本文整理汇总了C++中id_name函数的典型用法代码示例。如果您正苦于以下问题:C++ id_name函数的具体用法?C++ id_name怎么用?C++ id_name使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了id_name函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
}
}
}
开发者ID:bdlindsay,项目名称:cs4280Project,代码行数:28,代码来源:check.c
示例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;
}
}
}
开发者ID:coweatyou,项目名称:school,代码行数:54,代码来源:typecheck.c
示例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;
}
开发者ID:DarkDefender,项目名称:blender-npr-tess2,代码行数:28,代码来源:ControllerExporter.cpp
示例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;
}
}
}
开发者ID:nttputus,项目名称:blensor,代码行数:33,代码来源:CameraExporter.cpp
示例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();
}
开发者ID:vanangamudi,项目名称:blender-main,代码行数:9,代码来源:SceneExporter.cpp
示例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();
}
开发者ID:mgschwan,项目名称:blensor,代码行数:11,代码来源:MaterialExporter.cpp
示例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);
}
开发者ID:vanangamudi,项目名称:blender-main,代码行数:14,代码来源:AnimationExporter.cpp
示例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;
}
开发者ID:danielmarg,项目名称:blender-main,代码行数:14,代码来源:EffectExporter.cpp
示例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);
}
}
}
开发者ID:dfelinto,项目名称:blender,代码行数:14,代码来源:ArmatureExporter.cpp
示例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();
}
}
}
开发者ID:Ichthyostega,项目名称:blender,代码行数:48,代码来源:EffectExporter.cpp
示例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();
}
开发者ID:SuriyaaKudoIsc,项目名称:blender-git,代码行数:43,代码来源:AnimationExporter.cpp
示例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
开发者ID:bdlindsay,项目名称:cs4280Project,代码行数:41,代码来源:check.c
示例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()
开发者ID:bdlindsay,项目名称:cs4280Project,代码行数:21,代码来源:tree.c
示例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();
}
开发者ID:DarkDefender,项目名称:blender-npr-tess2,代码行数:39,代码来源:ControllerExporter.cpp
示例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);
}
开发者ID:billziss-gh,项目名称:winfsp,代码行数:23,代码来源:fsptool.c
示例16: openLibrary
void MaterialsExporter::exportMaterials(Scene *sce)
{
if (this->export_settings->export_texture_type == BC_TEXTURE_TYPE_MAT)
{
if (hasMaterials(sce)) {
openLibrary();
MaterialFunctor mf;
mf.forEachMaterialInExportSet<MaterialsExporter>(sce, *this, this->export_settings->export_set);
closeLibrary();
}
}
else {
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 matid(id_name(ima));
openMaterial(get_material_id_from_id(matid), translate_id(matid));
std::string efid = translate_id(matid) + "-effect";
addInstanceEffect(COLLADASW::URI(COLLADABU::Utils::EMPTY_STRING, efid));
closeMaterial();
}
closeLibrary();
}
}
}
开发者ID:mgschwan,项目名称:blensor,代码行数:36,代码来源:MaterialExporter.cpp
示例17: bc_get_assigned_armature
void SceneExporter::writeNodes(Object *ob, Scene *sce)
{
// Add associated armature first if available
bool armature_exported = false;
Object *ob_arm = bc_get_assigned_armature(ob);
if (ob_arm != NULL) {
armature_exported = bc_is_in_Export_set(this->export_settings->export_set, ob_arm);
if (armature_exported && bc_is_marked(ob_arm)) {
bc_remove_mark(ob_arm);
writeNodes(ob_arm, sce);
armature_exported = true;
}
}
COLLADASW::Node colladaNode(mSW);
colladaNode.setNodeId(translate_id(id_name(ob)));
colladaNode.setNodeName(translate_id(id_name(ob)));
colladaNode.setType(COLLADASW::Node::NODE);
colladaNode.start();
std::list<Object *> child_objects;
// list child objects
LinkNode *node;
for (node=this->export_settings->export_set; node; node=node->next) {
// cob - child object
Object *cob = (Object *)node->link;
if (cob->parent == ob) {
switch (cob->type) {
case OB_MESH:
case OB_CAMERA:
case OB_LAMP:
case OB_EMPTY:
case OB_ARMATURE:
if (bc_is_marked(cob))
child_objects.push_back(cob);
break;
}
}
}
if (ob->type == OB_MESH && armature_exported)
// for skinned mesh we write obmat in <bind_shape_matrix>
TransformWriter::add_node_transform_identity(colladaNode);
else
TransformWriter::add_node_transform_ob(colladaNode, ob);
// <instance_geometry>
if (ob->type == OB_MESH) {
bool instance_controller_created = false;
if (armature_exported) {
instance_controller_created = arm_exporter->add_instance_controller(ob);
}
if (!instance_controller_created) {
COLLADASW::InstanceGeometry instGeom(mSW);
instGeom.setUrl(COLLADASW::URI(COLLADABU::Utils::EMPTY_STRING, get_geometry_id(ob, this->export_settings->use_object_instantiation)));
InstanceWriter::add_material_bindings(instGeom.getBindMaterial(), ob, this->export_settings->active_uv_only);
instGeom.add();
}
}
// <instance_controller>
else if (ob->type == OB_ARMATURE) {
arm_exporter->add_armature_bones(ob, sce, this, child_objects);
}
// <instance_camera>
else if (ob->type == OB_CAMERA) {
COLLADASW::InstanceCamera instCam(mSW, COLLADASW::URI(COLLADABU::Utils::EMPTY_STRING, get_camera_id(ob)));
instCam.add();
}
// <instance_light>
else if (ob->type == OB_LAMP) {
COLLADASW::InstanceLight instLa(mSW, COLLADASW::URI(COLLADABU::Utils::EMPTY_STRING, get_light_id(ob)));
instLa.add();
}
// empty object
else if (ob->type == OB_EMPTY) { // TODO: handle groups (OB_DUPLIGROUP
if ((ob->transflag & OB_DUPLIGROUP) == OB_DUPLIGROUP && ob->dup_group) {
GroupObject *go = NULL;
Group *gr = ob->dup_group;
/* printf("group detected '%s'\n", gr->id.name+2); */
for (go = (GroupObject *)(gr->gobject.first); go; go = go->next) {
printf("\t%s\n", go->ob->id.name);
}
}
}
if (ob->type == OB_ARMATURE) {
colladaNode.end();
}
for (std::list<Object *>::iterator i = child_objects.begin(); i != child_objects.end(); ++i) {
if (bc_is_marked(*i)) {
//.........这里部分代码省略.........
开发者ID:vanangamudi,项目名称:blender-main,代码行数:101,代码来源:SceneExporter.cpp
示例18: get_morph_id
std::string get_morph_id(Object *ob)
{
return translate_id(id_name(ob)) + "-morph";
}
开发者ID:SuriyaaKudoIsc,项目名称:blender-git,代码行数:4,代码来源:collada_internal.cpp
示例19: get_material_id
std::string get_material_id(Material *mat)
{
return translate_id(id_name(mat)) + "-material";
}
开发者ID:SuriyaaKudoIsc,项目名称:blender-git,代码行数:4,代码来源:collada_internal.cpp
示例20: get_camera_id
std::string get_camera_id(Object *ob)
{
return translate_id(id_name(ob)) + "-camera";
}
开发者ID:SuriyaaKudoIsc,项目名称:blender-git,代码行数:4,代码来源:collada_internal.cpp
注:本文中的id_name函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论