21
edits
Paradox-01 (talk | contribs) m (*.dae files are influenced by FPS, *.exp are not) |
(Update notice w/ summary) Tags: Mobile edit Mobile web edit |
||
| (76 intermediate revisions by 3 users not shown) | |||
| Line 1: | Line 1: | ||
{{update|This article contains links to the now defunct Oni Central Forum. Sections: Selected Wisdom}} | |||
Autodesk's Mod Tool used to be the main choice for modders when working on level and character models (at least in Windows, since it's Windows-only). It was a free and accessible program, but has long since been discontinued. Nowadays, modders are encouraged to use [[Blender]] instead. | |||
{| class="wikitable" style="float:right;" | |||
|width="200px"| | |||
: | ;sub pages | ||
: | : [[Mod_Tool/Scripting]] | ||
: | : [[Mod_Tool/Rigging]] | ||
: [[Mod_Tool/OniTools_addon]] | |||
: [[Mod_Tool/Oni_level_rebuilder]] | |||
|} | |||
==Installation== | |||
Full name: "Autodesk Softimage Mod Tool". Usually we just call it "Mod Tool" or "XSI", the old name of the program. | |||
'''Download''' | |||
* '''Get it from [https://www.moddb.com/downloads/autodesk-softimage-mod-tool-75 Mod DB].''' | |||
* It's no longer possible to download Softimage from Autodesk because the [https://www.autodesk.com/products/softimage/overview software was discontinued] by Autodesk in favor of their major software packages Maya and 3ds Max. | |||
''' | '''Newer Windows installations usually require .NET 2.0 to be installed before the XSI installer can fully run.''' | ||
: Downloading and installing .Net 2.0 manually from the internet might not work. | |||
: '''Therefore use the Windows search and look for "features".''' (Enable/disable Windows features.) | |||
: From the Windows feature page install '''".NET framework 3.5 (includes .NET 2.0 and 3.0)"'''. | |||
There are various ways to extend Mod Tool's range of functions: scripts (.vbs, .js), toolbars (.xsitb) and addons (.xsiaddon). They can be created on one's own and also shared with other users. | |||
==Extensions== | ===Extensions=== | ||
'''links''' | '''links''' | ||
* [ | * [https://www.si-community.com/community/viewtopic.php?f=35&t=796 "Roadkill" UV Tool] | ||
* [http://www.xsidatabase.com/content/drag_and_drop_obj_files_jscript drag and drop support for OBJ files] | * [http://web.archive.org/web/20121001104022/http://www.xsidatabase.com:80/content/drag_and_drop_obj_files_jscript drag and drop support for OBJ files] | ||
* [ | * [https://www.si-community.com/community/viewtopic.php?f=35&t=797 OBJ exporter] | ||
* [http://mods.oni2.net/node/210 OBJ + OFGA exporter] for Oni | * [http://mods.oni2.net/node/210 OBJ + OFGA exporter] for Oni | ||
** might need the regular OBJ exporter to be installed first | ** might need the regular OBJ exporter to be installed first | ||
* [http://mods.oni2.net/node/210 adjusting existing fw throws] [ | * [http://mods.oni2.net/node/210 adjusting existing fw throws] [https://www.youtube.com/watch?v=vDTPYfvMf4M (instructions)] | ||
| Line 54: | Line 58: | ||
''' | '''building add-ons (<nowiki>http://softimage.wiki.softimage.com/sdkdocs/cus_addons_WalkthroughBuildinganAddon.htm</nowiki>, dead link)''' | ||
* Building an add-on file needs more effort than the other 'extensions' but for the end user it's best because it can hold all other files: toolbars, plugins (scripts), etc. | * Building an add-on file needs more effort than the other 'extensions' but for the end user it's best because it can hold all other files: toolbars, plugins (scripts), etc. | ||
** The user can install a newer version of the addon by repeating the installation with the new file: it's unnecessary to remove the old version. | ** The user can install a newer version of the addon by repeating the installation with the new file: it's unnecessary to remove the old version. | ||
| Line 146: | Line 150: | ||
end if | end if | ||
end function | end function | ||
==Selected wisdom== | ==Selected wisdom== | ||
We've also a [http://oni.bungie.org | We've also a [http://oni.bungie.org/forum/viewtopic.php?id=1229 tutorial thread on OCF.] | ||
Hotkey list can be found [http://www.keyxl.com/aaacbe0/415/SoftImage-XSI-keyboard-shortcuts.htm here]. | Hotkey list can be found [http://www.keyxl.com/aaacbe0/415/SoftImage-XSI-keyboard-shortcuts.htm here]. | ||
| Line 189: | Line 192: | ||
** B) goto Model > Modify > Poly. Mesh > Bridge Boundary Points/Edges (if blue lines appear try to disable the checkbox "Angle > 90") | ** B) goto Model > Modify > Poly. Mesh > Bridge Boundary Points/Edges (if blue lines appear try to disable the checkbox "Angle > 90") | ||
* merging two objects at blue lines: merge the objects at first, then proceed with the point above "filling a hole" | * merging two objects at blue lines: merge the objects at first, then proceed with the point above "filling a hole" | ||
* '''merging two objects with UVs''': Create > Poly. Mesh > [http://cryrid.com/images/temp/XSI/merge_materials.jpg Merge] | * '''merging two objects with UVs''': Create > Poly. Mesh > [https://web.archive.org/web/20160225163131/http://cryrid.com/images/temp/XSI/merge_materials.jpg Merge] | ||
** extracted Oni characters have their materials and hence textures directly grouped under the mesh (see Explorer) | ** extracted Oni characters have their materials and hence textures directly grouped under the mesh (see Explorer) | ||
** when adding (merging) a new part to the existing mesh, the materials/textures will be grouped under (Explorer again) mesh > Polygon Mesh > Clusters > ... | ** when adding (merging) a new part to the existing mesh, the materials/textures will be grouped under (Explorer again) mesh > Polygon Mesh > Clusters > ... | ||
** Samer reported that saving the file via fbx solves a problem when trying to convert TRBS | ** Samer reported that saving the file via fbx solves a problem when trying to convert TRBS | ||
** one would need to | ** one would need to move the content by hand in the explorer to bypass the fbx | ||
* hiding some objects/polygons: select object/polygon and hit [H], use [Control] + [H] to unhide all | * hiding some objects/polygons: select object/polygon and hit [H], use [Control] + [H] to unhide all | ||
* mirroring an object: select object, Modify > Poly. Mesh > Symmetrize Polygons | * mirroring an object: select object, Modify > Poly. Mesh > Symmetrize Polygons | ||
| Line 245: | Line 248: | ||
===Material and texture=== | ===Material and texture=== | ||
[[Image:apply_new_main_texture_in_Mod_Tool.png|thumb|200px|right|how to apply a new main texture]] | |||
[[Image:apply_new_polygon_cluster_texture_in_Mod_Tool.png|thumb|200px|right|how to apply a new polygon cluster texture]] | |||
* objects use the scene material by default, objects need their own material if they should have individual textures | * objects use the scene material by default, objects need their own material if they should have individual textures | ||
* selecting a material and surface: Model > Material > Phong (simply close the windows that pops up) | * selecting a material and surface: Model > Material > Phong (simply close the windows that pops up) | ||
| Line 254: | Line 259: | ||
** choose "diffuse" as illumination mode (for instance "ambient" won't work - the texture would be visible in Mod Tool but Onisplit can't use it) | ** choose "diffuse" as illumination mode (for instance "ambient" won't work - the texture would be visible in Mod Tool but Onisplit can't use it) | ||
* now "Image" can be double-clicked (the Texture Editor will pop up), in the section "Image" click on "New" to choose an image | * now "Image" can be double-clicked (the Texture Editor will pop up), in the section "Image" click on "New" to choose an image | ||
* to change textures '''don't drag and drop textures directly one meshes''', this creates textures layers which are ignored by OniSplit | |||
| Line 276: | Line 282: | ||
* freeze object to ''bake'' projections (green lines in the 3D view will disappear) | * freeze object to ''bake'' projections (green lines in the 3D view will disappear) | ||
* getting a picture of the UV: apply first a black texture then enter the Texture Editor [Alt] + [7], Edit > Stamp UV Mesh [Shift] + [S], save the texture | * getting a picture of the UV: apply first a black texture then enter the Texture Editor [Alt] + [7], Edit > Stamp UV Mesh [Shift] + [S], save the texture | ||
Things to test: | |||
* https://vimeo.com/67783125 | |||
===Rendering=== | |||
Rendering doesn't work well on my PCs.--[[User:Paradox-01|paradox-01]] ([[User talk:Paradox-01|talk]]) 01:09, 9 March 2016 (CET) | |||
Especially PNG, it works one time. But as soon as I import another dae the next render will fail. | |||
So, for creating a object library we might use blender. Nice thing is, it can also render in the background when called from CMD. This means you could keep working in XSI and render images in blender at the same time. | |||
example of a batch file: | |||
cd C:\Program Files\Blender Foundation\Blender | |||
blender -b --python C:\Users\Paradox-01\Desktop\blender-out\pythonScript.py | |||
example of a render script: | |||
import bpy | |||
# delete blender default cube object | |||
bpy.ops.object.mode_set(mode='OBJECT') | |||
bpy.ops.object.select_by_type(type='MESH') | |||
bpy.ops.object.delete(use_global=False) | |||
# load new object | |||
bpy.ops.wm.collada_import(filepath = "C:/Oni/r.dae") | |||
# render settings | |||
bpy.data.scenes['Scene'].render.resolution_x = 900 | |||
bpy.data.scenes['Scene'].render.resolution_y = 900 | |||
# default resolution percentage seems to be 50 | |||
bpy.data.scenes['Scene'].render.resolution_percentage = 100 | |||
bpy.data.scenes['Scene'].render.use_antialiasing = True | |||
# 5 | 8 | 11 | 16 | |||
bpy.data.scenes['Scene'].render.antialiasing_samples = "8" | |||
#TGA IRIS JPEG MOVIE IRIZ RAWTGA | |||
#AVIRAW AVIJPEG PNG BMP FRAMESERVER | |||
#no gif ? could be created by more code, maybe merging single frames of jpgs | |||
bpy.data.scenes['Scene'].render.image_settings.file_format = 'JPEG' | |||
bpy.data.scenes['Scene'].render.image_settings.quality = 100 | |||
# file suffix is overwritten by file_formate | |||
#bpy.data.scenes['Scene'].render.filepath = 'C:/Oni/renders/test.jpg' | |||
bpy.data.scenes['Scene'].render.filepath = 'C:/Oni/renders/test' | |||
# start render | |||
bpy.ops.render.render( write_still=True ) | |||
===Animating=== | ===Animating=== | ||
[[Image:Scale_animations_in_Mod_Tool_Animation_Editor_DopeSheet.png|thumb|200px|right|an animation that got scaled down from 116 to 58 frames]] | |||
* preparing ModTool to save animations Oni can use: File > Preferences... > Preferences > Tools > Output Format | * preparing ModTool to save animations Oni can use: File > Preferences... > Preferences > Tools > Output Format | ||
** Frame Step: 1 | ** Frame Step: 1 | ||
** Frame Format: Custom framerate | ** Frame Format: Custom framerate | ||
** Frame Rate: 60 | ** '''Frame Rate: 60''' | ||
* for real-time playback click on "Playback" option button and then "Real-Time Playback" | * for real-time playback click on "Playback" option button and then "Real-Time Playback" | ||
* opening the Animation Editor : [0] | * opening the Animation Editor : [0] | ||
* opening the DopeSheet: from any other Animation Editor, Editor > DopeSheet | * opening the DopeSheet: from any other Animation Editor, Editor > DopeSheet | ||
* making an animation shorter or longer: in DopeSheet click Region button (arrow with rectangle), click and hold to select keyframes, at selection edge a) [shift] plus left-click and move mouse or b) middle-click and move mouse | * '''making an animation shorter or longer:''' in DopeSheet click Region button (arrow with rectangle), click and hold to select keyframes, at selection edge a) [shift] plus left-click and move mouse or b) middle-click and move mouse | ||
====Issues when saving and sharing animation files (*.dae, *.exp)==== | |||
That what you currently see in Mod Tool and that what you get when saving data can be different. | |||
1) *.dae files might save data differently than expected. | |||
''Rotation flips'' might appear. | |||
*.exp files store the frames as they are | 2) *.exp and *.dae save data differently. | ||
*.exp files store the frames as they are. | |||
*.dae file store their actions (rotations/translation/...) in seconds and eventually depend on what framerate a Modder uses. | *.dae file store their actions (rotations/translation/...) in seconds and eventually depend on what framerate a Modder uses. | ||
'''Following scenario: a modder wants to share an animation as *.exp and another modder wants to use that animation.''' | |||
Modder A uses 30 fps in his settings and exports an *.exp that is 58 frame long. | |||
Modder B uses 60 fps in his setting and imports the *.exp, to his surprise the animation is 116 frames long. What now? | |||
An example: | If Modder B saves the *.exp under a new name would not help, the frames will be still the same. | ||
Instead Modder B could scale the animation. The way to do so is described in the [[#Animating|Animating]] section, "making an animation shorter or longer". | |||
Modder B scales the animation and saves it as dae. | |||
Now he wants to see if it worked. He opens a new scene [Strg]+[N] and loads the dae. | |||
'''Summary of issue-holding aspects''' | |||
* '''Frames Per Second (FPS)''' | |||
When you share *.dae files with other Modders be sure that the output formate is 60 fps. Different framerates among modders can cause confusion. | |||
Dae file store their actions (rotation/translation/...) in seconds. | |||
An example: | |||
<float_array count="10" id="pelvis_rotation_x_ANGLE-anim-input-array"> | <float_array count="10" id="pelvis_rotation_x_ANGLE-anim-input-array"> | ||
| Line 312: | Line 392: | ||
action at [s] * framerate [f/s] = frame [f] | action at [s] * framerate [f/s] = frame [f] | ||
In this example the last rotation occurs at 1.935267s. | |||
: Modder A uses 30 fps, his last frame is 58. | : Modder A uses 30 fps, his last frame is 58. | ||
| Line 318: | Line 398: | ||
* '''Euler rotations | * '''Euler rotations''' | ||
you will get [[wikipedia:Bézier_curve|BEZIER]] (cubic) interpolation instead of LINEAR if you use | you will get [[wikipedia:Bézier_curve|BEZIER]] (cubic) interpolation instead of LINEAR if you use | ||
| Line 329: | Line 409: | ||
* '''Quaternion rotations | * '''Quaternion rotations''' | ||
Don't use this. | Don't use this. | ||
| Line 336: | Line 416: | ||
* '''Make Rotation Keys Continuous | * '''Make Rotation Keys Continuous''' | ||
[...] | [...] | ||
| Line 346: | Line 426: | ||
Open the animation mixer with [Alt]+[0]. | Open the animation mixer with [Alt]+[0]. | ||
Further information over [http://softimage.wiki.softimage.com/xsidocs/nla_mixer.htm#Rdw10200 HERE.] | Further information over [http://web.archive.org/web/20170103065301/http://softimage.wiki.softimage.com/xsidocs/nla_mixer.htm#Rdw10200 HERE.] | ||
Here are a few videos: | Here are a few videos: | ||
* ''' | * '''https://www.youtube.com/watch?v=-xC31Q7zpM0''' | ||
* | * https://www.youtube.com/watch?v=njLrAIpDOFU | ||
* | * https://www.youtube.com/watch?v=PRDZaEo5CGo | ||
| Line 357: | Line 437: | ||
Within the animation mixer also sounds can be added. | Within the animation mixer also sounds can be added. | ||
Further information over [http://softimage.wiki.softimage.com/xsidocs/audio_LoadingAudioFilesintheAnimationMixer.htm#Rdy36984 HERE.] | Further information over [http://web.archive.org/web/20170102120711/http://softimage.wiki.softimage.com/xsidocs/audio_LoadingAudioFilesintheAnimationMixer.htm#Rdy36984 HERE.] | ||
This could be used to synchronize sounds effect with physical actions in the scene. | This could be used to synchronize sounds effect with physical actions in the scene. | ||
| Line 377: | Line 457: | ||
'''Links''' | '''Links''' | ||
* [http://softimage.wiki.softimage.com/index.php?title=Scripting_Tips_and_Tricks_%28XSISDK%29 xsi wiki page about scripting] | * [http://web.archive.org/web/20160803061035/http://softimage.wiki.softimage.com/index.php?title=Scripting_Tips_and_Tricks_%28XSISDK%29 xsi wiki page about scripting] | ||
* '''[http://softimage.wiki.softimage.com/sdkdocs/scriptsdb/scriptsdb/scrdb_vbscript.htm many vbscript examples]''' | * '''[http://web.archive.org/web/20170616035120/http://softimage.wiki.softimage.com/sdkdocs/scriptsdb/scriptsdb/scrdb_vbscript.htm many vbscript examples]''' | ||
* '''[ | * '''[https://ss64.com/vb/ vbs commands]''' | ||
* [ | * [https://web.archive.org/web/20070510173452/https://www.activexperts.com/activmonitor/windowsmanagement/adminscripts/filesfolders/files/ objFSO/objWSHShell: Scripts to manage Files] (replace "Wscript.Echo" with "logmessage") | ||
* [http://activexperts.com/activmonitor/windowsmanagement/adminscripts/other/textfiles/ objFSO/objWSHShell: Scripts to manage Text Files] | * [https://web.archive.org/web/20150504221146/http://activexperts.com/activmonitor/windowsmanagement/adminscripts/other/textfiles/ objFSO/objWSHShell: Scripts to manage Text Files] | ||
* [http://www.kxcad.net/ | * [http://web.archive.org/web/20080905102848/http://www.kxcad.net/softimage_xsi/Softimage_XSI_Documentation/script_basics_IncludingExternalScripts.htm using external scripts] | ||
* [ | * [https://download.autodesk.com/global/docs/softimage2013/en_us/sdkguide/index.html?url=si_om/XSIUIToolkit.html,topicNumber=si_om_XSIUIToolkit_html progress bar and open file dialog<!-- (hm, InitialDirectory code for quick save idea ?)-->] | ||
<!--* [http://download.autodesk.com/global/docs/softimage2013/en_us/sdkguide/index.html?url=files/cus_ppg_FileBrowserWidget.htm,topicNumber=d30e11980,hash=WS34BA39B437A993419C80CAB58E3BEFA1-0059 text box]--> | <!--* [http://download.autodesk.com/global/docs/softimage2013/en_us/sdkguide/index.html?url=files/cus_ppg_FileBrowserWidget.htm,topicNumber=d30e11980,hash=WS34BA39B437A993419C80CAB58E3BEFA1-0059 text box]--> | ||
| Line 403: | Line 483: | ||
* The commands are not case-sensitive, e.g. you can write "LogMessage" or "logmessage". | * The commands are not case-sensitive, e.g. you can write "LogMessage" or "logmessage". | ||
* Vbs functions can be found [ | * Vbs functions can be found [https://web.archive.org/web/20150707131602/https://www.w3schools.com/vbscript/vbscript_ref_functions.asp HERE.] | ||
' while it is possible to use + in strings, | ' while it is possible to use + in strings, | ||
| Line 460: | Line 540: | ||
| Logs the object name. | | Logs the object name. | ||
|- | |- | ||
| logmessage selection(0). | | logmessage selection(0).Materials(0).Name | ||
| Logs the material name. | | Logs the material name. | ||
|- | |- | ||
|valign=top| logmessage selection(0). | | logmessage selection(0).Materials(0).Library.name | ||
| Logs the material library name. | |||
|- | |||
| logmessage selection(0).Materials(0).shaders(0).name | |||
| Logs the material shader (e.g. phong). | |||
|- | |||
|valign=top| logmessage selection(0).Materials(0).CurrentImageClip.source.filename.value | |||
| Logs absolute path of the texture. Output example: | | Logs absolute path of the texture. Output example: | ||
: ''C:\Users\RRM\Desktop\TV_tex.png'' | : ''C:\Users\RRM\Desktop\TV_tex.png'' | ||
|- | |- | ||
|valign=top| logmessage selection(0). | |valign=top| logmessage selection(0).Materials(0).CurrentImageClip.source.Parameters("XRes").Value<br>logmessage selection(0).Material.CurrentImageClip.source.Parameters("YRes").Value | ||
| Logs the horizontal (X) and vertical (Y) pixel length of the texture. Output example: | | Logs the horizontal (X) and vertical (Y) pixel length of the texture. Output example: | ||
: ''512'' | : ''512'' | ||
| Line 497: | Line 583: | ||
: ToggleSelection "grid2,grid3" | : ToggleSelection "grid2,grid3" | ||
|- | |- | ||
|valign=top| [ | |valign=top| [https://download.autodesk.com/global/docs/softimage2013/en_us/sdkguide/index.html?url=si_cmds/SelectAllUsingFilter.html,topicNumber=si_cmds_SelectAllUsingFilter_html SelectAllUsingFilter] <nowiki>[SelFilter], [CheckComponentVisibility], [AffectSelectionList], [CheckObjectSelectability]</nowiki> | ||
|Selects everything that matches the filter and other options. Example: | |Selects everything that matches the filter and other options. Example: | ||
: SelectAllUsingFilter "object", siCheckComponentVisibility | : SelectAllUsingFilter "object", siCheckComponentVisibility | ||
| Line 515: | Line 601: | ||
| Makes all changes final. But saving those changes is still necessary. (Click on key symbol so it gets red.) | | Makes all changes final. But saving those changes is still necessary. (Click on key symbol so it gets red.) | ||
|- | |- | ||
| [ | | [https://download.autodesk.com/global/docs/softimage2013/en_us/sdkguide/index.html?url=si_cmds/Translate.html,topicNumber=si_cmds_Translate_html Translate] <nowiki>[InputObjs], [X], [Y], [Z], [Delta], [RefMode], [Center], [AxesFilter], [Snap], [SnapReference], [SnapFilter], [SplitLocalComponents], [PropTagOnly], [Pivot], [PivotX], [PivotY], [PivotZ], [ConstructionMode], [SlideComponents]</nowiki> | ||
| see link | | see link | ||
|- | |- | ||
| [ | | [https://download.autodesk.com/global/docs/softimage2013/en_us/sdkguide/index.html?url=si_cmds/Rotate.html,topicNumber=si_cmds_Rotate_html Rotate] <nowiki>[InputObjs], [X], [Y], [Z], [Delta], [RefMode], [Center], [AxesFilter], [Reference], [SplitLocalComponents], [PropTagOnly], [Pivot], [PivotX], [PivotY], [PivotZ], [ConstructionMode], [SlideComponents]</nowiki> | ||
| see link | | see link | ||
|} | |} | ||
| Line 527: | Line 613: | ||
If you see absolute paths adapt them so that the code works on your system too. | If you see absolute paths adapt them so that the code works on your system too. | ||
([[Mod_Tool/Scripting|Here]]'s another page for math related code pieces.) | |||
{| class="wikitable" width="100%" | {| class="wikitable" width="100%" | ||
| Line 580: | Line 668: | ||
| [38] fbx export | | [38] fbx export | ||
| [39] import an image clip only once | | [39] import an image clip only once | ||
|- | |||
| [40] layers | |||
| [41] onisplit update | |||
| [42] get vertex color | |||
|- | |||
| [43] get all used textures | |||
| [44] get global point position | |||
| | |||
|} | |} | ||
| Line 839: | Line 935: | ||
' '''[8] message box''' | ' '''[8] message box''' | ||
[ | [https://download.autodesk.com/global/docs/softimage2013/en_us/sdkguide/index.html?url=si_om/XSIUIToolkit.MsgBox.html,topicNumber=si_om_XSIUIToolkit_MsgBox_html msgbox] "message", , "title" | ||
| Line 878: | Line 974: | ||
' '''[13] reading out environment variables''' | ' '''[13] reading out environment variables''' | ||
' some infos about env vars: [http://softimage.wiki.softimage.com/xsidocs/config_envirovars.htm (1)], [http://softimage.wiki.softimage.com/xsidocs/EnvVars_SettingandUsingEnvironmentVariables.htm (2)], [http://softimage.wiki.softimage.com/xsidocs/EnvVars_EnvironmentVariableReference.htm (3)] | ' some infos about env vars: [http://web.archive.org/web/20170309190841/http://softimage.wiki.softimage.com/xsidocs/config_envirovars.htm (1)], [http://web.archive.org/web/20180416194626/http://softimage.wiki.softimage.com/xsidocs/EnvVars_SettingandUsingEnvironmentVariables.htm (2)], [http://web.archive.org/web/20170617095054/http://softimage.wiki.softimage.com/xsidocs/EnvVars_EnvironmentVariableReference.htm (3)] | ||
' those variables are stored inside the setenv.bat, two disadvantages: | ' those variables are stored inside the setenv.bat, two disadvantages: | ||
' adding or editing those vars appears to not work in vbs or I just did it wrong | ' adding or editing those vars appears to not work in vbs or I just did it wrong | ||
' anyway, new vars can only be read out after app restart | ' anyway, new vars can only be read out after app restart | ||
' therefore let's concentrate on reading out existing ones and then how to create our own via txt files (example: | ' therefore let's concentrate on reading out existing ones and then how to create our own via txt files (example: <nowiki>https://dl.dropbox.com/u/139715/OniGalore/ModToolScript/Oni_env_vars.txt Oni_env_vars.txt</nowiki> (dead link)) | ||
' code for reading out: | ' code for reading out: | ||
logmessage XSIUtils.ResolvePath("$SI_HOME/") | logmessage XSIUtils.ResolvePath("$SI_HOME/") | ||
| Line 910: | Line 1,006: | ||
logmessage "created folder " & strDirectory | logmessage "created folder " & strDirectory | ||
End If | End If | ||
' ### or simply: | |||
dir = "C:\test" | |||
XSIUtils.EnsureFolderExists (dir) | |||
| Line 1,071: | Line 1,171: | ||
' INFO : =================================== | ' INFO : =================================== | ||
' '''[] remove xml nodes''' | |||
Set objXMLDoc = CreateObject("Microsoft.XMLDOM") | |||
objXMLDoc.async = False | |||
Dim XMLFile | |||
XMLFile = "C:\Softimage\Softimage_Mod_Tool_7.5\OniLevels\ONLV\test\ONLVAirport.xml" | |||
objXMLDoc.load(XMLFile) | |||
Set nodes = objXMLDoc.selectNodes("Oni/CRSA/*") | |||
For Each node In nodes | |||
node.parentNode.removeChild(node) | |||
Next | |||
objXMLDoc.Save(XMLFile) | |||
| Line 1,152: | Line 1,267: | ||
' alternative to cmd: call onisplit via winmgmts | ' alternative to cmd: call onisplit via winmgmts | ||
' slightly modified code from [ | ' slightly modified code from [https://devblogs.microsoft.com/scripting/how-can-i-start-a-process-and-then-wait-for-the-process-to-end-before-terminating-the-script/ that site] | ||
' ''logmessage "onisplit finished."'' will be executed after the conversion finished, there should be also an delay of 3 seconds to support very slow computers | ' ''logmessage "onisplit finished."'' will be executed after the conversion finished, there should be also an delay of 3 seconds to support very slow computers | ||
' if you are going to use this method consider to extent the code to check if input file and output directory exist | ' if you are going to use this method consider to extent the code to check if input file and output directory exist | ||
| Line 1,181: | Line 1,296: | ||
[[Image:XSI_Mod_Tool_PPG.png|thumb]] | |||
' '''[23] building a form (PPG)''' | ' '''[23] building a form (PPG)''' | ||
| Line 1,262: | Line 1,375: | ||
[[Image:XSI_Mod_Tool_UserDataBlob.png|thumb]] | |||
' '''[24] UserDataBlob''' | ' '''[24] UserDataBlob''' | ||
| Line 1,482: | Line 1,593: | ||
' '''[33] getting bounding box values''' | ' '''[33] getting bounding box values''' | ||
' this could be useful to create a bounding box for [[ | ' this could be useful to create a bounding box for [[XML:OFGA|OFGA files]] | ||
' let's get the bounding box of a simple cylinder | ' let's get the bounding box of a simple cylinder | ||
| Line 1,505: | Line 1,616: | ||
' this could be used open an output folder ... | ' this could be used open an output folder ... | ||
strPath = "[http://support.microsoft.com/kb/152457 explorer.exe /e]," & XSIUtils.ResolvePath("$SI_HOME/") | strPath = "[http://web.archive.org/web/20150212074443/http://support.microsoft.com/kb/152457 explorer.exe /e]," & XSIUtils.ResolvePath("$SI_HOME/") | ||
Set objShell = CreateObject("Wscript.Shell") | Set objShell = CreateObject("Wscript.Shell") | ||
objShell.Run strPath | objShell.Run strPath | ||
| Line 1,513: | Line 1,624: | ||
[[Image:XSI_Mod_Tool_SelectNeighborObj_obj_5.png|thumb|SelectNeighborObj obj 5]] | |||
| SelectNeighborObj obj 5 | |||
' '''[35] working with hierarchies''' | ' '''[35] working with hierarchies''' | ||
| Line 1,615: | Line 1,724: | ||
end function | end function | ||
'''Important:''' | |||
Mod Tool has its own drag and drop event handler for dae and xml file. | |||
''' | If we succeed in modifying and shipping that new file, we could finally trigger scripts with those files and process them. | ||
The original file can be found at: | |||
logmessage XSIUtils.ResolvePath("$XSI_HOME/") & "Application\DSScripts\Model.vbs" | |||
' C:\Softimage\Softimage_Mod_Tool_7.5\Application\DSScripts\'''Model.vbs''' | |||
A backup of the original file can be found here: '''<nowiki>https://dl.dropboxusercontent.com/u/139715/OniGalore/ModToolScript/Model.vbs</nowiki> (dead link)''' | |||
set oProps = ActiveProject.ActiveScene.Root.Properties | There are two issues that can be fixed by modifying this file. | ||
* import of xml files created by onisplit | |||
* import of dae and xml files with relative path from a html page | |||
Relative file pathes will be transformed to absolute pathes whereby an unwanted "file:///" is added. | |||
A solution to is to transform the path again. | |||
if instr(in_Filename,"file:///") = 1 then | |||
in_Filename = replace(in_Filename, "file:///", "") | |||
end if | |||
Following function is always triggered, so we will modify it. | |||
sub ImportDotXSIProc( in_Filename, in_Parent ) | |||
<font style="color:#DD0000">if instr(in_Filename,"file:///") = 1 then | |||
in_Filename = replace(in_Filename, "file:///", "") | |||
end if | |||
Set objFSO = CreateObject("Scripting.FileSystem<Object") | |||
FileExt = objFSO.GetExtensionName(in_Filename)</font> | |||
if application.license = "Avid 3D" then | |||
SIImportDotXSIFile in_Filename, in_Parent | |||
else | |||
Set oFS = CreateObject("Scripting.FileSystemObject") | |||
<font style="color:#DD0000">if oFS.FileExists(in_Filename) = True then | |||
if FileExt = "xml" then | |||
' is this an Oni xml file ? | |||
Set xmlDoc = CreateObject("Microsoft.XMLDOM") | |||
xmlDoc.Async = "False" | |||
xmlDoc.Load(in_Filename) | |||
if xmlDoc.selectNodes("Oni").length > 0 then | |||
logmessage "Oni xml file detected" | |||
read_xml "OFGA", in_Filename | |||
end if | |||
exit sub | |||
end if</font> | |||
The lines in red has been added. | |||
'''[37] dae export''' | |||
set oProps = ActiveProject.ActiveScene.Root.Properties | |||
if typename (oProps.find("ExportCrosswalkOptions")) = "Nothing" then | if typename (oProps.find("ExportCrosswalkOptions")) = "Nothing" then | ||
logmessage "Export settings not set" | logmessage "Export settings not set" | ||
| Line 1,665: | Line 1,824: | ||
'''[40] layers''' | |||
[[Image:ModTool_layers.png|thumb|200px|right|how to access scene layers]] | |||
To access scene layers switch from Main Control Panel (MCP) to Keying Panel/Layers (KP/L) and then click "Scene". | |||
After the user became used to layers, they can help to organize work in a scene. This is especially interesting for some scripting tasks like getting TRGV/FURN data for xml files. | |||
' get current layer | |||
GetCurrentLayer CurrentLayer | |||
logmessage CurrentLayer | |||
''' | ' create a new layer named "FurnLayer" if it doesn't already exist | ||
' make new layer the current layer | |||
if typename(ActiveProject.ActiveScene.Layers("FurnLayer")) = "Nothing" then | |||
SICreateLayer , "FurnLayer", FurnLayer | |||
SetCurrentLayer FurnLayer | |||
else | |||
SetCurrentLayer "Layers.FurnLayer" | |||
end if | |||
'' | ' get objects in FurnLayer and count objects | ||
' exit sub if there are no objects | |||
SelectMembers "Layers.FurnLayer" | |||
if selection.count = 0 then | |||
MsgBox "No OFGA data found to export.", , "Export canceled" | |||
exit sub | |||
end if | |||
' if there are Furn objects | |||
for each obj in selection | |||
' do something e.g. create xml | |||
next | |||
' '''[41] onisplit update''' | |||
' this downloads and unzips the last attachment from the [http://mods.oni2.net/node/38 onisplit page] | |||
output_dir = "F:\test\" | |||
' get onisplit link ################################################ | |||
set xmlhttp = createobject ("msxml2.xmlhttp.3.0") | |||
xmlhttp.open "get", "http://mods.oni2.net/node/38/index.html", false | |||
xmlhttp.send | |||
<nowiki>webtext = xmlhttp.responseText | |||
webtext = replace(replace(webtext, vbcr,""),vblf,"") | |||
webtext = split(webtext, "<table class=""sticky-enabled""> <thead><tr><th>Attachment</th>" )(1) | |||
webtext = split(webtext, "</td> </tr></tbody></table>") (0)</nowiki> | |||
link_start = instrrev(webtext, "http") | |||
link_end = instrrev(webtext, ".zip"" type") + 4 ' + zip | |||
' mid (text, begin, length) | |||
link = mid(webtext, link_start, link_end - link_start) | |||
logmessage "last link in attachment: " & link | |||
dim xHttp: Set xHttp = createobject("Microsoft.XMLHTTP") | |||
dim bStrm: Set bStrm = createobject("Adodb.Stream") | |||
xHttp.Open "GET", link, False | |||
xHttp.Send | |||
' get file name ################################################### | |||
hdr = xHttp.getResponseHeader("Content-Disposition") | |||
hdr = replace (hdr, "attachment; filename=""", "") | |||
hdr = replace (hdr, """", "") | |||
logmessage hdr | |||
' save file ####################################################### | |||
filename = output_dir & hdr | |||
with bStrm | |||
.type = 1 '//binary | |||
.open | |||
.write xHttp.responseBody | |||
.savetofile filename, 2 '//overwrite | |||
end with | |||
' extract file #################################################### | |||
UnzipFile filename, output_dir | |||
Function UnzipFile(ZipFile, ExtractTo) | |||
Set fso = CreateObject("Scripting.FileSystemObject") | |||
If NOT fso.FolderExists(ExtractTo) Then | |||
fso.CreateFolder(ExtractTo) | |||
End If | |||
set objShell = CreateObject("Shell.Application") | |||
set FilesInZip=objShell.NameSpace(ZipFile).items | |||
objShell.NameSpace(ExtractTo).CopyHere(FilesInZip) | |||
Set fso = Nothing | |||
Set objShell = Nothing | |||
End Function | |||
' '''[42] get vertex color''' | |||
set oGeometry = selection(0).activeprimitive.geometry | |||
set oTriangles = oGeometry.Triangles | |||
for each oTriangle in oTriangles | |||
logmessage oTriangle.Name | |||
for each oVertex in oTriangle.Points | |||
set oColor = oVertex.Color | |||
logmessage vbTab & "RGBA(" & _ | |||
oColor.red & "," & _ | |||
oColor.green & "," & _ | |||
oColor.blue & "," & _ | |||
oColor.alpha & ")" | |||
next | |||
next | |||
' '''[43] get all used textures''' | |||
DeleteAllUnusedMaterials | |||
DeleteUnusedImageClips | |||
'DeleteUnusedImageSources | |||
for each i in Application.ActiveProject.ActiveScene.ExternalFiles | |||
if i.filetype = "Pictures" then | |||
logmessage i | |||
end if | |||
next | |||
' ''' [44] get global point position''' | |||
set oObj = selection(0) | |||
set oTrans = oObj.Kinematics.Local.Transform | |||
set oPoint0 = oObj.ActivePrimitive.Geometry.Points(0) | |||
set oPoint7 = oObj.ActivePrimitive.Geometry.Points(7) | |||
set oPos0 = oPoint0.Position | |||
set oPos7 = oPoint7.Position | |||
' scaling must be frozen to 1 before we can calculate the size from local values | |||
ResetTransform selection(0), siCtr, siScl, siXYZ | |||
logmessage "local p0: "& oPos0.X & " " & oPos0.Y & " " & oPos0.Z | |||
set oGlobalPos0 = XSIMath.MapObjectPositionToWorldSpace( oTrans, oPos0) | |||
logmessage "global p0: "& oGlobalPos0.X & " " & oGlobalPos0.Y & " " & oGlobalPos0.Z | |||
logmessage "local p7: "& oPos7.X & " " & oPos7.Y & " " & oPos7.Z | |||
set oGlobalPos7 = XSIMath.MapObjectPositionToWorldSpace( oTrans, oPos7) | |||
logmessage "global p7: "& oGlobalPos7.X & " " & oGlobalPos7.Y & " " & oGlobalPos7.Z | |||
logmessage "size: " & oPos7.X - oPos0.X & " " & _ | |||
oPos7.Y - oPos0.Y & " " & _ | |||
oPos7.Z - oPos0.Z | |||
' with a rotation of: -3,8792 16,4039 -13,5017 | |||
' INFO : local p0: -4 -4 -4 | |||
' INFO : local p7: 4 4 4 | |||
' INFO : global p0: -5,74764582364017 -3,00250371537919 -2,43916767056426 ' TRGV start point | |||
' INFO : global p7: 5,74764582364017 3,00250371537919 2,43916767056426 | |||
' INFO : size: 8 8 8 | |||
===Interactive Creative Environment (ICE)=== | |||
* [[wikipedia:Autodesk_Softimage#ICE_Interactive_Creative_Environment|ICE]] | |||
'''tutorials:''' | |||
* | * https://www.youtube.com/watch?v=ioMQ2rBVO4g | ||
* | * http://dot3d.blogspot.com/2009/10/softimage-ice-tree-building-step-by.html | ||
* [https://www.si-community.com/community/viewtopic.php?f=41&t=1707 an ICE tutorial thread] | |||
* [https://download.autodesk.com/global/docs/softimage2013/en_us/userguide/index.html?url=files/ICE_trees_DebuggingICETrees.htm,topicNumber=d30e269791 ICE trees Debugging] | |||
* <nowiki>https://support.solidangle.com/display/SItoAUG/ICE</nowiki> (dead link) | |||
==Wanted knowledge== | |||
* How to set up particles in Mod Tool? We still need an Oni particle editor! | |||
* How to rig models and then extract the animation data? | |||
* How to make complex new UV maps? | |||
[[Category:Modding tutorials]][[Category:Outdated modding tools]][[Category:Windows-only modding tools]] | |||
[ | |||
[[Category:Windows-only modding tools]] | |||
edits