HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DOP_FullPathData.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: DOP_FullPathData.h ( SOP Library, C++)
7  *
8  * COMMENTS:
9  */
10 
11 #ifndef __DOP_FullPathData_h__
12 #define __DOP_FullPathData_h__
13 
14 #include "DOP_API.h"
15 #include <UT/UT_Array.h>
16 #include <UT/UT_String.h>
17 #include <OP/OP_Node.h>
18 #include <GU/GU_DetailHandle.h>
19 #include <SIM/SIM_FullPathData.h>
20 #include "DOP_Engine.h"
21 
22 class UT_WorkBuffer;
23 class UT_StringArray;
25 class SIM_Data;
26 class SIM_Object;
28 class SIM_SDF;
29 class OP_Context;
30 class OP_GlobContext;
31 class DOP_Parent;
33 
35 {
36 public:
38  {
39  myDataName.setAlwaysDeep(true);
40  }
41 
43  {
44  myRootData = src.myRootData;
45  myData = src.myData;
46  myDataName = src.myDataName;
47  myDataName.setAlwaysDeep(true);
48  }
49 
50  static const SIM_Position *getBestPosition(const SIM_RootData *rootdata,
51  const SIM_Data *data,
52  const char *dataname)
53  {
54  return SIMgetBestPosition(rootdata, data, dataname);
55  }
56 
58  {
59  return getBestPosition(myRootData, myData, myDataName);
60  }
61 
62  static GU_ConstDetailHandle getBestGeometry(UT_DMatrix4 &xform,
63  const SIM_RootData *rootdata,
64  const SIM_Data *data,
65  const char *dataname,
66  fpreal simtime,
67  const bool doceflush = true);
68 
69  GU_ConstDetailHandle getBestGeometry(UT_DMatrix4 &xform) const;
70 
71  bool operator==(const DOP_FullPathData &cmp) const
72  {
73  return ((myNode == cmp.myNode) &&
74  (myParent == cmp.myParent) &&
75  (myRootData == cmp.myRootData) &&
76  (myData == cmp.myData) &&
77  (myDataName == cmp.myDataName));
78  }
79 
80  void clear()
81  {
82  myNode = 0;
83  myParent = 0;
84  myRootData = 0;
85  myData = 0;
86  myDataName = "";
87  myGlobalTime = 0;
88  }
89 
90  OP_Node *myNode = nullptr;
91  DOP_Parent *myParent = nullptr;
92  const SIM_RootData *myRootData = nullptr;
93  const SIM_Data *myData = nullptr;
95 
96  // Not simulation time.
97  fpreal myGlobalTime = 0;
98 };
99 
100 class DOP_API DOP_FullPathDataArray : public UT_Array<DOP_FullPathData>
101 {
102 public:
104  virtual ~DOP_FullPathDataArray();
105 
106  void buildFromPaths(const UT_StringArray &paths);
107  void getObjectArray(SIM_ConstObjectArray &objects) const;
108  void getObjectString(UT_WorkBuffer &buffer) const;
109 };
110 
111 DOP_API bool DOPfindDataFromPath(const char *path,
112  DOP_FullPathData &fulldata,
113  fpreal time, OP_Node *relativetonode = 0,
114  bool dopparentisenough = false);
115 /// Version of DOPfindDataFromPath() that uses the provided SIM_Engine instead
116 /// of searching for a DOP node at the beginning of the path.
118 DOP_API bool DOPfindDataFromPath(const char *path,
119  DOP_FullPathData &fulldata,
120  const SIM_Engine &engine,
121  const SIM_Time &sim_time,
122  bool interpolate_data);
123 DOP_API bool DOPfindAllDataFromPath(const char *path,
124  DOP_FullPathDataArray &fulldata,
125  fpreal time, OP_Node *relativetonode = 0,
126  bool dopparentisenough = false);
127 /// Version of DOPfindAllDataFromPath() that uses the provided SIM_Engine
128 /// instead of searching for a DOP node at the beginning of the path.
130 DOP_API bool DOPfindAllDataFromPath(const char *path,
131  DOP_FullPathDataArray &fulldata,
132  const SIM_Engine &engine,
133  const SIM_Time &sim_time,
134  bool interpolate_data);
135 DOP_API void DOPglobPathAndFindAllData(const char *path,
136  DOP_FullPathDataArray &fulldata,
137  OP_NodeList &nodatadopnets,
138  fpreal time, OP_Node *relativetonode = 0,
139  OP_GlobContext *context = 0,
140  OP_Node *errorsink = 0);
141 
142 /// If the dopparent is currently simulating it is not possible to
143 /// reset its time. Similarly, if the desired time is within the last
144 /// timestep, we can't interpolate since the actual 'current' value
145 /// of the object is stored at the end time.
146 /// Returned from this is the new time to use for accesses.
147 /// In case of unsimulated networks, it is the same as
148 /// dopparent->setDOPTime(time); return time;
150 
151 /// The following functions are the only ones which are thread-safe for
152 /// accessing DOP data
153 // @{
154 
155 /// Thread-safe method to find the owner node of a DOP data path
157  const char *path,
158  fpreal time, OP_Node *relativetonode = 0,
159  bool dopparentisenough = false);
160 
161 /// Thread-safe method to world transform of the a DOP data path, optionally
162 /// returning the geometry if there is any (and gdh is non-NULL). If given
163 /// an interested_node, then we will add an extra input on it to the path.
165  UT_DMatrix4 &xform,
167  bool &timedep,
168  const char *path,
169  OP_Context &context,
170  OP_Node *relativetonode = 0,
171  bool dopparentisenough = false,
172  OP_Node *interested_node = 0);
173 
174 // @}
175 
176 #endif
177 
SIM_API bool SIMfindDataFromPath(const char *path, SIM_FullPathData &fulldata, const SIM_Engine &engine, const SIM_Time &sim_time, bool interpolate_data)
DOP_API bool DOPgetWorldTransformFromDataPath(UT_DMatrix4 &xform, GU_ConstDetailHandle *gdh, bool &timedep, const char *path, OP_Context &context, OP_Node *relativetonode=0, bool dopparentisenough=false, OP_Node *interested_node=0)
GT_API const UT_StringHolder time
GLsizei const GLchar *const * path
Definition: glcorearb.h:3341
IMATH_HOSTDEVICE constexpr int cmp(T a, T b) IMATH_NOEXCEPT
Definition: ImathFun.h:84
#define SYS_DEPRECATED_REPLACE(__V__, __R__)
Definition: core.h:760
#define DOP_API
Definition: DOP_API.h:10
This class holds a signed distance function representing a GU_Detail.
Definition: SIM_SDF.h:27
UT_StringHolder myDataName
DOP_API OP_Node * DOPgetNodeFromDataPath(const char *path, fpreal time, OP_Node *relativetonode=0, bool dopparentisenough=false)
Thread-safe method to find the owner node of a DOP data path.
DOP_API bool DOPfindDataFromPath(const char *path, DOP_FullPathData &fulldata, fpreal time, OP_Node *relativetonode=0, bool dopparentisenough=false)
const SIM_Data * myData
static const SIM_Position * getBestPosition(const SIM_RootData *rootdata, const SIM_Data *data, const char *dataname)
Holds pointers to a number of const SIM_Object objects.
SIM_API const SIM_Position * SIMgetBestPosition(const SIM_RootData *rootdata, const SIM_Data *data, const char *dataname)
DOP_FullPathData(const SIM_FullPathData &src)
const SIM_RootData * myRootData
fpreal64 fpreal
Definition: SYS_Types.h:277
bool operator==(const DOP_FullPathData &cmp) const
SIM_API bool SIMfindAllDataFromPath(const char *path, UT_Array< SIM_FullPathData > &fulldata, const SIM_Engine &engine, const SIM_Time &sim_time, bool interpolate_data)
DOP_API void DOPglobPathAndFindAllData(const char *path, DOP_FullPathDataArray &fulldata, OP_NodeList &nodatadopnets, fpreal time, OP_Node *relativetonode=0, OP_GlobContext *context=0, OP_Node *errorsink=0)
DOP_API bool DOPfindAllDataFromPath(const char *path, DOP_FullPathDataArray &fulldata, fpreal time, OP_Node *relativetonode=0, bool dopparentisenough=false)
DOP_Parent * myParent
DOP_API SIM_Time DOPsetBestTime(DOP_Parent *dopparent, SIM_Time time)
const SIM_RootData * myRootData
const SIM_Position * getBestPosition() const
Definition: format.h:895
const SIM_Data * myData
GLenum src
Definition: glcorearb.h:1793