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/modifiers/intern/MOD_weightvg_util.c')
-rw-r--r--source/blender/modifiers/intern/MOD_weightvg_util.c54
1 files changed, 54 insertions, 0 deletions
diff --git a/source/blender/modifiers/intern/MOD_weightvg_util.c b/source/blender/modifiers/intern/MOD_weightvg_util.c
index 1a38787777f..54d3aa46344 100644
--- a/source/blender/modifiers/intern/MOD_weightvg_util.c
+++ b/source/blender/modifiers/intern/MOD_weightvg_util.c
@@ -27,6 +27,8 @@
#include "BLI_rand.h"
#include "BLI_string.h"
+#include "BLT_translation.h"
+
#include "DNA_color_types.h" /* CurveMapping. */
#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
@@ -35,15 +37,22 @@
#include "DNA_scene_types.h"
#include "BKE_colortools.h" /* CurveMapping. */
+#include "BKE_context.h"
#include "BKE_customdata.h"
#include "BKE_deform.h"
#include "BKE_modifier.h"
#include "BKE_texture.h" /* Texture masking. */
+#include "UI_interface.h"
+#include "UI_resources.h"
+
+#include "RNA_access.h"
+
#include "DEG_depsgraph.h"
#include "DEG_depsgraph_query.h"
#include "MEM_guardedalloc.h"
+#include "MOD_ui_common.h"
#include "MOD_util.h"
#include "MOD_weightvg_util.h"
#include "RE_shader_ext.h" /* Texture masking. */
@@ -329,3 +338,48 @@ void weightvg_update_vg(MDeformVert *dvert,
}
}
}
+
+/* Common vertex weight mask interface elements for the modifier panels.
+ */
+void weightvg_ui_common(const bContext *C, PointerRNA *ob_ptr, PointerRNA *ptr, uiLayout *layout)
+{
+ PointerRNA mask_texture_ptr = RNA_pointer_get(ptr, "mask_texture");
+ bool has_mask_texture = !RNA_pointer_is_null(&mask_texture_ptr);
+ bool has_mask_vertex_group = RNA_string_length(ptr, "mask_vertex_group") != 0;
+ int mask_tex_mapping = RNA_enum_get(ptr, "mask_tex_mapping");
+
+ uiLayoutSetPropSep(layout, true);
+
+ uiItemR(layout, ptr, "mask_constant", UI_ITEM_R_SLIDER, IFACE_("Global Influence:"), ICON_NONE);
+
+ if (!has_mask_texture) {
+ modifier_vgroup_ui(layout, ptr, ob_ptr, "mask_vertex_group", "invert_mask_vertex_group", NULL);
+ }
+
+ if (!has_mask_vertex_group) {
+ uiTemplateID(layout,
+ C,
+ ptr,
+ "mask_texture",
+ "texture.new",
+ NULL,
+ NULL,
+ 0,
+ ICON_NONE,
+ IFACE_("Mask Texture"));
+
+ if (has_mask_texture) {
+ uiItemR(layout, ptr, "mask_tex_use_channel", 0, IFACE_("Channel"), ICON_NONE);
+ uiItemR(layout, ptr, "mask_tex_mapping", 0, NULL, ICON_NONE);
+
+ if (mask_tex_mapping == MOD_DISP_MAP_OBJECT) {
+ uiItemR(layout, ptr, "mask_tex_map_object", 0, IFACE_("Object"), ICON_NONE);
+ }
+ else if (mask_tex_mapping == MOD_DISP_MAP_UV && RNA_enum_get(ob_ptr, "type") == OB_MESH) {
+ PointerRNA obj_data_ptr = RNA_pointer_get(ob_ptr, "data");
+ uiItemPointerR(
+ layout, ptr, "mask_tex_uv_layer", &obj_data_ptr, "uv_layers", NULL, ICON_NONE);
+ }
+ }
+ }
+} \ No newline at end of file