From 29ea84015c77e02938fc8b3140f0474d9258e099 Mon Sep 17 00:00:00 2001 From: Gaia Clary Date: Sun, 23 Jun 2013 18:00:14 +0000 Subject: [PATCH 01/72] readded 'old' layout due to user complains --- source/blender/editors/space_view3d/view3d_buttons.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/source/blender/editors/space_view3d/view3d_buttons.c b/source/blender/editors/space_view3d/view3d_buttons.c index 54173893847..03892c5f57d 100644 --- a/source/blender/editors/space_view3d/view3d_buttons.c +++ b/source/blender/editors/space_view3d/view3d_buttons.c @@ -901,9 +901,9 @@ static void view3d_panel_vgroup(const bContext *C, Panel *pa) uiItemR(row, &tools_ptr, "vertex_group_subset", UI_ITEM_R_EXPAND, NULL, ICON_NONE); col = uiLayoutColumn(bcol, true); - box = uiLayoutBox(col); /* The list box */ + //box = uiLayoutBox(col); /* The list box */ - col = uiLayoutColumn(box, true); + //col = uiLayoutColumn(box, true); vgroup_validmap = ED_vgroup_subset_from_select_type(ob, subset_type, &vgroup_tot, &subset_count); for (i = 0, dg = ob->defbase.first; dg; i++, dg = dg->next) { if (vgroup_validmap[i]) { @@ -912,7 +912,7 @@ static void view3d_panel_vgroup(const bContext *C, Panel *pa) int x, xco = 0; row = uiLayoutRow(col, true); - uiBlockSetEmboss(block, UI_EMBOSSN); + //uiBlockSetEmboss(block, UI_EMBOSSN); /* The Weight Group Name */ @@ -956,7 +956,7 @@ static void view3d_panel_vgroup(const bContext *C, Panel *pa) } MEM_freeN((void *)vgroup_validmap); - uiBlockSetEmboss(block, UI_EMBOSS); + //uiBlockSetEmboss(block, UI_EMBOSS); yco -= 2; From 969a076b0202047508bedad0c7a91ee610e9422a Mon Sep 17 00:00:00 2001 From: Gaia Clary Date: Sun, 23 Jun 2013 18:21:26 +0000 Subject: [PATCH 02/72] Changed text alignment to better match old layout behaviour --- source/blender/editors/space_view3d/view3d_buttons.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/editors/space_view3d/view3d_buttons.c b/source/blender/editors/space_view3d/view3d_buttons.c index 03892c5f57d..603b8a377b3 100644 --- a/source/blender/editors/space_view3d/view3d_buttons.c +++ b/source/blender/editors/space_view3d/view3d_buttons.c @@ -921,7 +921,7 @@ static void view3d_panel_vgroup(const bContext *C, Panel *pa) xco, yco, (x = UI_UNIT_X * 5), UI_UNIT_Y, ""); but_ptr = uiButGetOperatorPtrRNA(but); RNA_int_set(but_ptr, "weight_group", i); - uiButSetFlag(but, UI_TEXT_LEFT); + uiButSetFlag(but, UI_TEXT_RIGHT); if (ob->actdef != i + 1) { uiButSetFlag(but, UI_BUT_INACTIVE); } From 4f6f24752bcaa18db129c0a0daf1ceb358d5865a Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 23 Jun 2013 19:04:12 +0000 Subject: [PATCH 03/72] correct example [#35850] documentation error for mathutils.Vector --- doc/python_api/examples/mathutils.Vector.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/python_api/examples/mathutils.Vector.py b/doc/python_api/examples/mathutils.Vector.py index bf1fc70353f..14b8829c3b5 100644 --- a/doc/python_api/examples/mathutils.Vector.py +++ b/doc/python_api/examples/mathutils.Vector.py @@ -4,7 +4,7 @@ import mathutils vec = mathutils.Vector((0.0, 0.0, 1.0)) # unit length vector -vec_a = vec.copy().normalize() +vec_a = vec.normalized() vec_b = mathutils.Vector((0.0, 1.0, 2.0)) From d7b99389ba97d2561e01e79d2abfe14703121dbf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrgen=20Herrmann?= Date: Sun, 23 Jun 2013 19:07:46 +0000 Subject: [PATCH 04/72] prevent cycles sm_35 kernel to be built on win32 with vs2012 because of ptxas crashes. Workaround to keep buildbot running. I filed a bug report to NVidia, will remove this as soon as the problem is fixed. --- build_files/scons/config/win32-vc-config.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/build_files/scons/config/win32-vc-config.py b/build_files/scons/config/win32-vc-config.py index 101d0402757..b9ec5208d53 100644 --- a/build_files/scons/config/win32-vc-config.py +++ b/build_files/scons/config/win32-vc-config.py @@ -215,7 +215,12 @@ BF_BOOST_LIBPATH = '${BF_BOOST}/lib' #CUDA WITH_BF_CYCLES_CUDA_BINARIES = False #BF_CYCLES_CUDA_NVCC = "" # Path to the nvidia compiler -BF_CYCLES_CUDA_BINARIES_ARCH = ['sm_20', 'sm_21', 'sm_30', 'sm_35'] + +# Workaround for ptxas.exe crash on VS2012 and cuda 5.5 +if VC_VERSION == '11.0': + BF_CYCLES_CUDA_BINARIES_ARCH = ['sm_20', 'sm_21', 'sm_30'] +else: + BF_CYCLES_CUDA_BINARIES_ARCH = ['sm_20', 'sm_21', 'sm_30', 'sm_35'] #Ray trace optimization WITH_BF_RAYOPTIMIZATION = True From 8acdc0515db613cb8dbeaa3152472fd61559bde5 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Sun, 23 Jun 2013 19:24:32 +0000 Subject: [PATCH 05/72] Fix #35847: cycles group nodes did not work well exposing inputs like normal or texture coordinate that should automatically use the default normal or texture coordinate appropriate for that node, rather than some fixed value specified by the user. --- intern/cycles/render/graph.cpp | 38 ++++++++++++++++------- intern/cycles/render/graph.h | 3 +- intern/cycles/render/nodes.cpp | 7 +++-- intern/cycles/render/nodes.h | 2 +- source/blender/nodes/intern/node_socket.c | 2 ++ 5 files changed, 36 insertions(+), 16 deletions(-) diff --git a/intern/cycles/render/graph.cpp b/intern/cycles/render/graph.cpp index f9a4a69c954..515bbe92335 100644 --- a/intern/cycles/render/graph.cpp +++ b/intern/cycles/render/graph.cpp @@ -199,7 +199,7 @@ void ShaderGraph::connect(ShaderOutput *from, ShaderInput *to) } /* add automatic conversion node in case of type mismatch */ - ShaderNode *convert = add(new ConvertNode(from->type, to->type)); + ShaderNode *convert = add(new ConvertNode(from->type, to->type, true)); connect(from, convert->inputs[0]); connect(convert->outputs[0], to); @@ -341,6 +341,24 @@ void ShaderGraph::remove_unneeded_nodes() } else { foreach(ShaderInput *to, links) { + /* remove any autoconvert nodes too if they lead to + * sockets with an automatically set default value */ + ShaderNode *tonode = to->parent; + + if(tonode->special_type == SHADER_SPECIAL_TYPE_AUTOCONVERT) { + bool all_links_removed = true; + + foreach(ShaderInput *autoin, tonode->outputs[0]->links) { + if(autoin->default_value == ShaderInput::NONE) + all_links_removed = false; + else + disconnect(autoin); + } + + if(all_links_removed) + removed[tonode->id] = true; + } + disconnect(to); /* transfer the default input value to the target socket */ @@ -352,10 +370,10 @@ void ShaderGraph::remove_unneeded_nodes() removed[proxy->id] = true; any_node_removed = true; } - - /* remove useless mix closures nodes */ - if(node->special_type == SHADER_SPECIAL_TYPE_MIX_CLOSURE) { + else if(node->special_type == SHADER_SPECIAL_TYPE_MIX_CLOSURE) { MixClosureNode *mix = static_cast(node); + + /* remove useless mix closures nodes */ if(mix->outputs[0]->links.size() && mix->inputs[1]->link == mix->inputs[2]->link) { ShaderOutput *output = mix->inputs[1]->link; vector inputs = mix->outputs[0]->links; @@ -370,15 +388,11 @@ void ShaderGraph::remove_unneeded_nodes() connect(output, input); } } - } - /* remove unused mix closure input when factor is 0.0 or 1.0 */ - if(node->special_type == SHADER_SPECIAL_TYPE_MIX_CLOSURE) { - MixClosureNode *mix = static_cast(node); - /* Check for closure links and make sure factor link is disconnected */ + /* remove unused mix closure input when factor is 0.0 or 1.0 */ + /* check for closure links and make sure factor link is disconnected */ if(mix->outputs[0]->links.size() && mix->inputs[1]->link && mix->inputs[2]->link && !mix->inputs[0]->link) { - - /* Factor 0.0 */ + /* factor 0.0 */ if(mix->inputs[0]->value.x == 0.0f) { ShaderOutput *output = mix->inputs[1]->link; vector inputs = mix->outputs[0]->links; @@ -393,7 +407,7 @@ void ShaderGraph::remove_unneeded_nodes() connect(output, input); } } - /* Factor 1.0 */ + /* factor 1.0 */ else if(mix->inputs[0]->value.x == 1.0f) { ShaderOutput *output = mix->inputs[2]->link; vector inputs = mix->outputs[0]->links; diff --git a/intern/cycles/render/graph.h b/intern/cycles/render/graph.h index 5c4a44af3fc..90e4760ba1c 100644 --- a/intern/cycles/render/graph.h +++ b/intern/cycles/render/graph.h @@ -75,7 +75,8 @@ enum ShaderBump { enum ShaderNodeSpecialType { SHADER_SPECIAL_TYPE_NONE, SHADER_SPECIAL_TYPE_PROXY, - SHADER_SPECIAL_TYPE_MIX_CLOSURE + SHADER_SPECIAL_TYPE_MIX_CLOSURE, + SHADER_SPECIAL_TYPE_AUTOCONVERT }; /* Enum diff --git a/intern/cycles/render/nodes.cpp b/intern/cycles/render/nodes.cpp index 3672b893825..029b948332a 100644 --- a/intern/cycles/render/nodes.cpp +++ b/intern/cycles/render/nodes.cpp @@ -1121,12 +1121,15 @@ void MappingNode::compile(OSLCompiler& compiler) /* Convert */ -ConvertNode::ConvertNode(ShaderSocketType from_, ShaderSocketType to_) +ConvertNode::ConvertNode(ShaderSocketType from_, ShaderSocketType to_, bool autoconvert) : ShaderNode("convert") { from = from_; to = to_; + if(autoconvert) + special_type = SHADER_SPECIAL_TYPE_AUTOCONVERT; + assert(from != to); if(from == SHADER_SOCKET_FLOAT) @@ -1271,7 +1274,7 @@ void ProxyNode::compile(OSLCompiler& compiler) /* BSDF Closure */ BsdfNode::BsdfNode(bool scattering_) -: ShaderNode("subsurface_scattering"), scattering(scattering_) +: ShaderNode("bsdf"), scattering(scattering_) { closure = ccl::CLOSURE_BSSRDF_ID; diff --git a/intern/cycles/render/nodes.h b/intern/cycles/render/nodes.h index f19e0742906..78920d589ed 100644 --- a/intern/cycles/render/nodes.h +++ b/intern/cycles/render/nodes.h @@ -182,7 +182,7 @@ public: class ConvertNode : public ShaderNode { public: - ConvertNode(ShaderSocketType from, ShaderSocketType to); + ConvertNode(ShaderSocketType from, ShaderSocketType to, bool autoconvert = false); SHADER_NODE_BASE_CLASS(ConvertNode) ShaderSocketType from, to; diff --git a/source/blender/nodes/intern/node_socket.c b/source/blender/nodes/intern/node_socket.c index 4b3cd1c22a1..0fd6d871dc1 100644 --- a/source/blender/nodes/intern/node_socket.c +++ b/source/blender/nodes/intern/node_socket.c @@ -308,6 +308,8 @@ void node_socket_copy_default_value(bNodeSocket *to, bNodeSocket *from) break; } } + + to->flag |= (from->flag & SOCK_HIDE_VALUE); } static void standard_node_socket_interface_init_socket(bNodeTree *UNUSED(ntree), bNodeSocket *stemp, bNode *UNUSED(node), bNodeSocket *sock, const char *UNUSED(data_path)) From 8ce83150a7fa3b0214e73c468abde70210c192b9 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 24 Jun 2013 02:30:09 +0000 Subject: [PATCH 06/72] remove unused var in view3d_panel_vgroup --- .../editors/space_view3d/view3d_buttons.c | 23 +++++++------------ 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/source/blender/editors/space_view3d/view3d_buttons.c b/source/blender/editors/space_view3d/view3d_buttons.c index 603b8a377b3..9fe9c6273c9 100644 --- a/source/blender/editors/space_view3d/view3d_buttons.c +++ b/source/blender/editors/space_view3d/view3d_buttons.c @@ -883,7 +883,6 @@ static void view3d_panel_vgroup(const bContext *C, Panel *pa) uiLayout *col, *bcol; uiLayout *row; - uiLayout *box; uiBut *but; bDeformGroup *dg; unsigned int i; @@ -901,9 +900,7 @@ static void view3d_panel_vgroup(const bContext *C, Panel *pa) uiItemR(row, &tools_ptr, "vertex_group_subset", UI_ITEM_R_EXPAND, NULL, ICON_NONE); col = uiLayoutColumn(bcol, true); - //box = uiLayoutBox(col); /* The list box */ - //col = uiLayoutColumn(box, true); vgroup_validmap = ED_vgroup_subset_from_select_type(ob, subset_type, &vgroup_tot, &subset_count); for (i = 0, dg = ob->defbase.first; dg; i++, dg = dg->next) { if (vgroup_validmap[i]) { @@ -912,8 +909,6 @@ static void view3d_panel_vgroup(const bContext *C, Panel *pa) int x, xco = 0; row = uiLayoutRow(col, true); - //uiBlockSetEmboss(block, UI_EMBOSSN); - /* The Weight Group Name */ ot = ot_weight_set_active; @@ -930,8 +925,8 @@ static void view3d_panel_vgroup(const bContext *C, Panel *pa) /* The weight group value */ /* To be reworked still */ but = uiDefButF(block, NUM, B_VGRP_PNL_EDIT_SINGLE + i, "", - xco, yco, (x = UI_UNIT_X * 4), UI_UNIT_Y, - &dw->weight, 0.0, 1.0, 1, 3, ""); + xco, yco, (x = UI_UNIT_X * 4), UI_UNIT_Y, + &dw->weight, 0.0, 1.0, 1, 3, ""); uiButSetFlag(but, UI_TEXT_LEFT); xco += x; @@ -956,22 +951,20 @@ static void view3d_panel_vgroup(const bContext *C, Panel *pa) } MEM_freeN((void *)vgroup_validmap); - //uiBlockSetEmboss(block, UI_EMBOSS); - yco -= 2; col = uiLayoutColumn(pa->layout, true); row = uiLayoutRow(col, true); ot = WM_operatortype_find("OBJECT_OT_vertex_weight_normalize_active", 1); - but = uiDefButO_ptr(block, BUT, ot, WM_OP_EXEC_DEFAULT, "Normalize", - 0, yco,UI_UNIT_X * 5, UI_UNIT_Y, - TIP_("Normalize active vertex weights")); + but = uiDefButO_ptr(block, BUT, ot, WM_OP_EXEC_DEFAULT, "Normalize", + 0, yco,UI_UNIT_X * 5, UI_UNIT_Y, + TIP_("Normalize active vertex weights")); ot = WM_operatortype_find("OBJECT_OT_vertex_weight_copy", 1); - but = uiDefButO_ptr(block, BUT, ot, WM_OP_EXEC_DEFAULT, "Copy", - UI_UNIT_X * 5, yco,UI_UNIT_X * 5, UI_UNIT_Y, - TIP_("Copy active vertex to other selected verts")); + but = uiDefButO_ptr(block, BUT, ot, WM_OP_EXEC_DEFAULT, "Copy", + UI_UNIT_X * 5, yco,UI_UNIT_X * 5, UI_UNIT_Y, + TIP_("Copy active vertex to other selected verts")); } } From 0f4802817340794b50b09daead59c54e33caf09d Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 24 Jun 2013 02:57:06 +0000 Subject: [PATCH 07/72] fix [#35825] "Find missing files" seems to search for files which are not missing Made finding paths for files that exist optional (and off by default), since its handy for relocating projects. --- source/blender/blenkernel/BKE_bpath.h | 3 ++- source/blender/blenkernel/intern/bpath.c | 17 +++++++++++++---- source/blender/editors/space_info/info_ops.c | 10 +++++++--- 3 files changed, 22 insertions(+), 8 deletions(-) diff --git a/source/blender/blenkernel/BKE_bpath.h b/source/blender/blenkernel/BKE_bpath.h index 16a8b1be85b..55320b66054 100644 --- a/source/blender/blenkernel/BKE_bpath.h +++ b/source/blender/blenkernel/BKE_bpath.h @@ -65,7 +65,8 @@ void BKE_bpath_list_free(void *ls_handle); /* creates a text file with missing files if there are any */ void BKE_bpath_missing_files_check(struct Main *bmain, struct ReportList *reports); -void BKE_bpath_missing_files_find(struct Main *bmain, const char *searchpath, struct ReportList *reports); +void BKE_bpath_missing_files_find(struct Main *bmain, const char *searchpath, struct ReportList *reports, + const bool find_all); void BKE_bpath_relative_convert(struct Main *bmain, const char *basedir, struct ReportList *reports); void BKE_bpath_absolute_convert(struct Main *bmain, const char *basedir, struct ReportList *reports); diff --git a/source/blender/blenkernel/intern/bpath.c b/source/blender/blenkernel/intern/bpath.c index fe86b413a99..a4cb7cbf628 100644 --- a/source/blender/blenkernel/intern/bpath.c +++ b/source/blender/blenkernel/intern/bpath.c @@ -263,8 +263,9 @@ static int findFileRecursive(char *filename_new, typedef struct BPathFind_Data { const char *basedir; - char searchdir[FILE_MAX]; + const char *searchdir; ReportList *reports; + bool find_all; } BPathFind_Data; static int findMissingFiles_visit_cb(void *userdata, char *path_dst, const char *path_src) @@ -276,6 +277,12 @@ static int findMissingFiles_visit_cb(void *userdata, char *path_dst, const char int recur_depth = 0; int found; + if (data->find_all == false) { + if (BLI_exists(path_src)) { + return false; + } + } + filename_new[0] = '\0'; found = findFileRecursive(filename_new, @@ -300,14 +307,16 @@ static int findMissingFiles_visit_cb(void *userdata, char *path_dst, const char } } -void BKE_bpath_missing_files_find(Main *bmain, const char *searchpath, ReportList *reports) +void BKE_bpath_missing_files_find(Main *bmain, const char *searchpath, ReportList *reports, + const bool find_all) { struct BPathFind_Data data = {NULL}; data.reports = reports; - BLI_split_dir_part(searchpath, data.searchdir, sizeof(data.searchdir)); + data.searchdir = searchpath; + data.find_all = find_all; - BKE_bpath_traverse_main(bmain, findMissingFiles_visit_cb, 0, (void *)&data); + BKE_bpath_traverse_main(bmain, findMissingFiles_visit_cb, BKE_BPATH_TRAVERSE_ABS, (void *)&data); } /* Run a visitor on a string, replacing the contents of the string as needed. */ diff --git a/source/blender/editors/space_info/info_ops.c b/source/blender/editors/space_info/info_ops.c index c68473820e3..4e367c1d48d 100644 --- a/source/blender/editors/space_info/info_ops.c +++ b/source/blender/editors/space_info/info_ops.c @@ -422,8 +422,10 @@ void FILE_OT_report_missing_files(wmOperatorType *ot) static int find_missing_files_exec(bContext *C, wmOperator *op) { Main *bmain = CTX_data_main(C); - const char *searchpath = RNA_string_get_alloc(op->ptr, "filepath", NULL, 0); - BKE_bpath_missing_files_find(bmain, searchpath, op->reports); + const char *searchpath = RNA_string_get_alloc(op->ptr, "directory", NULL, 0); + const bool find_all = RNA_boolean_get(op->ptr, "find_all"); + + BKE_bpath_missing_files_find(bmain, searchpath, op->reports, find_all); MEM_freeN((void *)searchpath); return OPERATOR_FINISHED; @@ -451,8 +453,10 @@ void FILE_OT_find_missing_files(wmOperatorType *ot) ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; /* properties */ + RNA_def_boolean(ot->srna, "find_all", false, "Find All", "Find all files in the search path (not just missing)"); + WM_operator_properties_filesel(ot, 0, FILE_SPECIAL, FILE_OPENFILE, - WM_FILESEL_FILEPATH, FILE_DEFAULTDISPLAY); + WM_FILESEL_DIRECTORY, FILE_DEFAULTDISPLAY); } /********************* report box operator *********************/ From 423ee06625898d5094bfc78401b2e2204fe7118e Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 24 Jun 2013 03:06:32 +0000 Subject: [PATCH 08/72] use booleans for bpath api. --- source/blender/blenkernel/BKE_bpath.h | 4 +- source/blender/blenkernel/intern/blender.c | 4 +- source/blender/blenkernel/intern/bpath.c | 88 +++++++++++----------- source/blender/python/intern/bpy.c | 2 +- 4 files changed, 49 insertions(+), 49 deletions(-) diff --git a/source/blender/blenkernel/BKE_bpath.h b/source/blender/blenkernel/BKE_bpath.h index 55320b66054..90d5ca18b0c 100644 --- a/source/blender/blenkernel/BKE_bpath.h +++ b/source/blender/blenkernel/BKE_bpath.h @@ -41,12 +41,12 @@ struct ReportList; /* Function that does something with an ID's file path. Should return 1 if the * path has changed, and in that case, should write the result to pathOut. */ -typedef int (*BPathVisitor)(void *userdata, char *path_dst, const char *path_src); +typedef bool (*BPathVisitor)(void *userdata, char *path_dst, const char *path_src); /* Executes 'visit' for each path associated with 'id'. */ void BKE_bpath_traverse_id(struct Main *bmain, struct ID *id, BPathVisitor visit_cb, const int flag, void *userdata); void BKE_bpath_traverse_id_list(struct Main *bmain, struct ListBase *lb, BPathVisitor visit_cb, const int flag, void *userdata); void BKE_bpath_traverse_main(struct Main *bmain, BPathVisitor visit_cb, const int flag, void *userdata); -int BKE_bpath_relocate_visitor(void *oldbasepath, char *path_dst, const char *path_src); +bool BKE_bpath_relocate_visitor(void *oldbasepath, char *path_dst, const char *path_src); /* Functions for temp backup/restore of paths, path count must NOT change */ void *BKE_bpath_list_backup(struct Main *bmain, const int flag); diff --git a/source/blender/blenkernel/intern/blender.c b/source/blender/blenkernel/intern/blender.c index 1e7aba6d25b..29a8a615601 100644 --- a/source/blender/blenkernel/intern/blender.c +++ b/source/blender/blenkernel/intern/blender.c @@ -170,11 +170,11 @@ static void clear_global(void) G.main = NULL; } -static int clean_paths_visit_cb(void *UNUSED(userdata), char *path_dst, const char *path_src) +static bool clean_paths_visit_cb(void *UNUSED(userdata), char *path_dst, const char *path_src) { strcpy(path_dst, path_src); BLI_clean(path_dst); - return (strcmp(path_dst, path_src) == 0) ? FALSE : TRUE; + return !STREQ(path_dst, path_src); } /* make sure path names are correct for OS */ diff --git a/source/blender/blenkernel/intern/bpath.c b/source/blender/blenkernel/intern/bpath.c index a4cb7cbf628..6a51dadd28e 100644 --- a/source/blender/blenkernel/intern/bpath.c +++ b/source/blender/blenkernel/intern/bpath.c @@ -85,7 +85,7 @@ #include "BKE_bpath.h" /* own include */ -static int checkMissingFiles_visit_cb(void *userdata, char *UNUSED(path_dst), const char *path_src) +static bool checkMissingFiles_visit_cb(void *userdata, char *UNUSED(path_dst), const char *path_src) { ReportList *reports = (ReportList *)userdata; @@ -93,7 +93,7 @@ static int checkMissingFiles_visit_cb(void *userdata, char *UNUSED(path_dst), co BKE_reportf(reports, RPT_WARNING, "Path '%s' not found", path_src); } - return FALSE; + return false; } /* high level function */ @@ -111,14 +111,14 @@ typedef struct BPathRemap_Data { int count_failed; } BPathRemap_Data; -static int makeFilesRelative_visit_cb(void *userdata, char *path_dst, const char *path_src) +static bool makeFilesRelative_visit_cb(void *userdata, char *path_dst, const char *path_src) { BPathRemap_Data *data = (BPathRemap_Data *)userdata; data->count_tot++; if (BLI_path_is_rel(path_src)) { - return FALSE; /* already relative */ + return false; /* already relative */ } else { strcpy(path_dst, path_src); @@ -130,7 +130,7 @@ static int makeFilesRelative_visit_cb(void *userdata, char *path_dst, const char BKE_reportf(data->reports, RPT_WARNING, "Path '%s' cannot be made relative", path_src); data->count_failed++; } - return TRUE; + return true; } } @@ -153,26 +153,26 @@ void BKE_bpath_relative_convert(Main *bmain, const char *basedir, ReportList *re data.count_tot, data.count_changed, data.count_failed); } -static int makeFilesAbsolute_visit_cb(void *userdata, char *path_dst, const char *path_src) +static bool makeFilesAbsolute_visit_cb(void *userdata, char *path_dst, const char *path_src) { BPathRemap_Data *data = (BPathRemap_Data *)userdata; data->count_tot++; - if (BLI_path_is_rel(path_src) == FALSE) { - return FALSE; /* already absolute */ + if (BLI_path_is_rel(path_src) == false) { + return false; /* already absolute */ } else { strcpy(path_dst, path_src); BLI_path_abs(path_dst, data->basedir); - if (BLI_path_is_rel(path_dst) == FALSE) { + if (BLI_path_is_rel(path_dst) == false) { data->count_changed++; } else { BKE_reportf(data->reports, RPT_WARNING, "Path '%s' cannot be made absolute", path_src); data->count_failed++; } - return TRUE; + return true; } } @@ -218,7 +218,7 @@ static int findFileRecursive(char *filename_new, struct stat status; char path[FILE_MAX]; int size; - int found = FALSE; + bool found = false; dir = opendir(dirname); @@ -230,7 +230,7 @@ static int findFileRecursive(char *filename_new, while ((de = readdir(dir)) != NULL) { - if (strcmp(".", de->d_name) == 0 || strcmp("..", de->d_name) == 0) + if (STREQ(".", de->d_name) || STREQ("..", de->d_name)) continue; BLI_join_dirfile(path, sizeof(path), dirname, de->d_name); @@ -239,13 +239,13 @@ static int findFileRecursive(char *filename_new, continue; /* cant stat, don't bother with this file, could print debug info here */ if (S_ISREG(status.st_mode)) { /* is file */ - if (strncmp(filename, de->d_name, FILE_MAX) == 0) { /* name matches */ + if (STREQLEN(filename, de->d_name, FILE_MAX)) { /* name matches */ /* open the file to read its size */ size = status.st_size; if ((size > 0) && (size > *filesize)) { /* find the biggest file */ *filesize = size; BLI_strncpy(filename_new, path, FILE_MAX); - found = TRUE; + found = true; } } } @@ -268,7 +268,7 @@ typedef struct BPathFind_Data { bool find_all; } BPathFind_Data; -static int findMissingFiles_visit_cb(void *userdata, char *path_dst, const char *path_src) +static bool findMissingFiles_visit_cb(void *userdata, char *path_dst, const char *path_src) { BPathFind_Data *data = (BPathFind_Data *)userdata; char filename_new[FILE_MAX]; @@ -293,17 +293,17 @@ static int findMissingFiles_visit_cb(void *userdata, char *path_dst, const char BKE_reportf(data->reports, RPT_WARNING, "Could not open directory '%s'", BLI_path_basename(data->searchdir)); - return FALSE; + return false; } - else if (found == FALSE) { + else if (found == false) { BKE_reportf(data->reports, RPT_WARNING, "Could not find '%s' in '%s'", BLI_path_basename((char *)path_src), data->searchdir); - return FALSE; + return false; } else { BLI_strncpy(path_dst, filename_new, FILE_MAX); - return TRUE; + return true; } } @@ -320,7 +320,7 @@ void BKE_bpath_missing_files_find(Main *bmain, const char *searchpath, ReportLis } /* Run a visitor on a string, replacing the contents of the string as needed. */ -static int rewrite_path_fixed(char *path, BPathVisitor visit_cb, const char *absbase, void *userdata) +static bool rewrite_path_fixed(char *path, BPathVisitor visit_cb, const char *absbase, void *userdata) { char path_src_buf[FILE_MAX]; const char *path_src; @@ -337,18 +337,18 @@ static int rewrite_path_fixed(char *path, BPathVisitor visit_cb, const char *abs if (visit_cb(userdata, path_dst, path_src)) { BLI_strncpy(path, path_dst, FILE_MAX); - return TRUE; + return true; } else { - return FALSE; + return false; } } -static int rewrite_path_fixed_dirfile(char path_dir[FILE_MAXDIR], - char path_file[FILE_MAXFILE], - BPathVisitor visit_cb, - const char *absbase, - void *userdata) +static bool rewrite_path_fixed_dirfile(char path_dir[FILE_MAXDIR], + char path_file[FILE_MAXFILE], + BPathVisitor visit_cb, + const char *absbase, + void *userdata) { char path_src[FILE_MAX]; char path_dst[FILE_MAX]; @@ -361,14 +361,14 @@ static int rewrite_path_fixed_dirfile(char path_dir[FILE_MAXDIR], if (visit_cb(userdata, path_dst, (const char *)path_src)) { BLI_split_dirfile(path_dst, path_dir, path_file, FILE_MAXDIR, FILE_MAXFILE); - return TRUE; + return true; } else { - return FALSE; + return false; } } -static int rewrite_path_alloc(char **path, BPathVisitor visit_cb, const char *absbase, void *userdata) +static bool rewrite_path_alloc(char **path, BPathVisitor visit_cb, const char *absbase, void *userdata) { char path_src_buf[FILE_MAX]; const char *path_src; @@ -386,10 +386,10 @@ static int rewrite_path_alloc(char **path, BPathVisitor visit_cb, const char *ab if (visit_cb(userdata, path_dst, path_src)) { MEM_freeN((*path)); (*path) = BLI_strdup(path_dst); - return TRUE; + return true; } else { - return FALSE; + return false; } } @@ -504,7 +504,7 @@ void BKE_bpath_traverse_id(Main *bmain, ID *id, BPathVisitor visit_cb, const int { VFont *vfont = (VFont *)id; if (vfont->packedfile == NULL || (flag & BKE_BPATH_TRAVERSE_SKIP_PACKED) == 0) { - if (BKE_vfont_is_builtin(vfont) == FALSE) { + if (BKE_vfont_is_builtin(vfont) == false) { rewrite_path_fixed(((VFont *)id)->name, visit_cb, absbase, bpath_user_data); } } @@ -641,7 +641,7 @@ void BKE_bpath_traverse_main(Main *bmain, BPathVisitor visit_cb, const int flag, /* Rewrites a relative path to be relative to the main file - unless the path is * absolute, in which case it is not altered. */ -int BKE_bpath_relocate_visitor(void *pathbase_v, char *path_dst, const char *path_src) +bool BKE_bpath_relocate_visitor(void *pathbase_v, char *path_dst, const char *path_src) { /* be sure there is low chance of the path being too short */ char filepath[(FILE_MAXDIR * 2) + FILE_MAXFILE]; @@ -651,7 +651,7 @@ int BKE_bpath_relocate_visitor(void *pathbase_v, char *path_dst, const char *pat if (BLI_path_is_rel(base_old)) { printf("%s: error, old base path '%s' is not absolute.\n", __func__, base_old); - return FALSE; + return false; } /* Make referenced file absolute. This would be a side-effect of @@ -664,11 +664,11 @@ int BKE_bpath_relocate_visitor(void *pathbase_v, char *path_dst, const char *pat BLI_cleanup_file(base_new, filepath); BLI_path_rel(filepath, base_new); BLI_strncpy(path_dst, filepath, FILE_MAX); - return TRUE; + return true; } else { /* Path was not relative to begin with. */ - return FALSE; + return false; } } @@ -683,7 +683,7 @@ struct PathStore { struct PathStore *next, *prev; }; -static int bpath_list_append(void *userdata, char *UNUSED(path_dst), const char *path_src) +static bool bpath_list_append(void *userdata, char *UNUSED(path_dst), const char *path_src) { /* store the path and string in a single alloc */ ListBase *ls = userdata; @@ -693,24 +693,24 @@ static int bpath_list_append(void *userdata, char *UNUSED(path_dst), const char memcpy(filepath, path_src, path_size); BLI_addtail(ls, path_store); - return FALSE; + return false; } -static int bpath_list_restore(void *userdata, char *path_dst, const char *path_src) +static bool bpath_list_restore(void *userdata, char *path_dst, const char *path_src) { /* assume ls->first wont be NULL because the number of paths can't change! * (if they do caller is wrong) */ ListBase *ls = userdata; struct PathStore *path_store = ls->first; const char *filepath = (char *)(path_store + 1); - int ret; + bool ret; - if (strcmp(path_src, filepath) == 0) { - ret = FALSE; + if (STREQ(path_src, filepath)) { + ret = false; } else { BLI_strncpy(path_dst, filepath, FILE_MAX); - ret = TRUE; + ret = true; } BLI_freelinkN(ls, path_store); diff --git a/source/blender/python/intern/bpy.c b/source/blender/python/intern/bpy.c index 775cce3880b..aa4b8117e3a 100644 --- a/source/blender/python/intern/bpy.c +++ b/source/blender/python/intern/bpy.c @@ -90,7 +90,7 @@ static PyObject *bpy_script_paths(PyObject *UNUSED(self)) return ret; } -static int bpy_blend_paths_visit_cb(void *userdata, char *UNUSED(path_dst), const char *path_src) +static bool bpy_blend_paths_visit_cb(void *userdata, char *UNUSED(path_dst), const char *path_src) { PyObject *list = (PyObject *)userdata; PyObject *item = PyUnicode_DecodeFSDefault(path_src); From 23c0e0d996571cdcb896526b8a96b1b988f6c8bf Mon Sep 17 00:00:00 2001 From: Daniel Stokes Date: Mon, 24 Jun 2013 04:21:17 +0000 Subject: [PATCH 09/72] BGE: fix [#35811] Blenderplayer crash on closing if file saved with an actual version. Making sure free_nodesystem() is called before BLO_blendfiledata_free() fixes the problem. free_nodesystem() relies on blendfiledata. --- source/gameengine/GamePlayer/ghost/GPG_ghost.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp b/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp index 5d843cccf85..2c642d4bd04 100644 --- a/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp +++ b/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp @@ -1031,6 +1031,9 @@ int main(int argc, char** argv) * removal is needed else the system will free an already freed value */ system->removeEventConsumer(&app); + /* nodesystem relies on blendfile data, free it first */ + free_nodesystem(); + BLO_blendfiledata_free(bfd); if (python_main) MEM_freeN(python_main); } @@ -1061,7 +1064,6 @@ int main(int argc, char** argv) IMB_exit(); BKE_images_exit(); - free_nodesystem(); SYS_DeleteSystem(syshandle); From dbec3af9944c7cf0448b17221dc915ce44a3dc09 Mon Sep 17 00:00:00 2001 From: Mitchell Stokes Date: Mon, 24 Jun 2013 04:24:01 +0000 Subject: [PATCH 10/72] BGE: Fix for [#35737] "Action actuator in property mode don't work with values lower then 1" reported by HG1. IPOs were only set as "initialized" if the current time was greater than 0.0, which is why negative values weren't working. --- source/gameengine/Ketsji/KX_IPO_SGController.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/gameengine/Ketsji/KX_IPO_SGController.cpp b/source/gameengine/Ketsji/KX_IPO_SGController.cpp index c5e11195547..4c43633d4c5 100644 --- a/source/gameengine/Ketsji/KX_IPO_SGController.cpp +++ b/source/gameengine/Ketsji/KX_IPO_SGController.cpp @@ -132,7 +132,7 @@ bool KX_IpoSGController::Update(double currentTime) SG_Spatial* ob = (SG_Spatial*)m_pObject; //initialization on the first frame of the IPO - if (! m_ipo_start_initialized && currentTime > 0.0) { + if (! m_ipo_start_initialized && currentTime != 0.0) { m_ipo_start_point = ob->GetLocalPosition(); m_ipo_start_orient = ob->GetLocalOrientation(); m_ipo_start_scale = ob->GetLocalScale(); From 15aed4127b3537f2efd6265acab8d73c26136754 Mon Sep 17 00:00:00 2001 From: Thomas Dinges Date: Mon, 24 Jun 2013 04:28:07 +0000 Subject: [PATCH 11/72] Fix [#35852], hide Cycles sampling pattern menu, when using GPU. --- intern/cycles/blender/addon/ui.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/intern/cycles/blender/addon/ui.py b/intern/cycles/blender/addon/ui.py index 273b099a99d..dc632b9bb2c 100644 --- a/intern/cycles/blender/addon/ui.py +++ b/intern/cycles/blender/addon/ui.py @@ -85,7 +85,7 @@ class CyclesRender_PT_sampling(CyclesButtonsPanel, Panel): sub.prop(cscene, "mesh_light_samples", text="Mesh Light") sub.prop(cscene, "subsurface_samples", text="Subsurface") - if cscene.feature_set == 'EXPERIMENTAL': + if cscene.feature_set == 'EXPERIMENTAL' and (device_type == 'NONE' or cscene.device == 'CPU'): layout.row().prop(cscene, "sampling_pattern", text="Pattern") for rl in scene.render.layers: From bc79e226eee4fd218b3d047007a5609a8f7c39b2 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 24 Jun 2013 04:41:03 +0000 Subject: [PATCH 12/72] de-duplicate ED_mesh_active_dvert_* functions. not to devs - please don't just copy static functions around, make them api calls and add to headers. --- source/blender/editors/include/ED_mesh.h | 6 ++- source/blender/editors/mesh/meshtools.c | 51 +++++++++++++++++++ source/blender/editors/object/object_vgroup.c | 50 ------------------ .../editors/space_view3d/view3d_buttons.c | 51 ------------------- 4 files changed, 56 insertions(+), 102 deletions(-) diff --git a/source/blender/editors/include/ED_mesh.h b/source/blender/editors/include/ED_mesh.h index 1ee3ae1283d..3e0269aa138 100644 --- a/source/blender/editors/include/ED_mesh.h +++ b/source/blender/editors/include/ED_mesh.h @@ -74,7 +74,6 @@ struct Object; struct rcti; struct MeshStatVis; - /* editmesh_utils.c */ void EDBM_verts_mirror_cache_begin_ex(struct BMEditMesh *em, const int axis, const bool use_self, const bool use_select, @@ -313,6 +312,11 @@ bool ED_mesh_pick_vert(struct bContext *C, struct Object *ob, const int mva bool ED_mesh_pick_face(struct bContext *C, struct Object *ob, const int mval[2], unsigned int *index, int size); bool ED_mesh_pick_face_vert(struct bContext *C, struct Object *ob, const int mval[2], unsigned int *index, int size); + +struct MDeformVert *ED_mesh_active_dvert_get_em(struct Object *ob, struct BMVert **r_eve); +struct MDeformVert *ED_mesh_active_dvert_get_ob(struct Object *ob, int *r_index); +struct MDeformVert *ED_mesh_active_dvert_get_only(struct Object *ob); + #define ED_MESH_PICK_DEFAULT_VERT_SIZE 50 #define ED_MESH_PICK_DEFAULT_FACE_SIZE 3 diff --git a/source/blender/editors/mesh/meshtools.c b/source/blender/editors/mesh/meshtools.c index e34b792ab69..b8b245802bf 100644 --- a/source/blender/editors/mesh/meshtools.c +++ b/source/blender/editors/mesh/meshtools.c @@ -1362,3 +1362,54 @@ bool ED_mesh_pick_vert(bContext *C, Object *ob, const int mval[2], unsigned int return true; } + + +MDeformVert *ED_mesh_active_dvert_get_em(Object *ob, BMVert **r_eve) +{ + if (ob->mode & OB_MODE_EDIT && ob->type == OB_MESH && ob->defbase.first) { + Mesh *me = ob->data; + BMEditMesh *em = me->edit_btmesh; + const int cd_dvert_offset = CustomData_get_offset(&em->bm->vdata, CD_MDEFORMVERT); + + if (cd_dvert_offset != -1) { + BMEditSelection *ese = (BMEditSelection *)em->bm->selected.last; + + if (ese && ese->htype == BM_VERT) { + BMVert *eve = (BMVert *)ese->ele; + if (r_eve) *r_eve = eve; + return BM_ELEM_CD_GET_VOID_P(eve, cd_dvert_offset); + } + } + } + + if (r_eve) *r_eve = NULL; + return NULL; +} + +MDeformVert *ED_mesh_active_dvert_get_ob(Object *ob, int *r_index) +{ + Mesh *me = ob->data; + int index = BKE_mesh_mselect_active_get(me, ME_VSEL); + if (r_index) *r_index = index; + if (index == -1 || me->dvert == NULL) { + return NULL; + } + else { + return me->dvert + index; + } +} + +MDeformVert *ED_mesh_active_dvert_get_only(Object *ob) +{ + if (ob->type == OB_MESH) { + if (ob->mode & OB_MODE_EDIT) { + return ED_mesh_active_dvert_get_em(ob, NULL); + } + else { + return ED_mesh_active_dvert_get_ob(ob, NULL); + } + } + else { + return NULL; + } +} diff --git a/source/blender/editors/object/object_vgroup.c b/source/blender/editors/object/object_vgroup.c index 6da403074e8..2f163a358bc 100644 --- a/source/blender/editors/object/object_vgroup.c +++ b/source/blender/editors/object/object_vgroup.c @@ -411,28 +411,6 @@ bool ED_vgroup_copy_array(Object *ob, Object *ob_from) return true; } -static MDeformVert *ED_mesh_active_dvert_get_em(Object *ob, BMVert **r_eve) -{ - if (ob->mode & OB_MODE_EDIT && ob->type == OB_MESH && ob->defbase.first) { - Mesh *me = ob->data; - BMEditMesh *em = me->edit_btmesh; - const int cd_dvert_offset = CustomData_get_offset(&em->bm->vdata, CD_MDEFORMVERT); - - if (cd_dvert_offset != -1) { - BMEditSelection *ese = (BMEditSelection *)em->bm->selected.last; - - if (ese && ese->htype == BM_VERT) { - BMVert *eve = (BMVert *)ese->ele; - if (r_eve) *r_eve = eve; - return BM_ELEM_CD_GET_VOID_P(eve, cd_dvert_offset); - } - } - } - - if (r_eve) *r_eve = NULL; - return NULL; -} - /* TODO, cache flip data to speedup calls within a loop. */ static void mesh_defvert_mirror_update_internal(Object *ob, MDeformVert *dvert_dst, MDeformVert *dvert_src, @@ -454,19 +432,6 @@ static void mesh_defvert_mirror_update_internal(Object *ob, } } -static MDeformVert *ED_mesh_active_dvert_get_ob(Object *ob, int *r_index) -{ - Mesh *me = ob->data; - int index = BKE_mesh_mselect_active_get(me, ME_VSEL); - if (r_index) *r_index = index; - if (index == -1 || me->dvert == NULL) { - return NULL; - } - else { - return me->dvert + index; - } -} - static void ED_mesh_defvert_mirror_update_em(Object *ob, BMVert *eve, int def_nr, int vidx, const int cd_dvert_offset) { @@ -499,21 +464,6 @@ static void ED_mesh_defvert_mirror_update_ob(Object *ob, int def_nr, int vidx) } } -static MDeformVert *ED_mesh_active_dvert_get_only(Object *ob) -{ - if (ob->type == OB_MESH) { - if (ob->mode & OB_MODE_EDIT) { - return ED_mesh_active_dvert_get_em(ob, NULL); - } - else { - return ED_mesh_active_dvert_get_ob(ob, NULL); - } - } - else { - return NULL; - } -} - /** * Use when adjusting the active vertex weight and apply to mirror vertices. */ diff --git a/source/blender/editors/space_view3d/view3d_buttons.c b/source/blender/editors/space_view3d/view3d_buttons.c index 9fe9c6273c9..369051a0ab9 100644 --- a/source/blender/editors/space_view3d/view3d_buttons.c +++ b/source/blender/editors/space_view3d/view3d_buttons.c @@ -779,57 +779,6 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float #define B_VGRP_PNL_COPY_SINGLE 8192 /* or greater */ #define B_VGRP_PNL_ACTIVE 16384 /* or greater */ - -static MDeformVert *ED_mesh_active_dvert_get_ob(Object *ob, int *r_index) -{ - Mesh *me = ob->data; - int index = BKE_mesh_mselect_active_get(me, ME_VSEL); - if (r_index) *r_index = index; - if (index == -1 || me->dvert == NULL) { - return NULL; - } - else { - return me->dvert + index; - } -} - -static MDeformVert *ED_mesh_active_dvert_get_em(Object *ob, BMVert **r_eve) -{ - if (ob->mode & OB_MODE_EDIT && ob->type == OB_MESH && ob->defbase.first) { - Mesh *me = ob->data; - BMEditMesh *em = me->edit_btmesh; - const int cd_dvert_offset = CustomData_get_offset(&em->bm->vdata, CD_MDEFORMVERT); - - if (cd_dvert_offset != -1) { - BMEditSelection *ese = (BMEditSelection *)em->bm->selected.last; - - if (ese && ese->htype == BM_VERT) { - BMVert *eve = (BMVert *)ese->ele; - if (r_eve) *r_eve = eve; - return BM_ELEM_CD_GET_VOID_P(eve, cd_dvert_offset); - } - } - } - - if (r_eve) *r_eve = NULL; - return NULL; -} - -static MDeformVert *ED_mesh_active_dvert_get_only(Object *ob) -{ - if (ob->type == OB_MESH) { - if (ob->mode & OB_MODE_EDIT) { - return ED_mesh_active_dvert_get_em(ob, NULL); - } - else { - return ED_mesh_active_dvert_get_ob(ob, NULL); - } - } - else { - return NULL; - } -} - static void do_view3d_vgroup_buttons(bContext *C, void *UNUSED(arg), int event) { if (event < B_VGRP_PNL_EDIT_SINGLE) { From 781184562b47846113a83549fe0ef5d36a957579 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 24 Jun 2013 04:51:56 +0000 Subject: [PATCH 13/72] add api calls for BM_mesh_active_vert/edge_get. inspecting the edit-selection inline was cumbersome. --- source/blender/bmesh/intern/bmesh_marking.c | 45 +++++++++- source/blender/bmesh/intern/bmesh_marking.h | 7 +- source/blender/editors/mesh/editmesh_path.c | 90 +++++++++---------- source/blender/editors/mesh/editmesh_select.c | 61 +++++++------ source/blender/editors/mesh/editmesh_utils.c | 2 +- source/blender/editors/mesh/mesh_navmesh.c | 2 +- source/blender/editors/mesh/meshtools.c | 9 +- .../blender/editors/space_view3d/drawobject.c | 2 +- .../editors/transform/transform_conversions.c | 7 +- source/blender/editors/uvedit/uvedit_draw.c | 2 +- source/blender/editors/uvedit/uvedit_ops.c | 2 +- .../editors/uvedit/uvedit_unwrap_ops.c | 2 +- 12 files changed, 128 insertions(+), 103 deletions(-) diff --git a/source/blender/bmesh/intern/bmesh_marking.c b/source/blender/bmesh/intern/bmesh_marking.c index 313d76721fa..dc7c13b3fe0 100644 --- a/source/blender/bmesh/intern/bmesh_marking.c +++ b/source/blender/bmesh/intern/bmesh_marking.c @@ -555,12 +555,12 @@ void BM_elem_select_set(BMesh *bm, BMElem *ele, const bool select) } /* this replaces the active flag used in uv/face mode */ -void BM_active_face_set(BMesh *bm, BMFace *efa) +void BM_mesh_active_face_set(BMesh *bm, BMFace *efa) { bm->act_face = efa; } -BMFace *BM_active_face_get(BMesh *bm, const bool is_sloppy, const bool is_selected) +BMFace *BM_mesh_active_face_get(BMesh *bm, const bool is_sloppy, const bool is_selected) { if (bm->act_face && (!is_selected || BM_elem_flag_test(bm->act_face, BM_ELEM_SELECT))) { return bm->act_face; @@ -600,6 +600,45 @@ BMFace *BM_active_face_get(BMesh *bm, const bool is_sloppy, const bool is_select return NULL; } +BMEdge *BM_mesh_active_edge_get(BMesh *bm) +{ + if (bm->selected.last) { + BMEditSelection *ese = bm->selected.last; + + if (ese && ese->htype == BM_EDGE) { + return (BMEdge *)ese->ele; + } + } + + return NULL; +} + +BMVert *BM_mesh_active_vert_get(BMesh *bm) +{ + if (bm->selected.last) { + BMEditSelection *ese = bm->selected.last; + + if (ese && ese->htype == BM_VERT) { + return (BMVert *)ese->ele; + } + } + + return NULL; +} + +BMElem *BM_mesh_active_elem_get(BMesh *bm) +{ + if (bm->selected.last) { + BMEditSelection *ese = bm->selected.last; + + if (ese) { + return ese->ele; + } + } + + return NULL; +} + /** * Generic way to get data from an EditSelection type * These functions were written to be used by the Modifier widget @@ -763,7 +802,7 @@ void BM_select_history_validate(BMesh *bm) bool BM_select_history_active_get(BMesh *bm, BMEditSelection *ese) { BMEditSelection *ese_last = bm->selected.last; - BMFace *efa = BM_active_face_get(bm, false, false); + BMFace *efa = BM_mesh_active_face_get(bm, false, false); ese->next = ese->prev = NULL; diff --git a/source/blender/bmesh/intern/bmesh_marking.h b/source/blender/bmesh/intern/bmesh_marking.h index a3d2d4a6985..b7040e63458 100644 --- a/source/blender/bmesh/intern/bmesh_marking.h +++ b/source/blender/bmesh/intern/bmesh_marking.h @@ -70,8 +70,11 @@ int BM_mesh_elem_hflag_count_enabled(BMesh *bm, const char htype, const char hfl int BM_mesh_elem_hflag_count_disabled(BMesh *bm, const char htype, const char hflag, const bool respecthide); /* edit selection stuff */ -void BM_active_face_set(BMesh *bm, BMFace *f); -BMFace *BM_active_face_get(BMesh *bm, const bool is_sloppy, const bool is_selected); +void BM_mesh_active_face_set(BMesh *bm, BMFace *f); +BMFace *BM_mesh_active_face_get(BMesh *bm, const bool is_sloppy, const bool is_selected); +BMEdge *BM_mesh_active_edge_get(BMesh *bm); +BMVert *BM_mesh_active_vert_get(BMesh *bm); +BMElem *BM_mesh_active_elem_get(BMesh *bm); void BM_editselection_center(BMEditSelection *ese, float r_center[3]); void BM_editselection_normal(BMEditSelection *ese, float r_normal[3]); diff --git a/source/blender/editors/mesh/editmesh_path.c b/source/blender/editors/mesh/editmesh_path.c index 7b6d198d537..f4fd5a89277 100644 --- a/source/blender/editors/mesh/editmesh_path.c +++ b/source/blender/editors/mesh/editmesh_path.c @@ -83,28 +83,22 @@ static bool mouse_mesh_shortest_path_vert(ViewContext *vc) /* unlike edge/face versions, this uses a bmesh operator */ BMEditMesh *em = vc->em; + BMesh *bm = em->bm; BMVert *v_dst; float dist = 75.0f; const bool use_length = true; v_dst = EDBM_vert_find_nearest(vc, &dist, false, false); if (v_dst) { - struct UserData user_data = {vc->em->bm, vc->obedit->data, vc->scene}; + struct UserData user_data = {bm, vc->obedit->data, vc->scene}; LinkNode *path = NULL; + BMVert *v_act = BM_mesh_active_vert_get(bm); - if (em->bm->selected.last) { - BMEditSelection *ese = em->bm->selected.last; - - if (ese && ese->htype == BM_VERT) { - BMVert *v_act; - v_act = (BMVert *)ese->ele; - if (v_act != v_dst) { - if ((path = BM_mesh_calc_path_vert(em->bm, v_act, v_dst, use_length, - &user_data, verttag_filter_cb))) - { - BM_select_history_remove(em->bm, v_act); - } - } + if (v_act && (v_act != v_dst)) { + if ((path = BM_mesh_calc_path_vert(bm, v_act, v_dst, use_length, + &user_data, verttag_filter_cb))) + { + BM_select_history_remove(bm, v_act); } } @@ -137,9 +131,9 @@ static bool mouse_mesh_shortest_path_vert(ViewContext *vc) /* even if this is selected it may not be in the selection list */ if (BM_elem_flag_test(v_dst, BM_ELEM_SELECT) == 0) - BM_select_history_remove(em->bm, v_dst); + BM_select_history_remove(bm, v_dst); else - BM_select_history_store(em->bm, v_dst); + BM_select_history_store(bm, v_dst); EDBM_update_generic(em, false, false); @@ -254,31 +248,25 @@ static void edgetag_ensure_cd_flag(Scene *scene, Mesh *me) static bool mouse_mesh_shortest_path_edge(ViewContext *vc) { BMEditMesh *em = vc->em; + BMesh *bm = em->bm; BMEdge *e_dst; float dist = 75.0f; const bool use_length = true; e_dst = EDBM_edge_find_nearest(vc, &dist); if (e_dst) { - struct UserData user_data = {vc->em->bm, vc->obedit->data, vc->scene}; + struct UserData user_data = {bm, vc->obedit->data, vc->scene}; LinkNode *path = NULL; Mesh *me = vc->obedit->data; + BMEdge *e_act = BM_mesh_active_edge_get(bm); edgetag_ensure_cd_flag(vc->scene, em->ob->data); - if (em->bm->selected.last) { - BMEditSelection *ese = em->bm->selected.last; - - if (ese && ese->htype == BM_EDGE) { - BMEdge *e_act; - e_act = (BMEdge *)ese->ele; - if (e_act != e_dst) { - if ((path = BM_mesh_calc_path_edge(em->bm, e_act, e_dst, use_length, - &user_data, edgetag_filter_cb))) - { - BM_select_history_remove(em->bm, e_act); - } - } + if (e_act && (e_act != e_dst)) { + if ((path = BM_mesh_calc_path_edge(bm, e_act, e_dst, use_length, + &user_data, edgetag_filter_cb))) + { + BM_select_history_remove(bm, e_act); } } @@ -312,9 +300,9 @@ static bool mouse_mesh_shortest_path_edge(ViewContext *vc) /* even if this is selected it may not be in the selection list */ if (edgetag_test_cb(e_dst, &user_data) == 0) - BM_select_history_remove(em->bm, e_dst); + BM_select_history_remove(bm, e_dst); else - BM_select_history_store(em->bm, e_dst); + BM_select_history_store(bm, e_dst); /* force drawmode for mesh */ switch (vc->scene->toolsettings->edge_mode) { @@ -373,22 +361,23 @@ static void facetag_set_cb(BMFace *f, bool val, void *user_data_v) static bool mouse_mesh_shortest_path_face(ViewContext *vc) { BMEditMesh *em = vc->em; + BMesh *bm = em->bm; BMFace *f_dst; float dist = 75.0f; const bool use_length = true; f_dst = EDBM_face_find_nearest(vc, &dist); if (f_dst) { - struct UserData user_data = {vc->em->bm, vc->obedit->data, vc->scene}; + struct UserData user_data = {bm, vc->obedit->data, vc->scene}; LinkNode *path = NULL; - BMFace *f_act = BM_active_face_get(em->bm, false, true); + BMFace *f_act = BM_mesh_active_face_get(bm, false, true); if (f_act) { if (f_act != f_dst) { - if ((path = BM_mesh_calc_path_face(em->bm, f_act, f_dst, use_length, + if ((path = BM_mesh_calc_path_face(bm, f_act, f_dst, use_length, &user_data, facetag_filter_cb))) { - BM_select_history_remove(em->bm, f_act); + BM_select_history_remove(bm, f_act); } } } @@ -422,11 +411,11 @@ static bool mouse_mesh_shortest_path_face(ViewContext *vc) /* even if this is selected it may not be in the selection list */ if (facetag_test_cb(f_dst, &user_data) == 0) - BM_select_history_remove(em->bm, f_dst); + BM_select_history_remove(bm, f_dst); else - BM_select_history_store(em->bm, f_dst); + BM_select_history_store(bm, f_dst); - BM_active_face_set(em->bm, f_dst); + BM_mesh_active_face_set(bm, f_dst); EDBM_update_generic(em, false, false); @@ -513,6 +502,7 @@ static int edbm_shortest_path_select_exec(bContext *C, wmOperator *op) { Object *ob = CTX_data_edit_object(C); BMEditMesh *em = BKE_editmesh_from_object(ob); + BMesh *bm = em->bm; BMIter iter; BMEditSelection *ese_src, *ese_dst; BMElem *ele_src = NULL, *ele_dst = NULL, *ele; @@ -520,7 +510,7 @@ static int edbm_shortest_path_select_exec(bContext *C, wmOperator *op) const bool use_length = RNA_boolean_get(op->ptr, "use_length"); /* first try to find vertices in edit selection */ - ese_src = em->bm->selected.last; + ese_src = bm->selected.last; if (ese_src && (ese_dst = ese_src->prev) && (ese_src->htype == ese_dst->htype)) { ele_src = ese_src->ele; ele_dst = ese_dst->ele; @@ -528,8 +518,8 @@ static int edbm_shortest_path_select_exec(bContext *C, wmOperator *op) else { /* if selection history isn't available, find two selected elements */ ele_src = ele_dst = NULL; - if ((em->selectmode & SCE_SELECT_VERTEX) && (em->bm->totvertsel >= 2)) { - BM_ITER_MESH (ele, &iter, em->bm, BM_VERTS_OF_MESH) { + if ((em->selectmode & SCE_SELECT_VERTEX) && (bm->totvertsel >= 2)) { + BM_ITER_MESH (ele, &iter, bm, BM_VERTS_OF_MESH) { if (BM_elem_flag_test(ele, BM_ELEM_SELECT)) { if (ele_src == NULL) ele_src = ele; else if (ele_dst == NULL) ele_dst = ele; @@ -538,9 +528,9 @@ static int edbm_shortest_path_select_exec(bContext *C, wmOperator *op) } } - if ((ele_dst == NULL) && (em->selectmode & SCE_SELECT_EDGE) && (em->bm->totedgesel >= 2)) { + if ((ele_dst == NULL) && (em->selectmode & SCE_SELECT_EDGE) && (bm->totedgesel >= 2)) { ele_src = NULL; - BM_ITER_MESH (ele, &iter, em->bm, BM_EDGES_OF_MESH) { + BM_ITER_MESH (ele, &iter, bm, BM_EDGES_OF_MESH) { if (BM_elem_flag_test(ele, BM_ELEM_SELECT)) { if (ele_src == NULL) ele_src = ele; else if (ele_dst == NULL) ele_dst = ele; @@ -549,9 +539,9 @@ static int edbm_shortest_path_select_exec(bContext *C, wmOperator *op) } } - if ((ele_dst == NULL) && (em->selectmode & SCE_SELECT_FACE) && (em->bm->totfacesel >= 2)) { + if ((ele_dst == NULL) && (em->selectmode & SCE_SELECT_FACE) && (bm->totfacesel >= 2)) { ele_src = NULL; - BM_ITER_MESH (ele, &iter, em->bm, BM_FACES_OF_MESH) { + BM_ITER_MESH (ele, &iter, bm, BM_FACES_OF_MESH) { if (BM_elem_flag_test(ele, BM_ELEM_SELECT)) { if (ele_src == NULL) ele_src = ele; else if (ele_dst == NULL) ele_dst = ele; @@ -566,17 +556,17 @@ static int edbm_shortest_path_select_exec(bContext *C, wmOperator *op) switch (ele_src->head.htype) { case BM_VERT: path = BM_mesh_calc_path_vert( - em->bm, (BMVert *)ele_src, (BMVert *)ele_dst, use_length, + bm, (BMVert *)ele_src, (BMVert *)ele_dst, use_length, NULL, (bool (*)(BMVert *, void *))ele_filter_visible_cb); break; case BM_EDGE: path = BM_mesh_calc_path_edge( - em->bm, (BMEdge *)ele_src, (BMEdge *)ele_dst, use_length, + bm, (BMEdge *)ele_src, (BMEdge *)ele_dst, use_length, NULL, (bool (*)(BMEdge *, void *))ele_filter_visible_cb); break; case BM_FACE: path = BM_mesh_calc_path_face( - em->bm, (BMFace *)ele_src, (BMFace *)ele_dst, use_length, + bm, (BMFace *)ele_src, (BMFace *)ele_dst, use_length, NULL, (bool (*)(BMFace *, void *))ele_filter_visible_cb); break; } @@ -585,7 +575,7 @@ static int edbm_shortest_path_select_exec(bContext *C, wmOperator *op) LinkNode *node = path; do { - BM_elem_select_set(em->bm, node->link, true); + BM_elem_select_set(bm, node->link, true); } while ((node = node->next)); BLI_linklist_free(path, NULL); diff --git a/source/blender/editors/mesh/editmesh_select.c b/source/blender/editors/mesh/editmesh_select.c index 77b91365535..df5d764d69b 100644 --- a/source/blender/editors/mesh/editmesh_select.c +++ b/source/blender/editors/mesh/editmesh_select.c @@ -1204,7 +1204,7 @@ static void mouse_mesh_loop(bContext *C, const int mval[2], bool extend, bool de } } if (efa) { - BM_active_face_set(em->bm, efa); + BM_mesh_active_face_set(em->bm, efa); BM_select_history_store(em->bm, efa); } } @@ -1371,7 +1371,7 @@ bool EDBM_select_pick(bContext *C, const int mval[2], bool extend, bool deselect if (efa) { if (extend) { /* set the last selected face */ - BM_active_face_set(vc.em->bm, efa); + BM_mesh_active_face_set(vc.em->bm, efa); /* Work-around: deselect first, so we can guarantee it will */ /* be active even if it was already selected */ @@ -1386,7 +1386,7 @@ bool EDBM_select_pick(bContext *C, const int mval[2], bool extend, bool deselect } else { /* set the last selected face */ - BM_active_face_set(vc.em->bm, efa); + BM_mesh_active_face_set(vc.em->bm, efa); if (!BM_elem_flag_test(efa, BM_ELEM_SELECT)) { BM_select_history_store(vc.em->bm, efa); @@ -2383,27 +2383,25 @@ static void deselect_nth_active(BMEditMesh *em, BMVert **r_eve, BMEdge **r_eed, BMEdge *e; BMFace *f; BMIter iter; - BMEditSelection *ese; + BMElem *ele; *r_eve = NULL; *r_eed = NULL; *r_efa = NULL; EDBM_selectmode_flush(em); - ese = (BMEditSelection *)em->bm->selected.last; + ele = BM_mesh_active_elem_get(em->bm); - if (ese) { - switch (ese->htype) { - case BM_VERT: - *r_eve = (BMVert *)ese->ele; - return; - case BM_EDGE: - *r_eed = (BMEdge *)ese->ele; - return; - case BM_FACE: - *r_efa = (BMFace *)ese->ele; - return; - } + switch (ele->head.htype) { + case BM_VERT: + *r_eve = (BMVert *)ele; + return; + case BM_EDGE: + *r_eed = (BMEdge *)ele; + return; + case BM_FACE: + *r_efa = (BMFace *)ele; + return; } if (em->selectmode & SCE_SELECT_VERTEX) { @@ -2423,7 +2421,7 @@ static void deselect_nth_active(BMEditMesh *em, BMVert **r_eve, BMEdge **r_eed, } } else if (em->selectmode & SCE_SELECT_FACE) { - f = BM_active_face_get(em->bm, true, false); + f = BM_mesh_active_face_get(em->bm, true, false); if (f) { *r_efa = f; return; @@ -2832,39 +2830,40 @@ static int edbm_select_axis_exec(bContext *C, wmOperator *op) { Object *obedit = CTX_data_edit_object(C); BMEditMesh *em = BKE_editmesh_from_object(obedit); - BMEditSelection *ese = em->bm->selected.last; + BMesh *bm = em->bm; + BMVert *v_act = BM_mesh_active_vert_get(bm); const int axis = RNA_enum_get(op->ptr, "axis"); const int mode = RNA_enum_get(op->ptr, "mode"); /* -1 == aligned, 0 == neg, 1 == pos */ - if (ese == NULL || ese->htype != BM_VERT) { + if (v_act == NULL) { BKE_report(op->reports, RPT_WARNING, "This operator requires an active vertex (last selected)"); return OPERATOR_CANCELLED; } else { - BMVert *ev, *act_vert = (BMVert *)ese->ele; + BMVert *v; BMIter iter; - float value = act_vert->co[axis]; - float limit = CTX_data_tool_settings(C)->doublimit; // XXX + const float limit = CTX_data_tool_settings(C)->doublimit; // XXX + float value = v_act->co[axis]; if (mode == 0) value -= limit; else if (mode == 1) value += limit; - BM_ITER_MESH (ev, &iter, em->bm, BM_VERTS_OF_MESH) { - if (!BM_elem_flag_test(ev, BM_ELEM_HIDDEN)) { + BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) { + if (!BM_elem_flag_test(v, BM_ELEM_HIDDEN)) { switch (mode) { case -1: /* aligned */ - if (fabsf(ev->co[axis] - value) < limit) - BM_vert_select_set(em->bm, ev, true); + if (fabsf(v->co[axis] - value) < limit) + BM_vert_select_set(bm, v, true); break; case 0: /* neg */ - if (ev->co[axis] > value) - BM_vert_select_set(em->bm, ev, true); + if (v->co[axis] > value) + BM_vert_select_set(bm, v, true); break; case 1: /* pos */ - if (ev->co[axis] < value) - BM_vert_select_set(em->bm, ev, true); + if (v->co[axis] < value) + BM_vert_select_set(bm, v, true); break; } } diff --git a/source/blender/editors/mesh/editmesh_utils.c b/source/blender/editors/mesh/editmesh_utils.c index f3540fe62b7..560c314405e 100644 --- a/source/blender/editors/mesh/editmesh_utils.c +++ b/source/blender/editors/mesh/editmesh_utils.c @@ -1089,7 +1089,7 @@ MTexPoly *EDBM_mtexpoly_active_get(BMEditMesh *em, BMFace **r_act_efa, const boo if (!EDBM_mtexpoly_check(em)) return NULL; - efa = BM_active_face_get(em->bm, sloppy, selected); + efa = BM_mesh_active_face_get(em->bm, sloppy, selected); if (efa) { if (r_act_efa) *r_act_efa = efa; diff --git a/source/blender/editors/mesh/mesh_navmesh.c b/source/blender/editors/mesh/mesh_navmesh.c index 7a1fdd71b20..ba9bd8d3f7b 100644 --- a/source/blender/editors/mesh/mesh_navmesh.c +++ b/source/blender/editors/mesh/mesh_navmesh.c @@ -501,7 +501,7 @@ static int navmesh_face_copy_exec(bContext *C, wmOperator *op) BMEditMesh *em = BKE_editmesh_from_object(obedit); /* do work here */ - BMFace *efa_act = BM_active_face_get(em->bm, false, false); + BMFace *efa_act = BM_mesh_active_face_get(em->bm, false, false); if (efa_act) { if (CustomData_has_layer(&em->bm->pdata, CD_RECAST)) { diff --git a/source/blender/editors/mesh/meshtools.c b/source/blender/editors/mesh/meshtools.c index b8b245802bf..b0d337c365f 100644 --- a/source/blender/editors/mesh/meshtools.c +++ b/source/blender/editors/mesh/meshtools.c @@ -1368,14 +1368,13 @@ MDeformVert *ED_mesh_active_dvert_get_em(Object *ob, BMVert **r_eve) { if (ob->mode & OB_MODE_EDIT && ob->type == OB_MESH && ob->defbase.first) { Mesh *me = ob->data; - BMEditMesh *em = me->edit_btmesh; - const int cd_dvert_offset = CustomData_get_offset(&em->bm->vdata, CD_MDEFORMVERT); + BMesh *bm = me->edit_btmesh->bm; + const int cd_dvert_offset = CustomData_get_offset(&bm->vdata, CD_MDEFORMVERT); if (cd_dvert_offset != -1) { - BMEditSelection *ese = (BMEditSelection *)em->bm->selected.last; + BMVert *eve = BM_mesh_active_vert_get(bm); - if (ese && ese->htype == BM_VERT) { - BMVert *eve = (BMVert *)ese->ele; + if (eve) { if (r_eve) *r_eve = eve; return BM_ELEM_CD_GET_VOID_P(eve, cd_dvert_offset); } diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index 79ad62ee2e8..63906c4d429 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -3004,7 +3004,7 @@ static void draw_em_fancy(Scene *scene, ARegion *ar, View3D *v3d, { RegionView3D *rv3d = ar->regiondata; Mesh *me = ob->data; - BMFace *efa_act = BM_active_face_get(em->bm, false, true); /* annoying but active faces is stored differently */ + BMFace *efa_act = BM_mesh_active_face_get(em->bm, false, true); /* annoying but active faces is stored differently */ BMEdge *eed_act = NULL; BMVert *eve_act = NULL; diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index 1df5a7e323c..81af26b0d05 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -2110,12 +2110,7 @@ static void createTransEditVerts(TransInfo *t) } /* check active */ - if (em->bm->selected.last) { - BMEditSelection *ese = em->bm->selected.last; - if (ese->htype == BM_VERT) { - eve_act = (BMVert *)ese->ele; - } - } + eve_act = BM_mesh_active_vert_get(bm); if (t->mode == TFM_BWEIGHT) { BM_mesh_cd_flag_ensure(bm, BKE_mesh_from_object(t->obedit), ME_CDFLAG_VERT_BWEIGHT); diff --git a/source/blender/editors/uvedit/uvedit_draw.c b/source/blender/editors/uvedit/uvedit_draw.c index 62b02cff683..438f6bbdb9c 100644 --- a/source/blender/editors/uvedit/uvedit_draw.c +++ b/source/blender/editors/uvedit/uvedit_draw.c @@ -443,7 +443,7 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, Object *obedit) const int cd_poly_tex_offset = CustomData_get_offset(&bm->pdata, CD_MTEXPOLY); activetf = EDBM_mtexpoly_active_get(em, &efa_act, FALSE, FALSE); /* will be set to NULL if hidden */ - activef = BM_active_face_get(bm, FALSE, FALSE); + activef = BM_mesh_active_face_get(bm, FALSE, FALSE); ts = scene->toolsettings; drawfaces = draw_uvs_face_check(scene); diff --git a/source/blender/editors/uvedit/uvedit_ops.c b/source/blender/editors/uvedit/uvedit_ops.c index 75160cc8a16..1ed00c3aa20 100644 --- a/source/blender/editors/uvedit/uvedit_ops.c +++ b/source/blender/editors/uvedit/uvedit_ops.c @@ -2098,7 +2098,7 @@ static int uv_mouse_select(bContext *C, const float co[2], bool extend, bool loo } /* make active */ - BM_active_face_set(em->bm, hit.efa); + BM_mesh_active_face_set(em->bm, hit.efa); /* mark all face vertices as being hit */ diff --git a/source/blender/editors/uvedit/uvedit_unwrap_ops.c b/source/blender/editors/uvedit/uvedit_unwrap_ops.c index 8d7b8dc4e28..a100757980c 100644 --- a/source/blender/editors/uvedit/uvedit_unwrap_ops.c +++ b/source/blender/editors/uvedit/uvedit_unwrap_ops.c @@ -205,7 +205,7 @@ void uvedit_get_aspect(Scene *scene, Object *ob, BMEditMesh *em, float *aspx, fl BMFace *efa; Image *ima; - efa = BM_active_face_get(em->bm, sloppy, selected); + efa = BM_mesh_active_face_get(em->bm, sloppy, selected); if (efa) { if (BKE_scene_use_new_shading_nodes(scene)) { From 69d1e8187c8519132fa484df40f63d7146716680 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 24 Jun 2013 05:24:27 +0000 Subject: [PATCH 14/72] make behavior for edge tagging more predictable. last-picked edge is always selected+active. --- source/blender/editors/mesh/editmesh_path.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/source/blender/editors/mesh/editmesh_path.c b/source/blender/editors/mesh/editmesh_path.c index f4fd5a89277..828afe7718b 100644 --- a/source/blender/editors/mesh/editmesh_path.c +++ b/source/blender/editors/mesh/editmesh_path.c @@ -255,6 +255,7 @@ static bool mouse_mesh_shortest_path_edge(ViewContext *vc) e_dst = EDBM_edge_find_nearest(vc, &dist); if (e_dst) { + const char edge_mode = vc->scene->toolsettings->edge_mode; struct UserData user_data = {bm, vc->obedit->data, vc->scene}; LinkNode *path = NULL; Mesh *me = vc->obedit->data; @@ -296,16 +297,26 @@ static bool mouse_mesh_shortest_path_edge(ViewContext *vc) edgetag_set_cb(e_dst, is_act, &user_data); /* switch the edge option */ } + if (edge_mode != EDGE_MODE_SELECT) { + /* simple rules - last edge is _always_ active and selected */ + if (e_act) + BM_edge_select_set(bm, e_act, false); + BM_edge_select_set(bm, e_dst, true); + BM_select_history_store(bm, e_dst); + } + EDBM_selectmode_flush(em); /* even if this is selected it may not be in the selection list */ - if (edgetag_test_cb(e_dst, &user_data) == 0) - BM_select_history_remove(bm, e_dst); - else - BM_select_history_store(bm, e_dst); + if (edge_mode == EDGE_MODE_SELECT) { + if (edgetag_test_cb(e_dst, &user_data) == 0) + BM_select_history_remove(bm, e_dst); + else + BM_select_history_store(bm, e_dst); + } /* force drawmode for mesh */ - switch (vc->scene->toolsettings->edge_mode) { + switch (edge_mode) { case EDGE_MODE_TAG_SEAM: me->drawflag |= ME_DRAWSEAMS; From bfd0ceb4e08ae925d197d399cd5416acfcbf685f Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 24 Jun 2013 05:26:42 +0000 Subject: [PATCH 15/72] fix own error with updating edge tagging (seams didnt work) --- source/blender/editors/mesh/editmesh_path.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/editors/mesh/editmesh_path.c b/source/blender/editors/mesh/editmesh_path.c index 828afe7718b..e7eaa625843 100644 --- a/source/blender/editors/mesh/editmesh_path.c +++ b/source/blender/editors/mesh/editmesh_path.c @@ -164,7 +164,7 @@ static bool edgetag_test_cb(BMEdge *e, void *user_data_v) case EDGE_MODE_SELECT: return BM_elem_flag_test(e, BM_ELEM_SELECT) ? true : false; case EDGE_MODE_TAG_SEAM: - return BM_elem_flag_test(e, BM_ELEM_SEAM) ? false : true; + return BM_elem_flag_test(e, BM_ELEM_SEAM) ? true : false; case EDGE_MODE_TAG_SHARP: return BM_elem_flag_test(e, BM_ELEM_SMOOTH) ? false : true; case EDGE_MODE_TAG_CREASE: From 86bebb338013fd9ac4e39c3f3a8665b1d3b0ed53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrgen=20Herrmann?= Date: Mon, 24 Jun 2013 05:45:03 +0000 Subject: [PATCH 16/72] Fix for #35851: - Make scons work for non western CL.exe. --- build_files/scons/config/win32-vc-config.py | 10 +++++----- build_files/scons/config/win64-vc-config.py | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/build_files/scons/config/win32-vc-config.py b/build_files/scons/config/win32-vc-config.py index b9ec5208d53..12ca16d480a 100644 --- a/build_files/scons/config/win32-vc-config.py +++ b/build_files/scons/config/win32-vc-config.py @@ -3,13 +3,13 @@ import subprocess CL_OUT = subprocess.Popen(["cl.exe"],stdout=subprocess.PIPE,stderr=subprocess.PIPE) CL_STDOUT, CL_STDERR = CL_OUT.communicate() -if CL_STDERR.find("Version 15.00.") == -1: - VC_VERSION = '11.0' - LCGDIR = '#../lib/windows_vc11' - -else: +if CL_STDERR.find("17.00.") == -1: VC_VERSION = '9.0' LCGDIR = '#../lib/windows' + +else: + VC_VERSION = '11.0' + LCGDIR = '#../lib/windows_vc11' LIBDIR = '${LCGDIR}' diff --git a/build_files/scons/config/win64-vc-config.py b/build_files/scons/config/win64-vc-config.py index 803cac144ab..ab1c2a87d93 100644 --- a/build_files/scons/config/win64-vc-config.py +++ b/build_files/scons/config/win64-vc-config.py @@ -3,13 +3,13 @@ import subprocess CL_OUT = subprocess.Popen(["cl.exe"],stdout=subprocess.PIPE,stderr=subprocess.PIPE) CL_STDOUT, CL_STDERR = CL_OUT.communicate() -if CL_STDERR.find("Version 15.00.") == -1: - VC_VERSION = '11.0' - LCGDIR = '#../lib/win64_vc11' - -else: +if CL_STDERR.find("17.00.") == -1: VC_VERSION = '9.0' LCGDIR = '#../lib/win64' + +else: + VC_VERSION = '11.0' + LCGDIR = '#../lib/win64_vc11' LIBDIR = '${LCGDIR}' From a5b78bb6bdebe798865e8d6bcb958708d49c73b3 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 24 Jun 2013 05:55:05 +0000 Subject: [PATCH 17/72] replace use of 'a.find(b) != -1' --> 'b in a' --- build_files/buildbot/slave_test.py | 2 +- build_files/scons/config/win32-vc-config.py | 9 ++++----- build_files/scons/config/win64-vc-config.py | 9 ++++----- build_files/scons/tools/Blender.py | 2 +- build_files/scons/tools/btools.py | 8 ++++---- 5 files changed, 14 insertions(+), 16 deletions(-) diff --git a/build_files/buildbot/slave_test.py b/build_files/buildbot/slave_test.py index f79ef7cf5c6..d5acc8fd7a6 100644 --- a/build_files/buildbot/slave_test.py +++ b/build_files/buildbot/slave_test.py @@ -31,7 +31,7 @@ builder = sys.argv[1] # we run from build/ directory blender_dir = '../blender' -if builder.find('cmake') != -1: +if "cmake" in builder: # cmake retcode = subprocess.call(['ctest', '.' '--output-on-failure']) sys.exit(retcode) diff --git a/build_files/scons/config/win32-vc-config.py b/build_files/scons/config/win32-vc-config.py index 12ca16d480a..f1597a66538 100644 --- a/build_files/scons/config/win32-vc-config.py +++ b/build_files/scons/config/win32-vc-config.py @@ -3,13 +3,12 @@ import subprocess CL_OUT = subprocess.Popen(["cl.exe"],stdout=subprocess.PIPE,stderr=subprocess.PIPE) CL_STDOUT, CL_STDERR = CL_OUT.communicate() -if CL_STDERR.find("17.00.") == -1: - VC_VERSION = '9.0' - LCGDIR = '#../lib/windows' - -else: +if "17.00." in CL_STDERR: VC_VERSION = '11.0' LCGDIR = '#../lib/windows_vc11' +else: + VC_VERSION = '9.0' + LCGDIR = '#../lib/windows' LIBDIR = '${LCGDIR}' diff --git a/build_files/scons/config/win64-vc-config.py b/build_files/scons/config/win64-vc-config.py index ab1c2a87d93..a13f417c36c 100644 --- a/build_files/scons/config/win64-vc-config.py +++ b/build_files/scons/config/win64-vc-config.py @@ -3,13 +3,12 @@ import subprocess CL_OUT = subprocess.Popen(["cl.exe"],stdout=subprocess.PIPE,stderr=subprocess.PIPE) CL_STDOUT, CL_STDERR = CL_OUT.communicate() -if CL_STDERR.find("17.00.") == -1: - VC_VERSION = '9.0' - LCGDIR = '#../lib/win64' - -else: +if "17.00." in CL_STDERR: VC_VERSION = '11.0' LCGDIR = '#../lib/win64_vc11' +else: + VC_VERSION = '9.0' + LCGDIR = '#../lib/win64' LIBDIR = '${LCGDIR}' diff --git a/build_files/scons/tools/Blender.py b/build_files/scons/tools/Blender.py index c6cb88faebc..24bdd32ed26 100644 --- a/build_files/scons/tools/Blender.py +++ b/build_files/scons/tools/Blender.py @@ -847,7 +847,7 @@ class BlenderEnvironment(SConsEnvironment): def list_substring(quickie, libname): for q in quickie: - if libname.find(q) != -1: + if q in libname: return True return False diff --git a/build_files/scons/tools/btools.py b/build_files/scons/tools/btools.py index 90674113f47..53dd99a7971 100644 --- a/build_files/scons/tools/btools.py +++ b/build_files/scons/tools/btools.py @@ -674,10 +674,10 @@ def buildslave(target=None, source=None, env=None): if platform == 'linux': import platform - if env['BF_INSTALLDIR'].find('glibc27') != -1: - glibc="glibc27" - elif env['BF_INSTALLDIR'].find('glibc211') != -1: - glibc="glibc211" + if "glibc27" in env['BF_INSTALLDIR']: + glibc = "glibc27" + elif "glibc211" in env['BF_INSTALLDIR']: + glibc = "glibc211" bitness = platform.architecture()[0] if bitness == '64bit': From d5aaf8141ea89a3ca16e7fa6f922ac910db7e742 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 24 Jun 2013 06:08:47 +0000 Subject: [PATCH 18/72] fix [#35855] Change "Scene" crashes randomly --- source/blender/blenkernel/intern/colortools.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/source/blender/blenkernel/intern/colortools.c b/source/blender/blenkernel/intern/colortools.c index 732f9918622..9323531e5fe 100644 --- a/source/blender/blenkernel/intern/colortools.c +++ b/source/blender/blenkernel/intern/colortools.c @@ -1276,6 +1276,8 @@ void BKE_color_managed_view_settings_copy(ColorManagedViewSettings *new_settings if (settings->curve_mapping) new_settings->curve_mapping = curvemapping_copy(settings->curve_mapping); + else + new_settings->curve_mapping = NULL; } void BKE_color_managed_view_settings_free(ColorManagedViewSettings *settings) From e02612c04203c5a8028ebffc467158e4b42db09b Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 24 Jun 2013 06:44:00 +0000 Subject: [PATCH 19/72] localview was clearing the source-view3d when duplicating noticeable when splitting the view that the wrong viewport kept local-view layers. --- source/blender/editors/space_view3d/space_view3d.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c index 4c888f2f6c6..eb7adb7a333 100644 --- a/source/blender/editors/space_view3d/space_view3d.c +++ b/source/blender/editors/space_view3d/space_view3d.c @@ -380,11 +380,10 @@ static SpaceLink *view3d_duplicate(SpaceLink *sl) // XXX BIF_view3d_previewrender_free(v3do); - if (v3do->localvd) { - v3do->localvd = NULL; - v3do->properties_storage = NULL; - v3do->lay = v3dn->localvd->lay; - v3do->lay &= 0xFFFFFF; + if (v3dn->localvd) { + v3dn->localvd = NULL; + v3dn->properties_storage = NULL; + v3dn->lay = v3do->localvd->lay & 0xFFFFFF; } if (v3dn->drawtype == OB_RENDER) From c3d70a9bafabae19bc6747741aabfbb8470bb8f8 Mon Sep 17 00:00:00 2001 From: Mitchell Stokes Date: Mon, 24 Jun 2013 08:26:05 +0000 Subject: [PATCH 20/72] BGE: Fix for [#34185] "billboard scale problem in groups" reported by Tobias Lijsen (blenderhilfe). Use world scaling instead of local scaling when billboarding so we get all inherited scaling. --- source/gameengine/BlenderRoutines/KX_BlenderRenderTools.cpp | 2 +- source/gameengine/GamePlayer/common/GPC_RenderTools.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/source/gameengine/BlenderRoutines/KX_BlenderRenderTools.cpp b/source/gameengine/BlenderRoutines/KX_BlenderRenderTools.cpp index 4c162376b36..db9445b728d 100644 --- a/source/gameengine/BlenderRoutines/KX_BlenderRenderTools.cpp +++ b/source/gameengine/BlenderRoutines/KX_BlenderRenderTools.cpp @@ -207,7 +207,7 @@ void KX_BlenderRenderTools::applyTransform(RAS_IRasterizer* rasty,double* oglmat KX_GameObject* gameobj = (KX_GameObject*)m_clientobject; // get scaling of halo object - MT_Vector3 size = gameobj->GetSGNode()->GetLocalScale(); + MT_Vector3 size = gameobj->GetSGNode()->GetWorldScaling(); bool screenaligned = (objectdrawmode & RAS_IPolyMaterial::BILLBOARD_SCREENALIGNED)!=0;//false; //either screen or axisaligned if (screenaligned) diff --git a/source/gameengine/GamePlayer/common/GPC_RenderTools.cpp b/source/gameengine/GamePlayer/common/GPC_RenderTools.cpp index 39579f5629f..70a05f7425b 100644 --- a/source/gameengine/GamePlayer/common/GPC_RenderTools.cpp +++ b/source/gameengine/GamePlayer/common/GPC_RenderTools.cpp @@ -216,7 +216,7 @@ void GPC_RenderTools::applyTransform(RAS_IRasterizer* rasty,double* oglmatrix,in KX_GameObject* gameobj = (KX_GameObject*) this->m_clientobject; // get scaling of halo object - MT_Vector3 size = gameobj->GetSGNode()->GetLocalScale(); + MT_Vector3 size = gameobj->GetSGNode()->GetWorldScaling(); bool screenaligned = (objectdrawmode & RAS_IPolyMaterial::BILLBOARD_SCREENALIGNED)!=0;//false; //either screen or axisaligned if (screenaligned) From 64007a94c068efc19acc891d8990c4b56a7fa496 Mon Sep 17 00:00:00 2001 From: Mitchell Stokes Date: Mon, 24 Jun 2013 09:37:37 +0000 Subject: [PATCH 21/72] BGE: Fix for [#30450] "F-Curve on bone not working" reported by HG1. Run IPOs for all objects and not just non-armature objects. --- source/gameengine/Ketsji/BL_Action.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/gameengine/Ketsji/BL_Action.cpp b/source/gameengine/Ketsji/BL_Action.cpp index 07295d238ef..9d189a6170e 100644 --- a/source/gameengine/Ketsji/BL_Action.cpp +++ b/source/gameengine/Ketsji/BL_Action.cpp @@ -479,10 +479,10 @@ void BL_Action::Update(float curtime) obj->SetActiveAction(NULL, 0, curtime); } - - m_obj->UpdateIPO(m_localtime, m_ipo_flags & ACT_IPOFLAG_CHILD); } + m_obj->UpdateIPO(m_localtime, m_ipo_flags & ACT_IPOFLAG_CHILD); + if (m_done) ClearControllerList(); } From 7e50f07e483b48a989b1e4508c1c794053e9be23 Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Mon, 24 Jun 2013 11:44:07 +0000 Subject: [PATCH 22/72] Bugfix: Bone Constraints tab used wrong icon after r57584 --- source/blender/makesrna/intern/rna_space.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index 4513694e59d..38ada7bf74f 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -148,7 +148,7 @@ static EnumPropertyItem buttons_context_items[] = { {BCONTEXT_MODIFIER, "MODIFIER", ICON_MODIFIER, "Modifiers", "Object modifiers"}, {BCONTEXT_DATA, "DATA", ICON_NONE, "Data", "Object data"}, {BCONTEXT_BONE, "BONE", ICON_BONE_DATA, "Bone", "Bone"}, - {BCONTEXT_BONE_CONSTRAINT, "BONE_CONSTRAINT", ICON_CONSTRAINT, "Bone Constraints", "Bone constraints"}, + {BCONTEXT_BONE_CONSTRAINT, "BONE_CONSTRAINT", ICON_CONSTRAINT_BONE, "Bone Constraints", "Bone constraints"}, {BCONTEXT_MATERIAL, "MATERIAL", ICON_MATERIAL, "Material", "Material"}, {BCONTEXT_TEXTURE, "TEXTURE", ICON_TEXTURE, "Texture", "Texture"}, {BCONTEXT_PARTICLE, "PARTICLES", ICON_PARTICLES, "Particles", "Particle"}, From d42204f962f29463feeec11c585556977a8b54ca Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Mon, 24 Jun 2013 12:18:28 +0000 Subject: [PATCH 23/72] Fix [#35790] Panel Section Arrows Wrong Theme Colors Use TITLE color for the triangle and X (close) "icons" when used. --- .../editors/interface/interface_panel.c | 45 +++++++++---------- 1 file changed, 22 insertions(+), 23 deletions(-) diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c index ca26044f662..b13de64d0c7 100644 --- a/source/blender/editors/interface/interface_panel.c +++ b/source/blender/editors/interface/interface_panel.c @@ -472,8 +472,10 @@ static void ui_draw_aligned_panel_header(uiStyle *style, uiBlock *block, rcti *r const char *activename = panel->drawname[0] ? panel->drawname : panel->panelname; /* + 0.001f to avoid flirting with float inaccuracy */ - if (panel->control & UI_PNL_CLOSE) pnl_icons = (panel->labelofs + 2 * PNL_ICON + 5) / block->aspect + 0.001f; - else pnl_icons = (panel->labelofs + PNL_ICON + 5) / block->aspect + 0.001f; + if (panel->control & UI_PNL_CLOSE) + pnl_icons = (panel->labelofs + 2 * PNL_ICON + 5) / block->aspect + 0.001f; + else + pnl_icons = (panel->labelofs + PNL_ICON + 5) / block->aspect + 0.001f; /* active tab */ /* draw text label */ @@ -514,7 +516,7 @@ void ui_draw_aligned_panel(uiStyle *style, uiBlock *block, rcti *rect) rcti headrect; rctf itemrect; int ofsx; - + if (panel->paneltab) return; if (panel->type && (panel->type->flag & PNL_NO_HEADER)) return; @@ -523,14 +525,14 @@ void ui_draw_aligned_panel(uiStyle *style, uiBlock *block, rcti *rect) headrect = *rect; headrect.ymin = headrect.ymax; headrect.ymax = headrect.ymin + floor(PNL_HEADER / block->aspect + 0.001f); - + { float minx = rect->xmin; float maxx = rect->xmax; float y = headrect.ymax; glEnable(GL_BLEND); - + if (UI_GetThemeValue(TH_PANEL_SHOW_HEADER)) { /* draw with background color */ UI_ThemeColor4(TH_PANEL_HEADER); @@ -543,7 +545,7 @@ void ui_draw_aligned_panel(uiStyle *style, uiBlock *block, rcti *rect) /* draw embossed separator */ minx += 5.0f / block->aspect; maxx -= 5.0f / block->aspect; - + glColor4f(0.0f, 0.0f, 0.0f, 0.5f); fdrawline(minx, y, maxx, y); glColor4f(1.0f, 1.0f, 1.0f, 0.25f); @@ -552,11 +554,11 @@ void ui_draw_aligned_panel(uiStyle *style, uiBlock *block, rcti *rect) glDisable(GL_BLEND); } - + /* horizontal title */ if (!(panel->flag & PNL_CLOSEDX)) { ui_draw_aligned_panel_header(style, block, &headrect, 'h'); - + /* itemrect smaller */ itemrect.xmax = headrect.xmax - 5.0f / block->aspect; itemrect.xmin = itemrect.xmax - BLI_rcti_size_y(&headrect); @@ -566,12 +568,11 @@ void ui_draw_aligned_panel(uiStyle *style, uiBlock *block, rcti *rect) rectf_scale(&itemrect, 0.7f); ui_draw_panel_dragwidget(&itemrect); } - + /* if the panel is minimized vertically: * (------) */ if (panel->flag & PNL_CLOSEDY) { - } else if (panel->flag & PNL_CLOSEDX) { /* draw vertical title */ @@ -579,16 +580,15 @@ void ui_draw_aligned_panel(uiStyle *style, uiBlock *block, rcti *rect) } /* an open panel */ else { - /* in some occasions, draw a border */ if (panel->flag & PNL_SELECT) { if (panel->control & UI_PNL_SOLID) uiSetRoundBox(UI_CNR_ALL); else uiSetRoundBox(UI_CNR_NONE); - + UI_ThemeColorShade(TH_BACK, -120); uiRoundRect(0.5f + rect->xmin, 0.5f + rect->ymin, 0.5f + rect->xmax, 0.5f + headrect.ymax + 1, 8); } - + /* panel backdrop */ if (UI_GetThemeValue(TH_PANEL_SHOW_BACK)) { /* draw with background color */ @@ -596,32 +596,31 @@ void ui_draw_aligned_panel(uiStyle *style, uiBlock *block, rcti *rect) UI_ThemeColor4(TH_PANEL_BACK); glRecti(rect->xmin, rect->ymin, rect->xmax, rect->ymax); } - + if (panel->control & UI_PNL_SCALE) ui_draw_panel_scalewidget(rect); } - + /* draw optional close icon */ - + ofsx = 6; if (panel->control & UI_PNL_CLOSE) { - - UI_ThemeColor(TH_TEXT); + UI_ThemeColor(TH_TITLE); ui_draw_x_icon(rect->xmin + 2 + ofsx, rect->ymax + 2); ofsx = 22; } - + /* draw collapse icon */ - UI_ThemeColor(TH_TEXT); - + UI_ThemeColor(TH_TITLE); + /* itemrect smaller */ itemrect.xmin = headrect.xmin + 5.0f / block->aspect; itemrect.xmax = itemrect.xmin + BLI_rcti_size_y(&headrect); itemrect.ymin = headrect.ymin; itemrect.ymax = headrect.ymax; - + rectf_scale(&itemrect, 0.35f); - + if (panel->flag & PNL_CLOSEDY) ui_draw_tria_rect(&itemrect, 'h'); else if (panel->flag & PNL_CLOSEDX) From 960d2ec028a705c65395fc1d444704b8656c549e Mon Sep 17 00:00:00 2001 From: Gaia Clary Date: Mon, 24 Jun 2013 13:04:58 +0000 Subject: [PATCH 24/72] removed obsolete forward declaration --- source/blender/editors/include/ED_object.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/source/blender/editors/include/ED_object.h b/source/blender/editors/include/ED_object.h index e891f648713..90b131e5acc 100644 --- a/source/blender/editors/include/ED_object.h +++ b/source/blender/editors/include/ED_object.h @@ -69,8 +69,6 @@ struct PointerRNA; struct PropertyRNA; struct EnumPropertyItem; -enum eVGroupSelect; - /* object_edit.c */ struct Object *ED_object_context(struct bContext *C); /* context.object */ struct Object *ED_object_active_context(struct bContext *C); /* context.object or context.active_object */ From c42c9cb234524fcde6248df686d359c2fa827fcd Mon Sep 17 00:00:00 2001 From: Gaia Clary Date: Mon, 24 Jun 2013 13:17:21 +0000 Subject: [PATCH 25/72] Added missing include to collada sources --- source/blender/collada/AnimationExporter.h | 1 + source/blender/collada/SkinInfo.cpp | 1 + 2 files changed, 2 insertions(+) diff --git a/source/blender/collada/AnimationExporter.h b/source/blender/collada/AnimationExporter.h index a6f1b89aedb..ea5fd203bea 100644 --- a/source/blender/collada/AnimationExporter.h +++ b/source/blender/collada/AnimationExporter.h @@ -35,6 +35,7 @@ extern "C" #include "DNA_armature_types.h" #include "DNA_material_types.h" #include "DNA_constraint_types.h" +#include "DNA_scene_types.h" #include "BLI_math.h" #include "BLI_string.h" diff --git a/source/blender/collada/SkinInfo.cpp b/source/blender/collada/SkinInfo.cpp index 95baab05e3a..c2770dc3dc5 100644 --- a/source/blender/collada/SkinInfo.cpp +++ b/source/blender/collada/SkinInfo.cpp @@ -37,6 +37,7 @@ #include "BKE_object.h" #include "DNA_armature_types.h" #include "DNA_modifier_types.h" +#include "DNA_scene_types.h" #include "ED_mesh.h" #include "ED_object.h" #include "BKE_action.h" From 1a55b53375cf45481e3916d9d3a96c7ce4204e73 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 24 Jun 2013 13:45:35 +0000 Subject: [PATCH 26/72] lattice: use functions rather then defines, also added a function to get uvw from an index. - BKE_lattice_index_from_uvw() - BKE_lattice_index_to_uvw() --- source/blender/blenkernel/BKE_lattice.h | 3 +++ source/blender/blenkernel/intern/lattice.c | 15 ++++++++++++++- source/blender/editors/object/object_shapekey.c | 7 ++++--- source/blender/editors/object/object_vgroup.c | 4 ++-- source/blender/makesdna/DNA_lattice_types.h | 2 -- source/blender/makesrna/intern/rna_lattice.c | 14 +++++++------- 6 files changed, 30 insertions(+), 15 deletions(-) diff --git a/source/blender/blenkernel/BKE_lattice.h b/source/blender/blenkernel/BKE_lattice.h index b0bf9513814..9b29412675b 100644 --- a/source/blender/blenkernel/BKE_lattice.h +++ b/source/blender/blenkernel/BKE_lattice.h @@ -82,5 +82,8 @@ void BKE_lattice_center_median(struct Lattice *lt, float cent[3]); void BKE_lattice_center_bounds(struct Lattice *lt, float cent[3]); void BKE_lattice_translate(struct Lattice *lt, float offset[3], int do_keys); +int BKE_lattice_index_from_uvw(struct Lattice *lt, const int u, const int v, const int w); +void BKE_lattice_index_to_uvw(struct Lattice *lt, const int index, int *r_u, int *r_v, int *r_w); + #endif diff --git a/source/blender/blenkernel/intern/lattice.c b/source/blender/blenkernel/intern/lattice.c index feb82a34708..23368446675 100644 --- a/source/blender/blenkernel/intern/lattice.c +++ b/source/blender/blenkernel/intern/lattice.c @@ -62,6 +62,19 @@ #include "BKE_deform.h" +int BKE_lattice_index_from_uvw(struct Lattice *lt, + const int u, const int v, const int w) +{ + return (w * (lt->pntsu * lt->pntsv) + (v * lt->pntsu) + u); +} + +void BKE_lattice_index_to_uvw(struct Lattice *lt, const int index, + int *r_u, int *r_v, int *r_w) +{ + *r_u = (index % lt->pntsu); + *r_v = (index / lt->pntsu) % lt->pntsv; + *r_w = (index / (lt->pntsu * lt->pntsv)); +} void calc_lat_fudu(int flag, int res, float *r_fu, float *r_du) { @@ -867,7 +880,7 @@ int object_deform_mball(Object *ob, ListBase *dispbase) static BPoint *latt_bp(Lattice *lt, int u, int v, int w) { - return <->def[LT_INDEX(lt, u, v, w)]; + return <->def[BKE_lattice_index_from_uvw(lt, u, v, w)]; } void outside_lattice(Lattice *lt) diff --git a/source/blender/editors/object/object_shapekey.c b/source/blender/editors/object/object_shapekey.c index f9704343fdd..8fead6024fb 100644 --- a/source/blender/editors/object/object_shapekey.c +++ b/source/blender/editors/object/object_shapekey.c @@ -57,6 +57,7 @@ #include "BKE_library.h" #include "BKE_main.h" #include "BKE_object.h" +#include "BKE_lattice.h" #include "BKE_curve.h" #include "BLI_sys_types.h" // for intptr_t support @@ -244,14 +245,14 @@ static bool object_shape_key_mirror(bContext *C, Object *ob, int u_inv = (lt->pntsu - 1) - u; float tvec[3]; if (u == u_inv) { - i1 = LT_INDEX(lt, u, v, w); + i1 = BKE_lattice_index_from_uvw(lt, u, v, w); fp1 = ((float *)kb->data) + i1 * 3; fp1[0] = -fp1[0]; totmirr++; } else { - i1 = LT_INDEX(lt, u, v, w); - i2 = LT_INDEX(lt, u_inv, v, w); + i1 = BKE_lattice_index_from_uvw(lt, u, v, w); + i2 = BKE_lattice_index_from_uvw(lt, u_inv, v, w); fp1 = ((float *)kb->data) + i1 * 3; fp2 = ((float *)kb->data) + i2 * 3; diff --git a/source/blender/editors/object/object_vgroup.c b/source/blender/editors/object/object_vgroup.c index 2f163a358bc..c5efa91d105 100644 --- a/source/blender/editors/object/object_vgroup.c +++ b/source/blender/editors/object/object_vgroup.c @@ -2477,8 +2477,8 @@ void ED_vgroup_mirror(Object *ob, if (u != u_inv) { BPoint *bp, *bp_mirr; - i1 = LT_INDEX(lt, u, v, w); - i2 = LT_INDEX(lt, u_inv, v, w); + i1 = BKE_lattice_index_from_uvw(lt, u, v, w); + i2 = BKE_lattice_index_from_uvw(lt, u_inv, v, w); bp = <->def[i1]; bp_mirr = <->def[i2]; diff --git a/source/blender/makesdna/DNA_lattice_types.h b/source/blender/makesdna/DNA_lattice_types.h index 500b4ab88c3..837f0c354e6 100644 --- a/source/blender/makesdna/DNA_lattice_types.h +++ b/source/blender/makesdna/DNA_lattice_types.h @@ -83,8 +83,6 @@ typedef struct Lattice { #define LT_DS_EXPAND 4 -#define LT_INDEX(lt, u, v, w) ((w) * ((lt)->pntsu * (lt)->pntsv) + ((v) * (lt)->pntsu) + (u)) - #define LT_ACTBP_NONE -1 #endif diff --git a/source/blender/makesrna/intern/rna_lattice.c b/source/blender/makesrna/intern/rna_lattice.c index b2790a25e47..0cd5fec57df 100644 --- a/source/blender/makesrna/intern/rna_lattice.c +++ b/source/blender/makesrna/intern/rna_lattice.c @@ -54,14 +54,14 @@ static void rna_LatticePoint_co_get(PointerRNA *ptr, float *values) { Lattice *lt = (Lattice *)ptr->id.data; BPoint *bp = (BPoint *)ptr->data; - int a = bp - lt->def; - int x = a % lt->pntsu; - int y = (a / lt->pntsu) % lt->pntsv; - int z = (a / (lt->pntsu * lt->pntsv)); + int index = bp - lt->def; + int u, v, w; - values[0] = lt->fu + x * lt->du; - values[1] = lt->fv + y * lt->dv; - values[2] = lt->fw + z * lt->dw; + BKE_lattice_index_to_uvw(lt, index, &u, &v, &w); + + values[0] = lt->fu + u * lt->du; + values[1] = lt->fv + v * lt->dv; + values[2] = lt->fw + w * lt->dw; } static void rna_LatticePoint_groups_begin(CollectionPropertyIterator *iter, PointerRNA *ptr) From 553dd71efbd69e15157d1b69cc5d4deb628ba7b0 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Mon, 24 Jun 2013 13:46:34 +0000 Subject: [PATCH 27/72] Fix GLSL not showing shading properly on the backside of faces. Now it flips the normal towards the viewer, seems to give consistent results with blender internal, cycles, normal maps, etc. Started from patch #32761 by Vitor Balbio, but changed it to do normal flipping earlier so it solves all cases. --- source/blender/gpu/intern/gpu_codegen.c | 19 +++++++++++++++---- .../gpu/shaders/gpu_shader_material.glsl | 6 +++--- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/source/blender/gpu/intern/gpu_codegen.c b/source/blender/gpu/intern/gpu_codegen.c index 39cae4f01ce..f9e1babcb56 100644 --- a/source/blender/gpu/intern/gpu_codegen.c +++ b/source/blender/gpu/intern/gpu_codegen.c @@ -461,7 +461,7 @@ static void codegen_set_unique_ids(ListBase *nodes) BLI_ghash_free(definehash, NULL, NULL); } -static void codegen_print_uniforms_functions(DynStr *ds, ListBase *nodes) +static int codegen_print_uniforms_functions(DynStr *ds, ListBase *nodes) { GPUNode *node; GPUInput *input; @@ -516,6 +516,8 @@ static void codegen_print_uniforms_functions(DynStr *ds, ListBase *nodes) } BLI_dynstr_append(ds, "\n"); + + return builtins; } static void codegen_declare_tmps(DynStr *ds, ListBase *nodes) @@ -564,8 +566,12 @@ static void codegen_call_functions(DynStr *ds, ListBase *nodes, GPUOutput *final codegen_convert_datatype(ds, input->link->output->type, input->type, "tmp", input->link->output->id); } - else if (input->source == GPU_SOURCE_BUILTIN) - BLI_dynstr_appendf(ds, "%s", GPU_builtin_name(input->builtin)); + else if (input->source == GPU_SOURCE_BUILTIN) { + if(input->builtin == GPU_VIEW_NORMAL) + BLI_dynstr_append(ds, "facingnormal"); + else + BLI_dynstr_append(ds, GPU_builtin_name(input->builtin)); + } else if (input->source == GPU_SOURCE_VEC_UNIFORM) { if (input->dynamicvec) BLI_dynstr_appendf(ds, "unf%d", input->id); @@ -596,11 +602,12 @@ static char *code_generate_fragment(ListBase *nodes, GPUOutput *output, const ch { DynStr *ds = BLI_dynstr_new(); char *code; + int builtins; /*BLI_dynstr_append(ds, FUNCTION_PROTOTYPES);*/ codegen_set_unique_ids(nodes); - codegen_print_uniforms_functions(ds, nodes); + builtins = codegen_print_uniforms_functions(ds, nodes); //if (G.debug & G_DEBUG) // BLI_dynstr_appendf(ds, "/* %s */\n", name); @@ -608,6 +615,10 @@ static char *code_generate_fragment(ListBase *nodes, GPUOutput *output, const ch BLI_dynstr_append(ds, "void main(void)\n"); BLI_dynstr_append(ds, "{\n"); + if(builtins & GPU_VIEW_NORMAL) + BLI_dynstr_append(ds, "\tvec3 facingnormal = (gl_FrontFacing)? varnormal: -varnormal;\n"); + + codegen_declare_tmps(ds, nodes); codegen_call_functions(ds, nodes, output); diff --git a/source/blender/gpu/shaders/gpu_shader_material.glsl b/source/blender/gpu/shaders/gpu_shader_material.glsl index c095d803f48..2aee5b4846a 100644 --- a/source/blender/gpu/shaders/gpu_shader_material.glsl +++ b/source/blender/gpu/shaders/gpu_shader_material.glsl @@ -147,7 +147,7 @@ void geom(vec3 co, vec3 nor, mat4 viewinvmat, vec3 attorco, vec2 attuv, vec4 att normal = -normalize(nor); /* blender render normal is negated */ vcol_attribute(attvcol, vcol); vcol_alpha = attvcol.a; - frontback = 1.0; + frontback = (gl_FrontFacing)? 1.0: 0.0; } void mapping(vec3 vec, mat4 mat, vec3 minvec, vec3 maxvec, float domin, float domax, out vec3 outvec) @@ -2116,7 +2116,7 @@ void node_add_shader(vec4 shader1, vec4 shader2, out vec4 shader) void node_fresnel(float ior, vec3 N, vec3 I, out float result) { float eta = max(ior, 0.00001); - result = fresnel_dielectric(I, N, eta); //backfacing() ? 1.0/eta: eta); + result = fresnel_dielectric(I, N, (gl_FrontFacing)? eta: 1.0/eta); } /* geometry */ @@ -2139,7 +2139,7 @@ void node_geometry(vec3 I, vec3 N, mat4 toworld, true_normal = N; incoming = I; parametric = vec3(0.0); - backfacing = 0.0; + backfacing = (gl_FrontFacing)? 0.0: 1.0; } void node_tex_coord(vec3 I, vec3 N, mat4 viewinvmat, mat4 obinvmat, From 7f454c31f1ccb364ba0e7e229a88302e1d7210a3 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 24 Jun 2013 15:06:14 +0000 Subject: [PATCH 28/72] fix [#35844] "Blender User Preferences" window don't save size font --- source/blender/editors/interface/interface_style.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/editors/interface/interface_style.c b/source/blender/editors/interface/interface_style.c index daa92ef14fc..1c6263c9dd5 100644 --- a/source/blender/editors/interface/interface_style.c +++ b/source/blender/editors/interface/interface_style.c @@ -336,7 +336,7 @@ void uiStyleInit(void) /* recover from uninitialized dpi */ if (U.dpi == 0) U.dpi = 72; - CLAMP(U.dpi, 48, 128); + CLAMP(U.dpi, 48, 144); /* default builtin */ if (font == NULL) { From 5e72a211b51134fcc427201d89c706e2ebb551dd Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 24 Jun 2013 15:13:51 +0000 Subject: [PATCH 29/72] remove unused c file --- source/blender/blenkernel/CMakeLists.txt | 1 - source/blender/blenkernel/intern/script.c | 45 ----------------------- 2 files changed, 46 deletions(-) delete mode 100644 source/blender/blenkernel/intern/script.c diff --git a/source/blender/blenkernel/CMakeLists.txt b/source/blender/blenkernel/CMakeLists.txt index 7e1355b5421..e98d326c443 100644 --- a/source/blender/blenkernel/CMakeLists.txt +++ b/source/blender/blenkernel/CMakeLists.txt @@ -137,7 +137,6 @@ set(SRC intern/sca.c intern/scene.c intern/screen.c - intern/script.c intern/seqcache.c intern/seqeffects.c intern/seqmodifier.c diff --git a/source/blender/blenkernel/intern/script.c b/source/blender/blenkernel/intern/script.c deleted file mode 100644 index 2d1577a86c1..00000000000 --- a/source/blender/blenkernel/intern/script.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * This is a new part of Blender. - * - * Contributor(s): Willian P. Germano. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -/** \file blender/blenkernel/intern/script.c - * \ingroup bke - */ - - - -#include "MEM_guardedalloc.h" - -#if 0 -#ifdef WITH_PYTHON -#include "BPY_extern.h" // Blender Python library -#endif -#endif - -/* XXX this function and so also the file should not be needed anymore, - * since we have to force clearing all Python related data before freeing - * Blender's library. Still testing, will decide later (Willian). */ - From ef64acf6064e0f9ccb86591cda63df8b5b4526f4 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 24 Jun 2013 15:30:37 +0000 Subject: [PATCH 30/72] fix for editing lattice interpolation and options in editmode had no effect (exiting editmode would loose changes too). --- source/blender/makesrna/intern/rna_lattice.c | 33 +++++++++++++++++--- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/source/blender/makesrna/intern/rna_lattice.c b/source/blender/makesrna/intern/rna_lattice.c index 0cd5fec57df..e7b12206871 100644 --- a/source/blender/makesrna/intern/rna_lattice.c +++ b/source/blender/makesrna/intern/rna_lattice.c @@ -42,6 +42,7 @@ #include "DNA_object_types.h" #include "DNA_scene_types.h" +#include "BLI_string.h" #include "BKE_depsgraph.h" #include "BKE_lattice.h" #include "BKE_main.h" @@ -99,6 +100,28 @@ static void rna_Lattice_update_data(Main *UNUSED(bmain), Scene *UNUSED(scene), P WM_main_add_notifier(NC_GEOM | ND_DATA, id); } +/* copy settings to editlattice, + * we could split this up differently (one update call per property) + * but for now thats overkill + */ +static void rna_Lattice_update_data_editlatt(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) +{ + ID *id = ptr->id.data; + Lattice *lt = (Lattice *)ptr->id.data; + + if (lt->editlatt) { + Lattice *lt_em = lt->editlatt->latt; + lt_em->typeu = lt->typeu; + lt_em->typev = lt->typev; + lt_em->typew = lt->typew; + lt_em->flag = lt->flag; + BLI_strncpy(lt_em->vgroup, lt->vgroup, sizeof(lt_em->vgroup)); + } + + DAG_id_tag_update(id, 0); + WM_main_add_notifier(NC_GEOM | ND_DATA, id); +} + static void rna_Lattice_update_size(Main *bmain, Scene *scene, PointerRNA *ptr) { Lattice *lt = ptr->id.data; @@ -291,31 +314,31 @@ static void rna_def_lattice(BlenderRNA *brna) RNA_def_property_enum_sdna(prop, NULL, "typeu"); RNA_def_property_enum_items(prop, keyblock_type_items); RNA_def_property_ui_text(prop, "Interpolation Type U", ""); - RNA_def_property_update(prop, 0, "rna_Lattice_update_data"); + RNA_def_property_update(prop, 0, "rna_Lattice_update_data_editlatt"); prop = RNA_def_property(srna, "interpolation_type_v", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "typev"); RNA_def_property_enum_items(prop, keyblock_type_items); RNA_def_property_ui_text(prop, "Interpolation Type V", ""); - RNA_def_property_update(prop, 0, "rna_Lattice_update_data"); + RNA_def_property_update(prop, 0, "rna_Lattice_update_data_editlatt"); prop = RNA_def_property(srna, "interpolation_type_w", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "typew"); RNA_def_property_enum_items(prop, keyblock_type_items); RNA_def_property_ui_text(prop, "Interpolation Type W", ""); - RNA_def_property_update(prop, 0, "rna_Lattice_update_data"); + RNA_def_property_update(prop, 0, "rna_Lattice_update_data_editlatt"); prop = RNA_def_property(srna, "use_outside", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", LT_OUTSIDE); RNA_def_property_boolean_funcs(prop, NULL, "rna_Lattice_use_outside_set"); RNA_def_property_ui_text(prop, "Outside", "Only draw, and take into account, the outer vertices"); - RNA_def_property_update(prop, 0, "rna_Lattice_update_data"); + RNA_def_property_update(prop, 0, "rna_Lattice_update_data_editlatt"); prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "vgroup"); RNA_def_property_ui_text(prop, "Vertex Group", "Vertex group to apply the influence of the lattice"); RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Lattice_vg_name_set"); - RNA_def_property_update(prop, 0, "rna_Lattice_update_data"); + RNA_def_property_update(prop, 0, "rna_Lattice_update_data_editlatt"); prop = RNA_def_property(srna, "shape_keys", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "key"); From 294b49e312b4c8bd2e4dc2b1711840a11d30abba Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 24 Jun 2013 16:06:27 +0000 Subject: [PATCH 31/72] fix [#35457] Mirror the U texture coordinate does not work in projection painting regression since 2.61 --- source/blender/editors/sculpt_paint/paint_image_proj.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/source/blender/editors/sculpt_paint/paint_image_proj.c b/source/blender/editors/sculpt_paint/paint_image_proj.c index 7f47657c3ff..a24ee13e3bf 100644 --- a/source/blender/editors/sculpt_paint/paint_image_proj.c +++ b/source/blender/editors/sculpt_paint/paint_image_proj.c @@ -2827,20 +2827,19 @@ static void project_paint_begin(ProjPaintState *ps) * this avoids re-generating the derived mesh just to get the new index */ if (ps->do_layer_clone) { //int layer_num = CustomData_get_clone_layer(&ps->dm->faceData, CD_MTFACE); - int layer_num = CustomData_get_clone_layer(&((Mesh *)ps->ob->data)->fdata, CD_MTFACE); + int layer_num = CustomData_get_clone_layer(&((Mesh *)ps->ob->data)->pdata, CD_MTEXPOLY); if (layer_num != -1) ps->dm_mtface_clone = CustomData_get_layer_n(&ps->dm->faceData, CD_MTFACE, layer_num); if (ps->dm_mtface_clone == NULL || ps->dm_mtface_clone == ps->dm_mtface) { ps->do_layer_clone = FALSE; ps->dm_mtface_clone = NULL; - printf("ACK!\n"); } } if (ps->do_layer_stencil) { //int layer_num = CustomData_get_stencil_layer(&ps->dm->faceData, CD_MTFACE); - int layer_num = CustomData_get_stencil_layer(&((Mesh *)ps->ob->data)->fdata, CD_MTFACE); + int layer_num = CustomData_get_stencil_layer(&((Mesh *)ps->ob->data)->pdata, CD_MTEXPOLY); if (layer_num != -1) ps->dm_mtface_stencil = CustomData_get_layer_n(&ps->dm->faceData, CD_MTFACE, layer_num); From afb200f217ddbd0661ffe594ad41f5df6ff644f4 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 24 Jun 2013 18:13:33 +0000 Subject: [PATCH 32/72] calculate polygon normals for BKE_mesh_recalc_tessellation() inline rather then using scanfills function. --- source/blender/blenkernel/intern/mesh.c | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c index aeb1538ccf0..2b59aa4a8bb 100644 --- a/source/blender/blenkernel/intern/mesh.c +++ b/source/blender/blenkernel/intern/mesh.c @@ -2733,8 +2733,14 @@ int BKE_mesh_recalc_tessellation(CustomData *fdata, } #endif /* USE_TESSFACE_SPEEDUP */ else { +#define USE_TESSFACE_CALCNORMAL + int totfilltri; +#ifdef USE_TESSFACE_CALCNORMAL + float normal[3]; + zero_v3(normal); +#endif ml = mloop + mp->loopstart; BLI_scanfill_begin(&sf_ctx); @@ -2745,16 +2751,25 @@ int BKE_mesh_recalc_tessellation(CustomData *fdata, sf_vert->keyindex = mp->loopstart + j; - if (sf_vert_last) + if (sf_vert_last) { BLI_scanfill_edge_add(&sf_ctx, sf_vert_last, sf_vert); +#ifdef USE_TESSFACE_CALCNORMAL + add_newell_cross_v3_v3v3(normal, sf_vert_last->co, sf_vert->co); +#endif + } if (!sf_vert_first) sf_vert_first = sf_vert; sf_vert_last = sf_vert; } BLI_scanfill_edge_add(&sf_ctx, sf_vert_last, sf_vert_first); - +#ifdef USE_TESSFACE_CALCNORMAL + add_newell_cross_v3_v3v3(normal, sf_vert_last->co, sf_vert_first->co); + normalize_v3(normal); + totfilltri = BLI_scanfill_calc_ex(&sf_ctx, 0, normal); +#else totfilltri = BLI_scanfill_calc(&sf_ctx, 0); +#endif BLI_assert(totfilltri <= mp->totloop - 2); (void)totfilltri; @@ -2779,6 +2794,8 @@ int BKE_mesh_recalc_tessellation(CustomData *fdata, } BLI_scanfill_end(&sf_ctx); + +#undef USE_TESSFACE_CALCNORMAL } } From f8c37b083c50ac2c8dd697bcb44401b3a841a170 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 24 Jun 2013 18:22:59 +0000 Subject: [PATCH 33/72] remove own optimization in scanfill, in rare cases it caused problems, reported as [#35861] --- source/blender/blenlib/intern/scanfill.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/source/blender/blenlib/intern/scanfill.c b/source/blender/blenlib/intern/scanfill.c index 44a9ffa244d..b6a86b86188 100644 --- a/source/blender/blenlib/intern/scanfill.c +++ b/source/blender/blenlib/intern/scanfill.c @@ -721,11 +721,8 @@ static int scanfill(ScanFillContext *sf_ctx, PolyFill *pf, const int flag) /* we continue searching and pick the one with sharpest corner */ if (best_sc == NULL) { + /* even without holes we need to keep checking [#35861] */ best_sc = sc1; - /* only need to continue checking with holes */ - if ((flag & BLI_SCANFILL_CALC_HOLES) == 0) { - break; - } } else { float angle; From 898b49f7530e860a9accc4bb5ad897d12c55ef02 Mon Sep 17 00:00:00 2001 From: Daniel Stokes Date: Mon, 24 Jun 2013 21:11:13 +0000 Subject: [PATCH 34/72] Making sure free_nodesystem only frees non-NULL data. This helps address some problems in the BGE with loading multiple blendfiles. --- source/blender/blenkernel/intern/node.c | 60 ++++++++++++++----------- 1 file changed, 33 insertions(+), 27 deletions(-) diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c index 152d74f2ad6..ee8edfe32ae 100644 --- a/source/blender/blenkernel/intern/node.c +++ b/source/blender/blenkernel/intern/node.c @@ -3546,33 +3546,39 @@ void init_nodesystem(void) void free_nodesystem(void) { - NODE_TYPES_BEGIN(nt) - if (nt->ext.free) { - nt->ext.free(nt->ext.data); - } - NODE_TYPES_END - - NODE_SOCKET_TYPES_BEGIN(st) - if (st->ext_socket.free) - st->ext_socket.free(st->ext_socket.data); - if (st->ext_interface.free) - st->ext_interface.free(st->ext_interface.data); - NODE_SOCKET_TYPES_END - - NODE_TREE_TYPES_BEGIN(nt) - if (nt->ext.free) { - nt->ext.free(nt->ext.data); - } - NODE_TREE_TYPES_END - - BLI_ghash_free(nodetypes_hash, NULL, node_free_type); - nodetypes_hash = NULL; - - BLI_ghash_free(nodesockettypes_hash, NULL, node_free_socket_type); - nodesockettypes_hash = NULL; - - BLI_ghash_free(nodetreetypes_hash, NULL, ntree_free_type); - nodetreetypes_hash = NULL; + if (nodetypes_hash) { + NODE_TYPES_BEGIN(nt) + if (nt->ext.free) { + nt->ext.free(nt->ext.data); + } + NODE_TYPES_END + + BLI_ghash_free(nodetypes_hash, NULL, node_free_type); + nodetypes_hash = NULL; + } + + if (nodesockettypes_hash) { + NODE_SOCKET_TYPES_BEGIN(st) + if (st->ext_socket.free) + st->ext_socket.free(st->ext_socket.data); + if (st->ext_interface.free) + st->ext_interface.free(st->ext_interface.data); + NODE_SOCKET_TYPES_END + + BLI_ghash_free(nodesockettypes_hash, NULL, node_free_socket_type); + nodesockettypes_hash = NULL; + } + + if (nodetreetypes_hash) { + NODE_TREE_TYPES_BEGIN(nt) + if (nt->ext.free) { + nt->ext.free(nt->ext.data); + } + NODE_TREE_TYPES_END + + BLI_ghash_free(nodetreetypes_hash, NULL, ntree_free_type); + nodetreetypes_hash = NULL; + } } /* called from BKE_scene_unlink, when deleting a scene goes over all scenes From 0309f442bb232410e4c7594fa659238bd3854127 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Mon, 24 Jun 2013 22:41:24 +0000 Subject: [PATCH 35/72] Render stats text: show elapsed time for blender internal, hide useless "Single Layer" at the start, more clearly indicate what the render time of the last frame was, some other tweaks for consistency. --- intern/cycles/blender/blender_session.cpp | 20 ++++++---- intern/cycles/render/session.cpp | 12 ++++-- .../blender/editors/render/render_internal.c | 40 +++++++++++++++---- .../render/extern/include/RE_pipeline.h | 1 + .../blender/render/intern/source/pipeline.c | 1 + 5 files changed, 56 insertions(+), 18 deletions(-) diff --git a/intern/cycles/blender/blender_session.cpp b/intern/cycles/blender/blender_session.cpp index ecdc631e39a..86bdbc0749f 100644 --- a/intern/cycles/blender/blender_session.cpp +++ b/intern/cycles/blender/blender_session.cpp @@ -616,16 +616,22 @@ void BlenderSession::update_status_progress() get_status(status, substatus); get_progress(progress, total_time); - timestatus = string_printf("Mem: %.2fM, Peak: %.2fM | ", mem_used, mem_peak); + timestatus = string_printf("Mem:%.2fM, Peak:%.2fM", mem_used, mem_peak); - timestatus += b_scene.name(); - if(b_rlay_name != "") - timestatus += ", " + b_rlay_name; - timestatus += " | "; + if(background) { + timestatus += " | " + b_scene.name(); + if(b_rlay_name != "") + timestatus += ", " + b_rlay_name; + } + else { + timestatus += " | "; - BLI_timestr(total_time, time_str, sizeof(time_str)); - timestatus += "Elapsed: " + string(time_str) + " | "; + BLI_timestr(total_time, time_str, sizeof(time_str)); + timestatus += "Time:" + string(time_str); + } + if(status.size() > 0) + status = " | " + status; if(substatus.size() > 0) status += " | " + substatus; diff --git a/intern/cycles/render/session.cpp b/intern/cycles/render/session.cpp index 44364418dcf..d13e86429d6 100644 --- a/intern/cycles/render/session.cpp +++ b/intern/cycles/render/session.cpp @@ -791,12 +791,16 @@ void Session::update_status_time(bool show_pause, bool show_done) else substatus = string_printf("Path Tracing Sample %d/%d", sample+1, tile_manager.num_samples); - if(show_pause) + if(show_pause) { status = "Paused"; - else if(show_done) + } + else if(show_done) { status = "Done"; - else - status = "Rendering"; + } + else { + status = substatus; + substatus = ""; + } progress.set_status(status, substatus); diff --git a/source/blender/editors/render/render_internal.c b/source/blender/editors/render/render_internal.c index 4e94e534c4d..4542f140e67 100644 --- a/source/blender/editors/render/render_internal.c +++ b/source/blender/editors/render/render_internal.c @@ -38,6 +38,8 @@ #include "BLI_threads.h" #include "BLI_utildefines.h" +#include "PIL_time.h" + #include "BLF_translation.h" #include "DNA_object_types.h" @@ -296,13 +298,38 @@ static void make_renderinfo_string(RenderStats *rs, Scene *scene, char *str) mmap_used_memory = (mmap_in_use) / (1024.0 * 1024.0); megs_peak_memory = (peak_memory) / (1024.0 * 1024.0); - spos += sprintf(spos, "%s | ", (scene->lay & 0xFF000000) ? IFACE_("Localview") : IFACE_("Single Layer")); + /* local view */ + if(rs->localview) + spos += sprintf(spos, "%s | ", IFACE_("Local View")); + + /* frame number */ spos += sprintf(spos, IFACE_("Frame:%d "), (scene->r.cfra)); + /* previous and elapsed time */ + BLI_timestr(rs->lastframetime, info_time_str, sizeof(info_time_str)); + + if (rs->infostr && rs->infostr[0]) { + if (rs->lastframetime != 0.0) + spos += sprintf(spos, IFACE_("| Last:%s "), info_time_str); + else + spos += sprintf(spos, "| "); + + BLI_timestr(PIL_check_seconds_timer() - rs->starttime, info_time_str, sizeof(info_time_str)); + } + else + spos += sprintf(spos, "| "); + + spos += sprintf(spos, IFACE_("Time:%s "), info_time_str); + + /* statistics */ if (rs->statstr) { - spos += sprintf(spos, "| %s ", rs->statstr); + if(rs->statstr[0]) + spos += sprintf(spos, "| %s ", rs->statstr); } else { + if (rs->totvert || rs->totface || rs->tothalo || rs->totstrand || rs->totlamp) + spos += sprintf(spos, "| "); + if (rs->totvert) spos += sprintf(spos, IFACE_("Ve:%d "), rs->totvert); if (rs->totface) spos += sprintf(spos, IFACE_("Fa:%d "), rs->totface); if (rs->tothalo) spos += sprintf(spos, IFACE_("Ha:%d "), rs->tothalo); @@ -310,10 +337,10 @@ static void make_renderinfo_string(RenderStats *rs, Scene *scene, char *str) if (rs->totlamp) spos += sprintf(spos, IFACE_("La:%d "), rs->totlamp); if (rs->mem_peak == 0.0f) - spos += sprintf(spos, IFACE_("Mem:%.2fM (%.2fM, Peak %.2fM) "), + spos += sprintf(spos, IFACE_("| Mem:%.2fM (%.2fM, Peak %.2fM) "), megs_used_memory, mmap_used_memory, megs_peak_memory); else - spos += sprintf(spos, IFACE_("Mem:%.2fM, Peak: %.2fM "), rs->mem_used, rs->mem_peak); + spos += sprintf(spos, IFACE_("| Mem:%.2fM, Peak: %.2fM "), rs->mem_used, rs->mem_peak); if (rs->curfield) spos += sprintf(spos, IFACE_("Field %d "), rs->curfield); @@ -321,12 +348,11 @@ static void make_renderinfo_string(RenderStats *rs, Scene *scene, char *str) spos += sprintf(spos, IFACE_("Blur %d "), rs->curblur); } - BLI_timestr(rs->lastframetime, info_time_str, sizeof(info_time_str)); - spos += sprintf(spos, IFACE_("Time:%s "), info_time_str); - + /* full sample */ if (rs->curfsa) spos += sprintf(spos, IFACE_("| Full Sample %d "), rs->curfsa); + /* extra info */ if (rs->infostr && rs->infostr[0]) spos += sprintf(spos, "| %s ", rs->infostr); diff --git a/source/blender/render/extern/include/RE_pipeline.h b/source/blender/render/extern/include/RE_pipeline.h index 118d0036464..da53bc5a819 100644 --- a/source/blender/render/extern/include/RE_pipeline.h +++ b/source/blender/render/extern/include/RE_pipeline.h @@ -145,6 +145,7 @@ typedef struct RenderStats { int cfra; int totface, totvert, totstrand, tothalo, totlamp, totpart; short curfield, curblur, curpart, partsdone, convertdone, curfsa; + bool localview; double starttime, lastframetime; const char *infostr, *statstr; char scene_name[MAX_ID_NAME - 2]; diff --git a/source/blender/render/intern/source/pipeline.c b/source/blender/render/intern/source/pipeline.c index 51fb83d010b..f161e139989 100644 --- a/source/blender/render/intern/source/pipeline.c +++ b/source/blender/render/intern/source/pipeline.c @@ -2379,6 +2379,7 @@ static int render_initialize_from_main(Render *re, Main *bmain, Scene *scene, Sc re->scene_color_manage = BKE_scene_check_color_management_enabled(scene); re->camera_override = camera_override; re->lay = lay; + re->i.localview = (lay & 0xFF000000) != 0; /* not too nice, but it survives anim-border render */ if (anim) { From 8390aa5181d3dd9c8458fa68c2add910c1cd12e9 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Mon, 24 Jun 2013 22:41:27 +0000 Subject: [PATCH 36/72] Fix unnecessary redraw of 3D views when making changes in compositing nodes. --- source/blender/editors/include/ED_object.h | 2 ++ source/blender/editors/space_node/node_edit.c | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/source/blender/editors/include/ED_object.h b/source/blender/editors/include/ED_object.h index 90b131e5acc..e891f648713 100644 --- a/source/blender/editors/include/ED_object.h +++ b/source/blender/editors/include/ED_object.h @@ -69,6 +69,8 @@ struct PointerRNA; struct PropertyRNA; struct EnumPropertyItem; +enum eVGroupSelect; + /* object_edit.c */ struct Object *ED_object_context(struct bContext *C); /* context.object */ struct Object *ED_object_active_context(struct bContext *C); /* context.object or context.active_object */ diff --git a/source/blender/editors/space_node/node_edit.c b/source/blender/editors/space_node/node_edit.c index 89fa58cd750..e10cba43d71 100644 --- a/source/blender/editors/space_node/node_edit.c +++ b/source/blender/editors/space_node/node_edit.c @@ -222,7 +222,7 @@ static void compo_updatejob(void *cjv) cj->need_sync = FALSE; } - WM_main_add_notifier(NC_WINDOW | ND_DRAW, NULL); + WM_main_add_notifier(NC_SCENE | ND_COMPO_RESULT, NULL); } static void compo_progressjob(void *cjv, float progress) @@ -299,7 +299,7 @@ void ED_node_composite_job(const bContext *C, struct bNodeTree *nodetree, Scene /* setup job */ WM_jobs_customdata_set(wm_job, cj, compo_freejob); - WM_jobs_timer(wm_job, 0.1, NC_SCENE, NC_SCENE | ND_COMPO_RESULT); + WM_jobs_timer(wm_job, 0.1, NC_SCENE | ND_COMPO_RESULT, NC_SCENE | ND_COMPO_RESULT); WM_jobs_callbacks(wm_job, compo_startjob, compo_initjob, compo_updatejob, NULL); WM_jobs_start(CTX_wm_manager(C), wm_job); From 02fbfa5c70732e691606546ecce60fdfe3f80d9f Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Mon, 24 Jun 2013 22:41:33 +0000 Subject: [PATCH 37/72] Fix unnecessary 3D viewport redraws in various cases, in particular when editing node materials. Area and region listener callbacks now get the screen and area pointers passed, so they can do more fine grained checks to see if redraw is really needed, for example depending on the 3D view drawtype. --- source/blender/blenkernel/BKE_screen.h | 4 +- source/blender/editors/include/ED_screen.h | 4 +- .../editors/interface/interface_templates.c | 2 +- source/blender/editors/screen/area.c | 8 ++-- .../editors/space_action/space_action.c | 8 ++-- .../editors/space_buttons/space_buttons.c | 4 +- .../blender/editors/space_clip/space_clip.c | 14 +++--- .../editors/space_console/space_console.c | 2 +- .../blender/editors/space_file/space_file.c | 8 ++-- .../blender/editors/space_graph/space_graph.c | 4 +- .../blender/editors/space_image/space_image.c | 10 ++--- .../blender/editors/space_info/space_info.c | 4 +- .../blender/editors/space_logic/space_logic.c | 2 +- source/blender/editors/space_nla/space_nla.c | 8 ++-- source/blender/editors/space_node/node_draw.c | 6 +-- .../blender/editors/space_node/space_node.c | 4 +- .../editors/space_outliner/space_outliner.c | 4 +- .../editors/space_script/space_script.c | 2 +- .../editors/space_sequencer/space_sequencer.c | 8 ++-- .../blender/editors/space_text/space_text.c | 2 +- .../blender/editors/space_time/space_time.c | 6 +-- .../editors/space_userpref/space_userpref.c | 4 +- .../editors/space_view3d/space_view3d.c | 22 +++++++--- source/blender/makesrna/intern/rna_material.c | 12 +---- source/blender/windowmanager/WM_types.h | 1 + .../windowmanager/intern/wm_event_system.c | 44 +++++++++++-------- 26 files changed, 105 insertions(+), 92 deletions(-) diff --git a/source/blender/blenkernel/BKE_screen.h b/source/blender/blenkernel/BKE_screen.h index 5407e22e49e..b5a6c6fb821 100644 --- a/source/blender/blenkernel/BKE_screen.h +++ b/source/blender/blenkernel/BKE_screen.h @@ -78,7 +78,7 @@ typedef struct SpaceType { /* exit is called when the area is hidden or removed */ void (*exit)(struct wmWindowManager *, struct ScrArea *); /* Listeners can react to bContext changes */ - void (*listener)(struct ScrArea *, struct wmNotifier *); + void (*listener)(struct bScreen *sc, struct ScrArea *, struct wmNotifier *); /* refresh context, called after filereads, ED_area_tag_refresh() */ void (*refresh)(const struct bContext *, struct ScrArea *); @@ -123,7 +123,7 @@ typedef struct ARegionType { /* draw entirely, view changes should be handled here */ void (*draw)(const struct bContext *, struct ARegion *); /* contextual changes should be handled here */ - void (*listener)(struct ARegion *, struct wmNotifier *); + void (*listener)(struct bScreen *sc, struct ScrArea *, struct ARegion *, struct wmNotifier *); void (*free)(struct ARegion *); diff --git a/source/blender/editors/include/ED_screen.h b/source/blender/editors/include/ED_screen.h index 12030f7da80..d80e40d2455 100644 --- a/source/blender/editors/include/ED_screen.h +++ b/source/blender/editors/include/ED_screen.h @@ -50,7 +50,7 @@ struct uiBlock; struct rcti; /* regions */ -void ED_region_do_listen(struct ARegion *ar, struct wmNotifier *note); +void ED_region_do_listen(struct bScreen *sc, struct ScrArea *sa, struct ARegion *ar, struct wmNotifier *note); void ED_region_do_draw(struct bContext *C, struct ARegion *ar); void ED_region_exit(struct bContext *C, struct ARegion *ar); void ED_region_pixelspace(struct ARegion *ar); @@ -80,7 +80,7 @@ int ED_area_header_standardbuttons(const struct bContext *C, struct uiBlock void ED_area_initialize(struct wmWindowManager *wm, struct wmWindow *win, struct ScrArea *sa); void ED_area_exit(struct bContext *C, struct ScrArea *sa); int ED_screen_area_active(const struct bContext *C); -void ED_area_do_listen(ScrArea *sa, struct wmNotifier *note); +void ED_area_do_listen(struct bScreen *sc, ScrArea *sa, struct wmNotifier *note); void ED_area_tag_redraw(ScrArea *sa); void ED_area_tag_redraw_regiontype(ScrArea *sa, int type); void ED_area_tag_refresh(ScrArea *sa); diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index 464fcfb0496..34d1c24aade 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -1284,7 +1284,7 @@ static void do_preview_buttons(bContext *C, void *arg, int event) { switch (event) { case B_MATPRV: - WM_event_add_notifier(C, NC_MATERIAL | ND_SHADING, arg); + WM_event_add_notifier(C, NC_MATERIAL | ND_SHADING_PREVIEW, arg); break; } } diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c index 429156ea6a7..4ddacc3254e 100644 --- a/source/blender/editors/screen/area.c +++ b/source/blender/editors/screen/area.c @@ -116,7 +116,7 @@ void ED_region_pixelspace(ARegion *ar) } /* only exported for WM */ -void ED_region_do_listen(ARegion *ar, wmNotifier *note) +void ED_region_do_listen(bScreen *sc, ScrArea *sa, ARegion *ar, wmNotifier *note) { /* generic notes first */ switch (note->category) { @@ -130,15 +130,15 @@ void ED_region_do_listen(ARegion *ar, wmNotifier *note) } if (ar->type && ar->type->listener) - ar->type->listener(ar, note); + ar->type->listener(sc, sa, ar, note); } /* only exported for WM */ -void ED_area_do_listen(ScrArea *sa, wmNotifier *note) +void ED_area_do_listen(bScreen *sc, ScrArea *sa, wmNotifier *note) { /* no generic notes? */ if (sa->type && sa->type->listener) { - sa->type->listener(sa, note); + sa->type->listener(sc, sa, note); } } diff --git a/source/blender/editors/space_action/space_action.c b/source/blender/editors/space_action/space_action.c index b2bb455a0ba..7b0ff5a656f 100644 --- a/source/blender/editors/space_action/space_action.c +++ b/source/blender/editors/space_action/space_action.c @@ -269,7 +269,7 @@ static void action_header_area_draw(const bContext *C, ARegion *ar) ED_region_header(C, ar); } -static void action_channel_area_listener(ARegion *ar, wmNotifier *wmn) +static void action_channel_area_listener(bScreen *UNUSED(sc), ScrArea *UNUSED(sa), ARegion *ar, wmNotifier *wmn) { /* context changes */ switch (wmn->category) { @@ -307,7 +307,7 @@ static void action_channel_area_listener(ARegion *ar, wmNotifier *wmn) } } -static void action_main_area_listener(ARegion *ar, wmNotifier *wmn) +static void action_main_area_listener(bScreen *UNUSED(sc), ScrArea *UNUSED(sa), ARegion *ar, wmNotifier *wmn) { /* context changes */ switch (wmn->category) { @@ -355,7 +355,7 @@ static void action_main_area_listener(ARegion *ar, wmNotifier *wmn) } /* editor level listener */ -static void action_listener(ScrArea *sa, wmNotifier *wmn) +static void action_listener(bScreen *UNUSED(sc), ScrArea *sa, wmNotifier *wmn) { SpaceAction *saction = (SpaceAction *)sa->spacedata.first; @@ -448,7 +448,7 @@ static void action_listener(ScrArea *sa, wmNotifier *wmn) } } -static void action_header_area_listener(ARegion *ar, wmNotifier *wmn) +static void action_header_area_listener(bScreen *UNUSED(sc), ScrArea *UNUSED(sa), ARegion *ar, wmNotifier *wmn) { /* context changes */ switch (wmn->category) { diff --git a/source/blender/editors/space_buttons/space_buttons.c b/source/blender/editors/space_buttons/space_buttons.c index e6c6df416bf..b01f653837c 100644 --- a/source/blender/editors/space_buttons/space_buttons.c +++ b/source/blender/editors/space_buttons/space_buttons.c @@ -225,7 +225,7 @@ static void buttons_area_redraw(ScrArea *sa, short buttons) } /* reused! */ -static void buttons_area_listener(ScrArea *sa, wmNotifier *wmn) +static void buttons_area_listener(bScreen *UNUSED(sc), ScrArea *sa, wmNotifier *wmn) { SpaceButs *sbuts = sa->spacedata.first; @@ -295,6 +295,7 @@ static void buttons_area_listener(ScrArea *sa, wmNotifier *wmn) case ND_SHADING: case ND_SHADING_DRAW: case ND_SHADING_LINKS: + case ND_SHADING_PREVIEW: /* currently works by redraws... if preview is set, it (re)starts job */ sbuts->preview = 1; break; @@ -318,6 +319,7 @@ static void buttons_area_listener(ScrArea *sa, wmNotifier *wmn) case ND_SHADING: case ND_SHADING_DRAW: case ND_SHADING_LINKS: + case ND_SHADING_PREVIEW: case ND_NODES: /* currently works by redraws... if preview is set, it (re)starts job */ sbuts->preview = 1; diff --git a/source/blender/editors/space_clip/space_clip.c b/source/blender/editors/space_clip/space_clip.c index 986b71abc8a..36cf9fc44c6 100644 --- a/source/blender/editors/space_clip/space_clip.c +++ b/source/blender/editors/space_clip/space_clip.c @@ -340,7 +340,7 @@ static SpaceLink *clip_duplicate(SpaceLink *sl) return (SpaceLink *)scn; } -static void clip_listener(ScrArea *sa, wmNotifier *wmn) +static void clip_listener(bScreen *UNUSED(sc), ScrArea *sa, wmNotifier *wmn) { /* context changes */ switch (wmn->category) { @@ -1174,7 +1174,7 @@ static void clip_main_area_draw(const bContext *C, ARegion *ar) } } -static void clip_main_area_listener(ARegion *ar, wmNotifier *wmn) +static void clip_main_area_listener(bScreen *UNUSED(sc), ScrArea *UNUSED(sa), ARegion *ar, wmNotifier *wmn) { /* context changes */ switch (wmn->category) { @@ -1283,7 +1283,7 @@ static void clip_preview_area_draw(const bContext *C, ARegion *ar) dopesheet_area_draw(C, ar); } -static void clip_preview_area_listener(ARegion *UNUSED(ar), wmNotifier *UNUSED(wmn)) +static void clip_preview_area_listener(bScreen *UNUSED(sc), ScrArea *UNUSED(sa), ARegion *UNUSED(ar), wmNotifier *UNUSED(wmn)) { } @@ -1324,7 +1324,7 @@ static void clip_channels_area_draw(const bContext *C, ARegion *ar) UI_view2d_view_restore(C); } -static void clip_channels_area_listener(ARegion *UNUSED(ar), wmNotifier *UNUSED(wmn)) +static void clip_channels_area_listener(bScreen *UNUSED(sc), ScrArea *UNUSED(sa), ARegion *UNUSED(ar), wmNotifier *UNUSED(wmn)) { } @@ -1341,7 +1341,7 @@ static void clip_header_area_draw(const bContext *C, ARegion *ar) ED_region_header(C, ar); } -static void clip_header_area_listener(ARegion *ar, wmNotifier *wmn) +static void clip_header_area_listener(bScreen *UNUSED(sc), ScrArea *UNUSED(sa), ARegion *ar, wmNotifier *wmn) { /* context changes */ switch (wmn->category) { @@ -1381,7 +1381,7 @@ static void clip_tools_area_draw(const bContext *C, ARegion *ar) /****************** tool properties region ******************/ -static void clip_props_area_listener(ARegion *ar, wmNotifier *wmn) +static void clip_props_area_listener(bScreen *UNUSED(sc), ScrArea *UNUSED(sa), ARegion *ar, wmNotifier *wmn) { /* context changes */ switch (wmn->category) { @@ -1426,7 +1426,7 @@ static void clip_properties_area_draw(const bContext *C, ARegion *ar) ED_region_panels(C, ar, 1, NULL, -1); } -static void clip_properties_area_listener(ARegion *ar, wmNotifier *wmn) +static void clip_properties_area_listener(bScreen *UNUSED(sc), ScrArea *UNUSED(sa), ARegion *ar, wmNotifier *wmn) { /* context changes */ switch (wmn->category) { diff --git a/source/blender/editors/space_console/space_console.c b/source/blender/editors/space_console/space_console.c index 81211e7bfef..88a04197847 100644 --- a/source/blender/editors/space_console/space_console.c +++ b/source/blender/editors/space_console/space_console.c @@ -359,7 +359,7 @@ static void console_header_area_draw(const bContext *C, ARegion *ar) ED_region_header(C, ar); } -static void console_main_area_listener(ARegion *ar, wmNotifier *wmn) +static void console_main_area_listener(bScreen *UNUSED(sc), ScrArea *UNUSED(sa), ARegion *ar, wmNotifier *wmn) { // SpaceInfo *sinfo = sa->spacedata.first; diff --git a/source/blender/editors/space_file/space_file.c b/source/blender/editors/space_file/space_file.c index 56b0a5481bf..8b1df0f0d8f 100644 --- a/source/blender/editors/space_file/space_file.c +++ b/source/blender/editors/space_file/space_file.c @@ -255,7 +255,7 @@ static void file_refresh(const bContext *C, ScrArea *UNUSED(sa)) } -static void file_listener(ScrArea *sa, wmNotifier *wmn) +static void file_listener(bScreen *UNUSED(sc), ScrArea *sa, wmNotifier *wmn) { /* SpaceFile *sfile = (SpaceFile *)sa->spacedata.first; */ @@ -291,7 +291,7 @@ static void file_main_area_init(wmWindowManager *wm, ARegion *ar) WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct); } -static void file_main_area_listener(ARegion *ar, wmNotifier *wmn) +static void file_main_area_listener(bScreen *UNUSED(sc), ScrArea *UNUSED(sa), ARegion *ar, wmNotifier *wmn) { /* context changes */ switch (wmn->category) { @@ -500,7 +500,7 @@ static void file_channel_area_draw(const bContext *C, ARegion *ar) ED_region_panels(C, ar, 1, NULL, -1); } -static void file_channel_area_listener(ARegion *UNUSED(ar), wmNotifier *wmn) +static void file_channel_area_listener(bScreen *UNUSED(sc), ScrArea *UNUSED(sa), ARegion *UNUSED(ar), wmNotifier *wmn) { /* context changes */ switch (wmn->category) { @@ -560,7 +560,7 @@ static void file_ui_area_draw(const bContext *C, ARegion *ar) UI_view2d_view_restore(C); } -static void file_ui_area_listener(ARegion *ar, wmNotifier *wmn) +static void file_ui_area_listener(bScreen *UNUSED(sc), ScrArea *UNUSED(sa), ARegion *ar, wmNotifier *wmn) { /* context changes */ switch (wmn->category) { diff --git a/source/blender/editors/space_graph/space_graph.c b/source/blender/editors/space_graph/space_graph.c index 1a208ee2eb6..6e38f236d01 100644 --- a/source/blender/editors/space_graph/space_graph.c +++ b/source/blender/editors/space_graph/space_graph.c @@ -384,7 +384,7 @@ static void graph_buttons_area_draw(const bContext *C, ARegion *ar) ED_region_panels(C, ar, 1, NULL, -1); } -static void graph_region_listener(ARegion *ar, wmNotifier *wmn) +static void graph_region_listener(bScreen *UNUSED(sc), ScrArea *UNUSED(sa), ARegion *ar, wmNotifier *wmn) { /* context changes */ switch (wmn->category) { @@ -438,7 +438,7 @@ static void graph_region_listener(ARegion *ar, wmNotifier *wmn) } /* editor level listener */ -static void graph_listener(ScrArea *sa, wmNotifier *wmn) +static void graph_listener(bScreen *UNUSED(sc), ScrArea *sa, wmNotifier *wmn) { SpaceIpo *sipo = (SpaceIpo *)sa->spacedata.first; diff --git a/source/blender/editors/space_image/space_image.c b/source/blender/editors/space_image/space_image.c index 679c1632eb1..fd57bf6101f 100644 --- a/source/blender/editors/space_image/space_image.c +++ b/source/blender/editors/space_image/space_image.c @@ -420,7 +420,7 @@ static void image_refresh(const bContext *C, ScrArea *sa) } } -static void image_listener(ScrArea *sa, wmNotifier *wmn) +static void image_listener(bScreen *UNUSED(sc), ScrArea *sa, wmNotifier *wmn) { SpaceImage *sima = (SpaceImage *)sa->spacedata.first; @@ -731,7 +731,7 @@ static void image_main_area_draw(const bContext *C, ARegion *ar) #endif } -static void image_main_area_listener(ARegion *ar, wmNotifier *wmn) +static void image_main_area_listener(bScreen *UNUSED(sc), ScrArea *UNUSED(sa), ARegion *ar, wmNotifier *wmn) { /* context changes */ switch (wmn->category) { @@ -765,7 +765,7 @@ static void image_buttons_area_draw(const bContext *C, ARegion *ar) ED_region_panels(C, ar, 1, NULL, -1); } -static void image_buttons_area_listener(ARegion *ar, wmNotifier *wmn) +static void image_buttons_area_listener(bScreen *UNUSED(sc), ScrArea *UNUSED(sa), ARegion *ar, wmNotifier *wmn) { /* context changes */ switch (wmn->category) { @@ -821,7 +821,7 @@ static void image_scope_area_draw(const bContext *C, ARegion *ar) ED_region_panels(C, ar, 1, NULL, -1); } -static void image_scope_area_listener(ARegion *ar, wmNotifier *wmn) +static void image_scope_area_listener(bScreen *UNUSED(sc), ScrArea *UNUSED(sa), ARegion *ar, wmNotifier *wmn) { /* context changes */ switch (wmn->category) { @@ -858,7 +858,7 @@ static void image_header_area_draw(const bContext *C, ARegion *ar) ED_region_header(C, ar); } -static void image_header_area_listener(ARegion *ar, wmNotifier *wmn) +static void image_header_area_listener(bScreen *UNUSED(sc), ScrArea *UNUSED(sa), ARegion *ar, wmNotifier *wmn) { /* context changes */ switch (wmn->category) { diff --git a/source/blender/editors/space_info/space_info.c b/source/blender/editors/space_info/space_info.c index 96ad6dee2df..10b935502ba 100644 --- a/source/blender/editors/space_info/space_info.c +++ b/source/blender/editors/space_info/space_info.c @@ -233,7 +233,7 @@ static void info_header_area_draw(const bContext *C, ARegion *ar) ED_region_header(C, ar); } -static void info_main_area_listener(ARegion *ar, wmNotifier *wmn) +static void info_main_area_listener(bScreen *UNUSED(sc), ScrArea *UNUSED(sa), ARegion *ar, wmNotifier *wmn) { // SpaceInfo *sinfo = sa->spacedata.first; @@ -248,7 +248,7 @@ static void info_main_area_listener(ARegion *ar, wmNotifier *wmn) } } -static void info_header_listener(ARegion *ar, wmNotifier *wmn) +static void info_header_listener(bScreen *UNUSED(sc), ScrArea *UNUSED(sa), ARegion *ar, wmNotifier *wmn) { /* context changes */ switch (wmn->category) { diff --git a/source/blender/editors/space_logic/space_logic.c b/source/blender/editors/space_logic/space_logic.c index 3f3c81f2bfa..4682bbc59ff 100644 --- a/source/blender/editors/space_logic/space_logic.c +++ b/source/blender/editors/space_logic/space_logic.c @@ -194,7 +194,7 @@ static void logic_refresh(const bContext *UNUSED(C), ScrArea *UNUSED(sa)) } -static void logic_listener(ARegion *ar, wmNotifier *wmn) +static void logic_listener(bScreen *UNUSED(sc), ScrArea *UNUSED(sa), ARegion *ar, wmNotifier *wmn) { /* context changes */ switch (wmn->category) { diff --git a/source/blender/editors/space_nla/space_nla.c b/source/blender/editors/space_nla/space_nla.c index 4ef84b3e708..e54c1e8323a 100644 --- a/source/blender/editors/space_nla/space_nla.c +++ b/source/blender/editors/space_nla/space_nla.c @@ -353,7 +353,7 @@ static void nla_buttons_area_draw(const bContext *C, ARegion *ar) ED_region_panels(C, ar, 1, NULL, -1); } -static void nla_region_listener(ARegion *ar, wmNotifier *wmn) +static void nla_region_listener(bScreen *UNUSED(sc), ScrArea *UNUSED(sa), ARegion *ar, wmNotifier *wmn) { /* context changes */ switch (wmn->category) { @@ -386,7 +386,7 @@ static void nla_region_listener(ARegion *ar, wmNotifier *wmn) } -static void nla_main_area_listener(ARegion *ar, wmNotifier *wmn) +static void nla_main_area_listener(bScreen *UNUSED(sc), ScrArea *UNUSED(sa), ARegion *ar, wmNotifier *wmn) { /* context changes */ switch (wmn->category) { @@ -430,7 +430,7 @@ static void nla_main_area_listener(ARegion *ar, wmNotifier *wmn) } } -static void nla_channel_area_listener(ARegion *ar, wmNotifier *wmn) +static void nla_channel_area_listener(bScreen *UNUSED(sc), ScrArea *UNUSED(sa), ARegion *ar, wmNotifier *wmn) { /* context changes */ switch (wmn->category) { @@ -465,7 +465,7 @@ static void nla_channel_area_listener(ARegion *ar, wmNotifier *wmn) } /* editor level listener */ -static void nla_listener(ScrArea *sa, wmNotifier *wmn) +static void nla_listener(bScreen *UNUSED(sc), ScrArea *sa, wmNotifier *wmn) { /* context changes */ switch (wmn->category) { diff --git a/source/blender/editors/space_node/node_draw.c b/source/blender/editors/space_node/node_draw.c index 0ed803a7521..7da06bcf3a6 100644 --- a/source/blender/editors/space_node/node_draw.c +++ b/source/blender/editors/space_node/node_draw.c @@ -119,11 +119,11 @@ void ED_node_tag_update_id(ID *id) DAG_id_tag_update(id, 0); if (GS(id->name) == ID_MA) - WM_main_add_notifier(NC_MATERIAL | ND_SHADING_DRAW, id); + WM_main_add_notifier(NC_MATERIAL | ND_SHADING, id); else if (GS(id->name) == ID_LA) - WM_main_add_notifier(NC_LAMP | ND_LIGHTING_DRAW, id); + WM_main_add_notifier(NC_LAMP | ND_LIGHTING, id); else if (GS(id->name) == ID_WO) - WM_main_add_notifier(NC_WORLD | ND_WORLD_DRAW, id); + WM_main_add_notifier(NC_WORLD | ND_WORLD, id); } else if (ntree->type == NTREE_COMPOSIT) { WM_main_add_notifier(NC_SCENE | ND_NODES, id); diff --git a/source/blender/editors/space_node/space_node.c b/source/blender/editors/space_node/space_node.c index d0d74059da8..07fa6997e99 100644 --- a/source/blender/editors/space_node/space_node.c +++ b/source/blender/editors/space_node/space_node.c @@ -377,7 +377,7 @@ static void node_init(struct wmWindowManager *UNUSED(wm), ScrArea *UNUSED(sa)) } -static void node_area_listener(ScrArea *sa, wmNotifier *wmn) +static void node_area_listener(bScreen *UNUSED(sc), ScrArea *sa, wmNotifier *wmn) { /* note, ED_area_tag_refresh will re-execute compositor */ SpaceNode *snode = sa->spacedata.first; @@ -682,7 +682,7 @@ static void node_header_area_draw(const bContext *C, ARegion *ar) } /* used for header + main area */ -static void node_region_listener(ARegion *ar, wmNotifier *wmn) +static void node_region_listener(bScreen *UNUSED(sc), ScrArea *UNUSED(sa), ARegion *ar, wmNotifier *wmn) { /* context changes */ switch (wmn->category) { diff --git a/source/blender/editors/space_outliner/space_outliner.c b/source/blender/editors/space_outliner/space_outliner.c index 9e458647aa2..8da244b1db1 100644 --- a/source/blender/editors/space_outliner/space_outliner.c +++ b/source/blender/editors/space_outliner/space_outliner.c @@ -262,7 +262,7 @@ static void outliner_main_area_free(ARegion *UNUSED(ar)) } -static void outliner_main_area_listener(ARegion *ar, wmNotifier *wmn) +static void outliner_main_area_listener(bScreen *UNUSED(sc), ScrArea *UNUSED(sa), ARegion *ar, wmNotifier *wmn) { /* context changes */ switch (wmn->category) { @@ -378,7 +378,7 @@ static void outliner_header_area_free(ARegion *UNUSED(ar)) { } -static void outliner_header_area_listener(ARegion *ar, wmNotifier *wmn) +static void outliner_header_area_listener(bScreen *UNUSED(sc), ScrArea *UNUSED(sa), ARegion *ar, wmNotifier *wmn) { /* context changes */ switch (wmn->category) { diff --git a/source/blender/editors/space_script/space_script.c b/source/blender/editors/space_script/space_script.c index a6c4ac231df..fd2cd268a27 100644 --- a/source/blender/editors/space_script/space_script.c +++ b/source/blender/editors/space_script/space_script.c @@ -178,7 +178,7 @@ static void script_header_area_draw(const bContext *C, ARegion *ar) ED_region_header(C, ar); } -static void script_main_area_listener(ARegion *UNUSED(ar), wmNotifier *UNUSED(wmn)) +static void script_main_area_listener(bScreen *UNUSED(sc), ScrArea *UNUSED(sa), ARegion *UNUSED(ar), wmNotifier *UNUSED(wmn)) { /* context changes */ // XXX - Todo, need the ScriptSpace accessible to get the python script to run. diff --git a/source/blender/editors/space_sequencer/space_sequencer.c b/source/blender/editors/space_sequencer/space_sequencer.c index 08848645bf9..04b2a21bf79 100644 --- a/source/blender/editors/space_sequencer/space_sequencer.c +++ b/source/blender/editors/space_sequencer/space_sequencer.c @@ -318,7 +318,7 @@ static SpaceLink *sequencer_duplicate(SpaceLink *sl) return (SpaceLink *)sseqn; } -static void sequencer_listener(ScrArea *sa, wmNotifier *wmn) +static void sequencer_listener(bScreen *UNUSED(sc), ScrArea *sa, wmNotifier *wmn) { /* context changes */ switch (wmn->category) { @@ -480,7 +480,7 @@ static void sequencer_header_area_draw(const bContext *C, ARegion *ar) ED_region_header(C, ar); } -static void sequencer_main_area_listener(ARegion *ar, wmNotifier *wmn) +static void sequencer_main_area_listener(bScreen *UNUSED(sc), ScrArea *UNUSED(sa), ARegion *ar, wmNotifier *wmn) { /* context changes */ switch (wmn->category) { @@ -555,7 +555,7 @@ static void sequencer_preview_area_draw(const bContext *C, ARegion *ar) } -static void sequencer_preview_area_listener(ARegion *ar, wmNotifier *wmn) +static void sequencer_preview_area_listener(bScreen *UNUSED(sc), ScrArea *UNUSED(sa), ARegion *ar, wmNotifier *wmn) { /* context changes */ switch (wmn->category) { @@ -612,7 +612,7 @@ static void sequencer_buttons_area_draw(const bContext *C, ARegion *ar) ED_region_panels(C, ar, 1, NULL, -1); } -static void sequencer_buttons_area_listener(ARegion *ar, wmNotifier *wmn) +static void sequencer_buttons_area_listener(bScreen *UNUSED(sc), ScrArea *UNUSED(sa), ARegion *ar, wmNotifier *wmn) { /* context changes */ switch (wmn->category) { diff --git a/source/blender/editors/space_text/space_text.c b/source/blender/editors/space_text/space_text.c index 92b6b78e536..e7fa4c05b9d 100644 --- a/source/blender/editors/space_text/space_text.c +++ b/source/blender/editors/space_text/space_text.c @@ -116,7 +116,7 @@ static SpaceLink *text_duplicate(SpaceLink *sl) return (SpaceLink *)stextn; } -static void text_listener(ScrArea *sa, wmNotifier *wmn) +static void text_listener(bScreen *UNUSED(sc), ScrArea *sa, wmNotifier *wmn) { SpaceText *st = sa->spacedata.first; diff --git a/source/blender/editors/space_time/space_time.c b/source/blender/editors/space_time/space_time.c index 0f798aa1893..8258d717889 100644 --- a/source/blender/editors/space_time/space_time.c +++ b/source/blender/editors/space_time/space_time.c @@ -397,7 +397,7 @@ static void time_refresh(const bContext *UNUSED(C), ScrArea *sa) } /* editor level listener */ -static void time_listener(ScrArea *sa, wmNotifier *wmn) +static void time_listener(bScreen *UNUSED(sc), ScrArea *sa, wmNotifier *wmn) { /* mainly for updating cache display */ @@ -523,7 +523,7 @@ static void time_main_area_draw(const bContext *C, ARegion *ar) UI_view2d_scrollers_free(scrollers); } -static void time_main_area_listener(ARegion *ar, wmNotifier *wmn) +static void time_main_area_listener(bScreen *UNUSED(sc), ScrArea *UNUSED(sa), ARegion *ar, wmNotifier *wmn) { /* context changes */ switch (wmn->category) { @@ -563,7 +563,7 @@ static void time_header_area_draw(const bContext *C, ARegion *ar) ED_region_header(C, ar); } -static void time_header_area_listener(ARegion *ar, wmNotifier *wmn) +static void time_header_area_listener(bScreen *UNUSED(sc), ScrArea *UNUSED(sa), ARegion *ar, wmNotifier *wmn) { /* context changes */ switch (wmn->category) { diff --git a/source/blender/editors/space_userpref/space_userpref.c b/source/blender/editors/space_userpref/space_userpref.c index 5ebbebec35b..0bd094b6a33 100644 --- a/source/blender/editors/space_userpref/space_userpref.c +++ b/source/blender/editors/space_userpref/space_userpref.c @@ -138,12 +138,12 @@ static void userpref_header_area_draw(const bContext *C, ARegion *ar) ED_region_header(C, ar); } -static void userpref_main_area_listener(ARegion *UNUSED(ar), wmNotifier *UNUSED(wmn)) +static void userpref_main_area_listener(bScreen *UNUSED(sc), ScrArea *UNUSED(sa), ARegion *UNUSED(ar), wmNotifier *UNUSED(wmn)) { /* context changes */ } -static void userpref_header_listener(ARegion *UNUSED(ar), wmNotifier *UNUSED(wmn)) +static void userpref_header_listener(bScreen *UNUSED(sc), ScrArea *UNUSED(sa), ARegion *UNUSED(ar), wmNotifier *UNUSED(wmn)) { /* context changes */ #if 0 diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c index eb7adb7a333..b3d58bfa1b1 100644 --- a/source/blender/editors/space_view3d/space_view3d.c +++ b/source/blender/editors/space_view3d/space_view3d.c @@ -709,8 +709,10 @@ static void view3d_recalc_used_layers(ARegion *ar, wmNotifier *wmn, Scene *scene } } -static void view3d_main_area_listener(ARegion *ar, wmNotifier *wmn) +static void view3d_main_area_listener(bScreen *sc, ScrArea *sa, ARegion *ar, wmNotifier *wmn) { + Scene *scene = sc->scene; + View3D *v3d = sa->spacedata.first; /* context changes */ switch (wmn->category) { @@ -799,6 +801,12 @@ static void view3d_main_area_listener(ARegion *ar, wmNotifier *wmn) break; case NC_MATERIAL: switch (wmn->data) { + case ND_SHADING: + case ND_NODES: + if ((v3d->drawtype == OB_MATERIAL) || + (v3d->drawtype == OB_TEXTURE && scene->gm.matmode == GAME_MAT_GLSL)) + ED_region_tag_redraw(ar); + break; case ND_SHADING_DRAW: case ND_SHADING_LINKS: ED_region_tag_redraw(ar); @@ -822,7 +830,9 @@ static void view3d_main_area_listener(ARegion *ar, wmNotifier *wmn) case NC_LAMP: switch (wmn->data) { case ND_LIGHTING_DRAW: - ED_region_tag_redraw(ar); + if ((v3d->drawtype == OB_MATERIAL) || + (v3d->drawtype == OB_TEXTURE && (scene->gm.matmode == GAME_MAT_GLSL))) + ED_region_tag_redraw(ar); break; } break; @@ -907,7 +917,7 @@ static void view3d_header_area_draw(const bContext *C, ARegion *ar) ED_region_header(C, ar); } -static void view3d_header_area_listener(ARegion *ar, wmNotifier *wmn) +static void view3d_header_area_listener(bScreen *UNUSED(sc), ScrArea *UNUSED(sa), ARegion *ar, wmNotifier *wmn) { /* context changes */ switch (wmn->category) { @@ -948,7 +958,7 @@ static void view3d_buttons_area_draw(const bContext *C, ARegion *ar) ED_region_panels(C, ar, 1, NULL, -1); } -static void view3d_buttons_area_listener(ARegion *ar, wmNotifier *wmn) +static void view3d_buttons_area_listener(bScreen *UNUSED(sc), ScrArea *UNUSED(sa), ARegion *ar, wmNotifier *wmn) { /* context changes */ switch (wmn->category) { @@ -1048,7 +1058,7 @@ static void view3d_tools_area_draw(const bContext *C, ARegion *ar) ED_region_panels(C, ar, 1, CTX_data_mode_string(C), -1); } -static void view3d_props_area_listener(ARegion *ar, wmNotifier *wmn) +static void view3d_props_area_listener(bScreen *UNUSED(sc), ScrArea *UNUSED(sa), ARegion *ar, wmNotifier *wmn) { /* context changes */ switch (wmn->category) { @@ -1068,7 +1078,7 @@ static void view3d_props_area_listener(ARegion *ar, wmNotifier *wmn) } /*area (not region) level listener*/ -static void space_view3d_listener(ScrArea *sa, struct wmNotifier *wmn) +static void space_view3d_listener(bScreen *UNUSED(sc), ScrArea *sa, struct wmNotifier *wmn) { View3D *v3d = sa->spacedata.first; diff --git a/source/blender/makesrna/intern/rna_material.c b/source/blender/makesrna/intern/rna_material.c index 8936609c7db..fceb4e0a4d4 100644 --- a/source/blender/makesrna/intern/rna_material.c +++ b/source/blender/makesrna/intern/rna_material.c @@ -97,14 +97,7 @@ static void rna_Material_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *p Material *ma = ptr->id.data; DAG_id_tag_update(&ma->id, 0); - if (scene) { /* can be NULL, see [#30025] */ - if (scene->gm.matmode == GAME_MAT_GLSL) { - WM_main_add_notifier(NC_MATERIAL | ND_SHADING_DRAW, ma); - } - else { - WM_main_add_notifier(NC_MATERIAL | ND_SHADING, ma); - } - } + WM_main_add_notifier(NC_MATERIAL | ND_SHADING, ma); } static void rna_Material_update_previews(Main *bmain, Scene *scene, PointerRNA *ptr) @@ -114,10 +107,9 @@ static void rna_Material_update_previews(Main *bmain, Scene *scene, PointerRNA * if (ma->nodetree) BKE_node_preview_clear_tree(ma->nodetree); - WM_main_add_notifier(NC_MATERIAL | ND_SHADING, ma); + WM_main_add_notifier(NC_MATERIAL | ND_SHADING_PREVIEW, ma); } - static void rna_Material_draw_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *ptr) { Material *ma = ptr->id.data; diff --git a/source/blender/windowmanager/WM_types.h b/source/blender/windowmanager/WM_types.h index cd3899897a1..f1932c8aa97 100644 --- a/source/blender/windowmanager/WM_types.h +++ b/source/blender/windowmanager/WM_types.h @@ -302,6 +302,7 @@ typedef struct wmNotifier { #define ND_SHADING (30<<16) #define ND_SHADING_DRAW (31<<16) #define ND_SHADING_LINKS (32<<16) +#define ND_SHADING_PREVIEW (33<<16) /* NC_LAMP Lamp */ #define ND_LIGHTING (40<<16) diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index ac714b09bb0..0bef59cfc55 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -148,9 +148,15 @@ static int wm_test_duplicate_notifier(wmWindowManager *wm, unsigned int type, vo void WM_event_add_notifier(const bContext *C, unsigned int type, void *reference) { ARegion *ar; - wmNotifier *note = MEM_callocN(sizeof(wmNotifier), "notifier"); + wmWindowManager *wm = CTX_wm_manager(C); + wmNotifier *note; + + if (wm_test_duplicate_notifier(wm, type, reference)) + return; + + note = MEM_callocN(sizeof(wmNotifier), "notifier"); - note->wm = CTX_wm_manager(C); + note->wm = wm; BLI_addtail(¬e->wm->queue, note); note->window = CTX_wm_window(C); @@ -171,20 +177,22 @@ void WM_main_add_notifier(unsigned int type, void *reference) { Main *bmain = G.main; wmWindowManager *wm = bmain->wm.first; + wmNotifier *note; - if (wm && !wm_test_duplicate_notifier(wm, type, reference)) { - wmNotifier *note = MEM_callocN(sizeof(wmNotifier), "notifier"); - - note->wm = wm; - BLI_addtail(¬e->wm->queue, note); - - note->category = type & NOTE_CATEGORY; - note->data = type & NOTE_DATA; - note->subtype = type & NOTE_SUBTYPE; - note->action = type & NOTE_ACTION; - - note->reference = reference; - } + if (!wm || wm_test_duplicate_notifier(wm, type, reference)) + return; + + note = MEM_callocN(sizeof(wmNotifier), "notifier"); + + note->wm = wm; + BLI_addtail(¬e->wm->queue, note); + + note->category = type & NOTE_CATEGORY; + note->data = type & NOTE_DATA; + note->subtype = type & NOTE_SUBTYPE; + note->action = type & NOTE_ACTION; + + note->reference = reference; } /** @@ -312,13 +320,13 @@ void wm_event_do_notifiers(bContext *C) ED_screen_do_listen(C, note); for (ar = win->screen->regionbase.first; ar; ar = ar->next) { - ED_region_do_listen(ar, note); + ED_region_do_listen(win->screen, NULL, ar, note); } for (sa = win->screen->areabase.first; sa; sa = sa->next) { - ED_area_do_listen(sa, note); + ED_area_do_listen(win->screen, sa, note); for (ar = sa->regionbase.first; ar; ar = ar->next) { - ED_region_do_listen(ar, note); + ED_region_do_listen(win->screen, sa, ar, note); } } } From 28dd9c6a40859bf8d707b072174557d37240f162 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Mon, 24 Jun 2013 22:41:37 +0000 Subject: [PATCH 38/72] Fix #35767: transforming nodes in the node editor changed the wireframe color of the active object in the 3D view. This was due to sharing a global G.moving flag to indicate that transform is active, now it's only set per transform data type so different editors don't influence each other. --- source/blender/blenkernel/BKE_global.h | 3 +-- source/blender/blenkernel/intern/mball.c | 4 ++-- source/blender/editors/mesh/editmesh_bevel.c | 4 ++-- source/blender/editors/mesh/editmesh_inset.c | 4 ++-- source/blender/editors/space_image/space_image.c | 13 ++++--------- .../editors/space_sequencer/sequencer_draw.c | 4 ++-- source/blender/editors/space_view3d/drawobject.c | 2 +- source/blender/editors/transform/transform.h | 1 + .../editors/transform/transform_conversions.c | 15 +++++++++++++++ .../editors/transform/transform_generics.c | 6 ------ .../editors/transform/transform_manipulator.c | 11 +++++------ source/blender/editors/transform/transform_ops.c | 2 +- 12 files changed, 36 insertions(+), 33 deletions(-) diff --git a/source/blender/blenkernel/BKE_global.h b/source/blender/blenkernel/BKE_global.h index 8a55d3e8a17..0699344a887 100644 --- a/source/blender/blenkernel/BKE_global.h +++ b/source/blender/blenkernel/BKE_global.h @@ -192,8 +192,7 @@ enum { /* G.moving, signals drawing in (3d) window to denote transform */ #define G_TRANSFORM_OBJ 1 #define G_TRANSFORM_EDIT 2 -#define G_TRANSFORM_MANIP 4 -#define G_TRANSFORM_PARTICLE 8 +#define G_TRANSFORM_SEQ 4 /* G.special1 */ diff --git a/source/blender/blenkernel/intern/mball.c b/source/blender/blenkernel/intern/mball.c index 0546c85db67..d09490db235 100644 --- a/source/blender/blenkernel/intern/mball.c +++ b/source/blender/blenkernel/intern/mball.c @@ -2283,7 +2283,7 @@ void BKE_mball_polygonize(Scene *scene, Object *ob, ListBase *dispbase) if (process.totelem == 0) return; if ((G.is_rendering == FALSE) && (mb->flag == MB_UPDATE_NEVER)) return; - if (G.moving && mb->flag == MB_UPDATE_FAST) return; + if ((G.moving & (G_TRANSFORM_OBJ|G_TRANSFORM_EDIT)) && mb->flag == MB_UPDATE_FAST) return; process.thresh = mb->thresh; @@ -2325,7 +2325,7 @@ void BKE_mball_polygonize(Scene *scene, Object *ob, ListBase *dispbase) } else { width = mb->wiresize; - if (G.moving && mb->flag == MB_UPDATE_HALFRES) width *= 2; + if ((G.moving & (G_TRANSFORM_OBJ|G_TRANSFORM_EDIT)) && mb->flag == MB_UPDATE_HALFRES) width *= 2; } /* nr_cubes is just for safety, minimum is totsize */ nr_cubes = (int)(0.5f + totsize / width); diff --git a/source/blender/editors/mesh/editmesh_bevel.c b/source/blender/editors/mesh/editmesh_bevel.c index ed55383e8a4..6033e7ee471 100644 --- a/source/blender/editors/mesh/editmesh_bevel.c +++ b/source/blender/editors/mesh/editmesh_bevel.c @@ -117,7 +117,7 @@ static bool edbm_bevel_init(bContext *C, wmOperator *op, const bool is_modal) opdata->mesh_backup = EDBM_redo_state_store(em); opdata->draw_handle_pixel = ED_region_draw_cb_activate(ar->type, ED_region_draw_mouse_line_cb, opdata->mcenter, REGION_DRAW_POST_PIXEL); - G.moving = true; + G.moving = G_TRANSFORM_EDIT; opdata->twtype = v3d->twtype; v3d->twtype = 0; } @@ -179,7 +179,7 @@ static void edbm_bevel_exit(bContext *C, wmOperator *op) EDBM_redo_state_free(&opdata->mesh_backup, NULL, false); ED_region_draw_cb_exit(ar->type, opdata->draw_handle_pixel); v3d->twtype = opdata->twtype; - G.moving = false; + G.moving = 0; } MEM_freeN(opdata); op->customdata = NULL; diff --git a/source/blender/editors/mesh/editmesh_inset.c b/source/blender/editors/mesh/editmesh_inset.c index ef1767de3bd..dba19ee5da6 100644 --- a/source/blender/editors/mesh/editmesh_inset.c +++ b/source/blender/editors/mesh/editmesh_inset.c @@ -136,7 +136,7 @@ static bool edbm_inset_init(bContext *C, wmOperator *op, const bool is_modal) opdata->mesh_backup = EDBM_redo_state_store(em); opdata->draw_handle_pixel = ED_region_draw_cb_activate(ar->type, ED_region_draw_mouse_line_cb, opdata->mcenter, REGION_DRAW_POST_PIXEL); - G.moving = true; + G.moving = G_TRANSFORM_EDIT; opdata->twtype = v3d->twtype; v3d->twtype = 0; } @@ -157,7 +157,7 @@ static void edbm_inset_exit(bContext *C, wmOperator *op) EDBM_redo_state_free(&opdata->mesh_backup, NULL, false); ED_region_draw_cb_exit(ar->type, opdata->draw_handle_pixel); v3d->twtype = opdata->twtype; - G.moving = false; + G.moving = 0; } if (sa) { diff --git a/source/blender/editors/space_image/space_image.c b/source/blender/editors/space_image/space_image.c index fd57bf6101f..2b106e13836 100644 --- a/source/blender/editors/space_image/space_image.c +++ b/source/blender/editors/space_image/space_image.c @@ -376,15 +376,10 @@ static void image_refresh(const bContext *C, ScrArea *sa) /* check if we have to set the image from the editmesh */ if (ima && (ima->source == IMA_SRC_VIEWER && sima->mode == SI_MODE_MASK)) { - if (sima->lock == FALSE && G.moving) { - /* pass */ - } - else { - if (scene->nodetree) { - Mask *mask = ED_space_image_get_mask(sima); - if (mask) { - ED_node_composite_job(C, scene->nodetree, scene); - } + if (scene->nodetree) { + Mask *mask = ED_space_image_get_mask(sima); + if (mask) { + ED_node_composite_job(C, scene->nodetree, scene); } } } diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c index 20374e562e9..af4b4055156 100644 --- a/source/blender/editors/space_sequencer/sequencer_draw.c +++ b/source/blender/editors/space_sequencer/sequencer_draw.c @@ -403,7 +403,7 @@ static void draw_seq_handle(View2D *v2d, Sequence *seq, const float handsize_cla glDisable(GL_BLEND); } - if (G.moving || (seq->flag & whichsel)) { + if ((G.moving & G_TRANSFORM_SEQ) || (seq->flag & whichsel)) { const char col[4] = {255, 255, 255, 255}; if (direction == SEQ_LEFTHANDLE) { BLI_snprintf(numstr, sizeof(numstr), "%d", seq->startdisp); @@ -760,7 +760,7 @@ static void draw_seq_strip(Scene *scene, ARegion *ar, Sequence *seq, int outline } get_seq_color3ubv(scene, seq, col); - if (G.moving && (seq->flag & SELECT)) { + if ((G.moving & G_TRANSFORM_SEQ) && (seq->flag & SELECT)) { if (seq->flag & SEQ_OVERLAP) { col[0] = 255; col[1] = col[2] = 40; } diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index 63906c4d429..1ce8cf9082e 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -2685,7 +2685,7 @@ static void draw_em_measure_stats(ARegion *ar, View3D *v3d, Object *ob, BMEditMe float grid = unit->system ? unit->scale_length : v3d->grid; const bool do_split = (unit->flag & USER_UNIT_OPT_SPLIT) != 0; const bool do_global = (v3d->flag & V3D_GLOBAL_STATS) != 0; - const bool do_moving = G.moving; + const bool do_moving = (G.moving & G_TRANSFORM_EDIT) != 0; float clip_planes[4][4]; BMIter iter; diff --git a/source/blender/editors/transform/transform.h b/source/blender/editors/transform/transform.h index 53ecfe3a685..d160e1562b0 100644 --- a/source/blender/editors/transform/transform.h +++ b/source/blender/editors/transform/transform.h @@ -604,6 +604,7 @@ int calc_manipulator_stats(const struct bContext *C); void createTransData(struct bContext *C, TransInfo *t); void sort_trans_data_dist(TransInfo *t); void special_aftertrans_update(struct bContext *C, TransInfo *t); +int special_transform_moving(TransInfo *t); void transform_autoik_update(TransInfo *t, short mode); diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index 81af26b0d05..44c2158bf74 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -5701,6 +5701,21 @@ void special_aftertrans_update(bContext *C, TransInfo *t) #endif } +int special_transform_moving(TransInfo *t) +{ + if (t->spacetype == SPACE_SEQ) { + return G_TRANSFORM_SEQ; + } + else if (t->obedit || ((t->flag & T_POSE) && (t->poseobj))) { + return G_TRANSFORM_EDIT; + } + else if (t->flag & (T_OBJECT | T_TEXTURE)) { + return G_TRANSFORM_OBJ; + } + + return 0; +} + static void createTransObject(bContext *C, TransInfo *t) { TransData *td = NULL; diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c index 7afced78746..666612880e5 100644 --- a/source/blender/editors/transform/transform_generics.c +++ b/source/blender/editors/transform/transform_generics.c @@ -1047,12 +1047,6 @@ int initTransInfo(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *even Object *obedit = CTX_data_edit_object(C); PropertyRNA *prop; - /* moving: is shown in drawobject() (transform color) */ -// TRANSFORM_FIX_ME -// if (obedit || (t->flag & T_POSE) ) G.moving = G_TRANSFORM_EDIT; -// else if (G.f & G_PARTICLEEDIT) G.moving = G_TRANSFORM_PARTICLE; -// else G.moving = G_TRANSFORM_OBJ; - t->scene = sce; t->sa = sa; t->ar = ar; diff --git a/source/blender/editors/transform/transform_manipulator.c b/source/blender/editors/transform/transform_manipulator.c index d1d40689a4a..8972229d618 100644 --- a/source/blender/editors/transform/transform_manipulator.c +++ b/source/blender/editors/transform/transform_manipulator.c @@ -1592,7 +1592,6 @@ static void draw_manipulator_rotate_cyl(View3D *v3d, RegionView3D *rv3d, int mov /* ********************************************* */ /* main call, does calc centers & orientation too */ -/* uses global G.moving */ static int drawflags = 0xFFFF; // only for the calls below, belongs in scene...? void BIF_draw_manipulator(const bContext *C) @@ -1605,9 +1604,7 @@ void BIF_draw_manipulator(const bContext *C) int totsel; if (!(v3d->twflag & V3D_USE_MANIPULATOR)) return; -// if (G.moving && (G.moving & G_TRANSFORM_MANIP)==0) return; -// if (G.moving==0) { { v3d->twflag &= ~V3D_DRAW_MANIPULATOR; @@ -1654,11 +1651,13 @@ void BIF_draw_manipulator(const bContext *C) if (v3d->twtype & V3D_MANIP_ROTATE) { if (G.debug_value == 3) { - if (G.moving) draw_manipulator_rotate_cyl(v3d, rv3d, 1, drawflags, v3d->twtype, MAN_MOVECOL); - else draw_manipulator_rotate_cyl(v3d, rv3d, 0, drawflags, v3d->twtype, MAN_RGB); + if (G.moving & (G_TRANSFORM_OBJ|G_TRANSFORM_EDIT)) + draw_manipulator_rotate_cyl(v3d, rv3d, 1, drawflags, v3d->twtype, MAN_MOVECOL); + else + draw_manipulator_rotate_cyl(v3d, rv3d, 0, drawflags, v3d->twtype, MAN_RGB); } else - draw_manipulator_rotate(v3d, rv3d, 0 /* G.moving*/, drawflags, v3d->twtype); + draw_manipulator_rotate(v3d, rv3d, 0, drawflags, v3d->twtype); } if (v3d->twtype & V3D_MANIP_SCALE) { draw_manipulator_scale(v3d, rv3d, 0, drawflags, v3d->twtype, MAN_RGB); diff --git a/source/blender/editors/transform/transform_ops.c b/source/blender/editors/transform/transform_ops.c index c0adf065f57..eb204be3220 100644 --- a/source/blender/editors/transform/transform_ops.c +++ b/source/blender/editors/transform/transform_ops.c @@ -357,10 +357,10 @@ static int transformops_data(bContext *C, wmOperator *op, const wmEvent *event) } retval = initTransform(C, t, op, event, mode); - G.moving = 1; /* store data */ if (retval) { + G.moving = special_transform_moving(t); op->customdata = t; } else { From 454d6e020700195b191e6ff109d8ed0eccdf0254 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Mon, 24 Jun 2013 22:41:40 +0000 Subject: [PATCH 39/72] Fix particle hair display percentage not properly getting restored after rendering. This used to happen in an unneeded frame change update which was removed. For heavy particle systems this could have a bad impact on viewport performance after rendering. --- source/blender/blenkernel/BKE_particle.h | 2 ++ source/blender/blenkernel/intern/particle.c | 16 ++++++++++++++++ .../blender/blenkernel/intern/particle_system.c | 14 +++++++------- 3 files changed, 25 insertions(+), 7 deletions(-) diff --git a/source/blender/blenkernel/BKE_particle.h b/source/blender/blenkernel/BKE_particle.h index 2b753cba098..56b550a6f5d 100644 --- a/source/blender/blenkernel/BKE_particle.h +++ b/source/blender/blenkernel/BKE_particle.h @@ -380,6 +380,8 @@ int psys_particle_dm_face_lookup(struct Object *ob, struct DerivedMesh *dm, int void reset_particle(struct ParticleSimulationData *sim, struct ParticleData *pa, float dtime, float cfra); +float psys_get_current_display_percentage(struct ParticleSystem *psys); + /* psys_reset */ #define PSYS_RESET_ALL 1 #define PSYS_RESET_DEPSGRAPH 2 diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c index 3ab535febb1..f6901c7b81b 100644 --- a/source/blender/blenkernel/intern/particle.c +++ b/source/blender/blenkernel/intern/particle.c @@ -734,6 +734,8 @@ void psys_render_restore(Object *ob, ParticleSystem *psys) { ParticleRenderData *data; ParticleSystemModifierData *psmd = psys_get_modifier(ob, psys); + float render_disp = psys_get_current_display_percentage(psys); + float disp; data = psys->renderdata; if (!data) @@ -777,6 +779,20 @@ void psys_render_restore(Object *ob, ParticleSystem *psys) MEM_freeN(data); psys->renderdata = NULL; + + /* restore particle display percentage */ + disp = psys_get_current_display_percentage(psys); + + if (disp != render_disp) { + PARTICLE_P; + + LOOP_PARTICLES { + if (PSYS_FRAND(p) > disp) + pa->flag |= PARS_NO_DISP; + else + pa->flag &= ~PARS_NO_DISP; + } + } } /* BMESH_TODO, for orig face data, we need to use MPoly */ diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c index 50d2a47a97f..ec45c9eef40 100644 --- a/source/blender/blenkernel/intern/particle_system.c +++ b/source/blender/blenkernel/intern/particle_system.c @@ -123,7 +123,7 @@ static int particles_are_dynamic(ParticleSystem *psys) return ELEM3(psys->part->phystype, PART_PHYS_NEWTON, PART_PHYS_BOIDS, PART_PHYS_FLUID); } -static int psys_get_current_display_percentage(ParticleSystem *psys) +float psys_get_current_display_percentage(ParticleSystem *psys) { ParticleSettings *part=psys->part; @@ -131,10 +131,10 @@ static int psys_get_current_display_percentage(ParticleSystem *psys) (part->child_nbr && part->childtype) || /* display percentage applies to children */ (psys->pointcache->flag & PTCACHE_BAKING)) /* baking is always done with full amount */ { - return 100; + return 1.0f; } - return psys->part->disp; + return psys->part->disp/100.0f; } static int tot_particles(ParticleSystem *psys, PTCacheID *pid) @@ -3984,7 +3984,7 @@ static void hair_step(ParticleSimulationData *sim, float cfra) ParticleSystem *psys = sim->psys; ParticleSettings *part = psys->part; PARTICLE_P; - float disp = (float)psys_get_current_display_percentage(psys)/100.0f; + float disp = psys_get_current_display_percentage(psys); LOOP_PARTICLES { pa->size = part->size; @@ -4388,7 +4388,7 @@ static void cached_step(ParticleSimulationData *sim, float cfra) psys_update_effectors(sim); - disp= (float)psys_get_current_display_percentage(psys)/100.0f; + disp= psys_get_current_display_percentage(psys); LOOP_PARTICLES { psys_get_texture(sim, pa, &ptex, PAMAP_SIZE, cfra); @@ -4637,7 +4637,7 @@ static void system_step(ParticleSimulationData *sim, float cfra) /* 3. do dynamics */ /* set particles to be not calculated TODO: can't work with pointcache */ - disp= (float)psys_get_current_display_percentage(psys)/100.0f; + disp= psys_get_current_display_percentage(psys); LOOP_PARTICLES { if (PSYS_FRAND(p) > disp) @@ -4933,7 +4933,7 @@ void particle_system_update(Scene *scene, Object *ob, ParticleSystem *psys) case PART_PHYS_KEYED: { PARTICLE_P; - float disp = (float)psys_get_current_display_percentage(psys)/100.0f; + float disp = psys_get_current_display_percentage(psys); /* Particles without dynamics haven't been reset yet because they don't use pointcache */ if (psys->recalc & PSYS_RECALC_RESET) From 208301d2fed0cb7d2faad6af38d57a6306ed6e6f Mon Sep 17 00:00:00 2001 From: Tamito Kajiyama Date: Mon, 24 Jun 2013 22:48:00 +0000 Subject: [PATCH 40/72] Fix for invalid zero-length orientation vectors. Problem report by flokkievids in the BA Freestyle thread, thanks! Also made changes to suppress warnings in strip creation when Freestyle debugging is disabled. --- .../freestyle/intern/stroke/StrokeRep.cpp | 84 +++++++++++++------ 1 file changed, 59 insertions(+), 25 deletions(-) diff --git a/source/blender/freestyle/intern/stroke/StrokeRep.cpp b/source/blender/freestyle/intern/stroke/StrokeRep.cpp index dacf463ab88..c2811895147 100644 --- a/source/blender/freestyle/intern/stroke/StrokeRep.cpp +++ b/source/blender/freestyle/intern/stroke/StrokeRep.cpp @@ -31,6 +31,8 @@ #include "StrokeRenderer.h" #include "StrokeRep.h" +#include "BKE_global.h" + using namespace std; namespace Freestyle { @@ -109,7 +111,9 @@ void Strip::createStrip (const vector& iStrokeVertices) { //computeParameterization(); if (iStrokeVertices.size() < 2) { - cerr << "Warning: strip has less than 2 vertices" << endl; + if (G.debug & G_DEBUG_FREESTYLE) { + cout << "Warning: strip has less than 2 vertices" << endl; + } return; } _vertices.reserve(2 * iStrokeVertices.size()); @@ -123,6 +127,7 @@ void Strip::createStrip (const vector& iStrokeVertices) vector::const_iterator v, vend, v2, vPrev; StrokeVertex *sv, *sv2, *svPrev; + int orientationErrors = 0; //special case of first vertex v = iStrokeVertices.begin(); @@ -138,11 +143,15 @@ void Strip::createStrip (const vector& iStrokeVertices) // check whether the orientation was user defined if (sv->attribute().isAttributeAvailableVec2f("orientation")) { Vec2r userDir = sv->attribute().getAttributeVec2f("orientation"); - userDir.normalize(); - real dp = userDir * orthDir; - if (dp < 0) - userDir = userDir * (-1.0f); - stripDir = userDir; + if (userDir.norm() > 1e-6) { + userDir.normalize(); + real dp = userDir * orthDir; + if (dp < 0) + userDir = userDir * (-1.0f); + stripDir = userDir; + } else { + ++orientationErrors; + } } const float *thickness = sv->attribute().getThickness(); _vertices.push_back(new StrokeVertexRep(sv->getPoint() + thickness[1] * stripDir)); @@ -192,11 +201,15 @@ void Strip::createStrip (const vector& iStrokeVertices) Vec2r stripDir = orthDir; if (sv->attribute().isAttributeAvailableVec2f("orientation")) { Vec2r userDir = sv->attribute().getAttributeVec2f("orientation"); - userDir.normalize(); - real dp = userDir * orthDir; - if (dp < 0) - userDir = userDir * (-1.0f); - stripDir = userDir; + if (userDir.norm() > 1e-6) { + userDir.normalize(); + real dp = userDir * orthDir; + if (dp < 0) + userDir = userDir * (-1.0f); + stripDir = userDir; + } else { + ++orientationErrors; + } } //direction and orthogonal vector to the previous segment @@ -207,11 +220,15 @@ void Strip::createStrip (const vector& iStrokeVertices) Vec2r stripDirPrev = orthDirPrev; if (svPrev->attribute().isAttributeAvailableVec2f("orientation")) { Vec2r userDir = svPrev->attribute().getAttributeVec2f("orientation"); - userDir.normalize(); - real dp = userDir * orthDir; - if (dp < 0) - userDir = userDir * (-1.0f); - stripDirPrev = userDir; + if (userDir.norm() > 1e-6) { + userDir.normalize(); + real dp = userDir * orthDir; + if (dp < 0) + userDir = userDir * (-1.0f); + stripDirPrev = userDir; + } else { + ++orientationErrors; + } } const float *thickness = sv->attribute().getThickness(); @@ -279,11 +296,15 @@ void Strip::createStrip (const vector& iStrokeVertices) // check whether the orientation was user defined if (sv->attribute().isAttributeAvailableVec2f("orientation")) { Vec2r userDir = sv->attribute().getAttributeVec2f("orientation"); - userDir.normalize(); - real dp = userDir * orthDir; - if (dp < 0) - userDir = userDir * (-1.0f); - stripDirLast = userDir; + if (userDir.norm() > 1e-6) { + userDir.normalize(); + real dp = userDir * orthDir; + if (dp < 0) + userDir = userDir * (-1.0f); + stripDirLast = userDir; + } else { + ++orientationErrors; + } } const float *thicknessLast = sv->attribute().getThickness(); _vertices.push_back(new StrokeVertexRep(sv->getPoint() + thicknessLast[1] * stripDirLast)); @@ -322,8 +343,17 @@ void Strip::createStrip (const vector& iStrokeVertices) if (iStrokeVertices.size() < 3) _averageThickness = 0.5 * (thicknessLast[1] + thicknessLast[0] + thickness[0] + thickness[1]); - if (i != 2 * (int)iStrokeVertices.size()) - cerr << "Warning: problem with stripe size\n"; + if (orientationErrors > 0) { + if (G.debug & G_DEBUG_FREESTYLE) { + cout << "Warning: " << orientationErrors <<" invalid zero-length orientation vector(s) found.\n"; + } + } + + if (i != 2 * (int)iStrokeVertices.size()) { + if (G.debug & G_DEBUG_FREESTYLE) { + cout << "Warning: problem with stripe size\n"; + } + } cleanUpSingularities (iStrokeVertices); } @@ -338,7 +368,9 @@ void Strip::cleanUpSingularities (const vector& iStrokeVertices) for (k = 0; k < sizeStrip; k++) { if (notValid(_vertices[k]->point2d())) { - cerr << "Warning: strip vertex " << k << " non valid" << endl; + if (G.debug & G_DEBUG_FREESTYLE) { + cout << "Warning: strip vertex " << k << " non valid" << endl; + } return; } } @@ -437,7 +469,9 @@ void Strip::cleanUpSingularities (const vector& iStrokeVertices) for (k = 0; k < sizeStrip; k++) { if (notValid(_vertices[k]->point2d())) { - cerr << "Warning: strip vertex " << k << " non valid after cleanup" << endl; + if (G.debug & G_DEBUG_FREESTYLE) { + cout << "Warning: strip vertex " << k << " non valid after cleanup" << endl; + } return; } } From c2d5afd81f9488092f061e476ee824212eba1361 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Mon, 24 Jun 2013 23:24:39 +0000 Subject: [PATCH 41/72] Fix OpenGL render not working correct with display color space set to None (color management off). --- source/blender/editors/render/render_opengl.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/source/blender/editors/render/render_opengl.c b/source/blender/editors/render/render_opengl.c index b3216849dba..a22f776d9a0 100644 --- a/source/blender/editors/render/render_opengl.c +++ b/source/blender/editors/render/render_opengl.c @@ -269,10 +269,17 @@ static void screen_opengl_render_apply(OGLRender *oglrender) */ if (rect) { + int profile_to; + + if(BKE_scene_check_color_management_enabled(scene)) + profile_to = IB_PROFILE_LINEAR_RGB; + else + profile_to = IB_PROFILE_SRGB; + /* sequencer has got trickier conversion happened above * also assume opengl's space matches byte buffer color space */ IMB_buffer_float_from_byte(rr->rectf, rect, - IB_PROFILE_LINEAR_RGB, IB_PROFILE_SRGB, true, + profile_to, IB_PROFILE_SRGB, true, oglrender->sizex, oglrender->sizey, oglrender->sizex, oglrender->sizex); } From cd8959c4bfb591c8b3d003aeec99cc5501c87e41 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Mon, 24 Jun 2013 23:55:50 +0000 Subject: [PATCH 42/72] Attempt to workaround mingw64 buildbot issue with Windows command length limits, by splitting the compositor module into 3 parts. The operating system limit is 32767, which gives less than 120 characters per file with 272 cpp files. --- source/blender/compositor/SConscript | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/source/blender/compositor/SConscript b/source/blender/compositor/SConscript index c0388438a98..8d7f036f172 100644 --- a/source/blender/compositor/SConscript +++ b/source/blender/compositor/SConscript @@ -28,7 +28,10 @@ Import ('env') defs = ['GLEW_STATIC'] -sources = env.Glob('intern/*.cpp') + env.Glob('nodes/*.cpp') + env.Glob('operations/*.cpp') +# split into 3 modules to work around command length limit on Windows +sources_intern = env.Glob('intern/*.cpp') +sources_nodes = env.Glob('nodes/*.cpp') +sources_operations = env.Glob('operations/*.cpp') incs = [ '.', @@ -56,4 +59,7 @@ incs = [ if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'): incs.append(env['BF_PTHREADS_INC']) -env.BlenderLib('bf_composite', sources, incs, defines=defs, libtype=['core'], priority=[164]) +env.BlenderLib('bf_composite_intern', sources_intern, incs, defines=defs, libtype=['core'], priority=[164]) +env.BlenderLib('bf_composite_nodes', sources_nodes, incs, defines=defs, libtype=['core'], priority=[165]) +env.BlenderLib('bf_composite_operations', sources_operations, incs, defines=defs, libtype=['core'], priority=[166]) + From d54b2391c4b0c862aa4991f467bf724bb811048e Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Tue, 25 Jun 2013 00:11:04 +0000 Subject: [PATCH 43/72] Buildbot: another workaround for the Windows command length limit, this time with the freestyle module which has 242 cpp files. --- source/blender/compositor/SConscript | 4 ++-- source/blender/freestyle/SConscript | 9 +++++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/source/blender/compositor/SConscript b/source/blender/compositor/SConscript index 8d7f036f172..d40015cf9d3 100644 --- a/source/blender/compositor/SConscript +++ b/source/blender/compositor/SConscript @@ -59,7 +59,7 @@ incs = [ if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'): incs.append(env['BF_PTHREADS_INC']) -env.BlenderLib('bf_composite_intern', sources_intern, incs, defines=defs, libtype=['core'], priority=[164]) +env.BlenderLib('bf_composite_intern', sources_intern, incs, defines=defs, libtype=['core'], priority=[166]) env.BlenderLib('bf_composite_nodes', sources_nodes, incs, defines=defs, libtype=['core'], priority=[165]) -env.BlenderLib('bf_composite_operations', sources_operations, incs, defines=defs, libtype=['core'], priority=[166]) +env.BlenderLib('bf_composite_operations', sources_operations, incs, defines=defs, libtype=['core'], priority=[164]) diff --git a/source/blender/freestyle/SConscript b/source/blender/freestyle/SConscript index 909165529a8..2542bbd1ec6 100644 --- a/source/blender/freestyle/SConscript +++ b/source/blender/freestyle/SConscript @@ -76,8 +76,13 @@ python_sources = env.Glob(prefix + '/*.cpp') + \ sources = system_sources + image_sources + geometry_sources + scene_graph_sources + \ winged_edge_sources + view_map_sources + stroke_sources + \ - application_sources + interface_sources + python_sources + application_sources + interface_sources env.BlenderLib(libname="bf_freestyle", sources=sources, includes=Split(incs), - defines=defs, libtype=['core'], priority = [370] # bf_python is 361 + defines=defs, libtype=['core'], priority = [370] ) + +env.BlenderLib(libname="bf_freestyle_python", sources=python_sources, includes=Split(incs), + defines=defs, libtype=['core'], priority = [369] # bf_python is 361 +) + From 54db7f1b43b08f3bfd0ce28b24f8ed22e82282cf Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Tue, 25 Jun 2013 00:49:43 +0000 Subject: [PATCH 44/72] Buildbot: disable command length workaround for now, seems to give link errors. --- source/blender/compositor/SConscript | 13 +++++++++---- source/blender/freestyle/SConscript | 13 ++++++++----- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/source/blender/compositor/SConscript b/source/blender/compositor/SConscript index d40015cf9d3..073b100e156 100644 --- a/source/blender/compositor/SConscript +++ b/source/blender/compositor/SConscript @@ -28,7 +28,6 @@ Import ('env') defs = ['GLEW_STATIC'] -# split into 3 modules to work around command length limit on Windows sources_intern = env.Glob('intern/*.cpp') sources_nodes = env.Glob('nodes/*.cpp') sources_operations = env.Glob('operations/*.cpp') @@ -59,7 +58,13 @@ incs = [ if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'): incs.append(env['BF_PTHREADS_INC']) -env.BlenderLib('bf_composite_intern', sources_intern, incs, defines=defs, libtype=['core'], priority=[166]) -env.BlenderLib('bf_composite_nodes', sources_nodes, incs, defines=defs, libtype=['core'], priority=[165]) -env.BlenderLib('bf_composite_operations', sources_operations, incs, defines=defs, libtype=['core'], priority=[164]) +if False: # gives link errors 'win' in env['OURPLATFORM']: + # split into 3 modules to work around command length limit on Windows + env.BlenderLib('bf_composite_intern', sources_intern, incs, defines=defs, libtype=['core'], priority=[166]) + env.BlenderLib('bf_composite_nodes', sources_nodes, incs, defines=defs, libtype=['core'], priority=[165]) + env.BlenderLib('bf_composite_operations', sources_operations, incs, defines=defs, libtype=['core'], priority=[164]) +else: + sources = sources_intern + sources_nodes + sources_operations + env.BlenderLib('bf_composite', sources, incs, defines=defs, libtype=['core'], priority=[164]) + diff --git a/source/blender/freestyle/SConscript b/source/blender/freestyle/SConscript index 2542bbd1ec6..cae04f8642c 100644 --- a/source/blender/freestyle/SConscript +++ b/source/blender/freestyle/SConscript @@ -78,11 +78,14 @@ sources = system_sources + image_sources + geometry_sources + scene_graph_source winged_edge_sources + view_map_sources + stroke_sources + \ application_sources + interface_sources +if False: # gives link errors 'win' in env['OURPLATFORM']: + env.BlenderLib(libname="bf_freestyle_python", sources=python_sources, includes=Split(incs), + defines=defs, libtype=['core'], priority = [369] # bf_python is 361 + ) +else: + sources += python_sources + env.BlenderLib(libname="bf_freestyle", sources=sources, includes=Split(incs), - defines=defs, libtype=['core'], priority = [370] -) - -env.BlenderLib(libname="bf_freestyle_python", sources=python_sources, includes=Split(incs), - defines=defs, libtype=['core'], priority = [369] # bf_python is 361 + defines=defs, libtype=['core'], priority = [370] # bf_python is 361 ) From d3b6117068eb1d03f0c66aab7d0c667951223709 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Tue, 25 Jun 2013 07:22:28 +0000 Subject: [PATCH 45/72] Fix typo made back in svn rev35785 Callback handle was assigning to wrong storage in RE_draw_lock_cb. So far it was completely harmless because all the callbacks are using the same handle, so test_break_callback was using correct handle, and since draw_lock_callback didn't use handle at all nobody noticed this. But this typo lead to draw_lock_callback using NULL instead of real RenderJob, which is bad for the feature we're working in GSoC branch. --- source/blender/render/intern/source/pipeline.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/render/intern/source/pipeline.c b/source/blender/render/intern/source/pipeline.c index f161e139989..3e5868edeb9 100644 --- a/source/blender/render/intern/source/pipeline.c +++ b/source/blender/render/intern/source/pipeline.c @@ -702,7 +702,7 @@ void RE_progress_cb(Render *re, void *handle, void (*f)(void *handle, float)) void RE_draw_lock_cb(Render *re, void *handle, void (*f)(void *handle, int i)) { re->draw_lock = f; - re->tbh = handle; + re->dlh = handle; } void RE_test_break_cb(Render *re, void *handle, int (*f)(void *handle)) From 45d7ebbdf2f2cb3c2bb3ec175afcfd31052c9921 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Tue, 25 Jun 2013 09:27:31 +0000 Subject: [PATCH 46/72] Include DNA_scene_types before ED_object instead of forward enum declaration Forward enum declaration is a bad idea, especially for C++ which requires enum specification to dteermine which data type to use to store it. Alternative would be to not use enum as an arument and pass it as int, but actually would rather be strict on typing -- using explicit enum as parameter type helps understanding the code and prevents possible mistakes when using the function. --- source/blender/editors/curve/curve_ops.c | 1 + source/blender/editors/include/ED_object.h | 2 -- source/blender/editors/mesh/editmesh_add.c | 1 + source/blender/editors/mesh/editmesh_tools.c | 1 + source/blender/editors/mesh/mesh_ops.c | 2 ++ source/blender/editors/metaball/mball_ops.c | 2 ++ source/blender/editors/physics/physics_ops.c | 2 ++ source/blender/editors/space_api/spacetypes.c | 1 + source/blender/editors/space_logic/logic_ops.c | 1 + source/blender/editors/space_view3d/view3d_iterators.c | 1 + source/blender/editors/util/undo.c | 1 + 11 files changed, 13 insertions(+), 2 deletions(-) diff --git a/source/blender/editors/curve/curve_ops.c b/source/blender/editors/curve/curve_ops.c index 03b7697ecfa..5b525a089b3 100644 --- a/source/blender/editors/curve/curve_ops.c +++ b/source/blender/editors/curve/curve_ops.c @@ -34,6 +34,7 @@ #include "DNA_curve_types.h" +#include "DNA_scene_types.h" #include "BLI_math.h" #include "BLI_blenlib.h" diff --git a/source/blender/editors/include/ED_object.h b/source/blender/editors/include/ED_object.h index e891f648713..90b131e5acc 100644 --- a/source/blender/editors/include/ED_object.h +++ b/source/blender/editors/include/ED_object.h @@ -69,8 +69,6 @@ struct PointerRNA; struct PropertyRNA; struct EnumPropertyItem; -enum eVGroupSelect; - /* object_edit.c */ struct Object *ED_object_context(struct bContext *C); /* context.object */ struct Object *ED_object_active_context(struct bContext *C); /* context.object or context.active_object */ diff --git a/source/blender/editors/mesh/editmesh_add.c b/source/blender/editors/mesh/editmesh_add.c index ed2744509a6..e544592365d 100644 --- a/source/blender/editors/mesh/editmesh_add.c +++ b/source/blender/editors/mesh/editmesh_add.c @@ -30,6 +30,7 @@ */ #include "DNA_object_types.h" +#include "DNA_scene_types.h" #include "BLI_math.h" diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c index 508936190c8..51d02e8cc2b 100644 --- a/source/blender/editors/mesh/editmesh_tools.c +++ b/source/blender/editors/mesh/editmesh_tools.c @@ -37,6 +37,7 @@ #include "DNA_meshdata_types.h" #include "DNA_modifier_types.h" #include "DNA_object_types.h" +#include "DNA_scene_types.h" #include "BLI_listbase.h" #include "BLI_noise.h" diff --git a/source/blender/editors/mesh/mesh_ops.c b/source/blender/editors/mesh/mesh_ops.c index 7fe0c3b0344..c97b674dd2d 100644 --- a/source/blender/editors/mesh/mesh_ops.c +++ b/source/blender/editors/mesh/mesh_ops.c @@ -28,6 +28,8 @@ * \ingroup edmesh */ +#include "DNA_scene_types.h" + #include "BLI_math.h" #include "RNA_access.h" diff --git a/source/blender/editors/metaball/mball_ops.c b/source/blender/editors/metaball/mball_ops.c index 8c705aac0d2..bba0dc5000b 100644 --- a/source/blender/editors/metaball/mball_ops.c +++ b/source/blender/editors/metaball/mball_ops.c @@ -28,6 +28,8 @@ * \ingroup edmeta */ +#include "DNA_scene_types.h" + #include "BLI_utildefines.h" #include "RNA_access.h" diff --git a/source/blender/editors/physics/physics_ops.c b/source/blender/editors/physics/physics_ops.c index 2ede7047b74..444c87ded34 100644 --- a/source/blender/editors/physics/physics_ops.c +++ b/source/blender/editors/physics/physics_ops.c @@ -29,6 +29,8 @@ #include +#include "DNA_scene_types.h" + #include "BLI_utildefines.h" #include "RNA_access.h" diff --git a/source/blender/editors/space_api/spacetypes.c b/source/blender/editors/space_api/spacetypes.c index 2739d41a73d..bb0521d6589 100644 --- a/source/blender/editors/space_api/spacetypes.c +++ b/source/blender/editors/space_api/spacetypes.c @@ -33,6 +33,7 @@ #include "BLI_utildefines.h" #include "DNA_object_types.h" +#include "DNA_scene_types.h" #include "DNA_windowmanager_types.h" diff --git a/source/blender/editors/space_logic/logic_ops.c b/source/blender/editors/space_logic/logic_ops.c index a85fec7bf87..fadf4c0b113 100644 --- a/source/blender/editors/space_logic/logic_ops.c +++ b/source/blender/editors/space_logic/logic_ops.c @@ -34,6 +34,7 @@ #include "DNA_sensor_types.h" #include "DNA_controller_types.h" #include "DNA_actuator_types.h" +#include "DNA_scene_types.h" #include "BLI_blenlib.h" #include "BLI_utildefines.h" diff --git a/source/blender/editors/space_view3d/view3d_iterators.c b/source/blender/editors/space_view3d/view3d_iterators.c index 180686b4b82..0490d8763d8 100644 --- a/source/blender/editors/space_view3d/view3d_iterators.c +++ b/source/blender/editors/space_view3d/view3d_iterators.c @@ -30,6 +30,7 @@ #include "DNA_mesh_types.h" #include "DNA_armature_types.h" #include "DNA_object_types.h" +#include "DNA_scene_types.h" #include "BLI_utildefines.h" #include "BLI_listbase.h" diff --git a/source/blender/editors/util/undo.c b/source/blender/editors/util/undo.c index e1451ee43e6..7f2e5b4b81c 100644 --- a/source/blender/editors/util/undo.c +++ b/source/blender/editors/util/undo.c @@ -39,6 +39,7 @@ #include "DNA_mesh_types.h" #include "DNA_object_types.h" +#include "DNA_scene_types.h" #include "BLI_blenlib.h" #include "BLI_dynstr.h" From 436c546d67162530c8b97a87a8bf978a9015aa31 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Tue, 25 Jun 2013 10:30:07 +0000 Subject: [PATCH 47/72] Use bit-shift op for all bit-flags. Btw, there is a comment stating that bits 12-15 are the same for uiBlock->flag and uiBut->flag, this is obviously no more true currently (maybe it is now bits 14-17, i.e. ALIGN flags?). --- source/blender/editors/include/UI_interface.h | 184 +++++++++--------- 1 file changed, 93 insertions(+), 91 deletions(-) diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h index 86e51b201d9..9c9ab2972b3 100644 --- a/source/blender/editors/include/UI_interface.h +++ b/source/blender/editors/include/UI_interface.h @@ -95,84 +95,86 @@ typedef struct uiLayout uiLayout; #define UI_EMBOSST 3 /* Table */ /* uiBlock->direction */ -#define UI_DIRECTION (UI_TOP | UI_DOWN | UI_LEFT | UI_RIGHT) -#define UI_TOP 1 -#define UI_DOWN 2 -#define UI_LEFT 4 -#define UI_RIGHT 8 - -#define UI_CENTER 16 -#define UI_SHIFT_FLIPPED 32 +#define UI_DIRECTION (UI_TOP | UI_DOWN | UI_LEFT | UI_RIGHT) +#define UI_TOP (1 << 0) +#define UI_DOWN (1 << 1) +#define UI_LEFT (1 << 2) +#define UI_RIGHT (1 << 3) +#define UI_CENTER (1 << 4) +#define UI_SHIFT_FLIPPED (1 << 5) +#if 0 /* uiBlock->autofill (not yet used) */ -// #define UI_BLOCK_COLLUMNS 1 -// #define UI_BLOCK_ROWS 2 +#define UI_BLOCK_COLLUMNS 1 +#define UI_BLOCK_ROWS 2 +#endif /* uiBlock->flag (controls) */ -#define UI_BLOCK_LOOP 1 -#define UI_BLOCK_REDRAW 2 -#define UI_BLOCK_SEARCH_MENU 4 -#define UI_BLOCK_NUMSELECT 8 -#define UI_BLOCK_NO_WIN_CLIP 16 /* don't apply window clipping */ /* was UI_BLOCK_ENTER_OK */ -#define UI_BLOCK_CLIPBOTTOM 32 -#define UI_BLOCK_CLIPTOP 64 -#define UI_BLOCK_MOVEMOUSE_QUIT 128 -#define UI_BLOCK_KEEP_OPEN 256 -#define UI_BLOCK_POPUP 512 -#define UI_BLOCK_OUT_1 1024 -#define UI_BLOCK_NO_FLIP 2048 -#define UI_BLOCK_POPUP_MEMORY 4096 -#define UI_BLOCK_CLIP_EVENTS 8192 /* stop handling mouse events */ - -/* uiPopupBlockHandle->menuretval */ -#define UI_RETURN_CANCEL 1 /* cancel all menus cascading */ -#define UI_RETURN_OK 2 /* choice made */ -#define UI_RETURN_OUT 4 /* left the menu */ -#define UI_RETURN_OUT_PARENT 8 /* let the parent handle this event */ -#define UI_RETURN_UPDATE 16 /* update the button that opened */ -#define UI_RETURN_POPUP_OK 32 /* popup is ok to be handled */ +#define UI_BLOCK_LOOP (1 << 0) +#define UI_BLOCK_REDRAW (1 << 1) +#define UI_BLOCK_SEARCH_MENU (1 << 2) +#define UI_BLOCK_NUMSELECT (1 << 3) +#define UI_BLOCK_NO_WIN_CLIP (1 << 4) /* don't apply window clipping */ /* was UI_BLOCK_ENTER_OK */ +#define UI_BLOCK_CLIPBOTTOM (1 << 5) +#define UI_BLOCK_CLIPTOP (1 << 6) +#define UI_BLOCK_MOVEMOUSE_QUIT (1 << 7) +#define UI_BLOCK_KEEP_OPEN (1 << 8) +#define UI_BLOCK_POPUP (1 << 9) +#define UI_BLOCK_OUT_1 (1 << 10) +#define UI_BLOCK_NO_FLIP (1 << 11) +#define UI_BLOCK_POPUP_MEMORY (1 << 12) +#define UI_BLOCK_CLIP_EVENTS (1 << 13) /* stop handling mouse events */ +/* XXX This comment is no more valid! */ /* block->flag bits 12-15 are identical to but->flag bits */ +/* uiPopupBlockHandle->menuretval */ +#define UI_RETURN_CANCEL (1 << 0) /* cancel all menus cascading */ +#define UI_RETURN_OK (1 << 1) /* choice made */ +#define UI_RETURN_OUT (1 << 2) /* left the menu */ +#define UI_RETURN_OUT_PARENT (1 << 3) /* let the parent handle this event */ +#define UI_RETURN_UPDATE (1 << 4) /* update the button that opened */ +#define UI_RETURN_POPUP_OK (1 << 5) /* popup is ok to be handled */ + /* panel controls */ -#define UI_PNL_SOLID 2 -#define UI_PNL_CLOSE 32 -#define UI_PNL_SCALE 512 +#define UI_PNL_SOLID (1 << 1) +#define UI_PNL_CLOSE (1 << 5) +#define UI_PNL_SCALE (1 << 9) /* warning the first 6 flags are internal */ /* but->flag */ -#define UI_TEXT_LEFT 64 -#define UI_ICON_LEFT 128 -#define UI_ICON_SUBMENU 256 -#define UI_ICON_PREVIEW 512 +#define UI_TEXT_LEFT (1 << 6) +#define UI_ICON_LEFT (1 << 7) +#define UI_ICON_SUBMENU (1 << 8) +#define UI_ICON_PREVIEW (1 << 9) -#define UI_TEXT_RIGHT 1024 -#define UI_BUT_NODE_LINK 2048 -#define UI_BUT_NODE_ACTIVE 4096 -#define UI_BUT_DRAG_LOCK 8192 +#define UI_TEXT_RIGHT (1 << 10) +#define UI_BUT_NODE_LINK (1 << 11) +#define UI_BUT_NODE_ACTIVE (1 << 12) +#define UI_BUT_DRAG_LOCK (1 << 13) /* button align flag, for drawing groups together */ -#define UI_BUT_ALIGN (UI_BUT_ALIGN_TOP | UI_BUT_ALIGN_LEFT | UI_BUT_ALIGN_RIGHT | UI_BUT_ALIGN_DOWN) -#define UI_BUT_ALIGN_TOP (1 << 14) -#define UI_BUT_ALIGN_LEFT (1 << 15) -#define UI_BUT_ALIGN_RIGHT (1 << 16) -#define UI_BUT_ALIGN_DOWN (1 << 17) +#define UI_BUT_ALIGN (UI_BUT_ALIGN_TOP | UI_BUT_ALIGN_LEFT | UI_BUT_ALIGN_RIGHT | UI_BUT_ALIGN_DOWN) +#define UI_BUT_ALIGN_TOP (1 << 14) +#define UI_BUT_ALIGN_LEFT (1 << 15) +#define UI_BUT_ALIGN_RIGHT (1 << 16) +#define UI_BUT_ALIGN_DOWN (1 << 17) -#define UI_BUT_DISABLED (1 << 18) -#define UI_BUT_COLOR_LOCK (1 << 19) -#define UI_BUT_ANIMATED (1 << 20) -#define UI_BUT_ANIMATED_KEY (1 << 21) -#define UI_BUT_DRIVEN (1 << 22) -#define UI_BUT_REDALERT (1 << 23) -#define UI_BUT_INACTIVE (1 << 24) -#define UI_BUT_LAST_ACTIVE (1 << 25) -#define UI_BUT_UNDO (1 << 26) -#define UI_BUT_IMMEDIATE (1 << 27) -#define UI_BUT_NO_TOOLTIP (1 << 28) -#define UI_BUT_NO_UTF8 (1 << 29) +#define UI_BUT_DISABLED (1 << 18) +#define UI_BUT_COLOR_LOCK (1 << 19) +#define UI_BUT_ANIMATED (1 << 20) +#define UI_BUT_ANIMATED_KEY (1 << 21) +#define UI_BUT_DRIVEN (1 << 22) +#define UI_BUT_REDALERT (1 << 23) +#define UI_BUT_INACTIVE (1 << 24) +#define UI_BUT_LAST_ACTIVE (1 << 25) +#define UI_BUT_UNDO (1 << 26) +#define UI_BUT_IMMEDIATE (1 << 27) +#define UI_BUT_NO_TOOLTIP (1 << 28) +#define UI_BUT_NO_UTF8 (1 << 29) #define UI_BUT_VEC_SIZE_LOCK (1 << 30) /* used to flag if color hsv-circle should keep luminance */ -#define UI_BUT_COLOR_CUBIC (1 << 31) /* cubic saturation for the color wheel */ +#define UI_BUT_COLOR_CUBIC (1 << 31) /* cubic saturation for the color wheel */ #define UI_PANEL_WIDTH 340 #define UI_COMPACT_PANEL_WIDTH 160 @@ -279,9 +281,9 @@ void uiDrawBoxShade(int mode, float minx, float miny, float maxx, float maxy, fl void uiDrawBoxVerticalShade(int mode, float minx, float miny, float maxx, float maxy, float rad, float shadeLeft, float shadeRight); /* state for scrolldrawing */ -#define UI_SCROLL_PRESSED 1 -#define UI_SCROLL_ARROWS 2 -#define UI_SCROLL_NO_OUTLINE 4 +#define UI_SCROLL_PRESSED (1 << 0) +#define UI_SCROLL_ARROWS (1 << 1) +#define UI_SCROLL_NO_OUTLINE (1 << 2) void uiWidgetScrollDraw(struct uiWidgetColors *wcol, const struct rcti *rect, const struct rcti *slider, int state); /* Callbacks @@ -556,18 +558,18 @@ void uiButGetStrInfo(struct bContext *C, uiBut *but, ...); * - PickerButtons: buttons like the color picker (for code sharing). * - AutoButR: RNA property button with type automatically defined. */ -#define UI_ID_RENAME 1 -#define UI_ID_BROWSE 2 -#define UI_ID_ADD_NEW 4 -#define UI_ID_OPEN 8 -#define UI_ID_ALONE 16 -#define UI_ID_DELETE 32 -#define UI_ID_LOCAL 64 -#define UI_ID_AUTO_NAME 128 -#define UI_ID_FAKE_USER 256 -#define UI_ID_PIN 512 -#define UI_ID_BROWSE_RENDER 1024 -#define UI_ID_PREVIEWS 2048 +#define UI_ID_RENAME (1 << 0) +#define UI_ID_BROWSE (1 << 1) +#define UI_ID_ADD_NEW (1 << 2) +#define UI_ID_OPEN (1 << 3) +#define UI_ID_ALONE (1 << 4) +#define UI_ID_DELETE (1 << 5) +#define UI_ID_LOCAL (1 << 6) +#define UI_ID_AUTO_NAME (1 << 7) +#define UI_ID_FAKE_USER (1 << 8) +#define UI_ID_PIN (1 << 9) +#define UI_ID_BROWSE_RENDER (1 << 10) +#define UI_ID_PREVIEWS (1 << 11) #define UI_ID_FULL (UI_ID_RENAME | UI_ID_BROWSE | UI_ID_ADD_NEW | UI_ID_OPEN | UI_ID_ALONE | UI_ID_DELETE | UI_ID_LOCAL) int uiIconFromID(struct ID *id); @@ -708,15 +710,15 @@ void UI_exit(void); #define UI_LAYOUT_ALIGN_CENTER 2 #define UI_LAYOUT_ALIGN_RIGHT 3 -#define UI_ITEM_O_RETURN_PROPS 1 -#define UI_ITEM_R_EXPAND 2 -#define UI_ITEM_R_SLIDER 4 -#define UI_ITEM_R_TOGGLE 8 -#define UI_ITEM_R_ICON_ONLY 16 -#define UI_ITEM_R_EVENT 32 -#define UI_ITEM_R_FULL_EVENT 64 -#define UI_ITEM_R_NO_BG 128 -#define UI_ITEM_R_IMMEDIATE 256 +#define UI_ITEM_O_RETURN_PROPS (1 << 0) +#define UI_ITEM_R_EXPAND (1 << 1) +#define UI_ITEM_R_SLIDER (1 << 2) +#define UI_ITEM_R_TOGGLE (1 << 3) +#define UI_ITEM_R_ICON_ONLY (1 << 4) +#define UI_ITEM_R_EVENT (1 << 5) +#define UI_ITEM_R_FULL_EVENT (1 << 6) +#define UI_ITEM_R_NO_BG (1 << 7) +#define UI_ITEM_R_IMMEDIATE (1 << 8) /* uiLayoutOperatorButs flags */ #define UI_LAYOUT_OP_SHOW_TITLE 1 @@ -729,13 +731,13 @@ void UI_exit(void); * 8------4 */ enum { - UI_CNR_TOP_LEFT = 1, - UI_CNR_TOP_RIGHT = 2, - UI_CNR_BOTTOM_RIGHT = 4, - UI_CNR_BOTTOM_LEFT = 8, + UI_CNR_TOP_LEFT = (1 << 0), + UI_CNR_TOP_RIGHT = (1 << 1), + UI_CNR_BOTTOM_RIGHT = (1 << 2), + UI_CNR_BOTTOM_LEFT = (1 << 3), /* just for convenience */ - UI_CNR_NONE = 0, - UI_CNR_ALL = (UI_CNR_TOP_LEFT | UI_CNR_TOP_RIGHT | UI_CNR_BOTTOM_RIGHT | UI_CNR_BOTTOM_LEFT) + UI_CNR_NONE = 0, + UI_CNR_ALL = (UI_CNR_TOP_LEFT | UI_CNR_TOP_RIGHT | UI_CNR_BOTTOM_RIGHT | UI_CNR_BOTTOM_LEFT) }; /* not apart of the corner flags but mixed in some functions */ From 02bcfa19509c900d40e9ee3edada8cf068ea32a2 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 25 Jun 2013 10:40:15 +0000 Subject: [PATCH 48/72] new weight operators had zero min/max range for the 'weight_group' --- source/blender/editors/object/object_vgroup.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/source/blender/editors/object/object_vgroup.c b/source/blender/editors/object/object_vgroup.c index c5efa91d105..91a23eab2b3 100644 --- a/source/blender/editors/object/object_vgroup.c +++ b/source/blender/editors/object/object_vgroup.c @@ -4121,8 +4121,8 @@ void OBJECT_OT_vertex_weight_paste(wmOperatorType *ot) ot->idname = "OBJECT_OT_vertex_weight_paste"; ot->description = "Copy this group's weight to other selected verts"; - prop = RNA_def_int(ot->srna, "weight_group", - -1, 0, 0, "Weight Index", "Index of source weight in active Weight Group", 0, 0); + prop = RNA_def_int(ot->srna, "weight_group", -1, -1, INT_MAX, "Weight Index", + "Index of source weight in active Weight Group", -1, INT_MAX); RNA_def_property_flag(prop, PROP_SKIP_SAVE | PROP_HIDDEN); /* api callbacks */ @@ -4153,8 +4153,8 @@ void OBJECT_OT_vertex_weight_delete(wmOperatorType *ot) ot->idname = "OBJECT_OT_vertex_weight_delete"; ot->description = "Delete this weight from the vertex"; - prop = RNA_def_int(ot->srna, "weight_group", - -1, 0, 0, "Weight Index", "Index of source weight in active Weight Group", 0, 0); + prop = RNA_def_int(ot->srna, "weight_group", -1, -1, INT_MAX, "Weight Index", + "Index of source weight in active Weight Group", -1, INT_MAX); RNA_def_property_flag(prop, PROP_SKIP_SAVE | PROP_HIDDEN); /* api callbacks */ @@ -4187,8 +4187,8 @@ void OBJECT_OT_vertex_weight_set_active(wmOperatorType *ot) ot->idname = "OBJECT_OT_vertex_weight_set_active"; ot->description = "Set as active Vertex Group"; - prop = RNA_def_int(ot->srna, "weight_group", - -1, 0, 0, "Weight Index", "Index of source weight in active Weight Group", 0, 0); + prop = RNA_def_int(ot->srna, "weight_group", -1, -1, INT_MAX, "Weight Index", + "Index of source weight in active Weight Group", -1, INT_MAX); RNA_def_property_flag(prop, PROP_SKIP_SAVE | PROP_HIDDEN); /* api callbacks */ From 37f59451889d64e588ace4f16f7eebd085d8147a Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 25 Jun 2013 10:44:30 +0000 Subject: [PATCH 49/72] style cleanup --- source/blender/blenkernel/intern/autoexec.c | 2 +- source/blender/blenkernel/intern/deform.c | 2 +- source/blender/blenkernel/intern/mball.c | 8 +++++--- source/blender/blenkernel/intern/tracking.c | 2 +- source/blender/blenloader/intern/readfile.c | 2 +- source/blender/editors/render/render_internal.c | 7 ++++--- source/blender/editors/render/render_opengl.c | 2 +- source/blender/editors/space_view3d/space_view3d.c | 4 ++++ source/blender/editors/space_view3d/view3d_buttons.c | 4 ++-- source/blender/editors/transform/transform_manipulator.c | 2 +- source/blender/gpu/intern/gpu_codegen.c | 4 ++-- 11 files changed, 23 insertions(+), 16 deletions(-) diff --git a/source/blender/blenkernel/intern/autoexec.c b/source/blender/blenkernel/intern/autoexec.c index c27343bf80a..872780bd50a 100644 --- a/source/blender/blenkernel/intern/autoexec.c +++ b/source/blender/blenkernel/intern/autoexec.c @@ -20,7 +20,7 @@ * ***** END GPL LICENSE BLOCK ***** */ -/** \file blender/blenkernel/intern/armature.c +/** \file blender/blenkernel/intern/autoexec.c * \ingroup bke * * Currently just checks if a blend file can be trusted to autoexec, diff --git a/source/blender/blenkernel/intern/deform.c b/source/blender/blenkernel/intern/deform.c index edeef26ed58..b82e89d1af6 100644 --- a/source/blender/blenkernel/intern/deform.c +++ b/source/blender/blenkernel/intern/deform.c @@ -88,7 +88,7 @@ void defvert_copy_subset(MDeformVert *dvert_dst, const MDeformVert *dvert_src, const bool *vgroup_subset, const int vgroup_tot) { int defgroup; - for (defgroup=0; defgroup < vgroup_tot; defgroup++) { + for (defgroup = 0; defgroup < vgroup_tot; defgroup++) { if (vgroup_subset[defgroup]) { defvert_copy_index(dvert_dst, dvert_src, defgroup); } diff --git a/source/blender/blenkernel/intern/mball.c b/source/blender/blenkernel/intern/mball.c index d09490db235..8361f0c4f6c 100644 --- a/source/blender/blenkernel/intern/mball.c +++ b/source/blender/blenkernel/intern/mball.c @@ -151,7 +151,7 @@ typedef struct process { /* parameters, function, storage */ /* what happens here? floats, I think. */ /* float (*function)(void); */ /* implicit surface function */ - float (*function)(struct process*, float, float, float); + float (*function)(struct process *, float, float, float); float size, delta; /* cube size, normal delta */ int bounds; /* cube range within lattice */ CUBES *cubes; /* active cubes */ @@ -2283,7 +2283,7 @@ void BKE_mball_polygonize(Scene *scene, Object *ob, ListBase *dispbase) if (process.totelem == 0) return; if ((G.is_rendering == FALSE) && (mb->flag == MB_UPDATE_NEVER)) return; - if ((G.moving & (G_TRANSFORM_OBJ|G_TRANSFORM_EDIT)) && mb->flag == MB_UPDATE_FAST) return; + if ((G.moving & (G_TRANSFORM_OBJ | G_TRANSFORM_EDIT)) && mb->flag == MB_UPDATE_FAST) return; process.thresh = mb->thresh; @@ -2325,7 +2325,9 @@ void BKE_mball_polygonize(Scene *scene, Object *ob, ListBase *dispbase) } else { width = mb->wiresize; - if ((G.moving & (G_TRANSFORM_OBJ|G_TRANSFORM_EDIT)) && mb->flag == MB_UPDATE_HALFRES) width *= 2; + if ((G.moving & (G_TRANSFORM_OBJ | G_TRANSFORM_EDIT)) && mb->flag == MB_UPDATE_HALFRES) { + width *= 2; + } } /* nr_cubes is just for safety, minimum is totsize */ nr_cubes = (int)(0.5f + totsize / width); diff --git a/source/blender/blenkernel/intern/tracking.c b/source/blender/blenkernel/intern/tracking.c index 9ae3c5cdfe1..c073c716ec6 100644 --- a/source/blender/blenkernel/intern/tracking.c +++ b/source/blender/blenkernel/intern/tracking.c @@ -3889,7 +3889,7 @@ ImBuf *BKE_tracking_stabilize_frame(MovieTracking *tracking, int framenr, ImBuf * But need to keep an eye on this if the function will be * used in other cases. */ - #pragma omp parallel for if(tmpibuf->y > 128) + #pragma omp parallel for if (tmpibuf->y > 128) for (j = 0; j < tmpibuf->y; j++) { int i; for (i = 0; i < tmpibuf->x; i++) { diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 07ed2f18111..673cd3f7b26 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -9331,7 +9331,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) } if (main->versionfile < 267) { - //if(!DNA_struct_elem_find(fd->filesdna, "Brush", "int", "stencil_pos")) { + //if (!DNA_struct_elem_find(fd->filesdna, "Brush", "int", "stencil_pos")) { Brush *brush; for (brush = main->brush.first; brush; brush = brush->id.next) { diff --git a/source/blender/editors/render/render_internal.c b/source/blender/editors/render/render_internal.c index 4542f140e67..09138a5523a 100644 --- a/source/blender/editors/render/render_internal.c +++ b/source/blender/editors/render/render_internal.c @@ -299,7 +299,7 @@ static void make_renderinfo_string(RenderStats *rs, Scene *scene, char *str) megs_peak_memory = (peak_memory) / (1024.0 * 1024.0); /* local view */ - if(rs->localview) + if (rs->localview) spos += sprintf(spos, "%s | ", IFACE_("Local View")); /* frame number */ @@ -323,8 +323,9 @@ static void make_renderinfo_string(RenderStats *rs, Scene *scene, char *str) /* statistics */ if (rs->statstr) { - if(rs->statstr[0]) + if (rs->statstr[0]) { spos += sprintf(spos, "| %s ", rs->statstr); + } } else { if (rs->totvert || rs->totface || rs->tothalo || rs->totstrand || rs->totlamp) @@ -468,7 +469,7 @@ static void render_endjob(void *rjv) /* XXX render stability hack */ G.is_rendering = FALSE; - WM_main_add_notifier(NC_SCENE|ND_RENDER_RESULT, NULL); + WM_main_add_notifier(NC_SCENE | ND_RENDER_RESULT, NULL); /* Partial render result will always update display buffer * for first render layer only. This is nice because you'll diff --git a/source/blender/editors/render/render_opengl.c b/source/blender/editors/render/render_opengl.c index a22f776d9a0..13379425258 100644 --- a/source/blender/editors/render/render_opengl.c +++ b/source/blender/editors/render/render_opengl.c @@ -271,7 +271,7 @@ static void screen_opengl_render_apply(OGLRender *oglrender) if (rect) { int profile_to; - if(BKE_scene_check_color_management_enabled(scene)) + if (BKE_scene_check_color_management_enabled(scene)) profile_to = IB_PROFILE_LINEAR_RGB; else profile_to = IB_PROFILE_SRGB; diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c index b3d58bfa1b1..fef534fa5f2 100644 --- a/source/blender/editors/space_view3d/space_view3d.c +++ b/source/blender/editors/space_view3d/space_view3d.c @@ -805,7 +805,9 @@ static void view3d_main_area_listener(bScreen *sc, ScrArea *sa, ARegion *ar, wmN case ND_NODES: if ((v3d->drawtype == OB_MATERIAL) || (v3d->drawtype == OB_TEXTURE && scene->gm.matmode == GAME_MAT_GLSL)) + { ED_region_tag_redraw(ar); + } break; case ND_SHADING_DRAW: case ND_SHADING_LINKS: @@ -832,7 +834,9 @@ static void view3d_main_area_listener(bScreen *sc, ScrArea *sa, ARegion *ar, wmN case ND_LIGHTING_DRAW: if ((v3d->drawtype == OB_MATERIAL) || (v3d->drawtype == OB_TEXTURE && (scene->gm.matmode == GAME_MAT_GLSL))) + { ED_region_tag_redraw(ar); + } break; } break; diff --git a/source/blender/editors/space_view3d/view3d_buttons.c b/source/blender/editors/space_view3d/view3d_buttons.c index 369051a0ab9..c3686c601d8 100644 --- a/source/blender/editors/space_view3d/view3d_buttons.c +++ b/source/blender/editors/space_view3d/view3d_buttons.c @@ -907,12 +907,12 @@ static void view3d_panel_vgroup(const bContext *C, Panel *pa) ot = WM_operatortype_find("OBJECT_OT_vertex_weight_normalize_active", 1); but = uiDefButO_ptr(block, BUT, ot, WM_OP_EXEC_DEFAULT, "Normalize", - 0, yco,UI_UNIT_X * 5, UI_UNIT_Y, + 0, yco, UI_UNIT_X * 5, UI_UNIT_Y, TIP_("Normalize active vertex weights")); ot = WM_operatortype_find("OBJECT_OT_vertex_weight_copy", 1); but = uiDefButO_ptr(block, BUT, ot, WM_OP_EXEC_DEFAULT, "Copy", - UI_UNIT_X * 5, yco,UI_UNIT_X * 5, UI_UNIT_Y, + UI_UNIT_X * 5, yco, UI_UNIT_X * 5, UI_UNIT_Y, TIP_("Copy active vertex to other selected verts")); } diff --git a/source/blender/editors/transform/transform_manipulator.c b/source/blender/editors/transform/transform_manipulator.c index 8972229d618..5059e3bcc40 100644 --- a/source/blender/editors/transform/transform_manipulator.c +++ b/source/blender/editors/transform/transform_manipulator.c @@ -1651,7 +1651,7 @@ void BIF_draw_manipulator(const bContext *C) if (v3d->twtype & V3D_MANIP_ROTATE) { if (G.debug_value == 3) { - if (G.moving & (G_TRANSFORM_OBJ|G_TRANSFORM_EDIT)) + if (G.moving & (G_TRANSFORM_OBJ | G_TRANSFORM_EDIT)) draw_manipulator_rotate_cyl(v3d, rv3d, 1, drawflags, v3d->twtype, MAN_MOVECOL); else draw_manipulator_rotate_cyl(v3d, rv3d, 0, drawflags, v3d->twtype, MAN_RGB); diff --git a/source/blender/gpu/intern/gpu_codegen.c b/source/blender/gpu/intern/gpu_codegen.c index f9e1babcb56..e244c7cf57f 100644 --- a/source/blender/gpu/intern/gpu_codegen.c +++ b/source/blender/gpu/intern/gpu_codegen.c @@ -567,7 +567,7 @@ static void codegen_call_functions(DynStr *ds, ListBase *nodes, GPUOutput *final "tmp", input->link->output->id); } else if (input->source == GPU_SOURCE_BUILTIN) { - if(input->builtin == GPU_VIEW_NORMAL) + if (input->builtin == GPU_VIEW_NORMAL) BLI_dynstr_append(ds, "facingnormal"); else BLI_dynstr_append(ds, GPU_builtin_name(input->builtin)); @@ -615,7 +615,7 @@ static char *code_generate_fragment(ListBase *nodes, GPUOutput *output, const ch BLI_dynstr_append(ds, "void main(void)\n"); BLI_dynstr_append(ds, "{\n"); - if(builtins & GPU_VIEW_NORMAL) + if (builtins & GPU_VIEW_NORMAL) BLI_dynstr_append(ds, "\tvec3 facingnormal = (gl_FrontFacing)? varnormal: -varnormal;\n"); From 64968e3618892ebac419149fa8c4198151a4e29a Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 25 Jun 2013 10:49:20 +0000 Subject: [PATCH 50/72] patch [#35830] Add Catmull-Rom spline as an option for lattice deformer --- source/blender/blenkernel/intern/key.c | 27 ++++++++++++++++++++++++ source/blender/makesdna/DNA_key_types.h | 3 ++- source/blender/makesrna/intern/rna_key.c | 1 + 3 files changed, 30 insertions(+), 1 deletion(-) diff --git a/source/blender/blenkernel/intern/key.c b/source/blender/blenkernel/intern/key.c index dfa5fcff94c..e141b9dbabe 100644 --- a/source/blender/blenkernel/intern/key.c +++ b/source/blender/blenkernel/intern/key.c @@ -289,6 +289,16 @@ void key_curve_position_weights(float t, float data[4], int type) data[2] = -0.5f * t3 + 0.5f * t2 + 0.5f * t + 0.16666666f; data[3] = 0.16666666f * t3; } + else if (type == KEY_CATMULL_ROM) { + t2 = t * t; + t3 = t2 * t; + fc = 0.5f; + + data[0] = -fc * t3 + 2.0f * fc * t2 - fc * t; + data[1] = (2.0f - fc) * t3 + (fc - 3.0f) * t2 + 1.0f; + data[2] = (fc - 2.0f) * t3 + (3.0f - 2.0f * fc) * t2 + fc * t; + data[3] = fc * t3 - fc * t2; + } } /* first derivative */ @@ -319,6 +329,15 @@ void key_curve_tangent_weights(float t, float data[4], int type) data[2] = -1.5f * t2 + t + 0.5f; data[3] = 0.5f * t2; } + else if (type == KEY_CATMULL_ROM) { + t2 = t * t; + fc = 0.5f; + + data[0] = -3.0f * fc * t2 + 4.0f * fc * t - fc; + data[1] = 3.0f * (2.0f - fc) * t2 + 2.0f * (fc - 3.0f) * t; + data[2] = 3.0f * (fc - 2.0f) * t2 + 2.0f * (3.0f - 2.0f * fc) * t + fc; + data[3] = 3.0f * fc * t2 - 2.0f * fc * t; + } } /* second derivative */ @@ -346,6 +365,14 @@ void key_curve_normal_weights(float t, float data[4], int type) data[2] = -3.0f * t + 1.0f; data[3] = 1.0f * t; } + else if (type == KEY_CATMULL_ROM) { + fc = 0.5f; + + data[0] = -6.0f * fc * t + 4.0f * fc; + data[1] = 6.0f * (2.0f - fc) * t + 2.0f * (fc - 3.0f); + data[2] = 6.0f * (fc - 2.0f) * t + 2.0f * (3.0f - 2.0f * fc); + data[3] = 6.0f * fc * t - 2.0f * fc; + } } static int setkeys(float fac, ListBase *lb, KeyBlock *k[], float t[4], int cycl) diff --git a/source/blender/makesdna/DNA_key_types.h b/source/blender/makesdna/DNA_key_types.h index 4783247420c..0a09a82b2bb 100644 --- a/source/blender/makesdna/DNA_key_types.h +++ b/source/blender/makesdna/DNA_key_types.h @@ -125,7 +125,8 @@ enum { enum { KEY_LINEAR = 0, KEY_CARDINAL = 1, - KEY_BSPLINE = 2 + KEY_BSPLINE = 2, + KEY_CATMULL_ROM = 3, }; /* KeyBlock->flag */ diff --git a/source/blender/makesrna/intern/rna_key.c b/source/blender/makesrna/intern/rna_key.c index 3a2677c8398..49d760adb32 100644 --- a/source/blender/makesrna/intern/rna_key.c +++ b/source/blender/makesrna/intern/rna_key.c @@ -458,6 +458,7 @@ static char *rna_ShapeKeyPoint_path(PointerRNA *ptr) EnumPropertyItem keyblock_type_items[] = { {KEY_LINEAR, "KEY_LINEAR", 0, "Linear", ""}, {KEY_CARDINAL, "KEY_CARDINAL", 0, "Cardinal", ""}, + {KEY_CATMULL_ROM, "KEY_CATMULL_ROM", 0, "Catmull-Rom", ""}, {KEY_BSPLINE, "KEY_BSPLINE", 0, "BSpline", ""}, {0, NULL, 0, NULL, NULL} }; From 9ae8e4ca1ab491c0896e2deb40d6fd4a83b1fb32 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Tue, 25 Jun 2013 12:26:49 +0000 Subject: [PATCH 51/72] Fix #35715: graph editor > channels > move.. menu item showed wrong keyboard shortcut. --- source/blender/editors/interface/interface_layout.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c index ef839f1d143..7c32f354c0a 100644 --- a/source/blender/editors/interface/interface_layout.c +++ b/source/blender/editors/interface/interface_layout.c @@ -1749,7 +1749,7 @@ void uiItemMenuEnumO(uiLayout *layout, bContext *C, const char *opname, const ch /* add hotkey here, lower UI code can't detect it */ if (layout->root->block->flag & UI_BLOCK_LOOP) { - if (ot->prop && + if (ot->prop && ot->invoke && WM_key_event_operator_string(C, ot->idname, layout->root->opcontext, NULL, false, keybuf, sizeof(keybuf))) { namestr += BLI_snprintf(namestr, sizeof(namestr_buf) - (namestr - namestr_buf), "|%s", keybuf); From bd59bae6510c65c14956fefdcf3bedda4edf10d4 Mon Sep 17 00:00:00 2001 From: Antony Riakiotakis Date: Tue, 25 Jun 2013 13:27:43 +0000 Subject: [PATCH 52/72] Fix #34909 Texture paint mode does not correctly update when using textures larger than 2048x2048. Check if texture is over user preference or GPU limit in texture paint mode and if it is, scale the partial redraw rectangle before uploading to GPU. This should be faster than rescaling the whole texture. --- source/blender/gpu/intern/gpu_draw.c | 90 +++++++++++++++++++++++++++- 1 file changed, 89 insertions(+), 1 deletion(-) diff --git a/source/blender/gpu/intern/gpu_draw.c b/source/blender/gpu/intern/gpu_draw.c index e98f8988aa6..fc28ec2d6f7 100644 --- a/source/blender/gpu/intern/gpu_draw.c +++ b/source/blender/gpu/intern/gpu_draw.c @@ -932,6 +932,77 @@ void GPU_paint_set_mipmap(int mipmap) } } + +/* check if image has been downscaled and do scaled partial update */ +static bool GPU_check_scaled_image(ImBuf *ibuf, Image *ima, float *frect, int x, int y, int w, int h) +{ + if ((!GPU_non_power_of_two_support() && !is_power_of_2_resolution(ibuf->x, ibuf->y)) || + is_over_resolution_limit(ibuf->x, ibuf->y)) + { + int x_limit = smaller_power_of_2_limit(ibuf->x); + int y_limit = smaller_power_of_2_limit(ibuf->y); + + float xratio = x_limit/(float)ibuf->x; + float yratio = y_limit/(float)ibuf->y; + + /* find new width, height and x,y gpu texture coordinates */ + + /* take ceiling because we will be losing 1 pixel due to rounding errors in x,y... */ + int rectw = (int)ceil(xratio * w); + int recth = (int)ceil(yratio * h); + + x *= xratio; + y *= yratio; + + /* ...but take back if we are over the limit! */ + if (rectw + x > x_limit) rectw--; + if (recth + y > y_limit) recth--; + + /* float rectangles are already continuous in memory so we can use gluScaleImage */ + if (frect) { + float *fscalerect = MEM_mallocN(rectw*recth*sizeof(*fscalerect)*4, "fscalerect"); + gluScaleImage(GL_RGBA, w, h, GL_FLOAT, frect, rectw, recth, GL_FLOAT, fscalerect); + + glBindTexture(GL_TEXTURE_2D, ima->bindcode); + glTexSubImage2D(GL_TEXTURE_2D, 0, x, y, rectw, recth, GL_RGBA, + GL_FLOAT, fscalerect); + + MEM_freeN(fscalerect); + } + /* byte images are not continuous in memory so do manual interpolation */ + else { + unsigned char *scalerect= MEM_mallocN(rectw*recth*sizeof(*scalerect)*4, "scalerect"); + unsigned int *p = (unsigned int *)scalerect; + int i, j; + float inv_xratio = 1.0/xratio; + float inv_yratio = 1.0/yratio; + for (i = 0; i < rectw; i++) { + float u = (x + i)*inv_xratio; + for (j = 0; j < recth; j++) { + float v = (y + j)*inv_yratio; + bilinear_interpolation_color_wrap(ibuf, (unsigned char *)(p + i + j * (rectw)), NULL, u, v); + } + } + glBindTexture(GL_TEXTURE_2D, ima->bindcode); + glTexSubImage2D(GL_TEXTURE_2D, 0, x, y, rectw, recth, GL_RGBA, + GL_UNSIGNED_BYTE, scalerect); + + MEM_freeN(scalerect); + } + + if (GPU_get_mipmap()) { + gpu_generate_mipmap(GL_TEXTURE_2D); + } + else { + ima->tpageflag &= ~IMA_MIPMAP_COMPLETE; + } + + return true; + } + + return false; +} + void GPU_paint_update_image(Image *ima, int x, int y, int w, int h) { ImBuf *ibuf; @@ -959,6 +1030,15 @@ void GPU_paint_update_image(Image *ima, int x, int y, int w, int h) int is_data = (ima->tpageflag & IMA_GLBIND_IS_DATA); IMB_partial_rect_from_float(ibuf, buffer, x, y, w, h, is_data); + if (GPU_check_scaled_image(ibuf, ima, buffer, x, y, w, h)) { + MEM_freeN(buffer); + glPixelStorei(GL_UNPACK_ROW_LENGTH, row_length); + glPixelStorei(GL_UNPACK_SKIP_PIXELS, skip_pixels); + glPixelStorei(GL_UNPACK_SKIP_ROWS, skip_rows); + BKE_image_release_ibuf(ima, ibuf, NULL); + return; + } + glBindTexture(GL_TEXTURE_2D, ima->bindcode); glTexSubImage2D(GL_TEXTURE_2D, 0, x, y, w, h, GL_RGBA, GL_FLOAT, buffer); @@ -977,7 +1057,15 @@ void GPU_paint_update_image(Image *ima, int x, int y, int w, int h) BKE_image_release_ibuf(ima, ibuf, NULL); return; } - + + if (GPU_check_scaled_image(ibuf, ima, NULL, x, y, w, h)) { + glPixelStorei(GL_UNPACK_ROW_LENGTH, row_length); + glPixelStorei(GL_UNPACK_SKIP_PIXELS, skip_pixels); + glPixelStorei(GL_UNPACK_SKIP_ROWS, skip_rows); + BKE_image_release_ibuf(ima, ibuf, NULL); + return; + } + glBindTexture(GL_TEXTURE_2D, ima->bindcode); glPixelStorei(GL_UNPACK_ROW_LENGTH, ibuf->x); From 6268434eee6e7a7b3728a38614566f9a9e27673a Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Tue, 25 Jun 2013 13:39:51 +0000 Subject: [PATCH 53/72] Fix part of #35859: lib linking errors were not shown when opening files through open recent. --- source/blender/windowmanager/intern/wm_event_system.c | 2 +- source/blender/windowmanager/intern/wm_operators.c | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index 0bef59cfc55..d94cfaa5aee 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -1661,7 +1661,7 @@ static int wm_handler_fileselect_call(bContext *C, ListBase *handlers, wmEventHa if (win_prev == NULL) CTX_wm_window_set(C, CTX_wm_manager(C)->windows.first); - handler->op->reports->printlevel = RPT_WARNING; + BKE_report_print_level_set(handler->op->reports, RPT_WARNING); uiPupMenuReports(C, handler->op->reports); /* XXX - copied from 'wm_operator_finished()' */ diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index e71be6052d0..d782725bdcb 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -2045,6 +2045,9 @@ static int wm_open_mainfile_exec(bContext *C, wmOperator *op) } WM_file_read(C, path, op->reports); + /* for file open also popup for warnings, not only errors */ + BKE_report_print_level_set(op->reports, RPT_WARNING); + return OPERATOR_FINISHED; } From 689ca4aef7228f910065d45e0648e802c17ab7c2 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 25 Jun 2013 14:31:52 +0000 Subject: [PATCH 54/72] correct assertion error (clear dirty normal flag when there are no vertices) --- source/blender/blenkernel/intern/cdderivedmesh.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/source/blender/blenkernel/intern/cdderivedmesh.c b/source/blender/blenkernel/intern/cdderivedmesh.c index 73c722a4849..7f6dc680a74 100644 --- a/source/blender/blenkernel/intern/cdderivedmesh.c +++ b/source/blender/blenkernel/intern/cdderivedmesh.c @@ -2232,7 +2232,10 @@ void CDDM_calc_normals_mapping_ex(DerivedMesh *dm, const short only_face_normals CDDerivedMesh *cddm = (CDDerivedMesh *)dm; float (*face_nors)[3] = NULL; - if (dm->numVertData == 0) return; + if (dm->numVertData == 0) { + cddm->dm.dirty &= ~DM_DIRTY_NORMALS; + return; + } /* now we skip calculating vertex normals for referenced layer, * no need to duplicate verts. From 40d4dfaba84fe0d5048cc847d5d249a35314b8ed Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Tue, 25 Jun 2013 14:48:30 +0000 Subject: [PATCH 55/72] Fix #35824: finding missing files not working correct for filepaths with special characters on Windows. Replaced some uses of stat() by BLI_stat() to properly handle such filepaths. --- source/blender/blenkernel/intern/bpath.c | 2 +- source/blender/blenkernel/intern/packedFile.c | 2 +- source/blender/blenlib/intern/fileops.c | 2 +- source/blender/editors/space_file/filesel.c | 2 +- source/blender/editors/space_text/text_ops.c | 6 +++--- source/blender/imbuf/intern/thumbs.c | 4 ++-- source/blender/imbuf/intern/util.c | 2 +- 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/source/blender/blenkernel/intern/bpath.c b/source/blender/blenkernel/intern/bpath.c index 6a51dadd28e..6699cbcff2d 100644 --- a/source/blender/blenkernel/intern/bpath.c +++ b/source/blender/blenkernel/intern/bpath.c @@ -235,7 +235,7 @@ static int findFileRecursive(char *filename_new, BLI_join_dirfile(path, sizeof(path), dirname, de->d_name); - if (stat(path, &status) != 0) + if (BLI_stat(path, &status) != 0) continue; /* cant stat, don't bother with this file, could print debug info here */ if (S_ISREG(status.st_mode)) { /* is file */ diff --git a/source/blender/blenkernel/intern/packedFile.c b/source/blender/blenkernel/intern/packedFile.c index af67ada7765..f97429d7e65 100644 --- a/source/blender/blenkernel/intern/packedFile.c +++ b/source/blender/blenkernel/intern/packedFile.c @@ -378,7 +378,7 @@ int checkPackedFile(const char *filename, PackedFile *pf) BLI_strncpy(name, filename, sizeof(name)); BLI_path_abs(name, G.main->name); - if (stat(name, &st)) { + if (BLI_stat(name, &st)) { ret_val = PF_NOFILE; } else if (st.st_size != pf->size) { diff --git a/source/blender/blenlib/intern/fileops.c b/source/blender/blenlib/intern/fileops.c index d4a8b800f17..26fe0f21cd5 100644 --- a/source/blender/blenlib/intern/fileops.c +++ b/source/blender/blenlib/intern/fileops.c @@ -251,7 +251,7 @@ void *BLI_gzopen(const char *filename, const char *mode) fclose(ufopen(filename, "a")); /* temporary #if until we update all libraries to 1.2.7 - * for correct wide char path handling */ + * for correct wide char path handling */ #if ZLIB_VERNUM >= 0x1270 && !defined(FREE_WINDOWS) UTF16_ENCODE(filename); diff --git a/source/blender/editors/space_file/filesel.c b/source/blender/editors/space_file/filesel.c index a31af851575..85e4d255603 100644 --- a/source/blender/editors/space_file/filesel.c +++ b/source/blender/editors/space_file/filesel.c @@ -667,7 +667,7 @@ bool autocomplete_directory(struct bContext *C, char *str, void *UNUSED(arg_v)) BLI_join_dirfile(path, sizeof(path), dirname, de->d_name); - if (stat(path, &status) == 0) { + if (BLI_stat(path, &status) == 0) { if (S_ISDIR(status.st_mode)) { /* is subdir */ autocomplete_do_name(autocpl, path); } diff --git a/source/blender/editors/space_text/text_ops.c b/source/blender/editors/space_text/text_ops.c index ca6bab1d1da..dec61a0e1ca 100644 --- a/source/blender/editors/space_text/text_ops.c +++ b/source/blender/editors/space_text/text_ops.c @@ -486,7 +486,7 @@ static void txt_write_file(Text *text, ReportList *reports) fclose(fp); - if (stat(filepath, &st) == 0) { + if (BLI_stat(filepath, &st) == 0) { text->mtime = st.st_mtime; } else { @@ -3107,7 +3107,7 @@ int text_file_modified(Text *text) if (!BLI_exists(file)) return 2; - result = stat(file, &st); + result = BLI_stat(file, &st); if (result == -1) return -1; @@ -3134,7 +3134,7 @@ static void text_ignore_modified(Text *text) if (!BLI_exists(file)) return; - result = stat(file, &st); + result = BLI_stat(file, &st); if (result == -1 || (st.st_mode & S_IFMT) != S_IFREG) return; diff --git a/source/blender/imbuf/intern/thumbs.c b/source/blender/imbuf/intern/thumbs.c index 44358d8147e..59b78109aaf 100644 --- a/source/blender/imbuf/intern/thumbs.c +++ b/source/blender/imbuf/intern/thumbs.c @@ -319,7 +319,7 @@ ImBuf *IMB_thumb_create(const char *path, ThumbSize size, ThumbSource source, Im } if (img != NULL) { - stat(path, &info); + BLI_stat(path, &info); BLI_snprintf(mtime, sizeof(mtime), "%ld", (long int)info.st_mtime); BLI_snprintf(cwidth, sizeof(cwidth), "%d", img->x); BLI_snprintf(cheight, sizeof(cheight), "%d", img->y); @@ -339,7 +339,7 @@ ImBuf *IMB_thumb_create(const char *path, ThumbSize size, ThumbSource source, Im } IMB_free_anim(anim); } - stat(path, &info); + BLI_stat(path, &info); BLI_snprintf(mtime, sizeof(mtime), "%ld", (long int)info.st_mtime); } if (!img) return NULL; diff --git a/source/blender/imbuf/intern/util.c b/source/blender/imbuf/intern/util.c index fa1316f631f..234d80bf782 100644 --- a/source/blender/imbuf/intern/util.c +++ b/source/blender/imbuf/intern/util.c @@ -164,7 +164,7 @@ static int IMB_ispic_name(const char *name) if (UTIL_DEBUG) printf("IMB_ispic_name: loading %s\n", name); - if (stat(name, &st) == -1) + if (BLI_stat(name, &st) == -1) return FALSE; if (((st.st_mode) & S_IFMT) != S_IFREG) return FALSE; From daa54f0f5cbbacf519d6ce354a2ae5c289b6f056 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Tue, 25 Jun 2013 14:57:45 +0000 Subject: [PATCH 56/72] Fix #35846: crash rendering with dupligroups visible in 3D viewport during render in some cases. The dupli code would still do object updates during render indirectly, while this is disabled for thread safety everywhere else, now we disable it for this case as well. Not a pretty solution but this is for the depgraph refactor to solve. --- source/blender/blenkernel/intern/anim.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/source/blender/blenkernel/intern/anim.c b/source/blender/blenkernel/intern/anim.c index 35510fe64d5..9fea3d2e13f 100644 --- a/source/blender/blenkernel/intern/anim.c +++ b/source/blender/blenkernel/intern/anim.c @@ -1724,8 +1724,11 @@ ListBase *object_duplilist_ex(Scene *sce, Object *ob, bool update, bool for_rend int persistent_id[MAX_DUPLI_RECUR] = {0}; int flag = 0; - if (update) flag |= DUPLILIST_DO_UPDATE; - if (for_render) flag |= DUPLILIST_FOR_RENDER; + /* don't allow BKE_object_handle_update for viewport during render, can crash */ + if (update && !(G.is_rendering && !for_render)) + flag |= DUPLILIST_DO_UPDATE; + if (for_render) + flag |= DUPLILIST_FOR_RENDER; duplilist->first = duplilist->last = NULL; object_duplilist_recursive((ID *)sce, sce, ob, duplilist, NULL, persistent_id, 0, 0, flag); From 8574808b2d60305439bc2af9e3a6be6f34cd5375 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Tue, 25 Jun 2013 16:38:40 +0000 Subject: [PATCH 57/72] Fix #35546: clicking cycles "Use Nodes" did not do a proper undo push, due to button disappearing as soon as it's clicked. Workaround now is to make this an operator. Thanks to Lukas and Campbell for tracking this down. --- intern/cycles/blender/addon/ui.py | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/intern/cycles/blender/addon/ui.py b/intern/cycles/blender/addon/ui.py index dc632b9bb2c..e9ef771a6fb 100644 --- a/intern/cycles/blender/addon/ui.py +++ b/intern/cycles/blender/addon/ui.py @@ -20,7 +20,7 @@ import bpy -from bpy.types import Panel, Menu +from bpy.types import Panel, Menu, Operator class CYCLES_MT_integrator_presets(Menu): @@ -547,6 +547,26 @@ class CyclesObject_PT_ray_visibility(CyclesButtonsPanel, Panel): flow.prop(visibility, "shadow") +class CYCLES_OT_use_shading_nodes(Operator): + """Enable nodes on a material, world or lamp""" + bl_idname = "cycles.use_shading_nodes" + bl_label = "Use Nodes" + + @classmethod + def poll(cls, context): + return context.material or context.world or context.lamp + + def execute(self, context): + if context.material: + context.material.use_nodes = True + elif context.world: + context.world.use_nodes = True + elif context.lamp: + context.lamp.use_nodes = True + + return {'FINISHED'} + + def find_node(material, nodetype): if material and material.node_tree: ntree = material.node_tree @@ -568,7 +588,7 @@ def find_node_input(node, name): def panel_node_draw(layout, id_data, output_type, input_name): if not id_data.use_nodes: - layout.prop(id_data, "use_nodes", icon='NODETREE') + layout.operator("cycles.use_shading_nodes", icon='NODETREE') return False ntree = id_data.node_tree From 8245bdca2b89b9af3ca42399a7e83dae76653040 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 25 Jun 2013 20:52:33 +0000 Subject: [PATCH 58/72] quiet double promotion warning and some style cleanup --- source/blender/gpu/intern/gpu_draw.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/source/blender/gpu/intern/gpu_draw.c b/source/blender/gpu/intern/gpu_draw.c index fc28ec2d6f7..cfdbf87785e 100644 --- a/source/blender/gpu/intern/gpu_draw.c +++ b/source/blender/gpu/intern/gpu_draw.c @@ -937,13 +937,13 @@ void GPU_paint_set_mipmap(int mipmap) static bool GPU_check_scaled_image(ImBuf *ibuf, Image *ima, float *frect, int x, int y, int w, int h) { if ((!GPU_non_power_of_two_support() && !is_power_of_2_resolution(ibuf->x, ibuf->y)) || - is_over_resolution_limit(ibuf->x, ibuf->y)) + is_over_resolution_limit(ibuf->x, ibuf->y)) { int x_limit = smaller_power_of_2_limit(ibuf->x); int y_limit = smaller_power_of_2_limit(ibuf->y); - float xratio = x_limit/(float)ibuf->x; - float yratio = y_limit/(float)ibuf->y; + float xratio = x_limit / (float)ibuf->x; + float yratio = y_limit / (float)ibuf->y; /* find new width, height and x,y gpu texture coordinates */ @@ -965,27 +965,27 @@ static bool GPU_check_scaled_image(ImBuf *ibuf, Image *ima, float *frect, int x, glBindTexture(GL_TEXTURE_2D, ima->bindcode); glTexSubImage2D(GL_TEXTURE_2D, 0, x, y, rectw, recth, GL_RGBA, - GL_FLOAT, fscalerect); + GL_FLOAT, fscalerect); MEM_freeN(fscalerect); } /* byte images are not continuous in memory so do manual interpolation */ else { - unsigned char *scalerect= MEM_mallocN(rectw*recth*sizeof(*scalerect)*4, "scalerect"); + unsigned char *scalerect = MEM_mallocN(rectw * recth * sizeof(*scalerect) * 4, "scalerect"); unsigned int *p = (unsigned int *)scalerect; int i, j; - float inv_xratio = 1.0/xratio; - float inv_yratio = 1.0/yratio; + float inv_xratio = 1.0f / xratio; + float inv_yratio = 1.0f / yratio; for (i = 0; i < rectw; i++) { - float u = (x + i)*inv_xratio; + float u = (x + i) * inv_xratio; for (j = 0; j < recth; j++) { - float v = (y + j)*inv_yratio; + float v = (y + j) * inv_yratio; bilinear_interpolation_color_wrap(ibuf, (unsigned char *)(p + i + j * (rectw)), NULL, u, v); } } glBindTexture(GL_TEXTURE_2D, ima->bindcode); glTexSubImage2D(GL_TEXTURE_2D, 0, x, y, rectw, recth, GL_RGBA, - GL_UNSIGNED_BYTE, scalerect); + GL_UNSIGNED_BYTE, scalerect); MEM_freeN(scalerect); } From eacd013cb40d23964a1cab08279c9feffa54997b Mon Sep 17 00:00:00 2001 From: Gaia Clary Date: Tue, 25 Jun 2013 21:00:00 +0000 Subject: [PATCH 59/72] disable vertex editing when weight group is locked --- source/blender/editors/space_view3d/view3d_buttons.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/source/blender/editors/space_view3d/view3d_buttons.c b/source/blender/editors/space_view3d/view3d_buttons.c index c3686c601d8..d234b176dcf 100644 --- a/source/blender/editors/space_view3d/view3d_buttons.c +++ b/source/blender/editors/space_view3d/view3d_buttons.c @@ -877,6 +877,9 @@ static void view3d_panel_vgroup(const bContext *C, Panel *pa) xco, yco, (x = UI_UNIT_X * 4), UI_UNIT_Y, &dw->weight, 0.0, 1.0, 1, 3, ""); uiButSetFlag(but, UI_TEXT_LEFT); + if (dg->flag & DG_LOCK_WEIGHT) { + uiButSetFlag(but, UI_BUT_DISABLED); + } xco += x; /* The weight group paste function */ From 06b82088fab1febff4c0b74d6593b05ab486997f Mon Sep 17 00:00:00 2001 From: Gaia Clary Date: Tue, 25 Jun 2013 22:19:48 +0000 Subject: [PATCH 60/72] disable normalize when active vertex contains locked weights --- source/blender/editors/space_view3d/view3d_buttons.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/source/blender/editors/space_view3d/view3d_buttons.c b/source/blender/editors/space_view3d/view3d_buttons.c index d234b176dcf..d2fb5886171 100644 --- a/source/blender/editors/space_view3d/view3d_buttons.c +++ b/source/blender/editors/space_view3d/view3d_buttons.c @@ -839,6 +839,7 @@ static void view3d_panel_vgroup(const bContext *C, Panel *pa) const bool *vgroup_validmap; eVGroupSelect subset_type = ts->vgroupsubset; int yco = 0; + int locked = 0; uiBlockSetHandleFunc(block, do_view3d_vgroup_buttons, NULL); @@ -879,6 +880,7 @@ static void view3d_panel_vgroup(const bContext *C, Panel *pa) uiButSetFlag(but, UI_TEXT_LEFT); if (dg->flag & DG_LOCK_WEIGHT) { uiButSetFlag(but, UI_BUT_DISABLED); + locked++; } xco += x; @@ -911,7 +913,10 @@ static void view3d_panel_vgroup(const bContext *C, Panel *pa) ot = WM_operatortype_find("OBJECT_OT_vertex_weight_normalize_active", 1); but = uiDefButO_ptr(block, BUT, ot, WM_OP_EXEC_DEFAULT, "Normalize", 0, yco, UI_UNIT_X * 5, UI_UNIT_Y, - TIP_("Normalize active vertex weights")); + TIP_("Normalize weights of active vertex (if affected groups are unlocked")); + if(locked) { + uiButSetFlag(but, UI_BUT_DISABLED); + } ot = WM_operatortype_find("OBJECT_OT_vertex_weight_copy", 1); but = uiDefButO_ptr(block, BUT, ot, WM_OP_EXEC_DEFAULT, "Copy", From b52d01dea60361e30d046d198e34ee99db3feea8 Mon Sep 17 00:00:00 2001 From: Gaia Clary Date: Tue, 25 Jun 2013 22:28:20 +0000 Subject: [PATCH 61/72] Rename operator for better clarity --- source/blender/editors/object/object_intern.h | 2 +- source/blender/editors/object/object_ops.c | 2 +- source/blender/editors/object/object_vgroup.c | 8 ++++---- source/blender/editors/space_view3d/view3d_buttons.c | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/source/blender/editors/object/object_intern.h b/source/blender/editors/object/object_intern.h index 485987fd8fe..b3ce9320852 100644 --- a/source/blender/editors/object/object_intern.h +++ b/source/blender/editors/object/object_intern.h @@ -226,7 +226,7 @@ void OBJECT_OT_vertex_group_move(struct wmOperatorType *ot); void OBJECT_OT_vertex_weight_paste(struct wmOperatorType *ot); void OBJECT_OT_vertex_weight_delete(struct wmOperatorType *ot); void OBJECT_OT_vertex_weight_set_active(struct wmOperatorType *ot); -void OBJECT_OT_vertex_weight_normalize_active(struct wmOperatorType *ot); +void OBJECT_OT_vertex_weight_normalize_active_vertex(struct wmOperatorType *ot); void OBJECT_OT_vertex_weight_copy(struct wmOperatorType *ot); /* object_shapekey.c */ diff --git a/source/blender/editors/object/object_ops.c b/source/blender/editors/object/object_ops.c index 3afb04c34f6..356bda109a4 100644 --- a/source/blender/editors/object/object_ops.c +++ b/source/blender/editors/object/object_ops.c @@ -198,7 +198,7 @@ void ED_operatortypes_object(void) WM_operatortype_append(OBJECT_OT_vertex_weight_paste); WM_operatortype_append(OBJECT_OT_vertex_weight_delete); WM_operatortype_append(OBJECT_OT_vertex_weight_set_active); - WM_operatortype_append(OBJECT_OT_vertex_weight_normalize_active); + WM_operatortype_append(OBJECT_OT_vertex_weight_normalize_active_vertex); WM_operatortype_append(OBJECT_OT_vertex_weight_copy); WM_operatortype_append(OBJECT_OT_game_property_new); diff --git a/source/blender/editors/object/object_vgroup.c b/source/blender/editors/object/object_vgroup.c index 91a23eab2b3..7144ef07e74 100644 --- a/source/blender/editors/object/object_vgroup.c +++ b/source/blender/editors/object/object_vgroup.c @@ -4199,7 +4199,7 @@ void OBJECT_OT_vertex_weight_set_active(wmOperatorType *ot) ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; } -static int vertex_weight_normalize_active(bContext *C, wmOperator *UNUSED(op)) +static int vertex_weight_normalize_active_vertex(bContext *C, wmOperator *UNUSED(op)) { Object *ob = ED_object_context(C); ToolSettings *ts = CTX_data_tool_settings(C); @@ -4213,16 +4213,16 @@ static int vertex_weight_normalize_active(bContext *C, wmOperator *UNUSED(op)) return OPERATOR_FINISHED; } -void OBJECT_OT_vertex_weight_normalize_active(wmOperatorType *ot) +void OBJECT_OT_vertex_weight_normalize_active_vertex(wmOperatorType *ot) { ot->name = "Normalize Active"; - ot->idname = "OBJECT_OT_vertex_weight_normalize_active"; + ot->idname = "OBJECT_OT_vertex_weight_normalize_active_vertex"; ot->description = "Normalize Active Vert Weights"; /* api callbacks */ ot->poll = vertex_group_poll; - ot->exec = vertex_weight_normalize_active; + ot->exec = vertex_weight_normalize_active_vertex; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; diff --git a/source/blender/editors/space_view3d/view3d_buttons.c b/source/blender/editors/space_view3d/view3d_buttons.c index d2fb5886171..57088bcc315 100644 --- a/source/blender/editors/space_view3d/view3d_buttons.c +++ b/source/blender/editors/space_view3d/view3d_buttons.c @@ -910,7 +910,7 @@ static void view3d_panel_vgroup(const bContext *C, Panel *pa) col = uiLayoutColumn(pa->layout, true); row = uiLayoutRow(col, true); - ot = WM_operatortype_find("OBJECT_OT_vertex_weight_normalize_active", 1); + ot = WM_operatortype_find("OBJECT_OT_vertex_weight_normalize_active_vertex", 1); but = uiDefButO_ptr(block, BUT, ot, WM_OP_EXEC_DEFAULT, "Normalize", 0, yco, UI_UNIT_X * 5, UI_UNIT_Y, TIP_("Normalize weights of active vertex (if affected groups are unlocked")); From fad1da062d9e37b44c45b9c205c24f960aaaba62 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 25 Jun 2013 22:58:23 +0000 Subject: [PATCH 62/72] correct typos in comments. --- source/blender/blenlib/intern/graph.c | 2 +- source/blender/blenlib/intern/math_color_inline.c | 2 +- source/blender/blenlib/intern/math_geom.c | 2 +- source/blender/bmesh/intern/bmesh_edgeloop.c | 4 ++-- source/blender/bmesh/intern/bmesh_iterators.h | 2 +- source/blender/bmesh/intern/bmesh_walkers.c | 2 +- source/blender/bmesh/operators/bmo_beautify.c | 4 ++-- source/blender/bmesh/operators/bmo_bridge.c | 2 +- source/blender/bmesh/operators/bmo_dupe.c | 2 +- source/blender/bmesh/operators/bmo_poke.c | 2 +- source/blender/bmesh/tools/bmesh_bevel.c | 4 ++-- source/blender/bmesh/tools/bmesh_decimate_collapse.c | 4 ++-- source/blender/bmesh/tools/bmesh_decimate_unsubdivide.c | 2 +- source/blender/editors/object/object_add.c | 2 +- source/blender/editors/space_view3d/view3d_fly.c | 2 +- source/blender/freestyle/intern/view_map/SteerableViewMap.h | 2 +- source/blender/windowmanager/intern/wm_init_exit.c | 2 +- source/gameengine/Ketsji/KX_Dome.cpp | 2 +- .../Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.h | 2 +- 19 files changed, 23 insertions(+), 23 deletions(-) diff --git a/source/blender/blenlib/intern/graph.c b/source/blender/blenlib/intern/graph.c index cedec7d07b6..24497f8fb06 100644 --- a/source/blender/blenlib/intern/graph.c +++ b/source/blender/blenlib/intern/graph.c @@ -598,7 +598,7 @@ static void handleRadialSymmetry(BGraph *graph, BNode *root_node, int depth, flo /* sort ring by arc length * using a rather bogus insertion sort - * butrings will never get too big to matter + * but rings will never get too big to matter * */ for (i = 0; i < total; i++) { int j; diff --git a/source/blender/blenlib/intern/math_color_inline.c b/source/blender/blenlib/intern/math_color_inline.c index bef4e5adaaa..4af1307c521 100644 --- a/source/blender/blenlib/intern/math_color_inline.c +++ b/source/blender/blenlib/intern/math_color_inline.c @@ -78,7 +78,7 @@ MINLINE void linearrgb_to_srgb_uchar4(unsigned char srgb[4], const float linear[ F4TOCHAR4(srgb_f, srgb); } -/* predivide versions to work on associated/pre-multipled alpha. if this should +/* predivide versions to work on associated/pre-multiplied alpha. if this should * be done or not depends on the background the image will be composited over, * ideally you would never do color space conversion on an image with alpha * because it is ill defined */ diff --git a/source/blender/blenlib/intern/math_geom.c b/source/blender/blenlib/intern/math_geom.c index a4e7424e5dd..ddf1c598a1c 100644 --- a/source/blender/blenlib/intern/math_geom.c +++ b/source/blender/blenlib/intern/math_geom.c @@ -3621,7 +3621,7 @@ static float ff_quad_form_factor(float *p, float *n, float *q0, float *q1, float static __m128 sse_approx_acos(__m128 x) { /* needs a better approximation than taylor expansion of acos, since that - * gives big erros for near 1.0 values, sqrt(2 * x) * acos(1 - x) should work + * gives big errors for near 1.0 values, sqrt(2 * x) * acos(1 - x) should work * better, see http://www.tom.womack.net/projects/sse-fast-arctrig.html */ return _mm_set_ps1(1.0f); diff --git a/source/blender/bmesh/intern/bmesh_edgeloop.c b/source/blender/bmesh/intern/bmesh_edgeloop.c index dc3a223ae5d..8b5b95c5cae 100644 --- a/source/blender/bmesh/intern/bmesh_edgeloop.c +++ b/source/blender/bmesh/intern/bmesh_edgeloop.c @@ -520,7 +520,7 @@ const float *BM_edgeloop_center_get(struct BMEdgeLoopStore *el_store) #define NODE_AS_CO(n) ((BMVert *)((LinkData *)n)->data)->co /** - * edges are assined to one vert -> the next. + * edges are assigned to one vert -> the next. */ void BM_edgeloop_edges_get(struct BMEdgeLoopStore *el_store, BMEdge **e_arr) { @@ -612,7 +612,7 @@ bool BM_edgeloop_calc_normal(BMesh *UNUSED(bm), BMEdgeLoopStore *el_store) } /** - * For open loops that are stright lines, + * For open loops that are straight lines, * calculating the normal as if it were a polygon is meaningless. * * Instead use an alignment vector and calculate the normal based on that. diff --git a/source/blender/bmesh/intern/bmesh_iterators.h b/source/blender/bmesh/intern/bmesh_iterators.h index e4d7a88dc83..b5535b59321 100644 --- a/source/blender/bmesh/intern/bmesh_iterators.h +++ b/source/blender/bmesh/intern/bmesh_iterators.h @@ -154,7 +154,7 @@ typedef void *(*BMIter__step_cb) (void *); /* Iterator Structure */ /* note: some of these vars are not used, - * so they have beem commented to save stack space since this struct is used all over */ + * so they have been commented to save stack space since this struct is used all over */ typedef struct BMIter { /* keep union first */ union { diff --git a/source/blender/bmesh/intern/bmesh_walkers.c b/source/blender/bmesh/intern/bmesh_walkers.c index 79e097a7a7c..04edec01a5c 100644 --- a/source/blender/bmesh/intern/bmesh_walkers.c +++ b/source/blender/bmesh/intern/bmesh_walkers.c @@ -40,7 +40,7 @@ * - joeedh - * design notes: * - * original desing: walkers directly emulation recursive functions. + * original design: walkers directly emulation recursive functions. * functions save their state onto a worklist, and also add new states * to implement recursive or looping behavior. generally only one * state push per call with a specific state is desired. diff --git a/source/blender/bmesh/operators/bmo_beautify.c b/source/blender/bmesh/operators/bmo_beautify.c index f1c400574f5..2c0bc7f95d9 100644 --- a/source/blender/bmesh/operators/bmo_beautify.c +++ b/source/blender/bmesh/operators/bmo_beautify.c @@ -23,10 +23,10 @@ /** \file blender/bmesh/operators/bmo_beautify.c * \ingroup bmesh * - * Beautify the mesh by rotating edes between triangles + * Beautify the mesh by rotating edges between triangles * to more attractive positions until no more rotations can be made. * - * In princible this is very simple however there is the possability of + * In principle this is very simple however there is the possibility of * going into an eternal loop where edges keep rotating. * To avoid this - each edge stores a hash of it previous * states so as not to rotate back. diff --git a/source/blender/bmesh/operators/bmo_bridge.c b/source/blender/bmesh/operators/bmo_bridge.c index 116fe46ee53..a517b7af502 100644 --- a/source/blender/bmesh/operators/bmo_bridge.c +++ b/source/blender/bmesh/operators/bmo_bridge.c @@ -363,7 +363,7 @@ static void bridge_loop_pair(BMesh *bm, int i; BMOperator op_sub; - /* when we have to bridge betweeen different sized edge-loops, + /* when we have to bridge between different sized edge-loops, * be clever and post-process for best results */ diff --git a/source/blender/bmesh/operators/bmo_dupe.c b/source/blender/bmesh/operators/bmo_dupe.c index 2d78a02f709..e41fbd69616 100644 --- a/source/blender/bmesh/operators/bmo_dupe.c +++ b/source/blender/bmesh/operators/bmo_dupe.c @@ -23,7 +23,7 @@ /** \file blender/bmesh/operators/bmo_dupe.c * \ingroup bmesh * - * Duplicate, Split, Spint operators. + * Duplicate, Split, Split operators. */ #include "MEM_guardedalloc.h" diff --git a/source/blender/bmesh/operators/bmo_poke.c b/source/blender/bmesh/operators/bmo_poke.c index 7105210da04..03084ebb1b6 100644 --- a/source/blender/bmesh/operators/bmo_poke.c +++ b/source/blender/bmesh/operators/bmo_poke.c @@ -73,7 +73,7 @@ void bmo_poke_exec(BMesh *bm, BMOperator *op) float f_center[3]; BMVert *v_center = NULL; BMLoop *l_iter, *l_first; - /* only interpolate the centeral loop from the face once, + /* only interpolate the central loop from the face once, * then copy to all others in the fan */ BMLoop *l_center_example; diff --git a/source/blender/bmesh/tools/bmesh_bevel.c b/source/blender/bmesh/tools/bmesh_bevel.c index 6b5e18ceb61..a2cbb0fe44c 100644 --- a/source/blender/bmesh/tools/bmesh_bevel.c +++ b/source/blender/bmesh/tools/bmesh_bevel.c @@ -223,7 +223,7 @@ static BevVert *find_bevvert(BevelParams *bp, BMVert *bmv) return BLI_ghash_lookup(bp->vert_hash, bmv); } -/* Return a good respresentative face (for materials, etc.) for faces +/* Return a good representative face (for materials, etc.) for faces * created around/near BoundVert v */ static BMFace *boundvert_rep_face(BoundVert *v) { @@ -531,7 +531,7 @@ static int bev_ccw_test(BMEdge *a, BMEdge *b, BMFace *f) * Also find vd, which is in direction normal to parallelogram and 1 unit away * from the origin. * The quarter circle in first quadrant of unit square will be mapped to the - * quadrant of a sheared ellipse in the parallelgram, using a matrix. + * quadrant of a sheared ellipse in the parallelogram, using a matrix. * The matrix mat is calculated to map: * (0,1,0) -> va * (1,1,0) -> vmid diff --git a/source/blender/bmesh/tools/bmesh_decimate_collapse.c b/source/blender/bmesh/tools/bmesh_decimate_collapse.c index f47abc8891c..d3ffc348539 100644 --- a/source/blender/bmesh/tools/bmesh_decimate_collapse.c +++ b/source/blender/bmesh/tools/bmesh_decimate_collapse.c @@ -116,7 +116,7 @@ static void bm_decim_build_quadrics(BMesh *bm, Quadric *vquadrics) static void bm_decim_calc_target_co(BMEdge *e, float optimize_co[3], const Quadric *vquadrics) { - /* compute an edge contration target for edge 'e' + /* compute an edge contraction target for edge 'e' * this is computed by summing it's vertices quadrics and * optimizing the result. */ Quadric q; @@ -682,7 +682,7 @@ static bool bm_edge_collapse_is_degenerate_topology(BMEdge *e_first) /** * special, highly limited edge collapse function - * intended for speed over flexibiliy. + * intended for speed over flexibility. * can only collapse edges connected to (1, 2) tris. * * Important - dont add vert/edge/face data on collapsing! diff --git a/source/blender/bmesh/tools/bmesh_decimate_unsubdivide.c b/source/blender/bmesh/tools/bmesh_decimate_unsubdivide.c index c48e83686b5..0667d560615 100644 --- a/source/blender/bmesh/tools/bmesh_decimate_unsubdivide.c +++ b/source/blender/bmesh/tools/bmesh_decimate_unsubdivide.c @@ -79,7 +79,7 @@ static bool bm_vert_dissolve_fan(BMesh *bm, BMVert *v) { /* collapse under 2 conditions. * - vert connects to 4 manifold edges (and 4 faces). - * - vert connecrs to 1 manifold edge, 2 boundary edges (and 2 faces). + * - vert connects to 1 manifold edge, 2 boundary edges (and 2 faces). * * This covers boundary verts of a quad grid and center verts. * note that surrounding faces dont have to be quads. diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c index 5ad6bd4993a..c7aec9f93d4 100644 --- a/source/blender/editors/object/object_add.c +++ b/source/blender/editors/object/object_add.c @@ -1762,7 +1762,7 @@ void OBJECT_OT_convert(wmOperatorType *ot) /* * dupflag: a flag made from constants declared in DNA_userdef_types.h - * The flag tells adduplicate() weather to copy data linked to the object, or to reference the existing data. + * The flag tells adduplicate() whether to copy data linked to the object, or to reference the existing data. * U.dupflag for default operations or you can construct a flag as python does * if the dupflag is 0 then no data will be copied (linked duplicate) */ diff --git a/source/blender/editors/space_view3d/view3d_fly.c b/source/blender/editors/space_view3d/view3d_fly.c index 6bab677fb61..659c9a6c2e6 100644 --- a/source/blender/editors/space_view3d/view3d_fly.c +++ b/source/blender/editors/space_view3d/view3d_fly.c @@ -345,7 +345,7 @@ static bool initFlyInfo(bContext *C, FlyInfo *fly, wmOperator *op, const wmEvent fly->rv3d->rflag |= RV3D_NAVIGATING; /* so we draw the corner margins */ - /* detect weather to start with Z locking */ + /* detect whether to start with Z locking */ upvec[0] = 1.0f; upvec[1] = 0.0f; upvec[2] = 0.0f; diff --git a/source/blender/freestyle/intern/view_map/SteerableViewMap.h b/source/blender/freestyle/intern/view_map/SteerableViewMap.h index 79321cafefe..9af65765fcd 100644 --- a/source/blender/freestyle/intern/view_map/SteerableViewMap.h +++ b/source/blender/freestyle/intern/view_map/SteerableViewMap.h @@ -99,7 +99,7 @@ public: * \param copy * If false, the data is not duplicated, and Canvas deals with the memory management of these * _nbOrientations+1 images. If true, data is copied, and it's up to the caller to delete the images. - * \params iNbLevels + * \param iNbLevels * The number of levels desired for each pyramid. * If iNbLevels == 0, the complete pyramid is built. * \param iSigma diff --git a/source/blender/windowmanager/intern/wm_init_exit.c b/source/blender/windowmanager/intern/wm_init_exit.c index 8115779a7c6..63cf1eeb40d 100644 --- a/source/blender/windowmanager/intern/wm_init_exit.c +++ b/source/blender/windowmanager/intern/wm_init_exit.c @@ -227,7 +227,7 @@ void WM_init(bContext *C, int argc, const char **argv) /* normally 'wm_homefile_read' will do this, * however python is not initialized when called from this function. * - * unlikey any handlers are set but its possible, + * unlikely any handlers are set but its possible, * note that recovering the last session does its own callbacks. */ BLI_callback_exec(CTX_data_main(C), NULL, BLI_CB_EVT_LOAD_POST); } diff --git a/source/gameengine/Ketsji/KX_Dome.cpp b/source/gameengine/Ketsji/KX_Dome.cpp index b96d25e04d9..aa082c7ef19 100644 --- a/source/gameengine/Ketsji/KX_Dome.cpp +++ b/source/gameengine/Ketsji/KX_Dome.cpp @@ -468,7 +468,7 @@ bool KX_Dome::ParseWarpMesh(STR_String text) * n3_x n3_y n3_u n3_v n3_i * (...) * First line is the image type the mesh is support to be applied to: 2 = fisheye, 1=radial - * Tthe next line has the mesh dimensions + * The next line has the mesh dimensions * Rest of the lines are the nodes of the mesh. Each line has x y u v i * (x,y) are the normalized screen coordinates * (u,v) texture coordinates diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.h b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.h index 04f27360c6b..c638c40d34b 100644 --- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.h +++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.h @@ -119,7 +119,7 @@ protected: RAS_IPolyMaterial::TCachingInfo m_materialCachingInfo; /** - * Making use of a Strategy desing pattern for storage behavior. + * Making use of a Strategy design pattern for storage behavior. * Examples of concrete strategies: Vertex Arrays, VBOs, Immediate Mode*/ int m_storage_type; RAS_IStorage* m_storage; From 47cfdc4494c285b59f131aab33bf628a5f37f480 Mon Sep 17 00:00:00 2001 From: Gaia Clary Date: Tue, 25 Jun 2013 22:58:45 +0000 Subject: [PATCH 63/72] Fixed operator call (due to renamed operator parameter) --- release/scripts/startup/bl_ui/space_view3d.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py index 74f9d36db0a..3dedfac103a 100644 --- a/release/scripts/startup/bl_ui/space_view3d.py +++ b/release/scripts/startup/bl_ui/space_view3d.py @@ -1317,8 +1317,8 @@ class VIEW3D_MT_vertex_group(Menu): if ob.vertex_groups.active: layout.separator() layout.operator("object.vertex_group_assign", text="Assign to Active Group").new = False - layout.operator("object.vertex_group_remove_from", text="Remove from Active Group").all = False - layout.operator("object.vertex_group_remove_from", text="Remove from All").all = True + layout.operator("object.vertex_group_remove_from", text="Remove from Active Group").use_all_groups = False + layout.operator("object.vertex_group_remove_from", text="Remove from All").use_all_groups = True layout.separator() if ob.vertex_groups.active: From a7858767f46d25d8b7d95b37a3e66aaf552d67c8 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 26 Jun 2013 02:47:56 +0000 Subject: [PATCH 64/72] fix [#35858] Weight Paint: Hiding faces isnt flushing the flag to the vertices. --- source/blender/blenkernel/BKE_mesh.h | 20 ++++-- source/blender/blenkernel/intern/mesh.c | 63 ++++++++++++++++--- source/blender/editors/mesh/editface.c | 18 ++++-- .../blender/editors/sculpt_paint/paint_hide.c | 4 +- .../blender/modifiers/intern/MOD_multires.c | 12 ++-- 5 files changed, 88 insertions(+), 29 deletions(-) diff --git a/source/blender/blenkernel/BKE_mesh.h b/source/blender/blenkernel/BKE_mesh.h index 339d13b06b2..7481a403dc8 100644 --- a/source/blender/blenkernel/BKE_mesh.h +++ b/source/blender/blenkernel/BKE_mesh.h @@ -138,18 +138,26 @@ int BKE_mesh_edge_other_vert(const struct MEdge *e, int v); /* update the hide flag for edges and polys from the corresponding * flag in verts */ -void BKE_mesh_flush_hidden_from_verts(const struct MVert *mvert, - const struct MLoop *mloop, - struct MEdge *medge, int totedge, - struct MPoly *mpoly, int totpoly); +void BKE_mesh_flush_hidden_from_verts_ex(const struct MVert *mvert, + const struct MLoop *mloop, + struct MEdge *medge, const int totedge, + struct MPoly *mpoly, const int totpoly); +void BKE_mesh_flush_hidden_from_verts(struct Mesh *me); + +void BKE_mesh_flush_hidden_from_polys_ex(struct MVert *mvert, + const struct MLoop *mloop, + struct MEdge *medge, int totedge, + const struct MPoly *mpoly, const int totpoly); +void BKE_mesh_flush_hidden_from_polys(struct Mesh *me); + void BKE_mesh_flush_select_from_polys_ex(struct MVert *mvert, const int totvert, - struct MLoop *mloop, + const struct MLoop *mloop, struct MEdge *medge, const int totedge, const struct MPoly *mpoly, const int totpoly); void BKE_mesh_flush_select_from_polys(struct Mesh *me); void BKE_mesh_flush_select_from_verts_ex(const struct MVert *mvert, const int totvert, - struct MLoop *mloop, + const struct MLoop *mloop, struct MEdge *medge, const int totedge, struct MPoly *mpoly, const int totpoly); void BKE_mesh_flush_select_from_verts(struct Mesh *me); diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c index 2b59aa4a8bb..8c6c5d9fd83 100644 --- a/source/blender/blenkernel/intern/mesh.c +++ b/source/blender/blenkernel/intern/mesh.c @@ -3437,10 +3437,10 @@ int BKE_mesh_edge_other_vert(const MEdge *e, int v) /* update the hide flag for edges and faces from the corresponding * flag in verts */ -void BKE_mesh_flush_hidden_from_verts(const MVert *mvert, - const MLoop *mloop, - MEdge *medge, int totedge, - MPoly *mpoly, int totpoly) +void BKE_mesh_flush_hidden_from_verts_ex(const MVert *mvert, + const MLoop *mloop, + MEdge *medge, const int totedge, + MPoly *mpoly, const int totpoly) { int i, j; @@ -3464,12 +3464,59 @@ void BKE_mesh_flush_hidden_from_verts(const MVert *mvert, } } } +void BKE_mesh_flush_hidden_from_verts(Mesh *me) +{ + BKE_mesh_flush_hidden_from_verts_ex(me->mvert, me->mloop, + me->medge, me->totedge, + me->mpoly, me->totpoly); +} + +void BKE_mesh_flush_hidden_from_polys_ex(MVert *mvert, + const MLoop *mloop, + MEdge *medge, const int UNUSED(totedge), + const MPoly *mpoly, const int totpoly) +{ + const MPoly *mp; + int i; + + i = totpoly; + for (mp = mpoly; i--; mp++) { + if (mp->flag & ME_HIDE) { + const MLoop *ml; + int j; + j = mp->totloop; + for (ml = &mloop[mp->loopstart]; j--; ml++) { + mvert[ml->v].flag |= ME_HIDE; + medge[ml->e].flag |= ME_HIDE; + } + } + } + + i = totpoly; + for (mp = mpoly; i--; mp++) { + if ((mp->flag & ME_HIDE) == 0) { + const MLoop *ml; + int j; + j = mp->totloop; + for (ml = &mloop[mp->loopstart]; j--; ml++) { + mvert[ml->v].flag &= ~ME_HIDE; + medge[ml->e].flag &= ~ME_HIDE; + } + } + } +} +void BKE_mesh_flush_hidden_from_polys(Mesh *me) +{ + BKE_mesh_flush_hidden_from_polys_ex(me->mvert, me->mloop, + me->medge, me->totedge, + me->mpoly, me->totpoly); +} /** * simple poly -> vert/edge selection. */ void BKE_mesh_flush_select_from_polys_ex(MVert *mvert, const int totvert, - MLoop *mloop, + const MLoop *mloop, MEdge *medge, const int totedge, const MPoly *mpoly, const int totpoly) { @@ -3493,7 +3540,7 @@ void BKE_mesh_flush_select_from_polys_ex(MVert *mvert, const int totvert, /* assume if its selected its not hidden and none of its verts/edges are hidden * (a common assumption)*/ if (mp->flag & ME_FACE_SEL) { - MLoop *ml; + const MLoop *ml; int j; j = mp->totloop; for (ml = &mloop[mp->loopstart]; j--; ml++) { @@ -3512,7 +3559,7 @@ void BKE_mesh_flush_select_from_polys(Mesh *me) } void BKE_mesh_flush_select_from_verts_ex(const MVert *mvert, const int UNUSED(totvert), - MLoop *mloop, + const MLoop *mloop, MEdge *medge, const int totedge, MPoly *mpoly, const int totpoly) { @@ -3538,7 +3585,7 @@ void BKE_mesh_flush_select_from_verts_ex(const MVert *mvert, const int UNUSED(to for (mp = mpoly; i--; mp++) { if ((mp->flag & ME_HIDE) == 0) { int ok = TRUE; - MLoop *ml; + const MLoop *ml; int j; j = mp->totloop; for (ml = &mloop[mp->loopstart]; j--; ml++) { diff --git a/source/blender/editors/mesh/editface.c b/source/blender/editors/mesh/editface.c index e194f990739..82d958a5c7b 100644 --- a/source/blender/editors/mesh/editface.c +++ b/source/blender/editors/mesh/editface.c @@ -74,6 +74,8 @@ void paintface_flush_flags(Object *ob) if (me == NULL) return; + /* note, call #BKE_mesh_flush_hidden_from_verts_ex first when changing hidden flags */ + /* we could call this directly in all areas that change selection, * since this could become slow for realtime updates (circle-select for eg) */ BKE_mesh_flush_select_from_polys(me); @@ -139,18 +141,20 @@ void paintface_hide(Object *ob, const bool unselected) a = me->totpoly; while (a--) { if ((mpoly->flag & ME_HIDE) == 0) { - if (unselected) { - if ((mpoly->flag & ME_FACE_SEL) == 0) mpoly->flag |= ME_HIDE; - } - else { - if ((mpoly->flag & ME_FACE_SEL)) mpoly->flag |= ME_HIDE; + if (((mpoly->flag & ME_FACE_SEL) == 0) == unselected) { + mpoly->flag |= ME_HIDE; } } - if (mpoly->flag & ME_HIDE) mpoly->flag &= ~ME_FACE_SEL; + + if (mpoly->flag & ME_HIDE) { + mpoly->flag &= ~ME_FACE_SEL; + } mpoly++; } + BKE_mesh_flush_hidden_from_polys(me); + paintface_flush_flags(ob); } @@ -174,6 +178,8 @@ void paintface_reveal(Object *ob) mpoly++; } + BKE_mesh_flush_hidden_from_polys(me); + paintface_flush_flags(ob); } diff --git a/source/blender/editors/sculpt_paint/paint_hide.c b/source/blender/editors/sculpt_paint/paint_hide.c index e0d578ec210..3db0bd61f03 100644 --- a/source/blender/editors/sculpt_paint/paint_hide.c +++ b/source/blender/editors/sculpt_paint/paint_hide.c @@ -416,9 +416,7 @@ static int hide_show_exec(bContext *C, wmOperator *op) /* ensure that edges and faces get hidden as well (not used by * sculpt but it looks wrong when entering editmode otherwise) */ if (pbvh_type == PBVH_FACES) { - BKE_mesh_flush_hidden_from_verts(me->mvert, me->mloop, - me->medge, me->totedge, - me->mpoly, me->totpoly); + BKE_mesh_flush_hidden_from_verts(me); } ED_region_tag_redraw(ar); diff --git a/source/blender/modifiers/intern/MOD_multires.c b/source/blender/modifiers/intern/MOD_multires.c index 4292246d8cc..848f7ee0fc1 100644 --- a/source/blender/modifiers/intern/MOD_multires.c +++ b/source/blender/modifiers/intern/MOD_multires.c @@ -118,12 +118,12 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *dm, cddm->getVertArray(cddm), mdisps); - BKE_mesh_flush_hidden_from_verts(cddm->getVertArray(cddm), - cddm->getLoopArray(cddm), - cddm->getEdgeArray(cddm), - cddm->getNumEdges(cddm), - cddm->getPolyArray(cddm), - cddm->getNumPolys(cddm)); + BKE_mesh_flush_hidden_from_verts_ex(cddm->getVertArray(cddm), + cddm->getLoopArray(cddm), + cddm->getEdgeArray(cddm), + cddm->getNumEdges(cddm), + cddm->getPolyArray(cddm), + cddm->getNumPolys(cddm)); } if (grid_paint_mask) { float *paint_mask = CustomData_add_layer(&cddm->vertData, From 28e14794e7d6d41ab2ab5c8b1fff97bdb9d52507 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 26 Jun 2013 02:57:05 +0000 Subject: [PATCH 65/72] fix for vert/face mask modes using last used select option when using the select-all key shortcut. --- source/blender/editors/sculpt_paint/paint_ops.c | 6 ++++-- source/blender/editors/space_view3d/view3d_buttons.c | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/source/blender/editors/sculpt_paint/paint_ops.c b/source/blender/editors/sculpt_paint/paint_ops.c index df1978c49f6..2c7824d4a0d 100644 --- a/source/blender/editors/sculpt_paint/paint_ops.c +++ b/source/blender/editors/sculpt_paint/paint_ops.c @@ -1242,7 +1242,8 @@ void ED_keymap_paint(wmKeyConfig *keyconf) /*Weight paint's Vertex Selection Mode */ keymap = WM_keymap_find(keyconf, "Weight Paint Vertex Selection", 0, 0); keymap->poll = vert_paint_poll; - WM_keymap_add_item(keymap, "PAINT_OT_vert_select_all", AKEY, KM_PRESS, 0, 0); + kmi = WM_keymap_add_item(keymap, "PAINT_OT_vert_select_all", AKEY, KM_PRESS, 0, 0); + RNA_enum_set(kmi->ptr, "action", SEL_TOGGLE); kmi = WM_keymap_add_item(keymap, "PAINT_OT_vert_select_all", IKEY, KM_PRESS, KM_CTRL, 0); RNA_enum_set(kmi->ptr, "action", SEL_INVERT); WM_keymap_add_item(keymap, "VIEW3D_OT_select_border", BKEY, KM_PRESS, 0, 0); @@ -1283,7 +1284,8 @@ void ED_keymap_paint(wmKeyConfig *keyconf) keymap = WM_keymap_find(keyconf, "Face Mask", 0, 0); keymap->poll = facemask_paint_poll; - WM_keymap_add_item(keymap, "PAINT_OT_face_select_all", AKEY, KM_PRESS, 0, 0); + kmi = WM_keymap_add_item(keymap, "PAINT_OT_face_select_all", AKEY, KM_PRESS, 0, 0); + RNA_enum_set(kmi->ptr, "action", SEL_TOGGLE); kmi = WM_keymap_add_item(keymap, "PAINT_OT_face_select_all", IKEY, KM_PRESS, KM_CTRL, 0); RNA_enum_set(kmi->ptr, "action", SEL_INVERT); kmi = WM_keymap_add_item(keymap, "PAINT_OT_face_select_hide", HKEY, KM_PRESS, 0, 0); diff --git a/source/blender/editors/space_view3d/view3d_buttons.c b/source/blender/editors/space_view3d/view3d_buttons.c index 57088bcc315..860807946a0 100644 --- a/source/blender/editors/space_view3d/view3d_buttons.c +++ b/source/blender/editors/space_view3d/view3d_buttons.c @@ -914,7 +914,7 @@ static void view3d_panel_vgroup(const bContext *C, Panel *pa) but = uiDefButO_ptr(block, BUT, ot, WM_OP_EXEC_DEFAULT, "Normalize", 0, yco, UI_UNIT_X * 5, UI_UNIT_Y, TIP_("Normalize weights of active vertex (if affected groups are unlocked")); - if(locked) { + if (locked) { uiButSetFlag(but, UI_BUT_DISABLED); } From a050ddf2791f44e7997944b676f2af31a1e5556f Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 26 Jun 2013 03:42:45 +0000 Subject: [PATCH 66/72] remove unused callback --- source/blender/blenlib/BLI_scanfill.h | 1 - source/blender/blenlib/intern/scanfill.c | 14 -------------- source/creator/creator.c | 2 -- 3 files changed, 17 deletions(-) diff --git a/source/blender/blenlib/BLI_scanfill.h b/source/blender/blenlib/BLI_scanfill.h index 0cbd4ee70b1..21197670640 100644 --- a/source/blender/blenlib/BLI_scanfill.h +++ b/source/blender/blenlib/BLI_scanfill.h @@ -115,7 +115,6 @@ void BLI_scanfill_end(ScanFillContext *sf_ctx); /* These callbacks are needed to make the lib finction properly */ void BLI_setErrorCallBack(void (*f)(const char *)); -void BLI_setInterruptCallBack(int (*f)(void)); #ifdef __cplusplus } diff --git a/source/blender/blenlib/intern/scanfill.c b/source/blender/blenlib/intern/scanfill.c index b6a86b86188..873ce302b9c 100644 --- a/source/blender/blenlib/intern/scanfill.c +++ b/source/blender/blenlib/intern/scanfill.c @@ -45,7 +45,6 @@ /* callbacks for errors and interrupts and some goo */ static void (*BLI_localErrorCallBack)(const char *) = NULL; -static int (*BLI_localInterruptCallBack)(void) = NULL; /** * Set a function taking a (char *) as argument to flag errors. If the @@ -58,19 +57,6 @@ void BLI_setErrorCallBack(void (*f)(const char *)) BLI_localErrorCallBack = f; } -/** - * Set a function to be able to interrupt the execution of processing - * in this module. If the function returns true, the execution will - * terminate gracefully. If the callback is not set, interruption is - * not possible. - * \param f The function to use as callback - * \attention used in creator.c - */ -void BLI_setInterruptCallBack(int (*f)(void)) -{ - BLI_localInterruptCallBack = f; -} - /* just flush the error to /dev/null if the error handler is missing */ void callLocalErrorCallBack(const char *msg) { diff --git a/source/creator/creator.c b/source/creator/creator.c index 817bc4fcf60..04882f07cc3 100644 --- a/source/creator/creator.c +++ b/source/creator/creator.c @@ -1693,6 +1693,4 @@ static void setCallbacks(void) /* BLI_blenlib: */ BLI_setErrorCallBack(error_cb); /* */ -// XXX BLI_setInterruptCallBack(blender_test_break); - } From 7d608452d0c10da9b71ca37cb3bdbdfe0e5ebe36 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 26 Jun 2013 04:17:02 +0000 Subject: [PATCH 67/72] bmesh mirror operator was counting layers in inner loop for no good reason. --- source/blender/bmesh/operators/bmo_mirror.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/source/blender/bmesh/operators/bmo_mirror.c b/source/blender/bmesh/operators/bmo_mirror.c index cd35ea67914..f1bf3179cd6 100644 --- a/source/blender/bmesh/operators/bmo_mirror.c +++ b/source/blender/bmesh/operators/bmo_mirror.c @@ -92,12 +92,11 @@ void bmo_mirror_exec(BMesh *bm, BMOperator *op) BMFace *f; BMLoop *l; MLoopUV *luv; - int totlayer; + const int totlayer = CustomData_number_of_layers(&bm->ldata, CD_MLOOPUV); BMIter liter; BMO_ITER (f, &siter, dupeop.slots_out, "geom.out", BM_FACE) { BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) { - totlayer = CustomData_number_of_layers(&bm->ldata, CD_MLOOPUV); for (i = 0; i < totlayer; i++) { luv = CustomData_bmesh_get_n(&bm->ldata, l->head.data, CD_MLOOPUV, i); if (mirror_u) From c0c9f5386bac539e3824a5a97bd2243484598594 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 26 Jun 2013 04:17:41 +0000 Subject: [PATCH 68/72] fix [#35507] BMesh module: Crash on to_mesh() if faces.layers.tex is used but no loops.layers.uv --- source/blender/bmesh/intern/bmesh_mesh_conv.c | 36 +++++++++++++++++++ source/blender/bmesh/intern/bmesh_mesh_conv.h | 1 + source/blender/python/bmesh/bmesh_py_api.c | 6 ++++ source/blender/python/bmesh/bmesh_py_types.c | 3 ++ 4 files changed, 46 insertions(+) diff --git a/source/blender/bmesh/intern/bmesh_mesh_conv.c b/source/blender/bmesh/intern/bmesh_mesh_conv.c index 9d330075a3a..7c4af8eaa3b 100644 --- a/source/blender/bmesh/intern/bmesh_mesh_conv.c +++ b/source/blender/bmesh/intern/bmesh_mesh_conv.c @@ -98,6 +98,42 @@ #include "bmesh.h" #include "intern/bmesh_private.h" /* for element checking */ +/** + * Currently this is only used for Python scripts + * which may fail to keep matching UV/TexFace layers. + * + * \note This should only perform any changes in exceptional cases, + * if we need this to be faster we could inline #BM_data_layer_add and only + * call #update_data_blocks once at the end. + */ +void BM_mesh_cd_validate(BMesh *bm) +{ + int totlayer_mtex = CustomData_number_of_layers(&bm->pdata, CD_MTEXPOLY); + int totlayer_uv = CustomData_number_of_layers(&bm->ldata, CD_MLOOPUV); + + if (LIKELY(totlayer_mtex == totlayer_uv)) { + /* pass */ + } + else if (totlayer_mtex < totlayer_uv) { + const int uv_index_first = CustomData_get_layer_index(&bm->ldata, CD_MLOOPUV); + do { + const char *from_name = bm->ldata.layers[uv_index_first + totlayer_mtex].name; + BM_data_layer_add_named(bm, &bm->pdata, CD_MTEXPOLY, from_name); + CustomData_set_layer_unique_name(&bm->pdata, totlayer_mtex); + } while (totlayer_uv != ++totlayer_mtex); + } + else if (totlayer_uv < totlayer_mtex) { + const int mtex_index_first = CustomData_get_layer_index(&bm->pdata, CD_MTEXPOLY); + do { + const char *from_name = bm->pdata.layers[mtex_index_first + totlayer_uv].name; + BM_data_layer_add_named(bm, &bm->ldata, CD_MLOOPUV, from_name); + CustomData_set_layer_unique_name(&bm->ldata, totlayer_uv); + } while (totlayer_mtex != ++totlayer_uv); + } + + BLI_assert(totlayer_mtex == totlayer_uv); +} + void BM_mesh_cd_flag_ensure(BMesh *bm, Mesh *mesh, const char cd_flag) { const char cd_flag_all = BM_mesh_cd_flag_from_bmesh(bm) | cd_flag; diff --git a/source/blender/bmesh/intern/bmesh_mesh_conv.h b/source/blender/bmesh/intern/bmesh_mesh_conv.h index 754ae8bcad4..ab9d7a0ccf3 100644 --- a/source/blender/bmesh/intern/bmesh_mesh_conv.h +++ b/source/blender/bmesh/intern/bmesh_mesh_conv.h @@ -34,6 +34,7 @@ struct Mesh; +void BM_mesh_cd_validate(BMesh *bm); void BM_mesh_cd_flag_ensure(BMesh *bm, struct Mesh *mesh, const char cd_flag); void BM_mesh_cd_flag_apply(BMesh *bm, const char cd_flag); char BM_mesh_cd_flag_from_bmesh(BMesh *bm); diff --git a/source/blender/python/bmesh/bmesh_py_api.c b/source/blender/python/bmesh/bmesh_py_api.c index 99fd3429973..c7b10d0aa4b 100644 --- a/source/blender/python/bmesh/bmesh_py_api.c +++ b/source/blender/python/bmesh/bmesh_py_api.c @@ -138,6 +138,12 @@ static PyObject *bpy_bm_update_edit_mesh(PyObject *UNUSED(self), PyObject *args, { extern void EDBM_update_generic(BMEditMesh *em, const bool do_tessface, const bool is_destructive); + BMEditMesh *em = me->edit_btmesh; + BMesh *bm = em->bm; + + /* python won't ensure matching uv/mtex */ + BM_mesh_cd_validate(bm); + EDBM_update_generic(me->edit_btmesh, do_tessface, is_destructive); } diff --git a/source/blender/python/bmesh/bmesh_py_types.c b/source/blender/python/bmesh/bmesh_py_types.c index 6ea8d6c68ce..0db8b07d5f5 100644 --- a/source/blender/python/bmesh/bmesh_py_types.c +++ b/source/blender/python/bmesh/bmesh_py_types.c @@ -907,6 +907,9 @@ static PyObject *bpy_bmesh_to_mesh(BPy_BMesh *self, PyObject *args) bm = self->bm; + /* python won't ensure matching uv/mtex */ + BM_mesh_cd_validate(bm); + BM_mesh_bm_to_me(bm, me, false); /* we could have the user do this but if they forget blender can easy crash From 063be8fdc03e2fed9d2bec4fc80db6b55fec42c1 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Wed, 26 Jun 2013 07:28:55 +0000 Subject: [PATCH 69/72] Fix [#35750] list items in properties editor (text colors not following list item theme). Issue goes back since we stopped using LISTROW button to draw item's name (i.e. since we have custom buttons in list items!). This commit: * Adds a new flag to uiBlock, UI_BLOCK_LIST_ITEM, to mark blocks used for each list item. * Adds a new button type, LISTLABEL, which basically behaves exactly as LABEL, but uses wcol_list_item color set. * When uiItemL is called, it checks whether current block has UI_BLOCK_LIST_ITEM set, and if so, switch produced button to LISTLABEL type. * Adds a new helper func, ui_layout_list_set_labels_active, called after the active list item has been "drawn", to set all LISTLABEL buttons as UI_SELECT. Note custom widget_state_label() was removed, in interface_widgets.c, as it did nothing more than default widget_state(). Thanks to Brecht for the review and advices. --- source/blender/editors/include/UI_interface.h | 7 ++++-- .../editors/interface/interface_handlers.c | 11 ++++---- .../editors/interface/interface_intern.h | 4 ++- .../editors/interface/interface_layout.c | 21 ++++++++++++++-- .../editors/interface/interface_templates.c | 14 +++++++++++ .../editors/interface/interface_widgets.c | 25 ++++++++----------- 6 files changed, 57 insertions(+), 25 deletions(-) diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h index 9c9ab2972b3..b997d0ef6a0 100644 --- a/source/blender/editors/include/UI_interface.h +++ b/source/blender/editors/include/UI_interface.h @@ -125,9 +125,11 @@ typedef struct uiLayout uiLayout; #define UI_BLOCK_POPUP_MEMORY (1 << 12) #define UI_BLOCK_CLIP_EVENTS (1 << 13) /* stop handling mouse events */ -/* XXX This comment is no more valid! */ +/* XXX This comment is no more valid! Maybe it is now bits 14-17? */ /* block->flag bits 12-15 are identical to but->flag bits */ +#define UI_BLOCK_LIST_ITEM (1 << 19) + /* uiPopupBlockHandle->menuretval */ #define UI_RETURN_CANCEL (1 << 0) /* cancel all menus cascading */ #define UI_RETURN_OK (1 << 1) /* choice made */ @@ -251,7 +253,8 @@ typedef enum { VECTORSCOPE = (50 << 9), PROGRESSBAR = (51 << 9), SEARCH_MENU_UNLINK = (52 << 9), - NODESOCKET = (53 << 9) + NODESOCKET = (53 << 9), + LISTLABEL = (54 << 9), } eButType; #define BUTTYPE (63 << 9) diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index 7aee228ddaa..d86f22df4a7 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -276,7 +276,7 @@ void ui_pan_to_scroll(const wmEvent *event, int *type, int *val) static bool ui_but_editable(uiBut *but) { - return ELEM5(but->type, LABEL, SEPR, ROUNDBOX, LISTBOX, PROGRESSBAR); + return ELEM6(but->type, LABEL, LISTLABEL, SEPR, ROUNDBOX, LISTBOX, PROGRESSBAR); } static uiBut *ui_but_prev(uiBut *but) @@ -2010,7 +2010,7 @@ static void ui_textedit_next_but(uiBlock *block, uiBut *actbut, uiHandleButtonDa uiBut *but; /* label and roundbox can overlap real buttons (backdrops...) */ - if (ELEM4(actbut->type, LABEL, SEPR, ROUNDBOX, LISTBOX)) + if (ELEM5(actbut->type, LABEL, LISTLABEL, SEPR, ROUNDBOX, LISTBOX)) return; for (but = actbut->next; but; but = but->next) { @@ -2038,7 +2038,7 @@ static void ui_textedit_prev_but(uiBlock *block, uiBut *actbut, uiHandleButtonDa uiBut *but; /* label and roundbox can overlap real buttons (backdrops...) */ - if (ELEM4(actbut->type, LABEL, SEPR, ROUNDBOX, LISTBOX)) + if (ELEM5(actbut->type, LABEL, LISTLABEL, SEPR, ROUNDBOX, LISTBOX)) return; for (but = actbut->prev; but; but = but->prev) { @@ -5361,6 +5361,7 @@ static int ui_do_button(bContext *C, uiBlock *block, uiBut *but, const wmEvent * case ROUNDBOX: case LISTBOX: case LABEL: + case LISTLABEL: case ROW: case LISTROW: case BUT_IMAGE: @@ -5558,7 +5559,7 @@ static bool ui_mouse_inside_button(ARegion *ar, uiBut *but, int x, int y) bool ui_is_but_interactive(uiBut *but) { /* note, LABEL is included for highlights, this allows drags */ - if (but->type == LABEL && but->dragpoin == NULL) + if (ELEM(but->type, LABEL, LISTLABEL) && but->dragpoin == NULL) return false; if (ELEM3(but->type, ROUNDBOX, SEPR, LISTBOX)) return false; @@ -6995,7 +6996,7 @@ static int ui_handle_menu_event(bContext *C, const wmEvent *event, uiPopupBlockH for (but = block->buttons.first; but; but = but->next) { int doit = FALSE; - if (but->type != LABEL && but->type != SEPR) + if (but->type != LABEL && but->type != LISTLABEL && but->type != SEPR) count++; /* exception for rna layer buts */ diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h index a6076b8df78..82352cee05e 100644 --- a/source/blender/editors/interface/interface_intern.h +++ b/source/blender/editors/interface/interface_intern.h @@ -94,7 +94,8 @@ typedef enum { UI_WTYPE_BOX, UI_WTYPE_SCROLL, UI_WTYPE_LISTITEM, - UI_WTYPE_PROGRESSBAR + UI_WTYPE_PROGRESSBAR, + UI_WTYPE_LISTLABEL, } uiWidgetTypeEnum; /* menu scrolling */ @@ -563,6 +564,7 @@ void ui_layout_add_but(uiLayout *layout, uiBut *but); int ui_but_can_align(uiBut *but); void ui_but_add_search(uiBut *but, PointerRNA *ptr, PropertyRNA *prop, PointerRNA *searchptr, PropertyRNA *searchprop); void ui_but_add_shortcut(uiBut *but, const char *key_str, const bool do_strip); +void ui_layout_list_set_labels_active(uiLayout *layout); /* interface_anim.c */ void ui_but_anim_flag(uiBut *but, float cfra); diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c index 7c32f354c0a..2a6a9600582 100644 --- a/source/blender/editors/interface/interface_layout.c +++ b/source/blender/editors/interface/interface_layout.c @@ -1632,7 +1632,7 @@ static uiBut *uiItemL_(uiLayout *layout, const char *name, int icon) but = uiDefIconBut(block, LABEL, 0, icon, 0, 0, w, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, ""); else but = uiDefBut(block, LABEL, 0, name, 0, 0, w, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, ""); - + /* to compensate for string size padding in ui_text_icon_width, * make text aligned right if the layout is aligned right. */ @@ -1640,7 +1640,12 @@ static uiBut *uiItemL_(uiLayout *layout, const char *name, int icon) but->flag &= ~UI_TEXT_LEFT; /* default, needs to be unset */ but->flag |= UI_TEXT_RIGHT; } - + + /* Mark as a label inside a listbox. */ + if (block->flag & UI_BLOCK_LIST_ITEM) { + but->type = LISTLABEL; + } + return but; } @@ -2399,6 +2404,18 @@ uiLayout *uiLayoutBox(uiLayout *layout) return (uiLayout *)ui_layout_box(layout, ROUNDBOX); } +/* Check all buttons defined in this layout, and set labels as active/selected. + * Needed to handle correctly text colors of list items. */ +void ui_layout_list_set_labels_active(uiLayout *layout) +{ + uiButtonItem *bitem; + for (bitem = layout->items.first; bitem; bitem = bitem->item.next) { + if (bitem->item.type == ITEM_BUTTON && bitem->but->type == LISTLABEL) { + uiButSetFlag(bitem->but, UI_SELECT); + } + } +} + uiLayout *uiLayoutListBox(uiLayout *layout, uiList *ui_list, PointerRNA *ptr, PropertyRNA *prop, PointerRNA *actptr, PropertyRNA *actprop) { diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index 34d1c24aade..1a6d79c918d 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -2640,6 +2640,8 @@ void uiTemplateList(uiLayout *layout, bContext *C, const char *listtype_name, co subblock = uiLayoutGetBlock(col); overlap = uiLayoutOverlap(col); + uiBlockSetFlag(subblock, UI_BLOCK_LIST_ITEM); + /* list item behind label & other buttons */ sub = uiLayoutRow(overlap, FALSE); @@ -2653,6 +2655,11 @@ void uiTemplateList(uiLayout *layout, bContext *C, const char *listtype_name, co if (icon == ICON_DOT) icon = ICON_NONE; draw_item(ui_list, C, sub, dataptr, &itemptr, icon, active_dataptr, active_propname, i); + + /* If we are "drawing" active item, set all labels as active. */ + if (i == activei) { + ui_layout_list_set_labels_active(sub); + } } i++; } @@ -2721,6 +2728,8 @@ void uiTemplateList(uiLayout *layout, bContext *C, const char *listtype_name, co subblock = uiLayoutGetBlock(row); overlap = uiLayoutOverlap(row); + uiBlockSetFlag(subblock, UI_BLOCK_LIST_ITEM); + /* list item behind label & other buttons */ sub = uiLayoutRow(overlap, FALSE); @@ -2733,6 +2742,11 @@ void uiTemplateList(uiLayout *layout, bContext *C, const char *listtype_name, co icon = UI_rnaptr_icon_get(C, &itemptr, rnaicon, false); draw_item(ui_list, C, sub, dataptr, &itemptr, icon, active_dataptr, active_propname, i); + /* If we are "drawing" active item, set all labels as active. */ + if (i == activei) { + ui_layout_list_set_labels_active(sub); + } + i++; } RNA_PROP_END; diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c index d8efb972ce9..6ac681104d0 100644 --- a/source/blender/editors/interface/interface_widgets.c +++ b/source/blender/editors/interface/interface_widgets.c @@ -883,7 +883,8 @@ static void widget_draw_icon(uiBut *but, BIFIconID icon, float alpha, const rcti } /* extra feature allows more alpha blending */ - if (but->type == LABEL && but->a1 == 1.0f) alpha *= but->a2; + if (ELEM(but->type, LABEL, LISTLABEL) && but->a1 == 1.0f) + alpha *= but->a2; glEnable(GL_BLEND); @@ -1731,19 +1732,6 @@ static void widget_state_numslider(uiWidgetType *wt, int state) } } -/* labels use theme colors for text */ -static void widget_state_label(uiWidgetType *wt, int state) -{ - /* call this for option button */ - widget_state(wt, state); - - if (state & UI_SELECT) - UI_GetThemeColor3ubv(TH_TEXT_HI, (unsigned char *)wt->wcol.text); - else - UI_GetThemeColor3ubv(TH_TEXT, (unsigned char *)wt->wcol.text); - -} - /* labels use theme colors for text */ static void widget_state_option_menu(uiWidgetType *wt, int state) { @@ -2980,9 +2968,11 @@ static uiWidgetType *widget_type(uiWidgetTypeEnum type) case UI_WTYPE_REGULAR: break; + case UI_WTYPE_LISTLABEL: + wt.wcol_theme = &btheme->tui.wcol_list_item; + /* No break, we use usual label code too. */ case UI_WTYPE_LABEL: wt.draw = NULL; - wt.state = widget_state_label; break; case UI_WTYPE_TOGGLE: @@ -3230,6 +3220,11 @@ void ui_draw_but(const bContext *C, ARegion *ar, uiStyle *style, uiBut *but, rct } break; + case LISTLABEL: + wt = widget_type(UI_WTYPE_LISTLABEL); + fstyle = &style->widgetlabel; + break; + case SEPR: break; From 725543241a95639eb4d445a055664e8ecd8f74b4 Mon Sep 17 00:00:00 2001 From: Gaia Clary Date: Wed, 26 Jun 2013 09:02:11 +0000 Subject: [PATCH 70/72] Avoid blender crash during collada export (when armature has animation data) --- source/blender/collada/AnimationExporter.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/collada/AnimationExporter.cpp b/source/blender/collada/AnimationExporter.cpp index 19a49c4344d..bcbcdd42752 100644 --- a/source/blender/collada/AnimationExporter.cpp +++ b/source/blender/collada/AnimationExporter.cpp @@ -924,7 +924,7 @@ std::string AnimationExporter::create_4x4_source(std::vector &frames, Obj bPoseChannel *parchan = NULL; bPoseChannel *pchan = NULL; - if (ob->type == OB_ARMATURE ) { + if (ob->type == OB_ARMATURE && bone) { bPose *pose = ob->pose; pchan = BKE_pose_channel_find_name(pose, bone->name); if (!pchan) From 56f5951ed30fa43f9fecf3663a2a4d1e213071fb Mon Sep 17 00:00:00 2001 From: Antony Riakiotakis Date: Wed, 26 Jun 2013 10:14:30 +0000 Subject: [PATCH 71/72] Fix #34837 Texture Painting using Face Selection Mask fails to show texture if more than 1 texture is used The problem here is that no flushing is done when the texface image changes between rendered triangles. Added a compare function and slightly modified the draw_tface_mapped__set_draw callback to compliant with the new user data. --- source/blender/editors/space_view3d/drawmesh.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/source/blender/editors/space_view3d/drawmesh.c b/source/blender/editors/space_view3d/drawmesh.c index d0a34f20c77..6a836c4af13 100644 --- a/source/blender/editors/space_view3d/drawmesh.c +++ b/source/blender/editors/space_view3d/drawmesh.c @@ -89,6 +89,7 @@ typedef struct drawEMTFMapped_userData { } drawEMTFMapped_userData; typedef struct drawTFace_userData { + Mesh *me; MFace *mf; MTFace *tf; } drawTFace_userData; @@ -538,7 +539,7 @@ static void update_tface_color_layer(DerivedMesh *dm) static DMDrawOption draw_tface_mapped__set_draw(void *userData, int index) { - Mesh *me = (Mesh *)userData; + Mesh *me = ((drawTFace_userData *)userData)->me; /* array checked for NULL before calling */ MPoly *mpoly = &me->mpoly[index]; @@ -735,6 +736,7 @@ static int compareDrawOptions(void *userData, int cur_index, int next_index) return 1; } + static int compareDrawOptionsEm(void *userData, int cur_index, int next_index) { drawEMTFMapped_userData *data = userData; @@ -777,8 +779,14 @@ static void draw_mesh_textured_old(Scene *scene, View3D *v3d, RegionView3D *rv3d if (ob->mode & OB_MODE_WEIGHT_PAINT) dm->drawMappedFaces(dm, wpaint__setSolidDrawOptions_facemask, GPU_enable_material, NULL, me, DM_DRAW_USE_COLORS | DM_DRAW_ALWAYS_SMOOTH); - else - dm->drawMappedFacesTex(dm, me->mpoly ? draw_tface_mapped__set_draw : NULL, NULL, me); + else { + drawTFace_userData userData; + + userData.mf = DM_get_tessface_data_layer(dm, CD_MFACE); + userData.tf = DM_get_tessface_data_layer(dm, CD_MTFACE); + userData.me = me; + dm->drawMappedFacesTex(dm, me->mpoly ? draw_tface_mapped__set_draw : NULL, compareDrawOptions, &userData); + } } else { if (GPU_buffer_legacy(dm)) { @@ -794,6 +802,7 @@ static void draw_mesh_textured_old(Scene *scene, View3D *v3d, RegionView3D *rv3d userData.mf = DM_get_tessface_data_layer(dm, CD_MFACE); userData.tf = DM_get_tessface_data_layer(dm, CD_MTFACE); + userData.me = NULL; dm->drawFacesTex(dm, draw_tface__set_draw, compareDrawOptions, &userData); } From d5fd3b36888902367b07d92f7c606a95d603e23b Mon Sep 17 00:00:00 2001 From: Thomas Dinges Date: Wed, 26 Jun 2013 11:30:37 +0000 Subject: [PATCH 72/72] Install Deps script: * Use recent OSL 1.3.2 release. --- build_files/build_environment/install_deps.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build_files/build_environment/install_deps.sh b/build_files/build_environment/install_deps.sh index 2ac3a75688e..9c93214db4e 100755 --- a/build_files/build_environment/install_deps.sh +++ b/build_files/build_environment/install_deps.sh @@ -229,7 +229,7 @@ LLVM_FORCE_REBUILD=false LLVM_SKIP=false # OSL needs to be compiled for now! -OSL_VERSION="1.3.0" +OSL_VERSION="1.3.2" OSL_SOURCE="https://github.com/imageworks/OpenShadingLanguage/archive/Release-$OSL_VERSION.tar.gz" OSL_FORCE_REBUILD=false OSL_SKIP=false