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:
authorMitchell Stokes <mogurijin@gmail.com>2010-05-30 01:22:24 +0400
committerMitchell Stokes <mogurijin@gmail.com>2010-05-30 01:22:24 +0400
commit9d3157eed000e7c543d04f5ad3efc5990675903b (patch)
tree54d3fcbc7a128ef0881385f49c57392c38bbd7e0 /source/blender
parente335321e884f270e2ad28a7b6c75eea7e11bf4b7 (diff)
Reversing the last merge because I botched it.
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/editors/interface/interface_handlers.c29
-rw-r--r--source/blender/editors/sound/sound_ops.c42
-rw-r--r--source/blender/editors/space_view3d/view3d_edit.c4
-rw-r--r--source/blender/makesdna/DNA_object_types.h1
-rw-r--r--source/blender/makesrna/intern/rna_object.c3
-rw-r--r--source/blender/python/generic/blf_api.c2
-rw-r--r--source/blender/windowmanager/wm_event_types.h2
7 files changed, 24 insertions, 59 deletions
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c
index 4e3ffad48ae..fb0822de677 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -1659,7 +1659,7 @@ static void ui_do_but_textedit(bContext *C, uiBlock *block, uiBut *but, uiHandle
my= event->y;
ui_window_to_block(data->region, block, &mx, &my);
- if (ui_mouse_inside_button(data->region, but, mx, my)) {
+ if ((but->y1 <= my) && (my <= but->y2) && (but->x1 <= mx) && (mx <= but->x2)) {
ui_textedit_set_cursor_pos(but, data, mx);
but->selsta = but->selend = but->pos;
data->selstartx= mx;
@@ -1999,17 +1999,14 @@ static int ui_do_but_HOTKEYEVT(bContext *C, uiBut *but, uiHandleButtonData *data
if(event->type == MOUSEMOVE)
return WM_UI_HANDLER_CONTINUE;
- if(event->type == LEFTMOUSE && event->val==KM_PRESS) {
- /* only cancel if click outside the button */
- if(ui_mouse_inside_button(but->active->region, but, event->x, event->y) == 0) {
- /* data->cancel doesnt work, this button opens immediate */
- if(but->flag & UI_BUT_IMMEDIATE)
- ui_set_but_val(but, 0);
- else
- data->cancel= 1;
- button_activate_state(C, but, BUTTON_STATE_EXIT);
- return WM_UI_HANDLER_BREAK;
- }
+ if(event->type == ESCKEY) {
+ /* data->cancel doesnt work, this button opens immediate */
+ if(but->flag & UI_BUT_IMMEDIATE)
+ ui_set_but_val(but, 0);
+ else
+ data->cancel= 1;
+ button_activate_state(C, but, BUTTON_STATE_EXIT);
+ return WM_UI_HANDLER_BREAK;
}
/* always set */
@@ -2043,11 +2040,15 @@ static int ui_do_but_HOTKEYEVT(bContext *C, uiBut *but, uiHandleButtonData *data
return WM_UI_HANDLER_CONTINUE;
}
+
static int ui_do_but_KEYEVT(bContext *C, uiBut *but, uiHandleButtonData *data, wmEvent *event)
{
if(data->state == BUTTON_STATE_HIGHLIGHT) {
if(ELEM3(event->type, LEFTMOUSE, PADENTER, RETKEY) && event->val==KM_PRESS) {
- button_activate_state(C, but, BUTTON_STATE_WAIT_KEY_EVENT);
+ short event= (short)ui_get_but_val(but);
+ /* hardcoded prevention from editing or assigning ESC */
+ if(event!=ESCKEY)
+ button_activate_state(C, but, BUTTON_STATE_WAIT_KEY_EVENT);
return WM_UI_HANDLER_BREAK;
}
}
@@ -2056,7 +2057,7 @@ static int ui_do_but_KEYEVT(bContext *C, uiBut *but, uiHandleButtonData *data, w
return WM_UI_HANDLER_CONTINUE;
if(event->val==KM_PRESS) {
- if(WM_key_event_string(event->type)[0])
+ if(event->type!=ESCKEY && WM_key_event_string(event->type)[0])
ui_set_but_val(but, event->type);
else
data->cancel= 1;
diff --git a/source/blender/editors/sound/sound_ops.c b/source/blender/editors/sound/sound_ops.c
index be4f6ff0570..376db0d3d58 100644
--- a/source/blender/editors/sound/sound_ops.c
+++ b/source/blender/editors/sound/sound_ops.c
@@ -30,13 +30,10 @@
#include <stdlib.h>
#include <stdio.h>
-#include "MEM_guardedalloc.h"
-
#include "DNA_packedFile_types.h"
#include "DNA_scene_types.h"
#include "DNA_space_types.h"
#include "DNA_sequence_types.h"
-#include "DNA_userdef_types.h"
#include "BKE_context.h"
#include "BKE_global.h"
@@ -64,30 +61,17 @@
/******************** open sound operator ********************/
-static void open_init(bContext *C, wmOperator *op)
-{
- PropertyPointerRNA *pprop;
-
- op->customdata= pprop= MEM_callocN(sizeof(PropertyPointerRNA), "OpenPropertyPointerRNA");
- uiIDContextProperty(C, &pprop->ptr, &pprop->prop);
-}
-
static int open_exec(bContext *C, wmOperator *op)
{
char path[FILE_MAX];
bSound *sound;
- PropertyPointerRNA *pprop;
- PointerRNA idptr;
AUD_SoundInfo info;
RNA_string_get(op->ptr, "path", path);
+
sound = sound_new_file(CTX_data_main(C), path);
- if(!op->customdata)
- open_init(C, op);
-
if (sound==NULL || sound->playback_handle == NULL) {
- if(op->customdata) MEM_freeN(op->customdata);
BKE_report(op->reports, RPT_ERROR, "Unsupported audio format");
return OPERATOR_CANCELLED;
}
@@ -96,7 +80,6 @@ static int open_exec(bContext *C, wmOperator *op)
if (info.specs.channels == AUD_CHANNELS_INVALID) {
sound_delete(C, sound);
- if(op->customdata) MEM_freeN(op->customdata);
BKE_report(op->reports, RPT_ERROR, "Unsupported audio format");
return OPERATOR_CANCELLED;
}
@@ -104,34 +87,12 @@ static int open_exec(bContext *C, wmOperator *op)
if (RNA_boolean_get(op->ptr, "cache")) {
sound_cache(sound, 0);
}
-
- /* hook into UI */
- pprop= op->customdata;
-
- if(pprop->prop) {
- /* when creating new ID blocks, use is already 1, but RNA
- * pointer se also increases user, so this compensates it */
- sound->id.us--;
-
- RNA_id_pointer_create(&sound->id, &idptr);
- RNA_property_pointer_set(&pprop->ptr, pprop->prop, idptr);
- RNA_property_update(C, &pprop->ptr, pprop->prop);
- }
- MEM_freeN(op->customdata);
return OPERATOR_FINISHED;
}
static int open_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
- if(!RNA_property_is_set(op->ptr, "relative_path"))
- RNA_boolean_set(op->ptr, "relative_path", U.flag & USER_RELPATHS);
-
- if(RNA_property_is_set(op->ptr, "path"))
- return open_exec(C, op);
-
- open_init(C, op);
-
return WM_operator_filesel(C, op, event);
}
@@ -152,7 +113,6 @@ void SOUND_OT_open(wmOperatorType *ot)
/* properties */
WM_operator_properties_filesel(ot, FOLDERFILE|SOUNDFILE|MOVIEFILE, FILE_SPECIAL, FILE_OPENFILE);
RNA_def_boolean(ot->srna, "cache", FALSE, "Cache", "Cache the sound in memory.");
- RNA_def_boolean(ot->srna, "relative_path", FALSE, "Relative Path", "Load image with relative path to current .blend file");
}
/* ******************************************************* */
diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c
index 5c2fe184d65..3d039f07a65 100644
--- a/source/blender/editors/space_view3d/view3d_edit.c
+++ b/source/blender/editors/space_view3d/view3d_edit.c
@@ -1157,8 +1157,8 @@ static int viewzoom_invoke(bContext *C, wmOperator *op, wmEvent *event)
else {
/* Set y move = x move as MOUSEZOOM uses only x axis to pass magnification value */
- vod->origy = vod->oldy = vod->origy + event->x - event->prevx;
- viewzoom_apply(vod, event->prevx, event->prevy, USER_ZOOM_DOLLY);
+ vod->origy = vod->oldy = event->x;
+ viewzoom_apply(vod, event->x, event->prevx, USER_ZOOM_DOLLY);
}
request_depth_update(CTX_wm_region_view3d(C));
diff --git a/source/blender/makesdna/DNA_object_types.h b/source/blender/makesdna/DNA_object_types.h
index 9649b8351a6..e6b2e9a056c 100644
--- a/source/blender/makesdna/DNA_object_types.h
+++ b/source/blender/makesdna/DNA_object_types.h
@@ -402,6 +402,7 @@ extern Object workob;
#define OB_BOUND_POLYH 4
#define OB_BOUND_POLYT 5
#define OB_BOUND_DYN_MESH 6
+#define OB_BOUND_CAPSULE 7
/* **************** BASE ********************* */
diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c
index 12c4bb79e37..6e7a06af3ab 100644
--- a/source/blender/makesrna/intern/rna_object.c
+++ b/source/blender/makesrna/intern/rna_object.c
@@ -73,6 +73,7 @@ static EnumPropertyItem collision_bounds_items[] = {
{OB_BOUND_CONE, "CONE", 0, "Cone", ""},
{OB_BOUND_POLYT, "CONVEX_HULL", 0, "Convex Hull", ""},
{OB_BOUND_POLYH, "TRIANGLE_MESH", 0, "Triangle Mesh", ""},
+ {OB_BOUND_CAPSULE, "CAPSULE", 0, "Capsule", ""},
//{OB_DYN_MESH, "DYNAMIC_MESH", 0, "Dynamic Mesh", ""},
{0, NULL, 0, NULL, NULL}};
@@ -329,6 +330,7 @@ static EnumPropertyItem *rna_Object_collision_bounds_itemf(bContext *C, PointerR
RNA_enum_items_add_value(&item, &totitem, collision_bounds_items, OB_BOUND_CYLINDER);
RNA_enum_items_add_value(&item, &totitem, collision_bounds_items, OB_BOUND_SPHERE);
RNA_enum_items_add_value(&item, &totitem, collision_bounds_items, OB_BOUND_BOX);
+ RNA_enum_items_add_value(&item, &totitem, collision_bounds_items, OB_BOUND_CAPSULE);
}
RNA_enum_item_end(&item, &totitem);
@@ -1443,6 +1445,7 @@ static void rna_def_object(BlenderRNA *brna)
{OB_BOUND_SPHERE, "SPHERE", 0, "Sphere", ""},
{OB_BOUND_CYLINDER, "CYLINDER", 0, "Cylinder", ""},
{OB_BOUND_CONE, "CONE", 0, "Cone", ""},
+ {OB_BOUND_CAPSULE, "CAPSULE", 0, "Capsule", ""},
{OB_BOUND_POLYH, "POLYHEDER", 0, "Polyheder", ""},
{0, NULL, 0, NULL, NULL}};
diff --git a/source/blender/python/generic/blf_api.c b/source/blender/python/generic/blf_api.c
index 67f07ad8378..3e19bbeb569 100644
--- a/source/blender/python/generic/blf_api.c
+++ b/source/blender/python/generic/blf_api.c
@@ -402,4 +402,4 @@ PyObject *BLF_Init(void)
PyModule_AddIntConstant(submodule, "KERNING_DEFAULT", BLF_KERNING_DEFAULT);
return (submodule);
-}
+} \ No newline at end of file
diff --git a/source/blender/windowmanager/wm_event_types.h b/source/blender/windowmanager/wm_event_types.h
index a93214e9a54..7b83e1d4179 100644
--- a/source/blender/windowmanager/wm_event_types.h
+++ b/source/blender/windowmanager/wm_event_types.h
@@ -226,7 +226,7 @@
#define ISTWEAK(event) (event >= EVT_TWEAK_L && event <= EVT_GESTURE)
/* test whether event type is acceptable as hotkey, excluding modifiers */
-#define ISHOTKEY(event) ((ISKEYBOARD(event) || ISMOUSE(event)) && !(event>=LEFTCTRLKEY && event<=LEFTSHIFTKEY) && !(event>=UNKNOWNKEY && event<=GRLESSKEY))
+#define ISHOTKEY(event) ((ISKEYBOARD(event) || ISMOUSE(event)) && !(event>=LEFTCTRLKEY && event<=ESCKEY) && !(event>=UNKNOWNKEY && event<=GRLESSKEY))
/* **************** BLENDER GESTURE EVENTS ********************* */