Commit Graph

387 Commits

Author SHA1 Message Date
f23cf22125 Pie menus:
* Only use last key for pies if it hasn't been released already
* Confirm threshold is now measured as distance after regular threshold.
zero disables.
* Only display the confirm threshold if there's a valid direction (mouse
is after threshold).
* Calculate confirm threshold taking recentering into account
2014-10-14 12:08:44 +02:00
9fcc1a32df Pie menus: Confirm threshold
This commit adds a confirm threshold property to pie menus.

Basically, this will confirm the pie menu automatically when
the distance from the center of the pie exceeds that threshold without
a need to release the pie button.

The confirm threshold will only work if it is larger than the pie
threshold.

The confirmation actually occur when the mouse stops moving, to
allow multiple pie menus to be better linked together, (see below)

This functionality also facilitates the ability for chained pie menus by
dragging. Basically, a pie menu item can be a call_menu_pie operator and
the new pie menu will still use the original pie menu release event for
confirmation. This should allow for quick, gesture based navigation in
pie menu hierarchies (going back in the hierarchy is still not supported
though)

There will be a demonstration pie in the official add-on soon
2014-10-13 14:35:41 +02:00
ee5936cf6b Minor alignment for triangles on number slider widget 2014-10-12 01:01:59 +02:00
3a40aed3d5 Cleanup: use float versions of functions when in/output are floats 2014-09-24 14:55:02 +10:00
90c1afb020 Fix T41708, active palette indicator not refreshing when clicking
Issue, after a lot of blood sweat and tears, was found in
ui_but_update_from_old_block, where we restore a button to its old
values when possible. The problem here is that a1 and a2 are not really
meant to store temporary variables, because they tend to get overriden
and palette selection is one of those temporary states.

Instead, we now store the position of each button in the palette in a2
and pointer to the palette in the customdata pointer of each button and
use that to test if it's active. The positions won't change when
clicking so we are guaranteed that the old button won't override the new
one with garbage.

It's still hacky but it is better than testing button types when copying
old values.
2014-09-18 12:51:54 +02:00
44121442e9 Palette active color:
Use indicator color derived from color luminance for better contrast.
2014-09-18 12:20:34 +02:00
1ad9987af1 Fix filenames in splashscreen.
For some reason, labels of buttons in popups/menus were clipped left.

Removed that function (was the only place were it was used), clipping text
by its left is really bad for its understanding!

Instead, extended clip_middle code so that it optionnally preserves a right piece of
the given string (like the shortcut part of a menu label). Think that's what makes
more sense here (note that most menus adapt themselves to their longest item,
we do not have much fixed-width ones, anyway).

Also tweaked a bit clip_middle logic, so that left part always have at least ten chars
(in addition to already existing 'min width' checks).
2014-08-16 22:36:23 +02:00
028fd29eeb Pie Menus C code backend.
This commit merges the code in the pie-menu branch.

As per decisions taken the last few days, there are no pie menus
included and there will be an official add-on including overrides of
some keys with pie menus. However, people will now be able to use the
new code in python.

Full Documentation is in http://wiki.blender.org/index.php/Dev:Ref/

Thanks:
Campbell Barton, Dalai Felinto and Ton Roosendaal for the code review
and design comments

Jonathan Williamson, Pawel Lyczkowski, Pablo Vazquez among others for
suggestions during the development.

Special Thanks to Sean Olson, for his support, suggestions, testing and
merciless bugging so that I would finish the pie menu code. Without him
we wouldn't be here. Also to the rest of the developers of the original
python add-on, Patrick Moore and Dan Eicher and finally to Matt Ebb, who
did the research and first implementation and whose code I used to get
started.
2014-08-11 11:02:26 +02:00
f745564e4e GSOC 2013 paint
Yep, at last it's here!

There are a few minor issues remaining but development can go on in
master after discussion at blender institute.

For full list of features see:

http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.72/Painting

Thanks to Sergey and Campbell for the extensive review and to the
countless artists that have given their input and reported issues during
development.
2014-07-21 12:02:05 +02:00
00b29156e0 Defines: replace ELEM3-16 with ELEM(...), that can take varargs 2014-07-20 01:33:40 +10:00
2762432052 Code cleanup: de-duplicate widget_num_tria, widget_scroll_circle 2014-06-22 15:01:54 +10:00
5b367c9aaf Fix T40534: Multi-button editing, hard to distinguish sliders 2014-06-09 21:06:44 +10:00
aec8f4f777 Fix uninitialized var in recent change to cursor drawing 2014-05-31 17:30:04 +10:00
d914d101ec UI: fix for drawing textselect outside of button
also draw cursor even when there is a selection.
2014-05-30 10:21:45 +10:00
0111f3505f UI: more changes for large textfields
- no longer set 'but->drawstr' when editing buttons.
- clip text and set cursor based on the 'editstr'.
2014-05-03 09:18:00 +10:00
fc591473b2 Fix T39924: 400 character limit in text fields 2014-05-03 05:03:55 +10:00
4849ca8a56 Fix T39884: Displaying filenames with '|' failing in menus 2014-05-01 12:40:49 +10:00
4ca67869cc Code cleanup: remove unused includes
Opted to keep includes if they are used indirectly (even if removing is possible).
2014-05-01 04:47:51 +10:00
a2df2a637e Two changes:
* Buffer icons are usually in straight space (since we load from pngs)
so use src_alpha in OpenGL for blending.

* Allow blending for preview icons. This will be useful for the next
commit...
2014-04-27 23:38:39 +03:00
c67bd49e56 Code cleanup: use 'const' for arrays (editors) 2014-04-27 00:25:15 +10:00
1a1bc281e6 Code cleanup: style 2014-04-21 01:01:33 +10:00
1b9db9911d Code cleanup: use bools
also rename BLI_omp_thread_count -> BLI_system_thread_count_omp
2014-04-17 16:04:28 +10:00
4faef1e10c Add drag-resize to uiTemplatePreview (mat/tex/etc. preview widget).
This is done by adding a new button type, GRIP, similar to other numbuttons
(scroll, slider, ...), which here controls the preview height.

Then, we add a new DNA struct to be able to save that height in Blend files
(note I choose not to use Panel struct for this, because we would then have the
same limitation we used to have with uiLists, only one preview per panel
and no preview outside panel).

This implies a change to template_preview UI RNA/py API (each preview needs an ID),
but this is backward compatible, as by default datablock type will be used if no ID is
given (which means e.g. all material previews with no ID will have same height).

Reviewers: brecht

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D342
2014-04-02 13:03:11 +02:00
7199e2288f Code cleanup: use sqrtf when input and output are float 2014-03-28 14:53:37 +11:00
551d1a1ed5 Code cleanup: style 2014-03-24 13:14:19 +11:00
eaf387b8df UI: bypass text clipping on buttons with no text 2014-03-18 11:07:10 +11:00
4d44f70d5f Follow up to previous commit:
Make HSL wheel useful in compositing.

In HSL, 0.5 lightness corresponds to most vibrant colors so make that
default for locked wheels (previous value of 1.0 just made it white).
Also, unlock the wheel for both very bright and very dark colors.
2014-03-18 01:33:28 +02:00
06de5be90e Fix T39228 Gamma/lift/gain are burned out in the circular color pickers
and value/lightness slider stops midway.

Issue here is manyfold:

Color wheel does not support properties with different soft min/max
values than 1.0 (which after experimenting a little I left as is), and
also color management is completely destroying the mapping between the
value slider and the RNA property value range. To solve this I have
disabled color management by setting the property to gamma corrected
(only in RNA, Sequence editor coders please check!), otherwise it will
just become a big mess of tracking where color comes from and what kind
of color transforms it needs in different color pickers (if property has
non normalized range etc). HSL is not really meant to represent colors
outside a normalized space so I have disabled setting lightness above
1.0 in this model.

This will work, however it is hacking a color picker to do something
other than what it is supposed to do: pick a color from the screen
accurately. Which means normalized values always. The non normalized
colors picked for lift/gain/gamma through the pickers do not correspond
to any accurate colors; they are rather a user friendly way to 'sort of'
choose a color and a gamma with an indication of maximum value.

I think that lift/gamma/gain nodes need a dedicated widget for this
(besides it is quite clear that some options are written for that use
case) -or- a separate gamma multiplier for the picked color (which
should itself be in a normalized space)
2014-03-18 01:08:36 +02:00
2097e621ed Code cleanup: use r_ prefix for return args 2014-03-16 03:26:23 +11:00
433d55e9b4 Code cleanup: spelling & style 2014-03-15 23:46:02 +11:00
8f1a6e26b6 Fix Circle picker not liking linear color properties much. Again, visual
result for picked color was different from what was displayed on color
wheel under the cursor.
2014-03-14 02:30:27 +02:00
33f51abe4e Better fix for T37545.
This was supposed to fix inaccuracies between S-H wheel but it makes the
colors selected through the SV-H color cube wrong (see http://
%28SV-H%29-Inaccurate). Instead of deactivating color management for SV
and H widgets just reenable correction for the Hue wheel. This is wrong
because HSV always refers to display space and we -have- to account for
that when using linear color RNA properties.
2014-03-14 01:42:50 +02:00
4fa93b1ea4 Code cleanup (tm): Some code deduplication for HSL 2014-03-12 19:12:58 +02:00
bce924b43c HSL color wheel implementation.
This is a standard Hue - Saturation - Lightness model
(see for instance entry on wikipedia here: https://en.wikipedia.org/wiki/HSL_and_HSV)
Note though the difference between HSV and HSL saturation, which are not the same.

The advantage of having this color selection scheme is that artists can select
shades and tints of a color easily by using the lightness slider. Also colors
are arranged on (approximated) perceived lightness on the color wheel.

Beware, Old files opened with this preference saved will crash!

Reviewers: sergey, brecht, campbellbarton

Differential Revision: https://developer.blender.org/D385
2014-03-12 18:58:50 +02:00
e5e0888a8f UI: allow passing "" for icon only enum buttons and still get an icon
Enum icon-only buttons were getting their strings set,
then truncated with blenders string shortening methods, then not drawn
because there was no room (since buttons are icon width).

Modify UI code so icon-only buttons don't get names and passing "" to a
button won't have its text set later on.
2014-03-12 22:56:10 +11:00
118d86aa73 UI: avoid for divide by zero for icon buttons (no need to clip text) 2014-02-27 18:30:06 +11:00
c35ac8f7ac Fix T38678: Long strings on Search widget not getting shortened/no tooltip.
Note this commit only makes search menus wider and adds shortening to their strings.
Adding tooltips here is not trivial, would need much bigger changes...

Reviewers: brecht

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D341
2014-02-26 21:53:56 +01:00
d0ec83c1a2 Fix T38809: regression, text cursor offset in number buttons
Use the same offset for all edit-buttons now.
2014-02-25 10:31:04 +11:00
002b2c1541 MSVC: resolve utf8 encoding issue with some codepages 2014-02-23 14:38:27 +11:00
1df068c39a UI: Fix for rna-enum submenus not showing a right arrow 2014-02-20 13:30:52 +11:00
d4c87f2f79 Code cleanup: remove unused button aspect 2014-02-13 09:37:27 +11:00
7e300ed3a1 UI: change to give sliders more text space, messes with alignment 2014-02-12 02:46:43 +11:00
d2b5f0f6c2 UI: fix own error, dont add slider pad when neither sides align 2014-02-11 03:38:48 +11:00
127330d6ca UI: multi-drag number button editing
clicking and dragging down edits multiple number buttons at once. (patch D270)
2014-02-08 09:42:26 +11:00
fed1b8b16d Code cleanup: suffix vars to make obvious they are squared 2014-02-03 02:46:45 +11:00
abf18033f3 Fix T38383: glitch drawing inactive slider 2014-01-29 04:10:39 +11:00
44855f9ef2 Code Cleanup: remove redundant NULL checks and add function attributes 2014-01-20 11:13:53 +11:00
8b6b42b694 UI: tweak menu padding and make separator line more visible.
Adds some padding to the left of the icon, adds more space around the separator
line and make it more visible, and add some spacing at the top and bottom of
the menu. Ref T37794

Reviewed By: dingto, billrey

Differential Revision: https://developer.blender.org/D223
2014-01-17 17:06:11 +01:00
1914d804cf Fix T38083: submenu arrow is overlayed by menu hotkey 2014-01-10 02:25:49 +11:00
7bcb34e59b Fix T38131: node link buttons (like for cycles in material properties) were not
giving correct colors with theme menu colors set to bright values.

Thanks to Denis Declara for finding the cause of this bug.
2014-01-08 20:41:38 +01:00