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:
authorJoshua Leung <aligorith@gmail.com>2009-09-08 06:09:14 +0400
committerJoshua Leung <aligorith@gmail.com>2009-09-08 06:09:14 +0400
commit6808e15c8d20819deddd6b175668d11a6c6f454d (patch)
tree5beae41d3b50753e3e328749f59b7dad8235bfd9 /source/blender/windowmanager
parent00838f05d23cbd2dfefeab10d9d5345bbad25ea6 (diff)
2.5 - Mode Switching Bugfixes
This commit some of the many bugs here (it's still not perfect now, but much better than it was): * Moving in/out of Object, Edit, and Pose Modes for Armatures should now work smoothly. Operators should work nicely in the appropriate modes now (select linked might be a bit tempermental still, since it uses mouse-position). * Fixed the 'mysterious' memory leaks when changing modes. These were only caused when using the mode switching menu in the 3D-View. * Went through bullet-proofing some of the operator calling functions against NULL operator id-name strings.
Diffstat (limited to 'source/blender/windowmanager')
-rw-r--r--source/blender/windowmanager/intern/wm_operators.c46
1 files changed, 27 insertions, 19 deletions
diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c
index b51fcfddc47..c7011777dbf 100644
--- a/source/blender/windowmanager/intern/wm_operators.c
+++ b/source/blender/windowmanager/intern/wm_operators.c
@@ -91,10 +91,12 @@ wmOperatorType *WM_operatortype_find(const char *idname, int quiet)
char idname_bl[OP_MAX_TYPENAME]; // XXX, needed to support python style names without the _OT_ syntax
WM_operator_bl_idname(idname_bl, idname);
-
- for(ot= global_ops.first; ot; ot= ot->next) {
- if(strncmp(ot->idname, idname_bl, OP_MAX_TYPENAME)==0)
- return ot;
+
+ if (idname_bl[0]) {
+ for(ot= global_ops.first; ot; ot= ot->next) {
+ if(strncmp(ot->idname, idname_bl, OP_MAX_TYPENAME)==0)
+ return ot;
+ }
}
if(!quiet)
@@ -109,10 +111,12 @@ wmOperatorType *WM_operatortype_exists(const char *idname)
char idname_bl[OP_MAX_TYPENAME]; // XXX, needed to support python style names without the _OT_ syntax
WM_operator_bl_idname(idname_bl, idname);
-
- for(ot= global_ops.first; ot; ot= ot->next) {
- if(strncmp(ot->idname, idname_bl, OP_MAX_TYPENAME)==0)
- return ot;
+
+ if(idname_bl[0]) {
+ for(ot= global_ops.first; ot; ot= ot->next) {
+ if(strncmp(ot->idname, idname_bl, OP_MAX_TYPENAME)==0)
+ return ot;
+ }
}
return NULL;
}
@@ -322,21 +326,25 @@ void WM_operator_py_idname(char *to, const char *from)
/* some.op -> SOME_OT_op */
void WM_operator_bl_idname(char *to, const char *from)
{
- char *sep= strchr(from, '.');
+ if (from) {
+ char *sep= strchr(from, '.');
- if(sep) {
- int i, ofs= (sep-from);
+ if(sep) {
+ int i, ofs= (sep-from);
- for(i=0; i<ofs; i++)
- to[i]= toupper(from[i]);
+ for(i=0; i<ofs; i++)
+ to[i]= toupper(from[i]);
- BLI_strncpy(to+ofs, "_OT_", OP_MAX_TYPENAME);
- BLI_strncpy(to+(ofs+4), sep+1, OP_MAX_TYPENAME);
- }
- else {
- /* should not happen but support just incase */
- BLI_strncpy(to, from, OP_MAX_TYPENAME);
+ BLI_strncpy(to+ofs, "_OT_", OP_MAX_TYPENAME);
+ BLI_strncpy(to+(ofs+4), sep+1, OP_MAX_TYPENAME);
+ }
+ else {
+ /* should not happen but support just incase */
+ BLI_strncpy(to, from, OP_MAX_TYPENAME);
+ }
}
+ else
+ to[0]= 0;
}
/* print a string representation of the operator, with the args that it runs