diff options
author | Julian Eisel <eiseljulian@gmail.com> | 2016-09-30 02:18:41 +0300 |
---|---|---|
committer | Julian Eisel <eiseljulian@gmail.com> | 2016-09-30 02:18:41 +0300 |
commit | 42ed1f0e3cbd9d477b7a535b52030c7905ca5362 (patch) | |
tree | 2dec6287c35367d6771b38327642db8a7f8f3c49 | |
parent | 47bba7e15f4b7a105655b81affea9f2d48a3a767 (diff) | |
parent | 344a669c412a5eb5b71555a18aa85ef7a16b253f (diff) |
Merge branch 'master' into blender2.8
Conflicts:
source/blender/blenloader/intern/writefile.c
18 files changed, 411 insertions, 273 deletions
diff --git a/build_files/cmake/platform/platform_win32_msvc.cmake b/build_files/cmake/platform/platform_win32_msvc.cmake index 5efda52b2c5..961cada037e 100644 --- a/build_files/cmake/platform/platform_win32_msvc.cmake +++ b/build_files/cmake/platform/platform_win32_msvc.cmake @@ -414,7 +414,7 @@ if(WITH_OPENCOLORIO) endif() if(WITH_OPENVDB) - set(BLOSC_LIBRARIES optimized ${LIBDIR}/blosc/lib/libblosc.lib debug ${LIBDIR}/blosc/lib/libblosc_d.lib) + set(BLOSC_LIBRARIES ${LIBDIR}/blosc/lib/libblosc.lib ) set(TBB_LIBRARIES optimized ${LIBDIR}/tbb/lib/tbb.lib debug ${LIBDIR}/tbb/lib/tbb_debug.lib) set(TBB_INCLUDE_DIR ${LIBDIR}/tbb/include) set(OPENVDB ${LIBDIR}/openvdb) diff --git a/intern/cycles/kernel/closure/bsdf.h b/intern/cycles/kernel/closure/bsdf.h index 1e7fbdb5450..2ab92badc93 100644 --- a/intern/cycles/kernel/closure/bsdf.h +++ b/intern/cycles/kernel/closure/bsdf.h @@ -374,6 +374,8 @@ ccl_device bool bsdf_merge(ShaderClosure *a, ShaderClosure *b) default: return false; } +#else + return false; #endif } diff --git a/intern/cycles/kernel/closure/bsdf_microfacet.h b/intern/cycles/kernel/closure/bsdf_microfacet.h index 9da73f66da0..7c36f05b6cc 100644 --- a/intern/cycles/kernel/closure/bsdf_microfacet.h +++ b/intern/cycles/kernel/closure/bsdf_microfacet.h @@ -267,7 +267,7 @@ ccl_device bool bsdf_microfacet_merge(const ShaderClosure *a, const ShaderClosur (isequal_float3(bsdf_a->T, bsdf_b->T)) && (bsdf_a->ior == bsdf_b->ior) && ((!bsdf_a->extra && !bsdf_b->extra) || - ((bsdf_a->extra && bsdf_b->extra) && + ((bsdf_a->extra && bsdf_b->extra) && (isequal_float3(bsdf_a->extra->color, bsdf_b->extra->color)))); } diff --git a/intern/cycles/kernel/kernel_shader.h b/intern/cycles/kernel/kernel_shader.h index c36d9404669..3e098c922dc 100644 --- a/intern/cycles/kernel/kernel_shader.h +++ b/intern/cycles/kernel/kernel_shader.h @@ -851,11 +851,11 @@ ccl_device void shader_eval_surface(KernelGlobals *kg, ShaderData *sd, ccl_addr_ #ifdef __SVM__ svm_eval_nodes(kg, sd, state, SHADER_TYPE_SURFACE, path_flag); #else - ccl_fetch_array(sd, closure, 0)->weight = make_float3(0.8f, 0.8f, 0.8f); - ccl_fetch_array(sd, closure, 0)->N = ccl_fetch(sd, N); - ccl_fetch_array(sd, closure, 0)->data0 = 0.0f; - ccl_fetch_array(sd, closure, 0)->data1 = 0.0f; - ccl_fetch(sd, flag) |= bsdf_diffuse_setup(ccl_fetch_array(sd, closure, 0)); + DiffuseBsdf *bsdf = (DiffuseBsdf*)bsdf_alloc(sd, + sizeof(DiffuseBsdf), + make_float3(0.8f, 0.8f, 0.8f)); + bsdf->N = ccl_fetch(sd, N); + ccl_fetch(sd, flag) |= bsdf_diffuse_setup(bsdf); #endif } diff --git a/intern/ghost/intern/GHOST_SystemCocoa.mm b/intern/ghost/intern/GHOST_SystemCocoa.mm index f31cba498e5..173f59c9c8f 100644 --- a/intern/ghost/intern/GHOST_SystemCocoa.mm +++ b/intern/ghost/intern/GHOST_SystemCocoa.mm @@ -90,8 +90,7 @@ static GHOST_TButtonMask convertButton(int button) * \return Ghost key code */ static GHOST_TKey convertKey(int rawCode, unichar recvChar, UInt16 keyAction) -{ - +{ //printf("\nrecvchar %c 0x%x",recvChar,recvChar); switch (rawCode) { /*Physical keycodes not used due to map changes in int'l keyboards @@ -121,7 +120,7 @@ static GHOST_TKey convertKey(int rawCode, unichar recvChar, UInt16 keyAction) case kVK_ANSI_X: return GHOST_kKeyX; case kVK_ANSI_Y: return GHOST_kKeyY; case kVK_ANSI_Z: return GHOST_kKeyZ;*/ - + /* Numbers keys mapped to handle some int'l keyboard (e.g. French)*/ case kVK_ISO_Section: return GHOST_kKeyUnknown; case kVK_ANSI_1: return GHOST_kKey1; @@ -134,7 +133,7 @@ static GHOST_TKey convertKey(int rawCode, unichar recvChar, UInt16 keyAction) case kVK_ANSI_8: return GHOST_kKey8; case kVK_ANSI_9: return GHOST_kKey9; case kVK_ANSI_0: return GHOST_kKey0; - + case kVK_ANSI_Keypad0: return GHOST_kKeyNumpad0; case kVK_ANSI_Keypad1: return GHOST_kKeyNumpad1; case kVK_ANSI_Keypad2: return GHOST_kKeyNumpad2; @@ -173,24 +172,24 @@ static GHOST_TKey convertKey(int rawCode, unichar recvChar, UInt16 keyAction) case kVK_F18: return GHOST_kKeyF18; case kVK_F19: return GHOST_kKeyF19; case kVK_F20: return GHOST_kKeyF20; - + case kVK_UpArrow: return GHOST_kKeyUpArrow; case kVK_DownArrow: return GHOST_kKeyDownArrow; case kVK_LeftArrow: return GHOST_kKeyLeftArrow; case kVK_RightArrow: return GHOST_kKeyRightArrow; - + case kVK_Return: return GHOST_kKeyEnter; case kVK_Delete: return GHOST_kKeyBackSpace; case kVK_ForwardDelete: return GHOST_kKeyDelete; case kVK_Escape: return GHOST_kKeyEsc; case kVK_Tab: return GHOST_kKeyTab; case kVK_Space: return GHOST_kKeySpace; - + case kVK_Home: return GHOST_kKeyHome; case kVK_End: return GHOST_kKeyEnd; case kVK_PageUp: return GHOST_kKeyUpPage; case kVK_PageDown: return GHOST_kKeyDownPage; - + /*case kVK_ANSI_Minus: return GHOST_kKeyMinus; case kVK_ANSI_Equal: return GHOST_kKeyEqual; case kVK_ANSI_Comma: return GHOST_kKeyComma; @@ -202,12 +201,12 @@ static GHOST_TKey convertKey(int rawCode, unichar recvChar, UInt16 keyAction) case kVK_ANSI_LeftBracket: return GHOST_kKeyLeftBracket; case kVK_ANSI_RightBracket: return GHOST_kKeyRightBracket; case kVK_ANSI_Grave: return GHOST_kKeyAccentGrave;*/ - + case kVK_VolumeUp: case kVK_VolumeDown: case kVK_Mute: return GHOST_kKeyUnknown; - + default: { /* alphanumerical or punctuation key that is remappable in int'l keyboards */ @@ -221,11 +220,11 @@ static GHOST_TKey convertKey(int rawCode, unichar recvChar, UInt16 keyAction) /* Leopard and Snow Leopard 64bit compatible API*/ CFDataRef uchrHandle; /*the keyboard layout*/ TISInputSourceRef kbdTISHandle; - + kbdTISHandle = TISCopyCurrentKeyboardLayoutInputSource(); uchrHandle = (CFDataRef)TISGetInputSourceProperty(kbdTISHandle,kTISPropertyUnicodeKeyLayoutData); CFRelease(kbdTISHandle); - + /*get actual character value of the "remappable" keys in int'l keyboards, if keyboard layout is not correctly reported (e.g. some non Apple keyboards in Tiger), then fallback on using the received charactersIgnoringModifiers */ @@ -235,7 +234,6 @@ static GHOST_TKey convertKey(int rawCode, unichar recvChar, UInt16 keyAction) UCKeyTranslate((UCKeyboardLayout*)CFDataGetBytePtr(uchrHandle), rawCode, keyAction, 0, LMGetKbdType(), kUCKeyTranslateNoDeadKeysBit, &deadKeyState, 1, &actualStrLength, &recvChar); - } switch (recvChar) { @@ -285,7 +283,17 @@ extern "C" int GHOST_HACK_getFirstFile(char buf[FIRSTFILEBUFLG]) * CocoaAppDelegate * ObjC object to capture applicationShouldTerminate, and send quit event **/ +#if defined(__clang_major__) && __clang_major__ <= 7 +/* FIXME(merwin & Juicyfruit): long-term fix for proper protocol to use + * merwin thinks NSApplicationDelegate is the correct protocol here. Has been around since 10.6 so we should be good... what's the problem? + * https://developer.apple.com/reference/appkit/nsapplicationdelegate?language=objc + */ +@interface CocoaAppDelegate : NSObject <NSFileManagerDelegate> { +#else +/* for Xcode 8 */ @interface CocoaAppDelegate : NSObject <NSApplicationDelegate> { +#endif + GHOST_SystemCocoa *systemCocoa; } - (void)setSystemCocoa:(GHOST_SystemCocoa *)sysCocoa; @@ -321,7 +329,7 @@ extern "C" int GHOST_HACK_getFirstFile(char buf[FIRSTFILEBUFLG]) { //TODO: implement graceful termination through Cocoa mechanism to avoid session log off to be canceled //Note that Cmd+Q is already handled by keyhandler - if (systemCocoa->handleQuitRequest() == GHOST_kExitNow) + if (systemCocoa->handleQuitRequest() == GHOST_kExitNow) return NSTerminateCancel;//NSTerminateNow; else return NSTerminateCancel; @@ -356,7 +364,7 @@ GHOST_SystemCocoa::GHOST_SystemCocoa() struct timeval boottime; size_t len; char *rstring = NULL; - + m_modifierMask =0; m_cursorDelta_x=0; m_cursorDelta_y=0; @@ -370,20 +378,20 @@ GHOST_SystemCocoa::GHOST_SystemCocoa() mib[0] = CTL_KERN; mib[1] = KERN_BOOTTIME; len = sizeof(struct timeval); - + sysctl(mib, 2, &boottime, &len, NULL, 0); m_start_time = ((boottime.tv_sec*1000)+(boottime.tv_usec/1000)); - + //Detect multitouch trackpad mib[0] = CTL_HW; mib[1] = HW_MODEL; sysctl( mib, 2, NULL, &len, NULL, 0 ); rstring = (char*)malloc( len ); sysctl( mib, 2, rstring, &len, NULL, 0 ); - + free( rstring ); rstring = NULL; - + m_ignoreWindowSizedMessages = false; m_ignoreMomentumScroll = false; m_multiTouchScroll = false; @@ -404,67 +412,67 @@ GHOST_TSuccess GHOST_SystemCocoa::init() #endif //ProcessSerialNumber psn; - + //Carbon stuff to move window & menu to foreground /*if (!GetCurrentProcess(&psn)) { TransformProcessType(&psn, kProcessTransformToForegroundApplication); SetFrontProcess(&psn); }*/ - + NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; [NSApplication sharedApplication]; // initializes NSApp - + if ([NSApp mainMenu] == nil) { NSMenu *mainMenubar = [[NSMenu alloc] init]; NSMenuItem *menuItem; NSMenu *windowMenu; NSMenu *appMenu; - + //Create the application menu appMenu = [[NSMenu alloc] initWithTitle:@"Blender"]; - + [appMenu addItemWithTitle:@"About Blender" action:@selector(orderFrontStandardAboutPanel:) keyEquivalent:@""]; [appMenu addItem:[NSMenuItem separatorItem]]; - + menuItem = [appMenu addItemWithTitle:@"Hide Blender" action:@selector(hide:) keyEquivalent:@"h"]; [menuItem setKeyEquivalentModifierMask:NSCommandKeyMask]; - + menuItem = [appMenu addItemWithTitle:@"Hide others" action:@selector(hideOtherApplications:) keyEquivalent:@"h"]; [menuItem setKeyEquivalentModifierMask:(NSAlternateKeyMask | NSCommandKeyMask)]; - + [appMenu addItemWithTitle:@"Show All" action:@selector(unhideAllApplications:) keyEquivalent:@""]; - + menuItem = [appMenu addItemWithTitle:@"Quit Blender" action:@selector(terminate:) keyEquivalent:@"q"]; [menuItem setKeyEquivalentModifierMask:NSCommandKeyMask]; - + menuItem = [[NSMenuItem alloc] init]; [menuItem setSubmenu:appMenu]; - + [mainMenubar addItem:menuItem]; [menuItem release]; [NSApp performSelector:@selector(setAppleMenu:) withObject:appMenu]; //Needed for 10.5 [appMenu release]; - + //Create the window menu windowMenu = [[NSMenu alloc] initWithTitle:@"Window"]; - + menuItem = [windowMenu addItemWithTitle:@"Minimize" action:@selector(performMiniaturize:) keyEquivalent:@"m"]; [menuItem setKeyEquivalentModifierMask:NSCommandKeyMask]; - + [windowMenu addItemWithTitle:@"Zoom" action:@selector(performZoom:) keyEquivalent:@""]; - + menuItem = [windowMenu addItemWithTitle:@"Enter Full Screen" action:@selector(toggleFullScreen:) keyEquivalent:@"f" ]; [menuItem setKeyEquivalentModifierMask:NSControlKeyMask | NSCommandKeyMask]; menuItem = [windowMenu addItemWithTitle:@"Close" action:@selector(performClose:) keyEquivalent:@"w"]; [menuItem setKeyEquivalentModifierMask:NSCommandKeyMask]; - + menuItem = [[NSMenuItem alloc] init]; [menuItem setSubmenu:windowMenu]; - + [mainMenubar addItem:menuItem]; [menuItem release]; - + [NSApp setMainMenu:mainMenubar]; [NSApp setWindowsMenu:windowMenu]; [windowMenu release]; @@ -475,7 +483,7 @@ GHOST_TSuccess GHOST_SystemCocoa::init() [appDelegate setSystemCocoa:this]; [NSApp setDelegate:appDelegate]; } - + [NSApp finishLaunching]; [pool drain]; @@ -490,11 +498,11 @@ GHOST_TUns64 GHOST_SystemCocoa::getMilliSeconds() const { //Cocoa equivalent exists in 10.6 ([[NSProcessInfo processInfo] systemUptime]) struct timeval currentTime; - + gettimeofday(¤tTime, NULL); - + //Return timestamp of system uptime - + return ((currentTime.tv_sec*1000)+(currentTime.tv_usec/1000)-m_start_time); } @@ -517,11 +525,11 @@ void GHOST_SystemCocoa::getMainDisplayDimensions(GHOST_TUns32& width, GHOST_TUns NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; //Get visible frame, that is frame excluding dock and top menu bar NSRect frame = [[NSScreen mainScreen] visibleFrame]; - + //Returns max window contents (excluding title bar...) NSRect contentRect = [NSWindow contentRectForFrameRect:frame styleMask:(NSTitledWindowMask | NSClosableWindowMask | NSMiniaturizableWindowMask)]; - + width = contentRect.size.width; height = contentRect.size.height; @@ -549,12 +557,12 @@ GHOST_IWindow* GHOST_SystemCocoa::createWindow( { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; GHOST_IWindow* window = NULL; - + //Get the available rect for including window contents NSRect frame = [[NSScreen mainScreen] visibleFrame]; NSRect contentRect = [NSWindow contentRectForFrameRect:frame styleMask:(NSTitledWindowMask | NSClosableWindowMask | NSMiniaturizableWindowMask)]; - + GHOST_TInt32 bottom = (contentRect.size.height - 1) - height - top; //Ensures window top left is inside this available rect @@ -578,7 +586,7 @@ GHOST_IWindow* GHOST_SystemCocoa::createWindow( delete window; window = NULL; } - + [pool drain]; return window; } @@ -589,7 +597,7 @@ GHOST_IWindow* GHOST_SystemCocoa::createWindow( GHOST_TSuccess GHOST_SystemCocoa::getCursorPosition(GHOST_TInt32& x, GHOST_TInt32& y) const { NSPoint mouseLoc = [NSEvent mouseLocation]; - + // Returns the mouse location in screen coordinates x = (GHOST_TInt32)mouseLoc.x; y = (GHOST_TInt32)mouseLoc.y; @@ -609,11 +617,11 @@ GHOST_TSuccess GHOST_SystemCocoa::setCursorPosition(GHOST_TInt32 x, GHOST_TInt32 CGAssociateMouseAndMouseCursorPosition(false); setMouseCursorPosition(x, y); CGAssociateMouseAndMouseCursorPosition(true); - + //Force mouse move event (not pushed by Cocoa) pushEvent(new GHOST_EventCursor(getMilliSeconds(), GHOST_kEventCursorMove, window, x, y)); m_outsideLoopEventProcessed = true; - + return GHOST_kSuccess; } @@ -626,11 +634,11 @@ GHOST_TSuccess GHOST_SystemCocoa::setMouseCursorPosition(GHOST_TInt32 x, GHOST_T NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; NSScreen *windowScreen = window->getScreen(); NSRect screenRect = [windowScreen frame]; - + //Set position relative to current screen xf -= screenRect.origin.x; yf -= screenRect.origin.y; - + //Quartz Display Services uses the old coordinates (top left origin) yf = screenRect.size.height -yf; @@ -647,7 +655,7 @@ GHOST_TSuccess GHOST_SystemCocoa::getModifierKeys(GHOST_ModifierKeys& keys) cons keys.set(GHOST_kModifierKeyLeftAlt, (m_modifierMask & NSAlternateKeyMask) ? true : false); keys.set(GHOST_kModifierKeyLeftShift, (m_modifierMask & NSShiftKeyMask) ? true : false); keys.set(GHOST_kModifierKeyLeftControl, (m_modifierMask & NSControlKeyMask) ? true : false); - + return GHOST_kSuccess; } @@ -674,13 +682,13 @@ bool GHOST_SystemCocoa::processEvents(bool waitForEvent) { bool anyProcessed = false; NSEvent *event; - + // SetMouseCoalescingEnabled(false, NULL); //TODO : implement timer ?? #if 0 do { GHOST_TimerManager* timerMgr = getTimerManager(); - + if (waitForEvent) { GHOST_TUns64 next = timerMgr->nextFireTime(); double timeOut; @@ -701,20 +709,19 @@ bool GHOST_SystemCocoa::processEvents(bool waitForEvent) anyProcessed = true; } #endif - do { NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init]; event = [NSApp nextEventMatchingMask:NSAnyEventMask - untilDate:[NSDate distantPast] - inMode:NSDefaultRunLoopMode - dequeue:YES]; + untilDate:[NSDate distantPast] + inMode:NSDefaultRunLoopMode + dequeue:YES]; if (event==nil) { [pool drain]; break; } - + anyProcessed = true; - + // Send event to NSApp to ensure Mac wide events are handled, // this will send events to CocoaWindow which will call back // to handleKeyEvent, handleMouseEvent and handleTabletEvent @@ -743,16 +750,16 @@ bool GHOST_SystemCocoa::processEvents(bool waitForEvent) #if 0 } while (waitForEvent && !anyProcessed); // Needed only for timer implementation #endif - + if (m_needDelayedApplicationBecomeActiveEventProcessing) handleApplicationBecomeActiveEvent(); - + if (m_outsideLoopEventProcessed) { m_outsideLoopEventProcessed = false; return true; } - + m_ignoreWindowSizedMessages = false; - + return anyProcessed; } @@ -763,7 +770,7 @@ GHOST_TSuccess GHOST_SystemCocoa::handleApplicationBecomeActiveEvent() //(that is when update events are sent to another application) unsigned int modifiers; GHOST_IWindow* window = m_windowManager->getActiveWindow(); - + if (!window) { m_needDelayedApplicationBecomeActiveEventProcessing = true; return GHOST_kFailure; @@ -771,7 +778,7 @@ GHOST_TSuccess GHOST_SystemCocoa::handleApplicationBecomeActiveEvent() else m_needDelayedApplicationBecomeActiveEventProcessing = false; modifiers = [[[NSApplication sharedApplication] currentEvent] modifierFlags]; - + if ((modifiers & NSShiftKeyMask) != (m_modifierMask & NSShiftKeyMask)) { pushEvent( new GHOST_EventKey(getMilliSeconds(), (modifiers & NSShiftKeyMask) ? GHOST_kEventKeyDown : GHOST_kEventKeyUp, window, GHOST_kKeyLeftShift)); } @@ -784,9 +791,9 @@ GHOST_TSuccess GHOST_SystemCocoa::handleApplicationBecomeActiveEvent() if ((modifiers & NSCommandKeyMask) != (m_modifierMask & NSCommandKeyMask)) { pushEvent( new GHOST_EventKey(getMilliSeconds(), (modifiers & NSCommandKeyMask) ? GHOST_kEventKeyDown : GHOST_kEventKeyUp, window, GHOST_kKeyOS)); } - + m_modifierMask = modifiers; - + m_outsideLoopEventProcessed = true; return GHOST_kSuccess; } @@ -861,7 +868,7 @@ GHOST_TSuccess GHOST_SystemCocoa::handleWindowEvent(GHOST_TEventType eventType, //Note: called from NSWindow subclass GHOST_TSuccess GHOST_SystemCocoa::handleDraggingEvent(GHOST_TEventType eventType, GHOST_TDragnDropTypes draggedObjectType, - GHOST_WindowCocoa* window, int mouseX, int mouseY, void* data) + GHOST_WindowCocoa* window, int mouseX, int mouseY, void* data) { if (!validWindow(window)) { return GHOST_kFailure; @@ -872,7 +879,7 @@ GHOST_TSuccess GHOST_SystemCocoa::handleDraggingEvent(GHOST_TEventType eventType case GHOST_kEventDraggingExited: pushEvent(new GHOST_EventDragnDrop(getMilliSeconds(),eventType,draggedObjectType,window,mouseX,mouseY,NULL)); break; - + case GHOST_kEventDraggingDropDone: { GHOST_TUns8 * temp_buff; @@ -884,60 +891,60 @@ GHOST_TSuccess GHOST_SystemCocoa::handleDraggingEvent(GHOST_TEventType eventType int i; if (!data) return GHOST_kFailure; - + switch (draggedObjectType) { case GHOST_kDragnDropTypeFilenames: droppedArray = (NSArray*)data; - + strArray = (GHOST_TStringArray*)malloc(sizeof(GHOST_TStringArray)); if (!strArray) return GHOST_kFailure; - + strArray->count = [droppedArray count]; if (strArray->count == 0) { free(strArray); return GHOST_kFailure; } - + strArray->strings = (GHOST_TUns8**) malloc(strArray->count*sizeof(GHOST_TUns8*)); - + for (i=0;i<strArray->count;i++) { droppedStr = [droppedArray objectAtIndex:i]; - + pastedTextSize = [droppedStr lengthOfBytesUsingEncoding:NSUTF8StringEncoding]; temp_buff = (GHOST_TUns8*) malloc(pastedTextSize+1); - + if (!temp_buff) { strArray->count = i; break; } - + strncpy((char*)temp_buff, [droppedStr cStringUsingEncoding:NSUTF8StringEncoding], pastedTextSize); temp_buff[pastedTextSize] = '\0'; - + strArray->strings[i] = temp_buff; } eventData = (GHOST_TEventDataPtr) strArray; break; - + case GHOST_kDragnDropTypeString: droppedStr = (NSString*)data; pastedTextSize = [droppedStr lengthOfBytesUsingEncoding:NSUTF8StringEncoding]; - + temp_buff = (GHOST_TUns8*) malloc(pastedTextSize+1); - + if (temp_buff == NULL) { return GHOST_kFailure; } - + strncpy((char*)temp_buff, [droppedStr cStringUsingEncoding:NSUTF8StringEncoding], pastedTextSize); - + temp_buff[pastedTextSize] = '\0'; - + eventData = (GHOST_TEventDataPtr) temp_buff; break; - + case GHOST_kDragnDropTypeBitmap: { NSImage *droppedImg = (NSImage*)data; @@ -950,13 +957,13 @@ GHOST_TSuccess GHOST_SystemCocoa::handleDraggingEvent(GHOST_TEventType eventType NSBitmapImageRep *blBitmapFormatImageRGB,*blBitmapFormatImageRGBA,*bitmapImage=nil; NSEnumerator *enumerator; NSImageRep *representation; - + ibuf = IMB_allocImBuf (imgSize.width, imgSize.height, 32, IB_rect); if (!ibuf) { [droppedImg release]; return GHOST_kFailure; } - + /*Get the bitmap of the image*/ enumerator = [[droppedImg representations] objectEnumerator]; while ((representation = [enumerator nextObject])) { @@ -966,7 +973,7 @@ GHOST_TSuccess GHOST_SystemCocoa::handleDraggingEvent(GHOST_TEventType eventType } } if (bitmapImage == nil) return GHOST_kFailure; - + if (([bitmapImage bitsPerPixel] == 32) && (([bitmapImage bitmapFormat] & 0x5) == 0) && ![bitmapImage isPlanar]) { /* Try a fast copy if the image is a meshed RGBA 32bit bitmap*/ @@ -981,26 +988,26 @@ GHOST_TSuccess GHOST_SystemCocoa::handleDraggingEvent(GHOST_TEventType eventType else { /* Tell cocoa image resolution is same as current system one */ [bitmapImage setSize:imgSize]; - + /* Convert the image in a RGBA 32bit format */ /* As Core Graphics does not support contextes with non premutliplied alpha, we need to get alpha key values in a separate batch */ - + /* First get RGB values w/o Alpha to avoid pre-multiplication, 32bit but last byte is unused */ blBitmapFormatImageRGB = [[NSBitmapImageRep alloc] initWithBitmapDataPlanes:NULL - pixelsWide:imgSize.width - pixelsHigh:imgSize.height - bitsPerSample:8 samplesPerPixel:3 hasAlpha:NO isPlanar:NO - colorSpaceName:NSDeviceRGBColorSpace - bitmapFormat:(NSBitmapFormat)0 - bytesPerRow:4*imgSize.width - bitsPerPixel:32/*RGB format padded to 32bits*/]; - + pixelsWide:imgSize.width + pixelsHigh:imgSize.height + bitsPerSample:8 samplesPerPixel:3 hasAlpha:NO isPlanar:NO + colorSpaceName:NSDeviceRGBColorSpace + bitmapFormat:(NSBitmapFormat)0 + bytesPerRow:4*imgSize.width + bitsPerPixel:32/*RGB format padded to 32bits*/]; + [NSGraphicsContext saveGraphicsState]; [NSGraphicsContext setCurrentContext:[NSGraphicsContext graphicsContextWithBitmapImageRep:blBitmapFormatImageRGB]]; [bitmapImage draw]; [NSGraphicsContext restoreGraphicsState]; - + rasterRGB = (GHOST_TUns8*)[blBitmapFormatImageRGB bitmapData]; if (rasterRGB == NULL) { [bitmapImage release]; @@ -1008,22 +1015,22 @@ GHOST_TSuccess GHOST_SystemCocoa::handleDraggingEvent(GHOST_TEventType eventType [droppedImg release]; return GHOST_kFailure; } - + /* Then get Alpha values by getting the RGBA image (that is premultiplied btw) */ blBitmapFormatImageRGBA = [[NSBitmapImageRep alloc] initWithBitmapDataPlanes:NULL - pixelsWide:imgSize.width - pixelsHigh:imgSize.height - bitsPerSample:8 samplesPerPixel:4 hasAlpha:YES isPlanar:NO - colorSpaceName:NSDeviceRGBColorSpace - bitmapFormat:(NSBitmapFormat)0 - bytesPerRow:4*imgSize.width - bitsPerPixel:32/* RGBA */]; - + pixelsWide:imgSize.width + pixelsHigh:imgSize.height + bitsPerSample:8 samplesPerPixel:4 hasAlpha:YES isPlanar:NO + colorSpaceName:NSDeviceRGBColorSpace + bitmapFormat:(NSBitmapFormat)0 + bytesPerRow:4*imgSize.width + bitsPerPixel:32/* RGBA */]; + [NSGraphicsContext saveGraphicsState]; [NSGraphicsContext setCurrentContext:[NSGraphicsContext graphicsContextWithBitmapImageRep:blBitmapFormatImageRGBA]]; [bitmapImage draw]; [NSGraphicsContext restoreGraphicsState]; - + rasterRGBA = (GHOST_TUns8*)[blBitmapFormatImageRGBA bitmapData]; if (rasterRGBA == NULL) { [bitmapImage release]; @@ -1032,26 +1039,26 @@ GHOST_TSuccess GHOST_SystemCocoa::handleDraggingEvent(GHOST_TEventType eventType [droppedImg release]; return GHOST_kFailure; } - + /*Copy the image to ibuf, flipping it vertically*/ toIBuf = (GHOST_TUns8*)ibuf->rect; for (y = 0; y < imgSize.height; y++) { for (x = 0; x < imgSize.width; x++) { to_i = (imgSize.height-y-1)*imgSize.width + x; from_i = y*imgSize.width + x; - + toIBuf[4*to_i] = rasterRGB[4*from_i]; /* R */ toIBuf[4*to_i+1] = rasterRGB[4*from_i+1]; /* G */ toIBuf[4*to_i+2] = rasterRGB[4*from_i+2]; /* B */ toIBuf[4*to_i+3] = rasterRGBA[4*from_i+3]; /* A */ } } - + [blBitmapFormatImageRGB release]; [blBitmapFormatImageRGBA release]; [droppedImg release]; } - + eventData = (GHOST_TEventDataPtr) ibuf; break; @@ -1075,11 +1082,11 @@ GHOST_TSuccess GHOST_SystemCocoa::handleDraggingEvent(GHOST_TEventType eventType GHOST_TUns8 GHOST_SystemCocoa::handleQuitRequest() { GHOST_Window* window = (GHOST_Window*)m_windowManager->getActiveWindow(); - + //Discard quit event if we are in cursor grab sequence if (window && window->getCursorGrabModeIsWarp()) return GHOST_kExitCancel; - + //Check open windows if some changes are not saved if (m_windowManager->getAnyModifiedState()) { @@ -1102,14 +1109,13 @@ GHOST_TUns8 GHOST_SystemCocoa::handleQuitRequest() handleApplicationBecomeActiveEvent(); } } - } else { pushEvent( new GHOST_Event(getMilliSeconds(), GHOST_kEventQuit, NULL) ); m_outsideLoopEventProcessed = true; return GHOST_kExitNow; } - + return GHOST_kExitCancel; } @@ -1121,11 +1127,11 @@ bool GHOST_SystemCocoa::handleOpenDocumentRequest(void *filepathStr) char * temp_buff; size_t filenameTextSize; GHOST_Window* window= (GHOST_Window*)m_windowManager->getActiveWindow(); - + if (!window) { return NO; } - + //Discard event if we are in cursor grab sequence, it'll lead to "stuck cursor" situation if the alert panel is raised if (window && window->getCursorGrabModeIsWarp()) return GHOST_kExitCancel; @@ -1134,8 +1140,8 @@ bool GHOST_SystemCocoa::handleOpenDocumentRequest(void *filepathStr) if (m_windowManager->getAnyModifiedState()) { confirmOpen = NSRunAlertPanel([NSString stringWithFormat:@"Opening %@",[filepath lastPathComponent]], - @"Current document has not been saved.\nDo you really want to proceed?", - @"Cancel", @"Open", nil); + @"Current document has not been saved.\nDo you really want to proceed?", + @"Cancel", @"Open", nil); } //Give back focus to the blender window @@ -1147,15 +1153,15 @@ bool GHOST_SystemCocoa::handleOpenDocumentRequest(void *filepathStr) if (confirmOpen == NSAlertAlternateReturn) { filenameTextSize = [filepath lengthOfBytesUsingEncoding:NSUTF8StringEncoding]; - + temp_buff = (char*) malloc(filenameTextSize+1); - + if (temp_buff == NULL) { return GHOST_kFailure; } - + strncpy(temp_buff, [filepath cStringUsingEncoding:NSUTF8StringEncoding], filenameTextSize); - + temp_buff[filenameTextSize] = '\0'; pushEvent(new GHOST_EventString(getMilliSeconds(),GHOST_kEventOpenMainFile,window,(GHOST_TEventDataPtr) temp_buff)); @@ -1169,15 +1175,15 @@ GHOST_TSuccess GHOST_SystemCocoa::handleTabletEvent(void *eventPtr, short eventT { NSEvent *event = (NSEvent *)eventPtr; GHOST_IWindow* window; - + window = m_windowManager->getWindowAssociatedWithOSWindow((void*)[event window]); if (!window) { //printf("\nW failure for event 0x%x",[event type]); return GHOST_kFailure; } - + GHOST_TabletData& ct=((GHOST_WindowCocoa*)window)->GetCocoaTabletData(); - + switch (eventType) { case NSTabletPoint: // workaround 2 cornercases: @@ -1190,7 +1196,7 @@ GHOST_TSuccess GHOST_SystemCocoa::handleTabletEvent(void *eventPtr, short eventT ct.Xtilt = [event tilt].x; ct.Ytilt = [event tilt].y; break; - + case NSTabletProximity: ct.Pressure = 0; ct.Xtilt = 0; @@ -1241,7 +1247,6 @@ bool GHOST_SystemCocoa::handleTabletEvent(void *eventPtr) //No tablet event included : do nothing return false; } - } #if MAC_OS_X_VERSION_MAX_ALLOWED < 1070 @@ -1270,7 +1275,7 @@ GHOST_TSuccess GHOST_SystemCocoa::handleMouseEvent(void *eventPtr) NSEvent *event = (NSEvent *)eventPtr; GHOST_WindowCocoa* window; CocoaWindow *cocoawindow; - + /* [event window] returns other windows if mouse-over, that's OSX input standard however, if mouse exits window(s), the windows become inactive, until you click. We then fall back to the active window from ghost */ @@ -1284,7 +1289,7 @@ GHOST_TSuccess GHOST_SystemCocoa::handleMouseEvent(void *eventPtr) } cocoawindow = (CocoaWindow *)window->getOSWindow(); - + switch ([event type]) { case NSLeftMouseDown: pushEvent(new GHOST_EventButton([event timestamp] * 1000, GHOST_kEventButtonDown, window, GHOST_kButtonMaskLeft)); @@ -1311,13 +1316,13 @@ GHOST_TSuccess GHOST_SystemCocoa::handleMouseEvent(void *eventPtr) pushEvent(new GHOST_EventButton([event timestamp] * 1000, GHOST_kEventButtonUp, window, convertButton([event buttonNumber]))); handleTabletEvent(event); //Handle tablet events combined with mouse events break; - + case NSLeftMouseDragged: case NSRightMouseDragged: case NSOtherMouseDragged: //Handle tablet events combined with mouse events handleTabletEvent(event); - + case NSMouseMoved: { GHOST_TGrabCursorMode grab_mode = window->getCursorGrabMode(); @@ -1333,15 +1338,15 @@ GHOST_TSuccess GHOST_SystemCocoa::handleMouseEvent(void *eventPtr) case GHOST_kGrabHide: //Cursor hidden grab operation : no cursor move { GHOST_TInt32 x_warp, y_warp, x_accum, y_accum, x, y; - + window->getCursorGrabInitPos(x_warp, y_warp); window->screenToClientIntern(x_warp, y_warp, x_warp, y_warp); - + window->getCursorGrabAccum(x_accum, y_accum); x_accum += [event deltaX]; y_accum += -[event deltaY]; //Strange Apple implementation (inverted coordinates for the deltaY) ... window->setCursorGrabAccum(x_accum, y_accum); - + window->clientToScreenIntern(x_warp+x_accum, y_warp+y_accum, x, y); pushEvent(new GHOST_EventCursor([event timestamp] * 1000, GHOST_kEventCursorMove, window, x, y)); break; @@ -1353,38 +1358,37 @@ GHOST_TSuccess GHOST_SystemCocoa::handleMouseEvent(void *eventPtr) GHOST_TInt32 y_mouse= mousePos.y; GHOST_TInt32 x_accum, y_accum, x_cur, y_cur, x, y; GHOST_Rect bounds, windowBounds, correctedBounds; - + /* fallback to window bounds */ if (window->getCursorGrabBounds(bounds) == GHOST_kFailure) window->getClientBounds(bounds); - + //Switch back to Cocoa coordinates orientation (y=0 at botton,the same as blender internal btw!), and to client coordinates window->getClientBounds(windowBounds); window->screenToClient(bounds.m_l, bounds.m_b, correctedBounds.m_l, correctedBounds.m_t); window->screenToClient(bounds.m_r, bounds.m_t, correctedBounds.m_r, correctedBounds.m_b); correctedBounds.m_b = (windowBounds.m_b - windowBounds.m_t) - correctedBounds.m_b; correctedBounds.m_t = (windowBounds.m_b - windowBounds.m_t) - correctedBounds.m_t; - + //Update accumulation counts window->getCursorGrabAccum(x_accum, y_accum); x_accum += [event deltaX]-m_cursorDelta_x; y_accum += -[event deltaY]-m_cursorDelta_y; //Strange Apple implementation (inverted coordinates for the deltaY) ... window->setCursorGrabAccum(x_accum, y_accum); - - + //Warp mouse cursor if needed x_mouse += [event deltaX]-m_cursorDelta_x; y_mouse += -[event deltaY]-m_cursorDelta_y; correctedBounds.wrapPoint(x_mouse, y_mouse, 2); - + //Compensate for mouse moved event taking cursor position set into account m_cursorDelta_x = x_mouse-mousePos.x; m_cursorDelta_y = y_mouse-mousePos.y; - + //Set new cursor position window->clientToScreenIntern(x_mouse, y_mouse, x_cur, y_cur); setMouseCursorPosition(x_cur, y_cur); /* wrap */ - + //Post event window->getCursorGrabInitPos(x_cur, y_cur); window->screenToClientIntern(x_cur, y_cur, x_cur, y_cur); @@ -1397,7 +1401,7 @@ GHOST_TSuccess GHOST_SystemCocoa::handleMouseEvent(void *eventPtr) //Normal cursor operation: send mouse position in window NSPoint mousePos = [cocoawindow mouseLocationOutsideOfEventStream]; GHOST_TInt32 x, y; - + window->clientToScreenIntern(mousePos.x, mousePos.y, x, y); pushEvent(new GHOST_EventCursor([event timestamp] * 1000, GHOST_kEventCursorMove, window, x, y)); @@ -1413,7 +1417,7 @@ GHOST_TSuccess GHOST_SystemCocoa::handleMouseEvent(void *eventPtr) { NSEventPhase momentumPhase = NSEventPhaseNone; NSEventPhase phase = NSEventPhaseNone; - + if ([event respondsToSelector:@selector(momentumPhase)]) momentumPhase = [event momentumPhase]; if ([event respondsToSelector:@selector(phase)]) @@ -1442,12 +1446,12 @@ GHOST_TSuccess GHOST_SystemCocoa::handleMouseEvent(void *eventPtr) /* standard scrollwheel case, if no swiping happened, and no momentum (kinetic scroll) works */ if (!m_multiTouchScroll && momentumPhase == NSEventPhaseNone) { GHOST_TInt32 delta; - + double deltaF = [event deltaY]; if (deltaF == 0.0) deltaF = [event deltaX]; // make blender decide if it's horizontal scroll if (deltaF == 0.0) break; //discard trackpad delta=0 events - + delta = deltaF > 0.0 ? 1 : -1; pushEvent(new GHOST_EventWheel([event timestamp] * 1000, window, delta)); } @@ -1461,34 +1465,33 @@ GHOST_TSuccess GHOST_SystemCocoa::handleMouseEvent(void *eventPtr) /* with 10.7 nice scrolling deltas are supported */ dx = [event scrollingDeltaX]; dy = [event scrollingDeltaY]; - + /* however, wacom tablet (intuos5) needs old deltas, it then has momentum and phase at zero */ if (phase == NSEventPhaseNone && momentumPhase == NSEventPhaseNone) { dx = [event deltaX]; dy = [event deltaY]; } - #else /* trying to pretend you have nice scrolls... */ dx = [event deltaX]; dy = -[event deltaY]; const double deltaMax = 50.0; - + if ((dx == 0) && (dy == 0)) break; - + /* Quadratic acceleration */ dx = dx*(fabs(dx) + 0.5); if (dx < 0.0) dx -= 0.5; else dx += 0.5; if (dx < -deltaMax) dx = -deltaMax; else if (dx > deltaMax) dx = deltaMax; - + dy = dy*(fabs(dy) + 0.5); if (dy < 0.0) dy -= 0.5; else dy += 0.5; if (dy < -deltaMax) dy= -deltaMax; else if (dy > deltaMax) dy= deltaMax; - + dy = -dy; #endif window->clientToScreenIntern(mousePos.x, mousePos.y, x, y); @@ -1497,7 +1500,7 @@ GHOST_TSuccess GHOST_SystemCocoa::handleMouseEvent(void *eventPtr) } } break; - + case NSEventTypeMagnify: { NSPoint mousePos = [cocoawindow mouseLocationOutsideOfEventStream]; @@ -1514,13 +1517,13 @@ GHOST_TSuccess GHOST_SystemCocoa::handleMouseEvent(void *eventPtr) GHOST_TInt32 x, y; window->clientToScreenIntern(mousePos.x, mousePos.y, x, y); pushEvent(new GHOST_EventTrackpad([event timestamp] * 1000, window, GHOST_kTrackpadEventRotate, x, y, - -[event rotation] * 5.0, 0)); + [event rotation] * 5.0, 0)); } default: return GHOST_kFailure; break; } - + return GHOST_kSuccess; } @@ -1544,7 +1547,7 @@ GHOST_TSuccess GHOST_SystemCocoa::handleKeyEvent(void *eventPtr) char utf8_buf[6]= {'\0'}; ascii = 0; - + switch ([event type]) { case NSKeyDown: @@ -1552,19 +1555,19 @@ GHOST_TSuccess GHOST_SystemCocoa::handleKeyEvent(void *eventPtr) charsIgnoringModifiers = [event charactersIgnoringModifiers]; if ([charsIgnoringModifiers length] > 0) { keyCode = convertKey([event keyCode], - [charsIgnoringModifiers characterAtIndex:0], - [event type] == NSKeyDown?kUCKeyActionDown:kUCKeyActionUp); + [charsIgnoringModifiers characterAtIndex:0], + [event type] == NSKeyDown?kUCKeyActionDown:kUCKeyActionUp); } else { keyCode = convertKey([event keyCode],0, - [event type] == NSKeyDown?kUCKeyActionDown:kUCKeyActionUp); + [event type] == NSKeyDown?kUCKeyActionDown:kUCKeyActionUp); } /* handling both unicode or ascii */ characters = [event characters]; if ([characters length] > 0) { convertedCharacters = [characters dataUsingEncoding:NSUTF8StringEncoding]; - + for (int x = 0; x < [convertedCharacters length]; x++) { utf8_buf[x] = ((char*)[convertedCharacters bytes])[x]; } @@ -1591,16 +1594,16 @@ GHOST_TSuccess GHOST_SystemCocoa::handleKeyEvent(void *eventPtr) } if ([event type] == NSKeyDown) { - pushEvent( new GHOST_EventKey([event timestamp] * 1000, GHOST_kEventKeyDown, window, keyCode, ascii, utf8_buf) ); + pushEvent(new GHOST_EventKey([event timestamp] * 1000, GHOST_kEventKeyDown, window, keyCode, ascii, utf8_buf)); //printf("Key down rawCode=0x%x charsIgnoringModifiers=%c keyCode=%u ascii=%i %c utf8=%s\n",[event keyCode],[charsIgnoringModifiers length]>0?[charsIgnoringModifiers characterAtIndex:0]:' ',keyCode,ascii,ascii, utf8_buf); } else { - pushEvent( new GHOST_EventKey([event timestamp] * 1000, GHOST_kEventKeyUp, window, keyCode, 0, NULL) ); + pushEvent(new GHOST_EventKey([event timestamp] * 1000, GHOST_kEventKeyUp, window, keyCode, 0, NULL)); //printf("Key up rawCode=0x%x charsIgnoringModifiers=%c keyCode=%u ascii=%i %c utf8=%s\n",[event keyCode],[charsIgnoringModifiers length]>0?[charsIgnoringModifiers characterAtIndex:0]:' ',keyCode,ascii,ascii, utf8_buf); } m_ignoreMomentumScroll = true; break; - + case NSFlagsChanged: modifiers = [event modifierFlags]; @@ -1616,16 +1619,16 @@ GHOST_TSuccess GHOST_SystemCocoa::handleKeyEvent(void *eventPtr) if ((modifiers & NSCommandKeyMask) != (m_modifierMask & NSCommandKeyMask)) { pushEvent(new GHOST_EventKey([event timestamp] * 1000, (modifiers & NSCommandKeyMask) ? GHOST_kEventKeyDown : GHOST_kEventKeyUp, window, GHOST_kKeyOS)); } - + m_modifierMask = modifiers; m_ignoreMomentumScroll = true; break; - + default: return GHOST_kFailure; break; } - + return GHOST_kSuccess; } @@ -1636,47 +1639,46 @@ GHOST_TUns8* GHOST_SystemCocoa::getClipboard(bool selection) const { GHOST_TUns8 * temp_buff; size_t pastedTextSize; - + NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; - + NSPasteboard *pasteBoard = [NSPasteboard generalPasteboard]; - + if (pasteBoard == nil) { [pool drain]; return NULL; } - + NSArray *supportedTypes = [NSArray arrayWithObjects: NSStringPboardType, nil]; - - NSString *bestType = [[NSPasteboard generalPasteboard] - availableTypeFromArray:supportedTypes]; - + + NSString *bestType = [[NSPasteboard generalPasteboard] availableTypeFromArray:supportedTypes]; + if (bestType == nil) { [pool drain]; return NULL; } - - NSString * textPasted = [pasteBoard stringForType:NSStringPboardType]; + + NSString *textPasted = [pasteBoard stringForType:NSStringPboardType]; if (textPasted == nil) { [pool drain]; return NULL; } - + pastedTextSize = [textPasted lengthOfBytesUsingEncoding:NSUTF8StringEncoding]; - + temp_buff = (GHOST_TUns8*) malloc(pastedTextSize+1); if (temp_buff == NULL) { [pool drain]; return NULL; } - + strncpy((char*)temp_buff, [textPasted cStringUsingEncoding:NSUTF8StringEncoding], pastedTextSize); - + temp_buff[pastedTextSize] = '\0'; - + [pool drain]; if (temp_buff) { @@ -1690,26 +1692,25 @@ GHOST_TUns8* GHOST_SystemCocoa::getClipboard(bool selection) const void GHOST_SystemCocoa::putClipboard(GHOST_TInt8 *buffer, bool selection) const { NSString *textToCopy; - + if (selection) return; // for copying the selection, used on X11 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; - + NSPasteboard *pasteBoard = [NSPasteboard generalPasteboard]; - + if (pasteBoard == nil) { [pool drain]; return; } - + NSArray *supportedTypes = [NSArray arrayWithObject:NSStringPboardType]; - + [pasteBoard declareTypes:supportedTypes owner:nil]; - + textToCopy = [NSString stringWithCString:buffer encoding:NSUTF8StringEncoding]; - + [pasteBoard setString:textToCopy forType:NSStringPboardType]; - + [pool drain]; } - diff --git a/release/scripts/modules/bl_previews_utils/bl_previews_render.py b/release/scripts/modules/bl_previews_utils/bl_previews_render.py index f7317184bd2..b4f0b8dd3b8 100644 --- a/release/scripts/modules/bl_previews_utils/bl_previews_render.py +++ b/release/scripts/modules/bl_previews_utils/bl_previews_render.py @@ -236,8 +236,8 @@ def do_previews(do_objects, do_groups, do_scenes, do_data_intern): return success def objects_render_engine_guess(obs): - for obname in obs: - ob = bpy.data.objects[obname, None] + for obname, libpath in obs: + ob = bpy.data.objects[obname, libpath] for matslot in ob.material_slots: mat = matslot.material if mat and mat.use_nodes and mat.node_tree: @@ -247,10 +247,20 @@ def do_previews(do_objects, do_groups, do_scenes, do_data_intern): return 'BLENDER_RENDER' def object_bbox_merge(bbox, ob, ob_space, offset_matrix): - if ob.bound_box: + # Take group instances into account (including linked one in this case). + if ob.type == 'EMPTY' and ob.dupli_type == 'GROUP': + grp_objects = tuple((ob.name, ob.library.filepath if ob.library else None) for ob in ob.dupli_group.objects) + if (len(grp_objects) == 0): + ob_bbox = ob.bound_box + else: + coords = objects_bbox_calc(ob_space, grp_objects, + Matrix.Translation(ob.dupli_group.dupli_offset).inverted()) + ob_bbox = ((coords[0], coords[1], coords[2]), (coords[21], coords[22], coords[23])) + elif ob.bound_box: ob_bbox = ob.bound_box else: ob_bbox = ((-ob.scale.x, -ob.scale.y, -ob.scale.z), (ob.scale.x, ob.scale.y, ob.scale.z)) + for v in ob_bbox: v = offset_matrix * Vector(v) if offset_matrix is not None else Vector(v) v = ob_space.matrix_world.inverted() * ob.matrix_world * v @@ -269,8 +279,8 @@ def do_previews(do_objects, do_groups, do_scenes, do_data_intern): def objects_bbox_calc(camera, objects, offset_matrix): bbox = (Vector((1e9, 1e9, 1e9)), Vector((-1e9, -1e9, -1e9))) - for obname in objects: - ob = bpy.data.objects[obname, None] + for obname, libpath in objects: + ob = bpy.data.objects[obname, libpath] object_bbox_merge(bbox, ob, camera, offset_matrix) # Our bbox has been generated in camera local space, bring it back in world one bbox[0][:] = camera.matrix_world * bbox[0] @@ -333,7 +343,7 @@ def do_previews(do_objects, do_groups, do_scenes, do_data_intern): continue if root.type not in OBJECT_TYPES_RENDER: continue - objects = (root.name,) + objects = ((root.name, None),) render_engine = objects_render_engine_guess(objects) render_context = render_contexts.get(render_engine, None) @@ -344,8 +354,8 @@ def do_previews(do_objects, do_groups, do_scenes, do_data_intern): scene = bpy.data.scenes[render_context.scene, None] bpy.context.screen.scene = scene - for obname in objects: - ob = bpy.data.objects[obname, None] + for obname, libpath in objects: + ob = bpy.data.objects[obname, libpath] if obname not in scene.objects: scene.objects.link(ob) ob.hide_render = False @@ -363,8 +373,8 @@ def do_previews(do_objects, do_groups, do_scenes, do_data_intern): # OverflowError: Python int too large to convert to C long # ... :( scene = bpy.data.scenes[render_context.scene, None] - for obname in objects: - ob = bpy.data.objects[obname, None] + for obname, libpath in objects: + ob = bpy.data.objects[obname, libpath] scene.objects.unlink(ob) ob.hide_render = True @@ -377,7 +387,8 @@ def do_previews(do_objects, do_groups, do_scenes, do_data_intern): for grp in ids_nolib(bpy.data.groups): if grp.name in groups_ignored: continue - objects = tuple(ob.name for ob in grp.objects) + # Here too, we do want to keep linked objects members of local group... + objects = tuple((ob.name, ob.library.filepath if ob.library else None) for ob in grp.objects) render_engine = objects_render_engine_guess(objects) render_context = render_contexts.get(render_engine, None) @@ -415,7 +426,7 @@ def do_previews(do_objects, do_groups, do_scenes, do_data_intern): objects = None if not has_camera: # We had to add a temp camera, now we need to place it to see interesting objects! - objects = tuple(ob.name for ob in scene.objects + objects = tuple((ob.name, ob.library.filepath if ob.library else None) for ob in scene.objects if (not ob.hide_render) and (ob.type in OBJECT_TYPES_RENDER)) preview_render_do(render_context, 'scenes', scene.name, objects) diff --git a/release/scripts/startup/keyingsets_builtins.py b/release/scripts/startup/keyingsets_builtins.py index 0b4fbd52b5d..97320e56378 100644 --- a/release/scripts/startup/keyingsets_builtins.py +++ b/release/scripts/startup/keyingsets_builtins.py @@ -25,6 +25,9 @@ to work correctly. Beware also about changing the order that these are defined here, since this can result in old files referring to the wrong Keying Set as the active one, potentially resulting in lost (i.e. unkeyed) animation. + +Note that these classes cannot be subclassed further; only direct subclasses of KeyingSetInfo +are supported. """ import bpy @@ -43,6 +46,7 @@ ANIM_KS_SCALING_ID = "Scaling" ANIM_KS_LOC_ROT_SCALE_ID = "LocRotScale" ANIM_KS_AVAILABLE_ID = "Available" ANIM_KS_WHOLE_CHARACTER_ID = "WholeCharacter" +ANIM_KS_WHOLE_CHARACTER_SELECTED_ID = "WholeCharacterSelected" # Location @@ -522,9 +526,35 @@ class BUILTIN_KSI_WholeCharacter(KeyingSetInfo): elif prop_rna.is_animatable: ksi.addProp(ks, bone, prop) +# All properties that are likely to get animated in a character rig, only selected bones. +class BUILTIN_KSI_WholeCharacterSelected(KeyingSetInfo): + """Insert a keyframe for all properties that are likely to get animated in a character rig """ + """(only selected bones)""" + bl_idname = ANIM_KS_WHOLE_CHARACTER_SELECTED_ID + bl_label = "Whole Character (Selected bones only)" -############################### + # iterator - all bones regardless of selection + def iterator(ksi, context, ks): + # Use either the selected bones, or all of them if none are selected. + bones = context.selected_pose_bones or context.active_object.pose.bones + + for bone in bones: + if bone.name.startswith(BUILTIN_KSI_WholeCharacter.badBonePrefixes): + continue + ksi.generate(context, ks, bone) + + # Poor man's subclassing. Blender breaks when we actually subclass BUILTIN_KSI_WholeCharacter. + poll = BUILTIN_KSI_WholeCharacter.poll + generate = BUILTIN_KSI_WholeCharacter.generate + addProp = BUILTIN_KSI_WholeCharacter.addProp + doLoc = BUILTIN_KSI_WholeCharacter.doLoc + doRot4d = BUILTIN_KSI_WholeCharacter.doRot4d + doRot3d = BUILTIN_KSI_WholeCharacter.doRot3d + doScale = BUILTIN_KSI_WholeCharacter.doScale + doBBone = BUILTIN_KSI_WholeCharacter.doBBone + doCustomProps = BUILTIN_KSI_WholeCharacter.doCustomProps +############################### # Delta Location class BUILTIN_KSI_DeltaLocation(KeyingSetInfo): diff --git a/source/blender/blenkernel/intern/dynamicpaint.c b/source/blender/blenkernel/intern/dynamicpaint.c index 419a1cd854b..587e4a35806 100644 --- a/source/blender/blenkernel/intern/dynamicpaint.c +++ b/source/blender/blenkernel/intern/dynamicpaint.c @@ -100,6 +100,10 @@ static const float gaussianTotal = 3.309425f; static int neighX[8] = {1, 1, 0, -1, -1, -1, 0, 1}; static int neighY[8] = {0, 1, 1, 1, 0, -1, -1, -1}; +/* Neighbor x/y list that prioritizes grid directions over diagonals */ +static int neighStraightX[8] = {1, 0, -1, 0, 1, -1, -1, 1}; +static int neighStraightY[8] = {0, 1, 0, -1, 1, 1, -1, -1}; + /* subframe_updateObject() flags */ #define SUBFRAME_RECURSION 5 /* surface_getBrushFlags() return vals */ @@ -2187,9 +2191,12 @@ static void dynamic_paint_create_uv_surface_neighbor_cb(void *userdata, const in point[0] = ((float)tx + 0.5f) / w; point[1] = ((float)ty + 0.5f) / h; - /* search through defined area for neighbor */ - for (int u = u_min; u <= u_max; u++) { - for (int v = v_min; v <= v_max; v++) { + /* search through defined area for neighbor, checking grid directions first */ + for (int ni = 0; ni < 8; ni++) { + int u = neighStraightX[ni]; + int v = neighStraightY[ni]; + + if (u >= u_min && u <= u_max && v >= v_min && v <= v_max) { /* if not this pixel itself */ if (u != 0 || v != 0) { const int ind = (tx + u) + w * (ty + v); @@ -2227,7 +2234,6 @@ static void dynamic_paint_create_uv_surface_neighbor_cb(void *userdata, const in tPoint->v2 = mloop[mlooptri[i].tri[1]].v; tPoint->v3 = mloop[mlooptri[i].tri[2]].v; - u = u_max + 1; /* make sure we exit outer loop as well */ break; } } @@ -2399,7 +2405,22 @@ static int dynamic_paint_find_neighbour_pixel( ((s_uv2[0] == t_uv1[0] && s_uv2[1] == t_uv1[1]) && (s_uv1[0] == t_uv2[0] && s_uv1[1] == t_uv2[1]))) { - return ((px + neighX[n_index]) + w * (py + neighY[n_index])); + final_index = x + w * y; + + /* If not an active pixel, bail out */ + if (tempPoints[final_index].tri_index == -1) + return NOT_FOUND; + + /* If final point is an "edge pixel", use it's "real" neighbor instead */ + if (tempPoints[final_index].neighbour_pixel != -1) { + final_index = tempPoints[final_index].neighbour_pixel; + + /* If we ended up to our origin point */ + if (final_index == (px + w * py)) + return NOT_FOUND; + } + + return final_index; } /* @@ -2421,8 +2442,8 @@ static int dynamic_paint_find_neighbour_pixel( copy_v2_v2(pixel, mloopuv[mlooptri[target_tri].tri[target_uv1]].uv); add_v2_v2(pixel, dir_vec); - pixel[0] = (pixel[0] * (float)w) - 0.5f; - pixel[1] = (pixel[1] * (float)h) - 0.5f; + pixel[0] = (pixel[0] * (float)w); + pixel[1] = (pixel[1] * (float)h); final_pixel[0] = (int)floorf(pixel[0]); final_pixel[1] = (int)floorf(pixel[1]); @@ -2441,8 +2462,13 @@ static int dynamic_paint_find_neighbour_pixel( return NOT_FOUND; /* If final point is an "edge pixel", use it's "real" neighbor instead */ - if (tempPoints[final_index].neighbour_pixel != -1) - final_index = cPoint->neighbour_pixel; + if (tempPoints[final_index].neighbour_pixel != -1) { + final_index = tempPoints[final_index].neighbour_pixel; + + /* If we ended up to our origin point */ + if (final_index == (px + w * py)) + return NOT_FOUND; + } return final_index; } @@ -2601,6 +2627,7 @@ int dynamicPaint_createUVSurface(Scene *scene, DynamicPaintSurface *surface, flo const int index = tx + w * ty; if (tempPoints[index].tri_index != -1) { + int start_pos = n_pos; ed->n_index[final_index[index]] = n_pos; ed->n_num[final_index[index]] = 0; @@ -2609,10 +2636,20 @@ int dynamicPaint_createUVSurface(Scene *scene, DynamicPaintSurface *surface, flo const int n_target = dynamic_paint_find_neighbour_pixel( &data, vert_to_looptri_map, w, h, tx, ty, i); - if (n_target >= 0) { - ed->n_target[n_pos] = final_index[n_target]; - ed->n_num[final_index[index]]++; - n_pos++; + if (n_target >= 0 && n_target != index) { + bool duplicate = false; + for (int j = start_pos; j < n_pos; j++) { + if (ed->n_target[j] == final_index[n_target]) { + duplicate = true; + break; + } + } + + if (!duplicate) { + ed->n_target[n_pos] = final_index[n_target]; + ed->n_num[final_index[index]]++; + n_pos++; + } } else if (n_target == ON_MESH_EDGE || n_target == OUT_OF_TEXTURE) { ed->flags[final_index[index]] |= ADJ_ON_MESH_EDGE; @@ -4455,6 +4492,8 @@ static void dynamic_paint_effect_drip_cb(void *userdata, const int index) return; CLAMP(w_factor, 0.0f, 1.0f); + float ppoint_wetness_diff = 0.0f; + /* get force affect points */ surface_determineForceTargetPoints(sData, index, &force[index * 4], closest_d, closest_id); @@ -4476,9 +4515,9 @@ static void dynamic_paint_effect_drip_cb(void *userdata, const int index) /* Sort of spinlock, but only for given ePoint. * Since the odds a same ePoint is modified at the same time by several threads is very low, this is * much more efficient than a global spin lock. */ - const unsigned int pointlock_idx = n_trgt / 8; - const uint8_t pointlock_bitmask = 1 << (n_trgt & 7); /* 7 == 0b111 */ - while (atomic_fetch_and_or_uint8(&point_locks[pointlock_idx], pointlock_bitmask) & pointlock_bitmask); + const unsigned int epointlock_idx = n_trgt / 8; + const uint8_t epointlock_bitmask = 1 << (n_trgt & 7); /* 7 == 0b111 */ + while (atomic_fetch_and_or_uint8(&point_locks[epointlock_idx], epointlock_bitmask) & epointlock_bitmask); PaintPoint *ePoint = &((PaintPoint *)sData->type_data)[n_trgt]; const float e_wet = ePoint->wetness; @@ -4499,18 +4538,38 @@ static void dynamic_paint_effect_drip_cb(void *userdata, const int index) CLAMP_MAX(ePoint->e_color[3], pPoint_prev->e_color[3]); } - /* decrease paint wetness on current point */ - pPoint->wetness -= (ePoint->wetness - e_wet); - CLAMP(pPoint->wetness, 0.0f, MAX_WETNESS); + /* Decrease paint wetness on current point + * (just store diff here, that way we can only lock current point once at the end to apply it). */ + ppoint_wetness_diff += (ePoint->wetness - e_wet); #ifndef NDEBUG - uint8_t ret = atomic_fetch_and_and_uint8(&point_locks[pointlock_idx], ~pointlock_bitmask); - BLI_assert(ret & pointlock_bitmask); + { + uint8_t ret = atomic_fetch_and_and_uint8(&point_locks[epointlock_idx], ~epointlock_bitmask); + BLI_assert(ret & epointlock_bitmask); + } #else - atomic_fetch_and_and_uint8(&point_locks[pointlock_idx], ~pointlock_bitmask); + atomic_fetch_and_and_uint8(&point_locks[epointlock_idx], ~epointlock_bitmask); #endif } } + + { + const unsigned int ppointlock_idx = index / 8; + const uint8_t ppointlock_bitmask = 1 << (index & 7); /* 7 == 0b111 */ + while (atomic_fetch_and_or_uint8(&point_locks[ppointlock_idx], ppointlock_bitmask) & ppointlock_bitmask); + + pPoint->wetness -= ppoint_wetness_diff; + CLAMP(pPoint->wetness, 0.0f, MAX_WETNESS); + +#ifndef NDEBUG + { + uint8_t ret = atomic_fetch_and_and_uint8(&point_locks[ppointlock_idx], ~ppointlock_bitmask); + BLI_assert(ret & ppointlock_bitmask); + } +#else + atomic_fetch_and_and_uint8(&point_locks[ppointlock_idx], ~ppointlock_bitmask); +#endif + } } static void dynamicPaint_doEffectStep( diff --git a/source/blender/blenkernel/intern/sca.c b/source/blender/blenkernel/intern/sca.c index 61aa8c7589f..c7f406089d9 100644 --- a/source/blender/blenkernel/intern/sca.c +++ b/source/blender/blenkernel/intern/sca.c @@ -789,7 +789,7 @@ void BKE_sca_logic_copy(Object *ob_new, Object *ob) copy_controllers(&ob_new->controllers, &ob->controllers); copy_actuators(&ob_new->actuators, &ob->actuators); - for (bSensor *sens = ob->sensors.first; sens; sens = sens->next) { + for (bSensor *sens = ob_new->sensors.first; sens; sens = sens->next) { if (sens->flag & SENS_NEW) { for (int a = 0; a < sens->totlinks; a++) { if (sens->links[a] && sens->links[a]->mynew) { @@ -799,7 +799,7 @@ void BKE_sca_logic_copy(Object *ob_new, Object *ob) } } - for (bController *cont = ob->controllers.first; cont; cont = cont->next) { + for (bController *cont = ob_new->controllers.first; cont; cont = cont->next) { if (cont->flag & CONT_NEW) { for (int a = 0; a < cont->totlinks; a++) { if (cont->links[a] && cont->links[a]->mynew) { diff --git a/source/blender/blenlib/intern/polyfill2d_beautify.c b/source/blender/blenlib/intern/polyfill2d_beautify.c index 46f9251bea7..896177f436c 100644 --- a/source/blender/blenlib/intern/polyfill2d_beautify.c +++ b/source/blender/blenlib/intern/polyfill2d_beautify.c @@ -239,8 +239,9 @@ static void polyedge_beauty_cost_update_single( const float cost = polyedge_rotate_beauty_calc(coords, tris, e); /* We can get cases where both choices generate very small negative costs, which leads to infinite loop. * Anyway, costs above that are not worth recomputing, maybe we could even optimize it to a smaller limit? - * See T43578. */ - if (cost < -FLT_EPSILON) { + * Actually, FLT_EPSILON is too small in some cases, 1e-6f seems to work OK hopefully? + * See T43578, T49478. */ + if (cost < -1e-6f) { eheap_table[i] = BLI_heap_insert(eheap, cost, e); } else { diff --git a/source/blender/bmesh/operators/bmo_connect_pair.c b/source/blender/bmesh/operators/bmo_connect_pair.c index 05322a570a7..a73c86fd122 100644 --- a/source/blender/bmesh/operators/bmo_connect_pair.c +++ b/source/blender/bmesh/operators/bmo_connect_pair.c @@ -48,7 +48,7 @@ * - store a heap of paths which are being scanned (#PathContext.states). * - continuously search the shortest path in the heap. * - never step over the same element twice (tag elements as #ELE_TOUCHED). - * this avoids going into an eternal loop of there are many possible branches (see T45582). + * this avoids going into an eternal loop if there are many possible branches (see T45582). * - when running into a branch, create a new #PathLinkState state and add to the heap. * - when the target is reached, finish - since none of the other paths can be shorter then the one just found. * - if the connection can't be found - fail. @@ -82,13 +82,13 @@ #define ELE_TOUCH_TEST_VERT(v) BMO_vert_flag_test(pc->bm_bmoflag, v, ELE_TOUCHED) -// #define ELE_TOUCH_MARK_VERT(v) BMO_vert_flag_enable(pc->bm_bmoflag, (BMElemF *)e, ELE_TOUCHED) +// #define ELE_TOUCH_MARK_VERT(v) BMO_vert_flag_enable(pc->bm_bmoflag, (BMElemF *)v, ELE_TOUCHED) -// #define ELE_TOUCH_TEST_EDGE(v) BMO_edge_flag_test(pc->bm_bmoflag, v, ELE_TOUCHED) -// #define ELE_TOUCH_MARK_EDGE(v) BMO_edge_flag_enable(pc->bm_bmoflag, (BMElemF *)e, ELE_TOUCHED) +#define ELE_TOUCH_TEST_EDGE(e) BMO_edge_flag_test(pc->bm_bmoflag, e, ELE_TOUCHED) +// #define ELE_TOUCH_MARK_EDGE(e) BMO_edge_flag_enable(pc->bm_bmoflag, (BMElemF *)e, ELE_TOUCHED) -// #define ELE_TOUCH_TEST_FACE(v) BMO_face_flag_test(pc->bm_bmoflag, v, ELE_TOUCHED) -// #define ELE_TOUCH_MARK_FACE(v) BMO_face_flag_enable(pc->bm_bmoflag, (BMElemF *)e, ELE_TOUCHED) +// #define ELE_TOUCH_TEST_FACE(f) BMO_face_flag_test(pc->bm_bmoflag, f, ELE_TOUCHED) +// #define ELE_TOUCH_MARK_FACE(f) BMO_face_flag_enable(pc->bm_bmoflag, (BMElemF *)f, ELE_TOUCHED) // #define DEBUG_PRINT @@ -363,7 +363,7 @@ static PathLinkState *state_step__face_edges( BMElem *ele_next_from = (BMElem *)l_iter->f; if (FACE_WALK_TEST((BMFace *)ele_next_from) && - (ELE_TOUCH_TEST_VERT((BMVert *)ele_next) == false)) + (ELE_TOUCH_TEST_EDGE((BMEdge *)ele_next) == false)) { min_dist_dir_update(mddir, dist_dir); mddir->dist_min[index] = dist_test; @@ -661,7 +661,7 @@ void bmo_connect_vert_pair_exec(BMesh *bm, BMOperator *op) while (!BLI_heap_is_empty(pc.states)) { #ifdef DEBUG_PRINT - printf("\n%s: stepping %d\n", __func__, BLI_heap_size(pc.states)); + printf("\n%s: stepping %u\n", __func__, BLI_heap_size(pc.states)); #endif while (!BLI_heap_is_empty(pc.states)) { diff --git a/source/blender/depsgraph/intern/depsgraph_eval.cc b/source/blender/depsgraph/intern/depsgraph_eval.cc index a0435c318f0..c41f28b07e8 100644 --- a/source/blender/depsgraph/intern/depsgraph_eval.cc +++ b/source/blender/depsgraph/intern/depsgraph_eval.cc @@ -33,6 +33,8 @@ #include "MEM_guardedalloc.h" extern "C" { +#include "DNA_scene_types.h" + #include "BLI_utildefines.h" #include "BLI_ghash.h" @@ -125,7 +127,14 @@ void DEG_evaluate_on_refresh(EvaluationContext *eval_ctx, /* Update time on primary timesource. */ DEG::TimeSourceDepsNode *tsrc = deg_graph->find_time_source(); tsrc->cfra = BKE_scene_frame_get(scene); - DEG::deg_evaluate_on_refresh(eval_ctx, deg_graph, deg_graph->layers); + unsigned int layers = deg_graph->layers; + /* XXX(sergey): This works around missing updates in temp scenes used + * by various scripts, but is weak and needs closer investigation. + */ + if (layers == 0) { + layers = scene->lay; + } + DEG::deg_evaluate_on_refresh(eval_ctx, deg_graph, layers); } /* Frame-change happened for root scene that graph belongs to. */ diff --git a/source/blender/editors/animation/anim_channels_defines.c b/source/blender/editors/animation/anim_channels_defines.c index 4ad593b7059..5e39e059ec9 100644 --- a/source/blender/editors/animation/anim_channels_defines.c +++ b/source/blender/editors/animation/anim_channels_defines.c @@ -389,7 +389,10 @@ static bool acf_generic_dataexpand_setting_valid(bAnimContext *ac, bAnimListElem /* select is ok for most "ds*" channels (e.g. dsmat) */ case ACHANNEL_SETTING_SELECT: return true; - + + case ACHANNEL_SETTING_ALWAYS_VISIBLE: + return true; + /* other flags are never supported */ default: return false; @@ -1703,7 +1706,10 @@ static int acf_dscam_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Setting case ACHANNEL_SETTING_SELECT: /* selected */ return ADT_UI_SELECTED; - + + case ACHANNEL_SETTING_ALWAYS_VISIBLE: + return ADT_CURVES_ALWAYS_VISIBLE; + default: /* unsupported */ return 0; } @@ -1724,6 +1730,7 @@ static void *acf_dscam_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings set case ACHANNEL_SETTING_SELECT: /* selected */ case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */ case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */ + case ACHANNEL_SETTING_ALWAYS_VISIBLE: if (ca->adt) return GET_ACF_FLAG_PTR(ca->adt->flag, type); return NULL; diff --git a/source/blender/editors/animation/anim_filter.c b/source/blender/editors/animation/anim_filter.c index c41251578e7..66e4cae2f3e 100644 --- a/source/blender/editors/animation/anim_filter.c +++ b/source/blender/editors/animation/anim_filter.c @@ -2762,6 +2762,19 @@ static bool animdata_filter_base_is_ok(bDopeSheet *ads, Scene *scene, Base *base return true; } + /* Special case. + * We don't do recursive checks for pin, but we need to deal with tricky + * setup like animated camera lens without animated camera location. + * Without such special handle here we wouldn't be able to bin such + * camera data only animation to the editor. + */ + if (ob->adt == NULL && ob->data != NULL) { + AnimData *data_adt = BKE_animdata_from_id(ob->data); + if (data_adt != NULL && (data_adt->flag & ADT_CURVES_ALWAYS_VISIBLE)) { + return true; + } + } + /* check selection and object type filters */ if ((ads->filterflag & ADS_FILTER_ONLYSEL) && !((base->flag & SELECT) /*|| (base == sce->basact)*/)) { /* only selected should be shown */ diff --git a/source/blender/editors/armature/pose_lib.c b/source/blender/editors/armature/pose_lib.c index 4af7f3f8727..9309592bb46 100644 --- a/source/blender/editors/armature/pose_lib.c +++ b/source/blender/editors/armature/pose_lib.c @@ -461,7 +461,7 @@ static int poselib_add_exec(bContext *C, wmOperator *op) bAction *act = poselib_validate(ob); bPose *pose = (ob) ? ob->pose : NULL; TimeMarker *marker; - KeyingSet *ks = ANIM_builtin_keyingset_get_named(NULL, ANIM_KS_WHOLE_CHARACTER_ID); /* this includes custom props :)*/ + KeyingSet *ks; int frame = RNA_int_get(op->ptr, "frame"); char name[64]; @@ -495,8 +495,7 @@ static int poselib_add_exec(bContext *C, wmOperator *op) BLI_uniquename(&act->markers, marker, DATA_("Pose"), '.', offsetof(TimeMarker, name), sizeof(marker->name)); /* use Keying Set to determine what to store for the pose */ - /* FIXME: in the past, the Keying Set respected selections (LocRotScale), but the current one doesn't - * (WholeCharacter) so perhaps we need either a new Keying Set, or just to add overrides here... */ + ks = ANIM_builtin_keyingset_get_named(NULL, ANIM_KS_WHOLE_CHARACTER_SELECTED_ID); /* this includes custom props :)*/ ANIM_apply_keyingset(C, NULL, act, ks, MODIFYKEY_MODE_INSERT, (float)frame); /* store new 'active' pose number */ diff --git a/source/blender/editors/include/ED_keyframing.h b/source/blender/editors/include/ED_keyframing.h index 602e203a381..07cdff687a3 100644 --- a/source/blender/editors/include/ED_keyframing.h +++ b/source/blender/editors/include/ED_keyframing.h @@ -389,6 +389,7 @@ bool ED_autokeyframe_pchan(struct bContext *C, struct Scene *scene, struct Objec #define ANIM_KS_LOC_ROT_SCALE_ID "LocRotScale" #define ANIM_KS_AVAILABLE_ID "Available" #define ANIM_KS_WHOLE_CHARACTER_ID "WholeCharacter" +#define ANIM_KS_WHOLE_CHARACTER_SELECTED_ID "WholeCharacterSelected" #ifdef __cplusplus } diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c index bc7a9989c72..af86fb72070 100644 --- a/source/blender/editors/space_view3d/view3d_view.c +++ b/source/blender/editors/space_view3d/view3d_view.c @@ -627,7 +627,10 @@ static int view3d_setobjectascamera_exec(bContext *C, wmOperator *op) .dist = &rv3d->dist, .lens = &v3d->lens}); } - WM_event_add_notifier(C, NC_SCENE | ND_RENDER_OPTIONS | NC_OBJECT | ND_DRAW, CTX_data_scene(C)); + if (v3d->scenelock) { + WM_event_add_notifier(C, NC_SCENE, scene); + } + WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, scene); } return OPERATOR_FINISHED; diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c index df6c6c913ab..6cd9fe8f525 100644 --- a/source/blender/makesrna/intern/rna_modifier.c +++ b/source/blender/makesrna/intern/rna_modifier.c @@ -918,17 +918,18 @@ static EnumPropertyItem *rna_DataTransferModifier_layers_select_src_itemf(bConte CustomData *pdata; int num_data, i; - /* XXX Is this OK? */ - dm_src = mesh_get_derived_final(dtmd->modifier.scene, ob_src, CD_MASK_BAREMESH | CD_MTEXPOLY); - pdata = dm_src->getPolyDataLayout(dm_src); - num_data = CustomData_number_of_layers(pdata, CD_MTEXPOLY); + dm_src = object_get_derived_final(ob_src, false); + if (dm_src != NULL) { + pdata = dm_src->getPolyDataLayout(dm_src); + num_data = CustomData_number_of_layers(pdata, CD_MTEXPOLY); - RNA_enum_item_add_separator(&item, &totitem); + RNA_enum_item_add_separator(&item, &totitem); - for (i = 0; i < num_data; i++) { - tmp_item.value = i; - tmp_item.identifier = tmp_item.name = CustomData_get_layer_name(pdata, CD_MTEXPOLY, i); - RNA_enum_item_add(&item, &totitem, &tmp_item); + for (i = 0; i < num_data; i++) { + tmp_item.value = i; + tmp_item.identifier = tmp_item.name = CustomData_get_layer_name(pdata, CD_MTEXPOLY, i); + RNA_enum_item_add(&item, &totitem, &tmp_item); + } } } } @@ -940,17 +941,18 @@ static EnumPropertyItem *rna_DataTransferModifier_layers_select_src_itemf(bConte CustomData *ldata; int num_data, i; - /* XXX Is this OK? */ - dm_src = mesh_get_derived_final(dtmd->modifier.scene, ob_src, CD_MASK_BAREMESH | CD_MLOOPCOL); - ldata = dm_src->getLoopDataLayout(dm_src); - num_data = CustomData_number_of_layers(ldata, CD_MLOOPCOL); + dm_src = object_get_derived_final(ob_src, false); + if (dm_src != NULL) { + ldata = dm_src->getLoopDataLayout(dm_src); + num_data = CustomData_number_of_layers(ldata, CD_MLOOPCOL); - RNA_enum_item_add_separator(&item, &totitem); + RNA_enum_item_add_separator(&item, &totitem); - for (i = 0; i < num_data; i++) { - tmp_item.value = i; - tmp_item.identifier = tmp_item.name = CustomData_get_layer_name(ldata, CD_MLOOPCOL, i); - RNA_enum_item_add(&item, &totitem, &tmp_item); + for (i = 0; i < num_data; i++) { + tmp_item.value = i; + tmp_item.identifier = tmp_item.name = CustomData_get_layer_name(ldata, CD_MLOOPCOL, i); + RNA_enum_item_add(&item, &totitem, &tmp_item); + } } } } |