[C4D Python] Script for get all objects in the document or under a xref

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

Thread Tools Display Modes
  03 March 2018
[C4D Python] Script for get all objects in the document or under a xref

Hi there,

this is Steffen from Germany. On my recent project I need a little help with a hopefully easy way to solve.

I am using the order doc.GetObjects()
My problem is, that it only get objects without children. Is there a similar order for getting:
- all objects in the document?
- all objects within a specific folder/xref?

Reason is, that I will apply a source file through a xref with many nodes. The nodes are named by materials and that materials should be applied automatically. The last part is not a problem, only the first thing that doc.GetObjects() is taking only the first parents in the scene.

Would appreciate if someone could help.

  03 March 2018
You need to cycle through all your obkects,

This should do the trick,

But it would be splendid if Maxon implemented a dedicated python function for this dayly task ...
R19 Visualize - Flickr Album - Website
  03 March 2018
What I did now: I cycled through all objects, selected all polygon objects in a list. Works fine so far.

Next I wanted to apply the materials with the same name to the objects. Worked as well good. The problem was, that if I apply the script another time, it applies the materials another time.
So my plan was, first to delete the existing material tags.

Then for each polygon object, I created a list of my tags. For each step I printed a result, to check, where my problem is.

I have 18 poly objects in my objList. It prints "18 objects selected"

In my test file I have applied 6 materials to each poly objects. No other tags visible. But it prints "8 tags selected".
So I printed the tag list itself. It showed beside six texture tags a polygon tag and a point tag. So my for loop stops in the moment when there is no texture tag anymore but the list shows still two objects remaining .

Can someone help me to separate the texture tags from those other ones?

reply share thread

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Society of Digital Artists

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump

All times are GMT. The time now is 12:30 AM.

Powered by vBulletin
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.