blender/scripts/startup/bl_operators/__init__.py
Nathan Vegdahl 563b073381 Core: Project Awareness and UI
Adds minimal projects to Blender. Part of #133001

The high-level additions in this PR are:

- A single global run-time Blender project, which can either exist or
  not depending on whether a project is currently loaded. A python API
  is provided for creating, clearing, and modifying this run-time project.

- An on-disk TOML serialization of projects. For a given project, this
  lives in `<project_root>/.blender_project/config.toml`.
  The `.blender_project` directory functions similarly to a `.git`
  directory: any files under the directory that it's in are considered
  part of that project.  When opening a file under a project, that
  project is automatically loaded.

- New `project_root` and `project_name` path template variables, which
  are available whenever there is a project.

- A new Project editor type, where the user can create/edit/manage projects.

The UI and UX follow the "MVP - Single Project" design in:
https://devtalk.blender.org/t/2025-11-25-project-setup-meeting/43475

The core Blender project data structures are defined in C++. Currently
they are quite minimal, and only accommodate a project name and root
path. This will be expanded in the future as more project features from
#133001 are added.

Loading/saving and the on-disk format of projects is defined entirely
in Python. This was partly to make development easier, but also for
dog-fooding to ensure that the APIs are reasonable: in the future we
hope to allow Python extensions to define other ways of loading/saving
projects, to accommodate a wider range of production environments.

Co-authored-by: Sebastian Parborg <sebastian@blender.org>
Pull Request: https://projects.blender.org/blender/blender/pulls/140924
2026-06-05 17:23:26 +02:00

92 lines
1.9 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",
"project",
"render",
"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()
project.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()
project.unregister()
for mod in reversed(_modules_loaded):
for cls in reversed(mod.classes):
if cls.is_registered:
unregister_class(cls)