Blender Git Commit Log

Git Commits -> Revision 3bad243

Revision 3bad243 by Bastien Montagne (master)
March 23, 2014, 08:29 (GMT)
Further tweaking to numinput - enhance 'Reset' behavior.

Ways how it was resetting its values (backspace) was far from satisfaying. Now, e.g. when scaling, it will reset at 1 (or whatever mouse-value it was before entering numinput), instead of some ugly 0.0 value.

Implementation details:
* Values passed to applyNumInput() are stored as default ones (val_org), if it is not EDITED.
* applyNumInput() returns a boolean saying whether it actually set values or not.
* When backspace hits its ultimate step (where it clears all EDITED flags and reset all default values),
it sets a temp FAKE_EDITED flag that will be used to apply one last time values of numinput
(so that default values actually get applied!).

There are important things to note here for code using numinput:
* Values passed to applyNumInput() should be valid and are stored as default ones (val_org), if it is not EDITED.
* bool returned by applyNumInput should be used to decide whether to apply numinput-specific post-process to data.
* *Once applyNumInput has been called*, hasNumInput returns a valid value to decide whether to use numinput as drawstr source or not.

Those two steps have to be separated (so do not use a common call to hasNumInput() to do both in the same time!).

Commit Details:

Full Hash: 3bad243cb80f5f588f8464f41cedf6897dbb84d7
Parent Commit: c359de2
Lines Changed: +72, -46

4 Modified Paths:

/source/blender/editors/include/ED_numinput.h (+10, -1) (Diff)
/source/blender/editors/transform/transform.c (+25, -28) (Diff)
/source/blender/editors/transform/transform_constraints.c (+1, -2) (Diff)
/source/blender/editors/util/numinput.c (+36, -15) (Diff)
By: Miika HämäläinenLast update: Nov-07-2014 14:18MiikaHweb | 2003-2021