PDA

View Full Version : a little script need help


KingMax02
04-22-2012, 07:54 AM
I have some code but I actually don't know how to fully implement it:

/*
1.set background color
2.set viewport
3.set Textured Decal
4.show stats(selection info/scene Info)
*/
// Change the active layout
var desktop = Application.Desktop;
var layout = desktop.Layouts("Default");
desktop.ActiveLayout = layout;
//set background color:
Preferences.Categories("Scene Colors").BackgroundCol = green; //What's the color type? color value?
//set viewport
SetViewCamera("Explorer", 0);
SetViewCamera("Schematic", 2);
SetViewCamera("ObjectView", 3); //Why cannot change by this way? Explorer,schematic and objectView isnot a view?
//set TextureDecal:
SetDisplayMode("Camera", "texturedecal");
SetDisplayMode("Views.View1.UserCamera", "texturedecal");
//show states:
SetValue("Camera.camvis.selectioninfo,Views.ViewA.UserCamera.camvis.selectioninfo,Views.ViewA.TopCamera.camvis.selectioninfo,Views.ViewA.FrontCamera.camvis.selectioninfo,Views.ViewA.RightCamera.camvis.selectioninfo,Views.ViewA.SpotCamera.camvis.selectioninfo,Views.ViewB.UserCamera.camvis.selectioninfo,Views.ViewB.TopCamera.camvis.selectioninfo,Views.ViewB.FrontCamera.camvis.selectioninfo,Views.ViewB.RightCamera.camvis.selectioninfo,Views.ViewB.SpotCamera.camvis.selectioninfo,Views.ViewC.UserCamera.camvis.selectioninfo,Views.ViewC.TopCamera.camvis.selectioninfo,Views.ViewC.FrontCamera.camvis.selectioninfo,Views.ViewC.RightCamera.camvis.selectioninfo,Views.ViewC.SpotCamera.camvis.selectioninfo,Views.ViewD.UserCamera.camvis.selectioninfo,Views.ViewD.TopCamera.camvis.selectioninfo,Views.ViewD.FrontCamera.camvis.selectioninfo,Views.ViewD.RightCamera.camvis.selectioninfo,Views.ViewD.SpotCamera.camvis.selectioninfo,Views.View1.UserCamera.camvis.selectioninfo,Views.View1.TopCamera.camvis.selectioninfo,Views.View1.FrontCamera.camvis.selectioninfo,Views.View1.RightCamera.camvis.selectioninfo,Views.View1.SpotCamera.camvis.selectioninfo", [true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true], null);
SetValue("Camera.camvis.sceneinfo,Views.ViewA.UserCamera.camvis.sceneinfo,Views.ViewA.TopCamera.camvis.sceneinfo,Views.ViewA.FrontCamera.camvis.sceneinfo,Views.ViewA.RightCamera.camvis.sceneinfo,Views.ViewA.SpotCamera.camvis.sceneinfo,Views.ViewB.UserCamera.camvis.sceneinfo,Views.ViewB.TopCamera.camvis.sceneinfo,Views.ViewB.FrontCamera.camvis.sceneinfo,Views.ViewB.RightCamera.camvis.sceneinfo,Views.ViewB.SpotCamera.camvis.sceneinfo,Views.ViewC.UserCamera.camvis.sceneinfo,Views.ViewC.TopCamera.camvis.sceneinfo,Views.ViewC.FrontCamera.camvis.sceneinfo,Views.ViewC.RightCamera.camvis.sceneinfo,Views.ViewC.SpotCamera.camvis.sceneinfo,Views.ViewD.UserCamera.camvis.sceneinfo,Views.ViewD.TopCamera.camvis.sceneinfo,Views.ViewD.FrontCamera.camvis.sceneinfo,Views.ViewD.RightCamera.camvis.sceneinfo,Views.ViewD.SpotCamera.camvis.sceneinfo,Views.View1.UserCamera.camvis.sceneinfo,Views.View1.TopCamera.camvis.sceneinfo,Views.View1.FrontCamera.camvis.sceneinfo,Views.View1.RightCamera.camvis.sceneinfo,Views.View1.SpotCamera.camvis.sceneinfo", [true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true], null);



My two main question is:
A: How to say the color? Is there a color data type? similar to "red","green","blue"...
B: How to create some views inside the current layout? example "Explorer","Schematic"...
I found Layout.CreateView but "The new view is a temporary view and not attached to this layout"

ThE_JacO
04-22-2012, 11:33 PM
A) Color swatches are just UI aggregations of 3 or 4 parameters.
Expand things in the explorer and you will see that color widgets are made of 3 or 4 parameters, usually following the naming convention of parnamer, parnameg, parnameb and so on.

B) Layouts are static, you can't dynamically populate them.
For dynamicism in views you want relational views, which can be controlled better and the interaction between their internals can be scripted, and then embed those into a layout.

Also moving this to the scripting subforum.

CGTalk Moderation
04-22-2012, 11:33 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.