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
parent
ef566c494f
commit
bf30254871
|
@ -1,5 +1,11 @@
|
||||||
# Changelog
|
# 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
|
2.1.0
|
||||||
|
|
||||||
- added: 3 actions buttons:
|
- added: 3 actions buttons:
|
||||||
|
|
24
UI_tools.py
24
UI_tools.py
|
@ -226,16 +226,24 @@ class GPTB_PT_anim_manager(Panel):
|
||||||
row = col.row(align=True)
|
row = col.row(align=True)
|
||||||
# row.operator('object.create_follow_path_curve', text='Create Curve', icon='CURVE_BEZCURVE')
|
# 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'):
|
if context.object:
|
||||||
row.operator('object.object_from_curve', text='Back To Object', icon='LOOP_BACK')
|
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:
|
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.edit_curve', text='Edit Curve', icon='OUTLINER_DATA_CURVE')
|
||||||
row.operator('object.remove_follow_path', text='', icon='X')
|
row.operator('object.remove_follow_path', text='', icon='X')
|
||||||
col.label(text=f'{context.object.name} -> {follow_const.target.name}', icon='CON_FOLLOWPATH')
|
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:
|
else:
|
||||||
col.operator('object.create_follow_path_curve', text='Create Curve', icon='CURVE_BEZCURVE')
|
col.operator('object.create_follow_path_curve', text='Create Follow Curve', icon='CURVE_BEZCURVE')
|
||||||
|
|
||||||
|
|
||||||
## This can go in an extra category...
|
## This can go in an extra category...
|
||||||
|
|
|
@ -4,7 +4,7 @@ bl_info = {
|
||||||
"name": "GP toolbox",
|
"name": "GP toolbox",
|
||||||
"description": "Tool set for Grease Pencil in animation production",
|
"description": "Tool set for Grease Pencil in animation production",
|
||||||
"author": "Samuel Bernou, Christophe Seux",
|
"author": "Samuel Bernou, Christophe Seux",
|
||||||
"version": (2, 1, 0),
|
"version": (2, 1, 1),
|
||||||
"blender": (3, 0, 0),
|
"blender": (3, 0, 0),
|
||||||
"location": "Sidebar (N menu) > Gpencil > Toolbox / Gpencil properties",
|
"location": "Sidebar (N menu) > Gpencil > Toolbox / Gpencil properties",
|
||||||
"warning": "",
|
"warning": "",
|
||||||
|
|
4
utils.py
4
utils.py
|
@ -1053,7 +1053,7 @@ def orentation_track_from_vector(input_vector) -> str:
|
||||||
|
|
||||||
return orient
|
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'''
|
'''return create constraint'''
|
||||||
# # Clear bone follow path constraint
|
# # Clear bone follow path constraint
|
||||||
exiting_fp_constraints = [c for c in ob.constraints if c.type == 'FOLLOW_PATH']
|
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
|
const.target = curve
|
||||||
if follow_curve:
|
if follow_curve:
|
||||||
const.use_curve_follow = True
|
const.use_curve_follow = True
|
||||||
|
if use_fixed_location:
|
||||||
|
const.use_fixed_location = True
|
||||||
return const
|
return const
|
||||||
|
|
||||||
## on_bones:
|
## on_bones:
|
||||||
|
|
Loading…
Reference in New Issue