[Bf-committers] Some changes in 3D view header (and general RNA-generated UI)

Bastien Montagne montagne29 at wanadoo.fr
Sun May 12 11:18:06 CEST 2013


Hi Brecht, thanks for the review! :)

Updated patch ( http://www.pasteall.org/42162/diff ) addresses following 
points:
* Object mode menu is now longer when the "mode name" is too short 
(using a cheap trick)... But do we really want that? It takes some room 
in the header, on small screens it’s not optimal imho.
* Transform space is solved by adapting Enum menus' width to the longest 
string of the enum, instead of using a dummy placeholder text when 
computing width. This should benefits to other similar UI items too, 
especially when translated.
* EnumPropertyItem manipulators_items[] values' identifiers have been 
cleaned up.

Regarding the PROP_ENUM_NO_CONTEXT stuff, yes, it was giving me a 
(strange) issue with mode selector, where on startup the enum itemf func 
was getting a NULL context from rna access code (and hence returning all 
items), as this flag was enabled... :/

Yet I agree that "quick fix" was not a good idea, investigating a bit 
more I found another way to solve this (by calling 
WM_operator_properties_sanitize() in uiItemsFullEnumO(), which imho 
makes sense). I still wonder a bit why this PROP_ENUM_NO_CONTEXT is set 
on startup, though...

Bastien

On 11/05/2013 21:01, Brecht Van Lommel wrote:
> Some comments:
> * The object mode menu is too narrow now, the tranform space menu too wide.
> * EnumPropertyItem manipulators_items[] values should not have
> MANIPULATOR_ prefix for the item identifiers.
> * Regarding PROP_ENUM_NO_CONTEXT in rna_access.c. This is to ensure
> the callback always gets the same NULL pointer, to avoid subtle bugs
> due to things working ok in some usage of the callback but crashing in
> others. Not sure if you needed this to make things work, things can be
> unreliable when enum items give different results depending if context
> happens to be available but maybe it goes fine here.
>
> On Sat, May 11, 2013 at 3:11 PM, Bastien Montagne<montagne29 at wanadoo.fr>  wrote:
>> Hi devs,
>>
>> Here is a patch that was first intended to fix [#35224] "Transform
>> orientation - order inconsistency" : http://www.pasteall.org/42132/diff
>>
>> It’s not a big deal in itself, but as it affects quite a few areas, I
>> thought it would be better to post it here, so that all core devs have a
>> chance to give it a look.
>>
>> This patch adds several fixes/enhancements/simplifications (deduplications):
>> * Its main goal is to remove as much "manual UI" from 3D view header as
>> possible. In current state, it moves mode selector and all transform
>> manipulators/orientations stuff to RNA (leaving basically only edit mesh
>> select modes with custom handlers, as they have some quite specific
>> features).
>> * To achieve this, three main modifications were done:
>> ** enum-operator-generated menus are now PULLDOWN in headers too.
>> ** All bit-flag enums expanded in ROW buttons now have a handling
>> consistent with e.g. layers, or what we already have for transform
>> manipulators, i.e. clicking select only one element, shift-click to
>> select multiple ones.
>> ** Consequently, the three RNA booleans manipulators flags are merged
>> into a single bit-flag enum (yes, this is also an API change, though I
>> doubt many scripts use it).
>>
>> All this allows to remove some code in 3DView/transform areas, that was
>> actually mostly duplicating RNA/operator one.
>>
>> Also done a few optimizations here and there (among other, do not pass
>> &numitems to RNA_property_enum_items() when you do not need it, saves at
>> least an iteration over enum items to count them ;) ).
>>
>> Best regards,
>> Bastien
>> _______________________________________________
>> Bf-committers mailing list
>> Bf-committers at blender.org
>> http://lists.blender.org/mailman/listinfo/bf-committers
> _______________________________________________
> Bf-committers mailing list
> Bf-committers at blender.org
> http://lists.blender.org/mailman/listinfo/bf-committers
>


More information about the Bf-committers mailing list