[Bf-blender-cvs] [a36e2a9b649] master: Gpencil: Expose stroke and point time properties to API

Amelie Fondevilla noreply at git.blender.org
Tue Jan 24 12:43:49 CET 2023


Commit: a36e2a9b649eef7b21541bb397555b7d6eb6bd6d
Author: Amelie Fondevilla
Date:   Tue Jan 24 11:57:49 2023 +0100
Branches: master
https://developer.blender.org/rBa36e2a9b649eef7b21541bb397555b7d6eb6bd6d

Gpencil: Expose stroke and point time properties to API

Two properties are now exposed in python API :
time of each point, and inittime of each stroke.

Reviewed by: Antonio Vazquez

Differential Revision: https://developer.blender.org/D17104

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

M	source/blender/makesrna/intern/rna_gpencil.c

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

diff --git a/source/blender/makesrna/intern/rna_gpencil.c b/source/blender/makesrna/intern/rna_gpencil.c
index a9dc4f4dc12..544a7f73cab 100644
--- a/source/blender/makesrna/intern/rna_gpencil.c
+++ b/source/blender/makesrna/intern/rna_gpencil.c
@@ -1275,6 +1275,11 @@ static void rna_def_gpencil_stroke_point(BlenderRNA *brna)
   RNA_def_property_ui_text(prop, "Select", "Point is selected for viewport editing");
   RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
 
+  prop = RNA_def_property(srna, "time", PROP_FLOAT, PROP_TIME);
+  RNA_def_property_float_sdna(prop, NULL, "time");
+  RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+  RNA_def_property_ui_text(prop, "Time", "Time relative to stroke start");
+
   /* Vertex color. */
   prop = RNA_def_property(srna, "vertex_color", PROP_FLOAT, PROP_COLOR);
   RNA_def_property_float_sdna(prop, NULL, "vert_color");
@@ -1748,6 +1753,12 @@ static void rna_def_gpencil_stroke(BlenderRNA *brna)
   prop = RNA_def_property(srna, "select_index", PROP_INT, PROP_NONE);
   RNA_def_property_int_sdna(prop, NULL, "select_index");
   RNA_def_property_ui_text(prop, "Select Index", "Index of selection used for interpolation");
+
+  /* Init time */
+  prop = RNA_def_property(srna, "init_time", PROP_FLOAT, PROP_TIME);
+  RNA_def_property_float_sdna(prop, NULL, "inittime");
+  RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+  RNA_def_property_ui_text(prop, "Init Time", "Initial time of the stroke");
 }
 
 static void rna_def_gpencil_strokes_api(BlenderRNA *brna, PropertyRNA *cprop)



More information about the Bf-blender-cvs mailing list