diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-07-22 02:58:08 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-07-22 02:58:08 +0400 |
commit | 9b515033071b40e982ef647ee225e8afc377e0c9 (patch) | |
tree | b8906cf9d21d2441c6dd0db1b518561def3f8f1a | |
parent | 049dd8a0ffa94b0d02033877ec99172659b89d8c (diff) |
style cleanup
42 files changed, 304 insertions, 288 deletions
diff --git a/intern/cycles/subd/subd_build.cpp b/intern/cycles/subd/subd_build.cpp index c8181838ec3..312980f1fa2 100644 --- a/intern/cycles/subd/subd_build.cpp +++ b/intern/cycles/subd/subd_build.cpp @@ -117,7 +117,7 @@ Patch *SubdAccBuilder::run(SubdFace *face) memcpy(patch->hull, position, sizeof(float3)*20); return patch; } - else if(face->num_edges() == 4) { + else if(face->num_edges() == 4) { GregoryQuadPatch *patch = new GregoryQuadPatch(); memcpy(patch->hull, position, sizeof(float3)*20); return patch; @@ -644,7 +644,7 @@ Patch *SubdLinearBuilder::run(SubdFace *face) hull = lpatch->hull; patch = lpatch; } - else if(face->num_edges() == 4) { + else if(face->num_edges() == 4) { LinearQuadPatch *lpatch = new LinearQuadPatch(); hull = lpatch->hull; patch = lpatch; diff --git a/intern/decimation/intern/LOD_QuadricEditor.cpp b/intern/decimation/intern/LOD_QuadricEditor.cpp index b56f6a5b520..fbaf0c1180f 100644 --- a/intern/decimation/intern/LOD_QuadricEditor.cpp +++ b/intern/decimation/intern/LOD_QuadricEditor.cpp @@ -174,7 +174,7 @@ BuildQuadrics( vector<LOD_Edge>::iterator edge_it = edges.begin(); vector<LOD_Edge>::const_iterator edge_end = edges.end(); - for (; edge_it != edge_end; ++edge_it) { + for (; edge_it != edge_end; ++edge_it) { MT_Vector3 target = TargetVertex(*edge_it); @@ -235,7 +235,7 @@ ComputeEdgeCosts( vector<LOD_EdgeInd>::const_iterator edge_it = edges.begin(); vector<LOD_EdgeInd>::const_iterator edge_end = edges.end(); - for (; edge_it != edge_end; ++edge_it) { + for (; edge_it != edge_end; ++edge_it) { MT_Vector3 target = TargetVertex(edge_set[*edge_it]); diff --git a/intern/ghost/intern/GHOST_DisplayManagerX11.cpp b/intern/ghost/intern/GHOST_DisplayManagerX11.cpp index d719a4caa55..84e56799ee0 100644 --- a/intern/ghost/intern/GHOST_DisplayManagerX11.cpp +++ b/intern/ghost/intern/GHOST_DisplayManagerX11.cpp @@ -48,7 +48,7 @@ GHOST_DisplayManagerX11( GHOST_DisplayManager(), m_system(system) { - //nothing to do. + /* nothing to do. */ } GHOST_TSuccess @@ -87,7 +87,7 @@ getNumDisplaySettings( XF86VidModeGetAllModeLines(dpy, DefaultScreen(dpy), &numSettings, &vidmodes); #else - // We only have one X11 setting at the moment. + /* We only have one X11 setting at the moment. */ GHOST_ASSERT(display < 1, "Only single display systems are currently supported.\n"); numSettings = GHOST_TInt32(1); #endif @@ -144,8 +144,8 @@ getDisplaySetting( setting.bpp = DefaultDepth(x_display, DefaultScreen(x_display)); #endif - // Don't think it's possible to get this value from X! - // So let's guess!! + /* Don't think it's possible to get this value from X! + * So let's guess!! */ setting.frequency = 60; return GHOST_kSuccess; @@ -171,11 +171,10 @@ setCurrentDisplaySetting( const GHOST_DisplaySetting& setting) { #ifdef WITH_X11_XF86VMODE - // - // Mode switching code ported from Quake 2: - // ftp://ftp.idsoftware.com/idstuff/source/q2source-3.21.zip - // See linux/gl_glx.c:GLimp_SetMode - // + /* Mode switching code ported from Quake 2: + * ftp:/* ftp.idsoftware.com/idstuff/source/q2source-3.21.zip */ + * See linux/gl_glx.c:GLimp_SetMode + */ int majorVersion, minorVersion; XF86VidModeModeInfo **vidmodes; Display *dpy = m_system->getXDisplay(); @@ -187,7 +186,7 @@ setCurrentDisplaySetting( scrnum = DefaultScreen(dpy); - // Get video mode list + /* Get video mode list */ majorVersion = minorVersion = 0; if (!XF86VidModeQueryVersion(dpy, &majorVersion, &minorVersion)) { fprintf(stderr, "Error: XF86VidMode extension missing!\n"); @@ -228,20 +227,21 @@ setCurrentDisplaySetting( actualWidth, actualHeight); # endif - // change to the mode + /* change to the mode */ XF86VidModeSwitchToMode(dpy, scrnum, vidmodes[best_fit]); - // Move the viewport to top left + /* Move the viewport to top left */ XF86VidModeSetViewPort(dpy, scrnum, 0, 0); } - else + else { return GHOST_kFailure; + } XFlush(dpy); return GHOST_kSuccess; #else - // Just pretend the request was successful. + /* Just pretend the request was successful. */ return GHOST_kSuccess; #endif } diff --git a/intern/ghost/intern/GHOST_DropTargetX11.cpp b/intern/ghost/intern/GHOST_DropTargetX11.cpp index c1cc55b332a..e2e15277a99 100644 --- a/intern/ghost/intern/GHOST_DropTargetX11.cpp +++ b/intern/ghost/intern/GHOST_DropTargetX11.cpp @@ -144,23 +144,23 @@ void GHOST_DropTargetX11::UrlDecode(char *decodedOut, int bufferSize, const char break; } - // We are now converting + /* We are now converting */ state = STATE_CONVERTING; break; case STATE_CONVERTING: bothDigits = true; - // Create a buffer to hold the hex. For example, if %20, this - // buffer would hold 20 (in ASCII) + /* Create a buffer to hold the hex. For example, if %20, this + * buffer would hold 20 (in ASCII) */ memset(tempNumBuf, 0, sizeof(tempNumBuf)); - // Conversion complete (i.e. don't convert again next iter) + /* Conversion complete (i.e. don't convert again next iter) */ state = STATE_SEARCH; strncpy(tempNumBuf, &encodedIn[i], 2); - // Ensure both characters are hexadecimal + /* Ensure both characters are hexadecimal */ for (j = 0; j < 2; ++j) { if (!isxdigit(tempNumBuf[j])) @@ -170,16 +170,16 @@ void GHOST_DropTargetX11::UrlDecode(char *decodedOut, int bufferSize, const char if (!bothDigits) break; - // Convert two hexadecimal characters into one character + /* Convert two hexadecimal characters into one character */ sscanf(tempNumBuf, "%x", &asciiCharacter); - // Ensure we aren't going to overflow + /* Ensure we aren't going to overflow */ assert(strlen(decodedOut) < bufferSize); - // Concatenate this character onto the output + /* Concatenate this character onto the output */ strncat(decodedOut, (char *)&asciiCharacter, 1); - // Skip the next character + /* Skip the next character */ i++; break; } diff --git a/intern/ghost/intern/GHOST_SystemPathsX11.cpp b/intern/ghost/intern/GHOST_SystemPathsX11.cpp index 83f7e87977c..35bebd588c3 100644 --- a/intern/ghost/intern/GHOST_SystemPathsX11.cpp +++ b/intern/ghost/intern/GHOST_SystemPathsX11.cpp @@ -38,11 +38,11 @@ #include <sys/time.h> #include <unistd.h> -#include <stdio.h> // for fprintf only -#include <cstdlib> // for exit +#include <stdio.h> /* for fprintf only */ +#include <cstdlib> /* for exit */ -#include <pwd.h> // for get home without use getenv() -#include <limits.h> // for PATH_MAX +#include <pwd.h> /* for get home without use getenv() */ +#include <limits.h> /* for PATH_MAX */ #ifdef PREFIX static const char *static_path = PREFIX "/share"; diff --git a/intern/ghost/intern/GHOST_SystemX11.cpp b/intern/ghost/intern/GHOST_SystemX11.cpp index 03a952fafb3..eccfc18eef9 100644 --- a/intern/ghost/intern/GHOST_SystemX11.cpp +++ b/intern/ghost/intern/GHOST_SystemX11.cpp @@ -32,7 +32,6 @@ * \ingroup GHOST */ - #include "GHOST_SystemX11.h" #include "GHOST_WindowX11.h" #include "GHOST_WindowManager.h" @@ -44,11 +43,11 @@ #include "GHOST_DisplayManagerX11.h" #include "GHOST_EventDragnDrop.h" #ifdef WITH_INPUT_NDOF -#include "GHOST_NDOFManagerX11.h" +# include "GHOST_NDOFManagerX11.h" #endif #ifdef WITH_XDND -#include "GHOST_DropTargetX11.h" +# include "GHOST_DropTargetX11.h" #endif #include "GHOST_Debug.h" @@ -61,20 +60,19 @@ #include <X11/XF86keysym.h> #endif -// For timing - +/* For timing */ #include <sys/time.h> #include <unistd.h> #include <iostream> #include <vector> -#include <stdio.h> // for fprintf only -#include <cstdlib> // for exit +#include <stdio.h> /* for fprintf only */ +#include <cstdlib> /* for exit */ static GHOST_TKey convertXKey(KeySym key); -//these are for copy and select copy +/* these are for copy and select copy */ static char *txt_cut_buffer = NULL; static char *txt_select_buffer = NULL; @@ -90,7 +88,7 @@ GHOST_SystemX11( if (!m_display) { std::cerr << "Unable to open a display" << std::endl; - abort(); //was return before, but this would just mean it will crash later + abort(); /* was return before, but this would just mean it will crash later */ } #if defined(WITH_X11_XINPUT) && defined(X_HAVE_UTF8_STRING) @@ -128,13 +126,13 @@ GHOST_SystemX11( m_last_warp = 0; - // compute the initial time + /* compute the initial time */ timeval tv; if (gettimeofday(&tv, NULL) == -1) { GHOST_ASSERT(false, "Could not instantiate timer!"); } - // Taking care not to overflow the tv.tv_sec*1000 + /* Taking care not to overflow the tv.tv_sec*1000 */ m_start_time = GHOST_TUns64(tv.tv_sec) * 1000 + tv.tv_usec / 1000; @@ -190,7 +188,7 @@ getMilliSeconds() const GHOST_ASSERT(false, "Could not compute time!"); } - // Taking care not to overflow the tv.tv_sec*1000 + /* Taking care not to overflow the tv.tv_sec*1000 */ return GHOST_TUns64(tv.tv_sec) * 1000 + tv.tv_usec / 1000 - m_start_time; } @@ -254,16 +252,16 @@ createWindow( - window = new GHOST_WindowX11( - this, m_display, title, left, top, width, height, state, parentWindow, type, stereoVisual - ); + window = new GHOST_WindowX11(this, m_display, title, + left, top, width, height, + state, parentWindow, type, stereoVisual); if (window) { - // Both are now handle in GHOST_WindowX11.cpp - // Focus and Delete atoms. + /* Both are now handle in GHOST_WindowX11.cpp + * Focus and Delete atoms. */ if (window->getValid()) { - // Store the pointer to the window + /* Store the pointer to the window */ m_windowManager->addWindow(window); m_windowManager->setActiveWindow(window); pushEvent(new GHOST_Event(getMilliSeconds(), GHOST_kEventWindowSize, window) ); @@ -313,10 +311,10 @@ findGhostWindow( if (xwind == 0) return NULL; - // It is not entirely safe to do this as the backptr may point - // to a window that has recently been removed. - // We should always check the window manager's list of windows - // and only process events on these windows. + /* It is not entirely safe to do this as the backptr may point + * to a window that has recently been removed. + * We should always check the window manager's list of windows + * and only process events on these windows. */ vector<GHOST_IWindow *> & win_vec = m_windowManager->getWindows(); @@ -411,8 +409,8 @@ GHOST_SystemX11:: processEvents( bool waitForEvent) { - // Get all the current events -- translate them into - // ghost events and call base class pushEvent() method. + /* Get all the current events -- translate them into + * ghost events and call base class pushEvent() method. */ bool anyProcessed = false; @@ -519,8 +517,8 @@ GHOST_SystemX11::processEvent(XEvent *xe) XExposeEvent & xee = xe->xexpose; if (xee.count == 0) { - // Only generate a single expose event - // per read of the event queue. + /* Only generate a single expose event + * per read of the event queue. */ g_event = new GHOST_Event( @@ -761,7 +759,7 @@ GHOST_SystemX11::processEvent(XEvent *xe) break; } - // change of size, border, layer etc. + /* change of size, border, layer etc. */ case ConfigureNotify: { /* XConfigureEvent & xce = xe->xconfigure; */ @@ -780,12 +778,11 @@ GHOST_SystemX11::processEvent(XEvent *xe) { XFocusChangeEvent &xfe = xe->xfocus; - // TODO: make sure this is the correct place for activate/deactivate + /* TODO: make sure this is the correct place for activate/deactivate */ // printf("X: focus %s for window %d\n", xfe.type == FocusIn ? "in" : "out", (int) xfe.window); - // May have to look at the type of event and filter some - // out. - + /* May have to look at the type of event and filter some out. */ + GHOST_TEventType gtype = (xfe.type == FocusIn) ? GHOST_kEventWindowActivate : GHOST_kEventWindowDeactivate; @@ -860,7 +857,7 @@ GHOST_SystemX11::processEvent(XEvent *xe) case DestroyNotify: ::exit(-1); - // We're not interested in the following things.(yet...) + /* We're not interested in the following things.(yet...) */ case NoExpose: case GraphicsExpose: break; @@ -945,8 +942,12 @@ GHOST_SystemX11::processEvent(XEvent *xe) nxe.xselection.target = xse->target; nxe.xselection.time = xse->time; - /*Check to see if the requestor is asking for String*/ - if (xse->target == utf8_string || xse->target == string || xse->target == compound_text || xse->target == c_string) { + /* Check to see if the requestor is asking for String */ + if (xse->target == utf8_string || + xse->target == string || + xse->target == compound_text || + xse->target == c_string) + { if (xse->selection == XInternAtom(m_display, "PRIMARY", False)) { XChangeProperty(m_display, xse->requestor, xse->property, xse->target, 8, PropModeReplace, (unsigned char *)txt_select_buffer, strlen(txt_select_buffer)); @@ -968,11 +969,11 @@ GHOST_SystemX11::processEvent(XEvent *xe) XFlush(m_display); } else { - //Change property to None because we do not support anything but STRING + /* Change property to None because we do not support anything but STRING */ nxe.xselection.property = None; } - //Send the event to the client 0 0 == False, SelectionNotify + /* Send the event to the client 0 0 == False, SelectionNotify */ XSendEvent(m_display, xse->requestor, 0, 0, &nxe); XFlush(m_display); break; @@ -1023,14 +1024,14 @@ getModifierKeys( GHOST_ModifierKeys& keys) const { - // analyse the masks retuned from XQueryPointer. + /* analyse the masks retuned from XQueryPointer. */ memset((void *)m_keyboard_vector, 0, sizeof(m_keyboard_vector)); XQueryKeymap(m_display, (char *)m_keyboard_vector); - // now translate key symobols into keycodes and - // test with vector. + /* now translate key symobols into keycodes and + * test with vector. */ const static KeyCode shift_l = XKeysymToKeycode(m_display, XK_Shift_L); const static KeyCode shift_r = XKeysymToKeycode(m_display, XK_Shift_R); @@ -1041,16 +1042,16 @@ getModifierKeys( const static KeyCode super_l = XKeysymToKeycode(m_display, XK_Super_L); const static KeyCode super_r = XKeysymToKeycode(m_display, XK_Super_R); - // shift + /* shift */ keys.set(GHOST_kModifierKeyLeftShift, ((m_keyboard_vector[shift_l >> 3] >> (shift_l & 7)) & 1) != 0); keys.set(GHOST_kModifierKeyRightShift, ((m_keyboard_vector[shift_r >> 3] >> (shift_r & 7)) & 1) != 0); - // control + /* control */ keys.set(GHOST_kModifierKeyLeftControl, ((m_keyboard_vector[control_l >> 3] >> (control_l & 7)) & 1) != 0); keys.set(GHOST_kModifierKeyRightControl, ((m_keyboard_vector[control_r >> 3] >> (control_r & 7)) & 1) != 0); - // alt + /* alt */ keys.set(GHOST_kModifierKeyLeftAlt, ((m_keyboard_vector[alt_l >> 3] >> (alt_l & 7)) & 1) != 0); keys.set(GHOST_kModifierKeyRightAlt, ((m_keyboard_vector[alt_r >> 3] >> (alt_r & 7)) & 1) != 0); - // super (windows) - only one GHOST-kModifierKeyOS, so mapping to either + /* super (windows) - only one GHOST-kModifierKeyOS, so mapping to either */ keys.set(GHOST_kModifierKeyOS, ( ((m_keyboard_vector[super_l >> 3] >> (super_l & 7)) & 1) || ((m_keyboard_vector[super_r >> 3] >> (super_r & 7)) & 1) ) != 0); @@ -1123,9 +1124,9 @@ setCursorPosition( GHOST_TInt32 y ) { - // This is a brute force move in screen coordinates - // XWarpPointer does relative moves so first determine the - // current pointer position. + /* This is a brute force move in screen coordinates + * XWarpPointer does relative moves so first determine the + * current pointer position. */ int cx, cy; if (getCursorPosition(cx, cy) == GHOST_kFailure) { @@ -1336,15 +1337,15 @@ convertXKey(KeySym key) /* from xclip.c xcout() v0.11 */ -#define XCLIB_XCOUT_NONE 0 /* no context */ +#define XCLIB_XCOUT_NONE 0 /* no context */ #define XCLIB_XCOUT_SENTCONVSEL 1 /* sent a request */ -#define XCLIB_XCOUT_INCR 2 /* in an incr loop */ +#define XCLIB_XCOUT_INCR 2 /* in an incr loop */ #define XCLIB_XCOUT_FALLBACK 3 /* STRING failed, need fallback to UTF8 */ #define XCLIB_XCOUT_FALLBACK_UTF8 4 /* UTF8 failed, move to compouned */ #define XCLIB_XCOUT_FALLBACK_COMP 5 /* compouned failed, move to text. */ #define XCLIB_XCOUT_FALLBACK_TEXT 6 -// Retrieves the contents of a selections. +/* Retrieves the contents of a selections. */ void GHOST_SystemX11::getClipboard_xcout(XEvent evt, Atom sel, Atom target, unsigned char **txt, unsigned long *len, unsigned int *context) const @@ -1361,15 +1362,15 @@ void GHOST_SystemX11::getClipboard_xcout(XEvent evt, Window win = window->getXWindow(); switch (*context) { - // There is no context, do an XConvertSelection() + /* There is no context, do an XConvertSelection() */ case XCLIB_XCOUT_NONE: - // Initialise return length to 0 + /* Initialise return length to 0 */ if (*len > 0) { free(*txt); *len = 0; } - // Send a selection request + /* Send a selection request */ XConvertSelection(m_display, sel, target, m_xclip_out, win, CurrentTime); *context = XCLIB_XCOUT_SENTCONVSEL; return; @@ -1391,22 +1392,22 @@ void GHOST_SystemX11::getClipboard_xcout(XEvent evt, return; } - // find the size and format of the data in property + /* find the size and format of the data in property */ XGetWindowProperty(m_display, win, m_xclip_out, 0, 0, False, AnyPropertyType, &pty_type, &pty_format, &pty_items, &pty_size, &buffer); XFree(buffer); if (pty_type == m_incr) { - // start INCR mechanism by deleting property + /* start INCR mechanism by deleting property */ XDeleteProperty(m_display, win, m_xclip_out); XFlush(m_display); *context = XCLIB_XCOUT_INCR; return; } - // if it's not incr, and not format == 8, then there's - // nothing in the selection (that xclip understands, anyway) + /* if it's not incr, and not format == 8, then there's + * nothing in the selection (that xclip understands, anyway) */ if (pty_format != 8) { *context = XCLIB_XCOUT_NONE; @@ -1418,73 +1419,73 @@ void GHOST_SystemX11::getClipboard_xcout(XEvent evt, False, AnyPropertyType, &pty_type, &pty_format, &pty_items, &pty_size, &buffer); - // finished with property, delete it + /* finished with property, delete it */ XDeleteProperty(m_display, win, m_xclip_out); - // copy the buffer to the pointer for returned data + /* copy the buffer to the pointer for returned data */ ltxt = (unsigned char *) malloc(pty_items); memcpy(ltxt, buffer, pty_items); - // set the length of the returned data + /* set the length of the returned data */ *len = pty_items; *txt = ltxt; - // free the buffer + /* free the buffer */ XFree(buffer); *context = XCLIB_XCOUT_NONE; - // complete contents of selection fetched, return 1 + /* complete contents of selection fetched, return 1 */ return; case XCLIB_XCOUT_INCR: - // To use the INCR method, we basically delete the - // property with the selection in it, wait for an - // event indicating that the property has been created, - // then read it, delete it, etc. + /* To use the INCR method, we basically delete the + * property with the selection in it, wait for an + * event indicating that the property has been created, + * then read it, delete it, etc. */ - // make sure that the event is relevant + /* make sure that the event is relevant */ if (evt.type != PropertyNotify) return; - // skip unless the property has a new value + /* skip unless the property has a new value */ if (evt.xproperty.state != PropertyNewValue) return; - // check size and format of the property + /* check size and format of the property */ XGetWindowProperty(m_display, win, m_xclip_out, 0, 0, False, AnyPropertyType, &pty_type, &pty_format, &pty_items, &pty_size, (unsigned char **) &buffer); if (pty_format != 8) { - // property does not contain text, delete it - // to tell the other X client that we have read - // it and to send the next property + /* property does not contain text, delete it + * to tell the other X client that we have read + * it and to send the next property */ XFree(buffer); XDeleteProperty(m_display, win, m_xclip_out); return; } if (pty_size == 0) { - // no more data, exit from loop + /* no more data, exit from loop */ XFree(buffer); XDeleteProperty(m_display, win, m_xclip_out); *context = XCLIB_XCOUT_NONE; - // this means that an INCR transfer is now - // complete, return 1 + /* this means that an INCR transfer is now + * complete, return 1 */ return; } XFree(buffer); - // if we have come this far, the propery contains - // text, we know the size. + /* if we have come this far, the propery contains + * text, we know the size. */ XGetWindowProperty(m_display, win, m_xclip_out, 0, (long) pty_size, False, AnyPropertyType, &pty_type, &pty_format, &pty_items, &pty_size, (unsigned char **) &buffer); - // allocate memory to accommodate data in *txt + /* allocate memory to accommodate data in *txt */ if (*len == 0) { *len = pty_items; ltxt = (unsigned char *) malloc(*len); @@ -1494,13 +1495,13 @@ void GHOST_SystemX11::getClipboard_xcout(XEvent evt, ltxt = (unsigned char *) realloc(ltxt, *len); } - // add data to ltxt + /* add data to ltxt */ memcpy(<xt[*len - pty_items], buffer, pty_items); *txt = ltxt; XFree(buffer); - // delete property to get the next item + /* delete property to get the next item */ XDeleteProperty(m_display, win, m_xclip_out); XFlush(m_display); return; @@ -1514,7 +1515,7 @@ GHOST_TUns8 *GHOST_SystemX11::getClipboard(bool selection) const Atom target = m_utf8_string; Window owner; - // from xclip.c doOut() v0.11 + /* from xclip.c doOut() v0.11 */ unsigned char *sel_buf; unsigned long sel_len = 0; XEvent evt; diff --git a/intern/ghost/intern/GHOST_WindowNULL.h b/intern/ghost/intern/GHOST_WindowNULL.h index dcbb7d2b346..e3d092101b0 100644 --- a/intern/ghost/intern/GHOST_WindowNULL.h +++ b/intern/ghost/intern/GHOST_WindowNULL.h @@ -81,9 +81,9 @@ protected: GHOST_TSuccess activateDrawingContext( ) { return GHOST_kFailure; } ~GHOST_WindowNULL( ) { /* nothing */ } GHOST_TSuccess setWindowCursorVisibility( bool visible ) { return GHOST_kSuccess; } - GHOST_TSuccess setState(GHOST_TWindowState state) { return GHOST_kSuccess; } + GHOST_TSuccess setState(GHOST_TWindowState state) { return GHOST_kSuccess; } GHOST_TWindowState getState() const { return GHOST_kWindowStateNormal; } - GHOST_TSuccess invalidate() { return GHOST_kSuccess; } + GHOST_TSuccess invalidate() { return GHOST_kSuccess; } GHOST_TSuccess setOrder(GHOST_TWindowOrder order) { return GHOST_kSuccess; } diff --git a/intern/ghost/intern/GHOST_WindowWin32.cpp b/intern/ghost/intern/GHOST_WindowWin32.cpp index e3fe28e2e64..3a6e646de11 100644 --- a/intern/ghost/intern/GHOST_WindowWin32.cpp +++ b/intern/ghost/intern/GHOST_WindowWin32.cpp @@ -1343,7 +1343,7 @@ static int EnumPixelFormats(HDC hdc) ::DescribePixelFormat(hdc, i, sizeof(PIXELFORMATDESCRIPTOR), &pfd); w = WeightPixelFormat(pfd); // be strict on stereo - if (!((sPreferredFormat.dwFlags ^ pfd.dwFlags) & PFD_STEREO)) { + if (!((sPreferredFormat.dwFlags ^ pfd.dwFlags) & PFD_STEREO)) { if (w > weight) { weight = w; iPixelFormat = i; diff --git a/intern/ghost/intern/GHOST_WindowX11.cpp b/intern/ghost/intern/GHOST_WindowX11.cpp index 80d5b5a4652..3dc10d17169 100644 --- a/intern/ghost/intern/GHOST_WindowX11.cpp +++ b/intern/ghost/intern/GHOST_WindowX11.cpp @@ -39,7 +39,7 @@ #include "GHOST_DropTargetX11.h" #endif -// For standard X11 cursors +/* For standard X11 cursors */ #include <X11/cursorfont.h> #include <X11/Xatom.h> @@ -53,8 +53,8 @@ #include <algorithm> #include <string> -// For obscure full screen mode stuuf -// lifted verbatim from blut. +/* For obscure full screen mode stuuf + * lifted verbatim from blut. */ typedef struct { long flags; @@ -95,7 +95,7 @@ typedef struct { f.write('\n') */ -// See the python script above to regenerate the 48x48 icon within blender +/* See the python script above to regenerate the 48x48 icon within blender */ #define BLENDER_ICON_WIDTH 48 #define BLENDER_ICON_HEIGHT 48 static unsigned char BLENDER_ICON_48x48x24[] = { @@ -178,13 +178,13 @@ GHOST_WindowX11( m_custom_cursor(None) { - // Set up the minimum atrributes that we require and see if - // X can find us a visual matching those requirements. + /* Set up the minimum atrributes that we require and see if + * X can find us a visual matching those requirements. */ int attributes[40], i, samples; Atom atoms[2]; int natom; - int glxVersionMajor, glxVersionMinor; // As in GLX major.minor + int glxVersionMajor, glxVersionMinor; /* As in GLX major.minor */ #ifdef WITH_X11_XINPUT /* initialize incase X11 fails to load */ @@ -251,11 +251,11 @@ GHOST_WindowX11( } } - // Create a bunch of attributes needed to create an X window. + /* Create a bunch of attributes needed to create an X window. */ - // First create a colormap for the window and visual. - // This seems pretty much a legacy feature as we are in rgba mode anyway. + /* First create a colormap for the window and visual. + * This seems pretty much a legacy feature as we are in rgba mode anyway. */ XSetWindowAttributes xattributes; memset(&xattributes, 0, sizeof(xattributes)); @@ -268,7 +268,7 @@ GHOST_WindowX11( xattributes.border_pixel = 0; - // Specify which events we are interested in hearing. + /* Specify which events we are interested in hearing. */ xattributes.event_mask = ExposureMask | StructureNotifyMask | @@ -277,7 +277,7 @@ GHOST_WindowX11( ButtonPressMask | ButtonReleaseMask | PointerMotionMask | FocusChangeMask | PropertyChangeMask; - // create the window! + /* create the window! */ ; if (parentWindow == 0) { @@ -287,7 +287,7 @@ GHOST_WindowX11( top, width, height, - 0, // no border. + 0, /* no border. */ m_visual->depth, InputOutput, m_visual->visual, @@ -311,12 +311,12 @@ GHOST_WindowX11( m_window = XCreateWindow(m_display, - parentWindow, // reparent against embedder + parentWindow, /* reparent against embedder */ left, top, width, height, - 0, // no border. + 0, /* no border. */ m_visual->depth, InputOutput, m_visual->visual, @@ -353,9 +353,9 @@ GHOST_WindowX11( m_post_init = False; m_post_state = GHOST_kWindowStateNormal; } - - // Create some hints for the window manager on how - // we want this window treated. + + /* Create some hints for the window manager on how + * we want this window treated. */ XSizeHints *xsizehints = XAllocSizeHints(); xsizehints->flags = PPosition | PSize | PMinSize | PMaxSize; @@ -363,8 +363,8 @@ GHOST_WindowX11( xsizehints->y = top; xsizehints->width = width; xsizehints->height = height; - xsizehints->min_width = 320; // size hints, could be made apart of the ghost api - xsizehints->min_height = 240; // limits are also arbitrary, but should not allow 1x1 window + xsizehints->min_width = 320; /* size hints, could be made apart of the ghost api */ + xsizehints->min_height = 240; /* limits are also arbitrary, but should not allow 1x1 window */ xsizehints->max_width = 65535; xsizehints->max_height = 65535; XSetWMNormalHints(m_display, m_window, xsizehints); @@ -404,7 +404,7 @@ GHOST_WindowX11( m_xic = NULL; #endif - // Set the window icon + /* Set the window icon */ XWMHints *xwmhints = XAllocWMHints(); XImage *x_image, *mask_image; Pixmap icon_pixmap, mask_pixmap; @@ -442,7 +442,7 @@ GHOST_WindowX11( XPutImage(display, icon_pixmap, gc_icon, x_image, 0, 0, 0, 0, BLENDER_ICON_WIDTH, BLENDER_ICON_HEIGHT); XPutImage(display, mask_pixmap, gc_mask, mask_image, 0, 0, 0, 0, BLENDER_ICON_WIDTH, BLENDER_ICON_HEIGHT); - // Now the pixmap is ok to assign to the window as a hint + /* Now the pixmap is ok to assign to the window as a hint */ xwmhints->icon_pixmap = icon_pixmap; xwmhints->icon_mask = mask_pixmap; XFreeGC(display, gc_icon); @@ -455,7 +455,7 @@ GHOST_WindowX11( xwmhints->flags = InputHint | IconPixmapHint | IconMaskHint | StateHint; XSetWMHints(display, m_window, xwmhints); XFree(xwmhints); - // done setting the icon + /* done setting the icon */ setTitle(title); @@ -463,7 +463,7 @@ GHOST_WindowX11( initXInputDevices(); #endif - // now set up the rendering context. + /* now set up the rendering context. */ if (installDrawingContext(type) == GHOST_kSuccess) { m_valid_setup = true; GHOST_PRINT("Created window\n"); @@ -748,8 +748,8 @@ setTitle( (const unsigned char *) title.ReadPtr(), title.Length()); -// This should convert to valid x11 string -// and getTitle would need matching change + /* This should convert to valid x11 string + * and getTitle would need matching change */ XStoreName(m_display, m_window, title); XFlush(m_display); @@ -772,8 +772,8 @@ GHOST_WindowX11:: getWindowBounds( GHOST_Rect& bounds) const { - // Getting the window bounds under X11 is not - // really supported (nor should it be desired). + /* Getting the window bounds under X11 is not + * really supported (nor should it be desired). */ getClientBounds(bounds); } @@ -848,7 +848,7 @@ screenToClient( GHOST_TInt32& outX, GHOST_TInt32& outY) const { - // This is correct! + /* This is correct! */ int ax, ay; Window temp; @@ -1274,18 +1274,18 @@ GHOST_TSuccess GHOST_WindowX11:: invalidate() { - // So the idea of this function is to generate an expose event - // for the window. - // Unfortunately X does not handle expose events for you and - // it is the client's job to refresh the dirty part of the window. - // We need to queue up invalidate calls and generate GHOST events - // for them in the system. - - // We implement this by setting a boolean in this class to concatenate - // all such calls into a single event for this window. - - // At the same time we queue the dirty windows in the system class - // and generate events for them at the next processEvents call. + /* So the idea of this function is to generate an expose event + * for the window. + * Unfortunately X does not handle expose events for you and + * it is the client's job to refresh the dirty part of the window. + * We need to queue up invalidate calls and generate GHOST events + * for them in the system. + * + * We implement this by setting a boolean in this class to concatenate + * all such calls into a single event for this window. + * + * At the same time we queue the dirty windows in the system class + * and generate events for them at the next processEvents call. */ if (m_invalid_window == false) { m_system->addDirtyWindow(this); @@ -1384,7 +1384,7 @@ GHOST_WindowX11:: installDrawingContext( GHOST_TDrawingContextType type) { - // only support openGL for now. + /* only support openGL for now. */ GHOST_TSuccess success; switch (type) { case GHOST_kDrawingContextTypeOpenGL: diff --git a/source/blender/blenkernel/intern/collision.c b/source/blender/blenkernel/intern/collision.c index 516de35fab3..af9bb971d05 100644 --- a/source/blender/blenkernel/intern/collision.c +++ b/source/blender/blenkernel/intern/collision.c @@ -414,8 +414,9 @@ static CollPair* cloth_collision(ModifierData *md1, ModifierData *md2, collpair->bp2 = face2->v2; collpair->bp3 = face2->v3; } - else + else { i++; + } } if ( i == 2 ) { if ( face2->v4 ) { @@ -429,8 +430,9 @@ static CollPair* cloth_collision(ModifierData *md1, ModifierData *md2, collpair->bp2 = face2->v4; collpair->bp3 = face2->v3; } - else + else { break; + } } else if ( i == 3 ) { if ( face1->v4 && face2->v4 ) { @@ -444,8 +446,9 @@ static CollPair* cloth_collision(ModifierData *md1, ModifierData *md2, collpair->bp2 = face2->v3; collpair->bp3 = face2->v4; } - else + else { break; + } } #ifdef USE_BULLET @@ -464,8 +467,7 @@ static CollPair* cloth_collision(ModifierData *md1, ModifierData *md2, collpair->flag = 0; collpair++; }/* - else - { + else { float w1, w2, w3, u1, u2, u3; float v1[3], v2[3], relativeVelocity[3]; diff --git a/source/blender/blenkernel/intern/mask.c b/source/blender/blenkernel/intern/mask.c index f13c27cb436..6fe838666c5 100644 --- a/source/blender/blenkernel/intern/mask.c +++ b/source/blender/blenkernel/intern/mask.c @@ -110,7 +110,7 @@ static BezTriple *mask_spline_point_prev_bezt(MaskSpline *spline, MaskSplinePoin if (spline->flag & MASK_SPLINE_CYCLIC) { return &(points_array[0].bezt); } - else { + else { return NULL; } } @@ -2610,7 +2610,7 @@ void BKE_mask_rasterize_layers(ListBase *masklayers, int width, int height, floa } } - if(do_mask_aa){ + if (do_mask_aa) { //PLX_antialias_buffer(buffer,width,height); } /* clamp at the end */ @@ -2620,7 +2620,8 @@ void BKE_mask_rasterize_layers(ListBase *masklayers, int width, int height, floa } #ifdef __PLX_RASKTER_MT__ -void BKE_mask_init_layers(Mask *mask, struct layer_init_data *mlayer_data, int width, int height, const short do_aspect_correct){ +void BKE_mask_init_layers(Mask *mask, struct layer_init_data *mlayer_data, int width, int height, const short do_aspect_correct) +{ MaskLayer *masklay; int numLayers=0; int currLayer=0; diff --git a/source/blender/collada/AnimationImporter.cpp b/source/blender/collada/AnimationImporter.cpp index 4182a9c4c93..9c11358ce7f 100644 --- a/source/blender/collada/AnimationImporter.cpp +++ b/source/blender/collada/AnimationImporter.cpp @@ -916,7 +916,7 @@ void AnimationImporter::translate_Animations(COLLADAFW::Node *node, } } - if ( (animType->camera) != 0) { + if (animType->camera != 0) { Camera *camera = (Camera *) ob->data; if (!camera->adt || !camera->adt->action) act = verify_adt_action((ID *)&camera->id, 1); diff --git a/source/blender/collada/GeometryExporter.cpp b/source/blender/collada/GeometryExporter.cpp index c3d1106b288..d30f9b86a5a 100644 --- a/source/blender/collada/GeometryExporter.cpp +++ b/source/blender/collada/GeometryExporter.cpp @@ -135,7 +135,7 @@ void GeometryExporter::operator()(Object *ob) // XXX slow if (ob->totcol) { - for (int a = 0; a < ob->totcol; a++) { + for (int a = 0; a < ob->totcol; a++) { createPolylist(a, has_uvs, has_color, ob, me, geom_id, norind); } } diff --git a/source/blender/compositor/intern/COM_MemoryBuffer.h b/source/blender/compositor/intern/COM_MemoryBuffer.h index 5077a9e3228..9abbfb163e2 100644 --- a/source/blender/compositor/intern/COM_MemoryBuffer.h +++ b/source/blender/compositor/intern/COM_MemoryBuffer.h @@ -122,11 +122,13 @@ public: /** * @brief after execution the state will be set to available by calling this method */ - void setCreatedState() { + void setCreatedState() + { this->m_state = COM_MB_AVAILABLE; } - inline void read(float result[4], int x, int y) { + inline void read(float result[4], int x, int y) + { if (x >= this->m_rect.xmin && x < this->m_rect.xmax && y >= this->m_rect.ymin && y < this->m_rect.ymax) { @@ -140,7 +142,8 @@ public: } } - inline void readNoCheck(float result[4], int x, int y) { + inline void readNoCheck(float result[4], int x, int y) + { const int dx = x - this->m_rect.xmin; const int dy = y - this->m_rect.ymin; const int offset = (this->m_chunkWidth * dy + dx) * COM_NUMBER_OF_CHANNELS; @@ -150,42 +153,42 @@ public: void writePixel(int x, int y, const float color[4]); void addPixel(int x, int y, const float color[4]); inline void readCubic(float result[4], float x, float y) - { - int x1 = floor(x); - int x2 = x1 + 1; - int y1 = floor(y); - int y2 = y1 + 1; - - float valuex = x - x1; - float valuey = y - y1; - float mvaluex = 1.0f - valuex; - float mvaluey = 1.0f - valuey; - - float color1[4]; - float color2[4]; - float color3[4]; - float color4[4]; - - read(color1, x1, y1); - read(color2, x1, y2); - read(color3, x2, y1); - read(color4, x2, y2); - - color1[0] = color1[0] * mvaluey + color2[0] * valuey; - color1[1] = color1[1] * mvaluey + color2[1] * valuey; - color1[2] = color1[2] * mvaluey + color2[2] * valuey; - color1[3] = color1[3] * mvaluey + color2[3] * valuey; - - color3[0] = color3[0] * mvaluey + color4[0] * valuey; - color3[1] = color3[1] * mvaluey + color4[1] * valuey; - color3[2] = color3[2] * mvaluey + color4[2] * valuey; - color3[3] = color3[3] * mvaluey + color4[3] * valuey; - - result[0] = color1[0] * mvaluex + color3[0] * valuex; - result[1] = color1[1] * mvaluex + color3[1] * valuex; - result[2] = color1[2] * mvaluex + color3[2] * valuex; - result[3] = color1[3] * mvaluex + color3[3] * valuex; - } + { + int x1 = floor(x); + int x2 = x1 + 1; + int y1 = floor(y); + int y2 = y1 + 1; + + float valuex = x - x1; + float valuey = y - y1; + float mvaluex = 1.0f - valuex; + float mvaluey = 1.0f - valuey; + + float color1[4]; + float color2[4]; + float color3[4]; + float color4[4]; + + read(color1, x1, y1); + read(color2, x1, y2); + read(color3, x2, y1); + read(color4, x2, y2); + + color1[0] = color1[0] * mvaluey + color2[0] * valuey; + color1[1] = color1[1] * mvaluey + color2[1] * valuey; + color1[2] = color1[2] * mvaluey + color2[2] * valuey; + color1[3] = color1[3] * mvaluey + color2[3] * valuey; + + color3[0] = color3[0] * mvaluey + color4[0] * valuey; + color3[1] = color3[1] * mvaluey + color4[1] * valuey; + color3[2] = color3[2] * mvaluey + color4[2] * valuey; + color3[3] = color3[3] * mvaluey + color4[3] * valuey; + + result[0] = color1[0] * mvaluex + color3[0] * valuex; + result[1] = color1[1] * mvaluex + color3[1] * valuex; + result[2] = color1[2] * mvaluex + color3[2] * valuex; + result[3] = color1[3] * mvaluex + color3[3] * valuex; + } diff --git a/source/blender/compositor/intern/COM_OpenCLDevice.h b/source/blender/compositor/intern/COM_OpenCLDevice.h index 577df5caf77..f1a1e31c930 100644 --- a/source/blender/compositor/intern/COM_OpenCLDevice.h +++ b/source/blender/compositor/intern/COM_OpenCLDevice.h @@ -92,9 +92,9 @@ public: */ void execute(WorkPackage *work); - cl_context getContext(){ return this->m_context; } + cl_context getContext() { return this->m_context; } - cl_command_queue getQueue(){ return this->m_queue; } + cl_command_queue getQueue() { return this->m_queue; } cl_mem COM_clAttachMemoryBufferToKernelParameter(cl_kernel kernel, int parameterIndex, int offsetIndex, list<cl_mem> *cleanup, MemoryBuffer **inputMemoryBuffers, SocketReader *reader); cl_mem COM_clAttachMemoryBufferToKernelParameter(cl_kernel kernel, int parameterIndex, int offsetIndex, list<cl_mem> *cleanup, MemoryBuffer **inputMemoryBuffers, ReadBufferOperation *reader); diff --git a/source/blender/compositor/operations/COM_BokehBlurOperation.cpp b/source/blender/compositor/operations/COM_BokehBlurOperation.cpp index ff9bfb73396..ef28d55dbc8 100644 --- a/source/blender/compositor/operations/COM_BokehBlurOperation.cpp +++ b/source/blender/compositor/operations/COM_BokehBlurOperation.cpp @@ -94,7 +94,7 @@ void BokehBlurOperation::executePixel(float *color, int x, int y, void *data) int bufferstartx = inputBuffer->getRect()->xmin; int bufferstarty = inputBuffer->getRect()->ymin; int pixelSize = this->m_size * this->getWidth() / 100.0f; - if (pixelSize==0){ + if (pixelSize==0) { this->m_inputProgram->read(color, x, y, COM_PS_NEAREST); return; } diff --git a/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp b/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp index 8e2ff06a55c..cef068ccbaa 100644 --- a/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp +++ b/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp @@ -520,7 +520,7 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c PyObject *gameLogic_keys_new = PyDict_Keys(PyModule_GetDict(gameLogic)); const Py_ssize_t numitems= PyList_GET_SIZE(gameLogic_keys_new); Py_ssize_t listIndex; - for (listIndex=0; listIndex < numitems; listIndex++) { + for (listIndex=0; listIndex < numitems; listIndex++) { PyObject* item = PyList_GET_ITEM(gameLogic_keys_new, listIndex); if (!PySequence_Contains(gameLogic_keys, item)) { PyDict_DelItem( PyModule_GetDict(gameLogic), item); diff --git a/source/gameengine/Converter/BL_MeshDeformer.h b/source/gameengine/Converter/BL_MeshDeformer.h index c73e4efd245..c84d31c72cd 100644 --- a/source/gameengine/Converter/BL_MeshDeformer.h +++ b/source/gameengine/Converter/BL_MeshDeformer.h @@ -63,16 +63,16 @@ public: m_lastDeformUpdate(-1) {}; virtual ~BL_MeshDeformer(); - virtual void SetSimulatedTime(double time){} + virtual void SetSimulatedTime(double time) {} virtual bool Apply(class RAS_IPolyMaterial *mat); - virtual bool Update(void){ return false; } - virtual bool UpdateBuckets(void){ return false; } - virtual RAS_Deformer* GetReplica(){return NULL;} + virtual bool Update(void) { return false; } + virtual bool UpdateBuckets(void) { return false; } + virtual RAS_Deformer* GetReplica() {return NULL;} virtual void ProcessReplica(); struct Mesh* GetMesh() { return m_bmesh; } virtual class RAS_MeshObject* GetRasMesh() { return (RAS_MeshObject*)m_pMeshObject; } virtual float (* GetTransVerts(int *tot))[3] { *tot= m_tvtot; return m_transverts; } - // virtual void InitDeform(double time){} + // virtual void InitDeform(double time) {} protected: class RAS_MeshObject* m_pMeshObject; diff --git a/source/gameengine/Expressions/ListValue.h b/source/gameengine/Expressions/ListValue.h index 83f8232ca5e..4d104a4bd3a 100644 --- a/source/gameengine/Expressions/ListValue.h +++ b/source/gameengine/Expressions/ListValue.h @@ -57,7 +57,7 @@ public: void Remove(int i); void Resize(int num); void SetValue(int i,CValue* val); - CValue* GetValue(int i){ assertd(i < m_pValueArray.size()); return m_pValueArray[i];} + CValue* GetValue(int i) { assertd(i < m_pValueArray.size()); return m_pValueArray[i]; } int GetCount() { return m_pValueArray.size(); } virtual const STR_String & GetText(); diff --git a/source/gameengine/Expressions/VoidValue.h b/source/gameengine/Expressions/VoidValue.h index 5599b226a60..a1a82f8aa65 100644 --- a/source/gameengine/Expressions/VoidValue.h +++ b/source/gameengine/Expressions/VoidValue.h @@ -45,12 +45,19 @@ class CVoidValue : public CPropValue public: /// Construction/destruction - CVoidValue() : m_bDeleteOnDestruct(false), m_pAnything(NULL) { } - CVoidValue(void * voidptr, bool bDeleteOnDestruct, AllocationTYPE alloctype) : m_bDeleteOnDestruct(bDeleteOnDestruct), m_pAnything(voidptr) { if (alloctype == STACKVALUE) CValue::DisableRefCount(); } - virtual ~CVoidValue(); // Destruct void value, delete memory if we're owning it + CVoidValue() : m_bDeleteOnDestruct(false), m_pAnything(NULL) { } + CVoidValue(void * voidptr, bool bDeleteOnDestruct, AllocationTYPE alloctype) : + m_bDeleteOnDestruct(bDeleteOnDestruct), + m_pAnything(voidptr) + { + if (alloctype == STACKVALUE) { + CValue::DisableRefCount(); + } + } + virtual ~CVoidValue(); /* Destruct void value, delete memory if we're owning it */ /// Value -> String or number - virtual const STR_String & GetText(); // Get string description of void value (unimplemented) + virtual const STR_String & GetText(); /* Get string description of void value (unimplemented) */ virtual double GetNumber() { return -1; } /// Value calculation @@ -70,5 +77,5 @@ public: #endif }; -#endif // !defined _VOIDVALUE_H +#endif /* __VOIDVALUE_H__ */ diff --git a/source/gameengine/GameLogic/SCA_IObject.cpp b/source/gameengine/GameLogic/SCA_IObject.cpp index 5077ecaf816..b90952b2092 100644 --- a/source/gameengine/GameLogic/SCA_IObject.cpp +++ b/source/gameengine/GameLogic/SCA_IObject.cpp @@ -251,7 +251,7 @@ SCA_IActuator* SCA_IObject::FindActuator(const STR_String& actuatorname) void SCA_IObject::Suspend() { if ((!m_ignore_activity_culling) - && (!m_suspended)) { + && (!m_suspended)) { m_suspended = true; /* flag suspend for all sensors */ SCA_SensorList::iterator i = m_sensors.begin(); diff --git a/source/gameengine/GamePlayer/common/GPC_Canvas.h b/source/gameengine/GamePlayer/common/GPC_Canvas.h index 0e26c5ad729..25a50fbcac3 100644 --- a/source/gameengine/GamePlayer/common/GPC_Canvas.h +++ b/source/gameengine/GamePlayer/common/GPC_Canvas.h @@ -103,7 +103,7 @@ public: void Resize(int width, int height); - virtual void ResizeWindow(int width, int height){}; + virtual void ResizeWindow(int width, int height) {} /** * \section Methods inherited from abstract base class RAS_ICanvas. diff --git a/source/gameengine/Ketsji/KX_BlenderMaterial.cpp b/source/gameengine/Ketsji/KX_BlenderMaterial.cpp index 014c68e8bee..b28b8c86d33 100644 --- a/source/gameengine/Ketsji/KX_BlenderMaterial.cpp +++ b/source/gameengine/Ketsji/KX_BlenderMaterial.cpp @@ -884,7 +884,7 @@ KX_PYMETHODDEF_DOC( KX_BlenderMaterial, getShader , "getShader()") Py_RETURN_NONE; } - if (!GLEW_ARB_shader_objects) { + if (!GLEW_ARB_shader_objects) { if (!mModified) spit("GLSL not supported"); mModified = true; diff --git a/source/gameengine/Ketsji/KX_GameObject.cpp b/source/gameengine/Ketsji/KX_GameObject.cpp index b005684a6db..496b3925456 100644 --- a/source/gameengine/Ketsji/KX_GameObject.cpp +++ b/source/gameengine/Ketsji/KX_GameObject.cpp @@ -1291,8 +1291,7 @@ void KX_GameObject::Resume(void) void KX_GameObject::Suspend() { - if ((!m_ignore_activity_culling) - && (!m_suspended)) { + if ((!m_ignore_activity_culling) && (!m_suspended)) { SCA_IObject::Suspend(); if (GetPhysicsController()) GetPhysicsController()->SuspendDynamics(); diff --git a/source/gameengine/Ketsji/KX_PyMath.h b/source/gameengine/Ketsji/KX_PyMath.h index 8924567acde..aec871d7700 100644 --- a/source/gameengine/Ketsji/KX_PyMath.h +++ b/source/gameengine/Ketsji/KX_PyMath.h @@ -138,9 +138,9 @@ bool PyVecTo(PyObject* pyval, T& vec) #ifdef USE_MATHUTILS /* no need for BaseMath_ReadCallback() here, reading the sequences will do this */ - if(VectorObject_Check(pyval)) { + if (VectorObject_Check(pyval)) { VectorObject *pyvec= (VectorObject *)pyval; - if(BaseMath_ReadCallback(pyvec) == -1) { + if (BaseMath_ReadCallback(pyvec) == -1) { return false; /* exception raised */ } if (pyvec->size != Size(vec)) { @@ -150,9 +150,9 @@ bool PyVecTo(PyObject* pyval, T& vec) vec.setValue((float *) pyvec->vec); return true; } - else if(QuaternionObject_Check(pyval)) { + else if (QuaternionObject_Check(pyval)) { QuaternionObject *pyquat= (QuaternionObject *)pyval; - if(BaseMath_ReadCallback(pyquat) == -1) { + if (BaseMath_ReadCallback(pyquat) == -1) { return false; /* exception raised */ } if (4 != Size(vec)) { @@ -163,9 +163,9 @@ bool PyVecTo(PyObject* pyval, T& vec) vec.setValue((float *) pyquat->quat); return true; } - else if(EulerObject_Check(pyval)) { + else if (EulerObject_Check(pyval)) { EulerObject *pyeul= (EulerObject *)pyval; - if(BaseMath_ReadCallback(pyeul) == -1) { + if (BaseMath_ReadCallback(pyeul) == -1) { return false; /* exception raised */ } if (3 != Size(vec)) { @@ -174,10 +174,10 @@ bool PyVecTo(PyObject* pyval, T& vec) } vec.setValue((float *) pyeul->eul); return true; - } else + } + else #endif - if(PyTuple_Check(pyval)) - { + if (PyTuple_Check(pyval)) { unsigned int numitems = PyTuple_GET_SIZE(pyval); if (numitems != Size(vec)) { PyErr_Format(PyExc_AttributeError, "error setting vector, %d args, should be %d", numitems, Size(vec)); @@ -194,8 +194,8 @@ bool PyVecTo(PyObject* pyval, T& vec) return true; } - else if (PyObject_TypeCheck(pyval, (PyTypeObject *)&PyObjectPlus::Type)) - { /* note, include this check because PySequence_Check does too much introspection + else if (PyObject_TypeCheck(pyval, (PyTypeObject *)&PyObjectPlus::Type)) { + /* note, include this check because PySequence_Check does too much introspection * on the PyObject (like getting its __class__, on a BGE type this means searching up * the parent list each time only to discover its not a sequence. * GameObjects are often used as an alternative to vectors so this is a common case @@ -207,16 +207,14 @@ bool PyVecTo(PyObject* pyval, T& vec) PyErr_Format(PyExc_AttributeError, "expected a sequence type"); return false; } - else if (PySequence_Check(pyval)) - { + else if (PySequence_Check(pyval)) { unsigned int numitems = PySequence_Size(pyval); if (numitems != Size(vec)) { PyErr_Format(PyExc_AttributeError, "error setting vector, %d args, should be %d", numitems, Size(vec)); return false; } - for (unsigned int x = 0; x < numitems; x++) - { + for (unsigned int x = 0; x < numitems; x++) { PyObject *item = PySequence_GetItem(pyval, x); /* new ref */ vec[x] = PyFloat_AsDouble(item); Py_DECREF(item); @@ -228,8 +226,8 @@ bool PyVecTo(PyObject* pyval, T& vec) } return true; - } else - { + } + else { PyErr_Format(PyExc_AttributeError, "not a sequence type, expected a sequence of numbers size %d", Size(vec)); } diff --git a/source/gameengine/Ketsji/KX_WorldInfo.h b/source/gameengine/Ketsji/KX_WorldInfo.h index e4a73873fa1..5b35ca2ec54 100644 --- a/source/gameengine/Ketsji/KX_WorldInfo.h +++ b/source/gameengine/Ketsji/KX_WorldInfo.h @@ -43,7 +43,7 @@ class MT_CmMatrix4x4; class KX_WorldInfo { public: - KX_WorldInfo(){} + KX_WorldInfo() {} virtual ~KX_WorldInfo(); virtual bool hasWorld()=0; diff --git a/source/gameengine/Physics/common/PHY_IPhysicsEnvironment.h b/source/gameengine/Physics/common/PHY_IPhysicsEnvironment.h index 8fde9e289dc..30d63e6695d 100644 --- a/source/gameengine/Physics/common/PHY_IPhysicsEnvironment.h +++ b/source/gameengine/Physics/common/PHY_IPhysicsEnvironment.h @@ -107,7 +107,7 @@ class PHY_IPhysicsEnvironment /// Perform an integration step of duration 'timeStep'. virtual bool proceedDeltaTime(double curTime,float timeStep,float interval)=0; ///draw debug lines (make sure to call this during the render phase, otherwise lines are not drawn properly) - virtual void debugDrawWorld(){} + virtual void debugDrawWorld() {} virtual void setFixedTimeStep(bool useFixedTimeStep,float fixedTimeStep)=0; //returns 0.f if no fixed timestep is used virtual float getFixedTimeStep()=0; @@ -117,7 +117,7 @@ class PHY_IPhysicsEnvironment ///setNumIterations set the number of iterations for iterative solvers virtual void setNumIterations(int numIter) {} ///setNumTimeSubSteps set the number of divisions of the timestep. Tradeoff quality versus performance. - virtual void setNumTimeSubSteps(int numTimeSubSteps){} + virtual void setNumTimeSubSteps(int numTimeSubSteps) {} ///setDeactivationTime sets the minimum time that an objects has to stay within the velocity tresholds until it gets fully deactivated virtual void setDeactivationTime(float dTime) {} ///setDeactivationLinearTreshold sets the linear velocity treshold, see setDeactivationTime @@ -150,7 +150,7 @@ class PHY_IPhysicsEnvironment float axis2X=0,float axis2Y=0,float axis2Z=0,int flag=0 )=0; virtual void removeConstraint(int constraintid)=0; - virtual float getAppliedImpulse(int constraintid){ return 0.f;} + virtual float getAppliedImpulse(int constraintid) { return 0.0f; } //complex constraint for vehicles diff --git a/source/gameengine/Rasterizer/RAS_Deformer.h b/source/gameengine/Rasterizer/RAS_Deformer.h index 627db2b63fb..51c4da3c49d 100644 --- a/source/gameengine/Rasterizer/RAS_Deformer.h +++ b/source/gameengine/Rasterizer/RAS_Deformer.h @@ -49,8 +49,8 @@ class RAS_MeshObject; class RAS_Deformer { public: - RAS_Deformer() : m_pMesh(NULL), m_bDynamic(false) {}; - virtual ~RAS_Deformer(){}; + RAS_Deformer() : m_pMesh(NULL), m_bDynamic(false) {} + virtual ~RAS_Deformer() {} virtual void Relink(CTR_Map<class CTR_HashedPtr, void*>*map)=0; virtual bool Apply(class RAS_IPolyMaterial *polymat)=0; virtual bool Update(void)=0; diff --git a/source/gameengine/Rasterizer/RAS_IPolygonMaterial.h b/source/gameengine/Rasterizer/RAS_IPolygonMaterial.h index 0f89af490d8..169bc6e4ee6 100644 --- a/source/gameengine/Rasterizer/RAS_IPolygonMaterial.h +++ b/source/gameengine/Rasterizer/RAS_IPolygonMaterial.h @@ -174,7 +174,7 @@ public: virtual bool UsesObjectColor() const; virtual bool CastsShadows() const; - virtual void Replace_IScene(SCA_IScene *val) {}; /* overridden by KX_BlenderMaterial */ + virtual void Replace_IScene(SCA_IScene *val) {} /* overridden by KX_BlenderMaterial */ /** * \return the equivalent drawing mode for the material settings (equivalent to old TexFace tface->mode). @@ -184,7 +184,7 @@ public: /* * PreCalculate texture gen */ - virtual void OnConstruction(int layer){} + virtual void OnConstruction(int layer) {} #ifdef WITH_CXX_GUARDEDALLOC diff --git a/source/gameengine/Rasterizer/RAS_IRasterizer.h b/source/gameengine/Rasterizer/RAS_IRasterizer.h index d4c19410eb1..7749c4af9d6 100644 --- a/source/gameengine/Rasterizer/RAS_IRasterizer.h +++ b/source/gameengine/Rasterizer/RAS_IRasterizer.h @@ -64,8 +64,8 @@ typedef vector< KX_IndexArray* > vecIndexArrays; class RAS_IRasterizer { public: - RAS_IRasterizer(RAS_ICanvas* canv){}; - virtual ~RAS_IRasterizer(){}; + RAS_IRasterizer(RAS_ICanvas* canv) {}; + virtual ~RAS_IRasterizer() {}; /** * Drawing types @@ -401,8 +401,8 @@ public: virtual const MT_Matrix4x4& GetViewMatrix() const = 0; virtual const MT_Matrix4x4& GetViewInvMatrix() const = 0; - virtual bool QueryLists(){return false;} - virtual bool QueryArrays(){return false;} + virtual bool QueryLists() { return false; } + virtual bool QueryArrays() { return false; } virtual void EnableMotionBlur(float motionblurvalue)=0; virtual void DisableMotionBlur()=0; diff --git a/source/gameengine/Rasterizer/RAS_MaterialBucket.h b/source/gameengine/Rasterizer/RAS_MaterialBucket.h index 7cf7fee7845..295f2510313 100644 --- a/source/gameengine/Rasterizer/RAS_MaterialBucket.h +++ b/source/gameengine/Rasterizer/RAS_MaterialBucket.h @@ -54,7 +54,7 @@ class KX_ListSlot protected: int m_refcount; public: - KX_ListSlot(){ m_refcount=1; } + KX_ListSlot() { m_refcount = 1; } virtual ~KX_ListSlot() {} virtual int Release() { if (--m_refcount > 0) diff --git a/source/gameengine/Rasterizer/RAS_MeshObject.h b/source/gameengine/Rasterizer/RAS_MeshObject.h index 326110bea57..eb8655c8b1f 100644 --- a/source/gameengine/Rasterizer/RAS_MeshObject.h +++ b/source/gameengine/Rasterizer/RAS_MeshObject.h @@ -106,7 +106,7 @@ public: /* modification state */ bool MeshModified(); - void SetMeshModified(bool v){m_bMeshModified = v;} + void SetMeshModified(bool v) { m_bMeshModified = v; } /* original blender mesh */ Mesh* GetMesh() { return m_mesh; } diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_ListRasterizer.h b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_ListRasterizer.h index 808c4f11dd8..a8eb2d5ffdf 100644 --- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_ListRasterizer.h +++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_ListRasterizer.h @@ -72,7 +72,7 @@ public: virtual void SetDrawingMode(int drawingmode); - virtual bool QueryLists(){return true;} + virtual bool QueryLists() {return true;} #ifdef WITH_CXX_GUARDEDALLOC diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp index 7db433b5b4f..76d1a64a4c0 100644 --- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp +++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp @@ -533,10 +533,10 @@ void RAS_OpenGLRasterizer::SetEye(const StereoEye eye) glDrawBuffer(m_curreye == RAS_STEREO_LEFTEYE ? GL_BACK_LEFT : GL_BACK_RIGHT); break; case RAS_STEREO_ANAGLYPH: - if (m_curreye == RAS_STEREO_LEFTEYE) - { + if (m_curreye == RAS_STEREO_LEFTEYE) { glColorMask(GL_FALSE, GL_TRUE, GL_TRUE, GL_FALSE); - } else { + } + else { //glAccum(GL_LOAD, 1.0); glColorMask(GL_TRUE, GL_FALSE, GL_FALSE, GL_FALSE); ClearDepthBuffer(); @@ -892,7 +892,8 @@ void RAS_OpenGLRasterizer::IndexPrimitivesInternal(RAS_MeshSlot& ms, bool multi) int current_blend_mode = GPU_get_material_alpha_blend(); ms.m_pDerivedMesh->drawFacesGLSL(ms.m_pDerivedMesh, CheckMaterialDM); GPU_set_material_alpha_blend(current_blend_mode); - } else { + } + else { //ms.m_pDerivedMesh->drawMappedFacesTex(ms.m_pDerivedMesh, CheckTexfaceDM, mcol); current_blmat_nr = current_polymat->GetMaterialIndex(); current_image = current_polymat->GetBlenderImage(); diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.h b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.h index 36f768f6474..e5eba249175 100644 --- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.h +++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.h @@ -302,9 +302,9 @@ public: virtual int GetMotionBlurState() { return m_motionblur; } virtual void SetMotionBlurState(int newstate) { - if(newstate<0) + if (newstate < 0) m_motionblur = 0; - else if(newstate>2) + else if (newstate > 2) m_motionblur = 2; else m_motionblur = newstate; diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_VAOpenGLRasterizer.h b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_VAOpenGLRasterizer.h index deda1c4603a..e881192171f 100644 --- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_VAOpenGLRasterizer.h +++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_VAOpenGLRasterizer.h @@ -58,8 +58,8 @@ public: private: virtual void EnableTextures(bool enable); - //virtual bool QueryArrays(){return true;} - //virtual bool QueryLists(){return m_Lock;} + //virtual bool QueryArrays() {return true;} + //virtual bool QueryLists() {return m_Lock;} #ifdef WITH_CXX_GUARDEDALLOC diff --git a/source/gameengine/SceneGraph/SG_BBox.cpp b/source/gameengine/SceneGraph/SG_BBox.cpp index 4b2fc5410fa..3911babd2b5 100644 --- a/source/gameengine/SceneGraph/SG_BBox.cpp +++ b/source/gameengine/SceneGraph/SG_BBox.cpp @@ -217,7 +217,8 @@ void SG_BBox::split(SG_BBox &left, SG_BBox &right) const right.m_min[2] = m_min[2]; right.m_max = m_max; std::cout << "splity" << std::endl; - } else { + } + else { left.m_min = m_min; left.m_max[0] = m_max[0]; left.m_max[1] = m_max[1]; @@ -229,9 +230,9 @@ void SG_BBox::split(SG_BBox &left, SG_BBox &right) const right.m_max = m_max; std::cout << "splitz" << std::endl; } - } else { - if (sizex > sizez) - { + } + else { + if (sizex > sizez) { left.m_min = m_min; left.m_max[0] = m_min[0] + sizex/2.0; left.m_max[1] = m_max[1]; @@ -242,7 +243,8 @@ void SG_BBox::split(SG_BBox &left, SG_BBox &right) const right.m_min[2] = m_min[2]; right.m_max = m_max; std::cout << "splitx" << std::endl; - } else { + } + else { left.m_min = m_min; left.m_max[0] = m_max[0]; left.m_max[1] = m_max[1]; diff --git a/source/gameengine/SceneGraph/SG_Spatial.cpp b/source/gameengine/SceneGraph/SG_Spatial.cpp index e026419ca67..f8c4b5165ee 100644 --- a/source/gameengine/SceneGraph/SG_Spatial.cpp +++ b/source/gameengine/SceneGraph/SG_Spatial.cpp @@ -151,10 +151,12 @@ RelativeTranslate( ) { if (local) { m_localPosition += m_localRotation * trans; - } else { + } + else { if (parent) { m_localPosition += trans * parent->GetWorldOrientation(); - } else { + } + else { m_localPosition += trans; } } diff --git a/source/gameengine/SceneGraph/SG_Tree.cpp b/source/gameengine/SceneGraph/SG_Tree.cpp index 738c0fdef22..0f8264985de 100644 --- a/source/gameengine/SceneGraph/SG_Tree.cpp +++ b/source/gameengine/SceneGraph/SG_Tree.cpp @@ -296,7 +296,8 @@ SG_Tree* SG_TreeFactory::MakeTreeDown(SG_BBox &bbox) { lefttree.Add(*it); hasleft++; - } else { + } + else { righttree.Add(*it); hasright++; } diff --git a/source/gameengine/VideoTexture/ImageBase.cpp b/source/gameengine/VideoTexture/ImageBase.cpp index 090b4f6ff4a..54c1939ce6b 100644 --- a/source/gameengine/VideoTexture/ImageBase.cpp +++ b/source/gameengine/VideoTexture/ImageBase.cpp @@ -246,7 +246,8 @@ bool ImageBase::checkSourceSizes (void) // set current size as reference refSize = curSize; // otherwise check with current size - } else if (curSize[0] != refSize[0] || curSize[1] != refSize[1]) { + } + else if (curSize[0] != refSize[0] || curSize[1] != refSize[1]) { // if they don't match, report it return false; } diff --git a/source/gameengine/VideoTexture/ImageRender.cpp b/source/gameengine/VideoTexture/ImageRender.cpp index 2cc2c6efa1e..9fdd0cd393b 100644 --- a/source/gameengine/VideoTexture/ImageRender.cpp +++ b/source/gameengine/VideoTexture/ImageRender.cpp @@ -208,11 +208,11 @@ void ImageRender::Render() frustrum.x1, frustrum.x2, frustrum.y1, frustrum.y2, frustrum.camnear, frustrum.camfar); m_camera->SetProjectionMatrix(projmat); - } else if (m_camera->hasValidProjectionMatrix()) - { + } + else if (m_camera->hasValidProjectionMatrix()) { m_rasterizer->SetProjectionMatrix(m_camera->GetProjectionMatrix()); - } else - { + } + else { float lens = m_camera->GetLens(); float sensor_x = m_camera->GetSensorWidth(); float sensor_y = m_camera->GetSensorHeight(); @@ -241,8 +241,8 @@ void ImageRender::Render() projmat = m_rasterizer->GetOrthoMatrix( frustrum.x1, frustrum.x2, frustrum.y1, frustrum.y2, frustrum.camnear, frustrum.camfar); - } else - { + } + else { RAS_FramingManager::ComputeDefaultFrustum( nearfrust, farfrust, @@ -604,13 +604,12 @@ ImageRender::ImageRender (KX_Scene * scene, KX_GameObject * observer, KX_GameObj mirrorVerts.push_back(v1); mirrorVerts.push_back(v2); mirrorVerts.push_back(v3); - if (polygon->VertexCount() == 4) - { + if (polygon->VertexCount() == 4) { v4 = polygon->GetVertex(3); mirrorVerts.push_back(v4); area = normal_quad_v3(normal,(float*)v1->getXYZ(), (float*)v2->getXYZ(), (float*)v3->getXYZ(), (float*)v4->getXYZ()); - } else - { + } + else { area = normal_tri_v3(normal,(float*)v1->getXYZ(), (float*)v2->getXYZ(), (float*)v3->getXYZ()); } area = fabs(area); diff --git a/source/gameengine/VideoTexture/Texture.cpp b/source/gameengine/VideoTexture/Texture.cpp index f08a5a4a0b3..a21300018eb 100644 --- a/source/gameengine/VideoTexture/Texture.cpp +++ b/source/gameengine/VideoTexture/Texture.cpp @@ -130,13 +130,12 @@ short getMaterialID(PyObject * obj, const char *name) if (mat == NULL) break; // name is a material name if it starts with MA and a UV texture name if it starts with IM - if (name[0] == 'I' && name[1] == 'M') - { + if (name[0] == 'I' && name[1] == 'M') { // if texture name matches if (strcmp(mat->GetTextureName().ReadPtr(), name) == 0) return matID; - } else - { + } + else { // if material name matches if (strcmp(mat->GetMaterialName().ReadPtr(), name) == 0) return matID; |