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  /// Strip the namespace from the given node name.
232  /// Returns true if any removal was done, false if no change was needed.
233  static bool stripNamespace(
234  const UT_StringHolder& orig_name,
235  UT_StringHolder& trunc_name);
236 
237  static constexpr UT_StringLit FBX_ENUM_LIST_SUFFIX = ".list";
238  static constexpr UT_StringLit FBX_ENUM_INDEX_SUFFIX = ".index";
239 
240  // Import custom properties associated with the node
241  // as a dictionary of attributes
242  void importCustomProperties(
243  const FBX_NodeID node,
244  UT_Options& attrib_map,
245  bool is_animated = false,
246  const fpreal time_seconds = 0) const;
247 
248  // Creates an fbx property for single value custom attributes
249  // (e.g. bool, int, float, string). Returns a FBX_AnimCurveID
250  // for animated properties.
251  FBX_AnimCurveID outputCustomProperties(
252  const FBX_NodeID node,
253  FBX_AnimLayerID layer,
254  const char* name,
255  const UT_OptionEntry* attr,
256  bool is_animated = false);
257 
258  FBX_AnimCurveID outputCustomEnumProperties(
259  const FBX_NodeID node,
260  FBX_AnimLayerID layer,
261  const char* name,
262  UT_StringArray& enum_list,
263  int idx);
264 
265  // Creates an fbx property for compound custom attributes
266  // (e.g. vector3, vector4, matrix4x4). Returns a
267  // FBX_AnimCurveNodeID with the required channels properties.
268  FBX_AnimCurveNodeID outputCustomCompoundProperties(
269  const FBX_NodeID node,
270  FBX_AnimLayerID layer,
271  const char* name,
272  const UT_OptionEntry* attr);
273 
274  // Creates an animation curve with the given name and connects
275  // it to the animation curve node at the provided channel.
276  FBX_AnimCurveID createCurveOnNode(
277  FBX_AnimCurveNodeID curve_node,
278  const char* name,
279  int channel);
280 
281  // Get the total number of property channels defined in the
282  // given animation curve node.
283  int getChannelsCount(FBX_AnimCurveNodeID curve_node);
284 
285  /// Find first node in scene that has given name
286  FBX_NodeID findNode(const char* name) const;
287 
288  /// Return "path" from scene root of node. If node == nullptr, returns
289  /// empty string.
290  UT_StringHolder nodePath(FBX_NodeID node) const;
291 
292  /// Find node in scene by hierarchical path from the scene root.
293  /// If path does not begin with a '/' then it returns findNode(path).
294  FBX_NodeID findNodeByPath(const char* path) const;
295 
296  /// Return map of all nodes (except for the scene root) with unique names
297  void getUniqueNodeNames(
298  FBX_NodeNameMap& name_map,
299  bool remove_namespace,
300  FBX_ErrorManager& errors);
301 
302  int nodeCount() const;
303  FBX_NodeID node(int i) const;
304 
305  FBX_NodeID rootNode() const;
306  FBX_NodeID parentNode(FBX_NodeID node) const;
307  int childNodeCount(FBX_NodeID node) const;
308  FBX_NodeID childNode(FBX_NodeID node, int i) const;
309 
310  enum NodeType
311  {
312  eUnknown, // Unknown
313  eNull, // Null object
314  eMarker, // Mocap marker OR IK/FK effector
315  eSkeleton, // Bone/Joint
316  eMesh, // Geometry
317  eNurbs, // Geometry
318  ePatch, // Geometry
319  eCamera, // Camera
320  eCameraStereo, // Stereo camera
321  eCameraSwitcher, // Switch between child cameras
322  eLight, // Light
323  eOpticalReference, // Mocap marker
324  eOpticalMarker, // Mocap marker OR IK/FK effector
325  eNurbsCurve, // Geometry
326  eTrimNurbsSurface, // Geometry
327  eBoundary, // Geometry
328  eNurbsSurface, // Geometry
329  eShape, // Blendshape
330  eLODGroup, // Group of objects with different levels of detail
331  eSubDiv, // Geometry
332  eCachedEffect, // Particles, fluids, hair, etc. cache
333  eLine // Geometry
334  };
335  NodeType nodeType(FBX_NodeID node) const;
336 
337  UT_StringHolder nodeTypeAttributeName(NodeType type) const;
338 
339  /// Add new FbxNode with new FbxSkeleton attribute as a joint
340  FBX_NodeID createJointNode(
341  const char* name,
342  bool is_root,
343  fpreal display_scale);
344 
345  /// Add new LODGroup FbxNode
346  FBX_NodeID createLODGroupNode(const char* name);
347 
348  /// Add new Null FbxNode
349  FBX_NodeID createNullNode(const char* name);
350 
351  /// Matches ROP_FBXUtil::isLODGroupNullNodeName(node_name)
352  static bool isLODGroupNullNodeName(const char *node_name);
353 
354  /// Add child to parent. If child already has a parent, first it is removed
355  /// from current parent and then added to this one.
356  void nodeAddChild(FBX_NodeID parent, FBX_NodeID child);
357 
358  bool visibility(FBX_NodeID node) const;
359 
360  FBX_GeometryID geometry(FBX_NodeID node) const;
361  FBX_NodeID geometryNode(FBX_GeometryID geometry) const;
362  int geometrySkinDeformerCount(FBX_GeometryID geometry) const;
363 
364  /// Count of skin deformers in the file
365  int skinDeformerCount() const;
366 
367  /// Get geometry associated with skin deformer i
368  /// @note There might no geometry attached and this will return nullptr
369  FBX_GeometryID skinDeformerGeometry(int i) const;
370 
371  FBX_MeshID geometryMesh(FBX_NodeID node) const;
372 
373  // Compute smoothing group information from mesh normals
374  bool computeSmoothingGroupInfo(FBX_MeshID mesh) const;
375 
376  /// Convert geometry into GU_Detail, with skin deformers converted into
377  /// a boneCapture attribute. If world_xform is given, the result including
378  /// the transforms within boneCapture will have this baked into it.
379  /// When add_unused_joints is true, add ancestor joints for any captured
380  /// joints will also be added to the boneCapture attribute with identity
381  /// transforsm. When name_map is given, node names for boneCapture will
382  /// use the ones given by name_map.
383  /// @{
384  bool convertGeometry(
385  GU_Detail& detail,
386  FBX_GeometryID geometry,
387  FBX_ErrorManager& errors,
388  bool add_unused_joints,
389  const UT_Matrix4D* world_xform = nullptr) const;
390 
391  bool convertGeometry(
392  GU_Detail& detail,
393  FBX_GeometryID geometry,
394  FBX_ErrorManager& errors,
395  bool add_unused_joints,
396  const UT_Matrix4D* world_xform,
397  const FBX_NodeNameMap* name_map) const;
398  /// @}
399 
400  enum class SkinningType
401  {
402  eRigid,
403  eLinear,
404  eDualQuaternion,
405  eBlend
406  };
407  /// Returns the skinning type for the i'th skin deformer in the geometry.
408  SkinningType geometrySkinDeformerType(FBX_GeometryID geometry, int i) const;
409 
410  /// Returns the number of blend shape deformers for the geometry.
411  int blendshapeCount(FBX_GeometryID geometry) const;
412  /// Returns the number of channels for the i'th blend shape deformer.
413  int blendshapeChannelCount(
414  FBX_GeometryID geometry, int blendshape_idx) const;
415  /// Returns the name of the specified blendshape channel.
416  UT_StringHolder blendshapeChannelName(FBX_GeometryID geometry,
417  int blendshape_idx, int channel_idx) const;
418 
419  /// Like convertGeometry() except its specialized to only do it when the
420  /// conditions are necessary for importing blendshape channel targets.
421  /// Only returns false if a conversion was attempted and failed.
422  bool convertBlendShapeBaseGeometry(
423  GU_DetailHandle& detail,
424  FBX_GeometryID geometry,
425  FBX_ErrorManager& errors) const;
426 
427  /// Returns the geometry, name, and weight (multiplied by 0.01) for each of
428  /// the channel's target shapes. Multiple targets imply that there are
429  /// in-between shapes, and the shapes are sorted by weight in ascending
430  /// order.
431  /// @{
432  /// @note This variant is slower it needs to call
433  /// convertBlendShapeBaseGeometry() every time.
434  void blendShapeChannelTargets(
435  FBX_GeometryID geometry,
436  int blendshape_idx,
437  int channel_idx,
438  UT_Array<GU_DetailHandle>& details,
439  UT_StringArray& names,
440  UT_Array<fpreal>& weights,
441  const UT_Matrix4D* world_xform = nullptr) const;
442 
443  /// @param base_shape Prepared detail handle by calling
444  /// convertBlendShapeBaseGeometry()
445  void blendShapeChannelTargets(
446  FBX_GeometryID geometry,
447  int blendshape_idx,
448  int channel_idx,
449  const GU_DetailHandle& base_shape,
450  UT_Array<GU_DetailHandle>& details,
451  UT_StringArray& names,
452  UT_Array<fpreal>& weights,
453  const UT_Matrix4D* world_xform = nullptr) const;
454  /// @}
455 
456  /// Returns curve for the blend shape channel's values.
457  /// @note Result might be null for non-animated blendshapes.
458  /// @{
459  FBX_AnimCurveID blendshapeChannelCurve(
460  FBX_GeometryID geometry,
461  int blendshape_idx,
462  int channel_idx) const;
463  FBX_AnimCurveID blendshapeChannelCurve(
464  FBX_GeometryID geometry,
465  int blendshape_idx,
466  int channel_idx,
467  bool create_if_needed);
468  /// @}
469 
470  /// Evaluate an animation curve at the given time
471  fpreal animCurveEval(
472  FBX_AnimCurveID curve, fpreal time_seconds) const;
473 
474  /// Number of keys in anim curve
475  int animCurveKeyCount(FBX_AnimCurveID curve) const;
476 
477  /// Get the time range of the anim curve
478  void getAnimCurveTimeInterval(
479  FBX_AnimCurveID curve,
480  fpreal &start, fpreal &end) const;
481 
482  /// Local translation property of node
483  FBX_Property3D nodeLocalTranslate(FBX_NodeID node) const;
484 
485  /// Local rotation property of node
486  FBX_Property3D nodeLocalRotate(FBX_NodeID node) const;
487 
488  /// Local scale property of node
489  FBX_Property3D nodeLocalScale(FBX_NodeID node) const;
490 
491  /// Local pre-rotation property of node. Should only be used when
492  /// nodeIsRotationActive() is true.
493  FBX_Property3D nodeLocalPreRotation(FBX_NodeID node) const;
494 
495  /// When nodeIsRotationActive() is false, then these node properties are
496  /// ignored from the FBX file:
497  /// rotation order, pivots, pre/post rotation values, rotation limits
498  bool nodeIsRotationActive(FBX_NodeID node) const;
499 
500  /// Return the transform order for given node. For FBX, we always return a
501  /// transform order of SRT, so really only the rotation order is pertinent
502  /// here.
503  /// @note Returns a default value when !nodeIsRotationActive()
504  UT_XformOrder nodeTransformOrder(FBX_NodeID node) const;
505 
506  /// Return the rotation pivot for given node.
507  /// @note Returns a default value when !nodeIsRotationActive()
508  UT_Vector3D nodeRotationPivot(FBX_NodeID node) const;
509 
510  int animLayerCount(FBX_ClipID clip) const;
511  FBX_AnimLayerID animLayer(FBX_ClipID clip, int i) const;
512 
513  /// Create a new animation layer. If given clip, the layer is added to it.
514  FBX_AnimLayerID createAnimLayer(const char* name,
515  FBX_ClipID clip = FBX_ClipID{});
516 
517  /// Destroy give animation layer. If recurse_unused is true, then
518  /// recursively destroy all unused dst objects as a result.
519  void destroyAnimLayer(FBX_AnimLayerID layer,
520  bool recurse_unused = false);
521 
522  /// Add/remove a layer to clip as a src object
523  /// @{
524  void addAnimLayer(FBX_ClipID clip, FBX_AnimLayerID layer);
525  void removeAnimLayer(FBX_ClipID clip, FBX_AnimLayerID layer);
526  /// @}
527 
528  /// Return src object count of layer
529  int animLayerSrcCount(FBX_AnimLayerID layer) const;
530 
531  /// Return animation curve attached to property
532  FBX_AnimCurveID propertyAnimCurve(
533  FBX_PropertyID property,
534  FBX_AnimLayerID layer,
535  int component,
536  bool create = false);
537 
538  /// Evaluate animated value from property
539  /// @{
540  fpreal propertyEvalFloat(
541  FBX_PropertyID property,
542  fpreal time_seconds);
543  UT_Vector3R propertyEvalVector(
544  FBX_Property3D property,
545  fpreal time_seconds);
546  /// @}
547 
548  /// Set non-animated value on property
549  /// @{
550  void propertySetFloat(
551  FBX_PropertyID property,
552  fpreal value);
553  void propertySetVector(
554  FBX_PropertyID property,
555  const UT_Vector3R& vector);
556  /// @}
557 
558  /// Scene scale to convert from internal FBX scene. Determined by load()
559  /// This is currently only used by nodeGlobalTransform()
560  double sceneScale() const;
561 
562  /// Set the scene scale
563  void setSceneScale(fpreal scale);
564 
565  /// Return a node's global transform, scaled by sceneScale()
566  UT_Matrix4D nodeGlobalTransform(
567  FBX_NodeID node, fpreal time_seconds) const;
568 
569  /// Get a node's local transform at given time.
570  /// @note This transform is NOT scaled by sceneScale()
571  UT_Matrix4D nodeLocalTransform(
572  FBX_NodeID node, fpreal time_seconds) const;
573 
574  /// Return global transform without animation, scaled by sceneScale()
575  UT_Matrix4D nodeGlobalRestTransform(FBX_NodeID node) const;
576 
577  /// Access node's local transform without animation
578  /// @note This transform is NOT scaled by sceneScale()
579  /// @{
580  UT_Matrix4D nodeLocalRestTransform(FBX_NodeID node) const;
581 
582  /// Set a node's local transform without anim
583  void setNodeLocalRestTransform(
584  FBX_NodeID node,
585  const UT_Matrix4D& local);
586  /// @}
587 
588  /// Get a node's geometric transform. Returns false if there is none.
589  /// A geometric transform is a transform that is only applied to the node's
590  /// geometry and is not part of its global transform.
591  /// @note This transform is NOT scaled by sceneScale()
592  bool nodeGeometricTransform(
593  FBX_NodeID node, UT_Matrix4D& transform) const;
594 
595  /// Remove all animation on the transform properties of given node
596  void removeNodeAnimation(FBX_NodeID node);
597 
598  /// Compute a scene scale needed convert transforms from
599  /// nodeGlobalTransform() to the Houdini unit length.
600  /// This will be 1.0 if the file was loaded with convert_units=true.
601  double computeConversionFactor() const;
602 
604  nodeScaleInheritanceMode(FBX_NodeID node) const;
605 
606  /// Set the scale inheritance mode for a node. Note that FBX does NOT
607  /// support everything, and only these modes:
608  /// DEFAULT, OFFSET_ONLY, and OFFSET_AND_SCALE
609  /// If its given an invalid type, it will map to the next closest thing
610  /// and return false.
611  bool setNodeScaleInheritanceMode(
612  FBX_NodeID node, UT_ScaleInheritanceMode inherit);
613 
614  int clipCount() const;
615  FBX_ClipID clip(int i) const;
616 
617  FBX_ClipID findClip(const char* name) const;
618  const char* clipName(FBX_ClipID clip) const;
619 
620  void setActiveClip(FBX_ClipID clip);
621  FBX_ClipID activeClip() const;
622 
623  FBX_ClipID createClip(const char* name);
624 
625  /// Get/set the *inclusive* time range for the given clip in seconds
626  /// @{
627  void getClipTimeRange(
628  FBX_ClipID clip, fpreal& start, fpreal &stop) const;
629  void setClipTimeRange(
630  FBX_ClipID clip, fpreal start, fpreal stop);
631  /// @}
632 
633  // NB: Modifications to JointInfo might need changes to UT::DefaultClearer
634  // specialization at the bottom of this file.
635  struct JointInfo
636  {
637  FBX_NodeID myNode;
639  UT_StringArray mySkins; // may be empty
640  };
643  {
646  };
647 
648  /// Export geometry to FBX scene, with automatic handling of shapes
649  /// partitioned by name and/or path primitive attributes. If the nodes
650  /// already exist, then their geometry will be destroyed and recreated.
651  /// In order to export them with an identity global transform, a time is
652  /// needed to evaluate its parent node. If not specified, the time at 0
653  /// seconds will be used.
654  /// @warn Currently, everything is first converted to polygons.
655  /// @{
656  bool exportGeometry(
657  UT_Array<FBX_NodeID>& exported_nodes,
658  const UT_Matrix4D& parent_xform,
659  const GU_Detail& geo,
660  const SkinningInfo* skinning_info,
661  FBX_ErrorManager& errors);
662  bool exportGeometry(
663  UT_Array<FBX_NodeID>& exported_nodes,
664  fpreal time_seconds,
665  const UT_Matrix4D& parent_xform,
666  const GU_Detail& geo,
667  const SkinningInfo* skinning_info,
668  FBX_ErrorManager& errors);
669  /// @}
670 
671  /// Iterates over a node's user properties.
673  {
674  public:
675  PropertyIterator(FBX_NodeID node);
676  ~PropertyIterator();
677 
678  bool isValid();
679  void advance();
680 
681  const char *getName() const;
682  fpreal evalFloat(fpreal time_seconds) const;
683 
684  enum DataType
685  {
709  eDateTime
710  };
711 
712  DataType getDataType() const;
713 
714  private:
715  struct Impl;
716  UT_UniquePtr<Impl> myImpl;
717  };
718 
719 private:
720  template <typename FBX_T, typename ID_T>
721  static inline FBX_T * castID(ID_T id);
722 
723 private:
724  struct Impl;
725  UT_UniquePtr<Impl> myImpl;
726 
727  friend FBX_AnimCurveModifier;
728 };
729 
730 enum class FBX_KeyInterp
731 {
732  CONSTANT,
733  LINEAR,
734  CUBIC
735 };
736 
738 {
739 public:
740  FBX_AnimCurveModifier() = default;
741  FBX_AnimCurveModifier(FBX_AnimCurveID curve);
743 
744  void reset(FBX_AnimCurveID curve);
745  void markForDeletion();
746 
747  void clearKeys();
748  int addKey(fpreal time_seconds);
749  int getKeyCount();
750 
751  void setKeyInterpolation(int key_i, FBX_KeyInterp interp);
752  FBX_KeyInterp keyInterpolation(int key_i) const;
753 
754  void setKeyValue(int key_i, fpreal val);
755  fpreal keyValue(int key_i) const;
756 
757  FBX_AnimCurveID curve() const { return myCurve; }
758  int lastKeyIndex() const { return myLastKeyIndex; }
759 
760 private:
761  template <typename FBX_T, typename ID_T>
762  static inline FBX_T * castID(ID_T id)
763  { return FBX_SceneProxy::castID<FBX_T,ID_T>(id); }
764 
765 private:
766  FBX_AnimCurveID myCurve = FBX_AnimCurveID{};
767  int myLastKeyIndex = 0;
768  bool myDestroyCurveOnCleanup = false;
769 };
770 
772 {
773  enum class UpVector
774  {
775  XAxis,
776  YAxis,
777  ZAxis
778  };
779  enum class FrontVector
780  {
781  ParityEven,
782  ParityOdd
783  };
784  enum class CoordSystem
785  {
786  RightHanded,
787  LeftHanded
788  };
789 
793 
794  bool operator==(const FBX_AxisSystem &x) const
795  {
796  return myUpVector == x.myUpVector &&
797  myFrontVector == x.myFrontVector &&
798  myCoordSystem == x.myCoordSystem;
799  }
800  bool operator!=(const FBX_AxisSystem &x) const
801  {
802  return !(*this == x);
803  }
804 };
805 
806 namespace UT
807 {
808  template <>
809  struct DefaultClearer<FBX_SceneProxy::JointInfo>
810  {
814  static void clear(T& v) { D1::clear(v.myNode); D2::clear(v.mySkins); }
815  static bool isClear(const T& v) { return D1::isClear(v.myNode); }
816  static void clearConstruct(T* p)
817  {
818  D1::clearConstruct(&(p->myNode));
819  // p->myTransform's default ctor is uninitialized data
820  D2::clearConstruct(&(p->mySkins));
821  }
822  static const bool clearNeedsDestruction = false;
823  };
824 }
825 
826 #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:347
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
GLsizei const GLfloat * value
Definition: glcorearb.h:824
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:736
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
GLint GLint GLsizei GLint GLenum GLenum type
Definition: glcorearb.h:108
#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:278
bool operator==(const FBX_AxisSystem &x) const
GLuint GLfloat * val
Definition: glcorearb.h:1608
OP_OrientationMode
Definition: OP_Director.h:65
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)