[Bf-blender-cvs] [00c41c607b6] greasepencil-object: GPencil: Replace Frame Offset by Target Frame

Antonio Vazquez noreply at git.blender.org
Fri Apr 3 15:49:10 CEST 2020


Commit: 00c41c607b6fab2ac648c412757e86ef8a548408
Author: Antonio Vazquez
Date:   Fri Apr 3 15:48:55 2020 +0200
Branches: greasepencil-object
https://developer.blender.org/rB00c41c607b6fab2ac648c412757e86ef8a548408

GPencil: Replace Frame Offset by Target Frame

Also some UI changes

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

M	release/scripts/startup/bl_operators/gpencil_mesh_bake.py
M	source/blender/blenkernel/intern/gpencil_geom.c
M	source/blender/editors/gpencil/gpencil_mesh.c

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

diff --git a/release/scripts/startup/bl_operators/gpencil_mesh_bake.py b/release/scripts/startup/bl_operators/gpencil_mesh_bake.py
index ee1a525d25a..f630a9cf2ca 100644
--- a/release/scripts/startup/bl_operators/gpencil_mesh_bake.py
+++ b/release/scripts/startup/bl_operators/gpencil_mesh_bake.py
@@ -70,16 +70,6 @@ class GPENCIL_OT_mesh_bake(Operator):
         min=1, max=100,
         default=1,
     )
-    seams: BoolProperty(
-        name="Only Seam Edges",
-        description="Convert only seam edges",
-        default=False,
-    )
-    faces: BoolProperty(
-        name="Export Faces",
-        description="Export faces as filled strokes",
-        default=True,
-    )
     angle: FloatProperty(
         name="Threshold Angle",
         description="Threshold to determine ends of the strokes",
@@ -99,16 +89,26 @@ class GPENCIL_OT_mesh_bake(Operator):
         subtype='DISTANCE',
         unit='LENGTH',
     )
+    seams: BoolProperty(
+        name="Only Seam Edges",
+        description="Convert only seam edges",
+        default=False,
+    )
+    faces: BoolProperty(
+        name="Export Faces",
+        description="Export faces as filled strokes",
+        default=True,
+    )
     target: EnumProperty(
         name="Target Object",
         description="Grease Pencil Object",
         items=my_objlist_callback
         )
-    frame_offset: IntProperty(
-        name="Frame Offset",
-        description="Number of frames to offset in target object",
-        min=-100, max=100,
-        default=0,
+    frame_target: IntProperty(
+        name="Target Frame",
+        description="Destination frame for the baked animation",
+        min=1, max=300000,
+        default=1,
     )
 
     @classmethod
@@ -129,7 +129,7 @@ class GPENCIL_OT_mesh_bake(Operator):
             faces=self.faces,
             offset=self.offset,
             target=self.target,
-            frame_offset=self.frame_offset
+            frame_target=self.frame_target
         )
 
         return {'FINISHED'}
@@ -138,6 +138,7 @@ class GPENCIL_OT_mesh_bake(Operator):
         scene = context.scene
         self.frame_start = scene.frame_start
         self.frame_end = scene.frame_end
+        self.frame_target = scene.frame_start
 
         wm = context.window_manager
         return wm.invoke_props_dialog(self)
diff --git a/source/blender/blenkernel/intern/gpencil_geom.c b/source/blender/blenkernel/intern/gpencil_geom.c
index 94ef4e03d86..37d6ea8e358 100644
--- a/source/blender/blenkernel/intern/gpencil_geom.c
+++ b/source/blender/blenkernel/intern/gpencil_geom.c
@@ -2215,6 +2215,7 @@ static void gpencil_generate_edgeloops(Object *ob,
  * \param thickness: Thickness of the strokes.
  * \param offset: Offset along the normals.
  * \param matrix: Transformation matrix.
+ * \param frame_offset: Destination frame number offset.
  * \param use_seams: Only export seam edges.
  * \param use_faces: Export faces as filled strokes.
  */
diff --git a/source/blender/editors/gpencil/gpencil_mesh.c b/source/blender/editors/gpencil/gpencil_mesh.c
index df8d28c2df2..a01ecf6399c 100644
--- a/source/blender/editors/gpencil/gpencil_mesh.c
+++ b/source/blender/editors/gpencil/gpencil_mesh.c
@@ -113,7 +113,7 @@ static int gp_bake_mesh_animation_exec(bContext *C, wmOperator *op)
   const bool use_seams = RNA_boolean_get(op->ptr, "seams");
   const bool use_faces = RNA_boolean_get(op->ptr, "faces");
   const float offset = RNA_float_get(op->ptr, "offset");
-  const int frame_offset = RNA_int_get(op->ptr, "frame_offset");
+  const int frame_offset = RNA_int_get(op->ptr, "frame_target") - frame_start;
   char target[64];
   RNA_string_get(op->ptr, "target", target);
 
@@ -233,7 +233,7 @@ void GPENCIL_OT_bake_mesh_animation(wmOperatorType *ot)
   RNA_def_boolean(ot->srna, "faces", 1, "Export Faces", "Export faces as filled strokes");
   RNA_def_float_distance(
       ot->srna, "offset", 0.001f, 0.0, 100.0, "Offset", "Offset strokes from fill", 0.0, 100.00);
-  RNA_def_int(ot->srna, "frame_offset", 0, -1000, 1000, "Frame Offset", "", -1000, 1000);
+  RNA_def_int(ot->srna, "frame_target", 1, 1, 100000, "Frame Target", "", 1, 100000);
   RNA_def_string(ot->srna,
                  "target",
                  "Target",



More information about the Bf-blender-cvs mailing list