PDA

View Full Version : Maxscript - how can I create control rollout on dummy helper ?


AR-MAN
07-27-2011, 12:24 PM
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:

stigatle
07-27-2011, 12:36 PM
search for scripted "scripted plug-ins, Helper" in maxscript reference, look at the scripted helper plugin code.

There is a complete example there.

AR-MAN
07-29-2011, 05:29 PM
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 ?

AR-MAN
07-29-2011, 06:37 PM
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 ?

Panayot
07-29-2011, 06:44 PM
The Button Select1 it's not working at all, there's no changes, can somebody help me ? Your 'picked' handle is out of the rollout definition.

AR-MAN
07-29-2011, 07:02 PM
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
)

)

Panayot
07-29-2011, 07:08 PM
It's not working :hmm: There is no obj1 element here, your pickbutton is named object1 ; )

AR-MAN
07-29-2011, 07:13 PM
thank you ! :beer: благодаря

AR-MAN
07-29-2011, 08:33 PM
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

Panayot
07-30-2011, 02:37 AM
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

AR-MAN
07-30-2011, 02:53 AM
DropdownList needs string items, for example:


Thank you again, you're saving my day !
DropdownList item can't contain objects ? It must be only string variables ?

Panayot
07-30-2011, 03:00 AM
Thank you again, you're saving my day !
DropdownList item can't contain objects ? It must be only string variables ?
Yes, thats true and for ListBox, MultiListBox, ComboBox.

AR-MAN
07-30-2011, 03:22 AM
Yeah, it's working, thank you very much for your help man ! :beer:



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

AR-MAN
07-30-2011, 03:38 AM
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

AR-MAN
07-30-2011, 04:02 AM
Maybe because I didn't declared him in parameters section ?

lucpet
07-30-2011, 12:25 PM
Just thought I'd mention that you can use

local maxob=#()
pickbutton object1 "Select1 " width:140 autoDisplay:true
pickbutton object2 "Select2 " width:140 autoDisplay:true
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
and delete this line
)
)

AR-MAN
07-30-2011, 12:59 PM
Oh thank you very much lucpet.
But I still have a problem, when I'm deselecting and selecting my dummy, my objects aren't anymore in my dropdownlist :surprised

lucpet
07-30-2011, 01:24 PM
I just ran the last piece of code you posted and after you pick an object the rollout just disappears and I'm afraid it's beyond my understanding

Panayot
07-30-2011, 02:37 PM
Maybe because I didn't declared him in parameters section ?
Yes, you assume right, but you can update the ddlist using "on open" handle for the rollout, and if i not miss something, that should be fine --
on params open do
(
local names = #("None", "None")
if isValidNode maxob[1] do names[1] = maxob[1].name
if isValidNode maxob[2] do names[2] = maxob[2].name
scale_dd.items = names
)

AR-MAN
07-30-2011, 05:40 PM
Yes, you assume right, but you can update the ddlist using "on open" handle for the rollout, and if i not miss something, that should be fine --



Yeah man ;) you rock :thumbsup: I didn't get it well what the script do.... but I'll try to figure it out :)

CGTalk Moderation
07-30-2011, 05:40 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.