View Full Version : attaching created node value to floatfield on button click?
10-16-2010, 01:31 AM
That sounds a little convoluted, so let me explain what I'm wanting to do. I have this simple floating palette I use to help clean up models and I have a float slider and input field at the bottom that I want to be used for a things that would benefit from interactive adjustment, like edge softness angle and tri to quadrangle conversion:
The idea is that you would click "89° soften" or "Quadrangle brute" and the slider and value would then update with the relevant node's value and you could tweak it without using the attribute editor. So my question is: how do I query the node created when clicking the button and have it automatically attach to the slider and floatfield of something like PolySoftEdge9.angle of $mySelection after it's created?
edit: also, is there a way to make the text input field smaller? It's kind of huge
10-16-2010, 10:58 AM
The idea is that you would click "89° soften" or "Quadrangle brute" and the slider and value would then update with the relevant node's value and you could tweak it without using the attribute editor. So my question is: how do I query the node created when clicking the buttonUse getAttr on your selection to grab the value. Depending on how your code is structured, you may want to setup a global var (array or list depending on MEL or Python) to store the attribute name and its value.
and have it automatically attach to the slider and floatfield of something like PolySoftEdge9.angle of $mySelection after it's created?Use the 'edit' flag w/the attrFieldSliderGrp to update its value and the attribute 'attachment'. The value will come from the gettAttr, the 'attachment' will come from the button. You will need to assign a name to your attrFieldSliderGrp so you can edit it with a function attached to the button.
edit: also, is there a way to make the text input field smaller? It's kind of hugeDoesn't look too big to me. There are some size controls for the attrFieldSliderGrp, but they can be overridden by the Layout Container. What type of container is it sitting in? You might try forcing it with the type of Layout Container (ie - columnLayout).
Are you using Python or MEL? Paste a bit of code so we can see what's going on.
10-16-2010, 03:37 PM
I'm using MEL. I don't know Python - here's the code for the column layout (it's in a subframe now):
frameLayout -collapsable true -label "Edge Controls" -width 120;
text -align left -label "Soft edge angle:";
floatSliderGrp -precision 2 -field 1 -min 0.01 -max 180 facerslider1;
10-16-2010, 04:24 PM
so how would I go about getting the created node's name (soften edge)? That's the part I'm not clear on. It can't just attach to any PolySoftEdge attached to the object, since there could be a few.
10-16-2010, 08:07 PM
I think that would have to be done manually (ie, in the CB) or if its worth your time, you could create a GUI that would parse/list all the polySoftEdge nodes on a selected object and then allow you to pick one of them.
Also, my bad on the getAttr, when you update the -attachment attribute of the slider, the slider value should automatically update to the value of that attribute. I haven't tested it, but I can do so later if need be.
10-16-2010, 09:55 PM
ok - no worries. I'll skip this bit - it's not crucial and can be easily accessed from the channel editor. thanks anyway.
10-16-2010, 09:55 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-2014, Jelsoft Enterprises Ltd.