[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [40938] branches/cycles: Cycles: add python render engine option to use new shading nodes or not, instead
Brecht Van Lommel
brechtvanlommel at pandora.be
Tue Oct 11 19:19:55 CEST 2011
Revision: 40938
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=40938
Author: blendix
Date: 2011-10-11 17:19:55 +0000 (Tue, 11 Oct 2011)
Log Message:
-----------
Cycles: add python render engine option to use new shading nodes or not, instead
of hardcoded check for cycles. Also some other minor code cleaning tweaks.
Modified Paths:
--------------
branches/cycles/CMakeLists.txt
branches/cycles/intern/CMakeLists.txt
branches/cycles/intern/cycles/blender/addon/__init__.py
branches/cycles/release/scripts/startup/bl_ui/properties_particle.py
branches/cycles/release/scripts/startup/bl_ui/properties_texture.py
branches/cycles/release/scripts/startup/bl_ui/space_node.py
branches/cycles/release/scripts/startup/bl_ui/space_view3d.py
branches/cycles/source/blender/blenkernel/BKE_scene.h
branches/cycles/source/blender/blenkernel/intern/scene.c
branches/cycles/source/blender/editors/sculpt_paint/paint_image.c
branches/cycles/source/blender/editors/space_image/space_image.c
branches/cycles/source/blender/editors/space_node/node_header.c
branches/cycles/source/blender/editors/space_view3d/drawmesh.c
branches/cycles/source/blender/editors/space_view3d/drawobject.c
branches/cycles/source/blender/editors/space_view3d/view3d_draw.c
branches/cycles/source/blender/editors/uvedit/uvedit_ops.c
branches/cycles/source/blender/makesdna/DNA_image_types.h
branches/cycles/source/blender/makesdna/DNA_node_types.h
branches/cycles/source/blender/makesdna/DNA_view3d_types.h
branches/cycles/source/blender/makesrna/intern/rna_access.c
branches/cycles/source/blender/makesrna/intern/rna_render.c
branches/cycles/source/blender/makesrna/intern/rna_scene.c
branches/cycles/source/blender/makesrna/intern/rna_space.c
branches/cycles/source/blender/render/extern/include/RE_engine.h
branches/cycles/source/blender/render/intern/pipeline/engine.c
Modified: branches/cycles/CMakeLists.txt
===================================================================
--- branches/cycles/CMakeLists.txt 2011-10-11 14:53:27 UTC (rev 40937)
+++ branches/cycles/CMakeLists.txt 2011-10-11 17:19:55 UTC (rev 40938)
@@ -1462,13 +1462,7 @@
add_subdirectory(intern)
add_subdirectory(extern)
-#-----------------------------------------------------------------------------
-# Cycles
-if(WITH_CYCLES)
- add_subdirectory(intern/cycles)
-endif()
-
#-----------------------------------------------------------------------------
# Blender Application
if(WITH_BLENDER)
Modified: branches/cycles/intern/CMakeLists.txt
===================================================================
--- branches/cycles/intern/CMakeLists.txt 2011-10-11 14:53:27 UTC (rev 40937)
+++ branches/cycles/intern/CMakeLists.txt 2011-10-11 17:19:55 UTC (rev 40938)
@@ -58,3 +58,8 @@
if(WITH_IK_ITASC)
add_subdirectory(itasc)
endif()
+
+if(WITH_CYCLES)
+ add_subdirectory(cycles)
+endif()
+
Modified: branches/cycles/intern/cycles/blender/addon/__init__.py
===================================================================
--- branches/cycles/intern/cycles/blender/addon/__init__.py 2011-10-11 14:53:27 UTC (rev 40937)
+++ branches/cycles/intern/cycles/blender/addon/__init__.py 2011-10-11 17:19:55 UTC (rev 40938)
@@ -40,6 +40,7 @@
class CyclesRender(bpy.types.RenderEngine):
bl_idname = 'CYCLES'
bl_label = "Cycles"
+ bl_use_shading_nodes = True
def __init__(self):
engine.init()
Modified: branches/cycles/release/scripts/startup/bl_ui/properties_particle.py
===================================================================
--- branches/cycles/release/scripts/startup/bl_ui/properties_particle.py 2011-10-11 14:53:27 UTC (rev 40937)
+++ branches/cycles/release/scripts/startup/bl_ui/properties_particle.py 2011-10-11 17:19:55 UTC (rev 40938)
@@ -41,7 +41,6 @@
def particle_panel_poll(cls, context):
psys = context.particle_system
- engine = context.scene.render.engine
settings = 0
if psys:
@@ -79,7 +78,6 @@
@classmethod
def poll(cls, context):
- engine = context.scene.render.engine
return (context.particle_system or context.object or context.space_data.pin_id)
def draw(self, context):
@@ -251,7 +249,6 @@
@classmethod
def poll(cls, context):
psys = context.particle_system
- engine = context.scene.render.engine
if psys is None:
return False
if psys.settings is None:
@@ -647,7 +644,6 @@
def poll(cls, context):
psys = context.particle_system
settings = particle_get_settings(context)
- engine = context.scene.render.engine
if settings is None:
return False
@@ -746,12 +742,8 @@
@classmethod
def poll(cls, context):
settings = particle_get_settings(context)
- engine = context.scene.render.engine
- if settings is None:
- return False
+ return settings is not None
- return True
-
def draw(self, context):
layout = self.layout
@@ -931,10 +923,7 @@
@classmethod
def poll(cls, context):
settings = particle_get_settings(context)
- engine = context.scene.render.engine
- if settings is None:
- return False
- return True
+ return settings is not None
def draw(self, context):
layout = self.layout
Modified: branches/cycles/release/scripts/startup/bl_ui/properties_texture.py
===================================================================
--- branches/cycles/release/scripts/startup/bl_ui/properties_texture.py 2011-10-11 14:53:27 UTC (rev 40937)
+++ branches/cycles/release/scripts/startup/bl_ui/properties_texture.py 2011-10-11 17:19:55 UTC (rev 40938)
@@ -410,7 +410,6 @@
#Only for Material based textures, not for Lamp/World...
if slot and isinstance(idblock, bpy.types.Material):
- slot = context.texture_slot
col.prop(tex, "use_normal_map")
row = col.row()
row.active = tex.use_normal_map
Modified: branches/cycles/release/scripts/startup/bl_ui/space_node.py
===================================================================
--- branches/cycles/release/scripts/startup/bl_ui/space_node.py 2011-10-11 14:53:27 UTC (rev 40937)
+++ branches/cycles/release/scripts/startup/bl_ui/space_node.py 2011-10-11 17:19:55 UTC (rev 40938)
@@ -27,6 +27,7 @@
def draw(self, context):
layout = self.layout
+ scene = context.scene
snode = context.space_data
snode_id = snode.id
id_from = snode.id_from
@@ -43,9 +44,10 @@
layout.prop(snode, "tree_type", text="", expand=True)
if snode.tree_type == 'SHADER':
- row.prop(snode, "shader_type", text="", expand=True)
+ if scene.render.use_shading_nodes:
+ layout.prop(snode, "shader_type", text="", expand=True)
- if snode.shader_type == 'OBJECT':
+ if not scene.render.use_shading_nodes or snode.shader_type == 'OBJECT':
if id_from:
layout.template_ID(id_from, "active_material", new="material.new")
if snode_id:
Modified: branches/cycles/release/scripts/startup/bl_ui/space_view3d.py
===================================================================
--- branches/cycles/release/scripts/startup/bl_ui/space_view3d.py 2011-10-11 14:53:27 UTC (rev 40937)
+++ branches/cycles/release/scripts/startup/bl_ui/space_view3d.py 2011-10-11 17:19:55 UTC (rev 40938)
@@ -2142,9 +2142,11 @@
subsub.active = scene.unit_settings.system == 'NONE'
subsub.prop(view, "grid_subdivisions", text="Subdivisions")
- col = layout.column()
- col.label(text="Shading:")
- col.prop(gs, "material_mode", text="")
+ if not scene.render.use_shading_nodes:
+ col = layout.column()
+ col.label(text="Shading:")
+ col.prop(gs, "material_mode", text="")
+ col.prop(view, "show_textured_solid")
layout.separator()
Modified: branches/cycles/source/blender/blenkernel/BKE_scene.h
===================================================================
--- branches/cycles/source/blender/blenkernel/BKE_scene.h 2011-10-11 14:53:27 UTC (rev 40937)
+++ branches/cycles/source/blender/blenkernel/BKE_scene.h 2011-10-11 17:19:55 UTC (rev 40938)
@@ -102,7 +102,7 @@
int get_render_shadow_samples(struct RenderData *r, int samples);
float get_render_aosss_error(struct RenderData *r, float error);
-int scene_use_new_shading_system(struct Scene *scene);
+int scene_use_new_shading_nodes(struct Scene *scene);
#ifdef __cplusplus
}
Modified: branches/cycles/source/blender/blenkernel/intern/scene.c
===================================================================
--- branches/cycles/source/blender/blenkernel/intern/scene.c 2011-10-11 14:53:27 UTC (rev 40937)
+++ branches/cycles/source/blender/blenkernel/intern/scene.c 2011-10-11 17:19:55 UTC (rev 40938)
@@ -74,6 +74,8 @@
#include "BKE_sound.h"
+#include "RE_engine.h"
+
//XXX #include "BIF_previewrender.h"
//XXX #include "BIF_editseq.h"
@@ -1137,8 +1139,9 @@
return NULL;
}
-int scene_use_new_shading_system(Scene *scene)
+int scene_use_new_shading_nodes(Scene *scene)
{
- return (strcmp(scene->r.engine, "CYCLES") == 0);
+ RenderEngineType *type= RE_engines_find(scene->r.engine);
+ return (type->flag & RE_USE_SHADING_NODES);
}
Modified: branches/cycles/source/blender/editors/sculpt_paint/paint_image.c
===================================================================
--- branches/cycles/source/blender/editors/sculpt_paint/paint_image.c 2011-10-11 14:53:27 UTC (rev 40937)
+++ branches/cycles/source/blender/editors/sculpt_paint/paint_image.c 2011-10-11 17:19:55 UTC (rev 40938)
@@ -487,7 +487,7 @@
{
Image *ima;
- if(scene_use_new_shading_system(s->scene)) {
+ if(scene_use_new_shading_nodes(s->scene)) {
MFace *mf = s->me->mface+face_index;
ED_object_get_active_image(s->ob, mf->mat_nr, &ima, NULL);
}
@@ -503,7 +503,7 @@
{
Image *ima;
- if(scene_use_new_shading_system(ps->scene)) {
+ if(scene_use_new_shading_nodes(ps->scene)) {
MFace *mf = ps->dm_mface+face_index;
ED_object_get_active_image(ps->ob, mf->mat_nr, &ima, NULL);
}
Modified: branches/cycles/source/blender/editors/space_image/space_image.c
===================================================================
--- branches/cycles/source/blender/editors/space_image/space_image.c 2011-10-11 14:53:27 UTC (rev 40937)
+++ branches/cycles/source/blender/editors/space_image/space_image.c 2011-10-11 17:19:55 UTC (rev 40938)
@@ -594,7 +594,7 @@
EditMesh *em= BKE_mesh_get_editmesh(me);
int sloppy= 1; /* partially selected face is ok */
- if(scene_use_new_shading_system(scene)) {
+ if(scene_use_new_shading_nodes(scene)) {
/* new shading system, get image from material */
EditFace *efa= EM_get_actFace(em, sloppy);
Modified: branches/cycles/source/blender/editors/space_node/node_header.c
===================================================================
--- branches/cycles/source/blender/editors/space_node/node_header.c 2011-10-11 14:53:27 UTC (rev 40937)
+++ branches/cycles/source/blender/editors/space_node/node_header.c 2011-10-11 17:19:55 UTC (rev 40938)
@@ -232,7 +232,7 @@
if(snode->treetype==NTREE_SHADER) {
uiItemMenuF(layout, IFACE_(N_("Input")), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_INPUT));
uiItemMenuF(layout, IFACE_(N_("Output")), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_OUTPUT));
- if(scene_use_new_shading_system(scene)) {
+ if(scene_use_new_shading_nodes(scene)) {
uiItemMenuF(layout, IFACE_(N_("Shader")), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_SHADER));
uiItemMenuF(layout, IFACE_(N_("Texture")), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_TEXTURE));
}
Modified: branches/cycles/source/blender/editors/space_view3d/drawmesh.c
===================================================================
--- branches/cycles/source/blender/editors/space_view3d/drawmesh.c 2011-10-11 14:53:27 UTC (rev 40937)
+++ branches/cycles/source/blender/editors/space_view3d/drawmesh.c 2011-10-11 17:19:55 UTC (rev 40938)
@@ -775,7 +775,7 @@
void draw_mesh_textured(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *ob, DerivedMesh *dm, int faceselect)
{
- if(!scene_use_new_shading_system(scene)) {
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list