This nice patch by Matt D. (matd in #blendercoders) adds three nice features that can be seen already in the other supported OSes:
* minimum window size: to prevent some bugs with the window manager of Blender, system windows cannot be resized smaller than the minimum size.
* Continuous Grab is finally in Windows! Default settings since alpha 0 already have the feature enabled by default, so grab a new build and enjoy :)
* GHOST support for drag and drop added. This prepares Blender for drag and drop from OS -> Blender. Currently not very useful, since wm needs to be readied for that. But it does work (do BF_GHOST_DEBUG=1 build and drag a file onto a Blender window).
Thanks Matt D.!
Note: this works fine when running under 10.6, even if compiled with an older sdk
Under 10.4/10.5, workaround remains to assume no modifier key is pressed when the user restores the focus to the application
The carbon GetModifierFlag function (to get the current modifier keys status) is reimplemented in cocoa only from 10.6.
So we need to use a workaround to get the correct modifiers when blender application gets focus back. Current one is to assume no modifiers.
This at least fixes the issue when blender has been hidden using Cmd+H. The Cmd modifier was still seen as ON until the user pressed again on it.
Symptom: first button drag gets stuck on values.
Cause: Buttons didn't set grab bounds, to use the whole window. But Ghost didn't do anything in that case, it left the bounds value as is. It only affected the first cursor grab, because cursor ungrab sets it to -1, which forces it to use the whole window size (checking every mouse move) for subsequent grabs.
Solution: When NULL, init bounds to window size (and don't query every mouse move).
Need to stop accumulating warp coordinates after the first cursor warp (store time of new generated event and skip warp for events time smaller).
There's some interesting X11 code in there, if people are curious.
* Added GLEW_STATIC where necessary to make Blender compile again
* First attempt at compiling blenderplayer again - compiles, but doesn't link yet
* removed deprecated SND_ functions from blenderplayer
- Drag'n'Drop events are now correctly signaled to the main loop for dispatch (these events were directly handled in cocoa callbacks without notifying the process loop)
- Fix timestamping of events & add debug print of drag'n'drop events.
The dragging sequence is performed in four phases:
- Start sequence (GHOST_kEventDraggingEntered) that tells a drag'n'drop operation has started. Already gives the object data type, and the entering mouse location
- Update mouse position (GHOST_kEventDraggingUpdated) sent upon each mouse move until the drag'n'drop operation stops, to give the updated mouse position.
Useful to highlight a potential destination, and update the status (through GHOST_setAcceptDragOperation) telling if the object can be dropped at the current cursor position.
- Abort drag'n'drop sequence (GHOST_kEventDraggingExited) sent when the user moved the mouse outside the window.
- Send the dropped data (GHOST_kEventDraggingDropDone)
- Outside of the normal sequence, dropped data can be sent (GHOST_kEventDraggingDropOnIcon). This can happen when the user drops an object on the application icon. (Also used in OSX to pass the filename of the document the user doubled-clicked in the finder)
Note that the event handler is responsible for freeing the received data.
And the mouse position is sent directly in blender client coordinates (y=0 at bottom)
The GHOST_setAcceptDragOperation(TRUE) call must be placed before the user drops the object for it to be accepted.
Current handled data types :
- Text string
- Array of filenames (full paths)
- Bitmap image (not implemented yet)
- QuickTime export fixes.
Note that QuickTime export still crashes because it tries to open a "codec settings" dialog from the rendering background thread (and not the main/UI thread).
One quick fix may be to move the movie export initialization out of the render thread back into the operator function.
But a cleaner way would be to get rid of such a carbon/win32 dialog and place the codec settings inside blender interface
(additional fields in the output panel as it is currently the case for other file formats ?).
- replace libtiff by calls to Cocoa services to load/save tiff files
(Libtiff, dynamically linked is not distributed with OS X, and would have had to be shipped for all four architectures)
The imb_cocoaLoadImage & imb_cocoaSaveImage are generic towards the bitmap format, and thus can handle TIFF, GIF, JPG, JP2000, BMP and raw camera formats (read-only for these), even if today only TIFF is used as the other formats are already handled.
- CMake updated
- scons updated (Thx to Jens Verwiebe)
Fixed gcc-4.0 compile error (cocoa)
Updated scons to build cocoa (32bit & 64bit) (Thx Jens Verwiebe for the patch):
- make sure right python is unzipped to app-bundle ( printing information at the end of compiling )
- make sure arch-setting appends needed flags ( depending on OSX-version obsolete sometimes but harmless )
- link correct frameworks depending on gfx-api ( cocoa/carbon)
- conscript prepared for cocoa objC-files
- link to openAL-framework, using the headers from blender-lib + the symbols in framework
Usage instruction:
The default build is Cocoa 32bit.
To change it, copy config/darwin-config.py to user-config.py in the blender folder, and edit:
- WITH_GHOST_COCOA & MACOSX_ARCHITECTURE variables to select cocoa/carbon, and the arch (i386, X86_64, ppc, ..)
- the libs options as usual
- use Cocoa function to convert keys character value to isoLatin-1 encoding instead of the translation table. Works better with international keyboards
- enable stereo GL option
- fix source/creator CMake file to remove unneeded folders in the app bundle (the __MACOSX stuff). (Thx jensverwiebe)
- tablet : fix pressure retrieval => value sliding now works with tablet, UV-painting is pressure sensitive, and no more crash when clicking on window minimize button with the tablet
- update CMake file to remove unneeded folders in the app bundle (the __MACOSX stuff). From Jens' patch
- fix windowDidResize event not forwarded in some cases on 10.6
- fix crash on repeated Cmd-Q + Cancel quit actions
- place stub for .blend drop on blender app icon
Auto save is now working again in 2.5. It will also remember now what
the location of the original file was when recovering it, so that
library links still work and saving the restored file does not save to
the temp directory. There is also a new Recover Auto Save operator
which will open the filebrowser in the temp directory and show the
auto saved .blends.
Implemenation Notes:
* Timer storage was moved from window to windowmanager, so we can have
windowmanager level timers too now, doesn't make sense to have
autosave timer attached to a particular window.
* FileGlobal now has a filename field storing where the file was saved.
Note that this is only used when loading a file through the recover
operators, regular file read doesn't use it, so copying the quit.blend
manually over the original file will still work as expected.
* Jobs timer no longer uses operator now, this seems more like an
internal thing, changing keymaps should not make it possible to break
the jobs manager.
* Autosave is postponed by 10 seconds when a modal operator is running,
e.g. transform or file browsing.
* Moved setting G.sce in setup_app_data before depsgraph updates, these
can use the filename for pointcaches.