Replace the `Ghash` `prophash` properties map in RNA containers by a
`CustomIDVectorSet` `prop_lookup_set`.
This commit also allows for runtime-defined RNA Struct types to use
`CustomIDVectorSet` for properties lookup, instead of only relying on linear
search in the ListBase property list.
NOTE: This also simplifies a bit the code compared to using Ghash, since the
string key is contained whiting the property, and not stored separately as in the
GHash. It also means that the string key (the property identifier) is 'automatically'
updated in the VectorSet when updated in the property itself. This avoids the
need to re-insert the property when its identifier string is duplicated into a new
memory address. However, modifying the property identifier would cause
undefined behavior if the property is not removed from the vector set first.
-----
While its an impractical example, the following custom PropertyGroup example shows the potential slowdowns just
of looking through the ListBase
``` py
import bpy
test_properties_script = "import bpy\nclass TestProperties(bpy.types.PropertyGroup):"
property_count=10000
for x in range(property_count):
test_properties_script+="\n prop_{0} : bpy.props.IntProperty(name=\"Prop {0}\")".format(x)
exec(test_properties_script)
class LayoutDemoPanel(bpy.types.Panel):
"""Creates a Test in the text editor side panel to test ui perfomance"""
bl_label = "Test"
bl_category = "Test"
bl_idname = "TEXT_PT_test"
bl_space_type = 'TEXT_EDITOR'
bl_region_type = 'UI'
def draw(self, context):
layout = self.layout
layout.use_property_split=True
layout.use_property_decorate=False
for x in range(property_count):
row = layout.row()
row.prop(bpy.data.scenes['Scene'].test_pointer, "prop_{}".format(x))
classes = [
TestProperties,
LayoutDemoPanel,
]
if hasattr(bpy.types.Scene,'test_pointer'):
del bpy.types.Scene.test_pointer
class_register, class_unregister = bpy.utils.register_classes_factory(classes)
class_register()
bpy.types.Scene.test_pointer = bpy.props.PointerProperty(type=TestProperties)
```
<video src="attachments/95e36a02-b781-44b1-9a18-9e453f8a1432" title="2025-02-03 14-12-47.mp4" controls></video>
Pull Request: https://projects.blender.org/blender/blender/pulls/134000
Replicate the Overlay-Legacy behavior for selected face overlays in
X-Ray mode:
Use depth testing for `edit_mesh_faces_ps_` when X-Ray is fully opaque.
X-Ray is always considered fully opaque in Preview/Render mode since
X-Ray transparency is not supported.
Pull Request: https://projects.blender.org/blender/blender/pulls/135524
The general idea is to keep the 'old', C-style MEM_callocN signature, and slowly
replace most of its usages with the new, C++-style type-safer template version.
* `MEM_cnew<T>` allocation version is renamed to `MEM_callocN<T>`.
* `MEM_cnew_array<T>` allocation version is renamed to `MEM_calloc_arrayN<T>`.
* `MEM_cnew<T>` duplicate version is renamed to `MEM_dupallocN<T>`.
Similar templates type-safe version of `MEM_mallocN` will be added soon
as well.
Following discussions in !134452.
NOTE: For now static type checking in `MEM_callocN` and related are slightly
different for Windows MSVC. This compiler seems to consider structs using the
`DNA_DEFINE_CXX_METHODS` macro as non-trivial (likely because their default
copy constructors are deleted). So using checks on trivially
constructible/destructible instead on this compiler/system.
Pull Request: https://projects.blender.org/blender/blender/pulls/134771
Setting the offset to 0 for these cases fixes the issue.
We still want to draw the edit face in this case to a be able
to zoom on the retopo surface. We just don't want the offset.
Pull Request: https://projects.blender.org/blender/blender/pulls/135511
Previously, when pressing the Backspace key inside an open color picker,
the HSV and Hex field components would not refresh. Only the RGB
components would.
Fixed by calling the attached button function callbacks which propagates
the color changes to the other color picker buttons from the RGB values.
Pull Request: https://projects.blender.org/blender/blender/pulls/135131
Resolve naming collisions for structs which could cause the wrong size
to be used allocating the `LaplacianSystem` when calculating mesh
weights from an armature.
Ref !135491
While we can avoid this crash by enforcing that the animation can't
play while drawing, this PR fixes the problem by remembering the
drawing that the operation was started on.
This seems like the right thing to do in general because there might be
other ways that the frame can be changed.
From my tests this seems to work even in cases where we use multi
frame editing.
Pull Request: https://projects.blender.org/blender/blender/pulls/135451
Fix an issue where imported F-Curves were allocated but not zeroed out,
when importing skeletal animation from USD.
When growing the F-Curve array, `BKE_fcurve_bezt_resize()` will now zero
out new array elements, instead of leaving the initialisation to the
caller. There are many fields in `BezTriple`, and the caller is likely
to only set those that can be imported (like the keyframe coordinates &
handles).
This fixes an issue introduced in 857743db9d.
Pull Request: https://projects.blender.org/blender/blender/pulls/135448
In any Action Slot selector, when there is no slot selected yet, replace
the 'Duplicate' and 'Unassign' buttons with a large 'New' button. This
is consistent with the ID selector, which does the same thing.
Care is taken to ensure this is only applied to the use case of
selecting Action Slots, in order to minimize the UI changes in Blender
4.4.
The only other use case of `template_search()` that I could find, is the
View Layer selector in the top-right corner of the window. However, even
without the "_is this an Action Slot selector_" guard, it would not show
these changes, as Blender guarantees there is always a view layer
assigned. Add-ons may still use `template_search()` in other ways,
though, so it's still good to keep this guard in place.
Pull Request: https://projects.blender.org/blender/blender/pulls/135443
The detection of when the wireframe is drawn by the edit mode overlays
instead was incorrect and didn't handle recent changes to avoid drawing
edit mode overlay data for invalid evaluated/original edit mesh mappings.
See code comments for more detail.
Pull Request: https://projects.blender.org/blender/blender/pulls/135402
This patch removes the use of auto_resource_location during shader
operation material compilation. Instead, we assign slot locations
explicitly. Output images are just assigned incremental indices, while
input samplers are also assigned incremental indices, but starting from
the number of textures in the material, because color bands might be
reserving slots already.
Pull Request: https://projects.blender.org/blender/blender/pulls/135453
Primitive tools were not using the brush randomization options.
This moves the randomization functions into the editor utilities for Grease Pencil
and enables primitive curve generation to use them.
Pull Request: https://projects.blender.org/blender/blender/pulls/135454
Prior to 4.3, it is possible to toggle Stabilize Stroke during a Grease
Pencil stroke with shift key, however this is broken by brush system
changes. Now this behaviour is re-implemented.
Note: Shift-toggling of Stabilize Stroke is only for Grease Pencil for
now, as mesh sculpt mode will use shift key for smooth brush instead of
pointer smoothing.
Pull Request: https://projects.blender.org/blender/blender/pulls/135024
When accessing the key-map for tooltips it's important to use
the final "user" keymap, combine from "active" & "default".
Using the active keyconfig would only keys from key-maps that had
been modified.
Prior versions of Blender showed control characters as spaces, but
since we recently made fallback optional they are no longer visible.
This is because with fallback we are guaranteed to return a glyph, but
without fallback the current font will not have entries for these. This
PR just shows them as spaces, just like before. But does not do so for
carriage return and line feed.
Pull Request: https://projects.blender.org/blender/blender/pulls/135484
Previously, only `,` was a valid delimiter, but it's also common to have e.g.
tab or semicolon. Only single characters are supported as delimiters. A few
characters are not allowed because they have other meanings: `\n`, `\r`, `"`,
`\\`.
Note: The best way to get a tab character is the use the Special Characters node
currently.
Pull Request: https://projects.blender.org/blender/blender/pulls/135468
Rather than continuing to use ICON_TEMP, meant to represent temporary
locations, this PR adds a specific one - ICON_PREVIEW_LOADING - for
this purpose. Just a copy of ICON_TEMP for now, but with all parts at
40% opacity, matching how we use it now. Not only gives us an icon we
can later change, but also removes our special handling of reducing
opacity for one icon id.
Pull Request: https://projects.blender.org/blender/blender/pulls/135463
Adds a mode option to the node to choose between the existing
behavior and new behavior that converts each face to a cyclic curve.
Generally this is much faster than the existing mode because it's
easy to parallelize and because curve offsets and face and corner
attributes can be implicitly shared to avoid copies.
Resolves#134671.
Pull Request: https://projects.blender.org/blender/blender/pulls/134773
The report was storing a non-2D-Vector attribute with geometry nodes
over a valid UVMap, resulting in the evaluated mesh not having a valid
`CD_PROP_FLOAT2` layer anymore. There is already a check to early out
for the original mesh in case it has no UVs, but as mentioned, not for
the **evaluated** (cage/multi-no-res) mesh which is actually/rightfully
used to get the UVs.
To resolve, check again if we have UVs right after getting he mesh that
is actually used.
(we might even want to remove the first check, seems redundant now -
even though it would early out a bit sooner...)
Pull Request: https://projects.blender.org/blender/blender/pulls/135388