Commit: 59d301befccf59d8127abf959c6132a9bbe5a2f7
Author: Hugo Sales
Date:   Sat Jun 8 09:49:02 2019 +0100
Branches: soc-2019-fast-io
https://developer.blender.org/rB59d301befccf59d8127abf959c6132a9bbe5a2f7

[Fast import/export] Fixed STL export UI

===================================================================

M       source/blender/editors/io/io_common.c
M       source/blender/editors/io/io_common.h
M       source/blender/editors/io/io_obj.c
M       source/blender/editors/io/io_obj.h
M       source/blender/editors/io/io_stl.c

===================================================================

diff --git a/source/blender/editors/io/io_common.c 
b/source/blender/editors/io/io_common.c
index f087acc217f..9a05e9aae6a 100644
--- a/source/blender/editors/io/io_common.c
+++ b/source/blender/editors/io/io_common.c
@@ -160,6 +160,12 @@ void io_common_default_declare_export(struct 
wmOperatorType *ot,
                     MOD_TRIANGULATE_NGON_BEAUTY, "Polygon Method",
                     "Method for splitting the polygons into triangles");
 
+       RNA_def_boolean(ot->srna, "use_ascii", 0, "Use ASCII format",
+                       "Whether to use the ASCII or the binary variant");
+
+       RNA_def_boolean(ot->srna, "use_scene_units", 0, "Use scene units",
+                       "Whether to use the scene's units as a scaling factor");
+
        RNA_def_float(ot->srna, "global_scale", 1.0f, 0.0001f, 1000.0f, "Scale",
                      "Value by which to enlarge or shrink the objects with"
                      "respect to the world's origin",
@@ -231,6 +237,8 @@ ExportSettings * 
io_common_construct_default_export_settings(struct bContext *C,
        settings->quad_method               = RNA_enum_get(op->ptr, 
"quad_method");
        settings->ngon_method               = RNA_enum_get(op->ptr,  
"ngon_method");
        settings->global_scale              = RNA_float_get(op->ptr, 
"global_scale");
+       settings->use_ascii                 = RNA_boolean_get(op->ptr, 
"use_ascii");
+       settings->use_scene_units           = RNA_boolean_get(op->ptr, 
"use_scene_units");
 
        if(!settings->export_animations) {
                settings->frame_start = BKE_scene_frame_get(CTX_data_scene(C));;
diff --git a/source/blender/editors/io/io_common.h 
b/source/blender/editors/io/io_common.h
index db9489dea5e..47edca32413 100644
--- a/source/blender/editors/io/io_common.h
+++ b/source/blender/editors/io/io_common.h
@@ -68,6 +68,8 @@ typedef struct ExportSettings {
        int quad_method;
        int ngon_method;
 
+       bool use_ascii;
+       bool use_scene_units;
        float global_scale;
 
        /* bool (*should_export_object)(const ExportSettings * const settings, 
const Object * const eob); */
diff --git a/source/blender/editors/io/io_obj.c 
b/source/blender/editors/io/io_obj.c
index 3cbebd0d309..62f8028a93e 100644
--- a/source/blender/editors/io/io_obj.c
+++ b/source/blender/editors/io/io_obj.c
@@ -1,4 +1,3 @@
-
 #include "WM_api.h"
 #include "WM_types.h"
 
@@ -131,10 +130,13 @@ static void wm_obj_export_draw(bContext *C, wmOperator 
*op) {
        uiItemR(row, &ptr, "export_face_sets", 0, NULL, ICON_NONE);
 
        row = uiLayoutRow(box, false);
-       uiItemR(row, &ptr, "apply_modifiers", 1, NULL, ICON_NONE);
+       uiItemR(row, &ptr, "apply_modifiers", 0, NULL, ICON_NONE);
+
+       const bool modifiers = RNA_boolean_get(&ptr, "apply_modifiers");
 
        row = uiLayoutRow(box, false);
-       uiItemR(row, &ptr, "render_modifiers", 1, NULL, ICON_NONE);
+       uiLayoutSetEnabled(row, modifiers);
+       uiItemR(row, &ptr, "render_modifiers", 0, NULL, ICON_NONE);
 
        row = uiLayoutRow(box, false);
        uiItemR(row, &ptr, "curves_as_mesh", 0, NULL, ICON_NONE);
diff --git a/source/blender/editors/io/io_obj.h 
b/source/blender/editors/io/io_obj.h
index 646e3aa757b..e35f1afb368 100644
--- a/source/blender/editors/io/io_obj.h
+++ b/source/blender/editors/io/io_obj.h
@@ -35,6 +35,14 @@ struct wmOperatorType;
 extern "C" {
 #endif
 
+typedef struct OBJExportSettings {
+       float frame_start;
+       float frame_end;
+
+       bool flatten_hierarchy;
+
+} OBJExportSettings;
+
 void WM_OT_obj_export(struct wmOperatorType *ot);
 void WM_OT_obj_import(struct wmOperatorType *ot);
 
diff --git a/source/blender/editors/io/io_stl.c 
b/source/blender/editors/io/io_stl.c
index 6a254a71269..56f2871bae6 100644
--- a/source/blender/editors/io/io_stl.c
+++ b/source/blender/editors/io/io_stl.c
@@ -11,6 +11,10 @@
 #include "io_stl.h"
 #include "intern/stl.h"
 
+#include "RNA_access.h"
+#include "UI_interface.h"
+#include "UI_resources.h"
+
 /* bool STL_export(bContext *C, ExportSettings * const settings); */
 
 static int wm_stl_export_invoke(bContext *C, wmOperator *op, const wmEvent 
*event) {
@@ -20,7 +24,47 @@ static int wm_stl_export_exec(bContext *C, wmOperator *op) {
        return io_common_export_exec(C, op, &STL_export /* export function */);
 }
 static void wm_stl_export_draw(bContext *C, wmOperator *op) {
-       /* io_common_export_draw(C, op); */
+       PointerRNA ptr;
+       RNA_pointer_create(NULL, op->type->srna, op->properties, &ptr);
+
+       /* uiLayout *box; */
+       /* uiLayout *sub_box; */
+       uiLayout *row;
+
+       /* box = uiLayoutBox(op->layout); */
+
+       row = uiLayoutRow(op->layout, false);
+       uiItemR(row, &ptr, "axis_forward", 0, NULL, ICON_NONE);
+
+       row = uiLayoutRow(op->layout, false);
+       uiItemR(row, &ptr, "axis_up", 0, NULL, ICON_NONE);
+
+       row = uiLayoutRow(op->layout, false);
+       uiItemR(row, &ptr, "selected_only", 0, NULL, ICON_NONE);
+
+       row = uiLayoutRow(op->layout, false);
+       uiItemR(row, &ptr, "visible_only", 0, NULL, ICON_NONE);
+
+       row = uiLayoutRow(op->layout, false);
+       uiItemR(row, &ptr, "renderable_only", 0, NULL, ICON_NONE);
+
+       row = uiLayoutRow(op->layout, false);
+       uiItemR(row, &ptr, "use_ascii", 0, NULL, ICON_NONE);
+
+       row = uiLayoutRow(op->layout, false);
+       uiItemR(row, &ptr, "global_scale", 0, NULL, ICON_NONE);
+
+       row = uiLayoutRow(op->layout, false);
+       uiItemR(row, &ptr, "use_scene_units", 0, NULL, ICON_NONE);
+
+       row = uiLayoutRow(op->layout, false);
+       uiItemR(row, &ptr, "apply_modifiers", 0, NULL, ICON_NONE);
+
+       const bool modifiers = RNA_boolean_get(&ptr, "apply_modifiers");
+
+       row = uiLayoutRow(op->layout, false);
+       uiLayoutSetEnabled(row, modifiers);
+       uiItemR(row, &ptr, "render_modifiers", 0, NULL, ICON_NONE);
 }
 static bool wm_stl_export_check(bContext *C, wmOperator *op) {
        return io_common_export_check(C, op, ".stl");

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to