Inlining the functions is simpler nowadays, since there are utility
functions to copy spans and tag the mesh caches dirty. Also use an
array instead of a raw pointer for multires.
Resolves#103789
The issue was that bone colors are only specified with 3 channels (RGB),
but they're stored as 4 channels for some reason. So the fourth bogus
channel gets initialized to zero by default, which was then being
interpreted as zero alpha in some drawing modes.
This fixes the issue by ensuring that the fourth unused channel always
gets initialized to 255, and therefore can be validly interpreted as an
alpha channel.
Pull Request: https://projects.blender.org/blender/blender/pulls/115477
This utility was already duplicated in two places and planned to be used
more. While we should usually avoid creating arrays the size of the
indexed array (rather than the size of the mask), sometimes it does seem
to be the best option, and we're helped by the fact that most memory
stays unintialized for a small mask (allocating but not writing to memory
pages at all generally isn't too expensive).
Pull Request: https://projects.blender.org/blender/blender/pulls/115491
Description added in 9c2330d821.
It is unclear what "external" in this case means, why these asset
libraries are considered "normal" (are the others not "normal"?) and the
term "asset repository" is wrong (should be "asset library").
I think this isn't actually shown in the UI currently in fact.
Problem is the `UI_context_active_but_get()` lookup doesn't respect menu
regions, unlike the earier call to `UI_context_active_but_prop_get()`
(which is also used to validate the existence of an active button).
Using `UI_context_active_but_get_respect_menu()` instead would work, but
in fact the earlier lookup returns the active button if any, we just
didn't use that.
`wmDragActiveDropState` contains a `bContextStore` unique pointer, so
when constructing/destructing an object of this type `BKE_context.hh`
had to be included. It wouldn't be obvious why this include is necessary
in some cases. And the pointer is otherwise managed internally in the
source file, so the need for this include shouldn't bleed into other
files.
Make sure the unique pointer construction/destruction happens in the
translation unit of the source file that otherwise also manages it.
Avoids include in #107230.
New FCurves for bones were not automatically set to `FCURVE_COLOR_AUTO_RGB`
because the RNA path couldn't be resolved.
That was because the `PointerRNA` passed into the function points to the bone,
but the rna path is relative to the ID.
Fixed by resolving the path from the bones owner ID
Pull Request: https://projects.blender.org/blender/blender/pulls/115517
- Remove unnecessary exception if Py_CompileStringObject fails.
- Remove unnecessary PyErr_Occurred check if Py_CompileStringObject
succeeds (based on incorrect assumption from [0]).
- Pass closeit=1 to PyRun_FileExFlags so it's responsible for closing
the file before executing code.
- Remove unnecessary temporary ReportList.
[0]: b9f6d66328
Some Editors like the Filebrowser or Spreadsheet set up custom masks for
scrollbars (they dont cover the whole region width or height, some rows
or colums are excluded here -- e.g. the "index" column in the
Spreadsheet), this was working fine for drawing, but mouse interaction
was ignoring these custom masks.
Symptoms were that clicking on the "focus bubble" of the scrollbar and
dragging would not result in smooth scrolling [because internally code
would assume the mouse was clicking outside], instead scroll by 1 'page'
was happening [was perceived as a massive lag]. Especially noticable
with many rows/columns (where the "focus bubble" gets small).
So for drawing (`UI_view2d_scrollers_draw`) this wasnt a problem, masks
were passed in for `view2d_scrollers_calc`.
But for interaction (`scroller_activate_init`) `view2d_scrollers_calc`
is called again and a NULL mask was passed.
The already set up rects need to be considered though, otherwise coords
for `mouse_in_scroller_handle` later are not compatible.
To fix this, use existing `View2D` rects fors scrollbars, and pass a
union of those as `mask_custom` to `view2d_scrollers_calc`.
NOTE: this can temporarily extend the `View2D` scrollbar rect by a
pixel, the next draw call will correct this again though.
Pull Request: https://projects.blender.org/blender/blender/pulls/114631
Related commit: 82aa300e1c / 5596f7982182aa300e1c made it so that if only linked images are used, painting
would be prohibited. But since painting in Material mode actualy paints
across all materials it could happen that one particular image is linked
whereas another image isnt. In this case, painting on the linked image
would not be prohibited.
Two issues:
- [1] logic in above commit(s) seems slightly wrong, we could still pass
the check for linked images (also no image here should also not result
in a positive check I think).
- [2] code in `project_paint_prepare_all_faces` would still work with
linked images in slots, so
-- `ProjPaintState` -> `image_tot` was incremented
-- `ProjPaintImage` was created
-- this then ends up in the undo push - and crashes on undo
So now [1] is rectified and for [2] we skip faces with associated linked
images.
In addition, slots with linked images are now also greyed out in the UI
(`VIEW3D_PT_slots_projectpaint`) to give some sort of hint. For the
future it would probably also be good to dissallow selection of such
paint slots, but that is for another commit.
Pull Request: https://projects.blender.org/blender/blender/pulls/115263
Workaround potential C-API `FILE` incompatibility by reading the
file data into memory, compiling & running it - matching existing logic
for text buffers text buffers. This replaces the in-lined stub-script
that re-opened the file from Python.
While the down-side of the stub-script was minor, it required some
non-obvious logic and had the disadvantage of requiring 2x scripts to
execute whenever a file was executed on WIN32.
Expose BLI_file_read_data_as_mem_from_handle as a public function
since it's useful to be able to read an existing FILE into memory.
Passing a directory to --python would run it as a script without errors
since the directory would read as an empty file.
Raise an error instead because this is what Python it's self does.
This would already happen on WIN32 because the stub script was
executing the file from Python.
This effectively reverts [0] which required the installed Blender
along with the `bpy` module to load for the install target to generate
the man-page. It turns out running a full Blender at install time can be
quite involved.
Now the man-page generator runs `blender --help` & `blender --version`,
converting the output into a man-page from a Python script.
Some minor changes have also been made:
- Use PYTHON_EXECUTABLE so the systems Python
(which may not be compatible) isn't used.
- Remove leading blender version from the description
which was unintentionally being included.
[0]: 61d99d450e
Resolves#115090, where exceptions from the text editor called
`sys.excepthook` in v3.6 but not in v4.0.
The error was caused by PyC_ExceptionBuffer calling PyErr_Display
instead of PyErr_Print.
While technically a regression in [0], the behavior in 3.6x wasn't
working properly either since a user-defined `sys.excepthook` could
prevent PyC_ExceptionBuffer from accessing the exception text.
Resolve with the following changes:
- BPy_errors_to_report has been updated not to print errors.
Previously BPy_errors_to_report would *sometimes* print the error,
which complicated situations where the caller wanted predictable
behavior (always printing or never printing).
- `PyErr_Print()` must be used to display errors to the output,
this will call `sys.excepthook` as it used to.
It's better not to rely on side effects of BPy_errors_to_report()
for error handling.
[0]: 6a0f98aeef
After VFont has been updated to use the BLF API in 604ee2d036, it can
use the fallback font stack and display text in many scripts.
This change means the default text for font objects can now be
translated, instead of always being the English word 'Text'.
Translation will only occur if the user has enabled translation of new
data in the preferences.
The UsdTransform2d shader was previously ignored, and the material
read would stop when it found these nodes. This resulted in many
surfaces having their textures mapped incorrectly when imported
into Blender, and worse, resulted in the loss of that data when
round-tripping back out of Blender.
This patch adds support for the Transform 2D node and also ensures
that the wrap modes are similarly written correctly.
Co-authored-by: Charles Wardlaw <kattkieru@users.noreply.github.com>
Pull Request: https://projects.blender.org/blender/blender/pulls/114821
The node is still a bit non-standard in that it resizes an existing
mesh rather than creating a new one, but this commit makes the extrude
node a bit more similar to other mesh operations and makes other
miscellaneous improvements, including:
- Less use of intermediate states (compared to initial or final)
- Topology map building is no longer reimplemented for the node
- Attribute interpolation happens in a more familiar way
- Some topology maps can be skipped if a domain is empty
- More use of `IndexMask` instead of an array of indices
- Logarithmic cost index mask lookup is avoided
- Build index maps instead of implementing attribute propagation
separately for every type
Overall these changes might improve performance in a few cases, and
they reduce Blender's binary size by 58 KB. Edge indices are different
in some cases of the edge mode, so the test files are updated.
Implement the next phases of bounds improvement design #96968.
Mainly the following changes:
Don't use `Object.runtime.bb` for performance caching volume bounds.
This is redundant with the cache in most geometry data-block types.
Instead, this becomes `Object.runtime.bounds_eval`, and is only used
where it's actually needed: syncing the bounds from the evaluated
geometry in the active depsgraph to the original object.
Remove all redundant functions to access geometry bounds with an
Object argument. These make the whole design confusing, since they
access geometry bounds at an object level.
Use `std::optional<Bounds<float3>>` to pass and store bounds instead
of an allocated `BoundBox` struct. This uses less space, avoids
small heap allocations, and generally simplifies code, since we
usually only want the min and max anyway.
After this, to avoid performance regressions, we should also cache
bounds in volumes, and maybe the legacy curve and GP data types
(though it might not be worth the effort for those legacy types).
Pull Request: https://projects.blender.org/blender/blender/pulls/114933
This adds a new function, `compare_meshes`,
as a replacement for `BKE_mesh_cmp`.
The main benefits of the new version are the following:
- The code is written in c++, and makes use of the new attributes API.
- It adds an additional check, to see if the meshes only differ by
their indices. This is useful to verify correctness of new algorithmic
changes in mesh code, which might produce mesh elements in a different
order than the original algorithm. The tests will still fail, but the
error will show that the indices changed.
Some downsides:
- The code is more complex, due to having to be index-independent.
- The code is probably slower due to having to do comparisons "index-
independently". I have not tested this, as correctness was my priority
for this patch. A future update could look to improve the speed,
if that is desired.
- This is technically a breaking API change, since it changes the
returned values of `rna_Mesh_unit_test_compare`. I don't think that
there are many people (if any) using this, besides our own unit tests.
All tests that pass with `BKE_mesh_cmp` still pass with the new version.
**NOTE:**
Currently, mesh edge indices are allowed to be different in the
comparison, because `BKE_mesh_cmp` also allowed this. There are some
tests which would fail otherwise. These tests should be updated, and
then the corresponding code as well.
I wrote up a more detailed explanation of the algorithm here:
https://hackmd.io/@bo-JY945TOmvepQ1tAWy6w/SyuaFtay6
Pull Request: https://projects.blender.org/blender/blender/pulls/112794
The ImplicitSharingPtr has an implicit constructor for raw pointers.
This has unintended effects when comparing an ImplicitSharingPtr to a
raw pointer: The raw pointer is implicitly converted to the shared
pointer (without change in refcount) and when going out of scope will
decrement user count, eventually freeing the data.
Conversion from raw pointer to shared pointer should not happen
implicitly. The constructor is made explicit now. This requires a little
more boilerplate when constructing a sharing pointer. A special
constructor for the nullptr is added so comparison with nullptr can
still happen without writing out a constructor.
Pull Request: https://projects.blender.org/blender/blender/pulls/115476
Nowadays we have the loose edge cache which can tell us if there will be
any loose edges to subdivide. This means the topology map creation that
included multi-threading doesn't need to be behind a lock anymore.
Pull Request: https://projects.blender.org/blender/blender/pulls/115480
The `paint_init_pivot` calculates the `location` based
on the midpoint of the bounds of the object. For grease pencil
the bounds depend on the current frame (for original data).
This fixes the issue by making the `bounds_min_max` function
dependent on the `frame` and by introducing a `bounds_min_max_eval`
for evaluated data.
The `eval_frame` was not initialized to a default value,
causing a crash in some situations on windows.
This at least avoids a crash even if the outcome of
whatever uses the `eval_frame` might not be correct.
We should use explicit casting. Although it is not always needed it
is a best practise in order to support the shaders on Metal.
* `float max(float, int)` is not supported on Metal and fails with a compilation error
Pull Request: https://projects.blender.org/blender/blender/pulls/115464
Track the last time an object or its dependencies were evaluated by the
dependency graph.
These values can be compared against DEG_get_update_count().
Implemented following the design from #114112
Pull Request: https://projects.blender.org/blender/blender/pulls/115196