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
path: root/source
diff options
context:
space:
mode:
authorGermano Cavalcante <germano.costa@ig.com.br>2020-12-09 16:30:23 +0300
committerGermano Cavalcante <germano.costa@ig.com.br>2020-12-09 16:30:23 +0300
commit37bf71ad0475549e0458f1e864a30c68c5880e88 (patch)
tree9b23496330fee751eca4da635cdcad33c9fa8ccf /source
parentb9eb5921332922757acacd2c9251d8c89c9a239a (diff)
Fix T83588: Crash with Shrink/Fatten and Offset Even
`t->keymap` can be `NULL`. Bug introduced in rBc822f66bb83
Diffstat (limited to 'source')
-rw-r--r--source/blender/editors/transform/transform_mode_edge_seq_slide.c17
-rw-r--r--source/blender/editors/transform/transform_mode_shrink_fatten.c17
2 files changed, 18 insertions, 16 deletions
diff --git a/source/blender/editors/transform/transform_mode_edge_seq_slide.c b/source/blender/editors/transform/transform_mode_edge_seq_slide.c
index 1682b5bfe31..7ccfd0149bd 100644
--- a/source/blender/editors/transform/transform_mode_edge_seq_slide.c
+++ b/source/blender/editors/transform/transform_mode_edge_seq_slide.c
@@ -50,7 +50,7 @@ static eRedrawFlag seq_slide_handleEvent(struct TransInfo *t, const wmEvent *eve
{
BLI_assert(t->mode == TFM_SEQ_SLIDE);
wmKeyMapItem *kmi = t->custom.mode.data;
- if (event->type == kmi->type && event->val == kmi->val) {
+ if (kmi && event->type == kmi->type && event->val == kmi->val) {
/* Allows the 'Expand to fit' effect to be enabled as a toogle. */
t->flag ^= T_ALT_TRANSFORM;
return TREDRAW_HARD;
@@ -73,12 +73,11 @@ static void headerSeqSlide(TransInfo *t, const float val[2], char str[UI_MAX_DRA
ofs += BLI_snprintf(
str + ofs, UI_MAX_DRAW_STR - ofs, TIP_("Sequence Slide: %s%s, ("), &tvec[0], t->con.text);
- if (t->keymap) {
- wmKeyMapItem *kmi = t->custom.mode.data;
- if (kmi) {
- ofs += WM_keymap_item_to_string(kmi, false, str + ofs, UI_MAX_DRAW_STR - ofs);
- }
+ wmKeyMapItem *kmi = t->custom.mode.data;
+ if (kmi) {
+ ofs += WM_keymap_item_to_string(kmi, false, str + ofs, UI_MAX_DRAW_STR - ofs);
}
+
ofs += BLI_snprintf(str + ofs,
UI_MAX_DRAW_STR - ofs,
TIP_(" or Alt) Expand to fit %s"),
@@ -157,7 +156,9 @@ void initSeqSlide(TransInfo *t)
t->num.unit_type[0] = B_UNIT_NONE;
t->num.unit_type[1] = B_UNIT_NONE;
- /* Workaround to use the same key as the modal keymap. */
- t->custom.mode.data = WM_modalkeymap_find_propvalue(t->keymap, TFM_MODAL_TRANSLATE);
+ if (t->keymap) {
+ /* Workaround to use the same key as the modal keymap. */
+ t->custom.mode.data = WM_modalkeymap_find_propvalue(t->keymap, TFM_MODAL_TRANSLATE);
+ }
}
/** \} */
diff --git a/source/blender/editors/transform/transform_mode_shrink_fatten.c b/source/blender/editors/transform/transform_mode_shrink_fatten.c
index 6058a2824e9..2a5c631df41 100644
--- a/source/blender/editors/transform/transform_mode_shrink_fatten.c
+++ b/source/blender/editors/transform/transform_mode_shrink_fatten.c
@@ -50,7 +50,7 @@ static eRedrawFlag shrinkfatten_handleEvent(struct TransInfo *t, const wmEvent *
{
BLI_assert(t->mode == TFM_SHRINKFATTEN);
wmKeyMapItem *kmi = t->custom.mode.data;
- if (event->type == kmi->type && event->val == kmi->val) {
+ if (kmi && event->type == kmi->type && event->val == kmi->val) {
/* Allows the 'Even Thickness' effect to be enabled as a toogle. */
t->flag ^= T_ALT_TRANSFORM;
return TREDRAW_HARD;
@@ -90,12 +90,11 @@ static void applyShrinkFatten(TransInfo *t, const int UNUSED(mval[2]))
}
ofs += BLI_strncpy_rlen(str + ofs, ", (", sizeof(str) - ofs);
- if (t->keymap) {
- wmKeyMapItem *kmi = t->custom.mode.data;
- if (kmi) {
- ofs += WM_keymap_item_to_string(kmi, false, str + ofs, sizeof(str) - ofs);
- }
+ wmKeyMapItem *kmi = t->custom.mode.data;
+ if (kmi) {
+ ofs += WM_keymap_item_to_string(kmi, false, str + ofs, sizeof(str) - ofs);
}
+
BLI_snprintf(str + ofs,
sizeof(str) - ofs,
TIP_(" or Alt) Even Thickness %s"),
@@ -149,8 +148,10 @@ void initShrinkFatten(TransInfo *t)
t->flag |= T_NO_CONSTRAINT;
- /* Workaround to use the same key as the modal keymap. */
- t->custom.mode.data = WM_modalkeymap_find_propvalue(t->keymap, TFM_MODAL_RESIZE);
+ if (t->keymap) {
+ /* Workaround to use the same key as the modal keymap. */
+ t->custom.mode.data = WM_modalkeymap_find_propvalue(t->keymap, TFM_MODAL_RESIZE);
+ }
}
}
/** \} */