diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2012-06-25 15:43:22 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2012-06-25 15:43:22 +0400 |
commit | 3271850a2f59cdcae4bb224522e67b986b8cb9fd (patch) | |
tree | d16f744b2a863f3a7b215d97888ca7bcf8778864 | |
parent | ae797383b76a4489139b0152a6084b5dd4de2ba3 (diff) |
Fix cycles not working in 3d local view, and missing update when toggling hiding
in the outliner.
-rw-r--r-- | intern/cycles/blender/blender_object.cpp | 2 | ||||
-rw-r--r-- | intern/cycles/blender/blender_sync.cpp | 2 | ||||
-rw-r--r-- | intern/cycles/blender/blender_util.h | 22 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/view3d_view.c | 4 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_object.c | 21 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_space.c | 6 |
6 files changed, 52 insertions, 5 deletions
diff --git a/intern/cycles/blender/blender_object.cpp b/intern/cycles/blender/blender_object.cpp index d5b884cfccd..a928bd9a6ea 100644 --- a/intern/cycles/blender/blender_object.cpp +++ b/intern/cycles/blender/blender_object.cpp @@ -305,7 +305,7 @@ void BlenderSync::sync_objects(BL::SpaceView3D b_v3d, int motion) for(; b_sce; b_sce = b_sce.background_set()) { for(b_sce.objects.begin(b_ob); b_ob != b_sce.objects.end(); ++b_ob) { bool hide = (render_layer.use_viewport_visibility)? b_ob->hide(): b_ob->hide_render(); - uint ob_layer = get_layer(b_ob->layers()); + uint ob_layer = get_layer(b_ob->layers(), b_ob->layers_local_view(), object_is_light(*b_ob)); hide = hide || !(ob_layer & scene_layer); if(!hide) { diff --git a/intern/cycles/blender/blender_sync.cpp b/intern/cycles/blender/blender_sync.cpp index 5640a411fd7..c9d2d68da0a 100644 --- a/intern/cycles/blender/blender_sync.cpp +++ b/intern/cycles/blender/blender_sync.cpp @@ -219,7 +219,7 @@ void BlenderSync::sync_render_layers(BL::SpaceView3D b_v3d, const char *layer) layer = layername.c_str(); } else { - render_layer.scene_layer = get_layer(b_v3d.layers()); + render_layer.scene_layer = get_layer(b_v3d.layers(), b_v3d.layers_local_view()); render_layer.layer = render_layer.scene_layer; render_layer.holdout_layer = 0; render_layer.material_override = PointerRNA_NULL; diff --git a/intern/cycles/blender/blender_util.h b/intern/cycles/blender/blender_util.h index b5a76836bed..ebbd4e1221c 100644 --- a/intern/cycles/blender/blender_util.h +++ b/intern/cycles/blender/blender_util.h @@ -166,6 +166,28 @@ static inline uint get_layer(BL::Array<int, 20> array) return layer; } +static inline uint get_layer(BL::Array<int, 20> array, BL::Array<int, 8> local_array, bool is_light = false) +{ + uint layer = 0; + + for(uint i = 0; i < 20; i++) + if(array[i]) + layer |= (1 << i); + + if(is_light) { + /* consider lamps on all local view layers */ + for(uint i = 0; i < 8; i++) + layer |= (1 << (20+i)); + } + else { + for(uint i = 0; i < 8; i++) + if(local_array[i]) + layer |= (1 << (20+i)); + } + + return layer; +} + #if 0 static inline float3 get_float3(PointerRNA& ptr, const char *name) { diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c index 8fb012a18d6..4782b95ba1c 100644 --- a/source/blender/editors/space_view3d/view3d_view.c +++ b/source/blender/editors/space_view3d/view3d_view.c @@ -1564,13 +1564,15 @@ static void endlocalview(Main *bmain, Scene *scene, ScrArea *sa) static int localview_exec(bContext *C, wmOperator *UNUSED(unused)) { + Main *bmain = CTX_data_main(C); View3D *v3d = CTX_wm_view3d(C); if (v3d->localvd) endlocalview(CTX_data_main(C), CTX_data_scene(C), CTX_wm_area(C)); else initlocalview(CTX_data_main(C), CTX_data_scene(C), CTX_wm_area(C)); - + + DAG_id_type_tag(bmain, ID_OB); ED_area_tag_redraw(CTX_wm_area(C)); return OPERATOR_FINISHED; diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c index 0399a8ee60d..5072bda7508 100644 --- a/source/blender/makesrna/intern/rna_object.c +++ b/source/blender/makesrna/intern/rna_object.c @@ -174,6 +174,11 @@ static void rna_Object_matrix_world_update(Main *bmain, Scene *scene, PointerRNA rna_Object_internal_update(bmain, scene, ptr); } +static void rna_Object_hide_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *UNUSED(ptr)) +{ + DAG_id_type_tag(bmain, ID_OB); +} + static void rna_Object_matrix_local_get(PointerRNA *ptr, float values[16]) { Object *ob = ptr->id.data; @@ -1971,6 +1976,12 @@ static void rna_def_object(BlenderRNA *brna) RNA_def_property_flag(prop, PROP_LIB_EXCEPTION); RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_layer_update"); + prop = RNA_def_property(srna, "layers_local_view", PROP_BOOLEAN, PROP_LAYER_MEMBER); + RNA_def_property_boolean_sdna(prop, NULL, "lay", 0x01000000); + RNA_def_property_array(prop, 8); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Local View Layers", "3D local view layers the object is on"); + prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", SELECT); RNA_def_property_ui_text(prop, "Select", "Object selection state"); @@ -2308,7 +2319,7 @@ static void rna_def_object(BlenderRNA *brna) RNA_def_property_boolean_sdna(prop, NULL, "restrictflag", OB_RESTRICT_VIEW); RNA_def_property_ui_text(prop, "Restrict View", "Restrict visibility in the viewport"); RNA_def_property_ui_icon(prop, ICON_RESTRICT_VIEW_OFF, 1); - RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL); + RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_hide_update"); prop = RNA_def_property(srna, "hide_select", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "restrictflag", OB_RESTRICT_SELECT); @@ -2320,7 +2331,7 @@ static void rna_def_object(BlenderRNA *brna) RNA_def_property_boolean_sdna(prop, NULL, "restrictflag", OB_RESTRICT_RENDER); RNA_def_property_ui_text(prop, "Restrict Render", "Restrict renderability"); RNA_def_property_ui_icon(prop, ICON_RESTRICT_RENDER_OFF, 1); - RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL); + RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_hide_update"); /* anim */ rna_def_animdata_common(srna); @@ -2579,6 +2590,12 @@ static void rna_def_object_base(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Layers", "Layers the object base is on"); RNA_def_property_boolean_funcs(prop, NULL, "rna_Base_layer_set"); RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Base_layer_update"); + + prop = RNA_def_property(srna, "layers_local_view", PROP_BOOLEAN, PROP_LAYER_MEMBER); + RNA_def_property_boolean_sdna(prop, NULL, "lay", 0x01000000); + RNA_def_property_array(prop, 8); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Local View Layers", "3D local view layers the object base is on"); prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", BA_SELECT); diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index 661c7ba878c..e4af06a5012 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -1699,6 +1699,12 @@ static void rna_def_space_view3d(BlenderRNA *brna) RNA_def_property_boolean_funcs(prop, NULL, "rna_SpaceView3D_layer_set"); RNA_def_property_ui_text(prop, "Visible Layers", "Layers visible in this 3D View"); RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, "rna_SpaceView3D_layer_update"); + + prop = RNA_def_property(srna, "layers_local_view", PROP_BOOLEAN, PROP_LAYER_MEMBER); + RNA_def_property_boolean_sdna(prop, NULL, "lay", 0x01000000); + RNA_def_property_array(prop, 8); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Local View Layers", "Local view layers visible in this 3D View"); prop = RNA_def_property(srna, "layers_used", PROP_BOOLEAN, PROP_LAYER_MEMBER); RNA_def_property_boolean_sdna(prop, NULL, "lay_used", 1); |