本文整理汇总了Python中pyasm.biz.Snapshot.get_ref_snapshot_by_node方法的典型用法代码示例。如果您正苦于以下问题:Python Snapshot.get_ref_snapshot_by_node方法的具体用法?Python Snapshot.get_ref_snapshot_by_node怎么用?Python Snapshot.get_ref_snapshot_by_node使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyasm.biz.Snapshot
的用法示例。
在下文中一共展示了Snapshot.get_ref_snapshot_by_node方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: draw_node
# 需要导入模块: from pyasm.biz import Snapshot [as 别名]
# 或者: from pyasm.biz.Snapshot import get_ref_snapshot_by_node [as 别名]
def draw_node(self, ref_nodes, table):
if not ref_nodes:
return
for ref_node in ref_nodes:
snapshot = Snapshot.get_ref_snapshot_by_node(ref_node, mode='latest')
if not snapshot:
print "Snapshot for ref_node does not exist"
continue
render = snapshot.get_parent()
table.add_row()
parent = render.get_parent()
table.add_cell( parent.get_name() )
table.add_cell( self.get_open_wdg(render) )
dir = render.get_client_lib_dir()
table.add_cell( "<i>%s</i>" % dir )
示例2: get_version_wdgs
# 需要导入模块: from pyasm.biz import Snapshot [as 别名]
# 或者: from pyasm.biz.Snapshot import get_ref_snapshot_by_node [as 别名]
def get_version_wdgs(my):
'''get a list of version wdgs'''
if my.version_wdgs:
return my.version_wdgs
xml = my.snapshot.get_xml_value("snapshot")
refs = xml.get_nodes("snapshot/file/ref")
if not refs:
return my.version_wdgs
# handle subreferences
for ref in refs:
instance = Xml.get_attribute(ref, "instance")
node_name = Xml.get_attribute(ref, "node_name")
snapshot = Snapshot.get_ref_snapshot_by_node(ref, mode='current')
if not snapshot:
print "WARNING: reference in snapshot [%s] does not exist" % my.snapshot.get_code()
continue
#checkin_snapshot = Snapshot.get_ref_snapshot_by_node(ref)
parent = snapshot.get_parent()
asset_code = parent.get_code()
# namespace = "veryron_rig"
# node_name = "stool_model:furn001"
# instance = "stool_model"
# HACK: if node name was not specified, then try to guess it
# (for backwards compatibility)
if not node_name:
node_name = my.get_node_name(snapshot, asset_code, my.namespace)
# HACK
parts = node_name.split(":")
parts.insert(1, instance)
node_name = ":".join(parts)
print "WARNING: node_name not given: using [%s]" % node_name
# Add the current namespace to the node
# in session
checked_node_name = node_name
# FIXME: this is Maya-specific and meant for referencing a shot
'''
if app_name == 'Maya':
if not node_name.startswith("%s:" % my.namespace):
node_name = "%s:%s" % (my.namespace, node_name)
elif app_name == "XSI":
pass
'''
# get the latest information
latest_version = snapshot.get_value("version")
latest_context = snapshot.get_value("context")
latest_revision = snapshot.get_value("revision", no_exception=True)
latest_snapshot_type = snapshot.get_value("snapshot_type")
# get the session information
my.session.set_asset_mode(False)
session_context = my.session.get_context(node_name, asset_code, latest_snapshot_type)
session_version = my.session.get_version(node_name, asset_code, latest_snapshot_type)
session_revision = my.session.get_revision(node_name, asset_code, latest_snapshot_type)
#print "session: ", session_version, session_context, session_revision
# add to outdated ref list here
version_wdg = LatestVersionContextWdg()
data = {'session_version': session_version, \
'session_context': session_context, \
'session_revision': session_revision, \
'latest_context': latest_context, \
'latest_version': latest_version, \
'latest_revision': latest_revision,\
'asset_code': asset_code,\
'node_name': checked_node_name ,\
'sobject': parent,\
'snapshot': snapshot}
version_wdg.set_options(data)
my.version_wdgs.append(version_wdg)
# This only adds when it is being drawn with the corresponding process selected
# so not that useful, commented out for now.
#if version_wdg.get_status() not in [ VersionWdg.NOT_LOADED, VersionWdg.UPDATED]:
# SubRefWdg.add_outdated_ref(version_wdg)
return my.version_wdgs