Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Montagne <montagne29@wanadoo.fr>2014-03-23 02:20:14 +0400
committerBastien Montagne <montagne29@wanadoo.fr>2014-03-23 12:29:04 +0400
commit3bad243cb80f5f588f8464f41cedf6897dbb84d7 (patch)
tree053e36e5fff38c7862e58bb2f5e55209b0b21d43 /source/blender/editors/include/ED_numinput.h
parentc359de2c3a8d49dab6b11107d5d80052fb5f5c53 (diff)
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!).
Diffstat (limited to 'source/blender/editors/include/ED_numinput.h')
-rw-r--r--source/blender/editors/include/ED_numinput.h11
1 files changed, 10 insertions, 1 deletions
diff --git a/source/blender/editors/include/ED_numinput.h b/source/blender/editors/include/ED_numinput.h
index 9d8c2ae99ac..e7b52a49e8c 100644
--- a/source/blender/editors/include/ED_numinput.h
+++ b/source/blender/editors/include/ED_numinput.h
@@ -66,10 +66,19 @@ enum {
/*********************** NumInput ********************************/
+/* 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 (i.e. to call outputNumInput).
+ *
+ * Those two steps have to be separated (so do not use a common call to hasNumInput() to do both in the same time!).
+ */
+
void initNumInput(NumInput *n);
void outputNumInput(NumInput *n, char *str);
bool hasNumInput(const NumInput *n);
-void applyNumInput(NumInput *n, float *vec);
+bool applyNumInput(NumInput *n, float *vec);
bool handleNumInput(struct bContext *C, NumInput *n, const struct wmEvent *event);
#define NUM_MODAL_INCREMENT_UP 18