//protected override void Viewport_UpdateBeforeOutput( Viewport viewport ) //{ // base.Viewport_UpdateBeforeOutput( viewport ); // //update // if( instanceInScene != null && Time.Current > lastUpdateTime + 0.1 ) // { // CreateObject(); // lastUpdateTime = Time.Current; // } //} void CreateObject() { instanceInScene?.Dispose(); instanceInScene = (Component_Skybox)Skybox.Clone(); Scene.AddComponent(instanceInScene); }
void UpdatePreviewEnvironment() { var env = ProjectSettings.Get.GetMaterialPreviewEnvironment(); var multiplier = ProjectSettings.Get.MaterialPreviewEnvironmentMultiplier.Value; var affect = ProjectSettings.Get.MaterialPreviewEnvironmentAffectLighting.Value; if (!previewEnvironmentUsed.Equals(env) || previewEnvironmentMultiplierUsed != multiplier || previewEnvironmentAffectLightingUsed != affect) { previewEnvironmentUsed = env; previewEnvironmentMultiplierUsed = multiplier; previewEnvironmentAffectLightingUsed = affect; if (env.Value != null) { if (skybox == null) { skybox = Scene.CreateComponent <Component_Skybox>(); } skybox.Cubemap = env; skybox.Multiplier = multiplier; skybox.AffectLighting = affect; } else { skybox?.Dispose(); skybox = null; } } }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); if (Skybox != null) { var scene = CreateScene(false); instanceInScene = (Component_Skybox)Skybox.Clone(); scene.AddComponent(instanceInScene); scene.Enabled = true; //if( Document != null ) // Document.UndoSystem.ListOfActionsChanged += UndoSystem_ListOfActionsChanged; if (ObjectOfWindow != null) { SelectObjects(new object[] { ObjectOfWindow }); } } }