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_displace.c')
-rw-r--r--source/blender/modifiers/intern/MOD_displace.c79
1 files changed, 79 insertions, 0 deletions
diff --git a/source/blender/modifiers/intern/MOD_displace.c b/source/blender/modifiers/intern/MOD_displace.c
index 0cb882d0532..d562559d66d 100644
--- a/source/blender/modifiers/intern/MOD_displace.c
+++ b/source/blender/modifiers/intern/MOD_displace.c
@@ -26,10 +26,14 @@
#include "BLI_math.h"
#include "BLI_task.h"
+#include "BLT_translation.h"
+
#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
#include "DNA_object_types.h"
+#include "DNA_screen_types.h"
+#include "BKE_context.h"
#include "BKE_customdata.h"
#include "BKE_deform.h"
#include "BKE_editmesh.h"
@@ -39,13 +43,20 @@
#include "BKE_mesh.h"
#include "BKE_modifier.h"
#include "BKE_object.h"
+#include "BKE_screen.h"
#include "BKE_texture.h"
+#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 "RE_shader_ext.h"
@@ -419,6 +430,73 @@ static void deformVertsEM(ModifierData *md,
}
}
+static void panel_draw(const bContext *C, Panel *panel)
+{
+ uiLayout *col;
+ uiLayout *layout = panel->layout;
+
+ PointerRNA ptr;
+ PointerRNA ob_ptr;
+ modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr);
+
+ PointerRNA texture_ptr = RNA_pointer_get(&ptr, "texture");
+ bool has_texture = !RNA_pointer_is_null(&texture_ptr);
+ int texture_coords = RNA_enum_get(&ptr, "texture_coords");
+
+ uiLayoutSetPropSep(layout, true);
+
+ uiTemplateID(layout, C, &ptr, "texture", "texture.new", NULL, NULL, 0, ICON_NONE, NULL);
+
+ col = uiLayoutColumn(layout, false);
+ uiLayoutSetActive(col, has_texture);
+ uiItemR(col, &ptr, "texture_coords", 0, IFACE_("Coordinates"), ICON_NONE);
+ if (texture_coords == MOD_DISP_MAP_OBJECT) {
+ uiItemR(col, &ptr, "texture_coords_object", 0, NULL, ICON_NONE);
+ PointerRNA texture_coords_obj_ptr = RNA_pointer_get(&ptr, "texture_coords_object");
+ if (!RNA_pointer_is_null(&texture_coords_obj_ptr) &&
+ (RNA_enum_get(&texture_coords_obj_ptr, "type") == OB_ARMATURE)) {
+ PointerRNA texture_coords_obj_data_ptr = RNA_pointer_get(&texture_coords_obj_ptr, "data");
+ uiItemPointerR(layout,
+ &ptr,
+ "texture_coords_bone",
+ &texture_coords_obj_data_ptr,
+ "bones",
+ IFACE_("Bone"),
+ ICON_NONE);
+ }
+ }
+ else if (texture_coords == MOD_DISP_MAP_UV && RNA_enum_get(&ob_ptr, "type") == OB_MESH) {
+ uiItemR(col, &ptr, "uv_layer", 0, NULL, ICON_NONE);
+ }
+
+ uiItemS(layout);
+
+ col = uiLayoutColumn(layout, false);
+ uiItemR(col, &ptr, "direction", 0, 0, ICON_NONE);
+ if (ELEM(RNA_enum_get(&ptr, "direction"),
+ MOD_DISP_DIR_X,
+ MOD_DISP_DIR_Y,
+ MOD_DISP_DIR_Z,
+ MOD_DISP_DIR_RGB_XYZ)) {
+ uiItemR(col, &ptr, "space", 0, NULL, ICON_NONE);
+ }
+
+ uiItemS(layout);
+
+ col = uiLayoutColumn(layout, false);
+ uiItemR(col, &ptr, "strength", 0, NULL, ICON_NONE);
+ uiItemR(col, &ptr, "mid_level", 0, NULL, ICON_NONE);
+
+ modifier_vgroup_ui(col, &ptr, &ob_ptr, "vertex_group", "invert_vertex_group", NULL);
+
+ modifier_panel_end(layout, &ptr);
+}
+
+static void panelRegister(ARegionType *region_type)
+{
+ modifier_panel_register(region_type, eModifierType_Displace, panel_draw);
+}
+
ModifierTypeInfo modifierType_Displace = {
/* name */ "Displace",
/* structName */ "DisplaceModifierData",
@@ -448,4 +526,5 @@ ModifierTypeInfo modifierType_Displace = {
/* foreachIDLink */ foreachIDLink,
/* foreachTexLink */ foreachTexLink,
/* freeRuntimeData */ NULL,
+ /* panelRegister */ panelRegister,
};