diff options
Diffstat (limited to 'source/blender/modifiers/intern/MOD_screw.c')
-rw-r--r-- | source/blender/modifiers/intern/MOD_screw.c | 90 |
1 files changed, 90 insertions, 0 deletions
diff --git a/source/blender/modifiers/intern/MOD_screw.c b/source/blender/modifiers/intern/MOD_screw.c index d3d42068812..b1c49ba2fec 100644 --- a/source/blender/modifiers/intern/MOD_screw.c +++ b/source/blender/modifiers/intern/MOD_screw.c @@ -29,18 +29,30 @@ #include "BLI_alloca.h" #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_lib_query.h" #include "BKE_mesh.h" +#include "BKE_screen.h" + +#include "UI_interface.h" +#include "UI_resources.h" + +#include "RNA_access.h" #include "DEG_depsgraph_build.h" #include "DEG_depsgraph_query.h" #include "MEM_guardedalloc.h" + #include "MOD_modifiertypes.h" +#include "MOD_ui_common.h" #include "BLI_strict_flags.h" @@ -1156,6 +1168,83 @@ static void foreachObjectLink(ModifierData *md, Object *ob, ObjectWalkFunc walk, walk(userData, ob, <md->ob_axis, IDWALK_CB_NOP); } +static void panel_draw(const bContext *C, Panel *panel) +{ + uiLayout *sub, *row, *col; + uiLayout *layout = panel->layout; + int toggles_flag = UI_ITEM_R_TOGGLE | UI_ITEM_R_FORCE_BLANK_DECORATE; + + PointerRNA ptr; + modifier_panel_get_property_pointers(C, panel, NULL, &ptr); + + PointerRNA screw_obj_ptr = RNA_pointer_get(&ptr, "object"); + + uiLayoutSetPropSep(layout, true); + + col = uiLayoutColumn(layout, false); + uiItemR(col, &ptr, "angle", 0, NULL, ICON_NONE); + row = uiLayoutRow(col, false); + uiLayoutSetActive(row, + RNA_pointer_is_null(&screw_obj_ptr) || + !RNA_boolean_get(&ptr, "use_object_screw_offset")); + uiItemR(row, &ptr, "screw_offset", 0, NULL, ICON_NONE); + uiItemR(col, &ptr, "iterations", 0, NULL, ICON_NONE); + + uiItemS(layout); + col = uiLayoutColumn(layout, false); + row = uiLayoutRow(col, false); + uiItemR(row, &ptr, "axis", UI_ITEM_R_EXPAND, NULL, ICON_NONE); + uiItemR(col, &ptr, "object", 0, IFACE_("Axis Object"), ICON_NONE); + sub = uiLayoutColumn(col, false); + uiLayoutSetActive(sub, !RNA_pointer_is_null(&screw_obj_ptr)); + uiItemR(sub, &ptr, "use_object_screw_offset", 0, NULL, ICON_NONE); + + uiItemS(layout); + + col = uiLayoutColumn(layout, true); + uiItemR(col, &ptr, "steps", 0, IFACE_("Steps Viewport"), ICON_NONE); + uiItemR(col, &ptr, "render_steps", 0, IFACE_("Render"), ICON_NONE); + + uiItemS(layout); + + row = uiLayoutRowWithHeading(layout, true, IFACE_("Merge")); + uiItemR(row, &ptr, "use_merge_vertices", 0, "", ICON_NONE); + sub = uiLayoutRow(row, true); + uiLayoutSetActive(sub, RNA_boolean_get(&ptr, "use_merge_vertices")); + uiItemR(sub, &ptr, "merge_threshold", 0, "", ICON_NONE); + + uiItemS(layout); + + row = uiLayoutRowWithHeading(layout, true, IFACE_("Stretch UVs")); + uiItemR(row, &ptr, "use_stretch_u", toggles_flag, IFACE_("U"), ICON_NONE); + uiItemR(row, &ptr, "use_stretch_v", toggles_flag, IFACE_("V"), ICON_NONE); + + modifier_panel_end(layout, &ptr); +} + +static void normals_panel_draw(const bContext *C, Panel *panel) +{ + uiLayout *col; + uiLayout *layout = panel->layout; + + PointerRNA ptr; + modifier_panel_get_property_pointers(C, panel, NULL, &ptr); + + uiLayoutSetPropSep(layout, true); + + col = uiLayoutColumn(layout, false); + uiItemR(col, &ptr, "use_smooth_shade", 0, NULL, ICON_NONE); + uiItemR(col, &ptr, "use_normal_calculate", 0, NULL, ICON_NONE); + uiItemR(col, &ptr, "use_normal_flip", 0, NULL, ICON_NONE); +} + +static void panelRegister(ARegionType *region_type) +{ + PanelType *panel_type = modifier_panel_register(region_type, eModifierType_Screw, panel_draw); + modifier_subpanel_register( + region_type, "normals", "Normals", NULL, normals_panel_draw, panel_type); +} + ModifierTypeInfo modifierType_Screw = { /* name */ "Screw", /* structName */ "ScrewModifierData", @@ -1187,4 +1276,5 @@ ModifierTypeInfo modifierType_Screw = { /* foreachIDLink */ NULL, /* foreachTexLink */ NULL, /* freeRuntimeData */ NULL, + /* panelRegister */ panelRegister, }; |