refactor: remove get_nodes

This commit is contained in:
Swann 2021-06-04 12:13:53 +02:00
parent 1e15a12b10
commit 98553ba00c
No known key found for this signature in database
GPG Key ID: E1D3641A7C43AACB
4 changed files with 14 additions and 14 deletions

@ -1 +1 @@
Subproject commit d3b998789fd5c8696a21e0ef8ffae80c1024beba
Subproject commit 207c3f44e0d31587bcf538ae74d5c6fe2139c1f9

View File

@ -86,7 +86,7 @@ def initialize_session():
# Step 1: Constrect nodes
logging.info("Instantiating nodes")
for node in session.repository.list_ordered():
node_ref = session.repository.get_node(node)
node_ref = session.repository.nodes.get(node)
if node_ref is None:
logging.error(f"Can't construct node {node}")
elif node_ref.state == FETCHED:
@ -598,7 +598,7 @@ class SessionApply(bpy.types.Operator):
def execute(self, context):
logging.debug(f"Running apply on {self.target}")
try:
node_ref = session.repository.get_node(self.target)
node_ref = session.repository.nodes.get(self.target)
porcelain.apply(session.repository,
self.target,
force=True,
@ -801,7 +801,7 @@ class SessionLoadSaveOperator(bpy.types.Operator, ImportHelper):
repo.loads(self.filepath)
utils.clean_scene()
nodes = [repo.get_node(n) for n in repo.list_ordered()]
nodes = [repo.nodes.get(n) for n in repo.list_ordered()]
# Step 1: Construct nodes
for node in nodes:
@ -849,7 +849,7 @@ classes = (
def update_external_dependencies():
nodes_ids = [n.uuid for n in session.repository.nodes.values() if n.data['type_id'] in ['WindowsPath', 'PosixPath']]
for node_id in nodes_ids:
node = session.repository.get_node(node_id)
node = session.repository.nodes.get(node_id)
if node and node.owner in [session.id, RP_COMMON]:
porcelain.commit(session.repository, node_id)
porcelain.push(session.repository,'origin', node_id)
@ -922,7 +922,7 @@ def depsgraph_evaluation(scene):
# Is the object tracked ?
if update.id.uuid:
# Retrieve local version
node = session.repository.get_node(update.id.uuid)
node = session.repository.nodes.get(update.id.uuid)
check_common = session.repository.rdp.get_implementation(update.id).bl_check_common
# Check our right on this update:
# - if its ours or ( under common and diff), launch the

View File

@ -110,7 +110,7 @@ class ApplyTimer(Timer):
def execute(self):
if session and session.state == STATE_ACTIVE:
for node in session.repository.nodes.keys():
node_ref = session.repository.get_node(node)
node_ref = session.repository.nodes.get(node)
if node_ref.state == FETCHED:
try:
@ -152,7 +152,7 @@ class DynamicRightSelectTimer(Timer):
# if an annotation exist and is tracked
if annotation_gp and annotation_gp.uuid:
registered_gp = session.repository.get_node(annotation_gp.uuid)
registered_gp = session.repository.nodes.get(annotation_gp.uuid)
if is_annotating(bpy.context):
# try to get the right on it
if registered_gp.owner == RP_COMMON:
@ -165,7 +165,7 @@ class DynamicRightSelectTimer(Timer):
affect_dependencies=False)
if registered_gp.owner == settings.username:
gp_node = session.repository.get_node(annotation_gp.uuid)
gp_node = session.repository.nodes.get(annotation_gp.uuid)
porcelain.commit(session.repository, gp_node.uuid)
porcelain.push(session.repository, 'origin', gp_node.uuid)
@ -187,7 +187,7 @@ class DynamicRightSelectTimer(Timer):
# change old selection right to common
for obj in obj_common:
node = session.repository.get_node(obj)
node = session.repository.nodes.get(obj)
if node and (node.owner == settings.username or node.owner == RP_COMMON):
recursive = True
@ -204,7 +204,7 @@ class DynamicRightSelectTimer(Timer):
# change new selection to our
for obj in obj_ours:
node = session.repository.get_node(obj)
node = session.repository.nodes.get(obj)
if node and node.owner == RP_COMMON:
recursive = True
@ -235,7 +235,7 @@ class DynamicRightSelectTimer(Timer):
if len(current_selection) == 0 :
owned_keys = [k for k, v in session.repository.nodes.items() if v.owner==settings.username]
for key in owned_keys:
node = session.repository.get_node(key)
node = session.repository.nodes.get(key)
try:
porcelain.unlock(session.repository,
key,

View File

@ -438,7 +438,7 @@ class SESSION_PT_presence(bpy.types.Panel):
def draw_property(context, parent, property_uuid, level=0):
settings = get_preferences()
runtime_settings = context.window_manager.session
item = session.repository.get_node(property_uuid)
item = session.repository.nodes.get(property_uuid)
type_id = item.data.get('type_id')
area_msg = parent.row(align=True)
@ -554,7 +554,7 @@ class SESSION_PT_repository(bpy.types.Panel):
if runtime_settings.filter_name:
for node_id in filtered_node:
node_instance = session.repository.get_node(node_id)
node_instance = session.repository.nodes.get(node_id)
name = node_instance.data.get('name')
if runtime_settings.filter_name not in name:
filtered_node.remove(node_id)