Skip to content

Commit

Permalink
adds build_from_file function
Browse files Browse the repository at this point in the history
  • Loading branch information
MonsieurGallo committed Feb 20, 2024
1 parent da24b28 commit ecf1df4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
14 changes: 10 additions & 4 deletions release/scripts/mgear/shifter/rig_builder/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def execute_build_logic(self, json_data, validate=True, passed_only=False):
validate (bool): Option to run Pyblish validators
passed_only (bool): Option to publish only rigs that pass validation
"""
data = json.loads(json_data)
data = json_data

data_rows = data.get("rows")
if not data_rows:
Expand Down Expand Up @@ -189,9 +189,13 @@ def execute_build_logic(self, json_data, validate=True, passed_only=False):

return self.results_dict

def build_from_file(self, file_path):
json_data = self.load_config_data_from_file(file_path)
self.execute_build_logic(json_data)


@classmethod
def write_config_data_to_file(cls, data_string):
print("Writing data to file")
file_path = pm.fileDialog2(fileMode=0, fileFilter="*.srb")[0]
if not file_path:
return
Expand All @@ -201,8 +205,10 @@ def write_config_data_to_file(cls, data_string):


@classmethod
def load_config_data_from_file(cls):
file_path = pm.fileDialog2(fileMode=1, fileFilter="*.srb")[0]
def load_config_data_from_file(cls, file_path=""):
if not file_path:
file_path = pm.fileDialog2(fileMode=1, fileFilter="*.srb")[0]

if not file_path:
return

Expand Down
2 changes: 0 additions & 2 deletions release/scripts/mgear/shifter/rig_builder/ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,6 @@ def dropEvent(self, e):
self.add_file(file_path)

def import_config(self):
print("Calling import config")
data = builder.RigBuilder.load_config_data_from_file()

self.output_folder_line_edit.setText(data["output_folder"])
Expand All @@ -320,7 +319,6 @@ def import_config(self):


def export_config(self):
print("Calling export config")
data_string = self.collect_table_data()
builder.RigBuilder.write_config_data_to_file(data_string)

Expand Down

0 comments on commit ecf1df4

Please sign in to comment.