本文整理汇总了Python中collada.common.E.extra方法的典型用法代码示例。如果您正苦于以下问题:Python E.extra方法的具体用法?Python E.extra怎么用?Python E.extra使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类collada.common.E
的用法示例。
在下文中一共展示了E.extra方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _add_osg_description
# 需要导入模块: from collada.common import E [as 别名]
# 或者: from collada.common.E import extra [as 别名]
def _add_osg_description(self, node, description):
"""
"""
extra = E.extra(
E.technique(
E.Descriptions( E.Description(description) ),
profile="OpenSceneGraph",
),
type="Node",
)
extra_node = collada.scene.ExtraNode(extra)
node.children.append(extra_node)
示例2: __init__
# 需要导入模块: from collada.common import E [as 别名]
# 或者: from collada.common.E import extra [as 别名]
def __init__(self, xmlnode):
"""Create an extra node which stores arbitrary xml
:param xmlnode:
Should be an ElementTree instance of tag type <extra>
"""
if xmlnode != None:
self.xmlnode = xmlnode
"""ElementTree representation of the extra node."""
else:
self.xmlnode = E.extra()
示例3: save
# 需要导入模块: from collada.common import E [as 别名]
# 或者: from collada.common.E import extra [as 别名]
def save(self):
"""Saves the effect back to :attr:`xmlnode`"""
self.xmlnode.set('id', self.id)
self.xmlnode.set('name', self.id)
profilenode = self.xmlnode.find( tag('profile_COMMON') )
tecnode = profilenode.find( tag('technique') )
tecnode.set('sid', 'common')
self._fixColorValues()
for param in self.params:
param.save()
if param.xmlnode not in profilenode.getchildren():
profilenode.insert(list(profilenode).index(tecnode),
param.xmlnode)
deletenodes = []
for oldparam in profilenode.findall( tag('newparam') ):
if oldparam not in [param.xmlnode for param in self.params]:
deletenodes.append(oldparam)
for d in deletenodes:
profilenode.remove(d)
for shader in self.shaders:
shadnode = tecnode.find(tag(shader))
if shadnode is not None and shader != self.shadingtype:
tecnode.remove(shadnode)
def getPropNode(prop, value):
propnode = E(prop)
if prop == 'transparent' and self.opaque_mode == OPAQUE_MODE.RGB_ZERO:
propnode.set('opaque', OPAQUE_MODE.RGB_ZERO)
if type(value) is Map:
propnode.append(copy.deepcopy(value.xmlnode))
elif type(value) is float:
propnode.append(E.float(str(value)))
else:
propnode.append(E.color(' '.join(map(str, value) )))
return propnode
shadnode = tecnode.find(tag(self.shadingtype))
if shadnode is None:
shadnode = E(self.shadingtype)
for prop in self.supported:
value = getattr(self, prop)
if value is None: continue
shadnode.append(getPropNode(prop, value))
tecnode.append(shadnode)
else:
for prop in self.supported:
value = getattr(self, prop)
propnode = shadnode.find(tag(prop))
if propnode is not None:
shadnode.remove(propnode)
if value is not None:
shadnode.append(getPropNode(prop, value))
double_sided_node = profilenode.find('.//%s//%s' % (tag('extra'), tag('double_sided')))
if double_sided_node is None or double_sided_node.text is None:
extranode = profilenode.find(tag('extra'))
if extranode is None:
extranode = E.extra()
profilenode.append(extranode)
teqnodes = extranode.findall(tag('technique'))
goognode = None
for teqnode in teqnodes:
if teqnode.get('profile') == 'GOOGLEEARTH':
goognode = teqnode
break
if goognode is None:
goognode = E.technique(profile='GOOGLEEARTH')
extranode.append(goognode)
double_sided_node = goognode.find(tag('double_sided'))
if double_sided_node is None:
double_sided_node = E.double_sided()
goognode.append(double_sided_node)
double_sided_node.text = "1" if self.double_sided else "0"
示例4: save
# 需要导入模块: from collada.common import E [as 别名]
# 或者: from collada.common.E import extra [as 别名]
def save(self):
"""Saves the effect back to :attr:`xmlnode`"""
self.xmlnode.set("id", self.id)
self.xmlnode.set("name", self.id)
profilenode = self.xmlnode.find(tag("profile_COMMON"))
tecnode = profilenode.find(tag("technique"))
tecnode.set("sid", "common")
self._fixColorValues()
for param in self.params:
param.save()
if param.xmlnode not in profilenode.getchildren():
profilenode.insert(profilenode.index(tecnode), param.xmlnode)
deletenodes = []
for oldparam in profilenode.findall(tag("newparam")):
if oldparam not in [param.xmlnode for param in self.params]:
deletenodes.append(oldparam)
for d in deletenodes:
profilenode.remove(d)
for shader in self.shaders:
shadnode = tecnode.find(tag(shader))
if shadnode is not None and shader != self.shadingtype:
tecnode.remove(shadnode)
def getPropNode(prop, value):
propnode = E(prop)
if type(value) is Map:
propnode.append(copy.deepcopy(value.xmlnode))
elif type(value) is float:
propnode.append(E.float(str(value)))
else:
propnode.append(E.color(" ".join(map(str, value))))
return propnode
shadnode = tecnode.find(tag(self.shadingtype))
if shadnode is None:
shadnode = E(self.shadingtype)
for prop in self.supported:
value = getattr(self, prop)
if value is None:
continue
shadnode.append(getPropNode(prop, value))
tecnode.append(shadnode)
else:
for prop in self.supported:
value = getattr(self, prop)
propnode = shadnode.find(tag(prop))
if propnode is not None:
shadnode.remove(propnode)
if value is not None:
shadnode.append(getPropNode(prop, value))
double_sided_node = profilenode.find(".//%s//%s" % (tag("extra"), tag("double_sided")))
if double_sided_node is None or double_sided_node.text is None:
extranode = profilenode.find(tag("extra"))
if extranode is None:
extranode = E.extra()
profilenode.append(extranode)
teqnodes = extranode.findall(tag("technique"))
goognode = None
for teqnode in teqnodes:
if teqnode.get("profile") == "GOOGLEEARTH":
goognode = teqnode
break
if goognode is None:
goognode = E.technique(profile="GOOGLEEARTH")
extranode.append(goognode)
double_sided_node = goognode.find(tag("double_sided"))
if double_sided_node is None:
double_sided_node = E.double_sided()
goognode.append(double_sided_node)
double_sided_node.text = "1" if self.double_sided else "0"