Cinema4D 2025 get user data value parameter not accessible?
-
It seems that triggering this logic in Cinema4D 2025 fails:
for description_id, base_container in obj.GetUserDataContainer(): key = base_container[c4d.DESC_NAME] value = obj[description_id]
Which did not error in Cinema4D 2023 and 2024.
With an error along the lines of:value = obj[description_id] ~~~^^^^^^^^^^^^^^^^ AttributeError: Parameter value not accessible (object unknown in Python)
Source issue reported here
Even though this same logic worked in Cinema4D 2023 and 2024.
Is this a regression, or does my code need updating?Could it be failing on trying to get a value from a Group, e.g. as one created here:
# Create the group group_bc = c4d.GetCustomDatatypeDefault(c4d.DTYPE_GROUP) group_bc[c4d.DESC_NAME] = group group_bc[c4d.DESC_SHORT_NAME] = group group_bc[c4d.DESC_TITLEBAR] = True group_bc[c4d.DESC_GUIOPEN] = False group_id = node.AddUserData(group_bc)
If so, how would I detect correctly which user data should be allowed to retrieve the values from?
-
Hey @BigRoy,
Thank you for reaching out to us. What Python is trying to tell you, is that the data type at this parameter is not wrapped for the Python API. Not every data type known to the Cinema 4D API, and there are probably hundreds when you count plugins, is exposed to Python.
The data types in the core Cinema API (i.e., things in what the Python API calls
c4d
) are mostly wrapped for Python (but there are also exceptions as for example ItemTreeData where the Python API has no clue what to do with such paramater). Redshift is for example a prime offender and has introduced many data types which are inaccessible in Python (at least as a whole).What you can however often do, when the author of the data type implemented it, is channel access. See here and here for examples. Since you do not show us what
description_id
is, I can only speculate here. My guess would be something from the "lower" section of the user data, as these types are all not wrapped (usually):I doubt that this is a regression, as this error is an intended feature of our API. It is more likely that you are now iterating over different user data than you did in 2023 and 2024. When you think differently, you would have to provide us a bit more information, specifically the data type and the scene file in which you are trying to iterate on some user data. I.e., just print out your
description_id
as this is a DescID, which will also contain type information.E.g.,
for descid, _ in op.GetUserDataContainer(): # You could also use C4Datom.GetParameter as this is a bit more elegant and does not need a try/catch: try: value = obj[descid] except: # Will print something like ((700, 5, 0), (1, 19, 0)) where the second triple is the actual parameter # (desc-level) and a desc level is composed as (ID, TYPE, CREATOR). I.e., the data type would be # 19 here, which is the value of `DTYPE_REAL`, i.e., a float parameter. When the data type integer # is a value in the millions, e.g., (1, 1234567, 0)), this is plugin data type from a third party. These # data types cannot be wrapped in Python (only component access works). print (descid)
So, long story short: The error is an intended feature. And when there would be a regression (which strikes me as quite unlikely), your code was always dagerous, as it assumes that you can read all parameter data types in Python (which you cannot). For details we would need the data type of the failing parameter and a scene file (when it is one of the native data types which are wrapped).
Cheers,
Ferdinand -
Thanks so much - of course, it may very well be that something in Cinema4D may just be generating more user data than I expected to live there. As such, I'll just perfectly ignore any values that couldn't be parsed since in my case I only care about those that I put there from Python to begin with.
Thanks for the quick and thorough reply.
-
Just to confirm - skipping the unwanted entries worked absolutely fine for my needs. And I was able to reproduce the behavior in Cinema4D 2023 too if I created such user data manually and tried to access it. So - no bug or regression, just my limited knowledge.
-
Good to hear!