本文整理汇总了C++中id_name函数的典型用法代码示例。如果您正苦于以下问题:C++ id_name函数的具体用法?C++ id_name怎么用?C++ id_name使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了id_name函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: printST
void printST () {
int i;
char type[9] = "<none> ";
printf("SYMBOL TABLE - scope: %d\n", scope);
for (i = 0; i <= top; i++) {
//fprintf (stderr, "its scope: %d the scope: %d\n", ST[i]->scope, scope);
if (ST[i]->scope <= scope) { // only print if visible in current scope
int t = ST[i]->type;
if (t == Boolean) {
strcpy (type, "Boolean");
} else if ( t == Integer) {
strcpy (type, "Integer");
} else if (t == Array && ST[i]->arrayBaseT == Integer) {
strcpy (type, "Array:Integers");
} else if (t == Array && ST[i]->arrayBaseT == Boolean) {
strcpy (type, "Array:Booleans");
} else {
strcpy (type, "<none> ");
}
if (t != Array) {
printf ("%3d %-10s\t%-16s scope: %d\n", i,id_name (i), type, ST[i]->scope);
} else {
printf ("%3d %-10s\t%-16s scope: %d range: %d..%d\n",
i, id_name (i), type, ST[i]->scope, ST[i]->aStart, ST[i]->aEnd);
}
}
}
}
示例2: check_stmt
void check_stmt(tree t) {
for( ; t != NULL; t = t->next ) {
switch (t->kind) {
case If:
case Elseif:
if( check_expr(t->first) != Boolean ) {
print_error("Invalid IF statement.", t);
}
check_stmt(t->second);
check_stmt(t->third);
continue;
case Else:
check_stmt(t->first);
continue;
case Exit:
if(check_expr(t->first) != Boolean) {
print_error("exit when must produce a boolean.", t);
}
continue;
case Assign:
if(t->first->kind == Obracket | check_expr(t->first) != check_expr(t->second)) {
print_error("Invalid assignment statement.", t);
}
continue;
case For:
new_scope();
declare_var(id_name(t->first->value), Integer);
if(check_expr(t->second->first) != Integer | check_expr(t->second->second) != Integer)//TODO or add a range check
print_error("Invalid range.", t->second);
check_stmt(t->third);
end_scope();
continue;
case Declaration:;
if(t->second->kind == Array) {
for(tree cur = t->first; cur != NULL; cur = cur->next)
declare_array(id_name(cur->value), t->second->second->kind);
} else {
for(tree cur = t->first; cur != NULL; cur = cur->next)
declare_var(id_name(cur->value), t->second->kind);
}
continue;
case Declare:
new_scope();
check_stmt(t->first);
check_stmt(t->second);
end_scope();
continue;
default:
print_error("Token of this type not checked by check_stmt.", t);
continue;
}
}
}
示例3: translate_id
std::string ControllerExporter::add_morph_targets(Key *key, Object *ob)
{
std::string source_id = translate_id(id_name(ob)) + TARGETS_SOURCE_ID_SUFFIX;
COLLADASW::IdRefSource source(mSW);
source.setId(source_id);
source.setArrayId(source_id + ARRAY_ID_SUFFIX);
source.setAccessorCount(key->totkey - 1);
source.setAccessorStride(1);
COLLADASW::SourceBase::ParameterNameList ¶m = source.getParameterNameList();
param.push_back("IDREF");
source.prepareToAppendValues();
KeyBlock *kb = (KeyBlock *)key->block.first;
//skip the basis
kb = kb->next;
for (; kb; kb = kb->next) {
std::string geom_id = get_geometry_id(ob, false) + "_morph_" + translate_id(kb->name);
source.appendValues(geom_id);
}
source.finish();
return source_id;
}
示例4: cam_id
void CamerasExporter::operator()(Object *ob, Scene *sce)
{
// TODO: shiftx, shifty, YF_dofdist
Camera *cam = (Camera*)ob->data;
std::string cam_id(get_camera_id(ob));
std::string cam_name(id_name(cam));
switch (cam->type) {
case CAM_PANO:
case CAM_PERSP: {
COLLADASW::PerspectiveOptic persp(mSW);
persp.setXFov(RAD2DEGF(focallength_to_fov(cam->lens, cam->sensor_x)), "xfov");
persp.setAspectRatio((float)(sce->r.xsch)/(float)(sce->r.ysch), false, "aspect_ratio");
persp.setZFar(cam->clipend, false, "zfar");
persp.setZNear(cam->clipsta, false, "znear");
COLLADASW::Camera ccam(mSW, &persp, cam_id, cam_name);
addCamera(ccam);
break;
}
case CAM_ORTHO:
default:
{
COLLADASW::OrthographicOptic ortho(mSW);
ortho.setXMag(cam->ortho_scale, "xmag");
ortho.setAspectRatio((float)(sce->r.xsch)/(float)(sce->r.ysch), false, "aspect_ratio");
ortho.setZFar(cam->clipend, false, "zfar");
ortho.setZNear(cam->clipsta, false, "znear");
COLLADASW::Camera ccam(mSW, &ortho, cam_id, cam_name);
addCamera(ccam);
break;
}
}
}
示例5: id_name
void SceneExporter::exportScene(Scene *sce)
{
// <library_visual_scenes> <visual_scene>
std::string id_naming = id_name(sce);
openVisualScene(translate_id(id_naming), id_naming);
exportHierarchy(sce);
closeVisualScene();
closeLibrary();
}
示例6: name
void MaterialsExporter::operator()(Material *ma, Object *ob)
{
std::string name(id_name(ma));
openMaterial(get_material_id(ma), translate_id(name));
std::string efid = translate_id(name) + "-effect";
addInstanceEffect(COLLADASW::URI(COLLADABU::Utils::EMPTY_STRING, efid));
closeMaterial();
}
示例7: strtok
//Get proper name for bones
std::string AnimationExporter::getObjectBoneName(Object *ob, const FCurve *fcu)
{
//hard-way to derive the bone name from rna_path. Must find more compact method
std::string rna_path = std::string(fcu->rna_path);
char *boneName = strtok((char *)rna_path.c_str(), "\"");
boneName = strtok(NULL, "\"");
if (boneName != NULL)
return /*id_name(ob) + "_" +*/ std::string(boneName);
else
return id_name(ob);
}
示例8: texture
COLLADASW::ColorOrTexture EffectsExporter::createTexture(Image *ima,
std::string& uv_layer_name,
COLLADASW::Sampler *sampler
/*COLLADASW::Surface *surface*/)
{
COLLADASW::Texture texture(translate_id(id_name(ima)));
texture.setTexcoord(uv_layer_name);
//texture.setSurface(*surface);
texture.setSampler(*sampler);
COLLADASW::ColorOrTexture cot(texture);
return cot;
}
示例9: translate_id
void ArmatureExporter::write_bone_URLs(COLLADASW::InstanceController &ins,
Object *ob_arm,
Bone *bone)
{
if (bc_is_root_bone(bone, this->export_settings.get_deform_bones_only())) {
std::string joint_id = translate_id(id_name(ob_arm) + "_" + bone->name);
ins.addSkeleton(COLLADABU::URI(COLLADABU::Utils::EMPTY_STRING, joint_id));
}
else {
for (Bone *child = (Bone *)bone->childbase.first; child; child = child->next) {
write_bone_URLs(ins, ob_arm, child);
}
}
}
示例10: openLibrary
void EffectsExporter::exportEffects(Scene *sce)
{
this->scene = sce;
if (this->export_settings->export_texture_type == BC_TEXTURE_TYPE_MAT) {
if (hasEffects(sce)) {
MaterialFunctor mf;
openLibrary();
mf.forEachMaterialInExportSet<EffectsExporter>(sce, *this, this->export_settings->export_set);
closeLibrary();
}
}
else {
std::set<Object *> uv_textured_obs = bc_getUVTexturedObjects(sce, !this->export_settings->active_uv_only);
std::set<Image *> uv_images = bc_getUVImages(sce, !this->export_settings->active_uv_only);
if (uv_images.size() > 0) {
openLibrary();
std::set<Image *>::iterator uv_images_iter;
for (uv_images_iter = uv_images.begin();
uv_images_iter != uv_images.end();
uv_images_iter++)
{
Image *ima = *uv_images_iter;
std::string key(id_name(ima));
key = translate_id(key);
COLLADASW::Sampler sampler(COLLADASW::Sampler::SAMPLER_TYPE_2D,
key + COLLADASW::Sampler::SAMPLER_SID_SUFFIX,
key + COLLADASW::Sampler::SURFACE_SID_SUFFIX);
sampler.setImageId(key);
openEffect(key + "-effect");
COLLADASW::EffectProfile ep(mSW);
ep.setProfileType(COLLADASW::EffectProfile::COMMON);
ep.setShaderType(COLLADASW::EffectProfile::PHONG);
ep.setDiffuse(createTexture(ima, key, &sampler), false, "diffuse");
COLLADASW::ColorOrTexture cot = getcol(0, 0, 0, 1.0f);
ep.setSpecular(cot, false, "specular");
ep.openProfile();
ep.addProfileElements();
ep.addExtraTechniques(mSW);
ep.closeProfile();
closeEffect();
}
closeLibrary();
}
}
}
示例11: id_name
void AnimationExporter::dae_baked_animation(std::vector<float> &fra, Object *ob_arm, Bone *bone)
{
std::string ob_name = id_name(ob_arm);
std::string bone_name = bone->name;
char anim_id[200];
if (!fra.size())
return;
BLI_snprintf(anim_id, sizeof(anim_id), "%s_%s_%s", (char *)translate_id(ob_name).c_str(),
(char *)translate_id(bone_name).c_str(), "pose_matrix");
openAnimation(anim_id, COLLADABU::Utils::EMPTY_STRING);
// create input source
std::string input_id = create_source_from_vector(COLLADASW::InputSemantic::INPUT, fra, false, anim_id, "");
// create output source
std::string output_id;
output_id = create_4x4_source(fra, ob_arm, bone, anim_id);
// create interpolations source
std::string interpolation_id = fake_interpolation_source(fra.size(), anim_id, "");
std::string sampler_id = std::string(anim_id) + SAMPLER_ID_SUFFIX;
COLLADASW::LibraryAnimations::Sampler sampler(sw, sampler_id);
std::string empty;
sampler.addInput(COLLADASW::InputSemantic::INPUT, COLLADABU::URI(empty, input_id));
sampler.addInput(COLLADASW::InputSemantic::OUTPUT, COLLADABU::URI(empty, output_id));
// TODO create in/out tangents source
// this input is required
sampler.addInput(COLLADASW::InputSemantic::INTERPOLATION, COLLADABU::URI(empty, interpolation_id));
addSampler(sampler);
std::string target = translate_id(bone_name) + "/transform";
addChannel(COLLADABU::URI(empty, sampler_id), target);
closeAnimation();
}
示例12: handle_decls
static void handle_decls (tree t) {
int i;
if (scope == 1) {
for ( i = 0; i < 100; i++) {
ST[i] = (STEntry *) malloc( sizeof( STEntry* ));
}
// init the NoType entry of ST
ST[0]->index = 0;
ST[0]->type = NoType;
}
for (; t != NULL; t = t->next) {
int type = t->second->kind;
tree p;
if (type != Integer && type != Boolean && type != Array) {
fprintf( stderr, "Bad type in decl\n");
continue;
//return;
}
for (p = t->first; p != NULL; p = p->next) {
int pos = p->value;
static int test = 0;
if (ST[pos]->valid == true || ST[pos] != NULL && scope > 1) { // don't overwrite existing
push (ST[pos]); // push possible prev scope entry to stack
ST[pos] = (STEntry *) malloc( sizeof( STEntry*)); // new entry here
}
ST[pos]->index = pos;
ST[pos]->type = type;
ST[pos]->scope = scope;
char *tmp = id_name (p->value);
ST[pos]->name = tmp;
ST[pos]->valid = true;
ST[pos]->typeSize = -1;
ST[pos]->addr = -1;
if (type == Array) {
ST[pos]->aStart = t->second->first->first->value;
ST[pos]->aEnd = t->second->first->second->value;
ST[pos]->arrayBaseT = t->second->second->kind;
}
}
} // end for t = t->next
} // end handle_decls
示例13: printTree
void printTree (tree t) {
if (t == NULL) return;
for (; t != NULL; t = t->next) {
printf ("%*s%s", indent, "", tokName[t->kind]);
switch (t->kind) {
case Ident:
printf (" %s (%d)\n", id_name(t->value), t->value);
break;
case IntConst:
printf (" %d\n", t->value);
break;
default:
printf ("\n");
indent += 2;
printTree (t->first);
printTree (t->second);
printTree (t->third);
indent -= 2;
} // end switch
} // end for loop
} // end printTree()
示例14: bc_get_mesh_copy
void ControllerExporter::export_morph_controller(Object *ob, Key *key)
{
bool use_instantiation = this->export_settings->use_object_instantiation;
Mesh *me;
me = bc_get_mesh_copy(scene,
ob,
this->export_settings->export_mesh_type,
this->export_settings->apply_modifiers,
this->export_settings->triangulate);
std::string controller_name = id_name(ob) + "-morph";
std::string controller_id = get_controller_id(key, ob);
openMorph(controller_id, controller_name,
COLLADABU::URI(COLLADABU::Utils::EMPTY_STRING, get_geometry_id(ob, use_instantiation)));
std::string targets_id = add_morph_targets(key, ob);
std::string morph_weights_id = add_morph_weights(key, ob);
COLLADASW::TargetsElement targets(mSW);
COLLADASW::InputList &input = targets.getInputList();
input.push_back(COLLADASW::Input(COLLADASW::InputSemantic::MORPH_TARGET, // constant declared in COLLADASWInputList.h
COLLADASW::URI(COLLADABU::Utils::EMPTY_STRING, targets_id)));
input.push_back(COLLADASW::Input(COLLADASW::InputSemantic::MORPH_WEIGHT,
COLLADASW::URI(COLLADABU::Utils::EMPTY_STRING, morph_weights_id)));
targets.add();
BKE_libblock_free_us(G.main, me);
//support for animations
//can also try the base element and param alternative
add_weight_extras(key);
closeMorph();
closeController();
}
示例15: id
static int id(int argc, wchar_t **argv)
{
if (2 < argc)
usage();
NTSTATUS Result;
if (2 == argc)
{
if (L'S' == argv[1][0] && L'-' == argv[1][1] && L'1' == argv[1][2] && L'-' == argv[1][3])
Result = id_sid(argv[1]);
else
{
Result = id_uid(argv[1]);
if (STATUS_INVALID_PARAMETER == Result)
Result = id_name(argv[1]);
}
}
else
Result = id_user();
return FspWin32FromNtStatus(Result);
}