FBX C++ API Reference
fbxbindingoperator.h
Go to the documentation of this file.
1 /****************************************************************************************
2 
3  Copyright (C) 2015 Autodesk, Inc.
4  All rights reserved.
5 
6  Use of this software is subject to the terms of the Autodesk license agreement
7  provided at the time of installation or download, or which otherwise accompanies
8  this software in either electronic or hard copy form.
9 
10 ****************************************************************************************/
11 
13 #ifndef _FBXSDK_SCENE_SHADING_BINDING_OPERATOR_H_
14 #define _FBXSDK_SCENE_SHADING_BINDING_OPERATOR_H_
15 
16 #include <fbxsdk/fbxsdk_def.h>
17 
19 
20 #include <fbxsdk/fbxsdk_nsbegin.h>
21 
50 {
52 
53 public:
59  template <class FBXTYPE>
60  bool Evaluate(const FbxObject* pObject, FBXTYPE* pResult) const
61  {
62  EFbxType lResultType;
63  void* lResult = NULL;
64 
65  bool lSuccess = Evaluate(pObject, &lResultType, &lResult);
66 
67  if (lSuccess)
68  {
69  FbxTypeCopy(*pResult, lResult, lResultType);
70  }
71 
72  FreeEvaluationResult(lResultType, lResult);
73 
74  return lSuccess;
75  }
76 
85  template <class FBXTYPE>
86  bool ReverseEvaluation(const FbxObject* pObject, FBXTYPE * pInOut,
87  bool setObj=false, int index=0) const
88  {
89 
90  const void* lIn = pInOut;
91  void* lOut = NULL;
92  EFbxType lOutType;
93 
94  bool lSuccess = ReverseEvaluate(pObject, lIn, &lOut, &lOutType, setObj, index);
95 
96  if (lSuccess)
97  {
98  FbxTypeCopy(*pInOut, lOut, lOutType);
99  }
100 
101  FreeEvaluationResult(lOutType, lOut);
102 
103  return lSuccess;
104  }
105 
119  template <class FBXTYPE>
120  bool EvaluateEntry(const FbxObject* pObject, const char* pEntryDestinationName, FBXTYPE* pResult) const
121  {
122  EFbxType lResultType;
123  void* lResult = NULL;
124 
125  bool lSuccess = EvaluateEntry(pObject, pEntryDestinationName, &lResultType, &lResult);
126 
127  if (lSuccess)
128  {
129  FbxTypeCopy(*pResult, lResult, lResultType);
130  }
131 
132  FreeEvaluationResult(lResultType, lResult);
133 
134  return lSuccess;
135  }
136 
142 
148 
150  // Static values
152 
154  static const char* sFunctionName;
156  static const char* sTargetName;
157 
159  static const char* sDefaultFunctionName;
161  static const char* sDefaultTargetName;
162 
163 
165  // Functions
167 
171  static void RegisterFunctions();
172 
176  static void UnregisterFunctions();
177 
178 
184  {
185  public:
187  virtual ~Function() {}
188 
197  virtual bool Evaluate(const FbxBindingOperator* pOperator, const FbxObject* pObject, EFbxType* pResultType, void** pResult) const = 0;
198 
210  virtual bool ReverseEvaluate(const FbxBindingOperator* pOperator, const FbxObject* pTarget, const void* pIn, void** pOut, EFbxType* pOutType, bool setObj, int index) const = 0;
211  };
212 
217  {
218  public:
220  virtual ~FunctionCreatorBase() {}
221 
225  virtual const char* GetFunctionName() const = 0;
226 
229  virtual Function* CreateFunction() const = 0;
230  };
231 
235  template <class FUNCTION>
237  {
238  public:
239 
243  virtual const char* GetFunctionName() const
244  {
245  return FUNCTION::FunctionName;
246  }
247 
250  virtual Function* CreateFunction() const
251  {
252  return FbxNew< FUNCTION >();
253  }
254  };
255 
260  {
261  public:
265  static void RegisterFunctionCreator(FunctionCreatorBase const& pCreator)
266  {
267  sRegistry.Insert(pCreator.GetFunctionName(), &pCreator);
268  }
269 
273  static void UnregisterFunctionCreator(FunctionCreatorBase const& pCreator)
274  {
275  sRegistry.Remove(pCreator.GetFunctionName());
276  }
277 
281  static const FunctionCreatorBase* FindCreator(const char* pName)
282  {
283  RegistryType::RecordType* lRecord = sRegistry.Find(pName);
284 
285  if (lRecord)
286  {
287  return lRecord->GetValue();
288  }
289  else
290  {
291  return NULL;
292  }
293  }
294 
295  private:
297  static RegistryType sRegistry;
298  };
299 
300 
301 /*****************************************************************************************************************************
302 ** WARNING! Anything beyond these lines is for internal use, may not be documented and is subject to change without notice! **
303 *****************************************************************************************************************************/
304 #ifndef DOXYGEN_SHOULD_SKIP_THIS
305  bool EvaluateEntry(const FbxObject* pObject, const char* pEntryDestinationName, EFbxType* pResultType, void** pResult) const;
306  bool GetEntryProperty(const FbxObject* pObject, const char* pEntryDestinationName, FbxProperty & pProp) const;
307 
308 protected:
309  virtual void Construct(const FbxObject* pFrom);
310  virtual void Destruct(bool pRecursive);
311  virtual void ConstructProperties(bool pForceSet);
312 
313  void InstantiateFunction();
314  bool Evaluate(const FbxObject* pObject, EFbxType* pResultType, void** pResult) const;
315  bool ReverseEvaluate(const FbxObject* pTarget, const void* pIn, void** pOut, EFbxType* pOutType, bool setObj, int index) const;
316  void FreeEvaluationResult(EFbxType pResultType, void* pResult) const;
317 
318  Function* mFunction;
319 #endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/
320 };
321 
322 
327 {
328 public:
330  static const char* FunctionName;
331 
341  virtual bool Evaluate(const FbxBindingOperator* pOperator, const FbxObject* pObject, EFbxType* pResultType, void** pResult) const;
342 
344  virtual bool ReverseEvaluate(const FbxBindingOperator* pOperator, const FbxObject* pTarget, const void* pIn, void** pOut, EFbxType* pOutType, bool setObj, int index) const;
345 
346 /*****************************************************************************************************************************
347 ** WARNING! Anything beyond these lines is for internal use, may not be documented and is subject to change without notice! **
348 *****************************************************************************************************************************/
349 #ifndef DOXYGEN_SHOULD_SKIP_THIS
351  virtual ~FbxNodePositionBOF();
352 #endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/
353 };
354 
359 {
360 public:
362  static const char* FunctionName;
363 
373  virtual bool Evaluate(const FbxBindingOperator* pOperator, const FbxObject* pObject, EFbxType* pResultType, void** pResult) const;
374 
376  virtual bool ReverseEvaluate(const FbxBindingOperator* pOperator, const FbxObject* pTarget, const void* pIn, void** pOut, EFbxType* pOutType, bool setObj, int index) const;
377 
378 /*****************************************************************************************************************************
379 ** WARNING! Anything beyond these lines is for internal use, may not be documented and is subject to change without notice! **
380 *****************************************************************************************************************************/
381 #ifndef DOXYGEN_SHOULD_SKIP_THIS
383  virtual ~FbxNodeDirectionBOF();
384 #endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/
385 };
386 
390 {
391 public:
393  static const char* FunctionName;
394 
401  virtual bool Evaluate(const FbxBindingOperator* pOperator, const FbxObject* pObject, EFbxType* pResultType, void** pResult) const;
402 
404  virtual bool ReverseEvaluate(const FbxBindingOperator* pOperator, const FbxObject* pTarget, const void* pIn, void** pOut, EFbxType* pOutType, bool setObj, int index) const;
405 
406 /*****************************************************************************************************************************
407 ** WARNING! Anything beyond these lines is for internal use, may not be documented and is subject to change without notice! **
408 *****************************************************************************************************************************/
409 #ifndef DOXYGEN_SHOULD_SKIP_THIS
410  FbxAssignBOF();
411  virtual ~FbxAssignBOF();
412 #endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/
413 };
414 
415 
420 {
421 public:
423  static const char* FunctionName;
424 
438  virtual bool Evaluate(const FbxBindingOperator* pOperator, const FbxObject* pObject, EFbxType* pResultType, void** pResult) const;
439  virtual bool ReverseEvaluate(const FbxBindingOperator* pOperator, const FbxObject* pTarget, const void* pIn, void** pOut, EFbxType* pOutType, bool setObj, int index) const;
440 
441 /*****************************************************************************************************************************
442 ** WARNING! Anything beyond these lines is for internal use, may not be documented and is subject to change without notice! **
443 *****************************************************************************************************************************/
444 #ifndef DOXYGEN_SHOULD_SKIP_THIS
446  virtual ~FbxConditionalBOF();
447 #endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/
448 };
449 
450 
455 {
456 public:
458  static const char* FunctionName;
459 
473  virtual bool Evaluate(const FbxBindingOperator* pOperator, const FbxObject* pObject, EFbxType* pResultType, void** pResult) const;
474  virtual bool ReverseEvaluate(const FbxBindingOperator* pOperator, const FbxObject* pTarget, const void* pIn, void** pOut, EFbxType* pOutType, bool setObj, int index) const;
475 
476 /*****************************************************************************************************************************
477 ** WARNING! Anything beyond these lines is for internal use, may not be documented and is subject to change without notice! **
478 *****************************************************************************************************************************/
479 #ifndef DOXYGEN_SHOULD_SKIP_THIS
480  FbxSwitchBOF();
481  virtual ~FbxSwitchBOF();
482 #endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/
483 };
484 
485 
487 {
488 public:
490  static const char* FunctionName;
491 
501  virtual bool Evaluate(const FbxBindingOperator* pOperator, const FbxObject* pObject, EFbxType* pResultType, void** pResult) const;
502  virtual bool ReverseEvaluate(const FbxBindingOperator* pOperator, const FbxObject* pTarget, const void* pIn, void** pOut, EFbxType* pOutType, bool setObj, int index) const;
503 
504 /*****************************************************************************************************************************
505 ** WARNING! Anything beyond these lines is for internal use, may not be documented and is subject to change without notice! **
506 *****************************************************************************************************************************/
507 #ifndef DOXYGEN_SHOULD_SKIP_THIS
509  virtual ~FbxTRSToMatrixBOF();
510 #endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/
511 };
512 
513 
515 {
516 public:
518  static const char* FunctionName;
519 
529  virtual bool Evaluate(const FbxBindingOperator* pOperator, const FbxObject* pObject, EFbxType* pResultType, void** pResult) const;
530  virtual bool ReverseEvaluate(const FbxBindingOperator* pOperator, const FbxObject* pTarget, const void* pIn, void** pOut, EFbxType* pOutType, bool setObj, int index) const;
531 
532 /*****************************************************************************************************************************
533 ** WARNING! Anything beyond these lines is for internal use, may not be documented and is subject to change without notice! **
534 *****************************************************************************************************************************/
535 #ifndef DOXYGEN_SHOULD_SKIP_THIS
536  FbxAddBOF();
537  virtual ~FbxAddBOF();
538 #endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/
539 };
540 
541 
543 {
544 public:
546  static const char* FunctionName;
547 
557  virtual bool Evaluate(const FbxBindingOperator* pOperator, const FbxObject* pObject, EFbxType* pResultType, void** pResult) const;
558  virtual bool ReverseEvaluate(const FbxBindingOperator* pOperator, const FbxObject* pTarget, const void* pIn, void** pOut, EFbxType* pOutType, bool setObj, int index) const;
559 
560 /*****************************************************************************************************************************
561 ** WARNING! Anything beyond these lines is for internal use, may not be documented and is subject to change without notice! **
562 *****************************************************************************************************************************/
563 #ifndef DOXYGEN_SHOULD_SKIP_THIS
564  FbxSubstractBOF();
565  virtual ~FbxSubstractBOF();
566 #endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/
567 };
568 
569 
571 {
572 public:
574  static const char* FunctionName;
575 
585  virtual bool Evaluate(const FbxBindingOperator* pOperator, const FbxObject* pObject, EFbxType* pResultType, void** pResult) const;
586  //Set index to 1 to get realWorldScale.
587  virtual bool ReverseEvaluate(const FbxBindingOperator* pOperator, const FbxObject* pTarget, const void* pIn, void** pOut, EFbxType* pOutType, bool setObj, int index) const;
588 
589 /*****************************************************************************************************************************
590 ** WARNING! Anything beyond these lines is for internal use, may not be documented and is subject to change without notice! **
591 *****************************************************************************************************************************/
592 #ifndef DOXYGEN_SHOULD_SKIP_THIS
593  FbxMultiplyBOF();
594  virtual ~FbxMultiplyBOF();
595 #endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/
596 };
597 
598 
600 {
601 public:
603  static const char* FunctionName;
604 
614  virtual bool Evaluate(const FbxBindingOperator* pOperator, const FbxObject* pObject, EFbxType* pResultType, void** pResult) const;
615  virtual bool ReverseEvaluate(const FbxBindingOperator* pOperator, const FbxObject* pTarget, const void* pIn, void** pOut, EFbxType* pOutType, bool setObj, int index) const;
616 
617 /*****************************************************************************************************************************
618 ** WARNING! Anything beyond these lines is for internal use, may not be documented and is subject to change without notice! **
619 *****************************************************************************************************************************/
620 #ifndef DOXYGEN_SHOULD_SKIP_THIS
622  virtual ~FbxMultiplyDistBOF();
623 #endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/
624 };
625 
627 {
628 public:
630  static const char* FunctionName;
631 
641  virtual bool Evaluate(const FbxBindingOperator* pOperator, const FbxObject* pObject, EFbxType* pResultType, void** pResult) const;
642  virtual bool ReverseEvaluate(const FbxBindingOperator* pOperator, const FbxObject* pTarget, const void* pIn, void** pOut, EFbxType* pOutType, bool setObj, int index) const;
643 
644 /*****************************************************************************************************************************
645 ** WARNING! Anything beyond these lines is for internal use, may not be documented and is subject to change without notice! **
646 *****************************************************************************************************************************/
647 #ifndef DOXYGEN_SHOULD_SKIP_THIS
648  FbxOneOverXBOF();
649  virtual ~FbxOneOverXBOF();
650 #endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/
651 };
652 
654 {
655 public:
657  static const char* FunctionName;
658 
668  virtual bool Evaluate(const FbxBindingOperator* pOperator, const FbxObject* pObject, EFbxType* pResultType, void** pResult) const;
669  virtual bool ReverseEvaluate(const FbxBindingOperator* pOperator, const FbxObject* pTarget, const void* pIn, void** pOut, EFbxType* pOutType, bool setObj, int index) const;
670 
671 /*****************************************************************************************************************************
672 ** WARNING! Anything beyond these lines is for internal use, may not be documented and is subject to change without notice! **
673 *****************************************************************************************************************************/
674 #ifndef DOXYGEN_SHOULD_SKIP_THIS
675  FbxPowerBOF();
676  virtual ~FbxPowerBOF();
677 #endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/
678 };
679 
681 {
682 public:
684  static const char* FunctionName;
685 
695  virtual bool Evaluate(const FbxBindingOperator* pOperator, const FbxObject* pObject, EFbxType* pResultType, void** pResult) const;
696  virtual bool ReverseEvaluate(const FbxBindingOperator* pOperator, const FbxObject* pTarget, const void* pIn, void** pOut, EFbxType* pOutType, bool setObj, int index) const;
697 
698 /*****************************************************************************************************************************
699 ** WARNING! Anything beyond these lines is for internal use, may not be documented and is subject to change without notice! **
700 *****************************************************************************************************************************/
701 #ifndef DOXYGEN_SHOULD_SKIP_THIS
703  virtual ~FbxDegreeToRadianBOF();
704 #endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/
705 };
706 
707 
709 {
710 public:
712  static const char* FunctionName;
713 
723  virtual bool Evaluate(const FbxBindingOperator* pOperator, const FbxObject* pObject, EFbxType* pResultType, void** pResult) const;
724  virtual bool ReverseEvaluate(const FbxBindingOperator* pOperator, const FbxObject* pTarget, const void* pIn, void** pOut, EFbxType* pOutType, bool setObj, int index) const;
725 
726 /*****************************************************************************************************************************
727 ** WARNING! Anything beyond these lines is for internal use, may not be documented and is subject to change without notice! **
728 *****************************************************************************************************************************/
729 #ifndef DOXYGEN_SHOULD_SKIP_THIS
732 #endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/
733 };
734 
735 
736 
738 {
739 public:
741  static const char* FunctionName;
742 
752  virtual bool Evaluate(const FbxBindingOperator* pOperator, const FbxObject* pObject, EFbxType* pResultType, void** pResult) const;
753  virtual bool ReverseEvaluate(const FbxBindingOperator* pOperator, const FbxObject* pTarget, const void* pIn, void** pOut, EFbxType* pOutType, bool setObj, int index) const;
754 
755 /*****************************************************************************************************************************
756 ** WARNING! Anything beyond these lines is for internal use, may not be documented and is subject to change without notice! **
757 *****************************************************************************************************************************/
758 #ifndef DOXYGEN_SHOULD_SKIP_THIS
760  virtual ~FbxSphericalToCartesianBOF();
761 #endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/
762 };
763 
764 
765 
767 {
768 public:
770  static const char* FunctionName;
771 
781  virtual bool Evaluate(const FbxBindingOperator* pOperator, const FbxObject* pObject, EFbxType* pResultType, void** pResult) const;
782  virtual bool ReverseEvaluate(const FbxBindingOperator* pOperator, const FbxObject* pTarget, const void* pIn, void** pOut, EFbxType* pOutType, bool setObj, int index) const;
783 
784 /*****************************************************************************************************************************
785 ** WARNING! Anything beyond these lines is for internal use, may not be documented and is subject to change without notice! **
786 *****************************************************************************************************************************/
787 #ifndef DOXYGEN_SHOULD_SKIP_THIS
788  FbxIsYupBOF();
789  virtual ~FbxIsYupBOF();
790 #endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/
791 };
792 
793 
794 
799 {
800 public:
802  static const char* FunctionName;
803 
812  virtual bool Evaluate(const FbxBindingOperator* pOperator, const FbxObject* pObject, EFbxType* pResultType, void** pResult) const;
813  virtual bool ReverseEvaluate(const FbxBindingOperator* pOperator, const FbxObject* pTarget, const void* pIn, void** pOut, EFbxType* pOutType, bool setObj, int index) const;
814 
815 /*****************************************************************************************************************************
816 ** WARNING! Anything beyond these lines is for internal use, may not be documented and is subject to change without notice! **
817 *****************************************************************************************************************************/
818 #ifndef DOXYGEN_SHOULD_SKIP_THIS
819  FbxSymbolIDBOF();
820  virtual ~FbxSymbolIDBOF();
821 #endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/
822 };
823 
824 
829 {
830 public:
832  static const char* FunctionName;
833 
843  virtual bool Evaluate(const FbxBindingOperator* pOperator, const FbxObject* pObject, EFbxType* pResultType, void** pResult) const;
844 
846  virtual bool ReverseEvaluate(const FbxBindingOperator* pOperator, const FbxObject* pTarget, const void* pIn, void** pOut, EFbxType* pOutType, bool setObj, int index) const;
847 
848 /*****************************************************************************************************************************
849 ** WARNING! Anything beyond these lines is for internal use, may not be documented and is subject to change without notice! **
850 *****************************************************************************************************************************/
851 #ifndef DOXYGEN_SHOULD_SKIP_THIS
854 #endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/
855 };
856 
857 #include <fbxsdk/fbxsdk_nsend.h>
858 
859 #endif /* _FBXSDK_SCENE_SHADING_BINDING_OPERATOR_H_ */
#define FBXSDK_OBJECT_DECLARE(Class, Parent)
Macro used to declare a new class derived from FbxObject.
Definition: fbxobject.h:61
This utility class is used to register and unregister the binding function creators.
A pass through operator used to assign constants to parameters.
FBX SDK environment definition.
static const char * FunctionName
Name of the operation function.
A symbol(string) operator that search the string table and return its corresponding unique id...
static const char * FunctionName
Name of the operation function.
virtual Function * CreateFunction() const
Create the operation function.
static const char * FunctionName
Name of the operation function.
#define NULL
Definition: fbxarch.h:210
bool ReverseEvaluation(const FbxObject *pObject, FBXTYPE *pInOut, bool setObj=false, int index=0) const
Run the inverse operator on the given object, assigning the result directly to the object...
An evaluation operator to get the direction of the node that is bound with this operator via a certai...
virtual const char * GetFunctionName() const =0
Get name of the function.
bool Evaluate(const FbxObject *pObject, FBXTYPE *pResult) const
Run the operator on the given object.
FbxPropertyT< FbxString > FunctionName
This property stores the name of function.
static const char * FunctionName
Name of the operation function.
A binding table represents a collection of bindings from source types such as FbxObject, or FbxLayerElements to destinations which can be of similar types.
static void RegisterFunctionCreator(FunctionCreatorBase const &pCreator)
To register the binding function creator.
A conditional operator that outputs one out of two properties, based on the value of a predicate prop...
static const char * sTargetName
Target name.
static const char * FunctionName
Name of the operation function.
static const char * sDefaultFunctionName
Default value for function name.
This class implements an efficient map based on key comparison, which stores key-value pairs...
Definition: fbxmap.h:68
It represents a binding relationship between current object and the target.
EFbxType
Type identifier constants.
An evaluation operator to get the position of the node that is bound with this operator via a certain...
The base class of most FBX objects.
Definition: fbxobject.h:157
static const char * FunctionName
Name of the operation function.
virtual ~Function()
Destructor.
static const char * FunctionName
Name of the operation function.
virtual const char * GetFunctionName() const
Get Name of the operation function.
The concrete factory class for binding function.
static const char * FunctionName
Name of the operation function.
static const char * FunctionName
Name of the operation function.
static const char * FunctionName
Name of the operation function.
static const char * FunctionName
Name of the operation function.
static const char * sFunctionName
Function name.
static const char * FunctionName
Name of the operation function.
Class to hold user properties.
Definition: fbxproperty.h:37
static const char * FunctionName
Name of the operation function.
bool FbxTypeCopy(T1 &, const T2 &)
static const char * FunctionName
Name of the operation function.
This object represents a binding operation on a FbxObject or FbxProperty.
A chooser operator that check spot distribution and returns the correct value, based on the value of ...
#define FBXSDK_DLL
Definition: fbxarch.h:173
The abstract factory class for binding function.
A switch operator that outputs one out of n properties, based on the value of a predicate property...
static const FunctionCreatorBase * FindCreator(const char *pName)
To find the binding function creator by name.
static const char * FunctionName
Name of the operation function.
static void UnregisterFunctionCreator(FunctionCreatorBase const &pCreator)
To unregister the binding function creator.
FbxPropertyT< FbxString > TargetName
This property stores the name of target.
bool EvaluateEntry(const FbxObject *pObject, const char *pEntryDestinationName, FBXTYPE *pResult) const
Evaluate the value of an operator parameter.
static const char * FunctionName
Name of the operation function.
static const char * sDefaultTargetName
Default value for target name.
StorageType::RecordType RecordType
Definition: fbxmap.h:98
static const char * FunctionName
Name of the operation function.
static const char * FunctionName
Name of the operation function.