Added the option to change color in extract scene.

This edits the camera config in the same way as the resolution argument or transparency flag. Inputs can either be strings, 3 digit hex strings, or 6 digit hex strings. In a Unix terminal the hex strings will have to be prepended with a '\'.
This commit is contained in:
Dan Waxman 2018-09-08 12:57:33 -04:00
parent af7d4a3cb9
commit 314649c96f

View file

@ -16,6 +16,8 @@ from scene.scene import Scene
from utils.sounds import play_error_sound
from utils.sounds import play_finish_sound
from colour import Color
HELP_MESSAGE = """
Usage:
python extract_scene.py <module> [<scene name>]
@ -31,6 +33,7 @@ HELP_MESSAGE = """
-t use transperency when exporting images
-n specify the number of the animation to start from
-r specify a resolution
-c specify a background color
"""
SCENE_NOT_FOUND_MESSAGE = """
That scene is not in the script
@ -72,6 +75,7 @@ def get_configuration():
parser.add_argument("-o", "--output_name")
parser.add_argument("-n", "--start_at_animation_number")
parser.add_argument("-r", "--resolution")
parser.add_argument("-c", "--color")
args = parser.parse_args()
if args.output_name is not None:
output_name_root, output_name_ext = os.path.splitext(
@ -135,6 +139,14 @@ def get_configuration():
"pixel_width": width,
})
if args.color:
try:
config["camera_config"]["background_color"] = Color(args.color)
except AttributeError as err:
print("Please use a valid color")
print(err)
sys.exit(2)
# If rendering a transparent image/move, make sure the
# scene has a background opacity of 0
if args.transparent: