Changeset View
Changeset View
Standalone View
Standalone View
release/scripts/startup/bl_ui/space_view3d.py
| Show All 12 Lines | |||||
| # You should have received a copy of the GNU General Public License | # You should have received a copy of the GNU General Public License | ||||
| # along with this program; if not, write to the Free Software Foundation, | # along with this program; if not, write to the Free Software Foundation, | ||||
| # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||||
| # | # | ||||
| # ##### END GPL LICENSE BLOCK ##### | # ##### END GPL LICENSE BLOCK ##### | ||||
| # <pep8 compliant> | # <pep8 compliant> | ||||
| import bpy | import bpy | ||||
| from bpy.types import Header, Menu, Panel | from bpy.types import Header, Menu, Panel, UIList | ||||
| from bl_ui.properties_grease_pencil_common import ( | from bl_ui.properties_grease_pencil_common import ( | ||||
| GreasePencilDataPanel, | GreasePencilDataPanel, | ||||
| GreasePencilPaletteColorPanel, | GreasePencilPaletteColorPanel, | ||||
| ) | ) | ||||
| from bl_ui.properties_paint_common import UnifiedPaintPanel | from bl_ui.properties_paint_common import UnifiedPaintPanel | ||||
| from bpy.app.translations import contexts as i18n_contexts | from bpy.app.translations import contexts as i18n_contexts | ||||
| ▲ Show 20 Lines • Show All 2,941 Lines • ▼ Show 20 Lines | def draw(self, context): | ||||
| layout.operator("transform.bend", text="Bend") | layout.operator("transform.bend", text="Bend") | ||||
| layout.operator("transform.shear", text="Shear") | layout.operator("transform.shear", text="Shear") | ||||
| layout.operator("transform.tosphere", text="To Sphere") | layout.operator("transform.tosphere", text="To Sphere") | ||||
| layout.operator("transform.transform", text="Shrink Fatten").mode = 'GPENCIL_SHRINKFATTEN' | layout.operator("transform.transform", text="Shrink Fatten").mode = 'GPENCIL_SHRINKFATTEN' | ||||
| # ********** Panel ********** | # ********** Panel ********** | ||||
| class VIEW3D_UL_display_layers(UIList): | |||||
| def draw_item(self, context, layout, data, item, icon, active_data, active_propname, index): | |||||
| layer = item | |||||
| if self.layout_type in {'DEFAULT', 'COMPACT'}: | |||||
| layout.label(layer.name) | |||||
| layout.prop(layer, "hide", text="", index=index, emboss=False, | |||||
| icon='RESTRICT_VIEW_OFF' if (not layer.hide) else 'RESTRICT_VIEW_ON') | |||||
| elif self.layout_type == 'GRID': | |||||
| layout.alignment = 'CENTER' | |||||
| layout.label("", icon_value=icon + layer.hide) | |||||
| class VIEW3D_PT_viewport_debug(Panel): | class VIEW3D_PT_viewport_debug(Panel): | ||||
| bl_space_type = 'VIEW_3D' | bl_space_type = 'VIEW_3D' | ||||
| bl_region_type = 'UI' | bl_region_type = 'UI' | ||||
| bl_label = "Modern Viewport" | bl_label = "Modern Viewport" | ||||
| bl_options = {'DEFAULT_CLOSED'} | bl_options = {'DEFAULT_CLOSED'} | ||||
| @classmethod | @classmethod | ||||
| Show All 10 Lines | def draw(self, context): | ||||
| view = context.space_data | view = context.space_data | ||||
| layout.active = view.use_modern_viewport | layout.active = view.use_modern_viewport | ||||
| col = layout.column() | col = layout.column() | ||||
| col.label(text="Placeholder for debugging options") | col.label(text="Placeholder for debugging options") | ||||
| class VIEW3D_PT_display(Panel): | |||||
| bl_space_type = 'VIEW_3D' | |||||
| bl_region_type = 'UI' | |||||
| bl_label = "Display" | |||||
| bl_options = {'DEFAULT_CLOSED'} | |||||
| @classmethod | |||||
| def poll(cls, context): | |||||
| view = context.space_data | |||||
| return (view) and view.use_modern_viewport | |||||
| def draw(self, context): | |||||
| layout = self.layout | |||||
| view = context.space_data | |||||
| layout.prop(view, "show_all_display_layers") | |||||
| row = layout.row(align=True) | |||||
| row.menu("VIEW3D_MT_display_presets", text=bpy.types.VIEW3D_MT_display_presets.bl_label) | |||||
| row.operator("view3d.display_preset_add", text="", icon='ZOOMIN') | |||||
| row.operator("view3d.display_preset_add", text="", icon='ZOOMOUT').remove_active = True | |||||
| col = layout.column() | |||||
| col.label(text="Drawing Support:") | |||||
| col.row().template_list("VIEW3D_UL_display_layers", "", | |||||
| view, "drawing_support", | |||||
| view, "active_drawing_support_index", | |||||
| rows=2) | |||||
| col.label(text="Scene Elements:") | |||||
| col.row().template_list("VIEW3D_UL_display_layers", "", | |||||
| view, "scene_elements", | |||||
| view, "active_scene_elements_index", | |||||
| rows=2) | |||||
| col.label(text="Screen Effects:") | |||||
| col.row().template_list("VIEW3D_UL_display_layers", "", | |||||
| view, "screen_effects", | |||||
| view, "active_screen_effects_index", | |||||
| rows=2) | |||||
| class VIEW3D_PT_grease_pencil(GreasePencilDataPanel, Panel): | class VIEW3D_PT_grease_pencil(GreasePencilDataPanel, Panel): | ||||
| bl_space_type = 'VIEW_3D' | bl_space_type = 'VIEW_3D' | ||||
| bl_region_type = 'UI' | bl_region_type = 'UI' | ||||
| # NOTE: this is just a wrapper around the generic GP Panel | # NOTE: this is just a wrapper around the generic GP Panel | ||||
| @classmethod | |||||
| def poll(cls, context): | |||||
| view = context.space_data | |||||
| return (view) and not view.use_modern_viewport | |||||
| class VIEW3D_PT_grease_pencil_palettecolor(GreasePencilPaletteColorPanel, Panel): | class VIEW3D_PT_grease_pencil_palettecolor(GreasePencilPaletteColorPanel, Panel): | ||||
| bl_space_type = 'VIEW_3D' | bl_space_type = 'VIEW_3D' | ||||
| bl_region_type = 'UI' | bl_region_type = 'UI' | ||||
| # NOTE: this is just a wrapper around the generic GP Panel | # NOTE: this is just a wrapper around the generic GP Panel | ||||
| ▲ Show 20 Lines • Show All 248 Lines • ▼ Show 20 Lines | class VIEW3D_PT_view3d_motion_tracking(Panel): | ||||
| bl_space_type = 'VIEW_3D' | bl_space_type = 'VIEW_3D' | ||||
| bl_region_type = 'UI' | bl_region_type = 'UI' | ||||
| bl_label = "Motion Tracking" | bl_label = "Motion Tracking" | ||||
| bl_options = {'DEFAULT_CLOSED'} | bl_options = {'DEFAULT_CLOSED'} | ||||
| @classmethod | @classmethod | ||||
| def poll(cls, context): | def poll(cls, context): | ||||
| view = context.space_data | view = context.space_data | ||||
| return (view) | return (view) and not view.use_modern_viewport | ||||
| def draw_header(self, context): | def draw_header(self, context): | ||||
| view = context.space_data | view = context.space_data | ||||
| self.layout.prop(view, "show_reconstruction", text="") | self.layout.prop(view, "show_reconstruction", text="") | ||||
| def draw(self, context): | def draw(self, context): | ||||
| layout = self.layout | layout = self.layout | ||||
| ▲ Show 20 Lines • Show All 146 Lines • ▼ Show 20 Lines | |||||
| class VIEW3D_PT_background_image(Panel): | class VIEW3D_PT_background_image(Panel): | ||||
| bl_space_type = 'VIEW_3D' | bl_space_type = 'VIEW_3D' | ||||
| bl_region_type = 'UI' | bl_region_type = 'UI' | ||||
| bl_label = "Background Images" | bl_label = "Background Images" | ||||
| bl_options = {'DEFAULT_CLOSED'} | bl_options = {'DEFAULT_CLOSED'} | ||||
| @classmethod | |||||
| def poll(cls, context): | |||||
| view = context.space_data | |||||
| return (view) and not view.use_modern_viewport | |||||
| def draw_header(self, context): | def draw_header(self, context): | ||||
| view = context.space_data | view = context.space_data | ||||
| self.layout.prop(view, "show_background_images", text="") | self.layout.prop(view, "show_background_images", text="") | ||||
| def draw(self, context): | def draw(self, context): | ||||
| layout = self.layout | layout = self.layout | ||||
| ▲ Show 20 Lines • Show All 208 Lines • ▼ Show 20 Lines | def draw(self, context): | ||||
| import rna_prop_ui | import rna_prop_ui | ||||
| member = VIEW3D_PT_context_properties._active_context_member(context) | member = VIEW3D_PT_context_properties._active_context_member(context) | ||||
| if member: | if member: | ||||
| # Draw with no edit button | # Draw with no edit button | ||||
| rna_prop_ui.draw(self.layout, context, member, object, False) | rna_prop_ui.draw(self.layout, context, member, object, False) | ||||
| class VIEW3D_MT_display_presets(Menu): | |||||
| bl_label = "Display Presets" | |||||
| preset_subdir = "viewport_display" | |||||
| preset_operator = "script.execute_preset" | |||||
| draw = Menu.draw_preset | |||||
| class VIEW3D_MT_solid_objects_presets(Menu): | |||||
| bl_label = "Solid Objects Presets" | |||||
| preset_subdir = "viewport" | |||||
| preset_operator = "script.execute_preset" | |||||
| draw = Menu.draw_preset | |||||
| def register(): | def register(): | ||||
| bpy.utils.register_module(__name__) | bpy.utils.register_module(__name__) | ||||
| def unregister(): | def unregister(): | ||||
| bpy.utils.unregister_module(__name__) | bpy.utils.unregister_module(__name__) | ||||
| if __name__ == "__main__": | if __name__ == "__main__": | ||||
| register() | register() | ||||