[Bf-committers] UI/RNA question

Sergey Sharybin sergey.vfx at gmail.com
Thu Feb 16 19:09:15 CET 2012


Hi.

You can define RNA prop which isn't "connected" to any DNA property and
just write your own get/set function for it. Think it'll be much easier to
just point into sources rather than telling the same here.
So, you can open rna_tracking.c file and near line 963 you'll see a
definition of "select" property. It doesn't have DNA
analog.Functions rna_trackingTrack_select_get
and rna_trackingTrack_select_set are used to get/set vallue of this prop.
Think you shall just set NULL instead of set function and clear
PROP_EDITABLE flag for you prop. And in get function it'll be just
something like return ELEM(brush->type, CLAY, etcetcetc)

Thinks it'll be easiest way for you and will help keeping py code clear and
easy to follow.

On Thu, Feb 16, 2012 at 11:46 PM, Nicholas Bishop
<nicholasbishop at gmail.com>wrote:

> I was looking today at updating the menus in sculpt/paint modes,
> currently they are incomplete.
>
> In sculpt especially right now, the toolbar UI has a lot of code like
> this: "if tool in {'CLAY', 'FLATTEN', 'FILL', ...}". I'd rather not
> duplicate such code for menus. One option is to add more functions to
> properties_paint_common.py, but I was wondering if it would be better
> to make this information available through RNA? E.g. add read-only
> boolean properties like "has_direction", "has_stroke_method", etc,
> with a get function to check current tool and such.
>
> Would appreciate guidance as to whether that's appropriate RNA usage,
> or other options.
>
> -Nicholas
> _______________________________________________
> Bf-committers mailing list
> Bf-committers at blender.org
> http://lists.blender.org/mailman/listinfo/bf-committers
>



-- 
With best regards, Sergey Sharybin


More information about the Bf-committers mailing list