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(
330  const char* name,
331  bool is_root,
332  fpreal display_scale);
333 
334  /// Add new LODGroup FbxNode
335  FBX_NodeID createLODGroupNode(const char* name);
336 
337  /// Add new Null FbxNode
338  FBX_NodeID createNullNode(const char* name);
339 
340  /// Matches ROP_FBXUtil::isLODGroupNullNodeName(node_name)
341  static bool isLODGroupNullNodeName(const char *node_name);
342 
343  /// Add child to parent. If child already has a parent, first it is removed
344  /// from current parent and then added to this one.
345  void nodeAddChild(FBX_NodeID parent, FBX_NodeID child);
346 
347  bool visibility(FBX_NodeID node) const;
348 
349  FBX_GeometryID geometry(FBX_NodeID node) const;
350  FBX_NodeID geometryNode(FBX_GeometryID geometry) const;
351  int geometrySkinDeformerCount(FBX_GeometryID geometry) const;
352 
353  /// Count of skin deformers in the file
354  int skinDeformerCount() const;
355 
356  /// Get geometry associated with skin deformer i
357  /// @note There might no geometry attached and this will return nullptr
358  FBX_GeometryID skinDeformerGeometry(int i) const;
359 
360  FBX_MeshID geometryMesh(FBX_NodeID node) const;
361 
362  // Compute smoothing group information from mesh normals
363  bool computeSmoothingGroupInfo(FBX_MeshID mesh) const;
364 
365  /// Convert geometry into GU_Detail, with skin deformers converted into
366  /// a boneCapture attribute. If world_xform is given, the result including
367  /// the transforms within boneCapture will have this baked into it.
368  /// When add_unused_joints is true, add ancestor joints for any captured
369  /// joints will also be added to the boneCapture attribute with identity
370  /// transforsm. When name_map is given, node names for boneCapture will
371  /// use the ones given by name_map.
372  /// @{
373  bool convertGeometry(
374  GU_Detail& detail,
375  FBX_GeometryID geometry,
376  FBX_ErrorManager& errors,
377  bool add_unused_joints,
378  const UT_Matrix4D* world_xform = nullptr) const;
379 
380  bool convertGeometry(
381  GU_Detail& detail,
382  FBX_GeometryID geometry,
383  FBX_ErrorManager& errors,
384  bool add_unused_joints,
385  const UT_Matrix4D* world_xform,
386  const FBX_NodeNameMap* name_map) const;
387  /// @}
388 
389  enum class SkinningType
390  {
391  eRigid,
392  eLinear,
393  eDualQuaternion,
394  eBlend
395  };
396  /// Returns the skinning type for the i'th skin deformer in the geometry.
397  SkinningType geometrySkinDeformerType(FBX_GeometryID geometry, int i) const;
398 
399  /// Returns the number of blend shape deformers for the geometry.
400  int blendshapeCount(FBX_GeometryID geometry) const;
401  /// Returns the number of channels for the i'th blend shape deformer.
402  int blendshapeChannelCount(
403  FBX_GeometryID geometry, int blendshape_idx) const;
404  /// Returns the name of the specified blendshape channel.
405  UT_StringHolder blendshapeChannelName(FBX_GeometryID geometry,
406  int blendshape_idx, int channel_idx) const;
407 
408  /// Like convertGeometry() except its specialized to only do it when the
409  /// conditions are necessary for importing blendshape channel targets.
410  /// Only returns false if a conversion was attempted and failed.
411  bool convertBlendShapeBaseGeometry(
412  GU_DetailHandle& detail,
413  FBX_GeometryID geometry,
414  FBX_ErrorManager& errors) const;
415 
416  /// Returns the geometry, name, and weight (multiplied by 0.01) for each of
417  /// the channel's target shapes. Multiple targets imply that there are
418  /// in-between shapes, and the shapes are sorted by weight in ascending
419  /// order.
420  /// @{
421  /// @note This variant is slower it needs to call
422  /// convertBlendShapeBaseGeometry() every time.
423  void blendShapeChannelTargets(
424  FBX_GeometryID geometry,
425  int blendshape_idx,
426  int channel_idx,
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  /// @param base_shape Prepared detail handle by calling
433  /// convertBlendShapeBaseGeometry()
434  void blendShapeChannelTargets(
435  FBX_GeometryID geometry,
436  int blendshape_idx,
437  int channel_idx,
438  const GU_DetailHandle& base_shape,
439  UT_Array<GU_DetailHandle>& details,
440  UT_StringArray& names,
441  UT_Array<fpreal>& weights,
442  const UT_Matrix4D* world_xform = nullptr) const;
443  /// @}
444 
445  /// Returns curve for the blend shape channel's values.
446  /// @note Result might be null for non-animated blendshapes.
447  /// @{
448  FBX_AnimCurveID blendshapeChannelCurve(
449  FBX_GeometryID geometry,
450  int blendshape_idx,
451  int channel_idx) const;
452  FBX_AnimCurveID blendshapeChannelCurve(
453  FBX_GeometryID geometry,
454  int blendshape_idx,
455  int channel_idx,
456  bool create_if_needed);
457  /// @}
458 
459  /// Evaluate an animation curve at the given time
460  fpreal animCurveEval(
461  FBX_AnimCurveID curve, fpreal time_seconds) const;
462 
463  /// Number of keys in anim curve
464  int animCurveKeyCount(FBX_AnimCurveID curve) const;
465 
466  /// Get the time range of the anim curve
467  void getAnimCurveTimeInterval(
468  FBX_AnimCurveID curve,
469  fpreal &start, fpreal &end) const;
470 
471  /// Local translation property of node
472  FBX_Property3D nodeLocalTranslate(FBX_NodeID node) const;
473 
474  /// Local rotation property of node
475  FBX_Property3D nodeLocalRotate(FBX_NodeID node) const;
476 
477  /// Local scale property of node
478  FBX_Property3D nodeLocalScale(FBX_NodeID node) const;
479 
480  /// Local pre-rotation property of node. Should only be used when
481  /// nodeIsRotationActive() is true.
482  FBX_Property3D nodeLocalPreRotation(FBX_NodeID node) const;
483 
484  /// When nodeIsRotationActive() is false, then these node properties are
485  /// ignored from the FBX file:
486  /// rotation order, pivots, pre/post rotation values, rotation limits
487  bool nodeIsRotationActive(FBX_NodeID node) const;
488 
489  /// Return the transform order for given node. For FBX, we always return a
490  /// transform order of SRT, so really only the rotation order is pertinent
491  /// here.
492  /// @note Returns a default value when !nodeIsRotationActive()
493  UT_XformOrder nodeTransformOrder(FBX_NodeID node) const;
494 
495  /// Return the rotation pivot for given node.
496  /// @note Returns a default value when !nodeIsRotationActive()
497  UT_Vector3D nodeRotationPivot(FBX_NodeID node) const;
498 
499  int animLayerCount(FBX_ClipID clip) const;
500  FBX_AnimLayerID animLayer(FBX_ClipID clip, int i) const;
501 
502  /// Create a new animation layer. If given clip, the layer is added to it.
503  FBX_AnimLayerID createAnimLayer(const char* name,
504  FBX_ClipID clip = FBX_ClipID{});
505 
506  /// Destroy give animation layer. If recurse_unused is true, then
507  /// recursively destroy all unused dst objects as a result.
508  void destroyAnimLayer(FBX_AnimLayerID layer,
509  bool recurse_unused = false);
510 
511  /// Add/remove a layer to clip as a src object
512  /// @{
513  void addAnimLayer(FBX_ClipID clip, FBX_AnimLayerID layer);
514  void removeAnimLayer(FBX_ClipID clip, FBX_AnimLayerID layer);
515  /// @}
516 
517  /// Return src object count of layer
518  int animLayerSrcCount(FBX_AnimLayerID layer) const;
519 
520  /// Return animation curve attached to property
521  FBX_AnimCurveID propertyAnimCurve(
522  FBX_PropertyID property,
523  FBX_AnimLayerID layer,
524  int component,
525  bool create = false);
526 
527  /// Evaluate animated value from property
528  /// @{
529  fpreal propertyEvalFloat(
530  FBX_PropertyID property,
531  fpreal time_seconds);
532  UT_Vector3R propertyEvalVector(
533  FBX_Property3D property,
534  fpreal time_seconds);
535  /// @}
536 
537  /// Set non-animated value on property
538  /// @{
539  void propertySetFloat(
540  FBX_PropertyID property,
541  fpreal value);
542  void propertySetVector(
543  FBX_PropertyID property,
544  const UT_Vector3R& vector);
545  /// @}
546 
547  /// Scene scale to convert from internal FBX scene. Determined by load()
548  /// This is currently only used by nodeGlobalTransform()
549  double sceneScale() const;
550 
551  /// Set the scene scale
552  void setSceneScale(fpreal scale);
553 
554  /// Return a node's global transform, scaled by sceneScale()
555  UT_Matrix4D nodeGlobalTransform(
556  FBX_NodeID node, fpreal time_seconds) const;
557 
558  /// Get a node's local transform at given time.
559  /// @note This transform is NOT scaled by sceneScale()
560  UT_Matrix4D nodeLocalTransform(
561  FBX_NodeID node, fpreal time_seconds) const;
562 
563  /// Return global transform without animation, scaled by sceneScale()
564  UT_Matrix4D nodeGlobalRestTransform(FBX_NodeID node) const;
565 
566  /// Access node's local transform without animation
567  /// @note This transform is NOT scaled by sceneScale()
568  /// @{
569  UT_Matrix4D nodeLocalRestTransform(FBX_NodeID node) const;
570 
571  /// Set a node's local transform without anim
572  void setNodeLocalRestTransform(
573  FBX_NodeID node,
574  const UT_Matrix4D& local);
575  /// @}
576 
577  /// Get a node's geometric transform. Returns false if there is none.
578  /// A geometric transform is a transform that is only applied to the node's
579  /// geometry and is not part of its global transform.
580  /// @note This transform is NOT scaled by sceneScale()
581  bool nodeGeometricTransform(
582  FBX_NodeID node, UT_Matrix4D& transform) const;
583 
584  /// Remove all animation on the transform properties of given node
585  void removeNodeAnimation(FBX_NodeID node);
586 
587  /// Compute a scene scale needed convert transforms from
588  /// nodeGlobalTransform() to the Houdini unit length.
589  /// This will be 1.0 if the file was loaded with convert_units=true.
590  double computeConversionFactor() const;
591 
593  nodeScaleInheritanceMode(FBX_NodeID node) const;
594 
595  /// Set the scale inheritance mode for a node. Note that FBX does NOT
596  /// support everything, and only these modes:
597  /// DEFAULT, OFFSET_ONLY, and OFFSET_AND_SCALE
598  /// If its given an invalid type, it will map to the next closest thing
599  /// and return false.
600  bool setNodeScaleInheritanceMode(
601  FBX_NodeID node, UT_ScaleInheritanceMode inherit);
602 
603  int clipCount() const;
604  FBX_ClipID clip(int i) const;
605 
606  FBX_ClipID findClip(const char* name) const;
607  const char* clipName(FBX_ClipID clip) const;
608 
609  void setActiveClip(FBX_ClipID clip);
610  FBX_ClipID activeClip() const;
611 
612  FBX_ClipID createClip(const char* name);
613 
614  /// Get/set the *inclusive* time range for the given clip in seconds
615  /// @{
616  void getClipTimeRange(
617  FBX_ClipID clip, fpreal& start, fpreal &stop) const;
618  void setClipTimeRange(
619  FBX_ClipID clip, fpreal start, fpreal stop);
620  /// @}
621 
622  // NB: Modifications to JointInfo might need changes to UT::DefaultClearer
623  // specialization at the bottom of this file.
624  struct JointInfo
625  {
626  FBX_NodeID myNode;
628  UT_StringArray mySkins; // may be empty
629  };
632  {
635  };
636 
637  /// Export geometry to FBX scene, with automatic handling of shapes
638  /// partitioned by name and/or path primitive attributes. If the nodes
639  /// already exist, then their geometry will be destroyed and recreated.
640  /// In order to export them with an identity global transform, a time is
641  /// needed to evaluate its parent node. If not specified, the time at 0
642  /// seconds will be used.
643  /// @warn Currently, everything is first converted to polygons.
644  /// @{
645  bool exportGeometry(
646  UT_Array<FBX_NodeID>& exported_nodes,
647  const UT_Matrix4D& parent_xform,
648  const GU_Detail& geo,
649  const SkinningInfo* skinning_info,
650  FBX_ErrorManager& errors);
651  bool exportGeometry(
652  UT_Array<FBX_NodeID>& exported_nodes,
653  fpreal time_seconds,
654  const UT_Matrix4D& parent_xform,
655  const GU_Detail& geo,
656  const SkinningInfo* skinning_info,
657  FBX_ErrorManager& errors);
658  /// @}
659 
660  /// Iterates over a node's user properties.
662  {
663  public:
664  PropertyIterator(FBX_NodeID node);
665  ~PropertyIterator();
666 
667  bool isValid();
668  void advance();
669 
670  const char *getName() const;
671  fpreal evalFloat(fpreal time_seconds) const;
672 
673  enum DataType
674  {
698  eDateTime
699  };
700 
701  DataType getDataType() const;
702 
703  private:
704  struct Impl;
705  UT_UniquePtr<Impl> myImpl;
706  };
707 
708 private:
709  template <typename FBX_T, typename ID_T>
710  static inline FBX_T * castID(ID_T id);
711 
712 private:
713  struct Impl;
714  UT_UniquePtr<Impl> myImpl;
715 
716  friend FBX_AnimCurveModifier;
717 };
718 
719 enum class FBX_KeyInterp
720 {
721  CONSTANT,
722  LINEAR,
723  CUBIC
724 };
725 
727 {
728 public:
729  FBX_AnimCurveModifier() = default;
730  FBX_AnimCurveModifier(FBX_AnimCurveID curve);
732 
733  void reset(FBX_AnimCurveID curve);
734  void markForDeletion();
735 
736  void clearKeys();
737  int addKey(fpreal time_seconds);
738  int getKeyCount();
739 
740  void setKeyInterpolation(int key_i, FBX_KeyInterp interp);
741  FBX_KeyInterp keyInterpolation(int key_i) const;
742 
743  void setKeyValue(int key_i, fpreal val);
744  fpreal keyValue(int key_i) const;
745 
746  FBX_AnimCurveID curve() const { return myCurve; }
747  int lastKeyIndex() const { return myLastKeyIndex; }
748 
749 private:
750  template <typename FBX_T, typename ID_T>
751  static inline FBX_T * castID(ID_T id)
752  { return FBX_SceneProxy::castID<FBX_T,ID_T>(id); }
753 
754 private:
755  FBX_AnimCurveID myCurve = FBX_AnimCurveID{};
756  int myLastKeyIndex = 0;
757  bool myDestroyCurveOnCleanup = false;
758 };
759 
761 {
762  enum class UpVector
763  {
764  XAxis,
765  YAxis,
766  ZAxis
767  };
768  enum class FrontVector
769  {
770  ParityEven,
771  ParityOdd
772  };
773  enum class CoordSystem
774  {
775  RightHanded,
776  LeftHanded
777  };
778 
782 
783  bool operator==(const FBX_AxisSystem &x) const
784  {
785  return myUpVector == x.myUpVector &&
786  myFrontVector == x.myFrontVector &&
787  myCoordSystem == x.myCoordSystem;
788  }
789  bool operator!=(const FBX_AxisSystem &x) const
790  {
791  return !(*this == x);
792  }
793 };
794 
795 namespace UT
796 {
797  template <>
798  struct DefaultClearer<FBX_SceneProxy::JointInfo>
799  {
803  static void clear(T& v) { D1::clear(v.myNode); D2::clear(v.mySkins); }
804  static bool isClear(const T& v) { return D1::isClear(v.myNode); }
805  static void clearConstruct(T* p)
806  {
807  D1::clearConstruct(&(p->myNode));
808  // p->myTransform's default ctor is uninitialized data
809  D2::clearConstruct(&(p->mySkins));
810  }
811  static const bool clearNeedsDestruction = false;
812  };
813 }
814 
815 #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:676
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)