Skip to content

Commit

Permalink
chore(yaml): Removes yaml-config support
Browse files Browse the repository at this point in the history
  • Loading branch information
cornerfarmer committed Aug 21, 2023
1 parent 9fb4adb commit 4e1c374
Show file tree
Hide file tree
Showing 165 changed files with 25 additions and 15,692 deletions.
34 changes: 8 additions & 26 deletions blenderproc/command_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,12 @@ def cli():

# Setup all common arguments of run and debug mode
for subparser in [parser_run, parser_debug, parser_quickstart]:
subparser.add_argument('file', default=None, nargs='?',
help='The path to a configuration file which describes what the pipeline should do or '
'a python file which uses BlenderProc via the API.')
if subparser != parser_quickstart:
subparser.add_argument('file', help='The path to a python file which uses BlenderProc via the API.')

subparser.add_argument('--reinstall-blender', dest='reinstall_blender', action='store_true',
help='If given, the blender installation is deleted and reinstalled. Is ignored, if '
'a "custom_blender_path" is configured in the configuration file.')
'a "custom-blender-path" is given.')
subparser.add_argument('--temp-dir', dest='temp_dir', default=None,
help="The path to a directory where all temporary output files should be stored. "
"If it doesn't exist, it is created automatically. Type: string. Default: "
Expand All @@ -117,12 +116,10 @@ def cli():
for subparser in [parser_run, parser_debug, parser_pip, parser_quickstart]:
subparser.add_argument('--blender-install-path', dest='blender_install_path', default=None,
help="Set path where blender should be installed. If None is given, "
"/home_local/<env:USER>/blender/ is used per default. This argument is ignored "
"if it is specified in the given YAML config.")
"/home_local/<env:USER>/blender/ is used per default.")
subparser.add_argument('--custom-blender-path', dest='custom_blender_path', default=None,
help="Set, if you want to use a custom blender installation to run BlenderProc. "
"If None is given, blender is installed into the configured blender_install_path. "
"This argument is ignored if it is specified in the given YAML config.")
"If None is given, blender is installed into the configured blender_install_path. ")

args, unknown_args = parser.parse_known_args()

Expand All @@ -133,18 +130,8 @@ def cli():
print(__version__)
elif args.mode in ["run", "debug", "quickstart"]:

if args.mode == 'quickstart':
is_config = False
else:
# Make sure a file is given
if args.file is None:
print(parser.format_help())
sys.exit(0)
# Check whether it's a python a script or a yaml config
is_config = not args.file.endswith(".py")

# Install blender, if not already done
determine_result = InstallUtility.determine_blender_install_path(is_config, args, unknown_args)
determine_result = InstallUtility.determine_blender_install_path(args, unknown_args)
custom_blender_path, blender_install_path = determine_result
blender_run_path, major_version = InstallUtility.make_sure_blender_is_installed(custom_blender_path,
blender_install_path,
Expand All @@ -155,11 +142,6 @@ def cli():
path_src_run = os.path.join(repo_root_directory, "blenderproc", "scripts", "quickstart.py")
args.file = path_src_run
print(f"'blenderproc quickstart' is an alias for 'blenderproc run {path_src_run}'")
elif is_config:
print("\033[33m" + "Warning: Running BlenderProc with config.yaml files is deprecated and will be removed "
"in future releases.\nPlease switch to the more intuitive Python API introduced in "
"BlenderProc 2.0. It's easy, you won't regret it." + "\033[0m")
path_src_run = os.path.join(repo_root_directory, "blenderproc", "run.py")
else:
path_src_run = args.file
SetupUtility.check_if_setup_utilities_are_at_the_top(path_src_run)
Expand All @@ -181,7 +163,7 @@ def cli():
# pylint: disable=consider-using-with
p = subprocess.Popen([blender_run_path, "--python-use-system-env", "--python-exit-code", "0", "--python",
os.path.join(repo_root_directory, "blenderproc/debug_startup.py"), "--",
path_src_run if not is_config else args.file, temp_dir] + unknown_args,
path_src_run, temp_dir] + unknown_args,
env=used_environment)
# pylint: enable=consider-using-with
else:
Expand Down Expand Up @@ -251,7 +233,7 @@ def handle_sigterm(_signum, _frame):
current_cli()
elif args.mode == "pip":
# Install blender, if not already done
custom_blender_path, blender_install_path = InstallUtility.determine_blender_install_path(False, args,
custom_blender_path, blender_install_path = InstallUtility.determine_blender_install_path(args,
unknown_args)
blender_bin, major_version = InstallUtility.make_sure_blender_is_installed(custom_blender_path,
blender_install_path)
Expand Down
40 changes: 0 additions & 40 deletions blenderproc/debug.py

This file was deleted.

21 changes: 2 additions & 19 deletions blenderproc/debug_startup.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,8 @@
bpy.context.window.workspace = bpy.data.workspaces["Scripting"]
bpy.context.view_layer.update()

# Load text to put into scripting tool
is_config = not argv[0].endswith(".py")
if is_config:
# Create a new temporary script based on debug.py
text = bpy.data.texts.new("debug")
with Path(__file__).with_name("debug.py").open("r", encoding="utf-8") as file:
script_text = file.read()
# Replace placeholders
script_text = script_text.replace("###CONFIG_PATH###", argv[0])
script_text = script_text.replace("[\"###CONFIG_ARGS###\"]", str(argv[2:]))
# Put into blender text object
text.from_string(script_text)
# Set cursor to the beginning
text.cursor_set(0)
# Set filepath such that it can be used inside debug.py, while not overwriting it
text.filepath = str(Path(__file__).with_name("debug_temp.py").absolute())
else:
# Just load python script into blender text object
text = bpy.data.texts.load(os.path.abspath(argv[0]))
# Just load python script into blender text object
text = bpy.data.texts.load(os.path.abspath(argv[0]))


# Declare operator that runs the blender proc script
Expand Down
2 changes: 1 addition & 1 deletion blenderproc/python/camera/LensDistortionUtility.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import bpy
from scipy.ndimage import map_coordinates

from blenderproc.python.modules.main.GlobalStorage import GlobalStorage
from blenderproc.python.utility.GlobalStorage import GlobalStorage
from blenderproc.python.camera import CameraUtility
from blenderproc.python.utility.MathUtility import change_source_coordinate_frame_of_transformation_matrix

Expand Down
2 changes: 1 addition & 1 deletion blenderproc/python/constructor/RandomRoomConstructor.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import mathutils
import numpy as np

from blenderproc.python.modules.provider.getter.Material import Material
from blenderproc.python.types.MaterialUtility import Material
from blenderproc.python.utility.CollisionUtility import CollisionUtility
from blenderproc.python.types.EntityUtility import delete_multiple
from blenderproc.python.types.MeshObjectUtility import MeshObject, create_primitive
Expand Down
2 changes: 1 addition & 1 deletion blenderproc/python/material/MaterialLoaderUtility.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import bpy

from blenderproc.python.modules.provider.getter.Material import Material as MaterialGetter
from blenderproc.python.utility.MaterialGetter import MaterialGetter
from blenderproc.python.types.MaterialUtility import Material
from blenderproc.python.utility.Utility import Utility

Expand Down
142 changes: 0 additions & 142 deletions blenderproc/python/modules/README.md

This file was deleted.

Loading

0 comments on commit 4e1c374

Please sign in to comment.