@m_magalhaes said in Avoiding invalidating saved scenes when implementing Read/Write:
Some remark about your code, you can use maxon::Uuid instead of C4DUuid look at that manual for more information.
I guess it would've been helpful to mention that earlier, but I'm "stuck" at R16 and as far as I know, that's not yet implemented in this version.
You don't need to return SUPER::Write
you can simply return true or false.
Oh well that's actually something I "corrected" after I began this thread. I saw that in an example for HyperFile
handling so I just repeated it.
I still cannot reproduce your issue.
Well that's weird. I created a new document within Cinema, only added a single Sphere object, and even without any data within my SceneHook
I can reproduce this issue. So essentially, my code executes two things:
hf->WriteUInt32(0);
/* code that won't be executed anyway */
hf->WriteUuid(C4DUuid());
Which seems to be enough to invalidate the scene file without the plug-in installed.
Lo and behold! What seems to be the problem (in my case, anyway) is writing the C4DUuid
last, because writing just the UInt32
doesn't cause any problem.
EDIT: fixed some words/typos