[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [36355] branches/cycles: Blender modifications for Cycles integration.

Brecht Van Lommel brechtvanlommel at pandora.be
Wed Apr 27 16:36:03 CEST 2011


Revision: 36355
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=36355
Author:   blendix
Date:     2011-04-27 14:36:02 +0000 (Wed, 27 Apr 2011)
Log Message:
-----------
Blender modifications for Cycles integration.

Some notes about code status:

* The Blender modifications were fairly quickly put together, much more code
  polish and work is needed to get this to a state where it can be committed
  to trunk. Files created with this version may not work in future versions.

* Only simple path tracing is supported currently, but we intend to provide
  finer control, and more options where it makes sense.

* For GPU rendering, only CUDA works currently. The intention is to have the
  same kernel code compile for C++/OpenCL/CUDA, some more work is needed to
  get OpenCL functional.

* There are two shading backends: GPU compatible and Open Shading Language.
  Unfortunately, OSL only runs on the CPU currently, getting this to run on
  the GPU would be a major undertaking, and is unlikely to be supported soon.
  Additionally, it's not possible yet to write custom OSL shaders.

* There is some code for adaptive subdivision and displacement, but it's far
  from finished. The intention is to eventually have a nice unified bump and
  displacement system.

* The code currently has a number of fairly heavy dependencies: Boost,
  OpenImageIO, GLEW, GLUT, and optionally OSL, Partio. This makes it difficult
  to compile, we'll try to eliminate some, it may take a while before it
  becomes easy to compile this.

Modified Paths:
--------------
    branches/cycles/CMakeLists.txt
    branches/cycles/intern/cycles/device/device_network.cpp
    branches/cycles/intern/guardedalloc/MEM_guardedalloc.h
    branches/cycles/release/scripts/startup/bl_ui/properties_particle.py
    branches/cycles/release/scripts/startup/bl_ui/space_node.py
    branches/cycles/source/blender/blenkernel/BKE_depsgraph.h
    branches/cycles/source/blender/blenkernel/BKE_node.h
    branches/cycles/source/blender/blenkernel/BKE_object.h
    branches/cycles/source/blender/blenkernel/BKE_subsurf.h
    branches/cycles/source/blender/blenkernel/BKE_world.h
    branches/cycles/source/blender/blenkernel/intern/anim_sys.c
    branches/cycles/source/blender/blenkernel/intern/depsgraph.c
    branches/cycles/source/blender/blenkernel/intern/material.c
    branches/cycles/source/blender/blenkernel/intern/mesh.c
    branches/cycles/source/blender/blenkernel/intern/multires.c
    branches/cycles/source/blender/blenkernel/intern/node.c
    branches/cycles/source/blender/blenkernel/intern/object.c
    branches/cycles/source/blender/blenkernel/intern/scene.c
    branches/cycles/source/blender/blenkernel/intern/shrinkwrap.c
    branches/cycles/source/blender/blenkernel/intern/subsurf_ccg.c
    branches/cycles/source/blender/blenkernel/intern/world.c
    branches/cycles/source/blender/blenloader/intern/readfile.c
    branches/cycles/source/blender/blenloader/intern/writefile.c
    branches/cycles/source/blender/editors/datafiles/bfont.ttf.c
    branches/cycles/source/blender/editors/datafiles/bmonofont.ttf.c
    branches/cycles/source/blender/editors/datafiles/startup.blend.c
    branches/cycles/source/blender/editors/include/ED_node.h
    branches/cycles/source/blender/editors/include/ED_render.h
    branches/cycles/source/blender/editors/include/UI_interface.h
    branches/cycles/source/blender/editors/interface/CMakeLists.txt
    branches/cycles/source/blender/editors/interface/interface_handlers.c
    branches/cycles/source/blender/editors/interface/interface_icons.c
    branches/cycles/source/blender/editors/interface/interface_intern.h
    branches/cycles/source/blender/editors/interface/interface_layout.c
    branches/cycles/source/blender/editors/interface/interface_panel.c
    branches/cycles/source/blender/editors/interface/interface_widgets.c
    branches/cycles/source/blender/editors/interface/view2d.c
    branches/cycles/source/blender/editors/object/object_add.c
    branches/cycles/source/blender/editors/render/render_preview.c
    branches/cycles/source/blender/editors/render/render_shading.c
    branches/cycles/source/blender/editors/screen/area.c
    branches/cycles/source/blender/editors/space_buttons/buttons_header.c
    branches/cycles/source/blender/editors/space_buttons/buttons_intern.h
    branches/cycles/source/blender/editors/space_buttons/space_buttons.c
    branches/cycles/source/blender/editors/space_node/CMakeLists.txt
    branches/cycles/source/blender/editors/space_node/drawnode.c
    branches/cycles/source/blender/editors/space_node/node_draw.c
    branches/cycles/source/blender/editors/space_node/node_edit.c
    branches/cycles/source/blender/editors/space_node/node_header.c
    branches/cycles/source/blender/editors/space_node/node_intern.h
    branches/cycles/source/blender/editors/space_node/node_ops.c
    branches/cycles/source/blender/editors/space_node/space_node.c
    branches/cycles/source/blender/editors/space_view3d/drawobject.c
    branches/cycles/source/blender/editors/space_view3d/space_view3d.c
    branches/cycles/source/blender/editors/space_view3d/view3d_draw.c
    branches/cycles/source/blender/makesdna/DNA_ID.h
    branches/cycles/source/blender/makesdna/DNA_image_types.h
    branches/cycles/source/blender/makesdna/DNA_lamp_types.h
    branches/cycles/source/blender/makesdna/DNA_node_types.h
    branches/cycles/source/blender/makesdna/DNA_object_types.h
    branches/cycles/source/blender/makesdna/DNA_space_types.h
    branches/cycles/source/blender/makesdna/DNA_view3d_types.h
    branches/cycles/source/blender/makesdna/DNA_world_types.h
    branches/cycles/source/blender/makesrna/RNA_access.h
    branches/cycles/source/blender/makesrna/RNA_define.h
    branches/cycles/source/blender/makesrna/RNA_types.h
    branches/cycles/source/blender/makesrna/intern/CMakeLists.txt
    branches/cycles/source/blender/makesrna/intern/makesrna.c
    branches/cycles/source/blender/makesrna/intern/rna_ID.c
    branches/cycles/source/blender/makesrna/intern/rna_access.c
    branches/cycles/source/blender/makesrna/intern/rna_animation.c
    branches/cycles/source/blender/makesrna/intern/rna_define.c
    branches/cycles/source/blender/makesrna/intern/rna_internal.h
    branches/cycles/source/blender/makesrna/intern/rna_internal_types.h
    branches/cycles/source/blender/makesrna/intern/rna_lamp.c
    branches/cycles/source/blender/makesrna/intern/rna_main_api.c
    branches/cycles/source/blender/makesrna/intern/rna_material.c
    branches/cycles/source/blender/makesrna/intern/rna_nodetree.c
    branches/cycles/source/blender/makesrna/intern/rna_nodetree_types.h
    branches/cycles/source/blender/makesrna/intern/rna_object_api.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/makesrna/intern/rna_ui.c
    branches/cycles/source/blender/makesrna/intern/rna_ui_api.c
    branches/cycles/source/blender/makesrna/intern/rna_wm.c
    branches/cycles/source/blender/makesrna/intern/rna_world.c
    branches/cycles/source/blender/modifiers/intern/MOD_subsurf.c
    branches/cycles/source/blender/nodes/CMakeLists.txt
    branches/cycles/source/blender/nodes/SHD_node.h
    branches/cycles/source/blender/nodes/intern/SHD_nodes/SHD_geom.c
    branches/cycles/source/blender/nodes/intern/SHD_nodes/SHD_hueSatVal.c
    branches/cycles/source/blender/nodes/intern/SHD_nodes/SHD_math.c
    branches/cycles/source/blender/python/intern/bpy_rna.c
    branches/cycles/source/blender/render/CMakeLists.txt
    branches/cycles/source/blender/render/SConscript
    branches/cycles/source/blender/render/extern/include/RE_pipeline.h
    branches/cycles/source/blender/render/intern/source/pipeline.c
    branches/cycles/source/blender/windowmanager/intern/wm_draw.c
    branches/cycles/source/blender/windowmanager/intern/wm_event_system.c
    branches/cycles/source/creator/CMakeLists.txt

Added Paths:
-----------
    branches/cycles/source/blender/editors/interface/interface_node.c
    branches/cycles/source/blender/editors/space_node/node_layout.c
    branches/cycles/source/blender/nodes/intern/SHD_nodes/SHD_add_closure.c
    branches/cycles/source/blender/nodes/intern/SHD_nodes/SHD_attribute.c
    branches/cycles/source/blender/nodes/intern/SHD_nodes/SHD_background.c
    branches/cycles/source/blender/nodes/intern/SHD_nodes/SHD_bsdf_anisotropic.c
    branches/cycles/source/blender/nodes/intern/SHD_nodes/SHD_bsdf_diffuse.c
    branches/cycles/source/blender/nodes/intern/SHD_nodes/SHD_bsdf_glass.c
    branches/cycles/source/blender/nodes/intern/SHD_nodes/SHD_bsdf_glossy.c
    branches/cycles/source/blender/nodes/intern/SHD_nodes/SHD_bsdf_translucent.c
    branches/cycles/source/blender/nodes/intern/SHD_nodes/SHD_bsdf_transparent.c
    branches/cycles/source/blender/nodes/intern/SHD_nodes/SHD_bsdf_velvet.c
    branches/cycles/source/blender/nodes/intern/SHD_nodes/SHD_emission.c
    branches/cycles/source/blender/nodes/intern/SHD_nodes/SHD_fresnel.c
    branches/cycles/source/blender/nodes/intern/SHD_nodes/SHD_geometry.c
    branches/cycles/source/blender/nodes/intern/SHD_nodes/SHD_light_path.c
    branches/cycles/source/blender/nodes/intern/SHD_nodes/SHD_mix_closure.c
    branches/cycles/source/blender/nodes/intern/SHD_nodes/SHD_output_lamp.c
    branches/cycles/source/blender/nodes/intern/SHD_nodes/SHD_output_material.c
    branches/cycles/source/blender/nodes/intern/SHD_nodes/SHD_output_world.c
    branches/cycles/source/blender/nodes/intern/SHD_nodes/SHD_tex_blend.c
    branches/cycles/source/blender/nodes/intern/SHD_nodes/SHD_tex_clouds.c
    branches/cycles/source/blender/nodes/intern/SHD_nodes/SHD_tex_coord.c
    branches/cycles/source/blender/nodes/intern/SHD_nodes/SHD_tex_distnoise.c
    branches/cycles/source/blender/nodes/intern/SHD_nodes/SHD_tex_environment.c
    branches/cycles/source/blender/nodes/intern/SHD_nodes/SHD_tex_image.c
    branches/cycles/source/blender/nodes/intern/SHD_nodes/SHD_tex_magic.c
    branches/cycles/source/blender/nodes/intern/SHD_nodes/SHD_tex_marble.c
    branches/cycles/source/blender/nodes/intern/SHD_nodes/SHD_tex_musgrave.c
    branches/cycles/source/blender/nodes/intern/SHD_nodes/SHD_tex_noise.c
    branches/cycles/source/blender/nodes/intern/SHD_nodes/SHD_tex_sky.c
    branches/cycles/source/blender/nodes/intern/SHD_nodes/SHD_tex_stucci.c
    branches/cycles/source/blender/nodes/intern/SHD_nodes/SHD_tex_voronoi.c
    branches/cycles/source/blender/nodes/intern/SHD_nodes/SHD_tex_wood.c

Modified: branches/cycles/CMakeLists.txt
===================================================================
--- branches/cycles/CMakeLists.txt	2011-04-27 13:13:07 UTC (rev 36354)
+++ branches/cycles/CMakeLists.txt	2011-04-27 14:36:02 UTC (rev 36355)
@@ -90,6 +90,7 @@
 
 set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin CACHE INTERNAL "" FORCE )
 set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/lib CACHE INTERNAL "" FORCE )
+set(INCLUDE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/include CACHE INTERNAL "" FORCE )
 
 #-----------------------------------------------------------------------------
 # Load some macros.
@@ -170,6 +171,7 @@
 	option(WITH_INSTALL_PORTABLE "Install redistributeable runtime, otherwise install into CMAKE_INSTALL_PREFIX" ON)
 endif()
 option(WITH_PYTHON_INSTALL       "Copy system python into the blender install folder" ON)
+option(WITH_API_INSTALL     "Copy API header files into the blender install folder" ON)
 
 # Debug
 option(WITH_CXX_GUARDEDALLOC "Enable GuardedAlloc for C++ memory allocation tracking (only enable for development)" OFF)

Modified: branches/cycles/intern/cycles/device/device_network.cpp
===================================================================
--- branches/cycles/intern/cycles/device/device_network.cpp	2011-04-27 13:13:07 UTC (rev 36354)
+++ branches/cycles/intern/cycles/device/device_network.cpp	2011-04-27 14:36:02 UTC (rev 36355)
@@ -24,6 +24,8 @@
 
 CCL_NAMESPACE_BEGIN
 
+#ifdef WITH_NETWORK
+
 class NetworkDevice : public Device
 {
 public:
@@ -378,5 +380,7 @@
 	}
 }
 
+#endif
+
 CCL_NAMESPACE_END
 

Modified: branches/cycles/intern/guardedalloc/MEM_guardedalloc.h
===================================================================
--- branches/cycles/intern/guardedalloc/MEM_guardedalloc.h	2011-04-27 13:13:07 UTC (rev 36354)
+++ branches/cycles/intern/guardedalloc/MEM_guardedalloc.h	2011-04-27 14:36:02 UTC (rev 36355)
@@ -61,6 +61,14 @@
 #ifndef MEM_MALLOCN_H
 #define MEM_MALLOCN_H
 
+#ifndef LIBEXPORT
+#ifdef _WIN32
+#define LIBEXPORT __declspec(dllexport)
+#else
+#define LIBEXPORT
+#endif
+#endif
+
 #include <stdio.h> /* needed for FILE* */
 #include "MEM_sys_types.h" /* needed for uintptr_t */
 
@@ -95,7 +103,7 @@
 	/**
 	 * Duplicates a block of memory, and returns a pointer to the
 	 * newly allocated block.  */
-	void *MEM_dupallocN(void *vmemh) WARN_UNUSED;
+	LIBEXPORT void *MEM_dupallocN(void *vmemh) WARN_UNUSED;
 
 	/**
 	  * Reallocates a block of memory, and returns pointer to the newly

Modified: branches/cycles/release/scripts/startup/bl_ui/properties_particle.py
===================================================================
--- branches/cycles/release/scripts/startup/bl_ui/properties_particle.py	2011-04-27 13:13:07 UTC (rev 36354)
+++ branches/cycles/release/scripts/startup/bl_ui/properties_particle.py	2011-04-27 14:36:02 UTC (rev 36355)
@@ -51,7 +51,7 @@
     if not settings:
         return False
 
-    return settings.is_fluid == False and (engine in cls.COMPAT_ENGINES)
+    return settings.is_fluid == False
 
 
 def particle_get_settings(context):
@@ -75,12 +75,11 @@
 class PARTICLE_PT_context_particles(ParticleButtonsPanel, bpy.types.Panel):
     bl_label = ""
     bl_options = {'HIDE_HEADER'}
-    COMPAT_ENGINES = {'BLENDER_RENDER'}
 
     @classmethod
     def poll(cls, context):
         engine = context.scene.render.engine
-        return (context.particle_system or context.object or context.space_data.pin_id) and (engine in cls.COMPAT_ENGINES)
+        return (context.particle_system or context.object or context.space_data.pin_id)
 
     def draw(self, context):
         layout = self.layout
@@ -180,7 +179,6 @@
 
 class PARTICLE_PT_emission(ParticleButtonsPanel, bpy.types.Panel):
     bl_label = "Emission"
-    COMPAT_ENGINES = {'BLENDER_RENDER'}
 
     @classmethod
     def poll(cls, context):
@@ -250,7 +248,6 @@
 class PARTICLE_PT_hair_dynamics(ParticleButtonsPanel, bpy.types.Panel):
     bl_label = "Hair dynamics"
     bl_options = {'DEFAULT_CLOSED'}
-    COMPAT_ENGINES = {'BLENDER_RENDER'}
 
     @classmethod
     def poll(cls, context):
@@ -260,7 +257,7 @@
             return False
         if psys.settings is None:
             return False
-        return psys.settings.type == 'HAIR' and (engine in cls.COMPAT_ENGINES)
+        return psys.settings.type == 'HAIR'
 
     def draw_header(self, context):
         #cloth = context.cloth.collision_settings
@@ -306,7 +303,6 @@
 class PARTICLE_PT_cache(ParticleButtonsPanel, bpy.types.Panel):
     bl_label = "Cache"
     bl_options = {'DEFAULT_CLOSED'}
-    COMPAT_ENGINES = {'BLENDER_RENDER'}
 
     @classmethod
     def poll(cls, context):
@@ -321,7 +317,7 @@
         phystype = psys.settings.physics_type
         if phystype == 'NO' or phystype == 'KEYED':
             return False
-        return (psys.settings.type in {'EMITTER', 'REACTOR'} or (psys.settings.type == 'HAIR' and (psys.use_hair_dynamics or psys.point_cache.is_baked))) and engine in cls.COMPAT_ENGINES
+        return (psys.settings.type in {'EMITTER', 'REACTOR'} or (psys.settings.type == 'HAIR' and (psys.use_hair_dynamics or psys.point_cache.is_baked)))
 
     def draw(self, context):
         psys = context.particle_system
@@ -331,7 +327,6 @@
 
 class PARTICLE_PT_velocity(ParticleButtonsPanel, bpy.types.Panel):
     bl_label = "Velocity"
-    COMPAT_ENGINES = {'BLENDER_RENDER'}
 
     @classmethod
     def poll(cls, context):
@@ -381,7 +376,6 @@
 
 class PARTICLE_PT_rotation(ParticleButtonsPanel, bpy.types.Panel):
     bl_label = "Rotation"
-    COMPAT_ENGINES = {'BLENDER_RENDER'}
 
     @classmethod
     def poll(cls, context):
@@ -430,7 +424,6 @@
 
 class PARTICLE_PT_physics(ParticleButtonsPanel, bpy.types.Panel):
     bl_label = "Physics"
-    COMPAT_ENGINES = {'BLENDER_RENDER'}
 
     @classmethod
     def poll(cls, context):
@@ -645,7 +638,6 @@
 
 class PARTICLE_PT_boidbrain(ParticleButtonsPanel, bpy.types.Panel):
     bl_label = "Boid Brain"
-    COMPAT_ENGINES = {'BLENDER_RENDER'}
 
     @classmethod
     def poll(cls, context):
@@ -657,7 +649,7 @@
             return False
         if psys != None and psys.point_cache.use_external:
             return False
-        return settings.physics_type == 'BOIDS' and engine in cls.COMPAT_ENGINES
+        return settings.physics_type == 'BOIDS'
 
     def draw(self, context):
         layout = self.layout
@@ -746,7 +738,6 @@
 
 class PARTICLE_PT_render(ParticleButtonsPanel, bpy.types.Panel):
     bl_label = "Render"
-    COMPAT_ENGINES = {'BLENDER_RENDER'}
 
     @classmethod
     def poll(cls, context):
@@ -755,7 +746,7 @@
         if settings is None:
             return False
 
-        return engine in cls.COMPAT_ENGINES
+        return True
 
     def draw(self, context):
         layout = self.layout
@@ -923,7 +914,6 @@
 class PARTICLE_PT_draw(ParticleButtonsPanel, bpy.types.Panel):
     bl_label = "Display"
     bl_options = {'DEFAULT_CLOSED'}
-    COMPAT_ENGINES = {'BLENDER_RENDER'}
 
     @classmethod
     def poll(cls, context):
@@ -931,7 +921,7 @@
         engine = context.scene.render.engine
         if settings is None:
             return False
-        return engine in cls.COMPAT_ENGINES
+        return True
 
     def draw(self, context):
         layout = self.layout
@@ -985,7 +975,6 @@
 class PARTICLE_PT_children(ParticleButtonsPanel, bpy.types.Panel):
     bl_label = "Children"
     bl_options = {'DEFAULT_CLOSED'}
-    COMPAT_ENGINES = {'BLENDER_RENDER'}
 
     @classmethod
     def poll(cls, context):
@@ -1085,7 +1074,6 @@
 class PARTICLE_PT_field_weights(ParticleButtonsPanel, bpy.types.Panel):
     bl_label = "Field Weights"
     bl_options = {'DEFAULT_CLOSED'}
-    COMPAT_ENGINES = {'BLENDER_RENDER'}
 
     @classmethod
     def poll(cls, context):
@@ -1106,7 +1094,6 @@
 class PARTICLE_PT_force_fields(ParticleButtonsPanel, bpy.types.Panel):
     bl_label = "Force Field Settings"
     bl_options = {'DEFAULT_CLOSED'}
-    COMPAT_ENGINES = {'BLENDER_RENDER'}
 
     def draw(self, context):
         layout = self.layout
@@ -1140,7 +1127,6 @@
 class PARTICLE_PT_vertexgroups(ParticleButtonsPanel, bpy.types.Panel):
     bl_label = "Vertexgroups"
     bl_options = {'DEFAULT_CLOSED'}
-    COMPAT_ENGINES = {'BLENDER_RENDER'}
 
     @classmethod
     def poll(cls, context):
@@ -1209,7 +1195,6 @@
 
 
 class PARTICLE_PT_custom_props(ParticleButtonsPanel, PropertyPanel, bpy.types.Panel):
-    COMPAT_ENGINES = {'BLENDER_RENDER'}
     _context_path = "particle_system.settings"
     _property_type = bpy.types.ParticleSettings
 

Modified: branches/cycles/release/scripts/startup/bl_ui/space_node.py
===================================================================
--- branches/cycles/release/scripts/startup/bl_ui/space_node.py	2011-04-27 13:13:07 UTC (rev 36354)
+++ branches/cycles/release/scripts/startup/bl_ui/space_node.py	2011-04-27 14:36:02 UTC (rev 36355)
@@ -41,14 +41,17 @@
         row = layout.row()
         row.prop(snode, "tree_type", text="", expand=True)
 
-        if snode.tree_type == 'MATERIAL':
-            ob = snode.id_from
-            snode_id = snode.id
-            if ob:
-                layout.template_ID(ob, "active_material", new="material.new")
-            if snode_id:
-                layout.prop(snode_id, "use_nodes")
+        if snode.tree_type == 'SHADER':
+            row.prop(snode, "shader_type", text="", expand=True)
 
+            if snode.shader_type == 'OBJECT':
+                ob = snode.id_from
+                snode_id = snode.id
+                if ob:
+                    layout.template_ID(ob, "active_material", new="material.new")
+                if snode_id:
+                    layout.prop(snode_id, "use_nodes")
+
         elif snode.tree_type == 'TEXTURE':
             row.prop(snode, "texture_type", text="", expand=True)
 

Modified: branches/cycles/source/blender/blenkernel/BKE_depsgraph.h
===================================================================
--- branches/cycles/source/blender/blenkernel/BKE_depsgraph.h	2011-04-27 13:13:07 UTC (rev 36354)
+++ branches/cycles/source/blender/blenkernel/BKE_depsgraph.h	2011-04-27 14:36:02 UTC (rev 36355)
@@ -121,6 +121,10 @@
 void	DAG_id_tag_update(struct ID *id, short flag);
 		/* flush all tagged updates */
 void	DAG_ids_flush_tagged(struct Main *bmain);
+		/* clear ID recalc flags */
+void	DAG_ids_clear_recalc(struct Main *bmain);
+		/* test if any of this id type is tagged for update */
+int		DAG_id_type_tagged(struct Main *bmain, short idtype);
 

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list