forked from bartvdbraak/blender
svn merge ^/trunk/blender -r43278:43294
This commit is contained in:
commit
a7b0a11811
@ -156,7 +156,7 @@ endif()
|
||||
|
||||
if(UNIX AND NOT APPLE)
|
||||
option(WITH_X11_XINPUT "Enable X11 Xinput (tablet support and unicode input)" ON)
|
||||
option(WITH_X11_XF86VMODE "Enable X11 video mode switching" OFF)
|
||||
option(WITH_X11_XF86VMODE "Enable X11 video mode switching" ON)
|
||||
option(WITH_BUILTIN_GLEW "Use GLEW OpenGL wrapper library bundled with blender" ON)
|
||||
option(WITH_XDG_USER_DIRS "Build with XDG Base Directory Specification (only config and documents for now)" OFF)
|
||||
mark_as_advanced(WITH_XDG_USER_DIRS)
|
||||
|
2
extern/libmv/CMakeLists.txt
vendored
2
extern/libmv/CMakeLists.txt
vendored
@ -22,7 +22,7 @@
|
||||
#
|
||||
# ***** END GPL LICENSE BLOCK *****
|
||||
|
||||
# NOTEL This file is automatically generated by bundle.sh script
|
||||
# NOTE: This file is automatically generated by bundle.sh script
|
||||
# If you're doing changes in this file, please update template
|
||||
# in that script too
|
||||
|
||||
|
2
extern/libmv/SConscript
vendored
2
extern/libmv/SConscript
vendored
@ -1,6 +1,6 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
# NOTEL This file is automatically generated by bundle.sh script
|
||||
# NOTE: This file is automatically generated by bundle.sh script
|
||||
# If you're doing changes in this file, please update template
|
||||
# in that script too
|
||||
|
||||
|
4
extern/libmv/bundle.sh
vendored
4
extern/libmv/bundle.sh
vendored
@ -113,7 +113,7 @@ cat > CMakeLists.txt << EOF
|
||||
#
|
||||
# ***** END GPL LICENSE BLOCK *****
|
||||
|
||||
# NOTEL This file is automatically generated by bundle.sh script
|
||||
# NOTE: This file is automatically generated by bundle.sh script
|
||||
# If you're doing changes in this file, please update template
|
||||
# in that script too
|
||||
|
||||
@ -209,7 +209,7 @@ EOF
|
||||
cat > SConscript << EOF
|
||||
#!/usr/bin/python
|
||||
|
||||
# NOTEL This file is automatically generated by bundle.sh script
|
||||
# NOTE: This file is automatically generated by bundle.sh script
|
||||
# If you're doing changes in this file, please update template
|
||||
# in that script too
|
||||
|
||||
|
@ -228,7 +228,12 @@ void BlenderSync::sync_objects(BL::SpaceView3D b_v3d)
|
||||
|
||||
for(b_ob->dupli_list.begin(b_dup); b_dup != b_ob->dupli_list.end(); ++b_dup) {
|
||||
Transform tfm = get_transform(b_dup->matrix());
|
||||
sync_object(*b_ob, b_index, b_dup->object(), tfm, ob_layer);
|
||||
BL::Object b_dup_ob = b_dup->object();
|
||||
bool dup_hide = (b_v3d)? b_dup_ob.hide(): b_dup_ob.hide_render();
|
||||
|
||||
if(!(b_dup->hide() || dup_hide))
|
||||
sync_object(*b_ob, b_index, b_dup_ob, tfm, ob_layer);
|
||||
|
||||
b_index++;
|
||||
}
|
||||
|
||||
|
@ -255,8 +255,6 @@ vector<DeviceInfo>& Device::available_devices()
|
||||
static bool devices_init = false;
|
||||
|
||||
if(!devices_init) {
|
||||
device_cpu_info(devices);
|
||||
|
||||
#ifdef WITH_CUDA
|
||||
if(cuLibraryInit())
|
||||
device_cuda_info(devices);
|
||||
@ -271,6 +269,8 @@ vector<DeviceInfo>& Device::available_devices()
|
||||
device_multi_info(devices);
|
||||
#endif
|
||||
|
||||
device_cpu_info(devices);
|
||||
|
||||
#ifdef WITH_NETWORK
|
||||
device_network_info(devices);
|
||||
#endif
|
||||
|
@ -272,7 +272,7 @@ void device_cpu_info(vector<DeviceInfo>& devices)
|
||||
info.id = "CPU";
|
||||
info.num = 0;
|
||||
|
||||
devices.push_back(info);
|
||||
devices.insert(devices.begin(), info);
|
||||
}
|
||||
|
||||
CCL_NAMESPACE_END
|
||||
|
@ -17,6 +17,11 @@
|
||||
*
|
||||
* Contributor(s): Campbell Barton
|
||||
*
|
||||
* Mode switching
|
||||
* Copyright (C) 1997-2001 Id Software, Inc.
|
||||
* Copyright (c) 1993-2011 Tim Riker
|
||||
* Copyright (C) 2012 Alex Fraser
|
||||
*
|
||||
* ***** END GPL LICENSE BLOCK *****
|
||||
*/
|
||||
|
||||
@ -47,7 +52,19 @@ GHOST_TSuccess GHOST_DisplayManagerSDL::getNumDisplaySettings(GHOST_TUns8 displa
|
||||
GHOST_TInt32& numSettings) const
|
||||
{
|
||||
GHOST_ASSERT(display < 1, "Only single display systems are currently supported.\n");
|
||||
numSettings= GHOST_TInt32(1);
|
||||
int i;
|
||||
SDL_Rect **vidmodes;
|
||||
|
||||
vidmodes = SDL_ListModes(NULL, SDL_HWSURFACE | SDL_OPENGL |
|
||||
SDL_FULLSCREEN | SDL_HWPALETTE);
|
||||
if (!vidmodes) {
|
||||
fprintf(stderr, "Could not get available video modes: %s.\n",
|
||||
SDL_GetError());
|
||||
return GHOST_kFailure;
|
||||
}
|
||||
for (i = 0; vidmodes[i]; i++);
|
||||
numSettings = GHOST_TInt32(i);
|
||||
|
||||
return GHOST_kSuccess;
|
||||
}
|
||||
|
||||
@ -56,18 +73,38 @@ GHOST_DisplayManagerSDL::getDisplaySetting(GHOST_TUns8 display,
|
||||
GHOST_TInt32 index,
|
||||
GHOST_DisplaySetting& setting) const
|
||||
{
|
||||
|
||||
GHOST_ASSERT(display < 1, "Only single display systems are currently supported.\n");
|
||||
GHOST_ASSERT(index < 1, "Requested setting outside of valid range.\n");
|
||||
SDL_DisplayMode mode;
|
||||
|
||||
SDL_GetDesktopDisplayMode(display, &mode);
|
||||
int i;
|
||||
SDL_Rect **vidmodes;
|
||||
/* NULL is passed in here to get the modes for the current bit depth.
|
||||
* Other bit depths may be possible; in that case, an SDL_PixelFormat struct
|
||||
* should be passed in. To get a complete profile, all possible bit depths
|
||||
* would need to be iterated over. - z0r */
|
||||
vidmodes = SDL_ListModes(NULL, SDL_HWSURFACE | SDL_OPENGL |
|
||||
SDL_FULLSCREEN | SDL_HWPALETTE);
|
||||
if (!vidmodes) {
|
||||
fprintf(stderr, "Could not get available video modes: %s.\n",
|
||||
SDL_GetError());
|
||||
return GHOST_kFailure;
|
||||
}
|
||||
for (i = 0; vidmodes[i]; i++);
|
||||
GHOST_ASSERT(index < i, "Requested setting outside of valid range.\n");
|
||||
|
||||
setting.xPixels= mode.w;
|
||||
setting.yPixels= mode.h;
|
||||
setting.bpp= SDL_BYTESPERPIXEL(mode.format);
|
||||
/* assume 60 when unset */
|
||||
setting.frequency= mode.refresh_rate ? mode.refresh_rate : 60;
|
||||
setting.xPixels = vidmodes[index]->w;
|
||||
setting.yPixels = vidmodes[index]->h;
|
||||
|
||||
SDL_Surface *surf;
|
||||
surf = SDL_GetVideoSurface();
|
||||
if (surf == NULL) {
|
||||
fprintf(stderr, "Getting display setting: %s\n", SDL_GetError());
|
||||
/* Just guess the bit depth */
|
||||
setting.bpp = 32;
|
||||
} else {
|
||||
setting.bpp = surf->format->BitsPerPixel;
|
||||
}
|
||||
/* Just guess the frequency :( */
|
||||
setting.frequency = 60;
|
||||
|
||||
return GHOST_kSuccess;
|
||||
}
|
||||
@ -76,17 +113,100 @@ GHOST_TSuccess
|
||||
GHOST_DisplayManagerSDL::getCurrentDisplaySetting(GHOST_TUns8 display,
|
||||
GHOST_DisplaySetting& setting) const
|
||||
{
|
||||
return getDisplaySetting(display,GHOST_TInt32(0),setting);
|
||||
SDL_Surface *surf;
|
||||
const SDL_VideoInfo *info;
|
||||
|
||||
/* Note: not using SDL_GetDesktopDisplayMode because that does not return
|
||||
* the current mode. Try to use GetVideoSurface first, as it seems more
|
||||
* accurate. If that fails, try other methods. - z0r */
|
||||
surf = SDL_GetVideoSurface();
|
||||
|
||||
if (surf != NULL) {
|
||||
setting.xPixels = surf->w;
|
||||
setting.yPixels = surf->h;
|
||||
setting.bpp = surf->format->BitsPerPixel;
|
||||
/* Just guess the frequency :( */
|
||||
setting.frequency = 60;
|
||||
} else {
|
||||
/* This may happen if the surface hasn't been created yet, e.g. on
|
||||
* application startup. */
|
||||
info = SDL_GetVideoInfo();
|
||||
setting.xPixels = info->current_w;
|
||||
setting.yPixels = info->current_h;
|
||||
setting.bpp = info->vfmt->BitsPerPixel;
|
||||
/* Just guess the frequency :( */
|
||||
setting.frequency = 60;
|
||||
}
|
||||
|
||||
return GHOST_kSuccess;
|
||||
}
|
||||
|
||||
GHOST_TSuccess
|
||||
GHOST_DisplayManagerSDL:: setCurrentDisplaySetting(GHOST_TUns8 display,
|
||||
const GHOST_DisplaySetting& setting)
|
||||
{
|
||||
// This is never going to work robustly in X
|
||||
// but it's currently part of the full screen interface
|
||||
|
||||
// we fudge it for now.
|
||||
/*
|
||||
* Mode switching code ported from Quake 2 version 3.21 and bzflag version
|
||||
* 2.4.0:
|
||||
* ftp://ftp.idsoftware.com/idstuff/source/q2source-3.21.zip
|
||||
* See linux/gl_glx.c:GLimp_SetMode
|
||||
* http://wiki.bzflag.org/BZFlag_Source
|
||||
* See src/platform/SDLDisplay.cxx:SDLDisplay and createWindow
|
||||
*/
|
||||
SDL_Surface *surf;
|
||||
int best_fit, best_dist, dist, x, y;
|
||||
|
||||
SDL_Rect **vidmodes = SDL_ListModes(NULL, SDL_HWSURFACE | SDL_OPENGL |
|
||||
SDL_FULLSCREEN | SDL_HWPALETTE);
|
||||
if (!vidmodes) {
|
||||
fprintf(stderr, "Could not get available video modes: %s.\n",
|
||||
SDL_GetError());
|
||||
}
|
||||
|
||||
best_dist = 9999999;
|
||||
best_fit = -1;
|
||||
|
||||
if (vidmodes == (SDL_Rect **) -1) {
|
||||
/* Any mode is OK. */
|
||||
x = setting.xPixels;
|
||||
y = setting.yPixels;
|
||||
} else {
|
||||
for (int i = 0; vidmodes[i]; i++) {
|
||||
if (setting.xPixels > vidmodes[i]->w ||
|
||||
setting.yPixels > vidmodes[i]->h)
|
||||
continue;
|
||||
|
||||
x = setting.xPixels - vidmodes[i]->w;
|
||||
y = setting.yPixels - vidmodes[i]->h;
|
||||
dist = (x * x) + (y * y);
|
||||
if (dist < best_dist) {
|
||||
best_dist = dist;
|
||||
best_fit = i;
|
||||
}
|
||||
}
|
||||
|
||||
if (best_fit == -1)
|
||||
return GHOST_kFailure;
|
||||
|
||||
x = vidmodes[best_fit]->w;
|
||||
y = vidmodes[best_fit]->h;
|
||||
}
|
||||
|
||||
# ifdef _DEBUG
|
||||
printf("Switching to video mode %dx%d\n", x, y);
|
||||
# endif
|
||||
|
||||
// limit us to the main display
|
||||
static char singleDisplayEnv[] = "SDL_SINGLEDISPLAY=1";
|
||||
putenv(singleDisplayEnv);
|
||||
|
||||
// change to the mode
|
||||
surf = SDL_SetVideoMode(x, y, setting.bpp, SDL_OPENGL | SDL_FULLSCREEN);
|
||||
if (surf == NULL) {
|
||||
fprintf(stderr, "Could not set video mode: %s.\n", SDL_GetError());
|
||||
return GHOST_kFailure;
|
||||
}
|
||||
|
||||
return GHOST_kSuccess;
|
||||
}
|
||||
|
@ -67,10 +67,32 @@ getNumDisplaySettings(
|
||||
GHOST_TUns8 display,
|
||||
GHOST_TInt32& numSettings
|
||||
) const{
|
||||
|
||||
#ifdef WITH_X11_XF86VMODE
|
||||
int majorVersion, minorVersion;
|
||||
XF86VidModeModeInfo **vidmodes;
|
||||
Display *dpy = m_system->getXDisplay();
|
||||
|
||||
GHOST_ASSERT(display < 1, "Only single display systems are currently supported.\n");
|
||||
|
||||
if (dpy == NULL)
|
||||
return GHOST_kFailure;
|
||||
|
||||
majorVersion = minorVersion = 0;
|
||||
if (!XF86VidModeQueryVersion(dpy, &majorVersion, &minorVersion)) {
|
||||
fprintf(stderr, "Error: XF86VidMode extension missing!\n");
|
||||
return GHOST_kFailure;
|
||||
}
|
||||
|
||||
/* The X11 man page says vidmodes needs to be freed, but doing so causes a
|
||||
* segfault. - z0r */
|
||||
XF86VidModeGetAllModeLines(dpy, DefaultScreen(dpy), &numSettings, &vidmodes);
|
||||
|
||||
#else
|
||||
// We only have one X11 setting at the moment.
|
||||
GHOST_ASSERT(display < 1, "Only single display systems are currently supported.\n");
|
||||
numSettings = GHOST_TInt32(1);
|
||||
#endif
|
||||
|
||||
return GHOST_kSuccess;
|
||||
}
|
||||
|
||||
@ -81,7 +103,34 @@ getDisplaySetting(
|
||||
GHOST_TInt32 index,
|
||||
GHOST_DisplaySetting& setting
|
||||
) const {
|
||||
|
||||
|
||||
#ifdef WITH_X11_XF86VMODE
|
||||
int majorVersion, minorVersion;
|
||||
XF86VidModeModeInfo **vidmodes;
|
||||
Display *dpy = m_system->getXDisplay();
|
||||
int numSettings;
|
||||
|
||||
GHOST_ASSERT(display < 1, "Only single display systems are currently supported.\n");
|
||||
|
||||
if (dpy == NULL)
|
||||
return GHOST_kFailure;
|
||||
|
||||
majorVersion = minorVersion = 0;
|
||||
if (!XF86VidModeQueryVersion(dpy, &majorVersion, &minorVersion)) {
|
||||
fprintf(stderr, "Error: XF86VidMode extension missing!\n");
|
||||
return GHOST_kFailure;
|
||||
}
|
||||
|
||||
/* The X11 man page says vidmodes needs to be freed, but doing so causes a
|
||||
* segfault. - z0r */
|
||||
XF86VidModeGetAllModeLines(dpy, DefaultScreen(dpy), &numSettings, &vidmodes);
|
||||
GHOST_ASSERT(index < numSettings, "Requested setting outside of valid range.\n");
|
||||
|
||||
setting.xPixels = vidmodes[index]->hdisplay;
|
||||
setting.yPixels = vidmodes[index]->vdisplay;
|
||||
setting.bpp = DefaultDepth(dpy,DefaultScreen(dpy));
|
||||
|
||||
#else
|
||||
GHOST_ASSERT(display < 1, "Only single display systems are currently supported.\n");
|
||||
GHOST_ASSERT(index < 1, "Requested setting outside of valid range.\n");
|
||||
|
||||
@ -94,6 +143,7 @@ getDisplaySetting(
|
||||
setting.xPixels = DisplayWidth(x_display, DefaultScreen(x_display));
|
||||
setting.yPixels = DisplayHeight(x_display, DefaultScreen(x_display));
|
||||
setting.bpp = DefaultDepth(x_display,DefaultScreen(x_display));
|
||||
#endif
|
||||
|
||||
// Don't think it's possible to get this value from X!
|
||||
// So let's guess!!
|
||||
@ -108,6 +158,9 @@ getCurrentDisplaySetting(
|
||||
GHOST_TUns8 display,
|
||||
GHOST_DisplaySetting& setting
|
||||
) const {
|
||||
/* According to the xf86vidmodegetallmodelines man page,
|
||||
* "The first element of the array corresponds to the current video mode."
|
||||
*/
|
||||
return getDisplaySetting(display,GHOST_TInt32(0),setting);
|
||||
}
|
||||
|
||||
@ -130,6 +183,9 @@ setCurrentDisplaySetting(
|
||||
int scrnum, num_vidmodes;
|
||||
int best_fit, best_dist, dist, x, y;
|
||||
|
||||
if (dpy == NULL)
|
||||
return GHOST_kFailure;
|
||||
|
||||
scrnum = DefaultScreen(dpy);
|
||||
|
||||
// Get video mode list
|
||||
@ -143,6 +199,8 @@ setCurrentDisplaySetting(
|
||||
majorVersion, minorVersion);
|
||||
# endif
|
||||
|
||||
/* The X11 man page says vidmodes needs to be freed, but doing so causes a
|
||||
* segfault. - z0r */
|
||||
XF86VidModeGetAllModeLines(dpy, scrnum, &num_vidmodes, &vidmodes);
|
||||
|
||||
best_dist = 9999999;
|
||||
|
@ -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.
|
||||
|
@ -82,7 +82,7 @@ void free_armature(struct bArmature *arm);
|
||||
void make_local_armature(struct bArmature *arm);
|
||||
struct bArmature *copy_armature(struct bArmature *arm);
|
||||
|
||||
int bone_autoside_name (char name[32], int strip_number, short axis, float head, float tail);
|
||||
int bone_autoside_name (char name[64], int strip_number, short axis, float head, float tail);
|
||||
|
||||
struct Bone *get_named_bone (struct bArmature *arm, const char *name);
|
||||
|
||||
|
@ -69,7 +69,7 @@ void defvert_normalize_lock(struct MDeformVert *dvert, const int def_nr_lock);
|
||||
|
||||
/* utility function, note that 32 chars is the maximum string length since its only
|
||||
* used with defgroups currently */
|
||||
void flip_side_name(char name[32], const char from_name[32], int strip_number);
|
||||
void flip_side_name(char name[64], const char from_name[64], int strip_number);
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -76,7 +76,7 @@ struct Object;
|
||||
*/
|
||||
typedef struct bNodeSocketTemplate {
|
||||
int type, limit;
|
||||
char name[32];
|
||||
char name[64]; /* MAX_NAME */
|
||||
float val1, val2, val3, val4; /* default alloc value for inputs */
|
||||
float min, max;
|
||||
PropertySubType subtype;
|
||||
@ -95,7 +95,7 @@ typedef void (*NodeSocketButtonFunction)(const struct bContext *C, struct uiBloc
|
||||
*/
|
||||
typedef struct bNodeSocketType {
|
||||
int type;
|
||||
char ui_name[32];
|
||||
char ui_name[64]; /* MAX_NAME */
|
||||
char ui_description[128];
|
||||
int ui_icon;
|
||||
char ui_color[4];
|
||||
@ -125,7 +125,7 @@ typedef struct bNodeType {
|
||||
short needs_free; /* set for allocated types that need to be freed */
|
||||
|
||||
int type;
|
||||
char name[32];
|
||||
char name[64]; /* MAX_NAME */
|
||||
float width, minwidth, maxwidth;
|
||||
float height, minheight, maxheight;
|
||||
short nclass, flag, compatibility;
|
||||
|
@ -306,7 +306,7 @@ typedef struct SeqLoadInfo {
|
||||
int tot_error;
|
||||
int len; /* only for image strips */
|
||||
char path[512];
|
||||
char name[32];
|
||||
char name[64];
|
||||
} SeqLoadInfo;
|
||||
|
||||
/* SeqLoadInfo.flag */
|
||||
|
@ -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");
|
||||
|
||||
|
@ -1578,7 +1578,7 @@ static CustomDataLayer *customData_add_layer__internal(CustomData *data,
|
||||
data->layers[index].data = newlayerdata;
|
||||
|
||||
if(name || (name=typeInfo->defaultname)) {
|
||||
BLI_strncpy(data->layers[index].name, name, 32);
|
||||
BLI_strncpy(data->layers[index].name, name, sizeof(data->layers[index].name));
|
||||
CustomData_set_layer_unique_name(data, index);
|
||||
}
|
||||
else
|
||||
|
@ -479,22 +479,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;
|
||||
}
|
||||
@ -504,29 +504,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;
|
||||
}
|
||||
@ -1323,7 +1323,7 @@ void dynamicPaint_setInitialColor(DynamicPaintSurface *surface)
|
||||
MTFace *tface;
|
||||
MFace *mface = dm->getTessFaceArray(dm);
|
||||
int numOfFaces = dm->getNumTessFaces(dm);
|
||||
char uvname[40];
|
||||
char uvname[MAX_CUSTOMDATA_LAYER_NAME];
|
||||
|
||||
if (!tex) return;
|
||||
|
||||
@ -1871,7 +1871,8 @@ struct DerivedMesh *dynamicPaint_Modifier_do(DynamicPaintModifierData *pmd, Scen
|
||||
* px,py : origin pixel x and y
|
||||
* n_index : lookup direction index (use neighX,neighY to get final index)
|
||||
*/
|
||||
static int dynamicPaint_findNeighbourPixel(PaintUVPoint *tempPoints, DerivedMesh *dm, char *uvname, int w, int h, int px, int py, int n_index)
|
||||
static int dynamicPaint_findNeighbourPixel(PaintUVPoint *tempPoints, DerivedMesh *dm,
|
||||
const char *uvname, int w, int h, int px, int py, int n_index)
|
||||
{
|
||||
/* Note: Current method only uses polygon edges to detect neighbouring pixels.
|
||||
* -> It doesn't always lead to the optimum pixel but is accurate enough
|
||||
@ -2073,7 +2074,7 @@ int dynamicPaint_createUVSurface(DynamicPaintSurface *surface)
|
||||
int ty;
|
||||
int w,h;
|
||||
int numOfFaces;
|
||||
char uvname[32];
|
||||
char uvname[MAX_CUSTOMDATA_LAYER_NAME];
|
||||
int active_points = 0;
|
||||
int error = 0;
|
||||
|
||||
|
@ -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 {
|
||||
@ -1202,14 +1202,14 @@ static void stampdata(Scene *scene, Object *camera, StampData *stamp_data, int d
|
||||
}
|
||||
|
||||
if (scene->r.stamp & R_STAMP_FRAME) {
|
||||
char format[32];
|
||||
char fmtstr[32];
|
||||
int digits= 1;
|
||||
|
||||
if(scene->r.efra>9)
|
||||
digits= 1 + (int) log10(scene->r.efra);
|
||||
|
||||
BLI_snprintf(format, sizeof(format), do_prefix ? "Frame %%0%di":"%%0%di", digits);
|
||||
BLI_snprintf (stamp_data->frame, sizeof(stamp_data->frame), format, scene->r.cfra);
|
||||
BLI_snprintf(fmtstr, sizeof(fmtstr), do_prefix ? "Frame %%0%di":"%%0%di", digits);
|
||||
BLI_snprintf (stamp_data->frame, sizeof(stamp_data->frame), fmtstr, scene->r.cfra);
|
||||
} else {
|
||||
stamp_data->frame[0] = '\0';
|
||||
}
|
||||
@ -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);
|
||||
}
|
||||
|
||||
|
@ -991,7 +991,7 @@ static void IDnames_to_dyn_pupstring(DynStr *pupds, ListBase *lb, ID *link, shor
|
||||
ID *id;
|
||||
|
||||
for (i=0, id= lb->first; id; id= id->next, i++) {
|
||||
char buf[32];
|
||||
char numstr[32];
|
||||
|
||||
if (nr && id==link) *nr= i+1;
|
||||
|
||||
@ -1002,12 +1002,12 @@ static void IDnames_to_dyn_pupstring(DynStr *pupds, ListBase *lb, ID *link, shor
|
||||
if ( ((Image *)id)->source==IMA_SRC_VIEWER )
|
||||
continue;
|
||||
|
||||
get_flags_for_id(id, buf);
|
||||
get_flags_for_id(id, numstr);
|
||||
|
||||
BLI_dynstr_append(pupds, buf);
|
||||
BLI_dynstr_append(pupds, numstr);
|
||||
BLI_dynstr_append(pupds, id->name+2);
|
||||
BLI_snprintf(buf, sizeof(buf), "%%x%d", i+1);
|
||||
BLI_dynstr_append(pupds, buf);
|
||||
BLI_snprintf(numstr, sizeof(numstr), "%%x%d", i+1);
|
||||
BLI_dynstr_append(pupds, numstr);
|
||||
|
||||
/* icon */
|
||||
switch(GS(id->name))
|
||||
@ -1017,8 +1017,8 @@ static void IDnames_to_dyn_pupstring(DynStr *pupds, ListBase *lb, ID *link, shor
|
||||
case ID_IM: /* fall through */
|
||||
case ID_WO: /* fall through */
|
||||
case ID_LA: /* fall through */
|
||||
BLI_snprintf(buf, sizeof(buf), "%%i%d", BKE_icon_getid(id) );
|
||||
BLI_dynstr_append(pupds, buf);
|
||||
BLI_snprintf(numstr, sizeof(numstr), "%%i%d", BKE_icon_getid(id) );
|
||||
BLI_dynstr_append(pupds, numstr);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@ -1136,10 +1136,12 @@ static int check_for_dupid(ListBase *lb, ID *id, char *name)
|
||||
{
|
||||
ID *idtest;
|
||||
int nr= 0, nrtest, a, left_len;
|
||||
char left[32], leftest[32], in_use[32];
|
||||
char in_use[64]; /* use as a boolean array, unrelated to name length */
|
||||
|
||||
char left[MAX_ID_NAME + 8], leftest[MAX_ID_NAME + 8];
|
||||
|
||||
/* make sure input name is terminated properly */
|
||||
/* if( strlen(name) > 21 ) name[21]= 0; */
|
||||
/* if( strlen(name) > MAX_ID_NAME-3 ) name[MAX_ID_NAME-3]= 0; */
|
||||
/* removed since this is only ever called from one place - campbell */
|
||||
|
||||
while (1) {
|
||||
@ -1151,20 +1153,20 @@ static int check_for_dupid(ListBase *lb, ID *id, char *name)
|
||||
if( idtest == NULL ) return 0;
|
||||
|
||||
/* we have a dup; need to make a new name */
|
||||
/* quick check so we can reuse one of first 32 ids if vacant */
|
||||
/* quick check so we can reuse one of first 64 ids if vacant */
|
||||
memset(in_use, 0, sizeof(in_use));
|
||||
|
||||
/* get name portion, number portion ("name.number") */
|
||||
left_len= BLI_split_name_num(left, &nr, name, '.');
|
||||
|
||||
/* if new name will be too long, truncate it */
|
||||
if(nr > 999 && left_len > 16) {
|
||||
left[16]= 0;
|
||||
left_len= 16;
|
||||
if(nr > 999 && left_len > (MAX_ID_NAME - 8)) {
|
||||
left[MAX_ID_NAME - 8]= 0;
|
||||
left_len= MAX_ID_NAME - 8;
|
||||
}
|
||||
else if(left_len > 17) {
|
||||
left[17]= 0;
|
||||
left_len= 17;
|
||||
else if(left_len > (MAX_ID_NAME - 7)) {
|
||||
left[MAX_ID_NAME - 7]= 0;
|
||||
left_len= MAX_ID_NAME - 7;
|
||||
}
|
||||
|
||||
for(idtest= lb->first; idtest; idtest= idtest->next) {
|
||||
@ -1206,11 +1208,11 @@ static int check_for_dupid(ListBase *lb, ID *id, char *name)
|
||||
/* otherwise just continue and use a number suffix */
|
||||
}
|
||||
|
||||
if(nr > 999 && left_len > 16) {
|
||||
if(nr > 999 && left_len > (MAX_ID_NAME - 8)) {
|
||||
/* this would overflow name buffer */
|
||||
left[16] = 0;
|
||||
/* left_len = 16; */ /* for now this isnt used again */
|
||||
memcpy(name, left, sizeof(char) * 17);
|
||||
left[MAX_ID_NAME - 8] = 0;
|
||||
/* left_len = MAX_ID_NAME - 8; */ /* for now this isnt used again */
|
||||
memcpy(name, left, sizeof(char) * (MAX_ID_NAME - 7));
|
||||
continue;
|
||||
}
|
||||
/* this format specifier is from hell... */
|
||||
@ -1245,7 +1247,7 @@ int new_id(ListBase *lb, ID *id, const char *tname)
|
||||
|
||||
strncpy(name, tname, sizeof(name)-1);
|
||||
|
||||
/* if result > 21, strncpy don't put the final '\0' to name.
|
||||
/* if result > MAX_ID_NAME-3, strncpy don't put the final '\0' to name.
|
||||
* easier to assign each time then to check if its needed */
|
||||
name[sizeof(name)-1]= 0;
|
||||
|
||||
|
@ -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 */
|
||||
|
@ -356,7 +356,7 @@ int is_basis_mball(Object *ob)
|
||||
int is_mball_basis_for(Object *ob1, Object *ob2)
|
||||
{
|
||||
int basis1nr, basis2nr;
|
||||
char basis1name[32], basis2name[32];
|
||||
char basis1name[MAX_ID_NAME], basis2name[MAX_ID_NAME];
|
||||
|
||||
BLI_split_name_num(basis1name, &basis1nr, ob1->id.name+2, '.');
|
||||
BLI_split_name_num(basis2name, &basis2nr, ob2->id.name+2, '.');
|
||||
@ -378,7 +378,7 @@ void copy_mball_properties(Scene *scene, Object *active_object)
|
||||
Object *ob;
|
||||
MetaBall *active_mball = (MetaBall*)active_object->data;
|
||||
int basisnr, obnr;
|
||||
char basisname[32], obname[32];
|
||||
char basisname[MAX_ID_NAME], obname[MAX_ID_NAME];
|
||||
|
||||
BLI_split_name_num(basisname, &basisnr, active_object->id.name+2, '.');
|
||||
|
||||
@ -423,7 +423,7 @@ Object *find_basis_mball(Scene *scene, Object *basis)
|
||||
Object *ob,*bob= basis;
|
||||
MetaElem *ml=NULL;
|
||||
int basisnr, obnr;
|
||||
char basisname[32], obname[32];
|
||||
char basisname[MAX_ID_NAME], obname[MAX_ID_NAME];
|
||||
|
||||
BLI_split_name_num(basisname, &basisnr, basis->id.name+2, '.');
|
||||
totelem= 0;
|
||||
@ -1596,7 +1596,7 @@ float init_meta(Scene *scene, Object *ob) /* return totsize */
|
||||
float size, totsize, obinv[4][4], obmat[4][4], vec[3];
|
||||
//float max=0.0;
|
||||
int a, obnr, zero_size=0;
|
||||
char obname[32];
|
||||
char obname[MAX_ID_NAME];
|
||||
|
||||
copy_m4_m4(obmat, ob->obmat); /* to cope with duplicators from next_object */
|
||||
invert_m4_m4(obinv, ob->obmat);
|
||||
@ -1619,7 +1619,7 @@ float init_meta(Scene *scene, Object *ob) /* return totsize */
|
||||
else ml= mb->elems.first;
|
||||
}
|
||||
else {
|
||||
char name[32];
|
||||
char name[MAX_ID_NAME];
|
||||
int nr;
|
||||
|
||||
BLI_split_name_num(name, &nr, bob->id.name+2, '.');
|
||||
|
@ -831,7 +831,7 @@ Object *add_object(struct Scene *scene, int type)
|
||||
{
|
||||
Object *ob;
|
||||
Base *base;
|
||||
char name[32];
|
||||
char name[MAX_ID_NAME];
|
||||
|
||||
BLI_strncpy(name, get_obdata_defname(type), sizeof(name));
|
||||
ob = add_only_object(type, name);
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -3411,14 +3411,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));
|
||||
|
@ -428,7 +428,7 @@ void init_actuator(bActuator *act)
|
||||
case ACT_CAMERA:
|
||||
act->data= MEM_callocN(sizeof(bCameraActuator), "camact");
|
||||
ca = act->data;
|
||||
ca->axis = ACT_CAMERA_X;
|
||||
ca->axis = OB_POSX;
|
||||
ca->damping = 1.0/32.0;
|
||||
break;
|
||||
case ACT_EDIT_OBJECT:
|
||||
|
@ -176,7 +176,7 @@ static void open_plugin_seq(PluginSeq *pis, const char *seqname)
|
||||
MEM_freeN(info);
|
||||
|
||||
cp= BLI_dynlib_find_symbol(pis->handle, "seqname");
|
||||
if(cp) BLI_strncpy(cp, seqname, 21);
|
||||
if(cp) BLI_strncpy(cp, seqname, SEQ_NAME_MAXSTR);
|
||||
} else {
|
||||
printf ("Plugin returned unrecognized version number\n");
|
||||
return;
|
||||
@ -303,7 +303,10 @@ static struct ImBuf * do_plugin_effect(
|
||||
cp = BLI_dynlib_find_symbol(
|
||||
seq->plugin->handle, "seqname");
|
||||
|
||||
if(cp) strncpy(cp, seq->name+2, 22);
|
||||
/* 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)-2);
|
||||
|
||||
if (seq->plugin->current_private_data) {
|
||||
*seq->plugin->current_private_data
|
||||
|
@ -833,8 +833,8 @@ void clear_scene_in_allseqs(Main *bmain, Scene *scene)
|
||||
|
||||
typedef struct SeqUniqueInfo {
|
||||
Sequence *seq;
|
||||
char name_src[32];
|
||||
char name_dest[32];
|
||||
char name_src[SEQ_NAME_MAXSTR];
|
||||
char name_dest[SEQ_NAME_MAXSTR];
|
||||
int count;
|
||||
int match;
|
||||
} SeqUniqueInfo;
|
||||
@ -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 */
|
||||
}
|
||||
}
|
||||
@ -3388,13 +3389,13 @@ int seq_swap(Sequence *seq_a, Sequence *seq_b, const char **error_str)
|
||||
/* XXX - hackish function needed for transforming strips! TODO - have some better solution */
|
||||
void seq_offset_animdata(Scene *scene, Sequence *seq, int ofs)
|
||||
{
|
||||
char str[32];
|
||||
char str[SEQ_NAME_MAXSTR+3];
|
||||
FCurve *fcu;
|
||||
|
||||
if(scene->adt==NULL || ofs==0 || scene->adt->action==NULL)
|
||||
return;
|
||||
|
||||
sprintf(str, "[\"%s\"]", seq->name+2);
|
||||
BLI_snprintf(str, sizeof(str), "[\"%s\"]", seq->name+2);
|
||||
|
||||
for (fcu= scene->adt->action->curves.first; fcu; fcu= fcu->next) {
|
||||
if(strstr(fcu->rna_path, "sequence_editor.sequences_all[") && strstr(fcu->rna_path, str)) {
|
||||
@ -3411,7 +3412,7 @@ void seq_offset_animdata(Scene *scene, Sequence *seq, int ofs)
|
||||
|
||||
void seq_dupe_animdata(Scene *scene, const char *name_src, const char *name_dst)
|
||||
{
|
||||
char str_from[32];
|
||||
char str_from[SEQ_NAME_MAXSTR+3];
|
||||
FCurve *fcu;
|
||||
FCurve *fcu_last;
|
||||
FCurve *fcu_cpy;
|
||||
@ -3420,7 +3421,7 @@ void seq_dupe_animdata(Scene *scene, const char *name_src, const char *name_dst)
|
||||
if(scene->adt==NULL || scene->adt->action==NULL)
|
||||
return;
|
||||
|
||||
sprintf(str_from, "[\"%s\"]", name_src);
|
||||
BLI_snprintf(str_from, sizeof(str_from), "[\"%s\"]", name_src);
|
||||
|
||||
fcu_last= scene->adt->action->curves.last;
|
||||
|
||||
@ -3441,13 +3442,13 @@ void seq_dupe_animdata(Scene *scene, const char *name_src, const char *name_dst)
|
||||
/* XXX - hackish function needed to remove all fcurves belonging to a sequencer strip */
|
||||
static void seq_free_animdata(Scene *scene, Sequence *seq)
|
||||
{
|
||||
char str[32];
|
||||
char str[SEQ_NAME_MAXSTR+3];
|
||||
FCurve *fcu;
|
||||
|
||||
if(scene->adt==NULL || scene->adt->action==NULL)
|
||||
return;
|
||||
|
||||
sprintf(str, "[\"%s\"]", seq->name+2);
|
||||
BLI_snprintf(str, sizeof(str), "[\"%s\"]", seq->name+2);
|
||||
|
||||
fcu= scene->adt->action->curves.first;
|
||||
|
||||
|
@ -233,7 +233,7 @@ struct bSound* sound_new_buffer(struct Main *bmain, struct bSound *source)
|
||||
{
|
||||
bSound* sound = NULL;
|
||||
|
||||
char name[25];
|
||||
char name[MAX_ID_NAME+5];
|
||||
strcpy(name, "buf_");
|
||||
strcpy(name + 4, source->id.name);
|
||||
|
||||
@ -257,7 +257,7 @@ struct bSound* sound_new_limiter(struct Main *bmain, struct bSound *source, floa
|
||||
{
|
||||
bSound* sound = NULL;
|
||||
|
||||
char name[25];
|
||||
char name[MAX_ID_NAME+5];
|
||||
strcpy(name, "lim_");
|
||||
strcpy(name + 4, source->id.name);
|
||||
|
||||
|
@ -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) {
|
||||
|
@ -651,7 +651,7 @@ void BKE_tracking_clipboard_paste_tracks(MovieTracking *tracking, MovieTrackingO
|
||||
/*********************** tracks map *************************/
|
||||
|
||||
typedef struct TracksMap {
|
||||
char object_name[32];
|
||||
char object_name[MAX_NAME];
|
||||
int is_camera;
|
||||
|
||||
int num_tracks;
|
||||
@ -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;
|
||||
@ -1529,7 +1529,7 @@ typedef struct MovieReconstructContext {
|
||||
|
||||
struct libmv_Reconstruction *reconstruction;
|
||||
#endif
|
||||
char object_name[32];
|
||||
char object_name[MAX_NAME];
|
||||
int is_camera;
|
||||
|
||||
float focal_length;
|
||||
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6639,14 +6639,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++;
|
||||
}
|
||||
@ -9141,8 +9141,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++;
|
||||
}
|
||||
}
|
||||
@ -10135,7 +10136,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);
|
||||
@ -13020,7 +13021,23 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
|
||||
|
||||
/* put compatibility code here until next subversion bump */
|
||||
{
|
||||
|
||||
{
|
||||
/* convert Camera Actuator values to defines */
|
||||
Object *ob;
|
||||
bActuator *act;
|
||||
for(ob = main->object.first; ob; ob= ob->id.next) {
|
||||
for(act= ob->actuators.first; act; act= act->next) {
|
||||
if (act->type == ACT_CAMERA) {
|
||||
bCameraActuator *ba= act->data;
|
||||
|
||||
if(ba->axis==(float) 'x') ba->axis=OB_POSX;
|
||||
else if (ba->axis==(float)'y') ba->axis=OB_POSY;
|
||||
/* don't do an if/else to avoid imediate subversion bump*/
|
||||
// ba->axis=((ba->axis == (float) 'x')?OB_POSX_X:OB_POSY);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* WATCH IT!!!: pointers from libdata have not been converted yet here! */
|
||||
|
@ -180,7 +180,7 @@ void ANIM_timecode_string_from_frame (char *str, Scene *scene, int power, short
|
||||
static void draw_cfra_number (Scene *scene, View2D *v2d, float cfra, short time)
|
||||
{
|
||||
float xscale, yscale, x, y;
|
||||
char str[32] = " t"; /* t is the character to start replacing from */
|
||||
char numstr[32] = " t"; /* t is the character to start replacing from */
|
||||
short slen;
|
||||
|
||||
/* because the frame number text is subject to the same scaling as the contents of the view */
|
||||
@ -193,10 +193,10 @@ static void draw_cfra_number (Scene *scene, View2D *v2d, float cfra, short time)
|
||||
* but power = 1 is required for frames (to get integer frames)
|
||||
*/
|
||||
if (time)
|
||||
ANIM_timecode_string_from_frame(&str[4], scene, 0, time, FRA2TIME(cfra));
|
||||
ANIM_timecode_string_from_frame(&numstr[4], scene, 0, time, FRA2TIME(cfra));
|
||||
else
|
||||
ANIM_timecode_string_from_frame(&str[4], scene, 1, time, cfra);
|
||||
slen= (short)UI_GetStringWidth(str) - 1;
|
||||
ANIM_timecode_string_from_frame(&numstr[4], scene, 1, time, cfra);
|
||||
slen= (short)UI_GetStringWidth(numstr) - 1;
|
||||
|
||||
/* get starting coordinates for drawing */
|
||||
x= cfra * xscale;
|
||||
@ -208,7 +208,7 @@ static void draw_cfra_number (Scene *scene, View2D *v2d, float cfra, short time)
|
||||
|
||||
/* draw current frame number - black text */
|
||||
UI_ThemeColor(TH_TEXT);
|
||||
UI_DrawString(x-5, y+3, str);
|
||||
UI_DrawString(x-5, y+3, numstr);
|
||||
|
||||
/* restore view transform */
|
||||
glScalef(xscale, 1.0, 1.0);
|
||||
|
@ -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];
|
||||
}
|
||||
|
@ -3457,7 +3457,7 @@ static int armature_bone_primitive_add_exec(bContext *C, wmOperator *op)
|
||||
Object *obedit = CTX_data_edit_object(C);
|
||||
EditBone *bone;
|
||||
float obmat[3][3], curs[3], viewmat[3][3], totmat[3][3], imat[3][3];
|
||||
char name[32];
|
||||
char name[MAXBONENAME];
|
||||
|
||||
RNA_string_get(op->ptr, "name", name);
|
||||
|
||||
@ -3507,7 +3507,7 @@ void ARMATURE_OT_bone_primitive_add(wmOperatorType *ot)
|
||||
/* flags */
|
||||
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
|
||||
|
||||
RNA_def_string(ot->srna, "name", "Bone", 32, "Name", "Name of the newly created bone");
|
||||
RNA_def_string(ot->srna, "name", "Bone", MAXBONENAME, "Name", "Name of the newly created bone");
|
||||
|
||||
}
|
||||
|
||||
@ -5499,7 +5499,7 @@ static int armature_autoside_names_exec (bContext *C, wmOperator *op)
|
||||
{
|
||||
Object *ob= CTX_data_edit_object(C);
|
||||
bArmature *arm;
|
||||
char newname[32];
|
||||
char newname[MAXBONENAME];
|
||||
short axis= RNA_enum_get(op->ptr, "type");
|
||||
|
||||
/* paranoia checks */
|
||||
|
@ -450,7 +450,7 @@ static void renameTemplateBone(char *name, char *template_name, ListBase *editbo
|
||||
{
|
||||
int i, j;
|
||||
|
||||
for (i = 0, j = 0; template_name[i] != '\0' && i < 31 && j < 31; i++)
|
||||
for (i = 0, j = 0; template_name[i] != '\0' && i < (MAXBONENAME-1) && j < (MAXBONENAME-1); i++)
|
||||
{
|
||||
if (template_name[i] == '&')
|
||||
{
|
||||
@ -485,7 +485,7 @@ static void renameTemplateBone(char *name, char *template_name, ListBase *editbo
|
||||
static RigControl *cloneControl(RigGraph *rg, RigGraph *src_rg, RigControl *src_ctrl, GHash *ptr_hash, char *side_string, char *num_string)
|
||||
{
|
||||
RigControl *ctrl;
|
||||
char name[32];
|
||||
char name[MAXBONENAME];
|
||||
|
||||
ctrl = newRigControl(rg);
|
||||
|
||||
@ -541,7 +541,7 @@ static RigArc *cloneArc(RigGraph *rg, RigGraph *src_rg, RigArc *src_arc, GHash *
|
||||
|
||||
if (src_edge->bone != NULL)
|
||||
{
|
||||
char name[32];
|
||||
char name[MAXBONENAME];
|
||||
renameTemplateBone(name, src_edge->bone->name, rg->editbones, side_string, num_string);
|
||||
edge->bone = duplicateEditBoneObjects(src_edge->bone, name, rg->editbones, src_rg->ob, rg->ob);
|
||||
edge->bone->flag &= ~(BONE_TIPSEL|BONE_SELECTED|BONE_ROOTSEL);
|
||||
@ -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_math.h"
|
||||
#include "BLI_edgehash.h"
|
||||
#include "BLI_memarena.h"
|
||||
#include "BLI_string.h"
|
||||
|
||||
#include "BKE_DerivedMesh.h"
|
||||
#include "BKE_modifier.h"
|
||||
@ -1617,7 +1618,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");
|
||||
@ -1719,7 +1720,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);
|
||||
}
|
||||
|
||||
|
@ -523,28 +523,28 @@ static void pose_slide_reset (tPoseSlideOp *pso)
|
||||
/* draw percentage indicator in header */
|
||||
static void pose_slide_draw_status (tPoseSlideOp *pso)
|
||||
{
|
||||
char statusStr[32];
|
||||
char mode[32];
|
||||
char status_str[32];
|
||||
char mode_str[32];
|
||||
|
||||
switch (pso->mode) {
|
||||
case POSESLIDE_PUSH:
|
||||
strcpy(mode, "Push Pose");
|
||||
strcpy(mode_str, "Push Pose");
|
||||
break;
|
||||
case POSESLIDE_RELAX:
|
||||
strcpy(mode, "Relax Pose");
|
||||
strcpy(mode_str, "Relax Pose");
|
||||
break;
|
||||
case POSESLIDE_BREAKDOWN:
|
||||
strcpy(mode, "Breakdown");
|
||||
strcpy(mode_str, "Breakdown");
|
||||
break;
|
||||
|
||||
default:
|
||||
// unknown
|
||||
strcpy(mode, "Sliding-Tool");
|
||||
strcpy(mode_str, "Sliding-Tool");
|
||||
break;
|
||||
}
|
||||
|
||||
sprintf(statusStr, "%s: %d %%", mode, (int)(pso->percentage*100.0f));
|
||||
ED_area_headerprint(pso->sa, statusStr);
|
||||
BLI_snprintf(status_str, sizeof(status_str), "%s: %d %%", mode_str, (int)(pso->percentage*100.0f));
|
||||
ED_area_headerprint(pso->sa, status_str);
|
||||
}
|
||||
|
||||
/* common code for invoke() methods */
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -1777,7 +1777,7 @@ static int pose_autoside_names_exec (bContext *C, wmOperator *op)
|
||||
{
|
||||
Object *ob= object_pose_armature_get(CTX_data_active_object(C));
|
||||
bArmature *arm;
|
||||
char newname[32];
|
||||
char newname[MAXBONENAME];
|
||||
short axis= RNA_enum_get(op->ptr, "axis");
|
||||
|
||||
/* paranoia checks */
|
||||
|
@ -2036,10 +2036,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!) */
|
||||
|
@ -62,7 +62,7 @@ typedef struct EditBone
|
||||
normal bones when leaving editmode. */
|
||||
void *temp; /* Used to store temporary data */
|
||||
|
||||
char name[32];
|
||||
char name[64]; /* MAX_NAME */
|
||||
float roll; /* Roll along axis. We'll ultimately use the axis/angle method
|
||||
for determining the transformation matrix of the bone. The axis
|
||||
is tail-head while roll provides the angle. Refer to Graphics
|
||||
|
@ -2920,7 +2920,7 @@ static void autocomplete_id(bContext *C, char *str, void *arg_v)
|
||||
|
||||
/* search if str matches the beginning of an ID struct */
|
||||
if(str[0]) {
|
||||
AutoComplete *autocpl= autocomplete_begin(str, 22);
|
||||
AutoComplete *autocpl= autocomplete_begin(str, MAX_ID_NAME-2);
|
||||
ID *id;
|
||||
|
||||
for(id= listb->first; id; id= id->next)
|
||||
|
@ -1208,7 +1208,7 @@ static void rna_search_cb(const struct bContext *C, void *arg_but, const char *s
|
||||
|
||||
if(itemptr.type && RNA_struct_is_ID(itemptr.type)) {
|
||||
ID *id= itemptr.data;
|
||||
char name_ui[32];
|
||||
char name_ui[MAX_ID_NAME];
|
||||
|
||||
#if 0 /* this name is used for a string comparison and can't be modified, TODO */
|
||||
name_uiprefix_id(name_ui, id);
|
||||
|
@ -2109,7 +2109,7 @@ uiBlock *ui_block_func_COL(bContext *C, uiPopupBlockHandle *handle, void *arg_bu
|
||||
uiBut *but= arg_but;
|
||||
uiBlock *block;
|
||||
|
||||
block= uiBeginBlock(C, handle->region, "colorpicker", UI_EMBOSS);
|
||||
block= uiBeginBlock(C, handle->region, __func__, UI_EMBOSS);
|
||||
|
||||
if (but->rnaprop) {
|
||||
if (RNA_property_subtype(but->rnaprop) == PROP_COLOR_GAMMA) {
|
||||
@ -2299,8 +2299,8 @@ uiPopupBlockHandle *ui_popup_menu_create(bContext *C, ARegion *butregion, uiBut
|
||||
uiStyle *style= UI_GetStyle();
|
||||
uiPopupBlockHandle *handle;
|
||||
uiPopupMenu *pup;
|
||||
pup= MEM_callocN(sizeof(uiPopupMenu), "menu dummy");
|
||||
pup->block= uiBeginBlock(C, NULL, "ui_button_menu_create", UI_EMBOSSP);
|
||||
pup= MEM_callocN(sizeof(uiPopupMenu), __func__);
|
||||
pup->block= uiBeginBlock(C, NULL, __func__, UI_EMBOSSP);
|
||||
pup->layout= uiBlockLayout(pup->block, UI_LAYOUT_VERTICAL, UI_LAYOUT_MENU, 0, 0, 200, 0, style);
|
||||
pup->slideout= (but && (but->block->flag & UI_BLOCK_LOOP));
|
||||
pup->but= but;
|
||||
@ -2361,7 +2361,7 @@ uiPopupMenu *uiPupMenuBegin(bContext *C, const char *title, int icon)
|
||||
uiPopupMenu *pup= MEM_callocN(sizeof(uiPopupMenu), "popup menu");
|
||||
uiBut *but;
|
||||
|
||||
pup->block= uiBeginBlock(C, NULL, "uiPupMenuBegin", UI_EMBOSSP);
|
||||
pup->block= uiBeginBlock(C, NULL, __func__, UI_EMBOSSP);
|
||||
pup->block->flag |= UI_BLOCK_POPUP_MEMORY;
|
||||
pup->block->puphash= ui_popup_menu_hash(title);
|
||||
pup->layout= uiBlockLayout(pup->block, UI_LAYOUT_VERTICAL, UI_LAYOUT_MENU, 0, 0, 200, 0, style);
|
||||
|
@ -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);
|
||||
|
@ -140,7 +140,7 @@ static void id_search_cb(const bContext *C, void *arg_template, const char *str,
|
||||
continue;
|
||||
|
||||
if(BLI_strcasestr(id->name+2, str)) {
|
||||
char name_ui[32];
|
||||
char name_ui[MAX_ID_NAME];
|
||||
name_uiprefix_id(name_ui, id);
|
||||
|
||||
iconid= ui_id_icon_get((bContext*)C, id, 1);
|
||||
@ -413,11 +413,11 @@ static void template_ID(bContext *C, uiLayout *layout, TemplateID *template, Str
|
||||
}
|
||||
|
||||
if(id->us > 1) {
|
||||
char str[32];
|
||||
char numstr[32];
|
||||
|
||||
BLI_snprintf(str, sizeof(str), "%d", id->us);
|
||||
BLI_snprintf(numstr, sizeof(numstr), "%d", id->us);
|
||||
|
||||
but= uiDefBut(block, BUT, 0, str, 0,0,UI_UNIT_X + ((id->us < 10) ? 0:10), UI_UNIT_Y, NULL, 0, 0, 0, 0,
|
||||
but= uiDefBut(block, BUT, 0, numstr, 0,0,UI_UNIT_X + ((id->us < 10) ? 0:10), UI_UNIT_Y, NULL, 0, 0, 0, 0,
|
||||
TIP_("Display number of users of this data (click to make a single-user copy)"));
|
||||
|
||||
uiButSetNFunc(but, template_id_cb, MEM_dupallocN(template), SET_INT_IN_POINTER(UI_ID_ALONE));
|
||||
@ -1621,7 +1621,7 @@ static uiBlock *curvemap_clipping_func(bContext *C, struct ARegion *ar, void *cu
|
||||
uiBut *bt;
|
||||
float width= 8*UI_UNIT_X;
|
||||
|
||||
block= uiBeginBlock(C, ar, "curvemap_clipping_func", UI_EMBOSS);
|
||||
block = uiBeginBlock(C, ar, __func__, UI_EMBOSS);
|
||||
|
||||
/* use this for a fake extra empy space around the buttons */
|
||||
uiDefBut(block, LABEL, 0, "", -4, 16, width+8, 6*UI_UNIT_Y, NULL, 0, 0, 0, 0, "");
|
||||
@ -1680,7 +1680,7 @@ static uiBlock *curvemap_tools_func(bContext *C, struct ARegion *ar, void *cumap
|
||||
uiBlock *block;
|
||||
short yco= 0, menuwidth=10*UI_UNIT_X;
|
||||
|
||||
block= uiBeginBlock(C, ar, "curvemap_tools_func", UI_EMBOSS);
|
||||
block= uiBeginBlock(C, ar, __func__, UI_EMBOSS);
|
||||
uiBlockSetButmFunc(block, curvemap_tools_dofunc, cumap_v);
|
||||
|
||||
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, IFACE_("Reset View"), 0, yco-=UI_UNIT_Y, menuwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 1, "");
|
||||
@ -1702,7 +1702,7 @@ static uiBlock *curvemap_brush_tools_func(bContext *C, struct ARegion *ar, void
|
||||
uiBlock *block;
|
||||
short yco= 0, menuwidth=10*UI_UNIT_X;
|
||||
|
||||
block= uiBeginBlock(C, ar, "curvemap_tools_func", UI_EMBOSS);
|
||||
block= uiBeginBlock(C, ar, __func__, UI_EMBOSS);
|
||||
uiBlockSetButmFunc(block, curvemap_tools_dofunc, cumap_v);
|
||||
|
||||
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, IFACE_("Reset View"), 0, yco-=UI_UNIT_Y, menuwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 1, "");
|
||||
@ -2281,7 +2281,8 @@ void uiTemplateList(uiLayout *layout, bContext *C, PointerRNA *ptr, const char *
|
||||
uiBlock *block;
|
||||
uiBut *but;
|
||||
Panel *pa;
|
||||
char *name, str[32];
|
||||
const char *name;
|
||||
char numstr[32];
|
||||
int rnaicon=0, icon=0, i= 0, activei= 0, len= 0, items, found, min, max;
|
||||
|
||||
/* validate arguments */
|
||||
@ -2372,7 +2373,7 @@ void uiTemplateList(uiLayout *layout, bContext *C, PointerRNA *ptr, const char *
|
||||
uiItemL(row, (name)? name: "", icon);
|
||||
|
||||
if(name)
|
||||
MEM_freeN(name);
|
||||
MEM_freeN((void *)name);
|
||||
}
|
||||
|
||||
i++;
|
||||
@ -2385,8 +2386,8 @@ void uiTemplateList(uiLayout *layout, bContext *C, PointerRNA *ptr, const char *
|
||||
uiItemL(row, "", ICON_NONE);
|
||||
|
||||
/* next/prev button */
|
||||
BLI_snprintf(str, sizeof(str), "%d :", i);
|
||||
but= uiDefIconTextButR_prop(block, NUM, 0, 0, str, 0,0,UI_UNIT_X*5,UI_UNIT_Y, activeptr, activeprop, 0, 0, 0, 0, 0, "");
|
||||
BLI_snprintf(numstr, sizeof(numstr), "%d :", i);
|
||||
but= uiDefIconTextButR_prop(block, NUM, 0, 0, numstr, 0,0,UI_UNIT_X*5,UI_UNIT_Y, activeptr, activeprop, 0, 0, 0, 0, 0, "");
|
||||
if(i == 0)
|
||||
uiButSetFlag(but, UI_BUT_DISABLED);
|
||||
}
|
||||
@ -2470,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))
|
||||
|
@ -1507,7 +1507,7 @@ View2DScrollers *UI_view2d_scrollers_calc(const bContext *C, View2D *v2d, short
|
||||
static void scroll_printstr(Scene *scene, float x, float y, float val, int power, short unit, char dir)
|
||||
{
|
||||
int len;
|
||||
char str[32];
|
||||
char timecode_str[32];
|
||||
|
||||
/* adjust the scale unit to work ok */
|
||||
if (dir == 'v') {
|
||||
@ -1522,10 +1522,10 @@ static void scroll_printstr(Scene *scene, float x, float y, float val, int power
|
||||
}
|
||||
|
||||
/* get string to print */
|
||||
ANIM_timecode_string_from_frame(str, scene, power, (unit == V2D_UNIT_SECONDS), val);
|
||||
ANIM_timecode_string_from_frame(timecode_str, scene, power, (unit == V2D_UNIT_SECONDS), val);
|
||||
|
||||
/* get length of string, and adjust printing location to fit it into the horizontal scrollbar */
|
||||
len= strlen(str);
|
||||
len= strlen(timecode_str);
|
||||
if (dir == 'h') {
|
||||
/* seconds/timecode display has slightly longer strings... */
|
||||
if (unit == V2D_UNIT_SECONDS)
|
||||
@ -1536,12 +1536,12 @@ static void scroll_printstr(Scene *scene, float x, float y, float val, int power
|
||||
|
||||
/* Add degree sympbol to end of string for vertical scrollbar? */
|
||||
if ((dir == 'v') && (unit == V2D_UNIT_DEGREES)) {
|
||||
str[len]= 186;
|
||||
str[len+1]= 0;
|
||||
timecode_str[len]= 186;
|
||||
timecode_str[len+1]= 0;
|
||||
}
|
||||
|
||||
/* draw it */
|
||||
BLF_draw_default_ascii(x, y, 0.0f, str, sizeof(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);
|
||||
}
|
||||
}
|
||||
|
@ -524,7 +524,7 @@ static int drop_named_image_invoke(bContext *C, wmOperator *op, wmEvent *event)
|
||||
Mesh *me;
|
||||
Object *obedit;
|
||||
int exitmode= 0;
|
||||
char name[32];
|
||||
char name[MAX_ID_NAME-2];
|
||||
|
||||
/* Check context */
|
||||
if(base==NULL || base->object->type!=OB_MESH) {
|
||||
@ -593,7 +593,7 @@ void MESH_OT_drop_named_image(wmOperatorType *ot)
|
||||
ot->flag= OPTYPE_UNDO;
|
||||
|
||||
/* properties */
|
||||
RNA_def_string(ot->srna, "name", "Image", 24, "Name", "Image name to assign");
|
||||
RNA_def_string(ot->srna, "name", "Image", MAX_ID_NAME-2, "Name", "Image name to assign");
|
||||
RNA_def_string(ot->srna, "filepath", "Path", FILE_MAX, "Filepath", "Path to image file");
|
||||
}
|
||||
|
||||
|
@ -1922,7 +1922,7 @@ static int add_named_exec(bContext *C, wmOperator *op)
|
||||
Object *ob;
|
||||
int linked= RNA_boolean_get(op->ptr, "linked");
|
||||
int dupflag= (linked)? 0: U.dupflag;
|
||||
char name[32];
|
||||
char name[MAX_ID_NAME-2];
|
||||
|
||||
/* find object, create fake base */
|
||||
RNA_string_get(op->ptr, "name", name);
|
||||
@ -1977,7 +1977,7 @@ void OBJECT_OT_add_named(wmOperatorType *ot)
|
||||
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
|
||||
|
||||
RNA_def_boolean(ot->srna, "linked", 0, "Linked", "Duplicate object but not object data, linking to the original data");
|
||||
RNA_def_string(ot->srna, "name", "Cube", 24, "Name", "Object name to add");
|
||||
RNA_def_string(ot->srna, "name", "Cube", MAX_ID_NAME-2, "Name", "Object name to add");
|
||||
}
|
||||
|
||||
|
||||
|
@ -542,7 +542,7 @@ static int edit_constraint_poll(bContext *C)
|
||||
|
||||
static void edit_constraint_properties(wmOperatorType *ot)
|
||||
{
|
||||
RNA_def_string(ot->srna, "constraint", "", 32, "Constraint", "Name of the constraint to edit");
|
||||
RNA_def_string(ot->srna, "constraint", "", MAX_NAME, "Constraint", "Name of the constraint to edit");
|
||||
RNA_def_enum(ot->srna, "owner", constraint_owner_items, 0, "Owner", "The owner of this constraint");
|
||||
}
|
||||
|
||||
@ -575,7 +575,7 @@ static int edit_constraint_invoke_properties(bContext *C, wmOperator *op)
|
||||
|
||||
static bConstraint *edit_constraint_property_get(wmOperator *op, Object *ob, int type)
|
||||
{
|
||||
char constraint_name[32];
|
||||
char constraint_name[MAX_NAME];
|
||||
int owner = RNA_enum_get(op->ptr, "owner");
|
||||
bConstraint *con;
|
||||
ListBase *list=NULL;
|
||||
|
@ -1484,7 +1484,7 @@ static int game_property_new(bContext *C, wmOperator *op)
|
||||
{
|
||||
Object *ob= CTX_data_active_object(C);
|
||||
bProperty *prop;
|
||||
char name[32];
|
||||
char name[MAX_NAME];
|
||||
int type= RNA_enum_get(op->ptr, "type");
|
||||
|
||||
prop= new_property(type);
|
||||
@ -1517,7 +1517,7 @@ void OBJECT_OT_game_property_new(wmOperatorType *ot)
|
||||
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
|
||||
|
||||
RNA_def_enum(ot->srna, "type", gameproperty_type_items, 2, "Type", "Type of game property to add");
|
||||
RNA_def_string(ot->srna, "name", "", 32, "Name", "Name of the game property to add");
|
||||
RNA_def_string(ot->srna, "name", "", MAX_NAME, "Name", "Name of the game property to add");
|
||||
}
|
||||
|
||||
static int game_property_remove(bContext *C, wmOperator *op)
|
||||
|
@ -192,7 +192,7 @@ static int group_create_exec(bContext *C, wmOperator *op)
|
||||
Main *bmain= CTX_data_main(C);
|
||||
Scene *scene= CTX_data_scene(C);
|
||||
Group *group= NULL;
|
||||
char name[32]; /* id name */
|
||||
char name[MAX_ID_NAME-2]; /* id name */
|
||||
|
||||
RNA_string_get(op->ptr, "name", name);
|
||||
|
||||
@ -223,7 +223,7 @@ void GROUP_OT_create(wmOperatorType *ot)
|
||||
/* flags */
|
||||
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
|
||||
|
||||
RNA_def_string(ot->srna, "name", "Group", 32, "Name", "Name of the new group");
|
||||
RNA_def_string(ot->srna, "name", "Group", MAX_ID_NAME-2, "Name", "Name of the new group");
|
||||
}
|
||||
|
||||
/****************** properties window operators *********************/
|
||||
|
@ -432,7 +432,7 @@ static void add_hook_object(Main *bmain, Scene *scene, Object *obedit, Object *o
|
||||
HookModifierData *hmd = NULL;
|
||||
float cent[3];
|
||||
int tot, ok, *indexar;
|
||||
char name[32];
|
||||
char name[MAX_NAME];
|
||||
|
||||
ok = object_hook_index_array(scene, obedit, &tot, &indexar, name, cent);
|
||||
|
||||
@ -752,7 +752,7 @@ static int object_hook_assign_exec(bContext *C, wmOperator *op)
|
||||
Object *ob=NULL;
|
||||
HookModifierData *hmd=NULL;
|
||||
float cent[3];
|
||||
char name[32];
|
||||
char name[MAX_NAME];
|
||||
int *indexar, tot;
|
||||
|
||||
if (ptr.data) { /* if modifier context is available, use that */
|
||||
|
@ -740,7 +740,7 @@ static int edit_modifier_poll(bContext *C)
|
||||
|
||||
static void edit_modifier_properties(wmOperatorType *ot)
|
||||
{
|
||||
RNA_def_string(ot->srna, "modifier", "", 32, "Modifier", "Name of the modifier to edit");
|
||||
RNA_def_string(ot->srna, "modifier", "", MAX_NAME, "Modifier", "Name of the modifier to edit");
|
||||
}
|
||||
|
||||
static int edit_modifier_invoke_properties(bContext *C, wmOperator *op)
|
||||
@ -762,7 +762,7 @@ static int edit_modifier_invoke_properties(bContext *C, wmOperator *op)
|
||||
|
||||
static ModifierData *edit_modifier_property_get(wmOperator *op, Object *ob, int type)
|
||||
{
|
||||
char modifier_name[32];
|
||||
char modifier_name[MAX_NAME];
|
||||
ModifierData *md;
|
||||
RNA_string_get(op->ptr, "modifier", modifier_name);
|
||||
|
||||
|
@ -246,7 +246,7 @@ void ED_operatormacros_object(void)
|
||||
ot= WM_operatortype_append_macro("OBJECT_OT_add_named_cursor", "Add named object at cursor", OPTYPE_UNDO|OPTYPE_REGISTER);
|
||||
if(ot) {
|
||||
ot->description = "Add named object at cursor";
|
||||
RNA_def_string(ot->srna, "name", "Cube", 24, "Name", "Object name to add");
|
||||
RNA_def_string(ot->srna, "name", "Cube", MAX_ID_NAME-2, "Name", "Object name to add");
|
||||
|
||||
WM_operatortype_macro_define(ot, "VIEW3D_OT_cursor3d");
|
||||
WM_operatortype_macro_define(ot, "OBJECT_OT_add_named");
|
||||
|
@ -333,7 +333,7 @@ static int make_proxy_exec (bContext *C, wmOperator *op)
|
||||
if (ob) {
|
||||
Object *newob;
|
||||
Base *newbase, *oldbase= BASACT;
|
||||
char name[32];
|
||||
char name[MAX_ID_NAME+4];
|
||||
|
||||
/* Add new object for the proxy */
|
||||
newob= add_object(scene, OB_EMPTY);
|
||||
@ -1888,7 +1888,7 @@ static int drop_named_material_invoke(bContext *C, wmOperator *op, wmEvent *even
|
||||
Main *bmain= CTX_data_main(C);
|
||||
Base *base= ED_view3d_give_base_under_cursor(C, event->mval);
|
||||
Material *ma;
|
||||
char name[32];
|
||||
char name[MAX_ID_NAME-2];
|
||||
|
||||
RNA_string_get(op->ptr, "name", name);
|
||||
ma= (Material *)find_id("MA", name);
|
||||
@ -1921,5 +1921,5 @@ void OBJECT_OT_drop_named_material(wmOperatorType *ot)
|
||||
ot->flag= OPTYPE_UNDO;
|
||||
|
||||
/* properties */
|
||||
RNA_def_string(ot->srna, "name", "Material", 24, "Name", "Material name to assign");
|
||||
RNA_def_string(ot->srna, "name", "Material", MAX_ID_NAME-2, "Name", "Material name to assign");
|
||||
}
|
||||
|
@ -841,7 +841,7 @@ void OBJECT_OT_select_all(wmOperatorType *ot)
|
||||
static int object_select_same_group_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
Group *group;
|
||||
char group_name[32];
|
||||
char group_name[MAX_ID_NAME];
|
||||
|
||||
/* passthrough if no objects are visible */
|
||||
if (CTX_DATA_COUNT(C, visible_bases) == 0) return OPERATOR_PASS_THROUGH;
|
||||
@ -882,7 +882,7 @@ void OBJECT_OT_select_same_group(wmOperatorType *ot)
|
||||
/* flags */
|
||||
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
|
||||
|
||||
RNA_def_string(ot->srna, "group", "", 32, "Group", "Name of the group to select");
|
||||
RNA_def_string(ot->srna, "group", "", MAX_ID_NAME, "Group", "Name of the group to select");
|
||||
}
|
||||
|
||||
/**************************** Select Mirror ****************************/
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -236,7 +236,7 @@ typedef struct StrokeCache {
|
||||
|
||||
float vertex_rotation;
|
||||
|
||||
char saved_active_brush_name[24];
|
||||
char saved_active_brush_name[MAX_ID_NAME];
|
||||
int alt_smooth;
|
||||
|
||||
float plane_trim_squared;
|
||||
|
@ -119,7 +119,7 @@ void draw_channel_names(bContext *C, bAnimContext *ac, ARegion *ar)
|
||||
}
|
||||
}
|
||||
{ /* second pass: widgets */
|
||||
uiBlock *block= uiBeginBlock(C, ar, "dopesheet channel buttons", UI_EMBOSS);
|
||||
uiBlock *block= uiBeginBlock(C, ar, __func__, UI_EMBOSS);
|
||||
size_t channel_index = 0;
|
||||
|
||||
y= (float)ACHANNEL_FIRST;
|
||||
|
@ -108,7 +108,7 @@ void buttons_header_buttons(const bContext *C, ARegion *ar)
|
||||
|
||||
buttons_context_compute(C, sbuts);
|
||||
|
||||
block= uiBeginBlock(C, ar, "header buttons", UI_EMBOSS);
|
||||
block= uiBeginBlock(C, ar, __func__, UI_EMBOSS);
|
||||
uiBlockSetHandleFunc(block, do_buttons_buttons, NULL);
|
||||
|
||||
xco= ED_area_header_switchbutton(C, block, yco);
|
||||
|
@ -75,20 +75,20 @@ void clip_draw_curfra_label(SpaceClip *sc, float x, float y)
|
||||
{
|
||||
uiStyle *style= UI_GetStyle();
|
||||
int fontid= style->widget.uifont_id;
|
||||
char str[32];
|
||||
char numstr[32];
|
||||
float font_dims[2] = {0.0f, 0.0f};
|
||||
|
||||
/* frame number */
|
||||
BLF_size(fontid, 11.0f, U.dpi);
|
||||
BLI_snprintf(str, sizeof(str), "%d", sc->user.framenr);
|
||||
BLI_snprintf(numstr, sizeof(numstr), "%d", sc->user.framenr);
|
||||
|
||||
BLF_width_and_height(fontid, str, &font_dims[0], &font_dims[1]);
|
||||
BLF_width_and_height(fontid, numstr, &font_dims[0], &font_dims[1]);
|
||||
|
||||
glRecti(x, y, x + font_dims[0] + 6.0f, y + font_dims[1] + 4.0f);
|
||||
|
||||
UI_ThemeColor(TH_TEXT);
|
||||
BLF_position(fontid, x+2.0f, y+2.0f, 0.0f);
|
||||
BLF_draw(fontid, str, sizeof(str));
|
||||
BLF_draw(fontid, numstr, sizeof(numstr));
|
||||
}
|
||||
|
||||
static void draw_movieclip_cache(SpaceClip *sc, ARegion *ar, MovieClip *clip, Scene *scene)
|
||||
|
@ -118,7 +118,7 @@ void file_draw_buttons(const bContext *C, ARegion *ar)
|
||||
const int separator = 4;
|
||||
|
||||
/* Additional locals. */
|
||||
char name[32];
|
||||
char uiblockstr[32];
|
||||
int loadbutton;
|
||||
int fnumbuttons;
|
||||
int min_x = 10;
|
||||
@ -134,8 +134,8 @@ void file_draw_buttons(const bContext *C, ARegion *ar)
|
||||
ARegion* artmp;
|
||||
|
||||
/* Initialize UI block. */
|
||||
sprintf(name, "win %p", (void *)ar);
|
||||
block = uiBeginBlock(C, ar, name, UI_EMBOSS);
|
||||
BLI_snprintf(uiblockstr, sizeof(uiblockstr), "win %p", (void *)ar);
|
||||
block = uiBeginBlock(C, ar, uiblockstr, UI_EMBOSS);
|
||||
uiBlockSetHandleFunc(block, do_file_buttons, NULL);
|
||||
|
||||
/* exception to make space for collapsed region icon */
|
||||
@ -450,7 +450,7 @@ void file_draw_list(const bContext *C, ARegion *ar)
|
||||
struct FileList* files = sfile->files;
|
||||
struct direntry *file;
|
||||
ImBuf *imb;
|
||||
uiBlock *block = uiBeginBlock(C, ar, "FileNames", UI_EMBOSS);
|
||||
uiBlock *block = uiBeginBlock(C, ar, __func__, UI_EMBOSS);
|
||||
int numfiles;
|
||||
int numfiles_layout;
|
||||
int sx, sy;
|
||||
|
@ -970,7 +970,7 @@ int filelist_islibrary(struct FileList* filelist, char* dir, char* group)
|
||||
return BLO_is_a_library(filelist->dir, dir, group);
|
||||
}
|
||||
|
||||
static int groupname_to_code(char *group)
|
||||
static int groupname_to_code(const char *group)
|
||||
{
|
||||
char buf[32];
|
||||
char *lslash;
|
||||
@ -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 */
|
||||
|
@ -1003,7 +1003,7 @@ void graph_draw_channel_names(bContext *C, bAnimContext *ac, ARegion *ar)
|
||||
}
|
||||
}
|
||||
{ /* second pass: widgets */
|
||||
uiBlock *block= uiBeginBlock(C, ar, "graph channel buttons", UI_EMBOSS);
|
||||
uiBlock *block= uiBeginBlock(C, ar, __func__, UI_EMBOSS);
|
||||
size_t channel_index = 0;
|
||||
|
||||
y= (float)ACHANNEL_FIRST;
|
||||
|
@ -335,7 +335,7 @@ static void image_panel_preview(ScrArea *sa, short cntrl) // IMAGE_HANDLER_PREVI
|
||||
return;
|
||||
}
|
||||
|
||||
block= uiBeginBlock(C, ar, "image_panel_preview", UI_EMBOSS);
|
||||
block= uiBeginBlock(C, ar, __func__, UI_EMBOSS);
|
||||
uiPanelControl(UI_PNL_SOLID | UI_PNL_CLOSE | UI_PNL_SCALE | cntrl);
|
||||
uiSetPanelHandler(IMAGE_HANDLER_PREVIEW); // for close and esc
|
||||
|
||||
@ -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);
|
||||
|
@ -88,8 +88,8 @@ static int edit_actuator_poll(bContext *C)
|
||||
|
||||
static void edit_sensor_properties(wmOperatorType *ot)
|
||||
{
|
||||
RNA_def_string(ot->srna, "sensor", "", 32, "Sensor", "Name of the sensor to edit");
|
||||
RNA_def_string(ot->srna, "object", "", 32, "Object", "Name of the object the sensor belongs to");
|
||||
RNA_def_string(ot->srna, "sensor", "", MAX_NAME, "Sensor", "Name of the sensor to edit");
|
||||
RNA_def_string(ot->srna, "object", "", MAX_NAME, "Object", "Name of the object the sensor belongs to");
|
||||
}
|
||||
|
||||
static int edit_sensor_invoke_properties(bContext *C, wmOperator *op)
|
||||
@ -113,14 +113,14 @@ static int edit_sensor_invoke_properties(bContext *C, wmOperator *op)
|
||||
|
||||
static Object *edit_object_property_get(bContext *C, wmOperator *op)
|
||||
{
|
||||
char ob_name[32];
|
||||
char ob_name[MAX_NAME];
|
||||
Object *ob;
|
||||
|
||||
RNA_string_get(op->ptr, "object", ob_name);
|
||||
|
||||
/* if ob_name is valid try to find the object with this name
|
||||
otherwise gets the active object */
|
||||
if (BLI_strnlen(ob_name, 32) > 0)
|
||||
if (BLI_strnlen(ob_name, MAX_NAME) > 0)
|
||||
ob = BLI_findstring(&(CTX_data_main(C)->object), ob_name, offsetof(ID, name) + 2);
|
||||
else
|
||||
ob= ED_object_active_context(C);
|
||||
@ -130,7 +130,7 @@ static Object *edit_object_property_get(bContext *C, wmOperator *op)
|
||||
|
||||
static bSensor *edit_sensor_property_get(bContext *C, wmOperator *op, Object **ob)
|
||||
{
|
||||
char sensor_name[32];
|
||||
char sensor_name[MAX_NAME];
|
||||
bSensor *sens;
|
||||
|
||||
RNA_string_get(op->ptr, "sensor", sensor_name);
|
||||
@ -144,8 +144,8 @@ static bSensor *edit_sensor_property_get(bContext *C, wmOperator *op, Object **o
|
||||
|
||||
static void edit_controller_properties(wmOperatorType *ot)
|
||||
{
|
||||
RNA_def_string(ot->srna, "controller", "", 32, "Controller", "Name of the controller to edit");
|
||||
RNA_def_string(ot->srna, "object", "", 32, "Object", "Name of the object the controller belongs to");
|
||||
RNA_def_string(ot->srna, "controller", "", MAX_NAME, "Controller", "Name of the controller to edit");
|
||||
RNA_def_string(ot->srna, "object", "", MAX_NAME, "Object", "Name of the object the controller belongs to");
|
||||
}
|
||||
|
||||
static int edit_controller_invoke_properties(bContext *C, wmOperator *op)
|
||||
@ -169,7 +169,7 @@ static int edit_controller_invoke_properties(bContext *C, wmOperator *op)
|
||||
|
||||
static bController *edit_controller_property_get(bContext *C, wmOperator *op, Object **ob)
|
||||
{
|
||||
char controller_name[32];
|
||||
char controller_name[MAX_NAME];
|
||||
bController *cont;
|
||||
|
||||
RNA_string_get(op->ptr, "controller", controller_name);
|
||||
@ -183,8 +183,8 @@ static bController *edit_controller_property_get(bContext *C, wmOperator *op, Ob
|
||||
|
||||
static void edit_actuator_properties(wmOperatorType *ot)
|
||||
{
|
||||
RNA_def_string(ot->srna, "actuator", "", 32, "Actuator", "Name of the actuator to edit");
|
||||
RNA_def_string(ot->srna, "object", "", 32, "Object", "Name of the object the actuator belongs to");
|
||||
RNA_def_string(ot->srna, "actuator", "", MAX_NAME, "Actuator", "Name of the actuator to edit");
|
||||
RNA_def_string(ot->srna, "object", "", MAX_NAME, "Object", "Name of the object the actuator belongs to");
|
||||
}
|
||||
|
||||
static int edit_actuator_invoke_properties(bContext *C, wmOperator *op)
|
||||
@ -208,7 +208,7 @@ static int edit_actuator_invoke_properties(bContext *C, wmOperator *op)
|
||||
|
||||
static bActuator *edit_actuator_property_get(bContext *C, wmOperator *op, Object **ob)
|
||||
{
|
||||
char actuator_name[32];
|
||||
char actuator_name[MAX_NAME];
|
||||
bActuator *act;
|
||||
|
||||
RNA_string_get(op->ptr, "actuator", actuator_name);
|
||||
@ -278,7 +278,7 @@ static int sensor_add_exec(bContext *C, wmOperator *op)
|
||||
PointerRNA sens_ptr;
|
||||
PropertyRNA *prop;
|
||||
const char *sens_name;
|
||||
char name[32];
|
||||
char name[MAX_NAME];
|
||||
int type= RNA_enum_get(op->ptr, "type");
|
||||
|
||||
ob= edit_object_property_get(C, op);
|
||||
@ -293,7 +293,7 @@ static int sensor_add_exec(bContext *C, wmOperator *op)
|
||||
prop = RNA_struct_find_property(&sens_ptr, "type");
|
||||
|
||||
RNA_string_get(op->ptr, "name", name);
|
||||
if(BLI_strnlen(name, 32) < 1){
|
||||
if(BLI_strnlen(name, MAX_NAME) < 1){
|
||||
RNA_property_enum_name(C, &sens_ptr, prop, RNA_property_enum_get(&sens_ptr, prop), &sens_name);
|
||||
BLI_strncpy(sens->name, sens_name, sizeof(sens->name));
|
||||
}
|
||||
@ -328,8 +328,8 @@ static void LOGIC_OT_sensor_add(wmOperatorType *ot)
|
||||
/* properties */
|
||||
ot->prop= prop= RNA_def_enum(ot->srna, "type", DummyRNA_NULL_items, SENS_ALWAYS, "Type", "Type of sensor to add");
|
||||
RNA_def_enum_funcs(prop, rna_Sensor_type_itemf);
|
||||
RNA_def_string(ot->srna, "name", "", 32, "Name", "Name of the Sensor to add");
|
||||
RNA_def_string(ot->srna, "object", "", 32, "Object", "Name of the Object to add the Sensor to");
|
||||
RNA_def_string(ot->srna, "name", "", MAX_NAME, "Name", "Name of the Sensor to add");
|
||||
RNA_def_string(ot->srna, "object", "", MAX_NAME, "Object", "Name of the Object to add the Sensor to");
|
||||
}
|
||||
|
||||
/* ************* Add/Remove Controller Operator ************* */
|
||||
@ -382,7 +382,7 @@ static int controller_add_exec(bContext *C, wmOperator *op)
|
||||
PropertyRNA *prop;
|
||||
const char *cont_name;
|
||||
int bit;
|
||||
char name[32];
|
||||
char name[MAX_NAME];
|
||||
int type= RNA_enum_get(op->ptr, "type");
|
||||
|
||||
ob= edit_object_property_get(C, op);
|
||||
@ -397,7 +397,7 @@ static int controller_add_exec(bContext *C, wmOperator *op)
|
||||
prop = RNA_struct_find_property(&cont_ptr, "type");
|
||||
|
||||
RNA_string_get(op->ptr, "name", name);
|
||||
if(BLI_strnlen(name, 32) < 1){
|
||||
if(BLI_strnlen(name, MAX_NAME) < 1){
|
||||
RNA_property_enum_name(C, &cont_ptr, prop, RNA_property_enum_get(&cont_ptr, prop), &cont_name);
|
||||
BLI_strncpy(cont->name, cont_name, sizeof(cont->name));
|
||||
}
|
||||
@ -442,8 +442,8 @@ static void LOGIC_OT_controller_add(wmOperatorType *ot)
|
||||
|
||||
/* properties */
|
||||
ot->prop= RNA_def_enum(ot->srna, "type", controller_type_items, CONT_LOGIC_AND, "Type", "Type of controller to add");
|
||||
RNA_def_string(ot->srna, "name", "", 32, "Name", "Name of the Controller to add");
|
||||
RNA_def_string(ot->srna, "object", "", 32, "Object", "Name of the Object to add the Controller to");
|
||||
RNA_def_string(ot->srna, "name", "", MAX_NAME, "Name", "Name of the Controller to add");
|
||||
RNA_def_string(ot->srna, "object", "", MAX_NAME, "Object", "Name of the Object to add the Controller to");
|
||||
}
|
||||
|
||||
/* ************* Add/Remove Actuator Operator ************* */
|
||||
@ -495,7 +495,7 @@ static int actuator_add_exec(bContext *C, wmOperator *op)
|
||||
PointerRNA act_ptr;
|
||||
PropertyRNA *prop;
|
||||
const char *act_name;
|
||||
char name[32];
|
||||
char name[MAX_NAME];
|
||||
int type= RNA_enum_get(op->ptr, "type");
|
||||
|
||||
ob= edit_object_property_get(C, op);
|
||||
@ -510,7 +510,7 @@ static int actuator_add_exec(bContext *C, wmOperator *op)
|
||||
prop = RNA_struct_find_property(&act_ptr, "type");
|
||||
|
||||
RNA_string_get(op->ptr, "name", name);
|
||||
if (BLI_strnlen(name, 32) < 1){
|
||||
if (BLI_strnlen(name, MAX_NAME) < 1){
|
||||
RNA_property_enum_name(C, &act_ptr, prop, RNA_property_enum_get(&act_ptr, prop), &act_name);
|
||||
BLI_strncpy(act->name, act_name, sizeof(act->name));
|
||||
}
|
||||
@ -545,8 +545,8 @@ static void LOGIC_OT_actuator_add(wmOperatorType *ot)
|
||||
/* properties */
|
||||
ot->prop= prop= RNA_def_enum(ot->srna, "type", DummyRNA_NULL_items, CONT_LOGIC_AND, "Type", "Type of actuator to add");
|
||||
RNA_def_enum_funcs(prop, rna_Actuator_type_itemf);
|
||||
RNA_def_string(ot->srna, "name", "", 32, "Name", "Name of the Actuator to add");
|
||||
RNA_def_string(ot->srna, "object", "", 32, "Object", "Name of the Object to add the Actuator to");
|
||||
RNA_def_string(ot->srna, "name", "", MAX_NAME, "Name", "Name of the Actuator to add");
|
||||
RNA_def_string(ot->srna, "object", "", MAX_NAME, "Object", "Name of the Object to add the Actuator to");
|
||||
}
|
||||
|
||||
/* ************* Move Logic Bricks Operator ************* */
|
||||
|
@ -1187,7 +1187,7 @@ static short draw_sensorbuttons(Object *ob, bSensor *sens, uiBlock *block, short
|
||||
|
||||
ts= sens->data;
|
||||
|
||||
/* uiDefBut(block, TEX, 1, "Property:", xco,yco-22,width, 19, &ts->name, 0, 31, 0, 0, "Only look for Objects with this property"); */
|
||||
/* uiDefBut(block, TEX, 1, "Property:", xco,yco-22,width, 19, &ts->name, 0, MAX_NAME, 0, 0, "Only look for Objects with this property"); */
|
||||
uiDefIDPoinBut(block, test_matpoin_but, ID_MA, 1, "MA:",(short)(xco + 10),(short)(yco-44), (short)(width - 20), 19, &ts->ma, "Only look for floors with this Material");
|
||||
///* uiDefButF(block, NUM, 1, "Margin:", xco+width/2,yco-44,width/2, 19, &ts->dist, 0.0, 10.0, 100, 0, "Extra margin (distance) for larger sensitivity");
|
||||
yco-= ysize;
|
||||
@ -1216,11 +1216,11 @@ static short draw_sensorbuttons(Object *ob, bSensor *sens, uiBlock *block, short
|
||||
|
||||
if (cs->mode & SENS_COLLISION_MATERIAL) {
|
||||
uiDefBut(block, TEX, 1, "Material:", (short)(xco + 10 + 0.40 * (width-20)),
|
||||
(short)(yco-44), (short)(0.6*(width-20)), 19, &cs->materialName, 0, 31, 0, 0,
|
||||
(short)(yco-44), (short)(0.6*(width-20)), 19, &cs->materialName, 0, MAX_NAME, 0, 0,
|
||||
"Only look for Objects with this material");
|
||||
} else {
|
||||
uiDefBut(block, TEX, 1, "Property:", (short)(xco + 10 + 0.40 * (width-20)), (short)(yco-44),
|
||||
(short)(0.6*(width-20)), 19, &cs->name, 0, 31, 0, 0,
|
||||
(short)(0.6*(width-20)), 19, &cs->name, 0, MAX_NAME, 0, 0,
|
||||
"Only look for Objects with this property");
|
||||
}
|
||||
|
||||
@ -1240,7 +1240,7 @@ static short draw_sensorbuttons(Object *ob, bSensor *sens, uiBlock *block, short
|
||||
ns= sens->data;
|
||||
|
||||
uiDefBut(block, TEX, 1, "Property:",(short)(10+xco),(short)(yco-44), (short)(width-20), 19,
|
||||
&ns->name, 0, 31, 0, 0, "Only look for Objects with this property");
|
||||
&ns->name, 0, MAX_NAME, 0, 0, "Only look for Objects with this property");
|
||||
uiDefButF(block, NUM, 1, "Dist",(short)(10+xco),(short)(yco-68),(short)((width-22)/2), 19,
|
||||
&ns->dist, 0.0, 1000.0, 1000, 0, "Trigger distance");
|
||||
uiDefButF(block, NUM, 1, "Reset",(short)(10+xco+(width-22)/2), (short)(yco-68), (short)((width-22)/2), 19,
|
||||
@ -1261,7 +1261,7 @@ static short draw_sensorbuttons(Object *ob, bSensor *sens, uiBlock *block, short
|
||||
|
||||
uiDefBut(block, TEX, 1, "Prop:",
|
||||
(short)(10+xco),(short)(yco-44), (short)(0.7 * (width-20)), 19,
|
||||
&rs->name, 0, 31, 0, 0,
|
||||
&rs->name, 0, MAX_NAME, 0, 0,
|
||||
"Only look for Objects with this property");
|
||||
|
||||
str = "Type %t|+X axis %x0|+Y axis %x1|+Z axis %x2|-X axis %x3|-Y axis %x4|-Z axis %x5";
|
||||
@ -1316,14 +1316,14 @@ static short draw_sensorbuttons(Object *ob, bSensor *sens, uiBlock *block, short
|
||||
/* line 4: toggle property for string logging mode */
|
||||
uiDefBut(block, TEX, 1, "LogToggle: ",
|
||||
xco+10, yco-((ks->type&1) ? 68:92), (width-20), 19,
|
||||
ks->toggleName, 0, 31, 0, 0,
|
||||
ks->toggleName, 0, MAX_NAME, 0, 0,
|
||||
"Property that indicates whether to log "
|
||||
"keystrokes as a string");
|
||||
|
||||
/* line 5: target property for string logging mode */
|
||||
uiDefBut(block, TEX, 1, "Target: ",
|
||||
xco+10, yco-((ks->type&1) ? 92:116), (width-20), 19,
|
||||
ks->targetName, 0, 31, 0, 0,
|
||||
ks->targetName, 0, MAX_NAME, 0, 0,
|
||||
"Property that receives the keystrokes in case "
|
||||
"a string is logged");
|
||||
|
||||
@ -1349,21 +1349,21 @@ static short draw_sensorbuttons(Object *ob, bSensor *sens, uiBlock *block, short
|
||||
if (ps->type != SENS_PROP_EXPRESSION)
|
||||
{
|
||||
uiDefBut(block, TEX, 1, "Prop: ", xco+30,yco-68,width-60, 19,
|
||||
ps->name, 0, 31, 0, 0, "Property name");
|
||||
ps->name, 0, MAX_NAME, 0, 0, "Property name");
|
||||
}
|
||||
|
||||
if(ps->type == SENS_PROP_INTERVAL)
|
||||
{
|
||||
uiDefBut(block, TEX, 1, "Min: ", xco,yco-92,width/2, 19,
|
||||
ps->value, 0, 31, 0, 0, "check for min value");
|
||||
ps->value, 0, MAX_NAME, 0, 0, "check for min value");
|
||||
uiDefBut(block, TEX, 1, "Max: ", xco+width/2,yco-92,width/2, 19,
|
||||
ps->maxvalue, 0, 31, 0, 0, "check for max value");
|
||||
ps->maxvalue, 0, MAX_NAME, 0, 0, "check for max value");
|
||||
}
|
||||
else if(ps->type == SENS_PROP_CHANGED);
|
||||
else
|
||||
{
|
||||
uiDefBut(block, TEX, 1, "Value: ", xco+30,yco-92,width-60, 19,
|
||||
ps->value, 0, 31, 0, 0, "check for value");
|
||||
ps->value, 0, MAX_NAME, 0, 0, "check for value");
|
||||
}
|
||||
|
||||
yco-= ysize;
|
||||
@ -1384,12 +1384,12 @@ static short draw_sensorbuttons(Object *ob, bSensor *sens, uiBlock *block, short
|
||||
uiBlockBeginAlign(block);
|
||||
but = uiDefBut(block, TEX, 1, "Bone: ",
|
||||
(xco+10), (yco-44), (width-20)/2, 19,
|
||||
arm->posechannel, 0, 31, 0, 0,
|
||||
arm->posechannel, 0, MAX_NAME, 0, 0,
|
||||
"Bone on which you want to check a constraint");
|
||||
uiButSetFunc(but, check_armature_sensor, but, arm);
|
||||
but = uiDefBut(block, TEX, 1, "Cons: ",
|
||||
(xco+10)+(width-20)/2, (yco-44), (width-20)/2, 19,
|
||||
arm->constraint, 0, 31, 0, 0,
|
||||
arm->constraint, 0, MAX_NAME, 0, 0,
|
||||
"Name of the constraint you want to control");
|
||||
uiButSetFunc(but, check_armature_sensor, but, arm);
|
||||
uiBlockEndAlign(block);
|
||||
@ -1420,7 +1420,7 @@ static short draw_sensorbuttons(Object *ob, bSensor *sens, uiBlock *block, short
|
||||
as= sens->data;
|
||||
|
||||
uiDefBut(block, TEX, 1, "Act: ", xco+30,yco-44,width-60, 19,
|
||||
as->name, 0, 31, 0, 0, "Actuator name, actuator active state modifications will be detected");
|
||||
as->name, 0, MAX_NAME, 0, 0, "Actuator name, actuator active state modifications will be detected");
|
||||
yco-= ysize;
|
||||
break;
|
||||
}
|
||||
@ -1513,13 +1513,13 @@ static short draw_sensorbuttons(Object *ob, bSensor *sens, uiBlock *block, short
|
||||
if (raySens->mode & SENS_COLLISION_MATERIAL)
|
||||
{
|
||||
uiDefBut(block, TEX, 1, "Material:", xco + 10 + 0.20 * (width-20), yco-44, 0.8*(width-20), 19,
|
||||
&raySens->matname, 0, 31, 0, 0,
|
||||
&raySens->matname, 0, MAX_NAME, 0, 0,
|
||||
"Only look for Objects with this material");
|
||||
}
|
||||
else
|
||||
{
|
||||
uiDefBut(block, TEX, 1, "Property:", xco + 10 + 0.20 * (width-20), yco-44, 0.8*(width-20), 19,
|
||||
&raySens->propname, 0, 31, 0, 0,
|
||||
&raySens->propname, 0, MAX_NAME, 0, 0,
|
||||
"Only look for Objects with this property");
|
||||
}
|
||||
|
||||
@ -1557,7 +1557,7 @@ static short draw_sensorbuttons(Object *ob, bSensor *sens, uiBlock *block, short
|
||||
/* line 2: Subject filter */
|
||||
uiDefBut(block, TEX, 1, "Subject: ",
|
||||
(xco+10), (yco-44), (width-20), 19,
|
||||
mes->subject, 0, 31, 0, 0,
|
||||
mes->subject, 0, MAX_NAME, 0, 0,
|
||||
"Optional subject filter: only accept messages with this subject"
|
||||
", or empty for all");
|
||||
|
||||
@ -1683,7 +1683,7 @@ static short draw_controllerbuttons(bController *cont, uiBlock *block, short xco
|
||||
ec= cont->data;
|
||||
/* uiDefBut(block, BUT, 1, "Variables", xco,yco-24,80, 19, NULL, 0, 0, 0, 0, "Available variables for expression"); */
|
||||
uiDefBut(block, TEX, 1, "Exp:", xco + 10 , yco-21, width-20, 19,
|
||||
ec->str, 0, 127, 0, 0,
|
||||
ec->str, 0, sizeof(ec->str), 0, 0,
|
||||
"Expression");
|
||||
|
||||
yco-= ysize;
|
||||
@ -1704,7 +1704,7 @@ static short draw_controllerbuttons(bController *cont, uiBlock *block, short xco
|
||||
if(pc->mode==0)
|
||||
uiDefIDPoinBut(block, test_scriptpoin_but, ID_TXT, 1, "", xco+70,yco-23,width-74, 19, &pc->text, "Blender textblock to run as a script");
|
||||
else {
|
||||
uiDefBut(block, TEX, 1, "", xco+70,yco-23,(width-70)-25, 19, pc->module, 0, 63, 0, 0, "Module name and function to run e.g. \"someModule.main\". Internal texts and external python files can be used");
|
||||
uiDefBut(block, TEX, 1, "", xco+70,yco-23,(width-70)-25, 19, pc->module, 0, sizeof(pc->module), 0, 0, "Module name and function to run e.g. \"someModule.main\". Internal texts and external python files can be used");
|
||||
uiDefButBitI(block, TOG, CONT_PY_DEBUG, B_REDR, "D", (xco+width)-25, yco-23, 19, 19, &pc->flag, 0, 0, 0, 0, "Continuously reload the module from disk for editing external modules without restarting");
|
||||
}
|
||||
uiBlockEndAlign(block);
|
||||
@ -2032,7 +2032,7 @@ static short draw_actuatorbuttons(Main *bmain, Object *ob, bActuator *act, uiBlo
|
||||
|
||||
if(aa->type == ACT_ACTION_FROM_PROP)
|
||||
{
|
||||
uiDefBut(block, TEX, 0, "Prop: ",xco+10, yco-44, width-20, 19, aa->name, 0.0, 31.0, 0, 0, "Use this property to define the Action position");
|
||||
uiDefBut(block, TEX, 0, "Prop: ",xco+10, yco-44, width-20, 19, aa->name, 0.0, MAX_NAME, 0, 0, "Use this property to define the Action position");
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -2043,7 +2043,7 @@ static short draw_actuatorbuttons(Main *bmain, Object *ob, bActuator *act, uiBlo
|
||||
uiDefButS(block, NUM, 0, "Blendin: ", xco+10, yco-64, (width-20)/2, 19, &aa->blendin, 0.0, 32767, 0.0, 0.0, "Number of frames of motion blending");
|
||||
uiDefButS(block, NUM, 0, "Priority: ", xco+10+(width-20)/2, yco-64, (width-20)/2, 19, &aa->priority, 0.0, 100.0, 0.0, 0.0, "Execution priority - lower numbers will override actions with higher numbers, With 2 or more actions at once, the overriding channels must be lower in the stack");
|
||||
|
||||
uiDefBut(block, TEX, 0, "FrameProp: ",xco+10, yco-84, width-20, 19, aa->frameProp, 0.0, 31.0, 0, 0, "Assign the action's current frame number to this property");
|
||||
uiDefBut(block, TEX, 0, "FrameProp: ",xco+10, yco-84, width-20, 19, aa->frameProp, 0.0, MAX_NAME, 0, 0, "Assign the action's current frame number to this property");
|
||||
|
||||
|
||||
#ifdef __NLA_ACTION_BY_MOTION_ACTUATOR
|
||||
@ -2094,7 +2094,7 @@ static short draw_actuatorbuttons(Main *bmain, Object *ob, bActuator *act, uiBlo
|
||||
if(ia->type==ACT_IPO_FROM_PROP) {
|
||||
uiDefBut(block, TEX, 0,
|
||||
"Prop: ", xco+10, yco-44, width-80, 19,
|
||||
ia->name, 0.0, 31.0, 0, 0,
|
||||
ia->name, 0.0, MAX_NAME, 0, 0,
|
||||
"Use this property to define the Ipo position");
|
||||
}
|
||||
else {
|
||||
@ -2113,7 +2113,7 @@ static short draw_actuatorbuttons(Main *bmain, Object *ob, bActuator *act, uiBlo
|
||||
"Update IPO on all children Objects as well");
|
||||
uiDefBut(block, TEX, 0,
|
||||
"FrameProp: ", xco+10, yco-64, width-20, 19,
|
||||
ia->frameProp, 0.0, 31.0, 0, 0,
|
||||
ia->frameProp, 0.0, MAX_NAME, 0, 0,
|
||||
"Assign the action's current frame number to this property");
|
||||
|
||||
yco-= ysize;
|
||||
@ -2131,7 +2131,7 @@ static short draw_actuatorbuttons(Main *bmain, Object *ob, bActuator *act, uiBlo
|
||||
str= "Type%t|Assign%x0|Add %x1|Copy %x2|Toggle (bool/int/float/timer)%x3";
|
||||
uiDefButI(block, MENU, B_REDR, str, xco+30,yco-24,width-60, 19, &pa->type, 0, 31, 0, 0, "Type");
|
||||
|
||||
uiDefBut(block, TEX, 1, "Prop: ", xco+30,yco-44,width-60, 19, pa->name, 0, 31, 0, 0, "Property name");
|
||||
uiDefBut(block, TEX, 1, "Prop: ", xco+30,yco-44,width-60, 19, pa->name, 0, MAX_NAME, 0, 0, "Property name");
|
||||
|
||||
|
||||
if(pa->type==ACT_PROP_TOGGLE) {
|
||||
@ -2140,10 +2140,10 @@ static short draw_actuatorbuttons(Main *bmain, Object *ob, bActuator *act, uiBlo
|
||||
}
|
||||
else if(pa->type==ACT_PROP_COPY) {
|
||||
uiDefIDPoinBut(block, test_obpoin_but, ID_OB, 1, "OB:", xco+10, yco-64, (width-20)/2, 19, &(pa->ob), "Copy from this Object");
|
||||
uiDefBut(block, TEX, 1, "Prop: ", xco+10+(width-20)/2, yco-64, (width-20)/2, 19, pa->value, 0, 31, 0, 0, "Copy this property");
|
||||
uiDefBut(block, TEX, 1, "Prop: ", xco+10+(width-20)/2, yco-64, (width-20)/2, 19, pa->value, 0, MAX_NAME, 0, 0, "Copy this property");
|
||||
}
|
||||
else {
|
||||
uiDefBut(block, TEX, 1, "Value: ", xco+30,yco-64,width-60, 19, pa->value, 0, 31, 0, 0, "change with this value, use \"\" around strings");
|
||||
uiDefBut(block, TEX, 1, "Value: ", xco+30,yco-64,width-60, 19, pa->value, 0, MAX_NAME, 0, 0, "change with this value, use \"\" around strings");
|
||||
}
|
||||
yco-= ysize;
|
||||
|
||||
@ -2175,7 +2175,7 @@ static short draw_actuatorbuttons(Main *bmain, Object *ob, bActuator *act, uiBlo
|
||||
char dummy_str[] = "Sound mode %t|Play Stop %x0|Play End %x1|Loop Stop %x2|"
|
||||
"Loop End %x3|Loop Ping Pong Stop %x5|Loop Ping Pong %x4";
|
||||
uiDefBut(block, TEX, B_IDNAME, "SO:",xco+30,yco-22,wval-20,19,
|
||||
((ID *)sa->sound)->name+2, 0.0, 21.0, 0, 0, "");
|
||||
((ID *)sa->sound)->name+2, 0.0, MAX_ID_NAME-2, 0, 0, "");
|
||||
uiDefButS(block, MENU, 1, dummy_str,xco+10,yco-44,width-20, 19,
|
||||
&sa->type, 0.0, 0.0, 0, 0, "");
|
||||
uiDefButF(block, NUM, 0, "Volume:", xco+10,yco-66,wval, 19, &sa->volume,
|
||||
@ -2397,13 +2397,13 @@ static short draw_actuatorbuttons(Main *bmain, Object *ob, bActuator *act, uiBlo
|
||||
if (coa->flag & ACT_CONST_MATERIAL)
|
||||
{
|
||||
uiDefBut(block, TEX, 1, "Material:", xco + 50, yco-84, (width-60), 19,
|
||||
coa->matprop, 0, 31, 0, 0,
|
||||
coa->matprop, 0, MAX_NAME, 0, 0,
|
||||
"Ray detects only Objects with this material");
|
||||
}
|
||||
else
|
||||
{
|
||||
uiDefBut(block, TEX, 1, "Property:", xco + 50, yco-84, (width-60), 19,
|
||||
coa->matprop, 0, 31, 0, 0,
|
||||
coa->matprop, 0, MAX_NAME, 0, 0,
|
||||
"Ray detect only Objects with this property");
|
||||
}
|
||||
uiDefButBitS(block, TOG, ACT_CONST_PERMANENT, 0, "PER", xco+10, yco-103, 40, 19,
|
||||
@ -2456,13 +2456,13 @@ static short draw_actuatorbuttons(Main *bmain, Object *ob, bActuator *act, uiBlo
|
||||
if (coa->flag & ACT_CONST_MATERIAL)
|
||||
{
|
||||
uiDefBut(block, TEX, 1, "Material:", xco + 50, yco-84, (width-60), 19,
|
||||
coa->matprop, 0, 31, 0, 0,
|
||||
coa->matprop, 0, MAX_NAME, 0, 0,
|
||||
"Ray detects only Objects with this material");
|
||||
}
|
||||
else
|
||||
{
|
||||
uiDefBut(block, TEX, 1, "Property:", xco + 50, yco-84, (width-60), 19,
|
||||
coa->matprop, 0, 31, 0, 0,
|
||||
coa->matprop, 0, MAX_NAME, 0, 0,
|
||||
"Ray detect only Objects with this property");
|
||||
}
|
||||
uiDefButBitS(block, TOG, ACT_CONST_PERMANENT, 0, "PER", xco+10, yco-103, 40, 19,
|
||||
@ -2554,8 +2554,8 @@ static short draw_actuatorbuttons(Main *bmain, Object *ob, bActuator *act, uiBlo
|
||||
ysize = 48;
|
||||
glRects(xco, yco-ysize, xco+width, yco);
|
||||
uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
|
||||
uiDefBut(block, TEX, 1, "File: ", xco+10, yco-44,width-20,19, &(gma->filename), 0, 63, 0, 0, "Load this blend file, use the \"//\" prefix for a path relative to the current blend file");
|
||||
// uiDefBut(block, TEX, 1, "Anim: ", xco+10, yco-64,width-20,19, &(gma->loadaniname), 0, 63, 0, 0, "Use this loadinganimation");
|
||||
uiDefBut(block, TEX, 1, "File: ", xco+10, yco-44,width-20,19, &(gma->filename), 0, sizeof(gma->filename), 0, 0, "Load this blend file, use the \"//\" prefix for a path relative to the current blend file");
|
||||
// uiDefBut(block, TEX, 1, "Anim: ", xco+10, yco-64,width-20,19, &(gma->loadaniname), 0, sizeof(gma->loadaniname), 0, 0, "Use this loadinganimation");
|
||||
}
|
||||
/* else if (gma->type == ACT_GAME_START)
|
||||
{
|
||||
@ -2563,8 +2563,8 @@ static short draw_actuatorbuttons(Main *bmain, Object *ob, bActuator *act, uiBlo
|
||||
glRects(xco, yco-ysize, xco+width, yco);
|
||||
uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
|
||||
|
||||
uiDefBut(block, TEX, 1, "File: ", xco+10, yco-44,width-20,19, &(gma->filename), 0, 63, 0, 0, "Load this file");
|
||||
uiDefBut(block, TEX, 1, "Anim: ", xco+10, yco-64,width-20,19, &(gma->loadaniname), 0, 63, 0, 0, "Use this loadinganimation");
|
||||
uiDefBut(block, TEX, 1, "File: ", xco+10, yco-44,width-20,19, &(gma->filename), 0, sizeof(gma->filename), 0, 0, "Load this file");
|
||||
uiDefBut(block, TEX, 1, "Anim: ", xco+10, yco-64,width-20,19, &(gma->loadaniname), 0, sizeof(gma->loadaniname), 0, 0, "Use this loadinganimation");
|
||||
}
|
||||
*/ else if (ELEM4(gma->type, ACT_GAME_RESTART, ACT_GAME_QUIT, ACT_GAME_SAVECFG, ACT_GAME_LOADCFG))
|
||||
{
|
||||
@ -2592,11 +2592,11 @@ static short draw_actuatorbuttons(Main *bmain, Object *ob, bActuator *act, uiBlo
|
||||
|
||||
uiDefButS(block, MENU, 1, str, xco+20, yco-24, width-40, 19, &ga->type, 0, 0, 0, 0, "");
|
||||
if(ga->type==ACT_GROUP_SET) {
|
||||
uiDefBut(block, TEX, 0, "Key: ", xco+20, yco-44, (width-10)/2, 19, ga->name, 0.0, 31.0, 0, 0, "This name defines groupkey to be set");
|
||||
uiDefBut(block, TEX, 0, "Key: ", xco+20, yco-44, (width-10)/2, 19, ga->name, 0.0, MAX_NAME, 0, 0, "This name defines groupkey to be set");
|
||||
uiDefButI(block, NUM, 0, "Frame:", xco+20+(width-10)/2, yco-44, (width-70)/2, 19, &ga->sta, 0.0, 2500.0, 0, 0, "Set this frame");
|
||||
}
|
||||
else if(ga->type==ACT_GROUP_FROM_PROP) {
|
||||
uiDefBut(block, TEX, 0, "Prop: ", xco+20, yco-44, width-40, 19, ga->name, 0.0, 31.0, 0, 0, "Use this property to define the Group position");
|
||||
uiDefBut(block, TEX, 0, "Prop: ", xco+20, yco-44, width-40, 19, ga->name, 0.0, MAX_NAME, 0, 0, "Use this property to define the Group position");
|
||||
}
|
||||
else {
|
||||
uiDefButI(block, NUM, 0, "State", xco+20, yco-44, (width-40)/2, 19, &ga->sta, 0.0, 2500.0, 0, 0, "Start frame");
|
||||
@ -2698,7 +2698,7 @@ static short draw_actuatorbuttons(Main *bmain, Object *ob, bActuator *act, uiBlo
|
||||
|
||||
/* 3. property */
|
||||
uiDefBut(block, TEX, 1, "Property:", (xco+10), yco-44, (width-20), 19,
|
||||
&randAct->propname, 0, 31, 0, 0,
|
||||
&randAct->propname, 0, MAX_NAME, 0, 0,
|
||||
"Assign the random value to this property");
|
||||
|
||||
/*4. and 5. arguments for the distribution*/
|
||||
@ -2789,13 +2789,13 @@ static short draw_actuatorbuttons(Main *bmain, Object *ob, bActuator *act, uiBlo
|
||||
/* line 1: To */
|
||||
uiDefBut(block, TEX, 1, "To: ",
|
||||
(xco+10), (yco-(myline++*24)), (width-20), 19,
|
||||
&ma->toPropName, 0, 31, 0, 0,
|
||||
&ma->toPropName, 0, MAX_NAME, 0, 0,
|
||||
"Optional send message to objects with this name only, or empty to broadcast");
|
||||
|
||||
/* line 2: Message Subject */
|
||||
uiDefBut(block, TEX, 1, "Subject: ",
|
||||
(xco+10), (yco-(myline++*24)), (width-20), 19,
|
||||
&ma->subject, 0, 31, 0, 0,
|
||||
&ma->subject, 0, MAX_NAME, 0, 0,
|
||||
"Optional message subject. This is what can be filtered on");
|
||||
|
||||
/* line 3: Text/Property */
|
||||
@ -2809,14 +2809,14 @@ static short draw_actuatorbuttons(Main *bmain, Object *ob, bActuator *act, uiBlo
|
||||
/* line 3: Message Body */
|
||||
uiDefBut(block, TEX, 1, "Body: ",
|
||||
(xco+10+(0.20*(width-20))),(yco-(myline++*24)),(0.8*(width-20)),19,
|
||||
&ma->body, 0, 31, 0, 0,
|
||||
&ma->body, 0, MAX_NAME, 0, 0,
|
||||
"Optional message body Text");
|
||||
} else
|
||||
{
|
||||
/* line 3: Property body (set by property) */
|
||||
uiDefBut(block, TEX, 1, "Propname: ",
|
||||
(xco+10+(0.20*(width-20))),(yco-(myline++*24)),(0.8*(width-20)),19,
|
||||
&ma->body, 0, 31, 0, 0,
|
||||
&ma->body, 0, MAX_NAME, 0, 0,
|
||||
"The message body will be set by the Property Value");
|
||||
}
|
||||
|
||||
@ -2923,12 +2923,12 @@ static short draw_actuatorbuttons(Main *bmain, Object *ob, bActuator *act, uiBlo
|
||||
uiBlockBeginAlign(block);
|
||||
but = uiDefBut(block, TEX, 1, "Bone: ",
|
||||
(xco+5), (yco-44), (width-10)/2, 19,
|
||||
armAct->posechannel, 0, 31, 0, 0,
|
||||
armAct->posechannel, 0, MAX_NAME, 0, 0,
|
||||
"Bone on which the constraint is defined");
|
||||
uiButSetFunc(but, check_armature_actuator, but, armAct);
|
||||
but = uiDefBut(block, TEX, 1, "Cons: ",
|
||||
(xco+5)+(width-10)/2, (yco-44), (width-10)/2, 19,
|
||||
armAct->constraint, 0, 31, 0, 0,
|
||||
armAct->constraint, 0, MAX_NAME, 0, 0,
|
||||
"Name of the constraint you want to control");
|
||||
uiButSetFunc(but, check_armature_actuator, but, armAct);
|
||||
uiBlockEndAlign(block);
|
||||
@ -2999,7 +2999,7 @@ static uiBlock *sensor_menu(bContext *C, ARegion *ar, void *UNUSED(arg))
|
||||
uiBlock *block;
|
||||
int yco=0;
|
||||
|
||||
block= uiBeginBlock(C, ar, "filemenu", UI_EMBOSSP);
|
||||
block= uiBeginBlock(C, ar, __func__, UI_EMBOSSP);
|
||||
uiBlockSetButmFunc(block, do_sensor_menu, NULL);
|
||||
|
||||
uiDefBut(block, BUTM, 1, "Show Objects", 0, (short)(yco-=20), 160, 19, NULL, 0.0, 0.0, 1, 0, "");
|
||||
@ -3048,7 +3048,7 @@ static uiBlock *controller_menu(bContext *C, ARegion *ar, void *UNUSED(arg))
|
||||
uiBlock *block;
|
||||
int yco=0;
|
||||
|
||||
block= uiBeginBlock(C, ar, "filemenu", UI_EMBOSSP);
|
||||
block= uiBeginBlock(C, ar, __func__, UI_EMBOSSP);
|
||||
uiBlockSetButmFunc(block, do_controller_menu, NULL);
|
||||
|
||||
uiDefBut(block, BUTM, 1, "Show Objects", 0, (short)(yco-=20), 160, 19, NULL, 0.0, 0.0, 1, 0, "");
|
||||
@ -3097,7 +3097,7 @@ static uiBlock *actuator_menu(bContext *C, ARegion *ar, void *UNUSED(arg))
|
||||
uiBlock *block;
|
||||
int xco=0;
|
||||
|
||||
block= uiBeginBlock(C, ar, "filemenu", UI_EMBOSSP);
|
||||
block= uiBeginBlock(C, ar, __func__, UI_EMBOSSP);
|
||||
uiBlockSetButmFunc(block, do_actuator_menu, NULL);
|
||||
|
||||
uiDefBut(block, BUTM, 1, "Show Objects", 0, (short)(xco-=20), 160, 19, NULL, 0.0, 0.0, 1, 0, "");
|
||||
@ -3143,7 +3143,7 @@ static uiBlock *controller_state_mask_menu(bContext *C, ARegion *ar, void *arg_c
|
||||
|
||||
short yco = 12, xco = 0, stbit, offset;
|
||||
|
||||
block= uiBeginBlock(C, ar, "Controller state mask", UI_EMBOSS);
|
||||
block= uiBeginBlock(C, ar, __func__, UI_EMBOSS);
|
||||
|
||||
/* use this for a fake extra empy space around the buttons */
|
||||
uiDefBut(block, LABEL, 0, "", -5, -5, 200, 34, NULL, 0, 0, 0, 0, "");
|
||||
@ -3191,7 +3191,7 @@ static uiBlock *object_state_mask_menu(bContext *C, ARegion *ar, void *arg_obj)
|
||||
uiBlock *block;
|
||||
short xco = 0;
|
||||
|
||||
block= uiBeginBlock(C, ar, "obstatemenu", UI_EMBOSSP);
|
||||
block= uiBeginBlock(C, ar, __func__, UI_EMBOSSP);
|
||||
uiBlockSetButmFunc(block, do_object_state_menu, arg_obj);
|
||||
|
||||
uiDefBut(block, BUTM, 1, "Set all bits", 0, (short)(xco-=20), 160, 19, NULL, 0.0, 0.0, 1, 0, "");
|
||||
@ -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);
|
||||
@ -4488,7 +4488,7 @@ static void logic_buttons_new(bContext *C, ARegion *ar)
|
||||
uiLayout *layout, *row, *box;
|
||||
uiBlock *block;
|
||||
uiBut *but;
|
||||
char name[32];
|
||||
char uiblockstr[32];
|
||||
short a, count;
|
||||
int xco, yco, width;
|
||||
|
||||
@ -4497,8 +4497,8 @@ 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(name, "buttonswin %p", (void *)ar);
|
||||
block= uiBeginBlock(C, ar, name, UI_EMBOSS);
|
||||
BLI_snprintf(uiblockstr, sizeof(uiblockstr), "buttonswin %p", (void *)ar);
|
||||
block= uiBeginBlock(C, ar, uiblockstr, UI_EMBOSS);
|
||||
uiBlockSetHandleFunc(block, do_logic_buts, NULL);
|
||||
|
||||
/* loop over all objects and set visible/linked flags for the logic bricks */
|
||||
@ -4802,7 +4802,7 @@ void logic_buttons(bContext *C, ARegion *ar)
|
||||
int a, iact, stbit, offset;
|
||||
int xco, yco, width, ycoo;
|
||||
short count;
|
||||
char name[32];
|
||||
char numstr[32];
|
||||
/* pin is a bool used for actuator and sensor drawing with states
|
||||
* pin so changing states dosnt hide the logic brick */
|
||||
char pin;
|
||||
@ -4815,8 +4815,8 @@ void logic_buttons(bContext *C, ARegion *ar)
|
||||
if(ob==NULL) return;
|
||||
// uiSetButLock(object_is_libdata(ob), ERROR_LIBDATA_MESSAGE);
|
||||
|
||||
sprintf(name, "buttonswin %p", (void *)ar);
|
||||
block= uiBeginBlock(C, ar, name, UI_EMBOSS);
|
||||
BLI_snprintf(numstr, sizeof(numstr), "buttonswin %p", (void *)ar);
|
||||
block= uiBeginBlock(C, ar, numstr, UI_EMBOSS);
|
||||
uiBlockSetHandleFunc(block, do_logic_buts, NULL);
|
||||
|
||||
RNA_pointer_create(NULL, &RNA_SpaceLogicEditor, slogic, &logic_ptr);
|
||||
@ -4932,13 +4932,13 @@ void logic_buttons(bContext *C, ARegion *ar)
|
||||
uiDefIconButBitS(block, ICONTOG, CONT_SHOW, B_REDR, ICON_RIGHTARROW, (short)(xco+width-22), yco, 22, UI_UNIT_Y, &cont->flag, 0, 0, 0, 0, "Controller settings");
|
||||
uiDefIconButBitS(block, TOG, CONT_PRIO, B_REDR, ICON_BOOKMARKS, (short)(xco+width-66), yco, 22, UI_UNIT_Y, &cont->flag, 0, 0, 0, 0, "Mark controller for execution before all non-marked controllers (good for startup scripts)");
|
||||
|
||||
sprintf(name, "%d", first_bit(cont->state_mask)+1);
|
||||
uiDefBlockBut(block, controller_state_mask_menu, cont, name, (short)(xco+width-44), yco, 22, UI_UNIT_Y, "Set controller state index (from 1 to 30)");
|
||||
sprintf(numstr, "%d", first_bit(cont->state_mask)+1);
|
||||
uiDefBlockBut(block, controller_state_mask_menu, cont, numstr, (short)(xco+width-44), yco, 22, UI_UNIT_Y, "Set controller state index (from 1 to 30)");
|
||||
|
||||
if(cont->flag & CONT_SHOW) {
|
||||
cont->otype= cont->type;
|
||||
uiDefButS(block, MENU, B_CHANGE_CONT, controller_pup(),(short)(xco+22), yco, 70, UI_UNIT_Y, &cont->type, 0, 0, 0, 0, "Controller type");
|
||||
but= uiDefBut(block, TEX, 1, "", (short)(xco+92), yco, (short)(width-158), UI_UNIT_Y, cont->name, 0, 31, 0, 0, "Controller name");
|
||||
but= uiDefBut(block, TEX, 1, "", (short)(xco+92), yco, (short)(width-158), UI_UNIT_Y, cont->name, 0, MAX_NAME, 0, 0, "Controller name");
|
||||
uiButSetFunc(but, make_unique_prop_names_cb, cont->name, (void*) 0);
|
||||
|
||||
ycoo= yco;
|
||||
@ -5030,7 +5030,7 @@ void logic_buttons(bContext *C, ARegion *ar)
|
||||
if(sens->flag & SENS_SHOW)
|
||||
{
|
||||
uiDefButS(block, MENU, B_CHANGE_SENS, sensor_pup(), (short)(xco+22), yco, 80, UI_UNIT_Y, &sens->type, 0, 0, 0, 0, "Sensor type");
|
||||
but= uiDefBut(block, TEX, 1, "", (short)(xco+102), yco, (short)(width-(pin?146:124)), UI_UNIT_Y, sens->name, 0, 31, 0, 0, "Sensor name");
|
||||
but= uiDefBut(block, TEX, 1, "", (short)(xco+102), yco, (short)(width-(pin?146:124)), UI_UNIT_Y, sens->name, 0, MAX_NAME, 0, 0, "Sensor name");
|
||||
uiButSetFunc(but, make_unique_prop_names_cb, sens->name, (void*) 0);
|
||||
|
||||
sens->otype= sens->type;
|
||||
@ -5042,7 +5042,7 @@ void logic_buttons(bContext *C, ARegion *ar)
|
||||
glRecti(xco+22, yco, xco+width-22,yco+19);
|
||||
but= uiDefBut(block, LABEL, 0, sensor_name(sens->type), (short)(xco+22), yco, 80, UI_UNIT_Y, sens, 0, 0, 0, 0, "");
|
||||
//uiButSetFunc(but, old_sca_move_sensor, sens, NULL);
|
||||
but= uiDefBut(block, LABEL, 0, sens->name, (short)(xco+102), yco, (short)(width-(pin?146:124)), UI_UNIT_Y, sens, 0, 31, 0, 0, "");
|
||||
but= uiDefBut(block, LABEL, 0, sens->name, (short)(xco+102), yco, (short)(width-(pin?146:124)), UI_UNIT_Y, sens, 0, MAX_NAME, 0, 0, "");
|
||||
//uiButSetFunc(but, old_sca_move_sensor, sens, NULL);
|
||||
|
||||
uiBlockBeginAlign(block);
|
||||
@ -5108,7 +5108,7 @@ void logic_buttons(bContext *C, ARegion *ar)
|
||||
if(act->flag & ACT_SHOW) {
|
||||
act->otype= act->type;
|
||||
uiDefButS(block, MENU, B_CHANGE_ACT, actuator_pup(ob), (short)(xco+22), yco, 90, UI_UNIT_Y, &act->type, 0, 0, 0, 0, "Actuator type");
|
||||
but= uiDefBut(block, TEX, 1, "", (short)(xco+112), yco, (short)(width-(pin?156:134)), UI_UNIT_Y, act->name, 0, 31, 0, 0, "Actuator name");
|
||||
but= uiDefBut(block, TEX, 1, "", (short)(xco+112), yco, (short)(width-(pin?156:134)), UI_UNIT_Y, act->name, 0, MAX_NAME, 0, 0, "Actuator name");
|
||||
uiButSetFunc(but, make_unique_prop_names_cb, act->name, (void*) 0);
|
||||
|
||||
ycoo= yco;
|
||||
|
@ -514,7 +514,7 @@ static void nla_draw_strip_frames_text(NlaTrack *UNUSED(nlt), NlaStrip *strip, V
|
||||
{
|
||||
const float ytol = 1.0f; /* small offset to vertical positioning of text, for legibility */
|
||||
const char col[4] = {220, 220, 220, 255}; /* light grey */
|
||||
char str[32] = "";
|
||||
char numstr[32] = "";
|
||||
|
||||
|
||||
/* Always draw times above the strip, whereas sequencer drew below + above.
|
||||
@ -524,12 +524,12 @@ static void nla_draw_strip_frames_text(NlaTrack *UNUSED(nlt), NlaStrip *strip, V
|
||||
* while also preserving some accuracy, since we do use floats
|
||||
*/
|
||||
/* start frame */
|
||||
BLI_snprintf(str, sizeof(str), "%.1f", strip->start);
|
||||
UI_view2d_text_cache_add(v2d, strip->start-1.0f, ymaxc+ytol, str, col);
|
||||
BLI_snprintf(numstr, sizeof(numstr), "%.1f", strip->start);
|
||||
UI_view2d_text_cache_add(v2d, strip->start-1.0f, ymaxc+ytol, numstr, col);
|
||||
|
||||
/* end frame */
|
||||
BLI_snprintf(str, sizeof(str), "%.1f", strip->end);
|
||||
UI_view2d_text_cache_add(v2d, strip->end, ymaxc+ytol, str, col);
|
||||
BLI_snprintf(numstr, sizeof(numstr), "%.1f", strip->end);
|
||||
UI_view2d_text_cache_add(v2d, strip->end, ymaxc+ytol, numstr, col);
|
||||
}
|
||||
|
||||
/* ---------------------- */
|
||||
@ -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;
|
||||
@ -958,7 +958,7 @@ void draw_nla_channel_list (bContext *C, bAnimContext *ac, ARegion *ar)
|
||||
draw_nla_channel_list_gl(ac, &anim_data, v2d, y);
|
||||
}
|
||||
{ /* second pass: UI widgets */
|
||||
uiBlock *block= uiBeginBlock(C, ar, "NLA channel buttons", UI_EMBOSS);
|
||||
uiBlock *block= uiBeginBlock(C, ar, __func__, UI_EMBOSS);
|
||||
size_t channel_index = 0;
|
||||
|
||||
y= (float)(-NLACHANNEL_HEIGHT(snla));
|
||||
|
@ -132,7 +132,7 @@ static uiBlock *socket_component_menu(bContext *C, ARegion *ar, void *args_v)
|
||||
uiBlock *block;
|
||||
uiLayout *layout;
|
||||
|
||||
block= uiBeginBlock(C, ar, "socket menu", UI_EMBOSS);
|
||||
block= uiBeginBlock(C, ar, __func__, UI_EMBOSS);
|
||||
uiBlockSetFlag(block, UI_BLOCK_KEEP_OPEN);
|
||||
|
||||
layout= uiLayoutColumn(uiBlockLayout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, args->x, args->y+2, args->width, NODE_DY, UI_GetStyle()), 0);
|
||||
@ -631,7 +631,7 @@ static void draw_group_socket_name(SpaceNode *snode, bNode *gnode, bNodeSocket *
|
||||
if (sock->flag & SOCK_DYNAMIC) {
|
||||
bt = uiDefBut(gnode->block, TEX, 0, "",
|
||||
sock->locx+xoffset, sock->locy+1+yoffset, 72, NODE_DY,
|
||||
sock->name, 0, 31, 0, 0, "");
|
||||
sock->name, 0, sizeof(sock->name), 0, 0, "");
|
||||
if (in_out==SOCK_IN)
|
||||
uiButSetFunc(bt, update_group_input_cb, snode, ngroup);
|
||||
else
|
||||
@ -640,7 +640,7 @@ static void draw_group_socket_name(SpaceNode *snode, bNode *gnode, bNodeSocket *
|
||||
else {
|
||||
uiDefBut(gnode->block, LABEL, 0, sock->name,
|
||||
sock->locx+xoffset, sock->locy+1+yoffset, 72, NODE_DY,
|
||||
NULL, 0, 31, 0, 0, "");
|
||||
NULL, 0, sizeof(sock->name), 0, 0, "");
|
||||
}
|
||||
}
|
||||
|
||||
@ -1203,10 +1203,10 @@ static void node_composit_buts_image(uiLayout *layout, bContext *C, PointerRNA *
|
||||
/* don't use iuser->framenr directly because it may not be updated if auto-refresh is off */
|
||||
Scene *scene= CTX_data_scene(C);
|
||||
ImageUser *iuser= node->storage;
|
||||
char tstr[32];
|
||||
char numstr[32];
|
||||
const int framenr= BKE_image_user_get_frame(iuser, CFRA, 0);
|
||||
BLI_snprintf(tstr, sizeof(tstr), "Frame: %d", framenr);
|
||||
uiItemL(layout, tstr, ICON_NONE);
|
||||
BLI_snprintf(numstr, sizeof(numstr), "Frame: %d", framenr);
|
||||
uiItemL(layout, numstr, ICON_NONE);
|
||||
}
|
||||
|
||||
if (ELEM(source, IMA_SRC_SEQUENCE, IMA_SRC_MOVIE)) {
|
||||
@ -2308,7 +2308,7 @@ void draw_nodespace_color_info(ARegion *ar, int color_manage, int channels, int
|
||||
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));
|
||||
@ -2317,14 +2317,14 @@ void draw_nodespace_color_info(ARegion *ar, int color_manage, int channels, int
|
||||
#if 0 /* XXX no Z value in compo backdrop atm */
|
||||
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);
|
||||
@ -2334,33 +2334,33 @@ void draw_nodespace_color_info(ARegion *ar, int color_manage, int channels, int
|
||||
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);
|
||||
@ -2368,11 +2368,11 @@ void draw_nodespace_color_info(ARegion *ar, int color_manage, int channels, int
|
||||
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);
|
||||
@ -2440,12 +2440,12 @@ void draw_nodespace_color_info(ARegion *ar, int color_manage, int channels, int
|
||||
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);
|
||||
@ -2460,22 +2460,22 @@ void draw_nodespace_color_info(ARegion *ar, int color_manage, int channels, int
|
||||
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);
|
||||
|
@ -195,18 +195,18 @@ static void node_scaling_widget(int color_id, float aspect, float xmin, float ym
|
||||
static void node_uiblocks_init(const bContext *C, bNodeTree *ntree)
|
||||
{
|
||||
bNode *node;
|
||||
char str[32];
|
||||
char uiblockstr[32];
|
||||
|
||||
/* add node uiBlocks in drawing order - prevents events going to overlapping nodes */
|
||||
|
||||
for(node= ntree->nodes.first; node; node=node->next) {
|
||||
/* ui block */
|
||||
sprintf(str, "node buttons %p", (void *)node);
|
||||
node->block= uiBeginBlock(C, CTX_wm_region(C), str, UI_EMBOSS);
|
||||
uiBlockSetHandleFunc(node->block, do_node_internal_buttons, node);
|
||||
|
||||
/* this cancels events for background nodes */
|
||||
uiBlockSetFlag(node->block, UI_BLOCK_CLIP_EVENTS);
|
||||
for (node= ntree->nodes.first; node; node= node->next) {
|
||||
/* ui block */
|
||||
BLI_snprintf(uiblockstr, sizeof(uiblockstr), "node buttons %p", (void *)node);
|
||||
node->block= uiBeginBlock(C, CTX_wm_region(C), uiblockstr, UI_EMBOSS);
|
||||
uiBlockSetHandleFunc(node->block, do_node_internal_buttons, node);
|
||||
|
||||
/* this cancels events for background nodes */
|
||||
uiBlockSetFlag(node->block, UI_BLOCK_CLIP_EVENTS);
|
||||
}
|
||||
}
|
||||
|
||||
@ -673,7 +673,7 @@ static void node_draw_basis(const bContext *C, ARegion *ar, SpaceNode *snode, bN
|
||||
BLI_strncpy(showname, nodeLabel(node), sizeof(showname));
|
||||
|
||||
//if(node->flag & NODE_MUTED)
|
||||
// sprintf(showname, "[%s]", showname);
|
||||
// BLI_snprintf(showname, sizeof(showname), "[%s]", showname); // XXX - dont print into self!
|
||||
|
||||
uiDefBut(node->block, LABEL, 0, showname, (short)(rct->xmin+15), (short)(rct->ymax-NODE_DY),
|
||||
(int)(iconofs - rct->xmin-18.0f), NODE_DY, NULL, 0, 0, 0, 0, "");
|
||||
@ -835,7 +835,7 @@ static void node_draw_hidden(const bContext *C, ARegion *ar, SpaceNode *snode, b
|
||||
BLI_strncpy(showname, nodeLabel(node), sizeof(showname));
|
||||
|
||||
//if(node->flag & NODE_MUTED)
|
||||
// sprintf(showname, "[%s]", showname);
|
||||
// BLI_snprintf(showname, sizeof(showname), "[%s]", showname); // XXX - dont print into self!
|
||||
|
||||
uiDefBut(node->block, LABEL, 0, showname, (short)(rct->xmin+15), (short)(centy-10),
|
||||
(int)(rct->xmax - rct->xmin-18.0f -12.0f), NODE_DY, NULL, 0, 0, 0, 0, "");
|
||||
|
@ -751,7 +751,7 @@ static int edit_node_poll(bContext *C)
|
||||
static void edit_node_properties(wmOperatorType *ot)
|
||||
{
|
||||
/* XXX could node be a context pointer? */
|
||||
RNA_def_string(ot->srna, "node", "", 32, "Node", "");
|
||||
RNA_def_string(ot->srna, "node", "", MAX_NAME, "Node", "");
|
||||
RNA_def_int(ot->srna, "socket", 0, 0, MAX_SOCKET, "Socket", "", 0, MAX_SOCKET);
|
||||
RNA_def_enum(ot->srna, "in_out", socket_in_out_items, SOCK_IN, "Socket Side", "");
|
||||
}
|
||||
@ -779,7 +779,7 @@ static void edit_node_properties_get(wmOperator *op, bNodeTree *ntree, bNode **r
|
||||
{
|
||||
bNode *node;
|
||||
bNodeSocket *sock=NULL;
|
||||
char nodename[32];
|
||||
char nodename[MAX_NAME];
|
||||
int sockindex;
|
||||
int in_out;
|
||||
|
||||
@ -889,7 +889,7 @@ static int node_group_socket_add_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
SpaceNode *snode = CTX_wm_space_node(C);
|
||||
int in_out= -1;
|
||||
char name[32]= "";
|
||||
char name[MAX_NAME]= "";
|
||||
int type= SOCK_FLOAT;
|
||||
bNodeTree *ngroup= snode->edittree;
|
||||
/* bNodeSocket *sock; */ /* UNUSED */
|
||||
@ -932,7 +932,7 @@ void NODE_OT_group_socket_add(wmOperatorType *ot)
|
||||
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
|
||||
|
||||
RNA_def_enum(ot->srna, "in_out", socket_in_out_items, SOCK_IN, "Socket Type", "Input or Output");
|
||||
RNA_def_string(ot->srna, "name", "", 32, "Name", "Group socket name");
|
||||
RNA_def_string(ot->srna, "name", "", MAX_NAME, "Name", "Group socket name");
|
||||
RNA_def_enum(ot->srna, "type", node_socket_type_items, SOCK_FLOAT, "Type", "Type of the group socket");
|
||||
}
|
||||
|
||||
@ -3451,7 +3451,7 @@ static int node_add_file_exec(bContext *C, wmOperator *op)
|
||||
}
|
||||
else if(RNA_property_is_set(op->ptr, "name"))
|
||||
{
|
||||
char name[32];
|
||||
char name[MAX_ID_NAME-2];
|
||||
RNA_string_get(op->ptr, "name", name);
|
||||
ima= (Image *)find_id("IM", name);
|
||||
|
||||
@ -3517,7 +3517,7 @@ void NODE_OT_add_file(wmOperatorType *ot)
|
||||
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
|
||||
|
||||
WM_operator_properties_filesel(ot, FOLDERFILE|IMAGEFILE, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_FILEPATH); //XXX TODO, relative_path
|
||||
RNA_def_string(ot->srna, "name", "Image", 24, "Name", "Datablock name to assign");
|
||||
RNA_def_string(ot->srna, "name", "Image", MAX_ID_NAME-2, "Name", "Datablock name to assign");
|
||||
}
|
||||
|
||||
/********************** New node tree operator *********************/
|
||||
|
@ -1649,7 +1649,7 @@ void draw_outliner(const bContext *C)
|
||||
|
||||
/* draw outliner stuff (background, hierachy lines and names) */
|
||||
outliner_back(ar);
|
||||
block= uiBeginBlock(C, ar, "outliner buttons", UI_EMBOSS);
|
||||
block= uiBeginBlock(C, ar, __func__, UI_EMBOSS);
|
||||
outliner_draw_tree((bContext *)C, block, scene, ar, soops);
|
||||
|
||||
if(ELEM(soops->outlinevis, SO_DATABLOCKS, SO_USERDEF)) {
|
||||
|
@ -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 */
|
||||
|
@ -1342,7 +1342,7 @@ static int outliner_filter_has_name(TreeElement *te, const char *name, int flags
|
||||
}
|
||||
else {
|
||||
char fn_name[sizeof(((struct SpaceOops *)NULL)->search_string) + 2];
|
||||
sprintf(fn_name, "*%s*", name);
|
||||
BLI_snprintf(fn_name, sizeof(fn_name), "*%s*", name);
|
||||
found= fnmatch(fn_name, te->name, fn_flag)==0;
|
||||
}
|
||||
return found;
|
||||
|
@ -328,7 +328,7 @@ static void draw_seq_handle(View2D *v2d, Sequence *seq, float pixelx, short dire
|
||||
float x1, x2, y1, y2;
|
||||
float handsize;
|
||||
float minhandle, maxhandle;
|
||||
char str[32];
|
||||
char numstr[32];
|
||||
unsigned int whichsel=0;
|
||||
|
||||
x1= seq->startdisp;
|
||||
@ -392,15 +392,15 @@ static void draw_seq_handle(View2D *v2d, Sequence *seq, float pixelx, short dire
|
||||
if(G.moving || (seq->flag & whichsel)) {
|
||||
const char col[4]= {255, 255, 255, 255};
|
||||
if (direction == SEQ_LEFTHANDLE) {
|
||||
sprintf(str, "%d", seq->startdisp);
|
||||
BLI_snprintf(numstr, sizeof(numstr),"%d", seq->startdisp);
|
||||
x1= rx1;
|
||||
y1 -= 0.45f;
|
||||
} else {
|
||||
sprintf(str, "%d", seq->enddisp - 1);
|
||||
BLI_snprintf(numstr, sizeof(numstr), "%d", seq->enddisp - 1);
|
||||
x1= x2 - handsize*0.75f;
|
||||
y1= y2 + 0.05f;
|
||||
}
|
||||
UI_view2d_text_cache_add(v2d, x1, y1, str, col);
|
||||
UI_view2d_text_cache_add(v2d, x1, y1, numstr, col);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
@ -1766,7 +1766,7 @@ void draw_text_main(SpaceText *st, ARegion *ar)
|
||||
else
|
||||
UI_ThemeColor(TH_TEXT);
|
||||
|
||||
sprintf(linenr, "%*d", st->linenrs_tot, i + linecount + 1);
|
||||
BLI_snprintf(linenr, sizeof(linenr), "%*d", st->linenrs_tot, i + linecount + 1);
|
||||
/* itoa(i + linecount + 1, linenr, 10); */ /* not ansi-c :/ */
|
||||
text_font_draw(st, TXT_OFFSET - 7, y, linenr);
|
||||
|
||||
|
@ -218,23 +218,23 @@ void draw_motion_path_instance(Scene *scene,
|
||||
col[3]= 255;
|
||||
|
||||
for (i=0, mpv=mpv_start; i < len; i+=stepsize, mpv+=stepsize) {
|
||||
char str[32];
|
||||
char numstr[32];
|
||||
float co[3];
|
||||
|
||||
/* only draw framenum if several consecutive highlighted points don't occur on same point */
|
||||
if (i == 0) {
|
||||
sprintf(str, "%d", (i+sfra));
|
||||
sprintf(numstr, "%d", (i+sfra));
|
||||
mul_v3_m4v3(co, ob->imat, mpv->co);
|
||||
view3d_cached_text_draw_add(co, str, 0, V3D_CACHE_TEXT_WORLDSPACE|V3D_CACHE_TEXT_ASCII, col);
|
||||
view3d_cached_text_draw_add(co, numstr, 0, V3D_CACHE_TEXT_WORLDSPACE|V3D_CACHE_TEXT_ASCII, col);
|
||||
}
|
||||
else if ((i > stepsize) && (i < len-stepsize)) {
|
||||
bMotionPathVert *mpvP = (mpv - stepsize);
|
||||
bMotionPathVert *mpvN = (mpv + stepsize);
|
||||
|
||||
if ((equals_v3v3(mpv->co, mpvP->co)==0) || (equals_v3v3(mpv->co, mpvN->co)==0)) {
|
||||
sprintf(str, "%d", (sfra+i));
|
||||
sprintf(numstr, "%d", (sfra+i));
|
||||
mul_v3_m4v3(co, ob->imat, mpv->co);
|
||||
view3d_cached_text_draw_add(co, str, 0, V3D_CACHE_TEXT_WORLDSPACE|V3D_CACHE_TEXT_ASCII, col);
|
||||
view3d_cached_text_draw_add(co, numstr, 0, V3D_CACHE_TEXT_WORLDSPACE|V3D_CACHE_TEXT_ASCII, col);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -293,11 +293,11 @@ void draw_motion_path_instance(Scene *scene,
|
||||
float mframe= (float)(sfra + i);
|
||||
|
||||
if (BLI_dlrbTree_search_exact(&keys, compare_ak_cfraPtr, &mframe)) {
|
||||
char str[32];
|
||||
char numstr[32];
|
||||
|
||||
sprintf(str, "%d", (sfra+i));
|
||||
sprintf(numstr, "%d", (sfra+i));
|
||||
mul_v3_m4v3(co, ob->imat, mpv->co);
|
||||
view3d_cached_text_draw_add(co, str, 0, V3D_CACHE_TEXT_WORLDSPACE|V3D_CACHE_TEXT_ASCII, col);
|
||||
view3d_cached_text_draw_add(co, numstr, 0, V3D_CACHE_TEXT_WORLDSPACE|V3D_CACHE_TEXT_ASCII, col);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -576,7 +576,7 @@ static int draw_em_tf_mapped__set_draw(void *userData, int index)
|
||||
}
|
||||
}
|
||||
|
||||
static int wpaint__setSolidDrawOptions(void *userData, int index, int *drawSmooth_r)
|
||||
static int wpaint__setSolidDrawOptions_material(void *userData, int index, int *drawSmooth_r)
|
||||
{
|
||||
Mesh *me = (Mesh*)userData;
|
||||
|
||||
@ -591,6 +591,16 @@ static int wpaint__setSolidDrawOptions(void *userData, int index, int *drawSmoot
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* when face select is on, use face hidden flag */
|
||||
static int wpaint__setSolidDrawOptions_facemask(void *userData, int index, int *drawSmooth_r)
|
||||
{
|
||||
Mesh *me = (Mesh*)userData;
|
||||
MFace *mface = &me->mface[index];
|
||||
if (mface->flag & ME_HIDE) return 0;
|
||||
*drawSmooth_r = 1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void draw_mesh_text(Scene *scene, Object *ob, int glsl)
|
||||
{
|
||||
Mesh *me = ob->data;
|
||||
@ -729,7 +739,7 @@ void draw_mesh_textured_old(Scene *scene, View3D *v3d, RegionView3D *rv3d, Objec
|
||||
}
|
||||
else if(draw_flags & DRAW_FACE_SELECT) {
|
||||
if(ob->mode & OB_MODE_WEIGHT_PAINT)
|
||||
dm->drawMappedFaces(dm, wpaint__setSolidDrawOptions, GPU_enable_material, NULL, me, 1);
|
||||
dm->drawMappedFaces(dm, wpaint__setSolidDrawOptions_facemask, GPU_enable_material, NULL, me, 1);
|
||||
else
|
||||
dm->drawMappedFacesTex(dm, me->mpoly ? draw_tface_mapped__set_draw : NULL, NULL, me);
|
||||
}
|
||||
@ -888,7 +898,7 @@ void draw_mesh_textured(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *o
|
||||
/* weight paint mode exception */
|
||||
int useColors= 1;
|
||||
|
||||
dm->drawMappedFaces(dm, wpaint__setSolidDrawOptions,
|
||||
dm->drawMappedFaces(dm, wpaint__setSolidDrawOptions_material,
|
||||
GPU_enable_material, NULL, ob->data, useColors);
|
||||
}
|
||||
else {
|
||||
|
@ -2719,7 +2719,7 @@ static void draw_em_measure_stats(View3D *v3d, Object *ob, BMEditMesh *em, UnitS
|
||||
{
|
||||
Mesh *me= ob->data;
|
||||
float v1[3], v2[3], v3[3], vmid[3], fvec[3];
|
||||
char val[32]; /* Stores the measurement display text here */
|
||||
char numstr[32]; /* Stores the measurement display text here */
|
||||
const char *conv_float; /* Use a float conversion matching the grid size */
|
||||
unsigned char col[4]= {0, 0, 0, 255}; /* color of the text to draw */
|
||||
float area; /* area of the face */
|
||||
@ -2760,11 +2760,11 @@ static void draw_em_measure_stats(View3D *v3d, Object *ob, BMEditMesh *em, UnitS
|
||||
mul_mat3_m4_v3(ob->obmat, v2);
|
||||
}
|
||||
if(unit->system)
|
||||
bUnit_AsString(val, sizeof(val), len_v3v3(v1, v2)*unit->scale_length, 3, unit->system, B_UNIT_LENGTH, do_split, FALSE);
|
||||
bUnit_AsString(numstr, sizeof(numstr), len_v3v3(v1, v2)*unit->scale_length, 3, unit->system, B_UNIT_LENGTH, do_split, FALSE);
|
||||
else
|
||||
sprintf(val, conv_float, len_v3v3(v1, v2));
|
||||
sprintf(numstr, conv_float, len_v3v3(v1, v2));
|
||||
|
||||
view3d_cached_text_draw_add(vmid, val, 0, V3D_CACHE_TEXT_ASCII, col);
|
||||
view3d_cached_text_draw_add(vmid, numstr, 0, V3D_CACHE_TEXT_ASCII, col);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2775,15 +2775,15 @@ static void draw_em_measure_stats(View3D *v3d, Object *ob, BMEditMesh *em, UnitS
|
||||
BMFace *f;
|
||||
int n;
|
||||
|
||||
#define DRAW_EM_MEASURE_STATS_FACEAREA()\
|
||||
if (BM_TestHFlag(f, BM_SELECT)) {\
|
||||
mul_v3_fl(vmid, 1.0/n);\
|
||||
if(unit->system)\
|
||||
bUnit_AsString(val, sizeof(val), area*unit->scale_length,\
|
||||
3, unit->system, B_UNIT_LENGTH, do_split, FALSE);\
|
||||
else\
|
||||
sprintf(val, conv_float, area);\
|
||||
view3d_cached_text_draw_add(vmid, val, 0, V3D_CACHE_TEXT_ASCII, col);\
|
||||
#define DRAW_EM_MEASURE_STATS_FACEAREA() \
|
||||
if (BM_TestHFlag(f, BM_SELECT)) { \
|
||||
mul_v3_fl(vmid, 1.0/n); \
|
||||
if(unit->system) \
|
||||
bUnit_AsString(numstr, sizeof(numstr), area*unit->scale_length, \
|
||||
3, unit->system, B_UNIT_LENGTH, do_split, FALSE); \
|
||||
else \
|
||||
BLI_snprintf(numstr, sizeof(numstr), conv_float, area); \
|
||||
view3d_cached_text_draw_add(vmid, numstr, 0, V3D_CACHE_TEXT_ASCII, col); \
|
||||
}
|
||||
|
||||
UI_GetThemeColor3ubv(TH_DRAWEXTRA_FACEAREA, col);
|
||||
@ -2851,11 +2851,12 @@ static void draw_em_measure_stats(View3D *v3d, Object *ob, BMEditMesh *em, UnitS
|
||||
mul_mat3_m4_v3(ob->obmat, v3);
|
||||
}
|
||||
|
||||
if(BM_TestHFlag(efa, BM_SELECT) ||
|
||||
(do_moving && BM_TestHFlag(loop->v, BM_SELECT))){
|
||||
sprintf(val,"%.3g", RAD2DEGF(angle_v3v3v3(v1, v2, v3)));
|
||||
if ( (BM_TestHFlag(efa, BM_SELECT)) ||
|
||||
(do_moving && BM_TestHFlag(loop->v, BM_SELECT)))
|
||||
{
|
||||
BLI_snprintf(numstr, sizeof(numstr), "%.3g", RAD2DEGF(angle_v3v3v3(v1, v2, v3)));
|
||||
interp_v3_v3v3(fvec, vmid, v2, 0.8f);
|
||||
view3d_cached_text_draw_add(fvec, val, 0, V3D_CACHE_TEXT_ASCII, col);
|
||||
view3d_cached_text_draw_add(fvec, numstr, 0, V3D_CACHE_TEXT_ASCII, col);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2868,7 +2869,7 @@ static void draw_em_indices(BMEditMesh *em)
|
||||
BMFace *f;
|
||||
BMVert *v;
|
||||
int i;
|
||||
char val[32];
|
||||
char numstr[32];
|
||||
float pos[3];
|
||||
unsigned char col[4];
|
||||
|
||||
@ -2881,8 +2882,8 @@ static void draw_em_indices(BMEditMesh *em)
|
||||
UI_GetThemeColor3ubv(TH_DRAWEXTRA_FACEANG, col);
|
||||
BM_ITER(v, &iter, bm, BM_VERTS_OF_MESH, NULL) {
|
||||
if (BM_TestHFlag(v, BM_SELECT)) {
|
||||
sprintf(val, "%d", i);
|
||||
view3d_cached_text_draw_add(v->co, val, 0, V3D_CACHE_TEXT_ASCII, col);
|
||||
sprintf(numstr, "%d", i);
|
||||
view3d_cached_text_draw_add(v->co, numstr, 0, V3D_CACHE_TEXT_ASCII, col);
|
||||
}
|
||||
i++;
|
||||
}
|
||||
@ -2893,9 +2894,9 @@ static void draw_em_indices(BMEditMesh *em)
|
||||
UI_GetThemeColor3ubv(TH_DRAWEXTRA_EDGELEN, col);
|
||||
BM_ITER(e, &iter, bm, BM_EDGES_OF_MESH, NULL) {
|
||||
if (BM_TestHFlag(e, BM_SELECT)) {
|
||||
sprintf(val, "%d", i);
|
||||
sprintf(numstr, "%d", i);
|
||||
mid_v3_v3v3(pos, e->v1->co, e->v2->co);
|
||||
view3d_cached_text_draw_add(pos, val, 0, V3D_CACHE_TEXT_ASCII, col);
|
||||
view3d_cached_text_draw_add(pos, numstr, 0, V3D_CACHE_TEXT_ASCII, col);
|
||||
}
|
||||
i++;
|
||||
}
|
||||
@ -2907,8 +2908,8 @@ static void draw_em_indices(BMEditMesh *em)
|
||||
BM_ITER(f, &iter, bm, BM_FACES_OF_MESH, NULL) {
|
||||
if (BM_TestHFlag(f, BM_SELECT)) {
|
||||
BM_Compute_Face_CenterMean(bm, f, pos);
|
||||
sprintf(val, "%d", i);
|
||||
view3d_cached_text_draw_add(pos, val, 0, V3D_CACHE_TEXT_ASCII, col);
|
||||
sprintf(numstr, "%d", i);
|
||||
view3d_cached_text_draw_add(pos, numstr, 0, V3D_CACHE_TEXT_ASCII, col);
|
||||
}
|
||||
i++;
|
||||
}
|
||||
@ -4115,7 +4116,7 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv
|
||||
int a, totpart, totpoint=0, totve=0, drawn, draw_as, totchild=0;
|
||||
int select=ob->flag&SELECT, create_cdata=0, need_v=0;
|
||||
GLint polygonmode[2];
|
||||
char val[32];
|
||||
char numstr[32];
|
||||
unsigned char tcol[4]= {0, 0, 0, 255};
|
||||
|
||||
/* 1. */
|
||||
@ -4503,8 +4504,8 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv
|
||||
|
||||
if((part->draw & PART_DRAW_NUM || part->draw & PART_DRAW_HEALTH) && (v3d->flag2 & V3D_RENDER_OVERRIDE)==0){
|
||||
float vec_txt[3];
|
||||
char *val_pos= val;
|
||||
val[0]= '\0';
|
||||
char *val_pos= numstr;
|
||||
numstr[0]= '\0';
|
||||
|
||||
if(part->draw&PART_DRAW_NUM) {
|
||||
if(a < totpart && (part->draw & PART_DRAW_HEALTH) && (part->phystype==PART_PHYS_BOIDS)) {
|
||||
@ -4523,7 +4524,7 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv
|
||||
/* in path drawing state.co is the end point */
|
||||
/* use worldspace beause object matrix is already applied */
|
||||
mul_v3_m4v3(vec_txt, ob->imat, state.co);
|
||||
view3d_cached_text_draw_add(vec_txt, val, 10, V3D_CACHE_TEXT_WORLDSPACE|V3D_CACHE_TEXT_ASCII, tcol);
|
||||
view3d_cached_text_draw_add(vec_txt, numstr, 10, V3D_CACHE_TEXT_WORLDSPACE|V3D_CACHE_TEXT_ASCII, tcol);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -4612,10 +4613,10 @@ 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(val, "%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, val, 10, V3D_CACHE_TEXT_WORLDSPACE|V3D_CACHE_TEXT_ASCII, tcol);
|
||||
view3d_cached_text_draw_add(vec_txt, numstr, 10, V3D_CACHE_TEXT_WORLDSPACE|V3D_CACHE_TEXT_ASCII, tcol);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1349,7 +1349,7 @@ static void view3d_panel_preview(bContext *C, ARegion *ar, short cntrl) // VIEW3
|
||||
View3D *v3d= sa->spacedata.first;
|
||||
int ofsx, ofsy;
|
||||
|
||||
block= uiBeginBlock(C, ar, "view3d_panel_preview", UI_EMBOSS);
|
||||
block= uiBeginBlock(C, ar, __func__, UI_EMBOSS);
|
||||
uiPanelControl(UI_PNL_SOLID | UI_PNL_CLOSE | UI_PNL_SCALE | cntrl);
|
||||
uiSetPanelHandler(VIEW3D_HANDLER_PREVIEW); // for close and esc
|
||||
|
||||
|
@ -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)
|
||||
@ -2890,14 +2890,15 @@ static void view3d_main_area_draw_info(const bContext *C, ARegion *ar, const cha
|
||||
draw_viewport_name(ar, v3d);
|
||||
}
|
||||
if (grid_unit) { /* draw below the viewport name */
|
||||
char tstr[32]= "";
|
||||
char numstr[32]= "";
|
||||
|
||||
UI_ThemeColor(TH_TEXT_HI);
|
||||
if(v3d->grid != 1.0f) {
|
||||
BLI_snprintf(tstr, sizeof(tstr), "%s x %.4g", grid_unit, v3d->grid);
|
||||
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, tstr[0]?tstr : grid_unit, sizeof(tstr)); /* 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));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2960,7 +2960,7 @@ static int background_image_add_invoke(bContext *C, wmOperator *op, wmEvent *UNU
|
||||
View3D *v3d= CTX_wm_view3d(C);
|
||||
Image *ima= NULL;
|
||||
BGpic *bgpic;
|
||||
char name[32];
|
||||
char name[MAX_ID_NAME-2];
|
||||
|
||||
/* check input variables */
|
||||
if(RNA_property_is_set(op->ptr, "filepath")) {
|
||||
@ -3007,7 +3007,7 @@ void VIEW3D_OT_background_image_add(wmOperatorType *ot)
|
||||
ot->flag = 0;
|
||||
|
||||
/* properties */
|
||||
RNA_def_string(ot->srna, "name", "Image", 24, "Name", "Image name to assign");
|
||||
RNA_def_string(ot->srna, "name", "Image", MAX_ID_NAME-2, "Name", "Image name to assign");
|
||||
RNA_def_string(ot->srna, "filepath", "Path", FILE_MAX, "Filepath", "Path to image file");
|
||||
}
|
||||
|
||||
|
@ -2563,9 +2563,9 @@ static void headerResize(TransInfo *t, float vec[3], char *str)
|
||||
outputNumInput(&(t->num), tvec);
|
||||
}
|
||||
else {
|
||||
sprintf(&tvec[0], "%.4f", vec[0]);
|
||||
sprintf(&tvec[20], "%.4f", vec[1]);
|
||||
sprintf(&tvec[40], "%.4f", vec[2]);
|
||||
BLI_snprintf(&tvec[0], 20, "%.4f", vec[0]);
|
||||
BLI_snprintf(&tvec[20], 20, "%.4f", vec[1]);
|
||||
BLI_snprintf(&tvec[40], 20, "%.4f", vec[2]);
|
||||
}
|
||||
|
||||
if (t->con.mode & CON_APPLY) {
|
||||
|
@ -293,7 +293,7 @@ typedef struct TransInfo {
|
||||
|
||||
char *undostr; /* if set, uses this string for undo */
|
||||
float spacemtx[3][3]; /* orientation matrix of the current space */
|
||||
char spacename[32]; /* name of the current space */
|
||||
char spacename[64]; /* name of the current space, MAX_NAME */
|
||||
|
||||
struct Object *poseobj; /* if t->flag & T_POSE, this denotes pose object */
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -268,7 +268,7 @@ static void TRANSFORM_OT_delete_orientation(struct wmOperatorType *ot)
|
||||
|
||||
static int create_orientation_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
char name[36];
|
||||
char name[MAX_NAME];
|
||||
int use = RNA_boolean_get(op->ptr, "use");
|
||||
int overwrite = RNA_boolean_get(op->ptr, "overwrite");
|
||||
|
||||
@ -301,7 +301,7 @@ static void TRANSFORM_OT_create_orientation(struct wmOperatorType *ot)
|
||||
ot->poll = ED_operator_areaactive;
|
||||
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
|
||||
|
||||
RNA_def_string(ot->srna, "name", "", 35, "Name", "Text to insert at the cursor position");
|
||||
RNA_def_string(ot->srna, "name", "", MAX_NAME, "Name", "Text to insert at the cursor position");
|
||||
RNA_def_boolean(ot->srna, "use", 0, "Use after creation", "Select orientation after its creation");
|
||||
RNA_def_boolean(ot->srna, "overwrite", 0, "Overwrite previous", "Overwrite previously created orientation with same name");
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user