diff options
author | Sebastián Barschkis <sebbas@sebbas.org> | 2019-12-16 17:05:04 +0300 |
---|---|---|
committer | Sebastián Barschkis <sebbas@sebbas.org> | 2019-12-16 17:05:04 +0300 |
commit | ed32db06c1244d8428fd22ce418f19ac0a81e893 (patch) | |
tree | c99252b8068da22c30d4a0166b9c293b43d7dab6 | |
parent | 451400f6e6b2911be7059e6d6bf53cc312a2a3c3 (diff) | |
parent | 8d16dc029e6c52b16666b4edfafa66794d64b1a4 (diff) |
Merge branch 'master' into fluid-mantaflowfluid-mantaflow
49 files changed, 497 insertions, 313 deletions
diff --git a/build_files/cmake/platform/platform_win32_bundle_crt.cmake b/build_files/cmake/platform/platform_win32_bundle_crt.cmake index e84a139fac9..abadaa112a2 100644 --- a/build_files/cmake/platform/platform_win32_bundle_crt.cmake +++ b/build_files/cmake/platform/platform_win32_bundle_crt.cmake @@ -33,7 +33,3 @@ if(WITH_WINDOWS_BUNDLE_CRT) set(BUNDLECRT "<dependency><dependentAssembly><assemblyIdentity type=\"win32\" name=\"blender.crt\" version=\"1.0.0.0\" /></dependentAssembly></dependency>") endif() configure_file(${CMAKE_SOURCE_DIR}/release/windows/manifest/blender.exe.manifest.in ${CMAKE_CURRENT_BINARY_DIR}/blender.exe.manifest @ONLY) - - - - diff --git a/extern/quadriflow/3rd/lemon-1.3.1/CMakeLists.txt b/extern/quadriflow/3rd/lemon-1.3.1/CMakeLists.txt index 7aa6d430906..b20b163a16a 100644 --- a/extern/quadriflow/3rd/lemon-1.3.1/CMakeLists.txt +++ b/extern/quadriflow/3rd/lemon-1.3.1/CMakeLists.txt @@ -67,7 +67,7 @@ SET(LEMON_ENABLE_ILOG YES CACHE STRING "Enable ILOG (CPLEX) solver backend.") SET(LEMON_ENABLE_COIN YES CACHE STRING "Enable COIN solver backend.") SET(LEMON_ENABLE_SOPLEX YES CACHE STRING "Enable SoPlex solver backend.") -IF(LEMON_ENABLE_GLPK) +IF(LEMON_ENABLE_GLPK) FIND_PACKAGE(GLPK 4.33) ENDIF(LEMON_ENABLE_GLPK) IF(LEMON_ENABLE_ILOG) diff --git a/extern/quadriflow/3rd/lemon-1.3.1/cmake/FindILOG.cmake b/extern/quadriflow/3rd/lemon-1.3.1/cmake/FindILOG.cmake index a09fc9a2753..584df4f6994 100644 --- a/extern/quadriflow/3rd/lemon-1.3.1/cmake/FindILOG.cmake +++ b/extern/quadriflow/3rd/lemon-1.3.1/cmake/FindILOG.cmake @@ -4,7 +4,7 @@ FIND_PATH(ILOG_ROOT_DIR PATHS /opt/ibm/ILOG /usr/local/ibm/ILOG /usr/local/ILOG /usr/local/ilog PATHS "$ENV{HOME}/ILOG" "$ENV{HOME}/.local/ILOG" PATHS "$ENV{HOME}/ibm/ILOG" "$ENV{HOME}/.local/ibm/ILOG" - PATHS "C:/Program Files/IBM/ILOG" + PATHS "C:/Program Files/IBM/ILOG" PATH_SUFFIXES "CPLEX_Studio126" "CPLEX_Studio125" "CPLEX_Studio124" "CPLEX_Studio123" "CPLEX_Studio122" NO_DEFAULT_PATH diff --git a/extern/quadriflow/3rd/lemon-1.3.1/contrib/CMakeLists.txt b/extern/quadriflow/3rd/lemon-1.3.1/contrib/CMakeLists.txt index b6c11e2aad4..fd393bcc420 100644 --- a/extern/quadriflow/3rd/lemon-1.3.1/contrib/CMakeLists.txt +++ b/extern/quadriflow/3rd/lemon-1.3.1/contrib/CMakeLists.txt @@ -16,4 +16,3 @@ LINK_DIRECTORIES( # ADD_EXECUTABLE(myprog myprog-main.cc) # TARGET_LINK_LIBRARIES(myprog lemon) - diff --git a/extern/quadriflow/3rd/lemon-1.3.1/lemon/CMakeLists.txt b/extern/quadriflow/3rd/lemon-1.3.1/lemon/CMakeLists.txt index 4e6567e49c7..f3501ca865b 100644 --- a/extern/quadriflow/3rd/lemon-1.3.1/lemon/CMakeLists.txt +++ b/extern/quadriflow/3rd/lemon-1.3.1/lemon/CMakeLists.txt @@ -88,4 +88,3 @@ INSTALL( FILES ${CMAKE_CURRENT_BINARY_DIR}/lemon.pc DESTINATION lib/pkgconfig ) - diff --git a/intern/cycles/blender/blender_shader.cpp b/intern/cycles/blender/blender_shader.cpp index 6bbc73f72ec..215953d1f29 100644 --- a/intern/cycles/blender/blender_shader.cpp +++ b/intern/cycles/blender/blender_shader.cpp @@ -655,7 +655,8 @@ static ShaderNode *add_node(Scene *scene, image->builtin_data = b_image.ptr.data; } else { - image->filename = image_user_file_path(b_image_user, b_image, b_scene.frame_current()); + image->filename = image_user_file_path( + b_image_user, b_image, b_scene.frame_current(), &image->is_tiled); image->builtin_data = NULL; } @@ -709,7 +710,7 @@ static ShaderNode *add_node(Scene *scene, env->builtin_data = b_image.ptr.data; } else { - env->filename = image_user_file_path(b_image_user, b_image, b_scene.frame_current()); + env->filename = image_user_file_path(b_image_user, b_image, b_scene.frame_current(), NULL); env->builtin_data = NULL; } diff --git a/intern/cycles/blender/blender_util.h b/intern/cycles/blender/blender_util.h index bc5a8d24040..2c3e279a8d8 100644 --- a/intern/cycles/blender/blender_util.h +++ b/intern/cycles/blender/blender_util.h @@ -231,16 +231,24 @@ static inline int render_resolution_y(BL::RenderSettings &b_render) return b_render.resolution_y() * b_render.resolution_percentage() / 100; } -static inline string image_user_file_path(BL::ImageUser &iuser, BL::Image &ima, int cfra) +static inline string image_user_file_path(BL::ImageUser &iuser, + BL::Image &ima, + int cfra, + bool *is_tiled) { + if (is_tiled != NULL) { + *is_tiled = false; + } + char filepath[1024]; iuser.tile(0); BKE_image_user_frame_calc(NULL, iuser.ptr.data, cfra); BKE_image_user_file_path(iuser.ptr.data, ima.ptr.data, filepath); - if (ima.source() == BL::Image::source_TILED) { + if (ima.source() == BL::Image::source_TILED && is_tiled != NULL) { char *udim_id = strstr(filepath, "1001"); if (udim_id != NULL) { memcpy(udim_id, "%04d", 4); + *is_tiled = true; } } return string(filepath); diff --git a/intern/cycles/render/nodes.cpp b/intern/cycles/render/nodes.cpp index b8847f92153..5af22e0c2c3 100644 --- a/intern/cycles/render/nodes.cpp +++ b/intern/cycles/render/nodes.cpp @@ -235,6 +235,8 @@ NODE_DEFINE(ImageTextureNode) SOCKET_STRING(filename, "Filename", ustring()); SOCKET_STRING(colorspace, "Colorspace", u_colorspace_auto); + SOCKET_BOOLEAN(is_tiled, "Is Tiled", false); + static NodeEnum alpha_type_enum; alpha_type_enum.insert("auto", IMAGE_ALPHA_AUTO); alpha_type_enum.insert("unassociated", IMAGE_ALPHA_UNASSOCIATED); @@ -291,6 +293,14 @@ ShaderNode *ImageTextureNode::clone() const void ImageTextureNode::cull_tiles(Scene *scene, ShaderGraph *graph) { + /* Box projection computes its own UVs that always lie in the + * 1001 tile, so there's no point in loading any others. */ + if (projection == NODE_IMAGE_PROJ_BOX) { + tiles.clear(); + tiles.push_back(1001); + return; + } + if (!scene->params.background) { /* During interactive renders, all tiles are loaded. * While we could support updating this when UVs change, that could lead @@ -366,15 +376,12 @@ void ImageTextureNode::compile(SVMCompiler &compiler) image_manager = compiler.scene->image_manager; if (slots.empty()) { cull_tiles(compiler.scene, compiler.current_graph); - } - if (slots.size() < tiles.size()) { - slots.clear(); slots.reserve(tiles.size()); bool have_metadata = false; foreach (int tile, tiles) { string tile_name = filename.string(); - if (tiles.size() > 1) { + if (is_tiled) { tile_name = string_printf(tile_name.c_str(), tile); } @@ -409,15 +416,6 @@ void ImageTextureNode::compile(SVMCompiler &compiler) } if (has_image) { - /* If there only is one image (a very common case), we encode it as a negative value. */ - int num_nodes; - if (slots.size() == 1) { - num_nodes = -slots[0]; - } - else { - num_nodes = divide_up(slots.size(), 2); - } - int vector_offset = tex_mapping.compile_begin(compiler, vector_in); uint flags = 0; @@ -435,6 +433,15 @@ void ImageTextureNode::compile(SVMCompiler &compiler) } if (projection != NODE_IMAGE_PROJ_BOX) { + /* If there only is one image (a very common case), we encode it as a negative value. */ + int num_nodes; + if (slots.size() == 1) { + num_nodes = -slots[0]; + } + else { + num_nodes = divide_up(slots.size(), 2); + } + compiler.add_node(NODE_TEX_IMAGE, num_nodes, compiler.encode_uchar4(vector_offset, @@ -442,10 +449,28 @@ void ImageTextureNode::compile(SVMCompiler &compiler) compiler.stack_assign_if_linked(alpha_out), flags), projection); + + if (num_nodes > 0) { + for (int i = 0; i < num_nodes; i++) { + int4 node; + node.x = tiles[2 * i]; + node.y = slots[2 * i]; + if (2 * i + 1 < slots.size()) { + node.z = tiles[2 * i + 1]; + node.w = slots[2 * i + 1]; + } + else { + node.z = -1; + node.w = -1; + } + compiler.add_node(node.x, node.y, node.z, node.w); + } + } } else { + assert(slots.size() == 1); compiler.add_node(NODE_TEX_IMAGE_BOX, - num_nodes, + slots[0], compiler.encode_uchar4(vector_offset, compiler.stack_assign_if_linked(color_out), compiler.stack_assign_if_linked(alpha_out), @@ -453,23 +478,6 @@ void ImageTextureNode::compile(SVMCompiler &compiler) __float_as_int(projection_blend)); } - if (num_nodes > 0) { - for (int i = 0; i < num_nodes; i++) { - int4 node; - node.x = tiles[2 * i]; - node.y = slots[2 * i]; - if (2 * i + 1 < slots.size()) { - node.z = tiles[2 * i + 1]; - node.w = slots[2 * i + 1]; - } - else { - node.z = -1; - node.w = -1; - } - compiler.add_node(node.x, node.y, node.z, node.w); - } - } - tex_mapping.compile_end(compiler, vector_in, vector_offset); } else { diff --git a/intern/cycles/render/nodes.h b/intern/cycles/render/nodes.h index a8fe7644957..5b23ef6929e 100644 --- a/intern/cycles/render/nodes.h +++ b/intern/cycles/render/nodes.h @@ -114,6 +114,7 @@ class ImageTextureNode : public ImageSlotTextureNode { bool animated; float3 vector; ccl::vector<int> tiles; + bool is_tiled; /* Runtime. */ bool is_float; diff --git a/release/scripts/startup/bl_operators/__init__.py b/release/scripts/startup/bl_operators/__init__.py index bb92e070d00..5af2bd22222 100644 --- a/release/scripts/startup/bl_operators/__init__.py +++ b/release/scripts/startup/bl_operators/__init__.py @@ -32,7 +32,6 @@ _modules = [ "constraint", "file", "image", - "mask", "mesh", "node", "object", diff --git a/release/scripts/startup/bl_operators/mask.py b/release/scripts/startup/bl_operators/mask.py deleted file mode 100644 index 2635f535b0b..00000000000 --- a/release/scripts/startup/bl_operators/mask.py +++ /dev/null @@ -1,40 +0,0 @@ -# ##### BEGIN GPL LICENSE BLOCK ##### -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software Foundation, -# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# -# ##### END GPL LICENSE BLOCK ##### - -# <pep8-80 compliant> - -from bpy.types import Menu -from bpy.app.translations import contexts as i18n_contexts - - -class MASK_MT_add(Menu): - bl_idname = "MASK_MT_add" - bl_label = "Add" - bl_translation_context = i18n_contexts.operator_default - - def draw(self, _context): - layout = self.layout - - layout.operator_context = 'INVOKE_REGION_WIN' - layout.operator("mask.primitive_circle_add", text="Circle", icon='MESH_CIRCLE') - layout.operator("mask.primitive_square_add", text="Square", icon='MESH_PLANE') - - -classes = ( - MASK_MT_add, -) diff --git a/release/scripts/startup/bl_operators/rigidbody.py b/release/scripts/startup/bl_operators/rigidbody.py index 97149133dec..bc80500c888 100644 --- a/release/scripts/startup/bl_operators/rigidbody.py +++ b/release/scripts/startup/bl_operators/rigidbody.py @@ -241,7 +241,8 @@ class ConnectRigidBodies(Operator): description="Pattern used to connect objects", items=( ('SELECTED_TO_ACTIVE', "Selected to Active", "Connect selected objects to the active object"), - ('CHAIN_DISTANCE', "Chain by Distance", "Connect objects as a chain based on distance, starting at the active object"), + ('CHAIN_DISTANCE', "Chain by Distance", "Connect objects as a chain based on distance, " + "starting at the active object"), ), default='SELECTED_TO_ACTIVE', ) diff --git a/release/scripts/startup/bl_operators/uvcalc_smart_project.py b/release/scripts/startup/bl_operators/uvcalc_smart_project.py index 4e61874b440..1f56cbe6d57 100644 --- a/release/scripts/startup/bl_operators/uvcalc_smart_project.py +++ b/release/scripts/startup/bl_operators/uvcalc_smart_project.py @@ -283,7 +283,16 @@ def mergeUvIslands(islandList): # UV Edge list used for intersections as well as unique points. edges, uniqueEdgePoints = island2Edge(islandList[islandIdx]) - decoratedIslandList.append([islandList[islandIdx], totFaceArea, efficiency, islandBoundsArea, w, h, edges, uniqueEdgePoints]) + decoratedIslandList.append([ + islandList[islandIdx], + totFaceArea, + efficiency, + islandBoundsArea, + w, + h, + edges, + uniqueEdgePoints, + ]) # Sort by island bounding box area, smallest face area first. # no.. chance that to most simple edge loop first. @@ -389,7 +398,8 @@ def mergeUvIslands(islandList): # testcount+=1 # print 'Testing intersect' - Intersect = islandIntersectUvIsland(sourceIsland, targetIsland, Vector((boxLeft, boxBottom))) + Intersect = islandIntersectUvIsland( + sourceIsland, targetIsland, Vector((boxLeft, boxBottom))) # print 'Done', Intersect if Intersect == 1: # Line intersect, don't bother with this any more pass diff --git a/release/scripts/startup/bl_operators/vertexpaint_dirt.py b/release/scripts/startup/bl_operators/vertexpaint_dirt.py index 1f982c331fb..39d792bd557 100644 --- a/release/scripts/startup/bl_operators/vertexpaint_dirt.py +++ b/release/scripts/startup/bl_operators/vertexpaint_dirt.py @@ -176,7 +176,14 @@ class VertexPaintDirt(Operator): obj = context.object mesh = obj.data - ret = applyVertexDirt(mesh, self.blur_iterations, self.blur_strength, self.dirt_angle, self.clean_angle, self.dirt_only) + ret = applyVertexDirt( + mesh, + self.blur_iterations, + self.blur_strength, + self.dirt_angle, + self.clean_angle, + self.dirt_only, + ) return ret diff --git a/release/scripts/startup/bl_ui/properties_data_modifier.py b/release/scripts/startup/bl_ui/properties_data_modifier.py index e2b9287ebdd..d4b2c39bd5e 100644 --- a/release/scripts/startup/bl_ui/properties_data_modifier.py +++ b/release/scripts/startup/bl_ui/properties_data_modifier.py @@ -2414,6 +2414,7 @@ class DATA_PT_gpencil_modifiers(ModifierButtonsPanel, Panel): row.prop(md, "layer_pass", text="Pass") row.prop(md, "invert_layer_pass", text="", icon='ARROW_LEFTRIGHT') + classes = ( DATA_PT_modifiers, DATA_PT_gpencil_modifiers, 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 59c18d4f108..de08713c3e3 100644 --- a/release/scripts/startup/bl_ui/properties_grease_pencil_common.py +++ b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py @@ -160,6 +160,7 @@ class GreasePencilSculptOptionsPanel: layout.prop(settings, "use_edit_uv", text="Affect UV") + # GP Object Tool Settings class GreasePencilDisplayPanel: bl_label = "Brush Tip" @@ -175,16 +176,18 @@ class GreasePencilDisplayPanel: else: # GP Sculpt and Weight Paint always have Brush Tip panel. return True + return False def draw_header(self, context): - if self.is_popover: return + if self.is_popover: + return if context.mode == 'PAINT_GPENCIL': brush = context.tool_settings.gpencil_paint.brush gp_settings = brush.gpencil_settings self.layout.prop(gp_settings, "use_cursor", text="") - elif context.mode in ('SCULPT_GPENCIL', 'WEIGHT_GPENCIL'): + elif context.mode in {'SCULPT_GPENCIL', 'WEIGHT_GPENCIL'}: settings = context.tool_settings.gpencil_sculpt brush = settings.brush @@ -506,7 +509,7 @@ class GPENCIL_MT_move_to_layer(Menu): gpl_active = context.active_gpencil_layer tot_layers = len(gpd.layers) i = tot_layers - 1 - while(i >= 0): + while i >= 0: gpl = gpd.layers[i] if gpl.info == gpl_active.info: icon = 'GREASEPENCIL' @@ -716,12 +719,11 @@ class GreasePencilToolsPanel: bl_options = {'DEFAULT_CLOSED'} @classmethod - def poll(cls, context): + def poll(cls, _context): # XXX - disabled in 2.8 branch. + # return (context.gpencil_data is not None) return False - return (context.gpencil_data is not None) - def draw(self, context): layout = self.layout diff --git a/release/scripts/startup/bl_ui/properties_mask_common.py b/release/scripts/startup/bl_ui/properties_mask_common.py index 94d7ac2c91e..3342fe1985a 100644 --- a/release/scripts/startup/bl_ui/properties_mask_common.py +++ b/release/scripts/startup/bl_ui/properties_mask_common.py @@ -22,6 +22,33 @@ # menus are referenced `as is` from bpy.types import Menu, UIList +from bpy.app.translations import contexts as i18n_contexts + + +# Use by both image & clip context menus. +def draw_mask_context_menu(layout, context): + layout.operator_menu_enum("mask.handle_type_set", "type") + layout.operator("mask.switch_direction") + layout.operator("mask.cyclic_toggle") + + layout.separator() + layout.operator("mask.copy_splines", icon='COPYDOWN') + layout.operator("mask.paste_splines", icon='PASTEDOWN') + + layout.separator() + + layout.operator("mask.shape_key_rekey", text="Re-key Shape Points") + layout.operator("mask.feather_weight_clear") + layout.operator("mask.shape_key_feather_reset", text="Reset Feather Animation") + + layout.separator() + + layout.operator("mask.parent_set") + layout.operator("mask.parent_clear") + + layout.separator() + + layout.operator("mask.delete") class MASK_UL_layers(UIList): @@ -320,6 +347,19 @@ class MASK_MT_mask(Menu): layout.menu("MASK_MT_animation") +class MASK_MT_add(Menu): + bl_idname = "MASK_MT_add" + bl_label = "Add" + bl_translation_context = i18n_contexts.operator_default + + def draw(self, _context): + layout = self.layout + + layout.operator_context = 'INVOKE_REGION_WIN' + layout.operator("mask.primitive_circle_add", text="Circle", icon='MESH_CIRCLE') + layout.operator("mask.primitive_square_add", text="Square", icon='MESH_PLANE') + + class MASK_MT_visibility(Menu): bl_label = "Show/Hide" @@ -383,6 +423,7 @@ class MASK_MT_select(Menu): classes = ( MASK_UL_layers, MASK_MT_mask, + MASK_MT_add, MASK_MT_visibility, MASK_MT_transform, MASK_MT_animation, diff --git a/release/scripts/startup/bl_ui/properties_paint_common.py b/release/scripts/startup/bl_ui/properties_paint_common.py index e45988cdcd9..3c30d3655e0 100644 --- a/release/scripts/startup/bl_ui/properties_paint_common.py +++ b/release/scripts/startup/bl_ui/properties_paint_common.py @@ -27,7 +27,8 @@ class UnifiedPaintPanel: @staticmethod def get_brush_mode(context): - """Get the correct mode for this context. For any context where this returns None, no brush options should be displayed.""" + """ Get the correct mode for this context. For any context where this returns None, + no brush options should be displayed.""" if context.mode == 'PARTICLE': # Particle brush settings currently completely do their own thing. @@ -54,13 +55,14 @@ class UnifiedPaintPanel: return 'UV_SCULPT' return 'PAINT_2D' - if space_type in ('VIEW_3D', 'PROPERTIES'): + if space_type in {'VIEW_3D', 'PROPERTIES'}: if context.mode == 'PAINT_TEXTURE': if tool_settings.image_paint and tool_settings.image_paint.detect_data(): return context.mode else: return None return context.mode + return None @staticmethod def paint_settings(context): @@ -87,24 +89,37 @@ class UnifiedPaintPanel: # Grease Pencil settings elif mode == 'PAINT_GPENCIL': return tool_settings.gpencil_paint - elif mode in ('SCULPT_GPENCIL', 'WEIGHT_GPENCIL'): + elif mode in {'SCULPT_GPENCIL', 'WEIGHT_GPENCIL'}: return tool_settings.gpencil_sculpt + return False @staticmethod - def prop_unified(layout, context, brush, prop_name, unified_name=None, pressure_name=None, icon='NONE', text=None, slider=False, display_unified_toggle=True): - """ Generalized way of adding brush options to the UI, along with their pen pressure setting and global toggle, if they exist """ + def prop_unified( + layout, + context, + brush, + prop_name, + unified_name=None, + pressure_name=None, + icon='NONE', + text=None, + slider=False, + display_unified_toggle=True, + ): + """ Generalized way of adding brush options to the UI, + along with their pen pressure setting and global toggle, if they exist. """ row = layout.row(align=True) ups = context.tool_settings.unified_paint_settings prop_owner = brush - if(unified_name and getattr(ups, unified_name) and display_unified_toggle): + if unified_name and getattr(ups, unified_name) and display_unified_toggle: prop_owner = ups row.prop(prop_owner, prop_name, icon=icon, text=text, slider=slider) - if(pressure_name): + if pressure_name: row.prop(brush, pressure_name, text="") - if(unified_name and display_unified_toggle): + if unified_name and display_unified_toggle: row.prop(ups, unified_name, text="", icon="WORLD") return row @@ -138,7 +153,7 @@ class BrushSelectPanel(BrushPanel): brush = settings.brush row = layout.row() - large_preview=True + large_preview = True if large_preview: row.column().template_ID_preview(settings, "brush", new="brush.add", rows=3, cols=8, hide_buttons=False) else: @@ -170,6 +185,7 @@ class ColorPalettePanel(BrushPanel): elif context.vertex_paint_object: capabilities = brush.vertex_paint_capabilities return capabilities.has_color + return False def draw(self, context): layout = self.layout @@ -192,9 +208,10 @@ class ClonePanel(BrushPanel): settings = cls.paint_settings(context) mode = cls.get_brush_mode(context) - if mode in ('PAINT_TEXTURE', 'PAINT_2D'): + if mode in {'PAINT_TEXTURE', 'PAINT_2D'}: brush = settings.brush return brush.image_tool == 'CLONE' + return False def draw_header(self, context): settings = self.paint_settings(context) @@ -203,7 +220,6 @@ class ClonePanel(BrushPanel): def draw(self, context): layout = self.layout settings = self.paint_settings(context) - brush = settings.brush layout.active = settings.use_clone_layer @@ -213,16 +229,22 @@ class ClonePanel(BrushPanel): if settings.mode == 'MATERIAL': if len(ob.material_slots) > 1: col.label(text="Materials") - col.template_list("MATERIAL_UL_matslots", "", - ob, "material_slots", - ob, "active_material_index", rows=2) + col.template_list( + "MATERIAL_UL_matslots", "", + ob, "material_slots", + ob, "active_material_index", + rows=2, + ) mat = ob.active_material if mat: col.label(text="Source Clone Slot") - col.template_list("TEXTURE_UL_texpaintslots", "", - mat, "texture_paint_images", - mat, "paint_clone_slot", rows=2) + col.template_list( + "TEXTURE_UL_texpaintslots", "", + mat, "texture_paint_images", + mat, "paint_clone_slot", + rows=2, + ) elif settings.mode == 'IMAGE': mesh = ob.data @@ -286,7 +308,6 @@ class StrokePanel(BrushPanel): layout.use_property_split = True layout.use_property_decorate = False - tool_settings = context.tool_settings mode = self.get_brush_mode(context) settings = self.paint_settings(context) brush = settings.brush @@ -314,7 +335,7 @@ class StrokePanel(BrushPanel): if mode == 'SCULPT': col.row().prop(brush, "use_scene_spacing", text="Spacing Distance", expand=True) - if mode in ('PAINT_TEXTURE', 'PAINT_2D', 'SCULPT'): + if mode in {'PAINT_TEXTURE', 'PAINT_2D', 'SCULPT'}: if brush.image_paint_capabilities.has_space_attenuation or brush.sculpt_capabilities.has_space_attenuation: col.prop(brush, "use_space_attenuation") @@ -356,6 +377,7 @@ class SmoothStrokePanel(BrushPanel): brush = settings.brush if brush.brush_capabilities.has_smooth_stroke: return True + return False def draw_header(self, context): settings = self.paint_settings(context) @@ -497,7 +519,8 @@ class VIEW3D_MT_tools_projectpaint_clone(Menu): def brush_settings(layout, context, brush, popover=False): - """ Draw simple brush settings for Sculpt, Texture/Vertex/Weight Paint modes, or skip certain settings for the popover """ + """ Draw simple brush settings for Sculpt, + Texture/Vertex/Weight Paint modes, or skip certain settings for the popover """ mode = UnifiedPaintPanel.get_brush_mode(context) @@ -513,7 +536,14 @@ def brush_settings(layout, context, brush, popover=False): # auto_smooth_factor and use_inverse_smooth_pressure if capabilities.has_auto_smooth: - UnifiedPaintPanel.prop_unified(layout, context, brush, "auto_smooth_factor", pressure_name="use_inverse_smooth_pressure", slider=True) + UnifiedPaintPanel.prop_unified( + layout, + context, + brush, + "auto_smooth_factor", + pressure_name="use_inverse_smooth_pressure", + slider=True, + ) # topology_rake_factor if ( @@ -529,7 +559,7 @@ def brush_settings(layout, context, brush, popover=False): # crease_pinch_factor if capabilities.has_pinch_factor: text = "Pinch" - if brush.sculpt_tool in ('BLOB', 'SNAKE_HOOK'): + if brush.sculpt_tool in {'BLOB', 'SNAKE_HOOK'}: text = "Magnify" layout.prop(brush, "crease_pinch_factor", slider=True, text=text) @@ -540,7 +570,14 @@ def brush_settings(layout, context, brush, popover=False): # plane_offset, use_offset_pressure, use_plane_trim, plane_trim if capabilities.has_plane_offset: layout.separator() - UnifiedPaintPanel.prop_unified(layout, context, brush, "plane_offset", pressure_name="use_offset_pressure", slider=True) + UnifiedPaintPanel.prop_unified( + layout, + context, + brush, + "plane_offset", + pressure_name="use_offset_pressure", + slider=True, + ) layout.prop(brush, "use_plane_trim", text="Plane Trim") row = layout.row() @@ -578,14 +615,14 @@ def brush_settings(layout, context, brush, popover=False): if brush.sculpt_tool == 'POSE': row = layout.row() row.prop(brush, "pose_offset") - + if brush.sculpt_tool == 'SCRAPE': row = layout.row() - row.prop(brush, "invert_to_scrape_fill", text = "Invert to Fill") + row.prop(brush, "invert_to_scrape_fill", text="Invert to Fill") if brush.sculpt_tool == 'FILL': row = layout.row() - row.prop(brush, "invert_to_scrape_fill", text = "Invert to Scrape") + row.prop(brush, "invert_to_scrape_fill", text="Invert to Scrape") if brush.sculpt_tool == 'GRAB': layout.prop(brush, "use_grab_active_vertex") @@ -599,14 +636,16 @@ def brush_settings(layout, context, brush, popover=False): if brush.sculpt_tool == 'MASK': layout.row().prop(brush, "mask_tool", expand=True) - # 3D and 2D Texture Paint Mode # - elif mode in ('PAINT_TEXTURE', 'PAINT_2D'): + # 3D and 2D Texture Paint Mode. + elif mode in {'PAINT_TEXTURE', 'PAINT_2D'}: capabilities = brush.image_paint_capabilities if brush.image_tool == 'FILL': - if(brush.color_type == 'COLOR' and mode=='PAINT_2D'): # For some reason fill threshold only appears to be implemented in 2D paint. - layout.prop(brush, "fill_threshold", text="Fill Threshold", slider=True) - if(brush.color_type == 'GRADIENT'): + # For some reason fill threshold only appears to be implemented in 2D paint. + if brush.color_type == 'COLOR': + if mode == 'PAINT_2D': + layout.prop(brush, "fill_threshold", text="Fill Threshold", slider=True) + elif brush.color_type == 'GRADIENT': layout.row().prop(brush, "gradient_fill_mode", expand=True) @@ -625,7 +664,7 @@ def brush_shared_settings(layout, context, brush, popover=False): direction = False # 3D and 2D Texture Paint # - if mode in ('PAINT_TEXTURE', 'PAINT_2D'): + if mode in {'PAINT_TEXTURE', 'PAINT_2D'}: if not popover: blend_mode = brush.image_paint_capabilities.has_color size = brush.image_paint_capabilities.has_radius @@ -654,13 +693,14 @@ def brush_shared_settings(layout, context, brush, popover=False): size = True weight = brush.weight_paint_capabilities.has_weight strength = strength_pressure = True - if(brush.weight_tool=='DRAW'): # Only draw blend mode for the Draw tool, because for other tools it is pointless. D5928#137944 + # Only draw blend mode for the Draw tool, because for other tools it is pointless. D5928#137944 + if brush.weight_tool == 'DRAW': blend_mode = True # UV Sculpt # if mode == 'UV_SCULPT': size = True - strength = True + strength = True ### Draw settings. ### ups = context.scene.tool_settings.unified_paint_settings @@ -670,7 +710,14 @@ def brush_shared_settings(layout, context, brush, popover=False): layout.separator() if weight: - UnifiedPaintPanel.prop_unified(layout, context, brush, "weight", unified_name="use_unified_weight", slider=True) + UnifiedPaintPanel.prop_unified( + layout, + context, + brush, + "weight", + unified_name="use_unified_weight", + slider=True, + ) size_owner = ups if ups.use_unified_size else brush size_prop = "size" @@ -678,14 +725,31 @@ def brush_shared_settings(layout, context, brush, popover=False): size_prop = "unprojected_radius" if size or size_mode: if size: - UnifiedPaintPanel.prop_unified(layout, context, brush, size_prop, unified_name="use_unified_size", pressure_name="use_pressure_size", text="Radius", slider=True) + UnifiedPaintPanel.prop_unified( + layout, + context, + brush, + size_prop, + unified_name="use_unified_size", + pressure_name="use_pressure_size", + text="Radius", + slider=True, + ) if size_mode: layout.row().prop(size_owner, "use_locked_size", expand=True) layout.separator() if strength: pressure_name = "use_pressure_strength" if strength_pressure else None - UnifiedPaintPanel.prop_unified(layout, context, brush, "strength", unified_name="use_unified_strength", pressure_name=pressure_name, slider=True) + UnifiedPaintPanel.prop_unified( + layout, + context, + brush, + "strength", + unified_name="use_unified_strength", + pressure_name=pressure_name, + slider=True, + ) layout.separator() if direction: @@ -722,8 +786,8 @@ def brush_settings_advanced(layout, context, brush, popover=False): layout.prop(brush, "use_original_plane") layout.separator() - # 3D and 2D Texture Paint # - elif mode in ('PAINT_TEXTURE', 'PAINT_2D'): + # 3D and 2D Texture Paint. + elif mode in {'PAINT_TEXTURE', 'PAINT_2D'}: capabilities = brush.image_paint_capabilities use_accumulate = capabilities.has_accumulate @@ -762,9 +826,7 @@ def brush_settings_advanced(layout, context, brush, popover=False): use_accumulate = True use_frontface = True - ### Draw shared settings. ### - ups = context.scene.tool_settings.unified_paint_settings - + # Draw shared settings. if use_accumulate: layout.prop(brush, "use_accumulate") @@ -800,7 +862,15 @@ def draw_color_settings(context, layout, brush, color_type=False): col = layout.column() if brush.image_tool == 'DRAW': - UnifiedPaintPanel.prop_unified(col, context, brush, "secondary_color", unified_name="use_unified_color", text="Background Color", display_unified_toggle=False) + UnifiedPaintPanel.prop_unified( + col, + context, + brush, + "secondary_color", + unified_name="use_unified_color", + text="Background Color", + display_unified_toggle=False, + ) col.prop(brush, "gradient_stroke_mode", text="Gradient Mapping") if brush.gradient_stroke_mode in {'SPACING_REPEAT', 'SPACING_CLAMP'}: @@ -885,18 +955,33 @@ def brush_mask_texture_settings(layout, brush): # scale and offset col.prop(mask_tex_slot, "offset") col.prop(mask_tex_slot, "scale") + + def brush_basic_texpaint_settings(layout, context, brush, *, compact=False): """Draw Tool Settings header for Vertex Paint and 2D and 3D Texture Paint modes.""" # NOTE: We don't draw UnifiedPaintSettings in the header to reduce clutter. D5928#136281 capabilities = brush.image_paint_capabilities - if capabilities.has_color: UnifiedPaintPanel.prop_unified_color(layout, context, brush, "color", text="") layout.prop(brush, "blend", text="" if compact else "Blend") - UnifiedPaintPanel.prop_unified(layout, context, brush, "size", pressure_name="use_pressure_size", slider=True, text="Radius") - UnifiedPaintPanel.prop_unified(layout, context, brush, "strength", pressure_name="use_pressure_strength") + UnifiedPaintPanel.prop_unified( + layout, + context, + brush, + "size", + pressure_name="use_pressure_size", + slider=True, + text="Radius", + ) + UnifiedPaintPanel.prop_unified( + layout, + context, + brush, + "strength", + pressure_name="use_pressure_strength", + ) def brush_basic_gpencil_paint_settings(layout, context, brush, *, compact=False): @@ -935,7 +1020,7 @@ def brush_basic_gpencil_paint_settings(layout, context, brush, *, compact=False) row = layout.row(align=True) row.prop(gp_settings, "fill_draw_mode", text="Boundary") row.prop(gp_settings, "show_fill_boundary", text="", icon='GRID') - + else: # brush.gpencil_tool == 'DRAW': row = layout.row(align=True) row.prop(brush, "size", text="Radius") diff --git a/release/scripts/startup/bl_ui/properties_particle.py b/release/scripts/startup/bl_ui/properties_particle.py index 4e644bdf83f..21abf8bb34c 100644 --- a/release/scripts/startup/bl_ui/properties_particle.py +++ b/release/scripts/startup/bl_ui/properties_particle.py @@ -119,6 +119,7 @@ def find_modifier(ob, psys): if md.type == 'PARTICLE_SYSTEM': if md.particle_system == psys: return md + return None class PARTICLE_UL_particle_systems(bpy.types.UIList): @@ -159,7 +160,10 @@ class PARTICLE_PT_context_particles(ParticleButtonsPanel, Panel): @classmethod def poll(cls, context): engine = context.engine - return (context.particle_system or context.object or context.space_data.pin_id) and (engine in cls.COMPAT_ENGINES) + return ( + (context.particle_system or context.object or context.space_data.pin_id) and + (engine in cls.COMPAT_ENGINES) + ) def draw(self, context): layout = self.layout diff --git a/release/scripts/startup/bl_ui/properties_physics_cloth.py b/release/scripts/startup/bl_ui/properties_physics_cloth.py index cd7e99f255c..d9713cb8608 100644 --- a/release/scripts/startup/bl_ui/properties_physics_cloth.py +++ b/release/scripts/startup/bl_ui/properties_physics_cloth.py @@ -160,6 +160,7 @@ class PHYSICS_PT_cloth_damping(PhysicButtonsPanel, Panel): col = flow.column() col.prop(cloth, "bending_damping", text="Bending") + class PHYSICS_PT_cloth_internal_springs(PhysicButtonsPanel, Panel): bl_label = "Internal Springs" bl_parent_id = 'PHYSICS_PT_cloth_physical_properties' @@ -201,6 +202,7 @@ class PHYSICS_PT_cloth_internal_springs(PhysicButtonsPanel, Panel): col = flow.column() col.prop(cloth, "internal_compression_stiffness_max", text="Max Compression") + class PHYSICS_PT_cloth_pressure(PhysicButtonsPanel, Panel): bl_label = "Pressure" bl_parent_id = 'PHYSICS_PT_cloth_physical_properties' diff --git a/release/scripts/startup/bl_ui/space_clip.py b/release/scripts/startup/bl_ui/space_clip.py index 9afdcdff9a5..f93629a4f03 100644 --- a/release/scripts/startup/bl_ui/space_clip.py +++ b/release/scripts/startup/bl_ui/space_clip.py @@ -1445,15 +1445,6 @@ class CLIP_MT_select_grouped(Menu): layout.operator_enum("clip.select_grouped", "group") -class CLIP_MT_mask_handle_type_menu(Menu): - bl_label = "Set Handle Type" - - def draw(self, _context): - layout = self.layout - - layout.operator_enum("mask.handle_type_set", "type") - - class CLIP_MT_tracking_context_menu(Menu): bl_label = "Context Menu" @@ -1507,30 +1498,8 @@ class CLIP_MT_tracking_context_menu(Menu): layout.operator("clip.delete_track") elif mode == 'MASK': - - layout.menu("CLIP_MT_mask_handle_type_menu") - layout.operator("mask.switch_direction") - layout.operator("mask.cyclic_toggle") - - layout.separator() - - layout.operator("mask.copy_splines", icon='COPYDOWN') - layout.operator("mask.paste_splines", icon='PASTEDOWN') - - layout.separator() - - layout.operator("mask.shape_key_rekey", text="Re-key Shape Points") - layout.operator("mask.feather_weight_clear") - layout.operator("mask.shape_key_feather_reset", text="Reset Feather Animation") - - layout.separator() - - layout.operator("mask.parent_set") - layout.operator("mask.parent_clear") - - layout.separator() - - layout.operator("mask.delete") + from .properties_mask_common import draw_mask_context_menu + draw_mask_context_menu(layout, context) class CLIP_PT_camera_presets(PresetPanel, Panel): @@ -1801,7 +1770,6 @@ classes = ( CLIP_MT_tracking_pie, CLIP_MT_reconstruction_pie, CLIP_MT_solving_pie, - CLIP_MT_mask_handle_type_menu ) if __name__ == "__main__": # only for live edit. diff --git a/release/scripts/startup/bl_ui/space_dopesheet.py b/release/scripts/startup/bl_ui/space_dopesheet.py index b8f86788b4c..5a73ff094a2 100644 --- a/release/scripts/startup/bl_ui/space_dopesheet.py +++ b/release/scripts/startup/bl_ui/space_dopesheet.py @@ -657,6 +657,7 @@ class DOPESHEET_MT_snap_pie(Menu): pie.operator("action.snap", text="Nearest Second").type = 'NEAREST_SECOND' pie.operator("action.snap", text="Nearest Marker").type = 'NEAREST_MARKER' + class LayersDopeSheetPanel: bl_space_type = 'DOPESHEET_EDITOR' bl_region_type = 'UI' diff --git a/release/scripts/startup/bl_ui/space_filebrowser.py b/release/scripts/startup/bl_ui/space_filebrowser.py index 543a45e85c2..8dd0eaf5445 100644 --- a/release/scripts/startup/bl_ui/space_filebrowser.py +++ b/release/scripts/startup/bl_ui/space_filebrowser.py @@ -162,7 +162,7 @@ def panel_poll_is_upper_region(region): 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 diff --git a/release/scripts/startup/bl_ui/space_graph.py b/release/scripts/startup/bl_ui/space_graph.py index 968492db374..2e853a287ea 100644 --- a/release/scripts/startup/bl_ui/space_graph.py +++ b/release/scripts/startup/bl_ui/space_graph.py @@ -294,7 +294,9 @@ class GRAPH_MT_key(Menu): operator_context = layout.operator_context layout.operator("graph.decimate", text="Decimate (Ratio)").mode = 'RATIO' - # Using the modal operation doesn't make sense for this variant as we do not have a modal mode for it, so just execute it. + + # Using the modal operation doesn't make sense for this variant + # as we do not have a modal mode for it, so just execute it. layout.operator_context = 'EXEC_DEFAULT' layout.operator("graph.decimate", text="Decimate (Allowed Change)").mode = 'ERROR' layout.operator_context = operator_context diff --git a/release/scripts/startup/bl_ui/space_image.py b/release/scripts/startup/bl_ui/space_image.py index 0ccef9c08c8..c795b575a88 100644 --- a/release/scripts/startup/bl_ui/space_image.py +++ b/release/scripts/startup/bl_ui/space_image.py @@ -231,7 +231,7 @@ class IMAGE_MT_image(Menu): if ima and not show_render: if ima.packed_file: - if len(ima.filepath): + if ima.filepath: layout.separator() layout.operator("image.unpack", text="Unpack") else: @@ -590,8 +590,22 @@ class _draw_tool_settings_context_mode: brush = uv_sculpt.brush if brush: # NOTE: We don't draw UnifiedPaintSettings in the header to reduce clutter. D5928#136281 - UnifiedPaintPanel.prop_unified(layout, context, brush, "size", pressure_name="use_pressure_size", slider=True) - UnifiedPaintPanel.prop_unified(layout, context, brush, "strength", pressure_name="use_pressure_strength", slider=True) + UnifiedPaintPanel.prop_unified( + layout, + context, + brush, + "size", + pressure_name="use_pressure_size", + slider=True, + ) + UnifiedPaintPanel.prop_unified( + layout, + context, + brush, + "strength", + pressure_name="use_pressure_strength", + slider=True, + ) @staticmethod def PAINT(context, layout, tool): @@ -738,7 +752,6 @@ class MASK_MT_editor_menus(Menu): show_uvedit = sima.show_uvedit show_maskedit = sima.show_maskedit - show_paint = sima.show_paint layout.menu("IMAGE_MT_view") @@ -765,44 +778,13 @@ class IMAGE_MT_mask_context_menu(Menu): @classmethod def poll(cls, context): sima = context.space_data - return (sima.show_maskedit) + return sima.show_maskedit def draw(self, context): layout = self.layout - sima = context.space_data - - if not sima.mask: - layout.operator("mask.new") - layout.separator() - layout.operator("mask.primitive_circle_add", icon='MESH_CIRCLE') - layout.operator("mask.primitive_square_add", icon='MESH_PLANE') - else: - layout.operator_menu_enum("mask.handle_type_set", "type") - layout.operator("mask.switch_direction") - layout.operator("mask.cyclic_toggle") - - layout.separator() - layout.operator("mask.primitive_circle_add", icon='MESH_CIRCLE') - layout.operator("mask.primitive_square_add", icon='MESH_PLANE') - - layout.separator() - layout.operator("mask.copy_splines", icon='COPYDOWN') - layout.operator("mask.paste_splines", icon='PASTEDOWN') - - layout.separator() + from .properties_mask_common import draw_mask_context_menu + draw_mask_context_menu(layout, context) - layout.operator("mask.shape_key_rekey", text="Re-key Shape Points") - layout.operator("mask.feather_weight_clear") - layout.operator("mask.shape_key_feather_reset", text="Reset Feather Animation") - - layout.separator() - - layout.operator("mask.parent_set") - layout.operator("mask.parent_clear") - - layout.separator() - - layout.operator("mask.delete") # ----------------------------------------------------------------------------- # Mask (similar code in space_clip.py, keep in sync) @@ -1037,7 +1019,7 @@ class IMAGE_PT_render_slots(Panel): class IMAGE_UL_udim_tiles(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): tile = item layout.prop(tile, "label", text="", emboss=False) @@ -1079,6 +1061,7 @@ class IMAGE_PT_paint_select(Panel, ImagePaintPanel, BrushSelectPanel): bl_context = ".paint_common_2d" bl_category = "Tool" + class IMAGE_PT_paint_settings(Panel, ImagePaintPanel): bl_context = ".paint_common_2d" bl_category = "Tool" @@ -1226,6 +1209,7 @@ class IMAGE_PT_tools_imagepaint_symmetry(BrushButtonsPanel, Panel): row.prop(ipaint, "tile_x", text="X", toggle=True) row.prop(ipaint, "tile_y", text="Y", toggle=True) + class UVSculptPanel(UnifiedPaintPanel): @classmethod def poll(cls, context): @@ -1255,7 +1239,9 @@ class IMAGE_PT_uv_sculpt_brush_settings(Panel, ImagePaintPanel, UVSculptPanel): if brush: if brush.uv_sculpt_tool == 'RELAX': - # Although this settings is stored in the scene, it is only used by a single tool, so it doesn't make sense from a user perspective to move it to the Options panel. + # Although this settings is stored in the scene, + # it is only used by a single tool, + # so it doesn't make sense from a user perspective to move it to the Options panel. layout.prop(tool_settings, "uv_relax_method") @@ -1266,6 +1252,7 @@ class IMAGE_PT_uv_sculpt_curve(Panel, FalloffPanel, ImagePaintPanel, UVSculptPan bl_label = "Falloff" bl_options = {'DEFAULT_CLOSED'} + class IMAGE_PT_uv_sculpt_options(Panel, ImagePaintPanel, UVSculptPanel): bl_context = ".uv_sculpt" # dot on purpose (access from topbar) bl_category = "Tool" diff --git a/release/scripts/startup/bl_ui/space_toolsystem_common.py b/release/scripts/startup/bl_ui/space_toolsystem_common.py index 65c41bae3f6..7b0a769ae62 100644 --- a/release/scripts/startup/bl_ui/space_toolsystem_common.py +++ b/release/scripts/startup/bl_ui/space_toolsystem_common.py @@ -218,49 +218,27 @@ class ToolSelectPanelHelper: @staticmethod def _tools_flatten(tools): - """ - Flattens, skips None and calls generators. - """ for item in tools: - if item is None: - yield None - elif type(item) is tuple: - for sub_item in item: - if sub_item is None: - yield None - elif _item_is_fn(sub_item): - yield from sub_item(context) - else: - yield sub_item + if type(item) is tuple: + yield from item else: - if _item_is_fn(item): - yield from item(context) - else: - yield item + # May be None. + yield item @staticmethod def _tools_flatten_with_tool_index(tools): for item in tools: - if item is None: - yield None, -1 - elif type(item) is tuple: + if type(item) is tuple: i = 0 for sub_item in item: if sub_item is None: yield None, -1 - elif _item_is_fn(sub_item): - for item_dyn in sub_item(context): - yield item_dyn, i - i += 1 else: yield sub_item, i i += 1 else: - if _item_is_fn(item): - for item_dyn in item(context): - yield item_dyn, -1 - else: - yield item, -1 + # May be None. + yield item, -1 @classmethod def _tool_get_active(cls, context, space_type, mode, with_icon=False): @@ -378,7 +356,7 @@ class ToolSelectPanelHelper: @staticmethod def _tool_active_from_context(context, space_type, mode=None, create=False): - if space_type in ('VIEW_3D', 'PROPERTIES'): + if space_type in {'VIEW_3D', 'PROPERTIES'}: if mode is None: mode = context.mode tool = context.workspace.tools.from_space_view3d_mode(mode, create=create) @@ -676,7 +654,6 @@ class ToolSelectPanelHelper: space_type = context.space_data.type return ToolSelectPanelHelper._tool_active_from_context(context, space_type) - @staticmethod def draw_active_tool_fallback( context, layout, tool, diff --git a/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py b/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py index bd22287aea6..5f017e61db7 100644 --- a/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py +++ b/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py @@ -594,7 +594,7 @@ class _defs_edit_mesh: props = tool.operator_properties("mesh.bevel") region_type = context.region.type - if extra == False: + if not extra: if props.offset_type == 'PERCENT': layout.prop(props, "offset_pct") else: diff --git a/release/scripts/startup/bl_ui/space_userpref.py b/release/scripts/startup/bl_ui/space_userpref.py index 9ffae3aada2..3aecd7b9775 100644 --- a/release/scripts/startup/bl_ui/space_userpref.py +++ b/release/scripts/startup/bl_ui/space_userpref.py @@ -1213,7 +1213,12 @@ class ThemeGenericClassGenerator(): "datapath": new_datapath, }) - yield from generate_child_panel_classes_recurse(panel_id, prop.fixed_type, theme_area, new_datapath) + yield from generate_child_panel_classes_recurse( + panel_id, + prop.fixed_type, + theme_area, + new_datapath, + ) yield from generate_child_panel_classes_recurse(parent_id, rna_type, theme_area, datapath) diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py index 36d178a467c..6374b3af46d 100644 --- a/release/scripts/startup/bl_ui/space_view3d.py +++ b/release/scripts/startup/bl_ui/space_view3d.py @@ -130,7 +130,7 @@ class VIEW3D_HT_tool_header(Header): elif tool_mode == 'SCULPT_GPENCIL': settings = context.tool_settings.gpencil_sculpt tool = settings.sculpt_tool - if tool in ('SMOOTH', 'RANDOMIZE', 'SMOOTH'): + if tool in {'SMOOTH', 'RANDOMIZE', 'SMOOTH'}: layout.popover("VIEW3D_PT_tools_grease_pencil_sculpt_options") layout.popover("VIEW3D_PT_tools_grease_pencil_sculpt_appearance") elif tool_mode == 'WEIGHT_GPENCIL': @@ -262,11 +262,26 @@ class _draw_tool_settings_context_mode: size = "unprojected_radius" # NOTE: We don't draw UnifiedPaintSettings in the header to reduce clutter. D5928#136281 - UnifiedPaintPanel.prop_unified(layout, context, brush, size, pressure_name="use_pressure_size", text="Radius", slider=True) + UnifiedPaintPanel.prop_unified( + layout, + context, + brush, + size, + pressure_name="use_pressure_size", + text="Radius", + slider=True, + ) # strength, use_strength_pressure pressure_name = "use_pressure_strength" if capabilities.has_strength_pressure else None - UnifiedPaintPanel.prop_unified(layout, context, brush, "strength", pressure_name=pressure_name, text="Strength") + UnifiedPaintPanel.prop_unified( + layout, + context, + brush, + "strength", + pressure_name=pressure_name, + text="Strength", + ) # direction if not capabilities.has_direction: @@ -316,8 +331,22 @@ class _draw_tool_settings_context_mode: if capabilities.has_weight: UnifiedPaintPanel.prop_unified(layout, context, brush, "weight", slider=True) - UnifiedPaintPanel.prop_unified(layout, context, brush, "size", pressure_name="use_pressure_size", slider=True, text="Radius") - UnifiedPaintPanel.prop_unified(layout, context, brush, "strength", pressure_name="use_pressure_strength") + UnifiedPaintPanel.prop_unified( + layout, + context, + brush, + "size", + pressure_name="use_pressure_size", + slider=True, + text="Radius", + ) + UnifiedPaintPanel.prop_unified( + layout, + context, + brush, + "strength", + pressure_name="use_pressure_strength", + ) @staticmethod def PAINT_GPENCIL(context, layout, tool): @@ -5502,9 +5531,10 @@ class VIEW3D_PT_shading_render_pass(Panel): @classmethod def poll(cls, context): - return (context.space_data.shading.type == 'MATERIAL' - or (context.engine in cls.COMPAT_ENGINES - and context.space_data.shading.type == 'RENDERED')) + return ( + (context.space_data.shading.type == 'MATERIAL') or + (context.engine in cls.COMPAT_ENGINES and context.space_data.shading.type == 'RENDERED') + ) def draw(self, context): shading = context.space_data.shading @@ -6690,8 +6720,25 @@ class VIEW3D_PT_paint_vertex_context_menu(Panel): UnifiedPaintPanel.prop_unified_color_picker(split, context, brush, "color", value_slider=True) layout.prop(brush, "blend", text="") - UnifiedPaintPanel.prop_unified(layout, context, brush, "size", unified_name="use_unified_size", pressure_name="use_pressure_size", slider=True) - UnifiedPaintPanel.prop_unified(layout, context, brush, "strength", unified_name="use_unified_strength", pressure_name="use_pressure_strength", slider=True) + UnifiedPaintPanel.prop_unified( + layout, + context, + brush, + "size", + unified_name="use_unified_size", + pressure_name="use_pressure_size", + slider=True, + ) + UnifiedPaintPanel.prop_unified( + layout, + context, + brush, + "strength", + unified_name="use_unified_strength", + pressure_name="use_pressure_strength", + slider=True, + ) + class VIEW3D_PT_paint_texture_context_menu(Panel): # Only for popover, these are dummy values. @@ -6712,8 +6759,24 @@ class VIEW3D_PT_paint_texture_context_menu(Panel): layout.prop(brush, "blend", text="") if capabilities.has_radius: - UnifiedPaintPanel.prop_unified(layout, context, brush, "size", unified_name="use_unified_size", pressure_name="use_pressure_size", slider=True) - UnifiedPaintPanel.prop_unified(layout, context, brush, "strength", unified_name="use_unified_strength", pressure_name="use_pressure_strength", slider=True) + UnifiedPaintPanel.prop_unified( + layout, + context, + brush, + "size", + unified_name="use_unified_size", + pressure_name="use_pressure_size", + slider=True, + ) + UnifiedPaintPanel.prop_unified( + layout, + context, + brush, + "strength", + unified_name="use_unified_strength", + pressure_name="use_pressure_strength", + slider=True, + ) class VIEW3D_PT_paint_weight_context_menu(Panel): @@ -6726,9 +6789,32 @@ class VIEW3D_PT_paint_weight_context_menu(Panel): layout = self.layout brush = context.tool_settings.weight_paint.brush - UnifiedPaintPanel.prop_unified(layout, context, brush, "weight", unified_name="use_unified_weight", slider=True) - UnifiedPaintPanel.prop_unified(layout, context, brush, "size", unified_name="use_unified_size", pressure_name="use_pressure_size", slider=True) - UnifiedPaintPanel.prop_unified(layout, context, brush, "strength", unified_name="use_unified_strength", pressure_name="use_pressure_strength", slider=True) + UnifiedPaintPanel.prop_unified( + layout, + context, + brush, + "weight", + unified_name="use_unified_weight", + slider=True, + ) + UnifiedPaintPanel.prop_unified( + layout, + context, + brush, + "size", + unified_name="use_unified_size", + pressure_name="use_pressure_size", + slider=True, + ) + UnifiedPaintPanel.prop_unified( + layout, + context, + brush, + "strength", + unified_name="use_unified_strength", + pressure_name="use_pressure_strength", + slider=True, + ) class VIEW3D_PT_sculpt_context_menu(Panel): @@ -6743,8 +6829,24 @@ class VIEW3D_PT_sculpt_context_menu(Panel): brush = context.tool_settings.sculpt.brush capabilities = brush.sculpt_capabilities - UnifiedPaintPanel.prop_unified(layout, context, brush, "size", unified_name="use_unified_size", pressure_name="use_pressure_size", slider=True) - UnifiedPaintPanel.prop_unified(layout, context, brush, "strength", unified_name="use_unified_strength", pressure_name="use_pressure_strength", slider=True) + UnifiedPaintPanel.prop_unified( + layout, + context, + brush, + "size", + unified_name="use_unified_size", + pressure_name="use_pressure_size", + slider=True, + ) + UnifiedPaintPanel.prop_unified( + layout, + context, + brush, + "strength", + unified_name="use_unified_strength", + pressure_name="use_pressure_strength", + slider=True, + ) if capabilities.has_auto_smooth: layout.prop(brush, "auto_smooth_factor", slider=True) diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py b/release/scripts/startup/bl_ui/space_view3d_toolbar.py index 6ace1466883..43e4aee34db 100644 --- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py +++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py @@ -321,6 +321,7 @@ class VIEW3D_PT_tools_posemode_options(View3DPanel, Panel): # ********** default tools for paint modes **************** + class TEXTURE_UL_texpaintslots(UIList): def draw_item(self, _context, layout, _data, item, icon, _active_data, _active_propname, _index): # mat = data @@ -331,6 +332,7 @@ class TEXTURE_UL_texpaintslots(UIList): layout.alignment = 'CENTER' layout.label(text="") + class View3DPaintPanel(View3DPanel, UnifiedPaintPanel): bl_category = "Tool" @@ -409,6 +411,7 @@ class VIEW3D_PT_tools_brush_settings(Panel, View3DPaintBrushPanel): brush_settings(layout.column(), context, brush, popover=self.is_popover) + class VIEW3D_PT_tools_brush_settings_advanced(Panel, View3DPaintBrushPanel): bl_context = ".paint_common" bl_parent_id = "VIEW3D_PT_tools_brush_settings" @@ -436,20 +439,22 @@ class VIEW3D_PT_tools_brush_color(Panel, View3DPaintPanel): def poll(cls, context): settings = cls.paint_settings(context) brush = settings.brush + if context.image_paint_object: capabilities = brush.image_paint_capabilities return capabilities.has_color - elif context.vertex_paint_object: capabilities = brush.vertex_paint_capabilities return capabilities.has_color + return False + def draw(self, context): layout = self.layout settings = self.paint_settings(context) brush = settings.brush - draw_color_settings(context, layout, brush, color_type = not context.vertex_paint_object) + draw_color_settings(context, layout, brush, color_type=not context.vertex_paint_object) class VIEW3D_PT_tools_brush_swatches(Panel, View3DPaintPanel, ColorPalettePanel): @@ -852,6 +857,7 @@ class VIEW3D_PT_sculpt_voxel_remesh(Panel, View3DPaintPanel): col.prop(mesh, "use_remesh_preserve_paint_mask") col.operator("object.voxel_remesh", text="Remesh") + # TODO, move to space_view3d.py class VIEW3D_PT_sculpt_options(Panel, View3DPaintPanel): bl_context = ".sculpt_mode" # dot on purpose (access from topbar) @@ -879,6 +885,7 @@ class VIEW3D_PT_sculpt_options(Panel, View3DPaintPanel): col = flow.column() col.prop(sculpt, "use_deform_only") + class VIEW3D_PT_sculpt_options_gravity(Panel, View3DPaintPanel): bl_context = ".sculpt_mode" # dot on purpose (access from topbar) bl_parent_id = "VIEW3D_PT_sculpt_options" @@ -1047,11 +1054,11 @@ class VIEW3D_PT_tools_vertexpaint_options(Panel, View3DPaintPanel): bl_options = {'DEFAULT_CLOSED'} @classmethod - def poll(self, context): + def poll(self, _context): # This is currently unused, since there aren't any Vertex Paint mode specific options. return False - def draw(self, context): + def draw(self, _context): layout = self.layout layout.use_property_split = True layout.use_property_decorate = False @@ -1206,12 +1213,12 @@ class VIEW3D_PT_imagepaint_options(View3DPaintPanel): bl_label = "Options" @classmethod - def poll(cls, context): + def poll(cls, _context): # This is currently unused, since there aren't any Vertex Paint mode specific options. - return False - return (context.image_paint_object and context.tool_settings.image_paint) + return False + # return (context.image_paint_object and context.tool_settings.image_paint) - def draw(self, context): + def draw(self, _context): layout = self.layout layout.use_property_split = True layout.use_property_decorate = False @@ -1337,7 +1344,7 @@ class GreasePencilPanel: @classmethod def poll(cls, context): - if context.space_data.type in ('VIEW_3D', 'PROPERTIES'): + if context.space_data.type in {'VIEW_3D', 'PROPERTIES'}: if context.gpencil_data is None: return False @@ -1370,7 +1377,7 @@ class VIEW3D_PT_tools_grease_pencil_brush_select(Panel, View3DPanel, GreasePenci col.prop(brush, "use_custom_icon", toggle=True, icon='FILE_IMAGE', text="") - if(brush.use_custom_icon): + if brush.use_custom_icon: layout.row().prop(brush, "icon_filepath", text="") else: layout.row().prop(gp_settings, "gp_icon", text="Icon") @@ -1482,7 +1489,8 @@ class VIEW3D_PT_tools_grease_pencil_brush_stabilizer(Panel, View3DPanel): return brush is not None and brush.gpencil_tool == 'DRAW' def draw_header(self, context): - if self.is_popover: return + if self.is_popover: + return brush = context.tool_settings.gpencil_paint.brush gp_settings = brush.gpencil_settings @@ -1518,10 +1526,11 @@ class VIEW3D_PT_tools_grease_pencil_brush_post_processing(View3DPanel, Panel): @classmethod def poll(cls, context): brush = context.tool_settings.gpencil_paint.brush - return brush is not None and brush.gpencil_tool not in ('ERASE', 'FILL') + return brush is not None and brush.gpencil_tool not in {'ERASE', 'FILL'} def draw_header(self, context): - if self.is_popover: return + if self.is_popover: + return brush = context.tool_settings.gpencil_paint.brush gp_settings = brush.gpencil_settings @@ -1572,10 +1581,11 @@ class VIEW3D_PT_tools_grease_pencil_brush_random(View3DPanel, Panel): @classmethod def poll(cls, context): brush = context.tool_settings.gpencil_paint.brush - return brush is not None and brush.gpencil_tool not in ('ERASE', 'FILL') + return brush is not None and brush.gpencil_tool not in {'ERASE', 'FILL'} def draw_header(self, context): - if self.is_popover: return + if self.is_popover: + return brush = context.tool_settings.gpencil_paint.brush gp_settings = brush.gpencil_settings @@ -1734,7 +1744,6 @@ class VIEW3D_PT_tools_grease_pencil_sculpt_select(Panel, View3DPanel): layout.use_property_decorate = False settings = context.tool_settings.gpencil_sculpt - brush = settings.brush layout.template_icon_view(settings, "sculpt_tool", show_labels=True) @@ -1760,6 +1769,7 @@ class VIEW3D_PT_tools_grease_pencil_sculpt_settings(Panel, View3DPanel): # Grease Pencil weight painting tools + class VIEW3D_PT_tools_grease_pencil_weight_paint_select(View3DPanel, Panel): bl_context = ".greasepencil_weight" bl_label = "Brushes" @@ -1771,7 +1781,6 @@ class VIEW3D_PT_tools_grease_pencil_weight_paint_select(View3DPanel, Panel): layout.use_property_decorate = False settings = context.tool_settings.gpencil_sculpt - brush = settings.brush layout.template_icon_view(settings, "weight_tool", show_labels=True) @@ -1789,7 +1798,6 @@ class VIEW3D_PT_tools_grease_pencil_weight_paint_settings(Panel, View3DPanel): settings = context.tool_settings.gpencil_sculpt brush = settings.brush - if not self.is_popover: from bl_ui.properties_paint_common import ( brush_basic_gpencil_weight_settings, @@ -1846,7 +1854,7 @@ classes = ( VIEW3D_PT_tools_posemode_options, VIEW3D_PT_slots_projectpaint, - VIEW3D_PT_tools_brush_select, + VIEW3D_PT_tools_brush_select, VIEW3D_PT_tools_brush_settings, VIEW3D_PT_tools_brush_color, VIEW3D_PT_tools_brush_swatches, diff --git a/source/blender/draw/engines/eevee/shaders/renderpass_postprocess_frag.glsl b/source/blender/draw/engines/eevee/shaders/renderpass_postprocess_frag.glsl index 5a738d0f130..35bfb411cb9 100644 --- a/source/blender/draw/engines/eevee/shaders/renderpass_postprocess_frag.glsl +++ b/source/blender/draw/engines/eevee/shaders/renderpass_postprocess_frag.glsl @@ -61,4 +61,4 @@ void main() else { fragColor = vec4(1.0, 0.0, 1.0, 1.0); } -}
\ No newline at end of file +} diff --git a/source/blender/draw/engines/overlay/overlay_armature.c b/source/blender/draw/engines/overlay/overlay_armature.c index b0fb95380f4..0b77fcad265 100644 --- a/source/blender/draw/engines/overlay/overlay_armature.c +++ b/source/blender/draw/engines/overlay/overlay_armature.c @@ -2354,4 +2354,4 @@ void OVERLAY_pose_draw(OVERLAY_Data *vedata) DRW_draw_pass(psl->armature_ps[1]); } -}
\ No newline at end of file +} diff --git a/source/blender/draw/engines/overlay/overlay_edit_curve.c b/source/blender/draw/engines/overlay/overlay_edit_curve.c index b39dc39fd47..d9b9fac6b4b 100644 --- a/source/blender/draw/engines/overlay/overlay_edit_curve.c +++ b/source/blender/draw/engines/overlay/overlay_edit_curve.c @@ -129,4 +129,4 @@ void OVERLAY_edit_curve_draw(OVERLAY_Data *vedata) DRW_draw_pass(psl->edit_curve_wire_ps[1]); DRW_draw_pass(psl->edit_curve_handle_ps); -}
\ No newline at end of file +} diff --git a/source/blender/draw/engines/overlay/overlay_edit_text.c b/source/blender/draw/engines/overlay/overlay_edit_text.c index 0975608a300..72b5ae74255 100644 --- a/source/blender/draw/engines/overlay/overlay_edit_text.c +++ b/source/blender/draw/engines/overlay/overlay_edit_text.c @@ -202,4 +202,4 @@ void OVERLAY_edit_text_draw(OVERLAY_Data *vedata) DRW_draw_pass(psl->edit_text_wire_ps[1]); DRW_draw_pass(psl->edit_text_overlay_ps); -}
\ No newline at end of file +} diff --git a/source/blender/draw/engines/overlay/overlay_private.h b/source/blender/draw/engines/overlay/overlay_private.h index 9be92e0ab14..996ee845799 100644 --- a/source/blender/draw/engines/overlay/overlay_private.h +++ b/source/blender/draw/engines/overlay/overlay_private.h @@ -571,4 +571,4 @@ OVERLAY_InstanceFormats *OVERLAY_shader_instance_formats_get(void); void OVERLAY_shader_free(void); -#endif /* __OVERLAY_PRIVATE_H__ */
\ No newline at end of file +#endif /* __OVERLAY_PRIVATE_H__ */ diff --git a/source/blender/draw/engines/overlay/shaders/antialiasing_frag.glsl b/source/blender/draw/engines/overlay/shaders/antialiasing_frag.glsl index 386e6d9e141..4784d420e1d 100644 --- a/source/blender/draw/engines/overlay/shaders/antialiasing_frag.glsl +++ b/source/blender/draw/engines/overlay/shaders/antialiasing_frag.glsl @@ -147,4 +147,4 @@ void main() fragColor = mix(fragColor, fragColor / fragColor.a, blend); } #endif -}
\ No newline at end of file +} diff --git a/source/blender/draw/engines/overlay/shaders/antialiasing_vert.glsl b/source/blender/draw/engines/overlay/shaders/antialiasing_vert.glsl index 4f3c36c7bd7..8cf8ba121ed 100644 --- a/source/blender/draw/engines/overlay/shaders/antialiasing_vert.glsl +++ b/source/blender/draw/engines/overlay/shaders/antialiasing_vert.glsl @@ -8,4 +8,4 @@ void main() float y = float((v & 2) << 1); gl_Position = vec4(x - 1.0, y - 1.0, 1.0, 1.0); uvs = vec2(x, y) * 0.5; -}
\ No newline at end of file +} diff --git a/source/blender/draw/engines/overlay/shaders/extra_frag.glsl b/source/blender/draw/engines/overlay/shaders/extra_frag.glsl index 8a8ae8a9611..a2572f44e70 100644 --- a/source/blender/draw/engines/overlay/shaders/extra_frag.glsl +++ b/source/blender/draw/engines/overlay/shaders/extra_frag.glsl @@ -10,4 +10,4 @@ void main() { fragColor = finalColor; lineOutput = pack_line_data(gl_FragCoord.xy, edgeStart, edgePos); -}
\ No newline at end of file +} diff --git a/source/blender/draw/engines/overlay/shaders/extra_groundline_vert.glsl b/source/blender/draw/engines/overlay/shaders/extra_groundline_vert.glsl index 4b08ea587d4..738f0025f07 100644 --- a/source/blender/draw/engines/overlay/shaders/extra_groundline_vert.glsl +++ b/source/blender/draw/engines/overlay/shaders/extra_groundline_vert.glsl @@ -27,4 +27,4 @@ void main() #ifdef USE_WORLD_CLIP_PLANES world_clip_planes_calc_clip_distance(world_pos); #endif -}
\ No newline at end of file +} diff --git a/source/blender/draw/engines/overlay/shaders/extra_loose_point_frag.glsl b/source/blender/draw/engines/overlay/shaders/extra_loose_point_frag.glsl index 8784b6cd73a..c27061f8f97 100644 --- a/source/blender/draw/engines/overlay/shaders/extra_loose_point_frag.glsl +++ b/source/blender/draw/engines/overlay/shaders/extra_loose_point_frag.glsl @@ -15,4 +15,4 @@ void main() * the depth and creating mini-spheres. * Disabled as it has performance impact. */ // gl_FragDepth = gl_FragCoord.z + 1e-6 * fac; -}
\ No newline at end of file +} diff --git a/source/blender/draw/engines/overlay/shaders/extra_loose_point_vert.glsl b/source/blender/draw/engines/overlay/shaders/extra_loose_point_vert.glsl index 76a2678a50e..7e31bf966bc 100644 --- a/source/blender/draw/engines/overlay/shaders/extra_loose_point_vert.glsl +++ b/source/blender/draw/engines/overlay/shaders/extra_loose_point_vert.glsl @@ -17,4 +17,4 @@ void main() #ifdef USE_WORLD_CLIP_PLANES world_clip_planes_calc_clip_distance(world_pos); #endif -}
\ No newline at end of file +} diff --git a/source/blender/draw/engines/overlay/shaders/extra_point_vert.glsl b/source/blender/draw/engines/overlay/shaders/extra_point_vert.glsl index 14c03248981..537c55cf3f5 100644 --- a/source/blender/draw/engines/overlay/shaders/extra_point_vert.glsl +++ b/source/blender/draw/engines/overlay/shaders/extra_point_vert.glsl @@ -27,4 +27,4 @@ void main() #ifdef USE_WORLD_CLIP_PLANES world_clip_planes_calc_clip_distance(world_pos); #endif -}
\ No newline at end of file +} diff --git a/source/blender/draw/engines/overlay/shaders/extra_vert.glsl b/source/blender/draw/engines/overlay/shaders/extra_vert.glsl index a72c5adb691..92db27ea6dd 100644 --- a/source/blender/draw/engines/overlay/shaders/extra_vert.glsl +++ b/source/blender/draw/engines/overlay/shaders/extra_vert.glsl @@ -224,4 +224,4 @@ void main() #ifdef USE_WORLD_CLIP_PLANES world_clip_planes_calc_clip_distance(world_pos); #endif -}
\ No newline at end of file +} diff --git a/source/blender/draw/engines/overlay/shaders/extra_wire_frag.glsl b/source/blender/draw/engines/overlay/shaders/extra_wire_frag.glsl index 7e469aee18d..a2bc13ba443 100644 --- a/source/blender/draw/engines/overlay/shaders/extra_wire_frag.glsl +++ b/source/blender/draw/engines/overlay/shaders/extra_wire_frag.glsl @@ -28,4 +28,4 @@ void main() if (fract(dist / dash_width) > dash_factor) { discard; } -}
\ No newline at end of file +} diff --git a/source/blender/draw/engines/overlay/shaders/extra_wire_vert.glsl b/source/blender/draw/engines/overlay/shaders/extra_wire_vert.glsl index 933b9d65a5f..97183638a71 100644 --- a/source/blender/draw/engines/overlay/shaders/extra_wire_vert.glsl +++ b/source/blender/draw/engines/overlay/shaders/extra_wire_vert.glsl @@ -37,4 +37,4 @@ void main() #ifdef USE_WORLD_CLIP_PLANES world_clip_planes_calc_clip_distance(world_pos); #endif -}
\ No newline at end of file +} diff --git a/source/blender/draw/intern/draw_manager_text.c b/source/blender/draw/intern/draw_manager_text.c index 9462a0d8072..38e8544de07 100644 --- a/source/blender/draw/intern/draw_manager_text.c +++ b/source/blender/draw/intern/draw_manager_text.c @@ -526,4 +526,4 @@ void DRW_text_edit_mesh_measure_stats(ARegion *ar, } } } -}
\ No newline at end of file +} diff --git a/source/blender/editors/sculpt_paint/paint_image_2d.c b/source/blender/editors/sculpt_paint/paint_image_2d.c index 06d79b8a49d..bf198f70a67 100644 --- a/source/blender/editors/sculpt_paint/paint_image_2d.c +++ b/source/blender/editors/sculpt_paint/paint_image_2d.c @@ -1560,9 +1560,9 @@ static void paint_2d_canvas_free(ImagePaintState *s) } } -static void paint_2d_transform_mouse(ImagePaintState *s, const float in[2], float out[2]) +static void paint_2d_transform_mouse(View2D *v2d, const float in[2], float out[2]) { - UI_view2d_region_to_view(s->v2d, in[0], in[1], &out[0], &out[1]); + UI_view2d_region_to_view(v2d, in[0], in[1], &out[0], &out[1]); } static bool is_inside_tile(const int size[2], const float pos[2], const float brush[2]) @@ -1899,14 +1899,24 @@ void paint_2d_bucket_fill(const bContext *C, return; } + View2D *v2d = s ? s->v2d : &CTX_wm_region(C)->v2d; float uv_origin[2]; float image_init[2]; - paint_2d_transform_mouse(s, mouse_init, image_init); + paint_2d_transform_mouse(v2d, mouse_init, image_init); int tile_number = BKE_image_get_tile_from_pos(ima, image_init, image_init, uv_origin); - ImageUser *iuser = paint_2d_get_tile_iuser(s, tile_number); - if (!iuser) { - return; + + ImageUser local_iuser, *iuser; + if (s != NULL) { + iuser = paint_2d_get_tile_iuser(s, tile_number); + if (iuser == NULL) { + return; + } + } + else { + iuser = &local_iuser; + BKE_imageuser_default(iuser); + iuser->tile = tile_number; } ibuf = BKE_image_acquire_ibuf(ima, iuser, NULL); @@ -2125,8 +2135,8 @@ void paint_2d_gradient_fill( return; } - paint_2d_transform_mouse(s, mouse_final, image_final); - paint_2d_transform_mouse(s, mouse_init, image_init); + paint_2d_transform_mouse(s->v2d, mouse_final, image_final); + paint_2d_transform_mouse(s->v2d, mouse_init, image_init); sub_v2_v2(image_init, uv_origin); sub_v2_v2(image_final, uv_origin); diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c index c0c66a28ad9..c1172b0cea8 100644 --- a/source/blender/editors/space_image/image_ops.c +++ b/source/blender/editors/space_image/image_ops.c @@ -4419,7 +4419,7 @@ static void tile_fill_draw(bContext *UNUSED(C), wmOperator *op) void IMAGE_OT_tile_fill(wmOperatorType *ot) { /* identifiers */ - ot->name = "Fill tile"; + ot->name = "Fill Tile"; ot->description = "Fill the current tile with a generated image"; ot->idname = "IMAGE_OT_tile_fill"; diff --git a/source/creator/CMakeLists.txt b/source/creator/CMakeLists.txt index a7a816385ad..98cfe53592e 100644 --- a/source/creator/CMakeLists.txt +++ b/source/creator/CMakeLists.txt @@ -1049,7 +1049,7 @@ setup_liblinks(blender) # USD registry. # USD requires a set of JSON files that define the standard schemas. These # files are required at runtime. -if (WITH_USD) +if(WITH_USD) add_definitions(-DWITH_USD) install(DIRECTORY ${LIBDIR}/usd/lib/usd |