Softimage PPGテスト

mental rayかhardwareでレンダリングするかどうかのPPGテスツです。
実行結果はこんな感じ。
以下ソースコードをマルっとごりっと貼り付け
var renderArr = new Array(
 "Hardware Renderer", "Hardware Renderer",
 "mental ray",   "mental ray"
);

var typeArr = new Array(
 "Wireframe",   "wireframe",
 "Depth cue",   "depthcue",
 "Hidden-line removal", "hiddenline",
 "Constant",    "constant",
 "Sharded",    "shaded",
 "Texture",    "textured",
 "Textured Decal",  "texturedecal",
 "DirectX9",    "DirectX9",
 "OpenGL",    "OpenGL"
);

Main();

function Main() {
 var prop = XSIFactory.CreateObject("CustomProperty");
 prop.name = "Renderer Setting";
 prop.addParameter3("Scene", siString, renderArr[2]);
 prop.addParameter3("Type", siString, typeArr[16]);
 prop.addParameter3("fR", siFloat, 0, 0, 1, false);
 prop.addParameter3("fG", siFloat, 0, 0, 1, false);
 prop.addParameter3("fB", siFloat, 0, 0, 1, false);
 prop.addParameter3("fA", siFloat, 0, 0, 1, false);
 
 
 var layout = prop.PPGLayout;
 layout.addGroup("Scene Renderer");
 layout.addEnumControl("Scene", renderArr, "Scene Renderer", siControlCombo);
 layout.endGroup();
 layout.addGroup("Hardware Renderer");
 layout.addEnumControl("Type", typeArr, "Renderer Type", siControlCombo);
 layout.addColor("fR", "Baclground Color", false);
 layout.endGroup();
 
 layout.Logic = OnInit.toString()
  + Type_OnChanged.toString()
  + Scene_OnChanged.toString()
  + fR_OnChanged.toString()
  + fG_OnChanged.toString()
  + fB_OnChanged.toString()
 layout.Language = "JScript";
 
 InspectObj(prop, "", "", siLock, false);
}

function OnInit() {
 SetValue("Passes.RenderOptions.Renderer", "mental ray", null);
 SetValue("Passes.HardwareRenderer.RenderType", "OpenGL");
 SetValue("Passes.HardwareRenderer.BackgroundColorRed", 0.0, null);
 SetValue("Passes.HardwareRenderer.BackgroundColorGreen", 0.0, null);
 SetValue("Passes.HardwareRenderer.BackgroundColorRed", 0.0, null);
}

function Scene_OnChanged() {
 var scn_val = PPG.Scene.value;
 SetValue("Passes.RenderOptions.Renderer", scn_val, null);
 LogMessage("Scene Renderer = " + scn_val);
}

function Type_OnChanged() {
 var type_val = PPG.Type.value;
 // Setting Hardware Renderer Type.
 SetValue("Passes.HardwareRenderer.RenderType", type_val);
 LogMessage("Hardware Renderer = " + type_val);
}

function fR_OnChanged() {
 var r = PPG.fR.value;
 SetValue("Passes.HardwareRenderer.BackgroundColorRed", r, null);
}

function fG_OnChanged() {
 var g = PPG.fG.value;
 SetValue("Passes.HardwareRenderer.BackgroundColorGreen", g, null);
}

function fB_OnChanged() {
 var b = PPG.fB.value;
 SetValue("Passes.HardwareRenderer.BackgroundColorBlue", b, null);
}

No comments:

Post a Comment