Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2011-09-27 07:12:31 +0400
committerCampbell Barton <ideasman42@gmail.com>2011-09-27 07:12:31 +0400
commiteffea8c29b9862e2526f2cf64811952a2971f5d6 (patch)
tree72eb6486b146967e6533e8a18bc3735607f4ac16 /source/blender/editors
parent4d1e122d7becb573fea254474b349021e5293910 (diff)
parentf4dec97cef4b320c6f3ffd2ddc39d429da4fd4d5 (diff)
svn merge ^/trunk/blender -r40511:40587
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/animation/anim_channels_defines.c4
-rw-r--r--source/blender/editors/animation/anim_channels_edit.c2
-rw-r--r--source/blender/editors/animation/fmodifier_ui.c10
-rw-r--r--source/blender/editors/animation/keyframing.c4
-rw-r--r--source/blender/editors/armature/editarmature_retarget.c16
-rw-r--r--source/blender/editors/armature/poselib.c2
-rw-r--r--source/blender/editors/armature/reeb.c4
-rw-r--r--source/blender/editors/include/ED_anim_api.h2
-rw-r--r--source/blender/editors/include/UI_interface.h3
-rw-r--r--source/blender/editors/include/UI_interface_icons.h4
-rw-r--r--source/blender/editors/interface/CMakeLists.txt2
-rw-r--r--source/blender/editors/interface/SConscript2
-rw-r--r--source/blender/editors/interface/interface.c38
-rw-r--r--source/blender/editors/interface/interface_anim.c2
-rw-r--r--source/blender/editors/interface/interface_draw.c7
-rw-r--r--source/blender/editors/interface/interface_handlers.c16
-rw-r--r--source/blender/editors/interface/interface_intern.h6
-rw-r--r--source/blender/editors/interface/interface_layout.c6
-rw-r--r--source/blender/editors/interface/interface_panel.c2
-rw-r--r--source/blender/editors/interface/interface_regions.c43
-rw-r--r--source/blender/editors/interface/interface_style.c4
-rw-r--r--source/blender/editors/interface/interface_templates.c15
-rw-r--r--source/blender/editors/interface/interface_utils.c3
-rw-r--r--source/blender/editors/interface/interface_widgets.c6
-rw-r--r--source/blender/editors/interface/view2d_ops.c2
-rw-r--r--source/blender/editors/object/object_vgroup.c2
-rw-r--r--source/blender/editors/physics/particle_edit.c2
-rw-r--r--source/blender/editors/screen/area.c4
-rw-r--r--source/blender/editors/sculpt_paint/paint_image.c2
-rw-r--r--source/blender/editors/sculpt_paint/paint_undo.c3
-rw-r--r--source/blender/editors/space_console/space_console.c2
-rw-r--r--source/blender/editors/space_file/file_draw.c2
-rw-r--r--source/blender/editors/space_info/info_draw.c2
-rw-r--r--source/blender/editors/space_node/node_intern.h1
-rw-r--r--source/blender/editors/space_outliner/outliner_draw.c2
-rw-r--r--source/blender/editors/space_sequencer/sequencer_select.c8
-rw-r--r--source/blender/editors/space_text/text_draw.c3
-rw-r--r--source/blender/editors/space_text/text_python.c4
-rw-r--r--source/blender/editors/space_view3d/drawarmature.c76
-rw-r--r--source/blender/editors/space_view3d/drawmesh.c6
-rw-r--r--source/blender/editors/space_view3d/view3d_buttons.c1
-rw-r--r--source/blender/editors/space_view3d/view3d_fly.c150
-rw-r--r--source/blender/editors/transform/transform.c5
-rw-r--r--source/blender/editors/transform/transform.h4
-rw-r--r--source/blender/editors/transform/transform_conversions.c9
-rw-r--r--source/blender/editors/util/editmode_undo.c2
-rw-r--r--source/blender/editors/util/undo.c2
-rw-r--r--source/blender/editors/uvedit/uvedit_parametrizer.c10
48 files changed, 272 insertions, 235 deletions
diff --git a/source/blender/editors/animation/anim_channels_defines.c b/source/blender/editors/animation/anim_channels_defines.c
index 373d351fb6c..e8af5a8f290 100644
--- a/source/blender/editors/animation/anim_channels_defines.c
+++ b/source/blender/editors/animation/anim_channels_defines.c
@@ -3051,7 +3051,7 @@ static void achannel_setting_slider_shapekey_cb(bContext *C, void *key_poin, voi
/* Draw a widget for some setting */
static void draw_setting_widget (bAnimContext *ac, bAnimListElem *ale, bAnimChannelType *acf, uiBlock *block, int xpos, int ypos, int setting)
{
- short negflag, ptrsize, enabled, butType;
+ short negflag, ptrsize /* , enabled */ /* UNUSED */, butType;
int flag, icon;
void *ptr;
const char *tooltip;
@@ -3060,7 +3060,7 @@ static void draw_setting_widget (bAnimContext *ac, bAnimListElem *ale, bAnimChan
/* get the flag and the pointer to that flag */
flag= acf->setting_flag(ac, setting, &negflag);
ptr= acf->setting_ptr(ale, setting, &ptrsize);
- enabled= ANIM_channel_setting_get(ac, ale, setting);
+ /* enabled= ANIM_channel_setting_get(ac, ale, setting); */ /* UNUSED */
/* get the base icon for the setting */
switch (setting) {
diff --git a/source/blender/editors/animation/anim_channels_edit.c b/source/blender/editors/animation/anim_channels_edit.c
index d58d51c8e08..7f05a7c2b1a 100644
--- a/source/blender/editors/animation/anim_channels_edit.c
+++ b/source/blender/editors/animation/anim_channels_edit.c
@@ -366,7 +366,7 @@ void ANIM_deselect_anim_channels (bAnimContext *ac, void *data, short datatype,
/* Flush visibility (for Graph Editor) changes up/down hierarchy for changes in the given setting
* - anim_data: list of the all the anim channels that can be chosen
* -> filtered using ANIMFILTER_CHANNELS only, since if we took VISIBLE too,
- * then the channels under closed expanders get ignored...
+ * then the channels under closed expanders get ignored...
* - ale_setting: the anim channel (not in the anim_data list directly, though occuring there)
* with the new state of the setting that we want flushed up/down the hierarchy
* - setting: type of setting to set
diff --git a/source/blender/editors/animation/fmodifier_ui.c b/source/blender/editors/animation/fmodifier_ui.c
index 77c67fc4af0..d329874e1ba 100644
--- a/source/blender/editors/animation/fmodifier_ui.c
+++ b/source/blender/editors/animation/fmodifier_ui.c
@@ -112,7 +112,7 @@ static void delete_fmodifier_cb (bContext *C, void *fmods_v, void *fcm_v)
static void draw_modifier__generator(uiLayout *layout, ID *id, FModifier *fcm, short width)
{
FMod_Generator *data= (FMod_Generator *)fcm->data;
- uiLayout *col, *row;
+ uiLayout /* *col, */ /* UNUSED */ *row;
uiBlock *block;
uiBut *but;
PointerRNA ptr;
@@ -121,7 +121,7 @@ static void draw_modifier__generator(uiLayout *layout, ID *id, FModifier *fcm, s
RNA_pointer_create(id, &RNA_FModifierFunctionGenerator, fcm, &ptr);
/* basic settings (backdrop + mode selector + some padding) */
- col= uiLayoutColumn(layout, 1);
+ /* col= uiLayoutColumn(layout, 1); */ /* UNUSED */
block= uiLayoutGetBlock(layout);
uiBlockBeginAlign(block);
but= uiDefButR(block, MENU, B_FMODIFIER_REDRAW, NULL, 0, 0, width-30, UI_UNIT_Y, &ptr, "mode", -1, 0, 0, -1, -1, NULL);
@@ -521,7 +521,7 @@ static void draw_modifier__envelope(uiLayout *layout, ID *id, FModifier *fcm, sh
/* draw settings for limits modifier */
static void draw_modifier__limits(uiLayout *layout, ID *id, FModifier *fcm, short UNUSED(width))
{
- uiLayout *split, *col, *row;
+ uiLayout *split, *col /* , *row */ /* UNUSED */;
PointerRNA ptr;
/* init the RNA-pointer */
@@ -529,7 +529,7 @@ static void draw_modifier__limits(uiLayout *layout, ID *id, FModifier *fcm, shor
/* row 1: minimum */
{
- row= uiLayoutRow(layout, 0);
+ /* row= uiLayoutRow(layout, 0); */ /* UNUSED */
/* split into 2 columns */
split= uiLayoutSplit(layout, 0.5f, 0);
@@ -547,7 +547,7 @@ static void draw_modifier__limits(uiLayout *layout, ID *id, FModifier *fcm, shor
/* row 2: maximum */
{
- row= uiLayoutRow(layout, 0);
+ /* row= uiLayoutRow(layout, 0); */ /* UNUSED */
/* split into 2 columns */
split= uiLayoutSplit(layout, 0.5f, 0);
diff --git a/source/blender/editors/animation/keyframing.c b/source/blender/editors/animation/keyframing.c
index 58e1549c0ed..b52550832c3 100644
--- a/source/blender/editors/animation/keyframing.c
+++ b/source/blender/editors/animation/keyframing.c
@@ -540,8 +540,8 @@ static short visualkey_can_use (PointerRNA *ptr, PropertyRNA *prop)
/* get first constraint and determine type of keyframe constraints to check for
* - constraints can be on either Objects or PoseChannels, so we only check if the
- * ptr->type is RNA_Object or RNA_PoseBone, which are the RNA wrapping-info for
- * those structs, allowing us to identify the owner of the data
+ * ptr->type is RNA_Object or RNA_PoseBone, which are the RNA wrapping-info for
+ * those structs, allowing us to identify the owner of the data
*/
if (ptr->type == &RNA_Object) {
/* Object */
diff --git a/source/blender/editors/armature/editarmature_retarget.c b/source/blender/editors/armature/editarmature_retarget.c
index b750bd5ef1c..14891826260 100644
--- a/source/blender/editors/armature/editarmature_retarget.c
+++ b/source/blender/editors/armature/editarmature_retarget.c
@@ -1889,7 +1889,7 @@ static RetargetMode detectArcRetargetMode(RigArc *iarc)
RigEdge *edge;
int large_angle = 0;
float avg_angle = 0;
- float avg_length = 0;
+ /* float avg_length = 0; */ /* UNUSED */
int nb_edges = 0;
@@ -1901,7 +1901,7 @@ static RetargetMode detectArcRetargetMode(RigArc *iarc)
avg_angle /= nb_edges - 1; /* -1 because last edge doesn't have an angle */
- avg_length = iarc->length / nb_edges;
+ /* avg_length = iarc->length / nb_edges; */ /* UNUSED */
if (nb_edges > 2)
@@ -2202,7 +2202,9 @@ static void retargetArctoArcAggresive(bContext *C, RigGraph *rigg, RigArc *iarc,
float angle_weight = 1.0; // GET FROM CONTEXT
float length_weight = 1.0;
float distance_weight = 1.0;
+#ifndef USE_THREADS
float min_cost = FLT_MAX;
+#endif
float *vec0, *vec1;
int *best_positions;
int nb_edges = BLI_countlist(&iarc->edges);
@@ -2245,7 +2247,9 @@ static void retargetArctoArcAggresive(bContext *C, RigGraph *rigg, RigArc *iarc,
int nb_positions = earc->bcount;
int nb_memo_nodes = nb_positions * nb_positions * (nb_joints + 1);
MemoNode *table = MEM_callocN(nb_memo_nodes * sizeof(MemoNode), "memoization table");
+#ifndef USE_THREADS
MemoNode *result;
+#endif
float **positions_cache = MEM_callocN(sizeof(float*) * (nb_positions + 2), "positions cache");
int i;
@@ -2260,11 +2264,15 @@ static void retargetArctoArcAggresive(bContext *C, RigGraph *rigg, RigArc *iarc,
positions_cache[i] = bucket->p;
}
+#ifndef USE_THREADS
result = solveJoints(table, iter, positions_cache, nb_joints, earc->bcount, 0, 0, iarc->edges.first, nb_joints, angle_weight, length_weight, distance_weight);
-
min_cost = result->weight;
+#else
+ solveJoints(table, iter, positions_cache, nb_joints, earc->bcount, 0, 0, iarc->edges.first, nb_joints, angle_weight, length_weight, distance_weight);
+#endif
+
copyMemoPositions(best_positions, table, earc->bcount, nb_joints);
-
+
MEM_freeN(table);
MEM_freeN(positions_cache);
}
diff --git a/source/blender/editors/armature/poselib.c b/source/blender/editors/armature/poselib.c
index 8a7d837d2a8..bf2e17c4e87 100644
--- a/source/blender/editors/armature/poselib.c
+++ b/source/blender/editors/armature/poselib.c
@@ -993,7 +993,7 @@ static void poselib_preview_apply (bContext *C, wmOperator *op)
memcpy(&tempstr[index+1], &pld->searchstr[index], 64-index);
}
else {
- strncpy(tempstr, pld->searchstr, 64);
+ BLI_strncpy(tempstr, pld->searchstr, sizeof(tempstr));
}
/* get marker name */
diff --git a/source/blender/editors/armature/reeb.c b/source/blender/editors/armature/reeb.c
index 0522b24ae91..c60ea467f8c 100644
--- a/source/blender/editors/armature/reeb.c
+++ b/source/blender/editors/armature/reeb.c
@@ -1354,11 +1354,11 @@ static int joinSubgraphsEnds(ReebGraph *rg, float threshold, int nb_subgraphs)
if (end_node && start_node)
{
- ReebArc *start_arc, *end_arc;
+ ReebArc *start_arc /* , *end_arc */ /* UNUSED */;
int merging = 0;
start_arc = start_node->arcs[0];
- end_arc = end_node->arcs[0];
+ /* end_arc = end_node->arcs[0]; */ /* UNUSED */
if (start_arc->tail == start_node)
{
diff --git a/source/blender/editors/include/ED_anim_api.h b/source/blender/editors/include/ED_anim_api.h
index b730913a368..3c810f7da2d 100644
--- a/source/blender/editors/include/ED_anim_api.h
+++ b/source/blender/editors/include/ED_anim_api.h
@@ -426,7 +426,7 @@ void ANIM_channel_setting_set(bAnimContext *ac, bAnimListElem *ale, int setting,
/* Flush visibility (for Graph Editor) changes up/down hierarchy for changes in the given setting
* - anim_data: list of the all the anim channels that can be chosen
* -> filtered using ANIMFILTER_CHANNELS only, since if we took VISIBLE too,
- * then the channels under closed expanders get ignored...
+ * then the channels under closed expanders get ignored...
* - ale_setting: the anim channel (not in the anim_data list directly, though occuring there)
* with the new state of the setting that we want flushed up/down the hierarchy
* - setting: type of setting to set
diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h
index f5abebbebd5..4a895472b33 100644
--- a/source/blender/editors/include/UI_interface.h
+++ b/source/blender/editors/include/UI_interface.h
@@ -34,6 +34,7 @@
#ifndef UI_INTERFACE_H
#define UI_INTERFACE_H
+#include "BLO_sys_types.h" /* size_t */
#include "RNA_types.h"
#include "DNA_userdef_types.h"
@@ -576,7 +577,7 @@ void uiButSetFocusOnEnter (struct wmWindow *win, uiBut *but);
typedef struct AutoComplete AutoComplete;
-AutoComplete *autocomplete_begin(const char *startname, int maxlen);
+AutoComplete *autocomplete_begin(const char *startname, size_t maxlen);
void autocomplete_do_name(AutoComplete *autocpl, const char *name);
void autocomplete_end(AutoComplete *autocpl, char *autoname);
diff --git a/source/blender/editors/include/UI_interface_icons.h b/source/blender/editors/include/UI_interface_icons.h
index b6837a4b3c9..54400accbc2 100644
--- a/source/blender/editors/include/UI_interface_icons.h
+++ b/source/blender/editors/include/UI_interface_icons.h
@@ -50,8 +50,8 @@ typedef struct IconFile {
#define ICON_DEFAULT_HEIGHT 16
#define ICON_DEFAULT_WIDTH 16
-#define ICON_DEFAULT_HEIGHT_SCALE (UI_UNIT_Y * 0.8f)
-#define ICON_DEFAULT_WIDTH_SCALE (UI_UNIT_X * 0.8f)
+#define ICON_DEFAULT_HEIGHT_SCALE ((int)(UI_UNIT_Y * 0.8f))
+#define ICON_DEFAULT_WIDTH_SCALE ((int)(UI_UNIT_X * 0.8f))
#define PREVIEW_DEFAULT_HEIGHT 96
diff --git a/source/blender/editors/interface/CMakeLists.txt b/source/blender/editors/interface/CMakeLists.txt
index cc4c1eaa21c..678be82f160 100644
--- a/source/blender/editors/interface/CMakeLists.txt
+++ b/source/blender/editors/interface/CMakeLists.txt
@@ -60,7 +60,7 @@ set(SRC
)
if(WITH_INTERNATIONAL)
- add_definitions(-DINTERNATIONAL)
+ add_definitions(-DWITH_INTERNATIONAL)
endif()
if(WITH_HEADLESS)
diff --git a/source/blender/editors/interface/SConscript b/source/blender/editors/interface/SConscript
index 54390baadb9..2d6d5cd235e 100644
--- a/source/blender/editors/interface/SConscript
+++ b/source/blender/editors/interface/SConscript
@@ -14,7 +14,7 @@ incs += ' ../../python/' # python button eval
defs = []
if env['WITH_BF_INTERNATIONAL']:
- defs.append('INTERNATIONAL')
+ defs.append('WITH_INTERNATIONAL')
if env['WITH_BF_PYTHON']:
defs.append('WITH_PYTHON')
diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c
index 32fe0fb86f9..aad67b6b0be 100644
--- a/source/blender/editors/interface/interface.c
+++ b/source/blender/editors/interface/interface.c
@@ -96,7 +96,7 @@ static void ui_free_but(const bContext *C, uiBut *but);
int UI_translate_iface(void)
{
-#ifdef INTERNATIONAL
+#ifdef WITH_INTERNATIONAL
return (U.transopts & USER_DOTRANSLATE) && (U.transopts & USER_TR_IFACE);
#else
return 0;
@@ -105,7 +105,7 @@ int UI_translate_iface(void)
int UI_translate_tooltips(void)
{
-#ifdef INTERNATIONAL
+#ifdef WITH_INTERNATIONAL
return (U.transopts & USER_DOTRANSLATE) && (U.transopts & USER_TR_TOOLTIPS);
#else
return 0;
@@ -114,7 +114,7 @@ int UI_translate_tooltips(void)
const char *UI_translate_do_iface(const char *msgid)
{
-#ifdef INTERNATIONAL
+#ifdef WITH_INTERNATIONAL
if(UI_translate_iface())
return BLF_gettext(msgid);
else
@@ -126,7 +126,7 @@ const char *UI_translate_do_iface(const char *msgid)
const char *UI_translate_do_tooltip(const char *msgid)
{
-#ifdef INTERNATIONAL
+#ifdef WITH_INTERNATIONAL
if(UI_translate_tooltips())
return BLF_gettext(msgid);
else
@@ -1528,7 +1528,7 @@ static double ui_get_but_scale_unit(uiBut *but, double value)
}
/* str will be overwritten */
-void ui_convert_to_unit_alt_name(uiBut *but, char *str, int maxlen)
+void ui_convert_to_unit_alt_name(uiBut *but, char *str, size_t maxlen)
{
if(ui_is_but_unit(but)) {
UnitSettings *unit= but->block->unit;
@@ -1576,7 +1576,7 @@ static float ui_get_but_step_unit(uiBut *but, float step_default)
}
-void ui_get_but_string(uiBut *but, char *str, int maxlen)
+void ui_get_but_string(uiBut *but, char *str, size_t maxlen)
{
if(but->rnaprop && ELEM3(but->type, TEX, IDPOIN, SEARCH_MENU)) {
PropertyType type;
@@ -2143,8 +2143,8 @@ void ui_check_but(uiBut *but)
UI_GET_BUT_VALUE_INIT(but, value)
if(ui_is_but_float(but)) {
- if(value == (double) FLT_MAX) sprintf(but->drawstr, "%sinf", but->str);
- else if(value == (double) -FLT_MAX) sprintf(but->drawstr, "%s-inf", but->str);
+ if(value == (double) FLT_MAX) BLI_snprintf(but->drawstr, sizeof(but->drawstr), "%sinf", but->str);
+ else if(value == (double) -FLT_MAX) BLI_snprintf(but->drawstr, sizeof(but->drawstr), "%s-inf", but->str);
/* support length type buttons */
else if(ui_is_but_unit(but)) {
char new_str[sizeof(but->drawstr)];
@@ -2157,7 +2157,7 @@ void ui_check_but(uiBut *but)
}
}
else {
- sprintf(but->drawstr, "%s%d", but->str, (int)value);
+ BLI_snprintf(but->drawstr, sizeof(but->drawstr), "%s%d", but->str, (int)value);
}
if(but->rnaprop) {
@@ -2176,7 +2176,7 @@ void ui_check_but(uiBut *but)
BLI_snprintf(but->drawstr, sizeof(but->drawstr), "%s%.*f", but->str, prec, value);
}
else {
- strncpy(but->drawstr, but->str, UI_MAX_DRAW_STR);
+ BLI_strncpy(but->drawstr, but->str, UI_MAX_DRAW_STR);
}
break;
@@ -2194,7 +2194,7 @@ void ui_check_but(uiBut *but)
break;
case KEYEVT:
- strncpy(but->drawstr, but->str, UI_MAX_DRAW_STR);
+ BLI_strncpy(but->drawstr, but->str, UI_MAX_DRAW_STR);
if (but->flag & UI_SELECT) {
strcat(but->drawstr, "Press a key");
}
@@ -2226,15 +2226,15 @@ void ui_check_but(uiBut *but)
strcat(but->drawstr, "Press a key ");
}
else
- strncpy(but->drawstr, but->str, UI_MAX_DRAW_STR);
+ BLI_strncpy(but->drawstr, but->str, UI_MAX_DRAW_STR);
break;
case BUT_TOGDUAL:
/* trying to get the dual-icon to left of text... not very nice */
if(but->str[0]) {
- strncpy(but->drawstr, " ", UI_MAX_DRAW_STR);
- strncpy(but->drawstr+2, but->str, UI_MAX_DRAW_STR-2);
+ BLI_strncpy(but->drawstr, " ", UI_MAX_DRAW_STR);
+ BLI_strncpy(but->drawstr+2, but->str, UI_MAX_DRAW_STR-2);
}
break;
@@ -2242,13 +2242,13 @@ void ui_check_but(uiBut *but)
case HSVCIRCLE:
break;
default:
- strncpy(but->drawstr, but->str, UI_MAX_DRAW_STR);
+ BLI_strncpy(but->drawstr, but->str, UI_MAX_DRAW_STR);
}
/* if we are doing text editing, this will override the drawstr */
if(but->editstr)
- strncpy(but->drawstr, but->editstr, UI_MAX_DRAW_STR);
+ BLI_strncpy(but->drawstr, but->editstr, UI_MAX_DRAW_STR);
/* text clipping moved to widget drawing code itself */
}
@@ -2741,7 +2741,7 @@ static uiBut *ui_def_but_operator(uiBlock *block, int type, const char *opname,
if ((!tip || tip[0]=='\0') && ot && ot->description) {
tip= ot->description;
-#ifdef INTERNATIONAL
+#ifdef WITH_INTERNATIONAL
if(UI_translate_tooltips())
tip= BLF_gettext(tip);
#endif
@@ -2822,12 +2822,12 @@ static int findBitIndex(unsigned int x) {
/* autocomplete helper functions */
struct AutoComplete {
- int maxlen;
+ size_t maxlen;
char *truncate;
const char *startname;
};
-AutoComplete *autocomplete_begin(const char *startname, int maxlen)
+AutoComplete *autocomplete_begin(const char *startname, size_t maxlen)
{
AutoComplete *autocpl;
diff --git a/source/blender/editors/interface/interface_anim.c b/source/blender/editors/interface/interface_anim.c
index 1113f90a652..c35996701ee 100644
--- a/source/blender/editors/interface/interface_anim.c
+++ b/source/blender/editors/interface/interface_anim.c
@@ -83,7 +83,7 @@ void ui_but_anim_flag(uiBut *but, float cfra)
}
}
-int ui_but_anim_expression_get(uiBut *but, char *str, int maxlen)
+int ui_but_anim_expression_get(uiBut *but, char *str, size_t maxlen)
{
FCurve *fcu;
ChannelDriver *driver;
diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c
index a1275e237c1..b65be48f7ee 100644
--- a/source/blender/editors/interface/interface_draw.c
+++ b/source/blender/editors/interface/interface_draw.c
@@ -39,6 +39,7 @@
#include "BLI_math.h"
#include "BLI_rect.h"
+#include "BLI_string.h"
#include "BLI_utildefines.h"
#include "BKE_colortools.h"
@@ -500,7 +501,7 @@ void ui_draw_but_IMAGE(ARegion *UNUSED(ar), uiBut *but, uiWidgetColors *UNUSED(w
}
#if 0
-#ifdef INTERNATIONAL
+#ifdef WITH_INTERNATIONAL
static void ui_draw_but_CHARTAB(uiBut *but)
{
/* XXX 2.50 bad global access */
@@ -670,7 +671,7 @@ static void ui_draw_but_CHARTAB(uiBut *but)
}
}
-#endif // INTERNATIONAL
+#endif // WITH_INTERNATIONAL
#endif
static void draw_scope_end(rctf *rect, GLint *scissor)
@@ -835,7 +836,7 @@ void ui_draw_but_WAVEFORM(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol),
/* draw grid lines here */
for (i=0; i<6; i++) {
char str[4];
- sprintf(str,"%-3d",i*20);
+ BLI_snprintf(str, sizeof(str), "%-3d",i*20);
str[3]='\0';
fdrawline(rect.xmin+22, yofs+(i/5.f)*h, rect.xmax+1, yofs+(i/5.f)*h);
BLF_draw_default(rect.xmin+1, yofs-5+(i/5.f)*h, 0, str, sizeof(str)-1);
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c
index 125928c136b..568eaf358e5 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -631,7 +631,7 @@ static void ui_apply_but_IDPOIN(bContext *C, uiBut *but, uiHandleButtonData *dat
data->applied= 1;
}
-#ifdef INTERNATIONAL
+#ifdef WITH_INTERNATIONAL
static void ui_apply_but_CHARTAB(bContext *C, uiBut *but, uiHandleButtonData *data)
{
ui_apply_but_func(C, but);
@@ -1023,7 +1023,7 @@ static void ui_apply_button(bContext *C, uiBlock *block, uiBut *but, uiHandleBut
case IDPOIN:
ui_apply_but_IDPOIN(C, but, data);
break;
-#ifdef INTERNATIONAL
+#ifdef WITH_INTERNATIONAL
case CHARTAB:
ui_apply_but_CHARTAB(C, but, data);
break;
@@ -1113,9 +1113,9 @@ static void ui_but_copy_paste(bContext *C, uiBut *but, uiHandleButtonData *data,
if(but->poin==NULL && but->rnapoin.data==NULL);
else if(mode=='c') {
if(ui_is_but_float(but))
- sprintf(buf, "%f", ui_get_but_val(but));
+ BLI_snprintf(buf, sizeof(buf), "%f", ui_get_but_val(but));
else
- sprintf(buf, "%d", (int)ui_get_but_val(but));
+ BLI_snprintf(buf, sizeof(buf), "%d", (int)ui_get_but_val(but));
WM_clipboard_text_set(buf, 0);
}
@@ -1136,7 +1136,7 @@ static void ui_but_copy_paste(bContext *C, uiBut *but, uiHandleButtonData *data,
else if(mode=='c') {
ui_get_but_vectorf(but, rgb);
- sprintf(buf, "[%f, %f, %f]", rgb[0], rgb[1], rgb[2]);
+ BLI_snprintf(buf, sizeof(buf), "[%f, %f, %f]", rgb[0], rgb[1], rgb[2]);
WM_clipboard_text_set(buf, 0);
}
@@ -3924,7 +3924,7 @@ static int ui_do_but_VECTORSCOPE(bContext *C, uiBlock *block, uiBut *but, uiHand
return WM_UI_HANDLER_CONTINUE;
}
-#ifdef INTERNATIONAL
+#ifdef WITH_INTERNATIONAL
static int ui_do_but_CHARTAB(bContext *UNUSED(C), uiBlock *UNUSED(block), uiBut *UNUSED(but), uiHandleButtonData *UNUSED(data), wmEvent *UNUSED(event))
{
/* XXX 2.50 bad global and state access */
@@ -4367,7 +4367,7 @@ static int ui_but_menu(bContext *C, uiBut *but)
PointerRNA ptr_props;
if(but->rnapoin.data && but->rnaprop) {
- sprintf(buf, "%s.%s", RNA_struct_identifier(but->rnapoin.type), RNA_property_identifier(but->rnaprop));
+ BLI_snprintf(buf, sizeof(buf), "%s.%s", RNA_struct_identifier(but->rnapoin.type), RNA_property_identifier(but->rnaprop));
WM_operator_properties_create(&ptr_props, "WM_OT_doc_view");
RNA_string_set(&ptr_props, "doc_id", buf);
@@ -4584,7 +4584,7 @@ static int ui_do_button(bContext *C, uiBlock *block, uiBut *but, wmEvent *event)
case HSVCIRCLE:
retval= ui_do_but_HSVCIRCLE(C, block, but, data, event);
break;
-#ifdef INTERNATIONAL
+#ifdef WITH_INTERNATIONAL
case CHARTAB:
retval= ui_do_but_CHARTAB(C, block, but, data, event);
break;
diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h
index 72eb869dea0..94eb180bd06 100644
--- a/source/blender/editors/interface/interface_intern.h
+++ b/source/blender/editors/interface/interface_intern.h
@@ -364,8 +364,8 @@ extern void ui_set_but_vectorf(uiBut *but, float *vec);
extern void ui_hsvcircle_vals_from_pos(float *valrad, float *valdist, rcti *rect, float mx, float my);
-extern void ui_get_but_string(uiBut *but, char *str, int maxlen);
-extern void ui_convert_to_unit_alt_name(uiBut *but, char *str, int maxlen);
+extern void ui_get_but_string(uiBut *but, char *str, size_t maxlen);
+extern void ui_convert_to_unit_alt_name(uiBut *but, char *str, size_t maxlen);
extern int ui_set_but_string(struct bContext *C, uiBut *but, const char *str);
extern int ui_get_but_string_max_length(uiBut *but);
@@ -517,7 +517,7 @@ void ui_but_anim_copy_driver(struct bContext *C);
void ui_but_anim_paste_driver(struct bContext *C);
void ui_but_anim_add_keyingset(struct bContext *C);
void ui_but_anim_remove_keyingset(struct bContext *C);
-int ui_but_anim_expression_get(uiBut *but, char *str, int maxlen);
+int ui_but_anim_expression_get(uiBut *but, char *str, size_t maxlen);
int ui_but_anim_expression_set(uiBut *but, const char *str);
int ui_but_anim_expression_create(uiBut *but, const char *str);
void ui_but_anim_autokey(struct bContext *C, uiBut *but, struct Scene *scene, float cfra);
diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c
index 3c02f7d4bd2..ab07cb4bbf6 100644
--- a/source/blender/editors/interface/interface_layout.c
+++ b/source/blender/editors/interface/interface_layout.c
@@ -639,7 +639,7 @@ PointerRNA uiItemFullO(uiLayout *layout, const char *opname, const char *name, i
if(!name) {
name= ot->name;
-#ifdef INTERNATIONAL
+#ifdef WITH_INTERNATIONAL
name= UI_translate_do_iface(name);
#endif
}
@@ -1219,7 +1219,7 @@ static void rna_search_cb(const struct bContext *C, void *arg_but, const char *s
#if 0 /* this name is used for a string comparison and can't be modified, TODO */
name_uiprefix_id(name_ui, id);
#else
- strcpy(name_ui, id->name+2);
+ BLI_strncpy(name_ui, id->name+2, sizeof(name_ui));
#endif
name= BLI_strdup(name_ui);
iconid= ui_id_icon_get((bContext*)C, id, 1);
@@ -1432,7 +1432,7 @@ void uiItemM(uiLayout *layout, bContext *UNUSED(C), const char *menuname, const
if(!name) {
name= mt->label;
-#ifdef INTERNATIONAL
+#ifdef WITH_INTERNATIONAL
name= UI_translate_do_iface(name);
#endif
}
diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c
index ec7456eebdc..c25e7f23c04 100644
--- a/source/blender/editors/interface/interface_panel.c
+++ b/source/blender/editors/interface/interface_panel.c
@@ -444,7 +444,7 @@ static void ui_draw_aligned_panel_header(uiStyle *style, uiBlock *block, rcti *r
int pnl_icons;
const char *activename= panel->drawname[0]?panel->drawname:panel->panelname;
-#ifdef INTERNATIONAL
+#ifdef WITH_INTERNATIONAL
activename= UI_translate_do_iface(activename);
#endif
diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c
index 4221f7c30ff..4a9eb8113fe 100644
--- a/source/blender/editors/interface/interface_regions.c
+++ b/source/blender/editors/interface/interface_regions.c
@@ -84,7 +84,7 @@ typedef struct MenuEntry {
} MenuEntry;
typedef struct MenuData {
- char *instr;
+ const char *instr;
const char *title;
int titleicon;
@@ -92,7 +92,7 @@ typedef struct MenuData {
int nitems, itemssize;
} MenuData;
-static MenuData *menudata_new(char *instr)
+static MenuData *menudata_new(const char *instr)
{
MenuData *md= MEM_mallocN(sizeof(*md), "MenuData");
@@ -137,7 +137,7 @@ static void menudata_add_item(MenuData *md, const char *str, int retval, int ico
static void menudata_free(MenuData *md)
{
- MEM_freeN(md->instr);
+ MEM_freeN((void *)md->instr);
if (md->items)
MEM_freeN(md->items);
MEM_freeN(md);
@@ -156,7 +156,7 @@ static void menudata_free(MenuData *md)
* @param str String to be parsed.
* @retval new menudata structure, free with menudata_free()
*/
-static MenuData *decompose_menu_string(char *str)
+static MenuData *decompose_menu_string(const char *str)
{
char *instr= BLI_strdup(str);
MenuData *md= menudata_new(instr);
@@ -230,9 +230,11 @@ void ui_set_name_menu(uiBut *but, int value)
int i;
md= decompose_menu_string(but->str);
- for (i=0; i<md->nitems; i++)
- if (md->items[i].retval==value)
- strcpy(but->drawstr, md->items[i].str);
+ for (i=0; i<md->nitems; i++) {
+ if (md->items[i].retval==value) {
+ BLI_strncpy(but->drawstr, md->items[i].str, sizeof(but->drawstr));
+ }
+ }
menudata_free(md);
}
@@ -1611,7 +1613,7 @@ static void ui_block_func_MENUSTR(bContext *UNUSED(C), uiLayout *layout, void *a
uiBut *bt;
MenuData *md;
MenuEntry *entry;
- char *instr= arg_str;
+ const char *instr= arg_str;
int columns, rows, a, b;
uiBlockSetFlag(block, UI_BLOCK_MOVEMOUSE_QUIT);
@@ -1798,7 +1800,7 @@ static void ui_update_block_buts_rgb(uiBlock *block, float *rgb)
if (rgb_gamma[1] > 1.0f) rgb_gamma[1] = modf(rgb_gamma[1], &intpart);
if (rgb_gamma[2] > 1.0f) rgb_gamma[2] = modf(rgb_gamma[2], &intpart);
- sprintf(col, "%02X%02X%02X", FTOCHAR(rgb_gamma[0]), FTOCHAR(rgb_gamma[1]), FTOCHAR(rgb_gamma[2]));
+ BLI_snprintf(col, sizeof(col), "%02X%02X%02X", FTOCHAR(rgb_gamma[0]), FTOCHAR(rgb_gamma[1]), FTOCHAR(rgb_gamma[2]));
strcpy(bt->poin, col);
}
@@ -1986,10 +1988,10 @@ static void uiBlockPicker(uiBlock *block, float *rgb, PointerRNA *ptr, PropertyR
/* existence of profile means storage is in linear color space, with display correction */
if (block->color_profile == BLI_PR_NONE) {
- sprintf(tip, "Value in Display Color Space");
+ BLI_strncpy(tip, "Value in Display Color Space", sizeof(tip));
copy_v3_v3(rgb_gamma, rgb);
} else {
- sprintf(tip, "Value in Linear RGB Color Space");
+ BLI_strncpy(tip, "Value in Linear RGB Color Space", sizeof(tip));
/* make an sRGB version, for Hex code */
linearrgb_to_srgb_v3_v3(rgb_gamma, rgb);
}
@@ -2058,7 +2060,7 @@ static void uiBlockPicker(uiBlock *block, float *rgb, PointerRNA *ptr, PropertyR
rgb[3]= 1.0f;
}
- sprintf(hexcol, "%02X%02X%02X", FTOCHAR(rgb_gamma[0]), FTOCHAR(rgb_gamma[1]), FTOCHAR(rgb_gamma[2]));
+ BLI_snprintf(hexcol, sizeof(hexcol), "%02X%02X%02X", FTOCHAR(rgb_gamma[0]), FTOCHAR(rgb_gamma[1]), FTOCHAR(rgb_gamma[2]));
bt= uiDefBut(block, TEX, 0, "Hex: ", 0, -60, butwidth, UI_UNIT_Y, hexcol, 0, 8, 0, 0, "Hex triplet for color (#RRGGBB)");
uiButSetFunc(bt, do_hex_rna_cb, bt, hexcol);
@@ -2152,7 +2154,7 @@ static int ui_popup_string_hash(char *str)
return hash;
}
-static int ui_popup_menu_hash(char *str)
+static int ui_popup_menu_hash(const char *str)
{
return BLI_ghashutil_strhash(str);
}
@@ -2202,8 +2204,6 @@ static uiBlock *ui_block_func_POPUP(bContext *C, uiPopupBlockHandle *handle, voi
{
uiBlock *block;
uiBut *bt;
- ScrArea *sa;
- ARegion *ar;
uiPopupMenu *pup= arg_pup;
int offset[2], direction, minwidth, width, height, flip;
@@ -2275,10 +2275,9 @@ static uiBlock *ui_block_func_POPUP(bContext *C, uiPopupBlockHandle *handle, voi
else {
/* for a header menu we set the direction automatic */
if(!pup->slideout && flip) {
- sa= CTX_wm_area(C);
- ar= CTX_wm_region(C);
-
+ ScrArea *sa= CTX_wm_area(C);
if(sa && sa->headertype==HEADERDOWN) {
+ ARegion *ar= CTX_wm_region(C);
if(ar && ar->regiontype == RGN_TYPE_HEADER) {
uiBlockSetDirection(block, UI_TOP);
uiBlockFlipOrder(block);
@@ -2369,7 +2368,7 @@ uiPopupMenu *uiPupMenuBegin(bContext *C, const char *title, int icon)
char titlestr[256];
if(icon) {
- sprintf(titlestr, " %s", title);
+ BLI_snprintf(titlestr, sizeof(titlestr), " %s", title);
uiDefIconTextBut(pup->block, LABEL, 0, icon, titlestr, 0, 0, 200, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, "");
}
else {
@@ -2467,7 +2466,7 @@ void uiPupMenuOkee(bContext *C, const char *opname, const char *str, ...)
va_list ap;
char titlestr[256];
- sprintf(titlestr, "OK? %%i%d", ICON_QUESTION);
+ BLI_snprintf(titlestr, sizeof(titlestr), "OK? %%i%d", ICON_QUESTION);
va_start(ap, str);
vconfirm_opname(C, opname, titlestr, str, ap);
@@ -2507,9 +2506,9 @@ void uiPupMenuError(bContext *C, const char *str, ...)
char nfmt[256];
char titlestr[256];
- sprintf(titlestr, "Error %%i%d", ICON_ERROR);
+ BLI_snprintf(titlestr, sizeof(titlestr), "Error %%i%d", ICON_ERROR);
- sprintf(nfmt, "%s", str);
+ BLI_strncpy(nfmt, str, sizeof(nfmt));
va_start(ap, str);
vconfirm_opname(C, NULL, titlestr, nfmt, ap);
diff --git a/source/blender/editors/interface/interface_style.c b/source/blender/editors/interface/interface_style.c
index 3a9879384a3..3009d4fea09 100644
--- a/source/blender/editors/interface/interface_style.c
+++ b/source/blender/editors/interface/interface_style.c
@@ -315,14 +315,14 @@ void uiStyleInit(void)
font= MEM_callocN(sizeof(uiFont), "ui font");
BLI_addtail(&U.uifonts, font);
- strcpy(font->filename, "default");
+ BLI_strncpy(font->filename, "default", sizeof(font->filename));
font->uifont_id= UIFONT_DEFAULT;
}
for(font= U.uifonts.first; font; font= font->next) {
if(font->uifont_id==UIFONT_DEFAULT) {
-#ifdef INTERNATIONAL
+#ifdef WITH_INTERNATIONAL
int font_size= datatoc_bfont_ttf_size;
unsigned char *font_ttf= (unsigned char*)datatoc_bfont_ttf;
static int last_font_size = 0;
diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c
index bec9e6a7664..a4622f50725 100644
--- a/source/blender/editors/interface/interface_templates.c
+++ b/source/blender/editors/interface/interface_templates.c
@@ -412,7 +412,7 @@ static void template_ID(bContext *C, uiLayout *layout, TemplateID *template, Str
if(id->us > 1) {
char str[32];
- sprintf(str, "%d", id->us);
+ BLI_snprintf(str, sizeof(str), "%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,
UI_translate_do_tooltip(_("Displays number of users of this data. Click to make a single-user copy")));
@@ -724,7 +724,7 @@ static uiLayout *draw_modifier(uiLayout *layout, Scene *scene, Object *ob, Modif
block= uiLayoutGetBlock(row);
/* VIRTUAL MODIFIER */
// XXX this is not used now, since these cannot be accessed via RNA
- sprintf(str, "%s parent deform", md->name);
+ BLI_snprintf(str, sizeof(str), "%s parent deform", md->name);
uiDefBut(block, LABEL, 0, str, 0, 0, 185, UI_UNIT_Y, NULL, 0.0, 0.0, 0.0, 0.0, "Modifier name");
but = uiDefBut(block, BUT, 0, UI_translate_do_iface(N_("Make Real")), 0, 0, 80, 16, NULL, 0.0, 0.0, 0.0, 0.0,
@@ -959,13 +959,10 @@ static uiLayout *draw_constraint(uiLayout *layout, Object *ob, bConstraint *con)
cti= constraint_get_typeinfo(con);
if (cti == NULL) {
/* exception for 'Null' constraint - it doesn't have constraint typeinfo! */
- if (con->type == CONSTRAINT_TYPE_NULL)
- strcpy(typestr, "Null");
- else
- strcpy(typestr, "Unknown");
+ BLI_strncpy(typestr, (con->type == CONSTRAINT_TYPE_NULL) ? "Null" : "Unknown", sizeof(typestr));
}
else
- strcpy(typestr, cti->name);
+ BLI_strncpy(typestr, cti->name, sizeof(typestr));
/* determine whether constraint is proxy protected or not */
if (proxylocked_constraints_owner(ob, pchan))
@@ -2112,7 +2109,7 @@ static void list_item_row(bContext *C, uiLayout *layout, PointerRNA *ptr, Pointe
manode= give_node_material(ma);
if(manode) {
char str[MAX_ID_NAME + 12];
- sprintf(str, "Node %s", manode->id.name+2);
+ BLI_snprintf(str, sizeof(str), "Node %s", manode->id.name+2);
uiItemL(sub, str, ui_id_icon_get(C, &manode->id, 1));
}
else if(ma->use_nodes) {
@@ -2281,7 +2278,7 @@ void uiTemplateList(uiLayout *layout, bContext *C, PointerRNA *ptr, const char *
uiItemL(row, "", ICON_NONE);
/* next/prev button */
- sprintf(str, "%d :", i);
+ 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, "");
if(i == 0)
uiButSetFlag(but, UI_BUT_DISABLED);
diff --git a/source/blender/editors/interface/interface_utils.c b/source/blender/editors/interface/interface_utils.c
index a49060eaca2..206ecbad1d0 100644
--- a/source/blender/editors/interface/interface_utils.c
+++ b/source/blender/editors/interface/interface_utils.c
@@ -36,6 +36,7 @@
#include "DNA_object_types.h"
#include "BLI_utildefines.h"
+#include "BLI_string.h"
#include "BLF_translation.h"
@@ -116,7 +117,7 @@ uiBut *uiDefAutoButR(uiBlock *block, PointerRNA *ptr, PropertyRNA *prop, int ind
}
case PROP_COLLECTION: {
char text[256];
- sprintf(text, UI_translate_do_iface(N_("%d items")), RNA_property_collection_length(ptr, prop));
+ BLI_snprintf(text, sizeof(text), UI_translate_do_iface(N_("%d items")), RNA_property_collection_length(ptr, prop));
but= uiDefBut(block, LABEL, 0, text, x1, y1, x2, y2, NULL, 0, 0, 0, 0, NULL);
uiButSetFlag(but, UI_BUT_DISABLED);
break;
diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c
index 45829646145..0215cc05d36 100644
--- a/source/blender/editors/interface/interface_widgets.c
+++ b/source/blender/editors/interface/interface_widgets.c
@@ -574,7 +574,7 @@ static void widget_check_trias(uiWidgetTrias *tria, rcti *rect)
/* prepares shade colors */
-static void shadecolors4(char *coltop, char *coldown, const char *color, short shadetop, short shadedown)
+static void shadecolors4(char coltop[4], char *coldown, const char *color, short shadetop, short shadedown)
{
coltop[0]= CLAMPIS(color[0]+shadetop, 0, 255);
@@ -889,7 +889,7 @@ static void widget_draw_icon(uiBut *but, BIFIconID icon, float alpha, rcti *rect
UI_icon_draw_aspect(xs, ys, icon, aspect, alpha);
}
- if(but->flag & UI_ICON_SUBMENU) {
+ if((but->flag & UI_ICON_SUBMENU) && (but->dt == UI_EMBOSSP)) {
xs= rect->xmax-17;
ys= (rect->ymin+rect->ymax- height)/2;
@@ -1493,7 +1493,7 @@ void ui_widget_color_init(ThemeUI *tui)
/* ************ button callbacks, state ***************** */
-static void widget_state_blend(char *cp, const char *cpstate, const float fac)
+static void widget_state_blend(char cp[3], const char cpstate[3], const float fac)
{
if(fac != 0.0f) {
cp[0]= (int)((1.0f-fac)*cp[0] + fac*cpstate[0]);
diff --git a/source/blender/editors/interface/view2d_ops.c b/source/blender/editors/interface/view2d_ops.c
index 0aaf6fe3bc6..30ae69b71b8 100644
--- a/source/blender/editors/interface/view2d_ops.c
+++ b/source/blender/editors/interface/view2d_ops.c
@@ -785,7 +785,7 @@ static void VIEW2D_OT_zoom_out(wmOperatorType *ot)
}
/* ********************************************************* */
-/* DRAG-ZOOM OPERATOR */
+/* DRAG-ZOOM OPERATOR */
/* MMB Drag - allows non-uniform scaling by dragging mouse
*
diff --git a/source/blender/editors/object/object_vgroup.c b/source/blender/editors/object/object_vgroup.c
index 5aff7edd6d0..866a0c1c495 100644
--- a/source/blender/editors/object/object_vgroup.c
+++ b/source/blender/editors/object/object_vgroup.c
@@ -941,7 +941,7 @@ static void moveCloserToDistanceFromPlane(Scene *scene, Object *ob, Mesh *me, in
int totweight = dvert->totweight;
float oldw = 0;
float oldPos[3] = {0};
- float vc, hc, dist;
+ float vc, hc, dist = 0.0f /* Not necessary, but quites down gcc warnings! */;
int i, k;
float (*changes)[2] = MEM_mallocN(sizeof(float *)*totweight*2, "vertHorzChange");
float *dists = MEM_mallocN(sizeof(float)*totweight, "distance");
diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c
index 8a572ddbcd5..6b1176a04d5 100644
--- a/source/blender/editors/physics/particle_edit.c
+++ b/source/blender/editors/physics/particle_edit.c
@@ -3919,7 +3919,7 @@ void PE_undo_push(Scene *scene, const char *str)
/* make new */
edit->curundo= undo= MEM_callocN(sizeof(PTCacheUndo), "particle undo file");
- strncpy(undo->name, str, 64-1);
+ BLI_strncpy(undo->name, str, sizeof(undo->name));
BLI_addtail(&edit->undo, undo);
/* and limit amount to the maximum */
diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c
index 8951df9221e..041cb9091d9 100644
--- a/source/blender/editors/screen/area.c
+++ b/source/blender/editors/screen/area.c
@@ -1375,9 +1375,9 @@ static const char *editortype_pup(void)
"|Outliner %x3"
"|User Preferences %x19"
"|Info%x7"
-
+
"|%l"
-
+
"|File Browser %x5"
"|%l"
diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c
index 63804b9fbc2..354e81cb52c 100644
--- a/source/blender/editors/sculpt_paint/paint_image.c
+++ b/source/blender/editors/sculpt_paint/paint_image.c
@@ -3706,7 +3706,7 @@ static void do_projectpaint_draw_f(ProjPaintState *ps, ProjPixel *projPixel, flo
if(use_color_correction){
srgb_to_linearrgb_v3_v3(rgba, ps->brush->rgb);
}
- else {
+ else {
VECCOPY(rgba, ps->brush->rgb);
}
rgba[3] = 1.0;
diff --git a/source/blender/editors/sculpt_paint/paint_undo.c b/source/blender/editors/sculpt_paint/paint_undo.c
index ba0c2c8be92..345cda63f5a 100644
--- a/source/blender/editors/sculpt_paint/paint_undo.c
+++ b/source/blender/editors/sculpt_paint/paint_undo.c
@@ -34,6 +34,7 @@
#include "BLI_listbase.h"
#include "BLI_utildefines.h"
+#include "BLI_string.h"
#include "DNA_userdef_types.h"
@@ -106,7 +107,7 @@ static void undo_stack_push_begin(UndoStack *stack, const char *name, UndoRestor
BLI_addtail(&stack->elems, uel);
/* name can be a dynamic string */
- strncpy(uel->name, name, MAXUNDONAME-1);
+ BLI_strncpy(uel->name, name, sizeof(uel->name));
/* limit amount to the maximum amount*/
nr= 0;
diff --git a/source/blender/editors/space_console/space_console.c b/source/blender/editors/space_console/space_console.c
index 5a965fc076b..1b9e3fdfb4a 100644
--- a/source/blender/editors/space_console/space_console.c
+++ b/source/blender/editors/space_console/space_console.c
@@ -138,7 +138,7 @@ static void console_main_area_init(wmWindowManager *wm, ARegion *ar)
wmKeyMap *keymap;
ListBase *lb;
- const int prev_y_min= ar->v2d.cur.ymin; /* so resizing keeps the cursor visible */
+ const float prev_y_min= ar->v2d.cur.ymin; /* so resizing keeps the cursor visible */
UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_CUSTOM, ar->winx, ar->winy);
diff --git a/source/blender/editors/space_file/file_draw.c b/source/blender/editors/space_file/file_draw.c
index b2b734159ff..f7abb01546f 100644
--- a/source/blender/editors/space_file/file_draw.c
+++ b/source/blender/editors/space_file/file_draw.c
@@ -520,7 +520,7 @@ void file_draw_list(const bContext *C, ARegion *ar)
file_draw_preview(block, file, sx, sy, imb, layout, !is_icon && (file->flags & IMAGEFILE));
} else {
- file_draw_icon(block, file->path, sx, sy-(UI_UNIT_Y / 6), get_file_icon(file), ICON_DEFAULT_WIDTH_SCALE, ICON_DEFAULT_WIDTH_SCALE);
+ file_draw_icon(block, file->path, sx, sy-(UI_UNIT_Y / 6), get_file_icon(file), ICON_DEFAULT_WIDTH_SCALE, ICON_DEFAULT_HEIGHT_SCALE);
sx += ICON_DEFAULT_WIDTH_SCALE + 4;
}
diff --git a/source/blender/editors/space_info/info_draw.c b/source/blender/editors/space_info/info_draw.c
index 3121ddaa3b4..126d75e76cb 100644
--- a/source/blender/editors/space_info/info_draw.c
+++ b/source/blender/editors/space_info/info_draw.c
@@ -87,7 +87,7 @@ static void info_report_color(unsigned char *fg, unsigned char *bg, Report *repo
if (bool) { bg[0]=220; bg[1]=128; bg[2]=96; }
else { bg[0]=214; bg[1]=122; bg[2]=90; }
}
-#if 0 // XXX: this looks like the selected colour, so don't use this
+#if 0 // XXX: this looks like the selected color, so don't use this
else if (report->type & RPT_OPERATOR_ALL) {
if (bool) { bg[0]=96; bg[1]=128; bg[2]=255; }
else { bg[0]=90; bg[1]=122; bg[2]=249; }
diff --git a/source/blender/editors/space_node/node_intern.h b/source/blender/editors/space_node/node_intern.h
index 3751d8efae8..8bc0ae51415 100644
--- a/source/blender/editors/space_node/node_intern.h
+++ b/source/blender/editors/space_node/node_intern.h
@@ -33,6 +33,7 @@
#ifndef ED_NODE_INTERN_H
#define ED_NODE_INTERN_H
+#include <stddef.h> /* for size_t */
#include "UI_interface.h"
/* internal exports only */
diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c
index 65ce2e71d8d..10ca482ae0e 100644
--- a/source/blender/editors/space_outliner/outliner_draw.c
+++ b/source/blender/editors/space_outliner/outliner_draw.c
@@ -1248,7 +1248,7 @@ static void outliner_draw_tree_element(bContext *C, uiBlock *block, Scene *scene
if ( (SEARCHING_OUTLINER(soops) || (soops->outlinevis==SO_DATABLOCKS && soops->search_string[0]!=0)) &&
(tselem->flag & TSE_SEARCHMATCH))
{
- /* TODO - add search highlight colour to theme? */
+ /* TODO - add search highlight color to theme? */
glColor4f(0.2f, 0.5f, 0.2f, 0.3f);
glRecti(startx, *starty+1, ar->v2d.cur.xmax, *starty+UI_UNIT_Y-1);
}
diff --git a/source/blender/editors/space_sequencer/sequencer_select.c b/source/blender/editors/space_sequencer/sequencer_select.c
index a6cc65017bb..c0919ef3043 100644
--- a/source/blender/editors/space_sequencer/sequencer_select.c
+++ b/source/blender/editors/space_sequencer/sequencer_select.c
@@ -169,11 +169,11 @@ static void UNUSED_FUNCTION(select_single_seq)(Scene *scene, Sequence *seq, int
if((seq->type==SEQ_IMAGE) || (seq->type==SEQ_MOVIE)) {
if(seq->strip)
- strncpy(ed->act_imagedir, seq->strip->dir, FILE_MAXDIR-1);
+ BLI_strncpy(ed->act_imagedir, seq->strip->dir, FILE_MAXDIR);
}
else if(seq->type==SEQ_SOUND) {
if(seq->strip)
- strncpy(ed->act_sounddir, seq->strip->dir, FILE_MAXDIR-1);
+ BLI_strncpy(ed->act_sounddir, seq->strip->dir, FILE_MAXDIR);
}
seq->flag|= SELECT;
recurs_sel_seq(seq);
@@ -389,12 +389,12 @@ static int sequencer_select_invoke(bContext *C, wmOperator *op, wmEvent *event)
if ((seq->type == SEQ_IMAGE) || (seq->type == SEQ_MOVIE)) {
if(seq->strip) {
- strncpy(ed->act_imagedir, seq->strip->dir, FILE_MAXDIR-1);
+ BLI_strncpy(ed->act_imagedir, seq->strip->dir, FILE_MAXDIR);
}
} else
if (seq->type == SEQ_SOUND) {
if(seq->strip) {
- strncpy(ed->act_sounddir, seq->strip->dir, FILE_MAXDIR-1);
+ BLI_strncpy(ed->act_sounddir, seq->strip->dir, FILE_MAXDIR);
}
}
diff --git a/source/blender/editors/space_text/text_draw.c b/source/blender/editors/space_text/text_draw.c
index 4c617115a3d..10d355bd0c3 100644
--- a/source/blender/editors/space_text/text_draw.c
+++ b/source/blender/editors/space_text/text_draw.c
@@ -1421,8 +1421,7 @@ static void draw_suggestion_list(SpaceText *st, ARegion *ar)
y -= st->lheight;
- strncpy(str, item->name, SUGG_LIST_WIDTH);
- str[SUGG_LIST_WIDTH] = '\0';
+ BLI_strncpy(str, item->name, SUGG_LIST_WIDTH);
w = text_font_width(st, str);
diff --git a/source/blender/editors/space_text/text_python.c b/source/blender/editors/space_text/text_python.c
index 51b4b838171..08008f455e6 100644
--- a/source/blender/editors/space_text/text_python.c
+++ b/source/blender/editors/space_text/text_python.c
@@ -51,7 +51,7 @@
int text_do_suggest_select(SpaceText *st, ARegion *ar)
{
- SuggItem *item, *first, *last, *sel;
+ SuggItem *item, *first, *last /* , *sel */ /* UNUSED */;
TextLine *tmp;
int l, x, y, w, h, i;
int tgti, *top;
@@ -62,7 +62,7 @@ int text_do_suggest_select(SpaceText *st, ARegion *ar)
first = texttool_suggest_first();
last = texttool_suggest_last();
- sel = texttool_suggest_selected();
+ /* sel = texttool_suggest_selected(); */ /* UNUSED */
top = texttool_suggest_top();
if(!last || !first)
diff --git a/source/blender/editors/space_view3d/drawarmature.c b/source/blender/editors/space_view3d/drawarmature.c
index fc35ab93f70..3f45e32937d 100644
--- a/source/blender/editors/space_view3d/drawarmature.c
+++ b/source/blender/editors/space_view3d/drawarmature.c
@@ -146,7 +146,7 @@ static void cp_shade_color3ub (unsigned char cp[3], const int offset)
}
/* This function sets the gl-color for coloring a certain bone (based on bcolor) */
-static short set_pchan_glColor (short colCode, int boneflag, int constflag)
+static short set_pchan_glColor (short colCode, int boneflag, short constflag)
{
switch (colCode) {
case PCHAN_COLOR_NORMAL:
@@ -697,13 +697,9 @@ static void draw_sphere_bone_dist(float smat[][4], float imat[][4], bPoseChannel
vec[0]= - *(si+a) * dirvec[0] + *(co+a) * norvec[0];
vec[1]= - *(si+a) * dirvec[1] + *(co+a) * norvec[1];
vec[2]= - *(si+a) * dirvec[2] + *(co+a) * norvec[2];
-
- vec1[0]= headvec[0] + head*vec[0];
- vec1[1]= headvec[1] + head*vec[1];
- vec1[2]= headvec[2] + head*vec[2];
- vec2[0]= headvec[0] + (head+dist)*vec[0];
- vec2[1]= headvec[1] + (head+dist)*vec[1];
- vec2[2]= headvec[2] + (head+dist)*vec[2];
+
+ madd_v3_v3v3fl(vec1, headvec, vec, head);
+ madd_v3_v3v3fl(vec2, headvec, vec, head + dist);
glColor4ub(255, 255, 255, 50);
glVertex3fv(vec1);
@@ -715,13 +711,9 @@ static void draw_sphere_bone_dist(float smat[][4], float imat[][4], bPoseChannel
vec[0]= *(si+a) * dirvec[0] + *(co+a) * norvec[0];
vec[1]= *(si+a) * dirvec[1] + *(co+a) * norvec[1];
vec[2]= *(si+a) * dirvec[2] + *(co+a) * norvec[2];
-
- vec1[0]= tailvec[0] + tail*vec[0];
- vec1[1]= tailvec[1] + tail*vec[1];
- vec1[2]= tailvec[2] + tail*vec[2];
- vec2[0]= tailvec[0] + (tail+dist)*vec[0];
- vec2[1]= tailvec[1] + (tail+dist)*vec[1];
- vec2[2]= tailvec[2] + (tail+dist)*vec[2];
+
+ madd_v3_v3v3fl(vec1, tailvec, vec, tail);
+ madd_v3_v3v3fl(vec2, tailvec, vec, tail + dist);
//glColor4ub(255, 255, 255, 50);
glVertex3fv(vec1);
@@ -733,14 +725,10 @@ static void draw_sphere_bone_dist(float smat[][4], float imat[][4], bPoseChannel
vec[0]= - *(si) * dirvec[0] + *(co) * norvec[0];
vec[1]= - *(si) * dirvec[1] + *(co) * norvec[1];
vec[2]= - *(si) * dirvec[2] + *(co) * norvec[2];
-
- vec1[0]= headvec[0] + head*vec[0];
- vec1[1]= headvec[1] + head*vec[1];
- vec1[2]= headvec[2] + head*vec[2];
- vec2[0]= headvec[0] + (head+dist)*vec[0];
- vec2[1]= headvec[1] + (head+dist)*vec[1];
- vec2[2]= headvec[2] + (head+dist)*vec[2];
-
+
+ madd_v3_v3v3fl(vec1, headvec, vec, head);
+ madd_v3_v3v3fl(vec2, headvec, vec, head + dist);
+
//glColor4ub(255, 255, 255, 50);
glVertex3fv(vec1);
//glColor4ub(255, 255, 255, 0);
@@ -752,7 +740,7 @@ static void draw_sphere_bone_dist(float smat[][4], float imat[][4], bPoseChannel
/* smat, imat = mat & imat to draw screenaligned */
-static void draw_sphere_bone_wire(float smat[][4], float imat[][4], int armflag, int boneflag, int constflag, unsigned int id, bPoseChannel *pchan, EditBone *ebone)
+static void draw_sphere_bone_wire(float smat[][4], float imat[][4], int armflag, int boneflag, short constflag, unsigned int id, bPoseChannel *pchan, EditBone *ebone)
{
float head, tail /*, length*/;
float *headvec, *tailvec, dirvec[3];
@@ -839,21 +827,17 @@ static void draw_sphere_bone_wire(float smat[][4], float imat[][4], int armflag,
glLoadName(id | BONESEL_BONE);
glBegin(GL_LINES);
- vec[0]= headvec[0] + norvech[0];
- vec[1]= headvec[1] + norvech[1];
- vec[2]= headvec[2] + norvech[2];
+
+ add_v3_v3v3(vec, headvec, norvech);
glVertex3fv(vec);
- vec[0]= tailvec[0] + norvect[0];
- vec[1]= tailvec[1] + norvect[1];
- vec[2]= tailvec[2] + norvect[2];
+
+ add_v3_v3v3(vec, tailvec, norvect);
glVertex3fv(vec);
- vec[0]= headvec[0] - norvech[0];
- vec[1]= headvec[1] - norvech[1];
- vec[2]= headvec[2] - norvech[2];
+
+ sub_v3_v3v3(vec, headvec, norvech);
glVertex3fv(vec);
- vec[0]= tailvec[0] - norvect[0];
- vec[1]= tailvec[1] - norvect[1];
- vec[2]= tailvec[2] - norvect[2];
+
+ sub_v3_v3v3(vec, tailvec, norvect);
glVertex3fv(vec);
glEnd();
@@ -861,7 +845,7 @@ static void draw_sphere_bone_wire(float smat[][4], float imat[][4], int armflag,
}
/* does wire only for outline selecting */
-static void draw_sphere_bone(int dt, int armflag, int boneflag, int constflag, unsigned int id, bPoseChannel *pchan, EditBone *ebone)
+static void draw_sphere_bone(int dt, int armflag, int boneflag, short constflag, unsigned int id, bPoseChannel *pchan, EditBone *ebone)
{
GLUquadricObj *qobj;
float head, tail, length;
@@ -991,7 +975,7 @@ static GLubyte bm_dot5[]= {0x0, 0x0, 0x10, 0x38, 0x7c, 0x38, 0x10, 0x0};
static GLubyte bm_dot7[]= {0x0, 0x38, 0x7C, 0xFE, 0xFE, 0xFE, 0x7C, 0x38};
-static void draw_line_bone(int armflag, int boneflag, int constflag, unsigned int id, bPoseChannel *pchan, EditBone *ebone)
+static void draw_line_bone(int armflag, int boneflag, short constflag, unsigned int id, bPoseChannel *pchan, EditBone *ebone)
{
float length;
@@ -1125,7 +1109,7 @@ static void draw_b_bone_boxes(int dt, bPoseChannel *pchan, float xwidth, float l
}
}
-static void draw_b_bone(int dt, int armflag, int boneflag, int constflag, unsigned int id, bPoseChannel *pchan, EditBone *ebone)
+static void draw_b_bone(int dt, int armflag, int boneflag, short constflag, unsigned int id, bPoseChannel *pchan, EditBone *ebone)
{
float xwidth, length, zwidth;
@@ -1238,7 +1222,7 @@ static void draw_wire_bone_segments(bPoseChannel *pchan, Mat4 *bbones, float len
}
}
-static void draw_wire_bone(int dt, int armflag, int boneflag, int constflag, unsigned int id, bPoseChannel *pchan, EditBone *ebone)
+static void draw_wire_bone(int dt, int armflag, int boneflag, short constflag, unsigned int id, bPoseChannel *pchan, EditBone *ebone)
{
Mat4 *bbones = NULL;
int segments = 0;
@@ -1288,7 +1272,7 @@ static void draw_wire_bone(int dt, int armflag, int boneflag, int constflag, uns
draw_wire_bone_segments(pchan, bbones, length, segments);
}
-static void draw_bone(int dt, int armflag, int boneflag, int constflag, unsigned int id, float length)
+static void draw_bone(int dt, int armflag, int boneflag, short constflag, unsigned int id, float length)
{
/* Draw a 3d octahedral bone, we use normalized space based on length,
@@ -1659,7 +1643,7 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base,
float smat[4][4], imat[4][4], bmat[4][4];
int index= -1;
short do_dashed= 3, draw_wire= 0;
- short flag, constflag;
+ int flag;
/* being set below */
arm->layer_used= 0;
@@ -1880,6 +1864,7 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base,
((G.f & G_PICKSEL)==0 || (bone->flag & BONE_UNSELECTABLE)==0) )
{
if (bone->layer & arm->layer) {
+ const short constflag= pchan->constflag;
if ((do_dashed & 1) && (pchan->parent)) {
/* Draw a line from our root to the parent's tip
* - only if V3D_HIDE_HELPLINES is enabled...
@@ -1901,16 +1886,16 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base,
* - only if temporary chain (i.e. "autoik")
*/
if (arm->flag & ARM_POSEMODE) {
- if (pchan->constflag & PCHAN_HAS_IK) {
+ if (constflag & PCHAN_HAS_IK) {
if (bone->flag & BONE_SELECTED) {
- if (pchan->constflag & PCHAN_HAS_TARGET) glColor3ub(200, 120, 0);
+ if (constflag & PCHAN_HAS_TARGET) glColor3ub(200, 120, 0);
else glColor3ub(200, 200, 50); // add theme!
glLoadName(index & 0xFFFF);
pchan_draw_IK_root_lines(pchan, !(do_dashed & 2));
}
}
- else if (pchan->constflag & PCHAN_HAS_SPLINEIK) {
+ else if (constflag & PCHAN_HAS_SPLINEIK) {
if (bone->flag & BONE_SELECTED) {
glColor3ub(150, 200, 50); // add theme!
@@ -1935,7 +1920,6 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base,
flag |= BONE_DRAW_ACTIVE;
/* extra draw service for pose mode */
- constflag= pchan->constflag;
/* set color-set to use */
set_pchan_colorset(ob, pchan);
diff --git a/source/blender/editors/space_view3d/drawmesh.c b/source/blender/editors/space_view3d/drawmesh.c
index db009e92be0..877bd4bc939 100644
--- a/source/blender/editors/space_view3d/drawmesh.c
+++ b/source/blender/editors/space_view3d/drawmesh.c
@@ -544,10 +544,8 @@ static int wpaint__setSolidDrawOptions(void *userData, int index, int *drawSmoot
{
Mesh *me = (Mesh*)userData;
- if (me->mface) {
- short matnr= me->mface[index].mat_nr;
- Material *ma= me->mat[matnr];
-
+ if (me->mat && me->mface) {
+ Material *ma= me->mat[me->mface[index].mat_nr];
if (ma && (ma->game.flag & GEMAT_INVISIBLE)) {
return 0;
}
diff --git a/source/blender/editors/space_view3d/view3d_buttons.c b/source/blender/editors/space_view3d/view3d_buttons.c
index d2cb2a6c46f..a949c6a2aa4 100644
--- a/source/blender/editors/space_view3d/view3d_buttons.c
+++ b/source/blender/editors/space_view3d/view3d_buttons.c
@@ -999,6 +999,7 @@ static void v3d_editarmature_buts(uiLayout *layout, Object *ob)
uiItemR(col, &eboneptr, "tail_radius", 0, "Radius", ICON_NONE);
uiItemR(col, &eboneptr, "roll", 0, "Roll", ICON_NONE);
+ uiItemR(col, &eboneptr, "envelope_distance", 0, "Envelope", ICON_NONE);
}
static void v3d_editmetaball_buts(uiLayout *layout, Object *ob)
diff --git a/source/blender/editors/space_view3d/view3d_fly.c b/source/blender/editors/space_view3d/view3d_fly.c
index 30d1a508888..02a6cee5140 100644
--- a/source/blender/editors/space_view3d/view3d_fly.c
+++ b/source/blender/editors/space_view3d/view3d_fly.c
@@ -35,6 +35,7 @@
#include "DNA_anim_types.h"
#include "DNA_scene_types.h"
#include "DNA_object_types.h"
+#include "DNA_camera_types.h"
#include "MEM_guardedalloc.h"
@@ -62,49 +63,57 @@
#include "view3d_intern.h" // own include
/* NOTE: these defines are saved in keymap files, do not change values but just add new ones */
-#define FLY_MODAL_CANCEL 1
-#define FLY_MODAL_CONFIRM 2
-#define FLY_MODAL_ACCELERATE 3
-#define FLY_MODAL_DECELERATE 4
-#define FLY_MODAL_PAN_ENABLE 5
-#define FLY_MODAL_PAN_DISABLE 6
-#define FLY_MODAL_DIR_FORWARD 7
-#define FLY_MODAL_DIR_BACKWARD 8
-#define FLY_MODAL_DIR_LEFT 9
-#define FLY_MODAL_DIR_RIGHT 10
-#define FLY_MODAL_DIR_UP 11
-#define FLY_MODAL_DIR_DOWN 12
-#define FLY_MODAL_AXIS_LOCK_X 13
-#define FLY_MODAL_AXIS_LOCK_Z 14
-#define FLY_MODAL_PRECISION_ENABLE 15
-#define FLY_MODAL_PRECISION_DISABLE 16
+enum {
+ FLY_MODAL_CANCEL= 1,
+ FLY_MODAL_CONFIRM,
+ FLY_MODAL_ACCELERATE,
+ FLY_MODAL_DECELERATE,
+ FLY_MODAL_PAN_ENABLE,
+ FLY_MODAL_PAN_DISABLE,
+ FLY_MODAL_DIR_FORWARD,
+ FLY_MODAL_DIR_BACKWARD,
+ FLY_MODAL_DIR_LEFT,
+ FLY_MODAL_DIR_RIGHT,
+ FLY_MODAL_DIR_UP,
+ FLY_MODAL_DIR_DOWN,
+ FLY_MODAL_AXIS_LOCK_X,
+ FLY_MODAL_AXIS_LOCK_Z,
+ FLY_MODAL_PRECISION_ENABLE,
+ FLY_MODAL_PRECISION_DISABLE,
+ FLY_MODAL_FREELOOK_ENABLE,
+ FLY_MODAL_FREELOOK_DISABLE
+
+};
/* called in transform_ops.c, on each regeneration of keymaps */
void fly_modal_keymap(wmKeyConfig *keyconf)
{
static EnumPropertyItem modal_items[] = {
- {FLY_MODAL_CANCEL, "CANCEL", 0, "Cancel", ""},
- {FLY_MODAL_CONFIRM, "CONFIRM", 0, "Confirm", ""},
- {FLY_MODAL_ACCELERATE, "ACCELERATE", 0, "Accelerate", ""},
- {FLY_MODAL_DECELERATE, "DECELERATE", 0, "Decelerate", ""},
+ {FLY_MODAL_CANCEL, "CANCEL", 0, "Cancel", ""},
+ {FLY_MODAL_CONFIRM, "CONFIRM", 0, "Confirm", ""},
+ {FLY_MODAL_ACCELERATE, "ACCELERATE", 0, "Accelerate", ""},
+ {FLY_MODAL_DECELERATE, "DECELERATE", 0, "Decelerate", ""},
- {FLY_MODAL_PAN_ENABLE, "PAN_ENABLE", 0, "Pan Enable", ""},
- {FLY_MODAL_PAN_DISABLE, "PAN_DISABLE", 0, "Pan Disable", ""},
+ {FLY_MODAL_PAN_ENABLE, "PAN_ENABLE", 0, "Pan Enable", ""},
+ {FLY_MODAL_PAN_DISABLE, "PAN_DISABLE", 0, "Pan Disable", ""},
- {FLY_MODAL_DIR_FORWARD, "FORWARD", 0, "Fly Forward", ""},
- {FLY_MODAL_DIR_BACKWARD,"BACKWARD", 0, "Fly Backward", ""},
- {FLY_MODAL_DIR_LEFT, "LEFT", 0, "Fly Left", ""},
- {FLY_MODAL_DIR_RIGHT, "RIGHT", 0, "Fly Right", ""},
- {FLY_MODAL_DIR_UP, "UP", 0, "Fly Up", ""},
- {FLY_MODAL_DIR_DOWN, "DOWN", 0, "Fly Down", ""},
+ {FLY_MODAL_DIR_FORWARD, "FORWARD", 0, "Fly Forward", ""},
+ {FLY_MODAL_DIR_BACKWARD,"BACKWARD", 0, "Fly Backward", ""},
+ {FLY_MODAL_DIR_LEFT, "LEFT", 0, "Fly Left", ""},
+ {FLY_MODAL_DIR_RIGHT, "RIGHT", 0, "Fly Right", ""},
+ {FLY_MODAL_DIR_UP, "UP", 0, "Fly Up", ""},
+ {FLY_MODAL_DIR_DOWN, "DOWN", 0, "Fly Down", ""},
- {FLY_MODAL_AXIS_LOCK_X, "AXIS_LOCK_X", 0, "X Axis Correction", "X axis correction (toggle)"},
- {FLY_MODAL_AXIS_LOCK_Z, "AXIS_LOCK_Z", 0, "X Axis Correction", "Z axis correction (toggle)"},
+ {FLY_MODAL_AXIS_LOCK_X, "AXIS_LOCK_X", 0, "X Axis Correction", "X axis correction (toggle)"},
+ {FLY_MODAL_AXIS_LOCK_Z, "AXIS_LOCK_Z", 0, "X Axis Correction", "Z axis correction (toggle)"},
- {FLY_MODAL_PRECISION_ENABLE, "PRECISION_ENABLE", 0, "Precision Enable", ""},
- {FLY_MODAL_PRECISION_DISABLE, "PRECISION_DISABLE", 0, "Precision Disable", ""},
+ {FLY_MODAL_PRECISION_ENABLE, "PRECISION_ENABLE", 0, "Precision Enable", ""},
+ {FLY_MODAL_PRECISION_DISABLE, "PRECISION_DISABLE", 0, "Precision Disable", ""},
- {0, NULL, 0, NULL, NULL}};
+ {FLY_MODAL_FREELOOK_ENABLE, "FREELOOK_ENABLE", 0, "Rotation Enable", ""},
+ {FLY_MODAL_FREELOOK_DISABLE, "FREELOOK_DISABLE", 0, "Rotation Disable", ""},
+
+ {0, NULL, 0, NULL, NULL}};
wmKeyMap *keymap= WM_modalkeymap_get(keyconf, "View3D Fly Modal");
@@ -122,10 +131,10 @@ void fly_modal_keymap(wmKeyConfig *keyconf)
WM_modalkeymap_add_item(keymap, SPACEKEY, KM_PRESS, KM_ANY, 0, FLY_MODAL_CONFIRM);
WM_modalkeymap_add_item(keymap, PADENTER, KM_PRESS, KM_ANY, 0, FLY_MODAL_CONFIRM);
- WM_modalkeymap_add_item(keymap, PADPLUSKEY, KM_PRESS, 0, 0, FLY_MODAL_ACCELERATE);
- WM_modalkeymap_add_item(keymap, PADMINUS, KM_PRESS, 0, 0, FLY_MODAL_DECELERATE);
- WM_modalkeymap_add_item(keymap, WHEELUPMOUSE, KM_PRESS, 0, 0, FLY_MODAL_ACCELERATE);
- WM_modalkeymap_add_item(keymap, WHEELDOWNMOUSE, KM_PRESS, 0, 0, FLY_MODAL_DECELERATE);
+ WM_modalkeymap_add_item(keymap, PADPLUSKEY, KM_PRESS, KM_ANY, 0, FLY_MODAL_ACCELERATE);
+ WM_modalkeymap_add_item(keymap, PADMINUS, KM_PRESS, KM_ANY, 0, FLY_MODAL_DECELERATE);
+ WM_modalkeymap_add_item(keymap, WHEELUPMOUSE, KM_PRESS, KM_ANY, 0, FLY_MODAL_ACCELERATE);
+ WM_modalkeymap_add_item(keymap, WHEELDOWNMOUSE, KM_PRESS, KM_ANY, 0, FLY_MODAL_DECELERATE);
WM_modalkeymap_add_item(keymap, MIDDLEMOUSE, KM_PRESS, KM_ANY, 0, FLY_MODAL_PAN_ENABLE);
WM_modalkeymap_add_item(keymap, MIDDLEMOUSE, KM_RELEASE, KM_ANY, 0, FLY_MODAL_PAN_DISABLE); /* XXX - Bug in the event system, middle mouse release doesnt work */
@@ -144,6 +153,9 @@ void fly_modal_keymap(wmKeyConfig *keyconf)
WM_modalkeymap_add_item(keymap, LEFTSHIFTKEY, KM_PRESS, KM_ANY, 0, FLY_MODAL_PRECISION_ENABLE);
WM_modalkeymap_add_item(keymap, LEFTSHIFTKEY, KM_RELEASE, KM_ANY, 0, FLY_MODAL_PRECISION_DISABLE);
+ WM_modalkeymap_add_item(keymap, LEFTCTRLKEY, KM_PRESS, KM_ANY, 0, FLY_MODAL_FREELOOK_ENABLE);
+ WM_modalkeymap_add_item(keymap, LEFTCTRLKEY, KM_RELEASE, KM_ANY, 0, FLY_MODAL_FREELOOK_DISABLE);
+
/* assign map to operators */
WM_modalkeymap_assign(keymap, "VIEW3D_OT_fly");
}
@@ -158,8 +170,9 @@ typedef struct FlyInfo {
wmTimer *timer; /* needed for redraws */
short state;
- short use_precision;
short redraw;
+ unsigned char use_precision;
+ unsigned char use_freelook; /* if the user presses shift they can look about without movinf the direction there looking */
int mval[2]; /* latest 2D mouse values */
wmNDOFMotionData* ndof; /* latest 3D mouse values */
@@ -187,6 +200,10 @@ typedef struct FlyInfo {
float rot_backup[4]; /* backup the views quat incase the user cancels flying in non camera mode. (quat for view, eul for camera) */
short persp_backup; /* remember if were ortho or not, only used for restoring the view if it was a ortho view */
+ short is_ortho_cam; /* are we flying an ortho camera in perspective view,
+ * which was originall in ortho view?
+ * could probably figure it out but better be explicit */
+
void *obtfm; /* backup the objects transform */
/* compare between last state */
@@ -289,7 +306,8 @@ static int initFlyInfo (bContext *C, FlyInfo *fly, wmOperator *op, wmEvent *even
fly->xlock_momentum=0.0f;
fly->zlock_momentum=0.0f;
fly->grid= 1.0f;
- fly->use_precision= 0;
+ fly->use_precision= FALSE;
+ fly->use_freelook= FALSE;
#ifdef NDOF_FLY_DRAW_TOOMUCH
fly->redraw= 1;
@@ -317,6 +335,17 @@ static int initFlyInfo (bContext *C, FlyInfo *fly, wmOperator *op, wmEvent *even
fly->persp_backup= fly->rv3d->persp;
fly->dist_backup= fly->rv3d->dist;
+
+ /* check for flying ortho camera - which we cant support well
+ * we _could_ also check for an ortho camera but this is easier */
+ if( (fly->rv3d->persp == RV3D_CAMOB) &&
+ (fly->v3d->camera != NULL) &&
+ (fly->rv3d->is_persp == FALSE))
+ {
+ ((Camera *)fly->v3d->camera->data)->type= CAM_PERSP;
+ fly->is_ortho_cam= TRUE;
+ }
+
if (fly->rv3d->persp==RV3D_CAMOB) {
Object *ob_back;
if ((U.uiflag & USER_CAM_LOCK_NO_PARENT)==0 && (fly->root_parent=fly->v3d->camera->parent)) {
@@ -420,6 +449,10 @@ static int flyEnd(bContext *C, FlyInfo *fly)
/*Done with correcting for the dist */
}
+ if(fly->is_ortho_cam) {
+ ((Camera *)fly->v3d->camera->data)->type= CAM_ORTHO;
+ }
+
rv3d->rflag &= ~RV3D_NAVIGATING;
//XXX2.5 BIF_view3d_previewrender_signal(fly->sa, PR_DBASE|PR_DISPRECT); /* not working at the moment not sure why */
@@ -516,10 +549,7 @@ static void flyEvent(FlyInfo *fly, wmEvent *event)
fly->speed= 0.0f;
}
else {
- if (event->shift)
- fly->speed += fly->grid*time_wheel * 0.1f;
- else
- fly->speed += fly->grid*time_wheel;
+ fly->speed += fly->grid*time_wheel * (fly->use_precision ? 0.1f : 1.0f);
}
break;
}
@@ -537,10 +567,7 @@ static void flyEvent(FlyInfo *fly, wmEvent *event)
fly->speed=0;
}
else {
- if (event->shift)
- fly->speed-= fly->grid*time_wheel * 0.1f;
- else
- fly->speed-= fly->grid*time_wheel;
+ fly->speed-= fly->grid*time_wheel * (fly->use_precision ? 0.1f : 1.0f);
}
break;
}
@@ -605,6 +632,13 @@ static void flyEvent(FlyInfo *fly, wmEvent *event)
case FLY_MODAL_PRECISION_DISABLE:
fly->use_precision= FALSE;
break;
+
+ case FLY_MODAL_FREELOOK_ENABLE:
+ fly->use_freelook= TRUE;
+ break;
+ case FLY_MODAL_FREELOOK_DISABLE:
+ fly->use_freelook= FALSE;
+ break;
}
}
}
@@ -704,8 +738,6 @@ static int flyApply(bContext *C, FlyInfo *fly)
// cent_orig[2], /* view center */
//XXX- can avoid using // cent[2], /* view center modified */
xmargin, ymargin; /* x and y margin are define the safe area where the mouses movement wont rotate the view */
- unsigned char
- apply_rotation= 1; /* if the user presses shift they can look about without movinf the direction there looking*/
#ifdef NDOF_FLY_DEBUG
static unsigned int iteration = 1;
@@ -888,7 +920,7 @@ static int flyApply(bContext *C, FlyInfo *fly)
}
- if (apply_rotation) {
+ if (!fly->use_freelook) {
/* Normal operation */
/* define dvec, view direction vector */
dvec_tmp[0]= dvec_tmp[1]= dvec_tmp[2]= 0.0f;
@@ -896,9 +928,15 @@ static int flyApply(bContext *C, FlyInfo *fly)
dvec_tmp[fly->axis]= 1.0f;
mul_m3_v3(mat, dvec_tmp);
-
- mul_v3_fl(dvec_tmp, fly->speed * time_redraw * 0.25f);
}
+ else {
+ normalize_v3_v3(dvec_tmp, fly->dvec_prev);
+ if(fly->speed < 0.0f) {
+ negate_v3(dvec_tmp);
+ }
+ }
+
+ mul_v3_fl(dvec_tmp, fly->speed * time_redraw * 0.25f);
}
/* impose a directional lag */
@@ -967,11 +1005,9 @@ static int flyApply_ndof(bContext *C, FlyInfo *fly)
float speed = 10.f; /* blender units per second */
/* ^^ this is ok for default cube scene, but should scale with.. something */
- float trans[3] = {
- lateral_sensitivity * ndof->tvec[0],
- vertical_sensitivity * ndof->tvec[1],
- forward_sensitivity * ndof->tvec[2]
- };
+ float trans[3] = {lateral_sensitivity * ndof->tvec[0],
+ vertical_sensitivity * ndof->tvec[1],
+ forward_sensitivity * ndof->tvec[2]};
if (fly->use_precision)
speed *= 0.2f;
diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c
index cda0dbe922d..79d6f279f0f 100644
--- a/source/blender/editors/transform/transform.c
+++ b/source/blender/editors/transform/transform.c
@@ -1362,6 +1362,11 @@ void saveTransform(bContext *C, TransInfo *t, wmOperator *op)
int proportional = 0;
PropertyRNA *prop;
+ // Save back mode in case we're in the generic operator
+ if ((prop= RNA_struct_find_property(op->ptr, "mode"))) {
+ RNA_property_enum_set(op->ptr, prop, t->mode);
+ }
+
if ((prop= RNA_struct_find_property(op->ptr, "value"))) {
float *values= (t->flag & T_AUTOVALUES) ? t->auto_values : t->values;
if (RNA_property_array_check(prop)) {
diff --git a/source/blender/editors/transform/transform.h b/source/blender/editors/transform/transform.h
index 062e13f1ad4..3f8999483d0 100644
--- a/source/blender/editors/transform/transform.h
+++ b/source/blender/editors/transform/transform.h
@@ -437,8 +437,8 @@ typedef struct TransInfo {
#define TD_BEZTRIPLE (1 << 12) /* if this is a bez triple, we need to restore the handles, if this is set transdata->misc.hdata needs freeing */
#define TD_NO_LOC (1 << 13) /* when this is set, don't apply translation changes to this element */
#define TD_NOTIMESNAP (1 << 14) /* for Graph Editor autosnap, indicates that point should not undergo autosnapping */
-#define TD_INTVALUES (1 << 15) /* for Graph Editor - curves that can only have int-values need their keyframes tagged with this */
-#define TD_MIRROR_EDGE (1 << 16) /* For editmode mirror, clamp to x = 0 */
+#define TD_INTVALUES (1 << 15) /* for Graph Editor - curves that can only have int-values need their keyframes tagged with this */
+#define TD_MIRROR_EDGE (1 << 16) /* For editmode mirror, clamp to x = 0 */
#define TD_MOVEHANDLE1 (1 << 17) /* For fcurve handles, move them along with their keyframes */
#define TD_MOVEHANDLE2 (1 << 18)
#define TD_PBONE_LOCAL_MTX_P (1 << 19) /* exceptional case with pose bone rotating when a parent bone has 'Local Location' option enabled and rotating also transforms it. */
diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c
index 10502609358..30436fad772 100644
--- a/source/blender/editors/transform/transform_conversions.c
+++ b/source/blender/editors/transform/transform_conversions.c
@@ -5358,6 +5358,11 @@ static void createTransNodeData(bContext *C, TransInfo *t)
SpaceNode *snode= t->sa->spacedata.first;
bNode *node;
+ if(!snode->edittree) {
+ t->total= 0;
+ return;
+ }
+
/* set transform flags on nodes */
for (node=snode->edittree->nodes.first; node; node=node->next) {
if ((node->flag & NODE_SELECT) || (node->parent && (node->parent->flag & NODE_TRANSFORM)))
@@ -5445,7 +5450,7 @@ void createTransData(bContext *C, TransInfo *t)
t->ext = NULL;
if (t->obedit->type == OB_MESH) {
createTransEditVerts(C, t);
- }
+ }
else if ELEM(t->obedit->type, OB_CURVE, OB_SURF) {
createTransCurveVerts(C, t);
}
@@ -5458,7 +5463,7 @@ void createTransData(bContext *C, TransInfo *t)
else if (t->obedit->type==OB_ARMATURE) {
t->flag &= ~T_PROP_EDIT;
createTransArmatureVerts(t);
- }
+ }
else {
printf("edit type not implemented!\n");
}
diff --git a/source/blender/editors/util/editmode_undo.c b/source/blender/editors/util/editmode_undo.c
index f2ab43c281b..9b938c44a5f 100644
--- a/source/blender/editors/util/editmode_undo.c
+++ b/source/blender/editors/util/editmode_undo.c
@@ -142,7 +142,7 @@ void undo_editmode_push(bContext *C, const char *name,
/* make new */
curundo= uel= MEM_callocN(sizeof(UndoElem), "undo editmode");
- strncpy(uel->name, name, MAXUNDONAME-1);
+ BLI_strncpy(uel->name, name, sizeof(uel->name));
BLI_addtail(&undobase, uel);
uel->getdata= getdata;
diff --git a/source/blender/editors/util/undo.c b/source/blender/editors/util/undo.c
index c1aca61f795..55fda84874d 100644
--- a/source/blender/editors/util/undo.c
+++ b/source/blender/editors/util/undo.c
@@ -471,7 +471,7 @@ static int undo_history_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(even
if(totitem > 0) {
uiPopupMenu *pup= uiPupMenuBegin(C, op->type->name, ICON_NONE);
uiLayout *layout= uiPupMenuLayout(pup);
- uiLayout *split= uiLayoutSplit(layout, 0, 0), *column;
+ uiLayout *split= uiLayoutSplit(layout, 0, 0), *column = NULL;
int i, c;
for(c=0, i=totitem-1; i >= 0; i--, c++) {
diff --git a/source/blender/editors/uvedit/uvedit_parametrizer.c b/source/blender/editors/uvedit/uvedit_parametrizer.c
index 0e56f8145b9..09446fc5eab 100644
--- a/source/blender/editors/uvedit/uvedit_parametrizer.c
+++ b/source/blender/editors/uvedit/uvedit_parametrizer.c
@@ -2626,7 +2626,7 @@ static PBool p_chart_abf_solve(PChart *chart)
PEdge *e, *e1, *e2, *e3;
PAbfSystem sys;
int i;
- float lastnorm, limit = (chart->nfaces > 100)? 1.0f: 0.001f;
+ float /* lastnorm, */ /* UNUSED */ limit = (chart->nfaces > 100)? 1.0f: 0.001f;
/* setup id's */
sys.ninterior = sys.nfaces = sys.nangles = 0;
@@ -2705,12 +2705,12 @@ static PBool p_chart_abf_solve(PChart *chart)
p_abf_compute_sines(&sys);
/* iteration */
- lastnorm = 1e10;
+ /* lastnorm = 1e10; */ /* UNUSED */
for (i = 0; i < ABF_MAX_ITER; i++) {
float norm = p_abf_compute_gradient(&sys, chart);
- lastnorm = norm;
+ /* lastnorm = norm; */ /* UNUSED */
if (norm < limit)
break;
@@ -3611,7 +3611,7 @@ static SmoothNode *p_node_new(MemArena *arena, SmoothTriangle **tri, int ntri, f
{
SmoothNode *node = BLI_memarena_alloc(arena, sizeof *node);
int axis, i, t1size = 0, t2size = 0;
- float split, mi, mx;
+ float split, /* mi, */ /* UNUSED */ mx;
SmoothTriangle **t1, **t2, *t;
node->tri = tri;
@@ -3652,7 +3652,7 @@ static SmoothNode *p_node_new(MemArena *arena, SmoothTriangle **tri, int ntri, f
node->axis = axis;
node->split = split;
- mi = bmin[axis];
+ /* mi = bmin[axis]; */ /* UNUSED */
mx = bmax[axis];
bmax[axis] = split;
node->c1 = p_node_new(arena, t1, t1size, bmin, bmax, depth+1);