forked from bartvdbraak/blender
use BLI_strncpy and BLI_snprintf when the size of the string is known.
fix for sequencer unique naming which was missed with string length update.
This commit is contained in:
parent
dcef7346eb
commit
e10fd04db0
@ -198,6 +198,8 @@ void BLF_dir_free(char **dirs, int count);
|
||||
#define BLF_MATRIX (1<<4)
|
||||
#define BLF_ASPECT (1<<5)
|
||||
|
||||
#define BLF_DRAW_STR_DUMMY_MAX 1024
|
||||
|
||||
// XXX, bad design
|
||||
extern int blf_mono_font;
|
||||
extern int blf_mono_font_render; // dont mess drawing with render threads.
|
||||
|
@ -1503,7 +1503,7 @@ BoidState *boid_new_state(BoidSettings *boids)
|
||||
|
||||
state->id = boids->last_state_id++;
|
||||
if(state->id)
|
||||
sprintf(state->name, "State %i", state->id);
|
||||
BLI_snprintf(state->name, sizeof(state->name), "State %i", state->id);
|
||||
else
|
||||
strcpy(state->name, "State");
|
||||
|
||||
|
@ -476,22 +476,22 @@ void flip_side_name(char name[MAX_VGROUP_NAME], const char from_name[MAX_VGROUP_
|
||||
switch(name[0]) {
|
||||
case 'l':
|
||||
strcpy(replace, "r");
|
||||
strcpy(suffix, name+1);
|
||||
BLI_strncpy(suffix, name+1, sizeof(suffix));
|
||||
prefix[0]= 0;
|
||||
break;
|
||||
case 'r':
|
||||
strcpy(replace, "l");
|
||||
strcpy(suffix, name+1);
|
||||
BLI_strncpy(suffix, name+1, sizeof(suffix));
|
||||
prefix[0]= 0;
|
||||
break;
|
||||
case 'L':
|
||||
strcpy(replace, "R");
|
||||
strcpy(suffix, name+1);
|
||||
BLI_strncpy(suffix, name+1, sizeof(suffix));
|
||||
prefix[0]= 0;
|
||||
break;
|
||||
case 'R':
|
||||
strcpy(replace, "L");
|
||||
strcpy(suffix, name+1);
|
||||
BLI_strncpy(suffix, name+1, sizeof(suffix));
|
||||
prefix[0]= 0;
|
||||
break;
|
||||
}
|
||||
@ -501,29 +501,29 @@ void flip_side_name(char name[MAX_VGROUP_NAME], const char from_name[MAX_VGROUP_
|
||||
index = BLI_strcasestr(prefix, "right");
|
||||
if (index==prefix || index==prefix+len-5) {
|
||||
if (index[0]=='r')
|
||||
strcpy (replace, "left");
|
||||
strcpy(replace, "left");
|
||||
else {
|
||||
if (index[1]=='I')
|
||||
strcpy (replace, "LEFT");
|
||||
strcpy(replace, "LEFT");
|
||||
else
|
||||
strcpy (replace, "Left");
|
||||
strcpy(replace, "Left");
|
||||
}
|
||||
*index= 0;
|
||||
strcpy (suffix, index+5);
|
||||
BLI_strncpy(suffix, index+5, sizeof(suffix));
|
||||
}
|
||||
else {
|
||||
index = BLI_strcasestr(prefix, "left");
|
||||
if (index==prefix || index==prefix+len-4) {
|
||||
if (index[0]=='l')
|
||||
strcpy (replace, "right");
|
||||
strcpy(replace, "right");
|
||||
else {
|
||||
if (index[1]=='E')
|
||||
strcpy (replace, "RIGHT");
|
||||
strcpy(replace, "RIGHT");
|
||||
else
|
||||
strcpy (replace, "Right");
|
||||
strcpy(replace, "Right");
|
||||
}
|
||||
*index= 0;
|
||||
strcpy (suffix, index+4);
|
||||
BLI_strncpy(suffix, index + 4, sizeof(suffix));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -361,8 +361,8 @@ void dynamicPaintSurface_updateType(struct DynamicPaintSurface *surface)
|
||||
surface->depth_clamp = 1.0f;
|
||||
}
|
||||
else {
|
||||
sprintf(surface->output_name, "dp_");
|
||||
strcpy(surface->output_name2,surface->output_name);
|
||||
strcpy(surface->output_name, "dp_");
|
||||
strcpy(surface->output_name2, surface->output_name);
|
||||
surface->flags &= ~MOD_DPAINT_ANTIALIAS;
|
||||
surface->depth_clamp = 0.0f;
|
||||
}
|
||||
|
@ -1168,7 +1168,7 @@ static void stampdata(Scene *scene, Object *camera, StampData *stamp_data, int d
|
||||
char *name = scene_find_last_marker_name(scene, CFRA);
|
||||
|
||||
if (name) BLI_strncpy(text, name, sizeof(text));
|
||||
else strcpy(text, "<none>");
|
||||
else BLI_strncpy(text, "<none>", sizeof(text));
|
||||
|
||||
BLI_snprintf(stamp_data->marker, sizeof(stamp_data->marker), do_prefix ? "Marker %s":"%s", text);
|
||||
} else {
|
||||
@ -1224,7 +1224,7 @@ static void stampdata(Scene *scene, Object *camera, StampData *stamp_data, int d
|
||||
if (camera && camera->type == OB_CAMERA) {
|
||||
BLI_snprintf(text, sizeof(text), "%.2f", ((Camera *)camera->data)->lens);
|
||||
}
|
||||
else strcpy(text, "<none>");
|
||||
else BLI_strncpy(text, "<none>", sizeof(text));
|
||||
|
||||
BLI_snprintf(stamp_data->cameralens, sizeof(stamp_data->cameralens), do_prefix ? "Lens %s":"%s", text);
|
||||
} else {
|
||||
@ -1241,7 +1241,7 @@ static void stampdata(Scene *scene, Object *camera, StampData *stamp_data, int d
|
||||
Sequence *seq= seq_foreground_frame_get(scene, scene->r.cfra);
|
||||
|
||||
if (seq) BLI_strncpy(text, seq->name+2, sizeof(text));
|
||||
else strcpy(text, "<none>");
|
||||
else BLI_strncpy(text, "<none>", sizeof(text));
|
||||
|
||||
BLI_snprintf(stamp_data->strip, sizeof(stamp_data->strip), do_prefix ? "Strip %s":"%s", text);
|
||||
} else {
|
||||
|
@ -328,9 +328,9 @@ static char *shapekey_adrcodes_to_paths (int adrcode, int *UNUSED(array_index))
|
||||
/* block will be attached to ID_KE block, and setting that we alter is the 'value' (which sets keyblock.curval) */
|
||||
// XXX adrcode 0 was dummy 'speed' curve
|
||||
if (adrcode == 0)
|
||||
sprintf(buf, "speed");
|
||||
strcpy(buf, "speed");
|
||||
else
|
||||
sprintf(buf, "key_blocks[%d].value", adrcode);
|
||||
BLI_snprintf(buf, sizeof(buf), "key_blocks[%d].value", adrcode);
|
||||
return buf;
|
||||
}
|
||||
|
||||
@ -915,7 +915,7 @@ static char *get_rna_access (int blocktype, int adrcode, char actname[], char co
|
||||
/* note, strings are not escapted and they should be! */
|
||||
if ((actname && actname[0]) && (constname && constname[0])) {
|
||||
/* Constraint in Pose-Channel */
|
||||
sprintf(buf, "pose.bones[\"%s\"].constraints[\"%s\"]", actname, constname);
|
||||
BLI_snprintf(buf, sizeof(buf), "pose.bones[\"%s\"].constraints[\"%s\"]", actname, constname);
|
||||
}
|
||||
else if (actname && actname[0]) {
|
||||
if ((blocktype == ID_OB) && strcmp(actname, "Object")==0) {
|
||||
@ -928,16 +928,16 @@ static char *get_rna_access (int blocktype, int adrcode, char actname[], char co
|
||||
}
|
||||
else {
|
||||
/* Pose-Channel */
|
||||
sprintf(buf, "pose.bones[\"%s\"]", actname);
|
||||
BLI_snprintf(buf, sizeof(buf), "pose.bones[\"%s\"]", actname);
|
||||
}
|
||||
}
|
||||
else if (constname && constname[0]) {
|
||||
/* Constraint in Object */
|
||||
sprintf(buf, "constraints[\"%s\"]", constname);
|
||||
BLI_snprintf(buf, sizeof(buf), "constraints[\"%s\"]", constname);
|
||||
}
|
||||
else if (seq) {
|
||||
/* Sequence names in Scene */
|
||||
sprintf(buf, "sequence_editor.sequences_all[\"%s\"]", seq->name+2);
|
||||
BLI_snprintf(buf, sizeof(buf), "sequence_editor.sequences_all[\"%s\"]", seq->name+2);
|
||||
}
|
||||
else {
|
||||
buf[0]= '\0'; /* empty string */
|
||||
@ -954,7 +954,7 @@ static char *get_rna_access (int blocktype, int adrcode, char actname[], char co
|
||||
|
||||
/* if there was no array index pointer provided, add it to the path */
|
||||
if (array_index == NULL) {
|
||||
sprintf(buf, "[\"%d\"]", dummy_index);
|
||||
BLI_snprintf(buf, sizeof(buf), "[\"%d\"]", dummy_index);
|
||||
BLI_dynstr_append(path, buf);
|
||||
}
|
||||
|
||||
|
@ -51,6 +51,7 @@
|
||||
#include "BLI_listbase.h"
|
||||
#include "BLI_utildefines.h"
|
||||
#include "BLI_bpath.h"
|
||||
#include "BLI_string.h"
|
||||
|
||||
#include "BKE_animsys.h"
|
||||
#include "BKE_displist.h"
|
||||
@ -1614,7 +1615,7 @@ static void calculate_tface_materialname(char *matname, char *newname, int flag)
|
||||
int digits = integer_getdigits(flag);
|
||||
/* clamp the old name, remove the MA prefix and add the .TF.flag suffix
|
||||
e.g. matname = "MALoooooooooooooongName"; newname = "Loooooooooooooon.TF.2" */
|
||||
sprintf(newname, "%.*s.TF.%0*d", MAX_ID_NAME-(digits+5), matname, digits, flag);
|
||||
BLI_snprintf(newname, MAX_ID_NAME, "%.*s.TF.%0*d", MAX_ID_NAME-(digits+5), matname, digits, flag);
|
||||
}
|
||||
|
||||
/* returns -1 if no match */
|
||||
@ -1661,8 +1662,8 @@ static short convert_tfacenomaterial(Main *main, Mesh *me, MTFace *tf, int flag)
|
||||
short mat_nr= -1;
|
||||
|
||||
/* new material, the name uses the flag*/
|
||||
sprintf(idname, "MAMaterial.TF.%0*d", integer_getdigits(flag), flag);
|
||||
|
||||
BLI_snprintf(idname, sizeof(idname), "MAMaterial.TF.%0*d", integer_getdigits(flag), flag);
|
||||
|
||||
if ((ma= BLI_findstring(&main->mat, idname+2, offsetof(ID, name)+2))) {
|
||||
mat_nr= mesh_getmaterialnumber(me, ma);
|
||||
/* assign the material to the mesh */
|
||||
|
@ -251,7 +251,7 @@ static char *find_new_name(char *name)
|
||||
|
||||
if (fop_exists(name)) {
|
||||
for (number = 1; number <= 999; number++) {
|
||||
sprintf(tempname, "%s.%03d", name, number);
|
||||
BLI_snprintf(tempname, sizeof(tempname), "%s.%03d", name, number);
|
||||
if (! fop_exists(tempname)) {
|
||||
break;
|
||||
}
|
||||
|
@ -3409,14 +3409,14 @@ ModifierData *object_add_particle_system(Scene *scene, Object *ob, const char *n
|
||||
psys->part = psys_new_settings("ParticleSettings", NULL);
|
||||
|
||||
if(BLI_countlist(&ob->particlesystem)>1)
|
||||
sprintf(psys->name, "ParticleSystem %i", BLI_countlist(&ob->particlesystem));
|
||||
BLI_snprintf(psys->name, sizeof(psys->name), "ParticleSystem %i", BLI_countlist(&ob->particlesystem));
|
||||
else
|
||||
strcpy(psys->name, "ParticleSystem");
|
||||
|
||||
md= modifier_new(eModifierType_ParticleSystem);
|
||||
|
||||
if(name) BLI_strncpy(md->name, name, sizeof(md->name));
|
||||
else sprintf(md->name, "ParticleSystem %i", BLI_countlist(&ob->particlesystem));
|
||||
else BLI_snprintf(md->name, sizeof(md->name), "ParticleSystem %i", BLI_countlist(&ob->particlesystem));
|
||||
modifier_unique_name(&ob->modifiers, md);
|
||||
|
||||
psmd= (ParticleSystemModifierData*) md;
|
||||
|
@ -3096,7 +3096,7 @@ void BKE_ptcache_disk_cache_rename(PTCacheID *pid, const char *name_src, const c
|
||||
}
|
||||
closedir(dir);
|
||||
|
||||
strcpy(pid->cache->name, old_name);
|
||||
BLI_strncpy(pid->cache->name, old_name, sizeof(pid->cache->name));
|
||||
}
|
||||
|
||||
void BKE_ptcache_load_external(PTCacheID *pid)
|
||||
@ -3217,11 +3217,11 @@ void BKE_ptcache_update_info(PTCacheID *pid)
|
||||
|
||||
/* smoke doesn't use frame 0 as info frame so can't check based on totpoint */
|
||||
if(pid->type == PTCACHE_TYPE_SMOKE_DOMAIN && totframes)
|
||||
sprintf(cache->info, "%i frames found!", totframes);
|
||||
BLI_snprintf(cache->info, sizeof(cache->info), "%i frames found!", totframes);
|
||||
else if(totframes && cache->totpoint)
|
||||
sprintf(cache->info, "%i points found!", cache->totpoint);
|
||||
BLI_snprintf(cache->info, sizeof(cache->info), "%i points found!", cache->totpoint);
|
||||
else
|
||||
sprintf(cache->info, "No valid data to read!");
|
||||
BLI_snprintf(cache->info, sizeof(cache->info), "No valid data to read!");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -3231,9 +3231,9 @@ void BKE_ptcache_update_info(PTCacheID *pid)
|
||||
int totpoint = pid->totpoint(pid->calldata, 0);
|
||||
|
||||
if(cache->totpoint > totpoint)
|
||||
sprintf(mem_info, "%i cells + High Resolution cached", totpoint);
|
||||
BLI_snprintf(mem_info, sizeof(mem_info), "%i cells + High Resolution cached", totpoint);
|
||||
else
|
||||
sprintf(mem_info, "%i cells cached", totpoint);
|
||||
BLI_snprintf(mem_info, sizeof(mem_info), "%i cells cached", totpoint);
|
||||
}
|
||||
else {
|
||||
int cfra = cache->startframe;
|
||||
@ -3243,7 +3243,7 @@ void BKE_ptcache_update_info(PTCacheID *pid)
|
||||
totframes++;
|
||||
}
|
||||
|
||||
sprintf(mem_info, "%i frames on disk", totframes);
|
||||
BLI_snprintf(mem_info, sizeof(mem_info), "%i frames on disk", totframes);
|
||||
}
|
||||
}
|
||||
else {
|
||||
@ -3267,20 +3267,21 @@ void BKE_ptcache_update_info(PTCacheID *pid)
|
||||
|
||||
mb = (bytes > 1024.0f * 1024.0f);
|
||||
|
||||
sprintf(mem_info, "%i frames in memory (%.1f %s)",
|
||||
BLI_snprintf(mem_info, sizeof(mem_info), "%i frames in memory (%.1f %s)",
|
||||
totframes,
|
||||
bytes / (mb ? 1024.0f * 1024.0f : 1024.0f),
|
||||
mb ? "Mb" : "kb");
|
||||
}
|
||||
|
||||
if(cache->flag & PTCACHE_OUTDATED) {
|
||||
sprintf(cache->info, "%s, cache is outdated!", mem_info);
|
||||
BLI_snprintf(cache->info, sizeof(cache->info), "%s, cache is outdated!", mem_info);
|
||||
}
|
||||
else if(cache->flag & PTCACHE_FRAMES_SKIPPED) {
|
||||
sprintf(cache->info, "%s, not exact since frame %i.", mem_info, cache->last_exact);
|
||||
BLI_snprintf(cache->info, sizeof(cache->info), "%s, not exact since frame %i.", mem_info, cache->last_exact);
|
||||
}
|
||||
else {
|
||||
BLI_snprintf(cache->info, sizeof(cache->info), "%s.", mem_info);
|
||||
}
|
||||
else
|
||||
sprintf(cache->info, "%s.", mem_info);
|
||||
}
|
||||
|
||||
void BKE_ptcache_validate(PointCache *cache, int framenr)
|
||||
|
@ -171,7 +171,7 @@ void unique_property(bProperty *first, bProperty *prop, int force)
|
||||
i= 0;
|
||||
|
||||
do { /* ensure we have enough chars for the new number in the name */
|
||||
sprintf(num, "%d", i++);
|
||||
BLI_snprintf(num, sizeof(num), "%d", i++);
|
||||
BLI_strncpy(new_name, base_name, sizeof(prop->name) - strlen(num));
|
||||
strcat(new_name, num);
|
||||
} while(get_property__internal(first, prop, new_name));
|
||||
|
@ -306,7 +306,7 @@ static struct ImBuf * do_plugin_effect(
|
||||
/* XXX: it's crappy to limit copying buffer by it's lemgth,
|
||||
* but assuming plugin stuff is using correct buffer size
|
||||
* it should be fine */
|
||||
if(cp) strncpy(cp, seq->name+2, sizeof(seq->name));
|
||||
if(cp) strncpy(cp, seq->name+2, sizeof(seq->name)-2);
|
||||
|
||||
if (seq->plugin->current_private_data) {
|
||||
*seq->plugin->current_private_data
|
||||
|
@ -850,7 +850,8 @@ static void seqbase_unique_name(ListBase *seqbasep, SeqUniqueInfo *sui)
|
||||
Sequence *seq;
|
||||
for(seq=seqbasep->first; seq; seq= seq->next) {
|
||||
if (sui->seq != seq && strcmp(sui->name_dest, seq->name+2)==0) {
|
||||
sprintf(sui->name_dest, "%.17s.%03d", sui->name_src, sui->count++); /*24 - 2 for prefix, -1 for \0 */
|
||||
/* SEQ_NAME_MAXSTR - 2 for prefix, -1 for \0, -4 for the number */
|
||||
BLI_snprintf(sui->name_dest, sizeof(sui->name_dest), "%.59s.%03d", sui->name_src, sui->count++);
|
||||
sui->match= 1; /* be sure to re-scan */
|
||||
}
|
||||
}
|
||||
|
@ -168,7 +168,7 @@ PluginTex *add_plugin_tex(char *str)
|
||||
|
||||
pit= MEM_callocN(sizeof(PluginTex), "plugintex");
|
||||
|
||||
strcpy(pit->name, str);
|
||||
BLI_strncpy(pit->name, str, sizeof(pit->name));
|
||||
open_plugin_tex(pit);
|
||||
|
||||
if(pit->doit==NULL) {
|
||||
|
@ -669,7 +669,7 @@ static TracksMap *tracks_map_new(const char *object_name, int is_camera, int num
|
||||
{
|
||||
TracksMap *map= MEM_callocN(sizeof(TracksMap), "TrackingsMap");
|
||||
|
||||
strcpy(map->object_name, object_name);
|
||||
BLI_strncpy(map->object_name, object_name, sizeof(map->object_name));
|
||||
map->is_camera= is_camera;
|
||||
|
||||
map->num_tracks= num_tracks;
|
||||
@ -1784,7 +1784,7 @@ MovieReconstructContext* BKE_tracking_reconstruction_context_new(MovieTracking *
|
||||
int sfra= INT_MAX, efra= INT_MIN;
|
||||
MovieTrackingTrack *track;
|
||||
|
||||
strcpy(context->object_name, object->name);
|
||||
BLI_strncpy(context->object_name, object->name, sizeof(context->object_name));
|
||||
context->is_camera = object->flag&TRACKING_OBJECT_CAMERA;
|
||||
|
||||
context->tracks_map= tracks_map_new(context->object_name, context->is_camera, num_tracks, 0);
|
||||
|
@ -1077,9 +1077,9 @@ IDProperty *ffmpeg_property_add(RenderData *rd, const char *type, int opt_index,
|
||||
}
|
||||
|
||||
if (parent_index) {
|
||||
sprintf(name, "%s:%s", parent->name, o->name);
|
||||
BLI_snprintf(name, sizeof(name), "%s:%s", parent->name, o->name);
|
||||
} else {
|
||||
strcpy(name, o->name);
|
||||
BLI_strncpy(name, o->name, sizeof(name));
|
||||
}
|
||||
|
||||
fprintf(stderr, "ffmpeg_property_add: %s %d %d %s\n",
|
||||
|
@ -627,8 +627,10 @@ int BLI_path_frame_range(char *path, int sta, int end, int digits)
|
||||
|
||||
if (stringframe_chars(path, &ch_sta, &ch_end)) { /* warning, ch_end is the last # +1 */
|
||||
char tmp[FILE_MAX];
|
||||
sprintf(tmp, "%.*s%.*d-%.*d%s", ch_sta, path, ch_end-ch_sta, sta, ch_end-ch_sta, end, path+ch_end);
|
||||
strcpy(path, tmp);
|
||||
BLI_snprintf(tmp, sizeof(tmp),
|
||||
"%.*s%.*d-%.*d%s",
|
||||
ch_sta, path, ch_end-ch_sta, sta, ch_end-ch_sta, end, path+ch_end);
|
||||
BLI_strncpy(path, tmp, FILE_MAX);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
|
@ -203,7 +203,7 @@ static void bli_builddir(const char *dirname, const char *relname)
|
||||
char buf[256];
|
||||
DIR *dir;
|
||||
|
||||
strcpy(buf,relname);
|
||||
BLI_strncpy(buf, relname, sizeof(buf));
|
||||
rellen=strlen(relname);
|
||||
|
||||
if (rellen){
|
||||
@ -220,7 +220,7 @@ static void bli_builddir(const char *dirname, const char *relname)
|
||||
while ((fname = (struct dirent*) readdir(dir)) != NULL) {
|
||||
dlink = (struct dirlink *)malloc(sizeof(struct dirlink));
|
||||
if (dlink){
|
||||
strcpy(buf+rellen,fname->d_name);
|
||||
BLI_strncpy(buf + rellen ,fname->d_name, sizeof(buf) - rellen);
|
||||
dlink->name = BLI_strdup(buf);
|
||||
BLI_addhead(dirbase,dlink);
|
||||
newnum++;
|
||||
@ -343,8 +343,8 @@ static void bli_adddirstrings(void)
|
||||
tm= localtime(&file->s.st_mtime);
|
||||
// prevent impossible dates in windows
|
||||
if(tm==NULL) tm= localtime(&zero);
|
||||
strftime(file->time, 8, "%H:%M", tm);
|
||||
strftime(file->date, 16, "%d-%b-%y", tm);
|
||||
strftime(file->time, sizeof(file->time), "%H:%M", tm);
|
||||
strftime(file->date, sizeof(file->date), "%d-%b-%y", tm);
|
||||
|
||||
/*
|
||||
* Seems st_size is signed 32-bit value in *nix and Windows. This
|
||||
@ -354,38 +354,43 @@ static void bli_adddirstrings(void)
|
||||
st_size= file->s.st_size;
|
||||
|
||||
if (st_size > 1024*1024*1024) {
|
||||
sprintf(file->size, "%.2f GB", ((double)st_size)/(1024*1024*1024));
|
||||
BLI_snprintf(file->size, sizeof(file->size), "%.2f GB", ((double)st_size)/(1024*1024*1024));
|
||||
}
|
||||
else if (st_size > 1024*1024) {
|
||||
sprintf(file->size, "%.1f MB", ((double)st_size)/(1024*1024));
|
||||
BLI_snprintf(file->size, sizeof(file->size), "%.1f MB", ((double)st_size)/(1024*1024));
|
||||
}
|
||||
else if (st_size > 1024) {
|
||||
sprintf(file->size, "%d KB", (int)(st_size/1024));
|
||||
BLI_snprintf(file->size, sizeof(file->size), "%d KB", (int)(st_size/1024));
|
||||
}
|
||||
else {
|
||||
sprintf(file->size, "%d B", (int)st_size);
|
||||
BLI_snprintf(file->size, sizeof(file->size), "%d B", (int)st_size);
|
||||
}
|
||||
|
||||
strftime(datum, 32, "%d-%b-%y %H:%M", tm);
|
||||
strftime(datum, 32, "%d-%b-%y %H:%M", tm); /* XXX, is this used? - campbell */
|
||||
|
||||
if (st_size < 1000) {
|
||||
sprintf(size, "%10d", (int) st_size);
|
||||
} else if (st_size < 1000 * 1000) {
|
||||
sprintf(size, "%6d %03d", (int) (st_size / 1000), (int) (st_size % 1000));
|
||||
} else if (st_size < 100 * 1000 * 1000) {
|
||||
sprintf(size, "%2d %03d %03d", (int) (st_size / (1000 * 1000)), (int) ((st_size / 1000) % 1000), (int) ( st_size % 1000));
|
||||
} else {
|
||||
sprintf(size, "> %4.1f M", (double) (st_size / (1024.0 * 1024.0)));
|
||||
sprintf(size, "%10d", (int) st_size);
|
||||
BLI_snprintf(size, sizeof(size), "%10d",
|
||||
(int) st_size);
|
||||
}
|
||||
else if (st_size < 1000 * 1000) {
|
||||
BLI_snprintf(size, sizeof(size), "%6d %03d",
|
||||
(int) (st_size / 1000), (int) (st_size % 1000));
|
||||
}
|
||||
else if (st_size < 100 * 1000 * 1000) {
|
||||
BLI_snprintf(size, sizeof(size), "%2d %03d %03d",
|
||||
(int) (st_size / (1000 * 1000)), (int) ((st_size / 1000) % 1000), (int) ( st_size % 1000));
|
||||
}
|
||||
else {
|
||||
/* XXX, whats going on here?. 2x calls - campbell */
|
||||
BLI_snprintf(size, sizeof(size), "> %4.1f M", (double) (st_size / (1024.0 * 1024.0)));
|
||||
BLI_snprintf(size, sizeof(size), "%10d", (int) st_size);
|
||||
}
|
||||
|
||||
sprintf(buf,"%s %s %s %7s %s %s %10s %s", file->mode1, file->mode2, file->mode3, file->owner, file->date, file->time, size,
|
||||
file->relname);
|
||||
BLI_snprintf(buf, sizeof(buf), "%s %s %s %7s %s %s %10s %s",
|
||||
file->mode1, file->mode2, file->mode3, file->owner,
|
||||
file->date, file->time, size, file->relname);
|
||||
|
||||
file->string=MEM_mallocN(strlen(buf)+1, "filestring");
|
||||
if (file->string){
|
||||
strcpy(file->string,buf);
|
||||
}
|
||||
file->string = BLI_strdup(buf);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6560,14 +6560,14 @@ static void customdata_version_242(Mesh *me)
|
||||
if (layer->type == CD_MTFACE) {
|
||||
if (layer->name[0] == 0) {
|
||||
if (mtfacen == 0) strcpy(layer->name, "UVMap");
|
||||
else sprintf(layer->name, "UVMap.%.3d", mtfacen);
|
||||
else BLI_snprintf(layer->name, sizeof(layer->name), "UVMap.%.3d", mtfacen);
|
||||
}
|
||||
mtfacen++;
|
||||
}
|
||||
else if (layer->type == CD_MCOL) {
|
||||
if (layer->name[0] == 0) {
|
||||
if (mcoln == 0) strcpy(layer->name, "Col");
|
||||
else sprintf(layer->name, "Col.%.3d", mcoln);
|
||||
else BLI_snprintf(layer->name, sizeof(layer->name), "Col.%.3d", mcoln);
|
||||
}
|
||||
mcoln++;
|
||||
}
|
||||
@ -9062,8 +9062,9 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
|
||||
strcpy(kb->name, "Basis");
|
||||
}
|
||||
else {
|
||||
if(kb->name[0]==0)
|
||||
sprintf(kb->name, "Key %d", index);
|
||||
if (kb->name[0]==0) {
|
||||
BLI_snprintf(kb->name, sizeof(kb->name), "Key %d", index);
|
||||
}
|
||||
kb->adrcode= index++;
|
||||
}
|
||||
}
|
||||
@ -10056,7 +10057,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
|
||||
BLI_addtail(&ob->particlesystem, psys);
|
||||
|
||||
md= modifier_new(eModifierType_ParticleSystem);
|
||||
sprintf(md->name, "ParticleSystem %i", BLI_countlist(&ob->particlesystem));
|
||||
BLI_snprintf(md->name, sizeof(md->name), "ParticleSystem %i", BLI_countlist(&ob->particlesystem));
|
||||
psmd= (ParticleSystemModifierData*) md;
|
||||
psmd->psys=psys;
|
||||
BLI_addtail(&ob->modifiers, md);
|
||||
|
@ -134,8 +134,8 @@ int getname_anim_fcurve(char *name, ID *id, FCurve *fcu)
|
||||
char c= RNA_property_array_item_char(prop, fcu->array_index);
|
||||
|
||||
/* we need to write the index to a temp buffer (in py syntax) */
|
||||
if (c) sprintf(arrayindbuf, "%c ", c);
|
||||
else sprintf(arrayindbuf, "[%d]", fcu->array_index);
|
||||
if (c) BLI_snprintf(arrayindbuf, sizeof(arrayindbuf), "%c ", c);
|
||||
else BLI_snprintf(arrayindbuf, sizeof(arrayindbuf), "[%d]", fcu->array_index);
|
||||
|
||||
arrayname= &arrayindbuf[0];
|
||||
}
|
||||
|
@ -1453,7 +1453,7 @@ static void RIG_printCtrl(RigControl *ctrl, char *indent)
|
||||
printf("%sBone: %s\n", indent, ctrl->bone->name);
|
||||
printf("%sLink: %s\n", indent, ctrl->link ? ctrl->link->name : "!NONE!");
|
||||
|
||||
sprintf(text, "%soffset", indent);
|
||||
BLI_snprintf(text, sizeof(text), "%soffset", indent);
|
||||
print_v3(text, ctrl->offset);
|
||||
|
||||
printf("%sFlag: %i\n", indent, ctrl->flag);
|
||||
|
@ -45,6 +45,7 @@
|
||||
#include "BLI_edgehash.h"
|
||||
#include "BLI_memarena.h"
|
||||
#include "BLI_utildefines.h"
|
||||
#include "BLI_string.h"
|
||||
|
||||
#include "BKE_DerivedMesh.h"
|
||||
#include "BKE_modifier.h"
|
||||
@ -1613,7 +1614,7 @@ static void meshdeform_matrix_solve(MeshDeformModifierData *mmd, MeshDeformBind
|
||||
NLContext *context;
|
||||
float vec[3], gridvec[3];
|
||||
int a, b, x, y, z, totvar;
|
||||
char message[1024];
|
||||
char message[256];
|
||||
|
||||
/* setup variable indices */
|
||||
mdb->varidx= MEM_callocN(sizeof(int)*mdb->size3, "MeshDeformDSvaridx");
|
||||
@ -1715,7 +1716,7 @@ static void meshdeform_matrix_solve(MeshDeformModifierData *mmd, MeshDeformBind
|
||||
break;
|
||||
}
|
||||
|
||||
sprintf(message, "Mesh deform solve %d / %d |||", a+1, mdb->totcagevert);
|
||||
BLI_snprintf(message, sizeof(message), "Mesh deform solve %d / %d |||", a+1, mdb->totcagevert);
|
||||
progress_bar((float)(a+1)/(float)(mdb->totcagevert), message);
|
||||
}
|
||||
|
||||
|
@ -543,7 +543,7 @@ static void pose_slide_draw_status (tPoseSlideOp *pso)
|
||||
break;
|
||||
}
|
||||
|
||||
sprintf(status_str, "%s: %d %%", mode_str, (int)(pso->percentage*100.0f));
|
||||
BLI_snprintf(status_str, sizeof(status_str), "%s: %d %%", mode_str, (int)(pso->percentage*100.0f));
|
||||
ED_area_headerprint(pso->sa, status_str);
|
||||
}
|
||||
|
||||
|
@ -977,7 +977,9 @@ static void poselib_preview_apply (bContext *C, wmOperator *op)
|
||||
/* do header print - if interactively previewing */
|
||||
if (pld->state == PL_PREVIEW_RUNNING) {
|
||||
if (pld->flag & PL_PREVIEW_SHOWORIGINAL) {
|
||||
sprintf(pld->headerstr, "PoseLib Previewing Pose: [Showing Original Pose] | Use Tab to start previewing poses again");
|
||||
BLI_strncpy(pld->headerstr,
|
||||
"PoseLib Previewing Pose: [Showing Original Pose] | Use Tab to start previewing poses again",
|
||||
sizeof(pld->headerstr));
|
||||
ED_area_headerprint(pld->sa, pld->headerstr);
|
||||
}
|
||||
else if (pld->searchstr[0]) {
|
||||
@ -988,10 +990,10 @@ static void poselib_preview_apply (bContext *C, wmOperator *op)
|
||||
/* get search-string */
|
||||
index= pld->search_cursor;
|
||||
|
||||
if (index >= 0 && index <= 64) {
|
||||
if (index >= 0 && index <= sizeof(tempstr) - 1) {
|
||||
memcpy(&tempstr[0], &pld->searchstr[0], index);
|
||||
tempstr[index]= '|';
|
||||
memcpy(&tempstr[index+1], &pld->searchstr[index], 64-index);
|
||||
memcpy(&tempstr[index+1], &pld->searchstr[index], (sizeof(tempstr) - 1) - index);
|
||||
}
|
||||
else {
|
||||
BLI_strncpy(tempstr, pld->searchstr, sizeof(tempstr));
|
||||
@ -1000,11 +1002,18 @@ static void poselib_preview_apply (bContext *C, wmOperator *op)
|
||||
/* get marker name */
|
||||
BLI_strncpy(markern, pld->marker ? pld->marker->name : "No Matches", sizeof(markern));
|
||||
|
||||
sprintf(pld->headerstr, "PoseLib Previewing Pose: Filter - [%s] | Current Pose - \"%s\" | Use ScrollWheel or PageUp/Down to change", tempstr, markern);
|
||||
BLI_snprintf(pld->headerstr, sizeof(pld->headerstr),
|
||||
"PoseLib Previewing Pose: Filter - [%s] | "
|
||||
"Current Pose - \"%s\" | "
|
||||
"Use ScrollWheel or PageUp/Down to change",
|
||||
tempstr, markern);
|
||||
ED_area_headerprint(pld->sa, pld->headerstr);
|
||||
}
|
||||
else {
|
||||
sprintf(pld->headerstr, "PoseLib Previewing Pose: \"%s\" | Use ScrollWheel or PageUp/Down to change", pld->marker->name);
|
||||
BLI_snprintf(pld->headerstr, sizeof(pld->headerstr),
|
||||
"PoseLib Previewing Pose: \"%s\" | "
|
||||
"Use ScrollWheel or PageUp/Down to change",
|
||||
pld->marker->name);
|
||||
ED_area_headerprint(pld->sa, pld->headerstr);
|
||||
}
|
||||
}
|
||||
|
@ -2035,10 +2035,9 @@ void REEB_exportGraph(ReebGraph *rg, int count)
|
||||
|
||||
if (count == -1)
|
||||
{
|
||||
sprintf(filename, "test.txt");
|
||||
strcpy(filename, "test.txt");
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
sprintf(filename, "test%05i.txt", count);
|
||||
}
|
||||
f = fopen(filename, "w");
|
||||
|
@ -1069,17 +1069,17 @@ static void curve_rename_fcurves(Object *obedit, ListBase *orig_curves)
|
||||
while (a--) {
|
||||
keyIndex= getCVKeyIndex(editnurb, bezt);
|
||||
if(keyIndex) {
|
||||
sprintf(rna_path, "splines[%d].bezier_points[%d]", nu_index, pt_index);
|
||||
sprintf(orig_rna_path, "splines[%d].bezier_points[%d]", keyIndex->nu_index, keyIndex->pt_index);
|
||||
BLI_snprintf(rna_path, sizeof(rna_path), "splines[%d].bezier_points[%d]", nu_index, pt_index);
|
||||
BLI_snprintf(orig_rna_path, sizeof(orig_rna_path), "splines[%d].bezier_points[%d]", keyIndex->nu_index, keyIndex->pt_index);
|
||||
|
||||
if(keyIndex->switched) {
|
||||
char handle_path[64], orig_handle_path[64];
|
||||
sprintf(orig_handle_path, "%s.handle_left", orig_rna_path);
|
||||
sprintf(handle_path, "%s.handle_right", rna_path);
|
||||
BLI_snprintf(orig_handle_path, sizeof(orig_rna_path), "%s.handle_left", orig_rna_path);
|
||||
BLI_snprintf(handle_path, sizeof(rna_path), "%s.handle_right", rna_path);
|
||||
fcurve_path_rename(ad, orig_handle_path, handle_path, orig_curves, &curves);
|
||||
|
||||
sprintf(orig_handle_path, "%s.handle_right", orig_rna_path);
|
||||
sprintf(handle_path, "%s.handle_left", rna_path);
|
||||
BLI_snprintf(orig_handle_path, sizeof(orig_rna_path), "%s.handle_right", orig_rna_path);
|
||||
BLI_snprintf(handle_path, sizeof(rna_path), "%s.handle_left", rna_path);
|
||||
fcurve_path_rename(ad, orig_handle_path, handle_path, orig_curves, &curves);
|
||||
}
|
||||
|
||||
@ -1100,8 +1100,8 @@ static void curve_rename_fcurves(Object *obedit, ListBase *orig_curves)
|
||||
while (a--) {
|
||||
keyIndex= getCVKeyIndex(editnurb, bp);
|
||||
if(keyIndex) {
|
||||
sprintf(rna_path, "splines[%d].points[%d]", nu_index, pt_index);
|
||||
sprintf(orig_rna_path, "splines[%d].points[%d]", keyIndex->nu_index, keyIndex->pt_index);
|
||||
BLI_snprintf(rna_path, sizeof(rna_path), "splines[%d].points[%d]", nu_index, pt_index);
|
||||
BLI_snprintf(orig_rna_path, sizeof(orig_rna_path), "splines[%d].points[%d]", keyIndex->nu_index, keyIndex->pt_index);
|
||||
fcurve_path_rename(ad, orig_rna_path, rna_path, orig_curves, &curves);
|
||||
|
||||
keyIndex->nu_index= nu_index;
|
||||
@ -1140,8 +1140,8 @@ static void curve_rename_fcurves(Object *obedit, ListBase *orig_curves)
|
||||
}
|
||||
|
||||
if(keyIndex) {
|
||||
sprintf(rna_path, "splines[%d]", nu_index);
|
||||
sprintf(orig_rna_path, "splines[%d]", keyIndex->nu_index);
|
||||
BLI_snprintf(rna_path, sizeof(rna_path), "splines[%d]", nu_index);
|
||||
BLI_snprintf(orig_rna_path, sizeof(orig_rna_path), "splines[%d]", keyIndex->nu_index);
|
||||
fcurve_path_rename(ad, orig_rna_path, rna_path, orig_curves, &curves);
|
||||
}
|
||||
|
||||
|
@ -143,9 +143,9 @@ static void gp_drawui_layer (uiLayout *layout, bGPdata *gpd, bGPDlayer *gpl, con
|
||||
|
||||
/* name */
|
||||
if (gpl->flag & GP_LAYER_HIDE)
|
||||
sprintf(name, "%s (Hidden)", gpl->info);
|
||||
BLI_snprintf(name, sizeof(name), "%s (Hidden)", gpl->info);
|
||||
else
|
||||
sprintf(name, "%s (Locked)", gpl->info);
|
||||
BLI_snprintf(name, sizeof(name), "%s (Locked)", gpl->info);
|
||||
uiItemL(sub, name, ICON_NONE);
|
||||
|
||||
/* delete button (only if hidden but not locked!) */
|
||||
|
@ -180,7 +180,7 @@ void uiStyleFontDrawExt(uiFontStyle *fs, rcti *rect, const char *str,
|
||||
if (fs->kerning == 1)
|
||||
BLF_enable(fs->uifont_id, BLF_KERNING_DEFAULT);
|
||||
|
||||
BLF_draw(fs->uifont_id, str, 65535); /* XXX, use real length */
|
||||
BLF_draw(fs->uifont_id, str, BLF_DRAW_STR_DUMMY_MAX);
|
||||
BLF_disable(fs->uifont_id, BLF_CLIPPING);
|
||||
if (fs->shadow)
|
||||
BLF_disable(fs->uifont_id, BLF_SHADOW);
|
||||
@ -243,7 +243,7 @@ void uiStyleFontDrawRotated(uiFontStyle *fs, rcti *rect, const char *str)
|
||||
if (fs->kerning == 1)
|
||||
BLF_enable(fs->uifont_id, BLF_KERNING_DEFAULT);
|
||||
|
||||
BLF_draw(fs->uifont_id, str, 65535); /* XXX, use real length */
|
||||
BLF_draw(fs->uifont_id, str, BLF_DRAW_STR_DUMMY_MAX);
|
||||
BLF_disable(fs->uifont_id, BLF_ROTATION);
|
||||
BLF_disable(fs->uifont_id, BLF_CLIPPING);
|
||||
if (fs->shadow)
|
||||
@ -291,7 +291,7 @@ void UI_DrawString(float x, float y, const char *str)
|
||||
|
||||
uiStyleFontSet(&style->widget);
|
||||
BLF_position(style->widget.uifont_id, x, y, 0.0f);
|
||||
BLF_draw(style->widget.uifont_id, str, 65535); /* XXX, use real length */
|
||||
BLF_draw(style->widget.uifont_id, str, BLF_DRAW_STR_DUMMY_MAX);
|
||||
|
||||
if (style->widget.kerning == 1)
|
||||
BLF_disable(style->widget.uifont_id, BLF_KERNING_DEFAULT);
|
||||
|
@ -2471,12 +2471,15 @@ static void operator_search_cb(const bContext *C, void *UNUSED(arg), const char
|
||||
int len= strlen(ot->name);
|
||||
|
||||
/* display name for menu, can hold hotkey */
|
||||
BLI_strncpy(name, ot->name, 256);
|
||||
BLI_strncpy(name, ot->name, sizeof(name));
|
||||
|
||||
/* check for hotkey */
|
||||
if(len < 256-6) {
|
||||
if(WM_key_event_operator_string(C, ot->idname, WM_OP_EXEC_DEFAULT, NULL, TRUE, &name[len+1], 256-len-1))
|
||||
if(len < sizeof(name)-6) {
|
||||
if (WM_key_event_operator_string(C, ot->idname, WM_OP_EXEC_DEFAULT, NULL, TRUE,
|
||||
&name[len+1], sizeof(name)-len-1))
|
||||
{
|
||||
name[len]= '|';
|
||||
}
|
||||
}
|
||||
|
||||
if(0==uiSearchItemAdd(items, name, ot, 0))
|
||||
|
@ -1541,7 +1541,7 @@ static void scroll_printstr(Scene *scene, float x, float y, float val, int power
|
||||
}
|
||||
|
||||
/* draw it */
|
||||
BLF_draw_default_ascii(x, y, 0.0f, timecode_str, sizeof(timecode_str)-1);
|
||||
BLF_draw_default_ascii(x, y, 0.0f, timecode_str, sizeof(timecode_str));
|
||||
}
|
||||
|
||||
/* Draw scrollbars in the given 2d-region */
|
||||
@ -2093,11 +2093,11 @@ void UI_view2d_text_cache_draw(ARegion *ar)
|
||||
}
|
||||
|
||||
if(v2s->rect.xmin >= v2s->rect.xmax)
|
||||
BLF_draw_default((float)v2s->mval[0]+xofs, (float)v2s->mval[1]+yofs, 0.0, str, 65535);
|
||||
BLF_draw_default((float)v2s->mval[0]+xofs, (float)v2s->mval[1]+yofs, 0.0, str, BLF_DRAW_STR_DUMMY_MAX);
|
||||
else {
|
||||
BLF_clipping_default(v2s->rect.xmin-4, v2s->rect.ymin-4, v2s->rect.xmax+4, v2s->rect.ymax+4);
|
||||
BLF_enable_default(BLF_CLIPPING);
|
||||
BLF_draw_default(v2s->rect.xmin+xofs, v2s->rect.ymin+yofs, 0.0f, str, 65535);
|
||||
BLF_draw_default(v2s->rect.xmin+xofs, v2s->rect.ymin+yofs, 0.0f, str, BLF_DRAW_STR_DUMMY_MAX);
|
||||
BLF_disable_default(BLF_CLIPPING);
|
||||
}
|
||||
}
|
||||
|
@ -1042,7 +1042,7 @@ static int fluidsimBake(bContext *C, ReportList *reports, Object *fsDomain, shor
|
||||
fsset->surfaceSmoothing = domainSettings->surfaceSmoothing;
|
||||
fsset->surfaceSubdivs = domainSettings->surfaceSubdivs;
|
||||
fsset->farFieldSize = domainSettings->farFieldSize;
|
||||
BLI_strncpy(fsset->outputPath, targetFile, 240);
|
||||
BLI_strncpy(fsset->outputPath, targetFile, sizeof(fsset->outputPath));
|
||||
|
||||
// domain channels
|
||||
fsset->channelSizeFrameTime =
|
||||
|
@ -478,7 +478,7 @@ void ED_region_do_draw(bContext *C, ARegion *ar)
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
|
||||
UI_ThemeColor(TH_TEXT);
|
||||
BLF_draw_default(20, 8, 0.0f, ar->headerstr, 65535); /* XXX, use real length */
|
||||
BLF_draw_default(20, 8, 0.0f, ar->headerstr, BLF_DRAW_STR_DUMMY_MAX);
|
||||
}
|
||||
else if(at->draw) {
|
||||
at->draw(C, ar);
|
||||
@ -1809,5 +1809,5 @@ void ED_region_info_draw(ARegion *ar, const char *text, int block, float alpha)
|
||||
/* text */
|
||||
UI_ThemeColor(TH_TEXT_HI);
|
||||
BLF_position(fontid, 12, rect.ymin + 5, 0.0f);
|
||||
BLF_draw(fontid, text, 256);
|
||||
BLF_draw(fontid, text, BLF_DRAW_STR_DUMMY_MAX);
|
||||
}
|
||||
|
@ -134,7 +134,7 @@ void file_draw_buttons(const bContext *C, ARegion *ar)
|
||||
ARegion* artmp;
|
||||
|
||||
/* Initialize UI block. */
|
||||
sprintf(uiblockstr, "win %p", (void *)ar);
|
||||
BLI_snprintf(uiblockstr, sizeof(uiblockstr), "win %p", (void *)ar);
|
||||
block = uiBeginBlock(C, ar, uiblockstr, UI_EMBOSS);
|
||||
uiBlockSetHandleFunc(block, do_file_buttons, NULL);
|
||||
|
||||
|
@ -1199,10 +1199,10 @@ void filelist_from_main(struct FileList *filelist)
|
||||
if(idcode == ID_MA || idcode == ID_TE || idcode == ID_LA || idcode == ID_WO || idcode == ID_IM) {
|
||||
files->flags |= IMAGEFILE;
|
||||
}
|
||||
if(id->lib && fake) sprintf(files->extra, "LF %d", id->us);
|
||||
else if(id->lib) sprintf(files->extra, "L %d", id->us);
|
||||
else if(fake) sprintf(files->extra, "F %d", id->us);
|
||||
else sprintf(files->extra, " %d", id->us);
|
||||
if(id->lib && fake) BLI_snprintf(files->extra, sizeof(files->extra), "LF %d", id->us);
|
||||
else if(id->lib) BLI_snprintf(files->extra, sizeof(files->extra), "L %d", id->us);
|
||||
else if(fake) BLI_snprintf(files->extra, sizeof(files->extra), "F %d", id->us);
|
||||
else BLI_snprintf(files->extra, sizeof(files->extra), " %d", id->us);
|
||||
|
||||
if(id->lib) {
|
||||
if(totlib==0) firstlib= files;
|
||||
|
@ -647,7 +647,7 @@ static void graph_panel_drivers(const bContext *C, Panel *pa)
|
||||
|
||||
uiItemL(row, "Driver Value:", ICON_NONE);
|
||||
|
||||
sprintf(valBuf, "%.3f", driver->curval);
|
||||
BLI_snprintf(valBuf, sizeof(valBuf), "%.3f", driver->curval);
|
||||
uiItemL(row, valBuf, ICON_NONE);
|
||||
}
|
||||
|
||||
@ -702,18 +702,18 @@ static void graph_panel_drivers(const bContext *C, Panel *pa)
|
||||
graph_panel_driverVar__transChan(box, ale->id, dvar);
|
||||
break;
|
||||
}
|
||||
|
||||
/* value of variable */
|
||||
if (driver->flag & DRIVER_FLAG_SHOWDEBUG) {
|
||||
char valBuf[32];
|
||||
|
||||
box= uiLayoutBox(col);
|
||||
row= uiLayoutRow(box, 1);
|
||||
|
||||
/* value of variable */
|
||||
if (driver->flag & DRIVER_FLAG_SHOWDEBUG) {
|
||||
char valBuf[32];
|
||||
|
||||
box= uiLayoutBox(col);
|
||||
row= uiLayoutRow(box, 1);
|
||||
uiItemL(row, "Value:", ICON_NONE);
|
||||
|
||||
sprintf(valBuf, "%.3f", dvar->curval);
|
||||
BLI_snprintf(valBuf, sizeof(valBuf), "%.3f", dvar->curval);
|
||||
uiItemL(row, valBuf, ICON_NONE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* cleanup */
|
||||
|
@ -682,7 +682,7 @@ void uiTemplateImage(uiLayout *layout, bContext *C, PointerRNA *ptr, const char
|
||||
uiButSetFunc(but, image_freecache_cb, ima, NULL);
|
||||
|
||||
if(iuser->frames)
|
||||
sprintf(str, "(%d) Frames:", iuser->framenr);
|
||||
BLI_snprintf(str, sizeof(str), "(%d) Frames:", iuser->framenr);
|
||||
else strcpy(str, "Frames:");
|
||||
uiBlockBeginAlign(block);
|
||||
uiDefButI(block, NUM, imagechanged, str, 10, 90,150, 20, &iuser->frames, 0.0, MAXFRAMEF, 0, 0, "Number of images of a movie to use");
|
||||
@ -763,7 +763,7 @@ void uiTemplateImage(uiLayout *layout, bContext *C, PointerRNA *ptr, const char
|
||||
|
||||
col= uiLayoutColumn(split, 0);
|
||||
|
||||
sprintf(str, "(%d) Frames", iuser->framenr);
|
||||
BLI_snprintf(str, sizeof(str), "(%d) Frames", iuser->framenr);
|
||||
uiItemR(col, userptr, "frame_duration", 0, str, ICON_NONE);
|
||||
if(ima->anim) {
|
||||
block= uiLayoutGetBlock(col);
|
||||
|
@ -139,7 +139,7 @@ void draw_image_info(ARegion *ar, int color_manage, int channels, int x, int y,
|
||||
BLF_size(blf_mono_font, 11, 72);
|
||||
|
||||
glColor3ub(255, 255, 255);
|
||||
sprintf(str, "X:%-4d Y:%-4d |", x, y);
|
||||
BLI_snprintf(str, sizeof(str), "X:%-4d Y:%-4d |", x, y);
|
||||
// UI_DrawString(6, 6, str); // works ok but fixed width is nicer.
|
||||
BLF_position(blf_mono_font, dx, 6, 0);
|
||||
BLF_draw_ascii(blf_mono_font, str, sizeof(str));
|
||||
@ -147,14 +147,14 @@ void draw_image_info(ARegion *ar, int color_manage, int channels, int x, int y,
|
||||
|
||||
if(zp) {
|
||||
glColor3ub(255, 255, 255);
|
||||
sprintf(str, " Z:%-.4f |", 0.5f+0.5f*(((float)*zp)/(float)0x7fffffff));
|
||||
BLI_snprintf(str, sizeof(str), " Z:%-.4f |", 0.5f+0.5f*(((float)*zp)/(float)0x7fffffff));
|
||||
BLF_position(blf_mono_font, dx, 6, 0);
|
||||
BLF_draw_ascii(blf_mono_font, str, sizeof(str));
|
||||
dx += BLF_width(blf_mono_font, str);
|
||||
}
|
||||
if(zpf) {
|
||||
glColor3ub(255, 255, 255);
|
||||
sprintf(str, " Z:%-.3f |", *zpf);
|
||||
BLI_snprintf(str, sizeof(str), " Z:%-.3f |", *zpf);
|
||||
BLF_position(blf_mono_font, dx, 6, 0);
|
||||
BLF_draw_ascii(blf_mono_font, str, sizeof(str));
|
||||
dx += BLF_width(blf_mono_font, str);
|
||||
@ -163,33 +163,33 @@ void draw_image_info(ARegion *ar, int color_manage, int channels, int x, int y,
|
||||
if(channels >= 3) {
|
||||
glColor3ubv(red);
|
||||
if (fp)
|
||||
sprintf(str, " R:%-.4f", fp[0]);
|
||||
BLI_snprintf(str, sizeof(str), " R:%-.4f", fp[0]);
|
||||
else if (cp)
|
||||
sprintf(str, " R:%-3d", cp[0]);
|
||||
BLI_snprintf(str, sizeof(str), " R:%-3d", cp[0]);
|
||||
else
|
||||
sprintf(str, " R:-");
|
||||
BLI_snprintf(str, sizeof(str), " R:-");
|
||||
BLF_position(blf_mono_font, dx, 6, 0);
|
||||
BLF_draw_ascii(blf_mono_font, str, sizeof(str));
|
||||
dx += BLF_width(blf_mono_font, str);
|
||||
|
||||
glColor3ubv(green);
|
||||
if (fp)
|
||||
sprintf(str, " G:%-.4f", fp[1]);
|
||||
BLI_snprintf(str, sizeof(str), " G:%-.4f", fp[1]);
|
||||
else if (cp)
|
||||
sprintf(str, " G:%-3d", cp[1]);
|
||||
BLI_snprintf(str, sizeof(str), " G:%-3d", cp[1]);
|
||||
else
|
||||
sprintf(str, " G:-");
|
||||
BLI_snprintf(str, sizeof(str), " G:-");
|
||||
BLF_position(blf_mono_font, dx, 6, 0);
|
||||
BLF_draw_ascii(blf_mono_font, str, sizeof(str));
|
||||
dx += BLF_width(blf_mono_font, str);
|
||||
|
||||
glColor3ubv(blue);
|
||||
if (fp)
|
||||
sprintf(str, " B:%-.4f", fp[2]);
|
||||
BLI_snprintf(str, sizeof(str), " B:%-.4f", fp[2]);
|
||||
else if (cp)
|
||||
sprintf(str, " B:%-3d", cp[2]);
|
||||
BLI_snprintf(str, sizeof(str), " B:%-3d", cp[2]);
|
||||
else
|
||||
sprintf(str, " B:-");
|
||||
BLI_snprintf(str, sizeof(str), " B:-");
|
||||
BLF_position(blf_mono_font, dx, 6, 0);
|
||||
BLF_draw_ascii(blf_mono_font, str, sizeof(str));
|
||||
dx += BLF_width(blf_mono_font, str);
|
||||
@ -197,11 +197,11 @@ void draw_image_info(ARegion *ar, int color_manage, int channels, int x, int y,
|
||||
if(channels == 4) {
|
||||
glColor3ub(255, 255, 255);
|
||||
if (fp)
|
||||
sprintf(str, " A:%-.4f", fp[3]);
|
||||
BLI_snprintf(str, sizeof(str), " A:%-.4f", fp[3]);
|
||||
else if (cp)
|
||||
sprintf(str, " A:%-3d", cp[3]);
|
||||
BLI_snprintf(str, sizeof(str), " A:%-3d", cp[3]);
|
||||
else
|
||||
sprintf(str, "- ");
|
||||
BLI_snprintf(str, sizeof(str), "- ");
|
||||
BLF_position(blf_mono_font, dx, 6, 0);
|
||||
BLF_draw_ascii(blf_mono_font, str, sizeof(str));
|
||||
dx += BLF_width(blf_mono_font, str);
|
||||
@ -269,12 +269,12 @@ void draw_image_info(ARegion *ar, int color_manage, int channels, int x, int y,
|
||||
rgb_to_yuv((float)cp[0]/255.0f, (float)cp[0]/255.0f, (float)cp[0]/255.0f, &lum, &u, &v);
|
||||
}
|
||||
|
||||
sprintf(str, "V:%-.4f", val);
|
||||
BLI_snprintf(str, sizeof(str), "V:%-.4f", val);
|
||||
BLF_position(blf_mono_font, dx, 6, 0);
|
||||
BLF_draw_ascii(blf_mono_font, str, sizeof(str));
|
||||
dx += BLF_width(blf_mono_font, str);
|
||||
|
||||
sprintf(str, " L:%-.4f", lum);
|
||||
BLI_snprintf(str, sizeof(str), " L:%-.4f", lum);
|
||||
BLF_position(blf_mono_font, dx, 6, 0);
|
||||
BLF_draw_ascii(blf_mono_font, str, sizeof(str));
|
||||
dx += BLF_width(blf_mono_font, str);
|
||||
@ -289,22 +289,22 @@ void draw_image_info(ARegion *ar, int color_manage, int channels, int x, int y,
|
||||
rgb_to_yuv((float)cp[0]/255.0f, (float)cp[1]/255.0f, (float)cp[2]/255.0f, &lum, &u, &v);
|
||||
}
|
||||
|
||||
sprintf(str, "H:%-.4f", hue);
|
||||
BLI_snprintf(str, sizeof(str), "H:%-.4f", hue);
|
||||
BLF_position(blf_mono_font, dx, 6, 0);
|
||||
BLF_draw_ascii(blf_mono_font, str, sizeof(str));
|
||||
dx += BLF_width(blf_mono_font, str);
|
||||
|
||||
sprintf(str, " S:%-.4f", sat);
|
||||
BLI_snprintf(str, sizeof(str), " S:%-.4f", sat);
|
||||
BLF_position(blf_mono_font, dx, 6, 0);
|
||||
BLF_draw_ascii(blf_mono_font, str, sizeof(str));
|
||||
dx += BLF_width(blf_mono_font, str);
|
||||
|
||||
sprintf(str, " V:%-.4f", val);
|
||||
BLI_snprintf(str, sizeof(str), " V:%-.4f", val);
|
||||
BLF_position(blf_mono_font, dx, 6, 0);
|
||||
BLF_draw_ascii(blf_mono_font, str, sizeof(str));
|
||||
dx += BLF_width(blf_mono_font, str);
|
||||
|
||||
sprintf(str, " L:%-.4f", lum);
|
||||
BLI_snprintf(str, sizeof(str), " L:%-.4f", lum);
|
||||
BLF_position(blf_mono_font, dx, 6, 0);
|
||||
BLF_draw_ascii(blf_mono_font, str, sizeof(str));
|
||||
dx += BLF_width(blf_mono_font, str);
|
||||
|
@ -143,7 +143,7 @@ static int unpack_all_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)
|
||||
Main *bmain= CTX_data_main(C);
|
||||
uiPopupMenu *pup;
|
||||
uiLayout *layout;
|
||||
char title[128];
|
||||
char title[64];
|
||||
int count = 0;
|
||||
|
||||
count = countPackedFiles(bmain);
|
||||
@ -155,9 +155,9 @@ static int unpack_all_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)
|
||||
}
|
||||
|
||||
if(count == 1)
|
||||
sprintf(title, "Unpack 1 file");
|
||||
strcpy(title, "Unpack 1 file");
|
||||
else
|
||||
sprintf(title, "Unpack %d files", count);
|
||||
BLI_snprintf(title, sizeof(title), "Unpack %d files", count);
|
||||
|
||||
pup= uiPupMenuBegin(C, title, ICON_NONE);
|
||||
layout= uiPupMenuLayout(pup);
|
||||
|
@ -3580,7 +3580,7 @@ static void draw_controller_header(uiLayout *layout, PointerRNA *ptr, int xco, i
|
||||
bController *cont= (bController *)ptr->data;
|
||||
|
||||
char state[3];
|
||||
sprintf(state, "%d", RNA_int_get(ptr, "states"));
|
||||
BLI_snprintf(state, sizeof(state), "%d", RNA_int_get(ptr, "states"));
|
||||
|
||||
box= uiLayoutBox(layout);
|
||||
row= uiLayoutRow(box, 0);
|
||||
@ -4497,7 +4497,7 @@ static void logic_buttons_new(bContext *C, ARegion *ar)
|
||||
RNA_pointer_create(NULL, &RNA_SpaceLogicEditor, slogic, &logic_ptr);
|
||||
idar= get_selected_and_linked_obs(C, &count, slogic->scaflag);
|
||||
|
||||
sprintf(uiblockstr, "buttonswin %p", (void *)ar);
|
||||
BLI_snprintf(uiblockstr, sizeof(uiblockstr), "buttonswin %p", (void *)ar);
|
||||
block= uiBeginBlock(C, ar, uiblockstr, UI_EMBOSS);
|
||||
uiBlockSetHandleFunc(block, do_logic_buts, NULL);
|
||||
|
||||
@ -4815,7 +4815,7 @@ void logic_buttons(bContext *C, ARegion *ar)
|
||||
if(ob==NULL) return;
|
||||
// uiSetButLock(object_is_libdata(ob), ERROR_LIBDATA_MESSAGE);
|
||||
|
||||
sprintf(numstr, "buttonswin %p", (void *)ar);
|
||||
BLI_snprintf(numstr, sizeof(numstr), "buttonswin %p", (void *)ar);
|
||||
block= uiBeginBlock(C, ar, numstr, UI_EMBOSS);
|
||||
uiBlockSetHandleFunc(block, do_logic_buts, NULL);
|
||||
|
||||
|
@ -715,7 +715,7 @@ static void draw_nla_channel_list_gl (bAnimContext *ac, ListBase *anim_data, Vie
|
||||
}
|
||||
|
||||
sel = SEL_NLT(nlt);
|
||||
strcpy(name, nlt->name);
|
||||
BLI_strncpy(name, nlt->name, sizeof(name));
|
||||
|
||||
// draw manually still
|
||||
doDraw= 1;
|
||||
|
@ -749,7 +749,7 @@ static void outliner_find_panel(Scene *UNUSED(scene), ARegion *ar, SpaceOops *so
|
||||
TreeElement *last_find;
|
||||
TreeStoreElem *tselem;
|
||||
int ytop, xdelta, prevFound=0;
|
||||
char name[32];
|
||||
char name[sizeof(soops->search_string)];
|
||||
|
||||
/* get last found tree-element based on stored search_tse */
|
||||
last_find= outliner_find_tse(soops, &soops->search_tse);
|
||||
@ -803,7 +803,7 @@ static void outliner_find_panel(Scene *UNUSED(scene), ARegion *ar, SpaceOops *so
|
||||
/* store selection */
|
||||
soops->search_tse= *tselem;
|
||||
|
||||
BLI_strncpy(soops->search_string, name, 33);
|
||||
BLI_strncpy(soops->search_string, name, sizeof(soops->search_string));
|
||||
soops->search_flags= flags;
|
||||
|
||||
/* redraw */
|
||||
|
@ -75,7 +75,7 @@ static void text_font_end(SpaceText *UNUSED(st))
|
||||
static int text_font_draw(SpaceText *UNUSED(st), int x, int y, char *str)
|
||||
{
|
||||
BLF_position(mono, x, y, 0);
|
||||
BLF_draw(mono, str, 65535); /* XXX, use real length */
|
||||
BLF_draw(mono, str, BLF_DRAW_STR_DUMMY_MAX);
|
||||
|
||||
return BLF_width(mono, str);
|
||||
}
|
||||
|
@ -4539,7 +4539,7 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv
|
||||
|
||||
for(a=0, pa=psys->particles; a<totpart; a++, pa++){
|
||||
float vec_txt[3];
|
||||
sprintf(numstr, "%i", a);
|
||||
BLI_snprintf(numstr, sizeof(numstr), "%i", a);
|
||||
/* use worldspace beause object matrix is already applied */
|
||||
mul_v3_m4v3(vec_txt, ob->imat, cache[a]->co);
|
||||
view3d_cached_text_draw_add(vec_txt, numstr, 10, V3D_CACHE_TEXT_WORLDSPACE|V3D_CACHE_TEXT_ASCII, tcol);
|
||||
|
@ -863,24 +863,24 @@ static void draw_selected_name(Scene *scene, Object *ob)
|
||||
}
|
||||
}
|
||||
if(name && markern)
|
||||
sprintf(info, "(%d) %s %s <%s>", CFRA, ob->id.name+2, name, markern);
|
||||
BLI_snprintf(info, sizeof(info), "(%d) %s %s <%s>", CFRA, ob->id.name+2, name, markern);
|
||||
else if(name)
|
||||
sprintf(info, "(%d) %s %s", CFRA, ob->id.name+2, name);
|
||||
BLI_snprintf(info, sizeof(info), "(%d) %s %s", CFRA, ob->id.name+2, name);
|
||||
else
|
||||
sprintf(info, "(%d) %s", CFRA, ob->id.name+2);
|
||||
BLI_snprintf(info, sizeof(info), "(%d) %s", CFRA, ob->id.name+2);
|
||||
}
|
||||
else if(ELEM3(ob->type, OB_MESH, OB_LATTICE, OB_CURVE)) {
|
||||
Key *key= NULL;
|
||||
KeyBlock *kb = NULL;
|
||||
char shapes[75];
|
||||
char shapes[MAX_NAME + 10];
|
||||
|
||||
/* try to display active shapekey too */
|
||||
shapes[0] = 0;
|
||||
shapes[0] = '\0';
|
||||
key = ob_get_key(ob);
|
||||
if(key){
|
||||
kb = BLI_findlink(&key->block, ob->shapenr-1);
|
||||
if(kb){
|
||||
sprintf(shapes, ": %s ", kb->name);
|
||||
BLI_snprintf(shapes, sizeof(shapes), ": %s ", kb->name);
|
||||
if(ob->shapeflag == OB_SHAPE_LOCK){
|
||||
strcat(shapes, " (Pinned)");
|
||||
}
|
||||
@ -888,16 +888,16 @@ static void draw_selected_name(Scene *scene, Object *ob)
|
||||
}
|
||||
|
||||
if(markern)
|
||||
sprintf(info, "(%d) %s %s <%s>", CFRA, ob->id.name+2, shapes, markern);
|
||||
BLI_snprintf(info, sizeof(info), "(%d) %s %s <%s>", CFRA, ob->id.name+2, shapes, markern);
|
||||
else
|
||||
sprintf(info, "(%d) %s %s", CFRA, ob->id.name+2, shapes);
|
||||
BLI_snprintf(info, sizeof(info), "(%d) %s %s", CFRA, ob->id.name+2, shapes);
|
||||
}
|
||||
else {
|
||||
/* standard object */
|
||||
if (markern)
|
||||
sprintf(info, "(%d) %s <%s>", CFRA, ob->id.name+2, markern);
|
||||
BLI_snprintf(info, sizeof(info), "(%d) %s <%s>", CFRA, ob->id.name+2, markern);
|
||||
else
|
||||
sprintf(info, "(%d) %s", CFRA, ob->id.name+2);
|
||||
BLI_snprintf(info, sizeof(info), "(%d) %s", CFRA, ob->id.name+2);
|
||||
}
|
||||
|
||||
/* color depends on whether there is a keyframe */
|
||||
@ -909,9 +909,9 @@ static void draw_selected_name(Scene *scene, Object *ob)
|
||||
else {
|
||||
/* no object */
|
||||
if (markern)
|
||||
sprintf(info, "(%d) <%s>", CFRA, markern);
|
||||
BLI_snprintf(info, sizeof(info), "(%d) <%s>", CFRA, markern);
|
||||
else
|
||||
sprintf(info, "(%d)", CFRA);
|
||||
BLI_snprintf(info, sizeof(info), "(%d)", CFRA);
|
||||
|
||||
/* color is always white */
|
||||
UI_ThemeColor(TH_TEXT_HI);
|
||||
@ -920,7 +920,7 @@ static void draw_selected_name(Scene *scene, Object *ob)
|
||||
if (U.uiflag & USER_SHOW_ROTVIEWICON)
|
||||
offset = 14 + (U.rvisize * 2);
|
||||
|
||||
BLF_draw_default(offset, 10, 0.0f, info, sizeof(info)-1);
|
||||
BLF_draw_default(offset, 10, 0.0f, info, sizeof(info));
|
||||
}
|
||||
|
||||
static void view3d_camera_border(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D *rv3d, rctf *viewborder_r, short no_shift, short no_zoom)
|
||||
@ -2623,7 +2623,7 @@ static void draw_viewport_fps(Scene *scene, ARegion *ar)
|
||||
BLI_snprintf(printable, sizeof(printable), "fps: %i", (int)(fps+0.5f));
|
||||
}
|
||||
|
||||
BLF_draw_default_ascii(22, ar->winy-17, 0.0f, printable, sizeof(printable)-1);
|
||||
BLF_draw_default_ascii(22, ar->winy-17, 0.0f, printable, sizeof(printable));
|
||||
}
|
||||
|
||||
static int view3d_main_area_draw_engine(const bContext *C, ARegion *ar)
|
||||
@ -2897,7 +2897,8 @@ static void view3d_main_area_draw_info(const bContext *C, ARegion *ar, const cha
|
||||
BLI_snprintf(numstr, sizeof(numstr), "%s x %.4g", grid_unit, v3d->grid);
|
||||
}
|
||||
|
||||
BLF_draw_default_ascii(22, ar->winy-(USER_SHOW_VIEWPORTNAME?40:20), 0.0f, numstr[0]?numstr : grid_unit, sizeof(numstr)); /* XXX, use real length */
|
||||
BLF_draw_default_ascii(22, ar->winy-(USER_SHOW_VIEWPORTNAME?40:20), 0.0f,
|
||||
numstr[0] ? numstr : grid_unit, sizeof(numstr));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -59,6 +59,7 @@
|
||||
|
||||
#include "BLI_math.h"
|
||||
#include "BLI_utildefines.h"
|
||||
#include "BLI_string.h"
|
||||
|
||||
//#include "blendef.h"
|
||||
//
|
||||
@ -552,7 +553,7 @@ static void applyObjectConstraintRot(TransInfo *t, TransData *td, float vec[3],
|
||||
|
||||
void setConstraint(TransInfo *t, float space[3][3], int mode, const char text[])
|
||||
{
|
||||
strncpy(t->con.text + 1, text, 48);
|
||||
BLI_strncpy(t->con.text + 1, text, sizeof(t->con.text) - 1);
|
||||
copy_m3_m3(t->con.mtx, space);
|
||||
t->con.mode = mode;
|
||||
getConstraintMatrix(t);
|
||||
@ -579,7 +580,7 @@ void setLocalConstraint(TransInfo *t, int mode, const char text[])
|
||||
setConstraint(t, t->data->axismtx, mode, text);
|
||||
}
|
||||
else {
|
||||
strncpy(t->con.text + 1, text, 48);
|
||||
BLI_strncpy(t->con.text + 1, text, sizeof(t->con.text) - 1);
|
||||
copy_m3_m3(t->con.mtx, t->data->axismtx);
|
||||
t->con.mode = mode;
|
||||
getConstraintMatrix(t);
|
||||
@ -598,7 +599,7 @@ void setLocalConstraint(TransInfo *t, int mode, const char text[])
|
||||
/*
|
||||
Set the constraint according to the user defined orientation
|
||||
|
||||
ftext is a format string passed to sprintf. It will add the name of
|
||||
ftext is a format string passed to BLI_snprintf. It will add the name of
|
||||
the orientation where %s is (logically).
|
||||
*/
|
||||
void setUserConstraint(TransInfo *t, short orientation, int mode, const char ftext[])
|
||||
@ -609,28 +610,28 @@ void setUserConstraint(TransInfo *t, short orientation, int mode, const char fte
|
||||
case V3D_MANIP_GLOBAL:
|
||||
{
|
||||
float mtx[3][3]= MAT3_UNITY;
|
||||
sprintf(text, ftext, "global");
|
||||
BLI_snprintf(text, sizeof(text), ftext, "global");
|
||||
setConstraint(t, mtx, mode, text);
|
||||
}
|
||||
break;
|
||||
case V3D_MANIP_LOCAL:
|
||||
sprintf(text, ftext, "local");
|
||||
BLI_snprintf(text, sizeof(text), ftext, "local");
|
||||
setLocalConstraint(t, mode, text);
|
||||
break;
|
||||
case V3D_MANIP_NORMAL:
|
||||
sprintf(text, ftext, "normal");
|
||||
BLI_snprintf(text, sizeof(text), ftext, "normal");
|
||||
setConstraint(t, t->spacemtx, mode, text);
|
||||
break;
|
||||
case V3D_MANIP_VIEW:
|
||||
sprintf(text, ftext, "view");
|
||||
BLI_snprintf(text, sizeof(text), ftext, "view");
|
||||
setConstraint(t, t->spacemtx, mode, text);
|
||||
break;
|
||||
case V3D_MANIP_GIMBAL:
|
||||
sprintf(text, ftext, "gimbal");
|
||||
BLI_snprintf(text, sizeof(text), ftext, "gimbal");
|
||||
setConstraint(t, t->spacemtx, mode, text);
|
||||
break;
|
||||
default: /* V3D_MANIP_CUSTOM */
|
||||
sprintf(text, ftext, t->spacename);
|
||||
BLI_snprintf(text, sizeof(text), ftext, t->spacename);
|
||||
setConstraint(t, t->spacemtx, mode, text);
|
||||
break;
|
||||
}
|
||||
@ -874,11 +875,11 @@ static void setNearestAxis2d(TransInfo *t)
|
||||
/* no correction needed... just use whichever one is lower */
|
||||
if ( abs(t->mval[0]-t->con.imval[0]) < abs(t->mval[1]-t->con.imval[1]) ) {
|
||||
t->con.mode |= CON_AXIS1;
|
||||
sprintf(t->con.text, " along Y axis");
|
||||
BLI_snprintf(t->con.text, sizeof(t->con.text), " along Y axis");
|
||||
}
|
||||
else {
|
||||
t->con.mode |= CON_AXIS0;
|
||||
sprintf(t->con.text, " along X axis");
|
||||
BLI_snprintf(t->con.text, sizeof(t->con.text), " along X axis");
|
||||
}
|
||||
}
|
||||
|
||||
@ -929,31 +930,31 @@ static void setNearestAxis3d(TransInfo *t)
|
||||
if (len[0] <= len[1] && len[0] <= len[2]) {
|
||||
if (t->modifiers & MOD_CONSTRAINT_PLANE) {
|
||||
t->con.mode |= (CON_AXIS1|CON_AXIS2);
|
||||
sprintf(t->con.text, " locking %s X axis", t->spacename);
|
||||
BLI_snprintf(t->con.text, sizeof(t->con.text), " locking %s X axis", t->spacename);
|
||||
}
|
||||
else {
|
||||
t->con.mode |= CON_AXIS0;
|
||||
sprintf(t->con.text, " along %s X axis", t->spacename);
|
||||
BLI_snprintf(t->con.text, sizeof(t->con.text), " along %s X axis", t->spacename);
|
||||
}
|
||||
}
|
||||
else if (len[1] <= len[0] && len[1] <= len[2]) {
|
||||
if (t->modifiers & MOD_CONSTRAINT_PLANE) {
|
||||
t->con.mode |= (CON_AXIS0|CON_AXIS2);
|
||||
sprintf(t->con.text, " locking %s Y axis", t->spacename);
|
||||
BLI_snprintf(t->con.text, sizeof(t->con.text), " locking %s Y axis", t->spacename);
|
||||
}
|
||||
else {
|
||||
t->con.mode |= CON_AXIS1;
|
||||
sprintf(t->con.text, " along %s Y axis", t->spacename);
|
||||
BLI_snprintf(t->con.text, sizeof(t->con.text), " along %s Y axis", t->spacename);
|
||||
}
|
||||
}
|
||||
else if (len[2] <= len[1] && len[2] <= len[0]) {
|
||||
if (t->modifiers & MOD_CONSTRAINT_PLANE) {
|
||||
t->con.mode |= (CON_AXIS0|CON_AXIS1);
|
||||
sprintf(t->con.text, " locking %s Z axis", t->spacename);
|
||||
BLI_snprintf(t->con.text, sizeof(t->con.text), " locking %s Z axis", t->spacename);
|
||||
}
|
||||
else {
|
||||
t->con.mode |= CON_AXIS2;
|
||||
sprintf(t->con.text, " along %s Z axis", t->spacename);
|
||||
BLI_snprintf(t->con.text, sizeof(t->con.text), " along %s Z axis", t->spacename);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -179,18 +179,18 @@ void unpack_menu(bContext *C, const char *opname, const char *id_name, const cha
|
||||
|
||||
BLI_strncpy(local_name, abs_name, sizeof(local_name));
|
||||
BLI_splitdirstring(local_name, fi);
|
||||
sprintf(local_name, "//%s/%s", folder, fi);
|
||||
BLI_snprintf(local_name, sizeof(local_name), "//%s/%s", folder, fi);
|
||||
if(strcmp(abs_name, local_name)!=0) {
|
||||
switch(checkPackedFile(local_name, pf)) {
|
||||
case PF_NOFILE:
|
||||
sprintf(line, "Create %s", local_name);
|
||||
BLI_snprintf(line, sizeof(line), "Create %s", local_name);
|
||||
props_ptr= uiItemFullO(layout, opname, line, ICON_NONE, NULL, WM_OP_EXEC_DEFAULT, UI_ITEM_O_RETURN_PROPS);
|
||||
RNA_enum_set(&props_ptr, "method", PF_WRITE_LOCAL);
|
||||
RNA_string_set(&props_ptr, "id", id_name);
|
||||
|
||||
break;
|
||||
case PF_EQUAL:
|
||||
sprintf(line, "Use %s (identical)", local_name);
|
||||
BLI_snprintf(line, sizeof(line), "Use %s (identical)", local_name);
|
||||
//uiItemEnumO(layout, opname, line, 0, "method", PF_USE_LOCAL);
|
||||
props_ptr= uiItemFullO(layout, opname, line, ICON_NONE, NULL, WM_OP_EXEC_DEFAULT, UI_ITEM_O_RETURN_PROPS);
|
||||
RNA_enum_set(&props_ptr, "method", PF_USE_LOCAL);
|
||||
@ -198,13 +198,13 @@ void unpack_menu(bContext *C, const char *opname, const char *id_name, const cha
|
||||
|
||||
break;
|
||||
case PF_DIFFERS:
|
||||
sprintf(line, "Use %s (differs)", local_name);
|
||||
BLI_snprintf(line, sizeof(line), "Use %s (differs)", local_name);
|
||||
//uiItemEnumO(layout, opname, line, 0, "method", PF_USE_LOCAL);
|
||||
props_ptr= uiItemFullO(layout, opname, line, ICON_NONE, NULL, WM_OP_EXEC_DEFAULT, UI_ITEM_O_RETURN_PROPS);
|
||||
RNA_enum_set(&props_ptr, "method", PF_USE_LOCAL);
|
||||
RNA_string_set(&props_ptr, "id", id_name);
|
||||
|
||||
sprintf(line, "Overwrite %s", local_name);
|
||||
BLI_snprintf(line, sizeof(line), "Overwrite %s", local_name);
|
||||
//uiItemEnumO(layout, opname, line, 0, "method", PF_WRITE_LOCAL);
|
||||
props_ptr= uiItemFullO(layout, opname, line, ICON_NONE, NULL, WM_OP_EXEC_DEFAULT, UI_ITEM_O_RETURN_PROPS);
|
||||
RNA_enum_set(&props_ptr, "method", PF_WRITE_LOCAL);
|
||||
@ -216,27 +216,27 @@ void unpack_menu(bContext *C, const char *opname, const char *id_name, const cha
|
||||
|
||||
switch(checkPackedFile(abs_name, pf)) {
|
||||
case PF_NOFILE:
|
||||
sprintf(line, "Create %s", abs_name);
|
||||
BLI_snprintf(line, sizeof(line), "Create %s", abs_name);
|
||||
//uiItemEnumO(layout, opname, line, 0, "method", PF_WRITE_ORIGINAL);
|
||||
props_ptr= uiItemFullO(layout, opname, line, ICON_NONE, NULL, WM_OP_EXEC_DEFAULT, UI_ITEM_O_RETURN_PROPS);
|
||||
RNA_enum_set(&props_ptr, "method", PF_WRITE_ORIGINAL);
|
||||
RNA_string_set(&props_ptr, "id", id_name);
|
||||
break;
|
||||
case PF_EQUAL:
|
||||
sprintf(line, "Use %s (identical)", abs_name);
|
||||
BLI_snprintf(line, sizeof(line), "Use %s (identical)", abs_name);
|
||||
//uiItemEnumO(layout, opname, line, 0, "method", PF_USE_ORIGINAL);
|
||||
props_ptr= uiItemFullO(layout, opname, line, ICON_NONE, NULL, WM_OP_EXEC_DEFAULT, UI_ITEM_O_RETURN_PROPS);
|
||||
RNA_enum_set(&props_ptr, "method", PF_USE_ORIGINAL);
|
||||
RNA_string_set(&props_ptr, "id", id_name);
|
||||
break;
|
||||
case PF_DIFFERS:
|
||||
sprintf(line, "Use %s (differs)", abs_name);
|
||||
BLI_snprintf(line, sizeof(line), "Use %s (differs)", abs_name);
|
||||
//uiItemEnumO(layout, opname, line, 0, "method", PF_USE_ORIGINAL);
|
||||
props_ptr= uiItemFullO(layout, opname, line, ICON_NONE, NULL, WM_OP_EXEC_DEFAULT, UI_ITEM_O_RETURN_PROPS);
|
||||
RNA_enum_set(&props_ptr, "method", PF_USE_ORIGINAL);
|
||||
RNA_string_set(&props_ptr, "id", id_name);
|
||||
|
||||
sprintf(line, "Overwrite %s", abs_name);
|
||||
BLI_snprintf(line, sizeof(line), "Overwrite %s", abs_name);
|
||||
//uiItemEnumO(layout, opname, line, 0, "method", PF_WRITE_ORIGINAL);
|
||||
props_ptr= uiItemFullO(layout, opname, line, ICON_NONE, NULL, WM_OP_EXEC_DEFAULT, UI_ITEM_O_RETURN_PROPS);
|
||||
RNA_enum_set(&props_ptr, "method", PF_WRITE_ORIGINAL);
|
||||
|
@ -31,9 +31,10 @@
|
||||
|
||||
|
||||
#include <math.h> /* fabs */
|
||||
#include <stdio.h> /* for sprintf */
|
||||
#include <stdio.h> /* for size_t */
|
||||
|
||||
#include "BLI_utildefines.h"
|
||||
#include "BLI_string.h"
|
||||
|
||||
#include "WM_types.h"
|
||||
|
||||
@ -84,34 +85,34 @@ void outputNumInput(NumInput *n, char *str)
|
||||
inv[0] = 0;
|
||||
|
||||
if( n->val[i] > 1e10f || n->val[i] < -1e10f )
|
||||
sprintf(&str[j*20], "%s%.4e%c", inv, n->val[i], cur);
|
||||
BLI_snprintf(&str[j*20], 20, "%s%.4e%c", inv, n->val[i], cur);
|
||||
else
|
||||
switch (n->ctrl[i]) {
|
||||
case 0:
|
||||
sprintf(&str[j*20], "%sNONE%c", inv, cur);
|
||||
BLI_snprintf(&str[j*20], 20, "%sNONE%c", inv, cur);
|
||||
break;
|
||||
case 1:
|
||||
case -1:
|
||||
sprintf(&str[j*20], "%s%.0f%c", inv, n->val[i], cur);
|
||||
BLI_snprintf(&str[j*20], 20, "%s%.0f%c", inv, n->val[i], cur);
|
||||
break;
|
||||
case 10:
|
||||
case -10:
|
||||
sprintf(&str[j*20], "%s%.f.%c", inv, n->val[i], cur);
|
||||
BLI_snprintf(&str[j*20], 20, "%s%.f.%c", inv, n->val[i], cur);
|
||||
break;
|
||||
case 100:
|
||||
case -100:
|
||||
sprintf(&str[j*20], "%s%.1f%c", inv, n->val[i], cur);
|
||||
BLI_snprintf(&str[j*20], 20, "%s%.1f%c", inv, n->val[i], cur);
|
||||
break;
|
||||
case 1000:
|
||||
case -1000:
|
||||
sprintf(&str[j*20], "%s%.2f%c", inv, n->val[i], cur);
|
||||
BLI_snprintf(&str[j*20], 20, "%s%.2f%c", inv, n->val[i], cur);
|
||||
break;
|
||||
case 10000:
|
||||
case -10000:
|
||||
sprintf(&str[j*20], "%s%.3f%c", inv, n->val[i], cur);
|
||||
BLI_snprintf(&str[j*20], 20, "%s%.3f%c", inv, n->val[i], cur);
|
||||
break;
|
||||
default:
|
||||
sprintf(&str[j*20], "%s%.4e%c", inv, n->val[i], cur);
|
||||
BLI_snprintf(&str[j*20], 20, "%s%.4e%c", inv, n->val[i], cur);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -46,6 +46,7 @@
|
||||
#include "BLI_editVert.h"
|
||||
#include "BLI_uvproject.h"
|
||||
#include "BLI_utildefines.h"
|
||||
#include "BLI_string.h"
|
||||
|
||||
#include "BKE_context.h"
|
||||
#include "BKE_customdata.h"
|
||||
@ -334,7 +335,7 @@ static void minimize_stretch_iteration(bContext *C, wmOperator *op, int interact
|
||||
param_flush(ms->handle);
|
||||
|
||||
if(sa) {
|
||||
sprintf(str, "Minimize Stretch. Blend %.2f", ms->blend);
|
||||
BLI_snprintf(str, sizeof(str), "Minimize Stretch. Blend %.2f", ms->blend);
|
||||
ED_area_headerprint(sa, str);
|
||||
}
|
||||
|
||||
|
@ -173,7 +173,7 @@ static void gpu_material_set_attrib_id(GPUMaterial *material)
|
||||
* removed by the glsl compiler by dead code elimination */
|
||||
|
||||
for(a=0, b=0; a<attribs->totlayer; a++) {
|
||||
sprintf(name, "att%d", attribs->layer[a].attribid);
|
||||
BLI_snprintf(name, sizeof(name), "att%d", attribs->layer[a].attribid);
|
||||
attribs->layer[a].glindex = GPU_shader_get_attribute(shader, name);
|
||||
|
||||
if(attribs->layer[a].glindex >= 0) {
|
||||
|
@ -1289,7 +1289,7 @@ struct ImBuf * IMB_anim_absolute(struct anim * anim, int position,
|
||||
|
||||
if (ibuf) {
|
||||
if (filter_y) IMB_filtery(ibuf);
|
||||
sprintf(ibuf->name, "%s.%04d", anim->name, anim->curposition + 1);
|
||||
BLI_snprintf(ibuf->name, sizeof(ibuf->name), "%s.%04d", anim->name, anim->curposition + 1);
|
||||
|
||||
}
|
||||
return(ibuf);
|
||||
|
@ -605,7 +605,7 @@ void ntreeCompositExecTree(bNodeTree *ntree, RenderData *rd, int do_preview)
|
||||
ntree->progress(ntree->prh, (1.0f - curnode/(float)totnode));
|
||||
if(ntree->stats_draw) {
|
||||
char str[128];
|
||||
sprintf(str, "Compositing %d %s", curnode, node->name);
|
||||
BLI_snprintf(str, sizeof(str), "Compositing %d %s", curnode, node->name);
|
||||
ntree->stats_draw(ntree->sdh, str);
|
||||
}
|
||||
curnode--;
|
||||
|
@ -1257,8 +1257,9 @@ static uiBlock *wm_block_create_splash(bContext *C, ARegion *ar, void *UNUSED(ar
|
||||
version_str = &version_buf[0];
|
||||
revision_str = &revision_buf[0];
|
||||
|
||||
sprintf(version_str, "%d.%02d.%d", BLENDER_VERSION/100, BLENDER_VERSION%100, BLENDER_SUBVERSION);
|
||||
sprintf(revision_str, "r%s", build_rev);
|
||||
BLI_snprintf(version_str, sizeof(version_str),
|
||||
"%d.%02d.%d", BLENDER_VERSION/100, BLENDER_VERSION%100, BLENDER_SUBVERSION);
|
||||
BLI_snprintf(revision_str, sizeof(revision_str), "r%s", build_rev);
|
||||
|
||||
BLF_size(style->widgetlabel.uifont_id, style->widgetlabel.points, U.dpi);
|
||||
ver_width = (int)BLF_width(style->widgetlabel.uifont_id, version_str) + 5;
|
||||
|
Loading…
Reference in New Issue
Block a user