def initUI(self): grp = QGroupBox('Model') grplay = QGridLayout() name = QLineEdit() name.setText(self.mdl.name) name.textChanged.connect(self.name_changed) self.controls['name'] = name grplay.addWidget(QLabel('Name'), 0, 0) grplay.addWidget(name, 0, 1) parent = QLineEdit() parent.setText(self.mdl.parent_name) self.controls['parent'] = parent grplay.addWidget(QLabel('Parent'), 0, 2) grplay.addWidget(parent, 0, 3) type_ = QComboBox() type_.addItems(self.types) type_.setCurrentIndex(self.types2[self.mdl.model_type]) self.controls['type'] = type_ grplay.addWidget(QLabel('Type'), 1, 0) grplay.addWidget(type_, 1, 1) vis = QCheckBox() if self.mdl.vis: vis.toggle() self.controls['vis'] = vis grplay.addWidget(QLabel('Hidden'), 1, 2) grplay.addWidget(vis, 1, 3) buttonlay = QHBoxLayout() collprim = QPushButton('Collision Primitive') buttonlay.addWidget(collprim) collprim.clicked.connect(self.edit_collprim) deformers = QPushButton('Deformers') deformers.clicked.connect(self.edit_deformers) buttonlay.addWidget(deformers) bbox_btn = QPushButton('Bounding Box') bbox_btn.clicked.connect(self.edit_bbox) trans = QPushButton('Transform') trans.clicked.connect(self.edit_tran) buttonlay.addWidget(bbox_btn) buttonlay.addWidget(trans) buttonlay2 = QHBoxLayout() validate = QPushButton('Validate') validate.clicked.connect(self.validate) uvs = QPushButton('UVs') uvs.clicked.connect(self.show_uvs) buttonlay2.addWidget(validate) buttonlay2.addWidget(uvs) buttonlay2.addStretch() grplay.addLayout(buttonlay, 2, 0, 1, 4) grplay.addLayout(buttonlay2, 3, 0, 1, 4) grp.setLayout(grplay) geogrp = QGroupBox('Geometry') geolay = QHBoxLayout() self.geometries = QListWidget() self.geometries.addItems(['{0} - {1}'.format(ind, geo.classname) for ind, geo in enumerate(self.mdl.segments)]) geolay.addStretch() geolay.addWidget(self.geometries) edit_geo = QPushButton('Edit') edit_geo.clicked.connect(self.edit_geo) geolay.addWidget(edit_geo) geogrp.setLayout(geolay) btns = QHBoxLayout() save = QPushButton('Save') save.clicked.connect(self.save) cancel = QPushButton('Cancel') cancel.clicked.connect(self.close) self.status = QLabel('Model Edit Mode') btns.addWidget(self.status) btns.addStretch() btns.addWidget(save) btns.addWidget(cancel) mainlay = QVBoxLayout() mainlay.addWidget(grp) mainlay.addWidget(geogrp) mainlay.addLayout(btns) self.setLayout(mainlay) self.setGeometry(340, 340, 400, 200) self.setWindowTitle('MSH Suite - {0}'.format(self.mdl.name)) self.show()
def initUI(self): grp = QGroupBox('Material') grplay = QGridLayout() name = QLineEdit() name.setText(self.mat.name) self.controls['name'] = name tex0 = QLineEdit() tex0.setText(self.mat.tex0) self.controls['tex0'] = tex0 tex1 = QLineEdit() tex1.setText(self.mat.tex1) self.controls['tex1'] = tex1 tex2 = QLineEdit() tex2.setText(self.mat.tex2) self.controls['tex2'] = tex2 tex3 = QLineEdit() tex3.setText(self.mat.tex3) self.controls['tex3'] = tex3 flags = QGroupBox('Flags') fllay = QGridLayout() for ind, flag in enumerate(self.mat.flags): fllay.addWidget(QLabel(self.pretty_flags[flag[0]]), ind, 0) box = QCheckBox() fllay.addWidget(box, ind, 1) if flag[1]: box.toggle() self.controls[flag[0]] = box fllay.addWidget(QLabel('<b>RenderType</b>'), 8, 0) numbox = QComboBox() numbox.addItems(self.render_types) numbox.setCurrentIndex(self.mat.render_type) fllay.addWidget(numbox) self.controls['render_type'] = numbox fllay.addWidget(QLabel('<b>Data0</b>'), 9, 0) d0 = QSpinBox() d0.setValue(self.mat.data0) d0.setMinimum(0) d0.setMaximum(255) fllay.addWidget(d0) self.controls['data0'] = d0 fllay.addWidget(QLabel('<b>Data1</b>'), 10, 0) d1 = QSpinBox() d1.setValue(self.mat.data1) d1.setMinimum(0) d1.setMaximum(255) fllay.addWidget(d1) self.controls['data1'] = d1 flags.setLayout(fllay) colors = QGroupBox('Colors') collay = QGridLayout() self.add_color('<b>Diffuse</b>', self.mat.diff_color, collay, 3) self.add_color('<b>Specular</b>', self.mat.spec_color, collay, 4) self.add_color('<b>Ambient</b>', self.mat.ambt_color, collay, 5) colors.setLayout(collay) grplay.addWidget(QLabel('<b>Name</b>'), 0, 0) grplay.addWidget(name, 0, 1) grplay.addWidget(QLabel('<b>Texture0</b>'), 1, 0) grplay.addWidget(tex0, 1, 1) grplay.addWidget(QLabel('<b>Texture1</b>'), 1, 2) grplay.addWidget(tex1, 1, 3) grplay.addWidget(QLabel('<b>Texture2</b>'), 2, 0) grplay.addWidget(tex2, 2, 1) grplay.addWidget(QLabel('<b>Texture3</b>'), 2, 2) grplay.addWidget(tex3, 2, 3) grplay.addWidget(QLabel('<b>Gloss</b>'), 3, 0) gloss = QDoubleSpinBox() gloss.setValue(self.mat.gloss) grplay.addWidget(gloss, 3, 1) self.controls['gloss'] = gloss grplay.addWidget(colors, 4, 0, 1, 5) grplay.addWidget(flags, 5, 0, 1, 3) grp.setLayout(grplay) btns = QHBoxLayout() save = QPushButton('Save') save.clicked.connect(self.save) cancel = QPushButton('Cancel') cancel.clicked.connect(self.close) btns.addStretch() btns.addWidget(save) btns.addWidget(cancel) mainlay = QVBoxLayout() mainlay.addWidget(grp) mainlay.addLayout(btns) self.setLayout(mainlay) self.setGeometry(340, 340, 440, 200) self.setWindowTitle('MSH Suite - {0}'.format(self.mat.name)) self.show()
def initUI(self): grp = QGroupBox('Collision Primitive') grplay = QGridLayout() grp.setLayout(grplay) enabled = QCheckBox() benable = False if self.mdl.collprim: enabled.toggle() benable = True enabled.stateChanged.connect(self.enabled_changed) self.controls['collprim'] = enabled grplay.addWidget(QLabel('Enabled'), 0, 0) grplay.addWidget(enabled, 0, 1) widthl = QLabel('Dflt') grplay.addWidget(widthl, 1, 0) width = QDoubleSpinBox() width.setEnabled(benable) width.setValue(self.mdl.primitive[1]) grplay.addWidget(width, 1, 1) self.controls['width'] = width self.controls['widthl'] = widthl heightl = QLabel('Dflt') grplay.addWidget(heightl, 1, 2) height = QDoubleSpinBox() height.setEnabled(benable) height.setValue(self.mdl.primitive[2]) grplay.addWidget(height, 1, 3) self.controls['height'] = height self.controls['heightl'] = heightl depthl = QLabel('Dflt') grplay.addWidget(depthl, 1, 4) depth = QDoubleSpinBox() depth.setEnabled(benable) depth.setValue(self.mdl.primitive[3]) grplay.addWidget(depth, 1, 5) self.controls['depth'] = depth self.controls['depthl'] = depthl numbox = QComboBox() numbox.addItems(self.mdl.collprim_by_name.keys()) numbox.currentIndexChanged.connect(self.type_changed) numbox.setEnabled(benable) grplay.addWidget(QLabel('Type'), 0, 2) grplay.addWidget(numbox, 0, 3) self.controls['collprimtype'] = numbox if self.mdl.primitive[0] == 0: numbox.setCurrentIndex(0) elif self.mdl.primitive[0] == 1: numbox.setCurrentIndex(0) elif self.mdl.primitive[0] == 2: numbox.setCurrentIndex(1) elif self.mdl.primitive[0] == 4: numbox.setCurrentIndex(2) mainlay = QVBoxLayout() mainlay.addWidget(grp) btns = QHBoxLayout() btns.addStretch() save = QPushButton('Save') save.clicked.connect(self.save) close = QPushButton('Close') close.clicked.connect(self.close) btns.addWidget(save) btns.addWidget(close) mainlay.addLayout(btns) self.setLayout(mainlay) self.setGeometry(340, 340, 200, 120) self.setWindowTitle('MSH Suite - {0} Collision Primitive'.format(self.mdl.name)) self.update_labels() self.show()