HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
OBJ_Node.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 library (C++)
7  *
8  * COMMENTS: This defines a base object, here, children will inherit
9  * my attributes...
10  *
11  * My input (there's only one ever) is my "parent" in the
12  * object hierarchy, thus, I can have as many children as
13  * I want, but only one parent.
14  *
15  */
16 
17 #ifndef __OBJ_Node_h__
18 #define __OBJ_Node_h__
19 
20 #include "OBJ_API.h"
21 #include "OBJ_Error.h"
22 #include "OBJ_NodeFlags.h"
23 #include "OBJ_XformCache.h"
24 
25 #include <DEP/DEP_TimedMicroNode.h>
26 #include <GEO/GEO_PackedTypes.h>
27 #include <GU/GU_DetailHandle.h>
28 #include <OP/OP_DataMicroNode.h>
29 #include <OP/OP_Network.h>
30 #include <OP/OP_Node.h>
32 #include <OP/OP_Version.h>
34 #include <UT/UT_Map.h>
35 #include <UT/UT_Matrix4.h>
36 #include <UT/UT_Playback.h>
37 #include <UT/UT_SmallArray.h>
38 #include <UT/UT_ValArray.h>
39 
40 #include <stddef.h>
41 
42 class CMD_Manager;
43 class GU_Detail;
44 class OBJ_Ambient;
46 class OBJ_Blend;
47 class OBJ_Bone;
48 class OBJ_Camera;
49 class OBJ_DopNet;
50 class OBJ_Fetch;
51 class OBJ_Fog;
52 class OBJ_Geometry;
53 class OBJ_Handle;
54 class OBJ_Light;
55 class OBJ_Null;
56 class OBJ_NodeParentTransform;
57 class OBJ_Rivet;
58 class OBJ_StereoCamera;
59 class OBJ_Sticky;
60 class OBJ_SubNet;
61 class OBJ_UndoPreTransform;
62 class OP_Options;
64 class PI_PropertyMap;
65 class SHOP_ReData;
66 class SOP_Node;
67 class UT_IStream;
68 class UT_Options;
69 class UT_String;
70 class UT_StringRef;
71 
72 
74 {
75  OBJ_WORLD = 0x00001, // unused
76  OBJ_GEOMETRY = 0x00002, // has geometry and should render
77  OBJ_CAMERA = 0x00004, // has viewing parameters
78  OBJ_LIGHT = 0x00008, // has light specific parameters
79  OBJ_RENDERER = 0x00010, // obsolete
80  OBJ_FOG = 0x00020, // atmosphere
81  OBJ_BONE = 0x00040, // bone parameters
82  OBJ_HANDLE = 0x00080, // geometry handle
83  OBJ_BLEND = 0x00100, // blend object
84  OBJ_FORCE = 0x00200, // object describing a force
85  OBJ_CAMSWITCH= 0x00400, // switch between multiple cameras
86  OBJ_SOUND = 0x00800, // sound object
87  OBJ_MICROPHONE = 0x01000, // microphone object
88  OBJ_SUBNET = 0x02000, // subnet object
89  OBJ_FETCH = 0x04000, // fetch object
90  OBJ_NULL = 0x08000, // null object
91  OBJ_STICKY = 0x10000, // sticky object
92  OBJ_DOPNET = 0x20000, // DOP network object
93  OBJ_RIVET = 0x40000, // rivet object
94  OBJ_MUSCLE = 0x80000,
95 
96  // the above are the basic types used in the bitfield defining
97  // an objects characteristics. Below are some common combinations.
98  OBJ_STD_LIGHT = OBJ_CAMERA|OBJ_LIGHT, // ambient doesn't have CAMERA
113 };
114 
116 {
121 };
122 
124 {
126  OBJ_SHADER_MATERIAL, // Assign shader to material
127  OBJ_SHADER_SPARE, // Parameter on object
128  OBJ_SHADER_PROPERTY, // Parameter on property SHOP
129 };
130 
132 {
135 };
136 
138 {
139  T,
140  R,
141  S,
142  P,
143  All
144 };
145 
146 #define OBJ_MATERIAL_SPARE_TAG "material_spare"
147 
149 {
150  // Transform
164 
175 
176  // Render
179 
180  // Misc
186 
187 
188  I_N_BASE_INDICES // should always be last in the list
189 };
190 
192  OBJ_VAR_IPT, // Instance point
194 };
195 
196 // We must maintain this order! If you change/add to OBJ_KeepPosType, then
197 // you must also fix it in OBJ_Command.C
199 {
203 
204  OBJ_KEEPPOS_NUM_FLAGS // should always be last in the list
205 };
206 
207 typedef enum {
212 
213 
214 #define OBJ_SELECTABLE_FLAG 'S'
215 
216 #define FLOAT_OBJ_PARM(name, idx, vi, t) \
217  return evalFloat(name, &getIndirect()[idx], vi, t);
218 #define FLOAT_OBJ_PARMS(name, idx, v, t) \
219  evalFloats(name, &getIndirect()[idx], v, t);
220 #define INT_OBJ_PARM(name, idx, vi, t) \
221  return evalInt(name, &getIndirect()[idx], vi, t);
222 #define STR_OBJ_PARM(name, idx, vi, t) \
223  evalString(str, name, &getIndirect()[idx], vi, t);
224 
225 #define SET_FLOAT(name, parm_index, vector_index, t, val, add_key) \
226  setChRefFloat(name, getIndirect()[parm_index], vector_index, t, val, add_key);
227 #define SET_INT(name, parm_index, vector_index, t, val) \
228  setChRefInt(name,getIndirect()[parm_index], vector_index, t, val);
229 #define SET_STRING(val, meaning, parm_index, vector_index, t) \
230  setChRefString(val, meaning, name, getIndirect()[parm_index], vector_index, t);
231 
233 {
234 public:
235  const char *getChildType() const override;
236  const char *getOpType() const override;
237 
238  OP_OpTypeId getChildTypeID() const override;
239  OP_OpTypeId getOpTypeID() const override;
240  static const char *theChildTableName;
241 
242  // We must never use the result of this method to do a c-style cast.
243  // If you need to cast, then use the casting methods provided.
244  virtual OBJ_OBJECT_TYPE getObjectType() const = 0;
245 
247  int var_id,
248  int thread) override;
249 
251  int index,
252  int thread) override
253  {
255  val, index, thread);
256  }
257 
258  // Global list of all known obsolete lists...
259  static PRM_Template *getObsolete();
260  static PRM_Template *mergeObsoleteLists(PRM_Template *t1,
261  PRM_Template *t2);
262  static CH_LocalVariable ourLocalVariables[];
263 
264  // This finds all the known types and resolves them. It doesn't mind
265  // if they don't exist.
267  PRM_ParmList *obsolete_parms) override;
268 
269  // Resolves a specific parm...
270  void applyBackwardsPathCompatibility(
271  PRM_ParmList *obsolete_parms,
272  const char *oldname,
273  const char *newname,
274  const char *root = "/obj/",
275  const char *tail = "");
276  void applyBackwardsNetNodeCompatibility(
277  PRM_ParmList *obsolete_parms,
278  const char *oldnetname,
279  const char *oldnodename,
280  const char *newname,
281  const char *rootname,
282  const char *property_parm=0);
283  // This is a SHOP specific style one. As SHOP_PATHs allowed any arbitrary
284  // path internally, merely requiring they are relative to /shop, we
285  // cannot just blindly prefix /shop/. Specifically, if the old path
286  // was /shop/bar, we don't want /shop//shop/bar.
287  void applyBackwardsShopCompatibility(
288  PRM_ParmList *obsolete_parms,
289  const char *oldname,
290  const char *newname);
291 
292  // These are convenience functions. Do NOT override in subclasses!
293  // Override the appropriate apply.*Transform() function instead!
294  // NOTE: there are exceptions to the comment above. Notably, the
295  // OBJ_Bone class has no notion of scaling along one axis only.
296  // It also treats rotations specially, and therefore it overrides
297  // the parameter transformation methods below.
298 
299  /// Get the transform built from the trs parms of this object
300  /// @param context The cook context, which contains the time.
301  /// @param xform The output parameter, that contains the matrix described
302  /// by the transformation parameters (rotation, tranlation,
303  /// and scale).
304  virtual bool getParmTransform(OP_Context &context, UT_DMatrix4 &xform );
305  virtual bool getParmTransformRotates(OP_Context &context,
306  UT_DMatrix4 &xform );
307  virtual bool getParmTransformTranslates(OP_Context &context,
308  UT_DMatrix4 &xform );
309  virtual bool getParmTransformScales(OP_Context &context,
310  UT_DMatrix4 &xform );
311 
313  { return myUseFullTransformModel; }
314 
315  /// Is given name an extended parm that requires extra checking for
316  /// transform/limit properties.
317  static bool isExtTransformParm(const UT_StringRef &name);
318 
319  // Delete all channels on the transform parms.
320  void destroyTransformParmChannels();
321 
322  // set the trs parms of the object to match the given world
323  // transform. rigid parm transform omits scales. Returns
324  // false if fail_if_any_locked_parms is true and any of the
325  // parms are locked. Whether or not we change locked
326  // parms, when not automatically failing, is specified by
327  // skip_locked_parms.
328  bool setParmTransformFromWorld(
329  OP_Context &context, const UT_DMatrix4 &world_xform,
330  bool create_keys = false,
331  bool fail_if_any_locked_parms = false,
332  bool change_locked_parms = false);
333  void setRigidParmTransformFromWorld(
334  OP_Context &context, const UT_DMatrix4 &world_xform,
335  bool create_keys = false );
336  // set the trs parms of the object to match the given parm
337  // transform. rigid parm transform omits scales. Returns
338  // false if fail_if_any_locked_parms is true and any of the
339  // parms are locked. Whether or not we change locked
340  // parms, when not automatically failing, is specified by
341  // skip_locked_parms.
342  bool setParmTransform( OP_Context &context, const UT_DMatrix4 &xform,
343  bool create_keys = false,
344  bool fail_if_any_locked_parms = false,
345  bool change_locked_parms = false,
346  const UT_Vector3R *rotate_vals = NULL
347  );
348 
349  void setRigidParmTransform( OP_Context &context,
350  const UT_DMatrix4 &xform,
351  bool create_keys = false );
352 
353  /// Get the pivot transform built from the pivot parms of this object
354  /// @param context The cook context, which contains the time.
355  /// @param xform The output parameter, that contains the matrix described
356  /// by the pivot transformation parameters (rotation and
357  /// and translation).
358  bool getParmPivotTransform(OP_Context &context, UT_DMatrix4 &xform);
359 
360  /// Set the pivot transform parms from the rotates and translates in the
361  /// given xform matrix.
362  bool setParmPivotTransform(OP_Context &context, const UT_DMatrix4 &xform,
363  bool create_keys = false,
364  bool fail_if_any_locked_parms = false,
365  bool change_locked_parms = false,
366  const UT_Vector3R *rotate_vals = NULL);
367 
368  /// Obtains an accumulation of input independedn and pre-transform matrices.
369  /// This is equivalent to:
370  /// applyPreTransform(applyInputIndependent(identity))
371  /// Which is is the portion of the local transform that does not
372  /// depend on the parameters (transform or look-at). It is not widely used
373  /// and only relevant for the handles to orient themselves in parent space.
374  ///
375  /// @param context The cook context, which contains the time.
376  /// @param mat The output parameter that will contain the calculated
377  /// matrix.
378  /// @return 0 if mat is the identity, non-zero otherwise.
379  int getPreLocalTransform(OP_Context &context, UT_DMatrix4 &mat);
380 
381  /// Obtains the effective local transform which does not depend on input
382  /// nodes. This transform includes input independent matrix, pre-transform
383  /// matrix, parameter transform matrix, and the look-at matrix. This method
384  /// first cooks the object (if necessary) and then returns the member
385  /// variable myXform.
386  ///
387  /// @param context The cook context, which contains the time.
388  /// @param mat The output parameter that will contain the calculated
389  /// matrix.
390  bool getLocalTransform(OP_Context &context, UT_DMatrix4 &mat);
391 
392  /// Calculates the inverse of the getLocalToWorldTransform()
393  bool getInverseLocalToWorldTransform(
394  OP_Context &context, UT_DMatrix4 &mat);
395 
396  /// Returns the effective world transform of the parent.
397  /// The input depenent transform ensures that any externally dependent
398  /// transformation have been taken into account (eg, the length of the
399  /// parent bone for OBJ_Bone). This transform is the base to which all the
400  /// local transforms are applied (pre-transform, parameter, etc).
401  ///
402  /// In terms of methods this is calculated by
403  /// applyInputDependentTransform(
404  /// getParentObject()->getChildToWorldTransform())
405  /// If @c getParentObject() is @c NULL, then it simply returns @c
406  /// applyInputDependentTransform(identity_matrix).
407  ///
408  /// Use this function to convert
409  /// coordinates that have @b not been transformed by the follow path or
410  /// pre-transform. Typically, this function is only used internally for
411  /// manipulating the pre-transform. If the object is in a subnet,
412  /// then this will include the subnet's world transform.
413  ///
414  /// @param context The cook context, which contains the time.
415  /// @param mat The output parameter that will contain the calculated
416  /// matrix.
417  bool getParentToWorldTransform(OP_Context &context, UT_DMatrix4 &mat);
418 
419  /// Returns a transform matrix that is only missing the
420  /// local and look-at components.
421  /// In terms of methods this is calculated by
422  /// applyPreTransform( applyInputIndependentTransform(
423  /// getParentToWorldTransform()))
424  /// Use this function to convert co-ordinates from object space to world
425  /// space. Object space includes everything @b except the object's local
426  /// transform parameters. Typically, this function is used by handles to
427  /// place themselves relative to the origin of the object.
428  ///
429  /// @param context The cook context, which contains the time.
430  /// @param mat The output parameter that will contain the calculated
431  /// matrix.
432  bool getObjectToWorldTransform(OP_Context &context, UT_DMatrix4 &mat);
433 
434  /// Calculates the inverse of the getObjectToWorldTransform().
435  bool getInverseObjectToWorldTransform(
436  OP_Context &context, UT_DMatrix4 &mat);
437 
438  /// Returns the full world transform of the object including
439  /// all the component sub-matrices (parent and local).
440  /// This is equivalent to
441  /// getLocalTransform() * getParentToWorldTransform()
442  /// Use this function to convert co-ordinates from the local (geometry)
443  /// space to world space. It cooks the object first and returns the member
444  /// variable @c myWorldTransform. Typically, this function is used to place
445  /// child SOPs of the object in world space.
446  ///
447  /// @param context The cook context, which contains the time.
448  /// @param mat The output parameter that will contain the calculated
449  /// matrix.
450  bool getLocalToWorldTransform(OP_Context &context, UT_DMatrix4 &mat);
451 
452  /// Returns the transforms provided by the object's parent.
453  /// This is equivalent to applyOutputTransform( getLocalToWorldTransform())
454  /// Typically, this function is only used internally for the implementation
455  /// of @c getParentToWorldTransform().
456  ///
457  /// Note that in general, the following inequality holds, unless @c
458  /// applyInputDependentTransform() has no effect:
459  /// @code
460  /// getParentToWorldTransform() !=
461  /// getParentObject()->getChildToWorldTransform()
462  /// @endcode
463  bool getChildToWorldTransform(OP_Context &context, UT_DMatrix4 &mat);
464 
465 
466  /// Obtains the world space matrix before the constraints were applied.
467  ///
468  /// @param context The cook context, which contains the time.
469  /// @param mat The output parameter that will contain the calculated
470  /// matrix.
471  SYS_DEPRECATED(16.5) // No longer needed or functional.
472  bool getPreConstraintsTransform(OP_Context &context, UT_DMatrix4 &mat);
473 
474  // single precision versions of the above functions
475  // (slightly less efficient since it has to do it in double precision and
476  // then assign it to single precision)
477  bool getParmTransform(OP_Context &context, UT_Matrix4 &xform );
478  bool getParmPivotTransform(OP_Context &context, UT_Matrix4 &xform );
479  int getPreLocalTransform(OP_Context &context, UT_Matrix4 &mat);
480  bool getLocalTransform(OP_Context &context, UT_Matrix4 &mat);
481  bool getParentToWorldTransform(OP_Context &context, UT_Matrix4 &mat);
482  bool getObjectToWorldTransform(OP_Context &context, UT_Matrix4 &mat);
483  bool getInverseObjectToWorldTransform(
484  OP_Context &context, UT_Matrix4 &mat);
485  bool getLocalToWorldTransform(OP_Context &context, UT_Matrix4 &mat);
486  bool getInverseLocalToWorldTransform(
487  OP_Context &context, UT_Matrix4 &mat);
488  bool getChildToWorldTransform(OP_Context &context, UT_Matrix4 &mat);
489  SYS_DEPRECATED(16.5) // No longer needed or functional.
490  bool getPreConstraintsTransform(OP_Context &context, UT_Matrix4 &mat);
491 
492  // 2d methods.
493  bool getLocal2DToWorldTransform(OP_Context &context, UT_DMatrix4 &mat);
494  virtual bool get2DWorldTransform(UT_DMatrix4 &mat, OP_Context &context);
495 
496  // functions to override those in OP_Node.h
497  bool getWorldTransform(UT_Matrix4D &mat,
498  OP_Context &context) override;
499  bool getIWorldTransform(UT_Matrix4D &mat,
500  OP_Context &context) override;
501  bool getTransform(TransformMode mode, UT_Matrix4D &mat,
502  OP_Context &context) override;
503  int getRelativeTransform(OP_Node &to,
504  UT_Matrix4 &xform,
505  OP_Context &context) override;
506  int getRelativeTransform(OP_Node &to,
507  UT_DMatrix4 &xform,
508  OP_Context &context) override;
509  bool getCameraInfo(const UT_StringRef &camid,
510  const OP_Context &context,
511  DEP_MicroNode *depnode,
512  UT_StringHolder &foundcamid,
513  UT_CameraParms &camparms) override;
514 
515  // This is used by specialized channel functions like qlinear()
516  // to determine what the transform order should be:
517  void getXformOrder(UT_XformOrder &xord,
518  const CH_Channel *chp) const override;
519 
520  // the following two methods are to be used along with
521  // keepWorldTransformByOldInput()
522  int keepPosWhenParenting();
523  bool getPreTransformInput(OP_Context &context,
524  UT_DMatrix4 &mat);
525  int keepPosWhenMoving();
526 
527  /// This method considers the effect of the LOOKAT fields and produces
528  /// a matrix that should be premultiplied to the orienation to get the
529  /// lookat. It takes the local->world transform (myWorldXform) as this
530  /// is used to figure out where this is outside cookpaths.
531  /// If 'interest' is supplied, then interest will be onto this other node
532  /// instead.
533  /// NOTE: this function is virtual, because OBJ_Bone has a "capture"
534  /// mode in which the lookAt parameter (or input node's transform
535  /// for that matter) is ignored. Bones
536  /// override this method to provide the mode-dependent transorm.
537  /// @param context The cook context, which contains the time.
538  /// @param world The world matrix based on which the lookat matrix is
539  /// calculated.
540  /// @param lookat The output parameter that will contain a calucated
541  /// look-at matrix. That look-at matrix will be
542  /// pre-multiplied with the local and the world transforms
543  /// to calculate their final form.
544  /// @param interest Usually, this node will register an interest in the
545  /// look-at object, so it gets dirtied when the look-at
546  /// object moves. The interest parameter specifies a node
547  /// that should be dirtied instead of the object on which
548  /// buildLookAt() got invoked.
549  ///
550  /// @return This returns 0 if no lookat is needed, in which case the matrix
551  /// provided will not be altered!
552  virtual int buildLookAt(OP_Context &context,
553  const UT_DMatrix4 &world,
554  UT_DMatrix4 &lookat,
555  OP_Node *interest = 0);
556  /// A stand alone version of buildLookAt that is not connected to the ui
557  /// and always takes an upvector.
558  int buildLookAt(OP_Context &context,
559  const UT_DMatrix4 &worldxform,
560  const UT_String &lookat,
561  UT_DMatrix4 &lookatxform,
562  UT_Vector3R &up);
563  // Returns whether or not the lookat object is time dependent.
564  bool getLookatObjectIsTimeDependent(const UT_String &lookat,
565  fpreal t);
566  // Returns the local to world transform of the lookat object.
567  // Optionally adds an extra input. Returns true if a valid lookat
568  // object was found. Sets xform to identity if no lookat or an
569  // invalid lookat was found.
570  bool getLookatObjectTransform(const UT_String &lookat,
571  OP_Context &context,
572  OP_Node *addextrainputto,
573  UT_DMatrix4 &xform,
574  bool &timedep);
575  // getPreLookatTransform gives us the pretransform matrix for an object
576  // that can later be used to create a lookat matrix with buildinglookat.
577  // getPreLooaktTransform can calculate the whole prelook at matrix,
578  // which is the default setting or calculate the matrix without the
579  // rotates included.
580  int getPreLookatTransform(OP_Context &context,
581  UT_DMatrix4 &wolrdXform,
582  UT_DMatrix4 &xform,
583  bool norotates = false);
584  // maintain the original world position as if we were using the old
585  // parent world xform by modifying the pretransform
586  int keepWorldTransformByOldInput(OP_Context &context,
587  const UT_DMatrix4 &old_parent_world_xform);
588 
589  // maintain the last cooked world transform by modifying pretransform/parms
590  void keepLastWorldTransform(OP_Context &context);
591 
592  // Returns whether or not the lookat object is time dependent.
593  bool getPathObjectIsTimeDependent(const UT_String &path,
594  fpreal t);
595  // Returns the local to world transform of the lookat object.
596  // Optionally adds an extra input. Returns true if a valid lookat
597  // object was found. Sets xform to identity if no lookat or an
598  // invalid lookat was found.
599  bool getPathObjectDetailHandle(const UT_String &path,
600  OP_Context &context,
602  UT_DMatrix4 &xform);
603 
604  // Callback for building custom world transforms from objects.
605  // The callback is responsible for setting the given matrix by
606  // the parm transform of the object.
607  // An example of using this would simply do
608  // node->getParmTransform(context,mat)
609  // Return 0 to stop processing, 1 to continue.
610  typedef int (*ApplyParmTransformCallback)(
611  void *data, OBJ_Node *node,
612  OP_Context &context, UT_DMatrix4 &mat);
613 
614  // Use these functions to build your own custom world transforms instead
615  // of traversing the object hieararchy yourself! If you do it yourself,
616  // then you will probably not take into account the output and
617  // pre-transforms.
618  // DO NOT CALL THESE WITHIN AN OBJECT COOK PATH!!
619  void buildCustomChildToWorldTransform(
620  OP_Context &context, UT_DMatrix4 &mat,
621  ApplyParmTransformCallback callback, void *data);
622  void buildCustomObjectToWorldTransform(
623  OP_Context &context, UT_DMatrix4 &mat,
624  ApplyParmTransformCallback callback, void *data);
625 
626  /// Set the given world position by only modifying the pre-transform.
627  /// This is less efficient than keepWorldTransformByOldInput() but more
628  /// general. If your local t,r,s parms have not been modified, then use
629  /// keepWorldTransformByOldInput instead.
630  ///
631  /// @param context The cook context, which contains the time.
632  /// @param world_xform The world transform to set for this object.
633  /// @param allow_extract If true, extract to local xform where possible
634  virtual int keepWorldTransform(
635  OP_Context &context,
636  const UT_DMatrix4 &world_xform,
637  bool allow_extract = false );
638 
639  // this is overridden so that we can clear our own undo flags
640  void clearUndoFlags() override;
641 
642  /// Stores the current pre-transform for future undo.
643  void savePreTransformForUndo();
644 
645  /// This sets the pre-transform to the identity matrix. This will modify
646  /// the object's world transform unless the pre-transform was already the
647  /// identity.
648  void resetPreTransform();
649 
650  /// This transfers the object's transform parameters (@c L) to the
651  /// pre-transform. This does not modify the effective world transform.
652  virtual void transferLocalToPreTransform(fpreal gtime);
653 
654  /// This extracts the object's pre-transform into its transform parameters.
655  /// If the extraction involved shears, then only the non-sheared portion
656  /// is extracted. This does not modify the effective world transform.
657  virtual void transferPreToLocalTransform(
658  fpreal gtime, bool follow_chan_refs = false);
659 
660  /// Transfers only the rotate portion of the matrix to pre-transform.
661  virtual void transferLocalToPreTransformRotates(fpreal gtime);
662 
663  /// Transfers only the translates portion of the matrix to pre-transform.
664  virtual void transferLocalToPreTransformTranslates(fpreal gtime);
665 
666  /// Transfers only the scales portion of the matrix to pre-transform.
667  virtual void transferLocalToPreTransformScales(fpreal gtime);
668 
669  /// This sets the pretransform to the given matrix. This will modify the
670  /// object's effective world transform unless the given pre-transform is
671  /// identity.
672  void setPreTransform(const UT_DMatrix4 &xform);
673 
674  // get the rotation euler angles that include the pre-transform
675  void getAdjustedRotates(OP_Context &context, UT_Vector3R &r);
676 
677  // Takes the given rotation in degrees and adjusts it to include the
678  // pretransform
679  void adjustRotatesToIncludePreTransform(
680  OP_Context &context, UT_Vector3R &r);
681 
682  // adjust the given rotations (in degrees) suitable for stuffing into a
683  // rotation parm taking into account the pre-transform
684  void adjustRotatesForPreTransform(
685  OP_Context &context,
686  int return_as_radian, UT_Vector3R &rot);
687 
688  /// Returns current pretransform matrix.
689  const UT_DMatrix4 & getPreTransform() const
690  { return myPreTransform; }
692  { return myPreTransform; }
694  { return myPreTransformIsIdentity; }
696  { myPreTransformIsIdentity = yesno; }
697 
698  bool setPickable(bool onoff) override;
699  bool getPickable() override;
700  bool setCachable(bool onoff);
701  bool getCachable(int thread) const;
702  void setFlag(char flag, int8 val) override;
703 
704  bool getBoundingBox(UT_BoundingBox &box,
705  OP_Context &ctx) override;
706 
708  { return CAST_SOPNODE(getDisplayNodePtr()); }
710  { return CAST_SOPNODE(getRenderNodePtr()); }
712  { return CAST_DOPNODE(getDisplayNodePtr()); }
713 
714  // Return the SOP that the display geometry is taken from without actually
715  // cooking the SOP. Should be used instead of getDispalySopPtr(), as this
716  // takes instancing and Output SOPs into account.
717  SOP_Node *getDisplayOutputNode(OP_Context &context,
718  bool check_enable);
719 
720  GU_DetailHandle getDisplayGeometryHandle(OP_Context &context,
721  int check_enable=1,
722  OP_Node **source_node=0);
723  GU_DetailHandle getRenderGeometryHandle(OP_Context &context,
724  int check_enable=1);
725  const GU_Detail *getDisplayGeometry(OP_Context &context,
726  int check_enable=1,
727  OP_Node **source_node=0);
728  const GU_Detail *getRenderGeometry(OP_Context &context,
729  int check_enable=1);
730 
732  {
735  DEFORM
736  };
737  virtual obj_OnionSkin getOnionSkin() { return OFF; }
738  static void buildOperatorTable(OP_OperatorTable &table);
739  static void getManagementOperators(OP_OperatorList &op);
740  static void installCommands(CMD_Manager *cman);
741  static void initializeExpressions();
742  static void buildMaterialOptMenu(void *obj,
743  PRM_Name *names,
744  int size,
745  const PRM_SpareData *spare,
746  const PRM_Parm *parm);
747  static int handleMaterialOpt(void *obj,
748  int index,
749  fpreal now,
750  const PRM_Template *tplate);
751  bool processMaterialOpt(fpreal now, const char *operation,
752  int argc, const char *argv[],
753  UT_String &errors);
754 
755 
756  // These convience functions allow you to deal with COP2 paths
757  // and prepare them in a fashion the TIL resolver will liek.
758  int getFullCOP2Path(const char *relpath,
759  UT_String &fullpath, int &flagdependent);
760  void splitCOP2Path(const char *path,
761  UT_String &net, UT_String &nodepath);
762 
763 
764  // Menu callback functions available to general public
765 
766  static void buildObjectMenu(PRM_Name *, int max,
768  static void buildGeoObjMenu(
769  void *o, PRM_Name *, int,
770  const PRM_SpareData *, const PRM_Parm *);
771  static void buildPathObjMenu(
772  void *o, PRM_Name *, int,
773  const PRM_SpareData *, const PRM_Parm *);
774  static void buildKinChopMenu(
775  void *o, PRM_Name *, int,
776  const PRM_SpareData *, const PRM_Parm *);
777  static void buildPopGeoMenu(
778  void *o, PRM_Name *, int,
779  const PRM_SpareData *, const PRM_Parm *);
780  static void buildShadeObjMenu(
781  void *o, PRM_Name *, int,
782  const PRM_SpareData *, const PRM_Parm *);
783  static void buildColorPlaneMenu(
784  void *o, PRM_Name *, int,
785  const PRM_SpareData *, const PRM_Parm *);
786  static void buildAlphaPlaneMenu(
787  void *o, PRM_Name *, int,
788  const PRM_SpareData *, const PRM_Parm *);
789  static void buildGeoChopMenu(
790  void *o, PRM_Name *, int,
791  const PRM_SpareData *, const PRM_Parm *);
792  static void buildSoundChopMenu(
793  void *o, PRM_Name *, int,
794  const PRM_SpareData *, const PRM_Parm *);
795  static void buildMicChopMenu(
796  void *o, PRM_Name *, int,
797  const PRM_SpareData *, const PRM_Parm *);
798  static void buildChopNetMenu(
799  void *o, PRM_Name *, int,
800  const PRM_SpareData *, const PRM_Parm *);
801  static void buildBoneCaptureMenu(
802  void *o, PRM_Name *, int,
803  const PRM_SpareData *, const PRM_Parm *);
804  static void buildBoneChildMenu(
805  void *o, PRM_Name *, int,
806  const PRM_SpareData *, const PRM_Parm *);
807  static void buildChildObjMenu(
808  void *o, PRM_Name *, int,
809  const PRM_SpareData *, const PRM_Parm *);
810  static void buildPointGroupMenu(
811  void *o, PRM_Name *, int,
812  const PRM_SpareData *, const PRM_Parm *);
813  static void buildPrimitiveGroupMenu(
814  void *o, PRM_Name *, int,
815  const PRM_SpareData *, const PRM_Parm *);
816 
817  static int handlePreTransformMenu(void *o, int index, fpreal t,
818  const PRM_Template *);
819 
820  bool getDisplayOrigin() const override;
821  bool setDisplayOrigin(bool on_off_unchanged) override;
822 
824  { return myObjFlags.getParentingErrorFlag(); }
826  { myObjFlags.setParentingErrorFlag(o); }
827 
828  int isCookingRender() const override
829  { return myCookingRender ? 1:0; }
830 
831  void setCookingRender(int val) override
832  { myCookingRender = (val!=0); }
833 
834  OBJ_NodeFlags &objflags() { return myObjFlags; }
835 
837  OP_InputIdx idx, OP_Node *op,
838  OP_OutputIdx outputIdx = 0) override;
839 
841  OP_InputIdx idx, const char *label,
842  int keeppos,
843  OP_OutputIdx outputIdx = 0) override;
844 
846  OP_InputIdx idx,
847  OP_IndirectInput *in) override;
848 
849  OP_ERROR setNamedInput(const OP_ConnectorId& input_name,
850  OP_Node *op,
851  const OP_ConnectorId* output_name = NULL
852  ) override;
853 
855  const OP_ConnectorId& input_name,
856  const char *label,
857  int,
858  const OP_ConnectorId* output_name = NULL) override;
859 
861  const OP_ConnectorId& input_name,
862  OP_IndirectInput *input) override;
863 
864  /// Override this to specify the inputs which are needed for cooking this
865  /// node which can be executed in parallel.
866  void getParallelInputs(
867  OP_Context &context,
868  OP_NodeList &nodes) const override;
869 
871  { ourKeepPosWhenParenting = flag; }
873  { return ourKeepPosWhenParenting; }
874 
876  { ourKeepPosWhenMoving = flag; }
878  { return ourKeepPosWhenMoving; }
879 
880  static void disallowGlobalKeepPos();
881  static void allowGlobalKeepPos();
882 
883  static void disallowIgnorePretransform();
884  static void allowIgnorePretransform();
885 
886  static void setIgnorePretransformValue(bool flag)
887  { ourIgnorePretransformValue = flag; }
888  static bool getIgnorePretransform()
889  { return ourAllowIgnorePretransform
890  && ourIgnorePretransformValue; }
892  { return ourIgnorePretransformValue; }
893 
894  void opChanged(OP_EventType reason,
895  void *data=0) override;
896  void referencedParmChanged(int parm_index) override;
897 
898  // takes into account TRS order and pivot point
899  UT_Vector3R getLocalPivot(OP_Context &context);
900  UT_Vector3R getWorldPivot(OP_Context &context);
901 
902  void setParmFromHandle(
903  OP_Context &context,
904  PRM_Parm &parm,
905  int vec_idx,
906  fpreal val,
907  bool create_keys,
908  bool check_modified);
909  void setParmFromHandle(
910  OP_Context &context,
911  PRM_Parm &parm,
912  const UT_Vector3R &val,
913  bool create_keys = false,
914  int key_idx = -1,
915  bool check_modified = true);
916 
917  virtual void setScaleFromHandle(fpreal t, const UT_Vector3R &s,
918  bool create_keys = false,
919  int key_idx = -1,
920  bool check_modified = true);
921  virtual void setUniformScaleFromHandle(
922  fpreal t, fpreal uniform_scale,
923  bool create_keys = false,
924  bool check_modified = true);
925  virtual void setRotateFromHandle(fpreal t, const UT_Vector3R &r,
926  bool create_keys = false,
927  int key_idx = -1,
928  bool check_modified = true);
929  virtual void setTranslateFromHandle(fpreal t,
930  const UT_Vector3R &trans,
931  bool create_keys = false,
932  int key_idx = -1,
933  bool check_modified = true);
934  virtual void setPivotFromHandle(fpreal t,
935  const UT_Vector3R &pivot,
936  bool create_keys = false,
937  int key_idx = -1,
938  bool check_modified = true);
939  virtual void setPivotRotateFromHandle(fpreal t,
940  const UT_Vector3R &pivot_rotate,
941  bool create_keys = false,
942  int key_idx = -1,
943  bool check_modified = true);
944  void setXformOrderFromHandle(fpreal t, int value,
945  bool create_keys = false,
946  bool check_modified = true);
947 
948  virtual const char * getSetScaleParmName() const { return "s"; }
949  virtual const char * getSetRotateParmName() const { return "r"; }
950  virtual const char * getSetTranslateParmName() const { return "t"; }
951 
952  // Determines whether an object should be sent to renderers or not.
953  virtual int isObjectRenderable(fpreal t) const;
954 
955  // Function returns whether the object is lit by a particular light
956  virtual int isObjectLitBy(OBJ_Node *, fpreal) { return 0; }
957  /// Function to resolve lighting based on light masks
958  virtual bool isLightInLightMask(const OBJ_Node *light, fpreal now)
959  { return false; }
960 
961  // Function returns whether the object is lit by a particular subnet
962  virtual int isObjectLitBySubnet(OBJ_Node *, fpreal) { return 0; }
963 
964  // Function to return the subset of the specified lights which actually
965  // light this object. The default implementation uses the virtual
966  // isObjectLitBy method to determine this subset.
967  virtual void getActingLightSubset(
968  const UT_ValArray<OBJ_Ambient *> &lights,
970 
971  /// Return an interface to apply appearance operations. The default
972  /// behaviour is to return a NULL pointer.
973  virtual SOP_ObjectAppearancePtr getObjectAppearance();
974 
975  // Let each object type decide whether or not it should be drawn lit
976  virtual int doDrawLit() const { return 0; }
977 
978  static const char * displaySopToken;
979  static const char * renderSopToken;
980  static const char * boundingBoxToken;
981  static const char * boundingSphereToken;
982  static const char * input1ObjectToken;
983  static const char * input2ObjectToken;
984  static const char * input3ObjectToken;
985  static const char * input4ObjectToken;
986 
988  OP_Context &context,
989  OP_NodeInfoParms &iparms) override;
991  UT_InfoTree &tree,
992  const OP_NodeInfoTreeParms &parms) override;
993 
994  void propagateEndBlockModify() override;
995 
996  //Absolute Width
997  fpreal getW() const override;
998  //Absolute Height
999  fpreal getH() const override;
1000 
1001 
1002  virtual OBJ_Ambient *castToOBJAmbient() { return NULL; }
1003  virtual OBJ_Blend *castToOBJBlend() { return NULL; }
1004  virtual OBJ_Bone *castToOBJBone() { return NULL; }
1005  virtual OBJ_Camera *castToOBJCamera() { return NULL; }
1006  virtual OBJ_DopNet *castToOBJDopNet() { return NULL; }
1007  virtual OBJ_Fetch *castToOBJFetch() { return NULL; }
1008  virtual OBJ_Fog *castToOBJFog() { return NULL; }
1009  virtual OBJ_Geometry*castToOBJGeometry() { return NULL; }
1010  virtual OBJ_Handle *castToOBJHandle() { return NULL; }
1011  virtual OBJ_Light *castToOBJLight() { return NULL; }
1012  virtual OBJ_Null *castToOBJNull() { return NULL; }
1013  virtual OBJ_Rivet *castToOBJRivet() { return NULL; }
1014  virtual OBJ_Sticky *castToOBJSticky() { return NULL; }
1015  virtual OBJ_SubNet *castToOBJSubNet() { return NULL; }
1016  virtual OBJ_StereoCamera* castToOBJStereoCamera() { return NULL; }
1017 
1018  // Build a shader string for the object. If the shader string is built
1019  // successfully, the SHOP which generated the string will be returned.
1020  bool assignShader(int shop_type, const char *path,
1021  OBJ_SHADER_LOCATION where);
1022  OP_Node *evalShaderString(UT_String &shader, int shop_type, fpreal now,
1023  const UT_Options *options, OP_Node *shader_node = 0);
1024  bool evalShaderHandle(UT_String &handle, int shop_type, fpreal now,
1025  const UT_Options *options, OP_Node *shader_node = 0);
1026  bool evalShaderLanguage(UT_String &lang, int shop_type, fpreal now,
1027  const UT_Options *options, OP_Node *shader_node = 0);
1028  OP_Node *evalShaderData(SHOP_ReData &data, int shop_type, fpreal now,
1029  const UT_Options *options, OP_Node *shader_node = 0);
1030  OP_Node *evalShaderBounds(UT_BoundingBox &box, int shop_type,fpreal now,
1031  const UT_Options *options, OP_Node *shader_node = 0);
1032  bool evalCoShaderStrings(UT_StringArray &strings,
1033  OP_NodeList &shops, int shop_type, fpreal now,
1034  const UT_Options *options, OP_Node *shader_node = 0);
1035  bool evalCoShaderHandles(UT_StringArray &handles,
1036  int shop_type, fpreal now,
1037  const UT_Options *options, OP_Node *shader_node = 0);
1038  bool evalCoShaderLanguages(UT_StringArray &languages,
1039  int shop_type, fpreal now,
1040  const UT_Options *options, OP_Node *shader_node = 0);
1041  void getShopTransform(UT_DMatrix4 &xform, int shop_type,
1042  fpreal now, const UT_Options *options);
1043 
1044  // Returns the token (name) of the material parameter.
1045  static const char *getMaterialParmToken();
1046 
1047  // Get a node specified as a material
1048  OP_Node *getMaterialNode( fpreal now );
1049 
1050  // Get a particular SHOP.
1051  OP_Node *getShaderNode(OP_Node *candidate, int shader_type,
1052  fpreal now, const UT_Options *options);
1053  OP_Node *getShaderNode(int shader_type, fpreal now,
1054  const UT_Options *options,
1055  DEP_MicroNode *dep = NULL);
1056 
1057  DEP_MicroNode *getMaterialParmMicroNode();
1058 
1059  // Load up the options with the local parameter defintions
1060  virtual const UT_Options *createShaderParms(OP_Options &options,
1061  fpreal now,
1062  const UT_Options *src);
1063 
1064  // Combine the SOPs of other objects into this one. On success, returns
1065  // the display_merge SOP pointer, else NULL.
1066  //
1067  // objs List of objects to combine. These will be deleted on
1068  // return.
1069  // full_combine If true, it performs a combine with the existing SOPs
1070  // inside this object.
1071  // moved_map Optional. On return, this filled with a map of the
1072  // child node pointers from source node pointer to
1073  // destination node pointer.
1074  OP_Node *combine(OP_Context &context,
1075  const UT_ValArray<OBJ_Node *> &objs,
1076  bool full_combine = true,
1077  UT_Map<OP_Node *, OP_Node *> *moved_map = NULL);
1078 
1079  virtual bool getHideDefaultParms() const
1080  { return false; }
1081 
1082  const char *getHDASubType() override;
1083 
1084  bool canCreateNewOpType() const override;
1085 
1086  const OP_DataMicroNode &
1087  parmListMicroNodeConst() const override
1088  { return myXformMicroNode; }
1090  { return parmListMicroNodeConst().modVersion(); }
1091 
1092  // myXformCookLevel is positive during the cook of myXform
1093  const OP_DataMicroNode &
1094  dataMicroNodeConst() const override
1095  {
1096  return (myXformCookLevel > 0)
1097  ? myXformMicroNode
1099  }
1100 
1101  // Set Parm Transform that can trigger notifications
1102  bool setParmTransform( OP_Context &context, const UT_DMatrix4 &xform,
1103  bool create_keys,
1104  bool fail_if_any_locked_parms,
1105  bool change_locked_parms,
1106  const UT_Vector3R *rotate_vals,
1107  bool check_modified
1108  );
1109  // Set Parm Pivot Transform that can trigger notifications
1110  bool setParmPivotTransform( OP_Context &context,
1111  const UT_DMatrix4 &xform,
1112  bool create_keys,
1113  bool fail_if_any_locked_parms,
1114  bool change_locked_parms,
1115  const UT_Vector3R *rotate_vals,
1116  bool check_modified
1117  );
1118 
1119  bool hasConstraints() const { return myHasConstraints; }
1120 
1121  bool getRawParmTransform(OP_Context &context, UT_DMatrix4 &xform );
1122  bool getRawParmTransform(OP_Context &context, UT_Matrix4 &xform );
1123 protected:
1124 
1125  OBJ_Node(OP_Network *parent, const char *name, OP_Operator *op);
1126  ~OBJ_Node() override;
1127 
1128  bool supportsDropShopType(int shop_type);
1130  const char *label) override;
1131 
1132  int testDragDrop(DD_Source &src) override;
1134  DD_ChoiceList &c) override;
1135 
1136 
1137  // This method should add any extra interests that an object might
1138  // have. By default, geo instance, particle instance, shader spaces
1139  // etc. are added. This is called when objects cook.
1140  virtual void addExtraDependencies(OP_Context &context);
1141  virtual int getOpShadingInfo(UT_String &str, fpreal t);
1142  virtual int getOpConstraintsInfo(UT_String &str, fpreal t);
1145  const CH_ChannelList &channels) override;
1147  PRM_ParmNameMap &nmap,
1148  UT_String &errors) override;
1150  const UT_StringRef &name, fpreal now,
1151  OP_Node *&op, PRM_Parm *&parm,
1152  bool create_missing_multiparms,
1153  PRM_ParmList *obsolete = 0) override;
1155  const UT_StringRef &name,
1156  fpreal now,
1157  OP_Node *&op, PRM_Parm *&parm, int &vectoridx,
1158  PRM_ParmList *obsolete = 0) override;
1160  OP_PropertyLookupList &list) override;
1161 
1162  /// Computes and pre-multiplies an input dependent matrix to the given
1163  /// current matrix. This transform is
1164  /// defined as semantically dependent on the object's inputs. The OBJ_Blend
1165  /// object overrides this to do special processing. Also, the OBJ_Bone
1166  /// object overrides this to move its origin to the tip of the parent bone.
1167  /// By default, this method does not modify the given matrix, which is
1168  /// equivalent to identity matrix.
1169  /// @param context The cook context, which contains the time.
1170  /// @param mat Input and output parameter, that gets premuliplied by
1171  // the computed input dependent transform matrix, if any.
1172  ///
1173  /// @return Returns 1 if the matrix was modified, 0 otherwise
1174  virtual int applyInputDependentTransform(
1175  OP_Context &context, UT_DMatrix4 &mat);
1176 
1177  /// Computes and pre-multiplies an input independent transform to
1178  /// the given matrix.
1179  /// This transform is defined as semantically independent of the
1180  /// object's inputs. The default implementation applies a follow path
1181  /// object transform, if available.
1182  ///
1183  /// @param context The cook context, which contains the time.
1184  /// @param mat Input and output parameter, that gets premuliplied by
1185  /// the computed input independent transform matrix, if any.
1186  ///
1187  /// @return Returns 1 if the matrix was modified, 0 otherwise
1188  virtual int applyInputIndependentTransform(
1189  OP_Context &context, UT_DMatrix4 &mat);
1190 
1191  /// Computes and pre-multiplies an output transform to the given matrix.
1192  /// The output transform is a transform that a parent specifies for its
1193  /// children. This concept exists for completeness (since there is an input
1194  /// transform), but is not widely used.
1195  /// The default implementation does not apply any transform.
1196  ///
1197  /// @param context The cook context, which contains the time.
1198  /// @param mat Input and output parameters, that gets premultipled
1199  /// by an appropriate output transform, if any.
1200  ///
1201  /// @return Returns 1 if the matrix was modified, 0 otherwise
1202  virtual int applyOutputTransform(OP_Context &context, UT_DMatrix4 &mat);
1203 
1204  /// Premuliplies the pre-transform matrix, myPreTransform, to the given
1205  /// matrix. Pre-matrix is a transformation layer between the input and the
1206  /// parameter transforms, and is used to define the origin point (and
1207  /// orientation) at which zero translation and zero rotation would place the
1208  /// object. This allows to have more meaningull parameter values during
1209  /// animation, where rotation of 0 degrees may need to correspond to a
1210  /// slightly bent limb (ie, rotated joint).
1211  ///
1212  /// @param context The cook context, which contains the time.
1213  /// @param mat The input and output parameter, that gets premultipled
1214  /// by a pre-transform matrix.
1215  ///
1216  /// @return Returns 1 if the matrix was modified, 0 otherwise
1217  virtual int applyPreTransform(OP_Context &context, UT_DMatrix4 &mat);
1218 
1219  bool getParentToWorldTransformForInputNoLock(
1220  OBJ_Node *input, OP_Context &context, UT_DMatrix4 &mat, bool applyInputDependentTransform=true);
1221 
1222  // Methods to obtatin and store transformations in a cache. Also
1223  // check if this object is or should be caching xform
1224  const UT_DMatrix4 & getCachedTransform( OP_Context &context,
1226  OBJ_XformCache::OBJ_LookupStatus &status ) const;
1227  void setCachedTransform( OP_Context &context,
1229  const UT_DMatrix4 &xform ) const;
1230  bool isCachingTransforms(int thread) const;
1231 
1232  bool updateParmsFlags() override;
1233 
1234  /// Used to perform proper dependency tracking when cooking the local
1235  /// transform (myXform) from cookMyObj().
1237  {
1238  public:
1239  LocalCookScope(OP_Context &context, OBJ_Node& obj, bool constraint=false);
1240  ~LocalCookScope();
1241  private:
1242  OP_Context& myContext;
1243  OBJ_Node& myObj;
1244  const bool myWasTimeDep;
1245  const bool myWasCooking;
1246  const bool myConstraint;
1247  };
1248  friend class LocalCookScope;
1249  friend class OBJ_NodeParentTransform;
1250 
1251  //
1252  // The cookMe "caches" information - i.e. the world and local xform matrix
1253  OP_ERROR cookMe(OP_Context &context) override;
1254  OP_ERROR bypassMe(OP_Context &context,
1255  int &copied_input) override;
1256  virtual OP_ERROR cookMyObj(OP_Context &context);
1257 
1258  OP_DataType getCookedDataType() const override;
1259  void deleteCookedData() override;
1260  int saveCookedData(const char *, OP_Context &) override;
1261  int saveCookedData(std::ostream &os,
1262  OP_Context &,
1263  int binary = 0) override;
1264 
1265  const char *getFileExtension(int binary) const override;
1266  OP_ERROR saveIntrinsic(std::ostream &os,
1267  const OP_SaveFlags &flags) override;
1268  void saveIntrinsicCommand(std::ostream &os,
1269  const char *name) override;
1270 
1271  bool loadPacket(UT_IStream &is, short class_id, short sig,
1272  const char *path=0) override;
1273  bool loadPacket(UT_IStream &is, const char *token,
1274  const char *path=0) override;
1275 
1276  void saveFlagsForUndo() override;
1277  void getSaveFlagsString(
1278  UT_String &cmd,
1279  const char *flags,
1280  bool save_to_hip) const override;
1281  void getPreParmSaveFlagsString(
1282  UT_String &cmd) const override;
1283  void getPostParmSaveFlagsString(
1284  UT_String &cmd) const override;
1285 
1286  // appends the description of the xform to the text. If the xform is not
1287  // an identity the label is printed first and the rst values follow.
1288  // If the xform is identity the text_if_identity is appended instead
1289  // of the whole label and xform printout
1290  void getXformDescription(const UT_DMatrix4 &xform,
1291  const char* label_if_not_identity,
1292  const char* text_if_identity,
1293  const UT_Vector3R pivot,
1294  const UT_Vector3R pivot_rotate,
1295  const UT_XformOrder order,
1296  UT_WorkBuffer &text);
1297 
1298  // types of transormations that we can clean (i.e.,
1299  // transfer from local to pre-transform)
1301  {
1305  OBJ_TRANSFORM_SCALES
1306  };
1307 
1308 
1309  /// Calculates a matrix that needs to be premultiplied with pretransform
1310  /// to transfer the transformation of type 'type' to the pretransform matrix
1311  void getParmTransformTransferMatrix(
1312  OP_Context &context,
1313  OBJ_TransformComponent type,
1314  UT_DMatrix4 &xform );
1315 
1316  // method for propagating the change in capture transform by xform.
1317  // This method is
1318  // overloaded for OBJs that support capture parameters (e.g., OBJ_Bone)
1319  // in order to adjust their global capture position. This is handy
1320  // when editing the caputre pose and when we need to propagate
1321  // a transofrm (e.g., translation) to all the descendants.
1322  virtual void applyToCaptTransformAndDescendents(
1323  OP_Context &context,
1324  const UT_DMatrix4 &xform );
1325 
1326  // method for building a menu containg point groups
1327  virtual void buildPointGroupMenu(
1328  PRM_Name *menu, int size,
1329  const PRM_SpareData *spare, const PRM_Parm *parm);
1330 
1331  // method for building a menu containg primitive groups
1332  virtual void buildPrimitiveGroupMenu(
1333  PRM_Name *menu, int size,
1334  const PRM_SpareData *spare, const PRM_Parm *parm);
1335 
1336 
1337 //_________________________________________________________________________
1338 //
1339 // Convenience Error methods...
1340 //_________________________________________________________________________
1341 //
1342  void addError(int code, const char *msg = 0)
1343  { UTaddError("OBJ", code, msg);}
1344  void addMessage(OBJ_Error code, const char *msg = 0)
1345  { UTaddMessage("OBJ", code, msg);}
1346  void addWarning(OBJ_Error code, const char *msg = 0)
1347  { UTaddWarning("OBJ", code, msg);}
1348  void addFatal(OBJ_Error code, const char *msg = 0)
1349  { UTaddFatal("OBJ", code, msg);}
1350 
1351 public:
1352 
1353  static PRM_SpareData *getMatchSelectButton(int option, int autoscope);
1354 // TODO: We have to make sure that the parent is cooked here!
1355  virtual OBJ_Node *getParentObject();
1357  { return setInput(0, node); }
1358 
1359  OBJ_Node *getInstanceObject(fpreal now) const;
1360  OBJ_Node *getGeometryInstance(fpreal now) const;
1361  OBJ_Node *getParticleObject(fpreal now) const;
1362 
1363  void setLookAtObject(OBJ_Node *node);
1364  void setLookUpObject(OBJ_Node *node);
1365  void setPathObject(OBJ_Node *node);
1366 
1367 protected:
1369  virtual int collectPropertiesFromChannels(
1370  PI_EditScriptedParms &editparms,
1372  const CH_ChannelList &channels);
1373  virtual int collectPropertiesFromParms(
1374  PI_EditScriptedParms &editparms,
1375  UT_StringArray &names,
1376  PRM_ParmNameMap &nmap);
1377  int collectProperties(PI_EditScriptedParms &editparms,
1379  const CH_ChannelList &channels,
1380  PI_PropertyMap *pmap);
1381  int collectProperties(PI_EditScriptedParms &editparms,
1382  UT_StringArray &names,
1383  PRM_ParmNameMap &nmap,
1384  PI_PropertyMap *pmap);
1385  void createPropertiesShop();
1386 
1387  // Method to find a SHOP node of a specific type. If the type is
1388  // SHOP_INVALID, any SHOP will be returned. Otherwise, the SHOP at the
1389  // given path must be of the correct type. NULL will be returned if the
1390  // type doesn't match or the path isn't found.
1391 
1392  // Used to get pointer to indirection indices for each object type
1393  virtual int *getIndirect() const = 0;
1394 
1396  int name_idx) const
1397  {
1398  int &parm_idx = getIndirect()[name_idx];
1399  if (parm_idx < 0)
1400  parm_idx = getParmList()->getParmIndex(name);
1401  return parm_idx;
1402  }
1404  int name_idx) const
1405  {
1406  int &parm_idx = getIndirect()[name_idx];
1407  if (parm_idx < 0)
1408  parm_idx = getParmList()->getParmIndex(name);
1409  return parm_idx;
1410  }
1411  PRM_Parm *getCachedParm(const UT_StringRef &name, int name_idx)
1412  {
1413  return getParmList()->getParmPtr(
1414  getCachedParmIndex(name, name_idx));
1415  }
1417  const UT_StringRef &name, int name_idx) const
1418  {
1419  return getParmList()->getParmPtr(
1420  getCachedParmIndex(name, name_idx));
1421  }
1422 
1423  virtual bool getTimeOverride() { return false; }
1424 
1425  // inverseDirty is no more needed because setWorldXform does it automatically.
1426  SYS_DEPRECATED_HDK_REPLACE(16.0, "setWorldXform")
1427  void inverseDirty() { myInverseDirty = true; }
1428 
1430  {
1431  if (myInverseDirty)
1432  {
1433  myInverseDirty = false;
1434  myWorldXform.invert(myIWorldXform);
1435  }
1436  return myIWorldXform;
1437  }
1438 
1439  // Compute the object contraints given a local and a parent transform.
1440  // The contraint network is evaluated and given the parent and local_xforms.
1441  // This updates myXform and myWorldXform.
1442  bool computeConstraints(OP_Context &context);
1443 
1444  // Returns the currently cooked local matrix. Doesn't perform cooking.
1446  { return myXform; }
1447 
1448  // Sets the cooked local matrix during cooking.
1450  { myXform = m; }
1451 
1452  // Returns the currently cooked world matrix. Doesn't perform cooking.
1454  { return myWorldXform; }
1455 
1456  // Sets the cooked world matrix during cooking.
1457  // Also sets the myInverseDirty flag properly.
1459  { myWorldXform = m; myInverseDirty=true; }
1460 
1461 public:
1463  { SET_FLOAT("t", I_T, 0, t, v, add_key) }
1465  { SET_FLOAT("t", I_T, 1, t, v, add_key) }
1467  { SET_FLOAT("t", I_T, 2, t, v, add_key) }
1469  { SET_FLOAT("r", I_R, 0, t, v, add_key) }
1471  { SET_FLOAT("r", I_R, 1, t, v, add_key) }
1473  { SET_FLOAT("r", I_R, 2, t, v, add_key) }
1475  { SET_FLOAT("s", I_S, 0, t, v, add_key) }
1477  { SET_FLOAT("s", I_S, 1, t, v, add_key) }
1479  { SET_FLOAT("s", I_S, 2, t, v, add_key) }
1481  { SET_FLOAT("p", I_P, 0, t, v, add_key) }
1483  { SET_FLOAT("p", I_P, 1, t, v, add_key) }
1485  { SET_FLOAT("p", I_P, 2, t, v, add_key) }
1488  { SET_FLOAT("pr", I_PIVOTR, 0, t, v, add_key) }
1491  { SET_FLOAT("pr", I_PIVOTR, 1, t, v, add_key) }
1494  { SET_FLOAT("pr", I_PIVOTR, 2, t, v, add_key) }
1497  { SET_FLOAT("scale", I_SCALE, 0, t, v, add_key) }
1498 
1499  void setTRANSORDER(int v) { SET_INT("xOrd", I_XORDER, 0, 0, v) }
1500  void setROTORDER(int v) { SET_INT("rOrd", I_RORDER, 0, 0, v) }
1501  void setKEEPPOS(int v) { SET_INT("keeppos", I_KEEPPOS, 0, 0, v) }
1502  void setCHILDCOMP(int v) { SET_INT("childcomp", I_CHILDCOMP, 0, 0, v) }
1503 
1504  int KEEPPOS(fpreal t) const { INT_OBJ_PARM("keeppos", I_KEEPPOS, 0, t) }
1505  int TRS(fpreal t) const { INT_OBJ_PARM("xOrd", I_XORDER, 0, t); }
1506  int XYZ(fpreal t) const { INT_OBJ_PARM("rOrd", I_RORDER, 0, t); }
1507  int CHILDCOMP(fpreal t) const { INT_OBJ_PARM("childcomp", I_CHILDCOMP, 0, t) }
1508 
1509  void T(fpreal *v, fpreal t) { FLOAT_OBJ_PARMS("t", I_T, v, t) }
1510  void R(fpreal *v, fpreal t) { FLOAT_OBJ_PARMS("r", I_R, v, t) }
1511  void S(fpreal *v, fpreal t) { FLOAT_OBJ_PARMS("s", I_S, v, t) }
1512  void P(fpreal *v, fpreal t) { FLOAT_OBJ_PARMS("p", I_P, v, t) }
1514  { FLOAT_OBJ_PARMS("pr", I_PIVOTR, v, t) }
1515 
1517 
1518  void LOOKUP(UT_String &str, fpreal t)
1519  { STR_OBJ_PARM ("lookup", I_LOOKUP, 0, t) }
1520  // types of allowed path parameterization
1521  // NB: these correspond to the menu entries in thePathParmTypes[]
1523  {
1524  OBJ_PATHPARM_UNIFORM = 0,
1525  OBJ_PATHPARM_ARCLEN
1526  };
1527 
1529  int PATHPARMTYPE(fpreal t) { INT_OBJ_PARM("uparmtype", I_PATHUPARMTYPE,0,t) }
1530  int PATHORIENT(fpreal t) { INT_OBJ_PARM("pathorient", I_PATHORIENT, 0, t) }
1533  { FLOAT_OBJ_PARMS("up", I_PATHUP, v, t) }
1535 
1536  int PICKING() {INT_OBJ_PARM("picking", I_PICKING, 0, 0) }
1538  {STR_OBJ_PARM("pickscript", I_PICKSCRIPT, 0, t)}
1539  int CACHING() {INT_OBJ_PARM("caching", I_CACHING, 0, 0) }
1540 
1541  // This parameter is only important in specific classes, so is not
1542  // defined here at the base level.
1543  virtual int VPORT_SHADEOPEN() { return 0; }
1544  virtual int VPORT_DISPLAYASSUBDIV() { return 0; }
1545 
1546  fpreal SHADERATE(fpreal t, fpreal defval=1);
1547  int PHANTOM(fpreal t, int default_value);
1548  int MATTE(fpreal t, int default_value);
1549  int RAYBOUNCE(fpreal t, int default_value);
1550  int TRANSMITBOUNCE(fpreal t, int default_value);
1551  fpreal RAYCLIP(fpreal t, fpreal def=0.001);
1552  fpreal DISPBOUND(fpreal t, fpreal def=0);
1553  fpreal SHADOWRATE(fpreal t, fpreal def=1);
1554  fpreal REFLRATE(fpreal t, fpreal def=1);
1555  fpreal LOD(fpreal t, fpreal def=1);
1556  void PREINCLUDE(UT_String &str, fpreal t);
1557  void POSTINCLUDE(UT_String &str, fpreal t);
1560 
1561 
1563  { return evalInt("use_dcolor", &getIndirect()[I_USE_DCOLOR],
1564  0, 0); }
1568 
1570  {
1571  UT_Color col(UT_RGB);
1572  fpreal32 c[3];
1573  evalFloats("dcolor", &getIndirect()[I_DCOLOR], c, t);
1574  col.setRGB(c[0], c[1], c[2]);
1575  return col;
1576  }
1577 
1579  { SET_FLOAT("dcolor", I_DCOLOR, 0, t, r, PRM_AK_MARK_PENDING) }
1581  { SET_FLOAT("dcolor", I_DCOLOR, 1, t, g, PRM_AK_MARK_PENDING) }
1583  { SET_FLOAT("dcolor", I_DCOLOR, 2, t, b, PRM_AK_MARK_PENDING) }
1584 
1585  int DISPLAY(fpreal t) const;
1586 
1587  int parmIndexDISPLAY() const
1588  { return getCachedParmIndex("display", I_DISPLAY); }
1589 
1590  // Determine whether the geometry is really displayed. If the display
1591  // channel is turned off, then we use the display flag. Use this as opposed
1592  // to isDisplayDisabled() unless you do *not* want to check this object's
1593  // display flag. A network can be specified to ignore the display state
1594  // of any parents starting with that network.
1595  bool getObjectDisplay(fpreal t, const OP_Network *n=0) const
1596  {
1597  return getDisplay() && !isDisplayDisabled(t, n);
1598  }
1599  GEO_ViewportLOD getObjectDisplayStyle(fpreal t,
1600  const OP_Network *net = NULL,
1601  bool ignore_display=false) const;
1602  bool isDisplayTimeDependent() const;
1603 
1604  // Determine whether the geometry is disabled for display. If the display
1605  // channel is turned off, then we use the display flag. A network can be
1606  // specified to ignore the display state of any parents starting with that
1607  // network.
1608  int isDisplayDisabled(fpreal t,
1609  const OP_Network *net = 0) const;
1610 
1611  // setVisible() differs from setDisplay() in that it will try to set the
1612  // display flag on parent subnets and change visible object parameters as
1613  // necessary.
1614  bool setVisible(bool onoff) override;
1615  bool getVisible() const override;
1616 
1617  void evaluateBatchParms(PRM_BatchList &list,
1618  fpreal now) override;
1619 
1620  // These parameters are cached
1621 
1622  int TDISPLAY() const;
1623  int parmIndexTDISPLAY() const
1624  {
1625  return getCachedParmIndex("tdisplay", I_TDISPLAY);
1626  }
1627 
1629  {
1630  return getCachedParmIndex("constraints_on", I_CONSTRAINTS_ON);
1631  }
1632 
1634  {
1635  return getCachedParmIndex("constraints_path", I_CONSTRAINTS);
1636  }
1637 
1638  int INSTANCE(UT_String &str, fpreal now) const;
1639  int POINTINSTANCE(fpreal now) const;
1640  int PARTICLE(UT_String &s, fpreal t) const;
1641  bool PTMOTIONBLUR(UT_String &str, fpreal now) const;
1642 
1643  int LOOKAT(UT_String &str, fpreal t) const
1644  {
1645  STR_OBJ_PARM ("lookatpath", I_LOOKAT, 0, t)
1646  return str.isstring();
1647  }
1648 
1649  int LOOKUPOBJ(UT_String &str, fpreal t) const
1650  {
1651  STR_OBJ_PARM ("lookupobjpath", I_LOOKUPOBJ, 0, t)
1652  return str.isstring();
1653  }
1654 
1655  int PATHSOP(UT_String &str, fpreal t) const
1656  {
1657  STR_OBJ_PARM ("pathobjpath", I_PATHOBJ, 0, t)
1658  return str.isstring();
1659  }
1660 
1661  // This is used by the viewer to determine whether or not to cook (and show)
1662  // particle guide geometry at the object level.
1664  { return getDefaultedIProperty("vport_promote_popguides", t,1); }
1665 
1666  // This is used by DM_VPortAgent3D to determine what order to
1667  // draw objects in. It itself will set it depending on user defined
1668  // order, so it really is a temporary one-per-object flag.
1669  int getDisplayOrder() const
1670  {
1671  return myDisplayOrder;
1672  }
1674  {
1675  myDisplayOrder = order;
1676  }
1677 
1678  // This is used by OBJ_SubNet. This is called on all child objects
1679  // when the Visible Children parameter changes.
1681  { myDisplayDisabledBySubnetNeedsUpdate = 1; }
1682 
1683  void addTransformParmInterests( OP_Node *interested );
1684 
1685  int getDefaultedIProperty(const char *name, fpreal now, int def) const
1686  {
1687  int val;
1688  if (evalParameterOrProperty(name, 0, now, val))
1689  return val;
1690  return def;
1691  }
1692  fpreal getDefaultedFProperty(const char *name, fpreal now, fpreal def) const
1693  {
1694  fpreal val;
1695  if (evalParameterOrProperty(name, 0, now, val))
1696  return val;
1697  return def;
1698  }
1699  const char *getDefaultedSProperty(const char *name, fpreal now,
1700  UT_String &result, const char *def) const
1701  {
1702  if (!evalParameterOrProperty(name, 0, now, result))
1703  result = def;
1704  return result;
1705  }
1706  const char *getDefaultedRawSProperty(const char *name, fpreal now,
1707  UT_String &result, const char *def) const
1708  {
1709  if (!evalParameterOrPropertyRaw(name, 0, now, result))
1710  result = def;
1711  return result;
1712  }
1713 
1714  int64 getMemoryUsage(bool inclusive) const override;
1715 
1716  OP_Node *getEvaluatedConstraints();
1717 
1718  // Evaluate the constraint path parameter and strip the optional channel name.
1719  OP_Node *parseConstraintPath( UT_String &path, UT_String &channel, int add_dep );
1720  OP_Node *parseConstraintPath( UT_String &path, UT_String &channel, int add_dep, bool &got_by_flag );
1721 
1722  const UT_Color &DCOLORREF(fpreal t, int &use_color)
1723  {
1724  if(myWireColorMicroNode.requiresUpdate(t))
1725  {
1726  mySetWireColor = USE_DCOLOR();
1727  if( mySetWireColor )
1728  {
1729  myWireColor.setType(UT_RGB);
1730 
1731  char *p = (char*)(void*)&myWireColor;
1732  p += sizeof(UT_ColorType);
1733 
1734  fpreal32* c = (fpreal32*)p;
1735  evalFloats("dcolor", &getIndirect()[I_DCOLOR],c,t);
1736  }
1737  auto i_usedcolor = getIndirect()[I_USE_DCOLOR];
1738  auto i_dcolor = getIndirect()[I_DCOLOR];
1739  if(i_usedcolor >= 0)
1740  myWireColorMicroNode.addExplicitInput(
1741  parmMicroNode(i_usedcolor, 0),false);
1742  if(i_dcolor >= 0)
1743  {
1744  myWireColorMicroNode.addExplicitInput(
1745  parmMicroNode(i_dcolor, 0),false);
1746  myWireColorMicroNode.addExplicitInput(
1747  parmMicroNode(i_dcolor, 1),false);
1748  myWireColorMicroNode.addExplicitInput(
1749  parmMicroNode(i_dcolor, 2),false);
1750  }
1751  myWireColorMicroNode.update(t);
1752  }
1753 
1754  use_color = mySetWireColor;
1755  return myWireColor;
1756  }
1757 
1758  void onCreated() override;
1759 
1760 protected:
1761  void checkTimeDependencies(int do_parms=1,
1762  int do_inputs=1,
1763  int do_extras=1) override;
1764 private: // methods
1765  friend class OBJ_UndoPreTransform;
1766 
1767  void evalBLUR(UT_String &result, fpreal now);
1768  void checkKeepPosWhenParenting( OBJ_Node *parent_obj );
1769 
1770  const PRM_Parm * findTransformProperty(
1771  fpreal t, const UT_StringRef &name) const;
1772  PRM_Parm * findTransformProperty(
1773  fpreal t, const UT_StringRef &name);
1774 
1775  template <typename OBJ_NODE, typename VISITOR>
1776  static void visitTransformParms(
1777  OBJ_NODE *node,
1778  fpreal t,
1779  bool exclude_uniform_scale,
1780  VISITOR& visitor);
1781 
1782  bool hasTransformParmChannels(
1783  fpreal t,
1784  bool exclude_uniform_scale) const;
1785 
1786  int evalToggleInt(char *togglename, int toggleindirect,
1787  char *parm, int parmindirect,
1788  fpreal t, int def = 0);
1789  fpreal evalToggleFloat(char *togglename, int toggleindirect,
1790  char *parm, int parmindirect,
1791  fpreal t, fpreal defval = 1);
1792  int evalToggleParm(const char *togglename,
1793  const char *token, fpreal now,
1794  int value);
1795  fpreal evalToggleParm(const char *togglename,
1796  const char *token, fpreal now,
1797  fpreal value);
1798 
1799  void computeSubnetParentTransform(
1800  OP_Context &context,
1801  const UT_ValArray<OBJ_Node *> &parentstack,
1802  UT_DMatrix4 &world_xform);
1803 
1804  void addTransformDependencies( OBJ_Node *subnet );
1805 
1806  void propagateKeepPosWhenMoving();
1807 
1808  void dirtyPreTransform();
1809  void updatePreTransformParms( bool from, bool undo=true);
1810  void updatePreTransformParms( bool from, bool undo, fpreal now, int thread);
1811  void getPreTransformParms( OP_Context &ctx, UT_Matrix4D &mat );
1812 
1813  void applyBackwardsRiTransmitCompatibility(
1814  PRM_ParmList *obsolete_parms);
1815 
1816  const char *inputLabel(OP_InputIdx) const override;
1817 
1818  void applyLimits( OP_Context &context, fpreal *t, fpreal *r, fpreal *s );
1819  template<int OFFSET>
1820  void applyLimit( OP_Context &context, fpreal *t );
1821 
1822  void onChangeSpareParms();
1823  void cookLocalXform(OP_Context &context, const UT_DMatrix4 &pmat);
1824 
1825  /// Declares that this node's data depends on the @c op for the given
1826  /// reason (OP_INTEREST_DATA, OP_INTEREST_FLAG).
1827  /// This OBJ override also supports OP_INTEREST_INPUT and redirects it to a call to addOpReference()
1828  /// @note There are no other acceptable values for type.
1829  void addExtraObjInput(OP_Node *op, OP_InterestType type);
1830 
1831  /// All OBJ nodes can be a selection owner.
1832  /// This replaces the previous inheritance from SOP_SelectionOwner.
1833  bool isSelectionOwnerType() const override final
1834  { return true; }
1835 
1836  template<int HAS_DEP>
1837  bool internalGetRawParmTransform(OP_Context &context, UT_DMatrix4 &xform, OBJ_AutoTransformDependencies *in_dep );
1838 
1839 private: // data
1840 
1841 
1842  // Pre H16, myWorldXform and myXform used to be protected.
1843  // When cooking a derived OBJ_Node, use setWorldXform and setLocalXform instead.
1844  UT_DMatrix4 myXform; // Transform in parent's space
1845  UT_DMatrix4 myWorldXform; // Transform in world space
1846  UT_DMatrix4 myIWorldXform; // Inverse Xform in world space
1847 
1848  // myPreTransform is right multiplied into the actual parms version of
1849  // the local object transform when we cook.
1850  // ie. myXform includes myPreTransform after being cooked
1851  UT_DMatrix4 myPreTransform;
1852 
1853  OP_Node *myEvaluatedConstraints;
1854 
1855  // Micro-node for determining when myXform is dirty
1856  class obj_XformMicroNode : public OP_DataMicroNode
1857  {
1858  public:
1859  obj_XformMicroNode(OP_Node &node)
1860  : OP_DataMicroNode(node)
1861  {
1862  }
1863  const char *className() const override
1864  {
1865  return "obj_XformMicroNode";
1866  }
1867  };
1868  obj_XformMicroNode myXformMicroNode;
1869  int myXformCookLevel;
1870 
1871  DEP_MicroNode myModeMicroNode;
1872  DEP_MicroNode myDisplayStyleMicroNode;
1873  DEP_MicroNode myInstanceMicroNode;
1874  UT_StringHolder myInstanceRef;
1875 
1876  int myShopMaterialIndex; // Cache of parm index
1877  uint myShopMaterialIndexLastCheck; // Add/remove count
1878 
1879  unsigned myPreTransformIsIdentity:1,
1880  myTraversingForBlur:1,
1881  mySubnetParentTimeDep:1,
1882  myShowingPreTransform:1,
1883  myUpdatingPreTransform:1,
1884  myInverseDirty:1,
1885  myUseFullTransformModel:1,
1886  myCookingRender:1,
1887  myLimitsFlags:18,
1888  myHasLookAt:1,
1889  myHasPath:1,
1890  myHasConstraints:1,
1891  myPointInstance:1,
1892  myGotConstraintsByFlag:1;
1893 
1894  mutable unsigned myDisplayDisabledBySubnetNeedsUpdate:1,
1895  myDisplayDisabledBySubnet:1,
1896  myInstanceRecursion:1;
1897 
1898  OBJ_NodeFlags myObjFlags;
1899 
1900  // This gets this nodes precedence in display order.
1901  int myDisplayOrder;
1902 
1903  // These variables are for computing the parent xform
1904  UT_ValArray<OP_VERSION> mySubnetParentVersion;
1905  UT_DMatrix4 mySubnetParentTransform;
1906 
1907  enum objLimits
1908  {
1909  MIN_TX = 1<<0,
1910  MIN_TY = 1<<1,
1911  MIN_TZ = 1<<2,
1912  MIN_RX = 1<<3,
1913  MIN_RY = 1<<4,
1914  MIN_RZ = 1<<5,
1915  MIN_SX = 1<<6,
1916  MIN_SY = 1<<7,
1917  MIN_SZ = 1<<8,
1918 
1919  MAX_TX = 1<<9,
1920  MAX_TY = 1<<10,
1921  MAX_TZ = 1<<11,
1922  MAX_RX = 1<<12,
1923  MAX_RY = 1<<13,
1924  MAX_RZ = 1<<14,
1925  MAX_SX = 1<<15,
1926  MAX_SY = 1<<16,
1927  MAX_SZ = 1<<17,
1928  };
1929 
1930  // Pair of Parm* and Long
1931  struct objSpareParam
1932  {
1933  objSpareParam();
1934  objSpareParam( OBJ_Node *obj, const char* name);
1935 
1936  void reset()
1937  {
1938  parm = NULL;
1939  id = -1;
1940  }
1941 
1942  PRM_Parm *parm;
1943  int id;
1944  };
1945  // Struct holding the object spare properties pointers
1946  // for faster access and to only add a pointer to OBJ_Node class.
1947  struct objSpareProperties
1948  {
1949  // returns true if all the Parm pointers are NULL.
1950  // this should be called before disposing of myProperties.
1951  // PLEASE UPDATE when adding new data members
1952  bool isEmpty() const;
1953  void reset();
1954 
1955  // Pre-Transform Category
1956  objSpareParam myPreXOrd;
1957  objSpareParam myPreROrd;
1958  objSpareParam myPreTranslate;
1959  objSpareParam myPreRotate;
1960  objSpareParam myPreScale;
1961 
1962  // Limits Category
1963  objSpareParam myLimitsOn[18];
1964  objSpareParam myLimits[18];
1965 
1966  objSpareParam myParentToBoneTip;
1967  };
1968  objSpareProperties *myProperties;
1969 
1970  UT_Color myWireColor;
1971  bool mySetWireColor;
1972  UT_String myConstraintsChannel;
1973  int myConstraintsChannelIndex;
1974 
1975  DEP_MicroNode myRawParmTransformMicroNode;
1976 
1977  mutable DEP_TimedMicroNode myDisplayMicroNode;
1978  mutable int myCachedDisplay;
1979  mutable DEP_MicroNode myTDisplayMicroNode;
1980  mutable int myCachedTDisplay;
1981 
1982  DEP_TimedMicroNode myWireColorMicroNode;
1983  DEP_TimedMicroNode myObjectStyleMicroNode;
1984  GEO_ViewportLOD myObjectDisplayStyle;
1985 
1986 private: // static data
1987 
1988  static OBJ_KeepPosType ourKeepPosWhenParenting;
1989  static OBJ_KeepPosType ourKeepPosWhenMoving;
1990  static bool ourAllowKeepPos;
1991  static bool ourIgnorePretransformValue;
1992  static bool ourAllowIgnorePretransform;
1993 };
1994 
1995 inline bool
1997 {
1998  return (evalIntT("caching", &getIndirect()[I_CACHING], 0, 0, thread) != 0);
1999 }
2000 
2001 inline bool
2003 {
2005 
2006  // the intercept mode is used by some CHOPs to map the current time
2007  // beyond the frame limits. In this case we cannot guarantee that
2008  // caching a matrix at frame, say, 2 and then after one play cycle
2009  // again at frame 2 (which is sort of frame 302) is refering to the
2010  // same xform (assuming 1..300 range). In these situatin we turn off
2011  // caching.
2012  // NB: the intercept mode is entered via SCROLL LOCK key
2013 
2014  return (mode != 1) && getCachable(thread);
2015 }
2016 
2017 #undef FLOAT_OBJ_PARM
2018 #undef FLOAT_OBJ_PARMS
2019 #undef INT_OBJ_PARM
2020 #undef STR_OBJ_PARM
2021 
2022 #undef SET_FLOAT
2023 #undef SET_INT
2024 #undef SET_STRING
2025 
2026 extern "C" {
2028 };
2029 
2031 {
2032 public:
2034 
2036  const OBJ_AutoTransformDependencies &ctx) = delete;
2038  const OBJ_AutoTransformDependencies &ctx) = delete;
2039 
2041  {
2042  resetUserData();
2043  }
2044 
2046  {
2047  if( myCallerUserData )
2048  {
2049  if( myExtraInputs.size() )
2050  myCaller->addExtraInputs( myExtraInputs );
2051 
2052  if( myExtraMicroNodes.size() )
2053  myCaller->addExtraInputs( myExtraMicroNodes );
2054 
2055 
2056  myContext.setData(myCallerUserData);
2057 
2058  myCaller = nullptr;
2059  myCallerUserData = nullptr;
2060  myCallerTransformUserData = nullptr;
2061  }
2062  }
2063 
2065  {
2066  if( !myCaller || !dep )
2067  return;
2068 
2069  myExtraMicroNodes.append( dep );
2070 
2071  // Force time dependency from time dependent parameters
2072  if( myAddTimeDep )
2073  {
2074  if( !myCaller->flags().getTimeDep() && dep->inheritTimeDependentFromExplicitInputs() )
2075  {
2076  myCaller->flags().setTimeDep(true);
2077  }
2078  }
2079  }
2080 
2082  {
2083  if( !myCaller || !src )
2084  return;
2085 
2086  // If the node is being deleted, then don't add it to our extra inputs, or
2087  // else we will get end up getting a dangling reference.
2088  if (src->isBeingDeleted())
2089  {
2090  // The UT_ASSERT() here makes it easier to be aware of these situations
2091  // but in general, the user can produce these situations easily because
2092  // channel references can be evaluated right away which then cause them
2093  // to attempt to add an extra input on the node being deleted.
2094  UT_ASSERT(!"Adding an extra input onto a deleted node");
2095  return;
2096  }
2097 
2098  ((OBJ_Node*)myCaller)->addExtraObjInput(src, type);
2099  }
2100 
2101  void addExtraInput( OP_Node *src, int pi, int vi=0 )
2102  {
2103  addExtraInput( src, pi, vi, vi);
2104  }
2105 
2106  void addExtraInput( OP_Node *src, int pi, int vi_start, int vi_end )
2107  {
2108  if( !myCaller || !src )
2109  return;
2110 
2111  // If the node is being deleted, then don't add it to our extra inputs, or
2112  // else we will get end up getting a dangling reference.
2113  if (src->isBeingDeleted())
2114  {
2115  // The UT_ASSERT() here makes it easier to be aware of these situations
2116  // but in general, the user can produce these situations easily because
2117  // channel references can be evaluated right away which then cause them
2118  // to attempt to add an extra input on the node being deleted.
2119  UT_ASSERT(!"Adding an extra input onto a deleted node");
2120  return;
2121  }
2122 
2123  for( int vi=vi_start; vi<=vi_end; ++vi )
2124  {
2125  myExtraInputs.append( OP_InterestRef(*src,pi,vi) );
2126  }
2127 
2128  // Force time dependency from time dependent parameters
2129  if( myAddTimeDep )
2130  {
2131  if( !myCaller->flags().getTimeDep() &&src->getParmList()->getTimeDependent() )
2132  {
2133  PRM_Parm *p = src->getParmList()->getParmPtr(pi);
2134  if( p )
2135  {
2136  for( int vi=vi_start; vi<=vi_end; ++vi )
2137  {
2138  if( p->isTimeDependent(vi) )
2139  {
2140  myCaller->flags().setTimeDep(true);
2141  break;
2142  }
2143  }
2144  }
2145  }
2146  }
2147  }
2148 
2149  bool hasCaller() const { return myCaller;}
2150  bool getExtraArgs( int &xord, int &rord, int &mask)
2151  {
2152  if( myCallerTransformUserData )
2153  return myCallerTransformUserData->getExtraArgs(xord,rord,mask);
2154  return false;
2155  }
2156 
2157 
2158 private:
2159  OP_Context &myContext;
2160  OP_ContextData *myCallerUserData;
2161  OP_TransformContextData *myCallerTransformUserData;
2162  OP_Node *myCaller;
2163  bool myAddTimeDep;
2166 };
2167 #endif
void setRGB(UT_Vector3F c)
void addWarning(OBJ_Error code, const char *msg=0)
Definition: OBJ_Node.h:1346
UT_DMatrix4 & getPreTransform()
Definition: OBJ_Node.h:691
virtual bool getTimeOverride()
Definition: OBJ_Node.h:1423
void setTX(fpreal t, fpreal v, PRM_AddKeyType add_key=PRM_AK_MARK_PENDING)
Definition: OBJ_Node.h:1462
virtual OBJ_Bone * castToOBJBone()
Definition: OBJ_Node.h:1004
const UT_Matrix4D & getLocalXform() const
Definition: OBJ_Node.h:1445
GT_API const UT_StringHolder selection
#define SET_FLOAT(name, parm_index, vector_index, t, val, add_key)
Definition: OBJ_Node.h:225
OBJ_SHADER_LOCATION
Definition: OBJ_Node.h:123
virtual const char * getHDASubType()
Definition: OP_Node.h:2926
virtual bool updateParmsFlags()
PRM_AddKeyType
Definition: PRM_Parm.h:59
GLbitfield flags
Definition: glcorearb.h:1596
int PATHPARMTYPE(fpreal t)
Definition: OBJ_Node.h:1529
OBJ_ParmsStyle
Definition: OBJ_Node.h:207
DOP_Node * getDisplayDopPtr()
Definition: OBJ_Node.h:711
void R(fpreal *v, fpreal t)
Definition: OBJ_Node.h:1510
virtual OBJ_Sticky * castToOBJSticky()
Definition: OBJ_Node.h:1014
fpreal getH() const override
Node position/scale is used by the UI.
PRM_Parm * getParmPtr(const UT_StringRef &theparmname, int &theparmidx)
GLuint GLsizei const GLchar * label
Definition: glcorearb.h:2545
virtual OBJ_DopNet * castToOBJDopNet()
Definition: OBJ_Node.h:1006
fpreal getW() const override
Node position/scale is used by the UI.
void T(fpreal *v, fpreal t)
Definition: OBJ_Node.h:1509
#define SYS_DEPRECATED(__V__)
virtual int VPORT_SHADEOPEN()
Definition: OBJ_Node.h:1543
static const char * theChildTableName
Definition: OBJ_Node.h:240
static const char * boundingBoxToken
Definition: OBJ_Node.h:980
Unsorted map container.
Definition: UT_Map.h:109
uint64 OP_VERSION
Definition: OP_Version.h:6
OBJ_TransformComponent
Definition: OBJ_Node.h:1300
virtual int isObjectLitBySubnet(OBJ_Node *, fpreal)
Definition: OBJ_Node.h:962
void setPIVOTRZ(fpreal t, fpreal v, PRM_AddKeyType add_key=PRM_AK_MARK_PENDING)
Definition: OBJ_Node.h:1492
void setSCALE(fpreal t, fpreal v, PRM_AddKeyType add_key=PRM_AK_MARK_PENDING)
Definition: OBJ_Node.h:1495
void addFatal(OBJ_Error code, const char *msg=0)
Definition: OBJ_Node.h:1348
Definition: OBJ_Node.h:155
void setDCOLORB(fpreal t, fpreal b)
Definition: OBJ_Node.h:1582
const char * getDefaultedSProperty(const char *name, fpreal now, UT_String &result, const char *def) const
Definition: OBJ_Node.h:1699
#define SYS_VISIBILITY_EXPORT
void
Definition: png.h:1083
void setIsPreTransformIdentity(int yesno)
Definition: OBJ_Node.h:695
void addExtraInput(OP_Node *src, OP_InterestType type=OP_INTEREST_DATA)
Definition: OBJ_Node.h:2081
fpreal PATHBANK(fpreal t)
Definition: OBJ_Node.h:1534
const GLdouble * v
Definition: glcorearb.h:837
int parmIndexCONSTRAINTSPATH() const
Definition: OBJ_Node.h:1633
bool getExtraArgs(int &xord, int &rord, int &mask)
Definition: OBJ_Node.h:2150
virtual bool getPickable()
Definition: OP_Node.h:1406
virtual OP_ERROR setInput(OP_InputIdx idx, OP_Node *op, OP_OutputIdx output_idx=0)
Sets a given input to connect to an output of a particular node.
void setSZ(fpreal t, fpreal v, PRM_AddKeyType add_key=PRM_AK_MARK_PENDING)
Definition: OBJ_Node.h:1478
virtual void setFlag(char tag, int8 val)
Transformation order of scales, rotates, and translates.
Definition: UT_XformOrder.h:23
void setDisplayOrder(int order)
Definition: OBJ_Node.h:1673
static const char * input2ObjectToken
Definition: OBJ_Node.h:983
GLsizei const GLfloat * value
Definition: glcorearb.h:824
void P(fpreal *v, fpreal t)
Definition: OBJ_Node.h:1512
virtual bool createSpareParametersForLoad(UT_StringArray &, PRM_ParmNameMap &, UT_String &)
int LOOKAT(UT_String &str, fpreal t) const
Definition: OBJ_Node.h:1643
UT_API UT_ErrorSeverity UTaddFatal(const char *type, int code, const char *msg=0, const UT_SourceLocation *loc=0)
virtual OBJ_StereoCamera * castToOBJStereoCamera()
Definition: OBJ_Node.h:1016
#define SYS_DEPRECATED_HDK_REPLACE(__V__, __R__)
const GLuint GLenum const void * binary
Definition: glcorearb.h:1924
virtual int doDrawLit() const
Definition: OBJ_Node.h:976
void addExtraInput(OP_Node *src, int pi, int vi=0)
Definition: OBJ_Node.h:2101
GLsizei const GLchar *const * path
Definition: glcorearb.h:3341
bool isCachingTransforms(int thread) const
Definition: OBJ_Node.h:2002
int PICKING()
Definition: OBJ_Node.h:1536
GA_API const UT_StringHolder rot
int OP_InputIdx
Definition: OP_DataTypes.h:184
virtual OBJ_Blend * castToOBJBlend()
Definition: OBJ_Node.h:1003
GLboolean GLboolean g
Definition: glcorearb.h:1222
virtual const char * getSetRotateParmName() const
Definition: OBJ_Node.h:949
GLdouble s
Definition: glad.h:3009
UT_ErrorSeverity
Definition: UT_Error.h:25
bool evalVariableValue(UT_String &val, int index, int thread) override
Definition: OBJ_Node.h:250
Parameters for OP_Node::getInfoText()/OP_Node::getNodeSpecificInfoText()
virtual const char * getSetScaleParmName() const
Definition: OBJ_Node.h:948
virtual bool getDisplayOrigin() const
Definition: OP_Node.h:1414
void setParentingErrorFlag(bool o)
Definition: OBJ_Node.h:825
Definition: OBJ_Node.h:156
int USE_DCOLOR()
Definition: OBJ_Node.h:1562
int PATHSOP(UT_String &str, fpreal t) const
Definition: OBJ_Node.h:1655
static const char * input3ObjectToken
Definition: OBJ_Node.h:984
int LOOKUPOBJ(UT_String &str, fpreal t) const
Definition: OBJ_Node.h:1649
**But if you need a result
Definition: thread.h:622
virtual void getParallelInputs(OP_Context &context, OP_NodeList &nodes) const
static void setGlobalKeepPosWhenParenting(OBJ_KeepPosType flag)
Definition: OBJ_Node.h:870
virtual OBJ_Fog * castToOBJFog()
Definition: OBJ_Node.h:1008
virtual void getNodeSpecificInfoText(OP_Context &context, OP_NodeInfoParms &parms)
virtual bool getParameterOrPropertyByChannel(const UT_StringRef &chname, fpreal now, OP_Node *&op, PRM_Parm *&parm, int &vector_index, PRM_ParmList *obsolete=nullptr)
UT_API UT_ErrorSeverity UTaddMessage(const char *type, int code, const char *msg=0, const UT_SourceLocation *loc=0)
float fpreal32
Definition: SYS_Types.h:200
void PICKSCRIPT(UT_String &str, fpreal t)
Definition: OBJ_Node.h:1537
UT_Color DCOLOR(fpreal t)
Definition: OBJ_Node.h:1569
int XYZ(fpreal t) const
Definition: OBJ_Node.h:1506
virtual int VPORT_DISPLAYASSUBDIV()
Definition: OBJ_Node.h:1544
void setSX(fpreal t, fpreal v, PRM_AddKeyType add_key=PRM_AK_MARK_PENDING)
Definition: OBJ_Node.h:1474
fpreal getDefaultedFProperty(const char *name, fpreal now, fpreal def) const
Definition: OBJ_Node.h:1692
virtual OP_ERROR setInputReference(OP_InputIdx idx, const char *label, int keeppos, OP_OutputIdx output_idx=0)
Connects an input to particular node by name in the network.
OutGridT const XformOp bool bool
constexpr auto in(type t, int set) -> bool
Definition: core.h:611
OBJ_BaseIndex
Definition: OBJ_Node.h:148
static const char * renderSopToken
Definition: OBJ_Node.h:979
void S(fpreal *v, fpreal t)
Definition: OBJ_Node.h:1511
static const char * displaySopToken
Definition: OBJ_Node.h:978
SOP_Node * getDisplaySopPtr()
Definition: OBJ_Node.h:707
OBJ_VariableId
Definition: OBJ_Node.h:191
const UT_Color & DCOLORREF(fpreal t, int &use_color)
Definition: OBJ_Node.h:1722
const char * getDefaultedRawSProperty(const char *name, fpreal now, UT_String &result, const char *def) const
Definition: OBJ_Node.h:1706
void opChanged(OP_EventType reason, void *data=nullptr) override
const OP_DataMicroNode & dataMicroNodeConst() const override
Definition: OBJ_Node.h:1094
#define FLOAT_OBJ_PARMS(name, idx, v, t)
Definition: OBJ_Node.h:218
GLdouble n
Definition: glcorearb.h:2008
obj_PathParmType
Definition: OBJ_Node.h:1522
GLint GLint GLsizei GLint GLenum GLenum type
Definition: glcorearb.h:108
static void setGlobalKeepPosWhenMoving(OBJ_KeepPosType flag)
Definition: OBJ_Node.h:875
int isTimeDependent() const
virtual bool isLightInLightMask(const OBJ_Node *light, fpreal now)
Function to resolve lighting based on light masks.
Definition: OBJ_Node.h:958
virtual const OP_DataMicroNode & parmListMicroNodeConst() const
Definition: OP_Node.h:1691
OP_InterestType
Definition: OP_DataTypes.h:206
obj_OnionSkin
Definition: OBJ_Node.h:731
void addExtraInput(OP_Node *src, int pi, int vi_start, int vi_end)
Definition: OBJ_Node.h:2106
GLboolean reset
Definition: glad.h:5138
int KEEPPOS(fpreal t) const
Definition: OBJ_Node.h:1504
virtual int * getIndirect() const =0
fpreal DCOLORR(fpreal t)
Definition: OBJ_Node.h:1565
void PIVOTR(fpreal *v, fpreal t)
Definition: OBJ_Node.h:1513
Definition: OBJ_Node.h:154
int TRS(fpreal t) const
Definition: OBJ_Node.h:1505
GA_API const UT_StringHolder trans
void setDCOLORR(fpreal t, fpreal r)
Definition: OBJ_Node.h:1578
void LOOKUP(UT_String &str, fpreal t)
Definition: OBJ_Node.h:1518
OBJ_Error
Definition: OBJ_Error.h:15
SYS_FORCE_INLINE bool getTimeDependent() const
Definition: PRM_ParmList.h:314
#define SET_INT(name, parm_index, vector_index, t, val)
Definition: OBJ_Node.h:227
int getInterceptMode() const
Definition: UT_Playback.h:102
int getCachedParmIndex(const UT_StringRef &name, int name_idx) const
Definition: OBJ_Node.h:1395
virtual OP_ERROR setNamedInput(const OP_ConnectorId &input_name, OP_Node *op, const OP_ConnectorId *output_name=nullptr)
New input functions that use names instead of indices.
static OBJ_KeepPosType getGlobalKeepPosWhenMoving()
Definition: OBJ_Node.h:877
virtual bool setPickable(bool on_off)
Definition: OP_Node.h:1360
int getCachedParmIndex(const PRM_Name &name, int name_idx) const
Definition: OBJ_Node.h:1403
virtual bool getHideDefaultParms() const
Definition: OBJ_Node.h:1079
void addError(int code, const char *msg=0)
Definition: OBJ_Node.h:1342
GLint GLuint mask
Definition: glcorearb.h:124
void setTY(fpreal t, fpreal v, PRM_AddKeyType add_key=PRM_AK_MARK_PENDING)
Definition: OBJ_Node.h:1464
int PATHORIENT(fpreal t)
Definition: OBJ_Node.h:1530
void setSY(fpreal t, fpreal v, PRM_AddKeyType add_key=PRM_AK_MARK_PENDING)
Definition: OBJ_Node.h:1476
OBJ_KeepPosType
Definition: OBJ_Node.h:198
int parmIndexDISPLAY() const
Definition: OBJ_Node.h:1587
virtual const char * getSetTranslateParmName() const
Definition: OBJ_Node.h:950
GLdouble GLdouble GLint GLint order
Definition: glad.h:2676
long long int64
Definition: SYS_Types.h:116
SYS_VISIBILITY_EXPORT void newObjectOperator(OP_OperatorTable *table)
Definition: OBJ_Lamp.C:40
fpreal PATHROLL(fpreal t)
Definition: OBJ_Node.h:1531
virtual OBJ_Ambient * castToOBJAmbient()
Definition: OBJ_Node.h:1002
int parmIndexTDISPLAY() const
Definition: OBJ_Node.h:1623
virtual OP_ERROR setIndirectInput(OP_InputIdx idx, OP_IndirectInput *input)
Connects an input to an indirect input of our parent subnet.
void addMessage(OBJ_Error code, const char *msg=0)
Definition: OBJ_Node.h:1344
GLuint id
Definition: glcorearb.h:655
#define FLOAT_OBJ_PARM(name, idx, vi, t)
Definition: OBJ_Node.h:216
#define INT_OBJ_PARM(name, idx, vi, t)
Definition: OBJ_Node.h:220
int PROMOTE_POPGUIDES(fpreal t) const
Definition: OBJ_Node.h:1663
void addExtraInput(DEP_MicroNode *dep)
Definition: OBJ_Node.h:2064
OP_OpTypeId
Definition: OP_OpTypeId.h:18
void setLocalXform(const UT_Matrix4D &m)
Definition: OBJ_Node.h:1449
virtual OBJ_Camera * castToOBJCamera()
Definition: OBJ_Node.h:1005
virtual OP_Node * getRenderNodePtr()
static void setIgnorePretransformValue(bool flag)
Definition: OBJ_Node.h:886
bool hasConstraints() const
Definition: OBJ_Node.h:1119
virtual OBJ_SubNet * castToOBJSubNet()
Definition: OBJ_Node.h:1015
GLuint const GLchar * name
Definition: glcorearb.h:786
void setCHILDCOMP(int v)
Definition: OBJ_Node.h:1502
signed char int8
Definition: SYS_Types.h:35
void setTZ(fpreal t, fpreal v, PRM_AddKeyType add_key=PRM_AK_MARK_PENDING)
Definition: OBJ_Node.h:1466
GLsizei const GLchar *const * strings
Definition: glcorearb.h:1933
GLboolean GLboolean GLboolean b
Definition: glcorearb.h:1222
static bool getIgnorePretransform()
Definition: OBJ_Node.h:888
virtual const OP_DataMicroNode & dataMicroNodeConst() const
Definition: OP_Node.h:1680
virtual bool getBoundingBox(UT_BoundingBox &box, OP_Context &)
void setROTORDER(int v)
Definition: OBJ_Node.h:1500
int CHILDCOMP(fpreal t) const
Definition: OBJ_Node.h:1507
fpreal DCOLORB(fpreal t)
Definition: OBJ_Node.h:1567
GLenum GLenum GLsizei void * table
Definition: glad.h:5129
OBJ_UIChangeType
Definition: OBJ_Node.h:131
virtual OP_OpTypeId getOpTypeID() const
Definition: OP_Node.h:547
static const char * input4ObjectToken
Definition: OBJ_Node.h:985
that also have some descendant prim *whose name begins with which in turn has a child named baz where *the predicate active
const UT_Matrix4D & getWorldXform() const
Definition: OBJ_Node.h:1453
GLdouble t
Definition: glad.h:2397
bool getObjectDisplay(fpreal t, const OP_Network *n=0) const
Definition: OBJ_Node.h:1595
GLenum mode
Definition: glcorearb.h:99
virtual OP_ERROR setNamedIndirectInput(const OP_ConnectorId &input_name, OP_IndirectInput *input)
bool getParentingErrorFlag() const
Definition: OBJ_Node.h:823
virtual bool createSpareParametersFromChannels(UT_BitArray &selection, const CH_ChannelList &channels)
int CACHING()
Definition: OBJ_Node.h:1539
virtual OBJ_Light * castToOBJLight()
Definition: OBJ_Node.h:1011
fpreal PATHPOS(fpreal t)
Definition: OBJ_Node.h:1528
virtual OP_ERROR setNamedInputReference(const OP_ConnectorId &input_name, const char *label, int, const OP_ConnectorId *output_name=nullptr)
virtual void getDragDropChoice(DD_Source &src, DD_ChoiceList &c)
int isPreTransformIdentity()
Definition: OBJ_Node.h:693
virtual const char * getChildType() const
virtual bool getParameterOrProperty(const UT_StringRef &name, fpreal now, OP_Node *&op, PRM_Parm *&parm, bool create_missing_multiparms, PRM_ParmList *obsolete=nullptr)
#define STR_OBJ_PARM(name, idx, vi, t)
Definition: OBJ_Node.h:222
GLsizeiptr size
Definition: glcorearb.h:664
virtual int testDragDrop(DD_Source &src)
**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
GLuint shader
Definition: glcorearb.h:785
A map of string to various well defined value types.
Definition: UT_Options.h:84
void setWorldXform(const UT_Matrix4D &m)
Definition: OBJ_Node.h:1458
GA_API const UT_StringHolder parms
void setRY(fpreal t, fpreal v, PRM_AddKeyType add_key=PRM_AK_MARK_PENDING)
Definition: OBJ_Node.h:1470
virtual int findParametersOrProperties(fpreal now, OP_PropertyLookupList &list)
Parameters for OP_Node::fillInfoTree()/OP_Node::fillInfoTreeNodeSpecific()
void PATHUP(fpreal *v, fpreal t)
Definition: OBJ_Node.h:1532
virtual void fillInfoTreeNodeSpecific(UT_InfoTree &tree, const OP_NodeInfoTreeParms &parms)
virtual bool canCreateNewOpType() const
UT_ColorType
Definition: UT_Color.h:24
PRM_Parm * getCachedParm(const UT_StringRef &name, int name_idx)
Definition: OBJ_Node.h:1411
static OBJ_KeepPosType getGlobalKeepPosWhenParenting()
Definition: OBJ_Node.h:872
int getDisplayOrder() const
Definition: OBJ_Node.h:1669
static UT_Playback * getPlayback()
GEO_ViewportLOD
__hostdev__ constexpr T pi()
Pi constant taken from Boost to match old behaviour.
Definition: NanoVDB.h:976
virtual int isObjectLitBy(OBJ_Node *, fpreal)
Definition: OBJ_Node.h:956
virtual void resolveObsoleteParms(PRM_ParmList *)
OP_VERSION modVersion() const
fpreal64 fpreal
Definition: SYS_Types.h:278
exint evalIntT(int pi, int vi, fpreal t, int thread) const
SOP_Node * getRenderSopPtr()
Definition: OBJ_Node.h:709
bool isUseFullTransformModel() const
Definition: OBJ_Node.h:312
virtual OBJ_Rivet * castToOBJRivet()
Definition: OBJ_Node.h:1013
OBJ_MatchTransform
Definition: OBJ_Node.h:137
void setPIVOTRY(fpreal t, fpreal v, PRM_AddKeyType add_key=PRM_AK_MARK_PENDING)
Definition: OBJ_Node.h:1489
LeafData & operator=(const LeafData &)=delete
GLuint index
Definition: glcorearb.h:786
int getDefaultedIProperty(const char *name, fpreal now, int def) const
Definition: OBJ_Node.h:1685
virtual void referencedParmChanged(int pi)
virtual bool setDisplayOrigin(bool on_off_unchanged)
Definition: OP_Node.h:1368
virtual const char * getOpType() const
UT_API UT_ErrorSeverity UTaddWarning(const char *type, int code, const char *msg=0, const UT_SourceLocation *loc=0)
int parmIndexCONSTRAINTSON() const
Definition: OBJ_Node.h:1628
ImageBuf OIIO_API max(Image_or_Const A, Image_or_Const B, ROI roi={}, int nthreads=0)
GLuint GLfloat * val
Definition: glcorearb.h:1608
OP_EventType
Definition: OP_Value.h:22
void setRZ(fpreal t, fpreal v, PRM_AddKeyType add_key=PRM_AK_MARK_PENDING)
Definition: OBJ_Node.h:1472
GA_API const UT_StringHolder pivot
OP_DataType
Definition: OP_DataTypes.h:189
virtual OP_OpTypeId getChildTypeID() const =0
int OP_OutputIdx
Definition: OP_DataTypes.h:185
virtual OBJ_Handle * castToOBJHandle()
Definition: OBJ_Node.h:1010
int invert(T tol=0.0F)
void setTRANSORDER(int v)
Definition: OBJ_Node.h:1499
virtual bool evalVariableValue(UT_String &val, int index, int thread)
const OP_DataMicroNode & parmListMicroNodeConst() const override
Definition: OBJ_Node.h:1087
bool isstring() const
Definition: UT_String.h:698
bool inheritTimeDependentFromExplicitInputs()
OBJ_MOTIONBLUR_TYPE
Definition: OBJ_Node.h:115
virtual OBJ_Fetch * castToOBJFetch()
Definition: OBJ_Node.h:1007
int isBeingDeleted() const
Definition: OP_Node.h:1478
const UT_DMatrix4 & getInverseXform()
Definition: OBJ_Node.h:1429
This is the base class for all DOP nodes.
Definition: DOP_Node.h:77
#define UT_ASSERT(ZZ)
Definition: UT_Assert.h:156
static bool getIgnorePretransformValue()
Definition: OBJ_Node.h:891
void setPX(fpreal t, fpreal v, PRM_AddKeyType add_key=PRM_AK_MARK_PENDING)
Definition: OBJ_Node.h:1480
void setPZ(fpreal t, fpreal v, PRM_AddKeyType add_key=PRM_AK_MARK_PENDING)
Definition: OBJ_Node.h:1484
GLboolean r
Definition: glcorearb.h:1222
bool getCachable(int thread) const
Definition: OBJ_Node.h:1996
virtual void propagateEndBlockModify()
void setRX(fpreal t, fpreal v, PRM_AddKeyType add_key=PRM_AK_MARK_PENDING)
Definition: OBJ_Node.h:1468
#define OBJ_API
Definition: OBJ_API.h:10
fpreal SCALE(fpreal t)
Definition: OBJ_Node.h:1516
SYS_FORCE_INLINE PRM_ParmList * getParmList()
Definition: PRM_ParmOwner.h:73
OP_VERSION parmListModVersion() const
Definition: OBJ_Node.h:1089
void setPY(fpreal t, fpreal v, PRM_AddKeyType add_key=PRM_AK_MARK_PENDING)
Definition: OBJ_Node.h:1482
virtual OBJ_Null * castToOBJNull()
Definition: OBJ_Node.h:1012
OBJ_NodeFlags & objflags()
Definition: OBJ_Node.h:834
unsigned int uint
Definition: SYS_Types.h:45
void setCookingRender(int val) override
Definition: OBJ_Node.h:831
void setDCOLORG(fpreal t, fpreal g)
Definition: OBJ_Node.h:1580
void setPIVOTRX(fpreal t, fpreal v, PRM_AddKeyType add_key=PRM_AK_MARK_PENDING)
Definition: OBJ_Node.h:1486
static const char * boundingSphereToken
Definition: OBJ_Node.h:981
virtual int acceptDragDrop(DD_Source &src, const char *label)
Definition: OBJ_Node.h:153
virtual OBJ_Geometry * castToOBJGeometry()
Definition: OBJ_Node.h:1009
Definition: format.h:1821
static const char * input1ObjectToken
Definition: OBJ_Node.h:982
virtual OP_Node * getDisplayNodePtr()
int isCookingRender() const override
Definition: OBJ_Node.h:828
fpreal DCOLORG(fpreal t)
Definition: OBJ_Node.h:1566
OP_ERROR setParentObject(OBJ_Node *node)
Definition: OBJ_Node.h:1356
UT_API UT_ErrorSeverity UTaddError(const char *type, int code, const char *msg=0, const UT_SourceLocation *loc=0)
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)
const PRM_Parm * getCachedParm(const UT_StringRef &name, int name_idx) const
Definition: OBJ_Node.h:1416
virtual obj_OnionSkin getOnionSkin()
Definition: OBJ_Node.h:737
void setKEEPPOS(int v)
Definition: OBJ_Node.h:1501
void setDisplayDisabledBySubnetNeedsUpdate()
Definition: OBJ_Node.h:1680
GLenum src
Definition: glcorearb.h:1793