View Full Version : pntBaseNormal issue in Layout vs Modeler

06-20-2017, 05:30 PM
Hi, I'm having issues with using pntBaseNormal in Layout. I have a piece of code like this:

self.meshinfo.scanPoints(self.point_scan,(self.poi nts,))

.. and at some point down:

for pnt in self.points:
print self.meshinfo.pntBaseNormal(None, pnt) [0] # has_normal
print self.meshinfo.pntBaseNormal(None, pnt) [1] # vector

Now when I run the same code in Modeler, I get has_normal==1, and the vector is populated as I would expect.

When I run in this in Layout, has_normal==0, and the vector is zero'd (0,0,0).

I thought that normals in Layout may not be evaluating properly, so I thought I had the answer when I came upon this thread (http://forums.newtek.com/showthread.php?93455-pntBaseNormal-Problem&). Unfortunately, there is no difference.

I can confirm that I referring to a valid point id, and the other meshinfo function calls like pntBasePos is working both in Layout and Modeler. It's only the pntBaseNormal and pntOtherNormal that seems to be different.

Is there are particular method for setting/configuring Layout to make this evaluate properly? Or something else? Thanks for any help.


06-20-2017, 06:54 PM
Ok, well, I think posting that helped me figure it out.

So I had been using LWObjectFuncs's layerMesh. LWObjectFuncs, as the manual states, in an internal representation of objects loaded, so I imagined it's just LWO data, not evaluated data. This led me to think that not all LWMeshInfo structures are populated, as the SDK documentation hints at:

The LWMeshInfo structure describes the geometry of an object. You can get one of these from the Scene Objects and Object Info globals and from the access structure passed to the displacement handler evaluate function. What it contains can vary depending on how and when you obtain it. This structure is defined in the lwmeshes.h header file.

So I created a way to retrieve the a scene object LWItemID who uses so-and-so LWO and layer index, and using LWObjectInfo, I accessed meshInfo(LWItemID) to get to my evaluated mesh.