PDA

View Full Version : Layer name



regularfry
03-30-2006, 08:26 AM
Ok, I *swear* I've looked through the SDK docs. I just can't figure this out. I'm in a MeshDataEdit plugin. I've got an object reference name and a layer number. How do I get the layer name?

objfunc->layerName takes an object id, and I can't see where I'm supposed to get that from. Can I presume that, since I can only be editing one object, that the id of the active object is always going to be 0? The docs don't make it clear at all...

Sensei
04-10-2006, 07:28 AM
Ok, I *swear* I've looked through the SDK docs. I just can't figure this out. I'm in a MeshDataEdit plugin. I've got an object reference name and a layer number. How do I get the layer name?

You need Scene Objects global..
http://www.newtek.com/lightwave/developer/LW80/8lwsdk/docs/globals/sceneobj.html

However, converting the currently edited object to the form that Scene Object requires is pretty complicated.. You need to get reference name, and find one on the object list maintained by Scene Object..

Sensei
04-10-2006, 07:29 AM
BTW, reference name of the currently edited object you're getting using State Query..
http://www.newtek.com/lightwave/developer/LW80/8lwsdk/docs/globals/modstate.html

regularfry
04-11-2006, 09:24 AM
BTW, reference name of the currently edited object you're getting using State Query..
http://www.newtek.com/lightwave/developer/LW80/8lwsdk/docs/globals/modstate.html

Soooo, something along the lines of:


char *ref_name;
ref_name = query->object();
int done=0;
int i=-1;
while((i<objfunc->numObjects()) && !done){
i++;
done = strcmp(objfunc->refName(i), ref_name) == 0;
}
char *layername;
layername = objfunc->layerName(i, layernum);

? That looks about right to me (mod some error checking)...

Sensei
04-11-2006, 11:50 AM
Soooo, something along the lines of:

Hehe, nice way to complicate stuff..
Have no idea whether it'll work just by looking at it.. I prefer for() loops, with not-null checking whereever possible..