-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
[core] Add support for keyable attributes #2878
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #2878 +/- ##
===========================================
+ Coverage 79.52% 80.06% +0.53%
===========================================
Files 51 53 +2
Lines 6976 7225 +249
===========================================
+ Hits 5548 5785 +237
- Misses 1428 1440 +12 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
fff38b2 to
c5aba49
Compare
Allows to store a list of pairs (key, value) based on an attribute description.
- display value or default value at current viewId for keyable attribute. - allows to set/update current viewId value for keyable attribute. - new add/remove key button for keyable attribute.
- check keyable attribute initialization. - check keyable attribute CRUD. - check keyable attribute linked. - check keyable attribute UID.
Fix logic error, Attribute.getDefaultValue() is used in node serialization and represents the true default value of an attribute. In the case of a keyable attribute this should be an empty dict (no keys). We should use attribute description to get the default value of a key.
In this case, we can use SetAttributeCommand with attribute.getDefaultValue().
dc5b211 to
2587bc9
Compare
| checked: attribute.keyable && attribute.keyValues.hasKey(_reconstruction.selectedViewId) | ||
| enabled: root.editable | ||
| onClicked: { | ||
| if (attribute.keyValues.hasKey(_reconstruction.selectedViewId)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should do nothing if there is no selected view ("selectedViewId" is "-1").
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or maybe globally lock the attribute when there is no selectedViewId.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks.
I made the changes to lock the attribute.
In any case, it's not possible to add an attribute value for a negative key, checked in KeyValues.add().
Description
Previously, all attributes were implicitly treated as non-keyable.
This PR introduces support for keyable attributes, allowing them to be loaded, stored, animated or manipulated.
Backward compatibility is preserved.
A test node with keyable attributes.
Current limitations and scope:
BoolParam,IntParam, andFloatParam.viewIdis currently supported as thekeyType.Unit tests cover:
Sample Node:
A sample node for testing: TestNode.zip
Features list
KeyValuesclass to manage the keyable attribute list of(key, value)pairs.BoolParam,IntParam, andFloatParam.AttributeItemDelegate.qmlImplementation remarks
This PR is designed in the context of developing the new shape editor.
It can serve as a foundation for full support of keyable attributes in the future.