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-08-28 17:48:26 +0400
committerAntony Riakiotakis <kalast@gmail.com>2014-08-28 17:50:42 +0400
commit512b7383525d7b9ccdca93816a08a579db148f23 (patch)
tree21a46dc1830f3f067dbb73abafa3655f7f62ffb2 /source
parent2b15c012c24d913c1fa427a69f0c7270c32a39a8 (diff)
Texture paint system:
* Add ability to choose blend type and enable/disable toggle for each slot for blender internal.
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenkernel/intern/material.c2
-rw-r--r--source/blender/editors/sculpt_paint/paint_image_proj.c28
-rw-r--r--source/blender/makesdna/DNA_material_types.h5
-rw-r--r--source/blender/makesrna/intern/rna_material.c5
4 files changed, 17 insertions, 23 deletions
diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c
index 7565703358e..50147149b0c 100644
--- a/source/blender/blenkernel/intern/material.c
+++ b/source/blender/blenkernel/intern/material.c
@@ -1380,7 +1380,7 @@ void BKE_texpaint_slot_refresh_cache(Scene *scene, Material *ma)
if (get_mtex_slot_valid_texpaint(*mtex)) {
ma->texpaintslot[index].ima = (*mtex)->tex->ima;
ma->texpaintslot[index].uvname = (*mtex)->uvname;
- ma->texpaintslot[index].mtex = *mtex;
+ ma->texpaintslot[index].index = i;
index++;
}
diff --git a/source/blender/editors/sculpt_paint/paint_image_proj.c b/source/blender/editors/sculpt_paint/paint_image_proj.c
index f24c6888201..9362510a84d 100644
--- a/source/blender/editors/sculpt_paint/paint_image_proj.c
+++ b/source/blender/editors/sculpt_paint/paint_image_proj.c
@@ -4972,7 +4972,6 @@ static int texture_paint_delete_texture_paint_slot_exec(bContext *C, wmOperator
Material *ma;
bool is_bi = BKE_scene_uses_blender_internal(scene);
TexPaintSlot *slot;
- int i;
/* not supported for node-based engines */
if (!ob || !is_bi)
@@ -4985,24 +4984,17 @@ static int texture_paint_delete_texture_paint_slot_exec(bContext *C, wmOperator
slot = ma->texpaintslot + ma->paint_active_slot;
- /* find the material texture slot that corresponds to the current slot */
- for (i = 0; i < MAX_MTEX; i++) {
- if (ma->mtex[i] == slot->mtex) {
- if (ma->mtex[i]->tex)
- id_us_min(&ma->mtex[i]->tex->id);
- MEM_freeN(ma->mtex[i]);
- ma->mtex[i] = NULL;
-
- BKE_texpaint_slot_refresh_cache(scene, ma);
- DAG_id_tag_update(&ma->id, 0);
- WM_event_add_notifier(C, NC_MATERIAL, CTX_data_scene(C));
- /* we need a notifier for data change since we change the displayed modifier uvs */
- WM_event_add_notifier(C, NC_GEOM | ND_DATA, ob->data);
- return OPERATOR_FINISHED;
- }
- }
+ if (ma->mtex[slot->index]->tex)
+ id_us_min(&ma->mtex[slot->index]->tex->id);
+ MEM_freeN(ma->mtex[slot->index]);
+ ma->mtex[slot->index] = NULL;
- return OPERATOR_CANCELLED;
+ BKE_texpaint_slot_refresh_cache(scene, ma);
+ DAG_id_tag_update(&ma->id, 0);
+ WM_event_add_notifier(C, NC_MATERIAL, CTX_data_scene(C));
+ /* we need a notifier for data change since we change the displayed modifier uvs */
+ WM_event_add_notifier(C, NC_GEOM | ND_DATA, ob->data);
+ return OPERATOR_FINISHED;
}
diff --git a/source/blender/makesdna/DNA_material_types.h b/source/blender/makesdna/DNA_material_types.h
index bd791c9c006..3f94a9cfebb 100644
--- a/source/blender/makesdna/DNA_material_types.h
+++ b/source/blender/makesdna/DNA_material_types.h
@@ -85,8 +85,9 @@ typedef struct GameSettings {
typedef struct TexPaintSlot {
struct Image *ima; /* image to be painted on */
- char *uvname; /* customdata index for uv layer, MAX_NAME*/
- struct MTex *mtex; /* hook for blender internal materials. Not terribily nice, but serves for usability now */
+ char *uvname; /* customdata index for uv layer, MAX_NAME*/
+ int index; /* index for mtex slot in material for blender internal */
+ int pad;
} TexPaintSlot;
typedef struct Material {
diff --git a/source/blender/makesrna/intern/rna_material.c b/source/blender/makesrna/intern/rna_material.c
index 4031c70a7ef..c395b963d48 100644
--- a/source/blender/makesrna/intern/rna_material.c
+++ b/source/blender/makesrna/intern/rna_material.c
@@ -2212,8 +2212,9 @@ static void rna_def_tex_slot(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "UV Map", "Name of UV map");
RNA_def_property_update(prop, NC_GEOM | ND_DATA, "rna_Material_update");
- prop = RNA_def_property(srna, "mtex", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "MaterialTextureSlot");
+ prop = RNA_def_property(srna, "index", PROP_INT, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Index", "Index of MTex slot in the material");
}