[Bf-blender-cvs] [042cf19] multiview: Multiview Base Commit 6/10: Compositor

Dalai Felinto noreply at git.blender.org
Sat May 10 20:18:12 CEST 2014


Commit: 042cf19838cf07d079d92bea957bb946ac394604
Author: Dalai Felinto
Date:   Sat May 10 14:58:20 2014 -0300
https://developer.blender.org/rB042cf19838cf07d079d92bea957bb946ac394604

Multiview Base Commit 6/10: Compositor

This is part of the multiview rebase from a github to git.blender.org
repository. The rebase was made based on file areas, so build is likely
broken in some of those parts, but it bulds fine in the end.

The documentation and sample files were removed and now live in:
https://github.com/dfelinto/multiview-samples

The original git history can be found in:
https://github.com/dfelinto/blender/tree/multiview-pre-b3d

Code contributors of the original branch in github:
* Alexey Akishin
* Gabriel Caraballo

Original design made in contribution with Francesco Siddi
Original branch and design partially reviewed by Brecht Van Lommel

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

M	release/scripts/startup/nodeitems_builtins.py
M	source/blender/blenkernel/BKE_node.h
M	source/blender/compositor/CMakeLists.txt
M	source/blender/compositor/COM_compositor.h
M	source/blender/compositor/intern/COM_CompositorContext.h
M	source/blender/compositor/intern/COM_Converter.cpp
M	source/blender/compositor/intern/COM_ExecutionSystem.cpp
M	source/blender/compositor/intern/COM_ExecutionSystem.h
M	source/blender/compositor/intern/COM_Node.cpp
M	source/blender/compositor/intern/COM_Node.h
M	source/blender/compositor/intern/COM_compositor.cpp
M	source/blender/compositor/nodes/COM_CompositorNode.cpp
M	source/blender/compositor/nodes/COM_ImageNode.cpp
M	source/blender/compositor/nodes/COM_ImageNode.h
M	source/blender/compositor/nodes/COM_OutputFileNode.cpp
M	source/blender/compositor/nodes/COM_RenderLayersNode.cpp
A	source/blender/compositor/nodes/COM_SwitchViewNode.cpp
A	source/blender/compositor/nodes/COM_SwitchViewNode.h
M	source/blender/compositor/operations/COM_CompositorOperation.cpp
M	source/blender/compositor/operations/COM_CompositorOperation.h
A	source/blender/compositor/operations/COM_OutputFileMultiViewOperation.cpp
A	source/blender/compositor/operations/COM_OutputFileMultiViewOperation.h
M	source/blender/compositor/operations/COM_OutputFileOperation.cpp
M	source/blender/compositor/operations/COM_OutputFileOperation.h
M	source/blender/compositor/operations/COM_RenderLayersProg.cpp
M	source/blender/compositor/operations/COM_RenderLayersProg.h
M	source/blender/editors/space_node/drawnode.c
M	source/blender/editors/space_node/node_edit.c
M	source/blender/editors/space_node/node_intern.h
M	source/blender/editors/space_node/node_ops.c
M	source/blender/makesdna/DNA_node_types.h
M	source/blender/makesrna/intern/rna_nodetree.c
M	source/blender/nodes/CMakeLists.txt
M	source/blender/nodes/NOD_composite.h
M	source/blender/nodes/NOD_static_types.h
M	source/blender/nodes/composite/node_composite_tree.c
M	source/blender/nodes/composite/nodes/node_composite_image.c
M	source/blender/nodes/composite/nodes/node_composite_outputFile.c
A	source/blender/nodes/composite/nodes/node_composite_switchview.c

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

diff --git a/release/scripts/startup/nodeitems_builtins.py b/release/scripts/startup/nodeitems_builtins.py
index 34c0739..d9ec6d2 100644
--- a/release/scripts/startup/nodeitems_builtins.py
+++ b/release/scripts/startup/nodeitems_builtins.py
@@ -301,6 +301,7 @@ compositor_node_categories = [
         NodeItem("CompositorNodeCombYUVA"),
         NodeItem("CompositorNodeSepYCCA"),
         NodeItem("CompositorNodeCombYCCA"),
+        NodeItem("CompositorNodeSwitchView"),
         ]),
     CompositorNodeCategory("CMP_OP_FILTER", "Filter", items=[
         NodeItem("CompositorNodeBlur"),
diff --git a/source/blender/blenkernel/BKE_node.h b/source/blender/blenkernel/BKE_node.h
index 13a32ee..1d40a95 100644
--- a/source/blender/blenkernel/BKE_node.h
+++ b/source/blender/blenkernel/BKE_node.h
@@ -901,6 +901,7 @@ void            ntreeGPUMaterialNodes(struct bNodeTree *ntree, struct GPUMateria
 #define CMP_NODE_MAP_RANGE	319
 #define CMP_NODE_PLANETRACKDEFORM	320
 #define CMP_NODE_CORNERPIN          321
+#define CMP_NODE_SWITCH_VIEW    322
 
 /* channel toggles */
 #define CMP_CHAN_RGB		1
@@ -936,7 +937,8 @@ void            ntreeGPUMaterialNodes(struct bNodeTree *ntree, struct GPUMateria
 /* API */
 struct CompBuf;
 void ntreeCompositExecTree(struct Scene *scene, struct bNodeTree *ntree, struct RenderData *rd, int rendering, int do_previews,
-                           const struct ColorManagedViewSettings *view_settings, const struct ColorManagedDisplaySettings *display_settings);
+                           const struct ColorManagedViewSettings *view_settings, const struct ColorManagedDisplaySettings *display_settings,
+                           int view_id);
 void ntreeCompositTagRender(struct Scene *sce);
 int ntreeCompositTagAnimated(struct bNodeTree *ntree);
 void ntreeCompositTagGenerators(struct bNodeTree *ntree);
diff --git a/source/blender/compositor/CMakeLists.txt b/source/blender/compositor/CMakeLists.txt
index a194334..f801ada 100644
--- a/source/blender/compositor/CMakeLists.txt
+++ b/source/blender/compositor/CMakeLists.txt
@@ -121,6 +121,8 @@ set(SRC
 	nodes/COM_TimeNode.h
 	nodes/COM_SwitchNode.cpp
 	nodes/COM_SwitchNode.h
+	nodes/COM_SwitchViewNode.cpp
+	nodes/COM_SwitchViewNode.h
 	nodes/COM_MovieClipNode.cpp
 	nodes/COM_MovieClipNode.h
 	nodes/COM_OutputFileNode.cpp
@@ -367,6 +369,8 @@ set(SRC
 	operations/COM_CompositorOperation.cpp
 	operations/COM_OutputFileOperation.h
 	operations/COM_OutputFileOperation.cpp
+	operations/COM_OutputFileMultiViewOperation.h
+	operations/COM_OutputFileMultiViewOperation.cpp
 	operations/COM_ViewerOperation.h
 	operations/COM_ViewerOperation.cpp
 	operations/COM_PreviewOperation.h
diff --git a/source/blender/compositor/COM_compositor.h b/source/blender/compositor/COM_compositor.h
index 2cf2c69..fad31e8 100644
--- a/source/blender/compositor/COM_compositor.h
+++ b/source/blender/compositor/COM_compositor.h
@@ -316,7 +316,7 @@ extern "C" {
  *            generation in display space
  */
 void COM_execute(RenderData *rd, Scene *scene, bNodeTree *editingtree, int rendering,
-                 const ColorManagedViewSettings *viewSettings, const ColorManagedDisplaySettings *displaySettings);
+                 const ColorManagedViewSettings *viewSettings, const ColorManagedDisplaySettings *displaySettings, const int view_id);
 
 /**
  * @brief Deinitialize the compositor caches and allocated memory.
diff --git a/source/blender/compositor/intern/COM_CompositorContext.h b/source/blender/compositor/intern/COM_CompositorContext.h
index a398ae9..41349a4 100644
--- a/source/blender/compositor/intern/COM_CompositorContext.h
+++ b/source/blender/compositor/intern/COM_CompositorContext.h
@@ -87,6 +87,11 @@ private:
 	const ColorManagedViewSettings *m_viewSettings;
 	const ColorManagedDisplaySettings *m_displaySettings;
 
+	/**
+	 * @brief active view id (from all views, not only the rendering)
+	 */
+	int m_view_id;
+
 public:
 	/**
 	 * @brief constructor initializes the context with default values.
@@ -180,7 +185,17 @@ public:
 	 * @brief set has this system active openclDevices?
 	 */
 	void setHasActiveOpenCLDevices(bool hasAvtiveOpenCLDevices) { this->m_hasActiveOpenCLDevices = hasAvtiveOpenCLDevices; }
-	
+
+	/**
+	 * @brief get the active rendering view
+	 */
+	int getViewId() const { return this->m_view_id; }
+
+	/**
+	 * @brief set the active rendering view
+	 */
+	void setViewId(int view_id) { this->m_view_id = view_id; }
+
 	int getChunksize() const { return this->getbNodeTree()->chunksize; }
 	
 	void setFastCalculation(bool fastCalculation) {this->m_fastCalculation = fastCalculation;}
diff --git a/source/blender/compositor/intern/COM_Converter.cpp b/source/blender/compositor/intern/COM_Converter.cpp
index 9251e16..9fc06f0 100644
--- a/source/blender/compositor/intern/COM_Converter.cpp
+++ b/source/blender/compositor/intern/COM_Converter.cpp
@@ -100,6 +100,7 @@ extern "C" {
 #include "COM_SplitViewerNode.h"
 #include "COM_Stabilize2dNode.h"
 #include "COM_SwitchNode.h"
+#include "COM_SwitchViewNode.h"
 #include "COM_TextureNode.h"
 #include "COM_TimeNode.h"
 #include "COM_TonemapNode.h"
@@ -327,6 +328,9 @@ Node *Converter::convert(bNode *b_node)
 		case CMP_NODE_SWITCH:
 			node = new SwitchNode(b_node);
 			break;
+		case CMP_NODE_SWITCH_VIEW:
+			node = new SwitchViewNode(b_node);
+			break;
 		case CMP_NODE_GLARE:
 			node = new GlareNode(b_node);
 			break;
diff --git a/source/blender/compositor/intern/COM_ExecutionSystem.cpp b/source/blender/compositor/intern/COM_ExecutionSystem.cpp
index 7c08188..25a18b2 100644
--- a/source/blender/compositor/intern/COM_ExecutionSystem.cpp
+++ b/source/blender/compositor/intern/COM_ExecutionSystem.cpp
@@ -43,8 +43,10 @@ extern "C" {
 #endif
 
 ExecutionSystem::ExecutionSystem(RenderData *rd, Scene *scene, bNodeTree *editingtree, bool rendering, bool fastcalculation,
-                                 const ColorManagedViewSettings *viewSettings, const ColorManagedDisplaySettings *displaySettings)
+                                 const ColorManagedViewSettings *viewSettings, const ColorManagedDisplaySettings *displaySettings,
+                                 const int view_id)
 {
+	this->m_context.setViewId(view_id);
 	this->m_context.setScene(scene);
 	this->m_context.setbNodeTree(editingtree);
 	this->m_context.setPreviewHash(editingtree->previews);
diff --git a/source/blender/compositor/intern/COM_ExecutionSystem.h b/source/blender/compositor/intern/COM_ExecutionSystem.h
index ab90320..c3c8a4f 100644
--- a/source/blender/compositor/intern/COM_ExecutionSystem.h
+++ b/source/blender/compositor/intern/COM_ExecutionSystem.h
@@ -154,7 +154,8 @@ public:
 	 * @param rendering [true false]
 	 */
 	ExecutionSystem(RenderData *rd, Scene *scene, bNodeTree *editingtree, bool rendering, bool fastcalculation,
-	                const ColorManagedViewSettings *viewSettings, const ColorManagedDisplaySettings *displaySettings);
+	                const ColorManagedViewSettings *viewSettings, const ColorManagedDisplaySettings *displaySettings,
+                  const int view_id);
 
 	/**
 	 * Destructor
diff --git a/source/blender/compositor/intern/COM_Node.cpp b/source/blender/compositor/intern/COM_Node.cpp
index 67f4d25..4c41c2a 100644
--- a/source/blender/compositor/intern/COM_Node.cpp
+++ b/source/blender/compositor/intern/COM_Node.cpp
@@ -143,6 +143,25 @@ bNodeSocket *Node::getEditorOutputSocket(int editorNodeInputSocketIndex)
 	return NULL;
 }
 
+const char *Node::RenderData_get_actview_name (const RenderData *rd, const int actview) const
+{
+	SceneRenderView *srv;
+	int view_id;
+
+	if ((rd->scemode & R_MULTIVIEW) == 0)
+		return "";
+
+	for (view_id=0, srv= (SceneRenderView *) rd->views.first; srv; srv = srv->next) {
+
+		if (srv->viewflag & SCE_VIEW_DISABLE)
+			continue;
+
+		if (actview == view_id++)
+			return srv->name;
+	}
+
+	return "";
+}
 
 /*******************
  **** NodeInput ****
@@ -214,3 +233,4 @@ void NodeOutput::getEditorValueVector(float *value)
 	RNA_pointer_create((ID *)getNode()->getbNodeTree(), &RNA_NodeSocket, getbNodeSocket(), &ptr);
 	return RNA_float_get_array(&ptr, "default_value", value);
 }
+
diff --git a/source/blender/compositor/intern/COM_Node.h b/source/blender/compositor/intern/COM_Node.h
index 6046af2..ad77bc3 100644
--- a/source/blender/compositor/intern/COM_Node.h
+++ b/source/blender/compositor/intern/COM_Node.h
@@ -189,6 +189,8 @@ public:
 	
 	void setInstanceKey(bNodeInstanceKey instance_key) { m_instanceKey = instance_key; }
 	bNodeInstanceKey getInstanceKey() const { return m_instanceKey; }
+
+	const char *RenderData_get_actview_name (const RenderData *rd, const int actview) const;
 	
 protected:
 	/**
diff --git a/source/blender/compositor/intern/COM_compositor.cpp b/source/blender/compositor/intern/COM_compositor.cpp
index 99655c6..1d893e9 100644
--- a/source/blender/compositor/intern/COM_compositor.cpp
+++ b/source/blender/compositor/intern/COM_compositor.cpp
@@ -45,7 +45,8 @@ static void intern_freeCompositorCaches()
 
 void COM_execute(RenderData *rd, Scene *scene, bNodeTree *editingtree, int rendering,
                  const ColorManagedViewSettings *viewSettings,
-                 const ColorManagedDisplaySettings *displaySettings)
+                 const ColorManagedDisplaySettings *displaySettings,
+				 int view_id)
 {
 	/* initialize mutex, TODO this mutex init is actually not thread safe and
 	 * should be done somewhere as part of blender startup, all the other
@@ -81,7 +82,7 @@ void COM_execute(RenderData *rd, Scene *scene, bNodeTree *editingtree, int rende
 	bool twopass = (editingtree->flag & NTREE_TWO_PASS) > 0 && !rendering;
 	/* initialize execution system */
 	if (twopass) {
-		ExecutionSystem *system = new ExecutionSystem(rd, scene, editingtree, rendering, twopass, viewSettings, displaySettings);
+		ExecutionSystem *system = new ExecutionSystem(rd, scene, editingtree, rendering, twopass, viewSettings, displaySettings, view_id);
 		system->execute();
 		delete system;
 		
@@ -94,7 +95,7 @@ void COM_execute(RenderData *rd, Scene *scene, bNodeTree *editingtree, int rende
 	}
 
 	ExecutionSystem *system = new ExecutionSystem(rd, scene, editingtree, rendering, false,
-	                                              vi

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list