[Bf-blender-cvs] [09818846108] greasepencil-object: GPencil: SVG Remove exporter

Antonio Vazquez noreply at git.blender.org
Fri Sep 27 23:36:58 CEST 2019


Commit: 098188461086c4cc3d2e5cf0b68b83ebfaff72d6
Author: Antonio Vazquez
Date:   Fri Sep 27 23:34:29 2019 +0200
Branches: greasepencil-object
https://developer.blender.org/rB098188461086c4cc3d2e5cf0b68b83ebfaff72d6

GPencil: SVG Remove exporter

This will be added in the future.

===================================================================

M	source/blender/editors/gpencil/CMakeLists.txt
M	source/blender/editors/gpencil/gpencil_intern.h
M	source/blender/editors/gpencil/gpencil_ops.c
D	source/blender/editors/gpencil/gpencil_svg.c
D	source/blender/editors/include/ED_svg.h
M	source/blender/editors/io/CMakeLists.txt
D	source/blender/editors/io/io_svg.c
D	source/blender/editors/io/io_svg.h

===================================================================

diff --git a/source/blender/editors/gpencil/CMakeLists.txt b/source/blender/editors/gpencil/CMakeLists.txt
index fb525f70d62..21f1801f7eb 100644
--- a/source/blender/editors/gpencil/CMakeLists.txt
+++ b/source/blender/editors/gpencil/CMakeLists.txt
@@ -57,7 +57,6 @@ set(SRC
   gpencil_select.c
   gpencil_undo.c
   gpencil_utils.c
-  gpencil_svg.c
 
   gpencil_intern.h
 )
diff --git a/source/blender/editors/gpencil/gpencil_intern.h b/source/blender/editors/gpencil/gpencil_intern.h
index ecc8175e63d..a8f8ec0e8c5 100644
--- a/source/blender/editors/gpencil/gpencil_intern.h
+++ b/source/blender/editors/gpencil/gpencil_intern.h
@@ -454,8 +454,6 @@ void GPENCIL_OT_frame_clean_loose(struct wmOperatorType *ot);
 
 void GPENCIL_OT_convert(struct wmOperatorType *ot);
 
-void GPENCIL_OT_export_svg(struct wmOperatorType *ot);
-
 enum {
   GP_STROKE_JOIN = -1,
   GP_STROKE_JOINCOPY = 1,
diff --git a/source/blender/editors/gpencil/gpencil_ops.c b/source/blender/editors/gpencil/gpencil_ops.c
index 8792208f92a..ce410f3e52d 100644
--- a/source/blender/editors/gpencil/gpencil_ops.c
+++ b/source/blender/editors/gpencil/gpencil_ops.c
@@ -274,8 +274,6 @@ void ED_operatortypes_gpencil(void)
 
   WM_operatortype_append(GPENCIL_OT_sculpt_paint);
 
-  WM_operatortype_append(GPENCIL_OT_export_svg);
-
   /* Editing (Buttons) ------------ */
 
   WM_operatortype_append(GPENCIL_OT_data_add);
diff --git a/source/blender/editors/gpencil/gpencil_svg.c b/source/blender/editors/gpencil/gpencil_svg.c
deleted file mode 100644
index 56950b3009c..00000000000
--- a/source/blender/editors/gpencil/gpencil_svg.c
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2011 Blender Foundation.
- * All rights reserved.
- */
-
-/** \file
- * \ingroup edgpencil
- */
-
-#include <stdlib.h>
-#include <string.h>
-
-#include "MEM_guardedalloc.h"
-
-#include "DNA_gpencil_types.h"
-#include "DNA_object_types.h"
-#include "DNA_listBase.h"
-#include "DNA_text_types.h"
-#include "DNA_scene_types.h"
-
-#include "BKE_context.h"
-#include "BKE_gpencil.h"
-#include "BKE_text.h"
-
-#include "DEG_depsgraph.h"
-
-#include "BKE_context.h"
-#include "BKE_gpencil.h"
-#include "BKE_report.h"
-
-#include "UI_interface.h"
-
-#include "WM_api.h"
-#include "WM_types.h"
-
-#include "ED_gpencil.h"
-#include "ED_select_utils.h"
-#include "ED_svg.h"
-
-static int gpencil_export_svg_exec(bContext *C, wmOperator *op)
-{
-  Object *gpobj = CTX_data_active_object(C);
-  bGPdata *gpd = gpobj->data;
-  bGPDlayer *gpl;
-
-  for (gpl = gpd->layers.first; gpl; gpl = gpl->next) {
-    Text *ta = BKE_text_add(CTX_data_main(C), "exported_svg");
-    ED_svg_data_from_gpencil(gpd, ta, gpl, CTX_data_scene(C)->r.cfra);
-  }
-
-  return OPERATOR_FINISHED;
-}
-
-static bool gpencil_export_svg_poll(bContext *C)
-{
-  Object *o = CTX_data_active_object(C);
-
-  if (o && o->type == OB_GPENCIL) {
-    return true;
-  }
-  return false;
-}
-
-void GPENCIL_OT_export_svg(wmOperatorType *ot)
-{
-  PropertyRNA *prop;
-  UNUSED_VARS(prop);
-
-  /* identifiers */
-  ot->name = "Export to SVG";
-  ot->description = "Export this GPencil object to a SVG file";
-  ot->idname = "GPENCIL_OT_export_svg";
-
-  /* callbacks */
-  ot->exec = gpencil_export_svg_exec;
-  ot->poll = gpencil_export_svg_poll;
-
-  /* properties */
-  /* Should have: facing, layer, visibility, file split... */
-}
diff --git a/source/blender/editors/include/ED_svg.h b/source/blender/editors/include/ED_svg.h
deleted file mode 100644
index 554133e3b50..00000000000
--- a/source/blender/editors/include/ED_svg.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2009 Blender Foundation.
- * All rights reserved.
- */
-
-/** \file
- * \ingroup editors
- */
-
-#ifndef __ED_SVG_H__
-#define __ED_SVG_H__
-
-
-bool ED_svg_data_from_gpencil(struct bGPdata* gpd, struct Text* ta, struct bGPDlayer* layer, int frame);
-
-#endif /* __ED_SVG_H__ */
diff --git a/source/blender/editors/io/CMakeLists.txt b/source/blender/editors/io/CMakeLists.txt
index 6797a029267..5a35b251d0c 100644
--- a/source/blender/editors/io/CMakeLists.txt
+++ b/source/blender/editors/io/CMakeLists.txt
@@ -39,13 +39,11 @@ set(SRC
   io_cache.c
   io_collada.c
   io_ops.c
-  io_svg.c
 
   io_alembic.h
   io_cache.h
   io_collada.h
   io_ops.h
-  io_svg.h
 )
 
 set(LIB
diff --git a/source/blender/editors/io/io_svg.c b/source/blender/editors/io/io_svg.c
deleted file mode 100644
index 61afd3d696c..00000000000
--- a/source/blender/editors/io/io_svg.c
+++ /dev/null
@@ -1,195 +0,0 @@
-/*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-/** \file
- * \ingroup editor/io
- */
-
-#include <stdlib.h>
-#include <string.h>
-
-#include "BLI_utildefines.h"
-#include "BLI_string.h"
-#include "BLI_string_utils.h"
-#include "BLI_listbase.h"
-#include "BLI_math.h"
-
-#include "BKE_text.h"
-#include "BKE_gpencil.h"
-
-#include "DNA_object_types.h"
-#include "DNA_gpencil_types.h"
-#include "DNA_scene_types.h"
-#include "DNA_screen_types.h"
-#include "DNA_text_types.h"
-
-#include "DEG_depsgraph.h"
-
-#include "MEM_guardedalloc.h"
-
-static void write_svg_head(Text *ta)
-{
-  BKE_text_write(ta, "<?xml version=\"1.0\" standalone=\"no\"?>\n");
-  BKE_text_write(ta,
-                 "<svg width=\"10\" height=\"10\" viewBox=\"-5 -5 10 10\" "
-                 "xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\">\n");
-}
-
-static void write_svg_end(Text *ta)
-{
-  BKE_text_write(ta, "</svg>");
-}
-
-typedef int(svg_get_path_callback)(void *iterator,
-                                   float *fill_rgba,
-                                   float *stroke_rgba,
-                                   float *stroke_width);
-typedef int(svg_get_node_callback)(void *iterator, float *x, float *y);
-
-#define FAC_255_COLOR3(color) \
-  ((int)(255 * color[0])), ((int)(255 * color[1])), ((int)(255 * color[2]))
-
-static void write_paths_from_callback(void *iterator,
-                                      Text *ta,
-                                      svg_get_path_callback get_path,
-                                      svg_get_node_callback get_node)
-{
-  int status;
-  float fill_color[3], stroke_color[3], stroke_width;
-  int fill_color_i[3], stroke_color_i[3];
-  UNUSED_VARS(status, stroke_color_i, fill_color_i);
-
-  float x, y;
-  char buf[128];
-  int first_in;
-  while (get_path(iterator, fill_color, stroke_color, &stroke_width)) {
-
-    /* beginning of a path item */
-    BKE_text_write(ta, "<path d=\"");
-
-    first_in = 1;
-    while (get_node(iterator, &x, &y)) {
-      sprintf(buf,
-              "%c %f %f\n",
-              first_in ? 'M' : 'L',
-              x,
-              y); /* Should handle closed stroke as well. */
-      BKE_text_write(ta, buf);
-      first_in = 0;
-    }
-
-    CLAMP3(fill_color, 0, 1);
-    CLAMP3(stroke_color, 0, 1);
-
-    /* end the path */
-    sprintf(buf,
-            "\" fill=\"#%02X%02X%02X\" stroke=\"#%02X%02X%02X\" stroke-width=\"%f\" />\n",
-            FAC_255_COLOR3(fill_color),
-            FAC_255_COLOR3(stroke_color),
-            stroke_width / 1000.0f);
-    BKE_text_write(ta, buf);
-  }
-}
-
-typedef struct GPencilSVGIterator {
-  bGPdata *gpd;
-  bGPDlayer *layer;
-  bGPDframe *frame;
-  bGPDstroke *stroke;
-  bGPDspoint *point;
-  int point_i;
-} GPencilSVGIterator;
-
-static int svg_gpencil_get_path_callback(GPencilSVGIterator *iterator,
-                                         float *fill_color,
-                                         float *stroke_color,
-                                         float *stroke_width)
-{
-  GPencilSVGIterator *sr = (GPencilSVGIterator *)iterator;
-  if (!sr->stroke) {
-    if (!sr->frame->strokes.first) {
-      return 0;
-    }
-    sr->stroke = sr->frame->strokes.first;
-  }
-  else {
-    sr->stroke = sr->stroke->next;
-    if (!sr->stroke) {
-      return 0;
-    }
-  }
-  *stroke_width = sr->stroke->thickness;
-
-  /* TODO: no material access yet */
-  zero_v3(fill_color);
-  zero_v3(stroke_color);
-  return 1;
-}
-
-static int svg_gpencil_get_node_callback(GPencilSVGIterator *iterator, float *x, 

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list