[Closed] Parenting by pickbutton
maxObjectTab type parameter, that is the simple answer to what you are looking for.
it’s a simple answer, but not a simple task. try to make a custom attribute for example that stores a list of nodes, shows their names in a listbox control, and updates this list when any node added to tab, removed from tab, deleted, or renamed.
Yep yep, It just seems that this guys are asking for something they are not actually ready to even understand and are hoping we hand them a ready script on a platter,so I thought it would be better just to tell them about one thing that they need to use and hopefully they can go research it.
RigEater changing the parent of a node like the way you are doing will break your animations, you must use link_constraints, sure it might seem like it is working on you test case you showed in the video, but once you start animating you will start breaking it as you start changing the parent of a node on the fly that is basic stuff.
Thanks jabermax2 you’ve treated just like an older brother…anyway
i did my best and made this video (record with camtsia and lowest sd 7 mb is clear to understand) to show that why i need parenting in attribute holder to create Gluey hand (I call it this way).
if you don't want to watch the video it is a Hand_CNT with an attribute holder which stick on sth that pickbutton picked.
( [ https://vimeo.com/107164486 ]( https://vimeo.com/107164486) )
in this video i used this solution you can add lots of nodes here but it has a BIG PROBLEM which is Renaming if you duplicate the character all object renamed and all things get wrong that was why i go (weak refrencing) and come to this site,
denis i just write this to learn more i mean do you have any idea to make this script better and solve renaming problem..
I search a lot ask etc.... your solution was the best and so advanced and specially New,please write your own solution as well lets finish this tread.
It's up to you
.
here the code but with a renaming problem
R=teapot pos:[-100,0,0] wirecolor:blue R.name = "R_Hand_linker"
R2=plane pos:[-100,0,0] wirecolor:orange length:80 width:80 R2.name = "Main_CNT"
r3=box pos:[-70,-120,0] wirecolor:yellow
r4=box pos:[-40,-120,0] wirecolor:green
RR=circle pos:[40,0,0] wirecolor:green RR.name = "Att_holder"
def=attributes nodeStore
(
parameters nodesP rollout:nodesR
(
refNodes type:#maxObjectTab tabSize:0 tabSizeVariable:true
theObject type:#node ui:linkObject animatable:false
R_Hand_linker type:#node
L_Hand_linker type:#node
Main_CNT type:#node
pa type:#float ui:(pckslw,pckspw)
)
rollout nodesR "Nodes" width:162 height:193
(
local btW=135, btW2=65
pickbutton linkObject "LinkObject" pos:[9,14] width:104 height:21 autodisplay:True
button bclr "Clr" pos:[130,14] width:20 height:21
local obj01 = undefined--local obj01 = undefined
slider pckslw " World...........Linked"range:[0,100,0] pos:[2,40] width:125
spinner pckspw "" range:[0,100,0] pos:[115,65] fieldwidth:30
local obj01 = undefined--local obj01 = undefined
local R_Hand_linker = getnodebyname ("R_Hand_linker")
local L_Hand_linker = getnodebyname ("L_Hand_linker")
local Main_CNT = getnodebyname ("Main_CNT")
local NodeArray = #(R_Hand_linker,L_Hand_linker,Main_CNT) as array
fn parenting =
(
R_Hand_linker.parent = obj01
)
on bclr pressed do
(
linkObject.text = "None"
R_Hand_linker.parent = Main_CNT
)
on linkObject picked obj do
(
obj01 = obj
parenting()
)
)
)
ah=(EmptyModifier())
addModifier RR ah
custAttributes.add ah def
for o in NodeArray do append Nodes(nodeTransformMonitor node:i forwardTransformChangeMsgs:false)
append RR.modifiers[1].refNodes obj
it seems that it pus (“) instead of (“) don’t know why
if you want to animate this ‘sticking’ feature you have to use Link_Constraint controller. it’s the only controller that allows to animate targets. Position_Constraint, Orientation_Constraint, any script controller have to have all targets added in advance. so … i see only Link_Constraint here
After a quick glance at your script, this looks like the main underlying issue to me.
local obj01 = undefined--local obj01 = undefined
local R_Hand_linker = getnodebyname ("R_Hand_linker")
local L_Hand_linker = getnodebyname ("L_Hand_linker")
local Main_CNT = getnodebyname ("Main_CNT")
These are the variables you are using to access the nodes in your scene but there are 2 problems with it:
1 – You are not assigning the nodes as a weakReference to these variables.
2 – These variables are being re-assigned every time the rollout is created which happens every time you select the attr_Holder node and the rollout is created in your empty_modifier, so when you change the name of a node the script is still looking for the old name as it is hard coded.
You need to assign there variables from the outside and assign them as weakReferences.
Thanks pepeTd
Link constrain has nothing to do with my problem which made me to write this tread renaming and node storing was my problem. you are compeletly right no Link constrain no anime that is what i’m working on it
I don’t want
… hoping we hand them a ready
sb hand me a ready script,i’m looking for what you said your problem is this find yourself. as i said let finish this thread,it’s about 20 days writing on this Thread, i think 20 is enough. in this thread just because i put my version of (the things that i write) weak referencing sb swear at me and said i swearing at scriptspot i think better quit this thread before getting kicked or blamed for robbery
Thanks again.
Thanks calling me bro Rigeater and you are not lazy student
Thanks pepetd ,As i said
it is hard for me to ask this way ( please …)
i hate begging no matter money or knowledge , i’m really sorry if i treated just like a beggar, i’ve never ask this way again. sth to you and denis, first thanks you are sharing your knowledge, but i think, not answering not swearing is better than answering and swearing
Thanks to you and never see me again asking like this
that’s OK. you still can continue learning by reading anyone’s else questions and answers.
I gave you an answer, You are failing to understand it, I explained why you are having a renaming problem and explained what you need to do in order to solve it but I would not want to discourage anyone from posting in CG Talk so…
What has been asked in this post is not that simple and the implementation of it can be quite cumbersome for someone who is missing some basic understandings of the set-up and how CA’s and parameters work and interact.
Your Stored nodes need to be assigned from the outside of your rollout script because assigning the variables like you were on rollout creating will always give you an issue when renaming objects because you are looking for a hard coded name.
Here is a cleaned up version of you script that will work with renaming of nodes.
R=teapot pos:[-100,0,0] wirecolor:blue R.name = "R_Hand_linker"
R2=plane pos:[-100,0,0] wirecolor:orange length:80 width:80 R2.name = "Main_CNT"
r3=box pos:[-70,-120,0] wirecolor:yellow
r4=box pos:[-40,-120,0] wirecolor:green
RR=circle pos:[40,0,0] wirecolor:green RR.name = "Att_holder"
R.parent = R2
def=attributes nodeStore
(
parameters nodesP rollout:nodesR
(
R_Hand_linker type:#maxObject
L_Hand_linker type:#maxObject
Main_CNT type:#maxObject
pa type:#float ui:(pckslw,pckspw)
)
rollout nodesR "Nodes" width:162 height:193
(
local obj01 = undefined--local obj01 = undefined
pickbutton linkObject "LinkObject" pos:[9,14] width:104 height:21 autodisplay:True
button bclr "Clr" pos:[130,14] width:20 height:21
slider pckslw " World...........Linked"range:[0,100,0] pos:[2,40] width:125
spinner pckspw "" range:[0,100,0] pos:[115,65] fieldwidth:30
fn parenting =
(
R_Hand_linker.node.parent = obj01
)
on bclr pressed do
(
R_Hand_linker.node.parent = Main_CNT.node
linkObject.text = R_Hand_linker.node.parent.name
)
on linkObject picked obj do
(
obj01 = obj
parenting()
)
on nodesR open do
(
linkObject.text = R_Hand_linker.node.parent.name
)
)
)
ah=(EmptyModifier())
addModifier RR ah
custAttributes.add ah def
-- Assign the Controls to the CAs parameters as weak references NOTICE HOW WE ARE DOING THIS OUTSIDE OF THE ROLLOUT CREATION.
RR.modifiers[1].R_Hand_linker = (nodeTransformMonitor node:R forwardTransformChangeMsgs:false)
RR.modifiers[1].Main_CNT = (nodeTransformMonitor node:R2 forwardTransformChangeMsgs:false)