Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/transform/transform_generics.c
| Show First 20 Lines • Show All 422 Lines • ▼ Show 20 Lines | else { | ||||
| else { | else { | ||||
| t->view = NULL; | t->view = NULL; | ||||
| } | } | ||||
| t->around = V3D_AROUND_CENTER_BOUNDS; | t->around = V3D_AROUND_CENTER_BOUNDS; | ||||
| } | } | ||||
| BLI_assert(is_zero_v4(t->values_modal_offset)); | BLI_assert(is_zero_v4(t->values_modal_offset)); | ||||
| bool use_orient_axis = false; | |||||
| bool t_values_set_is_array = false; | bool t_values_set_is_array = false; | ||||
| if (op && (prop = RNA_struct_find_property(op->ptr, "value")) && | if (op && (prop = RNA_struct_find_property(op->ptr, "value")) && | ||||
| RNA_property_is_set(op->ptr, prop)) { | RNA_property_is_set(op->ptr, prop)) { | ||||
| float values[4] = {0}; /* in case value isn't length 4, avoid uninitialized memory */ | float values[4] = {0}; /* in case value isn't length 4, avoid uninitialized memory */ | ||||
| if (RNA_property_array_check(prop)) { | if (RNA_property_array_check(prop)) { | ||||
| RNA_float_get_array(op->ptr, "value", values); | RNA_float_get_array(op->ptr, "value", values); | ||||
| t_values_set_is_array = true; | t_values_set_is_array = true; | ||||
| } | } | ||||
| else { | else { | ||||
| values[0] = RNA_float_get(op->ptr, "value"); | values[0] = RNA_float_get(op->ptr, "value"); | ||||
| } | } | ||||
| copy_v4_v4(t->values, values); | copy_v4_v4(t->values, values); | ||||
| if (t->flag & T_MODAL) { | if (t->flag & T_MODAL) { | ||||
| /* Run before init functions so 'values_modal_offset' can be applied on mouse input. */ | /* Run before init functions so 'values_modal_offset' can be applied on mouse input. */ | ||||
| copy_v4_v4(t->values_modal_offset, values); | copy_v4_v4(t->values_modal_offset, values); | ||||
| } | } | ||||
| else { | else { | ||||
| copy_v4_v4(t->values, values); | copy_v4_v4(t->values, values); | ||||
| t->flag |= T_INPUT_IS_VALUES_FINAL; | t->flag |= T_INPUT_IS_VALUES_FINAL; | ||||
| } | } | ||||
| } | } | ||||
| if (op && (prop = RNA_struct_find_property(op->ptr, "orient_axis"))) { | |||||
| t->orient_axis = RNA_property_enum_get(op->ptr, prop); | |||||
| use_orient_axis = true; | |||||
| } | |||||
| if (op && (prop = RNA_struct_find_property(op->ptr, "constraint_axis"))) { | if (op && (prop = RNA_struct_find_property(op->ptr, "constraint_axis"))) { | ||||
| bool constraint_axis[3] = {false, false, false}; | bool constraint_axis[3] = {false, false, false}; | ||||
| if (t->flag & T_INPUT_IS_VALUES_FINAL) { | if (t->flag & T_INPUT_IS_VALUES_FINAL) { | ||||
| if (t_values_set_is_array) { | if (t_values_set_is_array) { | ||||
| /* For operators whose `t->values` is array, set constraint so that the | /* For operators whose `t->values` is array, set constraint so that the | ||||
| * orientation is more intuitive in the Redo Panel. */ | * orientation is more intuitive in the Redo Panel. */ | ||||
| constraint_axis[0] = constraint_axis[1] = constraint_axis[2] = true; | constraint_axis[0] = constraint_axis[1] = constraint_axis[2] = true; | ||||
| } | } | ||||
| else if (use_orient_axis) { | |||||
| constraint_axis[t->orient_axis] = true; | |||||
| } | |||||
| } | } | ||||
| else if (RNA_property_is_set(op->ptr, prop)) { | else if (RNA_property_is_set(op->ptr, prop)) { | ||||
| RNA_property_boolean_get_array(op->ptr, prop, constraint_axis); | RNA_property_boolean_get_array(op->ptr, prop, constraint_axis); | ||||
| } | } | ||||
| if (constraint_axis[0] || constraint_axis[1] || constraint_axis[2]) { | if (constraint_axis[0] || constraint_axis[1] || constraint_axis[2]) { | ||||
| t->con.mode |= CON_APPLY; | t->con.mode |= CON_APPLY; | ||||
| Show All 12 Lines | void initTransInfo(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *event) | ||||
| { | { | ||||
| short orient_types[3]; | short orient_types[3]; | ||||
| float custom_matrix[3][3]; | float custom_matrix[3][3]; | ||||
| short orient_type_scene = V3D_ORIENT_GLOBAL; | short orient_type_scene = V3D_ORIENT_GLOBAL; | ||||
| short orient_type_set = V3D_ORIENT_GLOBAL; | short orient_type_set = V3D_ORIENT_GLOBAL; | ||||
| short orient_type_matrix_set = -1; | short orient_type_matrix_set = -1; | ||||
| bool use_orient_axis = false; | |||||
| if ((t->spacetype == SPACE_VIEW3D) && (t->region->regiontype == RGN_TYPE_WINDOW)) { | if ((t->spacetype == SPACE_VIEW3D) && (t->region->regiontype == RGN_TYPE_WINDOW)) { | ||||
| TransformOrientationSlot *orient_slot = &t->scene->orientation_slots[SCE_ORIENT_DEFAULT]; | TransformOrientationSlot *orient_slot = &t->scene->orientation_slots[SCE_ORIENT_DEFAULT]; | ||||
| orient_type_scene = orient_slot->type; | orient_type_scene = orient_slot->type; | ||||
| if (orient_type_scene == V3D_ORIENT_CUSTOM) { | if (orient_type_scene == V3D_ORIENT_CUSTOM) { | ||||
| const int index_custom = orient_slot->index_custom; | const int index_custom = orient_slot->index_custom; | ||||
| orient_type_scene += index_custom; | orient_type_scene += index_custom; | ||||
| } | } | ||||
| } | } | ||||
| short orient_type_default = orient_type_scene; | short orient_type_default = orient_type_scene; | ||||
| if (op && (prop = RNA_struct_find_property(op->ptr, "orient_axis"))) { | |||||
| t->orient_axis = RNA_property_enum_get(op->ptr, prop); | |||||
| use_orient_axis = true; | |||||
| } | |||||
| if (op && (prop = RNA_struct_find_property(op->ptr, "orient_axis_ortho"))) { | if (op && (prop = RNA_struct_find_property(op->ptr, "orient_axis_ortho"))) { | ||||
| t->orient_axis_ortho = RNA_property_enum_get(op->ptr, prop); | t->orient_axis_ortho = RNA_property_enum_get(op->ptr, prop); | ||||
| } | } | ||||
| if (op && ((prop = RNA_struct_find_property(op->ptr, "orient_type")) && | if (op && ((prop = RNA_struct_find_property(op->ptr, "orient_type")) && | ||||
| RNA_property_is_set(op->ptr, prop))) { | RNA_property_is_set(op->ptr, prop))) { | ||||
| orient_type_set = RNA_property_enum_get(op->ptr, prop); | orient_type_set = RNA_property_enum_get(op->ptr, prop); | ||||
| if (orient_type_set >= V3D_ORIENT_CUSTOM + BIF_countTransformOrientation(C)) { | if (orient_type_set >= V3D_ORIENT_CUSTOM + BIF_countTransformOrientation(C)) { | ||||
| ▲ Show 20 Lines • Show All 964 Lines • Show Last 20 Lines | |||||