Commit Graph

104971 Commits

Author SHA1 Message Date
Hans Goudey
63af8dbfca Multires: Use IndexMask for Subdiv CCG face updates
These updates are used to recalculate normals and average values between
grid boundaries during multires sculpting. In main the affected faces
are passed as an array of pointers. Using an `IndexMask` instead reduces
memory usage by 4x per affected face (8 byte pointer to 2 byte integer),
simplifies iteration and threading, and can also improve performance.
Finding which faces are affected is now multithreaded, with its runtime
changing from 0.63 ms to 0.12 ms in a simple test sculpting on a portion
of a 1 million face grid.

Also switch to VectorSet instead of GHash for finding affected adjacent
elements. That's a friendlier data structure that probably has better
performance as well.
2023-11-29 11:10:08 -05:00
Hans Goudey
dfc6b1deb6 Cleanup: Use C++ threading API in subdiv_ccg.cc
Allows removing various structs for passing around arguments,
and simplifies the use of thread-local storage.
2023-11-29 10:35:21 -05:00
Hans Goudey
c28cb3d0ac Cleanup: Remove unused curve positions variable 2023-11-29 10:35:21 -05:00
Germano Cavalcante
db3d59d94d Fix #115570: Crash when using snap to volume and clipping region
`ED_view3d_win_to_ray_clipped_ex` requires `ray_end` when
`do_clip_planes` is true.

Since the snap code uses `ray_depth` instead of `ray_end`, the solution
is to always calculate the `ray_end` and convert to `ray_depth` when
necessary.
2023-11-29 12:33:08 -03:00
Lukas Tönne
5bc82b5b7c Geometry Nodes: Remove experimental volume nodes
The new grid socket (#115270) will make these nodes obsolete and
provide more elegant ways of implementing the features. Removing
these nodes now to clean up and make future changes simpler.

Pull Request: https://projects.blender.org/blender/blender/pulls/115567
2023-11-29 16:02:06 +01:00
Miguel Pozo
21712cf746 Fix: EEVEE-Next: Object::visibility_flag in material_sync
Take `OB_HIDE_SHADOW` into account. (fix #115488)
Include the relevant visibility flags into `MaterialKey`.

Pull Request: https://projects.blender.org/blender/blender/pulls/115575
2023-11-29 15:44:15 +01:00
Hans Goudey
aa2cdf283a Cleanup: Use proper type for subdiv CCG faces 2023-11-29 08:47:58 -05:00
Jacques Lucke
7c1a0e57ca Cleanup: remove unused code 2023-11-29 14:35:04 +01:00
Iliya Katueshenock
2ce4c4e8d2 Fix #115548: Missed sort after multithreaded algorithm
To make sure result is deterministic, sorting is used.
This was missed in one of last speedup.

Pull Request: https://projects.blender.org/blender/blender/pulls/115568
2023-11-29 14:16:37 +01:00
Jacques Lucke
7a7b7196f9 Geometry Nodes: extract global data passed to a geometry nodes invocation to separate struct
This avoids some duplication between the modifier and operator evaluation
contexts and also makes it easier to make independent from a specific
evaluation context (so e.g. the simulation nodes code shouldn't care whether
it's used from a modifier or operator.

Pull Request: https://projects.blender.org/blender/blender/pulls/115512
2023-11-29 13:22:20 +01:00
casey bianco-davis
1970de9d19 GPv3: Fix #113994: Overlay: Hide points for locked layers.
This makes so that locked layers don't show the points and the lines aren't visibly selected.

This separate the batch ensure function into two function, one for handling the visible grease pencil batch and one for handling the edit mode overlay batch.

This also makes it so that only selected curves show the points that make up it, (this matches legacy grease pencil).

Pull Request: https://projects.blender.org/blender/blender/pulls/114751
2023-11-29 11:31:50 +01:00
Campbell Barton
807993d2b7 Cleanup: use single underscore prefixes
Double underscores are reserved for implementation macros.
2023-11-29 18:09:01 +11:00
Campbell Barton
a144fcfa50 Cleanup: declare values for enums that may be written into blend files 2023-11-29 17:37:04 +11:00
Campbell Barton
c7593cc99f Cleanup: replace MAX2 with std::max 2023-11-29 17:11:09 +11:00
Campbell Barton
3a01ba9a39 Cleanup: avoid STR_ELEM expanding into multiple function calls
Also add note since hard coded property name checks are generally
worth avoiding.
2023-11-29 16:33:01 +11:00
Campbell Barton
a385a98e8e Cleanup: spelling in comments 2023-11-29 15:56:17 +11:00
Campbell Barton
b12edbcb9c Cleanup: format 2023-11-29 15:47:19 +11:00
Campbell Barton
44d6995b4c Cleanup: make hash sizes static, remove references to smallhash
Remove BLI_ghash_hash_sizes declaration it's only user (smallhash)
has been removed.
2023-11-29 15:13:05 +11:00
Hans Goudey
09caf59690 Fix #115298: Sculpt mask removed with undo involving mode change
Because reading memfile undo steps doesn't send the mesh through the
versioning code that converts legacy layers back to the new generic
format, we can't write the old format in undo steps. This same check
existed during the mesh struct of array refactor.
2023-11-28 16:58:45 -05:00
Hans Goudey
c083b3b8d2 Cleanup: Remove outdated normals comment for mesh validation
The validation function doesn't handle normals anymore,
since they are calculated lazily at runtime.
2023-11-28 16:50:52 -05:00
Hans Goudey
19b9b8d431 Cleanup: Move mesh looptri real edges function 2023-11-28 16:49:55 -05:00
Hans Goudey
aca27e5462 Cleanup: Store BVH and shrinkwrap data with C++ types 2023-11-28 16:40:43 -05:00
Hans Goudey
9271949f7b Cleanup: Remove unnecessary keywords from newly C++ headers 2023-11-28 16:13:09 -05:00
Hans Goudey
7e3ba529ea Cleanup: Move four blenkernel headers to C++ 2023-11-28 16:05:12 -05:00
Hans Goudey
991486c37f Cleanup: Remove/replace SmallHash data structure
Use blender::Set which is similar but offsers better type safety
and likely better performance as well. The only remaining user
was the mesh edit mode knife tool, and replacing that usage
with `Set` and `Map` was straightforward.
2023-11-28 14:03:53 -05:00
Hans Goudey
7020a4ff1a Cleanup: Remove unused voxel sampling functions
Last used in Blender internal renderer.
2023-11-28 13:30:18 -05:00
Hans Goudey
573b4728cb Cleanup: Remove unused BLI voronoi code
Unused after 75c947a467
2023-11-28 13:24:45 -05:00
Habib Gahbiche
ff083c1595 Compositor: UI: better node visibility for default node tree
Create default compositor node tree centred around x-axis, and with lower y-offset for better visibility

Pull Request: https://projects.blender.org/blender/blender/pulls/115439
2023-11-28 18:45:37 +01:00
Hans Goudey
81abaaad6b Fix #115521: Voxel remesh resets smooth with attribute propagation off
Add a special case for the sharp_face attribute to use the sharpness
of the first face, the same as before ba1c8fe6a5
2023-11-28 12:45:14 -05:00
Hans Goudey
321c1af26e Cleanup: Remove unnecessary mesh C-API functions 2023-11-28 12:26:51 -05:00
Hans Goudey
f2467f75b3 Cleanup: Remove mesh "vert coords" functions
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
2023-11-28 12:26:51 -05:00
Nathan Vegdahl
32e56879b7 Fix: missed some version bump code 2023-11-28 18:12:21 +01:00
Nathan Vegdahl
c9093332e0 Fix #115434: custom bone colors invisible in stick mode
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
2023-11-28 18:04:11 +01:00
Hans Goudey
21a2390f4c BLI: Add utility to reverse index mask
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
2023-11-28 17:32:17 +01:00
Hans Goudey
ed23989e2e Geometry Nodes: Remove drag & drop requirement of geometry input
Generator node groups don't need to have a geometry input, and the error
will be displayed in the modifier after it's added if it really matters.
2023-11-28 11:06:54 -05:00
Antonio Vazquez
b9fba005bd GPv3: Lock unselect materials operator
Conversion of GPv2 operator

Pull Request: https://projects.blender.org/blender/blender/pulls/115278
2023-11-28 16:38:59 +01:00
Julian Eisel
86362f14f9 UI: Improve description of custom asset library type
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.
2023-11-28 16:22:30 +01:00
Julian Eisel
0156169a9c Fix #115431: Crash on right click on string button inside menu
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.
2023-11-28 16:03:01 +01:00
Julian Eisel
e3b3399bcb Cleanup: Add constructor/destructor for drag data to avoid includes
`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.
2023-11-28 15:26:39 +01:00
Christoph Lendenfeld
265aebd7be Fix: FCurve colors on bones
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
2023-11-28 13:29:46 +01:00
Campbell Barton
d96cdb2231 Cleanup: simplify Python API use running scripts
- 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
2023-11-28 22:33:09 +11:00
Philipp Oeser
ed556113ce Fix #114557: UI scrollbar "focus bubble" interaction wrong in cases
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
2023-11-28 12:12:18 +01:00
Philipp Oeser
a4b8d214c6 Fix #115140: Crash undoing painting on linked image from 3DView
Related commit: 82aa300e1c / 5596f79821

82aa300e1c 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
2023-11-28 12:05:07 +01:00
Philipp Oeser
09be0915c3 Fix #115363: Scrollbars for template_lists in popups update issue
Scrollbars in popups need UI layout refresh to update the right items to
show correctly.

Pull Request: https://projects.blender.org/blender/blender/pulls/115364
2023-11-28 09:14:28 +01:00
Philipp Oeser
451a765ab3 Fix #115471: Crash opening files with particle boid goal objects
Exposed/caused by b53c7a804a

`particle_settings_foreach_id` only processed object IDs for `avoid`
(but not `goal`) -- `BoidRuleGoalAvoid` is used for both though.

Pull Request: https://projects.blender.org/blender/blender/pulls/115482
2023-11-28 09:11:11 +01:00
Campbell Barton
41739cd3fd PyAPI: remove use of stub script to execute files on WIN32
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.
2023-11-28 17:50:28 +11:00
Campbell Barton
48bc74953c PyAPI: raise an error when executing a directory on non-Windows systems
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.
2023-11-28 17:40:07 +11:00
Campbell Barton
d71c449d25 PyAPI: use binary file access running scripts on non-WIN32 platforms
Python itself uses binary file access when opening files so this
shouldn't cause any problems.
2023-11-28 16:59:52 +11:00
Campbell Barton
5486c70aae Fix #115056: man-page fails to build with non-portable install
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
2023-11-28 16:55:53 +11:00
Campbell Barton
9dda667fd4 Cleanup: spelling in comments 2023-11-28 15:19:20 +11:00