aardio 文档
aardio 范例: 固定画幅对比
import autos.skills.blender;
import JSON;
// 只读示例:先capture建立构图;人工或程序修改模型后,改成compare再运行。
// 不修改模型,不保存.blend,不覆盖已有构图基准。请改成实际会话名和集合名。
var action = _ARGV.action : "capture"; // capture / compare
var session = "autos";
var collectionName = "Chair";
var root = io.appData("aardio/autos/blender/fixed-framing-example");
var framingPath = io.joinpath(root,"framing.json");
var opt = {collection=collectionName;outputDir=io.joinpath(root,"images")};
if(action=="capture"){
if(io.exist(framingPath)) return {error="构图基准已存在;改用compare或另选输出目录,不自动覆盖";path=framingPath};
opt.views=["front","right","iso"];
opt.size=640;
opt.margin=0.2;
}
elseif(action=="compare"){
var framing,err=JSON.load(framingPath);
if(!framing) return {error=err;path=framingPath};
opt.framing=framing; // 不再指定size/views/margin;完整继承基准。
}
else return {error="action必须为capture或compare"};
var b=autos.skills.blender;
var c,err,detail=b.connect(session);
if(!c) return {error=err;detail=detail};
var image,err,detail=b.preview(c,opt);
c.close();
if(!image) return {error=err;detail=detail};
if(action=="capture"){
var ok,err=JSON.save(framingPath,image.framing,true);
if(!ok) return {error=err;preview=image};
}
print("请实际看图:",image.sheet);
print("固定画幅越界:",image.framingCheck.outOfFrame);
return {preview=image;framingPath=framingPath};
Markdown 格式