Changeset View
Changeset View
Standalone View
Standalone View
source/blender/io/gpencil/intern/gpencil_io_export_svg.cc
| Show First 20 Lines • Show All 285 Lines • ▼ Show 20 Lines | void GpencilExporterSVG::export_stroke_to_path(bGPDlayer *gpl, | ||||
| node_gps.append_attribute("stroke").set_value("none"); | node_gps.append_attribute("stroke").set_value("none"); | ||||
| std::string txt = "M"; | std::string txt = "M"; | ||||
| for (const int i : IndexRange(gps->totpoints)) { | for (const int i : IndexRange(gps->totpoints)) { | ||||
| if (i > 0) { | if (i > 0) { | ||||
| txt.append("L"); | txt.append("L"); | ||||
| } | } | ||||
| bGPDspoint &pt = gps->points[i]; | bGPDspoint &pt = gps->points[i]; | ||||
| const float2 screen_co = gpencil_3D_point_to_2D(&pt.x); | const float2 screen_co = gpencil_3D_point_to_2D(&pt.x, is_orthographic()); | ||||
| txt.append(std::to_string(screen_co.x) + "," + std::to_string(screen_co.y)); | txt.append(std::to_string(screen_co.x) + "," + std::to_string(screen_co.y)); | ||||
| } | } | ||||
| /* Close patch (cyclic)*/ | /* Close patch (cyclic)*/ | ||||
| if (gps->flag & GP_STROKE_CYCLIC) { | if (gps->flag & GP_STROKE_CYCLIC) { | ||||
| txt.append("z"); | txt.append("z"); | ||||
| } | } | ||||
| node_gps.append_attribute("d").set_value(txt.c_str()); | node_gps.append_attribute("d").set_value(txt.c_str()); | ||||
| Show All 35 Lines | void GpencilExporterSVG::export_stroke_to_polyline(bGPDlayer *gpl, | ||||
| } | } | ||||
| std::string txt; | std::string txt; | ||||
| for (const int i : IndexRange(gps->totpoints)) { | for (const int i : IndexRange(gps->totpoints)) { | ||||
| if (i > 0) { | if (i > 0) { | ||||
| txt.append(" "); | txt.append(" "); | ||||
| } | } | ||||
| bGPDspoint *pt = &gps->points[i]; | bGPDspoint *pt = &gps->points[i]; | ||||
| const float2 screen_co = gpencil_3D_point_to_2D(&pt->x); | const float2 screen_co = gpencil_3D_point_to_2D(&pt->x, is_orthographic()); | ||||
| txt.append(std::to_string(screen_co.x) + "," + std::to_string(screen_co.y)); | txt.append(std::to_string(screen_co.x) + "," + std::to_string(screen_co.y)); | ||||
| } | } | ||||
| node_gps.append_attribute("points").set_value(txt.c_str()); | node_gps.append_attribute("points").set_value(txt.c_str()); | ||||
| } | } | ||||
| /** | /** | ||||
| * Set color SVG string for stroke | * Set color SVG string for stroke | ||||
| ▲ Show 20 Lines • Show All 110 Lines • Show Last 20 Lines | |||||