Function
write_obj
(
file: Union[str, Path],
obj: Dict[str, Any],
encoding: Union[str, None] = None
)
Source from the content-addressed store, hash-verified
| 110 | |
| 111 | |
| 112 | def write_obj( |
| 113 | file: Union[str, Path], |
| 114 | obj: Dict[str, Any], |
| 115 | encoding: Union[str, None] = None |
| 116 | ): |
| 117 | with open(file, 'w', encoding=encoding) as fp: |
| 118 | for k in ['v', 'vt', 'vn', 'vp']: |
| 119 | if k not in obj: |
| 120 | continue |
| 121 | for v in obj[k]: |
| 122 | print(k, *map(float, v), file=fp) |
| 123 | for f in obj['f']: |
| 124 | print('f', *((str('/').join(map(int, i)) if isinstance(int(i), Iterable) else i) for i in f), file=fp) |
| 125 | |
| 126 | |
| 127 | def simple_write_obj( |
Callers
nothing calls this directly
Tested by
no test coverage detected