On 15/01/2016 at 08:48, xxxxxxxx wrote:
Hey all,
I'm having a weird issue. I'm trying to make a custom selection in a specific order, but when using the call doc.SetActiveObject(o, c4d.SELECTION_ADD), it doesn't add properly..
For an example, make 4 objects in your document named "1", "2", "3", and "4". Now run this script.
def main() :
for index, name in enumerate([2,1,4,3]) : # Random order for testing
obj = doc.SearchObject(str(name))
if index == 0:
doc.SetActiveObject(obj, c4d.SELECTION_NEW) # new selection for the first object
continue
doc.SetActiveObject(obj, c4d.SELECTION_ADD)
c4d.EventAdd()
newSelection = doc.GetActiveObjects(c4d.GETACTIVEOBJECTFLAGS_SELECTIONORDER)
print [o.GetName() for o in newSelection] # print new selection. It's wrong
if __name__=='__main__':
main()
It's just a random order, and not the order I want. Any ideas?