[Bf-blender-cvs] [25f734f] soc-2013-paint: xrg feedback request series #2:
Antony Riakiotakis
noreply at git.blender.org
Sat May 24 15:07:40 CEST 2014
Commit: 25f734fd988af63b83efe130bf4f307040dc3a17
Author: Antony Riakiotakis
Date: Sat May 24 16:07:26 2014 +0300
https://developer.blender.org/rB25f734fd988af63b83efe130bf4f307040dc3a17
xrg feedback request series #2:
Set the image of active paint slot of the active material (of the active
object of the active scene...phew! :p) in image editors when entering
texture paint mode.
+ some minor identation fixes.
===================================================================
M source/blender/editors/sculpt_paint/paint_image.c
M source/blender/makesrna/intern/rna_material.c
===================================================================
diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c
index a455355..15c2f41 100644
--- a/source/blender/editors/sculpt_paint/paint_image.c
+++ b/source/blender/editors/sculpt_paint/paint_image.c
@@ -1433,6 +1433,10 @@ static int texture_paint_toggle_exec(bContext *C, wmOperator *op)
toggle_paint_cursor(C, 0);
}
else {
+ bScreen *sc;
+ Main *bmain = CTX_data_main(C);
+ Material *ma;
+
bool use_nodes = BKE_scene_use_new_shading_nodes(scene);
/* This has to stay here to regenerate the texture paint
* cache in case we are loading a file */
@@ -1440,6 +1444,22 @@ static int texture_paint_toggle_exec(bContext *C, wmOperator *op)
paint_proj_mesh_data_ensure(C, ob, op);
+ /* set the current material active paint slot on image editor */
+ ma = give_current_material(ob, ob->actcol);
+
+ for (sc = bmain->screen.first; sc; sc = sc->id.next) {
+ ScrArea *sa;
+ for (sa = sc->areabase.first; sa; sa = sa->next) {
+ SpaceLink *sl;
+ for (sl = sa->spacedata.first; sl; sl = sl->next) {
+ if (sl->spacetype == SPACE_IMAGE) {
+ SpaceImage *sima = (SpaceImage *)sl;
+ ED_space_image_set(sima, scene, scene->obedit, ma->texpaintslot[ma->paint_active_slot].ima);
+ }
+ }
+ }
+ }
+
ob->mode |= mode_flag;
BKE_paint_init(&scene->toolsettings->imapaint.paint, PAINT_CURSOR_TEXTURE_PAINT);
diff --git a/source/blender/makesrna/intern/rna_material.c b/source/blender/makesrna/intern/rna_material.c
index 88f532e..111640c 100644
--- a/source/blender/makesrna/intern/rna_material.c
+++ b/source/blender/makesrna/intern/rna_material.c
@@ -204,8 +204,8 @@ static void rna_Material_active_paint_texture_index_update(Main *bmain, Scene *s
SpaceLink *sl;
for (sl = sa->spacedata.first; sl; sl = sl->next) {
if (sl->spacetype == SPACE_IMAGE) {
- SpaceImage *sima = (SpaceImage *)sl;
- ED_space_image_set(sima, scene, scene->obedit, ma->texpaintslot[ma->paint_active_slot].ima);
+ SpaceImage *sima = (SpaceImage *)sl;
+ ED_space_image_set(sima, scene, scene->obedit, ma->texpaintslot[ma->paint_active_slot].ima);
}
}
}
More information about the Bf-blender-cvs
mailing list