[Bf-blender-cvs] [ba9e10fd6a5] master: Merge branch 'blender2.7'
Campbell Barton
noreply at git.blender.org
Thu Jan 3 02:25:49 CET 2019
Commit: ba9e10fd6a5b7052d25f34343b7b723d25a94490
Author: Campbell Barton
Date: Thu Jan 3 12:23:17 2019 +1100
Branches: master
https://developer.blender.org/rBba9e10fd6a5b7052d25f34343b7b723d25a94490
Merge branch 'blender2.7'
===================================================================
===================================================================
diff --cc source/blender/blenkernel/intern/material.c
index 30fc02e94de,5e14a520bf6..7e59d31571b
--- a/source/blender/blenkernel/intern/material.c
+++ b/source/blender/blenkernel/intern/material.c
@@@ -545,29 -576,23 +545,38 @@@ Material **give_current_material_p(Obje
matarar = give_matarar(ob);
- if (matarar && *matarar) ma = (*matarar)[act - 1];
- else ma = NULL;
-
+ if (matarar && *matarar) {
+ ma_p = &(*matarar)[act - 1];
+ }
+ else {
+ ma_p = NULL;
+ }
}
- return ma;
+ return ma_p;
+ }
+
+ Material *give_current_material(Object *ob, short act)
+ {
+ Material **ma_p = give_current_material_p(ob, act);
+ return ma_p ? *ma_p : NULL;
}
+MaterialGPencilStyle *BKE_material_gpencil_settings_get(Object *ob, short act)
+{
+ Material *ma = give_current_material(ob, act);
+ if (ma != NULL) {
+ if (ma->gp_style == NULL) {
+ BKE_material_init_gpencil_settings(ma);
+ }
+
+ return ma->gp_style;
+ }
+ else {
+ return NULL;
+ }
+}
+
Material *give_node_material(Material *ma)
{
if (ma && ma->use_nodes && ma->nodetree) {
diff --cc source/blender/editors/render/render_shading.c
index c4effd3a523,8aa345dfa10..6875c803c33
--- a/source/blender/editors/render/render_shading.c
+++ b/source/blender/editors/render/render_shading.c
@@@ -521,9 -460,9 +521,8 @@@ void OBJECT_OT_material_slot_move(wmOpe
static int new_material_exec(bContext *C, wmOperator *UNUSED(op))
{
- Scene *scene = CTX_data_scene(C);
Material *ma = CTX_data_pointer_get_type(C, "material", &RNA_Material).data;
Main *bmain = CTX_data_main(C);
- Object *ob = CTX_data_active_object(C);
PointerRNA ptr, idptr;
PropertyRNA *prop;
@@@ -532,14 -471,12 +531,15 @@@
ma = BKE_material_copy(bmain, ma);
}
else {
- ma = BKE_material_add(bmain, DATA_("Material"));
-
- if (BKE_scene_use_new_shading_nodes(scene)) {
- ED_node_shader_default(C, &ma->id);
- ma->use_nodes = true;
++ Object *ob = CTX_data_active_object(C);
+ if ((!ob) || (ob->type != OB_GPENCIL)) {
+ ma = BKE_material_add(bmain, DATA_("Material"));
+ }
+ else {
+ ma = BKE_material_add_gpencil(bmain, DATA_("Material"));
}
+ ED_node_shader_default(C, &ma->id);
+ ma->use_nodes = true;
}
/* hook into UI */
More information about the Bf-blender-cvs
mailing list