upload files
This commit is contained in:
		
							
								
								
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							@@ -6,7 +6,6 @@ __pycache__
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
.coverage
 | 
					.coverage
 | 
				
			||||||
 | 
					
 | 
				
			||||||
MANIFEST
 | 
					 | 
				
			||||||
dist
 | 
					dist
 | 
				
			||||||
build
 | 
					build
 | 
				
			||||||
tmp.html
 | 
					tmp.html
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										5
									
								
								MANIFEST
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								MANIFEST
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,5 @@
 | 
				
			|||||||
 | 
					setup.py
 | 
				
			||||||
 | 
					obj2html/__init__.py
 | 
				
			||||||
 | 
					obj2html/obj2html.py
 | 
				
			||||||
 | 
					obj2html/index.html
 | 
				
			||||||
 | 
					pipy_readme.rst
 | 
				
			||||||
							
								
								
									
										68
									
								
								setup.py
									
									
									
									
									
								
							
							
						
						
									
										68
									
								
								setup.py
									
									
									
									
									
								
							@@ -1,73 +1,13 @@
 | 
				
			|||||||
from distutils.core import setup
 | 
					from distutils.core import setup
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# it do not work on install
 | 
					import os
 | 
				
			||||||
# import os
 | 
					with open(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'pipy_readme.rst'), 'r') as f:
 | 
				
			||||||
# with open(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'pipy_readme.rst'), 'r') as f:
 | 
					  long_des = f.read()
 | 
				
			||||||
#   long_des = f.read()
 | 
					 | 
				
			||||||
long_des = """obj2html lib
 | 
					 | 
				
			||||||
=============================
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
You can use that lib to create html file from a .obj path: 
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
.. code-block:: python
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    from obj2html import obj2html
 | 
					 | 
				
			||||||
    obj2html('model.obj', 'index.html')
 | 
					 | 
				
			||||||
    # firefox index.html
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
.. image:: https://gitlab.com/nicolalandro/obj2html/-/raw/main/imgs/colab_sample.png
 | 
					 | 
				
			||||||
  :alt: Colab example
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
Use in a Jupyter notebook to display a .obj 3D file:
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
.. code-block:: python
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    ! pip install obj2html
 | 
					 | 
				
			||||||
    ! wget https://gitlab.com/nicolalandro/obj2html/-/raw/main/test/assets/model.obj
 | 
					 | 
				
			||||||
    from obj2html import obj2html
 | 
					 | 
				
			||||||
    from IPython.display import display, HTML
 | 
					 | 
				
			||||||
    obj2html('model.obj', 'index.html')
 | 
					 | 
				
			||||||
    display(HTML('index.html'))
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
It is also possible to set the scale factor, light and camera options:
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
.. code-block:: python
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    camera={
 | 
					 | 
				
			||||||
      "fov": 45,
 | 
					 | 
				
			||||||
      "aspect": 2,
 | 
					 | 
				
			||||||
      "near": 0.1,
 | 
					 | 
				
			||||||
      "far": 100,
 | 
					 | 
				
			||||||
      "pos_x": 0,
 | 
					 | 
				
			||||||
      "pos_y": 10,
 | 
					 | 
				
			||||||
      "pos_z": 20,
 | 
					 | 
				
			||||||
      "orbit_x": 0,
 | 
					 | 
				
			||||||
      "orbit_y": 5,
 | 
					 | 
				
			||||||
      "orbit_z": 0,
 | 
					 | 
				
			||||||
    },
 | 
					 | 
				
			||||||
    light={
 | 
					 | 
				
			||||||
      "color": "0xFFFFFF",
 | 
					 | 
				
			||||||
      "intensity": 1,
 | 
					 | 
				
			||||||
      "pos_x": 0,
 | 
					 | 
				
			||||||
      "pos_y": 10,
 | 
					 | 
				
			||||||
      "pos_z": 0,
 | 
					 | 
				
			||||||
      "target_x": -5,
 | 
					 | 
				
			||||||
      "target_y": 0,
 | 
					 | 
				
			||||||
      "target_z": 0,
 | 
					 | 
				
			||||||
    },
 | 
					 | 
				
			||||||
    obj_options={
 | 
					 | 
				
			||||||
      "scale_x": 30,
 | 
					 | 
				
			||||||
      "scale_y": 30,
 | 
					 | 
				
			||||||
      "scale_z": 30,
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
    obj2html('model.obj', 'index.html', camera, light, obj_options)
 | 
					 | 
				
			||||||
"""
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
setup(
 | 
					setup(
 | 
				
			||||||
  name = 'obj2html',
 | 
					  name = 'obj2html',
 | 
				
			||||||
  packages = ['obj2html'],
 | 
					  packages = ['obj2html'],
 | 
				
			||||||
  version = '0.8',
 | 
					  version = '0.9',
 | 
				
			||||||
  license='MIT',
 | 
					  license='MIT',
 | 
				
			||||||
  description = 'Create an html with three.js that contains the given .obj file.',
 | 
					  description = 'Create an html with three.js that contains the given .obj file.',
 | 
				
			||||||
  long_description = long_des,
 | 
					  long_description = long_des,
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user