Fix T60781: DOF Distance (pick) crashes
authorCampbell Barton <ideasman42@gmail.com>
Wed, 23 Jan 2019 05:41:40 +0000 (16:41 +1100)
committerCampbell Barton <ideasman42@gmail.com>
Wed, 23 Jan 2019 05:43:18 +0000 (16:43 +1100)
From own recent changes c8e75c2b00cfb7e8

source/blender/editors/interface/interface_eyedropper_depth.c

index 1634e7c6bd450dd3a07bfc0458fab35a3da8c684..68a93229eb58fe7957b81f11661f94594e22d979 100644 (file)
@@ -111,9 +111,13 @@ static int depthdropper_init(bContext *C, wmOperator *op)
                        if (v3d->camera && v3d->camera->data && !ID_IS_LINKED(v3d->camera->data)) {
                                RNA_id_pointer_create(v3d->camera->data, &ddr->ptr);
                                ddr->prop = RNA_struct_find_property(&ddr->ptr, "dof_distance");
+                               ddr->is_undo = true;
                        }
                }
        }
+       else {
+               ddr->is_undo = UI_but_flag_is_set(but, UI_BUT_UNDO);
+       }
 
        if ((ddr->ptr.data == NULL) ||
            (ddr->prop == NULL) ||
@@ -125,8 +129,6 @@ static int depthdropper_init(bContext *C, wmOperator *op)
        }
        op->customdata = ddr;
 
-       ddr->is_undo = UI_but_flag_is_set(but, UI_BUT_UNDO);
-
        ddr->art = art;
        ddr->draw_handle_pixel = ED_region_draw_cb_activate(art, depthdropper_draw_cb, ddr, REGION_DRAW_POST_PIXEL);
        ddr->init_depth = RNA_property_float_get(&ddr->ptr, ddr->prop);