Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/mesh/editmesh_tools.c
| Show First 20 Lines • Show All 41 Lines • ▼ Show 20 Lines | |||||
| #include "DNA_scene_types.h" | #include "DNA_scene_types.h" | ||||
| #include "BLI_listbase.h" | #include "BLI_listbase.h" | ||||
| #include "BLI_noise.h" | #include "BLI_noise.h" | ||||
| #include "BLI_math.h" | #include "BLI_math.h" | ||||
| #include "BLI_rand.h" | #include "BLI_rand.h" | ||||
| #include "BLI_sort_utils.h" | #include "BLI_sort_utils.h" | ||||
| #include "BKE_layer.h" | |||||
| #include "BKE_material.h" | #include "BKE_material.h" | ||||
| #include "BKE_context.h" | #include "BKE_context.h" | ||||
| #include "BKE_deform.h" | #include "BKE_deform.h" | ||||
| #include "BKE_depsgraph.h" | #include "BKE_depsgraph.h" | ||||
| #include "BKE_report.h" | #include "BKE_report.h" | ||||
| #include "BKE_texture.h" | #include "BKE_texture.h" | ||||
| #include "BKE_main.h" | #include "BKE_main.h" | ||||
| #include "BKE_editmesh.h" | #include "BKE_editmesh.h" | ||||
| ▲ Show 20 Lines • Show All 3,195 Lines • ▼ Show 20 Lines | for (i = 0; i < max_iter; i++) { | ||||
| result |= (mesh_separate_tagged(bmain, scene, base_old, bm_old) != NULL); | result |= (mesh_separate_tagged(bmain, scene, base_old, bm_old) != NULL); | ||||
| } | } | ||||
| return result; | return result; | ||||
| } | } | ||||
| static int edbm_separate_exec(bContext *C, wmOperator *op) | static int edbm_separate_exec(bContext *C, wmOperator *op) | ||||
| { | { | ||||
| #if 0 | |||||
| Main *bmain = CTX_data_main(C); | Main *bmain = CTX_data_main(C); | ||||
| Scene *scene = CTX_data_scene(C); | Scene *scene = CTX_data_scene(C); | ||||
| const int type = RNA_enum_get(op->ptr, "type"); | const int type = RNA_enum_get(op->ptr, "type"); | ||||
| int retval = 0; | int retval = 0; | ||||
| if (ED_operator_editmesh(C)) { | if (ED_operator_editmesh(C)) { | ||||
| Base *base = CTX_data_active_base(C); | Base *base = CTX_data_active_base(C); | ||||
| BMEditMesh *em = BKE_editmesh_from_object(base->object); | BMEditMesh *em = BKE_editmesh_from_object(base->object); | ||||
| ▲ Show 20 Lines • Show All 82 Lines • ▼ Show 20 Lines | if (retval) { | ||||
| /* delay depsgraph recalc until all objects are duplicated */ | /* delay depsgraph recalc until all objects are duplicated */ | ||||
| DAG_relations_tag_update(bmain); | DAG_relations_tag_update(bmain); | ||||
| WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, NULL); | WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, NULL); | ||||
| return OPERATOR_FINISHED; | return OPERATOR_FINISHED; | ||||
| } | } | ||||
| return OPERATOR_CANCELLED; | return OPERATOR_CANCELLED; | ||||
| #else | |||||
| /* need to refactor this to use ObjectBase and create a new object in the correct SceneCollection */ | |||||
| TODO_LAYER_BASE | |||||
| (void)C; | |||||
| (void)mesh_separate_loose; | |||||
| (void)mesh_separate_material; | |||||
| (void)mesh_separate_selected; | |||||
| BKE_report(op->reports, RPT_ERROR, "MESH_OT_separate not supported at the moment"); | |||||
| return OPERATOR_CANCELLED; | |||||
| #endif | |||||
| } | } | ||||
| void MESH_OT_separate(wmOperatorType *ot) | void MESH_OT_separate(wmOperatorType *ot) | ||||
| { | { | ||||
| static EnumPropertyItem prop_separate_types[] = { | static EnumPropertyItem prop_separate_types[] = { | ||||
| {MESH_SEPARATE_SELECTED, "SELECTED", 0, "Selection", ""}, | {MESH_SEPARATE_SELECTED, "SELECTED", 0, "Selection", ""}, | ||||
| {MESH_SEPARATE_MATERIAL, "MATERIAL", 0, "By Material", ""}, | {MESH_SEPARATE_MATERIAL, "MATERIAL", 0, "By Material", ""}, | ||||
| {MESH_SEPARATE_LOOSE, "LOOSE", 0, "By loose parts", ""}, | {MESH_SEPARATE_LOOSE, "LOOSE", 0, "By loose parts", ""}, | ||||
| ▲ Show 20 Lines • Show All 2,592 Lines • Show Last 20 Lines | |||||