Strandli
12-12-2009, 01:02 AM
Hi!
I am very very new at this MaxScript thing, but I though I should read a little about it since I was in need for a custom script.
What I wanted my script to do was using "Edge Ring" and open up "Connect Edge Dialog PopUp", in one hotkey.
I tried it out a little, and I got most of it to work, but I found out it needed different functions depending on the object, whether it was an Editable Poly object, or a Edit Poly modifier. I wrote 2 scripts, one working perfect for each one, so I though I could just script a function in to detect the what kind of an object it was, and execute function depending on that.
I tried a If/then/else thing, but I could get it to work, 99% likely because this is my first try at scripting and I have almost no clue.
So is there anyone who can quickly give me the answer? I would greatly appreciate it.
x = "Editable Poly"
(
If (modPanel.getCurrentObject() == "x") Then
(
$.EditablePoly.SelectEdgeRing ()
actionMan.executeAction 369982487 "40062" -- Command for opening up ConnectEdge Dialog
) --condition not valid
else
(
$.modifiers[#Edit_Poly].ButtonOp #SelectEdgeRing
actionMan.executeAction 1250838234 "40062" -- Command for opening up ConnectEdge Dialog
)
) --ScriptEnd
When I wrote "modPanel.GetCurrentObject()" in the MaxScript Listener I got either "Edit_Poly:Edit Poly" or "Editable Poly", so I thought that was enough to use the if/then/else function, but I couldn't get it to work. As it is written now, it only works on Edit_Poly modifier objects, because whatever I try the answer is always "false" in the If function.
Can somebody help?
Thank you
- Strandli
I am very very new at this MaxScript thing, but I though I should read a little about it since I was in need for a custom script.
What I wanted my script to do was using "Edge Ring" and open up "Connect Edge Dialog PopUp", in one hotkey.
I tried it out a little, and I got most of it to work, but I found out it needed different functions depending on the object, whether it was an Editable Poly object, or a Edit Poly modifier. I wrote 2 scripts, one working perfect for each one, so I though I could just script a function in to detect the what kind of an object it was, and execute function depending on that.
I tried a If/then/else thing, but I could get it to work, 99% likely because this is my first try at scripting and I have almost no clue.
So is there anyone who can quickly give me the answer? I would greatly appreciate it.
x = "Editable Poly"
(
If (modPanel.getCurrentObject() == "x") Then
(
$.EditablePoly.SelectEdgeRing ()
actionMan.executeAction 369982487 "40062" -- Command for opening up ConnectEdge Dialog
) --condition not valid
else
(
$.modifiers[#Edit_Poly].ButtonOp #SelectEdgeRing
actionMan.executeAction 1250838234 "40062" -- Command for opening up ConnectEdge Dialog
)
) --ScriptEnd
When I wrote "modPanel.GetCurrentObject()" in the MaxScript Listener I got either "Edit_Poly:Edit Poly" or "Editable Poly", so I thought that was enough to use the if/then/else function, but I couldn't get it to work. As it is written now, it only works on Edit_Poly modifier objects, because whatever I try the answer is always "false" in the If function.
Can somebody help?
Thank you
- Strandli
