버튼 클릭으로 선택 파츠 + 바이패드 자동선택 해서 선택 익스포트 또는 전체 익스포트 (선택 없을 때) 맥스 스크립트 함수 구문
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
|
----------------------------------------------------------------------------------------
-- btn_ExportSelected
----------------------------------------------------------------------------------------
on btn_ExportSelected pressed do
(
sel = selection[1]
if sel != undefined then
(
try (
if (not doesFileExist (maxFilePath + "fbx")) then makeDir (maxFilePath + "fbx")
local exportFilename = (getFilenameFile maxfilename)
-- 아바타 복식인 경우 (파일명 prefix로 구분)
if (matchPattern (getFilenameFile maxfilename) pattern:"m_*") then (
-- 남성 캐릭터 인 경우
selectMore $'Bip0*' -- 선택 오브젝트에 바이패드를 추가 선택
deselect $'Bip0* Footsteps' -- 바이패드 선택에서 풋스탭 제외
exportFilename = selection[1].name -- 익스포트 파일명은 선택 오브젝트 명으로
FBXExporterSetParam "ConvertUnit" "in" -- 익스포트 유닛은 인치로 고정
FBXExporterSetParam "Animation" false -- 애니메이션 익스포트 안함
print "Male Character"
)
else if (matchPattern (getFilenameFile maxfilename) pattern:"f_*") then (
-- 여성 캐릭터 인 경우
selectMore $'Bip0*'
deselect $'Bip0* Footsteps'
exportFilename = selection[1].name
FBXExporterSetParam "ConvertUnit" "in"
FBXExporterSetParam "Animation" false
print "Female Character"
)
else if (matchPattern (getFilenameFile maxfilename) pattern:"*_m_*") then (
-- 남성 캐릭터 파츠 인 경우
selectMore $'Bip0*'
deselect $'Bip0* Footsteps'
exportFilename = selection[1].name
FBXExporterSetParam "ConvertUnit" "in"
FBXExporterSetParam "Animation" false
print "Male Character Parts"
)
else if (matchPattern (getFilenameFile maxfilename) pattern:"*_f_*") then (
-- 여성 캐릭터 파츠 인 경우
selectMore $'Bip0*'
deselect $'Bip0* Footsteps'
exportFilename = selection[1].name
FBXExporterSetParam "ConvertUnit" "in"
FBXExporterSetParam "Animation" false
print "Female Character Parts"
)
-- 다른 형식의 파일인 경우 (파일명 prefix로 구분)
else if (matchPattern (getFilenameFile maxfilename) pattern:"v_a_*") then
(
exportFilename = substituteString (getFilenameFile maxfilename) "_riding" ""
-- 남성 캐릭터 인 경우 (애니메이션 파일 이름 자동 변경)
if (matchPattern (getFilenameFile maxfilename) pattern:"*_male") then (
exportFilename = substituteString exportFilename "v_a_2" "animation_riding_7"
exportFilename = substituteString exportFilename "_male" "_m"
)
-- 여성 캐릭터 인 경우 (애니메이션 파일 이름 자동 변경)
else if (matchPattern (getFilenameFile maxfilename) pattern:"*_female") then (
exportFilename = substituteString exportFilename "v_a_2" "animation_riding_7"
exportFilename = substituteString exportFilename "_female" "_f"
)
)
else
(
exportFilename = (getFilenameFile maxfilename)
)
-- 선택한 오브젝트가 있다면 Export Selected
exportFile (maxFilePath + "fbx\\" + exportFilename + ".FBX") #noPrompt selectedOnly:true using:FBXEXP
format "% File Save OK! (Selected)\n" (exportFilename + ".FBX")
)
catch (
print "Export Selected Object Error!"
)
)
else
(
try (
if (not doesFileExist (maxFilePath + "fbx")) then makeDir (maxFilePath + "fbx")
local exportFilename = (getFilenameFile maxfilename)
-- 다른 형식의 라이딩 파일인 경우 (파일명 prefix로 구분)
if (matchPattern (getFilenameFile maxfilename) pattern:"v_a_*") then
(
exportFilename = substituteString (getFilenameFile maxfilename) "_riding" ""
-- 남성 캐릭터 인 경우 (애니메이션 파일 이름 자동 변경)
if (matchPattern (getFilenameFile maxfilename) pattern:"*_male") then (
exportFilename = substituteString exportFilename "v_a_2" "animation_riding_7"
exportFilename = substituteString exportFilename "_male" "_m"
)
-- 여성 캐릭터 인 경우 (애니메이션 파일 이름 자동 변경)
else if (matchPattern (getFilenameFile maxfilename) pattern:"*_female") then (
exportFilename = substituteString exportFilename "v_a_2" "animation_riding_7"
exportFilename = substituteString exportFilename "_female" "_f"
)
)
else
(
exportFilename = (getFilenameFile maxfilename)
)
-- 오브젝트를 선택하지 않았다면 Export All
exportFile (maxFilePath + "fbx\\" + exportFilename + ".FBX") #noPrompt selectedOnly:false using:FBXEXP
format "% File Save OK! (Export All)\n" (exportFilename + ".FBX")
)
catch (
print "Export All Object Error!"
)
)
)
|
cs |
'Technical Art > 2024' 카테고리의 다른 글
[3dsmax script] Create Sliding Keys 바이패드 발에 키를 넣어보자 (1) | 2024.03.07 |
---|---|
[3dsmax script] 선택한 오브젝트 피봇 toZero / toReset 토글 (0) | 2024.03.07 |
[Unity Editor Script] 애니메이션 FBX 클립 설정 (일괄 변경 가능) (0) | 2024.03.07 |
[Unity Editor Script] 단축키로 메인씬 열고 실행하기 (1) | 2024.03.07 |
[3dsmax script] 황군 Time Config 스크립트에 이것저것 기능 추가한거 (0) | 2024.03.04 |