-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
finish to correct pull workable for silex_maya
- Loading branch information
Showing
6 changed files
with
121 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 ========================================================================== |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters