[Closed] node reference
Somebody knows how to refer to a node even if the name change?
I know you can use controller script to refer to nodes and don’t worry about nodes names.
in the max script help i found this
id = $Box01.handle
you don’t have problems with names, but what happens if i want to import the node to another scene?
Maybe you could refer to an node through a controller script, but i dint found any info on that
If this is in a script controller then you can add variables in the script controller and add reference to a node through it. This will make it name independent. Using the ID will not work as it will change once merged with another scene.
Thanks Paul, so the only way to make name independent its through script controller .
its possible to create and access this variables with MaxScript?
I want to be able to duplicate an object with a custattribute that refer to himself
something like this
...
rollout pierna ""
(
spinner val "" fieldWidth:40
button theButton "Press"
on theButton pressed do
(
rollout test_buttons "Testing Buttons"
(
spinner valout "" fieldWidth:40 controller:$Object.modifiers[#Attribute_Holder].Controlpiernas.val.controller
)
createDialog test_buttons 150 50
)
...
If you are looking at custom Attributes then you can have a look at weak referencing that uses maxObject as the type for the parameter. You can also store a node how ever based on what you have said you will need the weak reference.
thanks again Paul !
i found this article in your site that explains everything
http://paulneale.com/tutorials/Scripting/weakReferences/weakReferences.htm
thanks again
That is old and assumes that you are using the old script controller. Make note of the changes to it if you are in Max 9 or higher.
What problems can i have by using this? :
[size=1]$.scale.controller= scale_script()
$.scale.controller.addNode “MyNode” $
[/size]and then to access that node i use
[size=1]$.scale.controller.getnode “MyNode”
[/size]