[Bf-codereview] Limit brushes to a single paint tool (issue 5671088)

Jason.A.Wilkins at gmail.com Jason.A.Wilkins at gmail.com
Sat Feb 18 12:16:52 CET 2012


I did something similar in soc-2011-onion except I did not create a new
C enumeration.  However, I did not go as far as this, mainly because I
see us having a unified paint/sculpt system eventually where brushes
can, for example, both sculpt and texture paint at the same time.  I see
the brush->ob_mode as eventually supporting multiple bit flags even
though now it only really supports 1.

One thing about RNA is that it does not have to exactly mirror the
underlying C.  When I re-factored the paint_stroke module I did not
create a new stroke enumeration in C for each possible mode I wanted to
show the user in the UI, instead I created a new RNA enumeration that
contained the appropriate combinations of the already existing bits
flags.

In onion if you enable the debug UI code it is possible to change the
individual flags with check boxes and the enumeration drop down box will
automatically show you what I named that combination.  (If you choose an
unnamed combination the box will go blank).

So, if we use your readfile code to split up brushes and only present
the user with a new enumeration that only allows mutually exclusive
modes then we can assume that brush->ob_mode only contains a valid
value.

Well, not completely, somebody could put all the brush.use_paint_* in
the UI and check them all like they can now, but we could just write
functions like brush.is_direction_capable() to always fail in that case.

Maybe this is a lot of words just to say: Why do we need a new C
enumeration?




http://codereview.appspot.com/5671088/


More information about the Bf-codereview mailing list