Code from {rBb0cb0a785475} assumed a texture node `node->id` would
always be an image.
That is not true though:
- could be an object (as reported here with the Point Density node)
- could be a textblock (as in the IES Texture node)
Acting on these would crash when doing `BKE_image_signal` on them.
Now check node id is an image and do nothing otherwise.
Also check if an image is actually set in these nodes (if none is, the
Image Editor is now also untouched, previously the image in the Image
Editor was "cleared" here [set to NULL] -- which does not seems very
beneficial)
Maniphest Tasks: T101001
Differential Revision: https://developer.blender.org/D15943
Since D15885, most (all?) python based importers are failing with an
error like RuntimeError: Error: Object 'Cube' can't be selected
because it is not in View Layer, whenever they try to mark
just-created objects selected via obj.select_set(True). Happens at
least in FBX and (legacy) OBJ importers -- effectively they end up
creating just the first imported object before failing with this
exception.
Looks like BKE_view_layer_synced_ensure calls were missing before
BKE_view_layer_base_find in rna_object_api.c.
Reviewed By: Campbell Barton
Differential Revision: https://developer.blender.org/D16004
Currently the rake rotation is calculated when the angle mode is set. Even when the texture isn't valid.
This change will only calculate the rake rotation when the texture is valid and the angle mode is set.
For example, allows a custom UV grid size of 4 x 12.
TODO: Fix snapping with custom UV grid sizes.
Manifest Tasks: T78391
Differential Revision: https://developer.blender.org/D16000
Currently node group assets are supported, but using them by dragging
from the asset browser is cumbersome. This patch adds all node group
assets from user asset libraries and the current file libraries to the
add node search menu and the link drag search menu.
Node groups added through the search will have their "options" hidden,
meaning the data-block selector is displayed. This helps keep the UI
clean, and the selector shouldn't be necessary anyway.
To make that possible, metadata like the node tree type and its inputs
and outputs has to be saved in the file. This requires re-saving the
files that contain the assets with the patch applied.
The node add search operator is moved from Python to C++ to ease
development and allow more flexibility. It supports a tooltip that
gives the description of assets.
Currently the node groups are added with the asset system's existing
"Append & Reuse" behavior. It's likely that linking should be possible
in the future too, but for now the idea is to use the more foolproof
option that doesn't create dependencies between files.
Because loading assets can potentially take a long time, the search
menu refreshes its items as new assets are loaded. However, changing
the search field is necessary to see the update.
Differential Revision: https://developer.blender.org/D15568
This commit adds a node to distribute points inside of volume grids.
The "Random" mode usese OpenVDB's "point scatter" implementation, and
there is also a "Grid" mode for uniform distributions. Both methods
operate on all of the float grids in the volume, using every voxel with
a value higher than the threshold. The random method is not stable as
the input volume deforms.
Based on a patch by Angus Stanton (@abstanton), which was based on a
patch by Kenzie (@kenziemac130).
Differential Revision: https://developer.blender.org/D15375
Before, the lines could be extended endless, but this added too noise.
Now, the lines are not extended more if collide.
Before:
{F13504186}
After:
{F13504187}
Reviewed By: mendio, frogstomp
Differential Revision: https://developer.blender.org/D15992
This simplifies python code.
When we call a method like shader.uniform_float("color", (1,1,1,1)),
we expect the shader's uniform to be updated regardless of whether the
shader is bound or not.
And `batch.draw()` already calls `GPU_shader_bind` inside.
Differential Revision: https://developer.blender.org/D15929
Check modifier keys using XKB_STATE_MODS_DEPRESSED which is used
to check if modifiers are physically held. In practice it's unlikely
this would have caused an error for key-maps in common use.
In `BKE_mesh_tag_coords_changed_uniformly` the checks for dirty vertex
and dirty poly normals were swapped around, causing an assert to be
triggered.
Differential Revision: https://developer.blender.org/D16002
`CurveEval` was added for the first iteration of geometry nodes curve
support. Since then, it has been replaced by the new `Curves` type
which is designed to be much faster for many curves and better
integrated with the rest of Blender. Now that all curve nodes have
been moved to use `Curves` (T95443), the type can be removed,
along with the corresponding geometry component.
This is the last node to use the `CurveEval` type. Since the curve to
points node is basically the same as the resample node, now it just
reuses the resample code and moves the curve point `CustomData` to a
new point cloud at the end. I had to add support for sampling tangents
and normals to the resampling.
There is one behavior change: If the radius attribute doesn't exist,
the node won't set the radius to 1 for the output point cloud anymore.
Instead, the default radius for point clouds will be used.
That issue was similar to T99814.
Differential Revision: https://developer.blender.org/D16008
Fix clipping artifacts of node drop shadows that could occur
on hidden nodes, when using higher UI scaling.
Reviewed By: Hans Goudey
Differential Revision: http://developer.blender.org/D16007
The node position is specified in the coordinate space of the node
editor. The cursor position has to be divided by `UI_DPI_FAC` since it's
in view space but the offset is independent of any ui scaling.
Reviewed By: Hans Goudey
Differential Revision: http://developer.blender.org/D16006
With the recent addition of the UV unwrapping node, there is a need to
be able to create seams easily. This node does that by outputting a
selection of the boundaries between different input face sets. In the
context of UV mapping, one inputs the "patches" you want, and the node
gives you the seams needed to make those patches.
Differential Revision: https://developer.blender.org/D15423
Add new functions to `array_utils` namespace called `gather(..)`.
Versions of `GVArray::materialize_compressed_to_uninitialized(..)` with
threading have been reimplemented locally in multiple geometry node
contexts. The purpose of this patch is therefore to:
* Assemble these implementations in a single file.
* Provide a naming convention that is easier to recognize.
Differential Revision: https://developer.blender.org/D15786
Correct interpolation of integer POD types for Catmull Rom
interpolation as implemented in eaf416693d.
**Problem description**
`attribute_math::DefaultMixer<T>::mix_in()` assumes/asserts positive
weights but the basis function for Catmull-Rom splines generates
negative weights (see image in revision). Passing negative weights will
yield correct result as sum(weights) = 1 (after multiplication by 0.5)
but the assert is still triggered in debug builds. This patch adjusts
the behavior by extending the mix functions with mix4(). The benefit
of using mix#() over a DefaultMixer is that the result no longer needs
to be divided by the weight sum, instead utilizing that the basis weight
sum is constant (see plot).
**Changes**
* Added mix4() and updated catmull_rom::interpolate() to use it.
* Removed TODOs from catmull_rom functions.
* Moved mix definitions to be ordered as 2, 3, 4 in the header.
**Implementation specifics**
`catmull_rom::interpolate()` uses a constexpr to differentiate between
POD types which multiplies the result with 0.5 after weighting the
values, this reduces the number of multiplications for 1D, 2D, 3D
vectors (https://godbolt.org/z/8M1z9Pxx6). While this could be
considered unnecessary, I didn't want to change the original behavior
as it could influence performance (did not measure performance here
as this should ensure the logic is ~identical for FP types).
Differential Revision: https://developer.blender.org/D15997
While this worked, the result for curves with a resolution of zero was
just a single evaluated point, which isn't useful or intuitive. Using
the attribute validation from 8934f00ac5, make sure users
can't set values 0 or less.
This option allows easier setup of intersection overrides on more
complex scene structures. Setting force intersection would allow objects
to always produce intersection lines even against no-intersection ones.
Reviewed By: Aleš Jelovčan (frogstomp) Antonio Vazquez (antoniov)
Differential Revision: https://developer.blender.org/D15978
Holding the OS (Windows) key on Win32 used key-repeat behavior.
While as far as I know it didn't cause user visible errors - sending
repeated modifier events isn't expected behavior and doesn't happen
on other platforms (or for other modifier keys).
Handling the OS key now match other modifiers in GHOST which detect
each key separately, making the behavior simpler to reason about since
mapping a single key to a modifier state is simpler, avoiding handling
that only applied to the OS-Key.
This means simulating key up/down events can use the correct modifier.
In the window-manager this is still only accessed accessed via KM_OSKEY.
We expect some builtin attributes to have positive values or values
within a certain range, but currently there some cases where users
can set attributes to arbitrary values: the store named attribute node,
and the output attributes of the geometry nodes modifier. The set
material index node also needs validation.
This patch adds an `AttributeValidator` to the attribute API, which
can be used to correct values from these untrusted inputs if necessary.
As an alternative to D15548, this approach makes it much easier to
understand when validation is being applied, without the need to add
arguments to every attribute API method or complicate the virtual
array system.
Currently validation is provided with a multi-function. That integrates
well with the field evaluations that set these values now, but it could
be wrapped to be friendlier to other areas of Blender in the future.
The Python API is not handled here either. Currently I would prefer to
wait until we can integrate the C++ and C attribute APIs better before
addressing that.
Fixes T100952
Differential Revision: https://developer.blender.org/D15990
writefile.cc includes BLI_winstuff.h which
includes Windows.h which supplies definitions
of min/max that conflict with the c++ headers
previously windows.h was only included when TBB was
enabled, the inclusion of BLI_winstuff.h now
makes this define mandatory for all configurations
Previously the a simulated event was sent for releasing modifiers
on activation but pressing only set the eventstate flag.
Prefer the simulated events since press/release events are used in some
modal key-maps.