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:
parent
087ff25c76
commit
bd9ec7ddc7
@ -839,3 +839,17 @@ class BlendFileBlock:
|
||||
"""Generator, yields (property path, property value) recursively for all properties."""
|
||||
for k in self.keys():
|
||||
yield from self.get_recursive_iter(k, as_str=False)
|
||||
|
||||
|
||||
def set_strict_pointer_mode(strict_pointers: bool) -> None:
|
||||
"""Control behaviour when a pointer to unknown memory is dereferenced.
|
||||
|
||||
Strict pointer mode raise exceptions.SegmentationFault when dereferencing an
|
||||
unknown pointer. This is the default.
|
||||
|
||||
Set to False to disable this exception, and to return None instead, i.e. to
|
||||
ignore such pointers. Note that this can cause None to be returned from a
|
||||
non-nil pointer.
|
||||
"""
|
||||
|
||||
BlendFile.strict_pointer_mode = strict_pointers
|
||||
|
||||
@ -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)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user