diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-01-18 02:30:28 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-01-18 02:30:28 +0300 |
commit | 44fdde569551679a4568f5c6005e9c70f5d98816 (patch) | |
tree | 8cbcc4a6845e38c35d48bab0b7df866354ab7135 /source/blender/makesrna/intern/rna_material.c | |
parent | 1a0d88a10825a692291be27385103820477a851a (diff) |
fix missing notifier [#25682] bpy.data.materials['XXX'].texture_slot.clear(0) dosen't delete texture from screen
Diffstat (limited to 'source/blender/makesrna/intern/rna_material.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_material.c | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/source/blender/makesrna/intern/rna_material.c b/source/blender/makesrna/intern/rna_material.c index 0fdb42f9146..aecb89a0fee 100644 --- a/source/blender/makesrna/intern/rna_material.c +++ b/source/blender/makesrna/intern/rna_material.c @@ -276,7 +276,7 @@ static EnumPropertyItem *rna_Material_texture_coordinates_itemf(bContext *C, Poi 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 @@ MTex *rna_mtex_texture_slots_add(ID *self_id, ReportList *reports) 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 *rna_mtex_texture_slots_create(ID *self_id, ReportList *reports, int index) 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 @@ void rna_mtex_texture_slots_clear(ID *self_id, ReportList *reports, int index) 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 @@ static void rna_def_texture_slots(BlenderRNA *brna, PropertyRNA *cprop, const ch /* 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 @@ static void rna_def_texture_slots(BlenderRNA *brna, PropertyRNA *cprop, const ch 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); } |