Changed the menu operators:
Expand Mask by Topology (hotkey Shift A)
Expand Mask by Normals (hotkey Shift Alt A)
Expand Face Set by Topology (hotkey Shift W)
Expand Active Face Set (hotkey Shift Alt W)
so that their hotkeys would appear in their menu entries.
Resolves#104023
Co-authored-by: DisquietingFridge <30654622+DisquietingFridge@users.noreply.github.com>
Pull Request: blender/blender#104568
This patch fixes T103393 by undefining `__LIGHT_TREE__` on Metal/AMD as it has an unexpected & major impact on performance even when light trees are not in use.
Patch authored by Prakash Kamliya.
Reviewed By: brecht
Maniphest Tasks: T103393
Differential Revision: https://developer.blender.org/D17167
The merge down operator was sometimes copying the wrong frame, which altered the animation.
While merging the layers, it is sometimes needed to duplicate a keyframe,
when the lowest layer does not have a keyframe but the highest layer does.
Instead of duplicating the previous keyframe of the lowest layer, the code
was actually duplicating the active frame of the layer which was the current frame in the timeline.
This patch fixes the issue by setting the previous keyframe of the layer as its active frame before duplication.
Related issue: T104371.
Differential Revision: https://developer.blender.org/D17214
Mutex locks for manipulating GHOST_System::m_timerManager from
GHOST_SystemWayland relied on WAYLAND being the only user of the
timer-manager.
This isn't the case as timers are fired from
`GHOST_System::dispatchEvents`.
Resolve by using a separate timer-manager for wayland key-repeat timers.
Resolve a thread safety issue reported by valgrind's helgrind checker,
although I wasn't able to redo the error in practice.
NULL check on the key-repeat timer also needs to lock, otherwise it's
possible the timer is set in another thread before the lock is acquired.
Now all key-repeat timer access which may run from a thread
locks the timer mutex before any checks or timer manipulation.
There were two errors with the function used to convert face sets
to the legacy mesh format for keeping forward compatibility:
- It was moved before `CustomData_blend_write_prepare` so it
operated on an empty span.
- It modified the mesh when it's only supposed to change the copy
of the layers written to the file.
Differential Revision: https://developer.blender.org/D17210
This implements two optimizations:
* If the duplication count is constant, the offsets array can be
filled directly in parallel.
* Otherwise, extracting the counts from the virtual array is parallelized.
But there is still a serial loop over all elements in the end to compute
the offsets.
In the unlikely case an area could not be created OPERATOR_CANCELLED
was returned, this has the same value of WM_HANDLER_HANDLED however
break is logical in this situation and both flags work.
If GetFileAttributesW returns an error, only debug assert if the reason
is file not found.
See D17204 for more details.
Differential Revision: https://developer.blender.org/D17204
Reviewed by Ray Molenkamp
Allow preview region to change cursor as per the selected tool
Reviewed by: campbellbarton, ISS
Differential Revision: https://developer.blender.org/D16878
This makes the code more readable.
In this commit also the `int curr_side_unclamp` member was moved to
`EdgeSlideParams` as it is a common value for all "Containers".
There was an inconsistency between geometry sample nodes and mesh/curve
sample nodes, where the latter didn't have a special "Sample" category,
and we categorized as "Operations", which they were not. Also put the
sample category between "Read" and "Write" since the verb name is
more consistent and sampling is an advanced form of reading.
In some cases panels without headers were drawn too wide in sidebars
with region overlap.
Instead of always using the maximum width the view allows, headerless
panels now also use the width calculated in
`panel_draw_width_from_max_width_get`. The function already returns the
correct width in all cases and also takes care of insetting the panels,
when their backdrop needs to be drawn, which is necessary for headerless
panels, too, when there is region overlap.
Reviewed By: Hans Goudey
Differential Revision: http://developer.blender.org/D17194
This is both a cleanup and a preparation for the Principled v2 changes.
Notable changes:
- Clearcoat weight is now folded into the closure weight, there's no reason
to track this separately.
- There's a general-purpose helper for computing a Closure's albedo, which is
currently used by the denoising albedo and diffuse/gloss/transmission color
passes.
- The d/g/t color passes didn't account for closure albedo before, this means
that e.g. metallic shaders with Principled v2 now have their color texture
included in the glossy color pass. Also fixes T104041 (sheen albedo).
- Instead of precomputing and storing the albedo during shader setup, compute
it when needed. This is technically redundant since we still need to compute
it on shader setup to adjust the sample weight, but the operation is cheap
enough that freeing up the storage seems worth it.
- Future changes (Principled v2) are easier to integrate since the Fresnel
handling isn't all over the place anymore.
- Fresnel handling in the Multiscattering GGX code is still ugly, but since
removing that entirely is the next step, putting effort into cleaning it up
doesn't seem worth it.
- Apart from the d/g/t color passes, no changes to render results are expected.
Differential Revision: https://developer.blender.org/D17101
Useful for validating changes when sampling/noise changes:
- First run with BLENDER_TEST_UPDATE=1 and e.g. CYCLESTEST_SPP_MULTIPLIER=32
- Apply your change
- Run with only CYCLESTEST_SPP_MULTIPLIER=32
- Compare
- Reset the SVN repo
Differential Revision: https://developer.blender.org/D17107
Cycles ignores the size of spot lights, therefore the illuminated area doesn't match the gizmo. This patch resolves this discrepancy.
| Before (Cycles) | After (Cycles) | Eevee
|{F14200605}|{F14200595}|{F14200600}|
This is done by scaling the ray direction by the size of the cone. The implementation of `spot_light_attenuation()` in `spot.h` matches `spot_attenuation()` in `lights_lib.glsl`.
**Test file**:
{F14200728}
Differential Revision: https://developer.blender.org/D17129
Own mistake in d204830107.
For some buttons the type is changed after construction, which means the button
has to be reconstructed. For example number buttons can be turned into number
slider buttons this way. New code was unintentionally overriding the button
type after reconstruction with the old type again.
Use the `SharedCache` concept introduced in D16204 to share lazily
calculated evaluated data between original and multiple evaluated
curves data-blocks. Combined with D14139, this should basically remove
most costs associated with copying large curves data-blocks (though
they add slightly higher constant overhead). The caches should
interact well with undo steps, limiting recalculations on undo/redo.
Options for avoiding the new overhead associated with the shared
caches are described in T104327 and can be addressed separately.
Simple situations affected by this change are using any of the following data
on an evaluated curves data-block without first invalidating it:
- Evaluated offsets (size of evaluated curves)
- Evaluated positions
- Evaluated tangents
- Evaluated normals
- Evaluated lengths (spline parameter node)
- Internal Bezier and NURBS caches
In a test with 4m points and 170k curves, using curve normals in a
procedural setup that didn't change positions procedurally gave 5x
faster playback speeds. Avoiding recalculating the offsets on every
update saved about 3 ms for every sculpt update for brushes that don't
change topology.
Differential Revision: https://developer.blender.org/D17134
This will add a proper modal keymap for the node link drag operator.
It allows the user to customize the keys used to start drag and so on.
Also it gets rid of the custom status bar message.
Differential Revision: https://developer.blender.org/D17190
No user-visible changes expected.
Essentially, this makes it possible to use C++ types like `std::function`
inside `uiBut`. This has plenty of benefits, for example this should help
significantly reducing unsafe `void *` use (since a `std::function` can hold
arbitrary data while preserving types).
----
I wanted to use a non-trivially-constructible C++ type (`std::function`) inside
`uiBut`. But this would mean we can't use `MEM_cnew()` like allocation anymore.
Rather than writing worse code, allow non-trivial construction for `uiBut`.
Member-initializing all members is annoying since there are so many, but rather
safe than sorry. As we use more C++ types (e.g. convert callbacks to use
`std::function`), this should become less since they initialize properly on
default construction.
Also use proper C++ inheritance for `uiBut` subtypes, the old way to allocate
based on size isn't working anymore.
Differential Revision: https://developer.blender.org/D17164
Reviewed by: Hans Goudey
Currently this conversion (which happens when using modifiers in edit
mode, for example) is completely single threaded. It's harder than some
other areas to multithread because BMesh elements don't always know
their indices (and vise versa), and because the dynamic AoS format
used by BMesh makes some typical solutions not helpful.
This patch proposes to split the operation into two steps. The first
updates the indices of BMesh elements and builds tables for easy
iteration later. It also checks if some optional mesh attributes
should be added. The second uses parallel loops over all elements,
copying attribute values and building the Mesh topology.
Both steps process different domains in separate threads (though the
first has to combine faces and loops). Though this isn't proper data
parallelism, it's quite helpful because each domain doesn't affect the
others.
**Timings**
I tested this on a Ryzen 7950x with a 1 million face grid, with no
extra attributes and then with several color attributes and vertex
groups.
| File | Before | After |
| Simple | 101.6 ms | 59.6 ms |
| More Attributes | 149.2 ms | 65.6 ms |
The optimization scales better with more attributes on the BMesh. The
speedup isn't as linear as multithreading other operations, indicating
added overhead. I think this is worth it though, because the user is
usually actively interacting with a mesh in edit mode.
See the differential revision for more timing information.
Differential Revision: https://developer.blender.org/D16249
Whenever a transform operation is activated by gizmo, the gizmo
modal is maintained, but its drawing remains the same even if the
transform mode or constrain is changed.
So update the gizmo according to the mode or constrain set.
NOTE: Currently only 3D view gizmo is affected
The operator has the option to add to selected FCurves instead
of only the active, but it was only exposed in the redo panel.
This patch adds the operator to the right-click menu on FCurve channels,
and to the channel menu in the Graph editor.
Both times with configured to add to selected
instead of only the active FCurve
Revied by Reviewed by: Sybren A. Stüvel
Differential Revision: https://developer.blender.org/D17066
Ref: D17066
Implements T103858: in OBJ importer and exporter, and in Collada
exporter, present axis choices as a dropdown instead of inline button
row.
Reviewed By: Bastien Montagne
Differential Revision: https://developer.blender.org/D17186
- Replace type annotations with doc-strings, the current conventions is
not to use type annotations in startup scripts.
- Replace abbreviation "idx" with "index" in public arguments/properties.
- Replace `len(..) > 0` with boolean checks.
- Add `__all__` to list public members.
- Use `arg` instead of `param` for doc-strings.
- Locate the doc-string so it shows as `__doc__`.
The recursion depth was checked for equality with a maximum depth,
allowing leaves with more primitives if a certain depth was reached.
However, a single leaf must always use the same material (including
set_smooth), so if a leaf contained multiple materials it was split
anyway. This meant that in the next recursion step the depth was
larger than the cutoff value and it would go back to recursing until
the number of primitives was small enough, ignoring the recursion
depth for the rest of the process.
In certain edge cases this could lead to a stack overflow.
Even with the check changed from 'equality' to 'larger or equal'
this could still fail in the pathological case where every primitive
has another material. But that can't be helped, and it wouldn't
realistically happen either.
Differential Revsision: https://developer.blender.org/D17188
Straightforward port. I took the oportunity to remove some C vector
functions (ex: `copy_v2_v2`).
This makes some changes to DRWView to accomodate the alignement
requirements of the float4x4 type.
This declaration change tells the evaluation system that the radius
field is evaluated on the input geometry. Which in turn means that
attributes referenced by the radius field should be propagated to
the geometry.
After Win32 API call GetFileAttributesW, check for
INVALID_FILE_ATTRIBUTES, which is returned on error,
usually if file not found.
See D17176 for more details.
Differential Revision: https://developer.blender.org/D17176
Reviewed by Ray Molenkamp
The declaration of group nodes using unavailable linked groups contains
a `skip_updating_sockets` tag, which indicates that the node shouldn't
change. This information was not used properly further down the line.
Versioning code in `do_versions_after_linking_260` inserted new group input
and output nodes. And (reasonably?) expected sockets to exist on those nodes.
However, `nodeAddStaticNode` did not initialize sockets on nodes with that use
`declare_dynamic` yet. This patch changes it so that `declare_dynamic` is used
in more places, which caused issues during file loading when node groups are
updated in somewhat arbitrary order (not in an order that is based on which
groups use which).
Differential Revision: https://developer.blender.org/D17183
Adds two operators to select linked vertices in weight paint mode.
Similar to how it works in edit mode.
Press "L" to select vertices under the cursor,
or CTRL + "L" to select anything linked to the current selection.
Reviewed by: Sybren A. Stüvel, Hans Goudey, Marion Stalke
Differential Revision: https://developer.blender.org/D16848
Ref: D16848
`ED_GIZMO_CAGE2D_STYLE_CIRCLE` now draw circles. The previous `ED_GIZMO_CAGE2D_STYLE_CIRCLE`, which drew rectangles, is renamed to `ED_GIZMO_CAGE2D_STYLE_RECTANGLE`. The meaning of `ED_GIZMO_CAGE2D_STYLE_BOX` is now unclear and probably needs to be renamed too.
Ref T104280
Maniphest Tasks: T104280
Differential Revision: https://developer.blender.org/D17174
Remove some assumptions that an FCurve with a single keyframe always is
extrapolated in constant fashion. There's no reason for the Beziér handles
to be ignored in such a case.
FCurve evaluation already worked properly, it was just the drawing in the
graph editor and the selectability of the handles that needed adjustments.
Test case is a smaller step towards supporting Vulkan. Other
test cases rely on SSBOs as well so it is better to first satisfy
this step before handling the others.
Even though the dope sheet respects the pinned channels, it did not show the icon to interact with the pinned state.
This adds the icon to the dope sheet as well.
{F14178715}
Reviewed by: Sybren A. Stüvel
Differential Revision: https://developer.blender.org/D17061
Ref: D17061
n versioning, when converting CD_SCULPT_FACE_SETS to CD_PROP_INT32
the layers were not kept properly ordered by type.
This was discovered while investigating T104053
Differential Revision: D17165
Previously, having the "Encoding speed" set to "slowest" would choose
libaom-av1 first and librav1e second. This change makes Blender choose
librav1e first (and has a fallback to whatever other AV1 codec is
available if librav1e is not installed).
Addresses /T103849 on systems where librav1e codec available.
Reviewed By: sergey, ISS
Maniphest Tasks: T103849
Differential Revision: https://developer.blender.org/D17002
In the previous situation the message was shown for Apple devices.
But this is not correct and confusing.
- Apple with Metal backend are supported, OpenGL on Apple isn't
- Legacy devices on Windows or Linux are also not supported.
This change will check that the capabilities of the GPU match the
requirements to use Viewport compositor. Based on those capabilities
a message is shown and the panel is activated.
In File Browser, correct full path creation so that it works correctly
in recursive listings.
See D17175 for more details.
Differential Revision: https://developer.blender.org/D17175
Reviewed by Julian Eisel
Blender crashes when Simplify is enabled and set to 0.
This is because mesh_to_volume_grid returns nullptr at voxel size 0.
A simple null-check fixes this problem.
Differential Revision: https://developer.blender.org/D17122
`WM_modalkeymap_items_to_string` is expected to always return a string.
But in the special case of zero length, the returned string was not
terminated with `'\0'`.
This can cause problems with the header of the knife tool for example.
It always uses the returned string.
(This issue was observed when investigating T103804).
This reverts commit 11a9578a19.
Reverting this because there was a miscommunication between Simon and me. Shortly
before I committed the change, Simon noticed that there are cases when "Hide Value"
is checked to hide the value in a group node, but we still want to show the value
in the modifier.
Normals falloff mask is created inverted compared
to how other falloffs work. It's now un-inverted
in a final step at the end.
Also exposed the normals falloff smooth steps as
an RNA property.
When the "Hide Value" option of a group input is enabled, only its name
is displayed in group nodes. Modifiers should have the same behavior.
However, for modifiers, only showing the name does not make sense
when the user can't edit the value. Therefore the value is not shown at all.
The image manager used to handle OSL textures on the GPU by
default loads images after displacement is evaluated. This is a
problem when the displacement shader uses any textures, hence
why the geometry manager already makes the image manager
load any images used in the displacement shader graph early
(`GeometryManager::device_update_displacement_images`).
This only handled Cycles image nodes however, not OSL nodes, so
if any `texture` calls were made in OSL those would be missed and
therefore crash when accessed on the GPU. Unfortunately it is not
simple to determine which textures referenced by OSL are needed
for displacement, so the solution for now is to simply load all of
them early if true displacement is used.
This patch also fixes the result of the displacement shader not
being used properly in OptiX.
Maniphest Tasks: T104240
Differential Revision: https://developer.blender.org/D17162
Was using squared cosine instead of cosine. The problem is obvious for large spread angles.
|before|after
|{F14220946}|{F14220948}
The images are generating by returning `floor(spotmask)` in function `spot_attenuation()` in `lights_lib.glsl`.
Thoses are added for better component masking syntax.
This avoids the harder to read `float2(my_vec4)`.
This is not meant to be fully usable swizzling support but could be
extended in the future.
Straightforward port. I took the oportunity to remove some C vector
functions (ex: `copy_v2_v2()`).
Reviewed By: antoniov
Differential Revision: https://developer.blender.org/D17160
Reduces the GLSL to MSL translation stage of shader compilation from 120 ms to 5 ms for complex EEVEE materials. This manifests in faster overall compilations, and faster cache hits for secondary compilations, as the MSL variant is needed as a key.
Startup time is also improved for both first-run and second-run. Note that this change does not affect shader compilation times within the Metal API.
Also disables shader output to disk
Authored by Apple: Michael Parkin-White
Ref T96261
Depends on D16990
Reviewed By: fclem
Maniphest Tasks: T96261
Differential Revision: https://developer.blender.org/D17033
Replace texelFetch calls with a texture point-sample rather than a textureRead call. This increases texture cache utilisation when mixing between sampled calls and reads. Bounds checking can also be removed from these functions, reducing instruction count and branch divergence, as the sampler routine handles range clamping.
Authored by Apple: Michael Parkin-White
Ref T96261
Depends on D16923
Reviewed By: fclem
Maniphest Tasks: T96261
Differential Revision: https://developer.blender.org/D17021
Test results were generated from incorrect code.
Code was fixed, but test results weren't updated.
This patch updates the test results to match the implementation.
- `projection_perspective.w.w == 0.0`
Also minor changes in comments:
- Reference BLENDER_HISTORY_FILE instead of the literal file-name
(simplifies looking up usage).
- Use usernames in tags, as noted in code-style.
Authored by Sonny Campbell.
Currently when importing a USD file, some of the camera properties are
ignored, or the units are not converted correctly from USD world units.
On import we currently set the focal length, but not the camera sensor
size (horizontal and vertical aperture), so the camera field of view
is wrong. The sensor size information is in the USD file, but is ignored
for perspective cameras.
USD uses "tenth of a world unit" scale for some physical camera properties
like focal length and aperture.
https://graphics.pixar.com/usd/release/api/class_usd_geom_camera.html#UsdGeom_CameraUnits
I have added the UsdStage's metersPerUnit parameter to the ImportSettings
so the camera can do the required conversion on import. This will convert from
the USD file's world units to millimeters for Blender's camera settings.
Reviewed by: Sybren and makowalski.
Differential Revision: https://developer.blender.org/D16019
The `MultiDevice` implementation of `get_cpu_osl_memory` returns a
nullptr when there is no CPU device in the mix. As such access to that
crashed in `update_osl_globals`. But that only updates maps that are not
currently used on the GPU anyway, so can just skip that when the CPU
is not used for rendering.
Maniphest Tasks: T104216
The glsl files + create infos of shaders that are only used
during development where still being compiled into blender.
This isn't needed and shouldn't be included. This change will
only include them when WITH_GTEST and WITH_OPENGL_DRAW_TESTS are
enabled. All other cases those files will be skipped.
Resolve an issue where released buffers were returned to the reusable memory pool before GPU work associated with these buffers had been encoded. Usually release of memory pools is dependent on successful completion of GPU work via command buffer callbacks. However, if the pool refresh operation occurs between encoding of work and submission, buffer ref-count is prematurely decremented.
Patch also ensures safe buffer free lists are only flushed once a set number of buffers have been used. This reduces overhead of small and frequent flushes, without raising the memory ceiling significantly.
Authored by Apple: Michael Parkin-White
Ref T96261
Reviewed By: fclem
Maniphest Tasks: T96261
Differential Revision: https://developer.blender.org/D17118
Compute test case still used legacy API to construct
GLSL shaders. This change will migrate it to use the
GPUShaderCreateInfo's.
In preparation to run test-cases against non-opengl
back-ends.
Due to shader global scope emulation via class interface, global constant arrays in shaders are allocated in per-thread shader local memory. To reduce memory pressure, placing these constant arrays inside function scope will ensure they only reside within device constant memory. This results in a tangible 1.5-2x performance uplift for the specific shaders affected.
Authored by Apple: Michael Parkin-White
Ref T96261
Reviewed By: fclem
Maniphest Tasks: T96261
Differential Revision: https://developer.blender.org/D17089
Paths to vulkan libraries, paths and related components were
hardcoded in the platform cmake file. This patch separates
this by using adding CMake modules for Vulkan and ShaderC.
This change has only been applied to the macOs configuration as
that is currently our main platform for development. Other platforms
will be added during the development of the Vulkan back-end.
Metal backend does not support primtiive restart for point primtiives. Hence strip_restart_indices removes restart indices by swapping them to the end of the index buffer and reducing the length.
An edge-case existed where all indices within the index buffer were restarts and no valid swap-index would be found, resulting in a buffer underflow.
Authored by Apple: Michael Parkin-White
Ref T96261
Reviewed By: fclem
Maniphest Tasks: T96261
Differential Revision: https://developer.blender.org/D17088
This patch adds support for compilation and execution of GLSL compute shaders. This, along with a few systematic changes and fixes, enable realtime compositor functionality with the Metal backend on macOS. A number of GLSL source modifications have been made to add the required level of type explicitness, allowing all compilations to succeed.
GLSL Compute shader compilation follows a similar path to Vertex/Fragment translation, with added support for shader atomics, shared memory blocks and barriers.
Texture flags have also been updated to ensure correct read/write specification for textures used within the compositor pipeline. GPU command submission changes have also been made in the high level path, when Metal is used, to address command buffer time-outs caused by certain expensive compute shaders.
Authored by Apple: Michael Parkin-White
Ref T96261
Ref T99210
Reviewed By: fclem
Maniphest Tasks: T99210, T96261
Differential Revision: https://developer.blender.org/D16990
Recent changes in our GLSL libraries didn't compile on Vulkan. This
change reverts a compile directive that was removed, but required
in order to compile using the Vulkan backend.
Extract:
- EEVEE: Compiling Shaders (the same message exists in EEVEE Next, but
it uses string concatenation and I don't know yet how to deal with
those--see T92758)
Disambiguate:
- Pan (audio, camera)
- Box (TextSequence)
- Mix (noun in constraints, GP materials)
- Volume (object type, file system)
- Floor (math integer part, 3D viewport horizontal plane)
- Impossible to disambiguate the constraint name because
bConstraintTypeInfo doesn't have a context field.
- Show Overlay (in the sequence editor, use the same message as other
editors to avoid a confusion with the Frame Overlay feature, also
called "Show Overlay")
Additionally, fix a few issues reported by Joan Pujolar (@jpujolar)
in T101830.
Reviewed By: mont29
Differential Revision: https://developer.blender.org/D17114
When moving or linking an object to a collection, the report was not
properly translatable. In French for instance, it would give
nonsensical half-translated sentences such as "<Object> moved vers
<collection>", instead of "<Object> déplacé vers <collection>".
Instead, separate the report into the four possible translations (one
or multiple objects, linking or moving). This is very verbose and less
legible, but it ensure the sentences can be properly translated,
including plurals in languages which use grammatical agreement.
In addition, use BKE_collection_ui_name_get() to get the collection
name, because the Scene Collection's name is hardcoded, but it can be
localized.
Reviewed By: mont29
Differential Revision: https://developer.blender.org/D17112
This operator updates scene strip internal length to reflect target
scene length. Previously scene strip had to be deleted and added from
scratch. Scene strip length in timeline will not be changed.
The code removed here was intended to be an optimization that
avoids creating an additional node to join multiple attribute sets.
However, that optimization did not work, because it did not take
into account whether the single attribute set is required or not.
Allow to explicitly swap node links by pressing the alt-key while
reconnecting node links. This replaces the old auto-swapping based on
matching prefixes in socket names.
The new behavior works as follows:
* By default plugging links into already occupied (single input)
sockets will connect the dragged link and remove the existing one.
* Pressing the alt-key while dragging an existing node link from one
socket to another socket that is already connected will swap the
links' destinations.
* Pressing the alt-key while dragging a new node link into an already
linked socket will try to reconnect the existing links into another
socket of the same type and remove the links, if no matching socket
is found on the node. This is similar to the old auto-swapping.
Swapping links from or to multi input sockets is not supported.
This commit also makes the link drag tooltip better visible, when using
light themes by using the text theme color.
Reviewed By: Hans Goudey, Simon Thommes
Differential Revision: https://developer.blender.org/D16244
Most operations where strips are duplicated use `SEQ_animation` API,
which handles keyframe animation. Now drivers are handled as well.
When group of strips is duplicated and driver references other strip,
it will still reference original strip. However, this is much better,
than previous behavior, when strip duplication results in "transfer" of
driver from original strip to duplicated one.
Fixes T104141
Simplify `BM_uv_element_map_create` by using `BM_face_calc_area_uv_signed`.
Remove unused UV winding code in `BM_uv_vert_map_create`.
Fixes unlikely memory leak in `BKE_mesh_uv_vert_map_create`.
No functional changes.
Differential Revision: https://developer.blender.org/D17137
This adds a new operator: bpy.ops.mesh.flip_quad_tessellation()
This operator rotates the internal loops of the selected quads, allowing
the user to control tessellation without destructively altering the
mesh.
{F14201995}
This operator can be found in the "Face" menu (Ctrl+F) under "Face
Data".
{F14201997}
Reviewed By: campbellbarton, dbystedt
Differential Revision: https://developer.blender.org/D17056
Some miscellaneous cleanups left over from a fix/cleanup combo:
- Use const variables
- Use the C++ `math` namespace functions
- Use `std::array` for arrays with size known at compile time
- Use `MutableSpan` instead of reference to array
Differential Revision: https://developer.blender.org/D17094
In the node groups for T103730, the "Points of Curve" node is often used to
retrieve the root point of every curve. Since the curve point offsets array
already contains that data directly, we can detect this as a special case and
avoid all the other work.
Differential Revision: https://developer.blender.org/D17128
MoltenVK wasn't found as it was previous part of lib/vulkan.
as lib/vulkan now doesn't contain
the full sdk, we will use a moltenvk folder.
At this moment the moltenvk folder isn't filled, but will eventually be.
These changes were authored by Michael B Johnson (drwave).
The default Blender USD export currently produces files that trigger
errors in the usdchecker that ships with USD 22.11.
The changes are:
- Set the defaultPrim if no defaultPrim is set. This sets it to the
first prim in the hierarchy which matches the behaviour of Pixar's
referencing (where referencing a USD layer without a defaultPrim will
pick the first prim) as well as matches the logic in Pixar's Maya USD
exporter code.
- Applies the MaterialBindingAPI to prims with material binding
attributes. This is a relatively new requirement for USD as it will
help for efficiency with upcoming changes to Hydra.
- Removes the preview scope in the USD shader hierarchy, because it
is no longer valid for shaders to have any non-container ancestors in
their hierarchy up until the enclosing Material prim.
Reviewed by: Michael Kowalski
Differential Revision: https://developer.blender.org/D17041
Removing all OSL script nodes from the shader graph would cause that
graph to no longer report it using `KERNEL_FEATURE_SHADER_RAYTRACE`
via `ShaderManager::get_graph_kernel_features`, but the shader object
itself still would have the `has_surface_raytrace` field set.
This caused kernels to be reloaded without shader raytracing support, but
later the `DEVICE_KERNEL_INTEGRATOR_SHADE_SURFACE_RAYTRACE`
kernel would still be invoked since the shader continued to report it
requiring that through the `SD_HAS_RAYTRACE` flag set because of
`has_surface_raytrace`.
Fix that by ensuring `has_surface_raytrace` is reset on every shader update,
so that when all OSL script nodes are deleted it is set to false, and only
stays true when there are still OSL script nodes (or other nodes using it).
Maniphest Tasks: T104157
Differential Revision: https://developer.blender.org/D17140
BKE blendfile should not be allowed to deal with DNA deprectaed data, so
move recent check in rB138b3815e528 into BLO readfile, in a new
`blo_read_file_checks` util that is being called at the very end of main
readfile code (`blo_read_file_internal` and `library_link_end`).
rB7f564d74f9ed (6 years ago!) forgot to clear the deprecated
`Window->screen` pointer on file read for recent-enough .blend files.
This is required since a valid value is always written in .blend files
for that pointer, to ensure backward compatibility.
The issue was never detected so far because that pointer is explicitely
reset to NULL after filewrite, which includes any memfile undostep
write, and usually existing UI data is re-used instead of loading the
one from the .blend file, so thedden assert in `blo_lib_link_restore`
would never be triggered.
Now moved the assert at the end of `setup_app_data` to ensure it always
get checked.
This patch adds a draw_ui_list() function, which is a wrapper around
layout.template_list(). It implements generic add/remove/move buttons,
passing the correct "row" integer to template_list(), as well as a
drop-down menu, if provided, making it a complete solution for
consistent UILists for addons.
Differential Revision: https://developer.blender.org/D14119
The node does not support blurring booleans, but that was not handled
property in link drag search.
Differential Revision: https://developer.blender.org/D17139
Only the area where the source buffer will be drawn on the destination buffer
will be evaluated. This will improve performance in sequencer and image editors as
less calcuations needs to happen.
Micro improvement to store delta uv per subsample. This reduces
branching that might happen on the CPU, but also makes it possible
to add other sub-sampling filters as well.
No changes for the end-user.
Adds new options to UV Face selection in the UV Editor, with UV > Select > Select Similar
In multi object edit mode, "Similar Object" selects faces which have the same object.
"Similar Winding" will select faces which have the same winding, i.e. are they
facing upwards or downwards.
Resolves: T103975
Differential Revision: https://developer.blender.org/D17125
Change the 2D Gizmo drawing function to provide a usable transform matrix,
if it would otherwise be degenerate.
Differential Revision: https://developer.blender.org/D17113
If an object has a geometry nodes modifier, the UVs on that object might change
in response to any change on any other object.
Now we will redraw the UV editor on any object change, not just the active object.
Differential Revision: https://developer.blender.org/D17124
Based on T99607:
- Existing Angle Control shortcuts are removed
- Voxel, Dyntopo and Hair resolution shortcuts are remapped to `R`
Since voxel remeshing is not compatible with dyntopo, each can use the shortcut `R` for the remeshing resolution without causing a conflict.
The shortcut `R` is not currently used for anything important.
The angle control menu is commonly not used.
And sculpt mode is only coincidentally inheriting the rotate operator shortcut on `R` because nothing else is mapped to the key.
Reviewed By: Julien Kaspar and Hans Goudey and Joseph Eagar
Differential Revision: https://developer.blender.org/D16511
Ref D16511
This addressed feature request T99811.
Added the following features to fully support importing USDZ archives:
- Added .usdz to the list of supported extensions.
- Added new USD import options to copy textures from USDZ archives. The
textures may be imported as packed data (the default) or to a directory
on disk.
- Extended the USD material import logic to handle package-relative texture
assets paths by invoking the USD asset resolver to copy the textures from
the USDZ archive to a directory on disk. When importing in Packed mode,
the textures are first saved to Blender's temporary session directory
prior to packing.
The new USD import options are
- Import Textures: Behavior when importing textures from a USDZ archive
- Textures Directory: Path to the directory where imported textures will
be copied
- File Name Collision: Behavior when the name of an imported texture file
conflicts with an existing file
Import Textures menu options:
- None: Don't import textures
- Packed: Import textures as packed data (the default)
- Copy: Copy files to Textures Directory
File Name Collision menu options:
- Use Existing: If a file with the same name already exists, use that
instead of copying (the default)
- Overwrite: Overwrite existing files
Reviewed by: Bastien
Differential Revision: https://developer.blender.org/D17074
In 7536abbe16 changes make possible to input field as Count field.
But changes of declaration probably was forgotten. So now this input
can take field and node will be work. But input link was red. This
patch resolves this issue.
Differential Revision: https://developer.blender.org/D17131
When the sort weights are a single value, they have no effect,
so sorting the relevant indices for the element will be wasted work.
The sorting is expensive compared to the rest of the node. In my
simple test of the points of curve node, it became 6 times faster
when the weights are a single value.
On some occasions, as in cases where transform operations are triggered
via gizmos, the constrain orientations that can be toggled with
multiple clicks of X, Y or Z were repeated.
There is no use in maintaining repeated orientations.
Image Transform use linear or nearest sampling during editing and exporting.
This gets sampling is fine for images that aren't scaled. When sequencing
however you mostly want use some sort of scaling, that leads to poorer
quality.
This change will use sub-sampling to improve the quality. This is only
enabled when rendering. During editing the subsampling is disabled to
keep the user interface reacting as expected.
Another improvement is that image transform is stopped at the moment
it hadn't sampled at least 4 samples for a scan line. In that case we
expect that there are no further samples that would change to result.
In a future patch this could be replaced by a ray/bounding bo intersection
as that would remove some unneeded loops in both the single sampled and
sub sampled approach.
Add an `object.modifiers.move()` method, similar to the one
for constraints and some other collections. Currently reordering
modifiers requires using operators, which depend on context.
The implementation is straightforward, except for the need to
make the severity of errors reported by the underlying editor
code into a parameter, so that the new Python API function
reports any problems as Python exceptions, and refactoring
the code to allow aborting a blocked move before making any
changes. I also turn the negative index condition from an assert
into an error.
Differential Revision: https://developer.blender.org/D16966
The list was populated from the base (unevaluated) object, but now that
Geometry nodes can generate various layers this is impractical..
Differential Revision: https://developer.blender.org/D17093
The clear functions for grease pencil data/frame/layer
was not followed by immediate update in the viewport.
Some notifiers were missing in the rna definition of these functions,
which are added in by this patch.
Reviewed By: Antonio Vazquez
Differential Revision: https://developer.blender.org/D17120
Only one point should be used to create a reference rotation for other
points to follow. Using two caused the resulting twist to be
asymmetric, especially noticeable on symmetrical, cyclic curves.
An update to [0] which broke curve_to_mesh & deform_modifiers tests,
now this change only applies to cyclic curves as the final result was
much greater for non-cyclic curves because of a difference between how
end-point directions are calculated (see code-comments for details).
Alternate fix to D11886 which caused T101843.
[0]: 36a82314a0.
Regression in [0] which cleared the redo-panel if an operator added
its own undo step. This worked for sculpt to fix T101743, but caused
the redo-panel to be cleared for actions who's undo steps where created
by nested operators (which is the case for the spin operator).
Fix by checking an undo-step is added without registering an operator.
[0]: f68e50a263
Various new CI tests for USD Import / Export functionalty:
Import:
- Added mesh import tests for topology types and multiple UV sets. (Python)
Export:
- Added a verification tests for mesh topology. (C++)
- Added a test to make sure UsdPreviewSurface export conversion of materials
is correct. (C++)
Reviewed by: Sybren and Hans.
Differential Revision: https://developer.blender.org/D16274
This reverts commit 36a82314a0.
as it has broken tests for the last day and a half, it likely just
needs a test file update, but we can't keep this failing longer
than it already has.
A mistake in the node type descriptions gave the node a description for
the reverse curve node.
Differential Revision: https://developer.blender.org/D17111
Added a new Import All Materials USD import option. When this
option is enabled, USD materials not used by any geometry will
be included in the import. Imported materials with no users
will have a fake user assigned.
Maniphest Tasks: T97195
Differential Revision: https://developer.blender.org/D16172
This commit fixes T100674, Renamed the "axis" label under viewport display
panel to "axes" in object properties.
Differential Revision: https://developer.blender.org/D16650
We should always have an active vertexgroup (making sure this is the
case was just not happening on the greasepencil side).
Now do this (similar to what is done for other object types in
`object_defgroup_remove_common`).
Maniphest Tasks: T104089
Differential Revision: https://developer.blender.org/D17091
User site-packages were disabled unless `--python-use-system-env`
argument was given. This was done to prevent Blender's Python
unintentionally using modules that happened to be installed locally,
however it meant so pip installing modules from Blender would fail to
load those modules (for some users).
Enable user site-packages since it's needed for installing additional
packages via pip, see code-comments for details.
Resolves T104000.
- Don't call exit() when memory allocation fails, while unlikely
internal failures should not be exiting the application.
- Don't print a message when the directory is empty as it's
unnecessarily noisy.
- Print errors the the stderr & include the reason for opendir failing.
When constructing run-time paths native slashes are preferred as WIN32
doesn't have full support for forward slashes in paths.
It can also cause problems when performing exact matches on paths
which are normalized, where normalizing one of the paths makes
comparisons fail.
Using the system native slash would have avoided T103385.
Originally, function `sequencer_generic_invoke_xy_guess_channel`
looked in what channel the last strip of the same type is and the
channel used for new strip placement. This was changed as a workaround
when sound strips were added below movie strips
(58bea005c5).
Now these workarounds aren't necessary, but the function was left
unchanged.
Current logic is for adding movie strip to channel 1 is:
- Sound is added to channel 1
- Video is added to channel 2
- If there is only video, it is added to channel 1
Since movie may, or may not contain sound, it is not possible to align
added strips in a way that was done before, unless timeline is analyzed
more in detail, but this would be quite inefficient.
Also, note, that the code did not work, if strip is added next to
previous one, so it mostly did not work as intended.
This commit changes:
- Fix alignment not working when strip is added right next to previous
strip
- Assume that movie strips have sound strip underneath it, so channel
below last movie strip is picked
- For other strip types, pick channel of the last strip of same type
Ultimately, the code is still rather weak, and better system, like using
channel where strip was manually moved, or concept of "typed channels"
would improve this feature.
There is not much documentation on the "snap_point" property, but by
code it is possible to note that it serves to set a target snap point
and is of internal use as it is hidden from the Redo panel.
However, this property was still very dependent on Tools settings and
if set to an operator's call, it changes the scene configurations
inadequately.
Therefore,
- remove this dependency from UI for rotation and resize operators,
- do not change the state of the snap in the scene and
- cleanup the code.
Some transform modes are changeable, so callbacks should be reset
together.
Currently the unchanged `transform_matrix` callback is not a major
issue as it is only used for gizmos and gizmos stop updating when
changing the operator type.
Use a Vector<std::string> , instead of a Set<std::string> as a Set does
not keep the same order when iterating over it.
Differential Revision: https://developer.blender.org/D17103
In many cases when reading undo memfile, n the 'restore id from old
main' part of the process, the 'id_old' is not set, which means that
the call to `BKE_main_idmap_insert_id` would try to dereference a `nullptr`.
In practice this is likely not an issue (see comment in code for details),
but at least explicitely check for a nullptr `id_old` pointer.
Would deffer actual cleanup of this area for after 3.5 is branched out.
Currently only affects 'UI' IDs (WindowManager, Screen, etc.), but in
the future other types may be affected as well.
NOTE: this is only used in readfile code itself, not in the
post-processing performed by `setup_app_data`, as this code is too
specific for such generic handling.
Based on "Sampling the GGX Distribution of Visible Normals" by Eric Heitz
(https://jcgt.org/published/0007/04/01/).
Also, this removes the lambdaI computation from the Beckmann sampling code and
just recomputes it below. We already need to recompute for two other cases
(GGX and clearcoat), so this makes the code more consistent.
In terms of performance, I don't expect a notable impact since the earlier
computation also was non-trivial, and while it probably was slightly more
accurate, I'd argue that being consistent between evaluation and sampling is
more important than absolute numerical accuracy anyways.
Differential Revision: https://developer.blender.org/D17100
This gives closer results to what I've seen in papers and other renderers when
using the code to precompute albedo later (to replace MultiGGX).
It's usually a tiny difference, the only case where I've seen it matter is
in the `shader/node_group_float.blend` test - but that's a (single-scatter) GGX
closure with 0.9 roughness, so it's not too surprising. In any case, the new
result looks closer to Eevee, so that's good I guess.
Differential Revision: https://developer.blender.org/D17099
Simon mentioned that this gets in the way more than it helps. No geometry
sockets currently show up in the modifier panel. People may build node groups
that have multiple geometry inputs that can be used when the group is used
as node instead of as modifier.
In the future we could also allow e.g. choosing an object to pass into a geometry
socket. That has the problem that we'd also have to duplicate other functionality
of the Object Info node (original vs. relative space).
There were two issues:
* The `new_point_counts_per_curve` was one too large, resulting in
`interpolate_from_neighbors` reading invalid memory.
* Writing the counts into the existing offsets array didn't quite work
because there can be a collision at the offset right between the
last old curve and the first new point. There was a race condition
where this value could be read and written at the same time.
When some path property was displayed in the File Browser, clicking the
icon to open a file browser dialog to choose a file/directory would
show an error. While this makes sense when you are already in a file
browser dialog (we don't support such nested file browser dialogs),
allow it when the file browser is opened as a normal editor, not as a
dialog.
Current implementation had some faulty assumtions and had some work
arounds for crashes that were actually limitation of the implementation.
The main reason for this was that the implementation didn't add new
primitives in the same direction it was already adding. Some when
incorrect behavior was detected it was assumed that the part wasn't
manifold (anymore) and didn't fix that part of the mesh.
The new implementation will extract a solution and use this solution
also as the order to generate primitives in uv space.
This patch fixes several crashes and improves the overall quality
when fixing seam bleeding. It also adds additional debug tools
(print_debug) implementation in order to find issues faster in the
future.
Regression in [0] caused by a change where path joining would
replace a forward slash with a back-slash when joining paths WIN32.
Now the directory is always used as a prefix for the paths returned
by BLI_filelist_dir_contents which resolves the regression.
[0]: 9f6a045e23
`remember_deformed_curve_positions_if_necessary` has to be called before
topology changing operations on curves. Otherwise the crazy-space data
is invalid.
The help circles to fill areas were rotated with the object rotation,
but as the stroke is part of the object, apply the rot matrix again
produced a double rotation, so it can be removed.
Two properties are now exposed in python API :
time of each point, and inittime of each stroke.
Reviewed by: Antonio Vazquez
Differential Revision: https://developer.blender.org/D17104
Speckles and missing lights were experienced in scenes with Nishita Sky
Texture and a Sun Size smaller than 1.5°, such as in Lone Monk and Attic
scenes.
Increasing the precision of cosf fixes it.
Only one point should be used to create a reference rotation for other
points to follow. Using two caused the resulting twist to be
asymmetric, especially noticeable on symmetrical, cyclic curves.
Alternate fix to D11886 which caused T101843.
After object-mode undo (memfile undo), the value wan't lost, but the
property would be temporarily converted back to integer type in order
to be forward compatible. Now only use the forward compatible
writing when writing undo steps. Auto-saves and similar files are
currently not forward compatible anyway.
Make the functions more flexible and more generic by changing the curves
arguments to the curve offsets. This way, theoretically they could become
normal utility functions in the future. Also do a consistency pass over
the algorithms that generate new curves geometry for naming and
code ordering, and use of utility functions. The functions are really
quite similar, and it's much easier to tell this way.
The most time-consuming operation in merge by distance is to find
duplicate faces (faces that are different but have the same vertices).
Therefore, some strategies were planned to optimize this algorithm:
- Store the corner indices in an array thus avoiding multiple calls of `weld_iter_loop_of_poly_next`;
- Create a map of polygons linked to edges instead of linked to vertices - this decreases the number of connections and reduces the calculation of the intersection of polygon indices.
There are other fields to optimize, like reusing the `wpolys` array
instead of creating a new array of corner offsets. And join some arrays
as members of the same struct to be used in the same buffer.
But for now, it is already a nice optimization. And the new
`poly_find_doubles` function can be reused in the future to create a
generic utility.
The result of the optimization varies greatly depending on the number
of polygons, the size of each polygon and the number of duplicates.
On average it was something around 2 times faster.
Worst case tested (old vs new): 0.1ms vs 0.3ms
Best case tested (old vs new): 10.0ms vs 3.2ms
Differential Revision: https://developer.blender.org/D17071
`PBVH_Leaf` nodes are now split into a new `PBVH_TexLeaf`
node type when using the paint brush. These nodes are
split by image pixels, not triangles. This greatly
increases performance when working with large
textures on low-poly meshes.
Reviewed By: Jeroen Bakker
Differential Revision: https://developer.blender.org/D14900
Ref: D14900
A noticeable (>5%) performance regression in oneAPI backend came with
a501a2dbff. Updating to latest graphics
compiler from driver 101.4032 fixes it.
I've tested it with current min-supported drivers and it runs well but
since compatibility of graphics compiler with older drivers isn't
guaranteed, I'm also bumping the min-supported driver versions.
If end-users consider latest drivers too fresh to switch to (version
isn't released as stable on Linux as of today but should be before
Blender 3.5 release), CYCLES_ONEAPI_ALL_DEVICES=1 env variable can be
used.
Intel Graphics Compiler on Linux will be updated in a later commit
so we can then close D16984.
Reviewed By: sergey, LazyDodo
The problem was that the stroke array was not reset for
each iteration of the loop, so the second time around,
the array was not initialized correctly and
was left with a NaN value.
The USD Preview Surface material import feature is now considered
stable, so this patch removes this option from the Experimental
category in the UI.
The Import USD Preview option is now enabled by default.
The Experimental box has been removed.
A new Materials box has been added to group the Import
USD Preview Surface, Set Material Blend and Material
Collision Mode options.
Reviewed by: Sybren
Differential Revision: https://developer.blender.org/D17053
Rewrite of the Workbench engine using C++ and the new Draw Manager API.
The new engine can be enabled in Blender `Preferences > Experimental > Workbench Next`.
After that, the engine can be selected in `Properties > Scene > Render Engine`.
When `Workbench Next` is the active engine, it also handles the `Solid` viewport mode rendering.
The rewrite aims to be functionally equivalent to the current Workbench engine, but it also includes some small fixes/tweaks:
- `In Front` rendered objects now work correctly with DoF and Shadows.
- The `Sampling > Viewport` setting is actually used when the viewport is in `Render Mode`.
- In `Texture` mode, textured materials also use the material properties. (Previously, only non textured materials would)
To do:
- Sculpt PBVH.
- Volume rendering.
- Hair rendering.
- Use the "no_geom" shader versions for shadow rendering.
- Decide the final API for custom visibility culling (Needed for shadows).
- Profile/optimize.
Known Issues:
- Matcaps are not loaded until they’re shown elsewhere. (e.g. when opening the `Viewort Shading` UI)
- Outlines are drawn between different materials of the same object. (Each material submesh has its own object handle)
Reviewed By: fclem
Maniphest Tasks: T101619
Differential Revision: https://developer.blender.org/D16826
Improve handling for cases where maximum in-flight command buffer count is exceeded. This can occur during light-baking operations. Ensures the application handles this gracefully and also improves workload pipelining by situationally stalling until GPU work has completed, if too much work is queued up.
This may have a tangible benefit for T103742 by ensuring Blender does not queue up too much GPU work.
Authored by Apple: Michael Parkin-White
Ref T96261
Ref T103742
Depends on D17018
Reviewed By: fclem
Maniphest Tasks: T103742, T96261
Differential Revision: https://developer.blender.org/D17019
Required by Metal backend to have correct usage flags for textures which are read by host.
Authored by Apple: Michael Parkin-White
Ref T96261
Reviewed By: fclem
Maniphest Tasks: T96261
Differential Revision: https://developer.blender.org/D17020
Affecting render output preview when tone mapping is used, and EEVEE scenes such as Mr Elephant rendering in pink due to missing shaders.
Authored by Apple: Michael Parkin-White
Ref T103635
Ref T96261
Reviewed By: fclem
Maniphest Tasks: T103635, T96261
Differential Revision: https://developer.blender.org/D16923
AMD GPUs do not appear to produce consistent results with other GPUs when using textureGather in the Metal backend. Disabling for now to ensure correct function of outline rendering.
This may require an additional sub-pixel offset in the texture sampling calls, to achieve correct behaviour.
Authored by Apple: Michael Parkin-White
Ref T103412
Ref T96261
Reviewed By: fclem
Maniphest Tasks: T103412, T96261
Differential Revision: https://developer.blender.org/D16934
This patch fixes an issue where Blender 3.5 alpha with the Metal GPU backend enabled on Japanese macOS fails to compile shaders and crashes on startup.
In a Japanese environment, `defaultCStringEncoding` is the legacy MacJapanese encoding, and it erroneously converts backslashes (0x5c) to Yen symbols (¥).
Therefore, Metal shader compile fails with the following log and Blender crashes.
```
2022-12-29 13:50:10.200 Blender[13404:246707] Compile Error - Metal Shader Library (Stage: 0), error Error Domain=MTLLibraryErrorDomain Code=3 "program_source:225:74: error: non-ASCII characters are not allowed outside of literals and identifiers
template<typename T, access A = access::sample> struct STRUCT_NAME { ¥
^
program_source:226:14: error: no template named 'TEX_TYPE'
thread TEX_TYPE<T, A> *texture; ¥
^
program_source:226:39: error: non-ASCII characters are not allowed outside of literals and identifiers
thread TEX_TYPE<T, A> *texture; ¥
^
program_source:227:29: error: non-ASCII characters are not allowed outside of literals and identifiers
thread sampler *samp; ¥
^
...
```
We can use `stringWithUTF8String` instead.
Reviewed By: fclem, MichaelPW
Differential Revision: https://developer.blender.org/D16881
In the new Draw Manager, when the same DrawGroup has both front and back facing instances, the front facing instances don't offset their indices accordingly.
Differential Revision: https://developer.blender.org/D17069
This changes `make update` to download the assets repository automatically
if it does not exist already. If it does exist, it is updated. Precompiled libraries
have the same behavior. This is required for T103620.
`pipeline_config.yaml` is updated as well for the builtbot.
Differential Revision: https://developer.blender.org/D17090
The call to BKE_volume_grid_openvdb_for_write() was accidentally removed
in D15806. This adds it to BKE_volume_grid_transform_matrix_set() to
avoid that it happens again when that function is used.
Differential Revision: D16949
The code in questions comes from Shewchuk's triangle code, which
hasn't been updated to fix the out-of-buffer access problem
that ASAN finds in the delaunay unit test. The problem is benign:
the code would exit the loop before using the value fetched from
beyond the end of the buffer, but to make ASAN happy, I put in
a couple extra tests to not fetch values that aren't going to be used.
There's a compromise of a code parameter called BEVEL_GOOD_ANGLE,
and bugs T44961, T86768, T95335, and this one, are all about problems
with various values of that parameter. If an angle of an adjacent
non-beveled edge is too close to that of the beveled edge, then you
get spikes. The BEVEL_GOOD_ANGLE says that if you are within that
angle difference, then no bevel happens. If the value is too small
then one gets spikes for certain models people build; if the value
is too large, then other people are annoyed that no bevel happens.
Hopefully this compromise in this commit is the final one I will do
before switching to Bevel v2, where none of this should be an issue.
Regression in [0] caused mouse wheel events over windows without focus
to use the modifier state at the point the window was de-activated.
Now un-focused windows have all events release, when focused again
modifier press events are set again.
[0]: 8bc76bf4b9
This can improve performance in some circumstances when there are
vectorized and/or unrolled loops. I especially noticed that this helps
a lot while working on D16970 (got a 10-20% speedup there by avoiding
running into the non-vectorized fallback loop too often).
This isn't correct as window activation is handled separately
from the cursor entering/leaving a window.
This would call de-activate when the cursor moved outside the window
even though the window remained focused.
Rely on focus changes which already handle activate/deactivate events.
Caused by {rB841df831e89d} and {rB3558bb8eae75}.
These commits moved flags from `eLineArtGPencilModifierFlags` to
`eLineartMainFlags`, but later on in code, these were still evaluated
from the modifiers `flags` (instead of `calculation_flags`).
This resulted in a false condition (`match_output` was assumed true but
it wasnt), leading to a wrong codepath taken.
This is now corrected (`calculation_flags` need to be passed around for
this as well).
Maniphest Tasks: T103887
Differential Revision: https://developer.blender.org/D17062
This also fixes the layout of boolean properties with the field toggle
visible. This was discussed in the most recent geometry nodes submodule
meeting.
This uses the changes from ef68a37e5d to create IDProperties
for exposed boolean sockets with a boolean type instead of an integer
with a [0,1] range. Existing properties and values are converted
automatically.
For forward compatibility, the properties are switched to the integer
type for saving. Otherwise older versions crash immediately when opening
a newer file. The "Use Attribute" IDProperties aren't changed here,
since that wouldn't have a visible benefit.
Differential Revision: https://developer.blender.org/D12816
This adds 4 collection properties to MeshUVLoopLayer to eventually replace the (MeshUVLoop) .data property.
The added properties are:
.uv
.vertex_selection
.edge_selection
.pin
The direct access to the separate arrays is much more efficient than the access via MeshUVLoop.
Differential Revision: https://developer.blender.org/D16998
Caused by 05952aa94d, which removed the use of the
active tessface UV pointer on meshes but didn't replace it properly with
the equivalend custom data API function.
This improves performance in cases where the Set Position node is "turned off"
by passing `false` into the selection input.
It's possible that the node still takes some time in this case currently, because
it is destructing the input fields which may reference geometries that need
to be destructed as well. We could potentially change this node (and others)
so that the field inputs are only requested when the selection is not a
constant `false`.
This adds the following operators to edit mode:
- `select_all`
- `select_random`
- `select_end`
Differential Revision: https://developer.blender.org/D17047
This adds an `UndoType` for the `Curves` object, for edit mode.
For now, this will only store the `CurvesGeometry` at every step.
Other properties such as the `selection_domain` or the `surface` object
will have to be dealt with in subsequent commits.
Differential Revision: https://developer.blender.org/D16979
This was not done originally, because one had to iterate over all curves
to get the number of points which had some overhead. Now the number
of points is stored all the time anyway.
The `fix_link_cycles` function added in rB2ffd08e95249df2a068dd did not
handle the case correctly when there are multiple cycles going through
the same socket.
Existing path selection & new path picking included without UV's.
Now limit objects to those with UV's.
Also remove use of CTX_wm_view3d(C) in the UV editor it would be NULL,
but it doesn't makes sense to use the 3D viewport for UV operations
even if it was available.
This adds a new `Interpolate Curves` node. It allows generating new curves
between a set of existing guide curves. This is essential for procedural hair.
Usage:
- One has to provide a set of guide curves and a set of root positions for
the generated curves. New curves are created starting from these root
positions. The N closest guide curves are used for the interpolation.
- An additional up vector can be provided for every guide curve and
root position. This is typically a surface normal or nothing. This allows
generating child curves that are properly oriented based on the
surface orientation.
- Sometimes a point should only be interpolated using a subset of the
guides. This can be achieved using the `Guide Group ID` and
`Point Group ID` inputs. The curve generated at a specific point will
only take the guides with the same id into account. This allows e.g.
for hair parting.
- The `Max Neighbors` input limits how many guide curves are taken
into account for every interpolated curve.
Differential Revision: https://developer.blender.org/D16642
During 3D texturing the uv islands are extended in order to fix seam bleeding
for manifold parts of the input mesh. This patch adds a `print_debug` method
on UVIsland that generates a python script. This script can be copy-past
into the Python Console to show the generated geometry.
This script can be extended to show the extracted border and use face colors
for showing internal decisions.
Swap-buffers was being deferred (to prevent it being called
from the event handling thread) however when it was called the
OpenGL context might not be active (especially with multiple windows).
Moving the cursor between windows made eglSwapBuffers report:
EGL Error (0x300D): EGL_BAD_SURFACE.
Resolve this by removing swapBuffer calls and instead add a
GHOST_kEventWindowUpdateDecor event intended for redrawing
client-side-decoration.
Besides the warning, this results an error with LIBDECOR window frames
not redrawing when a window became inactive.
The name SAFE_AREAS_OT_preset_add lead to "Safe Areas" having it's own
section in the operator API docs. Name CAMERA_OT_safe_areas_preset_add
instead. Keep "safe_areas" as the preset directory for users with
existing presets.
Fixes the packing operators that use ED_uvedit_pack_islands_multi
Also fixes UV Select Similar with hidden UV islands.
Packing operators using GEO_uv_parametrizer should remain unchanged.
Add a check to BM_elem_flag_test(efa, BM_ELEM_HIDDEN).
Note that BM_mesh_calc_face_groups doesn't easily support XOR of flags,
requiring logic to be moved to a preprocess step on BM_ELEM_TAG.
Regression in rBe3075f3cf7ce.
Differential Revision: https://developer.blender.org/D17055
The bpy.types page was unreasonably long (over 17k lines).
Resolve by setting the `maxdepth` for this and the `bpy.ops` page too.
This problem showed up in v3.4 release and may be caused by changes
to Sphinx's default behavior as there doesn't seem to be any change
that would cause this in the generated docs.
Path selection support from [0] didn't account for multiple objects in
edit-mode. Now picking the UV also picks the object to operate on.
[0]: ea5fe7abc1
Add:
- ED_object_in_mode_to_index
- ED_object_in_mode_from_index
Useful for operators that act on a non-active object in multi-edit mode,
so the index can be stored for the operators exec function to read back
the value when redoing an action. Needed to resolve T102680.
Fixes bug where other islands sometimes get their masks cleared (or
filled) in strange circumstances. Still need to figure out the
correct behavior for spherical falloff.
Mesh islands (shells) are now calculated on an as-needed
basis and cached inside of a temp attribute,
`sculpt_topology_island_key`. This attribute is updated
as needed when geometry changes (e.g. the trim brush)
or when mesh visibility changes.
This replaces the old behavior where the "topology" automasking
mode would walk the entire mesh on every stroke.
The background evaluation samples the sky discretely, so if the sun is
too small, it can be missed in the evaluation. To solve this, the sun is
ignored during the background evaluation and its contribution is
computed separately.
Add an RNA API function that gives an array of the normals for every control point.
The normals depend on the `normal_mode` attribute, which can currently be
minumum twist or Z-up, though more options are planned. Normals are currently
evaluated on the evaluated points and then sampled back to the control points.
Because that can be expensive, a normal mode that only does a first evaluation
on control points may be important
The function is intended to be used by Cycles, so it doesn't have to implement
the calculation of normals itself. They can be interpolated between control points
and normalized.
For best performance, the function should only be called once, since it does the
full calculation for every control point every time it is called.
Differential Revision: https://developer.blender.org/D17024
Based on discussion about T102962, rename the "Face Set Boundaries" node
to "Face Group Boundaries" and the Accumulate Field node's "Group Index"
socket to "Group ID". This convention of "__ Group" and "Group ID" will
be used more in other nodes in the future.
This commit doesn't affect forwards or backwards compatibility.
The reverse iteration added in e091291b5b didn't handle
the case where there are no nodes properly. Thanks to Iliya Katueshenock
for investigating this.
While we do need higher level utilities for copying attributes
between geometries, this currently isn't used and it's not clear
that it will be the right abstraction in the end.
The default when there is no cyclic attribute is that none of the curves
are cyclic. In the mesh to curve node, avoid creating the attribute with
just false to save time and memory usage. Also avoid looking up the
attribute twice in the trim node.
When all the curves are poly curves, skip the work of building a
separate array of offsets for the evaluated points (which are the
same as the control points). This saves 1-4ms on every reevaluation
in test files with many curves.
Standardizing the process of creating a new CurvesGeometry with
different curve sizes based on an existing curves is helpful, since
there are a few methods to simplify the process that aren't obvious
at first, like filling the offsets with sizes directly and accumulating
them to become sizes.
Also, in the trim curves node, avoid creating the curve types attribute
all the time. Use the special API functions for the types which do
some optimizations automatically. Also use a more consistent
method to copy the curve domain data, and correct some comments.
The same logic from D17025 is used in other places in the curve code.
This patch uses the class for the evaluated point offsets and the Bezier
control point offsets. This helps to standardize the behavior and make
it easier to read.
Previously the Bezier control point offsets used a slightly different standard
where the first point was the first offset, just so they could have the same
size as the number of points. However two nodes used a helper function
to use the same `OffsetIndices` system, so switch to that there too.
That requires removing the subtraction by one to find the actual offset.
Also add const when accessing data arrays from curves, for consistency.
Differential Revision: https://developer.blender.org/D17038
The lookup table method on CPU and the numerical root finding method on
GPU give quite different results. This commit deletes the Beckmann lookup
table and uses numerical root finding on all devices. For the numerical
root finding, a combined bisection-Newton method with precision control
is used.
Differential Revision: https://developer.blender.org/D17050
Previously, transforming a clip (scaling, repeat, etc) wouldn't re-calculate the blend-in and blend-out values, leading to over / undershoot, and a visual clip artifact
Old:
{F14045003}
This patch adds re-calculation logic (new `BKE_nlastrip_recalculate_blend()` method) to the blend-in/out on transformations to clamp values, and avoid over/under shoot.
The `BKE_nlastrip_recalculate_blend()` encapsulates the existing logic for both the `rna_NlaStrip_blend_in_set()` and `rna_NlaStrip_blend_out_set()` methods into a single BKE method that we an execute as needed. The fact that blend-in is first decreased, is strictly on the order of calculation. My suspicion is that //if// the blend-in / blend-our values were working as intended, the RNA set methods would update in order, and we'd experience the same thing. In short, the choice here was to linearly combine the logic, without making any assumptions of my own.
while talking things over with @sybren and @RiggingDojo, they are fine with how this currently works, but there a desire to update how the two values interact with each (ratio scale, etc) in the future.
New:
{F14045024}
{F14045025}
Reviewed By: sybren
Maniphest Tasks: T101369
Differential Revision: https://developer.blender.org/D16720
This makes it possible to use `texture` and `texture3d` in custom
OSL shaders with a constant image file name as argument on the
GPU, where previously texturing was only possible through Cycles
nodes.
For constant file name arguments, OSL calls
`OSL::RendererServices::get_texture_handle()` with the file name
string to convert it into an opaque handle for use on the GPU.
That is now used to load the respective image file using the Cycles
image manager and generate a SVM handle that can be used on
the GPU. Some care is necessary as the renderer services class is
shared across multiple Cycles instances, whereas the Cycles image
manager is local to each.
Maniphest Tasks: T101222
Differential Revision: https://developer.blender.org/D17032
This patch adds markup to specify that certain kernel data constants should not be specialised. Currently it is used for `tabulated_sobol_sequence_size` and `sobol_index_mask` which change frequently based on the aa sample count, trash the shader cache, and have little bearing on performance.
Reviewed By: brecht
Differential Revision: https://developer.blender.org/D16968
This patch adds occupancy tuning for the newly announced high-end M2 machines, giving 10-15% render speedup over a pre-tuned build.
Reviewed By: brecht
Differential Revision: https://developer.blender.org/D17037
Split the algorithms that find duplicates.
This improves readability and helps us find areas for optimization.
It may also facilitate the implementation of generic utilities.
No functional changes.
Differential Revision: https://developer.blender.org/D16918
Code authored by Michael B Johnson (drwave).
Reviewed by Sybren and makowalski.
This patch addresses a crash that occurs when exporting a
scene to a USD file, when that scene includes a point cloud
object or hair.
Added OB_POINTCLOUD and OB_CURVES enums and a default case
statement in the switch statement in
USDHierarchyIterator::create_data_writer, to avoid dereferencing
a NULL pointer.
Differential Revision: https://developer.blender.org/D16776
`batch_for_shader` is an utility function that creates the correct
vertex buffer based on the given shader. In the shader interface
the `attr_types_` contains the GPUType for each location in the
vertex buffer.
When using Metal, the `attr_types_` was never updated, resulting
in using incorrect or non-existing data types. This patch fixes
this by updating the `attr_types_` when building the shader
interface.
Reviewed By: fclem
Differential Revision: https://developer.blender.org/D17042
When using the "normalized" display of FCurves in the
Graph Editor, and also turning on the preview range,
the normalized display would break.
The preview frame range was assumed to be bezt indices,
which is only true when every frame has a key.
Reviewed by: Colin Basnett
Differential Revision: https://developer.blender.org/D16987
Ref: D16987
Similar to rBe97443478e32 and rBe772087ed664, exit early when
texture, collection and world ID has no parent to unlink from.
Reviewed by: Severin, lichtwerk
Differential Revision: https://developer.blender.org/D17017
The line art modifier added a wmNotifier in it's
GpencilModifierTypeInfo.generateStrokes callback which isn't thread-safe
when called from the depsgraph. This was from the original inclusion
of the feature [0] however a more recent optimization to notifier
lookups [1] made the crash occur more frequently.
Remove the notifier as modifiers should not be adding WM level events
and it works without it.
[0]: 3e87d8a431
[1]: 0aaff9a07d
This was the case when using the operator outside of the modifiers panel.
Caused by {rBeae36be372a6}.
In above commit, `DT_layer_items` shared both `DT_TYPE_MPROPCOL_LOOP` |
`DT_TYPE_MLOOPCOL_LOOP` in a single EnumPropertyItem value "Colors".
This is a bit unusual, but probably allowed.
As a consequence, checks for specific datatypes would fail when selecting
such EnumPropertyItem:
- `DT_DATATYPE_IS_MULTILAYERS` (uses `ELEM` to check distinct entries --
would return false)
- `BKE_object_data_transfer_dttype_to_srcdst_index` (would return
`DT_MULTILAYER_INDEX_INVALID`)
These places have now been corrected to take these "special" values into
account.
Another issue was that multiple EnumPropertyItems with the same value
could be created in dt_add_vcol_layers() if attributes of the same
domain, but different color types are in play (could lead to crashes)
and that has also been corrected.
Also: above commit did not give the choice of transfering color
attributes from the vertex domain (only face corner attributes could be
chosen), this has now been added. DT_layer_vert_items (used from the
modifier) already had this included so this was only an issue when using
the operator outside of the modifiers panel.
Since we now feature two domains, the single "VCOL" in the enum has been
split into "COLOR_VERTEX" and "COLOR_CORNER". This will break existing
scripts calling bpy.ops.object.datalayout_transfer and will be marked as
a breaking change in the release notes.
NOTE: there is another bug here when attributes of the same domain, but
different color types are in play and you want to transfer just a single
specific layer (but that is for a separate commit)
Maniphest Tasks: T103400
Differential Revision: https://developer.blender.org/D16935
Goal of this patch is to stop the invocation of OpenGL calls via the bgl module
on a none OpenGL GPU backend, report this as a python deprecation warning
and report this to the user.
## Deprecation warning to developers
```
>>> import bgl
>>> bgl.glUseProgram(0)
<blender_console>:1: DeprecationWarning: 'bgl.glUseProgram' is deprecated and will be removed in Blender 3.7. Report or update your script to use 'gpu' module.
```
## Deprecation message to users
The message to the user is shown as part of the Info Space and as a message box.
{F14159203 width=100%}
{F14158674 width=100%}
During implementation we tried several ideas:
# Use python warning as errors: This isn't fine grained enough and can show incorrect information to the user.
# Throw deprecation as error and use sys.excepthook to report the user message.
This required a custom exception class to identify the bgl deprecation and a CPython handler function to
be set during python initialization. Although this is the most flexible there was a disconnect between the
exception class, exception function and the excepthook registration.
# A variant how we handle autoexec failures. A flag is stored in Global and when set the user message is reported.
Not that flexible, but code is more connected to the boolean stored in the Global struct.
Although using Global struct isn't nice I chose this solution due to its traceability. It is clear to developers
reading the code how the mechanism works by using search all functionality of your IDE.
Reviewed By: MichaelPW, campbellbarton
Maniphest Tasks: T103863
Differential Revision: https://developer.blender.org/D16996
This makes it convenient to build blender without referencing
pre-compiled libraries which don't always work on newer Linux systems.
Previously I had to rename ../lib while creating the CMakeCache.txt
to ensure my systems libraries would be used.
This change ensures LIBDIR is undefined when WITH_LIBS_PRECOMPILED is
disabled, so any accidental use warns with CMake's `--warn-unused-vars`
argument is given.
These warnings can reveal errors in logic, so quiet them by checking
if the features are enabled before using variables or by assigning
empty strings in some cases.
- Check CMAKE_THREAD_LIBS_INIT is set before use as CMake docs
note that this may be left unset if it's not needed.
- Remove BOOST/OPENVDB/VULKAN references when disable.
- Define INC_SYS even when empty.
- Remove PNG_INC from freetype (not defined anywhere).
The original code used `BLI_polyfill_calc` which can create degenerate
triangles during triangulation per T103913. This causes the subsequent
overlap test to produce incorrect results in certain cases. Change to
using a "beauty" fill instead.
Differential Revision: https://developer.blender.org/D17015
There is a utility method on `CurvesGeometry` to build a map of the
curve for each point. Use that in two more places and make sure its
implementation is multithreaded, which gives a slight speedup
in a simple test file.
When doing partial reloads of asset libraries (only reload assets from
the current file, e.g. after undo re-allocated ID pointers), we'd end up
with assets that don't have their asset data read correctly. It would
execute a branch that didn't set the asset library object necessary to
create and store asset representations.
Steps to reproduce were:
* Open .blend file with geometry node assets in there
* In a geometry node editor, press Shift+A to open the add menu
* Cancel
* Move a node
* Undo
* Press Shift+A again
This allows an engine to perform GPU side view specification and let the
draw manager extract the culling informations (bounds).
To this end, the matrices ubo gets exposed to be able to write to it.
`compute_procedural_bounds()` need to be explicitely called before any
main pass using the culling result.
This abstraction is rarely used. It could be replaced by some more
general "query" API in the future. For now it's easier to just compare
pointers in the Set Position node where this was used.
This is possible now, because mesh positions are stored as flat `float3`
arrays (previously, they were stored as `MVert` with some other data
interleaved).
This changes how we access the points that correspond to each curve in a `CurvesGeometry`.
Previously, `CurvesGeometry::points_for_curve(int curve_index) -> IndexRange`
was called for every curve in many loops. Now one has to call
`CurvesGeometry::points_by_curve() -> OffsetIndices` before the
loop and use the returned value inside the loop.
While this is a little bit more verbose in general, it has some benefits:
* Better standardization of how "offset indices" are used. The new data
structure can be used independent of curves.
* Allows for better data oriented design. Generally, we want to retrieve
all the arrays we need for a loop first and then do the processing.
Accessing the old `CurvesGeometry::points_for_curve(...)` did not follow
that design because it hid the underlying offset array.
* Makes it easier to pass the offsets to a function without having to
pass the entire `CurvesGeometry`.
* Can improve performance in theory due to one less memory access
because `this` does not have to be dereferenced every time.
This likely doesn't have a noticable impact in practice.
Differential Revision: https://developer.blender.org/D17025
Struct members loc/size were misleading as they read as if the object
data stored object level transform channels. Rename these to match RNA
with a `texspace_*` prefix to make it clear these struct members only
apply to texture-space transform.
Also rename ME_AUTOSPACE & ME_AUTOSPACE_EVALUATED to
ME_TEXSPACE_FLAG_AUTO & ME_TEXSPACE_FLAG_AUTO_EVALUATED.
Give the "Value" input a higher search weight than the "Index"
input, since it's more likely that users will want to connect to
that. Based on feedback from Simon Thommes.
Socket declarations exist all the time and it would be useful to use
them for tooltips at all times, not just when there is a computed log.
Differential Revision: https://developer.blender.org/D16846
Avoid calling `interpolate_to_evaluate` while evaluating normals,
which has to look up attributes by name for every curve. Also avoid
duplicating the curve type switch in a few functions. I didn't observe
a performance difference, but theoretically this could reduce
overhead for many small curves.
Due to precision issues, the cosine value calculated with
`dot_v3v3(start, end)` can be outside the -1, 1 range causing `acosf`
to return `nan(ind)`.
Use `angle_signed_on_axis_v3v3_v3` instead. It returns more accurate
values, deduplicates code, and avoids these `nan` issues.
Since 90ea1b7643, node trees have been reevaluated
after many selection operations because nodes are sorted based on
the selection status and an update tag was added for that. However,
for years the node order was allowed to be different between the
original and evaluated copy of node trees.
Though it is a bit sketchy to have that difference in the evaluated
node tree, reevaluations for just selection are very bad, so use a
"smaller" update tag and add a comment for justification.
Differential Revision: https://developer.blender.org/D17023
wi is the viewing direction, and wo is the illumination direction. Under this notation, BSDF sampling always samples from wi and outputs wo, which is consistent with most of the papers and mitsuba. This order is reversed compared with PBRT, although PBRT also traces from the camera.
The order of arguments to memcpy was reversed, which is sadly possible
because the constness `KeyBlock` of keyblock doesn't propagate to
pointers it contains.
Caused by 6769acbbba.
Some of the matrix variants are rather obscure from the
semantic: they don't really fully initialize the output:
as in, they only write to an upper-left 3x3 block.
A quick solution to fix the very commonly used constraint.
It feels that it is possible to minimize about of copy
operations.
The Grease Pencil Material Popover currently has a color picker
for the Stroke of a Material using Solid style, but not one for
a Fill using Solid style.
With the default Grease Pencil Materials, the current
popover only shows the Stroke color for the grey "Solid Fill"
material (which doesn't have its Stroke enabled) instead of
the more useful Fill color.
This patch shows a Stroke color picker when the Material
has Stroke enabled and the style is Solid.
This is the same for the Fill.
Reviewed By: antoniov, mendio
Differential Revision: https://developer.blender.org/D17004
* Moved dyntopo.c to c++.
* The new element id system now mostly
works. Doesn't yet work with collapse
though, which is a tricky case. Element
IDs have to be manually freed now, doing that
with something as convoluted as a non-manifold
BREP's edge collapse is not easy.
* Fixed errors in second derivative of stroke spline
* Fix error on surfaces at an oblique angle to the viewport
* Fix roll mapping not working for sculpt texture paint
* Wrote a little C++ library for working with arc length
parameterized cubic splines.
* Stroke samples are queued if a roll texture exists.
That way we can build a stroke curve of sufficient
length to cover all the verts in the brush radius.
Boundary and corner flags are now stored in their own
attribute instead of in MSculptVert->flag. Note that
the other parts of MSculptVert will eventually become
their own indiviudual attibute (including the ->flag
which is still used by dyntopo).
* Fix memory corruption in sculpt attribute code.
* Fix a few compile errors for particularly pedantic compilers.
* Consolidate a bit of ASAN code in customdata.cc.
* The sculpt code now handles lifetime ownership
of SculptCustomLayer structs. This removes the
need to create temp attributes and get their
SculptCustomLayer reference structs in seperate
steps, as the code can internally update e.g. bmesh
block offsets for all SculptCustomLayer instances.
* Removed ss->custom_layers. The SCULPT_SCL_XXX enums
are no longer used to reference standard attributes
(though they are used, at the moment, to provide names
for them). Instead a new accessor struct, ss->scl,
has pointers to standard attributes (e.g. ss->scl.automasking_factor,
ss->scl.fairing_mask, etc).
This is the final version of the API that will be ported to master
(possibly minus the SCULPT_xxx alias functions that simply call
BKE_sculptsession_XXX equivalents).
Fix the pbvh draw optimization that only sends
active attributes to the GPU. The solution here
is the original sculpt-dev one (somehow this
ended up being removed but not replaced in the
pbvh-eevee patch).
It works by checking every viewport in every
window and if it finds eevee or workbench
in material mode it sets a flag in the pbvh
to forcibly upload all attributes.
Another approach is to simply rewrite pbvh
draw properly inside the draw manager to
begin with.
Save and restore python pointers when
adding or removing customdata layers, this is needed
since tool flags are a customdata layer in sculpt-dev.
Reallocating tool flags shouldn't clear python pointers.
* Fixed two missing break statements.
Amazing what a cascade of bugs this
produced.
* Fixed small bug in BKE_brush_curve_strength_ex.
* The radius scale fix for original normal mode
now applies to all sculpt brushes, not just
the draw brush.
* BKE_brush_curve_strength_ex now takes an argment on
whether to invert the input.
* BKE_brush_curve is now deprecated, it applies prior
behavior of disabling inversion for custom curves
* The standard sculpt brush spot test
API now supports square brushes.
* Supports tip scale x from paint brush.
* TODO: rewrite clay strips and paint
brushes to use standard api.
* Roll texture mapping semi-works.
* Brush mapping (device) curves now use the BrushCurve
API. This prevents having to save a CurveMapping
instance for every single device mapping (of which there
is ~5 or so) in every single channel (>40) for
every single brush (~40-70).
* Fixed regression where temporary attributes weren't being
stripped on file save in all cases.
* Fixed ss->totedges not being set correctly
in all cases. Fixes crash in cloth brush.
* Fix compile errors in alembic and fluid
code.
* Remove a couple of debug ATTR_NO_OPTs.
* Cleaned up a few old bmesh-only pbvh
functions into generic ones.
* Sculpt colors from master is now merged in.
* Implemenation for querying original verts is now
inside pbvh instead of sculpt.
* Still experimental
* PBVHs are cached in a global map keyed by
object name (though at the moment only one pbvh
is cached at a time).
* ss->pmap is now freed managed by pbvh.
* ss->bm is freed by the pbvh cache in some
circumstances but is stilled owned by SculptSession.
* Increased substep count.
* Snake hook now runs dyntopo twice by
inserting it into its commandlist twice,
instead of running over the same nodes and
re-executing it.
* Anchored stroke mode now works with
new brush command system
* Fixed original normal calc for anchored
brushes.
* Added yet more code in my as-yet vain
attempt to enforce seperation of
graphic drivers and ASAN.
backend for BMesh for profiling
purposes
* Purpose is to test the performance of
block vs page vs array CustomData allocation.
* Code is as simple as possible.
* Patches existing BMesh CustomData API.
* Not intended for master.
In an attempt to fix dyntopo artifacts with
snake hook I wrote a new heap implementation
for dyntopo, a min-max heap.
Turns out the seperation of collapse and
subdivision queues was a fundamental design
flaw in DynTopo. Unifiying them in
a single heap is much faster (as much as
2x faster depending on the setup), and
will allow for much cleaner code.
C++ API.
Basic idea is to wrap the C DNA structs
in a C++ wrapper class. Instances of
this class are then passed around by
value.
Rewrote BKE_brush_channelset_get_final_float
and BKE_brush_channelset_get_final_vector to
use these classes. Seems to work, will test
more.
Also, added a bunch of files that git failed
to add in the last merge.
Meed to do a merge so the code is in an
incomplete state. Anyway, I'm going to
move the brush engine code to C++, the
existing C code would never pass code
review.
I figure I can do this incrementally over
the next month or two and then submit a patch.
* Cleaned up naming.
- SCULPT_temp_customlayer_ensure is now
SCULPT_attr_ensure_layer.
- SCULPT_temp_cdata_get is now
SCULPT_attr_vertex_data.
- SCULPT_temp_cdata_get_f is now
SCULPT_attr_face_data
- SCULPT_temp_customlayer_get is now
SCULPT_attr_get_layer.
* Replaced with ss->limit_surface with an
entry in ss->custom_layers.
cache
* Fixed a few bugs in the curvemapping
cache code.
* Fixed bug in how BKE_channelset_compat_load
was copying brush.curve to/from the falloff_curve
brush channel.
now atomic
* bke_pbvh_update_vert_boundary now uses atomics
* This allows dyntopo surface smoothing
(surface_smooth_v_safe) to update vertex boundary
flags inside of a thread. This lessens degenerate
geometry created by hard edged brushes like
clay strips.
Two new automasking modes: "Brush Normal"
and "View Normal."
Brush Normal compares vertex normals to
the initial sculpt normal, while View
Normal of course compares with the
view vector.
Each of these modes have an angular limit
and a falloff. There's also an "original
normal" option, which needs a better name;
"original normal" is actually already taken,
but "automasking original normal" is a lot of
characters. Not sure what to do here.
This brush goes through all
the grids inside each PBVH node under
the brush, converts coordinates to
tangent space, filters out extreme displacements
and then converts back.
Simple, but very effective.
TODO: make this into a mesh filter too.
* BKE_brush_add now calls BKE_brush_sculpt_reset if
ob_mode has OB_MODE_SCULPT set. This should hopefully
eliminate a whole class of bugs I've been chasing.
* Detail enhance is now it's own dedicated toolslot.
This makes it possible to use autosmooth with
detail enhance.
Note the behavior of the smooth brush (which
invokes enhance when pressing control)
is unchanged.
* Fixed a bug with temporary attribute layers being constantly
cleared and reallocated with multires.
* Cleaned up velocity smooth code a bit.
* Pruned various dead #if blocks.
* generate_from_enum_ex in space_toolsystem.py
now takes a special argument to combine enum
items. This is used to make enhance a subtool
of smooth.
* The "boundary smooth" (psuedo-bevel) functionality of
SCULPT_neighbor_coords_average_interior is now its
own function.
* Fixed a few more pedantic gcc errors.
* Volume preservation had wrong bounds in
elastic deform brush leading to wrong
behavior.
* Fixed unprojected_radius channel not
being shown in header when scene radius
unit is on.
* Draw face sets now only fully rebuild draw buffers
in indexed draw modes that require it.
in weighted smooth
* Cached face areas are now updated
in a double buffered fashion;
all threads read from one side of
the buffer while the other is written
to by the threads that own a given
face; the buffers are swapped on
each iteration of a tool that uses
face areas.
* Fixes smooth flickering.
* This was actually kind of annoying; the
vertex->face-area-list code is in pbvh and
relies on edge ordering
around verts, but that order is non-trivial for
PBVH_FACES (relying as it does on a vertex->poly
map). This ordering was calculated entirely in
editors/sculpt_paint/sculpt.c, not callable from
pbvh.
* The solution was to add a helper function to pbvh
for building vertex->edge lists from vertex->poly
maps. This is then used by both sculpt.c and the
vertex->face-area-list code.
* Also improved boundary bevel smooth a bit. I'm
thinking of extracting it from SCULPT_neighbor_coords_average_interior
into its own function and possibly its own brush.
* Paint now has a brush_eval field which
is used in leu of ->brush if non-null.
* This lets us get rid of all the annoying:
`brush = ss->cache ? ss->cache->brush : BKE_paint_brush`
code. Now it's just BKE_paint_brush.
* Used by SCULPT_run_command.
* Also fixed nasty scene spacing bug.
* Fixed PBVH_FACES vcol draw bug.
* Fixed boundary smooth being turned on
if its temp customdata layer exists.
* Fixed unnesting of brush panels from
last commit improperly showing up
in the workspace tab for sculpt
instead of the brush tab.
related fixes
Various fixes so sculpt_init_tool_override_channels
for shift-smooth can replicate the prior behavior:
* Brush spacing will now look up brush channel
spacing directly for sculpt, instead of relying
on copying the channel data into Brush.
* Brush spacing code will now use brush channel
pressure for sculpt. Fixes broken shift-smooth
pen pressure.
* The falloff_curve channel is now automatically
added (before it was only used internally by
command lists, the code was defaulting to
the Brush field otherwise).
* BrushCurve now has an option for custom curve
presets to have negative slopes.
* The Falloff panel now puts the type dropbox
inside the panel header.
* Falloff panel also now uses brush channel data in
sculpt mode.
* falloff_shape is now a brush channel
In a somewhat unrelated change, I also unnested the
Brush Settings subpanels. It's been driving me
insane for a very, very long time. Much more
usable this way.
* Fixed bug where BRUSH_MAPPING_INHERIT was
being or'd to BrushMapping->flag instead
of assigned to ->inherit_mode.
* Fixed smooth_strength_factor
and smooth_strength_projection.
* Also added yet more asan poisoning to mempool
* Added a function to build final inherited brush
channel, BKE_brush_channel_copy_final_data. Takes
BrushMapping->inherit_mode into account.
color filter options from
sculpt-mode-features
* Follows comment in mesh filter's randomize and
uses BLI_hash_int_3d.
* Added a seed parameter.
* Also renamed SCULPT_get_mdyntopo to SCULPT_get_sculptvert.
* PBVH drawing for eevee is now used for
PBVH_FACES as well as PBVH_BMESH.
* PBVH_FACES now uses pbvh draw for eevee rendering
* Refactored gpu_pbvh_gpu_make_vcol_offs into a
more general gpu_pbvh_gpu_make_attr_offs.
This should be a usable alternative to using a generic
attribute gpu system (whether the one that's #ifdef'd out
in gpu_buffers.c, or the new one that hit master
recently).
* Textured workbench draw mode now works for pbvh drawing.
* Fixed nasty stack overflow in dyntopo edge collapse.
* Mask by color now works for dyntopo.
* Attribute and vertex color lists in the UI
now hide temporary CD layers.
* Added a specific op for removing vertex color
attributes.
* Fixed various bugs.
It simply wasn't maintainable to store active/render
vertex color layer as integer indices into the
global attribute list. Making that work would've
required a great deal of boilerplate that would
have to be inserted in lots of places. There
is simply no justification for doing that.
Instead, I've coded an AttributeRef struct that
simply stores a (type, name, domain) triplet to
uniquely reference an attribute layer.
This will be submitted as a patch for master
too.
* Brush input mappings now have three
inheritance mode: "always", "never" and
"channel" (use channel's inheritance mode).
* Note that the UI exposes a single inherit icon,
which just toggles between "always" and
"never," to lessen user confusion.
* Brush mappings default to "never" inheritance
mode.
* Fixed wrong node update flag in bke_pbvh_insert_face_finalize
leading to disappearing parts of the mesh.
* PBVH_BMESH construction is now partially
threaded.
* Fixed n**2 behavior in freelist-based
bmesh id implementation. I'd really
rather get range-tree faster, but
this works as a stopgap.
* Removed a bunch of debug ATTR_NO_OPTs.
* Mesh now has a render_color_index member.
+ We really need an attribute ref system
based on (domain, type, name) triplets.
* RNA uses render_color_index in all three
cases (loop colors, vert colors, and
the generic attribute types).
* PBVH draw uses render_color_index too.
UI list.
* Added an index to Mesh for active color attribute.
This seems janky to me, shouldn't this (along
with the active attribute index) be a
domain, name, cdtype triplet?
* Added a little api to preserve the active attribute
and color indices when changing mesh customdata
layouts. See above comment.
* The vertex color panel is now completely unified.
* TODO: allow setting render color layer (not sure how
to do this).
* Sculpt.brush_stroke now has a property to override
the tool slot.
* Note that this is somewhat different from how this
was typically done in the past. Instead of physically
switching slots we instead load the overriding slot's
brush's channels into ss->cache->tool_override_channels.
Basic idea is based off of {D6515}
* Removed a pointer from a sculpt cloth struct.
Due to padding this doubled the size of the
struct. Hopefully this will be nicer on the L3 cache.
* Fixed a nasty memory leak in the smoothing code with multires.
* Sculpt viewport header is now auto-generated in
much the same way as the workspace buttons
and right click menu.
* Added an API in the python code to insert
bits of UI code after a brush channel, currently
used to add flip colors operator.
* Added icon to add brush channels to header in
brush edit mode.
* Updated input mappings UI.
* BMLog now saves face material indices
* Fixed id corruption in join mesh edge case.
* The mesh->bmesh conversion function now checks
if IDs are corrupted in a bit smarter way:
+ Any id that's greater then 5 times the sum of
total elements with ids is assumed to be corrupt.
Avoids very large allocations for the fast element->id
map, which is a simple lookup table.
+ Alternative is to automatically switch to the slower
GHash id->element map.
+ Sculpt code would have to detect this case and regenerate
IDs?
* The slide relax brush is now internally split into two
seperate commands.
* Basic smoothing now uses fewer iterations, velocity smooth
is used to speed up convergence.
Added a new "auto face set" setting for brushes.
It basically invokes the draw face set tool,
with a few differences:
* The painted face set is fixed by user setting.
* More then one face set can be created,
these are assigned based on distance to
the stroke line.
* TODO: write a proper API for wrangling stroke
curves (should interpolate at least G2!).
The point of this is to enable better hard surface
brushes. Since the settings are extremely finicky
I've added an example of one (based on clay strips)
to startup.blend.
The necassary steps to make a hard brush out of this
are as follows:
1. Autosmooth: ~0.4;
2. Autosmooth radius scale: ~1.5.
3. Auto fset: on.
4. Hard edge mode: on (but turn off inherit).
How silly of me. I had left on
some debug code I wrote for edge collapse.
This particular debug code generated a .obj
format string of the local mesh around an edge
before collapsing edges.
What amazes me is that the performance regression
was only about as bad as the original edge collapse
implementation in DynTopo.
other fixes
* The paint brush now supports accumulate.
* Fixed bug with PBVH_FACES not setting
MSculptVert update flags correctly in
face set draw brush.
* Topology rake now has a mode where it
simply propegates directions from
boundaries.
* Dyntopo is now run before other commands in the
brush command lists.
* Fixed nasty command subspacing bug.
* Added a missing RNA library override flag.
* You can now edit brush input mappings
inside the main workspace brush panels.
* PBVH_CHECK_NAN now limits how many reports
it prints from a given source file.
* Fixed various problems with shift-smooth strength
setting.
* Fixed a NaN in the smoothing code.
* Fixed a nasty bit of memory corruption
* Along the way, added ASAN support to
bmesh customdata blocks.
* Each CD layer is padded by 32 bytes
inside the bmesh data block.
* Also fixed a few minor errors in
mempool's asan support.
* Tried and failed to fix numerical
stability issues with lasso/box
trim brushes.
* Input mappings now take a premultiply factor
to scale the input data prior to evaluation;
* Mapping data can also now be fed through a
(wave) function prior to evaluation.
* The UI now has seperate inputs and outputs
sections for input mapping to avoid confusion.
* Added a distance mapping and implemented the speed
mapping.
* Also fixed original data bug in color filter.
Cleaned up brush channel input mappings:
* BrushMapping now stores .min/.max
* BrushMappingDef .min/max now sets BrushMapping min/max
instead of changing the curve preset bounds.
* Fixed how BKE_brush_channel_eval_mappings evaluates
the mappings stack. Mappings now blend directly
with channel value instead of accumulating a multiplier
that's applied at the end.
* Consequently, BrushMapping->blendmode now defaults to MA_BLEND_MULT.
* Exposed BrushMapping->blendmode in RNA and UI.
Note that it doesn't support every MA_BLEND_ type,
it provides its own EnumPropertyItem list of
supported blendmodes.
* Added a random input method, BRUSH_MAPPING_RANDOM.
* Fixed BRUSH_MAPPING_ANGLE being given data in the wrong
range (all channels should be 0..1, not -pi..pi).
Other changes:
* Improved the uv smooth brush. It's still hidden behind an
experimental pref.
* Added a SCULPT_temp_customlayer_has function to check if a temporary
customdata attribute layer exists.
* Fixed a bunch of broken sliders in the paint_toolsystem_common.py.
* Wrote a new function, SCULPT_reproject_cdata,
to reproject loop customdata after smoothing.
* SCULPT_reproject_cdata is only called if UV
layers exist.
* All of the smoothing tools (hopefully all)
use it.
* This change is necassary to properly support vector
displacement maps in the future; otherwise DynTopo
will introduce lots of noise into the uv tangent
space.
Most of this commit made it in one or two commits ago.
Added a little macro to detect mysterious NaNs reported
by users and that appear to be related to threading.
It's seeded in various places to hopefully catch
where this is happening.
* Paint brush now uses its own temp attribute
layers instead of hijacking MSculptVert->origcolor.
* The various SCULPT_UNDO_XXX enums are now bit flags.
* Fixed anchored/drag drop mode for the paint brushes.
* Color hardening brush now works with dyntopo.
* Added a CD_FLAG_ELEM_NOINTERP flag to the customdata
API. If set it will either copy the first element
in the sources list if CD_FLAG_ELEM_NOCOPY is unset,
or nothing at all if it is.
This necassary to properly support the design
pattern whereby helper custom attributes
reset themselves in each brush stroke by comparing
a per-vertex stroke id with ss->stroke_id, thus obviating
the need to walk the entire mesh at every stroke start.
This commit rewrites much of the core BMLog
serialization logic.
BMLog originally did not support mesh
elements changing their internal topology,
which created ID conflicts in the log. Thus
it was impossible to use much of the BMesh API.
Instead DynTopo had its own implementations of
BM_edge_collapse and triangle edge splitting
that worked by recreating local mesh topology
from scratch.
I got rid of these functions a while ago and
tried to add support for elements changing
topology to BMLog. Unfortunatey I struggled to work
out all of the edge cases, and it turned out easier to
refactor the core serializer methods wholesale.
vertex color drawing.
* Added two buttons to toggle between vertex
and material color modes in workbench drawing
mode.
* They are labeled "Colors" and "Normal" to
avoid confusion; "Vertex" is ambiguous, while
"Material" might be taken to impley "EEVEE."
* For now they only show up if a sculpt paint
brush is active.
* Updated startup.blend so the sculpt layout
has vertex drawing mode on by default.
* BMLog now has a more fine-grained logging
facility to track the call chains
that produce specific log elements.
* Wrote a new function in bmesh_core.c to
dump local geometry around an element to
stdout in .obj format.
* Edge collapse now properly handles the
fact that bmesh handles sharp flags
inversely, i.e. edges *not* marked
with BM_ELEM_SMOOTH are sharp.
* Wrote a new BMLog API that handles elements
undergoing topological changes a bit better.
- BM_log_[edge/face]_[pre/post]
- Idea is to call the _pre before calling
collapse or split edge, then _post afterwards.
- No longer need to assign new IDs
in certain cases to avoid confusing BMLog.
- Other parts of BMLog may now be redundant;
need to check.
* Deleted some #if 0'd code
* Fixed a bug in BLI_smallhash_ensure_p, it didn't properly
set up state for when smallhash is used as a very simple
set.
* Fixed the completely broken shapekey conversion
in BM_mesh_bm_from_me; this bug is most likely
in master as well.
* Note that, while shapekeys now work in dyntopo
it does not represent a complete sculpt layers
implementation; the layers are still stored in
world space.
* The motivation for fixing this was to keep
dyntopo from destroying shapekey data, which
was the only form of custom attributes it didn't
support.
* That was because shapekeys were never being converted
to custom attributes for bmesh to begin with, the
conversion code was quite broken.
In addition to all this, this commit also has
a fix dyntopo collapse fixes.
* BM_edge_collapse now has an option to use
a new collapse implementation that can
handle non-manifold geometry properly.
* The aforementioned implementation is a replacement
for bmesh_kernel_join_vert_kill_edge. Note that
the old code still exists as
bmesh_kernel_join_vert_kill_edge_fast and is used
by default.
* This was always buggy, which is why
I have code that detects and snips off
non-manifold fins.
* Turns out it is more robust to simply allow
non-manifold collapses and clean up geometry
afterwards. IIRC this is how DynTopo (and the
paper it's based off of) originall worked.
* Paint brushes will now support
dyntopo if "dyntopo disabled"
(the one in their brush settings,
not the global setting in the
"Dynamic Topology" panel) is unchecked.
* Fixed dyntopo undo not properly handling
pushing more then one undo type.
This one is an actual error. I
went through the trouble of compiling
in a linux VM and still somehow managed
to miss it.
Also fix wrong range for normal_radius_factor.
interface to mask expand in "selection"
mode.
Leftclick runs normal expand.
Shfit-leftclick subtracts from mask.
Pressing CTRL inverts adding/subtracting
* The dyntopo collapse function now
properly snaps UVs, including at
island boundaries.
* PBVHTriBufs are now split by UVs
(and face sets); this turned out
to be surprising easy.
* Also fixed a few bugs relating to
hiding/revealing stuff.
* Brush radius wasn't being calculated correctly if symmetry was on.
* Unnessed SCULPT_run_commandlist, it now calls
do_symmetrical_brush_actions instead of the reverse.
* Renamed MDynTopoVert to MSculptVert. Old name didn't
make sense given that all three PBVH types now use it.
Mercifully it's never saved in files, and even if it
somehow was saved the CD file loading code checks for
that.
* Fixed very nasty customdata bug where
if the first layer of a given type was
CD_TEMPORARY, then on being stripped out
of the customdata set the active references.
I think I tracked down where this happened, but
just to be safe I also wrote code to detect it and
regenerate the active refs too.
* Fixed rotate brush.
* Fixed mesh filter crashing with automasking on.
Face set extrude now mostly works, thought it's
still buggy and unstable in DynTopo mode.
Interfacing PBVH_BMESH with the BMOp API
turned out to have a few nasty gotchas; the last commit
fixed a lot of things but some rethinking of the basic
design still needs to happen.
The way toolflags reallocated the entire mesh
just to add or remove one pointer from BMEdge/Vert/Face
was highly broken. Now a CD layer is used instead.
* PBVH_UpdateTopology is now properly cleared in all cases.
* BKE_curvemapping_cache.h no longer provides a global curve
cache, the brush system now allocates its own on startup.
* BrushChannel now uses its refine callback to
generate new structs for individual BrushChannelType's.
- It generates a .value member that's a copy of
one of the exisitng float_ bool_ enum_ etc_value members.
- Haven't figured out how to delete the XXX_value members
yet though.
* Drag dot now uses anchored's method
of calculating brush rake angle, this
is much more usable and less numerically
unstable.
* There is now an option ("Smooth Raking" to
smooth rake angles during brushes. This was
a failed effort at fixing drag dot raking
that turned out to be useful for other things.
* Drag dot no longer requests subspacing events
from the brush system. This made a huge
difference in performance and is now on par
with anchored mode.
GCC is giving errors on assigning
integers to char arrays. Naturally
this makes sense, and of course MSVC
doesn't even have a warning to detect
this (I tried enabling them all).
I may go back to clang.
For some reason I have to
take the sqrt of pressure
to match previous behavior,
but for the life of me I can't
find the offending double
multiplication.
* PBVH_FACES now uses MDynTopoVert (have got
to rename it) to store boundary/corner/visibility
flags the same way PBVH_BMESH does.
* Fixed brush add/sub buttons in header not
working
* Fixed inverted brushes feeding negative strength
to sub commands (like autosmooth, which flips it
to sharpen mode).
* Brush editor tab now defaults to old
interface, with two options:
- Advanced, which shows more options
- Edit Mode, which shows workspace visibility buttons
* Hard edge mode (which forcibly sets face set slide to 0
and enables preserve faceset boundarys) now works again.
* Smooth_strength_factor is now a brush channel with
inheritance set to true.
* Alt-smooth now restores the hard edge mode and
smooth_strength_factor from the active brush context.
While both are default inherited from toolsetting defaults,
it can be quite confusing if either have inheritance unset
by the user in the Smooth brush.
* Fixed a particularly nasty memory leak
where the entire process of entering sculpt
mode was being done twice.
* Discovered that range tree is extremely slow.
Got the alternative freelist version up and running,
and replace a usage of GSet with a bitmap. However
the new code is disabled pending further testing.
Literally an order of magnutude improvement.
* Cleaned up the SculptCustomLayer API that is
used for custom data.
* Various SculptCustomLayer references are now maintained
in ss->custom_layers and are updated automatically when
the CD layout changes.
* PBVH_GRIDS now forcibly allocate custom layers in simple_array
mode (i.e. they don't allocated real customdata layers at all).
* SculptCustomLayers can optionally be preserved in the final mesh.
* Fixed handling of CD_TEMPORARY which was broken.
* The layer brush can now split the pbvh during use.
* Persistent base data is now saved as permanent CD layers (except
for PBVH_GRIDS). This is necessary for undo, if we want we can
add special code to remove them on exising sculpt mode.
* The layer brush now uses the SculptCustomLayer API instead of
having seperate bmesh and faces/grids implementations.
* In unrelated changes, fixed curve presets for clay brushes.
- Still need to implement stabilized input mappings, which the
clay thumb brush needs.
* BrushChannelSet is now a pure collection. This
eliminated the annoying brush.channels.channels
paths, and also makes library overriding work.
* Now sure I've done this correctly. Struct extended
collection properties are a bit confusing.
* Move more dyntopo settings to brush channels
* Implemented the unprojected radius hack in
the new brush system. I'm not really happy
with it, but doing it properly is going to
take some thought.
* Added a new curve brush channel type
* Added a BKE_brush_curve_strength_ex method
that just takes preset and curve as arguments,
instead of pulling them from Brush.
* Autosmooth and topology rake now have their
own falloff curves.
* Moved brush settings (in sculpt mode) to
(for now) a new properties editor tab.
* Brush settings can now be individually configured
to show up in the workspace buttons.
* Brush settings can also be reordered.
* The new brush tab has a "preview" subpanel
to preview the workspace settings layout.
This is where settings are reordered.
* Sculpt now has an API to get brush channel settings.
If a sculpt cache exists it will use the channels there
(ss->cache->channels_final), otherwise it pulls them
from a brush and Sculpt toolsettings. Exampes:
float f = SCULPT_get_float(ss, "setting", sd, brush);
itn i = SCULPT_get_int(ss, "setting", sd, brush);
* Improved the UI a bit
* The input device curves for brush channels
now use a copy on write mechanism.
+ It's based on a global cache of curves.
The alternative is to reference count
BrushChannels, which I also implemented
then abandoned.
+ Profiling showed that copying CurveMapping
instances was actually a problem.
* Lots of small fixes to the old<-> new brush setting
conversion code;
* Brush commands can now, sortof, have individual
spacing. The default brush spacing still acts
as a minimum though.
* Added a BLI_ghash_lookup_p_ex method that
returns the key ptr inside the ghash (it
returns the actual key, not a pointer to
Entry.key).
* Added a general 1d CurveMapping preset operator
that uses an RNA path to get the curve.
BrushChannels are now stored in linked lists
instead of simple arrays. This helps to
avoid memory corruption.
I had originally wanted to be able to pass
BrushChannels by value, but that doesn't really
work since they heap allocd data (the input
mapping curves).
Command Lists
* The new system will be based on command lists
generated by (eventually) a node editor.
* For now, the lists will be hardcoded.
* Idea is to make a minimal viable
brush engine that won't cause file breakage
when the upgrade to node-based brushes happen.
Brush Channels
* Wrote new structures and API to wrange
brush parameters: BrushChannel.
* Supports, floats, ints, enums, bitmasks,
with plans for vec3 and vec4.
* This will replace UnifiedPaintStruct,
most of the members of Brush and the
DynTopoSettings struct.
* Brush channels can
be mapped to various input device
channels (e.g. pen pressure); each
mapping has its own associated curve
(CurveMapping instance) and bounds.
Brush channel inheritence chaining
* Brush channels can form inheritence chains
* Channel sets are stored in three places:
in the scene toolsettings, in Brush, and in
individual brush commands.
* Node groups will also have a channel set.
* Channels in each set can be flagged to
inherit from the parent set.
* Inheritence happens in seperate merged
channel sets at runtime. The final
Brush channels live in Brush->channels_final,
while the final command channels live in
BrushCommand->params_final.
design study (note that it's #ifdef'd out).
Basic idea is to put all the sculpt brush code
in a single large template. This template
takes a PBVH adaptor class (of which there
would be three, one per PBVH_XXX type)
as a template argument.
Basically we're using the compiler to generate
three complete copies of every brush implementation.
C++20 concepts are used to validate the pbvh classes.
An example brush implementation:
pbvh->forVertsInRange(
{
.brush = ss->cache->brush,
.radius = radius,
.use_threads = true,
.use_original = false
},
[&offset](auto viter, int node_i, void *userdata) {
//add offset to vertex coordinates
madd_v3_v3fl(viter.co, offset, viter.fade);
},
[](PBVHNode *node, int node_i, void *userdata) {
BKE_pbvh_node_mark_update(node);
});
Seperate enabling PBVH_BMESH from enabling DynTopo:
* Created a new option to globally disabled
DynTopo.
* The DynTopo panel header now reads "Dynamic Mode",
to hopefully signal that turning on PBVH_BMESH is
a seperate step from enabling or disabling DynTopo
itself.
* The first checkbox in the panel is "DynTopo" so it
should be clear enough (it's on by default, with multiple
layers of file versioning checks).
PBVH_BMesh's undo system:
* CD_MESH_ID layers are now permanently saved once
they are created (by default they are not). This
fixed a *lot* of bugs:
Before this the undo system had to save maps between
mesh indices and mesh IDs on transitioning
between sculpt and global undo steps. This was
extremely error prone, and it simply wasn't possible
to cover all of the corner cases
* Note that there is still an odd bug where the first
global undo push after a sculpt step gets ignored,
I dunno what's up with this.
* Dyntopo undo should be nearly (hopefully completely)
bug-free after this commit.
C++20
* Made a few small changes to get blender to compile
with c++20. std::result_of was removed, had to
replace a couple of usages of it with std::invoke_result.
* I'm planning to do some design studies on rewriting
sculpt into C++.
* I strongly suspect we are going to need C++20'a new
concepts feature if we move sculpt into C++.
I'm planning to do some design studies on how
that might work.
* Fixed noise on using autosmooth with tools that use original
coorinates. While this was most prominent with DynTopo,
it did happen with other tools.
* The solution is to smooth the original coordinates as well
as the explicit coordinates if the active tool requires
original data.
* I decided to replace the original coordinates system for
PBVH_FACES and PBVH_GRIDS with the same MDynTopoVert structure
DynTopo uses. The alternative would have been extremely messy
code.
* Todo: Rename MDynTopoVert to. . .SculptInfoVert?
* Todo: Cache boundary flag and corner info in MDynTopoVert->flag
for PBVH_FACES/GRIDS similar to PBVH_BMESH.
* Collapse now uses code from decimate to detect
degenerate cases.
* Remaining, unknown (and rare) degenerate cases
are now detected (via presence of duplicate verts
in faces) and fixed.
* DynTopo fills in undo size properly now,
so undo memory limiting works.
* BLI_table_gset now internally uses a SmallHash instead of
a GHash. Profiling revealed this to be quite a bit
faster.
* This is something of a stopgap until C++-afication of
pbvh, when we'll have our pick of a bunch of
really nice C++ hashmap libs.
* pbvh_collapse_edge bites the dust; dyntopo now uses
BM_collapse_edge. Of the three topology operations
(subdivide edge, collapse edge, dissolve 3/4 valence
vertex) only dissolve still has a dyntopo-specific
implementation.
* Fixed a bunch of annoying memory corruption bugs.
* Non-manifold triangles are now detected in more
places.
SmallHash changes:
* Enabled removal
* Fixed infinite loop bug caused by
improperly counting free*d* cells
versus free cells.
* Added a BLI_smallhash_ensure_p method
that works just like the GHash version.
Sculpt replay system
* Roughed out a simple system to record and
play back sculpt strokes using a simple
text format.
* This is exclusively for
performance profiling and unit tests.
* For each brush stroke the system saves a copy
of the active StrokeCache and PaintStroke
and parts of Sculpt.
This should make profiling DRAM thrashing a lot
easier.
* Changed brush defaults a bit. New defaults
are for organic modeling.
* autosmooth_fset_slide now defaults to 1, so
face set boundaries are smoothed but stick to mesh
surface (if 0 they would function as hard edges).
* Weight by area smooth mode is on by default for all
brushes.
* Cleaned up versioning code and made it
kick in at 3.00:21, with some simple checks to
try and detect existing data from beta testers.
* Also fixed a small crash bug.
* Wrote a simple fix for drawing face sets
in inverse (ctrl) mode with face set automasking
on.
* Various fixes related to hard edges and smoothing.
* Started writing some code to defragment bmesh mempools.
Need to figure out how to avoid triggering excessive
PBVH node rebuilds.
I might write a paper on this. Topology rake now locally
updates a vector field, which it uses to smooth the input
and constrain to mesh (including face set) boundaries.
This can make an enormous difference for things like
smoothing.
Note that this is different from the existing 'curvature rake'
mode, which also builds a field and which is fed into the input
of this new one.
The only oddity is that the field is stored in a CD_PROP_COLOR
since we don't have a CD_PROP_FLOAT4, and this shows up in the UI
(not sure if I'm messing up the CD_TEMPORARY flags or if the UI
doesn't check for them).
* Fixed crash in dyntopo collapse. The
loops around vertex iterator dyntopo uses
doesn't actually work on non-manifold meshes,
or meshes with invalid normals, this was not
being checked in pbvh_bmesh_collapse_edge.
* Rotate tool now works with dyntopo.
* Added a minimal edge API to query edge
boundary states.
* This is necassary because the previous approximation,
testing if two adjacent verts are boundaries, breaks
for triangles.
Added an option to split face set boundaries on mirror
boundaries; currently only DynTopo supports this.
Very useful for making hard edges along mirror lines.
* Sharp edge flags are now supported and are
treated much the same as face set boundaries:
+ Dyntopo preserves them
+ Interior smoothing treats them as boundaries
+ Corners are detected and pinned in smoothing
+ TODO: add a brush flag to ignore sharp boundaries
for smoothing.
* Seams are also preserved, but don't affect smoothing.
* BMLog now saves edges.
* The new edge split function is enabled.
* Dyntopo now pushes new combined BMLog entries in
its top-level function, to avoid scary id reuse
edge cases.
* SCULPT_vertex_is_boundary/corner now take a bitmask
of which types of boundaries you wish to query instead
of check_face_sets.
* New function SCULPT_vertex_is_corner, similar to
SCULPT_vertex_is_boundary it takes argument to
check face sets. PBVH_FACES/GRIDS version is
incomplete. It returns a bitmask of whether
the vert is a boundary corner and/or a face
set one.
* PBVH_BMESH uses a somewhat more expensive
calculation to detect corners of face set islands by
edge angle. This is currently not done for boundary
corners.
Corner pinning now happens in:
* The internal smoother dyntopo uses for stability reasons.
* SCULPT_vertex_neighbor_average_interior.
* Topology rake.
* Dyntopo collapse.
Note that DynTopo always pins face set corners
but everything else only does so if preserve face
sets is on.
* All of the smooth brushes now use the SculptCustomLayer
system for temporary data, so all work with dyntopo now.
* You can now use a flat array in SculptCustomLayer with
PBVH_BMESH (though you have to build the structure manually).
The mesh filter code uses this.
* Smooth (and autosmooth) now have an option to preserve face
set boundaries. Corners are currently not handled.
* Simplify brush has preserve face set boundaries autosmooth
flag set by default.
* SCULPT_vertex_is_boundary now takes an addition argument
for whether to check for face set boundaries.
* Added an option to weight smooth by face areas
* Dyntopo now caches face areas in a CD_PROP_FLOAT layer
* Dyntopo also caches number of edges around verts inside of
MDynTopoVert. To avoid increasing the struct size flag was
made a short.
* Cleanup mode (dissolves 3/4-valence verts) now piggybacks on
subdivide code to build list of verts; this is much faster.
To run, in the python console enter:
bpy.msgbus.pbvh_bmesh_do_cache_test()
The output will be in the regular console. The test
build a half-million vert cube and smooths it. It runs
several passes (all of which perform the same smoothing
operation):
1; Randomized order pass
2. Ordered pass (by vertex clustering)
3. Same as 2 but with a purely data-oriented version
of the bmesh structs.
4. Same as 2, but using a version of the bmesh structs
with all pointers replaced by integer indices.
At least on my laptop #3 and #2 are about a third faster
then #1, and #2 tends to be around 15%.
* Fixed multires apply base feeding bad original coordinates to
deform modifiers.
* Roughed out some code for cache performance testing.
* Wrote skeleton code for a PBVH texel API; hasn't been tested
yet and may be removed.
* Added a limited "fast draw" mode to pbvh drawing
that tries to limit data sent to the GPU.
- Facesets and mask data are disabled.
- Indexed mode is forced.
- Does not work (at all) for multires.
* Finally fixed some outstanding bmesh sculpt undo bugs:
- Forgot to mark pbvh nodes to update their bounds, which
produced a bug I had thought was caused by something else.
- Hopefully fixed a long-standing occasional memory corruption
bug.
This commit fixes boundary brush for multires which
broke two commits ago.
This required implementing the geodesic api for PBVH_GRIDS,
which I did by building topology maps in a rather. . .
haphazard fashion.
Basically I built a vert->edge map and then used it to
derive a pseudo edge to quads mapping (it maps edges
to all the verts in the two surrounding quads except
the edge's own verts).
Just for fun I enabled geodesic mode in mask expand;
it seems to work.
(still a wip)
The boundary brush now builds a geodesic distance
field (from the boundary) from which it derives a tangent
field:
* These now define the rotation plane for bend mode.
* Rotation origins snap to these planes.
There is also typedef'd code for visualization tangents
in a temporary object (note the sculpt object), to enable
define VISBM in sculpt_boundary.c. This will be removed
lated.
Additional changes:
* Added a function to get the number of edges around verts,
SCULPT_vertex_valence_get.
* Added an API to calculate cotangent weights for vert fans,
SCULPT_cotangents_begin (call in main thread first) and
SCULPT_get_cotangents.
* Sculpt neighbors for PBVH_FACES now uses ss->vemap if it exists.
* The Mesh topology mapping code now takes extra parameters for
sorting vert/edge cycles geometrically.
* Similarly, there is now a function to sort BMesh edge cycles,
BM_sort_disk_cycle.
* MDynTopoVert->flag now has a bitflag for when the disk cycle
sorting needs to be redone, DYNVERT_NEED_DISK_SORT.
* The sculpt geodesic code now supports passing in custom vertex
coordinates.
* The geodesic API can also build an optional map of which vertex
in the initial vertex list is closest to any other vertex.
* The PBVH draw subsystem is now told whether any viewports
have drawtype >= OB_MATERIAL before anything in any windows
are drawn. There are no alternatives given the design
constraints of sculpting, where simply uploading data to the GPU
quickly becomes a bottleneck.
* Fixed flat vcol shading mode.
Also:
* added BMLog function to save mesh IDs.
- Used by SCULPT_UNDO_DYNTOPO_BEGIN/END instead of
saving the whole mesh, which was the previous behavior.
* SCULPT_UNDO_DYNTOPO_BEGIN no longer pushes a non-dyntopo
geomtry undo node, as this is no longer necassary.
This greatly speeds up going into/out of sculpt mode
with dyntopo enabled, as before it was copying
the mesh twice.
* PBVH_BMESH now supports faces other then triangles;
* Dyntopo triangulates faces as it finds them.
- I looked into methods of preserving quads and failed to
find anything that worked well in practice; it actually
worked better to use topology rake to align triangles
into quads and then mark diagonal edges for later dissolving
then to try to preserve quads explicitly (I've not
implementated that here, that was research code).
- To avoid excessive cache-destroying loops over vertex-faces,
DynTopo flags which verts have non-triangle faces.
* PBVHTriBuf now builds edge buffers so we can avoid drawing
tesselation phantom edges.
* BMLog also now supports arbitrary faces. It still does not
support edges though.
TODO:
* Fix vcol cell shading mode
* Make sure indexed drawing works
* Face set boundaries are now preserved on dyntopo remeshing.
* MDynTopoVert->flag now has a DYNVERT_FSET_BOUNDARY flag
in addition to DYNVERT_BOUNDARY.
* Instrumented uiBut with ASAN poison regions to hopefully
find the super evil memory corruption bug that's been driving
me insane. It's frustratingly intermittent. There are five
poison regions.
* Prototyped a threaded bmesh->Mesh converter function. It's about
20-30% faster. Currently disabled.
* Tried to fix more of the bugs when stepping between sculpt and
other undo step types in the global undo stack.
instead of leaving that to the client.
Also semi-fixed uninitialized memory bug in bmesh unit test (dunno
how best to memset a C struct in C++ won't won't run afoul of some
random compiler somewhere).
It uses a simple LSCM-like solver; hold ctrl to do simple
laplacian relaxation.
There are some interesting artistic possibilities to using
DynTopo with UV maps, the point of this tool is to help
explore them.
Note that I'm not planning to merge this into master with
the rest of this branch. When the time comes I plan to
move it into a new branch for sculpt research stuff.
pbvh drawing.
* Dyntopo now stores a list of PBVHTriBufs in leaf nodes, one per material
used by the node.
* Actual drawing buffers live in a new mat_draw_buffers PBVHNode member.
A few notes:
* MESH_ID layers are not saved on conversion to Mesh unless
you ask for it in BM_mesh_bm_to_me's params.
* Still need to test the box/lasso trim tools.
* Need to find some way to test loop/edge ids, which aren't
used by dyntopo.
layers to a bmesh at once. Helpful since bmesh customdata
layers are allocated in single blocks, thus adding
layers individually can lead to lots of memory
copying.
bmesh
* System is per element type. So you can have unique ids for verts and
faces, but not edges and loops.
* Supports an optional id to element lookup table.
* Uses single id space for all elements
* Added a new CD_FLAG_ELEM_NOCOPY flag to tell
customdata_bmesh_copy_data to ignore that layer.
* IDs are stored as a temporary customdata layer with
CD_FLAG_ELEM_NOCOPY set.
* Got automasking to work with dyntopo properly.
- AutomaskingCache->factor
has been replaced with the new temp layer API (which works for all
PBVH modes).
- AutomaskingCache->factor is, however, only initialized for
topology and face set boundary modes (if DynTopo is enabled)
since it's probably better to calculate the rest dynamically
in that case.
* Fixed stats bug
* Got threaded mesh->bmesh conversion working (it's disabled
pending further testing however).
Note that SCULPT_dynamic_topology_enable_ex calls BKE_scene_graph_update_tagged,
which in tests was adding ~1 second to conversion time for larger
meshes. Do we need this call?
a new one from scratch, an operation that can be slow despite being
threaded.
PBVH building is a memory bound operation (not just on the CPU side
either, remember the draw buffers have to be fully regenerated too).
Incrementally updating it this way is enormously faster (about as fast
as non-dyntopo undo).
The downside is we don't have the convienience of users regularly
building the pbvh from scratch anymore. Dyntopo does try to
join empty PBVH nodes (which happens after every stroke), but
that's not a complete substitute for a decent tree balancer.
That's on the todo list.
* Wrote a new API for wrangling temporary customdata layers across pbvh types:
- SCULPT_temp_customlayer_ensure: makes sure a (named) customdata
layer exists. Works for multires; since these are temporary
layers we can safely allocate them in a temporary CustomData
structure (in ss->temp_vdata).
- SCULPT_temp_customlayer_get: initializes a special structure,
SculptCustomLayer, that is used to get per elem customdata.
- SCULPT_temp_cdata_get: Uses a SculptCustomLayer ref along with
a SculptVertexRef to look up the data.
* Sculpt code seems to be memory bandwidth bound.
* Some key topology loops will have to be written manually
instead of using BM_ITER.
I wrote a function to re-allocate a bmesh with elements ordered by
PBVH leaf nodes, SCULPT_reorder_bmesh. It's currently disabled.
This is going to take more profiling, but my original proxy refactor
idea might be worth revisiting. Might be more cache efficient.
The good news is that the worst case is the smooth code, which I can speed
up significantly by keeping a bit of state around.
* Sculpt expand now works with dyntopo in more cases
* Fixed various dyntopo face set bugs
Stuff from several commits ago:
* There is now an API to get face sets using SculptFaceRef's.
+ SCULPT_face_set_get
+ SCULPT_face_set_set
* Prototyped a faster geodesic propagation function, but it currently
doesn't work.
* Dyntopo triangulation now preserves face flags (took some work as BM_triangulate_face explicitly prevents selection flags from being preserved).
* Also face smooth flags are no longer being overriden.
* Most of the faceset create operators work (I'm not sure I've tested
all of them though).
* SCULPT_face_set.c now has helper functions that checks if a pbvh
is *not* PBVH_BMESH, in which case it builds a temporary bmesh,
otherwise ss->bm is used (sculpt_faceset_bm_begin and sculpt_faceset_bm_end).
+ Note that some functions were able to use SCULPT_face_set_XXX
instead and avoid bmesh entirely.
reference counted. This fixes various undo bugs caused by dyntopo
needing to execute an undo push but not being able too (e.g. during
file load, and I think it also happens sometimes with global undo).
A much better way of fixing this would be to add unique IDs to mesh
verts and faces, perhaps as a customdata layer.
The root problem is that BMLog assigns unique IDs to mesh elements,
which it does via a series of GHash's. I imagine this is a fairly
serious violation of the undo system's design rules, since it means
BMLogs are tied to specific instances of the bmesh in SculptSession->bm.
There were some hacks to try and get around this, but they were buggy
and needed to push the unstack stack to work, which wasn't possible in
all cases (e.g. if G_MAIN->wm.first->undo_stack is NULL, as it is during
file loading and apparently global undo).
Anyway, long story short each chain of SculptUndoNodes needs some way
to reconstruct their ID GHash's when exiting/entering the chain. The
only way I could think to do this was to make BMLog reference counted,
with BMLogEntry the users.
Like I said, having a proper system to assign unique IDs to mesh
elements would be *much* better.
things that need custom spacing (that is coaser than the brush radius),
and refactored the existing dyntopo spacing code to use it.
* Added option to topology rake to ignore brush falloff settings
(it forcibly uses Smooth falloff).
* Smooth and topology rake support custom spacing now.
+ This is especially important for the clay brush, which works
better at smaller spacings and with a bit of autosmoothing.
Now you can tell it to override the smooth spacing to be coarser,
leading to much better performance.
* Topology rake now has a projection setting similar to autosmooth
which defaults to 1.0 (to preserve current behavior).
The main motivation for this commit was to make topology rake work
better for normal brushes. This is now possible, however it tends to
make the brush slower and also the settings are a bit fiddly.
We might want to make dedicated brush presets for this.
Btw, the UI for brush settings are becoming a real mess. Help!
projection neighboring vertices onto the current smooth vert's normal
plane, multiplied by a "projection" factor. This is extremely similar
to what the surface laplacian produces, but is much simpler, uses
no temporary state and thus can be used in more places.
certain degenerate cases that produce lots of bad geometry (and
also bad PBVHs that slows down the whole mesh).
+ A very small amount of surface smoothing is now applied by dyntopo.
+ The recursive functions that expand the region considered by dyntopo
now ignore "front face only" for depths less then 5.
+ The number of edges dyntopo can split or collapse in one run has been cut in
half to 4k.
- This limit is also now dynamically adjusted by a measure
of how skinny the edges are.
- This required implementing SCULPT_UNDO_GEOMETRY for dyntopo.
That turned out to be more work then I expected. Basically
it writes an entire Mesh to BMLogEntry, which can be swapped
with current bmesh. Tricky part was patching bm log ids.
SCULPT_boundary_info_ensure, instead PBVH_BMESH keeps
track of boundary vert flags internally. This prevents
nasty first-click lag on the smooth brush as well as anything
with autosmooth.
Making multiply layers sequentially can lead to corrupted offsets.
Instead, ensure all layers exist with SCULPT_dyntopo_ensure_templayer
first,
then get all the offsets at once.
- To do this I made a little API to make scratch
customdata layers: SCULPT_dyntopo_[ensure/get]_templayer.
Takes a customdata type and a layer name (e.g.
'__dyntopo_bleh") and returns a customdata offset.
- Note that I also did this for the persistent base code.
* Added a macro to check if a tool supports splitting the PBVH
during a stroke, DYNTOPO_HAS_DYNAMIC_SPLIT. It is in sculpt_intern.h
(for now) to avoid the enormous amount of recompiling that is
triggered if DNA_brush_enum.h is modified.
* TODO: Right now the undo code resets original vertex coordinates for
bmesh PBVH. This means tools that rely on original data (sharp and
layer) can't split the pbvh during the stroke, since that will
allocate new undo nodes and reset original coords.
The solution is to move the original data API entirely out of the undo
code.
for DynTopo. Profiling consistently showed it to be a bottleneck.
I've now written scalar versions of this function four times.
For now I'm committing this inaccuration version. I'm also committing
code for a vectorized version I found in a paper. Still need to rejigger
the dyntopo code to use it though.
This system is designed to inherit settings from scene dyntopo defaults
in a highly flexible way; settings can be individually overridden via the
.inherit bitmask.
At stroke time the scene settings and brush->dyntopo are merged
and stored in brush->cached_dyntopo.
Note that brush->flag has a bit flag, DYNTOPO_DISABLED, with a few
subtlies. It does not switch the PBVH back to PBVH_FACES mode, it
simply disbles dyntopo topology update. It also doesn't inherit from
any default settings. And it's the only setting
that's currently exposed in the UI.
It stores:
- Original coordiates, colors and mask (which were previously four
seperate layers).
- A bitmask with (currently) one bitflag, whether or not a vertex is
on a boundary.
I needed to cache calculating vertex boundary state (which involves
iterating over the edges surrounding a vertex) and got fed up with
having so many CD layers for dyntopo. This struct consolidates them
and saves having yet another layer just to store a flag.
uniform triangle tesselations (dyntopo). This will be used for
a version of topological rake that aligns edge flows to lines of curvature
automatically.
Hopefully this will become a mask filter that can grow/shrink and smooth/
sharpen any mask shape interactively by dragging the pen, like the rest
of the filters.
Following code from D8627 this patch corrects multi threaded processing
of proxies, where a 60 sec proxy generation drops to 35 sec.
Differential Revision: https://developer.blender.org/D8659
Allow use all system threads for frame encoding/decoding. This is very
straightforward: the value of zero basically disables threading.
Change threading policy to slice when decoding frames. The reason for
this is because decoding happens frame-by-frame, so inter-frame threading
policy will not bring any speedup.
The change for threading policy to slice is less obvious and is based on
benchmark of the demo files from T78986. This gives best performance so
far.
Rendering the following file went down from 190sec down to 160sec.
https://storage.googleapis.com/institute-storage/vse_simplified_example.zip
This change makes both reading and writing faster. The animation render
is just easiest to get actual time metrics.
Differential Revision: https://developer.blender.org/D8627
USD version 21.02 includes two of the changes Blender used to patch in,
which have now been removed from `usd.diff`. Unfortunately 21.02
introduces another issue where LZ4 symbols are accidentally exported,
causing linker errors. Fortunately these symbols are only used for
resting, so I added a patch hunk that simply removes their `extern "C"`
declaration.
The LZ4 linker issue has been reported upstream at
https://github.com/PixarAnimationStudios/USD/issues/1447.
Reviewed By: sebbas, mont29
Differential Revision: https://developer.blender.org/D10367
Straight up version bump
Things of note:
They started using API calls only available in windows 8, however given
the Python 3.9 update will forcibly bump us to 8.1+ anyhow this is not
an issue.
Will require some minor tweaks to platform_win32.cmake after adding the
libs to svn which are not included in this diff so this diff can land
without having to have the libs in place yet.
Reviewed By: sebbas, sybren
Differential Revision: https://developer.blender.org/D10349
Straight forward version bump, some of the variables to detect a static
OpenEXR changed and the folder structure seemingly changed a little
requiring updates to the diff
Reviewed By: sebbas, sybren
Differential Revision: https://developer.blender.org/D10340
Version bump + no longer using Boost.
Building Alembic with Boost gave compiler errors, and having one less
inter-dependency is good as well.
Reviewed By: sebbas, sybren
Differential Revision: https://developer.blender.org/D10329
Straight forward version bump.
2020U2 is significantly louder in the deprecated header usage warning
department, we should probably see if we need to act on this: P1949
Differential Revision: https://developer.blender.org/D10359
Previously `mesh.attributes.new(...)` would return a generic attribute that
one could not do much with. Now it returns refined attributes like `FloatAttribute`.
Add a boundary check, avoiding access past actual data.
Ideally would need to report error to the user somehow,
but it doesn't seem to be easy to do.
This is a minimal safe patch. The proper complete fix is
being worked on by Jesse.
Differential Revision: https://developer.blender.org/D10357
This adds a location option to the trim lasso tool to position the shape
in the middle of the volume of the object instead of in the surface
under the cursor.
{F9349724}
In order to make this work, the SCULPT_cursor_geometry_info_update can
now also get the depth of the geometry from the raycast. The depth is
calculated as the second further intersecting triangle in the raycast
over the entire mesh. This information will also be used to improve and
create new tools.
Differential Revision: https://developer.blender.org/D9622
Stop with an error when the Clang-Tidy executable cannot be found.
Without this check, CMake will happily report "Found Clang-Tidy" but with
the fallback version (0, 0, 0), when `CLANG_TIDY_EXECUTABLE` points to a
non-existing executable.
Nicer appearance for the progress bar that is drawn over the application icon during long processes on macOS.
Differential Revision: https://developer.blender.org/D9398
Reviewed by Brecht Van Lommel
When using Optimal Display, some edges are not flagged `ME_EDGEDRAW` |
`ME_EDGERENDER`.
When the modifier is applied through the UI in the modifier stack this is
not an issue because the `modifyMesh` callback is run with
`MOD_APPLY_TO_BASE_MESH` (this will effectively turn of Optimal
Display).
When converting to mesh though, this will just get an evaluated mesh
(where the edge flags are still the same as with the subdivision
modifier).
Now ensure every edge is flagged to draw after conversion.
Maniphest Tasks: T81997
Differential Revision: https://developer.blender.org/D9331
Caused by rBb077de086e14.
Not entirely sure why this was rebuilding the tree prior to above
commit, but sending an ND_OB_SHADING notifier is appropriate (and also
what the Outliners listener listens to).
Maniphest Tasks: T82251
Differential Revision: https://developer.blender.org/D9396
This is caused by the TAA being reset after the init phase, leading to
1 sample being kept as valid when it is clearly not.
To fix this, we run the lookdev validation before TAA init.
Reviewed By: Jeroen Bakker
Differential Revision: https://developer.blender.org/D9452
This adds a Box option to the Text strip's style properties, plus related Box Margin value:
{F9208309}
When enabled the text is placed on top of a solid-filled rectangle of a chosen color, as shown below:
{F9208324}
When the box option is disabled the text strip works the same as it does now. When the box option is enabled the meaning of the Shadow option changes to provide a drop-shadow on the rectangle (and not on the text itself). The latter made more sense to me.
The box margin is specified as a fraction of the image width. The offset of the drop-down box shadow is fixed to a specific fraction of the image width as well.
I tested this feature on a movie of a couple of minutes containing dozens of text strips (all with box background), edge cases like multi-line strings and text overlapping the image edges.
Reviewed By: ISS
Differential Revision: https://developer.blender.org/D9468
Proxies are expected to be fast to read. Storing them in cache has
little to no effect on performance.
This change also allows to omit invalidation of cache when user switch
between proxies and original media.
Reviewed By: sergey
Differential Revision: https://developer.blender.org/D9473
Variables renaned:
- cfra -> timeline_frame
- nr -> frame index
- cfra_over -> overlap_frame
Function seq_give_stripelem_index was renamed to seq_give_frame_index.
Use bool return type where possible instead of int (the return values from fluid object are already boolean instead of int).
Also removed several if guards in API functions. If one of the arguments is in fact invalid / nullptr (should not happen though), it better to catch them directly where they failed and not silently escape them.
Refactor material assignment code such that:
- `build_mat_map()` just returns the built map (instead of relying on
modifying a map passed as parameter),
- `LISTBASE_FOREACH` is used to loop over a `ListBase` (instead of a
hand-crafted for-loop),
- just `return` when not enough material slots can be created (instead
of setting a boolean to false, then doing some useless work, then
checking the boolean),
- reorder some code for clarity, and
- rename `mat_map` to `matname_to_material` so that the semantics are
clearer.
No functional changes.
So a keyframed e.g. location slider would stay yellow/green even if its
corresponding channel was removed.
Needs a appropriate notifier so the listeners (e.g.
buttons_area_listener, view3d_buttons_region_listener) would cause a
redraw.
Maniphest Tasks: T82364
Differential Revision: https://developer.blender.org/D9438
accelerations
Caused by rB45dbc38a8b15.
Above commit would place parentheses surrounding a block until the next
operator was found.
For velocities and accelerations though, the '/' in 'm/s' or 'ft/s'
should not be considered an operator.
Maniphest Tasks: T82407
Differential Revision: https://developer.blender.org/D9467
This fix makes sure new files save `wmWindow.global_areas` under a different
name, so old Blender versions don't recognize and 0-initialize it.
Since enabling global area writing (ef4aa42ea4), loading a file in old
Blender versions would cause `wmWindow.global_areas` to be read, because there
was already reading code for it and `ScrAreaMap` was in SDNA.
However the `ScrArea.global` of the global areas would be NULL, because it was
*not* in SDNA (`ScrGlobalAreaData` was excluded).
Now, issue is that the code assumes that areas in the global area-map have a
valid ScrArea.global pointer.
Think this was a mistake in rB5f6c45498c92. We should have cleared all this data
on reading, until the global area writing was enabled.
Differential Revision: https://developer.blender.org/D9442
Reviewed by: Brecht Van Lommel
When editbones were selected from the Outliner (and they were connected
to a parent) with the 'Sync Selection' option turned ON, they could not
get duplicated.
For duplication to work, the (connected) parent bone's tip also has to
be selected [which was not the case when selection is done from the
Outliner under above circumstances]. The reason being that
armature_duplicate_selected_exec ->
ED_armature_edit_sync_selection clears the BONE_ROOTSEL flag if the
parent bone's BONE_TIPSEL is not set.
Caused by rB71eb65328078 btw.
The correct "parent-tip-selection" would actually happen in activation
- `tree_element_active_ebone`
-- `tree_element_active_ebone__sel`
but for 'Sync Selection' this happens [also] in
- `outliner_sync_selection_from_outliner`
-- `outliner_select_sync_to_edit_bone`
which did not do the "flushing" to the parent bone's tip
Now use existing dedicated function for this.
ref. T82347
Reviewers: Zachman
Differential Revision: https://developer.blender.org/D9470
Using configue_file(..) would have avoided the breakage from
1daa3c3f0a, caused by buildinfo not properly escaping quotes.
Rely on CMake to escaping strings instead using configure_file().
Use common prefix as this collided with existing API's (eg BLI_voronoi).
Also expand some non-obvious abbreviations:
- 'g' -> 'generic'
- 'vl' -> 'variable_lacunarity'
- 'V' -> 'v3'
The draw face sets brush uses the poly center when used in meshes to increase
its precision when working in low poly geometry. For this to work with deformed
meshes, the deformed coordinates from the PBVH should be used instead.
Reviewed By: sergey
Maniphest Tasks: T81915
Differential Revision: https://developer.blender.org/D9424
BKE_mesh_free() seems to not free the meshes correctly, so using BKE_id_free() instead.
The looptri array was also not freed.
Reviewed By: sergey
Differential Revision: https://developer.blender.org/D9426
Used the sampled cursor normal when available instead of the raycast face normal.
This makes the preview match the previous orientation of the cursor.
Reviewed By: sergey
Differential Revision: https://developer.blender.org/D9460
"Camera Parent Lock" can be useful when rigging cameras, but it is not
intuitive, and has also generated a lot of confusion (bug reports).
This is because it breaks the fundamental parent <-> child relationship
conventions in Blender, and there is no indication that it's intended
without diving into the preferences.
This commit moves the setting to the object level, and exposes it in
the relations panel in the property editor. It is exposed for every
object type because any object type can be "View Locked" in the 3D view.
The property description is also updated to reflect this change and be
more specific without getting too long.
In the future this could become a more general feature of the transform
system, but for now it is limited to "Lock Camera to View".
Differential Revision: https://developer.blender.org/D9239
Commit rBf5080c82dd915db6c7b9dd68a52aaaccf2600137
accidentally remove the Shift modifier key from
the `AUTOCONSTRAINPLANE` shortcut.
Differential Revision: https://developer.blender.org/D9480
Since it is possible to have multiple draw callbacks, (some of which
use bgl and others gpu), check and force the reset of the drawing status
at the end of each callback.
Differential Revision: https://developer.blender.org/D9476
The two entries `TFM_MODAL_AUTOCONSTRAINT` and
`TFM_MODAL_AUTOCONSTRAINTPLANE` had the same name
displayed in the UI. The latter is now includes
"plane" in it's name.
Reviewed By: mano-wii
Differential Revision: https://developer.blender.org/D9474
Also fixed SCULPT_HIDE_FACE_SETS. It was 1<<16, which overlaps
SCULPT_DYNTOPO_DETAIL_MANUAL. Changed it to 1<<17. Someone should do
this in master too.
stroke) for dyntopo. Instead it updates the original vertex color
customdata layer.
Calling into the undo system destroys threading with dyntopo, as its
undo code is single-threaded.
multithreaded.
* Worked on ProxyVert system, but it still needs more work. Issue is keeping
topological layers (reasonably) up to date without it being slow.
* Fixed memory leak in bmlog.
TODO:
- Handle face (loop) data
- Figure out what to do about edge data (warn user? actually handle
it?)
- Handle sculpt color undo push nodes properly (shouldn't be hard).
NOTE: I've added a new function, DRW_make_cdlayer_attr_aliases, for
this. It's patterned after extract_uvs. The appropriate devs from the
draw engine team should take a look.
It seems fast enough for simple cases, I make no promises that it
will be fast in crazy cases lots if there's lots of vgroup layers.
Note I still need to interface properly with the sculpt colors code.
much of the usage of integer indices. Meshes and grids simply store the
index here, but bmesh stores a pointer to a BMVert. This greatly speeds
up DynTopo by reducing the need to maintain flat pointer arrays in bmesh.
To prevent the accidental casting of ScuptVertexRef to indices and vice
versa SculptVertRef is defined as a struct:
typedef struct {intptr_t i} SculptVertRef;
There are also two functions to convert flat index indices to
SculptVertRefs and back:
ScultpVertRef BKE_pbvh_table_index_to_vertex(PBVH *pbvh, int index);
int BKE_pbvh_vertex_index_to_table(PBVH *pbvh, SculptVertRef *ref);
Note that these functions require the aforementioned maintanance of
flat pointer arrays in bmesh, so make sure to call
SCULPT_ensure_vertex_random_access().
Changes:
* Brought back bmesh_mdisps_space_set, written from scratch using
subdiv api, not ccg.
* Wrote a function to smooth multigres grids from within bmesh. I might
not need it; unless anyone thinks of a use for it I'll go ahead and
delete it.
Todo:
* Purge code of all usages of CCG for multires.
This commit:
* Wrote a utility function to dump multires displacements into a (new)
scene object.
* Consequently, I now know that the CCG_based multires code is not
compatible with the OpenSubdiv based code. The former produces gaps
between grids when converting displacements to object space.
Read [these tips](https://wiki.blender.org/wiki/Process/Bug_Reports) and watch this **[How to Report a Bug](https://www.youtube.com/watch?v=JTD0OJq_rF4)** video to make a complete, valid bug report. Remember to write your bug report in **English**.
### What not to report here
For feature requests, feedback, questions or issues building Blender, see [communication channels](https://wiki.blender.org/wiki/Communication/Contact#User_Feedback_and_Requests).
### Please verify
* Always test with the latest official release from [blender.org](https://www.blender.org/) and daily build from [builder.blender.org](https://builder.blender.org/).
* Please use `Help > Report a Bug` in Blender to automatically fill system information and exact Blender version.
* Test [previous Blender versions](https://download.blender.org/release/) to find the latest version that was working as expected.
* Find steps to redo the bug consistently without any non-official add-ons, and include a **small and simple .blend file** to demonstrate the bug.
* If there are multiple bugs, make multiple bug reports.
* Sometimes, driver or software upgrades cause problems. On Windows, try a clean install of the graphics drivers.
### Help the developers
Bug fixing is important, the developers will handle a report swiftly. For that reason, we need your help to carefully provide instructions that others can follow quickly. You do your half of the work, then we do our half!
If a report is tagged with Needs Information from User and it has no reply after a week, we will assume the issue is gone and close the report.
- type:textarea
attributes:
label:"Description"
value:|
**System Information**
Operating system:
Graphics card:
**Blender Version**
Broken: (example: 2.80, edbf15d3c044, master, 2018-11-28, as found on the splash screen)
Worked: (newest version of Blender that worked as expected)
**Short description of error**
**Exact steps for others to reproduce the error**
Based on the default startup or an attached .blend file (as simple as possible).
First time reporting? See [tips](https://wiki.blender.org/wiki/Process/Bug_Reports).
* Use **Help > Report a Bug** in Blender to fill system information and exact Blender version.
* Test [daily builds](https://builder.blender.org/) to verify if the issue is already fixed.
* Test [previous versions](https://download.blender.org/release/) to find an older working version.
* For feature requests, feedback, questions or build issues, see [communication channels](https://wiki.blender.org/wiki/Communication/Contact#User_Feedback_and_Requests).
* If there are multiple bugs, make multiple bug reports.
- type:textarea
id:body
attributes:
label:"Description"
hide_label:true
value:|
**System Information**
Operating system:
Graphics card:
**Blender Version**
Broken: (example: 2.80, edbf15d3c044, master, 2018-11-28, as found on the splash screen)
Worked: (newest version of Blender that worked as expected)
**Short description of error**
**Exact steps for others to reproduce the error**
Based on the default startup or an attached .blend file (as simple as possible).
- type:markdown
attributes:
value:|
### Help the developers
Bug fixing is important, the developers will handle reports swiftly. For that reason, carefully provide exact steps and a **small and simple .blend file** to reproduce the problem. You do your half of the work, then we do our half!
Guides to [contributing code](https://wiki.blender.org/index.php/Dev:Doc/Process/Contributing_Code) and effective [code review](https://wiki.blender.org/index.php/Dev:Doc/Tools/Code_Review).
By submitting code here, you agree that the code is (compatible with) GNU GPL v2 or later.
# Optionally build without pre-compiled libraries.
# NOTE: this could be supported on all platforms however in practice UNIX is the only platform
# that has good support for detecting installed libraries.
option(WITH_LIBS_PRECOMPILED"\
Detect and link against pre-compiled libraries (typically found under \"../lib/\"). \
Disabling this option will use the system libraries although cached paths \
that point to pre-compiled libraries will be left as-is."
ON
)
mark_as_advanced(WITH_LIBS_PRECOMPILED)
option(WITH_STATIC_LIBS"Try to link with static libraries, as much as possible, to make blender more portable across distributions"OFF)
if(WITH_STATIC_LIBS)
option(WITH_BOOST_ICU"Boost uses ICU library (required for linking with static Boost built with libicu)."OFF)
mark_as_advanced(WITH_BOOST_ICU)
endif()
endif()
# Misc
if(WIN32ORAPPLE)
option(WITH_INPUT_IME"Enable Input Method Editor (IME) for complex Asian character input"ON)
@@ -406,11 +444,6 @@ endif()
option(WITH_INPUT_NDOF"Enable NDOF input devices (SpaceNavigator and friends)"ON)
if(UNIXANDNOTAPPLE)
option(WITH_INSTALL_PORTABLE"Install redistributable runtime, otherwise install into CMAKE_INSTALL_PREFIX"ON)
option(WITH_STATIC_LIBS"Try to link with static libraries, as much as possible, to make blender more portable across distributions"OFF)
if(WITH_STATIC_LIBS)
option(WITH_BOOST_ICU"Boost uses ICU library (required for linking with static Boost built with libicu)."OFF)
mark_as_advanced(WITH_BOOST_ICU)
endif()
endif()
option(WITH_PYTHON_INSTALL"Copy system python into the blender install folder"ON)
@@ -491,7 +524,7 @@ endif()
if(NOTAPPLE)
option(WITH_CYCLES_DEVICE_HIP"Enable Cycles AMD HIP support"ON)
option(WITH_CYCLES_HIP_BINARIES"Build Cycles AMD HIP binaries"OFF)
set(CYCLES_HIP_BINARIES_ARCHgfx900gfx906gfx90cgfx902 gfx1010gfx1011gfx1012gfx1030gfx1031gfx1032gfx1034gfx1035gfx1100gfx1101gfx1102CACHESTRING"AMD HIP architectures to build binaries for")
set(CYCLES_HIP_BINARIES_ARCHgfx1010gfx1011gfx1012gfx1030gfx1031gfx1032gfx1034gfx1035gfx1100gfx1101gfx1102CACHESTRING"AMD HIP architectures to build binaries for")
mark_as_advanced(WITH_CYCLES_DEVICE_HIP)
mark_as_advanced(CYCLES_HIP_BINARIES_ARCH)
endif()
@@ -674,6 +707,12 @@ if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID MATCHES "Clang")
Some files were not shown because too many files have changed in this diff
Show More
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.