This commit cleanly splits IDProperties storage for its two very different usages: * "User-defined" data, also known as "custom properties". Mostly exposed in UI and as 'dictionary' in Python scripting, these are unique to each data (each object can have its own set of custom properties). * "System-defined" data, mainly as backend-storage for runtime RNA structures and properties. While these are not necessarily present in the storage, they are registered for a data type, and therefore always available to all data of that type through RNA access. See #123232 for rationales, designs and alternative investigated solutions. ## User-facing Changes When using Blender, the only noticeable change is that python-defined RNA data are not listed anymore in the Custom Properties panels (e.g. Cycles data). From a Python API perspective, the main changes are: * Runtime RNA structs defined by sub-classing `PropertyGroup` and registering them are no more accessible through the 'dict' syntax. * They remain accessible through a dedicated 'bl_system_properties_get()` callback, but its usages are only expected to be for testing and debugging. * The result of this call will be `None` by default when there has been nothing written into it yet, unless its optional `do_create` parameter is set to `True`. * Some types (like `Node`, `UIList`, etc.) cannot store raw IDProperties anymore (using the 'dict' syntax). ## Technical Details * Adds System idprops to some data types (IDs, ViewLayer...). * Moves some other containers (e.g operator properties, or some UI types like UILists) to only have system-defined properties. * For a few specific types (like `PropertyGroup`), the same storage is used, but exposed in RNA as both user and system properties. * Adds RNA API accessor callback to system idprops. * Adds a function `bl_system_properties_get()`, which wraps system-defined idprops and gives 'dict-like' access to them. Currently mainly used by some unittests. * System IDProps are always ignored by RNA diffing code (and therefore liboverride processing), as their value is already exposed through RNA properties, and should always be processed through these RNA properties. * Modifies bpy rna binding to use these new system idprops for property accesses, and keeps using user-defined idprops for 'dict-type' accesses. * Handles versioning by copying 'user idprops' (existing ones) into new 'system idprops'. ### IDProperties Split These types keep their historic IDProperty storage for user properties, and get a new `system_id_properties` storage for system properties: `ID`, `ViewLayers`, `Bone`, `EditBone`, `BoneCollection`, `PoseBone`, `Strip` These types can both be extended with registrable RNA properties, and expose Custom Properties in the UI. ### IDProperties become System Ones These types keep a single IDProperties storage (their DNA struct does not change), but it is now exclusively used for system-defined properties. `OperatorProperty`, `View3DShading`, `UIList`, `AddonPreferences`, `KeyConfigPreferences`, `GizmoProperties`, `GizmoGroupProperties`, `Node`, `NodeSocket`, `NodeTreeInterfaceSocket`, `TimelineMarker`, `AssetMetaData`` Since user properties were never available in the UI for them, they lose their 'dict-like' IDProperties access in the Python API. ### Single Storage, Exposed as Both in API These types still use a single IDProperty storage, but expose it both as user properties and as system ones through RNA API. * `PropertyGroup`: They need both access APIs since they are both used for raw IDProperty groups (the 'dict-like' access), and internally to access data of runtime-defined RNA structs. * `IDPropertyWrapPtr`: Done mainly to follow `PropertyGroup`. * `NodesModifier`: cannot become purely system idprops currently, as there is no other access than the 'raw ID properties' paths to their values. This can be changed once #132129 is finally implemented. Pull Request: https://projects.blender.org/blender/blender/pulls/135807
84 lines
2.2 KiB
C++
84 lines
2.2 KiB
C++
/* SPDX-FileCopyrightText: 2013 Blender Authors
|
|
*
|
|
* SPDX-License-Identifier: GPL-2.0-or-later */
|
|
|
|
/** \file
|
|
* \ingroup depsgraph
|
|
*/
|
|
|
|
#include "intern/builder/deg_builder_relations.h"
|
|
|
|
#include "DNA_scene_types.h"
|
|
|
|
#include "BLI_listbase.h"
|
|
|
|
namespace blender::deg {
|
|
|
|
void DepsgraphRelationBuilder::build_scene_render(Scene *scene, ViewLayer *view_layer)
|
|
{
|
|
scene_ = scene;
|
|
const bool build_compositor = (scene->r.scemode & R_DOCOMP);
|
|
const bool build_sequencer = (scene->r.scemode & R_DOSEQ);
|
|
build_scene_parameters(scene);
|
|
build_animdata(&scene->id);
|
|
build_scene_audio(scene);
|
|
if (build_compositor) {
|
|
build_scene_compositor(scene);
|
|
}
|
|
if (build_sequencer) {
|
|
build_scene_sequencer(scene);
|
|
build_scene_speakers(scene, view_layer);
|
|
}
|
|
if (scene->camera != nullptr) {
|
|
build_object(scene->camera);
|
|
}
|
|
}
|
|
|
|
void DepsgraphRelationBuilder::build_scene_camera(Scene *scene)
|
|
{
|
|
if (scene->camera != nullptr) {
|
|
build_object(scene->camera);
|
|
}
|
|
LISTBASE_FOREACH (TimeMarker *, marker, &scene->markers) {
|
|
if (!ELEM(marker->camera, nullptr, scene->camera)) {
|
|
build_object(marker->camera);
|
|
}
|
|
}
|
|
}
|
|
|
|
void DepsgraphRelationBuilder::build_scene_parameters(Scene *scene)
|
|
{
|
|
if (built_map_.check_is_built_and_tag(scene, BuilderMap::TAG_PARAMETERS)) {
|
|
return;
|
|
}
|
|
|
|
/* TODO(sergey): Trace as a scene parameters. */
|
|
|
|
build_idproperties(scene->id.properties);
|
|
build_idproperties(scene->id.system_properties);
|
|
build_parameters(&scene->id);
|
|
OperationKey parameters_eval_key(
|
|
&scene->id, NodeType::PARAMETERS, OperationCode::PARAMETERS_EXIT);
|
|
ComponentKey scene_eval_key(&scene->id, NodeType::SCENE);
|
|
add_relation(parameters_eval_key, scene_eval_key, "Parameters -> Scene Eval");
|
|
|
|
LISTBASE_FOREACH (TimeMarker *, marker, &scene->markers) {
|
|
build_idproperties(marker->prop);
|
|
}
|
|
}
|
|
|
|
void DepsgraphRelationBuilder::build_scene_compositor(Scene *scene)
|
|
{
|
|
if (built_map_.check_is_built_and_tag(scene, BuilderMap::TAG_SCENE_COMPOSITOR)) {
|
|
return;
|
|
}
|
|
if (scene->compositing_node_group == nullptr) {
|
|
return;
|
|
}
|
|
|
|
/* TODO(sergey): Trace as a scene compositor. */
|
|
build_nodetree(scene->compositing_node_group);
|
|
}
|
|
|
|
} // namespace blender::deg
|