Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorAntony Riakiotakis <kalast@gmail.com>2014-07-22 23:05:54 +0400
committerAntony Riakiotakis <kalast@gmail.com>2014-07-22 23:06:10 +0400
commitc32a671b3a7f2908c03bcb60f46ca40250dd08fa (patch)
tree98bf50090310d7d05f81fb86246c046bb2981981 /source
parent895f0f3dffd4ceb32e2e68c36cf834673e2f4093 (diff)
Fix T41141, can't paint texture in cycles.
The issue is actually that creating a new image in texture paint mode will set it always as a stencil image. Internally, the code checks if the painted image is the same as the stencil and if it is, no painting is done. Solution is to expose a boolena to the operator for setting the image as a stencil (could be an enum in th future for more uses) Stencil UI is a bit weird here, will definitely redesign.
Diffstat (limited to 'source')
-rw-r--r--source/blender/editors/space_image/image_ops.c11
-rw-r--r--source/blender/makesrna/intern/rna_material.c2
2 files changed, 8 insertions, 5 deletions
diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c
index 6a72066f031..66bd346ae69 100644
--- a/source/blender/editors/space_image/image_ops.c
+++ b/source/blender/editors/space_image/image_ops.c
@@ -1896,7 +1896,6 @@ static int image_new_exec(bContext *C, wmOperator *op)
SpaceImage *sima;
Scene *scene;
Object *obedit;
- Object *ob;
Image *ima;
Main *bmain;
PointerRNA ptr, idptr;
@@ -1905,13 +1904,13 @@ static int image_new_exec(bContext *C, wmOperator *op)
char *name = _name;
float color[4];
int width, height, floatbuf, gen_type, alpha;
+ bool stencil;
/* retrieve state */
sima = CTX_wm_space_image(C);
scene = CTX_data_scene(C);
obedit = CTX_data_edit_object(C);
bmain = CTX_data_main(C);
- ob = OBACT;
prop = RNA_struct_find_property(op->ptr, "name");
RNA_property_string_get(op->ptr, prop, name);
@@ -1925,7 +1924,8 @@ static int image_new_exec(bContext *C, wmOperator *op)
gen_type = RNA_enum_get(op->ptr, "generated_type");
RNA_float_get_array(op->ptr, "color", color);
alpha = RNA_boolean_get(op->ptr, "alpha");
-
+ stencil = RNA_boolean_get(op->ptr, "texstencil");
+
if (!alpha)
color[3] = 1.0f;
@@ -1957,7 +1957,7 @@ static int image_new_exec(bContext *C, wmOperator *op)
tex->ima = ima;
ED_area_tag_redraw(CTX_wm_area(C));
}
- else if (ob && ob->mode == OB_MODE_TEXTURE_PAINT) {
+ else if (stencil) {
ImagePaintSettings *imapaint = &(CTX_data_tool_settings(C)->imapaint);
if (imapaint->stencil)
@@ -2012,6 +2012,9 @@ void IMAGE_OT_new(wmOperatorType *ot)
RNA_def_enum(ot->srna, "generated_type", image_generated_type_items, IMA_GENTYPE_BLANK,
"Generated Type", "Fill the image with a grid for UV map testing");
RNA_def_boolean(ot->srna, "float", 0, "32 bit Float", "Create image with 32 bit floating point bit depth");
+ prop = RNA_def_boolean(ot->srna, "texstencil", 0, "Stencil", "Set Image as stencil");
+ RNA_def_property_flag(prop, PROP_HIDDEN);
+
}
#undef IMA_DEF_NAME
diff --git a/source/blender/makesrna/intern/rna_material.c b/source/blender/makesrna/intern/rna_material.c
index 3c9eaf3c5db..46c5cc770b8 100644
--- a/source/blender/makesrna/intern/rna_material.c
+++ b/source/blender/makesrna/intern/rna_material.c
@@ -186,7 +186,7 @@ static void rna_Material_active_paint_texture_index_update(Main *bmain, Scene *s
struct bNode *node;
int index = 0;
for (node = ma->nodetree->nodes.first; node; node = node->next) {
- if (node->typeinfo->nclass == NODE_CLASS_TEXTURE) {
+ if (node->typeinfo->nclass == NODE_CLASS_TEXTURE && node->typeinfo->type == SH_NODE_TEX_IMAGE && node->id) {
if (index++ == ma->paint_active_slot) {
break;
}