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+)
gpv2
Pullusb 2021-02-21 20:15:01 +01:00
parent fdbfaaa1e0
commit c9266b7efe
3 changed files with 20 additions and 2 deletions

View File

@ -59,6 +59,8 @@ def getMatrix (layer) :
return matrix.copy() return matrix.copy()
default_pt_uv_fill = Vector((0.5, 0.5))
def dump_gp_point(p, l, obj): def dump_gp_point(p, l, obj):
'''add properties of a given points to a dic and return it''' '''add properties of a given points to a dic and return it'''
pdic = {} pdic = {}
@ -76,7 +78,15 @@ def dump_gp_point(p, l, obj):
## get vertex color (long...) ## get vertex color (long...)
if p.vertex_color[:] != (0.0, 0.0, 0.0, 0.0): 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 return pdic
@ -342,6 +352,8 @@ def add_stroke(s, frame, layer, obj):
else: else:
setattr(ns.points[i], k, v) 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 ## patch pressure 2
# ns.points.foreach_set('pressure', pressure_flat_list) # ns.points.foreach_set('pressure', pressure_flat_list)

View File

@ -101,6 +101,12 @@ Panel in sidebar : 3D view > sidebar 'N' > Gpencil
## Changelog: ## 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: 1.0.0:
- Compatible with official grease pencil tools - Compatible with official grease pencil tools

View File

@ -15,7 +15,7 @@ bl_info = {
"name": "GP toolbox", "name": "GP toolbox",
"description": "Set of tools for Grease Pencil in animation production", "description": "Set of tools for Grease Pencil in animation production",
"author": "Samuel Bernou", "author": "Samuel Bernou",
"version": (1, 0, 0), "version": (1, 0, 1),
"blender": (2, 91, 0), "blender": (2, 91, 0),
"location": "sidebar (N menu) > Gpencil > Toolbox / Gpencil properties", "location": "sidebar (N menu) > Gpencil > Toolbox / Gpencil properties",
"warning": "", "warning": "",