Skip to content
Merged
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
519 changes: 515 additions & 4 deletions qml/PropertiesPanel.qml

Large diffs are not rendered by default.

68 changes: 66 additions & 2 deletions qml/SceneTreeNode.qml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@ Column {
property string nodeName: treeModel ? (treeModel.data(nodeIndex) || "") : ""
property bool selected: false
// Only Node-type items are draggable (not entities/submeshes)
property bool isNodeType: treeModel ? (treeModel.data(nodeIndex, 259) === "Node" || treeModel.data(nodeIndex, 259) === "Group") : false
property bool isNodeType: treeModel ? (treeModel.data(nodeIndex, 259) === "Node"
|| treeModel.data(nodeIndex, 259) === "Group"
|| treeModel.data(nodeIndex, 259) === "Light") : false
property bool isLightType: treeModel ? (treeModel.data(nodeIndex, 259) === "Light") : false
property bool renaming: false

width: parent ? parent.width : 200

Expand All @@ -35,6 +39,8 @@ Column {
case "Node":
case "Group":
return "PLACEMENT"
case "Light":
return "LIGHT"
case "Mesh":
return "MESH DATA"
case "Submesh":
Expand All @@ -49,6 +55,8 @@ Column {
case "Node":
case "Group":
return "#6ca0dc"
case "Light":
return "#6cdc6c"
case "Mesh":
return "#55b65a"
case "Submesh":
Expand Down Expand Up @@ -79,14 +87,26 @@ Column {
anchors.fill: parent
hoverEnabled: true

acceptedButtons: Qt.LeftButton | Qt.RightButton

onClicked: function(mouse) {
if (mouse.button === Qt.RightButton) {
if (treeNode.isLightType)
lightContextMenu.popup()
return
}
if (treeModel) {
var multiSelect = (mouse.modifiers & Qt.ControlModifier) ||
(mouse.modifiers & Qt.ShiftModifier)
treeModel.selectItem(nodeIndex.row, treeModel.parent(nodeIndex), multiSelect)
}
}
Comment thread
coderabbitai[bot] marked this conversation as resolved.

onDoubleClicked: function(mouse) {
if (treeNode.isLightType)
treeNode.renaming = true
}

}

Row {
Expand Down Expand Up @@ -125,6 +145,7 @@ Column {
var t = treeModel.data(nodeIndex, 259)
switch(t) {
case "Node": return "\u25A0"
case "Light": return "\u2600"
case "Mesh": return "\u25C6"
case "Submesh": return "\u25CB"
default: return "\u25A1"
Expand All @@ -136,6 +157,7 @@ Column {
var t = treeModel.data(nodeIndex, 259)
switch(t) {
case "Node": return "#6ca0dc"
case "Light": return "#6cdc6c"
case "Mesh": return "#6cdc6c"
case "Submesh": return "#dcdc6c"
default: return PropertiesPanelController.textColor
Expand All @@ -148,6 +170,7 @@ Column {
// Name + type label
Text {
id: nameLabel
visible: !treeNode.renaming
text: {
if (!treeModel) return ""
var n = treeNode.nodeName
Expand All @@ -166,6 +189,25 @@ Column {
anchors.verticalCenter: parent.verticalCenter
}

TextInput {
id: renameInput
visible: treeNode.renaming
text: treeNode.nodeName
color: PropertiesPanelController.textColor
font.pixelSize: 11
selectByMouse: true
width: nameLabel.width
anchors.verticalCenter: parent.verticalCenter
onVisibleChanged: if (visible) { selectAll(); forceActiveFocus() }
onEditingFinished: {
var trimmed = text.trim()
if (trimmed.length > 0 && trimmed !== treeNode.nodeName)
PropertiesPanelController.renameSceneTreeLight(treeNode.nodeName, trimmed)
treeNode.renaming = false
}
Keys.onEscapePressed: treeNode.renaming = false
}

Rectangle {
visible: treeNode.impactBadgeText() !== ""
width: visible ? badgeText.implicitWidth + 8 : 0
Expand Down Expand Up @@ -244,12 +286,34 @@ Column {
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
z: 20
onClicked: PropertiesPanelController.deleteSceneTreeNode(treeNode.nodeName)
onClicked: {
if (treeNode.isLightType)
LightsController.deleteLightByName(treeNode.nodeName)
else
PropertiesPanelController.deleteSceneTreeNode(treeNode.nodeName)
}
}
}
}
}

Menu {
id: lightContextMenu

MenuItem {
text: qsTr("Rename")
onTriggered: treeNode.renaming = true
}
MenuItem {
text: qsTr("Duplicate")
onTriggered: LightsController.duplicateLightByName(treeNode.nodeName)
}
MenuItem {
text: qsTr("Delete")
onTriggered: LightsController.deleteLightByName(treeNode.nodeName)
}
}

// Material typeahead dropdown (outside Row to avoid clipping)
Popup {
id: matDropdown
Expand Down
32 changes: 32 additions & 0 deletions src/AppSettingsKeys.h
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,38 @@
return k;
}

/** @brief Default preset rig for new empty scenes (Slice E #487). */
inline const QString& lightingDefaultRig()
{
static const QString k(QStringLiteral("Lighting/defaultRig"));
return k;
}

/** @brief Viewport background mode: 0=solid, 1=gradient, 2=HDR skybox. */
inline const QString& lightingBackgroundMode()
{
static const QString k(QStringLiteral("Lighting/backgroundMode"));
return k;
}

inline const QString& lightingSolidBackground()
{
static const QString k(QStringLiteral("Lighting/solidBackground"));

Check warning on line 177 in src/AppSettingsKeys.h

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Replace the redundant type with "auto".

See more on https://sonarcloud.io/project/issues?id=fernandotonon_QtMeshEditor&issues=AZ8rDXlTN3xCn8X3GhHv&open=AZ8rDXlTN3xCn8X3GhHv&pullRequest=803
return k;
}

inline const QString& lightingGradientTop()
{
static const QString k(QStringLiteral("Lighting/gradientTop"));

Check warning on line 183 in src/AppSettingsKeys.h

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Replace the redundant type with "auto".

See more on https://sonarcloud.io/project/issues?id=fernandotonon_QtMeshEditor&issues=AZ8rDXlTN3xCn8X3GhHw&open=AZ8rDXlTN3xCn8X3GhHw&pullRequest=803
return k;
}

inline const QString& lightingGradientBottom()
{
static const QString k(QStringLiteral("Lighting/gradientBottom"));

Check warning on line 189 in src/AppSettingsKeys.h

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Replace the redundant type with "auto".

See more on https://sonarcloud.io/project/issues?id=fernandotonon_QtMeshEditor&issues=AZ8rDXlTN3xCn8X3GhHx&open=AZ8rDXlTN3xCn8X3GhHx&pullRequest=803
return k;
}

} // namespace AppSettingsKeys

#endif // APP_SETTINGS_KEYS_H
14 changes: 14 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ PrimitiveObject.cpp
ViewportGrid.cpp
AnimationWidget.cpp
SelectionSet.cpp
LightManager.cpp
LightRigLibrary.cpp
LightVisualizer.cpp
LightsController.cpp
LightPropertiesController.cpp
SceneLightingController.cpp
SelectionBoxObject.cpp
ObjectItemModel.cpp
MaterialComboDelegate.cpp
Expand All @@ -60,6 +66,7 @@ UndoManager.cpp
SubMeshTransform.cpp
SubEntityHighlight.cpp
commands/TransformCommands.cpp
commands/LightCommands.cpp
commands/MoveKeyframeCommand.cpp
commands/BulkKeyframeCommands.cpp
commands/SetKeyframeValueCommand.cpp
Expand Down Expand Up @@ -222,6 +229,12 @@ ViewportGrid.h
ViewportSettingsKeys.h
AnimationWidget.h
SelectionSet.h
LightManager.h
LightRigLibrary.h
LightVisualizer.h
LightsController.h
LightPropertiesController.h
SceneLightingController.h
SelectionBoxObject.h
ObjectItemModel.h
MaterialComboDelegate.h
Expand All @@ -247,6 +260,7 @@ UndoManager.h
SubMeshTransform.h
SubEntityHighlight.h
commands/TransformCommands.h
commands/LightCommands.h
commands/ApplyMaterialCommand.h
PropertiesPanelController.h
SceneTreeModel.h
Expand Down
3 changes: 2 additions & 1 deletion src/GlobalDefinitions.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ THE SOFTWARE.

#define GIZMO_QUERY_FLAGS 0x01
#define BONE_QUERY_FLAGS 0x02
#define SCENE_QUERY_FLAGS 0xFC
#define LIGHT_QUERY_FLAGS 0x04
#define SCENE_QUERY_FLAGS 0xF8

#define GUI_VISIBILITY_FLAGS 0x01
#define SCENE_VISIBILITY_FLAGS 0xFE
Expand Down
Loading
Loading