HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
FBX_SceneProxy.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: FBX_SceneProxy.h (FBX Library, C++)
7  *
8  * COMMENTS:
9  *
10  */
11 
12 #ifndef __FBX_SCENEPROXY_H_INCLUDED__
13 #define __FBX_SCENEPROXY_H_INCLUDED__
14 
15 #include "FBX_API.h"
16 #include "FBX_SceneProxySupport.h"
17 #include <GU/GU_DetailHandle.h>
18 #include <GA/GA_OffsetList.h>
19 #include <UT/UT_Array.h>
20 #include <UT/UT_ArrayMap.h>
21 #include <UT/UT_ArrayStringMap.h>
22 #include <UT/UT_Options.h>
23 #include <UT/UT_StringArray.h>
24 #include <UT/UT_StringHolder.h>
25 #include <UT/UT_UniquePtr.h>
26 #include <UT/UT_VectorTypes.h>
27 #include <UT/UT_TransformUtil.h>
28 #include <SYS/SYS_Inline.h>
29 #include <SYS/SYS_Types.h>
30 
31 
32 class FBX_ErrorManager;
33 class GU_Detail;
34 enum class OP_OrientationMode;
35 
36 FBX_SCENEPROXY_DECLARE_ID(FBX_NodeID);
37 FBX_SCENEPROXY_DECLARE_ID(FBX_GeometryID);
38 FBX_SCENEPROXY_DECLARE_ID(FBX_MeshID);
39 FBX_SCENEPROXY_DECLARE_ID(FBX_ClipID);
40 FBX_SCENEPROXY_DECLARE_ID(FBX_AnimCurveID);
41 FBX_SCENEPROXY_DECLARE_ID(FBX_AnimLayerID);
42 FBX_SCENEPROXY_DECLARE_ID(FBX_AnimCurveNodeID);
43 FBX_SCENEPROXY_DECLARE_ID(FBX_PropertyID);
44 
45 template <typename T>
46 class FBX_Property : public FBX_PropertyID
47 {
48 public:
49  using value_type = T;
50 
51  using FBX_PropertyID::FBX_PropertyID;
52 
53 private:
54  friend class FBX_SceneProxy;
55 };
57 
59 struct FBX_AxisSystem;
60 
61 
63 {
64 public:
67 
69  void
70  add(FBX_NodeID node, const UT_StringHolder& name)
71  {
72  myNodeToName[node] = name;
73  myNameToNode[name] = node;
74  }
75 
77  FBX_NodeID
78  getNode(const UT_StringRef& name, FBX_NodeID fallback) const
79  {
80  auto item = myNameToNode.find(name);
81  return item != myNameToNode.end() ? item->second : fallback;
82  }
83 
86  getName(FBX_NodeID node, const UT_StringRef& fallback) const
87  {
88  auto item = myNodeToName.find(node);
89  return (item != myNodeToName.end()) ? item->second : fallback;
90  }
91 
93  bool exists(FBX_NodeID node) const
94  {
95  return myNodeToName.contains(node);
96  }
98  bool exists(const UT_StringRef& name) const
99  {
100  return myNameToNode.contains(name);
101  }
102 
103 private:
105  UT_ArrayStringMap<FBX_NodeID> myNameToNode;
106 };
107 
108 
110 {
111 public:
113  {
114  bool myConvertUnits = true;
115  bool myConvertAxisSystem = true;
116  bool myConvertAxisSystemForceYUp = true; /// only used when converting
117  bool myImportTemplates = true;
118  bool myImportPivots = true;
119  bool myImportGlobalSettings = true;
120  bool myImportCharacters = true;
121  bool myImportConstraints = true;
122  bool myImportGobos = true;
123  bool myImportShapes = true;
124  bool myImportLinks = true;
125  bool myImportTextures = true;
126  bool myImportModels = true;
127  bool myImportAnimations = true;
128  bool myImportMaterials = false; /// should also enable
129  /// myExtractEmbeddedMedia when
130  /// enabling this.
131  bool myExtractEmbeddedData = false; // evil!
132  };
133 
135  {
136  bool myBinary = true;
137  bool myAnimationOnly = false;
138  bool myEmbedData = false; /// only used when myBinary is true
139  };
140 
141  /// Construct wrapper around the FBX SDK
142  /// @note By default, no scene is set up. You must still call one of load()
143  /// or initInitNewScene().
144  FBX_SceneProxy();
145 
146  ~FBX_SceneProxy();
147 
148  /// Initialize a new empty scene
149  /// @note Resets mySceneScale/myShouldConvertMaterials to default.
150  bool initNewScene(FBX_ErrorManager& errors);
151 
152  /// Load a new scene
153  /// @{
154  bool load(const char* path,
155  const LoadOptions& options,
156  FBX_ErrorManager& errors);
157  inline bool load(const char* path,
158  bool convert_units,
159  FBX_ErrorManager& errors)
160  {
161  LoadOptions options;
162  options.myConvertUnits = convert_units;
163  return load(path, options, errors);
164  }
165  /// @}
166 
167  /// Save current scene. One of initNewScene() or load() must have been
168  /// called.
169  /// @{
170  bool save(const char* path,
171  FBX_ErrorManager& errors,
172  const SaveOptions& options) const;
173  inline bool save(const char* path,
174  FBX_ErrorManager& errors,
175  bool binary = true,
176  bool animation_only = false) const
177  {
178  SaveOptions options;
179  options.myBinary = binary;
180  options.myAnimationOnly = animation_only;
181  return save(path, errors, options);
182  }
183  // @}
184 
185  /// Stamp FbxDocumentInfo using the current $JOB, $HIPFILE and software
186  /// version.
187  void stampDocumentInfo(const char* orig_fbx_filename = nullptr);
188 
189  fpreal globalFrameRate() const;
190  void setGlobalFrameRate(fpreal fps);
191 
192  void getGlobalTimeRange(fpreal& start, fpreal &stop) const;
193  void setGlobalTimeRange(fpreal start, fpreal stop);
194 
195  /// Get the scene's current axis system
196  FBX_AxisSystem globalAxisSystem() const;
197 
198  /// Set the scene's current axis system
199  /// @{
200  void setGlobalAxisSystem(const FBX_AxisSystem& axis_system);
201  void setGlobalAxisSystem(OP_OrientationMode orientation_mode);
202  /// @}
203 
204  /// Convert the scene to the given axis system
205  void convertAxisSystem(const FBX_AxisSystem& target);
206 
207  enum class AxisSystemPreset
208  {
209  MayaYUp, // UpVector = +Y, FrontVector = +Z, CoordSystem = +X (RightHanded)
210  MayaZUp, // UpVector = +Z, FrontVector = -Y, CoordSystem = +X (RightHanded)
211  DirectX, // UpVector = +Y, FrontVector = +Z, CoordSystem = -X (LeftHanded)
212  UnrealEngine, // UpVector = +Z, FrontVector = -Y, CoordSystem = -X (LeftHanded)
213  };
214  bool convertAxisSystem(AxisSystemPreset preset);
215 
216  enum class SystemUnitPreset
217  {
218  cm,
219  m
220  };
221  /// Set the scene's current unit system
222  bool setGlobalSystemUnit(SystemUnitPreset preset);
223 
224  /// Convert the scene to match Houdini.
225  /// Returns true if conversion was done, false if no conversion was needed
226  bool convertToHoudiniAxisSystem();
227 
228  /// Return name of node
229  const char* nodeName(FBX_NodeID node) const;
230 
231  static constexpr UT_StringLit FBX_ENUM_LIST_SUFFIX = ".list";
232  static constexpr UT_StringLit FBX_ENUM_INDEX_SUFFIX = ".index";
233 
234  // Import custom properties associated with the node
235  // as a dictionary of attributes
236  void importCustomProperties(
237  const FBX_NodeID node,
238  UT_Options& attrib_map,
239  bool is_animated = false,
240  const fpreal time_seconds = 0) const;
241 
242  // Creates an fbx property for single value custom attributes
243  // (e.g. bool, int, float, string). Returns a FBX_AnimCurveID
244  // for animated properties.
245  FBX_AnimCurveID outputCustomProperties(
246  const FBX_NodeID node,
247  FBX_AnimLayerID layer,
248  const char* name,
249  const UT_OptionEntry* attr,
250  bool is_animated = false);
251 
252  FBX_AnimCurveID outputCustomEnumProperties(
253  const FBX_NodeID node,
254  FBX_AnimLayerID layer,
255  const char* name,
256  UT_StringArray& enum_list,
257  int idx);
258 
259  // Creates an fbx property for compound custom attributes
260  // (e.g. vector3, vector4, matrix4x4). Returns a
261  // FBX_AnimCurveNodeID with the required channels properties.
262  FBX_AnimCurveNodeID outputCustomCompoundProperties(
263  const FBX_NodeID node,
264  FBX_AnimLayerID layer,
265  const char* name,
266  const UT_OptionEntry* attr);
267 
268  // Creates an animation curve with the given name and connects
269  // it to the animation curve node at the provided channel.
270  FBX_AnimCurveID createCurveOnNode(
271  FBX_AnimCurveNodeID curve_node,
272  const char* name,
273  int channel);
274 
275  // Get the total number of property channels defined in the
276  // given animation curve node.
277  int getChannelsCount(FBX_AnimCurveNodeID curve_node);
278 
279  /// Find first node in scene that has given name
280  FBX_NodeID findNode(const char* name) const;
281 
282  /// Return "path" from scene root of node. If node == nullptr, returns
283  /// empty string.
284  UT_StringHolder nodePath(FBX_NodeID node) const;
285 
286  /// Find node in scene by hierarchical path from the scene root.
287  /// If path does not begin with a '/' then it returns findNode(path).
288  FBX_NodeID findNodeByPath(const char* path) const;
289 
290  /// Return map of all nodes (except for the scene root) with unique names
291  void getUniqueNodeNames(FBX_NodeNameMap& name_map);
292 
293  int nodeCount() const;
294  FBX_NodeID node(int i) const;
295 
296  FBX_NodeID rootNode() const;
297  FBX_NodeID parentNode(FBX_NodeID node) const;
298  int childNodeCount(FBX_NodeID node) const;
299  FBX_NodeID childNode(FBX_NodeID node, int i) const;
300 
301  enum NodeType
302  {
303  eUnknown, // Unknown
304  eNull, // Null object
305  eMarker, // Mocap marker OR IK/FK effector
306  eSkeleton, // Bone/Joint
307  eMesh, // Geometry
308  eNurbs, // Geometry
309  ePatch, // Geometry
310  eCamera, // Camera
311  eCameraStereo, // Stereo camera
312  eCameraSwitcher, // Switch between child cameras
313  eLight, // Light
314  eOpticalReference, // Mocap marker
315  eOpticalMarker, // Mocap marker OR IK/FK effector
316  eNurbsCurve, // Geometry
317  eTrimNurbsSurface, // Geometry
318  eBoundary, // Geometry
319  eNurbsSurface, // Geometry
320  eShape, // Blendshape
321  eLODGroup, // Group of objects with different levels of detail
322  eSubDiv, // Geometry
323  eCachedEffect, // Particles, fluids, hair, etc. cache
324  eLine // Geometry
325  };
326  NodeType nodeType(FBX_NodeID node) const;
327 
328  /// Add new FbxNode with new FbxSkeleton attribute as a joint
329  FBX_NodeID createJointNode(const char* name, bool is_root);
330 
331  /// Add child to parent. If child already has a parent, first it is removed
332  /// from current parent and then added to this one.
333  void nodeAddChild(FBX_NodeID parent, FBX_NodeID child);
334 
335  bool visibility(FBX_NodeID node) const;
336 
337  FBX_GeometryID geometry(FBX_NodeID node) const;
338  FBX_NodeID geometryNode(FBX_GeometryID geometry) const;
339  int geometrySkinDeformerCount(FBX_GeometryID geometry) const;
340 
341  /// Count of skin deformers in the file
342  int skinDeformerCount() const;
343 
344  /// Get geometry associated with skin deformer i
345  /// @note There might no geometry attached and this will return nullptr
346  FBX_GeometryID skinDeformerGeometry(int i) const;
347 
348  FBX_MeshID geometryMesh(FBX_NodeID node) const;
349 
350  // Compute smoothing group information from mesh normals
351  bool computeSmoothingGroupInfo(FBX_MeshID mesh) const;
352 
353  /// Convert geometry into GU_Detail, with skin deformers converted into
354  /// a boneCapture attribute. If world_xform is given, the result including
355  /// the transforms within boneCapture will have this baked into it.
356  /// When add_unused_joints is true, add ancestor joints for any captured
357  /// joints will also be added to the boneCapture attribute with identity
358  /// transforsm. When name_map is given, node names for boneCapture will
359  /// use the ones given by name_map.
360  /// @{
361  bool convertGeometry(
362  GU_Detail& detail,
363  FBX_GeometryID geometry,
364  FBX_ErrorManager& errors,
365  bool add_unused_joints,
366  const UT_Matrix4D* world_xform = nullptr) const;
367 
368  bool convertGeometry(
369  GU_Detail& detail,
370  FBX_GeometryID geometry,
371  FBX_ErrorManager& errors,
372  bool add_unused_joints,
373  const UT_Matrix4D* world_xform,
374  const FBX_NodeNameMap* name_map) const;
375  /// @}
376 
377  enum class SkinningType
378  {
379  eRigid,
380  eLinear,
381  eDualQuaternion,
382  eBlend
383  };
384  /// Returns the skinning type for the i'th skin deformer in the geometry.
385  SkinningType geometrySkinDeformerType(FBX_GeometryID geometry, int i) const;
386 
387  /// Returns the number of blend shape deformers for the geometry.
388  int blendshapeCount(FBX_GeometryID geometry) const;
389  /// Returns the number of channels for the i'th blend shape deformer.
390  int blendshapeChannelCount(
391  FBX_GeometryID geometry, int blendshape_idx) const;
392  /// Returns the name of the specified blendshape channel.
393  UT_StringHolder blendshapeChannelName(FBX_GeometryID geometry,
394  int blendshape_idx, int channel_idx) const;
395 
396  /// Like convertGeometry() except its specialized to only do it when the
397  /// conditions are necessary for importing blendshape channel targets.
398  /// Only returns false if a conversion was attempted and failed.
399  bool convertBlendShapeBaseGeometry(
400  GU_DetailHandle& detail,
401  FBX_GeometryID geometry,
402  FBX_ErrorManager& errors) const;
403 
404  /// Returns the geometry, name, and weight (multiplied by 0.01) for each of
405  /// the channel's target shapes. Multiple targets imply that there are
406  /// in-between shapes, and the shapes are sorted by weight in ascending
407  /// order.
408  /// @{
409  /// @note This variant is slower it needs to call
410  /// convertBlendShapeBaseGeometry() every time.
411  void blendShapeChannelTargets(
412  FBX_GeometryID geometry,
413  int blendshape_idx,
414  int channel_idx,
415  UT_Array<GU_DetailHandle>& details,
416  UT_StringArray& names,
417  UT_Array<fpreal>& weights,
418  const UT_Matrix4D* world_xform = nullptr) const;
419 
420  /// @param base_shape Prepared detail handle by calling
421  /// convertBlendShapeBaseGeometry()
422  void blendShapeChannelTargets(
423  FBX_GeometryID geometry,
424  int blendshape_idx,
425  int channel_idx,
426  const GU_DetailHandle& base_shape,
427  UT_Array<GU_DetailHandle>& details,
428  UT_StringArray& names,
429  UT_Array<fpreal>& weights,
430  const UT_Matrix4D* world_xform = nullptr) const;
431  /// @}
432 
433  /// Returns curve for the blend shape channel's values.
434  /// @note Result might be null for non-animated blendshapes.
435  /// @{
436  FBX_AnimCurveID blendshapeChannelCurve(
437  FBX_GeometryID geometry,
438  int blendshape_idx,
439  int channel_idx) const;
440  FBX_AnimCurveID blendshapeChannelCurve(
441  FBX_GeometryID geometry,
442  int blendshape_idx,
443  int channel_idx,
444  bool create_if_needed);
445  /// @}
446 
447  /// Evaluate an animation curve at the given time
448  fpreal animCurveEval(
449  FBX_AnimCurveID curve, fpreal time_seconds) const;
450 
451  /// Number of keys in anim curve
452  int animCurveKeyCount(FBX_AnimCurveID curve) const;
453 
454  /// Get the time range of the anim curve
455  void getAnimCurveTimeInterval(
456  FBX_AnimCurveID curve,
457  fpreal &start, fpreal &end) const;
458 
459  /// Local translation property of node
460  FBX_Property3D nodeLocalTranslate(FBX_NodeID node) const;
461 
462  /// Local rotation property of node
463  FBX_Property3D nodeLocalRotate(FBX_NodeID node) const;
464 
465  /// Local scale property of node
466  FBX_Property3D nodeLocalScale(FBX_NodeID node) const;
467 
468  /// Local pre-rotation property of node. Should only be used when
469  /// nodeIsRotationActive() is true.
470  FBX_Property3D nodeLocalPreRotation(FBX_NodeID node) const;
471 
472  /// When nodeIsRotationActive() is false, then these node properties are
473  /// ignored from the FBX file:
474  /// rotation order, pivots, pre/post rotation values, rotation limits
475  bool nodeIsRotationActive(FBX_NodeID node) const;
476 
477  /// Return the transform order for given node. For FBX, we always return a
478  /// transform order of SRT, so really only the rotation order is pertinent
479  /// here.
480  /// @note Returns a default value when !nodeIsRotationActive()
481  UT_XformOrder nodeTransformOrder(FBX_NodeID node) const;
482 
483  /// Return the rotation pivot for given node.
484  /// @note Returns a default value when !nodeIsRotationActive()
485  UT_Vector3D nodeRotationPivot(FBX_NodeID node) const;
486 
487  int animLayerCount(FBX_ClipID clip) const;
488  FBX_AnimLayerID animLayer(FBX_ClipID clip, int i) const;
489 
490  /// Create a new animation layer. If given clip, the layer is added to it.
491  FBX_AnimLayerID createAnimLayer(const char* name,
492  FBX_ClipID clip = FBX_ClipID{});
493 
494  /// Destroy give animation layer. If recurse_unused is true, then
495  /// recursively destroy all unused dst objects as a result.
496  void destroyAnimLayer(FBX_AnimLayerID layer,
497  bool recurse_unused = false);
498 
499  /// Add/remove a layer to clip as a src object
500  /// @{
501  void addAnimLayer(FBX_ClipID clip, FBX_AnimLayerID layer);
502  void removeAnimLayer(FBX_ClipID clip, FBX_AnimLayerID layer);
503  /// @}
504 
505  /// Return src object count of layer
506  int animLayerSrcCount(FBX_AnimLayerID layer) const;
507 
508  /// Return animation curve attached to property
509  FBX_AnimCurveID propertyAnimCurve(
510  FBX_PropertyID property,
511  FBX_AnimLayerID layer,
512  int component,
513  bool create = false);
514 
515  /// Evaluate animated value from property
516  /// @{
517  fpreal propertyEvalFloat(
518  FBX_PropertyID property,
519  fpreal time_seconds);
520  UT_Vector3R propertyEvalVector(
521  FBX_Property3D property,
522  fpreal time_seconds);
523  /// @}
524 
525  /// Set non-animated value on property
526  /// @{
527  void propertySetFloat(
528  FBX_PropertyID property,
529  fpreal value);
530  void propertySetVector(
531  FBX_PropertyID property,
532  const UT_Vector3R& vector);
533  /// @}
534 
535  /// Scene scale to convert from internal FBX scene. Determined by load()
536  /// This is currently only used by nodeGlobalTransform()
537  double sceneScale() const;
538 
539  /// Set the scene scale
540  void setSceneScale(fpreal scale);
541 
542  /// Return a node's global transform, scaled by sceneScale()
543  UT_Matrix4D nodeGlobalTransform(
544  FBX_NodeID node, fpreal time_seconds) const;
545 
546  /// Get a node's local transform at given time.
547  /// @note This transform is NOT scaled by sceneScale()
548  UT_Matrix4D nodeLocalTransform(
549  FBX_NodeID node, fpreal time_seconds) const;
550 
551  /// Return global transform without animation, scaled by sceneScale()
552  UT_Matrix4D nodeGlobalRestTransform(FBX_NodeID node) const;
553 
554  /// Access node's local transform without animation
555  /// @note This transform is NOT scaled by sceneScale()
556  /// @{
557  UT_Matrix4D nodeLocalRestTransform(FBX_NodeID node) const;
558 
559  /// Set a node's local transform without anim
560  void setNodeLocalRestTransform(
561  FBX_NodeID node,
562  const UT_Matrix4D& local);
563  /// @}
564 
565  /// Get a node's geometric transform. Returns false if there is none.
566  /// A geometric transform is a transform that is only applied to the node's
567  /// geometry and is not part of its global transform.
568  /// @note This transform is NOT scaled by sceneScale()
569  bool nodeGeometricTransform(
570  FBX_NodeID node, UT_Matrix4D& transform) const;
571 
572  /// Remove all animation on the transform properties of given node
573  void removeNodeAnimation(FBX_NodeID node);
574 
575  /// Compute a scene scale needed convert transforms from
576  /// nodeGlobalTransform() to the Houdini unit length.
577  /// This will be 1.0 if the file was loaded with convert_units=true.
578  double computeConversionFactor() const;
579 
581  nodeScaleInheritanceMode(FBX_NodeID node) const;
582 
583  /// Set the scale inheritance mode for a node. Note that FBX does NOT
584  /// support everything, and only these modes:
585  /// DEFAULT, OFFSET_ONLY, and OFFSET_AND_SCALE
586  /// If its given an invalid type, it will map to the next closest thing
587  /// and return false.
588  bool setNodeScaleInheritanceMode(
589  FBX_NodeID node, UT_ScaleInheritanceMode inherit);
590 
591  int clipCount() const;
592  FBX_ClipID clip(int i) const;
593 
594  FBX_ClipID findClip(const char* name) const;
595  const char* clipName(FBX_ClipID clip) const;
596 
597  void setActiveClip(FBX_ClipID clip);
598  FBX_ClipID activeClip() const;
599 
600  FBX_ClipID createClip(const char* name);
601 
602  /// Get/set the *inclusive* time range for the given clip in seconds
603  /// @{
604  void getClipTimeRange(
605  FBX_ClipID clip, fpreal& start, fpreal &stop) const;
606  void setClipTimeRange(
607  FBX_ClipID clip, fpreal start, fpreal stop);
608  /// @}
609 
610  // NB: Modifications to JointInfo might need changes to UT::DefaultClearer
611  // specialization at the bottom of this file.
612  struct JointInfo
613  {
614  FBX_NodeID myNode;
616  UT_StringArray mySkins; // may be empty
617  };
620  {
623  };
624 
625  /// Export geometry to FBX scene, with automatic handling of shapes
626  /// partitioned by name and/or path primitive attributes. If the nodes
627  /// already exist, then their geometry will be destroyed and recreated.
628  /// In order to export them with an identity global transform, a time is
629  /// needed to evaluate its parent node. If not specified, the time at 0
630  /// seconds will be used.
631  /// @warn Currently, everything is first converted to polygons.
632  /// @{
633  bool exportGeometry(
634  UT_Array<FBX_NodeID>& exported_nodes,
635  const UT_Matrix4D& parent_xform,
636  const GU_Detail& geo,
637  const SkinningInfo* skinning_info,
638  FBX_ErrorManager& errors);
639  bool exportGeometry(
640  UT_Array<FBX_NodeID>& exported_nodes,
641  fpreal time_seconds,
642  const UT_Matrix4D& parent_xform,
643  const GU_Detail& geo,
644  const SkinningInfo* skinning_info,
645  FBX_ErrorManager& errors);
646  /// @}
647 
648  /// Iterates over a node's user properties.
650  {
651  public:
652  PropertyIterator(FBX_NodeID node);
653  ~PropertyIterator();
654 
655  bool isValid();
656  void advance();
657 
658  const char *getName() const;
659  fpreal evalFloat(fpreal time_seconds) const;
660 
661  enum DataType
662  {
686  eDateTime
687  };
688 
689  DataType getDataType() const;
690 
691  private:
692  struct Impl;
693  UT_UniquePtr<Impl> myImpl;
694  };
695 
696 private:
697  template <typename FBX_T, typename ID_T>
698  static inline FBX_T * castID(ID_T id);
699 
700 private:
701  struct Impl;
702  UT_UniquePtr<Impl> myImpl;
703 
704  friend FBX_AnimCurveModifier;
705 };
706 
707 enum class FBX_KeyInterp
708 {
709  CONSTANT,
710  LINEAR,
711  CUBIC
712 };
713 
715 {
716 public:
717  FBX_AnimCurveModifier() = default;
718  FBX_AnimCurveModifier(FBX_AnimCurveID curve);
720 
721  void reset(FBX_AnimCurveID curve);
722  void markForDeletion();
723 
724  void clearKeys();
725  int addKey(fpreal time_seconds);
726  int getKeyCount();
727 
728  void setKeyInterpolation(int key_i, FBX_KeyInterp interp);
729  FBX_KeyInterp keyInterpolation(int key_i) const;
730 
731  void setKeyValue(int key_i, fpreal val);
732  fpreal keyValue(int key_i) const;
733 
734  FBX_AnimCurveID curve() const { return myCurve; }
735  int lastKeyIndex() const { return myLastKeyIndex; }
736 
737 private:
738  template <typename FBX_T, typename ID_T>
739  static inline FBX_T * castID(ID_T id)
740  { return FBX_SceneProxy::castID<FBX_T,ID_T>(id); }
741 
742 private:
743  FBX_AnimCurveID myCurve = FBX_AnimCurveID{};
744  int myLastKeyIndex = 0;
745  bool myDestroyCurveOnCleanup = false;
746 };
747 
749 {
750  enum class UpVector
751  {
752  XAxis,
753  YAxis,
754  ZAxis
755  };
756  enum class FrontVector
757  {
758  ParityEven,
759  ParityOdd
760  };
761  enum class CoordSystem
762  {
763  RightHanded,
764  LeftHanded
765  };
766 
770 
771  bool operator==(const FBX_AxisSystem &x) const
772  {
773  return myUpVector == x.myUpVector &&
774  myFrontVector == x.myFrontVector &&
775  myCoordSystem == x.myCoordSystem;
776  }
777  bool operator!=(const FBX_AxisSystem &x) const
778  {
779  return !(*this == x);
780  }
781 };
782 
783 namespace UT
784 {
785  template <>
786  struct DefaultClearer<FBX_SceneProxy::JointInfo>
787  {
791  static void clear(T& v) { D1::clear(v.myNode); D2::clear(v.mySkins); }
792  static bool isClear(const T& v) { return D1::isClear(v.myNode); }
793  static void clearConstruct(T* p)
794  {
795  D1::clearConstruct(&(p->myNode));
796  // p->myTransform's default ctor is uninitialized data
797  D2::clearConstruct(&(p->mySkins));
798  }
799  static const bool clearNeedsDestruction = false;
800  };
801 }
802 
803 #endif // __FBX_SCENEPROXY_H_INCLUDED__
FrontVector myFrontVector
SYS_FORCE_INLINE bool exists(FBX_NodeID node) const
CoordSystem myCoordSystem
bool contains(const Key &key) const
Definition: UT_ArrayMap.h:334
SYS_FORCE_INLINE void add(FBX_NodeID node, const UT_StringHolder &name)
const GLdouble * v
Definition: glcorearb.h:837
Transformation order of scales, rotates, and translates.
Definition: UT_XformOrder.h:23
GLuint start
Definition: glcorearb.h:475
const GLuint GLenum const void * binary
Definition: glcorearb.h:1924
GLsizei const GLchar *const * path
Definition: glcorearb.h:3341
int lastKeyIndex() const
iterator end()
Returns a non-const end iterator for the set.
Definition: UT_ArraySet.h:675
bool save(const char *path, FBX_ErrorManager &errors, bool binary=true, bool animation_only=false) const
iterator find(const Key &key)
Definition: UT_ArrayMap.h:158
GLenum GLuint GLint GLint layer
Definition: glcorearb.h:1299
std::unique_ptr< T, Deleter > UT_UniquePtr
A smart pointer for unique ownership of dynamically allocated objects.
Definition: UT_UniquePtr.h:39
bool operator!=(const FBX_AxisSystem &x) const
GA_API const UT_StringHolder scale
FBX_KeyInterp
#define FBX_API
Definition: FBX_API.h:10
GLboolean reset
Definition: glad.h:5138
PXL_API const char * getName(const ColorSpace *space)
Return the name of the color space.
GLuint GLuint end
Definition: glcorearb.h:475
#define SYS_FORCE_INLINE
Definition: SYS_Inline.h:45
UpVector myUpVector
SYS_FORCE_INLINE bool exists(const UT_StringRef &name) const
GLenum target
Definition: glcorearb.h:1667
GLuint id
Definition: glcorearb.h:655
bool load(const char *path, bool convert_units, FBX_ErrorManager &errors)
GLuint const GLchar * name
Definition: glcorearb.h:786
GA_API const UT_StringHolder transform
GLint GLenum GLint x
Definition: glcorearb.h:409
A map of string to various well defined value types.
Definition: UT_Options.h:84
fpreal64 fpreal
Definition: SYS_Types.h:277
bool operator==(const FBX_AxisSystem &x) const
GLuint GLfloat * val
Definition: glcorearb.h:1608
Definition: core.h:1131
OP_OrientationMode
Definition: OP_Director.h:61
FBX_AnimCurveID curve() const
Iterates over a node's user properties.
UT_ScaleInheritanceMode
Scale inheritance modes.
SYS_FORCE_INLINE UT_StringRef getName(FBX_NodeID node, const UT_StringRef &fallback) const
SYS_FORCE_INLINE FBX_NodeID getNode(const UT_StringRef &name, FBX_NodeID fallback) const
IMATH_INTERNAL_NAMESPACE_HEADER_ENTER IMATH_HOSTDEVICE IMATH_CONSTEXPR14 T clip(const T &p, const Box< T > &box) IMATH_NOEXCEPT
Definition: ImathBoxAlgo.h:29
FBX_SCENEPROXY_DECLARE_ID(FBX_NodeID)