WIP: #104303: WM panel parent API #105193
No reviewers
Labels
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
3 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#105193
Loading…
Reference in New Issue
No description provided.
Delete Branch "Pratyaksh-Raj/blender:WM-Panel-API"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The function 'WM_paneltype_subpanel_add' adds a sub-panel to a parent panel in Blender's user interface.
The function takes three arguments: 'pt', 'parent', and 'use_order'. 'pt' is a pointer to the sub-panel to be added, 'parent' is a pointer to the parent panel, and 'use_order' is a boolean flag that determines whether the sub-panel should be added in a specific order.
The first thing the function does is set the 'parent' of the 'pt' sub-panel to the 'parent' panel passed as an argument.
If 'parent' is not NULL, the function checks if 'use_order' is true. If it is, the function iterates through the children of the 'parent' panel to find the correct position for the sub-panel based on its order property. If 'use_order' is false, the function simply adds the sub-panel to the end of the children list of the 'parent' panel.
The function then sets the 'owner_id' property of the 'pt' sub-panel to the current owner ID using the 'RNA_struct_state_owner_get' function.
Finally, the function adds the 'pt' sub-panel to the global 'paneltypes' list using the 'WM_paneltype_add' function.
'WM_paneltype_subpanel_add' function improve the usability and functionality of Blender's user interface, which can ultimately benefit both developers and users alike.
WIP: WM-PANEL-PARENT-APIto WIP: WM panel parent APIWIP: WM panel parent APIto WIP: #104303: WM panel parent APIThanks for the patch, it's already a great improvement.
However, please ensure your code builds, and do basic testing of it, before submitting a patch. There are at least to critical errors noted below that won't even allow it to build.
Also added a few notes about required changes (you put a bit too much into that new
WM_paneltype_subpanel_add
function ;) ).@ -213,3 +213,3 @@
panel_type->parent = parent;
BLI_addtail(&parent->children, BLI_genericNodeN(panel_type));
BLI_addtail(®ion_type->paneltypes, panel_type);
BLI_addtail(®ion_type->paneltypes, panel_type);*/
Please remove code, do not comment it out. It makes patch less readable, and we do not want to keep dead code around.
Same for other cases below.
@ -215,1 +215,3 @@
BLI_addtail(®ion_type->paneltypes, panel_type);
BLI_addtail(®ion_type->paneltypes, panel_type);*/
WM_paneltype_subpanel_add(parent, NULL, pt, true);
There are four parameters here, function only takes three of them...
Same for other cases below.
@ -46,6 +46,37 @@ bool WM_paneltype_add(PanelType *pt)
BLI_ghash_insert(g_paneltypes_hash, pt->idname, pt);
return true;
}
void WM_paneltype_subpanel_add(PanelType *pt, PanelType *parent, bool use_order)
Style: Please leave an empty line between function definitions.
@ -49,0 +65,4 @@
BLI_addtail(&parent->children, BLI_genericNodeN(pt));
}
BLI_addtail(&art->paneltypes, pt);
Wondering where
art
comes from here...? Missing parameter?@ -49,0 +73,4 @@
if (owner_id) {
BLI_strncpy(pt->owner_id, owner_id, sizeof(pt->owner_id));
}
}
That block about the
owner_id
does not belong to that function, it's specific to the RNA registration code and should be kept there.@ -49,0 +75,4 @@
}
}
WM_paneltype_add(pt);
This should also be left out of this function, since it is not relevant to parenting a panel to another one, and not all panels need to be registered globally at the WM level.
@ -1 +1 @@
Subproject commit e133fc08cd3254bb3d3bd1345028c8486700bca4
Subproject commit 27826b4aed138b7e3aed882d0eab96740c3a55c7
This should not be here, in fact this has been removed recently, you need to update your patch against latest
main
branch.Sir In my 2nd commit there is no such submodule. Updated my main branch. Now For removing this should I need to change my branch and then put another PR?
Yes just rebase on latest
main
branch, and force-push on your fork.Thank you very much for your valuable feedback, Sir. I appreciate your insights and will definitely take them into consideration as I work to improve.
Getting there, but still some issues to fix. Once again, please build and do test your changes before submitting the patch... The missing
BLI_addtail(®ion_type->paneltypes, panel_type);
lines and similar will not break compilation, but will definitely at least break the related UI areas.@ -212,4 +211,0 @@
BLI_strncpy(panel_type->parent_id, parent->idname, BKE_ST_MAXNAME);
panel_type->parent = parent;
BLI_addtail(&parent->children, BLI_genericNodeN(panel_type));
BLI_addtail(®ion_type->paneltypes, panel_type);
This line should not be removed, it's not handled by the call to
WM_paneltype_subpanel_add
.@ -213,3 +211,1 @@
panel_type->parent = parent;
BLI_addtail(&parent->children, BLI_genericNodeN(panel_type));
BLI_addtail(®ion_type->paneltypes, panel_type);
WM_paneltype_subpanel_add(parent,pt, true);
WM_paneltype_subpanel_add(parent, pt, false);
(you do not want to use order here).@ -685,3 +683,2 @@
BLI_addtail(&pt_properties->children, BLI_genericNodeN(pt));
WM_paneltype_subpanel_add(pt_properties, pt, true);
BLI_addtail(&art->paneltypes, pt);
No need to remove that line
@ -669,3 +668,3 @@
pt->flag = PANEL_TYPE_DEFAULT_CLOSED;
pt->poll = nla_strip_eval_panel_poll;
BLI_addtail(&pt_properties->children, BLI_genericNodeN(pt));
WM_paneltype_subpanel_add(pt_properties, pt, true);
WM_paneltype_subpanel_add(parent, pt, false);
(you do not want to use order here).@ -672,2 +670,3 @@
WM_paneltype_subpanel_add(pt_properties, pt, true);
BLI_addtail(&art->paneltypes, pt);
Remove extra spaces...
@ -683,3 +681,3 @@
pt->flag = PANEL_TYPE_DEFAULT_CLOSED;
pt->poll = nla_strip_eval_panel_poll;
BLI_addtail(&pt_properties->children, BLI_genericNodeN(pt));
WM_paneltype_subpanel_add(pt_properties, pt, true);
WM_paneltype_subpanel_add(parent, pt, false);
(you do not want to use order here).@ -395,4 +394,0 @@
BLI_strncpy(panel_type->parent_id, parent->idname, BKE_ST_MAXNAME);
panel_type->parent = parent;
BLI_addtail(&parent->children, BLI_genericNodeN(panel_type));
BLI_addtail(®ion_type->paneltypes, panel_type);
This line should not be removed, it's not handled by the call to
WM_paneltype_subpanel_add
.@ -396,3 +394,1 @@
panel_type->parent = parent;
BLI_addtail(&parent->children, BLI_genericNodeN(panel_type));
BLI_addtail(®ion_type->paneltypes, panel_type);
WM_paneltype_subpanel_add(parent, pt, true);
WM_paneltype_subpanel_add(parent, pt, false);
(you do not want to use order here).@ -413,1 +403,3 @@
WM_paneltype_add(pt);
WM_paneltype_add(pt);
No need for extra empty lines here.
@ -487,4 +486,0 @@
BLI_strncpy(panel_type->parent_id, parent->idname, BKE_ST_MAXNAME);
panel_type->parent = parent;
BLI_addtail(&parent->children, BLI_genericNodeN(panel_type));
BLI_addtail(®ion_type->paneltypes, panel_type);
This line should not be removed, it's not handled by the call to
WM_paneltype_subpanel_add
.@ -488,3 +486,1 @@
panel_type->parent = parent;
BLI_addtail(&parent->children, BLI_genericNodeN(panel_type));
BLI_addtail(®ion_type->paneltypes, panel_type);
WM_paneltype_subpanel_add(parent, pt, true);
WM_paneltype_subpanel_add(parent, pt, false);
(you do not want to use order here).@ -266,4 +265,0 @@
BLI_strncpy(panel_type->parent_id, parent->idname, BKE_ST_MAXNAME);
panel_type->parent = parent;
BLI_addtail(&parent->children, BLI_genericNodeN(panel_type));
BLI_addtail(®ion_type->paneltypes, panel_type);
This line should not be removed, it's not handled by the call to
WM_paneltype_subpanel_add
.@ -267,3 +265,1 @@
panel_type->parent = parent;
BLI_addtail(&parent->children, BLI_genericNodeN(panel_type));
BLI_addtail(®ion_type->paneltypes, panel_type);
WM_paneltype_subpanel_add(parent, pt, true);
WM_paneltype_subpanel_add(parent, pt, false);
(you do not want to use order here).Only blender organization members with write access can start builds. See documentation for details.
Thank You @mont29 sir for your guidance, here I have updated the change in my PR #105645. I have build and test this PR which work fine. I request you to to review.
Checkout
From your project repository, check out a new branch and test the changes.