Force InExclusionData update after remove object outside of In-/Exclusion User Data
-
Hi,
I have a very simple scene:- A
Null Objectwith anIn-/Exclusion User Data - A
Python Tagon theNull Object - some script in the
Python Tag
import c4d def main(): obj = op.GetObject() objList = obj[c4d.ID_USERDATA,1] # point to the In-/Exclusion User Data print(objList.GetObjectCount())If I add scene objects into
In-/Exclusion User Data, or remove object withinIn-/Exclusion User Data,Python Tagwill print correct object count.But if I remove an object from the
Object Managerwhich had been added into theIn-/Exclusion User Databefore, I can see object has been removed inIn-/Exclusion User Data, butPython Tagreport wrong object count (as if the object has not been removed).And only if I make some change within the
In-/Exclusion User Datadirectly, that thePython Tagreport correct count number again.I wonder if there is something I'm missing from the script for forcing
InExclusionDataupdate, or it's a bug in the "updating system"?Thanks!
- A
-
Hi,
The
InExcludeDataobject count does not always reflect the accurate number of valid objects depending on the scenarios.
Additionally to callingGetObjectCount()the returned value fromObjectFromIndex()should be checked if it's not None. -
Hi, y_puech!
Thank you for replying!
I usei = 0 while True: obj = InExData.ObjectFromIndex(doc,i) if obj == None: break i += 1to get right result.
-
Hi,
Just a quick note on your code. A pythonic solution could be:
count = inExData.GetObjectCount() for i in xrange(count): obj = inExData.ObjectFromIndex(doc, i) if obj is None: continueWhy are you breaking out from the loop with the first invalid object in the InExcludeData?
-
Oh! Sorry! I know what you mean in the previous post now. I'm doing the wrong way. Your solution is correct!
By the way, I wonder if there is a situation where the actual object counts are greater than GetObjectCount() returned?
-
By the way, I wonder if there is a situation where the actual object counts are greater than GetObjectCount() returned?
This should never happen.
Thanks for marking the topic as solved. Note that you can mark a specific post as the correct answer or solution. See step 5 in Q&A New Functionality.
-
Hi, @y_puech I may find a bug of the forum about "mark a post correct answer", discussion post here: Cannot mark post as answer
Once this bug solved, I will re-edit this topic and posts correctly.