Skip to content

Conversation

@Zartris
Copy link
Contributor

@Zartris Zartris commented May 24, 2023

I did a mistake and deleted the branch.... here it is again

I needed a feature for visualising custom text like in the interative_rendere but I wanted to do it from the my scenario.
It was not possible to create TextLine from the scenario as it needed the viewer which is only available from the envirionment.
So the choice was to either give the extra_render method access to the viewer (which opens up for lots of functionality, but also for missuse) or to have this variable render_text which the environment checks for.

You can take this, modify or just leave it as it was just a functionality i needed.

@matteobettini
Copy link
Member

Thanks for this.

We also enccountered the same problem before.

I would like to find a solution where text can be passed as an object from extra_render() like the other geoms.

I'll have a look at this as soon as I have time.

Thanks a lot

@Zartris
Copy link
Contributor Author

Zartris commented May 24, 2023

Thats alright. Just close this if you don't need it.

@Zartris
Copy link
Contributor Author

Zartris commented May 24, 2023

Unless it is a dependency used by any of your libraries, the window keyword from TextLine class can be removed (as far as I can see it is not used anywhere), and then you can create TextLine objects in the extra_render function and add it to the list.

@Zartris
Copy link
Contributor Author

Zartris commented May 24, 2023

hmmm if we mix it with the other geoms from extra_render, it will course some transform problems later:

        self.transform.enable()
        for geom in self.geoms:
            geom.render()
        for geom in self.onetime_geoms:
            geom.render()
        self.transform.disable()

@Zartris
Copy link
Contributor Author

Zartris commented May 25, 2023

You could remove the state handling from the viewer class and add a singleton data class.
I'll show you an example, but there's some cleaning to do (which I have not done in this example) if you'd like this route.

@Zartris
Copy link
Contributor Author

Zartris commented May 25, 2023

This way, you can access this data from anywhere, and the viewer will just be responsible for rendering whatever is inside this data class.

@matteobettini
Copy link
Member

check out #54

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.

2 participants