本文整理汇总了C++中BLI_sprintfN函数的典型用法代码示例。如果您正苦于以下问题:C++ BLI_sprintfN函数的具体用法?C++ BLI_sprintfN怎么用?C++ BLI_sprintfN使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了BLI_sprintfN函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: BLI_sprintfN
static char *rna_DynamicPaintBrushSettings_path(PointerRNA *ptr)
{
DynamicPaintBrushSettings *settings = (DynamicPaintBrushSettings*)ptr->data;
ModifierData *md= (ModifierData *)settings->pmd;
return BLI_sprintfN("modifiers[\"%s\"].brush_settings", md->name);
}
示例2: BLI_sprintfN
static char *rna_FluidSettings_path(PointerRNA *ptr)
{
FluidsimSettings *fss = (FluidsimSettings*)ptr->data;
ModifierData *md= (ModifierData *)fss->fmd;
return BLI_sprintfN("modifiers[\"%s\"].settings", md->name);
}
示例3: modifiers_findByType
static char *rna_ClothCollisionSettings_path(PointerRNA *ptr)
{
Object *ob= (Object*)ptr->id.data;
ModifierData *md= modifiers_findByType(ob, eModifierType_Cloth);
return md ? BLI_sprintfN("modifiers[%s].collision_settings", md->name) : NULL;
}
示例4: BLI_sprintfN
static char *rna_Bone_path(PointerRNA *ptr)
{
Bone *bone = (Bone*)ptr->data;
/* special exception for trying to get the path where ID-block is Object
* - this will be assumed to be from a Pose Bone...
*/
if (ptr->id.data) {
ID *id = (ID *)ptr->id.data;
if (GS(id->name) == ID_OB)
return BLI_sprintfN("pose.bones[\"%s\"].bone", bone->name);
}
/* from armature... */
return BLI_sprintfN("bones[\"%s\"]", bone->name);
}
示例5: BLI_strescape
static char *rna_ViewLayer_path(PointerRNA *ptr)
{
ViewLayer *srl = (ViewLayer *)ptr->data;
char name_esc[sizeof(srl->name) * 2];
BLI_strescape(name_esc, srl->name, sizeof(name_esc));
return BLI_sprintfN("view_layers[\"%s\"]", name_esc);
}
示例6: BLI_strescape
static char *rna_DynamicPaintBrushSettings_path(PointerRNA *ptr)
{
DynamicPaintBrushSettings *settings = (DynamicPaintBrushSettings *)ptr->data;
ModifierData *md = (ModifierData *)settings->pmd;
char name_esc[sizeof(md->name) * 2];
BLI_strescape(name_esc, md->name, sizeof(name_esc));
return BLI_sprintfN("modifiers[\"%s\"].brush_settings", name_esc);
}
示例7: CTX_wm_area
/* Temporary wrapper for driver operators for buttons to make it easier to create
* such drivers by rerouting all paths through the active object instead so that
* they will get picked up by the dependency system.
*
* < C: context pointer - for getting active data
* <> ptr: RNA pointer for property's datablock. May be modified as result of path remapping.
* < prop: RNA definition of property to add for
*
* > returns: MEM_alloc'd string representing the path to the property from the given PointerRNA
*/
static char *get_driver_path_hack(bContext *C, PointerRNA *ptr, PropertyRNA *prop)
{
ID *id = (ID *)ptr->id.data;
ScrArea *sa = CTX_wm_area(C);
/* get standard path which may be extended */
char *basepath = RNA_path_from_ID_to_property(ptr, prop);
char *path = basepath; /* in case no remapping is needed */
/* Remapping will only be performed in the Properties Editor, as only this
* restricts the subspace of options to the 'active' data (a manageable state)
*/
// TODO: watch out for pinned context?
if ((sa) && (sa->spacetype == SPACE_BUTS)) {
Object *ob = CTX_data_active_object(C);
if (ob && id) {
/* only id-types which can be remapped to go through objects should be considered */
switch (GS(id->name)) {
case ID_TE: /* textures */
{
Material *ma = give_current_material(ob, ob->actcol);
Tex *tex = give_current_material_texture(ma);
/* assumes: texture will only be shown if it is active material's active texture it's ok */
if ((ID *)tex == id) {
char name_esc_ma[(sizeof(ma->id.name) - 2) * 2];
char name_esc_tex[(sizeof(tex->id.name) - 2) * 2];
BLI_strescape(name_esc_ma, ma->id.name + 2, sizeof(name_esc_ma));
BLI_strescape(name_esc_tex, tex->id.name + 2, sizeof(name_esc_tex));
/* create new path */
// TODO: use RNA path functions to construct step by step instead?
// FIXME: maybe this isn't even needed anymore...
path = BLI_sprintfN("material_slots[\"%s\"].material.texture_slots[\"%s\"].texture.%s",
name_esc_ma, name_esc_tex, basepath);
/* free old one */
MEM_freeN(basepath);
}
break;
}
}
/* fix RNA pointer, as we've now changed the ID root by changing the paths */
if (basepath != path) {
/* rebase provided pointer so that it starts from object... */
RNA_pointer_create(&ob->id, ptr->type, ptr->data, ptr);
}
}
}
/* the path should now have been corrected for use */
return path;
}
示例8: BLI_strescape
static char *rna_FluidSettings_path(PointerRNA *ptr)
{
FluidsimSettings *fss = (FluidsimSettings *)ptr->data;
ModifierData *md = (ModifierData *)fss->fmd;
char name_esc[sizeof(md->name) * 2];
BLI_strescape(name_esc, md->name, sizeof(name_esc));
return BLI_sprintfN("modifiers[\"%s\"].settings", name_esc);
}
示例9: BLI_strescape
static char *rna_BoidRule_path(PointerRNA *ptr)
{
BoidRule *rule = (BoidRule *)ptr->data;
char name_esc[sizeof(rule->name) * 2];
BLI_strescape(name_esc, rule->name, sizeof(name_esc));
return BLI_sprintfN("rules[\"%s\"]", name_esc); /* XXX not unique */
}
示例10: BLI_strescape
static char *rna_GPencilLayer_path(PointerRNA *ptr)
{
bGPDlayer *gpl = (bGPDlayer *)ptr->data;
char name_esc[sizeof(gpl->info) * 2];
BLI_strescape(name_esc, gpl->info, sizeof(name_esc));
return BLI_sprintfN("layers[\"%s\"]", name_esc);
}
示例11: BLI_strescape
static char *rna_Bone_path(PointerRNA *ptr)
{
ID *id = ptr->id.data;
Bone *bone = (Bone *)ptr->data;
char name_esc[sizeof(bone->name) * 2];
BLI_strescape(name_esc, bone->name, sizeof(name_esc));
/* special exception for trying to get the path where ID-block is Object
* - this will be assumed to be from a Pose Bone...
*/
if (id) {
if (GS(id->name) == ID_OB) {
return BLI_sprintfN("pose.bones[\"%s\"].bone", name_esc);
}
}
/* from armature... */
return BLI_sprintfN("bones[\"%s\"]", name_esc);
}
示例12: BLI_sprintfN
static char *rna_BoidSettings_path(PointerRNA *ptr)
{
BoidSettings *boids = (BoidSettings *)ptr->data;
if (particle_id_check(ptr)) {
ParticleSettings *part = (ParticleSettings *)ptr->id.data;
if (part->boids == boids)
return BLI_sprintfN("boids");
}
return NULL;
}
示例13: BKE_collection_new_name_get
/**
* The automatic/fallback name of a new collection.
*/
void BKE_collection_new_name_get(Collection *collection_parent, char *rname)
{
char *name;
if (!collection_parent) {
name = BLI_strdup("Collection");
}
else if (collection_parent->flag & COLLECTION_IS_MASTER) {
name = BLI_sprintfN("Collection %d", BLI_listbase_count(&collection_parent->children) + 1);
}
else {
const int number = BLI_listbase_count(&collection_parent->children) + 1;
const int digits = integer_digits_i(number);
const int max_len = sizeof(collection_parent->id.name) - 1 /* NULL terminator */ -
(1 + digits) /* " %d" */ - 2 /* ID */;
name = BLI_sprintfN("%.*s %d", max_len, collection_parent->id.name + 2, number);
}
BLI_strncpy(rname, name, MAX_NAME);
MEM_freeN(name);
}
示例14: rna_ShapeKey_find_key
static char *rna_ShapeKeyPoint_path(PointerRNA *ptr)
{
ID *id = (ID *)ptr->id.data;
Key *key = rna_ShapeKey_find_key(ptr->id.data);
KeyBlock *kb;
float *point = (float *)ptr->data;
/* if we can get a key block, we can construct a path */
kb = rna_ShapeKeyData_find_keyblock(key, point);
if (kb) {
int index = rna_ShapeKeyPoint_get_index(key, kb, point);
if (GS(id->name) == ID_KE)
return BLI_sprintfN("key_blocks[\"%s\"].data[%d]", kb->name, index);
else
return BLI_sprintfN("shape_keys.key_blocks[\"%s\"].data[%d]", kb->name, index);
}
else
return NULL; // XXX: there's really no way to resolve this...
}
示例15: switch
char *BKE_linestyle_path_to_color_ramp(FreestyleLineStyle *linestyle, ColorBand *color_ramp)
{
LineStyleModifier *m;
bool found = false;
for (m = (LineStyleModifier *)linestyle->color_modifiers.first; m; m = m->next) {
switch (m->type) {
case LS_MODIFIER_ALONG_STROKE:
if (color_ramp == ((LineStyleColorModifier_AlongStroke *)m)->color_ramp)
found = true;
break;
case LS_MODIFIER_DISTANCE_FROM_CAMERA:
if (color_ramp == ((LineStyleColorModifier_DistanceFromCamera *)m)->color_ramp)
found = true;
break;
case LS_MODIFIER_DISTANCE_FROM_OBJECT:
if (color_ramp == ((LineStyleColorModifier_DistanceFromObject *)m)->color_ramp)
found = true;
break;
case LS_MODIFIER_MATERIAL:
if (color_ramp == ((LineStyleColorModifier_Material *)m)->color_ramp)
found = true;
break;
case LS_MODIFIER_TANGENT:
if (color_ramp == ((LineStyleColorModifier_Tangent *)m)->color_ramp)
found = true;
break;
case LS_MODIFIER_NOISE:
if (color_ramp == ((LineStyleColorModifier_Noise *)m)->color_ramp)
found = true;
break;
case LS_MODIFIER_CREASE_ANGLE:
if (color_ramp == ((LineStyleColorModifier_CreaseAngle *)m)->color_ramp)
found = true;
break;
case LS_MODIFIER_CURVATURE_3D:
if (color_ramp == ((LineStyleColorModifier_Curvature_3D *)m)->color_ramp)
found = true;
break;
}
if (found) {
char name_esc[sizeof(m->name) * 2];
BLI_strescape(name_esc, m->name, sizeof(name_esc));
return BLI_sprintfN("color_modifiers[\"%s\"].color_ramp", name_esc);
}
}
printf("BKE_linestyle_path_to_color_ramp: No color ramps correspond to the given pointer.\n");
return NULL;
}