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