Commit Graph

367 Commits

Author SHA1 Message Date
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
e87095fa5d Cleanup: silence warnings. 2014-01-07 14:53:32 +01:00
256a069987 Middle-clip tweaks:
* Now only middle-clip when both left and right parts of remaining strings are at least two times icon-width (thus most short labels will never be middle-clipped).
* Add a trailing ellipsis to right-clipped strings (unless it would take more than 20% of whole available width, in this case just clip chars, to keep as much data visible as possible!).
2014-01-07 14:53:32 +01:00
0074eac1ed More tweaks to clip middle:
* Do not apply margins with MENU (i.e. dropdowns) either.
* When middle clipping would remove only a few chars, rather clip right part!
2014-01-04 16:50:42 +01:00
76d9244843 Fix core issue with clipping labels (labels have no margins, so border should be 0 in this case!). 2014-01-04 16:18:08 +01:00
b9114cb609 UI: Use bool rather then int/short's where possible 2014-01-04 18:10:01 +11:00
56a531eb29 Fix T38043: Text clipping when it shouldn't
Tweak some more 'middle clipping' (zoom issues).
2014-01-03 15:49:07 +01:00
f489e0c14c Code Cleanup: remove strlen() and unneeded include in recent commit
also fix for incorrect sizeof() use.
2014-01-03 19:40:29 +11:00
3c6b5b72a4 Add a new "shortening process" for UI string drawing, which keeps both right and left parts
of the drawstr and replaces the middle by '...'

Rationnal:
It's usually easier to figure out what a troncated string means if you have both its start and end parts.

Details:
It currently affects all UI items (text fields, buttons, labels...).
Only exceptions are buttons inside menus, text fields & co being edited, and numbuttons/sliders.
Note that some static texts (like panels' titles or items in outliner) do not use usual UI items,
and just draw the whole text, using OpenGL to clip it. Will make another patch to fix this.

Reviewers: campbellbarton, brecht, carter2422, #user_interface

Reviewed by: brecht, carter2422

CC: billrey

Differential Revision: https://developer.blender.org/D114
2014-01-01 11:58:45 +01:00
8901701808 UI: Display alpha checkers in image info's color swatch. 2013-12-24 17:20:37 +11:00
dce82591a7 Fix T37830: UILists text now right align.
Simply check for non-embossed TEX buttons inside uiList items, and align their text like labels do.
2013-12-19 09:34:53 +01:00
d963bdf7d9 UI: more fixes for text clipping
Were still cases where numbers could be clipped incorrectly and icon
size was accounted for twice when left clipping (error in own recent commit).
2013-12-18 17:13:58 +11:00
d41b2bb25f Fix issue with right aligned number buttons overlapping the label
This also simplifies button clipping which was attempting to detect
offsets that were applied afterwards,
Now apply text clipping after adjusting the button rect margins.
2013-12-18 07:18:28 +11:00
305fc82541 UI: don't attempt to draw with the menu-key when only drawing right aligned 2013-12-17 13:11:31 +11:00
09b4954d2d UI: use BLF_width_to_strlen for efficient text clipping 2013-12-16 22:00:30 +11:00
51b9d85b09 UI: remove text margin when a slider is aligned to another button
Paint sliders had too much space on right (aligned with pressure icons)
2013-12-13 05:29:54 +11:00
9ad88fbe6d Fix for error exposed by right-align number buttons
When the entire label was clipped, the right aligned number component
could be clipped on its left hand side too.
So "Foo: 1.00" could be clipped to ".00"
2013-12-13 02:47:00 +11:00
dde5e5ce25 User Interface: Align number buttons labels to the left, number right 2013-12-11 21:27:13 +11:00
8e94d3685a Interface: avoid setting \0 to drawstr in widget_draw_text 2013-12-11 20:35:28 +11:00
1ed822202f Code Cleanup: pass rectangles as const in insterface files 2013-12-07 15:47:57 +11:00
02aec1e758 User Interface: fix for crash pressing Ctrl+Delete
also remove redundant string duplication.
2013-12-02 21:35:42 +11:00