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_decimate.c')
-rw-r--r--source/blender/modifiers/intern/MOD_decimate.c63
1 files changed, 63 insertions, 0 deletions
diff --git a/source/blender/modifiers/intern/MOD_decimate.c b/source/blender/modifiers/intern/MOD_decimate.c
index 2bd33af7582..5b494baea1a 100644
--- a/source/blender/modifiers/intern/MOD_decimate.c
+++ b/source/blender/modifiers/intern/MOD_decimate.c
@@ -25,14 +25,24 @@
#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 "MEM_guardedalloc.h"
+#include "BKE_context.h"
#include "BKE_deform.h"
#include "BKE_mesh.h"
+#include "BKE_screen.h"
+
+#include "UI_interface.h"
+#include "UI_resources.h"
+
+#include "RNA_access.h"
#include "DEG_depsgraph_query.h"
@@ -46,6 +56,7 @@
# include "PIL_time_utildefines.h"
#endif
+#include "MOD_ui_common.h"
#include "MOD_util.h"
static void initData(ModifierData *md)
@@ -215,6 +226,57 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh *
return result;
}
+static void panel_draw(const bContext *C, Panel *panel)
+{
+ uiLayout *sub, *row;
+ uiLayout *layout = panel->layout;
+
+ PointerRNA ptr;
+ PointerRNA ob_ptr;
+ modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr);
+
+ uiLayoutSetPropSep(layout, true);
+
+ int decimate_type = RNA_enum_get(&ptr, "decimate_type");
+ char count_info[32];
+ snprintf(count_info, 32, IFACE_("Face Count: %d"), RNA_int_get(&ptr, "face_count"));
+
+ uiItemR(layout, &ptr, "decimate_type", 0, NULL, ICON_NONE);
+
+ if (decimate_type == MOD_DECIM_MODE_COLLAPSE) {
+ uiItemR(layout, &ptr, "ratio", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
+
+ row = uiLayoutRowWithHeading(layout, true, "Symmetry");
+ uiLayoutSetPropDecorate(row, false);
+ sub = uiLayoutRow(row, true);
+ uiItemR(sub, &ptr, "use_symmetry", 0, "", ICON_NONE);
+ sub = uiLayoutRow(sub, true);
+ uiLayoutSetActive(sub, RNA_boolean_get(&ptr, "use_symmetry"));
+ uiItemR(sub, &ptr, "symmetry_axis", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
+ uiItemDecoratorR(row, &ptr, "symmetry_axis", 0);
+
+ uiItemR(layout, &ptr, "use_collapse_triangulate", 0, NULL, ICON_NONE);
+
+ modifier_vgroup_ui(layout, &ptr, &ob_ptr, "vertex_group", "invert_vertex_group", NULL);
+ }
+ else if (decimate_type == MOD_DECIM_MODE_UNSUBDIV) {
+ uiItemR(layout, &ptr, "iterations", 0, NULL, ICON_NONE);
+ }
+ else { /* decimate_type == MOD_DECIM_MODE_DISSOLVE. */
+ uiItemR(layout, &ptr, "angle_limit", 0, NULL, ICON_NONE);
+ uiItemR(layout, &ptr, "delimit", 0, NULL, ICON_NONE);
+ uiItemR(layout, &ptr, "use_dissolve_boundaries", 0, NULL, ICON_NONE);
+ }
+ uiItemL(layout, count_info, ICON_NONE);
+
+ modifier_panel_end(layout, &ptr);
+}
+
+static void panelRegister(ARegionType *region_type)
+{
+ modifier_panel_register(region_type, eModifierType_Decimate, panel_draw);
+}
+
ModifierTypeInfo modifierType_Decimate = {
/* name */ "Decimate",
/* structName */ "DecimateModifierData",
@@ -244,4 +306,5 @@ ModifierTypeInfo modifierType_Decimate = {
/* foreachIDLink */ NULL,
/* foreachTexLink */ NULL,
/* freeRuntimeData */ NULL,
+ /* panelRegister */ panelRegister,
};