[Closed] Commiting on pelt map
Hello, I’m trying to write a script that automatically pelts the selected faces with basic settings from pelt dialog in max 2010. I have everything working, so far, except that I don’t know of a way of hitting the Commit button. The maxscript documentation on pelt map seems to be from max 8, so there isn’t any solution there, and there isn’t any macro for it, so I can’t find out the actionman id using the macro recorder.
Here’s what I’”m using so far-
$.modifiers[#unwrap_uvw].unwrap5.mappingMode 5
$.modifiers[#unwrap_uvw].unwrap5.peltDialogSelectStretcher ()
$.modifiers[#unwrap_uvw].unwrap2.ScaleSelectedCenter 8.0 0
actionMan.executeAction 2077580866 "40155"
$.modifiers[#unwrap_uvw].unwrap5.peltDialogSelectPelt ()
$.modifiers[#unwrap_uvw].unwrap2.ScaleSelectedCenter 0.125 0
So, just using this, I would still have to hit Commt, which pretty much makes this script incomplete. Thanks in advance!
$.modifiers[#unwrap_uvw].unwrap5.mappingMode 5
$.modifiers[#unwrap_uvw].unwrap5.peltDialogSelectStretcher ()
$.modifiers[#unwrap_uvw].unwrap2.ScaleSelectedCenter 8.0 0
actionMan.executeAction 2077580866 "40155"
$.modifiers[#unwrap_uvw].unwrap5.peltDialogSelectPelt ()
$.modifiers[#unwrap_uvw].unwrap2.ScaleSelectedCenter 0.125 0
storeCmd = getCommandPanelTaskMode()
max modify mode
dialogHWND = windows.getChildHWND 0 "Pelt Map"
dialogChildren = windows.getChildrenhwnd dialogHWND[1]
for child in dialogChildren where child[4] == "Button" and child[5] == "Commit" do
(
UIAccessor.pressButton child[1]
)
setCommandPanelTaskMode storeCmd
That will press the commit button, it ain’t pretty, but it gets the job done
-Johan
Well, thanks a bunch for that solution, looking through the reference, I figured there had to be a way of literally having the commit button pressed, and I did stumble on to the UIAccessor and dialog commands, but those seemed to be quite complicated.
I was also thinking of having a seperate function that does the same thing, but also relaxes it before committing. I did find the actions for light relaxing and heavy relaxing-
actionMan.executeAction 2077580866 "40157" -- All Commands: Pelt Dialog Relax Simulation Heavy
actionMan.executeAction 2077580866 "40156" -- All Commands: Pelt Dialog Relax Simulation Light
But I would like to have something like a medium relax, How would I press the Start Relax Button for like 5 seconds, and press the same button to stop? Or would it be better to use the seperate relax2 methods after committing?
Well unfortunately it doesn’t appear to work inside of a macro-
macroScript AutoPelt_Selected
category: "UV Tools"
internalCategory: "UV_Tools"
tooltip: "AutoPelt Selected"
autoUndoEnabled:true
(
$.modifiers[#unwrap_uvw].unwrap5.mappingMode 5
$.modifiers[#unwrap_uvw].unwrap5.peltDialogSelectStretcher ()
$.modifiers[#unwrap_uvw].unwrap2.ScaleSelectedCenter 8.0 0
actionMan.executeAction 2077580866 "40155"
$.modifiers[#unwrap_uvw].unwrap5.peltDialogSelectPelt ()
$.modifiers[#unwrap_uvw].unwrap2.ScaleSelectedCenter 0.125 0
storeCmd = getCommandPanelTaskMode()
max modify mode
dialogHWND = windows.getChildHWND 0 "Pelt Map"
dialogChildren = windows.getChildrenhwnd dialogHWND[1]
for child in dialogChildren where child[4] == "Button" and child[5] == "Commit" do
(
UIAccessor.pressButton child[1]
)
setCommandPanelTaskMode storeCmd
)
The commit press doesn’t function, and you still have to press it. Although your dialog code works fine and presses it, but in a separate macro. Whats weird too, is that it won’t press commit when I try to run the seperate macro from within the original macro-
(
$.modifiers[#unwrap_uvw].unwrap5.mappingMode 5
$.modifiers[#unwrap_uvw].unwrap5.peltDialogSelectStretcher ()
$.modifiers[#unwrap_uvw].unwrap2.ScaleSelectedCenter 8.0 0
actionMan.executeAction 2077580866 "40155"
actionMan.executeAction 2077580866 "40155"
actionMan.executeAction 2077580866 "40155"
actionMan.executeAction 2077580866 "40155"
actionMan.executeAction 2077580866 "40155"
$.modifiers[#unwrap_uvw].unwrap5.peltDialogSelectPelt ()
$.modifiers[#unwrap_uvw].unwrap2.ScaleSelectedCenter 0.125 0
$.modifiers[#unwrap_uvw].unwrap5.peltDialogSelectStretcher ()
macros.run 27649
The seperate macro-
macroScript Commit_Pelt
category: "UV Tools"
internalCategory: "UV_Tools"
tooltip: "Commit Pelt"
autoUndoEnabled:true
(
storeCmd = getCommandPanelTaskMode()
max modify mode
dialogHWND = windows.getChildHWND 0 "Pelt Map"
dialogChildren = windows.getChildrenhwnd dialogHWND[1]
for child in dialogChildren where child[4] == "Button" and child[5] == "Commit" do
(
UIAccessor.pressButton child[1]
)
setCommandPanelTaskMode storeCmd
)
But of course all of this works evaluates fine without having it be a macro. Sorry if I’m missing something fundamental, as I don’t touch maxscript all that often. Thanks again for your help.