Fix #29848: cycles not respecting dupli group visible layers, also exposed
authorBrecht Van Lommel <brechtvanlommel@pandora.be>
Wed, 11 Jan 2012 13:55:00 +0000 (13:55 +0000)
committerBrecht Van Lommel <brechtvanlommel@pandora.be>
Wed, 11 Jan 2012 13:55:00 +0000 (13:55 +0000)
DupliObject.hide property in API now.

intern/cycles/blender/blender_object.cpp
source/blender/makesrna/intern/rna_object.c

index caf5b0a99b1b5bf0fbdcfc7868e1a6160eae167a..608cb33eadde8bf694ff4f587732c1e39ac6b8de 100644 (file)
@@ -228,7 +228,12 @@ void BlenderSync::sync_objects(BL::SpaceView3D b_v3d)
 
                                for(b_ob->dupli_list.begin(b_dup); b_dup != b_ob->dupli_list.end(); ++b_dup) {
                                        Transform tfm = get_transform(b_dup->matrix());
-                                       sync_object(*b_ob, b_index, b_dup->object(), tfm, ob_layer);
+                                       BL::Object b_dup_ob = b_dup->object();
+                                       bool dup_hide = (b_v3d)? b_dup_ob.hide(): b_dup_ob.hide_render();
+
+                                       if(!(b_dup->hide() || dup_hide))
+                                               sync_object(*b_ob, b_index, b_dup_ob, tfm, ob_layer);
+
                                        b_index++;
                                }
 
index f9bb0b36a3f14103f14f597e0b3ae9bee648aacc..3ec01e56ab37b3a61d2f64860ed711f85c252fb1 100644 (file)
@@ -2447,15 +2447,20 @@ static void rna_def_dupli_object(BlenderRNA *brna)
        prop= RNA_def_property(srna, "matrix_original", PROP_FLOAT, PROP_MATRIX);
        RNA_def_property_float_sdna(prop, NULL, "omat");
        RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_4x4);
-       RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+       RNA_def_property_clear_flag(prop, PROP_ANIMATABLE|PROP_EDITABLE);
        RNA_def_property_ui_text(prop, "Object Matrix", "The original matrix of this object before it was duplicated");
 
        prop= RNA_def_property(srna, "matrix", PROP_FLOAT, PROP_MATRIX);
        RNA_def_property_float_sdna(prop, NULL, "mat");
        RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_4x4);
-       RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+       RNA_def_property_clear_flag(prop, PROP_ANIMATABLE|PROP_EDITABLE);
        RNA_def_property_ui_text(prop, "Object Duplicate Matrix", "Object duplicate transformation matrix");
 
+       prop= RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_sdna(prop, NULL, "no_draw", 0);
+       RNA_def_property_clear_flag(prop, PROP_ANIMATABLE|PROP_EDITABLE);
+       RNA_def_property_ui_text(prop, "Hide", "Don't show dupli object in viewport or render");
+
        /* TODO: DupliObject has more properties that can be wrapped */
 }