Changeset View
Changeset View
Standalone View
Standalone View
release/scripts/startup/bl_ui/properties_data_workspace.py
| Show First 20 Lines • Show All 55 Lines • ▼ Show 20 Lines | def draw(self, context): | ||||
| layout.enabled = not workspace.use_scene_settings | layout.enabled = not workspace.use_scene_settings | ||||
| layout.template_search(window, "view_layer", scene, "view_layers") | layout.template_search(window, "view_layer", scene, "view_layers") | ||||
| if view_render.has_multiple_engines: | if view_render.has_multiple_engines: | ||||
| layout.prop(view_render, "engine", text="") | layout.prop(view_render, "engine", text="") | ||||
| class WORKSPACE_PT_ui_tags(WorkSpaceButtonsPanel, Panel): | |||||
| bl_label = "Show/Hide Add-On's" | |||||
| bl_options = {'DEFAULT_CLOSED'} | |||||
| def draw_header(self, context): | |||||
| workspace = context.workspace | |||||
| self.layout.prop(workspace, "use_ui_tags", text="") | |||||
| def draw(self, context): | |||||
| layout = self.layout | |||||
| # align just to pack more tightly | |||||
| col = layout.box().column(align=True) | |||||
| workspace = context.workspace | |||||
| userpref = context.user_preferences | |||||
| col.active = workspace.use_ui_tags | |||||
| import addon_utils | |||||
| addon_map = { | |||||
| mod.__name__: ("%s: %s" % (mod.bl_info["category"], mod.bl_info["name"])) | |||||
| for mod in addon_utils.modules() | |||||
| } | |||||
| ui_tags = {ui_tag.name for ui_tag in workspace.ui_tags} | |||||
| for addon in userpref.addons: | |||||
| module_name = addon.module | |||||
| text = addon_map[module_name] | |||||
| is_enabled = module_name in ui_tags | |||||
| row = col.row() | |||||
| row.operator( | |||||
| "wm.ui_tag_disable" if is_enabled else "wm.ui_tag_enable", | |||||
| icon='CHECKBOX_HLT' if is_enabled else 'CHECKBOX_DEHLT', | |||||
| text="", | |||||
| emboss=False, | |||||
| ).ui_tag = module_name | |||||
| row.label(text) | |||||
| class WORKSPACE_PT_custom_props(WorkSpaceButtonsPanel, PropertyPanel, Panel): | class WORKSPACE_PT_custom_props(WorkSpaceButtonsPanel, PropertyPanel, Panel): | ||||
| _context_path = "workspace" | _context_path = "workspace" | ||||
| _property_type = bpy.types.WorkSpace | _property_type = bpy.types.WorkSpace | ||||
| classes = ( | classes = ( | ||||
| WORKSPACE_PT_context, | WORKSPACE_PT_context, | ||||
| WORKSPACE_PT_workspace, | WORKSPACE_PT_workspace, | ||||
| WORKSPACE_PT_ui_tags, | |||||
| WORKSPACE_PT_custom_props, | WORKSPACE_PT_custom_props, | ||||
| ) | ) | ||||
| if __name__ == "__main__": # only for live edit. | if __name__ == "__main__": # only for live edit. | ||||
| from bpy.utils import register_class | from bpy.utils import register_class | ||||
| for cls in classes: | for cls in classes: | ||||
| register_class(cls) | register_class(cls) | ||||