<commit_before>#! python2

__author__		= '<EMAIL>'
__version__		= 'v1.0'


'''
create and constrain a locator to a vertex with an expression
'''


import maya.cmds as cmds


def	constrain_locator_to_vertex	():
	vertex		= cmds.ls(selection = True)[0]
	geo			= vertex[:vertex.rfind('.')]
	locator		= cmds.createNode('locator')
	locator		= cmds.listRelatives(locator, parent = True)[0]
	locator		= cmds.rename(locator, 'locator_vertexConstrained')
	#locator		= cmds.pickWalk (direction = 'up')[0]
	cmds.expression	(name = locator, string	='''
float $BBoxSize = '''	+	geo	+	'''.boundingBoxMinX;\n
$vertexWorldPos[3] = `pointPosition -world '''		+	vertex	+	'''`;\n'''	+
locator	+	'''.translateX = $vertexWorldPos[0];\n'''	+
locator	+	'''.translateY = $vertexWorldPos[1];\n'''	+
locator	+	'''.translateZ = $vertexWorldPos[2];'''	)<commit_msg>constrain loc to vtx update; pass functional test<commit_after>#! python2

__author__		= '<EMAIL>'


"""
create and constrain a locator
to a vertex with an expression
"""


import maya.cmds as cmds


def	constrain_locator_to_vertex	():
	vertex		= cmds.ls(selection = True)[0]
	geo			= vertex[:vertex.rfind('.')]
	locator		= cmds.createNode('locator')
	locator		= cmds.listRelatives(locator, parent = True)[0]
	locator		= cmds.rename(locator, 'locator_vertexConstrained')
	#locator		= cmds.pickWalk (direction = 'up')[0]
	cmds.expression	(name = locator, string	='''
float $BBoxSize = '''	+	geo	+	'''.boundingBoxMinX;\n
$vertexWorldPos = `pointPosition -world '''		+	vertex	+	'''`;\n'''	+
locator	+	'''.translateX = $vertexWorldPos[0];\n'''	+
locator	+	'''.translateY = $vertexWorldPos[1];\n'''	+
locator	+	'''.translateZ = $vertexWorldPos[2];'''	)
{'fraction_non_alphanumeric': 0.18478906714200832, 'fraction_numerical': 0.010101010101010102, 'mean_word_length': 4.99288256227758, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6169447', 'n_tokens_mistral': 681, 'n_tokens_neox': 668, 'n_words': 131}