Skip to content

Commit

Permalink
reorganize prj hierarchy
Browse files Browse the repository at this point in the history
  • Loading branch information
MuSmile committed Feb 28, 2023
1 parent cf7f94e commit 6a39e2d
Show file tree
Hide file tree
Showing 35 changed files with 427 additions and 433 deletions.
4 changes: 2 additions & 2 deletions data/themes/dark/qss/dock.qss
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,8 @@ ads--CDockWidgetTab[hasIcon="true"]
ads--CDockWidgetTab[activeTab="true"]
{
background: &[Palette/bgActive];
border-top-left-radius: 3px;
border-top-right-radius: 3px;
border-top-left-radius: 0px;
border-top-right-radius: 0px;
}

ads--CDockWidgetTab[activeTab="true"] > QFrame
Expand Down
2 changes: 1 addition & 1 deletion data/themes/dark/qss/widgets/menu.qss
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ QMenuBar {
}

QMenu {
min-width: 80px;
/*min-width: 80px;*/
font-size: &[Font/sizeMenuItem];
}
#end
Expand Down
4 changes: 2 additions & 2 deletions data/themes/dark/qss/widgets/trees.qss
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ TreeView
qproperty-dropIndicatorWidth: 2;

qproperty-customAnimated: true;
qproperty-customAnimDuration: 100;
qproperty-customAnimTickInterval: 10;
qproperty-customAnimDuration: 80;
qproperty-customAnimTickInterval: 8;

qproperty-drawBranchLine: true;
qproperty-branchLineFilterDepth: 1;
Expand Down
File renamed without changes.
6 changes: 3 additions & 3 deletions editor/common/math.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ def clamp(t, min, max):
return t

def sign(x):
if x > 0: return 1
if x < 0: return -1
return 0
if x > 0: return 1
if x < 0: return -1
return 0

def cosd(deg):
return cos(radians(deg))
Expand Down
Binary file modified editor/common/pyqtads/osx/libqt6advanceddocking.4.0.2.dylib
Binary file not shown.
60 changes: 37 additions & 23 deletions editor/common/util.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import time
import sys, os, time
from PySide6.QtCore import Qt, QPropertyAnimation, QPoint
from PySide6.QtGui import QPainter, QPixmap, QBrush
from PySide6.QtWidgets import QApplication, QMainWindow


#############################################
Expand Down Expand Up @@ -62,25 +63,38 @@ def requestTransparentBgBrush():

#############################################
def shakeWidget(target):
if hasattr(target, '_shakeing'): return
animation = QPropertyAnimation(target, b'pos', target)
animation.finished.connect(lambda: delattr(target, '_shakeing'))
target._shakeing = True
pos = target.pos()
x, y = pos.x(), pos.y()
animation.setDuration(100)
animation.setLoopCount(2)
animation.setKeyValueAt(0, QPoint(x, y))
animation.setKeyValueAt(0.09, QPoint(x + 1, y - 1))
animation.setKeyValueAt(0.18, QPoint(x + 2, y - 2))
animation.setKeyValueAt(0.27, QPoint(x + 1, y - 3))
animation.setKeyValueAt(0.36, QPoint(x + 0, y - 4))
animation.setKeyValueAt(0.45, QPoint(x - 1, y - 3))
animation.setKeyValueAt(0.54, QPoint(x - 2, y - 4))
animation.setKeyValueAt(0.63, QPoint(x - 3, y - 3))
animation.setKeyValueAt(0.72, QPoint(x - 4, y - 2))
animation.setKeyValueAt(0.81, QPoint(x - 3, y - 1))
animation.setKeyValueAt(0.90, QPoint(x - 2, y - 0))
animation.setKeyValueAt(0.99, QPoint(x - 1, y + 1))
animation.setEndValue(QPoint(x, y))
animation.start(animation.DeleteWhenStopped)
if hasattr(target, '_shakeing'): return
animation = QPropertyAnimation(target, b'pos', target)
animation.finished.connect(lambda: delattr(target, '_shakeing'))
target._shakeing = True
pos = target.pos()
x, y = pos.x(), pos.y()
animation.setDuration(100)
animation.setLoopCount(2)
animation.setKeyValueAt(0, QPoint(x, y))
animation.setKeyValueAt(0.09, QPoint(x + 1, y - 1))
animation.setKeyValueAt(0.18, QPoint(x + 2, y - 2))
animation.setKeyValueAt(0.27, QPoint(x + 1, y - 3))
animation.setKeyValueAt(0.36, QPoint(x + 0, y - 4))
animation.setKeyValueAt(0.45, QPoint(x - 1, y - 3))
animation.setKeyValueAt(0.54, QPoint(x - 2, y - 4))
animation.setKeyValueAt(0.63, QPoint(x - 3, y - 3))
animation.setKeyValueAt(0.72, QPoint(x - 4, y - 2))
animation.setKeyValueAt(0.81, QPoint(x - 3, y - 1))
animation.setKeyValueAt(0.90, QPoint(x - 2, y - 0))
animation.setKeyValueAt(0.99, QPoint(x - 1, y + 1))
animation.setEndValue(QPoint(x, y))
animation.start(animation.DeleteWhenStopped)


#############################################
def quitApp():
app = QApplication.instance()
for widget in app.topLevelWidgets():
if isinstance(widget, QMainWindow):
return widget.close()

def restartApp():
quitApp()
py = sys.executable
os.execl(py, py, *sys.argv)
83 changes: 38 additions & 45 deletions editor/main_window.py
Original file line number Diff line number Diff line change
@@ -1,62 +1,55 @@
from PySide6.QtCore import *
from PySide6.QtGui import *
from PySide6.QtWidgets import *
# from editor.tools.testkit import *
# from editor.widgets.menubar import *
# from editor.widgets.screenshot import *
# from editor.widgets.dropdown import *
# from editor.widgets.new_tree import *
from PySide6.QtWidgets import QMainWindow
from editor.widgets.menubar import createMenuBar
from editor.widgets.toolbar import *
from editor.widgets.statusbar import *
# from editor.widgets.color_picker import *
from editor.widgets.toolbar import createToolBar
from editor.widgets.statusbar import createMainStatusBar
from editor.view_manager import createDockManager, createDockView

import editor.views
import editor.views, extensions

class MainWindow(QMainWindow):
def __init__(self, parent = None):
super().__init__(parent)
self.setGeometry(1000, 300, 800, 600)
def __init__(self, parent = None):
super().__init__(parent)
self.setGeometry(1000, 300, 800, 600)

self.setMenuBar(createMenuBar(self))
self.addToolBar(createToolBar(self))
self.setStatusBar(createMainStatusBar(self))
self.setMenuBar(createMenuBar(self))
self.addToolBar(createToolBar(self))
self.setStatusBar(createMainStatusBar(self))

self.setupEditorViews()
self.setFocus()
self.setupEditorViews()
self.setFocus()


def closeEvent(self, evt):
for fw in self.dockManager.floatingWidgets(): fw.close()
super().closeEvent(evt)
def setupEditorViews(self):
dockManager = createDockManager(self)
self.dockManager = dockManager

def setupEditorViews(self):
dockManager = createDockManager(self)
self.dockManager = dockManager
dock1 = createDockView('Hierarchy')
dock1.addIntoEditor('right')

dock1 = createDockView('Hierarchy')
dock1.addIntoEditor('right')
dock2 = createDockView('Project')
dock2.addIntoEditor('center')

dock2 = createDockView('Project')
dock2.addIntoEditor('center')
dock3 = createDockView('Console')
dock3.addIntoEditor('right')

dock3 = createDockView('Inspector')
dock3.addIntoEditor('right')
dock4 = createDockView('Scene')
dock4.addIntoEditor('bottom')

dock4 = createDockView('Scene')
dock4.addIntoEditor('bottom')
# # rootarea = showEditorView('opengl', 'left')
# area1 = showEditorView('Imgui', 'left')
# area2 = showEditorView('Project', 'right')
# showEditorView('Inspector', 'bottom', area2)
# showEditorViewTabTo('Console', 'Inspector')
# showEditorViewTabTo('Hierarchy', 'Imgui')
# showEditorViewTabTo('FsmGraph', 'Imgui')

# # rootarea = showEditorView('opengl', 'left')
# area1 = showEditorView('Imgui', 'left')
# area2 = showEditorView('Project', 'right')
# showEditorView('Inspector', 'bottom', area2)
# showEditorViewTabTo('Console', 'Inspector')
# showEditorViewTabTo('Hierarchy', 'Imgui')
# showEditorViewTabTo('FsmGraph', 'Imgui')
# setDockSplitterSizes(area2, [600, 600])
# setDockSplitterSizes(area1, [600, 600])

# setDockSplitterSizes(area2, [600, 600])
# setDockSplitterSizes(area1, [600, 600])
# setDockFocused('Hierarchy')

# setDockFocused('Hierarchy')

def closeEvent(self, evt):
for fw in self.dockManager.floatingWidgets(): fw.close()
super().closeEvent(evt)
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
19 changes: 0 additions & 19 deletions editor/pipeline/asset/metadata.py

This file was deleted.

9 changes: 7 additions & 2 deletions editor/view_manager.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import os, json, platform, uuid
import xml.etree.ElementTree as ET
from PySide6.QtWidgets import QWidget
from PySide6.QtCore import Qt, QTimer, QSize
from PySide6.QtCore import Qt, QSize
from PySide6.QtGui import QAction
from editor.common.pyqtads import CDockManager, CDockWidget, DockWidgetArea
from editor.common.logger import warn, error
Expand Down Expand Up @@ -233,6 +232,12 @@ def loadLayout(name):
layoutTable[ view ] = [ data ]

for view in layoutTable:

if view not in _viewRegistry:
error(f'skip restoring view \'{view}\', which is not registered.')
for dock in findDockViewList(view): dock.closeDockWidget()
continue

lviews = layoutTable[view]
eviews = findDockViewList(view)
lviewsLen, eviewsLen = len(lviews), len(eviews)
Expand Down
1 change: 0 additions & 1 deletion editor/views/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import os, importlib


basepath = os.environ[ 'DEAR_BASE_PATH' ]
for f in os.scandir(basepath + '/editor/views'):
if f.is_file(): continue
Expand Down
4 changes: 0 additions & 4 deletions editor/views/scene/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@
from editor.view_manager import DockView, dockView

class OpenGLWidget(QOpenGLWidget):
def __init__(self, parent = None):
super().__init__(parent)
self.setWindowTitle("Triangle, PyQt5, OpenGL ES 2.0")
self.resize(300, 300)
def initializeGL(self):
gl.glClearColor(0.3, 0.3, 0.3, 1.0)
vertShaderSrc = '''
Expand Down
Loading

0 comments on commit 6a39e2d

Please sign in to comment.