Page MenuHome

Tobias Langen (Tobl)
User

Projects

User does not belong to any projects.

User Details

User Since
Tue, Nov 12, 2:54 PM (3 w, 4 d)

Recent Activity

Wed, Nov 27

Tobias Fuchsberger (Kronk) awarded D6234: Add a filter to the theme preferences a Love token.
Wed, Nov 27, 12:06 PM · BF Blender (2.82), User Interface

Wed, Nov 13

Fran Marz (franMarz) awarded D6234: Add a filter to the theme preferences a Love token.
Wed, Nov 13, 5:37 AM · BF Blender (2.82), User Interface

Tue, Nov 12

Tobias Langen (Tobl) added a comment to D6234: Add a filter to the theme preferences.

A filtering system like this would be very helpful, so +1 for the feature itself.
However - and I hate to be a party pooper here - I'm not really happy with this implementation.
An obvious issue is requiring each item to be checked by an if statement. This makes code hard to follow and maintain. The number of possible code execution paths, of which some may cause issues, increases enormously. But further, I'm fairly sure this will break in more complex cases: In more complex layouts, pulling out individual elements can mess up the layout quite badly. Without having checked details, I see you already had to do some tweaks to the layout in some cases, which confirms this suspicion. Even if it works now, it limits what we can do in future.
If we just wanted to remove the if statements, we could wrap the calls to add an item (e.g. uiLayout.prop()), so you would call something like USERPREF_theme_filter.add_prop(layout, ui, "foo_bar") instead. In there you could then perform the conditional check.
Such kind of bandage would improve things a little bit - and I'm not totally rejecting this approach. But I'd prefer something that scales better, and may be applicable to more cases.
So what I would like to see is basically a post-processing step in the C UI definition code: Once all items were added, we check them against the filter and only keep those visible that match. These can then be reinserted into a new, basic layout to avoid the rabbit hole of having to preserve all kinds of layouts. The same system could then be used allover the UI.
Again, I hate to be a party pooper :\ Your effort is appreciated regardless.
As a general note, you should't have to add RNA/DNA properties in cases like this. You should be able to do the same with custom properties.

Tue, Nov 12, 8:21 PM · BF Blender (2.82), User Interface
Hans Goudey (HooglyBoogly) awarded D6234: Add a filter to the theme preferences a Love token.
Tue, Nov 12, 7:07 PM · BF Blender (2.82), User Interface
Alessio Monti di Sopra (a.monti) awarded D6234: Add a filter to the theme preferences a Love token.
Tue, Nov 12, 5:19 PM · BF Blender (2.82), User Interface
Duarte Farrajota Ramos (duarteframos) awarded D6234: Add a filter to the theme preferences a Mountain of Wealth token.
Tue, Nov 12, 4:43 PM · BF Blender (2.82), User Interface
Tobias Langen (Tobl) created D6234: Add a filter to the theme preferences.
Tue, Nov 12, 3:54 PM · BF Blender (2.82), User Interface