<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Best place to do version conversion for scenes and assets]]></title><description><![CDATA[<p dir="auto">I have a couple of MaterialData plugins that have input ports/pins that have changed in functionality. In order to make old scenes/materials work, I need to insert a ShaderData plugin inbetween the existing MaterialData port and whatever ShaderData is already connected to that port.</p>
<p dir="auto">The documentation seems to suggest that versioning should be done at the NodeData::Read function, however this does not seem to be the right place as the gelistnode graph does not seem to be guaranteed to be fully instatiated when this function is called - which makes it a bad fit for changing the graph.</p>
<p dir="auto">Aside from that I cannot find where I am supposed to do this type of version conversion.</p>
]]></description><link>http://developers.maxon.net/forum/topic/16349/best-place-to-do-version-conversion-for-scenes-and-assets</link><generator>RSS for Node</generator><lastBuildDate>Mon, 20 Apr 2026 18:46:49 GMT</lastBuildDate><atom:link href="http://developers.maxon.net/forum/topic/16349.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 10 Nov 2025 11:44:37 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Best place to do version conversion for scenes and assets on Mon, 10 Nov 2025 19:30:38 GMT]]></title><description><![CDATA[<p dir="auto">Hey <a class="plugin-mentions-user plugin-mentions-a" href="/forum/user/echekman">@<bdi>ECHekman</bdi></a>,</p>
<p dir="auto">Thank you for your question. This is a tricky one. When <code>NodeData::Read</code> is emitted, Cinema 4D is currently reading a file and in the process of deserializing your node; so it indeed is not yet <em>'fully instantiated'</em>, as that is the whole point of the method. You are here not meant to manipulate the scene graph (the node is not yet attached), but read and store data on your plugin hook. I.e., you are supposed to do something with your <code>MyMaterialData</code> and not the <code>GeListNode/BaseMaterial</code> which is being passed in as the first argument of <code>Read</code>.</p>
<p dir="auto">The common workflow is to read data from the <code>HyperFile</code> which is passed in and store it on your <code>NodeData</code> instance. Passed in is also the important version number (which is called for some odd reason <code>disklevel</code>) of your <code>HyperFile</code> container.</p>
<p dir="auto">As always, you are bound to the main thread for scene graph manipulations. So, <code>NodeData::Init</code> is not a good candidate when wanting to poke around in the scene graph, as it can be called off main thread and on dettached dummy nodes. A good approach is to hook into <code>NodeData::Message</code> and listen for <a href="https://developers.maxon.net/docs/cpp/2026_0_0/group___m_s_g.html#ga997eaf2f722ddd1ec7f5898b44189928" target="_blank" rel="noopener noreferrer nofollow ugc">MSG_DOCUMENTINFO</a> to catch a document just having been loaded. This is for your specific case of wanting to manipulate nodes which have been deserialized. If you want to manipulate node instantiation, <code>MSG_MENUPREPARE</code> is a god choice. But it is only called for nodes which have been instantiated from direct user interactions such as a menu click. So, <code>MSG_MENUPREPARE</code> is not being emitted for nodes loaded from a file.</p>
<p dir="auto">The drill to do what you want to do would be:</p>
<ol>
<li>[optional] Overwrite <code>NodeData::Read/Write/CopyTo</code> to read, write, and copy custom data, and possibly use/detect different disk levels to catch different versions of a node type being loaded. You would have to match this with incrementing the disk level in your <a href="https://developers.maxon.net/docs/cpp/2026_0_0/namespacecinema.html#aab7a6153124d7fe825737eb3faf84997" target="_blank" rel="noopener noreferrer nofollow ugc">RegisterMaterialPlugin</a> call, so that there are <em>old</em> and <em>new</em> versions of your material type out there.</li>
<li>Hook into the document being loaded, check the scene state, and possible data left behind for you by <code>NodeData::Read</code> and <code>::Init</code>.</li>
<li>Manipulate the scene graph to your liking.</li>
</ol>
<p dir="auto">Cheers,<br />
Ferdinand</p>
]]></description><link>http://developers.maxon.net/forum/post/76922</link><guid isPermaLink="true">http://developers.maxon.net/forum/post/76922</guid><dc:creator><![CDATA[ferdinand]]></dc:creator><pubDate>Mon, 10 Nov 2025 19:30:38 GMT</pubDate></item></channel></rss>