Select (lxu-select.hpp)

From The Foundry MODO SDK wiki
Revision as of 18:29, 16 August 2013 by Adissid (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

This module provides utility classes for accessing some common selection states for mesh components and items.

These classes have grown organically, so they don't necessarily handle every case for every selection type. File bugs if you find holes that should be filled!


This class can be used to access vertex selections.

  • AnyDirect() -- returns true if there is a direct vertex selection, i.e. the user has chosen some verts in vertex mode.
  • AnyIndirect() -- returns true if there is an indirect vertex selection, i.e. layer scanning in vertex mode will affect something.
  • GetDirectList(MeshList &) -- returns a list of directly selected vertices. Since there can be vertices from multiple meshes, this returns a nested list.
	CLxVertexSelection                 *vsel;
	CLxVertexSelection::MeshList        mlist;
	CLxVertexSelection::MeshList_Itr    mitr;
	CLxVertexSelection::PointList_Itr   pitr;

	vsel.GetDirectList (mlist);
	for (mitr = mlist.begin (); mitr != mlist.end (); mitr++) {
		//mitr->mesh -- the mesh object
		//mitr->item -- the mesh item

 		for (pitr = mitr->plist.begin (); pitr != mitr->plist.end (); pitr++) {
			//(*pitr) -- LXtPointID


This class can be used to access vertex map selections.

  • GetFirst (std::string &) -- get the name of the first selected map
  • GetList (MapList &) -- get the list of all selected maps by name and type
  • Include (LXtID4) -- virtual method that can limit the subset of types the class supports


This class can be used to access item selections, both reading and writing.

  • GetFirst (CLxUser_Item &) -- get the first selected item
  • GetList (ItemList &) -- get the selected items as a list (where order matters)
  • GetSet (ItemSet &) -- get selected items as a set (for testing items against selection)

The next set of methods are used for looping over item selection.

  • LoopInit ()
  • LoopNext (CLxUser_Item &)
  • LoopStop ()
	CLxItemSelection	 isel;
	CLxUser_Item		 item;

	for (isel.LoopInit (); isel.LoopNext (item); ) {
		dbOut ("item %s is selected", item.IdentPtr ());

This is a virtual method which can be overridden in a subclass to limit the scan and list methods to only a subset of selected items.

  • Include (CLxUser_Item &item)

The methods manipulate the item selection.

  • Drop () -- drop all selected items and set to item mode
  • Clear () -- drop selected items without changing mode
  • Select (CLxUser_Item &) -- add the given item to the selection
  • Deselect (CLxUser_Item &) -- remove the item from the selection


This is a subclass of CLxItemSelection but limited to a specific item type given in the constructor.

        CLxItemSelectionType    meshsel (LXsITYPE_MESH);
        CLxUser_Item            item;

        if (meshsel.GetFirst (item)) {
                dbOut ("item %s is the first selected mesh", item.IdentPtr ());


This class can be used to read the current scene.

  • Get (CLxUser_Scene &) -- get the current scene object
  • Get (CLxUser_ChannelRead &evalChan) -- read evaluated channels from the current scene
  • Get (CLxUser_ChannelRead &actChan, const char *action) -- read channels from the named action in the current scene