[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [34375] trunk/blender/source/blender/ makesrna/intern: fix missing notifier [#25682] bpy.data.materials['XXX']. texture_slot.clear(0) dosen't delete texture from screen

Campbell Barton ideasman42 at gmail.com
Tue Jan 18 00:30:29 CET 2011


Revision: 34375
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=34375
Author:   campbellbarton
Date:     2011-01-17 23:30:28 +0000 (Mon, 17 Jan 2011)
Log Message:
-----------
fix missing notifier [#25682] bpy.data.materials['XXX'].texture_slot.clear(0) dosen't delete texture from screen

Modified Paths:
--------------
    trunk/blender/source/blender/makesrna/intern/rna_internal.h
    trunk/blender/source/blender/makesrna/intern/rna_material.c

Modified: trunk/blender/source/blender/makesrna/intern/rna_internal.h
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_internal.h	2011-01-17 22:37:24 UTC (rev 34374)
+++ trunk/blender/source/blender/makesrna/intern/rna_internal.h	2011-01-17 23:30:28 UTC (rev 34375)
@@ -362,9 +362,9 @@
 int rna_parameter_size_alloc(struct PropertyRNA *parm);
 
 // XXX, these should not need to be defined here~!
-struct MTex *rna_mtex_texture_slots_add(struct ID *self, struct ReportList *reports);
-struct MTex *rna_mtex_texture_slots_create(struct ID *self, struct ReportList *reports, int index);
-void rna_mtex_texture_slots_clear(struct ID *self, struct ReportList *reports, int index);
+struct MTex *rna_mtex_texture_slots_add(struct ID *self, struct bContext *C, struct ReportList *reports);
+struct MTex *rna_mtex_texture_slots_create(struct ID *self, struct bContext *C, struct ReportList *reports, int index);
+void rna_mtex_texture_slots_clear(struct ID *self, struct bContext *C, struct ReportList *reports, int index);
 
 #endif /* RNA_INTERNAL_H */
 

Modified: trunk/blender/source/blender/makesrna/intern/rna_material.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_material.c	2011-01-17 22:37:24 UTC (rev 34374)
+++ trunk/blender/source/blender/makesrna/intern/rna_material.c	2011-01-17 23:30:28 UTC (rev 34375)
@@ -276,7 +276,7 @@
 	return item;
 }
 
-MTex *rna_mtex_texture_slots_add(ID *self_id, ReportList *reports)
+MTex *rna_mtex_texture_slots_add(ID *self_id, struct bContext *C, ReportList *reports)
 {
 	MTex *mtex= add_mtex_id(self_id, -1);
 	if (mtex == NULL) {
@@ -284,10 +284,13 @@
 		return NULL;
 	}
 
+	/* for redraw only */
+	WM_event_add_notifier(C, NC_TEXTURE, CTX_data_scene(C));
+
 	return mtex;
 }
 
-MTex *rna_mtex_texture_slots_create(ID *self_id, ReportList *reports, int index)
+MTex *rna_mtex_texture_slots_create(ID *self_id, struct bContext *C, ReportList *reports, int index)
 {
 	MTex *mtex;
 
@@ -298,10 +301,13 @@
 
 	mtex= add_mtex_id(self_id, index);
 
+	/* for redraw only */
+	WM_event_add_notifier(C, NC_TEXTURE, CTX_data_scene(C));
+
 	return mtex;
 }
 
-void rna_mtex_texture_slots_clear(ID *self_id, ReportList *reports, int index)
+void rna_mtex_texture_slots_clear(ID *self_id, struct bContext *C, ReportList *reports, int index)
 {
 	MTex **mtex_ar;
 	short act;
@@ -323,6 +329,9 @@
 		MEM_freeN(mtex_ar[index]);
 		mtex_ar[index]= NULL;
 	}
+
+	/* for redraw only */
+	WM_event_add_notifier(C, NC_TEXTURE, CTX_data_scene(C));
 }
 
 #else
@@ -1841,13 +1850,13 @@
 	/* functions */
 	func= RNA_def_function(srna, "add", "rna_mtex_texture_slots_add");
 	RNA_def_function_ui_description(func, "Add a number of points to this spline.");
-	RNA_def_function_flag(func, FUNC_USE_SELF_ID|FUNC_NO_SELF|FUNC_USE_REPORTS);
+	RNA_def_function_flag(func, FUNC_USE_SELF_ID|FUNC_NO_SELF|FUNC_USE_CONTEXT|FUNC_USE_REPORTS);
 	parm= RNA_def_pointer(func, "mtex", structname, "", "The newly initialized mtex.");
 	RNA_def_function_return(func, parm);
 	
 	func= RNA_def_function(srna, "create", "rna_mtex_texture_slots_create");
 	RNA_def_function_ui_description(func, "Add a number of points to this spline.");
-	RNA_def_function_flag(func, FUNC_USE_SELF_ID|FUNC_NO_SELF|FUNC_USE_REPORTS);
+	RNA_def_function_flag(func, FUNC_USE_SELF_ID|FUNC_NO_SELF|FUNC_USE_CONTEXT|FUNC_USE_REPORTS);
 	parm= RNA_def_int(func, "index", 0, 0, INT_MAX, "Index", "Slot index to initialize.", 0, INT_MAX);
 	RNA_def_property_flag(parm, PROP_REQUIRED);
 	parm= RNA_def_pointer(func, "mtex", structname, "", "The newly initialized mtex.");
@@ -1855,7 +1864,7 @@
 	
 	func= RNA_def_function(srna, "clear", "rna_mtex_texture_slots_clear");
 	RNA_def_function_ui_description(func, "Add a number of points to this spline.");
-	RNA_def_function_flag(func, FUNC_USE_SELF_ID|FUNC_NO_SELF|FUNC_USE_REPORTS);
+	RNA_def_function_flag(func, FUNC_USE_SELF_ID|FUNC_NO_SELF|FUNC_USE_CONTEXT|FUNC_USE_REPORTS);
 	parm= RNA_def_int(func, "index", 0, 0, INT_MAX, "Index", "Slot index to clar.", 0, INT_MAX);
 	RNA_def_property_flag(parm, PROP_REQUIRED);
 }




More information about the Bf-blender-cvs mailing list