[Bf-blender-cvs] [26049908bf0] temp-gpencil-io: Use blender::Vector
Antonio Vazquez
noreply at git.blender.org
Wed Mar 17 18:10:41 CET 2021
Commit: 26049908bf09d112896150b46fe3e0809cd2f706
Author: Antonio Vazquez
Date: Wed Mar 17 18:10:36 2021 +0100
Branches: temp-gpencil-io
https://developer.blender.org/rB26049908bf09d112896150b46fe3e0809cd2f706
Use blender::Vector
===================================================================
M source/blender/editors/io/io_gpencil_export.c
M source/blender/io/gpencil/intern/gpencil_io_base.cc
M source/blender/io/gpencil/intern/gpencil_io_base.h
===================================================================
diff --git a/source/blender/editors/io/io_gpencil_export.c b/source/blender/editors/io/io_gpencil_export.c
index 9f18f53a6ca..aae65fecfff 100644
--- a/source/blender/editors/io/io_gpencil_export.c
+++ b/source/blender/editors/io/io_gpencil_export.c
@@ -67,6 +67,33 @@ static const EnumPropertyItem gpencil_export_select_items[] = {
{0, NULL, 0, NULL, NULL},
};
+/* Common props for exporting. */
+static void gpencil_export_common_props_definition(wmOperatorType *ot)
+{
+ RNA_def_boolean(ot->srna, "use_fill", true, "Fill", "Export filled areas");
+ RNA_def_enum(ot->srna,
+ "selected_object_type",
+ gpencil_export_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);
+ RNA_def_boolean(ot->srna,
+ "use_normalized_thickness",
+ false,
+ "Normalize",
+ "Export strokes with constant thickness along the stroke");
+}
+
static void ui_gpencil_export_common_settings(uiLayout *layout, PointerRNA *imfptr)
{
uiLayout *box, *row, *col;
@@ -100,34 +127,12 @@ static bool wm_gpencil_export_svg_common_check(bContext *UNUSED(C), wmOperator *
static void gpencil_export_common_props_svg(wmOperatorType *ot)
{
- RNA_def_boolean(ot->srna, "use_fill", true, "Fill", "Export filled areas");
- RNA_def_boolean(ot->srna,
- "use_normalized_thickness",
- false,
- "Normalize",
- "Export strokes with constant thickness along the stroke");
- ot->prop = RNA_def_enum(ot->srna,
- "selected_object_type",
- gpencil_export_select_items,
- GP_EXPORT_SELECTED,
- "Object",
- "Objects included in the export");
-
+ gpencil_export_common_props_definition(ot);
RNA_def_boolean(ot->srna,
"use_clip_camera",
false,
"Clip Camera",
"Clip drawings to camera size when export in camera view");
- 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);
}
static int wm_gpencil_export_svg_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
@@ -445,29 +450,7 @@ void WM_OT_gpencil_export_pdf(wmOperatorType *ot)
{0, NULL, 0, NULL, NULL},
};
- RNA_def_boolean(ot->srna, "use_fill", true, "Fill", "Export filled areas");
- RNA_def_boolean(ot->srna,
- "use_normalized_thickness",
- false,
- "Normalize",
- "Export strokes with constant thickness along the stroke");
- ot->prop = RNA_def_enum(ot->srna,
- "selected_object_type",
- gpencil_export_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);
+ gpencil_export_common_props_definition(ot);
ot->prop = RNA_def_enum(ot->srna,
"frame_mode",
gpencil_export_frame_items,
diff --git a/source/blender/io/gpencil/intern/gpencil_io_base.cc b/source/blender/io/gpencil/intern/gpencil_io_base.cc
index 8c9faf84eed..66bf3d7164f 100644
--- a/source/blender/io/gpencil/intern/gpencil_io_base.cc
+++ b/source/blender/io/gpencil/intern/gpencil_io_base.cc
@@ -177,7 +177,7 @@ void GpencilIO::create_object_list()
if (is_camera_) {
float camera_z = dot_v3v3(camera_z_axis, object->obmat[3]);
ObjectZ obz = {camera_z, object};
- ob_list_.push_back(obz);
+ ob_list_.append(obz);
}
else {
float zdepth = 0;
@@ -189,7 +189,7 @@ void GpencilIO::create_object_list()
zdepth = -dot_v3v3(rv3d_->viewinv[2], object->obmat[3]);
}
ObjectZ obz = {zdepth * -1.0f, object};
- ob_list_.push_back(obz);
+ ob_list_.append(obz);
}
}
}
@@ -325,10 +325,9 @@ bool GpencilIO::is_stroke_thickness_constant(struct bGPDstroke *gps)
/** Get radius of point. */
float GpencilIO::stroke_point_radius_get(bGPDlayer *gpl, struct bGPDstroke *gps)
{
- bGPDspoint *pt = nullptr;
float v1[2], screen_co[2], screen_ex[2];
- pt = &gps->points[0];
+ bGPDspoint *pt = &gps->points[0];
gpencil_3d_point_to_2D(&pt->x, screen_co);
/* Radius. */
diff --git a/source/blender/io/gpencil/intern/gpencil_io_base.h b/source/blender/io/gpencil/intern/gpencil_io_base.h
index 9219727da9a..0d8dbbffe87 100644
--- a/source/blender/io/gpencil/intern/gpencil_io_base.h
+++ b/source/blender/io/gpencil/intern/gpencil_io_base.h
@@ -24,6 +24,8 @@
#include <string>
#include <vector>
+#include "BLI_vector.hh"
+
#include "gpencil_io.h"
struct ARegion;
@@ -39,6 +41,8 @@ struct bGPDframe;
struct bGPDstroke;
struct MaterialGPencilStyle;
+using blender::Vector;
+
namespace blender::io::gpencil {
class GpencilIO {
@@ -62,7 +66,7 @@ class GpencilIO {
};
/** List of included objects. */
- std::vector<ObjectZ> ob_list_;
+ blender::Vector<ObjectZ> ob_list_;
/* Data for easy access. */
struct Depsgraph *depsgraph_;
More information about the Bf-blender-cvs
mailing list