Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/object/object_shader_fx.c
| Show First 20 Lines • Show All 241 Lines • ▼ Show 20 Lines | static int shaderfx_add_exec(bContext *C, wmOperator *op) | ||||
| Scene *scene = CTX_data_scene(C); | Scene *scene = CTX_data_scene(C); | ||||
| Object *ob = ED_object_active_context(C); | Object *ob = ED_object_active_context(C); | ||||
| int type = RNA_enum_get(op->ptr, "type"); | int type = RNA_enum_get(op->ptr, "type"); | ||||
| if (!ED_object_shaderfx_add(op->reports, bmain, scene, ob, NULL, type)) { | if (!ED_object_shaderfx_add(op->reports, bmain, scene, ob, NULL, type)) { | ||||
| return OPERATOR_CANCELLED; | return OPERATOR_CANCELLED; | ||||
| } | } | ||||
| WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER, ob); | WM_event_add_notifier(C, NC_OBJECT | ND_SHADERFX, ob); | ||||
| return OPERATOR_FINISHED; | return OPERATOR_FINISHED; | ||||
| } | } | ||||
| static const EnumPropertyItem *shaderfx_add_itemf(bContext *C, | static const EnumPropertyItem *shaderfx_add_itemf(bContext *C, | ||||
| PointerRNA *UNUSED(ptr), | PointerRNA *UNUSED(ptr), | ||||
| PropertyRNA *UNUSED(prop), | PropertyRNA *UNUSED(prop), | ||||
| bool *r_free) | bool *r_free) | ||||
| ▲ Show 20 Lines • Show All 144 Lines • ▼ Show 20 Lines | static int shaderfx_remove_exec(bContext *C, wmOperator *op) | ||||
| Main *bmain = CTX_data_main(C); | Main *bmain = CTX_data_main(C); | ||||
| Object *ob = ED_object_active_context(C); | Object *ob = ED_object_active_context(C); | ||||
| ShaderFxData *fx = edit_shaderfx_property_get(op, ob, 0); | ShaderFxData *fx = edit_shaderfx_property_get(op, ob, 0); | ||||
| if (!fx || !ED_object_shaderfx_remove(op->reports, bmain, ob, fx)) { | if (!fx || !ED_object_shaderfx_remove(op->reports, bmain, ob, fx)) { | ||||
| return OPERATOR_CANCELLED; | return OPERATOR_CANCELLED; | ||||
| } | } | ||||
| WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER, ob); | WM_event_add_notifier(C, NC_OBJECT | ND_SHADERFX, ob); | ||||
| return OPERATOR_FINISHED; | return OPERATOR_FINISHED; | ||||
| } | } | ||||
| static int shaderfx_remove_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event)) | static int shaderfx_remove_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event)) | ||||
| { | { | ||||
| if (edit_shaderfx_invoke_properties(C, op)) { | if (edit_shaderfx_invoke_properties(C, op)) { | ||||
| return shaderfx_remove_exec(C, op); | return shaderfx_remove_exec(C, op); | ||||
| Show All 25 Lines | static int shaderfx_move_up_exec(bContext *C, wmOperator *op) | ||||
| Object *ob = ED_object_active_context(C); | Object *ob = ED_object_active_context(C); | ||||
| ShaderFxData *fx = edit_shaderfx_property_get(op, ob, 0); | ShaderFxData *fx = edit_shaderfx_property_get(op, ob, 0); | ||||
| if (!fx || !ED_object_shaderfx_move_up(op->reports, ob, fx)) { | if (!fx || !ED_object_shaderfx_move_up(op->reports, ob, fx)) { | ||||
| return OPERATOR_CANCELLED; | return OPERATOR_CANCELLED; | ||||
| } | } | ||||
| DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY); | DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY); | ||||
| WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER, ob); | WM_event_add_notifier(C, NC_OBJECT | ND_SHADERFX, ob); | ||||
| return OPERATOR_FINISHED; | return OPERATOR_FINISHED; | ||||
| } | } | ||||
| static int shaderfx_move_up_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event)) | static int shaderfx_move_up_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event)) | ||||
| { | { | ||||
| if (edit_shaderfx_invoke_properties(C, op)) { | if (edit_shaderfx_invoke_properties(C, op)) { | ||||
| return shaderfx_move_up_exec(C, op); | return shaderfx_move_up_exec(C, op); | ||||
| Show All 25 Lines | static int shaderfx_move_down_exec(bContext *C, wmOperator *op) | ||||
| Object *ob = ED_object_active_context(C); | Object *ob = ED_object_active_context(C); | ||||
| ShaderFxData *fx = edit_shaderfx_property_get(op, ob, 0); | ShaderFxData *fx = edit_shaderfx_property_get(op, ob, 0); | ||||
| if (!fx || !ED_object_shaderfx_move_down(op->reports, ob, fx)) { | if (!fx || !ED_object_shaderfx_move_down(op->reports, ob, fx)) { | ||||
| return OPERATOR_CANCELLED; | return OPERATOR_CANCELLED; | ||||
| } | } | ||||
| DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY); | DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY); | ||||
| WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER, ob); | WM_event_add_notifier(C, NC_OBJECT | ND_SHADERFX, ob); | ||||
| return OPERATOR_FINISHED; | return OPERATOR_FINISHED; | ||||
| } | } | ||||
| static int shaderfx_move_down_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event)) | static int shaderfx_move_down_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event)) | ||||
| { | { | ||||
| if (edit_shaderfx_invoke_properties(C, op)) { | if (edit_shaderfx_invoke_properties(C, op)) { | ||||
| return shaderfx_move_down_exec(C, op); | return shaderfx_move_down_exec(C, op); | ||||
| Show All 31 Lines | static int shaderfx_move_to_index_exec(bContext *C, wmOperator *op) | ||||
| ShaderFxData *fx = edit_shaderfx_property_get(op, ob, 0); | ShaderFxData *fx = edit_shaderfx_property_get(op, ob, 0); | ||||
| int index = RNA_int_get(op->ptr, "index"); | int index = RNA_int_get(op->ptr, "index"); | ||||
| if (!fx || !ED_object_shaderfx_move_to_index(op->reports, ob, fx, index)) { | if (!fx || !ED_object_shaderfx_move_to_index(op->reports, ob, fx, index)) { | ||||
| return OPERATOR_CANCELLED; | return OPERATOR_CANCELLED; | ||||
| } | } | ||||
| DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY); | DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY); | ||||
| WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER, ob); | WM_event_add_notifier(C, NC_OBJECT | ND_SHADERFX, ob); | ||||
| return OPERATOR_FINISHED; | return OPERATOR_FINISHED; | ||||
| } | } | ||||
| static int shaderfx_move_to_index_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event)) | static int shaderfx_move_to_index_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event)) | ||||
| { | { | ||||
| if (edit_shaderfx_invoke_properties(C, op)) { | if (edit_shaderfx_invoke_properties(C, op)) { | ||||
| return shaderfx_move_to_index_exec(C, op); | return shaderfx_move_to_index_exec(C, op); | ||||
| Show All 24 Lines | |||||