@@ -54,8 +54,6 @@ class CreateInputs(flowam_utils.BaseInputs):
5454 sg_pipeline_step : str
5555 #: The AM project under which the asset should be added.
5656 am_project_id : str
57- #: The name of the current SG task.
58- sg_task_name : str = ""
5957 #: Description of asset.
6058 description : str = ""
6159 #: Determines which initial source file to use to create the asset.
@@ -102,10 +100,6 @@ def validate(self):
102100 if self .create_mode == create .CreateMode .GENERIC and not self .source_path :
103101 msg = "No source path provided for generic asset."
104102 raise exceptions .CreateAssetError (data = self .asdict (), details = msg )
105- # If pipeline step is provided, we expect task_name to be provided as well
106- if self .sg_pipeline_step and not self .sg_task_name :
107- msg = "Incomplete sg context provided. Must provide sg_task_name."
108- raise exceptions .CreateAssetError (data = self .asdict (), details = msg )
109103 # prep_scene_callback is only applicable when create_mode is NEW or TEMPLATE
110104 if (
111105 self .create_mode == create .CreateMode .GENERIC
@@ -283,14 +277,6 @@ def in_dcc_context() -> bool:
283277 return engine .name != "tk-desktop"
284278
285279
286- def _has_workfile_type (parent : objects .FlowAsset , type_id : str ) -> bool :
287- """Return True if parent asset contains a child of given type."""
288-
289- if parent .find_children (type_id = type_id ):
290- return True
291- return False
292-
293-
294280def _create_dcc_workfile_asset (
295281 parent : objects .FlowAsset , inputs : CreateInputs
296282) -> sandbox .NewDraftInfo :
@@ -313,15 +299,9 @@ def _create_dcc_workfile_asset(
313299 workfile_type = flow_host ().WORKFILE_TYPE
314300 type_id = schema .get_schema_id (workfile_type )
315301
316- # Only allow one workfile of DCC type under parent
317- if _has_workfile_type (parent , type_id ):
318- msg = f'A workfile of type "{ workfile_type } " has already been created '
319- msg += f'under pipeline step "{ parent .name } ". Please open the asset from '
320- msg += "the Loader app to publish another revision of this asset."
321- raise exceptions .CreateAssetError (data = inputs .asdict (), details = msg )
322-
323- # By convention asset name will be the sg entity name
324- name = inputs .sg_entity_name
302+ # By convention asset name will be the sg entity name + workfile type
303+ abbr_type = workfile_type .split ("." )[- 1 ].upper ()
304+ name = f"{ inputs .sg_entity_name } - { abbr_type } "
325305
326306 # Prepare the source file and save to temporary location
327307 # By convention the source file will be named after the asset
0 commit comments