Get rid of the BRUSH_FIXED_TEX flag, use mapping modes instead. Version
authorAntony Riakiotakis <kalast@gmail.com>
Wed, 16 Jan 2013 14:36:13 +0000 (14:36 +0000)
committerAntony Riakiotakis <kalast@gmail.com>
Wed, 16 Jan 2013 14:36:13 +0000 (14:36 +0000)
patched all previous texture paint brushes to use tiled mapping since
mappping is now shared between 2d and 3d painting.

release/scripts/startup/bl_ui/space_image.py
release/scripts/startup/bl_ui/space_view3d_toolbar.py
source/blender/blenkernel/BKE_blender.h
source/blender/blenkernel/intern/brush.c
source/blender/blenkernel/intern/texture.c
source/blender/blenloader/intern/readfile.c
source/blender/editors/sculpt_paint/paint_image_2d.c
source/blender/makesdna/DNA_brush_types.h
source/blender/makesrna/intern/rna_brush.c

index 1ea20d9..cfedc5e 100644 (file)
@@ -20,7 +20,7 @@
 import bpy
 from bpy.types import Header, Menu, Panel
 from bl_ui.properties_paint_common import UnifiedPaintPanel
-
+from bl_ui.properties_paint_common import brush_texture_settings
 
 class ImagePaintPanel(UnifiedPaintPanel):
     bl_space_type = 'IMAGE_EDITOR'
@@ -722,7 +722,8 @@ class IMAGE_PT_tools_brush_texture(BrushButtonsPanel, Panel):
 
         col = layout.column()
         col.template_ID_preview(brush, "texture", new="texture.new", rows=3, cols=8)
-        col.prop(brush, "use_fixed_texture")
+        
+        brush_texture_settings(col, brush, 0)
 
 
 class IMAGE_PT_tools_brush_tool(BrushButtonsPanel, Panel):
index 5791719..1653e8f 100644 (file)
@@ -720,8 +720,6 @@ class VIEW3D_PT_tools_brush_texture(Panel, View3DPaintPanel):
         col = layout.column()
 
         col.template_ID_preview(brush, "texture", new="texture.new", rows=3, cols=8)
-        if brush.use_paint_image:
-            col.prop(brush, "use_fixed_texture")
 
         brush_texture_settings(col, brush, context.sculpt_object)
 
index 9c6d26c..2d596fa 100644 (file)
@@ -42,7 +42,7 @@ extern "C" {
  * and keep comment above the defines.
  * Use STRINGIFY() rather than defining with quotes */
 #define BLENDER_VERSION         265
-#define BLENDER_SUBVERSION      8
+#define BLENDER_SUBVERSION      9
 
 /* 262 was the last editmesh release but it has compatibility code for bmesh data */
 #define BLENDER_MINVERSION      262
index aeb0407..e827547 100644 (file)
@@ -259,7 +259,6 @@ void BKE_brush_debug_print_state(Brush *br)
        BR_TEST_FLAG(BRUSH_SIZE_PRESSURE);
        BR_TEST_FLAG(BRUSH_JITTER_PRESSURE);
        BR_TEST_FLAG(BRUSH_SPACING_PRESSURE);
-       BR_TEST_FLAG(BRUSH_FIXED_TEX);
        BR_TEST_FLAG(BRUSH_RAKE);
        BR_TEST_FLAG(BRUSH_ANCHORED);
        BR_TEST_FLAG(BRUSH_DIR_IN);
index fbaf6f7..2e909f1 100644 (file)
@@ -615,6 +615,7 @@ void default_mtex(MTex *mtex)
        mtex->gravityfac = 1.0f;
        mtex->fieldfac = 1.0f;
        mtex->normapspace = MTEX_NSPACE_TANGENT;
+       mtex->brush_map_mode = MTEX_MAP_MODE_TILED;
 }
 
 
index 029e169..09c90f6 100644 (file)
@@ -8663,6 +8663,15 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
                }
        }
 
+       if (!MAIN_VERSION_ATLEAST(main, 265, 9)) {
+               Brush *br;
+               for (br = main->brush.first; br; br = br->id.next) {
+                       if (br->ob_mode & OB_MODE_TEXTURE_PAINT) {
+                               br->mtex.brush_map_mode = MTEX_MAP_MODE_TILED;
+                       }
+               }
+       }
+
        // if (main->versionfile < 265 || (main->versionfile == 265 && main->subversionfile < 7)) {
 
        /* WATCH IT!!!: pointers from libdata have not been converted yet here! */
index dd7412c..9965727 100644 (file)
@@ -331,7 +331,7 @@ static void brush_painter_refresh_cache(BrushPainter *painter, const float pos[2
                flt = cache->flt;
                size = (cache->size) ? cache->size : diameter;
 
-               if (brush->flag & BRUSH_FIXED_TEX) {
+               if (brush->mtex.brush_map_mode == MTEX_MAP_MODE_TILED) {
                        BKE_brush_imbuf_new(scene, brush, flt, 3, size, &cache->maskibuf, use_color_correction);
                        brush_painter_fixed_tex_partial_update(painter, pos);
                }
@@ -342,7 +342,7 @@ static void brush_painter_refresh_cache(BrushPainter *painter, const float pos[2
                cache->lastalpha = alpha;
                cache->lastjitter = brush->jitter;
        }
-       else if ((brush->flag & BRUSH_FIXED_TEX) && mtex && mtex->tex) {
+       else if ((brush->mtex.brush_map_mode == MTEX_MAP_MODE_TILED) && mtex && mtex->tex) {
                int dx = (int)painter->lastpaintpos[0] - (int)pos[0];
                int dy = (int)painter->lastpaintpos[1] - (int)pos[1];
 
index e3571c7..e935592 100644 (file)
@@ -112,7 +112,7 @@ typedef enum BrushFlags {
        BRUSH_SIZE_PRESSURE = (1 << 3),
        BRUSH_JITTER_PRESSURE = (1 << 4),
        BRUSH_SPACING_PRESSURE = (1 << 5),
-       BRUSH_FIXED_TEX = (1 << 6),
+       BRUSH_FIXED_TEX = (1 << 6), /* obsolete, use mtex->brush_map_mode = MTEX_MAP_MODE_TILED instead */
        BRUSH_RAKE = (1 << 7),
        BRUSH_ANCHORED = (1 << 8),
        BRUSH_DIR_IN = (1 << 9),
@@ -164,10 +164,12 @@ typedef enum BrushSculptTool {
 } BrushSculptTool;
 
 /* ImagePaintSettings.tool */
-#define PAINT_TOOL_DRAW     0
-#define PAINT_TOOL_SOFTEN   1
-#define PAINT_TOOL_SMEAR    2
-#define PAINT_TOOL_CLONE    3
+typedef enum BrushImagePaintTool{
+       PAINT_TOOL_DRAW = 0,
+       PAINT_TOOL_SOFTEN = 1,
+       PAINT_TOOL_SMEAR = 2,
+       PAINT_TOOL_CLONE = 3
+} BrushImagePaintTool;
 
 /* direction that the brush displaces along */
 enum {
index 2eb6568..f17ee48 100644 (file)
@@ -867,11 +867,6 @@ static void rna_def_brush(BlenderRNA *brna)
        RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_RESTORE_MESH);
        RNA_def_property_ui_text(prop, "Restore Mesh", "Allow a single dot to be carefully positioned");
        RNA_def_property_update(prop, 0, "rna_Brush_update");
-
-       prop = RNA_def_property(srna, "use_fixed_texture", PROP_BOOLEAN, PROP_NONE);
-       RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_FIXED_TEX);
-       RNA_def_property_ui_text(prop, "Fixed Texture", "Keep texture origin in fixed position");
-       RNA_def_property_update(prop, 0, "rna_Brush_update");
        
        /* only for projection paint, TODO, other paint modes */
        prop = RNA_def_property(srna, "use_alpha", PROP_BOOLEAN, PROP_NONE);