summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@gmail.com>2011-06-16 00:03:37 -0600
committerTavian Barnes <tavianator@gmail.com>2011-06-16 00:08:22 -0600
commit1c9b8fa88e290ef2b66f049c99b812f378d30ee3 (patch)
tree48e0855680fb3bc411e127a5992b336c54d49e1e
parent817532b031cb9a15ccf27ff66d8031b31abce200 (diff)
downloaddimension-1c9b8fa88e290ef2b66f049c99b812f378d30ee3.tar.xz
Use types for command-line options, and support --quality.
-rw-r--r--dimension/dimension.in18
-rw-r--r--libdimension-python/dimension.pyx9
2 files changed, 19 insertions, 8 deletions
diff --git a/dimension/dimension.in b/dimension/dimension.in
index 1f26db0..b73ff1c 100644
--- a/dimension/dimension.in
+++ b/dimension/dimension.in
@@ -32,10 +32,10 @@ _parser = argparse.ArgumentParser(
_parser.add_argument('-V', '--version', action = 'version',
version = '@PACKAGE_NAME@ @PACKAGE_VERSION@')
-_parser.add_argument('-w', '--width', action = 'store', default = 768,
- help = 'image width')
-_parser.add_argument('-h', '--height', action = 'store', default = 480,
- help = 'image height')
+_parser.add_argument('-w', '--width', action = 'store', type = int,
+ default = 768, help = 'image width')
+_parser.add_argument('-h', '--height', action = 'store', type = int,
+ default = 480, help = 'image height')
_parser.add_argument('-v', '--verbose', action = 'store_true',
help = 'print more information')
@@ -44,12 +44,14 @@ _parser.add_argument('-q', '--quiet', action = 'store_true',
_parser.add_argument('--strict', action = 'store_true',
help = 'treat warnings as errors')
-_parser.add_argument('--threads', action = 'store',
+_parser.add_argument('--threads', action = 'store', type = int,
help = 'the number of threads to render with')
+_parser.add_argument('--quality', action = 'store', type = int,
+ help = 'the scene quality')
-_parser.add_argument('-o', '--output', action = 'store',
+_parser.add_argument('-o', '--output', action = 'store', type = str,
help = 'the output image file')
-_parser.add_argument('input', action = 'store',
+_parser.add_argument('input', action = 'store', type = str,
help = 'the input scene description file')
_args = _parser.parse_args()
@@ -101,6 +103,8 @@ if recursion_limit is not None:
scene.recursion_limit = recursion_limit
if _args.threads is not None:
scene.nthreads = _args.threads
+if _args.quality is not None:
+ scene.quality = _args.quality
# Raytrace the scene
if not _args.quiet:
diff --git a/libdimension-python/dimension.pyx b/libdimension-python/dimension.pyx
index fa57691..b19db18 100644
--- a/libdimension-python/dimension.pyx
+++ b/libdimension-python/dimension.pyx
@@ -432,7 +432,7 @@ cdef class Canvas:
"""A rendering target."""
cdef dmnsn_canvas *_canvas
- def __init__(self, size_t width, size_t height):
+ def __init__(self, width, height):
"""
Create a Canvas.
@@ -1292,6 +1292,13 @@ cdef class Scene:
def __set__(self, n):
self._scene.nthreads = n
+ property quality:
+ """The render quality."""
+ def __get__(self):
+ return self._scene.quality
+ def __set__(self, q):
+ self._scene.quality = q
+
property bounding_timer:
"""The Timer for building the bounding hierarchy."""
def __get__(self):