After talking with Matt about this, added notifier NC_ID to handle ID changes, specif...
authorElia Sarti <vekoon@gmail.com>
Wed, 25 Nov 2009 23:13:47 +0000 (23:13 +0000)
committerElia Sarti <vekoon@gmail.com>
Wed, 25 Nov 2009 23:13:47 +0000 (23:13 +0000)
source/blender/editors/space_buttons/space_buttons.c
source/blender/editors/space_outliner/outliner.c
source/blender/editors/space_outliner/space_outliner.c
source/blender/editors/space_view3d/space_view3d.c
source/blender/makesrna/intern/rna_ID.c
source/blender/windowmanager/WM_types.h

index 2c918bd9b30a30afbdda0177414e3c347e59922f..de8a1616496d06530f695924c26ac7b4d7293385 100644 (file)
@@ -308,6 +308,10 @@ static void buttons_area_listener(ScrArea *sa, wmNotifier *wmn)
                        if(wmn->data == ND_SPACE_PROPERTIES)
                                ED_area_tag_redraw(sa);
                        break;
+               case NC_ID:
+                       if(wmn->data == ND_ID_RENAME)
+                               ED_area_tag_redraw(sa);
+                       break;
        }
 
        if(wmn->data == ND_KEYS)
index 39eecd7d2de8526833226071c41d6b9466e81fe5..bfb1724af3557b35d6a82472bfbdce97036d05aa 100644 (file)
@@ -4747,7 +4747,7 @@ static void namebutton_cb(bContext *C, void *tsep, char *oldname)
                                case ID_SCE:
                                        WM_event_add_notifier(C, NC_SCENE, NULL); break;
                                default:
-                                       WM_event_add_notifier(C, NC_MATERIAL, NULL); break;
+                                       WM_event_add_notifier(C, NC_ID|ND_ID_RENAME, NULL); break;
                        }                                       
                        /* Check the library target exists */
                        if (te->idcode == ID_LI) {
index 5c6a8701f18db34d0d1e27095f7f7a161188c2c8..e3fbb13ed7d24e356ea3dda2096321ba7abf614a 100644 (file)
@@ -147,6 +147,10 @@ static void outliner_main_area_listener(ARegion *ar, wmNotifier *wmn)
                        if(wmn->data == ND_SPACE_OUTLINER)
                                ED_region_tag_redraw(ar);
                                break;
+               case NC_ID:
+                       if(wmn->data == ND_ID_RENAME)
+                               ED_region_tag_redraw(ar);
+                               break;
        }
        
 }
index d11eee466ed3925ad0c6ee61c7991f6eb8cf2c3b..787df5150f48c622975c3ad4b82a6b1b08d1b5ee 100644 (file)
@@ -517,6 +517,10 @@ static void view3d_main_area_listener(ARegion *ar, wmNotifier *wmn)
                        if(wmn->data == ND_SPACE_VIEW3D)
                                ED_region_tag_redraw(ar);
                        break;
+               case NC_ID:
+                       if(wmn->data == ND_ID_RENAME)
+                               ED_region_tag_redraw(ar);
+                       break;
        }
 }
 
@@ -639,6 +643,10 @@ static void view3d_buttons_area_listener(ARegion *ar, wmNotifier *wmn)
                        if(wmn->data == ND_SPACE_VIEW3D)
                                ED_region_tag_redraw(ar);
                        break;
+               case NC_ID:
+                       if(wmn->data == ND_ID_RENAME)
+                               ED_region_tag_redraw(ar);
+                       break;
        }
 }
 
index cb1a1211d24cfa27173bd27ce05dfc1150dff110..3bcdf373c432c34c61b1c7d56d653f1d58db71b2 100644 (file)
@@ -31,6 +31,8 @@
 
 #include "DNA_ID.h"
 
+#include "WM_types.h"
+
 #include "rna_internal.h"
 
 /* enum of ID-block types 
@@ -301,6 +303,7 @@ static void rna_def_ID(BlenderRNA *brna)
        RNA_def_property_ui_text(prop, "Name", "Unique datablock ID name.");
        RNA_def_property_string_funcs(prop, "rna_ID_name_get", "rna_ID_name_length", "rna_ID_name_set");
        RNA_def_property_string_maxlength(prop, sizeof(((ID*)NULL)->name)-2);
+       RNA_def_property_update(prop, NC_ID|ND_ID_RENAME, NULL);
        RNA_def_struct_name_property(srna, prop);
 
        prop= RNA_def_property(srna, "users", PROP_INT, PROP_UNSIGNED);
index 3f0c52f0f2ce5e89e1e86619bace8fa55f783376..53cca69fffcf7f90ad8fe5c0177d6406d6e15455 100644 (file)
@@ -136,6 +136,7 @@ typedef struct wmNotifier {
 #define NC_SPACE                       (15<<24)
 #define        NC_GEOM                         (16<<24)
 #define NC_NODE                                (17<<24)
+#define NC_ID                          (18<<24)
 
 /* data type, 256 entries is enough, it can overlap */
 #define NOTE_DATA                      0x00FF0000
@@ -215,6 +216,9 @@ typedef struct wmNotifier {
        /* NC_NODE Nodes */
 #define ND_NODE_SELECT                 (1<<16)
 
+       /* NC_ID IDs */
+#define ND_ID_RENAME                   (1<<16)
+
 
        /* NC_SPACE */
 #define ND_SPACE_CONSOLE               (1<<16) /* general redraw */