style cleanup

This commit is contained in:
Campbell Barton 2012-07-01 09:54:44 +00:00
parent 93cb7fb97b
commit 1597ad9377
16 changed files with 995 additions and 1002 deletions

@ -167,7 +167,7 @@ public:
inline friend bool operator<(rcSTR_String lhs, rcSTR_String rhs) { return (strcmp(lhs, rhs)<0); }
inline friend bool operator<(rcSTR_String lhs, const char *rhs) { return (strcmp(lhs, rhs)<0); };
inline friend bool operator<(rcSTR_String lhs, const char *rhs) { return (strcmp(lhs, rhs)<0); }
inline friend bool operator<(const char *lhs, rcSTR_String rhs) { return (strcmp(lhs, rhs)<0); }
inline friend bool operator>(rcSTR_String lhs, rcSTR_String rhs) { return (strcmp(lhs, rhs)>0); }
inline friend bool operator>(rcSTR_String lhs, const char *rhs) { return (strcmp(lhs, rhs)>0); }

@ -42,7 +42,7 @@
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#if defined(__sun__) || defined( __sun ) || defined (__sparc) || defined (__sparc__) || defined (_AIX)
#if defined(__sun__) || defined(__sun) || defined(__sparc) || defined(__sparc__) || defined(_AIX)
# include <strings.h>
#endif
#include "STR_String.h"
@ -57,7 +57,7 @@
// Construct an empty string
//
STR_String::STR_String() :
pData(new char [32]),
pData(new char[32]),
Len(0),
Max(32)
{
@ -70,7 +70,7 @@ STR_String::STR_String() :
// Construct a string of one character
//
STR_String::STR_String(char c) :
pData(new char [9]),
pData(new char[9]),
Len(1),
Max(9)
{
@ -84,9 +84,9 @@ STR_String::STR_String(char c) :
// Construct a string of multiple repeating characters
//
STR_String::STR_String(char c, int len) :
pData(new char [len+8]),
pData(new char[len + 8]),
Len(len),
Max(len+8)
Max(len + 8)
{
assertd(pData != NULL);
memset(pData, c, len);
@ -104,7 +104,7 @@ STR_String::STR_String(const char *str)
if (str) {
Len = ::strlen(str);
Max = Len + 8;
pData = new char [Max];
pData = new char[Max];
assertd(pData != NULL);
::memcpy(pData, str, Len);
pData[Len] = 0;
@ -122,9 +122,9 @@ STR_String::STR_String(const char *str)
// Construct a string from a pointer-to-ASCII-string and a length
//
STR_String::STR_String(const char *str, int len) :
pData(new char [len+8]),
pData(new char[len + 8]),
Len(len),
Max(len+8)
Max(len + 8)
{
assertd(pData != NULL);
memcpy(pData, str, len);
@ -137,9 +137,9 @@ STR_String::STR_String(const char *str, int len) :
// Construct a string from another string
//
STR_String::STR_String(rcSTR_String str) :
pData(new char [str.Length()+8]),
pData(new char[str.Length() + 8]),
Len(str.Length()),
Max(str.Length()+8)
Max(str.Length() + 8)
{
assertd(pData != NULL);
assertd(str.pData != NULL);
@ -153,9 +153,9 @@ STR_String::STR_String(rcSTR_String str) :
// Construct a string from the first number of characters in another string
//
STR_String::STR_String(rcSTR_String str, int len) :
pData(new char [len+8]),
pData(new char[len + 8]),
Len(len),
Max(len+8)
Max(len + 8)
{
assertd(pData != NULL);
assertd(str.pData != NULL);
@ -169,14 +169,14 @@ STR_String::STR_String(rcSTR_String str, int len) :
// Create a string by concatenating two sources
//
STR_String::STR_String(const char *src1, int len1, const char *src2, int len2) :
pData(new char [len1+len2+8]),
Len(len1+len2),
Max(len1+len2+8)
pData(new char[len1 + len2 + 8]),
Len(len1 + len2),
Max(len1 + len2 + 8)
{
assertd(pData != NULL);
memcpy(pData, src1, len1);
memcpy(pData+len1, src2, len2);
pData[len1+len2] = 0;
memcpy(pData + len1, src2, len2);
pData[len1 + len2] = 0;
}
@ -185,11 +185,11 @@ STR_String::STR_String(const char *src1, int len1, const char *src2, int len2) :
// Create a string with an integer value
//
STR_String::STR_String(int val) :
pData(new char [32]),
pData(new char[32]),
Max(32)
{
assertd(pData != NULL);
Len=sprintf(pData, "%d", val);
Len = sprintf(pData, "%d", val);
}
@ -199,11 +199,11 @@ STR_String::STR_String(int val) :
// Create a string with a dword value
//
STR_String::STR_String(dword val) :
pData(new char [32]),
pData(new char[32]),
Max(32)
{
assertd(pData != NULL);
Len=sprintf(pData, "%lu", val);
Len = sprintf(pData, "%lu", val);
}
@ -212,11 +212,11 @@ STR_String::STR_String(dword val) :
// Create a string with a floating point value
//
STR_String::STR_String(float val) :
pData(new char [32]),
pData(new char[32]),
Max(32)
{
assertd(pData != NULL);
Len=sprintf(pData, "%g", val);
Len = sprintf(pData, "%g", val);
}
@ -225,11 +225,11 @@ STR_String::STR_String(float val) :
// Create a string with a double value
//
STR_String::STR_String(double val) :
pData(new char [32]),
pData(new char[32]),
Max(32)
{
assertd(pData != NULL);
Len=sprintf(pData, "%g", val);
Len = sprintf(pData, "%g", val);
}
@ -246,15 +246,15 @@ STR_String::STR_String(double val) :
void STR_String::AllocBuffer(int len, bool keep_contents)
{
// Check if we have enough space
if (len+1 <= Max) return;
if (len + 1 <= Max) return;
// Reallocate string
char *new_data = new char [len+8];
char *new_data = new char[len + 8];
if (keep_contents) memcpy(new_data, pData, Len);
delete[] pData;
// Accept new data
Max = len+8;
Max = len + 8;
pData = new_data;
assertd(pData != NULL);
}
@ -298,7 +298,7 @@ STR_String& STR_String::FormatAdd(const char *fmt, ...)
// Expand arguments and format to string
va_list args;
va_start(args, fmt);
Len += vsprintf(pData+Len, fmt, args);
Len += vsprintf(pData + Len, fmt, args);
assertd(Len <= 2048);
va_end(args);
@ -318,7 +318,7 @@ STR_String& STR_String::FormatAdd(const char *fmt, ...)
//
bool STR_String::IsUpper() const
{
for (int i=0; i<Len; i++)
for (int i = 0; i < Len; i++)
if (isLower(pData[i]))
return false;
@ -332,7 +332,7 @@ bool STR_String::IsUpper() const
//
bool STR_String::IsLower() const
{
for (int i=0; i<Len; i++)
for (int i = 0; i < Len; i++)
if (isUpper(pData[i]))
return false;
@ -353,10 +353,10 @@ bool STR_String::IsLower() const
int STR_String::Find(char c, int pos) const
{
assertd(pos >= 0);
assertd(Len==0 || pos<Len);
assertd(Len == 0 || pos < Len);
assertd(pData != NULL);
char *find_pos = strchr(pData+pos, c);
return (find_pos) ? (find_pos-pData) : -1;
char *find_pos = strchr(pData + pos, c);
return (find_pos) ? (find_pos - pData) : -1;
}
@ -367,10 +367,10 @@ int STR_String::Find(char c, int pos) const
int STR_String::Find(const char *str, int pos) const
{
assertd(pos >= 0);
assertd(Len==0 || pos<Len);
assertd(Len == 0 || pos < Len);
assertd(pData != NULL);
char *find_pos = strstr(pData+pos, str);
return (find_pos) ? (find_pos-pData) : -1;
char *find_pos = strstr(pData + pos, str);
return (find_pos) ? (find_pos - pData) : -1;
}
@ -381,10 +381,10 @@ int STR_String::Find(const char *str, int pos) const
int STR_String::Find(rcSTR_String str, int pos) const
{
assertd(pos >= 0);
assertd(Len==0 || pos<Len);
assertd(Len == 0 || pos < Len);
assertd(pData != NULL);
char *find_pos = strstr(pData+pos, str.ReadPtr());
return (find_pos) ? (find_pos-pData) : -1;
char *find_pos = strstr(pData + pos, str.ReadPtr());
return (find_pos) ? (find_pos - pData) : -1;
}
@ -396,7 +396,7 @@ int STR_String::RFind(char c) const
{
assertd(pData != NULL);
char *pos = strrchr(pData, c);
return (pos) ? (pos-pData) : -1;
return (pos) ? (pos - pData) : -1;
}
@ -407,10 +407,10 @@ int STR_String::RFind(char c) const
int STR_String::FindOneOf(const char *set, int pos) const
{
assertd(pos >= 0);
assertd(Len==0 || pos<Len);
assertd(Len == 0 || pos < Len);
assertd(pData != NULL);
char *find_pos = strpbrk(pData+pos, set);
return (find_pos) ? (find_pos-pData) : -1;
char *find_pos = strpbrk(pData + pos, set);
return (find_pos) ? (find_pos - pData) : -1;
}
@ -425,17 +425,16 @@ void STR_String::Replace(int pos, rcSTR_String str)
if (str.Length() < 1)
{
// Remove one character from the string
memcpy(pData+pos, pData+pos+1, Len-pos);
memcpy(pData + pos, pData + pos + 1, Len - pos);
}
else
{
else {
// Insert zero or more characters into the string
AllocBuffer(Len + str.Length() - 1, true);
if (str.Length() != 1) memcpy(pData+pos+str.Length(), pData+pos+1, Length()-pos);
memcpy(pData+pos, str.ReadPtr(), str.Length());
if (str.Length() != 1) memcpy(pData + pos + str.Length(), pData + pos + 1, Length() - pos);
memcpy(pData + pos, str.ReadPtr(), str.Length());
}
Len += str.Length()-1;
Len += str.Length() - 1;
}
@ -452,18 +451,17 @@ void STR_String::Replace(int pos, int num, rcSTR_String str)
if (str.Length() < num)
{
// Remove some data from the string by replacement
memcpy(pData+pos+str.Length(), pData+pos+num, Len-pos-num+1);
memcpy(pData+pos, str.ReadPtr(), str.Length());
memcpy(pData + pos + str.Length(), pData + pos + num, Len - pos - num + 1);
memcpy(pData + pos, str.ReadPtr(), str.Length());
}
else
{
else {
// Insert zero or more characters into the string
AllocBuffer(Len + str.Length() - num, true);
if (str.Length() != num) memcpy(pData+pos+str.Length(), pData+pos+num, Length()-pos-num+1);
memcpy(pData+pos, str.ReadPtr(), str.Length());
if (str.Length() != num) memcpy(pData + pos + str.Length(), pData + pos + num, Length() - pos - num + 1);
memcpy(pData + pos, str.ReadPtr(), str.Length());
}
Len += str.Length()-num;
Len += str.Length() - num;
}
@ -513,8 +511,8 @@ STR_String& STR_String::Upper()
#ifdef WIN32
_strupr(pData);
#else
for (int i=0;i<Len;i++)
pData[i] = (pData[i] >= 'a' && pData[i] <= 'z')?pData[i]+'A'-'a':pData[i];
for (int i = 0; i < Len; i++)
pData[i] = (pData[i] >= 'a' && pData[i] <= 'z') ? pData[i] + 'A' - 'a' : pData[i];
#endif
return *this;
}
@ -530,8 +528,8 @@ STR_String& STR_String::Lower()
#ifdef WIN32
_strlwr(pData);
#else
for (int i=0;i<Len;i++)
pData[i] = (pData[i] >= 'A' && pData[i] <= 'Z')?pData[i]+'a'-'A':pData[i];
for (int i = 0; i < Len; i++)
pData[i] = (pData[i] >= 'A' && pData[i] <= 'Z') ? pData[i] + 'a' - 'A' : pData[i];
#endif
return *this;
}
@ -545,13 +543,13 @@ STR_String& STR_String::Capitalize()
{
assertd(pData != NULL);
#ifdef WIN32
if (Len>0) pData[0] = toupper(pData[0]);
if (Len>1) _strlwr(pData+1);
if (Len > 0) pData[0] = toupper(pData[0]);
if (Len > 1) _strlwr(pData + 1);
#else
if (Len > 0)
pData[0] = (pData[0] >= 'A' && pData[0] <= 'A')?pData[0]+'a'-'A':pData[0];
for (int i=1;i<Len;i++)
pData[i] = (pData[i] >= 'a' && pData[i] <= 'z')?pData[i]+'A'-'a':pData[i];
pData[0] = (pData[0] >= 'A' && pData[0] <= 'A') ? pData[0] + 'a' - 'A' : pData[0];
for (int i = 1; i < Len; i++)
pData[i] = (pData[i] >= 'a' && pData[i] <= 'z') ? pData[i] + 'A' - 'a' : pData[i];
#endif
return *this;
}
@ -565,9 +563,9 @@ STR_String& STR_String::TrimLeft()
{
int skip;
assertd(pData != NULL);
for (skip=0; isSpace(pData[skip]); skip++, Len--)
for (skip = 0; isSpace(pData[skip]); skip++, Len--)
{};
memmove(pData, pData+skip, Len+1);
memmove(pData, pData + skip, Len + 1);
return *this;
}
@ -579,8 +577,8 @@ STR_String& STR_String::TrimLeft()
STR_String& STR_String::TrimRight()
{
assertd(pData != NULL);
while (Len && isSpace(pData[Len-1])) Len--;
pData[Len]=0;
while (Len && isSpace(pData[Len - 1])) Len--;
pData[Len] = 0;
return *this;
}
@ -605,9 +603,9 @@ STR_String& STR_String::TrimLeft(char *set)
{
int skip;
assertd(pData != NULL);
for (skip=0; Len && strchr(set, pData[skip]); skip++, Len--)
for (skip = 0; Len && strchr(set, pData[skip]); skip++, Len--)
{};
memmove(pData, pData+skip, Len+1);
memmove(pData, pData + skip, Len + 1);
return *this;
}
@ -619,8 +617,8 @@ STR_String& STR_String::TrimLeft(char *set)
STR_String& STR_String::TrimRight(char *set)
{
assertd(pData != NULL);
while (Len && strchr(set, pData[Len-1])) Len--;
pData[Len]=0;
while (Len && strchr(set, pData[Len - 1])) Len--;
pData[Len] = 0;
return *this;
}
@ -645,10 +643,10 @@ STR_String& STR_String::TrimQuotes()
{
// Trim quotes if they are on both sides of the string
assertd(pData != NULL);
if ((Len >= 2) && (pData[0] == '\"') && (pData[Len-1] == '\"'))
if ((Len >= 2) && (pData[0] == '\"') && (pData[Len - 1] == '\"'))
{
memmove(pData, pData+1, Len-2+1);
Len-=2;
memmove(pData, pData + 1, Len - 2 + 1);
Len -= 2;
}
return *this;
}
@ -666,7 +664,7 @@ STR_String& STR_String::TrimQuotes()
//
rcSTR_String STR_String::Copy(const char *src, int len)
{
assertd(len>=0);
assertd(len >= 0);
assertd(src);
assertd(pData != NULL);
@ -685,14 +683,14 @@ rcSTR_String STR_String::Copy(const char *src, int len)
//
rcSTR_String STR_String::Concat(const char *data, int len)
{
assertd(Len>=0);
assertd(len>=0);
assertd(Len >= 0);
assertd(len >= 0);
assertd(data);
assertd(pData != NULL);
AllocBuffer(Len+len, true);
memcpy(pData+Len, data, len);
Len+=len;
AllocBuffer(Len + len, true);
memcpy(pData + Len, data, len);
Len += len;
pData[Len] = 0;
return *this;
@ -713,7 +711,7 @@ std::vector<STR_String> STR_String::Explode(char c) const
}
else {
uc.push_back(lcv.Left(pos));
lcv = lcv.Mid(pos+1);
lcv = lcv.Mid(pos + 1);
}
}
@ -723,25 +721,24 @@ std::vector<STR_String> STR_String::Explode(char c) const
}
/*
#if 0
int STR_String::Serialize(pCStream stream)
{
if (stream->GetAccess() == CStream::Access_Read)
{
if (stream->GetAccess() == CStream::Access_Read) {
int ln;
stream->Read(&ln, sizeof(ln));
AllocBuffer(ln, false);
stream->Read(pData, ln);
pData[ln] = '\0';
Len = ln;
} else
{
}
else {
stream->Write(&Len, sizeof(Len));
stream->Write(pData, Len);
}
return Len + sizeof(Len);
}
*/
#endif

@ -67,7 +67,7 @@ int uopen(const char *filename, int oflag, int pmode)
UTF16_UN_ENCODE(filename);
if (f == -1) {
if ((f=open(filename,oflag, pmode)) != -1) {
if ((f = open(filename,oflag, pmode)) != -1) {
printf("WARNING: %s is not utf path. Please update it.\n",filename);
}
}

@ -811,7 +811,7 @@ void calchandles_fcurve(FCurve *fcu)
if (bezt->vec[2][0] < bezt->vec[1][0]) bezt->vec[2][0] = bezt->vec[1][0];
/* calculate auto-handles */
BKE_nurb_handle_calc(bezt, prev, next, 1); /* 1==special autohandle */
BKE_nurb_handle_calc(bezt, prev, next, 1); /* (1 == special) autohandle */
/* for automatic ease in and out */
if (ELEM(bezt->h1, HD_AUTO, HD_AUTO_ANIM) && ELEM(bezt->h2, HD_AUTO, HD_AUTO_ANIM)) {

@ -771,7 +771,7 @@ void do_rel_key(const int start, int end, const int tot, char *basispoin, Key *k
ofsp = ofs;
while (cp[0]) { /* cp[0]==amount */
while (cp[0]) { /* (cp[0] == amount) */
switch (cp[1]) {
case IPO_FLOAT:
@ -936,7 +936,7 @@ static void do_key(const int start, int end, const int tot, char *poin, Key *key
ofsp = ofs;
while (cp[0]) { /* cp[0]==amount */
while (cp[0]) { /* (cp[0] == amount) */
switch (cp[1]) {
case IPO_FLOAT:

@ -901,8 +901,8 @@ static int getLowestRoot(const float a, const float b, const float c, const floa
// If determinant is negative it means no solutions.
if (determinant >= 0.0f) {
// calculate the two roots: (if determinant == 0 then
// x1==x2 but lets disregard that slight optimization)
/* calculate the two roots: (if determinant == 0 then
* x1==x2 but lets disregard that slight optimization) */
float sqrtD = (float)sqrt(determinant);
float r1 = (-b - sqrtD) / (2.0f * a);
float r2 = (-b + sqrtD) / (2.0f * a);

@ -1643,7 +1643,7 @@ int BLI_rebase_path(char *abs, size_t abs_len, char *rel, size_t rel_len, const
strncat(rel, base, rel_len);
}
/* return 2 if src=dest */
/* return 2 if (src == dest) */
if (BLI_path_cmp(path, dest_path) == 0) {
// if (G.debug & G_DEBUG) printf("%s and %s are the same file\n", path, dest_path);
return BLI_REBASE_IDENTITY;

@ -288,7 +288,7 @@ static void mergepolysSimp(ScanFillContext *sf_ctx, PolyFill *pf1, PolyFill *pf2
}
static short testedgeside(const float v1[2], const float v2[2], const float v3[2])
/* is v3 to the right of v1-v2 ? With exception: v3==v1 || v3==v2 */
/* is v3 to the right of v1-v2 ? With exception: v3 == v1 || v3 == v2 */
{
float inp;

@ -96,7 +96,7 @@ static void *thread_tls_data;
* }
* // conditions to exit loop
* if (if escape loop event) {
* if (BLI_available_threadslots(&lb)==maxthreads)
* if (BLI_available_threadslots(&lb) == maxthreads)
* break;
* }
* }

@ -37,7 +37,7 @@
double PIL_check_seconds_timer(void)
{
static int hasperfcounter = -1; /* -1==unknown */
static int hasperfcounter = -1; /* (-1 == unknown) */
static double perffreq;
if (hasperfcounter == -1) {

@ -270,7 +270,7 @@ static int object_select_linked_exec(bContext *C, wmOperator *op)
{
if (nr == 1) {
// XXX old animation system
//if (base->object->ipo==ipo) base->flag |= SELECT;
//if (base->object->ipo == ipo) base->flag |= SELECT;
//changed = 1;
}
else if (nr == 2) {

@ -72,7 +72,7 @@ static void node_tag_recursive(bNode *node)
node->flag |= NODE_TEST;
for (input=node->inputs.first; input; input=input->next)
for (input = node->inputs.first; input; input = input->next)
if (input->link)
node_tag_recursive(input->link->fromnode);
}
@ -86,7 +86,7 @@ static void node_clear_recursive(bNode *node)
node->flag &= ~NODE_TEST;
for (input=node->inputs.first; input; input=input->next)
for (input = node->inputs.first; input; input = input->next)
if (input->link)
node_clear_recursive(input->link->fromnode);
}
@ -100,20 +100,20 @@ static void node_remove_linked(bNodeTree *ntree, bNode *rem_node)
return;
/* tag linked nodes to be removed */
for (node=ntree->nodes.first; node; node=node->next)
for (node = ntree->nodes.first; node; node = node->next)
node->flag &= ~NODE_TEST;
node_tag_recursive(rem_node);
/* clear tags on nodes that are still used by other nodes */
for (node=ntree->nodes.first; node; node=node->next)
for (node = ntree->nodes.first; node; node = node->next)
if (!(node->flag & NODE_TEST))
for (sock=node->inputs.first; sock; sock=sock->next)
for (sock = node->inputs.first; sock; sock = sock->next)
if (sock->link && sock->link->fromnode != rem_node)
node_clear_recursive(sock->link->fromnode);
/* remove nodes */
for (node=ntree->nodes.first; node; node=next) {
for (node = ntree->nodes.first; node; node = next) {
next = node->next;
if (node->flag & NODE_TEST) {
@ -166,7 +166,7 @@ static void node_socket_add_replace(Main *bmain, bNodeTree *ntree, bNode *node_t
}
/* find existing node that we can use */
for (node_from=ntree->nodes.first; node_from; node_from=node_from->next)
for (node_from = ntree->nodes.first; node_from; node_from = node_from->next)
if (node_from->type == ntemp->type)
break;
@ -181,7 +181,7 @@ static void node_socket_add_replace(Main *bmain, bNodeTree *ntree, bNode *node_t
node_from = node_prev;
}
else if (!node_from) {
node_from= nodeAddNode(ntree, ntemp);
node_from = nodeAddNode(ntree, ntemp);
node_from->locx = node_to->locx - (node_from->typeinfo->width + 50);
node_from->locy = node_to->locy;
@ -199,8 +199,8 @@ static void node_socket_add_replace(Main *bmain, bNodeTree *ntree, bNode *node_t
if (node_prev && node_from != node_prev) {
bNodeSocket *sock_prev, *sock_from;
for (sock_prev=node_prev->inputs.first; sock_prev; sock_prev=sock_prev->next) {
for (sock_from=node_from->inputs.first; sock_from; sock_from=sock_from->next) {
for (sock_prev = node_prev->inputs.first; sock_prev; sock_prev = sock_prev->next) {
for (sock_from = node_from->inputs.first; sock_from; sock_from = sock_from->next) {
if (nodeCountSocketLinks(ntree, sock_from) >= sock_from->limit)
continue;
@ -259,7 +259,7 @@ typedef struct NodeLinkArg {
static void ui_node_link(bContext *C, void *arg_p, void *event_p)
{
NodeLinkArg *arg = (NodeLinkArg*)arg_p;
NodeLinkArg *arg = (NodeLinkArg *)arg_p;
Main *bmain = arg->bmain;
bNode *node_to = arg->node;
bNodeSocket *sock_to = arg->sock;
@ -290,7 +290,7 @@ static void ui_node_sock_name(bNodeSocket *sock, char name[UI_MAX_NAME_STR])
if (node->type == NODE_GROUP) {
if (node->id)
BLI_strncpy(node_name, node->id->name+2, UI_MAX_NAME_STR);
BLI_strncpy(node_name, node->id->name + 2, UI_MAX_NAME_STR);
else
BLI_strncpy(node_name, N_("Group"), UI_MAX_NAME_STR);
}
@ -331,17 +331,17 @@ static void ui_node_menu_column(NodeLinkArg *arg, int nclass, const char *cname)
bNodeTree *ngroup;
NodeLinkArg *argN;
int first = 1;
int compatibility= 0;
int compatibility = 0;
if (ntree->type == NTREE_SHADER) {
if (BKE_scene_use_new_shading_nodes(arg->scene))
compatibility= NODE_NEW_SHADING;
compatibility = NODE_NEW_SHADING;
else
compatibility= NODE_OLD_SHADING;
compatibility = NODE_OLD_SHADING;
}
if (nclass == NODE_CLASS_GROUP) {
for (ngroup=bmain->nodetree.first; ngroup; ngroup=ngroup->id.next) {
for (ngroup = bmain->nodetree.first; ngroup; ngroup = ngroup->id.next) {
bNodeSocket *gsock;
char name[UI_MAX_NAME_STR];
int i, j, num = 0;
@ -349,11 +349,11 @@ static void ui_node_menu_column(NodeLinkArg *arg, int nclass, const char *cname)
if (ngroup->type != ntree->type)
continue;
for (gsock=ngroup->inputs.first; gsock; gsock=gsock->next)
for (gsock = ngroup->inputs.first; gsock; gsock = gsock->next)
if (ui_compatible_sockets(gsock->type, sock->type))
num++;
for (i=0, j=0, gsock=ngroup->outputs.first; gsock; gsock=gsock->next, i++) {
for (i = 0, j = 0, gsock = ngroup->outputs.first; gsock; gsock = gsock->next, i++) {
if (!ui_compatible_sockets(gsock->type, sock->type))
continue;
@ -362,26 +362,26 @@ static void ui_node_menu_column(NodeLinkArg *arg, int nclass, const char *cname)
uiBlockSetCurLayout(block, column);
uiItemL(column, IFACE_(cname), ICON_NODE);
but= block->buttons.last;
but->flag= UI_TEXT_LEFT;
but = block->buttons.last;
but->flag = UI_TEXT_LEFT;
first = 0;
}
if (num > 1) {
if (j == 0) {
uiItemL(column, ngroup->id.name+2, ICON_NODE);
but= block->buttons.last;
but->flag= UI_TEXT_LEFT;
uiItemL(column, ngroup->id.name + 2, ICON_NODE);
but = block->buttons.last;
but->flag = UI_TEXT_LEFT;
}
BLI_snprintf(name, UI_MAX_NAME_STR, " %s", gsock->name);
j++;
}
else
BLI_strncpy(name, ngroup->id.name+2, UI_MAX_NAME_STR);
BLI_strncpy(name, ngroup->id.name + 2, UI_MAX_NAME_STR);
but = uiDefBut(block, BUT, 0, ngroup->id.name+2, 0, 0, UI_UNIT_X*4, UI_UNIT_Y,
but = uiDefBut(block, BUT, 0, ngroup->id.name + 2, 0, 0, UI_UNIT_X * 4, UI_UNIT_Y,
NULL, 0.0, 0.0, 0.0, 0.0, TIP_("Add node to input"));
argN = MEM_dupallocN(arg);
@ -393,9 +393,9 @@ static void ui_node_menu_column(NodeLinkArg *arg, int nclass, const char *cname)
}
}
else {
bNodeTreeType *ttype= ntreeGetType(ntree->type);
bNodeTreeType *ttype = ntreeGetType(ntree->type);
for (ntype=ttype->node_types.first; ntype; ntype=ntype->next) {
for (ntype = ttype->node_types.first; ntype; ntype = ntype->next) {
bNodeSocketTemplate *stemp;
char name[UI_MAX_NAME_STR];
int i, j, num = 0;
@ -406,11 +406,11 @@ static void ui_node_menu_column(NodeLinkArg *arg, int nclass, const char *cname)
if (ntype->nclass != nclass)
continue;
for (i=0, stemp=ntype->outputs; stemp && stemp->type != -1; stemp++, i++)
for (i = 0, stemp = ntype->outputs; stemp && stemp->type != -1; stemp++, i++)
if (ui_compatible_sockets(stemp->type, sock->type))
num++;
for (i=0, j=0, stemp=ntype->outputs; stemp && stemp->type != -1; stemp++, i++) {
for (i = 0, j = 0, stemp = ntype->outputs; stemp && stemp->type != -1; stemp++, i++) {
if (!ui_compatible_sockets(stemp->type, sock->type))
continue;
@ -419,8 +419,8 @@ static void ui_node_menu_column(NodeLinkArg *arg, int nclass, const char *cname)
uiBlockSetCurLayout(block, column);
uiItemL(column, IFACE_(cname), ICON_NODE);
but= block->buttons.last;
but->flag= UI_TEXT_LEFT;
but = block->buttons.last;
but->flag = UI_TEXT_LEFT;
first = 0;
}
@ -428,8 +428,8 @@ static void ui_node_menu_column(NodeLinkArg *arg, int nclass, const char *cname)
if (num > 1) {
if (j == 0) {
uiItemL(column, IFACE_(ntype->name), ICON_NODE);
but= block->buttons.last;
but->flag= UI_TEXT_LEFT;
but = block->buttons.last;
but->flag = UI_TEXT_LEFT;
}
BLI_snprintf(name, UI_MAX_NAME_STR, " %s", IFACE_(stemp->name));
@ -438,7 +438,7 @@ static void ui_node_menu_column(NodeLinkArg *arg, int nclass, const char *cname)
else
BLI_strncpy(name, IFACE_(ntype->name), UI_MAX_NAME_STR);
but = uiDefBut(block, BUT, 0, name, 0, 0, UI_UNIT_X*4, UI_UNIT_Y,
but = uiDefBut(block, BUT, 0, name, 0, 0, UI_UNIT_X * 4, UI_UNIT_Y,
NULL, 0.0, 0.0, 0.0, 0.0, TIP_("Add node to input"));
argN = MEM_dupallocN(arg);
@ -452,7 +452,7 @@ static void ui_node_menu_column(NodeLinkArg *arg, int nclass, const char *cname)
static void node_menu_column_foreach_cb(void *calldata, int nclass, const char *name)
{
NodeLinkArg *arg = (NodeLinkArg*)calldata;
NodeLinkArg *arg = (NodeLinkArg *)calldata;
if (!ELEM(nclass, NODE_CLASS_GROUP, NODE_CLASS_LAYOUT))
ui_node_menu_column(arg, nclass, name);
@ -460,21 +460,21 @@ static void node_menu_column_foreach_cb(void *calldata, int nclass, const char *
static void ui_template_node_link_menu(bContext *C, uiLayout *layout, void *but_p)
{
Main *bmain= CTX_data_main(C);
Scene *scene= CTX_data_scene(C);
Main *bmain = CTX_data_main(C);
Scene *scene = CTX_data_scene(C);
uiBlock *block = uiLayoutGetBlock(layout);
uiBut *but = (uiBut*)but_p;
uiBut *but = (uiBut *)but_p;
uiLayout *split, *column;
NodeLinkArg *arg = (NodeLinkArg*)but->func_argN;
NodeLinkArg *arg = (NodeLinkArg *)but->func_argN;
bNodeSocket *sock = arg->sock;
bNodeTreeType *ntreetype= ntreeGetType(arg->ntree->type);
bNodeTreeType *ntreetype = ntreeGetType(arg->ntree->type);
uiBlockSetCurLayout(block, layout);
split = uiLayoutSplit(layout, 0.0f, FALSE);
arg->bmain= bmain;
arg->scene= scene;
arg->layout= split;
arg->bmain = bmain;
arg->scene = scene;
arg->layout = split;
if (ntreetype && ntreetype->foreach_nodeclass)
ntreetype->foreach_nodeclass(scene, arg, node_menu_column_foreach_cb);
@ -484,14 +484,14 @@ static void ui_template_node_link_menu(bContext *C, uiLayout *layout, void *but_
if (sock->link) {
uiItemL(column, IFACE_("Link"), ICON_NONE);
but= block->buttons.last;
but->flag= UI_TEXT_LEFT;
but = block->buttons.last;
but->flag = UI_TEXT_LEFT;
but = uiDefBut(block, BUT, 0, IFACE_("Remove"), 0, 0, UI_UNIT_X*4, UI_UNIT_Y,
but = uiDefBut(block, BUT, 0, IFACE_("Remove"), 0, 0, UI_UNIT_X * 4, UI_UNIT_Y,
NULL, 0.0, 0.0, 0.0, 0.0, TIP_("Remove nodes connected to the input"));
uiButSetNFunc(but, ui_node_link, MEM_dupallocN(arg), SET_INT_IN_POINTER(UI_NODE_LINK_REMOVE));
but = uiDefBut(block, BUT, 0, IFACE_("Disconnect"), 0, 0, UI_UNIT_X*4, UI_UNIT_Y,
but = uiDefBut(block, BUT, 0, IFACE_("Disconnect"), 0, 0, UI_UNIT_X * 4, UI_UNIT_Y,
NULL, 0.0, 0.0, 0.0, 0.0, TIP_("Disconnect nodes connected to the input"));
uiButSetNFunc(but, ui_node_link, MEM_dupallocN(arg), SET_INT_IN_POINTER(UI_NODE_LINK_DISCONNECT));
}
@ -517,14 +517,14 @@ void uiTemplateNodeLink(uiLayout *layout, bNodeTree *ntree, bNode *node, bNodeSo
if (sock->link || sock->type == SOCK_SHADER || (sock->flag & SOCK_HIDE_VALUE)) {
char name[UI_MAX_NAME_STR];
ui_node_sock_name(sock, name);
but = uiDefMenuBut(block, ui_template_node_link_menu, NULL, name, 0, 0, UI_UNIT_X*4, UI_UNIT_Y, "");
but = uiDefMenuBut(block, ui_template_node_link_menu, NULL, name, 0, 0, UI_UNIT_X * 4, UI_UNIT_Y, "");
}
else
but = uiDefIconMenuBut(block, ui_template_node_link_menu, NULL, ICON_NONE, 0, 0, UI_UNIT_X, UI_UNIT_Y, "");
but->type= MENU;
but->flag |= UI_TEXT_LEFT|UI_BUT_NODE_LINK;
but->poin= (char*)but;
but->type = MENU;
but->flag |= UI_TEXT_LEFT | UI_BUT_NODE_LINK;
but->poin = (char *)but;
but->func_argN = arg;
if (sock->link && sock->link->fromnode)
@ -555,8 +555,8 @@ static void ui_node_draw_node(uiLayout *layout, bContext *C, bNodeTree *ntree, b
}
}
for (input=node->inputs.first; input; input=input->next)
ui_node_draw_input(layout, C, ntree, node, input, depth+1);
for (input = node->inputs.first; input; input = input->next)
ui_node_draw_input(layout, C, ntree, node, input, depth + 1);
}
static void ui_node_draw_input(uiLayout *layout, bContext *C, bNodeTree *ntree, bNode *node, bNodeSocket *input, int depth)
@ -567,7 +567,7 @@ static void ui_node_draw_input(uiLayout *layout, bContext *C, bNodeTree *ntree,
uiLayout *split, *row, *col;
bNode *lnode;
char label[UI_MAX_NAME_STR];
int indent = (depth > 1)? 2*(depth - 1): 0;
int indent = (depth > 1) ? 2 * (depth - 1) : 0;
int dependency_loop;
if (input->flag & SOCK_UNAVAIL)
@ -575,7 +575,7 @@ static void ui_node_draw_input(uiLayout *layout, bContext *C, bNodeTree *ntree,
/* to avoid eternal loops on cyclic dependencies */
node->flag |= NODE_TEST;
lnode = (input->link)? input->link->fromnode: NULL;
lnode = (input->link) ? input->link->fromnode : NULL;
dependency_loop = (lnode && (lnode->flag & NODE_TEST));
if (dependency_loop)
@ -598,21 +598,21 @@ static void ui_node_draw_input(uiLayout *layout, bContext *C, bNodeTree *ntree,
uiBlockSetEmboss(block, UI_EMBOSSN);
if (lnode && (lnode->inputs.first || (lnode->typeinfo->uifunc && lnode->type != NODE_GROUP))) {
int icon = (input->flag & SOCK_COLLAPSED)? ICON_DISCLOSURE_TRI_RIGHT: ICON_DISCLOSURE_TRI_DOWN;
int icon = (input->flag & SOCK_COLLAPSED) ? ICON_DISCLOSURE_TRI_RIGHT : ICON_DISCLOSURE_TRI_DOWN;
uiItemR(row, &inputptr, "show_expanded", UI_ITEM_R_ICON_ONLY, "", icon);
}
else
uiItemL(row, "", ICON_BLANK1);
bt = block->buttons.last;
bt->x2 = UI_UNIT_X/2;
bt->x2 = UI_UNIT_X / 2;
uiBlockSetEmboss(block, UI_EMBOSS);
}
uiItemL(row, label, ICON_NONE);
bt= block->buttons.last;
bt->flag= UI_TEXT_LEFT;
bt = block->buttons.last;
bt->flag = UI_TEXT_LEFT;
if (dependency_loop) {
row = uiLayoutRow(split, FALSE);
@ -661,7 +661,7 @@ void uiTemplateNodeView(uiLayout *layout, bContext *C, bNodeTree *ntree, bNode *
return;
/* clear for cycle check */
for (tnode=ntree->nodes.first; tnode; tnode=tnode->next)
for (tnode = ntree->nodes.first; tnode; tnode = tnode->next)
tnode->flag &= ~NODE_TEST;
if (input)

@ -71,20 +71,20 @@ ARegion *node_has_buttons_region(ScrArea *sa)
{
ARegion *ar, *arnew;
ar= BKE_area_find_region_type(sa, RGN_TYPE_UI);
ar = BKE_area_find_region_type(sa, RGN_TYPE_UI);
if (ar) return ar;
/* add subdiv level; after header */
ar= BKE_area_find_region_type(sa, RGN_TYPE_HEADER);
ar = BKE_area_find_region_type(sa, RGN_TYPE_HEADER);
/* is error! */
if (ar==NULL) return NULL;
if (ar == NULL) return NULL;
arnew= MEM_callocN(sizeof(ARegion), "buttons for node");
arnew = MEM_callocN(sizeof(ARegion), "buttons for node");
BLI_insertlinkafter(&sa->regionbase, ar, arnew);
arnew->regiontype= RGN_TYPE_UI;
arnew->alignment= RGN_ALIGN_RIGHT;
arnew->regiontype = RGN_TYPE_UI;
arnew->alignment = RGN_ALIGN_RIGHT;
arnew->flag = RGN_FLAG_HIDDEN;
@ -98,32 +98,32 @@ static SpaceLink *node_new(const bContext *UNUSED(C))
ARegion *ar;
SpaceNode *snode;
snode= MEM_callocN(sizeof(SpaceNode), "initnode");
snode->spacetype= SPACE_NODE;
snode = MEM_callocN(sizeof(SpaceNode), "initnode");
snode->spacetype = SPACE_NODE;
/* backdrop */
snode->zoom = 1.0f;
/* header */
ar= MEM_callocN(sizeof(ARegion), "header for node");
ar = MEM_callocN(sizeof(ARegion), "header for node");
BLI_addtail(&snode->regionbase, ar);
ar->regiontype= RGN_TYPE_HEADER;
ar->alignment= RGN_ALIGN_BOTTOM;
ar->regiontype = RGN_TYPE_HEADER;
ar->alignment = RGN_ALIGN_BOTTOM;
/* buttons/list view */
ar= MEM_callocN(sizeof(ARegion), "buttons for node");
ar = MEM_callocN(sizeof(ARegion), "buttons for node");
BLI_addtail(&snode->regionbase, ar);
ar->regiontype= RGN_TYPE_UI;
ar->alignment= RGN_ALIGN_RIGHT;
ar->regiontype = RGN_TYPE_UI;
ar->alignment = RGN_ALIGN_RIGHT;
ar->flag = RGN_FLAG_HIDDEN;
/* main area */
ar= MEM_callocN(sizeof(ARegion), "main area for node");
ar = MEM_callocN(sizeof(ARegion), "main area for node");
BLI_addtail(&snode->regionbase, ar);
ar->regiontype= RGN_TYPE_WINDOW;
ar->regiontype = RGN_TYPE_WINDOW;
ar->v2d.tot.xmin = -256.0f;
ar->v2d.tot.ymin = -256.0f;
@ -135,18 +135,18 @@ static SpaceLink *node_new(const bContext *UNUSED(C))
ar->v2d.cur.xmax = 768.0f;
ar->v2d.cur.ymax = 768.0f;
ar->v2d.min[0]= 1.0f;
ar->v2d.min[1]= 1.0f;
ar->v2d.min[0] = 1.0f;
ar->v2d.min[1] = 1.0f;
ar->v2d.max[0]= 32000.0f;
ar->v2d.max[1]= 32000.0f;
ar->v2d.max[0] = 32000.0f;
ar->v2d.max[1] = 32000.0f;
ar->v2d.minzoom= 0.09f;
ar->v2d.maxzoom= 2.31f;
ar->v2d.minzoom = 0.09f;
ar->v2d.maxzoom = 2.31f;
ar->v2d.scroll= (V2D_SCROLL_RIGHT|V2D_SCROLL_BOTTOM);
ar->v2d.keepzoom= V2D_LIMITZOOM|V2D_KEEPASPECT;
ar->v2d.keeptot= 0;
ar->v2d.scroll = (V2D_SCROLL_RIGHT | V2D_SCROLL_BOTTOM);
ar->v2d.keepzoom = V2D_LIMITZOOM | V2D_KEEPASPECT;
ar->v2d.keeptot = 0;
return (SpaceLink *)snode;
}
@ -167,8 +167,8 @@ static void node_init(struct wmWindowManager *UNUSED(wm), ScrArea *UNUSED(sa))
static void node_area_listener(ScrArea *sa, wmNotifier *wmn)
{
/* note, ED_area_tag_refresh will re-execute compositor */
SpaceNode *snode= sa->spacedata.first;
int type= snode->treetype;
SpaceNode *snode = sa->spacedata.first;
int type = snode->treetype;
short shader_type = snode->shaderfrom;
/* preview renders */
@ -183,9 +183,9 @@ static void node_area_listener(ScrArea *sa, wmNotifier *wmn)
ED_area_tag_redraw(sa);
break;
case ND_TRANSFORM_DONE:
if (type==NTREE_COMPOSIT) {
if (type == NTREE_COMPOSIT) {
if (snode->flag & SNODE_AUTO_RENDER) {
snode->recalc= 1;
snode->recalc = 1;
ED_area_tag_refresh(sa);
}
}
@ -193,43 +193,43 @@ static void node_area_listener(ScrArea *sa, wmNotifier *wmn)
}
break;
case NC_WM:
if (wmn->data==ND_FILEREAD)
if (wmn->data == ND_FILEREAD)
ED_area_tag_refresh(sa);
break;
/* future: add ID checks? */
case NC_MATERIAL:
if (type==NTREE_SHADER) {
if (wmn->data==ND_SHADING)
if (type == NTREE_SHADER) {
if (wmn->data == ND_SHADING)
ED_area_tag_refresh(sa);
else if (wmn->data==ND_SHADING_DRAW)
else if (wmn->data == ND_SHADING_DRAW)
ED_area_tag_refresh(sa);
else if (wmn->action==NA_ADDED && snode->edittree)
else if (wmn->action == NA_ADDED && snode->edittree)
nodeSetActiveID(snode->edittree, ID_MA, wmn->reference);
}
break;
case NC_TEXTURE:
if (type==NTREE_SHADER || type==NTREE_TEXTURE) {
if (wmn->data==ND_NODES)
if (type == NTREE_SHADER || type == NTREE_TEXTURE) {
if (wmn->data == ND_NODES)
ED_area_tag_refresh(sa);
}
break;
case NC_WORLD:
if (type==NTREE_SHADER && shader_type==SNODE_SHADER_WORLD) {
if (type == NTREE_SHADER && shader_type == SNODE_SHADER_WORLD) {
ED_area_tag_refresh(sa);
}
break;
case NC_OBJECT:
if (type==NTREE_SHADER) {
if (wmn->data==ND_OB_SHADING)
if (type == NTREE_SHADER) {
if (wmn->data == ND_OB_SHADING)
ED_area_tag_refresh(sa);
}
break;
case NC_SPACE:
if (wmn->data==ND_SPACE_NODE)
if (wmn->data == ND_SPACE_NODE)
ED_area_tag_refresh(sa);
else if (wmn->data==ND_SPACE_NODE_VIEW)
else if (wmn->data == ND_SPACE_NODE_VIEW)
ED_area_tag_redraw(sa);
break;
case NC_NODE:
@ -247,7 +247,7 @@ static void node_area_listener(ScrArea *sa, wmNotifier *wmn)
break;
case NC_MASK:
if (wmn->action == NA_EDITED) {
if (type==NTREE_COMPOSIT) {
if (type == NTREE_COMPOSIT) {
ED_area_tag_refresh(sa);
}
}
@ -255,7 +255,7 @@ static void node_area_listener(ScrArea *sa, wmNotifier *wmn)
case NC_IMAGE:
if (wmn->action == NA_EDITED) {
if (type==NTREE_COMPOSIT) {
if (type == NTREE_COMPOSIT) {
/* note that nodeUpdateID is already called by BKE_image_signal() on all
* scenes so really this is just to know if the images is used in the compo else
* painting on images could become very slow when the compositor is open. */
@ -270,42 +270,42 @@ static void node_area_listener(ScrArea *sa, wmNotifier *wmn)
static void node_area_refresh(const struct bContext *C, struct ScrArea *sa)
{
/* default now: refresh node is starting preview */
SpaceNode *snode= sa->spacedata.first;
SpaceNode *snode = sa->spacedata.first;
snode_set_context(snode, CTX_data_scene(C));
if (snode->nodetree) {
if (snode->treetype==NTREE_SHADER) {
if (snode->treetype == NTREE_SHADER) {
if (GS(snode->id->name) == ID_MA) {
Material *ma= (Material *)snode->id;
Material *ma = (Material *)snode->id;
if (ma->use_nodes)
ED_preview_shader_job(C, sa, snode->id, NULL, NULL, 100, 100, PR_NODE_RENDER);
}
else if (GS(snode->id->name) == ID_LA) {
Lamp *la= (Lamp *)snode->id;
Lamp *la = (Lamp *)snode->id;
if (la->use_nodes)
ED_preview_shader_job(C, sa, snode->id, NULL, NULL, 100, 100, PR_NODE_RENDER);
}
else if (GS(snode->id->name) == ID_WO) {
World *wo= (World *)snode->id;
World *wo = (World *)snode->id;
if (wo->use_nodes)
ED_preview_shader_job(C, sa, snode->id, NULL, NULL, 100, 100, PR_NODE_RENDER);
}
}
else if (snode->treetype==NTREE_COMPOSIT) {
Scene *scene= (Scene *)snode->id;
else if (snode->treetype == NTREE_COMPOSIT) {
Scene *scene = (Scene *)snode->id;
if (scene->use_nodes) {
/* recalc is set on 3d view changes for auto compo */
if (snode->recalc) {
snode->recalc= 0;
node_render_changed_exec((struct bContext*)C, NULL);
snode->recalc = 0;
node_render_changed_exec((struct bContext *)C, NULL);
}
else
snode_composite_job(C, sa);
}
}
else if (snode->treetype==NTREE_TEXTURE) {
Tex *tex= (Tex *)snode->id;
else if (snode->treetype == NTREE_TEXTURE) {
Tex *tex = (Tex *)snode->id;
if (tex->use_nodes) {
ED_preview_shader_job(C, sa, snode->id, NULL, NULL, 100, 100, PR_NODE_RENDER);
}
@ -315,11 +315,11 @@ static void node_area_refresh(const struct bContext *C, struct ScrArea *sa)
static SpaceLink *node_duplicate(SpaceLink *sl)
{
SpaceNode *snoden= MEM_dupallocN(sl);
SpaceNode *snoden = MEM_dupallocN(sl);
/* clear or remove stuff from old */
snoden->nodetree= NULL;
snoden->linkdrag.first= snoden->linkdrag.last= NULL;
snoden->nodetree = NULL;
snoden->linkdrag.first = snoden->linkdrag.last = NULL;
return (SpaceLink *)snoden;
}
@ -343,7 +343,7 @@ static void node_buttons_area_draw(const bContext *C, ARegion *ar)
static void node_cursor(wmWindow *win, ScrArea *sa, ARegion *ar)
{
SpaceNode *snode= sa->spacedata.first;
SpaceNode *snode = sa->spacedata.first;
/* convert mouse coordinates to v2d space */
UI_view2d_region_to_view(&ar->v2d, win->eventstate->x - ar->winrct.xmin, win->eventstate->y - ar->winrct.ymin,
@ -375,7 +375,7 @@ static void node_main_area_init(wmWindowManager *wm, ARegion *ar)
static void node_main_area_draw(const bContext *C, ARegion *ar)
{
View2D *v2d= &ar->v2d;
View2D *v2d = &ar->v2d;
drawnodespace(C, ar, v2d);
}
@ -385,12 +385,12 @@ static void node_main_area_draw(const bContext *C, ARegion *ar)
static int node_drop_poll(bContext *UNUSED(C), wmDrag *drag, wmEvent *UNUSED(event))
{
if (drag->type==WM_DRAG_ID) {
ID *id= (ID *)drag->poin;
if ( GS(id->name)==ID_IM )
if (drag->type == WM_DRAG_ID) {
ID *id = (ID *)drag->poin;
if (GS(id->name) == ID_IM)
return 1;
}
else if (drag->type==WM_DRAG_PATH) {
else if (drag->type == WM_DRAG_PATH) {
if (ELEM(drag->icon, 0, ICON_FILE_IMAGE)) /* rule might not work? */
return 1;
}
@ -399,10 +399,10 @@ static int node_drop_poll(bContext *UNUSED(C), wmDrag *drag, wmEvent *UNUSED(eve
static void node_id_path_drop_copy(wmDrag *drag, wmDropBox *drop)
{
ID *id= (ID *)drag->poin;
ID *id = (ID *)drag->poin;
if (id) {
RNA_string_set(drop->ptr, "name", id->name+2);
RNA_string_set(drop->ptr, "name", id->name + 2);
}
if (drag->path[0]) {
RNA_string_set(drop->ptr, "filepath", drag->path);
@ -412,7 +412,7 @@ static void node_id_path_drop_copy(wmDrag *drag, wmDropBox *drop)
/* this region dropbox definition */
static void node_dropboxes(void)
{
ListBase *lb= WM_dropboxmap_find("Node Editor", SPACE_NODE, RGN_TYPE_WINDOW);
ListBase *lb = WM_dropboxmap_find("Node Editor", SPACE_NODE, RGN_TYPE_WINDOW);
WM_dropbox_add(lb, "NODE_OT_add_file", node_drop_poll, node_id_path_drop_copy);
@ -429,8 +429,8 @@ static void node_header_area_init(wmWindowManager *UNUSED(wm), ARegion *ar)
static void node_header_area_draw(const bContext *C, ARegion *ar)
{
SpaceNode *snode= CTX_wm_space_node(C);
Scene *scene= CTX_data_scene(C);
SpaceNode *snode = CTX_wm_space_node(C);
Scene *scene = CTX_data_scene(C);
/* find and set the context */
snode_set_context(snode, scene);
@ -444,7 +444,7 @@ static void node_region_listener(ARegion *ar, wmNotifier *wmn)
/* context changes */
switch (wmn->category) {
case NC_SPACE:
if (wmn->data==ND_SPACE_NODE)
if (wmn->data == ND_SPACE_NODE)
ED_region_tag_redraw(ar);
break;
case NC_SCREEN:
@ -458,7 +458,7 @@ static void node_region_listener(ARegion *ar, wmNotifier *wmn)
ED_region_tag_redraw(ar);
break;
case NC_OBJECT:
if (wmn->data==ND_OB_SHADING)
if (wmn->data == ND_OB_SHADING)
ED_region_tag_redraw(ar);
break;
case NC_ID:
@ -472,7 +472,7 @@ const char *node_context_dir[] = {"selected_nodes", "active_node", NULL};
static int node_context(const bContext *C, const char *member, bContextDataResult *result)
{
SpaceNode *snode= CTX_wm_space_node(C);
SpaceNode *snode = CTX_wm_space_node(C);
if (CTX_data_dir(member)) {
CTX_data_dir_set(result, node_context_dir);
@ -482,7 +482,7 @@ static int node_context(const bContext *C, const char *member, bContextDataResul
bNode *node;
if (snode->edittree) {
for (node=snode->edittree->nodes.last; node; node=node->prev) {
for (node = snode->edittree->nodes.last; node; node = node->prev) {
if (node->flag & NODE_SELECT) {
CTX_data_list_add(result, &snode->edittree->id, &RNA_Node, node);
}
@ -507,56 +507,56 @@ static int node_context(const bContext *C, const char *member, bContextDataResul
/* only called once, from space/spacetypes.c */
void ED_spacetype_node(void)
{
SpaceType *st= MEM_callocN(sizeof(SpaceType), "spacetype node");
SpaceType *st = MEM_callocN(sizeof(SpaceType), "spacetype node");
ARegionType *art;
st->spaceid= SPACE_NODE;
st->spaceid = SPACE_NODE;
strncpy(st->name, "Node", BKE_ST_MAXNAME);
st->new= node_new;
st->free= node_free;
st->init= node_init;
st->duplicate= node_duplicate;
st->operatortypes= node_operatortypes;
st->keymap= node_keymap;
st->listener= node_area_listener;
st->refresh= node_area_refresh;
st->context= node_context;
st->new = node_new;
st->free = node_free;
st->init = node_init;
st->duplicate = node_duplicate;
st->operatortypes = node_operatortypes;
st->keymap = node_keymap;
st->listener = node_area_listener;
st->refresh = node_area_refresh;
st->context = node_context;
st->dropboxes = node_dropboxes;
/* regions: main window */
art= MEM_callocN(sizeof(ARegionType), "spacetype node region");
art = MEM_callocN(sizeof(ARegionType), "spacetype node region");
art->regionid = RGN_TYPE_WINDOW;
art->init= node_main_area_init;
art->draw= node_main_area_draw;
art->listener= node_region_listener;
art->init = node_main_area_init;
art->draw = node_main_area_draw;
art->listener = node_region_listener;
art->cursor = node_cursor;
art->event_cursor = TRUE;
art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_VIEW2D|ED_KEYMAP_FRAMES|ED_KEYMAP_GPENCIL;
art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_VIEW2D | ED_KEYMAP_FRAMES | ED_KEYMAP_GPENCIL;
BLI_addhead(&st->regiontypes, art);
/* regions: header */
art= MEM_callocN(sizeof(ARegionType), "spacetype node region");
art = MEM_callocN(sizeof(ARegionType), "spacetype node region");
art->regionid = RGN_TYPE_HEADER;
art->prefsizey= HEADERY;
art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_VIEW2D|ED_KEYMAP_FRAMES|ED_KEYMAP_HEADER;
art->listener= node_region_listener;
art->init= node_header_area_init;
art->draw= node_header_area_draw;
art->prefsizey = HEADERY;
art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_VIEW2D | ED_KEYMAP_FRAMES | ED_KEYMAP_HEADER;
art->listener = node_region_listener;
art->init = node_header_area_init;
art->draw = node_header_area_draw;
BLI_addhead(&st->regiontypes, art);
node_menus_register();
/* regions: listview/buttons */
art= MEM_callocN(sizeof(ARegionType), "spacetype node region");
art = MEM_callocN(sizeof(ARegionType), "spacetype node region");
art->regionid = RGN_TYPE_UI;
art->prefsizex= 180; // XXX
art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_FRAMES;
art->listener= node_region_listener;
art->init= node_buttons_area_init;
art->draw= node_buttons_area_draw;
art->prefsizex = 180; // XXX
art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_FRAMES;
art->listener = node_region_listener;
art->init = node_buttons_area_init;
art->draw = node_buttons_area_draw;
BLI_addhead(&st->regiontypes, art);
node_buttons_register(art);

@ -30,7 +30,6 @@
* \ingroup ikplugin
*/
#include "MEM_guardedalloc.h"
#include "BIK_api.h"

File diff suppressed because it is too large Load Diff

@ -406,7 +406,7 @@ CValue* CValue::GetProperty(int inIndex)
std::map<STR_String,CValue*>::iterator it;
for (it= m_pNamedPropertyArray->begin(); (it != m_pNamedPropertyArray->end()); it++)
{
if (count++==inIndex)
if (count++ == inIndex)
{
result = (*it).second;
break;