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:
Diffstat (limited to 'source/blender/io/gpencil')
-rw-r--r--source/blender/io/gpencil/gpencil_io.h6
-rw-r--r--source/blender/io/gpencil/intern/gpencil_io_base.cc10
-rw-r--r--source/blender/io/gpencil/intern/gpencil_io_base.hh10
-rw-r--r--source/blender/io/gpencil/intern/gpencil_io_capi.cc2
-rw-r--r--source/blender/io/gpencil/intern/gpencil_io_export_pdf.cc11
-rw-r--r--source/blender/io/gpencil/intern/gpencil_io_export_pdf.hh15
-rw-r--r--source/blender/io/gpencil/intern/gpencil_io_export_svg.cc37
-rw-r--r--source/blender/io/gpencil/intern/gpencil_io_export_svg.hh41
8 files changed, 68 insertions, 64 deletions
diff --git a/source/blender/io/gpencil/gpencil_io.h b/source/blender/io/gpencil/gpencil_io.h
index cb004910c1e..ea328a531c6 100644
--- a/source/blender/io/gpencil/gpencil_io.h
+++ b/source/blender/io/gpencil/gpencil_io.h
@@ -85,7 +85,13 @@ typedef enum eGpencilExportFrame {
GP_EXPORT_FRAME_SCENE = 2,
} eGpencilExportFrame;
+/**
+ * Main export entry point function.
+ */
bool gpencil_io_export(const char *filename, struct GpencilIOParams *iparams);
+/**
+ * Main import entry point function.
+ */
bool gpencil_io_import(const char *filename, struct GpencilIOParams *iparams);
#ifdef __cplusplus
diff --git a/source/blender/io/gpencil/intern/gpencil_io_base.cc b/source/blender/io/gpencil/intern/gpencil_io_base.cc
index 294f6bfccb7..f031648d2ed 100644
--- a/source/blender/io/gpencil/intern/gpencil_io_base.cc
+++ b/source/blender/io/gpencil/intern/gpencil_io_base.cc
@@ -145,7 +145,6 @@ void GpencilIO::prepare_camera_params(Scene *scene, const GpencilIOParams *ipara
}
}
-/** Create a list of selected objects sorted from back to front */
void GpencilIO::create_object_list()
{
ViewLayer *view_layer = CTX_data_view_layer(params_.C);
@@ -194,17 +193,12 @@ void GpencilIO::create_object_list()
});
}
-/**
- * Set file input_text full path.
- * \param filename: Path of the file provided by save dialog.
- */
void GpencilIO::filename_set(const char *filename)
{
BLI_strncpy(filename_, filename, FILE_MAX);
BLI_path_abs(filename_, BKE_main_blendfile_path(bmain_));
}
-/** Convert to screenspace. */
bool GpencilIO::gpencil_3D_point_to_screen_space(const float3 co, float2 &r_co)
{
float3 parent_co = diff_mat_ * co;
@@ -244,7 +238,6 @@ bool GpencilIO::gpencil_3D_point_to_screen_space(const float3 co, float2 &r_co)
return false;
}
-/** Convert to render space. */
float2 GpencilIO::gpencil_3D_point_to_render_space(const float3 co)
{
float3 parent_co = diff_mat_ * co;
@@ -266,7 +259,6 @@ float2 GpencilIO::gpencil_3D_point_to_render_space(const float3 co)
return r_co;
}
-/** Convert to 2D. */
float2 GpencilIO::gpencil_3D_point_to_2D(const float3 co)
{
const bool is_camera = (bool)(rv3d_->persp == RV3D_CAMOB);
@@ -278,7 +270,6 @@ float2 GpencilIO::gpencil_3D_point_to_2D(const float3 co)
return result;
}
-/** Get radius of point. */
float GpencilIO::stroke_point_radius_get(bGPDlayer *gpl, bGPDstroke *gps)
{
bGPDspoint *pt = &gps->points[0];
@@ -338,7 +329,6 @@ bool GpencilIO::is_camera_mode()
return is_camera_;
}
-/* Calculate selected strokes boundbox. */
void GpencilIO::selected_objects_boundbox_calc()
{
const float gap = 10.0f;
diff --git a/source/blender/io/gpencil/intern/gpencil_io_base.hh b/source/blender/io/gpencil/intern/gpencil_io_base.hh
index 02758883f19..6437796648d 100644
--- a/source/blender/io/gpencil/intern/gpencil_io_base.hh
+++ b/source/blender/io/gpencil/intern/gpencil_io_base.hh
@@ -87,11 +87,16 @@ class GpencilIO {
float stroke_color_[4], fill_color_[4];
/* Geometry functions. */
+ /** Convert to screenspace. */
bool gpencil_3D_point_to_screen_space(const float3 co, float2 &r_co);
+ /** Convert to render space. */
float2 gpencil_3D_point_to_render_space(const float3 co);
+ /** Convert to 2D. */
float2 gpencil_3D_point_to_2D(const float3 co);
+ /** Get radius of point. */
float stroke_point_radius_get(struct bGPDlayer *gpl, struct bGPDstroke *gps);
+ /** Create a list of selected objects sorted from back to front */
void create_object_list();
bool is_camera_mode();
@@ -101,8 +106,13 @@ class GpencilIO {
void prepare_layer_export_matrix(struct Object *ob, struct bGPDlayer *gpl);
void prepare_stroke_export_colors(struct Object *ob, struct bGPDstroke *gps);
+ /* Calculate selected strokes boundbox. */
void selected_objects_boundbox_calc();
void selected_objects_boundbox_get(rctf *boundbox);
+ /**
+ * Set file input_text full path.
+ * \param filename: Path of the file provided by save dialog.
+ */
void filename_set(const char *filename);
private:
diff --git a/source/blender/io/gpencil/intern/gpencil_io_capi.cc b/source/blender/io/gpencil/intern/gpencil_io_capi.cc
index 95f5839682f..92ce165e059 100644
--- a/source/blender/io/gpencil/intern/gpencil_io_capi.cc
+++ b/source/blender/io/gpencil/intern/gpencil_io_capi.cc
@@ -177,7 +177,6 @@ static bool gpencil_io_export_frame_svg(GpencilExporterSVG *exporter,
}
#endif
-/* Main import entry point function. */
bool gpencil_io_import(const char *filename, GpencilIOParams *iparams)
{
GpencilImporterSVG importer = GpencilImporterSVG(filename, iparams);
@@ -185,7 +184,6 @@ bool gpencil_io_import(const char *filename, GpencilIOParams *iparams)
return gpencil_io_import_frame(&importer, *iparams);
}
-/* Main export entry point function. */
bool gpencil_io_export(const char *filename, GpencilIOParams *iparams)
{
Depsgraph *depsgraph_ = CTX_data_depsgraph_pointer(iparams->C);
diff --git a/source/blender/io/gpencil/intern/gpencil_io_export_pdf.cc b/source/blender/io/gpencil/intern/gpencil_io_export_pdf.cc
index 82f8444d43e..7539fba1343 100644
--- a/source/blender/io/gpencil/intern/gpencil_io_export_pdf.cc
+++ b/source/blender/io/gpencil/intern/gpencil_io_export_pdf.cc
@@ -109,7 +109,6 @@ bool GpencilExporterPDF::write()
return (res == 0) ? true : false;
}
-/* Create pdf document. */
bool GpencilExporterPDF::create_document()
{
pdf_ = HPDF_New(error_handler, nullptr);
@@ -120,7 +119,6 @@ bool GpencilExporterPDF::create_document()
return true;
}
-/* Add page. */
bool GpencilExporterPDF::add_page()
{
/* Add a new page object. */
@@ -136,7 +134,6 @@ bool GpencilExporterPDF::add_page()
return true;
}
-/* Main layer loop. */
void GpencilExporterPDF::export_gpencil_layers()
{
/* If is doing a set of frames, the list of objects can change for each frame. */
@@ -229,10 +226,6 @@ void GpencilExporterPDF::export_gpencil_layers()
}
}
-/**
- * Export a stroke using polyline or polygon
- * \param do_fill: True if the stroke is only fill
- */
void GpencilExporterPDF::export_stroke_to_polyline(bGPDlayer *gpl,
bGPDstroke *gps,
const bool is_stroke,
@@ -288,10 +281,6 @@ void GpencilExporterPDF::export_stroke_to_polyline(bGPDlayer *gpl,
HPDF_Page_GRestore(page_);
}
-/**
- * Set color.
- * \param do_fill: True if the stroke is only fill.
- */
void GpencilExporterPDF::color_set(bGPDlayer *gpl, const bool do_fill)
{
const float fill_opacity = fill_color_[3] * gpl->opacity;
diff --git a/source/blender/io/gpencil/intern/gpencil_io_export_pdf.hh b/source/blender/io/gpencil/intern/gpencil_io_export_pdf.hh
index 89d97f79783..18de321914c 100644
--- a/source/blender/io/gpencil/intern/gpencil_io_export_pdf.hh
+++ b/source/blender/io/gpencil/intern/gpencil_io_export_pdf.hh
@@ -45,20 +45,31 @@ class GpencilExporterPDF : public GpencilExporter {
protected:
private:
- /* PDF document. */
+ /** PDF document. */
HPDF_Doc pdf_;
- /* PDF page. */
+ /** PDF page. */
HPDF_Page page_;
+ /** Create PDF document. */
bool create_document();
+ /** Add page. */
bool add_page();
+ /** Main layer loop. */
void export_gpencil_layers();
+ /**
+ * Export a stroke using poly-line or polygon
+ * \param do_fill: True if the stroke is only fill
+ */
void export_stroke_to_polyline(bGPDlayer *gpl,
bGPDstroke *gps,
const bool is_stroke,
const bool do_fill,
const bool normalize);
+ /**
+ * Set color.
+ * \param do_fill: True if the stroke is only fill.
+ */
void color_set(bGPDlayer *gpl, const bool do_fill);
};
diff --git a/source/blender/io/gpencil/intern/gpencil_io_export_svg.cc b/source/blender/io/gpencil/intern/gpencil_io_export_svg.cc
index a9745415d40..09eac7a2813 100644
--- a/source/blender/io/gpencil/intern/gpencil_io_export_svg.cc
+++ b/source/blender/io/gpencil/intern/gpencil_io_export_svg.cc
@@ -97,7 +97,6 @@ bool GpencilExporterSVG::write()
return result;
}
-/* Create document header and main svg node. */
void GpencilExporterSVG::create_document_header()
{
/* Add a custom document declaration node. */
@@ -133,7 +132,6 @@ void GpencilExporterSVG::create_document_header()
main_node_.append_attribute("viewBox").set_value(viewbox.c_str());
}
-/* Main layer loop. */
void GpencilExporterSVG::export_gpencil_layers()
{
const bool is_clipping = is_camera_mode() && (params_.flag & GP_EXPORT_CLIP_CAMERA) != 0;
@@ -254,11 +252,6 @@ void GpencilExporterSVG::export_gpencil_layers()
}
}
-/**
- * Export a stroke using SVG path
- * \param node_gpl: Node of the layer.
- * \param do_fill: True if the stroke is only fill
- */
void GpencilExporterSVG::export_stroke_to_path(bGPDlayer *gpl,
bGPDstroke *gps,
pugi::xml_node node_gpl,
@@ -303,11 +296,6 @@ void GpencilExporterSVG::export_stroke_to_path(bGPDlayer *gpl,
node_gps.append_attribute("d").set_value(txt.c_str());
}
-/**
- * Export a stroke using polyline or polygon
- * \param node_gpl: Node of the layer.
- * \param do_fill: True if the stroke is only fill
- */
void GpencilExporterSVG::export_stroke_to_polyline(bGPDlayer *gpl,
bGPDstroke *gps,
pugi::xml_node node_gpl,
@@ -351,11 +339,6 @@ void GpencilExporterSVG::export_stroke_to_polyline(bGPDlayer *gpl,
node_gps.append_attribute("points").set_value(txt.c_str());
}
-/**
- * Set color SVG string for stroke
- * \param node_gps: Stroke node.
- * \param do_fill: True if the stroke is only fill.
- */
void GpencilExporterSVG::color_string_set(bGPDlayer *gpl,
bGPDstroke *gps,
pugi::xml_node node_gps,
@@ -392,16 +375,6 @@ void GpencilExporterSVG::color_string_set(bGPDlayer *gpl,
}
}
-/**
- * Create a SVG rectangle
- * \param node: Parent node
- * \param x: X location
- * \param y: Y location
- * \param width: width of the rectangle
- * \param height: Height of the rectangle
- * \param thickness: Thickness of the line
- * \param hexcolor: Color of the line
- */
void GpencilExporterSVG::add_rect(pugi::xml_node node,
float x,
float y,
@@ -422,15 +395,6 @@ void GpencilExporterSVG::add_rect(pugi::xml_node node,
}
}
-/**
- * Create SVG text
- * \param node: Parent node
- * \param x: X location
- * \param y: Y location
- * \param text: Text to include
- * \param size: Size of the text
- * \param hexcolor: Color of the text
- */
void GpencilExporterSVG::add_text(pugi::xml_node node,
float x,
float y,
@@ -448,7 +412,6 @@ void GpencilExporterSVG::add_text(pugi::xml_node node,
nodetxt.text().set(text.c_str());
}
-/** Convert a color to Hex value (#FFFFFF). */
std::string GpencilExporterSVG::rgb_to_hexstr(const float color[3])
{
uint8_t r = color[0] * 255.0f;
diff --git a/source/blender/io/gpencil/intern/gpencil_io_export_svg.hh b/source/blender/io/gpencil/intern/gpencil_io_export_svg.hh
index 6d8a0c2f6ac..b3175978072 100644
--- a/source/blender/io/gpencil/intern/gpencil_io_export_svg.hh
+++ b/source/blender/io/gpencil/intern/gpencil_io_export_svg.hh
@@ -42,6 +42,16 @@ class GpencilExporterSVG : public GpencilExporter {
bool write();
protected:
+ /**
+ * Create a SVG rectangle
+ * \param node: Parent node
+ * \param x: X location
+ * \param y: Y location
+ * \param width: width of the rectangle
+ * \param height: Height of the rectangle
+ * \param thickness: Thickness of the line
+ * \param hexcolor: Color of the line
+ */
static void add_rect(pugi::xml_node node,
float x,
float y,
@@ -50,6 +60,15 @@ class GpencilExporterSVG : public GpencilExporter {
float thickness,
std::string hexcolor);
+ /**
+ * Create SVG text
+ * \param node: Parent node
+ * \param x: X location
+ * \param y: Y location
+ * \param text: Text to include
+ * \param size: Size of the text
+ * \param hexcolor: Color of the text
+ */
static void add_text(pugi::xml_node node,
float x,
float y,
@@ -58,31 +77,49 @@ class GpencilExporterSVG : public GpencilExporter {
std::string hexcolor);
private:
- /* XML doc. */
+ /** XML doc. */
pugi::xml_document main_doc_;
- /* Main document node. */
+ /** Main document node. */
pugi::xml_node main_node_;
/** Frame node. */
pugi::xml_node frame_node_;
+ /** Create document header and main SVG node. */
void create_document_header();
+ /** Main layer loop. */
void export_gpencil_layers();
+ /**
+ * Export a stroke using SVG path
+ * \param node_gpl: Node of the layer.
+ * \param do_fill: True if the stroke is only fill
+ */
void export_stroke_to_path(struct bGPDlayer *gpl,
struct bGPDstroke *gps,
pugi::xml_node node_gpl,
const bool do_fill);
+ /**
+ * Export a stroke using poly-line or polygon
+ * \param node_gpl: Node of the layer.
+ * \param do_fill: True if the stroke is only fill
+ */
void export_stroke_to_polyline(struct bGPDlayer *gpl,
struct bGPDstroke *gps,
pugi::xml_node node_gpl,
const bool is_stroke,
const bool do_fill);
+ /**
+ * Set color SVG string for stroke
+ * \param node_gps: Stroke node.
+ * \param do_fill: True if the stroke is only fill.
+ */
void color_string_set(struct bGPDlayer *gpl,
struct bGPDstroke *gps,
pugi::xml_node node_gps,
const bool do_fill);
+ /** Convert a color to Hex value (#FFFFFF). */
std::string rgb_to_hexstr(const float color[3]);
};