From a1403f7fbb65809ac1e7266dcb6a7cf5f8e89451 Mon Sep 17 00:00:00 2001 From: Thomas Dinges Date: Fri, 24 Jul 2009 22:09:30 +0000 Subject: [PATCH] 2.5 3DView Properties Panel: * 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 | 66 ++++++++++++++-------- source/blender/makesrna/intern/rna_space.c | 11 ++++ 2 files changed, 52 insertions(+), 25 deletions(-) diff --git a/release/ui/space_view3d.py b/release/ui/space_view3d.py index 4d5d7a03c07..e21d585a14d 100644 --- a/release/ui/space_view3d.py +++ b/release/ui/space_view3d.py @@ -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): - view = context.space_data - scene = context.scene layout = self.layout - split = layout.split() - col = split.column() + view = context.space_data + scene = context.scene + + 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) - - diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index 2afa1e6102b..f04f3b7be68 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -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)