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:
authorJulian Eisel <julian@blender.org>2020-09-04 22:18:45 +0300
committerJulian Eisel <julian@blender.org>2020-09-04 22:26:31 +0300
commite6f0b60c2e9111af1878d31dcc295c59ed1bea77 (patch)
tree4df10fc869f5f512c233a2755246c1749bafc1c7 /source/blender/editors/space_clip
parent47881791be0538f9558b2ef091e1761187df250d (diff)
UI Code Quality: Use derived struct for number buttons
For the man rationale behind this design, see 49f088e2d093. Further, this removes users of uiBut.a1/uiBut.a2, which is a very ugly design choice (hard to reason about). Note that I had to do rather ugly, specific exceptions for the number buttons in `ui_def_but_rna()`. But once all users of a1/a2 are removed, this special handling shouldn't be needed anymore. I also had to move a sanity check out of the button definition. It's now moved into a new debug only sanity checking function executed when finishing the layout definition (block end).
Diffstat (limited to 'source/blender/editors/space_clip')
-rw-r--r--source/blender/editors/space_clip/clip_buttons.c300
1 files changed, 160 insertions, 140 deletions
diff --git a/source/blender/editors/space_clip/clip_buttons.c b/source/blender/editors/space_clip/clip_buttons.c
index 80ce07d39ef..2e7ee3498b5 100644
--- a/source/blender/editors/space_clip/clip_buttons.c
+++ b/source/blender/editors/space_clip/clip_buttons.c
@@ -585,34 +585,38 @@ void uiTemplateMarker(uiLayout *layout,
0,
0,
"");
- uiDefButF(block,
- UI_BTYPE_NUM,
- B_MARKER_POS,
- IFACE_("X:"),
- 0.5 * UI_UNIT_X,
- 9 * UI_UNIT_Y,
- 7.25 * UI_UNIT_X,
- UI_UNIT_Y,
- &cb->marker_pos[0],
- -10 * width,
- 10.0 * width,
- step,
- digits,
- TIP_("X-position of marker at frame in screen coordinates"));
- uiDefButF(block,
- UI_BTYPE_NUM,
- B_MARKER_POS,
- IFACE_("Y:"),
- 8.25 * UI_UNIT_X,
- 9 * UI_UNIT_Y,
- 7.25 * UI_UNIT_X,
- UI_UNIT_Y,
- &cb->marker_pos[1],
- -10 * height,
- 10.0 * height,
- step,
- digits,
- TIP_("Y-position of marker at frame in screen coordinates"));
+ bt = uiDefButF(block,
+ UI_BTYPE_NUM,
+ B_MARKER_POS,
+ IFACE_("X:"),
+ 0.5 * UI_UNIT_X,
+ 9 * UI_UNIT_Y,
+ 7.25 * UI_UNIT_X,
+ UI_UNIT_Y,
+ &cb->marker_pos[0],
+ -10 * width,
+ 10.0 * width,
+ 0,
+ 0,
+ TIP_("X-position of marker at frame in screen coordinates"));
+ UI_but_number_step_size_set(bt, step);
+ UI_but_number_precision_set(bt, digits);
+ bt = uiDefButF(block,
+ UI_BTYPE_NUM,
+ B_MARKER_POS,
+ IFACE_("Y:"),
+ 8.25 * UI_UNIT_X,
+ 9 * UI_UNIT_Y,
+ 7.25 * UI_UNIT_X,
+ UI_UNIT_Y,
+ &cb->marker_pos[1],
+ -10 * height,
+ 10.0 * height,
+ 0,
+ 0,
+ TIP_("Y-position of marker at frame in screen coordinates"));
+ UI_but_number_step_size_set(bt, step);
+ UI_but_number_precision_set(bt, digits);
uiDefBut(block,
UI_BTYPE_LABEL,
@@ -628,34 +632,38 @@ void uiTemplateMarker(uiLayout *layout,
0,
0,
"");
- uiDefButF(block,
- UI_BTYPE_NUM,
- B_MARKER_OFFSET,
- IFACE_("X:"),
- 0.5 * UI_UNIT_X,
- 7 * UI_UNIT_Y,
- 7.25 * UI_UNIT_X,
- UI_UNIT_Y,
- &cb->track_offset[0],
- -10 * width,
- 10.0 * width,
- step,
- digits,
- TIP_("X-offset to parenting point"));
- uiDefButF(block,
- UI_BTYPE_NUM,
- B_MARKER_OFFSET,
- IFACE_("Y:"),
- 8.25 * UI_UNIT_X,
- 7 * UI_UNIT_Y,
- 7.25 * UI_UNIT_X,
- UI_UNIT_Y,
- &cb->track_offset[1],
- -10 * height,
- 10.0 * height,
- step,
- digits,
- TIP_("Y-offset to parenting point"));
+ bt = uiDefButF(block,
+ UI_BTYPE_NUM,
+ B_MARKER_OFFSET,
+ IFACE_("X:"),
+ 0.5 * UI_UNIT_X,
+ 7 * UI_UNIT_Y,
+ 7.25 * UI_UNIT_X,
+ UI_UNIT_Y,
+ &cb->track_offset[0],
+ -10 * width,
+ 10.0 * width,
+ 0,
+ 0,
+ TIP_("X-offset to parenting point"));
+ UI_but_number_step_size_set(bt, step);
+ UI_but_number_precision_set(bt, digits);
+ bt = uiDefButF(block,
+ UI_BTYPE_NUM,
+ B_MARKER_OFFSET,
+ IFACE_("Y:"),
+ 8.25 * UI_UNIT_X,
+ 7 * UI_UNIT_Y,
+ 7.25 * UI_UNIT_X,
+ UI_UNIT_Y,
+ &cb->track_offset[1],
+ -10 * height,
+ 10.0 * height,
+ 0,
+ 0,
+ TIP_("Y-offset to parenting point"));
+ UI_but_number_step_size_set(bt, step);
+ UI_but_number_precision_set(bt, digits);
uiDefBut(block,
UI_BTYPE_LABEL,
@@ -671,34 +679,38 @@ void uiTemplateMarker(uiLayout *layout,
0,
0,
"");
- uiDefButF(block,
- UI_BTYPE_NUM,
- B_MARKER_PAT_DIM,
- IFACE_("Width:"),
- 0.5 * UI_UNIT_X,
- 5 * UI_UNIT_Y,
- 15 * UI_UNIT_X,
- UI_UNIT_Y,
- &cb->marker_pat[0],
- 3.0f,
- 10.0 * width,
- step,
- digits,
- TIP_("Width of marker's pattern in screen coordinates"));
- uiDefButF(block,
- UI_BTYPE_NUM,
- B_MARKER_PAT_DIM,
- IFACE_("Height:"),
- 0.5 * UI_UNIT_X,
- 4 * UI_UNIT_Y,
- 15 * UI_UNIT_X,
- UI_UNIT_Y,
- &cb->marker_pat[1],
- 3.0f,
- 10.0 * height,
- step,
- digits,
- TIP_("Height of marker's pattern in screen coordinates"));
+ bt = uiDefButF(block,
+ UI_BTYPE_NUM,
+ B_MARKER_PAT_DIM,
+ IFACE_("Width:"),
+ 0.5 * UI_UNIT_X,
+ 5 * UI_UNIT_Y,
+ 15 * UI_UNIT_X,
+ UI_UNIT_Y,
+ &cb->marker_pat[0],
+ 3.0f,
+ 10.0 * width,
+ 0,
+ 0,
+ TIP_("Width of marker's pattern in screen coordinates"));
+ UI_but_number_step_size_set(bt, step);
+ UI_but_number_precision_set(bt, digits);
+ bt = uiDefButF(block,
+ UI_BTYPE_NUM,
+ B_MARKER_PAT_DIM,
+ IFACE_("Height:"),
+ 0.5 * UI_UNIT_X,
+ 4 * UI_UNIT_Y,
+ 15 * UI_UNIT_X,
+ UI_UNIT_Y,
+ &cb->marker_pat[1],
+ 3.0f,
+ 10.0 * height,
+ 0,
+ 0,
+ TIP_("Height of marker's pattern in screen coordinates"));
+ UI_but_number_step_size_set(bt, step);
+ UI_but_number_precision_set(bt, digits);
uiDefBut(block,
UI_BTYPE_LABEL,
@@ -714,62 +726,70 @@ void uiTemplateMarker(uiLayout *layout,
0,
0,
"");
- uiDefButF(block,
- UI_BTYPE_NUM,
- B_MARKER_SEARCH_POS,
- IFACE_("X:"),
- 0.5 * UI_UNIT_X,
- 2 * UI_UNIT_Y,
- 7.25 * UI_UNIT_X,
- UI_UNIT_Y,
- &cb->marker_search_pos[0],
- -width,
- width,
- step,
- digits,
- TIP_("X-position of search at frame relative to marker's position"));
- uiDefButF(block,
- UI_BTYPE_NUM,
- B_MARKER_SEARCH_POS,
- IFACE_("Y:"),
- 8.25 * UI_UNIT_X,
- 2 * UI_UNIT_Y,
- 7.25 * UI_UNIT_X,
- UI_UNIT_Y,
- &cb->marker_search_pos[1],
- -height,
- height,
- step,
- digits,
- TIP_("Y-position of search at frame relative to marker's position"));
- uiDefButF(block,
- UI_BTYPE_NUM,
- B_MARKER_SEARCH_DIM,
- IFACE_("Width:"),
- 0.5 * UI_UNIT_X,
- 1 * UI_UNIT_Y,
- 15 * UI_UNIT_X,
- UI_UNIT_Y,
- &cb->marker_search[0],
- 3.0f,
- 10.0 * width,
- step,
- digits,
- TIP_("Width of marker's search in screen coordinates"));
- uiDefButF(block,
- UI_BTYPE_NUM,
- B_MARKER_SEARCH_DIM,
- IFACE_("Height:"),
- 0.5 * UI_UNIT_X,
- 0 * UI_UNIT_Y,
- 15 * UI_UNIT_X,
- UI_UNIT_Y,
- &cb->marker_search[1],
- 3.0f,
- 10.0 * height,
- step,
- digits,
- TIP_("Height of marker's search in screen coordinates"));
+ bt = uiDefButF(block,
+ UI_BTYPE_NUM,
+ B_MARKER_SEARCH_POS,
+ IFACE_("X:"),
+ 0.5 * UI_UNIT_X,
+ 2 * UI_UNIT_Y,
+ 7.25 * UI_UNIT_X,
+ UI_UNIT_Y,
+ &cb->marker_search_pos[0],
+ -width,
+ width,
+ 0,
+ 0,
+ TIP_("X-position of search at frame relative to marker's position"));
+ UI_but_number_step_size_set(bt, step);
+ UI_but_number_precision_set(bt, digits);
+ bt = uiDefButF(block,
+ UI_BTYPE_NUM,
+ B_MARKER_SEARCH_POS,
+ IFACE_("Y:"),
+ 8.25 * UI_UNIT_X,
+ 2 * UI_UNIT_Y,
+ 7.25 * UI_UNIT_X,
+ UI_UNIT_Y,
+ &cb->marker_search_pos[1],
+ -height,
+ height,
+ 0,
+ 0,
+ TIP_("Y-position of search at frame relative to marker's position"));
+ UI_but_number_step_size_set(bt, step);
+ UI_but_number_precision_set(bt, digits);
+ bt = uiDefButF(block,
+ UI_BTYPE_NUM,
+ B_MARKER_SEARCH_DIM,
+ IFACE_("Width:"),
+ 0.5 * UI_UNIT_X,
+ 1 * UI_UNIT_Y,
+ 15 * UI_UNIT_X,
+ UI_UNIT_Y,
+ &cb->marker_search[0],
+ 3.0f,
+ 10.0 * width,
+ 0,
+ 0,
+ TIP_("Width of marker's search in screen coordinates"));
+ UI_but_number_step_size_set(bt, step);
+ UI_but_number_precision_set(bt, digits);
+ bt = uiDefButF(block,
+ UI_BTYPE_NUM,
+ B_MARKER_SEARCH_DIM,
+ IFACE_("Height:"),
+ 0.5 * UI_UNIT_X,
+ 0 * UI_UNIT_Y,
+ 15 * UI_UNIT_X,
+ UI_UNIT_Y,
+ &cb->marker_search[1],
+ 3.0f,
+ 10.0 * height,
+ 0,
+ 0,
+ TIP_("Height of marker's search in screen coordinates"));
+ UI_but_number_step_size_set(bt, step);
+ UI_but_number_precision_set(bt, digits);
UI_block_align_end(block);
}