本文整理汇总了Python中transform.Transform.getMatrix方法的典型用法代码示例。如果您正苦于以下问题:Python Transform.getMatrix方法的具体用法?Python Transform.getMatrix怎么用?Python Transform.getMatrix使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类transform.Transform
的用法示例。
在下文中一共展示了Transform.getMatrix方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from transform import Transform [as 别名]
# 或者: from transform.Transform import getMatrix [as 别名]
class Entity:
def __init__(self):
self._type = ''
self._id = ''
self._category = ''
self._level = ''
self.guid = guid()
self.transform = Transform()
def loadDb3(self, db3File, guid):
self.guid = guid
self._category = db3File.queryEntityData(guid, '_Category')
self._level = db3File.queryEntityData(guid, '_Level')
self.transform.matrix.set([float(i) for i in db3File.queryEntityData(guid, 'Transform').split(',')])
self.transform.setMatrix()
def saveDb3(self, db3File):
if self._id:
db3File.updateEntityData(self.guid, '_ID', self._id + ' (' + self._level + ')')
if self._category:
db3File.updateEntityData(self.guid, '_Category', self._category)
if self._level:
db3File.updateEntityData(self.guid, '_Level', self._level)
if self.transform:
db3File.updateEntityData(self.guid, 'Transform', ', '.join([str(i) for i in self.transform.matrix.get()]))
def setAttributes(self, attrs):
if 'name' in attrs:
self._id = attrs['name']
if 'pos' in attrs:
self.transform.position = [float(i) for i in attrs['pos'].split()]
if 'rot' in attrs:
self.transform.rotation = [float(i) for i in attrs['rot'].split()]
if 'scale' in attrs:
self.transform.scale = [float(i) for i in attrs['scale'].split()]
self.transform.getMatrix()
def getAttributes(self):
attrs = {}
if self._id:
attrs['name'] = self._id
if len(self.transform.position):
attrs['pos'] = ' '.join([str(i) for i in self.transform.position])
if len(self.transform.rotation):
attrs['rot'] = ' '.join([str(i) for i in self.transform.rotation])
if len(self.transform.scale):
attrs['scale'] = ' '.join([str(i) for i in self.transform.scale])
return attrs
#-------------------------------------------------------------------------------
# Eof
#-------------------------------------------------------------------------------