Editor API
UnigineEditor public API
|
This class is used to manage selected nodes along with their subobjects (such as surfaces, shapes, joints, billboards, etc.). More...
#include <Selector.h>
Classes | |
class | SubItemList |
This class represents a list of selected subitems of a selected node. When an object is selected, some of its surfaces or collision shapes can also be selected, the subitems list shall contain all of them. More... | |
Public Types | |
enum | SubType { INDEXED = 0, USER = 0x0100 } |
Subitem type. The first 256 types are reserved by UNIGINE, user subitem types start from USER + i (256 and higher). More... | |
Public Member Functions | |
SelectorNodes () | |
SelectorNodes (const QVector< Unigine::NodePtr > &nodes) | |
~SelectorNodes () override | |
int | type () const override |
Returns the current selector type. More... | |
bool | equal (const Selector *selector) const override |
Checks whether the selector is equal to the specified target selector. More... | |
SelectorNodes * | clone () const override |
Clones the current nodes selector. More... | |
QVector< Unigine::NodePtr > | getNodes () const |
Returns the list of all selected nodes. More... | |
int | size () const |
Returns the number of selected nodes. More... | |
bool | empty () const |
Checks whether the nodes selector is empty (no nodes are currently selected). More... | |
void | extend (const Unigine::NodePtr &node) |
Extends the current selection by adding the specified node to it. More... | |
void | extend (const QVector< Unigine::NodePtr > &nodes) |
Extends the current selection by adding the specified list of nodes to it. More... | |
void | extend (const Unigine::NodePtr &node, SubItemList *subs) |
Extends the current selection by adding the specified node to it along with the list of selected subitems. More... | |
void | exclude (const Unigine::NodePtr &node) |
Excludes the specified node from the current selection. More... | |
void | exclude (const QVector< Unigine::NodePtr > &nodes) |
Excludes the specified list of nodes from the current selection. More... | |
void | exclude (Constants::SubObjectType stype) |
Excludes the specified type of subitems from the current selection for all selected nodes (e.g., remove all joints from the selection for all selected nodes). More... | |
bool | contains (const Unigine::NodePtr &node) |
Checks whether the current selection contains the specified node. More... | |
SubItemList * | getSubItemList (int node_id) const |
Gets the list of subitems for the selected node with the specified ID. More... | |
SubItemList * | getSubItemList (const Unigine::NodePtr &node) const |
Gets the list of subitems for the specified selected node. More... | |
IndexList * | getIndexList (int node_id) const |
Gets the list of subitem indices for the the selected node with the specified ID. Some subitems (such as surfaces, shapes, joints, billboards, forces, noises, or deflectors) are referred to via indices, and unlike the getSubItemList() which returns the list of subitems, this method returns the list of indices for them. More... | |
IndexList * | getIndexList (const Unigine::NodePtr &node) const |
Gets the list of subitem indices for the specified selected node. Some subitems (such as surfaces, shapes, joints, billboards, forces, noises, or deflectors) are referred to via indices, and unlike the getSubItemList() which returns the list of subitems, this method returns the list of indices for them. More... | |
QSet< int > | getIntersectedIndexes (Constants::SubObjectType stype) const |
Gets the list of indices of the specified subitem type that are currently selected for all selected nodes (e.g., if surfaces 0, 1, 2, 3 of the first selected object and surfaces 1 and 3 of the second one are selected the result will be: {1, 3}). Some subitems (such as surfaces, shapes, joints, billboards, forces, noises, or deflectors) are referred to via indices, and unlike the getSubItemList() which returns the list of subitems, this method returns the list of indices for them. More... | |
void | resetCache () |
Resets nodes cache used for selection. Storing direct pointers to nodes is unsafe, so their IDs are stored instead. To optimize retrieval of nodes by their IDs the nodes cache is used. This method is used to reset this cache when it is no longer valid (e.g., in case of loading another world). More... | |
void | setNeedExpand (bool value) |
bool | isNeedExpand () const |
Public Member Functions inherited from Editor::Selector | |
Selector () | |
virtual | ~Selector () |
Static Public Member Functions | |
static SelectorNodes * | createObjectsSelector (const QVector< Unigine::NodePtr > &nodes) |
Creates a new selection (SelectorNodes) combining all objects from the specified list of nodes. All surfaces of these objects shall also be included in the current selection. More... | |
This class is used to manage selected nodes along with their subobjects (such as surfaces, shapes, joints, billboards, etc.).
Subitem type. The first 256 types are reserved by UNIGINE, user subitem types start from USER + i (256 and higher).
Editor::SelectorNodes::SelectorNodes | ( | ) |
|
explicit |
|
override |
|
overridevirtual |
Clones the current nodes selector.
Implements Editor::Selector.
bool Editor::SelectorNodes::contains | ( | const Unigine::NodePtr & | node | ) |
Checks whether the current selection contains the specified node.
node | Node to be checked. |
|
static |
Creates a new selection (SelectorNodes) combining all objects from the specified list of nodes. All surfaces of these objects shall also be included in the current selection.
bool Editor::SelectorNodes::empty | ( | ) | const |
Checks whether the nodes selector is empty (no nodes are currently selected).
|
overridevirtual |
Checks whether the selector is equal to the specified target selector.
selector | Target selector. |
Implements Editor::Selector.
void Editor::SelectorNodes::exclude | ( | const Unigine::NodePtr & | node | ) |
Excludes the specified node from the current selection.
node | Node to be excluded from the current selection. |
void Editor::SelectorNodes::exclude | ( | const QVector< Unigine::NodePtr > & | nodes | ) |
Excludes the specified list of nodes from the current selection.
nodes | Vector containing nodes to be excluded from the current selection. |
void Editor::SelectorNodes::exclude | ( | Constants::SubObjectType | stype | ) |
Excludes the specified type of subitems from the current selection for all selected nodes (e.g., remove all joints from the selection for all selected nodes).
stype | Type of subitems to be excluded from the current selection for all nodes (Constants::SubObjectType). |
void Editor::SelectorNodes::extend | ( | const Unigine::NodePtr & | node | ) |
Extends the current selection by adding the specified node to it.
node | Node to be added to the current selection. |
void Editor::SelectorNodes::extend | ( | const QVector< Unigine::NodePtr > & | nodes | ) |
Extends the current selection by adding the specified list of nodes to it.
nodes | Vector containing nodes to be added to the current selection. |
void Editor::SelectorNodes::extend | ( | const Unigine::NodePtr & | node, |
SubItemList * | subs | ||
) |
Extends the current selection by adding the specified node to it along with the list of selected subitems.
node | Node to be added to the current selection. |
subs | List of subitems to be added to the current selection. |
IndexList* Editor::SelectorNodes::getIndexList | ( | int | node_id | ) | const |
Gets the list of subitem indices for the the selected node with the specified ID. Some subitems (such as surfaces, shapes, joints, billboards, forces, noises, or deflectors) are referred to via indices, and unlike the getSubItemList() which returns the list of subitems, this method returns the list of indices for them.
node_id | ID of the selected node for which the list of indices of selected subitems is to be obtained. |
IndexList* Editor::SelectorNodes::getIndexList | ( | const Unigine::NodePtr & | node | ) | const |
Gets the list of subitem indices for the specified selected node. Some subitems (such as surfaces, shapes, joints, billboards, forces, noises, or deflectors) are referred to via indices, and unlike the getSubItemList() which returns the list of subitems, this method returns the list of indices for them.
node | Selected node for which the list of indices of selected subitems is to be obtained. |
QSet<int> Editor::SelectorNodes::getIntersectedIndexes | ( | Constants::SubObjectType | stype | ) | const |
Gets the list of indices of the specified subitem type that are currently selected for all selected nodes (e.g., if surfaces 0, 1, 2, 3 of the first selected object and surfaces 1 and 3 of the second one are selected the result will be: {1, 3}). Some subitems (such as surfaces, shapes, joints, billboards, forces, noises, or deflectors) are referred to via indices, and unlike the getSubItemList() which returns the list of subitems, this method returns the list of indices for them.
stype | Selected node for which the list of indices of selected subitems is to be obtained. |
QVector<Unigine::NodePtr> Editor::SelectorNodes::getNodes | ( | ) | const |
Returns the list of all selected nodes.
SubItemList* Editor::SelectorNodes::getSubItemList | ( | int | node_id | ) | const |
Gets the list of subitems for the selected node with the specified ID.
node_id | ID of the selected node. |
SubItemList* Editor::SelectorNodes::getSubItemList | ( | const Unigine::NodePtr & | node | ) | const |
Gets the list of subitems for the specified selected node.
node | Selected node for which the list of selected subitems is to be obtained. |
bool Editor::SelectorNodes::isNeedExpand | ( | ) | const |
void Editor::SelectorNodes::resetCache | ( | ) |
Resets nodes cache used for selection. Storing direct pointers to nodes is unsafe, so their IDs are stored instead. To optimize retrieval of nodes by their IDs the nodes cache is used. This method is used to reset this cache when it is no longer valid (e.g., in case of loading another world).
void Editor::SelectorNodes::setNeedExpand | ( | bool | value | ) |
int Editor::SelectorNodes::size | ( | ) | const |
Returns the number of selected nodes.
|
overridevirtual |
Returns the current selector type.
Implements Editor::Selector.