Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/transform/transform_constraints.c
| Show First 20 Lines • Show All 647 Lines • ▼ Show 20 Lines | |||||
| /* | /* | ||||
| * Set the constraint according to the user defined orientation | * Set the constraint according to the user defined orientation | ||||
| * | * | ||||
| * ftext is a format string passed to BLI_snprintf. It will add the name of | * ftext is a format string passed to BLI_snprintf. It will add the name of | ||||
| * the orientation where %s is (logically). | * the orientation where %s is (logically). | ||||
| */ | */ | ||||
| void setUserConstraint(TransInfo *t, short orientation, int mode, const char ftext[]) | void setUserConstraint(TransInfo *t, short orientation, int mode, const char ftext[]) | ||||
| { | { | ||||
| char text[40]; | char text[256]; | ||||
| switch (orientation) { | switch (orientation) { | ||||
| case V3D_MANIP_GLOBAL: | case V3D_MANIP_GLOBAL: | ||||
| { | { | ||||
| float mtx[3][3]; | float mtx[3][3]; | ||||
| BLI_snprintf(text, sizeof(text), ftext, IFACE_("global")); | BLI_snprintf(text, sizeof(text), ftext, IFACE_("global")); | ||||
| unit_m3(mtx); | unit_m3(mtx); | ||||
| setConstraint(t, mtx, mode, text); | setConstraint(t, mtx, mode, text); | ||||
| Show All 15 Lines | switch (orientation) { | ||||
| case V3D_MANIP_VIEW: | case V3D_MANIP_VIEW: | ||||
| BLI_snprintf(text, sizeof(text), ftext, IFACE_("view")); | BLI_snprintf(text, sizeof(text), ftext, IFACE_("view")); | ||||
| setConstraint(t, t->spacemtx, mode, text); | setConstraint(t, t->spacemtx, mode, text); | ||||
| break; | break; | ||||
| case V3D_MANIP_GIMBAL: | case V3D_MANIP_GIMBAL: | ||||
| BLI_snprintf(text, sizeof(text), ftext, IFACE_("gimbal")); | BLI_snprintf(text, sizeof(text), ftext, IFACE_("gimbal")); | ||||
| setConstraint(t, t->spacemtx, mode, text); | setConstraint(t, t->spacemtx, mode, text); | ||||
| break; | break; | ||||
| default: /* V3D_MANIP_CUSTOM */ | case V3D_MANIP_CUSTOM: | ||||
| BLI_snprintf(text, sizeof(text), ftext, t->spacename); | { | ||||
| char orientation_str[128]; | |||||
| BLI_snprintf(orientation_str, sizeof(orientation_str), "%s \"%s\"", | |||||
| IFACE_("custom orientation"), t->custom_orientation->name); | |||||
| BLI_snprintf(text, sizeof(text), ftext, orientation_str); | |||||
| setConstraint(t, t->spacemtx, mode, text); | setConstraint(t, t->spacemtx, mode, text); | ||||
| break; | break; | ||||
| } | } | ||||
| } | |||||
| t->con.orientation = orientation; | t->con.orientation = orientation; | ||||
| t->con.mode |= CON_USER; | t->con.mode |= CON_USER; | ||||
| } | } | ||||
| /*----------------- DRAWING CONSTRAINTS -------------------*/ | /*----------------- DRAWING CONSTRAINTS -------------------*/ | ||||
| ▲ Show 20 Lines • Show All 436 Lines • Show Last 20 Lines | |||||