args = parse_custom_args() common.ensure_addons() if args.blend: common.open_scene(args.blend) version.save_new(args.id) meta.write_media_info() else: run_updates = True if args.min_interval: meta = meta.get() if "lastUpdate" in meta: run_updates = time() - meta["lastUpdate"] < args.min_interval if run_updates: version.open_latest(args.id) # TODO: Find problem: Why does it update although hash stayed the same? # (Happened on update form external sources manually) # (Note 06/03/2016 - not sure if still applies) if update.update_models(): version.save_new(args.id) meta.write_media_info() else: meta.write({"lastUpdate": time()})
parser.add_argument("--media-type", required=True) parser.add_argument("--media-width", type=int, required=True) parser.add_argument("--media-height", type=int, required=True) parser.add_argument("--media-length", type=float, default=24) parser.add_argument("--camera-type", required=True) parser.add_argument("--style-type", required=True) parser.add_argument("--modifier-type", required=True) parser.add_argument("--modifier-section-axis", default="Z") parser.add_argument("--modifier-section-level", type=float, default=0.5) parser.add_argument("--modifier-section-animated") parser.add_argument("--modifier-section-animate-progress-from", type=float, default=0) parser.add_argument("--modifier-section-animate-progress-to", type=float, default=1) custom_args = args[sys.argv.index("--") + 1:] return parser.parse_args(custom_args) options = options_from_args(sys.argv) version.save_new(options.id) common.setup_default_scene() media.setup(options) update.update_models(options) style.setup(options) modifier.setup(options) camera.setup(options) version.save_current(options)
def options_from_args(args): parser = ArgumentParser(prog="Elmyra Update Params") parser.add_argument("--id", required=True) parser.add_argument("--min-interval", type=int, default=None) parser.add_argument("--blend", default=None) custom_args = args[sys.argv.index("--") + 1 :] return parser.parse_args(custom_args) options = options_from_args(sys.argv) if options.blend: version.open_new(options.blend) version.save_new(options.id) meta.write_media_info() else: version.open_latest(options.id) # TODO: Find problem: Why does it update although the hash stayed the same? # (Happened on update form external sources manually) if update.update_models(options, options.min_interval): version.save_new(options.id) meta.write_media_info() else: # Save only updated meta-information (timestamps) version.save_current(options)