Fix #141448: Geometry Nodes: UI panel property name trimming logic Fix
Previously in 95259228d9, property names
within geometry nodes panels are trimmed to make it less verbose if the
property name contains the parent panel's name as prefix, this didn't
take into account where property name can be the same as panel name, in
which case there will be an empty property name which is undesired. So
we should not trim the name in this case.
Pull Request: https://projects.blender.org/blender/blender/pulls/141500
This commit is contained in:
@@ -512,9 +512,11 @@ static void draw_property_for_socket(DrawGroupInputsContext &ctx,
|
||||
if (parent_name.has_value()) {
|
||||
const StringRefNull prefix_to_remove = *parent_name;
|
||||
int pos = name.find(prefix_to_remove);
|
||||
if (pos == 0) {
|
||||
if (pos == 0 && name != prefix_to_remove) {
|
||||
/* Needs to trim remainig space characters if any. Use the `trim()` from `StringRefNull`
|
||||
* because std::string doesn't have a built-in `trim()` yet. */
|
||||
* because std::string doesn't have a built-in `trim()` yet. If the property name is the
|
||||
* same as parent panel's name then keep the name, otherwise the name would be an empty
|
||||
* string which messes up the UI. */
|
||||
name = StringRefNull(name.substr(prefix_to_remove.size())).trim();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user