[Closed] Maxscript – how can I create control rollout on dummy helper ?
Hey there guys,
I’m trying to make my own rigging system, and I need to create some rollouts on dummy or another helper, to change the linking target. I saw in this video that it’s possible and the author told me that he done everything by himself :
http://vimeo.com/13957690#comment_5451475
so I know that it is possible. :banghead:
Please help me, what is the script, to create some rollouts on helpers or another objects ? :rolleyes:
search for scripted “scripted plug-ins, Helper” in maxscript reference, look at the scripted helper plugin code.
There is a complete example there.
thank you very much, and can you tell my how can I create a object selecting menu, like in skin modifier for example ? Wich Rollout User-Interface Control Types I must use ?
there’s some problem, when I’m creating a simple Dialog Rollout my script is working.
rollout ddl_test “Drop-Down List”
(
pickbutton select1 “Select 1” width:140
on select1 picked obj do
(
if obj != undefined do select1.text = obj.name
))
createDialog ddl_test
And when I’m trying to do the same thing with scripted plugin it’s not working:
plugin Helper mydummy
name: “mydummy”
classid:#(0x5c329848, 0x2f7b41f0)
category: “myhelpers”
extends:dummy
(local lastSize, meshObj
parameters main rollout: params
(
obj1 type:#node ui:object1
size type:#float animatable:true ui:amount default:40.0
)rollout params “Parameters”
(
group “Objects”
(
pickbutton object1 “Select1 ” width:140
)
group “Size”
(
Spinner amount “Size:” range:[0, 1e9, 40]
)
)on getDisplayMesh do
(
if (meshObj == undefined) do
(
meshObj = createInstance box length:size width:size height:size mapCoords:false
lastSize = size
)if size != lastSize do ( meshObj.length = size meshObj.width = size meshObj.height = size lastSize = size ) meshObj.mesh )
on obj1 picked obj do
(
if obj != undefined do obj1.text = obj.name
)tool create (
on mousePoint click do (
viewTM = getCPTM()
nodeTM = (transMatrix worldPoint) * (inverse viewTM)
#stop
)
))–end
The Button Select1 it’s not working at all, there’s no changes, can somebody help me ?
It’s not working :hmm:
rollout params “Parameters”
(pickbutton object1 "Select1 " width:140 Spinner amount "Size:" range:[0, 1e9, 40] on obj1 picked obj do ( if obj != undefined do obj1.text = obj.name )
)
Another Problem…
When I’m picking my object with two buttons and assigning them to drowndownlist items array , they didn’t appear in my list ! Why ? I need to refresh the list … or… ?
this is the script :
rollout ddl_test “Drop-Down List”
(
pickbutton object1 “Select1 ” width:140
pickbutton object2 “Select2 ” width:140
dropdownlist scale_dd “Scale” items:#()on object1 picked obj_1 do
(
if obj_1 != undefined do
(
scale_dd.items[1]=obj_1;
object1.text = obj_1.name
)
)on object2 picked obj_2 do
(
if obj_2 != undefined do
(
scale_dd.items[2]=obj_2;
object2.text = obj_2.name
)
)on scale_dd obj i do
(
if scale_dd.items[i] != undefined do $.parent=scale_dd.items[i]
))
createDialog ddl_test
DropdownList needs string items, for example:
rollout ddl_test "Drop-Down List"
(
pickbutton object1 "Select1 " width:140
pickbutton object2 "Select2 " width:140
dropdownlist scale_dd "Scale" items:#("None", "None")
on object1 picked obj_1 do
(
if obj_1 != undefined do
(
scale_dd.items[1] = obj_1.name
scale_dd.items = scale_dd.items --update
object1.text = obj_1.name
)
)
on object2 picked obj_2 do
(
if obj_2 != undefined do
(
scale_dd.items[2] = obj_2.name
scale_dd.items = scale_dd.items
object2.text = obj_2.name
)
)
on scale_dd selected i do
(
local obj = GetNodeByName scale_dd.items[i]
if isValidNode obj and selection.count > 0 do
selection.parent = obj
)
)
createDialog ddl_test
hope this help
Thank you again, you’re saving my day !
DropdownList item can’t contain objects ? It must be only string variables ?
Yeah, it’s working, thank you very much for your help man !
rollout ddl_test "Drop-Down List"
(
local maxob=#()
pickbutton object1 "Select1 " width:140
pickbutton object2 "Select2 " width:140
dropdownlist scale_dd "Scale" items:#("","")
on object1 picked obj_1 do
(
if obj_1 != undefined do
(
scale_dd.items[1] = obj_1.name;
scale_dd.items = scale_dd.items;
maxob[1]=obj_1;
object1.text = obj_1.name;
)
)
on object2 picked obj_2 do
(
if obj_2 != undefined do
(
scale_dd.items[2]=obj_2.name;
scale_dd.items = scale_dd.items;
maxob[2]=obj_2;
object2.text = obj_2.name;
)
)
on scale_dd selected i do
(
$klor.parent=maxob[i]
)
)
createDialog ddl_test
I used the code for a plugin, he’s working, but there’s a small problem.
Chen I’m picking two objects and assigning them as parent to my dummy, everything is OK,
But when I’m deselecting and selecting my dummy my two selected objects aren’t in my list anymore.
There’s some script to save them, that they didn’t disappear from my list?
plugin Helper mydummy
name: "mydummy"
classid:#(0x5c329848, 0x2f7b41f0)
category: "myhelpers"
extends:dummy
(
local lastSize, meshObj
local maxob=#()
parameters main rollout: params
(
obj1 type:#node ui:object1
obj2 type:#node ui:object2
size type:#float animatable:true ui:amount default:40.0
)
rollout params "Parameters"
(
pickbutton object1 "Select1 " width:140
pickbutton object2 "Select2 " width:140
dropdownlist scale_dd "Scale" items:#("","")
Spinner amount "Size:" range:[0, 1e9, 40]
on object1 picked obj_1 do
(
if obj_1 != undefined do
(
scale_dd.items[1] = obj_1.name;
scale_dd.items = scale_dd.items;
maxob[1]=obj_1;
object1.text = obj_1.name;
)
)
on object2 picked obj_2 do
(
if obj_2 != undefined do
(
scale_dd.items[2]=obj_2.name;
scale_dd.items = scale_dd.items;
maxob[2]=obj_2;
object2.text = obj_2.name;
)
)
on scale_dd selected i do
(
$.parent=maxob[i]
)
)
on getDisplayMesh do
(
if (meshObj == undefined) do
(
meshObj = createInstance box length:size width:size height:size mapCoords:false
lastSize = size
)
if size != lastSize do
(
meshObj.length = size
meshObj.width = size
meshObj.height = size
lastSize = size
)
meshObj.mesh
)
tool create (
on mousePoint click do (
viewTM = getCPTM()
nodeTM = (transMatrix worldPoint) * (inverse viewTM)
#stop
)
)
)--end