Move the Copy Global Transform core add-on into Blender's code. - The entire extension was one Python file. This PR basically splits it into two, one for operators (in `bl_operators`) and the other for UI panels. Those panels are registered in the 3D viewport's sidebar, which were registered in `space_view3d`, but I made the decision here to create a new file `space_view3d_sidebar`, because the main file is getting too large and difficult to navigate. This PR puts the global transform panel in this file. After this is merged, I will do refactors to move the rest of the sidebar panels here as well. - `AutoKeying` class was moved into `bpy_extras/anim_utils.py` so that it's reusable and also accessible from API, since it's generally very useful. There were discussions about putting this somewhere, but for now, I chose against it because creating a new file would also mean PR would have to affect documentation generation, and would complicate things. If we want to, we can probably create a new module in the future. - Little tweaks to labels and descriptions. Now that they exist outside of the add-on context, and exist without the user explicitly enabling them, they need to be more descriptive and tell users what they actually do. They also need to conform to Blender's GUI guidelines. Also tried organizing files a little by grouping objects. - Add-on properties (which included word `addon` in the name) have been registered in C++, on `scene.tool_settings` with `anim_` prefix. Pull Request: https://projects.blender.org/blender/blender/pulls/145414
89 lines
1.8 KiB
Python
89 lines
1.8 KiB
Python
# SPDX-FileCopyrightText: 2009-2023 Blender Authors
|
|
#
|
|
# SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
from __future__ import annotations
|
|
|
|
# support reloading sub-modules
|
|
if "bpy" in locals():
|
|
from importlib import reload
|
|
_modules_loaded[:] = [reload(val) for val in _modules_loaded]
|
|
del reload
|
|
|
|
_modules = [
|
|
"add_mesh_torus",
|
|
"anim",
|
|
"assets",
|
|
"bone_selection_sets",
|
|
"clip",
|
|
"connect_to_output",
|
|
"console",
|
|
"constraint",
|
|
"copy_global_transform",
|
|
"file",
|
|
"geometry_nodes",
|
|
"grease_pencil",
|
|
"image",
|
|
"image_as_planes",
|
|
"mesh",
|
|
"node",
|
|
"object",
|
|
"object_align",
|
|
"object_quick_effects",
|
|
"object_randomize_transform",
|
|
"presets",
|
|
"rigidbody",
|
|
"screen_play_rendered_anim",
|
|
"sequencer",
|
|
"spreadsheet",
|
|
"userpref",
|
|
"uvcalc_follow_active",
|
|
"uvcalc_lightmap",
|
|
"uvcalc_transform",
|
|
"vertexpaint_dirt",
|
|
"view3d",
|
|
"world",
|
|
"wm",
|
|
]
|
|
|
|
import bpy
|
|
|
|
if bpy.app.build_options.freestyle:
|
|
_modules.append("freestyle")
|
|
|
|
__import__(name=__name__, fromlist=_modules)
|
|
_namespace = globals()
|
|
_modules_loaded = [_namespace[name] for name in _modules]
|
|
del _namespace
|
|
|
|
|
|
def register():
|
|
from bpy.utils import register_class
|
|
from . import (
|
|
bone_selection_sets,
|
|
copy_global_transform,
|
|
)
|
|
|
|
for mod in _modules_loaded:
|
|
for cls in mod.classes:
|
|
register_class(cls)
|
|
|
|
bone_selection_sets.register()
|
|
copy_global_transform.register()
|
|
|
|
|
|
def unregister():
|
|
from bpy.utils import unregister_class
|
|
from . import (
|
|
bone_selection_sets,
|
|
copy_global_transform,
|
|
)
|
|
|
|
bone_selection_sets.unregister()
|
|
copy_global_transform.unregister()
|
|
|
|
for mod in reversed(_modules_loaded):
|
|
for cls in reversed(mod.classes):
|
|
if cls.is_registered:
|
|
unregister_class(cls)
|