static void EditorManager_SceneEvent(object sender, SceneEventArgs e) { if (e.action == SceneEventArgs.Action.BeforeClosing) { FreeAllBrushes(); } }
/// <summary> /// On scene event /// </summary> void EditorManager_SceneEvent(object sender, SceneEventArgs e) { if (e.action == SceneEventArgs.Action.AfterLoading) { FillScriptList(); } }
public void OnSceneLoaded(object sender, SceneEventArgs e) { //Debug.Log (e.Scene + " Loaded (mod.cs)"); if (e.Scene == ModApi.Scenes.SceneNames.Designer) { designer.CraftLoaded += OnCraftLoaded; designer.BeforeCraftUnloaded += OnCraftUnloading; designer.CraftStructureChanged += OnCraftStructureChanged; designer.Click += OnClick; DesignerToolsUIController.OnDesignerLoaded(); selectorManager.OnDesignerLoaded(); if (ModSettings.Instance.viewCube && _viewCube == null) { _viewCube = new ViewCube(designer); } // IFlyout flyout = Game.Instance.Designer.DesignerUi.Flyouts.Tools; // IXmlLayout layout = flyout.Transform.GetComponentInChildren<IXmlLayout> ().GetElementById ("PaintTool").XmlLayout; // Debug.Log ("Paint Tool Panel: " + layout.Xml); // Debug.Log (layout.ToString ()); // RectTransform root = layout.GetElementById<RectTransform> ("edit-color-panel"); // Debug.Log ("panel: " + root.ToString ()); // _ColorPickerButton = Game.Instance.UserInterface.BuildUserInterfaceFromResource<ColorPickerButtonScript> ("DesignerTools/Designer/ColorPickerButton", (s, c) => { s.OnLayoutRebuilt (c.XmlLayout); }, root); // _ColorPickerButton.gameObject.AddComponent<LayoutElement> ().minHeight = 30; // _ColorPickerButton.transform.SetAsLastSibling (); } }
/// <summary> /// Raises the focus locked event event. /// </summary> /// <param name="e">E.</param> protected virtual void OnSceneEvent(SceneEventArgs e) { if (Scene != null) { Scene(this, e); } }
public override void OnSceneEvent(SceneEventArgs args) { base.OnSceneEvent(args); if (args.action == SceneEventArgs.Action.AfterRendererNodeChanged) { CheckRendererNodeCompatibility(); } }
void EditorManager_SceneEvent(object sender, SceneEventArgs e) { if (e.action == SceneEventArgs.Action.BeforeClosing) { // Will result in call to OnDeactivate and end the editing EditorManager.ActiveView.SetDefaultContext(); } }
public void OnSceneUnloading(object sender, SceneEventArgs e) { if (e.Scene == ModApi.Scenes.SceneNames.Designer) { //Debug.Log (e.Scene + " Unloading (mod.cs)"); Designer.CraftLoaded -= OnCraftLoaded; _ViewCube = null; } }
void EditorManager_SceneEvent(object sender, SceneEventArgs e) { if ((e.action == SceneEventArgs.Action.AfterStaticLighting || e.action == SceneEventArgs.Action.StaticLightingReset || e.action == SceneEventArgs.Action.StaticLightingLoaded) && e.Success) { foreach (Layer layer in EditorManager.Scene.Layers) { layer.Root.RunVisitor(ParticleGroupShape.LIGHTING_CHANGED); } } }
private void handleSceneEvent(object sender, SceneEventArgs args) { Debug.Log("SceneManager: Reloading Player at new position with body " + args.NextBody.ToString() + "."); if (this.m_Player.GetComponent <NavMeshAgent> () != null) { DestroyImmediate(this.m_Player.GetComponent <NavMeshAgent> ()); Debug.Log("SceneManager: NavMeshAgent removed from Player"); } // configure character controller UpdateController(args.NextSpot, args.NextBody, args.LookAt); }
public override void OnSceneEvent(SceneEventArgs args) { base.OnSceneEvent(args); if (args.action == SceneEventArgs.Action.AfterStaticLighting || args.action == SceneEventArgs.Action.StaticLightingReset) { if (_useStaticLighting && HasEngineInstance()) { EngineMobileWater.UpdateStaticLighting(); } } }
void EditorManager_SceneEvent(object sender, SceneEventArgs e) { if (e.action == SceneEventArgs.Action.AfterClosing) { // clear out the settings collection m_settingsDictionary = null; UpdateSettingsListView(); } else if (e.action == SceneEventArgs.Action.BeforeExport) { ExportSceneEventArgs exportEventArgs = e as ExportSceneEventArgs; if (tsb_Build.ToolTipText == BUILD_DIRTY_STR) { } } }
private void FocusTargetBehaviour(GameObject go) { switch (go.tag) { case "TriggerScene": SceneEventArgs args = new SceneEventArgs(); args.NextSpot = go.GetComponent <VMENextSpot>().nextSpot; args.NextBody = go.GetComponent <VMENextSpot>().nextBody; OnSceneEvent(args); break; case "TriggerObject": go.GetComponent <VMEObjectAction>().LockAction(); Debug.Log("FocusEventVMECameraRayTracker on object: " + this.TargetObjectName); break; default: Debug.Log("FocusEventVMECameraRayTracker on object: " + this.TargetObjectName); break; } }
private void SceneManagerOnSceneLoaded( Object sender, SceneEventArgs e) { if (Game.InFlightScene) { // Add docking port cameras var craft = Game.Instance.FlightScene.CraftNode.CraftScript; foreach (var partData in craft.Data.Assembly.Parts.Where(p => !p.IsDestroyed)) { var part = partData.PartScript; if (part.GetModifier <DockingPortScript>() != null) { var existingScript = part.GetModifier <CameraVantageScript>(); if (existingScript == null) { // Automatically add a CameraVantage Part Modifier to all DockingPort parts var cameraData = PartModifierData.CreateFromDefaultXml <CameraVantageData>(part.Data); cameraData.ViewMode = ViewMode.FirstPerson; var cameraVantageScript = (CameraVantageScript)cameraData.CreateScript(); var cameraAlignment = cameraVantageScript.gameObject.AddComponent <DockingPortCameraAlignment>(); cameraAlignment.Initialize(cameraVantageScript, part); } else if (existingScript.gameObject.GetComponent <DockingPortCameraAlignment>() == null) { var cameraAlignment = existingScript.gameObject.AddComponent <DockingPortCameraAlignment>(); cameraAlignment.Initialize(existingScript, part); } } } } }
/// <summary> /// On scene event /// </summary> void EditorManager_SceneEvent(object sender, SceneEventArgs e) { if (e.action == SceneEventArgs.Action.AfterLoading) FillScriptList(); }
private void SceneEventDemo1(object o, SceneEventArgs e) { Debug.Log("All " + e.SceneName + " : " + e.Process); }
public override void OnSceneEvent(SceneEventArgs e) { base.OnSceneEvent(e); if (!HasEngineInstance()) { return; } switch (e.action) { case SceneEventArgs.Action.AfterSaving: // save the native terrain sectors also when the scene is saved if(e.Success) { EngineTerrain.SaveToFile(); } break; case SceneEventArgs.Action.AfterStaticLighting: case SceneEventArgs.Action.StaticLightingReset: case SceneEventArgs.Action.AfterRendererNodeChanged: UpdateAutoTerrainEffect(); break; } }
/// <summary> /// Handles the respawned event /// </summary> /// <param name="sender">Sender.</param> /// <param name="e">Event args.</param> void HandleRespawned(object sender, SceneEventArgs e) { Show (); }
/// <summary> /// Handles the respawned event /// </summary> /// <param name="sender">Sender.</param> /// <param name="e">Event args.</param> void HandleRespawned(object sender, SceneEventArgs e) { Show(); }
/// <summary> /// Handles the load or respawn event by resetting timer. /// </summary> /// <param name="sender">Sender.</param> /// <param name="e">E.</param> protected void HandleLoadOrRespawn(object sender, SceneEventArgs e) { ResetTimer (); }
public override void OnSceneEvent(SceneEventArgs e) { base.OnSceneEvent(e); if (!Active || !ExportShape || EngineBox == null) return; if (e.action == SceneEventArgs.Action.BeforeExport || e.action == SceneEventArgs.Action.BeforePrefabBinaryExport) { ShapeCollection shapes = GetRelevantShapes(); if (shapes == null || shapes.Count == 0) return; string name; string fileextension = ".vmesh"; if (string.IsNullOrEmpty(_exportFileName)) { //use UID name = string.Format("SM_{0:x8}_{1:x8}", ParentLayer.LayerID, this.LocalID); } else { name = _exportFileName; } name += fileextension; string filename = null; if (e is ExportSceneEventArgs) filename = Path.Combine(((ExportSceneEventArgs)e).ExportInfo.AbsoluteExportDataFolder, name); else { // this path is taken by BeforePrefabBinaryExport PropertyInfo property = EditorManager.Scene.GetType().GetProperty("AbsoluteZoneExportFolder"); if (property != null) filename = property.GetValue(EditorManager.Scene, null) as string; if (string.IsNullOrEmpty(filename)) return; filename = Path.Combine(filename, name); } filename = EditorManager.Project.MakeRelative(filename); EngineBox.fCombinedFarClipDist = -1.0f; EngineBox.iCombinedVisibleBitmask = 0; EngineBox.iCombinedCollisionBitmask = 0; EngineBox.bCombinedStaticShadows = false; EngineBox.bCombinedDynamicShadows = false; foreach (StaticMeshShape shape in shapes) { if (StaticMeshShape.UsesCollisionGroups) { EngineBox.iCombinedCollisionBitmask = shape.EngineMesh.GetCollisionFilter(); } else EngineBox.iCombinedCollisionBitmask |= (uint)shape.CollisionBitmask; EngineBox.iCombinedVisibleBitmask |= (uint)shape.VisibleBitmask; EngineBox.fCombinedFarClipDist = Math.Max(EngineBox.fCombinedFarClipDist, shape.FarClipDistance); EngineBox.bCombinedStaticShadows |= shape.CastStaticShadows; EngineBox.bCombinedDynamicShadows |= shape.CastDynamicShadows; } EngineBox.BeginExport(shapes, filename); return; } if (e.action == SceneEventArgs.Action.AfterExport || e.action == SceneEventArgs.Action.AfterPrefabBinaryExport) { EngineBox.EndExport(); return; } }
void EditorManager_SceneEvent(object sender, SceneEventArgs e) { if (e.action == SceneEventArgs.Action.AfterClosing) { // Will trigger searchPanel_FilterChanged searchPanel.ClearSearch(); } }
private void SceneEventDemo2(object o, SceneEventArgs e) { Debug.Log("Single " + e.SceneName + " : " + e.Process); }
public override void OnSceneEvent(SceneEventArgs args) { base.OnSceneEvent(args); if (args.action == SceneEventArgs.Action.AfterStaticLighting || args.action == SceneEventArgs.Action.StaticLightingReset) { if (_useStaticLighting && HasEngineInstance()) EngineMobileWater.UpdateStaticLighting(); } }
public override void OnSceneEvent(SceneEventArgs e) { base.OnSceneEvent(e); if (e.action == SceneEventArgs.Action.AfterStaticLighting || e.action == SceneEventArgs.Action.StaticLightingReset || e.action == SceneEventArgs.Action.StaticLightingLoaded) { if (this.UseSceneBrightness) this.UpdateBillboardMesh(); } else if (e.action == SceneEventArgs.Action.AfterRendererNodeChanged) { if (HasEngineInstance()) EngineMesh.ReassignShader(); } if (e.action == SceneEventArgs.Action.BeforeClosing) { if (_contextDlg != null) // create a new dialog next scene { _contextDlg.Close(); _contextDlg = null; } } }
void EditorManager_SceneEvent(object sender, SceneEventArgs e) { if (e.action == SceneEventArgs.Action.AllowExport) { if (MeshExportSettings.AutomaticExport && MeshExportSettings.ExportForAssetProfile.IsActiveProfileSet) { if (EditorManager.ShowMessageBox("The terrain data needs to be saved before the export.\n Continue?", "Save Terrain Data", MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes) { if (e is ExportSceneEventArgs) { ((ExportSceneEventArgs)e).CancelExport = true; } } } } else if (e.action == SceneEventArgs.Action.BeforeExport && HasEngineInstance()) { if (e is ExportSceneEventArgs) { if (MeshExportSettings.ExportForAssetProfile.IsActiveProfileSet) { if (!MeshExportSettings.AutomaticExport) return; EditorManager.ActiveView.SetDefaultContext(); int iCountX = 0; int iCountY = 0; if (!EngineTerrain.GetSectorMeshCount(ref iCountX, ref iCountY)) return; EditorManager.EngineManager.DisableRendering(); EditorManager.Progress.ShowProgressDialog("Exporting terrain sectors as static meshes"); try { // export each sector of the terrain as a .vmesh file EngineTerrain.ExportTerrainMeshs(MeshExportSettings, EditorManager.Progress, 50.0f, false); // collection which holds all exported zones, these zones are removed after the export (see below: SceneEventArgs.Action.AfterExport) exportedZones = new ZoneCollection(); // disable visibility zone disconnecting EngineTerrain.SetTerrainMeshExportFlag(true); float fStep = 50.0f / (float)(iCountX*iCountY); float fPercentage = 50.0f; // create zone, layer, and static mesh for each sector of the terrain for (int sy = 0; sy < iCountY; ++sy) { for (int sx = 0; sx < iCountX; ++sx) { string sectorFileName = EngineTerrain.GetSectorMeshFileName(sx, sy); if (sectorFileName == null) continue; // create static mesh StaticMeshShape shape = new StaticMeshShape(Path.GetFileNameWithoutExtension(sectorFileName)); shape.Position = (Vector3F)EngineTerrain.GetSectorOrigin(sx, sy); shape.MeshFileName = sectorFileName; string lightmapFileName = EngineTerrain.GetSectorLightmapName(sx, sy); if (lightmapFileName != null) shape.CustomLightmap = lightmapFileName; // create zone string uniqueFileName = FileHelper.CreateUniqueFilename(EditorManager.Scene.LayerDirectoryName, "TerrainSectorZone" + sx + "_" + sy, IScene.ZoneFileExtension); object[] zoneParameters = { EditorManager.Scene.CreateUniqueZoneName("TerrainSectorZone" + sx + "_" + sy) }; Zone zone = EditorManager.ZoneFactory.CreateInstance(zoneParameters); zone.SetZoneFileNameInternal(uniqueFileName); zone.LoadedDistance = MeshExportSettings.LoadedDistance; zone.CacheInMargin = MeshExportSettings.CacheInMargin; zone.CacheOutMargin = MeshExportSettings.CacheOutMargin; EditorManager.Scene.AddZone(zone); // create layer string uniqueFile = EditorManager.Scene.Layers.CreateUniqueLayerFileName(EditorManager.Scene.LayerDirectoryName, "TerrainSector" + sx + "_" + sy); object[] layerParameters = { "TerrainSector" }; Layer layer = EditorManager.LayerFactory.CreateInstance(layerParameters); layer.SetLayerFileNameInternal(uniqueFile); layer.AttachToZone(zone); EditorManager.Scene.AddLayer(layer, true); layer.AddShape(shape, shape.Parent); // add zone to export info, so that it gets exported ((ExportSceneEventArgs)e).ExportInfo.RelevantExportZones.Add(zone); ((ExportSceneEventArgs)e).ExportInfo.RelevantEmbeddedZones.Add(zone); // keep reference to be able to remove the zone after export exportedZones.Add(zone); fPercentage += fStep; if (EditorManager.Progress != null) EditorManager.Progress.Percentage = fPercentage; Application.DoEvents(); } } } finally { EditorManager.Progress.HideProgressDialog(); EditorManager.EngineManager.EnableRendering(); } } } } else if (e.action == SceneEventArgs.Action.AfterExport && HasEngineInstance()) { if (e is ExportSceneEventArgs) { if (MeshExportSettings.ExportForAssetProfile.IsActiveProfileSet) { if (!MeshExportSettings.AutomaticExport) return; // re-enable default behaviour for terrain visibility zone serialization EngineTerrain.SetTerrainMeshExportFlag(false); foreach (Zone zone in exportedZones) { // create .deleted filenames string absLayerFileName = zone.Layers[0].AbsoluteLayerFilename + ".deleted"; string absZoneFileName = zone.AbsoluteZoneFilename + ".deleted"; EditorManager.Scene.RemoveZone(zone); // delete .deleted files, because they are not needed in any way if (File.Exists(absLayerFileName)) File.Delete(absLayerFileName); if (File.Exists(absZoneFileName)) File.Delete(absZoneFileName); } exportedZones.Clear(); } } } }
public override void OnSceneEvent(SceneEventArgs args) { base.OnSceneEvent(args); if (args.action == SceneEventArgs.Action.UpdateNativeVariable) { UpdateVariableEventArgs e = (UpdateVariableEventArgs)args; if (e.Success || !Modifiable || !HasEngineInstance() || !e.IsSubProperty || EntityProperties == null || !EngineEntity.IsNativeObject(e.NativeObject)) return; DynamicProperty prop = EntityProperties.GetPropertyByDisplayName(e.VariableName); if (prop == null) return; object newVal = SerializationHelper.GetObjectFromStringData(prop.PropertyType.NativeType, e.VariableValue); IAction action = SetPropertyAction.CreateSetPropertyAction(EntityProperties, e.VariableName, newVal); if (e.SetViaAction) EditorManager.Actions.Add(action); else { action.Do(); // Make sure that the UI gets informed about this change, since we bypass the undo/redo system IScene.SendPropertyChangedEvent(new PropertyChangedArgs(this, e.VariableName)); } e.Success = true; return; } }
private void enginePanel_SceneEvent(object sender, SceneEventArgs e) { if (e.action == SceneEventArgs.Action.AfterRendererNodeChanged) { //the render node changed... if (EditorManager.Scene!=null && EditorManager.Scene.RendererNodeClass == IRendererNodeManager.RENDERERNODECLASS_DEFERRED) { if (EditorManager.ActiveView.ProjectionMode != VisionViewBase.ProjectionMode_e.Perspective) { //switch back to perspective because we do not support deferred + orthogonal EditorManager.ActiveView.ProjectionMode = VisionViewBase.ProjectionMode_e.Perspective; } //switch back to normal shading VisionEngineManager engineManager = (VisionEngineManager)EditorManager.EngineManager; engineManager.SetReplacementRenderLoopEffect(ShadingEffectMenuItem.NORMAL_SHADING_INDEX); EditorManager.ActiveView.UpdateView(true); } } }
public override void OnSceneEvent(SceneEventArgs e) { base.OnSceneEvent(e); if (!Active || !ExportShape || EngineBox == null) { return; } if (e.action == SceneEventArgs.Action.BeforeExport || e.action == SceneEventArgs.Action.BeforePrefabBinaryExport) { ShapeCollection shapes = GetRelevantShapes(); if (shapes == null || shapes.Count == 0) { return; } string name; string fileextension = ".vmesh"; if (string.IsNullOrEmpty(_exportFileName)) { //use UID name = string.Format("SM_{0:x8}_{1:x8}", ParentLayer.LayerID, this.LocalID); } else { name = _exportFileName; } name += fileextension; string filename = null; if (e is ExportSceneEventArgs) { filename = Path.Combine(((ExportSceneEventArgs)e).ExportInfo.AbsoluteExportDataFolder, name); } else { // this path is taken by BeforePrefabBinaryExport PropertyInfo property = EditorManager.Scene.GetType().GetProperty("AbsoluteZoneExportFolder"); if (property != null) { filename = property.GetValue(EditorManager.Scene, null) as string; } if (string.IsNullOrEmpty(filename)) { return; } filename = Path.Combine(filename, name); } filename = EditorManager.Project.MakeRelative(filename); EngineBox.fCombinedFarClipDist = -1.0f; EngineBox.iCombinedVisibleBitmask = 0; EngineBox.iCombinedCollisionBitmask = 0; EngineBox.bCombinedStaticShadows = false; EngineBox.bCombinedDynamicShadows = false; foreach (StaticMeshShape shape in shapes) { if (StaticMeshShape.UsesCollisionGroups) { EngineBox.iCombinedCollisionBitmask = shape.EngineMesh.GetCollisionFilter(); } else { EngineBox.iCombinedCollisionBitmask |= (uint)shape.CollisionBitmask; } EngineBox.iCombinedVisibleBitmask |= (uint)shape.VisibleBitmask; EngineBox.fCombinedFarClipDist = Math.Max(EngineBox.fCombinedFarClipDist, shape.FarClipDistance); EngineBox.bCombinedStaticShadows |= shape.CastStaticShadows; EngineBox.bCombinedDynamicShadows |= shape.CastDynamicShadows; } EngineBox.BeginExport(shapes, filename); return; } if (e.action == SceneEventArgs.Action.AfterExport || e.action == SceneEventArgs.Action.AfterPrefabBinaryExport) { EngineBox.EndExport(); return; } }
/// <summary> /// Handles the respawned event from the level manager /// </summary> /// <param name="sender">Sender.</param> /// <param name="e">E.</param> void HandleRespawned(object sender, SceneEventArgs e) { UpdateText (); }
public override void OnSceneEvent(SceneEventArgs e) { base.OnSceneEvent(e); // save the native terrain sectors also when the scene is saved if (e.action == SceneEventArgs.Action.AfterSaving && e.Success && HasEngineInstance()) EngineTerrain.SaveToFile(); // after lighting, we should mark the layer as dirty to save the terrain sector files // if (e.action == SceneEventArgs.Action.AfterStaticLighting && e.Success && HasEngineInstance() && Lightmapped && Modifiable) // this.Modified = true; if (e.action == SceneEventArgs.Action.AfterRendererNodeChanged && HasEngineInstance()) EngineTerrain.SetShaderEffect(this.ShaderConfig); }
/// <summary> /// Called by the scene if the static lighting update is finished /// </summary> /// <param name="sender"></param> /// <param name="e"></param> public override void OnSceneEvent(SceneEventArgs e) { base.OnSceneEvent(e); bool bNeedsDynUpdate = false; if (e.action == SceneEventArgs.Action.AfterStaticLighting && e.Success) { // for this combination, turn off the dynamic light preview if (_bTurnOffAfterLighting && _bStatic && _bPreviewStatic && !_bBakedToLightmap) { this._bBakedToLightmap = true; bNeedsDynUpdate = true; // update the property grid IScene.SendPropertyChangedEvent(new PropertyChangedArgs(this, "BakedToLightmap")); } } if (e.action == SceneEventArgs.Action.StaticLightingReset && _bBakedToLightmap) { this._bBakedToLightmap = false; bNeedsDynUpdate = true; } if (bNeedsDynUpdate) { if (this.Modifiable) this.Modified = true; // mark layer dirty so the flag gets saved if (HasEngineInstance()) EngineLight.SetPreviewStatic(_bPreviewStatic && !_bBakedToLightmap); UpdateLightPreviewProperties(); } }
/// <summary> /// React to scene changes /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void EditorManager_SceneEvent(object sender, SceneEventArgs e) { if ((e.action == SceneEventArgs.Action.AfterStaticLighting || e.action == SceneEventArgs.Action.StaticLightingLoaded || e.action == SceneEventArgs.Action.StaticLightingReset) && e.Success) { if (TerrainEditor.CurrentTerrain != null && TerrainEditor.CurrentTerrain.LightmapSize != TerrainShape.LightmapSize_e.NoLightmapping) { TerrainEditor.DirectionalLighting = false; // switch to lightmapping mode } } if (e.action == SceneEventArgs.Action.AfterRendererNodeChanged) { UpdateToolbar(); } }
void EditorManager_SceneEvent(object sender, SceneEventArgs e) { if ((e.action == SceneEventArgs.Action.AfterStaticLighting || e.action == SceneEventArgs.Action.StaticLightingReset || e.action == SceneEventArgs.Action.StaticLightingLoaded) && e.Success) { foreach (Layer layer in EditorManager.Scene.Layers) layer.Root.RunVisitor(ParticleGroupShape.LIGHTING_CHANGED); } }
/// <summary> /// Handles the respawned event from the level manager /// </summary> /// <param name="sender">Sender.</param> /// <param name="e">E.</param> void HandleRespawned(object sender, SceneEventArgs e) { UpdateText(); }
private void EditorManager_SceneEvent(object sender, SceneEventArgs e) { if (e.action == SceneEventArgs.Action.AfterStaticLighting) { LightingChanged(true); } }