View Full Version : Python help() question...what is lnum?

04-13-2012, 08:48 PM
I'm trying to see if a given object has had its pivot point moved. I can parse the text of the scene file in order to do this, but I'd rather learn the "right" way in LightWave Python.

The LWObjectFuncs has a function called "pivotPoint." I'm hoping that this might return the pivot offset if one exists, but I could be looking in the wrong spot. However, I'm confused about part of the documentation:

pivotPoint(self, *args)
pivotPoint(self, int obj, int lnum)

What is "lnum"? I'm having trouble figuring this out.

I figured out that "int obj" refers to the index of the object, and not the object ID. That is, if you had five entries in the Current Item list, an "int obj" of 0 would ignore any nulls and instead return the very first LoadObjectLayer item present in the scene.

However, I'm not yet sure what "lnum" represents. Does it refer to the "DATA" variables listed in help(lwsdk)?

04-14-2012, 01:11 AM
What is "lnum"? I'm having trouble figuring this out.

lnum would be the layer number of the object. The help seems to omit what pivotPoint should return though, so that will be an exciting surprise.

04-14-2012, 01:23 AM
As discussed via email, that isn't quite the right function to use for what you want to do. You're after the item pivots, not the mesh pivots. But for completeness sake, lnum is the layer number or index.

In Layout the same LWO can be referenced by multiple object items. LWObjectFuncs gives access to the database of loaded LWOs. The connection between an object item and the LWO is via the filename. You get the LWO filename for an item from LWObjectInfo, then match that up with the filenames of the objects in the database using LWObjectFuncs.

An item in Layout can reference only one layer in an object. The index of the layer which it is referencing can be obtained by parsing the item name to extract the layer name, and then matching it with the layer names obtained through the LWObjectFuncs.

There is no relation between the object index and the LWItemIDs or the order in which items are in the scene.