Skip to content
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

Disable RmlUI document if scene is not visible #517

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

gleblebedev
Copy link
Contributor

No description provided.

@rokups
Copy link
Member

rokups commented Feb 10, 2023

IMO it would make more sense for component to follow scene->IsUpdateEnabled(). This knob specifically disables updates to scene and all of it's components, while UI alone can be disabled explicitly by calling component->SetEnabled(false).

@gleblebedev
Copy link
Contributor Author

IMO it would make more sense for component to follow scene->IsUpdateEnabled(). This knob specifically disables updates to scene and all of it's components, while UI alone can be disabled explicitly by calling component->SetEnabled(false).

Will disabling updates stop UI from rendering? I don't think so.

Calling SetEnabled is not convenient. The problem is that switching between application states should switch visible rmlui elements. For classic UI I solve this by replacing a UI Root element in UI subsystem. There is no such thing in RmlUI subsystem.

There should be a better way of doing this but coming up with it may take a long time.

@rokups
Copy link
Member

rokups commented Feb 10, 2023

Will disabling updates stop UI from rendering? I don't think so.

It does not, but it could. E_SCENEUPDATECHANGED event could be added, which fires whenever Scene::SetUpdateEnabled() is called. Then component can subscribe to this event and show/hide UI.

Calling SetEnabled is not convenient.

This is an option for other usecases. Maybe we want invisible scene still doing UI, maybe we want visible scene not doing UI. Combination of E_SCENEUPDATECHANGED+SetEnabled allow both

@gleblebedev
Copy link
Contributor Author

Ok, I'll update the PR tonight.

@eugeneko
Copy link
Member

It does not, but it could

But should it?
We render scene that is not updated all the time in the Editor.
Why should we render Scene and not render UI?

@rokups
Copy link
Member

rokups commented Feb 10, 2023

That makes sense 🤔

@eugeneko
Copy link
Member

@gleblebedev did you check that render to texture works as expected (e.g. in samples)?

@gleblebedev
Copy link
Contributor Author

@gleblebedev did you check that render to texture works as expected (e.g. in samples)?

No :-( I forgot about it

@gleblebedev
Copy link
Contributor Author

Is it also done with component? Why component?

@rokups
Copy link
Member

rokups commented Feb 10, 2023

Our workflow is component-centric, it was a natural fit for ui in the editor. But maybe component is implemented wrong. Maybe ui should be rendered as an overlay on the scene. In that case not rendering scene would not render ui automagically. Although input handling would start to depend on viewport rect. It would also play well with editor...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants