Skip to content

Commit

Permalink
Adds drag n drop functionality for srb files
Browse files Browse the repository at this point in the history
  • Loading branch information
MonsieurGallo committed Feb 20, 2024
1 parent ecf1df4 commit 87233a4
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions release/scripts/mgear/shifter/rig_builder/ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
from mgear.core import pyqt, widgets
from mgear.shifter.rig_builder import builder

from functools import partial


class RigBuilderUI(
MayaQWidgetDockableMixin, QtWidgets.QDialog, pyqt.SettingsMixin
Expand Down Expand Up @@ -145,7 +147,7 @@ def create_layout(self):
def create_connections(self):
"""Connects buttons to their functions."""

self.import_action.triggered.connect(self.import_config)
self.import_action.triggered.connect(partial(self.import_config, ""))
self.export_action.triggered.connect(self.export_config)

self.output_folder_button.clicked.connect(
Expand Down Expand Up @@ -295,9 +297,11 @@ def dropEvent(self, e):
file_path = str(url.toLocalFile())
if file_path.lower().endswith(".sgt"):
self.add_file(file_path)
if file_path.lower().endswith(".srb"):
self.import_config(file_path=file_path)

def import_config(self):
data = builder.RigBuilder.load_config_data_from_file()
def import_config(self, file_path=""):
data = builder.RigBuilder.load_config_data_from_file(file_path=file_path)

self.output_folder_line_edit.setText(data["output_folder"])
self.pre_script_line_edit.setText(data["pre_script"])
Expand Down

0 comments on commit 87233a4

Please sign in to comment.