XPresso Basics

Become a member of the CGSociety

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

Thread Tools Search this Thread Display Modes
  03 March 2013
XPresso Basics

I want to have each child of a group match the PSR of another group. I know it has something to do with the iteration or hierarchy nodes, but I can never quite grock how the those nodes work.

Attached is a simple scene to illustrate my failed attempt. How can I get the cubes to match the PSR of the spheres, using XPresso only?
Any takers?

  03 March 2013
what about something like this :

The Hierarchy Node refers to Group1 and the LinkList Node contains the 4 Cubes :

  03 March 2013
OK. So it seems this works only if I drag all the cubes into the link list field.
I am looking for a way for the XPresso tag to see into the group on it's own...

Last edited by JeremyW : 03 March 2013 at 12:46 AM.
  03 March 2013
To show how literal Python can be:
(Paste into a Py expression tag placed on "Group 1" Null)

import c4d
#Welcome to the world of Python

def main():
    group1 = op.GetObject()
    group2 = group1.GetNext()
    group1children = group1.GetChildren()
    group2children = group2.GetChildren()
    for i in xrange(len(group1children)):

MSA | OSX | xfiles ...Cinema4D Tools
  03 March 2013
That works nicely. Thanks.
I'm still wanting to learn how to do it with Xpresso.
  03 March 2013
I may be too tired to come up with something that's elegant and easy, but if you really need to keep it xpresso, you could put some of the functionality in a Python Node.

You could, for example, auto-fill up the LinkList in my previous screenshot with the children of Group2.

Read this topic and use the code from Tim / Lennart @ http://forums.cgsociety.org/showthread.php?t=978208

This screenshot also uses the Object Node trick to reference the LinkList Node, which allows you to access the Link List Parameter.

  03 March 2013

some nice suggestions here, I'll need to take a look at those python codes

However if you want to make it strictly with xpresso, hierarchy nodes won't cut it since you can't iterate a hierarchy within a hierarchy currently.

But what you could do is use the Link List nodes, and add the objects in the lists. Make a comparison so when the Index is the same, they will match their PSR.
  03 March 2013
Originally Posted by douwe: I may be too tired to come up with something that's elegant and easy

This looks like a perfectly elegant approach, as does Lennart's. Both of these solutions have the advantage of being able to dynamically adapt to changes in the number of objects.

The Reference node can also be used to find the objects in the second group. This setup has to be modified if the object count changes:

Replacing the Condition node with a Python node automatically allows for changes in the object count:

These are no better than the other solutions but may contribute to understanding how things work.
  03 March 2013
Thread automatically closed

This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
Thread Closed 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 02:11 AM.

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