Age | Commit message (Collapse) | Author |
|
use when the length of the destination string is needed.
|
|
unit.c intentionally doesn't include DNA or BKE headers (except its own)
|
|
assumes translations are in meters.
Turned out there were several issues in handling of scale parameter by numinput.
Fixed that by factorizing more some code in common with 'usual' numbuttons eval code
(new `bUnit_getScaleUnit()` helper will return valid scaled value, depending on
given system and type).
Now, numinput behaves as expected - using default unit amended by scale in case no unit is given
(i.e. entering '20' with a scale of 0.01 will give you 20cm, and '20cm' as well!).
|
|
|
|
Now always check for a default unit, and evaluate the whole expression in this "unit space".
Not an ideal solution, but should handle most cases nicely
(we can't address all possible corner cases anyway).
Note default unit is searched in current string first (bigger unit of current system wins),
then in previous string.
Note this also replaces ',' by '+' in default separation between units,
helps solving issues with parenthesis (e.g. (1'1")*2.5 would fail in existing code)!
This would break if someone uses py ops with lower precedence than '+' (like bitwise
operations, and comparison), but these are not expected usecase here anyway.
Reviewers: campbellbarton
Differential Revision: https://developer.blender.org/D340
|
|
|
|
When converting text to value, units' "value" had only 6 digits of precision,
leading to annoying loss of precision esp. when mixing big and small units
(like e.g. miles and inches).
|
|
|
|
|
|
|
|
|
|
|
|
Avoids having small values displayed as "0kg".
|
|
This reverts commit ead6d397fda12d8287dff7d6a6fff6ea1948cd69.
|
|
|
|
Summary:
This completly changes the way modal numinput is handled. Now, edited expression is a string, which then gets unit- and py-evaluated to get a float value.
We gain many power and flexibility, but lose a few "shortcuts" like '-' to negate, or '/' to inverse (if they are really needed, we still can add them with modifiers, like e.g. ctrl-/ or so).
Features:
- units (cm, ", deg, etc.).
- basic operations from python/BKE_unit (+, *, **, etc.), and math constants and functions (pi, sin, etc.).
- you can navigate in edited value (left/right key, ctrl to move by block) and insert/delete chars, e.g. to fix a typo without having to rewrite everything.
- you can go to next/previous value with (ctrl-)TAB key.
- As before, hitting backspace after having deleted all leading chars will first reset the edited value to init state, and on second press, the whole "modal numinput" editing will be cancelled, going back to usual transform with mouse.
Notes:
- Did not touch to how values are shown in header when modal numinput is not enabled (would do that in another commit), so this is still quite inconsistent.
- Added back radian support in BKE_unit.
- Added arcminute/arcsecond to BKE_unit.
(those unit changes affect all angle UI controls, btw, so you can now enter radians or longitude/latitude values when in degrees units).
Related to T37600.
Reviewers: brecht, campbellbarton, carter2422
Reviewed By: brecht, campbellbarton, carter2422
Thanks everybody!
Differential Revision: http://developer.blender.org/D61
|
|
|
|
rename change/is_change/is_changed/modified -> changed
also use bools over int/short/char and once accidental float.
|
|
Lockal for noting this!
|
|
uppercase input is misinterpreted
Typo in lowercasing code!
|
|
Issue was actually that micrometer was not drawing correctly (from r58165), reverted that fix and instead use utf8 drawing for editmode metrics when using a unit system (we already had a similar hack for surfaces and volumes, anyway).
|
|
|
|
sizes but not microscopic.
|
|
you can specify precision=0 for this, and use -1 for the default 2.
|
|
also replace sprintf with strcpy when no formatting is done.
|
|
they do.
I've added a separate camera unit type. It's a bit strange to have an exception for
this but it ensures units are shown in familiar millimeters and it also ensures
backwards compatibility.
|
|
|
|
are not so common.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(input still knows about them) - was reported as a bug.
also fix minor rip bug where active selection was lost.
|
|
cleanup some defines/includes for windows.
|
|
result was editing number buttons with um would give a python error.
|
|
|
|
also remove large, duplicate comments from sunsky.h
|
|
|
|
|
|
|
|
|
|
Use %g instead of %lg due to %g is supposed to be used for doubles and %lg confuses mingw at all
|
|
also removed some unused function definitons.
|
|
http://markmail.org/message/fp7ozcywxum3ar7n
|
|
Initially problem was caused by updated version of mingw-runtime which
changed behavior of snprintf and vsnprintf so %lf isn't anymore valid
for doubles.
According to manpages, %f is a correct format for snprintf for doubles.
|
|
* replace by BLI_snprintf in various places, note _snprintf on windows
does not properly null terminate the string.
* fix overflow in sequencer proxy code due to buffer being smaller than
specified size.
* fix some usage of snprintf as strcpy, this is will go wrong if the
string contains % characters.
* remove BLI_dynstr_printf function in gpu module, use BLI_dynstr_appendf
|
|
and thous
|