[Bf-blender-cvs] [c666a4c03c9] soc-2020-io-performance: Review update: fix UI text; add comments.
Ankit Meel
noreply at git.blender.org
Mon Aug 31 18:48:37 CEST 2020
Commit: c666a4c03c988c0568bdb90edff8393a2eda013d
Author: Ankit Meel
Date: Mon Aug 31 22:08:44 2020 +0530
Branches: soc-2020-io-performance
https://developer.blender.org/rBc666a4c03c988c0568bdb90edff8393a2eda013d
Review update: fix UI text; add comments.
Variable type change for `forward_axis` and `up_axis`.
===================================================================
M source/blender/editors/io/io_obj.c
M source/blender/io/wavefront_obj/IO_wavefront_obj.h
M source/blender/io/wavefront_obj/intern/obj_export_file_writer.cc
===================================================================
diff --git a/source/blender/editors/io/io_obj.c b/source/blender/editors/io/io_obj.c
index e6f38dd4533..693746ca6c6 100644
--- a/source/blender/editors/io/io_obj.c
+++ b/source/blender/editors/io/io_obj.c
@@ -50,39 +50,38 @@
#include "io_obj.h"
const EnumPropertyItem io_obj_transform_axis_forward[] = {
- {OBJ_AXIS_X_FORWARD, "X_FORWARD", 0, "X", "Positive X-axis"},
- {OBJ_AXIS_Y_FORWARD, "Y_FORWARD", 0, "Y", "Positive Y-axis"},
- {OBJ_AXIS_Z_FORWARD, "Z_FORWARD", 0, "Z", "Positive Z-axis"},
- {OBJ_AXIS_NEGATIVE_X_FORWARD, "NEGATIVE_X_FORWARD", 0, "-X", "Negative X-axis"},
- {OBJ_AXIS_NEGATIVE_Y_FORWARD, "NEGATIVE_Y_FORWARD", 0, "-Y (Default)", "Negative Y-axis"},
- {OBJ_AXIS_NEGATIVE_Z_FORWARD, "NEGATIVE_Z_FORWARD", 0, "-Z", "Negative Z-axis"},
+ {OBJ_AXIS_X_FORWARD, "X_FORWARD", 0, "X", "Positive X axis"},
+ {OBJ_AXIS_Y_FORWARD, "Y_FORWARD", 0, "Y", "Positive Y axis"},
+ {OBJ_AXIS_Z_FORWARD, "Z_FORWARD", 0, "Z", "Positive Z axis"},
+ {OBJ_AXIS_NEGATIVE_X_FORWARD, "NEGATIVE_X_FORWARD", 0, "-X", "Negative X axis"},
+ {OBJ_AXIS_NEGATIVE_Y_FORWARD, "NEGATIVE_Y_FORWARD", 0, "-Y (Default)", "Negative Y axis"},
+ {OBJ_AXIS_NEGATIVE_Z_FORWARD, "NEGATIVE_Z_FORWARD", 0, "-Z", "Negative Z axis"},
{0, NULL, 0, NULL, NULL}};
const EnumPropertyItem io_obj_transform_axis_up[] = {
- {OBJ_AXIS_X_UP, "X_UP", 0, "X", "Positive X-axis"},
- {OBJ_AXIS_Y_UP, "Y_UP", 0, "Y", "Positive Y-axis"},
- {OBJ_AXIS_Z_UP, "Z_UP", 0, "Z (Default)", "Positive Z-axis"},
- {OBJ_AXIS_NEGATIVE_X_UP, "NEGATIVE_X_UP", 0, "-X", "Negative X-axis"},
- {OBJ_AXIS_NEGATIVE_Y_UP, "NEGATIVE_Y_UP", 0, "-Y", "Negative Y-axis"},
- {OBJ_AXIS_NEGATIVE_Z_UP, "NEGATIVE_Z_UP", 0, "-Z", "Negative Z-axis"},
+ {OBJ_AXIS_X_UP, "X_UP", 0, "X", "Positive X axis"},
+ {OBJ_AXIS_Y_UP, "Y_UP", 0, "Y", "Positive Y axis"},
+ {OBJ_AXIS_Z_UP, "Z_UP", 0, "Z (Default)", "Positive Z axis"},
+ {OBJ_AXIS_NEGATIVE_X_UP, "NEGATIVE_X_UP", 0, "-X", "Negative X axis"},
+ {OBJ_AXIS_NEGATIVE_Y_UP, "NEGATIVE_Y_UP", 0, "-Y", "Negative Y axis"},
+ {OBJ_AXIS_NEGATIVE_Z_UP, "NEGATIVE_Z_UP", 0, "-Z", "Negative Z axis"},
{0, NULL, 0, NULL, NULL}};
const EnumPropertyItem io_obj_export_evaluation_mode[] = {
{DAG_EVAL_RENDER,
"DAG_EVAL_RENDER",
0,
- "Render properties",
+ "Render",
"Modifiers need to be applied for render properties to take effect"},
{DAG_EVAL_VIEWPORT,
"DAG_EVAL_VIEWPORT",
0,
- "Viewport properties (Default)",
+ "Viewport (Default)",
"Export objects as they appear in the viewport"},
{0, NULL, 0, NULL, NULL}};
-static int wm_obj_export_invoke(bContext *C, wmOperator *op, const wmEvent *event)
+static int wm_obj_export_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
{
-
if (!RNA_struct_property_is_set(op->ptr, "filepath")) {
Main *bmain = CTX_data_main(C);
char filepath[FILE_MAX];
@@ -100,8 +99,6 @@ static int wm_obj_export_invoke(bContext *C, wmOperator *op, const wmEvent *even
WM_event_add_fileselect(C, op);
return OPERATOR_RUNNING_MODAL;
-
- UNUSED_VARS(event);
}
static int wm_obj_export_exec(bContext *C, wmOperator *op)
@@ -141,86 +138,56 @@ static int wm_obj_export_exec(bContext *C, wmOperator *op)
static void ui_obj_export_settings(uiLayout *layout, PointerRNA *imfptr)
{
- uiLayout *box;
- uiLayout *row;
+
const bool export_animation = RNA_boolean_get(imfptr, "export_animation");
const bool export_smooth_groups = RNA_boolean_get(imfptr, "export_smooth_groups");
- box = uiLayoutBox(layout);
- row = uiLayoutRow(box, false);
- /* Animation options. */
- uiItemL(row, IFACE_("Animation"), ICON_NONE);
-
- row = uiLayoutRow(box, false);
- uiItemR(row, imfptr, "export_animation", 0, NULL, ICON_NONE);
-
- row = uiLayoutRow(box, false);
- uiItemR(row, imfptr, "start_frame", 0, NULL, ICON_NONE);
- uiLayoutSetEnabled(row, export_animation);
-
- row = uiLayoutRow(box, false);
- uiItemR(row, imfptr, "end_frame", 0, NULL, ICON_NONE);
- uiLayoutSetEnabled(row, export_animation);
+ uiLayoutSetPropSep(layout, true);
+ uiLayoutSetPropDecorate(layout, false);
- /* Geometry Transform options. */
+ /* Animation options. */
+ uiLayout *box = uiLayoutBox(layout);
+ uiItemL(box, IFACE_("Animation"), ICON_ANIM);
+ uiLayout *col = uiLayoutColumn(box, true);
+ uiLayout *sub = uiLayoutColumn(col, true);
+ uiItemR(sub, imfptr, "export_animation", 0, NULL, ICON_NONE);
+ sub = uiLayoutColumn(sub, true);
+ uiItemR(sub, imfptr, "start_frame", 0, IFACE_("Frame Start"), ICON_NONE);
+ uiItemR(sub, imfptr, "end_frame", 0, IFACE_("End"), ICON_NONE);
+ uiLayoutSetEnabled(sub, export_animation);
+
+ /* Object Transform options. */
box = uiLayoutBox(layout);
- row = uiLayoutRow(box, false);
- uiItemL(row, IFACE_("Geometry Transform"), ICON_NONE);
-
- row = uiLayoutRow(box, false);
- uiItemR(row, imfptr, "forward_axis", 0, NULL, ICON_NONE);
-
- row = uiLayoutRow(box, 1);
- uiItemR(row, imfptr, "up_axis", 0, NULL, ICON_NONE);
-
- row = uiLayoutRow(box, false);
- uiItemR(row, imfptr, "scaling_factor", 0, NULL, ICON_NONE);
-
- row = uiLayoutRow(box, false);
- uiItemR(row, imfptr, "export_eval_mode", 0, NULL, ICON_NONE);
+ uiItemL(box, IFACE_("Object Transform"), ICON_OBJECT_DATA);
+ col = uiLayoutColumn(box, true);
+ uiItemR(col, imfptr, "forward_axis", 0, NULL, ICON_NONE);
+ uiItemR(col, imfptr, "up_axis", 0, NULL, ICON_NONE);
+ uiItemR(col, imfptr, "scaling_factor", 0, NULL, ICON_NONE);
+ uiItemR(col, imfptr, "export_eval_mode", 0, NULL, ICON_NONE);
- /* File write options. */
+ /* Options for what to write. */
box = uiLayoutBox(layout);
- row = uiLayoutRow(box, false);
- uiItemL(row, IFACE_("File Write Options"), ICON_NONE);
-
- row = uiLayoutRow(box, false);
- uiItemR(row, imfptr, "export_selected_objects", 0, NULL, ICON_NONE);
-
- row = uiLayoutRow(box, false);
- uiItemR(row, imfptr, "export_uv", 0, NULL, ICON_NONE);
-
- row = uiLayoutRow(box, false);
- uiItemR(row, imfptr, "export_normals", 0, NULL, ICON_NONE);
-
- row = uiLayoutRow(box, false);
- uiItemR(row, imfptr, "export_materials", 0, NULL, ICON_NONE);
-
- row = uiLayoutRow(box, false);
- uiItemR(row, imfptr, "export_triangulated_mesh", 0, NULL, ICON_NONE);
-
- row = uiLayoutRow(box, false);
- uiItemR(row, imfptr, "export_curves_as_nurbs", 0, NULL, ICON_NONE);
+ uiItemL(box, IFACE_("Geometry Export Options"), ICON_EXPORT);
+ col = uiLayoutColumn(box, true);
+ sub = uiLayoutColumnWithHeading(col, true, IFACE_("Export"));
+ uiItemR(sub, imfptr, "export_uv", 0, IFACE_("UV Coordinates"), ICON_NONE);
+ uiItemR(sub, imfptr, "export_normals", 0, IFACE_("Normals"), ICON_NONE);
+ uiItemR(sub, imfptr, "export_materials", 0, IFACE_("Materials"), ICON_NONE);
+ uiItemR(sub, imfptr, "export_selected_objects", 0, IFACE_("Selected Objects Only"), ICON_NONE);
+ uiItemR(sub, imfptr, "export_triangulated_mesh", 0, IFACE_("Triangulated Mesh"), ICON_NONE);
+ uiItemR(sub, imfptr, "export_curves_as_nurbs", 0, IFACE_("Curves as NURBS"), ICON_NONE);
box = uiLayoutBox(layout);
- row = uiLayoutRow(box, false);
- uiItemL(row, IFACE_("Grouping Options"), ICON_NONE);
-
- row = uiLayoutRow(box, false);
- uiItemR(row, imfptr, "export_object_groups", 0, NULL, ICON_NONE);
-
- row = uiLayoutRow(box, false);
- uiItemR(row, imfptr, "export_material_groups", 0, NULL, ICON_NONE);
-
- row = uiLayoutRow(box, false);
- uiItemR(row, imfptr, "export_vertex_groups", 0, NULL, ICON_NONE);
-
- row = uiLayoutRow(box, false);
- uiItemR(row, imfptr, "export_smooth_groups", 0, NULL, ICON_NONE);
-
- row = uiLayoutRow(box, false);
- uiItemR(row, imfptr, "smooth_group_bitflags", 0, NULL, ICON_NONE);
- uiLayoutSetEnabled(row, export_smooth_groups);
+ uiItemL(box, IFACE_("Grouping Options"), ICON_GROUP);
+ col = uiLayoutColumn(box, true);
+ sub = uiLayoutColumnWithHeading(col, true, IFACE_("Export"));
+ uiItemR(sub, imfptr, "export_object_groups", 0, IFACE_("Object Groups"), ICON_NONE);
+ uiItemR(sub, imfptr, "export_material_groups", 0, IFACE_("Material Groups"), ICON_NONE);
+ uiItemR(sub, imfptr, "export_vertex_groups", 0, IFACE_("Vertex Groups"), ICON_NONE);
+ uiItemR(sub, imfptr, "export_smooth_groups", 0, IFACE_("Smooth Groups"), ICON_NONE);
+ sub = uiLayoutColumn(sub, true);
+ uiLayoutSetEnabled(sub, export_smooth_groups);
+ uiItemR(sub, imfptr, "smooth_group_bitflags", 0, IFACE_("Smooth Group Bitflags"), ICON_NONE);
}
static void wm_obj_export_draw(bContext *UNUSED(C), wmOperator *op)
@@ -232,7 +199,7 @@ static void wm_obj_export_draw(bContext *UNUSED(C), wmOperator *op)
static bool wm_obj_export_check(bContext *C, wmOperator *op)
{
- char filepath[FILE_MAX];
+ char filepath[FILE_MAX] = {};
Scene *scene = CTX_data_scene(C);
bool ret = false;
RNA_string_get(op->ptr, "filepath", filepath);
@@ -244,16 +211,13 @@ static bool wm_obj_export_check(bContext *C, wmOperator *op)
}
/* Set the default export frames to the current one in viewport. */
- if (RNA_int_get(op->ptr, "start_frame") == INT_MAX) {
+ if (RNA_boolean_get(op->ptr, "export_animation")) {
+ RNA_int_set(op->ptr, "start_frame", SFRA);
+ RNA_int_set(op->ptr, "end_frame", EFRA);
+ }
+ else {
RNA_int_set(op->ptr, "start_frame", CFRA);
RNA_int_set(op->ptr, "end_frame", CFRA);
- ret = true;
- }
-
- /* End frame should be greater than or equal to start frame. */
- if (RNA_int_get(op->ptr, "start_frame") > RNA_int_get(op->ptr, "end_frame")) {
- RNA_int_set(op->ptr, "end_frame", RNA_int_get(op->ptr, "start_frame"));
- ret = true;
}
/* Both forward and up axes cannot be the same (or same except opposite sign). */
@@ -262,6 +226,13 @@ static bool wm_obj_export_check(bContext *C, wmOperator *op)
RNA_enum_set(op->ptr, "up_axis", RNA_enum_get(op->ptr, "up_axis") % 3 + 1);
ret = true;
}
+
+ /* One can enable smooth groups bitflags, then disable smooth groups, but smooth group bitflags
+ * remain enabled. This can be confusing.
+ */
+ if (!RNA_boolean_get(op->ptr, "export_smooth_groups")) {
+ RNA_boolean_set(op->ptr, "smooth_group_bitflags", false);
+ }
return ret;
}
@@ -290,8 +261,7 @@ void W
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list