Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/physics/particle_edit.c
| Show First 20 Lines • Show All 5,262 Lines • ▼ Show 20 Lines | if (psys->edit != NULL) { | ||||
| BLI_assert(psys->free_edit != NULL); | BLI_assert(psys->free_edit != NULL); | ||||
| psys->free_edit(psys->edit); | psys->free_edit(psys->edit); | ||||
| psys->free_edit = NULL; | psys->free_edit = NULL; | ||||
| psys->edit = NULL; | psys->edit = NULL; | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| void ED_object_particle_edit_mode_exit_ex(bContext *C, Object *ob) | |||||
| { | |||||
| ob->mode &= ~OB_MODE_PARTICLE_EDIT; | |||||
| toggle_particle_cursor(C, 0); | |||||
| free_all_psys_edit(ob); | |||||
| WM_event_add_notifier(C, NC_SCENE | ND_MODE | NS_MODE_OBJECT, NULL); | |||||
| } | |||||
| void ED_object_particle_edit_mode_exit(bContext *C) | |||||
| { | |||||
| Object *ob = CTX_data_active_object(C); | |||||
| ED_object_particle_edit_mode_exit_ex(C, ob); | |||||
| } | |||||
| static int particle_edit_toggle_exec(bContext *C, wmOperator *op) | static int particle_edit_toggle_exec(bContext *C, wmOperator *op) | ||||
| { | { | ||||
| struct wmMsgBus *mbus = CTX_wm_message_bus(C); | struct wmMsgBus *mbus = CTX_wm_message_bus(C); | ||||
| Depsgraph *depsgraph = CTX_data_depsgraph_pointer(C); | Depsgraph *depsgraph = CTX_data_depsgraph_pointer(C); | ||||
| Scene *scene = CTX_data_scene(C); | Scene *scene = CTX_data_scene(C); | ||||
| Object *ob = CTX_data_active_object(C); | Object *ob = CTX_data_active_object(C); | ||||
| const int mode_flag = OB_MODE_PARTICLE_EDIT; | const int mode_flag = OB_MODE_PARTICLE_EDIT; | ||||
| const bool is_mode_set = (ob->mode & mode_flag) != 0; | const bool is_mode_set = (ob->mode & mode_flag) != 0; | ||||
| Show All 23 Lines | if (edit && edit->psys) { | ||||
| object_eval, edit->psmd->modifier.name); | object_eval, edit->psmd->modifier.name); | ||||
| recalc_emitter_field(depsgraph, ob, edit->psys); | recalc_emitter_field(depsgraph, ob, edit->psys); | ||||
| } | } | ||||
| toggle_particle_cursor(C, 1); | toggle_particle_cursor(C, 1); | ||||
| WM_event_add_notifier(C, NC_SCENE | ND_MODE | NS_MODE_PARTICLE, NULL); | WM_event_add_notifier(C, NC_SCENE | ND_MODE | NS_MODE_PARTICLE, NULL); | ||||
| } | } | ||||
| else { | else { | ||||
| ob->mode &= ~mode_flag; | ED_object_particle_edit_mode_exit_ex(C, ob); | ||||
| toggle_particle_cursor(C, 0); | |||||
| free_all_psys_edit(ob); | |||||
| WM_event_add_notifier(C, NC_SCENE | ND_MODE | NS_MODE_OBJECT, NULL); | |||||
| } | } | ||||
| DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY | ID_RECALC_COPY_ON_WRITE); | DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY | ID_RECALC_COPY_ON_WRITE); | ||||
| WM_msg_publish_rna_prop(mbus, &ob->id, ob, Object, mode); | WM_msg_publish_rna_prop(mbus, &ob->id, ob, Object, mode); | ||||
| WM_toolsystem_update_from_context_view3d(C); | WM_toolsystem_update_from_context_view3d(C); | ||||
| ▲ Show 20 Lines • Show All 186 Lines • Show Last 20 Lines | |||||