From 7f25242089c97b2a044257df98463e12c347eb1b Mon Sep 17 00:00:00 2001 From: Hans Goudey Date: Tue, 26 Mar 2024 22:29:53 -0400 Subject: [PATCH] Cleanup: Move object mode switching declarations to proper modules Keep each function's declaration in the header file associated with its module. Arguably mode switching should be more organized, but for now it's better to just declare functions in more predictable places. --- source/blender/editors/include/ED_object.hh | 36 ------------------- source/blender/editors/include/ED_paint.hh | 26 ++++++++++++-- source/blender/editors/include/ED_physics.hh | 12 +++++-- source/blender/editors/include/ED_sculpt.hh | 10 ++++++ source/blender/editors/object/object_modes.cc | 3 ++ .../editors/physics/particle_edit_undo.cc | 1 + source/blender/editors/util/ed_util.cc | 1 + 7 files changed, 49 insertions(+), 40 deletions(-) diff --git a/source/blender/editors/include/ED_object.hh b/source/blender/editors/include/ED_object.hh index bbe4f64ee8b..f48a94504ef 100644 --- a/source/blender/editors/include/ED_object.hh +++ b/source/blender/editors/include/ED_object.hh @@ -282,42 +282,6 @@ bool ED_object_editmode_enter_ex(Main *bmain, Scene *scene, Object *ob, int flag bool ED_object_editmode_enter(bContext *C, int flag); bool ED_object_editmode_load(Main *bmain, Object *obedit); -void ED_object_vpaintmode_enter_ex(Main *bmain, Depsgraph *depsgraph, Scene *scene, Object *ob); -void ED_object_vpaintmode_enter(bContext *C, Depsgraph *depsgraph); -void ED_object_wpaintmode_enter_ex(Main *bmain, Depsgraph *depsgraph, Scene *scene, Object *ob); -void ED_object_wpaintmode_enter(bContext *C, Depsgraph *depsgraph); - -void ED_object_vpaintmode_exit_ex(Object *ob); -void ED_object_vpaintmode_exit(bContext *C); -void ED_object_wpaintmode_exit_ex(Object *ob); -void ED_object_wpaintmode_exit(bContext *C); - -void ED_object_texture_paint_mode_enter_ex(Main *bmain, - Scene *scene, - Depsgraph *depsgraph, - Object *ob); -void ED_object_texture_paint_mode_enter(bContext *C); - -void ED_object_texture_paint_mode_exit_ex(Main *bmain, Scene *scene, Object *ob); -void ED_object_texture_paint_mode_exit(bContext *C); - -bool ED_object_particle_edit_mode_supported(const Object *ob); -void ED_object_particle_edit_mode_enter_ex(Depsgraph *depsgraph, Scene *scene, Object *ob); -void ED_object_particle_edit_mode_enter(bContext *C); - -void ED_object_particle_edit_mode_exit_ex(Scene *scene, Object *ob); -void ED_object_particle_edit_mode_exit(bContext *C); - -void ED_object_sculptmode_enter_ex(Main *bmain, - Depsgraph *depsgraph, - Scene *scene, - Object *ob, - bool force_dyntopo, - ReportList *reports); -void ED_object_sculptmode_enter(bContext *C, Depsgraph *depsgraph, ReportList *reports); -void ED_object_sculptmode_exit_ex(Main *bmain, Depsgraph *depsgraph, Scene *scene, Object *ob); -void ED_object_sculptmode_exit(bContext *C, Depsgraph *depsgraph); - void ED_object_location_from_view(bContext *C, float loc[3]); void ED_object_rotation_from_quat(float rot[3], const float quat[4], char align_axis); void ED_object_rotation_from_view(bContext *C, float rot[3], char align_axis); diff --git a/source/blender/editors/include/ED_paint.hh b/source/blender/editors/include/ED_paint.hh index b886b732272..47c9a43f208 100644 --- a/source/blender/editors/include/ED_paint.hh +++ b/source/blender/editors/include/ED_paint.hh @@ -13,12 +13,15 @@ enum class PaintMode : int8_t; struct bContext; struct bToolRef; -struct PaintModeSettings; -struct ImBuf; +struct Depsgraph; struct Image; struct ImageUser; +struct ImBuf; +struct Main; +struct PaintModeSettings; struct PaintTileMap; struct ReportList; +struct Scene; struct UndoStep; struct UndoType; struct wmKeyConfig; @@ -127,3 +130,22 @@ bool ED_paint_tool_use_canvas(bContext *C, bToolRef *tref); /** Store the last used tool in the sculpt session. */ void ED_paint_tool_update_sticky_shading_color(bContext *C, Object *ob); + +void ED_object_vpaintmode_enter_ex(Main *bmain, Depsgraph *depsgraph, Scene *scene, Object *ob); +void ED_object_vpaintmode_enter(bContext *C, Depsgraph *depsgraph); +void ED_object_wpaintmode_enter_ex(Main *bmain, Depsgraph *depsgraph, Scene *scene, Object *ob); +void ED_object_wpaintmode_enter(bContext *C, Depsgraph *depsgraph); + +void ED_object_vpaintmode_exit_ex(Object *ob); +void ED_object_vpaintmode_exit(bContext *C); +void ED_object_wpaintmode_exit_ex(Object *ob); +void ED_object_wpaintmode_exit(bContext *C); + +void ED_object_texture_paint_mode_enter_ex(Main *bmain, + Scene *scene, + Depsgraph *depsgraph, + Object *ob); +void ED_object_texture_paint_mode_enter(bContext *C); + +void ED_object_texture_paint_mode_exit_ex(Main *bmain, Scene *scene, Object *ob); +void ED_object_texture_paint_mode_exit(bContext *C); diff --git a/source/blender/editors/include/ED_physics.hh b/source/blender/editors/include/ED_physics.hh index 5972c42c7c0..5eba2ab3b6b 100644 --- a/source/blender/editors/include/ED_physics.hh +++ b/source/blender/editors/include/ED_physics.hh @@ -8,14 +8,22 @@ #pragma once -struct ReportList; struct bContext; -struct wmKeyConfig; +struct Depsgraph; struct Object; +struct ReportList; struct Scene; +struct wmKeyConfig; /* `particle_edit.cc` */ +bool ED_object_particle_edit_mode_supported(const Object *ob); +void ED_object_particle_edit_mode_enter_ex(Depsgraph *depsgraph, Scene *scene, Object *ob); +void ED_object_particle_edit_mode_enter(bContext *C); + +void ED_object_particle_edit_mode_exit_ex(Scene *scene, Object *ob); +void ED_object_particle_edit_mode_exit(bContext *C); + bool PE_poll(bContext *C); bool PE_hair_poll(bContext *C); bool PE_poll_view3d(bContext *C); diff --git a/source/blender/editors/include/ED_sculpt.hh b/source/blender/editors/include/ED_sculpt.hh index 2df0a9339b5..2fc34b7f958 100644 --- a/source/blender/editors/include/ED_sculpt.hh +++ b/source/blender/editors/include/ED_sculpt.hh @@ -18,6 +18,16 @@ struct rcti; struct wmOperator; struct wmKeyConfig; +void ED_object_sculptmode_enter_ex(Main *bmain, + Depsgraph *depsgraph, + Scene *scene, + Object *ob, + bool force_dyntopo, + ReportList *reports); +void ED_object_sculptmode_enter(bContext *C, Depsgraph *depsgraph, ReportList *reports); +void ED_object_sculptmode_exit_ex(Main *bmain, Depsgraph *depsgraph, Scene *scene, Object *ob); +void ED_object_sculptmode_exit(bContext *C, Depsgraph *depsgraph); + /* `sculpt.cc` */ /** diff --git a/source/blender/editors/object/object_modes.cc b/source/blender/editors/object/object_modes.cc index ea1abc65d1f..cf9ed7307e3 100644 --- a/source/blender/editors/object/object_modes.cc +++ b/source/blender/editors/object/object_modes.cc @@ -38,6 +38,9 @@ #include "ED_armature.hh" #include "ED_gpencil_legacy.hh" #include "ED_outliner.hh" +#include "ED_paint.hh" +#include "ED_physics.hh" +#include "ED_sculpt.hh" #include "ED_undo.hh" #include "ED_view3d.hh" diff --git a/source/blender/editors/physics/particle_edit_undo.cc b/source/blender/editors/physics/particle_edit_undo.cc index d4baf944fd9..63f8d5205ba 100644 --- a/source/blender/editors/physics/particle_edit_undo.cc +++ b/source/blender/editors/physics/particle_edit_undo.cc @@ -30,6 +30,7 @@ #include "ED_object.hh" #include "ED_particle.hh" +#include "ED_physics.hh" #include "ED_undo.hh" #include "particle_edit_utildefines.h" diff --git a/source/blender/editors/util/ed_util.cc b/source/blender/editors/util/ed_util.cc index 45a91603569..573c02c7e37 100644 --- a/source/blender/editors/util/ed_util.cc +++ b/source/blender/editors/util/ed_util.cc @@ -44,6 +44,7 @@ #include "ED_object.hh" #include "ED_paint.hh" #include "ED_screen.hh" +#include "ED_sculpt.hh" #include "ED_space_api.hh" #include "ED_util.hh"