PDA

View Full Version : access Clone Data...every parameter?


egon569
11-23-2010, 01:10 PM
Is there a way to control some parameter of objects in a cloner mograph via COFFEE effector?
for example to randomize each number text in a moText or create a sequenced number of moText based of the number of clones.
I needed it for creating a parametric sequence of doors number but I don't know COFFEE very well and so I did it manually ( not a big problem )
But now I'm curious to know the possibility of mograph.
Linking some parametric or randomize data of mograph effectors to any data of cloned object could be very interesting

I hope everything's clear..I'm not english :shrug:

thanks.

mark render
11-23-2010, 03:22 PM
i donīt know if i got you right exactly, but hereīs a simple setup to feed text with the cloner-index-numbers. no coffee needed by the way.
hope it helps.

egon569
11-23-2010, 04:00 PM
thanks.
but if I change the number of the cube cloner there's no change in the number.
Text Objects are not generated by any other parameter.

The possibilty of linking effector parameter to any data of any object will open, for me, a new mograph world.

for that reason I tried to use only MG and not editable objects.

mark render
11-23-2010, 04:25 PM
as far as i know you cant dynamically access the indices of a cloner within expresso. maybe you have to dive into coffee then.

Scott Ayers
11-23-2010, 05:52 PM
There are two Coffee Effector examples in the Cinema4D scripts section of this forum that should show you how to use it.
But if you don't understand how loops work. Then you might not understand them.

Iterating clones with the effector is all about looping through them. Then doing something with them once you've found them.
Here's the simplest Coffee Effector example I can think of to illustrate this concept: main(doc,op)
{
var md = GeGetMoData(op);
if (!md) return false;
var cnt = md->GetCount();
var marr = md->GetArray(MODATA_MATRIX);
var fall = md->GetFalloffs();

var i;
for(i = cnt-1; i >= 0; --i) // Loop through the available clones
{
var pos = marr[i]->GetV0();// Get their global positions
println("clone#", i,pos); //Print the clones positions to the coffee console
}
md->SetArray(MODATA_MATRIX, marr, true);
return true;
}

I have no idea what coding level you're at.
So if this code doesn't make sense to you. Then I would say the best thing to do is look through my Coffee Bible and play around with some of the "for loop" examples in it.

-ScottA

Per-Anders
11-23-2010, 08:05 PM
Just approach it the other way, use multiple objects being cloned and a randomizer (or whatever you want to control the clones) adjusting the Clone Index value. Or if you must then use an expression that's driven by userdata to set a number, have two clones with the min/max values and use the blend method to get as many clones with different values as you want.

egon569
11-24-2010, 11:13 AM
Iterating clones with the effector is all about looping through them. Then doing something with them once you've found them.

-ScottA

I started with your Coffee Bible ( thanks for your precious work ).
I can understand the meaning of Loop and I know I can iterate through clone.
but since my knowledge stops here, I'd like to know if, for example, I can iterate through cloned lights and access the colour or the area size or something else, not just position or matrix.
I'm starting with coffee so I'm sorry if I'm asking something too big for a beginner, but I'm very curious about that.

Scott Ayers
11-24-2010, 03:00 PM
Look in the "Containers" section in the Coffee Bible. Make sure you have the new .PDF version.
There's a couple of examples in it that show how to edit the color of a light.

Pretty much any attribute on an object can be controlled with Coffee.
The easiest way to do that is to drag the attribute you want to change into the script manager or the script log. And it will give you the ID for it that you'll use in your code.
If an attribute doesn't produce anything when it's dropped into those scripting windows. Then you have to create a base container from scratch. Then look up the attributes ID by hand.
I've included the list of all those ID's in my .zip file so you don't need to go hunting for it.

This is all incredibly simple stuff.
But like anything new. Until you do it a few times it's a bit overwhelming and confusing.
I have some beginner videos here: https://sites.google.com/site/scottayersmedia/scripting

-ScottA

egon569
11-24-2010, 05:54 PM
wow. a lot of videos to watch
I was always complaining about the lack of tutorials about coffee scripting :wip:
now it's time to start learning..no more excuses

thanks.

Scott Ayers
11-24-2010, 07:11 PM
They are very basic for people brand new to scripting. So you might already know most of what's covered in them.
The only reason I mentioned them here is because I think I showed dragging and dropping attributes to get their Id's in them.
My memory is so bad that I often even forget the stuff I invent and create myself. :)

-ScottA

CGTalk Moderation
11-24-2010, 07:11 PM
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.