示例#1
0
 def editTranslation(self):
     temp = self.comboBox.currentIndex()
     self.TranslationEditor = AnimEditor()
     self.TranslationEditor.setAnimBlock(self.m2.uv_anim[temp].translation,
                                         self.m2.gSequ)
     self.TranslationEditor.show()
     self.connect(self.TranslationEditor,
                  QtCore.SIGNAL("AnimBlockEdited()"), self.setTranslation)
示例#2
0
 def editAttenuationEnd(self):
     temp = self.lightList.currentIndex()
     self.AttEndEditor = AnimEditor()
     self.AttEndEditor.setAnimBlock(self.m2.lights[temp].AttEnd,
                                    self.m2.gSequ)
     self.AttEndEditor.show()
     self.connect(self.AttEndEditor, QtCore.SIGNAL("AnimBlockEdited()"),
                  self.setAttenuationEnd)
示例#3
0
 def editDiffuseIntensity(self):
     temp = self.lightList.currentIndex()
     self.DiffIntEditor = AnimEditor()
     self.DiffIntEditor.setAnimBlock(self.m2.lights[temp].DiffuseInt,
                                     self.m2.gSequ)
     self.DiffIntEditor.show()
     self.connect(self.DiffIntEditor, QtCore.SIGNAL("AnimBlockEdited()"),
                  self.setDiffuseIntensity)
示例#4
0
 def editScaling(self):
     temp = self.comboBox.currentIndex()
     self.ScalingEditor = AnimEditor()
     self.ScalingEditor.setAnimBlock(self.m2.uv_anim[temp].scaling,
                                     self.m2.gSequ)
     self.ScalingEditor.show()
     self.connect(self.ScalingEditor, QtCore.SIGNAL("AnimBlockEdited()"),
                  self.setScaling)
示例#5
0
 def editAlpha(self):
     temp = self.colorList.currentIndex()
     self.AlphaEditor = AnimEditor()
     self.AlphaEditor.setAnimBlock(self.m2.colors[temp].alpha,
                                   self.m2.gSequ)
     self.AlphaEditor.show()
     self.connect(self.AlphaEditor, QtCore.SIGNAL("AnimBlockEdited()"),
                  self.setAlpha)
示例#6
0
 def editEnabled(self):
     temp = self.lightList.currentIndex()
     self.EnabledEditor = AnimEditor()
     self.EnabledEditor.setAnimBlock(self.m2.lights[temp].Enabled,
                                     self.m2.gSequ)
     self.EnabledEditor.show()
     self.connect(self.EnabledEditor, QtCore.SIGNAL("AnimBlockEdited()"),
                  self.setEnabled)
示例#7
0
 def editTransparency(self):
     transparency = self.comboBox.currentIndex()
     self.TransparencyEditor = AnimEditor()
     self.TransparencyEditor.setAnimBlock(
         self.m2.transparency[transparency].alpha, self.m2.gSequ)
     self.TransparencyEditor.show()
     self.connect(self.TransparencyEditor,
                  QtCore.SIGNAL("AnimBlockEdited()"), self.setTransparency)
示例#8
0
 def editEmissionRate(self):
     temp = self.chooseBox.currentIndex()
     self.eRateEditor = AnimEditor()
     self.eRateEditor.setAnimBlock(
         self.m2.particle_emitters[temp].emission_rate, self.m2.gSequ)
     self.eRateEditor.show()
     self.connect(self.eRateEditor, QtCore.SIGNAL("AnimBlockEdited()"),
                  self.setEmissionRate)
示例#9
0
 def editAmbientColor(self):
     temp = self.lightList.currentIndex()
     self.AmbColEditor = AnimEditor()
     self.AmbColEditor.setAnimBlock(self.m2.lights[temp].AmbientCol,
                                    self.m2.gSequ)
     self.AmbColEditor.show()
     self.connect(self.AmbColEditor, QtCore.SIGNAL("AnimBlockEdited()"),
                  self.setAmbientColor)
示例#10
0
 def editAreaWidth(self):
     temp = self.chooseBox.currentIndex()
     self.eAreaWidthEditor = AnimEditor()
     self.eAreaWidthEditor.setAnimBlock(
         self.m2.particle_emitters[temp].emission_area_width, self.m2.gSequ)
     self.eAreaWidthEditor.show()
     self.connect(self.eAreaWidthEditor, QtCore.SIGNAL("AnimBlockEdited()"),
                  self.setAreaWidth)
示例#11
0
 def editHorizontalRange(self):
     temp = self.chooseBox.currentIndex()
     self.HorRangeEditor = AnimEditor()
     self.HorRangeEditor.setAnimBlock(
         self.m2.particle_emitters[temp].hor_range, self.m2.gSequ)
     self.HorRangeEditor.show()
     self.connect(self.HorRangeEditor, QtCore.SIGNAL("AnimBlockEdited()"),
                  self.setHorizontalRange)
示例#12
0
 def editLifespan(self):
     temp = self.chooseBox.currentIndex()
     self.lifespanEditor = AnimEditor()
     self.lifespanEditor.setAnimBlock(
         self.m2.particle_emitters[temp].lifespan, self.m2.gSequ)
     self.lifespanEditor.show()
     self.connect(self.lifespanEditor, QtCore.SIGNAL("AnimBlockEdited()"),
                  self.setLifespan)
示例#13
0
 def editSpeedVariation(self):
     temp = self.chooseBox.currentIndex()
     self.eSpeedVarEditor = AnimEditor()
     self.eSpeedVarEditor.setAnimBlock(
         self.m2.particle_emitters[temp].speed_var, self.m2.gSequ)
     self.eSpeedVarEditor.show()
     self.connect(self.eSpeedVarEditor, QtCore.SIGNAL("AnimBlockEdited()"),
                  self.setSpeedVariation)
示例#14
0
 def editStrongGravity(self):
     temp = self.chooseBox.currentIndex()
     self.strongGravEditor = AnimEditor()
     self.strongGravEditor.setAnimBlock(
         self.m2.particle_emitters[temp].gravity2, self.m2.gSequ)
     self.strongGravEditor.show()
     self.connect(self.strongGravEditor, QtCore.SIGNAL("AnimBlockEdited()"),
                  self.setStrongGravity)
示例#15
0
	def editEnabled(self):		
		temp = self.comboBox.currentIndex()
		self.EnabledEditor = AnimEditor()
		self.EnabledEditor.setAnimBlock(self.m2.attachments[temp].Enabled,self.m2.gSequ)
		self.EnabledEditor.show()
		self.connect(self.EnabledEditor,QtCore.SIGNAL("AnimBlockEdited()"),self.setEnabled)
示例#16
0
class ColorEditor(QtGui.QDialog):
    def __init__(self):
        QtGui.QDialog.__init__(self)
        self.setupUi(self)
        self.last = -1

    def setupUi(self, Dialog):
        Dialog.setObjectName("Dialog")
        Dialog.resize(450, 150)

        self.buttonBox = QtGui.QDialogButtonBox(Dialog)
        self.buttonBox.setGeometry(QtCore.QRect(90, 110, 341, 32))
        self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
        self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel
                                          | QtGui.QDialogButtonBox.Ok)
        self.buttonBox.setObjectName("buttonBox")

        self.colorList = QtGui.QComboBox(Dialog)
        self.colorList.setGeometry(QtCore.QRect(10, 10, 69, 22))
        self.colorList.setObjectName("colorList")
        self.connect(self.colorList, QtCore.SIGNAL("currentIndexChanged(int)"),
                     self.changeEdit)

        self.line = QtGui.QFrame(Dialog)
        self.line.setGeometry(QtCore.QRect(10, 40, 211, 16))
        self.line.setFrameShape(QtGui.QFrame.HLine)
        self.line.setFrameShadow(QtGui.QFrame.Sunken)
        self.line.setObjectName("line")

        self.addIcon = QtGui.QIcon("Icons/edit-add.png")
        self.addButton = QtGui.QPushButton(self.addIcon, "Add", Dialog)
        self.addButton.setGeometry(QtCore.QRect(100, 10, 75, 23))
        self.addButton.setObjectName("addButton")
        self.connect(self.addButton, QtCore.SIGNAL("clicked()"), self.addColor)

        self.colorButton = QtGui.QPushButton(Dialog)
        self.colorButton.setGeometry(QtCore.QRect(150, 60, 75, 23))
        self.colorButton.setObjectName("colorButton")
        self.connect(self.colorButton, QtCore.SIGNAL("clicked()"),
                     self.editColor)

        self.alphaButton = QtGui.QPushButton(Dialog)
        self.alphaButton.setGeometry(QtCore.QRect(240, 60, 75, 23))
        self.alphaButton.setObjectName("alphaButton")
        self.connect(self.alphaButton, QtCore.SIGNAL("clicked()"),
                     self.editAlpha)

        self.retranslateUi(Dialog)
        QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("accepted()"),
                               Dialog.accept)
        QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("rejected()"),
                               Dialog.reject)
        QtCore.QMetaObject.connectSlotsByName(Dialog)

    def retranslateUi(self, Dialog):
        Dialog.setWindowTitle(
            QtGui.QApplication.translate("Dialog", "Color Editor", None,
                                         QtGui.QApplication.UnicodeUTF8))
        self.addButton.setText(
            QtGui.QApplication.translate("Dialog", "Add", None,
                                         QtGui.QApplication.UnicodeUTF8))
        self.colorButton.setText(
            QtGui.QApplication.translate("Dialog", "Edit Color", None,
                                         QtGui.QApplication.UnicodeUTF8))
        self.alphaButton.setText(
            QtGui.QApplication.translate("Dialog", "Edit Alpha", None,
                                         QtGui.QApplication.UnicodeUTF8))

    def editColor(self):
        temp = self.colorList.currentIndex()
        self.ColEditor = AnimColorEditor()
        self.ColEditor.setAnimBlock(self.m2.colors[temp].color, self.m2.gSequ)
        self.ColEditor.show()
        self.connect(self.ColEditor, QtCore.SIGNAL("AnimBlockEdited()"),
                     self.setColor)

    def setColor(self):
        self.m2.colors[self.colorList.currentIndex(
        )].color = self.ColEditor.getAnimBlock()

    def editAlpha(self):
        temp = self.colorList.currentIndex()
        self.AlphaEditor = AnimEditor()
        self.AlphaEditor.setAnimBlock(self.m2.colors[temp].alpha,
                                      self.m2.gSequ)
        self.AlphaEditor.show()
        self.connect(self.AlphaEditor, QtCore.SIGNAL("AnimBlockEdited()"),
                     self.setAlpha)

    def setAlpha(self):
        self.m2.colors[self.colorList.currentIndex(
        )].alpha = self.AlphaEditor.getAnimBlock()

    def finalizeMe(self):
        self.saveOld()
        self.accept()

    def setCurrentEditing(self, i):
        self.colorList.setCurrentIndex(i)
        self.changeEdit()

    def setModel(self, m2, skin):
        self.m2 = m2
        self.skin = skin
        for i in range(len(self.m2.colors)):
            self.colorList.addItem(str(i))
        self.changeEdit()

    def addColor(self):
        l = m2.Color()
        l.color.type = m2.DATA_VEC3
        l.alpha.type = m2.DATA_FLOAT

        self.m2.colors.append(l)

        self.colorList.addItem(str(self.m2.hdr.colors.count))
        self.m2.hdr.colors.count += 1

    def saveOld(self):
        if (self.last == -1):
            return

    def changeEdit(self):
        self.saveOld()
        self.last = self.colorList.currentIndex()
示例#17
0
	def editRotation(self):		
		temp = self.comboBox.currentIndex()
		self.RotationEditor = AnimEditor()
		self.RotationEditor.setAnimBlock(self.m2.bones[temp].rotation,self.m2.gSequ)
		self.RotationEditor.show()
		self.connect(self.RotationEditor,QtCore.SIGNAL("AnimBlockEdited()"),self.setRotation)
示例#18
0
 def editTransparency(self):
     transparency = self.comboBox.currentIndex()
     self.TransparencyEditor = AnimEditor()
     self.TransparencyEditor.setAnimBlock(self.m2.transparency[transparency].alpha, self.m2.gSequ)
     self.TransparencyEditor.show()
     self.connect(self.TransparencyEditor, QtCore.SIGNAL("AnimBlockEdited()"), self.setTransparency)
示例#19
0
	def editAreaWidth(self):		
		temp = self.chooseBox.currentIndex()
		self.eAreaWidthEditor = AnimEditor()
		self.eAreaWidthEditor.setAnimBlock(self.m2.particle_emitters[temp].emission_area_width,self.m2.gSequ)
		self.eAreaWidthEditor.show()
		self.connect(self.eAreaWidthEditor,QtCore.SIGNAL("AnimBlockEdited()"),self.setAreaWidth)
示例#20
0
	def editAlpha(self):		
		temp = self.colorList.currentIndex()
		self.AlphaEditor = AnimEditor()
		self.AlphaEditor.setAnimBlock(self.m2.colors[temp].alpha,self.m2.gSequ)
		self.AlphaEditor.show()
		self.connect(self.AlphaEditor,QtCore.SIGNAL("AnimBlockEdited()"),self.setAlpha)
示例#21
0
class ColorEditor(QtGui.QDialog):
	def __init__(self): 
		QtGui.QDialog.__init__(self) 
		self.setupUi(self)
		self.last = -1
		
	def setupUi(self, Dialog):
		Dialog.setObjectName("Dialog")
		Dialog.resize(450, 150)
		
		self.buttonBox = QtGui.QDialogButtonBox(Dialog)
		self.buttonBox.setGeometry(QtCore.QRect(90, 110, 341, 32))
		self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
		self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok)
		self.buttonBox.setObjectName("buttonBox")
		
		self.colorList = QtGui.QComboBox(Dialog)
		self.colorList.setGeometry(QtCore.QRect(10, 10, 69, 22))
		self.colorList.setObjectName("colorList")
		self.connect(self.colorList, QtCore.SIGNAL("currentIndexChanged(int)"), self.changeEdit) 
		
		self.line = QtGui.QFrame(Dialog)
		self.line.setGeometry(QtCore.QRect(10, 40, 211, 16))
		self.line.setFrameShape(QtGui.QFrame.HLine)
		self.line.setFrameShadow(QtGui.QFrame.Sunken)
		self.line.setObjectName("line")
		
		self.addIcon = QtGui.QIcon("Icons/edit-add.png")
		self.addButton = QtGui.QPushButton(self.addIcon,"Add",Dialog)
		self.addButton.setGeometry(QtCore.QRect(100, 10, 75, 23))
		self.addButton.setObjectName("addButton")
		self.connect(self.addButton, QtCore.SIGNAL("clicked()"), self.addColor)
		
		self.colorButton = QtGui.QPushButton(Dialog)
		self.colorButton.setGeometry(QtCore.QRect(150, 60, 75, 23))
		self.colorButton.setObjectName("colorButton")
		self.connect(self.colorButton, QtCore.SIGNAL("clicked()"), self.editColor)
		
		self.alphaButton = QtGui.QPushButton(Dialog)
		self.alphaButton.setGeometry(QtCore.QRect(240, 60, 75, 23))
		self.alphaButton.setObjectName("alphaButton")
		self.connect(self.alphaButton, QtCore.SIGNAL("clicked()"), self.editAlpha)

		self.retranslateUi(Dialog)
		QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("accepted()"), Dialog.accept)
		QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("rejected()"), Dialog.reject)
		QtCore.QMetaObject.connectSlotsByName(Dialog)

	def retranslateUi(self, Dialog):
		Dialog.setWindowTitle(QtGui.QApplication.translate("Dialog", "Color Editor", None, QtGui.QApplication.UnicodeUTF8))
		self.addButton.setText(QtGui.QApplication.translate("Dialog", "Add", None, QtGui.QApplication.UnicodeUTF8))
		self.colorButton.setText(QtGui.QApplication.translate("Dialog", "Edit Color", None, QtGui.QApplication.UnicodeUTF8))
		self.alphaButton.setText(QtGui.QApplication.translate("Dialog", "Edit Alpha", None, QtGui.QApplication.UnicodeUTF8))
		


	def editColor(self):		
		temp = self.colorList.currentIndex()
		self.ColEditor = AnimColorEditor()
		self.ColEditor.setAnimBlock(self.m2.colors[temp].color,self.m2.gSequ)
		self.ColEditor.show()
		self.connect(self.ColEditor,QtCore.SIGNAL("AnimBlockEdited()"),self.setColor)

	def setColor(self):
		self.m2.colors[self.colorList.currentIndex()].color = self.ColEditor.getAnimBlock()

	def editAlpha(self):		
		temp = self.colorList.currentIndex()
		self.AlphaEditor = AnimEditor()
		self.AlphaEditor.setAnimBlock(self.m2.colors[temp].alpha,self.m2.gSequ)
		self.AlphaEditor.show()
		self.connect(self.AlphaEditor,QtCore.SIGNAL("AnimBlockEdited()"),self.setAlpha)

	def setAlpha(self):
		self.m2.colors[self.colorList.currentIndex()].alpha = self.AlphaEditor.getAnimBlock()


	def finalizeMe(self):
		self.saveOld()
		self.accept()

	def setCurrentEditing(self,i):
		self.colorList.setCurrentIndex(i)
		self.changeEdit()

	def setModel(self,m2,skin):
		self.m2 = m2
		self.skin = skin
		for i in range(len(self.m2.colors)):
			self.colorList.addItem(str(i))
		self.changeEdit()
		
		
	def addColor(self):
		l = m2.Color()
		l.color.type = m2.DATA_VEC3
		l.alpha.type = m2.DATA_FLOAT

		self.m2.colors.append(l)
		
		self.colorList.addItem(str(self.m2.hdr.colors.count))
		self.m2.hdr.colors.count += 1

	def saveOld(self):
		if (self.last == -1):
			return		
			
			
	def changeEdit(self):
		self.saveOld()
		self.last = self.colorList.currentIndex()
示例#22
0
	def editLifespan(self):		
		temp = self.chooseBox.currentIndex()
		self.lifespanEditor = AnimEditor()
		self.lifespanEditor.setAnimBlock(self.m2.particle_emitters[temp].lifespan,self.m2.gSequ)
		self.lifespanEditor.show()
		self.connect(self.lifespanEditor,QtCore.SIGNAL("AnimBlockEdited()"),self.setLifespan)
示例#23
0
	def editEmissionRate(self):		
		temp = self.chooseBox.currentIndex()
		self.eRateEditor = AnimEditor()
		self.eRateEditor.setAnimBlock(self.m2.particle_emitters[temp].emission_rate,self.m2.gSequ)
		self.eRateEditor.show()
		self.connect(self.eRateEditor,QtCore.SIGNAL("AnimBlockEdited()"),self.setEmissionRate)
示例#24
0
class ParticleEditor(QtGui.QDialog):
    def __init__(self):
        QtGui.QDialog.__init__(self)
        self.setupUi(self)
        self.last = -1

    def setupUi(self, Dialog):
        Dialog.setObjectName("Dialog")
        Dialog.resize(644, 590)

        self.buttonBox = QtGui.QDialogButtonBox(Dialog)
        self.buttonBox.setGeometry(QtCore.QRect(280, 540, 341, 32))
        self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
        self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel
                                          | QtGui.QDialogButtonBox.Ok)
        self.buttonBox.setObjectName("buttonBox")

        self.chooseBox = QtGui.QComboBox(Dialog)
        self.chooseBox.setGeometry(QtCore.QRect(20, 20, 85, 27))
        self.chooseBox.setObjectName("chooseBox")
        self.connect(self.chooseBox, QtCore.SIGNAL("currentIndexChanged(int)"),
                     self.changeEdit)

        self.addIcon = QtGui.QIcon("Icons/edit-add.png")
        self.addButton = QtGui.QPushButton(self.addIcon, "Add", Dialog)
        self.addButton.setGeometry(QtCore.QRect(110, 20, 92, 28))
        self.addButton.setObjectName("addButton")
        self.connect(self.addButton, QtCore.SIGNAL("clicked()"),
                     self.addParticle)

        self.line = QtGui.QFrame(Dialog)
        self.line.setGeometry(QtCore.QRect(20, 60, 241, 16))
        self.line.setFrameShape(QtGui.QFrame.HLine)
        self.line.setFrameShadow(QtGui.QFrame.Sunken)
        self.line.setObjectName("line")

        self.modelEdit = QtGui.QLineEdit(Dialog)
        self.modelEdit.setGeometry(QtCore.QRect(10, 100, 113, 26))
        self.modelEdit.setObjectName("modelEdit")

        self.particleEdit = QtGui.QLineEdit(Dialog)
        self.particleEdit.setGeometry(QtCore.QRect(10, 160, 113, 26))
        self.particleEdit.setObjectName("particleEdit")

        self.eSpeedButton = QtGui.QPushButton(Dialog)
        self.eSpeedButton.setGeometry(QtCore.QRect(231, 90, 111, 28))
        self.eSpeedButton.setObjectName("eSpeedButton")
        self.connect(self.eSpeedButton, QtCore.SIGNAL("clicked()"),
                     self.editEmissionSpeed)

        self.speedVarButton = QtGui.QPushButton(Dialog)
        self.speedVarButton.setGeometry(QtCore.QRect(350, 90, 121, 28))
        self.speedVarButton.setObjectName("speedVarButton")
        self.connect(self.speedVarButton, QtCore.SIGNAL("clicked()"),
                     self.editSpeedVariation)

        self.vertRangeButton = QtGui.QPushButton(Dialog)
        self.vertRangeButton.setGeometry(QtCore.QRect(231, 120, 111, 28))
        self.vertRangeButton.setObjectName("vertRangeButton")
        self.connect(self.vertRangeButton, QtCore.SIGNAL("clicked()"),
                     self.editVerticalRange)

        self.horRangeButton = QtGui.QPushButton(Dialog)
        self.horRangeButton.setGeometry(QtCore.QRect(350, 120, 121, 28))
        self.horRangeButton.setObjectName("horRangeButton")
        self.connect(self.horRangeButton, QtCore.SIGNAL("clicked()"),
                     self.editEmissionSpeed)

        self.gravButton = QtGui.QPushButton(Dialog)
        self.gravButton.setGeometry(QtCore.QRect(231, 150, 111, 28))
        self.gravButton.setObjectName("gravButton")
        self.connect(self.gravButton, QtCore.SIGNAL("clicked()"),
                     self.editGravity)

        self.lifeButton = QtGui.QPushButton(Dialog)
        self.lifeButton.setGeometry(QtCore.QRect(350, 150, 121, 28))
        self.lifeButton.setObjectName("lifeButton")
        self.connect(self.lifeButton, QtCore.SIGNAL("clicked()"),
                     self.editLifespan)

        self.eRateButton = QtGui.QPushButton(Dialog)
        self.eRateButton.setGeometry(QtCore.QRect(231, 180, 111, 28))
        self.eRateButton.setObjectName("eRateButton")
        self.connect(self.eRateButton, QtCore.SIGNAL("clicked()"),
                     self.editEmissionRate)

        self.grav2Button = QtGui.QPushButton(Dialog)
        self.grav2Button.setGeometry(QtCore.QRect(350, 180, 121, 28))
        self.grav2Button.setObjectName("grav2Button")
        self.connect(self.grav2Button, QtCore.SIGNAL("clicked()"),
                     self.editStrongGravity)

        self.eLengthButton = QtGui.QPushButton(Dialog)
        self.eLengthButton.setGeometry(QtCore.QRect(231, 210, 111, 28))
        self.eLengthButton.setObjectName("eLengthButton")
        self.connect(self.eLengthButton, QtCore.SIGNAL("clicked()"),
                     self.editAreaLength)

        self.eWidthButton = QtGui.QPushButton(Dialog)
        self.eWidthButton.setGeometry(QtCore.QRect(350, 210, 121, 28))
        self.eWidthButton.setObjectName("eWidthButton")
        self.connect(self.eWidthButton, QtCore.SIGNAL("clicked()"),
                     self.editAreaWidth)

        self.fColorButton = QtGui.QPushButton(Dialog)
        self.fColorButton.setGeometry(QtCore.QRect(230, 290, 92, 28))
        self.fColorButton.setObjectName("fColorButton")

        self.fOpacityButton = QtGui.QPushButton(Dialog)
        self.fOpacityButton.setGeometry(QtCore.QRect(330, 290, 92, 28))
        self.fOpacityButton.setObjectName("fOpacityButton")

        self.fIntensityButton = QtGui.QPushButton(Dialog)
        self.fIntensityButton.setGeometry(QtCore.QRect(230, 320, 92, 28))
        self.fIntensityButton.setObjectName("fIntensityButton")

        self.fUnkButton = QtGui.QPushButton(Dialog)
        self.fUnkButton.setGeometry(QtCore.QRect(330, 320, 92, 28))
        self.fUnkButton.setObjectName("fUnkButton")

        self.fSizeButton = QtGui.QPushButton(Dialog)
        self.fSizeButton.setGeometry(QtCore.QRect(430, 290, 92, 28))
        self.fSizeButton.setObjectName("fSizeButton")

        self.textureBox = QtGui.QComboBox(Dialog)
        self.textureBox.setGeometry(QtCore.QRect(10, 200, 85, 27))
        self.textureBox.setObjectName("textureBox")

        self.xEdit = QtGui.QLineEdit(Dialog)
        self.xEdit.setGeometry(QtCore.QRect(10, 260, 31, 26))
        self.xEdit.setObjectName("xEdit")

        self.yEdit = QtGui.QLineEdit(Dialog)
        self.yEdit.setGeometry(QtCore.QRect(50, 260, 31, 26))
        self.yEdit.setObjectName("yEdit")

        self.zEdit = QtGui.QLineEdit(Dialog)
        self.zEdit.setGeometry(QtCore.QRect(90, 260, 31, 26))
        self.zEdit.setObjectName("zEdit")

        self.boneBox = QtGui.QComboBox(Dialog)
        self.boneBox.setGeometry(QtCore.QRect(120, 200, 85, 27))
        self.boneBox.setObjectName("boneBox")

        self.typeBox = QtGui.QComboBox(Dialog)
        self.typeBox.setGeometry(QtCore.QRect(130, 260, 85, 27))
        self.typeBox.setObjectName("typeBox")
        self.typeBox.addItem("")
        self.typeBox.addItem("")
        self.typeBox.addItem("")

        self.htBox = QtGui.QComboBox(Dialog)
        self.htBox.setGeometry(QtCore.QRect(10, 300, 85, 27))
        self.htBox.setObjectName("htBox")
        self.htBox.addItem("")
        self.htBox.addItem("")
        self.htBox.addItem("")

        self.particleColorBox = QtGui.QComboBox(Dialog)
        self.particleColorBox.setGeometry(QtCore.QRect(110, 300, 85, 27))
        self.particleColorBox.setObjectName("particleColorBox")
        self.particleColorBox.addItem("")
        self.particleColorBox.addItem("")
        self.particleColorBox.addItem("")
        self.particleColorBox.addItem("")

        self.mFileLabel = QtGui.QLabel(Dialog)
        self.mFileLabel.setGeometry(QtCore.QRect(10, 80, 111, 18))
        self.mFileLabel.setObjectName("mFileLabel")

        self.pFileLabel = QtGui.QLabel(Dialog)
        self.pFileLabel.setGeometry(QtCore.QRect(10, 140, 131, 18))
        self.pFileLabel.setObjectName("pFileLabel")

        self.posLabel = QtGui.QLabel(Dialog)
        self.posLabel.setGeometry(QtCore.QRect(10, 240, 81, 18))
        self.posLabel.setObjectName("posLabel")

        self.retranslateUi(Dialog)
        QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("accepted()"),
                               Dialog.accept)
        QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("rejected()"),
                               Dialog.reject)
        QtCore.QMetaObject.connectSlotsByName(Dialog)

    def retranslateUi(self, Dialog):
        Dialog.setWindowTitle(
            QtGui.QApplication.translate("Dialog", "Dialog", None,
                                         QtGui.QApplication.UnicodeUTF8))
        self.addButton.setText(
            QtGui.QApplication.translate("Dialog", "Add", None,
                                         QtGui.QApplication.UnicodeUTF8))
        self.eSpeedButton.setText(
            QtGui.QApplication.translate("Dialog", "EmissionSpeed", None,
                                         QtGui.QApplication.UnicodeUTF8))
        self.speedVarButton.setText(
            QtGui.QApplication.translate("Dialog", "SpeedVariation", None,
                                         QtGui.QApplication.UnicodeUTF8))
        self.vertRangeButton.setText(
            QtGui.QApplication.translate("Dialog", "Vertical Range", None,
                                         QtGui.QApplication.UnicodeUTF8))
        self.horRangeButton.setText(
            QtGui.QApplication.translate("Dialog", "Horizontal Range", None,
                                         QtGui.QApplication.UnicodeUTF8))
        self.gravButton.setText(
            QtGui.QApplication.translate("Dialog", "Gravity", None,
                                         QtGui.QApplication.UnicodeUTF8))
        self.lifeButton.setText(
            QtGui.QApplication.translate("Dialog", "Lifespan", None,
                                         QtGui.QApplication.UnicodeUTF8))
        self.eRateButton.setText(
            QtGui.QApplication.translate("Dialog", "EmissionRate", None,
                                         QtGui.QApplication.UnicodeUTF8))
        self.grav2Button.setText(
            QtGui.QApplication.translate("Dialog", "Strong Gravity", None,
                                         QtGui.QApplication.UnicodeUTF8))
        self.eLengthButton.setText(
            QtGui.QApplication.translate("Dialog", "Area Length", None,
                                         QtGui.QApplication.UnicodeUTF8))
        self.eWidthButton.setText(
            QtGui.QApplication.translate("Dialog", "Area Width", None,
                                         QtGui.QApplication.UnicodeUTF8))
        self.fColorButton.setText(
            QtGui.QApplication.translate("Dialog", "Color", None,
                                         QtGui.QApplication.UnicodeUTF8))
        self.fOpacityButton.setText(
            QtGui.QApplication.translate("Dialog", "Opacity", None,
                                         QtGui.QApplication.UnicodeUTF8))
        self.fIntensityButton.setText(
            QtGui.QApplication.translate("Dialog", "Intensity", None,
                                         QtGui.QApplication.UnicodeUTF8))
        self.fUnkButton.setText(
            QtGui.QApplication.translate("Dialog", "Unknown", None,
                                         QtGui.QApplication.UnicodeUTF8))
        self.fSizeButton.setText(
            QtGui.QApplication.translate("Dialog", "Size", None,
                                         QtGui.QApplication.UnicodeUTF8))
        self.typeBox.setItemText(
            0,
            QtGui.QApplication.translate("Dialog", "Plane", None,
                                         QtGui.QApplication.UnicodeUTF8))
        self.typeBox.setItemText(
            1,
            QtGui.QApplication.translate("Dialog", "Sphere", None,
                                         QtGui.QApplication.UnicodeUTF8))
        self.typeBox.setItemText(
            2,
            QtGui.QApplication.translate("Dialog", "Spline (exists?)", None,
                                         QtGui.QApplication.UnicodeUTF8))
        self.htBox.setItemText(
            0,
            QtGui.QApplication.translate("Dialog", "Head", None,
                                         QtGui.QApplication.UnicodeUTF8))
        self.htBox.setItemText(
            1,
            QtGui.QApplication.translate("Dialog", "Tail", None,
                                         QtGui.QApplication.UnicodeUTF8))
        self.htBox.setItemText(
            2,
            QtGui.QApplication.translate("Dialog", "Both", None,
                                         QtGui.QApplication.UnicodeUTF8))
        self.particleColorBox.setItemText(
            0,
            QtGui.QApplication.translate("Dialog", "None", None,
                                         QtGui.QApplication.UnicodeUTF8))
        self.particleColorBox.setItemText(
            1,
            QtGui.QApplication.translate("Dialog", "One (11)", None,
                                         QtGui.QApplication.UnicodeUTF8))
        self.particleColorBox.setItemText(
            2,
            QtGui.QApplication.translate("Dialog", "Two (12)", None,
                                         QtGui.QApplication.UnicodeUTF8))
        self.particleColorBox.setItemText(
            3,
            QtGui.QApplication.translate("Dialog", "Three (13)", None,
                                         QtGui.QApplication.UnicodeUTF8))
        self.mFileLabel.setText(
            QtGui.QApplication.translate("Dialog", "ModelFileName:", None,
                                         QtGui.QApplication.UnicodeUTF8))
        self.pFileLabel.setText(
            QtGui.QApplication.translate("Dialog", "ParticleFileName:", None,
                                         QtGui.QApplication.UnicodeUTF8))
        self.posLabel.setText(
            QtGui.QApplication.translate("Dialog", "Position:", None,
                                         QtGui.QApplication.UnicodeUTF8))

    def finalizeMe(self):
        self.saveOld()
        self.accept()

    def setCurrentEditing(self, i):
        self.chooseBox.setCurrentIndex(i)
        self.changeEdit()

    def setModel(self, m2, skin):
        self.m2 = m2
        self.skin = skin
        for i in range(len(self.m2.particle_emitters)):
            self.chooseBox.addItem(str(i))

        for i in range(len(self.m2.textures)):
            self.textureBox.addItem(
                str(i) + ": " + TextureTypes[self.m2.textures[i].type] + " " +
                str(self.m2.textures[i].name))

        for i in range(len(self.m2.bones) + 1):
            if i == 0:
                self.boneBox.addItem("None " + str(i - 1))
            else:
                self.boneBox.addItem("Bone: " + str(i - 1) + " " +
                                     KeyBoneTypes[self.m2.bones[i -
                                                                1].KeyBoneId])

        self.last = -1
        self.changeEdit()

    def addParticle(self, parbone=0):
        l = m2.Particle()
        l.bone = parbone
        l.emission_speed.type = m2.DATA_FLOAT
        l.speed_var.type = m2.DATA_FLOAT
        l.vert_range.type = m2.DATA_FLOAT
        l.hor_range.type = m2.DATA_FLOAT
        l.gravity.type = m2.DATA_FLOAT
        l.lifespan.type = m2.DATA_FLOAT
        l.emission_rate.type = m2.DATA_FLOAT
        l.emission_area_len.type = m2.DATA_FLOAT
        l.emission_area_width.type = m2.DATA_FLOAT
        l.gravity2.type = m2.DATA_FLOAT

        self.m2.particle_emitters.append(l)

        self.chooseBox.addItem(str(self.m2.hdr.particle_emitters.count))
        self.m2.hdr.particle_emitters.count += 1
        if (self.last == -1):
            changeEdit()

    def saveOld(self):
        if (self.last == -1):
            return

        p = self.m2.particle_emitters[self.last]
        p.Pos.x = float(self.xEdit.text())
        p.Pos.y = float(self.yEdit.text())
        p.Pos.z = float(self.zEdit.text())

        name = str(self.modelEdit.text())
        p.ModelName = makeZeroTerminated(name)
        p.lenModel = len(p.ModelName)

        name = str(self.particleEdit.text())
        p.ParticleName = makeZeroTerminated(name)
        p.lenParticle = len(p.ParticleName)

        p.bone = self.boneBox.currentIndex() - 1
        p.texture = self.textureBox.currentIndex()
        cdbc = self.particleColorBox.currentIndex()
        p.color_dbc = cdbc if (cdbc == 0) else cdbc + 10
        p.head_or_tail = self.htBox.currentIndex()
        p.particletype = self.typeBox.currentIndex()

        self.m2.particle_emitters[self.last] = p

    def changeEdit(self):
        self.saveOld()
        if (self.chooseBox.count() == 0):
            return
        self.last = self.chooseBox.currentIndex()
        p = self.m2.particle_emitters[self.last]
        self.boneBox.setCurrentIndex(p.bone + 1)
        self.textureBox.setCurrentIndex(p.texture)
        self.particleColorBox.setCurrentIndex(p.color_dbc - 10 if (
            p.color_dbc in (11, 12, 13)) else 0)
        self.htBox.setCurrentIndex(p.head_or_tail)
        self.typeBox.setCurrentIndex(p.particletype)

        self.xEdit.setText(str(p.Pos.x))
        self.yEdit.setText(str(p.Pos.y))
        self.zEdit.setText(str(p.Pos.z))

        self.modelEdit.setText(p.ModelName)
        self.particleEdit.setText(p.ParticleName)

    def editEmissionSpeed(self):
        temp = self.chooseBox.currentIndex()
        self.eSpeedEditor = AnimEditor()
        self.eSpeedEditor.setAnimBlock(
            self.m2.particle_emitters[temp].emission_speed, self.m2.gSequ)
        self.eSpeedEditor.show()
        self.connect(self.eSpeedEditor, QtCore.SIGNAL("AnimBlockEdited()"),
                     self.setEmissionSpeed)

    def setEmissionSpeed(self):
        self.m2.particle_emitters[self.chooseBox.currentIndex(
        )].emission_speed = self.eSpeedEditor.getAnimBlock()

    def editSpeedVariation(self):
        temp = self.chooseBox.currentIndex()
        self.eSpeedVarEditor = AnimEditor()
        self.eSpeedVarEditor.setAnimBlock(
            self.m2.particle_emitters[temp].speed_var, self.m2.gSequ)
        self.eSpeedVarEditor.show()
        self.connect(self.eSpeedVarEditor, QtCore.SIGNAL("AnimBlockEdited()"),
                     self.setSpeedVariation)

    def setSpeedVariation(self):
        self.m2.particle_emitters[self.chooseBox.currentIndex(
        )].speed_var = self.eSpeedVarEditor.getAnimBlock()

    def editVerticalRange(self):
        temp = self.chooseBox.currentIndex()
        self.VertRangeEditor = AnimEditor()
        self.VertRangeEditor.setAnimBlock(
            self.m2.particle_emitters[temp].vert_range, self.m2.gSequ)
        self.VertRangeEditor.show()
        self.connect(self.VertRangeEditor, QtCore.SIGNAL("AnimBlockEdited()"),
                     self.setVerticalRange)

    def setVerticalRange(self):
        self.m2.particle_emitters[self.chooseBox.currentIndex(
        )].vert_range = self.VertRangeEditor.getAnimBlock()

    def editHorizontalRange(self):
        temp = self.chooseBox.currentIndex()
        self.HorRangeEditor = AnimEditor()
        self.HorRangeEditor.setAnimBlock(
            self.m2.particle_emitters[temp].hor_range, self.m2.gSequ)
        self.HorRangeEditor.show()
        self.connect(self.HorRangeEditor, QtCore.SIGNAL("AnimBlockEdited()"),
                     self.setHorizontalRange)

    def setHorizontalRange(self):
        self.m2.particle_emitters[self.chooseBox.currentIndex(
        )].hor_range = self.HorRangeEditor.getAnimBlock()

    def editGravity(self):
        temp = self.chooseBox.currentIndex()
        self.GravEditor = AnimEditor()
        self.GravEditor.setAnimBlock(self.m2.particle_emitters[temp].gravity,
                                     self.m2.gSequ)
        self.GravEditor.show()
        self.connect(self.GravEditor, QtCore.SIGNAL("AnimBlockEdited()"),
                     self.setGravity)

    def setGravity(self):
        self.m2.particle_emitters[self.chooseBox.currentIndex(
        )].gravity = self.GravEditor.getAnimBlock()

    def editLifespan(self):
        temp = self.chooseBox.currentIndex()
        self.lifespanEditor = AnimEditor()
        self.lifespanEditor.setAnimBlock(
            self.m2.particle_emitters[temp].lifespan, self.m2.gSequ)
        self.lifespanEditor.show()
        self.connect(self.lifespanEditor, QtCore.SIGNAL("AnimBlockEdited()"),
                     self.setLifespan)

    def setLifespan(self):
        self.m2.particle_emitters[self.chooseBox.currentIndex(
        )].lifespan = self.lifespanEditor.getAnimBlock()

    def editEmissionRate(self):
        temp = self.chooseBox.currentIndex()
        self.eRateEditor = AnimEditor()
        self.eRateEditor.setAnimBlock(
            self.m2.particle_emitters[temp].emission_rate, self.m2.gSequ)
        self.eRateEditor.show()
        self.connect(self.eRateEditor, QtCore.SIGNAL("AnimBlockEdited()"),
                     self.setEmissionRate)

    def setEmissionRate(self):
        self.m2.particle_emitters[self.chooseBox.currentIndex(
        )].emission_rate = self.eRateEditor.getAnimBlock()

    def editAreaLength(self):
        temp = self.chooseBox.currentIndex()
        self.eAreaLengthEditor = AnimEditor()
        self.eAreaLengthEditor.setAnimBlock(
            self.m2.particle_emitters[temp].emission_area_len, self.m2.gSequ)
        self.eAreaLengthEditor.show()
        self.connect(self.eAreaLengthEditor,
                     QtCore.SIGNAL("AnimBlockEdited()"), self.setAreaLength)

    def setAreaLength(self):
        self.m2.particle_emitters[self.chooseBox.currentIndex(
        )].emission_area_len = self.eAreaLengthEditor.getAnimBlock()

    def editAreaWidth(self):
        temp = self.chooseBox.currentIndex()
        self.eAreaWidthEditor = AnimEditor()
        self.eAreaWidthEditor.setAnimBlock(
            self.m2.particle_emitters[temp].emission_area_width, self.m2.gSequ)
        self.eAreaWidthEditor.show()
        self.connect(self.eAreaWidthEditor, QtCore.SIGNAL("AnimBlockEdited()"),
                     self.setAreaWidth)

    def setAreaWidth(self):
        self.m2.particle_emitters[self.chooseBox.currentIndex(
        )].emission_area_width = self.eAreaWidthEditor.getAnimBlock()

    def editStrongGravity(self):
        temp = self.chooseBox.currentIndex()
        self.strongGravEditor = AnimEditor()
        self.strongGravEditor.setAnimBlock(
            self.m2.particle_emitters[temp].gravity2, self.m2.gSequ)
        self.strongGravEditor.show()
        self.connect(self.strongGravEditor, QtCore.SIGNAL("AnimBlockEdited()"),
                     self.setStrongGravity)

    def setStrongGravity(self):
        self.m2.particle_emitters[self.chooseBox.currentIndex(
        )].gravity2 = self.strongGravEditor.getAnimBlock()
示例#25
0
	def editStrongGravity(self):		
		temp = self.chooseBox.currentIndex()
		self.strongGravEditor = AnimEditor()
		self.strongGravEditor.setAnimBlock(self.m2.particle_emitters[temp].gravity2,self.m2.gSequ)
		self.strongGravEditor.show()
		self.connect(self.strongGravEditor,QtCore.SIGNAL("AnimBlockEdited()"),self.setStrongGravity)
示例#26
0
class UVAnimEditor(QtGui.QDialog):
	def __init__(self): 
		QtGui.QDialog.__init__(self) 
		self.setupUi(self)

	def setupUi(self, Dialog):
		Dialog.setObjectName("Dialog")
		Dialog.resize(514, 300)

		self.buttonBox = QtGui.QDialogButtonBox(Dialog)
		self.buttonBox.setGeometry(QtCore.QRect(410, 10, 101, 81))
		self.buttonBox.setOrientation(QtCore.Qt.Vertical)
		self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok)
		self.buttonBox.setObjectName("buttonBox")

		self.comboBox = QtGui.QComboBox(Dialog)
		self.comboBox.setGeometry(QtCore.QRect(10, 10, 85, 27))
		self.comboBox.setObjectName("comboBox")

		self.addIcon = QtGui.QIcon("Icons/edit-add.png")
		self.addButton = QtGui.QPushButton(self.addIcon,"Add",self)
		self.addButton.setGeometry(QtCore.QRect(110, 10, 92, 28))
		self.addButton.setObjectName("addButton")
		self.connect(self.addButton, QtCore.SIGNAL("clicked()"), self.adduvanimation) 

		self.line = QtGui.QFrame(Dialog)
		self.line.setGeometry(QtCore.QRect(10, 40, 201, 21))
		self.line.setFrameShape(QtGui.QFrame.HLine)
		self.line.setFrameShadow(QtGui.QFrame.Sunken)
		self.line.setObjectName("line")

		self.translationIcon = QtGui.QIcon("Icons/edit-translation.png")
		self.editTranslationButton =  QtGui.QPushButton(self.translationIcon,"Edit Translation",Dialog)
		self.editTranslationButton.setGeometry(QtCore.QRect(10, 50, 120, 28))
		self.editTranslationButton.setObjectName("editTranslationButton")
		self.connect(self.editTranslationButton, QtCore.SIGNAL("clicked()"), self.editTranslation) 

		self.scalingIcon = QtGui.QIcon("Icons/edit-scaling.png")
		self.editScalingButton = QtGui.QPushButton(self.scalingIcon,"Edit Scaling",Dialog)
		self.editScalingButton.setGeometry(QtCore.QRect(10, 90, 120, 28))
		self.editScalingButton.setObjectName("editScalingButton")
		self.connect(self.editScalingButton, QtCore.SIGNAL("clicked()"), self.editScaling) 

		self.rotationIcon = QtGui.QIcon("Icons/edit-rotation.png")
		self.editRotationButton = QtGui.QPushButton(self.rotationIcon,"Edit Rotation",Dialog)
		self.editRotationButton.setGeometry(QtCore.QRect(10, 130, 120, 28))
		self.editRotationButton.setObjectName("editRotationButton")
		self.connect(self.editRotationButton, QtCore.SIGNAL("clicked()"), self.editRotation) 


		self.retranslateUi(Dialog)
		QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("accepted()"), Dialog.accept)
		QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("rejected()"), Dialog.reject)
		QtCore.QMetaObject.connectSlotsByName(Dialog)

	def retranslateUi(self, Dialog):
		Dialog.setWindowTitle(QtGui.QApplication.translate("Dialog", "Edit UV-Animations", None, QtGui.QApplication.UnicodeUTF8))
		self.editTranslationButton.setText(QtGui.QApplication.translate("Dialog", "Edit Translation", None, QtGui.QApplication.UnicodeUTF8))
		self.editScalingButton.setText(QtGui.QApplication.translate("Dialog", "Edit Scaling", None, QtGui.QApplication.UnicodeUTF8))
		self.editRotationButton.setText(QtGui.QApplication.translate("Dialog", "Edit Rotation", None, QtGui.QApplication.UnicodeUTF8))
		self.addButton.setText(QtGui.QApplication.translate("Dialog", "Add", None, QtGui.QApplication.UnicodeUTF8))

	
	def setModel(self,m2,skin):
		self.m2 = m2
		self.skin = skin
		for i in range(len(self.m2.uv_anim)):
			self.comboBox.addItem(str(i))

	def setTranslation(self):
		self.m2.uv_anim[self.comboBox.currentIndex()].translation = self.TranslationEditor.getAnimBlock()

	def editTranslation(self):		
		temp = self.comboBox.currentIndex()
		self.TranslationEditor = AnimEditor()
		self.TranslationEditor.setAnimBlock(self.m2.uv_anim[temp].translation,self.m2.gSequ)
		self.TranslationEditor.show()
		self.connect(self.TranslationEditor,QtCore.SIGNAL("AnimBlockEdited()"),self.setTranslation)


	def setScaling(self):
		self.m2.uv_anim[self.comboBox.currentIndex()].scaling = self.ScalingEditor.getAnimBlock()

	def editScaling(self):		
		temp = self.comboBox.currentIndex()
		self.ScalingEditor = AnimEditor()
		self.ScalingEditor.setAnimBlock(self.m2.uv_anim[temp].scaling,self.m2.gSequ)
		self.ScalingEditor.show()
		self.connect(self.ScalingEditor,QtCore.SIGNAL("AnimBlockEdited()"),self.setScaling)

	def setRotation(self):
		self.m2.uv_anim[self.comboBox.currentIndex()].rotation = self.RotationEditor.getAnimBlock()

	def editRotation(self):		
		temp = self.comboBox.currentIndex()
		self.RotationEditor = AnimEditor()
		self.RotationEditor.setAnimBlock(self.m2.uv_anim[temp].rotation,self.m2.gSequ)
		self.RotationEditor.show()
		self.connect(self.RotationEditor,QtCore.SIGNAL("AnimBlockEdited()"),self.setRotation)


	def adduvanimation(self):
		tr = m2.UVAnimation()
		tr.translation.type = m2.DATA_VEC3
		tr.scaling.type = m2.DATA_VEC3
		tr.rotation.type = m2.DATA_QUAT
		
		tl = m2.Lookup()
		tl.Id = self.m2.hdr.uv_anim .count

		self.comboBox.addItem(str(len(self.m2.uv_anim )))

		self.m2.uv_anim .append(tr)
		self.m2.hdr.uv_anim .count += 1

		self.m2.uv_anim_lookup.append(tl)
		self.m2.hdr.uv_anim_lookup.count += 1
示例#27
0
class TransparencyChooser(QtGui.QDialog):
    def __init__(self):
        QtGui.QDialog.__init__(self)
        self.setupUi(self)

    def setupUi(self, Dialog):
        Dialog.setObjectName("Dialog")
        Dialog.resize(514, 300)

        self.buttonBox = QtGui.QDialogButtonBox(Dialog)
        self.buttonBox.setGeometry(QtCore.QRect(410, 10, 101, 81))
        self.buttonBox.setOrientation(QtCore.Qt.Vertical)
        self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel | QtGui.QDialogButtonBox.Ok)
        self.buttonBox.setObjectName("buttonBox")

        self.comboBox = QtGui.QComboBox(Dialog)
        self.comboBox.setGeometry(QtCore.QRect(10, 10, 85, 27))
        self.comboBox.setObjectName("comboBox")
        self.connect(self.comboBox, QtCore.SIGNAL("currentIndexChanged(int)"), self.changeEdit)

        self.editButton = QtGui.QPushButton(Dialog)
        self.editButton.setGeometry(QtCore.QRect(110, 10, 92, 28))
        self.editButton.setObjectName("editButton")
        self.connect(self.editButton, QtCore.SIGNAL("clicked()"), self.editTransparency)

        self.addIcon = QtGui.QIcon("Icons/edit-add.png")
        self.addButton = QtGui.QPushButton(self.addIcon, "Add", Dialog)
        self.addButton.setGeometry(QtCore.QRect(210, 10, 92, 28))
        self.addButton.setObjectName("addButton")
        self.connect(self.addButton, QtCore.SIGNAL("clicked()"), self.addTransparency)

        self.line = QtGui.QFrame(Dialog)
        self.line.setGeometry(QtCore.QRect(10, 40, 201, 21))
        self.line.setFrameShape(QtGui.QFrame.HLine)
        self.line.setFrameShadow(QtGui.QFrame.Sunken)
        self.line.setObjectName("line")

        self.label = QtGui.QLabel(Dialog)
        self.label.setGeometry(QtCore.QRect(20, 70, 361, 211))
        self.label.setObjectName("label")

        self.retranslateUi(Dialog)
        QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("accepted()"), Dialog.accept)
        QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("rejected()"), Dialog.reject)
        QtCore.QMetaObject.connectSlotsByName(Dialog)

    def retranslateUi(self, Dialog):
        Dialog.setWindowTitle(
            QtGui.QApplication.translate("Dialog", "Edit Transparency", None, QtGui.QApplication.UnicodeUTF8)
        )
        self.editButton.setText(QtGui.QApplication.translate("Dialog", "Edit", None, QtGui.QApplication.UnicodeUTF8))
        self.addButton.setText(QtGui.QApplication.translate("Dialog", "Add", None, QtGui.QApplication.UnicodeUTF8))
        self.label.setText(
            QtGui.QApplication.translate("Dialog", "Transparency used by:", None, QtGui.QApplication.UnicodeUTF8)
        )

    def setModel(self, m2):
        self.m2 = m2
        for i in range(len(self.m2.transparency)):
            self.comboBox.addItem(str(i))
        self.changeEdit()

    def changeEdit(self):
        s = "This transparency is used by:\n"
        for i in self.m2.materials[0]:
            try:
                if self.m2.trans_lookup[i.transparency].Id == self.comboBox.currentIndex():
                    s += "Layer " + str(i.flags) + " Geoset " + str(i.submesh) + ":" + str(i.submesh2) + "\n"
            except:
                pass
        self.label.setText(s)

    def setTransparency(self):
        self.m2.transparency[self.comboBox.currentIndex()].alpha = self.TransparencyEditor.getAnimBlock()

    def editTransparency(self):
        transparency = self.comboBox.currentIndex()
        self.TransparencyEditor = AnimEditor()
        self.TransparencyEditor.setAnimBlock(self.m2.transparency[transparency].alpha, self.m2.gSequ)
        self.TransparencyEditor.show()
        self.connect(self.TransparencyEditor, QtCore.SIGNAL("AnimBlockEdited()"), self.setTransparency)

    def addTransparency(self):
        tr = m2.Transparency()
        tr.alpha.type = m2.DATA_SHORT

        tl = m2.Lookup()
        tl.Id = self.m2.hdr.transparency.count

        self.comboBox.addItem(str(len(self.m2.transparency)))

        self.m2.transparency.append(tr)
        self.m2.hdr.transparency.count += 1

        self.m2.trans_lookup.append(tl)
        self.m2.hdr.trans_lookup.count += 1
示例#28
0
	def editTranslation(self):		
		temp = self.comboBox.currentIndex()
		self.TranslationEditor = AnimEditor()
		self.TranslationEditor.setAnimBlock(self.m2.uv_anim[temp].translation,self.m2.gSequ)
		self.TranslationEditor.show()
		self.connect(self.TranslationEditor,QtCore.SIGNAL("AnimBlockEdited()"),self.setTranslation)
示例#29
0
	def editScaling(self):		
		temp = self.comboBox.currentIndex()
		self.ScalingEditor = AnimEditor()
		self.ScalingEditor.setAnimBlock(self.m2.bones[temp].scaling,self.m2.gSequ)
		self.ScalingEditor.show()
		self.connect(self.ScalingEditor,QtCore.SIGNAL("AnimBlockEdited()"),self.setScaling)
示例#30
0
class AttachmentEditor(QtGui.QDialog):
    def __init__(self):
        QtGui.QDialog.__init__(self)
        self.setupUi(self)
        self.last = -1

    def setupUi(self, Dialog):
        Dialog.setObjectName("Dialog")
        Dialog.resize(480, 327)
        self.buttonBox = QtGui.QDialogButtonBox(Dialog)
        self.buttonBox.setGeometry(QtCore.QRect(130, 280, 341, 32))
        self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
        self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel
                                          | QtGui.QDialogButtonBox.Ok)
        self.buttonBox.setObjectName("buttonBox")

        self.comboBox = QtGui.QComboBox(Dialog)
        self.comboBox.setGeometry(QtCore.QRect(10, 10, 201, 27))
        self.comboBox.setObjectName("comboBox")
        self.connect(self.comboBox, QtCore.SIGNAL("currentIndexChanged(int)"),
                     self.changeEdit)

        self.addIcon = QtGui.QIcon("Icons/edit-add.png")
        self.addButton = QtGui.QPushButton(self.addIcon, "Add", Dialog)
        self.addButton.setGeometry(QtCore.QRect(220, 10, 92, 28))
        self.addButton.setObjectName("addButton")
        self.connect(self.addButton, QtCore.SIGNAL("clicked()"),
                     self.addAttachment)

        self.line = QtGui.QFrame(Dialog)
        self.line.setGeometry(QtCore.QRect(10, 50, 261, 16))
        self.line.setFrameShape(QtGui.QFrame.HLine)
        self.line.setFrameShadow(QtGui.QFrame.Sunken)
        self.line.setObjectName("line")

        self.typeBox = QtGui.QComboBox(Dialog)
        self.typeBox.setGeometry(QtCore.QRect(20, 70, 100, 27))
        self.typeBox.setObjectName("typeBox")
        for i in range(50):
            self.typeBox.addItem(QtCore.QString())

        self.label = QtGui.QLabel(Dialog)
        self.label.setGeometry(QtCore.QRect(20, 110, 62, 18))
        self.label.setObjectName("label")

        self.xEdit = QtGui.QLineEdit(Dialog)
        self.xEdit.setGeometry(QtCore.QRect(20, 130, 50, 26))
        self.xEdit.setObjectName("xEdit")

        self.yEdit = QtGui.QLineEdit(Dialog)
        self.yEdit.setGeometry(QtCore.QRect(80, 130, 50, 26))
        self.yEdit.setObjectName("yEdit")

        self.zEdit = QtGui.QLineEdit(Dialog)
        self.zEdit.setGeometry(QtCore.QRect(140, 130, 50, 26))
        self.zEdit.setObjectName("zEdit")

        self.boneBox = QtGui.QComboBox(Dialog)
        self.boneBox.setGeometry(QtCore.QRect(20, 170, 100, 27))
        self.boneBox.setObjectName("boneBox")

        self.enabledIcon = QtGui.QIcon("Icons/edit-enabled.png")
        self.enabledButton = QtGui.QPushButton(self.enabledIcon,
                                               "Edit Enabled", Dialog)
        self.enabledButton.setGeometry(QtCore.QRect(20, 200, 140, 28))
        self.enabledButton.setObjectName("enabledButton")
        self.connect(self.enabledButton, QtCore.SIGNAL("clicked()"),
                     self.editEnabled)

        self.retranslateUi(Dialog)
        QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("accepted()"),
                               self.finalizeMe)
        QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("rejected()"),
                               Dialog.reject)
        QtCore.QMetaObject.connectSlotsByName(Dialog)

    def finalizeMe(self):
        self.saveOld()
        self.accept()

    def retranslateUi(self, Dialog):
        Dialog.setWindowTitle(
            QtGui.QApplication.translate("Dialog", "Attachment Editor", None,
                                         QtGui.QApplication.UnicodeUTF8))
        self.addButton.setText(
            QtGui.QApplication.translate("Dialog", "Add", None,
                                         QtGui.QApplication.UnicodeUTF8))
        self.label.setText(
            QtGui.QApplication.translate("Dialog", "Position:", None,
                                         QtGui.QApplication.UnicodeUTF8))

        for i in range(50):
            self.typeBox.setItemText(
                i,
                QtGui.QApplication.translate(
                    "Dialog",
                    str(i) + ": " + attachment_types[i], None,
                    QtGui.QApplication.UnicodeUTF8))

    def setModel(self, m2):
        self.m2 = m2
        for i in range(len(self.m2.attachments)):
            self.comboBox.addItem(
                str(i) + ": " + attachment_types[self.m2.attachments[i].Id])
        for i in range(len(self.m2.bones)):
            self.boneBox.addItem("Bone: " + str(i) + "/" +
                                 str(self.m2.bones[i].KeyBoneId))
        self.changeEdit()

    def setCurrentEditing(self, i):
        self.comboBox.setCurrentIndex(i)
        self.changeEdit()

    def addAttachment(self):
        att = m2.Attachment()
        att.Enabled.type = m2.DATA_INT
        lu = m2.Lookup()
        lu.Id = self.m2.hdr.attachments.count
        self.m2.attach_lookup.append(lu)
        self.m2.attachments.append(att)
        self.comboBox.addItem(
            str(self.m2.hdr.attachments.count) + ": " + attachment_types[
                self.m2.attachments[self.m2.hdr.attachments.count].Id])
        self.m2.hdr.attachments.count += 1
        self.m2.hdr.attach_lookup.count += 1

    def changeEdit(self):
        self.saveOld()
        self.last = self.comboBox.currentIndex()
        if not len(self.m2.attachments) < 1:
            self.typeBox.setCurrentIndex(
                self.m2.attachments[self.comboBox.currentIndex()].Id)
            self.xEdit.setText(
                str(self.m2.attachments[self.comboBox.currentIndex()].pos.x))
            self.yEdit.setText(
                str(self.m2.attachments[self.comboBox.currentIndex()].pos.y))
            self.zEdit.setText(
                str(self.m2.attachments[self.comboBox.currentIndex()].pos.z))
            self.boneBox.setCurrentIndex(
                self.m2.attachments[self.comboBox.currentIndex()].bone)

    def saveOld(self):
        if (self.last == -1):
            return
        self.m2.attachments[self.last].Id = self.typeBox.currentIndex()
        self.m2.attachments[self.last].pos.x = float(self.xEdit.text())
        self.m2.attachments[self.last].pos.y = float(self.yEdit.text())
        self.m2.attachments[self.last].pos.z = float(self.zEdit.text())
        self.m2.attachments[self.last].bone = self.boneBox.currentIndex()
        self.comboBox.setItemText(
            self.last,
            str(self.last) + ": " +
            attachment_types[self.m2.attachments[self.last].Id])

    def editEnabled(self):
        temp = self.comboBox.currentIndex()
        self.EnabledEditor = AnimEditor()
        self.EnabledEditor.setAnimBlock(self.m2.attachments[temp].Enabled,
                                        self.m2.gSequ)
        self.EnabledEditor.show()
        self.connect(self.EnabledEditor, QtCore.SIGNAL("AnimBlockEdited()"),
                     self.setEnabled)

    def setEnabled(self):
        self.m2.attachments[self.comboBox.currentIndex(
        )].Enabled = self.EnabledEditor.getAnimBlock()
示例#31
0
class BoneEditor(QtGui.QDialog):
	def __init__(self): 
		QtGui.QDialog.__init__(self) 
		self.setupUi(self)
		self.last = -1


	def setupUi(self, Dialog):
		Dialog.setObjectName("Dialog")
		Dialog.resize(480, 350)
		self.buttonBox = QtGui.QDialogButtonBox(Dialog)
		self.buttonBox.setGeometry(QtCore.QRect(130, 300, 341, 32))
		self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
		self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok)
		self.buttonBox.setObjectName("buttonBox")

		self.comboBox = QtGui.QComboBox(Dialog)
		self.comboBox.setGeometry(QtCore.QRect(10, 10, 201, 27))
		self.comboBox.setObjectName("comboBox")
		self.connect(self.comboBox, QtCore.SIGNAL("currentIndexChanged(int)"), self.changeEdit) 

		self.addIcon = QtGui.QIcon("Icons/edit-add.png")
		self.addButton = QtGui.QPushButton(self.addIcon,"Add",Dialog)
		self.addButton.setGeometry(QtCore.QRect(220, 10, 92, 28))
		self.addButton.setObjectName("addButton")
		self.connect(self.addButton, QtCore.SIGNAL("clicked()"), self.addBone)


		self.line = QtGui.QFrame(Dialog)
		self.line.setGeometry(QtCore.QRect(10, 50, 261, 16))
		self.line.setFrameShape(QtGui.QFrame.HLine)
		self.line.setFrameShadow(QtGui.QFrame.Sunken)
		self.line.setObjectName("line")

		self.typeBox = QtGui.QComboBox(Dialog)
		self.typeBox.setGeometry(QtCore.QRect(20, 70, 100, 27))
		self.typeBox.setObjectName("typeBox")
		for i in range(36):			
			self.typeBox.addItem(QtCore.QString())


		self.label = QtGui.QLabel(Dialog)
		self.label.setGeometry(QtCore.QRect(20, 110, 62, 18))
		self.label.setObjectName("label")

		self.xEdit = QtGui.QLineEdit(Dialog)
		self.xEdit.setGeometry(QtCore.QRect(20, 130, 50, 26))
		self.xEdit.setObjectName("xEdit")

		self.yEdit = QtGui.QLineEdit(Dialog)
		self.yEdit.setGeometry(QtCore.QRect(80, 130, 50, 26))
		self.yEdit.setObjectName("yEdit")

		self.zEdit = QtGui.QLineEdit(Dialog)
		self.zEdit.setGeometry(QtCore.QRect(140, 130, 50, 26))
		self.zEdit.setObjectName("zEdit")


		self.parentlabel = QtGui.QLabel(Dialog)
		self.parentlabel.setGeometry(QtCore.QRect(20, 170, 62, 18))
		self.parentlabel.setObjectName("parentlabel")

		self.boneBox = QtGui.QComboBox(Dialog)
		self.boneBox.setGeometry(QtCore.QRect(20, 200, 100, 27))
		self.boneBox.setObjectName("boneBox")


		self.translationIcon = QtGui.QIcon("Icons/edit-translation.png")
		self.translationButton = QtGui.QPushButton(self.translationIcon,"Edit Translation",Dialog)
		self.translationButton.setGeometry(QtCore.QRect(20, 230, 140, 28))
		self.translationButton.setObjectName("translationButton")
		self.connect(self.translationButton, QtCore.SIGNAL("clicked()"), self.editTranslation)


		self.scalingIcon = QtGui.QIcon("Icons/edit-scaling.png")
		self.scalingButton = QtGui.QPushButton(self.scalingIcon,"Edit Scaling",Dialog)
		self.scalingButton.setGeometry(QtCore.QRect(170, 230, 140, 28))
		self.scalingButton.setObjectName("translationButton")
		self.connect(self.scalingButton, QtCore.SIGNAL("clicked()"), self.editScaling)


		self.rotationIcon = QtGui.QIcon("Icons/edit-rotation.png")
		self.rotationButton = QtGui.QPushButton(self.rotationIcon,"Edit Rotation",Dialog)
		self.rotationButton.setGeometry(QtCore.QRect(320, 230, 140, 28))
		self.rotationButton.setObjectName("rotationButton")
		self.connect(self.rotationButton, QtCore.SIGNAL("clicked()"), self.editRotation)

		self.billBox = QtGui.QCheckBox(Dialog)
		self.billBox.setGeometry(QtCore.QRect(20, 270, 110, 23))
		self.billBox.setObjectName("checkBox")

		self.transBox = QtGui.QCheckBox(Dialog)
		self.transBox.setGeometry(QtCore.QRect(150, 270, 110, 23))
		self.transBox.setObjectName("transBox")

		self.retranslateUi(Dialog)
		QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("accepted()"), self.finalizeMe)
		QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("rejected()"), Dialog.reject)
		QtCore.QMetaObject.connectSlotsByName(Dialog)


	def finalizeMe(self):
		self.saveOld()
		self.accept()

	def retranslateUi(self, Dialog):
		Dialog.setWindowTitle(QtGui.QApplication.translate("Dialog", "Bone Editor", None, QtGui.QApplication.UnicodeUTF8))
		self.addButton.setText(QtGui.QApplication.translate("Dialog", "Add", None, QtGui.QApplication.UnicodeUTF8))
		self.label.setText(QtGui.QApplication.translate("Dialog", "Position:", None, QtGui.QApplication.UnicodeUTF8))
		self.parentlabel.setText(QtGui.QApplication.translate("Dialog", "Parent:", None, QtGui.QApplication.UnicodeUTF8))
		self.billBox.setText(QtGui.QApplication.translate("Dialog", "Billboarded", None, QtGui.QApplication.UnicodeUTF8))
		self.transBox.setText(QtGui.QApplication.translate("Dialog", "Transformed", None, QtGui.QApplication.UnicodeUTF8))

		for i in range(36):
			self.typeBox.setItemText(i, QtGui.QApplication.translate("Dialog", str(i-1)+": "+KeyBoneTypes[i-1], None, QtGui.QApplication.UnicodeUTF8))

	def setModel(self,m2,skin):
		self.m2 = m2
		self.skin = skin
		for i in range(len(self.m2.bones)):
			self.comboBox.addItem(str(i)+": "+KeyBoneTypes[self.m2.bones[i].KeyBoneId])
		for i in range(len(self.m2.bones)+1):
			if i == 0:
				self.boneBox.addItem("None "+str(i-1))
			else:
				self.boneBox.addItem("Bone: "+str(i-1)+" "+KeyBoneTypes[self.m2.bones[i-1].KeyBoneId])
		self.changeEdit()

	def setCurrentEditing(self,i):
		self.comboBox.setCurrentIndex(i)
		self.changeEdit()
	
	def addBone(self,parbone = -1):
		b = m2.Bone()
		b.parent = parbone
		b.translation.type = m2.DATA_VEC3
		b.scaling.type = m2.DATA_VEC3
		b.rotation.type = m2.DATA_QUAT

		lu = m2.Lookup()
		lu.Id = self.m2.hdr.bones.count

		self.m2.bones.append(b)
		self.m2.bone_lookup.append(lu)
		
		self.comboBox.addItem(str(self.m2.hdr.bones.count)+": "+KeyBoneTypes[self.m2.bones[self.m2.hdr.bones.count].KeyBoneId])

		self.m2.hdr.bones.count += 1
		self.m2.hdr.bone_lookup.count += 1

	def changeEdit(self):
		self.saveOld()
		self.last = self.comboBox.currentIndex()
		if not len(self.m2.bones)<1:			
			self.typeBox.setCurrentIndex(self.m2.bones[self.comboBox.currentIndex()].KeyBoneId+1)
			self.xEdit.setText(str(self.m2.bones[self.comboBox.currentIndex()].pivot.x))
			self.yEdit.setText(str(self.m2.bones[self.comboBox.currentIndex()].pivot.y))
			self.zEdit.setText(str(self.m2.bones[self.comboBox.currentIndex()].pivot.z))			
			self.boneBox.setCurrentIndex(self.m2.bones[self.comboBox.currentIndex()].parent+1)
			if self.m2.bones[self.comboBox.currentIndex()].flags & 0x8:
				self.billBox.setCheckState(2)
			else:
				self.billBox.setCheckState(0)

			if self.m2.bones[self.comboBox.currentIndex()].flags & 0x200:
				self.transBox.setCheckState(2)
			else:
				self.transBox.setCheckState(0)

	def saveOld(self):
		if (self.last == -1):
			return
		self.m2.bones[self.last].KeyBoneId = self.typeBox.currentIndex()-1
		self.m2.bones[self.last].pivot.x = float(self.xEdit.text())
		self.m2.bones[self.last].pivot.y = float(self.yEdit.text())
		self.m2.bones[self.last].pivot.z = float(self.zEdit.text())
		self.m2.bones[self.last].parent = self.boneBox.currentIndex()-1
		self.m2.bones[self.last].flags = 0
		if self.billBox.checkState() == 2:
			self.m2.bones[self.last].flags += 0x8
		if self.transBox.checkState() == 2:
			self.m2.bones[self.last].flags += 0x200
		self.comboBox.setItemText(self.last,str(self.last)+": "+KeyBoneTypes[self.m2.bones[self.last].KeyBoneId])

	def setTranslation(self):
		self.m2.bones[self.comboBox.currentIndex()].translation = self.TranslationEditor.getAnimBlock()

	def editTranslation(self):		
		temp = self.comboBox.currentIndex()
		self.TranslationEditor = AnimEditor()
		self.TranslationEditor.setAnimBlock(self.m2.bones[temp].translation,self.m2.gSequ)
		self.TranslationEditor.show()
		self.connect(self.TranslationEditor,QtCore.SIGNAL("AnimBlockEdited()"),self.setTranslation)

	def setScaling(self):
		self.m2.bones[self.comboBox.currentIndex()].scaling = self.ScalingEditor.getAnimBlock()

	def editScaling(self):		
		temp = self.comboBox.currentIndex()
		self.ScalingEditor = AnimEditor()
		self.ScalingEditor.setAnimBlock(self.m2.bones[temp].scaling,self.m2.gSequ)
		self.ScalingEditor.show()
		self.connect(self.ScalingEditor,QtCore.SIGNAL("AnimBlockEdited()"),self.setScaling)

	def setRotation(self):
		self.m2.bones[self.comboBox.currentIndex()].rotation = self.RotationEditor.getAnimBlock()

	def editRotation(self):		
		temp = self.comboBox.currentIndex()
		self.RotationEditor = AnimEditor()
		self.RotationEditor.setAnimBlock(self.m2.bones[temp].rotation,self.m2.gSequ)
		self.RotationEditor.show()
		self.connect(self.RotationEditor,QtCore.SIGNAL("AnimBlockEdited()"),self.setRotation)
示例#32
0
	def editAttenuationEnd(self):		
		temp = self.lightList.currentIndex()
		self.AttEndEditor = AnimEditor()
		self.AttEndEditor.setAnimBlock(self.m2.lights[temp].AttEnd,self.m2.gSequ)
		self.AttEndEditor.show()
		self.connect(self.AttEndEditor,QtCore.SIGNAL("AnimBlockEdited()"),self.setAttenuationEnd)
示例#33
0
class UVAnimEditor(QtGui.QDialog):
    def __init__(self):
        QtGui.QDialog.__init__(self)
        self.setupUi(self)

    def setupUi(self, Dialog):
        Dialog.setObjectName("Dialog")
        Dialog.resize(514, 300)

        self.buttonBox = QtGui.QDialogButtonBox(Dialog)
        self.buttonBox.setGeometry(QtCore.QRect(410, 10, 101, 81))
        self.buttonBox.setOrientation(QtCore.Qt.Vertical)
        self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel
                                          | QtGui.QDialogButtonBox.Ok)
        self.buttonBox.setObjectName("buttonBox")

        self.comboBox = QtGui.QComboBox(Dialog)
        self.comboBox.setGeometry(QtCore.QRect(10, 10, 85, 27))
        self.comboBox.setObjectName("comboBox")

        self.addIcon = QtGui.QIcon("Icons/edit-add.png")
        self.addButton = QtGui.QPushButton(self.addIcon, "Add", self)
        self.addButton.setGeometry(QtCore.QRect(110, 10, 92, 28))
        self.addButton.setObjectName("addButton")
        self.connect(self.addButton, QtCore.SIGNAL("clicked()"),
                     self.adduvanimation)

        self.line = QtGui.QFrame(Dialog)
        self.line.setGeometry(QtCore.QRect(10, 40, 201, 21))
        self.line.setFrameShape(QtGui.QFrame.HLine)
        self.line.setFrameShadow(QtGui.QFrame.Sunken)
        self.line.setObjectName("line")

        self.translationIcon = QtGui.QIcon("Icons/edit-translation.png")
        self.editTranslationButton = QtGui.QPushButton(self.translationIcon,
                                                       "Edit Translation",
                                                       Dialog)
        self.editTranslationButton.setGeometry(QtCore.QRect(10, 50, 120, 28))
        self.editTranslationButton.setObjectName("editTranslationButton")
        self.connect(self.editTranslationButton, QtCore.SIGNAL("clicked()"),
                     self.editTranslation)

        self.scalingIcon = QtGui.QIcon("Icons/edit-scaling.png")
        self.editScalingButton = QtGui.QPushButton(self.scalingIcon,
                                                   "Edit Scaling", Dialog)
        self.editScalingButton.setGeometry(QtCore.QRect(10, 90, 120, 28))
        self.editScalingButton.setObjectName("editScalingButton")
        self.connect(self.editScalingButton, QtCore.SIGNAL("clicked()"),
                     self.editScaling)

        self.rotationIcon = QtGui.QIcon("Icons/edit-rotation.png")
        self.editRotationButton = QtGui.QPushButton(self.rotationIcon,
                                                    "Edit Rotation", Dialog)
        self.editRotationButton.setGeometry(QtCore.QRect(10, 130, 120, 28))
        self.editRotationButton.setObjectName("editRotationButton")
        self.connect(self.editRotationButton, QtCore.SIGNAL("clicked()"),
                     self.editRotation)

        self.retranslateUi(Dialog)
        QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("accepted()"),
                               Dialog.accept)
        QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("rejected()"),
                               Dialog.reject)
        QtCore.QMetaObject.connectSlotsByName(Dialog)

    def retranslateUi(self, Dialog):
        Dialog.setWindowTitle(
            QtGui.QApplication.translate("Dialog", "Edit UV-Animations", None,
                                         QtGui.QApplication.UnicodeUTF8))
        self.editTranslationButton.setText(
            QtGui.QApplication.translate("Dialog", "Edit Translation", None,
                                         QtGui.QApplication.UnicodeUTF8))
        self.editScalingButton.setText(
            QtGui.QApplication.translate("Dialog", "Edit Scaling", None,
                                         QtGui.QApplication.UnicodeUTF8))
        self.editRotationButton.setText(
            QtGui.QApplication.translate("Dialog", "Edit Rotation", None,
                                         QtGui.QApplication.UnicodeUTF8))
        self.addButton.setText(
            QtGui.QApplication.translate("Dialog", "Add", None,
                                         QtGui.QApplication.UnicodeUTF8))

    def setModel(self, m2):
        self.m2 = m2
        for i in range(len(self.m2.uv_anim)):
            self.comboBox.addItem(str(i))

    def setTranslation(self):
        self.m2.uv_anim[self.comboBox.currentIndex(
        )].translation = self.TranslationEditor.getAnimBlock()

    def editTranslation(self):
        temp = self.comboBox.currentIndex()
        self.TranslationEditor = AnimEditor()
        self.TranslationEditor.setAnimBlock(self.m2.uv_anim[temp].translation,
                                            self.m2.gSequ)
        self.TranslationEditor.show()
        self.connect(self.TranslationEditor,
                     QtCore.SIGNAL("AnimBlockEdited()"), self.setTranslation)

    def setScaling(self):
        self.m2.uv_anim[self.comboBox.currentIndex(
        )].scaling = self.ScalingEditor.getAnimBlock()

    def editScaling(self):
        temp = self.comboBox.currentIndex()
        self.ScalingEditor = AnimEditor()
        self.ScalingEditor.setAnimBlock(self.m2.uv_anim[temp].scaling,
                                        self.m2.gSequ)
        self.ScalingEditor.show()
        self.connect(self.ScalingEditor, QtCore.SIGNAL("AnimBlockEdited()"),
                     self.setScaling)

    def setRotation(self):
        self.m2.uv_anim[self.comboBox.currentIndex(
        )].rotation = self.RotationEditor.getAnimBlock()

    def editRotation(self):
        temp = self.comboBox.currentIndex()
        self.RotationEditor = AnimEditor()
        self.RotationEditor.setAnimBlock(self.m2.uv_anim[temp].rotation,
                                         self.m2.gSequ)
        self.RotationEditor.show()
        self.connect(self.RotationEditor, QtCore.SIGNAL("AnimBlockEdited()"),
                     self.setRotation)

    def adduvanimation(self):
        tr = m2.UVAnimation()
        tr.translation.type = m2.DATA_VEC3
        tr.scaling.type = m2.DATA_VEC3
        tr.rotation.type = m2.DATA_QUAT

        tl = m2.Lookup()
        tl.Id = self.m2.hdr.uv_anim.count

        self.comboBox.addItem(str(len(self.m2.uv_anim)))

        self.m2.uv_anim.append(tr)
        self.m2.hdr.uv_anim.count += 1

        self.m2.uv_anim_lookup.append(tl)
        self.m2.hdr.uv_anim_lookup.count += 1
示例#34
0
class AttachmentEditor(QtGui.QDialog):
	def __init__(self): 
		QtGui.QDialog.__init__(self) 
		self.setupUi(self)
		self.last = -1


	def setupUi(self, Dialog):
		Dialog.setObjectName("Dialog")
		Dialog.resize(480, 327)
		self.buttonBox = QtGui.QDialogButtonBox(Dialog)
		self.buttonBox.setGeometry(QtCore.QRect(130, 280, 341, 32))
		self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
		self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok)
		self.buttonBox.setObjectName("buttonBox")

		self.comboBox = QtGui.QComboBox(Dialog)
		self.comboBox.setGeometry(QtCore.QRect(10, 10, 201, 27))
		self.comboBox.setObjectName("comboBox")
		self.connect(self.comboBox, QtCore.SIGNAL("currentIndexChanged(int)"), self.changeEdit) 

		self.addIcon = QtGui.QIcon("Icons/edit-add.png")
		self.addButton = QtGui.QPushButton(self.addIcon,"Add",Dialog)
		self.addButton.setGeometry(QtCore.QRect(220, 10, 92, 28))
		self.addButton.setObjectName("addButton")
		self.connect(self.addButton, QtCore.SIGNAL("clicked()"), self.addAttachment)


		self.line = QtGui.QFrame(Dialog)
		self.line.setGeometry(QtCore.QRect(10, 50, 261, 16))
		self.line.setFrameShape(QtGui.QFrame.HLine)
		self.line.setFrameShadow(QtGui.QFrame.Sunken)
		self.line.setObjectName("line")

		self.typeBox = QtGui.QComboBox(Dialog)
		self.typeBox.setGeometry(QtCore.QRect(20, 70, 100, 27))
		self.typeBox.setObjectName("typeBox")
		for i in range(50):			
			self.typeBox.addItem(QtCore.QString())


		self.label = QtGui.QLabel(Dialog)
		self.label.setGeometry(QtCore.QRect(20, 110, 62, 18))
		self.label.setObjectName("label")

		self.xEdit = QtGui.QLineEdit(Dialog)
		self.xEdit.setGeometry(QtCore.QRect(20, 130, 50, 26))
		self.xEdit.setObjectName("xEdit")

		self.yEdit = QtGui.QLineEdit(Dialog)
		self.yEdit.setGeometry(QtCore.QRect(80, 130, 50, 26))
		self.yEdit.setObjectName("yEdit")

		self.zEdit = QtGui.QLineEdit(Dialog)
		self.zEdit.setGeometry(QtCore.QRect(140, 130, 50, 26))
		self.zEdit.setObjectName("zEdit")

		self.boneBox = QtGui.QComboBox(Dialog)
		self.boneBox.setGeometry(QtCore.QRect(20, 170, 100, 27))
		self.boneBox.setObjectName("boneBox")


		self.enabledIcon = QtGui.QIcon("Icons/edit-enabled.png")
		self.enabledButton = QtGui.QPushButton(self.enabledIcon,"Edit Enabled",Dialog)
		self.enabledButton.setGeometry(QtCore.QRect(20, 200, 140, 28))
		self.enabledButton.setObjectName("enabledButton")
		self.connect(self.enabledButton, QtCore.SIGNAL("clicked()"), self.editEnabled)

		self.retranslateUi(Dialog)
		QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("accepted()"), self.finalizeMe)
		QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("rejected()"), Dialog.reject)
		QtCore.QMetaObject.connectSlotsByName(Dialog)


	def finalizeMe(self):
		self.saveOld()
		self.accept()

	def retranslateUi(self, Dialog):
		Dialog.setWindowTitle(QtGui.QApplication.translate("Dialog", "Attachment Editor", None, QtGui.QApplication.UnicodeUTF8))
		self.addButton.setText(QtGui.QApplication.translate("Dialog", "Add", None, QtGui.QApplication.UnicodeUTF8))
		self.label.setText(QtGui.QApplication.translate("Dialog", "Position:", None, QtGui.QApplication.UnicodeUTF8))

		for i in range(50):
			self.typeBox.setItemText(i, QtGui.QApplication.translate("Dialog", str(i)+": "+attachment_types[i], None, QtGui.QApplication.UnicodeUTF8))

	

	def setModel(self,m2,skin):
		self.m2 = m2
		self.skin = skin
		for i in range(len(self.m2.attachments)):
			self.comboBox.addItem(str(i)+": "+attachment_types[self.m2.attachments[i].Id])
		for i in range(len(self.m2.bones)):
			self.boneBox.addItem("Bone: "+str(i)+"/"+str(self.m2.bones[i].KeyBoneId))
		self.changeEdit()

	def setCurrentEditing(self,i):
		self.comboBox.setCurrentIndex(i)
		self.changeEdit()

	def addAttachment(self,parbone = 0):
		att = m2.Attachment()
		att.Enabled.type = m2.DATA_INT
		att.bone = parbone
		lu = m2.Lookup()
		lu.Id = self.m2.hdr.attachments.count
		self.m2.attach_lookup.append(lu)
		self.m2.attachments.append(att)
		self.comboBox.addItem(str(self.m2.hdr.attachments.count)+": "+attachment_types[self.m2.attachments[self.m2.hdr.attachments.count].Id])
		self.m2.hdr.attachments.count += 1
		self.m2.hdr.attach_lookup.count += 1


	def changeEdit(self):
		self.saveOld()
		self.last = self.comboBox.currentIndex()
		if not len(self.m2.attachments)<1:
			self.typeBox.setCurrentIndex(self.m2.attachments[self.comboBox.currentIndex()].Id)
			self.xEdit.setText(str(self.m2.attachments[self.comboBox.currentIndex()].pos.x))
			self.yEdit.setText(str(self.m2.attachments[self.comboBox.currentIndex()].pos.y))
			self.zEdit.setText(str(self.m2.attachments[self.comboBox.currentIndex()].pos.z))
			self.boneBox.setCurrentIndex(self.m2.attachments[self.comboBox.currentIndex()].bone)

	def saveOld(self):
		if (self.last == -1):
			return
		self.m2.attachments[self.last].Id = self.typeBox.currentIndex()
		self.m2.attachments[self.last].pos.x = float(self.xEdit.text())
		self.m2.attachments[self.last].pos.y = float(self.yEdit.text())
		self.m2.attachments[self.last].pos.z = float(self.zEdit.text())
		self.m2.attachments[self.last].bone = self.boneBox.currentIndex()
		self.comboBox.setItemText(self.last,str(self.last)+": "+attachment_types[self.m2.attachments[self.last].Id])

	def editEnabled(self):		
		temp = self.comboBox.currentIndex()
		self.EnabledEditor = AnimEditor()
		self.EnabledEditor.setAnimBlock(self.m2.attachments[temp].Enabled,self.m2.gSequ)
		self.EnabledEditor.show()
		self.connect(self.EnabledEditor,QtCore.SIGNAL("AnimBlockEdited()"),self.setEnabled)

	def setEnabled(self):
		self.m2.attachments[self.comboBox.currentIndex()].Enabled = self.EnabledEditor.getAnimBlock()
示例#35
0
	def editAmbientColor(self):		
		temp = self.lightList.currentIndex()
		self.AmbColEditor = AnimEditor()
		self.AmbColEditor.setAnimBlock(self.m2.lights[temp].AmbientCol,self.m2.gSequ)
		self.AmbColEditor.show()
		self.connect(self.AmbColEditor,QtCore.SIGNAL("AnimBlockEdited()"),self.setAmbientColor)
示例#36
0
	def editDiffuseIntensity(self):		
		temp = self.lightList.currentIndex()
		self.DiffIntEditor = AnimEditor()
		self.DiffIntEditor.setAnimBlock(self.m2.lights[temp].DiffuseInt,self.m2.gSequ)
		self.DiffIntEditor.show()
		self.connect(self.DiffIntEditor,QtCore.SIGNAL("AnimBlockEdited()"),self.setDiffuseIntensity)
示例#37
0
class ParticleEditor(QtGui.QDialog):
	def __init__(self): 
		QtGui.QDialog.__init__(self) 
		self.setupUi(self)
		self.last = -1
		
	def setupUi(self, Dialog):
		Dialog.setObjectName("Dialog")
		Dialog.resize(644, 590)
		
		self.buttonBox = QtGui.QDialogButtonBox(Dialog)
		self.buttonBox.setGeometry(QtCore.QRect(280, 540, 341, 32))
		self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
		self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok)
		self.buttonBox.setObjectName("buttonBox")
		
		self.chooseBox = QtGui.QComboBox(Dialog)
		self.chooseBox.setGeometry(QtCore.QRect(20, 20, 85, 27))
		self.chooseBox.setObjectName("chooseBox")
		self.connect(self.chooseBox, QtCore.SIGNAL("currentIndexChanged(int)"), self.changeEdit) 
		

		self.addIcon = QtGui.QIcon("Icons/edit-add.png")
		self.addButton = QtGui.QPushButton(self.addIcon,"Add",Dialog)
		self.addButton.setGeometry(QtCore.QRect(110, 20, 92, 28))
		self.addButton.setObjectName("addButton")
		self.connect(self.addButton, QtCore.SIGNAL("clicked()"), self.addParticle) 
		
		self.line = QtGui.QFrame(Dialog)
		self.line.setGeometry(QtCore.QRect(20, 60, 241, 16))
		self.line.setFrameShape(QtGui.QFrame.HLine)
		self.line.setFrameShadow(QtGui.QFrame.Sunken)
		self.line.setObjectName("line")
		
		self.modelEdit = QtGui.QLineEdit(Dialog)
		self.modelEdit.setGeometry(QtCore.QRect(10, 100, 113, 26))
		self.modelEdit.setObjectName("modelEdit")
		
		self.particleEdit = QtGui.QLineEdit(Dialog)
		self.particleEdit.setGeometry(QtCore.QRect(10, 160, 113, 26))
		self.particleEdit.setObjectName("particleEdit")
		
		self.eSpeedButton = QtGui.QPushButton(Dialog)
		self.eSpeedButton.setGeometry(QtCore.QRect(231, 90, 111, 28))
		self.eSpeedButton.setObjectName("eSpeedButton")
		self.connect(self.eSpeedButton, QtCore.SIGNAL("clicked()"), self.editEmissionSpeed)
		
		self.speedVarButton = QtGui.QPushButton(Dialog)
		self.speedVarButton.setGeometry(QtCore.QRect(350, 90, 121, 28))
		self.speedVarButton.setObjectName("speedVarButton")
		self.connect(self.speedVarButton, QtCore.SIGNAL("clicked()"), self.editSpeedVariation)
		
		self.vertRangeButton = QtGui.QPushButton(Dialog)
		self.vertRangeButton.setGeometry(QtCore.QRect(231, 120, 111, 28))
		self.vertRangeButton.setObjectName("vertRangeButton")
		self.connect(self.vertRangeButton, QtCore.SIGNAL("clicked()"), self.editVerticalRange)
		
		self.horRangeButton = QtGui.QPushButton(Dialog)
		self.horRangeButton.setGeometry(QtCore.QRect(350, 120, 121, 28))
		self.horRangeButton.setObjectName("horRangeButton")
		self.connect(self.horRangeButton, QtCore.SIGNAL("clicked()"), self.editEmissionSpeed)
		
		self.gravButton = QtGui.QPushButton(Dialog)
		self.gravButton.setGeometry(QtCore.QRect(231, 150, 111, 28))
		self.gravButton.setObjectName("gravButton")
		self.connect(self.gravButton, QtCore.SIGNAL("clicked()"), self.editGravity)
		
		self.lifeButton = QtGui.QPushButton(Dialog)
		self.lifeButton.setGeometry(QtCore.QRect(350, 150, 121, 28))
		self.lifeButton.setObjectName("lifeButton")
		self.connect(self.lifeButton, QtCore.SIGNAL("clicked()"), self.editLifespan)
		
		self.eRateButton = QtGui.QPushButton(Dialog)
		self.eRateButton.setGeometry(QtCore.QRect(231, 180, 111, 28))
		self.eRateButton.setObjectName("eRateButton")
		self.connect(self.eRateButton, QtCore.SIGNAL("clicked()"), self.editEmissionRate)
		
		self.grav2Button = QtGui.QPushButton(Dialog)
		self.grav2Button.setGeometry(QtCore.QRect(350, 180, 121, 28))
		self.grav2Button.setObjectName("grav2Button")
		self.connect(self.grav2Button, QtCore.SIGNAL("clicked()"), self.editStrongGravity)
		
		self.eLengthButton = QtGui.QPushButton(Dialog)
		self.eLengthButton.setGeometry(QtCore.QRect(231, 210, 111, 28))
		self.eLengthButton.setObjectName("eLengthButton")
		self.connect(self.eLengthButton, QtCore.SIGNAL("clicked()"), self.editAreaLength)
		
		self.eWidthButton = QtGui.QPushButton(Dialog)
		self.eWidthButton.setGeometry(QtCore.QRect(350, 210, 121, 28))
		self.eWidthButton.setObjectName("eWidthButton")
		self.connect(self.eWidthButton, QtCore.SIGNAL("clicked()"), self.editAreaWidth)
		
		self.fColorButton = QtGui.QPushButton(Dialog)
		self.fColorButton.setGeometry(QtCore.QRect(230, 290, 92, 28))
		self.fColorButton.setObjectName("fColorButton")
		
		self.fOpacityButton = QtGui.QPushButton(Dialog)
		self.fOpacityButton.setGeometry(QtCore.QRect(330, 290, 92, 28))
		self.fOpacityButton.setObjectName("fOpacityButton")
		
		self.fIntensityButton = QtGui.QPushButton(Dialog)
		self.fIntensityButton.setGeometry(QtCore.QRect(230, 320, 92, 28))
		self.fIntensityButton.setObjectName("fIntensityButton")
		
		self.fUnkButton = QtGui.QPushButton(Dialog)
		self.fUnkButton.setGeometry(QtCore.QRect(330, 320, 92, 28))
		self.fUnkButton.setObjectName("fUnkButton")
		
		self.fSizeButton = QtGui.QPushButton(Dialog)
		self.fSizeButton.setGeometry(QtCore.QRect(430, 290, 92, 28))
		self.fSizeButton.setObjectName("fSizeButton")
		
		self.textureBox = QtGui.QComboBox(Dialog)
		self.textureBox.setGeometry(QtCore.QRect(10, 200, 85, 27))
		self.textureBox.setObjectName("textureBox")
		
		self.xEdit = QtGui.QLineEdit(Dialog)
		self.xEdit.setGeometry(QtCore.QRect(10, 260, 31, 26))
		self.xEdit.setObjectName("xEdit")
		
		self.yEdit = QtGui.QLineEdit(Dialog)
		self.yEdit.setGeometry(QtCore.QRect(50, 260, 31, 26))
		self.yEdit.setObjectName("yEdit")
		
		self.zEdit = QtGui.QLineEdit(Dialog)
		self.zEdit.setGeometry(QtCore.QRect(90, 260, 31, 26))
		self.zEdit.setObjectName("zEdit")
		
		self.boneBox = QtGui.QComboBox(Dialog)
		self.boneBox.setGeometry(QtCore.QRect(120, 200, 85, 27))
		self.boneBox.setObjectName("boneBox")
		
		self.typeBox = QtGui.QComboBox(Dialog)
		self.typeBox.setGeometry(QtCore.QRect(130, 260, 85, 27))
		self.typeBox.setObjectName("typeBox")
		self.typeBox.addItem("")
		self.typeBox.addItem("")
		self.typeBox.addItem("")
		
		self.htBox = QtGui.QComboBox(Dialog)
		self.htBox.setGeometry(QtCore.QRect(10, 300, 85, 27))
		self.htBox.setObjectName("htBox")
		self.htBox.addItem("")
		self.htBox.addItem("")
		self.htBox.addItem("")
		
		self.particleColorBox = QtGui.QComboBox(Dialog)
		self.particleColorBox.setGeometry(QtCore.QRect(110, 300, 85, 27))
		self.particleColorBox.setObjectName("particleColorBox")
		self.particleColorBox.addItem("")
		self.particleColorBox.addItem("")
		self.particleColorBox.addItem("")
		self.particleColorBox.addItem("")
		
		self.mFileLabel = QtGui.QLabel(Dialog)
		self.mFileLabel.setGeometry(QtCore.QRect(10, 80, 111, 18))
		self.mFileLabel.setObjectName("mFileLabel")
		
		self.pFileLabel = QtGui.QLabel(Dialog)
		self.pFileLabel.setGeometry(QtCore.QRect(10, 140, 131, 18))
		self.pFileLabel.setObjectName("pFileLabel")
		
		self.posLabel = QtGui.QLabel(Dialog)
		self.posLabel.setGeometry(QtCore.QRect(10, 240, 81, 18))
		self.posLabel.setObjectName("posLabel")

		self.retranslateUi(Dialog)
		QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("accepted()"), Dialog.accept)
		QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("rejected()"), Dialog.reject)
		QtCore.QMetaObject.connectSlotsByName(Dialog)

	def retranslateUi(self, Dialog):
		Dialog.setWindowTitle(QtGui.QApplication.translate("Dialog", "Dialog", None, QtGui.QApplication.UnicodeUTF8))
		self.addButton.setText(QtGui.QApplication.translate("Dialog", "Add", None, QtGui.QApplication.UnicodeUTF8))
		self.eSpeedButton.setText(QtGui.QApplication.translate("Dialog", "EmissionSpeed", None, QtGui.QApplication.UnicodeUTF8))
		self.speedVarButton.setText(QtGui.QApplication.translate("Dialog", "SpeedVariation", None, QtGui.QApplication.UnicodeUTF8))
		self.vertRangeButton.setText(QtGui.QApplication.translate("Dialog", "Vertical Range", None, QtGui.QApplication.UnicodeUTF8))
		self.horRangeButton.setText(QtGui.QApplication.translate("Dialog", "Horizontal Range", None, QtGui.QApplication.UnicodeUTF8))
		self.gravButton.setText(QtGui.QApplication.translate("Dialog", "Gravity", None, QtGui.QApplication.UnicodeUTF8))
		self.lifeButton.setText(QtGui.QApplication.translate("Dialog", "Lifespan", None, QtGui.QApplication.UnicodeUTF8))
		self.eRateButton.setText(QtGui.QApplication.translate("Dialog", "EmissionRate", None, QtGui.QApplication.UnicodeUTF8))
		self.grav2Button.setText(QtGui.QApplication.translate("Dialog", "Strong Gravity", None, QtGui.QApplication.UnicodeUTF8))
		self.eLengthButton.setText(QtGui.QApplication.translate("Dialog", "Area Length", None, QtGui.QApplication.UnicodeUTF8))
		self.eWidthButton.setText(QtGui.QApplication.translate("Dialog", "Area Width", None, QtGui.QApplication.UnicodeUTF8))
		self.fColorButton.setText(QtGui.QApplication.translate("Dialog", "Color", None, QtGui.QApplication.UnicodeUTF8))
		self.fOpacityButton.setText(QtGui.QApplication.translate("Dialog", "Opacity", None, QtGui.QApplication.UnicodeUTF8))
		self.fIntensityButton.setText(QtGui.QApplication.translate("Dialog", "Intensity", None, QtGui.QApplication.UnicodeUTF8))
		self.fUnkButton.setText(QtGui.QApplication.translate("Dialog", "Unknown", None, QtGui.QApplication.UnicodeUTF8))
		self.fSizeButton.setText(QtGui.QApplication.translate("Dialog", "Size", None, QtGui.QApplication.UnicodeUTF8))
		self.typeBox.setItemText(0, QtGui.QApplication.translate("Dialog", "Plane", None, QtGui.QApplication.UnicodeUTF8))
		self.typeBox.setItemText(1, QtGui.QApplication.translate("Dialog", "Sphere", None, QtGui.QApplication.UnicodeUTF8))
		self.typeBox.setItemText(2, QtGui.QApplication.translate("Dialog", "Spline (exists?)", None, QtGui.QApplication.UnicodeUTF8))
		self.htBox.setItemText(0, QtGui.QApplication.translate("Dialog", "Head", None, QtGui.QApplication.UnicodeUTF8))
		self.htBox.setItemText(1, QtGui.QApplication.translate("Dialog", "Tail", None, QtGui.QApplication.UnicodeUTF8))
		self.htBox.setItemText(2, QtGui.QApplication.translate("Dialog", "Both", None, QtGui.QApplication.UnicodeUTF8))
		self.particleColorBox.setItemText(0, QtGui.QApplication.translate("Dialog", "None", None, QtGui.QApplication.UnicodeUTF8))
		self.particleColorBox.setItemText(1, QtGui.QApplication.translate("Dialog", "One (11)", None, QtGui.QApplication.UnicodeUTF8))
		self.particleColorBox.setItemText(2, QtGui.QApplication.translate("Dialog", "Two (12)", None, QtGui.QApplication.UnicodeUTF8))
		self.particleColorBox.setItemText(3, QtGui.QApplication.translate("Dialog", "Three (13)", None, QtGui.QApplication.UnicodeUTF8))
		self.mFileLabel.setText(QtGui.QApplication.translate("Dialog", "ModelFileName:", None, QtGui.QApplication.UnicodeUTF8))
		self.pFileLabel.setText(QtGui.QApplication.translate("Dialog", "ParticleFileName:", None, QtGui.QApplication.UnicodeUTF8))
		self.posLabel.setText(QtGui.QApplication.translate("Dialog", "Position:", None, QtGui.QApplication.UnicodeUTF8))



	def finalizeMe(self):
		self.saveOld()
		self.accept()

	def setCurrentEditing(self,i):
		self.chooseBox.setCurrentIndex(i)
		self.changeEdit()

	def setModel(self,m2,skin):
		self.m2 = m2
		self.skin = skin
		for i in range(len(self.m2.particle_emitters)):
			self.chooseBox.addItem(str(i))

		for i in range(len(self.m2.textures)):
			self.textureBox.addItem(str(i) + ": " + TextureTypes[self.m2.textures[i].type] + " " + str(self.m2.textures[i].name))
			
		for i in range(len(self.m2.bones)+1):
			if i == 0:
				self.boneBox.addItem("None "+str(i-1))
			else:
				self.boneBox.addItem("Bone: "+str(i-1)+" "+KeyBoneTypes[self.m2.bones[i-1].KeyBoneId])
				
		self.last = -1
		self.changeEdit()
		
		
	def addParticle(self,parbone = 0):
		l = m2.Particle()
		l.bone = parbone
		l.emission_speed.type = m2.DATA_FLOAT
		l.speed_var.type = m2.DATA_FLOAT
		l.vert_range.type = m2.DATA_FLOAT
		l.hor_range.type = m2.DATA_FLOAT
		l.gravity.type = m2.DATA_FLOAT
		l.lifespan.type = m2.DATA_FLOAT
		l.emission_rate.type = m2.DATA_FLOAT
		l.emission_area_len.type = m2.DATA_FLOAT
		l.emission_area_width.type = m2.DATA_FLOAT
		l.gravity2.type = m2.DATA_FLOAT

		self.m2.particle_emitters.append(l)
		
		self.chooseBox.addItem(str(self.m2.hdr.particle_emitters.count))
		self.m2.hdr.particle_emitters.count += 1
		if(self.last == -1):
			changeEdit()

	def saveOld(self):
		if (self.last == -1):
			return	
			
		p = self.m2.particle_emitters[self.last]
		p.Pos.x = float(self.xEdit.text())
		p.Pos.y = float(self.yEdit.text())
		p.Pos.z = float(self.zEdit.text())
		
		
		name = str(self.modelEdit.text())
		p.ModelName = makeZeroTerminated(name)
		p.lenModel = len(p.ModelName)
		
		name = str(self.particleEdit.text())
		p.ParticleName =makeZeroTerminated(name)
		p.lenParticle = len(p.ParticleName)
		
		p.bone = self.boneBox.currentIndex()-1
		p.texture = self.textureBox.currentIndex()
		cdbc = self.particleColorBox.currentIndex()
		p.color_dbc = cdbc if (cdbc == 0) else cdbc+10
		p.head_or_tail = self.htBox.currentIndex()
		p.particletype = self.typeBox.currentIndex()
		
		self.m2.particle_emitters[self.last] = p
			
			
	def changeEdit(self):
		self.saveOld()
		if(self.chooseBox.count() == 0):
			return
		self.last = self.chooseBox.currentIndex()
		p = self.m2.particle_emitters[self.last]
		self.boneBox.setCurrentIndex(p.bone+1)
		self.textureBox.setCurrentIndex(p.texture)
		self.particleColorBox.setCurrentIndex(p.color_dbc-10 if( p.color_dbc in (11,12,13)) else 0)
		self.htBox.setCurrentIndex(p.head_or_tail)
		self.typeBox.setCurrentIndex(p.particletype)
		
		self.xEdit.setText(str(p.Pos.x))
		self.yEdit.setText(str(p.Pos.y))
		self.zEdit.setText(str(p.Pos.z))
		
		self.modelEdit.setText(p.ModelName)
		self.particleEdit.setText(p.ParticleName)
		
	

	def editEmissionSpeed(self):		
		temp = self.chooseBox.currentIndex()
		self.eSpeedEditor = AnimEditor()
		self.eSpeedEditor.setAnimBlock(self.m2.particle_emitters[temp].emission_speed,self.m2.gSequ)
		self.eSpeedEditor.show()
		self.connect(self.eSpeedEditor,QtCore.SIGNAL("AnimBlockEdited()"),self.setEmissionSpeed)

	def setEmissionSpeed(self):
		self.m2.particle_emitters[self.chooseBox.currentIndex()].emission_speed = self.eSpeedEditor.getAnimBlock()
		
	

	def editSpeedVariation(self):		
		temp = self.chooseBox.currentIndex()
		self.eSpeedVarEditor = AnimEditor()
		self.eSpeedVarEditor.setAnimBlock(self.m2.particle_emitters[temp].speed_var,self.m2.gSequ)
		self.eSpeedVarEditor.show()
		self.connect(self.eSpeedVarEditor,QtCore.SIGNAL("AnimBlockEdited()"),self.setSpeedVariation)

	def setSpeedVariation(self):
		self.m2.particle_emitters[self.chooseBox.currentIndex()].speed_var = self.eSpeedVarEditor.getAnimBlock()
		
	

	def editVerticalRange(self):		
		temp = self.chooseBox.currentIndex()
		self.VertRangeEditor = AnimEditor()
		self.VertRangeEditor.setAnimBlock(self.m2.particle_emitters[temp].vert_range,self.m2.gSequ)
		self.VertRangeEditor.show()
		self.connect(self.VertRangeEditor,QtCore.SIGNAL("AnimBlockEdited()"),self.setVerticalRange)

	def setVerticalRange(self):
		self.m2.particle_emitters[self.chooseBox.currentIndex()].vert_range = self.VertRangeEditor.getAnimBlock()
		
	

	def editHorizontalRange(self):		
		temp = self.chooseBox.currentIndex()
		self.HorRangeEditor = AnimEditor()
		self.HorRangeEditor.setAnimBlock(self.m2.particle_emitters[temp].hor_range,self.m2.gSequ)
		self.HorRangeEditor.show()
		self.connect(self.HorRangeEditor,QtCore.SIGNAL("AnimBlockEdited()"),self.setHorizontalRange)

	def setHorizontalRange(self):
		self.m2.particle_emitters[self.chooseBox.currentIndex()].hor_range = self.HorRangeEditor.getAnimBlock()
		
	

	def editGravity(self):		
		temp = self.chooseBox.currentIndex()
		self.GravEditor = AnimEditor()
		self.GravEditor.setAnimBlock(self.m2.particle_emitters[temp].gravity,self.m2.gSequ)
		self.GravEditor.show()
		self.connect(self.GravEditor,QtCore.SIGNAL("AnimBlockEdited()"),self.setGravity)

	def setGravity(self):
		self.m2.particle_emitters[self.chooseBox.currentIndex()].gravity = self.GravEditor.getAnimBlock()
		
	

	def editLifespan(self):		
		temp = self.chooseBox.currentIndex()
		self.lifespanEditor = AnimEditor()
		self.lifespanEditor.setAnimBlock(self.m2.particle_emitters[temp].lifespan,self.m2.gSequ)
		self.lifespanEditor.show()
		self.connect(self.lifespanEditor,QtCore.SIGNAL("AnimBlockEdited()"),self.setLifespan)

	def setLifespan(self):
		self.m2.particle_emitters[self.chooseBox.currentIndex()].lifespan = self.lifespanEditor.getAnimBlock()
		
	

	def editEmissionRate(self):		
		temp = self.chooseBox.currentIndex()
		self.eRateEditor = AnimEditor()
		self.eRateEditor.setAnimBlock(self.m2.particle_emitters[temp].emission_rate,self.m2.gSequ)
		self.eRateEditor.show()
		self.connect(self.eRateEditor,QtCore.SIGNAL("AnimBlockEdited()"),self.setEmissionRate)

	def setEmissionRate(self):
		self.m2.particle_emitters[self.chooseBox.currentIndex()].emission_rate = self.eRateEditor.getAnimBlock()
		
	

	def editAreaLength(self):		
		temp = self.chooseBox.currentIndex()
		self.eAreaLengthEditor = AnimEditor()
		self.eAreaLengthEditor.setAnimBlock(self.m2.particle_emitters[temp].emission_area_len,self.m2.gSequ)
		self.eAreaLengthEditor.show()
		self.connect(self.eAreaLengthEditor,QtCore.SIGNAL("AnimBlockEdited()"),self.setAreaLength)

	def setAreaLength(self):
		self.m2.particle_emitters[self.chooseBox.currentIndex()].emission_area_len = self.eAreaLengthEditor.getAnimBlock()
		
	

	def editAreaWidth(self):		
		temp = self.chooseBox.currentIndex()
		self.eAreaWidthEditor = AnimEditor()
		self.eAreaWidthEditor.setAnimBlock(self.m2.particle_emitters[temp].emission_area_width,self.m2.gSequ)
		self.eAreaWidthEditor.show()
		self.connect(self.eAreaWidthEditor,QtCore.SIGNAL("AnimBlockEdited()"),self.setAreaWidth)

	def setAreaWidth(self):
		self.m2.particle_emitters[self.chooseBox.currentIndex()].emission_area_width = self.eAreaWidthEditor.getAnimBlock()
		
	

	def editStrongGravity(self):		
		temp = self.chooseBox.currentIndex()
		self.strongGravEditor = AnimEditor()
		self.strongGravEditor.setAnimBlock(self.m2.particle_emitters[temp].gravity2,self.m2.gSequ)
		self.strongGravEditor.show()
		self.connect(self.strongGravEditor,QtCore.SIGNAL("AnimBlockEdited()"),self.setStrongGravity)

	def setStrongGravity(self):
		self.m2.particle_emitters[self.chooseBox.currentIndex()].gravity2 = self.strongGravEditor.getAnimBlock()
示例#38
0
class LightEditor(QtGui.QDialog):
	def __init__(self): 
		QtGui.QDialog.__init__(self) 
		self.setupUi(self)
		self.last = -1
		
	def setupUi(self, Dialog):
		Dialog.setObjectName("Dialog")
		Dialog.resize(450, 323)
		
		self.buttonBox = QtGui.QDialogButtonBox(Dialog)
		self.buttonBox.setGeometry(QtCore.QRect(90, 280, 341, 32))
		self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
		self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok)
		self.buttonBox.setObjectName("buttonBox")
		
		self.lightList = QtGui.QComboBox(Dialog)
		self.lightList.setGeometry(QtCore.QRect(10, 10, 69, 22))
		self.lightList.setObjectName("lightList")
		self.connect(self.lightList, QtCore.SIGNAL("currentIndexChanged(int)"), self.changeEdit) 
		
		self.line = QtGui.QFrame(Dialog)
		self.line.setGeometry(QtCore.QRect(10, 40, 211, 16))
		self.line.setFrameShape(QtGui.QFrame.HLine)
		self.line.setFrameShadow(QtGui.QFrame.Sunken)
		self.line.setObjectName("line")
		
		self.addIcon = QtGui.QIcon("Icons/edit-add.png")
		self.addButton = QtGui.QPushButton(self.addIcon,"Add",Dialog)
		self.addButton.setGeometry(QtCore.QRect(100, 10, 75, 23))
		self.addButton.setObjectName("addButton")
		self.connect(self.addButton, QtCore.SIGNAL("clicked()"), self.addLight)
		
		self.boneBox = QtGui.QComboBox(Dialog)
		self.boneBox.setGeometry(QtCore.QRect(10, 60, 101, 22))
		self.boneBox.setObjectName("boneBox")
		
		self.typeBox = QtGui.QComboBox(Dialog)
		self.typeBox.setGeometry(QtCore.QRect(10, 100, 101, 22))
		self.typeBox.setObjectName("typeBox")
		self.typeBox.addItem(LightTypes[0])
		self.typeBox.addItem(LightTypes[1])
		
		self.xPos = QtGui.QLineEdit(Dialog)
		self.xPos.setGeometry(QtCore.QRect(10, 160, 31, 20))
		self.xPos.setObjectName("xPos")
		
		self.yPos = QtGui.QLineEdit(Dialog)
		self.yPos.setGeometry(QtCore.QRect(50, 160, 31, 20))
		self.yPos.setObjectName("yPos")
		
		self.zPos = QtGui.QLineEdit(Dialog)
		self.zPos.setGeometry(QtCore.QRect(90, 160, 31, 20))
		self.zPos.setObjectName("zPos")
		
		self.label = QtGui.QLabel(Dialog)
		self.label.setGeometry(QtCore.QRect(10, 140, 46, 13))
		self.label.setObjectName("label")
		
		self.ambientColorButton = QtGui.QPushButton(Dialog)
		self.ambientColorButton.setGeometry(QtCore.QRect(150, 60, 75, 23))
		self.ambientColorButton.setObjectName("ambientColorButton")
		self.connect(self.ambientColorButton, QtCore.SIGNAL("clicked()"), self.editAmbientColor)
		
		self.ambientIntButton = QtGui.QPushButton(Dialog)
		self.ambientIntButton.setGeometry(QtCore.QRect(240, 60, 75, 23))
		self.ambientIntButton.setObjectName("ambientIntButton")
		self.connect(self.ambientIntButton, QtCore.SIGNAL("clicked()"), self.editAmbientIntensity)
		
		self.diffuseColorButton = QtGui.QPushButton(Dialog)
		self.diffuseColorButton.setGeometry(QtCore.QRect(150, 100, 75, 23))
		self.diffuseColorButton.setObjectName("diffuseColorButton")
		self.connect(self.diffuseColorButton, QtCore.SIGNAL("clicked()"), self.editDiffuseColor)
		
		self.diffuseIntButton = QtGui.QPushButton(Dialog)
		self.diffuseIntButton.setGeometry(QtCore.QRect(240, 100, 75, 23))
		self.diffuseIntButton.setObjectName("diffuseIntButton")
		self.connect(self.diffuseIntButton, QtCore.SIGNAL("clicked()"), self.editDiffuseIntensity)
		
		self.attStartButton = QtGui.QPushButton(Dialog)
		self.attStartButton.setGeometry(QtCore.QRect(150, 140, 75, 23))
		self.attStartButton.setObjectName("attStartButton")
		self.connect(self.attStartButton, QtCore.SIGNAL("clicked()"), self.editAttenuationStart)
		
		self.attEndButton = QtGui.QPushButton(Dialog)
		self.attEndButton.setGeometry(QtCore.QRect(240, 140, 75, 23))
		self.attEndButton.setObjectName("attEndButton")
		self.connect(self.attEndButton, QtCore.SIGNAL("clicked()"), self.editAttenuationEnd)
		
		self.enabledButton = QtGui.QPushButton(Dialog)
		self.enabledButton.setGeometry(QtCore.QRect(10, 200, 75, 23))
		self.enabledButton.setObjectName("enabledButton")
		self.connect(self.enabledButton, QtCore.SIGNAL("clicked()"), self.editEnabled)

		self.retranslateUi(Dialog)
		QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("accepted()"), Dialog.accept)
		QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("rejected()"), Dialog.reject)
		QtCore.QMetaObject.connectSlotsByName(Dialog)

	def retranslateUi(self, Dialog):
		Dialog.setWindowTitle(QtGui.QApplication.translate("Dialog", "Light Editor", None, QtGui.QApplication.UnicodeUTF8))
		self.addButton.setText(QtGui.QApplication.translate("Dialog", "Add", None, QtGui.QApplication.UnicodeUTF8))
		self.label.setText(QtGui.QApplication.translate("Dialog", "Position:", None, QtGui.QApplication.UnicodeUTF8))
		self.ambientColorButton.setText(QtGui.QApplication.translate("Dialog", "AmbientColor", None, QtGui.QApplication.UnicodeUTF8))
		self.ambientIntButton.setText(QtGui.QApplication.translate("Dialog", "AmbientInt", None, QtGui.QApplication.UnicodeUTF8))
		self.diffuseColorButton.setText(QtGui.QApplication.translate("Dialog", "DiffuseColor", None, QtGui.QApplication.UnicodeUTF8))
		self.diffuseIntButton.setText(QtGui.QApplication.translate("Dialog", "DiffuseInt", None, QtGui.QApplication.UnicodeUTF8))
		self.attStartButton.setText(QtGui.QApplication.translate("Dialog", "AttStart", None, QtGui.QApplication.UnicodeUTF8))
		self.attEndButton.setText(QtGui.QApplication.translate("Dialog", "AttEnd", None, QtGui.QApplication.UnicodeUTF8))
		self.enabledButton.setText(QtGui.QApplication.translate("Dialog", "Enabled", None, QtGui.QApplication.UnicodeUTF8))


	def finalizeMe(self):
		self.saveOld()
		self.accept()

	def setCurrentEditing(self,i):
		self.lightList.setCurrentIndex(i)
		self.changeEdit()

	def setModel(self,m2,skin):
		self.m2 = m2
		self.skin = skin
		for i in range(len(self.m2.lights)):
			self.lightList.addItem(str(i)+": "+LightTypes[self.m2.lights[i].Type])
		for i in range(len(self.m2.bones)+1):
			if i == 0:
				self.boneBox.addItem("None "+str(i-1))
			else:
				self.boneBox.addItem("Bone: "+str(i-1)+" "+KeyBoneTypes[self.m2.bones[i-1].KeyBoneId])
		self.changeEdit()
		
		
	def addLight(self):
		l = m2.Light()
		l.AmbientCol.type = m2.DATA_VEC3
		l.AmbientInt.type = m2.DATA_FLOAT
		l.DiffuseCol.type = m2.DATA_VEC3
		l.DiffuseInt.type = m2.DATA_FLOAT
		l.AttStart.type = m2.DATA_FLOAT
		l.AttEnd.type = m2.DATA_FLOAT
		l.Enabled.type = m2.DATA_INT

		self.m2.lights.append(l)
		
		self.lightList.addItem(str(self.m2.hdr.lights.count)+": "+LightTypes[self.m2.lights[self.last].Type])
		self.m2.hdr.lights.count += 1

	def saveOld(self):
		if (self.last == -1):
			return
		self.m2.lights[self.last].Type = self.typeBox.currentIndex()
		self.m2.lights[self.last].Pos.x = float(self.xPos.text())
		self.m2.lights[self.last].Pos.y = float(self.yPos.text())
		self.m2.lights[self.last].Pos.z = float(self.zPos.text())
		self.m2.lights[self.last].Bone = self.boneBox.currentIndex()-1
		self.lightList.setItemText(self.last,str(self.last)+": "+LightTypes[self.m2.lights[self.last].Type])
			
			
			
			
	def changeEdit(self):
		self.saveOld()
		self.last = self.lightList.currentIndex()
		if not len(self.m2.lights)<1:			
			self.typeBox.setCurrentIndex(self.m2.lights[self.lightList.currentIndex()].Type)
			self.xPos.setText(str(self.m2.lights[self.lightList.currentIndex()].Pos.x))
			self.yPos.setText(str(self.m2.lights[self.lightList.currentIndex()].Pos.y))
			self.zPos.setText(str(self.m2.lights[self.lightList.currentIndex()].Pos.z))			
			self.boneBox.setCurrentIndex(self.m2.lights[self.lightList.currentIndex()].Bone+1)
			
			
	

	def editAmbientColor(self):		
		temp = self.lightList.currentIndex()
		self.AmbColEditor = AnimEditor()
		self.AmbColEditor.setAnimBlock(self.m2.lights[temp].AmbientCol,self.m2.gSequ)
		self.AmbColEditor.show()
		self.connect(self.AmbColEditor,QtCore.SIGNAL("AnimBlockEdited()"),self.setAmbientColor)

	def setAmbientColor(self):
		self.m2.lights[self.lightList.currentIndex()].AmbientCol = self.AmbColEditor.getAnimBlock()

	def editAmbientIntensity(self):		
		temp = self.lightList.currentIndex()
		self.AmbIntEditor = AnimEditor()
		self.AmbIntEditor.setAnimBlock(self.m2.lights[temp].AmbientInt,self.m2.gSequ)
		self.AmbIntEditor.show()
		self.connect(self.AmbIntEditor,QtCore.SIGNAL("AnimBlockEdited()"),self.setAmbientIntensity)

	def setAmbientIntensity(self):
		self.m2.lights[self.lightList.currentIndex()].AmbientInt = self.AmbIntEditor.getAnimBlock()

	def editDiffuseColor(self):		
		temp = self.lightList.currentIndex()
		self.DiffColEditor = AnimEditor()
		self.DiffColEditor.setAnimBlock(self.m2.lights[temp].DiffuseCol,self.m2.gSequ)
		self.DiffColEditor.show()
		self.connect(self.DiffColEditor,QtCore.SIGNAL("AnimBlockEdited()"),self.setDiffuseColor)

	def setDiffuseColor(self):
		self.m2.lights[self.lightList.currentIndex()].DiffuseCol = self.DiffColEditor.getAnimBlock()

	def editDiffuseIntensity(self):		
		temp = self.lightList.currentIndex()
		self.DiffIntEditor = AnimEditor()
		self.DiffIntEditor.setAnimBlock(self.m2.lights[temp].DiffuseInt,self.m2.gSequ)
		self.DiffIntEditor.show()
		self.connect(self.DiffIntEditor,QtCore.SIGNAL("AnimBlockEdited()"),self.setDiffuseIntensity)

	def setDiffuseIntensity(self):
		self.m2.lights[self.lightList.currentIndex()].DiffuseInt = self.DiffIntEditor.getAnimBlock()

	def editAttenuationStart(self):		
		temp = self.lightList.currentIndex()
		self.AttStartEditor = AnimEditor()
		self.AttStartEditor.setAnimBlock(self.m2.lights[temp].AttStart,self.m2.gSequ)
		self.AttStartEditor.show()
		self.connect(self.AttStartEditor,QtCore.SIGNAL("AnimBlockEdited()"),self.setAttenuationStart)

	def setAttenuationStart(self):
		self.m2.lights[self.lightList.currentIndex()].AttStart = self.AttStartEditor.getAnimBlock()

	def editAttenuationEnd(self):		
		temp = self.lightList.currentIndex()
		self.AttEndEditor = AnimEditor()
		self.AttEndEditor.setAnimBlock(self.m2.lights[temp].AttEnd,self.m2.gSequ)
		self.AttEndEditor.show()
		self.connect(self.AttEndEditor,QtCore.SIGNAL("AnimBlockEdited()"),self.setAttenuationEnd)

	def setAttenuationEnd(self):
		self.m2.lights[self.lightList.currentIndex()].AttEnd = self.AttEndEditor.getAnimBlock()

	def editEnabled(self):		
		temp = self.lightList.currentIndex()
		self.EnabledEditor = AnimEditor()
		self.EnabledEditor.setAnimBlock(self.m2.lights[temp].Enabled,self.m2.gSequ)
		self.EnabledEditor.show()
		self.connect(self.EnabledEditor,QtCore.SIGNAL("AnimBlockEdited()"),self.setEnabled)

	def setEnabled(self):
		self.m2.lights[self.lightList.currentIndex()].Enabled = self.EnabledEditor.getAnimBlock()
示例#39
0
	def editSpeedVariation(self):		
		temp = self.chooseBox.currentIndex()
		self.eSpeedVarEditor = AnimEditor()
		self.eSpeedVarEditor.setAnimBlock(self.m2.particle_emitters[temp].speed_var,self.m2.gSequ)
		self.eSpeedVarEditor.show()
		self.connect(self.eSpeedVarEditor,QtCore.SIGNAL("AnimBlockEdited()"),self.setSpeedVariation)
示例#40
0
	def editHorizontalRange(self):		
		temp = self.chooseBox.currentIndex()
		self.HorRangeEditor = AnimEditor()
		self.HorRangeEditor.setAnimBlock(self.m2.particle_emitters[temp].hor_range,self.m2.gSequ)
		self.HorRangeEditor.show()
		self.connect(self.HorRangeEditor,QtCore.SIGNAL("AnimBlockEdited()"),self.setHorizontalRange)
示例#41
0
class LightEditor(QtGui.QDialog):
    def __init__(self):
        QtGui.QDialog.__init__(self)
        self.setupUi(self)
        self.last = -1

    def setupUi(self, Dialog):
        Dialog.setObjectName("Dialog")
        Dialog.resize(450, 323)

        self.buttonBox = QtGui.QDialogButtonBox(Dialog)
        self.buttonBox.setGeometry(QtCore.QRect(90, 280, 341, 32))
        self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
        self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel
                                          | QtGui.QDialogButtonBox.Ok)
        self.buttonBox.setObjectName("buttonBox")

        self.lightList = QtGui.QComboBox(Dialog)
        self.lightList.setGeometry(QtCore.QRect(10, 10, 69, 22))
        self.lightList.setObjectName("lightList")
        self.connect(self.lightList, QtCore.SIGNAL("currentIndexChanged(int)"),
                     self.changeEdit)

        self.line = QtGui.QFrame(Dialog)
        self.line.setGeometry(QtCore.QRect(10, 40, 211, 16))
        self.line.setFrameShape(QtGui.QFrame.HLine)
        self.line.setFrameShadow(QtGui.QFrame.Sunken)
        self.line.setObjectName("line")

        self.addIcon = QtGui.QIcon("Icons/edit-add.png")
        self.addButton = QtGui.QPushButton(self.addIcon, "Add", Dialog)
        self.addButton.setGeometry(QtCore.QRect(100, 10, 75, 23))
        self.addButton.setObjectName("addButton")
        self.connect(self.addButton, QtCore.SIGNAL("clicked()"), self.addLight)

        self.boneBox = QtGui.QComboBox(Dialog)
        self.boneBox.setGeometry(QtCore.QRect(10, 60, 101, 22))
        self.boneBox.setObjectName("boneBox")

        self.typeBox = QtGui.QComboBox(Dialog)
        self.typeBox.setGeometry(QtCore.QRect(10, 100, 101, 22))
        self.typeBox.setObjectName("typeBox")
        self.typeBox.addItem(LightTypes[0])
        self.typeBox.addItem(LightTypes[1])

        self.xPos = QtGui.QLineEdit(Dialog)
        self.xPos.setGeometry(QtCore.QRect(10, 160, 31, 20))
        self.xPos.setObjectName("xPos")

        self.yPos = QtGui.QLineEdit(Dialog)
        self.yPos.setGeometry(QtCore.QRect(50, 160, 31, 20))
        self.yPos.setObjectName("yPos")

        self.zPos = QtGui.QLineEdit(Dialog)
        self.zPos.setGeometry(QtCore.QRect(90, 160, 31, 20))
        self.zPos.setObjectName("zPos")

        self.label = QtGui.QLabel(Dialog)
        self.label.setGeometry(QtCore.QRect(10, 140, 46, 13))
        self.label.setObjectName("label")

        self.ambientColorButton = QtGui.QPushButton(Dialog)
        self.ambientColorButton.setGeometry(QtCore.QRect(150, 60, 80, 30))
        self.ambientColorButton.setObjectName("ambientColorButton")
        self.connect(self.ambientColorButton, QtCore.SIGNAL("clicked()"),
                     self.editAmbientColor)

        self.ambientIntButton = QtGui.QPushButton(Dialog)
        self.ambientIntButton.setGeometry(QtCore.QRect(240, 60, 80, 30))
        self.ambientIntButton.setObjectName("ambientIntButton")
        self.connect(self.ambientIntButton, QtCore.SIGNAL("clicked()"),
                     self.editAmbientIntensity)

        self.diffuseColorButton = QtGui.QPushButton(Dialog)
        self.diffuseColorButton.setGeometry(QtCore.QRect(150, 100, 80, 30))
        self.diffuseColorButton.setObjectName("diffuseColorButton")
        self.connect(self.diffuseColorButton, QtCore.SIGNAL("clicked()"),
                     self.editDiffuseColor)

        self.diffuseIntButton = QtGui.QPushButton(Dialog)
        self.diffuseIntButton.setGeometry(QtCore.QRect(240, 100, 80, 30))
        self.diffuseIntButton.setObjectName("diffuseIntButton")
        self.connect(self.diffuseIntButton, QtCore.SIGNAL("clicked()"),
                     self.editDiffuseIntensity)

        self.attStartButton = QtGui.QPushButton(Dialog)
        self.attStartButton.setGeometry(QtCore.QRect(150, 140, 80, 30))
        self.attStartButton.setObjectName("attStartButton")
        self.connect(self.attStartButton, QtCore.SIGNAL("clicked()"),
                     self.editAttenuationStart)

        self.attEndButton = QtGui.QPushButton(Dialog)
        self.attEndButton.setGeometry(QtCore.QRect(240, 140, 80, 30))
        self.attEndButton.setObjectName("attEndButton")
        self.connect(self.attEndButton, QtCore.SIGNAL("clicked()"),
                     self.editAttenuationEnd)

        self.enabledButton = QtGui.QPushButton(Dialog)
        self.enabledButton.setGeometry(QtCore.QRect(10, 200, 80, 30))
        self.enabledButton.setObjectName("enabledButton")
        self.connect(self.enabledButton, QtCore.SIGNAL("clicked()"),
                     self.editEnabled)

        self.retranslateUi(Dialog)
        QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("accepted()"),
                               Dialog.finalizeMe)
        QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("rejected()"),
                               Dialog.reject)
        QtCore.QMetaObject.connectSlotsByName(Dialog)

    def retranslateUi(self, Dialog):
        Dialog.setWindowTitle(
            QtGui.QApplication.translate("Dialog", "Light Editor", None,
                                         QtGui.QApplication.UnicodeUTF8))
        self.addButton.setText(
            QtGui.QApplication.translate("Dialog", "Add", None,
                                         QtGui.QApplication.UnicodeUTF8))
        self.label.setText(
            QtGui.QApplication.translate("Dialog", "Position:", None,
                                         QtGui.QApplication.UnicodeUTF8))
        self.ambientColorButton.setText(
            QtGui.QApplication.translate("Dialog", "AmbientColor", None,
                                         QtGui.QApplication.UnicodeUTF8))
        self.ambientIntButton.setText(
            QtGui.QApplication.translate("Dialog", "AmbientInt", None,
                                         QtGui.QApplication.UnicodeUTF8))
        self.diffuseColorButton.setText(
            QtGui.QApplication.translate("Dialog", "DiffuseColor", None,
                                         QtGui.QApplication.UnicodeUTF8))
        self.diffuseIntButton.setText(
            QtGui.QApplication.translate("Dialog", "DiffuseInt", None,
                                         QtGui.QApplication.UnicodeUTF8))
        self.attStartButton.setText(
            QtGui.QApplication.translate("Dialog", "AttStart", None,
                                         QtGui.QApplication.UnicodeUTF8))
        self.attEndButton.setText(
            QtGui.QApplication.translate("Dialog", "AttEnd", None,
                                         QtGui.QApplication.UnicodeUTF8))
        self.enabledButton.setText(
            QtGui.QApplication.translate("Dialog", "Enabled", None,
                                         QtGui.QApplication.UnicodeUTF8))

    def finalizeMe(self):
        self.saveOld()
        self.accept()

    def setCurrentEditing(self, i):
        self.lightList.setCurrentIndex(i)
        self.changeEdit()

    def setModel(self, m2, skin):
        self.m2 = m2
        self.skin = skin
        for i in range(len(self.m2.lights)):
            self.lightList.addItem(
                str(i) + ": " + LightTypes[self.m2.lights[i].Type])
        for i in range(len(self.m2.bones) + 1):
            if i == 0:
                self.boneBox.addItem("None " + str(i - 1))
            else:
                self.boneBox.addItem("Bone: " + str(i - 1) + " " +
                                     KeyBoneTypes[self.m2.bones[i -
                                                                1].KeyBoneId])
        self.changeEdit()

    def addLight(self, parbone=0):
        l = m2.Light()
        l.Bone = parbone
        l.AmbientCol.type = m2.DATA_VEC3
        l.AmbientInt.type = m2.DATA_FLOAT
        l.DiffuseCol.type = m2.DATA_VEC3
        l.DiffuseInt.type = m2.DATA_FLOAT
        l.AttStart.type = m2.DATA_FLOAT
        l.AttEnd.type = m2.DATA_FLOAT
        l.Enabled.type = m2.DATA_INT

        self.m2.lights.append(l)

        self.lightList.addItem(
            str(self.m2.hdr.lights.count) + ": " +
            LightTypes[self.m2.lights[self.last].Type])
        self.m2.hdr.lights.count += 1

    def saveOld(self):
        if (self.last == -1):
            return
        self.m2.lights[self.last].Type = self.typeBox.currentIndex()
        self.m2.lights[self.last].Pos.x = float(self.xPos.text())
        self.m2.lights[self.last].Pos.y = float(self.yPos.text())
        self.m2.lights[self.last].Pos.z = float(self.zPos.text())
        self.m2.lights[self.last].Bone = self.boneBox.currentIndex() - 1
        self.lightList.setItemText(
            self.last,
            str(self.last) + ": " + LightTypes[self.m2.lights[self.last].Type])

    def changeEdit(self):
        self.saveOld()
        self.last = self.lightList.currentIndex()
        if not len(self.m2.lights) < 1:
            self.typeBox.setCurrentIndex(
                self.m2.lights[self.lightList.currentIndex()].Type)
            self.xPos.setText(
                str(self.m2.lights[self.lightList.currentIndex()].Pos.x))
            self.yPos.setText(
                str(self.m2.lights[self.lightList.currentIndex()].Pos.y))
            self.zPos.setText(
                str(self.m2.lights[self.lightList.currentIndex()].Pos.z))
            self.boneBox.setCurrentIndex(
                self.m2.lights[self.lightList.currentIndex()].Bone + 1)

    def editAmbientColor(self):
        temp = self.lightList.currentIndex()
        self.AmbColEditor = AnimColorEditor()
        self.AmbColEditor.setAnimBlock(self.m2.lights[temp].AmbientCol,
                                       self.m2.gSequ)
        self.AmbColEditor.show()
        self.connect(self.AmbColEditor, QtCore.SIGNAL("AnimBlockEdited()"),
                     self.setAmbientColor)

    def setAmbientColor(self):
        self.m2.lights[self.lightList.currentIndex(
        )].AmbientCol = self.AmbColEditor.getAnimBlock()

    def editAmbientIntensity(self):
        temp = self.lightList.currentIndex()
        self.AmbIntEditor = AnimEditor()
        self.AmbIntEditor.setAnimBlock(self.m2.lights[temp].AmbientInt,
                                       self.m2.gSequ)
        self.AmbIntEditor.show()
        self.connect(self.AmbIntEditor, QtCore.SIGNAL("AnimBlockEdited()"),
                     self.setAmbientIntensity)

    def setAmbientIntensity(self):
        self.m2.lights[self.lightList.currentIndex(
        )].AmbientInt = self.AmbIntEditor.getAnimBlock()

    def editDiffuseColor(self):
        temp = self.lightList.currentIndex()
        self.DiffColEditor = AnimColorEditor()
        self.DiffColEditor.setAnimBlock(self.m2.lights[temp].DiffuseCol,
                                        self.m2.gSequ)
        self.DiffColEditor.show()
        self.connect(self.DiffColEditor, QtCore.SIGNAL("AnimBlockEdited()"),
                     self.setDiffuseColor)

    def setDiffuseColor(self):
        self.m2.lights[self.lightList.currentIndex(
        )].DiffuseCol = self.DiffColEditor.getAnimBlock()

    def editDiffuseIntensity(self):
        temp = self.lightList.currentIndex()
        self.DiffIntEditor = AnimEditor()
        self.DiffIntEditor.setAnimBlock(self.m2.lights[temp].DiffuseInt,
                                        self.m2.gSequ)
        self.DiffIntEditor.show()
        self.connect(self.DiffIntEditor, QtCore.SIGNAL("AnimBlockEdited()"),
                     self.setDiffuseIntensity)

    def setDiffuseIntensity(self):
        self.m2.lights[self.lightList.currentIndex(
        )].DiffuseInt = self.DiffIntEditor.getAnimBlock()

    def editAttenuationStart(self):
        temp = self.lightList.currentIndex()
        self.AttStartEditor = AnimEditor()
        self.AttStartEditor.setAnimBlock(self.m2.lights[temp].AttStart,
                                         self.m2.gSequ)
        self.AttStartEditor.show()
        self.connect(self.AttStartEditor, QtCore.SIGNAL("AnimBlockEdited()"),
                     self.setAttenuationStart)

    def setAttenuationStart(self):
        self.m2.lights[self.lightList.currentIndex(
        )].AttStart = self.AttStartEditor.getAnimBlock()

    def editAttenuationEnd(self):
        temp = self.lightList.currentIndex()
        self.AttEndEditor = AnimEditor()
        self.AttEndEditor.setAnimBlock(self.m2.lights[temp].AttEnd,
                                       self.m2.gSequ)
        self.AttEndEditor.show()
        self.connect(self.AttEndEditor, QtCore.SIGNAL("AnimBlockEdited()"),
                     self.setAttenuationEnd)

    def setAttenuationEnd(self):
        self.m2.lights[self.lightList.currentIndex(
        )].AttEnd = self.AttEndEditor.getAnimBlock()

    def editEnabled(self):
        temp = self.lightList.currentIndex()
        self.EnabledEditor = AnimEditor()
        self.EnabledEditor.setAnimBlock(self.m2.lights[temp].Enabled,
                                        self.m2.gSequ)
        self.EnabledEditor.show()
        self.connect(self.EnabledEditor, QtCore.SIGNAL("AnimBlockEdited()"),
                     self.setEnabled)

    def setEnabled(self):
        self.m2.lights[self.lightList.currentIndex(
        )].Enabled = self.EnabledEditor.getAnimBlock()
示例#42
0
class TransparencyChooser(QtGui.QDialog):
    def __init__(self):
        QtGui.QDialog.__init__(self)
        self.setupUi(self)

    def setupUi(self, Dialog):
        Dialog.setObjectName("Dialog")
        Dialog.resize(514, 300)

        self.buttonBox = QtGui.QDialogButtonBox(Dialog)
        self.buttonBox.setGeometry(QtCore.QRect(410, 10, 101, 81))
        self.buttonBox.setOrientation(QtCore.Qt.Vertical)
        self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel
                                          | QtGui.QDialogButtonBox.Ok)
        self.buttonBox.setObjectName("buttonBox")

        self.comboBox = QtGui.QComboBox(Dialog)
        self.comboBox.setGeometry(QtCore.QRect(10, 10, 85, 27))
        self.comboBox.setObjectName("comboBox")
        self.connect(self.comboBox, QtCore.SIGNAL("currentIndexChanged(int)"),
                     self.changeEdit)

        self.editButton = QtGui.QPushButton(Dialog)
        self.editButton.setGeometry(QtCore.QRect(110, 10, 92, 28))
        self.editButton.setObjectName("editButton")
        self.connect(self.editButton, QtCore.SIGNAL("clicked()"),
                     self.editTransparency)

        self.addIcon = QtGui.QIcon("Icons/edit-add.png")
        self.addButton = QtGui.QPushButton(self.addIcon, "Add", Dialog)
        self.addButton.setGeometry(QtCore.QRect(210, 10, 92, 28))
        self.addButton.setObjectName("addButton")
        self.connect(self.addButton, QtCore.SIGNAL("clicked()"),
                     self.addTransparency)

        self.line = QtGui.QFrame(Dialog)
        self.line.setGeometry(QtCore.QRect(10, 40, 201, 21))
        self.line.setFrameShape(QtGui.QFrame.HLine)
        self.line.setFrameShadow(QtGui.QFrame.Sunken)
        self.line.setObjectName("line")

        self.label = QtGui.QLabel(Dialog)
        self.label.setGeometry(QtCore.QRect(20, 70, 361, 211))
        self.label.setObjectName("label")

        self.retranslateUi(Dialog)
        QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("accepted()"),
                               Dialog.accept)
        QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("rejected()"),
                               Dialog.reject)
        QtCore.QMetaObject.connectSlotsByName(Dialog)

    def retranslateUi(self, Dialog):
        Dialog.setWindowTitle(
            QtGui.QApplication.translate("Dialog", "Edit Transparency", None,
                                         QtGui.QApplication.UnicodeUTF8))
        self.editButton.setText(
            QtGui.QApplication.translate("Dialog", "Edit", None,
                                         QtGui.QApplication.UnicodeUTF8))
        self.addButton.setText(
            QtGui.QApplication.translate("Dialog", "Add", None,
                                         QtGui.QApplication.UnicodeUTF8))
        self.label.setText(
            QtGui.QApplication.translate("Dialog", "Transparency used by:",
                                         None, QtGui.QApplication.UnicodeUTF8))

    def setModel(self, m2):
        self.m2 = m2
        for i in range(len(self.m2.transparency)):
            self.comboBox.addItem(str(i))
        self.changeEdit()

    def changeEdit(self):
        s = "This transparency is used by:\n"
        for i in self.m2.materials[0]:
            try:
                if (self.m2.trans_lookup[i.transparency].Id ==
                        self.comboBox.currentIndex()):
                    s += "Layer " + str(i.flags) + " Geoset " + str(
                        i.submesh) + ":" + str(i.submesh2) + "\n"
            except:
                pass
        self.label.setText(s)

    def setTransparency(self):
        self.m2.transparency[self.comboBox.currentIndex(
        )].alpha = self.TransparencyEditor.getAnimBlock()

    def editTransparency(self):
        transparency = self.comboBox.currentIndex()
        self.TransparencyEditor = AnimEditor()
        self.TransparencyEditor.setAnimBlock(
            self.m2.transparency[transparency].alpha, self.m2.gSequ)
        self.TransparencyEditor.show()
        self.connect(self.TransparencyEditor,
                     QtCore.SIGNAL("AnimBlockEdited()"), self.setTransparency)

    def addTransparency(self):
        tr = m2.Transparency()
        tr.alpha.type = m2.DATA_SHORT

        tl = m2.Lookup()
        tl.Id = self.m2.hdr.transparency.count

        self.comboBox.addItem(str(len(self.m2.transparency)))

        self.m2.transparency.append(tr)
        self.m2.hdr.transparency.count += 1

        self.m2.trans_lookup.append(tl)
        self.m2.hdr.trans_lookup.count += 1