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:
authorHans Goudey <h.goudey@me.com>2020-06-05 17:41:03 +0300
committerHans Goudey <h.goudey@me.com>2020-06-05 17:41:03 +0300
commit9b099c86123fc828a194c59ce5b8bbf5a56f9cdb (patch)
tree38937711643f5816881710debd93df2d28cf9675 /source/blender/modifiers/intern/MOD_triangulate.c
parent4e70e0e384c08d2d4b021758347aeb5e7a1da0dc (diff)
UI: Drag and Drop Modifiers, Layout Updates
This patch implements the list panel system D7490 for modifiers. It also moves modifier drawing to a callback in ModifierTypeInfo in line with the extensible architecture refactoring goal T75724. This adds a PanelRegister callback and utilities for registering panels and subpanels. It also adds the callbacks for expansion saving and drag and drop reordering described in D7490. These utilities, callbacks, and other common UI elements shared between modifiers live in MOD_ui_common.c. Because modifier buttons are now in panels, we can make use of subpanels for organization. The UI layouts also use the single column layout style consistently used elsewhere in Blender. Additionally, the mode-setting buttons are aligned and ordered consistently with the outliner. However, the large number of UI changes in this patch may mean that additional polishing is required in master. Thanks to William Reynish (@billreynish) who did a fair amount of the layout work and to Julian Eisel (@Severin) for consistent help. Differential Revision: https://developer.blender.org/D7498
Diffstat (limited to 'source/blender/modifiers/intern/MOD_triangulate.c')
-rw-r--r--source/blender/modifiers/intern/MOD_triangulate.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/source/blender/modifiers/intern/MOD_triangulate.c b/source/blender/modifiers/intern/MOD_triangulate.c
index bb88bda6394..351a1016a35 100644
--- a/source/blender/modifiers/intern/MOD_triangulate.c
+++ b/source/blender/modifiers/intern/MOD_triangulate.c
@@ -22,17 +22,28 @@
#include "BLI_utildefines.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_mesh.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"
#include "MOD_modifiertypes.h"
+#include "MOD_ui_common.h"
static Mesh *triangulate_mesh(Mesh *mesh,
const int quad_method,
@@ -115,6 +126,29 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *UNUSED(ctx)
return result;
}
+static void panel_draw(const bContext *C, Panel *panel)
+{
+ uiLayout *layout = panel->layout;
+
+ PointerRNA ptr;
+ PointerRNA ob_ptr;
+ modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr);
+
+ uiLayoutSetPropSep(layout, true);
+
+ uiItemR(layout, &ptr, "quad_method", 0, NULL, ICON_NONE);
+ uiItemR(layout, &ptr, "ngon_method", 0, NULL, ICON_NONE);
+ uiItemR(layout, &ptr, "min_vertices", 0, NULL, ICON_NONE);
+ uiItemR(layout, &ptr, "keep_custom_normals", 0, NULL, ICON_NONE);
+
+ modifier_panel_end(layout, &ptr);
+}
+
+static void panelRegister(ARegionType *region_type)
+{
+ modifier_panel_register(region_type, eModifierType_Triangulate, panel_draw);
+}
+
ModifierTypeInfo modifierType_Triangulate = {
/* name */ "Triangulate",
/* structName */ "TriangulateModifierData",
@@ -144,5 +178,7 @@ ModifierTypeInfo modifierType_Triangulate = {
/* dependsOnNormals */ NULL,
/* foreachObjectLink */ NULL,
/* foreachIDLink */ NULL,
+ /* foreachTexLink */ NULL,
/* freeRuntimeData */ NULL,
+ /* panelRegister */ panelRegister,
};