fbcharactermanipulator.h

Go to the documentation of this file.
00001 #ifndef __FBCHARACTERMANIPULATOR_H__
00002 #define __FBCHARACTERMANIPULATOR_H__
00003 /**************************************************************************
00004  Copyright (c) 1994 - 2009 Autodesk, Inc. and/or its licensors.
00005  All Rights Reserved.
00006  
00007  The coded instructions, statements, computer programs, and/or related 
00008  material (collectively the "Data") in these files contain unpublished 
00009  information proprietary to Autodesk, Inc. and/or its licensors, which is 
00010  protected by Canada and United States of America federal copyright law 
00011  and by international treaties.
00012  
00013  The Data may not be disclosed or distributed to third parties, in whole 
00014  or in part, without the prior written consent of Autodesk, Inc. 
00015  ("Autodesk").
00016  
00017  THE DATA IS PROVIDED "AS IS" AND WITHOUT WARRANTY.
00018  ALL WARRANTIES ARE EXPRESSLY EXCLUDED AND DISCLAIMED. AUTODESK MAKES NO 
00019  WARRANTY OF ANY KIND WITH RESPECT TO THE DATA, EXPRESS, IMPLIED OR 
00020  ARISING BY CUSTOM OR TRADE USAGE, AND DISCLAIMS ANY IMPLIED WARRANTIES 
00021  OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR 
00022  PURPOSE OR USE. WITHOUT LIMITING THE FOREGOING, AUTODESK DOES NOT 
00023  WARRANT THAT THE OPERATION OF THE DATA WILL BE UNINTERRUPTED OR ERROR 
00024  FREE.
00025  
00026  IN NO EVENT SHALL AUTODESK, ITS AFFILIATES, PARENT COMPANIES, LICENSORS 
00027  OR SUPPLIERS ("AUTODESK GROUP") BE LIABLE FOR ANY LOSSES, DAMAGES OR 
00028  EXPENSES OF ANY KIND (INCLUDING WITHOUT LIMITATION PUNITIVE OR MULTIPLE 
00029  DAMAGES OR OTHER SPECIAL, DIRECT, INDIRECT, EXEMPLARY, INCIDENTAL, LOSS 
00030  OF PROFITS, REVENUE OR DATA, COST OF COVER OR CONSEQUENTIAL LOSSES OR 
00031  DAMAGES OF ANY KIND), HOWEVER CAUSED, AND REGARDLESS OF THE THEORY OF 
00032  LIABILITY, WHETHER DERIVED FROM CONTRACT, TORT (INCLUDING, BUT NOT 
00033  LIMITED TO, NEGLIGENCE), OR OTHERWISE, ARISING OUT OF OR RELATING TO THE 
00034  DATA OR ITS USE OR ANY OTHER PERFORMANCE, WHETHER OR NOT AUTODESK HAS 
00035  BEEN ADVISED OF THE POSSIBILITY OF SUCH LOSS OR DAMAGE.
00036  
00037 **************************************************************************/
00038 
00043 #include <kaydaradef.h>
00044 #ifndef FBSDK_DLL 
00045 
00048     #define FBSDK_DLL K_DLLIMPORT
00049 #endif
00050 
00051 #include <fbsdk/fbcomponent.h>
00052 #include <fbsdk/fbcore.h>
00053 #include <fbsdk/fbcharacter.h>
00054 
00055 #ifdef FBSDKUseNamespace
00056     namespace FBSDKNamespace {
00057 #endif
00058 
00060 // Return value for manipulation functions
00063 enum FBManipulationStartResult 
00064 { 
00065     kFBManipulationOK,              
00066     kFBManipulationOKNoUndo,        
00067     kFBManipulationRefuse           
00068 };
00069 
00071 enum FBManipulationGetResult
00072 { 
00073     kFBManipulationGetDone,         
00074     kFBManipulationGetContinue,     
00075     kFBManipulationGetFail          
00076 };
00077 
00079 enum FBManipulationSetResult
00080 { 
00081     kFBManipulationSetContinue,     
00082     kFBManipulationSetFail          
00083 };
00084 
00086 enum FBReferencialType
00087 {
00088     FBRefTypeNone,                  
00089     FBRefTypeGlobal,                
00090     FBRefTypeLocal,                 
00091     FBRefTypeLayer,                 
00092     FBRefTypeSumLayers,             
00093     FBRefTypeParent,                
00094 };
00095 
00097 enum FBSetType
00098 {
00099     FBSetTypeNone,                  
00100     FBSetTypeExact,                 
00101     FBSetTypeCumulative,            
00102 };
00103 
00105 enum FBSetWhat
00106 {
00107     FBSetWhatNone,                  
00108     FBSetWhatX,                     
00109     FBSetWhatY,                     
00110     FBSetWhatZ,                     
00111     FBSetWhatXYZ,                   
00112     FBSetWhatAll,                   
00113 };                                  
00114                                     
00116 enum FBManipPivot
00117 {
00118     FBManipPivotObjectTranslation,  
00119     FBManipPivotObjectRotation,     
00120     FBManipPivotObjectScaling,      
00121     FBManipPivotObjectUnknown       
00122 };
00123 
00125 enum FBManipMode
00126 {
00127     FBManip_EditorOther,        
00128     FBManip_EditorTranslation,  
00129     FBManip_EditorRotation,     
00130     FBManip_EditorScaling       
00131 };
00132 
00133 FB_DEFINE_COMPONENT( FBSDK_DLL, CharacterManipulator );
00134 FB_DEFINE_COMPONENT( FBSDK_DLL, CharacterManipulatorCtrlSet );
00135 
00137 // FBCharacterManipulator
00139 
00162 __FB_FORWARD( FBCharacterManipulator);
00163 
00165 class FBSDK_DLL FBCharacterManipulator : public FBComponent 
00166 {
00167     __FBClassDeclare( FBCharacterManipulator,FBComponent );
00168 public:
00173     FBCharacterManipulator(char *pName, HIObject pObject=NULL);
00174 
00180     virtual FBManipulationGetResult     TranslationIsEditable( bool &pEditable, FBReferencialType pRefType ) = 0;
00181 
00182     // Manipulation Get/Set
00190     virtual FBManipulationSetResult     TranslationSet( FBTVector &pT, FBReferencialType pRefType, FBSetType pSetType, FBSetWhat pSetWhat ) = 0;
00197     virtual FBManipulationGetResult     TranslationGet( FBTVector &pT, FBReferencialType pRefType, FBManipPivot pPivot = FBManipPivotObjectTranslation ) = 0;
00198     
00199     // Manipulation
00204     virtual FBManipulationStartResult   TranslationStartManipulation( FBReferencialType pRefType ) = 0;
00207     virtual void                        TranslationStopManipulation () = 0;
00208 
00209 
00210     //Rotation
00216     virtual FBManipulationGetResult     RotationIsEditable( bool &pEditable, FBReferencialType pRefType ) = 0;
00217     
00218     /* Matrix Get/Set */
00226     virtual FBManipulationSetResult     RotationSet( FBMatrix &pRM, FBReferencialType pRefType, FBSetType pSetType, bool pOnlyRoot = false ) = 0;
00232     virtual FBManipulationGetResult     RotationGet( FBMatrix &pRM, FBReferencialType pRefType ) = 0;
00233 
00234     /* Manipulation */
00239     virtual FBManipulationStartResult   RotationStartManipulation( FBReferencialType pRefType ) = 0;
00242     virtual void                        RotationStopManipulation () = 0;
00243 
00244     //Scaling
00249     virtual FBManipulationGetResult     ScalingIsEditable( bool &pEditable ) = 0;
00250     
00251     /* Manipulation Get/Set*/
00259     virtual FBManipulationSetResult     ScalingSet( FBSVector &pS, FBReferencialType pRefType, FBSetType pSetType, FBSetWhat pSetWhat ) = 0;
00265     virtual FBManipulationGetResult     ScalingGet( FBSVector &pS, FBReferencialType pRefType ) = 0;
00266 
00267     /* Manipulation */
00272     virtual FBManipulationStartResult   ScalingStartManipulation( FBReferencialType pRefType ) = 0;
00275     virtual void                        ScalingStopManipulation () = 0;
00276 
00280     bool    IsReleasePinPressed();
00281 
00285     FBModel *GetManipulatedNode();
00286 
00290     FBManipMode GetManipulatorMode();
00291 };
00292 
00298 #define FBCharacterManipulatorCtrlSetDeclare( ClassName, Parent ) \
00299     FBClassDeclare( ClassName, Parent ); \
00300   public: \
00301     ClassName(char * pName):Parent(pName) { FBClassInit; } \
00302   private:
00303 
00307 #define FBCharacterManipulatorCtrlSetImplementation( ThisComponent ) \
00308         FBClassImplementation( ThisComponent )
00309 
00311 // FBCharacterManipulatorCtrlSet
00313 __FB_FORWARD( FBCharacterManipulatorCtrlSet);
00314 
00316 class FBSDK_DLL FBCharacterManipulatorCtrlSet : public FBCharacterManipulator 
00317 {
00318     __FBClassDeclare( FBCharacterManipulatorCtrlSet,FBCharacterManipulator );
00319 public:
00324     FBCharacterManipulatorCtrlSet(char *pName, HIObject pObject=NULL);
00325 
00329     FBCharacter *                       GetCharacter();
00330 
00335     virtual void                        AllocateState(FBCharacter* pCharacter);
00336 
00340     virtual void                        DeallocateState();
00341 
00345     bool                                IsFullBody(); 
00346 
00350     bool                                IsBodyPart(); 
00351 
00355     bool                                IsReachOverride();
00356 
00360     bool                                IsStiffnessOverride();
00361 
00365     bool                                IsIKPivotUse();
00366 
00369     virtual void                        SyncCharacter(FBEvaluateInfo *pEvalInfo);
00370    
00374     FBEffectorId                        GetManipulatedEffectorId();
00375 
00379     FBEffectorId                        GetManipulatedEffectorIdForRotation();
00380 
00384     FBEffectorId                        GetManipulatedEffectorIdForTranslation();
00385 
00389     FBEffectorSetID                     GetEffectorSet();
00390 
00394     FBBodyNodeId                        GetManipulatedBodyNode();
00395 
00400     bool                                IsDescendantPulling(FBEffectorId pEffectorId);
00401 
00406     int                                 GetDescendantEffectorCount(FBEffectorId pEffectorId);
00407 
00413     FBEffectorId                        GetDescendantEffector(FBEffectorId pEffectorId, int pIndex);
00414 
00419     float                               GetEffectorReachTValue(int pEffectorId);              
00424     void                                SetEffectorReachTValue(int pEffectorId, float pValue);              
00425 
00430     float                               GetEffectorPullValue(int pEffectorId);              
00435     void                                SetEffectorPullValue(int pEffectorId, float pValue);              
00436 
00441     void                                TranslationSetGlobal(FBTVector pVector, int pEffectorId);
00446     void                                TranslationSetLocal(FBTVector pVector, int pEffectorId);
00447 
00448     //For the following function, please see the description in the parent class.
00449     //Translation
00450     virtual FBManipulationGetResult     TranslationIsEditable( bool &pEditable, FBReferencialType pRefType );
00451     // Manipulation Get/Set
00452     virtual FBManipulationSetResult     TranslationSet( FBTVector &pT, FBReferencialType pRefType, FBSetType pSetType, FBSetWhat pSetWhat );
00453     virtual FBManipulationGetResult     TranslationGet( FBTVector &pT, FBReferencialType pRefType, FBManipPivot pPivot = FBManipPivotObjectTranslation );
00454     // Manipulation
00455     virtual FBManipulationStartResult   TranslationStartManipulation( FBReferencialType pRefType );
00456     void                                TranslationStopManipulation ();
00457 
00458     //Rotation
00459     virtual FBManipulationGetResult     RotationIsEditable( bool &pEditable, FBReferencialType pRefType );
00460     /* Matrix Get/Set */
00461     virtual FBManipulationSetResult     RotationSet( FBMatrix &pRM, FBReferencialType pRefType, FBSetType pSetType, bool pOnlyRoot = false );
00462     virtual FBManipulationGetResult     RotationGet( FBMatrix &pRM, FBReferencialType pRefType );
00463     /* Manipulation */
00464     virtual FBManipulationStartResult   RotationStartManipulation( FBReferencialType pRefType );
00465     virtual void                        RotationStopManipulation ();
00466 
00467     //Scaling
00468     virtual FBManipulationGetResult     ScalingIsEditable( bool &pEditable );
00469     /* Manipulation Get/Set*/
00470     virtual FBManipulationGetResult     ScalingGet( FBSVector &pS, FBReferencialType pRefType );
00471     virtual FBManipulationSetResult     ScalingSet( FBSVector &pS, FBReferencialType pRefType, FBSetType pSetType, FBSetWhat pSetWhat );
00472     /* Manipulation */
00473     virtual FBManipulationStartResult   ScalingStartManipulation( FBReferencialType pRefType );
00474     virtual void                        ScalingStopManipulation ();
00475 };
00476 
00477 #ifdef FBSDKUseNamespace
00478     }
00479 #endif
00480 #endif