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:
authorJoseph Eagar <joeedh@gmail.com>2011-04-15 05:19:13 +0400
committerJoseph Eagar <joeedh@gmail.com>2011-04-15 05:19:13 +0400
commitc98148a963d37fc2f25e125afeb4cf21df6fbf14 (patch)
tree691a051e27f08e35bf09d35b6fb9c88e4c37b8d2 /source/blender/editors/screen
parent0bba684d08952d0be822f3906ffb2a03b2674cc2 (diff)
parentfa63c297753636c149fbb1a3877d9b3d93601357 (diff)
=bmesh= merge from trunk at r36153
Diffstat (limited to 'source/blender/editors/screen')
-rw-r--r--source/blender/editors/screen/CMakeLists.txt1
-rw-r--r--source/blender/editors/screen/area.c44
-rw-r--r--source/blender/editors/screen/glutil.c27
-rw-r--r--source/blender/editors/screen/screen_context.c13
-rw-r--r--source/blender/editors/screen/screen_edit.c62
-rw-r--r--source/blender/editors/screen/screen_intern.h5
-rw-r--r--source/blender/editors/screen/screen_ops.c412
-rw-r--r--source/blender/editors/screen/screendump.c5
8 files changed, 449 insertions, 120 deletions
diff --git a/source/blender/editors/screen/CMakeLists.txt b/source/blender/editors/screen/CMakeLists.txt
index 5663a9ee750..3098c26f638 100644
--- a/source/blender/editors/screen/CMakeLists.txt
+++ b/source/blender/editors/screen/CMakeLists.txt
@@ -31,6 +31,7 @@ set(INC
../../makesrna
../../windowmanager
../../../../intern/guardedalloc
+ ${GLEW_INCLUDE_PATH}
)
set(SRC
diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c
index 4ddb5d059e4..5a80799fc3b 100644
--- a/source/blender/editors/screen/area.c
+++ b/source/blender/editors/screen/area.c
@@ -26,6 +26,11 @@
* ***** END GPL LICENSE BLOCK *****
*/
+/** \file blender/editors/screen/area.c
+ * \ingroup edscr
+ */
+
+
#include <string.h>
#include <stdio.h>
@@ -102,7 +107,7 @@ void ED_region_pixelspace(ARegion *ar)
int width= ar->winrct.xmax-ar->winrct.xmin+1;
int height= ar->winrct.ymax-ar->winrct.ymin+1;
- wmOrtho2(-0.375, (float)width-0.375, -0.375, (float)height-0.375);
+ wmOrtho2(-0.375f, (float)width-0.375f, -0.375f, (float)height-0.375f);
glLoadIdentity();
}
@@ -309,6 +314,10 @@ void ED_region_do_draw(bContext *C, ARegion *ar)
ARegionType *at= ar->type;
rcti winrct;
+ /* see BKE_spacedata_draw_locks() */
+ if(at->do_lock)
+ return;
+
/* checks other overlapping regions */
region_scissor_winrct(ar, &winrct);
@@ -426,7 +435,11 @@ void ED_area_tag_refresh(ScrArea *sa)
void ED_area_headerprint(ScrArea *sa, const char *str)
{
ARegion *ar;
-
+
+ /* happens when running transform operators in backround mode */
+ if(sa == NULL)
+ return;
+
for(ar= sa->regionbase.first; ar; ar= ar->next) {
if(ar->regiontype==RGN_TYPE_HEADER) {
if(str) {
@@ -838,7 +851,7 @@ static void region_subwindow(wmWindow *win, ARegion *ar)
wm_subwindow_position(win, ar->swinid, &ar->winrct);
}
-static void ed_default_handlers(wmWindowManager *wm, ListBase *handlers, int flag)
+static void ed_default_handlers(wmWindowManager *wm, ScrArea *sa, ListBase *handlers, int flag)
{
/* note, add-handler checks if it already exists */
@@ -855,8 +868,20 @@ static void ed_default_handlers(wmWindowManager *wm, ListBase *handlers, int fla
if(flag & ED_KEYMAP_MARKERS) {
/* time-markers */
wmKeyMap *keymap= WM_keymap_find(wm->defaultconf, "Markers", 0, 0);
- WM_event_add_keymap_handler(handlers, keymap);
- // XXX need boundbox check urgently!!!
+
+ /* time space only has this keymap, the others get a boundbox restricted map */
+ if(sa->spacetype!=SPACE_TIME) {
+ ARegion *ar;
+ static rcti rect= {0, 10000, 0, 30}; /* same local check for all areas */
+
+ for(ar= sa->regionbase.first; ar; ar= ar->next)
+ if(ar->regiontype == RGN_TYPE_WINDOW)
+ break;
+ if(ar)
+ WM_event_add_keymap_handler_bb(handlers, keymap, &rect, &ar->winrct);
+ }
+ else
+ WM_event_add_keymap_handler(handlers, keymap);
}
if(flag & ED_KEYMAP_ANIMATION) {
/* frame changing and timeline operators (for time spaces) */
@@ -909,7 +934,7 @@ void ED_area_initialize(wmWindowManager *wm, wmWindow *win, ScrArea *sa)
region_rect_recursive(sa, sa->regionbase.first, &rect, 0);
/* default area handlers */
- ed_default_handlers(wm, &sa->handlers, sa->type->keymapflag);
+ ed_default_handlers(wm, sa, &sa->handlers, sa->type->keymapflag);
/* checks spacedata, adds own handlers */
if(sa->type->init)
sa->type->init(wm, sa);
@@ -920,7 +945,7 @@ void ED_area_initialize(wmWindowManager *wm, wmWindow *win, ScrArea *sa)
if(ar->swinid) {
/* default region handlers */
- ed_default_handlers(wm, &ar->handlers, ar->type->keymapflag);
+ ed_default_handlers(wm, sa, &ar->handlers, ar->type->keymapflag);
/* own handlers */
if(ar->type->init)
ar->type->init(wm, ar);
@@ -1062,6 +1087,9 @@ void ED_area_newspace(bContext *C, ScrArea *sa, int type)
if(sl && sl->regionbase.first==NULL) {
st->free(sl);
BLI_freelinkN(&sa->spacedata, sl);
+ if(slold == sl) {
+ slold= NULL;
+ }
sl= NULL;
}
@@ -1418,7 +1446,7 @@ void ED_region_header(const bContext *C, ARegion *ar)
uiBlock *block;
uiLayout *layout;
HeaderType *ht;
- Header header = {0};
+ Header header = {NULL};
int maxco, xco, yco;
/* clear */
diff --git a/source/blender/editors/screen/glutil.c b/source/blender/editors/screen/glutil.c
index ce96df5d3b1..2918c98c84a 100644
--- a/source/blender/editors/screen/glutil.c
+++ b/source/blender/editors/screen/glutil.c
@@ -25,6 +25,11 @@
* ***** END GPL LICENSE BLOCK *****
*/
+/** \file blender/editors/screen/glutil.c
+ * \ingroup edscr
+ */
+
+
#include <stdio.h>
#include <string.h>
@@ -341,7 +346,7 @@ void glutil_draw_filled_arc(float start, float angle, float radius, int nsegment
float t= (float) i/(nsegments-1);
float cur= start + t*angle;
- glVertex2f(cos(cur)*radius, sin(cur)*radius);
+ glVertex2f(cosf(cur)*radius, sinf(cur)*radius);
}
glEnd();
}
@@ -354,7 +359,7 @@ void glutil_draw_lined_arc(float start, float angle, float radius, int nsegments
float t= (float) i/(nsegments-1);
float cur= start + t*angle;
- glVertex2f(cos(cur)*radius, sin(cur)*radius);
+ glVertex2f(cosf(cur)*radius, sinf(cur)*radius);
}
glEnd();
}
@@ -756,9 +761,9 @@ void bglBegin(int mode)
if(mode==GL_POINTS) {
float value[4];
glGetFloatv(GL_POINT_SIZE_RANGE, value);
- if(value[1]<2.0) {
+ if(value[1] < 2.0f) {
glGetFloatv(GL_POINT_SIZE, value);
- pointhack= floor(value[0]+0.5);
+ pointhack= floor(value[0] + 0.5f);
if(pointhack>4) pointhack= 4;
}
else glBegin(mode);
@@ -769,9 +774,9 @@ int bglPointHack(void) {
float value[4];
int pointhack_px;
glGetFloatv(GL_POINT_SIZE_RANGE, value);
- if(value[1]<2.0) {
+ if(value[1] < 2.0f) {
glGetFloatv(GL_POINT_SIZE, value);
- pointhack_px= floor(value[0]+0.5);
+ pointhack_px= floorf(value[0]+0.5f);
if(pointhack_px>4) pointhack_px= 4;
return pointhack_px;
}
@@ -784,7 +789,7 @@ void bglVertex3fv(float *vec)
case GL_POINTS:
if(pointhack) {
glRasterPos3fv(vec);
- glBitmap(pointhack, pointhack, (float)pointhack/2.0, (float)pointhack/2.0, 0.0, 0.0, Squaredot);
+ glBitmap(pointhack, pointhack, (float)pointhack/2.0f, (float)pointhack/2.0f, 0.0, 0.0, Squaredot);
}
else glVertex3fv(vec);
break;
@@ -797,7 +802,7 @@ void bglVertex3f(float x, float y, float z)
case GL_POINTS:
if(pointhack) {
glRasterPos3f(x, y, z);
- glBitmap(pointhack, pointhack, (float)pointhack/2.0, (float)pointhack/2.0, 0.0, 0.0, Squaredot);
+ glBitmap(pointhack, pointhack, (float)pointhack/2.0f, (float)pointhack/2.0f, 0.0, 0.0, Squaredot);
}
else glVertex3f(x, y, z);
break;
@@ -855,7 +860,7 @@ void bglPolygonOffset(float viewdist, float dist)
{
static float winmat[16], offset=0.0;
- if(dist!=0.0) {
+ if(dist != 0.0f) {
float offs;
// glEnable(GL_POLYGON_OFFSET_FILL);
@@ -867,8 +872,8 @@ void bglPolygonOffset(float viewdist, float dist)
/* dist is from camera to center point */
- if(winmat[15]>0.5) offs= 0.00001*dist*viewdist; // ortho tweaking
- else offs= 0.0005*dist; // should be clipping value or so...
+ if(winmat[15]>0.5f) offs= 0.00001f*dist*viewdist; // ortho tweaking
+ else offs= 0.0005f*dist; // should be clipping value or so...
winmat[14]-= offs;
offset+= offs;
diff --git a/source/blender/editors/screen/screen_context.c b/source/blender/editors/screen/screen_context.c
index 754d75fe9a5..f73ede19724 100644
--- a/source/blender/editors/screen/screen_context.c
+++ b/source/blender/editors/screen/screen_context.c
@@ -24,6 +24,11 @@
* ***** END GPL LICENSE BLOCK *****
*/
+/** \file blender/editors/screen/screen_context.c
+ * \ingroup edscr
+ */
+
+
#include <stdlib.h>
#include <string.h>
@@ -57,7 +62,7 @@ const char *screen_context_dir[] = {
"visible_pose_bones", "selected_pose_bones", "active_bone", "active_pose_bone",
"active_base", "active_object", "object", "edit_object",
"sculpt_object", "vertex_paint_object", "weight_paint_object",
- "texture_paint_object", "particle_edit_object",
+ "image_paint_object", "particle_edit_object",
"sequences", "selected_sequences", "selected_editable_sequences", /* sequencer */
NULL};
@@ -149,7 +154,7 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
return 1;
}
else if(CTX_data_equals(member, "visible_bones") || CTX_data_equals(member, "editable_bones")) {
- bArmature *arm= (obedit) ? obedit->data : NULL;
+ bArmature *arm= (obedit && obedit->type == OB_ARMATURE) ? obedit->data : NULL;
EditBone *ebone, *flipbone=NULL;
int editable_bones= CTX_data_equals(member, "editable_bones");
@@ -191,7 +196,7 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
}
}
else if(CTX_data_equals(member, "selected_bones") || CTX_data_equals(member, "selected_editable_bones")) {
- bArmature *arm= (obedit) ? obedit->data : NULL;
+ bArmature *arm= (obedit && obedit->type == OB_ARMATURE) ? obedit->data : NULL;
EditBone *ebone, *flipbone=NULL;
int selected_editable_bones= CTX_data_equals(member, "selected_editable_bones");
@@ -335,7 +340,7 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
return 1;
}
- else if(CTX_data_equals(member, "texture_paint_object")) {
+ else if(CTX_data_equals(member, "image_paint_object")) {
if(obact && (obact->mode & OB_MODE_TEXTURE_PAINT))
CTX_data_id_pointer_set(result, &obact->id);
diff --git a/source/blender/editors/screen/screen_edit.c b/source/blender/editors/screen/screen_edit.c
index f2f11f42204..2467140bde4 100644
--- a/source/blender/editors/screen/screen_edit.c
+++ b/source/blender/editors/screen/screen_edit.c
@@ -24,6 +24,11 @@
* ***** END GPL LICENSE BLOCK *****
*/
+/** \file blender/editors/screen/screen_edit.c
+ * \ingroup edscr
+ */
+
+
#include <string.h>
#include <math.h>
@@ -222,16 +227,16 @@ void removenotused_scredges(bScreen *sc)
sa= sc->areabase.first;
while(sa) {
se= screen_findedge(sc, sa->v1, sa->v2);
- if(se==0) printf("error: area %d edge 1 doesn't exist\n", a);
+ if(se==NULL) printf("error: area %d edge 1 doesn't exist\n", a);
else se->flag= 1;
se= screen_findedge(sc, sa->v2, sa->v3);
- if(se==0) printf("error: area %d edge 2 doesn't exist\n", a);
+ if(se==NULL) printf("error: area %d edge 2 doesn't exist\n", a);
else se->flag= 1;
se= screen_findedge(sc, sa->v3, sa->v4);
- if(se==0) printf("error: area %d edge 3 doesn't exist\n", a);
+ if(se==NULL) printf("error: area %d edge 3 doesn't exist\n", a);
else se->flag= 1;
se= screen_findedge(sc, sa->v4, sa->v1);
- if(se==0) printf("error: area %d edge 4 doesn't exist\n", a);
+ if(se==NULL) printf("error: area %d edge 4 doesn't exist\n", a);
else se->flag= 1;
sa= sa->next;
a++;
@@ -319,8 +324,7 @@ static short testsplitpoint(ScrArea *sa, char dir, float fac)
if(dir=='h' && (sa->v2->vec.y- sa->v1->vec.y <= 2*AREAMINY)) return 0;
// to be sure
- if(fac<0.0) fac= 0.0;
- if(fac>1.0) fac= 1.0;
+ CLAMP(fac, 0.0f, 1.0f);
if(dir=='h') {
y= sa->v1->vec.y+ fac*(sa->v2->vec.y- sa->v1->vec.y);
@@ -649,14 +653,14 @@ static void screen_test_scale(bScreen *sc, int winsizex, int winsizey)
/* FIXME, this resizing logic is no good when resizing the window + redrawing [#24428]
* need some way to store these as floats internally and re-apply from there. */
tempf= ((float)sv->vec.x)*facx;
- sv->vec.x= (short)(tempf+0.5);
+ sv->vec.x= (short)(tempf+0.5f);
sv->vec.x+= AREAGRID-1;
sv->vec.x-= (sv->vec.x % AREAGRID);
CLAMP(sv->vec.x, 0, winsizex);
tempf= ((float)sv->vec.y)*facy;
- sv->vec.y= (short)(tempf+0.5);
+ sv->vec.y= (short)(tempf+0.5f);
sv->vec.y+= AREAGRID-1;
sv->vec.y-= (sv->vec.y % AREAGRID);
@@ -955,8 +959,9 @@ static void region_cursor_set(wmWindow *win, int swinid)
}
}
-void ED_screen_do_listen(wmWindow *win, wmNotifier *note)
+void ED_screen_do_listen(bContext *C, wmNotifier *note)
{
+ wmWindow *win= CTX_wm_window(C);
/* generic notes */
switch(note->category) {
@@ -968,8 +973,11 @@ void ED_screen_do_listen(wmWindow *win, wmNotifier *note)
win->screen->do_draw= 1;
break;
case NC_SCREEN:
+ if(note->data==ND_SUBWINACTIVE)
+ uiFreeActiveButtons(C, win->screen);
if(note->action==NA_EDITED)
win->screen->do_draw= win->screen->do_refresh= 1;
+ break;
case NC_SCENE:
if(note->data==ND_MODE)
region_cursor_set(win, note->swinid);
@@ -981,8 +989,9 @@ void ED_screen_do_listen(wmWindow *win, wmNotifier *note)
void ED_screen_draw(wmWindow *win)
{
ScrArea *sa;
- ScrArea *sa1=NULL;
- ScrArea *sa2=NULL;
+ ScrArea *sa1= NULL;
+ ScrArea *sa2= NULL;
+ ScrArea *sa3= NULL;
int dir = -1;
int dira = -1;
@@ -991,6 +1000,7 @@ void ED_screen_draw(wmWindow *win)
for(sa= win->screen->areabase.first; sa; sa= sa->next) {
if (sa->flag & AREA_FLAG_DRAWJOINFROM) sa1 = sa;
if (sa->flag & AREA_FLAG_DRAWJOINTO) sa2 = sa;
+ if (sa->flag & (AREA_FLAG_DRAWSPLIT_H|AREA_FLAG_DRAWSPLIT_V)) sa3 = sa;
drawscredge_area(sa, win->sizex, win->sizey, 0);
}
for(sa= win->screen->areabase.first; sa; sa= sa->next)
@@ -1023,7 +1033,25 @@ void ED_screen_draw(wmWindow *win)
scrarea_draw_shape_light(sa1, dira);
}
-// if(G.f & G_DEBUG) printf("draw screen\n");
+ /* splitpoint */
+ if(sa3) {
+ glEnable(GL_BLEND);
+ glColor4ub(255, 255, 255, 100);
+
+ if(sa3->flag & AREA_FLAG_DRAWSPLIT_H) {
+ sdrawline(sa3->totrct.xmin, win->eventstate->y, sa3->totrct.xmax, win->eventstate->y);
+ glColor4ub(0, 0, 0, 100);
+ sdrawline(sa3->totrct.xmin, win->eventstate->y+1, sa3->totrct.xmax, win->eventstate->y+1);
+ }
+ else {
+ sdrawline(win->eventstate->x, sa3->totrct.ymin, win->eventstate->x, sa3->totrct.ymax);
+ glColor4ub(0, 0, 0, 100);
+ sdrawline(win->eventstate->x+1, sa3->totrct.ymin, win->eventstate->x+1, sa3->totrct.ymax);
+ }
+
+ glDisable(GL_BLEND);
+ }
+
win->screen->do_draw= 0;
}
@@ -1192,8 +1220,10 @@ static void screen_cursor_set(wmWindow *win, wmEvent *event)
/* called in wm_event_system.c. sets state vars in screen, cursors */
/* event type is mouse move */
-void ED_screen_set_subwinactive(wmWindow *win, wmEvent *event)
+void ED_screen_set_subwinactive(bContext *C, wmEvent *event)
{
+ wmWindow *win= CTX_wm_window(C);
+
if(win->screen) {
bScreen *scr= win->screen;
ScrArea *sa;
@@ -1239,6 +1269,7 @@ void ED_screen_set_subwinactive(wmWindow *win, wmEvent *event)
}
else if(oldswin!=scr->subwinactive) {
region_cursor_set(win, scr->subwinactive);
+ WM_event_add_notifier(C, NC_SCREEN|ND_SUBWINACTIVE, scr);
}
}
}
@@ -1470,7 +1501,7 @@ int ED_screen_full_newspace(bContext *C, ScrArea *sa, int type)
bScreen *screen= CTX_wm_screen(C);
ScrArea *newsa= NULL;
- if(!sa || sa->full==0) {
+ if(!sa || sa->full==NULL) {
newsa= ED_screen_full_toggle(C, win, sa);
}
@@ -1554,6 +1585,9 @@ ScrArea *ED_screen_full_toggle(bContext *C, wmWindow *win, ScrArea *sa)
are no longer in the same screen */
for(ar=sa->regionbase.first; ar; ar=ar->next)
uiFreeBlocks(C, &ar->uiblocks);
+
+ /* prevent hanging header prints */
+ ED_area_headerprint(sa, NULL);
}
if(sa && sa->full) {
diff --git a/source/blender/editors/screen/screen_intern.h b/source/blender/editors/screen/screen_intern.h
index 50a3159644d..f15b1a70afa 100644
--- a/source/blender/editors/screen/screen_intern.h
+++ b/source/blender/editors/screen/screen_intern.h
@@ -25,6 +25,11 @@
*
* ***** END GPL LICENSE BLOCK *****
*/
+
+/** \file blender/editors/screen/screen_intern.h
+ * \ingroup edscr
+ */
+
#ifndef ED_SCREEN_INTERN_H
#define ED_SCREEN_INTERN_H
diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c
index 2c9a11b2112..136d9fb7af1 100644
--- a/source/blender/editors/screen/screen_ops.c
+++ b/source/blender/editors/screen/screen_ops.c
@@ -24,6 +24,11 @@
* ***** END GPL LICENSE BLOCK *****
*/
+/** \file blender/editors/screen/screen_ops.c
+ * \ingroup edscr
+ */
+
+
#include <math.h>
#include <string.h>
@@ -44,6 +49,7 @@
#include "BKE_context.h"
#include "BKE_customdata.h"
+#include "BKE_global.h"
#include "BKE_main.h"
#include "BKE_mesh.h"
#include "BKE_report.h"
@@ -62,6 +68,7 @@
#include "ED_armature.h"
#include "ED_screen_types.h"
#include "ED_keyframes_draw.h"
+#include "ED_view3d.h"
#include "RNA_access.h"
#include "RNA_define.h"
@@ -103,6 +110,27 @@ int ED_operator_screenactive(bContext *C)
return 1;
}
+/* XXX added this to prevent anim state to change during renders */
+int ED_operator_screenactive_norender(bContext *C)
+{
+ if(G.rendering) return 0;
+ if(CTX_wm_window(C)==NULL) return 0;
+ if(CTX_wm_screen(C)==NULL) return 0;
+ return 1;
+}
+
+
+static int screen_active_editable(bContext *C)
+{
+ if(ED_operator_screenactive(C)) {
+ /* no full window splitting allowed */
+ if(CTX_wm_screen(C)->full != SCREENNORMAL)
+ return 0;
+ return 1;
+ }
+ return 0;
+}
+
/* when mouse is over area-edge */
int ED_operator_screen_mainwinactive(bContext *C)
{
@@ -277,6 +305,12 @@ int ED_operator_object_active_editable_mesh(bContext *C)
return ((ob != NULL) && !(ob->id.lib) && !(ob->restrictflag & OB_RESTRICT_VIEW) && ob->type == OB_MESH);
}
+int ED_operator_object_active_editable_font(bContext *C)
+{
+ Object *ob = ED_object_active_context(C);
+ return ((ob != NULL) && !(ob->id.lib) && !(ob->restrictflag & OB_RESTRICT_VIEW) && ob->type == OB_FONT);
+}
+
int ED_operator_editmesh(bContext *C)
{
Object *obedit= CTX_data_edit_object(C);
@@ -1087,21 +1121,44 @@ static void SCREEN_OT_area_move(wmOperatorType *ot)
#define SPLIT_STARTED 1
#define SPLIT_PROGRESS 2
-typedef struct sAreaSplitData
- {
- int x, y; /* last used mouse position */
-
- int origval; /* for move areas */
- int bigger, smaller; /* constraints for moving new edge */
- int delta; /* delta move edge */
- int origmin, origsize; /* to calculate fac, for property storage */
-
- ScrEdge *nedge; /* new edge */
- ScrArea *sarea; /* start area */
- ScrArea *narea; /* new area */
- } sAreaSplitData;
+typedef struct sAreaSplitData {
+ int x, y; /* last used mouse position */
+
+ int origval; /* for move areas */
+ int bigger, smaller; /* constraints for moving new edge */
+ int delta; /* delta move edge */
+ int origmin, origsize; /* to calculate fac, for property storage */
+ int previewmode; /* draw previewline, then split */
+
+ ScrEdge *nedge; /* new edge */
+ ScrArea *sarea; /* start area */
+ ScrArea *narea; /* new area */
+
+} sAreaSplitData;
+
+/* generic init, menu case, doesn't need active area */
+static int area_split_menu_init(bContext *C, wmOperator *op)
+{
+ sAreaSplitData *sd;
+
+ /* custom data */
+ sd= (sAreaSplitData*)MEM_callocN(sizeof (sAreaSplitData), "op_area_split");
+ op->customdata= sd;
+
+ sd->sarea= CTX_wm_area(C);
+
+ if(sd->sarea) {
+ int dir= RNA_enum_get(op->ptr, "direction");
-/* generic init, no UI stuff here */
+ if(dir=='h')
+ sd->sarea->flag |= AREA_FLAG_DRAWSPLIT_H;
+ else
+ sd->sarea->flag |= AREA_FLAG_DRAWSPLIT_V;
+ }
+ return 1;
+}
+
+/* generic init, no UI stuff here, assumes active area */
static int area_split_init(bContext *C, wmOperator *op)
{
ScrArea *sa= CTX_wm_area(C);
@@ -1205,6 +1262,9 @@ static void area_split_exit(bContext *C, wmOperator *op)
if(sd->sarea) ED_area_tag_redraw(sd->sarea);
if(sd->narea) ED_area_tag_redraw(sd->narea);
+ if(sd->sarea)
+ sd->sarea->flag &= ~(AREA_FLAG_DRAWSPLIT_H|AREA_FLAG_DRAWSPLIT_V);
+
MEM_freeN(op->customdata);
op->customdata = NULL;
}
@@ -1221,19 +1281,19 @@ static void area_split_exit(bContext *C, wmOperator *op)
static int area_split_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
sAreaSplitData *sd;
+ int dir;
+
+ /* no full window splitting allowed */
+ if(CTX_wm_screen(C)->full != SCREENNORMAL)
+ return OPERATOR_CANCELLED;
if(event->type==EVT_ACTIONZONE_AREA) {
sActionzoneData *sad= event->customdata;
- int dir;
if(sad->modifier>0) {
return OPERATOR_PASS_THROUGH;
}
- /* no full window splitting allowed */
- if(CTX_wm_area(C)->full)
- return OPERATOR_PASS_THROUGH;
-
/* verify *sad itself */
if(sad==NULL || sad->sa1==NULL || sad->az==NULL)
return OPERATOR_PASS_THROUGH;
@@ -1257,10 +1317,42 @@ static int area_split_invoke(bContext *C, wmOperator *op, wmEvent *event)
if(!area_split_init(C, op))
return OPERATOR_PASS_THROUGH;
- sd= (sAreaSplitData *)op->customdata;
+ }
+ else {
+ ScrEdge *actedge;
+ int x, y;
+
+ /* retrieve initial mouse coord, so we can find the active edge */
+ if(RNA_property_is_set(op->ptr, "mouse_x"))
+ x= RNA_int_get(op->ptr, "mouse_x");
+ else
+ x= event->x;
+
+ if(RNA_property_is_set(op->ptr, "mouse_y"))
+ y= RNA_int_get(op->ptr, "mouse_y");
+ else
+ y= event->x;
+
+ actedge= screen_find_active_scredge(CTX_wm_screen(C), x, y);
+ if(actedge==NULL)
+ return OPERATOR_CANCELLED;
- sd->x= event->x;
- sd->y= event->y;
+ dir= scredge_is_horizontal(actedge)?'v':'h';
+
+ RNA_enum_set(op->ptr, "direction", dir);
+
+ /* special case, adds customdata, sets defaults */
+ if(!area_split_menu_init(C, op))
+ return OPERATOR_CANCELLED;
+
+ }
+
+ sd= (sAreaSplitData *)op->customdata;
+
+ sd->x= event->x;
+ sd->y= event->y;
+
+ if(event->type==EVT_ACTIONZONE_AREA) {
/* do the split */
if(area_split_apply(C, op)) {
@@ -1271,11 +1363,14 @@ static int area_split_invoke(bContext *C, wmOperator *op, wmEvent *event)
return OPERATOR_RUNNING_MODAL;
}
-
}
else {
- /* nonmodal for now */
- return op->type->exec(C, op);
+ sd->previewmode= 1;
+ /* add temp handler for edge move or cancel */
+ WM_event_add_modal_handler(C, op);
+
+ return OPERATOR_RUNNING_MODAL;
+
}
return OPERATOR_PASS_THROUGH;
@@ -1299,12 +1394,16 @@ static int area_split_cancel(bContext *C, wmOperator *op)
{
sAreaSplitData *sd= (sAreaSplitData *)op->customdata;
- if (screen_area_join(C, CTX_wm_screen(C), sd->sarea, sd->narea)) {
- if (CTX_wm_area(C) == sd->narea) {
- CTX_wm_area_set(C, NULL);
- CTX_wm_region_set(C, NULL);
+ if(sd->previewmode) {
+ }
+ else {
+ if (screen_area_join(C, CTX_wm_screen(C), sd->sarea, sd->narea)) {
+ if (CTX_wm_area(C) == sd->narea) {
+ CTX_wm_area_set(C, NULL);
+ CTX_wm_region_set(C, NULL);
+ }
+ sd->narea = NULL;
}
- sd->narea = NULL;
}
area_split_exit(C, op);
@@ -1323,17 +1422,50 @@ static int area_split_modal(bContext *C, wmOperator *op, wmEvent *event)
dir= RNA_enum_get(op->ptr, "direction");
sd->delta= (dir == 'v')? event->x - sd->origval: event->y - sd->origval;
- area_move_apply_do(C, sd->origval, sd->delta, dir, sd->bigger, sd->smaller);
+ if(sd->previewmode==0)
+ area_move_apply_do(C, sd->origval, sd->delta, dir, sd->bigger, sd->smaller);
+ else {
+ if(sd->sarea) {
+ sd->sarea->flag &= ~(AREA_FLAG_DRAWSPLIT_H|AREA_FLAG_DRAWSPLIT_V);
+ ED_area_tag_redraw(sd->sarea);
+ }
+ sd->sarea= screen_areahascursor(CTX_wm_screen(C), event->x, event->y); /* area context not set */
+
+ if(sd->sarea) {
+ ED_area_tag_redraw(sd->sarea);
+ if (dir=='v') {
+ sd->origsize= sd->sarea->winx;
+ sd->origmin= sd->sarea->totrct.xmin;
+ sd->sarea->flag |= AREA_FLAG_DRAWSPLIT_V;
+ }
+ else {
+ sd->origsize= sd->sarea->winy;
+ sd->origmin= sd->sarea->totrct.ymin;
+ sd->sarea->flag |= AREA_FLAG_DRAWSPLIT_H;
+ }
+ }
+
+ CTX_wm_window(C)->screen->do_draw= 1;
+
+ }
fac= (dir == 'v') ? event->x-sd->origmin : event->y-sd->origmin;
RNA_float_set(op->ptr, "factor", fac / (float)sd->origsize);
+
break;
case LEFTMOUSE:
- if(event->val==KM_RELEASE) { /* mouse up */
+ if(sd->previewmode) {
+ area_split_apply(C, op);
area_split_exit(C, op);
return OPERATOR_FINISHED;
}
+ else {
+ if(event->val==KM_RELEASE) { /* mouse up */
+ area_split_exit(C, op);
+ return OPERATOR_FINISHED;
+ }
+ }
break;
case RIGHTMOUSE: /* cancel operation */
case ESCKEY:
@@ -1358,12 +1490,14 @@ static void SCREEN_OT_area_split(wmOperatorType *ot)
ot->invoke= area_split_invoke;
ot->modal= area_split_modal;
- ot->poll= ED_operator_areaactive;
+ ot->poll= screen_active_editable;
ot->flag= OPTYPE_BLOCKING;
/* rna */
RNA_def_enum(ot->srna, "direction", prop_direction_items, 'h', "Direction", "");
RNA_def_float(ot->srna, "factor", 0.5f, 0.0, 1.0, "Factor", "", 0.0, 1.0);
+ RNA_def_int(ot->srna, "mouse_x", -100, INT_MIN, INT_MAX, "Mouse X", "", INT_MIN, INT_MAX);
+ RNA_def_int(ot->srna, "mouse_y", -100, INT_MIN, INT_MAX, "Mouse Y", "", INT_MIN, INT_MAX);
}
@@ -1591,7 +1725,7 @@ static void SCREEN_OT_frame_offset(wmOperatorType *ot)
ot->exec= frame_offset_exec;
- ot->poll= ED_operator_screenactive;
+ ot->poll= ED_operator_screenactive_norender;
ot->flag= 0;
/* rna */
@@ -1641,7 +1775,7 @@ static void SCREEN_OT_frame_jump(wmOperatorType *ot)
ot->exec= frame_jump_exec;
- ot->poll= ED_operator_screenactive;
+ ot->poll= ED_operator_screenactive_norender;
ot->flag= OPTYPE_UNDO;
/* rna */
@@ -1656,7 +1790,7 @@ static int keyframe_jump_exec(bContext *C, wmOperator *op)
{
Scene *scene= CTX_data_scene(C);
Object *ob= CTX_data_active_object(C);
- bDopeSheet ads= {0};
+ bDopeSheet ads= {NULL};
DLRBT_Tree keys;
ActKeyColumn *ak;
float cfra= (scene)? (float)(CFRA) : 0.0f;
@@ -1721,7 +1855,7 @@ static void SCREEN_OT_keyframe_jump(wmOperatorType *ot)
ot->exec= keyframe_jump_exec;
- ot->poll= ED_operator_screenactive;
+ ot->poll= ED_operator_screenactive_norender;
ot->flag= OPTYPE_UNDO;
/* rna */
@@ -1793,7 +1927,18 @@ static void SCREEN_OT_screen_set(wmOperatorType *ot)
/* function to be called outside UI context, or for redo */
static int screen_full_area_exec(bContext *C, wmOperator *UNUSED(op))
{
- ED_screen_full_toggle(C, CTX_wm_window(C), CTX_wm_area(C));
+ bScreen *screen = CTX_wm_screen(C);
+ ScrArea *sa=NULL;
+
+ /* search current screen for 'fullscreen' areas */
+ /* prevents restoring info header, when mouse is over it */
+ for (sa=screen->areabase.first; sa; sa=sa->next) {
+ if (sa->full) break;
+ }
+
+ if(sa==NULL) sa= CTX_wm_area(C);
+
+ ED_screen_full_toggle(C, CTX_wm_window(C), sa);
return OPERATOR_FINISHED;
}
@@ -1859,6 +2004,7 @@ static int area_join_init(bContext *C, wmOperator *op)
sAreaJoinData* jd= NULL;
int x1, y1;
int x2, y2;
+ int shared= 0;
/* required properties, make negative to get return 0 if not set by caller */
x1= RNA_int_get(op->ptr, "min_x");
@@ -1871,6 +2017,16 @@ static int area_join_init(bContext *C, wmOperator *op)
if(sa1==NULL || sa2==NULL || sa1==sa2)
return 0;
+ /* do areas share an edge? */
+ if(sa1->v1==sa2->v1 || sa1->v1==sa2->v2 || sa1->v1==sa2->v3 || sa1->v1==sa2->v4) shared++;
+ if(sa1->v2==sa2->v1 || sa1->v2==sa2->v2 || sa1->v2==sa2->v3 || sa1->v2==sa2->v4) shared++;
+ if(sa1->v3==sa2->v1 || sa1->v3==sa2->v2 || sa1->v3==sa2->v3 || sa1->v3==sa2->v4) shared++;
+ if(sa1->v4==sa2->v1 || sa1->v4==sa2->v2 || sa1->v4==sa2->v3 || sa1->v4==sa2->v4) shared++;
+ if(shared!=2) {
+ printf("areas don't share edge\n");
+ return 0;
+ }
+
jd = (sAreaJoinData*)MEM_callocN(sizeof (sAreaJoinData), "op_area_join");
jd->sa1 = sa1;
@@ -1949,17 +2105,16 @@ static int area_join_invoke(bContext *C, wmOperator *op, wmEvent *event)
RNA_int_set(op->ptr, "min_y", sad->y);
RNA_int_set(op->ptr, "max_x", event->x);
RNA_int_set(op->ptr, "max_y", event->y);
-
- if(!area_join_init(C, op))
- return OPERATOR_PASS_THROUGH;
-
- /* add temp handler */
- WM_event_add_modal_handler(C, op);
-
- return OPERATOR_RUNNING_MODAL;
}
- return OPERATOR_PASS_THROUGH;
+
+ if(!area_join_init(C, op))
+ return OPERATOR_PASS_THROUGH;
+
+ /* add temp handler */
+ WM_event_add_modal_handler(C, op);
+
+ return OPERATOR_RUNNING_MODAL;
}
static int area_join_cancel(bContext *C, wmOperator *op)
@@ -2085,7 +2240,7 @@ static void SCREEN_OT_area_join(wmOperatorType *ot)
ot->exec= area_join_exec;
ot->invoke= area_join_invoke;
ot->modal= area_join_modal;
- ot->poll= ED_operator_areaactive;
+ ot->poll= screen_active_editable;
ot->flag= OPTYPE_BLOCKING;
@@ -2096,6 +2251,58 @@ static void SCREEN_OT_area_join(wmOperatorType *ot)
RNA_def_int(ot->srna, "max_y", -100, INT_MIN, INT_MAX, "Y 2", "", INT_MIN, INT_MAX);
}
+/* ******************************* */
+
+static int screen_area_options_invoke(bContext *C, wmOperator *op, wmEvent *event)
+{
+ uiPopupMenu *pup;
+ uiLayout *layout;
+ PointerRNA ptr1, ptr2;
+ ScrEdge *actedge= screen_find_active_scredge(CTX_wm_screen(C), event->x, event->y);
+
+ if(actedge==NULL) return OPERATOR_CANCELLED;
+
+ pup= uiPupMenuBegin(C, op->type->name, ICON_NONE);
+ layout= uiPupMenuLayout(pup);
+
+ WM_operator_properties_create(&ptr1, "SCREEN_OT_area_join");
+
+ /* mouse cursor on edge, '4' can fail on wide edges... */
+ RNA_int_set(&ptr1, "min_x", event->x+4);
+ RNA_int_set(&ptr1, "min_y", event->y+4);
+ RNA_int_set(&ptr1, "max_x", event->x-4);
+ RNA_int_set(&ptr1, "max_y", event->y-4);
+
+ WM_operator_properties_create(&ptr2, "SCREEN_OT_area_split");
+
+ /* store initial mouse cursor position */
+ RNA_int_set(&ptr2, "mouse_x", event->x);
+ RNA_int_set(&ptr2, "mouse_y", event->y);
+
+ uiItemFullO(layout, "SCREEN_OT_area_split", "Split Area", ICON_NONE, ptr2.data, WM_OP_INVOKE_DEFAULT, 0);
+ uiItemFullO(layout, "SCREEN_OT_area_join", "Join Area", ICON_NONE, ptr1.data, WM_OP_INVOKE_DEFAULT, 0);
+
+ uiPupMenuEnd(C, pup);
+
+ return OPERATOR_CANCELLED;
+}
+
+static void SCREEN_OT_area_options(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name= "Area Options";
+ ot->description= "Operations for splitting and merging";
+ ot->idname= "SCREEN_OT_area_options";
+
+ /* api callbacks */
+ ot->invoke= screen_area_options_invoke;
+
+ ot->poll= ED_operator_screen_mainwinactive;
+}
+
+
+/* ******************************* */
+
static int spacedata_cleanup(bContext *C, wmOperator *op)
{
@@ -2172,11 +2379,11 @@ static int repeat_history_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(ev
if(items==0)
return OPERATOR_CANCELLED;
- pup= uiPupMenuBegin(C, op->type->name, ICON_NULL);
+ pup= uiPupMenuBegin(C, op->type->name, ICON_NONE);
layout= uiPupMenuLayout(pup);
for (i=items-1, lastop= wm->operators.last; lastop; lastop= lastop->prev, i--)
- uiItemIntO(layout, lastop->type->name, ICON_NULL, op->type->idname, "index", i);
+ uiItemIntO(layout, lastop->type->name, ICON_NONE, op->type->idname, "index", i);
uiPupMenuEnd(C, pup);
@@ -2297,26 +2504,36 @@ static int region_quadview_exec(bContext *C, wmOperator *op)
/* lock views and set them */
if(sa->spacetype==SPACE_VIEW3D) {
+ /* run ED_view3d_lock() so the correct 'rv3d->viewquat' is set,
+ * otherwise when restoring rv3d->localvd the 'viewquat' won't
+ * match the 'view', set on entering localview See: [#26315],
+ *
+ * We could avoid manipulating rv3d->localvd here if exiting
+ * localview with a 4-split would assign these view locks */
RegionView3D *rv3d;
rv3d= ar->regiondata;
rv3d->viewlock= RV3D_LOCKED; rv3d->view= RV3D_VIEW_FRONT; rv3d->persp= RV3D_ORTHO;
- if (rv3d->localvd) { rv3d->localvd->view = rv3d->view; rv3d->localvd->persp = rv3d->persp; }
+ ED_view3d_lock(rv3d);
+ if (rv3d->localvd) { rv3d->localvd->view = rv3d->view; rv3d->localvd->persp = rv3d->persp; copy_qt_qt(rv3d->localvd->viewquat, rv3d->viewquat);}
ar= ar->next;
rv3d= ar->regiondata;
rv3d->viewlock= RV3D_LOCKED; rv3d->view= RV3D_VIEW_TOP; rv3d->persp= RV3D_ORTHO;
- if (rv3d->localvd) { rv3d->localvd->view = rv3d->view; rv3d->localvd->persp = rv3d->persp; }
+ ED_view3d_lock(rv3d);
+ if (rv3d->localvd) { rv3d->localvd->view = rv3d->view; rv3d->localvd->persp = rv3d->persp; copy_qt_qt(rv3d->localvd->viewquat, rv3d->viewquat);}
ar= ar->next;
rv3d= ar->regiondata;
rv3d->viewlock= RV3D_LOCKED; rv3d->view= RV3D_VIEW_RIGHT; rv3d->persp= RV3D_ORTHO;
- if (rv3d->localvd) { rv3d->localvd->view = rv3d->view; rv3d->localvd->persp = rv3d->persp; }
+ ED_view3d_lock(rv3d);
+ if (rv3d->localvd) { rv3d->localvd->view = rv3d->view; rv3d->localvd->persp = rv3d->persp; copy_qt_qt(rv3d->localvd->viewquat, rv3d->viewquat);}
ar= ar->next;
rv3d= ar->regiondata;
rv3d->view= RV3D_VIEW_CAMERA; rv3d->persp= RV3D_CAMOB;
- if (rv3d->localvd) {rv3d->localvd->view = rv3d->view; rv3d->localvd->persp = rv3d->persp; }
+ ED_view3d_lock(rv3d);
+ if (rv3d->localvd) {rv3d->localvd->view = rv3d->view; rv3d->localvd->persp = rv3d->persp; copy_qt_qt(rv3d->localvd->viewquat, rv3d->viewquat);}
}
ED_area_tag_redraw(sa);
WM_event_add_notifier(C, NC_SCREEN|NA_EDITED, NULL);
@@ -2444,23 +2661,23 @@ static int header_toolbox_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *U
uiPopupMenu *pup;
uiLayout *layout;
- pup= uiPupMenuBegin(C, "Header", ICON_NULL);
+ pup= uiPupMenuBegin(C, "Header", ICON_NONE);
layout= uiPupMenuLayout(pup);
// XXX SCREEN_OT_region_flip doesn't work - gets wrong context for active region, so added custom operator
if (ar->alignment == RGN_ALIGN_TOP)
- uiItemO(layout, "Flip to Bottom", ICON_NULL, "SCREEN_OT_header_flip");
+ uiItemO(layout, "Flip to Bottom", ICON_NONE, "SCREEN_OT_header_flip");
else
- uiItemO(layout, "Flip to Top", ICON_NULL, "SCREEN_OT_header_flip");
+ uiItemO(layout, "Flip to Top", ICON_NONE, "SCREEN_OT_header_flip");
uiItemS(layout);
/* file browser should be fullscreen all the time, but other regions can be maximised/restored... */
if (sa->spacetype != SPACE_FILE) {
if (sa->full)
- uiItemO(layout, "Tile Area", ICON_NULL, "SCREEN_OT_screen_full_area");
+ uiItemO(layout, "Tile Area", ICON_NONE, "SCREEN_OT_screen_full_area");
else
- uiItemO(layout, "Maximize Area", ICON_NULL, "SCREEN_OT_screen_full_area");
+ uiItemO(layout, "Maximize Area", ICON_NONE, "SCREEN_OT_screen_full_area");
}
uiPupMenuEnd(C, pup);
@@ -2569,7 +2786,7 @@ static int screen_animation_step(bContext *C, wmOperator *UNUSED(op), wmEvent *e
else sync= (scene->flag & SCE_FRAME_DROP);
if((scene->audio.flag & AUDIO_SYNC) && !(sad->flag & ANIMPLAY_FLAG_REVERSE) && finite(time = sound_sync_scene(scene)))
- scene->r.cfra = time * FPS + 0.5;
+ scene->r.cfra = (double)time * FPS + 0.5;
else
{
if (sync) {
@@ -2579,7 +2796,7 @@ static int screen_animation_step(bContext *C, wmOperator *UNUSED(op), wmEvent *e
scene->r.cfra -= step;
else
scene->r.cfra += step;
- wt->duration -= ((float)step)/FPS;
+ wt->duration -= ((double)step)/FPS;
}
else {
/* one frame +/- */
@@ -2678,7 +2895,7 @@ static void SCREEN_OT_animation_step(wmOperatorType *ot)
/* api callbacks */
ot->invoke= screen_animation_step;
- ot->poll= ED_operator_screenactive;
+ ot->poll= ED_operator_screenactive_norender;
}
@@ -2735,26 +2952,29 @@ static void SCREEN_OT_animation_play(wmOperatorType *ot)
/* api callbacks */
ot->exec= screen_animation_play_exec;
- ot->poll= ED_operator_screenactive;
+ ot->poll= ED_operator_screenactive_norender;
RNA_def_boolean(ot->srna, "reverse", 0, "Play in Reverse", "Animation is played backwards");
RNA_def_boolean(ot->srna, "sync", 0, "Sync", "Drop frames to maintain framerate");
}
-static int screen_animation_cancel_exec(bContext *C, wmOperator *UNUSED(op))
+static int screen_animation_cancel_exec(bContext *C, wmOperator *op)
{
bScreen *screen= CTX_wm_screen(C);
-
+
if (screen->animtimer) {
- ScreenAnimData *sad= screen->animtimer->customdata;
- Scene *scene= CTX_data_scene(C);
-
- /* reset current frame before stopping, and just send a notifier to deal with the rest
- * (since playback still needs to be stopped)
- */
- scene->r.cfra= sad->sfra;
- WM_event_add_notifier(C, NC_SCENE|ND_FRAME, scene);
-
+ if(RNA_boolean_get(op->ptr, "restore_frame")) {
+ ScreenAnimData *sad= screen->animtimer->customdata;
+ Scene *scene= CTX_data_scene(C);
+
+ /* reset current frame before stopping, and just send a notifier to deal with the rest
+ * (since playback still needs to be stopped)
+ */
+ scene->r.cfra= sad->sfra;
+
+ WM_event_add_notifier(C, NC_SCENE|ND_FRAME, scene);
+ }
+
/* call the other "toggling" operator to clean up now */
ED_screen_animation_play(C, 0, 0);
}
@@ -2773,6 +2993,8 @@ static void SCREEN_OT_animation_cancel(wmOperatorType *ot)
ot->exec= screen_animation_cancel_exec;
ot->poll= ED_operator_screenactive;
+
+ RNA_def_boolean(ot->srna, "restore_frame", TRUE, "Restore Frame", "Restore the frame when animation was initialized.");
}
/* ************** border select operator (template) ***************************** */
@@ -2924,6 +3146,7 @@ static void SCREEN_OT_new(wmOperatorType *ot)
/* api callbacks */
ot->exec= screen_new_exec;
+ ot->poll= WM_operator_winactive;
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -2959,26 +3182,39 @@ static void SCREEN_OT_delete(wmOperatorType *ot)
static int scene_new_exec(bContext *C, wmOperator *op)
{
Scene *newscene, *scene= CTX_data_scene(C);
+ bScreen *screen= CTX_wm_screen(C);
Main *bmain= CTX_data_main(C);
int type= RNA_enum_get(op->ptr, "type");
+
+ if(type == SCE_COPY_NEW) {
+ newscene= add_scene("Scene");
+ }
+ else { /* different kinds of copying */
+ newscene= copy_scene(scene, type);
+
+ /* these can't be handled in blenkernel curently, so do them here */
+ if(type == SCE_COPY_LINK_DATA) {
+ ED_object_single_users(bmain, newscene, 0);
+ }
+ else if(type == SCE_COPY_FULL) {
+ ED_object_single_users(bmain, newscene, 1);
+ }
+ }
- newscene= copy_scene(scene, type);
-
- /* these can't be handled in blenkernel curently, so do them here */
- if(type == SCE_COPY_LINK_DATA)
- ED_object_single_users(bmain, newscene, 0);
- else if(type == SCE_COPY_FULL)
- ED_object_single_users(bmain, newscene, 1);
-
+ /* this notifier calls ED_screen_set_scene, doing a lot of UI stuff, not for inside event loops */
WM_event_add_notifier(C, NC_SCENE|ND_SCENEBROWSE, newscene);
+ if(screen)
+ screen->scene= newscene;
+
return OPERATOR_FINISHED;
}
static void SCENE_OT_new(wmOperatorType *ot)
{
static EnumPropertyItem type_items[]= {
- {SCE_COPY_EMPTY, "EMPTY", 0, "Empty", "Add empty scene"},
+ {SCE_COPY_NEW, "NEW", 0, "New", "Add new scene"},
+ {SCE_COPY_EMPTY, "EMPTY", 0, "Copy Settings", "Make a copy without any objects"},
{SCE_COPY_LINK_OB, "LINK_OBJECTS", 0, "Link Objects", "Link to the objects from the current scene"},
{SCE_COPY_LINK_DATA, "LINK_OBJECT_DATA", 0, "Link Object Data", "Copy objects linked to data from the current scene"},
{SCE_COPY_FULL, "FULL_COPY", 0, "Full Copy", "Make a full copy of the current scene"},
@@ -3041,6 +3277,7 @@ void ED_operatortypes_screen(void)
WM_operatortype_append(SCREEN_OT_area_move);
WM_operatortype_append(SCREEN_OT_area_split);
WM_operatortype_append(SCREEN_OT_area_join);
+ WM_operatortype_append(SCREEN_OT_area_options);
WM_operatortype_append(SCREEN_OT_area_dupli);
WM_operatortype_append(SCREEN_OT_area_swap);
WM_operatortype_append(SCREEN_OT_region_quadview);
@@ -3143,6 +3380,9 @@ void ED_keymap_screen(wmKeyConfig *keyconf)
/* area move after action zones */
WM_keymap_verify_item(keymap, "SCREEN_OT_area_move", LEFTMOUSE, KM_PRESS, 0, 0);
+ WM_keymap_verify_item(keymap, "SCREEN_OT_area_options", RIGHTMOUSE, KM_PRESS, 0, 0);
+
+
/* Header Editing ------------------------------------------------ */
keymap= WM_keymap_find(keyconf, "Header", 0, 0);
@@ -3219,11 +3459,17 @@ void ED_keymap_screen(wmKeyConfig *keyconf)
WM_keymap_add_item(keymap, "SCREEN_OT_keyframe_jump", PAGEUPKEY, KM_PRESS, KM_CTRL, 0);
RNA_boolean_set(WM_keymap_add_item(keymap, "SCREEN_OT_keyframe_jump", PAGEDOWNKEY, KM_PRESS, KM_CTRL, 0)->ptr, "next", 0);
+ WM_keymap_add_item(keymap, "SCREEN_OT_keyframe_jump", MEDIALAST, KM_PRESS, 0, 0);
+ RNA_boolean_set(WM_keymap_add_item(keymap, "SCREEN_OT_keyframe_jump", MEDIAFIRST, KM_PRESS, 0, 0)->ptr, "next", 0);
+
/* play (forward and backwards) */
WM_keymap_add_item(keymap, "SCREEN_OT_animation_play", AKEY, KM_PRESS, KM_ALT, 0);
RNA_boolean_set(WM_keymap_add_item(keymap, "SCREEN_OT_animation_play", AKEY, KM_PRESS, KM_ALT|KM_SHIFT, 0)->ptr, "reverse", 1);
WM_keymap_add_item(keymap, "SCREEN_OT_animation_cancel", ESCKEY, KM_PRESS, 0, 0);
+ WM_keymap_add_item(keymap, "SCREEN_OT_animation_play", MEDIAPLAY, KM_PRESS, 0, 0);
+ WM_keymap_add_item(keymap, "SCREEN_OT_animation_cancel", MEDIASTOP, KM_PRESS, 0, 0);
+
/* Alternative keys for animation and sequencer playing */
#if 0 // XXX: disabled for restoring later... bad implementation
keymap= WM_keymap_find(keyconf, "Frames", 0, 0);
diff --git a/source/blender/editors/screen/screendump.c b/source/blender/editors/screen/screendump.c
index 7ac73eb8c14..c38544fdc37 100644
--- a/source/blender/editors/screen/screendump.c
+++ b/source/blender/editors/screen/screendump.c
@@ -26,6 +26,11 @@
* Making screendumps.
*/
+/** \file blender/editors/screen/screendump.c
+ * \ingroup edscr
+ */
+
+
#include <string.h>
#include "MEM_guardedalloc.h"