From c9266b7efe71679647ef3b5d96b79f123bd32a12 Mon Sep 17 00:00:00 2001 From: Pullusb Date: Sun, 21 Feb 2021 20:15:01 +0100 Subject: [PATCH] fix: brushed strokes copy-paste 1.0.1: - fix: copy paste problems - Get points uv_properties (used for brushed points) - Trigger an update on each pasted strokes, recalculate badly drawn uv and fills (works in 2.93+) --- OP_copy_paste.py | 14 +++++++++++++- README.md | 6 ++++++ __init__.py | 2 +- 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/OP_copy_paste.py b/OP_copy_paste.py index 4fa6a96..1fafa6e 100644 --- a/OP_copy_paste.py +++ b/OP_copy_paste.py @@ -59,6 +59,8 @@ def getMatrix (layer) : return matrix.copy() +default_pt_uv_fill = Vector((0.5, 0.5)) + def dump_gp_point(p, l, obj): '''add properties of a given points to a dic and return it''' pdic = {} @@ -76,7 +78,15 @@ def dump_gp_point(p, l, obj): ## get vertex color (long...) if p.vertex_color[:] != (0.0, 0.0, 0.0, 0.0): - pdic['vertex_color'] = convertAttr(getattr(p,'vertex_color')) + pdic['vertex_color'] = convertAttr(p.vertex_color) + + ## UV attr (maybe uv fill is always (0.5,0.5) ? also exists at stroke level...) + if p.uv_fill != default_pt_uv_fill: + pdic['uv_fill'] = convertAttr(p.uv_fill) + if p.uv_factor != 0.0: + pdic['uv_factor'] = convertAttr(p.uv_factor) + if p.uv_rotation != 0.0: + pdic['uv_rotation'] = convertAttr(p.uv_rotation) return pdic @@ -342,6 +352,8 @@ def add_stroke(s, frame, layer, obj): else: setattr(ns.points[i], k, v) + ## trigger updapte (in 2.93 fix some drawing problem with fills and UVs) + ns.points.update() ## patch pressure 2 # ns.points.foreach_set('pressure', pressure_flat_list) diff --git a/README.md b/README.md index 256763d..477ef95 100644 --- a/README.md +++ b/README.md @@ -101,6 +101,12 @@ Panel in sidebar : 3D view > sidebar 'N' > Gpencil ## Changelog: +1.0.1: + +- fix: copy paste problems + - Get points uv_properties (used for brushed points) + - Trigger an update on each pasted strokes, recalculate badly drawn uv and fills (works in 2.93+) + 1.0.0: - Compatible with official grease pencil tools diff --git a/__init__.py b/__init__.py index 9431cc7..8b46525 100644 --- a/__init__.py +++ b/__init__.py @@ -15,7 +15,7 @@ bl_info = { "name": "GP toolbox", "description": "Set of tools for Grease Pencil in animation production", "author": "Samuel Bernou", -"version": (1, 0, 0), +"version": (1, 0, 1), "blender": (2, 91, 0), "location": "sidebar (N menu) > Gpencil > Toolbox / Gpencil properties", "warning": "",