public static void UnlockInspectorWindowIfLocked(GameObject go) { #if UNITY_EDITOR if (ActiveEditorTracker.sharedTracker.isLocked) { if (!Selection.objects.IsNullOrEmpty()) { var match = false; foreach (var o in Selection.objects) { if (o == go) { match = true; break; } } if (!match) { return; } } ActiveEditorTracker.sharedTracker.isLocked = false; QcUnity.FocusOn(go); } #endif }
public static void RefocusIfLocked(Object current, Object target) { #if UNITY_EDITOR if (current != target && target && ActiveEditorTracker.sharedTracker.isLocked) { ActiveEditorTracker.sharedTracker.isLocked = false; QcUnity.FocusOn(target); ActiveEditorTracker.sharedTracker.isLocked = true; } #endif }
public static void Lock_UnlockWindowClick(Object obj) { #if UNITY_EDITOR if (!PaintingGameViewUI) { if (ActiveEditorTracker.sharedTracker.isLocked == false && icon.Unlock.ClickUnFocus("Lock Inspector Window")) { QcUnity.FocusOn(ef.serObj.targetObject); ActiveEditorTracker.sharedTracker.isLocked = true; } if (ActiveEditorTracker.sharedTracker.isLocked && icon.Lock.ClickUnFocus("Unlock Inspector Window")) { ActiveEditorTracker.sharedTracker.isLocked = false; QcUnity.FocusOn(obj); } } #endif }
public static void GridUpdate(SceneView sceneView) { var e = Event.current; if (e.isMouse) { EditorInputManager.FeedMouseEvent(e); } if (!PlaytimePainter.IsCurrentTool) { return; } if (e.isMouse) { if (e.button == 0) { lMouseDwn = (e.type == EventType.MouseDown) && (e.button == 0); lMouseUp = (e.type == EventType.MouseUp) && (e.button == 0); } mousePosition = Event.current.mousePosition; var cam = Camera.current; var offScreen = (!cam || (mousePosition.x <0 || mousePosition.y <0 || mousePosition.x> cam.pixelWidth || mousePosition.y> cam.pixelHeight)); if (!offScreen) { var camTf = cam.transform; EditorInputManager.centerRaySceneView = new Ray(camTf.position, camTf.forward); mouseRayGui = HandleUtility.GUIPointToWorldRay(mousePosition); EditorInputManager.mouseRaySceneView = mouseRayGui; if (painter) { mouseRayGui = painter.PrepareRay(mouseRayGui); } } } FeedEvents(e); if (e.isMouse) { RaycastHit hit; var isHit = Physics.Raycast(mouseRayGui, out hit); var pp = isHit ? hit.transform.GetComponent <PlaytimePainter>() : null; var refocus = OnEditorRayHit_AllowRefocusing(hit, mouseRayGui); if (lMouseDwn && e.button == 0 && refocus && isHit) { if (pp && pp == painter && AllowEditing(painter)) { HandleUtility.AddDefaultControl(GUIUtility.GetControlID(FocusType.Passive)); } QcUnity.FocusOn(hit.transform.gameObject); } #if !UNITY_2019_1_OR_NEWER if (!navigating && AllowEditing(painter)) { e.Use(); } #endif } if (painter && painter.textureWasChanged) { painter.ManagedUpdateOnFocused(); } }
public void CombinedUpdate() { if (!this || !Data) { return; } lastManagedUpdate = QcUnity.TimeSinceStartup(); if (PlaytimePainter.IsCurrentTool && FocusedPainter) { FocusedPainter.ManagedUpdateOnFocused(); } QcAsync.UpdateManagedCoroutines(); MeshManager.CombinedUpdate(); if (!Application.isPlaying && depthProjectorCamera) { depthProjectorCamera.ManagedUpdate(); } #if UNITY_EDITOR if (refocusOnThis) { _scipFrames--; if (_scipFrames == 0) { QcUnity.FocusOn(refocusOnThis); refocusOnThis = null; _scipFrames = 3; } } #endif var p = PlaytimePainter.currentlyPaintedObjectPainter; if (p && !Application.isPlaying && ((QcUnity.TimeSinceStartup() - lastPainterCall) > 0.016f)) { if (p.TexMeta == null) { PlaytimePainter.currentlyPaintedObjectPainter = null; } else { p.ProcessStrokeState(); } } var needRefresh = false; if (CameraModuleBase.modules != null) { foreach (var pl in CameraModuleBase.modules) { if (pl != null) { pl.Update(); } else { needRefresh = true; } } } if (needRefresh) { Debug.Log("Refreshing modules"); CameraModuleBase.RefreshModules(); } lastPainterCall = QcUnity.TimeSinceStartup(); }
public void CombinedUpdate() { if (!this || !Data) { return; } lastManagedUpdate = Time.time; if (PlaytimePainter.IsCurrentTool && focusedPainter) { focusedPainter.ManagedUpdateOnFocused(); } if (GlobalBrush.previewDirty) { SHADER_BRUSH_UPDATE(); } QcAsync.UpdateManagedCoroutines(); MeshManager.CombinedUpdate(); if (!Application.isPlaying && depthProjectorCamera) { depthProjectorCamera.ManagedUpdate(); } #if UNITY_EDITOR if (refocusOnThis) { _scipFrames--; if (_scipFrames == 0) { QcUnity.FocusOn(refocusOnThis); refocusOnThis = null; _scipFrames = 3; } } #endif var p = PlaytimePainter.currentlyPaintedObjectPainter; if (p && !Application.isPlaying && ((Time.time - lastPainterCall) > 0.016f)) { if (p.TexMeta == null) { PlaytimePainter.currentlyPaintedObjectPainter = null; } else { p.ProcessStrokeState(); //TexMgmtData.brushConfig.Paint(p.stroke, p); //p.ManagedUpdateOnFocused(); } } var needRefresh = false; if (CameraModuleBase.modules != null) { foreach (var pl in CameraModuleBase.modules) { if (pl != null) { pl.Update(); } else { needRefresh = true; } } } if (needRefresh) { Debug.Log("Refreshing modules"); CameraModuleBase.RefreshPlugins(); } lastPainterCall = Time.time; }
public void CombinedUpdate() { if (!this || !Data) { return; } lastManagedUpdate = Time.time; if (PlaytimePainter.IsCurrentTool && focusedPainter) { focusedPainter.ManagedUpdate(); } if (GlobalBrush.previewDirty) { SHADER_BRUSH_UPDATE(); } PlaytimePainter uiPainter = null; MeshManager.CombinedUpdate(); if (!Application.isPlaying && depthProjectorCamera) { depthProjectorCamera.ManagedUpdate(); } #if UNITY_2018_1_OR_NEWER foreach (var j in blitJobsActive) { if (j.jobHandle.IsCompleted) { j.CompleteJob(); } } #endif #if UNITY_EDITOR if (refocusOnThis) { _scipFrames--; if (_scipFrames == 0) { QcUnity.FocusOn(refocusOnThis); refocusOnThis = null; _scipFrames = 3; } } #endif if (!uiPainter || !uiPainter.CanPaint()) { var p = PlaytimePainter.currentlyPaintedObjectPainter; if (p && !Application.isPlaying && ((Time.time - lastPainterCall) > 0.016f)) { if (p.TexMeta == null) { PlaytimePainter.currentlyPaintedObjectPainter = null; } else { TexMgmtData.brushConfig.Paint(p.stroke, p); p.ManagedUpdate(); } } } var needRefresh = false; if (PainterSystemManagerModuleBase.modules != null) { foreach (var pl in PainterSystemManagerModuleBase.modules) { if (pl != null) { pl.Update(); } else { needRefresh = true; } } } if (needRefresh) { Debug.Log("Refreshing modules"); PainterSystemManagerModuleBase.RefreshPlugins(); } lastPainterCall = Time.time; }