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