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

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/editors/render/render_shading.c')
-rw-r--r--source/blender/editors/render/render_shading.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/source/blender/editors/render/render_shading.c b/source/blender/editors/render/render_shading.c
index 53e1f49d544..e00db9b5850 100644
--- a/source/blender/editors/render/render_shading.c
+++ b/source/blender/editors/render/render_shading.c
@@ -367,6 +367,7 @@ 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);
PointerRNA ptr, idptr;
PropertyRNA *prop;
@@ -375,7 +376,7 @@ static int new_material_exec(bContext *C, wmOperator *UNUSED(op))
ma = BKE_material_copy(ma);
}
else {
- ma = BKE_material_add("Material");
+ ma = BKE_material_add(bmain, "Material");
if (BKE_scene_use_new_shading_nodes(scene)) {
ED_node_shader_default(scene, &ma->id);
@@ -420,6 +421,7 @@ void MATERIAL_OT_new(wmOperatorType *ot)
static int new_texture_exec(bContext *C, wmOperator *UNUSED(op))
{
Tex *tex = CTX_data_pointer_get_type(C, "texture", &RNA_Texture).data;
+ Main *bmain = CTX_data_main(C);
PointerRNA ptr, idptr;
PropertyRNA *prop;
@@ -427,7 +429,7 @@ static int new_texture_exec(bContext *C, wmOperator *UNUSED(op))
if (tex)
tex = BKE_texture_copy(tex);
else
- tex = add_texture("Texture");
+ tex = add_texture(bmain, "Texture");
/* hook into UI */
uiIDContextProperty(C, &ptr, &prop);
@@ -467,6 +469,7 @@ static int new_world_exec(bContext *C, wmOperator *UNUSED(op))
{
Scene *scene = CTX_data_scene(C);
World *wo = CTX_data_pointer_get_type(C, "world", &RNA_World).data;
+ Main *bmain = CTX_data_main(C);
PointerRNA ptr, idptr;
PropertyRNA *prop;
@@ -475,7 +478,7 @@ static int new_world_exec(bContext *C, wmOperator *UNUSED(op))
wo = BKE_world_copy(wo);
}
else {
- wo = add_world("World");
+ wo = add_world(bmain, "World");
if (BKE_scene_use_new_shading_nodes(scene)) {
ED_node_shader_default(scene, &wo->id);