Adding object to In/Exclusion List
-
On 05/10/2017 at 11:58, xxxxxxxx wrote:
I'm trying to create a null and add it to an in/exclusion list. The list is in the user data of an xpresso tag. This will be run off of a script. I have this code so far:
import c4d
from c4d import gui, utilsdef main() :
document = doc
tagowner = doc.SearchObject('StageLightMaster')
xtag = tagowner.GetFirstTag()
LinkList = xtag[c4d.ID_USERDATA,1]
NullMaster = c4d.BaseObject(5140)
document.InsertObject(NullMaster)
LinkList.InsertObject(NullMaster,1)
c4d.EventAdd()
if __name__=='__main__':
main()I can run a count before and after the object is added and it seems to be running properly, but when I go to the list in the tag it is not updated to include the null. I read somewhere that I need to update the gui object for the changes to take place, but I'm not sure how to call it. Any help is greatly appreciated! Thanks!
-
On 06/10/2017 at 02:05, xxxxxxxx wrote:
Add
xtag[c4d.ID_USERDATA,1] = LinkList
Before your EventaAdd().
If we go step by step in your program here is what happend.
mport c4d from c4d import gui, utils def main() : #Get the obj document = doc tagowner = doc.SearchObject('StageLightMaster') #Get the tag xtag = tagowner.GetFirstTag() #Get a copy in memory of xtag[c4d.ID_USERDATA,1] LinkList = xtag[c4d.ID_USERDATA,1] #Create in memory a new object an copy it to NullMaster NullMaster = c4d.BaseObject(5140) #Insert The the object into the document document.InsertObject(NullMaster) #Insert the object into your linklist variable which is a copy in memory of the userdata LinkList.InsertObject(NullMaster,1) #Trigger an event c4d.EventAdd() if __name__=='__main__': main()
So as you see you only change value on memory so you need to push back into the object
-
On 06/10/2017 at 02:05, xxxxxxxx wrote:
Hi and Welcome to the Plugin Cafe forums!
LinkList in your script (retrieved with xtag[c4d.ID_USERDATA,1]) is a copy of the actual in/exclusion user data.
So it has to be assigned to xtag[c4d.ID_USERDATA,1], after inserting the null object, for the in/exclusion user data to be updated in the GUI. -
On 06/10/2017 at 05:40, xxxxxxxx wrote:
Well you guys are just awesome! Thanks for explaining the logic behind the solution this helps me out tremendously.