On 21/05/2018 at 19:00, xxxxxxxx wrote:
Hi folks, I'm having problems successfully creating a take override for user data on a list of objects. Code below.
When the code is run...
* It completes without error
* Overrides for the selected models are indeed created for the the selected take
* But they don't seem to work: their values in the Take Manager are empty
* And even stranger, clicking the Take in the Take Manager exhibits very odd behavior. E.g. The Take effects do seem to activate (e.g. the correct layers are solo'd), but the icon does not highlight, and the solo'd layers cannot be un-solo'd. See follow up post below for details and screen cap.
I suspect that FindOrAddOverrideParam doesn't like the DescID I'm providing, as it returns None. Conversely I'm creating overrides elsewhere in this script (to solo layers, for example) without problems. This is the only place I'm trying to 1) get DescID for user data, and 2) get DescID for two DescLevels deep, so I suspect that's where I'm going wrong.
def SetModelModeOverrides(take, models) :
doc = c4d.documents.GetActiveDocument()
takeData = doc.GetTakeData()
ID = c4d.DescID(c4d.DescLevel(c4d.ID_USERDATA), c4d.DescLevel(11, c4d.DTYPE_LONG, 0))
newValue = 0
for model in models:
overrideNode = take.FindOrAddOverrideParam(takeData, model, ID, newValue)
print model # Prints <c4d.BaseObject object called ... >
print ID # Prints ((700, 0, 0), (11, 15, 0))
print overrideNode # Prints None
if overrideNode is not None:
* User data data type is integer, with Quicktab Radio interface, and ID 11
* I can successfully modify said user data via model[c4d.ID_USERDATA,11] = 3
* User data lives on nulls brought in as non-encapsulated Xrefs
* I'm on R19, macOS 10.13.3
* There are no problems with rest of the script, which automates the setup of layers, takes, comp tags, and render settings.
model[c4d.ID_USERDATA,11] = 3
Any suggestions would be hugely appreciated! This is my first time working with Python in C4D and this forum has been a god-send so far
On 21/05/2018 at 19:48, xxxxxxxx wrote:
The part that I find most strange is that take.FindOrAddOverrideParam seems to return None, and so you'd think it would have no effect, but the overrides are indeed created in the Take, and for the correct objects / properties no less. It's just that their values are empty, and that the Take can't be selected. Or—even more odd—I can click on it, and it has _some_ effect (the right layers are solo'd), but the icon does not highlight, and subsequently clicking on other takes does not un-solo the layers. Screencap tells the tale, here: https://www.dropbox.com/s/gaqydgh9qouoreh/python-problems.gif?dl=0
In aggregate this is making me wonder if I'm hitting C4D bugs.
On 22/05/2018 at 09:27, xxxxxxxx wrote:
First of all welcome at PluginCafe JoshCarpenter.
After few tests it's looks like to to write the full desclevel make it working, so
c4d.DescID(c4d.DescLevel(c4d.ID_USERDATA), c4d.DescLevel(11, c4d.DTYPE_LONG, 0))
c4d.DescID(c4d.DescLevel(c4d.ID_USERDATA, c4d.DTYPE_SUBCONTAINER, 0), c4d.DescLevel(11, c4d.DTYPE_LONG, 0))
works well here even when parameters are not allowed to be modified in the Xref.
If you have any questions do not hesitate.
On 22/05/2018 at 11:56, xxxxxxxx wrote:
Outstanding; that works! I'm glad it was something trivial like that Thanks so much!