Revert changes from main commits that were merged into blender-v4.1-release
The last good commit wasf57e4c5b98. After this one more fix was committed, this one is preserved as well:67bd678887.
This commit is contained in:
@@ -1,73 +0,0 @@
|
||||
"""
|
||||
**Using Python Argument Parsing**
|
||||
|
||||
This example shows how the Python ``argparse`` module can be used with a custom command.
|
||||
|
||||
Using ``argparse`` is generally recommended as it has many useful utilities and
|
||||
generates a ``--help`` message for your command.
|
||||
"""
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
import bpy
|
||||
|
||||
|
||||
def argparse_create():
|
||||
import argparse
|
||||
|
||||
parser = argparse.ArgumentParser(
|
||||
prog=os.path.basename(sys.argv[0]) + " --command keyconfig_export",
|
||||
description="Write key-configuration to a file.",
|
||||
)
|
||||
|
||||
parser.add_argument(
|
||||
"-o", "--output",
|
||||
dest="output",
|
||||
metavar='OUTPUT',
|
||||
type=str,
|
||||
help="The path to write the keymap to.",
|
||||
required=True,
|
||||
)
|
||||
|
||||
parser.add_argument(
|
||||
"-a", "--all",
|
||||
dest="all",
|
||||
action="store_true",
|
||||
help="Write all key-maps (not only customized key-maps).",
|
||||
required=False,
|
||||
)
|
||||
|
||||
return parser
|
||||
|
||||
|
||||
def keyconfig_export(argv):
|
||||
parser = argparse_create()
|
||||
args = parser.parse_args(argv)
|
||||
|
||||
# Ensure the key configuration is loaded in background mode.
|
||||
bpy.utils.keyconfig_init()
|
||||
|
||||
bpy.ops.preferences.keyconfig_export(
|
||||
filepath=args.output,
|
||||
all=args.all,
|
||||
)
|
||||
|
||||
return 0
|
||||
|
||||
|
||||
cli_commands = []
|
||||
|
||||
|
||||
def register():
|
||||
cli_commands.append(bpy.utils.register_cli_command("keyconfig_export", keyconfig_export))
|
||||
|
||||
|
||||
def unregister():
|
||||
for cmd in cli_commands:
|
||||
bpy.utils.unregister_cli_command(cmd)
|
||||
cli_commands.clear()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
register()
|
||||
@@ -1,42 +0,0 @@
|
||||
"""
|
||||
**Custom Commands**
|
||||
|
||||
Registering commands makes it possible to conveniently expose command line
|
||||
functionality via commands passed to (``-c`` / ``--command``).
|
||||
"""
|
||||
|
||||
import sys
|
||||
import os
|
||||
|
||||
|
||||
def sysinfo_command(argv):
|
||||
import tempfile
|
||||
import sys_info
|
||||
|
||||
if argv and argv[0] == "--help":
|
||||
print("Print system information & exit!")
|
||||
return 0
|
||||
|
||||
with tempfile.TemporaryDirectory() as tempdir:
|
||||
filepath = os.path.join(tempdir, "system_info.txt")
|
||||
sys_info.write_sysinfo(filepath)
|
||||
with open(filepath, "r", encoding="utf-8") as fh:
|
||||
sys.stdout.write(fh.read())
|
||||
return 0
|
||||
|
||||
|
||||
cli_commands = []
|
||||
|
||||
|
||||
def register():
|
||||
cli_commands.append(bpy.utils.register_cli_command("sysinfo", sysinfo_command))
|
||||
|
||||
|
||||
def unregister():
|
||||
for cmd in cli_commands:
|
||||
bpy.utils.unregister_cli_command(cmd)
|
||||
cli_commands.clear()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
register()
|
||||
@@ -1,7 +1,7 @@
|
||||
..
|
||||
This document is appended to the auto generated BMesh API doc to avoid clogging up the C files with details.
|
||||
to test this run:
|
||||
./blender.bin -b -P doc/python_api/sphinx_doc_gen.py -- \
|
||||
./blender.bin -b -noaudio -P doc/python_api/sphinx_doc_gen.py -- \
|
||||
--partial bmesh* ; cd doc/python_api ; sphinx-build sphinx-in sphinx-out ; cd ../../
|
||||
|
||||
|
||||
|
||||
@@ -252,7 +252,8 @@ def main():
|
||||
name, tp = arg
|
||||
tp_sub = None
|
||||
else:
|
||||
assert False, "unreachable, unsupported 'arg' length found %d" % len(arg)
|
||||
print(arg)
|
||||
assert 0
|
||||
|
||||
tp_str = ""
|
||||
|
||||
@@ -321,7 +322,8 @@ def main():
|
||||
# but think the idea is that that pointer is for any type?
|
||||
tp_str = ":class:`bpy.types.bpy_struct`"
|
||||
else:
|
||||
assert False, "unreachable, unknown type %r" % vars_dict_reverse[tp_sub]
|
||||
print("Can't find", vars_dict_reverse[tp_sub])
|
||||
assert 0
|
||||
|
||||
elif tp == BMO_OP_SLOT_ELEMENT_BUF:
|
||||
assert tp_sub is not None
|
||||
@@ -360,9 +362,11 @@ def main():
|
||||
elif tp_sub == BMO_OP_SLOT_SUBTYPE_MAP_INTERNAL:
|
||||
tp_str += "unknown internal data, not compatible with python"
|
||||
else:
|
||||
assert False, "unreachable, unknown type %r" % vars_dict_reverse[tp_sub]
|
||||
print("Can't find", vars_dict_reverse[tp_sub])
|
||||
assert 0
|
||||
else:
|
||||
assert False, "unreachable, unknown type %r" % vars_dict_reverse[tp]
|
||||
print("Can't find", vars_dict_reverse[tp])
|
||||
assert 0
|
||||
|
||||
args_wash.append((name, default_value, tp_str, comment))
|
||||
return args_wash
|
||||
|
||||
@@ -7,7 +7,7 @@ API dump in RST files
|
||||
---------------------
|
||||
Run this script from Blender's root path once you have compiled Blender
|
||||
|
||||
blender --background --factory-startup --python doc/python_api/sphinx_doc_gen.py
|
||||
blender --background --factory-startup -noaudio --python doc/python_api/sphinx_doc_gen.py
|
||||
|
||||
This will generate python files in doc/python_api/sphinx-in/
|
||||
providing ./blender is or links to the blender executable
|
||||
@@ -239,12 +239,12 @@ BPY_LOGGER.setLevel(logging.DEBUG)
|
||||
"""
|
||||
# for quick rebuilds
|
||||
rm -rf /b/doc/python_api/sphinx-* && \
|
||||
./blender -b --factory-startup -P doc/python_api/sphinx_doc_gen.py && \
|
||||
./blender -b -noaudio --factory-startup -P doc/python_api/sphinx_doc_gen.py && \
|
||||
sphinx-build doc/python_api/sphinx-in doc/python_api/sphinx-out
|
||||
|
||||
or
|
||||
|
||||
./blender -b --factory-startup -P doc/python_api/sphinx_doc_gen.py -- -f -B
|
||||
./blender -b -noaudio --factory-startup -P doc/python_api/sphinx_doc_gen.py -- -f -B
|
||||
"""
|
||||
|
||||
# Switch for quick testing so doc-builds don't take so long.
|
||||
|
||||
Reference in New Issue
Block a user