diff --git a/Output/test.zig.zon b/Output/test.zig.zon index 660d2e4..5f1fcbe 100644 --- a/Output/test.zig.zon +++ b/Output/test.zig.zon @@ -1,34 +1,3 @@ .{ - .{ - .input = .{cubyz:copper_ingot}, - .output = cubyz:apple, - .input = .{cubyz:copper_ingot}, - .output = cubyz:apple, - .input = .{cubyz:meteorite_ingot}, - .output = cubyz:raw_meat, - .input = .{cubyz:copper_ingot}, - .output = cubyz:apple, - .input = .{cubyz:meteorite_ingot}, - .output = cubyz:raw_meat, - .input = .{cubyz:copper_ingot}, - .output = cubyz:apple, - .input = .{cubyz:meteorite_ingot}, - .output = cubyz:raw_meat, - .input = .{cubyz:copper_ingot}, - .output = cubyz:apple, - .input = .{cubyz:meteorite_ingot}, - .output = cubyz:raw_meat, - .input = .{cubyz:copper_ingot}, - .output = cubyz:apple, - .input = .{cubyz:meteorite_ingot}, - .output = cubyz:raw_meat, - .input = .{cubyz:copper_ingot}, - .output = cubyz:apple, - .input = .{cubyz:meteorite_ingot}, - .output = cubyz:raw_meat, - .input = .{cubyz:copper_ingot}, - .output = cubyz:apple, - .input = .{cubyz:meteorite_ingot}, - .output = cubyz:raw_meat, - }, + .collide = false, } diff --git a/__pycache__/editor_ui.cpython-312.pyc b/__pycache__/editor_ui.cpython-312.pyc index e43ee01..3f5bbd4 100644 Binary files a/__pycache__/editor_ui.cpython-312.pyc and b/__pycache__/editor_ui.cpython-312.pyc differ diff --git a/__pycache__/formatting.cpython-312.pyc b/__pycache__/formatting.cpython-312.pyc index 41fe47e..187a5c5 100644 Binary files a/__pycache__/formatting.cpython-312.pyc and b/__pycache__/formatting.cpython-312.pyc differ diff --git a/__pycache__/reference_lists.cpython-312.pyc b/__pycache__/reference_lists.cpython-312.pyc new file mode 100644 index 0000000..091ce92 Binary files /dev/null and b/__pycache__/reference_lists.cpython-312.pyc differ diff --git a/__pycache__/ui_classes.cpython-312.pyc b/__pycache__/ui_classes.cpython-312.pyc new file mode 100644 index 0000000..7c933a0 Binary files /dev/null and b/__pycache__/ui_classes.cpython-312.pyc differ diff --git a/__pycache__/zon_object_types.cpython-312.pyc b/__pycache__/zon_object_types.cpython-312.pyc index 9460e42..8794a51 100644 Binary files a/__pycache__/zon_object_types.cpython-312.pyc and b/__pycache__/zon_object_types.cpython-312.pyc differ diff --git a/editor_ui.py b/editor_ui.py index a510f5f..ec61175 100644 --- a/editor_ui.py +++ b/editor_ui.py @@ -116,25 +116,9 @@ def recurseReadChildren(self, givenList, returnZon): for i in range(givenList.__len__()): childButton = givenList[i] - if isinstance(childButton, uiTxtInputZonValue): - self.addZonValue(childButton, returnZon) - if isinstance(childButton, uiComboBoxZonValue): - if childButton.comboBox.currentText() == "": continue - newZonObj = zonValue() - newZonObj.value = childButton.comboBox.currentText() - newZonObj.name = childButton.name - returnZon.children.append(newZonObj) - if isinstance(childButton, uiTxtInputZonArray): - self.addZonArray(childButton, returnZon) - if isinstance(childButton, uiComboBoxZonArray): - newZonObj = zonArray() - newZonObj.children = [] - for childComboBox in childButton.comboBoxList: - if childComboBox.currentText() == "": continue - newZonObj.children.append(childComboBox.currentText()) - if newZonObj.children.__len__() == 0: return - newZonObj.name = childButton.name - returnZon.children.append(newZonObj) + + self.checkZonValues(childButton, returnZon) + if isinstance(childButton, uiZonObject): self.addZonObj(childButton, returnZon) if isinstance(childButton, uiFormatGroupZonMulti): @@ -154,8 +138,25 @@ def recurseReadChildren(self, givenList, returnZon): for recipie in childButton.children: self.recurseReadChildren(recipie, newBaseZonObj) returnZon.children.append(newBaseZonObj) - - + + def checkZonValues(self, childButton, returnZon): # seperated to make code cleaner to read + + if isinstance(childButton, uiTxtInputZonValue): + self.addZonValue(childButton, returnZon) + return + if isinstance(childButton, uiComboBoxZonValue): + if childButton.comboBox.currentText() == "": return + newZonObj = zonValue() + newZonObj.value = childButton.comboBox.currentText() + newZonObj.name = childButton.name + returnZon.children.append(newZonObj) + return + if isinstance(childButton, uiBoolZonValue): + if (childButton.checkBox.isChecked() == childButton.defaultValue): return + newZonObj = zonValue() + newZonObj.value = str(childButton.checkBox.isChecked()).lower() + newZonObj.name = childButton.name + returnZon.children.append(newZonObj) def addZonValue(self, childButton, returnZon): if childButton.txtInput.text() == "": return diff --git a/formatting.py b/formatting.py index 14c79ee..2acfe24 100644 --- a/formatting.py +++ b/formatting.py @@ -68,7 +68,7 @@ def createChildBasedOnInfo(varName, varType, parentZon): # determines how to int newZonObj.name = varName newZonObj.children = [varType] parentZon.children.append(newZonObj) - elif (varType.isdecimal()) or (is_float(varType)) or (varType == "image.png") or (varType == ".tag") or (varType == "true") or (varType == "false") or (varType == "0x000000") or (varType == "cubyz:no_rotation"): + elif (varType.isdecimal()) or (is_float(varType)) or (varType == "image.png") or (varType == ".tag") or (varType == "0x000000") or (varType == "cubyz:no_rotation"): newZonObj = zonValue() newZonObj.name = varName newZonObj.value = varType @@ -78,6 +78,11 @@ def createChildBasedOnInfo(varName, varType, parentZon): # determines how to int newZonObj.name = varName newZonObj.formatGroup = createFormatGroup("formatting/modifier") parentZon.children.append(newZonObj) + elif (varType == "true") or (varType == "false"): + newZonObj = boolZon() + newZonObj.name = varName + newZonObj.baseValue = bool(varType) + parentZon.children.append(newZonObj) elif (varType == "item"): newZonObj = zonObject() newZonObj.name = varName diff --git a/ui_classes.py b/ui_classes.py index c91bc8a..f2bc430 100644 --- a/ui_classes.py +++ b/ui_classes.py @@ -18,6 +18,7 @@ QComboBox, QScrollArea, QFileDialog, + QCheckBox ) from pathlib import Path @@ -67,6 +68,11 @@ def readFormat(givenFormat, baseParentLayout, childZonList): newZonValue = uiTxtInputZonValue() newZonValue.addZonValueInput(child.name, baseParentLayout, child.value) childZonList.append(newZonValue) + if isinstance(child, boolZon): + newZonValue = uiBoolZonValue() + newZonValue.defaultValue = child.defaultValue + newZonValue.addZonValueInput(child.name, baseParentLayout) + childZonList.append(newZonValue) elif isinstance(child, zonArray): newZonArray = uiTxtInputZonArray() newZonArray.addZonArrayInput(child.name, baseParentLayout, child.children[0]) @@ -85,6 +91,29 @@ def readFormat(givenFormat, baseParentLayout, childZonList): #MARK: UiClasses # smaller classes for ui + +class uiBoolZonValue(): + + name = "ErrorNotDefined" + checkBox = None + defaultValue = False + + def addZonValueInput(self, name, baseParentLayout): + txtInputsLayout = QHBoxLayout() + + self.name = name + self.checkBox = QCheckBox() + if self.defaultValue: self.checkBox.setCheckState(Qt.CheckState.Checked) + else: self.checkBox.setCheckState(Qt.CheckState.Unchecked) + txtInputsLayout.addWidget(self.checkBox) + + lineLayout = QHBoxLayout()#item 1 is always the actual value object(s) + namelabel = QLabel(name + " = ") + lineLayout.addWidget(namelabel) + lineLayout.addLayout(txtInputsLayout) + + baseParentLayout.addLayout(lineLayout) + class uiTxtInputZonValue(): name = "ErrorNotDefined" diff --git a/zon_object_types.py b/zon_object_types.py index 0dc8ec7..e9d19d1 100644 --- a/zon_object_types.py +++ b/zon_object_types.py @@ -84,4 +84,8 @@ class formatGroupZonMulti(): class recipieZon(): name = "ErrorMissingName" # not used just defined so i can sort by classes +class boolZon(): + name = "ErrorMissingName" # not used just defined so i can sort by classes + defaultValue = True + print("imported zon_object_types.py") \ No newline at end of file