PDA

View Full Version : A way to get the active flag on an item?



Dodgy
02-29-2012, 12:28 AM
Hey all,

Is there a member for getting the active state of a selected object? There's one for bones, but I haven't found one for lights/meshes/cameras...

Thanks,
Mike

iain_r
02-29-2012, 04:35 AM
Hi, I haven't found one in the docs and the SDK does not appear to have an active state flag either. There are flags but no values that are returned are for active state. I've only looked in the 9.6 docs.

Regards

Iain

Sensei
02-29-2012, 02:01 PM
LWItemInfo global

itemflags = flags( item )
Returns certain item settings as a set of bit flags:

LWITEMF_ACTIVE

Sensei
02-29-2012, 02:02 PM
To check which items are selected

LWInterfaceInfo global

const LWItemID *selItems;
unsigned int (*itemFlags) (LWItemID);

const LWItemID *items = interfaceinfo->selItems;
if( items != NULL )
{
for( int i = 0; items[ i ] != NULL; i++ )
{
LWItemID itemid = items[ i ];
if( ( interfaceinfo->itemFlags( itemid ) & LWITEMF_SELECTED ) != 0 )
{
// SELECTED ItemID
}
}
}

You must get InterfaceInfo always before using it, do NOT cache it initialization part.

Sensei
02-29-2012, 02:07 PM
Cameras don't care about activation flag AFAIK.

Which one is active depends on LWSceneInfo global
LWItemID (*renderCamera) (LWTime);

Lights and Objects do care.

Sensei
02-29-2012, 02:17 PM
scene.firstSelect() and scene.nextSelect()
firstSelect() and nextSelect() are used to cycle through the objects that are selected in the current scene. The methods are used in a fashion identical to other iteration methods, like firstChild() and nextChild() in the Layout Object Agent.

I would check if
obj = scene.firstSelect();
flags = obj.flags();
or
flags = obj.flags[1];
is working