Skip to content

Commit

Permalink
Fixed the "Lock Aspect Ratio" checkbox
Browse files Browse the repository at this point in the history
  • Loading branch information
Gemmstone committed Jan 15, 2024
1 parent 3e94bc0 commit 89d8c8b
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 35 deletions.
25 changes: 25 additions & 0 deletions Core/Settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,19 @@ def __init__(self, parameters):
self.parameters = parameters
self.sizeX.setValue(self.parameters["sizeX"])
self.sizeY.setValue(self.parameters["sizeY"])

self.og_width = self.parameters["sizeX"]
self.og_height = self.parameters["sizeY"]

self.posX.setValue(self.parameters["posX"])
self.posY.setValue(self.parameters["posY"])
self.posZ.setValue(self.parameters["posZ"])
self.rotation.setValue(self.parameters["rotation"])
self.check_hotkeys()

self.sizeX.valueChanged.connect(self.maintain_aspect_ratio_w)
self.sizeY.valueChanged.connect(self.maintain_aspect_ratio_h)

self.sizeX.valueChanged.connect(self.save_current)
self.sizeY.valueChanged.connect(self.save_current)
self.posX.valueChanged.connect(self.save_current)
Expand Down Expand Up @@ -149,6 +156,24 @@ def css_finished_edit(self):
self.parameters["css"] = self.css.toPlainText()
self.save_current()

def maintain_aspect_ratio_w(self):
if self.aspectRatio.isChecked():
ratio = self.sizeX.value() / self.og_width
self.sizeY.blockSignals(True)
self.sizeY.setValue(int(self.sizeY.value() * ratio))
self.sizeY.blockSignals(False)
self.og_width = self.sizeX.value()
self.save_current()

def maintain_aspect_ratio_h(self):
if self.aspectRatio.isChecked():
ratio = self.sizeY.value() / self.og_height
self.sizeX.blockSignals(True)
self.sizeX.setValue(int(self.sizeX.value() * ratio))
self.sizeX.blockSignals(False)
self.og_height = self.sizeY.value()
self.save_current()


class SettingsToolBox(QToolBox):
settings_changed = pyqtSignal(dict)
Expand Down
13 changes: 6 additions & 7 deletions Data/current.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,20 @@
"Assets/mouth/[mouth]_004.PNG",
"Assets/blush/blush_029.png",
"Assets/blush/blush_030.png",
"Assets/hairbows/hairbows_168.png",
"Assets/hairbows/hairbows_242.png",
"Assets/hairbows/hairbows_260.png",
"Assets/hairbows/hairbows_119.png",
"Assets/ahoge/ahoge_026.png",
"Assets/bangs/bangs_154.png",
"Assets/side pieces/side pieces_159.png",
"Assets/side pieces/side pieces_160.png",
"Assets/ponytails/ponytails_249.png",
"Assets/ponytails/ponytails_250.png",
"Assets/ponytails/ponytails_141.png",
"Assets/ponytails/ponytails_142.png",
"Assets/glasses/glasses_044.png",
"Assets/face assc/face assc_087.png",
"Assets/face assc/face assc_088.png",
"Assets/nose/[nose]_001.PNG",
"Assets/overshirts/overshirts_134.png",
"Assets/undershirts/undershirts_099.png",
"Assets/overshirts/overshirts_115.png",
"Assets/undershirt style/undershirt style_040.png",
"Assets/undershirts/undershirts_027.png",
"Assets/body/body_049.png",
"Assets/hairback/hairback_172.png"
]
2 changes: 1 addition & 1 deletion Data/current_model.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"name": "Hoodie",
"name": "Academic",
"type": "Avatars"
}
43 changes: 16 additions & 27 deletions Viewer/viewer.html
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@
;
"/>
<img class="ignore ignore" src="../Assets/undershirts/undershirts_099.png" style="
<img class="ignore ignore" src="../Assets/undershirts/undershirts_027.png" style="
position: absolute !important;
left: calc(50% + 0px);
top: calc(50% + 0px);
Expand All @@ -209,29 +209,29 @@
;
"/>
<img class="ignore ignore" src="../Assets/overshirts/overshirts_134.png" style="
<img class="ignore ignore" src="../Assets/undershirt style/undershirt style_040.png" style="
position: absolute !important;
left: calc(50% + 0px);
top: calc(50% + 0px);
z-index: 24;
z-index: 23;
transform: translate(-50%, -50%) scale(1.0) rotate(0deg);
width: 600px;
height: 600px;
;
"/>
<img class="ignore ignore" src="../Assets/ponytails/ponytails_249.png" style="
<img class="ignore ignore" src="../Assets/overshirts/overshirts_115.png" style="
position: absolute !important;
left: calc(50% + 0px);
top: calc(50% + 0px);
z-index: 26;
z-index: 24;
transform: translate(-50%, -50%) scale(1.0) rotate(0deg);
width: 600px;
height: 600px;
;
"/>
<img class="ignore ignore" src="../Assets/ponytails/ponytails_250.png" style="
<img class="ignore ignore" src="../Assets/ponytails/ponytails_141.png" style="
position: absolute !important;
left: calc(50% + 0px);
top: calc(50% + 0px);
Expand All @@ -242,29 +242,29 @@
;
"/>
<img class="ignore ignore" src="../Assets/ahoge/ahoge_026.png" style="
<img class="ignore ignore" src="../Assets/ponytails/ponytails_142.png" style="
position: absolute !important;
left: calc(50% + 0px);
top: calc(50% + 0px);
z-index: 27;
z-index: 26;
transform: translate(-50%, -50%) scale(1.0) rotate(0deg);
width: 600px;
height: 600px;
;
"/>
<img class="ignore ignore" src="../Assets/side pieces/side pieces_159.png" style="
<img class="ignore ignore" src="../Assets/ahoge/ahoge_026.png" style="
position: absolute !important;
left: calc(50% + 0px);
top: calc(50% + 0px);
z-index: 31;
z-index: 27;
transform: translate(-50%, -50%) scale(1.0) rotate(0deg);
width: 600px;
height: 600px;
;
"/>
<img class="ignore ignore" src="../Assets/side pieces/side pieces_160.png" style="
<img class="ignore ignore" src="../Assets/side pieces/side pieces_159.png" style="
position: absolute !important;
left: calc(50% + 0px);
top: calc(50% + 0px);
Expand All @@ -275,40 +275,29 @@
;
"/>
<img class="ignore ignore" src="../Assets/bangs/bangs_154.png" style="
position: absolute !important;
left: calc(50% + 0px);
top: calc(50% + 0px);
z-index: 35;
transform: translate(-50%, -50%) scale(1.0) rotate(0deg);
width: 600px;
height: 600px;
;
"/>
<img class="ignore ignore" src="../Assets/hairbows/hairbows_168.png" style="
<img class="ignore ignore" src="../Assets/side pieces/side pieces_160.png" style="
position: absolute !important;
left: calc(50% + 0px);
top: calc(50% + 0px);
z-index: 36;
z-index: 31;
transform: translate(-50%, -50%) scale(1.0) rotate(0deg);
width: 600px;
height: 600px;
;
"/>
<img class="ignore ignore" src="../Assets/hairbows/hairbows_242.png" style="
<img class="ignore ignore" src="../Assets/bangs/bangs_154.png" style="
position: absolute !important;
left: calc(50% + 0px);
top: calc(50% + 0px);
z-index: 36;
z-index: 35;
transform: translate(-50%, -50%) scale(1.0) rotate(0deg);
width: 600px;
height: 600px;
;
"/>
<img class="ignore ignore" src="../Assets/hairbows/hairbows_260.png" style="
<img class="ignore ignore" src="../Assets/hairbows/hairbows_119.png" style="
position: absolute !important;
left: calc(50% + 0px);
top: calc(50% + 0px);
Expand Down

0 comments on commit 89d8c8b

Please sign in to comment.