[Bf-blender-cvs] [f5a6d287c86] temp-gpencil-io: Various small cleanups
Hans Goudey
noreply at git.blender.org
Tue Mar 23 17:54:28 CET 2021
Commit: f5a6d287c8637a218eba08a16d7ff4835fbeb94f
Author: Hans Goudey
Date: Tue Mar 23 12:54:21 2021 -0400
Branches: temp-gpencil-io
https://developer.blender.org/rBf5a6d287c8637a218eba08a16d7ff4835fbeb94f
Various small cleanups
- Use consistent order for includes
- Remove unecessary `struct` use in cc files
- Small UI cleanups
- Some very small whitespace changes
===================================================================
M source/blender/editors/io/io_gpencil_export.c
M source/blender/editors/io/io_gpencil_import.c
M source/blender/io/gpencil/gpencil_io.h
M source/blender/io/gpencil/intern/gpencil_io_base.cc
M source/blender/io/gpencil/intern/gpencil_io_base.h
M source/blender/io/gpencil/intern/gpencil_io_capi.cc
M source/blender/io/gpencil/intern/gpencil_io_export_base.cc
M source/blender/io/gpencil/intern/gpencil_io_export_pdf.cc
M source/blender/io/gpencil/intern/gpencil_io_export_svg.cc
M source/blender/io/gpencil/intern/gpencil_io_import_base.cc
M source/blender/io/gpencil/intern/gpencil_io_import_svg.cc
===================================================================
diff --git a/source/blender/editors/io/io_gpencil_export.c b/source/blender/editors/io/io_gpencil_export.c
index 2d2d161c761..a1b4c564a3f 100644
--- a/source/blender/editors/io/io_gpencil_export.c
+++ b/source/blender/editors/io/io_gpencil_export.c
@@ -21,6 +21,9 @@
* \ingroup editor/io
*/
+#include "BLI_path_util.h"
+#include "BLI_string.h"
+
#include "DNA_gpencil_types.h"
#include "DNA_space_types.h"
@@ -29,9 +32,6 @@
#include "BKE_report.h"
#include "BKE_screen.h"
-#include "BLI_path_util.h"
-#include "BLI_string.h"
-
#include "BLT_translation.h"
#include "RNA_access.h"
@@ -51,49 +51,47 @@
#include "gpencil_io.h"
/* Definition of enum elements to export. */
-static const EnumPropertyItem gpencil_export_select_items[] = {
- {GP_EXPORT_ACTIVE, "ACTIVE", 0, "Active", "Include only active object"},
- {GP_EXPORT_SELECTED, "SELECTED", 0, "Selected", "Include selected objects"},
- {GP_EXPORT_VISIBLE, "VISIBLE", 0, "Visible", "Include visible objects"},
- {0, NULL, 0, NULL, NULL},
-};
-
/* Common props for exporting. */
static void gpencil_export_common_props_definition(wmOperatorType *ot)
{
+ static const EnumPropertyItem select_items[] = {
+ {GP_EXPORT_ACTIVE, "ACTIVE", 0, "Active", "Include only the active object"},
+ {GP_EXPORT_SELECTED, "SELECTED", 0, "Selected", "Include selected objects"},
+ {GP_EXPORT_VISIBLE, "VISIBLE", 0, "Visible", "Include all visible objects"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
RNA_def_boolean(ot->srna, "use_fill", true, "Fill", "Export filled areas");
RNA_def_enum(ot->srna,
"selected_object_type",
- gpencil_export_select_items,
+ select_items,
GP_EXPORT_SELECTED,
"Object",
- "Objects included in the export");
- RNA_def_float(
- ot->srna,
- "stroke_sample",
- 0.0f,
- 0.0f,
- 100.0f,
- "Sampling",
- "Precision of sampling stroke, low values gets more precise result, zero to disable",
- 0.0f,
- 100.0f);
+ "Which objects to include in the export");
+ RNA_def_float(ot->srna,
+ "stroke_sample",
+ 0.0f,
+ 0.0f,
+ 100.0f,
+ "Sampling",
+ "Precision of stroke sampling. Low values mean a more precise result, and zero "
+ "disables sampling",
+ 0.0f,
+ 100.0f);
RNA_def_boolean(ot->srna,
"use_normalized_thickness",
false,
"Normalize",
- "Export strokes with constant thickness along the stroke");
+ "Export strokes with constant thickness");
}
static void ui_gpencil_export_common_settings(uiLayout *layout, PointerRNA *imfptr)
{
- uiLayout *box, *row, *col;
+ uiLayout *box = uiLayoutBox(layout);
+ uiLayout *row = uiLayoutRow(box, false);
+ uiItemL(row, IFACE_("Export Options"), ICON_NONE);
- box = uiLayoutBox(layout);
- row = uiLayoutRow(box, false);
- uiItemL(row, IFACE_("Export Options"), ICON_SCENE_DATA);
-
- col = uiLayoutColumn(box, false);
+ uiLayout *col = uiLayoutColumn(box, false);
uiItemR(col, imfptr, "stroke_sample", 0, NULL, ICON_NONE);
uiItemR(col, imfptr, "use_fill", 0, NULL, ICON_NONE);
uiItemR(col, imfptr, "use_normalized_thickness", 0, NULL, ICON_NONE);
@@ -175,20 +173,20 @@ static int wm_gpencil_export_svg_exec(bContext *C, wmOperator *op)
SET_FLAG_FROM_TEST(flag, use_norm_thickness, GP_EXPORT_NORM_THICKNESS);
SET_FLAG_FROM_TEST(flag, use_clip_camera, GP_EXPORT_CLIP_CAMERA);
- struct GpencilIOParams params = {.C = C,
- .region = region,
- .v3d = v3d,
- .ob = ob,
- .mode = GP_EXPORT_TO_SVG,
- .frame_start = CFRA,
- .frame_end = CFRA,
- .frame_cur = CFRA,
- .flag = flag,
- .scale = 1.0f,
- .select_mode = select_mode,
- .frame_mode = GP_EXPORT_FRAME_ACTIVE,
- .stroke_sample = RNA_float_get(op->ptr, "stroke_sample"),
- .resolution = 1.0f};
+ GpencilIOParams params = {.C = C,
+ .region = region,
+ .v3d = v3d,
+ .ob = ob,
+ .mode = GP_EXPORT_TO_SVG,
+ .frame_start = CFRA,
+ .frame_end = CFRA,
+ .frame_cur = CFRA,
+ .flag = flag,
+ .scale = 1.0f,
+ .select_mode = select_mode,
+ .frame_mode = GP_EXPORT_FRAME_ACTIVE,
+ .stroke_sample = RNA_float_get(op->ptr, "stroke_sample"),
+ .resolution = 1.0f};
/* Do export. */
WM_cursor_wait(true);
@@ -212,7 +210,7 @@ static void ui_gpencil_export_svg_settings(uiLayout *layout, PointerRNA *imfptr)
box = uiLayoutBox(layout);
row = uiLayoutRow(box, false);
- uiItemL(row, IFACE_("Scene Options"), ICON_SCENE_DATA);
+ uiItemL(row, IFACE_("Scene Options"), ICON_NONE);
row = uiLayoutRow(box, false);
uiItemR(row, imfptr, "selected_object_type", 0, NULL, ICON_NONE);
@@ -222,7 +220,6 @@ static void ui_gpencil_export_svg_settings(uiLayout *layout, PointerRNA *imfptr)
static void wm_gpencil_export_svg_draw(bContext *UNUSED(C), wmOperator *op)
{
-
PointerRNA ptr;
RNA_pointer_create(NULL, op->type->srna, op->properties, &ptr);
@@ -325,20 +322,20 @@ static int wm_gpencil_export_pdf_exec(bContext *C, wmOperator *op)
SET_FLAG_FROM_TEST(flag, use_fill, GP_EXPORT_FILL);
SET_FLAG_FROM_TEST(flag, use_norm_thickness, GP_EXPORT_NORM_THICKNESS);
- struct GpencilIOParams params = {.C = C,
- .region = region,
- .v3d = v3d,
- .ob = ob,
- .mode = GP_EXPORT_TO_PDF,
- .frame_start = SFRA,
- .frame_end = EFRA,
- .frame_cur = CFRA,
- .flag = flag,
- .scale = 1.0f,
- .select_mode = select_mode,
- .frame_mode = frame_mode,
- .stroke_sample = RNA_float_get(op->ptr, "stroke_sample"),
- .resolution = 1.0f};
+ GpencilIOParams params = {.C = C,
+ .region = region,
+ .v3d = v3d,
+ .ob = ob,
+ .mode = GP_EXPORT_TO_PDF,
+ .frame_start = SFRA,
+ .frame_end = EFRA,
+ .frame_cur = CFRA,
+ .flag = flag,
+ .scale = 1.0f,
+ .select_mode = select_mode,
+ .frame_mode = frame_mode,
+ .stroke_sample = RNA_float_get(op->ptr, "stroke_sample"),
+ .resolution = 1.0f};
/* Do export. */
WM_cursor_wait(true);
@@ -362,14 +359,14 @@ static void ui_gpencil_export_pdf_settings(uiLayout *layout, PointerRNA *imfptr)
box = uiLayoutBox(layout);
row = uiLayoutRow(box, false);
- uiItemL(row, IFACE_("Scene Options"), ICON_SCENE_DATA);
+ uiItemL(row, IFACE_("Scene Options"), ICON_NONE);
row = uiLayoutRow(box, false);
uiItemR(row, imfptr, "selected_object_type", 0, NULL, ICON_NONE);
box = uiLayoutBox(layout);
row = uiLayoutRow(box, false);
- uiItemL(row, IFACE_("Export Options"), ICON_SCENE_DATA);
+ uiItemL(row, IFACE_("Export Options"), ICON_NONE);
col = uiLayoutColumn(box, false);
sub = uiLayoutColumn(col, true);
@@ -433,6 +430,6 @@ void WM_OT_gpencil_export_pdf(wmOperatorType *ot)
gpencil_export_frame_items,
GP_EXPORT_ACTIVE,
"Frames",
- "Frames included in the export");
+ "Which frames to include in the export");
}
#endif
diff --git a/source/blender/editors/io/io_gpencil_import.c b/source/blender/editors/io/io_gpencil_import.c
index c31ed549e3d..79bf4340ad5 100644
--- a/source/blender/editors/io/io_gpencil_import.c
+++ b/source/blender/editors/io/io_gpencil_import.c
@@ -21,6 +21,8 @@
* \ingroup editor/io
*/
+#include "BLI_path_util.h"
+
#include "DNA_gpencil_types.h"
#include "DNA_space_types.h"
@@ -28,8 +30,6 @@
#include "BKE_gpencil.h"
#include "BKE_report.h"
-#include "BLI_path_util.h"
-
#include "BLT_translation.h"
#include "RNA_access.h"
@@ -98,7 +98,7 @@ static int wm_gpencil_import_svg_exec(bContext *C, wmOperator *op)
const int resolution = RNA_int_get(op->ptr, "resolution");
const float scale = RNA_float_get(op->ptr, "scale");
- struct GpencilIOParams params = {
+ GpencilIOParams params = {
.C = C,
.region = region,
.v3d = v3d,
@@ -129,25 +129,16 @@ static int wm_gpencil_import_svg_exec(bContext *C, wmOperator *op)
static void ui_gpencil_import_svg_settings(uiLayout *layout, PointerRNA *imfptr)
{
- uiLayout *box, *row, *col;
-
uiLayoutSetPropSep(layout, true);
uiLayoutSetPropDecorate(layout, false);
-
- box = uiLayoutBox(layout);
- row = uiLayoutRow(box, false);
- uiItemL(row, IFACE_("Import Options"), ICON_SCENE_DATA);
-
- col = uiLayoutColumn(box, false);
+ uiLayout *col = uiLayoutColumn(layout, false);
uiItemR(col, imfptr, "resolution", 0, NULL, ICON_NONE);
uiItemR(col, imfptr, "scale", 0, NULL, ICON_NONE);
}
static void wm_gpencil_import_svg_draw(bContext *UNUSED(C), wmOperator *op)
{
-
PointerRNA ptr;
-
RNA_poin
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list