Curves: Unify poll functions, add message with no surface

The "snap to surface" operators now have "disabled" poll messages
when there is no surface object.

The implementation in most curves operators is also unified.
The goal is to avoid having to define and use the poll failure messages
in multiple places, to reduce the boilerplate that tends to be
necessary to add an operator, and to increase the likelihood that
operators are implemented with proper poll messages.

Differential Revision: https://developer.blender.org/D15528
This commit is contained in:
2022-07-25 11:59:33 -05:00
parent 739136caca
commit 00a3533429
3 changed files with 56 additions and 73 deletions

View File

@@ -26,10 +26,14 @@ void ED_operatortypes_curves(void);
namespace blender::ed::curves {
bke::CurvesGeometry primitive_random_sphere(int curves_size, int points_per_curve);
bool selection_operator_poll(bContext *C);
bool has_anything_selected(const Curves &curves_id);
VectorSet<Curves *> get_unique_editable_curves(const bContext &C);
void ensure_surface_deformation_node_exists(bContext &C, Object &curves_ob);
bool editable_curves_with_surface_poll(bContext *C);
bool curves_with_surface_poll(bContext *C);
bool editable_curves_poll(bContext *C);
bool curves_poll(bContext *C);
} // namespace blender::ed::curves
#endif