Example #1
0
def dump(fileHandle, groups):
    '''Look through the Massive scene and dump to fileHandle, in .mas format,
	   all of the Groups specified by 'groups' as well as their Locators.
	'''
    # The MasSpec object is an intermediary data format
    # which MasWriter/MasReader write from and read to
    mas = MasSpec.MasSpec()
    for name in groups:
        # Find the named Massive Group
        group = massive.find_group(name)
        if not group:
            continue
        id = len(mas.groups)
        mas.groups.append(MasSpec.Group(id, name))

        # Add each of the Group's locators to the MasSpec
        for i in range(group.n_locator):
            locator = group.get_locator(i)
            position = (locator.px, locator.py, locator.pz)
            mas.locators.append(MasSpec.Locator(id, position))
    # Dump the data to fileHandle
    MasWriter.write(fileHandle, mas)
Example #2
0
def dump( fileHandle, groups ):
	'''Look through the Massive scene and dump to fileHandle, in .mas format,
	   all of the Groups specified by 'groups' as well as their Locators.
	'''
	# The MasSpec object is an intermediary data format
	# which MasWriter/MasReader write from and read to
	mas = MasSpec.MasSpec()
	for name in groups:
		# Find the named Massive Group
		group = massive.find_group(name)
		if not group:
			continue
		id = len(mas.groups)
		mas.groups.append(MasSpec.Group(id, name))
		
		# Add each of the Group's locators to the MasSpec
		for i in range(group.n_locator):
			locator = group.get_locator(i)
			position = (locator.px, locator.py, locator.pz)
			mas.locators.append(MasSpec.Locator(id, position))
	# Dump the data to fileHandle
	MasWriter.write(fileHandle, mas)
def dump(fileHandle):
    '''	Look through the Maya scene and dump to fileHandle, in .mas format,
	   	any Maya objects that represent Massive entitities. For now only
	   	Massive groups and locators are supported.'''

    factory = MayaFactory.MayaFactory()

    # Massive groups are represented by Maya sets of the same
    # name stored in the "massive_groups" set. If no "massive_groups" set
    # exists, bail.
    groupsSet = factory.getGroupsSet(False)

    # Get a list of all Massive groups
    groups = mc.sets(groupsSet, query=True)
    if not groups:
        groups = []
    # This MasSpec object will be populated with the Massive
    # setup data and written to 'fileHandle'
    mas = MasSpec.MasSpec()

    groupId = 0
    for group in groups:
        mas.groups.append(MasSpec.Group(groupId, group))
        # Get all the Massive locators in 'group'
        locators = mc.sets(group, query=True)
        if not locators:
            locators = []
        for locator in locators:
            # Get the locator world space position
            position = mc.xform(locator,
                                query=True,
                                translation=True,
                                worldSpace=True)
            mas.locators.append(MasSpec.Locator(groupId, position))
        groupId += 1

    # Write the Massive setup information to 'fileHandle'
    MasWriter.write(fileHandle, mas)
Example #4
0
def dump( fileHandle ):
	'''	Look through the Maya scene and dump to fileHandle, in .mas format,
	   	any Maya objects that represent Massive entitities. For now only
	   	Massive groups and locators are supported.'''
	   
	factory = MayaFactory.MayaFactory()
	   
	# Massive groups are represented by Maya sets of the same
	# name stored in the "massive_groups" set. If no "massive_groups" set
	# exists, bail.
	groupsSet = factory.getGroupsSet(False)

	# Get a list of all Massive groups
	groups = mc.sets( groupsSet, query=True )
	if not groups:
		groups = []
	# This MasSpec object will be populated with the Massive
	# setup data and written to 'fileHandle'
	mas = MasSpec.MasSpec()

	groupId = 0
	for group in groups:
		mas.groups.append( MasSpec.Group( groupId, group ) )
		# Get all the Massive locators in 'group'
		locators = mc.sets( group, query=True )
		if not locators:
			locators = []
		for locator in locators:
			# Get the locator world space position
			position = mc.xform( locator,
								 query=True,
								 translation=True,
								 worldSpace=True )
			mas.locators.append( MasSpec.Locator( groupId, position ) )
		groupId += 1
		
	# Write the Massive setup information to 'fileHandle'
	MasWriter.write( fileHandle, mas )