-
Notifications
You must be signed in to change notification settings - Fork 6
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
Added click-boxes of show
and locked
#169
Conversation
This is nice, only thing is that, I feel |
I don't know even is_locked is useful at all in any cases, as this is not aiming on being a CAD environment that needs to do all kinds editing |
yes, let's get rid of |
@property | ||
def is_locked(self): | ||
return self._is_locked | ||
|
||
@is_locked.setter | ||
def is_locked(self, value: bool): | ||
self._is_locked = value | ||
if value: | ||
self.is_selected = False | ||
# scene parent | ||
self.scene.instance_colors.pop(self.instance_color.rgb255) | ||
else: | ||
self.scene.instance_colors[self.instance_color.rgb255] = self | ||
|
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.
We will be removing is_locked all together, but will be another PR.
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.
okay!
CHANGELOG.md
Outdated
* Added click-boxes of `show` for `compas_viewer.components.SceneForm`. | ||
* Added observer pattern to of `show` for `compas_viewer.Scene.scene`. | ||
* Added Time Debounce pattern to of `show` for `compas_viewer.Scene.scene`. |
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.
please convert this into understandable sentences...
@@ -206,7 +207,8 @@ def __init__( | |||
self.linewidth = 1.0 if linewidth is None else linewidth | |||
self.opacity = 1.0 if opacity is None else opacity | |||
self.doublesided = True if doublesided is None else doublesided | |||
self.is_visible = True if is_visiable is None else is_visiable | |||
self.show = True if is_visiable is None else is_visiable |
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.
is_visiable
=> is_visible
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.
btw, i am not a fan of self.show
. i think it should be self.is_visible
. self.show
sounds like a method...
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.
show
comes from compas core, which I suggested a while ago for the simplicity, but I agree indeed it can feel like a method. If we decide to go back to is_visible
, I would suggest we make this change in compas core first then update here
@@ -206,7 +207,8 @@ def __init__( | |||
self.linewidth = 1.0 if linewidth is None else linewidth | |||
self.opacity = 1.0 if opacity is None else opacity | |||
self.doublesided = True if doublesided is None else doublesided | |||
self.is_visible = True if is_visiable is None else is_visiable | |||
self.show = True if is_visiable is None else is_visiable | |||
self._is_locked = False if is_locked is None else is_locked |
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.
were we not going to remove this?
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.
yes we are, but it would be better to do that in another PR, cuz this attribute is a bit everywhere, this one here is added temporarily to make the form work
@@ -70,10 +81,35 @@ def __init__(self, name: str = "ViewerScene", context: str = "Viewer"): | |||
|
|||
# Primitive | |||
self.objects: list[ViewerSceneObject] |
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.
btw, this does not initialize the attribute. it just adds a type annotation. if you try to access this attribute an error will be thrown. it should be self.objects: list[ViewerSceneObject] = []
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.
objects
is inherent from the parent class, I believe this was only for additionally type-hinting the object will be ViewerScenceObject
instead of the base SceneObject
src/compas_viewer/scene/scene.py
Outdated
@property | ||
def observers(self): | ||
new_observers = [ | ||
self.viewer.renderer, | ||
self.viewer.ui.sidebar, | ||
] | ||
|
||
for observer in new_observers: | ||
self._observers.add(observer) | ||
|
||
return list(self._observers) |
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.
this looks a bit fishy...
src/compas_viewer/scene/scene.py
Outdated
Attributes | ||
---------- | ||
observers : set | ||
Set of unique observer objects. |
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.
are these objects that observe, or objects that are being observed?
what makes something an "observer"?
is there a base class somewhere?
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.
I updated the observer class in PR #181 maybe I remove from here, so is less confusing
#146
What type of change is this?
show
andlocked
forcompas_viewer.components.SceneForm
.show
andlocked
forcompas_viewer.Scene.scene
.show
andlocked
forcompas_viewer.Scene.scene
.