merge with trunk/2.5 at r24378
[blender-staging.git] / source / blender / editors / screen / screen_ops.c
index a1537b2ddf5739bd1b8ab2c1eace56cc793987ee..dbfabc00737f19a2da37593e99b2ea258f8c2606 100644 (file)
@@ -61,6 +61,7 @@
 #include "BKE_scene.h"
 #include "BKE_screen.h"
 #include "BKE_utildefines.h"
+#include "BKE_tessmesh.h"
 #include "BKE_sound.h"
 #include "BKE_writeavi.h"
 
@@ -222,7 +223,7 @@ int ED_operator_editmesh(bContext *C)
 {
        Object *obedit= CTX_data_edit_object(C);
        if(obedit && obedit->type==OB_MESH)
-               return NULL != ((Mesh *)obedit->data)->edit_mesh;
+               return NULL != ((Mesh *)obedit->data)->edit_btmesh;
        return 0;
 }
 
@@ -249,36 +250,27 @@ int ED_operator_posemode(bContext *C)
 int ED_operator_uvedit(bContext *C)
 {
        Object *obedit= CTX_data_edit_object(C);
-       EditMesh *em= NULL;
+       BMEditMesh *em= NULL;
 
        if(obedit && obedit->type==OB_MESH)
-               em= BKE_mesh_get_editmesh((Mesh *)obedit->data);
-
-       if(em && (em->faces.first) && (CustomData_has_layer(&em->fdata, CD_MTFACE))) {
-               BKE_mesh_end_editmesh(obedit->data, em);
+               em= ((Mesh *)obedit->data)->edit_btmesh;
+       if (em && em->bm->totface && CustomData_has_layer(&em->bm->pdata, CD_MTEXPOLY))
                return 1;
-       }
 
-       if(obedit)
-               BKE_mesh_end_editmesh(obedit->data, em);
        return 0;
 }
 
 int ED_operator_uvmap(bContext *C)
 {
        Object *obedit= CTX_data_edit_object(C);
-       EditMesh *em= NULL;
+       BMEditMesh *em= NULL;
 
        if(obedit && obedit->type==OB_MESH)
-               em= BKE_mesh_get_editmesh((Mesh *)obedit->data);
+               em= ((Mesh *)obedit->data)->edit_btmesh;
 
-       if(em && (em->faces.first)) {
-               BKE_mesh_end_editmesh(obedit->data, em);
+       if(em && (em->bm->totface))
                return 1;
-       }
 
-       if(obedit)
-               BKE_mesh_end_editmesh(obedit->data, em);
        return 0;
 }
 
@@ -2232,7 +2224,7 @@ static int screen_animation_step(bContext *C, wmOperator *op, wmEvent *event)
                ScreenAnimData *sad= wt->customdata;
                ScrArea *sa;
                int sync;
-
+               
                /* sync, don't sync, or follow scene setting */
                if(sad->flag & ANIMPLAY_FLAG_SYNC) sync= 1;
                else if(sad->flag & ANIMPLAY_FLAG_NO_SYNC) sync= 0;
@@ -2241,7 +2233,7 @@ static int screen_animation_step(bContext *C, wmOperator *op, wmEvent *event)
                if(sync) {
                        /* skip frames */
                        int step = floor(wt->duration * FPS);
-                       if(sad->flag & ANIMPLAY_FLAG_REVERSE) // XXX does this option work with audio?
+                       if (sad->flag & ANIMPLAY_FLAG_REVERSE) // XXX does this option work with audio?
                                scene->r.cfra -= step;
                        else
                                scene->r.cfra += step;
@@ -2249,7 +2241,7 @@ static int screen_animation_step(bContext *C, wmOperator *op, wmEvent *event)
                }
                else {
                        /* one frame +/- */
-                       if(sad->flag & ANIMPLAY_FLAG_REVERSE)
+                       if (sad->flag & ANIMPLAY_FLAG_REVERSE)
                                scene->r.cfra--;
                        else
                                scene->r.cfra++;
@@ -2291,7 +2283,7 @@ static int screen_animation_step(bContext *C, wmOperator *op, wmEvent *event)
 
                /* since we follow drawflags, we can't send notifier but tag regions ourselves */
                ED_update_for_newframe(C, 1);
-
+               
                sound_update_playing(C);
 
                for(sa= screen->areabase.first; sa; sa= sa->next) {
@@ -2341,7 +2333,7 @@ static int screen_animation_play(bContext *C, wmOperator *op, wmEvent *event)
                ScrArea *sa= CTX_wm_area(C);
                int mode= (RNA_boolean_get(op->ptr, "reverse")) ? -1 : 1;
                int sync= -1;
-
+               
                if(RNA_property_is_set(op->ptr, "sync"))
                        sync= (RNA_boolean_get(op->ptr, "sync"));
                
@@ -2353,7 +2345,7 @@ static int screen_animation_play(bContext *C, wmOperator *op, wmEvent *event)
                        
                        /* update region if TIME_REGION was set, to leftmost 3d window */
                        ED_screen_animation_timer_update(C, stime->redraws);
-               }
+                       }
                else {
                        int redraws = TIME_REGION|TIME_ALL_3D_WIN;