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
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2009-07-15 23:20:59 +0400
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2009-07-15 23:20:59 +0400
commitd4504aa891c38333089da6bba50f66ca588cca1e (patch)
treecd98ee9da93dd78cc7a6c7dd1ec0ea956489d685 /source/blender/makesrna/intern/rna_brush.c
parent4df1836325bd2847f3c88eb6fafa98e7bafea81c (diff)
2.5
* Some changes to make lamp and world textures editing work. You may have to click on another texture slot once before being able to add a texture, and the layout is messy. Added this so lightenv project isn't blocked by this being missing. * Adding a new material slot now doesn't create a new material anymore, to avoid creating unused materials. * Tiny changes to scene/object buttons.
Diffstat (limited to 'source/blender/makesrna/intern/rna_brush.c')
-rw-r--r--source/blender/makesrna/intern/rna_brush.c27
1 files changed, 26 insertions, 1 deletions
diff --git a/source/blender/makesrna/intern/rna_brush.c b/source/blender/makesrna/intern/rna_brush.c
index 3b7df3aa948..954c20e211c 100644
--- a/source/blender/makesrna/intern/rna_brush.c
+++ b/source/blender/makesrna/intern/rna_brush.c
@@ -34,6 +34,10 @@
#ifdef RNA_RUNTIME
+#include "MEM_guardedalloc.h"
+
+#include "BKE_texture.h"
+
static void rna_Brush_mtex_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
{
Brush *brush= (Brush*)ptr->data;
@@ -46,6 +50,27 @@ static PointerRNA rna_Brush_active_texture_get(PointerRNA *ptr)
return rna_pointer_inherit_refine(ptr, &RNA_TextureSlot, brush->mtex[(int)brush->texact]);
}
+static void rna_Brush_active_texture_index_set(PointerRNA *ptr, int value)
+{
+ Brush *brush= (Brush*)ptr->data;
+ int act= brush->texact;
+
+ if(value == act || value < 0 || value >= MAX_MTEX)
+ return;
+
+ /* auto create/free mtex on activate/deactive, so we can edit
+ * the texture pointer in the buttons UI. */
+ if(brush->mtex[act] && !brush->mtex[act]->tex) {
+ MEM_freeN(brush->mtex[act]);
+ brush->mtex[act]= NULL;
+ }
+
+ brush->texact= value;
+
+ if(!brush->mtex[value])
+ brush->mtex[value]= add_mtex();
+}
+
static float rna_Brush_rotation_get(PointerRNA *ptr)
{
Brush *brush= (Brush*)ptr->data;
@@ -198,7 +223,7 @@ void rna_def_brush(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Curve", "Editable falloff curve.");
/* texture */
- rna_def_mtex_common(srna, "rna_Brush_mtex_begin", "rna_Brush_active_texture_get", "TextureSlot");
+ rna_def_mtex_common(srna, "rna_Brush_mtex_begin", "rna_Brush_active_texture_get", "rna_Brush_active_texture_index_set", "TextureSlot");
/* clone tool */
prop= RNA_def_property(srna, "clone_image", PROP_POINTER, PROP_NONE);