mirror of
https://github.com/blender/blender
synced 2026-09-29 04:37:17 +03:00
PyAPI: use None for bpy.app.autoexec_override when it isn't set
Expose `bpy.app.autoexec_override` as as bool or None, so the boolean can be used to indicate the command line argument passed in. Ref !164033
This commit is contained in:
parent
93145bafae
commit
3d39eceaee
5 changed files with 23 additions and 10 deletions
|
|
@ -327,8 +327,13 @@ class TestAutoExecCLI(unittest.TestCase):
|
|||
self.assert_blend_file_state(states[0], filename, is_trusted=is_trusted, message=message)
|
||||
# Opening the same file interactively must default to the same trust.
|
||||
self.assertEqual(states[0]["trust_source"], is_trusted, message)
|
||||
is_override = any(arg in {"--enable-autoexec", "--disable-autoexec"} for arg in args)
|
||||
self.assertEqual(states[0]["autoexec_override"], is_override, message)
|
||||
if "--enable-autoexec" in args:
|
||||
autoexec_override = True
|
||||
elif "--disable-autoexec" in args:
|
||||
autoexec_override = False
|
||||
else:
|
||||
autoexec_override = None
|
||||
self.assertEqual(states[0]["autoexec_override"], autoexec_override, message)
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
# Tests with Auto-Execution Preference "Enabled"
|
||||
|
|
|
|||
|
|
@ -175,7 +175,7 @@ def _setup(dirpath_temp, *, use_autoexec, autoexec_override=None):
|
|||
e = _events_after_load()
|
||||
|
||||
t.assertEqual(bpy.data.filepath, "")
|
||||
t.assertEqual(bpy.app.autoexec_override, autoexec_override is not None)
|
||||
t.assertEqual(bpy.app.autoexec_override, autoexec_override)
|
||||
if autoexec_override is None:
|
||||
t.assertEqual(bpy.app.autoexec, use_autoexec, "Auto-execution follows the preference")
|
||||
else:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue