diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2019-04-19 16:27:50 +0200 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2019-04-19 16:27:50 +0200 |
| commit | 4746c261f2b85f36742e9271feb9fc1f951b2379 (patch) | |
| tree | 19ec3ade2380ecb127d947b4d07843a008d58ff7 /megapixels/commands/misc | |
| parent | 124a00e14d22bff52d11926143affe0ef5e6171a (diff) | |
copy edit;
Diffstat (limited to 'megapixels/commands/misc')
| -rw-r--r-- | megapixels/commands/misc/obj2ply.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/megapixels/commands/misc/obj2ply.py b/megapixels/commands/misc/obj2ply.py index 8d0cec60..61fdefbd 100644 --- a/megapixels/commands/misc/obj2ply.py +++ b/megapixels/commands/misc/obj2ply.py @@ -10,10 +10,12 @@ import click @click.option('-c', '--float_colors/--int_colors', 'float_colors', default=False, help='pass if RGB colors are floats, not ints, in the obj') @click.option('-u', '--unwind/--wind', 'unwind', default=False, help='pass to reverse winding order on faces (if surface normals are upside down)') @click.option('-y', '--flip_y/--no_flip_y', 'flip_y', default=False, help='flip Y axis') +@click.option('-z', '--flip_z/--no_flip_z', 'flip_z', default=False, help='flip Z axis') +@click.option('-s', '--swap_xy/--no_swap_xy', 'swap_xy', default=False, help='swap axes so things rotate correctly') @click.option('-i', '--input_fn', required=True, help='input OBJ filename') @click.option('-o', '--output_fn', help='output PLY filename') @click.pass_context -def cli(ctx, float_colors, unwind, flip_y, input_fn, output_fn): +def cli(ctx, float_colors, unwind, flip_y, flip_z, swap_xy, input_fn, output_fn): """ click command for converting OBJ to PLY """ @@ -44,6 +46,12 @@ def cli(ctx, float_colors, unwind, flip_y, input_fn, output_fn): if N[0] == 'v': if flip_y: N[2] = str(float(N[2]) * -1) + if swap_xy: + tmp = N[2] + N[2] = N[1] + N[1] = tmp + if flip_z: + N[2] = str(float(N[2]) * -1) if float_colors: vertexes.append([ N[1], |
