HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
OP3D_GUSelectionSet.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  * NAME: OP3D_GUSelectionSet.h ( OP3D Library, C++)
7  */
8 
9 #ifndef __OP3D_GUSelectionSet__
10 #define __OP3D_GUSelectionSet__
11 
12 #include "OP3D_API.h"
13 
14 #include <GU/GU_SelectType.h>
15 #include <GA/GA_Types.h>
16 #include <UT/UT_NonCopyable.h>
17 #include <UT/UT_SharedPtr.h>
18 
19 class UT_JSONParser;
20 class UT_JSONWriter;
21 
24 
25 /// A set of selections, one for each unique selection type. The selection
26 /// handles may be freely assigned, unlike GU_SelectionSet.
28 {
29 public:
30  /// Construct a new empty selection set.
32 
33  /// Create a new selection set from a subset of an existing one.
35  const OP3D_GUSelectionSet &selection_set,
36  bool clone);
37 
38  /// Returns \c true if the set contains the requested selection
39  /// type.
40  bool hasType(GA_GroupType sel_type) const;
41 
42  /// Returns the entire group mask of selection types with non-null
43  /// selections.
44  GA_GroupMaskType typeMask() const;
45 
46  /// Returns the selection handle of the given selection type, which
47  /// may be empty.
49 
50  /// Set the selection handle of the given selection type. If the
51  /// selection handle points to a selection, then its selection type
52  /// must match that supplied.
53  void setSelection(GA_GroupType sel_type, GU_SelectionHandle selection);
54 
55  /// Save the selection set to a json stream.
56  bool save(UT_JSONWriter &w) const;
57 
58  /// Load the selection set from a json stream. Will recycle existing
59  /// selection objects, if possible, or create new ones if needed.
60  bool load(UT_JSONParser &p);
61 
62  int64 getMemoryUsage(bool inclusive) const;
63 
64 private:
65  GU_SelectionHandle mySelections[GA_GROUP_N];
66 };
67 
68 #endif // __GU_SelectionSet__
GT_API const UT_StringHolder selection
JSON reader class which handles parsing of JSON or bJSON files.
Definition: UT_JSONParser.h:87
Class which writes ASCII or binary JSON streams.
Definition: UT_JSONWriter.h:37
std::shared_ptr< T > UT_SharedPtr
Wrapper around std::shared_ptr.
Definition: UT_SharedPtr.h:36
long long int64
Definition: SYS_Types.h:116
UT_SharedPtr< GU_Selection > GU_SelectionHandle
GA_GroupType
An ordinal enum for the different types of groups in GA.
Definition: GA_Types.h:161
#define OP3D_API
Definition: OP3D_API.h:10
UT_SharedPtr< OP3D_GUSelectionSet > OP3D_GUSelectionSetHandle
GLubyte GLubyte GLubyte GLubyte w
Definition: glcorearb.h:857
GA_GroupMaskType
Definition: GA_Types.h:175