[Bf-blender-cvs] [297261eb906] master: CodeCleanup: Added enums to opengl render functions

Jeroen Bakker noreply at git.blender.org
Fri Mar 6 12:13:51 CET 2020


Commit: 297261eb906c56c7decf4401e6a3e06cec1691e8
Author: Jeroen Bakker
Date:   Fri Mar 6 12:08:03 2020 +0100
Branches: master
https://developer.blender.org/rB297261eb906c56c7decf4401e6a3e06cec1691e8

CodeCleanup: Added enums to opengl render functions

Motivation the functions get 3 different kind of flag parameters (ImBuf,
DrawType, OffscreenRendering) the naming of the flags were not clear,
leading to mistakes and unnecessary time spend debugging.

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

M	source/blender/blenkernel/BKE_sequencer.h
A	source/blender/blenkernel/BKE_sequencer_offscreen.h
M	source/blender/blenkernel/intern/sequencer.c
M	source/blender/editors/include/ED_view3d.h
A	source/blender/editors/include/ED_view3d_offscreen.h
M	source/blender/editors/render/render_opengl.c
M	source/blender/editors/sculpt_paint/paint_image_proj.c
M	source/blender/editors/space_sequencer/space_sequencer.c
M	source/blender/editors/space_view3d/view3d_draw.c
M	source/blender/imbuf/IMB_imbuf_types.h
M	source/blender/makesdna/DNA_object_enums.h
M	source/blender/makesdna/DNA_object_types.h
M	source/blender/makesdna/DNA_view3d_types.h
M	source/blender/python/gpu/CMakeLists.txt
M	source/blender/python/gpu/gpu_py_offscreen.c
M	source/blender/windowmanager/intern/wm_files.c

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

diff --git a/source/blender/blenkernel/BKE_sequencer.h b/source/blender/blenkernel/BKE_sequencer.h
index 789d6b694cb..2a45d89bad4 100644
--- a/source/blender/blenkernel/BKE_sequencer.h
+++ b/source/blender/blenkernel/BKE_sequencer.h
@@ -521,21 +521,6 @@ struct Sequence *BKE_sequencer_add_movie_strip(struct bContext *C,
                                                ListBase *seqbasep,
                                                struct SeqLoadInfo *seq_load);
 
-typedef struct ImBuf *(*SequencerDrawView)(struct Depsgraph *depsgraph,
-                                           struct Scene *scene,
-                                           struct View3DShading *shading_override,
-                                           int drawtype,
-                                           struct Object *camera,
-                                           int width,
-                                           int height,
-                                           unsigned int flag,
-                                           unsigned int draw_flags,
-                                           int alpha_mode,
-                                           const char *viewname,
-                                           struct GPUOffScreen *ofs,
-                                           char err_out[256]);
-extern SequencerDrawView sequencer_view3d_cb;
-
 /* copy/paste */
 extern ListBase seqbase_clipboard;
 extern int seqbase_clipboard_frame;
diff --git a/source/blender/blenkernel/BKE_sequencer_offscreen.h b/source/blender/blenkernel/BKE_sequencer_offscreen.h
new file mode 100644
index 00000000000..72e3f246dcb
--- /dev/null
+++ b/source/blender/blenkernel/BKE_sequencer_offscreen.h
@@ -0,0 +1,56 @@
+/*
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2004 Blender Foundation.
+ * All rights reserved.
+ */
+
+#ifndef __BKE_SEQUENCER_OFFSCREEN_H__
+#define __BKE_SEQUENCER_OFFSCREEN_H__
+
+/** \file
+ * \ingroup bke
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "DNA_object_enums.h"
+
+#include "DNA_view3d_types.h"
+
+#include "IMB_imbuf_types.h"
+
+typedef struct ImBuf *(*SequencerDrawView)(struct Depsgraph *depsgraph,
+                                           struct Scene *scene,
+                                           struct View3DShading *shading_override,
+                                           eObjectDrawType drawtype,
+                                           struct Object *camera,
+                                           int width,
+                                           int height,
+                                           eImBufFlags flag,
+                                           eV3DOffscreenDrawFlag draw_flags,
+                                           int alpha_mode,
+                                           const char *viewname,
+                                           struct GPUOffScreen *ofs,
+                                           char err_out[256]);
+extern SequencerDrawView sequencer_view3d_cb;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __BKE_SEQUENCER_H__ */
diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c
index e86563ea08c..ea53726a94d 100644
--- a/source/blender/blenkernel/intern/sequencer.c
+++ b/source/blender/blenkernel/intern/sequencer.c
@@ -64,6 +64,7 @@
 #include "BKE_layer.h"
 #include "BKE_main.h"
 #include "BKE_sequencer.h"
+#include "BKE_sequencer_offscreen.h"
 #include "BKE_movieclip.h"
 #include "BKE_fcurve.h"
 #include "BKE_scene.h"
diff --git a/source/blender/editors/include/ED_view3d.h b/source/blender/editors/include/ED_view3d.h
index 66468275a1e..9627e7d7617 100644
--- a/source/blender/editors/include/ED_view3d.h
+++ b/source/blender/editors/include/ED_view3d.h
@@ -45,7 +45,6 @@ struct EditBone;
 struct GPUOffScreen;
 struct GPUViewport;
 struct ID;
-struct ImBuf;
 struct MVert;
 struct Main;
 struct MetaElem;
@@ -101,6 +100,24 @@ typedef struct ViewDepths {
   bool damaged;
 } ViewDepths;
 
+typedef struct ViewDrawOffscreenContext {
+  struct Depsgraph *depsgraph;
+  struct Scene *scene;
+  int drawtype;
+  struct View3D *v3d;
+  struct ARegion *ar;
+  int winx;
+  int winy;
+  float viewmat[4][4];
+  float winmat[4][4];
+  bool do_sky;
+  bool is_persp;
+  const char *viewname;
+  const bool do_color_management;
+  struct GPUOffScreen *ofs;
+  struct GPUViewport *viewport;
+} ViewDrawOffscreenContext;
+
 /* Rotate 3D cursor on placement. */
 enum eV3DCursorOrient {
   V3D_CURSOR_ORIENT_NONE = 0,
@@ -564,21 +581,6 @@ void ED_draw_object_facemap(struct Depsgraph *depsgraph,
 struct RenderEngineType *ED_view3d_engine_type(struct Scene *scene, int drawtype);
 
 bool ED_view3d_context_activate(struct bContext *C);
-void ED_view3d_draw_offscreen(struct Depsgraph *depsgraph,
-                              struct Scene *scene,
-                              int drawtype,
-                              struct View3D *v3d,
-                              struct ARegion *ar,
-                              int winx,
-                              int winy,
-                              float viewmat[4][4],
-                              float winmat[4][4],
-                              bool do_sky,
-                              bool is_persp,
-                              const char *viewname,
-                              const bool do_color_management,
-                              struct GPUOffScreen *ofs,
-                              struct GPUViewport *viewport);
 void ED_view3d_draw_setup_view(struct wmWindow *win,
                                struct Depsgraph *depsgraph,
                                struct Scene *scene,
@@ -588,32 +590,6 @@ void ED_view3d_draw_setup_view(struct wmWindow *win,
                                float winmat[4][4],
                                const struct rcti *rect);
 
-struct ImBuf *ED_view3d_draw_offscreen_imbuf(struct Depsgraph *depsgraph,
-                                             struct Scene *scene,
-                                             int drawtype,
-                                             struct View3D *v3d,
-                                             struct ARegion *ar,
-                                             int sizex,
-                                             int sizey,
-                                             unsigned int flag,
-                                             int alpha_mode,
-                                             const char *viewname,
-                                             struct GPUOffScreen *ofs,
-                                             char err_out[256]);
-struct ImBuf *ED_view3d_draw_offscreen_imbuf_simple(struct Depsgraph *depsgraph,
-                                                    struct Scene *scene,
-                                                    struct View3DShading *shading_override,
-                                                    int drawtype,
-                                                    struct Object *camera,
-                                                    int width,
-                                                    int height,
-                                                    unsigned int flag,
-                                                    unsigned int draw_flags,
-                                                    int alpha_mode,
-                                                    const char *viewname,
-                                                    struct GPUOffScreen *ofs,
-                                                    char err_out[256]);
-
 struct Base *ED_view3d_give_base_under_cursor(struct bContext *C, const int mval[2]);
 struct Object *ED_view3d_give_object_under_cursor(struct bContext *C, const int mval[2]);
 bool ED_view3d_is_object_under_cursor(struct bContext *C, const int mval[2]);
diff --git a/source/blender/editors/include/ED_view3d_offscreen.h b/source/blender/editors/include/ED_view3d_offscreen.h
new file mode 100644
index 00000000000..5a31516ec64
--- /dev/null
+++ b/source/blender/editors/include/ED_view3d_offscreen.h
@@ -0,0 +1,90 @@
+/*
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2008 Blender Foundation.
+ * All rights reserved.
+ */
+
+/** \file
+ * \ingroup editors
+ */
+
+#ifndef __ED_VIEW3D_OFFSCREEN_H__
+#define __ED_VIEW3D_OFFSCREEN_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* ********* exports for space_view3d/ module for offscreen rendering ********** */
+struct Depsgraph;
+struct Scene;
+struct View3D;
+struct ARegion;
+struct GPUOffScreen;
+struct GPUViewport;
+struct View3DShading;
+
+#include "DNA_view3d_types.h"
+#include "DNA_object_enums.h"
+#include "IMB_imbuf_types.h"
+
+void ED_view3d_draw_offscreen(struct Depsgraph *depsgraph,
+                         

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list