|
I’ve been struggling to find a good, reliable way of extracting normals from a mesh that were explicitly specified using the Edit Normals modifier.
The problem is that these normals do not appear to pass through to the Mesh that is created as a result of converting a node’s Object to a TriObj. I’ve tried getting the normals using the IEditNormalsMod interface (after searching for the appropriate modifier) and while this works sometimes, there are a few shortcomings:
1)The mesh’s node needs to be selected.
2)The ‘modify’ panel needs to be visible.
3)If I force steps 1 and 2 using GetCOREInterface()->SelectNode() and GetCOREInterface()->SetCommandPanelTaskMode(), Max sometimes crashes.
4)This approach is ugly.
This doesn’t seem like such a difficult problem to solve but I’ve spent an enormous time looking for a solution. Any help would be appreciated.
P.S. - Using IGame is not an option.
|
|
|
|
Did you figure out a solution for this? If not, I can ask one of the coders here how we did it for our exporter.
|
|
|
|
Try this… currently only spits our the “true” explicit test...but I’m sure you can mod it
you can do a quick test using $geometry as the objs_array argument.
Hope it helps.
fn exp_norms objs_array =
(
max modify mode
for each in objs_array do
(
if(validmodifier each each.modifiers[#edit_normals]) then
(
each
select each
normnum = (each.modifiers[1].editnormalsmod.getnumnormals node:each)
format “%\n” each.name
for i = 1 to normnum do
(
format “Normal#:% Value:%\n” i (each.modifiers[1].editnormalsmod.getnormalexplicit i node:each)
)
)
)
)
|
|
|