<?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[Add custom attribute to Document]]></title><description><![CDATA[<p dir="auto"><em>On 01/08/2018 at 09:00, <strong>xxxxxxxx</strong> wrote:</em></p>
<p dir="auto">Hi guys, first time here !</p>
<p dir="auto">I do not know much about C4D at all (barely use it) but I need to integrate some of our tools in it.<br />
I am looking to insert custom data in the document, lets say FileId = 1 for example. Is there any way to do it ? I've looked through the docs and looked for info but it's pretty blurry how your supposed to do that, or if you even can. There seems to be a BaseContainer of some sort in the document, but I have no idea how to add arbitrary values to it.</p>
<p dir="auto">Thanks !</p>
]]></description><link>http://developers.maxon.net/forum/topic/10895/14344_add-custom-attribute-to-document</link><generator>RSS for Node</generator><lastBuildDate>Sun, 19 Jul 2026 07:07:26 GMT</lastBuildDate><atom:link href="http://developers.maxon.net/forum/topic/10895.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 01 Sep 2018 10:53:15 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Add custom attribute to Document on Sat, 01 Sep 2018 10:53:21 GMT]]></title><description><![CDATA[<p dir="auto"><em>On 07/08/2018 at 10:02, <strong>xxxxxxxx</strong> wrote:</em></p>
<p dir="auto">Thank you very much MaximeA ! That got me in the right direction ! I actually didn't realize there was a project object in C4D. When i got that i was able to add UserData to it, and it works like a charm.</p>
]]></description><link>http://developers.maxon.net/forum/post/55370</link><guid isPermaLink="true">http://developers.maxon.net/forum/post/55370</guid><dc:creator><![CDATA[Helper]]></dc:creator><pubDate>Sat, 01 Sep 2018 10:53:21 GMT</pubDate></item><item><title><![CDATA[Reply to Add custom attribute to Document on Sat, 01 Sep 2018 10:53:18 GMT]]></title><description><![CDATA[<p dir="auto"><em>On 02/08/2018 at 06:11, <strong>xxxxxxxx</strong> wrote:</em></p>
<p dir="auto">Hi Tuft, first of all, welcome in the PluginCafe forum!</p>
<p dir="auto">BaseDocument, like Objects, tag and pretty much everything a user can find in C4D inherit from <a href="https://developers.maxon.net/docs/py/2023_2/modules/c4d/C4DAtom/GeListNode/BaseList2D/index.html?highlight=baselist2d" target="_blank" rel="noopener noreferrer nofollow ugc">BaseList2D</a>, as you already found get a BaseContainer.<br />
<a href="https://developers.maxon.net/docs/py/2023_2/modules/c4d/BaseContainer/index.html?highlight=basecontainer" target="_blank" rel="noopener noreferrer nofollow ugc">A BaseContainer</a> is a kind of array (or a dictionary in python), where data are stored according to a given ID.<br />
The benefice of BaseContainer, is all data stored within are part of the BaseList2D (so the object, tag, document) and they are automatically saved, read when you save/load a file.<br />
For more information, you can read <a href="https://developers.maxon.net/docs/cpp/2023_2/page_manual_basecontainer.html" target="_blank" rel="noopener noreferrer nofollow ugc">the C++ manual about BaseContainer.</a></p>
<p dir="auto">Now regarding your question, you can easily add data to the BaseContainer of the document.<br />
Since you don't want to override your parameter or other plugins to override your entry, you should get a unique ID <code>here</code>[URL-REMOVED].</p>
<p dir="auto">Now you can do something like that</p>
<pre><code>YourUniqueId = 1000001
  
# Get an Instance of the BaseContainer (that mean all changes are directly made in the document)
bc = doc.GetDataInstance()
bc[YourUniqueId] = 10 # Set the value
  
print bc[YourUniqueId] # Read the value
</code></pre>
<p dir="auto">If you have more than one value it's recommended to create a BaseContainer with all your data and then store this BaseCcontainer within the BaseContainer of the document with your unique ID.</p>
<p dir="auto">The BaseContainer principle applies to everything, but if you want to attach data to a specific object, you can also create a Tag, depending on your need, but please let me know if you have any questions!</p>
<p dir="auto">Cheers,<br />
Maxime</p>
<hr />
<p dir="auto">[URL-REMOVED] <a class="plugin-mentions-user plugin-mentions-a" href="/forum/user/maxon">@<bdi>maxon</bdi></a>: This section contained a non-resolving link which has been removed.</p>
]]></description><link>http://developers.maxon.net/forum/post/55369</link><guid isPermaLink="true">http://developers.maxon.net/forum/post/55369</guid><dc:creator><![CDATA[Helper]]></dc:creator><pubDate>Sat, 01 Sep 2018 10:53:18 GMT</pubDate></item></channel></rss>