PDA

View Full Version : go trought objects and add X


ChrRambow
11-06-2008, 10:59 PM
I got a problem with adjusting about 50 object in ypos.

I need to go trought the objects and add ypos about a calculated value...

For example:

obj1 = ypos(0)
obj2 = ypos(obj1) + valueX
obj3 = ypos(obj2) + valueX
.
.
.
obj50 = ypos(obj49) +valueX

Is that possible in Xpresso?

I tried to get it to work with Hierarchial Iteration but i ould not figure out on
how to get the ypos from the previous obj to add valueX .... and so on.

In the iteration Node is an option to get previous but i could not access ypos trought this.
It just print out an integer value.

Every tip is helpful....my experience is low ... because i am learning Coffee and C++ right now ... just for fun.

I am testing out my Idea in Coffee + Xpresso. So far everything is working really well.
Right now i am a littlebit too frighten for oop in c++ with the C4d Sdk.
First understand Coffee SDK ... then heading to c++.

Thanks to Base80 for helping with a Problem where i was stuck when creating objects with a CoffeeNode in Xpresso... sometimes you do not see small errors... and they will drive you nuts for serveral sleepless nights.

i hope someone knows a solution. Or maybe just a pointer to the right direction.

cheers,
Christian

Darter
11-06-2008, 11:39 PM
Here's a simple script for applying relative Y offsets. You can type in your own offset value.

if(!doc->GetActiveObject()) return;
var child = op->GetDown();
if(!child) return;

var offset = 210; // <-Change offset here
child = child->GetNext();

doc->StartUndo();

while(child)
{
var pos = child->GetPrev()->GetPosition();
doc->AddUndo(UNDO_CHANGE, child);
child->SetPosition(vector(pos.x, pos.y + offset, pos.z));
child = child->GetNext();
}

doc->EndUndo();

ChrRambow
11-10-2008, 08:42 AM
Thank you very very much for your help. :)

CGTalk Moderation
11-10-2008, 08:42 AM
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.