<?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[Miscellaneous questions about &quot;BaseContainer&quot;,&quot;DescID&quot; etc]]></title><description><![CDATA[<p dir="auto">[I have so many questions in this thread. So first, please let me thank you for taking time! <img src="http://developers.maxon.net/forum/assets/plugins/nodebb-plugin-emoji/emoji/android/263a.png?v=0b8ddba251d" class="not-responsive emoji emoji-android emoji--relaxed" style="height:23px;width:auto;vertical-align:middle" title=":relaxed:" alt="☺" />]</p>
<p dir="auto">Hi,<br />
I want to access user data in a more "procedural way". Here is the code after I do lots of searching on the Python (and C++) SDK document:</p>
<pre><code class="language-Python">import c4d
from c4d import gui
#Welcome to the world of Python

def main():
    obj = doc.GetActiveObject()
    objBc = obj.GetData()
    
    userdataList = obj.GetUserDataContainer()

    userdata = userdataList[0]
    
    userdataBc = userdata[1]
    
    DescIDList = userdata[0]
    id0 = DescIDList[0].id
    id1 = DescIDList[1].id
    print(objBc[id0][id1])

if __name__=='__main__':
    main()
</code></pre>
<p dir="auto">After this, I really want to know how the data of a <code>BaseObject</code> organized and stored. And I make a picture:</p>
<p dir="auto"><img src="https://developers.maxon.net/forum/assets/uploads/files/1541682650114-basecontainer-resized.jpg" alt="0_1541682640524_BaseContainer.jpg" class=" img-fluid img-markdown" /></p>
<p dir="auto">I don't know if this reveals some of the data structure of <code>BaseObject</code>.</p>
<p dir="auto">And I have some doubts in or out of the picture:</p>
<ol>
<li>
<p dir="auto"><em>[In the picture]</em> After I search in the <code>BaseContainer</code> of <code>BaseObject</code>, I don't find anything data related to a <code>Userdata</code>: <code>long name</code>, <code>short name</code>, <code>min/max value/default value</code>, etc.<br />
Where is the <code>BaseContainer</code> of all these data stored?</p>
</li>
<li>
<p dir="auto"><em>[In the picture]</em> Is <code>DescID</code> is similar to  <code>UUID</code> of a <code>BaseContainer</code>? And where are they stored?</p>
</li>
<li>
<p dir="auto"><em>[In the picture]</em> What is <code>CreatorId</code> of <code>DescLevel</code>? I only find <code>0</code> in this field.</p>
</li>
<li>
<p dir="auto"><em>[Out the picture]</em> As for now, is there any easier way to get a <code>textual form</code> of <code>DescLevel.id</code> and <code>DescLevel.dtype</code>? Comparing and searching in branches of <code>*.h</code> files is not friendly for us without C++ experience.</p>
</li>
<li>
<p dir="auto"><em>[Off topic]</em> The name <code>index</code> in <a href="https://developers.maxon.net/docs/py/2023_2/modules/c4d/BaseContainer/index.html?highlight=basecontainer#BaseContainer.__iter__" target="_blank" rel="noopener noreferrer nofollow ugc">sample code</a> of <code>BaseContainer.__iter__()</code> in <code>Python SDK Document</code> is confusing. Especially that all other function documents refer the same thing as <code>id</code> on the same page.</p>
</li>
<li>
<p dir="auto"><em>[Off topic]</em> Is there any articles that have more detail about the <strong>foundation concepts</strong> for cinema 4d coding?<br />
Here I find some pages in <code>Python SDK Document</code>:<br />
<a href="https://developers.maxon.net/docs/py/2023_2/misc/cookbook.html" target="_blank" rel="noopener noreferrer nofollow ugc">Cookbook</a>, <a href="https://developers.maxon.net/docs/py/2023_2/misc/pluginstructure.html" target="_blank" rel="noopener noreferrer nofollow ugc">Plugin Structure</a>, <a href="https://developers.maxon.net/docs/py/2023_2/misc/general_gui.html" target="_blank" rel="noopener noreferrer nofollow ugc">Introduction into the GUI of Cinema 4D</a>.<br />
But they are <strong>lack of details and relation with other document</strong>.<br />
Also, some foundation concepts only have <strong>few</strong> introduction paragraphs:<br />
<a href="https://developers.maxon.net/docs/py/2023_2/modules/c4d/C4DAtom/GeListNode/BaseList2D/index.html" target="_blank" rel="noopener noreferrer nofollow ugc"><code>BaseList2D</code></a>,<a href="https://developers.maxon.net/docs/py/2023_2/modules/c4d/BaseContainer/index.html" target="_blank" rel="noopener noreferrer nofollow ugc"><code>BaseContainer</code></a>, etc.<br />
I don't mean to complain, but it's frustrating after spending hours and hours searching in the SDK and the Internet but only get some obscure results. I hope the document could be more friendly to new developers.</p>
</li>
</ol>
<p dir="auto">Thanks a lot!</p>
]]></description><link>http://developers.maxon.net/forum/topic/11128/miscellaneous-questions-about-basecontainer-descid-etc</link><generator>RSS for Node</generator><lastBuildDate>Tue, 08 Sep 2026 09:33:44 GMT</lastBuildDate><atom:link href="http://developers.maxon.net/forum/topic/11128.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 08 Nov 2018 14:47:31 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Miscellaneous questions about &quot;BaseContainer&quot;,&quot;DescID&quot; etc on Fri, 09 Nov 2018 14:03:50 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/forum/user/s_bach">@<bdi>s_bach</bdi></a>, thank you, I'll start to do some hard reading!</p>
]]></description><link>http://developers.maxon.net/forum/post/56325</link><guid isPermaLink="true">http://developers.maxon.net/forum/post/56325</guid><dc:creator><![CDATA[eZioPan]]></dc:creator><pubDate>Fri, 09 Nov 2018 14:03:50 GMT</pubDate></item><item><title><![CDATA[Reply to Miscellaneous questions about &quot;BaseContainer&quot;,&quot;DescID&quot; etc on Fri, 09 Nov 2018 10:23:36 GMT]]></title><description><![CDATA[<p dir="auto">Hello,</p>
<p dir="auto">An object like <a href="https://developers.maxon.net/docs/py/2023_2/modules/c4d/C4DAtom/GeListNode/BaseList2D/BaseObject/index.html?highlight=baseobject" target="_blank" rel="noopener noreferrer nofollow ugc">BaseObject</a> can store data. This data is typically stored in the object's <a href="https://developers.maxon.net/docs/py/2023_2/modules/c4d/BaseContainer/index.html?highlight=basecontainer" target="_blank" rel="noopener noreferrer nofollow ugc">BaseContainer</a>. But there are cases where the data is not stored in the BaseContainer so in general it is saver to use <a href="https://developers.maxon.net/docs/py/2023_2/modules/c4d/C4DAtom/index.html?highlight=getparameter#C4DAtom.GetParameter" target="_blank" rel="noopener noreferrer nofollow ugc">GetParameter()</a>.</p>
<p dir="auto">A BaseContainer can store any kind of data. This includes other BaseContainers. The BaseContainer of the object stores a sub-BaseContainer that stores all the values of the user data. The ID of the User-Data-BaseContainer is <a href="https://developers.maxon.net/docs/py/2023_2/modules/c4d/DescID/index.html?highlight=c4d%20id_userdata#c4d.ID_USERDATA" target="_blank" rel="noopener noreferrer nofollow ugc">c4d.ID_USERDATA</a>. Using this ID you can obtain the BaseContainer:</p>
<pre><code>bc = op.GetData()
userDataValues = bc[c4d.ID_USERDATA]

# or

userDataValues = op.GetParameter(c4d.ID_USERDATA, c4d.DESCFLAGS_GET_0)
</code></pre>
<p dir="auto">This BaseContainer stores the parameter values of user data parameters.</p>
<p dir="auto">A parameter is identified using a <a href="https://developers.maxon.net/docs/py/2023_2/modules/c4d/DescID/index.html?highlight=descid" target="_blank" rel="noopener noreferrer nofollow ugc">DescID</a>. This DescID has nothing to do with UUID.</p>
<p dir="auto">A DescID is composed of one or several <a href="https://developers.maxon.net/docs/py/2023_2/modules/c4d/DescLevel/index.html?highlight=desclevel" target="_blank" rel="noopener noreferrer nofollow ugc">DescLevel</a> components. In most cases the DescID has only one DescLevel. The DescLevel defines these properties:</p>
<ul>
<li><strong>id</strong>: id of the level. Typically the parameter ID.</li>
<li><strong>dtype</strong>: type of the parameter.</li>
<li><strong>creator</strong>: ID of the "creator" of the parameter. E.g. on a cube you have some parameters that were created by the "Cube" (Size, Segments, ...). But there are also other parameters that are shared by all BaseObject's (Position, Scale, ...). These shared parameters are inherited from a base class, in this case <em>Obase</em> (5155). The "creator" value is not always relevant so it might not always be set.</li>
</ul>
<p dir="auto">A DescID can have multiple DescLevels since a parameter may be stored inside another parameter. As described above, user data values are stored in a BaseContainer that is stored in the default BaseContainer. The full DescID of a user-data parameter has to reflect that. The DescID of a user-data parameter must first identify the user-data container and then the actual parameter in that container. This is done using two DescLevels:</p>
<pre><code>id = c4d.DescID(c4d.DescLevel(c4d.ID_USERDATA, c4d.DTYPE_SUBCONTAINER, 0), c4d.DescLevel(1))

value = op.GetParameter(id, c4d.DESCFLAGS_GET_0)
</code></pre>
<p dir="auto">But the Python API also allows you to do the same with less code:</p>
<pre><code>value = op[c4d.ID_USERDATA, 1]
</code></pre>
<p dir="auto">Or you access the user-data BaseContainer:</p>
<pre><code>bc = op.GetData()
userDataValues = bc[c4d.ID_USERDATA]
value = userData[1]
</code></pre>
<p dir="auto">The DescIDs are not necessarily stored in a file. The number of parameters of an object may change depending on how the object is used. The list of all displayed parameters is stored in the parameter Description. This Description contains the IDs as well as information on how to display the parameters in the <a href="https://help.maxon.net/us/#5821" target="_blank" rel="noopener noreferrer nofollow ugc">Attribute Manager</a>. The information how the parameter should be displayed is also stored as a BaseContainer (but this is NOT the object's BaseContainer).</p>
<p dir="auto">The parameter description of user data parameters is stored in the object. You can access this data with <a href="https://developers.maxon.net/docs/py/2023_2/modules/c4d/C4DAtom/GeListNode/BaseList2D/index.html?highlight=getuserdatacontainer#BaseList2D.GetUserDataContainer" target="_blank" rel="noopener noreferrer nofollow ugc">GetUserDataContainer()</a>:</p>
<pre><code>for id, descriptionBC in op.GetUserDataContainer():
	print("User Data ID: " + str(id))
	print("User Data Value: " + str(op[id]))
	print("User Data Name: " + descriptionBC[c4d.DESC_NAME])
</code></pre>
<p dir="auto">To make that clear: the <strong>VALUES</strong> of user data parameters are stored in the object's BaseContainer. The <strong>DESCRIPTION</strong> of the user data parameters is stored in the BaseContainers accessed with <code>GetUserDataContainer()</code>.</p>
<p dir="auto">You find an overview over the most fundamental concepts and classes currently in the C++ documentation under <a href="https://developers.maxon.net/docs/cpp/2023_2/page_maxonapi_foundations.html" target="_blank" rel="noopener noreferrer nofollow ugc">Foundations</a>, especially <a href="https://developers.maxon.net/docs/cpp/2023_2/page_maxonapi_legacy_base.html" target="_blank" rel="noopener noreferrer nofollow ugc">Classic API Base Classes</a>.</p>
<p dir="auto">You can also find further information about these classes:</p>
<ul>
<li><a href="https://developers.maxon.net/docs/py/2023_2/modules/c4d/BaseContainer/index.html?highlight=basecontainer" target="_blank" rel="noopener noreferrer nofollow ugc">BaseContainer</a>, <a href="https://developers.maxon.net/docs/cpp/2023_2/page_manual_basecontainer.html" target="_blank" rel="noopener noreferrer nofollow ugc">BaseContainer Manual</a></li>
<li><a href="https://developers.maxon.net/docs/py/2023_2/modules/c4d/DescID/index.html?highlight=descid" target="_blank" rel="noopener noreferrer nofollow ugc">DescID</a>,  <a href="https://developers.maxon.net/docs/cpp/2023_2/page_manual_descid.html" target="_blank" rel="noopener noreferrer nofollow ugc">DescID Manual</a></li>
<li><a href="https://developers.maxon.net/docs/cpp/2023_2/page_manual_userdata.html" target="_blank" rel="noopener noreferrer nofollow ugc">DynamicDescription Manual</a></li>
<li><a href="https://developers.maxon.net/docs/cpp/2023_2/page_manual_description.html" target="_blank" rel="noopener noreferrer nofollow ugc">Description Manual</a></li>
<li><a href="https://developers.maxon.net/docs/cpp/2023_2/page_manual_description_settings.html" target="_blank" rel="noopener noreferrer nofollow ugc">Description Settings Manual</a></li>
</ul>
<p dir="auto">best wishes,<br />
Sebastian</p>
]]></description><link>http://developers.maxon.net/forum/post/56323</link><guid isPermaLink="true">http://developers.maxon.net/forum/post/56323</guid><dc:creator><![CDATA[s_bach]]></dc:creator><pubDate>Fri, 09 Nov 2018 10:23:36 GMT</pubDate></item></channel></rss>