MergeDocument() crash C4D
-
Hi,
c4d.documents.MergeDocument(doc, path_str,c4d.SCENEFILTER_OBJECTS | c4d.SCENEFILTER_MATERIALS,None)this code,c4d always crashed
-
Hi, @chuanzhen
This code runs fine on my end (Cinema 4D 2026.3.4). Analyzing the cause of the failure may require more detailed information, such as the Cinema 4D version number and the real path (path resolution may occur), and corruption of the path_str file is also one possibility.
Cheers,
Anlv -
@Anlv Hi
Here is a video demonstrating how C4D crashes. For a saved document (or a loaded document), using MergeDocument() is fine, but for a new document that hasn't been saved, using MergeDocument() will definitely crash
2026.3.3 win11
-
Hi, @chuanzhen
I tested the same code as you in both saved projects and unsaved new documents, but no crash occurred. This might be a bug, possibly related to the ObjectData plugin in your project. I can't be certain that's the cause. You could try ruling out the plugin's influence first. But this is beyond my capability, so let's wait for more professional personnel to help.
Cheers,
Anlv -
@Anlv Thanks for your reply.can't reproduce this issue on your side, it seems I need to test it on other computers. It's a puzzling problem
-
Hey @chuanzhen,
we will need both the scene you are merging and merging into to make here any sensible statement. We will also need more than this one sole line of code.
And while a crash always indicates that we could do something better, my hunch would be that that fault lies mostly with some plugin. Because Cinema itself uses heavily
MergeDocumentand if there would be a principal bug with the very common flagsc4d.SCENEFILTER_OBJECTS | c4d.SCENEFILTER_MATERIALS, we would have found and fixed it before.The first thing that comes to mind with your line of code is that you are off-main thread and then run into problems because you try to let the code run on the MT by passing
Noneforthread. But off-main-thread, merging documents would be a bit unusual (and also illegal if one of the participating documents is a loaded document). You can usec4d.threading.GeGetCurrentThread()to get the current thread and pass it forthread.Another cause could be some
NodeDataplugin which holds data outside of its data container and which does not correctly serialize that extra data (does not implementNodeData::Read,::Write, and::CopyTo) which can then lead to crashes when Cinema tries to run the merged scene with only partially copied node data (assuming the plugin in questions also fails to do sanity/existence checks on its internal extra data).Cheers,
Ferdinand