forked from bartvdbraak/blender
workaround [#24392] 2d Image paint editor: no clone/smear/soften tools etc
the brush system matches the brush mode with the object mode, but this doesn't work for 2D image view paint. since the poll() function doesnt have access to the context, for now just check if no paint modes are active, default to texture paint.
This commit is contained in:
parent
ee4b32c41a
commit
81fe9d2d04
@ -67,7 +67,7 @@ static void brush_set_defaults(Brush *brush)
|
||||
brush->blend = 0;
|
||||
brush->flag = 0;
|
||||
|
||||
brush->ob_mode = (OB_MODE_SCULPT|OB_MODE_VERTEX_PAINT|OB_MODE_WEIGHT_PAINT|OB_MODE_TEXTURE_PAINT);
|
||||
brush->ob_mode = OB_MODE_ALL_PAINT;
|
||||
|
||||
/* BRUSH SCULPT TOOL SETTINGS */
|
||||
brush->size= 35; /* radius of the brush in pixels */
|
||||
|
@ -11124,7 +11124,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
|
||||
Brush *br;
|
||||
for(br= main->brush.first; br; br= br->id.next) {
|
||||
if(br->ob_mode==0)
|
||||
br->ob_mode= (OB_MODE_SCULPT|OB_MODE_WEIGHT_PAINT|OB_MODE_TEXTURE_PAINT|OB_MODE_VERTEX_PAINT);
|
||||
br->ob_mode= OB_MODE_ALL_PAINT;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -339,7 +339,7 @@ static void stats_update(Scene *scene)
|
||||
/* Pose Mode */
|
||||
stats_object_pose(ob, &stats);
|
||||
}
|
||||
else if(ob && (ob->flag & (OB_MODE_SCULPT|OB_MODE_VERTEX_PAINT|OB_MODE_WEIGHT_PAINT|OB_MODE_TEXTURE_PAINT))) {
|
||||
else if(ob && (ob->flag & OB_MODE_ALL_PAINT)) {
|
||||
/* Sculpt and Paint Mode */
|
||||
stats_object_paint(ob, &stats);
|
||||
}
|
||||
|
@ -443,7 +443,7 @@ int calc_manipulator_stats(const bContext *C)
|
||||
mul_m4_v3(ob->obmat, scene->twmax);
|
||||
}
|
||||
}
|
||||
else if(ob && (ob->mode & (OB_MODE_SCULPT|OB_MODE_VERTEX_PAINT|OB_MODE_WEIGHT_PAINT|OB_MODE_TEXTURE_PAINT))) {
|
||||
else if(ob && (ob->mode & OB_MODE_ALL_PAINT)) {
|
||||
;
|
||||
}
|
||||
else if(ob && ob->mode & OB_MODE_PARTICLE_EDIT) {
|
||||
|
@ -884,7 +884,7 @@ int getTransformOrientation(const bContext *C, float normal[3], float plane[3],
|
||||
result = ORIENTATION_EDGE;
|
||||
}
|
||||
}
|
||||
else if(ob && (ob->mode & (OB_MODE_SCULPT|OB_MODE_VERTEX_PAINT|OB_MODE_WEIGHT_PAINT|OB_MODE_TEXTURE_PAINT|OB_MODE_PARTICLE_EDIT)))
|
||||
else if(ob && (ob->mode & (OB_MODE_ALL_PAINT|OB_MODE_PARTICLE_EDIT)))
|
||||
{
|
||||
}
|
||||
else {
|
||||
|
@ -557,6 +557,9 @@ typedef enum ObjectMode {
|
||||
OB_MODE_POSE = 64
|
||||
} ObjectMode;
|
||||
|
||||
/* any mode where the brush system is used */
|
||||
#define OB_MODE_ALL_PAINT (OB_MODE_SCULPT|OB_MODE_VERTEX_PAINT|OB_MODE_WEIGHT_PAINT|OB_MODE_TEXTURE_PAINT)
|
||||
|
||||
#define MAX_DUPLI_RECUR 8
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -162,8 +162,19 @@ static int rna_Brush_mode_poll(PointerRNA *ptr, PointerRNA value)
|
||||
Scene *scene= (Scene *)ptr->id.data;
|
||||
Object *ob = OBACT;
|
||||
Brush *brush= value.id.data;
|
||||
return ob->mode & brush->ob_mode;
|
||||
|
||||
/* 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->mode & OB_MODE_ALL_PAINT) {
|
||||
return ob->mode & brush->ob_mode;
|
||||
}
|
||||
else {
|
||||
return OB_MODE_TEXTURE_PAINT & brush->ob_mode;
|
||||
}
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
static void rna_def_paint(BlenderRNA *brna)
|
||||
|
Loading…
Reference in New Issue
Block a user