// // Load the modifier settings // void ModifierSettings::LoadState(FScope *fScope) { // Load the settings FScope *sScope; while ((sScope = fScope->NextFunction()) != NULL) { switch (sScope->NameCrc()) { case 0x1F2EDF02: // "Set" { const char *modifier = sScope->NextArgString(); const char *setting = sScope->NextArgString(); U8 modifierIndex; U8 settingIndex; if ( FindModifier(Crc::CalcStr(modifier), &modifierIndex) && FindSetting(modifierIndex, Crc::CalcStr(setting), &settingIndex)) { Set(modifierIndex, settingIndex); } else { LOG_WARN(("Invalid modifier setting combination %s:%s", modifier, setting)) } break; } } } }
bool RBExport::ProcessSkin( INode* node ) { m_pSkin = NULL; m_pSkinData = NULL; m_pPhysique = NULL; Modifier* pMod = NULL; // check for 'Skin' modifier pMod = FindModifier( node, SKIN_CLASSID ); if (pMod) { m_pSkin = (ISkin*) pMod->GetInterface( I_SKIN ); if (!m_pSkin) return false; m_pSkinData = m_pSkin->GetContextInterface( node ); // build bone reindexing table for the skin int nBones = m_pSkin->GetNumBones(); for (int i = 0; i < nBones; i++) { INode* pBoneNode = m_pSkin->GetBone( i ); ExpNode* pExportedBone = GetExportedNode( pBoneNode ); m_pCurExpNode->m_BoneIdx.push_back( pExportedBone->m_Index ); } return true; } // check for physique modifier pMod = FindModifier( node, Class_ID( PHYSIQUE_CLASS_ID_A, PHYSIQUE_CLASS_ID_B ) ); if (pMod) { IPhysiqueExport* iPExport = (IPhysiqueExport*)pMod->GetInterface( I_PHYINTERFACE ); if (!iPExport) return false; m_pPhysique = (IPhyContextExport*) iPExport->GetContextInterface( node ); if (!m_pPhysique) return false; // convert to rigid with blending m_pPhysique->ConvertToRigid ( TRUE ); m_pPhysique->AllowBlending ( TRUE ); return true; } return false; } // RBExport::ProcessSkin
bool UnlockManager::ModifierIsLocked( const CString &sOneMod ) const { if( !PREFSMAN->m_bUseUnlockSystem ) return false; const UnlockEntry *p = FindModifier( sOneMod ); if( p == NULL ) return false; return p->IsLocked(); }
void EC_AvatarAppearance::SetModifierValue(const std::string& name, AppearanceModifier::ModifierType type, Real value) { if (value < 0.0) value = 0.0; if (value > 1.0) value = 1.0; AppearanceModifier* mod = FindModifier(name, type); if (mod) { mod->value_ = value; mod->manual_ = true; } }
bool AlembicCustomAttributesEx::defineCustomAttributes(INode* node, Abc::OCompoundProperty& compoundProp, const AbcA::MetaData& metadata, unsigned int animatedTs) { Modifier* pMod = FindModifier(node, (char*)this->modName.c_str()); if(!pMod){ return false; } ICustAttribContainer* cont = pMod->GetCustAttribContainer(); if(!cont){ return false; } for(int i=0; i<cont->GetNumCustAttribs(); i++) { CustAttrib* ca = cont->GetCustAttrib(i); std::string name = EC_MCHAR_to_UTF8( ca->GetName() ); pblock = ca->GetParamBlockByID(0); break; } if(!pblock){ return false; } for(int i=0, nNumParams = pblock->NumParams(); i<nNumParams; i++){ ParamID id = pblock->IndextoID(i); MSTR name = pblock->GetLocalName(id, 0); std::stringstream propName; propName<<EC_MSTR_to_UTF8(name); ParamType2 type = pblock->GetParameterType(id); if(type == TYPE_STRING){ customProps[propName.str()] = new Abc::OStringProperty(compoundProp, propName.str().c_str(), metadata, animatedTs ); } else if(type == TYPE_FLOAT){ customProps[propName.str()] = new Abc::OFloatProperty(compoundProp, propName.str().c_str(), metadata, animatedTs ); } else if(type == TYPE_INT){ customProps[propName.str()] = new Abc::OInt32Property(compoundProp, propName.str().c_str(), metadata, animatedTs ); } } return true; }
void EC_AvatarAppearance::SetMasterModifierValue(const std::string& name, Real value) { if (value < 0.0) value = 0.0; if (value > 1.0) value = 1.0; for (uint i = 0; i < master_modifiers_.size(); ++i) { if (master_modifiers_[i].name_ == name) { master_modifiers_[i].value_ = value; for (uint j = 0; j < master_modifiers_[i].modifiers_.size(); ++j) { AppearanceModifier* mod = FindModifier(master_modifiers_[i].modifiers_[j].name_, master_modifiers_[i].modifiers_[j].type_); if (mod) mod->manual_ = false; } CalculateMasterModifiers(); return; } } }
void EC_AvatarAppearance::CalculateMasterModifiers() { for (uint i = 0; i < morph_modifiers_.size(); ++i) morph_modifiers_[i].ResetAccumulation(); for (uint i = 0; i < bone_modifiers_.size(); ++i) bone_modifiers_[i].ResetAccumulation(); for (uint i = 0; i < master_modifiers_.size(); ++i) { for (uint j = 0; j < master_modifiers_[i].modifiers_.size(); ++j) { AppearanceModifier* mod = FindModifier(master_modifiers_[i].modifiers_[j].name_, master_modifiers_[i].modifiers_[j].type_); if (mod) { float slave_value = master_modifiers_[i].modifiers_[j].GetMappedValue(master_modifiers_[i].value_); mod->AccumulateValue(slave_value, master_modifiers_[i].modifiers_[j].mode_ == SlaveModifier::Average); } } } }
int UnlockManager::FindCode( const CString &sName ) const { const UnlockEntry *pEntry = NULL; const Song *pSong = SONGMAN->FindSong( sName ); if( pSong != NULL ) pEntry = FindSong( pSong ); const Course *pCourse = SONGMAN->FindCourse( sName ); if( pCourse != NULL ) pEntry = FindCourse( pCourse ); if( pEntry == NULL ) pEntry = FindModifier( sName ); if( pEntry == NULL ) { LOG->Warn( "Couldn't find locked entry \"%s\"", sName.c_str() ); return -1; } return pEntry->m_iCode; }
void SaveMetaData(INode* node, AlembicObject* object) { if (object == NULL) { return; } if (object->GetNumSamples() > 0) { return; } Modifier* pMod = FindModifier(node, Class_ID(0xd81fc3e, 0x1e4eacf5)); bool bReadCustAttribs = false; if (!pMod) { pMod = FindModifier(node, "Metadata"); bReadCustAttribs = true; } if (!pMod) { return; } std::vector<std::string> metaData; if (bReadCustAttribs) { ICustAttribContainer* cont = pMod->GetCustAttribContainer(); if (!cont) { return; } for (int i = 0; i < cont->GetNumCustAttribs(); i++) { CustAttrib* ca = cont->GetCustAttrib(i); std::string name = EC_MCHAR_to_UTF8(ca->GetName()); IParamBlock2* pblock = ca->GetParamBlockByID(0); if (pblock) { int nNumParams = pblock->NumParams(); for (int i = 0; i < nNumParams; i++) { ParamID id = pblock->IndextoID(i); // MSTR name = pblock->GetLocalName(id, 0); MSTR value = pblock->GetStr(id, 0); metaData.push_back(EC_MSTR_to_UTF8(value)); } } } } else { IParamBlock2* pblock = pMod->GetParamBlockByID(0); if (pblock && pblock->NumParams() == 1) { ParamID id = pblock->IndextoID(0); MSTR name = pblock->GetLocalName(id, 0); int nSize = pblock->Count(id); for (int i = 0; i < nSize; i++) { MSTR value = pblock->GetStr(id, 0, i); metaData.push_back(EC_MSTR_to_UTF8(value)); } } } if (metaData.size() > 0) { Abc::OStringArrayProperty metaDataProperty = Abc::OStringArrayProperty( object->GetCompound(), ".metadata", object->GetCompound().getMetaData(), object->GetCurrentJob()->GetAnimatedTs()); Abc::StringArraySample metaDataSample(&metaData.front(), metaData.size()); metaDataProperty.set(metaDataSample); } }