2012年2月14日 星期二

MAXscript : 如何自動觸發Dialog中的按鈕

在Max中有許多不被MAXscript直接支援的東西,譬如說Load Envelopes等等的Dialog,此時可靠一個callback function來解決,CGS的Bobo分享了這個方法,另外在這邊也有相關討論

fn ANoon_EnvelopeCallbackFunction =
(
    WindowHandle = DialogMonitorOPS.GetWindowHandle()
    theDialogName = UIAccessor.GetWindowText WindowHandle
    if theDialogName != undefined and matchpattern theDialogName pattern:"*Load Envelopes*" do
    UIAccessor.PressButtonByName WindowHandle "OK" true
)

DialogMonitorOPS.RegisterNotification ANoon_EnvelopeCallbackFunction ID:#ANoon_Envelopes
DialogMonitorOPS.Enabled = true

這個callback是case sensitive

2012年2月9日 星期四

MAXscript : Skinops Methods

今天想寫個merge已綁定模型的同時也自動將skin加上去的script,但是當寫到給merge進來的模型add bone的時候就是一直** system exception **,搞了好久一直找不到原因,上網搜了一下找到答案了,原來是skinops的methods一定要在該skin modifier可以被選取的狀態下才可以使用!!真是太不人性化了...

Help裡面就有寫著,一直被我無視...
The following methods require that the Skin modifier be the displayed modifier in the Modify panel, and that the Modify panel is active.
addbone後要執行load envlope時,又遇到一個問題,load envlope雖然成功執行,但是卻沒有load到envlope,咕狗後發現解決辦法(還有如何執行load envlope dialog的按鈕的方法),一為執行load envlope兩次,二為在load envlope之前加入completeRedraw()。

2012年2月7日 星期二

MAXscript : 控制外部文件

MAXscript 控制外部文件的函數 (適用於max檔案及非max檔案)


getFiles "wild_card_filename_string"
Returns an array of file names that match the given wild-card path name. The following example gets an array of all the .max scene files in c:\foo and then loops over the array, opening each file and printing the objects in each:
files = getFiles "c:\\foo\\*.max"
for f in files do (loadMAXFile f; print objects)
getFiles() can also be used to determine if a file exists.


getDirectories "wild_card_directory_name_string"
Returns an array of directory paths that match the given wild-card directory path name.


makeDir "directorypath_string" all:
Return false on failure (either because the path could not be created or because the path already existed).


deleteFile "filename_string"
Fails if the file is open in MAXScript.


renameFile "old_filename_string" "new_filename_string"
Renames the old file to the new file. This can also be used to move a file between directories. Fails if new file already exists or if the old file is open in MAXScript. Returns true on success, false on failure.


copyFile "existing_filename_string" "new_filename_string"
Copies the existing file to the new file. Fails if the new file already exists, the new file cannot be created, or the existing file is open in MAXScript. Returns true on success, false on failure.


getFileSize "filename_string"
Returns the size of the specified file in bytes. Returns 0 if the file could not be found.


getFileAttribute "filename_string" "attribute"
setFileAttribute "filename_string" "attribute"
The valid values are:
#readOnly #hidden #system #directory #archive #temporary #normal


getFileModDate "filename_string"
getFileCreateDate "filename_string"


getFileVersion "filename_string"
This data is typically specified only for executable and application extension (i.e., .dll) files.


FileStream Values


createFile


openFile [ mode: ]


close filepath


Standard Open and Save File Dialogs


getOpenFileName
getSaveFileName
Both functions return a fully-specified file path name or undefined if the user cancels out.
When the optional keyword filename: is supplied, the string is used to define the path and file name of the file to be loaded or saved. The dialog automatically navigates to the specified path (if available on the disk/network), displays its content in the browsing area and suggests the file name in the "File name" field. If the path does not exist, the current path is used and only the file name is displayed as requested.

getMAXFileObjectNames
傳回該檔案內物件的字串陣列


checkForSave()
儲存確認視窗


shellLaunch "notepad.exe" filepath
執行外部程式 eg. Notepad


File Name Parsing 檔名的解析
filenameFromPath "filename_string"
從完整的檔案路徑中擷取檔名(包含副檔名)


getFilenamePath " filename_string "
getFilenameFile " filename_string "
getFilenameType " filename_string "
從完整的檔案路徑中獲得目錄路徑、檔案檔名(不含副檔名)、副檔名


doesFileExist " filename_string "
return True or False

2012年2月3日 星期五

關於遊戲開發資料收集

The Anatomy of a Design Document, Part 1: Documentation Guidelines for the Game Concept and Proposal (1999)
The Anatomy of a Design Document, Part 2: Documentation Guidelines for the Functional and Technical Specifications(1999)
Game Production TimeLine - Game Production TimeLine

Python 資訊收集

fcamel's blog: 學 Python 的入門書: 常看到有人問這問題,想說來寫篇心得,省得重覆回一樣的問題。 我在學 Python 前已學過別的程式語言,所以想找針對已學過程式的人的書。一開始翻許多人推薦的《Learning Python》,發現它是針對沒學過程式的人,有太多篇幅在介紹基本觀念 (如 if 是什麼 ),翻沒幾...

fcamel's blog: Python 的特別之處 (1): 從新手的眼中來看 Python,比較能看出 Python 和其它語言不同之處。最近有機會幫別人快速上手 Python,就順便整理一下我從中發覺 Python 較為突出的優點。 list、dictionary and string 平時 coding 最常用到的 container...


blur-devBlur Studio API's, Libraries and Tools : Python and 3dsMax

Dive Into PythonPython from novice to pro: Dive Into Python is a free Python book for experienced programmers. It was originally hosted at DiveIntoPython.org, but the author has pulled down all copies. It is being mirrored here. You can read the book online, or download it in a variety of formats. It is also available in multiple languages.