diff --git a/README.md b/README.md index 6de7a7d..3eb7e53 100644 --- a/README.md +++ b/README.md @@ -11,13 +11,13 @@ This code was previously part of the Tilt Brush Toolkit and was originally writt Python 3.9 code and scripts for advanced Open Brush data manipulation. * `bin` - command-line tools - * `dump_tilt.py` - Sample code that uses the tiltbrush.tilt module to view raw Open Brush data. + * `dump_tilt.py` - Sample code that uses the openbrush.tilt module to view raw Open Brush data. * `geometry_json_to_fbx.py` - Sample code that shows how to postprocess the raw per-stroke geometry in various ways that might be needed for more-sophisticated workflows involving DCC tools and raytracers. This variant packages the result as a .fbx file. * `geometry_json_to_obj.py` - Sample code that shows how to postprocess the raw per-stroke geometry in various ways that might be needed for more-sophisticated workflows involving DCC tools and raytracers. This variant packages the result as a .obj file. * `tilt_to_strokes_dae.py` - Converts .tilt files to a Collada .dae containing spline data. * `unpack_tilt.py` - Converts .tilt files from packed format (zip) to unpacked format (directory) and vice versa, optionally applying compression. * `Python` - Put this in your `PYTHONPATH` - * `tiltbrush` - Python package for manipulating Open Brush data. + * `openbrush` - Python package for manipulating Open Brush data. * `export.py` - Parse the legacy .json export format. This format contains the raw per-stroke geometry in a form intended to be easy to postprocess. * `tilt.py` - Read and write .tilt files. This format contains no geometry, but does contain timestamps, pressure, controller position and orientation, metadata, and so on -- everything Open Brush needs to regenerate the geometry. * `unpack.py` - Convert .tilt files from packed format to unpacked format and vice versa. diff --git a/bin/analyze_tilt.py b/bin/analyze_tilt.py index 37546e4..d4cc40c 100755 --- a/bin/analyze_tilt.py +++ b/bin/analyze_tilt.py @@ -1,12 +1,12 @@ import sys from pprint import pprint -import tiltbrush.tilt +import openbrush.tilt if __name__ == '__main__': path = " ".join(sys.argv[1:]) try: - tilt = tiltbrush.tilt.Tilt(path) + tilt = openbrush.tilt.Tilt(path) pprint(tilt.metadata['CameraPaths']) except Exception as e: print("ERROR: %s" % e) diff --git a/bin/dump_tilt.py b/bin/dump_tilt.py index 9703298..27d2764 100755 --- a/bin/dump_tilt.py +++ b/bin/dump_tilt.py @@ -14,7 +14,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -"""This is sample Python 2.7 code that uses the tiltbrush.tilt module +"""This is sample Python 2.7 code that uses the openbrush.tilt module to view raw Tilt Brush data.""" import os @@ -24,7 +24,7 @@ try: sys.path.append(os.path.join(os.path.dirname(os.path.dirname( os.path.abspath(__file__))), 'Python')) - from tiltbrush.tilt import Tilt + from openbrush.tilt import Tilt except ImportError: print("Please put the 'Python' directory in your PYTHONPATH", file=sys.stderr) sys.exit(1) @@ -32,7 +32,7 @@ def dump_sketch(sketch): """Prints out some rough information about the strokes. - Pass a tiltbrush.tilt.Sketch instance.""" + Pass a openbrush.tilt.Sketch instance.""" cooky, version, unused = sketch.header[0:3] print('Cooky:0x%08x Version:%s Unused:%s Extra:(%d bytes)' % ( cooky, version, unused, len(sketch.additional_header))) diff --git a/bin/geometry_json_to_fbx.py b/bin/geometry_json_to_fbx.py index 2f1a722..0339784 100755 --- a/bin/geometry_json_to_fbx.py +++ b/bin/geometry_json_to_fbx.py @@ -32,7 +32,7 @@ try: sys.path.append(os.path.join(os.path.dirname(os.path.dirname( os.path.abspath(__file__))), 'Python')) - from tiltbrush.export import iter_meshes, TiltBrushMesh, SINGLE_SIDED_FLAT_BRUSH + from openbrush.export import iter_meshes, TiltBrushMesh, SINGLE_SIDED_FLAT_BRUSH except ImportError: print("Please put the 'Python' directory in your PYTHONPATH", file=sys.stderr) sys.exit(1) diff --git a/bin/geometry_json_to_obj.py b/bin/geometry_json_to_obj.py index 30485a7..5b9263a 100755 --- a/bin/geometry_json_to_obj.py +++ b/bin/geometry_json_to_obj.py @@ -34,7 +34,7 @@ try: sys.path.append(os.path.join(os.path.dirname(os.path.dirname( os.path.abspath(__file__))), 'Python')) - from tiltbrush.export import iter_meshes, TiltBrushMesh, SINGLE_SIDED_FLAT_BRUSH + from openbrush.export import iter_meshes, TiltBrushMesh, SINGLE_SIDED_FLAT_BRUSH except ImportError: print("Please put the 'Python' directory in your PYTHONPATH", file=sys.stderr) sys.exit(1) diff --git a/bin/normalize_sketch.py b/bin/normalize_sketch.py index f6cce3e..2a929e2 100755 --- a/bin/normalize_sketch.py +++ b/bin/normalize_sketch.py @@ -14,7 +14,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -"""This is sample Python 2.7 code that uses the tiltbrush.tilt module +"""This is sample Python 2.7 code that uses the openbrush.tilt module to scale, rotate, and translate the sketch so that the resetting the transform will bring you back to the initial size, orientation, and position. But the environment size, orientation, and position will also @@ -27,7 +27,7 @@ try: sys.path.append(os.path.join(os.path.dirname(os.path.dirname( os.path.abspath(__file__))), 'Python')) - from tiltbrush.tilt import Tilt + from openbrush.tilt import Tilt except ImportError: print("Please put the 'Python' directory in your PYTHONPATH", file=sys.stderr) sys.exit(1) diff --git a/bin/tilt_to_strokes_dae.py b/bin/tilt_to_strokes_dae.py index b338c0d..6cacb12 100755 --- a/bin/tilt_to_strokes_dae.py +++ b/bin/tilt_to_strokes_dae.py @@ -22,7 +22,7 @@ try: sys.path.append(os.path.join(os.path.dirname(os.path.dirname( os.path.abspath(__file__))), 'Python')) - from tiltbrush.tilt import Tilt + from openbrush.tilt import Tilt except ImportError: print("Please put the 'Python' directory in your PYTHONPATH", file=sys.stderr) sys.exit(1) diff --git a/bin/unpack_tilt.py b/bin/unpack_tilt.py index 9bf8d64..680498c 100755 --- a/bin/unpack_tilt.py +++ b/bin/unpack_tilt.py @@ -20,7 +20,7 @@ try: sys.path.append(os.path.join(os.path.dirname(os.path.dirname( os.path.abspath(__file__))), 'Python')) - import tiltbrush.unpack + import openbrush.unpack except ImportError: print("Please put the 'Python' directory in your PYTHONPATH", file=sys.stderr) sys.exit(1) @@ -28,13 +28,13 @@ def convert(in_name, compress): if os.path.isdir(in_name): - tiltbrush.unpack.convert_dir_to_zip(in_name, compress) + openbrush.unpack.convert_dir_to_zip(in_name, compress) print("Converted %s to zip format" % in_name) elif os.path.isfile(in_name): - tiltbrush.unpack.convert_zip_to_dir(in_name) + openbrush.unpack.convert_zip_to_dir(in_name) print("Converted %s to directory format" % in_name) else: - raise tiltbrush.unpack.ConversionError("%s doesn't exist" % in_name) + raise openbrush.unpack.ConversionError("%s doesn't exist" % in_name) def main(): @@ -49,7 +49,7 @@ def main(): for arg in args.files: try: convert(arg, args.compress) - except tiltbrush.unpack.ConversionError as e: + except openbrush.unpack.ConversionError as e: print("ERROR: %s" % e) diff --git a/tiltbrush/__init__.py b/openbrush/__init__.py similarity index 100% rename from tiltbrush/__init__.py rename to openbrush/__init__.py diff --git a/tiltbrush/export.py b/openbrush/export.py similarity index 100% rename from tiltbrush/export.py rename to openbrush/export.py diff --git a/tiltbrush/tilt.py b/openbrush/tilt.py similarity index 99% rename from tiltbrush/tilt.py rename to openbrush/tilt.py index 2d08a1b..948e851 100644 --- a/tiltbrush/tilt.py +++ b/openbrush/tilt.py @@ -185,7 +185,7 @@ def as_directory(tilt_file): if os.path.isdir(tilt_file): yield Tilt(tilt_file) else: - import tiltbrush.unpack as unpack + import openbrush.unpack as unpack compressed = unpack.convert_zip_to_dir(tilt_file) try: yield Tilt(tilt_file) diff --git a/tiltbrush/unpack.py b/openbrush/unpack.py similarity index 100% rename from tiltbrush/unpack.py rename to openbrush/unpack.py diff --git a/tests/test_tilt.py b/tests/test_tilt.py index dde5a4b..14d39b9 100644 --- a/tests/test_tilt.py +++ b/tests/test_tilt.py @@ -17,7 +17,7 @@ import shutil import unittest -from tiltbrush.tilt import Tilt +from openbrush.tilt import Tilt @contextlib.contextmanager