GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Use setuptools and provide README to python binding for PyPI hosting. · YoshiDesign/tinyobjloader@b3ca787

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • python
    • LICENSE
    • README.md
    • sample.py
    • setup.py
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎python/LICENSE‎

Copy file name to clipboard
+21Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2012-2019 Syoyo Fujita and many contributors.
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in
13+
all copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
THE SOFTWARE.
Collapse file

‎python/README.md‎

Copy file name to clipboard
+61Lines changed: 61 additions & 0 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# tinyobj, Wavefront .obj loader
2+
3+
tinyobj is a python wrapper for C++ wavefront .obj loader.
4+
tinyobj is rather fast and feature rich than other pure python version of .obj loader.
5+
6+
## Quick tutorial
7+
8+
```py
9+
import sys
10+
import tinyobj
11+
12+
# Create reader.
13+
reader = tinyobj.ObjReader()
14+
15+
filename = "cornellbox.obj"
16+
17+
# Load .obj(and .mtl) using default configuration
18+
ret = reader.ParseFromFile(filename)
19+
20+
if ret == False:
21+
print("Warn:", reader.Warning())
22+
pint("Err:", reader.Error())
23+
print("Failed to load : ", filename)
24+
25+
sys.exit(-1)
26+
27+
if reader.Warning():
28+
print("Warn:", reader.Warning())
29+
30+
attrib = reader.GetAttrib()
31+
print("attrib.vertices = ", len(attrib.vertices))
32+
print("attrib.normals = ", len(attrib.normals))
33+
print("attrib.texcoords = ", len(attrib.texcoords))
34+
35+
materials = reader.GetMaterials()
36+
print("Num materials: ", len(materials))
37+
for m in materials:
38+
print(m.name)
39+
print(m.diffuse)
40+
41+
shapes = reader.GetShapes()
42+
print("Num shapes: ", len(shapes))
43+
for shape in shapes:
44+
print(shape.name)
45+
print("num_indices = {}".format(len(shape.mesh.indices)))
46+
47+
```
48+
49+
## More detailed usage
50+
51+
Please take a look at `python/sample.py` file in tinyobjloader git repo.
52+
53+
https://github.com/syoyo/tinyobjloader/blob/master/python/sample.py
54+
55+
## License
56+
57+
MIT license.
58+
59+
## TODO
60+
* [ ] Writer saver
61+
Collapse file

‎python/sample.py‎

Copy file name to clipboardExpand all lines: python/sample.py
+4-2Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,12 @@
1616

1717
if ret == False:
1818
print("Failed to load : ", filename)
19+
print("Warn:", reader.Warning())
20+
print("Err:", reader.Error())
1921
sys.exit(-1)
2022

21-
print("Warn:", reader.Warning())
22-
print("Err:", reader.Error())
23+
if reader.Warning():
24+
print("Warn:", reader.Warning())
2325

2426
attrib = reader.GetAttrib()
2527
print("attrib.vertices = ", len(attrib.vertices))
Collapse file

‎python/setup.py‎

Copy file name to clipboard
+14-3Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,28 @@
1-
from distutils.core import setup, Extension
1+
import setuptools
22

3+
with open("README.md", "r") as fh:
4+
long_description= fh.read()
35

46
# `tiny_obj_loader.cc` contains implementation of tiny_obj_loader.
5-
m = Extension('tinyobj',
7+
m = setuptools.Extension('tinyobj',
68
sources = ['bindings.cc', 'tiny_obj_loader.cc'],
79
extra_compile_args=['-std=c++11'],
810
include_dirs = ['../', '../pybind11/include']
911
)
1012

1113

12-
setup (name = 'tinyobj',
14+
setuptools.setup (name = 'tinyobj',
1315
version = '0.1',
1416
description = 'Python module for tinyobjloader',
17+
long_description = long_description,
18+
long_description_content_type = "text/markdown",
19+
author="Syoyo Fujita",
20+
author_email="[email protected]",
21+
url="https://github.com/syoyo/tinyobjloader",
22+
classifiers=[
23+
"License :: OSI Approved :: MIT License",
24+
],
25+
packages=setuptools.find_packages(),
1526
ext_modules = [m])
1627

1728

0 commit comments

Comments
0 (0)
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.