compas-dev / compas_view2

Standalone viewer for COMPAS
https://compas.dev/compas_view2/
MIT License
6 stars 8 forks source link

feature/view-setting-config #208

Closed ZacZhangzhuo closed 8 months ago

ZacZhangzhuo commented 8 months ago

What type of change is this?

Added view_angle and camera in the config. This should close #207 .

Thanks @tomvanmele for the proposal.

ZacZhangzhuo commented 8 months ago

image

ZacZhangzhuo commented 8 months ago

Wait, I should put out a better solution that also solves #209 . I convert it into draft and will work on it.

maybe do you have any clue about the break point of the camera? sometimes it becomes blank and not useable. there might be some trick in setting the params. @Licini

image

Licini commented 8 months ago

@ZacZhangzhuo We should also allow using programmable API to achieve this besides config. Something like

viewer = App()
...
viewer.camera.top_view()
viewer.show()

or

viewer = App(view_port="top")
...
viewer.show()
ZacZhangzhuo commented 8 months ago

Hi @Licini , I updated the solution and it is ready to be reviewed:

2023-12-12-15-19-21-02 example_camera_config_2 example_camera_config

Licini commented 8 months ago

@ZacZhangzhuo We should also allow using programmable API to achieve this besides config. Something like

viewer = App()
...
viewer.camera.top_view()
viewer.show()

or

viewer = App(view_port="top")
...
viewer.show()

Almost there, as Tom mentioned, let's make view_port to viewport and view_mode to viewmode. And please add kwarg to App init api e.g. App(viewport="Top")

ZacZhangzhuo commented 8 months ago

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 tutorial_configuration:

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:

like enable_propertyform, flow_view_size, zoom_selected, view_perspective, background_color, and selection_color,

are not changed. let me know if you want to change them too.

tomvanmele commented 8 months ago

sorry i approved this by accident. will leave the approval up to @Licini

tomvanmele commented 8 months ago

@ZacZhangzhuo if you bring in the latest changes from main the docs will build a lot faster...

ZacZhangzhuo commented 8 months ago

@ZacZhangzhuo if you bring in the latest changes from main the docs will build a lot faster...

thanks for the update change!