Strange crash on a single file with Open Maya editting normals

Strange crash on a single file with Open Maya editting normals

Anonymous
Not applicable
696 Views
4 Replies
Message 1 of 5

Strange crash on a single file with Open Maya editting normals

Anonymous
Not applicable

I've been making a few scripts to fiddle with maya's meshes in a way more convenient than the standard tools for a few specific cases. I've usually chosen the Open Maya API since it reads and writes more cleanly than standard Cmds commands.
The lastest script, included in the zip as NewScript, I've written seem to reliable crash on 1 of my test files that had another on of my scripts run on it.

In the attached zip I've included the crash log and hopefully related dumps (copied everything from the time of crash)
The crash log seems to point to the bottom half of the split cube in ModNormTest failing to run a getNormalIndices() on it's MeshVertexIterator.

The only thing that is out of the ordinary in this file is that I've run a different script before which I included in the zip as PreScript.

the goal of PreScript is to make normal point away from a given point. The goal of NewScript is to average the edge vertex normals of 2 meshes OR copy the edge normals from one mesh to another. The or depends on the isAverage boolean.

I'm really unclear what I did wrong in either the scene or the scripts. My current suspicion is that I created an edge case the API can't handle or that I'm missing a finalizing method for my normal edits.

0 Likes
697 Views
4 Replies
Replies (4)
Message 2 of 5

cheng_xi_li
Autodesk Support
Autodesk Support

Hi,

 

I tried to run your script to reproduce the crash on my machine, but it seems that it misses some function(s) like getFullComponentList in your sample. Could you send us a sample with those functions? 

 

I also found your functions need two objects selected, are they targetCube and pCube2?

 

BTW: Should I run the preScript first with the testing scene? Which referencePoint did you set?

 

Yours,

Li

0 Likes
Message 3 of 5

Anonymous
Not applicable

Excuse the missing methods. I thought I had filtered all the relevant parts from the larger library these scripts belong to in my local setup. I've included an updated version of that script file. I did an extra local test run to ensure I had all the methods involved.

As for the prescript file. It's to show the method I ran on the box parts to create this test case. In case the error comes from an earlier misuse in API on my end.

To create the test maya file I first ran the prescript with the center of the complete box as a reference point and after splitting the box in 2 parts I ran the prescript again on the top half with (0, 0, 0) as a reference point to create a visual seam in the mesh shading. After this the file was saved for later use once the new script was fully written.

For running the NewScript file I usually select the bottom half of the box then the top half, go into vertex selection and select the seam area of the box halves. The script also works without going into a sub object selection mode (the differences are taken care of by the getSelectedVertexIdsByComponent method)

0 Likes
Message 4 of 5

cheng_xi_li
Autodesk Support
Autodesk Support

Hi,

 

I tested updated code and scene with debug version today. It suggests the cube's topology is corrupted and accessing to normals out of index.

 

So I tried to reproduce the scene with your prescript but it seems missing something.

 

Here are steps that I tried to reproduce the scene:

1. Create a cube

1a). Create two subdivisions

2. Run prescript

3. Select Modeling toolkit>Mesh>Tools>Multi-Cut Tool

4. Check at Slice Tool>Check "Extract Faces"

5. Click at XZ

6. Click at Seperate

7. Run prescript with polySurface1

 

It doesn't crash when I tried to copy normals from polySurface1 to polySurface2 and it is far from replicating your scene. Could you share the details of how you are creating the scene? There might be a warning once I've modified something I shouldn't.

 

Yours,

Li

 

0 Likes
Message 5 of 5

Anonymous
Not applicable

There is a difference in how you made the object and how I made it.

I made a poly cube.
Made it larger and more subdided via the attribute editor tab.
Moved it up a bit so the bottom is sort of on world 0,0,0.
Editted normals with the prescript with the cube center as a reference point.
Duplicated the resulting mesh.
Deleted the top half of one with face component selection.
Deleted the bottom half of the other in the same manner.
Selected the top half again and re-ran te prescript with 0,0,0 as the reference point.

I tried recreating everything from scratch again myself just now but I don't seem to be able to get to the same point of error. Even with saving the file after creation and restarting maya. Could be that my process of getting to the code I sent here eventually corrupted the file without my immediate knowledge. =S
The script states during me figuring out how I should use the mesh structure are lost though.

A few things I didn't understand immediately was that vertices have a normal per polygon-vertex pair. So my first attempt assigned the source object normals to the target it's normalsList on vertexId. But that was very obviously wrong and I don't think I saved that state ever. Although if that sounds like somethign that could corrupt a mesh then maybe I did and reran the other script to return to the initial test state.

I did always work with a full normals list that I assigned to the mesh after all the edits because editting normal per normal is incredibly slow.

If this doens't lead to any clear reason to me breaking this scene I guess the only assumption can be that whatever broke it got removed while rewriting the script to do what was intended.

0 Likes