From cfb60c98be7d6ccc48400df94ba5d509e28c9b97 Mon Sep 17 00:00:00 2001 From: Ray Molenkamp Date: Tue, 27 Feb 2024 01:02:42 +0100 Subject: [PATCH] CMake: MSVC: Add natvis file for blender's native types This currently contains some types I personally needed more types can be added if people desire them. Due to the .natvis being added to creator, Visual Studio will automatically pick up on these types and show the improved visualizers while debugging. vscode can also use this file, but you'll have to check its documentation on how to set that up. Pull Request: https://projects.blender.org/blender/blender/pulls/118576 --- source/creator/CMakeLists.txt | 5 +++ tools/utils_ide/natvis/Blender.natvis | 58 +++++++++++++++++++++++++++ 2 files changed, 63 insertions(+) create mode 100644 tools/utils_ide/natvis/Blender.natvis diff --git a/source/creator/CMakeLists.txt b/source/creator/CMakeLists.txt index 63762a26ef4..3242e2e00d3 100644 --- a/source/creator/CMakeLists.txt +++ b/source/creator/CMakeLists.txt @@ -152,6 +152,11 @@ set(SRC creator_intern.h ) +if(CMAKE_GENERATOR MATCHES "^Visual Studio.+") + # This helps visual studio find the debugger visualizers + list(APPEND SRC ${CMAKE_SOURCE_DIR}/tools/utils_ide/natvis/Blender.natvis) +endif() + # MSVC 2010 gives linking errors with the manifest. if(WIN32 AND NOT UNIX) add_definitions( diff --git a/tools/utils_ide/natvis/Blender.natvis b/tools/utils_ide/natvis/Blender.natvis new file mode 100644 index 00000000000..ac141879470 --- /dev/null +++ b/tools/utils_ide/natvis/Blender.natvis @@ -0,0 +1,58 @@ + + + + {data_,[size_]s} (size={size_}) + + + {{size={end_ - begin_}}} + + end_ - begin_ + capacity_end_ - begin_ + + end_ - begin_ + begin_ + + + + + {{size={size_ }}} + + size_ + + size_ + data_ + + + + + {{x={x}, y={y}, z={z}}} + + + {{size={size_ }}} + + size_ + + size_ + data_ + + + + + Size={occupied_and_removed_slots_ - removed_slots_} + + + + + + slot->value_buffer_ + ++slot + ++i + + + + + + + {*($T1*)buffer_.buffer_.buffer_} + + \ No newline at end of file