The `copy_layer_group_content` function was using the `LayerGroup::nodes()` API
for iterating over layers and inserting unique copies into the target geometry.
This function lists __all__ the layers inside a group, not just direct children.
A layer inside a group will be copied twice or more this way, once for the root
layer and for any of its parent groups. Looping only over directly child layers
and groups is the correct thing to do here.
Pull Request: https://projects.blender.org/blender/blender/pulls/132868
Multi-column lists are supposed to collapse to single-column when they
are estimated to be wider than the available window width. However,
current code has two errors. First the calculation of the maximum
number of possible rows is based on entire screen height when the most
available is a bit less than half. This too-large value was used in
the calculation of widths, yet the maximum rows is actually clamped
to about 24 for uncategorized lists. Whenever the former is greater
than the latter this could cause collapsing to not occur. This issue is
only really noticeable for lists in Nodes as these can be shown much
smaller than regular size. This PR fixes the max-row calculation and
uses this correctly when breaking lists without categories.
Pull Request: https://projects.blender.org/blender/blender/pulls/132881
In a Camera's properties you can "Reset to Default" on "Focal Length"
because "lens" is a direct member of Camera and it has "50.0f" as its
default value in DNA_camera_defaults.h. However change the "Len Unit"
to "Field of View" and what you are changing is "angle". This is not
a member of Camera but is a calculated value based on sensor size. So
"reset to default" makes this "0", which is invalid and otherwise not
possible to enter. This PR uses RNA_def_property_float_default to set
a default value of 0.6911504f radians which is the 39.6° FOV for the
default 50mm lens.
Pull Request: https://projects.blender.org/blender/blender/pulls/132364
For node region, `event_cursor` is true, it sends update to the cursor
every draw call, this restores the cursor `WM_CURSOR_X_MOVE`.
Issue is originally caused by e6d941cdf4 and it introduced couple other
issues. So best fix would be to revert the commit. And to fix#129178,
restore modal cursor after drawing context menu, i.e. execution of
`ui_popup_context_menu_for_button`.
Pull Request: https://projects.blender.org/blender/blender/pulls/132848
This creates more boilerplate code, but it's easier to extend,
it's follows the same structure as the mesh extraction, and
it's more aligned to planned future performance improvements.
Pull Request: https://projects.blender.org/blender/blender/pulls/132866
Was missed in the move to Overlay Next.
Now bring it back in `class Axes: Overlay`
Thx @pragma37 making me aware chaging draw state (not writing depth)
can be done using a subpass!
Pull Request: https://projects.blender.org/blender/blender/pulls/132794
Main goals of this refactor:
* Make it more obvious which update function should be used.
* Make it more obvious which parameters are required by using references instead
of pointers.
* Support passing in multiple modified trees instead of just a single one.
No functional changes are expected.
Pull Request: https://projects.blender.org/blender/blender/pulls/132862
The `bNode.type_legacy` is still used in many places to check if a node is a
specific type. However, going forward it's better to rely more on the idname
than on this legacy integer type. Some more information is available in #132858.
The added utility method can be used like so:
`node->is_type("GeometryNodeMenuSwitch")`. Previously one would have written
`node->type_legacy == GEO_NODE_MENU_SWITCH`. The `is_type` method internally
checks that the passed in string is a valid node identifier to make it more
likely that we catch typos early.
Pull Request: https://projects.blender.org/blender/blender/pulls/132863
As proposed in #98518, this moves all `View2D` files into
a `source/blender/editors/inteface/view2d/` directory. This helps
keeping the `interface/` directory clean. In general I think we should
promote a more modular thinking, where coherent parts of the code form a
module or sub-module. The directory structure and its files can reflect
that nicely.
Pull Request: https://projects.blender.org/blender/blender/pulls/132853
The issue was that we were passing a pointer-to-a-pointer to
`BLI_addtail()`, which expects a pointer to something castable to a
`Link`. This in turn led to an invalid memory access when trying to
access the fields of the supposed `Link`.
This fixes the issue by passing a pointer to a zero-initialized `Link`
instead.
This also takes the opportunity to more simply zero-initialize the
`bAction` structs used in the tests as well.
Pull Request: https://projects.blender.org/blender/blender/pulls/132860
The new description for `bNode.type_legacy`:
```
/**
* Legacy integer type for nodes. It does not uniquely identify a node type, only the `idname`
* does that. For example, all custom nodes use #NODE_CUSTOM but do have different idnames.
* This is mainly kept for compatibility reasons.
*
* Currently, this type is also used in many parts of Blender, but that should slowly be phased
* out by either relying on idnames, accessor methods like `node.is_reroute()`.
*
* A main benefit of this integer type over using idnames currently is that integer comparison is
* much cheaper than string comparison, especially if many idnames have the same prefix (e.g.
* "GeometryNode"). Eventually, we could introduce cheap-to-compare runtime identifier for node
* types. That could mean e.g. using `ustring` for idnames (where string comparison is just
* pointer comparison), or using a run-time generated integer that is automatically assigned when
* node types are registered.
*/
```
Pull Request: https://projects.blender.org/blender/blender/pulls/132858
In various previous commits all the remaining usages of this file were removed
(b1d7e8fcb1, b1d7e8fcb1, 2afd946ba, b43e2168e3). Now this file is finally
completely unused, which means we can remove it.
The main reason why we don't want this file is that it heavily relied on the
preprocessor and makes it hard to decentralize implementation details of
individual nodes.
Pull Request: https://projects.blender.org/blender/blender/pulls/132855
When the material index of a stroke is out-of-range of the material slots, the
strokes are never editable. This makes it hard to even re-assign the material or
otherwise remove such strokes. A negative index can happen when curves are added
while a Grease Pencil object has no material slots (see #123887).
Since `material_index` is a generic attribute and should be allowed any value,
strokes with out-of-range indices should be considered editable by default.
This patch slightly changes the `get_editable_material_indices` function for
tools, such that only __valid__ materials with the "Locked" flag set are
considered non-editable.
Pull Request: https://projects.blender.org/blender/blender/pulls/132806
The `smooth_curve_attribute` function smoothes individual
ranges of points that are selected within a stroke.
When smoothing a single range, the `gaussian_blur_1D` function
shouldn't treat this range as cyclic.
Instead, we check if the entire curve is selected and only use
the `cyclic` boolean in this case. For ranges, we always
treat them as non-cyclic.
Pull Request: https://projects.blender.org/blender/blender/pulls/132850
This removes the last usage of `NOD_static_types.h` after #132815. It does so by
essentially inlining it into `rna_nodetree.cc` in a more compact way.
To avoid the need for especial cases for some nodes, all node-specific functions
now also take the `BlenderRNA` as parameter instead of only the `StructRNA`.
This allows such node-specific functions to register additional subtypes if
necessary. I think it should be possible to use this to fully define more
complex dynamic nodes such as repeat zone nodes, but that's not included in this
patch.
Now a line to define a node rna struct looks like so: `define("GeometryNode",
"GeometryNodePointsOfCurve");`
The `GeometryNode` part of it is intentionally somewhat redundant to allow for
better searchability.
Pull Request: https://projects.blender.org/blender/blender/pulls/132823
This removes the second to last usage of `NOD_static_types.hh` which we intend
to remove. A nice benefit is that the idname is now finally more explicit when a
node is registered. Previously it was difficult to search for the definition of
a node in the code when one had only the idname, which is the main identifier
for nodes.
The main change is in `node_type_base`.
Pull Request: https://projects.blender.org/blender/blender/pulls/132815
The material index in Grease Pencil attributes can be negative, since they are a
generic attribute. The shader, however, requires clamping of the material index
to avoid an invalid lookup. This was already happening for the material buffer
setup (`grease_pencil_object_cache_populate`), but not for the actual VBO.
Fixes#131670
Pull Request: https://projects.blender.org/blender/blender/pulls/132804
When no image is present the depth and color buffers aren't correctly
cleared, resulting in showing the previous buffers.
Replaced the clear on bind with regular clearing operations.
Alternative implementation for !132751
Pull Request: https://projects.blender.org/blender/blender/pulls/132844
- Remove redundant .HasValue() calls
We are calling `GetPrimvarsWithValues` which will do the HasValue
checks for us already.
- Consistently skip non-array primvars
We only want to import in the array attributes. Consistently check for
this in each of our loops.
Pull Request: https://projects.blender.org/blender/blender/pulls/132816
- Prefer term "size" over "width" as this was used for the height.
- Simplify calculation for drawing the "+".
- Add note that the "+" is slightly off-center (ref #112653).
Implicit sharing dramatically reduces the cost of coping geometry
which is extremely helpful for read-only and slight modification.
But case of Sort Elements node implies a total rewrite of whole domain,
so implicit sharing only adds redundant cost for write access. This fix
uses kernel API to create domains without attributes, manually forcing
implicit sharing for offset indices and uses kernel attribute copy
functions to force sharing for all attributes when this is possible.
In all other cases new attributes are created from scratch and copied
as re-ordered only once.
In attached example file shown the difference depend on the number of
attributes on the mesh, benchmark result:
| Attributes | Before | After |
| ---------- | ------ | ----- |
| 1 | 2 ms | 1.5 ms |
| 5 | 5 ms | 4 ms |
| 10 | 9 ms | 6 ms |
| 50 | 45 ms | 30 ms |
| 100 | 89 ms | 59 ms |
Pull Request: https://projects.blender.org/blender/blender/pulls/117910
As the local zoom in changed, scale the vertical start and end of the
hierarchy lines by the 2D aspect value so they remain lining up with
the other content.
Pull Request: https://projects.blender.org/blender/blender/pulls/132817
Currently the popup tooltips for colors shows the same display whether
the color supports alpha or not. This can be confusing when what is
shown could imply that alpha is changeable when it is not. This PR
makes it clear by not showing alpha values for RBA colors.
Pull Request: https://projects.blender.org/blender/blender/pulls/132287
The part that used the context does not seem to be necessary anymore. If the
given tree has any update tag set, the same notifiers will be sent anyway by the
`tree_changed_fn` callback.
If it turns out that we are now missing some notifier, then we have to change
the caller. It either has to call the proper `BKE_ntree_update_tag_*` function,
or create the notifier directly.
This change helps to generalize the concept of propagating changes in original
data, because the context is rarely available.
Pull Request: https://projects.blender.org/blender/blender/pulls/132810
The referenced bug report shows the processing of a report by the UI
creating a status bar banner but not informing the Info editor. This is
because for this type of report we are only sending a notifier of
ND_SPACE_INFO_REPORT when the operator finishes with OPERATOR_CANCELLED
and not with OPERATOR_FINISHED. The report is only shown in Info on the
next refresh. This PR just sends the notifier on both canceled and
finished.
Pull Request: https://projects.blender.org/blender/blender/pulls/132315
Scrolling a tree view could result in incorrectly drawn hierarchy lines, see
https://projects.blender.org/blender/blender/issues/132386#issuecomment-1384663
Two issues:
- The index of the last descendant of an item was off by one
- When a hierarchy line was skipped because it was scrolled out of view, the
following indices would be wrong.
While processing handlers we are currently clearing tooltips if we
process any keymap handlers. This behavior was added in 8f8e91987b
so that tooltips didn't remain showing after operators started like
walk navigation. However this keeps any tooltips from showing while
animation is playing. This PR just alters the clearing to not do so
if the event is from a timer. That way we clear tooltips only for
deliberate interactive actions.
Pull Request: https://projects.blender.org/blender/blender/pulls/132539
As part of an effort to remove this header, reducing the need for macro/
include magic and making node definitions more independent, move
the node UI name and description definitions to each node's file.
The UI name, description, and idname are also moved to std::string
instead of char arrays.
Similar to b43e2168e3.
Pull Request: https://projects.blender.org/blender/blender/pulls/132708
Two places had to be fixed to support this:
* `RNA_property_enum_get_default` needs to handle the case when the property is
backed by an `IDProperty`. This is just like in
`RNA_property_float_get_default`.
* The default value has to be copied from the node group interface to the
geometry nodes modifier inputs.
Pull Request: https://projects.blender.org/blender/blender/pulls/132740
Make the type structs non-trivial, use new and delete for allocation and
freeing, and use std::string for most strings they contain. Also use
StringRef instead of char pointers in a few places. Mainly this improves
ergonomics when working with the strings.
Pull Request: https://projects.blender.org/blender/blender/pulls/132750