Control Strict Pointer Mode from the CLI, defaulting to OFF

Due to issues with library overrides and unsynced pointers, it's quite
common for the Blender Animation Studio to get crashes of BAT. To avoid
these, Strict Pointer Mode is disabled when using BAT from the CLI.

Blender Cloud add-on will also get a similar update, so that there also
the Strict Pointer Mode is disabled.
This commit is contained in:
Sybren A. Stüvel
2021-07-22 10:47:50 +02:00
parent 087ff25c76
commit bd9ec7ddc7
2 changed files with 30 additions and 0 deletions
+16
View File
@@ -62,6 +62,14 @@ def cli_main():
const=logging.ERROR,
help="Log at ERROR level and higher",
)
parser.add_argument(
"-S",
"--strict-pointers",
default=False,
action="store_true",
help="Crash on pointers to missing data; otherwise the missing data is just ignored.",
)
subparsers = parser.add_subparsers(
help="Choose a subcommand to actually make BAT do something. "
"Global options go before the subcommand, "
@@ -88,6 +96,8 @@ def cli_main():
if not args.func:
parser.error("No subcommand was given")
set_strict_pointer_mode(args.strict_pointers)
start_time = time.time()
if args.profile:
import cProfile
@@ -118,3 +128,9 @@ def config_logging(args):
# Only set the log level on our own logger. Otherwise
# debug logging will be completely swamped.
logging.getLogger("blender_asset_tracer").setLevel(args.loglevel)
def set_strict_pointer_mode(strict_pointers: bool) -> None:
from blender_asset_tracer import blendfile
blendfile.set_strict_pointer_mode(strict_pointers)