element3ds.com
WOCHI  发表于 2015-11-11 08:20:02  
41#
立刻提起了精神。
回复 收起回复
使用道具
_main  发表于 2015-12-3 12:58:35  
42#
想要成大触,天天上元素!
回复 收起回复
使用道具
天哪丶你真高  发表于 2015-12-5 10:54:15  
43#
元素那么大,我想来看看!
回复 收起回复
使用道具
为了下图片  发表于 2015-12-6 01:10:39  
44#
元素帖子强,满满正能量!
回复 收起回复
使用道具
二次元萝莉控  发表于 2016-12-13 14:17:40  
45#
/**
* 2013-5-10 由 霸王硬上弓 编写
* cg++ id :脚本天下
* 转载请注明出处,Element3ds万岁
*/

global dlgIns = rolloutCreator "defaultRol" rolloutName  --控件的父窗口
global currBtnList = undefined

fn findLastString str substr =(  --可以使用findLastString "12xx3xxxx4xxx567x8" "xx"测试;找到最后一个字符串的索引
        lastInd = ind = 0
        while ((ind = findstring str substr) !=undefined) do(
                str = substring str (ind+1) -1
                lastInd+=ind
        )
        lastInd
)

fn filterstr str findstr &strs= (
        ind = findstring str findstr
        if ind !=undefined then (
                if ind > 1 do (
                        cutstr = substring str 1 (ind-1)
                        append strs cutstr
                )
                levstr = substring str (ind + findstr.count) -1
                filterstr levstr findstr &strs
        )
        else if str!="" then append strs str
)
firstInd
fn replaceString str findStr replaceStr filterStand:on =( --默认开启标准filter,需要使用逐字符过滤就关闭
        strArr = #()
        if filterStand then (
                strArr = filterstring str findstr
        ) --filterstring "xxx-xxx-xxx" "x-x"结果为#()空,不是#("xx","x","xx")
        else(
                filterstr str findstr &strArr
        )
        firstInd = findstring str findstr
        lastkey  = findLaststring str findstr
        result = ""
        for i=1 to strArr.count do append result (strArr+replaceStr)
        if lastkey+findstr.count != str.count+1 do result = substring result 1 (result.count-replaceStr.count) --替换字符串不为尾项就掐掉
        if firstInd == 1 do result = replaceStr + result  --替换字符串为首项就添加替换字符到最前
        result
)

fn getMxs_ directory &pathArr=(
        if directory != undefined and doesFileExist directory then (
                mxsArr = getFiles (directory+"*.ms*")
                mxsArr = for mxs in mxsArr where not (getFileAttribute mxs #hidden) collect mxs
                join pathArr mxsArr
                dirArr = getDirectories (directory+"*")
                dirArr = for d in dirArr where not  (getFileAttribute d #hidden) collect d
                for d in dirArr do getMxs_ d pathArr
                pathArr
        )
        else #()
)

fn gencurrBtnList files rolloutName = ( --用于脚本管理器中 生成动态对话框
        dlgIns = rolloutCreator "defaultRol" rolloutName
        dlgIns.begin()
        for i=1 to files.count do(
                fname = getFilenameFile files
                theCtrl = "dlgIns.addControl #Button #Button"+(i as string)+" \"" + fname + "\" " + "paramStr: \" width:150 height:25 \""
                execute theCtrl
                event = "dlgIns.addHandler #Button"+(i as string)+" #pressed filter:on codeStr:\"fileIn @"+files+"@\" "
                execute event
                event2 = "dlgIns.addHandler #Button"+(i as string)+" #rightclick filter:on codeStr:\"shellLaunch @"+files+"@ @ @ \" " --两个@ @不能靠紧
                execute event2
        )
        rol = dlgIns.end()
        rol
)

fn defaultPath srcPath tagPath = (
        if not doesFileExist srcPath then tagPath
        else srcPath
)

rollout rt_mxsManager  "MaxScript Manager" width:200 height:400(
        edittext edt_msPath "Path:" text:"" width:150 height:20 across:2
        button btn_msPath "+" width:20 offset:[35,0]
        subrollout workZone "subRol" height:(rt_mxsManager.height - 40 )

                local selfScriptDir = getFileNamePath (getsourceFileName()) --缺省脚本目录
        local msPathIni = selfScriptDir + "msPath.ini"


        on rt_mxsManager  open do (
                pathFromIni = getIniSetting msPathIni "Directories" "MS"
                msPath = defaultPath pathFromIni selfScriptDir
                edt_msPath.text = replaceString msPath "/" "\\"
                dfiles = getMxs_ msPath #()
                files = for file in dfiles collect (replaceString file "\\" "/")
                currBtnList = gencurrBtnList files "Third Plugin"
                AddSubRollout rt_mxsManager.workZone currBtnList

                height = (getIniSetting msPathIni "UI" "height") as number
                if height == 0 do height = 400
                rt_mxsManager.height = height
                rt_mxsManager.workZone.height = (amax height 41) - 40
        )

        on btn_msPath pressed do(
                scriptDir = getSavePath caption:"Get Directories" initialDir:(defaultPath (edt_msPath.text) selfScriptDir)
                edt_msPath.text = scriptDir
                dfiles = getMxs_ scriptDir #()
                files = for file in dfiles collect (replaceString file "\\" "/")
                if files.count>0 do (
                        newBtnList = gencurrBtnList files "Third Plugin"
                        removeSubRollout rt_mxsManager.workZone currBtnList
                        AddSubRollout rt_mxsManager.workZone newBtnList
                        currBtnList = newBtnList
                )
        )

        on rt_mxsManager close do (
                setINISetting msPathIni "Directories" "MS" ( replaceString (edt_msPath.text) "\\" "/" )
                setINISetting msPathIni "UI" "height" (rt_mxsManager.height as string)
        )

        on rt_mxsManager resized size do (
               rt_mxsManager.workZone.height = size.y - 40
        )
)
createDialog rt_mxsManager lockWidth:on lockHeight:off style:#(#style_resizing,#style_toolwindow,#style_sysmenu)
回复 收起回复
使用道具
二次元萝莉控  发表于 2016-12-13 14:17:43  
46#
/**
* 2013-5-10 由 霸王硬上弓 编写
* cg++ id :脚本天下
* 转载请注明出处,Element3ds万岁
*/

global dlgIns = rolloutCreator "defaultRol" rolloutName  --控件的父窗口
global currBtnList = undefined

fn findLastString str substr =(  --可以使用findLastString "12xx3xxxx4xxx567x8" "xx"测试;找到最后一个字符串的索引
        lastInd = ind = 0
        while ((ind = findstring str substr) !=undefined) do(
                str = substring str (ind+1) -1
                lastInd+=ind
        )
        lastInd
)

fn filterstr str findstr &strs= (
        ind = findstring str findstr
        if ind !=undefined then (
                if ind > 1 do (
                        cutstr = substring str 1 (ind-1)
                        append strs cutstr
                )
                levstr = substring str (ind + findstr.count) -1
                filterstr levstr findstr &strs
        )
        else if str!="" then append strs str
)
firstInd
fn replaceString str findStr replaceStr filterStand:on =( --默认开启标准filter,需要使用逐字符过滤就关闭
        strArr = #()
        if filterStand then (
                strArr = filterstring str findstr
        ) --filterstring "xxx-xxx-xxx" "x-x"结果为#()空,不是#("xx","x","xx")
        else(
                filterstr str findstr &strArr
        )
        firstInd = findstring str findstr
        lastkey  = findLaststring str findstr
        result = ""
        for i=1 to strArr.count do append result (strArr+replaceStr)
        if lastkey+findstr.count != str.count+1 do result = substring result 1 (result.count-replaceStr.count) --替换字符串不为尾项就掐掉
        if firstInd == 1 do result = replaceStr + result  --替换字符串为首项就添加替换字符到最前
        result
)

fn getMxs_ directory &pathArr=(
        if directory != undefined and doesFileExist directory then (
                mxsArr = getFiles (directory+"*.ms*")
                mxsArr = for mxs in mxsArr where not (getFileAttribute mxs #hidden) collect mxs
                join pathArr mxsArr
                dirArr = getDirectories (directory+"*")
                dirArr = for d in dirArr where not  (getFileAttribute d #hidden) collect d
                for d in dirArr do getMxs_ d pathArr
                pathArr
        )
        else #()
)

fn gencurrBtnList files rolloutName = ( --用于脚本管理器中 生成动态对话框
        dlgIns = rolloutCreator "defaultRol" rolloutName
        dlgIns.begin()
        for i=1 to files.count do(
                fname = getFilenameFile files
                theCtrl = "dlgIns.addControl #Button #Button"+(i as string)+" \"" + fname + "\" " + "paramStr: \" width:150 height:25 \""
                execute theCtrl
                event = "dlgIns.addHandler #Button"+(i as string)+" #pressed filter:on codeStr:\"fileIn @"+files+"@\" "
                execute event
                event2 = "dlgIns.addHandler #Button"+(i as string)+" #rightclick filter:on codeStr:\"shellLaunch @"+files+"@ @ @ \" " --两个@ @不能靠紧
                execute event2
        )
        rol = dlgIns.end()
        rol
)

fn defaultPath srcPath tagPath = (
        if not doesFileExist srcPath then tagPath
        else srcPath
)

rollout rt_mxsManager  "MaxScript Manager" width:200 height:400(
        edittext edt_msPath "Path:" text:"" width:150 height:20 across:2
        button btn_msPath "+" width:20 offset:[35,0]
        subrollout workZone "subRol" height:(rt_mxsManager.height - 40 )

                local selfScriptDir = getFileNamePath (getsourceFileName()) --缺省脚本目录
        local msPathIni = selfScriptDir + "msPath.ini"


        on rt_mxsManager  open do (
                pathFromIni = getIniSetting msPathIni "Directories" "MS"
                msPath = defaultPath pathFromIni selfScriptDir
                edt_msPath.text = replaceString msPath "/" "\\"
                dfiles = getMxs_ msPath #()
                files = for file in dfiles collect (replaceString file "\\" "/")
                currBtnList = gencurrBtnList files "Third Plugin"
                AddSubRollout rt_mxsManager.workZone currBtnList

                height = (getIniSetting msPathIni "UI" "height") as number
                if height == 0 do height = 400
                rt_mxsManager.height = height
                rt_mxsManager.workZone.height = (amax height 41) - 40
        )

        on btn_msPath pressed do(
                scriptDir = getSavePath caption:"Get Directories" initialDir:(defaultPath (edt_msPath.text) selfScriptDir)
                edt_msPath.text = scriptDir
                dfiles = getMxs_ scriptDir #()
                files = for file in dfiles collect (replaceString file "\\" "/")
                if files.count>0 do (
                        newBtnList = gencurrBtnList files "Third Plugin"
                        removeSubRollout rt_mxsManager.workZone currBtnList
                        AddSubRollout rt_mxsManager.workZone newBtnList
                        currBtnList = newBtnList
                )
        )

        on rt_mxsManager close do (
                setINISetting msPathIni "Directories" "MS" ( replaceString (edt_msPath.text) "\\" "/" )
                setINISetting msPathIni "UI" "height" (rt_mxsManager.height as string)
        )

        on rt_mxsManager resized size do (
               rt_mxsManager.workZone.height = size.y - 40
        )
)
createDialog rt_mxsManager lockWidth:on lockHeight:off style:#(#style_resizing,#style_toolwindow,#style_sysmenu)
回复 收起回复
使用道具
zhoulijing  发表于 2017-1-12 17:57:43  
47#
看看
回复 收起回复
使用道具
zhoulijing  发表于 2017-1-16 20:23:23  
48#
看看
回复 收起回复
使用道具
zhoulijing  发表于 2017-1-20 14:59:03  
49#
yuansubei
回复 收起回复
使用道具
saberss  发表于 2017-4-17 08:38:41  
50#
回复 收起回复
使用道具
clown2015  发表于 2018-11-11 09:59:56  
51#
元素帖子强,满满正能量!
回复 收起回复
使用道具
小凡凡  发表于 2018-11-12 09:19:13  
52#
资源发布哪家强?元素首发称大王!
回复 收起回复
使用道具
ゞ最初的奔跑ゞ  发表于 2018-11-12 09:30:57  
53#
多谢楼主分享
回复 收起回复
使用道具
不能好好起名  发表于 2018-11-13 13:16:11  
54#
很好的帖子
回复 收起回复
使用道具
神佛之上  发表于 2022-11-22 22:08:22  
55#
给力!元素有你更精彩
回复 收起回复
使用道具
123

快来发表你宝贵的意见吧!

快速回复 返回顶部 返回列表