Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/curve/editcurve.c
| Show First 20 Lines • Show All 45 Lines • ▼ Show 20 Lines | |||||
| #include "BKE_layer.h" | #include "BKE_layer.h" | ||||
| #include "BKE_library.h" | #include "BKE_library.h" | ||||
| #include "BKE_main.h" | #include "BKE_main.h" | ||||
| #include "BKE_modifier.h" | #include "BKE_modifier.h" | ||||
| #include "BKE_report.h" | #include "BKE_report.h" | ||||
| #include "DEG_depsgraph.h" | #include "DEG_depsgraph.h" | ||||
| #include "DEG_depsgraph_build.h" | #include "DEG_depsgraph_build.h" | ||||
| #include "DEG_depsgraph_query.h" | |||||
| #include "WM_api.h" | #include "WM_api.h" | ||||
| #include "WM_types.h" | #include "WM_types.h" | ||||
| #include "ED_keyframes_edit.h" | #include "ED_keyframes_edit.h" | ||||
| #include "ED_object.h" | #include "ED_object.h" | ||||
| #include "ED_screen.h" | #include "ED_screen.h" | ||||
| #include "ED_transform.h" | #include "ED_transform.h" | ||||
| ▲ Show 20 Lines • Show All 7,037 Lines • ▼ Show 20 Lines | |||||
| static int match_texture_space_exec(bContext *C, wmOperator *UNUSED(op)) | static int match_texture_space_exec(bContext *C, wmOperator *UNUSED(op)) | ||||
| { | { | ||||
| /* Need to ensure the dependency graph is fully evaluated, so the display list is at a correct | /* Need to ensure the dependency graph is fully evaluated, so the display list is at a correct | ||||
| * state. */ | * state. */ | ||||
| Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C); | Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C); | ||||
| (void)depsgraph; | (void)depsgraph; | ||||
| Object *object = CTX_data_active_object(C); | Object *object = CTX_data_active_object(C); | ||||
| Object *object_eval = DEG_get_evaluated_object(depsgraph, object); | |||||
| Curve *curve = (Curve *)object->data; | Curve *curve = (Curve *)object->data; | ||||
| float min[3], max[3], size[3], loc[3]; | float min[3], max[3], size[3], loc[3]; | ||||
| int a; | int a; | ||||
| BLI_assert(object->runtime.curve_cache != NULL); | BLI_assert(object_eval->runtime.curve_cache != NULL); | ||||
| INIT_MINMAX(min, max); | INIT_MINMAX(min, max); | ||||
| BKE_displist_minmax(&object->runtime.curve_cache->disp, min, max); | BKE_displist_minmax(&object_eval->runtime.curve_cache->disp, min, max); | ||||
| mid_v3_v3v3(loc, min, max); | mid_v3_v3v3(loc, min, max); | ||||
| size[0] = (max[0] - min[0]) / 2.0f; | size[0] = (max[0] - min[0]) / 2.0f; | ||||
| size[1] = (max[1] - min[1]) / 2.0f; | size[1] = (max[1] - min[1]) / 2.0f; | ||||
| size[2] = (max[2] - min[2]) / 2.0f; | size[2] = (max[2] - min[2]) / 2.0f; | ||||
| for (a = 0; a < 3; a++) { | for (a = 0; a < 3; a++) { | ||||
| Show All 10 Lines | static int match_texture_space_exec(bContext *C, wmOperator *UNUSED(op)) | ||||
| copy_v3_v3(curve->loc, loc); | copy_v3_v3(curve->loc, loc); | ||||
| copy_v3_v3(curve->size, size); | copy_v3_v3(curve->size, size); | ||||
| zero_v3(curve->rot); | zero_v3(curve->rot); | ||||
| curve->texflag &= ~CU_AUTOSPACE; | curve->texflag &= ~CU_AUTOSPACE; | ||||
| WM_event_add_notifier(C, NC_GEOM | ND_DATA, curve); | WM_event_add_notifier(C, NC_GEOM | ND_DATA, curve); | ||||
| DEG_id_tag_update(&curve->id, ID_RECALC_GEOMETRY); | |||||
| return OPERATOR_FINISHED; | return OPERATOR_FINISHED; | ||||
| } | } | ||||
| void CURVE_OT_match_texture_space(wmOperatorType *ot) | void CURVE_OT_match_texture_space(wmOperatorType *ot) | ||||
| { | { | ||||
| /* identifiers */ | /* identifiers */ | ||||
| ot->name = "Match Texture Space"; | ot->name = "Match Texture Space"; | ||||
| Show All 10 Lines | |||||