From bb0e8f1c552adfb67f34551f061f2b901e1f2d90 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 27 Jun 2017 18:05:44 +1000 Subject: [PATCH 1/7] Cleanup: remove unused function --- source/blender/collada/EffectExporter.cpp | 12 ------------ source/blender/collada/EffectExporter.h | 1 - 2 files changed, 13 deletions(-) diff --git a/source/blender/collada/EffectExporter.cpp b/source/blender/collada/EffectExporter.cpp index 55dc936939c..2bf0859b0f0 100644 --- a/source/blender/collada/EffectExporter.cpp +++ b/source/blender/collada/EffectExporter.cpp @@ -196,18 +196,6 @@ void EffectsExporter::writeTextures(COLLADASW::EffectProfile &ep, } } -void EffectsExporter::exportUVMats(Object *ob) -{ - std::vector tex_indices; - int active_uv_layer = -1; - std::set uv_textures; - if (ob->type == OB_MESH && ob->totcol && this->export_settings->export_texture_type == BC_TEXTURE_TYPE_UV) { - bool active_uv_only = this->export_settings->active_uv_only; - Mesh *me = (Mesh *)ob->data; - active_uv_layer = CustomData_get_active_layer_index(&me->pdata, CD_MTEXPOLY); - } -} - void EffectsExporter::operator()(Material *ma, Object *ob) { // create a list of indices to textures of type TEX_IMAGE diff --git a/source/blender/collada/EffectExporter.h b/source/blender/collada/EffectExporter.h index 95e931dc0d1..7d45a085777 100644 --- a/source/blender/collada/EffectExporter.h +++ b/source/blender/collada/EffectExporter.h @@ -47,7 +47,6 @@ class EffectsExporter: COLLADASW::LibraryEffects { public: EffectsExporter(COLLADASW::StreamWriter *sw, const ExportSettings *export_settings); - void exportUVMats(Object *ob); void exportEffects(Scene *sce); void operator()(Material *ma, Object *ob); From f11bcbed9d0402db271bc610eaec156583e746fa Mon Sep 17 00:00:00 2001 From: Dalai Felinto Date: Tue, 27 Jun 2017 16:53:43 +0200 Subject: [PATCH 2/7] Fix T51913: Context tab for textures issue The original code was doing a sanity check to see if existing index was out of range. However the comparison was wrong. So if the previous ct->user (active index of texture node) was larger than then number of available texture nodes + 1 in the other material, we would never re-set the index to 0. Bug introduced on c31f74de6bb7. There was an early attempt of fixing this (2b2ac5d3cc) but it was just working by pure, luck. And failing in cases like the one from this bug report. --- source/blender/editors/space_buttons/buttons_texture.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/editors/space_buttons/buttons_texture.c b/source/blender/editors/space_buttons/buttons_texture.c index 72de7e5c81c..1d67ac620b0 100644 --- a/source/blender/editors/space_buttons/buttons_texture.c +++ b/source/blender/editors/space_buttons/buttons_texture.c @@ -470,7 +470,7 @@ void buttons_texture_context_compute(const bContext *C, SpaceButs *sbuts) } else { /* set one user as active based on active index */ - if (ct->index == BLI_listbase_count_ex(&ct->users, ct->index + 1)) + if (ct->index >= BLI_listbase_count_ex(&ct->users, ct->index + 1)) ct->index = 0; ct->user = BLI_findlink(&ct->users, ct->index); From 2c0ee61f6d3dc6baf8bb75d747c4fb1c2aca2f87 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Wed, 28 Jun 2017 10:53:52 +0200 Subject: [PATCH 3/7] Fix T51900: Crash after pressing "F" multiple times. `BMO_iter_as_array()` may fill less items than requested in given array, so we have to update number of items to work on from its returned value, otherwise code might try to use uninitialized memory. --- source/blender/bmesh/operators/bmo_create.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/source/blender/bmesh/operators/bmo_create.c b/source/blender/bmesh/operators/bmo_create.c index a980baf8626..20b8a481ede 100644 --- a/source/blender/bmesh/operators/bmo_create.c +++ b/source/blender/bmesh/operators/bmo_create.c @@ -74,13 +74,13 @@ void bmo_contextual_create_exec(BMesh *bm, BMOperator *op) BMVert *verts[2]; BMEdge *e; - BMO_iter_as_array(op->slots_in, "geom", BM_VERT, (void **)verts, 2); - - /* create edge */ - e = BM_edge_create(bm, verts[0], verts[1], NULL, BM_CREATE_NO_DOUBLE); - BMO_edge_flag_enable(bm, e, ELE_OUT); - tote += 1; - BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "edges.out", BM_EDGE, ELE_OUT); + if (BMO_iter_as_array(op->slots_in, "geom", BM_VERT, (void **)verts, 2) == 0) { + /* create edge */ + e = BM_edge_create(bm, verts[0], verts[1], NULL, BM_CREATE_NO_DOUBLE); + BMO_edge_flag_enable(bm, e, ELE_OUT); + tote += 1; + BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "edges.out", BM_EDGE, ELE_OUT); + } return; } @@ -283,13 +283,13 @@ void bmo_contextual_create_exec(BMesh *bm, BMOperator *op) */ if (totv > 2) { /* TODO, some of these vertes may be connected by edges, - * this connectivity could be used rather then treating + * this connectivity could be used rather than treating * them as a bunch of isolated verts. */ BMVert **vert_arr = MEM_mallocN(sizeof(BMVert *) * totv, __func__); BMFace *f; - BMO_iter_as_array(op->slots_in, "geom", BM_VERT, (void **)vert_arr, totv); + totv = BMO_iter_as_array(op->slots_in, "geom", BM_VERT, (void **)vert_arr, totv); BM_verts_sort_radial_plane(vert_arr, totv); From 16eca8f47ed6096ce726306b1059f4d50b04454f Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Wed, 28 Jun 2017 13:21:04 +0200 Subject: [PATCH 4/7] Fix own really stupid mistake/typo in previous commit... --- source/blender/bmesh/operators/bmo_create.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/bmesh/operators/bmo_create.c b/source/blender/bmesh/operators/bmo_create.c index 20b8a481ede..fa08d009d40 100644 --- a/source/blender/bmesh/operators/bmo_create.c +++ b/source/blender/bmesh/operators/bmo_create.c @@ -74,7 +74,7 @@ void bmo_contextual_create_exec(BMesh *bm, BMOperator *op) BMVert *verts[2]; BMEdge *e; - if (BMO_iter_as_array(op->slots_in, "geom", BM_VERT, (void **)verts, 2) == 0) { + if (BMO_iter_as_array(op->slots_in, "geom", BM_VERT, (void **)verts, 2) == 2) { /* create edge */ e = BM_edge_create(bm, verts[0], verts[1], NULL, BM_CREATE_NO_DOUBLE); BMO_edge_flag_enable(bm, e, ELE_OUT); From b5696f27991ce8ff9c95ed54d0a0387ed31f02ce Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Wed, 28 Jun 2017 20:50:21 +0200 Subject: [PATCH 5/7] Fix node UI not using translation context correctly. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Now that some node types may have custom context, we need to handle that in the (convoluted :| ) UI code of nodes as well. Reported in T43295 by Gabriel Gazzán (@gab3d), thanks. --- release/scripts/modules/nodeitems_utils.py | 12 +++++++++--- source/blender/blenkernel/intern/node.c | 16 ++++++++++++---- 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/release/scripts/modules/nodeitems_utils.py b/release/scripts/modules/nodeitems_utils.py index be6f031217c..904062c36cd 100644 --- a/release/scripts/modules/nodeitems_utils.py +++ b/release/scripts/modules/nodeitems_utils.py @@ -61,13 +61,19 @@ class NodeItem: # if no custom label is defined, fall back to the node type UI name return getattr(bpy.types, self.nodetype).bl_rna.name + @property + def translation_context(self): + if self._label: + return bpy.app.translations.contexts.default + else: + # if no custom label is defined, fall back to the node type UI name + return getattr(bpy.types, self.nodetype).bl_rna.translation_context + # NB: is a staticmethod because called with an explicit self argument # NodeItemCustom sets this as a variable attribute in __init__ @staticmethod def draw(self, layout, context): - default_context = bpy.app.translations.contexts.default - - props = layout.operator("node.add_node", text=self.label, text_ctxt=default_context) + props = layout.operator("node.add_node", text=self.label, text_ctxt=self.translation_context) props.type = self.nodetype props.use_transform = True diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c index dd28a534d22..78323557ae2 100644 --- a/source/blender/blenkernel/intern/node.c +++ b/source/blender/blenkernel/intern/node.c @@ -3174,12 +3174,20 @@ void nodeSynchronizeID(bNode *node, bool copy_to_id) void nodeLabel(bNodeTree *ntree, bNode *node, char *label, int maxlen) { - if (node->label[0] != '\0') + if (node->label[0] != '\0') { BLI_strncpy(label, node->label, maxlen); - else if (node->typeinfo->labelfunc) + } + else if (node->typeinfo->labelfunc) { node->typeinfo->labelfunc(ntree, node, label, maxlen); - else - BLI_strncpy(label, IFACE_(node->typeinfo->ui_name), maxlen); + } + else { + /* Kind of hacky and weak... Ideally would be better to use RNA here. :| */ + const char *tmp = CTX_IFACE_(BLT_I18NCONTEXT_ID_NODETREE, node->typeinfo->ui_name); + if (tmp == node->typeinfo->ui_name) { + tmp = IFACE_(node->typeinfo->ui_name); + } + BLI_strncpy(label, tmp, maxlen); + } } static void node_type_base_defaults(bNodeType *ntype) From 1f3fd8e60a378f1516adf2527630206fc730c6b8 Mon Sep 17 00:00:00 2001 From: Lukas Stockner Date: Wed, 28 Jun 2017 21:25:30 +0200 Subject: [PATCH 6/7] Fix T51909: Cycles: Uninitialized closure normals for the Hair BSDF As the title says, the normal wasn't set for the Hair BSDF because it wasn't needed before. However, the denoiser uses it to store the feature passes, so it needs to be set now. --- intern/cycles/kernel/osl/osl_closures.cpp | 4 ++-- intern/cycles/kernel/svm/svm_closure.h | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/intern/cycles/kernel/osl/osl_closures.cpp b/intern/cycles/kernel/osl/osl_closures.cpp index 2f0897434ec..14c5c1c3db5 100644 --- a/intern/cycles/kernel/osl/osl_closures.cpp +++ b/intern/cycles/kernel/osl/osl_closures.cpp @@ -156,7 +156,7 @@ BSDF_CLOSURE_CLASS_BEGIN(MicrofacetBeckmannRefraction, microfacet_beckmann_refra BSDF_CLOSURE_CLASS_END(MicrofacetBeckmannRefraction, microfacet_beckmann_refraction) BSDF_CLOSURE_CLASS_BEGIN(HairReflection, hair_reflection, HairBsdf, LABEL_GLOSSY) - CLOSURE_FLOAT3_PARAM(HairReflectionClosure, unused), + CLOSURE_FLOAT3_PARAM(HairReflectionClosure, params.N), CLOSURE_FLOAT_PARAM(HairReflectionClosure, params.roughness1), CLOSURE_FLOAT_PARAM(HairReflectionClosure, params.roughness2), CLOSURE_FLOAT3_PARAM(HairReflectionClosure, params.T), @@ -164,7 +164,7 @@ BSDF_CLOSURE_CLASS_BEGIN(HairReflection, hair_reflection, HairBsdf, LABEL_GLOSSY BSDF_CLOSURE_CLASS_END(HairReflection, hair_reflection) BSDF_CLOSURE_CLASS_BEGIN(HairTransmission, hair_transmission, HairBsdf, LABEL_GLOSSY) - CLOSURE_FLOAT3_PARAM(HairTransmissionClosure, unused), + CLOSURE_FLOAT3_PARAM(HairTransmissionClosure, params.N), CLOSURE_FLOAT_PARAM(HairTransmissionClosure, params.roughness1), CLOSURE_FLOAT_PARAM(HairTransmissionClosure, params.roughness2), CLOSURE_FLOAT3_PARAM(HairReflectionClosure, params.T), diff --git a/intern/cycles/kernel/svm/svm_closure.h b/intern/cycles/kernel/svm/svm_closure.h index 844245ee2d4..b3d24f88420 100644 --- a/intern/cycles/kernel/svm/svm_closure.h +++ b/intern/cycles/kernel/svm/svm_closure.h @@ -725,6 +725,7 @@ ccl_device void svm_node_closure_bsdf(KernelGlobals *kg, ShaderData *sd, float * HairBsdf *bsdf = (HairBsdf*)bsdf_alloc(sd, sizeof(HairBsdf), weight); if(bsdf) { + bsdf->N = N; bsdf->roughness1 = param1; bsdf->roughness2 = param2; bsdf->offset = -stack_load_float(stack, data_node.z); From a57a7975a1625d0876ff6ac13c14d5784236eb7e Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Thu, 29 Jun 2017 10:09:17 +0200 Subject: [PATCH 7/7] Fix T51926: Selecting pose icon under expanded group in outliner causes crash. Cannot switch uninstantiated armature to Pose mode... --- source/blender/editors/space_outliner/outliner_select.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/source/blender/editors/space_outliner/outliner_select.c b/source/blender/editors/space_outliner/outliner_select.c index 7e05c76b35b..18cc2a015e6 100644 --- a/source/blender/editors/space_outliner/outliner_select.c +++ b/source/blender/editors/space_outliner/outliner_select.c @@ -707,7 +707,12 @@ static eOLDrawState tree_element_active_pose( { Object *ob = (Object *)tselem->id; Base *base = BKE_scene_base_find(scene, ob); - + + if (base == NULL) { + /* Armature not instantiated in current scene (e.g. inside an appended group...). */ + return OL_DRAWSEL_NONE; + } + if (set != OL_SETSEL_NONE) { if (scene->obedit) ED_object_editmode_exit(C, EM_FREEDATA | EM_FREEUNDO | EM_WAITCURSOR | EM_DO_UNDO);