Merging r38343 through r38363 from trunk into soc-2011-tomato
authorSergey Sharybin <sergey.vfx@gmail.com>
Wed, 13 Jul 2011 16:53:54 +0000 (16:53 +0000)
committerSergey Sharybin <sergey.vfx@gmail.com>
Wed, 13 Jul 2011 16:53:54 +0000 (16:53 +0000)
28 files changed:
CMakeLists.txt
doc/python_api/examples/bge.texture.py
intern/ghost/CMakeLists.txt
intern/ghost/SConscript
intern/ghost/intern/GHOST_Debug.h
intern/ghost/intern/GHOST_DisplayManagerSDL.cpp
intern/ghost/intern/GHOST_DisplayManagerSDL.h
intern/ghost/intern/GHOST_EventPrinter.cpp
intern/ghost/intern/GHOST_EventPrinter.h
intern/ghost/intern/GHOST_ISystem.cpp
intern/ghost/intern/GHOST_NDOFManager.cpp
intern/ghost/intern/GHOST_SystemSDL.cpp
intern/ghost/intern/GHOST_SystemSDL.h
intern/ghost/intern/GHOST_SystemWin32.cpp
intern/ghost/intern/GHOST_SystemX11.cpp
intern/ghost/intern/GHOST_WindowSDL.cpp
intern/ghost/intern/GHOST_WindowSDL.h
release/scripts/modules/bpy_extras/mesh_utils.py
release/scripts/startup/bl_ui/space_node.py
source/blender/editors/CMakeLists.txt
source/blender/editors/datafiles/CMakeLists.txt
source/blender/editors/space_node/node_draw.c
source/blender/editors/space_node/node_edit.c
source/blender/editors/space_node/node_intern.h
source/blender/editors/space_node/node_ops.c
source/blender/editors/space_view3d/view3d_buttons.c
source/blender/nodes/intern/CMP_nodes/CMP_blur.c
source/blender/nodes/intern/CMP_util.c

index b6adf0bdab932c5bb7be59b5ec7e436acd8ba4ff..6f5466bed9e43450e012836e1381769ffb854442 100644 (file)
@@ -90,6 +90,9 @@ set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/lib CACHE INTERNAL "" FORCE )
 get_blender_version()
 
 # Blender internal features
+option(WITH_BLENDER "Build blender (disable to build only the blender player)" ON)
+mark_as_advanced(WITH_BLENDER)
+
 option(WITH_INTERNATIONAL "Enable I18N (International fonts and text)" ON)
 
 option(WITH_PYTHON        "Enable Embedded Python API  (only disable for development)" ON)
@@ -106,15 +109,21 @@ option(WITH_BULLET        "Enable Bullet (Physics Engine)" ON)
 option(WITH_GAMEENGINE    "Enable Game Engine" ON)
 option(WITH_PLAYER        "Build Player" OFF)
 
-option(WITH_AUDASPACE    "Build with blenders audio library" ON)
-mark_as_advanced(WITH_AUDASPACE)
+# GHOST Windowing Library Options
+option(WITH_GHOST_DEBUG   "Enable debugging output for the GHOST library" OFF)
+mark_as_advanced(WITH_GHOST_DEBUG)
 
-option(WITH_SDL_GHOST    "Enable building blender against SDL for windowing rather then the native APIs" OFF)
-mark_as_advanced(WITH_SDL_GHOST)
+option(WITH_GHOST_SDL    "Enable building blender against SDL for windowing rather then the native APIs" OFF)
+mark_as_advanced(WITH_GHOST_SDL)
 
+# Misc...
 option(WITH_HEADLESS      "Build without graphical support (renderfarm, server mode only)" OFF)
 mark_as_advanced(WITH_HEADLESS)
 
+option(WITH_AUDASPACE    "Build with blenders audio library (only disable if you know what you're doing!)" ON)
+mark_as_advanced(WITH_AUDASPACE)
+
+
 # (unix defaults to OpenMP On)
 if(UNIX AND NOT APPLE)
        option(WITH_OPENMP        "Enable OpenMP (has to be supported by the compiler)" ON)
@@ -207,6 +216,10 @@ endif()
 #-----------------------------------------------------------------------------
 # Check for conflicting/unsupported configurations
 
+if(NOT WITH_BLENDER AND NOT WITH_PLAYER)
+       message(FATAL_ERROR "At least one of WITH_BLENDER or WITH_PLAYER must be enabled, nothing to do!")
+endif()
+
 if(NOT WITH_GAMEENGINE AND WITH_PLAYER)
        message(FATAL_ERROR "WITH_PLAYER requires WITH_GAMEENGINE")
 endif()
@@ -215,8 +228,8 @@ if(NOT WITH_AUDASPACE AND (WITH_OPENAL OR WITH_SDL OR WITH_JACK))
        message(FATAL_ERROR "WITH_OPENAL/WITH_SDL/WITH_JACK/WITH_CODEC_FFMPEG require WITH_AUDASPACE")
 endif()
 
-if(NOT WITH_SDL AND WITH_SDL_GHOST)
-       message(FATAL_ERROR "WITH_SDL_GHOST requires WITH_SDL to be ON")
+if(NOT WITH_SDL AND WITH_GHOST_SDL)
+       message(FATAL_ERROR "WITH_GHOST_SDL requires WITH_SDL to be ON")
 endif()
 
 if(NOT WITH_IMAGE_OPENJPEG AND WITH_IMAGE_REDCODE)
@@ -443,7 +456,7 @@ if(UNIX AND NOT APPLE)
        # OpenSuse needs lutil, ArchLinux not, for now keep, can avoid by using --as-needed
        set(PLATFORM_LINKLIBS "-lutil -lc -lm -lpthread -lstdc++")
 
-       if((NOT WITH_HEADLESS) AND (NOT WITH_SDL_GHOST))
+       if((NOT WITH_HEADLESS) AND (NOT WITH_GHOST_SDL))
                find_package(X11 REQUIRED)
                find_path(X11_XF86keysym_INCLUDE_PATH X11/XF86keysym.h ${X11_INC_SEARCH_PATH})
                mark_as_advanced(X11_XF86keysym_INCLUDE_PATH)
@@ -1220,7 +1233,9 @@ add_subdirectory(extern)
 
 #-----------------------------------------------------------------------------
 # Blender Application
-add_subdirectory(source/creator)
+if(WITH_BLENDER)
+       add_subdirectory(source/creator)
+endif()
 
 
 #-----------------------------------------------------------------------------
index b27c357b1ee190b171330a1c5e136266272b16ec..0ec9aa16bca050ba5d4ff18beefe8cc72bcb023c 100644 (file)
@@ -29,4 +29,4 @@ if not hasattr(logic, 'video'):
     logic.video.source.play()
 
 # you need to call this function every frame to ensure update of the texture.
-logic.video.refresh(True)
\ No newline at end of file
+logic.video.refresh(True)
index 30f5b1765323f5e65cf23b8fe3008839ca9307c0..41c70b7cd169e502f8dd5a3beb024a0f0849b20d 100644 (file)
@@ -42,7 +42,6 @@ set(SRC
        intern/GHOST_Path-api.cpp
        intern/GHOST_DisplayManager.cpp
        intern/GHOST_EventManager.cpp
-       intern/GHOST_EventPrinter.cpp
        intern/GHOST_ISystem.cpp
        intern/GHOST_ISystemPaths.cpp
        intern/GHOST_ModifierKeys.cpp
@@ -75,7 +74,6 @@ set(SRC
        intern/GHOST_EventKey.h
        intern/GHOST_EventManager.h
        intern/GHOST_EventNDOF.h
-       intern/GHOST_EventPrinter.h
        intern/GHOST_EventString.h
        intern/GHOST_EventTrackpad.h
        intern/GHOST_EventWheel.h
@@ -89,7 +87,17 @@ set(SRC
        intern/GHOST_WindowManager.h
 )
 
-if(WITH_HEADLESS OR WITH_SDL_GHOST)
+if(WITH_GHOST_DEBUG)
+       list(APPEND SRC
+               intern/GHOST_EventPrinter.cpp
+
+               intern/GHOST_EventPrinter.h
+       )
+       add_definitions(-DWITH_GHOST_DEBUG)
+endif()
+
+
+if(WITH_HEADLESS OR WITH_GHOST_SDL)
        if(WITH_HEADLESS)
                list(APPEND SRC
                        intern/GHOST_DisplayManagerNULL.h
@@ -107,7 +115,7 @@ if(WITH_HEADLESS OR WITH_SDL_GHOST)
                        intern/GHOST_SystemSDL.h
                        intern/GHOST_WindowSDL.h
                )
-               add_definitions(-DWITH_SDL_GHOST)
+               add_definitions(-DWITH_GHOST_SDL)
        endif()
 
 
index ccfaa4814bc89c99ab9c973547aa9b31770dfd7b..c65ec58a97b4412eb0fbb78317814317d3e0dacf 100644 (file)
@@ -25,6 +25,7 @@ if env['WITH_GHOST_SDL']:
         except ValueError:
             pass
     incs += ' ' + env['BF_SDL_INC']
+    defs += ['WITH_GHOST_SDL']
 elif window_system in ('linux2', 'openbsd3', 'sunos5', 'freebsd7', 'freebsd8', 'freebsd9', 'irix6', 'aix4', 'aix5'):
     for f in pf:
         try:
@@ -73,7 +74,9 @@ else:
     Exit()
 
 if env['BF_GHOST_DEBUG']:
-    defs.append('BF_GHOST_DEBUG')
+    defs.append('WITH_GHOST_DEBUG')
+else:
+       sources.remove('intern' + os.sep + 'GHOST_EventPrinter.cpp')
 
 if window_system in ('win32-vc', 'win32-mingw', 'cygwin', 'linuxcross', 'win64-vc'):
     incs = env['BF_WINTAB_INC'] + ' ' + incs
index e77f3b9c46106681678e61b18ff61fef019647b1..ef1099b5cf67abcc99f72dec912fe12525e3d21d 100644 (file)
@@ -41,9 +41,9 @@
        #endif // DEBUG
 #endif // WIN32
 
-#ifdef BF_GHOST_DEBUG 
+#ifdef WITH_GHOST_DEBUG 
        #define GHOST_DEBUG // spit ghost events to stdout
-#endif // BF_GHOST_DEBUG 
+#endif // WITH_GHOST_DEBUG 
 
 #ifdef GHOST_DEBUG
        #include <iostream>
index ed37fa1dd0f65a14c32534e6b22e32201bc7e329..2e55957e60aa8020ae5551ba79b84e5ffd3c2705 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id:
+ * $Id$
  * ***** BEGIN GPL LICENSE BLOCK *****
  *
  * This program is free software; you can redistribute it and/or
index 5019d1b135179f03097769daaf620d82ef3b3be5..2a815b1dc28fb1dd1cf2a4924e495eaa90b5d02e 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: GHOST_DisplayManagerSDL.h 37194 2011-06-05 00:10:20Z gsrb3d $
+ * $Id$
  * ***** BEGIN GPL LICENSE BLOCK *****
  *
  * This program is free software; you can redistribute it and/or
@@ -35,6 +35,10 @@ extern "C" {
        #include "SDL.h"
 }
 
+#if !SDL_VERSION_ATLEAST(1, 3, 0)
+#  error "SDL 1.3 or newer is needed to build with Ghost"
+#endif
+
 class GHOST_SystemSDL;
 
 class GHOST_DisplayManagerSDL : public GHOST_DisplayManager
index 139c4beb4120a419ac0692589c8de6d272921932..9fa0b278353c55305ceb8e4db3620ba27c9bcd1e 100644 (file)
@@ -37,6 +37,7 @@
 #include "GHOST_EventDragnDrop.h"
 #include "GHOST_Debug.h"
 
+#include <stdio.h>
 
 bool GHOST_EventPrinter::processEvent(GHOST_IEvent* event)
 {
@@ -82,17 +83,17 @@ bool GHOST_EventPrinter::processEvent(GHOST_IEvent* event)
        case GHOST_kEventKeyUp:
                {
                GHOST_TEventKeyData* keyData = (GHOST_TEventKeyData*)((GHOST_IEvent*)event)->getData();
-               STR_String str;
+               char str[32]= {'\0'};
                getKeyString(keyData->key, str);
-               std::cout << "GHOST_kEventKeyUp, key: " << str.Ptr();
+               std::cout << "GHOST_kEventKeyUp, key: " << str;
                }
                break;
        case GHOST_kEventKeyDown:
                {
                GHOST_TEventKeyData* keyData = (GHOST_TEventKeyData*)((GHOST_IEvent*)event)->getData();
-               STR_String str;
+               char str[32]= {'\0'};
                getKeyString(keyData->key, str);
-               std::cout << "GHOST_kEventKeyDown, key: " << str.Ptr();
+               std::cout << "GHOST_kEventKeyDown, key: " << str;
                }
                break;
                        
@@ -183,165 +184,161 @@ bool GHOST_EventPrinter::processEvent(GHOST_IEvent* event)
 }
 
 
-void GHOST_EventPrinter::getKeyString(GHOST_TKey key, STR_String& str) const
+void GHOST_EventPrinter::getKeyString(GHOST_TKey key, char str[32]) const
 {
        if ((key >= GHOST_kKeyComma) && (key <= GHOST_kKeyRightBracket)) {
-               str = ((char)key);
+               sprintf(str, "%c", (char)key);
        } else if ((key >= GHOST_kKeyNumpad0) && (key <= GHOST_kKeyNumpad9)) {
-               int number = key - GHOST_kKeyNumpad0;
-               STR_String numberStr (number);
-               str = "Numpad";
-               str += numberStr;
+               sprintf(str, "Numpad %d", (key - GHOST_kKeyNumpad0));
 #if defined(__sun__) || defined(__sun)
        } else if (key == 268828432) { /* solaris keyboards are messed up */
                 /* This should really test XK_F11 but that doesn't work */
-               str = "F11";
+               strcpy(str, "F11");
        } else if (key == 268828433) { /* solaris keyboards are messed up */
                 /* This should really test XK_F12 but that doesn't work */
-               str = "F12";
+               strcpy(str, "F12");
 #endif
        } else if ((key >= GHOST_kKeyF1) && (key <= GHOST_kKeyF24)) {
-               int number = key - GHOST_kKeyF1 + 1;
-               STR_String numberStr (number);
-               str = "F";
-               str += numberStr;
+               sprintf(str, "F%d", key - GHOST_kKeyF1 + 1);
        } else {
-               switch (key)
-               {
+               const char *tstr= NULL;
+               switch (key) {
                case GHOST_kKeyBackSpace:
-                       str = "BackSpace";
+                       tstr = "BackSpace";
                        break;
                case GHOST_kKeyTab:
-                       str = "Tab";
+                       tstr = "Tab";
                        break;
                case GHOST_kKeyLinefeed:
-                       str = "Linefeed";
+                       tstr = "Linefeed";
                        break;
                case GHOST_kKeyClear:
-                       str = "Clear";
+                       tstr = "Clear";
                        break;
                case GHOST_kKeyEnter:
-                       str = "Enter";
+                       tstr = "Enter";
                        break;
                case GHOST_kKeyEsc:
-                       str = "Esc";
+                       tstr = "Esc";
                        break;
                case GHOST_kKeySpace:
-                       str = "Space";
+                       tstr = "Space";
                        break;
                case GHOST_kKeyQuote:
-                       str = "Quote";
+                       tstr = "Quote";
                        break;
                case GHOST_kKeyBackslash:
-                       str = "\\";
+                       tstr = "\\";
                        break;
                case GHOST_kKeyAccentGrave:
-                       str = "`";
+                       tstr = "`";
                        break;
                case GHOST_kKeyLeftShift:
-                       str = "LeftShift";
+                       tstr = "LeftShift";
                        break;
                case GHOST_kKeyRightShift:
-                       str = "RightShift";
+                       tstr = "RightShift";
                        break;
                case GHOST_kKeyLeftControl:
-                       str = "LeftControl";
+                       tstr = "LeftControl";
                        break;
                case GHOST_kKeyRightControl:
-                       str = "RightControl";
+                       tstr = "RightControl";
                        break;
                case GHOST_kKeyLeftAlt:
-                       str = "LeftAlt";
+                       tstr = "LeftAlt";
                        break;
                case GHOST_kKeyRightAlt:
-                       str = "RightAlt";
+                       tstr = "RightAlt";
                        break;
                case GHOST_kKeyOS:
-                       str = "OS";
+                       tstr = "OS";
                        break;
                case GHOST_kKeyGrLess:
             // PC german!
-                       str = "GrLess";
+                       tstr = "GrLess";
                        break;
                case GHOST_kKeyCapsLock:
-                       str = "CapsLock";
+                       tstr = "CapsLock";
                        break;
                case GHOST_kKeyNumLock:
-                       str = "NumLock";
+                       tstr = "NumLock";
                        break;
                case GHOST_kKeyScrollLock:
-                       str = "ScrollLock";
+                       tstr = "ScrollLock";
                        break;
                case GHOST_kKeyLeftArrow:
-                       str = "LeftArrow";
+                       tstr = "LeftArrow";
                        break;
                case GHOST_kKeyRightArrow:
-                       str = "RightArrow";
+                       tstr = "RightArrow";
                        break;
                case GHOST_kKeyUpArrow:
-                       str = "UpArrow";
+                       tstr = "UpArrow";
                        break;
                case GHOST_kKeyDownArrow:
-                       str = "DownArrow";
+                       tstr = "DownArrow";
                        break;
                case GHOST_kKeyPrintScreen:
-                       str = "PrintScreen";
+                       tstr = "PrintScreen";
                        break;
                case GHOST_kKeyPause:
-                       str = "Pause";
+                       tstr = "Pause";
                        break;
                case GHOST_kKeyInsert:
-                       str = "Insert";
+                       tstr = "Insert";
                        break;
                case GHOST_kKeyDelete:
-                       str = "Delete";
+                       tstr = "Delete";
                        break;
                case GHOST_kKeyHome:
-                       str = "Home";
+                       tstr = "Home";
                        break;
                case GHOST_kKeyEnd:
-                       str = "End";
+                       tstr = "End";
                        break;
                case GHOST_kKeyUpPage:
-                       str = "UpPage";
+                       tstr = "UpPage";
                        break;
                case GHOST_kKeyDownPage:
-                       str = "DownPage";
+                       tstr = "DownPage";
                        break;
                case GHOST_kKeyNumpadPeriod:
-                       str = "NumpadPeriod";
+                       tstr = "NumpadPeriod";
                        break;
                case GHOST_kKeyNumpadEnter:
-                       str = "NumpadEnter";
+                       tstr = "NumpadEnter";
                        break;
                case GHOST_kKeyNumpadPlus:
-                       str = "NumpadPlus";
+                       tstr = "NumpadPlus";
                        break;
                case GHOST_kKeyNumpadMinus:
-                       str = "NumpadMinus";
+                       tstr = "NumpadMinus";
                        break;
                case GHOST_kKeyNumpadAsterisk:
-                       str = "NumpadAsterisk";
+                       tstr = "NumpadAsterisk";
                        break;
                case GHOST_kKeyNumpadSlash:
-                       str = "NumpadSlash";
+                       tstr = "NumpadSlash";
                        break;
                case GHOST_kKeyMediaPlay:
-                       str = "MediaPlayPause";
+                       tstr = "MediaPlayPause";
                        break;
                case GHOST_kKeyMediaStop:
-                       str = "MediaStop";
+                       tstr = "MediaStop";
                        break;
                case GHOST_kKeyMediaFirst:
-                       str = "MediaFirst";
+                       tstr = "MediaFirst";
                        break;
                case GHOST_kKeyMediaLast:
-                       str = "MediaLast";
+                       tstr = "MediaLast";
                        break;
                default:
-                       str = "unknown";
+                       tstr = "unknown";
                        break;
                }
+
+               sprintf(str, "%s", tstr);
        }
 }
 
index 74c379e76a8fa4b66198ec08de76eaafdbb3f1c3..d9b7f86c04e954b95c517478fc96682fc84c3a7c 100644 (file)
@@ -58,7 +58,7 @@ protected:
         * @param key The GHOST key code to convert.
         * @param str The GHOST key code converted to a readable string.
         */
-       void    getKeyString(GHOST_TKey key, STR_String& str) const;
+       void    getKeyString(GHOST_TKey key, char str[32]) const;
 };
 
 #endif // _GHOST_EVENT_PRINTER_H_
index 2cb82ffd7c2767602ffb7ed56757742b736f01b5..278c224ff85bf87af6cbad7438a6670f25da5bfa 100644 (file)
@@ -43,7 +43,7 @@
 
 #ifdef WITH_HEADLESS
 #      include "GHOST_SystemNULL.h"
-#elif defined(WITH_SDL_GHOST)
+#elif defined(WITH_GHOST_SDL)
 #      include "GHOST_SystemSDL.h"
 #elif defined(WIN32)
 #      include "GHOST_SystemWin32.h"
@@ -69,7 +69,7 @@ GHOST_TSuccess GHOST_ISystem::createSystem()
        if (!m_system) {
 #ifdef WITH_HEADLESS
                m_system = new GHOST_SystemNULL();
-#elif defined(WITH_SDL_GHOST)
+#elif defined(WITH_GHOST_SDL)
                m_system = new GHOST_SystemSDL();
 #elif defined(WIN32)
                m_system = new GHOST_SystemWin32 ();
index 30f0de1e646f438e22ecb614c3a429c5dd42727f..dae6cb5b5445bc89c26ff95f4b41fad49eb5ef04 100644 (file)
@@ -85,7 +85,7 @@ GHOST_NDOFManager::deviceOpen(GHOST_IWindow* window,
                        /* do nothing */
                #elif defined(_WIN32) || defined(__APPLE__)
                        m_DeviceHandle = ndofDeviceOpen((void *)&currentNdofValues);    
-               #elif defined(WITH_SDL_GHOST)
+               #elif defined(WITH_GHOST_SDL)
                        /* do nothing */
                #else
                        GHOST_SystemX11 *sys;
index 33dcbc01307c465765e88d92e35aa737e19ff627..2c61acc2d931d648884787382ffd03bb40859c8a 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id:
+ * $Id$
  * ***** BEGIN GPL LICENSE BLOCK *****
  *
  * This program is free software; you can redistribute it and/or
@@ -279,10 +279,57 @@ GHOST_SystemSDL::processEvent(SDL_Event *sdl_event)
        case SDL_MOUSEMOTION:
                {
                        SDL_MouseMotionEvent &sdl_sub_evt= sdl_event->motion;
-                       GHOST_WindowSDL *window= findGhostWindow(SDL_GetWindowFromID(sdl_sub_evt.windowID));
+                       SDL_Window *sdl_win= SDL_GetWindowFromID(sdl_sub_evt.windowID);
+                       GHOST_WindowSDL *window= findGhostWindow(sdl_win);
                        assert(window != NULL);
 
-                       g_event= new GHOST_EventCursor(getMilliSeconds(), GHOST_kEventCursorMove, window, sdl_sub_evt.x, sdl_sub_evt.y);
+                       int x_win, y_win;
+                       SDL_GetWindowPosition(sdl_win, &x_win, &y_win);
+
+                       GHOST_TInt32 x_root= sdl_sub_evt.x + x_win;
+                       GHOST_TInt32 y_root= sdl_sub_evt.y + y_win;
+
+#if 0
+                       if(window->getCursorGrabMode() != GHOST_kGrabDisable && window->getCursorGrabMode() != GHOST_kGrabNormal)
+                       {
+                               GHOST_TInt32 x_new= x_root;
+                               GHOST_TInt32 y_new= y_root;
+                               GHOST_TInt32 x_accum, y_accum;
+                               GHOST_Rect bounds;
+
+                               /* fallback to window bounds */
+                               if(window->getCursorGrabBounds(bounds)==GHOST_kFailure)
+                                       window->getClientBounds(bounds);
+
+                               /* could also clamp to screen bounds
+                                * wrap with a window outside the view will fail atm  */
+                               bounds.wrapPoint(x_new, y_new, 8); /* offset of one incase blender is at screen bounds */
+                               window->getCursorGrabAccum(x_accum, y_accum);
+
+                               // cant use setCursorPosition because the mouse may have no focus!
+                               if(x_new != x_root || y_new != y_root) {
+                                       if (1 ) { //xme.time > m_last_warp) {
+                                               /* when wrapping we don't need to add an event because the
+                                                * setCursorPosition call will cause a new event after */
+                                               SDL_WarpMouseInWindow(sdl_win, x_new - x_win, y_new - y_win); /* wrap */
+                                               window->setCursorGrabAccum(x_accum + (x_root - x_new), y_accum + (y_root - y_new));
+                                               // m_last_warp= lastEventTime(xme.time);
+                                       } else {
+                                               // setCursorPosition(x_new, y_new); /* wrap but don't accumulate */
+                                               SDL_WarpMouseInWindow(sdl_win, x_new - x_win, y_new - y_win);
+                                       }
+
+                                       g_event = new GHOST_EventCursor(getMilliSeconds(), GHOST_kEventCursorMove, window, x_new, y_new);
+                               }
+                               else {
+                                       g_event = new GHOST_EventCursor(getMilliSeconds(), GHOST_kEventCursorMove, window, x_root + x_accum, y_root + y_accum);
+                               }
+                       }
+                       else
+#endif
+                       {
+                               g_event= new GHOST_EventCursor(getMilliSeconds(), GHOST_kEventCursorMove, window, x_root, y_root);
+                       }
                        break;
                }
        case SDL_MOUSEBUTTONUP:
@@ -346,10 +393,15 @@ GHOST_TSuccess
 GHOST_SystemSDL::getCursorPosition(GHOST_TInt32& x,
                                    GHOST_TInt32& y) const
 {
+       int x_win, y_win;
+       SDL_Window *win= SDL_GetMouseFocus();
+       SDL_GetWindowPosition(win, &x_win, &y_win);
+
        int xi, yi;
        SDL_GetMouseState(&xi, &yi);
-       x= xi;
-       y= yi;
+       x= xi + x_win;
+       y= yi + x_win;
+
        return GHOST_kSuccess;
 }
 
@@ -357,8 +409,11 @@ GHOST_TSuccess
 GHOST_SystemSDL::setCursorPosition(GHOST_TInt32 x,
                                    GHOST_TInt32 y)
 {
-       // SDL_SendMouseMotion(SDL, SDL_FALSE, x, y); // NOT EXPOSED
-       SDL_WarpMouseInWindow(NULL, x, y);
+       int x_win, y_win;
+       SDL_Window *win= SDL_GetMouseFocus();
+       SDL_GetWindowPosition(win, &x_win, &y_win);
+
+       SDL_WarpMouseInWindow(win, x - x_win, y - y_win);
        return GHOST_kSuccess;
 }
 
index 7aea1b6694a3c591f6477bcc0d925582d9e9db72..87d288117c51670b0851c8fa4f43d0e539202c48 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: GHOST_SystemSDL.h 37194 2011-06-05 00:10:20Z gsrb3d $
+ * $Id$
  * ***** BEGIN GPL LICENSE BLOCK *****
  *
  * This program is free software; you can redistribute it and/or
@@ -40,6 +40,11 @@ extern "C" {
        #include "SDL.h"
 }
 
+#if !SDL_VERSION_ATLEAST(1, 3, 0)
+#  error "SDL 1.3 or newer is needed to build with Ghost"
+#endif
+
+
 class GHOST_WindowSDL;
 
 
index 143f7e97f2d275897f6a3fc29c602b50b835f2b9..ace6cc0e0cff67a9ae27425ecd753d0080e1b865 100644 (file)
@@ -763,7 +763,7 @@ GHOST_EventKey* GHOST_SystemWin32::processKeyEvent(GHOST_IWindow *window, WPARAM
 
                event = new GHOST_EventKey(system->getMilliSeconds(), keyDown ? GHOST_kEventKeyDown: GHOST_kEventKeyUp, window, key, ascii);
                
-#ifdef BF_GHOST_DEBUG
+#ifdef GHOST_DEBUG
                std::cout << ascii << std::endl;
 #endif
        }
index 2d8d90c6c83d57d928e63efc0612a706b17c7f73..3ebd24c008b32abaef3cce4951db212c32bba84d 100644 (file)
@@ -859,60 +859,28 @@ getModifierKeys(
        // now translate key symobols into keycodes and
        // test with vector.
 
-       const KeyCode shift_l = XKeysymToKeycode(m_display,XK_Shift_L);
-       const KeyCode shift_r = XKeysymToKeycode(m_display,XK_Shift_R);
-       const KeyCode control_l = XKeysymToKeycode(m_display,XK_Control_L);
-       const KeyCode control_r = XKeysymToKeycode(m_display,XK_Control_R);
-       const KeyCode alt_l = XKeysymToKeycode(m_display,XK_Alt_L);
-       const KeyCode alt_r = XKeysymToKeycode(m_display,XK_Alt_R);
-       const KeyCode super_l = XKeysymToKeycode(m_display,XK_Super_L);
-       const KeyCode super_r = XKeysymToKeycode(m_display,XK_Super_R);
-
-       // Shift
-       if ((m_keyboard_vector[shift_l >> 3] >> (shift_l & 7)) & 1) {
-               keys.set(GHOST_kModifierKeyLeftShift,true);
-       } else {
-               keys.set(GHOST_kModifierKeyLeftShift,false);
-       }
-       if ((m_keyboard_vector[shift_r >> 3] >> (shift_r & 7)) & 1) {
-
-               keys.set(GHOST_kModifierKeyRightShift,true);
-       } else {
-               keys.set(GHOST_kModifierKeyRightShift,false);
-       }
+       const static KeyCode shift_l = XKeysymToKeycode(m_display,XK_Shift_L);
+       const static KeyCode shift_r = XKeysymToKeycode(m_display,XK_Shift_R);
+       const static KeyCode control_l = XKeysymToKeycode(m_display,XK_Control_L);
+       const static KeyCode control_r = XKeysymToKeycode(m_display,XK_Control_R);
+       const static KeyCode alt_l = XKeysymToKeycode(m_display,XK_Alt_L);
+       const static KeyCode alt_r = XKeysymToKeycode(m_display,XK_Alt_R);
+       const static KeyCode super_l = XKeysymToKeycode(m_display,XK_Super_L);
+       const static KeyCode super_r = XKeysymToKeycode(m_display,XK_Super_R);
+
+       // 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
+       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
+       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
+       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);
 
-       // control (weep)
-       if ((m_keyboard_vector[control_l >> 3] >> (control_l & 7)) & 1) {
-               keys.set(GHOST_kModifierKeyLeftControl,true);
-       } else {
-               keys.set(GHOST_kModifierKeyLeftControl,false);
-       }
-       if ((m_keyboard_vector[control_r >> 3] >> (control_r & 7)) & 1) {
-               keys.set(GHOST_kModifierKeyRightControl,true);
-       } else {
-               keys.set(GHOST_kModifierKeyRightControl,false);
-       }
-
-       // Alt (yawn)
-       if ((m_keyboard_vector[alt_l >> 3] >> (alt_l & 7)) & 1) {
-               keys.set(GHOST_kModifierKeyLeftAlt,true);
-       } else {
-               keys.set(GHOST_kModifierKeyLeftAlt,false);
-       }       
-       if ((m_keyboard_vector[alt_r >> 3] >> (alt_r & 7)) & 1) {
-               keys.set(GHOST_kModifierKeyRightAlt,true);
-       } else {
-               keys.set(GHOST_kModifierKeyRightAlt,false);
-       }
-
-       // Super (Windows) - only one GHOST-kModifierKeyOS, so mapping
-       // to either
-       if ( ((m_keyboard_vector[super_l >> 3] >> (super_l & 7)) & 1) || 
-            ((m_keyboard_vector[super_r >> 3] >> (super_r & 7)) & 1) ) {
-               keys.set(GHOST_kModifierKeyOS,true);
-       } else {
-               keys.set(GHOST_kModifierKeyOS,false);
-       }
        return GHOST_kSuccess;
 }
 
index 9d4263f6311fc740135fa291bafb8d4474f6bedf..1675c1fb12b223c76e5bbb3e11f2db4e14b34e0b 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id:
+ * $Id$
  * ***** BEGIN GPL LICENSE BLOCK *****
  *
  * This program is free software; you can redistribute it and/or
@@ -50,8 +50,8 @@ GHOST_WindowSDL::GHOST_WindowSDL(GHOST_SystemSDL *system,
       m_sdl_custom_cursor(NULL)
 {
        m_sdl_win= SDL_CreateWindow(title,
-                                   10,
-                                   10,
+                                   left,
+                                   top,
                                    width,
                                    height,
                                    SDL_WINDOW_RESIZABLE|SDL_WINDOW_OPENGL|SDL_WINDOW_SHOWN);
@@ -285,6 +285,26 @@ GHOST_WindowSDL::setClientSize(GHOST_TUns32 width,
        return GHOST_kSuccess;
 }
 
+void
+GHOST_WindowSDL::screenToClient( GHOST_TInt32 inX, GHOST_TInt32 inY, GHOST_TInt32& outX, GHOST_TInt32& outY ) const
+{
+       /* XXXSDL_WEAK_ABS_COORDS */
+       int x_win, y_win;
+       SDL_GetWindowPosition(m_sdl_win, &x_win, &y_win);
+
+       outX = inX - x_win;
+       outY = inY - y_win;
+}
+void
+GHOST_WindowSDL::clientToScreen( GHOST_TInt32 inX, GHOST_TInt32 inY, GHOST_TInt32& outX, GHOST_TInt32& outY ) const
+{
+       /* XXXSDL_WEAK_ABS_COORDS */
+       int x_win, y_win;
+       SDL_GetWindowPosition(m_sdl_win, &x_win, &y_win);
+
+       outX = inX + x_win;
+       outY = inY + y_win;
+}
 
 /* mouse cursor */
 static unsigned char sdl_std_cursor_mask_xterm[]= {0xef,0x01,0xff,0x01,0xff,0x01,0x7c,0x00,0x38,0x00,0x38,0x00,0x38,0x00,0x38,0x00,0x38,0x00,0x38,0x00,0x38,0x00,0x38,0x00,0x7c,0x00,0xff,0x01,0xff,0x01,0xef,0x01,};
index 12ff0266e8cf587fe862b49e77b306fc78c35fd5..6b016b85126f8434f3f047713bfa35dd5603a2b5 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: GHOST_WindowSDL.h 38022 2011-07-01 15:15:22Z campbellbarton $
+ * $Id$
  * ***** BEGIN GPL LICENSE BLOCK *****
  *
  * This program is free software; you can redistribute it and/or
@@ -37,6 +37,10 @@ extern "C" {
        #include "SDL.h"
 }
 
+#if !SDL_VERSION_ATLEAST(1, 3, 0)
+#  error "SDL 1.3 or newer is needed to build with Ghost"
+#endif
+
 class STR_String;
 
 class GHOST_WindowSDL : public GHOST_Window
@@ -55,10 +59,8 @@ public:
 
        GHOST_WindowSDL(GHOST_SystemSDL *system,
                        const STR_String& title,
-                       GHOST_TInt32 left,
-                       GHOST_TInt32 top,
-                       GHOST_TUns32 width,
-                       GHOST_TUns32 height,
+                       GHOST_TInt32 left, GHOST_TInt32 top,
+                       GHOST_TUns32 width, GHOST_TUns32 height,
                        GHOST_TWindowState state,
                        const GHOST_TEmbedderWindowID parentWindow,
                        GHOST_TDrawingContextType type,
@@ -70,8 +72,8 @@ public:
 
        /* SDL spesific */
        SDL_Window *
-       getSDLWindow(
-       ){
+       getSDLWindow()
+       {
                return m_sdl_win;
        }
 
@@ -88,37 +90,74 @@ public:
                m_invalid_window = false;
        }
 
-       bool getValid( ) const
+       bool getValid() const
        {
                return (m_sdl_win != NULL);
        }
 
+       void getWindowBounds(GHOST_Rect& bounds) const;
+       void getClientBounds(GHOST_Rect& bounds) const;
+
 protected:
        GHOST_TSuccess installDrawingContext(GHOST_TDrawingContextType type);
        GHOST_TSuccess removeDrawingContext();
 
-       GHOST_TSuccess setWindowCursorGrab(GHOST_TGrabCursorMode mode);
-       GHOST_TSuccess setWindowCursorShape(GHOST_TStandardCursor shape);
-       GHOST_TSuccess setWindowCustomCursorShape(GHOST_TUns8 bitmap[16][2], GHOST_TUns8 mask[16][2], int hotX, int hotY);
-       GHOST_TSuccess setWindowCustomCursorShape(GHOST_TUns8 *bitmap, GHOST_TUns8 *mask, int sizex, int sizey, int hotX, int hotY, int fg_color, int bg_color);
-       GHOST_TSuccess setWindowCursorVisibility(bool visible);
-
-       void setTitle(const STR_String& title);
-       void getTitle(STR_String& title) const;
-       void getWindowBounds( GHOST_Rect& bounds ) const;
-       void getClientBounds( GHOST_Rect& bounds ) const;
-       GHOST_TSuccess setClientWidth(GHOST_TUns32 width);
-       GHOST_TSuccess setClientHeight(GHOST_TUns32 height);
-       GHOST_TSuccess setClientSize(GHOST_TUns32 width, GHOST_TUns32 height);
-
-       /* TODO */
-       void screenToClient( GHOST_TInt32 inX, GHOST_TInt32 inY, GHOST_TInt32& outX, GHOST_TInt32& outY ) const { outX = inX; outY = inY; }
-       void clientToScreen( GHOST_TInt32 inX, GHOST_TInt32 inY, GHOST_TInt32& outX, GHOST_TInt32& outY ) const { outX = inX; outY = inY; }
-
-       GHOST_TSuccess swapBuffers();
-       GHOST_TSuccess activateDrawingContext();
-       GHOST_TSuccess setState(GHOST_TWindowState state);
-       GHOST_TWindowState getState() const;
+       GHOST_TSuccess
+       setWindowCursorGrab(GHOST_TGrabCursorMode mode);
+
+       GHOST_TSuccess
+       setWindowCursorShape(GHOST_TStandardCursor shape);
+
+       GHOST_TSuccess
+       setWindowCustomCursorShape(GHOST_TUns8 bitmap[16][2],
+                                  GHOST_TUns8 mask[16][2],
+                                  int hotX, int hotY);
+
+       GHOST_TSuccess
+       setWindowCustomCursorShape(GHOST_TUns8 *bitmap,
+                                  GHOST_TUns8 *mask,
+                                  int sizex, int sizey,
+                                  int hotX, int hotY,
+                                  int fg_color, int bg_color);
+
+       GHOST_TSuccess
+       setWindowCursorVisibility(bool visible);
+
+       void
+       setTitle(const STR_String& title);
+
+       void
+       getTitle(STR_String& title) const;
+
+       GHOST_TSuccess
+       setClientWidth(GHOST_TUns32 width);
+
+       GHOST_TSuccess
+       setClientHeight(GHOST_TUns32 height);
+
+       GHOST_TSuccess
+       setClientSize(GHOST_TUns32 width,
+                     GHOST_TUns32 height);
+
+       void
+       screenToClient(GHOST_TInt32 inX, GHOST_TInt32 inY,
+                      GHOST_TInt32& outX, GHOST_TInt32& outY) const;
+
+       void
+       clientToScreen(GHOST_TInt32 inX, GHOST_TInt32 inY,
+                      GHOST_TInt32& outX, GHOST_TInt32& outY) const;
+
+       GHOST_TSuccess
+       swapBuffers();
+
+       GHOST_TSuccess
+       activateDrawingContext();
+
+       GHOST_TSuccess
+       setState(GHOST_TWindowState state);
+
+       GHOST_TWindowState
+       getState() const;
 
        GHOST_TSuccess setOrder(GHOST_TWindowOrder order) { return GHOST_kSuccess; } // TODO
 
index 34925ccb5e9b21468d88fff4a45e95650e11eaaf..c42d3d0236a6d92948755f04dabe5a72eb539c4d 100644 (file)
@@ -16,7 +16,7 @@
 #
 # ##### END GPL LICENSE BLOCK #####
 
-# <pep8 compliant>
+# <pep8-80 compliant>
 
 __all__ = (
     "mesh_linked_faces",
@@ -25,6 +25,7 @@ __all__ = (
     "edge_loops_from_faces",
     "edge_loops_from_edges",
     "ngon_tesselate",
+    "face_random_points",
 )
 
 
@@ -67,7 +68,8 @@ def mesh_linked_faces(mesh):
                         if mapped_index != nxt_mapped_index:
                             ok = True
 
-                            # Assign mapping to this group so they all map to this group
+                            # Assign mapping to this group so they
+                            # all map to this group
                             for grp_f in face_groups[nxt_mapped_index]:
                                 face_mapping[grp_f.index] = mapped_index
 
@@ -433,3 +435,70 @@ def ngon_tesselate(from_data, indices, fix_loops=True):
                 fill[i] = tuple([ii for ii in reversed(fi)])
 
     return fill
+
+
+def face_random_points(num_points, faces):
+    """
+    Generates a list of random points over mesh faces.
+
+    :arg num_points: the number of random points to generate on each face.
+    :type int:
+    :arg faces: list of the faces to generate points on.
+    :type faces: :class:`MeshFaces`, sequence
+    :return: list of random points over all faces.
+    :rtype: list
+    """
+
+    from random import random
+    from mathutils.geometry import area_tri
+
+    # Split all quads into 2 tris, tris remain unchanged
+    tri_faces = []
+    for f in faces:
+        tris = []
+        verts = f.id_data.vertices
+        fv = f.vertices[:]
+        tris.append((verts[fv[0]].co,
+                     verts[fv[1]].co,
+                     verts[fv[2]].co,
+                    ))
+        if len(fv) == 4:
+            tris.append((verts[fv[0]].co,
+                         verts[fv[3]].co,
+                         verts[fv[2]].co,
+                        ))
+        tri_faces.append(tris)
+
+    # For each face, generate the required number of random points
+    sampled_points = [None] * (num_points * len(faces))
+    for i, tf in enumerate(tri_faces):
+        for k in range(num_points):
+            # If this is a quad, we need to weight its 2 tris by their area
+            if len(tf) != 1:
+                area1 = area_tri(*tf[0])
+                area2 = area_tri(*tf[1])
+                area_tot = area1 + area2
+
+                area1 = area1 / area_tot
+                area2 = area2 / area_tot
+
+                vecs = tf[0 if (random() < area1) else 1]
+            else:
+                vecs = tf[0]
+
+            u1 = random()
+            u2 = random()
+            u_tot = u1 + u2
+
+            if u_tot > 1:
+                u1 = 1.0 - u1
+                u2 = 1.0 - u2
+
+            side1 = vecs[1] - vecs[0]
+            side2 = vecs[2] - vecs[0]
+
+            p = vecs[0] + u1 * side1 + u2 * side2
+
+            sampled_points[num_points * i + k] = p
+
+    return sampled_points
index fed1cc49c4cd13680880e86aa34df292a2664076..831fd3597823d0de843c5bd61e86db33641cae4f 100644 (file)
@@ -135,9 +135,10 @@ class NODE_MT_node(bpy.types.Menu):
         layout.operator("transform.resize")
 
         layout.separator()
-
+        
         layout.operator("node.duplicate_move")
         layout.operator("node.delete")
+        layout.operator("node.delete_reconnect")
 
         layout.separator()
         layout.operator("node.link_make")
index b919d0f57c08c8b7dbe786d3a172fb2669bd1075..b39d63e90b2c7c0665b72e97874da792ccf622fb 100644 (file)
 #
 # ***** END GPL LICENSE BLOCK *****
 
-add_subdirectory(animation)
-add_subdirectory(armature)
-add_subdirectory(curve)
+if(WITH_BLENDER)
+       add_subdirectory(animation)
+       add_subdirectory(armature)
+       add_subdirectory(curve)
+       add_subdirectory(gpencil)
+       add_subdirectory(interface)
+       add_subdirectory(mesh)
+       add_subdirectory(metaball)
+       add_subdirectory(object)
+       add_subdirectory(physics)
+       add_subdirectory(render)
+       add_subdirectory(screen)
+       add_subdirectory(sculpt_paint)
+       add_subdirectory(sound)
+       add_subdirectory(space_action)
+       add_subdirectory(space_api)
+       add_subdirectory(space_buttons)
+       add_subdirectory(space_clip)
+       add_subdirectory(space_console)
+       add_subdirectory(space_file)
+       add_subdirectory(space_graph)
+       add_subdirectory(space_image)
+       add_subdirectory(space_info)
+       add_subdirectory(space_logic)
+       add_subdirectory(space_nla)
+       add_subdirectory(space_node)
+       add_subdirectory(space_outliner)
+       add_subdirectory(space_script)
+       add_subdirectory(space_sequencer)
+       add_subdirectory(space_sound)
+       add_subdirectory(space_text)
+       add_subdirectory(space_time)
+       add_subdirectory(space_userpref)
+       add_subdirectory(space_view3d)
+       add_subdirectory(transform)
+       add_subdirectory(util)
+       add_subdirectory(uvedit)
+endif()
+
 add_subdirectory(datafiles)
-add_subdirectory(gpencil)
-add_subdirectory(interface)
-add_subdirectory(mesh)
-add_subdirectory(metaball)
-add_subdirectory(object)
-add_subdirectory(physics)
-add_subdirectory(render)
-add_subdirectory(screen)
-add_subdirectory(sculpt_paint)
-add_subdirectory(sound)
-add_subdirectory(space_action)
-add_subdirectory(space_api)
-add_subdirectory(space_buttons)
-add_subdirectory(space_clip)
-add_subdirectory(space_console)
-add_subdirectory(space_file)
-add_subdirectory(space_graph)
-add_subdirectory(space_image)
-add_subdirectory(space_info)
-add_subdirectory(space_logic)
-add_subdirectory(space_nla)
-add_subdirectory(space_node)
-add_subdirectory(space_outliner)
-add_subdirectory(space_script)
-add_subdirectory(space_sequencer)
-add_subdirectory(space_sound)
-add_subdirectory(space_text)
-add_subdirectory(space_time)
-add_subdirectory(space_userpref)
-add_subdirectory(space_view3d)
-add_subdirectory(transform)
-add_subdirectory(util)
-add_subdirectory(uvedit)
index ae86905a91d7ef1d9ec482e5422ea46d27c2320d..080673d6e543295539fc73c3ad365eba5d638b6e 100644 (file)
@@ -27,50 +27,58 @@ set(INC_SYS
 
 )
 
+# blender and player
 set(SRC
        Bfont.c
        bfont.ttf.c
-       bmonofont.ttf.c
-       startup.blend.c
-       preview.blend.c
 )
 
-if(NOT WITH_HEADLESS)
+if(WITH_BLENDER)
+       # blender only
        list(APPEND SRC
-               splash.png.c
-               blenderbuttons.c
-
-               # brushes
-               add.png.c
-               blob.png.c
-               blur.png.c
-               clay.png.c
-               clone.png.c
-               crease.png.c
-               darken.png.c
-               draw.png.c
-               fill.png.c
-               flatten.png.c
-               grab.png.c
-               inflate.png.c
-               layer.png.c
-               lighten.png.c
-               mix.png.c
-               multiply.png.c
-               nudge.png.c
-               pinch.png.c
-               prvicons.c
-               scrape.png.c
-               smear.png.c
-               smooth.png.c
-               snake_hook.png.c
-               soften.png.c
-               subtract.png.c
-               texdraw.png.c
-               thumb.png.c
-               twist.png.c
-               vertexdraw.png.c
+               startup.blend.c
+               preview.blend.c
+               bmonofont.ttf.c
        )
+
+       if(NOT WITH_HEADLESS)
+               # blender UI only
+               list(APPEND SRC
+                       splash.png.c
+                       blenderbuttons.c
+
+                       # brushes
+                       add.png.c
+                       blob.png.c
+                       blur.png.c
+                       clay.png.c
+                       clone.png.c
+                       crease.png.c
+                       darken.png.c
+                       draw.png.c
+                       fill.png.c
+                       flatten.png.c
+                       grab.png.c
+                       inflate.png.c
+                       layer.png.c
+                       lighten.png.c
+                       mix.png.c
+                       multiply.png.c
+                       nudge.png.c
+                       pinch.png.c
+                       prvicons.c
+                       scrape.png.c
+                       smear.png.c
+                       smooth.png.c
+                       snake_hook.png.c
+                       soften.png.c
+                       subtract.png.c
+                       texdraw.png.c
+                       thumb.png.c
+                       twist.png.c
+                       vertexdraw.png.c
+               )
+       endif()
 endif()
 
 blender_add_lib(bf_editor_datafiles "${SRC}" "${INC}" "${INC_SYS}")
index 5f8ab0dded5524bda5b3ab282deee19363268f16..cd1fa5c16a7a731277791c5f8dd5bcae958eee4a 100644 (file)
@@ -461,6 +461,7 @@ static void node_update_group(const bContext *C, bNodeTree *UNUSED(ntree), bNode
 }
 
 /* note: in cmp_util.c is similar code, for node_compo_pass_on() */
+/* note: in node_edit.c is similar code, for untangle node */
 static void node_draw_mute_line(View2D *v2d, SpaceNode *snode, bNode *node)
 {
        bNodeSocket *valsock= NULL, *colsock= NULL, *vecsock= NULL;
index a6a60035aa78255b8fe1c059b65d823d708cbc84..e760c9021c25835787da5764e6d86cabbb79337d 100644 (file)
@@ -2906,6 +2906,117 @@ void NODE_OT_delete(wmOperatorType *ot)
        ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
+/* ****************** Delete with reconnect ******************* */
+
+/* note: in cmp_util.c is similar code, for node_compo_pass_on() */
+/* used for disabling node  (similar code in node_draw.c for disable line) */
+static void node_delete_reconnect(bNodeTree* tree, bNode* node) {
+       bNodeLink *link, *next;
+       bNodeSocket *valsocket= NULL, *colsocket= NULL, *vecsocket= NULL;
+       bNodeSocket *deliveringvalsocket= NULL, *deliveringcolsocket= NULL, *deliveringvecsocket= NULL;
+       bNode *deliveringvalnode= NULL, *deliveringcolnode= NULL, *deliveringvecnode= NULL;
+       bNodeSocket *sock;
+
+       /* test the inputs */
+       for(sock= node->inputs.first; sock; sock= sock->next) {
+               int type = sock->type;
+               if(type==SOCK_VALUE && valsocket==NULL) valsocket = sock;
+               if(type==SOCK_VECTOR && vecsocket==NULL) vecsocket = sock;
+               if(type==SOCK_RGBA && colsocket==NULL) colsocket = sock;
+       }
+       // we now have the input sockets for the 'data types'
+       // now find the output sockets (and nodes) in the tree that delivers data to these input sockets
+       for(link= tree->links.first; link; link=link->next) {
+               if (valsocket != NULL) {
+                       if (link->tosock == valsocket) {
+                               deliveringvalnode = link->fromnode;
+                               deliveringvalsocket = link->fromsock;
+                       }
+               }
+               if (vecsocket != NULL) {
+                       if (link->tosock == vecsocket) {
+                               deliveringvecnode = link->fromnode;
+                               deliveringvecsocket = link->fromsock;
+                       }
+               }
+               if (colsocket != NULL) {
+                       if (link->tosock == colsocket) {
+                               deliveringcolnode = link->fromnode;
+                               deliveringcolsocket = link->fromsock;
+                       }
+               }
+       }
+       // we now have the sockets+nodes that fill the inputsockets be aware for group nodes these can be NULL
+       // now make the links for all outputlinks of the node to be reconnected
+       for(link= tree->links.first; link; link=next) {
+               next= link->next;
+               if (link->fromnode == node) {
+                       sock = link->fromsock;
+                       switch(sock->type) {
+                       case SOCK_VALUE:
+                               if (deliveringvalsocket) {
+                                       link->fromnode = deliveringvalnode;
+                                       link->fromsock = deliveringvalsocket;
+                               }
+                               break;
+                       case SOCK_VECTOR:
+                               if (deliveringvecsocket) {
+                                       link->fromnode = deliveringvecnode;
+                                       link->fromsock = deliveringvecsocket;
+                               }
+                               break;
+                       case SOCK_RGBA:
+                               if (deliveringcolsocket) {
+                                       link->fromnode = deliveringcolnode;
+                                       link->fromsock = deliveringcolsocket;
+                               }
+                               break;
+                       }
+               }
+       }
+       if(node->id)
+               node->id->us--;
+       nodeFreeNode(tree, node);
+
+}
+
+static int node_delete_reconnect_exec(bContext *C, wmOperator *UNUSED(op))
+{
+       SpaceNode *snode= CTX_wm_space_node(C);
+       bNode *node, *next;
+
+       ED_preview_kill_jobs(C);
+
+       for(node= snode->edittree->nodes.first; node; node= next) {
+               next= node->next;
+               if(node->flag & SELECT) {
+                       node_delete_reconnect(snode->edittree, node);
+               }
+       }
+
+       node_tree_verify_groups(snode->nodetree);
+
+       snode_notify(C, snode);
+       snode_dag_update(C, snode);
+
+       return OPERATOR_FINISHED;
+}
+
+void NODE_OT_delete_reconnect(wmOperatorType *ot)
+{
+       /* identifiers */
+       ot->name= "Delete with reconnect";
+       ot->description = "Delete nodes; will reconnect nodes as if deletion was muted";
+       ot->idname= "NODE_OT_delete_reconnect";
+
+       /* api callbacks */
+       ot->exec= node_delete_reconnect_exec;
+       ot->poll= ED_operator_node_active;
+
+       /* flags */
+       ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+}
+
 /* ****************** Show Cyclic Dependencies Operator  ******************* */
 
 static int node_show_cycles_exec(bContext *C, wmOperator *UNUSED(op))
index a1c0f5535fe46a22d0be64f98884b3e917762ac7..9122235f33c14e241193505d722256c9f64b041f 100644 (file)
@@ -114,6 +114,7 @@ int node_render_changed_exec(bContext *, wmOperator *);
 
 void NODE_OT_duplicate(struct wmOperatorType *ot);
 void NODE_OT_delete(struct wmOperatorType *ot);
+void NODE_OT_delete_reconnect(struct wmOperatorType *ot);
 void NODE_OT_resize(struct wmOperatorType *ot);
 
 void NODE_OT_link(struct wmOperatorType *ot);
index 11e7949791dd6f58ba3040c6f50250cc5093a238..4d181a3489489e75d3795e7609882755adffc037 100644 (file)
@@ -70,12 +70,13 @@ void node_operatortypes(void)
        
        WM_operatortype_append(NODE_OT_duplicate);
        WM_operatortype_append(NODE_OT_delete);
+       WM_operatortype_append(NODE_OT_delete_reconnect);
        WM_operatortype_append(NODE_OT_resize);
        
        WM_operatortype_append(NODE_OT_link);
        WM_operatortype_append(NODE_OT_link_make);
        WM_operatortype_append(NODE_OT_links_cut);
-       
+
        WM_operatortype_append(NODE_OT_group_make);
        WM_operatortype_append(NODE_OT_group_ungroup);
        WM_operatortype_append(NODE_OT_group_edit);
@@ -108,8 +109,7 @@ void ED_operatormacros_node(void)
        ot= WM_operatortype_append_macro("NODE_OT_select_link_viewer", "Link Viewer", OPTYPE_UNDO);
        WM_operatortype_macro_define(ot, "NODE_OT_select");
        WM_operatortype_macro_define(ot, "NODE_OT_link_viewer");
-       
-}
+       }
 
 void node_keymap(struct wmKeyConfig *keyconf)
 {
@@ -167,6 +167,7 @@ void node_keymap(struct wmKeyConfig *keyconf)
        WM_keymap_add_item(keymap, "NODE_OT_select_border", BKEY, KM_PRESS, 0, 0);
        WM_keymap_add_item(keymap, "NODE_OT_delete", XKEY, KM_PRESS, 0, 0);
        WM_keymap_add_item(keymap, "NODE_OT_delete", DELKEY, KM_PRESS, 0, 0);
+       WM_keymap_add_item(keymap, "NODE_OT_delete_reconnect", XKEY, KM_PRESS, KM_CTRL, 0);
 
        WM_keymap_add_item(keymap, "NODE_OT_select_all", AKEY, KM_PRESS, 0, 0);
        WM_keymap_add_item(keymap, "NODE_OT_select_linked_to", LKEY, KM_PRESS, KM_SHIFT, 0);
index 549a547b84689b7c0a1304457f1d854e8e7603cd..ef7ada85843dd786b6dc65460634004c28760b11 100644 (file)
@@ -966,13 +966,13 @@ static void v3d_editarmature_buts(uiLayout *layout, Object *ob)
        
        ebone= arm->act_edbone;
 
-       if (!ebone || (ebone->layer & arm->layer)==0)
+       if (!ebone || (ebone->layer & arm->layer)==0) {
+               uiItemL(col, "Nothing selected", ICON_NONE);
                return;
-       
+       }
 //     row= uiLayoutRow(layout, 0);
        RNA_pointer_create(&arm->id, &RNA_EditBone, ebone, &eboneptr);
 
-
        col= uiLayoutColumn(layout, 0);
        uiItemR(col, &eboneptr, "head", 0, "Head", ICON_NONE);
        if (ebone->parent && ebone->flag & BONE_CONNECTED ) {
@@ -1256,7 +1256,7 @@ static void view3d_panel_object(const bContext *C, Panel *pa)
 
        if(ob==obedit) {
                if(ob->type==OB_ARMATURE) v3d_editarmature_buts(col, ob);
-               if(ob->type==OB_MBALL) v3d_editmetaball_buts(col, ob);
+               else if(ob->type==OB_MBALL) v3d_editmetaball_buts(col, ob);
                else v3d_editvertex_buts(col, v3d, ob, lim);
        }
        else if(ob->mode & OB_MODE_POSE) {
index 2b33126b3a769bfc30d6d0726df9ea20594cabff..718578a921b3a691e361cdafc45fa1800aa7b37b 100644 (file)
@@ -387,7 +387,7 @@ static void bokeh_single_image(bNode *node, CompBuf *new, CompBuf *img, float fa
                        float dist= sqrt(fj*fj + fi*fi);
                        
                //*dgauss= hexagon_filter(fi, fj);
-                       *dgauss= RE_filter_value(nbd->filtertype, 2.0f*dist - 1.0f);
+                       *dgauss= RE_filter_value(nbd->filtertype, dist);
 
                        val+= *dgauss;
                }
index b73a46c7d7db4c2a4f5f0a71c25a4141243f3e43..a763f34a644c75bae368bef242e671aeb298cf92 100644 (file)
@@ -132,7 +132,7 @@ void compbuf_set_node(CompBuf *cbuf, bNode *node)
        if (cbuf) cbuf->node = node;
 }
 
-/* used for disabling node  (similar code in drawnode.c for disable line) */
+/* used for disabling node  (similar code in node_draw.c for disable line and node_edit for untangling nodes) */
 void node_compo_pass_on(bNode *node, bNodeStack **nsin, bNodeStack **nsout)
 {
        CompBuf *valbuf= NULL, *colbuf= NULL, *vecbuf= NULL;