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