Skip to content

Commit

Permalink
Merge pull request #64 from MoonShineVFX/ple-1705
Browse files Browse the repository at this point in the history
Add asset_type key when create asset manually
  • Loading branch information
rebeccaLinx authored Jan 16, 2023
2 parents b5f32d2 + c20866a commit 66fcfdd
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 9 deletions.
24 changes: 15 additions & 9 deletions avalon/tools/projectmanager/dialogs.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def __init__(self, is_silo_required=True, parent=None, shotgrid_io=None, shotgri
silo_field.setVisible(is_silo_required)

# Parent
parent_label = QtWidgets.QLabel("Parent:")
parent_label = QtWidgets.QLabel("Parent: (Asset Type)")
parent_field = QtWidgets.QLineEdit()
parent_field.setReadOnly(True)
parent_field.setStyleSheet("background-color: #333333;") # greyed out
Expand Down Expand Up @@ -163,8 +163,8 @@ def update_name(self):
name = label

# Prefix with parent name (if parent)
if self.parent_doc:
name = "_".join((self.parent_doc["name"], name))
# if self.parent_doc:
# name = "_".join((self.parent_doc["name"], name))

self.data["label"]["name"].setText(name)

Expand All @@ -179,11 +179,16 @@ def on_add_asset(self):
sequence_id = parent_id if self.parent_doc["type"] == "sequence"\
else self.parent_doc.get("data", {}).get("sequence_id")
else:
parent_id = None
episode = ""
episode_id = None
sequence = ""
sequence_id = None
# parent_id = None
# episode = ""
# episode_id = None
# sequence = ""
# sequence_id = None
QtWidgets.QMessageBox.warning(
self, "Asset type invalid",
"Could not create! Please give asset type."
)
return

name = self.data["label"]["name"].text()
label = self.data["label"]["label"].text()
Expand Down Expand Up @@ -240,7 +245,8 @@ def on_add_asset(self):
"episode_id": episode_id,
"sequence": sequence,
"sequence_id": sequence_id,
"visualParent": parent_id
"visualParent": parent_id,
"asset_type": self.parent_doc["name"]
}

if self.is_silo_required:
Expand Down
2 changes: 2 additions & 0 deletions avalon/tools/projectmanager/lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,8 @@ def create_asset(data, silo_required):
asset["episode"] = data.pop("episode")
if "sequence" in data:
asset["sequence"] = data.pop("sequence")
if "asset_type" in data:
asset["asset_type"] = data.pop("asset_type")

# Asset *must* have a name
assert asset["name"], "Asset has no name"
Expand Down

0 comments on commit 66fcfdd

Please sign in to comment.