Cycles: add Use Surfaces and Use Hair option to render layers, to disable rendering
authorBrecht Van Lommel <brechtvanlommel@pandora.be>
Fri, 10 May 2013 13:34:49 +0000 (13:34 +0000)
committerBrecht Van Lommel <brechtvanlommel@pandora.be>
Fri, 10 May 2013 13:34:49 +0000 (13:34 +0000)
of hair and surfaces, similar to blender internal options.

intern/cycles/blender/addon/ui.py
intern/cycles/blender/blender_mesh.cpp
intern/cycles/blender/blender_sync.cpp
intern/cycles/blender/blender_sync.h

index c3a717e0956564f0d700cbab4e776471cd844871..b9e71a29f6ccc654cd1ed7a55bbe8481afc6eb51 100644 (file)
@@ -300,10 +300,13 @@ class CyclesRender_PT_layer_options(CyclesButtonsPanel, Panel):
         col = split.column()
         col.label(text="Material:")
         col.prop(rl, "material_override", text="")
+        col.separator()
+        col.prop(rl, "samples")
 
         col = split.column()
-        col.prop(rl, "samples")
         col.prop(rl, "use_sky", "Use Environment")
+        col.prop(rl, "use_solid", "Use Surfaces")
+        col.prop(rl, "use_strand", "Use Hair")
 
 
 class CyclesRender_PT_layer_passes(CyclesButtonsPanel, Panel):
index 8de4fa1a114771eaacdd20ac841613c5925385ed..7f02bc68e6b511869240cef7dcfa03b5e92cccd7 100644 (file)
@@ -442,31 +442,35 @@ Mesh *BlenderSync::sync_mesh(BL::Object b_ob, bool object_updated, bool hide_tri
 
        /* create derived mesh */
        bool need_undeformed = mesh->need_attribute(scene, ATTR_STD_GENERATED);
-       BL::Mesh b_mesh = object_to_mesh(b_data, b_ob, b_scene, true, !preview, need_undeformed);
        PointerRNA cmesh = RNA_pointer_get(&b_ob_data.ptr, "cycles");
 
        vector<Mesh::Triangle> oldtriangle = mesh->triangles;
        
-       /* compares curve_keys rather than strands in order to handle quick hair adjustsments in dynamic BVH - other methods could probably do this better*/
+       /* compares curve_keys rather than strands in order to handle quick hair
+        * adjustsments in dynamic BVH - other methods could probably do this better*/
        vector<Mesh::CurveKey> oldcurve_keys = mesh->curve_keys;
 
        mesh->clear();
        mesh->used_shaders = used_shaders;
        mesh->name = ustring(b_ob_data.name().c_str());
 
-       if(b_mesh) {
-               if(!(hide_tris && experimental)) {
-                       if(cmesh.data && experimental && RNA_boolean_get(&cmesh, "use_subdivision"))
-                               create_subd_mesh(mesh, b_mesh, &cmesh, used_shaders);
-                       else
-                               create_mesh(scene, mesh, b_mesh, used_shaders);
-               }
+       if(render_layer.use_surfaces || render_layer.use_hair) {
+               BL::Mesh b_mesh = object_to_mesh(b_data, b_ob, b_scene, true, !preview, need_undeformed);
+
+               if(b_mesh) {
+                       if(render_layer.use_surfaces && !(hide_tris && experimental)) {
+                               if(cmesh.data && experimental && RNA_boolean_get(&cmesh, "use_subdivision"))
+                                       create_subd_mesh(mesh, b_mesh, &cmesh, used_shaders);
+                               else
+                                       create_mesh(scene, mesh, b_mesh, used_shaders);
+                       }
 
-               if(experimental)
-                       sync_curves(mesh, b_mesh, b_ob, object_updated);
+                       if(render_layer.use_hair && experimental)
+                               sync_curves(mesh, b_mesh, b_ob, object_updated);
 
-               /* free derived mesh */
-               b_data.meshes.remove(b_mesh);
+                       /* free derived mesh */
+                       b_data.meshes.remove(b_mesh);
+               }
        }
 
        /* displacement method */
index 501c764873103d793a811624843fce7576376701..90d5e9244c48fe0aec4d3a1e8faa7d600d3b9f45 100644 (file)
@@ -242,6 +242,8 @@ void BlenderSync::sync_render_layers(BL::SpaceView3D b_v3d, const char *layer)
                        render_layer.holdout_layer = 0;
                        render_layer.material_override = PointerRNA_NULL;
                        render_layer.use_background = true;
+                       render_layer.use_hair = true;
+                       render_layer.use_surfaces = true;
                        render_layer.use_viewport_visibility = true;
                        render_layer.samples = 0;
                        render_layer.bound_samples = false;
@@ -270,6 +272,8 @@ void BlenderSync::sync_render_layers(BL::SpaceView3D b_v3d, const char *layer)
 
                        render_layer.material_override = b_rlay->material_override();
                        render_layer.use_background = b_rlay->use_sky();
+                       render_layer.use_surfaces = b_rlay->use_solid();
+                       render_layer.use_hair = b_rlay->use_strand();
                        render_layer.use_viewport_visibility = false;
                        render_layer.use_localview = false;
 
index 43c8906c79996f3958edb19e24e5fcdfc05c6168..5b63042a682a0bc61ca028e98d87846121971342 100644 (file)
@@ -124,6 +124,8 @@ private:
                  holdout_layer(0), exclude_layer(0),
                  material_override(PointerRNA_NULL),
                  use_background(true),
+                 use_surfaces(true),
+                 use_hair(true),
                  use_viewport_visibility(false),
                  samples(0), bound_samples(false)
                {}
@@ -135,6 +137,8 @@ private:
                uint exclude_layer;
                BL::Material material_override;
                bool use_background;
+               bool use_surfaces;
+               bool use_hair;
                bool use_viewport_visibility;
                bool use_localview;
                int samples;