Forum Groups
  All forums
    Help & Feedback
      Questions
      Work in progress
      Finished Art
      Non-Max related
    Community
      Offtopic
      News
    Hardware
    Photography



Maxunderground news unavailable

MaxScript flattenMap arguments
show user profile  3joez
This simple script should flatten the selected object map.

m = unwrap_uvw
addModifier $ (m())
m.flattenMap 45.0 #() 0.01 true 0 true true

But Max complains I should provide 8 arguments and not 7(the documentation shows only 7!).
Clues?
Photobucket

read 611 times
4/30/2014 10:41:34 AM (last edit: 4/30/2014 10:41:34 AM)
show user profile  Nik Clark
You might need to do the classof hack

See Bobo's comment here:
http://forums.cgsociety.org/archive/index.php/t-318851.html





read 610 times
4/30/2014 10:44:39 AM (last edit: 4/30/2014 10:44:39 AM)
show user profile  3joez
m = UVWunwrap()
addModifier $ (m)
m.flattenMap 45.0 #() 0.001 true 0 true true

The variabile that held the modifier was wrong so "UVWunwrap" worked in place of "unwrap_uvw".
Photobucket

read 607 times
4/30/2014 11:01:05 AM (last edit: 4/30/2014 11:17:34 AM)
show user profile  3joez
Nick, it was a useful hint, anyway, because it happened that I've packed the flattening into a function and classOf did the trick. So thanks!

fn app = (
m = UVWunwrap()
addModifier $ (m)
classOf $
m.flattenMap 45.0 #() 0.001 true 0 true true
subobjectlevel = 3
m.selectFaces #{1..$.numfaces}
)

I've had troubles finding the rotate faces function, anyway. Is it exposed to maxscript unwrap?
Photobucket

read 591 times
4/30/2014 4:51:39 PM (last edit: 4/30/2014 4:51:39 PM)
show user profile  Garp
Nope, that's not it. If you replace UVWunwrap with unwrap_uvw in your second script, it works just fine.

In your first snippet:
- m = unwrap_uvw is missing the function call operator (). So instead of calling the constructor and passing the constructed modifier to m, m is a reference (an alias) to the contructor.
- addModifier $ (m()) works because you're adding () to the contructor's reference, hence you are actually calling the contructor and you get a modifier added to $.
- m.flattenMap 45.0 #() 0.01 true 0 true true can't work since m here is not a modifier.

So
m = unwrap_uvw()
addModifier $ (m)
m.flattenMap 45.0 #() 0.001 true 0 true true

is OK :)




read 590 times
4/30/2014 5:00:38 PM (last edit: 4/30/2014 5:02:40 PM)
show user profile  3joez
Thanks Garp!
Photobucket

read 584 times
4/30/2014 5:13:20 PM (last edit: 4/30/2014 5:13:20 PM)
#Maxforums IRC
Open chat window


Support Maxforums.org