[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [29932] branches/soc-2010-kwk: First steps to automatically select the active paint image by active textures in texture stack .

Konrad Kleine konrad at konradwilhelm.de
Sun Jul 4 15:29:36 CEST 2010


Revision: 29932
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=29932
Author:   kwk
Date:     2010-07-04 15:29:36 +0200 (Sun, 04 Jul 2010)

Log Message:
-----------
First steps to automatically select the active paint image by active textures in texture stack.

* The behaviour is controlled by a boolean property.
  * Added Boolean RNA property in the Tool Settings for Image Painting
  * Made the above property available in the UI under: UV/Image Editor :: Image :: Auto Select Image
* Experiment with listeners that shall update the currently shown image in the UV/Image editor.

Modified Paths:
--------------
    branches/soc-2010-kwk/release/scripts/ui/space_image.py
    branches/soc-2010-kwk/source/blender/editors/space_image/space_image.c
    branches/soc-2010-kwk/source/blender/makesdna/DNA_scene_types.h
    branches/soc-2010-kwk/source/blender/makesrna/intern/rna_sculpt_paint.c
    branches/soc-2010-kwk/source/blender/makesrna/intern/rna_space.c

Modified: branches/soc-2010-kwk/release/scripts/ui/space_image.py
===================================================================
--- branches/soc-2010-kwk/release/scripts/ui/space_image.py	2010-07-04 13:17:19 UTC (rev 29931)
+++ branches/soc-2010-kwk/release/scripts/ui/space_image.py	2010-07-04 13:29:36 UTC (rev 29932)
@@ -137,7 +137,11 @@
 
             layout.prop(sima, "image_painting")
 
+            layout.separator()
 
+            layout.prop(bpy.context.tool_settings.image_paint, "auto_select_image")            
+
+
 class IMAGE_MT_uvs_showhide(bpy.types.Menu):
     bl_label = "Show/Hide Faces"
 
@@ -682,9 +686,9 @@
         layout = self.layout
 
         row = layout.row()
-        
+
         split = layout.split()
-#        
+
         row = split.row(align=True)
         row.label(text="Add:")
         row.operator("image.multi_channel_add_channel", text="Diffuse").channel_type = 'DIFFUSE' # , icon='FILE_IMAGE'

Modified: branches/soc-2010-kwk/source/blender/editors/space_image/space_image.c
===================================================================
--- branches/soc-2010-kwk/source/blender/editors/space_image/space_image.c	2010-07-04 13:17:19 UTC (rev 29931)
+++ branches/soc-2010-kwk/source/blender/editors/space_image/space_image.c	2010-07-04 13:29:36 UTC (rev 29932)
@@ -589,6 +589,11 @@
 	}
 }
 
+static void auto_select_image()
+{
+	
+}
+
 static void image_listener(ScrArea *sa, wmNotifier *wmn)
 {
 	SpaceImage *sima= (SpaceImage *)sa->spacedata.first;
@@ -635,13 +640,28 @@
 			}
 		case NC_OBJECT:
 			switch(wmn->data) {
-				case ND_TRANSFORM:
-					if(sima->lock && (sima->flag & SI_DRAWSHADOW)) {
+				case ND_TRANSFORM:					
+					if(sima->lock && (sima->flag & SI_DRAWSHADOW)) {						
 						ED_area_tag_refresh(sa);
 						ED_area_tag_redraw(sa);
 					}
 					break;
 			}
+		/* XXX: (kwk) for auto selecting image */
+		case NC_MATERIAL:
+			switch(wmn->data) {
+				default:
+					printf("Material.");
+					fflush(stdout);
+					break;
+			}
+		case NC_TEXTURE:
+			switch(wmn->data) {
+				default:
+					printf("Texture.");
+					fflush(stdout);
+					break;
+			}
 	}
 }
 

Modified: branches/soc-2010-kwk/source/blender/makesdna/DNA_scene_types.h
===================================================================
--- branches/soc-2010-kwk/source/blender/makesdna/DNA_scene_types.h	2010-07-04 13:17:19 UTC (rev 29931)
+++ branches/soc-2010-kwk/source/blender/makesdna/DNA_scene_types.h	2010-07-04 13:29:36 UTC (rev 29932)
@@ -526,10 +526,7 @@
 	/* for projection painting only */
 	short seam_bleed, normal_angle;
 	short screen_grab_size[2]; /* capture size for re-projection */
-
-	/* XXX: (kwk) For multi-channel painting */
 	
-	/* XXX: (kwk) still need pad1 here? */	
 	int pad1;
 
 	void *paintcursor;			/* wm handle */
@@ -1138,8 +1135,8 @@
 #define IMAGEPAINT_PROJECT_LAYER_CLONE	1<<7
 #define IMAGEPAINT_PROJECT_LAYER_STENCIL	1<<8
 #define IMAGEPAINT_PROJECT_LAYER_STENCIL_INV	1<<9
-/* for multi-channel painting */
-#define IMAGEPAINT_MUTLI_CHANNEL_ENABLED 1<<10
+/* ImagePaintSettings.flag (again) */
+#define IMAGEPAINT_AUTO_SELECT_IMAGE	1<<10
 
 /* toolsettings->uvcalc_flag */
 #define UVCALC_FILLHOLES			1

Modified: branches/soc-2010-kwk/source/blender/makesrna/intern/rna_sculpt_paint.c
===================================================================
--- branches/soc-2010-kwk/source/blender/makesrna/intern/rna_sculpt_paint.c	2010-07-04 13:17:19 UTC (rev 29931)
+++ branches/soc-2010-kwk/source/blender/makesrna/intern/rna_sculpt_paint.c	2010-07-04 13:29:36 UTC (rev 29932)
@@ -369,6 +369,11 @@
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", IMAGEPAINT_PROJECT_LAYER_CLONE);
 	RNA_def_property_ui_text(prop, "Clone Layer", "Use another UV layer as clone source, otherwise use 3D the cursor as the source");
 	
+	/*  selecting the active paint image by active textures in texture stack */
+	prop= RNA_def_property(srna, "auto_select_image", PROP_BOOLEAN, PROP_NONE);
+	RNA_def_property_boolean_sdna(prop, NULL, "flag", IMAGEPAINT_AUTO_SELECT_IMAGE);
+	RNA_def_property_ui_text(prop, "Auto Select Image", "Automatically select image by active texture in the texture stack");
+	
 	/* integers */
 	
 	prop= RNA_def_property(srna, "seam_bleed", PROP_INT, PROP_UNSIGNED);

Modified: branches/soc-2010-kwk/source/blender/makesrna/intern/rna_space.c
===================================================================
--- branches/soc-2010-kwk/source/blender/makesrna/intern/rna_space.c	2010-07-04 13:17:19 UTC (rev 29931)
+++ branches/soc-2010-kwk/source/blender/makesrna/intern/rna_space.c	2010-07-04 13:29:36 UTC (rev 29932)
@@ -1353,7 +1353,7 @@
 	RNA_def_property_ui_text(prop, "Image Painting", "Enable image painting mode");
 	RNA_def_property_ui_icon(prop, ICON_TPAINT_HLT, 0);
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_IMAGE, "rna_SpaceImageEditor_paint_update");
-
+	
 	/* grease pencil */
 	prop= RNA_def_property(srna, "grease_pencil", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "gpd");





More information about the Bf-blender-cvs mailing list