Revision: 32708
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=32708
Author: campbellbarton
Date: 2010-10-25 23:57:45 +0200 (Mon, 25 Oct 2010)
Log Message:
-----------
Added function RNA_property_update_check() to check if an update call is needed,
Simple python benchmark shows this to be about 3x faster in the case where an
update isn't needed.
This also speeds up rna function argument parsing, since each arg in a function
call did 2 string lookups on the context which were never needed.
Modified Paths:
--------------
trunk/blender/source/blender/makesrna/RNA_access.h
trunk/blender/source/blender/makesrna/intern/rna_access.c
trunk/blender/source/blender/python/intern/bpy_rna.c
trunk/blender/source/gameengine/BlenderRoutines/CMakeLists.txt
trunk/blender/source/gameengine/Converter/CMakeLists.txt
trunk/blender/source/gameengine/GamePlayer/common/CMakeLists.txt
trunk/blender/source/gameengine/GamePlayer/ghost/CMakeLists.txt
trunk/blender/source/gameengine/Ketsji/CMakeLists.txt
trunk/blender/source/gameengine/Physics/common/CMakeLists.txt
trunk/blender/source/gameengine/VideoTexture/CMakeLists.txt
Modified: trunk/blender/source/blender/makesrna/RNA_access.h
===================================================================
--- trunk/blender/source/blender/makesrna/RNA_access.h 2010-10-25 18:12:28 UTC
(rev 32707)
+++ trunk/blender/source/blender/makesrna/RNA_access.h 2010-10-25 21:57:45 UTC
(rev 32708)
@@ -681,6 +681,7 @@
void RNA_property_update(struct bContext *C, PointerRNA *ptr, PropertyRNA
*prop);
void RNA_property_update_main(struct Main *bmain, struct Scene *scene,
PointerRNA *ptr, PropertyRNA *prop);
+int RNA_property_update_check(struct PropertyRNA *prop);
/* Property Data */
Modified: trunk/blender/source/blender/makesrna/intern/rna_access.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_access.c 2010-10-25
18:12:28 UTC (rev 32707)
+++ trunk/blender/source/blender/makesrna/intern/rna_access.c 2010-10-25
21:57:45 UTC (rev 32708)
@@ -1268,6 +1268,14 @@
}
+/* must keep in sync with 'rna_property_update'
+ * note, its possible this returns a false positive in the case of
PROP_CONTEXT_UPDATE
+ * but this isnt likely to be a performance problem. */
+int RNA_property_update_check(PropertyRNA *prop)
+{
+ return (prop->magic != RNA_MAGIC || prop->update || prop->noteflag);
+}
+
void RNA_property_update(bContext *C, PointerRNA *ptr, PropertyRNA *prop)
{
rna_property_update(C, CTX_data_main(C), CTX_data_scene(C), ptr, prop);
Modified: trunk/blender/source/blender/python/intern/bpy_rna.c
===================================================================
--- trunk/blender/source/blender/python/intern/bpy_rna.c 2010-10-25
18:12:28 UTC (rev 32707)
+++ trunk/blender/source/blender/python/intern/bpy_rna.c 2010-10-25
21:57:45 UTC (rev 32708)
@@ -120,7 +120,9 @@
}
RNA_property_float_set_array(&self->ptr, self->prop, bmo->data);
- RNA_property_update(BPy_GetContext(), &self->ptr, self->prop);
+ if(RNA_property_update_check(self->prop)) {
+ RNA_property_update(BPy_GetContext(), &self->ptr, self->prop);
+ }
/* Euler order exception */
if(subtype==MATHUTILS_CB_SUBTYPE_EUL) {
@@ -129,7 +131,9 @@
short order= pyrna_rotation_euler_order_get(&self->ptr,
&prop_eul_order, eul->order);
if(order != eul->order) {
RNA_property_enum_set(&self->ptr, prop_eul_order,
eul->order);
- RNA_property_update(BPy_GetContext(), &self->ptr,
prop_eul_order);
+ if(RNA_property_update_check(prop_eul_order)) {
+ RNA_property_update(BPy_GetContext(),
&self->ptr, prop_eul_order);
+ }
}
}
return 1;
@@ -160,7 +164,11 @@
RNA_property_float_clamp(&self->ptr, self->prop, &bmo->data[index]);
RNA_property_float_set_index(&self->ptr, self->prop, index,
bmo->data[index]);
- RNA_property_update(BPy_GetContext(), &self->ptr, self->prop);
+
+ if(RNA_property_update_check(self->prop)) {
+ RNA_property_update(BPy_GetContext(), &self->ptr, self->prop);
+ }
+
return 1;
}
@@ -201,7 +209,10 @@
/* can ignore clamping here */
RNA_property_float_set_array(&self->ptr, self->prop, bmo->data);
- RNA_property_update(BPy_GetContext(), &self->ptr, self->prop);
+
+ if(RNA_property_update_check(self->prop)) {
+ RNA_property_update(BPy_GetContext(), &self->ptr, self->prop);
+ }
return 1;
}
@@ -1235,7 +1246,9 @@
}
/* Run rna property functions */
- RNA_property_update(BPy_GetContext(), ptr, prop);
+ if(RNA_property_update_check(prop)) {
+ RNA_property_update(BPy_GetContext(), ptr, prop);
+ }
return 0;
}
@@ -1309,8 +1322,10 @@
}
/* Run rna property functions */
- RNA_property_update(BPy_GetContext(), ptr, prop);
-
+ if(RNA_property_update_check(prop)) {
+ RNA_property_update(BPy_GetContext(), ptr, prop);
+ }
+
return ret;
}
@@ -1720,7 +1735,9 @@
}
if(ret != -1) {
- RNA_property_update(BPy_GetContext(), &self->ptr, self->prop);
+ if(RNA_property_update_check(self->prop)) {
+ RNA_property_update(BPy_GetContext(), &self->ptr,
self->prop);
+ }
}
return ret;
Modified: trunk/blender/source/gameengine/BlenderRoutines/CMakeLists.txt
===================================================================
--- trunk/blender/source/gameengine/BlenderRoutines/CMakeLists.txt
2010-10-25 18:12:28 UTC (rev 32707)
+++ trunk/blender/source/gameengine/BlenderRoutines/CMakeLists.txt
2010-10-25 21:57:45 UTC (rev 32708)
@@ -8,7 +8,6 @@
../../../source/gameengine/Rasterizer/RAS_OpenGLRasterizer
../../../source/gameengine/Converter
../../../source/blender/imbuf
- ../../../intern/ghost/include
../../../intern/moto/include
../../../source/gameengine/Ketsji
../../../source/blender/blenlib
@@ -16,8 +15,7 @@
../../../source/blender/blenfont
../../../source/blender/editors/include
../../../source/blender/windowmanager
- ../../../source/blender
- ../../../source/blender/include
+ ../../../source/blender
../../../source/blender/makesdna
../../../source/blender/makesrna
../../../source/gameengine/Rasterizer
@@ -28,7 +26,6 @@
../../../source/gameengine/Physics/common
../../../source/gameengine/Physics/Bullet
../../../source/gameengine/Network/LoopBackNetwork
- ../../../source/blender/misc
../../../source/blender/blenloader
../../../source/blender/gpu
../../../extern/bullet2/src
Modified: trunk/blender/source/gameengine/Converter/CMakeLists.txt
===================================================================
--- trunk/blender/source/gameengine/Converter/CMakeLists.txt 2010-10-25
18:12:28 UTC (rev 32707)
+++ trunk/blender/source/gameengine/Converter/CMakeLists.txt 2010-10-25
21:57:45 UTC (rev 32708)
@@ -41,7 +41,6 @@
../../../source/blender/blenkernel
../../../source/blender/windowmanager
../../../source/blender
- ../../../source/blender/include
../../../source/blender/makesdna
../../../source/blender/makesrna
../../../source/gameengine/Rasterizer
@@ -54,7 +53,6 @@
../../../source/gameengine/Physics/Bullet
../../../source/gameengine/Physics/Dummy
../../../source/gameengine/Network/LoopBackNetwork
- ../../../source/blender/misc
../../../source/blender/blenloader
../../../source/blender/gpu
../../../source/blender/ikplugin
Modified: trunk/blender/source/gameengine/GamePlayer/common/CMakeLists.txt
===================================================================
--- trunk/blender/source/gameengine/GamePlayer/common/CMakeLists.txt
2010-10-25 18:12:28 UTC (rev 32707)
+++ trunk/blender/source/gameengine/GamePlayer/common/CMakeLists.txt
2010-10-25 21:57:45 UTC (rev 32708)
@@ -39,7 +39,6 @@
../../../../source/blender/blenlib
../../../../source/blender/blenkernel
../../../../source/blender
- ../../../../source/blender/include
../../../../source/blender/makesdna
../../../../source/gameengine/Rasterizer
../../../../source/gameengine/GameLogic
@@ -49,7 +48,6 @@
../../../../source/gameengine/Physics/common
../../../../source/gameengine/Network/LoopBackNetwork
../../../../source/gameengine/GamePlayer/ghost
- ../../../../source/blender/misc
../../../../source/blender/blenloader
../../../../source/blender/gpu
../../../../extern/glew/include
Modified: trunk/blender/source/gameengine/GamePlayer/ghost/CMakeLists.txt
===================================================================
--- trunk/blender/source/gameengine/GamePlayer/ghost/CMakeLists.txt
2010-10-25 18:12:28 UTC (rev 32707)
+++ trunk/blender/source/gameengine/GamePlayer/ghost/CMakeLists.txt
2010-10-25 21:57:45 UTC (rev 32708)
@@ -40,7 +40,6 @@
../../../../source/blender/blenkernel
../../../../source/blender/readblenfile
../../../../source/blender
- ../../../../source/blender/include
../../../../source/blender/makesdna
../../../../source/blender/makesrna
../../../../source/gameengine/Rasterizer
@@ -51,7 +50,6 @@
../../../../source/gameengine/Physics/common
../../../../source/gameengine/Network/LoopBackNetwork
../../../../source/gameengine/GamePlayer/common
- ../../../../source/blender/misc
../../../../source/blender/blenloader
../../../../source/blender/gpu
../../../../extern/glew/include
Modified: trunk/blender/source/gameengine/Ketsji/CMakeLists.txt
===================================================================
--- trunk/blender/source/gameengine/Ketsji/CMakeLists.txt 2010-10-25
18:12:28 UTC (rev 32707)
+++ trunk/blender/source/gameengine/Ketsji/CMakeLists.txt 2010-10-25
21:57:45 UTC (rev 32708)
@@ -32,7 +32,6 @@
../../../source/gameengine/Rasterizer/RAS_OpenGLRasterizer
../../../source/gameengine/Converter
../../../source/blender/imbuf
- ../../../intern/ghost/include
../../../intern/moto/include
../../../source/gameengine/Ketsji
../../../source/blender/blenlib
@@ -40,7 +39,6 @@
../../../source/blender/python
../../../source/blender/python/generic
../../../source/blender
- ../../../source/blender/include
../../../source/blender/makesdna
../../../source/gameengine/Rasterizer
../../../source/gameengine/GameLogic
@@ -51,7 +49,6 @@
../../../source/gameengine/Physics/common
../../../source/gameengine/Network/LoopBackNetwork
../../../intern/audaspace/intern
- ../../../source/blender/misc
../../../source/blender/blenloader
../../../source/blender/gpu
../../../extern/glew/include
Modified: trunk/blender/source/gameengine/Physics/common/CMakeLists.txt
===================================================================
--- trunk/blender/source/gameengine/Physics/common/CMakeLists.txt
2010-10-25 18:12:28 UTC (rev 32707)
+++ trunk/blender/source/gameengine/Physics/common/CMakeLists.txt
2010-10-25 21:57:45 UTC (rev 32708)
@@ -27,7 +27,6 @@
SET(INC
.
../Dummy
- ../../../intern/moto/include
)
SET(SRC
Modified: trunk/blender/source/gameengine/VideoTexture/CMakeLists.txt
===================================================================
--- trunk/blender/source/gameengine/VideoTexture/CMakeLists.txt 2010-10-25
18:12:28 UTC (rev 32707)
+++ trunk/blender/source/gameengine/VideoTexture/CMakeLists.txt 2010-10-25
21:57:45 UTC (rev 32708)
@@ -33,7 +33,6 @@
../../../source/gameengine/Rasterizer
../../../source/gameengine/Rasterizer/RAS_OpenGLRasterizer
../../../source/gameengine/BlenderRoutines
- ../../../source/blender/include
../../../source/blender/blenlib
../../../source/blender/blenkernel
../../../source/blender/makesdna
_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs