[Bf-blender-cvs] [3302fbaeb1d] master: Cleanup: style, use braces for compositor

Campbell Barton noreply at git.blender.org
Tue Apr 23 07:19:33 CEST 2019


Commit: 3302fbaeb1d5f58d926c06b6153ec5d6f1a9b0be
Author: Campbell Barton
Date:   Tue Apr 23 11:21:22 2019 +1000
Branches: master
https://developer.blender.org/rB3302fbaeb1d5f58d926c06b6153ec5d6f1a9b0be

Cleanup: style, use braces for compositor

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

M	source/blender/compositor/intern/COM_Converter.cpp
M	source/blender/compositor/intern/COM_Debug.cpp
M	source/blender/compositor/intern/COM_ExecutionGroup.cpp
M	source/blender/compositor/intern/COM_MemoryBuffer.h
M	source/blender/compositor/intern/COM_Node.cpp
M	source/blender/compositor/intern/COM_NodeGraph.cpp
M	source/blender/compositor/intern/COM_NodeOperation.cpp
M	source/blender/compositor/intern/COM_NodeOperation.h
M	source/blender/compositor/intern/COM_NodeOperationBuilder.cpp
M	source/blender/compositor/intern/COM_OpenCLDevice.cpp
M	source/blender/compositor/intern/COM_SingleThreadedOperation.cpp
M	source/blender/compositor/intern/COM_WorkScheduler.cpp
M	source/blender/compositor/nodes/COM_CompositorNode.cpp
M	source/blender/compositor/nodes/COM_DefocusNode.cpp
M	source/blender/compositor/nodes/COM_DisplaceNode.cpp
M	source/blender/compositor/nodes/COM_ImageNode.cpp
M	source/blender/compositor/nodes/COM_KeyingNode.cpp
M	source/blender/compositor/nodes/COM_LensDistortionNode.cpp
M	source/blender/compositor/nodes/COM_MovieClipNode.cpp
M	source/blender/compositor/nodes/COM_RenderLayersNode.cpp
M	source/blender/compositor/nodes/COM_SeparateColorNode.cpp
M	source/blender/compositor/nodes/COM_SocketProxyNode.cpp
M	source/blender/compositor/nodes/COM_SplitViewerNode.cpp
M	source/blender/compositor/nodes/COM_SwitchNode.cpp
M	source/blender/compositor/nodes/COM_ViewerNode.cpp
M	source/blender/compositor/operations/COM_AntiAliasOperation.cpp
M	source/blender/compositor/operations/COM_BlurBaseOperation.cpp
M	source/blender/compositor/operations/COM_ChangeHSVOperation.cpp
M	source/blender/compositor/operations/COM_ColorBalanceASCCDLOperation.cpp
M	source/blender/compositor/operations/COM_ColorBalanceLGGOperation.cpp
M	source/blender/compositor/operations/COM_CompositorOperation.cpp
M	source/blender/compositor/operations/COM_ConvertDepthToRadiusOperation.cpp
M	source/blender/compositor/operations/COM_CropOperation.cpp
M	source/blender/compositor/operations/COM_DoubleEdgeMaskOperation.cpp
M	source/blender/compositor/operations/COM_FastGaussianBlurOperation.cpp
M	source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cpp
M	source/blender/compositor/operations/COM_GlareFogGlowOperation.cpp
M	source/blender/compositor/operations/COM_GlareGhostOperation.cpp
M	source/blender/compositor/operations/COM_GlareStreaksOperation.cpp
M	source/blender/compositor/operations/COM_ImageOperation.cpp
M	source/blender/compositor/operations/COM_InpaintOperation.cpp
M	source/blender/compositor/operations/COM_InvertOperation.cpp
M	source/blender/compositor/operations/COM_KeyingClipOperation.cpp
M	source/blender/compositor/operations/COM_KeyingScreenOperation.cpp
M	source/blender/compositor/operations/COM_MapRangeOperation.cpp
M	source/blender/compositor/operations/COM_MapUVOperation.cpp
M	source/blender/compositor/operations/COM_MapValueOperation.cpp
M	source/blender/compositor/operations/COM_MathBaseOperation.cpp
M	source/blender/compositor/operations/COM_MixOperation.cpp
M	source/blender/compositor/operations/COM_MovieClipOperation.cpp
M	source/blender/compositor/operations/COM_MultilayerImageOperation.cpp
M	source/blender/compositor/operations/COM_NormalizeOperation.cpp
M	source/blender/compositor/operations/COM_OpenCLKernels.cl
M	source/blender/compositor/operations/COM_OutputFileMultiViewOperation.cpp
M	source/blender/compositor/operations/COM_OutputFileOperation.cpp
M	source/blender/compositor/operations/COM_PlaneCornerPinOperation.cpp
M	source/blender/compositor/operations/COM_PlaneTrackOperation.cpp
M	source/blender/compositor/operations/COM_ProjectorLensDistortionOperation.cpp
M	source/blender/compositor/operations/COM_RenderLayersProg.cpp
M	source/blender/compositor/operations/COM_ScreenLensDistortionOperation.cpp
M	source/blender/compositor/operations/COM_TextureOperation.cpp
M	source/blender/compositor/operations/COM_TrackPositionOperation.cpp
M	source/blender/compositor/operations/COM_VectorBlurOperation.cpp
M	source/blender/compositor/operations/COM_ViewerOperation.cpp
M	source/blender/compositor/operations/COM_ViewerOperation.h
M	source/blender/compositor/operations/COM_WrapOperation.cpp

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

diff --git a/source/blender/compositor/intern/COM_Converter.cpp b/source/blender/compositor/intern/COM_Converter.cpp
index d7fac8bb5b4..9dc55527f0d 100644
--- a/source/blender/compositor/intern/COM_Converter.cpp
+++ b/source/blender/compositor/intern/COM_Converter.cpp
@@ -130,8 +130,9 @@ Node *Converter::convert(bNode *b_node)
   Node *node = NULL;
 
   /* ignore undefined nodes with missing or invalid node data */
-  if (!nodeIsRegistered(b_node))
+  if (!nodeIsRegistered(b_node)) {
     return NULL;
+  }
 
   switch (b_node->type) {
     case CMP_NODE_COMPOSITE:
@@ -514,8 +515,9 @@ void Converter::convertResolution(NodeOperationBuilder &builder,
     TranslateOperation *translateOperation = new TranslateOperation();
     translateOperation->getInputSocket(1)->setResizeMode(COM_SC_NO_RESIZE);
     translateOperation->getInputSocket(2)->setResizeMode(COM_SC_NO_RESIZE);
-    if (!first)
+    if (!first) {
       first = translateOperation;
+    }
     SetValueOperation *xop = new SetValueOperation();
     xop->setValue(addX);
     builder.addLink(xop->getOutputSocket(), translateOperation->getInputSocket(1));
diff --git a/source/blender/compositor/intern/COM_Debug.cpp b/source/blender/compositor/intern/COM_Debug.cpp
index b977154db1a..8632b7ad0f0 100644
--- a/source/blender/compositor/intern/COM_Debug.cpp
+++ b/source/blender/compositor/intern/COM_Debug.cpp
@@ -53,19 +53,23 @@ DebugInfo::GroupStateMap DebugInfo::m_group_states;
 std::string DebugInfo::node_name(const Node *node)
 {
   NodeNameMap::const_iterator it = m_node_names.find(node);
-  if (it != m_node_names.end())
+  if (it != m_node_names.end()) {
     return it->second;
-  else
+  }
+  else {
     return "";
+  }
 }
 
 std::string DebugInfo::operation_name(const NodeOperation *op)
 {
   OpNameMap::const_iterator it = m_op_names.find(op);
-  if (it != m_op_names.end())
+  if (it != m_op_names.end()) {
     return it->second;
-  else
+  }
+  else {
     return "";
+  }
 }
 
 void DebugInfo::convert_started()
@@ -79,8 +83,9 @@ void DebugInfo::execute_started(const ExecutionSystem *system)
   m_group_states.clear();
   for (ExecutionSystem::Groups::const_iterator it = system->m_groups.begin();
        it != system->m_groups.end();
-       ++it)
+       ++it) {
     m_group_states[*it] = EG_WAIT;
+  }
 }
 
 void DebugInfo::node_added(const Node *node)
@@ -145,10 +150,12 @@ int DebugInfo::graphviz_operation(const ExecutionSystem *system,
   }
 
   len += snprintf(str + len, maxlen > len ? maxlen - len : 0, "// OPERATION: %p\r\n", operation);
-  if (group)
+  if (group) {
     len += snprintf(str + len, maxlen > len ? maxlen - len : 0, "\"O_%p_%p\"", operation, group);
-  else
+  }
+  else {
     len += snprintf(str + len, maxlen > len ? maxlen - len : 0, "\"O_%p\"", operation);
+  }
   len += snprintf(str + len,
                   maxlen > len ? maxlen - len : 0,
                   " [fillcolor=%s,style=filled,shape=record,label=\"{",
@@ -368,8 +375,9 @@ bool DebugInfo::graphviz_system(const ExecutionSystem *system, char *str, int ma
   /* operations not included in any group */
   for (int j = 0; j < totops; ++j) {
     NodeOperation *operation = system->m_operations[j];
-    if (op_groups.find(operation) != op_groups.end())
+    if (op_groups.find(operation) != op_groups.end()) {
       continue;
+    }
 
     op_groups[operation].push_back(std::string(""));
 
@@ -407,8 +415,9 @@ bool DebugInfo::graphviz_system(const ExecutionSystem *system, char *str, int ma
       NodeOperationInput *to = *it;
       NodeOperationOutput *from = to->getLink();
 
-      if (!from)
+      if (!from) {
         continue;
+      }
 
       std::string color;
       switch (from->getDataType()) {
diff --git a/source/blender/compositor/intern/COM_ExecutionGroup.cpp b/source/blender/compositor/intern/COM_ExecutionGroup.cpp
index 50caf51cf48..367362c2c66 100644
--- a/source/blender/compositor/intern/COM_ExecutionGroup.cpp
+++ b/source/blender/compositor/intern/COM_ExecutionGroup.cpp
@@ -96,8 +96,9 @@ bool ExecutionGroup::canContainOperation(NodeOperation *operation)
 
 bool ExecutionGroup::addOperation(NodeOperation *operation)
 {
-  if (!canContainOperation(operation))
+  if (!canContainOperation(operation)) {
     return false;
+  }
 
   if (!operation->isReadBufferOperation() && !operation->isWriteBufferOperation()) {
     m_complex = operation->isComplex();
@@ -342,8 +343,9 @@ void ExecutionGroup::execute(ExecutionSystem *graph)
         startEvaluated = true;
         numberEvaluated++;
 
-        if (bTree->update_draw)
+        if (bTree->update_draw) {
           bTree->update_draw(bTree->udh);
+        }
       }
       else if (state == COM_ES_SCHEDULED) {
         finished = false;
@@ -401,8 +403,9 @@ MemoryBuffer *ExecutionGroup::constructConsolidatedMemoryBuffer(MemoryProxy *mem
 
 void ExecutionGroup::finalizeChunkExecution(int chunkNumber, MemoryBuffer **memoryBuffers)
 {
-  if (this->m_chunkExecutionStates[chunkNumber] == COM_ES_SCHEDULED)
+  if (this->m_chunkExecutionStates[chunkNumber] == COM_ES_SCHEDULED) {
     this->m_chunkExecutionStates[chunkNumber] = COM_ES_EXECUTED;
+  }
 
   atomic_add_and_fetch_u(&this->m_chunksFinished, 1);
   if (memoryBuffers) {
diff --git a/source/blender/compositor/intern/COM_MemoryBuffer.h b/source/blender/compositor/intern/COM_MemoryBuffer.h
index 12cd55c95a3..01a8a86bb15 100644
--- a/source/blender/compositor/intern/COM_MemoryBuffer.h
+++ b/source/blender/compositor/intern/COM_MemoryBuffer.h
@@ -158,10 +158,12 @@ class MemoryBuffer {
       case COM_MB_CLIP:
         break;
       case COM_MB_EXTEND:
-        if (x < 0)
+        if (x < 0) {
           x = 0;
-        if (x >= w)
+        }
+        if (x >= w) {
           x = w;
+        }
         break;
       case COM_MB_REPEAT:
         x = (x >= 0.0f ? (x % w) : (x % w) + w);
@@ -172,10 +174,12 @@ class MemoryBuffer {
       case COM_MB_CLIP:
         break;
       case COM_MB_EXTEND:
-        if (y < 0)
+        if (y < 0) {
           y = 0;
-        if (y >= h)
+        }
+        if (y >= h) {
           y = h;
+        }
         break;
       case COM_MB_REPEAT:
         y = (y >= 0.0f ? (y % h) : (y % h) + h);
@@ -197,10 +201,12 @@ class MemoryBuffer {
       case COM_MB_CLIP:
         break;
       case COM_MB_EXTEND:
-        if (x < 0)
+        if (x < 0) {
           x = 0.0f;
-        if (x >= w)
+        }
+        if (x >= w) {
           x = w;
+        }
         break;
       case COM_MB_REPEAT:
         x = fmodf(x, w);
@@ -211,10 +217,12 @@ class MemoryBuffer {
       case COM_MB_CLIP:
         break;
       case COM_MB_EXTEND:
-        if (y < 0)
+        if (y < 0) {
           y = 0.0f;
-        if (y >= h)
+        }
+        if (y >= h) {
           y = h;
+        }
         break;
       case COM_MB_REPEAT:
         y = fmodf(y, h);
diff --git a/source/blender/compositor/intern/COM_Node.cpp b/source/blender/compositor/intern/COM_Node.cpp
index b38493e19f2..df5a8e690d3 100644
--- a/source/blender/compositor/intern/COM_Node.cpp
+++ b/source/blender/compositor/intern/COM_Node.cpp
@@ -48,10 +48,12 @@ Node::Node(bNode *editorNode, bool create_sockets)
     bNodeSocket *input = (bNodeSocket *)editorNode->inputs.first;
     while (input != NULL) {
       DataType dt = COM_DT_VALUE;
-      if (input->type == SOCK_RGBA)
+      if (input->type == SOCK_RGBA) {
         dt = COM_DT_COLOR;
-      if (input->type == SOCK_VECTOR)
+      }
+      if (input->type == SOCK_VECTOR) {
         dt = COM_DT_VECTOR;
+      }
 
       this->addInputSocket(dt, input);
       input = input->next;
@@ -59,10 +61,12 @@ Node::Node(bNode *editorNode, bool create_sockets)
     bNodeSocket *output = (bNodeSocket *)editorNode->outputs.first;
     while (output != NULL) {
       DataType dt = COM_DT_VALUE;
-      if (output->type == SOCK_RGBA)
+      if (output->type == SOCK_RGBA) {
         dt = COM_DT_COLOR;
-      if (output->type == SOCK_VECTOR)
+      }
+      if (output->type == SOCK_VECTOR) {
         dt = COM_DT_VECTOR;
+      }
 
       this->addOutputSocket(dt, output);
       output = output->next;
diff --git a/source/blender/compositor/intern/COM_NodeGraph.cpp b/source/blender/compositor/intern/COM_NodeGraph.cpp
index 89f4542d42f..39dc946f3bc 100644
--- a/source/blender/compositor/intern/COM_NodeGraph.cpp
+++ b/source/blender/compositor/intern/COM_NodeGraph.cpp
@@ -60,8 +60,9 @@ bNodeSocket *NodeGraph::find_b_node_input(bNode *b_group_node, const char *ident
 {
   for (bNodeSocket *b_sock = (bNodeSocket *)b_group_node->inputs.first; b_sock;
        b_sock = b_sock->next) {
-    if (STREQ(b_sock->identifier, identifier))
+    if (STREQ(b_sock->identifier, identifier)) {
       return b_sock;
+    }
   }
   return NULL;
 }
@@ -70,8 +71,9 @@ bNodeSocket *NodeGraph::find_b_node_output(bNode *b_group_node, const char *iden
 {
   for (bNodeSocket *b_sock = (bNodeSocket *)b_group_node->outputs.first; b_sock;
        b_sock = b_sock->next) {
-    if (STREQ(b_sock->identifier, identifier))
+    if (STREQ(b_sock->identifier, identifier)) {
       return b_sock;
+    }
   }
   return NULL;
 }
@@ -149,8 +151,9 @@ void NodeGraph::add_bNode(const CompositorContext &context,
   else {
     /* regular nodes, handled in Converter */
     Node *node = Converter::convert(b_node);
-    if (node)
+    if (node) {
       add_node(node, b_ntree, key, is_active_group);
+    }
   }
 }
 
@@ -186,24 +189,28 @@ NodeOutput *NodeGraph::find_output(const NodeRange &node_range, bNodeSocket *b_s
 void NodeGraph::add_bNodeLink(const NodeRange &node_range, bNodeLink *b_nodelink)
 {
   /// \note: ignore invalid links
-  if (!(b_nodelink->flag & NODE_LINK_VALID))
+  if (!(b_nodelink->flag & NODE_LINK_VALID)) {
     return;
-  if ((b_nodelink->fromsock->flag & SOCK_UNAVAIL) || (b_nodelink->tosock->flag & SOCK_UNAVAIL))
+  }
+  if ((b_nodelink->fromsock->flag & SOCK_UNAVAIL) || (b_nodelink->tosock->flag & SOCK_UNAVAIL)) {
     return;
+  }
 
   /* Note: a DNA input socket can have multiple NodeInput in the compositor tree! (proxies)
    * The output then gets linked to each one of them.
    */
 
   NodeOutput *output = find_output(node_range, b_nodelink->fromsock);
-  if (!output)
+  if (!output) {
     return;
+  }
 
   NodeInputs inputs 

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list