Outliner: Port bone elements to new tree-element code design #109684

Merged
Julian Eisel merged 5 commits from :temp-bone-refactor into main 2023-07-06 18:44:05 +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 class for bone elements.

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 class for bone elements.
Almaz-Shinbay added 2 commits 2023-07-04 08:32:20 +02:00
Almaz-Shinbay requested review from Julian Eisel 2023-07-04 08:33:00 +02:00
Julian Eisel requested changes 2023-07-04 15:01:41 +02:00
Julian Eisel left a comment
Member

There's a bug here, noted inline.

There's a bug here, noted inline.
@ -103,2 +104,4 @@
return std::make_unique<TreeElementSequenceStripDuplicate>(legacy_te,
*static_cast<Sequence *>(idv));
case TSE_BONE:
return std::make_unique<TreeElementBone>(legacy_te, *static_cast<Bone *>(idv));
Member

In the outliner_add_element() call, the armature is passed as idv, but here you are casting it to a Bone *. This is a bug.

Since for now there's only one custom argument you can pass, you can create a wrapper struct like this:

struct BoneElementCreateData {
  ID *armature_id;
  Bone *bone;
};

The TreeElementBone constructor can take both a ID & and a Bone &.

In the `outliner_add_element()` call, the armature is passed as `idv`, but here you are casting it to a `Bone *`. This is a bug. Since for now there's only one custom argument you can pass, you can create a wrapper struct like this: ```Cpp struct BoneElementCreateData { ID *armature_id; Bone *bone; }; ``` The `TreeElementBone` constructor can take both a `ID &` and a `Bone &`.
Almaz-Shinbay marked this conversation as resolved
@ -89,4 +89,2 @@
te->name = curBone->name;
te->directdata = curBone;
LISTBASE_FOREACH (Bone *, child_bone, &curBone->childbase) {
Member

Any reason for not doing this in the expand function?

Any reason for not doing this in the expand function?
Author
Contributor

I didn't find a way how to pass the index, but now I have some idea in mind

I didn't find a way how to pass the index, but now I have some idea in mind
Author
Contributor

Do you have an idea how to do it?

Do you have an idea how to do it?
Member

Actually, it's not that important to move this to the expand() function, so you can leave it as is now. (I do see solutions for the index but it's not really worth it).

Actually, it's not that important to move this to the `expand()` function, so you can leave it as is now. (I do see solutions for the index but it's not really worth it).
Julian Eisel added the
Module
User Interface
label 2023-07-04 15:02:13 +02:00
Almaz-Shinbay added 2 commits 2023-07-05 09:42:31 +02:00
Author
Contributor

Is it better to include TSE_EBONE to this PR or create new PR for it?

Is it better to include `TSE_EBONE` to this PR or create new PR for it?
Julian Eisel reviewed 2023-07-06 18:29:15 +02:00
@ -240,2 +240,4 @@
id = nullptr;
}
else if (type == TSE_BONE) {
id = ((BoneElementCreateData *)idv)->armature_id;
Member

Use static_cast here.

Use `static_cast` here.
Almaz-Shinbay marked this conversation as resolved
Member

Is it better to include TSE_EBONE to this PR or create new PR for it?

Would keep them separate. Good practice to keep changes minimal.

> Is it better to include `TSE_EBONE` to this PR or create new PR for it? Would keep them separate. Good practice to keep changes minimal.
Almaz-Shinbay added 1 commit 2023-07-06 18:38:02 +02:00
Julian Eisel approved these changes 2023-07-06 18:43:23 +02:00
Julian Eisel merged commit af92de664b into main 2023-07-06 18:44:05 +02:00
Almaz-Shinbay deleted branch temp-bone-refactor 2023-07-06 18:47:00 +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#109684
No description provided.