Mod Tool: Difference between revisions

From OniGalore
Jump to navigation Jump to search
mNo edit summary
mNo edit summary
Line 51: Line 51:




===view port navigation===
===camera navigation===
* move camera: [S]+[LClick]+[Moving_Mouse]
* move camera: [S]+[LClick]+[Moving_Mouse]
* rotate camera: [S]+[RClick]+[Moving_Mouse]
* rotate camera: [S]+[RClick]+[Moving_Mouse]
Line 59: Line 59:


===mesh===
===mesh===
* copying a edges from an object: select the edges, right-click, "Extract Edge as Curve", to preserve the shape use "Mesh Subdivision Level: 0" as option
* extracting a polygon from an object: select polygon, right-click, "Extract Polygons (Delete)"
* extracting a polygon from an object: select polygon, right-click, "Extract Polygons (Delete)"
* copying an polygon from an object: select polygon, right-click, "Extract Polygons (Keep)"
* copying an polygon from an object: select polygon, right-click, "Extract Polygons (Keep)"
Line 140: Line 139:
* You can also change the language by right-click the white script box and click on "Set to JScript" or "Set to VBScript".
* You can also change the language by right-click the white script box and click on "Set to JScript" or "Set to VBScript".
* Same way you can load a few code piece, e.g. "Syntax Help" > "If..Else" or "Catch Error".
* Same way you can load a few code piece, e.g. "Syntax Help" > "If..Else" or "Catch Error".
* Mark code you want to disable ("Comment Out") with single apostrophes or enable ("Comment Remove").
* Mark code you want to disable ("Comment Out") with single apostrophes ' or enable ("Comment Remove").
* In VBS you declare variables only as a variant e.g. "dim PolygonCount". Mod Tool decides what type it becomes when it uses the variable the first time.
* In VBS you declare variables only as a variant e.g. "dim PolygonCount". Mod Tool decides what type it becomes when it uses the variable the first time.
* The commands are not case-sensitive, e.g. you can write ''LogMessage'' or logmessage.
* Some common vbs functions can be found [http://www.w3schools.com/vbscript/vbscript_ref_functions.asp HERE.]
' while it is possible to use + in strings,
' you should actually use & only for strings
' and + only for numbers
logmessage "How about ... " + "a riddle?"
logmessage "Where can you find following phrase in Oni? " & "The day is mine !!"
logmessage "Did you know that Bungie likes to hide sevens? The digits of the year 2032 add up to " & cstr(2 + 0 + 3 + 2) & "."
' INFO : How about ... a riddle?
' INFO : Where can you find following phrase in Oni? The day is mine !!
' INFO : Did you know that Bungie likes to hide sevens? The digits of the year 2032 add up to 7.




'''some VBS commands that might interesting for Oni related stuff'''
'''some VBS commands that might be interesting for Oni related stuff'''


{| class="wikitable" width="100%"
{| class="wikitable" width="100%"
| width=50% valign=top | LogMessage <nowiki>[string|var]</nowiki>
| width=50% valign=top | LogMessage <nowiki>[string | var]</nowiki>
| A command to log information. It requires a string or a variable. Example:
| A command to log information. It requires a string or a variable. Example:
: LogMessage "The object's name is: " & selection(0).Name
: LogMessage "The object's name is: " & selection(0).Name
Line 197: Line 210:
:5 = ZYX
:5 = ZYX
|-
|-
|valign=top| SelectObj <nowiki>[string|var]</nowiki>
|valign=top| SelectObj <nowiki>[string | var]</nowiki>
| select one or more objects. Comma serves as separator. Example:
| select one or more objects. Comma serves as separator. Example:
: SelectObj "grid,grid1"
: SelectObj "grid,grid1"
|-
|-
|valign=top| ToggleSelection <nowiki>[string|var]</nowiki>
|valign=top| ToggleSelection <nowiki>[string | var]</nowiki>
| Adds one or more objects from current selection. If the objects are already selected then they become subtracted from the selection. Example:
| Adds one or more objects from current selection. If the objects are already selected then they become subtracted from the selection. Example:
: ToggleSelection "grid2,grid3"
: ToggleSelection "grid2,grid3"
Line 215: Line 228:
| deselects everything
| deselects everything
|-
|-
|valign=top| DeleteObj <nowiki>[string|var]</nowiki>
|valign=top| DeleteObj <nowiki>[string | var]</nowiki>
| Deletes one or more objects. Comma used as separator. Example:
| Deletes one or more objects. Comma used as separator. Example:
: DeleteObj "grid"
: DeleteObj "grid"
Line 303: Line 316:
  logmessage selected(i)
  logmessage selected(i)
  next
  next
' '''converting euler rotations (in degrees) to quaternions
dim x, y, z, dRotation, qRotation
x = 90
y = 0
z = 0
set dRotation = XSIMath.CreateRotation(XSIMath.DegreesToRadians(x), XSIMath.DegreesToRadians(y), XSIMath.DegreesToRadians(z))
set qRotation = XSIMath.CreateQuaternion()
dRotation.GetQuaternion (qRotation)
LogMessage qRotation.W
LogMessage qRotation.X
LogMessage qRotation.Y
LogMessage qRotation.Z
' INFO : 0,707106781186548
' INFO : 0,707106781186547
' INFO : 0
' INFO : 0
' '''converting quarternions to euler rotations (in degrees)'''
dim qW, qX, qY, qZ, qRotation, x, y, z
qW = 0.707106781186548
qX = 0.707106781186547
qY = 0
qZ = 0
set qRotation = XSIMath.CreateQuaternion (qW, qX , qY, qZ)
qRotation.GetXYZAngleValues x, y, z
logmessage XSIMath.RadiansToDegrees(x)
logmessage XSIMath.RadiansToDegrees(y)
logmessage XSIMath.RadiansToDegrees(z)
' INFO : 89,9999999999999
' INFO : 0
' INFO : 0




Line 313: Line 367:
* copying animation data from one character to another
* copying animation data from one character to another
* creating new door animations
* creating new door animations
' VBScript code
set oRotation = XSIMath.CreateRotation( XSIMath.DegreesToRadians( 40 ), XSIMath.DegreesToRadians (0), XSIMath.DegreesToRadians (0) )
set oQuaternion = XSIMath.CreateQuaternion()
oRotation.GetQuaternion( oQuaternion )
Application.LogMessage "Quaternion rotation is " _
& oQuaternion.X & "," _
& oQuaternion.Y & "," _
& oQuaternion.Z & "," _
& oQuaternion.W


After a few experiments onisplit v0.9.54.0 seems to output XYZ-W instead of XYZW.
After a few experiments onisplit v0.9.54.0 seems to output XYZ-W instead of XYZW.

Revision as of 14:32, 5 August 2012

general information

Various modders of the community use "Autodesk Softimage Mod Tool". Usually we just call it "Mod Tool".

Beside the free version, there's also the retail and student version "Autodesk Softimage [year]"

Those versions are also available as 64-bit versions.
If you are a student you can get Autodesk Software for free if your school is a partner of Autodesk.
In that case you can register with your email address given by your school.

But in the very most cases "Mod Tool" isn't really in disadvantage towards the retail version when it comes to modding Oni.


There's also the possibility to get files that extent Mod Tool's range of functions.

Those are scripts (*.vbs, js), toolbars (*.xsitb) and addons (*.xsiaddon).
They can be create on one's own and even shared with other users.


extensions

links


how to bind scripts to buttons (embedded code or .vbs / .js)

  • You can enable/disable the Main Shelf over "View" > "Optional Panels" > "Main Shelf". Then click the "Custom" tab.
  • A) Right-click the free gray space, click on "Customize Toolbar...". Select "Toolbar Widgets" > "Script Button".
  • Enter your code and make sure you selected the correct Scripting Language. Click okay when you are done.
  • B) You can also drag'n'drop your script file directly onto the free gray space.
  • A new window pops up, check the settings and click okay when done.
  • Right-click the Main Shelf and use the "Save" option. ("Save As" let you save the Main Shelf as toolbar file.)


how to install toolbars (.xsitb)

  • creation: goto "View" > "New custom toolbar"
  • Now you can add buttons like in Main Shelf. Remember to save your changes. (Right-click, "Save As".)
  • installation: Drag'n'drop the xsitb file onto the viewport (it's simply the window where you can see 3D objects).
  • access: goto "View" > "Toolbars"
  • deletion: goto "View" > "Manage..." Check a toolbar and click Delete button.
  • The file will remain with a new file suffix ".bak" You can restore this backup if you remove the ".bak" from the name.


how to install addons (.xsiaddon)

  • A) drag'n'drop the file into the so-called viewport (it's simply the window where you can see 3D objects), then restart Mod Tool
  • B) if drag and drop doesn't work, goto "File" > "Add-On" > "Install"
  • Then click on the "..." button to search for the file. When you found it, click the "Install" button.


selected wisdom

We've also a tutorial thread on OCF.


camera navigation

  • move camera: [S]+[LClick]+[Moving_Mouse]
  • rotate camera: [S]+[RClick]+[Moving_Mouse]
  • zoom camera: [S]+[Scrolling]
  • reset view: [R]


mesh

  • extracting a polygon from an object: select polygon, right-click, "Extract Polygons (Delete)"
  • copying an polygon from an object: select polygon, right-click, "Extract Polygons (Keep)"
  • merging two objects: select one of them, goto Model>Modify>Poly.Mesh>Boolean>Union, select second object
(this makes a copy of the second object and attaches it to the first one, the merged objects must be freezed before the original second object can be removed)
  • filling a hole: select all edges surrounding the hole and choose one of the following methods
    • A) goto Model > Modify > Poly.Mesh > Weld Boundary Points/Edges
    • 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"
  • hiding a single polygon: select polygon and hit [H], use [Control]+[H] to unhide
  • mirroring an object: select object, Edit > Duplicate/Instantiate > Duplicate Symmetry (center rotation might need to be changed afterwards)
  • working with symmetry mode
    • select object, Property > Symmetry Map (YZ/XZ/XY) (press [W] to preview symmetry plane)
    • click on Sym buttom (in Transform area) to enable/disable symmetry mode
    • changing the Symmetry plane: Explorer [8] > unfold object > Polygon Mesh > Cluster > delete SymmetryMapCls; then add a new symmetry plane


material and texture

  • 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)
  • connecting the texture with the material:
    • [7] to open Render Tree
    • in first column: "Texture"
    • in second column: drag'n'drop "Image" into the free space
    • click and hold the red point of "Image", then move it to "Phong" and release the mouse click
    • 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


projection and UV

getting started

  • in section "Texture Projection" click on "New", choose a projection similar to the mesh shape (planar / cylindrical / cubic / spherical)
  • select the object
  • Texture editor: [Alt]+[7] (open it while being in selection mode "Object" or "Polygon", otherwise the UVs aren't shown)

modify single/all UVs

  • rotate 90°: [R]
  • rotate: [C]
  • scale: [X]
  • move: [V]
  • tearing single UV parts: [Control]+[T], then move [V]
  • heal (re-connect) selected UV parts: click on the plus symbol (the parts should be very near to each other, best if the points are on same spot)
  • snap function for move tool: Snap > Enable Snapping; check "Points" (if not already active)
  • relax (smooth warped UVs): [Control]+[R] (usually pressing several times that combination)
  • a new projection can also be applied to currently selected UV parts
  • 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


scripting

  • open the Script Editor: [Alt]+[4]
  • run the current code in the Script Editor window: [F5]
  • clear the log: Edit > Clear History Log
  • actions from button embedded code will be logged
  • actions from code files that are linked in a button won't be logged (results in a performance boost)
  • you can save your code to a file via "File" > "Save As..." or "Save Selection"


links


notes about polygon extraction

  • a grid of 9 polygons (ID 0 to 8)
  • you extract the middle polygon (ID 4)
  • grid's polygon of ID 8 will change to ID 4
  • if you now extract 5th, the 7th gets the ID
  • now the ID order is: 0, 1, 2, 3, 6, 5, 4
  • this means that an automatic extraction of several polygons requires two changes in the code
  • 1) the ID array of selected polygons must be sorted
  • 2) the extraction must start with the last ID to avoid ID shift during the process (see code pieces)


some basics of VBScript

  • Logged stuff will be rewritten if you change the script language. (File > Preferences...)
  • You can also change the language by right-click the white script box and click on "Set to JScript" or "Set to VBScript".
  • Same way you can load a few code piece, e.g. "Syntax Help" > "If..Else" or "Catch Error".
  • Mark code you want to disable ("Comment Out") with single apostrophes ' or enable ("Comment Remove").
  • In VBS you declare variables only as a variant e.g. "dim PolygonCount". Mod Tool decides what type it becomes when it uses the variable the first time.
  • The commands are not case-sensitive, e.g. you can write LogMessage or logmessage.
  • Some common vbs functions can be found HERE.
' while it is possible to use + in strings,
' you should actually use & only for strings
' and + only for numbers

logmessage "How about ... " + "a riddle?"
logmessage "Where can you find following phrase in Oni? " & "The day is mine !!"
logmessage "Did you know that Bungie likes to hide sevens? The digits of the year 2032 add up to " & cstr(2 + 0 + 3 + 2) & "."

' INFO : How about ... a riddle?
' INFO : Where can you find following phrase in Oni? The day is mine !!
' INFO : Did you know that Bungie likes to hide sevens? The digits of the year 2032 add up to 7.


some VBS commands that might be interesting for Oni related stuff

LogMessage [string | var] A command to log information. It requires a string or a variable. Example:
LogMessage "The object's name is: " & selection(0).Name
logmessage selection(0).Name Logs the object name.
logmessage selection(0).Material.Name Logs the material name.
logmessage selection(0).Material.CurrentImageClip.Name Logs the texture name. "." before the file suffix is replaced by "_". Also a number might follow after the file suffix. Output example:
INFO : grid_part_8_tga4
logmessage selection(0).sclx.value Logs object's X scaling.
logmessage selection(0).scly.value Logs object's Y scaling.
logmessage selection(0).sclz.value Logs object's Z scaling.
logmessage selection(0).rotx.value Logs object's X rotation.
logmessage selection(0).roty.value Logs object's Y rotation.
logmessage selection(0).rotz.value Logs object's Z rotation.
logmessage selection(0).posx.value Logs object's X position.
logmessage selection(0).posy.value Logs object's Y position.
logmessage selection(0).posz.value Logs object's Z position.
logmessage selection(0).rotorder.value Logs object's rotation order.
0 = XYZ
1 = XZY
2 = YXZ
3 = YZX
4 = ZXY
5 = ZYX
SelectObj [string | var] select one or more objects. Comma serves as separator. Example:
SelectObj "grid,grid1"
ToggleSelection [string | var] Adds one or more objects from current selection. If the objects are already selected then they become subtracted from the selection. Example:
ToggleSelection "grid2,grid3"
SelectAllUsingFilter [SelFilter], [CheckComponentVisibility], [AffectSelectionList], [CheckObjectSelectability] Selects everything that matches the filter and other options. Example:
SelectAllUsingFilter "object", siCheckComponentVisibility
selects all roots, lights, cameras, and geometry (meshes)
SelectAllUsingFilter "geometry", siCheckComponentVisibility
selects all geometry (meshes)
DeselectAll deselects everything
DeleteObj [string | var] Deletes one or more objects. Comma used as separator. Example:
DeleteObj "grid"
DeleteObj "grid,grid1"
FreezeObj Makes all changes final. But saving those changes is still necessary. (Click on key symbol so it gets red.)
Translate [InputObjs], [X], [Y], [Z], [Delta], [RefMode], [Center], [AxesFilter], [Snap], [SnapReference], [SnapFilter], [SplitLocalComponents], [PropTagOnly], [Pivot], [PivotX], [PivotY], [PivotZ], [ConstructionMode], [SlideComponents] see link
Rotate [InputObjs], [X], [Y], [Z], [Delta], [RefMode], [Center], [AxesFilter], [Reference], [SplitLocalComponents], [PropTagOnly], [Pivot], [PivotX], [PivotY], [PivotZ], [ConstructionMode], [SlideComponents] see link


code pieces (VB Script)

' making an array
' make some object, select them and run the code

dim y
y = selection.count

redim x (y - 1)
	' redim is needed for arrays
	' () sets the number of array items
 
for i = 0 to y - 1
	x(i) = selection(i).fullname
	logmessage x(i)
next

logmessage "counted objects: " & y


' check selection mode 

checkfilter
'use sub to make use of the exit command

sub checkfilter
	Select Case Selection.Filter.Name
	'caution: case-sensitive

	Case "object"
		logmessage "object mode"
	Case "Edge"
		logmessage "edge mode"
	Case "Vertex"
		logmessage "point mode"
	Case "Polygon"
		logmessage "polygon mode"
		polymode
	Case Else
		logmessage "Choose Object or Polygon selection mode."
		exit sub
	End Select
end sub


' getting the IDs of selected polygons plus sorting them

poly_count = Selection(0).SubComponent.ComponentCollection.count
logmessage "poly_count: " & poly_count
redim selected (poly_count)
logmessage "Show ID as it is."
for i=0 to poly_count - 1
	' build ID array
	selected(i) = Selection(0).SubComponent.ComponentCollection(i).index
	logmessage selected(i)
next

' change sort order by replacing ">" with "<"
For i = 0 To poly_count - 1
	For j = 0 To poly_count - 1
		If selected(i) > selected(j) Then
			tmp = selected(i)
			selected(i) = selected(j)
			selected(j) = tmp
		End If
	Next
Next
logmessage "Show sorted ID."

for i=0 to poly_count - 1
	logmessage selected(i)
next


' converting euler rotations (in degrees) to quaternions

dim x, y, z, dRotation, qRotation
x = 90
y = 0
z = 0

set dRotation = XSIMath.CreateRotation(XSIMath.DegreesToRadians(x), XSIMath.DegreesToRadians(y), XSIMath.DegreesToRadians(z)) 
set qRotation = XSIMath.CreateQuaternion() 

	dRotation.GetQuaternion (qRotation) 
	LogMessage qRotation.W
	LogMessage qRotation.X
	LogMessage qRotation.Y
	LogMessage qRotation.Z
	' INFO : 0,707106781186548
	' INFO : 0,707106781186547
	' INFO : 0
	' INFO : 0


' converting quarternions to euler rotations (in degrees)

dim qW, qX, qY, qZ, qRotation, x, y, z

	qW = 0.707106781186548
	qX = 0.707106781186547
	qY = 0
	qZ = 0

set qRotation = XSIMath.CreateQuaternion (qW, qX , qY, qZ)

	qRotation.GetXYZAngleValues x, y, z
	logmessage XSIMath.RadiansToDegrees(x)
	logmessage XSIMath.RadiansToDegrees(y)
	logmessage XSIMath.RadiansToDegrees(z)
	' INFO : 89,9999999999999
	' INFO : 0
	' INFO : 0


script ideas

  • making an import/export for some trigger volume data (semi-transparent cubes, the level geometry itself would just serve as reference)
  • hierarchy builder for characters
maybe null objects could stand for the centers of body parts Then one click and the centers gets positioned, rotations are known and the names lead to the correct hierarchy
  • autoheal discontinuities (blue lines) of overlaying edges (for repairing google sketchup objects that weren't yet textured)
  • making loops from parts of animations
  • copying animation data from one character to another
  • creating new door animations

After a few experiments onisplit v0.9.54.0 seems to output XYZ-W instead of XYZW.

Example:

				X	Y	Z
Rotation in Mod Tool		40	0	0
--------------------------------------------------------------
				X	Y	Z	W
Q.Rotation in Mod Tool		0,342	0	0	0,939	
--------------------------------------------------------------
				X	Y	Z	-W
Q.Rotation onispl. v54		0,334	0	0	-0,94

Also, OBAN flag "ZAxisUp" needs some more investigation.