Пример #1
0
    def findSet(self, name='', quiet=False):
        ''' finds the set with name
			Params:
				name: name of set
				quiet: suppress dialogs
			Returns: FBSet/False
		'''
        if not name:
            if not quiet:
                moBuLogger.errorDialog("No name arg passed.")
            return False

        # get all sets
        allSets = self.scene.Sets
        if not allSets:
            if not quiet:
                moBuLogger.infoDialog("No sets found in scene.")
            return False

        # check sets for name
        for _set in allSets:
            if name == _set.Name:
                return _set

        # not found
        if not quiet:
            moBuLogger.infoDialog("No set found with name '%s'" % name)
        return False
Пример #2
0
	def findSet(self, name='', quiet=False):
		''' finds the set with name
			Params:
				name: name of set
				quiet: suppress dialogs
			Returns: FBSet/False
		'''
		if not name:
			if not quiet:
				moBuLogger.errorDialog("No name arg passed.")
			return False
			
		# get all sets
		allSets = self.scene.Sets
		if not allSets:
			if not quiet:
				moBuLogger.infoDialog("No sets found in scene.")
			return False

		# check sets for name
		for _set in allSets:
			if name == _set.Name:
				return _set
				
		# not found
		if not quiet:
			moBuLogger.infoDialog("No set found with name '%s'" % name)
		return False
Пример #3
0
	def findSetFromObject(self, pObject='', quiet=False):
		''' finds the set that an object is in
			Params:
				pObject: object to look for
				quiet: suppress dialogs
			Returns: FBSet/False
		'''
		# get all sets
		allSets = self.scene.Sets
		
		# check for string
		if isinstance(pObject, str):
			pObject = self.getObject(name=pObject, pyMB=False, exact=False, quiet=quiet)
			if not pObject:
				if not quiet:
					moBuLogger.infoDialog("No valid object passed.")
				return False
		
		if not allSets:
			if not quiet:
				moBuLogger.infoDialog("No sets found in scene.")
			return False

		# check sets
		for _set in allSets:
			if self.isInSet(pObject=pObject, pSet=_set):
				moBuLogger.info("Found '%s' in set '%s'" % (pObject.Name, _set.Name))
				return _set
		
		# not found
		if not quiet:
			moBuLogger.infoDialog("'%s' not found in any sets" % pObject.Name)
		return False
Пример #4
0
    def findSetFromObject(self, pObject='', quiet=False):
        ''' finds the set that an object is in
			Params:
				pObject: object to look for
				quiet: suppress dialogs
			Returns: FBSet/False
		'''
        # get all sets
        allSets = self.scene.Sets

        # check for string
        if isinstance(pObject, str):
            pObject = self.getObject(name=pObject,
                                     pyMB=False,
                                     exact=False,
                                     quiet=quiet)
            if not pObject:
                if not quiet:
                    moBuLogger.infoDialog("No valid object passed.")
                return False

        if not allSets:
            if not quiet:
                moBuLogger.infoDialog("No sets found in scene.")
            return False

        # check sets
        for _set in allSets:
            if self.isInSet(pObject=pObject, pSet=_set):
                moBuLogger.info("Found '%s' in set '%s'" %
                                (pObject.Name, _set.Name))
                return _set

        # not found
        if not quiet:
            moBuLogger.infoDialog("'%s' not found in any sets" % pObject.Name)
        return False
Пример #5
0
    def addAllToSet(self, name='', quiet=False):
        ''' finds the set with name
			Params:
				name: name of set
				quiet: suppress dialogs
			Returns: FBSet/False
		'''
        ourSet = None

        # type or select set name if not passed
        if not name:
            # check for selected set
            selected = self.getSelected(_type=FBSet, found=True)
            if selected:
                # test type
                if isinstance(selected, FBSet):
                    ourSet = selected
            else:
                # spawn dialogue listing choices
                self.addAllToSetUI()
                return False
        else:
            # check for set existence
            if self.findSet(name=name, quiet=quiet):
                ourSet = self.findSet(name=name, quiet=quiet)
            else:
                # create set
                ourSet = FBSet(name)


#		count = 0
#		allItems = []
#
#		modelSkeletons = self.getAllByType(_type='FBModelSkeleton')
#		allItems.extend(modelSkeletons)
#
#		models = self.getAllByType(_type='FBModel')
#		allItems.extend(models)
#
#		modelNulls = self.getAllByType(_type='FBModelNull')
#		allItems.extend(modelNulls)
#		materials = self.getAllByType(_type='FBMaterial')
#		allItems.extend(materials)
#		textures = self.getAllByType(_type='FBTexture')
#		allItems.extend(textures)
#
#		deformers = self.getAllByType(_type='FBDeformer')
#		allItems.extend(deformers)
#		constraintRelation = self.getAllByType(_type='FBConstraintRelation')
#		allItems.extend(constraintRelation)
#		groups = self.getAllByType(_type='FBGroup')
#		allItems.extend(groups)
#		poses = self.getAllByType(_type='FBPose')
#		allItems.extend(poses)
#		vidClips = self.getAllByType(_type='FBVideoClipImage')
#		allItems.extend(vidClips)
#		characters = self.getAllByType(_type='FBCharacter')
#		allItems.extend(characters)
#
#		for item in allItems:
#			ourSet.Items.append(item)
#			count+=1

        count = 0
        allItems = self.getAllByType(_type='all')
        for item in allItems:

            # skip Sets
            if isinstance(item, FBSet):
                continue

            # safe to add
            ourSet.Items.append(item)
            count += 1

        if not quiet:
            moBuLogger.infoDialog(
                "%d items added to Set '%s'" % (count, ourSet.Name),
                "Set Created")
        else:
            moBuLogger.info("%d items added to Set '%s'" %
                            (count, ourSet.Name))

        return ourSet
Пример #6
0
	def addAllToSet(self, name='', quiet=False):
		''' finds the set with name
			Params:
				name: name of set
				quiet: suppress dialogs
			Returns: FBSet/False
		'''
		ourSet = None
		
		# type or select set name if not passed
		if not name:
			# check for selected set
			selected = self.getSelected(_type=FBSet, found=True)
			if selected:
				# test type
				if isinstance(selected, FBSet):
					ourSet = selected
			else:
				# spawn dialogue listing choices
				self.addAllToSetUI()
				return False
		else:
			# check for set existence
			if self.findSet(name=name, quiet=quiet):
				ourSet = self.findSet(name=name, quiet=quiet)
			else:
				# create set
				ourSet = FBSet(name)
			
#		count = 0
#		allItems = []
#		
#		modelSkeletons = self.getAllByType(_type='FBModelSkeleton')
#		allItems.extend(modelSkeletons)
#		
#		models = self.getAllByType(_type='FBModel')
#		allItems.extend(models)
#		
#		modelNulls = self.getAllByType(_type='FBModelNull')
#		allItems.extend(modelNulls)
#		materials = self.getAllByType(_type='FBMaterial')
#		allItems.extend(materials)
#		textures = self.getAllByType(_type='FBTexture')
#		allItems.extend(textures)
#		
#		deformers = self.getAllByType(_type='FBDeformer')
#		allItems.extend(deformers)
#		constraintRelation = self.getAllByType(_type='FBConstraintRelation')
#		allItems.extend(constraintRelation)
#		groups = self.getAllByType(_type='FBGroup')
#		allItems.extend(groups)
#		poses = self.getAllByType(_type='FBPose')
#		allItems.extend(poses)
#		vidClips = self.getAllByType(_type='FBVideoClipImage')
#		allItems.extend(vidClips)
#		characters = self.getAllByType(_type='FBCharacter')
#		allItems.extend(characters)
#		
#		for item in allItems:
#			ourSet.Items.append(item)
#			count+=1
		
		count = 0
		allItems = self.getAllByType(_type='all')
		for item in allItems:
								
			# skip Sets
			if isinstance(item, FBSet):
				continue
				
			# safe to add
			ourSet.Items.append(item)
			count += 1
			
		if not quiet:
			moBuLogger.infoDialog("%d items added to Set '%s'" % (count, ourSet.Name), "Set Created")
		else:
			moBuLogger.info("%d items added to Set '%s'" % (count, ourSet.Name))
		
		return ourSet