ADX2ロボット

スクリプトいろいろ

# project名を得る
project = acproject.get_child_objects(None, "Project")["data"][0]
project_name = acproject.get_value(project, "Name")["data"]
print(project_name)
# ビルドルートパスを得る (ビルド後に取得可能)
user_settings = acproject.get_user_settings()["data"]
path = acproject.get_value(user_settings, "BuildRootAbsolutePath")["data"]
print("BuildPath: " + path)
# 選択しているキューを得る
selected_cues = acproject.get_selected_objects("Cue")["data"]
if not selected_cues:
    # キューが選択されていない場合は、選択項目の下のキューを探す
    # 選択項目を取得
    parent_objs = []
    for parent_type in ["WorkUnitFolder", "WorkUnit", "CueSheet", "CueSheetFolder", "CueFolder"]:
        parent_objs.extend(acproject.get_selected_objects(parent_type)["data"])

    # 選択項目以下のキューを取得
    cues = []
    for parent_obj in parent_objs:
        selected_cues.extend(acproject.find_objects(parent_obj, "Cue")["data"])

if not selected_cues:
    acdebug.warning("キューを選択してください")
    sys.exit()
# --Description:[tatmos][Analyze]選択した項目のキュー名前に2バイト文字が含まれているかチェックする
import cri.atomcraft.debug as acdebug
import cri.atomcraft.project as acproject

import importlib
import unicodedata

# 選択しているキューを得る
cues = acproject.get_selected_objects("Cue")["data"]
if not cues :
    # キューが選択されていない場合は、選択項目の下のキューを探す
    # 選択項目を取得
    parent_objs = []
    for parent_type in ["CueSheet", "CueSheetFolder", "CueFolder"]:
        parent_objs.extend(acproject.get_selected_objects(parent_type)["data"])

    # 選択項目以下のキューを取得
    cues = []
    for parent_obj in parent_objs:
        cues.extend(acproject.find_objects(parent_obj, "Cue")["data"])

if not cues :
    acdebug.warning("チェックするキューを選択してください.")
    sys.exit()

cueLength = len(cues)

error_list = []
for cue in cues:
    cue_name = acproject.get_value(cue, "Name")["data"]

    not_na = False
    # 半角チェック
    for c in cue_name:
        j = unicodedata.east_asian_width(c)
        if 'Na' != j:
            not_na = True

    if not_na:
        error_list.append(cue_name + " 2byet文字あり ")
        error_list.append("\n")

    if " " in cue_name:
        error_list.append(cue_name + " 半角スペースあり ")
        error_list.append("\n")

    if not cue_name.islower():

        if "_LP" in cue_name or "_LPE" in cue_name or "SE_" in cue_name:
            pass
        else: 
            error_list.append(cue_name + " 大文字が含まれている ")
            error_list.append("\n")

message = ""

for error in error_list:
    message = message + " " + error + " ";

if len(message) != 0:
    # 表示
    acdebug.warning(f"エラーのファイル:\n {message}")
else:
    acdebug.log(f"問題なし {len(cues)}個のキューをチェックしました。")
# --Description:[tatmos][Replace]選択した項目のキュー名前を小文字にする
import cri.atomcraft.debug as acdebug
import cri.atomcraft.project as acproject

import importlib
import unicodedata

# 選択しているキューを得る
cues = acproject.get_selected_objects("Cue")["data"]
if not cues:
    # キューが選択されていない場合は、選択項目の下のキューを探す
    # 選択項目を取得
    parent_objs = []
    for parent_type in ["CueSheet", "CueSheetFolder", "CueFolder"]:
        parent_objs.extend(acproject.get_selected_objects(parent_type)["data"])

    # 選択項目以下のキューを取得
    cues = []
    for parent_obj in parent_objs:
        cues.extend(acproject.find_objects(parent_obj, "Cue")["data"])

if not cues:
    acdebug.warning("小文字にするキューを選択してください.")
    sys.exit()

cueLength = len(cues)

error_list = []
for cue in cues:
    cue_name = acproject.get_value(cue, "Name")["data"]

    cue_name = cue_name.lower()
    acproject.set_value(cue, "Name", cue_name)

    acdebug.log(f"{len(cues)}個のキューを小文字にしました。")

タグ:

+ タグ編集
  • タグ:

このサイトはreCAPTCHAによって保護されており、Googleの プライバシーポリシー利用規約 が適用されます。

最終更新:2024年09月11日 18:22