本文整理汇总了C++中IParamBlock2::GetLocalName方法的典型用法代码示例。如果您正苦于以下问题:C++ IParamBlock2::GetLocalName方法的具体用法?C++ IParamBlock2::GetLocalName怎么用?C++ IParamBlock2::GetLocalName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IParamBlock2
的用法示例。
在下文中一共展示了IParamBlock2::GetLocalName方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: UpdateParameters
bool HoudiniEngineMesh::UpdateParameters(TimeValue t)
{
bool need_cook = false;
if ( assetId >= 0 )
{
hapi::Asset asset(assetId);
if (asset.isValid())
{
INode* node = this->GetINode();
if (node)
{
MSTR pname;
int subs = node->NumSubs();
for (int i = 0; i < subs; ++i)
{
pname = node->SubAnimName(i);
Animatable* anim = node->SubAnim(i);
if (anim)
{
int blocks = anim->NumParamBlocks();
for (int block = 0; block < blocks; ++block)
{
IParamBlock2 *pblock = anim->GetParamBlock(block);
if (pblock) {
TSTR pbname = pblock->GetLocalName();
int nNumParams = pblock->NumParams();
ParamID id;
std::map<std::string, hapi::Parm> params = asset.parmMap();
for (int i = 0; i < nNumParams; i++)
{
id = pblock->IndextoID(i);
MSTR pname = pblock->GetLocalName(id);
std::string hname = CStr::FromMSTR(pblock->GetLocalName(id)).data();
int index = (int)(hname[hname.size() - 1] - '0');
hname.pop_back();
if (std::string("__he_input") == hname)
{
// input node
INode* inputnode = pblock->GetINode(id, t);
if (inputnode)
{
need_cook = SetInputNode(index, inputnode) || need_cook;
}
}
else
{
// parameters
if (params.find(hname) != params.end())
{
hapi::Parm parm = params[hname];
if (HAPI_ParmInfo_IsInt(&parm.info()))
{
int value = pblock->GetInt(id, t);
if (value != parm.getIntValue(index))
{
parm.setIntValue(index, value);
need_cook = true;
}
}
else if (HAPI_ParmInfo_IsFloat(&parm.info()))
{
float value = pblock->GetFloat(id, t);
if (value != parm.getFloatValue(index))
{
parm.setFloatValue(index, value);
need_cook = true;
}
}
else if (HAPI_ParmInfo_IsString(&parm.info()))
{
std::string value = CStr::FromMSTR(pblock->GetStr(id, t));
if (value != parm.getStringValue(index))
{
parm.setStringValue(index, value.c_str());
need_cook = true;
}
}
}
}
}
}
}
}
}
}
}
}
return need_cook;
}
示例2: GetCustomAWDObjectSettings
//.........这里部分代码省略.........
if (paramtype==TYPE_BOOL)
returnData.export_this_children=(0 != pb->GetInt(pid));
}
}
}
free (className_ptr);
return returnData;
}
free (className_ptr);
}
}
Object * thisOBJ=(Object *)node_der->GetObjRef();
if(thisOBJ!=NULL){
if((thisOBJ->SuperClassID() == GEN_DERIVOB_CLASS_ID) || (thisOBJ->SuperClassID() == WSM_DERIVOB_CLASS_ID) || (thisOBJ->SuperClassID() == DERIVOB_CLASS_ID )){
IDerivedObject* thisDerObj=( IDerivedObject* ) thisOBJ;
if(thisDerObj!=NULL){
int nMods = thisDerObj->NumModifiers();
for (int m = 0; m<nMods; m++){
Modifier* node_mod = thisDerObj->GetModifier(m);
if (node_mod->IsEnabled()){
MSTR className;
node_mod->GetClassName(className);
char * className_ptr=W2A(className);
if (ATTREQ(className_ptr,"AWDObjectSettings")){
IParamBlock2* pb = GetParamBlock2ByIndex((ReferenceMaker*)node_mod, 0);
if(pb!=NULL){
int numBlockparams=pb->NumParams();
int p=0;
for (p=0; p<numBlockparams; p++) {
ParamID pid = pb->IndextoID(p);
ParamDef def = pb->GetParamDef(pid);
ParamType2 paramtype = pb->GetParameterType(pid);
char * paramName_ptr=W2A(def.int_name);
if (ATTREQ(paramName_ptr, "thisAWDID")){
//if (paramtype==TYPE_STRING)
// skeletonMod_ptr=W2A(pb->GetStr(pid));
}
if (ATTREQ(paramName_ptr, "export")){
if (paramtype==TYPE_BOOL)
returnData.export_this=(0 != pb->GetInt(pid));
}
if (ATTREQ(paramName_ptr, "exportChildren")){
if (paramtype==TYPE_BOOL)
returnData.export_this_children=(0 != pb->GetInt(pid));
}
}
}
free (className_ptr);
return returnData;
}
free (className_ptr);
}
}
}
}
}
}
while(obj->SuperClassID() != BASENODE_CLASS_ID) {
if (obj->SuperClassID() == GEN_DERIVOB_CLASS_ID) {
IDerivedObject *dobj = (IDerivedObject *)obj;
obj = dobj->GetObjRef(); // Get next object down mod-stack.
}
else {
break; // Failed.
}
}
ICustAttribContainer *attributes = obj->GetCustAttribContainer();
if (attributes) {
int a=0;
int numAttribs=0;
numAttribs = attributes->GetNumCustAttribs();
for (a=0; a<numAttribs; a++) {
int p=0;
int t=0;
CustAttrib *attr = attributes->GetCustAttrib(a);
for (t=0; t<attr->NumParamBlocks(); t++) {
IParamBlock2 *block = attr->GetParamBlock(t);
char * localName_ptr=W2A(block->GetLocalName());
if (ATTREQ(localName_ptr,"AWD_Export") ){
for (p=0; p<block->NumParams(); p++) {
ParamID pid = block->IndextoID(p);
ParamDef def = block->GetParamDef(pid);
char * paramName_ptr=W2A(def.int_name);
if (block->GetParameterType(pid)==TYPE_BOOL){
if (ATTREQ(paramName_ptr,"Export") )
returnData.export_this= (0 != block->GetInt(pid));
else if (ATTREQ(paramName_ptr,"ExportChildren") )
returnData.export_this_children= (0 != block->GetInt(pid));
}
free(paramName_ptr);
}
}
free(localName_ptr);
}
}
}
return returnData;
}
示例3: ExportUserAttributes
void MaxAWDExporter::ExportUserAttributes(Animatable *obj, AWDAttrElement *elem)
{
if (!opts->ExportAttributes())
return;
ICustAttribContainer *attributes = obj->GetCustAttribContainer();
if (attributes) {
int a=0;
int numAttribs=0;
numAttribs = attributes->GetNumCustAttribs();
for (a=0; a<numAttribs; a++) {
int k=0;
CustAttrib *attr = attributes->GetCustAttrib(a);
for (k=0; k<attr->NumParamBlocks(); k++) {
int p=0;
IParamBlock2 *block = attr->GetParamBlock(k);
if (block!=NULL){
char * blockName_ptr=W2A(block->GetLocalName());
if (ATTREQ(blockName_ptr,"AWDObjectSettingsParams") ){ }
// the next three should not occur yet, as we do not read Custom-properties on materials yet
else if (ATTREQ(blockName_ptr,"AWD_MaterialSettingsparams") ){ }
else if (ATTREQ(blockName_ptr,"AWD_EffectMethodsparams") ){ }
else if (ATTREQ(blockName_ptr,"AWDShadingParams") ){ }
else{
for (p=0; p<block->NumParams(); p++) {
ParamID pid = block->IndextoID(p);
Color col;
AColor acol;
Interval valid = FOREVER;
awd_uint16 len = 0;
AWD_field_type type = AWD_FIELD_FLOAT32;
AWD_field_ptr ptr;
ptr.v = NULL;
switch (block->GetParameterType(pid)) {
case TYPE_ANGLE:
case TYPE_PCNT_FRAC:
case TYPE_WORLD:
case TYPE_FLOAT:
type = AWD_FIELD_FLOAT64;
len = sizeof(awd_float64);
ptr.v = malloc(len);
*ptr.f64 = block->GetFloat(pid);
break;
case TYPE_TIMEVALUE:
case TYPE_INT:
type = AWD_FIELD_INT32;
len = sizeof(awd_int32);
ptr.v = malloc(len);
*ptr.i32 = block->GetInt(pid);
break;
case TYPE_BOOL:
type = AWD_FIELD_BOOL;
len = sizeof(awd_bool);
ptr.v = malloc(len);
*ptr.b = (0 != block->GetInt(pid));
break;
case TYPE_FILENAME:
case TYPE_STRING:
type = AWD_FIELD_STRING;
ptr.str = (char*)block->GetStr(pid);
len = strlen(ptr.str);
break;
case TYPE_RGBA:
type = AWD_FIELD_COLOR;
len = sizeof(awd_color);
col = block->GetColor(pid);
ptr.v = malloc(len);
*ptr.col = awdutil_float_color(col.r, col.g, col.b, 1.0);
break;
case TYPE_FRGBA:
type = AWD_FIELD_COLOR;
len = sizeof(awd_color);
acol = block->GetAColor(pid);
ptr.v = malloc(len);
*ptr.col = awdutil_float_color(acol.r, acol.g, acol.b, acol.a);
break;
}
if (ptr.v != NULL) {
ParamDef def = block->GetParamDef(pid);
if (ns == NULL) {
// Namespace has not yet been created; ns is a class
// variable that will be created only once and then
// reused for all user attributes.
char * ns_ptr=opts->AttributeNamespace();//dont free, as this will get freed in the opts delete
ns = new AWDNamespace(ns_ptr, strlen(ns_ptr));
awd->add_namespace(ns);
}
char * thisName=W2A(def.int_name);
elem->set_attr(ns, thisName, strlen(thisName)+1, ptr, len, type);
free(thisName);
//.........这里部分代码省略.........
示例4: SaveMetaData
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);
}
}