[Bf-blender-cvs] [e05ce1ea202] master: UV/Image: Remove Legacy Drawing

Jeroen Bakker noreply at git.blender.org
Tue Oct 20 17:06:43 CEST 2020


Commit: e05ce1ea2029a942ce0d9a9df018b36d0604f0d5
Author: Jeroen Bakker
Date:   Tue Oct 20 16:55:50 2020 +0200
Branches: master
https://developer.blender.org/rBe05ce1ea2029a942ce0d9a9df018b36d0604f0d5

UV/Image: Remove Legacy Drawing

With D8234 a new drawing method for UV/Image editor was introduced. For debugging
reasons we left the old drawing method in the code base. This patch will remove
the old drawing method.

Reviewed By: Clément Foucault

Differential Revision: https://developer.blender.org/D9011

===================================================================

M	release/scripts/startup/bl_ui/space_userpref.py
M	source/blender/blenloader/intern/versioning_290.c
M	source/blender/editors/include/ED_uvedit.h
M	source/blender/editors/space_image/space_image.c
M	source/blender/editors/uvedit/uvedit_draw.c
M	source/blender/makesdna/DNA_space_types.h
M	source/blender/makesdna/DNA_userdef_types.h
M	source/blender/makesrna/intern/rna_space.c
M	source/blender/makesrna/intern/rna_userdef.c

===================================================================

diff --git a/release/scripts/startup/bl_ui/space_userpref.py b/release/scripts/startup/bl_ui/space_userpref.py
index 77b0f17a937..864fd203e5b 100644
--- a/release/scripts/startup/bl_ui/space_userpref.py
+++ b/release/scripts/startup/bl_ui/space_userpref.py
@@ -2218,7 +2218,6 @@ class USERPREF_PT_experimental_debugging(ExperimentalPanel, Panel):
             context, (
                 ({"property": "use_undo_legacy"}, "T60695"),
                 ({"property": "use_cycles_debug"}, None),
-                ({"property": "use_image_editor_legacy_drawing"}, "T67530"),
             ),
         )
 
diff --git a/source/blender/blenloader/intern/versioning_290.c b/source/blender/blenloader/intern/versioning_290.c
index d93a6d57565..f08e896744b 100644
--- a/source/blender/blenloader/intern/versioning_290.c
+++ b/source/blender/blenloader/intern/versioning_290.c
@@ -897,4 +897,19 @@ void blo_do_versions_290(FileData *fd, Library *UNUSED(lib), Main *bmain)
   {
     /* Keep this block, even when empty. */
   }
+
+  /* Remove options of legacy UV/Image editor */
+  for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) {
+    LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
+      LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
+        switch (sl->spacetype) {
+          case SPACE_IMAGE: {
+            SpaceImage *sima = (SpaceImage *)sl;
+            sima->flag &= ~(SI_FLAG_UNUSED_20);
+            break;
+          }
+        }
+      }
+    }
+  }
 }
diff --git a/source/blender/editors/include/ED_uvedit.h b/source/blender/editors/include/ED_uvedit.h
index 53fb79bb012..629e77bd4f2 100644
--- a/source/blender/editors/include/ED_uvedit.h
+++ b/source/blender/editors/include/ED_uvedit.h
@@ -229,12 +229,6 @@ void ED_uvedit_add_simple_uvs(struct Main *bmain, const struct Scene *scene, str
 
 /* uvedit_draw.c */
 void ED_image_draw_cursor(struct ARegion *region, const float cursor[2]);
-void ED_uvedit_draw_main(struct SpaceImage *sima,
-                         const struct Scene *scene,
-                         struct ViewLayer *view_layer,
-                         struct Object *obedit,
-                         struct Object *obact,
-                         struct Depsgraph *depsgraph);
 
 /* uvedit_buttons.c */
 void ED_uvedit_buttons_register(struct ARegionType *art);
diff --git a/source/blender/editors/space_image/space_image.c b/source/blender/editors/space_image/space_image.c
index 7a066adae77..749e61955d9 100644
--- a/source/blender/editors/space_image/space_image.c
+++ b/source/blender/editors/space_image/space_image.c
@@ -634,22 +634,12 @@ static void image_main_region_draw(const bContext *C, ARegion *region)
 {
   /* draw entirely, view changes should be handled here */
   SpaceImage *sima = CTX_wm_space_image(C);
-  Object *obact = CTX_data_active_object(C);
   Object *obedit = CTX_data_edit_object(C);
   Depsgraph *depsgraph = CTX_data_expect_evaluated_depsgraph(C);
   Mask *mask = NULL;
-  bool show_uvedit = false;
-  bool show_curve = false;
   Scene *scene = CTX_data_scene(C);
-  ViewLayer *view_layer = CTX_data_view_layer(C);
   View2D *v2d = &region->v2d;
 
-  GPUViewport *viewport = WM_draw_region_get_viewport(region);
-  GPUFrameBuffer *framebuffer_default, *framebuffer_overlay;
-
-  framebuffer_default = GPU_viewport_framebuffer_default_get(viewport);
-  framebuffer_overlay = GPU_viewport_framebuffer_overlay_get(viewport);
-
   /* XXX not supported yet, disabling for now */
   scene->r.scemode &= ~R_COMP_CROP;
 
@@ -659,82 +649,37 @@ static void image_main_region_draw(const bContext *C, ARegion *region)
   image_main_region_set_view2d(sima, region);
 
   /* check for mask (delay draw) */
-  if (ED_space_image_show_uvedit(sima, obedit)) {
-    show_uvedit = true;
-  }
-  else if (sima->mode == SI_MODE_MASK) {
+  if (!ED_space_image_show_uvedit(sima, obedit) && sima->mode == SI_MODE_MASK) {
     mask = ED_space_image_get_mask(sima);
   }
-  else if (ED_space_image_paint_curve(C)) {
-    show_curve = true;
-  }
 
   /* we draw image in pixelspace */
-  if (!U.experimental.use_image_editor_legacy_drawing) {
-    DRW_draw_view(C);
-    draw_image_main_helpers(C, region);
-
-    /* Draw Meta data of the image isn't added to the DrawManager as it is
-     * used in other areas as well. */
-    if (sima->flag & SI_DRAW_METADATA) {
-      void *lock;
-      /* `ED_space_image_get_zoom` temporarily locks the image, so this needs to be done before
-       * the image is locked when calling `ED_space_image_acquire_buffer`. */
-      float zoomx, zoomy;
-      ED_space_image_get_zoom(sima, region, &zoomx, &zoomy);
-      ImBuf *ibuf = ED_space_image_acquire_buffer(sima, &lock, 0);
-      if (ibuf) {
-        int x, y;
-        rctf frame;
-        BLI_rctf_init(&frame, 0.0f, ibuf->x, 0.0f, ibuf->y);
-        UI_view2d_view_to_region(&region->v2d, 0.0f, 0.0f, &x, &y);
-        ED_region_image_metadata_draw(x, y, ibuf, &frame, zoomx, zoomy);
-        ED_space_image_release_buffer(sima, ibuf, lock);
-      }
+  DRW_draw_view(C);
+  draw_image_main_helpers(C, region);
+
+  /* Draw Meta data of the image isn't added to the DrawManager as it is
+   * used in other areas as well. */
+  if (sima->flag & SI_DRAW_METADATA) {
+    void *lock;
+    /* `ED_space_image_get_zoom` temporarily locks the image, so this needs to be done before
+     * the image is locked when calling `ED_space_image_acquire_buffer`. */
+    float zoomx, zoomy;
+    ED_space_image_get_zoom(sima, region, &zoomx, &zoomy);
+    ImBuf *ibuf = ED_space_image_acquire_buffer(sima, &lock, 0);
+    if (ibuf) {
+      int x, y;
+      rctf frame;
+      BLI_rctf_init(&frame, 0.0f, ibuf->x, 0.0f, ibuf->y);
+      UI_view2d_view_to_region(&region->v2d, 0.0f, 0.0f, &x, &y);
+      ED_region_image_metadata_draw(x, y, ibuf, &frame, zoomx, zoomy);
+      ED_space_image_release_buffer(sima, ibuf, lock);
     }
-
-    /* sample line */
-    UI_view2d_view_ortho(v2d);
-    draw_image_sample_line(sima);
-    UI_view2d_view_restore(C);
   }
-  else {
-    GPU_framebuffer_bind(framebuffer_default);
-    GPU_clear_color(0.0f, 0.0f, 0.0f, 0.0f);
-
-    GPU_framebuffer_bind(framebuffer_overlay);
-
-    float col[3];
-    /* clear and setup matrix */
-    UI_GetThemeColor3fv(TH_BACK, col);
-    srgb_to_linearrgb_v3_v3(col, col);
-    GPU_clear_color(col[0], col[1], col[2], 1.0f);
-    GPU_depth_test(GPU_DEPTH_NONE);
-    draw_image_main(C, region);
-
-    /* and uvs in 0.0-1.0 space */
-    UI_view2d_view_ortho(v2d);
 
-    ED_region_draw_cb_draw(C, region, REGION_DRAW_PRE_VIEW);
-
-    ED_uvedit_draw_main(sima, scene, view_layer, obedit, obact, depsgraph);
-
-    ED_region_draw_cb_draw(C, region, REGION_DRAW_POST_VIEW);
-
-    if (sima->flag & SI_SHOW_GPENCIL) {
-      /* Grease Pencil too (in addition to UV's) */
-      draw_image_grease_pencil((bContext *)C, true);
-    }
-    /* sample line */
-    draw_image_sample_line(sima);
-
-    UI_view2d_view_restore(C);
-
-    if (sima->flag & SI_SHOW_GPENCIL) {
-      /* draw Grease Pencil - screen space only */
-      draw_image_grease_pencil((bContext *)C, false);
-    }
-  }
+  /* sample line */
+  UI_view2d_view_ortho(v2d);
+  draw_image_sample_line(sima);
+  UI_view2d_view_restore(C);
 
   if (mask) {
     Image *image = ED_space_image(sima);
@@ -773,14 +718,7 @@ static void image_main_region_draw(const bContext *C, ARegion *region)
                         C);
   }
 
-  if ((show_uvedit || mask || show_curve) && U.experimental.use_image_editor_legacy_drawing) {
-    UI_view2d_view_ortho(v2d);
-    ED_image_draw_cursor(region, sima->cursor);
-    UI_view2d_view_restore(C);
-  }
-
   WM_gizmomap_draw(region->gizmo_map, C, WM_GIZMOMAP_DRAWSTEP_2D);
-
   draw_image_cache(C, region);
 }
 
diff --git a/source/blender/editors/uvedit/uvedit_draw.c b/source/blender/editors/uvedit/uvedit_draw.c
index 044fca2310c..a4ab9164017 100644
--- a/source/blender/editors/uvedit/uvedit_draw.c
+++ b/source/blender/editors/uvedit/uvedit_draw.c
@@ -21,78 +21,20 @@
  * \ingroup eduv
  */
 
-#include <float.h>
-#include <math.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "MEM_guardedalloc.h"
-
-#include "DNA_material_types.h"
-#include "DNA_mesh_types.h"
-#include "DNA_meshdata_types.h"
-#include "DNA_object_types.h"
-#include "DNA_scene_types.h"
-#include "DNA_screen_types.h"
-#include "DNA_space_types.h"
-
-#include "../../draw/intern/draw_cache_impl.h"
-
 #include "BLI_math.h"
-#include "BLI_task.h"
 #include "BLI_utildefines.h"
 
-#include "BKE_deform.h"
-#include "BKE_editmesh.h"
-#include "BKE_layer.h"
-#include "BKE_material.h"
-
-#include "BKE_scene.h"
-
-#include "DEG_depsgraph.h"
-#include "DEG_depsgraph_query.h"
+#include "DNA_scene_types.h"
+#include "DNA_screen_types.h"
+#include "DNA_userdef_types.h"
 
-#include "GPU_batch.h"
-#include "GPU_framebuffer.h"
 #include "GPU_immediate.h"
 #include "GPU_matrix.h"
-#include "GPU_state.h"
-
-#include "ED_image.h"
-#include "ED_mesh.h"
-#include "ED_uvedit.h"
 
 #include "UI_interface.h"
-#include "UI_resources.h"
 #include "UI_view2d.h"
 
-#include "uvedit_intern.h"
-
-/* Struct containing the needed batches per object.
- * this optimizes the way how data is requested from
- * the draw manager. */
-typedef struct UVEditGPUBatches {
-  Object *ob_eval;
-  GPUBatch *faces;
-  GPUBatch *edges;
-  GPUBatch *verts;
-  GPUBatch *facedots;
-} UVEditGPUBatches;
-
-static int draw_uvs_face_check(const ToolSettings *ts)
-{
-  /* checks if we are selecting only faces */
-  if (ts->uv_flag & UV_SYNC_SELECTION) {
-    if (ts->selectmode == SCE_SELECT_FACE) {
-      return 2;
-    }
-    if (ts->selectmode & SCE_SELECT_FACE) {
-      return 1;
-    }
-    return 0;
-  }
-  return (ts->uv_selectmode == UV_SELECT_FACE);
-}
+#include "ED_uvedit.h"
 
 /* ------------------------- */
 
@@ -166,434 +108,3 @@ void ED_image_draw_cursor(ARegion *region, const float cursor[2])
 
   GPU_matrix_translate_2f(-cursor[0], -cursor[1]);
 }
-
-static void uvedit_get_batches(Object *ob,
-                               SpaceImage *sima,
-                               const Scene *scene,
-                               UVEditGPUBatches *batches,
-                               float *tot_area,
-                  

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list