From ac5a46166d1ebbc6d84aa0abae8977bbdba596ad Mon Sep 17 00:00:00 2001 From: Strike Digital <59890307+strike-digital@users.noreply.github.com> Date: Wed, 17 Jul 2024 09:56:02 +0100 Subject: [PATCH] Python-formatting (#167) * auto format python files with `black -l 120` * Removed unused imports from auto_load.py * Fix bare except statements * Remove unused import --- pythonFiles/generate_data.py | 6 ++- .../include/blender_vscode/__init__.py | 12 +++-- .../include/blender_vscode/communication.py | 41 +++++++++++----- .../include/blender_vscode/environment.py | 2 +- .../include/blender_vscode/installation.py | 26 +++++++--- .../include/blender_vscode/load_addons.py | 4 +- .../blender_vscode/operators/__init__.py | 1 + .../blender_vscode/operators/addon_update.py | 23 +++++---- .../blender_vscode/operators/script_runner.py | 16 ++++--- .../blender_vscode/operators/stop_blender.py | 4 +- pythonFiles/include/blender_vscode/ui.py | 16 +++---- pythonFiles/include/blender_vscode/utils.py | 11 ++++- .../templates/addons/simple/__init__.py | 24 +++++----- .../addons/with_auto_load/__init__.py | 18 +++---- .../addons/with_auto_load/auto_load.py | 48 ++++++++++++++----- pythonFiles/templates/operator_simple.py | 2 +- pythonFiles/templates/panel_simple.py | 6 +-- pythonFiles/templates/script.py | 2 +- 18 files changed, 169 insertions(+), 93 deletions(-) diff --git a/pythonFiles/generate_data.py b/pythonFiles/generate_data.py index 67c5e52..f9b9764 100644 --- a/pythonFiles/generate_data.py +++ b/pythonFiles/generate_data.py @@ -5,18 +5,22 @@ output_dir = Path(__file__).parent.parent / "generated" enums_output_path = output_dir / "enums.json" + def insert_enum_data(data, identifier): type_name, prop_name = identifier.split(".") enum_name = type_name.lower() + prop_name.title() + "Items" data[enum_name] = enum_prop_to_dict(type_name, prop_name) + def enum_prop_to_dict(type_name, prop_name): type = getattr(bpy.types, type_name) prop = type.bl_rna.properties[prop_name] return enum_items_to_dict(prop.enum_items) + def enum_items_to_dict(items): - return [{"identifier" : item.identifier, "name" : item.name, "description" : item.description} for item in items] + return [{"identifier": item.identifier, "name": item.name, "description": item.description} for item in items] + data = {} insert_enum_data(data, "Area.type") diff --git a/pythonFiles/include/blender_vscode/__init__.py b/pythonFiles/include/blender_vscode/__init__.py index 68c4e91..4a090aa 100644 --- a/pythonFiles/include/blender_vscode/__init__.py +++ b/pythonFiles/include/blender_vscode/__init__.py @@ -16,14 +16,15 @@ def startup(editor_address, addons_to_load: list[AddonInfo], allow_modify_extern handle_fatal_error("Please use a newer version of Blender") from . import installation - installation.ensure_packages_are_installed( - ["debugpy", "flask", "requests"], - allow_modify_external_python) + + installation.ensure_packages_are_installed(["debugpy", "flask", "requests"], allow_modify_external_python) from . import load_addons + path_mappings = load_addons.setup_addon_links(addons_to_load) from . import communication + communication.setup(editor_address, path_mappings) from . import operators, ui @@ -33,11 +34,12 @@ def startup(editor_address, addons_to_load: list[AddonInfo], allow_modify_extern load_addons.load(addons_to_load) + def handle_fatal_error(message): print() - print("#"*80) + print("#" * 80) for line in message.splitlines(): print("> ", line) - print("#"*80) + print("#" * 80) print() sys.exit(1) diff --git a/pythonFiles/include/blender_vscode/communication.py b/pythonFiles/include/blender_vscode/communication.py index 2ca9ca3..d740c94 100644 --- a/pythonFiles/include/blender_vscode/communication.py +++ b/pythonFiles/include/blender_vscode/communication.py @@ -1,4 +1,3 @@ -import bpy import time import flask import debugpy @@ -6,13 +5,14 @@ import requests import threading from functools import partial -from . utils import run_in_main_thread -from . environment import blender_path, scripts_folder +from .utils import run_in_main_thread +from .environment import blender_path, scripts_folder EDITOR_ADDRESS = None OWN_SERVER_PORT = None DEBUGPY_PORT = None + def setup(address, path_mappings): global EDITOR_ADDRESS, OWN_SERVER_PORT, DEBUGPY_PORT EDITOR_ADDRESS = address @@ -26,6 +26,7 @@ def setup(address, path_mappings): debugpy.wait_for_client() print("Debug client attached.") + def start_own_server(): port = [None] @@ -46,6 +47,7 @@ def server_thread_function(): return port[0] + def start_debug_server(): while True: port = get_random_port() @@ -56,13 +58,15 @@ def start_debug_server(): pass return port + # Server ######################################### server = flask.Flask("Blender Server") post_handlers = {} -@server.route("/", methods=['POST']) + +@server.route("/", methods=["POST"]) def handle_post(): data = flask.request.get_json() print("Got POST:", data) @@ -72,7 +76,8 @@ def handle_post(): return "OK" -@server.route("/", methods=['GET']) + +@server.route("/", methods=["GET"]) def handle_get(): flask.request data = flask.request.get_json() @@ -87,25 +92,31 @@ def register_post_handler(type, handler): assert type not in post_handlers post_handlers[type] = handler + def register_post_action(type, handler): def request_handler_wrapper(data): run_in_main_thread(partial(handler, data)) return "OK" + register_post_handler(type, request_handler_wrapper) # Sending Data ############################### + def send_connection_information(path_mappings): - send_dict_as_json({ - "type" : "setup", - "blenderPort" : OWN_SERVER_PORT, - "debugpyPort" : DEBUGPY_PORT, - "blenderPath" : str(blender_path), - "scriptsFolder" : str(scripts_folder), - "addonPathMappings" : path_mappings - }) + send_dict_as_json( + { + "type": "setup", + "blenderPort": OWN_SERVER_PORT, + "debugpyPort": DEBUGPY_PORT, + "blenderPath": str(blender_path), + "scriptsFolder": str(scripts_folder), + "addonPathMappings": path_mappings, + } + ) + def send_dict_as_json(data): print("Sending:", data) @@ -115,14 +126,18 @@ def send_dict_as_json(data): # Utils ############################### + def get_random_port(): return random.randint(2000, 10000) + def get_blender_port(): return OWN_SERVER_PORT + def get_debugpy_port(): return DEBUGPY_PORT + def get_editor_address(): return EDITOR_ADDRESS diff --git a/pythonFiles/include/blender_vscode/environment.py b/pythonFiles/include/blender_vscode/environment.py index 692f0a3..d089484 100644 --- a/pythonFiles/include/blender_vscode/environment.py +++ b/pythonFiles/include/blender_vscode/environment.py @@ -9,7 +9,7 @@ blender_directory = blender_path.parent # Test for MacOS app bundles -if platform.system()=='Darwin': +if platform.system() == "Darwin": use_own_python = blender_directory.parent in python_path.parents else: use_own_python = blender_directory in python_path.parents diff --git a/pythonFiles/include/blender_vscode/installation.py b/pythonFiles/include/blender_vscode/installation.py index b6a14c7..ceffee4 100644 --- a/pythonFiles/include/blender_vscode/installation.py +++ b/pythonFiles/include/blender_vscode/installation.py @@ -4,10 +4,11 @@ import subprocess from pathlib import Path from . import handle_fatal_error -from . environment import python_path, use_own_python +from .environment import python_path, use_own_python cwd_for_subprocesses = python_path.parent + def ensure_packages_are_installed(package_names, allow_modify_external_python): if packages_are_installed(package_names): return @@ -17,9 +18,11 @@ def ensure_packages_are_installed(package_names, allow_modify_external_python): install_packages(package_names) + def packages_are_installed(package_names): return all(module_can_be_imported(name) for name in package_names) + def install_packages(package_names): if not module_can_be_imported("pip"): install_pip() @@ -29,26 +32,30 @@ def install_packages(package_names): assert packages_are_installed(package_names) + def ensure_package_is_installed(name): if not module_can_be_imported(name): install_package(name) + def install_package(name): target = get_package_install_directory() - subprocess.run([str(python_path), "-m", "pip", "install", name, '--target', target], cwd=cwd_for_subprocesses) + subprocess.run([str(python_path), "-m", "pip", "install", name, "--target", target], cwd=cwd_for_subprocesses) if not module_can_be_imported(name): handle_fatal_error(f"could not install {name}") + def install_pip(): # try ensurepip before get-pip.py - if module_can_be_imported('ensurepip'): - subprocess.run([str(python_path), '-m', 'ensurepip', '--upgrade'], cwd=cwd_for_subprocesses) + if module_can_be_imported("ensurepip"): + subprocess.run([str(python_path), "-m", "ensurepip", "--upgrade"], cwd=cwd_for_subprocesses) return # pip can not necessarily be imported into Blender after this get_pip_path = Path(__file__).parent / "external" / "get-pip.py" subprocess.run([str(python_path), str(get_pip_path)], cwd=cwd_for_subprocesses) + def get_package_install_directory(): for path in sys.path: if os.path.basename(path) in ("dist-packages", "site-packages"): @@ -56,6 +63,7 @@ def get_package_install_directory(): handle_fatal_error("Don't know where to install packages. Please make a bug report.") + def module_can_be_imported(name): try: __import__(name) @@ -63,13 +71,17 @@ def module_can_be_imported(name): except ModuleNotFoundError: return False + def handle_cannot_install_packages(package_names): - handle_fatal_error(textwrap.dedent(f'''\ + handle_fatal_error( + textwrap.dedent( + f"""\ Installing packages in Python distributions, that don't come with Blender, is not allowed currently. Please enable 'blender.allowModifyExternalPython' in VS Code or install those packages yourself: {str(package_names):53}\ - ''')) - + """ + ) + ) diff --git a/pythonFiles/include/blender_vscode/load_addons.py b/pythonFiles/include/blender_vscode/load_addons.py index f802092..3c06235 100644 --- a/pythonFiles/include/blender_vscode/load_addons.py +++ b/pythonFiles/include/blender_vscode/load_addons.py @@ -55,7 +55,7 @@ def load(addons_to_load: list[AddonInfo]): try: bpy.ops.preferences.addon_enable(module=addon_name) - except: + except Exception: traceback.print_exc() send_dict_as_json({"type": "enableFailure", "addonPath": str(addon_info.load_dir)}) @@ -66,10 +66,12 @@ def create_link_in_user_addon_directory(directory, link_path): if sys.platform == "win32": import _winapi + _winapi.CreateJunction(str(directory), str(link_path)) else: os.symlink(str(directory), str(link_path), target_is_directory=True) + def is_in_any_addon_directory(module_path): for path in addon_directories: if path == module_path.parent: diff --git a/pythonFiles/include/blender_vscode/operators/__init__.py b/pythonFiles/include/blender_vscode/operators/__init__.py index b4dddfb..b5cf74b 100644 --- a/pythonFiles/include/blender_vscode/operators/__init__.py +++ b/pythonFiles/include/blender_vscode/operators/__init__.py @@ -8,6 +8,7 @@ stop_blender, ) + def register(): for module in modules: module.register() diff --git a/pythonFiles/include/blender_vscode/operators/addon_update.py b/pythonFiles/include/blender_vscode/operators/addon_update.py index 83b1298..68567b4 100644 --- a/pythonFiles/include/blender_vscode/operators/addon_update.py +++ b/pythonFiles/include/blender_vscode/operators/addon_update.py @@ -3,8 +3,9 @@ import sys import traceback from bpy.props import * -from .. utils import is_addon_legacy, redraw_all -from .. communication import send_dict_as_json, register_post_action +from ..utils import is_addon_legacy, redraw_all +from ..communication import send_dict_as_json, register_post_action + class UpdateAddonOperator(bpy.types.Operator): bl_idname = "dev.update_addon" @@ -15,10 +16,10 @@ class UpdateAddonOperator(bpy.types.Operator): def execute(self, context): try: bpy.ops.preferences.addon_disable(module=self.module_name) - except: + except Exception: traceback.print_exc() - send_dict_as_json({"type" : "disableFailure"}) - return {'CANCELLED'} + send_dict_as_json({"type": "disableFailure"}) + return {"CANCELLED"} for name in list(sys.modules.keys()): if name.startswith(self.module_name): @@ -26,15 +27,16 @@ def execute(self, context): try: bpy.ops.preferences.addon_enable(module=self.module_name) - except: + except Exception: traceback.print_exc() - send_dict_as_json({"type" : "enableFailure"}) - return {'CANCELLED'} + send_dict_as_json({"type": "enableFailure"}) + return {"CANCELLED"} - send_dict_as_json({"type" : "addonUpdated"}) + send_dict_as_json({"type": "addonUpdated"}) redraw_all() - return {'FINISHED'} + return {"FINISHED"} + def reload_addon_action(data): module_names = [] @@ -47,6 +49,7 @@ def reload_addon_action(data): for name in module_names: bpy.ops.dev.update_addon(module_name=name) + def register(): bpy.utils.register_class(UpdateAddonOperator) register_post_action("reload", reload_addon_action) diff --git a/pythonFiles/include/blender_vscode/operators/script_runner.py b/pythonFiles/include/blender_vscode/operators/script_runner.py index 5cc584c..755e36c 100644 --- a/pythonFiles/include/blender_vscode/operators/script_runner.py +++ b/pythonFiles/include/blender_vscode/operators/script_runner.py @@ -2,8 +2,9 @@ import bpy import runpy from bpy.props import * -from .. utils import redraw_all -from .. communication import register_post_action +from ..utils import redraw_all +from ..communication import register_post_action + class RunScriptOperator(bpy.types.Operator): bl_idname = "dev.run_script" @@ -13,9 +14,9 @@ class RunScriptOperator(bpy.types.Operator): def execute(self, context): ctx = prepare_script_context(self.filepath) - runpy.run_path(self.filepath, init_globals={"CTX" : ctx}) + runpy.run_path(self.filepath, init_globals={"CTX": ctx}) redraw_all() - return {'FINISHED'} + return {"FINISHED"} def run_script_action(data): @@ -34,8 +35,8 @@ def prepare_script_context(filepath): with open(filepath) as fs: text = fs.read() - area_type = 'VIEW_3D' - region_type = 'WINDOW' + area_type = "VIEW_3D" + region_type = "WINDOW" for line in text.splitlines(): match = re.match(r"^\s*#\s*context\.area\s*:\s*(\w+)", line, re.IGNORECASE) @@ -53,18 +54,21 @@ def prepare_script_context(filepath): context["region"] = get_region_in_area(context["area"], region_type) if context["area"] else None return context + def get_area_by_type(area_type): for area in bpy.data.window_managers[0].windows[0].screen.areas: if area.type == area_type: return area return None + def get_region_in_area(area, region_type): for region in area.regions: if region.type == region_type: return region return None + def register(): bpy.utils.register_class(RunScriptOperator) register_post_action("script", run_script_action) diff --git a/pythonFiles/include/blender_vscode/operators/stop_blender.py b/pythonFiles/include/blender_vscode/operators/stop_blender.py index b1f84bb..5715448 100644 --- a/pythonFiles/include/blender_vscode/operators/stop_blender.py +++ b/pythonFiles/include/blender_vscode/operators/stop_blender.py @@ -1,8 +1,10 @@ import bpy -from .. communication import register_post_action +from ..communication import register_post_action + def stop_action(data): bpy.ops.wm.quit_blender() + def register(): register_post_action("stop", stop_action) diff --git a/pythonFiles/include/blender_vscode/ui.py b/pythonFiles/include/blender_vscode/ui.py index d082d78..e57f1f0 100644 --- a/pythonFiles/include/blender_vscode/ui.py +++ b/pythonFiles/include/blender_vscode/ui.py @@ -1,15 +1,12 @@ import bpy -from . communication import ( - get_blender_port, - get_debugpy_port, - get_editor_address -) +from .communication import get_blender_port, get_debugpy_port, get_editor_address + class DevelopmentPanel(bpy.types.Panel): bl_idname = "DEV_PT_panel" bl_label = "Development" - bl_space_type = 'VIEW_3D' - bl_region_type = 'UI' + bl_space_type = "VIEW_3D" + bl_region_type = "UI" bl_category = "Dev" def draw(self, context): @@ -19,9 +16,8 @@ def draw(self, context): layout.label(text=f"Editor at Address {get_editor_address()}") -classes = ( - DevelopmentPanel, -) +classes = (DevelopmentPanel,) + def register(): for cls in classes: diff --git a/pythonFiles/include/blender_vscode/utils.py b/pythonFiles/include/blender_vscode/utils.py index d6a4f05..cf7a71a 100644 --- a/pythonFiles/include/blender_vscode/utils.py +++ b/pythonFiles/include/blender_vscode/utils.py @@ -3,6 +3,7 @@ import queue import traceback + def is_addon_legacy(addon_dir: Path): """Return whether an addon uses the legacy bl_info behavior, or the new blender_manifest behavior""" if bpy.app.version < (4, 2, 0): @@ -11,26 +12,32 @@ def is_addon_legacy(addon_dir: Path): return True return False + def redraw_all(): for window in bpy.context.window_manager.windows: for area in window.screen.areas: area.tag_redraw() + def get_prefixes(all_names, separator): return set(name.split(separator)[0] for name in all_names if separator in name) execution_queue = queue.Queue() + def run_in_main_thread(func): execution_queue.put(func) + def always(): while not execution_queue.empty(): func = execution_queue.get() - try: func() - except: + try: + func() + except Exception: traceback.print_exc() return 0.1 + bpy.app.timers.register(always, persistent=True) diff --git a/pythonFiles/templates/addons/simple/__init__.py b/pythonFiles/templates/addons/simple/__init__.py index 0bf2a0c..c66e57b 100644 --- a/pythonFiles/templates/addons/simple/__init__.py +++ b/pythonFiles/templates/addons/simple/__init__.py @@ -12,18 +12,18 @@ # along with this program. If not, see . bl_info = { - "name" : "ADDON_NAME", - "author" : "AUTHOR_NAME", - "description" : "", - "blender" : (2, 80, 0), - "version" : (0, 0, 1), - "location" : "", - "warning" : "", - "category" : "Generic" + "name": "ADDON_NAME", + "author": "AUTHOR_NAME", + "description": "", + "blender": (2, 80, 0), + "version": (0, 0, 1), + "location": "", + "warning": "", + "category": "Generic", } -def register(): - ... -def unregister(): - ... +def register(): ... + + +def unregister(): ... diff --git a/pythonFiles/templates/addons/with_auto_load/__init__.py b/pythonFiles/templates/addons/with_auto_load/__init__.py index 7a2f96a..c1abb7c 100644 --- a/pythonFiles/templates/addons/with_auto_load/__init__.py +++ b/pythonFiles/templates/addons/with_auto_load/__init__.py @@ -12,22 +12,24 @@ # along with this program. If not, see . bl_info = { - "name" : "ADDON_NAME", - "author" : "AUTHOR_NAME", - "description" : "", - "blender" : (2, 80, 0), - "version" : (0, 0, 1), - "location" : "", - "warning" : "", - "category" : "Generic" + "name": "ADDON_NAME", + "author": "AUTHOR_NAME", + "description": "", + "blender": (2, 80, 0), + "version": (0, 0, 1), + "location": "", + "warning": "", + "category": "Generic", } from . import auto_load auto_load.init() + def register(): auto_load.register() + def unregister(): auto_load.unregister() diff --git a/pythonFiles/templates/addons/with_auto_load/auto_load.py b/pythonFiles/templates/addons/with_auto_load/auto_load.py index b784530..21f2fcf 100644 --- a/pythonFiles/templates/addons/with_auto_load/auto_load.py +++ b/pythonFiles/templates/addons/with_auto_load/auto_load.py @@ -1,6 +1,4 @@ -import os import bpy -import sys import typing import inspect import pkgutil @@ -18,6 +16,7 @@ modules = None ordered_classes = None + def init(): global modules global ordered_classes @@ -25,6 +24,7 @@ def init(): modules = get_all_submodules(Path(__file__).parent) ordered_classes = get_ordered_classes_to_register(modules) + def register(): for cls in ordered_classes: bpy.utils.register_class(cls) @@ -35,6 +35,7 @@ def register(): if hasattr(module, "register"): module.register() + def unregister(): for cls in reversed(ordered_classes): bpy.utils.unregister_class(cls) @@ -49,13 +50,16 @@ def unregister(): # Import modules ################################################# + def get_all_submodules(directory): return list(iter_submodules(directory, __package__)) + def iter_submodules(path, package_name): for name in sorted(iter_submodule_names(path)): yield importlib.import_module("." + name, package_name) + def iter_submodule_names(path, root=""): for _, module_name, is_package in pkgutil.iter_modules([str(path)]): if is_package: @@ -69,22 +73,26 @@ def iter_submodule_names(path, root=""): # Find classes to register ################################################# + def get_ordered_classes_to_register(modules): return toposort(get_register_deps_dict(modules)) + def get_register_deps_dict(modules): my_classes = set(iter_my_classes(modules)) - my_classes_by_idname = {cls.bl_idname : cls for cls in my_classes if hasattr(cls, "bl_idname")} + my_classes_by_idname = {cls.bl_idname: cls for cls in my_classes if hasattr(cls, "bl_idname")} deps_dict = {} for cls in my_classes: deps_dict[cls] = set(iter_my_register_deps(cls, my_classes, my_classes_by_idname)) return deps_dict + def iter_my_register_deps(cls, my_classes, my_classes_by_idname): yield from iter_my_deps_from_annotations(cls, my_classes) yield from iter_my_deps_from_parent_id(cls, my_classes_by_idname) + def iter_my_deps_from_annotations(cls, my_classes): for value in typing.get_type_hints(cls, {}, {}).values(): dependency = get_dependency_from_annotation(value) @@ -92,6 +100,7 @@ def iter_my_deps_from_annotations(cls, my_classes): if dependency in my_classes: yield dependency + def get_dependency_from_annotation(value): if blender_version >= (2, 93): if isinstance(value, bpy.props._PropertyDeferred): @@ -102,6 +111,7 @@ def get_dependency_from_annotation(value): return value[1]["type"] return None + def iter_my_deps_from_parent_id(cls, my_classes_by_idname): if issubclass(cls, bpy.types.Panel): parent_idname = getattr(cls, "bl_parent_id", None) @@ -110,6 +120,7 @@ def iter_my_deps_from_parent_id(cls, my_classes_by_idname): if parent_cls is not None: yield parent_cls + def iter_my_classes(modules): base_types = get_register_base_types() for cls in get_classes_in_modules(modules): @@ -117,6 +128,7 @@ def iter_my_classes(modules): if not getattr(cls, "is_registered", False): yield cls + def get_classes_in_modules(modules): classes = set() for module in modules: @@ -124,24 +136,38 @@ def get_classes_in_modules(modules): classes.add(cls) return classes + def iter_classes_in_module(module): for value in module.__dict__.values(): if inspect.isclass(value): yield value + def get_register_base_types(): - return set(getattr(bpy.types, name) for name in [ - "Panel", "Operator", "PropertyGroup", - "AddonPreferences", "Header", "Menu", - "Node", "NodeSocket", "NodeTree", - "UIList", "RenderEngine", - "Gizmo", "GizmoGroup", - ]) + return set( + getattr(bpy.types, name) + for name in [ + "Panel", + "Operator", + "PropertyGroup", + "AddonPreferences", + "Header", + "Menu", + "Node", + "NodeSocket", + "NodeTree", + "UIList", + "RenderEngine", + "Gizmo", + "GizmoGroup", + ] + ) # Find order to register to solve dependencies ################################################# + def toposort(deps_dict): sorted_list = [] sorted_values = set() @@ -153,5 +179,5 @@ def toposort(deps_dict): sorted_values.add(value) else: unsorted.append(value) - deps_dict = {value : deps_dict[value] - sorted_values for value in unsorted} + deps_dict = {value: deps_dict[value] - sorted_values for value in unsorted} return sorted_list diff --git a/pythonFiles/templates/operator_simple.py b/pythonFiles/templates/operator_simple.py index 2d60a9c..dae84ef 100644 --- a/pythonFiles/templates/operator_simple.py +++ b/pythonFiles/templates/operator_simple.py @@ -3,4 +3,4 @@ class CLASS_NAME(OPERATOR_CLASS): bl_label = "LABEL" def execute(self, context): - return {'FINISHED'} \ No newline at end of file + return {"FINISHED"} diff --git a/pythonFiles/templates/panel_simple.py b/pythonFiles/templates/panel_simple.py index 237c8e1..c9c6949 100644 --- a/pythonFiles/templates/panel_simple.py +++ b/pythonFiles/templates/panel_simple.py @@ -1,8 +1,8 @@ class CLASS_NAME(PANEL_CLASS): bl_idname = "IDNAME" bl_label = "LABEL" - bl_space_type = 'SPACE_TYPE' - bl_region_type = 'REGION_TYPE' + bl_space_type = "SPACE_TYPE" + bl_region_type = "REGION_TYPE" def draw(self, context): - layout = self.layout \ No newline at end of file + layout = self.layout diff --git a/pythonFiles/templates/script.py b/pythonFiles/templates/script.py index a4c23ba..45e3cd9 100644 --- a/pythonFiles/templates/script.py +++ b/pythonFiles/templates/script.py @@ -1,5 +1,5 @@ import bpy from mathutils import * + D = bpy.data C = bpy.context -