CG Wishlist


Access to Modifier Methods Requires the modifier to be open in the Modify Panel:


Many modifier methods return incorrect values unless that modifier is the active modifier in the modify panel. This is a reall problem, and these methods should return correct results, even if not the active modifier. Here are some examples...

Unwrap UVW

Try the following steps

1) Open a new max file. Create a Plane with 1 face. Collapse it to Editable poly. Add a Unwrap UVW modifier on it.
2) Select Plane01
3) Go to modify panel, open up the unwrap, click edit, you should see the object's uvs.
4) Run the following maxscript code...

Code:
obj1 = $Plane01
sourceverts = polyop.getMapFace obj1 1 1
for v in sourceverts do
(
print (obj1.modifiers[1].unwrap.getVertexPosition currenttime v)
)
You should see results like this...

[0,1,0]
[0,0,0]
[1,0,0]
[1,1,0]

These are the results you expect.

5) Close the UV Window.
6) Click on the modifier to get out of subobject mode
7) Deselect the object
8) Run the code a second time

You should see results like this...

[0.5,1,0]
[0.5,1,0]
[0.5,1,0]
[0.5,1,0]

which are totally wrong. This is because of a limitation that exists in the Unwrap UVW modifier. From the maxscript help...

"The following methods require that the Unwrap UVW modifier be the displayed modifier in the Modify panel, and that the Modify panel is active."

This is a pretty major limitation, especially when dealing with a number of objects. Say you want to perform a script operation on a selection of 1000 objects. Rather than just giving commands such as getVertexPosition to an object, you have to have the script select the object first, then change to the modify panel, then open up the interface. This slows down the running time of any script by a large factor, since it needs to perform a bunch of ui manipulation just to modify some parameters to an object.

I would like to see these methods work properly even if you don't have the object selected, and without the need for the modifier panel to be open, or the Edit UV window open.

Edit Poly

Make an object, say a cube, collapse to editablepoly, then run this code:

max modify mode
progressStart "test"
obj = $
addmodifier obj (Edit_Poly())
myMod = obj.modifiers[1]
numVerts = myMod.GetNumVertices()
print numVerts
progressEnd()

It will return 0, even though your cube has vertexes. Now run this code:

max modify mode
obj = $
addmodifier obj (Edit_Poly())
myMod = obj.modifiers[1]
numVerts = myMod.GetNumVertices()
print numVerts

It properly returns the number of vertexes.

This is because the progressbar takes focus away from the modify panel, hence the
myMod.GetNumVertices() can't acccess the info it needs.

The same limitation exists with the Edit Normals, Skin and Pointcache modifiers, and I'd love to see them fixed as well.



This site is ©2014 by Neil Blevins, All rights are reserved.
Back to NeilBlevins.com