[Closed] pickbutton question
Hi, i am trying to make a script that can transfer uv coordinates from one object to the other. But ran into a problem.
How to tell the cannelinfo command to copy the channel info from the object i have picked with the pick button?
Here is my failed attempt. Please tell me what am i doing wrong?
rollout testRol "Test Rollout"
(
pickbutton srcuv "SourceUV"
pickbutton dstuv "DesinationUV"
on srcuv picked obj do
(
channelInfo.CopyChannel $srcobj 3 1
)
on dstuv picked obj do
(
channelInfo.PasteChannel $.destuv 3 1
channelInfo.NameChannel $.destuv 3 1 "-none-"
messagebox "Done"
)
)
createDialog testRol width:150
Thanks!
Replace $srcobj and $.destuv with obj. From the Maxscript Help:
Called when the user selects an object in the scene while in the pickbutton pick mode. The <arg> argument will contain the selected object.
-Eric
hey thanks Eric. Works like a charm now.
btw where did you find that in the maxscript help? Ive searched but didn’t find that.
Search pickbutton, at the bottom of the pickbutton page it has the Events section. These tell you what events are supported by the UI element and what the results are for the UI elements.
-Eric
Oh i see. Thanks.
I thought that it was refering to the name of the object that i have selected with the pick button. Thats why i typed the $ stuff. But it was as simple as putting obj.
Thanks again.
edit: by that way is there a way to integrate selection sets for uv clusters with maxscript? The pulldown thingy from the top toolbar.
Ok i have another problem now…
spinner sustscl "CustomScale" range:[0.01,100,1] type:#float
on sustscl changed do
(
$.modifiers[#unwrap_uvw].unwrap2.ScaleSelectedCenter sustscl.value 0
)
The unwrap scale expect two values the scale and on what axis. So it works like this
$.modifiers[#unwrap_uvw].unwrap2.ScaleSelectedCenter 0.1 0
But how do i replace the first number with the number on my spinner?
first of all i suggest you to look MXS help for Rollout User-Interface Controls and controls’ event handlers. Spinner’s “changed” event handler has another argument which contains the new value of the spinner.
on <spinner> changed <arg> [<inSpin_arg>] do <expr> (see Spinner UI Control)
Yeah i am constantly looking there but the problem is that i don’t understand more than half of what is written there.
Anyway i think i got it now…
on sustscl changed value do
(
$.modifiers[#unwrap_uvw].unwrap2.ScaleSelectedCenter value 0
)
I have a small script that moves selected clusters from multiple selected objects one tile to the left. But its not working like i want it to work
sel = selection
obj = #()
for i in sel do
(
i.modifiers[#unwrap_uvw].unwrap2.MoveSelected [1.0,0,0]
)
With this script for example i have 5 objects selected and when i execute the script it moves 5 tiles to the left, if i have 3 objects selected it moves 3 tiles to the left and so on. But i want it to have 10 or 20 or it doesn’t really matter how many objects i have selected, i just want to move the selected clusters one tile to the left. How can i do this? Thanks!