Brushstroke Tools: Initial Version #328

Merged
Simon Thommes merged 229 commits from SimonThommes/blender-studio-tools:brushstroke_tools-initial-version into main 2024-11-06 15:03:47 +01:00
Showing only changes of commit 0c79e32b1b - Show all commits

View File

@ -34,7 +34,11 @@ def find_context_brushstrokes(dummy):
idx = len(settings.context_brushstrokes)-1 idx = len(settings.context_brushstrokes)-1
if not settings.context_brushstrokes: if not settings.context_brushstrokes:
return return
if len_prev == len(settings.context_brushstrokes): if context.object:
for i, bs in enumerate(settings.context_brushstrokes):
SimonThommes marked this conversation as resolved Outdated

Generally, the code would be easier to read if line lengths were more limited. E.g. for Blender we have a 120 line length limit. That also makes it easier to have two files open next to each other. Such limits can be enforced automatically with auto-formatters like autopep8 (what we currently use in Blender) or e.g. black.

Generally, the code would be easier to read if line lengths were more limited. E.g. for Blender we have a 120 line length limit. That also makes it easier to have two files open next to each other. Such limits can be enforced automatically with auto-formatters like `autopep8` (what we currently use in Blender) or e.g. `black`.
if bs.name == context.object.name:
settings.active_context_brushstrokes_index = i
elif len_prev == len(settings.context_brushstrokes):
settings.active_context_brushstrokes_index = idx settings.active_context_brushstrokes_index = idx
settings.active_context_brushstrokes_index = max(min(settings.active_context_brushstrokes_index, len(settings.context_brushstrokes)-1), 0) settings.active_context_brushstrokes_index = max(min(settings.active_context_brushstrokes_index, len(settings.context_brushstrokes)-1), 0)