imporve and expose follow curve offset

2.1.1

- added: follow curve show offset property in UI
- added: follow curve show clickable warning if object has non-zero location to reset location
- changed: created follow curve use `fixed offset`
gpv2
Pullusb 2022-11-15 18:36:21 +01:00
parent ef566c494f
commit bf30254871
4 changed files with 26 additions and 10 deletions

View File

@ -1,5 +1,11 @@
# Changelog
2.1.1
- added: follow curve show offset property in UI
- added: follow curve show clickable warning if object has non-zero location to reset location
- changed: created follow curve use `fixed offset`
2.1.0
- added: 3 actions buttons:

View File

@ -226,16 +226,24 @@ class GPTB_PT_anim_manager(Panel):
row = col.row(align=True)
# row.operator('object.create_follow_path_curve', text='Create Curve', icon='CURVE_BEZCURVE')
if context.object and context.object.type == 'CURVE' and context.mode in ('OBJECT', 'EDIT_CURVE'):
row.operator('object.object_from_curve', text='Back To Object', icon='LOOP_BACK')
if context.object:
if context.object.type == 'CURVE' and context.mode in ('OBJECT', 'EDIT_CURVE'):
row.operator('object.object_from_curve', text='Back To Object', icon='LOOP_BACK')
elif (follow_const := context.object.constraints.get('Follow Path')) and follow_const.target:
row.operator('object.edit_curve', text='Edit Curve', icon='OUTLINER_DATA_CURVE')
row.operator('object.remove_follow_path', text='', icon='X')
col.label(text=f'{context.object.name} -> {follow_const.target.name}', icon='CON_FOLLOWPATH')
elif (follow_const := context.object.constraints.get('Follow Path')) and follow_const.target:
row.operator('object.edit_curve', text='Edit Curve', icon='OUTLINER_DATA_CURVE')
row.operator('object.remove_follow_path', text='', icon='X')
col.label(text=f'{context.object.name} -> {follow_const.target.name}', icon='CON_FOLLOWPATH')
if follow_const.use_fixed_location:
col.prop(follow_const, 'offset_factor')
else:
col.prop(follow_const, 'offset')
if context.object.location.length != 0: # context.object.location[:] != (0,0,0):
col.operator('object.location_clear', text='Offseted Location! Reset', icon='ERROR')
# ? Check if object location is animated ? (can be intentional...)
else:
col.operator('object.create_follow_path_curve', text='Create Curve', icon='CURVE_BEZCURVE')
else:
col.operator('object.create_follow_path_curve', text='Create Follow Curve', icon='CURVE_BEZCURVE')
## This can go in an extra category...

View File

@ -4,7 +4,7 @@ bl_info = {
"name": "GP toolbox",
"description": "Tool set for Grease Pencil in animation production",
"author": "Samuel Bernou, Christophe Seux",
"version": (2, 1, 0),
"version": (2, 1, 1),
"blender": (3, 0, 0),
"location": "Sidebar (N menu) > Gpencil > Toolbox / Gpencil properties",
"warning": "",

View File

@ -1053,7 +1053,7 @@ def orentation_track_from_vector(input_vector) -> str:
return orient
def create_follow_path_constraint(ob, curve, follow_curve=False):
def create_follow_path_constraint(ob, curve, follow_curve=False, use_fixed_location=True):
'''return create constraint'''
# # Clear bone follow path constraint
exiting_fp_constraints = [c for c in ob.constraints if c.type == 'FOLLOW_PATH']
@ -1070,6 +1070,8 @@ def create_follow_path_constraint(ob, curve, follow_curve=False):
const.target = curve
if follow_curve:
const.use_curve_follow = True
if use_fixed_location:
const.use_fixed_location = True
return const
## on_bones: