Free Motion Capture for Everyone πβ¨
TypeScript
Trying to fix the 'recursively generation of FreeMoCap_Data folders' thing
Jon Matthis2bb588aa9e25
diff --git a/freemocap/fmc_startup/startup.py b/freemocap/fmc_startup/startup.pyindex 367ff7f7..e383f832 100644--- a/freemocap/fmc_startup/startup.py+++ b/freemocap/fmc_startup/startup.py@@ -13,8 +13,8 @@ def get_user_preferences(session,stage):"""load user preferences if they exist, create a new preferences yaml if they don't"""- here = Path(__file__).parent- preferences_path = here/'user_preferences.yaml'+ path_to_this_py_file = Path(__file__).parent+ preferences_path = path_to_this_py_file/'user_preferences.yaml'preferences_yaml = YAML()#check for a user preferences yaml, if it doesn't exist, build one using the default parameters in recordingconfig.py@@ -48,7 +48,6 @@ def get_data_folder_path(session):# 3) If no sessionID was user-input, search the chosen directory for the last session createdif session.setDataPath == True:session.basePath = startupGUI.RunChooseDataPathGUI(session)- session.basePath = Path(session.basePath)#sesh.dataFolderPath = Path(basePath)/sesh.dataFolderNameelif session.userDataPath is not None:@@ -57,17 +56,22 @@ def get_data_folder_path(session):else:try:current_path_to_data = session.preferences['saved']['path_to_save']- session.basePath = current_path_to_data+ session.basePath = Path(current_path_to_data)except KeyError:print('Saved Data path not found, please choose a new one')session.basePath = startupGUI.RunChooseDataPathGUI(session)session.preferences['saved']['path_to_save'] = str(session.basePath)session.save_user_preferences(session.preferences)-- dataFolder = Path(session.basePath)/session.dataFolderName++ if session.basePath.stem == session.dataFolderName: #don't recursively craete 'FreeMoCap_Data' folders!+ dataFolder = session.basePath+ else:+ dataFolder = session.basePath/session.dataFolderName+session.dataFolderPath = dataFolder-++if not dataFolder.exists():raise FileNotFoundError('No data folder located at: ' + str(dataFolder))diff --git a/freemocap/fmc_startup/startupGUI.py b/freemocap/fmc_startup/startupGUI.pyindex 9395244a..a43f2527 100644--- a/freemocap/fmc_startup/startupGUI.py+++ b/freemocap/fmc_startup/startupGUI.py@@ -161,7 +161,7 @@ def RunChooseDataPathGUI(session):chosenDataPath = setDataPathGUI(root, session)root.mainloop()- return chosenDataPath.dataPath+ return Path(chosenDataPath.dataPath)def RunChooseDLCPathGUI(session,saved_dlc_paths):diff --git a/freemocap/play_skeleton_animation.py b/freemocap/play_skeleton_animation.pyindex a5080ed2..cf9a0321 100644--- a/freemocap/play_skeleton_animation.py+++ b/freemocap/play_skeleton_animation.py@@ -69,6 +69,10 @@ def PlaySkeletonAnimation(useDLC=False,recordVid = True):++++######### ββ ββ ββββββ ββββββ βββββ ββββββββ βββββββ βββββββ ββ ββββββ ββ ββ ββββββ βββββββ@@ -259,9 +263,11 @@ def PlaySkeletonAnimation(xCurrTimeArtists[thisArtistKey][0].set_ydata(xCurrTimeYdata[thisArtistKey][frameNum] )yCurrTimeArtists[thisArtistKey][0].set_ydata(yCurrTimeYdata[thisArtistKey][frameNum] )-- # fig.suptitle("nSessionID: {}, Frame: {} of {}".format(session.sessionID, frameNum, numFrames), fontsize=10)- # animSlider.set_val(val=frameNum)+ # if recordVid:+ # thisFramePath = str(animationFramePath) + '/'+ str(session.sessionID) + "_frame_" + str(frameNum).zfill(6) + ".png"+ # plt.savefig(thisFramePath)+ # # fig.suptitle("nSessionID: {}, Frame: {} of {}".format(session.sessionID, frameNum, numFrames), fontsize=10)+ # # animSlider.set_val(val=frameNum)######## ββββββ ββββββ βββββββ βββββ ββββββββ βββββββ βββββββ ββ ββββββ ββ ββ ββββββ βββββββ@@ -526,7 +532,7 @@ def PlaySkeletonAnimation(# groundYY = np.zeros_like(groundXX)# groundMesh = ax3d.plot_surface(groundXX, groundZZ, groundYY, color='k', alpha=.5)- axRange = 500#session.board.square_length * 10+ axRange = 750#session.board.square_length * 10# Setting the axes propertiesax3d.set_xlim3d([mx-axRange, mx+axRange])@@ -808,6 +814,9 @@ def PlaySkeletonAnimation(if logoIm is not None: logoAx.imshow(cv2.cvtColor(logoIm, cv2.COLOR_BGR2RGB))logoAx.axis('off')+ # if recordVid:+ # animationFramePath = session.sessionPath / "animationFrames"+ # animationFramePath.mkdir(parents=True, exist_ok=True)# Creating the Animation objectline_animation = animation.FuncAnimation(fig, update_figure, range(startFrame,numFrames), fargs=(),diff --git a/freemocap_runme_script.py b/freemocap_runme_script.pyindex 104eb169..b6b94b4a 100644--- a/freemocap_runme_script.py+++ b/freemocap_runme_script.py@@ -1,3 +1,3 @@import freemocap as fmc-fmc.RunMe()+fmc.RunMe(sessionID = 'sesh_2021-10-19_18_40_12', stage=5, useOpenPose=True, setDataPath=False)