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