Skip to content

Commit

Permalink
Release version 2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
n0samu committed Oct 31, 2023
1 parent d0be080 commit bb9bfca
Show file tree
Hide file tree
Showing 21 changed files with 1,758 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Tools/
Xtras/
*.exe
4 changes: 4 additions & 0 deletions AutoDismissOnFrame.ls
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
on exitFrame me
dismissPopupDialogs()
go to the frame
end
Binary file added AutoDismisser.dir
Binary file not shown.
42 changes: 42 additions & 0 deletions AutoDismisser.ls
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
global msgXtra

on clickWindowButton windowRef, buttonNum
set WM_LBUTTONDOWN = 513
set WM_LBUTTONUP = 514

set buttonRefs = baChildWindowList(windowRef, "Button", "", False)
if buttonNum <= the count of buttonRefs then
set buttonRef = buttonRefs.getAt(buttonNum)
msgXtra.send_msg(buttonRef, WM_LBUTTONDOWN, 0, 0)
msgXtra.send_msg(buttonRef, WM_LBUTTONUP, 0, 0)
return True
end if
return False
end

on findDialog windowTitle, exactMatch
set dialogClass = "#32770"
set dialogRefs = baWindowList(dialogClass, windowTitle, exactMatch)
if the count of dialogRefs > 0 then return dialogRefs.getAt(1)
return 0
end

on dismissDialog windowTitle, exactMatch, buttonIndex
set dialogRef = findDialog(windowTitle, exactMatch)
if dialogRef then return clickWindowButton(dialogRef, buttonIndex)
end

on dismissPopupDialogs
dismissDialog("Director Player Error", True, 1)
dismissDialog("Where is" && QUOTE, False, 2)
end

on prepareMovie
if the commandLine = EMPTY then
alert "This is a tool used by Cast Ripper. It should not be run directly."
halt()
else
set the title of the window = the commandLine
end if
set msgXtra = new xtra("msg")
end
4 changes: 4 additions & 0 deletions ButtonBehavior.ls
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
on mouseUp me
set btn = sprite (the spriteNum of me)
if the visible of btn and the enabled of btn then clickButton(the name of btn)
end
12 changes: 12 additions & 0 deletions CheckboxBehavior.ls
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
property opt

on getPropertyDescriptionList me
list = [:]
addProp list, #opt, [#comment: "The option that this checkbox corresponds to:", #format: #symbol, #default: #empty ]
return list
end

on mouseUp me
set cb = sprite (the spriteNum of me)
clickCheckbox(cb)
end
153 changes: 153 additions & 0 deletions CommandLine.ls
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
on setMemberTypes types
global memberTypes
if the count of types = 0 then
errorMsg("Please specify at least one member type to export")
else if the count of types = 1 and types.getAt(1) = "all" then
enableAllCategories()
else
set msg = "Unknown member type:"
set allTypes = the value of field "MemberTypes"
set allCategories = getAllProps(the value of field "MemberCategories")
repeat with t in types
if t starts "#" then
set memberType = value(t)
if allTypes.getPos(memberType) > 0 then
memberTypes.setaProp(memberType, True)
else
errorMsg(msg && t)
end if
else
if t = "3d" then set t = "shockwave3d"
set memberCategory = symbol(t)
if allCategories.getPos(memberCategory) > 0 then
updateCategory(memberCategory, True)
else
errorMsg(msg && t)
end if
end if
end repeat
end if
end

on setExportFormats formats
global exportFormats
set allFormats = the value of field "ExportFormats"
repeat with fmt in formats
set fmt = symbol(fmt)
if allFormats.getPos(fmt) > 0 then
exportFormats.setaProp(fmt, True)
else
errorMsg("Unknown export format:" && fmt)
end if
end repeat
end

on parseCommandLineArgs argsList
set parsedArgs = propList()
set argName = EMPTY
set argVals = list()
repeat with arg in argsList
if char 1 to 2 of arg = "--" then
set argName = arg
delete char 1 to 2 of argName
set argVals = parsedArgs.getaProp(argName)
if argVals = VOID then
set argVals = list()
end if
else if char 1 of arg = "-" and the number of chars in arg = 2 then
parsedArgs.setaProp(char 2 of arg, list())
else
argVals.append(arg)
end if
parsedArgs.setaProp(argName, argVals)
end repeat
return parsedArgs
end

on setFlagOpt optName, optVal
global exportOptions
if the count of optVal > 0 then
errorMsg("Unknown arguments after" && optName & ":" && optVal)
else
exportOptions.setaProp(optName, True)
end if
end

on processCommandLineArgs args
global fxObj, consoleMode, movieFiles, castFiles, exportFolder
set options = parseCommandLineArgs(args)
if the count of options = 0 or the runMode = "Author" then return

repeat with i = 1 to the count of options
set optName = options.getPropAt(i)
set optVal = options.getAt(i)
case optName of
"help", "h": printInfo(True)
"version", "v": printInfo(False)
-- File paths can be passed without an option name
"files", EMPTY: processSelection(optVal)
"folders": set inputFolders = optVal
"movies": set movies = optVal
"casts": set casts = optVal
"output-folder": set exportFolderOpt = optVal
"member-types": setMemberTypes(optVal)
"formats": setExportFormats(optVal)
"include-names": setFlagOpt(#exportWithNames, optVal)
"decompile": setFlagOpt(#decompile, optVal)
"dismiss-dialogs": setFlagOpt(#dismissDialogs, optVal)
"text-to-images": setFlagOpt(#textToImages, optVal)
otherwise: errorMsg("Unknown option:" && optName)
end case
end repeat

if listP(inputFolders) then
repeat with folderPath in inputFolders
if fxObj.fx_FolderExists(folderPath) then
processSelection(getDirFiles(folderPath))
else
errorMsg("The specified input folder does not exist:" && folderPath)
end if
end repeat
end if

if listP(movies) then
checkFilesExist(movies)
appendItems(movieFiles, movies)
end if

if listP(casts) then
checkFilesExist(casts)
appendItems(castFiles, casts)
end if

if consoleMode then -- User won't be able to set these options via the UI; fail immediately
if the count of movieFiles = 0 and the count of castFiles = 0 then
errorMsg("Please specify at least one Director movie or cast file to export from")
end if
if voidP(exportFolder) and voidP(exportFolderOpt) then
if not setDefaultExportFolder() then errorMsg("Please specify an output folder path to export to")
end if
end if
if listP(exportFolderOpt) then
if the count of exportFolderOpt = 1 then
if not setExportFolder(exportFolderOpt.getAt(1)) then
errorMsg("The specified output folder does not exist or is not writable")
set exportFolder = EMPTY
end if
else
errorMsg("Please specify exactly one folder path to export to. If the path contains spaces, wrap it in quotes.")
end if
end if
end
on printInfo includeHelp
infoMsg(the movieAboutInfo)
if includeHelp then
infoMsg("Usage:" && the applicationName && "[files...] [options...]")
repeat with i = 1 to the number of lines of field "CmdLineHelp"
infoMsg(SPACE & line i of field "CmdLineHelp")
end repeat
end if
quit() -- halt() seems to sometimes not work from a prepareMovie handler
end
Binary file added DirectorCastRipper.dir
Binary file not shown.
Loading

0 comments on commit bb9bfca

Please sign in to comment.