Skip to content

Commit

Permalink
Scene Editor PR (#150)
Browse files Browse the repository at this point in the history
* Scene Editor stuff i left rotting here

- Added copy and paste for the select tool
- Fix tile collision viewer's random chance of displaying at an incorrect size when loading a stage
- Fix crash on pre-v5 when attempting to pick a tile/chunk from the scene viewer at a location that exceeded the limits of the selected layer
- fix #148 ,#146 and #145
- add #147 for v5

* patch flaw on #146 fix

also:
- clean clipboard if a copied entity gets deleted
- fix select tool picking the entity next to a selected entity if there's a gap in the list as a result of deleting an entity
- fix deleted entities through select tool not counting as editing the stage

* fix crash on remove entity

* Fix chunk multi-replace
  • Loading branch information
Leonx254 authored Nov 14, 2024
1 parent 4daa173 commit cda5059
Show file tree
Hide file tree
Showing 15 changed files with 763 additions and 496 deletions.
188 changes: 147 additions & 41 deletions RetroEDv2/tools/sceneeditor.cpp

Large diffs are not rendered by default.

6 changes: 5 additions & 1 deletion RetroEDv2/tools/sceneeditor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ class SceneEditor : public QWidget
void TitleChanged(QString title, QString tabFullPath);

public slots:
void updateType(SceneEntity *entity, byte type);
void updateType(SceneEntity *entity, byte type, bool keepVals = false);
protected:
bool event(QEvent *event);
bool eventFilter(QObject *object, QEvent *event);
Expand All @@ -178,9 +178,13 @@ public slots:
COPY_LAYER,
COPY_CHUNK,
COPY_ENTITY,
COPY_ENTITY_SELECT,
COPY_SCROLLINFO,
};
void *clipboard = nullptr;
QList<int> clipboardIDs;
QList<Vector2<float>> clipboardOffset;
Vector2<float> clipPosCenter;
byte clipboardType = COPY_NONE;
int clipboardInfo = 0;

Expand Down
103 changes: 55 additions & 48 deletions RetroEDv2/tools/sceneeditor.ui
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
</size>
</property>
<property name="currentIndex">
<number>0</number>
<number>3</number>
</property>
<widget class="QWidget" name="layerPage">
<property name="geometry">
Expand Down Expand Up @@ -139,68 +139,38 @@
<string>Entity List</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_4">
<item row="0" column="0" colspan="6">
<item row="1" column="0" colspan="6">
<widget class="QListWidget" name="entityList"/>
</item>
<item row="2" column="1">
<spacer name="horizontalSpacer_6">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="0">
<widget class="QToolButton" name="addEnt">
<property name="toolTip">
<string>Adds an entity</string>
</property>
<property name="text">
<string>+</string>
</property>
<property name="icon">
<iconset resource="../resources.qrc">
<normaloff>:/icons/ic_add_circle_48px.svg</normaloff>:/icons/ic_add_circle_48px.svg</iconset>
</property>
</widget>
</item>
<item row="2" column="5">
<widget class="QToolButton" name="rmEnt">
<property name="enabled">
<bool>false</bool>
</property>
<item row="3" column="3">
<widget class="QToolButton" name="downEnt">
<property name="toolTip">
<string>Removes an entity</string>
<string>Moves an entity down</string>
</property>
<property name="text">
<string>-</string>
<string>D</string>
</property>
<property name="icon">
<iconset resource="../resources.qrc">
<normaloff>:/icons/ic_cancel_48px.svg</normaloff>:/icons/ic_cancel_48px.svg</iconset>
<normaloff>:/icons/ic_arrow_downward_48px.svg</normaloff>:/icons/ic_arrow_downward_48px.svg</iconset>
</property>
</widget>
</item>
<item row="2" column="3">
<widget class="QToolButton" name="downEnt">
<item row="3" column="0">
<widget class="QToolButton" name="addEnt">
<property name="toolTip">
<string>Moves an entity down</string>
<string>Adds an entity</string>
</property>
<property name="text">
<string>D</string>
<string>+</string>
</property>
<property name="icon">
<iconset resource="../resources.qrc">
<normaloff>:/icons/ic_arrow_downward_48px.svg</normaloff>:/icons/ic_arrow_downward_48px.svg</iconset>
<normaloff>:/icons/ic_add_circle_48px.svg</normaloff>:/icons/ic_add_circle_48px.svg</iconset>
</property>
</widget>
</item>
<item row="2" column="2">
<item row="3" column="2">
<widget class="QToolButton" name="upEnt">
<property name="toolTip">
<string>Moves an entity up</string>
Expand All @@ -214,7 +184,27 @@
</property>
</widget>
</item>
<item row="2" column="4">
<item row="2" column="0" colspan="6">
<widget class="QLineEdit" name="entityFilter">
<property name="placeholderText">
<string>Find entities...</string>
</property>
</widget>
</item>
<item row="3" column="1">
<spacer name="horizontalSpacer_6">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="3" column="4">
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
Expand All @@ -227,10 +217,27 @@
</property>
</spacer>
</item>
<item row="1" column="0" colspan="6">
<widget class="QLineEdit" name="entityFilter">
<property name="placeholderText">
<string>Find entities...</string>
<item row="3" column="5">
<widget class="QToolButton" name="rmEnt">
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip">
<string>Removes an entity</string>
</property>
<property name="text">
<string>-</string>
</property>
<property name="icon">
<iconset resource="../resources.qrc">
<normaloff>:/icons/ic_cancel_48px.svg</normaloff>:/icons/ic_cancel_48px.svg</iconset>
</property>
</widget>
</item>
<item row="0" column="0" colspan="6">
<widget class="QLabel" name="totalEntCount">
<property name="text">
<string>Total Entity Count</string>
</property>
</widget>
</item>
Expand Down
Loading

0 comments on commit cda5059

Please sign in to comment.