Commit: 4d978cc2e496eb0287b3b828ac105bb767da4bb4
Author: Campbell Barton
Date:   Tue Jul 24 13:54:25 2018 +1000
Branches: master
https://developer.blender.org/rB4d978cc2e496eb0287b3b828ac105bb767da4bb4

Cleanup: changes from 2.8

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

M       source/blender/blenlib/intern/hash_mm3.c
M       source/blender/compositor/nodes/COM_CryptomatteNode.cpp
M       source/blender/compositor/operations/COM_CryptomatteOperation.cpp
M       source/blender/nodes/composite/nodes/node_composite_cryptomatte.c
M       source/blender/nodes/shader/nodes/node_shader_bsdf_hair_principled.c

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

diff --git a/source/blender/blenlib/intern/hash_mm3.c 
b/source/blender/blenlib/intern/hash_mm3.c
index 5ead9ceca63..105c1f46832 100644
--- a/source/blender/blenlib/intern/hash_mm3.c
+++ b/source/blender/blenlib/intern/hash_mm3.c
@@ -92,7 +92,7 @@ BLI_INLINE uint64_t fmix64(uint64_t k)
 
 uint32_t BLI_hash_mm3(const unsigned char *in, size_t len, uint32_t seed)
 {
-       const uint8_t *data = (const uint8_t*)in;
+       const uint8_t *data = (const uint8_t *)in;
        const int nblocks = len / 4;
 
        uint32_t h1 = seed;
@@ -102,23 +102,23 @@ uint32_t BLI_hash_mm3(const unsigned char *in, size_t 
len, uint32_t seed)
 
        /* body */
 
-       const uint32_t *blocks = (const uint32_t *)(data + nblocks*4);
+       const uint32_t *blocks = (const uint32_t *)(data + nblocks * 4);
 
        for (int i = -nblocks; i; i++) {
-               uint32_t k1 = getblock32(blocks,i);
+               uint32_t k1 = getblock32(blocks, i);
 
                k1 *= c1;
-               k1 = ROTL32(k1,15);
+               k1 = ROTL32(k1, 15);
                k1 *= c2;
 
                h1 ^= k1;
-               h1 = ROTL32(h1,13);
-               h1 = h1*5+0xe6546b64;
+               h1 = ROTL32(h1, 13);
+               h1 = h1 * 5 + 0xe6546b64;
        }
 
        /* tail */
 
-       const uint8_t *tail = (const uint8_t*)(data + nblocks*4);
+       const uint8_t *tail = (const uint8_t *)(data + nblocks * 4);
 
        uint32_t k1 = 0;
 
@@ -132,10 +132,10 @@ uint32_t BLI_hash_mm3(const unsigned char *in, size_t 
len, uint32_t seed)
                case 1:
                        k1 ^= tail[0];
                        k1 *= c1;
-                       k1 = ROTL32(k1,15);
+                       k1 = ROTL32(k1, 15);
                        k1 *= c2;
                        h1 ^= k1;
-       };
+       }
 
        /* finalization */
 
diff --git a/source/blender/compositor/nodes/COM_CryptomatteNode.cpp 
b/source/blender/compositor/nodes/COM_CryptomatteNode.cpp
index bc115e66c20..5ed66fe45e7 100644
--- a/source/blender/compositor/nodes/COM_CryptomatteNode.cpp
+++ b/source/blender/compositor/nodes/COM_CryptomatteNode.cpp
@@ -62,7 +62,7 @@ void CryptomatteNode::convertToOperations(NodeConverter 
&converter, const Compos
        bNode *node = this->getbNode();
        NodeCryptomatte *cryptoMatteSettings = (NodeCryptomatte *)node->storage;
 
-       CryptomatteOperation *operation = new 
CryptomatteOperation(getNumberOfInputSockets()-1);
+       CryptomatteOperation *operation = new 
CryptomatteOperation(getNumberOfInputSockets() - 1);
        if (cryptoMatteSettings) {
                if (cryptoMatteSettings->matte_id) {
                        /* Split the string by commas, ignoring white space. */
@@ -83,7 +83,7 @@ void CryptomatteNode::convertToOperations(NodeConverter 
&converter, const Compos
                                                
operation->addObjectIndex(atof(token.substr(1, token.length() - 2).c_str()));
                                        }
                                        else {
-                                               uint32_t hash = 
BLI_hash_mm3((const unsigned char*)token.c_str(), token.length(), 0);
+                                               uint32_t hash = 
BLI_hash_mm3((const unsigned char *)token.c_str(), token.length(), 0);
                                                
operation->addObjectIndex(hash_to_float(hash));
                                        }
                                }
@@ -93,7 +93,7 @@ void CryptomatteNode::convertToOperations(NodeConverter 
&converter, const Compos
 
        converter.addOperation(operation);
 
-       for (int i = 0; i < getNumberOfInputSockets()-1; ++i) {
+       for (int i = 0; i < getNumberOfInputSockets() - 1; ++i) {
                converter.mapInputSocket(this->getInputSocket(i + 1), 
operation->getInputSocket(i));
        }
 
diff --git a/source/blender/compositor/operations/COM_CryptomatteOperation.cpp 
b/source/blender/compositor/operations/COM_CryptomatteOperation.cpp
index 9dd36863d37..f3fa81075c6 100644
--- a/source/blender/compositor/operations/COM_CryptomatteOperation.cpp
+++ b/source/blender/compositor/operations/COM_CryptomatteOperation.cpp
@@ -63,7 +63,7 @@ void CryptomatteOperation::executePixel(float output[4],
                        output[1] = ((float) ((m3hash << 8)) / (float) 
UINT32_MAX);
                        output[2] = ((float) ((m3hash << 16)) / (float) 
UINT32_MAX);
                }
-               for(size_t i = 0; i < m_objectIndex.size(); i++) {
+               for (size_t i = 0; i < m_objectIndex.size(); i++) {
                        if (m_objectIndex[i] == input[0]) {
                                output[3] += input[1];
                        }
diff --git a/source/blender/nodes/composite/nodes/node_composite_cryptomatte.c 
b/source/blender/nodes/composite/nodes/node_composite_cryptomatte.c
index 0231e4717b2..bf9ab4a5064 100644
--- a/source/blender/nodes/composite/nodes/node_composite_cryptomatte.c
+++ b/source/blender/nodes/composite/nodes/node_composite_cryptomatte.c
@@ -39,10 +39,10 @@
 
 static inline float hash_to_float(uint32_t hash)
 {
-       uint32_t mantissa = hash & (( 1 << 23) - 1);
+       uint32_t mantissa = hash & ((1 << 23) - 1);
        uint32_t exponent = (hash >> 23) & ((1 << 8) - 1);
-       exponent = MAX2(exponent, (uint32_t) 1);
-       exponent = MIN2(exponent, (uint32_t) 254);
+       exponent = MAX2(exponent, (uint32_t)1);
+       exponent = MIN2(exponent, (uint32_t)254);
        exponent = exponent << 23;
        uint32_t sign = (hash >> 31);
        sign = sign << 31;
@@ -54,7 +54,7 @@ static inline float hash_to_float(uint32_t hash)
        return f;
 }
 
-static void cryptomatte_add(NodeCryptomatte* n, float f)
+static void cryptomatte_add(NodeCryptomatte *n, float f)
 {
        /* Turn the number into a string. */
        char number[32];
@@ -72,16 +72,16 @@ static void cryptomatte_add(NodeCryptomatte* n, float f)
                        }
 
                        /* Find the next seprator. */
-                       char* token_end = strchr(n->matte_id+start, ',');
-                       if (token_end == NULL || token_end == 
n->matte_id+start) {
-                               token_end = n->matte_id+end;
+                       char *token_end = strchr(n->matte_id + start, ',');
+                       if (token_end == NULL || token_end == n->matte_id + 
start) {
+                               token_end = n->matte_id + end;
                        }
                        /* Be aware that token_len still contains any trailing 
white space. */
                        token_len = token_end - (n->matte_id + start);
 
                        /* If this has a leading bracket, assume a raw floating 
point number and look for the closing bracket. */
                        if (n->matte_id[start] == '<') {
-                               if (strncmp(n->matte_id+start, number, 
strlen(number)) == 0) {
+                               if (strncmp(n->matte_id + start, number, 
strlen(number)) == 0) {
                                        /* This number is already there, so 
continue. */
                                        return;
                                }
@@ -89,16 +89,16 @@ static void cryptomatte_add(NodeCryptomatte* n, float f)
                        else {
                                /* Remove trailing white space */
                                size_t name_len = token_len;
-                               while (n->matte_id[start+name_len] == ' ' && 
name_len > 0) {
+                               while (n->matte_id[start + name_len] == ' ' && 
name_len > 0) {
                                        name_len--;
                                }
                                /* Calculate the hash of the token and compare. 
*/
-                               uint32_t hash = BLI_hash_mm3((const unsigned 
char*)(n->matte_id+start), name_len, 0);
+                               uint32_t hash = BLI_hash_mm3((const unsigned 
char *)(n->matte_id + start), name_len, 0);
                                if (f == hash_to_float(hash)) {
                                        return;
                                }
                        }
-                       start += token_len+1;
+                       start += token_len + 1;
                }
        }
 
@@ -107,12 +107,12 @@ static void cryptomatte_add(NodeCryptomatte* n, float f)
                return;
        }
 
-       if(n->matte_id) {
+       if (n->matte_id) {
                BLI_dynstr_append(new_matte, n->matte_id);
                MEM_freeN(n->matte_id);
        }
 
-       if(BLI_dynstr_get_len(new_matte) > 0) {
+       if (BLI_dynstr_get_len(new_matte) > 0) {
                BLI_dynstr_append(new_matte, ",");
        }
        BLI_dynstr_append(new_matte, number);
@@ -120,7 +120,7 @@ static void cryptomatte_add(NodeCryptomatte* n, float f)
        BLI_dynstr_free(new_matte);
 }
 
-static void cryptomatte_remove(NodeCryptomatte*n, float f)
+static void cryptomatte_remove(NodeCryptomatte *n, float f)
 {
        if (n->matte_id == NULL || strlen(n->matte_id) == 0) {
                /* Empty string, nothing to remove. */
@@ -150,9 +150,9 @@ static void cryptomatte_remove(NodeCryptomatte*n, float f)
                }
 
                /* Find the next seprator. */
-               char* token_end = strchr(n->matte_id+start+1, ',');
-               if (token_end == NULL || token_end == n->matte_id+start) {
-                       token_end = n->matte_id+end;
+               char *token_end = strchr(n->matte_id + start + 1, ',');
+               if (token_end == NULL || token_end == n->matte_id + start) {
+                       token_end = n->matte_id + end;
                }
                /* Be aware that token_len still contains any trailing white 
space. */
                token_len = token_end - (n->matte_id + start);
@@ -162,7 +162,7 @@ static void cryptomatte_remove(NodeCryptomatte*n, float f)
                }
                /* If this has a leading bracket, assume a raw floating point 
number and look for the closing bracket. */
                else if (n->matte_id[start] == '<') {
-                       if (strncmp(n->matte_id+start, number, strlen(number)) 
== 0) {
+                       if (strncmp(n->matte_id + start, number, 
strlen(number)) == 0) {
                                /* This number is already there, so skip it. */
                                skip = true;
                        }
@@ -170,11 +170,11 @@ static void cryptomatte_remove(NodeCryptomatte*n, float f)
                else {
                        /* Remove trailing white space */
                        size_t name_len = token_len;
-                       while (n->matte_id[start+name_len] == ' ' && name_len > 
0) {
+                       while (n->matte_id[start + name_len] == ' ' && name_len 
> 0) {
                                name_len--;
                        }
                        /* Calculate the hash of the token and compare. */
-                       uint32_t hash = BLI_hash_mm3((const unsigned 
char*)(n->matte_id+start), name_len, 0);
+                       uint32_t hash = BLI_hash_mm3((const unsigned char 
*)(n->matte_id + start), name_len, 0);
                        if (f == hash_to_float(hash)) {
                                skip = true;
                        }
@@ -186,26 +186,26 @@ static void cryptomatte_remove(NodeCryptomatte*n, float f)
                        else {
                                BLI_dynstr_append(new_matte, ", ");
                        }
-                       BLI_dynstr_nappend(new_matte, n->matte_id+start, 
token_len);
+                       BLI_dynstr_nappend(new_matte, n->matte_id + start, 
token_len);
                }
-               start += token_len+1;
+               start += token_len + 1;
        }
 
-       if(n->matte_id) {
+       if (n->matte_id) {
                MEM_freeN(n->matte_id);
                n->matte_id = NULL;
        }
-       if(BLI_dynstr_get_len(new_matte) > 0) {
+       if (BLI_dynstr_get_len(new_matte) > 0) {
                n->matte_id = BLI_dynstr_get_cstring(new_matte);
        }
        BLI_dynstr_free(new_matte);
 }
 
 static bNodeSocketTemplate outputs[] = {
-       {       SOCK_RGBA,      0, N_("Image")},
-       {       SOCK_FLOAT, 0, N_("Matte")},
-       {       SOCK_RGBA,      0, N_("Pick")},
-       {       -1, 0, ""       }
+       {   SOCK_RGBA,  0, N_("Image")},
+       {   SOCK_FLOAT, 0, N_("Matte")},
+       {   SOCK_RGBA,  0, N_("Pick")},
+       {   -1, 0, ""   }
 };
 
 void ntreeCompositCryptomatteSyncFromAdd(bNodeTree *UNUSED(ntree), bNode *node)
@@ -235,7 +235,7 @@ bNodeSocket *ntreeCompositCryptomatteAddSocket(bNodeTree 
*ntree, bNode *node)
        NodeCryptomatte *n = node->storage;
        char sockname[32];
        n->num_inputs++;
-       BLI_snprintf(sockname, sizeof(sockname), "Crypto %.2d", 
n->num_inputs-1);
+       BLI_snprintf(sockname, sizeof(sockname), "Crypto %.2d", n->num_inputs - 
1);
        bNodeSocket *sock = nodeAddStaticSocket(ntree, node, SOCK_IN, 
SOCK_RGBA, PROP_NONE, NULL, sockna

@@ Diff output truncated at 10240 characters. @@

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to