MoI discussion forum
MoI discussion forum

Full Version: 一个独立的视口截图工具取自M3DCH UI(An independent viewport screenshot tool taken from M3DCH UI)

From: 大道刀 (SUIYAN)
27 Jun   [#1]
Hello EveryOne

我昨天在寻找一个能在moi中快捷调用的截图工具,我使用过论坛中的代码(I was looking for a screenshot tool that can be quickly called in Moi yesterday, and I have used the code from the forum before)

script: var prev_background = moi.view.viewportBackgroundColor; moi.view.viewportBackgroundColor = 0xFFFFFF; moi.view.lineWidth = 4; moi.grid.display = false; moi.grid.showXYAxes = false; moi.view.showAxisIcon = false; moi.view.showViewTitles = false; var img = null; try { img = moi.ui.getActiveViewport().render( 4000, 2500 ); } catch(e){} moi.view.lineWidth = 1; moi.grid.display = true; moi.grid.showXYAxes = true; moi.view.showAxisIcon = true; moi.view.showViewTitles = true; moi.view.viewportBackgroundColor = prev_background; var name = img.getSaveFileName(); if ( name != '' ) img.save( name );

但效果并不好,运行它会更改我原本对视口的设置,无法截取同时显示四个视图的快照也会强制更改设置,显示参考网格。我短暂的使用过M3DCH 这套UI,在它的插件中找到了这个插件,这是我的使用效果图:
(But the effect is not good. Running it will change my original settings for the viewport, and I won't be able to take a snapshot that displays all four views at the same time. It will also force me to change the settings and display the reference grid. I have briefly used the M3DCH UI and found this plugin in its plugins. Here is my usage rendering:)







看得出来,无论是在怎样的视口和材质情况下,快照效果都不错。可以设置快捷键A 值=ScreenCapture(或任何你重命名ScreenCapture.js的对应名称 )
(It can be seen that the snapshot effect is good regardless of the viewport and material conditions. You can set the shortcut key A value to ScreenCapture (or any corresponding name for renaming ScreenCapture.js))

希望后续版本默认添加这个脚本(hope that future versions will add this script by default)

Attachments:
ScreenCapture.js

Image Attachments:
1.png  2.png  3.png  4.png  5.png 


From: BurrMan
27 Jun   [#2] In reply to [#1]

This one lets you set resolution to whatever your video card will pump out. I dont remember whether it does all 4 views at once or only active, but it wont change settings

It saves to clipboard so you can paste it where ever to create any image type

http://moi3d.com/forum/lmessages.php?webtag=MOI&msg=1049.5

There is also a “screen grab” type one that will just save a file for you. On petr’s MoI page. I’ll get a link then edit that in here in a second.

Here:
http://kyticka.webzdarma.cz/3d/moi/#CaptureScreenToFile


From: 大道刀 (SUIYAN)
27 Jun   [#3] In reply to [#2]
HI BurrMan
这太棒了,但我认为制作成可调用的js脚本而不是使用代码调用的意义:
(This is great, but I think the significance of making it a callable JavaScript script instead of using code calls is:)


就是人们不再需要记忆、理解长长的代码,而使用自身文字来定义快捷键,我想这对一些人会很重要(It means that people no longer need to remember and understand long codes, but use their own language to define shortcut keys, which I think will be important for some people)

Image Attachments:
1.png 


From: BurrMan
28 Jun   [#4] In reply to [#3]

Hi Suiyan,
So you can do it either way

If you have “inline” code, you can just add it to a text file with a “.js” extension. Then the command is whatever you name it.

So from your screenshot, “alt-s” then for the command put the name of your new js file (that you added to the command or scripts folder in your install directory)


From: 大道刀 (SUIYAN)
28 Jun   [#5] In reply to [#4]
Thanks BurrMan,我才想到这么做(Thanks BurrMan, I just thought of doing this)