当前位置: 首页>>代码示例>>Python>>正文


Python AnimEditor.setAnimBlock方法代码示例

本文整理汇总了Python中animeditor.AnimEditor.setAnimBlock方法的典型用法代码示例。如果您正苦于以下问题:Python AnimEditor.setAnimBlock方法的具体用法?Python AnimEditor.setAnimBlock怎么用?Python AnimEditor.setAnimBlock使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在animeditor.AnimEditor的用法示例。


在下文中一共展示了AnimEditor.setAnimBlock方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: TransparencyChooser

# 需要导入模块: from animeditor import AnimEditor [as 别名]
# 或者: from animeditor.AnimEditor import setAnimBlock [as 别名]
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
开发者ID:GanjaNoel,项目名称:pym2,代码行数:98,代码来源:transparencychooser.py

示例2: BoneEditor

# 需要导入模块: from animeditor import AnimEditor [as 别名]
# 或者: from animeditor.AnimEditor import setAnimBlock [as 别名]

#.........这里部分代码省略.........
		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)
开发者ID:GanjaNoel,项目名称:pym2,代码行数:104,代码来源:boneeditor.py

示例3: ParticleEditor

# 需要导入模块: from animeditor import AnimEditor [as 别名]
# 或者: from animeditor.AnimEditor import setAnimBlock [as 别名]

#.........这里部分代码省略.........
		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()
		
	
开发者ID:GanjaNoel,项目名称:pym2,代码行数:67,代码来源:particleeditor.py

示例4: UVAnimEditor

# 需要导入模块: from animeditor import AnimEditor [as 别名]
# 或者: from animeditor.AnimEditor import setAnimBlock [as 别名]
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)

#.........这里部分代码省略.........
开发者ID:GanjaNoel,项目名称:pym2,代码行数:103,代码来源:uvanimeditor.py

示例5: ColorEditor

# 需要导入模块: from animeditor import AnimEditor [as 别名]
# 或者: from animeditor.AnimEditor import setAnimBlock [as 别名]
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)
		
#.........这里部分代码省略.........
开发者ID:GanjaNoel,项目名称:pym2,代码行数:103,代码来源:coloreditor.py

示例6: AttachmentEditor

# 需要导入模块: from animeditor import AnimEditor [as 别名]
# 或者: from animeditor.AnimEditor import setAnimBlock [as 别名]

#.........这里部分代码省略.........
		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()
开发者ID:GanjaNoel,项目名称:pym2,代码行数:104,代码来源:attachmenteditor.py

示例7: LightEditor

# 需要导入模块: from animeditor import AnimEditor [as 别名]
# 或者: from animeditor.AnimEditor import setAnimBlock [as 别名]

#.........这里部分代码省略.........
		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()
开发者ID:GanjaNoel,项目名称:pym2,代码行数:104,代码来源:lighteditor.py


注:本文中的animeditor.AnimEditor.setAnimBlock方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。