• 3dsmax script export/import tools


    ----输出模型信息
    mesh01 = snapshotasmesh selection[1]
    out_name = ((getdir #export)+"/ee.txt")
    out_file = createfile out_name


    --点总数输出
    numberverts = mesh01.numverts
    --面总数输出
    numberfaces = mesh01.numfaces

    format "%,%\n" numberverts numberfaces to:out_file


    --点位置集合
    for i = 1 to numberverts do
     (
      v = getvert mesh01 i
      format "%," v to:out_file
     )
     
     format "\n"  to:out_file
     
    --面位置集合
    for t = 1 to numberfaces do
     (
      z = getface mesh01 t
      format "%," z to:out_file
     )
     
     
     close out_file
        edit out_name
    ------读取模型信息
    vert_array = #()
    face_array = #()
    in_file = openfile ((getdir #export)+"/ee.txt")
    if in_file != undefined then
    (
     num_verts = readvalue in_file
     num_faces = readvalue in_file
     vert_array.count = num_verts
     face_array.count = num_faces
     for v = 1 to num_verts do vert_array[v] = (readvalue in_file)
     for f = 1 to num_faces do face_array[f] = (readvalue in_file)
     close in_file
     new_mesh = mesh vertices:vert_array faces:face_array
    )
     

    -----输出UV信息
    UvFaceNumber = meshop.getNumMapfaces $ 1
    UvVertNumber = meshop.getNumMapVerts $ 1

    arrayvet = for i = 1 to UvVertNumber collect meshop.getMapVert $ 1 i
    arrayface = for i = 1 to UvfaceNumber collect meshop.getMapface $ 1 i
     
    -----读取UV信息 
    meshop.setNumTVerts $ UvVertNumber
     
    for i = 1 to UvFaceNumber do
    (
     meshop.setMapface $ 1 i arrayface[i]
    )

    for i = 1 to UvVertNumber do
    (
     meshop.setMapVert $ 1 i arrayvet[i]
    )

  • 相关阅读:
    递增三元子序列
    Linux sed 命令
    linux shell中$0,$?,$!等的特殊用法
    ansible-playbook使用
    Linux下通过crontab命令来实现定时任务
    iperf网络性能测试
    OpenStack接口测试工具rally/tempest环境搭建及使用
    Jenkins配置slaver节点
    微信小程序跳转外部链接(h5页面)以及数据交互
    Echarts 系列之折线图、柱状图相关配置
  • 原文地址:https://www.cnblogs.com/softimagewht/p/1784029.html
Copyright © 2020-2023  润新知