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

Adds typing information to the notebooks.mesh_viewer module. #675

Merged
merged 1 commit into from
Jan 6, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 4 additions & 2 deletions tensorflow_graphics/notebooks/mesh_viewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
from __future__ import division
from __future__ import print_function

from typing import Any, Dict

import numpy as np
from tensorflow_graphics.notebooks import threejs_visualization

Expand All @@ -32,7 +34,7 @@
class Viewer(object):
"""A ThreeJS based viewer class for viewing 3D meshes."""

def _mesh_from_data(self, data):
def _mesh_from_data(self, data: Dict[str, Any]) -> Dict[str, Any]:
"""Creates a dictionary of ThreeJS mesh objects from numpy data."""
if 'vertices' not in data or 'faces' not in data:
raise ValueError('Mesh Data must contain vertices and faces')
Expand All @@ -54,7 +56,7 @@ def _mesh_from_data(self, data):
mesh['material'] = material
return mesh

def __init__(self, source_mesh_data):
def __init__(self, source_mesh_data: Dict[str, Any]):
context = threejs_visualization.build_context()
self.context = context
light1 = context.THREE.PointLight.new_object(0x808080)
Expand Down