【问题标题】:3DSMAX 2011 Scripting - How to clone and rename bones3DSMAX 2011 脚本 - 如何克隆和重命名骨骼
【发布时间】:2016-09-15 16:24:03
【问题描述】:

我是 3DSMAX 脚本的新手。

我需要按名称克隆骨骼并用特定名称重命名“克隆骨骼”。

例如:

我必须克隆 bip_01_Lhand 并将克隆重命名为 _bone_weapon_attachment 并将克隆的骨骼 10 units of distance 移动到 X axis

对于bip01_head,其克隆必须变为_bone_hat_attachment并在Y axis上移动克隆的骨骼15 units of distance

我该怎么做? (obs:我自己尝试过,但是当我无法正确创建数组时失败了)

【问题讨论】:

  • 如果您在这里没有得到满意的答案,请尝试 gamedev.stackexchange.com ;那里有一些工具程序员。 (我希望我能自己帮助你,但我们是一家玛雅商店。)
  • 会的!谢谢你:)

标签: 3dsmax


【解决方案1】:

你想做的事情的要点在技术艺术/动画中很常见。

如果您需要对每个骨骼应用不同的更改,那么您将别无选择,只能创建某种映射。在 python 中,这可以通过字典轻松完成。如果您使用 maxscript,一个选项是创建一个多维数组,其中每个数组项都是一个以您要查找的项开头的数组,第二项是克隆的名称,第三项是偏移量。

然后简单地遍历装备的每个骨骼,克隆预期的骨骼,并应用您存储在映射中的偏移量。

这是一个例子:

mapping = #(
    #("bip_01_Lhand ", "_bone_weapon_attachment", [10, 0, 0]),
    #("bip01_head", "_bone_hat_attachmentand", [0, 15, 0])
)    

selectedNodes = getCurrentSelection()

for s in selectedNodes do
(
    -- for each item in the selection, go through each mapping and 
    -- see if a match can be found
    for m in mapping do
    (
        -- m is an array, so fetch each item of the array
        name = m[1]
        targetName = m[2]
        offset = m[3]
        -- verify that the names match, otherwise move on to the next
        if s.name == name then
        (
            cloneObj = copy s
            cloneObj.name = targetName
            cloneObj.position += offset
        )
    )

)

【讨论】:

    猜你喜欢
    • 2016-09-12
    • 2018-11-27
    • 2012-06-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-23
    • 2011-04-02
    • 2011-07-11
    相关资源
    最近更新 更多