1 | -- ogreToolbar.mcr |
---|
2 | -- |
---|
3 | -- Banania - 2004 |
---|
4 | -- |
---|
5 | -- Macroscript for the Ogre Toolbar 2.0 |
---|
6 | -- |
---|
7 | -- Thanks to John Martin and Etienne Mallard for the work they did in the previous versions |
---|
8 | -- |
---|
9 | |
---|
10 | -- library functions |
---|
11 | include "ogre/lib/ogreSkeletonLib.ms" |
---|
12 | include "ogre/lib/ogreMaterialLib.ms" |
---|
13 | include "ogre/lib/ogreMaterialPlugin.ms" |
---|
14 | |
---|
15 | macroScript showOgreExportTools |
---|
16 | category:"Ogre Tools" |
---|
17 | internalCategory:"Ogre Tools" |
---|
18 | buttonText:"Ogre Exporter" |
---|
19 | tooltip:"Ogre Exporter" |
---|
20 | Icon:#("Maintoolbar",49) |
---|
21 | ( |
---|
22 | -- create a floater |
---|
23 | OgreExportFloater = newRolloutFloater "Ogre Exporter - 1.19" 280 800 ; |
---|
24 | |
---|
25 | rollout OgreExportOptions "Options" width:270 height:140 rolledUp:true |
---|
26 | ( |
---|
27 | button openScript "open OgreScript.ini" pos:[7,8] width:116 height:26 toolTip:"open the script to edit your settings" |
---|
28 | checkbox CBconvertXML "convert XML file after export" pos:[8,42] width:255 height:22 checked:true |
---|
29 | label lbl01 "XML Converter Program" pos:[8,64] width:256 height:18 |
---|
30 | editText editXMLconverter "" pos:[7,80] width:253 height:23 |
---|
31 | button browseXMLconverter "Browse" pos:[188,106] width:72 height:25 toolTip:"choose your XML converter" |
---|
32 | groupBox grp1 "Conversion settings" pos:[8,132] width:254 height:125 |
---|
33 | checkbox CBgenerateedges "Generate Edges List (for stencil shadows)" pos:[12,145] width:245 height:20 checked:true |
---|
34 | checkbox CBgeneratetangents "Generate Tangent Vectors (for normal mapping)" pos:[12,163] width:245 height:20 checked:false |
---|
35 | checkbox CBgenerateLOD "Generate LOD" pos:[12,181] width:245 height:20 checked:false |
---|
36 | label lbl02 "LOD levels" pos:[30,200] width:156 height:18 |
---|
37 | label lbl03 "LOD distance" pos:[30,218] width:156 height:18 |
---|
38 | label lbl04 "LOD reduction (%)" pos:[30,236] width:156 height:18 |
---|
39 | spinner SPlodlevels "" pos:[120,200] width:114 height:16 range:[1,20,1] type:#integer scale:1 enabled:false |
---|
40 | spinner SPloddistance "" pos:[120,218] width:114 height:16 range:[0.0,100000.0,10.0] type:#float scale:1.0 enabled:false |
---|
41 | spinner SPlodreduction "" pos:[120,236] width:114 height:16 range:[0.0,100.0,20.0] type:#float scale:5.0 enabled:false |
---|
42 | |
---|
43 | on CBgenerateLOD changed state do |
---|
44 | ( |
---|
45 | SPlodlevels.enabled = state; |
---|
46 | SPloddistance.enabled = state; |
---|
47 | SPlodreduction.enabled = state; |
---|
48 | ) |
---|
49 | on openScript pressed do |
---|
50 | ( |
---|
51 | shellLaunch ((getDir #scripts) + "\\ogre\\ogreScript.ini") "" ; |
---|
52 | ) |
---|
53 | on CBconvertXML changed state do |
---|
54 | ( |
---|
55 | if (state and (editXMLconverter.text!="")) then |
---|
56 | ( |
---|
57 | if (not (doesFileExist editXMLconverter.text)) then |
---|
58 | ( |
---|
59 | editXMLconverter.text = "The file/directory specified in the .ini for the XML converter does not exist !"; |
---|
60 | CBconvertXML.checked = false; |
---|
61 | ) |
---|
62 | ) |
---|
63 | ) |
---|
64 | on browseXMLconverter pressed do |
---|
65 | ( |
---|
66 | filename = getOpenFileName types:"Executables(*.exe)|*.exe|" ; |
---|
67 | if (filename != undefined) then |
---|
68 | ( |
---|
69 | editXMLconverter.text = filename ; |
---|
70 | CBconvertXML.checked = true; |
---|
71 | if (not (doesFileExist editXMLconverter.text)) then |
---|
72 | ( |
---|
73 | editXMLconverter.text = "The file/directory specified in the .ini for the XML converter does not exist !"; |
---|
74 | CBconvertXML.checked = false; |
---|
75 | ) |
---|
76 | else |
---|
77 | ( |
---|
78 | xmlConvPath = getFilenamePath editXMLconverter.text; |
---|
79 | xmlexe = getFilenameFile editXMLconverter.text; |
---|
80 | setINISetting ((getDir #scripts) + "\\ogre\\ogreScript.ini") "Directories" "XMLConverterPath" xmlConvPath; |
---|
81 | setINISetting ((getDir #scripts) + "\\ogre\\ogreScript.ini") "Exe" "XMLConverterExe" xmlexe; |
---|
82 | ) |
---|
83 | ) |
---|
84 | ) |
---|
85 | on OgreExportOptions open do |
---|
86 | ( |
---|
87 | runXMLConverter = getINISetting ((getDir #scripts) + "\\ogre\\ogreScript.ini") "Tools" "runXMLConverter" |
---|
88 | if (runXMLConverter=="yes") then |
---|
89 | ( |
---|
90 | CBconvertXML.enabled = true; |
---|
91 | CBconvertXML.checked = true; |
---|
92 | ) |
---|
93 | else |
---|
94 | ( |
---|
95 | CBconvertXML.enabled = false; |
---|
96 | ) |
---|
97 | |
---|
98 | xmlConvPath = getINISetting ((getDir #scripts) + "\\ogre\\ogreScript.ini") "Directories" "XMLConverterPath" |
---|
99 | xmlexe = getINISetting ((getDir #scripts) + "\\ogre\\ogreScript.ini") "Exe" "XMLConverterExe" |
---|
100 | |
---|
101 | ext = substring xmlexe (xmlexe.count-4) 4; |
---|
102 | if ( (ext[2]!="e" and ext[2]!="E") or (ext[3]!="x" and ext[3]!="X") or (ext[4]!="e" and ext[4]!="E") ) then |
---|
103 | editXMLconverter.text = xmlConvPath + "\\" + xmlexe + ".exe"; |
---|
104 | else |
---|
105 | editXMLconverter.text = xmlConvPath + "\\" + xmlexe; |
---|
106 | |
---|
107 | print editXMLconverter.text; |
---|
108 | if (not (doesFileExist editXMLconverter.text)) then |
---|
109 | ( |
---|
110 | editXMLconverter.text = "The file/directory specified in the .ini for the XML converter does not exist !"; |
---|
111 | CBconvertXML.checked = false; |
---|
112 | ) |
---|
113 | else |
---|
114 | ( |
---|
115 | CBconvertXML.checked = true; |
---|
116 | ) |
---|
117 | ) |
---|
118 | on OgreExportOptions close do |
---|
119 | ( |
---|
120 | |
---|
121 | ) |
---|
122 | ) |
---|
123 | |
---|
124 | rollout OgreExportObject "Object" width:270 height:259 |
---|
125 | ( |
---|
126 | label lbl01 "Selected Object :" pos:[6,35] width:260 height:17 |
---|
127 | editText editObject "" pos:[0,51] width:263 height:20 |
---|
128 | button selectMesh "Select a mesh..." pos:[115,2] width:152 height:28 toolTip:"select the mesh you want to export" |
---|
129 | spinner SPscale "Scale" pos:[149,75] width:114 height:16 range:[0.0,1000.0,1.0] type:#float scale:0.1 |
---|
130 | checkbox CBFlipYZ "Flip Y/Z" pos:[203,96] width:60 height:19 checked:true |
---|
131 | groupBox grp1 "Output" pos:[8,112] width:254 height:75 |
---|
132 | label lbl03 "File name" pos:[17,125] width:238 height:17 |
---|
133 | editText editFilename "" pos:[11,140] width:242 height:22 |
---|
134 | button chooseFilename "Browse" pos:[170,164] width:82 height:20 toolTip:"chooose the name of your output files" |
---|
135 | button export "Export !" pos:[29,191] width:214 height:40 toolTip:"export your mesh, skeleton ......" |
---|
136 | progressBar exportProgress pos:[9,235] width:250 height:10 |
---|
137 | |
---|
138 | on OgreExportObject open do |
---|
139 | ( |
---|
140 | if (maxOps.productAppID == #max) then |
---|
141 | g_MAX = false; |
---|
142 | else |
---|
143 | g_MAX = true; |
---|
144 | |
---|
145 | lastFile = getINISetting ((getDir #scripts) + "\\ogre\\ogreScript.ini") "Settings" "lastFile" |
---|
146 | lastAnimName = getINISetting ((getDir #scripts) + "\\ogre\\ogreScript.ini") "Settings" "lastAnimName" |
---|
147 | lastfirstFrame = getINISetting ((getDir #scripts) + "\\ogre\\ogreScript.ini") "Settings" "lastFrameStart" |
---|
148 | lastlastFrame = getINISetting ((getDir #scripts) + "\\ogre\\ogreScript.ini") "Settings" "lastFrameEnd" |
---|
149 | lastAnimLength = getINISetting ((getDir #scripts) + "\\ogre\\ogreScript.ini") "Settings" "lastAnimLength" |
---|
150 | lastScale = getINISetting ((getDir #scripts) + "\\ogre\\ogreScript.ini") "Settings" "lastScale" |
---|
151 | |
---|
152 | editFilename.text = lastFile ; |
---|
153 | OgreExportMesh.CBexportUV.checked = true ; |
---|
154 | CBFlipYZ.checked = true ; |
---|
155 | SPscale.value = lastScale as Float; |
---|
156 | if (SPscale.value == 0.0) then |
---|
157 | SPscale.value = 1.0; |
---|
158 | |
---|
159 | select = getCurrentSelection() ; |
---|
160 | if ((select[1]!=undefined) and (iskindof select[1] GeometryClass)) then |
---|
161 | ( |
---|
162 | editObject.text = select[1].name ; |
---|
163 | OgreExportMesh.CBexportMesh.enabled = true; |
---|
164 | OgreExportMesh.CBexportMesh.checked = true; |
---|
165 | OgreExportMesh.CBflipnormals.enabled = true ; |
---|
166 | OgreExportMesh.CBexportColor.enabled = true ; |
---|
167 | OgreExportMesh.CBexportUV.enabled = true ; |
---|
168 | OgreExportMesh.CBexportUV.checked = true ; |
---|
169 | OgreExportMesh.SPchannels.enabled = true ; |
---|
170 | OgreExportAnimation.CBexportSkeleton.enabled = (getSkin(select[1]) != undefined) or (getPhysique(select[1]) != undefined) ; |
---|
171 | ) |
---|
172 | ) |
---|
173 | on OgreExportObject close do |
---|
174 | ( |
---|
175 | |
---|
176 | ) |
---|
177 | on selectMesh pressed do |
---|
178 | ( |
---|
179 | max tool hlist ; |
---|
180 | select = getCurrentSelection() ; |
---|
181 | if ((select[1]!=undefined) and (iskindof select[1] GeometryClass)) then |
---|
182 | ( |
---|
183 | editObject.text = select[1].name ; |
---|
184 | |
---|
185 | -- options accessible ou non |
---|
186 | OgreExportMesh.CBexportMesh.enabled = true; |
---|
187 | OgreExportMesh.CBexportMesh.checked = true; |
---|
188 | OgreExportMesh.CBflipnormals.enabled = true ; |
---|
189 | OgreExportMesh.CBexportColor.enabled = true ; |
---|
190 | OgreExportMesh.CBexportUV.enabled = true ; |
---|
191 | OgreExportMesh.CBexportUV.checked = true ; |
---|
192 | OgreExportMesh.SPchannels.enabled = true ; |
---|
193 | OgreExportAnimation.CBexportSkeleton.enabled = (getSkin(select[1]) != undefined) or (getPhysique(select[1]) != undefined) ; |
---|
194 | ) |
---|
195 | ) |
---|
196 | on chooseFilename pressed do |
---|
197 | ( |
---|
198 | filename = getSaveFileName types:"All Files(*.*)|*.*|" ; |
---|
199 | if (filename != undefined) then |
---|
200 | ( |
---|
201 | editFilename.text = filename ; |
---|
202 | ) |
---|
203 | ) |
---|
204 | |
---|
205 | ------------------------------------- |
---|
206 | -- EXPORT --------------------------- |
---|
207 | ------------------------------------- |
---|
208 | on export pressed do |
---|
209 | ( |
---|
210 | sliderTime = 0 ; |
---|
211 | m = execute ("$" + (replaceSpaces editObject.text)) ; |
---|
212 | if (editFilename.text == "" or m == undefined ) then |
---|
213 | ( |
---|
214 | messageBox "You have to choose a filename and a valid object." ; |
---|
215 | ) |
---|
216 | else |
---|
217 | ( |
---|
218 | clearlistener() ; |
---|
219 | |
---|
220 | if (SPscale.value == 0.0) then |
---|
221 | SPscale.value = 1.0; |
---|
222 | |
---|
223 | Options = exportOptions scale:SPscale.value flipYZ:false flipNormal:false exportColours:false exportUV:false ; |
---|
224 | exportingMeshDone = false ; |
---|
225 | exportingSkelDone = false ; |
---|
226 | -- sets options |
---|
227 | --------------- |
---|
228 | if (CBFlipYZ.checked) then |
---|
229 | Options.flipYZ= true ; |
---|
230 | if (OgreExportMesh.CBflipnormals.checked and OgreExportMesh.CBflipnormals.enabled) then |
---|
231 | Options.flipNormal = true ; |
---|
232 | if (OgreExportMesh.CBexportColor.checked and OgreExportMesh.CBexportColor.enabled) then |
---|
233 | Options.exportColours = true ; |
---|
234 | if (OgreExportMesh.CBexportUV.checked and OgreExportMesh.CBexportUV.enabled) then |
---|
235 | ( |
---|
236 | Options.exportUV = true ; |
---|
237 | Options.UVchannels = OgreExportMesh.SPchannels.value; |
---|
238 | ) |
---|
239 | Options.exportHelpers = (OgreExportAnimation.CBexporthelpers.enabled and OgreExportAnimation.CBexporthelpers.checked); |
---|
240 | |
---|
241 | if (not g_MAX) then |
---|
242 | setINISetting ((getDir #scripts) + "\\ogre\\ogreScript.ini") "Settings" "lastScale" (SPscale.value as string) |
---|
243 | |
---|
244 | -- exports mesh |
---|
245 | --------------- |
---|
246 | if (OgreExportMesh.CBexportMesh.enabled and OgreExportMesh.CBexportMesh.checked) then |
---|
247 | ( |
---|
248 | if (not g_MAX) then |
---|
249 | setINISetting ((getDir #scripts) + "\\ogre\\ogreScript.ini") "Settings" "lastFile" editFilename.text |
---|
250 | --progressStart "Mesh Export" ; |
---|
251 | exportingMeshDone = writeMesh m Options (editFilename.text) ; |
---|
252 | --progressStop ; |
---|
253 | ) |
---|
254 | |
---|
255 | -- exports skeleton |
---|
256 | ------------------- |
---|
257 | if (OgreExportAnimation.CBexportSkeleton.enabled and OgreExportAnimation.CBexportSkeleton.checked) then |
---|
258 | ( |
---|
259 | Options.sampleRate = OgreExportAnimation.SPsamplerate.value ; |
---|
260 | Options.ikSampleRate = OgreExportAnimation.SPiksamplerate.value ; |
---|
261 | |
---|
262 | exportingSkelDone = writeSkeleton m Options Anims editFilename.text ; |
---|
263 | ) |
---|
264 | |
---|
265 | -- exports material |
---|
266 | if (OgreExportMaterial.CBexportmaterial.enabled and OgreExportMaterial.CBexportmaterial.checked) then |
---|
267 | ( |
---|
268 | select = getCurrentSelection() ; |
---|
269 | if ((select[1]!=undefined) and (iskindof select[1] GeometryClass)) then |
---|
270 | ( |
---|
271 | mat = select[1].material |
---|
272 | if (exportSomeMaterial!=undefined) then -- export with Octopus functions |
---|
273 | ( |
---|
274 | local outFile ; |
---|
275 | if (not g_MAX) then |
---|
276 | ( |
---|
277 | outFile = createfile (editFilename.text + ".material"); |
---|
278 | ) |
---|
279 | else |
---|
280 | ( |
---|
281 | ClearListener(); |
---|
282 | if (g_MAX_use_listener) then |
---|
283 | format("<ogrestartfile>%</ogrestartfile><ogrestartdata>\n") (editFilename.text + ".material"); |
---|
284 | outFile = listener; |
---|
285 | ) |
---|
286 | |
---|
287 | exportSomeMaterial mat "" outFile; |
---|
288 | |
---|
289 | if (not g_MAX) then |
---|
290 | ( |
---|
291 | close outFile ; |
---|
292 | ) |
---|
293 | else |
---|
294 | ( |
---|
295 | if (g_MAX_use_listener) then |
---|
296 | format("</ogrestartdata>\n") to: outFile; |
---|
297 | ) |
---|
298 | ) |
---|
299 | else |
---|
300 | ( |
---|
301 | exportMaterial mat (editFilename.text + ".material"); |
---|
302 | ) |
---|
303 | ) |
---|
304 | ) |
---|
305 | |
---|
306 | -- post traitement |
---|
307 | ------------------ |
---|
308 | if (exportingMeshDone or exportingSkelDone) then |
---|
309 | ( |
---|
310 | if (OgreExportOptions.CBconvertXML.checked) then |
---|
311 | ( |
---|
312 | if (not g_MAX) then |
---|
313 | ( |
---|
314 | OptionConv = ""; |
---|
315 | mediaPath = getINISetting ((getDir #scripts) + "\\ogre\\ogreScript.ini") "Directories" "MediaPath" |
---|
316 | |
---|
317 | if (exportingMeshDone) then |
---|
318 | ( |
---|
319 | if (OgreExportOptions.CBgenerateedges.enabled==false or OgreExportOptions.CBgenerateedges.checked==false) then |
---|
320 | OptionConv = OptionConv + " -e"; |
---|
321 | if (OgreExportOptions.CBgeneratetangents.enabled and OgreExportOptions.CBgeneratetangents.checked) then |
---|
322 | ( |
---|
323 | if (OgreExportMesh.CBexportUV.enabled and OgreExportMesh.CBexportUV.checked and (OgreExportMesh.SPchannels.value>0)) then |
---|
324 | OptionConv = OptionConv + " -t"; |
---|
325 | else |
---|
326 | messageBox "Tangent vectors cannot be generated without UV sets. Generation will be deactivated." ; |
---|
327 | ) |
---|
328 | if (OgreExportOptions.CBgeneratelod.enabled and OgreExportOptions.CBgeneratelod.checked) then |
---|
329 | OptionConv = OptionConv + " -l " + (OgreExportOptions.SPlodlevels.value as string) + " -d " + (OgreExportOptions.SPloddistance.value as string) + " -p " + (OgreExportOptions.SPlodreduction.value as string); |
---|
330 | |
---|
331 | DOSCommand (OgreExportOptions.editXMLconverter.text + OptionConv + " \"" + editFilename.text + ".mesh.xml\" \"" + editFilename.text + ".mesh\"") ; |
---|
332 | DOSCommand ("copy \"" + editFilename.text + ".mesh\" \"" + mediaPath + "\"") ; |
---|
333 | ) |
---|
334 | if (exportingSkelDone) then |
---|
335 | ( |
---|
336 | DOSCommand (OgreExportOptions.editXMLconverter.text + " \"" + editFilename.text + ".skeleton.xml\" \"" + editFilename.text + ".skeleton\"") ; |
---|
337 | DOSCommand ("copy \"" + editFilename.text + ".skeleton\" \"" + mediaPath + "\"") ; |
---|
338 | ) |
---|
339 | messageBox "OgreXMLConverter has been run and files copied to the media directory." |
---|
340 | print (OgreExportOptions.editXMLconverter.text + OptionConv + " \"" + editFilename.text + ".mesh.xml\" \"" + editFilename.text + ".mesh\"") ; |
---|
341 | ) |
---|
342 | else |
---|
343 | ( |
---|
344 | messageBox "gmax cannot launch XMLConverter due to its limitations..." |
---|
345 | ) |
---|
346 | ) |
---|
347 | ) |
---|
348 | ) |
---|
349 | ) |
---|
350 | ) |
---|
351 | |
---|
352 | rollout OgreExportMesh "Mesh" width:270 height:120 |
---|
353 | ( |
---|
354 | checkbox CBexportMesh "Export Mesh" pos:[5,5] width:150 height:17 |
---|
355 | groupBox grp2 "Export settings" pos:[4,25] width:262 height:102 |
---|
356 | checkbox CBflipnormals "Flip normals" pos:[14,42] width:140 height:19 |
---|
357 | checkbox CBexportUV "Export UV sets" pos:[14,64] width:140 height:20 |
---|
358 | spinner SPchannels "# UV channels" pos:[36,85] width:173 height:16 range:[1,8,1] type:#integer scale:1 |
---|
359 | checkbox CBexportColor "Export Vertex Color" pos:[13,105] width:140 height:19 |
---|
360 | on OgreExportMesh open do |
---|
361 | ( |
---|
362 | OgreExportMesh.CBexportMesh.enabled = false; |
---|
363 | OgreExportMesh.CBexportMesh.checked = true; |
---|
364 | OgreExportMesh.CBflipnormals.enabled = false ; |
---|
365 | OgreExportMesh.CBexportColor.enabled = false ; |
---|
366 | OgreExportMesh.CBexportUV.enabled = false ; |
---|
367 | OgreExportMesh.CBexportUV.checked = true ; |
---|
368 | OgreExportMesh.SPchannels.enabled = false ; |
---|
369 | |
---|
370 | select = getCurrentSelection() ; |
---|
371 | if ((select[1]!=undefined) and (iskindof select[1] GeometryClass)) then |
---|
372 | ( |
---|
373 | OgreExportMesh.CBexportMesh.enabled = true; |
---|
374 | OgreExportMesh.CBexportMesh.checked = true; |
---|
375 | OgreExportMesh.CBflipnormals.enabled = true ; |
---|
376 | OgreExportMesh.CBexportColor.enabled = true ; |
---|
377 | OgreExportMesh.CBexportUV.enabled = true ; |
---|
378 | if (classof select[1] == Editable_Mesh) then |
---|
379 | ( |
---|
380 | if (getNumTVerts select[1] == 0) then |
---|
381 | OgreExportMesh.CBexportUV.checked = false ; |
---|
382 | else |
---|
383 | OgreExportMesh.CBexportUV.checked = true ; |
---|
384 | ) |
---|
385 | else |
---|
386 | ( |
---|
387 | OgreExportMesh.CBexportUV.checked = false ; |
---|
388 | ) |
---|
389 | OgreExportMesh.SPchannels.enabled = true ; |
---|
390 | ) |
---|
391 | ) |
---|
392 | on OgreExportMesh close do |
---|
393 | ( |
---|
394 | |
---|
395 | ) |
---|
396 | on CBexportMesh changed state do |
---|
397 | ( |
---|
398 | OgreExportMesh.CBflipnormals.enabled = state ; |
---|
399 | OgreExportMesh.CBexportColor.enabled = state ; |
---|
400 | OgreExportMesh.CBexportUV.enabled = state ; |
---|
401 | OgreExportMesh.SPchannels.enabled = state ; |
---|
402 | ) |
---|
403 | on CBexportUV changed state do |
---|
404 | ( |
---|
405 | SPchannels.enabled = state ; |
---|
406 | ) |
---|
407 | on SPchannels changed state do |
---|
408 | ( |
---|
409 | name = OgreExportObject.editObject.text; |
---|
410 | replaceSpaces name; |
---|
411 | d = execute ("$" + name); |
---|
412 | num_channels = (meshOp.getNumMaps d) - 1; |
---|
413 | if (state > num_channels) then |
---|
414 | SPchannels.value = num_channels; |
---|
415 | ) |
---|
416 | ) |
---|
417 | |
---|
418 | rollout OgreExportAnimation "Animation" width:270 height:347 |
---|
419 | ( |
---|
420 | checkbox CBexportSkeleton "Export Skeleton" pos:[5,4] width:150 height:19 enabled:false |
---|
421 | groupBox grp3 "Export settings" pos:[4,26] width:262 height:76 |
---|
422 | --checkbox CBbiped "Biped Export" pos:[13,44] width:246 height:19 enabled:false |
---|
423 | spinner SPsamplerate "Sample Rate" pos:[11,45] width:186 height:16 enabled:false range:[0.0,10000,0.0] type:#float scale:0.5 |
---|
424 | spinner SPiksamplerate "IK Sample Rate" pos:[17,63] width:180 height:16 enabled:false range:[0.0,10000,5.0] type:#float scale:0.5 |
---|
425 | checkbox CBexporthelpers "Export non-bones objects (must be in the modifier)" pos:[11,81] width:254 height:16 enabled:false checked:false |
---|
426 | groupBox grp4 "Animation settings" pos:[4,106] width:261 height:252 |
---|
427 | button getFromModifier "<-" pos:[14,124] width:61 height:21 enabled:false toolTip:"retrieve information from OctopusExport Modifier" |
---|
428 | label lbl4 "Get settings from Octopus modifier" pos:[86,128] width:167 height:14 enabled:true |
---|
429 | groupBox grp5 "Animations" pos:[8,149] width:253 height:203 |
---|
430 | button addAnimation "Add" pos:[16,164] width:80 height:22 enabled:false toolTip:"add an animation to the list" |
---|
431 | button deleteAnimation "Delete" pos:[172,165] width:80 height:22 enabled:false toolTip:"remove an animation from the list" |
---|
432 | comboBox ListAnimations "" pos:[17,191] width:235 height:6 enabled:false |
---|
433 | label lbl5 "Frames" pos:[17,290] width:236 height:16 |
---|
434 | spinner SPframestart "from" pos:[25,307] width:106 height:16 enabled:false range:[0,10000,0] type:#integer scale:1 |
---|
435 | spinner SPframeend "to" pos:[154,307] width:96 height:16 enabled:false range:[0,10000,100] type:#integer scale:1 |
---|
436 | label lbl6 "Length (in seconds)" pos:[18,330] width:115 height:16 |
---|
437 | spinner SPanimlength "" pos:[120,329] width:130 height:16 range:[0,10000,10] type:#float scale:0.1 |
---|
438 | on OgreExportAnimation open do |
---|
439 | ( |
---|
440 | OgreExportAnimation.CBexportSkeleton.enabled = false; |
---|
441 | --OgreExportAnimation.CBbiped.enabled = false; |
---|
442 | --OgreExportAnimation.CBbiped.checked = false; |
---|
443 | OgreExportAnimation.getFromModifier.enabled = false; |
---|
444 | OgreExportAnimation.SPsamplerate.enabled = false; |
---|
445 | OgreExportAnimation.SPiksamplerate.enabled = false; |
---|
446 | OgreExportAnimation.CBexporthelpers.enabled = false; |
---|
447 | OgreExportAnimation.addAnimation.enabled = false; |
---|
448 | OgreExportAnimation.deleteAnimation.enabled = false; |
---|
449 | OgreExportAnimation.ListAnimations.enabled = false; |
---|
450 | OgreExportAnimation.SPframestart.enabled = false; |
---|
451 | OgreExportAnimation.SPframeend.enabled = false; |
---|
452 | OgreExportAnimation.SPanimlength.enabled = false; |
---|
453 | |
---|
454 | select = getCurrentSelection() ; |
---|
455 | if ((select[1]!=undefined) and (iskindof select[1] GeometryClass)) then |
---|
456 | ( |
---|
457 | OgreExportAnimation.CBexportSkeleton.enabled = (getSkin(select[1]) != undefined) or (getPhysique(select[1]) != undefined) ; |
---|
458 | if (OgreExportAnimation.CBexportSkeleton.enabled and OgreExportAnimation.CBexportSkeleton.checked) then |
---|
459 | ( |
---|
460 | --OgreExportAnimation.CBbiped.enabled = true; |
---|
461 | --OgreExportAnimation.CBbiped.checked = (getPhysique(select[1]) != undefined); |
---|
462 | OgreExportAnimation.getFromModifier.enabled = true; |
---|
463 | OgreExportAnimation.SPsamplerate.enabled = true; |
---|
464 | OgreExportAnimation.SPiksamplerate.enabled = true; |
---|
465 | OgreExportAnimation.CBexporthelpers.enabled = true; |
---|
466 | OgreExportAnimation.addAnimation.enabled = true; |
---|
467 | OgreExportAnimation.deleteAnimation.enabled = true; |
---|
468 | OgreExportAnimation.ListAnimations.enabled = true; |
---|
469 | OgreExportAnimation.SPframestart.enabled = true; |
---|
470 | OgreExportAnimation.SPframeend.enabled = true; |
---|
471 | OgreExportAnimation.SPanimlength.enabled = true; |
---|
472 | ) |
---|
473 | ) |
---|
474 | |
---|
475 | Anims = exportAnims names:#() startframes:#() endframes:#() lengths:#(); |
---|
476 | ) |
---|
477 | --on CBbiped changed state do |
---|
478 | --( |
---|
479 | --) |
---|
480 | on CBexportSkeleton changed state do |
---|
481 | ( |
---|
482 | select = getCurrentSelection() ; |
---|
483 | if ((select[1]!=undefined) and (iskindof select[1] GeometryClass)) then |
---|
484 | ( |
---|
485 | --OgreExportAnimation.CBbiped.enabled = state; |
---|
486 | --OgreExportAnimation.CBbiped.checked = (getPhysique(select[1]) != undefined); |
---|
487 | OgreExportAnimation.getFromModifier.enabled = state; |
---|
488 | OgreExportAnimation.SPsamplerate.enabled = state; |
---|
489 | OgreExportAnimation.SPiksamplerate.enabled = state; |
---|
490 | OgreExportAnimation.CBexporthelpers.enabled = state; |
---|
491 | OgreExportAnimation.addAnimation.enabled = state; |
---|
492 | OgreExportAnimation.deleteAnimation.enabled = state; |
---|
493 | OgreExportAnimation.ListAnimations.enabled = state; |
---|
494 | OgreExportAnimation.SPframestart.enabled = state; |
---|
495 | OgreExportAnimation.SPframeend.enabled = state; |
---|
496 | OgreExportAnimation.SPanimlength.enabled = state; |
---|
497 | ) |
---|
498 | ) |
---|
499 | on OgreExportAnimation close do |
---|
500 | ( |
---|
501 | |
---|
502 | ) |
---|
503 | on getFromModifier pressed do |
---|
504 | ( |
---|
505 | select = getCurrentSelection() |
---|
506 | if ((select[1]!=undefined) and (iskindof select[1] GeometryClass)) then |
---|
507 | ( |
---|
508 | max modify mode ; |
---|
509 | --if (select[1].modifiers["OctopusExport"]!=undefined) then |
---|
510 | -- modPanel.setCurrentObject select[1].modifiers["OctopusExport"] ; |
---|
511 | octexp = getOctopusExport select[1]; |
---|
512 | |
---|
513 | if (octexp!=undefined) then |
---|
514 | ( |
---|
515 | local array=#(); |
---|
516 | for n in octexp.anames do |
---|
517 | append array n; |
---|
518 | |
---|
519 | ListAnimations.items = array; |
---|
520 | ListAnimations.selection = 1; |
---|
521 | |
---|
522 | Anims.names = array; |
---|
523 | |
---|
524 | array=#(); |
---|
525 | for n in octexp.afframes do |
---|
526 | append Anims.startframes n; |
---|
527 | |
---|
528 | array=#(); |
---|
529 | for n in octexp.alframes do |
---|
530 | append Anims.endframes n; |
---|
531 | |
---|
532 | array=#(); |
---|
533 | for n in octexp.artimes do |
---|
534 | append Anims.lengths n; |
---|
535 | |
---|
536 | if (ListAnimations.items.count!=0) then |
---|
537 | ( |
---|
538 | SPframestart.value = Anims.startframes[1] |
---|
539 | SPframeend.value = Anims.endframes[1] |
---|
540 | SPanimlength.value = Anims.lengths[1] |
---|
541 | ) |
---|
542 | ) |
---|
543 | ) |
---|
544 | ) |
---|
545 | on addAnimation pressed do |
---|
546 | ( |
---|
547 | if (ListAnimations.text != "") then |
---|
548 | ( |
---|
549 | local array=#(); |
---|
550 | for n in ListAnimations.items do |
---|
551 | append array n; |
---|
552 | append array ListAnimations.text; |
---|
553 | ListAnimations.items = array; |
---|
554 | append Anims.names ListAnimations.items[ListAnimations.items.count]; |
---|
555 | append Anims.startframes SPframestart.value; |
---|
556 | append Anims.endframes SPframeend.value; |
---|
557 | append Anims.lengths SPanimlength.value; |
---|
558 | ListAnimations.selection = 0; |
---|
559 | ) |
---|
560 | ) |
---|
561 | on deleteAnimation pressed do |
---|
562 | ( |
---|
563 | if ((ListAnimations.items.count > 0) and (ListAnimations.selection > 0)) then |
---|
564 | ( |
---|
565 | local array=#(); |
---|
566 | ind = ListAnimations.selection |
---|
567 | deleteItem Anims.names ind |
---|
568 | deleteItem Anims.startframes ind |
---|
569 | deleteItem Anims.endframes ind |
---|
570 | deleteItem Anims.lengths ind |
---|
571 | for n in Anims.names do |
---|
572 | append array n; |
---|
573 | ListAnimations.items = array; |
---|
574 | ListAnimations.selection = 1; |
---|
575 | ) |
---|
576 | ) |
---|
577 | on ListAnimations selected num do |
---|
578 | ( |
---|
579 | if (ListAnimations.items.count >= num) then |
---|
580 | ( |
---|
581 | SPframestart.value = Anims.startframes[num] |
---|
582 | SPframeend.value = Anims.endframes[num] |
---|
583 | SPanimlength.value = Anims.lengths[num] |
---|
584 | ) |
---|
585 | ) |
---|
586 | on SPframestart changed val do |
---|
587 | ( |
---|
588 | if ((ListAnimations.items.count > 0) and (ListAnimations.selection > 0)) then |
---|
589 | ( |
---|
590 | if (ListAnimations.text == Anims.names[ListAnimations.selection]) then |
---|
591 | Anims.startframes[ListAnimations.selection] = SPframestart.value; |
---|
592 | ) |
---|
593 | ) |
---|
594 | on SPframeend changed val do |
---|
595 | ( |
---|
596 | if ((ListAnimations.items.count > 0) and (ListAnimations.selection > 0)) then |
---|
597 | ( |
---|
598 | if (ListAnimations.text == Anims.names[ListAnimations.selection]) then |
---|
599 | Anims.endframes[ListAnimations.selection] = SPframeend.value; |
---|
600 | ) |
---|
601 | ) |
---|
602 | on SPanimlength changed val do |
---|
603 | ( |
---|
604 | if ((ListAnimations.items.count > 0) and (ListAnimations.selection > 0)) then |
---|
605 | ( |
---|
606 | if (ListAnimations.text == Anims.names[ListAnimations.selection]) then |
---|
607 | Anims.lengths[ListAnimations.selection] = SPanimlength.value; |
---|
608 | ) |
---|
609 | ) |
---|
610 | ) |
---|
611 | |
---|
612 | rollout OgreExportMaterial "Material" width:270 height:33 |
---|
613 | ( |
---|
614 | checkbox CBexportmaterial "Export Material" pos:[5,7] width:260 height:17 enabled:false |
---|
615 | on OgreExportMaterial open do |
---|
616 | ( |
---|
617 | CBexportmaterial.enabled = false; |
---|
618 | |
---|
619 | select = getCurrentSelection() ; |
---|
620 | if ((select[1]!=undefined) and (iskindof select[1] GeometryClass)) then |
---|
621 | ( |
---|
622 | CBexportmaterial.enabled = true; |
---|
623 | ) |
---|
624 | ) |
---|
625 | on OgreExportMaterial close do |
---|
626 | ( |
---|
627 | |
---|
628 | ) |
---|
629 | ) |
---|
630 | |
---|
631 | rollout OgreExportAbout "About" rolledUp:true |
---|
632 | ( |
---|
633 | label label11 "For use with the Ogre graphics engine." align:#center; |
---|
634 | label label12 "See website for details: http://ogre.sourceforge.net" align:#center; |
---|
635 | label label13 "This software is distributed under the terms of the LGPL." align:#center ; |
---|
636 | label label16 "Based on the exporter realised by" align:#center ; |
---|
637 | label label14 "EarthquakeProof - mallard@iie.cnam.fr (summer 2003)" align:#center ; |
---|
638 | label label15 "by Banania - November 2004" align:#center ; |
---|
639 | ) |
---|
640 | |
---|
641 | -- add the rollout, which contains the dialog |
---|
642 | addRollout OgreExportOptions OgreExportFloater ; |
---|
643 | addRollout OgreExportObject OgreExportFloater ; |
---|
644 | addRollout OgreExportMesh OgreExportFloater ; |
---|
645 | addRollout OgreExportAnimation OgreExportFloater ; |
---|
646 | addRollout OgreExportMaterial OgreExportFloater ; |
---|
647 | addRollout OgreExportAbout OgreExportFloater ; |
---|
648 | ) |
---|