mirror of
https://github.com/CopterExpress/clever-show.git
synced 2026-05-27 07:29:33 +00:00
animation_lib: add get_start_xy function
This commit is contained in:
@@ -37,9 +37,43 @@ def get_id(filepath="animation.csv"):
|
||||
anim_id = row_0[0]
|
||||
print("Got animation_id: {}".format(anim_id))
|
||||
else:
|
||||
anim_id = "Empty id"
|
||||
print("No animation id in file")
|
||||
return anim_id
|
||||
|
||||
def get_start_xy(filepath="animation.csv"):
|
||||
try:
|
||||
animation_file = open(filepath)
|
||||
except IOError:
|
||||
logging.error("File {} can't be opened".format(filepath))
|
||||
anim_id = "No animation"
|
||||
return float('nan'), float('nan')
|
||||
else:
|
||||
with animation_file:
|
||||
csv_reader = csv.reader(
|
||||
animation_file, delimiter=',', quotechar='|'
|
||||
)
|
||||
try:
|
||||
row_0 = csv_reader.next()
|
||||
except:
|
||||
return float('nan'), float('nan')
|
||||
if len(row_0) == 1:
|
||||
anim_id = row_0[0]
|
||||
print("Got animation_id: {}".format(anim_id))
|
||||
try:
|
||||
frame_number, x, y, z, yaw, red, green, blue = csv_reader.next()
|
||||
except:
|
||||
return float('nan'), float('nan')
|
||||
else:
|
||||
anim_id = "Empty id"
|
||||
print("No animation id in file")
|
||||
try:
|
||||
frame_number, x, y, z, yaw, red, green, blue = row_0
|
||||
except:
|
||||
return float('nan'), float('nan')
|
||||
return float(x), float(y)
|
||||
|
||||
|
||||
def load_animation(filepath="animation.csv", x0=0, y0=0, z0=0, x_ratio=1, y_ratio=1, z_ratio=1):
|
||||
imported_frames = []
|
||||
global anim_id
|
||||
|
||||
Reference in New Issue
Block a user