Mod Tool: Difference between revisions

113 bytes removed ,  4 July 2013
m
improved code piece: DnD
mNo edit summary
m (improved code piece: DnD)
Line 1,482: Line 1,482:
  function XSILoadPlugin( in_reg )
  function XSILoadPlugin( in_reg )
  in_reg.Author = ""
  in_reg.Author = ""
  in_reg.Name = "Oni_drag_and_drop"
  in_reg.Name = "Oni drag and drop support"
  in_reg.Email = ""
  in_reg.Email = ""
  in_reg.URL = ""
  in_reg.URL = ""
Line 1,489: Line 1,489:
   
   
  in_reg.RegisterEvent "support_oni_DnD",siOnDragAndDrop
  in_reg.RegisterEvent "support_oni_DnD",siOnDragAndDrop
'RegistrationInsertionPoint - do not remove this line
  'RegistrationInsertionPoint - do not remove this line
   
   
  XSILoadPlugin = true
  XSILoadPlugin = true
Line 1,501: Line 1,501:
  end function
  end function
   
   
  function support_oni_DnD_Init( in_ctxt )
  function support_oni_DnD_OnEvent( in_ctxt )
  dim action
  Set objFSO = CreateObject("Scripting.FileSystemObject")
  set action = in_ctxt.GetAttribute( "DragAndDropAction" )
  end function
  FullFilePath = in_ctxt.GetAttribute("DragSource")
  FileExt = objFSO.GetExtensionName(FullFilePath)
FileName = objFSO.GetBaseName(FullFilePath)
   
  if instr(LCase(FileExt), "oni") = 1 then
  in_ctxt.SetAttribute "DragSourceSupported", true
 
  ' next line prevents the code from being repeated
if in_ctxt.GetAttribute("DragAndDropAction") = 1 then
   
   
' Callback for the support_oni_DnD event.
logmessage "What I'm supposed to do with that oni?"
function support_oni_DnD_OnEvent( in_ctxt )
' do more stuff here
filename = in_ctxt.GetAttribute("DragSource")
' ..................
' isolate file extension from full name
' e.g. telling onisplit to extract the oni
FileExt = right(filename, len(filename) - instrrev(filename, "."))
   
   
' use LCase to recognize extension that might be in upper case, e.g. rewrites "ONI" to "oni"
  end if
if len(FileExt) = 3 and instr(LCase(FileExt), "oni") = 1 then
'enable drop if file extension is "oni"
  in_ctxt.SetAttribute "DragSourceSupported", true
end if
' catch file drop event
if in_ctxt.GetAttribute("DragAndDropAction") = 1 then
' code that handels the imported file
' there could be a subtype recognition e.g. to let onisplit convert AKEV to dae files
' [...]
  end if
  end if
   
   
' Return value is ignored as this event can not be aborted.
  support_oni_DnD_OnEvent = true
  support_oni_DnD_OnEvent = true
  end function
  end function




Line 1,611: Line 1,609:
** LSIs gets imported with a placeholder geometry (there's no easy way to detect what actual LSI is used for a level)
** LSIs gets imported with a placeholder geometry (there's no easy way to detect what actual LSI is used for a level)
** using LSIs from the manager works though (just keep in mind that levels are fixed to one type of LSI)
** using LSIs from the manager works though (just keep in mind that levels are fixed to one type of LSI)
** new LSIs can be added at ...\Softimage\Softimage_Mod_Tool_7.5\OniXSI_resources\PowerUps\LSI
version 2 (skipped release)
* better support for future custom resources
<!--  
<!--  
pushed back
pushed back
8,452

edits