modtoolで竜の頭16 - 準備2
前回に引き続き準備を進めます。
こちらの準備は人それぞれ、です。
好みの問題なので自分で試してみてください。
XSIにはスタートアップ時にツールの初期設定を設定できます。
何のこっちゃ?といった感じですが、
開くウィンドウ、そのウィンドウの設定等をあらかじめ設定しておくことが可能です。
特にアンビエントカラー等は用途によって全く異なると思います。
プリレンダを最終形体とするのであれば0が好ましいと思いますし、
リアルタイムレンダであればその仕事により異なる、かと思います。
そういった環境を設定するには、
ファイルメニューFile>Plug-in Managerを起動し、
File…>New>Eventを実行します。
図のパネルが表示されるかと思います。
帰る部分は特にありません。Filenameは自分が理解しやすい名前に変えてもいいかもしれません。
CodingLanguageは使用する言語です。得意な言語があればそちらを選択してください。
無ければとりあえずJScriptを選んで置いてください。
タブを切り替えるとさらにややこしいです。
よくよく見てゆくとしたから5番目にsiOnStartupと書かれております。
ここにチェックを入れます。
そうしたら一番下のスイッチ、Generate Codeをクリックしてからのコードが作成されます。
このようなコードが吐き出されたかと思います。
エラーが出ますがよく読んでません。生成されるのでたぶん問題はないかと思います。
このコードの
// TODO: Put your code here.
の部分に追加したい要素を書き加えればカスタマイズが可能になります。
個人的なカスタマイズコードを置いておきます。
function XSILoadPlugin( in_reg ) { in_reg.Author = "ken_a"; in_reg.Name = "NewEvent Plug-in"; in_reg.Email = ""; in_reg.URL = "http://giken.workarea.jp/"; in_reg.Major = 1; in_reg.Minor = 0; in_reg.RegisterEvent("siOnStartupEvent",siOnStartup); //RegistrationInsertionPoint - do not remove this line return true; } function XSIUnloadPlugin( in_reg ) { var strPluginName; strPluginName = in_reg.Name; Application.LogMessage(strPluginName + " has been unloaded.",siVerbose); return true; } // Callback for the siOnStartupEvent event. function siOnStartupEvent_OnEvent( in_ctxt ) { Application.LogMessage("siOnStartupEvent_OnEvent called",siVerbose); SetValue("Scene_Root.AmbientLighting.ambience.green", 1, null); SetValue("Scene_Root.AmbientLighting.ambience.blue", 1, null); SetValue("Scene_Root.AmbientLighting.ambience.red", 1, null); SetValue("light.light.soft_light.intensity", 1, null); SetValue ("light.kine.rotx", -10); SetValue ("light.kine.roty", 15); SetValue ("light.kine.rotz", 0); var vw = Desktop.ActiveLayout.Views.Find( "View Manager" ); vw.setattributevalue ("suspenddrawing","true"); vw.setattributevalue ("activecamera:a","user"); vw.setattributevalue ("activecamera:b","user"); vw.setattributevalue ("layout","vertical:ab"); vw.setattributevalue ("suspenddrawing","false"); SetValue ("Views.ViewA.UserCamera.camvis.selectioninfo", true,null); SetValue ("Views.ViewA.UserCamera.camvis.sceneinfo", true); SetValue ("Views.ViewA.UserCamera.camera.proj", 0, null); SetValue("Views.ViewB.UserCamera.camera.fov", 20, null); SetDisplayMode ("Views.ViewA.UserCamera", "texturedecal"); // Return value is ignored as this event can not be aborted. return true; }
やっていることは、
アンビエントライトのカラーを全部1に、
デフォルトライトの明るさを1に、
デフォルトライトの角度を変更
レイアウトを水平で二分し、両方ともユーザービューに、
片方のビューにシーン情報を表示
そのビューのパースを無くす(オーソグラフィ、Orthographic)
そのビューのシェーディングを(テクスチャデカール、texturedecal)
に変更しました。
そのほか、デュアルモニタを使われている場合は、以下のようなコードが便利かと思います。
二つ目のモニタにエクスプローラ、スケマティック、テクスチャエディタを表示させます。
完全にモデラー仕様です。
XSIはデュアルモニタの設定がデフォルトであり、アプリケーションウィンドウ自体を
デュアルモニタのサイズに引き伸ばすことは可能ですが、個人的な経験ですが
どうも落ちやすくなるように思います。
Mayaと違い気軽に同じウィンドウが出せるのは良い点ですが、メインビューに色々な種類の
ビューを埋め込むととたんに動作が怪しくなる傾向があるように思います。
なのでこういった形で対応してみました。
function XSILoadPlugin( in_reg ) { in_reg.Author = "ken_a"; in_reg.Name = "NewEvent Plug-in"; in_reg.Email = ""; in_reg.URL = "http://giken.workarea.jp/"; in_reg.Major = 1; in_reg.Minor = 0; in_reg.RegisterEvent("siOnStartupEvent",siOnStartup); //RegistrationInsertionPoint - do not remove this line return true; } function XSIUnloadPlugin( in_reg ) { var strPluginName; strPluginName = in_reg.Name; Application.LogMessage(strPluginName + " has been unloaded.",siVerbose); return true; } // Callback for the siOnStartupEvent event. function siOnStartupEvent_OnEvent( in_ctxt ) { Application.LogMessage("siOnStartupEvent_OnEvent called",siVerbose); SetValue("Scene_Root.AmbientLighting.ambience.green", 1, null); SetValue("Scene_Root.AmbientLighting.ambience.blue", 1, null); SetValue("Scene_Root.AmbientLighting.ambience.red", 1, null); SetValue("light.light.soft_light.intensity", 1, null); SetValue ("light.kine.rotx", -10); SetValue ("light.kine.roty", 15); SetValue ("light.kine.rotz", 0); var vw = Desktop.ActiveLayout.Views.Find( "View Manager" ); vw.setattributevalue ("suspenddrawing","true"); vw.setattributevalue ("activecamera:a","user"); vw.setattributevalue ("activecamera:b","user"); vw.setattributevalue ("layout","vertical:ab"); vw.setattributevalue ("suspenddrawing","false"); SetValue ("Views.ViewA.UserCamera.camvis.selectioninfo", true,null); SetValue ("Views.ViewA.UserCamera.camvis.sceneinfo", true); SetValue ("Views.ViewA.UserCamera.camera.proj", 0, null); SetValue("Views.ViewB.UserCamera.camera.fov", 20, null); SetDisplayMode ("Views.ViewA.UserCamera", "texturedecal"); var exp = Application.Desktop.ActiveLayout.CreateView("Explorer", "Explorer"); exp.Resize(800,1000); exp.Move(1680,0); var sche = Application.Desktop.ActiveLayout.CreateView("Schematic", "Schematic"); sche.Resize(1600,1000); sche.Move(1680,750); var uvv = Application.Desktop.ActiveLayout.CreateView("Texture Editor", "Texture Editor"); uvv.Resize(1200,1200); uvv.Move(1680,50); // Return value is ignored as this event can not be aborted. return true; }
ちなみにこれらのコードは最初の起動時しか適用されません。
新たなシーンを作る時にも適用したい場合は、siOnEndNewSceneEventにチェックを入れてコードを作れば大丈夫です。
ちなみにそれもあげておきます。
function XSILoadPlugin( in_reg ) { in_reg.Author = "ken_a"; in_reg.Name = "NewEvent2 Plug-in"; in_reg.Email = ""; in_reg.URL = "http://giken.workarea.jp/"; in_reg.Major = 1; in_reg.Minor = 0; in_reg.RegisterEvent("siOnEndNewSceneEvent",siOnEndNewScene); //RegistrationInsertionPoint - do not remove this line return true; } function XSIUnloadPlugin( in_reg ) { var strPluginName; strPluginName = in_reg.Name; Application.LogMessage(strPluginName + " has been unloaded.",siVerbose); return true; } // Callback for the siOnEndNewSceneEvent event. function siOnEndNewSceneEvent_OnEvent( in_ctxt ) { Application.LogMessage("siOnEndNewSceneEvent_OnEvent called",siVerbose); SetValue("Scene_Root.AmbientLighting.ambience.green", 1, null); SetValue("Scene_Root.AmbientLighting.ambience.blue", 1, null); SetValue("Scene_Root.AmbientLighting.ambience.red", 1, null); SetValue("light.light.soft_light.intensity", 1, null); SetValue ("light.kine.rotx", -10); SetValue ("light.kine.roty", 15); SetValue ("light.kine.rotz", 0); var vw = Desktop.ActiveLayout.Views.Find( "View Manager" ); vw.setattributevalue ("suspenddrawing","true"); vw.setattributevalue ("activecamera:a","user"); vw.setattributevalue ("activecamera:b","user"); vw.setattributevalue ("layout","vertical:ab"); vw.setattributevalue ("suspenddrawing","false"); SetValue ("Views.ViewA.UserCamera.camvis.selectioninfo", true,null); SetValue ("Views.ViewA.UserCamera.camvis.sceneinfo", true); SetValue ("Views.ViewA.UserCamera.camera.proj", 0, null); SetValue("Views.ViewB.UserCamera.camera.fov", 20, null); SetDisplayMode ("Views.ViewA.UserCamera", "texturedecal"); // Return value is ignored as this event can not be aborted. return true; }
こちらはデュアルモニタ用です。
function XSILoadPlugin( in_reg ) { in_reg.Author = "ken_a"; in_reg.Name = "NewEvent2 Plug-in"; in_reg.Email = ""; in_reg.URL = "http://giken.workarea.jp/"; in_reg.Major = 1; in_reg.Minor = 0; in_reg.RegisterEvent("siOnEndNewSceneEvent",siOnEndNewScene); //RegistrationInsertionPoint - do not remove this line return true; } function XSIUnloadPlugin( in_reg ) { var strPluginName; strPluginName = in_reg.Name; Application.LogMessage(strPluginName + " has been unloaded.",siVerbose); return true; } // Callback for the siOnEndNewSceneEvent event. function siOnEndNewSceneEvent_OnEvent( in_ctxt ) { Application.LogMessage("siOnEndNewSceneEvent_OnEvent called",siVerbose); SetValue("Scene_Root.AmbientLighting.ambience.green", 1, null); SetValue("Scene_Root.AmbientLighting.ambience.blue", 1, null); SetValue("Scene_Root.AmbientLighting.ambience.red", 1, null); SetValue("light.light.soft_light.intensity", 1, null); SetValue ("light.kine.rotx", -10); SetValue ("light.kine.roty", 15); SetValue ("light.kine.rotz", 0); var vw = Desktop.ActiveLayout.Views.Find( "View Manager" ); vw.setattributevalue ("suspenddrawing","true"); vw.setattributevalue ("activecamera:a","user"); vw.setattributevalue ("activecamera:b","user"); vw.setattributevalue ("layout","vertical:ab"); vw.setattributevalue ("suspenddrawing","false"); SetValue ("Views.ViewA.UserCamera.camvis.selectioninfo", true,null); SetValue ("Views.ViewA.UserCamera.camvis.sceneinfo", true); SetValue ("Views.ViewA.UserCamera.camera.proj", 0, null); SetValue("Views.ViewB.UserCamera.camera.fov", 20, null); SetDisplayMode ("Views.ViewA.UserCamera", "texturedecal"); OpenView ("Explorer"); OpenView ("Schematic"); OpenView ("Texture Editor"); // Return value is ignored as this event can not be aborted. return true; }
カスタマイズはご自由に行ってください。
では、今回はこの辺で。
コメントする
トラックバックする
トラックバック用URL: