Cleanup: move public doc-strings into headers for 'io/gpencil'
Ref T92709
This commit is contained in:
parent
3647a1e621
commit
cd4a7be5b2
Notes:
blender-bot
2023-02-14 09:48:25 +01:00
Referenced by issue #93854, Relocate doc-strings into public headers Referenced by issue #92709, Code Style: documentation at declaration or definition
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
};
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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]);
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue