Changeset View
Changeset View
Standalone View
Standalone View
release/scripts/startup/bl_ui/space_topbar.py
| Show First 20 Lines • Show All 809 Lines • ▼ Show 20 Lines | def draw(self, context): | ||||
| layout.operator("screen.repeat_history", text="Repeat History...") | layout.operator("screen.repeat_history", text="Repeat History...") | ||||
| layout.separator() | layout.separator() | ||||
| layout.operator("screen.redo_last", text="Adjust Last Operation...") | layout.operator("screen.redo_last", text="Adjust Last Operation...") | ||||
| layout.separator() | layout.separator() | ||||
| # Mainly to expose shortcut. | |||||
| props = layout.operator("wm.call_panel", text="Rename Active Item...", icon='OUTLINER_DATA_FONT') | |||||
| props.name = "TOPBAR_PT_name" | |||||
| props.keep_open = False | |||||
| layout.operator("wm.search_menu", text="Operator Search...", icon='VIEWZOOM') | layout.operator("wm.search_menu", text="Operator Search...", icon='VIEWZOOM') | ||||
| layout.separator() | layout.separator() | ||||
| # Should move elsewhere (impacts outliner & 3D view). | # Should move elsewhere (impacts outliner & 3D view). | ||||
| tool_settings = context.tool_settings | tool_settings = context.tool_settings | ||||
| layout.prop(tool_settings, "lock_object_mode") | layout.prop(tool_settings, "lock_object_mode") | ||||
| ▲ Show 20 Lines • Show All 236 Lines • ▼ Show 20 Lines | def draw(self, context): | ||||
| row.prop(gp_settings, "fill_factor", text="Resolution") | row.prop(gp_settings, "fill_factor", text="Resolution") | ||||
| if gp_settings.fill_draw_mode != 'STROKE': | if gp_settings.fill_draw_mode != 'STROKE': | ||||
| row = layout.row(align=True) | row = layout.row(align=True) | ||||
| row.prop(gp_settings, "show_fill", text="Ignore Transparent Strokes") | row.prop(gp_settings, "show_fill", text="Ignore Transparent Strokes") | ||||
| row = layout.row(align=True) | row = layout.row(align=True) | ||||
| row.prop(gp_settings, "fill_threshold", text="Threshold") | row.prop(gp_settings, "fill_threshold", text="Threshold") | ||||
| # Only a popover | |||||
| class TOPBAR_PT_name(Panel): | |||||
| bl_space_type = 'TOPBAR' # dummy | |||||
| bl_region_type = 'HEADER' | |||||
| bl_label = "Rename Active Item" | |||||
| bl_ui_units_x = 14 | |||||
| @classmethod | |||||
| def poll(cls, context): | |||||
| return True | |||||
| def draw(self, context): | |||||
| layout = self.layout | |||||
| # Edit first editable button in popup | |||||
| layout.activate_init = True | |||||
| mode = context.mode | |||||
| scene = context.scene | |||||
| space = context.space_data | |||||
| space_type = 'PROPERTIES' if (space is None) else space.type | |||||
| found = False | |||||
| if space_type == 'SEQUENCE_EDITOR': | |||||
| layout.label(text="Sequence Strip Name") | |||||
| item = getattr(scene.sequence_editor, "active_strip") | |||||
| if item: | |||||
| layout.prop(item, "name", text="") | |||||
| found = True | |||||
| elif space_type == 'NODE_EDITOR': | |||||
| layout.label(text="Node Name") | |||||
| item = context.active_node | |||||
| if item: | |||||
| layout.prop(item, "name", text="") | |||||
| layout.label(text="Node Label") | |||||
| layout.prop(item, "label", text="") | |||||
| found = True | |||||
| else: | |||||
| if mode == 'POSE' or (mode == 'WEIGHT_PAINT' and context.pose_object): | |||||
| layout.label(text="Bone Name") | |||||
| item = getattr(context.active_pose_bone, "bone", None) | |||||
| if item: | |||||
| layout.prop(item, "name", text="") | |||||
| found = True | |||||
| elif mode == 'EDIT_ARMATURE': | |||||
| layout.label(text="Bone Name") | |||||
| item = context.active_bone | |||||
| if item: | |||||
| layout.prop(item, "name", text="") | |||||
| found = True | |||||
| else: | |||||
| layout.label(text="Object Name") | |||||
| item = context.object | |||||
| if item: | |||||
| layout.prop(item, "name", text="") | |||||
| found = True | |||||
| if not found: | |||||
| layout.label(text="No active item") | |||||
| classes = ( | classes = ( | ||||
| TOPBAR_HT_upper_bar, | TOPBAR_HT_upper_bar, | ||||
| TOPBAR_HT_lower_bar, | TOPBAR_HT_lower_bar, | ||||
| TOPBAR_MT_file_context_menu, | TOPBAR_MT_file_context_menu, | ||||
| TOPBAR_MT_window_context_menu, | TOPBAR_MT_window_context_menu, | ||||
| TOPBAR_MT_workspace_menu, | TOPBAR_MT_workspace_menu, | ||||
| TOPBAR_MT_editor_menus, | TOPBAR_MT_editor_menus, | ||||
| TOPBAR_MT_file, | TOPBAR_MT_file, | ||||
| TOPBAR_MT_file_new, | TOPBAR_MT_file_new, | ||||
| TOPBAR_MT_templates_more, | TOPBAR_MT_templates_more, | ||||
| TOPBAR_MT_file_import, | TOPBAR_MT_file_import, | ||||
| TOPBAR_MT_file_export, | TOPBAR_MT_file_export, | ||||
| TOPBAR_MT_file_external_data, | TOPBAR_MT_file_external_data, | ||||
| TOPBAR_MT_file_previews, | TOPBAR_MT_file_previews, | ||||
| TOPBAR_MT_edit, | TOPBAR_MT_edit, | ||||
| TOPBAR_MT_render, | TOPBAR_MT_render, | ||||
| TOPBAR_MT_window, | TOPBAR_MT_window, | ||||
| TOPBAR_MT_help, | TOPBAR_MT_help, | ||||
| TOPBAR_PT_active_tool, | TOPBAR_PT_active_tool, | ||||
| TOPBAR_PT_gpencil_layers, | TOPBAR_PT_gpencil_layers, | ||||
| TOPBAR_PT_gpencil_primitive, | TOPBAR_PT_gpencil_primitive, | ||||
| TOPBAR_PT_gpencil_fill, | TOPBAR_PT_gpencil_fill, | ||||
| TOPBAR_PT_name, | |||||
| ) | ) | ||||
| 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) | ||||