当前位置: 首页>>代码示例>>Python>>正文


Python OpenMayaMPx.asHashable方法代码示例

本文整理汇总了Python中maya.OpenMayaMPx.asHashable方法的典型用法代码示例。如果您正苦于以下问题:Python OpenMayaMPx.asHashable方法的具体用法?Python OpenMayaMPx.asHashable怎么用?Python OpenMayaMPx.asHashable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在maya.OpenMayaMPx的用法示例。


在下文中一共展示了OpenMayaMPx.asHashable方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: readBinary

# 需要导入模块: from maya import OpenMayaMPx [as 别名]
# 或者: from maya.OpenMayaMPx import asHashable [as 别名]
    def readBinary(self, inStream, numBytesToRead):
        """Read in 4 byte packs to cStringIO, unpickle from there
        
        :note: this method is more complicated than it needs be since asCharPtr does not work !
            It returns a string of a single char ... which is not the same :) !
        :note: YES, this is a CUMBERSOME way to deal with bytes ... terrible, thanks maya :), thanks python"""
        sio = cStringIO.StringIO()
        scriptutil = api.MScriptUtil()
        scriptutil.createFromInt(0)
        intptr = scriptutil.asIntPtr()

        # require multiple of 4 !
        if numBytesToRead % 4 != 0:
            raise AssertionError("Require multiple of for for number of bytes to be read, but is %i" % numBytesToRead)

        bitmask = 255                               # mask the lower 8 bit
        shiftlist = [0, 8, 16, 24]              # used to shift bits by respective values
        for i in xrange(numBytesToRead  / 4):
            api.MStreamUtils.readInt(inStream, intptr, True)
            intval = scriptutil.getInt(intptr)

            # convert to chars - endianess should be taken care of by python
            for shift in shiftlist:
                sio.write(chr((intval >> shift) & bitmask))
            # END for each byte
        # END for all 4 bytes to read

        self.__data = cPickle.loads(binascii.a2b_base64(sio.getvalue()))
        sys._maya_pyPickleData_trackingDict[mpx.asHashable(self)] = self.__data
开发者ID:mrv-developers,项目名称:mrv,代码行数:31,代码来源:persistence.py

示例2: readASCII

# 需要导入模块: from maya import OpenMayaMPx [as 别名]
# 或者: from maya.OpenMayaMPx import asHashable [as 别名]
	def readASCII(self, args, lastParsedElement):
		try:
			if args.length() > 0:
				parsedIndex = OpenMaya.MScriptUtil.getUint(lastParsedElement)
				self.__fValue = args.asDouble( parsedIndex )
				parsedIndex += 1
				OpenMaya.MScriptUtil.setUint(lastParsedElement,parsedIndex)
				fValueDictionary[OpenMayaMPx.asHashable(self)]=self.__fValue
		except:
			sys.stderr.write("Failed to read ASCII value.")
			raise
开发者ID:BigRoy,项目名称:Maya-devkit,代码行数:13,代码来源:blindDoubleDataCmd.py

示例3: readASCII

# 需要导入模块: from maya import OpenMayaMPx [as 别名]
# 或者: from maya.OpenMayaMPx import asHashable [as 别名]
    def readASCII(self, args, lastParsedElement):
        """Read base64 element and decode to cStringIO, then unpickle"""
        parsedIndex = api.MScriptUtil.getUint(lastParsedElement)
        base64encodedstring = args.asString(parsedIndex)
        self.__data = cPickle.loads(binascii.a2b_base64(base64encodedstring))

        parsedIndex += 1
        api.MScriptUtil.setUint(lastParsedElement,parsedIndex)  # proceed the index

        # update tracking dict
        sys._maya_pyPickleData_trackingDict[mpx.asHashable(self)] = self.__data
开发者ID:mrv-developers,项目名称:mrv,代码行数:13,代码来源:persistence.py

示例4: __del__

# 需要导入模块: from maya import OpenMayaMPx [as 别名]
# 或者: from maya.OpenMayaMPx import asHashable [as 别名]
 def __del__(self):
     """Remove ourselves from the dictionary to prevent flooding
     
     :note: we can be called even if maya is already unloaded or shutting down"""
     if mpx.asHashable is not None:
         del(sys._maya_pyPickleData_trackingDict[mpx.asHashable(self)])
     # call super just to be on the safe side in future, currently it appears
     # not to be required
     try:
         super(PyPickleData, self).__del__()
     except AttributeError:
         # Maya 2008 and following do not require this anymore as they
         # do not have a del method implemented apparently
         pass
开发者ID:mrv-developers,项目名称:mrv,代码行数:16,代码来源:persistence.py

示例5: doEditFlags

# 需要导入模块: from maya import OpenMayaMPx [as 别名]
# 或者: from maya.OpenMayaMPx import asHashable [as 别名]
	def doEditFlags(self):
		theParser = self._parser()
		theControl = kPythonPtrTable.get(OpenMayaMPx.asHashable(self._control()), None)

		if theParser.isFlagSet(kNopFlag):
			theControl.setOperation(kNop)
		elif theParser.isFlagSet(kMultFlag):
			theControl.setOperation(kMult)
		elif theParser.isFlagSet(kAddFlag):
			theControl.setOperation(kAdd)
		elif theParser.isFlagSet(kRedrawFlag):
			theControl.redrawCells()
			theControl.redrawLabels()
		else:
			OpenMayaMPx.MPxControlCommand.doEditFlags(self)
开发者ID:BigRoy,项目名称:Maya-devkit,代码行数:17,代码来源:mathTableControl.py

示例6: doPress

# 需要导入模块: from maya import OpenMayaMPx [as 别名]
# 或者: from maya.OpenMayaMPx import asHashable [as 别名]
	def doPress(self, event):
		OpenMayaMPx.MPxSelectionContext.doPress(self, event)
		spc = OpenMaya.MSpace.kWorld

		# If we are not in selecting mode (i.e. an object has been selected)
		# then set up for the translation.
		#
		if not self._isSelecting():
			argX = OpenMaya.MScriptUtil()
			argX.createFromInt(0)
			argXPtr = argX.asShortPtr()
			argY = OpenMaya.MScriptUtil()
			argY.createFromInt(0)
			argYPtr = argY.asShortPtr()
			event.getPosition(argXPtr, argYPtr)
			self.__startPos_x = OpenMaya.MScriptUtil(argXPtr).asShort()
			self.__startPos_y = OpenMaya.MScriptUtil(argYPtr).asShort()
			self.__view = OpenMayaUI.M3dView.active3dView()

			camera = OpenMaya.MDagPath()
			self.__view.getCamera(camera)
			fnCamera = OpenMaya.MFnCamera(camera)
			upDir = fnCamera.upDirection(spc)
			rightDir = fnCamera.rightDirection(spc)

			# Determine the camera used in the current view
			#
			if fnCamera.isOrtho():
				if upDir.isEquivalent(OpenMaya.MVector.zNegAxis, kVectorEpsilon):
					self.__currWin = MoveContext.kTop
				elif rightDir.isEquivalent(OpenMaya.MVector.xAxis, kVectorEpsilon):
					self.__currWin = MoveContext.kFront
				else:
					self.__currWin = MoveContext.kSide
			else:
				self.__currWin = MoveContext.kPersp

			# Create an instance of the move tool command.
			#
			newCmd = self._newToolCommand()
			self.__cmd = kTrackingDictionary.get(OpenMayaMPx.asHashable(newCmd), None)
			self.__cmd.setVector(0.0, 0.0, 0.0)
开发者ID:DimondTheCat,项目名称:xray,代码行数:44,代码来源:moveTool.py

示例7: copy

# 需要导入模块: from maya import OpenMayaMPx [as 别名]
# 或者: from maya.OpenMayaMPx import asHashable [as 别名]
	def copy(self, other):
		# Cannot convert other to self.  Use a dictionary
		# to hold the information we need.
		self.__fValue = fValueDictionary[OpenMayaMPx.asHashable(other)]
开发者ID:BigRoy,项目名称:Maya-devkit,代码行数:6,代码来源:blindDoubleDataCmd.py

示例8: __init__

# 需要导入模块: from maya import OpenMayaMPx [as 别名]
# 或者: from maya.OpenMayaMPx import asHashable [as 别名]
	def __init__(self):
		OpenMayaMPx.MPxData.__init__(self)
		self.__fValue = 0.0
		fValueDictionary[OpenMayaMPx.asHashable(self)]=self.__fValue
开发者ID:BigRoy,项目名称:Maya-devkit,代码行数:6,代码来源:blindDoubleDataCmd.py

示例9: __del__

# 需要导入模块: from maya import OpenMayaMPx [as 别名]
# 或者: from maya.OpenMayaMPx import asHashable [as 别名]
 def __del__(self):
     del kTrackingDictionary[OpenMayaMPx.asHashable(self)]
开发者ID:BigRoy,项目名称:Maya-devkit,代码行数:4,代码来源:rockingTransform.py

示例10: __init__

# 需要导入模块: from maya import OpenMayaMPx [as 别名]
# 或者: from maya.OpenMayaMPx import asHashable [as 别名]
 def __init__(self):
     OpenMayaMPx.MPxTransformationMatrix.__init__(self)
     kTrackingDictionary[OpenMayaMPx.asHashable(self)] = self
     self.rockXValue = 0.0
开发者ID:BigRoy,项目名称:Maya-devkit,代码行数:6,代码来源:rockingTransform.py

示例11: getRockingTransformationMatrix

# 需要导入模块: from maya import OpenMayaMPx [as 别名]
# 或者: from maya.OpenMayaMPx import asHashable [as 别名]
 def getRockingTransformationMatrix(self):
     baseXform = self.transformationMatrixPtr()
     return kTrackingDictionary[OpenMayaMPx.asHashable(baseXform)]
开发者ID:BigRoy,项目名称:Maya-devkit,代码行数:5,代码来源:rockingTransform.py

示例12: __del__

# 需要导入模块: from maya import OpenMayaMPx [as 别名]
# 或者: from maya.OpenMayaMPx import asHashable [as 别名]
	def __del__(self):
		del kPythonPtrTable[OpenMayaMPx.asHashable(self)]
开发者ID:BigRoy,项目名称:Maya-devkit,代码行数:4,代码来源:mathTableControl.py

示例13: __init__

# 需要导入模块: from maya import OpenMayaMPx [as 别名]
# 或者: from maya.OpenMayaMPx import asHashable [as 别名]
	def __init__(self, command):
		OpenMayaMPx.MPxUITableControl.__init__(self, command)
		self.__myOperation = None
		kPythonPtrTable[OpenMayaMPx.asHashable(self)] = self
开发者ID:BigRoy,项目名称:Maya-devkit,代码行数:6,代码来源:mathTableControl.py

示例14: copy

# 需要导入模块: from maya import OpenMayaMPx [as 别名]
# 或者: from maya.OpenMayaMPx import asHashable [as 别名]
 def copy(self, other):
     """Copy other into self - allows copy pointers as maya copies the data each
     time you retrieve it"""
     otherdata = sys._maya_pyPickleData_trackingDict[mpx.asHashable(other)]
     self.__data = otherdata
     sys._maya_pyPickleData_trackingDict[mpx.asHashable(self)] = self.__data
开发者ID:mrv-developers,项目名称:mrv,代码行数:8,代码来源:persistence.py

示例15: __init__

# 需要导入模块: from maya import OpenMayaMPx [as 别名]
# 或者: from maya.OpenMayaMPx import asHashable [as 别名]
 def __init__(self):
     mpx.MPxData.__init__(self)
     self.__data = dict()
     sys._maya_pyPickleData_trackingDict[mpx.asHashable(self)] = self.__data
开发者ID:mrv-developers,项目名称:mrv,代码行数:6,代码来源:persistence.py


注:本文中的maya.OpenMayaMPx.asHashable方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。