style cleanup
This commit is contained in:
@@ -26,16 +26,16 @@
|
|||||||
#include "COM_SplitViewerOperation.h"
|
#include "COM_SplitViewerOperation.h"
|
||||||
#include "COM_ExecutionSystem.h"
|
#include "COM_ExecutionSystem.h"
|
||||||
|
|
||||||
SplitViewerNode::SplitViewerNode(bNode *editorNode): Node(editorNode)
|
SplitViewerNode::SplitViewerNode(bNode *editorNode) : Node(editorNode)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void SplitViewerNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context)
|
void SplitViewerNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
|
||||||
{
|
{
|
||||||
InputSocket *image1Socket = this->getInputSocket(0);
|
InputSocket *image1Socket = this->getInputSocket(0);
|
||||||
InputSocket *image2Socket = this->getInputSocket(1);
|
InputSocket *image2Socket = this->getInputSocket(1);
|
||||||
Image *image = (Image*)this->getbNode()->id;
|
Image *image = (Image *)this->getbNode()->id;
|
||||||
ImageUser * imageUser = (ImageUser*) this->getbNode()->storage;
|
ImageUser *imageUser = (ImageUser *) this->getbNode()->storage;
|
||||||
if (image1Socket->isConnected() && image2Socket->isConnected()) {
|
if (image1Socket->isConnected() && image2Socket->isConnected()) {
|
||||||
SplitViewerOperation *splitViewerOperation = new SplitViewerOperation();
|
SplitViewerOperation *splitViewerOperation = new SplitViewerOperation();
|
||||||
splitViewerOperation->setColorManagement(context->getScene()->r.color_mgt_flag & R_COLOR_MANAGEMENT);
|
splitViewerOperation->setColorManagement(context->getScene()->r.color_mgt_flag & R_COLOR_MANAGEMENT);
|
||||||
|
@@ -26,21 +26,21 @@
|
|||||||
#include "COM_CalculateMeanOperation.h"
|
#include "COM_CalculateMeanOperation.h"
|
||||||
#include "COM_CalculateStandardDeviationOperation.h"
|
#include "COM_CalculateStandardDeviationOperation.h"
|
||||||
|
|
||||||
ViewLevelsNode::ViewLevelsNode(bNode *editorNode): Node(editorNode)
|
ViewLevelsNode::ViewLevelsNode(bNode *editorNode) : Node(editorNode)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
void ViewLevelsNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context)
|
void ViewLevelsNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
|
||||||
{
|
{
|
||||||
InputSocket * input = this->getInputSocket(0);
|
InputSocket *input = this->getInputSocket(0);
|
||||||
bool firstOperationConnected = false;
|
bool firstOperationConnected = false;
|
||||||
if (input->isConnected()) {
|
if (input->isConnected()) {
|
||||||
OutputSocket *inputSocket = input->getConnection()->getFromSocket();
|
OutputSocket *inputSocket = input->getConnection()->getFromSocket();
|
||||||
// add preview to inputSocket;
|
// add preview to inputSocket;
|
||||||
|
|
||||||
OutputSocket * socket = this->getOutputSocket(0);
|
OutputSocket *socket = this->getOutputSocket(0);
|
||||||
if (socket->isConnected()) {
|
if (socket->isConnected()) {
|
||||||
// calculate mean operation
|
// calculate mean operation
|
||||||
CalculateMeanOperation * operation = new CalculateMeanOperation();
|
CalculateMeanOperation *operation = new CalculateMeanOperation();
|
||||||
input->relinkConnections(operation->getInputSocket(0), 0, graph);
|
input->relinkConnections(operation->getInputSocket(0), 0, graph);
|
||||||
firstOperationConnected = true;
|
firstOperationConnected = true;
|
||||||
operation->setSetting(this->getbNode()->custom1);
|
operation->setSetting(this->getbNode()->custom1);
|
||||||
@@ -51,7 +51,7 @@ void ViewLevelsNode::convertToOperations(ExecutionSystem *graph, CompositorConte
|
|||||||
socket = this->getOutputSocket(1);
|
socket = this->getOutputSocket(1);
|
||||||
if (socket->isConnected()) {
|
if (socket->isConnected()) {
|
||||||
// calculate standard deviation operation
|
// calculate standard deviation operation
|
||||||
CalculateStandardDeviationOperation * operation = new CalculateStandardDeviationOperation();
|
CalculateStandardDeviationOperation *operation = new CalculateStandardDeviationOperation();
|
||||||
if (firstOperationConnected) {
|
if (firstOperationConnected) {
|
||||||
addLink(graph, inputSocket, operation->getInputSocket(0));
|
addLink(graph, inputSocket, operation->getInputSocket(0));
|
||||||
}
|
}
|
||||||
|
@@ -26,16 +26,16 @@
|
|||||||
#include "COM_ViewerOperation.h"
|
#include "COM_ViewerOperation.h"
|
||||||
#include "COM_ExecutionSystem.h"
|
#include "COM_ExecutionSystem.h"
|
||||||
|
|
||||||
ViewerNode::ViewerNode(bNode *editorNode): Node(editorNode)
|
ViewerNode::ViewerNode(bNode *editorNode) : Node(editorNode)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void ViewerNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context)\
|
void ViewerNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
|
||||||
{
|
{
|
||||||
InputSocket *imageSocket = this->getInputSocket(0);
|
InputSocket *imageSocket = this->getInputSocket(0);
|
||||||
InputSocket *alphaSocket = this->getInputSocket(1);
|
InputSocket *alphaSocket = this->getInputSocket(1);
|
||||||
Image *image = (Image*)this->getbNode()->id;
|
Image *image = (Image *)this->getbNode()->id;
|
||||||
ImageUser * imageUser = (ImageUser*) this->getbNode()->storage;
|
ImageUser *imageUser = (ImageUser *) this->getbNode()->storage;
|
||||||
bNode *editorNode = this->getbNode();
|
bNode *editorNode = this->getbNode();
|
||||||
if (imageSocket->isConnected()) {
|
if (imageSocket->isConnected()) {
|
||||||
ViewerOperation *viewerOperation = new ViewerOperation();
|
ViewerOperation *viewerOperation = new ViewerOperation();
|
||||||
|
@@ -60,7 +60,7 @@ void SplitViewerOperation::deinitExecution()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SplitViewerOperation::executeRegion(rcti *rect, unsigned int tileNumber, MemoryBuffer** memoryBuffers)
|
void SplitViewerOperation::executeRegion(rcti *rect, unsigned int tileNumber, MemoryBuffer **memoryBuffers)
|
||||||
{
|
{
|
||||||
float *buffer = this->outputBuffer;
|
float *buffer = this->outputBuffer;
|
||||||
unsigned char *bufferDisplay = this->outputBufferDisplay;
|
unsigned char *bufferDisplay = this->outputBufferDisplay;
|
||||||
@@ -70,15 +70,15 @@ void SplitViewerOperation::executeRegion(rcti *rect, unsigned int tileNumber, Me
|
|||||||
int y1 = rect->ymin;
|
int y1 = rect->ymin;
|
||||||
int x2 = rect->xmax;
|
int x2 = rect->xmax;
|
||||||
int y2 = rect->ymax;
|
int y2 = rect->ymax;
|
||||||
int offset = (y1*this->getWidth() + x1 ) * 4;
|
int offset = (y1 * this->getWidth() + x1) * 4;
|
||||||
int x;
|
int x;
|
||||||
int y;
|
int y;
|
||||||
int perc = xSplit?this->splitPercentage*getWidth()/100.0f:this->splitPercentage*getHeight()/100.0f;
|
int perc = xSplit ? this->splitPercentage *getWidth() / 100.0f : this->splitPercentage *getHeight() / 100.0f;
|
||||||
for (y = y1 ; y < y2 ; y++) {
|
for (y = y1; y < y2; y++) {
|
||||||
for (x = x1 ; x < x2 ; x++) {
|
for (x = x1; x < x2; x++) {
|
||||||
bool image1;
|
bool image1;
|
||||||
float srgb[4];
|
float srgb[4];
|
||||||
image1 = xSplit?x>perc:y>perc;
|
image1 = xSplit ? x > perc : y > perc;
|
||||||
if (image1) {
|
if (image1) {
|
||||||
image1Input->read(&(buffer[offset]), x, y, COM_PS_NEAREST, memoryBuffers);
|
image1Input->read(&(buffer[offset]), x, y, COM_PS_NEAREST, memoryBuffers);
|
||||||
}
|
}
|
||||||
@@ -88,21 +88,21 @@ void SplitViewerOperation::executeRegion(rcti *rect, unsigned int tileNumber, Me
|
|||||||
/// @todo: linear conversion only when scene color management is selected, also check predivide.
|
/// @todo: linear conversion only when scene color management is selected, also check predivide.
|
||||||
if (this->doColorManagement) {
|
if (this->doColorManagement) {
|
||||||
if (this->doColorPredivide) {
|
if (this->doColorPredivide) {
|
||||||
linearrgb_to_srgb_predivide_v4(srgb, buffer+offset);
|
linearrgb_to_srgb_predivide_v4(srgb, buffer + offset);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
linearrgb_to_srgb_v4(srgb, buffer+offset);
|
linearrgb_to_srgb_v4(srgb, buffer + offset);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
copy_v4_v4(srgb, buffer+offset);
|
copy_v4_v4(srgb, buffer + offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
F4TOCHAR4(srgb, bufferDisplay+offset);
|
rgba_float_to_uchar(bufferDisplay + offset, srgb);
|
||||||
|
|
||||||
offset +=4;
|
offset += 4;
|
||||||
}
|
}
|
||||||
offset += (this->getWidth()-(x2-x1))*4;
|
offset += (this->getWidth() - (x2 - x1)) * 4;
|
||||||
}
|
}
|
||||||
updateImage(rect);
|
updateImage(rect);
|
||||||
}
|
}
|
||||||
|
@@ -74,13 +74,13 @@ void ViewerBaseOperation::initImage()
|
|||||||
|
|
||||||
/* now we combine the input with ibuf */
|
/* now we combine the input with ibuf */
|
||||||
this->outputBuffer = ibuf->rect_float;
|
this->outputBuffer = ibuf->rect_float;
|
||||||
this->outputBufferDisplay = (unsigned char*)ibuf->rect;
|
this->outputBufferDisplay = (unsigned char *)ibuf->rect;
|
||||||
|
|
||||||
BKE_image_release_ibuf(this->image, this->lock);
|
BKE_image_release_ibuf(this->image, this->lock);
|
||||||
}
|
}
|
||||||
void ViewerBaseOperation:: updateImage(rcti *rect)
|
void ViewerBaseOperation:: updateImage(rcti *rect)
|
||||||
{
|
{
|
||||||
WM_main_add_notifier(NC_WINDOW|ND_DRAW, NULL);
|
WM_main_add_notifier(NC_WINDOW | ND_DRAW, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ViewerBaseOperation::deinitExecution()
|
void ViewerBaseOperation::deinitExecution()
|
||||||
|
@@ -64,7 +64,7 @@ void ViewerOperation::deinitExecution()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ViewerOperation::executeRegion(rcti *rect, unsigned int tileNumber, MemoryBuffer** memoryBuffers)
|
void ViewerOperation::executeRegion(rcti *rect, unsigned int tileNumber, MemoryBuffer **memoryBuffers)
|
||||||
{
|
{
|
||||||
float *buffer = this->outputBuffer;
|
float *buffer = this->outputBuffer;
|
||||||
unsigned char *bufferDisplay = this->outputBufferDisplay;
|
unsigned char *bufferDisplay = this->outputBufferDisplay;
|
||||||
@@ -73,36 +73,36 @@ void ViewerOperation::executeRegion(rcti *rect, unsigned int tileNumber, MemoryB
|
|||||||
const int y1 = rect->ymin;
|
const int y1 = rect->ymin;
|
||||||
const int x2 = rect->xmax;
|
const int x2 = rect->xmax;
|
||||||
const int y2 = rect->ymax;
|
const int y2 = rect->ymax;
|
||||||
const int offsetadd = (this->getWidth()-(x2-x1))*4;
|
const int offsetadd = (this->getWidth() - (x2 - x1)) * 4;
|
||||||
int offset = (y1*this->getWidth() + x1 ) * 4;
|
int offset = (y1 * this->getWidth() + x1) * 4;
|
||||||
float alpha[4], srgb[4];
|
float alpha[4], srgb[4];
|
||||||
int x;
|
int x;
|
||||||
int y;
|
int y;
|
||||||
bool breaked = false;
|
bool breaked = false;
|
||||||
|
|
||||||
for (y = y1 ; y < y2 && (!breaked) ; y++) {
|
for (y = y1; y < y2 && (!breaked); y++) {
|
||||||
for (x = x1 ; x < x2; x++) {
|
for (x = x1; x < x2; x++) {
|
||||||
imageInput->read(&(buffer[offset]), x, y, COM_PS_NEAREST, memoryBuffers);
|
imageInput->read(&(buffer[offset]), x, y, COM_PS_NEAREST, memoryBuffers);
|
||||||
if (alphaInput != NULL) {
|
if (alphaInput != NULL) {
|
||||||
alphaInput->read(alpha, x, y, COM_PS_NEAREST, memoryBuffers);
|
alphaInput->read(alpha, x, y, COM_PS_NEAREST, memoryBuffers);
|
||||||
buffer[offset+3] = alpha[0];
|
buffer[offset + 3] = alpha[0];
|
||||||
}
|
}
|
||||||
/// @todo: linear conversion only when scene color management is selected, also check predivide.
|
/// @todo: linear conversion only when scene color management is selected, also check predivide.
|
||||||
if (this->doColorManagement) {
|
if (this->doColorManagement) {
|
||||||
if (this->doColorPredivide) {
|
if (this->doColorPredivide) {
|
||||||
linearrgb_to_srgb_predivide_v4(srgb, buffer+offset);
|
linearrgb_to_srgb_predivide_v4(srgb, buffer + offset);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
linearrgb_to_srgb_v4(srgb, buffer+offset);
|
linearrgb_to_srgb_v4(srgb, buffer + offset);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
copy_v4_v4(srgb, buffer+offset);
|
copy_v4_v4(srgb, buffer + offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
F4TOCHAR4(srgb, bufferDisplay+offset);
|
rgba_float_to_uchar(bufferDisplay + offset, srgb);
|
||||||
|
|
||||||
offset +=4;
|
offset += 4;
|
||||||
}
|
}
|
||||||
if (isBreaked()) {
|
if (isBreaked()) {
|
||||||
breaked = true;
|
breaked = true;
|
||||||
|
@@ -34,11 +34,11 @@
|
|||||||
|
|
||||||
|
|
||||||
/* **************** VIEWER ******************** */
|
/* **************** VIEWER ******************** */
|
||||||
static bNodeSocketTemplate cmp_node_viewer_in[]= {
|
static bNodeSocketTemplate cmp_node_viewer_in[] = {
|
||||||
{ SOCK_RGBA, 1, N_("Image"), 0.0f, 0.0f, 0.0f, 1.0f},
|
{ SOCK_RGBA, 1, N_("Image"), 0.0f, 0.0f, 0.0f, 1.0f},
|
||||||
{ SOCK_FLOAT, 1, N_("Alpha"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE},
|
{ SOCK_FLOAT, 1, N_("Alpha"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE},
|
||||||
{ SOCK_FLOAT, 1, N_("Z"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE},
|
{ SOCK_FLOAT, 1, N_("Z"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE},
|
||||||
{ -1, 0, "" }
|
{ -1, 0, "" }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -47,9 +47,9 @@ static void node_composit_exec_viewer(void *data, bNode *node, bNodeStack **in,
|
|||||||
/* image assigned to output */
|
/* image assigned to output */
|
||||||
/* stack order input sockets: col, alpha, z */
|
/* stack order input sockets: col, alpha, z */
|
||||||
|
|
||||||
if (node->id && (node->flag & NODE_DO_OUTPUT)) { /* only one works on out */
|
if (node->id && (node->flag & NODE_DO_OUTPUT)) { /* only one works on out */
|
||||||
RenderData *rd= data;
|
RenderData *rd = data;
|
||||||
Image *ima= (Image *)node->id;
|
Image *ima = (Image *)node->id;
|
||||||
ImBuf *ibuf;
|
ImBuf *ibuf;
|
||||||
CompBuf *cbuf, *tbuf;
|
CompBuf *cbuf, *tbuf;
|
||||||
int rectx, recty;
|
int rectx, recty;
|
||||||
@@ -58,8 +58,8 @@ static void node_composit_exec_viewer(void *data, bNode *node, bNodeStack **in,
|
|||||||
BKE_image_user_frame_calc(node->storage, rd->cfra, 0);
|
BKE_image_user_frame_calc(node->storage, rd->cfra, 0);
|
||||||
|
|
||||||
/* always returns for viewer image, but we check nevertheless */
|
/* always returns for viewer image, but we check nevertheless */
|
||||||
ibuf= BKE_image_acquire_ibuf(ima, node->storage, &lock);
|
ibuf = BKE_image_acquire_ibuf(ima, node->storage, &lock);
|
||||||
if (ibuf==NULL) {
|
if (ibuf == NULL) {
|
||||||
printf("node_composit_exec_viewer error\n");
|
printf("node_composit_exec_viewer error\n");
|
||||||
BKE_image_release_ibuf(ima, lock);
|
BKE_image_release_ibuf(ima, lock);
|
||||||
return;
|
return;
|
||||||
@@ -71,28 +71,28 @@ static void node_composit_exec_viewer(void *data, bNode *node, bNodeStack **in,
|
|||||||
IMB_freezbuffloatImBuf(ibuf);
|
IMB_freezbuffloatImBuf(ibuf);
|
||||||
|
|
||||||
/* get size */
|
/* get size */
|
||||||
tbuf= in[0]->data?in[0]->data:(in[1]->data?in[1]->data:in[2]->data);
|
tbuf = in[0]->data ? in[0]->data : (in[1]->data ? in[1]->data : in[2]->data);
|
||||||
if (tbuf==NULL) {
|
if (tbuf == NULL) {
|
||||||
rectx= 320; recty= 256;
|
rectx = 320; recty = 256;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
rectx= tbuf->x;
|
rectx = tbuf->x;
|
||||||
recty= tbuf->y;
|
recty = tbuf->y;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* make ibuf, and connect to ima */
|
/* make ibuf, and connect to ima */
|
||||||
ibuf->x= rectx;
|
ibuf->x = rectx;
|
||||||
ibuf->y= recty;
|
ibuf->y = recty;
|
||||||
imb_addrectfloatImBuf(ibuf);
|
imb_addrectfloatImBuf(ibuf);
|
||||||
|
|
||||||
ima->ok= IMA_OK_LOADED;
|
ima->ok = IMA_OK_LOADED;
|
||||||
|
|
||||||
/* now we combine the input with ibuf */
|
/* now we combine the input with ibuf */
|
||||||
cbuf= alloc_compbuf(rectx, recty, CB_RGBA, 0); /* no alloc*/
|
cbuf = alloc_compbuf(rectx, recty, CB_RGBA, 0); /* no alloc*/
|
||||||
cbuf->rect= ibuf->rect_float;
|
cbuf->rect = ibuf->rect_float;
|
||||||
|
|
||||||
/* when no alpha, we can simply copy */
|
/* when no alpha, we can simply copy */
|
||||||
if (in[1]->data==NULL) {
|
if (in[1]->data == NULL) {
|
||||||
composit1_pixel_processor(node, cbuf, in[0]->data, in[0]->vec, do_copy_rgba, CB_RGBA);
|
composit1_pixel_processor(node, cbuf, in[0]->data, in[0]->vec, do_copy_rgba, CB_RGBA);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -100,14 +100,14 @@ static void node_composit_exec_viewer(void *data, bNode *node, bNodeStack **in,
|
|||||||
|
|
||||||
/* zbuf option */
|
/* zbuf option */
|
||||||
if (in[2]->data) {
|
if (in[2]->data) {
|
||||||
CompBuf *zbuf= alloc_compbuf(rectx, recty, CB_VAL, 1);
|
CompBuf *zbuf = alloc_compbuf(rectx, recty, CB_VAL, 1);
|
||||||
ibuf->zbuf_float= zbuf->rect;
|
ibuf->zbuf_float = zbuf->rect;
|
||||||
ibuf->mall |= IB_zbuffloat;
|
ibuf->mall |= IB_zbuffloat;
|
||||||
|
|
||||||
composit1_pixel_processor(node, zbuf, in[2]->data, in[2]->vec, do_copy_value, CB_VAL);
|
composit1_pixel_processor(node, zbuf, in[2]->data, in[2]->vec, do_copy_value, CB_VAL);
|
||||||
|
|
||||||
/* free compbuf, but not the rect */
|
/* free compbuf, but not the rect */
|
||||||
zbuf->malloc= 0;
|
zbuf->malloc = 0;
|
||||||
free_compbuf(zbuf);
|
free_compbuf(zbuf);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -122,13 +122,13 @@ static void node_composit_exec_viewer(void *data, bNode *node, bNodeStack **in,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void node_composit_init_viewer(bNodeTree *UNUSED(ntree), bNode* node, bNodeTemplate *UNUSED(ntemp))
|
static void node_composit_init_viewer(bNodeTree *UNUSED(ntree), bNode *node, bNodeTemplate *UNUSED(ntemp))
|
||||||
{
|
{
|
||||||
ImageUser *iuser= MEM_callocN(sizeof(ImageUser), "node image user");
|
ImageUser *iuser = MEM_callocN(sizeof(ImageUser), "node image user");
|
||||||
node->storage= iuser;
|
node->storage = iuser;
|
||||||
iuser->sfra= 1;
|
iuser->sfra = 1;
|
||||||
iuser->fie_ima= 2;
|
iuser->fie_ima = 2;
|
||||||
iuser->ok= 1;
|
iuser->ok = 1;
|
||||||
node->custom3 = 0.5f;
|
node->custom3 = 0.5f;
|
||||||
node->custom4 = 0.5f;
|
node->custom4 = 0.5f;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user