Commit Graph

1215 Commits

Author SHA1 Message Date
Mike Erwin
28cf9cfd15 NDOF: fix crash on Mac with old drivers
For best results use the latest 3Dconnexion driver. But latest is only
supported on Mac OS 10.9+. We go all the way back to Mac OS 10.6 so
have to deal with older driver versions.

See the original dlclose line for my faulty assumption. Waiting to
unload the driver later fixes the crash. Newer drivers don’t seem to
have this issue.

Also removed WITH_INPUT_NDOF guards as NDOFManager.h takes care of
this. Follow-up to b10d005 a few days ago.
2016-08-21 23:09:30 -04:00
Mike Erwin
b10d0058d7 NDOF: compile 3D mouse code only if WITH_INPUT_NDOF
When WITH_INPUT_NDOF is disabled, 3D mouse handling code is removed
from:

- GHOST (was mostly done, finished the job)
- window manager
- various editors
- RNA
- keymaps

The input tab of user prefs does not show 3D mouse settings. Key map
editor does not show NDOF mappings.

DNA does not change.

On my Mac the compiled binary is 42KB smaller after this change. It
runs fine WITH_INPUT_NDOF on or off.
2016-08-18 00:22:18 -04:00
Mike Erwin
a195dd15d4 NDOF: suppress buttons debug log
Accidentally left this in the 3D mouse code. Mac only.
2016-08-18 00:22:18 -04:00
Mike Erwin
2c03d0186a OpenGL: debug context on Windows
Enable based on --debug-gpu at the command line. Linux already works
this way.

This commit in master (2.78 timeframe) is the smallest change that gets
the desired result. I did a similar commit in blender2.8. Most ongoing
GL debug work will go into 2.8, not 2.7x.

In support of T49089
2016-08-15 04:49:07 -04:00
70100b4ec7 Fix T48283: on OS X, mouse clicks not working properly if application launch takes a long time. 2016-08-03 02:39:29 +02:00
Campbell Barton
7065022f7a Fix T48901: Blender ignores xinput cursor matrix 2016-08-01 13:51:44 +10:00
Ray Molenkamp
404f41d22d [bf_intern_ghost/Windows] Cleanup
This patch addresses the following issues in bf_intern_ghost

```
Warning	C4312	'type cast': conversion from 'GHOST_TEmbedderWindowID' to 'HWND' of greater size	bf_intern_ghost	K:\BlenderGit\blender\intern\ghost\intern\GHOST_WindowWin32.cpp	179
Warning	C4312	'type cast': conversion from 'GHOST_TEmbedderWindowID' to 'HWND' of greater size	bf_intern_ghost	K:\BlenderGit\blender\intern\ghost\intern\GHOST_WindowWin32.cpp	198
```

GHOST_TEmbedderWindowID is defined as long, handles are however of pointer size,
so this should have been an issue when we moved to 64 bits, guess we got lucky.
fixed by turning GHOST_TEmbedderWindowID from long into void*

```
Warning	C4302	'reinterpret_cast': truncation from 'HKL' to 'LANGID'	bf_intern_ghost	K:\BlenderGit\blender\intern\ghost\intern\GHOST_ImeWin32.cpp	67
```

reinterpret_cast emits warnings on truncation, LOWORD does the job just
as well with no warnings.

```
Warning	C4838	conversion from 'int' to 'DWORD' requires a narrowing conversion	bf_intern_ghost	K:\BlenderGit\blender\intern\ghost\intern\GHOST_ContextWGL.cpp	734
Warning	C4838	conversion from 'int' to 'BYTE' requires a narrowing conversion	bf_intern_ghost	K:\BlenderGit\blender\intern\ghost\intern\GHOST_ContextWGL.cpp	734
```

Weird warning, it does a really bad job at telling you what parameter is
causing the warning , tuns out there's a bunch of parameters that cause it
but it still only yields a single warning, the problem is that every
(somevar ? a : b) construct results in an integer type. which needs to be
properly cast to get rid of the warning.

```
Warning	C4996	'GetVersionExA': was declared deprecated	bf_intern_ghost	K:\BlenderGit\blender\intern\ghost\intern\GHOST_WindowWin32.cpp	105
Warning	C4996	'GetVersionExA': was declared deprecated	bf_intern_ghost	K:\BlenderGit\blender\intern\ghost\intern\GHOST_WindowWin32.cpp	107
```

The warning was clear, the code not as much. The version check in place
here is quite convoluted and could be replaced by including VersionHelpers.h
and calling IsWindows7OrGreater, However, CreateInstance will just return NULL
in m_Bar if the interface is not supported, so the whole check is useless.
This however did require that the CreateInstance call actually asked for
ITaskbarList3 and not ITaskBarlist . (You're not really allowed to assign
different interface types to each-other, a roundtrip through QueryInterface
is required there, we were violating spec here by asking for ITaskBarlist and
storing it in ITaskbarList3*  )

Reviewers: sergey

Reviewed By: sergey

Subscribers: sergey

Differential Revision: https://developer.blender.org/D2094
2016-07-18 15:48:51 +02:00
Campbell Barton
8343518272 Cleanup: comment blocks 2016-07-15 02:39:45 +10:00
Campbell Barton
6ce0ddae96 GHOST/X11: Hotplug support for xinput
Allows to plug/unplug different tablets while Blender is running.

Also fixes crash unplugging tablet while Blender runs (T48750).
2016-06-28 16:08:39 +10:00
0b415700f4 Attempted fix for T48625: tablet button configured to right click not working on OS X. 2016-06-11 20:32:24 +02:00
Campbell Barton
a5788a9c47 Cleanup: brace-placement 2016-06-10 07:50:45 +10:00
Benoit Bolsee
8529b2f925 BGE: alpha on frame buffer and precedence of MSAA over swap.
A new option '-a' can be passed to the blenderplayer. It forces the
framebuffer to have an alpha channel.
This can be used in VideoTexture to return a image with alpha channel
with ImageViewport (provided alpha is set to True on the ImageViewport
object and that the background color alpha channel is 0, which is the
default).
Without the -a option, the frame buffer has no alpha channel and
ImageViewport always returns an opaque image, no matter what.
In Linux, the player window will be rendered transparently over
the desktop.
In Windows, the player window is still rendered opaque because
transparency of the window is only possible using the 'compositing'
functions of Windows. The code is there but not enabled  (look for
WIN32_COMPOSITING) because 1) it doesn't work so well 2) it requires
a DLL that is only available on Vista and up.

give precedence to AA over Swap copy:

Certain GPU (intel) will not allow MSAA together with swap copy.
Previously, swap copy had priority over MSAA: fewer AA samples would be
chosen if it was the condition to get swap copy. This patch reverse the
logic: swap copy will be abandonned if another swap method (undefined or
exchange) will provide the number of AA samples requested. If no AA
samples is requested, swap copy still has the priority of course.
2016-06-09 22:15:13 +02:00
Mike Erwin
bd678f179b ndof: detect SpaceMouse Enterprise
New device! Lots of buttons!
2016-05-27 15:34:40 -04:00
Bastien Montagne
a7c3ec4feb GHOST cleanup (null check before delete, and 0 -> NULL for pointers).
Based on patch from Lawrence D'Oliveiro (ldo) in T48499.
2016-05-24 11:49:30 +02:00
Campbell Barton
24a3a9e8a3 Cleanup: remove unused doxy config 2016-05-22 17:15:08 +10:00
Bastien Montagne
38f65c500c Fix T48204: Generic Tablet on Linux - Erratic strokes with pressure sensitivity enabled.
Once and for all - I hope!

So, for the records: Xinput1 events' valuators have a first_axis and axis_count defining the 'range'
of valid axes for that event - but valid data in the valuator's array **always** start at zero
(which means that, if event reports first axis as being axis 2, axis 2's value is in axis_data[0]).
2016-05-19 20:30:48 +02:00
Bastien Montagne
ce65fae8f3 Fix T48369: Missing suport for main '+' key.
Many keyboard layouts (italian, spanish, german...) have direct access to '+' key on main
keyboard area (not the numpad one), ans x11 has own define for this key, so use it instead
of generating an unkown key event.

Note that we most likely have much more missing 'specific' keycodes for non-US keyboard layout,
but think since we already had a 'minus' keyevent, supporting 'plus' one is totally consistent.
And we had a spare space in our defined values just for it even!

This keyevent is only supported/generated by x11 and cocoa Ghost backends for now,
neither SDL nor win32 seem to have matching key events...
2016-05-10 08:29:03 +02:00
Campbell Barton
ac163447f8 Cleanup: warnings. spelling 2016-04-30 04:10:34 +10:00
Campbell Barton
a3d67456cd GHOST/X11: print description of error event 2016-04-23 18:44:17 +10:00
Sergey Sharybin
31632e7f74 NDof device: Check for socket exists before connecting to spnavd
This allows us to get rid of annoying and misleading error printed to the console
about being unable to connect to something.
2016-04-22 10:14:30 +02:00
Campbell Barton
f5fb4361d2 Cleanup: indentation 2016-04-06 09:30:20 +10:00
Campbell Barton
b8417501ab Cleanup: suspicious use of commas 2016-03-04 16:38:41 +11:00
Sergey Sharybin
b2655167c6 GHost: Avoid macro re-definition by undefining the macro first
Should b totally harmless since the define was overriten anyway.
2016-02-20 14:06:10 +05:00
Campbell Barton
1c958f5bef Cleanup: avoid -Wnarrowing warning 2016-02-17 05:18:47 +11:00
701a4a4e09 Fix cmd+z for undo not working when editing text objects on OS X. 2016-02-13 22:54:02 +01:00
88770bed7c Fix T47393: mouse wheel scroll no longer zooms with mighty mouse on OS X.
Hopefully this is the last fix, using the method explained here:
https://forums.developer.apple.com/thread/31536
2016-02-13 16:07:55 +01:00
Bastien Montagne
b80c07321b Fix T47300: SHIFT TAB, CTRL SHIFT TAB shortcuts does not toggle snap, snap mode on off anymore.
Regression from rB12c71508c2d7.

Now, we systematically first try keycode from `XLookupKeysym()`, and only fall back to
the one from `XLookupString()` if it failed to convert to a valid gkey.
2016-02-02 21:27:33 +01:00
6451c072ce Fix T47153: scroll wheel zoom fails with mouses that support smooth scroll on OS X. 2016-01-30 22:33:20 +01:00
Bastien Montagne
12c71508c2 Fix T47228: Ghost not handling predictably keycodes when first keymap is non-latin.
Why this is not working in original code and works int this one remains mystery
(see comments for details).

Note that we still do not support at all non-latin keymaps for our shortcuts,
this would be nice to add someday, but that's a TODO, not a bug.

Reviewers: sergey, campbellbarton

Reviewed By: campbellbarton

Differential Revision: https://developer.blender.org/D1746
2016-01-28 14:57:33 +01:00
Campbell Barton
d21eeffbbf Cleanup: used pre-defined atoms in ghost 2016-01-15 18:40:15 +11:00
Campbell Barton
c282373116 Fix T31063: X11 window resize fails on PPC
X11 property access was using wrong sized types that only worked for little endian systems.
2016-01-15 16:47:41 +11:00
cd6c6ee1a5 Fix T46993: UI lag in fullscreen mode on OS X / Intel graphics.
If anyone finds OS X UI drawing glitches with different graphics cards please
report them and I'll add an exception specifically for Intel, but in theory this
should work fine for all graphics cards.
2016-01-07 23:51:38 +01:00
Sergey Sharybin
5d99cde822 Remove SCons building system
While SCons building system was serving us really good for ages it's no longer
having much attention by the developers and started to become quite a difficult
task to maintain.

What's even worse -- there started to be quite serious divergence between SCons
and CMake which was only accumulating over the releases now. The fact that none
of the active developers are really using SCons and that our main studio is also
using CMake spotting bugs in the SCons builds became quite a difficult task and
we aren't always spotting them in time.

Meanwhile CMake became really mature building system which is available on every
platform we support and arguably it's also easier and more robust to use.

This commit includes:

- Removal of actual SCons building system
- Removal of SCons git submodule
- Removal of documentation which is stored in the sources and covers SCons
- Tweaks to the buildbot master to stop using SCons submodule
  (this change requires deploying to the server)
- Tweaks to the install dependencies script to skip installing or mentioning
  SCons building system
- Tweaks to various helper scripts to avoid mention of SCons folders/files
  as well

Reviewers: mont29, dingto, dfelinto, lukastoenne, lukasstockner97, brecht, Severin, merwin, aligorith, psy-fi, campbellbarton, juicyfruit

Reviewed By: campbellbarton, juicyfruit

Differential Revision: https://developer.blender.org/D1680
2016-01-04 14:20:48 +05:00
d1a26437ef OS X: remove code for OS X <= 10.5, which is already not supported since 2 years. 2015-12-29 00:27:18 +01:00
Campbell Barton
225b02fcd6 Fix for building ghost-tests 2015-12-28 21:40:49 +11:00
Kévin Dietrich
7ef10decdb Fix for heap-use-after-free happening in GHOST_EventManager.
Issue was that dispatchEvent might call removeWindowEvents/
removeTypeEvents which will delete the event before we can do so.

To address this, handled events are now put in a separate list.

Reported by psy-fi and reviewed by brecht in IRC.
2015-12-28 00:35:47 +01:00
Kévin Dietrich
c4c3d84d58 Addendum to previous GHOST commit: remove redundant check. 2015-12-27 21:32:19 +01:00
Kévin Dietrich
3e35e32e9d Fix memory leak in GHOST Event Manager.
The events are allocated on the heap, then pushed on a stack. Before
being processed, they are popped from the stack, and deleted after
processing is done. When the manager is destroyed (e.g. application
closing), any remaining event in the stack is detroyed.

Issue is that when the "application closing" event is processed, it is
never freed, because the manager gets destroyed before the call to
`delete` is made and the event is not on the stack anymore.

Now events are left on the stack while they are processed, and only
popped and deleted after processing is done.

As a slight bonus refactor: use void as return type for dispatch events
functions, as no caller is checking the return value, and it is not
clear what it means (suggested by the reviewer).

Reviewers: brecht

Differential Revision: https://developer.blender.org/D1695
2015-12-27 18:08:44 +01:00
Ines Almeida
46218dc9f9 Fix: unreported crash with misconfigured nvidia opengl drivers 2015-12-13 10:36:52 +00:00
Mike Erwin
1858823d3b OpenGL: request version 2.1 when creating context on Windows
In practice this gives us a context that is *compatible* with GL 2.1. On
my machine it gives a GL 3.3 or 4.3 compatibility profile context,
depending on graphics card installed.

Also fixed enum for core profile (not used yet).

Also added option for GL 3.2 compatibility profile. This will be useful
during Blender 2.8 development, until we are able to use the core
profile. On my machine this gives exactly a GL 3.2 compatibility profile
context, not 3.3 or 4.
2015-12-06 18:02:07 -05:00
Bastien Montagne
14221521fb Fix previous own fix - second message was actually OK, first one had bad comma placement...
Thanks to psy-fi for the head-up.
2015-11-24 15:36:49 +01:00
Bastien Montagne
0b422900c8 Fix broken windows 'MessageBox' calls (UI messages).
Reported by Bzzt_Ploink on IRC.
2015-11-24 15:14:22 +01:00
Antony Riakiotakis
db1f0e3616 Error out on Windows if driver does not support OpenGL 2.1 with an error
messagebox.
2015-11-22 20:53:57 +01:00
Antony Riakiotakis
8623d75b46 Add check for OpenGL version 2.1 on linux.
Unfortunately there's no easy way to show a messagebox here, so just
print a warning on fstderr and exit. If we don't call exit() here we get
crashes on other blender systems (python, opensubdiv) and it can get
tricky to track the initialization state here, so just using exit()
should do the trick for now.
2015-11-22 18:14:46 +01:00
Campbell Barton
ae8e4d3718 Cleanup: redundant 'break', minor edits 2015-11-19 22:52:13 +11:00
Campbell Barton
dc14629b26 GHOST: rename suffix X11 to Unix for non X11 files
We may use these for Wayland or SDL back-ends.
2015-11-16 21:57:05 +11:00
Campbell Barton
cfbbf72d89 Revert "Increase CMake minimum version to 3.0"
This reverts commit ff3cf93405e63fa367f64412bcfe96b382b24b38.

Turns out distros only a year old still use CMake 2.8x
2015-11-10 02:53:10 +11:00
Campbell Barton
ff3cf93405 Increase CMake minimum version to 3.0
This allows us to use newer features of CMake, and less hassles having to test & support older versions.
2015-11-09 23:37:53 +11:00
Mike Erwin
c3cec828e8 ndof: rework Mac driver glue
Load driver dynamically at runtime instead of weak-linking the
3Dconnexion framework. Driver no longer needed at build time!

Works with really old drivers (as in PowerMac old), more recent
versions, and the latest which allows us to process events on a
separate thread.
2015-10-25 21:19:26 +01:00
Campbell Barton
6af043424d Workaround for glew initialization bug
It turns out libGL from Intel crashes when calling glxewInit (where mesa, nvidia work fine),
unfortunately the only option without making larger changes to glew,
is to inline the parts of glew we're using - before the glx context is created.
2015-10-12 22:07:24 +11:00