mirror of
https://github.com/3b1b/manim.git
synced 2025-08-19 21:08:53 +00:00
Merge pull request #285 from DanWaxman/master
Added the option to change color in extract scene.
This commit is contained in:
commit
1ce9ce99aa
1 changed files with 12 additions and 0 deletions
|
@ -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:
|
||||
|
|
Loading…
Add table
Reference in a new issue