Skip to content

Commit a297bf9

Browse files
authored
Merge pull request #4 from nimbleheroes/swc_beta
Swc beta
2 parents 09447e7 + 4ad7567 commit a297bf9

4 files changed

Lines changed: 23 additions & 9 deletions

File tree

python/sync/resolver.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@ def root_path(self):
8282
else:
8383
templated_path = self.root_template.apply_fields(self.template_fields,
8484
platform= sys.platform)
85-
return os.path.join(templated_path, "...")
86-
85+
#return os.path.join(templated_path, "...")
86+
return templated_path
8787
@property
8888
def entity_info(self):
8989
try:

python/sync/sync.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def __init__(self, fw):
4646
self.p4_server = self._get_p4_server()
4747

4848

49-
def sync_with_dlg(self, app, entities_to_sync, specific_files=False):
49+
def sync_with_dlg(self, app, entities_to_sync, specific_files=False, child_asset_ids=None):
5050
"""
5151
Show the sync window for user file syncing
5252
@@ -56,6 +56,7 @@ def sync_with_dlg(self, app, entities_to_sync, specific_files=False):
5656
self.entities_to_sync = entities_to_sync
5757
self.app = app
5858
self.specific_files = specific_files
59+
self.child_asset_ids = child_asset_ids
5960

6061
try:
6162
# ensure this always runs on the main thread:
@@ -77,7 +78,7 @@ def _sync_with_dlg(self):
7778
from ..widgets import SyncForm
7879

7980
result, _ = self._fw.engine.show_modal("Perforce Sync ", self._fw, SyncForm,
80-
self.app, self.entities_to_sync, self.specific_files)
81+
self.app, self.entities_to_sync, self.specific_files, self.child_asset_ids)
8182

8283
if result == QtGui.QDialog.Accepted:
8384
pass
@@ -100,12 +101,12 @@ def _get_p4_server(self):
100101
return str(sg_project.get(server_field))
101102

102103

103-
def sync_with_dialog(app, entities_to_sync, specific_files=False):
104+
def sync_with_dialog(app, entities_to_sync, specific_files=False, child_asset_ids=None):
104105
"""
105106
Show the Perforce sync dialog
106107
107108
:returns Qt UI: A new Perforce sync dialog
108109
"""
109110

110111
fw = sgtk.platform.current_bundle()
111-
return SyncHandler(fw).sync_with_dlg(app, entities_to_sync, specific_files=specific_files)
112+
return SyncHandler(fw).sync_with_dlg(app, entities_to_sync, specific_files=specific_files, child_asset_ids=child_asset_ids)

python/widgets/open_sync_form.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class SyncForm(QtGui.QWidget):
3333

3434
progress = 0
3535

36-
def __init__(self, parent_sgtk_app, entities_to_sync, specific_files, parent=None):
36+
def __init__(self, parent_sgtk_app, entities_to_sync, specific_files, child_asset_ids=None , parent=None):
3737
"""
3838
Construction of sync UI
3939
"""
@@ -44,6 +44,7 @@ def __init__(self, parent_sgtk_app, entities_to_sync, specific_files, parent=No
4444
self.app = parent_sgtk_app
4545
self.entities_to_sync = entities_to_sync
4646
self.specific_files= specific_files
47+
self.child_asset_ids = child_asset_ids
4748
self.scan()
4849

4950
def scan(self):
@@ -626,6 +627,10 @@ def populate_assets(self):
626627
asset_info_gather_worker.status_update.connect(self.set_progress_message)
627628
asset_info_gather_worker.includes.connect(self.update_available_filters)
628629

630+
if self.child_asset_ids:
631+
if entity_to_sync.get('id') in self.child_asset_ids:
632+
asset_info_gather_worker.child = True
633+
629634
self.threadpool.start(asset_info_gather_worker)
630635

631636

python/widgets/sync_workers.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,8 @@ def __init__(self, app=None, entity=None, framework=None):
9595
self._icon = None
9696
self._detail = None
9797

98+
self.child = False
99+
98100
self.fw = framework
99101
self.asset_item = None
100102

@@ -127,7 +129,12 @@ def asset_name(self):
127129

128130
@property
129131
def root_path(self):
130-
rp = self.asset_item.get('root_path')
132+
p4_path_operator = "*"
133+
if self.child is True:
134+
p4_path_operator = "..."
135+
self.fw.logger.warning("processed root path as a child: %s" %self.asset_item.get('root_path'))
136+
137+
rp = os.path.join(self.asset_item.get('root_path'), p4_path_operator )
131138
if self.entity.get('type') in ["PublishedFile"]:
132139
rp = "B:/" + self.entity.get('path_cache')
133140
return rp
@@ -204,7 +211,8 @@ def run(self):
204211
"""
205212
try:
206213
self.template_resolver = TemplateResolver(app=self.app,
207-
entity=self.entity )
214+
entity=self.entity,
215+
)
208216

209217
self.asset_item = self.template_resolver.entity_info
210218
progress_status_string = ""

0 commit comments

Comments
 (0)