migrate code to GPV3 (still problem with UV fill not set on point anymore)
This commit is contained in:
@@ -11,8 +11,8 @@ from .. constants import BGCOL, MODULE_DIR
|
||||
|
||||
## Plane conversion between multiple types: GP plane / image plane / empty references
|
||||
|
||||
def convert_background_image(ob, target = 'GPENCIL'):
|
||||
'''Target in ['GPENCIL', 'EMPTY', 'MESH']'''
|
||||
def convert_background_image(ob, target = 'GREASEPENCIL'):
|
||||
'''Target in ['GREASEPENCIL', 'EMPTY', 'MESH']'''
|
||||
|
||||
if target == ob.type:
|
||||
print('WARNING', f'{ob.name} Already of type {target}')
|
||||
@@ -49,7 +49,7 @@ def convert_background_image(ob, target = 'GPENCIL'):
|
||||
## TODO: ensure image filepath is ok ?
|
||||
|
||||
suffix = ''
|
||||
if target == 'GPENCIL':
|
||||
if target == 'GREASEPENCIL':
|
||||
## Create GP plane from Texture source
|
||||
new = core.import_image_as_gp_reference(
|
||||
image_data,
|
||||
@@ -122,9 +122,9 @@ class BPM_OT_convert_planes(Operator):
|
||||
bl_options = {"REGISTER"} # , "UNDO"
|
||||
|
||||
target_type : bpy.props.EnumProperty(
|
||||
name="Convert To", description="", default='GPENCIL', options={'ANIMATABLE'},
|
||||
name="Convert To", description="", default='GREASEPENCIL', options={'ANIMATABLE'},
|
||||
items=(
|
||||
('GPENCIL', 'Gpencil Object', 'Convert bg planes to gpencil objects', 0),
|
||||
('GREASEPENCIL', 'Gpencil Object', 'Convert bg planes to gpencil objects', 0),
|
||||
('EMPTY', 'Empty Reference', 'Convert bg planes to empty objects', 1),
|
||||
('MESH', 'Texture Plane', 'Convert bg planes to mesh objects', 2),
|
||||
))
|
||||
|
||||
@@ -240,9 +240,9 @@ class BPM_OT_align_to_plane(Operator):
|
||||
|
||||
for l in o.data.layers:
|
||||
for f in l.frames:
|
||||
for s in f.strokes:
|
||||
for s in f.drawing.strokes:
|
||||
for p in s.points:
|
||||
p.co = matrot @ p.co
|
||||
p.position = matrot @ p.position
|
||||
|
||||
return {"FINISHED"}
|
||||
|
||||
@@ -341,7 +341,7 @@ class BPM_OT_create_and_place_in_camera(Operator):
|
||||
|
||||
## Create Object
|
||||
prefs = core.get_addon_prefs()
|
||||
gp_data = bpy.data.grease_pencils.new(ob_name)
|
||||
gp_data = bpy.data.grease_pencils_v3.new(ob_name)
|
||||
ob = bpy.data.objects.new(ob_name, gp_data)
|
||||
ob.use_grease_pencil_lights = prefs.use_light
|
||||
gp_data.edit_line_color[3] = prefs.edit_line_opacity
|
||||
|
||||
Reference in New Issue
Block a user