随笔分类 - MaxDevelopGuide
Max开发入门
摘要:也是帮网友写的。不过最后没用上。哈哈。targetPF = $startTime = AnimationRange.Start.FrameendTime = AnimationRange.End.FrameparticlesCount = targetPF.numParticlesGenerated() particleMeshs = #()particleMeshs[particlesCount] = undefinedfor timeIndex = startTime to endTime do( SliderTime = timeIndex for particID = 1 ...
阅读全文
摘要:看到有网友需要写的,其实镜像就是缩放改为负数Fn MirrorObject argObjects argAxisName =( local axisNames = #(#x,#y,#z) if FindItem axisNames argAxisName == 0 do ( throw "the second parameter error !!! -- valid values:#x,#y,#z" ) local mirrorMatrix = matrix3 1 if argAxisName == #x do mirrorMatri...
阅读全文
摘要:Fn SmtpSendMail argSmtpAddress argSenderAddress argSenderPassword argTargetAddress argTitle argMessage = ( tempSmtpClient = DotNetObject "System.Net.Mail.SmtpClient" argSmtpAddress tempSmtpClient.UseDefaultCredentials = false tempSmtpClient.Credentials = DotNetObject "System.Net.Netwo
阅读全文
摘要:IGame是MaxSDK中的一个组件,在原生接口上做了封装来方便导出数据,以往在MaxScript中是不能调用IGame的,不过从Max2013开始MaxSDK有了.net版本(Max2012安装了扩展包也可以),MaxScript也可以使用MaxSDK的全部接口了。范例如下Fn InitializeMaxSDK = ( local result = false if (MaxVersion())[1] >= 14000 do ( result = (DotNetClass "Autodesk.Max.GlobalInterface") != undefined...
阅读全文
摘要:rollout testRollout1 "testRollout"( slider dddd "dddd" )rollout testRollout2 "testRollout"( slider dddd "dddd" )rollout testRollout "testRollout"( button btn "O_o" on btn pressed do ( testRollout1.open = not testRollout1.open testRollout2.o
阅读全文
摘要:这个需要用另外的进程来做,不然执行到关闭就会终止脚本的执行。简单的范例如下Fn ReStartMax inputSecond = ( local CSharpProvider,CompilerParams,CompilerResults,errorMessage CSharpCodeSource =" using System; using System.Diagnostics; using System.Threading; namespace Temp { static class Program { ...
阅读全文
摘要:也是有网友需要写的范例Fn GetFunctionSetCursorPos = ( local result = undefined if DotNetClass "WinAPI.Utilities" == undefined then ( CSharpCodeSource ="using System; using System.Runtime.InteropServices; namespace WinAPI { public class Utilities { ...
阅读全文
摘要:Fn GetAllFiles inputPath inputFilterList outArray:#() =( directories = GetDirectories (inputPath + "*") if directories.count > 0 do for tempPath in directories do ( GetAllFiles tempPath inputFilterList outArray:outArray ) for tempFilter in inputFilterList do ( tem...
阅读全文
摘要:Max2012使用Nitrous作为显示驱动的时候会有个Bug,就是MaxScript无法用GW.TransPoint来将世界坐标转换为屏幕坐标.这个Bug在2013中已经修复,2012可以换用Direct3D来解决,当不能换的时候,可以用该函数凑合解决一下:)。Fn WorldPositionToScreen inputPos =( viewMatrix = GetViewTM() viewCameraMatrix = Inverse viewMatrix screenRange2D = GetViewSize() refPosition = inputPos * v...
阅读全文
摘要:看到有人需要,简单写了一下Fn GetMaterialSample inputMaterial inputWidth inputHeight =( result = undefined with redraw off with undo off ( tempHiddenObject = for tempObject in Objects where not tempObject.ishidden collect tempObject Hide tempHiddenObject tempCamera = Freecamera fo...
阅读全文
摘要:也是在qq群遇到的网友的问题,,实际上如果只是合并成psd也可以找.net的库来做,不过大部分库都是只能读不能写,是因为psd的授权问题。此外也为了普及一下ole这个老古董。不过这段代码只操作cs6通过,其他photoshop的版本可能有改动。Fn CombineTextureToPSD inputSourceArray inputSavePsdFile photoshopExit:true =( if inputSourceArray.Count > 1 do ( Global PhotoshopApplication PhotoshopApplic...
阅读全文
摘要:有时一些中文的脚本会在max2013中显示为乱码,是因为max2013将多种语言统一在一起的缘故,在开始菜单中max2013可以用支持的各种语言的版本启动。题外插一句,可见还是用英文比较合适,不会出现乱码问题,哈哈。要解决使用中文的脚本乱码问题,方式如下。第一种是手动========================================================================惯例分隔线,以下是代码改变选项的方式,美术同鞋可以止步了,技术美术和程序请继续=======================================================
阅读全文
摘要:介绍几个东西,如何在Max插件里使用.net来做界面,怎么为插件增加maxScript的脚本接口以及命令行参数来直接测试导出插件。先说第一个,首先是visualstudio的项目设置里开启clr的支持,添加需要的引用,然后需要在DllMain里增加BOOL WINAPI DllMain(HINSTANCE hinstDLL,ULONG fdwReason,LPVOID lpvReserved){ if( fdwReason == DLL_PROCESS_ATTACH ) { hInstance = hinstDLL; DisableThread...
阅读全文
摘要:其实是以前博客的老贴子,太久没写博了,就粘贴过来点自Max9开始,MaxScript可以直接调用.Net的dll文件,并且可以创建其中的类使用其中的方法。而.Net又可以调用C++编写的dll文件。于是可以使用C#对C++的代码封装一下,在max里调用。以下为范例。---------------以下为dll.defLIBRARY "Dll"EXPORTS HelloWorld @1--------------以下为dll.cpp文件内容BOOL APIENTRY DllMain( HANDLE hModule, DWORD ul_reaso...
阅读全文
摘要:DotNetClipboard = DotNetclass "System.Windows.Forms.Clipboard"tempImage = DotNetClipboard.GetImage()if tempImage != undefined do tempImage.save "d:\\test.jpg"if DotNetClipboard.ContainsFileDropList() do ( fileList = DotNetClipboard.GetFileDropList() for i = 0 to (fileList.count -
阅读全文
摘要:原本记录在网易博客的,有人问起,查了一下就顺路搬过来其实就是这一句脚本设置一下就好。可以放到自动启动里。(DotNetClass"System.Windows.Forms.Application").CurrentCulture=dotnetObject"System.Globalization.CultureInfo""zh-cn"
阅读全文
摘要:遇到有人问如何用代码设置checkbox的同时执行on checkbox changedstate 事件其实事件就是这个控件的一个函数范例如下,话说最近乱七八糟的忙,一直没有写帖子。有时间还是要积累一下View Code 1 rollout testRollout "" 2 ( 3 checkBox ckb1 "CheckButton" 4 button btn1 "Button" 5 on ckb1 changed state do 6 ( 7 print state 8 ) 9 on btn1 pressed do1...
阅读全文
摘要:theVoice = CreateOLEObject "SAPI.SpVoice"theVoice.Speak "Hello"你可以把hello替换成任意其他单词或句子比如 “fuck”然后你可以藏在任意地点来执行,你甚至可以用callback把这段脚本存在Max文件里,然后有人打开文件的时候就会发出“fuck”等等的声音。WinXP的话,控制面板--语音,Win7的话,控制面板--语音识别--文本到语音转换,有个列表可以换语音包
阅读全文
摘要:有网友问我如何使用脚本来创建十二面体,因为时间不多,所以只是用了顶点列表的方式。代码如下View Code plugin simpleObject DodecahedronGeometryPluginname:"Dodecahedron"classID:#(0x1e73aacc, 0x54773e26)category:"ScriptedGeometry"( parameters main rollout:params ( size type:#worldUnits ui:size default:0 ) rollout params "Par
阅读全文
摘要:sourceImage = openBitMap "d:\\testimage.bmp"outputImage = bitmap sourceImage.width sourceImage.heightcopy sourceImage outputImage outputImage.fileName = "d:\\testImage.jpg"JPEG.setQuality 99save outputImage--BitmapIO
阅读全文

浙公网安备 33010602011771号