Mod Tool: Difference between revisions

3,954 bytes added ,  27 June 2013
scripting: read xml file (attribute/content-based)
m (scripting: read nodes of xml files)
(scripting: read xml file (attribute/content-based))
Line 476: Line 476:
|-
|-
| [16] write xml file
| [16] write xml file
| [17] create txt file + write lines
| [17] read xml file
| [18] read txt file
| [18] read xml file (attribute/content-based)
|-
|-
| [19] check onisplit version
| [19] create txt file + write lines
| [20] call CMD, e.g. to use onisplit
| [20] read txt file
| [21] building forms in ModTool
| [21] check onisplit version
|-
|-
| [22] UserDataBlob
| [22] call CMD, e.g. to use onisplit
| [23] getting the position of points (with selection mode point)
| [23] building forms in ModTool
| [24] getting the position of points (with selection mode object)
| [24] UserDataBlob
|-
|-
| [25] getting and setting the position of points (without selection)
| [25] getting the position of points (with selection mode point)
| [26] getting the rotation and position of selected objects
| [26] getting the position of points (with selection mode object)
| [27] getting the rotation and position of not selected objects
| [27] getting and setting the position of points (without selection)
|-
|-
| [28] decrypting merged integer flags
| [28] getting the rotation and position of selected objects
| [29] disabling PPG popups
| [29] getting the rotation and position of not selected objects
| [30] disabling logmessages
| [30] decrypting merged integer flags
|-
|-
| [31] getting bounding box values
| [31] disabling PPG popups
| [32] open an explorer window
| [32] disabling logmessages
| [33] working with hierarchies
| [33] getting bounding box values
|-
|-
| [34] drag and drop (DnD) support for specific oni files
| [34] open an explorer window
| [35] dae export
| [35] working with hierarchies
| [36] fbx export
| [36] drag and drop (DnD) support for specific oni files
|-
|-
| [37] import an image clip only once
| [37] dae export
|
| [38] fbx export
|
| [39] import an image clip only once
|}
|}


Line 854: Line 854:




  ' '''[] read xml file'''
  ' '''[17] read xml file'''
   
   
  Set xmlDoc = CreateObject( "Microsoft.XMLDOM" )
  Set xmlDoc = CreateObject( "Microsoft.XMLDOM" )
Line 888: Line 888:




  ' '''[17] create txt file + write lines'''
 
  ' '''[18] read xml file (attribute/content-based)'''
Set xmlDoc = CreateObject( "Microsoft.XMLDOM" )
' tells the program to wait until the file was loaded conpletely
xmlDoc.Async = "False"
xmlDoc.Load( "C:\Users\RRM\Oni\AE\AEInstaller\vanilla\level0_Final\BINAEINOimpact_effects.xml" )
' example 1 ('''we use this one''')
' nodes only with a certain attribute and conent will be collected
' content-based search: node [child_node = 'content']
' attribute-based search: node [@attribute_name = 'attribute_value']
' if things get too long an underscore _ can be used to make a linebreak
'''set w1_tap = xmlDoc.selectNodes _'''
'''( "Oni/ImpactEffects/Impact[@Name = 'w1_tap']/Material[@Name = 'Unbreak_Glass']/ImpactEffect [Component = 'Damage']" )'''
' example 2
' use "or" for a search of various material
'set w1_tap = xmlDoc.selectNodes _
' ( "Oni/ImpactEffects/Impact/Material[@Name = 'Default' or @Name = 'Character']/ImpactEffect" )
' example 3
' use (|) for a search of various content, e.g. ''<ImpactEffect><Modifier>Light'' plus ''<ImpactEffect><Modifier>Medium''
'set w1_tap = xmlDoc.selectNodes _
' ( "Oni/ImpactEffects/Impact/Material/(ImpactEffect [Modifier = 'Light'] | ImpactEffect [Modifier = 'Medium'])" )
for each element in w1_tap
logmessage "Impact: " & element.parentNode.parentNode.getAttribute("Name")
logmessage "Material: " & element.parentNode.getAttribute("Name")
' outputs "tag name: tag content"
logmessage element.childNodes(0).nodename & ": " & element.childNodes(0).text
logmessage element.childNodes(1).nodename & ": " & element.childNodes(1).text
logmessage "-----------------------------------"
'check for sounds
if element.childNodes(2).childNodes.length = 0 then
logmessage "sound not present"
else
logmessage "sound is present"
logmessage "-----------------------------------"
logmessage element.childNodes(2).childNodes(0).nodename & ": " & element.childNodes(2).childNodes(0).text
logmessage element.childNodes(2).childNodes(1).nodename & ": " & element.childNodes(2).childNodes(1).text
logmessage element.childNodes(2).childNodes(2).nodename & ": " & element.childNodes(2).childNodes(2).text
logmessage element.childNodes(2).childNodes(3).nodename & ": " & element.childNodes(2).childNodes(3).text
end if
logmessage "-----------------------------------"
' check for particle
if element.childNodes(3).childNodes.length = 0 then
logmessage "no particle present"
else
logmessage "number of particle: " & element.childNodes(3).childNodes.length
for i = 0 to element.childNodes(3).childNodes.length - 1
' particle structure can vary
' http://wiki.oni2.net/XML:BINA/ONIE#particle_structures
' so we will count (=j) the nodes (xml tags) under <Particle> to build a loop
logmessage "-----------------------------------"
for j = 0 to element.childNodes(3).childNodes(i).childNodes.length - 1
' e.g.           <Particles>  <Particle>    <Name>
logmessage element.childNodes(3).childNodes(i).childNodes(j).nodename & ": " & _
  element.childNodes(3).childNodes(i).childNodes(j).text
next
next
end if
logmessage "==================================="
next
' INFO : Impact: w1_tap
' INFO : Material: Unbreak_Glass
' INFO : Component: Damage
' INFO : Modifier: Any
' INFO : -----------------------------------
' INFO : sound not present
' INFO : -----------------------------------
' INFO : number of particle: 2
' INFO : -----------------------------------
' INFO : Name: d__GLASSCRACK
' INFO : Orientation: 0
' INFO : Location: 4
' INFO : Decal1: false
' INFO : Decal2: true
' INFO : -----------------------------------
' INFO : Name: w1_tap_x03
' INFO : Orientation: 0
' INFO : Location: 1
' INFO : Offset: -1
' INFO : ===================================
 
 
 
' '''[19] create txt file + write lines'''
   
   
  txt_location = "C:\Softimage\Softimage_Mod_Tool_7.5\test.txt"
  txt_location = "C:\Softimage\Softimage_Mod_Tool_7.5\test.txt"
Line 898: Line 1,000:




  ' '''[18] read txt file'''
  ' '''[20] read txt file'''
   
   
  Set objFileToRead = CreateObject("Scripting.FileSystemObject").OpenTextFile("C:\Softimage\Softimage_Mod_Tool_7.5\test.txt", 1)
  Set objFileToRead = CreateObject("Scripting.FileSystemObject").OpenTextFile("C:\Softimage\Softimage_Mod_Tool_7.5\test.txt", 1)
Line 913: Line 1,015:




  ' '''[19] check onisplit version'''
  ' '''[21] check onisplit version'''
   
   
  Set objFSO = CreateObject("Scripting.FileSystemObject")
  Set objFSO = CreateObject("Scripting.FileSystemObject")
Line 922: Line 1,024:




  ' '''[20] call CMD, e.g. to lunch onisplit or the game'''
  ' '''[22] call CMD, e.g. to lunch onisplit or the game'''
   
   
  ' relative path
  ' relative path
Line 1,000: Line 1,102:
|}
|}


  ' '''[21] building a form (PPG)'''
  ' '''[23] building a form (PPG)'''
   
   
  dim oPSet, oPPGLayout, oItem, PPG_exist
  dim oPSet, oPPGLayout, oItem, PPG_exist
Line 1,081: Line 1,183:
|}
|}


  ' '''[22] UserDataBlob'''
  ' '''[24] UserDataBlob'''
   
   
  ' you can attach data to objects, e.g. new properties for the scene root or Oni Trigger Volumes
  ' you can attach data to objects, e.g. new properties for the scene root or Oni Trigger Volumes
Line 1,117: Line 1,219:




  ' '''[23] getting the position of points (with selection mode point)'''
  ' '''[25] getting the position of points (with selection mode point)'''
   
   
  ' a point must be selected
  ' a point must be selected
Line 1,126: Line 1,228:




  ' '''[24] getting the position of points (with selection mode object)'''
  ' '''[26] getting the position of points (with selection mode object)'''
   
   
  ' an object must be selected
  ' an object must be selected
Line 1,135: Line 1,237:




  ' '''[25] getting and setting the position of points (without selection) right after object creation'''
  ' '''[27] getting and setting the position of points (without selection) right after object creation'''
   
   
  ' point positions are relative to the object's center
  ' point positions are relative to the object's center
Line 1,178: Line 1,280:




  ' '''[26] getting the scaling, rotation and position of selected objects'''
  ' '''[28] getting the scaling, rotation and position of selected objects'''
   
   
  logmessage "mesh name: " & selection(0)
  logmessage "mesh name: " & selection(0)
Line 1,192: Line 1,294:




  ' '''[27] getting the scaling, rotation, and position of not selected objects'''
  ' '''[29] getting the scaling, rotation, and position of not selected objects'''
   
   
  ' GetValue("NAME.kine.global.rotx")
  ' GetValue("NAME.kine.global.rotx")
Line 1,208: Line 1,310:




  ' '''[28] decrypting merged integer flags'''
  ' '''[30] decrypting merged integer flags'''
   
   
  ' for example the [[XML:BINA/OBJC/TRGV|BINACJBOTrigger Volume.xml]] file has flags as strings for the <Flags> tag
  ' for example the [[XML:BINA/OBJC/TRGV|BINACJBOTrigger Volume.xml]] file has flags as strings for the <Flags> tag
Line 1,272: Line 1,374:




  ' '''[29] disabling PPG popups'''
  ' '''[31] disabling PPG popups'''
   
   
  ' for example if code of a script button creates numerous objects in one go, the same number of property pages (PPG) can appear
  ' for example if code of a script button creates numerous objects in one go, the same number of property pages (PPG) can appear
Line 1,287: Line 1,389:




  ' '''[30] disabling logmessages'''
  ' '''[32] disabling logmessages'''
   
   
  ' msglogverbos is probably already set to false by default
  ' msglogverbos is probably already set to false by default
Line 1,295: Line 1,397:




  ' '''[31] getting bounding box values'''
  ' '''[33] getting bounding box values'''
   
   
  ' this could be useful to create a bounding box for [[OBD_talk:OFGA#XML|OFGA files]]
  ' this could be useful to create a bounding box for [[OBD_talk:OFGA#XML|OFGA files]]
Line 1,317: Line 1,419:




  ' '''[32] open an explorer window'''
  ' '''[34] open an explorer window'''
   
   
  ' this could be used open an output folder ...
  ' this could be used open an output folder ...
Line 1,331: Line 1,433:
| SelectNeighborObj obj 5<br>[http://i305.photobucket.com/albums/nn207/unknownfuture/Oni_Galore_Images/XSI_modding/SelectNeighborObj_obj_5.png http://i305.photobucket.com/albums/nn207/unknownfuture/Oni_Galore_Images/XSI_modding/SelectNeighborObj_obj_5_tn.png]
| SelectNeighborObj obj 5<br>[http://i305.photobucket.com/albums/nn207/unknownfuture/Oni_Galore_Images/XSI_modding/SelectNeighborObj_obj_5.png http://i305.photobucket.com/albums/nn207/unknownfuture/Oni_Galore_Images/XSI_modding/SelectNeighborObj_obj_5_tn.png]
|}
|}
  ' '''[33] working with hierarchies'''  
  ' '''[35] working with hierarchies'''  
   
   
  ' let's be sure we have an object selected
  ' let's be sure we have an object selected
Line 1,383: Line 1,485:




'''[34] drag and drop support for specific oni files'''
'''[36] drag and drop support for specific oni files'''


  function XSILoadPlugin( in_reg )
  function XSILoadPlugin( in_reg )
Line 1,435: Line 1,537:




'''[35] dae export'''
'''[37] dae export'''


  set oProps = ActiveProject.ActiveScene.Root.Properties
  set oProps = ActiveProject.ActiveScene.Root.Properties
Line 1,455: Line 1,557:




'''[36] fbx export'''
'''[38] fbx export'''


  FBXExportLights (false)
  FBXExportLights (false)
Line 1,463: Line 1,565:




'''[37] import an image clip only once'''
'''[39] import an image clip only once'''


  found_img = 0
  found_img = 0
8,452

edits