Skip to content

Commit

Permalink
Adds typing information to the notebooks.mesh_viewer module.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 419875202
  • Loading branch information
G4G authored and Copybara-Service committed Jan 6, 2022
1 parent 9e15b6a commit 573eb95
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions tensorflow_graphics/notebooks/mesh_viewer.py
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

0 comments on commit 573eb95

Please sign in to comment.