Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 25 additions & 9 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,30 +16,46 @@ def init_app(self):
"""
Called as the application is being initialized
"""

tk_multi_snapshot = self.import_module("tk_multi_snapshot")
self._handler = tk_multi_snapshot.Snapshot(self)

# validate templates:
work_template = self.get_template("template_work")
snapshot_template = self.get_template("template_snapshot")

# ensure snapshot template has at least one of increment or timestamp:
if (not "timestamp" in snapshot_template.keys
and not "increment" in snapshot_template.keys):
self.log_error("'template_snapshot' must contain at least one of 'timestamp' or 'increment'")
return

# register commands:
self.engine.register_command("Snapshot...", self._handler.show_snapshot_dlg)
self.engine.register_command("Snapshot History...", self._handler.show_snapshot_history_dlg)
self.engine.register_command("Snapshot...", self.show_snapshot_dlg)
self.engine.register_command("Snapshot History...", self.show_snapshot_history_dlg)

def destroy_app(self):
self._handler = None
self.log_debug("Destroying tk-multi-snapshot")


def show_snapshot_dlg(self):
"""
Shows the Snapshot Dialog.
"""
return self._handler.show_snapshot_dlg()

def show_snapshot_history_dlg(self):
self._handler.show_snapshot_history_dlg()

def can_snapshot(self, work_path=None):
"""
Helper method to determine if a snapshot can be made with work_path.
"""
return self._handler.can_snapshot(work_path)

def snapshot(self, comment=None, thumbnail=None):
"""
Snapshots the current scene without any UI
"""
work_path = self._handler.get_current_file_path()
return self._handler.do_snapshot(work_path, thumbnail, comment)
return self._handler.do_snapshot(work_path, thumbnail, comment)
Loading