Cleanup: UI: Icons shuffling around #127197

Merged
Dalai Felinto merged 2 commits from dfelinto/blender:icons-shuffle into main 2024-09-06 12:38:14 +02:00

No functional changes.

The comments in the file are used as categories by some of our ICON reading tools.

I split this PR in a few commits, so the alphabetical sorting doesn't add unecessary noise into the main change.

No functional changes. The comments in the file are used as categories by some of our ICON reading tools. I split this PR in a few commits, so the alphabetical sorting doesn't add unecessary noise into the main change.
Author
Owner

@blender-bot build

@blender-bot build
Dalai Felinto requested review from Harley Acheson 2024-09-05 17:27:43 +02:00
Dalai Felinto changed title from Cleanup: UI: Icons shuffling around to WIP: Cleanup: UI: Icons shuffling around 2024-09-05 17:50:38 +02:00
Author
Owner

For some mysterious reason, the order shuffling commit messes up with the record-on icon coloring, and adds an extra space there:
image

I'm investigating it, worst case I will skip the alphabetical sorting.

For some mysterious reason, the order shuffling commit messes up with the record-on icon coloring, and adds an extra space there: <img width="118" alt="image" src="attachments/5705b04b-ccfa-4866-a172-8bdede7d16af"> I'm investigating it, worst case I will skip the alphabetical sorting.
Dalai Felinto force-pushed icons-shuffle from e4c3cd7fd4 to cceb194b4e 2024-09-05 18:28:51 +02:00 Compare
Member

I'm not finding any issues with this new version with NONE first.

Did you end up being able to put that "record_on" where you wanted it to go? If not I can investigate why. AFAIK everything between ICON_NONE and LAST_SVG_ITEM should be able to move around like this as long as the toggle pairs are kept together.

This removes the cryptic comment "/* XXX fix this up */". Do you know what that was about?

I'm not finding any issues with this new version with NONE first. Did you end up being able to put that "record_on" where you wanted it to go? If not I can investigate why. AFAIK everything between ICON_NONE and LAST_SVG_ITEM should be able to move around like this as long as the toggle pairs are kept together. This removes the cryptic comment "/* XXX fix this up */". Do you know what that was about?
Dalai Felinto changed title from WIP: Cleanup: UI: Icons shuffling around to Cleanup: UI: Icons shuffling around 2024-09-05 19:02:50 +02:00
Author
Owner

Hi @Harley thanks for taking a look. I have no idea about the cryptic comment, but I assumed it will never be tackled, so this is a good moment to clean this up.

I just updated the patch and got everything working. The issue with NONE is that NONE has to be the first item apparently. It is documented now at least.

Hi @Harley thanks for taking a look. I have no idea about the cryptic comment, but I assumed it will never be tackled, so this is a good moment to clean this up. I just updated the patch and got everything working. The issue with NONE is that NONE has to be the first item apparently. It is documented now at least.
Member

Will load this up again in a sec, but I think this reverses the order of ICON_LOCK and ICON_UNLOCK. This could be done but would require code changes as well. Our toggles take the icon index of one and then there also a value indicating whether the other is before or after. And then we have a flag that reverses it.

Probably best to keep the same order and then another job could be to reorder those in some consistent order like OFF then ON. Yikes some could really use some renaming too, like that CHECKBOX_DEHLT and HLT

Will load this up again in a sec, but I think this reverses the order of ICON_LOCK and ICON_UNLOCK. This could be done but would require code changes as well. Our toggles take the icon index of one and then there also a value indicating whether the other is before or after. And then we have a flag that reverses it. Probably best to keep the same order and then another job could be to reorder those in some consistent order like OFF then ON. Yikes some could really use some renaming too, like that CHECKBOX_DEHLT and HLT
Author
Owner

This did not intend to change the order of any of the toggle icons which are currently being used as a toggle. Not sure how this affects add-ons ... I wonder if more icons would need to be moved to the toggle section.

One thing we could do if you are okay with it is to get the first two commits in first, and then we look over the alphabetical sorting later. Feel free to cherry-pick them into main if you want.

This did not intend to change the order of any of the toggle icons **which are currently being used as a toggle**. Not sure how this affects add-ons ... I wonder if more icons would need to be moved to the toggle section. One thing we could do if you are okay with it is to get the first two commits in first, and then we look over the alphabetical sorting later. Feel free to cherry-pick them into main if you want.
Member

This did not intend to change the order of any of the toggle icons which are currently being used as a toggle

This is the only pair that is reversed as far as I can see. In the majority of the cases of toggles we actually set both of them in a ternary, which makes no difference. And add-ons too always use enums, so not worried about them. It only becomes a problem when we do things like this: RNA_def_property_ui_icon(prop, ICON_UNLOCKED, 1); where the `1" means the next icon is +1 away.

I wonder if more icons would need to be moved to the toggle section.

There might be some but not sure if you want them with the others. Fake_user_off/on, holdout_off/on, modifier_off/on, restrict_color_off/on, restrict_instanced_off/on, line_numbers_off/on, syntax_off/on, wordwrap_off/on, mute_ipo_off/on, solo_off/on. But I can see the utility in having some or all of these within a different category.

I'm pretty sure that we had one or two pairs there were separated from each other (because there was no suitable space on the old sheet), but can't see them right now.

Feel free to cherry-pick them into main if you want.

Yes, I'll probably do a bit more checking and then will update this PR

> This did not intend to change the order of any of the toggle icons which are currently being used as a toggle This is the only pair that is reversed as far as I can see. In the majority of the cases of toggles we actually set both of them in a ternary, which makes no difference. And add-ons too always use enums, so not worried about them. It only becomes a problem when we do things like this: `RNA_def_property_ui_icon(prop, ICON_UNLOCKED, 1);` where the `1" means the next icon is +1 away. > I wonder if more icons would need to be moved to the toggle section. There might be some but not sure if you want them with the others. Fake_user_off/on, holdout_off/on, modifier_off/on, restrict_color_off/on, restrict_instanced_off/on, line_numbers_off/on, syntax_off/on, wordwrap_off/on, mute_ipo_off/on, solo_off/on. But I can see the utility in having some or all of these within a different category. I'm pretty sure that we had one or two pairs there were separated from each other (because there was no suitable space on the old sheet), but can't see them right now. > Feel free to cherry-pick them into main if you want. Yes, I'll probably do a bit more checking and then will update this PR
Member

I had to redo this from scratch because I couldn't figure out at what point it failed. We definitely have some code somewhere that is depending on one of these icons or, more likely, depending on the relative space between multiples. I'll eventually figure it out.

I had to redo this from scratch because I couldn't figure out at what point it failed. We definitely have some code somewhere that is depending on one of these icons or, more likely, depending on the relative space between multiples. I'll eventually figure it out.
Author
Owner

@blender-bot package

@blender-bot package
Member

Package build started. Download here when ready.

Package build started. [Download here](https://builder.blender.org/download/patch/PR127197) when ready.
Author
Owner

Hi Harley, thanks for looking into that.

I see that you did a few too many changes ... it would be easier if you had started off from the 2nd commit instead. Some of the changes I made with Pablo on the first two commits were completely lost now.

I'm about to update this patch with:

  • Revert your commit.
  • Revert my re-shulffing commit.
  • Move more things to the TOGGLE category based on your patch.

That said, one thing I didn't understand from your changes is why did you move the following to the "TOGGLE" category?
DEF_ICON(UNLINKED)
DEF_ICON(LINKED)
DEF_ICON(MODIFIER_OFF)
DEF_ICON(MODIFIER_ON)
DEF_ICON(RESTRICT_COLOR_OFF)
DEF_ICON(RESTRICT_COLOR_ON)
DEF_ICON(RESTRICT_INSTANCED_OFF)
DEF_ICON(RESTRICT_INSTANCED_ON)

None of them seem to be used by any RNA_def_property_ui_icon ... with consecutive being 1/true/-1.
I would suggest we move them back to their respective category.

I will do this as a separate commit, so we can still roll-back this easily.


The other change I'm bringing back is to make sure the category is a single comment before the values, leaving any further explanation as a separate comment. It makes much easier for the scripts to parse the categories this way.

Hi Harley, thanks for looking into that. I see that you did a few too many changes ... it would be easier if you had started off from the 2nd commit instead. Some of the changes I made with Pablo on the first two commits were completely lost now. I'm about to update this patch with: * Revert your commit. * Revert my re-shulffing commit. * Move more things to the TOGGLE category based on your patch. That said, one thing I didn't understand from your changes is why did you move the following to the "TOGGLE" category? DEF_ICON(UNLINKED) DEF_ICON(LINKED) DEF_ICON(MODIFIER_OFF) DEF_ICON(MODIFIER_ON) DEF_ICON(RESTRICT_COLOR_OFF) DEF_ICON(RESTRICT_COLOR_ON) DEF_ICON(RESTRICT_INSTANCED_OFF) DEF_ICON(RESTRICT_INSTANCED_ON) None of them seem to be used by any RNA_def_property_ui_icon ... with consecutive being 1/true/-1. I would suggest we move them back to their respective category. I will do this as a separate commit, so we can still roll-back this easily. --- The other change I'm bringing back is to make sure the category is a single comment before the values, leaving any further explanation as a separate comment. It makes much easier for the scripts to parse the categories this way.
Author
Owner

I noticed that DECORATE_UNLOCKED/DECORATE_LOCKED also needs to be treat as a toggle because of code like:

row.prop(pchan, "lock_location", text="", emboss=False, icon='DECORATE_UNLOCKED').

This preserves the toggability of the prop, but use a different reference icon :/ Man this code ... I start regretting touching it :)

I noticed that DECORATE_UNLOCKED/DECORATE_LOCKED also needs to be treat as a toggle because of code like: `row.prop(pchan, "lock_location", text="", emboss=False, icon='DECORATE_UNLOCKED')`. This preserves the toggability of the prop, but use a different reference icon :/ Man this code ... I start regretting touching it :)
Dalai Felinto force-pushed icons-shuffle from 4fc17a0917 to 4ec91724ba 2024-09-06 12:09:42 +02:00 Compare
Author
Owner

@Harley I moved the commits (with your changes) to dfelinto/blender:icons-shuffle-backup.

And did a cleanup (not including the toggles which I believe are not needed - see my comment earlier). So there are now only two commits here. I will ask for Julian to take a look, if he is ok with it I go ahead and commit, otherwise we talk later.

We can always revert/tweak things after they are in main.

@Harley I moved the commits (with your changes) to [dfelinto/blender:icons-shuffle-backup](https://projects.blender.org/dfelinto/blender/src/branch/icons-shuffle-backup). And did a cleanup (not including the toggles which I believe are not needed - see my comment earlier). So there are now only two commits here. I will ask for Julian to take a look, if he is ok with it I go ahead and commit, otherwise we talk later. We can always revert/tweak things after they are in main.
Author
Owner

@blender-bot package

@blender-bot package
Member

Package build started. Download here when ready.

Package build started. [Download here](https://builder.blender.org/download/patch/PR127197) when ready.
Member

Seems fine in general. This is changing icon values for scripts, but I'd hope that scripts don't use the raw values instead of the proper identifiers.

Reading the comments, I don't understand the current state, are there issues remaining or not?

Seems fine in general. This is changing icon values for scripts, but I'd hope that scripts don't use the raw values instead of the proper identifiers. Reading the comments, I don't understand the current state, are there issues remaining or not?
Author
Owner

@JulianEisel no issues as far as I'm concerned.

The current approach is moving less icons to the TOGGLE category than what Harley was suggesting. But I don't see the point/need of doing that.

So my suggestion is to commit the patch as it is, and eventually do the extra change if needed,

@JulianEisel no issues as far as I'm concerned. The current approach is moving less icons to the TOGGLE category than what Harley was suggesting. But I don't see the point/need of doing that. So my suggestion is to commit the patch as it is, and eventually do the extra change if needed,
Julian Eisel approved these changes 2024-09-06 12:34:36 +02:00
Dalai Felinto merged commit 60cc73afe6 into main 2024-09-06 12:38:14 +02:00
Dalai Felinto deleted branch icons-shuffle 2024-09-06 12:38:21 +02:00
Member

@dfelinto @pablovazquez @JulianEisel

That said, one thing I didn't understand from your changes is why did you move the following to the "TOGGLE" category...None of them seem to be used by any RNA_def_property_ui_icon ... with consecutive being 1/true/-1.

For the same reason. Any of those pairs could be used like that in the future and then a subsequent sorting could break them.

I see that you did a few too many changes ... it would be easier if you had started off from the 2nd commit instead. Some of the changes I made with Pablo on the first two commits were completely lost now.

Yes, sorry about that. I was (unsuccessfully) chasing a weird error. I'd like to explain it here just in case we see it again later...

The UI_icons.hh file as I first found it here had the order of ICON_LOCKED and ICON_UNLOCKED reversed. That seemed like a small problem and I just put them back in the original order. But that didn't fix it and it was very odd...

My test for this was the "transform lock" icons in the View3D sidebar. I had assumed the original issue was just that the icon pair was going in the wrong direction but that wasn't it. It was toggling between ICON_LOCKED and DECORATE_UNLOCKED, which at the time were very far away from each other while this RNA_def_property_ui_icon "iconadd" stuff should only work for immediate neighbors.

I started from scratch and made similar changes, sorted sections, and it broke in a similar way. Usually the result was this odd locked/decorate_unlocked and sometimes it would be locked/fund. About the only thing I knew before my night ended (each test iteration took a while) was that it was some portion of the sorting, but not which section. We probably have some code somewhere that is assuming a relationship between subsequent icons for some reason and perhaps getting weird if the difference is negative.

Anyway, the list as it is now in main does not show this problem.

@dfelinto @pablovazquez @JulianEisel > That said, one thing I didn't understand from your changes is why did you move the following to the "TOGGLE" category...None of them seem to be used by any RNA_def_property_ui_icon ... with consecutive being 1/true/-1. For the same reason. Any of those pairs could be used like that in the future and then a subsequent sorting could break them. > I see that you did a few too many changes ... it would be easier if you had started off from the 2nd commit instead. Some of the changes I made with Pablo on the first two commits were completely lost now. Yes, sorry about that. I was (unsuccessfully) chasing a weird error. I'd like to explain it here just in case we see it again later... The UI_icons.hh file as I first found it here had the order of ICON_LOCKED and ICON_UNLOCKED reversed. That seemed like a small problem and I just put them back in the original order. But that didn't fix it and it was very odd... My test for this was the "transform lock" icons in the View3D sidebar. I had assumed the original issue was just that the icon pair was going in the wrong direction but that wasn't it. It was toggling between ICON_LOCKED and DECORATE_UNLOCKED, which at the time were very far away from each other while this RNA_def_property_ui_icon "iconadd" stuff should only work for immediate neighbors. I started from scratch and made similar changes, sorted sections, and it broke in a similar way. Usually the result was this odd locked/decorate_unlocked and sometimes it would be locked/fund. About the only thing I knew before my night ended (each test iteration took a while) was that it was some portion of the sorting, but not which section. We probably have some code somewhere that is assuming a relationship between subsequent icons for some reason and perhaps getting weird if the difference is negative. Anyway, the list as it is **now** in main does not show this problem.
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset System
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
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
Viewport & EEVEE
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Asset Browser Project
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
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
Module
Viewport & EEVEE
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Severity
High
Severity
Low
Severity
Normal
Severity
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
4 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#127197
No description provided.