本文整理汇总了Python中collada.common.E.instance_visual_scene方法的典型用法代码示例。如果您正苦于以下问题:Python E.instance_visual_scene方法的具体用法?Python E.instance_visual_scene怎么用?Python E.instance_visual_scene使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类collada.common.E
的用法示例。
在下文中一共展示了E.instance_visual_scene方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: save
# 需要导入模块: from collada.common import E [as 别名]
# 或者: from collada.common.E import instance_visual_scene [as 别名]
def save(self):
"""Saves the collada document back to :attr:`xmlnode`"""
libraries = [(self.geometries, 'library_geometries'),
(self.controllers, 'library_controllers'),
(self.lights, 'library_lights'),
(self.cameras, 'library_cameras'),
(self.images, 'library_images'),
(self.effects, 'library_effects'),
(self.materials, 'library_materials'),
(self.nodes, 'library_nodes'),
(self.scenes, 'library_visual_scenes')]
self.assetInfo.save()
assetnode = self.xmlnode.getroot().find(tag('asset'))
if assetnode is not None:
self.xmlnode.getroot().replace(assetnode, self.assetInfo.xmlnode)
else:
self.xmlnode.getroot().insert(0, self.assetInfo.xmlnode)
library_loc = 0
for i, node in enumerate(self.xmlnode.getroot()):
if node.tag == tag('asset'):
library_loc = i+1
for arr, name in libraries:
node = self.xmlnode.find( tag(name) )
if node is None:
if len(arr) == 0:
continue
self.xmlnode.getroot().insert(library_loc, E(name))
node = self.xmlnode.find( tag(name) )
elif node is not None and len(arr) == 0:
self.xmlnode.getroot().remove(node)
continue
for o in arr:
o.save()
if o.xmlnode not in node:
node.append(o.xmlnode)
xmlnodes = [o.xmlnode for o in arr]
for n in node:
if n not in xmlnodes:
node.remove(n)
scenenode = self.xmlnode.find(tag('scene'))
scenenode.clear()
if self.scene is not None:
sceneid = self.scene.id
if sceneid not in self.scenes:
raise DaeBrokenRefError('Default scene %s not found' % sceneid)
scenenode.append(E.instance_visual_scene(url="#%s" % sceneid))
if self.validator is not None:
if not self.validator.validate(self.xmlnode):
raise DaeSaveValidationError("Validation error when saving: " +
schema.COLLADA_SCHEMA_1_4_1_INSTANCE.error_log.last_error.message)