from PySide2.QtGui import *
from PySide2.QtWidgets import *
from PySide2.QtCore import *
from PySide2.QtUiTools import *
import maya.cmds as cmds
import particles
reload(particles)
from sliders import *
# The base class for the actual tab panels.
class AbstractTabPanel(QWidget):
def __init__(self, panelName):
super(AbstractTabPanel, self).__init__(None)
self.name = panelName
vlayout = QVBoxLayout()
self.setLayout(vlayout)
self.addWidgetsPanel(vlayout)
vlayout.addStretch()
#-------------------------------------------------------------
def addWidgetsPanel(self, parentLayout):
raise NotImplementedError("addWidgetsPanel() must be implemented")
#-------------------------------------------------------------
def doAction(self, parentLayout):
raise NotImplementedError("doAction must be implemented")
#-------------------------------------------------------------
class DomeTabPanel(AbstractTabPanel):
def __init__(self, panelName):
super(DomeTabPanel, self).__init__(panelName)
# Note: the base class lays out the UI
#-------------------------------------------------------------
def addWidgetsPanel(self, parentLayout):
vlayout = QVBoxLayout()
self.numParticles = IntSlider("Num Particles", 100, 10000, 3000, parentLayout)
self.innerRadius = FloatSlider("Inner Radius", 0, 10, 7.4, parentLayout)
self.outerRadius = FloatSlider("Outer Radius", 0, 10, 7.5, parentLayout)
#-------------------------------------------------------------
def doAction(self):
return particles.Dome(self.numParticles.getValue(),
self.innerRadius.getValue(),
self.outerRadius.getValue())
#-------------------------------------------------------------
class ShellTabPanel(AbstractTabPanel):
def __init__(self, panelName):
super(ShellTabPanel, self).__init__(panelName)
# Note: the base class lays out the UI
#-------------------------------------------------------------
def addWidgetsPanel(self, parentLayout):
vlayout = QVBoxLayout()
self.numParticles = IntSlider("Num Particles", 100, 10000, 3000, parentLayout)
self.innerRadius = FloatSlider("Inner Radius", 0, 10, 7.4, parentLayout)
self.outerRadius = FloatSlider("Outer Radius", 0, 10, 7.5, parentLayout)
self.height = FloatSlider("Upper Cut Off", 0, 10, 10, parentLayout)
self.depth = FloatSlider("Lower Cut Off", -10, 0, -10, parentLayout)
#-------------------------------------------------------------
def doAction(self):
return particles.Shell(self.numParticles.getValue(),
self.innerRadius.getValue(),
self.outerRadius.getValue(),
self.height.getValue(),
self.depth.getValue())
#-------------------------------------------------------------
class WaveyTabPanel(AbstractTabPanel):
def __init__(self, panelName):
super(WaveyTabPanel, self).__init__(panelName)
# Note: the base class lays out the UI
#-------------------------------------------------------------
def addWidgetsPanel(self, parentLayout):
vlayout = QVBoxLayout()
self.numParticles = IntSlider("Num Particles", 100, 10000, 3000, parentLayout)
self.radius = FloatSlider("Radius", 0, 10, 8, parentLayout)
self.frequency = FloatSlider("Frequency", 0, 5, 2, parentLayout)
self.thickness = FloatSlider("Thickness", 0, 10, 1, parentLayout)
#-------------------------------------------------------------
def doAction(self):
return particles.Wavey(self.numParticles.getValue(),
self.radius.getValue(),
self.frequency.getValue(),
self.thickness.getValue())
#-------------------------------------------------------------
class TubeTabPanel(AbstractTabPanel):
def __init__(self, panelName):
super(TubeTabPanel, self).__init__(panelName)
# Note: the base class lays out the UI
#-------------------------------------------------------------
def addWidgetsPanel(self, parentLayout):
vlayout = QVBoxLayout()
self.numParticles = IntSlider("Num Particles", 100, 10000, 3000, parentLayout)
self.radius = FloatSlider("Radius", 0, 10, 8, parentLayout)
self.height = FloatSlider("Height", -10, 10, 5, parentLayout)
self.thickness = FloatSlider("Thickness", 0, 10, 1, parentLayout)
#-------------------------------------------------------------
def doAction(self):
return particles.Tubular(self.numParticles.getValue(),
self.radius.getValue(),
self.height.getValue(),
self.thickness.getValue())
#-------------------------------------------------------------