public void cleanup() { GuiStackControl classList = findObjectByInternalName("classList", true); if (classList.isObject()) { classList.clear(); } // Initialize the filter list. GuiStackControl filterList = findObjectByInternalName("filterList", true); if (filterList.isObject()) { filterList.clear(); } GuiPopUpMenuCtrl groupList = findObjectByInternalName("groupList", true); if (groupList.isObject()) { groupList.clear(); } if (this["classArray"].isObject()) { this["classArray"].delete(); } }
public void initFilterList(string selectFilter) { GuiPopUpMenuCtrl SFXParameterFilter = this.FOT("SFXParameterFilter"); SimSet SFXParameterGroup = "SFXParameterGroup"; GuiPopUpMenuCtrl filterList = SFXParameterFilter; filterList.clear(); filterList.add("", 0); for (uint i = 0; i < SFXParameterGroup.getCount(); i++) { SimObject obj = SFXParameterGroup.getObject(i); if (!Util.isMemberOfClass(obj.getClassName(), "SFXParameter")) { continue; } for (int idx = 0; obj["categories[" + idx + "]"] != ""; idx++) { string category = obj["categories[" + idx + "]"]; if (filterList.findText(category) == -1) { filterList.add(category, filterList.size()); } } } // Sort the filters. filterList.sort(); filterList.setSelected(filterList.findText(selectFilter), false); }
public virtual void initGroupList() { GuiPopUpMenuCtrl groupList = findObjectByInternalName("groupList", true); int selected = 0; if (groupList.size() > 0) { selected = groupList.getSelected(); } groupList.clear(); SimGroup root = getRootGroup(); if (!root.isObject()) { return; } // Add all non-empty groups. scanGroup(root, groupList, 0); // Select initial group. if (selected != 0 && selected.AsString().isObject()) { groupList.setSelected(selected); } else { groupList.setSelected(root.getId()); } }
public void createPromptNameCheck() { GuiControl DatablockEditorCreatePrompt = "DatablockEditorCreatePrompt"; editor Editor = "Editor"; GuiPopUpMenuCtrl copySourceDropdown = DatablockEditorCreatePrompt.findObjectByInternalName("copySourceDropdown", true); string name = ((GuiTextEditCtrl)DatablockEditorCreatePrompt.findObjectByInternalName("CreateDatablockName", true)) .getText(); if (!Editor.validateObjectName(name, true)) { return; } // Fetch the copy source and clear the list. string copySource = copySourceDropdown.getText(); copySourceDropdown.clear(); // Remove the dialog and create the datablock. ((GuiCanvas)"canvas").popDialog(DatablockEditorCreatePrompt); this.createDatablockFinish(name, copySource); }
public void createDatablock() { GuiTreeViewCtrl DatablockEditorTypeTree = "DatablockEditorTypeTree"; GuiControl DatablockEditorCreatePrompt = "DatablockEditorCreatePrompt"; string className = DatablockEditorTypeTree.getItemText(DatablockEditorTypeTree.getSelectedItem()); if (className != "") { // Need to prompt for a name. ((GuiTextEditCtrl)DatablockEditorCreatePrompt.findObjectByInternalName("CreateDatablockName", true)) .setText("Name"); ((GuiTextEditCtrl)DatablockEditorCreatePrompt.findObjectByInternalName("CreateDatablockName", true)) .selectAllText(); // Populate the copy source dropdown. GuiPopUpMenuCtrl list = DatablockEditorCreatePrompt.findObjectByInternalName("CopySourceDropdown", true); list.clear(); list.add("", 0); SimSet set = "DataBlockSet"; int count = set.getCount(); for (uint i = 0; i < count; i++) { SimObject datablock = set.getObject(i); string datablockClass = datablock.getClassName(); if (!Util.isMemberOfClass(datablockClass, className)) { continue; } list.add(datablock.getName(), ((int)i + 1)); } // Set up state of client-side checkbox. GuiCheckBoxCtrl clientSideCheckBox = DatablockEditorCreatePrompt.findObjectByInternalName("ClientSideCheckBox", true); bool canBeClientSide = this.canBeClientSideDatablock(className); clientSideCheckBox.setStateOn(canBeClientSide); clientSideCheckBox.setActive(canBeClientSide); // Show the dialog. ((GuiCanvas)"canvas").pushDialog(DatablockEditorCreatePrompt, 0, true); } }
public override void onWake() { /* * %this-->theName.setText( "" ); * * %matList = %this-->theMaterialList; * %matList.clear(); * %count = TerrainMaterialSet.getCount(); * for ( %i=0; %i < %count; %i++ ) * %matList.add( TerrainMaterialSet.getObject( %i ).internalName, %i ); * %matList.setSelected( 0 ); * * %rezList = %this-->theRezList; * %rezList.clear(); * %rezList.add( "256", 256 ); * %rezList.add( "512", 512 ); * %rezList.add( "1024", 1024 ); * %rezList.add( "2048", 2048 ); * //%rezList.add( "4096", 4096 ); * %rezList.setSelected( 256 ); * * %this-->flatRadio.setStateOn( true ); */ ((GuiTextEditCtrl)this.findObjectByInternalName("theName", true)).setText(""); GuiPopUpMenuCtrl matList = this.findObjectByInternalName("theMaterialList", true); matList.clear(); SimSet TerrainMaterialSet = "TerrainMaterialSet"; int count = TerrainMaterialSet.getCount(); for (uint i = 0; i < count; i++) { matList.add( ((SimObject)TerrainMaterialSet.getObject(i)).internalName, (int)i); } matList.setSelected(0); GuiPopUpMenuCtrl rezList = this.findObjectByInternalName("theRezList", true); rezList.clear(); rezList.add("256", 256); rezList.add("512", 512); rezList.add("1024", 1024); rezList.add("2048", 2048); rezList.setSelected(256); ((GuiRadioCtrl)this.findObjectByInternalName("flatRadio", true)).setStateOn(true); }
public override void onSelect(string id, string text) { // Skip empty provider selections. if (text == "") { return; } sGlobal["$pref::SFX::provider"] = text; GuiPopUpMenuCtrl OptAudioDeviceList = "OptAudioDeviceList"; OptAudioDeviceList.clear(); string buffer = Util.sfxGetAvailableDevices(); int count = Util.getRecordCount(buffer); for (int i = 0; i < count; i++) { string record = Util.getRecord(buffer, i); string provider = Util.getField(record, 0); string device = Util.getField(record, 1); if (provider != text) { continue; } if (OptAudioDeviceList.findText(device) == -1) { OptAudioDeviceList.add(device, i); } } // Find the previous selected device. int selId = OptAudioDeviceList.findText(sGlobal["$pref::SFX::device"]); if (selId == -1) { OptAudioDeviceList.setFirstSelected(); } else { OptAudioDeviceList.setSelected(selId); } }
public void guiSync() { GuiPopUpMenuCtrl PEP_ParticleSelector = "PEP_ParticleSelector"; ParticleEmitterEditor.PE_EmitterEditor PE_EmitterEditor = "PE_EmitterEditor"; MaterialEditor.gui.CodeBehind.MaterialEditor.MaterialEditorGui MaterialEditorGui = "MaterialEditorGui"; GuiSwatchButtonCtrl PE_ColorTintSwatch0 = "PE_ColorTintSwatch0"; GuiSwatchButtonCtrl PE_ColorTintSwatch1 = "PE_ColorTintSwatch1"; GuiSwatchButtonCtrl PE_ColorTintSwatch2 = "PE_ColorTintSwatch2"; GuiSwatchButtonCtrl PE_ColorTintSwatch3 = "PE_ColorTintSwatch3"; GuiBitmapButtonCtrl PEP_previewImage = this.FOT("PEP_previewImage"); GuiTextEditCtrl PEP_previewImageName = this.FOT("PEP_previewImageName"); GuiTextEditCtrl PEP_lifetimeMS_textEdit = this.FOT("PEP_lifetimeMS_textEdit"); GuiTextEditCtrl PEP_lifetimeVarianceMS_textEdit = this.FOT("PEP_lifetimeVarianceMS_textEdit"); GuiTextEditCtrl PEP_inheritedVelFactor_textEdit = this.FOT("PEP_inheritedVelFactor_textEdit"); GuiTextEditCtrl PEP_constantAcceleration_textEdit = this.FOT("PEP_constantAcceleration_textEdit"); GuiTextEditCtrl PEP_gravityCoefficient_textEdit = this.FOT("PEP_gravityCoefficient_textEdit"); GuiTextEditCtrl PEP_dragCoefficient_textEdit = this.FOT("PEP_dragCoefficient_textEdit"); GuiTextEditCtrl PEP_spinRandomMin_textEdit = this.FOT("PEP_spinRandomMin_textEdit"); GuiTextEditCtrl PEP_spinRandomMax_textEdit = this.FOT("PEP_spinRandomMax_textEdit"); GuiTextEditCtrl PEP_spinSpeed_textEdit = this.FOT("PEP_spinSpeed_textEdit"); GuiTextEditCtrl PEP_pointSize_textEdit0 = this.FOT("PEP_pointSize_textEdit0"); GuiTextEditCtrl PEP_pointSize_textEdit1 = this.FOT("PEP_pointSize_textEdit1"); GuiTextEditCtrl PEP_pointSize_textEdit2 = this.FOT("PEP_pointSize_textEdit2"); GuiTextEditCtrl PEP_pointSize_textEdit3 = this.FOT("PEP_pointSize_textEdit3"); GuiTextEditCtrl PEP_pointTime_textEdit0 = this.FOT("PEP_pointTime_textEdit0"); GuiTextEditCtrl PEP_pointTime_textEdit1 = this.FOT("PEP_pointTime_textEdit1"); GuiTextEditCtrl PEP_pointTime_textEdit2 = this.FOT("PEP_pointTime_textEdit2"); GuiTextEditCtrl PEP_pointTime_textEdit3 = this.FOT("PEP_pointTime_textEdit3"); GuiCheckBoxCtrl PEP_inverseAlpha = this.FOT("PEP_inverseAlpha"); GuiSliderCtrl PEP_lifetimeMS_slider = this.FOT("PEP_lifetimeMS_slider"); GuiSliderCtrl PEP_lifetimeVarianceMS_slider = this.FOT("PEP_lifetimeVarianceMS_slider"); GuiSliderCtrl PEP_inheritedVelFactor_slider = this.FOT("PEP_inheritedVelFactor_slider"); GuiSliderCtrl PEP_constantAcceleration_slider = this.FOT("PEP_constantAcceleration_slider"); GuiSliderCtrl PEP_gravityCoefficient_slider = this.FOT("PEP_gravityCoefficient_slider"); GuiSliderCtrl PEP_dragCoefficient_slider = this.FOT("PEP_dragCoefficient_slider"); GuiSliderCtrl PEP_spinRandomMin_slider = this.FOT("PEP_spinRandomMin_slider"); GuiSliderCtrl PEP_spinRandomMax_slider = this.FOT("PEP_spinRandomMax_slider"); GuiSliderCtrl PEP_spinSpeed_slider = this.FOT("PEP_spinSpeed_slider"); GuiSliderCtrl PEP_pointSize_slider0 = this.FOT("PEP_pointSize_slider0"); GuiSliderCtrl PEP_pointSize_slider1 = this.FOT("PEP_pointSize_slider1"); GuiSliderCtrl PEP_pointSize_slider2 = this.FOT("PEP_pointSize_slider2"); GuiSliderCtrl PEP_pointSize_slider3 = this.FOT("PEP_pointSize_slider3"); GuiSliderCtrl PEP_pointTime_slider0 = this.FOT("PEP_pointTime_slider0"); GuiSliderCtrl PEP_pointTime_slider1 = this.FOT("PEP_pointTime_slider1"); GuiSliderCtrl PEP_pointTime_slider2 = this.FOT("PEP_pointTime_slider2"); GuiSliderCtrl PEP_pointTime_slider3 = this.FOT("PEP_pointTime_slider3"); // Populate the selector with the particles assigned // to the current emitter. bool containsCurrParticle = false; GuiPopUpMenuCtrl popup = PEP_ParticleSelector; popup.clear(); foreach (SimObject particle in PE_EmitterEditor.currEmitter["particles"].Split(' ')) { if (particle.getId() == this.currParticle) { containsCurrParticle = true; } popup.add(particle.getName(), particle.getId()); } // Just in case the particle doesn't exist, fallback gracefully if (!containsCurrParticle) { this.currParticle = Util.getWord(PE_EmitterEditor.currEmitter["particles"], 0).getID(); } SimObject data = this.currParticle; popup.sort(); popup.setSelected(data); string bitmap = MaterialEditorGui.searchForTexture(data.getName(), data["textureName"]); if (bitmap != "") { PEP_previewImage.setBitmap(bitmap); PEP_previewImageName.setText(bitmap); PEP_previewImageName.tooltip = bitmap; } else { PEP_previewImage.setBitmap(""); PEP_previewImageName.setText("None"); PEP_previewImageName.tooltip = "None"; } PEP_inverseAlpha.setValue(data["useInvAlpha"]); PEP_lifetimeMS_slider.setValue(data["lifetimeMS"]); PEP_lifetimeMS_textEdit.setText(data["lifetimeMS"]); PEP_lifetimeVarianceMS_slider.setValue(data["lifetimeVarianceMS"]); PEP_lifetimeVarianceMS_textEdit.setText(data["lifetimeVarianceMS"]); PEP_inheritedVelFactor_slider.setValue(data["inheritedVelFactor"]); PEP_inheritedVelFactor_textEdit.setText(data["inheritedVelFactor"]); PEP_constantAcceleration_slider.setValue(data["constantAcceleration"]); PEP_constantAcceleration_textEdit.setText(data["constantAcceleration"]); PEP_gravityCoefficient_slider.setValue(data["gravityCoefficient"]); PEP_gravityCoefficient_textEdit.setText(data["gravityCoefficient"]); PEP_dragCoefficient_slider.setValue(data["dragCoefficient"]); PEP_dragCoefficient_textEdit.setText(data["dragCoefficient"]); PEP_spinRandomMin_slider.setValue(data["spinRandomMin"]); PEP_spinRandomMin_textEdit.setText(data["spinRandomMin"]); PEP_spinRandomMax_slider.setValue(data["spinRandomMax"]); PEP_spinRandomMax_textEdit.setText(data["spinRandomMax"]); PEP_spinRandomMax_slider.setValue(data["spinRandomMax"]); PEP_spinRandomMax_textEdit.setText(data["spinRandomMax"]); PEP_spinSpeed_slider.setValue(data["spinSpeed"]); PEP_spinSpeed_textEdit.setText(data["spinSpeed"]); PE_ColorTintSwatch0["color"] = data["colors[0]"]; PE_ColorTintSwatch1["color"] = data["colors[1]"]; PE_ColorTintSwatch2["color"] = data["colors[2]"]; PE_ColorTintSwatch3["color"] = data["colors[3]"]; PEP_pointSize_slider0.setValue(data["sizes[0]"]); PEP_pointSize_textEdit0.setText(data["sizes[0]"]); PEP_pointSize_slider1.setValue(data["sizes[1]"]); PEP_pointSize_textEdit1.setText(data["sizes[1]"]); PEP_pointSize_slider2.setValue(data["sizes[2]"]); PEP_pointSize_textEdit2.setText(data["sizes[2]"]); PEP_pointSize_slider3.setValue(data["sizes[3]"]); PEP_pointSize_textEdit3.setText(data["sizes[3]"]); PEP_pointTime_slider0.setValue(data["times[0]"]); PEP_pointTime_textEdit0.setText(data["times[0]"]); PEP_pointTime_slider1.setValue(data["times[1]"]); PEP_pointTime_textEdit1.setText(data["times[1]"]); PEP_pointTime_slider2.setValue(data["times[2]"]); PEP_pointTime_textEdit2.setText(data["times[2]"]); PEP_pointTime_slider3.setValue(data["times[3]"]); PEP_pointTime_textEdit3.setText(data["times[3]"]); }