• 重要的视图类型解释。


    ---下面是一种视图抓取功能。 在下面还有别的。

    grab_bmp = gw.getViewportDib()
    BitMap:
    grab_bmp.filename  ="E:\shiyan_Experimental\012.bmp"
    "E:\shiyan_Experimental\012.bmp"
    save grab_bmp
    ---- 能作为一个保存。

    bmp_name = getSaveFileName caption:"Save Viewport to:" filename:bmp_name \

    types:"BMP(*.bmp)|*.bmp|TIFF(*.tif)|*.tif|JPG(*.jpg)|*.jpg|TGA(*.tga)|*.tga|"

    --上面是保存类型的函数。 getSaveFileName 就是保存对话框。这样的保险是显示保存。 我上面的是,隐士保存。其实 是各有需要。

    --caption:"Save Viewport to:" 保存的标题。  filename:bmp_name 在下面的名称处理。

    types:"BMP(*.bmp)|*.bmp|TIFF(*.tif)|*.tif|JPG(*.jpg)|*.jpg|TGA(*.tga)|*.tga|" ---保存类型的写法,这个很有用。

    if bmp_name != undefined then --if user has confirmed / entered a valid name

    (

    grab_bmp.filename = bmp_name --set output name to the one entered in the save file dialog

    save grab_bmp --save the bitmap

    display grab_bmp --display the bitmap in a VFB

    )

    View Code
    (

    ---------------------------------------------------------------------

    --GRABVIEWPORT MACROSCRIPT

    --Created:3/23/99

    --Edited:4/28/99

    --by Borislav Petrov

    --bobo@email.archlab.tuwien.ac.at

    ---------------------------------------------------------------------

    --Snapshot Active Viewport to Bitmap

    --Filename in format:

    --VPGRAB_MaxFileName_ViewportName_CurentFrame.ImageFormatExtension

    ---------------------------------------------------------------------

    --

    --Init Variables

    local grab_bmp
    --bitmap to put the snapshot into

    local bmp_name
    --name of the bitmap to save

    local get_viewport_name
    --viewport name

    local gac,gct,mfn
    --variables to hold ActiveCamera, CurrentTime, MaxFileName

    --

    --Start Macro

    grab_bmp
    = gw.getViewportDib() --get the viewport bitmap into variable --创建一张视图位图

    get_viewport_name
    = viewport.GetType() --get viewport name -- 返回视图的名字。

    gvn
    = get_viewport_name as string --convert viewport name to string ---转成string 后就会去掉相应的 #

    gvn
    = substring gvn 6 (gvn.count-5) --cut the string ---截取功能

    if gvn == "camera" then --if the remaining string is "camera"

    (

    gac
    = getActiveCamera() --get the camera

    gvn
    = gac.name --get the name of the camera

    )

    mfn
    = MaxFileName --get max file name ---max 文件名字,这里面做了一个得保存。

    if mfn == "" then --if there is no name

    mfn
    = "Untitled" --use "Untitled"

    else

    mfn
    = getFileNameFile mfn --use the file name without .MAX extension ---get 文件名字。

    gct
    = SliderTime as string --get current frame time --把当前的时间转换。

    --

    bmp_name
    = "VPGRAB_"+ mfn +"_" +gvn + "_" + gct --build the output file name ---上面的就是为了这里做铺垫。为了处理好名字的可变性。

    --

    --Display file save dialog

    bmp_name
    = getSaveFileName caption:"Save Viewport to:" filename:bmp_name \

    types:
    "BMP(*.bmp)|*.bmp|TIFF(*.tif)|*.tif|JPG(*.jpg)|*.jpg|TGA(*.tga)|*.tga|"

    --

    if bmp_name != undefined then --if user has confirmed / entered a valid name

    (

    grab_bmp.filename
    = bmp_name --set output name to the one entered in the save file dialog

    save grab_bmp
    --save the bitmap

    display grab_bmp
    --display the bitmap in a VFB

    )

    --

    )
    --end of script
  • 相关阅读:
    GF4 Beta 冲刺Scrum meeting2
    GF4 Beta 冲刺Scrum meeting1
    GF4 实验九 团队作业6:团队项目编码&ALPHA冲刺
    GF4 实验九 【Alpha】Scrum Meeting 7
    GF4 实验九 【Alpha】Scrum Meeting 6
    GF4 实验九 【Alpha】Scrum Meeting 5
    GF4 实验九 【Alpha】Scrum Meeting 4
    docker安装jenkins
    docker安装svn
    idea添加web项目报404问题
  • 原文地址:https://www.cnblogs.com/gaitian00/p/1976874.html
Copyright © 2020-2023  润新知