[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [24618] trunk/blender/source/blender/ makesrna/intern/rna_access.c: adjusting generic props in the UI refreshes the depgraph, this is weak but allows custom props to be used as drivers

Campbell Barton ideasman42 at gmail.com
Tue Nov 17 17:53:53 CET 2009


Revision: 24618
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=24618
Author:   campbellbarton
Date:     2009-11-17 17:53:52 +0100 (Tue, 17 Nov 2009)

Log Message:
-----------
adjusting generic props in the UI refreshes the depgraph, this is weak but allows custom props to be used as drivers

Modified Paths:
--------------
    trunk/blender/source/blender/makesrna/intern/rna_access.c

Modified: trunk/blender/source/blender/makesrna/intern/rna_access.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_access.c	2009-11-17 16:48:43 UTC (rev 24617)
+++ trunk/blender/source/blender/makesrna/intern/rna_access.c	2009-11-17 16:53:52 UTC (rev 24618)
@@ -45,6 +45,11 @@
 #include "RNA_define.h"
 #include "RNA_types.h"
 
+/* flush updates */
+#include "DNA_object_types.h"
+#include "BKE_depsgraph.h"
+#include "WM_types.h"
+
 #include "rna_internal.h"
 
 /* Init/Exit */
@@ -886,12 +891,21 @@
 
 void RNA_property_update(bContext *C, PointerRNA *ptr, PropertyRNA *prop)
 {
+	int is_rna = (prop->magic == RNA_MAGIC);
 	prop= rna_ensure_property(prop);
 
-	if(prop->update)
-		prop->update(C, ptr);
-	if(prop->noteflag)
-		WM_event_add_notifier(C, prop->noteflag, ptr->id.data);
+	if(is_rna) {
+		if(prop->update)
+			prop->update(C, ptr);
+		if(prop->noteflag)
+			WM_event_add_notifier(C, prop->noteflag, ptr->id.data);
+	}
+	else {
+		/* WARNING! This is so property drivers update the display!
+		 * not especially nice  */
+		DAG_id_flush_update(ptr->id.data, OB_RECALC_OB);
+		WM_event_add_notifier(C, NC_WINDOW, NULL);
+	}
 }
 
 /* Property Data */





More information about the Bf-blender-cvs mailing list