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:
overrideNode.UpdateSceneNode(takeData, ID)
c4d.EventAdd()
Additional details:
* 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.
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 :)