-
Notifications
You must be signed in to change notification settings - Fork 62
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
[rebased] Text rendering: python-side #111
Conversation
src/meshcat/geometry.py
Outdated
@@ -195,6 +215,26 @@ def lower(self, object_data): | |||
} | |||
|
|||
|
|||
class TextTexture(Texture): | |||
def __init__(self, text, font_size=100, font_face='sans-serif', | |||
width=200, height=100, position=[10, 10]): |
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.
width
, height
, position
are not used. Should I delete them ?
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 please
Hi maintainers (@rdeits and @shensquared ?), a gentle reminder of this PR waiting for your feedback :) Also, while thinking about it, I was wondering how hard it would be to be able to extend this work and apply a texture only on some faces of 3D shapes (especially boxes). An illustration explaining why is below: This is a screenshot of a little project I did to visualize the position of some frames of a robot. I draw 3 cylinders for each frame pointing in the X,Y,Z directions. I wanted to add the frame name on the X cylinder (colored red). Ideally I would have liked to have this text readable on all 4 sides of the cylinder, for now I only did it on 2 opposite sides, by creating a transparent box around the red cylinder, and having the frame name painted as a
I highlighted 2 small issues with the current solution:
I feel that those 2 issues could be solved by:
Despite those slight inconvenience (for which there is maybe an already existing solution ?), I'd be very happy if we could merge this first PR into |
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 for forgetting about this, and thanks for the contribution. If you can delete those unused attributes I'm happy to get this merged.
src/meshcat/geometry.py
Outdated
@@ -195,6 +215,26 @@ def lower(self, object_data): | |||
} | |||
|
|||
|
|||
class TextTexture(Texture): | |||
def __init__(self, text, font_size=100, font_face='sans-serif', | |||
width=200, height=100, position=[10, 10]): |
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 please
@rdeits I removed the attributes :) |
Install from source works for me:
|
I do not claim any credit for this work, I merely squashed & rebased @shensquared's work in #32. The only "intelligent" change I had to do is remove a use of
unicode
since we're python3 now.I tested the relevant
demo.ipynb
and was able to reproduce the results. Here's the state after the final cell is run:I hope this will save you some work, and help merge this nice feature to
meshcat
:)