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 
68  GU_ConstDetailHandle getBestGeometry(UT_DMatrix4 &xform) const;
69 
70  bool operator==(const DOP_FullPathData &cmp) const
71  {
72  return ((myNode == cmp.myNode) &&
73  (myParent == cmp.myParent) &&
74  (myRootData == cmp.myRootData) &&
75  (myData == cmp.myData) &&
76  (myDataName == cmp.myDataName));
77  }
78 
79  void clear()
80  {
81  myNode = 0;
82  myParent = 0;
83  myRootData = 0;
84  myData = 0;
85  myDataName = "";
86  myGlobalTime = 0;
87  }
88 
89  OP_Node *myNode = nullptr;
90  DOP_Parent *myParent = nullptr;
91  const SIM_RootData *myRootData = nullptr;
92  const SIM_Data *myData = nullptr;
94 
95  // Not simulation time.
96  fpreal myGlobalTime = 0;
97 };
98 
99 class DOP_API DOP_FullPathDataArray : public UT_Array<DOP_FullPathData>
100 {
101 public:
103  virtual ~DOP_FullPathDataArray();
104 
105  void buildFromPaths(const UT_StringArray &paths);
106  void getObjectArray(SIM_ConstObjectArray &objects) const;
107  void getObjectString(UT_WorkBuffer &buffer) const;
108 };
109 
110 DOP_API bool DOPfindDataFromPath(const char *path,
111  DOP_FullPathData &fulldata,
112  fpreal time, OP_Node *relativetonode = 0,
113  bool dopparentisenough = false);
114 /// Version of DOPfindDataFromPath() that uses the provided SIM_Engine instead
115 /// of searching for a DOP node at the beginning of the path.
118  DOP_FullPathData &fulldata,
119  const SIM_Engine &engine,
120  const SIM_Time &sim_time,
121  bool interpolate_data);
122 DOP_API bool DOPfindAllDataFromPath(const char *path,
123  DOP_FullPathDataArray &fulldata,
124  fpreal time, OP_Node *relativetonode = 0,
125  bool dopparentisenough = false);
126 /// Version of DOPfindAllDataFromPath() that uses the provided SIM_Engine
127 /// instead of searching for a DOP node at the beginning of the path.
129 DOP_API bool DOPfindAllDataFromPath(const char *path,
130  DOP_FullPathDataArray &fulldata,
131  const SIM_Engine &engine,
132  const SIM_Time &sim_time,
133  bool interpolate_data);
134 DOP_API void DOPglobPathAndFindAllData(const char *path,
135  DOP_FullPathDataArray &fulldata,
136  OP_NodeList &nodatadopnets,
137  fpreal time, OP_Node *relativetonode = 0,
138  OP_GlobContext *context = 0,
139  OP_Node *errorsink = 0);
140 
141 /// If the dopparent is currently simulating it is not possible to
142 /// reset its time. Similarly, if the desired time is within the last
143 /// timestep, we can't interpolate since the actual 'current' value
144 /// of the object is stored at the end time.
145 /// Returned from this is the new time to use for accesses.
146 /// In case of unsimulated networks, it is the same as
147 /// dopparent->setDOPTime(time); return time;
149 
150 /// The following functions are the only ones which are thread-safe for
151 /// accessing DOP data
152 // @{
153 
154 /// Thread-safe method to find the owner node of a DOP data path
156  const char *path,
157  fpreal time, OP_Node *relativetonode = 0,
158  bool dopparentisenough = false);
159 
160 /// Thread-safe method to world transform of the a DOP data path, optionally
161 /// returning the geometry if there is any (and gdh is non-NULL). If given
162 /// an interested_node, then we will add an extra input on it to the path.
164  UT_DMatrix4 &xform,
166  bool &timedep,
167  const char *path,
168  OP_Context &context,
169  OP_Node *relativetonode = 0,
170  bool dopparentisenough = false,
171  OP_Node *interested_node = 0);
172 
173 // @}
174 
175 #endif
176 
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)
#define const
Definition: zconf.h:214
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