本文整理汇总了Python中collada.E.source方法的典型用法代码示例。如果您正苦于以下问题:Python E.source方法的具体用法?Python E.source怎么用?Python E.source使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类collada.E
的用法示例。
在下文中一共展示了E.source方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from collada import E [as 别名]
# 或者: from collada.E import source [as 别名]
def __init__(self, id, surface, minfilter=None, magfilter=None, xmlnode=None):
"""Create a Sampler2D object.
:param str id:
A string identifier for the sampler within the local scope of the material
:param collada.material.Surface surface:
Surface instance that this object samples from
:param str minfilter:
Minification filter string id, see collada spec for details
:param str magfilter:
Maximization filter string id, see collada spec for details
:param xmlnode:
If loaded from xml, the xml node
"""
self.id = id
"""The string identifier for the sampler within the local scope of the material"""
self.surface = surface
"""Surface instance that this object samples from"""
self.minfilter = minfilter
"""Minification filter string id, see collada spec for details"""
self.magfilter = magfilter
"""Maximization filter string id, see collada spec for details"""
if xmlnode != None:
self.xmlnode = xmlnode
"""ElementTree representation of the sampler."""
else:
sampler_node = E.sampler2D(E.source(self.surface.id))
if minfilter:
sampler_node.append(E.minfilter(self.minfilter))
if magfilter:
sampler_node.append(E.magfilter(self.magfilter))
self.xmlnode = E.newparam(sampler_node, sid=self.id)
示例2: __init__
# 需要导入模块: from collada import E [as 别名]
# 或者: from collada.E import source [as 别名]
def __init__(self, id, data, components, xmlnode=None):
"""Create a name source instance.
:param str id:
A unique string identifier for the source
:param numpy.array data:
Numpy array (unshaped) with the source values
:param tuple components:
Tuple of strings describing the semantic of the data,
e.g. ``('JOINT')`` would cause :attr:`data` to be
reshaped as ``(-1, 1)``
:param xmlnode:
When loaded, the xmlnode it comes from.
"""
self.id = id
"""The unique string identifier for the source"""
self.data = data
"""Numpy array with the source values. This will be shaped as ``(-1,N)`` where ``N = len(self.components)``"""
self.data.shape = (-1, len(components) )
self.components = components
"""Tuple of strings describing the semantic of the data, e.g. ``('JOINT')``"""
if xmlnode != None:
self.xmlnode = xmlnode
"""ElementTree representation of the source."""
else:
self.data.shape = (-1,)
txtdata = ' '.join(map(str, self.data.tolist() ))
rawlen = len( self.data )
self.data.shape = (-1, len(self.components) )
acclen = len( self.data )
stridelen = len(self.components)
sourcename = "%s-array"%self.id
self.xmlnode = E.source(
E.Name_array(txtdata, count=str(rawlen), id=sourcename),
E.technique_common(
E.accessor(
*[E.param(type='Name', name=c) for c in self.components]
, **{'count':str(acclen), 'stride':str(stridelen), 'source':sourcename})
)
, id=self.id )