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_mirror.c')
-rw-r--r--source/blender/modifiers/intern/MOD_mirror.c99
1 files changed, 99 insertions, 0 deletions
diff --git a/source/blender/modifiers/intern/MOD_mirror.c b/source/blender/modifiers/intern/MOD_mirror.c
index bbbcac262ca..949b115a25f 100644
--- a/source/blender/modifiers/intern/MOD_mirror.c
+++ b/source/blender/modifiers/intern/MOD_mirror.c
@@ -23,16 +23,26 @@
#include "BLI_math.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_deform.h"
#include "BKE_lib_id.h"
#include "BKE_lib_query.h"
#include "BKE_mesh.h"
#include "BKE_mesh_mirror.h"
#include "BKE_modifier.h"
+#include "BKE_screen.h"
+
+#include "UI_interface.h"
+#include "UI_resources.h"
+
+#include "RNA_access.h"
#include "bmesh.h"
#include "bmesh_tools.h"
@@ -43,6 +53,7 @@
#include "DEG_depsgraph_query.h"
#include "MOD_modifiertypes.h"
+#include "MOD_ui_common.h"
static void initData(ModifierData *md)
{
@@ -113,6 +124,93 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh *
return result;
}
+static void panel_draw(const bContext *C, Panel *panel)
+{
+ uiLayout *row, *col, *sub;
+ uiLayout *layout = panel->layout;
+ int toggles_flag = UI_ITEM_R_TOGGLE | UI_ITEM_R_FORCE_BLANK_DECORATE;
+
+ PropertyRNA *prop;
+ PointerRNA ptr;
+ PointerRNA ob_ptr;
+ modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr);
+
+ col = uiLayoutColumn(layout, false);
+ uiLayoutSetPropSep(col, true);
+
+ prop = RNA_struct_find_property(&ptr, "use_axis");
+ row = uiLayoutRowWithHeading(col, true, IFACE_("Axis"));
+ uiItemFullR(row, &ptr, prop, 0, 0, toggles_flag, IFACE_("X"), ICON_NONE);
+ uiItemFullR(row, &ptr, prop, 1, 0, toggles_flag, IFACE_("Y"), ICON_NONE);
+ uiItemFullR(row, &ptr, prop, 2, 0, toggles_flag, IFACE_("Z"), ICON_NONE);
+
+ prop = RNA_struct_find_property(&ptr, "use_bisect_axis");
+ row = uiLayoutRowWithHeading(col, true, IFACE_("Bisect"));
+ uiItemFullR(row, &ptr, prop, 0, 0, toggles_flag, IFACE_("X"), ICON_NONE);
+ uiItemFullR(row, &ptr, prop, 1, 0, toggles_flag, IFACE_("Y"), ICON_NONE);
+ uiItemFullR(row, &ptr, prop, 2, 0, toggles_flag, IFACE_("Z"), ICON_NONE);
+
+ prop = RNA_struct_find_property(&ptr, "use_bisect_flip_axis");
+ row = uiLayoutRowWithHeading(col, true, IFACE_("Flip"));
+ uiItemFullR(row, &ptr, prop, 0, 0, toggles_flag, IFACE_("X"), ICON_NONE);
+ uiItemFullR(row, &ptr, prop, 1, 0, toggles_flag, IFACE_("Y"), ICON_NONE);
+ uiItemFullR(row, &ptr, prop, 2, 0, toggles_flag, IFACE_("Z"), ICON_NONE);
+
+ uiItemS(col);
+
+ uiItemR(col, &ptr, "mirror_object", 0, NULL, ICON_NONE);
+
+ uiItemR(col, &ptr, "use_clip", 0, IFACE_("Clipping"), ICON_NONE);
+
+ row = uiLayoutRowWithHeading(col, true, IFACE_("Merge"));
+ uiItemR(row, &ptr, "use_mirror_merge", 0, "", ICON_NONE);
+ sub = uiLayoutRow(row, true);
+ uiLayoutSetActive(sub, RNA_boolean_get(&ptr, "use_mirror_merge"));
+ uiItemR(sub, &ptr, "merge_threshold", 0, "", ICON_NONE);
+
+ modifier_panel_end(layout, &ptr);
+}
+
+static void data_panel_draw(const bContext *C, Panel *panel)
+{
+ uiLayout *col, *row, *sub;
+ uiLayout *layout = panel->layout;
+
+ PointerRNA ptr;
+ modifier_panel_get_property_pointers(C, panel, NULL, &ptr);
+
+ uiLayoutSetPropSep(layout, true);
+
+ col = uiLayoutColumnWithHeading(layout, false, IFACE_("Mirror U"));
+ row = uiLayoutRow(col, true);
+ uiLayoutSetPropDecorate(row, false);
+ sub = uiLayoutRow(row, true);
+ uiItemR(sub, &ptr, "use_mirror_u", 0, "", ICON_NONE);
+ sub = uiLayoutRow(sub, true);
+ uiLayoutSetActive(sub, RNA_boolean_get(&ptr, "use_mirror_u"));
+ uiItemR(sub, &ptr, "mirror_offset_u", UI_ITEM_R_SLIDER, "", ICON_NONE);
+ uiItemDecoratorR(row, &ptr, "mirror_offset_v", 0);
+
+ col = uiLayoutColumnWithHeading(layout, false, "V");
+ row = uiLayoutRow(col, true);
+ uiLayoutSetPropDecorate(row, false);
+ sub = uiLayoutRow(row, true);
+ uiItemR(sub, &ptr, "use_mirror_v", 0, "", ICON_NONE);
+ sub = uiLayoutRow(sub, true);
+ uiLayoutSetActive(sub, RNA_boolean_get(&ptr, "use_mirror_v"));
+ uiItemR(sub, &ptr, "mirror_offset_v", UI_ITEM_R_SLIDER, "", ICON_NONE);
+ uiItemDecoratorR(row, &ptr, "mirror_offset_v", 0);
+
+ uiItemR(layout, &ptr, "use_mirror_vertex_groups", 0, IFACE_("Vertex Groups"), ICON_NONE);
+ uiItemR(layout, &ptr, "use_mirror_udim", 0, IFACE_("Flip UDIM"), ICON_NONE);
+}
+
+static void panelRegister(ARegionType *region_type)
+{
+ PanelType *panel_type = modifier_panel_register(region_type, eModifierType_Mirror, panel_draw);
+ modifier_subpanel_register(region_type, "data", "Data", NULL, data_panel_draw, panel_type);
+}
+
ModifierTypeInfo modifierType_Mirror = {
/* name */ "Mirror",
/* structName */ "MirrorModifierData",
@@ -146,4 +244,5 @@ ModifierTypeInfo modifierType_Mirror = {
/* foreachIDLink */ NULL,
/* foreachTexLink */ NULL,
/* freeRuntimeData */ NULL,
+ /* panelRegister */ panelRegister,
};