示例#1
0
 def saveCurrentLightProperty(self, propSet):
     for obj in self._nativeObjects():
         if mxs.classOf(obj) == mxs.VRayLight:
             if propSet.value('primaryVisibility'):
                 so = SceneObject(self._scene, obj)
                 so.userProps()['previousInvisibleState'] = obj.invisible
                 obj.invisible = True
示例#2
0
	def saveCurrentLightProperty(self, propSet):
		for obj in self._nativeObjects():
			if mxs.classOf(obj) == mxs.VRayLight:
				if propSet.value('primaryVisibility'):
					so = SceneObject(self._scene, obj)
					so.userProps()['previousInvisibleState'] = obj.invisible
					obj.invisible = True
示例#3
0
	def _nativeObjects(self, getsFromSelection=False, wildcard='', objectType=0):
		"""
			\remarks	implements the AbstractScene._nativeObjects method to return the native objects from the scene
			\return		<list> [ <PySoftimage.xsi.X3DObject> nativeObject, .. ] || None
		"""

		# TODO: Needs to be severely optimzed. Make sure we can use regular expression for wildcard.
		# nativeType = SceneObject._abstractToNativeObjectType.get(type)

		if getsFromSelection:
			if wildcard:
				import re
				expression = wildcard.replace('*', '.+').strip('.+')
				output = []
				for obj in xsi.Selection:
					if re.findall(expression, obj.FullName, flags=re.I):
						output.append(obj)
				objects = output
			else:
				objects = [ obj for obj in xsi.Selection ]
		else:
			root = self._nativeRootObject()
			objects = root.FindChildren(wildcard, '', '', True)

		if objectType:
			holder = []
			from cross3d import SceneObject
			for obj in objects:
				if SceneObject._typeOfNativeObject(obj) == objectType:
					holder.append(obj)
			objects = holder

		return objects
    def objects(self):
        """Return a list of the objects that are part of this layer group

		:return: list of :class:`cross3d.SceneObject`'s

		"""
        from cross3d import SceneObject
        return [SceneObject(self._scene, obj) for obj in self._nativeObjects()]
示例#5
0
	def _objects(self, getsFromSelection=False, wildcard='', type=0):
		""" Returns a list of all the objects in the scene wrapped as api objects
			:param: getsFromSelection <bool>
			:param: wildcard <string>
			:param: type <cross3d.constants.ObjectType>
			:return: <list> [ <cross3d.Variant>, .. ]
		"""
		from cross3d import SceneObject
		return [SceneObject(self, obj) for obj in self._nativeObjects(getsFromSelection, wildcard, type) if obj.apiType() != om.MFn.kWorld]
示例#6
0
    def objects(self):
        """
		Returns the SceneObject's that are associated with this object group
		
		:return: a list of :class:`cross3d.SceneObject` objects
		
		"""
        from cross3d import SceneObject
        return [SceneObject(self._scene, obj) for obj in self._nativeObjects()]
示例#7
0
    def parent(self):
        """
			Returns the parent item for this object	
			:return: :class:`cross3d.SceneObject` or None
		"""
        nativeParent = self._nativeParent()
        if (nativeParent):
            from cross3d import SceneObject
            return SceneObject(self._scene, nativeParent)
        return None
示例#8
0
    def childAt(self, index):
        """Returns the child at a particular index for this object
		
		:return: :class:`cross3d.SceneObject` or None
		
		"""
        nativeChildren = self._nativeChildren()
        if (0 <= index and index < len(nativeChildren)):
            return SceneObject(self._scene, nativeChildren[index])
        return None
示例#9
0
    def objects(self):
        """The objects that are using this material.

		Returns:
			list: The list of `cross3d.SceneObject`s using this material.
		"""
        from cross3d import SceneObject
        return [
            SceneObject(self._scene, o) for o in self._nativeObjects() if o
        ]
示例#10
0
    def model(self):
        """Returns the SceneObject that is the model for this object
		
		:return: :class:`cross3d.SceneObject` or None

		"""
        nativeModel = self._nativeModel()
        if (nativeModel):
            from cross3d import SceneObject
            return SceneObject(self._scene, nativeModel)
        return None
示例#11
0
    def findChild(self, name, recursive=False):
        """
		Loops through the children for this object searching for the 
		proper one

		:return: :class:`cross3d.SceneObject` or None

		"""
        nativeChild = self._findNativeChild(name, recursive=recursive)
        if (nativeChild):
            from cross3d import SceneObject
            return SceneObject(self._scene, nativeChild)
        return None
示例#12
0
    def children(self, recursive=False, wildcard='', type=''):
        """Returns SceneObject wrappers over the children for this object
		
		:param recursive: If True, will recursively traverse child tree
		:param wildcard: ?
		:type wildcard: str
		:param type: ?
		:type type: str
		:return: list of :class:`cross3d.SceneObject` objects

		"""
        from cross3d import SceneObject
        scene = self._scene
        return [
            SceneObject(scene, native)
            for native in self._nativeChildren(recursive, wildcard, type)
        ]
示例#13
0
    def dispatchEvent(self, signal, *args):
        print 'Dispatching event', signal
        if (self.signalsBlocked()):
            return

        # emit a defined pyqtSignal
        if (hasattr(Dispatch, signal) and type(getattr(
                Dispatch, signal)).__name__ == 'pyqtBoundSignal'):
            # this should identify the object type before emiting it if it needs to emit something
            getattr(Dispatch,
                    signal).emit(SceneObject(Scene.instance(), args[0]))

        # elif process application specific signals like xsi's value changed

        # otherwise emit a custom signal
        else:
            from PyQt4.QtCore import SIGNAL
            self.emit(SIGNAL(signal), *args)

        # emit linked signals
        if (signal in self._linkedSignals):
            for trigger in self._linkedSignals[signal]:
                self.dispatch(trigger)
示例#14
0
    def _nativeObjects(self,
                       getsFromSelection=False,
                       wildcard='',
                       objectType=0):
        """
			\remarks	implements the AbstractScene._nativeObjects method to return the native objects from the scene
			\return		<list> [ <PySoftimage.xsi.X3DObject> nativeObject, .. ] || None
		"""

        # TODO: Needs to be severely optimzed. Make sure we can use regular expression for wildcard.
        # nativeType = SceneObject._abstractToNativeObjectType.get(type)

        if getsFromSelection:
            if wildcard:
                import re
                expression = wildcard.replace('*', '.+').strip('.+')
                output = []
                for obj in xsi.Selection:
                    if re.findall(expression, obj.FullName, flags=re.I):
                        output.append(obj)
                objects = output
            else:
                objects = [obj for obj in xsi.Selection]
        else:
            root = self._nativeRootObject()
            objects = root.FindChildren(wildcard, '', '', True)

        if objectType:
            holder = []
            from cross3d import SceneObject
            for obj in objects:
                if SceneObject._typeOfNativeObject(obj) == objectType:
                    holder.append(obj)
            objects = holder

        return objects
示例#15
0
 def objects(self, wildcard='*', type=0):
     return [
         SceneObject(self._scene, nativeObject)
         for nativeObject in self._nativeObjects(wildcard=wildcard,
                                                 type=type)
     ]
示例#16
0
 def constrainingObjects(self):
     from cross3d import SceneObject
     return [
         SceneObject(self._scene, nativeObject)
         for nativeObject in self._constrainingNativeObjects()
     ]