The snapshot script is from the original most recent Windows customUI of Max.
...AppData\Roaming\startup\82 Snapshot.js
- Brian
var title = "Snapshot";
var command = "snapshot(1600,1200, event.button, event.shiftKey, event.ctrlKey)";
var icon = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAAHdbkFIAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAABdxJREFUeNpi/P//PwM+wMRACJBrwn9cCjih9FmirWDB5R5GRkYITcgEgABipDwcsHmNFJBFKKD+MqEJSkNpRoxwAPoGJsiIFA7MBL0JEEAEFRACLMjBjgb+gnwJDUuQgmnkpKc9BMJ3MS4DcoC4FYv4dPR4wOeCdWh8SyyuScWXVgLR+NHI8QcFrOBYAAYiuVERQXE0AgQQxQYwMVAIKDaAEY9cLxDfgabImQTUUpbj/xPQ9ByP/BIWPBoZiXD2ESY8YaNCjCuZcNjODA1AQoH9H5cL/hIZsP+Y8EQturPvYlPLRGQauQjEyljUMLMQWULp4yr6GCmpFsBmDnhuBAggil0w4MXBkHcAA4lR8I/aDRVYPngJxE1AfBBqCRPUIFi58AuIbxIZYrCsoQTEHGhZhQlqPj8QHwPLQUOAFFf/x1HrK5FoThoIM5FoMcyHX6B8WSDmA+Kr0BAipWAAhzBywwBf4X8XqSzDp9YCiE8QoQ4WAkTnAiUoLUDAUJDlr6Hsz0SkP2YWIh0gDaU/EPAZshwnMQmW2BB4BqXfIFnADsSvgPgrEPsipQ9QVE0CNfwImAmqNP8QmwbQwV4gdgLid0D8DYhliGgnoYNU5IJoICqE06BcNFoZDbgDAAJoNApGHTDqAHK6jaBsk4nUWvoLNacUiDOAeDeNmoNENTRAIzLutHAAGwn1BcgRRcQ6ALkJpY3UaITRMPlHRDQw0IEOmlmwhi6IvRJUmwId8AYy5kQ6MEVqNYNwA3k9AkigppOgSRNPVIAaLTtJdQALCVmxAJrqkXMOqFX0E8qWIrIxir11SgQ4jJYbuqEO8MQSKs2kREEmidkPVxS8JLF7BnY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4h9UbDq0JQhawnAePj2JNpMLWuGvCc0j5HiMCYs6UsRg+ZMRR6CQYwesQL6MPiQ2OjXGMMLBaACMBsAIBwAv62NJ/N1rTwAAAABJRU5ErkJggg==";
function snapshot(w, h, button, shiftkey, ctrlkey)
{
function ftime()
{
var d = new Date(), a=d.getDate(), o=d.getMonth()+1, y=d.getYear(), h=d.getHours(), m=d.getMinutes(), s=d.getSeconds();
a=(a>9)?a:'0'+a; o=(o>9)?o:'0'+o; y=(y>999)?y:1900+y; h=(h>9)?h:'0'+h; m=(m>9)?m:'0'+m; s=(s>9)?s:'0'+s;
return y+'.'+o+'.'+a+'-'+h+'.'+m+'.'+s;
}
var getDir = moi.filesystem.getAppDataDir;
var st = [], settings = ["view.meshAngle", "view.viewportBackgroundColor", "view.lineWidth", "grid.display", "grid.accentedLineColor", "grid.lineColor", "grid.showXYAxes", "view.showAxisIcon", "view.showViewTitles"];
var time = ftime();
var vp = moi.ui.getLastClickedViewport();
if (!vp) { vp = moi.ui.mainWindow.viewpanel.getViewport('3D'); }
for (var sv in settings) { st.push(moi[settings[sv].split('.')[0]][settings[sv].split('.')[1]] ); }
moi.view.showViewTitles = false;
moi.view.showAxisIcon = false;
moi.grid.showXYAxes = false;
moi.view.viewportBackgroundColor = 0xEEEEEE;
if ( moi.view.meshAngle > 10 ) { moi.view.meshAngle = 10; }
moi.grid.display = (button === 2 )?false:true;
var m = (ctrlkey)?1.5:1;
if ( !shiftkey ) { moi.grid.accentedLineColor = 0xBBBBBB; moi.view.lineWidth = 1; } else { w = w*m*2; h = h*m*2; moi.grid.accentedLineColor = 0x999999; moi.view.lineWidth = 2; }
moi.grid.lineColor = moi.grid.accentedLineColor;
vp.render(w, h).save(getDir()+"snapshots\\"+time+"-["+vp.name+"].png");
for (var sv in settings) { moi[settings[sv].split('.')[0]][settings[sv].split('.')[1]] = st.shift(); }
}
var script, doc = moi.ui.getUIPanel("moi://ui/CommandBar.htm").document;
var head = doc.getElementsByTagName('head')[0];
for (var i in this) if (this.hasOwnProperty(i) && this[i] instanceof Function )
{
script = doc.createElement('script');
script.type = 'text/javascript';
script.innerHTML = this[i].toString();
head.appendChild(script);
}
moi.ui.commandBar.CommandBarCustomUI.insertAdjacentHTML( "beforeEnd", '<moi:Spacer><moi:Spacer><moi:CommandButton icon="'+icon+'" onbuttonclick="'+command+'">'+title+'</moi:CommandButton>');
|