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`
This commit is contained in:
Pullusb
2022-11-15 18:36:21 +01:00
parent ef566c494f
commit bf30254871
4 changed files with 26 additions and 10 deletions
+16 -8
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...