Fix/addition for recent RNA collections active index changes -
authorMatt Ebb <matt@mke3.net>
Wed, 25 Aug 2010 07:03:35 +0000 (07:03 +0000)
committerMatt Ebb <matt@mke3.net>
Wed, 25 Aug 2010 07:03:35 +0000 (07:03 +0000)
added scene render layers.active property and updated UI file

release/scripts/ui/properties_render.py
source/blender/makesrna/intern/rna_scene.c

index 61fea315e2c14052b49ac788b4acaa2a079a36a8..fcd5a229cd9a02bbb06e93d647e337c5a6c617fa 100644 (file)
@@ -84,7 +84,7 @@ class RENDER_PT_layers(RenderButtonsPanel, bpy.types.Panel):
         col.operator("scene.render_layer_add", icon='ZOOMIN', text="")
         col.operator("scene.render_layer_remove", icon='ZOOMOUT', text="")
 
-        rl = rd.layers[rd.active_layer_index]
+        rl = rd.layers.active
 
         if rl:
             layout.prop(rl, "name")
index c3ad05d44f6e3a4c9e76c17987868c184442caa1..6f36ff51c87eebbf680f7563f5454084ff25fbab 100644 (file)
@@ -644,6 +644,22 @@ static void rna_RenderSettings_active_layer_index_range(PointerRNA *ptr, int *mi
        *max= MAX2(0, *max);
 }
 
+static PointerRNA rna_RenderSettings_active_layer_get(PointerRNA *ptr)
+{
+       RenderData *rd= (RenderData*)ptr->data;
+       SceneRenderLayer *srl = BLI_findlink(&rd->layers, rd->actlay);
+       
+       return rna_pointer_inherit_refine(ptr, &RNA_SceneRenderLayer, srl);
+}
+
+static void rna_RenderSettings_active_layer_set(PointerRNA *ptr, PointerRNA value)
+{
+       RenderData *rd= (RenderData*)ptr->data;
+       SceneRenderLayer *srl= (SceneRenderLayer*)value.data;
+       
+       rd->actlay = BLI_findindex(&rd->layers, srl);
+}
+
 static void rna_RenderSettings_engine_set(PointerRNA *ptr, int value)
 {
        RenderData *rd= (RenderData*)ptr->data;
@@ -1817,7 +1833,7 @@ static void rna_def_render_layers(BlenderRNA *brna, PropertyRNA *cprop)
        PropertyRNA *prop;
 
        // FunctionRNA *func;
-       // PropertyRNA *parm;
+       // PropertyRNA *parm; 
 
        RNA_def_property_srna(cprop, "RenderLayers");
        srna= RNA_def_struct(brna, "RenderLayers", NULL);
@@ -1830,7 +1846,13 @@ static void rna_def_render_layers(BlenderRNA *brna, PropertyRNA *cprop)
        RNA_def_property_ui_text(prop, "Active Layer Index", "Active index in render layer array");
        RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
        
-       /* todo - active*/
+       prop= RNA_def_property(srna, "active", PROP_POINTER, PROP_UNSIGNED);
+       RNA_def_property_struct_type(prop, "SceneRenderLayer");
+       RNA_def_property_pointer_funcs(prop, "rna_RenderSettings_active_layer_get", "rna_RenderSettings_active_layer_set", NULL, NULL);
+       RNA_def_property_flag(prop, PROP_EDITABLE);
+       RNA_def_property_ui_text(prop, "Active Render Layer", "Active Render Layer");
+       RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
+
 }
 
 static void rna_def_scene_render_data(BlenderRNA *brna)