UI: Status Bar Improvements for Sculpt Expand Operator
Changes to the status bar display when using the Sculpt Expand operator, which currently takes up too much horizontal space. This mostly removes "toggle", combines some increase/decrease keys, etc. Pull Request: https://projects.blender.org/blender/blender/pulls/145009
This commit is contained in:
committed by
Harley Acheson
parent
6e75d59c7f
commit
923b5f88ba
@@ -490,6 +490,11 @@ class WorkspaceStatus {
|
||||
*/
|
||||
void item(std::string text, int icon1, int icon2 = 0);
|
||||
|
||||
/**
|
||||
* Add extra (or negative) space between items.
|
||||
*/
|
||||
void separator(float factor = 1.0f);
|
||||
|
||||
/**
|
||||
* Add a dynamic status entry with up to two icons that change appearance.
|
||||
* Example:
|
||||
|
||||
@@ -961,6 +961,11 @@ void WorkspaceStatus::item(std::string text, const int icon1, const int icon2)
|
||||
ed_workspace_status_text_item(workspace_, std::move(text));
|
||||
}
|
||||
|
||||
void WorkspaceStatus::separator(float factor)
|
||||
{
|
||||
ed_workspace_status_space(workspace_, factor);
|
||||
}
|
||||
|
||||
void WorkspaceStatus::range(std::string text, const int icon1, const int icon2)
|
||||
{
|
||||
ed_workspace_status_item(workspace_, {}, icon1);
|
||||
|
||||
@@ -33,6 +33,8 @@
|
||||
#include "BKE_report.hh"
|
||||
#include "BKE_subdiv_ccg.hh"
|
||||
|
||||
#include "BLT_translation.hh"
|
||||
|
||||
#include "WM_api.hh"
|
||||
#include "WM_types.hh"
|
||||
|
||||
@@ -1612,6 +1614,8 @@ static void sculpt_expand_cancel(bContext *C, wmOperator * /*op*/)
|
||||
|
||||
undo::push_end(ob);
|
||||
expand_cache_free(ss);
|
||||
|
||||
ED_workspace_status_text(C, nullptr);
|
||||
}
|
||||
|
||||
/* Functions to update the sculpt mesh data. */
|
||||
@@ -2287,6 +2291,70 @@ static int active_face_set_id_get(Object &object, Cache &expand_cache)
|
||||
return SCULPT_FACE_SET_NONE;
|
||||
}
|
||||
|
||||
static void sculpt_expand_status(bContext *C, wmOperator *op, Cache *expand_cache)
|
||||
{
|
||||
WorkspaceStatus status(C);
|
||||
|
||||
status.opmodal(IFACE_("Confirm"), op->type, SCULPT_EXPAND_MODAL_CONFIRM);
|
||||
status.opmodal(IFACE_("Cancel"), op->type, SCULPT_EXPAND_MODAL_CANCEL);
|
||||
status.opmodal(IFACE_("Invert"), op->type, SCULPT_EXPAND_MODAL_INVERT, expand_cache->invert);
|
||||
status.opmodal(IFACE_("Snap"), op->type, SCULPT_EXPAND_MODAL_SNAP_TOGGLE, expand_cache->snap);
|
||||
status.opmodal(IFACE_("Move"), op->type, SCULPT_EXPAND_MODAL_MOVE_TOGGLE, expand_cache->move);
|
||||
status.opmodal(
|
||||
IFACE_("Preserve"), op->type, SCULPT_EXPAND_MODAL_PRESERVE_TOGGLE, expand_cache->preserve);
|
||||
|
||||
if (expand_cache->target != TargetType::FaceSets) {
|
||||
status.opmodal(IFACE_("Falloff Gradient"),
|
||||
op->type,
|
||||
SCULPT_EXPAND_MODAL_GRADIENT_TOGGLE,
|
||||
expand_cache->falloff_gradient);
|
||||
status.opmodal(IFACE_("Brush Gradient"),
|
||||
op->type,
|
||||
SCULPT_EXPAND_MODAL_BRUSH_GRADIENT_TOGGLE,
|
||||
expand_cache->brush_gradient);
|
||||
}
|
||||
|
||||
if (ELEM(expand_cache->falloff_type,
|
||||
FalloffType::Geodesic,
|
||||
FalloffType::Topology,
|
||||
FalloffType::TopologyNormals,
|
||||
FalloffType::Sphere))
|
||||
{
|
||||
status.item(IFACE_("Falloff:"), 0);
|
||||
status.opmodal(IFACE_("Geodesic"),
|
||||
op->type,
|
||||
SCULPT_EXPAND_MODAL_FALLOFF_GEODESIC,
|
||||
expand_cache->falloff_type == FalloffType::Geodesic);
|
||||
status.opmodal(IFACE_("Topology"),
|
||||
op->type,
|
||||
SCULPT_EXPAND_MODAL_FALLOFF_TOPOLOGY,
|
||||
expand_cache->falloff_type == FalloffType::Topology);
|
||||
status.opmodal(IFACE_("Diagonals"),
|
||||
op->type,
|
||||
SCULPT_EXPAND_MODAL_FALLOFF_TOPOLOGY_DIAGONALS,
|
||||
expand_cache->falloff_type == FalloffType::TopologyNormals);
|
||||
status.opmodal(IFACE_("Spherical"),
|
||||
op->type,
|
||||
SCULPT_EXPAND_MODAL_FALLOFF_SPHERICAL,
|
||||
expand_cache->falloff_type == FalloffType::Sphere);
|
||||
}
|
||||
|
||||
status.opmodal({}, op->type, SCULPT_EXPAND_MODAL_LOOP_COUNT_INCREASE);
|
||||
status.item("/", 0);
|
||||
status.separator(-1.2f);
|
||||
status.opmodal(IFACE_("Loop Count"), op->type, SCULPT_EXPAND_MODAL_LOOP_COUNT_DECREASE);
|
||||
|
||||
status.opmodal(IFACE_("Geodesic Step"), op->type, SCULPT_EXPAND_MODAL_RECURSION_STEP_GEODESIC);
|
||||
status.opmodal(IFACE_("Topology Step"), op->type, SCULPT_EXPAND_MODAL_RECURSION_STEP_TOPOLOGY);
|
||||
|
||||
const MTex *mask_tex = BKE_brush_mask_texture_get(expand_cache->brush, OB_MODE_SCULPT);
|
||||
if (mask_tex->tex) {
|
||||
status.opmodal({}, op->type, SCULPT_EXPAND_MODAL_TEXTURE_DISTORTION_INCREASE);
|
||||
status.opmodal(
|
||||
IFACE_("Texture Distortion"), op->type, SCULPT_EXPAND_MODAL_TEXTURE_DISTORTION_DECREASE);
|
||||
}
|
||||
}
|
||||
|
||||
static wmOperatorStatus sculpt_expand_modal(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
{
|
||||
Object &ob = *CTX_data_active_object(C);
|
||||
@@ -2472,6 +2540,8 @@ static wmOperatorStatus sculpt_expand_modal(bContext *C, wmOperator *op, const w
|
||||
/* Update the sculpt data with the current state of the #Cache. */
|
||||
update_for_vert(C, ob, target_expand_vertex);
|
||||
|
||||
sculpt_expand_status(C, op, &expand_cache);
|
||||
|
||||
return OPERATOR_RUNNING_MODAL;
|
||||
}
|
||||
|
||||
@@ -2792,6 +2862,8 @@ static wmOperatorStatus sculpt_expand_invoke(bContext *C, wmOperator *op, const
|
||||
/* Initial mesh data update, resets all target data in the sculpt mesh. */
|
||||
update_for_vert(C, ob, initial_vert);
|
||||
|
||||
sculpt_expand_status(C, op, ss.expand_cache);
|
||||
|
||||
WM_event_add_modal_handler(C, op);
|
||||
return OPERATOR_RUNNING_MODAL;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user