PDA

View Full Version : Select vertices, which are affacted by a morph map?



mewnow
03-20-2019, 03:12 AM
There is a command "Select by Map" in modeler, but it don't do the job well, it also select some points which do not affacted by the morph map, those points all have 0,0,0 value by moprh map in Point Info Panel.

Notice:This happend since I had some import\export operations with my model.

I also try "Select By Current Morph Map (https://www.lightwave3d.com/assets/plugins/entry/select-by-current-weightmorph-map/)" and "Select By AnyMap (https://www.lightwave3d.com/assets/plugins/entry/select-by-anymap/)" from Akira Asagi, they did not work as I expected.

Here is a little script do the job well in blender: https://blender.stackexchange.com/questions/116764/select-vertices-which-are-affected-by-a-shape-key

Any help?

gar26lw
03-20-2019, 05:18 AM
i think there is a plugin to remove zero value vmaps. might be part of the ys plugins

http://www.dstorm.co.jp/dsproducts/FreePlugins/ysplugin.html

MonroePoteet
03-20-2019, 07:15 PM
If you're running LW2015, there's an LScript available called SelectByMapInfluence revealed in this thread by kyuzo:

https://forums.newtek.com/showthread.php?159528-Missing-lscript

which allows a range of map values for selection. Specifying a range of anything above 0.0 may do what you want.

It seems to be left out of the LW2018 and LW2019 kit / installation, although it works fine in LW2019. I just copied it from my LW2015 installation to the LW2019.0.2 and it works great. If you have an LW2015 installation, it's located here:

C:\Program Files\NewTek\LW2015.3\support\plugins\scripts\LScr ipt\model\selectbymapinfl.ls

mTp

mewnow
03-20-2019, 07:53 PM
No LW2015 here, only V11.6.3. There is a command "Select By Map Influence" in V11.6.3. Seems it not works for morph maps but weight maps.

MonroePoteet
03-20-2019, 08:17 PM
Ah, yes, the script seems to be specific to Weight maps rather than vertex maps in general.

Looking at the script, it's not really feasible to do a simple adaptation to Morph maps. Morph maps have 3 "dimensions", the relative distance in X,Y and Z from the "base" morph (or absolute difference if that mode was used when the Morph was created). So determining a valid range would be difficult, since if the model is large and the morphs are quite different the relative distances could be large, while for small models and details morphs, they'd be small. As well, one relative distance may be zero while the others are not - so the Morph doesn't influence that point in that dimension!

My experimenting in LW2019 is that points I don't move in a Morph don't have any mapped value for the Morph. I guess I'm surprised that just doing a "Select by Map" specifying the Morph map doesn't work!

mTp


mTp

mewnow
03-20-2019, 09:57 PM
So, there isn't a ready-made "command" to do this thing...or say there isn't a easy way to do it unless I can coding a script.
Anyway, thank you very much for helping, mTp.

mewnow
03-20-2019, 10:05 PM
BTW, in LW11.6.3, there is three commands in Selection tab: "VMap Poly Select", "Select by Map", "By Vertex Map Value". They seem to do the same thing without big differences, is it necessary?

MonroePoteet
03-20-2019, 11:02 PM
If you only want to select points that are both a) mapped to a selected Morph map, and b) have at least one X,Y,Z dimension within that Morph map that's non-zero, here's a quick hack of the script that may work for you.

Note that I removed all the options except the Morph map, including the Select Polygons option. If you need the polygons selected, use the script to select the non-zero Morph map points, and then the Selection=>Polys=>Sel Polys menu entry.

Hope it works for you!
mTP

Sensei
03-20-2019, 11:29 PM
There is a command "Select by Map" in modeler, but it don't do the job well, it also select some points which do not affacted by the morph map, those points all have 0,0,0 value by moprh map in Point Info Panel.

Notice:This happend since I had some import\export operations with my model.

I also try "Select By Current Morph Map (https://www.lightwave3d.com/assets/plugins/entry/select-by-current-weightmorph-map/)" and "Select By AnyMap (https://www.lightwave3d.com/assets/plugins/entry/select-by-anymap/)" from Akira Asagi, they did not work as I expected.

Here is a little script do the job well in blender: https://blender.stackexchange.com/questions/116764/select-vertices-which-are-affected-by-a-shape-key

Any help?


Save duplicate (just in case) of file.

Apply Morph.

Make base in 1st layer, morphed and applied in 2nd layer.

Bg To Morph will make new morph only from vertexes which are different between base and transformed state, so the all vertexes with 0,0,0 relative offset will be ignored. And Select by map should start working as expected again.

mewnow
03-20-2019, 11:54 PM
If you only want to select points that are both a) mapped to a selected Morph map, and b) have at least one X,Y,Z dimension within that Morph map that's non-zero, here's a quick hack of the script that may work for you.

Note that I removed all the options except the Morph map, including the Select Polygons option. If you need the polygons selected, use the script to select the non-zero Morph map points, and then the Selection=>Polys=>Sel Polys menu entry.

Hope it works for you!
mTP

Yeah, really nice script! It did what I want. Thanks for everything, mTp.

I don't know if it is possible, but I think it will be better if the script does its job according to the Vertex Maps Panel(F8) highlighted selection but no need another select popup.

One more request, can I get an version that gets the invert selection automatically?

Thanks

MonroePoteet
03-21-2019, 09:49 AM
I don't see any mechanism in the LScript Scene Object Agent documentation for querying the currently selected Vertex Map from the panel or lower-right drop-down. I could SET the currently selected VMap to be whatever you choose in the script's pulldown, but I don't think I can query what's selected in Modeler. The automatic selection inversion is simply adding a selinvert() after the work is done, leaving points selected which a) are in the Morph Map and b) have ALL of the X,Y, and Z dimensions equal to zero.

If that's what you want, it should be a few minutes worth of work.

mTp

Sensei
03-21-2019, 11:10 AM
In C/C++ and Python it's LWStateQuery.vmap();
LWSDK 2019/html/globals/modstate.html

"
vmapname = vmap( index, lwid )
Returns the name of the currently selected vertex map, and stores the LWID of the vmap in the second argument. The index can be one of the following.

LWM_VMAP_WEIGHT
LWM_VMAP_TEXTURE
LWM_VMAP_MORPH

"

Kryslin
03-21-2019, 11:31 AM
I seem to remember that an index of 0 for a given map type will assign the selected vertex map to the vertex map agent...
"The currently selected Weight, Texture or Morph vertex map can now be acquired in Modeler by providing an index value of zero (0) to the VMap() constructor when specifying one of the three vertex map types..."
(From Mike Green's lscript documentation)(http://www.mikegreen.name/Lscript/Lscript%20Index.html)

mewnow
03-21-2019, 07:42 PM
I don't see any mechanism in the LScript Scene Object Agent documentation for querying the currently selected Vertex Map from the panel or lower-right drop-down. I could SET the currently selected VMap to be whatever you choose in the script's pulldown, but I don't think I can query what's selected in Modeler. The automatic selection inversion is simply adding a selinvert() after the work is done, leaving points selected which a) are in the Morph Map and b) have ALL of the X,Y, and Z dimensions equal to zero.

If that's what you want, it should be a few minutes worth of work.

mTp

"Do the job" by current morph map is fine, something like Select By Current Morph Map (https://www.lightwave3d.com/assets/plugins/entry/select-by-current-weightmorph-map/). No more select target morph map from list in a popup window.

Thanks.

MonroePoteet
03-21-2019, 10:32 PM
I seem to remember that an index of 0 for a given map type will assign the selected vertex map to the vertex map agent...
"The currently selected Weight, Texture or Morph vertex map can now be acquired in Modeler by providing an index value of zero (0) to the VMap() constructor when specifying one of the three vertex map types..."
(From Mike Green's lscript documentation)(http://www.mikegreen.name/Lscript/Lscript%20Index.html)

Yep, works great! Thanks for the pointer both to the "trick" and to Mike Green's nicely organized documentation!

Here's the script SelectUninfluencedMorphMapPoints.ls which selects points which are either not in the Morph map at all, or have all zero "dimensions" in the map entry (i.e. no change from the base). You need to select a Morph map in the F8 vertex map panel or in the lower-right pulldown first.

mTp

mewnow
03-22-2019, 01:41 AM
Huge help!!! Thanks mTp, thanks for everything.
Then, if I want to select the points which were influenced by current morph map, just comment the selinvert(); line?

MonroePoteet
03-22-2019, 08:39 AM
You bet! Glad it works for you!

Yes, putting a // comment designator at the front of the selinvert(); line would cause the script to select all points which are 1) in the Morph Map and 2) have at least one non-zero X,Y,Z in that Morph Map.

mTp