Your browser does not seem to support JavaScript. As a result, your viewing experience will be diminished, and you have been placed in read-only mode.
Please download a browser that supports JavaScript, or enable it if it's disabled (i.e. NoScript).
On 10/10/2014 at 20:38, xxxxxxxx wrote:
User Information: Cinema 4D Version: R16 Platform: Mac OSX ; Language(s) :
--------- Inserting or deleting objects from an Include/Exclude is not working.
Tried making a new InExcludeData() and replacing my light data with it. Still doesn't work.
testInEx = c4d.InExcludeData() testInEx.InsertObject(op, 1) op[c4d.LIGHT_EXCLUSION_LIST] = testInEx
On 11/10/2014 at 08:31, xxxxxxxx wrote:
It should work. But you didn't really post much code. I'm guessing this is what you're trying to do?:
#This script gets all of the selected objects #Then creates an area light and inserts the objects into the light's InExclude attribute import c4d def main() : objs = doc.GetActiveObjects(True) #Get all active objects and their children light = c4d.BaseObject(c4d.Olight) #Create a new light object light[c4d.LIGHT_TYPE] = 8 #Set it's type to area doc.InsertObject(light) #Insert the light into the scene inexclude = c4d.InExcludeData() #Create an InExcludeData class instance for obj in objs: inexclude.InsertObject(obj,15) #Insert all active objects into the InExclude data list #15 is a flag used to make all items selected in the InExclude data attribute obj.InsertUnder(light) #Move the objects under the newly created light light[c4d.LIGHT_EXCLUSION_LIST] = inexclude #Update the changes made to the InExclude data list c4d.EventAdd() if __name__=='__main__': main()
-ScottA
On 11/10/2014 at 09:52, xxxxxxxx wrote:
It works with that code.
However, I shouldn't have to make a InExcludeData class. I should be able to modify objects in the current one. Heres an example of my situation.
import c4d def main() : obj = op #Get current object tag = obj.GetTag(1033673) #get tag that contains the Incude/Exclude nextObj = obj.GetNext() #get the object below the current object inc = tag[c4d.INCLUDEEXCLUDE] #get the include/exclude from the tag inc.InsertObject(nextObj,15) #insert object on tags include/exclude c4d.EventAdd() if __name__=='__main__': main()
On 03/11/2014 at 15:59, xxxxxxxx wrote:
Hi,
I guess you just need to write it back to your inexcludelist like:
import c4d def main() : obj = op #Get current object tag = obj.GetTag(1033673) #get tag that contains the Incude/Exclude nextObj = obj.GetNext() #get the object below the current object inc = tag[c4d.INCLUDEEXCLUDE] #get the include/exclude from the tag inc.InsertObject(nextObj,15) #insert object on tags include/exclude #here you update your inexclude list tag[c4d.INCLUDEEXCLUDE]= inc c4d.EventAdd() if __name__=='__main__': main()
Best wishes Martin