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:
authorCampbell Barton <ideasman42@gmail.com>2011-11-03 03:16:10 +0400
committerCampbell Barton <ideasman42@gmail.com>2011-11-03 03:16:10 +0400
commit5fbf3b813cd5473070f3c3bd6572ad504b83dc74 (patch)
treef9cb28d79cf31d8ea85014ef5d70c80190fb3333 /source/blender/editors/render/render_shading.c
parent439f57d361322bbe521cfd3e60dfd6534ca22c6d (diff)
parent4293f4738ce0ea1bb81260b12a6b64f98b6a3468 (diff)
svn merge -r41458:41480 ^/trunk/blender
Diffstat (limited to 'source/blender/editors/render/render_shading.c')
-rw-r--r--source/blender/editors/render/render_shading.c26
1 files changed, 21 insertions, 5 deletions
diff --git a/source/blender/editors/render/render_shading.c b/source/blender/editors/render/render_shading.c
index 248cae2413a..73264ddf20e 100644
--- a/source/blender/editors/render/render_shading.c
+++ b/source/blender/editors/render/render_shading.c
@@ -26,7 +26,6 @@
* \ingroup edrend
*/
-
#include <stdlib.h>
#include <string.h>
@@ -77,6 +76,7 @@
#include "ED_curve.h"
#include "ED_mesh.h"
+#include "ED_node.h"
#include "ED_render.h"
#include "ED_screen.h"
@@ -363,16 +363,24 @@ void OBJECT_OT_material_slot_copy(wmOperatorType *ot)
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;
PointerRNA ptr, idptr;
PropertyRNA *prop;
/* add or copy material */
- if(ma)
+ if(ma) {
ma= copy_material(ma);
- else
+ }
+ else {
ma= add_material("Material");
+ if(scene_use_new_shading_nodes(scene)) {
+ ED_node_shader_default(scene, &ma->id);
+ ma->use_nodes= 1;
+ }
+ }
+
/* hook into UI */
uiIDContextProperty(C, &ptr, &prop);
@@ -455,16 +463,24 @@ void TEXTURE_OT_new(wmOperatorType *ot)
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;
PointerRNA ptr, idptr;
PropertyRNA *prop;
/* add or copy world */
- if(wo)
+ if(wo) {
wo= copy_world(wo);
- else
+ }
+ else {
wo= add_world("World");
+ if(scene_use_new_shading_nodes(scene)) {
+ ED_node_shader_default(scene, &wo->id);
+ wo->use_nodes= 1;
+ }
+ }
+
/* hook into UI */
uiIDContextProperty(C, &ptr, &prop);