View Full Version : Capturing the cluster name during scripting
rhythmone 03-07-2003, 04:46 AM Its been a long day.... I am writing a script that creates a cluster and I am trying to capture the name that gets created so that I can rename it in the same pass.... any thoughts?
from the script editor ---
build_spline ("test");
newCluster " -envelope 1";
// Result: cluster3 cluster3Handle //
and here is the relavant part of my script
$cluster_name[] = `CreateCluster`;
//rename ($cluster_name[0]) ($crv_name + "_cluster");
//rename ($cluster_name[1]) ($crv_name + "_handle");
print ($cluster_name[0]);
It doesn't print anything as I believe that there is no returning val so.....I also tried using "newCluster -envelope1" as the command because it looks like it actually has the returning value but no go.......
|
|
lostpencil
03-07-2003, 05:47 AM
I think the mel command you want is cluster, select a CV on a spline and then try this:
string $my_name[] = `cluster`;
print $my_name[0];
rhythmone
03-07-2003, 06:01 AM
YOU ROCK!!! :thumbsup:
BTW - "string $my_array"
.... so that just specifies that this array is made up of string types, right?
.... does that mean that I could also do this "int $my_integer_array"
.... and what if I don't specify the type? is string the default, or does it depend on the type of data that is coming back.
ps - I usually understand short answers... so don't feel the need to over-elaborate... I am greatful with whatever info I can get:p
rhythmone
03-07-2003, 06:04 AM
sorry - left the brackets off of all those.... meant to say "string $my_array[]" ..... etc....
lostpencil
03-07-2003, 06:12 AM
:) Oops.. you are right.. the name should fit better... I just did a quick test :surprised
.... so that just specifies that this array is made up of string types, right?
Yes.
.... does that mean that I could also do this "int $my_integer_array"
Yes, you could create an array of integers like so:
int $test[10];
for ($i=0; $i<=10; $i++)
{
$test[$i] = $i;
print ($test[$i] + "\n");
};
.... and what if I don't specify the type? is string the default, or does it depend on the type of data that is coming back.
The first time you assign something to it, that something will define the data type. I just like to use it for clarity.
wrend
03-07-2003, 06:16 AM
also you can name straight up:
cluster -name/n poiesis
:)
rhythmone
03-07-2003, 06:30 AM
also you can name straight up:
cluster -name/n poiesis
thanks .... funny how somtimes we overlook the completely obvious
lostpencil
03-07-2003, 07:42 AM
Yeah! What Wrend said!... even...
CGTalk Moderation
01-14-2006, 02:00 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.
vBulletin v3.0.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.