Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2010-10-26 01:57:45 +0400
committerCampbell Barton <ideasman42@gmail.com>2010-10-26 01:57:45 +0400
commit29605fc06ddd8fb9a5d80df1389a0cbfb150c9b9 (patch)
tree1d951c993e2e31732feaa84263f9c31204173072
parent82fd7f21fc36e44f5948f2aacabc10aaa36250c7 (diff)
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.
-rw-r--r--source/blender/makesrna/RNA_access.h1
-rw-r--r--source/blender/makesrna/intern/rna_access.c8
-rw-r--r--source/blender/python/intern/bpy_rna.c33
-rw-r--r--source/gameengine/BlenderRoutines/CMakeLists.txt5
-rw-r--r--source/gameengine/Converter/CMakeLists.txt2
-rw-r--r--source/gameengine/GamePlayer/common/CMakeLists.txt2
-rw-r--r--source/gameengine/GamePlayer/ghost/CMakeLists.txt2
-rw-r--r--source/gameengine/Ketsji/CMakeLists.txt3
-rw-r--r--source/gameengine/Physics/common/CMakeLists.txt1
-rw-r--r--source/gameengine/VideoTexture/CMakeLists.txt1
10 files changed, 35 insertions, 23 deletions
diff --git a/source/blender/makesrna/RNA_access.h b/source/blender/makesrna/RNA_access.h
index ab1319653b8..1ec65c0e59b 100644
--- a/source/blender/makesrna/RNA_access.h
+++ b/source/blender/makesrna/RNA_access.h
@@ -681,6 +681,7 @@ int RNA_property_animated(PointerRNA *ptr, PropertyRNA *prop);
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 */
diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c
index 6cb5858648a..6cdb842fbc2 100644
--- a/source/blender/makesrna/intern/rna_access.c
+++ b/source/blender/makesrna/intern/rna_access.c
@@ -1268,6 +1268,14 @@ static void rna_property_update(bContext *C, Main *bmain, Scene *scene, PointerR
}
+/* 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);
diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c
index a3b0c4739c4..2bffd7f6b88 100644
--- a/source/blender/python/intern/bpy_rna.c
+++ b/source/blender/python/intern/bpy_rna.c
@@ -120,7 +120,9 @@ static int mathutils_rna_vector_set(BaseMathObject *bmo, int subtype)
}
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 @@ static int mathutils_rna_vector_set(BaseMathObject *bmo, int subtype)
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 @@ static int mathutils_rna_vector_set_index(BaseMathObject *bmo, int UNUSED(subtyp
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 @@ static int mathutils_rna_matrix_set(BaseMathObject *bmo, int UNUSED(subtype))
/* 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 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb
}
/* 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 @@ static int pyrna_py_to_prop_array_index(BPy_PropertyArrayRNA *self, int index, P
}
/* 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 @@ static int pyrna_prop_array_ass_subscript( BPy_PropertyArrayRNA *self, PyObject
}
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;
diff --git a/source/gameengine/BlenderRoutines/CMakeLists.txt b/source/gameengine/BlenderRoutines/CMakeLists.txt
index 661f9c5b25d..7abdeba0740 100644
--- a/source/gameengine/BlenderRoutines/CMakeLists.txt
+++ b/source/gameengine/BlenderRoutines/CMakeLists.txt
@@ -8,7 +8,6 @@ SET(INC
../../../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 @@ SET(INC
../../../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 @@ SET(INC
../../../source/gameengine/Physics/common
../../../source/gameengine/Physics/Bullet
../../../source/gameengine/Network/LoopBackNetwork
- ../../../source/blender/misc
../../../source/blender/blenloader
../../../source/blender/gpu
../../../extern/bullet2/src
diff --git a/source/gameengine/Converter/CMakeLists.txt b/source/gameengine/Converter/CMakeLists.txt
index e6b5f6c81a0..a23629e3341 100644
--- a/source/gameengine/Converter/CMakeLists.txt
+++ b/source/gameengine/Converter/CMakeLists.txt
@@ -41,7 +41,6 @@ SET(INC
../../../source/blender/blenkernel
../../../source/blender/windowmanager
../../../source/blender
- ../../../source/blender/include
../../../source/blender/makesdna
../../../source/blender/makesrna
../../../source/gameengine/Rasterizer
@@ -54,7 +53,6 @@ SET(INC
../../../source/gameengine/Physics/Bullet
../../../source/gameengine/Physics/Dummy
../../../source/gameengine/Network/LoopBackNetwork
- ../../../source/blender/misc
../../../source/blender/blenloader
../../../source/blender/gpu
../../../source/blender/ikplugin
diff --git a/source/gameengine/GamePlayer/common/CMakeLists.txt b/source/gameengine/GamePlayer/common/CMakeLists.txt
index 47ac7f73a51..02c0cb8a83c 100644
--- a/source/gameengine/GamePlayer/common/CMakeLists.txt
+++ b/source/gameengine/GamePlayer/common/CMakeLists.txt
@@ -39,7 +39,6 @@ SET(INC
../../../../source/blender/blenlib
../../../../source/blender/blenkernel
../../../../source/blender
- ../../../../source/blender/include
../../../../source/blender/makesdna
../../../../source/gameengine/Rasterizer
../../../../source/gameengine/GameLogic
@@ -49,7 +48,6 @@ SET(INC
../../../../source/gameengine/Physics/common
../../../../source/gameengine/Network/LoopBackNetwork
../../../../source/gameengine/GamePlayer/ghost
- ../../../../source/blender/misc
../../../../source/blender/blenloader
../../../../source/blender/gpu
../../../../extern/glew/include
diff --git a/source/gameengine/GamePlayer/ghost/CMakeLists.txt b/source/gameengine/GamePlayer/ghost/CMakeLists.txt
index 6ce9f7be280..b6e381359df 100644
--- a/source/gameengine/GamePlayer/ghost/CMakeLists.txt
+++ b/source/gameengine/GamePlayer/ghost/CMakeLists.txt
@@ -40,7 +40,6 @@ SET(INC
../../../../source/blender/blenkernel
../../../../source/blender/readblenfile
../../../../source/blender
- ../../../../source/blender/include
../../../../source/blender/makesdna
../../../../source/blender/makesrna
../../../../source/gameengine/Rasterizer
@@ -51,7 +50,6 @@ SET(INC
../../../../source/gameengine/Physics/common
../../../../source/gameengine/Network/LoopBackNetwork
../../../../source/gameengine/GamePlayer/common
- ../../../../source/blender/misc
../../../../source/blender/blenloader
../../../../source/blender/gpu
../../../../extern/glew/include
diff --git a/source/gameengine/Ketsji/CMakeLists.txt b/source/gameengine/Ketsji/CMakeLists.txt
index 68f0a0de994..2813160fb82 100644
--- a/source/gameengine/Ketsji/CMakeLists.txt
+++ b/source/gameengine/Ketsji/CMakeLists.txt
@@ -32,7 +32,6 @@ SET(INC
../../../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 @@ SET(INC
../../../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 @@ SET(INC
../../../source/gameengine/Physics/common
../../../source/gameengine/Network/LoopBackNetwork
../../../intern/audaspace/intern
- ../../../source/blender/misc
../../../source/blender/blenloader
../../../source/blender/gpu
../../../extern/glew/include
diff --git a/source/gameengine/Physics/common/CMakeLists.txt b/source/gameengine/Physics/common/CMakeLists.txt
index 0389280340f..f67de0f77d0 100644
--- a/source/gameengine/Physics/common/CMakeLists.txt
+++ b/source/gameengine/Physics/common/CMakeLists.txt
@@ -27,7 +27,6 @@
SET(INC
.
../Dummy
- ../../../intern/moto/include
)
SET(SRC
diff --git a/source/gameengine/VideoTexture/CMakeLists.txt b/source/gameengine/VideoTexture/CMakeLists.txt
index 1c624482d30..eb623065a75 100644
--- a/source/gameengine/VideoTexture/CMakeLists.txt
+++ b/source/gameengine/VideoTexture/CMakeLists.txt
@@ -33,7 +33,6 @@ SET(INC
../../../source/gameengine/Rasterizer
../../../source/gameengine/Rasterizer/RAS_OpenGLRasterizer
../../../source/gameengine/BlenderRoutines
- ../../../source/blender/include
../../../source/blender/blenlib
../../../source/blender/blenkernel
../../../source/blender/makesdna