diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2019-05-02 17:05:23 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2019-05-02 17:05:23 +0300 |
commit | 43e6bb85cee0802887eae9489a2bd73836daf41d (patch) | |
tree | eaa106429af8341bf2123d7445fdab0af71b3dda /release | |
parent | 7daeb1f9aee284d958abe87622b43c70c21af967 (diff) | |
parent | ffaf91b5fc03f91e1fc90bd2f1d5dc5aa75656ff (diff) |
Merge 'master' into 'collada'
Diffstat (limited to 'release')
62 files changed, 1934 insertions, 1445 deletions
diff --git a/release/datafiles/userdef/userdef_default_theme.c b/release/datafiles/userdef/userdef_default_theme.c index 6f9f2a98a6a..9c763c5b2a1 100644 --- a/release/datafiles/userdef/userdef_default_theme.c +++ b/release/datafiles/userdef/userdef_default_theme.c @@ -8,6 +8,8 @@ #include "BLO_readfile.h" +/* clang-format off */ + #ifdef __LITTLE_ENDIAN__ # define RGBA(c) {((c) >> 24) & 0xff, ((c) >> 16) & 0xff, ((c) >> 8) & 0xff, (c) & 0xff} # define RGB(c) {((c) >> 16) & 0xff, ((c) >> 8) & 0xff, (c) & 0xff} @@ -301,7 +303,7 @@ const bTheme U_theme_default = { }, .grid = RGBA(0xa7a7a733), .wire = RGBA(0x000000ff), - .wire_edit = RGBA(0x111111ff), + .wire_edit = RGBA(0x000000ff), .select = RGBA(0xed5700ff), .lamp = RGBA(0x00000028), .speaker = RGBA(0x000000ff), @@ -310,18 +312,18 @@ const bTheme U_theme_default = { .active = RGBA(0xffa028ff), .transform = RGBA(0xffffffff), .vertex = RGBA(0x000000ff), - .vertex_select = RGBA(0xff8500ff), + .vertex_select = RGBA(0xff7a00ff), .vertex_bevel = RGBA(0x00a5ffff), .edge = RGBA(0x000000ff), - .edge_select = RGBA(0xffa000ff), + .edge_select = RGBA(0xff7200ff), .edge_seam = RGBA(0xdb2512ff), .edge_sharp = RGBA(0x00ffffff), .edge_facesel = RGBA(0x4b4b4bff), .edge_crease = RGBA(0xcc0099ff), .edge_bevel = RGBA(0x00a5ffff), .face = RGBA(0x00000012), - .face_select = RGBA(0xff85004d), - .face_dot = RGBA(0xff8500ff), + .face_select = RGBA(0xff990056), + .face_dot = RGBA(0xff8a00ff), .extra_edge_len = RGBA(0x150806ff), .extra_edge_angle = RGBA(0x4d4d00ff), .extra_face_angle = RGBA(0x0000ccff), @@ -336,7 +338,7 @@ const bTheme U_theme_default = { .time_keyframe = RGBA(0xddd700ff), .time_gp_keyframe = RGBA(0xb5e61dff), .freestyle_edge_mark = RGBA(0x7fff7fff), - .freestyle_face_mark = RGBA(0x7fff7f33), + .freestyle_face_mark = RGBA(0x7fff7f4d), .nurb_uline = RGBA(0x909000ff), .nurb_vline = RGBA(0x803060ff), .act_spline = RGBA(0xdb2512ff), @@ -353,6 +355,7 @@ const bTheme U_theme_default = { .handle_sel_align = RGBA(0xf090a0ff), .vertex_size = 3, .outline_width = 1, + .obcenter_dia = 6, .facedot_size = 3, .editmesh_active = RGBA(0xffffff80), .clipping_border_3d = RGBA(0x313131ff), @@ -1054,3 +1057,5 @@ const bTheme U_theme_default = { }, }, }; + +/* clang-format on */ diff --git a/release/scripts/modules/bpy_extras/object_utils.py b/release/scripts/modules/bpy_extras/object_utils.py index d08b98772f5..cd74aa39916 100644 --- a/release/scripts/modules/bpy_extras/object_utils.py +++ b/release/scripts/modules/bpy_extras/object_utils.py @@ -187,7 +187,7 @@ class AddObjectHelper: ) @classmethod - def poll(self, context): + def poll(cls, context): return context.scene.library is None diff --git a/release/scripts/modules/bpy_types.py b/release/scripts/modules/bpy_types.py index 32e8fe40c6a..86fb09ffb4b 100644 --- a/release/scripts/modules/bpy_types.py +++ b/release/scripts/modules/bpy_types.py @@ -61,7 +61,7 @@ class Library(bpy_types.ID): # See: readblenentry.c, IDTYPE_FLAGS_ISLINKABLE, # we could make this an attribute in rna. attr_links = ("actions", "armatures", "brushes", "cameras", - "curves", "grease_pencil", "collections", "images", + "curves", "grease_pencils", "collections", "images", "lights", "lattices", "materials", "metaballs", "meshes", "node_groups", "objects", "scenes", "sounds", "speakers", "textures", "texts", @@ -523,6 +523,15 @@ class Text(bpy_types.ID): self.clear() self.write(string) + def as_module(self): + from os.path import splitext + from types import ModuleType + mod = ModuleType(splitext(self.name)[0]) + # TODO: We could use Text.compiled (C struct member) + # if this is called often it will be much faster. + exec(self.as_string(), mod.__dict__) + return mod + class Sound(bpy_types.ID): __slots__ = () diff --git a/release/scripts/presets/gpencil_material/fill_only.py b/release/scripts/presets/gpencil_material/fill_only.py index b15f5f28f80..bad9d7b1304 100644 --- a/release/scripts/presets/gpencil_material/fill_only.py +++ b/release/scripts/presets/gpencil_material/fill_only.py @@ -8,6 +8,9 @@ gpcolor.color = (0.0, 0.0, 0.0, 0.0) gpcolor.stroke_image = None gpcolor.pixel_size = 100.0 gpcolor.use_stroke_pattern = False +gpcolor.use_stroke_texture_mix = False +gpcolor.mix_stroke_factor = 0.0 +gpcolor.use_follow_path = True gpcolor.fill_style = 'SOLID' gpcolor.fill_color = (0.5, 0.5, 0.5, 1.0) gpcolor.fill_image = None @@ -26,7 +29,7 @@ gpcolor.texture_scale = (1.0, 1.0) gpcolor.texture_angle = 0.0 gpcolor.texture_opacity = 1.0 gpcolor.texture_clamp = False -gpcolor.texture_mix = False +gpcolor.use_fill_texture_mix = False gpcolor.mix_factor = 0.0 gpcolor.show_stroke = False gpcolor.show_fill = True diff --git a/release/scripts/presets/gpencil_material/stroke_and_fill.py b/release/scripts/presets/gpencil_material/stroke_and_fill.py index b9a1e873ea2..1f523949a5d 100644 --- a/release/scripts/presets/gpencil_material/stroke_and_fill.py +++ b/release/scripts/presets/gpencil_material/stroke_and_fill.py @@ -8,6 +8,9 @@ gpcolor.color = (0.0, 0.0, 0.0, 1.0) gpcolor.stroke_image = None gpcolor.pixel_size = 100.0 gpcolor.use_stroke_pattern = False +gpcolor.use_stroke_texture_mix = False +gpcolor.mix_stroke_factor = 0.0 +gpcolor.use_follow_path = True gpcolor.fill_style = 'SOLID' gpcolor.fill_color = (0.5, 0.5, 0.5, 1.0) gpcolor.fill_image = None @@ -26,7 +29,7 @@ gpcolor.texture_scale = (1.0, 1.0) gpcolor.texture_angle = 0.0 gpcolor.texture_opacity = 1.0 gpcolor.texture_clamp = False -gpcolor.texture_mix = False +gpcolor.use_fill_texture_mix = False gpcolor.mix_factor = 0.0 gpcolor.show_stroke = True gpcolor.show_fill = True diff --git a/release/scripts/presets/gpencil_material/stroke_only.py b/release/scripts/presets/gpencil_material/stroke_only.py index 96739af59f0..27b579fce0c 100644 --- a/release/scripts/presets/gpencil_material/stroke_only.py +++ b/release/scripts/presets/gpencil_material/stroke_only.py @@ -8,6 +8,9 @@ gpcolor.color = (0.0, 0.0, 0.0, 1.0) gpcolor.stroke_image = None gpcolor.pixel_size = 100.0 gpcolor.use_stroke_pattern = False +gpcolor.use_stroke_texture_mix = False +gpcolor.mix_stroke_factor = 0.0 +gpcolor.use_follow_path = True gpcolor.fill_style = 'SOLID' gpcolor.fill_color = (0.5, 0.5, 0.5, 0.0) gpcolor.fill_image = None @@ -26,7 +29,7 @@ gpcolor.texture_scale = (1.0, 1.0) gpcolor.texture_angle = 0.0 gpcolor.texture_opacity = 1.0 gpcolor.texture_clamp = False -gpcolor.texture_mix = False +gpcolor.use_fill_texture_mix = False gpcolor.mix_factor = 0.0 gpcolor.show_stroke = True gpcolor.show_fill = False diff --git a/release/scripts/presets/interface_theme/blender_light.xml b/release/scripts/presets/interface_theme/blender_light.xml index fbdf82f77ab..d1fc068853f 100644 --- a/release/scripts/presets/interface_theme/blender_light.xml +++ b/release/scripts/presets/interface_theme/blender_light.xml @@ -408,6 +408,7 @@ paint_curve_handle="#7fff7f7f" paint_curve_pivot="#ff7f7f7f" outline_width="1" + obcenter_dia="6" > <space> <ThemeSpaceGradient diff --git a/release/scripts/presets/keyconfig/keymap_data/blender_default.py b/release/scripts/presets/keyconfig/keymap_data/blender_default.py index 92ad7cc52a5..45c082feee9 100644 --- a/release/scripts/presets/keyconfig/keymap_data/blender_default.py +++ b/release/scripts/presets/keyconfig/keymap_data/blender_default.py @@ -153,6 +153,21 @@ def op_tool_cycle(tool, kmi_args): # ------------------------------------------------------------------------------ # Keymap Templates +def _template_space_region_type_toggle(*, toolbar_key=None, sidebar_key=None): + items = [] + if toolbar_key is not None: + items.append( + ("wm.context_toggle", toolbar_key, + {"properties": [("data_path", 'space_data.show_region_toolbar')]}) + ) + if sidebar_key is not None: + items.append( + ("wm.context_toggle", sidebar_key, + {"properties": [("data_path", 'space_data.show_region_ui')]}), + ) + return items + + def _template_items_select_actions(params, operator): if not params.use_select_all_toggle: return [ @@ -246,11 +261,11 @@ def _template_items_uv_select_mode(params): def _template_items_proportional_editing(*, connected=False): return [ op_menu_pie("VIEW3D_MT_proportional_editing_falloff_pie", {"type": 'O', "value": 'PRESS', "shift": True}), - ("wm.context_toggle_enum", {"type": 'O', "value": 'PRESS'}, - {"properties": [("data_path", 'tool_settings.proportional_edit'), ("value_1", 'DISABLED'), ("value_2", 'ENABLED')]}), + ("wm.context_toggle", {"type": 'O', "value": 'PRESS'}, + {"properties": [("data_path", 'tool_settings.use_proportional_edit')]}), *(() if not connected else ( - ("wm.context_toggle_enum", {"type": 'O', "value": 'PRESS', "alt": True}, - {"properties": [("data_path", 'tool_settings.proportional_edit'), ("value_1", 'DISABLED'), ("value_2", 'CONNECTED')]}), + ("wm.context_toggle", {"type": 'O', "value": 'PRESS', "alt": True}, + {"properties": [("data_path", 'tool_settings.use_proportional_connected')]}), )) ] @@ -311,7 +326,7 @@ def km_window(params): if params.apple: # Apple standard shortcuts. Cmd+F for search since F-keys are not easy to use. items.extend([ - ("wm.read_homefile", {"type": 'N', "value": 'PRESS', "oskey": True}, None), + op_menu("TOPBAR_MT_file_new", {"type": 'N', "value": 'PRESS', "oskey": True}), op_menu("TOPBAR_MT_file_open_recent", {"type": 'O', "value": 'PRESS', "shift": True, "oskey": True}), ("wm.open_mainfile", {"type": 'O', "value": 'PRESS', "oskey": True}, None), ("wm.save_mainfile", {"type": 'S', "value": 'PRESS', "oskey": True}, None), @@ -341,7 +356,7 @@ def km_window(params): items.extend([ # File operations - ("wm.read_homefile", {"type": 'N', "value": 'PRESS', "ctrl": True}, None), + op_menu("TOPBAR_MT_file_new", {"type": 'N', "value": 'PRESS', "ctrl": True}), op_menu("TOPBAR_MT_file_open_recent", {"type": 'O', "value": 'PRESS', "shift": True, "ctrl": True}), ("wm.open_mainfile", {"type": 'O', "value": 'PRESS', "ctrl": True}, None), ("wm.save_mainfile", {"type": 'S', "value": 'PRESS', "ctrl": True}, None), @@ -457,7 +472,11 @@ def km_screen(params): ("render.play_rendered_anim", {"type": 'F11', "value": 'PRESS', "ctrl": True}, None), ]) - if params.legacy: + if not params.legacy: + items.extend([ + ("screen.redo_last", {"type": 'F9', "value": 'PRESS'}, None), + ]) + else: # Old keymap items.extend([ ("ed.undo_history", {"type": 'Z', "value": 'PRESS', "ctrl": True, "alt": True}, None), @@ -514,7 +533,8 @@ def km_screen_editing(params): if params.legacy: items.extend([ - ("screen.header", {"type": 'F9', "value": 'PRESS', "alt": True}, None), + ("wm.context_toggle", {"type": 'F9', "value": 'PRESS', "alt": True}, + {"properties": [("data_path", 'space_data.show_region_header')]}) ]) return keymap @@ -693,7 +713,7 @@ def km_outliner(params): ("outliner.highlight_update", {"type": 'MOUSEMOVE', "value": 'ANY', "any": True}, None), ("outliner.item_rename", {"type": 'LEFTMOUSE', "value": 'DOUBLE_CLICK'}, None), ("outliner.item_activate", {"type": 'LEFTMOUSE', "value": 'CLICK'}, - {"properties": [("extend", False), ("recursive", False)]}), + {"properties": [("extend", False), ("recursive", False), ("deselect_all", not params.legacy)]}), ("outliner.item_activate", {"type": 'LEFTMOUSE', "value": 'CLICK', "shift": True}, {"properties": [("extend", True), ("recursive", False)]}), ("outliner.item_activate", {"type": 'LEFTMOUSE', "value": 'CLICK', "ctrl": True}, @@ -763,7 +783,7 @@ def km_uv_editor(params): *_template_items_uv_select_mode(params), ("uv.mark_seam", {"type": 'E', "value": 'PRESS', "ctrl": True}, None), ("uv.select", {"type": params.select_mouse, "value": params.select_mouse_value}, - {"properties": [("extend", False)]}), + {"properties": [("extend", False), ("deselect_all", not params.legacy)]}), ("uv.select", {"type": params.select_mouse, "value": params.select_mouse_value, "shift": True}, {"properties": [("extend", True)]}), ("uv.select_loop", {"type": params.select_mouse, "value": params.select_mouse_value, "alt": True}, @@ -843,8 +863,6 @@ def km_uv_editor(params): ("uv.minimize_stretch", {"type": 'V', "value": 'PRESS', "ctrl": True}, None), ("uv.pack_islands", {"type": 'P', "value": 'PRESS', "ctrl": True}, None), ("uv.average_islands_scale", {"type": 'A', "value": 'PRESS', "ctrl": True}, None), - ("wm.context_toggle", {"type": 'Q', "value": 'PRESS'}, - {"properties": [("data_path", 'tool_settings.use_uv_sculpt')]}), ]) if params.select_mouse == 'LEFTMOUSE' and not params.legacy: @@ -857,39 +875,6 @@ def km_uv_editor(params): return keymap -def km_uv_sculpt(_params): - items = [] - keymap = ( - "UV Sculpt", - {"space_type": 'EMPTY', "region_type": 'WINDOW'}, - {"items": items}, - ) - - items.extend([ - ("wm.context_toggle", {"type": 'Q', "value": 'PRESS'}, - {"properties": [("data_path", 'tool_settings.use_uv_sculpt')]}), - ("sculpt.uv_sculpt_stroke", {"type": 'LEFTMOUSE', "value": 'PRESS'}, - {"properties": [("mode", 'NORMAL')]}), - ("sculpt.uv_sculpt_stroke", {"type": 'LEFTMOUSE', "value": 'PRESS', "ctrl": True}, - {"properties": [("mode", 'INVERT')]}), - ("sculpt.uv_sculpt_stroke", {"type": 'LEFTMOUSE', "value": 'PRESS', "shift": True}, - {"properties": [("mode", 'RELAX')]}), - ("brush.scale_size", {"type": 'LEFT_BRACKET', "value": 'PRESS'}, - {"properties": [("scalar", 0.9)]}), - ("brush.scale_size", {"type": 'RIGHT_BRACKET', "value": 'PRESS'}, - {"properties": [("scalar", 1.0 / 0.9)]}), - *_template_paint_radial_control("uv_sculpt"), - ("brush.uv_sculpt_tool_set", {"type": 'S', "value": 'PRESS'}, - {"properties": [("tool", 'RELAX')]}), - ("brush.uv_sculpt_tool_set", {"type": 'P', "value": 'PRESS'}, - {"properties": [("tool", 'PINCH')]}), - ("brush.uv_sculpt_tool_set", {"type": 'G', "value": 'PRESS'}, - {"properties": [("tool", 'GRAB')]}), - ]) - - return keymap - - # 3D View: all regions. def km_view3d_generic(_params): items = [] @@ -900,8 +885,10 @@ def km_view3d_generic(_params): ) items.extend([ - ("view3d.properties", {"type": 'N', "value": 'PRESS'}, None), - ("view3d.toolshelf", {"type": 'T', "value": 'PRESS'}, None), + *_template_space_region_type_toggle( + toolbar_key={"type": 'T', "value": 'PRESS'}, + sidebar_key={"type": 'N', "value": 'PRESS'}, + ) ]) return keymap @@ -1229,7 +1216,8 @@ def km_mask_editing(params): ("mask.delete", {"type": 'X', "value": 'PRESS'}, None), ("mask.delete", {"type": 'DEL', "value": 'PRESS'}, None), ("mask.select", {"type": params.select_mouse, "value": params.select_mouse_value}, - {"properties": [("extend", False), ("deselect", False), ("toggle", False)]}), + {"properties": [("extend", False), ("deselect", False), ("toggle", False), + ("deselect_all", not params.legacy)]}), ("mask.select", {"type": params.select_mouse, "value": params.select_mouse_value, "shift": True}, {"properties": [("extend", False), ("deselect", False), ("toggle", True)]}), *_template_items_select_actions(params, "mask.select_all"), @@ -1328,7 +1316,9 @@ def km_graph_editor_generic(_params): ) items.extend([ - ("graph.properties", {"type": 'N', "value": 'PRESS'}, None), + *_template_space_region_type_toggle( + sidebar_key={"type": 'N', "value": 'PRESS'}, + ), ("graph.extrapolation_type", {"type": 'E', "value": 'PRESS', "shift": True}, None), ("anim.channels_find", {"type": 'F', "value": 'PRESS', "ctrl": True}, None), ("graph.hide", {"type": 'H', "value": 'PRESS'}, @@ -1356,7 +1346,8 @@ def km_graph_editor(params): {"properties": [("data_path", 'space_data.show_handles')]}), ("graph.cursor_set", {"type": params.action_mouse, "value": 'PRESS'}, None), ("graph.clickselect", {"type": params.select_mouse, "value": 'PRESS'}, - {"properties": [("extend", False), ("column", False), ("curves", False)]}), + {"properties": [("extend", False), ("deselect_all", not params.legacy), + ("column", False), ("curves", False)]}), ("graph.clickselect", {"type": params.select_mouse, "value": 'PRESS', "alt": True}, {"properties": [("extend", False), ("column", True), ("curves", False)]}), ("graph.clickselect", {"type": params.select_mouse, "value": 'PRESS', "shift": True}, @@ -1442,6 +1433,8 @@ def km_graph_editor(params): op_menu_pie("GRAPH_MT_pivot_pie", {"type": 'PERIOD', "value": 'PRESS'}), ("marker.add", {"type": 'M', "value": 'PRESS'}, None), ("marker.rename", {"type": 'M', "value": 'PRESS', "ctrl": True}, None), + ("anim.start_frame_set", {"type": 'HOME', "value": 'PRESS', "ctrl": True}, None), + ("anim.end_frame_set", {"type": 'END', "value": 'PRESS', "ctrl": True}, None), ]) if params.apple: @@ -1464,14 +1457,16 @@ def km_image_generic(_params): ) items.extend([ + *_template_space_region_type_toggle( + toolbar_key={"type": 'T', "value": 'PRESS'}, + sidebar_key={"type": 'N', "value": 'PRESS'}, + ), ("image.new", {"type": 'N', "value": 'PRESS', "alt": True}, None), ("image.open", {"type": 'O', "value": 'PRESS', "alt": True}, None), ("image.reload", {"type": 'R', "value": 'PRESS', "alt": True}, None), ("image.read_viewlayers", {"type": 'R', "value": 'PRESS', "ctrl": True}, None), ("image.save", {"type": 'S', "value": 'PRESS', "alt": True}, None), ("image.save_as", {"type": 'S', "value": 'PRESS', "shift": True}, None), - ("image.properties", {"type": 'N', "value": 'PRESS'}, None), - ("image.toolshelf", {"type": 'T', "value": 'PRESS'}, None), ("image.cycle_render_slot", {"type": 'J', "value": 'PRESS'}, None), ("image.cycle_render_slot", {"type": 'J', "value": 'PRESS', "alt": True}, {"properties": [("reverse", True)]}), @@ -1558,8 +1553,10 @@ def km_node_generic(_params): ) items.extend([ - ("node.properties", {"type": 'N', "value": 'PRESS'}, None), - ("node.toolbar", {"type": 'T', "value": 'PRESS'}, None), + *_template_space_region_type_toggle( + toolbar_key={"type": 'T', "value": 'PRESS'}, + sidebar_key={"type": 'N', "value": 'PRESS'}, + ), ]) return keymap @@ -1710,7 +1707,11 @@ def km_info(params): ) items.extend([ - ("info.select_pick", {"type": params.select_mouse, "value": 'PRESS'}, None), + ("info.select_pick", {"type": 'LEFTMOUSE', "value": 'CLICK'}, None), + ("info.select_pick", {"type": 'LEFTMOUSE', "value": 'CLICK', "shift": True}, + {"properties": [("extend", True)]}), + ("info.select_box", {"type": 'EVT_TWEAK_L', "value": 'ANY'}, + {"properties": [("wait_for_input", False)]}), *_template_items_select_actions(params, "info.select_all"), ("info.select_box", {"type": 'B', "value": 'PRESS'}, None), ("info.report_replay", {"type": 'R', "value": 'PRESS'}, None), @@ -1864,7 +1865,10 @@ def km_dopesheet_generic(_params): ) items.extend([ - ("action.properties", {"type": 'N', "value": 'PRESS'}, None), + *_template_space_region_type_toggle( + toolbar_key={"type": 'T', "value": 'PRESS'}, + sidebar_key={"type": 'N', "value": 'PRESS'}, + ), ("wm.context_set_enum", {"type": 'TAB', "value": 'PRESS', "ctrl": True}, {"properties": [("data_path", 'area.type'), ("value", 'GRAPH_EDITOR')]}) ]) @@ -1882,7 +1886,8 @@ def km_dopesheet(params): items.extend([ ("action.clickselect", {"type": params.select_mouse, "value": 'PRESS'}, - {"properties": [("extend", False), ("column", False), ("channel", False)]}), + {"properties": [("extend", False), ("deselect_all", not params.legacy), + ("column", False), ("channel", False)]}), ("action.clickselect", {"type": params.select_mouse, "value": 'PRESS', "alt": True}, {"properties": [("extend", False), ("column", True), ("channel", False)]}), ("action.clickselect", {"type": params.select_mouse, "value": 'PRESS', "shift": True}, @@ -1985,7 +1990,9 @@ def km_nla_generic(_params): ) items.extend([ - ("nla.properties", {"type": 'N', "value": 'PRESS'}, None), + *_template_space_region_type_toggle( + sidebar_key={"type": 'N', "value": 'PRESS'}, + ), ("nla.tweakmode_enter", {"type": 'TAB', "value": 'PRESS'}, None), ("nla.tweakmode_exit", {"type": 'TAB', "value": 'PRESS'}, None), ("nla.tweakmode_enter", {"type": 'TAB', "value": 'PRESS', "shift": True}, @@ -2032,7 +2039,7 @@ def km_nla_editor(params): items.extend([ ("nla.click_select", {"type": params.select_mouse, "value": 'PRESS'}, - {"properties": [("extend", False)]}), + {"properties": [("extend", False), ("deselect_all", not params.legacy)]}), ("nla.click_select", {"type": params.select_mouse, "value": 'PRESS', "shift": True}, {"properties": [("extend", True)]}), ("nla.select_leftright", {"type": params.select_mouse, "value": 'PRESS', "ctrl": True}, @@ -2098,11 +2105,13 @@ def km_text_generic(params): ) items.extend([ + *_template_space_region_type_toggle( + sidebar_key={"type": 'T', "value": 'PRESS', "ctrl": True}, + ), ("text.start_find", {"type": 'F', "value": 'PRESS', "ctrl": True}, None), ("text.jump", {"type": 'J', "value": 'PRESS', "ctrl": True}, None), ("text.find", {"type": 'G', "value": 'PRESS', "ctrl": True}, None), ("text.replace", {"type": 'H', "value": 'PRESS', "ctrl": True}, None), - ("text.properties", {"type": 'T', "value": 'PRESS', "ctrl": True}, None), ]) if params.apple: @@ -2297,7 +2306,9 @@ def km_sequencercommon(_params): ) items.extend([ - ("sequencer.properties", {"type": 'N', "value": 'PRESS'}, None), + *_template_space_region_type_toggle( + sidebar_key={"type": 'N', "value": 'PRESS'}, + ), ("wm.context_toggle", {"type": 'O', "value": 'PRESS', "shift": True}, {"properties": [("data_path", 'scene.sequence_editor.show_overlay')]}), ("sequencer.view_toggle", {"type": 'TAB', "value": 'PRESS', "ctrl": True}, None), @@ -2375,7 +2386,8 @@ def km_sequencer(params): ) ), ("sequencer.select", {"type": params.select_mouse, "value": 'PRESS'}, - {"properties": [("extend", False), ("linked_handle", False), ("left_right", 'NONE'), ("linked_time", False)]}), + {"properties": [("extend", False), ("deselect_all", True), + ("linked_handle", False), ("left_right", 'NONE'), ("linked_time", False)]}), ("sequencer.select", {"type": params.select_mouse, "value": 'PRESS', "shift": True}, {"properties": [("extend", True), ("linked_handle", False), ("left_right", 'NONE'), ("linked_time", False)]}), ("sequencer.select", {"type": params.select_mouse, "value": 'PRESS', "alt": True}, @@ -2521,9 +2533,11 @@ def km_clip(_params): ) items.extend([ + *_template_space_region_type_toggle( + toolbar_key={"type": 'T', "value": 'PRESS'}, + sidebar_key={"type": 'N', "value": 'PRESS'}, + ), ("clip.open", {"type": 'O', "value": 'PRESS', "alt": True}, None), - ("clip.tools", {"type": 'T', "value": 'PRESS'}, None), - ("clip.properties", {"type": 'N', "value": 'PRESS'}, None), ("clip.track_markers", {"type": 'LEFT_ARROW', "value": 'PRESS', "alt": True}, {"properties": [("backwards", True), ("sequence", False)]}), ("clip.track_markers", {"type": 'RIGHT_ARROW', "value": 'PRESS', "alt": True}, @@ -2534,8 +2548,11 @@ def km_clip(_params): {"properties": [("backwards", True), ("sequence", True)]}), ("wm.context_toggle_enum", {"type": 'TAB', "value": 'PRESS'}, {"properties": [("data_path", 'space_data.mode'), ("value_1", 'TRACKING'), ("value_2", 'MASK')]}), - ("clip.solve_camera", {"type": 'S', "value": 'PRESS', "shift": True}, None), ("clip.prefetch", {"type": 'P', "value": 'PRESS'}, None), + op_menu_pie("CLIP_MT_tracking_pie", {"type": 'E', "value": 'PRESS'}), + op_menu_pie("CLIP_MT_solving_pie", {"type": 'S', "value": 'PRESS', "shift": True}), + op_menu_pie("CLIP_MT_marker_pie", {"type": 'E', "value": 'PRESS', "shift": True}), + op_menu_pie("CLIP_MT_reconstruction_pie", {"type": 'W', "value": 'PRESS', "shift": True}), ]) return keymap @@ -2596,7 +2613,7 @@ def km_clip_editor(params): {"properties": [("position", 'PATHSTART')]}), ("clip.change_frame", {"type": 'LEFTMOUSE', "value": 'PRESS'}, None), ("clip.select", {"type": params.select_mouse, "value": 'PRESS'}, - {"properties": [("extend", False)]}), + {"properties": [("extend", False), ("deselect_all", not params.legacy)]}), ("clip.select", {"type": params.select_mouse, "value": 'PRESS', "shift": True}, {"properties": [("extend", True)]}), *_template_items_select_actions(params, "clip.select_all"), @@ -2978,7 +2995,8 @@ def km_grease_pencil_stroke_edit_mode(params): ("gpencil.interpolate", {"type": 'E', "value": 'PRESS', "ctrl": True, "alt": True}, None), ("gpencil.interpolate_sequence", {"type": 'E', "value": 'PRESS', "shift": True, "ctrl": True}, None), # Normal select - ("gpencil.select", {"type": params.select_mouse, "value": params.select_mouse_value}, None), + ("gpencil.select", {"type": params.select_mouse, "value": params.select_mouse_value}, + {"properties": [("deselect_all", not params.legacy)]}), # Selection *_grease_pencil_selection(params), # Duplicate and move selected points @@ -3917,7 +3935,7 @@ def km_mesh(params): ("mesh.rip_move", {"type": 'V', "value": 'PRESS', "alt": True}, {"properties": [("MESH_OT_rip", [("use_fill", True), ],)]}), ("mesh.rip_edge_move", {"type": 'D', "value": 'PRESS', "alt": True}, None), - ("mesh.merge", {"type": 'M', "value": 'PRESS', "alt": True}, None), + op_menu("VIEW3D_MT_edit_mesh_merge", {"type": 'M', "value": 'PRESS', "alt": True}), ("transform.shrink_fatten", {"type": 'S', "value": 'PRESS', "alt": True}, None), ("mesh.edge_face_add", {"type": 'F', "value": 'PRESS'}, None), ("mesh.duplicate_move", {"type": 'D', "value": 'PRESS', "shift": True}, None), @@ -5224,13 +5242,32 @@ def km_image_editor_tool_uv_select_lasso(params): ) +def km_image_editor_tool_uv_sculpt_stroke(params): + return ( + "Image Editor Tool: Uv, Sculpt Stroke", + {"space_type": 'IMAGE_EDITOR', "region_type": 'WINDOW'}, + {"items": [ + ("sculpt.uv_sculpt_stroke", {"type": params.tool_mouse, "value": 'PRESS'}, None), + ("sculpt.uv_sculpt_stroke", {"type": params.tool_mouse, "value": 'PRESS', "ctrl": True}, + {"properties": [("mode", 'INVERT')]}), + ("sculpt.uv_sculpt_stroke", {"type": params.tool_mouse, "value": 'PRESS', "shift": True}, + {"properties": [("mode", 'RELAX')]}), + ("brush.scale_size", {"type": 'LEFT_BRACKET', "value": 'PRESS'}, + {"properties": [("scalar", 0.9)]}), + ("brush.scale_size", {"type": 'RIGHT_BRACKET', "value": 'PRESS'}, + {"properties": [("scalar", 1.0 / 0.9)]}), + *_template_paint_radial_control("uv_sculpt"), + ]}, + ) + + def km_node_editor_tool_select(params): return ( "Node Tool: Select", {"space_type": 'NODE_EDITOR', "region_type": 'WINDOW'}, {"items": [ ("node.select", {"type": params.select_mouse, "value": 'PRESS'}, - {"properties": [("extend", False)]}), + {"properties": [("extend", False), ("deselect_all", not params.legacy)]}), ]}, ) @@ -5323,16 +5360,6 @@ def km_3d_view_tool_select_lasso(params): ) -def km_3d_view_tool_transform(params): - return ( - "3D View Tool: Transform", - {"space_type": 'VIEW_3D', "region_type": 'WINDOW'}, - {"items": [ - ("transform.from_gizmo", {"type": params.tool_tweak, "value": 'ANY'}, None), - ]}, - ) - - def km_3d_view_tool_move(params): return ( "3D View Tool: Move", @@ -6074,7 +6101,6 @@ def generate_keymaps(params=None): # Editors. km_outliner(params), km_uv_editor(params), - km_uv_sculpt(params), km_view3d_generic(params), km_view3d(params), km_mask_editing(params), @@ -6202,6 +6228,7 @@ def generate_keymaps(params=None): km_image_editor_tool_uv_select_box(params), km_image_editor_tool_uv_select_circle(params), km_image_editor_tool_uv_select_lasso(params), + km_image_editor_tool_uv_sculpt_stroke(params), km_node_editor_tool_select(params), km_node_editor_tool_select_box(params), km_node_editor_tool_select_lasso(params), @@ -6212,7 +6239,6 @@ def generate_keymaps(params=None): km_3d_view_tool_select_box(params), km_3d_view_tool_select_circle(params), km_3d_view_tool_select_lasso(params), - km_3d_view_tool_transform(params), km_3d_view_tool_move(params), km_3d_view_tool_rotate(params), km_3d_view_tool_scale(params), diff --git a/release/scripts/presets/keyconfig/keymap_data/industry_compatible_data.py b/release/scripts/presets/keyconfig/keymap_data/industry_compatible_data.py index 4eb13b263c6..590d8562cf1 100644 --- a/release/scripts/presets/keyconfig/keymap_data/industry_compatible_data.py +++ b/release/scripts/presets/keyconfig/keymap_data/industry_compatible_data.py @@ -447,7 +447,7 @@ def km_outliner(params): ("outliner.highlight_update", {"type": 'MOUSEMOVE', "value": 'ANY', "any": True}, None), ("outliner.item_rename", {"type": 'LEFTMOUSE', "value": 'DOUBLE_CLICK'}, None), ("outliner.item_activate", {"type": 'LEFTMOUSE', "value": 'CLICK'}, - {"properties": [("extend", False), ("recursive", False)]}), + {"properties": [("extend", False), ("recursive", False), ("deselect_all", True)]}), ("outliner.item_activate", {"type": 'LEFTMOUSE', "value": 'CLICK', "shift": True}, {"properties": [("extend", True), ("recursive", False)]}), ("outliner.item_activate", {"type": 'LEFTMOUSE', "value": 'CLICK', "ctrl": True}, @@ -511,7 +511,7 @@ def km_uv_editor(params): items.extend([ # Selection modes. ("uv.select", {"type": 'LEFTMOUSE', "value": 'PRESS'}, - {"properties": [("extend", False)]}), + {"properties": [("extend", False), ("deselect_all", True)]}), ("uv.select_loop", {"type": 'LEFTMOUSE', "value": 'DOUBLE_CLICK', "shift": True}, {"properties": [("extend", True)]}), ("uv.select_loop", {"type": 'LEFTMOUSE', "value": 'DOUBLE_CLICK'}, @@ -546,38 +546,6 @@ def km_uv_editor(params): return keymap -def km_uv_sculpt(params): - items = [] - keymap = ( - "UV Sculpt", - {"space_type": 'EMPTY', "region_type": 'WINDOW'}, - {"items": items}, - ) - - items.extend([ - ("wm.context_toggle", {"type": 'Q', "value": 'PRESS'}, - {"properties": [("data_path", 'tool_settings.use_uv_sculpt')]}), - ("sculpt.uv_sculpt_stroke", {"type": 'LEFTMOUSE', "value": 'PRESS'}, - {"properties": [("mode", 'NORMAL')]}), - ("sculpt.uv_sculpt_stroke", {"type": 'LEFTMOUSE', "value": 'PRESS', "ctrl": True}, - {"properties": [("mode", 'INVERT')]}), - ("sculpt.uv_sculpt_stroke", {"type": 'LEFTMOUSE', "value": 'PRESS', "shift": True}, - {"properties": [("mode", 'RELAX')]}), - ("brush.scale_size", {"type": 'LEFT_BRACKET', "value": 'PRESS'}, - {"properties": [("scalar", 0.9)]}), - ("brush.scale_size", {"type": 'RIGHT_BRACKET', "value": 'PRESS'}, - {"properties": [("scalar", 1.0 / 0.9)]}), - *_template_paint_radial_control("uv_sculpt"), - ("brush.uv_sculpt_tool_set", {"type": 'S', "value": 'PRESS'}, - {"properties": [("tool", 'RELAX')]}), - ("brush.uv_sculpt_tool_set", {"type": 'P', "value": 'PRESS'}, - {"properties": [("tool", 'PINCH')]}), - ("brush.uv_sculpt_tool_set", {"type": 'G', "value": 'PRESS'}, - {"properties": [("tool", 'GRAB')]}), - ]) - - return keymap - # 3D View: all regions. def km_view3d_generic(_params): items = [] @@ -588,8 +556,10 @@ def km_view3d_generic(_params): ) items.extend([ - ("view3d.toolshelf", {"type": 'LEFT_BRACKET', "value": 'PRESS', "ctrl": True}, None), - ("view3d.properties", {"type": 'RIGHT_BRACKET', "value": 'PRESS', "ctrl": True}, None), + ("wm.context_toggle", {"type": 'LEFT_BRACKET', "value": 'PRESS', "ctrl": True}, + {"properties": [("data_path", 'space_data.show_region_toolbar')]}), + ("wm.context_toggle", {"type": 'RIGHT_BRACKET', "value": 'PRESS', "ctrl": True}, + {"properties": [("data_path", 'space_data.show_region_ui')]}), ]) return keymap @@ -730,7 +700,7 @@ def km_mask_editing(params): ("mask.delete", {"type": 'BACK_SPACE', "value": 'PRESS'}, None), ("mask.delete", {"type": 'DEL', "value": 'PRESS'}, None), ("mask.select", {"type": 'LEFTMOUSE', "value": 'PRESS'}, - {"properties": [("extend", False), ("deselect", False), ("toggle", False)]}), + {"properties": [("extend", False), ("deselect", False), ("toggle", False), ("deselect_all", True)]}), ("mask.select", {"type": 'LEFTMOUSE', "value": 'PRESS', "shift": True}, {"properties": [("extend", False), ("deselect", False), ("toggle", True)]}), ("mask.select_all", {"type": 'A', "value": 'PRESS', "ctrl": True}, {"properties": [("action", 'SELECT')]}), @@ -845,7 +815,7 @@ def km_graph_editor(params): *_template_items_animation(), ("graph.cursor_set", {"type": 'RIGHTMOUSE', "value": 'PRESS', "ctrl": True}, None), ("graph.clickselect", {"type": 'LEFTMOUSE', "value": 'PRESS'}, - {"properties": [("extend", False), ("column", False), ("curves", False)]}), + {"properties": [("extend", False), ("deselect_all", True), ("column", False), ("curves", False)]}), ("graph.clickselect", {"type": 'LEFTMOUSE', "value": 'PRESS', "alt": True}, {"properties": [("extend", False), ("column", True), ("curves", False)]}), ("graph.clickselect", {"type": 'LEFTMOUSE', "value": 'PRESS', "shift": True}, @@ -856,8 +826,6 @@ def km_graph_editor(params): {"properties": [("extend", False), ("column", False), ("curves", True)]}), ("graph.clickselect", {"type": 'LEFTMOUSE', "value": 'PRESS', "shift": True, "ctrl": True, "alt": True}, {"properties": [("extend", True), ("column", False), ("curves", True)]}), - ("graph.select_leftright", {"type": 'LEFTMOUSE', "value": 'PRESS', "ctrl": True}, - {"properties": [("mode", 'CHECK'), ("extend", False)]}), ("graph.select_leftright", {"type": 'LEFTMOUSE', "value": 'PRESS', "shift": True, "ctrl": True}, {"properties": [("mode", 'CHECK'), ("extend", True)]}), ("graph.select_leftright", {"type": 'LEFT_BRACKET', "value": 'PRESS'}, @@ -875,6 +843,12 @@ def km_graph_editor(params): {"properties": [("axis_range", False), ("include_handles", True)]}), ("graph.select_box", {"type": 'Q', "value": 'PRESS', "ctrl": True, "alt": True}, {"properties": [("axis_range", True), ("include_handles", True)]}), + ("graph.select_box", {"type": 'EVT_TWEAK_L', "value": 'ANY'}, + {"properties":[("axis_range", False), ("include_handles", True), ("wait_for_input", False), ("mode", 'SET')]}), + ("graph.select_box", {"type": 'EVT_TWEAK_L', "value": 'ANY', "shift": True}, + {"properties":[("axis_range", False), ("include_handles", True), ("wait_for_input", False), ("mode", 'ADD')]}), + ("graph.select_box", {"type": 'EVT_TWEAK_L', "value": 'ANY', "ctrl": True}, + {"properties":[("axis_range", False),("include_handles", True), ("wait_for_input", False), ("mode", 'SUB')]}), ("graph.select_more", {"type": 'UP_ARROW', "value": 'PRESS'}, None), ("graph.select_less", {"type": 'DOWN_ARROW', "value": 'PRESS'}, None), ("graph.select_linked", {"type": 'RIGHT_BRACKET', "value": 'PRESS'}, None), @@ -892,9 +866,10 @@ def km_graph_editor(params): ("graph.view_all", {"type": 'NDOF_BUTTON_FIT', "value": 'PRESS'}, None), ("graph.view_selected", {"type": 'F', "value": 'PRESS'}, None), ("graph.view_frame", {"type": 'A', "value": 'PRESS', "shift": True}, None), - ("anim.channels_editable_toggle", {"type": 'TAB', "value": 'PRESS'}, None), + ("anim.channels_editable_toggle", {"type": 'LEFTMOUSE', "value": 'DOUBLE_CLICK'}, None), ("transform.translate", {"type": 'W', "value": 'PRESS'}, None), - ("transform.translate", {"type": 'EVT_TWEAK_L', "value": 'ANY'}, None), + ("transform.translate", {"type": 'LEFTMOUSE', "value": 'PRESS'}, None), + ("transform.translate", {"type": 'EVT_TWEAK_M', "value": 'ANY'}, None), ("transform.transform", {"type": 'Y', "value": 'PRESS'}, {"properties": [("mode", 'TIME_EXTEND')]}), ("transform.rotate", {"type": 'E', "value": 'PRESS'}, None), @@ -1063,7 +1038,6 @@ def km_node_editor(params): {"properties": [("replace", False)]}), ("node.link_make", {"type": 'F', "value": 'PRESS', "shift": True}, {"properties": [("replace", True)]}), - op_menu("NODE_MT_add", {"type": 'A', "value": 'PRESS', "shift": True}), ("node.duplicate_move", {"type": 'D', "value": 'PRESS', "ctrl": True}, None), ("node.parent_set", {"type": 'P', "value": 'PRESS'}, None), ("node.join", {"type": 'J', "value": 'PRESS', "ctrl": True}, None), @@ -1128,6 +1102,10 @@ def km_info(params): items.extend([ ("info.select_pick", {"type": 'LEFTMOUSE', "value": 'PRESS'}, None), + ("info.select_pick", {"type": 'LEFTMOUSE', "value": 'PRESS', "shift": True}, + {"properties": [("extend", True)]}), + ("info.select_box", {"type": 'EVT_TWEAK_L', "value": 'ANY'}, + {"properties": [("wait_for_input", False)]}), ("info.select_all", {"type": 'A', "value": 'PRESS', "ctrl": True}, {"properties": [("action", 'SELECT')]}), ("info.select_all", {"type": 'A', "value": 'PRESS', "ctrl": True, "shift": True}, None), ("info.select_all", {"type": 'I', "value": 'PRESS', "ctrl": True}, None), @@ -1277,9 +1255,8 @@ def km_dopesheet_generic(params): ) items.extend([ - ("action.properties", {"type": 'N', "value": 'PRESS'}, None), - ("wm.context_set_enum", {"type": 'TAB', "value": 'PRESS', "ctrl": True}, - {"properties": [("data_path", 'area.type'), ("value", 'GRAPH_EDITOR')]}) + ("wm.context_toggle", {"type": 'RIGHT_BRACKET', "value": 'PRESS', "ctrl": True}, + {"properties": [("data_path", 'space_data.show_region_ui')]}), ]) return keymap @@ -1296,7 +1273,7 @@ def km_dopesheet(params): items.extend([ *_template_items_animation(), ("action.clickselect", {"type": 'LEFTMOUSE', "value": 'PRESS'}, - {"properties": [("extend", False), ("column", False), ("channel", False)]}), + {"properties": [("extend", False), ("deselect_all", True), ("column", False), ("channel", False)]}), ("action.clickselect", {"type": 'LEFTMOUSE', "value": 'PRESS', "alt": True}, {"properties": [("extend", False), ("column", True), ("channel", False)]}), ("action.clickselect", {"type": 'LEFTMOUSE', "value": 'PRESS', "shift": True}, @@ -1307,8 +1284,6 @@ def km_dopesheet(params): {"properties": [("extend", False), ("column", False), ("channel", True)]}), ("action.clickselect", {"type": 'LEFTMOUSE', "value": 'PRESS', "shift": True, "ctrl": True, "alt": True}, {"properties": [("extend", True), ("column", False), ("channel", True)]}), - ("action.select_leftright", {"type": 'LEFTMOUSE', "value": 'PRESS', "ctrl": True}, - {"properties": [("mode", 'CHECK'), ("extend", False)]}), ("action.select_leftright", {"type": 'LEFTMOUSE', "value": 'PRESS', "shift": True, "ctrl": True}, {"properties": [("mode", 'CHECK'), ("extend", True)]}), ("action.select_leftright", {"type": 'LEFT_BRACKET', "value": 'PRESS'}, @@ -1322,6 +1297,12 @@ def km_dopesheet(params): {"properties": [("axis_range", False)]}), ("action.select_box", {"type": 'Q', "value": 'PRESS', "alt": True}, {"properties": [("axis_range", True)]}), + ("action.select_box", {"type": 'EVT_TWEAK_L', "value": 'ANY'}, + {"properties":[("axis_range", False), ("wait_for_input", False), ("mode", 'SET')]}), + ("action.select_box", {"type": 'EVT_TWEAK_L', "value": 'ANY', "shift": True}, + {"properties":[("axis_range", False), ("wait_for_input", False), ("mode", 'ADD')]}), + ("action.select_box", {"type": 'EVT_TWEAK_L', "value": 'ANY', "ctrl": True}, + {"properties":[("axis_range", False), ("wait_for_input", False), ("mode", 'SUB')]}), ("action.select_column", {"type": 'K', "value": 'PRESS'}, {"properties": [("mode", 'KEYS')]}), ("action.select_column", {"type": 'K', "value": 'PRESS', "ctrl": True}, @@ -1348,19 +1329,20 @@ def km_dopesheet(params): ("action.view_all", {"type": 'NDOF_BUTTON_FIT', "value": 'PRESS'}, None), ("action.view_selected", {"type": 'F', "value": 'PRESS'}, None), ("action.view_frame", {"type": 'NUMPAD_0', "value": 'PRESS'}, None), - ("anim.channels_editable_toggle", {"type": 'TAB', "value": 'PRESS'}, None), + ("anim.channels_editable_toggle", {"type": 'LEFTMOUSE', "value": 'DOUBLE_CLICK'}, None), ("anim.channels_find", {"type": 'F', "value": 'PRESS', "ctrl": True}, None), - ("transform.transform", {"type": 'G', "value": 'PRESS'}, + ("transform.transform", {"type": 'W', "value": 'PRESS'}, {"properties": [("mode", 'TIME_TRANSLATE')]}), - ("transform.transform", {"type": 'EVT_TWEAK_L', "value": 'ANY'}, + ("transform.transform", {"type": 'LEFTMOUSE', "value": 'PRESS'}, + {"properties": [("mode", 'TIME_TRANSLATE')]}), + ("transform.transform", {"type": 'EVT_TWEAK_M', "value": 'ANY'}, {"properties": [("mode", 'TIME_TRANSLATE')]}), ("transform.transform", {"type": 'E', "value": 'PRESS'}, {"properties": [("mode", 'TIME_EXTEND')]}), - ("transform.transform", {"type": 'S', "value": 'PRESS'}, + ("transform.transform", {"type": 'R', "value": 'PRESS'}, {"properties": [("mode", 'TIME_SCALE')]}), ("transform.transform", {"type": 'T', "value": 'PRESS', "shift": True}, {"properties": [("mode", 'TIME_SLIDE')]}), - op_menu_pie("VIEW3D_MT_proportional_editing_falloff_pie", {"type": 'O', "value": 'PRESS', "shift": True}), ("marker.add", {"type": 'M', "value": 'PRESS'}, None), ("marker.rename", {"type": 'RET', "value": 'PRESS'}, None), ("anim.start_frame_set", {"type": 'LEFT_ARROW', "value": 'PRESS', "ctrl": True}, None), @@ -1418,7 +1400,7 @@ def km_nla_editor(params): items.extend([ ("nla.click_select", {"type": 'LEFTMOUSE', "value": 'PRESS'}, - {"properties": [("extend", False)]}), + {"properties": [("extend", False), ("deselect_all", True)]}), ("nla.click_select", {"type": 'LEFTMOUSE', "value": 'PRESS', "shift": True}, {"properties": [("extend", True)]}), ("nla.select_leftright", {"type": 'LEFTMOUSE', "value": 'PRESS', "ctrl": True}, @@ -1482,7 +1464,8 @@ def km_text_generic(params): ("text.jump", {"type": 'J', "value": 'PRESS', "ctrl": True}, None), ("text.find", {"type": 'G', "value": 'PRESS', "ctrl": True}, None), ("text.replace", {"type": 'H', "value": 'PRESS', "ctrl": True}, None), - ("text.properties", {"type": 'I', "value": 'PRESS', "ctrl": True}, None), + ("wm.context_toggle", {"type": 'I', "value": 'PRESS', "ctrl": True}, + {"properties": [("data_path", 'space_data.show_region_ui')]}), ]) return keymap @@ -1638,10 +1621,8 @@ def km_sequencercommon(_params): ) items.extend([ - ("sequencer.properties", {"type": 'N', "value": 'PRESS'}, None), - ("wm.context_toggle", {"type": 'O', "value": 'PRESS', "shift": True}, - {"properties": [("data_path", 'scene.sequence_editor.show_overlay')]}), - #("sequencer.view_toggle", {"type": 'TAB', "value": 'PRESS', "ctrl": True}, None), + ("wm.context_toggle", {"type": 'RIGHT_BRACKET', "value": 'PRESS', "ctrl": True}, + {"properties": [("data_path", 'space_data.show_region_ui')]}), ]) return keymap @@ -1684,7 +1665,7 @@ def km_sequencer(params): ("sequencer.copy", {"type": 'C', "value": 'PRESS', "ctrl": True}, None), ("sequencer.paste", {"type": 'V', "value": 'PRESS', "ctrl": True}, None), ("sequencer.images_separate", {"type": 'Y', "value": 'PRESS'}, None), - ("sequencer.meta_toggle", {"type": 'TAB', "value": 'PRESS'}, None), + ("sequencer.meta_toggle", {"type": 'LEFTMOUSE', "value": 'DOUBLE_CLICK'}, None), ("sequencer.meta_make", {"type": 'G', "value": 'PRESS', "ctrl": True}, None), ("sequencer.meta_separate", {"type": 'G', "value": 'PRESS', "ctrl": True, "alt": True}, None), ("sequencer.view_all", {"type": 'A', "value": 'PRESS'}, None), @@ -1718,7 +1699,7 @@ def km_sequencer(params): ) ), ("sequencer.select", {"type": 'LEFTMOUSE', "value": 'PRESS'}, - {"properties": [("extend", False), ("linked_handle", False), ("left_right", 'NONE'), ("linked_time", False)]}), + {"properties": [("extend", False), ("deselect_all", True), ("linked_handle", False), ("left_right", 'NONE'), ("linked_time", False)]}), ("sequencer.select", {"type": 'LEFTMOUSE', "value": 'PRESS', "shift": True}, {"properties": [("extend", True), ("linked_handle", False), ("left_right", 'NONE'), ("linked_time", False)]}), ("sequencer.select", {"type": 'LEFTMOUSE', "value": 'PRESS', "alt": True}, @@ -1741,7 +1722,7 @@ def km_sequencer(params): ("sequencer.slip", {"type": 'S', "value": 'PRESS'}, None), ("wm.context_set_int", {"type": 'O', "value": 'PRESS'}, {"properties": [("data_path", 'scene.sequence_editor.overlay_frame'), ("value", 0)]}), - ("transform.seq_slide", {"type": 'G', "value": 'PRESS'}, None), + ("transform.seq_slide", {"type": 'W', "value": 'PRESS'}, None), ("transform.seq_slide", {"type": 'EVT_TWEAK_L', "value": 'ANY'}, None), ("transform.transform", {"type": 'E', "value": 'PRESS'}, {"properties": [("mode", 'TIME_EXTEND')]}), @@ -1917,7 +1898,7 @@ def km_clip_editor(params): {"properties": [("position", 'PATHSTART')]}), ("clip.change_frame", {"type": 'LEFTMOUSE', "value": 'PRESS'}, None), ("clip.select", {"type": 'LEFTMOUSE', "value": 'PRESS'}, - {"properties": [("extend", False)]}), + {"properties": [("extend", False), ("deselect_all", True)]}), ("clip.select", {"type": 'LEFTMOUSE', "value": 'PRESS', "shift": True}, {"properties": [("extend", True)]}), ("clip.select_box", {"type": 'Q', "value": 'PRESS'}, None), @@ -2219,7 +2200,8 @@ def km_grease_pencil_stroke_edit_mode(params): ("gpencil.interpolate", {"type": 'E', "value": 'PRESS', "ctrl": True, "alt": True}, None), ("gpencil.interpolate_sequence", {"type": 'E', "value": 'PRESS', "shift": True, "ctrl": True}, None), # Normal select - ("gpencil.select", {"type": 'LEFTMOUSE', "value": 'PRESS'}, None), + ("gpencil.select", {"type": 'LEFTMOUSE', "value": 'PRESS'}, + {"properties": [("deselect_all", True)]}), # Selection *_grease_pencil_selection(params), # Duplicate and move selected points @@ -3345,10 +3327,11 @@ def km_knife_tool_modal_map(_params): items.extend([ ("CANCEL", {"type": 'ESC', "value": 'PRESS', "any": True}, None), ("PANNING", {"type": 'LEFTMOUSE', "value": 'PRESS', "alt": True}, None), - ("ADD_CUT", {"type": 'LEFTMOUSE', "value": 'PRESS'}, None), + ("ADD_CUT", {"type": 'LEFTMOUSE', "value": 'ANY', "any": True}, None), + ("CANCEL", {"type": 'RIGHTMOUSE', "value": 'PRESS', "any": True}, None), ("CONFIRM", {"type": 'RET', "value": 'PRESS', "any": True}, None), ("CONFIRM", {"type": 'NUMPAD_ENTER', "value": 'PRESS', "any": True}, None), - ("CONFIRM", {"type": 'SPACE', "value": 'PRESS', "any": True}, None), + ("CONFIRM", {"type": 'LEFTMOUSE', "value": 'DOUBLE_CLICK', "any": True}, None), ("NEW_CUT", {"type": 'E', "value": 'PRESS'}, None), ("SNAP_MIDPOINTS_ON", {"type": 'LEFT_CTRL', "value": 'PRESS', "any": True}, None), ("SNAP_MIDPOINTS_OFF", {"type": 'LEFT_CTRL', "value": 'RELEASE', "any": True}, None), @@ -3463,20 +3446,97 @@ def km_transform_modal_map(_params): # Tool System Keymaps - def km_3d_view_tool_move(params): return ( "3D View Tool: Move", {"space_type": 'VIEW_3D', "region_type": 'WINDOW'}, {"items": [ - ("transform.translate", {"type": params.tool_tweak, "value": 'ANY'}, + ("transform.translate", {"type": 'MIDDLEMOUSE', "value": 'ANY'}, {"properties": [("release_confirm", True)]}), - ("object.duplicate_move", {"type": params.tool_tweak, "value": 'ANY', "shift": True}, None), - ("mesh.duplicate_move", {"type": params.tool_tweak, "value": 'ANY', "shift": True}, None), - ("curve.duplicate_move", {"type": params.tool_tweak, "value": 'ANY', "shift": True}, None), - ("armature.duplicate_move", {"type": params.tool_tweak, "value": 'ANY', "shift": True}, None), - ("mball.duplicate_move", {"type": params.tool_tweak, "value": 'ANY', "shift": True}, None), - ("gpencil.duplicate_move", {"type": 'D', "value": 'PRESS', "ctrl": True}, None), + *_template_items_tool_select_actions("view3d.select_box", type=params.tool_tweak, value='ANY'), + ]}, + ) + + +def km_3d_view_tool_rotate(params): + return ( + "3D View Tool: Rotate", + {"space_type": 'VIEW_3D', "region_type": 'WINDOW'}, + {"items": [ + ("transform.rotate", {"type": 'MIDDLEMOUSE', "value": 'ANY'}, + {"properties": [("release_confirm", True)]}), + *_template_items_tool_select_actions("view3d.select_box", type=params.tool_tweak, value='ANY'), + ]}, + ) + + +def km_3d_view_tool_scale(params): + return ( + "3D View Tool: Scale", + {"space_type": 'VIEW_3D', "region_type": 'WINDOW'}, + {"items": [ + ("transform.resize", {"type": 'MIDDLEMOUSE', "value": 'ANY'}, + {"properties": [("release_confirm", True)]}), + *_template_items_tool_select_actions("view3d.select_box", type=params.tool_tweak, value='ANY'), + ]}, + ) + + +def km_3d_view_tool_edit_mesh_extrude_region(params): + return ( + "3D View Tool: Edit Mesh, Extrude Region", + {"space_type": 'VIEW_3D', "region_type": 'WINDOW'}, + {"items": [ + ("mesh.extrude_context_move", {"type": 'MIDDLEMOUSE', "value": 'ANY'}, + {"properties": [("TRANSFORM_OT_translate", [("release_confirm", True)])]}), + *_template_items_tool_select_actions("view3d.select_box", type=params.tool_tweak, value='ANY'), + ]}, + ) + + +def km_3d_view_tool_edit_mesh_shear(params): + return ( + "3D View Tool: Edit Mesh, Shear", + {"space_type": 'VIEW_3D', "region_type": 'WINDOW'}, + {"items": [ + ("transform.shear", {"type": 'MIDDLEMOUSE', "value": 'ANY'}, + {"properties": [("release_confirm", True)]}), + *_template_items_tool_select_actions("view3d.select_box", type=params.tool_tweak, value='ANY'), + ]}, + ) + + +def km_3d_view_tool_edit_mesh_spin(params): + return ( + "3D View Tool: Edit Mesh, Spin", + {"space_type": 'VIEW_3D', "region_type": 'WINDOW'}, + {"items": [ + ("mesh.spin", {"type": 'MIDDLEMOUSE', "value": 'ANY'}, None), + *_template_items_tool_select_actions("view3d.select_box", type=params.tool_tweak, value='ANY'), + ]}, + ) + + +def km_3d_view_tool_edit_mesh_spin_duplicate(params): + return ( + "3D View Tool: Edit Mesh, Spin Duplicates", + {"space_type": 'VIEW_3D', "region_type": 'WINDOW'}, + {"items": [ + ("mesh.spin", {"type": 'MIDDLEMOUSE', "value": 'ANY'}, + {"properties": [("dupli", True)]}), + *_template_items_tool_select_actions("view3d.select_box", type=params.tool_tweak, value='ANY'), + ]}, + ) + + +def km_3d_view_tool_edit_curve_extrude(params): + return ( + "3D View Tool: Edit Curve, Extrude", + {"space_type": 'VIEW_3D', "region_type": 'WINDOW'}, + {"items": [ + ("curve.extrude_move", {"type": 'MIDDLEMOUSE', "value": 'ANY'}, + {"properties": [("TRANSFORM_OT_translate", [("release_confirm", True)])]}), + *_template_items_tool_select_actions("view3d.select_box", type=params.tool_tweak, value='ANY'), ]}, ) @@ -3501,7 +3561,6 @@ def generate_keymaps(params=None): # Editors. km_outliner(params), km_uv_editor(params), - km_uv_sculpt(params), km_view3d_generic(params), km_view3d(params), km_mask_editing(params), @@ -3572,4 +3631,11 @@ def generate_keymaps(params=None): # Tool System. km_3d_view_tool_move(params), + km_3d_view_tool_rotate(params), + km_3d_view_tool_scale(params), + km_3d_view_tool_edit_mesh_extrude_region(params), + km_3d_view_tool_edit_mesh_shear(params), + km_3d_view_tool_edit_mesh_spin(params), + km_3d_view_tool_edit_mesh_spin_duplicate(params), + km_3d_view_tool_edit_curve_extrude(params), ] diff --git a/release/scripts/startup/bl_operators/image.py b/release/scripts/startup/bl_operators/image.py index a3de2811750..d07546d1773 100644 --- a/release/scripts/startup/bl_operators/image.py +++ b/release/scripts/startup/bl_operators/image.py @@ -132,7 +132,7 @@ class SaveDirty(Operator): " can't be re-packed" % (image.name, image.library.filepath)) else: - image.pack(as_png=True) + image.pack() else: filepath = bpy.path.abspath(image.filepath, library=image.library) diff --git a/release/scripts/startup/bl_operators/presets.py b/release/scripts/startup/bl_operators/presets.py index baacb0c051e..c7f516f61a1 100644 --- a/release/scripts/startup/bl_operators/presets.py +++ b/release/scripts/startup/bl_operators/presets.py @@ -670,6 +670,9 @@ class AddPresetGpencilMaterial(AddPresetBase, Operator): "gpcolor.stroke_image", "gpcolor.pixel_size", "gpcolor.use_stroke_pattern", + "gpcolor.use_stroke_texture_mix", + "gpcolor.mix_stroke_factor", + "gpcolor.use_follow_path", "gpcolor.fill_style", "gpcolor.fill_color", "gpcolor.fill_image", @@ -688,7 +691,7 @@ class AddPresetGpencilMaterial(AddPresetBase, Operator): "gpcolor.texture_angle", "gpcolor.texture_opacity", "gpcolor.texture_clamp", - "gpcolor.texture_mix", + "gpcolor.use_fill_texture_mix", "gpcolor.mix_factor", "gpcolor.show_stroke", "gpcolor.show_fill", diff --git a/release/scripts/startup/bl_ui/__init__.py b/release/scripts/startup/bl_ui/__init__.py index 138b5393777..44229b2afdf 100644 --- a/release/scripts/startup/bl_ui/__init__.py +++ b/release/scripts/startup/bl_ui/__init__.py @@ -120,7 +120,7 @@ def register(): ) from bpy.types import WindowManager - def addon_filter_items(self, context): + def addon_filter_items(_self, _context): import addon_utils items = [ diff --git a/release/scripts/startup/bl_ui/properties_animviz.py b/release/scripts/startup/bl_ui/properties_animviz.py index 10a3d1ddb91..6c3c1fd1721 100644 --- a/release/scripts/startup/bl_ui/properties_animviz.py +++ b/release/scripts/startup/bl_ui/properties_animviz.py @@ -31,7 +31,7 @@ class MotionPathButtonsPanel: bl_label = "Motion Paths" # bl_options = {'DEFAULT_CLOSED'} - def draw_settings(self, context, avs, mpath, bones=False): + def draw_settings(self, _context, avs, mpath, bones=False): layout = self.layout mps = avs.motion_path @@ -89,7 +89,7 @@ class MotionPathButtonsPanel_display: bl_region_type = 'WINDOW' bl_label = "Display" - def draw_settings(self, context, avs, mpath, bones=False): + def draw_settings(self, _context, avs, mpath, bones=False): layout = self.layout mps = avs.motion_path diff --git a/release/scripts/startup/bl_ui/properties_constraint.py b/release/scripts/startup/bl_ui/properties_constraint.py index 0fc67d4aed6..a5353a4e29e 100644 --- a/release/scripts/startup/bl_ui/properties_constraint.py +++ b/release/scripts/startup/bl_ui/properties_constraint.py @@ -93,7 +93,7 @@ class ConstraintButtonsPanel: col = split.column() col.prop(con, "chain_count") - def CHILD_OF(self, context, layout, con): + def CHILD_OF(self, _context, layout, con): self.target_template(layout, con) split = layout.split() @@ -120,7 +120,7 @@ class ConstraintButtonsPanel: row.operator("constraint.childof_set_inverse") row.operator("constraint.childof_clear_inverse") - def TRACK_TO(self, context, layout, con): + def TRACK_TO(self, _context, layout, con): self.target_template(layout, con) row = layout.row() @@ -176,7 +176,7 @@ class ConstraintButtonsPanel: sub.active = con.use_rotation sub.prop(con, "orient_weight", text="Rotation", slider=True) - def IK_COPY_POSE(self, context, layout, con): + def IK_COPY_POSE(self, _context, layout, con): self.target_template(layout, con) self.ik_template(layout, con) @@ -211,7 +211,7 @@ class ConstraintButtonsPanel: row.prop(con, "lock_rotation_z", text="Z") split.active = con.use_rotation - def IK_DISTANCE(self, context, layout, con): + def IK_DISTANCE(self, _context, layout, con): self.target_template(layout, con) self.ik_template(layout, con) @@ -221,7 +221,7 @@ class ConstraintButtonsPanel: row.prop(con, "weight", text="Weight", slider=True) row.prop(con, "distance", text="Distance", slider=True) - def FOLLOW_PATH(self, context, layout, con): + def FOLLOW_PATH(self, _context, layout, con): self.target_template(layout, con) layout.operator("constraint.followpath_path_animate", text="Animate Path", icon='ANIM_DATA') @@ -246,7 +246,7 @@ class ConstraintButtonsPanel: row.prop(con, "up_axis", text="Up") row.label() - def LIMIT_ROTATION(self, context, layout, con): + def LIMIT_ROTATION(self, _context, layout, con): split = layout.split() col = split.column(align=True) @@ -276,7 +276,7 @@ class ConstraintButtonsPanel: row.label(text="Convert:") row.prop(con, "owner_space", text="") - def LIMIT_LOCATION(self, context, layout, con): + def LIMIT_LOCATION(self, _context, layout, con): split = layout.split() col = split.column() @@ -317,7 +317,7 @@ class ConstraintButtonsPanel: row.label(text="Convert:") row.prop(con, "owner_space", text="") - def LIMIT_SCALE(self, context, layout, con): + def LIMIT_SCALE(self, _context, layout, con): split = layout.split() col = split.column() @@ -358,7 +358,7 @@ class ConstraintButtonsPanel: row.label(text="Convert:") row.prop(con, "owner_space", text="") - def COPY_ROTATION(self, context, layout, con): + def COPY_ROTATION(self, _context, layout, con): self.target_template(layout, con) split = layout.split() @@ -385,7 +385,7 @@ class ConstraintButtonsPanel: self.space_template(layout, con) - def COPY_LOCATION(self, context, layout, con): + def COPY_LOCATION(self, _context, layout, con): self.target_template(layout, con) split = layout.split() @@ -412,7 +412,7 @@ class ConstraintButtonsPanel: self.space_template(layout, con) - def COPY_SCALE(self, context, layout, con): + def COPY_SCALE(self, _context, layout, con): self.target_template(layout, con) row = layout.row(align=True) @@ -428,7 +428,7 @@ class ConstraintButtonsPanel: self.space_template(layout, con) - def MAINTAIN_VOLUME(self, context, layout, con): + def MAINTAIN_VOLUME(self, _context, layout, con): row = layout.row() row.label(text="Free:") @@ -440,14 +440,14 @@ class ConstraintButtonsPanel: row.label(text="Convert:") row.prop(con, "owner_space", text="") - def COPY_TRANSFORMS(self, context, layout, con): + def COPY_TRANSFORMS(self, _context, layout, con): self.target_template(layout, con) self.space_template(layout, con) # def SCRIPT(self, context, layout, con): - def ACTION(self, context, layout, con): + def ACTION(self, _context, layout, con): self.target_template(layout, con) split = layout.split() @@ -474,7 +474,7 @@ class ConstraintButtonsPanel: col.prop(con, "frame_start", text="Start") col.prop(con, "frame_end", text="End") - def LOCKED_TRACK(self, context, layout, con): + def LOCKED_TRACK(self, _context, layout, con): self.target_template(layout, con) row = layout.row() @@ -485,7 +485,7 @@ class ConstraintButtonsPanel: row.label(text="Lock:") row.prop(con, "lock_axis", expand=True) - def LIMIT_DISTANCE(self, context, layout, con): + def LIMIT_DISTANCE(self, _context, layout, con): self.target_template(layout, con) col = layout.column(align=True) @@ -502,7 +502,7 @@ class ConstraintButtonsPanel: self.space_template(layout, con) - def STRETCH_TO(self, context, layout, con): + def STRETCH_TO(self, _context, layout, con): self.target_template(layout, con) row = layout.row() @@ -532,7 +532,7 @@ class ConstraintButtonsPanel: row.label(text="Plane:") row.prop(con, "keep_axis", expand=True) - def FLOOR(self, context, layout, con): + def FLOOR(self, _context, layout, con): self.target_template(layout, con) row = layout.row() @@ -547,7 +547,7 @@ class ConstraintButtonsPanel: self.space_template(layout, con) - def RIGID_BODY_JOINT(self, context, layout, con): + def RIGID_BODY_JOINT(self, _context, layout, con): self.target_template(layout, con, subtargets=False) layout.prop(con, "pivot_type") @@ -656,7 +656,7 @@ class ConstraintButtonsPanel: col.active = con.use_angular_limit_x col.prop(con, "limit_angle_max_x", text="Max") - def CLAMP_TO(self, context, layout, con): + def CLAMP_TO(self, _context, layout, con): self.target_template(layout, con) row = layout.row() @@ -665,7 +665,7 @@ class ConstraintButtonsPanel: layout.prop(con, "use_cyclic") - def TRANSFORM(self, context, layout, con): + def TRANSFORM(self, _context, layout, con): self.target_template(layout, con) layout.prop(con, "use_motion_extrapolate", text="Extrapolate") @@ -742,7 +742,7 @@ class ConstraintButtonsPanel: self.space_template(layout, con) - def SHRINKWRAP(self, context, layout, con): + def SHRINKWRAP(self, _context, layout, con): self.target_template(layout, con, False) layout.prop(con, "distance") @@ -776,14 +776,14 @@ class ConstraintButtonsPanel: row.active = con.use_track_normal row.prop(con, "track_axis", expand=True) - def DAMPED_TRACK(self, context, layout, con): + def DAMPED_TRACK(self, _context, layout, con): self.target_template(layout, con) row = layout.row() row.label(text="To:") row.prop(con, "track_axis", expand=True) - def SPLINE_IK(self, context, layout, con): + def SPLINE_IK(self, _context, layout, con): self.target_template(layout, con) col = layout.column() @@ -816,7 +816,7 @@ class ConstraintButtonsPanel: col.active = con.use_bulge_min or con.use_bulge_max col.prop(con, "bulge_smooth", text="Smooth") - def PIVOT(self, context, layout, con): + def PIVOT(self, _context, layout, con): self.target_template(layout, con) if con.target: @@ -876,7 +876,7 @@ class ConstraintButtonsPanel: layout.operator("clip.constraint_to_fcurve") - def CAMERA_SOLVER(self, context, layout, con): + def CAMERA_SOLVER(self, _context, layout, con): layout.prop(con, "use_active_clip") if not con.use_active_clip: @@ -903,7 +903,7 @@ class ConstraintButtonsPanel: layout.operator("clip.constraint_to_fcurve") - def TRANSFORM_CACHE(self, context, layout, con): + def TRANSFORM_CACHE(self, _context, layout, con): layout.label(text="Cache File Properties:") box = layout.box() box.template_cache_file(con, "cache_file") @@ -916,7 +916,7 @@ class ConstraintButtonsPanel: if cache_file is not None: box.prop_search(con, "object_path", cache_file, "object_paths") - def SCRIPT(self, context, layout, con): + def SCRIPT(self, _context, layout, _con): layout.label(text="Blender 2.6 doesn't support python constraints yet") def ARMATURE(self, context, layout, con): diff --git a/release/scripts/startup/bl_ui/properties_data_armature.py b/release/scripts/startup/bl_ui/properties_data_armature.py index 4e10ac205bf..5687b0df018 100644 --- a/release/scripts/startup/bl_ui/properties_data_armature.py +++ b/release/scripts/startup/bl_ui/properties_data_armature.py @@ -103,7 +103,7 @@ class DATA_PT_display(ArmatureButtonsPanel, Panel): class DATA_MT_bone_group_context_menu(Menu): bl_label = "Bone Group Specials" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator("pose.group_sort", icon='SORTALPHA') diff --git a/release/scripts/startup/bl_ui/properties_data_bone.py b/release/scripts/startup/bl_ui/properties_data_bone.py index 0af51ddd5ba..707b1ca3f1a 100644 --- a/release/scripts/startup/bl_ui/properties_data_bone.py +++ b/release/scripts/startup/bl_ui/properties_data_bone.py @@ -160,8 +160,12 @@ class BONE_PT_curved(BoneButtonsPanel, Panel): col.prop(bone, "use_endroll_as_inroll") col = topcol.column(align=True) - col.prop(bbone, "bbone_scalein", text="Scale In") - col.prop(bbone, "bbone_scaleout", text="Out") + col.prop(bbone, "bbone_scaleinx", text="Scale In X") + col.prop(bbone, "bbone_scaleiny", text="In Y") + + col = topcol.column(align=True) + col.prop(bbone, "bbone_scaleoutx", text="Scale Out X") + col.prop(bbone, "bbone_scaleouty", text="Out Y") col = topcol.column(align=True) col.prop(bbone, "bbone_easein", text="Ease In") diff --git a/release/scripts/startup/bl_ui/properties_data_camera.py b/release/scripts/startup/bl_ui/properties_data_camera.py index 84fe9fb1f3e..6ba3ad4e334 100644 --- a/release/scripts/startup/bl_ui/properties_data_camera.py +++ b/release/scripts/startup/bl_ui/properties_data_camera.py @@ -184,7 +184,7 @@ class DATA_PT_camera(CameraButtonsPanel, Panel): bl_options = {'DEFAULT_CLOSED'} COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH'} - def draw_header_preset(self, context): + def draw_header_preset(self, _context): CAMERA_PT_presets.draw_panel_header(self.layout) def draw(self, context): @@ -450,7 +450,7 @@ class DATA_PT_camera_safe_areas(CameraButtonsPanel, Panel): self.layout.prop(cam, "show_safe_areas", text="") - def draw_header_preset(self, context): + def draw_header_preset(self, _context): SAFE_AREAS_PT_presets.draw_panel_header(self.layout) def draw(self, context): diff --git a/release/scripts/startup/bl_ui/properties_data_gpencil.py b/release/scripts/startup/bl_ui/properties_data_gpencil.py index 5d11373b2e9..e96ec95786f 100644 --- a/release/scripts/startup/bl_ui/properties_data_gpencil.py +++ b/release/scripts/startup/bl_ui/properties_data_gpencil.py @@ -120,7 +120,7 @@ class DATA_PT_gpencil_layers(DataButtonsPanel, Panel): else: self.draw_layers(context, layout, gpd) - def draw_layers(self, context, layout, gpd): + def draw_layers(self, _context, layout, gpd): row = layout.row() @@ -338,7 +338,7 @@ class GPENCIL_MT_gpencil_vertex_group(Menu): class GPENCIL_UL_vgroups(UIList): - def draw_item(self, context, layout, data, item, icon, active_data, active_propname, index): + def draw_item(self, _context, layout, _data, item, icon, _active_data, _active_propname, _index): vgroup = item if self.layout_type in {'DEFAULT', 'COMPACT'}: layout.prop(vgroup, "name", text="", emboss=False, icon_value=icon) diff --git a/release/scripts/startup/bl_ui/properties_data_mesh.py b/release/scripts/startup/bl_ui/properties_data_mesh.py index eacf027c491..2e849daa17e 100644 --- a/release/scripts/startup/bl_ui/properties_data_mesh.py +++ b/release/scripts/startup/bl_ui/properties_data_mesh.py @@ -25,7 +25,7 @@ from rna_prop_ui import PropertyPanel class MESH_MT_vertex_group_context_menu(Menu): bl_label = "Vertex Group Specials" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator("object.vertex_group_sort", icon='SORTALPHA', text="Sort by Name").sort_type = 'NAME' @@ -51,7 +51,7 @@ class MESH_MT_vertex_group_context_menu(Menu): class MESH_MT_shape_key_context_menu(Menu): bl_label = "Shape Key Specials" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator("object.shape_key_add", icon='ADD', text="New Shape From Mix").from_mix = True @@ -69,7 +69,7 @@ class MESH_MT_shape_key_context_menu(Menu): class MESH_UL_vgroups(UIList): - def draw_item(self, context, layout, data, item, icon, active_data, active_propname, index): + def draw_item(self, _context, layout, _data, item, icon, _active_data_, _active_propname, _index): # assert(isinstance(item, bpy.types.VertexGroup)) vgroup = item if self.layout_type in {'DEFAULT', 'COMPACT'}: @@ -82,7 +82,7 @@ class MESH_UL_vgroups(UIList): class MESH_UL_fmaps(UIList): - def draw_item(self, context, layout, data, item, icon, active_data, active_propname, index): + def draw_item(self, _context, layout, _data, item, icon, _active_data, _active_propname, _index): # assert(isinstance(item, bpy.types.FaceMap)) fmap = item if self.layout_type in {'DEFAULT', 'COMPACT'}: @@ -93,7 +93,7 @@ class MESH_UL_fmaps(UIList): class MESH_UL_shape_keys(UIList): - def draw_item(self, context, layout, data, item, icon, active_data, active_propname, index): + def draw_item(self, _context, layout, _data, item, icon, active_data, _active_propname, index): # assert(isinstance(item, bpy.types.ShapeKey)) obj = active_data # key = data @@ -117,7 +117,7 @@ class MESH_UL_shape_keys(UIList): class MESH_UL_uvmaps(UIList): - def draw_item(self, context, layout, data, item, icon, active_data, active_propname, index): + def draw_item(self, _context, layout, _data, item, icon, _active_data, _active_propname, _index): # assert(isinstance(item, (bpy.types.MeshTexturePolyLayer, bpy.types.MeshLoopColorLayer))) if self.layout_type in {'DEFAULT', 'COMPACT'}: layout.prop(item, "name", text="", emboss=False, icon='GROUP_UVS') @@ -129,7 +129,7 @@ class MESH_UL_uvmaps(UIList): class MESH_UL_vcols(UIList): - def draw_item(self, context, layout, data, item, icon, active_data, active_propname, index): + def draw_item(self, _context, layout, _data, item, icon, _active_data, _active_propname, _index): # assert(isinstance(item, (bpy.types.MeshTexturePolyLayer, bpy.types.MeshLoopColorLayer))) if self.layout_type in {'DEFAULT', 'COMPACT'}: layout.prop(item, "name", text="", emboss=False, icon='GROUP_VCOL') diff --git a/release/scripts/startup/bl_ui/properties_data_modifier.py b/release/scripts/startup/bl_ui/properties_data_modifier.py index 8e0021b64a8..668dd61315d 100644 --- a/release/scripts/startup/bl_ui/properties_data_modifier.py +++ b/release/scripts/startup/bl_ui/properties_data_modifier.py @@ -79,7 +79,7 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel): split.prop(md, "use_multi_modifier") - def ARRAY(self, layout, ob, md): + def ARRAY(self, layout, _ob, md): layout.prop(md, "fit_type") if md.fit_type == 'FIXED_COUNT': @@ -171,7 +171,7 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel): layout.row().prop(md, "miter_inner") layout.row().prop(md, "spread") - def BOOLEAN(self, layout, ob, md): + def BOOLEAN(self, layout, _ob, md): split = layout.split() col = split.column() @@ -187,7 +187,7 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel): if bpy.app.debug: layout.prop(md, "debug_options") - def BUILD(self, layout, ob, md): + def BUILD(self, layout, _ob, md): split = layout.split() col = split.column() @@ -201,7 +201,7 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel): sub.active = md.use_random_order sub.prop(md, "seed") - def MESH_CACHE(self, layout, ob, md): + def MESH_CACHE(self, layout, _ob, md): layout.prop(md, "cache_format") layout.prop(md, "filepath") @@ -288,10 +288,10 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel): if md.object: col.prop(md, "use_transform") - def CLOTH(self, layout, ob, md): + def CLOTH(self, layout, _ob, _md): layout.label(text="Settings are inside the Physics tab") - def COLLISION(self, layout, ob, md): + def COLLISION(self, layout, _ob, _md): layout.label(text="Settings are inside the Physics tab") def CURVE(self, layout, ob, md): @@ -386,10 +386,10 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel): row.prop(md, "mid_level") row.prop(md, "strength") - def DYNAMIC_PAINT(self, layout, ob, md): + def DYNAMIC_PAINT(self, layout, _ob, _md): layout.label(text="Settings are inside the Physics tab") - def EDGE_SPLIT(self, layout, ob, md): + def EDGE_SPLIT(self, layout, _ob, md): split = layout.split() col = split.column() @@ -421,7 +421,7 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel): layout.operator("object.explode_refresh", text="Refresh") - def FLUID_SIMULATION(self, layout, ob, md): + def FLUID_SIMULATION(self, layout, _ob, _md): layout.label(text="Settings are inside the Physics tab") def HOOK(self, layout, ob, md): @@ -575,7 +575,7 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel): else: layout.operator("object.meshdeform_bind", text="Bind") - def MIRROR(self, layout, ob, md): + def MIRROR(self, layout, _ob, md): axis_text = "XYZ" split = layout.split(factor=0.33) @@ -673,7 +673,7 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel): row.operator("object.multires_external_save", text="Save External...") row.label() - def OCEAN(self, layout, ob, md): + def OCEAN(self, layout, _ob, md): if not bpy.app.build_options.mod_oceansim: layout.label(text="Built without OceanSim modifier") return @@ -809,10 +809,10 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel): col.prop_search(md, "index_layer_name", ob.data, "vertex_colors", text="Index Layer") col.prop_search(md, "value_layer_name", ob.data, "vertex_colors", text="Value Layer") - def PARTICLE_SYSTEM(self, layout, ob, md): + def PARTICLE_SYSTEM(self, layout, _ob, _md): layout.label(text="Settings can be found inside the Particle context") - def SCREW(self, layout, ob, md): + def SCREW(self, layout, _ob, md): split = layout.split() col = split.column() @@ -932,7 +932,7 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel): col.prop(md, "angle") col.prop(md, "limits", slider=True) - def SMOKE(self, layout, ob, md): + def SMOKE(self, layout, _ob, _md): layout.label(text="Settings are inside the Physics tab") def SMOOTH(self, layout, ob, md): @@ -950,7 +950,7 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel): col.label(text="Vertex Group:") col.prop_search(md, "vertex_group", ob, "vertex_groups", text="") - def SOFT_BODY(self, layout, ob, md): + def SOFT_BODY(self, layout, _ob, _md): layout.label(text="Settings are inside the Physics tab") def SOLIDIFY(self, layout, ob, md): @@ -1049,10 +1049,10 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel): preview = max(scene.cycles.preview_dicing_rate * ob.cycles.dicing_rate, 0.1) col.label(text=f"Render {render:.2f} px, Preview {preview:.2f} px") - def SURFACE(self, layout, ob, md): + def SURFACE(self, layout, _ob, _md): layout.label(text="Settings are inside the Physics tab") - def SURFACE_DEFORM(self, layout, ob, md): + def SURFACE_DEFORM(self, layout, _ob, md): col = layout.column() col.active = not md.is_bound @@ -1190,7 +1190,7 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel): col.prop(md, "width", slider=True) col.prop(md, "narrowness", slider=True) - def REMESH(self, layout, ob, md): + def REMESH(self, layout, _ob, md): if not bpy.app.build_options.mod_remesh: layout.label(text="Built without Remesh modifier") return @@ -1331,7 +1331,7 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel): layout.separator() self.vertex_weight_mask(layout, ob, md) - def SKIN(self, layout, ob, md): + def SKIN(self, layout, _ob, md): row = layout.row() row.operator("object.skin_armature_create", text="Create Armature") row.operator("mesh.customdata_skin_add") @@ -1360,7 +1360,7 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel): col.prop(md, "use_y_symmetry") col.prop(md, "use_z_symmetry") - def TRIANGULATE(self, layout, ob, md): + def TRIANGULATE(self, layout, _ob, md): row = layout.row() col = row.column() diff --git a/release/scripts/startup/bl_ui/properties_data_shaderfx.py b/release/scripts/startup/bl_ui/properties_data_shaderfx.py index 5ada588e31a..fce86446dfc 100644 --- a/release/scripts/startup/bl_ui/properties_data_shaderfx.py +++ b/release/scripts/startup/bl_ui/properties_data_shaderfx.py @@ -30,11 +30,12 @@ class ShaderFxButtonsPanel: class DATA_PT_shader_fx(ShaderFxButtonsPanel, Panel): bl_label = "Effects" - @classmethod - def poll(cls, context): - return True - ob = context.object - return ob and ob.type == 'GPENCIL' + # Unused: always show for now. + + # @classmethod + # def poll(cls, context): + # ob = context.object + # return ob and ob.type == 'GPENCIL' def draw(self, context): layout = self.layout diff --git a/release/scripts/startup/bl_ui/properties_freestyle.py b/release/scripts/startup/bl_ui/properties_freestyle.py index a4c109b150a..095bd182ad4 100644 --- a/release/scripts/startup/bl_ui/properties_freestyle.py +++ b/release/scripts/startup/bl_ui/properties_freestyle.py @@ -90,7 +90,7 @@ class ViewLayerFreestyleEditorButtonsPanel(ViewLayerFreestyleButtonsPanel): class VIEWLAYER_UL_linesets(UIList): - def draw_item(self, context, layout, data, item, icon, active_data, active_propname, index): + def draw_item(self, _context, layout, _data, item, icon, _active_data, _active_propname, index): lineset = item if self.layout_type in {'DEFAULT', 'COMPACT'}: layout.prop(lineset, "name", text="", emboss=False, icon_value=icon) @@ -103,7 +103,7 @@ class VIEWLAYER_UL_linesets(UIList): class RENDER_MT_lineset_context_menu(Menu): bl_label = "Lineset Specials" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator("scene.freestyle_lineset_copy", icon='COPYDOWN') layout.operator("scene.freestyle_lineset_paste", icon='PASTEDOWN') @@ -289,7 +289,7 @@ class VIEWLAYER_PT_freestyle_linestyle(ViewLayerFreestyleEditorButtonsPanel, Pan sub.operator("scene.freestyle_modifier_move", icon='TRIA_DOWN', text="").direction = 'DOWN' sub.operator("scene.freestyle_modifier_remove", icon='X', text="") - def draw_modifier_box_error(self, box, modifier, message): + def draw_modifier_box_error(self, box, _modifier, message): row = box.row() row.label(text=message, icon='ERROR') @@ -514,7 +514,7 @@ class VIEWLAYER_PT_freestyle_linestyle(ViewLayerFreestyleEditorButtonsPanel, Pan message = "Enable Face Smoothness to use this modifier" self.draw_modifier_box_error(col.box(), modifier, message) - def draw_geometry_modifier(self, context, modifier): + def draw_geometry_modifier(self, _context, modifier): layout = self.layout col = layout.column(align=True) diff --git a/release/scripts/startup/bl_ui/properties_grease_pencil_common.py b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py index 6e1253df968..734828bceaa 100644 --- a/release/scripts/startup/bl_ui/properties_grease_pencil_common.py +++ b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py @@ -84,10 +84,6 @@ class AnnotationDrawingToolsPanel: bl_category = "Annotation" bl_region_type = 'TOOLS' - @classmethod - def poll(cls, context): - return True - def draw(self, context): layout = self.layout @@ -390,7 +386,7 @@ class GPENCIL_MT_pie_tool_palette(Menu): row.operator("transform.resize", text="Scale", icon='MAN_SCALE') row = col.row(align=True) row.label(text="Proportional Edit:") - row.prop(context.tool_settings, "proportional_edit", text="", icon_only=True) + row.prop(context.tool_settings, "use_proportional_edit", text="", icon_only=True) row.prop(context.tool_settings, "proportional_edit_falloff", text="", icon_only=True) # NW - Select (Non-Modal) @@ -510,7 +506,7 @@ class GPENCIL_MT_pie_tools_more(Menu): gpd = context.gpencil_data return bool(gpd and gpd.use_stroke_edit_mode and context.editable_gpencil_strokes) - def draw(self, context): + def draw(self, _context): layout = self.layout pie = layout.menu_pie() @@ -586,7 +582,7 @@ class GPENCIL_MT_pie_sculpt(Menu): class GPENCIL_MT_snap(Menu): bl_label = "Snap" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator("gpencil.snap_to_grid", text="Selection to Grid") @@ -603,7 +599,7 @@ class GPENCIL_MT_snap(Menu): class GPENCIL_MT_separate(Menu): bl_label = "Separate" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator("gpencil.stroke_separate", text="Selected Points").mode = 'POINT' layout.operator("gpencil.stroke_separate", text="Selected Strokes").mode = 'STROKE' @@ -613,7 +609,7 @@ class GPENCIL_MT_separate(Menu): class GPENCIL_MT_gpencil_draw_delete(Menu): bl_label = "GPencil Draw Delete" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator_context = 'INVOKE_REGION_WIN' @@ -624,7 +620,7 @@ class GPENCIL_MT_gpencil_draw_delete(Menu): class GPENCIL_MT_cleanup(Menu): bl_label = "Clean Up" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator("gpencil.frame_clean_loose", text="Loose Points") layout.separator() @@ -637,7 +633,7 @@ class GPENCIL_MT_cleanup(Menu): class GPENCIL_UL_annotation_layer(UIList): - def draw_item(self, context, layout, data, item, icon, active_data, active_propname, index): + def draw_item(self, _context, layout, _data, item, icon, _active_data, _active_propname, _index): # assert(isinstance(item, bpy.types.GPencilLayer) gpl = item @@ -812,7 +808,7 @@ class GreasePencilToolsPanel: layout.label(text="Proportional Edit:") row = layout.row() - row.prop(context.tool_settings, "proportional_edit", text="") + row.prop(context.tool_settings, "use_proportional_edit", text="") row.prop(context.tool_settings, "proportional_edit_falloff", text="") layout.separator() @@ -892,7 +888,7 @@ class GreasePencilMaterialsPanel: class GPENCIL_UL_layer(UIList): - def draw_item(self, context, layout, data, item, icon, active_data, active_propname, index): + def draw_item(self, _context, layout, _data, item, icon, _active_data, _active_propname, _index): # assert(isinstance(item, bpy.types.GPencilLayer) gpl = item diff --git a/release/scripts/startup/bl_ui/properties_mask_common.py b/release/scripts/startup/bl_ui/properties_mask_common.py index 509424278b0..872b51d51ff 100644 --- a/release/scripts/startup/bl_ui/properties_mask_common.py +++ b/release/scripts/startup/bl_ui/properties_mask_common.py @@ -25,8 +25,8 @@ from bpy.types import Menu, UIList class MASK_UL_layers(UIList): - def draw_item(self, context, layout, data, item, icon, - active_data, active_propname, index): + def draw_item(self, _context, layout, _data, item, icon, + _active_data, _active_propname, _index): # assert(isinstance(item, bpy.types.MaskLayer) mask = item if self.layout_type in {'DEFAULT', 'COMPACT'}: @@ -199,8 +199,8 @@ class MASK_PT_point: tracks_list = "tracks" if parent.type == 'POINT_TRACK' else "plane_tracks" if parent.parent in tracking.objects: - object = tracking.objects[parent.parent] - col.prop_search(parent, "sub_parent", object, + ob = tracking.objects[parent.parent] + col.prop_search(parent, "sub_parent", ob, tracks_list, icon='ANIM_DATA', text="Track") else: col.prop_search(parent, "sub_parent", tracking, @@ -246,7 +246,7 @@ class MASK_PT_transforms: space_data = context.space_data return space_data.mask and space_data.mode == 'MASK' - def draw(self, context): + def draw(self, _context): layout = self.layout col = layout.column(align=True) @@ -260,7 +260,7 @@ class MASK_PT_transforms: class MASK_MT_add(Menu): bl_label = "Add" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator("mask.primitive_circle_add", icon='MESH_CIRCLE') @@ -270,7 +270,7 @@ class MASK_MT_add(Menu): class MASK_MT_mask(Menu): bl_label = "Mask" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator("mask.delete") @@ -299,7 +299,7 @@ class MASK_MT_mask(Menu): class MASK_MT_visibility(Menu): bl_label = "Show/Hide" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator("mask.hide_view_clear") @@ -310,7 +310,7 @@ class MASK_MT_visibility(Menu): class MASK_MT_transform(Menu): bl_label = "Transform" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator("transform.translate") @@ -322,7 +322,7 @@ class MASK_MT_transform(Menu): class MASK_MT_animation(Menu): bl_label = "Animation" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator("mask.shape_key_clear") @@ -334,7 +334,7 @@ class MASK_MT_animation(Menu): class MASK_MT_select(Menu): bl_label = "Select" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator("mask.select_all", text="All").action = 'SELECT' diff --git a/release/scripts/startup/bl_ui/properties_material.py b/release/scripts/startup/bl_ui/properties_material.py index 145e9cf4c06..79efd92f222 100644 --- a/release/scripts/startup/bl_ui/properties_material.py +++ b/release/scripts/startup/bl_ui/properties_material.py @@ -26,7 +26,7 @@ from bpy_extras.node_utils import find_node_input class MATERIAL_MT_context_menu(Menu): bl_label = "Material Specials" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator("material.copy", icon='COPYDOWN') @@ -36,7 +36,7 @@ class MATERIAL_MT_context_menu(Menu): class MATERIAL_UL_matslots(UIList): - def draw_item(self, context, layout, data, item, icon, active_data, active_propname, index): + def draw_item(self, _context, layout, _data, item, icon, _active_data, _active_propname, _index): # assert(isinstance(item, bpy.types.MaterialSlot) # ob = data slot = item @@ -145,7 +145,7 @@ class EEVEE_MATERIAL_PT_context_material(MaterialButtonsPanel, Panel): row.template_ID(space, "pin_id") -def panel_node_draw(layout, ntree, output_type, input_name): +def panel_node_draw(layout, ntree, _output_type, input_name): node = ntree.get_output_node('EEVEE') if node: diff --git a/release/scripts/startup/bl_ui/properties_material_gpencil.py b/release/scripts/startup/bl_ui/properties_material_gpencil.py index e982bea9438..3ba18049a2e 100644 --- a/release/scripts/startup/bl_ui/properties_material_gpencil.py +++ b/release/scripts/startup/bl_ui/properties_material_gpencil.py @@ -30,7 +30,7 @@ from .properties_grease_pencil_common import ( class GPENCIL_MT_color_context_menu(Menu): bl_label = "Layer" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator("gpencil.color_reveal", icon='RESTRICT_VIEW_OFF', text="Show All") @@ -46,7 +46,7 @@ class GPENCIL_MT_color_context_menu(Menu): class GPENCIL_UL_matslots(UIList): - def draw_item(self, context, layout, data, item, icon, active_data, active_propname, index): + def draw_item(self, _context, layout, _data, item, icon, _active_data, _active_propname, _index): slot = item ma = slot.material if (ma is not None) and (ma.grease_pencil is not None): @@ -104,10 +104,10 @@ class MATERIAL_PT_gpencil_slots(GreasePencilMaterialsPanel, Panel): class MATERIAL_PT_gpencil_surface(GPMaterialButtonsPanel, Panel): bl_label = "Surface" - def draw_header_preset(self, context): + def draw_header_preset(self, _context): MATERIAL_PT_gpencil_material_presets.draw_panel_header(self.layout) - def draw(self, context): + def draw(self, _context): layout = self.layout layout.use_property_split = True @@ -146,8 +146,14 @@ class MATERIAL_PT_gpencil_strokecolor(GPMaterialButtonsPanel, Panel): col.prop(gpcolor, "pixel_size", text="UV Factor") col.prop(gpcolor, "use_stroke_pattern", text="Use As Pattern") - - if gpcolor.stroke_style == 'SOLID' or gpcolor.use_stroke_pattern is True: + if gpcolor.use_stroke_pattern is False: + col.prop(gpcolor, "use_stroke_texture_mix", text="Mix Color") + if gpcolor.use_stroke_texture_mix is True: + col.prop(gpcolor, "mix_stroke_factor", text="Factor") + + if gpcolor.stroke_style == 'SOLID' or \ + gpcolor.use_stroke_pattern is True or \ + gpcolor.use_stroke_texture_mix is True: col.prop(gpcolor, "color", text="Color") if gpcolor.mode in {'DOTS', 'BOX'}: @@ -203,7 +209,7 @@ class MATERIAL_PT_gpencil_fillcolor(GPMaterialButtonsPanel, Panel): col.prop(gpcolor, "pattern_gridsize", text="Box Size") # Texture - if gpcolor.fill_style == 'TEXTURE' or (gpcolor.texture_mix is True and gpcolor.fill_style == 'SOLID'): + if gpcolor.fill_style == 'TEXTURE' or (gpcolor.use_fill_texture_mix is True and gpcolor.fill_style == 'SOLID'): col.template_ID(gpcolor, "fill_image", open="image.open") if gpcolor.fill_style == 'TEXTURE': @@ -218,9 +224,9 @@ class MATERIAL_PT_gpencil_fillcolor(GPMaterialButtonsPanel, Panel): col.prop(gpcolor, "texture_clamp", text="Clip Image") if gpcolor.use_fill_pattern is False: - col.prop(gpcolor, "texture_mix", text="Mix With Color") + col.prop(gpcolor, "use_fill_texture_mix", text="Mix With Color") - if gpcolor.texture_mix is True: + if gpcolor.use_fill_texture_mix is True: col.prop(gpcolor, "fill_color", text="Mix Color") col.prop(gpcolor, "mix_factor", text="Mix Factor", slider=True) diff --git a/release/scripts/startup/bl_ui/properties_object.py b/release/scripts/startup/bl_ui/properties_object.py index 59ff21e1dd7..3265366a2f9 100644 --- a/release/scripts/startup/bl_ui/properties_object.py +++ b/release/scripts/startup/bl_ui/properties_object.py @@ -165,7 +165,7 @@ class OBJECT_PT_relations(ObjectButtonsPanel, Panel): class COLLECTION_MT_context_menu(Menu): bl_label = "Collection Specials" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator("object.collection_unlink", icon='X') @@ -309,7 +309,7 @@ class OBJECT_PT_instancing(ObjectButtonsPanel, Panel): col = layout.column() col.prop(ob, "instance_collection", text="Collection") - if ob.instance_type != 'NONE' or len(ob.particle_systems): + if ob.instance_type != 'NONE' or ob.particle_systems: col = flow.column(align=True) col.prop(ob, "show_instancer_for_viewport") col.prop(ob, "show_instancer_for_render") diff --git a/release/scripts/startup/bl_ui/properties_output.py b/release/scripts/startup/bl_ui/properties_output.py index 02b38f1dc8b..00be0f1a792 100644 --- a/release/scripts/startup/bl_ui/properties_output.py +++ b/release/scripts/startup/bl_ui/properties_output.py @@ -61,7 +61,7 @@ class RENDER_PT_dimensions(RenderOutputButtonsPanel, Panel): _frame_rate_args_prev = None _preset_class = None - def draw_header_preset(self, context): + def draw_header_preset(self, _context): RENDER_PT_presets.draw_panel_header(self.layout) @staticmethod @@ -313,7 +313,7 @@ class RENDER_PT_output_views(RenderOutputButtonsPanel, Panel): COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH'} @classmethod - def poll(self, context): + def poll(cls, context): rd = context.scene.render return rd.use_multiview @@ -332,7 +332,7 @@ class RENDER_PT_encoding(RenderOutputButtonsPanel, Panel): bl_options = {'DEFAULT_CLOSED'} COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH'} - def draw_header_preset(self, context): + def draw_header_preset(self, _context): RENDER_PT_ffmpeg_presets.draw_panel_header(self.layout) @classmethod @@ -443,7 +443,7 @@ class RENDER_PT_encoding_audio(RenderOutputButtonsPanel, Panel): class RENDER_UL_renderviews(UIList): - def draw_item(self, context, layout, data, item, icon, active_data, active_propname, index): + def draw_item(self, _context, layout, _data, item, icon, _active_data, _active_propname, index): view = item if self.layout_type in {'DEFAULT', 'COMPACT'}: if view.name in {"left", "right"}: diff --git a/release/scripts/startup/bl_ui/properties_paint_common.py b/release/scripts/startup/bl_ui/properties_paint_common.py index 9ebcf137688..9e1a642d891 100644 --- a/release/scripts/startup/bl_ui/properties_paint_common.py +++ b/release/scripts/startup/bl_ui/properties_paint_common.py @@ -108,7 +108,7 @@ class VIEW3D_MT_tools_projectpaint_clone(Menu): props.value = i -def brush_texpaint_common(panel, context, layout, brush, settings, projpaint=False): +def brush_texpaint_common(panel, context, layout, brush, _settings, projpaint=False): capabilities = brush.image_paint_capabilities col = layout.column() @@ -136,7 +136,7 @@ def brush_texpaint_common(panel, context, layout, brush, settings, projpaint=Fal brush_basic_texpaint_settings(col, context, brush) -def brush_texpaint_common_clone(panel, context, layout, brush, settings, projpaint=False): +def brush_texpaint_common_clone(_panel, context, layout, _brush, settings, projpaint=False): ob = context.active_object col = layout.column() @@ -164,9 +164,7 @@ def brush_texpaint_common_clone(panel, context, layout, brush, settings, projpai col.menu("VIEW3D_MT_tools_projectpaint_clone", text=clone_text, translate=False) -def brush_texpaint_common_color(panel, context, layout, brush, settings, projpaint=False): - capabilities = brush.image_paint_capabilities - +def brush_texpaint_common_color(_panel, context, layout, brush, _settings, projpaint=False): UnifiedPaintPanel.prop_unified_color_picker(layout, context, brush, "color", value_slider=True) row = layout.row(align=True) @@ -176,7 +174,7 @@ def brush_texpaint_common_color(panel, context, layout, brush, settings, projpai row.operator("paint.brush_colors_flip", icon='FILE_REFRESH', text="", emboss=False) -def brush_texpaint_common_gradient(panel, context, layout, brush, settings, projpaint=False): +def brush_texpaint_common_gradient(_panel, context, layout, brush, _settings, projpaint=False): layout.template_color_ramp(brush, "gradient", expand=True) layout.use_property_split = True @@ -192,7 +190,7 @@ def brush_texpaint_common_gradient(panel, context, layout, brush, settings, proj col.prop(brush, "gradient_fill_mode") -def brush_texpaint_common_options(panel, context, layout, brush, settings, projpaint=False): +def brush_texpaint_common_options(_panel, _context, layout, brush, _settings, projpaint=False): capabilities = brush.image_paint_capabilities col = layout.column() @@ -344,7 +342,6 @@ def brush_basic_texpaint_settings(layout, context, brush, *, compact=False): def brush_basic_sculpt_settings(layout, context, brush, *, compact=False): tool_settings = context.tool_settings capabilities = brush.sculpt_capabilities - settings = tool_settings.gpencil_sculpt row = layout.row(align=True) @@ -368,11 +365,11 @@ def brush_basic_sculpt_settings(layout, context, brush, *, compact=False): UnifiedPaintPanel.prop_unified_strength(row, context, brush, "use_pressure_strength", text="") # direction - if capabilities.has_direction == False: + if not capabilities.has_direction: layout.row().prop(brush, "direction", expand=True, **({"text": ""} if compact else {})) -def brush_basic_gpencil_paint_settings(layout, context, brush, *, compact=True): +def brush_basic_gpencil_paint_settings(layout, _context, brush, *, compact=True): gp_settings = brush.gpencil_settings # Brush details @@ -446,7 +443,7 @@ def brush_basic_gpencil_sculpt_settings(layout, context, brush, *, compact=False layout.use_property_split = use_property_split_prev -def brush_basic_gpencil_weight_settings(layout, context, brush, *, compact=False): +def brush_basic_gpencil_weight_settings(layout, _context, brush, *, compact=False): layout.prop(brush, "size", slider=True) row = layout.row(align=True) diff --git a/release/scripts/startup/bl_ui/properties_particle.py b/release/scripts/startup/bl_ui/properties_particle.py index 0667bff8177..7167be362ad 100644 --- a/release/scripts/startup/bl_ui/properties_particle.py +++ b/release/scripts/startup/bl_ui/properties_particle.py @@ -69,7 +69,7 @@ class PARTICLE_MT_context_menu(Menu): bl_label = "Particle Specials" COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH'} - def draw(self, context): + def draw(self, _context): layout = self.layout props = layout.operator( @@ -122,7 +122,7 @@ def find_modifier(ob, psys): class PARTICLE_UL_particle_systems(bpy.types.UIList): - def draw_item(self, context, layout, data, item, icon, active_data, active_propname, index, flt_flag): + def draw_item(self, _context, layout, data, item, icon, _active_data, _active_propname, _index, _flt_flag): ob = data psys = item @@ -488,7 +488,7 @@ class PARTICLE_PT_cache(ParticleButtonsPanel, Panel): if psys.settings.is_fluid: return False phystype = psys.settings.physics_type - if phystype == 'NO' or phystype == 'KEYED': + if phystype in {'NO', 'KEYED'}: return False return ( psys.settings.type in {'EMITTER', 'REACTOR'} or ( @@ -500,7 +500,7 @@ class PARTICLE_PT_cache(ParticleButtonsPanel, Panel): def draw(self, context): psys = context.particle_system - point_cache_ui(self, context, psys.point_cache, True, 'HAIR' if (psys.settings.type == 'HAIR') else 'PSYS') + point_cache_ui(self, psys.point_cache, True, 'HAIR' if (psys.settings.type == 'HAIR') else 'PSYS') class PARTICLE_PT_velocity(ParticleButtonsPanel, Panel): @@ -691,10 +691,7 @@ class PARTICLE_PT_physics_fluid_advanced(ParticleButtonsPanel, Panel): @classmethod def poll(cls, context): part = particle_get_settings(context) - if part.physics_type == 'FLUID': - return True - else: - return False + return part.physics_type == 'FLUID' def draw(self, context): layout = self.layout @@ -740,10 +737,7 @@ class PARTICLE_PT_physics_fluid_springs(ParticleButtonsPanel, Panel): def poll(cls, context): part = particle_get_settings(context) fluid = part.fluid - if part.physics_type == 'FLUID' and fluid.solver == 'DDR': - return True - else: - return False + return part.physics_type == 'FLUID' and fluid.solver == 'DDR' def draw(self, context): layout = self.layout @@ -767,10 +761,7 @@ class PARTICLE_PT_physics_fluid_springs_viscoelastic(ParticleButtonsPanel, Panel def poll(cls, context): part = particle_get_settings(context) fluid = part.fluid - if part.physics_type == 'FLUID' and fluid.solver == 'DDR': - return True - else: - return False + return part.physics_type == 'FLUID' and fluid.solver == 'DDR' def draw_header(self, context): part = particle_get_settings(context) @@ -806,10 +797,7 @@ class PARTICLE_PT_physics_fluid_springs_advanced(ParticleButtonsPanel, Panel): def poll(cls, context): part = particle_get_settings(context) fluid = part.fluid - if part.physics_type == 'FLUID' and fluid.solver == 'DDR': - return True - else: - return False + return part.physics_type == 'FLUID' and fluid.solver == 'DDR' def draw(self, context): layout = self.layout @@ -1813,7 +1801,7 @@ class PARTICLE_PT_field_weights(ParticleButtonsPanel, Panel): def draw(self, context): part = particle_get_settings(context) - effector_weights_ui(self, context, part.effector_weights, 'PSYS') + effector_weights_ui(self, part.effector_weights, 'PSYS') if part.type == 'HAIR': row = self.layout.row() @@ -1852,7 +1840,7 @@ class PARTICLE_PT_force_fields_type1(ParticleButtonsPanel, Panel): col = layout.column() col.prop(part.force_field_1, "type", text="Type 1") - basic_force_field_settings_ui(self, context, part.force_field_1) + basic_force_field_settings_ui(self, part.force_field_1) class PARTICLE_PT_force_fields_type2(ParticleButtonsPanel, Panel): @@ -1868,7 +1856,7 @@ class PARTICLE_PT_force_fields_type2(ParticleButtonsPanel, Panel): col = layout.column() col.prop(part.force_field_2, "type", text="Type 2") - basic_force_field_settings_ui(self, context, part.force_field_2) + basic_force_field_settings_ui(self, part.force_field_2) class PARTICLE_PT_force_fields_type1_falloff(ParticleButtonsPanel, Panel): @@ -1883,7 +1871,7 @@ class PARTICLE_PT_force_fields_type1_falloff(ParticleButtonsPanel, Panel): part = particle_get_settings(context) - basic_force_field_falloff_ui(self, context, part.force_field_1) + basic_force_field_falloff_ui(self, part.force_field_1) class PARTICLE_PT_force_fields_type2_falloff(ParticleButtonsPanel, Panel): @@ -1898,7 +1886,7 @@ class PARTICLE_PT_force_fields_type2_falloff(ParticleButtonsPanel, Panel): part = particle_get_settings(context) - basic_force_field_falloff_ui(self, context, part.force_field_2) + basic_force_field_falloff_ui(self, part.force_field_2) class PARTICLE_PT_vertexgroups(ParticleButtonsPanel, Panel): diff --git a/release/scripts/startup/bl_ui/properties_physics_cloth.py b/release/scripts/startup/bl_ui/properties_physics_cloth.py index f3d84a7acc0..7463f10185d 100644 --- a/release/scripts/startup/bl_ui/properties_physics_cloth.py +++ b/release/scripts/startup/bl_ui/properties_physics_cloth.py @@ -55,7 +55,7 @@ class PHYSICS_PT_cloth(PhysicButtonsPanel, Panel): bl_label = "Cloth" COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH'} - def draw_header_preset(self, context): + def draw_header_preset(self, _context): CLOTH_PT_presets.draw_panel_header(self.layout) def draw(self, context): @@ -169,7 +169,7 @@ class PHYSICS_PT_cloth_cache(PhysicButtonsPanel, Panel): def draw(self, context): md = context.cloth - point_cache_ui(self, context, md.point_cache, cloth_panel_enabled(md), 'CLOTH') + point_cache_ui(self, md.point_cache, cloth_panel_enabled(md), 'CLOTH') class PHYSICS_PT_cloth_shape(PhysicButtonsPanel, Panel): @@ -373,7 +373,7 @@ class PHYSICS_PT_cloth_field_weights(PhysicButtonsPanel, Panel): def draw(self, context): cloth = context.cloth.settings - effector_weights_ui(self, context, cloth.effector_weights, 'CLOTH') + effector_weights_ui(self, cloth.effector_weights, 'CLOTH') classes = ( diff --git a/release/scripts/startup/bl_ui/properties_physics_common.py b/release/scripts/startup/bl_ui/properties_physics_common.py index 11a9b250454..aeeb4714d46 100644 --- a/release/scripts/startup/bl_ui/properties_physics_common.py +++ b/release/scripts/startup/bl_ui/properties_physics_common.py @@ -35,7 +35,7 @@ class PhysicButtonsPanel: return (context.object) and context.engine in cls.COMPAT_ENGINES -def physics_add(self, layout, md, name, type, typeicon, toggles): +def physics_add(layout, md, name, type, _typeicon, toggles): row = layout.row(align=True) if md: row.context_pointer_set("modifier", md) @@ -57,7 +57,7 @@ def physics_add(self, layout, md, name, type, typeicon, toggles): ).type = type -def physics_add_special(self, layout, data, name, addop, removeop, typeicon): +def physics_add_special(layout, data, name, addop, removeop, _typeicon): row = layout.row(align=True) if data: row.operator(removeop, text=name, text_ctxt=i18n_contexts.default, icon='X') @@ -89,23 +89,21 @@ class PHYSICS_PT_add(PhysicButtonsPanel, Panel): col.operator("object.forcefield_toggle", text="Force Field", icon='X') if obj.type == 'MESH': - physics_add(self, col, context.collision, "Collision", 'COLLISION', 'MOD_PHYSICS', False) - physics_add(self, col, context.cloth, "Cloth", 'CLOTH', 'MOD_CLOTH', True) - physics_add( - self, col, context.dynamic_paint, "Dynamic Paint", 'DYNAMIC_PAINT', 'MOD_DYNAMICPAINT', True - ) + physics_add(col, context.collision, "Collision", 'COLLISION', 'MOD_PHYSICS', False) + physics_add(col, context.cloth, "Cloth", 'CLOTH', 'MOD_CLOTH', True) + physics_add(col, context.dynamic_paint, "Dynamic Paint", 'DYNAMIC_PAINT', 'MOD_DYNAMICPAINT', True) col = flow.column() if obj.type in {'MESH', 'LATTICE', 'CURVE', 'SURFACE', 'FONT'}: - physics_add(self, col, context.soft_body, "Soft Body", 'SOFT_BODY', 'MOD_SOFT', True) + physics_add(col, context.soft_body, "Soft Body", 'SOFT_BODY', 'MOD_SOFT', True) if obj.type == 'MESH': - physics_add(self, col, context.fluid, "Fluid", 'FLUID_SIMULATION', 'MOD_FLUIDSIM', True) - physics_add(self, col, context.smoke, "Smoke", 'SMOKE', 'MOD_SMOKE', True) + physics_add(col, context.fluid, "Fluid", 'FLUID_SIMULATION', 'MOD_FLUIDSIM', True) + physics_add(col, context.smoke, "Smoke", 'SMOKE', 'MOD_SMOKE', True) physics_add_special( - self, col, obj.rigid_body, "Rigid Body", + col, obj.rigid_body, "Rigid Body", "rigidbody.object_add", "rigidbody.object_remove", 'MESH_ICOSPHERE' @@ -113,7 +111,7 @@ class PHYSICS_PT_add(PhysicButtonsPanel, Panel): # all types of objects can have rigid body constraint. physics_add_special( - self, col, obj.rigid_body_constraint, "Rigid Body Constraint", + col, obj.rigid_body_constraint, "Rigid Body Constraint", "rigidbody.constraint_add", "rigidbody.constraint_remove", 'CONSTRAINT' @@ -122,7 +120,7 @@ class PHYSICS_PT_add(PhysicButtonsPanel, Panel): # cache-type can be 'PSYS' 'HAIR' 'SMOKE' etc. -def point_cache_ui(self, context, cache, enabled, cachetype): +def point_cache_ui(self, cache, enabled, cachetype): layout = self.layout layout.use_property_split = True @@ -243,7 +241,7 @@ def point_cache_ui(self, context, cache, enabled, cachetype): col.operator("ptcache.bake_all", text="Update All To Frame").bake = False -def effector_weights_ui(self, context, weights, weight_type): +def effector_weights_ui(self, weights, weight_type): layout = self.layout layout.use_property_split = True @@ -280,7 +278,7 @@ def effector_weights_ui(self, context, weights, weight_type): col.prop(weights, "boid", slider=True) -def basic_force_field_settings_ui(self, context, field): +def basic_force_field_settings_ui(self, field): layout = self.layout layout.use_property_split = True @@ -333,7 +331,7 @@ def basic_force_field_settings_ui(self, context, field): col.prop(field, "use_absorption") -def basic_force_field_falloff_ui(self, context, field): +def basic_force_field_falloff_ui(self, field): layout = self.layout if not field or field.type == 'NONE': diff --git a/release/scripts/startup/bl_ui/properties_physics_dynamicpaint.py b/release/scripts/startup/bl_ui/properties_physics_dynamicpaint.py index 05b531f9a1f..4eb43695eb5 100644 --- a/release/scripts/startup/bl_ui/properties_physics_dynamicpaint.py +++ b/release/scripts/startup/bl_ui/properties_physics_dynamicpaint.py @@ -29,7 +29,7 @@ from .properties_physics_common import ( class PHYSICS_UL_dynapaint_surfaces(UIList): - def draw_item(self, context, layout, data, item, icon, active_data, active_propname, index): + def draw_item(self, _context, layout, _data, item, icon, _active_data, _active_propname, _index): # assert(isinstance(item, bpy.types.DynamicPaintSurface) surf = item sticon = layout.enum_item_icon(surf, "surface_type", surf.surface_type) @@ -39,15 +39,6 @@ class PHYSICS_UL_dynapaint_surfaces(UIList): row.label(text="", icon_value=icon) row.prop(surf, "name", text="", emboss=False, icon_value=sticon) row = layout.row(align=True) - - if surf.use_color_preview: - row.prop( - surf, - "show_preview", - text="", - emboss=False, - icon='RESTRICT_VIEW_OFF' if surf.show_preview else 'RESTRICT_VIEW_ON' - ) row.prop(surf, "is_active", text="") elif self.layout_type == 'GRID': @@ -62,10 +53,12 @@ class PhysicButtonsPanel: bl_region_type = 'WINDOW' bl_context = "physics" + @staticmethod def poll_dyn_paint(context): ob = context.object return (ob and ob.type == 'MESH') and context.dynamic_paint + @staticmethod def poll_dyn_canvas(context): if not PhysicButtonsPanel.poll_dyn_paint(context): return False @@ -73,6 +66,7 @@ class PhysicButtonsPanel: md = context.dynamic_paint return (md and md.ui_type == 'CANVAS' and md.canvas_settings and md.canvas_settings.canvas_surfaces.active) + @staticmethod def poll_dyn_canvas_paint(context): if not PhysicButtonsPanel.poll_dyn_canvas(context): return False @@ -80,6 +74,7 @@ class PhysicButtonsPanel: surface = context.dynamic_paint.canvas_settings.canvas_surfaces.active return (surface.surface_type == 'PAINT') + @staticmethod def poll_dyn_canvas_brush(context): if not PhysicButtonsPanel.poll_dyn_paint(context): return False @@ -87,6 +82,7 @@ class PhysicButtonsPanel: md = context.dynamic_paint return (md and md.ui_type == 'BRUSH' and md.brush_settings) + @staticmethod def poll_dyn_output(context): if not PhysicButtonsPanel.poll_dyn_canvas(context): return False @@ -94,6 +90,7 @@ class PhysicButtonsPanel: surface = context.dynamic_paint.canvas_settings.canvas_surfaces.active return (not (surface.surface_format == 'VERTEX' and (surface.surface_type in {'DISPLACE', 'WAVE'}))) + @staticmethod def poll_dyn_output_maps(context): if not PhysicButtonsPanel.poll_dyn_output(context): return False @@ -367,9 +364,6 @@ class PHYSICS_PT_dp_canvas_output(PhysicButtonsPanel, Panel): # vertex format outputs. if surface.surface_format == 'VERTEX': if surface_type == 'PAINT': - # toggle active preview. - layout.prop(surface, "preview_id") - # paint-map output. row = layout.row() row.prop_search(surface, "output_name_a", ob.data, "vertex_colors", text="Paintmap Layer") @@ -557,7 +551,7 @@ class PHYSICS_PT_dp_effects(PhysicButtonsPanel, Panel): return (context.engine in cls.COMPAT_ENGINES) - def draw(self, context): + def draw(self, _context): return # do nothing. @@ -653,7 +647,7 @@ class PHYSICS_PT_dp_effects_drip_weights(PhysicButtonsPanel, Panel): layout.active = surface.use_drip - effector_weights_ui(self, context, surface.effector_weights, 'DYNAMIC_PAINT') + effector_weights_ui(self, surface.effector_weights, 'DYNAMIC_PAINT') class PHYSICS_PT_dp_effects_shrink(PhysicButtonsPanel, Panel): @@ -704,7 +698,7 @@ class PHYSICS_PT_dp_cache(PhysicButtonsPanel, Panel): surface = context.dynamic_paint.canvas_settings.canvas_surfaces.active cache = surface.point_cache - point_cache_ui(self, context, cache, (cache.is_baked is False), 'DYNAMIC_PAINT') + point_cache_ui(self, cache, (cache.is_baked is False), 'DYNAMIC_PAINT') class PHYSICS_PT_dp_brush_source(PhysicButtonsPanel, Panel): diff --git a/release/scripts/startup/bl_ui/properties_physics_field.py b/release/scripts/startup/bl_ui/properties_physics_field.py index 7123d33a86b..c38dad25cf4 100644 --- a/release/scripts/startup/bl_ui/properties_physics_field.py +++ b/release/scripts/startup/bl_ui/properties_physics_field.py @@ -32,10 +32,12 @@ class PhysicButtonsPanel: bl_region_type = 'WINDOW' bl_context = "physics" + @staticmethod def poll_force_field(context): ob = context.object return (ob and (ob.field) and (ob.field.type != 'NONE')) + @staticmethod def poll_collision(context): ob = context.object return (ob and ob.type == 'MESH') and (context.collision) @@ -131,7 +133,7 @@ class PHYSICS_PT_field_settings(PhysicButtonsPanel, Panel): col.prop(field, "use_smoke_density") else: del flow - basic_force_field_settings_ui(self, context, field) + basic_force_field_settings_ui(self, field) class PHYSICS_PT_field_settings_kink(PhysicButtonsPanel, Panel): @@ -212,7 +214,7 @@ class PHYSICS_PT_field_falloff(PhysicButtonsPanel, Panel): layout.prop(field, "falloff_type", text="Shape") - basic_force_field_falloff_ui(self, context, field) + basic_force_field_falloff_ui(self, field) class PHYSICS_PT_field_falloff_angular(PhysicButtonsPanel, Panel): diff --git a/release/scripts/startup/bl_ui/properties_physics_fluid.py b/release/scripts/startup/bl_ui/properties_physics_fluid.py index 17289cfbaf1..8817d35b88a 100644 --- a/release/scripts/startup/bl_ui/properties_physics_fluid.py +++ b/release/scripts/startup/bl_ui/properties_physics_fluid.py @@ -38,6 +38,7 @@ class PhysicButtonsPanel: bl_region_type = 'WINDOW' bl_context = "physics" + @staticmethod def poll_fluid(context): ob = context.object if not ((ob and ob.type == 'MESH') and (context.fluid)): @@ -45,6 +46,7 @@ class PhysicButtonsPanel: return (bpy.app.build_options.mod_fluid) + @staticmethod def poll_fluid_settings(context): if not (PhysicButtonsPanel.poll_fluid(context)): return False @@ -52,6 +54,7 @@ class PhysicButtonsPanel: md = context.fluid return md and md.settings and (md.settings.type != 'NONE') + @staticmethod def poll_fluid_domain(context): if not PhysicButtonsPanel.poll_fluid(context): return False @@ -367,7 +370,7 @@ class PHYSICS_PT_domain_viscosity(PhysicButtonsPanel, Panel): return (context.engine in cls.COMPAT_ENGINES) - def draw_header_preset(self, context): + def draw_header_preset(self, _context): FLUID_PT_presets.draw_panel_header(self.layout) def draw(self, context): diff --git a/release/scripts/startup/bl_ui/properties_physics_rigidbody_constraint.py b/release/scripts/startup/bl_ui/properties_physics_rigidbody_constraint.py index 02f0dc6ea08..ec35e1230d8 100644 --- a/release/scripts/startup/bl_ui/properties_physics_rigidbody_constraint.py +++ b/release/scripts/startup/bl_ui/properties_physics_rigidbody_constraint.py @@ -139,7 +139,7 @@ class PHYSICS_PT_rigid_body_constraint_limits(PHYSICS_PT_rigidbody_constraint_pa return (ob and rbc and (rbc.type in {'GENERIC', 'GENERIC_SPRING', 'HINGE', 'SLIDER', 'PISTON'}) and context.engine in cls.COMPAT_ENGINES) - def draw(self, context): + def draw(self, _context): return # do nothing. @@ -279,7 +279,7 @@ class PHYSICS_PT_rigid_body_constraint_motor(PHYSICS_PT_rigidbody_constraint_pan return (ob and rbc and rbc.type == 'MOTOR' and context.engine in cls.COMPAT_ENGINES) - def draw(self, context): + def draw(self, _context): return # do nothing. diff --git a/release/scripts/startup/bl_ui/properties_physics_smoke.py b/release/scripts/startup/bl_ui/properties_physics_smoke.py index 9d170d07c69..898e1f3804e 100644 --- a/release/scripts/startup/bl_ui/properties_physics_smoke.py +++ b/release/scripts/startup/bl_ui/properties_physics_smoke.py @@ -33,6 +33,7 @@ class PhysicButtonsPanel: bl_region_type = 'WINDOW' bl_context = "physics" + @staticmethod def poll_smoke(context): ob = context.object if not ((ob and ob.type == 'MESH') and (context.smoke)): @@ -41,6 +42,7 @@ class PhysicButtonsPanel: md = context.smoke return md and (context.smoke.smoke_type != 'NONE') and (bpy.app.build_options.mod_smoke) + @staticmethod def poll_smoke_domain(context): if not PhysicButtonsPanel.poll_smoke(context): return False @@ -540,7 +542,7 @@ class PHYSICS_PT_smoke_cache(PhysicButtonsPanel, Panel): col.separator() cache = domain.point_cache - point_cache_ui(self, context, cache, (cache.is_baked is False), 'SMOKE') + point_cache_ui(self, cache, (cache.is_baked is False), 'SMOKE') class PHYSICS_PT_smoke_field_weights(PhysicButtonsPanel, Panel): @@ -558,7 +560,7 @@ class PHYSICS_PT_smoke_field_weights(PhysicButtonsPanel, Panel): def draw(self, context): domain = context.smoke.domain_settings - effector_weights_ui(self, context, domain.effector_weights, 'SMOKE') + effector_weights_ui(self, domain.effector_weights, 'SMOKE') class PHYSICS_PT_smoke_viewport_display(PhysicButtonsPanel, Panel): diff --git a/release/scripts/startup/bl_ui/properties_physics_softbody.py b/release/scripts/startup/bl_ui/properties_physics_softbody.py index 462797ad597..6157446fd5a 100644 --- a/release/scripts/startup/bl_ui/properties_physics_softbody.py +++ b/release/scripts/startup/bl_ui/properties_physics_softbody.py @@ -112,7 +112,7 @@ class PHYSICS_PT_softbody_cache(PhysicButtonsPanel, Panel): def draw(self, context): md = context.soft_body - point_cache_ui(self, context, md.point_cache, softbody_panel_enabled(md), 'SOFTBODY') + point_cache_ui(self, md.point_cache, softbody_panel_enabled(md), 'SOFTBODY') class PHYSICS_PT_softbody_goal(PhysicButtonsPanel, Panel): @@ -395,7 +395,7 @@ class PHYSICS_PT_softbody_field_weights(PhysicButtonsPanel, Panel): md = context.soft_body softbody = md.settings - effector_weights_ui(self, context, softbody.effector_weights, 'SOFTBODY') + effector_weights_ui(self, softbody.effector_weights, 'SOFTBODY') classes = ( diff --git a/release/scripts/startup/bl_ui/properties_scene.py b/release/scripts/startup/bl_ui/properties_scene.py index 5687caa8be0..df431000048 100644 --- a/release/scripts/startup/bl_ui/properties_scene.py +++ b/release/scripts/startup/bl_ui/properties_scene.py @@ -33,7 +33,7 @@ from .properties_physics_common import ( class SCENE_UL_keying_set_paths(UIList): - def draw_item(self, context, layout, data, item, icon, active_data, active_propname, index): + def draw_item(self, _context, layout, _data, item, icon, _active_data, _active_propname, _index): # assert(isinstance(item, bpy.types.KeyingSetPath) kspath = item icon = layout.enum_item_icon(kspath, "id_type", kspath.id_type) @@ -408,7 +408,7 @@ class SCENE_PT_rigid_body_cache(RigidBodySubPanel, Panel): scene = context.scene rbw = scene.rigidbody_world - point_cache_ui(self, context, rbw.point_cache, rbw.point_cache.is_baked is False and rbw.enabled, 'RIGID_BODY') + point_cache_ui(self, rbw.point_cache, rbw.point_cache.is_baked is False and rbw.enabled, 'RIGID_BODY') class SCENE_PT_rigid_body_field_weights(RigidBodySubPanel, Panel): @@ -420,7 +420,7 @@ class SCENE_PT_rigid_body_field_weights(RigidBodySubPanel, Panel): scene = context.scene rbw = scene.rigidbody_world - effector_weights_ui(self, context, rbw.effector_weights, 'RIGID_BODY') + effector_weights_ui(self, rbw.effector_weights, 'RIGID_BODY') class SCENE_PT_custom_props(SceneButtonsPanel, PropertyPanel, Panel): diff --git a/release/scripts/startup/bl_ui/properties_texture.py b/release/scripts/startup/bl_ui/properties_texture.py index 313e0668b92..946083ea4e9 100644 --- a/release/scripts/startup/bl_ui/properties_texture.py +++ b/release/scripts/startup/bl_ui/properties_texture.py @@ -39,7 +39,7 @@ class TEXTURE_MT_context_menu(Menu): bl_label = "Texture Specials" COMPAT_ENGINES = {'BLENDER_RENDER'} - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator("texture.slot_copy", icon='COPYDOWN') @@ -48,7 +48,7 @@ class TEXTURE_MT_context_menu(Menu): class TEXTURE_UL_texslots(UIList): - def draw_item(self, context, layout, data, item, icon, active_data, active_propname, index): + def draw_item(self, _context, layout, _data, item, icon, _active_data, _active_propname, _index): slot = item tex = slot.texture if slot else None @@ -357,7 +357,7 @@ class TEXTURE_PT_image(TextureTypePanel, Panel): tex_type = 'IMAGE' COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH'} - def draw(self, context): + def draw(self, _context): # TODO: maybe expose the template_ID from the template image here. layout = self.layout del layout diff --git a/release/scripts/startup/bl_ui/properties_view_layer.py b/release/scripts/startup/bl_ui/properties_view_layer.py index 639e31c85ad..121b8f2f401 100644 --- a/release/scripts/startup/bl_ui/properties_view_layer.py +++ b/release/scripts/startup/bl_ui/properties_view_layer.py @@ -56,7 +56,6 @@ class VIEWLAYER_PT_layer(ViewLayerButtonsPanel, Panel): class VIEWLAYER_PT_eevee_layer_passes(ViewLayerButtonsPanel, Panel): bl_label = "Passes" - bl_options = {'DEFAULT_CLOSED'} COMPAT_ENGINES = {'BLENDER_EEVEE'} def draw(self, context): diff --git a/release/scripts/startup/bl_ui/space_clip.py b/release/scripts/startup/bl_ui/space_clip.py index 436a87c2e93..b92b12abb86 100644 --- a/release/scripts/startup/bl_ui/space_clip.py +++ b/release/scripts/startup/bl_ui/space_clip.py @@ -29,8 +29,8 @@ from .properties_grease_pencil_common import ( class CLIP_UL_tracking_objects(UIList): - def draw_item(self, context, layout, data, item, icon, - active_data, active_propname, index): + def draw_item(self, _context, layout, _data, item, _icon, + _active_data, _active_propname, _index): # assert(isinstance(item, bpy.types.MovieTrackingObject) tobj = item if self.layout_type in {'DEFAULT', 'COMPACT'}: @@ -267,8 +267,7 @@ class CLIP_HT_header(Header): sc = context.space_data - row = layout.row(align=True) - row.template_header() + layout.template_header() layout.prop(sc, "mode", text="") if sc.mode == 'TRACKING': @@ -364,7 +363,7 @@ class CLIP_PT_tools_clip(Panel): return clip and sc.view == 'CLIP' and sc.mode != 'MASK' - def draw(self, context): + def draw(self, _context): layout = self.layout col = layout.column(align=True) @@ -380,7 +379,7 @@ class CLIP_PT_tools_marker(CLIP_PT_tracking_panel, Panel): bl_label = "Marker" bl_category = "Track" - def draw(self, context): + def draw(self, _context): layout = self.layout col = layout.column(align=True) @@ -396,7 +395,7 @@ class CLIP_PT_tracking_settings(CLIP_PT_tracking_panel, Panel): bl_label = "Tracking Settings" bl_category = "Track" - def draw_header_preset(self, context): + def draw_header_preset(self, _context): CLIP_PT_tracking_settings_presets.draw_panel_header(self.layout) def draw(self, context): @@ -467,7 +466,7 @@ class CLIP_PT_tools_tracking(CLIP_PT_tracking_panel, Panel): bl_category = "Track" bl_options = {'DEFAULT_CLOSED'} - def draw(self, context): + def draw(self, _context): layout = self.layout row = layout.row(align=True) @@ -522,7 +521,7 @@ class CLIP_PT_tools_plane_tracking(CLIP_PT_tracking_panel, Panel): bl_options = {'DEFAULT_CLOSED'} bl_category = "Solve" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator("clip.create_plane_track") @@ -598,7 +597,7 @@ class CLIP_PT_tools_geometry(CLIP_PT_tracking_panel, Panel): bl_options = {'DEFAULT_CLOSED'} bl_category = "Solve" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator("clip.bundles_to_mesh") @@ -862,7 +861,7 @@ class CLIP_PT_tracking_camera(Panel): return False - def draw_header_preset(self, context): + def draw_header_preset(self, _context): CLIP_PT_camera_presets.draw_panel_header(self.layout) def draw(self, context): @@ -1198,7 +1197,7 @@ class CLIP_PT_tools_scenesetup(Panel): return clip and sc.view == 'CLIP' and sc.mode != 'MASK' - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator("clip.set_viewport_background") @@ -1231,8 +1230,10 @@ class CLIP_MT_view(Menu): sc = context.space_data if sc.view == 'CLIP': - layout.operator("clip.properties", icon='MENU_PANEL') - layout.operator("clip.tools", icon='MENU_PANEL') + layout.prop(sc, "show_region_ui") + layout.prop(sc, "show_region_toolbar") + layout.prop(sc, "show_region_hud") + layout.separator() layout.operator("clip.view_selected") @@ -1290,7 +1291,7 @@ class CLIP_MT_clip(Menu): class CLIP_MT_proxy(Menu): bl_label = "Proxy" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator("clip.rebuild_proxy") @@ -1300,7 +1301,7 @@ class CLIP_MT_proxy(Menu): class CLIP_MT_track(Menu): bl_label = "Track" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator("clip.clear_solution") @@ -1361,7 +1362,7 @@ class CLIP_MT_track(Menu): class CLIP_MT_reconstruction(Menu): bl_label = "Reconstruction" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator("clip.set_origin") @@ -1382,7 +1383,7 @@ class CLIP_MT_reconstruction(Menu): class CLIP_MT_track_visibility(Menu): bl_label = "Show/Hide" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator("clip.hide_tracks_clear") @@ -1393,7 +1394,7 @@ class CLIP_MT_track_visibility(Menu): class CLIP_MT_track_transform(Menu): bl_label = "Transform" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator("transform.translate") @@ -1403,7 +1404,7 @@ class CLIP_MT_track_transform(Menu): class CLIP_MT_select(Menu): bl_label = "Select" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator("clip.select_box") @@ -1422,7 +1423,7 @@ class CLIP_MT_select(Menu): class CLIP_MT_select_grouped(Menu): bl_label = "Select Grouped" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator_enum("clip.select_grouped", "group") @@ -1435,7 +1436,7 @@ class CLIP_MT_tracking_context_menu(Menu): def poll(cls, context): return context.space_data.clip - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator("clip.disable_markers", @@ -1485,7 +1486,7 @@ class CLIP_PT_tracking_settings_presets(PresetPanel, Panel): class CLIP_MT_stabilize_2d_context_menu(Menu): bl_label = "Translation Track Specials" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator("clip.stabilize_2d_select") @@ -1494,7 +1495,7 @@ class CLIP_MT_stabilize_2d_context_menu(Menu): class CLIP_MT_stabilize_2d_rotation_context_menu(Menu): bl_label = "Rotation Track Specials" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator("clip.stabilize_2d_rotation_select") @@ -1513,6 +1514,156 @@ class CLIP_MT_pivot_pie(Menu): pie.prop_enum(context.space_data, "pivot_point", value='MEDIAN_POINT') +class CLIP_MT_marker_pie(Menu): + # Settings for the individual markers + bl_label = "Marker Settings" + + @classmethod + def poll(cls, context): + space = context.space_data + return space.mode == 'TRACKING' and space.clip + + def draw(self, context): + clip = context.space_data.clip + tracks = getattr(getattr(clip, "tracking", None), "tracks", None) + track_active = tracks.active if tracks else None + + layout = self.layout + pie = layout.menu_pie() + # Use Location Tracking + prop = pie.operator("wm.context_set_enum", text="Loc") + prop.data_path = "space_data.clip.tracking.tracks.active.motion_model" + prop.value = "Loc" + # Use Affine Tracking + prop = pie.operator("wm.context_set_enum", text="Affine") + prop.data_path = "space_data.clip.tracking.tracks.active.motion_model" + prop.value = "Affine" + # Copy Settings From Active To Selected + pie.operator("clip.track_settings_to_track", icon='COPYDOWN') + # Make Settings Default + pie.operator("clip.track_settings_as_default", icon='SETTINGS') + if track_active: + # Use Normalization + pie.prop(track_active, "use_normalization", text="Normalization") + # Use Brute Force + pie.prop(track_active, "use_brute", text="Use Brute Force") + # Match Keyframe + prop = pie.operator("wm.context_set_enum", text="Match Previous", icon='KEYFRAME_HLT') + prop.data_path = "space_data.clip.tracking.tracks.active.pattern_match" + prop.value = 'KEYFRAME' + # Match Previous Frame + prop = pie.operator("wm.context_set_enum", text="Match Keyframe", icon='KEYFRAME') + prop.data_path = "space_data.clip.tracking.tracks.active.pattern_match" + prop.value = 'PREV_FRAME' + + +class CLIP_MT_tracking_pie(Menu): + # Tracking Operators + bl_label = "Tracking" + + @classmethod + def poll(cls, context): + space = context.space_data + return space.mode == 'TRACKING' and space.clip + + def draw(self, context): + space = context.space_data + clip = space.clip + act_track = clip.tracking.tracks.active + + layout = self.layout + pie = layout.menu_pie() + # Track Backwards + prop = pie.operator("clip.track_markers", icon='TRACKING_BACKWARDS') + prop.backwards = True + prop.sequence = True + # Track Forwards + prop = pie.operator("clip.track_markers", icon='TRACKING_FORWARDS') + prop.backwards = False + prop.sequence = True + # Disable Marker + pie.operator("clip.disable_markers", icon="VISIBLE_IPO_ON").action = 'TOGGLE' + # Detect Features + pie.operator("clip.detect_features", icon='ZOOM_SELECTED') + # Clear Path Backwards + pie.operator("clip.clear_track_path", icon='TRACKING_CLEAR_BACKWARDS').action = 'UPTO' + # Clear Path Forwards + pie.operator("clip.clear_track_path", icon='TRACKING_CLEAR_FORWARDS').action = 'REMAINED' + # Refine Backwards + pie.operator("clip.refine_markers", icon='TRACKING_REFINE_BACKWARDS').backwards = True + # Refine Forwards + pie.operator("clip.refine_markers", icon='TRACKING_REFINE_FORWARDS').backwards = False + + +class CLIP_MT_solving_pie(Menu): + # Operators to solve the scene + bl_label = "Solving" + + @classmethod + def poll(cls, context): + space = context.space_data + return space.mode == 'TRACKING' and space.clip + + def draw(self, context): + clip = context.space_data.clip + settings = getattr(getattr(clip, "tracking", None), "settings", None) + + layout = self.layout + pie = layout.menu_pie() + # Clear Solution + pie.operator("clip.clear_solution", icon='FILE_REFRESH') + # Solve Camera + pie.operator("clip.solve_camera", text="Solve Camera", icon='OUTLINER_OB_CAMERA') + # Use Tripod Solver + if settings: + pie.prop(settings, "use_tripod_solver", text="Tripod Solver") + # create Plane Track + pie.operator("clip.create_plane_track", icon='MATPLANE') + # Set Keyframe A + pie.operator("clip.set_solver_keyframe", text="Set Keyframe A", + icon='KEYFRAME').keyframe = 'KEYFRAME_A' + # Set Keyframe B + pie.operator("clip.set_solver_keyframe", text="Set Keyframe B", + icon='KEYFRAME').keyframe = 'KEYFRAME_B' + # Clean Tracks + prop = pie.operator("clip.clean_tracks", icon='X') + # Filter Tracks + pie.operator("clip.filter_tracks", icon='FILTER') + prop.frames = 15 + prop.error = 2 + + +class CLIP_MT_reconstruction_pie(Menu): + # Scene Reconstruction + bl_label = "Reconstruction" + + @classmethod + def poll(cls, context): + space = context.space_data + return space.mode == 'TRACKING' and space.clip + + def draw(self, context): + layout = self.layout + pie = layout.menu_pie() + # Set Active Clip As Viewport Background + pie.operator("clip.set_viewport_background", text="Set Viewport Background", icon='FILE_IMAGE') + # Setup Tracking Scene + pie.operator("clip.setup_tracking_scene", text="Setup Tracking Scene", icon='SCENE_DATA') + # Setup Floor + pie.operator("clip.set_plane", text="Set Floor", icon='AXIS_TOP') + # Set Origin + pie.operator("clip.set_origin", text="Set Origin", icon='OBJECT_ORIGIN') + # Set X Axis + pie.operator("clip.set_axis", text="Set X Axis", icon='AXIS_FRONT').axis = 'X' + # Set Y Axis + pie.operator("clip.set_axis", text="Set Y Axis", icon='AXIS_SIDE').axis = 'Y' + # Set Scale + pie.operator("clip.set_scale", text="Set Scale", icon='ARROW_LEFTRIGHT') + # Apply Solution Scale + pie.operator("clip.apply_solution_scale", icon='ARROW_LEFTRIGHT') + + + classes = ( CLIP_UL_tracking_objects, CLIP_HT_header, @@ -1568,6 +1719,10 @@ classes = ( CLIP_MT_stabilize_2d_context_menu, CLIP_MT_stabilize_2d_rotation_context_menu, CLIP_MT_pivot_pie, + CLIP_MT_marker_pie, + CLIP_MT_tracking_pie, + CLIP_MT_reconstruction_pie, + CLIP_MT_solving_pie ) if __name__ == "__main__": # only for live edit. diff --git a/release/scripts/startup/bl_ui/space_console.py b/release/scripts/startup/bl_ui/space_console.py index 06349abaaf0..2e1d0fd2eba 100644 --- a/release/scripts/startup/bl_ui/space_console.py +++ b/release/scripts/startup/bl_ui/space_console.py @@ -38,7 +38,7 @@ class CONSOLE_MT_editor_menus(Menu): bl_idname = "CONSOLE_MT_editor_menus" bl_label = "" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.menu("CONSOLE_MT_console") @@ -46,7 +46,7 @@ class CONSOLE_MT_editor_menus(Menu): class CONSOLE_MT_console(Menu): bl_label = "Console" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator("console.indent") @@ -72,7 +72,7 @@ class CONSOLE_MT_console(Menu): class CONSOLE_MT_language(Menu): bl_label = "Languages..." - def draw(self, context): + def draw(self, _context): import sys layout = self.layout diff --git a/release/scripts/startup/bl_ui/space_dopesheet.py b/release/scripts/startup/bl_ui/space_dopesheet.py index e3d5aaf2169..70d37c971a5 100644 --- a/release/scripts/startup/bl_ui/space_dopesheet.py +++ b/release/scripts/startup/bl_ui/space_dopesheet.py @@ -210,8 +210,7 @@ class DOPESHEET_HT_header(Header): st = context.space_data - row = layout.row(align=True) - row.template_header() + layout.template_header() if st.mode == 'TIMELINE': from .space_time import ( @@ -236,6 +235,7 @@ class DOPESHEET_HT_editor_buttons(Header): def draw(self, context): pass + @staticmethod def draw_header(context, layout): st = context.space_data tool_settings = context.tool_settings @@ -323,7 +323,8 @@ class DOPESHEET_MT_view(Menu): st = context.space_data - layout.operator("action.properties", icon='MENU_PANEL') + layout.prop(st, "show_region_ui") + layout.separator() layout.prop(st.dopesheet, "use_multi_word_filter", text="Multi-word Match Search") @@ -430,7 +431,7 @@ class DOPESHEET_MT_marker(Menu): class DOPESHEET_MT_channel(Menu): bl_label = "Channel" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator_context = 'INVOKE_REGION_CHANNELS' @@ -464,7 +465,7 @@ class DOPESHEET_MT_channel(Menu): class DOPESHEET_MT_key(Menu): bl_label = "Key" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.menu("DOPESHEET_MT_key_transform", text="Transform") @@ -499,7 +500,7 @@ class DOPESHEET_MT_key(Menu): class DOPESHEET_MT_key_transform(Menu): bl_label = "Transform" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator("transform.transform", text="Move").mode = 'TIME_TRANSLATE' @@ -514,7 +515,7 @@ class DOPESHEET_MT_key_transform(Menu): class DOPESHEET_MT_gpencil_channel(Menu): bl_label = "Channel" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator_context = 'INVOKE_REGION_CHANNELS' @@ -541,7 +542,7 @@ class DOPESHEET_MT_gpencil_channel(Menu): class DOPESHEET_MT_gpencil_frame(Menu): bl_label = "Frame" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.menu("DOPESHEET_MT_key_transform", text="Transform") @@ -563,7 +564,7 @@ class DOPESHEET_MT_gpencil_frame(Menu): class DOPESHEET_MT_delete(Menu): bl_label = "Delete" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator("action.delete") @@ -577,7 +578,7 @@ class DOPESHEET_MT_delete(Menu): class DOPESHEET_MT_context_menu(Menu): bl_label = "Dope Sheet Context Menu" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator("action.copy", text="Copy") @@ -588,7 +589,6 @@ class DOPESHEET_MT_context_menu(Menu): layout.operator_menu_enum("action.handle_type", "type", text="Handle Type") layout.operator_menu_enum("action.interpolation_type", "type", text="Interpolation Mode") - layout.operator_menu_enum("action.easing_type", "type", text="Easing Type") layout.separator() @@ -605,7 +605,7 @@ class DOPESHEET_MT_context_menu(Menu): class DOPESHEET_MT_channel_context_menu(Menu): bl_label = "Dope Sheet Channel Context Menu" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator("anim.channels_setting_enable", text="Mute Channels").type = 'MUTE' @@ -637,7 +637,7 @@ class DOPESHEET_MT_channel_context_menu(Menu): class DOPESHEET_MT_snap_pie(Menu): bl_label = "Snap" - def draw(self, context): + def draw(self, _context): layout = self.layout pie = layout.menu_pie() diff --git a/release/scripts/startup/bl_ui/space_filebrowser.py b/release/scripts/startup/bl_ui/space_filebrowser.py index 5ab4dbfd16b..b3e7ca62ed1 100644 --- a/release/scripts/startup/bl_ui/space_filebrowser.py +++ b/release/scripts/startup/bl_ui/space_filebrowser.py @@ -89,7 +89,7 @@ class FILEBROWSER_HT_header(Header): class FILEBROWSER_UL_dir(UIList): - def draw_item(self, context, layout, data, item, icon, active_data, active_propname, index): + def draw_item(self, _context, layout, _data, item, icon, _active_data, active_propname, _index): direntry = item # space = context.space_data icon = 'NONE' @@ -155,7 +155,7 @@ class FILEBROWSER_PT_system_bookmarks(Panel): class FILEBROWSER_MT_bookmarks_context_menu(Menu): bl_label = "Bookmarks Specials" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator("file.bookmark_cleanup", icon='X', text="Cleanup") diff --git a/release/scripts/startup/bl_ui/space_graph.py b/release/scripts/startup/bl_ui/space_graph.py index 09f9529c302..b71c0582dd9 100644 --- a/release/scripts/startup/bl_ui/space_graph.py +++ b/release/scripts/startup/bl_ui/space_graph.py @@ -34,8 +34,7 @@ class GRAPH_HT_header(Header): st = context.space_data - row = layout.row(align=True) - row.template_header() + layout.template_header() # Now a exposed as a sub-space type # layout.prop(st, "mode", text="") @@ -94,7 +93,7 @@ class GRAPH_MT_editor_menus(Menu): bl_idname = "GRAPH_MT_editor_menus" bl_label = "" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.menu("GRAPH_MT_view") layout.menu("GRAPH_MT_select") @@ -111,7 +110,7 @@ class GRAPH_MT_view(Menu): st = context.space_data - layout.operator("graph.properties", icon='MENU_PANEL') + layout.prop(st, "show_region_ui") layout.separator() layout.prop(st, "use_realtime_update") @@ -158,7 +157,7 @@ class GRAPH_MT_view(Menu): class GRAPH_MT_select(Menu): bl_label = "Select" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator("graph.select_all", text="All").action = 'SELECT' @@ -258,7 +257,7 @@ class GRAPH_MT_channel(Menu): class GRAPH_MT_key(Menu): bl_label = "Key" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.menu("GRAPH_MT_key_transform", text="Transform") @@ -300,7 +299,7 @@ class GRAPH_MT_key(Menu): class GRAPH_MT_key_transform(Menu): bl_label = "Transform" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator("transform.translate", text="Move") @@ -312,7 +311,7 @@ class GRAPH_MT_key_transform(Menu): class GRAPH_MT_delete(Menu): bl_label = "Delete" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator("graph.delete") @@ -326,7 +325,7 @@ class GRAPH_MT_delete(Menu): class GRAPH_MT_context_menu(Menu): bl_label = "F-Curve Context Menu" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator("graph.copy", text="Copy") @@ -366,7 +365,7 @@ class GRAPH_MT_pivot_pie(Menu): class GRAPH_MT_snap_pie(Menu): bl_label = "Snap" - def draw(self, context): + def draw(self, _context): layout = self.layout pie = layout.menu_pie() diff --git a/release/scripts/startup/bl_ui/space_image.py b/release/scripts/startup/bl_ui/space_image.py index de0b6f8cc1d..b27895fa04b 100644 --- a/release/scripts/startup/bl_ui/space_image.py +++ b/release/scripts/startup/bl_ui/space_image.py @@ -41,13 +41,13 @@ from bpy.app.translations import pgettext_iface as iface_ class ImagePaintPanel(UnifiedPaintPanel): - bl_space_type = 'PROPERTIES' - bl_region_type = 'WINDOW' + bl_space_type = 'IMAGE_EDITOR' + bl_region_type = 'UI' class BrushButtonsPanel(UnifiedPaintPanel): - bl_space_type = 'PROPERTIES' - bl_region_type = 'WINDOW' + bl_space_type = 'IMAGE_EDITOR' + bl_region_type = 'UI' @classmethod def poll(cls, context): @@ -55,6 +55,25 @@ class BrushButtonsPanel(UnifiedPaintPanel): return tool_settings.brush +class IMAGE_PT_active_tool(Panel): + bl_space_type = 'IMAGE_EDITOR' + bl_region_type = 'UI' + bl_label = "Active Tool" + bl_category = "Tool" + + def draw(self, context): + layout = self.layout + + # Panel display of topbar tool settings. + # currently displays in tool settings, keep here since the same functionality is used for the topbar. + + layout.use_property_split = True + layout.use_property_decorate = False + + from .space_toolsystem_common import ToolSelectPanelHelper + ToolSelectPanelHelper.draw_active_tool_header(context, layout, show_tool_name=True) + + class IMAGE_MT_view(Menu): bl_label = "View" @@ -69,8 +88,9 @@ class IMAGE_MT_view(Menu): show_uvedit = sima.show_uvedit show_render = sima.show_render - layout.operator("image.properties", icon='MENU_PANEL') - layout.operator("image.toolshelf", icon='MENU_PANEL') + layout.prop(sima, "show_region_toolbar") + layout.prop(sima, "show_region_ui") + layout.prop(sima, "show_region_hud") layout.separator() @@ -119,7 +139,7 @@ class IMAGE_MT_view(Menu): class IMAGE_MT_view_zoom(Menu): bl_label = "Fractional Zoom" - def draw(self, context): + def draw(self, _context): layout = self.layout ratios = ((1, 8), (1, 4), (1, 2), (1, 1), (2, 1), (4, 1), (8, 1)) @@ -138,7 +158,7 @@ class IMAGE_MT_view_zoom(Menu): class IMAGE_MT_select(Menu): bl_label = "Select" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator("uv.select_all", text="All").action = 'SELECT' @@ -159,7 +179,7 @@ class IMAGE_MT_select(Menu): layout.separator() layout.operator("uv.select_pinned") - layout.operator("uv.select_linked").extend = False + layout.operator("uv.select_linked") layout.separator() @@ -227,23 +247,17 @@ class IMAGE_MT_image(Menu): layout.menu("IMAGE_MT_image_invert") if not show_render: - if not ima.packed_file: - layout.separator() + layout.separator() + if ima.packed_file: + layout.operator("image.pack", text="Repack") + else: layout.operator("image.pack", text="Pack") - # Only for dirty && specific image types, perhaps - # this could be done in operator poll too. - if ima.is_dirty: - if ima.source in {'FILE', 'GENERATED'} and ima.type != 'OPEN_EXR_MULTILAYER': - if ima.packed_file: - layout.separator() - layout.operator("image.pack", text="Pack As PNG").as_png = True - class IMAGE_MT_image_invert(Menu): bl_label = "Invert" - def draw(self, context): + def draw(self, _context): layout = self.layout props = layout.operator("image.invert", text="Invert Image Colors", icon='IMAGE_RGB') @@ -262,7 +276,7 @@ class IMAGE_MT_image_invert(Menu): class IMAGE_MT_uvs_showhide(Menu): bl_label = "Show/Hide Faces" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator("uv.reveal") @@ -270,24 +284,10 @@ class IMAGE_MT_uvs_showhide(Menu): layout.operator("uv.hide", text="Hide Unselected").unselected = True -class IMAGE_MT_uvs_proportional(Menu): - bl_label = "Proportional Editing" - - def draw(self, context): - layout = self.layout - - layout.props_enum(context.tool_settings, "proportional_edit") - - layout.separator() - - layout.label(text="Falloff:") - layout.props_enum(context.tool_settings, "proportional_edit_falloff") - - class IMAGE_MT_uvs_transform(Menu): bl_label = "Transform" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator("transform.translate") @@ -302,7 +302,7 @@ class IMAGE_MT_uvs_transform(Menu): class IMAGE_MT_uvs_snap(Menu): bl_label = "Snap" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator_context = 'EXEC_REGION_WIN' @@ -321,7 +321,7 @@ class IMAGE_MT_uvs_snap(Menu): class IMAGE_MT_uvs_mirror(Menu): bl_label = "Mirror" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator("mesh.faces_mirror_uv") @@ -337,7 +337,7 @@ class IMAGE_MT_uvs_mirror(Menu): class IMAGE_MT_uvs_weldalign(Menu): bl_label = "Weld/Align" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator("uv.weld") # W, 1. @@ -364,10 +364,6 @@ class IMAGE_MT_uvs(Menu): layout.separator() - layout.prop(tool_settings, "use_uv_sculpt") - - layout.separator() - layout.prop(uv, "use_live_unwrap") layout.operator("uv.unwrap") @@ -497,7 +493,7 @@ class IMAGE_MT_pivot_pie(Menu): class IMAGE_MT_uvs_snap_pie(Menu): bl_label = "Snap" - def draw(self, context): + def draw(self, _context): layout = self.layout pie = layout.menu_pie() @@ -511,9 +507,137 @@ class IMAGE_MT_uvs_snap_pie(Menu): pie.operator("uv.snap_selected", text="Selected to Adjacent Unselected", icon='RESTRICT_SELECT_OFF').target = 'ADJACENT_UNSELECTED' +class IMAGE_HT_tool_header(Header): + bl_space_type = 'IMAGE_EDITOR' + bl_region_type = "TOOL_HEADER" + + def draw(self, context): + layout = self.layout + + layout.template_header() + + self.draw_tool_settings(context) + + sima = context.space_data + + layout.separator_spacer() + + IMAGE_HT_header.draw_xform_template(layout, context) + + layout.separator_spacer() + + self.draw_mode_settings(context) + + def draw_tool_settings(self, context): + layout = self.layout + + # Active Tool + # ----------- + from .space_toolsystem_common import ToolSelectPanelHelper + tool = ToolSelectPanelHelper.draw_active_tool_header(context, layout) + tool_mode = context.mode if tool is None else tool.mode + + # Object Mode Options + # ------------------- + + # Example of how tool_settings can be accessed as pop-overs. + + # TODO(campbell): editing options should be after active tool options + # (obviously separated for from the users POV) + draw_fn = getattr(_draw_tool_settings_context_mode, tool_mode, None) + if draw_fn is not None: + draw_fn(context, layout, tool) + + if tool_mode == 'PAINT': + if (tool is not None) and tool.has_datablock: + layout.popover_group(space_type='IMAGE_EDITOR', region_type='UI', context=".paint_common_2d", category="") + elif tool_mode == 'UV': + if (tool is not None) and tool.has_datablock: + layout.popover_group(space_type='IMAGE_EDITOR', region_type='UI', context=".uv_sculpt", category="") + + def draw_mode_settings(self, context): + layout = self.layout + + # Active Tool + # ----------- + from .space_toolsystem_common import ToolSelectPanelHelper + tool = ToolSelectPanelHelper.tool_active_from_context(context) + tool_mode = context.mode if tool is None else tool.mode + + if tool_mode == 'PAINT': + layout.popover_group(space_type='IMAGE_EDITOR', region_type='UI', context=".imagepaint_2d", category="") + + +class _draw_tool_settings_context_mode: + @staticmethod + def UV(context, layout, tool): + if tool and tool.has_datablock: + if context.mode == 'EDIT_MESH': + tool_settings = context.tool_settings + uv_sculpt = tool_settings.uv_sculpt + brush = uv_sculpt.brush + if brush: + from .properties_paint_common import UnifiedPaintPanel + + row = layout.row(align=True) + UnifiedPaintPanel.prop_unified_size(row, context, brush, "size", slider=True) + UnifiedPaintPanel.prop_unified_size(row, context, brush, "use_pressure_size", text="") + + row = layout.row(align=True) + UnifiedPaintPanel.prop_unified_strength(row, context, brush, "strength", slider=True) + UnifiedPaintPanel.prop_unified_strength(row, context, brush, "use_pressure_strength", text="") + + @staticmethod + def PAINT(context, layout, tool): + if (tool is None) or (not tool.has_datablock): + return + + paint = context.tool_settings.image_paint + layout.template_ID_preview(paint, "brush", rows=3, cols=8, hide_buttons=True) + + brush = paint.brush + if brush is None: + return + + from .properties_paint_common import ( + UnifiedPaintPanel, + brush_basic_texpaint_settings, + ) + capabilities = brush.image_paint_capabilities + if capabilities.has_color: + UnifiedPaintPanel.prop_unified_color(layout, context, brush, "color", text="") + brush_basic_texpaint_settings(layout, context, brush, compact=True) + + class IMAGE_HT_header(Header): bl_space_type = 'IMAGE_EDITOR' + @staticmethod + def draw_xform_template(layout, context): + sima = context.space_data + show_uvedit = sima.show_uvedit + show_maskedit = sima.show_maskedit + + if show_uvedit or show_maskedit: + layout.prop(sima, "pivot_point", icon_only=True) + + if show_uvedit: + tool_settings = context.tool_settings + + # Snap. + row = layout.row(align=True) + row.prop(tool_settings, "use_snap", text="") + row.prop(tool_settings, "snap_uv_element", icon_only=True) + if tool_settings.snap_uv_element != 'INCREMENT': + row.prop(tool_settings, "snap_target", text="") + + # Proportional Editing + row = layout.row(align=True) + row.prop(tool_settings, "use_proportional_edit", icon_only=True) + sub = row.row(align=True) + sub.active = tool_settings.use_proportional_edit + sub.prop(tool_settings, "proportional_edit_falloff", icon_only=True) + def draw(self, context): layout = self.layout @@ -521,13 +645,14 @@ class IMAGE_HT_header(Header): ima = sima.image iuser = sima.image_user tool_settings = context.tool_settings + show_region_tool_header = sima.show_region_tool_header show_render = sima.show_render show_uvedit = sima.show_uvedit show_maskedit = sima.show_maskedit - row = layout.row(align=True) - row.template_header() + if not show_region_tool_header: + layout.template_header() if sima.mode != 'UV': layout.prop(sima, "ui_mode", text="") @@ -548,6 +673,9 @@ class IMAGE_HT_header(Header): layout.separator_spacer() + if not show_region_tool_header: + IMAGE_HT_header.draw_xform_template(layout, context) + layout.template_ID(sima, "image", new="image.new", open="image.open") if show_maskedit: @@ -565,31 +693,6 @@ class IMAGE_HT_header(Header): mesh = context.edit_object.data layout.prop_search(mesh.uv_layers, "active", mesh, "uv_layers", text="") - if show_uvedit or show_maskedit: - layout.prop(sima, "pivot_point", icon_only=True) - - if show_uvedit: - # Snap. - row = layout.row(align=True) - row.prop(tool_settings, "use_snap", text="") - row.prop(tool_settings, "snap_uv_element", icon_only=True) - if tool_settings.snap_uv_element != 'INCREMENT': - row.prop(tool_settings, "snap_target", text="") - - # Proportional Editing - row = layout.row(align=True) - row.prop(tool_settings, "proportional_edit", icon_only=True) - # if tool_settings.proportional_edit != 'DISABLED': - sub = row.row(align=True) - sub.active = tool_settings.proportional_edit != 'DISABLED' - sub.prop(tool_settings, "proportional_edit_falloff", icon_only=True) - - row = layout.row() - row.popover( - panel="IMAGE_PT_view_display", - text="Display" - ) - if ima: if ima.is_stereo_3d: row = layout.row() @@ -711,8 +814,9 @@ class IMAGE_PT_image_properties(Panel): class IMAGE_PT_view_display(Panel): bl_space_type = 'IMAGE_EDITOR' - bl_region_type = 'HEADER' + bl_region_type = 'UI' bl_label = "Display" + bl_category = "View" @classmethod def poll(cls, context): @@ -741,9 +845,10 @@ class IMAGE_PT_view_display(Panel): class IMAGE_PT_view_display_uv_edit_overlays(Panel): bl_space_type = 'IMAGE_EDITOR' - bl_region_type = 'HEADER' + bl_region_type = 'UI' bl_label = "Overlays" bl_parent_id = 'IMAGE_PT_view_display' + bl_category = "View" bl_options = {'DEFAULT_CLOSED'} @classmethod @@ -754,15 +859,15 @@ class IMAGE_PT_view_display_uv_edit_overlays(Panel): def draw(self, context): layout = self.layout layout.use_property_split = True + layout.use_property_decorate = False sima = context.space_data uvedit = sima.uv_editor col = layout.column() - split = col.split(factor=0.6) - split.prop(uvedit, "show_edges", text="Edges") - split.prop(uvedit, "edge_display_type", text="") + col.prop(uvedit, "show_edges", text="Edges") + col.prop(uvedit, "edge_display_type", text="Draw Type") col.prop(uvedit, "show_faces", text="Faces") @@ -773,9 +878,10 @@ class IMAGE_PT_view_display_uv_edit_overlays(Panel): class IMAGE_PT_view_display_uv_edit_overlays_advanced(Panel): bl_space_type = 'IMAGE_EDITOR' - bl_region_type = 'HEADER' + bl_region_type = 'UI' bl_label = "Advanced" bl_parent_id = 'IMAGE_PT_view_display_uv_edit_overlays' + bl_category = "View" bl_options = {'DEFAULT_CLOSED'} @classmethod @@ -799,7 +905,7 @@ class IMAGE_PT_view_display_uv_edit_overlays_advanced(Panel): class IMAGE_UL_render_slots(UIList): - def draw_item(self, context, layout, data, item, icon, active_data, active_propname, index): + def draw_item(self, _context, layout, _data, item, _icon, _active_data, _active_propname, _index): slot = item layout.prop(slot, "name", text="", emboss=False) @@ -841,7 +947,7 @@ class IMAGE_PT_render_slots(Panel): class IMAGE_PT_paint(Panel, ImagePaintPanel): bl_label = "Brush" bl_context = ".paint_common_2d" - bl_category = "Tools" + bl_category = "Tool" def draw(self, context): layout = self.layout @@ -860,12 +966,13 @@ class IMAGE_PT_paint(Panel, ImagePaintPanel): class IMAGE_PT_paint_color(Panel, ImagePaintPanel): + bl_category = "Tool" bl_context = ".paint_common_2d" bl_parent_id = "IMAGE_PT_paint" bl_label = "Color Picker" @classmethod - def poll(self, context): + def poll(cls, context): settings = context.tool_settings.image_paint brush = settings.brush capabilities = brush.image_paint_capabilities @@ -877,19 +984,20 @@ class IMAGE_PT_paint_color(Panel, ImagePaintPanel): settings = context.tool_settings.image_paint brush = settings.brush - layout.active = brush.use_gradient == False + layout.active = not brush.use_gradient brush_texpaint_common_color(self, context, layout, brush, settings, True) class IMAGE_PT_paint_swatches(Panel, ImagePaintPanel): + bl_category = "Tool" bl_context = ".paint_common_2d" bl_parent_id = "IMAGE_PT_paint" bl_label = "Color Palette" bl_options = {'DEFAULT_CLOSED'} @classmethod - def poll(self, context): + def poll(cls, context): settings = context.tool_settings.image_paint brush = settings.brush capabilities = brush.image_paint_capabilities @@ -906,13 +1014,14 @@ class IMAGE_PT_paint_swatches(Panel, ImagePaintPanel): class IMAGE_PT_paint_gradient(Panel, ImagePaintPanel): + bl_category = "Tool" bl_context = ".paint_common_2d" bl_parent_id = "IMAGE_PT_paint" bl_label = "Gradient" bl_options = {'DEFAULT_CLOSED'} @classmethod - def poll(self, context): + def poll(cls, context): settings = context.tool_settings.image_paint brush = settings.brush capabilities = brush.image_paint_capabilities @@ -937,13 +1046,14 @@ class IMAGE_PT_paint_gradient(Panel, ImagePaintPanel): class IMAGE_PT_paint_clone(Panel, ImagePaintPanel): + bl_category = "Tool" bl_context = ".paint_common_2d" bl_parent_id = "IMAGE_PT_paint" bl_label = "Clone from Image/UV Map" bl_options = {'DEFAULT_CLOSED'} @classmethod - def poll(self, context): + def poll(cls, context): settings = context.tool_settings.image_paint brush = settings.brush @@ -964,13 +1074,14 @@ class IMAGE_PT_paint_clone(Panel, ImagePaintPanel): class IMAGE_PT_paint_options(Panel, ImagePaintPanel): + bl_category = "Tool" bl_context = ".paint_common_2d" bl_parent_id = "IMAGE_PT_paint" bl_label = "Options" bl_options = {'DEFAULT_CLOSED'} @classmethod - def poll(self, context): + def poll(cls, context): settings = context.tool_settings.image_paint brush = settings.brush capabilities = brush.image_paint_capabilities @@ -992,7 +1103,7 @@ class IMAGE_PT_tools_brush_display(BrushButtonsPanel, Panel): bl_label = "Display" bl_context = ".paint_common_2d" bl_options = {'DEFAULT_CLOSED'} - bl_category = "Options" + bl_category = "Tool" def draw(self, context): layout = self.layout @@ -1046,6 +1157,7 @@ class IMAGE_PT_tools_brush_display_show_brush(BrushButtonsPanel, Panel): bl_context = ".paint_common_2d" # dot on purpose (access from topbar) bl_label = "Show Brush" bl_parent_id = "IMAGE_PT_tools_brush_display" + bl_category = "Tool" bl_options = {'DEFAULT_CLOSED'} def draw_header(self, context): @@ -1079,6 +1191,7 @@ class IMAGE_PT_tools_brush_display_custom_icon(BrushButtonsPanel, Panel): bl_context = ".paint_common_2d" # dot on purpose (access from topbar) bl_label = "Custom Icon" bl_parent_id = "IMAGE_PT_tools_brush_display" + bl_category = "Tool" bl_options = {'DEFAULT_CLOSED'} def draw_header(self, context): @@ -1104,8 +1217,8 @@ class IMAGE_PT_tools_brush_display_custom_icon(BrushButtonsPanel, Panel): class IMAGE_PT_tools_brush_texture(BrushButtonsPanel, Panel): bl_label = "Texture" bl_context = ".paint_common_2d" + bl_category = "Tool" bl_options = {'DEFAULT_CLOSED'} - bl_category = "Tools" def draw(self, context): layout = self.layout @@ -1122,8 +1235,8 @@ class IMAGE_PT_tools_brush_texture(BrushButtonsPanel, Panel): class IMAGE_PT_tools_mask_texture(BrushButtonsPanel, Panel): bl_label = "Texture Mask" bl_context = ".paint_common_2d" + bl_category = "Tool" bl_options = {'DEFAULT_CLOSED'} - bl_category = "Tools" def draw(self, context): layout = self.layout @@ -1140,8 +1253,8 @@ class IMAGE_PT_tools_mask_texture(BrushButtonsPanel, Panel): class IMAGE_PT_paint_stroke(BrushButtonsPanel, Panel): bl_label = "Stroke" bl_context = ".paint_common_2d" + bl_category = "Tool" bl_options = {'DEFAULT_CLOSED'} - bl_category = "Tools" def draw(self, context): layout = self.layout @@ -1190,6 +1303,7 @@ class IMAGE_PT_paint_stroke_smooth_stroke(BrushButtonsPanel, Panel): bl_context = ".paint_common_2d" # dot on purpose (access from topbar) bl_label = "Smooth Stroke" bl_parent_id = "IMAGE_PT_paint_stroke" + bl_category = "Tool" bl_options = {'DEFAULT_CLOSED'} @classmethod @@ -1222,8 +1336,8 @@ class IMAGE_PT_paint_stroke_smooth_stroke(BrushButtonsPanel, Panel): class IMAGE_PT_paint_curve(BrushButtonsPanel, Panel): bl_label = "Falloff" bl_context = ".paint_common_2d" + bl_category = "Tool" bl_options = {'DEFAULT_CLOSED'} - bl_category = "Tools" def draw(self, context): layout = self.layout @@ -1244,9 +1358,9 @@ class IMAGE_PT_paint_curve(BrushButtonsPanel, Panel): class IMAGE_PT_tools_imagepaint_symmetry(BrushButtonsPanel, Panel): - bl_category = "Tools" bl_context = ".imagepaint_2d" bl_label = "Tiling" + bl_category = "Tool" bl_options = {'DEFAULT_CLOSED'} def draw(self, context): @@ -1261,53 +1375,33 @@ class IMAGE_PT_tools_imagepaint_symmetry(BrushButtonsPanel, Panel): row.prop(ipaint, "tile_y", text="Y", toggle=True) -class IMAGE_PT_uv_sculpt_curve(Panel): - bl_space_type = 'PROPERTIES' - bl_region_type = 'WINDOW' +class IMAGE_PT_uv_sculpt_brush(Panel): + bl_space_type = 'IMAGE_EDITOR' + bl_region_type = 'UI' bl_context = ".uv_sculpt" # dot on purpose (access from topbar) - bl_category = "Options" - bl_label = "UV Sculpt Curve" - bl_options = {'DEFAULT_CLOSED'} + bl_category = "Tool" + bl_label = "Brush" @classmethod def poll(cls, context): - return (context.uv_sculpt_object is not None) + sima = context.space_data + # TODO(campbell): nicer way to check if we're in uv sculpt mode. + if sima and sima.show_uvedit: + from .space_toolsystem_common import ToolSelectPanelHelper + tool = ToolSelectPanelHelper.tool_active_from_context(context) + if tool.has_datablock: + return True + return False def draw(self, context): + from .properties_paint_common import UnifiedPaintPanel layout = self.layout tool_settings = context.tool_settings uvsculpt = tool_settings.uv_sculpt - brush = uvsculpt.brush - layout.template_curve_mapping(brush, "curve") + layout.template_ID(uvsculpt, "brush") - row = layout.row(align=True) - row.operator("brush.curve_preset", icon='SMOOTHCURVE', text="").shape = 'SMOOTH' - row.operator("brush.curve_preset", icon='SPHERECURVE', text="").shape = 'ROUND' - row.operator("brush.curve_preset", icon='ROOTCURVE', text="").shape = 'ROOT' - row.operator("brush.curve_preset", icon='SHARPCURVE', text="").shape = 'SHARP' - row.operator("brush.curve_preset", icon='LINCURVE', text="").shape = 'LINE' - row.operator("brush.curve_preset", icon='NOCURVE', text="").shape = 'MAX' - - -class IMAGE_PT_uv_sculpt(Panel): - bl_space_type = 'PROPERTIES' - bl_region_type = 'WINDOW' - bl_context = ".uv_sculpt" # dot on purpose (access from topbar) - bl_category = "Options" - bl_label = "UV Sculpt" - - @classmethod - def poll(cls, context): - return (context.uv_sculpt_object is not None) - - def draw(self, context): - from .properties_paint_common import UnifiedPaintPanel - layout = self.layout - - tool_settings = context.tool_settings - uvsculpt = tool_settings.uv_sculpt brush = uvsculpt.brush if not self.is_popover: @@ -1326,13 +1420,43 @@ class IMAGE_PT_uv_sculpt(Panel): col.prop(tool_settings, "uv_sculpt_lock_borders") col.prop(tool_settings, "uv_sculpt_all_islands") - col.prop(tool_settings, "uv_sculpt_tool") - if tool_settings.uv_sculpt_tool == 'RELAX': - col.prop(tool_settings, "uv_relax_method") + if brush: + if brush.uv_sculpt_tool == 'RELAX': + col.prop(tool_settings, "uv_relax_method") col.prop(uvsculpt, "show_brush") +class IMAGE_PT_uv_sculpt_curve(Panel): + bl_space_type = 'IMAGE_EDITOR' + bl_region_type = 'UI' + bl_context = ".uv_sculpt" # dot on purpose (access from topbar) + bl_category = "Tool" + bl_label = "Falloff" + bl_options = {'DEFAULT_CLOSED'} + + poll = IMAGE_PT_uv_sculpt_brush.poll + + def draw(self, context): + layout = self.layout + + tool_settings = context.tool_settings + uvsculpt = tool_settings.uv_sculpt + brush = uvsculpt.brush + + if brush is not None: + layout.template_curve_mapping(brush, "curve") + + row = layout.row(align=True) + row.operator("brush.curve_preset", icon='SMOOTHCURVE', text="").shape = 'SMOOTH' + row.operator("brush.curve_preset", icon='SPHERECURVE', text="").shape = 'ROUND' + row.operator("brush.curve_preset", icon='ROOTCURVE', text="").shape = 'ROOT' + row.operator("brush.curve_preset", icon='SHARPCURVE', text="").shape = 'SHARP' + row.operator("brush.curve_preset", icon='LINCURVE', text="").shape = 'LINE' + row.operator("brush.curve_preset", icon='NOCURVE', text="").shape = 'MAX' + + + class ImageScopesPanel: @classmethod def poll(cls, context): @@ -1450,7 +1574,7 @@ class IMAGE_PT_scope_sample(ImageScopesPanel, Panel): class IMAGE_PT_uv_cursor(Panel): bl_space_type = 'IMAGE_EDITOR' bl_region_type = 'UI' - bl_category = "Image" + bl_category = "View" bl_label = "2D Cursor" @classmethod @@ -1474,7 +1598,7 @@ class IMAGE_PT_uv_cursor(Panel): class IMAGE_PT_grease_pencil(AnnotationDataPanel, Panel): bl_space_type = 'IMAGE_EDITOR' bl_region_type = 'UI' - bl_category = "Image" + bl_category = "View" # NOTE: this is just a wrapper around the generic GP Panel. @@ -1490,7 +1614,6 @@ classes = ( IMAGE_MT_image_invert, IMAGE_MT_uvs, IMAGE_MT_uvs_showhide, - IMAGE_MT_uvs_proportional, IMAGE_MT_uvs_transform, IMAGE_MT_uvs_snap, IMAGE_MT_uvs_mirror, @@ -1499,8 +1622,10 @@ classes = ( IMAGE_MT_uvs_context_menu, IMAGE_MT_pivot_pie, IMAGE_MT_uvs_snap_pie, + IMAGE_HT_tool_header, IMAGE_HT_header, MASK_MT_editor_menus, + IMAGE_PT_active_tool, IMAGE_PT_mask, IMAGE_PT_mask_layers, IMAGE_PT_mask_display, @@ -1527,7 +1652,7 @@ classes = ( IMAGE_PT_tools_brush_display_show_brush, IMAGE_PT_tools_brush_display_custom_icon, IMAGE_PT_tools_imagepaint_symmetry, - IMAGE_PT_uv_sculpt, + IMAGE_PT_uv_sculpt_brush, IMAGE_PT_uv_sculpt_curve, IMAGE_PT_view_histogram, IMAGE_PT_view_waveform, diff --git a/release/scripts/startup/bl_ui/space_info.py b/release/scripts/startup/bl_ui/space_info.py index 3ce48291619..196b12c0859 100644 --- a/release/scripts/startup/bl_ui/space_info.py +++ b/release/scripts/startup/bl_ui/space_info.py @@ -23,12 +23,11 @@ from bpy.types import Header, Menu class INFO_HT_header(Header): bl_space_type = 'INFO' - def draw(self, context): + def draw(self, _context): layout = self.layout layout.template_header() # Empty for now until info editor gets turned into log editor - pass # Not really info, just add to re-usable location. diff --git a/release/scripts/startup/bl_ui/space_nla.py b/release/scripts/startup/bl_ui/space_nla.py index 62a8e87b779..ba94769d2c0 100644 --- a/release/scripts/startup/bl_ui/space_nla.py +++ b/release/scripts/startup/bl_ui/space_nla.py @@ -33,8 +33,7 @@ class NLA_HT_header(Header): st = context.space_data - row = layout.row(align=True) - row.template_header() + layout.template_header() NLA_MT_editor_menus.draw_collapsible(context, layout) @@ -70,7 +69,7 @@ class NLA_MT_editor_menus(Menu): bl_idname = "NLA_MT_editor_menus" bl_label = "" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.menu("NLA_MT_view") layout.menu("NLA_MT_select") @@ -87,8 +86,7 @@ class NLA_MT_view(Menu): st = context.space_data - layout.operator("nla.properties", icon='MENU_PANEL') - + layout.prop(st, "show_region_ui") layout.separator() layout.prop(st, "use_realtime_update") @@ -118,7 +116,7 @@ class NLA_MT_view(Menu): class NLA_MT_select(Menu): bl_label = "Select" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator("nla.select_all", text="All").action = 'SELECT' @@ -200,7 +198,7 @@ class NLA_MT_edit(Menu): class NLA_MT_add(Menu): bl_label = "Add" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator("nla.actionclip_add") @@ -222,7 +220,7 @@ class NLA_MT_add(Menu): class NLA_MT_edit_transform(Menu): bl_label = "Transform" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator("transform.translate", text="Move") @@ -233,7 +231,7 @@ class NLA_MT_edit_transform(Menu): class NLA_MT_snap_pie(Menu): bl_label = "Snap" - def draw(self, context): + def draw(self, _context): layout = self.layout pie = layout.menu_pie() diff --git a/release/scripts/startup/bl_ui/space_node.py b/release/scripts/startup/bl_ui/space_node.py index 12c51da3e29..f31b8def2c9 100644 --- a/release/scripts/startup/bl_ui/space_node.py +++ b/release/scripts/startup/bl_ui/space_node.py @@ -51,8 +51,7 @@ class NODE_HT_header(Header): id_from = snode.id_from tool_settings = context.tool_settings - row = layout.row(align=True) - row.template_header() + layout.template_header() # Now expanded via the 'ui_type' # layout.prop(snode, "tree_type", text="") @@ -180,7 +179,7 @@ class NODE_MT_editor_menus(Menu): bl_idname = "NODE_MT_editor_menus" bl_label = "" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.menu("NODE_MT_view") layout.menu("NODE_MT_select") @@ -213,8 +212,8 @@ class NODE_MT_view(Menu): snode = context.space_data - layout.operator("node.properties", icon='MENU_PANEL') - layout.operator("node.toolbar", icon='MENU_PANEL') + layout.prop(snode, "show_region_toolbar") + layout.prop(snode, "show_region_ui") layout.separator() @@ -247,7 +246,7 @@ class NODE_MT_view(Menu): class NODE_MT_select(Menu): bl_label = "Select" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator("node.select_box").tweak = False @@ -273,7 +272,7 @@ class NODE_MT_select(Menu): class NODE_MT_node(Menu): bl_label = "Node" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator("transform.translate") @@ -368,7 +367,7 @@ class NODE_PT_node_color_presets(PresetPanel, Panel): class NODE_MT_node_color_context_menu(Menu): bl_label = "Node Color Specials" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator("node.node_copy_color", icon='COPY_ID') @@ -460,7 +459,7 @@ class NODE_PT_active_node_color(Panel): node = context.active_node self.layout.prop(node, "use_custom_color", text="") - def draw_header_preset(self, context): + def draw_header_preset(self, _context): NODE_PT_node_color_presets.draw_panel_header(self.layout) def draw(self, context): @@ -612,7 +611,7 @@ class NODE_PT_quality(bpy.types.Panel): class NODE_UL_interface_sockets(bpy.types.UIList): - def draw_item(self, context, layout, data, item, icon, active_data, active_propname, index): + def draw_item(self, context, layout, _data, item, icon, _active_data, _active_propname, _index): socket = item color = socket.draw_color(context) @@ -660,7 +659,7 @@ class NODE_PT_grease_pencil_tools(GreasePencilToolsPanel, Panel): # toolbar, but which may not necessarily be open -def node_draw_tree_view(layout, context): +def node_draw_tree_view(_layout, _context): pass diff --git a/release/scripts/startup/bl_ui/space_outliner.py b/release/scripts/startup/bl_ui/space_outliner.py index 9282d6a9150..43907f985c0 100644 --- a/release/scripts/startup/bl_ui/space_outliner.py +++ b/release/scripts/startup/bl_ui/space_outliner.py @@ -32,8 +32,7 @@ class OUTLINER_HT_header(Header): scene = context.scene ks = context.scene.keying_sets.active - row = layout.row(align=True) - row.template_header() + layout.template_header() layout.prop(space, "display_mode", icon_only=True) @@ -100,7 +99,7 @@ class OUTLINER_MT_editor_menus(Menu): class OUTLINER_MT_context(Menu): bl_label = "Outliner" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.menu("OUTLINER_MT_context_view") @@ -113,7 +112,7 @@ class OUTLINER_MT_context(Menu): class OUTLINER_MT_context_view(Menu): bl_label = "View" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator("outliner.show_active") @@ -128,7 +127,7 @@ class OUTLINER_MT_context_view(Menu): class OUTLINER_MT_edit_datablocks(Menu): bl_label = "Edit" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator("outliner.keyingset_add_selected") @@ -160,7 +159,7 @@ class OUTLINER_MT_collection_view_layer(Menu): class OUTLINER_MT_collection_visibility(Menu): bl_label = "Visibility" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator("outliner.collection_isolate", text="Isolate") diff --git a/release/scripts/startup/bl_ui/space_properties.py b/release/scripts/startup/bl_ui/space_properties.py index 3febcce37c7..7d9ca687524 100644 --- a/release/scripts/startup/bl_ui/space_properties.py +++ b/release/scripts/startup/bl_ui/space_properties.py @@ -23,11 +23,10 @@ from bpy.types import Header, Panel class PROPERTIES_HT_header(Header): bl_space_type = 'PROPERTIES' - def draw(self, context): + def draw(self, _context): layout = self.layout - row = layout.row() - row.template_header() + layout.template_header() class PROPERTIES_PT_navigation_bar(Panel): diff --git a/release/scripts/startup/bl_ui/space_sequencer.py b/release/scripts/startup/bl_ui/space_sequencer.py index 95e76bd077c..7f54276c7e5 100644 --- a/release/scripts/startup/bl_ui/space_sequencer.py +++ b/release/scripts/startup/bl_ui/space_sequencer.py @@ -83,8 +83,7 @@ class SEQUENCER_HT_header(Header): st = context.space_data scene = context.scene - row = layout.row(align=True) - row.template_header() + layout.template_header() layout.prop(st, "view_type", text="") @@ -126,8 +125,8 @@ class SEQUENCER_HT_header(Header): # Proportional editing if gpd and gpd.use_stroke_edit_mode: row = layout.row(align=True) - row.prop(tool_settings, "proportional_edit", icon_only=True) - if tool_settings.proportional_edit != 'DISABLED': + row.prop(tool_settings, "use_proportional_edit", icon_only=True) + if tool_settings.use_proportional_edit: row.prop(tool_settings, "proportional_edit_falloff", icon_only=True) @@ -152,7 +151,7 @@ class SEQUENCER_MT_editor_menus(Menu): class SEQUENCER_MT_view_toggle(Menu): bl_label = "View Type" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator("sequencer.view_toggle").type = 'SEQUENCER' @@ -160,6 +159,25 @@ class SEQUENCER_MT_view_toggle(Menu): layout.operator("sequencer.view_toggle").type = 'SEQUENCER_PREVIEW' +class SEQUENCER_MT_view_cache(Menu): + bl_label = "Cache" + + def draw(self, context): + layout = self.layout + + ed = context.scene.sequence_editor + layout.prop(ed, "show_cache") + layout.separator() + + col = layout.column() + col.enabled = ed.show_cache + + col.prop(ed, "show_cache_final_out") + col.prop(ed, "show_cache_raw") + col.prop(ed, "show_cache_preprocessed") + col.prop(ed, "show_cache_composite") + + class SEQUENCER_MT_view(Menu): bl_label = "View" @@ -175,7 +193,7 @@ class SEQUENCER_MT_view(Menu): # mode, else the lookup for the shortcut will fail in # wm_keymap_item_find_props() (see #32595). layout.operator_context = 'INVOKE_REGION_PREVIEW' - layout.operator("sequencer.properties", icon='MENU_PANEL') + layout.prop(st, "show_region_ui") layout.operator_context = 'INVOKE_DEFAULT' layout.separator() @@ -213,6 +231,7 @@ class SEQUENCER_MT_view(Menu): layout.prop(st, "show_frame_indicator") layout.prop(st, "show_strip_offset") layout.prop(st, "show_marker_lines") + layout.menu("SEQUENCER_MT_view_cache") layout.prop_menu_enum(st, "waveform_display_type") @@ -238,7 +257,7 @@ class SEQUENCER_MT_view(Menu): class SEQUENCER_MT_select(Menu): bl_label = "Select" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator("sequencer.select_all", text="All").action = 'SELECT' @@ -310,7 +329,7 @@ class SEQUENCER_MT_change(Menu): class SEQUENCER_MT_frame(Menu): bl_label = "Frame" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator("anim.previewrange_clear") @@ -400,7 +419,7 @@ class SEQUENCER_MT_add(Menu): class SEQUENCER_MT_add_empty(Menu): bl_label = "Empty" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.label(text="No Items Available") @@ -461,7 +480,7 @@ class SEQUENCER_MT_add_effect(Menu): class SEQUENCER_MT_strip_transform(Menu): bl_label = "Transform" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator("transform.transform", text="Move").mode = 'TRANSLATION' @@ -502,7 +521,7 @@ class SEQUENCER_MT_strip_input(Menu): class SEQUENCER_MT_strip_lock_mute(Menu): bl_label = "Lock/Mute" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator("sequencer.lock", icon='LOCKED') @@ -658,7 +677,7 @@ class SEQUENCER_PT_edit(SequencerButtonsPanel, Panel): row.label(text=iface_("Final Length: %s") % bpy.utils.smpte_from_frame(strip.frame_final_duration), translate=False) row = col.row(align=True) - row.active = (frame_current >= strip.frame_start and frame_current <= strip.frame_start + strip.frame_duration) + row.active = strip.frame_start <= frame_current <= strip.frame_start + strip.frame_duration row.label(text=iface_("Playhead: %d") % (frame_current - strip.frame_start), translate=False) col.label(text=iface_("Frame Offset %d:%d") % (strip.frame_offset_start, strip.frame_offset_end), @@ -1146,9 +1165,29 @@ class SEQUENCER_PT_filter(SequencerButtonsPanel, Panel): layout.prop(strip, "use_float", text="Convert to Float") +class SEQUENCER_PT_cache_settings(SequencerButtonsPanel, Panel): + bl_label = "Cache Settings" + bl_category = "Proxy & Cache" + + @classmethod + def poll(cls, context): + return cls.has_sequencer(context) + + def draw(self, context): + layout = self.layout + ed = context.scene.sequence_editor + + layout.prop(ed, "use_cache_raw") + layout.prop(ed, "use_cache_preprocessed") + layout.prop(ed, "use_cache_composite") + layout.prop(ed, "use_cache_final") + layout.separator() + layout.prop(ed, "recycle_max_cost") + + class SEQUENCER_PT_proxy_settings(SequencerButtonsPanel, Panel): - bl_label = "Proxy settings" - bl_category = "Proxy" + bl_label = "Proxy Settings" + bl_category = "Proxy & Cache" @classmethod def poll(cls, context): return cls.has_sequencer(context) @@ -1169,8 +1208,8 @@ class SEQUENCER_PT_proxy_settings(SequencerButtonsPanel, Panel): class SEQUENCER_PT_strip_proxy(SequencerButtonsPanel, Panel): - bl_label = "Strip Proxy/Timecode" - bl_category = "Proxy" + bl_label = "Strip Proxy & Timecode" + bl_category = "Proxy & Cache" @classmethod def poll(cls, context): @@ -1226,8 +1265,33 @@ class SEQUENCER_PT_strip_proxy(SequencerButtonsPanel, Panel): col.prop(proxy, "timecode") +class SEQUENCER_PT_strip_cache(SequencerButtonsPanel, Panel): + bl_label = "Strip Cache" + bl_category = "Proxy & Cache" + + @classmethod + def poll(cls, context): + if not cls.has_sequencer(context): + return False + if act_strip(context) is not None: + return True + + def draw_header(self, context): + strip = act_strip(context) + self.layout.prop(strip, "override_cache_settings", text="") + + def draw(self, context): + layout = self.layout + strip = act_strip(context) + layout.active = strip.override_cache_settings + + layout.prop(strip, "use_cache_raw") + layout.prop(strip, "use_cache_preprocessed") + layout.prop(strip, "use_cache_composite") + + class SEQUENCER_PT_preview(SequencerButtonsPanel_Output, Panel): - bl_label = "Scene Preview/Render" + bl_label = "Scene Shading" bl_space_type = 'SEQUENCE_EDITOR' bl_region_type = 'UI' bl_category = "Strip" @@ -1240,11 +1304,8 @@ class SEQUENCER_PT_preview(SequencerButtonsPanel_Output, Panel): col = layout.column() col.prop(render, "sequencer_gl_preview", text="") - row = col.row() - row.active = render.sequencer_gl_preview == 'SOLID' - row.prop(render, "use_sequencer_gl_textured_solid") - - col.prop(render, "use_sequencer_gl_dof") + if render.sequencer_gl_preview in ['SOLID', 'WIREFRAME']: + col.prop(render, "use_sequencer_override_scene_strip") class SEQUENCER_PT_view(SequencerButtonsPanel_Output, Panel): @@ -1412,6 +1473,7 @@ classes = ( SEQUENCER_HT_header, SEQUENCER_MT_editor_menus, SEQUENCER_MT_view, + SEQUENCER_MT_view_cache, SEQUENCER_MT_view_toggle, SEQUENCER_MT_select, SEQUENCER_MT_marker, @@ -1431,8 +1493,10 @@ classes = ( SEQUENCER_PT_scene, SEQUENCER_PT_mask, SEQUENCER_PT_filter, + SEQUENCER_PT_cache_settings, SEQUENCER_PT_proxy_settings, SEQUENCER_PT_strip_proxy, + SEQUENCER_PT_strip_cache, SEQUENCER_PT_preview, SEQUENCER_PT_view, SEQUENCER_PT_view_safe_areas, diff --git a/release/scripts/startup/bl_ui/space_text.py b/release/scripts/startup/bl_ui/space_text.py index 07184c81e42..6956a8379bd 100644 --- a/release/scripts/startup/bl_ui/space_text.py +++ b/release/scripts/startup/bl_ui/space_text.py @@ -31,15 +31,14 @@ class TEXT_HT_header(Header): st = context.space_data text = st.text - row = layout.row(align=True) - row.template_header() + layout.template_header() TEXT_MT_editor_menus.draw_collapsible(context, layout) if text and text.is_modified: - sub = row.row(align=True) - sub.alert = True - sub.operator("text.resolve_conflict", text="", icon='HELP') + row = layout.row(align=True) + row.alert = True + row.operator("text.resolve_conflict", text="", icon='HELP') layout.separator_spacer() @@ -188,7 +187,9 @@ class TEXT_MT_view(Menu): def draw(self, context): layout = self.layout - layout.operator("text.properties", icon='MENU_PANEL') + st = context.space_data + + layout.prop(st, "show_region_ui") layout.separator() @@ -234,7 +235,7 @@ class TEXT_MT_text(Menu): class TEXT_MT_templates_py(Menu): bl_label = "Python" - def draw(self, context): + def draw(self, _context): self.path_menu( bpy.utils.script_paths("templates_py"), "text.open", @@ -245,7 +246,7 @@ class TEXT_MT_templates_py(Menu): class TEXT_MT_templates_osl(Menu): bl_label = "Open Shading Language" - def draw(self, context): + def draw(self, _context): self.path_menu( bpy.utils.script_paths("templates_osl"), "text.open", @@ -256,7 +257,7 @@ class TEXT_MT_templates_osl(Menu): class TEXT_MT_templates(Menu): bl_label = "Templates" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.menu("TEXT_MT_templates_py") layout.menu("TEXT_MT_templates_osl") @@ -265,7 +266,7 @@ class TEXT_MT_templates(Menu): class TEXT_MT_edit_select(Menu): bl_label = "Select" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator("text.select_all") @@ -275,7 +276,7 @@ class TEXT_MT_edit_select(Menu): class TEXT_MT_format(Menu): bl_label = "Format" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator("text.indent") @@ -294,7 +295,7 @@ class TEXT_MT_format(Menu): class TEXT_MT_edit_to3d(Menu): bl_label = "Text To 3D Object" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator("text.to_3d_object", @@ -312,7 +313,7 @@ class TEXT_MT_edit(Menu): def poll(cls, context): return (context.space_data.text) - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator("ed.undo") @@ -350,7 +351,7 @@ class TEXT_MT_edit(Menu): class TEXT_MT_toolbox(Menu): bl_label = "" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator_context = 'INVOKE_DEFAULT' diff --git a/release/scripts/startup/bl_ui/space_time.py b/release/scripts/startup/bl_ui/space_time.py index 75f020666bb..d2c41f13ee3 100644 --- a/release/scripts/startup/bl_ui/space_time.py +++ b/release/scripts/startup/bl_ui/space_time.py @@ -30,6 +30,7 @@ class TIME_HT_editor_buttons(Header): def draw(self, context): pass + @staticmethod def draw_header(context, layout): scene = context.scene tool_settings = context.tool_settings @@ -85,7 +86,7 @@ class TIME_MT_editor_menus(Menu): bl_idname = "TIME_MT_editor_menus" bl_label = "" - def draw(self, context): + def draw(self, _context): layout = self.layout horizontal = (layout.direction == 'VERTICAL') if horizontal: diff --git a/release/scripts/startup/bl_ui/space_toolsystem_common.py b/release/scripts/startup/bl_ui/space_toolsystem_common.py index aa9e0bf979f..71354f9875d 100644 --- a/release/scripts/startup/bl_ui/space_toolsystem_common.py +++ b/release/scripts/startup/bl_ui/space_toolsystem_common.py @@ -544,23 +544,37 @@ class ToolSelectPanelHelper: self.draw_cls(self.layout, context) @staticmethod + def _tool_key_from_context(context): + space_data = context.space_data + space_type = space_data.type + if space_type == 'VIEW_3D': + return space_type, context.mode + elif space_type == 'IMAGE_EDITOR': + return space_type, space_data.mode + elif space_type == 'NODE_EDITOR': + return space_type, None + else: + return None, None + + @staticmethod def tool_active_from_context(context): - # BAD DESIGN WARNING: last used tool - workspace = context.workspace - space_type = workspace.tools_space_type - mode = workspace.tools_mode - return ToolSelectPanelHelper._tool_active_from_context(context, space_type, mode) + space_type = context.space_data.type + return ToolSelectPanelHelper._tool_active_from_context(context, space_type) @staticmethod def draw_active_tool_header( context, layout, *, show_tool_name=False, + tool_key=None, ): - # BAD DESIGN WARNING: last used tool - workspace = context.workspace - space_type = workspace.tools_space_type - mode = workspace.tools_mode + if tool_key is None: + space_type, mode = ToolSelectPanelHelper._tool_key_from_context(context) + else: + space_type, mode = tool_key + + if space_type is None: + return None item, tool, icon_value = ToolSelectPanelHelper._tool_get_active(context, space_type, mode, with_icon=True) if item is None: return None diff --git a/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py b/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py index 71d6771c487..dee2fa3c5f8 100644 --- a/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py +++ b/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py @@ -32,7 +32,6 @@ from .space_toolsystem_common import ( ToolDef, ) -from bpy.app.translations import pgettext_iface as iface_ from bpy.app.translations import pgettext_tip as tip_ @@ -44,7 +43,7 @@ def kmi_to_string_or_none(kmi): def generate_from_enum_ex( - context, *, + _context, *, idname_prefix, icon_prefix, type, @@ -73,7 +72,7 @@ def generate_from_enum_ex( class _template_widget: class VIEW3D_GGT_xform_extrude: @staticmethod - def draw_settings(context, layout, tool): + def draw_settings(_context, layout, tool): props = tool.gizmo_group_properties("VIEW3D_GGT_xform_extrude") layout.prop(props, "axis_type", expand=True) @@ -88,7 +87,7 @@ class _template_widget: class _defs_view3d_generic: @ToolDef.from_fn def cursor(): - def draw_settings(context, layout, tool): + def draw_settings(_context, layout, tool): props = tool.operator_properties("view3d.cursor3d") layout.prop(props, "use_depth") layout.prop(props, "orientation") @@ -114,7 +113,7 @@ class _defs_view3d_generic: @ToolDef.from_fn def ruler(): - def description(context, item, km): + def description(_context, _item, km): if km is not None: kmi_add = km.keymap_items.find_from_operator("view3d.ruler_add") kmi_remove = km.keymap_items.find_from_operator("view3d.ruler_remove") @@ -218,7 +217,7 @@ class _defs_annotate: @ToolDef.from_fn def eraser(): - def draw_settings(context, layout, tool): + def draw_settings(context, layout, _tool): # TODO: Move this setting to tool_settings prefs = context.preferences layout.prop(prefs.edit, "grease_pencil_eraser_radius", text="Radius") @@ -236,7 +235,7 @@ class _defs_transform: @ToolDef.from_fn def translate(): - def draw_settings(context, layout, tool): + def draw_settings(context, layout, _tool): _template_widget.VIEW3D_GGT_xform_gizmo.draw_settings_with_index(context, layout, 1) return dict( idname="builtin.move", @@ -251,7 +250,7 @@ class _defs_transform: @ToolDef.from_fn def rotate(): - def draw_settings(context, layout, tool): + def draw_settings(context, layout, _tool): _template_widget.VIEW3D_GGT_xform_gizmo.draw_settings_with_index(context, layout, 2) return dict( idname="builtin.rotate", @@ -266,7 +265,7 @@ class _defs_transform: @ToolDef.from_fn def scale(): - def draw_settings(context, layout, tool): + def draw_settings(context, layout, _tool): _template_widget.VIEW3D_GGT_xform_gizmo.draw_settings_with_index(context, layout, 3) return dict( idname="builtin.scale", @@ -281,7 +280,7 @@ class _defs_transform: @ToolDef.from_fn def scale_cage(): - def draw_settings(context, layout, tool): + def draw_settings(context, layout, _tool): _template_widget.VIEW3D_GGT_xform_gizmo.draw_settings_with_index(context, layout, 3) return dict( idname="builtin.scale_cage", @@ -298,7 +297,7 @@ class _defs_view3d_select: @ToolDef.from_fn def select(): - def draw_settings(context, layout, tool): + def draw_settings(_context, _layout, _tool): pass return dict( idname="builtin.select", @@ -311,11 +310,9 @@ class _defs_view3d_select: @ToolDef.from_fn def box(): - def draw_settings(context, layout, tool): + def draw_settings(_context, layout, tool): props = tool.operator_properties("view3d.select_box") - sub = layout.row() - sub.use_property_split = False - sub.prop(props, "mode", expand=True) + layout.prop(props, "mode", text="") return dict( idname="builtin.select_box", label="Select Box", @@ -327,11 +324,9 @@ class _defs_view3d_select: @ToolDef.from_fn def lasso(): - def draw_settings(context, layout, tool): + def draw_settings(_context, layout, tool): props = tool.operator_properties("view3d.select_lasso") - sub = layout.row() - sub.use_property_split = False - sub.prop(props, "mode", expand=True) + layout.prop(props, "mode", text="") return dict( idname="builtin.select_lasso", label="Select Lasso", @@ -343,14 +338,12 @@ class _defs_view3d_select: @ToolDef.from_fn def circle(): - def draw_settings(context, layout, tool): + def draw_settings(_context, layout, tool): props = tool.operator_properties("view3d.select_circle") - sub = layout.row() - sub.use_property_split = False - sub.prop(props, "mode", expand=True) + layout.prop(props, "mode", text="") layout.prop(props, "radius") - def draw_cursor(context, tool, xy): + def draw_cursor(_context, tool, xy): from gpu_extras.presets import draw_circle_2d props = tool.operator_properties("view3d.select_circle") radius = props.radius @@ -442,7 +435,7 @@ class _defs_edit_mesh: @ToolDef.from_fn def rip_region(): - def draw_settings(context, layout, tool): + def draw_settings(_context, layout, tool): props = tool.operator_properties("mesh.rip_move") props_macro = props.MESH_OT_rip layout.prop(props_macro, "use_fill") @@ -478,7 +471,7 @@ class _defs_edit_mesh: @ToolDef.from_fn def edge_slide(): - def draw_settings(context, layout, tool): + def draw_settings(_context, layout, tool): props = tool.operator_properties("transform.edge_slide") layout.prop(props, "correct_uv") @@ -493,7 +486,7 @@ class _defs_edit_mesh: @ToolDef.from_fn def vert_slide(): - def draw_settings(context, layout, tool): + def draw_settings(_context, layout, tool): props = tool.operator_properties("transform.vert_slide") layout.prop(props, "correct_uv") @@ -508,7 +501,7 @@ class _defs_edit_mesh: @ToolDef.from_fn def spin(): - def draw_settings(context, layout, tool): + def draw_settings(_context, layout, tool): props = tool.operator_properties("mesh.spin") layout.prop(props, "steps") props = tool.gizmo_group_properties("MESH_GGT_spin") @@ -525,7 +518,7 @@ class _defs_edit_mesh: @ToolDef.from_fn def spin_duplicate(): - def draw_settings(context, layout, tool): + def draw_settings(_context, layout, tool): props = tool.operator_properties("mesh.spin") layout.prop(props, "steps") props = tool.gizmo_group_properties("MESH_GGT_spin") @@ -542,7 +535,7 @@ class _defs_edit_mesh: @ToolDef.from_fn def inset(): - def draw_settings(context, layout, tool): + def draw_settings(_context, layout, tool): props = tool.operator_properties("mesh.inset") layout.prop(props, "use_outset") layout.prop(props, "use_individual") @@ -560,7 +553,7 @@ class _defs_edit_mesh: @ToolDef.from_fn def bevel(): - def draw_settings(context, layout, tool): + def draw_settings(_context, layout, tool): props = tool.operator_properties("mesh.bevel") layout.prop(props, "offset_type") layout.prop(props, "segments") @@ -595,7 +588,7 @@ class _defs_edit_mesh: @ToolDef.from_fn def extrude_normals(): - def draw_settings(context, layout, tool): + def draw_settings(_context, layout, tool): props = tool.operator_properties("mesh.extrude_region_shrink_fatten") props_macro = props.TRANSFORM_OT_shrink_fatten layout.prop(props_macro, "use_even_offset") @@ -621,7 +614,7 @@ class _defs_edit_mesh: @ToolDef.from_fn def extrude_cursor(): - def draw_settings(context, layout, tool): + def draw_settings(_context, layout, tool): props = tool.operator_properties("mesh.dupli_extrude_cursor") layout.prop(props, "rotate_source") @@ -637,7 +630,7 @@ class _defs_edit_mesh: @ToolDef.from_fn def loopcut_slide(): - def draw_settings(context, layout, tool): + def draw_settings(_context, layout, tool): props = tool.operator_properties("mesh.loopcut_slide") props_macro = props.MESH_OT_loopcut layout.prop(props_macro, "number_cuts") @@ -665,7 +658,7 @@ class _defs_edit_mesh: @ToolDef.from_fn def vertex_smooth(): - def draw_settings(context, layout, tool): + def draw_settings(_context, layout, tool): props = tool.operator_properties("mesh.vertices_smooth") layout.prop(props, "repeat") return dict( @@ -679,7 +672,7 @@ class _defs_edit_mesh: @ToolDef.from_fn def vertex_randomize(): - def draw_settings(context, layout, tool): + def draw_settings(_context, layout, tool): props = tool.operator_properties("transform.vertex_random") layout.prop(props, "uniform") layout.prop(props, "normal") @@ -721,7 +714,7 @@ class _defs_edit_mesh: @ToolDef.from_fn def shrink_fatten(): - def draw_settings(context, layout, tool): + def draw_settings(_context, layout, tool): props = tool.operator_properties("transform.shrink_fatten") layout.prop(props, "use_even_offset") @@ -746,7 +739,7 @@ class _defs_edit_mesh: @ToolDef.from_fn def knife(): - def draw_settings(context, layout, tool): + def draw_settings(_context, layout, tool): props = tool.operator_properties("mesh.knife_tool") layout.prop(props, "use_occlude_geometry") layout.prop(props, "only_selected") @@ -762,7 +755,7 @@ class _defs_edit_mesh: @ToolDef.from_fn def bisect(): - def draw_settings(context, layout, tool): + def draw_settings(_context, layout, tool): props = tool.operator_properties("mesh.bisect") layout.prop(props, "use_fill") layout.prop(props, "clear_inner") @@ -782,7 +775,7 @@ class _defs_edit_curve: @ToolDef.from_fn def draw(): - def draw_settings(context, layout, tool): + def draw_settings(context, layout, _tool): # Tool settings initialize operator options. tool_settings = context.tool_settings cps = tool_settings.curve_paint_settings @@ -856,7 +849,7 @@ class _defs_edit_curve: @ToolDef.from_fn def curve_vertex_randomize(): - def draw_settings(context, layout, tool): + def draw_settings(_context, layout, tool): props = tool.operator_properties("transform.vertex_random") layout.prop(props, "uniform") layout.prop(props, "normal") @@ -1084,7 +1077,7 @@ class _defs_image_generic: # Falls back to default image editor action. @ToolDef.from_fn def sample(): - def draw_settings(context, layout, tool): + def draw_settings(_context, layout, tool): props = tool.operator_properties("image.sample") layout.prop(props, "size") return dict( @@ -1119,7 +1112,7 @@ class _defs_image_uv_select: @ToolDef.from_fn def select(): - def draw_settings(context, layout, tool): + def draw_settings(_context, _layout, _tool): pass return dict( idname="builtin.select", @@ -1132,11 +1125,9 @@ class _defs_image_uv_select: @ToolDef.from_fn def box(): - def draw_settings(context, layout, tool): + def draw_settings(_context, layout, tool): props = tool.operator_properties("uv.select_box") - sub = layout.row() - sub.use_property_split = False - sub.prop(props, "mode", expand=True) + layout.prop(props, "mode", text="") return dict( idname="builtin.select_box", label="Select Box", @@ -1148,11 +1139,9 @@ class _defs_image_uv_select: @ToolDef.from_fn def lasso(): - def draw_settings(context, layout, tool): + def draw_settings(_context, layout, tool): props = tool.operator_properties("uv.select_lasso") - sub = layout.row() - sub.use_property_split = False - sub.prop(props, "mode", expand=True) + layout.prop(props, "mode", text="") return dict( idname="builtin.select_lasso", label="Select Lasso", @@ -1164,11 +1153,9 @@ class _defs_image_uv_select: @ToolDef.from_fn def circle(): - def draw_settings(context, layout, tool): + def draw_settings(_context, layout, tool): props = tool.operator_properties("uv.select_circle") - sub = layout.row() - sub.use_property_split = False - sub.prop(props, "mode", expand=True) + layout.prop(props, "mode", text="") layout.prop(props, "radius") return dict( idname="builtin.select_circle", @@ -1184,12 +1171,33 @@ class _defs_image_uv_sculpt: @staticmethod def generate_from_brushes(context): + def draw_cursor(context, _tool, xy): + from gpu_extras.presets import draw_circle_2d + tool_settings = context.tool_settings + uv_sculpt = tool_settings.uv_sculpt + if not uv_sculpt.show_brush: + return + ups = tool_settings.unified_paint_settings + if ups.use_unified_size: + radius = ups.size + else: + brush = tool_settings.uv_sculpt.brush + if brush is None: + return + radius = brush.size + draw_circle_2d(xy, (1.0,) * 4, radius, 32) + return generate_from_enum_ex( context, idname_prefix="builtin_brush.", icon_prefix="brush.uv_sculpt.", - type=bpy.types.ToolSettings, + type=bpy.types.Brush, attr="uv_sculpt_tool", + tooldef_keywords=dict( + operator="sculpt.uv_sculpt_stroke", + keymap="Image Editor Tool: Uv, Sculpt Stroke", + draw_cursor=draw_cursor, + ), ) @@ -1288,7 +1296,7 @@ class _defs_gpencil_edit: @ToolDef.from_fn def select(): - def draw_settings(context, layout, tool): + def draw_settings(context, layout, _tool): layout.prop(context.tool_settings.gpencil_sculpt, "intersection_threshold") return dict( idname="builtin.select", @@ -1303,9 +1311,7 @@ class _defs_gpencil_edit: def box_select(): def draw_settings(context, layout, tool): props = tool.operator_properties("gpencil.select_box") - sub = layout.row() - sub.use_property_split = False - sub.prop(props, "mode", expand=True) + layout.prop(props, "mode", text="") layout.prop(context.tool_settings.gpencil_sculpt, "intersection_threshold") return dict( idname="builtin.select_box", @@ -1320,9 +1326,7 @@ class _defs_gpencil_edit: def lasso_select(): def draw_settings(context, layout, tool): props = tool.operator_properties("gpencil.select_lasso") - sub = layout.row() - sub.use_property_split = False - sub.prop(props, "mode", expand=True) + layout.prop(props, "mode", text="") layout.prop(context.tool_settings.gpencil_sculpt, "intersection_threshold") return dict( idname="builtin.select_lasso", @@ -1337,9 +1341,7 @@ class _defs_gpencil_edit: def circle_select(): def draw_settings(context, layout, tool): props = tool.operator_properties("gpencil.select_circle") - sub = layout.row() - sub.use_property_split = False - sub.prop(props, "mode", expand=True) + layout.prop(props, "mode", text="") layout.prop(props, "radius") layout.prop(context.tool_settings.gpencil_sculpt, "intersection_threshold") return dict( @@ -1427,7 +1429,7 @@ class _defs_node_select: @ToolDef.from_fn def select(): - def draw_settings(context, layout, tool): + def draw_settings(_context, _layout, _tool): pass return dict( idname="builtin.select", @@ -1440,11 +1442,9 @@ class _defs_node_select: @ToolDef.from_fn def box(): - def draw_settings(context, layout, tool): + def draw_settings(_context, layout, tool): props = tool.operator_properties("node.select_box") - sub = layout.row() - sub.use_property_split = False - sub.prop(props, "mode", expand=True) + layout.prop(props, "mode", text="") pass return dict( idname="builtin.select_box", @@ -1457,11 +1457,9 @@ class _defs_node_select: @ToolDef.from_fn def lasso(): - def draw_settings(context, layout, tool): + def draw_settings(_context, layout, tool): props = tool.operator_properties("node.select_lasso") - sub = layout.row() - sub.use_property_split = False - sub.prop(props, "mode", expand=True) + layout.prop(props, "mode", text="") return dict( idname="builtin.select_lasso", label="Select Lasso", @@ -1473,11 +1471,9 @@ class _defs_node_select: @ToolDef.from_fn def circle(): - def draw_settings(context, layout, tool): + def draw_settings(_context, layout, tool): props = tool.operator_properties("node.select_circle") - sub = layout.row() - sub.use_property_split = False - sub.prop(props, "mode", expand=True) + layout.prop(props, "mode", text="") layout.prop(props, "radius") return dict( idname="builtin.select_circle", diff --git a/release/scripts/startup/bl_ui/space_topbar.py b/release/scripts/startup/bl_ui/space_topbar.py index 7598c6954d5..3e7d6d98679 100644 --- a/release/scripts/startup/bl_ui/space_topbar.py +++ b/release/scripts/startup/bl_ui/space_topbar.py @@ -80,399 +80,6 @@ class TOPBAR_HT_upper_bar(Header): unlink="scene.view_layer_remove") -class TOPBAR_HT_lower_bar(Header): - bl_space_type = 'TOPBAR' - bl_region_type = 'WINDOW' - - def draw(self, context): - region = context.region - - if region.alignment == 'RIGHT': - self.draw_right(context) - else: - self.draw_left(context) - - def draw_left(self, context): - layout = self.layout - - # Active Tool - # ----------- - from .space_toolsystem_common import ToolSelectPanelHelper - tool = ToolSelectPanelHelper.draw_active_tool_header(context, layout) - tool_space_type = 'VIEW_3D' if tool is None else tool.space_type - tool_mode = context.mode if tool is None else tool.mode - - # Object Mode Options - # ------------------- - - # Example of how tool_settings can be accessed as pop-overs. - - # TODO(campbell): editing options should be after active tool options - # (obviously separated for from the users POV) - draw_fn = getattr(getattr(_draw_left_context_mode, tool_space_type, None), tool_mode, None) - if draw_fn is not None: - draw_fn(context, layout, tool) - - if tool_space_type == 'VIEW_3D': - # Note: general mode options should be added to 'draw_right'. - if tool_mode == 'SCULPT': - if (tool is not None) and tool.has_datablock: - layout.popover_group(space_type='PROPERTIES', region_type='WINDOW', context=".paint_common", category="") - elif tool_mode == 'PAINT_VERTEX': - if (tool is not None) and tool.has_datablock: - layout.popover_group(space_type='PROPERTIES', region_type='WINDOW', context=".paint_common", category="") - elif tool_mode == 'PAINT_WEIGHT': - if (tool is not None) and tool.has_datablock: - layout.popover_group(space_type='PROPERTIES', region_type='WINDOW', context=".paint_common", category="") - elif tool_mode == 'PAINT_TEXTURE': - if (tool is not None) and tool.has_datablock: - layout.popover_group(space_type='PROPERTIES', region_type='WINDOW', context=".paint_common", category="") - elif tool_mode == 'EDIT_ARMATURE': - pass - elif tool_mode == 'EDIT_CURVE': - pass - elif tool_mode == 'EDIT_MESH': - pass - elif tool_mode == 'POSE': - pass - elif tool_mode == 'PARTICLE': - # Disable, only shows "Brush" panel, which is already in the top-bar. - # if tool.has_datablock: - # layout.popover_group(space_type='PROPERTIES', region_type='WINDOW', context=".paint_common", category="") - pass - elif tool_mode == 'PAINT_GPENCIL': - if (tool is not None) and tool.has_datablock: - layout.popover_group(space_type='PROPERTIES', region_type='WINDOW', context=".greasepencil_paint", category="") - elif tool_mode == 'SCULPT_GPENCIL': - layout.popover_group(space_type='PROPERTIES', region_type='WINDOW', context=".greasepencil_sculpt", category="") - elif tool_mode == 'WEIGHT_GPENCIL': - layout.popover_group(space_type='PROPERTIES', region_type='WINDOW', context=".greasepencil_weight", category="") - elif tool_space_type == 'IMAGE_EDITOR': - if tool_mode == 'PAINT': - if (tool is not None) and tool.has_datablock: - layout.popover_group(space_type='PROPERTIES', region_type='WINDOW', context=".paint_common_2d", category="") - elif context.uv_sculpt_object is not None: - layout.popover_group(space_type='PROPERTIES', region_type='WINDOW', context=".uv_sculpt", category="") - - def draw_right(self, context): - layout = self.layout - - # Active Tool - # ----------- - from .space_toolsystem_common import ToolSelectPanelHelper - tool = ToolSelectPanelHelper.tool_active_from_context(context) - tool_space_type = 'VIEW_3D' if tool is None else tool.space_type - tool_mode = context.mode if tool is None else tool.mode - - if tool_space_type == 'VIEW_3D': - if tool_mode == 'SCULPT': - layout.popover_group(space_type='PROPERTIES', region_type='WINDOW', context=".sculpt_mode", category="") - elif tool_mode == 'PAINT_VERTEX': - layout.popover_group(space_type='PROPERTIES', region_type='WINDOW', context=".vertexpaint", category="") - elif tool_mode == 'PAINT_WEIGHT': - layout.popover_group(space_type='PROPERTIES', region_type='WINDOW', context=".weightpaint", category="") - elif tool_mode == 'PAINT_TEXTURE': - layout.popover_group(space_type='PROPERTIES', region_type='WINDOW', context=".imagepaint", category="") - elif tool_mode == 'EDIT_TEXT': - layout.popover_group(space_type='PROPERTIES', region_type='WINDOW', context=".text_edit", category="") - elif tool_mode == 'EDIT_ARMATURE': - layout.popover_group(space_type='PROPERTIES', region_type='WINDOW', context=".armature_edit", category="") - elif tool_mode == 'EDIT_METABALL': - layout.popover_group(space_type='PROPERTIES', region_type='WINDOW', context=".mball_edit", category="") - elif tool_mode == 'EDIT_LATTICE': - layout.popover_group(space_type='PROPERTIES', region_type='WINDOW', context=".lattice_edit", category="") - elif tool_mode == 'EDIT_CURVE': - layout.popover_group(space_type='PROPERTIES', region_type='WINDOW', context=".curve_edit", category="") - elif tool_mode == 'EDIT_MESH': - layout.popover_group(space_type='PROPERTIES', region_type='WINDOW', context=".mesh_edit", category="") - elif tool_mode == 'POSE': - layout.popover_group(space_type='PROPERTIES', region_type='WINDOW', context=".posemode", category="") - elif tool_mode == 'PARTICLE': - layout.popover_group(space_type='PROPERTIES', region_type='WINDOW', context=".particlemode", category="") - elif tool_mode == 'OBJECT': - layout.popover_group(space_type='PROPERTIES', region_type='WINDOW', context=".objectmode", category="") - elif tool_mode in {'PAINT_GPENCIL', 'EDIT_GPENCIL', 'SCULPT_GPENCIL', 'WEIGHT_GPENCIL'}: - # Grease pencil layer. - gpl = context.active_gpencil_layer - if gpl and gpl.info is not None: - text = gpl.info - maxw = 25 - if len(text) > maxw: - text = text[:maxw - 5] + '..' + text[-3:] - else: - text = "" - - layout.label(text="Layer:") - sub = layout.row() - sub.ui_units_x = 8 - sub.popover( - panel="TOPBAR_PT_gpencil_layers", - text=text, - ) - elif tool_space_type == 'IMAGE_EDITOR': - if tool_mode == 'PAINT': - layout.popover_group(space_type='PROPERTIES', region_type='WINDOW', context=".imagepaint_2d", category="") - - -class _draw_left_context_mode: - class VIEW_3D: - @staticmethod - def SCULPT(context, layout, tool): - if (tool is None) or (not tool.has_datablock): - return - - paint = context.tool_settings.sculpt - layout.template_ID_preview(paint, "brush", rows=3, cols=8, hide_buttons=True) - - brush = paint.brush - if brush is None: - return - - from .properties_paint_common import ( - brush_basic_sculpt_settings, - ) - brush_basic_sculpt_settings(layout, context, brush, compact=True) - - @staticmethod - def PAINT_TEXTURE(context, layout, tool): - if (tool is None) or (not tool.has_datablock): - return - - paint = context.tool_settings.image_paint - layout.template_ID_preview(paint, "brush", rows=3, cols=8, hide_buttons=True) - - brush = paint.brush - if brush is None: - return - - from .properties_paint_common import ( - UnifiedPaintPanel, - brush_basic_texpaint_settings, - ) - capabilities = brush.image_paint_capabilities - if capabilities.has_color: - UnifiedPaintPanel.prop_unified_color(layout, context, brush, "color", text="") - brush_basic_texpaint_settings(layout, context, brush, compact=True) - - @staticmethod - def PAINT_VERTEX(context, layout, tool): - if (tool is None) or (not tool.has_datablock): - return - - paint = context.tool_settings.vertex_paint - layout.template_ID_preview(paint, "brush", rows=3, cols=8, hide_buttons=True) - - brush = paint.brush - if brush is None: - return - - from .properties_paint_common import ( - UnifiedPaintPanel, - brush_basic_vpaint_settings, - ) - capabilities = brush.vertex_paint_capabilities - if capabilities.has_color: - UnifiedPaintPanel.prop_unified_color(layout, context, brush, "color", text="") - brush_basic_vpaint_settings(layout, context, brush, compact=True) - - @staticmethod - def PAINT_WEIGHT(context, layout, tool): - if (tool is None) or (not tool.has_datablock): - return - - paint = context.tool_settings.weight_paint - layout.template_ID_preview(paint, "brush", rows=3, cols=8, hide_buttons=True) - brush = paint.brush - if brush is None: - return - - from .properties_paint_common import brush_basic_wpaint_settings - brush_basic_wpaint_settings(layout, context, brush, compact=True) - - @staticmethod - def PAINT_GPENCIL(context, layout, tool): - if tool is None: - return - - # is_paint = True - # FIXME: tools must use their own UI drawing! - if tool.idname in {"builtin.line", "builtin.box", "builtin.circle", "builtin.arc", "builtin.curve"}: - # is_paint = False - pass - elif tool.idname == "Cutter": - row = layout.row(align=True) - row.prop(context.tool_settings.gpencil_sculpt, "intersection_threshold") - return - elif not tool.has_datablock: - return - - paint = context.tool_settings.gpencil_paint - brush = paint.brush - if brush is None: - return - - gp_settings = brush.gpencil_settings - - def draw_color_selector(): - ma = gp_settings.material - row = layout.row(align=True) - if not gp_settings.use_material_pin: - ma = context.object.active_material - icon_id = 0 - if ma: - icon_id = ma.id_data.preview.icon_id - txt_ma = ma.name - maxw = 25 - if len(txt_ma) > maxw: - txt_ma = txt_ma[:maxw - 5] + '..' + txt_ma[-3:] - else: - txt_ma = "" - - row.label(text="Material:") - sub = row.row() - sub.ui_units_x = 8 - sub.popover( - panel="TOPBAR_PT_gpencil_materials", - text=txt_ma, - icon_value=icon_id, - ) - - row.prop(gp_settings, "use_material_pin", text="") - - row = layout.row(align=True) - tool_settings = context.scene.tool_settings - settings = tool_settings.gpencil_paint - row.template_ID_preview(settings, "brush", rows=3, cols=8, hide_buttons=True) - - if context.object and brush.gpencil_tool in {'FILL', 'DRAW'}: - draw_color_selector() - - from .properties_paint_common import ( - brush_basic_gpencil_paint_settings, - ) - brush_basic_gpencil_paint_settings(layout, context, brush, compact=True) - - # FIXME: tools must use their own UI drawing! - if tool.idname in {"builtin.arc", "builtin.curve", "builtin.line", "builtin.box", "builtin.circle"}: - settings = context.tool_settings.gpencil_sculpt - row = layout.row(align=True) - row.prop(settings, "use_thickness_curve", text="", icon='CURVE_DATA') - sub = row.row(align=True) - sub.active = settings.use_thickness_curve - sub.popover( - panel="TOPBAR_PT_gpencil_primitive", - text="Thickness Profile", - ) - - if brush.gpencil_tool == 'FILL': - settings = context.tool_settings.gpencil_sculpt - row = layout.row(align=True) - sub = row.row(align=True) - sub.popover( - panel="TOPBAR_PT_gpencil_fill", - text="Fill Options", - ) - - @staticmethod - def SCULPT_GPENCIL(context, layout, tool): - if (tool is None) or (not tool.has_datablock): - return - tool_settings = context.tool_settings - settings = tool_settings.gpencil_sculpt - brush = settings.brush - - from .properties_paint_common import ( - brush_basic_gpencil_sculpt_settings, - ) - brush_basic_gpencil_sculpt_settings(layout, context, brush, compact=True) - - @staticmethod - def WEIGHT_GPENCIL(context, layout, tool): - if (tool is None) or (not tool.has_datablock): - return - tool_settings = context.tool_settings - settings = tool_settings.gpencil_sculpt - brush = settings.brush - - from .properties_paint_common import ( - brush_basic_gpencil_weight_settings, - ) - brush_basic_gpencil_weight_settings(layout, context, brush, compact=True) - - @staticmethod - def PARTICLE(context, layout, tool): - if (tool is None) or (not tool.has_datablock): - return - - # See: 'VIEW3D_PT_tools_brush', basically a duplicate - settings = context.tool_settings.particle_edit - brush = settings.brush - tool = settings.tool - if tool != 'NONE': - layout.prop(brush, "size", slider=True) - if tool == 'ADD': - layout.prop(brush, "count") - - layout.prop(settings, "use_default_interpolate") - layout.prop(brush, "steps", slider=True) - layout.prop(settings, "default_key_count", slider=True) - else: - layout.prop(brush, "strength", slider=True) - - if tool == 'LENGTH': - layout.row().prop(brush, "length_mode", expand=True) - elif tool == 'PUFF': - layout.row().prop(brush, "puff_mode", expand=True) - layout.prop(brush, "use_puff_volume") - elif tool == 'COMB': - row = layout.row() - row.active = settings.is_editable - row.prop(settings, "use_emitter_deflect", text="Deflect Emitter") - sub = row.row(align=True) - sub.active = settings.use_emitter_deflect - sub.prop(settings, "emitter_distance", text="Distance") - - class IMAGE_EDITOR: - @staticmethod - def VIEW(context, layout, tool): - tool_settings = context.tool_settings - if tool_settings.use_uv_sculpt: - if context.mode == 'EDIT_MESH': - uv_sculpt = tool_settings.uv_sculpt - brush = uv_sculpt.brush - if brush: - from .properties_paint_common import UnifiedPaintPanel - - row = layout.row(align=True) - UnifiedPaintPanel.prop_unified_size(row, context, brush, "size", slider=True) - UnifiedPaintPanel.prop_unified_size(row, context, brush, "use_pressure_size", text="") - - row = layout.row(align=True) - UnifiedPaintPanel.prop_unified_strength(row, context, brush, "strength", slider=True) - UnifiedPaintPanel.prop_unified_strength(row, context, brush, "use_pressure_strength", text="") - - @staticmethod - def PAINT(context, layout, tool): - if (tool is None) or (not tool.has_datablock): - return - - paint = context.tool_settings.image_paint - layout.template_ID_preview(paint, "brush", rows=3, cols=8, hide_buttons=True) - - brush = paint.brush - if brush is None: - return - - from .properties_paint_common import ( - UnifiedPaintPanel, - brush_basic_texpaint_settings, - ) - capabilities = brush.image_paint_capabilities - if capabilities.has_color: - UnifiedPaintPanel.prop_unified_color(layout, context, brush, "color", text="") - brush_basic_texpaint_settings(layout, context, brush, compact=True) - - class TOPBAR_PT_gpencil_layers(Panel): bl_space_type = 'VIEW_3D' bl_region_type = 'HEADER' @@ -549,7 +156,7 @@ class TOPBAR_MT_editor_menus(Menu): bl_idname = "TOPBAR_MT_editor_menus" bl_label = "" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.menu("TOPBAR_MT_file") layout.menu("TOPBAR_MT_edit") @@ -653,8 +260,9 @@ class TOPBAR_MT_file_new(Menu): return sorted(app_templates) - def draw_ex(layout, context, *, use_splash=False, use_more=False): - layout.operator_context = 'EXEC_DEFAULT' + @staticmethod + def draw_ex(layout, _context, *, use_splash=False, use_more=False): + layout.operator_context = 'INVOKE_DEFAULT' # Limit number of templates in splash screen, spill over into more menu. paths = TOPBAR_MT_file_new.app_template_paths() @@ -686,6 +294,8 @@ class TOPBAR_MT_file_new(Menu): ) props.app_template = d + layout.operator_context = 'EXEC_DEFAULT' + if show_more: layout.menu("TOPBAR_MT_templates_more", text="...") @@ -704,7 +314,7 @@ class TOPBAR_MT_file_import(Menu): bl_idname = "TOPBAR_MT_file_import" bl_label = "Import" - def draw(self, context): + def draw(self, _context): if bpy.app.build_options.collada: self.layout.operator("wm.collada_import", text="Collada (Default) (.dae)") if bpy.app.build_options.alembic: @@ -715,7 +325,7 @@ class TOPBAR_MT_file_export(Menu): bl_idname = "TOPBAR_MT_file_export" bl_label = "Export" - def draw(self, context): + def draw(self, _context): if bpy.app.build_options.collada: self.layout.operator("wm.collada_export", text="Collada (Default) (.dae)") if bpy.app.build_options.alembic: @@ -725,7 +335,7 @@ class TOPBAR_MT_file_export(Menu): class TOPBAR_MT_file_external_data(Menu): bl_label = "External Data" - def draw(self, context): + def draw(self, _context): layout = self.layout icon = 'CHECKBOX_HLT' if bpy.data.use_autopack else 'CHECKBOX_DEHLT' @@ -752,7 +362,7 @@ class TOPBAR_MT_file_external_data(Menu): class TOPBAR_MT_file_previews(Menu): bl_label = "Data Previews" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator("wm.previews_ensure") @@ -858,7 +468,6 @@ class TOPBAR_MT_window(Menu): layout.separator() - layout.prop(context.screen, "show_topbar") layout.prop(context.screen, "show_statusbar") layout.separator() @@ -946,11 +555,11 @@ class TOPBAR_MT_help(Menu): class TOPBAR_MT_file_context_menu(Menu): bl_label = "File Context Menu" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator_context = 'INVOKE_AREA' - layout.operator("wm.read_homefile", text="New", icon='FILE_NEW') + layout.menu("TOPBAR_MT_file_new", text="New", icon='FILE_NEW') layout.operator("wm.open_mainfile", text="Open...", icon='FILE_FOLDER') layout.separator() @@ -971,7 +580,7 @@ class TOPBAR_MT_file_context_menu(Menu): class TOPBAR_MT_workspace_menu(Menu): bl_label = "Workspace" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator("workspace.duplicate", text="Duplicate", icon='DUPLICATE') @@ -1002,6 +611,7 @@ class TOPBAR_PT_active_tool(Panel): def draw(self, context): layout = self.layout + tool_mode = context.mode # Panel display of topbar tool settings. # currently displays in tool settings, keep here since the same functionality is used for the topbar. @@ -1010,7 +620,12 @@ class TOPBAR_PT_active_tool(Panel): layout.use_property_decorate = False from .space_toolsystem_common import ToolSelectPanelHelper - ToolSelectPanelHelper.draw_active_tool_header(context, layout, show_tool_name=True) + ToolSelectPanelHelper.draw_active_tool_header( + context, + layout, + show_tool_name=True, + tool_key=('VIEW_3D', tool_mode), + ) # Grease Pencil Object - Primitive curve @@ -1033,7 +648,6 @@ class TOPBAR_PT_gpencil_fill(Panel): bl_region_type = 'HEADER' bl_label = "Advanced" - @staticmethod def draw(self, context): paint = context.tool_settings.gpencil_paint brush = paint.brush @@ -1053,14 +667,10 @@ class TOPBAR_PT_gpencil_fill(Panel): # Only a popover class TOPBAR_PT_name(Panel): bl_space_type = 'TOPBAR' # dummy - bl_region_type = 'WINDOW' + 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 @@ -1120,7 +730,6 @@ class TOPBAR_PT_name(Panel): classes = ( TOPBAR_HT_upper_bar, - TOPBAR_HT_lower_bar, TOPBAR_MT_file_context_menu, TOPBAR_MT_workspace_menu, TOPBAR_MT_editor_menus, diff --git a/release/scripts/startup/bl_ui/space_userpref.py b/release/scripts/startup/bl_ui/space_userpref.py index 1740731c301..d97a228aaa3 100644 --- a/release/scripts/startup/bl_ui/space_userpref.py +++ b/release/scripts/startup/bl_ui/space_userpref.py @@ -318,6 +318,7 @@ class USERPREF_PT_edit_objects_duplicate_data(PreferencePanel, Panel): col.prop(edit, "use_duplicate_curve", text="Curve") # col.prop(edit, "use_duplicate_fcurve", text="F-Curve") col.prop(edit, "use_duplicate_light", text="Light") + col.prop(edit, "use_duplicate_lightprobe", text="Light Probe") col = flow.column() col.prop(edit, "use_duplicate_material", text="Material") col.prop(edit, "use_duplicate_mesh", text="Mesh") @@ -327,6 +328,7 @@ class USERPREF_PT_edit_objects_duplicate_data(PreferencePanel, Panel): col.prop(edit, "use_duplicate_surface", text="Surface") col.prop(edit, "use_duplicate_text", text="Text") col.prop(edit, "use_duplicate_texture", text="Texture") + col.prop(edit, "use_duplicate_grease_pencil", text="Grease Pencil") class USERPREF_PT_edit_cursor(PreferencePanel, Panel): @@ -577,10 +579,7 @@ class USERPREF_PT_viewport_display(PreferencePanel, Panel): flow = layout.grid_flow(row_major=False, columns=0, even_columns=True, even_rows=False, align=False) - col = flow.column() - col.prop(view, "gizmo_size", text="Gizmo Size") - col.prop(view, "object_origin_size") - col.separator() + flow.prop(view, "gizmo_size", text="Gizmo Size") flow.separator() @@ -685,6 +684,13 @@ class USERPREF_PT_system_memory(PreferencePanel, Panel): flow.prop(system, "texture_time_out", text="Texture Time Out") flow.prop(system, "texture_collection_rate", text="Garbage Collection Rate") + layout.separator() + + flow = layout.grid_flow(row_major=False, columns=0, even_columns=True, even_rows=False, align=False) + + flow.prop(system, "vbo_time_out", text="Vbo Time Out") + flow.prop(system, "vbo_collection_rate", text="Garbage Collection Rate") + class USERPREF_MT_interface_theme_presets(Menu): bl_label = "Presets" @@ -697,6 +703,7 @@ class USERPREF_MT_interface_theme_presets(Menu): ) draw = Menu.draw_preset + @staticmethod def reset_cb(context): bpy.ops.preferences.reset_default_theme() @@ -1157,7 +1164,7 @@ class FilePathsPanel: class USERPREF_PT_file_paths_data(FilePathsPanel, Panel): bl_label = "Data" - def draw_props(self, context, layout): + def draw_props(self, context, _layout): paths = context.preferences.filepaths col = self.layout.column() @@ -1171,7 +1178,7 @@ class USERPREF_PT_file_paths_data(FilePathsPanel, Panel): class USERPREF_PT_file_paths_render(FilePathsPanel, Panel): bl_label = "Render" - def draw_props(self, context, layout): + def draw_props(self, context, _layout): paths = context.preferences.filepaths col = self.layout.column() @@ -1924,7 +1931,7 @@ class USERPREF_PT_studiolight_matcaps(Panel, StudioLightPanelMixin): bl_label = "MatCaps" sl_type = 'MATCAP' - def draw_header_preset(self, context): + def draw_header_preset(self, _context): layout = self.layout layout.operator("preferences.studiolight_install", icon='IMPORT', text="Install...").type = 'MATCAP' layout.separator() @@ -1934,7 +1941,7 @@ class USERPREF_PT_studiolight_world(Panel, StudioLightPanelMixin): bl_label = "LookDev HDRIs" sl_type = 'WORLD' - def draw_header_preset(self, context): + def draw_header_preset(self, _context): layout = self.layout layout.operator("preferences.studiolight_install", icon='IMPORT', text="Install...").type = 'WORLD' layout.separator() @@ -1944,7 +1951,7 @@ class USERPREF_PT_studiolight_lights(Panel, StudioLightPanelMixin): bl_label = "Studio Lights" sl_type = 'STUDIO' - def draw_header_preset(self, context): + def draw_header_preset(self, _context): layout = self.layout op = layout.operator("preferences.studiolight_install", icon='IMPORT', text="Install...") op.type = 'STUDIO' diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py index 06626c67bc9..8c9a1f86cb1 100644 --- a/release/scripts/startup/bl_ui/space_view3d.py +++ b/release/scripts/startup/bl_ui/space_view3d.py @@ -33,101 +33,367 @@ from .properties_grease_pencil_common import ( ) from bpy.app.translations import contexts as i18n_contexts - -class VIEW3D_HT_header(Header): +class VIEW3D_HT_tool_header(Header): bl_space_type = 'VIEW_3D' + bl_region_type = "TOOL_HEADER" def draw(self, context): layout = self.layout - view = context.space_data - shading = view.shading - # mode_string = context.mode - obj = context.active_object - overlay = view.overlay - tool_settings = context.tool_settings + layout.row(align=True).template_header() - row = layout.row(align=True) - row.template_header() + self.draw_tool_settings(context) - object_mode = 'OBJECT' if obj is None else obj.mode - has_pose_mode = ( - (object_mode == 'POSE') or - (object_mode == 'WEIGHT_PAINT' and context.pose_object is not None) + layout.separator_spacer() + + VIEW3D_HT_header.draw_xform_template(layout, context) + + layout.separator_spacer() + + self.draw_mode_settings(context) + + def draw_tool_settings(self, context): + layout = self.layout + tool_mode = context.mode + + # Active Tool + # ----------- + from .space_toolsystem_common import ToolSelectPanelHelper + tool = ToolSelectPanelHelper.draw_active_tool_header( + context, layout, + tool_key=('VIEW_3D', tool_mode), ) - # Note: This is actually deadly in case enum_items have to be dynamically generated - # (because internal RNA array iterator will free everything immediately...). - # XXX This is an RNA internal issue, not sure how to fix it. - # Note: Tried to add an accessor to get translated UI strings instead of manual call - # to pgettext_iface below, but this fails because translated enumitems - # are always dynamically allocated. - act_mode_item = bpy.types.Object.bl_rna.properties["mode"].enum_items[object_mode] - act_mode_i18n_context = bpy.types.Object.bl_rna.properties["mode"].translation_context + # Object Mode Options + # ------------------- + + # Example of how tool_settings can be accessed as pop-overs. + + # TODO(campbell): editing options should be after active tool options + # (obviously separated for from the users POV) + draw_fn = getattr(_draw_tool_settings_context_mode, tool_mode, None) + if draw_fn is not None: + draw_fn(context, layout, tool) + + # Note: general mode options should be added to 'draw_mode_settings'. + if tool_mode == 'SCULPT': + if (tool is not None) and tool.has_datablock: + layout.popover_group(space_type='PROPERTIES', region_type='WINDOW', context=".paint_common", category="") + elif tool_mode == 'PAINT_VERTEX': + if (tool is not None) and tool.has_datablock: + layout.popover_group(space_type='PROPERTIES', region_type='WINDOW', context=".paint_common", category="") + elif tool_mode == 'PAINT_WEIGHT': + if (tool is not None) and tool.has_datablock: + layout.popover_group(space_type='PROPERTIES', region_type='WINDOW', context=".paint_common", category="") + elif tool_mode == 'PAINT_TEXTURE': + if (tool is not None) and tool.has_datablock: + layout.popover_group(space_type='PROPERTIES', region_type='WINDOW', context=".paint_common", category="") + elif tool_mode == 'EDIT_ARMATURE': + pass + elif tool_mode == 'EDIT_CURVE': + pass + elif tool_mode == 'EDIT_MESH': + pass + elif tool_mode == 'POSE': + pass + elif tool_mode == 'PARTICLE': + # Disable, only shows "Brush" panel, which is already in the top-bar. + # if tool.has_datablock: + # layout.popover_group(space_type='PROPERTIES', region_type='WINDOW', context=".paint_common", category="") + pass + elif tool_mode == 'PAINT_GPENCIL': + if (tool is not None) and tool.has_datablock: + layout.popover_group(space_type='PROPERTIES', region_type='WINDOW', context=".greasepencil_paint", category="") + elif tool_mode == 'SCULPT_GPENCIL': + layout.popover_group(space_type='PROPERTIES', region_type='WINDOW', context=".greasepencil_sculpt", category="") + elif tool_mode == 'WEIGHT_GPENCIL': + layout.popover_group(space_type='PROPERTIES', region_type='WINDOW', context=".greasepencil_weight", category="") + + def draw_mode_settings(self, context): + layout = self.layout + + # Active Tool + # ----------- + from .space_toolsystem_common import ToolSelectPanelHelper + tool = ToolSelectPanelHelper.tool_active_from_context(context) + tool_mode = context.mode if tool is None else tool.mode + + if tool_mode == 'SCULPT': + layout.popover_group(space_type='PROPERTIES', region_type='WINDOW', context=".sculpt_mode", category="") + elif tool_mode == 'PAINT_VERTEX': + layout.popover_group(space_type='PROPERTIES', region_type='WINDOW', context=".vertexpaint", category="") + elif tool_mode == 'PAINT_WEIGHT': + layout.popover_group(space_type='PROPERTIES', region_type='WINDOW', context=".weightpaint", category="") + elif tool_mode == 'PAINT_TEXTURE': + layout.popover_group(space_type='PROPERTIES', region_type='WINDOW', context=".imagepaint", category="") + elif tool_mode == 'EDIT_TEXT': + layout.popover_group(space_type='PROPERTIES', region_type='WINDOW', context=".text_edit", category="") + elif tool_mode == 'EDIT_ARMATURE': + layout.popover_group(space_type='PROPERTIES', region_type='WINDOW', context=".armature_edit", category="") + elif tool_mode == 'EDIT_METABALL': + layout.popover_group(space_type='PROPERTIES', region_type='WINDOW', context=".mball_edit", category="") + elif tool_mode == 'EDIT_LATTICE': + layout.popover_group(space_type='PROPERTIES', region_type='WINDOW', context=".lattice_edit", category="") + elif tool_mode == 'EDIT_CURVE': + layout.popover_group(space_type='PROPERTIES', region_type='WINDOW', context=".curve_edit", category="") + elif tool_mode == 'EDIT_MESH': + layout.popover_group(space_type='PROPERTIES', region_type='WINDOW', context=".mesh_edit", category="") + elif tool_mode == 'POSE': + layout.popover_group(space_type='PROPERTIES', region_type='WINDOW', context=".posemode", category="") + elif tool_mode == 'PARTICLE': + layout.popover_group(space_type='PROPERTIES', region_type='WINDOW', context=".particlemode", category="") + elif tool_mode == 'OBJECT': + layout.popover_group(space_type='PROPERTIES', region_type='WINDOW', context=".objectmode", category="") + elif tool_mode in {'PAINT_GPENCIL', 'EDIT_GPENCIL', 'SCULPT_GPENCIL', 'WEIGHT_GPENCIL'}: + # Grease pencil layer. + gpl = context.active_gpencil_layer + if gpl and gpl.info is not None: + text = gpl.info + maxw = 25 + if len(text) > maxw: + text = text[:maxw - 5] + '..' + text[-3:] + else: + text = "" - row.separator() + layout.label(text="Layer:") + sub = layout.row() + sub.ui_units_x = 8 + sub.popover( + panel="TOPBAR_PT_gpencil_layers", + text=text, + ) - sub = row.row() - sub.ui_units_x = 5.5 - sub.operator_menu_enum("object.mode_set", "mode", - text=bpy.app.translations.pgettext_iface(act_mode_item.name, act_mode_i18n_context), - icon=act_mode_item.icon) - del act_mode_item - layout.template_header_3D_mode() +class _draw_tool_settings_context_mode: + @staticmethod + def SCULPT(context, layout, tool): + if (tool is None) or (not tool.has_datablock): + return - # Contains buttons like Mode, Pivot, Layer, Mesh Select Mode... - if obj: - # Particle edit - if object_mode == 'PARTICLE_EDIT': - row = layout.row() - row.prop(tool_settings.particle_edit, "select_mode", text="", expand=True) + paint = context.tool_settings.sculpt + layout.template_ID_preview(paint, "brush", rows=3, cols=8, hide_buttons=True) - # Grease Pencil - if obj and obj.type == 'GPENCIL' and context.gpencil_data: - gpd = context.gpencil_data + brush = paint.brush + if brush is None: + return - if gpd.is_stroke_paint_mode: - row = layout.row() - sub = row.row(align=True) - sub.prop(tool_settings, "use_gpencil_draw_onback", text="", icon='MOD_OPACITY') - sub.separator(factor=0.4) - sub.prop(tool_settings, "use_gpencil_weight_data_add", text="", icon='WPAINT_HLT') - sub.separator(factor=0.4) - sub.prop(tool_settings, "use_gpencil_draw_additive", text="", icon='FREEZE') + from .properties_paint_common import ( + brush_basic_sculpt_settings, + ) + brush_basic_sculpt_settings(layout, context, brush, compact=True) - if gpd.use_stroke_edit_mode: - row = layout.row(align=True) - row.prop(tool_settings, "gpencil_selectmode", text="", expand=True) + @staticmethod + def PAINT_TEXTURE(context, layout, tool): + if (tool is None) or (not tool.has_datablock): + return - if gpd.use_stroke_edit_mode or gpd.is_stroke_sculpt_mode or gpd.is_stroke_weight_mode: - row = layout.row(align=True) + paint = context.tool_settings.image_paint + layout.template_ID_preview(paint, "brush", rows=3, cols=8, hide_buttons=True) - if gpd.is_stroke_sculpt_mode: - row.prop(tool_settings.gpencil_sculpt, "use_select_mask", text="") - row.separator() + brush = paint.brush + if brush is None: + return - row.prop(gpd, "use_multiedit", text="", icon='GP_MULTIFRAME_EDITING') + from .properties_paint_common import ( + UnifiedPaintPanel, + brush_basic_texpaint_settings, + ) + capabilities = brush.image_paint_capabilities + if capabilities.has_color: + UnifiedPaintPanel.prop_unified_color(layout, context, brush, "color", text="") + brush_basic_texpaint_settings(layout, context, brush, compact=True) - sub = row.row(align=True) - sub.active = gpd.use_multiedit - sub.popover( - panel="VIEW3D_PT_gpencil_multi_frame", - text="Multiframe", - ) + @staticmethod + def PAINT_VERTEX(context, layout, tool): + if (tool is None) or (not tool.has_datablock): + return - if gpd.use_stroke_edit_mode: - row = layout.row(align=True) - row.prop(tool_settings.gpencil_sculpt, "use_select_mask", text="") + paint = context.tool_settings.vertex_paint + layout.template_ID_preview(paint, "brush", rows=3, cols=8, hide_buttons=True) - row.popover( - panel="VIEW3D_PT_tools_grease_pencil_interpolate", - text="Interpolate", - ) + brush = paint.brush + if brush is None: + return - VIEW3D_MT_editor_menus.draw_collapsible(context, layout) + from .properties_paint_common import ( + UnifiedPaintPanel, + brush_basic_vpaint_settings, + ) + capabilities = brush.vertex_paint_capabilities + if capabilities.has_color: + UnifiedPaintPanel.prop_unified_color(layout, context, brush, "color", text="") + brush_basic_vpaint_settings(layout, context, brush, compact=True) - layout.separator_spacer() + @staticmethod + def PAINT_WEIGHT(context, layout, tool): + if (tool is None) or (not tool.has_datablock): + return + + paint = context.tool_settings.weight_paint + layout.template_ID_preview(paint, "brush", rows=3, cols=8, hide_buttons=True) + brush = paint.brush + if brush is None: + return + + from .properties_paint_common import brush_basic_wpaint_settings + brush_basic_wpaint_settings(layout, context, brush, compact=True) + + @staticmethod + def PAINT_GPENCIL(context, layout, tool): + if tool is None: + return + + # is_paint = True + # FIXME: tools must use their own UI drawing! + if tool.idname in {"builtin.line", "builtin.box", "builtin.circle", "builtin.arc", "builtin.curve"}: + # is_paint = False + pass + elif tool.idname == "Cutter": + row = layout.row(align=True) + row.prop(context.tool_settings.gpencil_sculpt, "intersection_threshold") + return + elif not tool.has_datablock: + return + + paint = context.tool_settings.gpencil_paint + brush = paint.brush + if brush is None: + return + + gp_settings = brush.gpencil_settings + + def draw_color_selector(): + ma = gp_settings.material + row = layout.row(align=True) + if not gp_settings.use_material_pin: + ma = context.object.active_material + icon_id = 0 + if ma: + icon_id = ma.id_data.preview.icon_id + txt_ma = ma.name + maxw = 25 + if len(txt_ma) > maxw: + txt_ma = txt_ma[:maxw - 5] + '..' + txt_ma[-3:] + else: + txt_ma = "" + + sub = row.row() + sub.ui_units_x = 8 + sub.popover( + panel="TOPBAR_PT_gpencil_materials", + text=txt_ma, + icon_value=icon_id, + ) + + row.prop(gp_settings, "use_material_pin", text="") + + row = layout.row(align=True) + tool_settings = context.scene.tool_settings + settings = tool_settings.gpencil_paint + row.template_ID_preview(settings, "brush", rows=3, cols=8, hide_buttons=True) + + if context.object and brush.gpencil_tool in {'FILL', 'DRAW'}: + draw_color_selector() + + from .properties_paint_common import ( + brush_basic_gpencil_paint_settings, + ) + brush_basic_gpencil_paint_settings(layout, context, brush, compact=True) + + # FIXME: tools must use their own UI drawing! + if tool.idname in {"builtin.arc", "builtin.curve", "builtin.line", "builtin.box", "builtin.circle"}: + settings = context.tool_settings.gpencil_sculpt + row = layout.row(align=True) + row.prop(settings, "use_thickness_curve", text="", icon='CURVE_DATA') + sub = row.row(align=True) + sub.active = settings.use_thickness_curve + sub.popover( + panel="TOPBAR_PT_gpencil_primitive", + text="Thickness Profile", + ) + + if brush.gpencil_tool == 'FILL': + settings = context.tool_settings.gpencil_sculpt + row = layout.row(align=True) + sub = row.row(align=True) + sub.popover( + panel="TOPBAR_PT_gpencil_fill", + text="Fill Options", + ) + + @staticmethod + def SCULPT_GPENCIL(context, layout, tool): + if (tool is None) or (not tool.has_datablock): + return + tool_settings = context.tool_settings + settings = tool_settings.gpencil_sculpt + brush = settings.brush + + from .properties_paint_common import ( + brush_basic_gpencil_sculpt_settings, + ) + brush_basic_gpencil_sculpt_settings(layout, context, brush, compact=True) + + @staticmethod + def WEIGHT_GPENCIL(context, layout, tool): + if (tool is None) or (not tool.has_datablock): + return + tool_settings = context.tool_settings + settings = tool_settings.gpencil_sculpt + brush = settings.brush + + from .properties_paint_common import ( + brush_basic_gpencil_weight_settings, + ) + brush_basic_gpencil_weight_settings(layout, context, brush, compact=True) + + @staticmethod + def PARTICLE(context, layout, tool): + if (tool is None) or (not tool.has_datablock): + return + + # See: 'VIEW3D_PT_tools_brush', basically a duplicate + settings = context.tool_settings.particle_edit + brush = settings.brush + tool = settings.tool + if tool != 'NONE': + layout.prop(brush, "size", slider=True) + if tool == 'ADD': + layout.prop(brush, "count") + + layout.prop(settings, "use_default_interpolate") + layout.prop(brush, "steps", slider=True) + layout.prop(settings, "default_key_count", slider=True) + else: + layout.prop(brush, "strength", slider=True) + + if tool == 'LENGTH': + layout.row().prop(brush, "length_mode", expand=True) + elif tool == 'PUFF': + layout.row().prop(brush, "puff_mode", expand=True) + layout.prop(brush, "use_puff_volume") + elif tool == 'COMB': + row = layout.row() + row.active = settings.is_editable + row.prop(settings, "use_emitter_deflect", text="Deflect Emitter") + sub = row.row(align=True) + sub.active = settings.use_emitter_deflect + sub.prop(settings, "emitter_distance", text="Distance") + + +class VIEW3D_HT_header(Header): + bl_space_type = 'VIEW_3D' + + @staticmethod + def draw_xform_template(layout, context): + obj = context.active_object + object_mode = 'OBJECT' if obj is None else obj.mode + has_pose_mode = ( + (object_mode == 'POSE') or + (object_mode == 'WEIGHT_PAINT' and context.pose_object is not None) + ) + + tool_settings = context.tool_settings # Mode & Transform Settings scene = context.scene @@ -200,29 +466,29 @@ class VIEW3D_HT_header(Header): ) # Proportional editing - gpd = context.gpencil_data - if object_mode in {'EDIT', 'PARTICLE_EDIT'}: - row = layout.row(align=True) - row.prop(tool_settings, "proportional_edit", icon_only=True) - sub = row.row(align=True) - sub.active = tool_settings.proportional_edit != 'DISABLED' - sub.prop(tool_settings, "proportional_edit_falloff", icon_only=True) - - elif object_mode == 'OBJECT': + if object_mode in {'EDIT', 'PARTICLE_EDIT', 'SCULPT_GPENCIL', 'EDIT_GPENCIL', 'OBJECT'}: row = layout.row(align=True) - row.prop(tool_settings, "use_proportional_edit_objects", icon_only=True) - sub = row.row(align=True) - sub.active = tool_settings.use_proportional_edit_objects - sub.prop(tool_settings, "proportional_edit_falloff", icon_only=True) + kw = {} + if object_mode == 'OBJECT': + attr = "use_proportional_edit_objects" + else: + attr = "use_proportional_edit" - elif gpd is not None and obj.type == 'GPENCIL': - if gpd.use_stroke_edit_mode or gpd.is_stroke_sculpt_mode: - row = layout.row(align=True) - row.prop(tool_settings, "proportional_edit", icon_only=True) + if tool_settings.use_proportional_connected: + kw["icon"] = 'PROP_CON' + elif tool_settings.use_proportional_projected: + kw["icon"] = 'PROP_PROJECTED' - sub = row.row(align=True) - sub.active = tool_settings.proportional_edit != 'DISABLED' - sub.prop(tool_settings, "proportional_edit_falloff", icon_only=True) + row.prop(tool_settings, attr, icon_only=True, **kw) + sub = row.row(align=True) + sub.active = getattr(tool_settings, attr) + sub.prop_with_popover( + tool_settings, + "proportional_edit_falloff", + text="", + icon_only=True, + panel="VIEW3D_PT_proportional_edit", + ) # grease pencil if object_mode == 'PAINT_GPENCIL': @@ -255,8 +521,102 @@ class VIEW3D_HT_header(Header): text="Guides", ) + def draw(self, context): + layout = self.layout + + tool_settings = context.tool_settings + view = context.space_data + shading = view.shading + # mode_string = context.mode + obj = context.active_object + show_region_tool_header = view.show_region_tool_header + + if not show_region_tool_header: + layout.row(align=True).template_header() + + row = layout.row(align=True) + object_mode = 'OBJECT' if obj is None else obj.mode + + # Note: This is actually deadly in case enum_items have to be dynamically generated + # (because internal RNA array iterator will free everything immediately...). + # XXX This is an RNA internal issue, not sure how to fix it. + # Note: Tried to add an accessor to get translated UI strings instead of manual call + # to pgettext_iface below, but this fails because translated enumitems + # are always dynamically allocated. + act_mode_item = bpy.types.Object.bl_rna.properties["mode"].enum_items[object_mode] + act_mode_i18n_context = bpy.types.Object.bl_rna.properties["mode"].translation_context + + sub = row.row(align=True) + sub.ui_units_x = 5.5 + sub.operator_menu_enum( + "object.mode_set", "mode", + text=bpy.app.translations.pgettext_iface(act_mode_item.name, act_mode_i18n_context), + icon=act_mode_item.icon, + ) + del act_mode_item + + layout.template_header_3D_mode() + + # Contains buttons like Mode, Pivot, Layer, Mesh Select Mode... + if obj: + # Particle edit + if object_mode == 'PARTICLE_EDIT': + row = layout.row() + row.prop(tool_settings.particle_edit, "select_mode", text="", expand=True) + + # Grease Pencil + if obj and obj.type == 'GPENCIL' and context.gpencil_data: + gpd = context.gpencil_data + + if gpd.is_stroke_paint_mode: + row = layout.row() + sub = row.row(align=True) + sub.prop(tool_settings, "use_gpencil_draw_onback", text="", icon='MOD_OPACITY') + sub.separator(factor=0.4) + sub.prop(tool_settings, "use_gpencil_weight_data_add", text="", icon='WPAINT_HLT') + sub.separator(factor=0.4) + sub.prop(tool_settings, "use_gpencil_draw_additive", text="", icon='FREEZE') + + if gpd.use_stroke_edit_mode: + row = layout.row(align=True) + row.prop(tool_settings, "gpencil_selectmode", text="", expand=True) + + if gpd.use_stroke_edit_mode or gpd.is_stroke_sculpt_mode or gpd.is_stroke_weight_mode: + row = layout.row(align=True) + + if gpd.is_stroke_sculpt_mode: + row.prop(tool_settings.gpencil_sculpt, "use_select_mask", text="") + row.separator() + + row.prop(gpd, "use_multiedit", text="", icon='GP_MULTIFRAME_EDITING') + + sub = row.row(align=True) + sub.active = gpd.use_multiedit + sub.popover( + panel="VIEW3D_PT_gpencil_multi_frame", + text="Multiframe", + ) + + if gpd.use_stroke_edit_mode: + row = layout.row(align=True) + row.prop(tool_settings.gpencil_sculpt, "use_select_mask", text="") + + row.popover( + panel="VIEW3D_PT_tools_grease_pencil_interpolate", + text="Interpolate", + ) + + overlay = view.overlay + + VIEW3D_MT_editor_menus.draw_collapsible(context, layout) + layout.separator_spacer() + if not show_region_tool_header: + VIEW3D_HT_header.draw_xform_template(layout, context) + + layout.separator_spacer() + # Viewport Settings layout.popover( panel="VIEW3D_PT_object_type_visibility", @@ -381,7 +741,7 @@ class ShowHideMenu: bl_label = "Show/Hide" _operator_name = "" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator("%s.reveal" % self._operator_name) @@ -496,7 +856,7 @@ class VIEW3D_MT_transform_armature(VIEW3D_MT_transform_base): class VIEW3D_MT_mirror(Menu): bl_label = "Mirror" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator("transform.mirror", text="Interactive Mirror") @@ -518,7 +878,7 @@ class VIEW3D_MT_mirror(Menu): class VIEW3D_MT_snap(Menu): bl_label = "Snap" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator("view3d.snap_selected_to_grid", text="Selection to Grid") @@ -537,7 +897,7 @@ class VIEW3D_MT_snap(Menu): class VIEW3D_MT_uv_map(Menu): bl_label = "UV Mapping" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator("uv.unwrap") @@ -580,8 +940,9 @@ class VIEW3D_MT_view(Menu): layout = self.layout view = context.space_data - layout.operator("view3d.toolshelf", icon='MENU_PANEL') - layout.operator("view3d.properties", icon='MENU_PANEL') + layout.prop(view, "show_region_toolbar") + layout.prop(view, "show_region_ui") + layout.prop(view, "show_region_hud") layout.separator() @@ -624,7 +985,7 @@ class VIEW3D_MT_view(Menu): class VIEW3D_MT_view_local(Menu): bl_label = "Local View" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator("view3d.localview", text="Toggle Local View") @@ -634,7 +995,7 @@ class VIEW3D_MT_view_local(Menu): class VIEW3D_MT_view_cameras(Menu): bl_label = "Cameras" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator("view3d.object_as_camera") @@ -644,7 +1005,7 @@ class VIEW3D_MT_view_cameras(Menu): class VIEW3D_MT_view_viewpoint(Menu): bl_label = "Viewpoint" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator("view3d.view_camera", text="Camera") @@ -668,7 +1029,7 @@ class VIEW3D_MT_view_viewpoint(Menu): class VIEW3D_MT_view_navigation(Menu): bl_label = "Navigation" - def draw(self, context): + def draw(self, _context): from math import pi layout = self.layout @@ -702,7 +1063,7 @@ class VIEW3D_MT_view_navigation(Menu): class VIEW3D_MT_view_align(Menu): bl_label = "Align View" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.menu("VIEW3D_MT_view_align_selected") @@ -726,7 +1087,7 @@ class VIEW3D_MT_view_align(Menu): class VIEW3D_MT_view_align_selected(Menu): bl_label = "Align View to Active" - def draw(self, context): + def draw(self, _context): layout = self.layout props = layout.operator("view3d.view_axis", text="Top") @@ -761,7 +1122,7 @@ class VIEW3D_MT_view_align_selected(Menu): class VIEW3D_MT_view_regions(Menu): bl_label = "View Regions" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator("view3d.clip_border", text="Clipping Region...") layout.operator("view3d.render_border", text="Render Region...") @@ -776,7 +1137,7 @@ class VIEW3D_MT_view_regions(Menu): class VIEW3D_MT_select_object_more_less(Menu): bl_label = "Select More/Less" - def draw(self, context): + def draw(self, _context): layout = self.layout layout = self.layout @@ -808,7 +1169,7 @@ class VIEW3D_MT_select_object_more_less(Menu): class VIEW3D_MT_select_object(Menu): bl_label = "Select" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator("object.select_all", text="All").action = 'SELECT' @@ -841,7 +1202,7 @@ class VIEW3D_MT_select_object(Menu): class VIEW3D_MT_select_pose_more_less(Menu): bl_label = "Select More/Less" - def draw(self, context): + def draw(self, _context): layout = self.layout layout = self.layout @@ -868,7 +1229,7 @@ class VIEW3D_MT_select_pose_more_less(Menu): class VIEW3D_MT_select_pose(Menu): bl_label = "Select" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator("pose.select_all", text="All").action = 'SELECT' @@ -902,7 +1263,7 @@ class VIEW3D_MT_select_pose(Menu): class VIEW3D_MT_select_particle(Menu): bl_label = "Select" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator("particle.select_all", text="All").action = 'SELECT' @@ -936,7 +1297,7 @@ class VIEW3D_MT_select_particle(Menu): class VIEW3D_MT_edit_mesh_select_similar(Menu): bl_label = "Select Similar" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator_enum("mesh.select_similar", "type") @@ -966,7 +1327,7 @@ class VIEW3D_MT_edit_mesh_select_by_trait(Menu): class VIEW3D_MT_edit_mesh_select_more_less(Menu): bl_label = "Select More/Less" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator("mesh.select_more", text="More") @@ -981,7 +1342,7 @@ class VIEW3D_MT_edit_mesh_select_more_less(Menu): class VIEW3D_MT_edit_mesh_select_linked(Menu): bl_label = "Select Linked" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator("mesh.select_linked", text="Linked") @@ -992,7 +1353,7 @@ class VIEW3D_MT_edit_mesh_select_linked(Menu): class VIEW3D_MT_edit_mesh_select_loops(Menu): bl_label = "Select Loops" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator("mesh.loop_multi_select", text="Edge Loops").ring = False @@ -1007,7 +1368,7 @@ class VIEW3D_MT_edit_mesh_select_loops(Menu): class VIEW3D_MT_select_edit_mesh(Menu): bl_label = "Select" - def draw(self, context): + def draw(self, _context): layout = self.layout # primitive @@ -1061,7 +1422,7 @@ class VIEW3D_MT_select_edit_mesh(Menu): class VIEW3D_MT_select_edit_curve(Menu): bl_label = "Select" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator("curve.select_all", text="All").action = 'SELECT' @@ -1096,7 +1457,7 @@ class VIEW3D_MT_select_edit_curve(Menu): class VIEW3D_MT_select_edit_surface(Menu): bl_label = "Select" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator("curve.select_all", text="All").action = 'SELECT' @@ -1128,7 +1489,7 @@ class VIEW3D_MT_select_edit_surface(Menu): class VIEW3D_MT_edit_text_context_menu(Menu): bl_label = "Text Context Menu" - def draw(self, context): + def draw(self, _context): layout = self.layout layout = self.layout @@ -1153,7 +1514,7 @@ class VIEW3D_MT_select_edit_text(Menu): # select menu for 3d-text doesn't make sense bl_label = "Edit" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator("font.text_cut", text="Cut") @@ -1174,7 +1535,7 @@ class VIEW3D_MT_select_edit_text(Menu): class VIEW3D_MT_select_edit_metaball(Menu): bl_label = "Select" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator("mball.select_all", text="All").action = 'SELECT' @@ -1198,7 +1559,7 @@ class VIEW3D_MT_select_edit_metaball(Menu): class VIEW3D_MT_edit_lattice_context_menu(Menu): bl_label = "Lattice Context Menu" - def draw(self, context): + def draw(self, _context): layout = self.layout layout = self.layout @@ -1215,7 +1576,7 @@ class VIEW3D_MT_edit_lattice_context_menu(Menu): class VIEW3D_MT_select_edit_lattice(Menu): bl_label = "Select" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator("lattice.select_all", text="All").action = 'SELECT' @@ -1245,7 +1606,7 @@ class VIEW3D_MT_select_edit_lattice(Menu): class VIEW3D_MT_select_edit_armature(Menu): bl_label = "Select" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator("armature.select_all", text="All").action = 'SELECT' @@ -1293,7 +1654,7 @@ class VIEW3D_MT_select_edit_armature(Menu): class VIEW3D_MT_select_gpencil(Menu): bl_label = "Select" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator("gpencil.select_all", text="All").action = 'SELECT' @@ -1325,7 +1686,7 @@ class VIEW3D_MT_select_gpencil(Menu): class VIEW3D_MT_select_paint_mask(Menu): bl_label = "Select" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator("paint.face_select_all", text="All").action = 'SELECT' @@ -1345,7 +1706,7 @@ class VIEW3D_MT_select_paint_mask(Menu): class VIEW3D_MT_select_paint_mask_vertex(Menu): bl_label = "Select" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator("paint.vert_select_all", text="All").action = 'SELECT' @@ -1400,7 +1761,7 @@ class VIEW3D_MT_mesh_add(Menu): bl_idname = "VIEW3D_MT_mesh_add" bl_label = "Mesh" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator_context = 'INVOKE_REGION_WIN' @@ -1424,7 +1785,7 @@ class VIEW3D_MT_curve_add(Menu): bl_idname = "VIEW3D_MT_curve_add" bl_label = "Curve" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator_context = 'INVOKE_REGION_WIN' @@ -1443,7 +1804,7 @@ class VIEW3D_MT_surface_add(Menu): bl_idname = "VIEW3D_MT_surface_add" bl_label = "Surface" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator_context = 'INVOKE_REGION_WIN' @@ -1460,7 +1821,7 @@ class VIEW3D_MT_surface_add(Menu): class VIEW3D_MT_edit_metaball_context_menu(Menu): bl_label = "Metaball Context Menu" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator_context = 'INVOKE_REGION_WIN' @@ -1485,7 +1846,7 @@ class VIEW3D_MT_metaball_add(Menu): bl_idname = "VIEW3D_MT_metaball_add" bl_label = "Metaball" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator_context = 'INVOKE_REGION_WIN' @@ -1512,7 +1873,7 @@ class TOPBAR_MT_edit_armature_add(Menu): bl_idname = "TOPBAR_MT_edit_armature_add" bl_label = "Armature" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator_context = 'EXEC_REGION_WIN' @@ -1523,7 +1884,7 @@ class VIEW3D_MT_armature_add(Menu): bl_idname = "VIEW3D_MT_armature_add" bl_label = "Armature" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator_context = 'EXEC_REGION_WIN' @@ -1534,7 +1895,7 @@ class VIEW3D_MT_light_add(Menu): bl_idname = "VIEW3D_MT_light_add" bl_label = "Light" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator_context = 'INVOKE_REGION_WIN' @@ -1545,7 +1906,7 @@ class VIEW3D_MT_lightprobe_add(Menu): bl_idname = "VIEW3D_MT_lightprobe_add" bl_label = "Light Probe" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator_context = 'INVOKE_REGION_WIN' @@ -1556,7 +1917,7 @@ class VIEW3D_MT_camera_add(Menu): bl_idname = "VIEW3D_MT_camera_add" bl_label = "Camera" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator_context = 'EXEC_REGION_WIN' layout.operator("object.camera_add", text="Camera", icon='OUTLINER_OB_CAMERA') @@ -1644,7 +2005,7 @@ class VIEW3D_MT_add(Menu): class VIEW3D_MT_image_add(Menu): bl_label = "Add Image" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator("object.load_reference_image", text="Reference", icon='IMAGE_REFERENCE') layout.operator("object.load_background_image", text="Background", icon='IMAGE_BACKGROUND') @@ -1653,7 +2014,7 @@ class VIEW3D_MT_image_add(Menu): class VIEW3D_MT_object_relations(Menu): bl_label = "Relations" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator("object.proxy_make", text="Make Proxy...") @@ -1741,7 +2102,7 @@ class VIEW3D_MT_object(Menu): class VIEW3D_MT_object_animation(Menu): bl_label = "Animation" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator("anim.keyframe_insert_menu", text="Insert Keyframe...") @@ -1757,7 +2118,7 @@ class VIEW3D_MT_object_animation(Menu): class VIEW3D_MT_object_rigid_body(Menu): bl_label = "Rigid Body" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator("rigidbody.objects_add", text="Add Active").type = 'ACTIVE' @@ -1783,7 +2144,7 @@ class VIEW3D_MT_object_rigid_body(Menu): class VIEW3D_MT_object_clear(Menu): bl_label = "Clear" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator("object.location_clear", text="Location").clear_delta = False @@ -2017,7 +2378,7 @@ class VIEW3D_MT_object_shading(Menu): # XXX, this menu is a place to store shading operator in object mode bl_label = "Shading" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator("object.shade_smooth", text="Smooth") layout.operator("object.shade_flat", text="Flat") @@ -2026,7 +2387,7 @@ class VIEW3D_MT_object_shading(Menu): class VIEW3D_MT_object_apply(Menu): bl_label = "Apply" - def draw(self, context): + def draw(self, _context): layout = self.layout props = layout.operator("object.transform_apply", text="Location", text_ctxt=i18n_contexts.default) @@ -2087,7 +2448,7 @@ class VIEW3D_MT_object_apply(Menu): class VIEW3D_MT_object_parent(Menu): bl_label = "Parent" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator_enum("object.parent_set", "type") @@ -2100,7 +2461,7 @@ class VIEW3D_MT_object_parent(Menu): class VIEW3D_MT_object_track(Menu): bl_label = "Track" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator_enum("object.track_set", "type") @@ -2113,7 +2474,7 @@ class VIEW3D_MT_object_track(Menu): class VIEW3D_MT_object_collection(Menu): bl_label = "Collection" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator("object.move_to_collection") @@ -2135,7 +2496,7 @@ class VIEW3D_MT_object_collection(Menu): class VIEW3D_MT_object_constraints(Menu): bl_label = "Constraints" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator("object.constraint_add_with_targets") @@ -2149,7 +2510,7 @@ class VIEW3D_MT_object_constraints(Menu): class VIEW3D_MT_object_quick_effects(Menu): bl_label = "Quick Effects" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator("object.quick_fur") @@ -2161,7 +2522,7 @@ class VIEW3D_MT_object_quick_effects(Menu): class VIEW3D_MT_object_showhide(Menu): bl_label = "Show/Hide" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator("object.hide_view_clear") @@ -2175,7 +2536,7 @@ class VIEW3D_MT_object_showhide(Menu): class VIEW3D_MT_make_single_user(Menu): bl_label = "Make Single User" - def draw(self, context): + def draw(self, _context): layout = self.layout props = layout.operator("object.make_single_user", text="Object") @@ -2202,7 +2563,7 @@ class VIEW3D_MT_make_single_user(Menu): class VIEW3D_MT_make_links(Menu): bl_label = "Make Links" - def draw(self, context): + def draw(self, _context): layout = self.layout operator_context_default = layout.operator_context @@ -2290,6 +2651,7 @@ class VIEW3D_MT_brush_paint_modes(Menu): brush = settings.brush layout.prop(brush, "use_paint_sculpt", text="Sculpt") + layout.prop(brush, "use_paint_uv_sculpt", text="UV Sculpt") layout.prop(brush, "use_paint_vertex", text="Vertex Paint") layout.prop(brush, "use_paint_weight", text="Weight Paint") layout.prop(brush, "use_paint_image", text="Texture Paint") @@ -2298,7 +2660,7 @@ class VIEW3D_MT_brush_paint_modes(Menu): class VIEW3D_MT_paint_vertex(Menu): bl_label = "Paint" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator("paint.vertex_color_set") @@ -2407,7 +2769,7 @@ class VIEW3D_MT_paint_weight(Menu): layout.operator("paint.weight_set") - def draw(self, context): + def draw(self, _context): self.draw_generic(self.layout, is_editmode=False) @@ -2447,7 +2809,7 @@ class VIEW3D_MT_sculpt(Menu): class VIEW3D_MT_hide_mask(Menu): bl_label = "Hide/Mask" - def draw(self, context): + def draw(self, _context): layout = self.layout props = layout.operator("paint.hide_show", text="Show All") @@ -2576,7 +2938,7 @@ class VIEW3D_MT_particle_showhide(ShowHideMenu, Menu): class VIEW3D_MT_pose(Menu): bl_label = "Pose" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.menu("VIEW3D_MT_transform_armature") @@ -2639,7 +3001,7 @@ class VIEW3D_MT_pose(Menu): class VIEW3D_MT_pose_transform(Menu): bl_label = "Clear Transform" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator("pose.transforms_clear", text="All") @@ -2658,7 +3020,7 @@ class VIEW3D_MT_pose_transform(Menu): class VIEW3D_MT_pose_slide(Menu): bl_label = "In-Betweens" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator("pose.push") @@ -2669,7 +3031,7 @@ class VIEW3D_MT_pose_slide(Menu): class VIEW3D_MT_pose_propagate(Menu): bl_label = "Propagate" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator("pose.propagate").mode = 'WHILE_HELD' @@ -2691,7 +3053,7 @@ class VIEW3D_MT_pose_propagate(Menu): class VIEW3D_MT_pose_library(Menu): bl_label = "Pose Library" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator("poselib.browse_interactive", text="Browse Poses...") @@ -2706,7 +3068,7 @@ class VIEW3D_MT_pose_library(Menu): class VIEW3D_MT_pose_motion(Menu): bl_label = "Motion Paths" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator("pose.paths_calculate", text="Calculate") @@ -2738,7 +3100,7 @@ class VIEW3D_MT_pose_group(Menu): class VIEW3D_MT_pose_ik(Menu): bl_label = "Inverse Kinematics" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator("pose.ik_add") @@ -2748,7 +3110,7 @@ class VIEW3D_MT_pose_ik(Menu): class VIEW3D_MT_pose_constraints(Menu): bl_label = "Constraints" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator("pose.constraint_add_with_targets", text="Add (With Targets)...") @@ -2763,7 +3125,7 @@ class VIEW3D_MT_pose_showhide(ShowHideMenu, Menu): class VIEW3D_MT_pose_apply(Menu): bl_label = "Apply" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator("pose.armature_apply") @@ -2778,7 +3140,7 @@ class VIEW3D_MT_pose_apply(Menu): class VIEW3D_MT_pose_context_menu(Menu): bl_label = "Pose Context Menu" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator_context = 'INVOKE_REGION_WIN' @@ -2874,7 +3236,7 @@ class VIEW3D_MT_bone_options_disable(Menu, BoneOptions): class VIEW3D_MT_edit_mesh(Menu): bl_label = "Mesh" - def draw(self, context): + def draw(self, _context): layout = self.layout with_bullet = bpy.app.build_options.bullet @@ -2967,7 +3329,7 @@ class VIEW3D_MT_edit_mesh_context_menu(Menu): col.separator() - col.operator("mesh.extrude_vertices_move", text="Extrude Vertices"), + col.operator("mesh.extrude_vertices_move", text="Extrude Vertices") col.operator("mesh.bevel", text="Bevel Vertices").vertex_only = True if selected_verts_len > 1: @@ -2996,8 +3358,7 @@ class VIEW3D_MT_edit_mesh_context_menu(Menu): # Removal Operators if selected_verts_len > 1: - col.operator("mesh.merge", text="Merge Vertices...") - col.operator("mesh.remove_doubles", text="Remove Double Vertices") + col.menu("VIEW3D_MT_edit_mesh_merge", text="Merge Vertices") col.operator("mesh.dissolve_verts") col.operator("mesh.delete", text="Delete Vertices").type = 'VERT' @@ -3013,7 +3374,7 @@ class VIEW3D_MT_edit_mesh_context_menu(Menu): col.separator() - col.operator("mesh.extrude_edges_move", text="Extrude Edges"), + col.operator("mesh.extrude_edges_move", text="Extrude Edges") col.operator("mesh.bevel", text="Bevel Edges").vertex_only = False if selected_edges_len >= 2: col.operator("mesh.bridge_edge_loops") @@ -3077,11 +3438,11 @@ class VIEW3D_MT_edit_mesh_context_menu(Menu): col.separator() - col.operator("view3d.edit_mesh_extrude_move_normal", text="Extrude Faces"), - col.operator("view3d.edit_mesh_extrude_move_shrink_fatten", text="Extrude Faces Along Normals"), - col.operator("mesh.extrude_faces_move", text="Extrude Individual Faces"), + col.operator("view3d.edit_mesh_extrude_move_normal", text="Extrude Faces") + col.operator("view3d.edit_mesh_extrude_move_shrink_fatten", text="Extrude Faces Along Normals") + col.operator("mesh.extrude_faces_move", text="Extrude Individual Faces") - col.operator("mesh.inset"), + col.operator("mesh.inset") col.operator("mesh.poke") if selected_faces_len >= 2: @@ -3114,7 +3475,7 @@ class VIEW3D_MT_edit_mesh_context_menu(Menu): class VIEW3D_MT_edit_mesh_select_mode(Menu): bl_label = "Mesh Select Mode" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator_context = 'INVOKE_REGION_WIN' @@ -3128,15 +3489,15 @@ class VIEW3D_MT_edit_mesh_extrude(Menu): _extrude_funcs = { 'VERT': lambda layout: - layout.operator("mesh.extrude_vertices_move", text="Extrude Vertices"), + layout.operator("mesh.extrude_vertices_move", text="Extrude Vertices"), 'EDGE': lambda layout: - layout.operator("mesh.extrude_edges_move", text="Extrude Edges"), + layout.operator("mesh.extrude_edges_move", text="Extrude Edges"), 'REGION': lambda layout: - layout.operator("view3d.edit_mesh_extrude_move_normal", text="Extrude Faces"), + layout.operator("view3d.edit_mesh_extrude_move_normal", text="Extrude Faces"), 'REGION_VERT_NORMAL': lambda layout: - layout.operator("view3d.edit_mesh_extrude_move_shrink_fatten", text="Extrude Faces Along Normals"), + layout.operator("view3d.edit_mesh_extrude_move_shrink_fatten", text="Extrude Faces Along Normals"), 'FACE': lambda layout: - layout.operator("mesh.extrude_faces_move", text="Extrude Individual Faces"), + layout.operator("mesh.extrude_faces_move", text="Extrude Individual Faces"), } @staticmethod @@ -3167,11 +3528,11 @@ class VIEW3D_MT_edit_mesh_extrude(Menu): class VIEW3D_MT_edit_mesh_vertices(Menu): bl_label = "Vertex" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator_context = 'INVOKE_REGION_WIN' - layout.operator("mesh.extrude_vertices_move", text="Extrude Vertices"), + layout.operator("mesh.extrude_vertices_move", text="Extrude Vertices") layout.operator("mesh.bevel", text="Bevel Vertices").vertex_only = True layout.separator() @@ -3200,8 +3561,7 @@ class VIEW3D_MT_edit_mesh_vertices(Menu): layout.separator() - layout.operator("mesh.merge", text="Merge Vertices") - layout.operator("mesh.remove_doubles", text="Remove Double Vertices") + layout.menu("VIEW3D_MT_edit_mesh_merge", text="Merge Vertices") layout.separator() @@ -3251,14 +3611,14 @@ class VIEW3D_MT_edit_mesh_edges_data(Menu): class VIEW3D_MT_edit_mesh_edges(Menu): bl_label = "Edge" - def draw(self, context): + def draw(self, _context): layout = self.layout with_freestyle = bpy.app.build_options.freestyle layout.operator_context = 'INVOKE_REGION_WIN' - layout.operator("mesh.extrude_edges_move", text="Extrude Edges"), + layout.operator("mesh.extrude_edges_move", text="Extrude Edges") layout.operator("mesh.bevel", text="Bevel Edges").vertex_only = False layout.operator("mesh.bridge_edge_loops") @@ -3308,7 +3668,7 @@ class VIEW3D_MT_edit_mesh_edges(Menu): class VIEW3D_MT_edit_mesh_faces_data(Menu): bl_label = "Face Data" - def draw(self, context): + def draw(self, _context): layout = self.layout with_freestyle = bpy.app.build_options.freestyle @@ -3334,14 +3694,14 @@ class VIEW3D_MT_edit_mesh_faces(Menu): bl_label = "Face" bl_idname = "VIEW3D_MT_edit_mesh_faces" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator_context = 'INVOKE_REGION_WIN' - layout.operator("view3d.edit_mesh_extrude_move_normal", text="Extrude Faces"), - layout.operator("view3d.edit_mesh_extrude_move_shrink_fatten", text="Extrude Faces Along Normals"), - layout.operator("mesh.extrude_faces_move", text="Extrude Individual Faces"), + layout.operator("view3d.edit_mesh_extrude_move_normal", text="Extrude Faces") + layout.operator("view3d.edit_mesh_extrude_move_shrink_fatten", text="Extrude Faces Along Normals") + layout.operator("mesh.extrude_faces_move", text="Extrude Individual Faces") layout.separator() @@ -3381,7 +3741,7 @@ class VIEW3D_MT_edit_mesh_faces(Menu): class VIEW3D_MT_edit_mesh_normals(Menu): bl_label = "Normals" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator("mesh.normals_make_consistent", text="Recalculate Outside").inside = False @@ -3389,38 +3749,34 @@ class VIEW3D_MT_edit_mesh_normals(Menu): layout.separator() - layout.operator("mesh.flip_normals") + layout.operator("mesh.flip_normals", text="Flip") layout.operator("mesh.set_normals_from_faces", text="Set From Faces") - - layout.operator("transform.rotate_normal", text="Rotate Normal") - layout.operator("mesh.point_normals", text="Point normals to target") - + layout.operator("transform.rotate_normal", text="Rotate") + layout.operator("mesh.point_normals", text="Point to Target") layout.operator("mesh.merge_normals", text="Merge") layout.operator("mesh.split_normals", text="Split") + layout.operator("mesh.average_normals", text="Average") - layout.operator("mesh.average_normals", text="Average Normals") - - layout.label(text="Normal Vector") - - layout.operator("mesh.normals_tools", text="Copy").mode = 'COPY' - layout.operator("mesh.normals_tools", text="Paste").mode = 'PASTE' + layout.separator() - layout.operator("mesh.normals_tools", text="Multiply").mode = 'MULTIPLY' - layout.operator("mesh.normals_tools", text="Add").mode = 'ADD' + layout.operator("mesh.normals_tools", text="Copy Vectors").mode = 'COPY' + layout.operator("mesh.normals_tools", text="Paste Vectors").mode = 'PASTE' + layout.operator("mesh.normals_tools", text="Add Vectors").mode = 'ADD' + layout.operator("mesh.normals_tools", text="Multiply Vectors").mode = 'MULTIPLY' - layout.operator("mesh.normals_tools", text="Reset").mode = 'RESET' + layout.operator("mesh.smoothen_normals", text="Smoothen Vectors") + layout.operator("mesh.normals_tools", text="Reset Vectors").mode = 'RESET' - layout.operator("mesh.smoothen_normals", text="Smoothen") + layout.separator() - layout.label(text="Face Strength") - layout.operator("mesh.mod_weighted_strength", text="Face Select", icon='FACESEL').set = False - layout.operator("mesh.mod_weighted_strength", text="Set Strength", icon='ADD').set = True + layout.operator("mesh.mod_weighted_strength", text="Get Face Strength").set = False + layout.operator("mesh.mod_weighted_strength", text="Set Face Strength").set = True class VIEW3D_MT_edit_mesh_shading(Menu): bl_label = "Shading" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator("mesh.faces_shade_smooth", text="Smooth Faces") @@ -3443,14 +3799,14 @@ class VIEW3D_MT_edit_mesh_shading(Menu): class VIEW3D_MT_edit_mesh_weights(Menu): bl_label = "Weights" - def draw(self, context): + def draw(self, _context): VIEW3D_MT_paint_weight.draw_generic(self.layout, is_editmode=True) class VIEW3D_MT_edit_mesh_clean(Menu): bl_label = "Clean Up" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator("mesh.delete_loose") @@ -3473,7 +3829,7 @@ class VIEW3D_MT_edit_mesh_clean(Menu): class VIEW3D_MT_edit_mesh_delete(Menu): bl_label = "Delete" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator_enum("mesh.delete", "type") @@ -3494,6 +3850,19 @@ class VIEW3D_MT_edit_mesh_delete(Menu): layout.operator("mesh.delete_edgeloop", text="Edge Loops") +class VIEW3D_MT_edit_mesh_merge(Menu): + bl_label = "Merge" + + def draw(self, _context): + layout = self.layout + + layout.operator_enum("mesh.merge", "type") + + layout.separator() + + layout.operator("mesh.remove_doubles", text="By Distance") + + class VIEW3D_MT_edit_mesh_showhide(ShowHideMenu, Menu): _operator_name = "mesh" @@ -3501,7 +3870,7 @@ class VIEW3D_MT_edit_mesh_showhide(ShowHideMenu, Menu): class VIEW3D_MT_edit_gpencil_delete(Menu): bl_label = "Delete" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator_enum("gpencil.delete", "type") @@ -3517,7 +3886,7 @@ class VIEW3D_MT_edit_gpencil_delete(Menu): # draw_curve is used by VIEW3D_MT_edit_curve and VIEW3D_MT_edit_surface -def draw_curve(self, context): +def draw_curve(self, _context): layout = self.layout layout.menu("VIEW3D_MT_transform") @@ -3595,7 +3964,7 @@ class VIEW3D_MT_edit_curve_ctrlpoints(Menu): class VIEW3D_MT_edit_curve_segments(Menu): bl_label = "Segments" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator("curve.subdivide") @@ -3605,7 +3974,7 @@ class VIEW3D_MT_edit_curve_segments(Menu): class VIEW3D_MT_edit_curve_clean(Menu): bl_label = "Clean Up" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator("curve.decimate") @@ -3614,7 +3983,7 @@ class VIEW3D_MT_edit_curve_clean(Menu): class VIEW3D_MT_edit_curve_context_menu(Menu): bl_label = "Curve Context Menu" - def draw(self, context): + def draw(self, _context): # TODO(campbell): match mesh vertex menu. layout = self.layout @@ -3669,7 +4038,7 @@ class VIEW3D_MT_edit_curve_context_menu(Menu): class VIEW3D_MT_edit_curve_delete(Menu): bl_label = "Delete" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator_enum("curve.delete", "type") @@ -3692,7 +4061,7 @@ class VIEW3D_MT_edit_surface(Menu): class VIEW3D_MT_edit_font(Menu): bl_label = "Font" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator("font.style_toggle", text="Toggle Bold").style = 'BOLD' @@ -3711,7 +4080,7 @@ class VIEW3D_MT_edit_font(Menu): class VIEW3D_MT_edit_text_chars(Menu): bl_label = "Special Characters" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator("font.text_insert", text="Copyright").text = "\u00A9" @@ -3751,7 +4120,7 @@ class VIEW3D_MT_edit_text_chars(Menu): class VIEW3D_MT_edit_meta(Menu): bl_label = "Metaball" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.menu("VIEW3D_MT_transform") @@ -3773,7 +4142,7 @@ class VIEW3D_MT_edit_meta(Menu): class VIEW3D_MT_edit_meta_showhide(Menu): bl_label = "Show/Hide" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator("mball.reveal_metaelems") @@ -3784,7 +4153,7 @@ class VIEW3D_MT_edit_meta_showhide(Menu): class VIEW3D_MT_edit_lattice(Menu): bl_label = "Lattice" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.separator() @@ -3906,7 +4275,7 @@ class VIEW3D_MT_armature_context_menu(Menu): class VIEW3D_MT_edit_armature_names(Menu): bl_label = "Names" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator_context = 'EXEC_REGION_WIN' @@ -3919,7 +4288,7 @@ class VIEW3D_MT_edit_armature_names(Menu): class VIEW3D_MT_edit_armature_parent(Menu): bl_label = "Parent" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator("armature.parent_set", text="Make") @@ -3929,7 +4298,7 @@ class VIEW3D_MT_edit_armature_parent(Menu): class VIEW3D_MT_edit_armature_roll(Menu): bl_label = "Bone Roll" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator_menu_enum("armature.calculate_roll", "type") @@ -3943,7 +4312,7 @@ class VIEW3D_MT_edit_armature_roll(Menu): class VIEW3D_MT_edit_armature_delete(Menu): bl_label = "Delete" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator_context = 'EXEC_AREA' @@ -3958,7 +4327,7 @@ class VIEW3D_MT_edit_armature_delete(Menu): class VIEW3D_MT_gpencil_autoweights(Menu): bl_label = "Generate Weights" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator("gpencil.generate_weights", text="With Empty Groups").mode = 'NAME' layout.operator("gpencil.generate_weights", text="With Automatic Weights").mode = 'AUTO' @@ -3967,7 +4336,7 @@ class VIEW3D_MT_gpencil_autoweights(Menu): class VIEW3D_MT_gpencil_simplify(Menu): bl_label = "Simplify" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator("gpencil.stroke_simplify_fixed", text="Fixed") layout.operator("gpencil.stroke_simplify", text="Adaptive") @@ -3976,7 +4345,7 @@ class VIEW3D_MT_gpencil_simplify(Menu): class VIEW3D_MT_paint_gpencil(Menu): bl_label = "Strokes" - def draw(self, context): + def draw(self, _context): layout = self.layout @@ -4027,7 +4396,7 @@ class VIEW3D_MT_gpencil_copy_layer(Menu): class VIEW3D_MT_edit_gpencil(Menu): bl_label = "Strokes" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.menu("VIEW3D_MT_edit_gpencil_transform") @@ -4085,7 +4454,7 @@ class VIEW3D_MT_edit_gpencil(Menu): class VIEW3D_MT_weight_gpencil(Menu): bl_label = "Weights" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator("gpencil.vertex_group_normalize_all", text="Normalize All") @@ -4107,7 +4476,7 @@ class VIEW3D_MT_gpencil_animation(Menu): ob = context.active_object return ob and ob.type == 'GPENCIL' and ob.mode != 'OBJECT' - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator("gpencil.blank_frame_add") @@ -4121,7 +4490,7 @@ class VIEW3D_MT_gpencil_animation(Menu): class VIEW3D_MT_edit_gpencil_transform(Menu): bl_label = "Transform" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator("transform.translate") @@ -4143,7 +4512,7 @@ class VIEW3D_MT_edit_gpencil_transform(Menu): class VIEW3D_MT_edit_gpencil_interpolate(Menu): bl_label = "Interpolate" - def draw(self, context): + def draw(self, _context): layout = self.layout layout.operator("gpencil.interpolate", text="Interpolate") @@ -4153,7 +4522,7 @@ class VIEW3D_MT_edit_gpencil_interpolate(Menu): class VIEW3D_MT_object_mode_pie(Menu): bl_label = "Mode" - def draw(self, context): + def draw(self, _context): layout = self.layout pie = layout.menu_pie() @@ -4164,7 +4533,7 @@ class VIEW3D_MT_view_pie(Menu): bl_label = "View" bl_idname = "VIEW3D_MT_view_pie" - def draw(self, context): + def draw(self, _context): layout = self.layout pie = layout.menu_pie() @@ -4255,7 +4624,7 @@ class VIEW3D_MT_orientations_pie(Menu): class VIEW3D_MT_snap_pie(Menu): bl_label = "Snap" - def draw(self, context): + def draw(self, _context): layout = self.layout pie = layout.menu_pie() @@ -4283,6 +4652,26 @@ class VIEW3D_MT_proportional_editing_falloff_pie(Menu): # ********** Panel ********** +class VIEW3D_PT_active_tool(Panel): + bl_space_type = 'VIEW_3D' + bl_region_type = 'UI' + bl_label = "Active Tool" + bl_category = "Tool" + # bl_context = ".active_tool" # dot on purpose (access from tool settings) + + def draw(self, context): + layout = self.layout + + # Panel display of topbar tool settings. + # currently displays in tool settings, keep here since the same functionality is used for the topbar. + + layout.use_property_split = True + layout.use_property_decorate = False + + from .space_toolsystem_common import ToolSelectPanelHelper + ToolSelectPanelHelper.draw_active_tool_header(context, layout, show_tool_name=True) + + class VIEW3D_PT_view3d_properties(Panel): bl_space_type = 'VIEW_3D' bl_region_type = 'UI' @@ -4385,7 +4774,8 @@ class VIEW3D_PT_collections(Panel): bl_space_type = 'VIEW_3D' bl_region_type = 'UI' bl_category = "View" - bl_label = "Collections Visibility" + bl_label = "Collections" + bl_options = {'DEFAULT_CLOSED'} def _draw_collection(self, layout, view_layer, collection, index): need_separator = index @@ -4435,9 +4825,6 @@ class VIEW3D_PT_collections(Panel): layout = self.layout layout.use_property_split = False - layout.label(text="Collections Visibility") - layout.column() - view_layer = context.view_layer # We pass index 0 here beause the index is increased # so the first real index is 1 @@ -4515,7 +4902,7 @@ class VIEW3D_PT_shading(Panel): else: return context.scene.display.shading - def draw(self, context): + def draw(self, _context): layout = self.layout layout.label(text="Viewport Shading") @@ -4617,7 +5004,7 @@ class VIEW3D_PT_shading_color(Panel): layout = self.layout shading = VIEW3D_PT_shading.get_shading(context) - layout.row().prop(shading, "color_type", expand=True) + layout.grid_flow(columns=3, align=True).prop(shading, "color_type", expand=True) if shading.color_type == 'SINGLE': layout.row().prop(shading, "single_color", text="") @@ -4656,7 +5043,7 @@ class VIEW3D_PT_shading_options(Panel): if shading.type != 'WIREFRAME': col.prop(shading, "show_backface_culling") - row = col.row() + row = col.row(align=True) if shading.type == 'WIREFRAME': row.prop(shading, "show_xray_wireframe", text="") @@ -4671,7 +5058,7 @@ class VIEW3D_PT_shading_options(Panel): #X-ray mode is off when alpha is 1.0 xray_active = shading.show_xray and shading.xray_alpha != 1 - row = col.row() + row = col.row(align=True) row.prop(shading, "show_shadows", text="") row.active = not xray_active sub = row.row(align=True) @@ -4730,10 +5117,6 @@ class VIEW3D_PT_shading_options_shadow(Panel): bl_space_type = 'VIEW_3D' bl_region_type = 'HEADER' - @classmethod - def poll(cls, context): - return True - def draw(self, context): layout = self.layout layout.use_property_split = True @@ -4750,10 +5133,6 @@ class VIEW3D_PT_shading_options_ssao(Panel): bl_space_type = 'VIEW_3D' bl_region_type = 'HEADER' - @classmethod - def poll(cls, context): - return True - def draw(self, context): layout = self.layout layout.use_property_split = True @@ -4775,7 +5154,6 @@ class VIEW3D_PT_gizmo_display(Panel): scene = context.scene view = context.space_data - overlay = view.overlay col = layout.column() col.label(text="Viewport Gizmos") @@ -4786,24 +5164,29 @@ class VIEW3D_PT_gizmo_display(Panel): colsub.prop(view, "show_gizmo_tool", text="Active Tools") colsub.prop(view, "show_gizmo_context", text="Active Object") - colsub = col.column() - colsub.active = view.show_gizmo_context - colsub.label(text="Object Gizmos") - colsub.prop(scene.transform_orientation_slots[1], "type", text="") - colsub.prop(view, "show_gizmo_object_translate", text="Move") - colsub.prop(view, "show_gizmo_object_rotate", text="Rotate") - colsub.prop(view, "show_gizmo_object_scale", text="Scale") + layout.separator() + + col = layout.column() + col.active = view.show_gizmo_context + col.label(text="Object Gizmos") + col.prop(scene.transform_orientation_slots[1], "type", text="") + col.prop(view, "show_gizmo_object_translate", text="Move") + col.prop(view, "show_gizmo_object_rotate", text="Rotate") + col.prop(view, "show_gizmo_object_scale", text="Scale") + + layout.separator() # Match order of object type visibility - colsub.label(text="Empty") - colsub.prop(view, "show_gizmo_empty_image", text="Image") - colsub.prop(view, "show_gizmo_empty_force_field", text="Force Field") - colsub.label(text="Light") - colsub.prop(view, "show_gizmo_light_size", text="Size") - colsub.prop(view, "show_gizmo_light_look_at", text="Look At") - colsub.label(text="Camera") - colsub.prop(view, "show_gizmo_camera_lens", text="Lens") - colsub.prop(view, "show_gizmo_camera_dof_distance", text="Focus Distance") + col = layout.column() + col.label(text="Empty") + col.prop(view, "show_gizmo_empty_image", text="Image") + col.prop(view, "show_gizmo_empty_force_field", text="Force Field") + col.label(text="Light") + col.prop(view, "show_gizmo_light_size", text="Size") + col.prop(view, "show_gizmo_light_look_at", text="Look At") + col.label(text="Camera") + col.prop(view, "show_gizmo_camera_lens", text="Lens") + col.prop(view, "show_gizmo_camera_dof_distance", text="Focus Distance") class VIEW3D_PT_overlay(Panel): @@ -4812,7 +5195,7 @@ class VIEW3D_PT_overlay(Panel): bl_label = "Overlays" bl_ui_units_x = 13 - def draw(self, context): + def draw(self, _context): layout = self.layout layout.label(text="Viewport Overlays") @@ -4836,15 +5219,19 @@ class VIEW3D_PT_overlay_guides(Panel): split = col.split() sub = split.column() - sub.prop(overlay, "show_floor", text="Grid") - if overlay.show_floor: - sub = col.column(align=True) - sub.active = bool(overlay.show_floor or view.region_quadviews or not view.region_3d.is_perspective) - subsub = sub.row(align=True) - subsub.active = overlay.show_floor - subsub.prop(overlay, "grid_scale", text="Scale") - subsub.prop(overlay, "grid_subdivisions", text="Subdivisions") + row = sub.row() + row_el = row.column() + row_el.prop(overlay, "show_ortho_grid", text="Grid") + grid_active = view.region_quadviews or (view.region_3d.is_orthographic_side_view and not view.region_3d.is_perspective) + row_el.active = grid_active + row.prop(overlay, "show_floor", text="Floor") + + if overlay.show_floor or overlay.show_ortho_grid: + sub = col.row(align=True) + sub.active = (overlay.show_floor and not view.region_3d.is_orthographic_side_view) or (overlay.show_ortho_grid and grid_active) + sub.prop(overlay, "grid_scale", text="Scale") + sub.prop(overlay, "grid_subdivisions", text="Subdivisions") sub = split.column() row = sub.row() @@ -4914,7 +5301,7 @@ class VIEW3D_PT_overlay_geometry(Panel): col = layout.column() col.active = display_all - row = col.row() + row = col.row(align=True) if not is_wireframes: row.prop(overlay, "show_wireframes", text="") sub = row.row() @@ -5221,8 +5608,16 @@ class VIEW3D_PT_overlay_sculpt(Panel): tool_settings = context.tool_settings sculpt = tool_settings.sculpt + view = context.space_data + overlay = view.overlay + layout.prop(sculpt, "show_diffuse_color") - layout.prop(sculpt, "show_mask") + + row = layout.row(align=True) + row.prop(sculpt, "show_mask", text="") + sub = row.row() + sub.active = sculpt.show_mask + sub.prop(overlay, "sculpt_mode_mask_opacity", text="Mask") class VIEW3D_PT_overlay_pose(Panel): @@ -5371,6 +5766,27 @@ class VIEW3D_PT_snapping(Panel): row.prop(tool_settings, "use_snap_scale", text="Scale", toggle=True) +class VIEW3D_PT_proportional_edit(Panel): + bl_space_type = 'VIEW_3D' + bl_region_type = 'HEADER' + bl_label = "Proportional Editing" + bl_ui_units_x = 8 + + def draw(self, context): + layout = self.layout + tool_settings = context.tool_settings + col = layout.column() + + if context.mode != 'OBJECT': + col.prop(tool_settings, "use_proportional_connected") + sub = col.column() + sub.active = not tool_settings.use_proportional_connected + sub.prop(tool_settings, "use_proportional_projected") + col.separator() + + col.prop(tool_settings, "proportional_edit_falloff", expand=True) + + class VIEW3D_PT_transform_orientations(Panel): bl_space_type = 'VIEW_3D' bl_region_type = 'HEADER' @@ -5628,10 +6044,11 @@ class VIEW3D_PT_view3d_stereo(Panel): class VIEW3D_PT_context_properties(Panel): bl_space_type = 'VIEW_3D' bl_region_type = 'UI' - bl_category = "View" + bl_category = "Item" bl_label = "Properties" bl_options = {'DEFAULT_CLOSED'} + @staticmethod def _active_context_member(context): obj = context.object if obj: @@ -5904,6 +6321,7 @@ class TOPBAR_PT_gpencil_materials(GreasePencilMaterialsPanel, Panel): classes = ( VIEW3D_HT_header, + VIEW3D_HT_tool_header, VIEW3D_MT_editor_menus, VIEW3D_MT_transform, VIEW3D_MT_transform_base, @@ -6012,6 +6430,7 @@ classes = ( VIEW3D_MT_edit_mesh_weights, VIEW3D_MT_edit_mesh_clean, VIEW3D_MT_edit_mesh_delete, + VIEW3D_MT_edit_mesh_merge, VIEW3D_MT_edit_mesh_showhide, VIEW3D_MT_paint_gpencil, VIEW3D_MT_assign_material, @@ -6052,6 +6471,7 @@ classes = ( VIEW3D_MT_snap_pie, VIEW3D_MT_orientations_pie, VIEW3D_MT_proportional_editing_falloff_pie, + VIEW3D_PT_active_tool, VIEW3D_PT_view3d_properties, VIEW3D_PT_view3d_lock, VIEW3D_PT_view3d_cursor, @@ -6086,6 +6506,7 @@ classes = ( VIEW3D_PT_overlay_sculpt, VIEW3D_PT_pivot_point, VIEW3D_PT_snapping, + VIEW3D_PT_proportional_edit, VIEW3D_PT_gpencil_origin, VIEW3D_PT_gpencil_lock, VIEW3D_PT_gpencil_guide, diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py b/release/scripts/startup/bl_ui/space_view3d_toolbar.py index 7c1fa0f9663..81804f6a399 100644 --- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py +++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py @@ -17,7 +17,6 @@ # ##### END GPL LICENSE BLOCK ##### # <pep8 compliant> -import bpy from bpy.types import Menu, Panel, UIList from .properties_grease_pencil_common import ( GreasePencilStrokeEditPanel, @@ -45,15 +44,6 @@ class View3DPanel: # **************** standard tool clusters ****************** -# Keyframing tools -def draw_keyframing_tools(context, layout): - col = layout.column(align=True) - col.label(text="Keyframes:") - row = col.row(align=True) - row.operator("anim.keyframe_insert_menu", text="Insert") - row.operator("anim.keyframe_delete_v3d", text="Remove") - - # Used by vertex & weight paint def draw_vpaint_symmetry(layout, vpaint): @@ -398,8 +388,8 @@ class VIEW3D_PT_tools_brush_color(Panel, View3DPaintPanel): bl_label = "Color Picker" @classmethod - def poll(self, context): - settings = self.paint_settings(context) + def poll(cls, context): + settings = cls.paint_settings(context) brush = settings.brush if context.image_paint_object: capabilities = brush.image_paint_capabilities @@ -414,7 +404,7 @@ class VIEW3D_PT_tools_brush_color(Panel, View3DPaintPanel): settings = self.paint_settings(context) brush = settings.brush - layout.active = brush.use_gradient == False + layout.active = not brush.use_gradient brush_texpaint_common_color(self, context, layout, brush, settings, True) @@ -426,8 +416,8 @@ class VIEW3D_PT_tools_brush_swatches(Panel, View3DPaintPanel): bl_options = {'DEFAULT_CLOSED'} @classmethod - def poll(self, context): - settings = self.paint_settings(context) + def poll(cls, context): + settings = cls.paint_settings(context) brush = settings.brush if context.image_paint_object: capabilities = brush.image_paint_capabilities @@ -453,8 +443,8 @@ class VIEW3D_PT_tools_brush_gradient(Panel, View3DPaintPanel): bl_options = {'DEFAULT_CLOSED'} @classmethod - def poll(self, context): - settings = self.paint_settings(context) + def poll(cls, context): + settings = cls.paint_settings(context) brush = settings.brush capabilities = brush.image_paint_capabilities @@ -484,8 +474,8 @@ class VIEW3D_PT_tools_brush_clone(Panel, View3DPaintPanel): bl_options = {'DEFAULT_CLOSED'} @classmethod - def poll(self, context): - settings = self.paint_settings(context) + def poll(cls, context): + settings = cls.paint_settings(context) brush = settings.brush return brush.image_tool == 'CLONE' @@ -559,7 +549,7 @@ class VIEW3D_PT_tools_brush_options(Panel, View3DPaintPanel): class TEXTURE_UL_texpaintslots(UIList): - def draw_item(self, context, layout, data, item, icon, active_data, active_propname, index): + def draw_item(self, _context, layout, _data, item, icon, _active_data, _active_propname, _index): # mat = data if self.layout_type in {'DEFAULT', 'COMPACT'}: @@ -1707,7 +1697,7 @@ class VIEW3D_PT_tools_grease_pencil_brush_option(View3DPanel, Panel): brush = context.tool_settings.gpencil_paint.brush return brush is not None and brush.gpencil_tool not in {'ERASE', 'FILL'} - def draw_header_preset(self, context): + def draw_header_preset(self, _context): VIEW3D_PT_gpencil_brush_presets.draw_panel_header(self.layout) def draw(self, context): @@ -1732,13 +1722,14 @@ class VIEW3D_PT_tools_grease_pencil_brush_option(View3DPanel, Panel): ob = context.object if ob: ma = ob.active_material - - if brush.gpencil_settings.material: + elif brush.gpencil_settings.material: ma = brush.gpencil_settings.material + else: + ma = None col.separator() subcol = col.column(align=True) - if ma and ma.grease_pencil.mode != 'DOTS': + if ma and ma.grease_pencil.mode == 'LINE': subcol.enabled = False subcol.prop(gp_settings, "gradient_factor", slider=True) subcol.prop(gp_settings, "gradient_shape") diff --git a/release/scripts/startup/nodeitems_builtins.py b/release/scripts/startup/nodeitems_builtins.py index 60772062dcf..9f0a7f0e7b7 100644 --- a/release/scripts/startup/nodeitems_builtins.py +++ b/release/scripts/startup/nodeitems_builtins.py @@ -40,19 +40,22 @@ class SortedNodeCategory(NodeCategory): class CompositorNodeCategory(SortedNodeCategory): @classmethod def poll(cls, context): - return (context.space_data.tree_type == 'CompositorNodeTree') + return (context.space_data.type == 'NODE_EDITOR' and + context.space_data.tree_type == 'CompositorNodeTree') class ShaderNodeCategory(SortedNodeCategory): @classmethod def poll(cls, context): - return (context.space_data.tree_type == 'ShaderNodeTree') + return (context.space_data.type == 'NODE_EDITOR' and + context.space_data.tree_type == 'ShaderNodeTree') class TextureNodeCategory(SortedNodeCategory): @classmethod def poll(cls, context): - return context.space_data.tree_type == 'TextureNodeTree' + return (context.space_data.type == 'NODE_EDITOR' and + context.space_data.tree_type == 'TextureNodeTree') # menu entry for node group tools |