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:
authorOmar Emara <mail@OmarEmara.dev>2021-02-20 19:05:13 +0300
committerOmar Emara <mail@OmarEmara.dev>2021-02-20 19:05:13 +0300
commitf2c0bbed1ce5270eee1332a02da02c1819bb230c (patch)
tree3bc309ba191cc1a4c81d3daa6e1b57fa987ef6a1 /source/blender/blenkernel/BKE_object.h
parent5dced2a0636a7f3db73be09139cf8abd952612e7 (diff)
Python: Add to_curve method to the object API
This patch adds a to_curve method to the Object ID. This method is analogous to the to_mesh method. The method can operate on curve and text objects. For text objects, the text is converted into a 3D Curve ID and that curve is returned. For curve objects, if apply_modifiers is true, the spline deform modifiers will be applied and a Curve ID with the result will be returned, otherwise a copy of the curve will be returned. The goal of this addition is to allow the developer to access the splines of text objects and to get the result of modifier applications which was otherwise not possible. Reviewed By: Brecht Differential Revision: https://developer.blender.org/D10354
Diffstat (limited to 'source/blender/blenkernel/BKE_object.h')
-rw-r--r--source/blender/blenkernel/BKE_object.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/source/blender/blenkernel/BKE_object.h b/source/blender/blenkernel/BKE_object.h
index 904db053717..12c40e891c9 100644
--- a/source/blender/blenkernel/BKE_object.h
+++ b/source/blender/blenkernel/BKE_object.h
@@ -32,6 +32,7 @@ extern "C" {
struct Base;
struct BoundBox;
+struct Curve;
struct Depsgraph;
struct GpencilModifierData;
struct HookGpencilModifierData;
@@ -424,6 +425,21 @@ struct Mesh *BKE_object_to_mesh(struct Depsgraph *depsgraph,
void BKE_object_to_mesh_clear(struct Object *object);
+/* This is an utility function for Python's object.to_curve().
+ * The result is owned by the object.
+ *
+ * The curve will be freed when object is re-evaluated or is destroyed. It is possible to force
+ * clear memory used by this curve by calling BKE_object_to_curve_clear().
+ *
+ * If apply_modifiers is true and the object is a curve one, then spline deform modifiers are
+ * applied on the curve control points.
+ */
+struct Curve *BKE_object_to_curve(struct Object *object,
+ struct Depsgraph *depsgraph,
+ bool apply_modifiers);
+
+void BKE_object_to_curve_clear(struct Object *object);
+
void BKE_object_check_uuids_unique_and_report(const struct Object *object);
void BKE_object_modifiers_lib_link_common(void *userData,