View Full Version : maptoview failure
dejawolf 03-21-2006, 11:01 PM hello, created this little script, so that i can select and object, press a button, and have it mapped to view.
unfortunately, i get an error message when i try and run it as a button, although it works
without a hitch as a script. what have i done wrong.
macroScript MaptoView
category:"mine"
toolTip:"yes"
(
addmodifier $ (unwrap_uvw())
subobjectLevel = 3
max select all
$.unwrap_uvw.mappingmode 1
$.unwrap_uvw.mappingAlignToView()
$.modifiers[#unwrap_uvw].unwrap5.setNormalizeMap off
$.unwrap_uvw.mappingmode 1
$.unwrap_uvw.pack 1 0.0 true false false
)
|
|
RyanT
03-21-2006, 11:39 PM
I am guessing, but I think you didnt run you script while you were on the modifier panel. If you add this line to the begining of your code it wont give you a system exception.
max modify mode
-RyanT
dejawolf
03-22-2006, 12:00 AM
i tried that, evaluated, and still get a system exception when running it as a macroscripted button.
although that max modify mode fixed another bug i experienced with this.
dejawolf
03-22-2006, 04:35 PM
if this is a bug, how do i work around it?
Zbuffer
03-26-2006, 02:41 AM
HI,
try this:
macroScript MaptoView
category:"mine"
toolTip:"yes"
(
max modify mode
addmodifier $ (unwrap_uvw())
local uv=modpanel.getcurrentObject()
subobjectLevel = 3
max select all
uv.mappingmode 1
uv.mappingAlignToView()
uv.unwrap5.setNormalizeMap off
uv.mappingmode 1
uv.pack 1 0.0 true false false
subobjectLevel = 0
)
dejawolf
03-28-2006, 11:35 PM
well, it didn't create any errors, but the line
uv.mappingmode and uv.mappingaligntoview()
are not doing what they're supposed to, IE nothings happending.
hello, created this little script, so that i can select and object, press a button, and have it mapped to view.
unfortunately, i get an error message when i try and run it as a button, although it works
without a hitch as a script. what have i done wrong.
As usual, this is a case where executing the lines one by one from the Listener works as expected, but putting everything into a macroscript fails because the modifier stack has not updated at the moment where the method is called.
Once again, the solution is as simple as it is hacky - call classof $ before calling the .mappingAlignToView() method to force a modifier stack update:
macroScript MapToView
category:"Forum Help"
toolTip:"Map To View Fixed"
(
on isEnabled return selection.count == 1 and modPanel.ValidModifier unwrap_uvw
on execute do
(
theMod = unwrap_uvw()
addmodifier $ theMod
subobjectLevel = 3
max select all
theMod.mappingmode 1
classof $ --FORCE STACK UPDATE
theMod.mappingAlignToView()
theMod.unwrap5.setNormalizeMap off
theMod.mappingmode 1
theMod.pack 1 0.0 true false false
)
)
dejawolf
03-29-2006, 11:10 PM
thanks! now onto some turbocharged unwrapping..
CGTalk Moderation
03-29-2006, 11:10 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.
vBulletin v3.0.5, Copyright ©2000-2013, Jelsoft Enterprises Ltd.