[Closed] make unique
Hi all,
Hi strongly suspect that the following question only shows my misundertanding of some basic max script fundamentals :
Does anyone knows how to duplicate the “make unique” tool that de-instanciate objects ?
there is a copy method, in the documentation :
$foo.rotation.controller = copy $foo.rotation.controller makes the $foo rotation controller unique.
… but I do not know how to apply it to the base, or modified object ?
Jerome
Hiya Jerome,
Well, I guess if you did copy it and delete the original, you’ve essential made it unique! but, there are a few things you can do with the Instancemgr interface
[left]
[/left]
[left]i=instancemgr -- the instance manager[/left]
[left]i.getinstances $ &x -- get all instances[/left]
[left]select x -- select the new array[/left]
[left][size=2]if (i.CanMakeObjectsUnique x[1]) then (i.MakeObjectsUnique &x[1] #prompt) -- make the first object unique[/left]
[/size][left]
[/left]
[left]have a read about it in the help file.[/left]
[left]Hope this is useful![/left]
[left]Josh.[/left]
haha, good remark So simple, I even did not think of it. But like some others have said : “why do it the simple way when you can do it the complicated way ?”
But the real reason why I did not chose the simple way is that I want to understand how things works, just to learn…
[left]… And I must say I got what I wanted ! Not only it does exactly what I needed, but I also I get to learn about all those “interface”things . I was thinking all this rubric of the help file was about the MAX interface, and you make me discover a full box of candies !
It is , definitly ! Thank a lot !
Jerome
Check out the MakeObjectUnique script here:
http://www.neilblevins.com/soulburnscripts/soulburnscripts.htm
Either use the script or feel free to use the code if you’re building it into some other script.
- Neil
Thanks Neil, I’ll have a look at it. I need to include in another script.
Jerome
In the documentation for the Instancemgr interface there is this part of syntax:
<&node array>
I must admit: I never saw the & before – can please somebody tell we what it is, as I can’t find a explantion in the help file.
Is this a pointer or a hash or …?
Georg
Jerome,
There was a great discussion about instances and refernces on the discreet webboard sometime ago, I don’t know if this link will work but you will find some interesting things there.
http://support.discreet.com/webboard/wbpx.dll/read?226907,15e#226907
The Ampersand (&) is a referencing operator. It is quite hard to find in the help but search for dereferencing (*) in the help and you’re going along the right path. Essentially it is for referencing an array element (as in this case) or a property or variable. You can then pass this reference to a function and it will be treated directly as the original. the dereferencing operator (*) is used to return it to it’s original value.
b=box()
x=&b.pos
x.controller
*x.controller
You can use it to pass a by reference parameter for a function to return multiple results.
This is a bit of a crap example but:
fn testsize norm mult limit &tot=
(
tot=norm*mult
if tot>limit then return true else return false
)
m=2
n=5
l=8
ol=testsize n m l &total
format "oversize = % at % units
" ol total
[size=2]
[/size]
When I can understand it a bit better, I’ll explain it a bit better ;>
Cheers,
Josh.