[Closed] Maxscript flattenMap not doing anything
I was trying to reply to an existing thread on here but it would not let me because it is archived. I am having a similar problem where I am creating and applying an unwrap_uvw modifier to an object and doing a flattenmap operation. But the flattenmap does not happen. From the previous thread I read, I have developed this code that seems like it should work, but it does not:
function AO_UVWUnwrap _Object =
(
Unwrapper = UVWunwrap()
Unwrapper.setApplyToWholeObject true
addModifier _Object (Unwrapper)
Unwrapper.setMapChannel 2
classof _Object --asks for the class on top of the stack, thus forces an internal update
Unwrapper.flattenMap 45.0 #() 0.001 true 0 true true
)
myBox = box()
convertToPoly myBox
AO_UVWUnwrap myBox
After I execute this script, I can select the Box object and enter into its Unwrap modifier and confirm that the object was not flattenmap’d.
Any ideas what I’m doing wrong?
You need to select the node and set the active panel to Modify.
function AO_UVWUnwrap _Object =
(
setCommandPanelTaskMode mode:#modify
select _Object
Unwrapper = UVWunwrap()
Unwrapper.setMapChannel 2
Unwrapper.setApplyToWholeObject true
addModifier _Object Unwrapper
Unwrapper.flattenMap 45.0 #() 0.001 true 0 true true
)
myBox = box()
convertToPoly myBox
AO_UVWUnwrap myBox
Thank you, that seems to fix that issue. But the next problem I have is that I need this operation to take place in the background. That is, I don’t want to have the modify panel active. If I use “suspendEditing which:#modify” then the flattenmap once again doesn’t work. Do you know a way around this?
No, I don’t know any workaround for this. I am afraid you need to be in Modify Panel in order to work with the UnwrapUVW Modifier.
This is part of a larger operation that is getting “refershed” every time a Spinner is dragged. So the script will be too slow if the UI is constantly updating.
Hmm. Are there other methods of manipulating UVs in Maxscript without having to select objects and update the UI?
Yes, take a look at the following links:
Mesh Texture Vertex
Meshop General Mapping
Editable_Poly Mapping
Thank you! Those silent Editable Poly methods seem to be what I need. Thanks so much!
Hello,
I am running into a very similar problem, very slow when having to select objects and update UI. Could you maybe elaborate on how mesh uvw’s can be flattened using these other methods (meshop, editable_poly, etc)? Many thanks!