Changeset View
Changeset View
Standalone View
Standalone View
source/blender/modifiers/intern/MOD_multires.c
| Show First 20 Lines • Show All 320 Lines • ▼ Show 20 Lines | #endif | ||||
| } | } | ||||
| BKE_subdiv_displacement_attach_from_multires(subdiv, mesh, mmd); | BKE_subdiv_displacement_attach_from_multires(subdiv, mesh, mmd); | ||||
| BKE_subdiv_deform_coarse_vertices(subdiv, mesh, vertex_cos, num_verts); | BKE_subdiv_deform_coarse_vertices(subdiv, mesh, vertex_cos, num_verts); | ||||
| if (subdiv != runtime_data->subdiv) { | if (subdiv != runtime_data->subdiv) { | ||||
| BKE_subdiv_free(subdiv); | BKE_subdiv_free(subdiv); | ||||
| } | } | ||||
| } | } | ||||
| static void panel_draw(const bContext *C, Panel *panel) | static void panel_draw(const bContext *UNUSED(C), Panel *panel) | ||||
| { | { | ||||
| uiLayout *col; | uiLayout *col; | ||||
| uiLayout *layout = panel->layout; | uiLayout *layout = panel->layout; | ||||
| PointerRNA ptr; | PointerRNA *ptr = modifier_panel_get_property_pointers(panel, NULL); | ||||
| modifier_panel_get_property_pointers(C, panel, NULL, &ptr); | |||||
| uiLayoutSetPropSep(layout, true); | uiLayoutSetPropSep(layout, true); | ||||
| col = uiLayoutColumn(layout, true); | col = uiLayoutColumn(layout, true); | ||||
| uiItemR(col, &ptr, "levels", 0, IFACE_("Level Viewport"), ICON_NONE); | uiItemR(col, ptr, "levels", 0, IFACE_("Level Viewport"), ICON_NONE); | ||||
| uiItemR(col, &ptr, "sculpt_levels", 0, IFACE_("Sculpt"), ICON_NONE); | uiItemR(col, ptr, "sculpt_levels", 0, IFACE_("Sculpt"), ICON_NONE); | ||||
| uiItemR(col, &ptr, "render_levels", 0, IFACE_("Render"), ICON_NONE); | uiItemR(col, ptr, "render_levels", 0, IFACE_("Render"), ICON_NONE); | ||||
| uiItemR(layout, &ptr, "show_only_control_edges", 0, NULL, ICON_NONE); | uiItemR(layout, ptr, "show_only_control_edges", 0, NULL, ICON_NONE); | ||||
| modifier_panel_end(layout, &ptr); | modifier_panel_end(layout, ptr); | ||||
| } | } | ||||
| static void subdivisions_panel_draw(const bContext *C, Panel *panel) | static void subdivisions_panel_draw(const bContext *UNUSED(C), Panel *panel) | ||||
| { | { | ||||
| uiLayout *row; | uiLayout *row; | ||||
| uiLayout *layout = panel->layout; | uiLayout *layout = panel->layout; | ||||
| PointerRNA ptr; | |||||
| PointerRNA ob_ptr; | PointerRNA ob_ptr; | ||||
| modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr); | PointerRNA *ptr = modifier_panel_get_property_pointers(panel, &ob_ptr); | ||||
| uiLayoutSetEnabled(layout, RNA_enum_get(&ob_ptr, "mode") != OB_MODE_EDIT); | uiLayoutSetEnabled(layout, RNA_enum_get(&ob_ptr, "mode") != OB_MODE_EDIT); | ||||
| MultiresModifierData *mmd = (MultiresModifierData *)ptr.data; | MultiresModifierData *mmd = (MultiresModifierData *)ptr->data; | ||||
| /** | /** | ||||
| * Changing some of the properties can not be done once there is an | * Changing some of the properties can not be done once there is an | ||||
| * actual displacement stored for this multi-resolution modifier. | * actual displacement stored for this multi-resolution modifier. | ||||
| * This check will disallow changes for those properties. | * This check will disallow changes for those properties. | ||||
| * This check is a bit stupid but it should be sufficient for the usual | * This check is a bit stupid but it should be sufficient for the usual | ||||
| * multi-resolution usage. It might become less strict and only disallow | * multi-resolution usage. It might become less strict and only disallow | ||||
| * modifications if there is CD_MDISPS layer, or if there is actual | * modifications if there is CD_MDISPS layer, or if there is actual | ||||
| Show All 39 Lines | static void subdivisions_panel_draw(const bContext *UNUSED(C), Panel *panel) | ||||
| uiItemO(layout, IFACE_("Unsubdivide"), ICON_NONE, "OBJECT_OT_multires_unsubdivide"); | uiItemO(layout, IFACE_("Unsubdivide"), ICON_NONE, "OBJECT_OT_multires_unsubdivide"); | ||||
| row = uiLayoutRow(layout, false); | row = uiLayoutRow(layout, false); | ||||
| uiItemL(row, "", ICON_NONE); | uiItemL(row, "", ICON_NONE); | ||||
| uiItemO(row, IFACE_("Delete Higher"), ICON_NONE, "OBJECT_OT_multires_higher_levels_delete"); | uiItemO(row, IFACE_("Delete Higher"), ICON_NONE, "OBJECT_OT_multires_higher_levels_delete"); | ||||
| } | } | ||||
| static void shape_panel_draw(const bContext *C, Panel *panel) | static void shape_panel_draw(const bContext *UNUSED(C), Panel *panel) | ||||
| { | { | ||||
| uiLayout *row; | uiLayout *row; | ||||
| uiLayout *layout = panel->layout; | uiLayout *layout = panel->layout; | ||||
| PointerRNA ptr; | |||||
| PointerRNA ob_ptr; | PointerRNA ob_ptr; | ||||
| modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr); | modifier_panel_get_property_pointers(panel, &ob_ptr); | ||||
| uiLayoutSetEnabled(layout, RNA_enum_get(&ob_ptr, "mode") != OB_MODE_EDIT); | uiLayoutSetEnabled(layout, RNA_enum_get(&ob_ptr, "mode") != OB_MODE_EDIT); | ||||
| row = uiLayoutRow(layout, false); | row = uiLayoutRow(layout, false); | ||||
| uiItemO(row, IFACE_("Reshape"), ICON_NONE, "OBJECT_OT_multires_reshape"); | uiItemO(row, IFACE_("Reshape"), ICON_NONE, "OBJECT_OT_multires_reshape"); | ||||
| uiItemO(row, IFACE_("Apply Base"), ICON_NONE, "OBJECT_OT_multires_base_apply"); | uiItemO(row, IFACE_("Apply Base"), ICON_NONE, "OBJECT_OT_multires_base_apply"); | ||||
| } | } | ||||
| static void generate_panel_draw(const bContext *C, Panel *panel) | static void generate_panel_draw(const bContext *UNUSED(C), Panel *panel) | ||||
| { | { | ||||
| uiLayout *col, *row; | uiLayout *col, *row; | ||||
| uiLayout *layout = panel->layout; | uiLayout *layout = panel->layout; | ||||
| PointerRNA ptr; | PointerRNA *ptr = modifier_panel_get_property_pointers(panel, NULL); | ||||
| modifier_panel_get_property_pointers(C, panel, NULL, &ptr); | MultiresModifierData *mmd = (MultiresModifierData *)ptr->data; | ||||
| MultiresModifierData *mmd = (MultiresModifierData *)ptr.data; | |||||
| bool is_external = RNA_boolean_get(&ptr, "is_external"); | bool is_external = RNA_boolean_get(ptr, "is_external"); | ||||
| if (mmd->totlvl == 0) { | if (mmd->totlvl == 0) { | ||||
| uiItemO( | uiItemO( | ||||
| layout, IFACE_("Rebuild Subdivisions"), ICON_NONE, "OBJECT_OT_multires_rebuild_subdiv"); | layout, IFACE_("Rebuild Subdivisions"), ICON_NONE, "OBJECT_OT_multires_rebuild_subdiv"); | ||||
| } | } | ||||
| col = uiLayoutColumn(layout, false); | col = uiLayoutColumn(layout, false); | ||||
| row = uiLayoutRow(col, false); | row = uiLayoutRow(col, false); | ||||
| if (is_external) { | if (is_external) { | ||||
| uiItemO(row, IFACE_("Pack External"), ICON_NONE, "OBJECT_OT_multires_external_pack"); | uiItemO(row, IFACE_("Pack External"), ICON_NONE, "OBJECT_OT_multires_external_pack"); | ||||
| uiLayoutSetPropSep(col, true); | uiLayoutSetPropSep(col, true); | ||||
| row = uiLayoutRow(col, false); | row = uiLayoutRow(col, false); | ||||
| uiItemR(row, &ptr, "filepath", 0, NULL, ICON_NONE); | uiItemR(row, ptr, "filepath", 0, NULL, ICON_NONE); | ||||
| } | } | ||||
| else { | else { | ||||
| uiItemO(col, IFACE_("Save External..."), ICON_NONE, "OBJECT_OT_multires_external_save"); | uiItemO(col, IFACE_("Save External..."), ICON_NONE, "OBJECT_OT_multires_external_save"); | ||||
| } | } | ||||
| } | } | ||||
| static void advanced_panel_draw(const bContext *C, Panel *panel) | static void advanced_panel_draw(const bContext *UNUSED(C), Panel *panel) | ||||
| { | { | ||||
| uiLayout *col; | uiLayout *col; | ||||
| uiLayout *layout = panel->layout; | uiLayout *layout = panel->layout; | ||||
| PointerRNA ptr; | PointerRNA *ptr = modifier_panel_get_property_pointers(panel, NULL); | ||||
| modifier_panel_get_property_pointers(C, panel, NULL, &ptr); | |||||
| bool has_displacement = RNA_int_get(&ptr, "total_levels") != 0; | bool has_displacement = RNA_int_get(ptr, "total_levels") != 0; | ||||
| uiLayoutSetPropSep(layout, true); | uiLayoutSetPropSep(layout, true); | ||||
| uiLayoutSetEnabled(layout, !has_displacement); | uiLayoutSetEnabled(layout, !has_displacement); | ||||
| uiItemR(layout, &ptr, "subdivision_type", 0, NULL, ICON_NONE); | uiItemR(layout, ptr, "subdivision_type", 0, NULL, ICON_NONE); | ||||
| uiItemR(layout, &ptr, "quality", 0, NULL, ICON_NONE); | uiItemR(layout, ptr, "quality", 0, NULL, ICON_NONE); | ||||
| col = uiLayoutColumn(layout, false); | col = uiLayoutColumn(layout, false); | ||||
| uiLayoutSetEnabled(col, true); | uiLayoutSetEnabled(col, true); | ||||
| uiItemR(col, &ptr, "uv_smooth", 0, NULL, ICON_NONE); | uiItemR(col, ptr, "uv_smooth", 0, NULL, ICON_NONE); | ||||
| uiItemR(layout, &ptr, "use_creases", 0, NULL, ICON_NONE); | uiItemR(layout, ptr, "use_creases", 0, NULL, ICON_NONE); | ||||
| uiItemR(layout, &ptr, "use_custom_normals", 0, NULL, ICON_NONE); | uiItemR(layout, ptr, "use_custom_normals", 0, NULL, ICON_NONE); | ||||
| } | } | ||||
| static void panelRegister(ARegionType *region_type) | static void panelRegister(ARegionType *region_type) | ||||
| { | { | ||||
| PanelType *panel_type = modifier_panel_register(region_type, eModifierType_Multires, panel_draw); | PanelType *panel_type = modifier_panel_register(region_type, eModifierType_Multires, panel_draw); | ||||
| modifier_subpanel_register( | modifier_subpanel_register( | ||||
| region_type, "subdivide", "Subdivision", NULL, subdivisions_panel_draw, panel_type); | region_type, "subdivide", "Subdivision", NULL, subdivisions_panel_draw, panel_type); | ||||
| modifier_subpanel_register(region_type, "shape", "Shape", NULL, shape_panel_draw, panel_type); | modifier_subpanel_register(region_type, "shape", "Shape", NULL, shape_panel_draw, panel_type); | ||||
| Show All 40 Lines | |||||