From 5cd0d96f3f9444f1c13825ae3e79238f7fe0ce4a Mon Sep 17 00:00:00 2001 From: dgelessus Date: Tue, 5 Mar 2024 18:16:04 +0100 Subject: [PATCH 1/4] Fix alphabetical sorting of creatable type lists --- src/PrpShop/PRP/QCreatable.cpp | 4 ++-- src/PrpShop/QPlasmaUtils.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/PrpShop/PRP/QCreatable.cpp b/src/PrpShop/PRP/QCreatable.cpp index ac822f4..44abe49 100644 --- a/src/PrpShop/PRP/QCreatable.cpp +++ b/src/PrpShop/PRP/QCreatable.cpp @@ -162,8 +162,6 @@ QCreatable* pqMakeCreatableForm(plCreatable* pCre, QWidget* parent, int forceTyp return new QDynamicTextMap(pCre, parent); case kFadeOpacityMod: return new QFadeOpacityMod(pCre, parent); - case kInterfaceInfoModifier: - return new QInterfaceInfoModifier(pCre, parent); case kGMaterial: return new QMaterial(pCre, parent); case kGUIButtonMod: @@ -206,6 +204,8 @@ QCreatable* pqMakeCreatableForm(plCreatable* pCre, QWidget* parent, int forceTyp return new QGUIUpDownPairMod(pCre, parent); case kImageLibMod: return new QImageLibMod(pCre, parent); + case kInterfaceInfoModifier: + return new QInterfaceInfoModifier(pCre, parent); case kLayer: return new QLayer(pCre, parent); case kLayerAnimation: diff --git a/src/PrpShop/QPlasmaUtils.cpp b/src/PrpShop/QPlasmaUtils.cpp index 0f53a4d..314d3fc 100644 --- a/src/PrpShop/QPlasmaUtils.cpp +++ b/src/PrpShop/QPlasmaUtils.cpp @@ -590,14 +590,14 @@ std::vector pqGetValidKOTypes() k2WayWinAudible, kAudible, kAudibleNull, kAudioInterface, kAvLadderMod, kCollisionDetector, kCoordinateInterface, kCubicEnvironmap, kDetectorModifier, kDirectShadowMaster, kDrawInterface, kDynamicTextMap, - kFadeOpacityMod, kGUIButtonMod, kGUICheckBoxCtrl, kGUIClickMapCtrl, + kFadeOpacityMod, kGMaterial, kGUIButtonMod, kGUICheckBoxCtrl, kGUIClickMapCtrl, kGUIDialogMod, kGUIDragBarCtrl, kGUIDraggableMod, kGUIDynDisplayCtrl, kGUIEditBoxMod, kGUIKnobCtrl, kGUIListBoxMod, kGUIMenuItem, kGUIMultiLineEditCtrl, kGUIPopUpMenu, kGUIProgressCtrl, kGUIRadioGroupCtrl, kGUISkin, kGUITextBoxMod, kGUIUpDownPairMod, kImageLibMod, kInterfaceInfoModifier, kLayer, kLayerAnimation, kLayerAVI, kLayerBink, kLayerDepth, kLayerLinkAnimation, kLayerMovie, - kLayerSDLAnimation, kGMaterial, kMaintainersMarkerModifier, kMipmap, + kLayerSDLAnimation, kMaintainersMarkerModifier, kMipmap, kMsgForwarder, kMultistageBehMod, kOneShotMod, kPanicLinkRegion, kPickingDetector, kPointShadowMaster, kPythonFileMod, kSceneNode, kSceneObject, kSeekPointMod, kShadowMaster, kSimulationInterface, kSound, From a4e21ae9a6769daf225ef623ad5957103b48935e Mon Sep 17 00:00:00 2001 From: dgelessus Date: Tue, 5 Mar 2024 18:19:14 +0100 Subject: [PATCH 2/4] Fix pqGetValidKOTypes not listing kSynchedObject (it has an edit dialog) --- src/PrpShop/QPlasmaUtils.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/PrpShop/QPlasmaUtils.cpp b/src/PrpShop/QPlasmaUtils.cpp index 314d3fc..89f271b 100644 --- a/src/PrpShop/QPlasmaUtils.cpp +++ b/src/PrpShop/QPlasmaUtils.cpp @@ -601,7 +601,7 @@ std::vector pqGetValidKOTypes() kMsgForwarder, kMultistageBehMod, kOneShotMod, kPanicLinkRegion, kPickingDetector, kPointShadowMaster, kPythonFileMod, kSceneNode, kSceneObject, kSeekPointMod, kShadowMaster, kSimulationInterface, kSound, - kSoundBuffer, kSpawnModifier, kSubworldRegionDetector, kWinAudible, + kSoundBuffer, kSpawnModifier, kSubworldRegionDetector, kSynchedObject, kWinAudible, kWin32LinkSound, kWin32Sound, kWin32StaticSound, kWin32StreamingSound, }; static size_t s_numTypes = sizeof(s_typeList) / sizeof(s_typeList[0]); From 28482dfbaf780a0a50582d5af985973004758469 Mon Sep 17 00:00:00 2001 From: dgelessus Date: Tue, 5 Mar 2024 19:04:51 +0100 Subject: [PATCH 3/4] Add "Edit As" context menu for editing objects using a base type editor This can be useful if only the PRC editor is available for the object's exact type, but one of the base types has a dedicated graphical editor. This way, at least part of the object can be edited graphically. --- src/PrpShop/Main.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/PrpShop/Main.cpp b/src/PrpShop/Main.cpp index 77d2f4a..3cb0dfb 100644 --- a/src/PrpShop/Main.cpp +++ b/src/PrpShop/Main.cpp @@ -439,6 +439,24 @@ void PrpShopMain::treeContextMenu(const QPoint& pos) } else if (item->type() == QPlasmaTreeItem::kTypeKO) { menu.addAction(fActions[kTreeEdit]); menu.addAction(fActions[kTreeEditPRC]); + QMenu* editAsMenu = menu.addMenu(tr("Edit A&s")); + editAsMenu->setEnabled(false); + for (short type : pqGetValidKOTypes()) { + if (item->obj()->ClassInstance(type)) { + if (type != item->obj()->ClassIndex()) { + // Enable the Edit As submenu only if it has at least one "interesting" entry, + // i. e. not just the default editor. + editAsMenu->setEnabled(true); + } + editAsMenu->addAction( + pqGetTypeIcon(type), + pqGetFriendlyClassName(type), + [this, item, type]() { + editCreatable(item->obj(), type); + } + ); + } + } menu.addAction(fActions[kTreeEditHex]); menu.addAction(fActions[kTreePreview]); menu.addAction(fActions[kTreeViewTargets]); From fcab61f4f6a31134c20456890ae1f81763944e4c Mon Sep 17 00:00:00 2001 From: dgelessus Date: Sat, 9 Mar 2024 14:59:24 +0100 Subject: [PATCH 4/4] Highlight default editor in "Edit As" context menu --- src/PrpShop/Main.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/PrpShop/Main.cpp b/src/PrpShop/Main.cpp index 3cb0dfb..a300ce0 100644 --- a/src/PrpShop/Main.cpp +++ b/src/PrpShop/Main.cpp @@ -443,18 +443,20 @@ void PrpShopMain::treeContextMenu(const QPoint& pos) editAsMenu->setEnabled(false); for (short type : pqGetValidKOTypes()) { if (item->obj()->ClassInstance(type)) { - if (type != item->obj()->ClassIndex()) { - // Enable the Edit As submenu only if it has at least one "interesting" entry, - // i. e. not just the default editor. - editAsMenu->setEnabled(true); - } - editAsMenu->addAction( + QAction* action = editAsMenu->addAction( pqGetTypeIcon(type), pqGetFriendlyClassName(type), [this, item, type]() { editCreatable(item->obj(), type); } ); + if (type == item->obj()->ClassIndex()) { + editAsMenu->setDefaultAction(action); + } else { + // Enable the Edit As submenu only if it has at least one "interesting" entry, + // i. e. not just the default editor. + editAsMenu->setEnabled(true); + } } } menu.addAction(fActions[kTreeEditHex]);