diff options
author | Nicholas Bishop <nicholasbishop@gmail.com> | 2011-01-16 21:33:08 +0300 |
---|---|---|
committer | Nicholas Bishop <nicholasbishop@gmail.com> | 2011-01-16 21:33:08 +0300 |
commit | c94eefd52b4174be3b98b3e921546a7a8486d691 (patch) | |
tree | 87bc3c0b80c7cc6b25c66e5e43ce3abf2d521169 /source/blender/makesrna | |
parent | 6ef1f23a33dffa1765c358b158ef18798d1ec3c0 (diff) |
Fixed bug [#25649] Image editor paint icon missing until enter weight
paint
A couple underlying issues:
* Paint icon was looking only at the object mode to determine what the
"current" mode is, but that gave problems when the object mode was
anything other than texpaint, but 2D image paint was turned on. Fix
was to also look at what space is being drawn, and only if it's in
the 3D view does it look at the ob mode.
* The brushes lists weren't getting filtered correctly in the same
case where 2D image paint was on but a different object mode is
enabled. Fixed by changing the brush rna poll to look at the paint
source, rather than the object mode.
Diffstat (limited to 'source/blender/makesrna')
-rw-r--r-- | source/blender/makesrna/intern/rna_sculpt_paint.c | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/source/blender/makesrna/intern/rna_sculpt_paint.c b/source/blender/makesrna/intern/rna_sculpt_paint.c index ae13e5c68d9..040c2175d07 100644 --- a/source/blender/makesrna/intern/rna_sculpt_paint.c +++ b/source/blender/makesrna/intern/rna_sculpt_paint.c @@ -160,19 +160,23 @@ static int rna_ParticleEdit_hair_get(PointerRNA *ptr) static int rna_Brush_mode_poll(PointerRNA *ptr, PointerRNA value) { Scene *scene= (Scene *)ptr->id.data; - Object *ob = OBACT; + ToolSettings *ts = scene->toolsettings; Brush *brush= value.id.data; - - /* weak, for object painting we need to check against the object mode - * but for 2D view image painting we always want texture brushes - * this is not quite correct since you could be in object weightpaint - * mode at the same time as the 2D image view, but for now its *good enough* */ - if(ob && ob->mode & OB_MODE_ALL_PAINT) { - return ob->mode & brush->ob_mode; - } - else { - return OB_MODE_TEXTURE_PAINT & brush->ob_mode; - } + int mode = 0; + + /* check the origin of the Paint struct to see which paint + mode to select from */ + + if(ptr->data == &ts->imapaint) + mode = OB_MODE_TEXTURE_PAINT; + else if(ptr->data == ts->sculpt) + mode = OB_MODE_SCULPT; + else if(ptr->data == ts->vpaint) + mode = OB_MODE_VERTEX_PAINT; + else if(ptr->data == ts->wpaint) + mode = OB_MODE_WEIGHT_PAINT; + + return brush->ob_mode & mode; } #else |