Skip to content

Commit

Permalink
Fix duplicate ImGui IDs in component move handles
Browse files Browse the repository at this point in the history
  • Loading branch information
Benualdo committed Nov 11, 2024
1 parent 1613e61 commit bcd0450
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/Build_Win64_DX12.yml
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ jobs:
"description": "A new version of VGFramework is available",
"color": 15579707,
"thumbnail": {
"url": "https://github.com/vimontgames/vgframework/blob/master/doc/img/newversion.png?raw=true"
"url": "https://github.com/vimontgames/vgframework/blob/master/doc/img/version.png?raw=true"
},
"author": {
"name": "$($env:GITHUB_ACTOR)",
Expand Down
66 changes: 65 additions & 1 deletion .github/workflows/Win64_DX12_Release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,68 @@ jobs:
working-directory: ${{ env.GITHUB_WORKSPACE }}
# Add additional options to the MSBuild command line here (like platform or verbosity level).
# See https://docs.microsoft.com/visualstudio/msbuild/msbuild-command-line-reference
run: msbuild /m /p:Configuration=${{ env.BUILD_CONFIGURATION }} /p:Platform=${{ env.BUILD_PLATFORM }} ${{ env.SOLUTION_FILE_PATH }}
run: msbuild /m /p:Configuration=${{ env.BUILD_CONFIGURATION }} /p:Platform=${{ env.BUILD_PLATFORM }} ${{ env.SOLUTION_FILE_PATH }}

- name: Success Notification
if: ${{ success() }}
run: |
$DISCORD_BUILD_WEBHOOK_URL = "${{ secrets.DISCORD_BUILD_WEBHOOK_URL }}"
$jsonPayload = @"
{
"username": "GitHub",
"content": "",
"embeds": [
{
"type": "rich",
"title": "Win64 DX12 Release",
"description": "The build succeeded",
"color": 2674853,
"thumbnail": {
"url": "https://github.com/vimontgames/vgframework/blob/master/doc/img/buildsuccess.png?raw=true"
},
"author": {
"name": "$($env:GITHUB_ACTOR)",
"url": "https://github.com/$($env:GITHUB_ACTOR)",
"icon_url": "https://avatars.githubusercontent.com/u/$($env:GITHUB_ACTOR_ID)?v=4"
},
"url": "https://github.com/vimontgames/vgframework"
}
]
}
"@
$RESPONSE = curl -H "Content-Type: application/json" -X POST -d $jsonPayload $DISCORD_BUILD_WEBHOOK_URL
Write-Output "Webhook server response: $RESPONSE"
- name: Failure Notification
if: ${{ failure() }}
run: |
$DISCORD_BUILD_WEBHOOK_URL = "${{ secrets.DISCORD_BUILD_WEBHOOK_URL }}"
$jsonPayload = @"
{
"username": "GitHub",
"content": "",
"embeds": [
{
"type": "rich",
"title": "Win64 DX12 Release",
"description": "The build has failed",
"color": 14473477,
"thumbnail": {
"url": "https://github.com/vimontgames/vgframework/blob/master/doc/img/buildfailed.png?raw=true"
},
"author": {
"name": "$($env:GITHUB_ACTOR)",
"url": "https://github.com/$($env:GITHUB_ACTOR)",
"icon_url": "https://avatars.githubusercontent.com/u/$($env:GITHUB_ACTOR_ID)?v=4"
},
"url": "https://github.com/vimontgames/vgframework"
}
]
}
"@
$RESPONSE = curl -H "Content-Type: application/json" -X POST -d $jsonPayload $DISCORD_BUILD_WEBHOOK_URL
Write-Output "Webhook server response: $RESPONSE"
15 changes: 1 addition & 14 deletions src/editor/ImGui/Window/ImGuiWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1683,7 +1683,7 @@ namespace vg::editor
{
ImGui::SetCursorPosY(ImGui::GetCursorPosY() - style::draganddrop::interlineSize.y - 1);

string label = fmt::sprintf("###%s %s", asString(type), component->GetName().c_str());
string label = fmt::sprintf("###%s %u", asString(type), component->GetUID(false) ? (uint_ptr)component->GetUID() : (uint_ptr)component);
ImGui::InvisibleButton(label.c_str(), style::draganddrop::interlineSize);

// debug
Expand Down Expand Up @@ -1788,12 +1788,6 @@ namespace vg::editor
if (debugInspector)
componentShortName += fmt::sprintf(" (0x%016X)", (u64)pComponent);

//if (auto * nameProp = pComponent->GetClassDesc()->GetPropertyByName("m_name"))
//{
// if (!asBool(core::PropertyFlags::NotVisible & nameProp->GetFlags()))
// componentShortName += " - " + *nameProp->GetPropertyString(pComponent);
//}

ImVec2 collapsingHeaderPos = ImGui::GetCursorPos();

const bool isOpen = asBool(ObjectFlags::Opened & pComponent->GetObjectFlags());
Expand Down Expand Up @@ -2213,13 +2207,6 @@ namespace vg::editor
{
auto availableWidth = GetContentRegionAvail().x;
ImGui::PushItemWidth(availableWidth - style::label::PixelWidth);

//auto customDisplayHandler = ImGuiObjectHandler::Find(_resource->GetClassName());
//if (nullptr != customDisplayHandler)
//{
// changed = customDisplayHandler->displayObject(_resource, objectContext);
//}
//else
{
const char * classDisplayName = classDesc->GetClassDisplayName();

Expand Down

0 comments on commit bcd0450

Please sign in to comment.