Outliner: Port object elements to new tree-element code design #109162

Merged
Julian Eisel merged 9 commits from :temp-id-object-refactor into main 2023-06-22 15:04:58 +02:00
Contributor

No user visible changes expected.

Part of #96713, continuation of work started in 249e4df110 and 2e221de4ce.
Refer to these for a motivation and design overview.

Adds a new tree-element class for object IDs.

No user visible changes expected. Part of #96713, continuation of work started in 249e4df110 and 2e221de4ce. Refer to these for a motivation and design overview. Adds a new tree-element class for object IDs.
Almaz-Shinbay added 2 commits 2023-06-20 16:34:19 +02:00
Almaz-Shinbay requested review from Julian Eisel 2023-06-20 16:34:40 +02:00
Julian Eisel requested changes 2023-06-20 16:58:40 +02:00
Julian Eisel left a comment
Member

Quite a nice improvement, although I'd suggest some further cleanups in further patches:

  • Some of the includes that are now in tree_element_id_object.cc can probably be removed now from outliner_tree.cc. I just committed c8395e3bbc to remove some already unused includes.
  • The constraint expanding seems to be duplicated for object and channel constraints. Could this be de-duplicated?
  • Dead code (disabled with #if 0) can be removed.

This part in outliner_add_id_contents() can be moved to the object expand function as well:

/* tuck pointer back in object, to construct hierarchy */
  if (GS(id->name) == ID_OB) {
    id->newid = (ID *)te;
  }
Quite a nice improvement, although I'd suggest some further cleanups in further patches: - Some of the includes that are now in `tree_element_id_object.cc` can probably be removed now from `outliner_tree.cc`. I just committed c8395e3bbc to remove some already unused includes. - The constraint expanding seems to be duplicated for object and channel constraints. Could this be de-duplicated? - Dead code (disabled with `#if 0`) can be removed. This part in `outliner_add_id_contents()` can be moved to the object expand function as well: ```C /* tuck pointer back in object, to construct hierarchy */ if (GS(id->name) == ID_OB) { id->newid = (ID *)te; } ```
@ -0,0 +61,4 @@
void TreeElementIDObject::expandPose(SpaceOutliner &space_outliner) const
{
if (object_.pose) {
Member

Use early exit to make this more readable (reduces indentation level & cognitive complexity):

if (!object.pose) {
  return;
}
/* ... */
Use early exit to make this more readable (reduces indentation level & cognitive complexity): ``` if (!object.pose) { return; } /* ... */ ```
Almaz-Shinbay marked this conversation as resolved
@ -0,0 +152,4 @@
void TreeElementIDObject::expandConstraints(SpaceOutliner &space_outliner) const
{
if (!BLI_listbase_is_empty(&object_.constraints)) {
Member

Same here, use early exit.

Same here, use early exit.
Almaz-Shinbay marked this conversation as resolved
@ -0,0 +182,4 @@
void TreeElementIDObject::expandModifiers(SpaceOutliner &space_outliner) const
{
if (!BLI_listbase_is_empty(&object_.modifiers)) {
Member

Early exit.

Early exit.
Almaz-Shinbay marked this conversation as resolved
@ -0,0 +241,4 @@
void TreeElementIDObject::expandGPencilModifiers(SpaceOutliner &space_outliner) const
{
if (!BLI_listbase_is_empty(&object_.greasepencil_modifiers)) {
Member

Early exit.

Early exit.
Almaz-Shinbay marked this conversation as resolved
@ -0,0 +283,4 @@
void TreeElementIDObject::expandGPencilEffects(SpaceOutliner &space_outliner) const
{
if (!BLI_listbase_is_empty(&object_.shader_fx)) {
Member

Early exit.

Early exit.
Almaz-Shinbay marked this conversation as resolved
@ -0,0 +309,4 @@
void TreeElementIDObject::expandVertexGroups(SpaceOutliner &space_outliner) const
{
if (ELEM(object_.type, OB_MESH, OB_GPENCIL_LEGACY, OB_LATTICE)) {
Member

Early exit.

Early exit.
Almaz-Shinbay marked this conversation as resolved
@ -0,0 +311,4 @@
{
if (ELEM(object_.type, OB_MESH, OB_GPENCIL_LEGACY, OB_LATTICE)) {
const ListBase *defbase = BKE_object_defgroup_list(&object_);
if (!BLI_listbase_is_empty(defbase)) {
Member

This can also be turned into an early exit, simply return if defbase is empty.

This can also be turned into an early exit, simply return if `defbase` is empty.
Almaz-Shinbay marked this conversation as resolved
Almaz-Shinbay added 5 commits 2023-06-20 18:58:23 +02:00
Author
Contributor

To de-duplicate constraints expansion, will be it okay to change that function to expandConstraints(SpaceOutliner &space_outliner, TreeElement &legacy_te)?

To de-duplicate constraints expansion, will be it okay to change that function to `expandConstraints(SpaceOutliner &space_outliner, TreeElement &legacy_te)`?
Almaz-Shinbay added 1 commit 2023-06-20 19:10:05 +02:00
Julian Eisel approved these changes 2023-06-22 15:04:00 +02:00
Julian Eisel left a comment
Member

To de-duplicate constraints expansion, will be it okay to change that function to expandConstraints(SpaceOutliner &space_outliner, TreeElement &legacy_te)?

Seems fine, but can be done in a separate patch.

> To de-duplicate constraints expansion, will be it okay to change that function to `expandConstraints(SpaceOutliner &space_outliner, TreeElement &legacy_te)`? Seems fine, but can be done in a separate patch.
Julian Eisel added 1 commit 2023-06-22 15:04:38 +02:00
Julian Eisel merged commit 888cfd29c3 into main 2023-06-22 15:04:58 +02:00
Almaz-Shinbay deleted branch temp-id-object-refactor 2023-06-22 18:04:24 +02:00
Sign in to join this conversation.
No reviewers
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#109162
No description provided.