Skip to content

Commit

Permalink
allow edition of int64 and uint64
Browse files Browse the repository at this point in the history
  • Loading branch information
cpichard committed May 13, 2023
1 parent a14fddc commit 21fe784
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 0 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Changelog

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)

## [Unreleased]

### Added

- allows edition of int64 and uint64 in the value editors
2 changes: 2 additions & 0 deletions src/widgets/VtArrayEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,8 @@ VtValue DrawVtArrayValue(const VtValue &value) {
DrawArrayIfHolding(float)
DrawArrayIfHolding(double)
DrawArrayIfHolding(int)
DrawArrayIfHolding(int64_t)
DrawArrayIfHolding(uint64_t)
DrawArrayIfHolding(GfHalf)
DrawArrayIfHolding(TfToken)
DrawArrayIfHolding(SdfAssetPath)
Expand Down
14 changes: 14 additions & 0 deletions src/widgets/VtValueEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,20 @@ VtValue DrawVtValue(const std::string &label, const VtValue &value) {
if (ImGui::IsItemDeactivatedAfterEdit()) {
return VtValue(intValue);
}
} else if (value.IsHolding<int64_t>()) {
int64_t intValue = value.Get<int64_t>();
const char* format = "%" PRId64;
ImGui::InputScalar(label.c_str(), ImGuiDataType_S64, (void*)&intValue, nullptr, nullptr, format, ImGuiInputTextFlags());
if (ImGui::IsItemDeactivatedAfterEdit()) {
return VtValue(intValue);
}
} else if (value.IsHolding<uint64_t>()) {
uint64_t intValue = value.Get<uint64_t>();
const char* format = "%" PRIu64;
ImGui::InputScalar(label.c_str(), ImGuiDataType_U64, (void*)&intValue, nullptr, nullptr, format, ImGuiInputTextFlags());
if (ImGui::IsItemDeactivatedAfterEdit()) {
return VtValue(intValue);
}
} else if (value.IsHolding<TfToken>()) {
TfToken token = value.Get<TfToken>();
return DrawTfToken(label, token);
Expand Down

0 comments on commit 21fe784

Please sign in to comment.