Skip to content

Instantly share code, notes, and snippets.

@bonsak
Last active August 29, 2015 13:56
Show Gist options
  • Select an option

  • Save bonsak/9100485 to your computer and use it in GitHub Desktop.

Select an option

Save bonsak/9100485 to your computer and use it in GitHub Desktop.
Iterate a c4d bascontainer
import c4d
def main():
bc = c4d.GetWorldContainer()
for index, value in bc:
# If value is "basecontainer"
print "Index: %i, Value: %s" % (index, str(value))
if bc.GetType(index) == 132:
print " Container: %i, Value: %s" % (index, str(value))
sub = bc.GetContainer(index)
for index, value in sub:
print " Subindex: %i, Value: %s" % (index, str(value))
if sub.GetType(index) == 132:
print " Subindex: %i, Value: %s" % (index, str(value))
if __name__=='__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment