Conversation
Licini
commented
Jun 2, 2025
| items = {str(item.guid): item for item in data["items"]} | ||
|
|
||
| def add(node, parent, items): | ||
| scene = cls(data["name"], datastore=data["datastore"]) |
Contributor
Author
There was a problem hiding this comment.
in this version, we still allow direct serialization and deserialization of datastore attribute
Licini
commented
Jun 2, 2025
Comment on lines
+109
to
+111
| if isinstance(item, Group): | ||
| raise Exception("Use Scene.add_group to add a group to the scene.") | ||
|
|
Contributor
Author
There was a problem hiding this comment.
Letting users to interact with a Group instance before properly attached to Scene is fragile, this is added to prevent that and ask user to use scene.add_group instead, so the links are property established.
Licini
commented
Jun 2, 2025
Comment on lines
+128
to
+133
| def add_group(self, name=None, parent=None, **kwargs): | ||
| # type: (str, SceneObject | TreeNode | None, dict) -> Group | ||
| parent = parent or self.root | ||
| group = Group(name=name, **kwargs) | ||
| super(Scene, self).add(group, parent=parent) | ||
| return group |
Contributor
Author
There was a problem hiding this comment.
Another reason we must have this function is that: Group class is not registered with an item and can not automatically reconstructed with correct extension class in a different context like Viewer. For example in Viewer we must overwrite this function to use compas_viewer.scene.Group instead of the original one
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Another attempt for data store only update. Please comments below...