Skip to content

Commit

Permalink
Sprite Collision Mask Tweak (#200)
Browse files Browse the repository at this point in the history
* Combine the sprite editor collision mask combos for mode and shape under the same group box.
* Fix model mapping typo in sprite editor source for shape combo.
* Add missing alpha tolerance slider for later automatic bounding box calculation.
  • Loading branch information
RobertBColton authored Dec 31, 2020
1 parent d9f0890 commit a6a3adb
Show file tree
Hide file tree
Showing 2 changed files with 77 additions and 50 deletions.
2 changes: 1 addition & 1 deletion Editors/SpriteEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ SpriteEditor::SpriteEditor(MessageModel* model, QWidget* parent)
_nodeMapper->addMapping(_ui->nameEdit, TreeNode::kNameFieldNumber);
_resMapper->addMapping(_ui->originXSpinBox, Sprite::kOriginXFieldNumber);
_resMapper->addMapping(_ui->originYSpinBox, Sprite::kOriginYFieldNumber);
_resMapper->addMapping(_ui->collisionShapeGroupBox, Sprite::kShapeFieldNumber, "currentIndex");
_resMapper->addMapping(_ui->shapeComboBox, Sprite::kShapeFieldNumber, "currentIndex");
_resMapper->addMapping(_ui->bboxComboBox, Sprite::kBboxModeFieldNumber, "currentIndex");
_resMapper->addMapping(_ui->leftSpinBox, Sprite::kBboxLeftFieldNumber);
_resMapper->addMapping(_ui->rightSpinBox, Sprite::kBboxRightFieldNumber);
Expand Down
125 changes: 76 additions & 49 deletions Editors/SpriteEditor.ui
Original file line number Diff line number Diff line change
Expand Up @@ -89,50 +89,6 @@
<property name="bottomMargin">
<number>4</number>
</property>
<item row="2" column="0" colspan="2">
<widget class="QGroupBox" name="collisionShapeGroupBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title">
<string>Collision Shape</string>
</property>
<layout class="QVBoxLayout" name="collisionShapeLayout">
<item>
<widget class="QComboBox" name="collisionShapeComboBox">
<item>
<property name="text">
<string>Precise</string>
</property>
</item>
<item>
<property name="text">
<string>Rectangle</string>
</property>
</item>
<item>
<property name="text">
<string>Disk</string>
</property>
</item>
<item>
<property name="text">
<string>Diamond</string>
</property>
</item>
<item>
<property name="text">
<string>Polygon</string>
</property>
</item>
</widget>
</item>
</layout>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="nameLabel">
<property name="text">
Expand Down Expand Up @@ -220,7 +176,7 @@
</layout>
</widget>
</item>
<item row="3" column="0" colspan="2">
<item row="2" column="0" colspan="2">
<widget class="QGroupBox" name="boundingboxGroup">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
Expand All @@ -229,16 +185,23 @@
</sizepolicy>
</property>
<property name="title">
<string>Bounding Box</string>
<string>Collision Mask</string>
</property>
<property name="checkable">
<bool>false</bool>
</property>
<layout class="QVBoxLayout" name="bboxLayout">
<layout class="QFormLayout" name="formLayout">
<property name="leftMargin">
<number>9</number>
</property>
<item>
<item row="0" column="0">
<widget class="QLabel" name="bboxLabel">
<property name="text">
<string>Mode</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="bboxComboBox">
<item>
<property name="text">
Expand All @@ -257,7 +220,71 @@
</item>
</widget>
</item>
<item>
<item row="1" column="0">
<widget class="QLabel" name="shapeLabel">
<property name="text">
<string>Type</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="shapeComboBox">
<item>
<property name="text">
<string>Precise</string>
</property>
</item>
<item>
<property name="text">
<string>Rectangle</string>
</property>
</item>
<item>
<property name="text">
<string>Disk</string>
</property>
</item>
<item>
<property name="text">
<string>Diamond</string>
</property>
</item>
<item>
<property name="text">
<string>Polygon</string>
</property>
</item>
</widget>
</item>
<item row="2" column="0" colspan="2">
<widget class="QLabel" name="alphaLabel">
<property name="text">
<string>Alpha Tolerance</string>
</property>
</widget>
</item>
<item row="3" column="0" colspan="2">
<layout class="QHBoxLayout" name="alphaControlLayout">
<item>
<widget class="QSlider" name="alphaSlider">
<property name="maximum">
<number>255</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="alphaSpinBox">
<property name="maximum">
<number>255</number>
</property>
</widget>
</item>
</layout>
</item>
<item row="4" column="0" colspan="2">
<layout class="QGridLayout" name="bboxDimensionsLayout">
<property name="spacing">
<number>0</number>
Expand Down

0 comments on commit a6a3adb

Please sign in to comment.