HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
OBJ_DopNet.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: OBJ_DopNet.h (Custom Library, C++)
7  *
8  * COMMENTS: An object to describe a motion capture handle
9  *
10  */
11 
12 #ifndef __OBJ_DopNet__
13 #define __OBJ_DopNet__
14 
15 #include "OBJ_API.h"
16 #include "OBJ_Node.h"
17 #include <DOP/DOP_Engine.h>
18 #include <DOP/DOP_Parent.h>
19 #include <SYS/SYS_Types.h>
20 
21 
22 #define FLOAT_OBJ_PARM(name, idx, vi, t) \
23  return evalFloat(name, &getIndirect()[idx], vi, t);
24 #define INT_OBJ_PARM(name, idx, vi, t) \
25  return evalInt(name, &getIndirect()[idx], vi, t);
26 #define STR_OBJ_PARM(name, idx, vi, t) \
27  evalString(str, name, &getIndirect()[idx], vi, t);
28 
29 
30 class SIM_RenderParms;
31 class UT_String;
32 
33 
35 {
63 
65 };
66 
67 enum
68 {
80 };
81 
82 class OBJ_API OBJ_DopNet : public OBJ_Node, public DOP_Parent
83 {
84 public:
86  const char *name,
87  OP_Operator *op);
88  ~OBJ_DopNet() override;
89 
90  static CH_LocalVariable theVariables[];
91  /// Handle the evaluation of standards string local variables.
92  bool evalVariableValue(
94  int index,
95  int thread) override;
97  fpreal &v,
98  int i,
99  int thr) override
100  {
101  return OBJ_Node::
102  evalVariableValue(v, i, thr);
103  }
104 
105  const char *getChildType() const override;
106  OBJ_OBJECT_TYPE getObjectType() const override;
107  OP_OpTypeId getChildTypeID() const override;
108 
109  static const char *theChildTableName;
110 
111  OP_Node *getRenderNodePtr() override;
112  int isObjectRenderable(fpreal t) const override;
113 
114  // Functions for going through all our simulation objects and returning
115  // the geometry representing each one.
116  int getNumDOPGeometries() const;
117  GU_ConstDetailHandle getDOPGeometry(int index,
118  UT_DMatrix4 &xform,
119  bool fordisplay,
120  bool acceptguide) const;
121  const SIM_Data *getDOPData(int index) const;
122  const SIM_RootData *getDOPRootData(int index) const;
123  const SIM_RenderParms *getDOPRenderParms(int index) const;
124  bool getDOPIsGuide(int index) const;
125  bool getIsTimeless() const override
126  { return TIMELESS(); }
127  bool opIsContinuousCook() const override
128  { return CONTINUOUSCOOK(); }
129  exint opContinuousCookTick() const override
130  { return CONTINUOUSCOOK_TICK(); }
131  void addExtraSimDependencies(DEP_MicroNode *depnode) override;
132 
133  DOP_Parent *castToDOPParent() override;
134  const DOP_Parent *castToDOPParent() const override;
135 
136  static OP_Node *myConstructor(OP_Network *net,
137  const char *name,
138  OP_Operator *entry);
139  static PRM_Template *getObsolete();
140  static PRM_Template *getTemplateList();
141 
142  int isObjectLitBy(OBJ_Node *, fpreal) override { return 1; }
143  bool isLightInLightMask(const OBJ_Node *, fpreal) override
144  { return true; }
145 
146  int doDrawLit() const override { return 1; }
147 
149  { STR_OBJ_PARM("displayfilter", I_DOPNETDISPLAYFILTER, 0, 0.0); }
150 
151  bool ISPLAYER() const
152  { INT_OBJ_PARM("isplayer", I_DOPNETISPLAYER, 0, 0.0); }
153  void PLAYFILESNAME(UT_String &str) const
154  { STR_OBJ_PARM("playfilesname", I_DOPNETPLAYFILESNAME, 0, 0.0); }
155 
157  { STR_OBJ_PARM("initialstate", I_DOPNETINITIALSTATE, 0, 0.0); }
159  { FLOAT_OBJ_PARM("timestep", I_DOPNETTIMESTEP, 0, 0.0); }
160  int SUBSTEP()
161  { INT_OBJ_PARM("substep", I_DOPNETSUBSTEP, 0, 0.0); }
163  { FLOAT_OBJ_PARM("timeoffset", I_DOPNETTIMEOFFSET, 0, 0.0); }
165  { INT_OBJ_PARM("startframe", I_DOPNETFRAMEOFFSET, 0, 0.0); }
167  { FLOAT_OBJ_PARM("timescale", I_DOPNETTIMESCALE, 0, 0.0); }
169  { INT_OBJ_PARM("maxfeedback", I_DOPNETMAXFEEDBACK, 0, 0.0); }
171  { INT_OBJ_PARM("interpolate", I_DOPNETINTERPOLATE, 0, 0.0); }
172  int AUTORESIM()
173  { INT_OBJ_PARM("autoresim", I_DOPNETAUTORESIM, 0, 0.0); }
174  int DATAHINTS()
175  { INT_OBJ_PARM("datahints", I_DOPNETDATAHINTS, 0, 0.0); }
177  { INT_OBJ_PARM("cacheenabled", I_DOPNETCACHEENABLED, 0, 0.0); }
179  { INT_OBJ_PARM("cachetodisk", I_DOPNETCACHETODISK, 0, 0.0); }
181  { INT_OBJ_PARM("cachetodisknoninteractive", I_DOPNETCACHETODISKNONINTERACTIVE, 0, 0.0); }
183  { INT_OBJ_PARM("cachesubsteps", I_DOPNETCACHESUBSTEPS, 0, 0.0); }
185  { INT_OBJ_PARM("cachemaxsize", I_DOPNETCACHEMAXSIZE, 0, 0.0); }
186 
188  { STR_OBJ_PARM("compresssims", I_DOPNETCOMPRESSSIMS, 0, 0.0); }
189 
191  { INT_OBJ_PARM("explicitcache", I_DOPNETEXPLICITCACHE, 0, 0.0); }
193  { STR_OBJ_PARM("explicitcachename", I_DOPNETEXPLICITCACHENAME, 0, 0.0); }
195  { INT_OBJ_PARM("explicitcachensteps", I_DOPNETEXPLICITCACHENSTEPS, 0, 0.0); }
197  { INT_OBJ_PARM("explicitcachecheckpointspacing", I_DOPNETEXPLICITCACHECHECKPOINTSPACING, 0, 0.0); }
198  static int resimulateStatic(void *, int, fpreal64, const PRM_Template *, const UT_Options *);
199 
200  // This must be const so we thus don't use the indirect.
201  int TIMELESS() const
202  { return evalInt("timeless", 0, 0.0); }
203  bool CONTINUOUSCOOK() const
204  { return evalInt("continuouscook", 0, 0.0); }
206  { return evalInt("continuouscook_tick", 0, 0.0); }
207 
208  // The display and render ops of a DOP Network are always equal.
209  int getDandROpsEqual() override;
210  int updateDandROpsEqual(int check_inputs = 1) override;
211 
212  // Override clearInterrupted to avoid invalidating the whole cache when
213  // the user interrupts a cook.
214  void clearInterrupted() override;
215 
216  OBJ_DopNet *castToOBJDopNet() override { return this; }
217 
218  // invalidate any cached data
219  void clearCache() override;
220 
221  bool opIsPlayer() const override { return ISPLAYER(); }
222 
223 protected:
224  bool updateParmsFlags() override;
225  void getDescriptiveName(UT_String &name) const override;
226  void getDescriptiveParmName(UT_String &name) const override;
227 
228  // Used to get pointer to indirection indices for each object type
229  int *getIndirect() const override
230  { return myDopNetIndirect; }
231 
232  void childFlagChange(OP_Node *) override;
233 
234  // In the dark ages we had a parmchange call back to detect
235  // if sim parameter changed, so required this to know of
236  // any changed. However, this should no longer be required.
237  bool cookedDataUsesAllParameters() const override
238  { return false; }
239 
240  // Override DOP_Parent virtual functions.
241  const DOP_Engine &getEngineSubclass() const override;
242  void setDOPTimeSubclass(const SIM_Time &t) override;
244  void filterDataSubclass(const SIM_Time &t) override;
245 
246  void handleRefilterParms(const SIM_Time &t) override;
247  void handleResimParms(const SIM_Time &t) override;
248 
251  const CH_ChannelList &channels) override;
253  PRM_ParmNameMap &nmap,
254  UT_String &errors) override;
255 
256  void getOwnedMicroNodes(
257  DEP_MicroNodeList &micronodes) override;
258 
259  void dumpMicroNodes(
260  std::ostream &os,
261  bool as_DOT,
262  int indent_level) const override;
263 
264 private:
265  DOP_Engine myEngine;
267  SIM_ConstDataArray myData;
268  UT_Array<GU_ConstDetailHandle> myGeometries;
269  UT_Array<UT_DMatrix4> myPositionData;
271  UT_BitArray myGeoIsGuide;
272 
273  static int *myDopNetIndirect;
274  static int myLastInternalParmIndex;
275 };
276 
277 #undef FLOAT_OBJ_PARM
278 #undef INT_OBJ_PARM
279 #undef STR_OBJ_PARM
280 
281 #endif
bool opIsPlayer() const override
Checks to see if the dop is in play mode.
Definition: OBJ_DopNet.h:221
OP_OpTypeId getChildTypeID() const override
GT_API const UT_StringHolder selection
bool cookedDataUsesAllParameters() const override
Definition: OBJ_DopNet.h:237
virtual DOP_Engine & getNonConstEngineSubclass()=0
exint CONTINUOUSCOOK_TICK() const
Definition: OBJ_DopNet.h:205
exint opContinuousCookTick() const override
Current continuous cook tick.
Definition: OBJ_DopNet.h:129
int doDrawLit() const override
Definition: OBJ_DopNet.h:146
static const char * theChildTableName
Definition: OBJ_DopNet.h:109
fpreal TIMESTEP()
Definition: OBJ_DopNet.h:158
const GLdouble * v
Definition: glcorearb.h:837
bool EXPLICITCACHE()
Definition: OBJ_DopNet.h:190
GLsizei const GLfloat * value
Definition: glcorearb.h:824
int CACHEENABLED()
Definition: OBJ_DopNet.h:176
int64 exint
Definition: SYS_Types.h:125
#define FLOAT_OBJ_PARM(name, idx, vi, t)
Definition: OBJ_DopNet.h:22
virtual void handleRefilterParms(const SIM_Time &t)
Definition: DOP_Parent.h:216
virtual OBJ_OBJECT_TYPE getObjectType() const =0
virtual DOP_Parent * castToDOPParent()
Definition: OP_Node.h:2827
int getDandROpsEqual() override
int CACHEMAXSIZE()
Definition: OBJ_DopNet.h:184
int INTERPOLATE()
Definition: OBJ_DopNet.h:170
#define STR_OBJ_PARM(name, idx, vi, t)
Definition: OBJ_DopNet.h:26
bool createSpareParametersForLoad(UT_StringArray &names, PRM_ParmNameMap &nmap, UT_String &errors) override
int isObjectLitBy(OBJ_Node *, fpreal) override
Definition: OBJ_DopNet.h:142
virtual void childFlagChange(OP_Node *)
double fpreal64
Definition: SYS_Types.h:201
bool getIsTimeless() const override
Definition: OBJ_DopNet.h:125
virtual void clearInterrupted()
Definition: OP_Node.h:2611
bool evalVariableValue(fpreal &val, int var_id, int thread) override
int EXPLICITCACHENSTEPS()
Definition: OBJ_DopNet.h:194
int AUTORESIM()
Definition: OBJ_DopNet.h:172
int TIMELESS() const
Definition: OBJ_DopNet.h:201
int CACHETODISKNONINTERACTIVE()
Definition: OBJ_DopNet.h:180
virtual const DOP_Engine & getEngineSubclass() const =0
void EXPLICITCACHENAME(UT_String &str)
Definition: OBJ_DopNet.h:192
virtual void handleResimParms(const SIM_Time &t)
Definition: DOP_Parent.h:217
void PLAYFILESNAME(UT_String &str) const
Definition: OBJ_DopNet.h:153
OBJ_DopNetIndex
Definition: OBJ_DopNet.h:34
virtual void getDescriptiveName(UT_String &str) const
int SUBSTEP()
Definition: OBJ_DopNet.h:160
int updateDandROpsEqual(int check_inputs=1) override
OP_OpTypeId
Definition: OP_OpTypeId.h:18
virtual OP_Node * getRenderNodePtr()
GLuint const GLchar * name
Definition: glcorearb.h:786
bool ISPLAYER() const
Definition: OBJ_DopNet.h:151
#define INT_OBJ_PARM(name, idx, vi, t)
Definition: OBJ_DopNet.h:24
GLdouble t
Definition: glad.h:2397
int * getIndirect() const override
Definition: OBJ_DopNet.h:229
fpreal STARTFRAME()
Definition: OBJ_DopNet.h:164
virtual void getDescriptiveParmName(UT_String &str) const
bool CONTINUOUSCOOK() const
Definition: OBJ_DopNet.h:203
bool opIsContinuousCook() const override
Returns if the operator is in Continous Cook mode.
Definition: OBJ_DopNet.h:127
**Note that the tasks the is the thread number *for the or if it s being executed by a non pool thread(this *can happen in cases where the whole pool is occupied and the calling *thread contributes to running the work load).**Thread pool.Have fun
A map of string to various well defined value types.
Definition: UT_Options.h:84
int CACHESUBSTEPS()
Definition: OBJ_DopNet.h:182
OBJ_DopNet * castToOBJDopNet() override
Definition: OBJ_DopNet.h:216
virtual int isObjectRenderable(fpreal t) const
int MAXFEEDBACK()
Definition: OBJ_DopNet.h:168
fpreal64 fpreal
Definition: SYS_Types.h:278
void COMPRESSSIMS(UT_String &str)
Definition: OBJ_DopNet.h:187
GLuint index
Definition: glcorearb.h:786
void DISPLAYFILTER(UT_String &str)
Definition: OBJ_DopNet.h:148
bool createSpareParametersFromChannels(UT_BitArray &selection, const CH_ChannelList &channels) override
fpreal TIMEOFFSET()
Definition: OBJ_DopNet.h:162
bool updateParmsFlags() override
const char * getChildType() const override
bool isLightInLightMask(const OBJ_Node *, fpreal) override
Function to resolve lighting based on light masks.
Definition: OBJ_DopNet.h:143
virtual void getOwnedMicroNodes(DEP_MicroNodeList &micronodes)
exint evalInt(int pi, int vi, fpreal t) const
static PRM_Template * getObsolete()
bool evalVariableValue(fpreal &v, int i, int thr) override
Definition: OBJ_DopNet.h:96
#define OBJ_API
Definition: OBJ_API.h:10
virtual void setDOPTimeSubclass(const SIM_Time &t)
int CACHETODISK()
Definition: OBJ_DopNet.h:178
int DATAHINTS()
Definition: OBJ_DopNet.h:174
void INITIALSTATE(UT_String &str)
Definition: OBJ_DopNet.h:156
int EXPLICITCACHECHECKPOINTSPACING()
Definition: OBJ_DopNet.h:196
virtual void filterDataSubclass(const SIM_Time &t)=0
virtual void dumpMicroNodes(std::ostream &os, bool as_DOT, int indent_level) const
OBJ_OBJECT_TYPE
Definition: OBJ_Node.h:73
ImageBuf OIIO_API channels(const ImageBuf &src, int nchannels, cspan< int > channelorder, cspan< float > channelvalues={}, cspan< std::string > newchannelnames={}, bool shuffle_channel_names=false, int nthreads=0)
virtual void clearCache()
fpreal TIMESCALE()
Definition: OBJ_DopNet.h:166
virtual void addExtraSimDependencies(DEP_MicroNode *depnode)
Definition: DOP_Parent.h:170