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