Clicking the drop-down button for a Menu-type socket in geometry
modifier panel crashes with ASAN error.
Resolve by skipping the check for ID properties & assert the property
is an RNA property.
`UI_OT_button_string_clear` clears the redo panel in `wm_operator_finished`.
hud_status is set to CLEAR due to undo flag on above the internal operator.
To fix the redo panel from closing, undo flag from the operator could be
removed. Alternative is, skip internal operators from closing the redo
panel with extra check `if (op->type->flag & OPTYPE_INTERNAL) {return;}`
Ref: !135727
When using vertex parenting, an option for using the parent object
final evaluated indices is exposed in the Object Properties: Relations
panel. This allows the calculation of the parent vertex position to
ignore the the CD_ORIGINDEX layer and instead use the final indices
that may have been altered by the node tree evaluation.
The indices that will be used for the vertex parenting are also exposed
to the UI in the same panel, allowing them to be altered after the
vertex parent has been created.
While object names in Blender are already unique, the names themselves
may be "unsafe" for use in the various file formats. During processing
we make the names "safe". However, we did not guarantee that these new
safe names were themselves unique wrt each other. Consider object names
"Test 1" and "Test-1" which both become "Test_1" after being made safe.
These will collide during export; only 1 object would be exported and
it's undefined which object's data would "win".
To rectify this we add another name map to the hierarchy iterator which
is then used to handle collisions as they happen. The map is per-
hierarchy meaning that a name can appear more than once as long as its
under a different hierarchy. E.g.
- `/root/A/X` and another `/root/B/X` is OK
- `/root/A/X` and another `/root/A/X` is NOT OK
Pull Request: https://projects.blender.org/blender/blender/pulls/135418
This improves the situations where the shading normal is far from the
best shadow bias direction. This is particularly noticeable on low poly
meshes with smooth normals.
This patch fixes the issue by storing a quantized version of the
geometric normal in the Gbuffer.
Only 6 bits are used (each axis uses 2 bits). This is stored inside the
gbuffer header since it is always available and has some spare bits to
store this data.
This quantization is only done if the error introduced by using the
shading normal is higher than using the quantized normal. This means
that flat shaded surfaces will not have any quantization artifact.
For smooth shaded surfaces, the quantization is only effective if the
shading normal is quite different (greater than ~20° difference)
than the geometric normal.
The attached blendfile contains an example Material that shows
how the quantization is done. This was used to find the threshold
value with the least amount of error.
To compensate the quantization error, we increase the normal bias by
~20% which is subpixel if the shadow texel density is high enough.
This also changes the forward shading pipeline to use the geometric
normal for bias.
The first Light closure normal is now used for the attenuation function
since this is the most representative of the final shading. This normal
being inverted for transmission closures, we have to negate the normal
in the attenuation computation.
Pull Request: https://projects.blender.org/blender/blender/pulls/136136
This was caused by the select_id not being flushed to
the armature object.
This is because the selection code uses `FOREACH_OBJECT_IN_MODE_BEGIN`
to iterate over the objects. This doesn't call the depsgraph
which would, in normal circumstances, flush the select_id value
to the evaluated object.
Also fix#136141
Pull Request: https://projects.blender.org/blender/blender/pulls/136320
Regression from 583e2b7240
`DRW_shader_init()` calls `GPU_context_create` before having a valid
GHOST context active (`WM_system_gpu_context_activate(system_gpu_context)`).
Swap the calling order to fix the issue.
Pull Request: https://projects.blender.org/blender/blender/pulls/136270
This makes the random vertex color brightness work on a relative basis.
Because humans see relative differences in brightness more then absolute
brightness, simple adding randomness to `Value` will cause dark colors to be
effected more heavily then light colors.
This also fixes a problem desaturated colors with becoming red after
saturation randomization.
Pull Request: https://projects.blender.org/blender/blender/pulls/107315
This patch adds the icon_value property to GIZMO_GT_button_2d to support
using custom icons values. This allows for the use of user-defined icons
(via custom preview collections), or generated icons like material or
image previews.
On the API side, this property replicates the RNA UI API behavior (seen
in layout.operator/layout.prop) of prioritizing `icon` over `icon_value`
if the former is set.
Pull Request: https://projects.blender.org/blender/blender/pulls/136080
This patch adds support for boolean sockets in the compositor. This
involves adding a new Bool ResultType and handling it in relevant code.
For shader operations, booleans are passes as floats since GPUMaterial
does not yet support boolean types.
Pull Request: https://projects.blender.org/blender/blender/pulls/136296
The main issue of 'type-less' standard C allocations is that there is no check on
allocated type possible.
This is a serious source of annoyance (and crashes) when making some
low-level structs non-trivial, as tracking down all usages of these
structs in higher-level other structs and their allocation is... really
painful.
MEM_[cm]allocN<T> templates on the other hand do check that the
given type is trivial, at build time (static assert), which makes such issue...
trivial to catch.
NOTE: New code should strive to use MEM_new (i.e. allocation and
construction) as much as possible, even for trivial PoD types.
Pull Request: https://projects.blender.org/blender/blender/pulls/136268
While using constructors in Operator classes is _really_ not
recommended, BPY code was a bit too eager to overwrite existing errors
with its own generic messages.
Now only generate these exceptions if there is no other exception
already set.
The compositor asserts when sharing data with different precision, but
this is fine, since it can be thought of as precision promotion. So
remove the assert.
Dont increment the path count (and dont create a corresponding pointer)
in `ButsContextPath` when there is no current particle system.
This alone would do the trick for particles, but I have also changed
`buttons_panel_context_draw` slightly (so that it checks if the pointer
is valid -- earlying out otherwise -- **before** drawing the triangle
icon) in case it might happen elsewhere too.
Pull Request: https://projects.blender.org/blender/blender/pulls/136256
For the "Render Active Object" operator, it is not enough to check if
the IDs in context (e.g. selected in the Asset browser) can generate
previews, more importantly, we have to check the object being rendered
here (the **active** object)
Pull Request: https://projects.blender.org/blender/blender/pulls/136074
This adds icons for ICON_RGB_RED, ICON_RGB_GREEN, and ICON_RGB_BLUE
that display with those colors. This does not remove the existing
monochrome ICON_COLOR_* icons. This also allows the translation of
the "R", "G", "B" characters shown, for languages that prefer color
words that do not start with these.
Pull Request: https://projects.blender.org/blender/blender/pulls/136154
- Manually check over all direct calls to operator callbacks
ensuring the result isn't assigned to an int.
- OPERATOR_RETVAL_CHECK() now fails unless a wmOperatorStatus is used.
- Check the return values of direct calls to callbacks.
- Remove invalid check for the return value of rna_operator_check_cb.
- Use the variable name `retval` as it's most widely used.
- Move the assignment of `retval` out of the `if` statement in
sculpt/paint operators because it prevents assigning the result
`const` variable.
When dragging on area edges to resize them, the visual feedback is
brighter on high DPI displays like Retina. This is because the center
line is subpixel when on a regular monitor. This PR increases the
width of the line and outline, giving a stronger highlight and one
that looks similar on all platforms.
Pull Request: https://projects.blender.org/blender/blender/pulls/136108
Callbacks: exec invoke & modal now use a typed enum wmOperatorStatus.
This helps avoid mistakes returning incompatible booleans or other
values which don't make sense for operators to return.
It also makes it more obvious functions in the WM API are intended
to be used to calculate return values for operator callbacks.
Operator enums have been moved into DNA_windowmanager_enums.h
so this can be used in other headers without loading other includes
indirectly.
No functional changes expected.
Ref !136227
When resizing areas by dragging at the edges, the hit area is wider
than the visible border. This extra border padding is extended in this
PR by another one pixel on each side. This increases the hit width by
about 30%. This is possible because this adjusts for scrollbars at the
edge of the area.
Pull Request: https://projects.blender.org/blender/blender/pulls/135952
Part of #134755 / #134766.
Previously dropping collections would use some point under the mouse
cursor, I think projected based on the 3D cursor location. According to
feedback this is pretty useless and unpredictable, snapping to surfaces
under the mouse cursor is preferred.
With this the collection or collection instance will be transformed so
objects are placed relative to the dropping point (plus the collection
instance offset, if any).
This is added for dragging assets mostly, but works for dragging
collections from anywhere (e.g. Outliner).
Pull Request: https://projects.blender.org/blender/blender/pulls/136181
This PR increase the height (only) of the corner action zones at the
top-left and bottom-left area corners. They get more than twice as tall
so they are twice as easy to hit. Especially nice using a pen.
Pull Request: https://projects.blender.org/blender/blender/pulls/135954
Part of #134755 / #134766.
Adds options to the new Import Settings popover (added in 7a6beb65f4)
to toggle collection instancing for dragging in collections. It can be
toggled separately for linking and appending, since it's typical to use
instancing for linking, but not appending (current default, also with
this change).
Previously, toggling collection instancing was only possible via the
Adjust Last Operation panel but this wasn't obvious, many people were
not aware. Adding this option based on feedback by the Blender Studio.
Pull Request: https://projects.blender.org/blender/blender/pulls/135996
Crashes were caused by setting `Strip::machine` above `MAX_CHANNELS`
value.
Instead of clamping this value at multiple places, setter function
`seq::strip_channel_set` was added that implements clamping.
This also allows for better handling of clamping if it was ever needed.
Function `strip_transform_handle_expand_to_fit` still sets machine value
directly and above `MAX_CHANNELS` as a hack. This could be avoided, but
it would require some refactoring.
Pull Request: https://projects.blender.org/blender/blender/pulls/136163
For very large scales with very small windows the enum list calculation
of how many rows might fit can result in zero, causing problems with a
later division. clamping this to a minimum of one fixes this and causes
no harm. This calculation is just a hint on how to behave, whether to
show lists in columns or not, etc. Lists still display fine even when
this variable reaches this minimum.
Pull Request: https://projects.blender.org/blender/blender/pulls/136265
Geometry indices is no longer hidden under Developer Extras, also
remove mention "Edit Source" since nowadays this feature exposes more
features than just that (this tooltip dates back to Blender 2.5 days).
Use `Display` instead of `Show` to be consistent with other tooltips.
Pull Request: https://projects.blender.org/blender/blender/pulls/134584
Make sure refreshing an asset library properly clears all storage for
this library, both in the global asset list storage and the storage of
each asset browser.
The `ed::asset::list::clear()` function handled clearing of asset
browsers too since recently, however the refresh operator wouldn't use
that when clearing directly from an asset browser. Instead, always clear
all asset library storage/chaches.
GPU subdivision shaders can read out of bound when evaluating
the last face. This seems to be always been the case, but Metal + Vulkan
has validation to detect these mis-usages.
Binary search was initialized with out of bound values so the last
face could select out of bound index due to rounding.
Pull Request: https://projects.blender.org/blender/blender/pulls/136242
The main issue of 'type-less' standard C allocations is that there is no check on
allocated type possible.
This is a serious source of annoyance (and crashes) when making some
low-level structs non-trivial, as tracking down all usages of these
structs in higher-level other structs and their allocation is... really
painful.
MEM_[cm]allocN<T> templates on the other hand do check that the
given type is trivial, at build time (static assert), which makes such issue...
trivial to catch.
NOTE: New code should strive to use MEM_new (i.e. allocation and
construction) as much as possible, even for trivial PoD types.
Pull Request: https://projects.blender.org/blender/blender/pulls/136134
This patch uses the socket type as opposed to the result type in the
switch case that initialize the values of the single input value
results, since that makes more sense as we are retrieving the values
from the sockets. This also matches the implementation in pixel
operations.