Skip to content

Commit

Permalink
Now Light Rigs are properly referenced
Browse files Browse the repository at this point in the history
  • Loading branch information
tpoveda committed Nov 30, 2019
1 parent f4a167d commit e470836
Showing 1 changed file with 20 additions and 11 deletions.
31 changes: 20 additions & 11 deletions artellapipe/tools/lightrigsmanager/lightrigsmanager.py
Expand Up @@ -152,11 +152,8 @@ def _on_reference_light_rig(self):
LOGGER.warning('Impossible to reference Light Rig: {} | {} | {}'.format(
self._name, self._path, self._file_type))
return None
light_rig_file = light_rig_file_class(light_rig_name, file_path=self._path)
light_rig_file.reference_file()

#
# return tp.Dcc.reference_file(light_rig, force=True)
light_rig_file = light_rig_file_class(self._project, light_rig_name, file_path=self._path)
light_rig_file.import_file(reference=True)


class ArtellaLightRigManager(artellapipe.Tool, object):
Expand All @@ -174,15 +171,18 @@ def get_light_rigs_path(self):

light_rigs_template_name = self.config.get('lightrigs_template', None)
if not light_rigs_template_name:
LOGGER.warning(
'No Light Rigs Template name defined in configuration file: "{}"'.format(self.config.get_path()))
msg = 'No Light Rigs Template name defined in configuration file: "{}"'.format(self.config.get_path())
self.show_warning_message(msg)
LOGGER.warning(msg)
return None
template = artellapipe.FilesMgr().get_template(light_rigs_template_name)
if not template:
LOGGER.warning(
'"{}" template is not defined in project files configuration file!'.format(light_rigs_template_name))
return None

template_dict = {
'assets_path': artellapipe.AssetsMgr().get_assets_path()
'project_path': self._project.get_path()
}
light_rigs_path = template.format(template_dict)

Expand Down Expand Up @@ -243,7 +243,14 @@ def synchronize_light_rigs(self):
Synchronizes current light rigs into user computer
"""

artellapipe.FilesMgr().sync_paths([self.get_light_rigs_path()], recursive=True)
light_rigs_path = self.get_light_rigs_path()
if not light_rigs_path:
msg = 'Impossible to synchronize light rigs because its path is not defined!'
self.show_warning_message(msg)
LOGGER.warning(msg)
return

artellapipe.FilesMgr().sync_paths([light_rigs_path], recursive=True)
self._update_ui(allow_sync=False)

def _update_ui(self, allow_sync=True):
Expand Down Expand Up @@ -281,11 +288,13 @@ def _on_open_light_rigs_folder(self):
"""

light_rigs_path = self.get_light_rigs_path()
if os.path.exists(light_rigs_path):
if light_rigs_path and os.path.exists(light_rigs_path):
folder_utils.open_folder(light_rigs_path)
return True
else:
LOGGER.warning('Light Rigs Folder "{}" does not exists!'.format(light_rigs_path))
msg = 'Light Rigs Folder "{}" does not exists!'.format(light_rigs_path)
self.show_warning_message(msg)
LOGGER.warning(msg)
return False

def _on_sync_light_rigs(self):
Expand Down

0 comments on commit e470836

Please sign in to comment.