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

add interfacing to javascript side 2d text rendering #32

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

Conversation

shensquared
Copy link
Contributor

@shensquared shensquared commented Nov 26, 2018

accompanying the javascript side PR meshcat-dev/meshcat#43
still some clean up needed

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-io
Copy link

codecov-io commented Feb 15, 2019

Codecov Report

Merging #32 into master will decrease coverage by 1.51%.
The diff coverage is 40%.

Impacted file tree graph

@@            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
Impacted Files Coverage Δ
src/meshcat/commands.py 95.12% <100%> (ø) ⬆️
src/meshcat/geometry.py 83.18% <36.84%> (-4.14%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ad50538...9932bb9. Read the comment docs.

@@ -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
Copy link
Collaborator

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?

Copy link
Contributor Author

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.



def SceneText(text, **kwargs):
if 'width' in kwargs and 'height' in kwargs:
Copy link
Collaborator

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): 
  ...

?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, agreed. Changed it.

@@ -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):
Copy link
Collaborator

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@Arpafaucon
Copy link

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 ?

@Arpafaucon
Copy link

This MR was re-ported and merged in #111 so it should probably be closed

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.

4 participants