Merge branch 'master' into blender2.8
authorBastien Montagne <montagne29@wanadoo.fr>
Thu, 29 Jun 2017 08:11:17 +0000 (10:11 +0200)
committerBastien Montagne <montagne29@wanadoo.fr>
Thu, 29 Jun 2017 08:11:17 +0000 (10:11 +0200)
Conflicts:
source/blender/editors/space_outliner/outliner_select.c

intern/cycles/kernel/osl/osl_closures.cpp
intern/cycles/kernel/svm/svm_closure.h
release/scripts/modules/nodeitems_utils.py
source/blender/blenkernel/intern/node.c
source/blender/bmesh/operators/bmo_create.c
source/blender/editors/space_buttons/buttons_texture.c
source/blender/editors/space_outliner/outliner_select.c

index 2f0897434ecbd6fcf8e3484dea8db7806cee060c..14c5c1c3db50efc991fcb2e98ba0c4b68813ec78 100644 (file)
@@ -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),
index 844245ee2d41a82b392496c5062fe67e4aeceb8e..b3d24f88420b8501264bfed7543fe5a91395fc1d 100644 (file)
@@ -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);
index be6f031217c2122b82a081ed5fa987a62c7dcf00..904062c36cde8ffca8a9607b36b4a6e901781604 100644 (file)
@@ -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
 
index 8ccd652edd4dda8c4d540ebe3288c260c075aace..82092fedbe3605836984addf2ac99980219d7104 100644 (file)
@@ -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)
index a980baf8626990093cd70ea7b1ec4e8d7f09a1bf..fa08d009d402c361e006a71aa062412ddbde1430 100644 (file)
@@ -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) == 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);
+               }
                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);
 
index 72de7e5c81c6171222fe0b27eb9056785d6581f1..1d67ac620b0f9a3ae582eec4d051ec548dce176d 100644 (file)
@@ -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);
index 459af31b921cee529f6174d700a3f7ce8b153609..d9590d2af7f823c8690a57fd501a6bc949d8ae39 100644 (file)
@@ -659,7 +659,12 @@ static eOLDrawState tree_element_active_pose(
 {
        Object *ob = (Object *)tselem->id;
        Base *base = BKE_scene_layer_base_find(sl, 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);