-
Notifications
You must be signed in to change notification settings - Fork 8
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
feature/view-setting-config #208
feature/view-setting-config #208
Conversation
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.
Can you also add an example script.
src/compas_view2/views/view.py
Outdated
RIGHT = 2 | ||
TOP = 3 | ||
PERSPECTIVE = 4 | ||
VIEW_ANGLES = {"CUSTOM": 0, "FRONT": 1, "RIGHT": 2, "TOP": 3, "PERSPECTIVE": 4} |
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.
What would be the benefit to change these numeration to dict?
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 for the review!
The reason is for the readability of the config file: the original version would only allow us to put numbers (i,e. "view_angle":1
) in the config. While using dict would allow us to indicate the key: "view_angle": "TOP"
.
@@ -14,8 +14,17 @@ | |||
"view": { | |||
"show_grid": true, | |||
"view_mode": "shaded", | |||
"view_angle": "CUSTOM", |
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.
angle suggest things like Euler angle, any other name?
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.
Also I think we should use a custom setting here in the default config. It should be something minimal and simple.
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.
angle suggest things like Euler angle, any other name?
agree, I was having trouble with naming this as well. In rhino it is called view setting
which is a bit general as well.
how about view_port
? like "view_port":"TOP"
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.
Also I think we should use a custom setting here in the default config. It should be something minimal and simple.
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.
sorry I meant we shouldn't ............. I miss typed
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.
"view_port" is better, let's use that
requirements-dev.txt
Outdated
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.
pin the sphinx version, related to compas-dev/compas_invocations@067a873
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.
Also I think we should use a custom setting here in the default config. It should be something minimal and simple.
the default value is already custom.
@ZacZhangzhuo We should also allow using programmable API to achieve this besides config. viewer = App()
...
viewer.camera.top_view()
viewer.show() or viewer = App(view_port="top")
...
viewer.show() |
Hi @Licini , I updated the solution and it is ready to be reviewed:
|
@@ -14,8 +14,17 @@ | |||
"view": { | |||
"show_grid": true, | |||
"view_mode": "shaded", | |||
"view_port": "PERSPECTIVE", |
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.
personally, i would not add an underscore in keys like these. you could consider "viewmode" and "viewport" as one word. "show_grid" is different in that sense...
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. I didn't find the naming conversions for the configuration / .jason file so I named it this way. All the items in this file, including some long words, like enable_propertyform
, flow_view_size
, zoom_selected
, view_perspective
, background_color
, and selection_color
, then need to be changed. Shall we decide fixing them all?
We could create a separate PR/Issue for this
self.shader_model = None | ||
self.app = app | ||
self.color = view_config["background_color"] | ||
self.mode = view_config["view_mode"] | ||
self.selection_color = view_config["selection_color"] | ||
self.show_grid = view_config["show_grid"] | ||
self.camera = Camera(self) | ||
self.camera = Camera(self, **view_config["camera"]) |
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.
also to my point earlier, view_config
could be interpreted as "viewing the config" (action + subject). it is clearer what is meant when viewconfig
is used, in my opinion...
Almost there, as Tom mentioned, let's make |
changed, you can use the below code to exam: viewer = App(viewport="front")
viewer.show() since this is a small update, I have not put an example yet. but the doc is updated in the 2. In-code definition which overwrites the configuration:
::
>>> from compas_view2.app import App
>>> viewer = App(viewmode="lighted", viewport = "top", enable_sceneform=True, enable_propertyform=True, enable_sidebar=True, width=2000, height=1000) let me know if you think we should add an extra example file. also, the underscores of other options in the config:
are not changed. let me know if you want to change them too. |
sorry i approved this by accident. will leave the approval up to @Licini |
@ZacZhangzhuo if you bring in the latest changes from main the docs will build a lot faster... |
thanks for the update change! |
What type of change is this?
Added
view_angle
andcamera
in the config. This should close #207 .Thanks @tomvanmele for the proposal.