diff --git a/silex_client/commands/build_render_path.py b/silex_client/commands/build_render_path.py index ef160c67..2f67618d 100644 --- a/silex_client/commands/build_render_path.py +++ b/silex_client/commands/build_render_path.py @@ -128,7 +128,6 @@ async def _get_gazu_output_path( name=task_name, mode = "render" ) - print(output_path) return pathlib.Path(output_path) @CommandBase.conform_command() diff --git a/silex_client/commands/build_work_path.py b/silex_client/commands/build_work_path.py index 9e820d94..d3a90b74 100644 --- a/silex_client/commands/build_work_path.py +++ b/silex_client/commands/build_work_path.py @@ -17,6 +17,8 @@ class BuildWorkPath(CommandBase): + + print("je suis dans le build work path") """ Build the path where the work files should be saved to """ diff --git a/silex_client/commands/farm/houdini_render_tasks.py b/silex_client/commands/farm/houdini_render_tasks.py index 1a816dba..67e8b25e 100644 --- a/silex_client/commands/farm/houdini_render_tasks.py +++ b/silex_client/commands/farm/houdini_render_tasks.py @@ -38,7 +38,7 @@ class HoudiniRenderTasksCommand(CommandBase): parameters = { "scene_file": { "label": "Scene file", - "type": TaskFileParameterMeta(extensions=[".hip", ".hipnc"]), + "type": TaskFileParameterMeta(), }, "frame_range": { "label": "Frame range", @@ -110,7 +110,6 @@ async def __call__( logger: logging.Logger, ): scene: pathlib.Path = parameters["scene_file"] - print(scene) frame_range: FrameSet = parameters["frame_range"] skip_existing = parameters["skip_existing"] parameter_overrides: bool = parameters["parameter_overrides"] @@ -171,6 +170,7 @@ async def setup( logger: logging.Logger, ): scene: pathlib.Path = parameters["scene_file"] + print(scene) rop_from_hip: bool = parameters["rop_from_hip"] previous_hip_value = action_query.store.get( "submit_houdini_temp_hip_filepath", None diff --git a/silex_client/commands/pull_workable.py b/silex_client/commands/pull_workable.py index b99b2ca8..4ddfa67e 100644 --- a/silex_client/commands/pull_workable.py +++ b/silex_client/commands/pull_workable.py @@ -156,6 +156,7 @@ async def work_and_full_path(version: int) -> tuple[str, str]: launch_cmd.param("action") launch_cmd.value('rename') + print(launch_cmd) os.system(str(launch_cmd)) diff --git a/silex_client/commands/rename_startup.py b/silex_client/commands/rename_startup.py index 6c84ca9d..67201ea1 100644 --- a/silex_client/commands/rename_startup.py +++ b/silex_client/commands/rename_startup.py @@ -1,84 +1,133 @@ +# from __future__ import annotations + +# import logging +# import os +# import pathlib +# import re +# import typing +# from typing import Any, Dict +# import gazu.files +# import fileseq + + +# import asyncio +# from silex_client.action.command_base import CommandBase +# from silex_client.action.parameter_buffer import ParameterBuffer +# from silex_client.commands.build_work_path import BuildWorkPath +# from silex_client.utils import command_builder +# from silex_client.core.context import Context +# from silex_client.utils.files import expand_path +# from silex_client.utils.log import flog +# from silex_client.utils.parameter_types import TaskFileParameterMeta, TextParameterMeta + +# # Forward references +# if typing.TYPE_CHECKING: +# from silex_client.action.action_query import ActionQuery + + + +# class RenameStartup(BuildWorkPath): + +# print("je suis dans l'action rename de silex_client") + +# @CommandBase.conform_command() +# async def __call__( +# self, +# parameters: Dict[str, Any], +# action_query: ActionQuery, +# logger: logging.Logger, +# ): + +# task = await gazu.task.get_task(action_query.context_metadata["task_id"]) +# async def work_and_full_path(version: int) -> tuple[str, str]: +# work_path: str = await gazu.files.build_working_file_path( +# task, software=None, revision=version, sep=os.path.sep +# ) +# full_path = f"{work_path}{extension}" +# return work_path, full_path +# print(work_path + " test ") +# # Build the work path +# initial_version = 1 +# version = initial_version +# work_path, full_path = await work_and_full_path(initial_version) + +# existing_sequences = fileseq.findSequencesOnDisk(os.path.dirname(full_path)) + +# # Change to the good version =================================================================================== +# matching_sequence = None +# for sequence in existing_sequences: +# # Check if the filename is present in any of the file sequences +# if pathlib.Path(full_path) in [ +# pathlib.Path(path) for path in sequence +# ]: +# # Set the version to the latest of that sequence +# last_version = sequence.frameSet()[-1] + 1 + +# # If the version is greater, use that +# if last_version > version: +# version = last_version +# matching_sequence = sequence + +# # We also increment when an existing sequence was found +# if parameters["increment"]: +# version += 1 + +# if version != initial_version: +# # Rebuild the file path again with the new version +# _, full_path = await work_and_full_path(version) +# flog.info(full_path) + +# publishes = [publish] +# if not publish.is_dir(): +# publish = publish.parent +# else: +# publishes = list(publish.iterdir()) + +# # get the associated dcc to extension ========================================================================== + from __future__ import annotations import logging -import os import pathlib -import re import typing -from typing import Any, Dict -import gazu.files -import fileseq - +from typing import Any, Dict, List -import asyncio from silex_client.action.command_base import CommandBase -from silex_client.action.parameter_buffer import ParameterBuffer -from silex_client.commands.build_work_path import BuildWorkPath -from silex_client.utils import command_builder -from silex_client.core.context import Context -from silex_client.utils.files import expand_path +# from silex_houdini.utils.utils import Utils +from silex_client.utils.parameter_types import ListParameter from silex_client.utils.log import flog -from silex_client.utils.parameter_types import TaskFileParameterMeta, TextParameterMeta + # Forward references if typing.TYPE_CHECKING: from silex_client.action.action_query import ActionQuery +import os + +import maya.cmds as cmds +print("je suis dans le silex_clients rename") -class SelectPull(BuildWorkPath): +class RenameStartup(CommandBase): + """ + Save current scene with context as path + """ + print("je suis dans la class") + parameters = { + "name": { + "label": "Only set the path", + "type": str, + "value": None, + "hide": True, + }, + } @CommandBase.conform_command() async def __call__( - self, - parameters: Dict[str, Any], - action_query: ActionQuery, - logger: logging.Logger, + self, + parameters: Dict[str, Any], + action_query: ActionQuery, + logger: logging.Logger, ): + cmds.file(rename= parameters["name"]) - task = await gazu.task.get_task(action_query.context_metadata["task_id"]) - async def work_and_full_path(version: int) -> tuple[str, str]: - work_path: str = await gazu.files.build_working_file_path( - task, software=None, revision=version, sep=os.path.sep - ) - full_path = f"{work_path}{extension}" - return work_path, full_path - - # Build the work path - initial_version = 1 - version = initial_version - work_path, full_path = await work_and_full_path(initial_version) - - existing_sequences = fileseq.findSequencesOnDisk(os.path.dirname(full_path)) - - # Change to the good version =================================================================================== - matching_sequence = None - for sequence in existing_sequences: - # Check if the filename is present in any of the file sequences - if pathlib.Path(full_path) in [ - pathlib.Path(path) for path in sequence - ]: - # Set the version to the latest of that sequence - last_version = sequence.frameSet()[-1] + 1 - - # If the version is greater, use that - if last_version > version: - version = last_version - matching_sequence = sequence - - # We also increment when an existing sequence was found - if parameters["increment"]: - version += 1 - - if version != initial_version: - # Rebuild the file path again with the new version - _, full_path = await work_and_full_path(version) - flog.info(full_path) - - publishes = [publish] - if not publish.is_dir(): - publish = publish.parent - else: - publishes = list(publish.iterdir()) - - # get the associated dcc to extension ========================================================================== \ No newline at end of file diff --git a/silex_client/utils/parameter_types.py b/silex_client/utils/parameter_types.py index d1098275..e13fa6dd 100644 --- a/silex_client/utils/parameter_types.py +++ b/silex_client/utils/parameter_types.py @@ -175,7 +175,6 @@ def TaskFileParameterMeta( def __init__(self, value): if not isinstance(value, list): value = [value] - for index, item in enumerate(value): value[index] = pathlib.Path(item) @@ -421,3 +420,6 @@ def get_default(): } return CommandParameterMeta("UnionParameter", (object,), attributes) + +if __name__ == "__main__": + TaskFileParameterMeta(extensions=["hip","hipnc"])