/* */ import artofillusion.preferences.PreferencesEditor; import artofillusion.preferences.PreferencesPlugin; import buoy.widget.*; System.out.println("Mechanisto Layout: Generating preferences..."); artofillusion.PluginRegistry.registerPlugin( new PreferencesEditor(){ BCheckBox check1; FormContainer editor; getName(){ return "Mechanisto"; } getPreferencesPanel(){ System.out.println("Mechanisto: Preparing preferences."); if (editor == null) { prefs = PluginRegistry.getPluginObject("artofillusion.preferences.PreferencesPlugin"); bool1 = prefs.getBoolean("Mechanisto-1","OnOff"); check1 = new BCheckBox("Use Mechanisto View Layout", bool1); //saveBox.addEventLink(ValueChangedEvent.class, this, "stateChanged"); LayoutInfo label = new LayoutInfo(LayoutInfo.EAST, LayoutInfo.NONE); LayoutInfo field = new LayoutInfo(LayoutInfo.WEST, LayoutInfo.HORIZONTAL, new Insets(0, 5, 0, 0), null); editor = new FormContainer(2, 1); editor.add(check1, 0, 0, 2, 1); //stateChanged(null); editor.layoutChildren(); } return editor; } /** * save the preferences values from the GUI * * @see artofillusion.preferences.PreferencesEditor#savePreferences() * Where would one find this? Not in the API… */ savePreferences(){ prefs = PluginRegistry.getPluginObject("artofillusion.preferences.PreferencesPlugin"); bool1 = check1.getState(); prefs.putBoolean("Mechanisto-1","OnOff", bool1); } stateChanged(){ } }); System.out.println("Mechanisto Layout: Registering as plugin..."); artofillusion.PluginRegistry.registerPlugin(new Plugin() { processMessage(message, args){ prefs = PluginRegistry.getPluginObject("artofillusion.preferences.PreferencesPlugin"); Boolean Inited = prefs.getBoolean("Mechanisto-1","Inited"); if (Inited == false){ System.out.println("Mechanisto inited? " + Inited); Inited = true; prefs.putBoolean("Mechanisto-1","Inited", Inited); prefs.putBoolean("Mechanisto-1","OnOff", false); prefs.commit(); } System.out.println("Mechanisto inited? " + Inited); Boolean OnOff = prefs.getBoolean("Mechanisto-1","OnOff"); System.out.println("Mechanisto on? " + OnOff); if (OnOff){ if (message == Plugin.SCENE_WINDOW_CREATED){ artofillusion.LayoutWindow theWindow = args[0]; alertView = theWindow.getAllViews(); //View 1: Top alertView[0].setOrientation(ViewerCanvas.VIEW_TOP); alertView[0].setPerspective(false); alertView[0].setRenderMode(ViewerCanvas.RENDER_WIREFRAME); //View 2: Camera alertView[1].setOrientation(6); //6 is the index of the default camera. alertView[1].setPerspective(true); alertView[1].setRenderMode(ViewerCanvas.RENDER_TEXTURED); //View 3: Front alertView[2].setOrientation(ViewerCanvas.VIEW_FRONT); alertView[2].setPerspective(false); alertView[2].setRenderMode(ViewerCanvas.RENDER_WIREFRAME); //View 4: Left alertView[3].setOrientation(ViewerCanvas.VIEW_LEFT); alertView[3].setPerspective(false); alertView[3].setRenderMode(ViewerCanvas.RENDER_WIREFRAME); //Show the Axes on views 1,3 & 4 alertView[0].setShowAxes(true); alertView[2].setShowAxes(true); alertView[3].setShowAxes(true); } } } });