Merging files with PLUGINFLAG_SCENELOADER_MERGEORIGINAL
-
Hello,
We recently noticed that when merging files through our scene file loaders in 2025 the colors on existing materials in the scene were changing. Our loaders just insert some objects/materials in the document we are provided with in ::Load(...) and are registered with PLUGINFLAG_SCENELOADER_MERGEORIGINAL which seems to be the problem. If I remember correctly we use it because of some problems with document scale when merging. Without it everything seems to work and I also noticed that PLUGINFLAG_SCENELOADER_HANDLES_COLOR_MANAGEMENT fixes it. However, I'm a bit confused now.... How do these flags cause the behavior we are seeing and why would other materials in the scene ever change when merging? And are these 2 flags a valid combination? -
Hey @bojidar,
Thank you for reaching out to us. Let me preface my answer that I do not have that much time this week. I will try to talk with Fritz when I have a bit more time.
This flag has been added with 2025.0.1 by Fritz in the wake of the 2025 OCIO changes. I think he added that in the wake of what he did for importing legacy colors, e.g., what has been reflected how colors are handled in NodeData::Init now, there is at least a version control commit description which heavily implies that ('fix loader double conversion').
And yes, you can mix that flag with
PLUGINFLAG_SCENELOADER_MERGEORIGINAL
our own Forger importer does that. The flag is used very rarely in our code base (only three hits). So, it strikes me mostly as a hack/fix for importers that do not yet do a more intricate (OCIO) color management. It looks so that when the flag is set, it will cause the color management settings (partially) being copied from the merged document into the resulting document. For the details I would have to talk with Fritz.Cheers,
Ferdinand -
Hey,
so I talked with Fritz, I got the direction right, but there are some relevant details. When you set the flag for an importer hook, it signals that you do not want Cinema 4D to carry out the automatic scene color conversion along the conversion path implied in the settings.
So, when you have a importer, and it does NOT set the flag, and you would import a scene with these settings:
Cinema 4D would transform all scene colors from
sRGB-2.1
to theRender Space
. When you DO set the flag, Cinema 4D will NOT do that, and the importer is expected to handle that.So, when you need to set this flag, this implicitly means that something with your scene data is not correct, they are not meant to be sRGB. You can of course also change the respective setting,
Raw
for example means as always no conversion. Without a bit more details about your scene data and its provenance, it is hard to give here good advice.Cheers,
FerdinandPS: I might update the Im/Exporter settings at some point, to handle custom cases, but the default should be to NOT to set the flag, and let the intended color management of Cinema 4D do its work.