Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/editors/mesh/editmesh_select.c')
-rw-r--r--source/blender/editors/mesh/editmesh_select.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/source/blender/editors/mesh/editmesh_select.c b/source/blender/editors/mesh/editmesh_select.c
index 7e05209f79e..6b2d56322fc 100644
--- a/source/blender/editors/mesh/editmesh_select.c
+++ b/source/blender/editors/mesh/editmesh_select.c
@@ -32,6 +32,7 @@
#include "BLI_math.h"
#include "BLI_math_bits.h"
#include "BLI_rand.h"
+#include "BLI_string.h"
#include "BLI_utildefines_stack.h"
#include "BKE_context.h"
@@ -55,6 +56,8 @@
#include "ED_transform.h"
#include "ED_view3d.h"
+#include "BLT_translation.h"
+
#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
#include "DNA_object_types.h"
@@ -1389,6 +1392,36 @@ static int edbm_select_mode_invoke(bContext *C, wmOperator *op, const wmEvent *e
return edbm_select_mode_exec(C, op);
}
+static char *edbm_select_mode_get_description(struct bContext *UNUSED(C),
+ struct wmOperatorType *UNUSED(op),
+ struct PointerRNA *values)
+{
+ const int type = RNA_enum_get(values, "type");
+
+ /* Because the special behavior for shift and ctrl click depend on user input, they may be
+ * incorrect if the operator is used from a script or from a special button. So only return the
+ * specialized descriptions if only the "type" is set, which conveys that the operator is meant
+ * to be used with the logic in the `invoke` method. */
+ if (RNA_struct_property_is_set(values, "type") &&
+ !RNA_struct_property_is_set(values, "use_extend") &&
+ !RNA_struct_property_is_set(values, "use_expand") &&
+ !RNA_struct_property_is_set(values, "action"))
+ switch (type) {
+ case SCE_SELECT_VERTEX:
+ return BLI_strdup(
+ N_("Vertex select - Shift-Click for multiple modes, Ctrl-Click contracts selection"));
+ case SCE_SELECT_EDGE:
+ return BLI_strdup(
+ N_("Edge select - Shift-Click for multiple modes, "
+ "Ctrl-Click expands/contracts selection depending on the current mode"));
+ case SCE_SELECT_FACE:
+ return BLI_strdup(
+ N_("Face select - Shift-Click for multiple modes, Ctrl-Click expands selection"));
+ }
+
+ return NULL;
+}
+
void MESH_OT_select_mode(wmOperatorType *ot)
{
PropertyRNA *prop;
@@ -1409,6 +1442,7 @@ void MESH_OT_select_mode(wmOperatorType *ot)
ot->invoke = edbm_select_mode_invoke;
ot->exec = edbm_select_mode_exec;
ot->poll = ED_operator_editmesh;
+ ot->get_description = edbm_select_mode_get_description;
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;