Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 1 addition & 32 deletions Output/test.zig.zon
Original file line number Diff line number Diff line change
@@ -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,
}
Binary file modified __pycache__/editor_ui.cpython-312.pyc
Binary file not shown.
Binary file modified __pycache__/formatting.cpython-312.pyc
Binary file not shown.
Binary file added __pycache__/reference_lists.cpython-312.pyc
Binary file not shown.
Binary file added __pycache__/ui_classes.cpython-312.pyc
Binary file not shown.
Binary file modified __pycache__/zon_object_types.cpython-312.pyc
Binary file not shown.
43 changes: 22 additions & 21 deletions editor_ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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
Expand Down
7 changes: 6 additions & 1 deletion formatting.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
29 changes: 29 additions & 0 deletions ui_classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
QComboBox,
QScrollArea,
QFileDialog,
QCheckBox
)
from pathlib import Path

Expand Down Expand Up @@ -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])
Expand All @@ -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"
Expand Down
4 changes: 4 additions & 0 deletions zon_object_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")