Example #1
0
def load_position(obj):
	'''Finds all of the positions for the selected object and applies them
	Args:
		obj (pm.PyNode): the object to apply to
	Returns (dict): position
	Usage:
		get_positions(pm.ls(sl=True)[0])
	'''
	#Current version folder nonsense
	folder = os.path.join( environ.POSITIONS, obj )
	versionFolder = lib_env.folder_detectVersions( folder, versionUp = False )
	if versionFolder:
		folder = versionFolder
	else:
		pm.warning('Folder does not exist')
	
	#Handling shit
	if os.path.exists(folder):
		os.chdir(folder)
		positions = []
		for file in glob.glob("*.pos"):
			position = import_position(file)
			print position
			pm.xform(obj, t=position['translate'], ro=position['rotate'], s=position['scale'], ws=True)
	else:
		pm.warning('Object: %s does not have any deformers available in folder: %s'%(obj,folder))
Example #2
0
def save_position(obj):
	'''stores position files for the curreitnnt object
	Args:
		obj (pm.PyNode): the object to get deformers from
	Returns (boolean): whether the export worked on not
	Usage:
		save_positionList(pm.ls(sl=True)[0])
	'''
	#Current version folder nonsense
	folder = os.path.join( environ.POSITIONS, obj )
	versionFolder = lib_env.folder_detectVersions( folder, versionUp=True )
	if versionFolder:
		folder = versionFolder
	else:
		folder = os.path.join(folder, 'v001')
	if not os.path.exists(folder):
		os.makedirs(folder)
		
	#File and export
	file = os.path.join(folder, obj+'.pos')
	export_position(file, obj)