MNMesh ComputeRenderNormal gives Access Violation
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
I having trouble computing render normals on an MNMesh.
For example:
If I make a 1x1 plane (i.e. 1 face, 2 tris), convert it to an Editable Poly, and run the following,
the DebugPrint looks ok to me (below), but I get an access violation,
(and other, more complex polys are similar).
Strangely, if I zoom the viewport in and out before running the script, no violation...
Many thanks in advance, -Duncan.
def_visible_primitive(ComputeRenderNormal, "ComputeRenderNormal");
...
INode* node = static_cast<MAXNode*>(arg_list[0])->to_node();
const ObjectState* object_state = &node->EvalWorldState(MAXScript_time());
Object* object = object_state->obj;
PolyObject* poly_object = dynamic_cast<PolyObject*>(object);
MNMesh* mnmesh = &poly_object->GetMesh();
mnmesh->CheckAllData();
mnmesh->MNDebugPrint();
mnmesh->ComputeRenderNormal(0,0); <-- Access Violation 😞
MNMesh Debug Output: 4 verts, 4 edges, 1 faces
2024/08/01 10:26:20 [19564] : 68656ms : Vertex 0:
2024/08/01 10:26:20 [19564] : 68657ms : ( -23.065, -21.422, 0.000)
2024/08/01 10:26:20 [19564] : 68657ms : Edges: (
2024/08/01 10:26:20 [19564] : 68657ms : 0
2024/08/01 10:26:20 [19564] : 68657ms : 3
2024/08/01 10:26:20 [19564] : 68657ms : )
2024/08/01 10:26:20 [19564] : 68657ms : Faces: (
2024/08/01 10:26:20 [19564] : 68657ms : 0
2024/08/01 10:26:20 [19564] : 68657ms : )
2024/08/01 10:26:20 [19564] : 68658ms :
2024/08/01 10:26:20 [19564] : 68658ms : Vertex 1:
2024/08/01 10:26:20 [19564] : 68658ms : ( 23.065, -21.422, 0.000)
2024/08/01 10:26:20 [19564] : 68658ms : Edges: (
2024/08/01 10:26:20 [19564] : 68658ms : 2
2024/08/01 10:26:20 [19564] : 68658ms : 3
2024/08/01 10:26:20 [19564] : 68658ms : )
2024/08/01 10:26:20 [19564] : 68658ms : Faces: (
2024/08/01 10:26:20 [19564] : 68658ms : 0
2024/08/01 10:26:20 [19564] : 68659ms : )
2024/08/01 10:26:20 [19564] : 68659ms :
2024/08/01 10:26:20 [19564] : 68659ms : Vertex 2:
2024/08/01 10:26:20 [19564] : 68659ms : ( -23.065, 21.422, 0.000)
2024/08/01 10:26:20 [19564] : 68659ms : Edges: (
2024/08/01 10:26:20 [19564] : 68659ms : 0
2024/08/01 10:26:20 [19564] : 68659ms : 1
2024/08/01 10:26:20 [19564] : 68659ms : )
2024/08/01 10:26:20 [19564] : 68659ms : Faces: (
2024/08/01 10:26:20 [19564] : 68659ms : 0
2024/08/01 10:26:20 [19564] : 68660ms : )
2024/08/01 10:26:20 [19564] : 68660ms :
2024/08/01 10:26:20 [19564] : 68660ms : Vertex 3:
2024/08/01 10:26:20 [19564] : 68660ms : ( 23.065, 21.422, 0.000)
2024/08/01 10:26:20 [19564] : 68660ms : Edges: (
2024/08/01 10:26:20 [19564] : 68660ms : 1
2024/08/01 10:26:20 [19564] : 68660ms : 2
2024/08/01 10:26:20 [19564] : 68660ms : )
2024/08/01 10:26:20 [19564] : 68660ms : Faces: (
2024/08/01 10:26:20 [19564] : 68660ms : 0
2024/08/01 10:26:20 [19564] : 68661ms : )
2024/08/01 10:26:20 [19564] : 68661ms :
2024/08/01 10:26:20 [19564] : 68661ms : Edge 0:
2024/08/01 10:26:20 [19564] : 68661ms : verts (2 0), face 0
2024/08/01 10:26:20 [19564] : 68661ms :
2024/08/01 10:26:20 [19564] : 68661ms : Edge 1:
2024/08/01 10:26:20 [19564] : 68661ms : verts (3 2), face 0
2024/08/01 10:26:20 [19564] : 68661ms :
2024/08/01 10:26:20 [19564] : 68661ms : Edge 2:
2024/08/01 10:26:20 [19564] : 68661ms : verts (1 3), face 0
2024/08/01 10:26:20 [19564] : 68662ms :
2024/08/01 10:26:20 [19564] : 68662ms : Edge 3:
2024/08/01 10:26:20 [19564] : 68662ms : verts (0 1), face 0
2024/08/01 10:26:20 [19564] : 68662ms :
2024/08/01 10:26:20 [19564] : 68662ms : Face 0:
2024/08/01 10:26:20 [19564] : 68662ms : verts (
2024/08/01 10:26:20 [19564] : 68662ms : 2
2024/08/01 10:26:20 [19564] : 68662ms : 0
2024/08/01 10:26:20 [19564] : 68662ms : 1
2024/08/01 10:26:20 [19564] : 68662ms : 3
2024/08/01 10:26:20 [19564] : 68662ms : ) edges (
2024/08/01 10:26:20 [19564] : 68663ms : 0v
2024/08/01 10:26:20 [19564] : 68663ms : 3v
2024/08/01 10:26:20 [19564] : 68663ms : 2v
2024/08/01 10:26:20 [19564] : 68663ms : 1v
2024/08/01 10:26:20 [19564] : 68663ms : )
2024/08/01 10:26:20 [19564] : 68663ms : Map 1:
2024/08/01 10:26:20 [19564] : 68663ms : MNMap Debug Output: 4 verts, 1 faces
2024/08/01 10:26:20 [19564] : 68663ms : UVVert 0: 0.000000, 0.000000, 0.000000
2024/08/01 10:26:20 [19564] : 68663ms : UVVert 1: 1.000000, 0.000000, 0.000000
2024/08/01 10:26:20 [19564] : 68663ms : UVVert 2: 0.000000, 1.000000, 0.000000
2024/08/01 10:26:20 [19564] : 68663ms : UVVert 3: 1.000000, 1.000000, 0.000000
2024/08/01 10:26:20 [19564] : 68663ms : Face 0:
2024/08/01 10:26:20 [19564] : 68664ms : 2
2024/08/01 10:26:20 [19564] : 68664ms : 0
2024/08/01 10:26:20 [19564] : 68664ms : 1
2024/08/01 10:26:20 [19564] : 68664ms : 3
2024/08/01 10:26:20 [19564] : 68664ms :
2024/08/01 10:26:20 [19564] : 68664ms :
2024/08/01 10:26:20 [19564] : 68664ms :
Exception thrown at 0x00007FFCE5DD64DB (MNMath.dll) in 3dsmax.exe: 0xC0000005: Access violation reading location 0x0000000000000008.