• 关于Max贴图路径的重新查找指定


    这个范例只是演示基本需要的东西,本身速度并不好并且只是针对单个Max文件操作。有需要的人自己修改。

    此外,用相对路径可以完全避免此类问题,有兴趣的看这里

    http://www.cnblogs.com/sitt/archive/2011/03/31/1989846.html

    View Code
    Fn SetDirectoryAccessControlType inputDirectoryInfo =
    (
    tempUserName
    = (DotNetClass "System.Environment").UserName
    fileSystemRights
    = (DotNetClass "System.Security.AccessControl.FileSystemRights").Modify
    accessControlType
    = (DotNetClass "System.Security.AccessControl.AccessControlType").Allow
    fileSystemAccessRule
    = DotNetObject "System.Security.AccessControl.FileSystemAccessRule" tempUserName fileSystemRights accessControlType
    directorySecurity
    = inputDirectoryInfo .GetAccessControl()
    directorySecurity.AddAccessRule fileSystemAccessRule
    inputDirectoryInfo .SetAccessControl directorySecurity
    )

    Fn GetAllFiles targetPath fileFilter
    =
    (
    local SearchOption,DotNetDirectoryInfo
    SearchOption
    = DotNetClass "System.IO.SearchOption"
    DotNetDirectoryInfo
    = DotNetObject "System.IO.DirectoryInfo" targetPath
    SetDirectoryAccessControlType DotNetDirectoryInfo
    result
    = for tfi in (DotNetDirectoryInfo.GetFiles fileFilter SearchOption.AllDirectories) collect tfi.FullName
    result
    )

    Fn GetStringParseCount inputString1 inputString2
    =
    (
    result
    = 0
    referenceString
    = inputString1
    if inputString1.count > inputString2.count do referenceString = inputString2
    for i = 0 to referenceString.count - 1 do
    (
    if inputString1[inputString1.Count - i] == inputString2[inputString2.Count - i] then
    (
    result
    += 1
    )
    else
    (
    exit
    )
    )
    result
    )

    Fn GetRootTrackNode
    = (refs.Dependents RootNode)[1]

    Fn RecursionProcessFilePath inputTargetNode inputNewPath
    =
    (
    for i = 1 to inputTargetNode.numSubs do
    (
    tempSubAnim
    = getSubAnim inputTargetNode i
    tempNode
    = (getSubAnim inputTargetNode i).object
    if ClassOf tempNode == Bitmaptexture do
    (
    oldFileFullName
    = tempNode.FileName
    if oldFileFullName != "" and not DoesFileExist oldFileFullName do
    (
    oldFileName
    = FilenameFromPath oldFileFullName
    newFilelist
    = GetAllFiles inputNewPath oldFileName
    maxParseFileName
    = ""
    for tempFileName in newFilelist where
    (
    GetStringParseCount tempFileName oldFileName
    > GetStringParseCount tempFileName maxParseFileName
    )
    do
    (
    maxParseFileName
    = tempFileName
    )
    if maxParseFileName != "" do tempNode.FileName = maxParseFileName
    )
    )
    if tempSubAnim.numSubs > 0 do RecursionProcessFilePath tempSubAnim inputNewPath
    )
    )
    newPath
    = GetSavePath()
    if undefined != newpath do RecursionProcessFilePath (GetRootTrackNode()) newPath

  • 相关阅读:
    下载地址jquery upload file demo (C#)
    特征卷积基于3D卷积神经网络的人体行为理解(论文笔记)
    应用目录S5PV210的BL1应用
    手机音效手机测试游戏类
    metadata查询Querying Metadata
    arraynodeSorting
    functionclass[LeetCode]Path Sum II
    functionclass[LeetCode]Permutation Sequence
    exceptionfunction[LeetCode]Permutations
    exceptionfunction[LeetCode]Permutations II
  • 原文地址:https://www.cnblogs.com/sitt/p/2082561.html
Copyright © 2020-2023  润新知