2.5 3DView Properties Panel:
authorThomas Dinges <blender@dingto.org>
Fri, 24 Jul 2009 22:09:30 +0000 (22:09 +0000)
committerThomas Dinges <blender@dingto.org>
Fri, 24 Jul 2009 22:09:30 +0000 (22:09 +0000)
* Some Code cleanup.
* Added 3-Split Operator into the panel and some options (which don't work yet)
* Added RNA for RegionView3D lock and box options.

release/ui/space_view3d.py
source/blender/makesrna/intern/rna_space.c

index 4d5d7a03c0753e7252edf99c26325f148f42f359..e21d585a14d7e34306ecef82fe0915ecf030eea9 100644 (file)
@@ -1,6 +1,25 @@
 
 import bpy
 
+# ********** Header ****************
+
+class VIEW3D_HT_header(bpy.types.Header):
+       __space_type__ = "VIEW_3D"
+
+       def draw(self, context):
+               layout = self.layout
+
+               layout.template_header()
+
+               # menus
+               if context.area.show_menus:
+                       row = layout.row()
+                       row.itemM("VIEW3D_MT_view")
+
+               layout.template_header_3D()
+
+# ********** Menu ****************
+
 class VIEW3D_MT_view_navigation(bpy.types.Menu):
        __space_type__ = "VIEW_3D"
        __label__ = "Navigation"
@@ -76,20 +95,7 @@ class VIEW3D_MT_view(bpy.types.Menu):
                layout.itemO("screen.region_foursplit", text="Toggle Quad View")
                layout.itemO("screen.screen_full_area", text="Toggle Full Screen")
 
-class VIEW3D_HT_header(bpy.types.Header):
-       __space_type__ = "VIEW_3D"
-
-       def draw(self, context):
-               layout = self.layout
-
-               layout.template_header()
-
-               # menus
-               if context.area.show_menus:
-                       row = layout.row()
-                       row.itemM("VIEW3D_MT_view")
-
-               layout.template_header_3D()
+# ********** Panel ****************
 
 class VIEW3D_PT_3dview_properties(bpy.types.Panel):
        __space_type__ = "VIEW_3D"
@@ -101,17 +107,19 @@ class VIEW3D_PT_3dview_properties(bpy.types.Panel):
                return (view)
 
        def draw(self, context):
+               layout = self.layout
+               
                view = context.space_data
                scene = context.scene
-               layout = self.layout
                
-               split = layout.split()
-               col = split.column()
+               col = layout.column()
                col.itemR(view, "camera")
                col.itemR(view, "lens")
+               
                col.itemL(text="Clip:")
                col.itemR(view, "clip_start", text="Start")
                col.itemR(view, "clip_end", text="End")
+               
                col.itemL(text="Grid:")
                col.itemR(view, "grid_spacing", text="Spacing")
                col.itemR(view, "grid_subdivisions", text="Subdivisions")
@@ -127,11 +135,10 @@ class VIEW3D_PT_3dview_display(bpy.types.Panel):
                return (view)
 
        def draw(self, context):
-               view = context.space_data
                layout = self.layout
+               view = context.space_data
                
-               split = layout.split()
-               col = split.column()
+               col = layout.column()
                col.itemR(view, "display_floor", text="Grid Floor")
                col.itemR(view, "display_x_axis", text="X Axis")
                col.itemR(view, "display_y_axis", text="Y Axis")
@@ -140,11 +147,21 @@ class VIEW3D_PT_3dview_display(bpy.types.Panel):
                col.itemR(view, "all_object_centers")
                col.itemR(view, "relationship_lines")
                col.itemR(view, "textured_solid")
-                       
+               
+               layout.itemS()
+               
+               layout.itemO("screen.region_foursplit")
+               
+               col = layout.column()
+               col.itemR(view, "lock_rotation")
+               col.itemR(view, "box_preview")
+               col.itemR(view, "box_clip")
+       
 class VIEW3D_PT_background_image(bpy.types.Panel):
        __space_type__ = "VIEW_3D"
        __region_type__ = "UI"
        __label__ = "Background Image"
+       __default_closed__ = True
 
        def poll(self, context):
                view = context.space_data
@@ -158,9 +175,10 @@ class VIEW3D_PT_background_image(bpy.types.Panel):
                layout.itemR(view, "display_background_image", text="")
 
        def draw(self, context):
+               layout = self.layout
+               
                view = context.space_data
                bg = context.space_data.background_image
-               layout = self.layout
                
                layout.active = view.display_background_image
                split = layout.split()
@@ -179,5 +197,3 @@ bpy.types.register(VIEW3D_HT_header)
 bpy.types.register(VIEW3D_PT_3dview_properties)
 bpy.types.register(VIEW3D_PT_3dview_display)
 bpy.types.register(VIEW3D_PT_background_image)
-
-
index 2afa1e6102bfda359690678b5be8b58de11b3c7d..f04f3b7be68f69ce846b9ca8f87192c82bdc8152 100644 (file)
@@ -646,7 +646,18 @@ static void rna_def_space_3dview(BlenderRNA *brna)
        RNA_def_property_enum_items(prop, transform_orientation_items);
        RNA_def_property_ui_text(prop, "Transform Orientation", "The alignment of manipulator handles.");
        RNA_def_property_update(prop, NC_OBJECT|ND_TRANSFORM, NULL);
+
+       prop= RNA_def_property(srna, "lock_rotation", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_sdna(prop, "RegionView3D", "viewlock", RV3D_LOCKED);
+       RNA_def_property_ui_text(prop, "Lock", "Lock View Rotation");
+       
+       prop= RNA_def_property(srna, "box_preview", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_sdna(prop, "RegionView3D", "viewlock", RV3D_BOXVIEW);
+       RNA_def_property_ui_text(prop, "Box", "");
        
+       prop= RNA_def_property(srna, "box_clip", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_sdna(prop, "RegionView3D", "viewlock", RV3D_BOXCLIP);
+       RNA_def_property_ui_text(prop, "Clip", "");
 }
 
 static void rna_def_space_buttons(BlenderRNA *brna)