[Bf-blender-cvs] [4180416] GPU_data_request: Workflow shader data
Antony Riakiotakis
noreply at git.blender.org
Fri Apr 10 16:39:02 CEST 2015
Commit: 418041628a2d2f246b8450a52db93638c8ffc7bd
Author: Antony Riakiotakis
Date: Fri Apr 10 16:38:42 2015 +0200
Branches: GPU_data_request
https://developer.blender.org/rB418041628a2d2f246b8450a52db93638c8ffc7bd
Workflow shader data
Hook the struct to more places. Now there is a button
to choose a workflow instead of a draw type in the new viewport
(still needs to be somehow sorted according to object mode)
===================================================================
A source/blender/blenkernel/BKE_workflow_shaders.h
M source/blender/blenkernel/CMakeLists.txt
M source/blender/blenkernel/intern/idcode.c
M source/blender/blenkernel/intern/library.c
A source/blender/blenkernel/intern/workflow_shaders.c
M source/blender/blenloader/intern/readfile.c
M source/blender/editors/space_view3d/view3d_edit.c
M source/blender/editors/space_view3d/view3d_header.c
M source/blender/editors/space_view3d/view3d_intern.h
M source/blender/editors/space_view3d/view3d_ops.c
M source/blender/makesdna/DNA_view3d_types.h
M source/blender/makesrna/RNA_access.h
M source/blender/makesrna/intern/rna_ID.c
M source/blender/makesrna/intern/rna_space.c
===================================================================
diff --git a/source/blender/blenkernel/BKE_workflow_shaders.h b/source/blender/blenkernel/BKE_workflow_shaders.h
new file mode 100644
index 0000000..d1782e9
--- /dev/null
+++ b/source/blender/blenkernel/BKE_workflow_shaders.h
@@ -0,0 +1,43 @@
+/*
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * 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) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): Antony Riakiotakis.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+#ifndef BKE_WORKFLOW_SHADERS_H
+#define BKE_WORKFLOW_SHADERS_H
+
+/** \file BKE_workflow_shaders.h
+ * \ingroup bke
+ * \since March 2015
+ * \author psy-fi
+ */
+
+struct GPUWorkflowShader;
+struct Main;
+
+void BKE_workflow_shader_free(struct GPUWorkflowShader *shader);
+struct GPUWorkflowShader *BKE_workflow_shader_add(struct Main *bmain, const char *name);
+
+
+#endif // BKE_WORKFLOW_SHADERS_H
diff --git a/source/blender/blenkernel/CMakeLists.txt b/source/blender/blenkernel/CMakeLists.txt
index f19c106..834ee2e 100644
--- a/source/blender/blenkernel/CMakeLists.txt
+++ b/source/blender/blenkernel/CMakeLists.txt
@@ -174,6 +174,7 @@ set(SRC
intern/tracking_util.c
intern/treehash.c
intern/unit.c
+ intern/workflow_shaders.c
intern/world.c
intern/writeavi.c
intern/writeframeserver.c
@@ -274,6 +275,7 @@ set(SRC
BKE_treehash.h
BKE_unit.h
BKE_utildefines.h
+ BKE_workflow_shaders.h
BKE_world.h
BKE_writeavi.h
BKE_writeframeserver.h
diff --git a/source/blender/blenkernel/intern/idcode.c b/source/blender/blenkernel/intern/idcode.c
index 1b7a03e..82b58cd 100644
--- a/source/blender/blenkernel/intern/idcode.c
+++ b/source/blender/blenkernel/intern/idcode.c
@@ -83,6 +83,7 @@ static IDType idtypes[] = {
{ ID_TE, "Texture", "textures", IDTYPE_FLAGS_ISLINKABLE },
{ ID_TXT, "Text", "texts", IDTYPE_FLAGS_ISLINKABLE },
{ ID_VF, "VFont", "fonts", IDTYPE_FLAGS_ISLINKABLE },
+ { ID_GPUWS, "GPUWorkflowShader","workflowshaders", IDTYPE_FLAGS_ISLINKABLE },
{ ID_WO, "World", "worlds", IDTYPE_FLAGS_ISLINKABLE },
{ ID_WM, "WindowManager", "window_managers", 0 },
};
diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c
index dfce7a8..07bdd41 100644
--- a/source/blender/blenkernel/intern/library.c
+++ b/source/blender/blenkernel/intern/library.c
@@ -67,6 +67,7 @@
#include "DNA_vfont_types.h"
#include "DNA_windowmanager_types.h"
#include "DNA_world_types.h"
+#include "DNA_view3d_types.h"
#include "BLI_blenlib.h"
#include "BLI_utildefines.h"
@@ -750,6 +751,9 @@ static ID *alloc_libblock_notest(short type)
case ID_PC:
id = MEM_callocN(sizeof(PaintCurve), "Paint Curve");
break;
+ case ID_GPUWS:
+ id = MEM_callocN(sizeof(GPUWorkflowShader), "Workflow Shader");
+ break;
}
return id;
}
diff --git a/source/blender/blenkernel/intern/workflow_shaders.c b/source/blender/blenkernel/intern/workflow_shaders.c
new file mode 100644
index 0000000..8a0ea05
--- /dev/null
+++ b/source/blender/blenkernel/intern/workflow_shaders.c
@@ -0,0 +1,57 @@
+/*
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * 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) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): Antony Riakiotakis.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/blenkernel/intern/workflow_shaders.c
+ * \ingroup bke
+ */
+
+#include "DNA_view3d_types.h"
+#include "DNA_object_types.h"
+
+#include "BKE_library.h"
+#include "BKE_workflow_shaders.h"
+
+
+void BKE_workflow_shader_free(GPUWorkflowShader *shader)
+{
+
+}
+
+struct GPUWorkflowShader *BKE_workflow_shader_add(struct Main *bmain, const char *name)
+{
+ GPUWorkflowShader *wfshader;
+
+ wfshader = BKE_libblock_alloc(bmain, ID_GPUWS, name);
+
+ /* enable fake user by default */
+ wfshader->id.flag |= LIB_FAKEUSER;
+
+ /* initially active only for object mode */
+ wfshader->objectmode |= OB_MODE_OBJECT;
+
+ return wfshader;
+}
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index a0285ce..646d7a1 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -1952,6 +1952,23 @@ static void direct_link_palette(FileData *fd, Palette *palette)
link_list(fd, &palette->colors);
}
+static void lib_link_workflow_shader(FileData *UNUSED(fd), Main *main)
+{
+ GPUWorkflowShader *wfshader;
+
+ /* only link ID pointers */
+ for (wfshader = main->gpuworkflows.first; wfshader; wfshader = wfshader->id.next) {
+ if (wfshader->id.flag & LIB_NEED_LINK) {
+ wfshader->id.flag -= LIB_NEED_LINK;
+ }
+ }
+}
+
+static void direct_link_workflow_shader(FileData *UNUSED(fd), GPUWorkflowShader *UNUSED(wfshader))
+{
+
+}
+
static void lib_link_paint_curve(FileData *UNUSED(fd), Main *main)
{
PaintCurve *pc;
@@ -7640,6 +7657,9 @@ static BHead *read_libblock(FileData *fd, Main *main, BHead *bhead, int flag, ID
case ID_PC:
direct_link_paint_curve(fd, (PaintCurve *)id);
break;
+ case ID_GPUWS:
+ direct_link_workflow_shader(fd, (GPUWorkflowShader *)id);
+ break;
}
oldnewmap_free_unused(fd->datamap);
@@ -7828,6 +7848,7 @@ static void lib_link_all(FileData *fd, Main *main)
lib_link_nodetree(fd, main); /* has to be done after scene/materials, this will verify group nodes */
lib_link_brush(fd, main);
lib_link_palette(fd, main);
+ lib_link_workflow_shader(fd, main);
lib_link_paint_curve(fd, main);
lib_link_particlesettings(fd, main);
lib_link_movieclip(fd, main);
diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c
index 671fc68..659a1ef 100644
--- a/source/blender/editors/space_view3d/view3d_edit.c
+++ b/source/blender/editors/space_view3d/view3d_edit.c
@@ -44,6 +44,7 @@
#include "BLI_math.h"
#include "BLI_utildefines.h"
+#include "BKE_main.h"
#include "BKE_camera.h"
#include "BKE_context.h"
#include "BKE_font.h"
@@ -55,7 +56,7 @@
#include "BKE_screen.h"
#include "BKE_action.h"
#include "BKE_depsgraph.h" /* for ED_view3d_camera_lock_sync */
-
+#include "BKE_workflow_shaders.h"
#include "BIF_gl.h"
#include "BIF_glutil.h"
@@ -5021,3 +5022,31 @@ void ED_view3D_lock_clear(View3D *v3d)
v3d->ob_centre_cursor = false;
v3d->flag2 &= ~V3D_LOCK_CAMERA;
}
+
+
+/**** Workflow Shaders ******************/
+
+static int view3d_workflow_new_exec(bContext *C, wmOperator *UNUSED(op))
+{
+ Main *bmain = CTX_data_main(C);
+ View3D *v3d = CTX_wm_view3d(C);
+ v3d->activeworkflow = BKE_workflow_shader_add(bmain, "Workflow Shader");
+ return OPERATOR_FINISHED;
+}
+
+
+void VIEW3D_OT_workflow_new(struct wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name = "New Workflow Shader";
+ ot->description = "Creates a new workflow shader";
+ ot->idname = "VIEW3D_OT_workflow_new";
+
+ /* api callbacks */
+ ot->exec = view3d_workflow_new_exec;
+ ot->poll = ED_operator_view3d_active;
+
+ /* flags */
+ ot->flag = 0;
+}
+
diff --git a/source/blender/editors/space_view3d/view3d_header.c b/source/blender/editors/space_view3d/view3d_header.c
index f891234..a507299 100644
--- a/source/blender/editors/space_view3d/view3d_header.c
+++ b/source/blender/editors/space_view3d/view3d_header.c
@@ -330,7 +330,11 @@ void uiTemplateHeader3D(uiLayout *layout, struct bContext *C)
}
/* Draw type */
- uiItemR(layout, &v3dptr, "viewport_shade", UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
+ if (U.gameflags & USER_VIEWPORT_2)
+ /* TODO add something for unlinking */
+ uiTemplateID(layout, C, &v3dptr, "activeworkflow", "VIEW3D_OT_workflow_new", NULL, NULL);
+ else
+ uiItemR(layout, &v3dptr, "viewport_shade", UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
if (obedit == NULL && is_paint) {
if (ob->mode & OB_MODE_ALL_PAINT) {
diff --git a/source/blender/editors/space_view3d/view3d_intern.h b/source/blender/editors/space_view3d/view3d_intern.h
index 65125f0..c4011e9 100644
--- a/source/blender/editors/space_view3d/view3d_intern.h
+++ b/source/blender/editors/space_view3d/view3d_intern.h
@@ -107,6 +107,7 @@ void VIEW3D_OT_enable_manipulator(struct wmOperatorType *ot);
void VIEW3D_OT_render_border(struct wmOperatorType *ot);
void VIEW3D_OT_clear_render_border(struct wmOperatorType *ot);
void VIEW3D_OT_zoom_border(struct wmOperatorType *ot);
+void VIEW3D_OT_workflow_new(struct wmOperatorType *ot);
void view3d_boxview_copy(ScrArea *sa, ARegion *ar);
diff --git a/source/blender/editors/space_view3d/view3d_ops.c b/source/blender/editors/space_view3d/view3d_ops.c
index 8c668b2..817c16e 100644
--- a/source/blender/editors/space_view3d/view3d_ops.
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list