-
Notifications
You must be signed in to change notification settings - Fork 63
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
add interfacing to javascript side 2d text rendering #32
base: master
Are you sure you want to change the base?
Conversation
add text geometry (and PEP8 autofomat) add set_text() method and supporting logics split the texture from the rest of the object_json streamline material initialization demo WIP WIP add transparency parameter to differentiate scene and object texts fix transparent args and disentangle font size with face (for resizing) remove alphas finalizing
Codecov Report
@@ Coverage Diff @@
## master #32 +/- ##
==========================================
- Coverage 87.47% 85.96% -1.52%
==========================================
Files 8 8
Lines 615 634 +19
==========================================
+ Hits 538 545 +7
- Misses 77 89 +12
Continue to review full report at Codecov.
|
src/meshcat/commands.py
Outdated
@@ -19,6 +20,9 @@ def __init__(self, geometry_or_object, material=None, path=[]): | |||
if isinstance(material, PointsMaterial): | |||
self.object = Points(geometry_or_object, material) | |||
else: | |||
if texts is not None: | |||
material.map = TextTexture(texts) | |||
material.needsUpdate = True |
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.
Do we still need this code?
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.
Right, they only serve to simplify the call a little, but it's not too verbose otherwise either. Removed them.
src/meshcat/geometry.py
Outdated
|
||
|
||
def SceneText(text, **kwargs): | ||
if 'width' in kwargs and 'height' in kwargs: |
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.
I don't think this is quite right. If the user only provides width
or height
then that argument will be ignored. Can't we just do:
def SceneText(text, width=10, height=10, **kwargs):
...
?
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.
Yep, agreed. Changed it.
src/meshcat/visualizer.py
Outdated
@@ -134,8 +134,9 @@ def jupyter_cell(self): | |||
def __getitem__(self, path): | |||
return Visualizer.view_into(self.window, self.path.append(path)) | |||
|
|||
def set_object(self, geometry, material=None): | |||
return self.window.send(SetObject(geometry, material, self.path)) | |||
def set_object(self, geometry, material=None, texts=None): |
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 we get rid of the texts
argument here as well?
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.
Done.
Hey @shensquared, @rdeits ! When looking for ways to display text in meshcat via python I got to this MR, that is still open. I'd be glad to help get this merge if I can ! Do you need anything ? |
This MR was re-ported and merged in #111 so it should probably be closed |
accompanying the javascript side PR meshcat-dev/meshcat#43
still some clean up needed