Items

How do I determine the visibility of an item?

Item visibility is defined by a visibility channel that can be set by the user. However, other properties, such as the visibility of parents or the visibility settings of the groups the item belongs to, may modify or override that visibility channel. There is a hidden hVisible channel on locator type items that takes these extra properties into account. Reading this channel in an evaluated context will return the true visibility of an item.

C++

CLxUser_ChannelRead       chan_read;
int                       visible = 0;

chan_read.from (item, time);

visible = eval.IValue (item, LXsICHAN_LOCATOR_HVISIBLE);

Python

scene = item.Context ()

chan_read = lx.object.ChannelRead (scene.Channels (None, time))

visible = chan_read.Integer (item, item.ChannelLookup (lx.symbol.sICHAN_LOCATOR_VISIBLE))

How do I read server tags on a package?

Packages are servers, so you can access them through the HostService Interface as a Factory Object. This function returns the value for any server tag given the server class, the name of the server, and the tag key.

C++

                const char *
ServerTag (
                const char             *className,
                const char             *serverName,
                const char             *tagKey)
{
                CLxUser_HostService     hostSrv;
                CLxUser_Factory         factory;
                const char             *value;

                hostSrv.Lookup (fac, className, serverName);
                if (LXx_OK (fac.InfoTag (tagKey, &value))
                                return value;

                return 0;
}

In order to use this function to read server tag for item types (packages), you just need to find the package name from the item type.

C++

                bool
IsMask (
                CLxUser_Item           &item)
{
                CLxUser_SceneService    scnSrv;
                const char             *pkgName;

                scnSrv.ItemTypeName (item.Type (), &pkgName);
                return (ServerTag (LXa_PACKAGE, pkgName, LXsPKG_IS_MASK) != 0);
}