Fast Ref / API Reference / Advanced

지정된 슬롯 레퍼런스의 네임스페이스를 대화상자 없이 변경합니다. 파이프라인 자동화 및 TA 스크립트용으로 설계된 비대화식 API입니다. 노드, 레이어, SelectionSet 이름이 일괄 업데이트됩니다.

시그니처

api.set_namespace(slot: int, namespace: str) -> dict

파라미터

파라미터 타입 설명
slot int 슬롯 번호 (0-9). 반드시 int여야 합니다 (bool 거부).
namespace str 새 네임스페이스 이름. 공백 문자만으로 구성된 경우 거부합니다.

반환값

{"success": bool, "namespace": str, "message": str}
타입 설명
success bool 변경 성공 여부. no-op(이미 같은 이름) 시에도 True.
namespace str 적용된 네임스페이스 이름.
message str 상태 설명 문자열.

예외

예외 조건
TypeError slot이 int가 아닐 때 (bool 포함), 또는 namespace가 str이 아닐 때
ValueError 슬롯이 유효하지 않거나 비어 있을 때, namespace가 공백 문자뿐일 때, 또는 같은 이름이 다른 슬롯에 이미 존재할 때
RuntimeError 내부 네임스페이스 적용 실패 시

동작 세부 사항

  • No-op: 슬롯이 이미 동일한 네임스페이스를 가지면 씬을 수정하지 않고 즉시 {"success": True}를 반환합니다.
  • 중복 검사: 다른 점유된 슬롯이 이미 같은 이름을 사용 중이면 ValueError를 발생시킵니다.
  • 일괄 적용: 내부적으로 UI 다이얼로그와 동일한 엔진을 사용하므로, 노드·레이어·SelectionSet 이름이 일관되게 변경됩니다.
  • 씬 저장: 성공 시 InfoNode UDP에 즉시 저장됩니다 (다른 쓰기 메서드와 동일).

예제

from os_fast_ref.api import FastRefAPI

api = FastRefAPI()

# 슬롯 0의 네임스페이스를 "Centaur"로 변경
result = api.set_namespace(slot=0, namespace="Centaur")
print(result["namespace"])  # "Centaur"

# UI가 열려 있으면 갱신
api.update_ui()

잘못된 사용 예제

# TypeError: slot은 int여야 합니다
api.set_namespace(slot="0", namespace="NewNs")   # TypeError
api.set_namespace(slot=True, namespace="NewNs")  # TypeError

# TypeError: namespace는 str이어야 합니다
api.set_namespace(slot=0, namespace=123)          # TypeError

# ValueError: 빈 네임스페이스
api.set_namespace(slot=0, namespace="   ")        # ValueError

# ValueError: 다른 슬롯이 이미 "Mable"을 사용 중일 때
api.set_namespace(slot=0, namespace="Mable")      # ValueError

파이프라인 활용 예시

from os_fast_ref.api import FastRefAPI

api = FastRefAPI()
refs = api.get_reference_list()

# 현재 네임스페이스 목록 출력
for r in refs:
    print(f"Slot {r['slot']}: {r['namespace']}")

# 슬롯 2의 네임스페이스를 파이프라인 규칙에 맞게 변경
result = api.set_namespace(slot=2, namespace="Enemy_A")
if result["success"]:
    print(f"Renamed to: {result['namespace']}")
    api.update_ui()

💬

Need help with the API?

Open a support ticket or join the community discussion.

문의하기