本文整理汇总了C++中Animatable::ClassID方法的典型用法代码示例。如果您正苦于以下问题:C++ Animatable::ClassID方法的具体用法?C++ Animatable::ClassID怎么用?C++ Animatable::ClassID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Animatable
的用法示例。
在下文中一共展示了Animatable::ClassID方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getController
AlembicFloatController* getController(Animatable* pObj,
const std::string& identifier,
const std::string& camProperty, int i,
int j, int k = -1)
{
if (i >= pObj->NumSubs()) {
return NULL;
}
Animatable* an = pObj->SubAnim(i);
if (!an || j >= an->NumSubs()) {
return NULL;
}
an = an->SubAnim(j);
if (k != -1) {
if (!an || k >= an->NumSubs()) {
return NULL;
}
an = an->SubAnim(k);
}
Class_ID cid = an->ClassID();
if (!an || an->ClassID() != ALEMBIC_FLOAT_CONTROLLER_CLASSID) {
return NULL;
}
AlembicFloatController* pControl = static_cast<AlembicFloatController*>(an);
TimeValue zero(0);
std::string contIdentifier =
EC_MCHAR_to_UTF8(pControl->GetParamBlockByID(0)->GetStr(
GetParamIdByName(pControl, 0, "identifier"), zero));
if (strcmp(contIdentifier.c_str(), identifier.c_str()) != 0) {
return NULL;
}
std::string contCamProperty =
EC_MCHAR_to_UTF8(pControl->GetParamBlockByID(0)->GetStr(
GetParamIdByName(pControl, 0, "property"), zero));
if (strcmp(contCamProperty.c_str(), camProperty.c_str()) != 0) {
return NULL;
}
return pControl;
}
示例2: AlembicImport_SetupVisControl
///////////////////////////////////////////////////////////////////////////////////////////////////
// AlembicImport_vis
///////////////////////////////////////////////////////////////////////////////////////////////////
void AlembicImport_SetupVisControl(std::string const &file,
std::string const &identifier,
AbcG::IObject &obj, INode *pNode,
alembic_importoptions &options)
{
if (!pNode) {
return;
}
AbcG::IVisibilityProperty visibilityProperty = getAbcVisibilityProperty(obj);
bool isConstant = true;
if (visibilityProperty.valid()) {
isConstant = visibilityProperty.isConstant();
}
if (isConstant) {
Animatable *pAnimatable = pNode->SubAnim(0);
if (pAnimatable &&
pAnimatable->ClassID() == ALEMBIC_VISIBILITY_CONTROLLER_CLASSID) {
pNode->DeleteSubAnim(0);
}
alembic_fillvis_options visFillOptions;
visFillOptions.pIObj = &obj;
visFillOptions.dTicks = 0;
visFillOptions.bOldVisibility = true;
AlembicImport_FillInVis(visFillOptions);
BOOL bVis = visFillOptions.bVisibility ? TRUE : FALSE;
float fBool = bVis ? 1.0f : 0.0f;
pNode->SetVisibility(0, fBool);
}
else {
// Create the xform modifier
AlembicVisibilityController *pControl =
static_cast<AlembicVisibilityController *>(
GetCOREInterface()->CreateInstance(
CTRL_FLOAT_CLASS_ID, ALEMBIC_VISIBILITY_CONTROLLER_CLASSID));
// Set the alembic id
TimeValue t = GET_MAX_INTERFACE()->GetTime();
TimeValue zero(0);
// Set the alembic id
pControl->GetParamBlockByID(0)->SetValue(
GetParamIdByName(pControl, 0, "path"), zero,
EC_UTF8_to_TCHAR(file.c_str()));
pControl->GetParamBlockByID(0)->SetValue(
GetParamIdByName(pControl, 0, "identifier"), zero,
EC_UTF8_to_TCHAR(identifier.c_str()));
pControl->GetParamBlockByID(0)->SetValue(
GetParamIdByName(pControl, 0, "time"), zero, 0.0f);
pControl->GetParamBlockByID(0)->SetValue(
GetParamIdByName(pControl, 0, "muted"), zero, FALSE);
// Add the modifier to the node
pNode->SetVisController(pControl);
if (!isConstant) {
std::stringstream controllerName;
controllerName << GET_MAXSCRIPT_NODE(pNode);
controllerName << "mynode2113.visibility.controller.time";
AlembicImport_ConnectTimeControl(controllerName.str().c_str(), options);
}
}
}
示例3: Apply
void RandKeysUtil::Apply()
{
BOOL timeMode = iu->GetMajorMode()==TVMODE_EDITTIME;
BOOL fcurveMode = iu->GetMajorMode()==TVMODE_EDITFCURVE;
Interval iv = iu->GetTimeSelection();
if (!doTime && !doVal) return;
theHold.Begin();
// Turn animation on
SuspendAnimate();
AnimateOn();
for (int i=0; i<iu->GetNumTracks(); i++) {
if ((timeMode||fcurveMode) && !iu->IsSelected(i)) continue;
// Get Interfaces
Animatable *anim = iu->GetAnim(i);
Animatable *client = iu->GetClient(i);
int subNum = iu->GetSubNum(i);
Control *cont = GetControlInterface(anim);
IKeyControl *ikc = GetKeyControlInterface(anim);
IKey *key = GetKeyPointer(anim->SuperClassID(),anim->ClassID());
if (!ikc || !cont || !key) continue;
if (fcurveMode && !anim->IsCurveSelected()) continue;
// Get the param dim
float min = negVal, max = posVal;
ParamDimension *dim = client->GetParamDimension(subNum);
if (dim) {
min = dim->UnConvert(min);
max = dim->UnConvert(max);
}
for (int j=0; j<ikc->GetNumKeys(); j++) {
// Get the key data
ikc->GetKey(j,key);
// Check if it's selected
if (timeMode && !iv.InInterval(key->time)) continue;
if (!timeMode && !(key->flags&IKEY_SELECTED)) continue;
// Randomize time
if (doTime) {
key->time = (int)CompRand(
float(key->time-negTime),
float(key->time+posTime));
ikc->SetKey(j,key);
}
}
if (doTime) ikc->SortKeys();
for (j=0; j<ikc->GetNumKeys(); j++) {
// Get the key data
ikc->GetKey(j,key);
// Check if it's selected
if (timeMode && !iv.InInterval(key->time)) continue;
if (!timeMode && !(key->flags&IKEY_SELECTED)) continue;
// Randomize value
if (doVal) {
Point3 pt, ang;
Point4 p4;
float f;
Quat q;
ScaleValue s;
BOOL doX, doY, doZ, doW;
doX = doY = doZ = doW = TRUE;
if (!fcurveMode) {
if (!(key->flags&IKEY_XSEL)) doX = FALSE;
if (!(key->flags&IKEY_YSEL)) doY = FALSE;
if (!(key->flags&IKEY_ZSEL)) doZ = FALSE;
if (!(key->flags&IKEY_WSEL)) doW = FALSE;
}
switch (anim->SuperClassID()) {
case CTRL_FLOAT_CLASS_ID:
cont->GetValue(key->time,&f,FOREVER);
f = CompRand(f-min,f+max);
cont->SetValue(key->time,&f);
break;
case CTRL_POSITION_CLASS_ID:
case CTRL_POINT3_CLASS_ID:
cont->GetValue(key->time,&pt,FOREVER);
if (doX) pt.x = CompRand(pt.x-min,pt.x+max);
if (doY) pt.y = CompRand(pt.y-min,pt.y+max);
if (doZ) pt.z = CompRand(pt.z-min,pt.z+max);
cont->SetValue(key->time,&pt);
break;
case CTRL_POINT4_CLASS_ID:
cont->GetValue(key->time,&p4,FOREVER);
if (doX) p4.x = CompRand(p4.x-min,p4.x+max);
if (doY) p4.y = CompRand(p4.y-min,p4.y+max);
if (doZ) p4.z = CompRand(p4.z-min,p4.z+max);
if (doW) p4.w = CompRand(p4.w-min,p4.w+max);
cont->SetValue(key->time,&p4);
//.........这里部分代码省略.........