constraints/constraint_template/orconstraint_template_constraint.cxx

constraints/constraint_template/orconstraint_template_constraint.cxx
/***************************************************************************************
Autodesk(R) Open Reality(R) Samples
(C) 2009 Autodesk, Inc. and/or its licensors
All rights reserved.
AUTODESK SOFTWARE LICENSE AGREEMENT
Autodesk, Inc. licenses this Software to you only upon the condition that
you accept all of the terms contained in the Software License Agreement ("Agreement")
that is embedded in or that is delivered with this Software. By selecting
the "I ACCEPT" button at the end of the Agreement or by copying, installing,
uploading, accessing or using all or any portion of the Software you agree
to enter into the Agreement. A contract is then formed between Autodesk and
either you personally, if you acquire the Software for yourself, or the company
or other legal entity for which you are acquiring the software.
AUTODESK, INC., MAKES NO WARRANTY, EITHER EXPRESS OR IMPLIED, INCLUDING BUT
NOT LIMITED TO ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR
PURPOSE REGARDING THESE MATERIALS, AND MAKES SUCH MATERIALS AVAILABLE SOLELY ON AN
"AS-IS" BASIS.
IN NO EVENT SHALL AUTODESK, INC., BE LIABLE TO ANYONE FOR SPECIAL, COLLATERAL,
INCIDENTAL, OR CONSEQUENTIAL DAMAGES IN CONNECTION WITH OR ARISING OUT OF PURCHASE
OR USE OF THESE MATERIALS. THE SOLE AND EXCLUSIVE LIABILITY TO AUTODESK, INC.,
REGARDLESS OF THE FORM OF ACTION, SHALL NOT EXCEED THE PURCHASE PRICE OF THE
MATERIALS DESCRIBED HEREIN.
Autodesk, Inc., reserves the right to revise and improve its products as it sees fit.
Autodesk and Open Reality are registered trademarks or trademarks of Autodesk, Inc.,
in the U.S.A. and/or other countries. All other brand names, product names, or
trademarks belong to their respective holders.
GOVERNMENT USE
Use, duplication, or disclosure by the U.S. Government is subject to restrictions as
set forth in FAR 12.212 (Commercial Computer Software-Restricted Rights) and
DFAR 227.7202 (Rights in Technical Data and Computer Software), as applicable.
Manufacturer is Autodesk, Inc., 10 Duke Street, Montreal, Quebec, Canada, H3C 2L7.
***************************************************************************************/
//--- Class declarations
#include "orconstraint_template_constraint.h"
#include "orconstraint_template_layout.h"
//--- Registration defines
#define ORCONSTRAINT__CLASS ORCONSTRAINT__CLASSNAME
#define ORCONSTRAINT__NAME "Constraint Template"
#define ORCONSTRAINT__LABEL "OR - Constraint Template"
#define ORCONSTRAINT__DESC "OR - Constraint Template Description"
//--- implementation and registration
FBConstraintImplementation ( ORCONSTRAINT__CLASS );
FBRegisterConstraint ( ORCONSTRAINT__NAME,
ORCONSTRAINT__CLASS,
ORCONSTRAINT__LABEL,
ORCONSTRAINT__DESC,
FB_DEFAULT_SDK_ICON ); // Icon filename (default=Open Reality icon)
double ORConstraint_TemplateGetTempValue( HIObject pMbObject )
{
ORConstraint_Template* pFbObject = FBCast<ORConstraint_Template>( pMbObject );
return pFbObject->mTempValue;
}
void ORConstraint_TemplateSetTempValue( HIObject pMbObject, double pValue )
{
ORConstraint_Template* pFbObject = FBCast<ORConstraint_Template>( pMbObject );
pFbObject->mTempValue = pValue;
}
/************************************************
* Creation function.
************************************************/
bool ORConstraint_Template::FBCreate()
{
/*
* 1. Create Reference group & elements
* 2. Set constraint variables (deformer,layout,description)
* 3. Set pointers to NULL if necessary
*/
Deformer = false;
HasLayout = true;
Description = "Constraint Template";
mTempValue = 0;
FBPropertyPublish( this, TempValue, "TempValue", ORConstraint_TemplateGetTempValue, ORConstraint_TemplateSetTempValue );
return true;
}
/************************************************
* Destruction function.
************************************************/
void ORConstraint_Template::FBDestroy()
{
/*
* Free any user memory associated to constraint
*/
}
/************************************************
* Refrence added notification.
************************************************/
bool ORConstraint_Template::ReferenceAddNotify( int pGroupIndex, FBModel* pModel )
{
/*
* Perform action required when a refrence is added.
*/
return true;
}
/************************************************
* Reference removed notification.
************************************************/
bool ORConstraint_Template::ReferenceRemoveNotify( int pGroupIndex, FBModel* pModel )
{
/*
* Perform action required when a refrence is removed.
*/
return true;
}
/************************************************
* Setup all of the animation nodes.
************************************************/
void ORConstraint_Template::SetupAllAnimationNodes()
{
/*
* - Based on the existence of the references (ReferenceGet() function),
* create the required animation nodes.
* - A source will use an Out node, whereas a destination will use
* an In Node.
* - If the node is with respect to a deformation, then Bind the reference
* to the deformation notification ( DeformerBind() )
*/
}
/************************************************
* Removed all of the animation nodes.
************************************************/
void ORConstraint_Template::RemoveAllAnimationNodes()
{
/*
* If nodes have been bound to deformations, remove the binding.
*/
}
/************************************************
* Suggest a snap.
************************************************/
void ORConstraint_Template::SnapSuggested()
{
/*
* Perform any pre-snap operations.
*/
}
/************************************************
* Suggest a freeze.
************************************************/
void ORConstraint_Template::FreezeSuggested()
{
/*
* Perform any pre-freeze operations
*/
}
/************************************************
* Disable the constraint on pModel.
************************************************/
bool ORConstraint_Template::Disable(FBModel* pModel)
{
/*
* Perform any operations to disable model
* Must call FBConstraint::Disable()
*/
return FBConstraint::Disable( pModel );
}
/************************************************
* Real-Time Engine Evaluation.
************************************************/
bool ORConstraint_Template::AnimationNodeNotify(FBAnimationNode* pConnector,FBEvaluateInfo* pEvaluateInfo,FBConstraintInfo* pConstraintInfo)
{
/*
* Constraint Evaluation
* 1. Read data from sources
* 2. Calculate necessary operations.
* 3. Write output to destinations
* Note: Not the deformation operations !
*/
return true;
}
/************************************************
* Real-Time Deformer Evaluation.
************************************************/
bool ORConstraint_Template::DeformerNotify(FBModel* pModel,const FBVertex* pSrcVertex,const FBVertex* pSrcNormal,int pCount,FBVertex* pDstVertex,FBVertex* pDstNormal)
{
/*
* 1. Get the data from the source vertices
* 2. Calculate the necessary operations
* 3. Write the output to the destination vertices.
* Note: Not the non-deformation operations !
*/
return true;
}
/************************************************
* FBX Storage.
************************************************/
bool ORConstraint_Template::FbxStore( FBFbxObject* pFbxObject, kFbxObjectStore pStoreWhat )
{
/*
* FBX Storage of constraint parameters.
*/
return true;
}
/************************************************
* FBX Retrieval.
************************************************/
bool ORConstraint_Template::FbxRetrieve( FBFbxObject* pFbxObject, kFbxObjectStore pStoreWhat )
{
/*
* FBX Retrieval of constraint parameters.
*/
return true;
}
/************************************************
* Deformer Binding.
************************************************/
bool ORConstraint_Template::DeformerBind( FBModel* pModel )
{
/*
* Perform the operations for the binding of a model to be deformed
* Must call FBConstraint::DeformerBind()
*/
return FBConstraint::DeformerBind( pModel );
}
/************************************************
* Deformer Unbinding.
************************************************/
bool ORConstraint_Template::DeformerUnBind( FBModel* pModel )
{
/*
* Perform the operations for the unbinding of a model being deformed
* Must call FBConstraint::DeformerUnBind()
*/
return FBConstraint::DeformerUnBind( pModel );
}
/************************************************
* Freeze SRT for the constraint.
************************************************/
void ORConstraint_Template::FreezeSRT ( FBModel* pModel, bool pS, bool pR, bool pT )
{
/*
* Freeze the model's SRT parameters (if true,true,true)
* Must call FBConstraint::FreezeSRT
*/
FBConstraint::FreezeSRT( pModel, pS, pR, pT );
}