[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [50255] trunk/blender/source/blender: cleanup pixel sampler code (pixel interpolations in compositor)
Jeroen Bakker
j.bakker at atmind.nl
Tue Aug 28 12:41:38 CEST 2012
Revision: 50255
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=50255
Author: jbakker
Date: 2012-08-28 10:41:37 +0000 (Tue, 28 Aug 2012)
Log Message:
-----------
cleanup pixel sampler code (pixel interpolations in compositor)
Modified Paths:
--------------
trunk/blender/source/blender/compositor/intern/COM_SocketReader.h
trunk/blender/source/blender/compositor/nodes/COM_RotateNode.cpp
trunk/blender/source/blender/compositor/nodes/COM_Stabilize2dNode.cpp
trunk/blender/source/blender/compositor/nodes/COM_TransformNode.cpp
trunk/blender/source/blender/makesrna/intern/rna_nodetree.c
Modified: trunk/blender/source/blender/compositor/intern/COM_SocketReader.h
===================================================================
--- trunk/blender/source/blender/compositor/intern/COM_SocketReader.h 2012-08-28 10:02:10 UTC (rev 50254)
+++ trunk/blender/source/blender/compositor/intern/COM_SocketReader.h 2012-08-28 10:41:37 UTC (rev 50255)
@@ -30,9 +30,9 @@
#endif
typedef enum PixelSampler {
- COM_PS_NEAREST,
- COM_PS_BILINEAR,
- COM_PS_BICUBIC
+ COM_PS_NEAREST = 0,
+ COM_PS_BILINEAR = 1,
+ COM_PS_BICUBIC = 2
} PixelSampler;
class MemoryBuffer;
Modified: trunk/blender/source/blender/compositor/nodes/COM_RotateNode.cpp
===================================================================
--- trunk/blender/source/blender/compositor/nodes/COM_RotateNode.cpp 2012-08-28 10:02:10 UTC (rev 50254)
+++ trunk/blender/source/blender/compositor/nodes/COM_RotateNode.cpp 2012-08-28 10:41:37 UTC (rev 50255)
@@ -39,19 +39,7 @@
RotateOperation *operation = new RotateOperation();
SetSamplerOperation *sampler = new SetSamplerOperation();
- switch (this->getbNode()->custom1) {
- case 0:
- sampler->setSampler(COM_PS_NEAREST);
- break;
- case 1:
- sampler->setSampler(COM_PS_BILINEAR);
- break;
- case 2:
- sampler->setSampler(COM_PS_BICUBIC);
- break;
-
- }
-
+ sampler->setSampler((PixelSampler)this->getbNode()->custom1);
addLink(system, sampler->getOutputSocket(), operation->getInputSocket(0));
inputSocket->relinkConnections(sampler->getInputSocket(0), 0, system);
Modified: trunk/blender/source/blender/compositor/nodes/COM_Stabilize2dNode.cpp
===================================================================
--- trunk/blender/source/blender/compositor/nodes/COM_Stabilize2dNode.cpp 2012-08-28 10:02:10 UTC (rev 50254)
+++ trunk/blender/source/blender/compositor/nodes/COM_Stabilize2dNode.cpp 2012-08-28 10:41:37 UTC (rev 50255)
@@ -26,6 +26,7 @@
#include "COM_RotateOperation.h"
#include "COM_ScaleOperation.h"
#include "COM_MovieClipAttributeOperation.h"
+#include "COM_SetSamplerOperation.h"
extern "C" {
#include "DNA_movieclip_types.h"
@@ -49,6 +50,7 @@
MovieClipAttributeOperation *angleAttribute = new MovieClipAttributeOperation();
MovieClipAttributeOperation *xAttribute = new MovieClipAttributeOperation();
MovieClipAttributeOperation *yAttribute = new MovieClipAttributeOperation();
+ SetSamplerOperation *psoperation = new SetSamplerOperation();
scaleAttribute->setAttribute(MCA_SCALE);
scaleAttribute->setFramenumber(context->getFramenumber());
@@ -77,9 +79,11 @@
addLink(graph, rotateOperation->getOutputSocket(), translateOperation->getInputSocket(0));
addLink(graph, xAttribute->getOutputSocket(), translateOperation->getInputSocket(1));
addLink(graph, yAttribute->getOutputSocket(), translateOperation->getInputSocket(2));
-
- this->getOutputSocket()->relinkConnections(translateOperation->getOutputSocket());
+ psoperation->setSampler((PixelSampler)this->getbNode()->custom1);
+ addLink(graph, translateOperation->getOutputSocket(), psoperation->getInputSocket(0));
+ this->getOutputSocket()->relinkConnections(psoperation->getOutputSocket());
+
graph->addOperation(scaleAttribute);
graph->addOperation(angleAttribute);
graph->addOperation(xAttribute);
@@ -87,4 +91,5 @@
graph->addOperation(scaleOperation);
graph->addOperation(translateOperation);
graph->addOperation(rotateOperation);
+ graph->addOperation(psoperation);
}
Modified: trunk/blender/source/blender/compositor/nodes/COM_TransformNode.cpp
===================================================================
--- trunk/blender/source/blender/compositor/nodes/COM_TransformNode.cpp 2012-08-28 10:02:10 UTC (rev 50254)
+++ trunk/blender/source/blender/compositor/nodes/COM_TransformNode.cpp 2012-08-28 10:41:37 UTC (rev 50255)
@@ -46,17 +46,7 @@
TranslateOperation *translateOperation = new TranslateOperation();
SetSamplerOperation *sampler = new SetSamplerOperation();
- switch (this->getbNode()->custom1) {
- case 0:
- sampler->setSampler(COM_PS_NEAREST);
- break;
- case 1:
- sampler->setSampler(COM_PS_BILINEAR);
- break;
- case 2:
- sampler->setSampler(COM_PS_BICUBIC);
- break;
- }
+ sampler->setSampler((PixelSampler)this->getbNode()->custom1);
imageInput->relinkConnections(sampler->getInputSocket(0), 0, graph);
addLink(graph, sampler->getOutputSocket(), scaleOperation->getInputSocket(0));
Modified: trunk/blender/source/blender/makesrna/intern/rna_nodetree.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_nodetree.c 2012-08-28 10:02:10 UTC (rev 50254)
+++ trunk/blender/source/blender/makesrna/intern/rna_nodetree.c 2012-08-28 10:41:37 UTC (rev 50255)
@@ -133,6 +133,14 @@
{0, NULL, 0, NULL, NULL}
};
+EnumPropertyItem node_sampler_type_items[] = {
+ {0, "NEAREST", 0, "Nearest", ""},
+ {1, "BILINEAR", 0, "Bilinear", ""},
+ {2, "BICUBIC", 0, "Bicubic", ""},
+ {0, NULL, 0, NULL, NULL}
+};
+
+
EnumPropertyItem prop_noise_basis_items[] = {
{SHD_NOISE_PERLIN, "PERLIN", 0, "Perlin", ""},
{SHD_NOISE_VORONOI_F1, "VORONOI_F1", 0, "Voronoi F1", ""},
@@ -2213,16 +2221,9 @@
{
PropertyRNA *prop;
- static EnumPropertyItem rotate_items[] = {
- {0, "NEAREST", 0, "Nearest", ""},
- {1, "BILINEAR", 0, "Bilinear", ""},
- {2, "BICUBIC", 0, "Bicubic", ""},
- {0, NULL, 0, NULL, NULL}
- };
-
prop = RNA_def_property(srna, "filter_type", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "custom1");
- RNA_def_property_enum_items(prop, rotate_items);
+ RNA_def_property_enum_items(prop, node_sampler_type_items);
RNA_def_property_ui_text(prop, "Filter", "Method to use to filter rotation");
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
}
@@ -3150,13 +3151,6 @@
{
PropertyRNA *prop;
- static EnumPropertyItem filter_type_items[] = {
- {0, "NEAREST", 0, "Nearest", ""},
- {1, "BILINEAR", 0, "Bilinear", ""},
- {2, "BICUBIC", 0, "Bicubic", ""},
- {0, NULL, 0, NULL, NULL}
- };
-
prop = RNA_def_property(srna, "clip", PROP_POINTER, PROP_NONE);
RNA_def_property_pointer_sdna(prop, NULL, "id");
RNA_def_property_struct_type(prop, "MovieClip");
@@ -3166,7 +3160,7 @@
prop = RNA_def_property(srna, "filter_type", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "custom1");
- RNA_def_property_enum_items(prop, filter_type_items);
+ RNA_def_property_enum_items(prop, node_sampler_type_items);
RNA_def_property_ui_text(prop, "Filter", "Method to use to filter stabilization");
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
}
@@ -3264,16 +3258,9 @@
{
PropertyRNA *prop;
- static EnumPropertyItem filter_type_items[] = {
- {0, "NEAREST", 0, "Nearest", ""},
- {1, "BILINEAR", 0, "Bilinear", ""},
- {2, "BICUBIC", 0, "Bicubic", ""},
- {0, NULL, 0, NULL, NULL}
- };
-
prop = RNA_def_property(srna, "filter_type", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "custom1");
- RNA_def_property_enum_items(prop, filter_type_items);
+ RNA_def_property_enum_items(prop, node_sampler_type_items);
RNA_def_property_ui_text(prop, "Filter", "Method to use to filter transform");
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
}
More information about the Bf-blender-cvs
mailing list