Skip to content

Instantly share code, notes, and snippets.

@MikeUdin
Last active January 5, 2017 12:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MikeUdin/cfb487bb26b499529ccaf6d4e13571fd to your computer and use it in GitHub Desktop.
Save MikeUdin/cfb487bb26b499529ccaf6d4e13571fd to your computer and use it in GitHub Desktop.
Select instaces with same reference object
import c4d
# Check out tutoral here
# http://mikeudin.net/2017/01/05/cinema-4d-python-recursive-hierarchy-iteration/
def recur_iter(obj,ref):
while obj:
if obj[c4d.INSTANCEOBJECT_LINK] == ref:
obj.SetBit(c4d.BIT_ACTIVE)
recur_iter(obj.GetDown(),ref)
obj = obj.GetNext()
def main():
ref = op[c4d.INSTANCEOBJECT_LINK]
recur_iter(doc.GetFirstObject(),ref)
c4d.EventAdd()
if __name__=='__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment