def __init__(self):
		widgets.MainWindow.__init__(self, "FGM Editor", )
		
		self.resize(450, 500)

		self.fgm_data = FgmFile()
		self.widgets = []
		self.tooltips = config.read_config("util/tooltips/fgm.txt")
		self.shaders = {}
		for game in games:
			self.shaders[game] = config.read_list(f"util/tooltips/fgm-shaders-{game.lower().replace(' ', '-')}.txt")

		self.cleaner = QtCore.QObjectCleanupHandler()

		self.scrollarea = QtWidgets.QScrollArea(self)
		self.scrollarea.setWidgetResizable(True)
		self.setCentralWidget(self.scrollarea)

		# the actual scrollable stuff
		self.widget = QtWidgets.QWidget()
		self.scrollarea.setWidget(self.widget)

		self.game_container = widgets.LabelCombo("Game:", games)
		self.game_container.entry.currentIndexChanged.connect(self.game_changed)
		self.game_container.entry.setEditable(False)
		self.file_widget = widgets.FileWidget(self, self.cfg, dtype="FGM")
		self.shader_container = widgets.LabelCombo("Shader:", ())
		self.shader_container.entry.activated.connect(self.shader_changed)
		self.tex_container = QtWidgets.QGroupBox("Textures")
		self.attrib_container = QtWidgets.QGroupBox("Attributes")

		vbox = QtWidgets.QVBoxLayout()
		vbox.addWidget(self.file_widget)
		vbox.addWidget(self.game_container)
		vbox.addWidget(self.shader_container)
		vbox.addWidget(self.tex_container)
		vbox.addWidget(self.attrib_container)
		vbox.addStretch(1)
		self.widget.setLayout(vbox)

		self.tex_grid = self.create_grid()
		self.attrib_grid = self.create_grid()

		self.tex_container.setLayout(self.tex_grid)
		self.attrib_container.setLayout(self.attrib_grid)

		mainMenu = self.menuBar()
		fileMenu = mainMenu.addMenu('File')
		helpMenu = mainMenu.addMenu('Help')
		button_data = ( (fileMenu, "Open", self.file_widget.ask_open, "CTRL+O", ""), \
						(fileMenu, "Save", self.save_fgm, "CTRL+S", ""), \
						(fileMenu, "Exit", self.close, "", ""), \
						(helpMenu, "Report Bug", self.report_bug, "", ""), \
						(helpMenu, "Documentation", self.online_support, "", ""), \
						)
		self.add_to_menu(button_data)
Beispiel #2
0
    def __init__(self):
        widgets.MainWindow.__init__(
            self,
            "MaterialCollection Editor",
        )

        self.resize(450, 500)

        self.matcol_data = MaterialcollectionFormat.Data()
        self.file_src = ""
        self.widgets = []
        self.tooltips = config.read_config("util/tooltips/matcol.txt")
        self.games = ("Jurassic World Evolution", "Planet Zoo")
        self.default_fgms = config.read_list(
            "util/tooltips/matcol-fgm-names.txt")

        mainMenu = self.menuBar()
        fileMenu = mainMenu.addMenu('File')
        helpMenu = mainMenu.addMenu('Help')
        button_data = ( (fileMenu, "Open", self.open_materialcollection, "CTRL+O"), \
            (fileMenu, "Save", self.save_materialcollection, "CTRL+S"), \
            (fileMenu, "Exit", self.close, ""), \
            (helpMenu, "Report Bug", self.report_bug, ""), \
            (helpMenu, "Documentation", self.online_support, ""), \
            )
        self.add_to_menu(button_data)

        self.cleaner = QtCore.QObjectCleanupHandler()

        self.scrollarea = QtWidgets.QScrollArea(self)
        self.scrollarea.setWidgetResizable(True)
        self.setCentralWidget(self.scrollarea)

        # the actual scrollable stuff
        self.widget = QtWidgets.QWidget()
        self.scrollarea.setWidget(self.widget)

        self.game_container = widgets.LabelCombo("Game:", self.games)
        # self.game_container.entry.currentIndexChanged.connect(self.game_changed)
        self.game_container.entry.setEditable(False)
        self.materialcollection_container = widgets.LabelEdit("MATCOL:")
        self.tex_container = QtWidgets.QGroupBox("Slots")
        self.attrib_container = QtWidgets.QGroupBox("Attributes")

        self.vbox = QtWidgets.QVBoxLayout()
        self.vbox.addWidget(self.game_container)
        self.vbox.addWidget(self.materialcollection_container)
        self.vbox.addWidget(self.tex_container)
        self.vbox.addWidget(self.attrib_container)
        self.vbox.addStretch(1)
        self.widget.setLayout(self.vbox)

        self.tex_grid = self.create_grid()
        self.attrib_grid = self.create_grid()

        self.tex_container.setLayout(self.tex_grid)
        self.attrib_container.setLayout(self.attrib_grid)
Beispiel #3
0
	def load_materialcollection(self):
		if self.file_src:
			for w in self.widgets:
				w.deleteLater()
			self.cfg["dir_materialcollections_in"], materialcollection_name = os.path.split(self.file_src)
			try:
				self.matcol_data.load(self.file_src)
				game = self.matcol_data.game
				print("from game", game)
				self.game_container.entry.setText(game)

				self.materialcollection_container.entry.setText( materialcollection_name )

				# delete existing widgets
				self.clear_layout(self.tex_grid)
				self.clear_layout(self.attrib_grid)

				self.tex_grid = self.create_grid()
				self.attrib_grid = self.create_grid()

				self.tex_container.setLayout(self.tex_grid)
				self.attrib_container.setLayout(self.attrib_grid)
				line_i = 0
				for i, tex in enumerate(self.matcol_data.texture_wrapper.textures):
					# w = widgets.VectorEntry(tex, self.tooltips)
					# form.addRow(w.label, w.data)
					box = widgets.CollapsibleBox(f"Slot {i}")
					# box = QtWidgets.QGroupBox(f"Slot {i}")
					self.tex_grid.addWidget(box, line_i, 0)
					line_i += 1
					lay = self.create_grid()
					a = QtWidgets.QLabel("texture type")
					b = QtWidgets.QLabel("texture suffix")
					x = QtWidgets.QLineEdit(tex.texture_type)
					y = QtWidgets.QLineEdit(tex.texture_suffix)

					combo = widgets.LabelCombo("First FGM:", self.default_fgms, tex, "fgm_name")
					lay.addWidget(a, 0, 0)
					lay.addWidget(b, 1, 0)
					lay.addWidget(x, 0, 1)
					lay.addWidget(y, 1, 1)
					lay.addWidget(combo.label, 2, 0)
					lay.addWidget(combo.entry, 2, 1)
					box.setLayout(lay)

				line_i = 0
				for i, attrib in enumerate(self.matcol_data.layered_wrapper.layers):
					box = widgets.CollapsibleBox(f"Slot {i}")
					# box = QtWidgets.QGroupBox(attrib.name)
					self.attrib_grid.addWidget(box, line_i, 0)
					line_i += 1
					lay = self.create_grid()
					combo = widgets.LabelCombo("FGM:", self.default_fgms, attrib, "name")
					lay.addWidget(combo.label, 0, 0)
					lay.addWidget(combo.entry, 0, 1)
					l = 1
					for infow in attrib.infos:
						w = widgets.MatcolInfo(infow, self.tooltips)
						lay.addWidget(w.label, l, 0)
						lay.addWidget(w.data, l, 1)
						l+=1
					box.setLayout(lay)
				
				line_i = 0
				for zstr in self.matcol_data.variant_wrapper.materials:

					a = QtWidgets.QLabel("variant fgm")
					b = QtWidgets.QLineEdit(zstr)
					self.attrib_grid.addWidget(a, line_i, 0)
					self.attrib_grid.addWidget(b, line_i, 1)
					line_i += 1
				
			except Exception as ex:
				widgets.showdialog(str(ex))
				print(traceback.print_exc())
			print("Done!")