Notifications
Clear all

[Closed] Parenting by pickbutton

Hi:
We have : 1_ a pickbutton in attribute holder. 2_we have A and B object in the scene.When i pick B object by pickbutton i want pickbutton link A to B.

Thanks anyway

31 Replies

Hope i understood you, copy the part you need from here:

if $ != Undefined then 
   ( 
   	DEF=Attributes LinkAttrib 
   	( 
   		Rollout LinkRoll "Link A to B" 
   		( 
   			Local Obj_A = $Teapot001 --Replace this with your Obj A
   			Fn filt Obj_B =  Obj_B != Obj_A
   			Pickbutton pckBtn "Pick Obj B" filter:filt
   			On pckBtn picked Obj_B  do 
   			(
   				Obj_A.parent = Obj_B
   				select Obj_B
   			)	
   		) 
   	) 
   	EmpMod=emptyModifier() 
   	EmpMod.name="Link A to B"
   	addModifier $ EmpMod
   	custAttributes.add EmpMod DEF	
   	
   )
   else
   (
   	messageBox "Select a node to add your attribute holder" title:"Error"
   )

Thanks so much for you reply
But
I need one specific object in the scene ex Teapot001 OK, BUT in attribute holder i don’t want to say $Teapot001.
Can you please make it better for example, instead of ( $Teapot001) we assign Teapot001 as node.Because if we rename Teapot001 in our scene we face problem.
For example we have (R_hand_CNT) in our scene and when the [pickbutton] pick any object in the scene pickbutton link any object to the (R_hand_CNT) Tha’s you have down perfectly, but when you duplicate the character the (R_hand_CNT) changes to (R_hand_CNT01) now the script face a problem

Thanks so much samsed
RigEater

What you need is a parameter block, details of which are skillfully hidden in the Scripted Plugin Clauses section of Max script help.

... 
   ( 

   	DEF=Attributes LinkAttrib 
   	( 
   		parameters main rollout:LinkRoll --declare a block of parameters associated with the rollout
		(
			childNode type:#node -- declare a param named "childnode" of type #node
		)
   		Rollout LinkRoll "Link A to B" 
   		( 
   			childNode = $Teapot001 --reference the named parameter directly in the rollout
   			Fn filt Obj_B =  Obj_B != childNode
   			Pickbutton pckBtn "Pick Obj B" filter:filt
   			On pckBtn picked Obj_B  do 
   			(
   				childNode.parent = Obj_B
   				select Obj_B
   			)	
   		) 
   	) 
...

Scripting direct node references like childNode = $Teapot001 is easy.
More tricky yet useful is scripting generic references to the object a CA is applied to, so you can drop teh CA onto various objects

My post about a similar problem might be hepful.

You Also may wish to look at Paul Neale’s simple tut about weak referencing

Sorry for delay
Thanks a lot Mambo4
You were a great help,I’ve got my answer from Paul’s site .
Thanks again

——-====================================
I’ll remove scriptspot tread as well
——-====================================
when there is no (s2=$Main_CNT) it works fine and even you rename the (R_Hand_linker) it works well but when you add second node it get crazy.
i try (for o in NodeArray do append Nodes(nodeTransformMonitor node:i forwardTransformChangeMsgs:false ) but i couldn’t do anything right.

thanks in advance

I think better change the name of this Thread To: — Storing multiply nodes on attributes—
I add this tread to scripspot no answer am i asking sth which is impossible? If it is is there any other way.

Thanks anyway.

deleted… (the subject of max script encryption was discussed many times here)

please don’t swear at each other here

…XXXXXXXXXXX…this is not a place to swear .Learn some manner…
I’m quite sure that you didn’t see that page. ( http://www.scriptspot.com/forums/3ds-max/general-scripting/several-node-storing-in-attribute-holder ) just 2 lines is similar the main script if you run the script you’ll find the whole difference.that is why scriptspot put it there.

what do you mean by (encrypted script). it was introduced to me by paul neal ( http://paulneale.com/tutorials/Scripting/weakReferences/weakReferences.htm ) at the first of my question i write (I’ve read Paul Neal’s weak referencing ). he didn’t say anything about don’t … beside (weakReferences.zip) is downloadable in his site for free.
I myself respect to those who work hard to create script and respect much more when they share their knowledge, (SOX Mirror Tool) is my proof i didn’t put the script here in this site to find my problem it was for free.I really didn’t know that it was encrypted or sth.
Believe me if you frankly or politely or any way except the way you said to me, imminently i remove that post now let it be there
Next time watch your tongue before swear at someone.

Page 1 / 3