public virtual void selectAllInClassList(string state) { GuiStackControl classList = findObjectByInternalName("classList", true); for (uint i = 0; i < classList.getCount(); i++) { SimObject ctrl = classList.getObject(i); if (ctrl.call("getValue") == state) { ctrl.call("performClick"); } } }
public void onFinishCreateObject(SimObject objId) { this.objectGroup.add(objId); if (objId.isMemberOfClass("SceneObject")) { objId["position"] = this.getCreateObjectPosition(); //flush new position objId.call("setTransform", objId.call("getTransform")); } this.onObjectCreated(objId); }
public override void onDeactivated() { ForestEditorGui.ForestEditorPropertiesWindow ForestEditorPropertiesWindow = "ForestEditorPropertiesWindow"; ForestEditorGui.ForestEditorPalleteWindow ForestEditorPalleteWindow = "ForestEditorPalleteWindow"; ForestEditorGui ForestEditorGui = "ForestEditorGui"; PersistenceManager ForestDataManager = "ForestDataManager"; //Copyright Winterleaf Entertainment L.L.C. 2013 if (!this["isActive"].AsBool()) { return; } this["isActive"] = false.AsString(); //Copyright Winterleaf Entertainment L.L.C. 2013 ForestEditorGui.setVisible(false); ForestEditorPalleteWindow.setVisible(false); ForestEditorPropertiesWindow.setVisible(false); SimObject tool = ForestEditorGui.getActiveTool(); if (tool.isObject()) { tool.call("onDeactivated"); } // Also take this opportunity to save. ForestDataManager.saveDirty(); this.map.pop(); base.onDeactivated(); }
public void updateParticle(string propertyField, string value, bool isSlider, bool onMouseUp) { editor Editor = "Editor"; ParticleEditor ParticleEditor = "ParticleEditor"; this.setParticleDirty(); SimObject particle = this.currParticle; SimObject last = Editor.getUndoManager().getUndoAction((Editor.getUndoManager().getUndoCount() - 1)); if ((isSlider) && (last["isSlider"].AsBool()) && (!last["onMouseUp"].AsBool())) { last["field"] = propertyField; last["isSlider"] = isSlider.AsString(); last["onMouseUp"] = onMouseUp.AsString(); last["newValue"] = value; } else { var action = ParticleEditor.createUndo <ParticleEditorUndo.ActionUpdateActiveParticle>("Update Active Particle"); action["particle"] = particle; action["field"] = propertyField; action["isSlider"] = isSlider.AsString(); action["onMouseUp"] = onMouseUp.AsString(); action["newValue"] = value; action["oldValue"] = particle.getFieldValue(propertyField, -1); ParticleEditor.submitUndo(action); } particle.setFieldValue(propertyField, value, -1); particle.call("reload"); }
public void updateEmitter(string propertyField, string value, bool isSlider, bool onMouseUp) { ParticleEditor ParticleEditor = "ParticleEditor"; editor Editor = "Editor"; this.setEmitterDirty(); SimObject emitter = this.currEmitter; SimObject last = Editor.getUndoManager().getUndoAction((Editor.getUndoManager().getUndoCount() - 1)); if ((isSlider) && (last["isSlider"]).AsBool() && (!last["onMouseUp"].AsBool())) { last["field"] = propertyField; last["isSlider"] = isSlider.AsString(); last["onMouseUp"] = onMouseUp.AsString(); last["newValue"] = value; } else { ParticleEditorUndo.ActionUpdateActiveEmitter action = ParticleEditor.createUndo <ParticleEditorUndo.ActionUpdateActiveEmitter>("Update Active Emitter"); action["emitter"] = emitter; action["field"] = propertyField; action["isSlider"] = isSlider.AsString(); action["onMouseUp"] = onMouseUp.AsString(); action["newValue"] = value; action["oldValue"] = emitter.getFieldValue(propertyField, -1); ParticleEditor.submitUndo(action); } emitter.setFieldValue(propertyField, value, -1); emitter.call("reload"); }
public void getAbsRotation() { EWorldEditor EWorldEditor = "EWorldEditor"; GuiCheckBoxCtrl DoRotation = this.FOT("DoRotation"); GuiCheckBoxCtrl RotRelative = this.FOT("RotRelative"); GuiCheckBoxCtrl RotLocal = this.FOT("RotLocal"); GuiTextEditCtrl Bank = this.FOT("Bank"); GuiTextEditCtrl Pitch = this.FOT("Pitch"); GuiTextEditCtrl Heading = this.FOT("Heading"); int count = EWorldEditor.getSelectionSize(); // If we have more than one SceneObject selected, // we must exit. SimObject obj = -1; for (int i = 0; i < count; i++) { SimObject test = EWorldEditor.getSelectedObject(i); if (test.isMemberOfClass("SceneObject")) { if (obj != -1) { return; } obj = test; } } if (obj == -1) { // No SceneObjects selected return; } string rot = obj.call("getEulerRotation"); Pitch.setText(Util.getWord(rot, 0)); Bank.setText(Util.getWord(rot, 1)); Heading.setText(Util.getWord(rot, 2)); // Turn off relative as we're populating absolute values. // Of course this means that we need to set local on. RotRelative.setValue("0"); RotLocal.setValue("1"); // Finally, set the Rotation check box as active. The user // likely wants this if they're getting the position. DoRotation.setValue("1"); }
public string GetTooltipWorldEditorSelection(SimObject obj) { string text = "Objects: " + obj.call("getCount"); if (!obj.getCanSave()) { text = text + '\n' + "Persistent: No"; } else { text = text + '\n' + "Persistent: Yes"; } return(text); }
public virtual void scanGroup(SimGroup group, GuiPopUpMenuCtrl list, int indentLevel) { // Create a display name for the group. string text = group.getName(); if (text == "") { text = group.getClassName(); } string internalName = group.getInternalName(); if (internalName != "") { text = text + "[" + internalName + "]"; } // Indent the name according to the depth in the hierarchy. if (indentLevel > 0) { text = Util.strrepeat(" ", indentLevel, "") + text; } // Add it to the list. list.add(text, group.getId()); // Recurse into SimSets with at least one child. for (uint i = 0; i < group.getCount(); i++) { SimObject obj = group.getObject(i); if (!obj.isMemberOfClass("SimSet") || obj.call("getCount").AsInt() == 0) { continue; } scanGroup(obj.GetID(), list, indentLevel + 1); } }
public void loadNewParticle(SimObject particle) { GuiPopUpMenuCtrl PEP_ParticleSelector = "PEP_ParticleSelector"; ParticleData PE_ParticleEditor_NotDirtyParticle = "PE_ParticleEditor_NotDirtyParticle"; if (particle.isObject()) { particle = particle.getId().AsString(); } else { particle = PEP_ParticleSelector.getSelected().AsString(); } this.currParticle = particle; particle.call("reload"); PE_ParticleEditor_NotDirtyParticle.assignFieldsFrom(particle); PE_ParticleEditor_NotDirtyParticle["originalName"] = particle.getName(); this.guiSync(); this.setParticleNotDirty(); }
public override void onActivated() { EditorGui EditorGui = "EditorGui"; ForestEditorGui ForestEditorGui = "ForestEditorGui"; ForestEditorGui.ForestEditorPropertiesWindow ForestEditorPropertiesWindow = "ForestEditorPropertiesWindow"; ForestEditorGui.ForestEditorPalleteWindow ForestEditorPalleteWindow = "ForestEditorPalleteWindow"; ForestEditorGui.ForestEditMeshTree ForestEditMeshTree = "ForestEditMeshTree"; ForestEditorGui.ForestEditBrushTree ForestEditBrushTree = "ForestEditBrushTree"; ForestEditorGui.ForestEditTabBook ForestEditTabBook = "ForestEditTabBook"; SimGroup ForestBrushGroup = "ForestBrushGroup"; SimSet ForestItemDataSet = "ForestItemDataSet"; SimSet ForestTools = "ForestTools"; GizmoProfile GlobalGizmoProfile = "GlobalGizmoProfile"; GuiBitmapButtonCtrl ForestEditorPaintModeBtn = "ForestEditorPaintModeBtn"; GuiBitmapButtonCtrl ForestEditorSelectModeBtn = "ForestEditorSelectModeBtn"; GuiBitmapButtonCtrl ForestEditorMoveModeBtn = "ForestEditorMoveModeBtn"; GuiBitmapButtonCtrl ForestEditorRotateModeBtn = "ForestEditorRotateModeBtn"; GuiBitmapButtonCtrl ForestEditorScaleModeBtn = "ForestEditorScaleModeBtn"; GuiBitmapButtonCtrl ForestEditorEraseModeBtn = "ForestEditorEraseModeBtn"; GuiBitmapButtonCtrl ForestEditorEraseSelectedModeBtn = "ForestEditorEraseSelectedModeBtn"; GuiBitmapButtonCtrl ForestEditorDropToGroundModeBtn = "ForestEditorDropToGroundModeBtn"; ForestSelectionTool SelectionTool = ForestTools.FOF("SelectionTool"); ForestBrushTool BrushTool = ForestTools.FOF("BrushTool"); string mode; //Copyright Winterleaf Entertainment L.L.C. 2013 this["isActive"] = true.AsString(); //Copyright Winterleaf Entertainment L.L.C. 2013 EditorGui.bringToFront(ForestEditorGui); ForestEditorGui.setVisible(true); ForestEditorPalleteWindow.setVisible(true); ForestEditorPropertiesWindow.setVisible(true); ForestEditorGui.makeFirstResponder(true); //ForestEditToolbar.setVisible( true ); this.map.push(); base.onActivated(); ForestEditBrushTree.open(ForestBrushGroup); ForestEditMeshTree.open(ForestItemDataSet); // Open the Brush tab. ForestEditTabBook.selectPage(0); // Sync the pallete button state // And toolbar. SimObject tool = ForestEditorGui.getActiveTool(); if (tool.isObject()) { tool.call("onActivated"); } if (!tool.isObject()) { ForestEditorPaintModeBtn.performClick(); if (ForestEditBrushTree.getItemCount() > 0) { ForestEditBrushTree.selectItem(0, true); } } else if (tool == SelectionTool) { mode = GlobalGizmoProfile["mode"]; switch (mode) { case "None": ForestEditorSelectModeBtn.performClick(); break; case "Move": ForestEditorMoveModeBtn.performClick(); break; case "Rotate": ForestEditorRotateModeBtn.performClick(); break; case "Scale": ForestEditorScaleModeBtn.performClick(); break; } } else if (tool == BrushTool) { mode = BrushTool["mode"]; switch (mode) { case "Paint": ForestEditorPaintModeBtn.performClick(); break; case "Erase": ForestEditorEraseModeBtn.performClick(); break; case "EraseSelected": ForestEditorEraseSelectedModeBtn.performClick(); break; case "DropToGround": ForestEditorDropToGroundModeBtn.performClick(); break; } } if (this["showError"].AsBool()) { messageBox.MessageBoxOK("Error", "Your art/forest folder does not contain a valid brushes.cs. Brushes you create will not be saved!"); } }
public void updateSpeedFields(bool isRandom, float value, bool isSlider, bool onMouseUp) { GuiSliderCtrl PEE_ejectionVelocity_slider = this.FOT("PEE_ejectionVelocity_slider"); GuiSliderCtrl PEE_velocityVariance_slider = this.FOT("PEE_velocityVariance_slider"); GuiTextEditCtrl PEE_ejectionVelocity_textEdit = this.FOT("PEE_ejectionVelocity_textEdit"); GuiTextEditCtrl PEE_velocityVariance_textEdit = this.FOT("PEE_velocityVariance_textEdit"); editor Editor = "Editor"; ParticleEditor ParticleEditor = "ParticleEditor"; this.setEmitterDirty(); SimObject emitter = this.currEmitter; // Transfer values over to gui controls. if (isRandom) { if (value > PEE_ejectionVelocity_slider.getValue()) { PEE_ejectionVelocity_textEdit.setText(value.AsString()); PEE_ejectionVelocity_slider.setValue(value.AsString()); } } else { if (value < PEE_velocityVariance_slider.getValue()) { PEE_velocityVariance_textEdit.setText(value.AsString()); PEE_velocityVariance_slider.setValue(value.AsString()); } } // Submit undo. SimObject last = Editor.getUndoManager().getUndoAction((Editor.getUndoManager().getUndoCount() - 1)); if ((isSlider) && (last["isSlider"].AsBool()) && (!last["onMouseUp"].AsBool())) { last["isSlider"] = isSlider.AsString(); last["onMouseUp"] = onMouseUp.AsString(); last["newValueEjectionVelocity"] = PEE_ejectionVelocity_textEdit.getText(); last["newValueVelocityVariance"] = PEE_velocityVariance_textEdit.getText(); } else { ParticleEditorUndo.ActionUpdateActiveEmitterSpeedFields action = ParticleEditor.createUndo <ParticleEditorUndo.ActionUpdateActiveEmitterSpeedFields>("Update Active Emitter"); action["emitter"] = emitter; action["isSlider"] = isSlider.AsString(); action["onMouseUp"] = onMouseUp.AsString(); action["newValueEjectionVelocity"] = PEE_ejectionVelocity_textEdit.getText(); action["oldValueEjectionVelocity"] = emitter["ejectionVelocity"]; action["newValueVelocityVariance"] = PEE_velocityVariance_textEdit.getText(); action["oldValueVelocityVariance"] = emitter["velocityVariance"]; ParticleEditor.submitUndo(action); } // Set the values on the current emitter. emitter["ejectionVelocity"] = PEE_ejectionVelocity_textEdit.getText(); emitter["velocityVariance"] = PEE_velocityVariance_textEdit.getText(); emitter.call("reload"); }
public void updateLifeFields(bool isRandom, float value, bool isSlider, bool onMouseUp) { GuiCheckBoxCtrl PEE_infiniteLoop = this.FOT("PEE_infiniteLoop"); GuiSliderCtrl PEE_lifetimeMS_slider = this.FOT("PEE_lifetimeMS_slider"); GuiSliderCtrl PEE_lifetimeVarianceMS_slider = this.FOT("PEE_lifetimeVarianceMS_slider"); GuiTextEditCtrl PEE_lifetimeVarianceMS_textEdit = this.FOT("PEE_lifetimeVarianceMS_textEdit"); GuiTextEditCtrl PEE_lifetimeMS_textEdit = this.FOT("PEE_lifetimeMS_textEdit"); editor Editor = "Editor"; ParticleEditor ParticleEditor = "ParticleEditor"; this.setEmitterDirty(); SimObject emitter = this.currEmitter; // Transfer values over to gui controls. if (isRandom) { if (value > 0) { value++; } if (value > PEE_lifetimeMS_slider.getValue()) { PEE_lifetimeMS_textEdit.setText(value.AsString()); PEE_lifetimeMS_slider.setValue(value.AsString()); } } else { if (value > 0) { value--; } if (value < PEE_lifetimeVarianceMS_slider.getValue()) { PEE_lifetimeVarianceMS_textEdit.setText(value.AsString()); PEE_lifetimeVarianceMS_slider.setValue(value.AsString()); } } // Submit undo. SimObject last = Editor.getUndoManager().getUndoAction((Editor.getUndoManager().getUndoCount() - 1)); if ((isSlider) && (last["isSlider"].AsBool()) && (!last["onMouseUp"].AsBool())) { last["isSlider"] = isSlider.AsString(); last["onMouseUp"] = onMouseUp.AsString(); last["newValueLifetimeMS"] = PEE_lifetimeMS_textEdit.getText(); last["newValueLifetimeVarianceMS"] = PEE_lifetimeVarianceMS_textEdit.getText(); } else { ParticleEditorUndo.ActionUpdateActiveEmitterLifeFields action = ParticleEditor.createUndo <ParticleEditorUndo.ActionUpdateActiveEmitterLifeFields>("Update Active Emitter"); action["emitter"] = emitter; action["isSlider"] = isSlider.AsString(); action["onMouseUp"] = onMouseUp.AsString(); action["newValueLifetimeMS"] = PEE_lifetimeMS_textEdit.getText(); action["oldValueLifetimeMS"] = emitter["lifetimeMS"]; action["newValueLifetimeVarianceMS"] = PEE_lifetimeVarianceMS_textEdit.getText(); action["oldValueLifetimeVarianceMS"] = emitter["lifetimeVarianceMS"]; ParticleEditor.submitUndo(action); } // Set the values on the current emitter. emitter["lifetimeMS"] = PEE_lifetimeMS_textEdit.getText(); emitter["lifetimeVarianceMS"] = PEE_lifetimeVarianceMS_textEdit.getText(); emitter.call("reload"); // Keep the infiniteLoop checkbox up to date. PEE_infiniteLoop.setStateOn(emitter["lifetimeMS"].AsInt() == 0); }
public void getAbsSize() { EWorldEditor EWorldEditor = "EWorldEditor"; GuiCheckBoxCtrl ETransformSelectionSizeProportional = "ETransformSelectionSizeProportional"; GuiCheckBoxCtrl DoSize = this.FOT("DoSize"); GuiCheckBoxCtrl SizeRelative = this.FOT("SizeRelative"); GuiTextEditCtrl SizeX = this.FOT("SizeX"); GuiTextEditCtrl SizeY = this.FOT("SizeY"); GuiTextEditCtrl SizeZ = this.FOT("SizeZ"); int count = EWorldEditor.getSelectionSize(); // If we have more than one SceneObject selected, // we must exit. SimObject obj = -1; for (int i = 0; i < count; i++) { SimObject test = EWorldEditor.getSelectedObject(i); if (test.isMemberOfClass("SceneObject")) { if (obj != -1) { return; } obj = test; } } if (obj == -1) { // No SceneObjects selected return; } string size = obj.call("getObjectBox"); string scale = obj.call("getScale"); string sizex = ((Util.getWord(size, 3).AsFloat() - Util.getWord(size, 0).AsFloat()) * Util.getWord(scale, 0).AsFloat()) .AsString(); SizeX.setText(sizex); if (!ETransformSelectionSizeProportional.getValue().AsBool()) { SizeY.setText( ((Util.getWord(size, 4).AsFloat() - Util.getWord(size, 1).AsFloat()) * Util.getWord(scale, 1).AsFloat()).AsString()); SizeZ.setText( ((Util.getWord(size, 5).AsFloat() - Util.getWord(size, 2).AsFloat()) * Util.getWord(scale, 2).AsFloat()).AsString()); } else { SizeY.setText(sizex); SizeZ.setText(sizex); } // Turn off relative as we're populating absolute values SizeRelative.setValue("0"); // Finally, set the Size check box as active. The user // likely wants this if they're getting the position. DoSize.setValue("1"); }
public void onSelectionChanged() { EWorldEditor EWorldEditor = "EWorldEditor"; GuiCheckBoxCtrl RotRelative = this.FOT("RotRelative"); GuiCheckBoxCtrl RotLocal = this.FOT("RotLocal"); GuiButtonCtrl GetPosButton = this.FOT("GetPosButton"); GuiButtonCtrl GetRotButton = this.FOT("GetRotButton"); GuiButtonCtrl GetScaleButton = this.FOT("GetScaleButton"); GuiButtonCtrl GetSizeButton = this.FOT("GetSizeButton"); GuiButtonCtrl ApplyButton = this.FOT("ApplyButton"); // Count the number of selected SceneObjects. There are // other object classes that could be selected, such // as SimGroups. int count = EWorldEditor.getSelectionSize(); int sceneObjects = 0; int globalBoundsObjects = 0; for (int i = 0; i < count; i++) { SimObject obj = EWorldEditor.getSelectedObject(i); if (obj.isMemberOfClass("SceneObject")) { sceneObjects++; if (obj.call("isGlobalBounds").AsBool()) { globalBoundsObjects++; } } } if (sceneObjects == 0) { // With nothing selected, disable all Get buttons this.disableAllButtons(); } else if (sceneObjects == 1) { // With one selected, all Get buttons are active GetPosButton.setActive(true); GetRotButton.setActive(true); // Special case for Scale and Size for global bounds objects if (globalBoundsObjects == 1) { GetSizeButton.setActive(false); GetScaleButton.setActive(false); } else { GetSizeButton.setActive(true); GetScaleButton.setActive(true); } ApplyButton.setActive(true); } else { // With more than one selected, only the position button // is active GetPosButton.setActive(true); GetRotButton.setActive(false); GetScaleButton.setActive(false); GetSizeButton.setActive(false); ApplyButton.setActive(true); // If both RotRelative and RotLocal are unchecked, then go with RotLocal if (RotRelative.getValue().AsInt() == 0 && RotLocal.getValue().AsInt() == 0) { RotLocal.setStateOn(true); } } }
public void updateSpinFields(bool isMax, float value, bool isSlider, bool onMouseUp) { editor Editor = "Editor"; ParticleEditor ParticleEditor = "ParticleEditor"; GuiTextEditCtrl PEP_spinRandomMin_textEdit = this.FOT("PEP_spinRandomMin_textEdit"); GuiTextEditCtrl PEP_spinRandomMax_textEdit = this.FOT("PEP_spinRandomMax_textEdit"); GuiSliderCtrl PEP_spinRandomMin_slider = this.FOT("PEP_spinRandomMin_slider"); GuiSliderCtrl PEP_spinRandomMax_slider = this.FOT("PEP_spinRandomMax_slider"); this.setParticleDirty(); SimObject particle = this.currParticle; // Transfer values over to gui controls. if (isMax) { value++; if (value > PEP_spinRandomMax_slider.getValue()) { PEP_spinRandomMax_textEdit.setText(value.AsString()); PEP_spinRandomMax_slider.setValue(value.AsString()); } } else { value--; if (value < PEP_spinRandomMin_slider.getValue()) { PEP_spinRandomMin_textEdit.setText(value.AsString()); PEP_spinRandomMin_slider.setValue(value.AsString()); } } // Submit undo. SimObject last = Editor.getUndoManager().getUndoAction((Editor.getUndoManager().getUndoCount() - 1)); if ((isSlider) && (last["isSlider"].AsBool()) && (!last["onMouseUp"].AsBool())) { last["isSlider"] = isSlider.AsString(); last["onMouseUp"] = onMouseUp.AsString(); last["newValueSpinRandomMax"] = PEP_spinRandomMax_textEdit.getText(); last["newValueSpinRandomMin"] = PEP_spinRandomMin_textEdit.getText(); } else { var action = ParticleEditor.createUndo <ParticleEditorUndo.ActionUpdateActiveParticleSpinFields>("Update Active Particle"); action["particle"] = particle; action["isSlider"] = isSlider.AsString(); action["onMouseUp"] = onMouseUp.AsString(); action["newValueSpinRandomMax"] = PEP_spinRandomMax_textEdit.getText(); action["oldValueSpinRandomMax"] = particle["spinRandomMax"]; action["newValueSpinRandomMin"] = PEP_spinRandomMin_textEdit.getText(); action["oldValueSpinRandomMin"] = particle["spinRandomMin"]; ParticleEditor.submitUndo(action); } particle["spinRandomMax"] = PEP_spinRandomMax_textEdit.getText(); particle["spinRandomMin"] = PEP_spinRandomMin_textEdit.getText(); particle.call("reload"); }