Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/mesh/editmesh_inset.c
| Show First 20 Lines • Show All 118 Lines • ▼ Show 20 Lines | |||||
| static bool edbm_inset_init(bContext *C, wmOperator *op, const bool is_modal) | static bool edbm_inset_init(bContext *C, wmOperator *op, const bool is_modal) | ||||
| { | { | ||||
| InsetData *opdata; | InsetData *opdata; | ||||
| Scene *scene = CTX_data_scene(C); | Scene *scene = CTX_data_scene(C); | ||||
| ViewLayer *view_layer = CTX_data_view_layer(C); | ViewLayer *view_layer = CTX_data_view_layer(C); | ||||
| if (is_modal) { | if (is_modal) { | ||||
| RNA_float_set(op->ptr, "thickness", 0.01f); | RNA_float_set(op->ptr, "thickness", 0.0f); | ||||
| RNA_float_set(op->ptr, "depth", 0.0f); | RNA_float_set(op->ptr, "depth", 0.0f); | ||||
| } | } | ||||
| op->customdata = opdata = MEM_mallocN(sizeof(InsetData), "inset_operator_data"); | op->customdata = opdata = MEM_mallocN(sizeof(InsetData), "inset_operator_data"); | ||||
| uint objects_used_len = 0; | uint objects_used_len = 0; | ||||
| { | { | ||||
| uint ob_store_len = 0; | uint ob_store_len = 0; | ||||
| Object **objects = BKE_view_layer_array_from_objects_in_edit_mode_unique_data(view_layer, CTX_wm_view3d(C), &ob_store_len); | Object **objects = BKE_view_layer_array_from_objects_in_edit_mode_unique_data(view_layer, CTX_wm_view3d(C), &ob_store_len); | ||||
| opdata->ob_store = MEM_malloc_arrayN(ob_store_len, sizeof(*opdata->ob_store), __func__); | opdata->ob_store = MEM_malloc_arrayN(ob_store_len, sizeof(*opdata->ob_store), __func__); | ||||
| for (uint ob_index = 0; ob_index < ob_store_len; ob_index++) { | for (uint ob_index = 0; ob_index < ob_store_len; ob_index++) { | ||||
| Object *obedit = objects[ob_index]; | Object *obedit = objects[ob_index]; | ||||
| BMEditMesh *em = BKE_editmesh_from_object(obedit); | BMEditMesh *em = BKE_editmesh_from_object(obedit); | ||||
| if (em->bm->totvertsel > 0) { | if (em->bm->totvertsel > 0) { | ||||
| opdata->ob_store[objects_used_len].em = em; | opdata->ob_store[objects_used_len].em = em; | ||||
| objects_used_len++; | objects_used_len++; | ||||
| } | } | ||||
| } | } | ||||
| MEM_freeN(objects); | MEM_freeN(objects); | ||||
| opdata->ob_store_len = objects_used_len; | opdata->ob_store_len = objects_used_len; | ||||
| } | } | ||||
| opdata->old_thickness = 0.01; | opdata->old_thickness = 0.0; | ||||
| opdata->old_depth = 0.0; | opdata->old_depth = 0.0; | ||||
| opdata->modify_depth = false; | opdata->modify_depth = false; | ||||
| opdata->shift = false; | opdata->shift = false; | ||||
| opdata->shift_amount = 0.0f; | opdata->shift_amount = 0.0f; | ||||
| opdata->is_modal = is_modal; | opdata->is_modal = is_modal; | ||||
| initNumInput(&opdata->num_input); | initNumInput(&opdata->num_input); | ||||
| opdata->num_input.idx_max = 1; /* Two elements. */ | opdata->num_input.idx_max = 1; /* Two elements. */ | ||||
| ▲ Show 20 Lines • Show All 401 Lines • ▼ Show 20 Lines | RNA_def_boolean( | ||||
| true, "Offset Even", "Scale the offset to give more even thickness"); | true, "Offset Even", "Scale the offset to give more even thickness"); | ||||
| RNA_def_boolean( | RNA_def_boolean( | ||||
| ot->srna, "use_relative_offset", | ot->srna, "use_relative_offset", | ||||
| false, "Offset Relative", "Scale the offset by surrounding geometry"); | false, "Offset Relative", "Scale the offset by surrounding geometry"); | ||||
| RNA_def_boolean( | RNA_def_boolean( | ||||
| ot->srna, "use_edge_rail", | ot->srna, "use_edge_rail", | ||||
| false, "Edge Rail", "Inset the region along existing edges"); | false, "Edge Rail", "Inset the region along existing edges"); | ||||
| prop = RNA_def_float_distance(ot->srna, "thickness", 0.01f, 0.0f, 1e12f, "Thickness", "", 0.0f, 10.0f); | prop = RNA_def_float_distance(ot->srna, "thickness", 0.0f, 0.0f, 1e12f, "Thickness", "", 0.0f, 10.0f); | ||||
| /* use 1 rather then 10 for max else dragging the button moves too far */ | /* use 1 rather then 10 for max else dragging the button moves too far */ | ||||
| RNA_def_property_ui_range(prop, 0.0, 1.0, 0.01, 4); | RNA_def_property_ui_range(prop, 0.0, 1.0, 0.01, 4); | ||||
| prop = RNA_def_float_distance(ot->srna, "depth", 0.0f, -1e12f, 1e12f, "Depth", "", -10.0f, 10.0f); | prop = RNA_def_float_distance(ot->srna, "depth", 0.0f, -1e12f, 1e12f, "Depth", "", -10.0f, 10.0f); | ||||
| RNA_def_property_ui_range(prop, -10.0f, 10.0f, 0.01, 4); | RNA_def_property_ui_range(prop, -10.0f, 10.0f, 0.01, 4); | ||||
| RNA_def_boolean(ot->srna, "use_outset", false, "Outset", "Outset rather than inset"); | RNA_def_boolean(ot->srna, "use_outset", false, "Outset", "Outset rather than inset"); | ||||
| RNA_def_boolean(ot->srna, "use_select_inset", false, "Select Outer", "Select the new inset faces"); | RNA_def_boolean(ot->srna, "use_select_inset", false, "Select Outer", "Select the new inset faces"); | ||||
| RNA_def_boolean(ot->srna, "use_individual", false, "Individual", "Individual Face Inset"); | RNA_def_boolean(ot->srna, "use_individual", false, "Individual", "Individual Face Inset"); | ||||
| RNA_def_boolean(ot->srna, "use_interpolate", true, "Interpolate", "Blend face data across the inset"); | RNA_def_boolean(ot->srna, "use_interpolate", true, "Interpolate", "Blend face data across the inset"); | ||||
| prop = RNA_def_boolean(ot->srna, "release_confirm", 0, "Confirm on Release", ""); | prop = RNA_def_boolean(ot->srna, "release_confirm", 0, "Confirm on Release", ""); | ||||
| RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE); | RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE); | ||||
| } | } | ||||