diff --git a/DearPyGui/dearpygui/_dearpygui.pyi b/DearPyGui/dearpygui/_dearpygui.pyi index 719e4e7e6..b08270bb8 100644 --- a/DearPyGui/dearpygui/_dearpygui.pyi +++ b/DearPyGui/dearpygui/_dearpygui.pyi @@ -1663,8 +1663,7 @@ mvPlotStyleVar_PlotDefaultSize=0 mvPlotStyleVar_PlotMinSize=0 mvNodeStyleVar_GridSpacing=0 mvNodeStyleVar_NodeCornerRounding=0 -mvNodeStyleVar_NodePaddingHorizontal=0 -mvNodeStyleVar_NodePaddingVertical=0 +mvNodeStyleVar_NodePadding=0 mvNodeStyleVar_NodeBorderThickness=0 mvNodeStyleVar_LinkThickness=0 mvNodeStyleVar_LinkLineSegmentsPerLength=0 diff --git a/DearPyGui/dearpygui/_dearpygui_RTD.py b/DearPyGui/dearpygui/_dearpygui_RTD.py index e74c7ff16..492417bbc 100644 --- a/DearPyGui/dearpygui/_dearpygui_RTD.py +++ b/DearPyGui/dearpygui/_dearpygui_RTD.py @@ -8910,8 +8910,7 @@ def unstage(item): mvPlotStyleVar_PlotMinSize=internal_dpg.mvPlotStyleVar_PlotMinSize mvNodeStyleVar_GridSpacing=internal_dpg.mvNodeStyleVar_GridSpacing mvNodeStyleVar_NodeCornerRounding=internal_dpg.mvNodeStyleVar_NodeCornerRounding -mvNodeStyleVar_NodePaddingHorizontal=internal_dpg.mvNodeStyleVar_NodePaddingHorizontal -mvNodeStyleVar_NodePaddingVertical=internal_dpg.mvNodeStyleVar_NodePaddingVertical +mvNodeStyleVar_NodePadding=internal_dpg.mvNodeStyleVar_NodePadding mvNodeStyleVar_NodeBorderThickness=internal_dpg.mvNodeStyleVar_NodeBorderThickness mvNodeStyleVar_LinkThickness=internal_dpg.mvNodeStyleVar_LinkThickness mvNodeStyleVar_LinkLineSegmentsPerLength=internal_dpg.mvNodeStyleVar_LinkLineSegmentsPerLength diff --git a/DearPyGui/dearpygui/dearpygui.py b/DearPyGui/dearpygui/dearpygui.py index fb99aec7f..767936e2c 100644 --- a/DearPyGui/dearpygui/dearpygui.py +++ b/DearPyGui/dearpygui/dearpygui.py @@ -9780,8 +9780,7 @@ def unstage(item : Union[int, str], **kwargs) -> None: mvPlotStyleVar_PlotMinSize=internal_dpg.mvPlotStyleVar_PlotMinSize mvNodeStyleVar_GridSpacing=internal_dpg.mvNodeStyleVar_GridSpacing mvNodeStyleVar_NodeCornerRounding=internal_dpg.mvNodeStyleVar_NodeCornerRounding -mvNodeStyleVar_NodePaddingHorizontal=internal_dpg.mvNodeStyleVar_NodePaddingHorizontal -mvNodeStyleVar_NodePaddingVertical=internal_dpg.mvNodeStyleVar_NodePaddingVertical +mvNodeStyleVar_NodePadding=internal_dpg.mvNodeStyleVar_NodePadding mvNodeStyleVar_NodeBorderThickness=internal_dpg.mvNodeStyleVar_NodeBorderThickness mvNodeStyleVar_LinkThickness=internal_dpg.mvNodeStyleVar_LinkThickness mvNodeStyleVar_LinkLineSegmentsPerLength=internal_dpg.mvNodeStyleVar_LinkLineSegmentsPerLength diff --git a/DearPyGui/src/modules/dearpygui.cpp b/DearPyGui/src/modules/dearpygui.cpp index c2ef7e754..a58c2c789 100644 --- a/DearPyGui/src/modules/dearpygui.cpp +++ b/DearPyGui/src/modules/dearpygui.cpp @@ -374,8 +374,7 @@ GetModuleConstants() // nodes ModuleConstants.push_back({ "mvNodeStyleVar_GridSpacing", ImNodesStyleVar_GridSpacing }); ModuleConstants.push_back({ "mvNodeStyleVar_NodeCornerRounding", ImNodesStyleVar_NodeCornerRounding }); - ModuleConstants.push_back({ "mvNodeStyleVar_NodePaddingHorizontal", ImNodesStyleVar_NodePadding }); - ModuleConstants.push_back({ "mvNodeStyleVar_NodePaddingVertical", ImNodesStyleVar_NodePadding }); + ModuleConstants.push_back({ "mvNodeStyleVar_NodePadding", ImNodesStyleVar_NodePadding }); ModuleConstants.push_back({ "mvNodeStyleVar_NodeBorderThickness", ImNodesStyleVar_NodeBorderThickness }); ModuleConstants.push_back({ "mvNodeStyleVar_LinkThickness", ImNodesStyleVar_LinkThickness }); ModuleConstants.push_back({ "mvNodeStyleVar_LinkLineSegmentsPerLength", ImNodesStyleVar_LinkLineSegmentsPerLength }); diff --git a/DearPyGui/src/ui/AppItems/mvThemes.cpp b/DearPyGui/src/ui/AppItems/mvThemes.cpp index 930bdecf5..461623762 100644 --- a/DearPyGui/src/ui/AppItems/mvThemes.cpp +++ b/DearPyGui/src/ui/AppItems/mvThemes.cpp @@ -408,14 +408,7 @@ static const mvGuiStyleVarInfo* GetStyleVarInfo(ImGuiStyleVar idx) return &GStyleVarInfo[idx]; } -struct mvPlotStyleVarInfo { - ImGuiDataType Type; - ImU32 Count; - ImU32 Offset; - void* GetVarPtr(ImPlotStyle* style) const { return (void*)((unsigned char*)style + Offset); } -}; - -static const mvPlotStyleVarInfo GPlotStyleVarInfo[] = +static const mvGuiStyleVarInfo GPlotStyleVarInfo[] = { { ImGuiDataType_Float, 1, (ImU32)IM_OFFSETOF(ImPlotStyle, LineWeight) }, // ImPlotStyleVar_LineWeight { ImGuiDataType_S32, 1, (ImU32)IM_OFFSETOF(ImPlotStyle, Marker) }, // ImPlotStyleVar_Marker @@ -448,12 +441,51 @@ static const mvPlotStyleVarInfo GPlotStyleVarInfo[] = { ImGuiDataType_Float, 2, (ImU32)IM_OFFSETOF(ImPlotStyle, PlotMinSize) } // ImPlotStyleVar_PlotMinSize }; -static const mvPlotStyleVarInfo* GetPlotStyleVarInfo(ImPlotStyleVar idx) { +static const mvGuiStyleVarInfo* GetPlotStyleVarInfo(ImPlotStyleVar idx) { IM_ASSERT(idx >= 0 && idx < ImPlotStyleVar_COUNT); IM_ASSERT(IM_ARRAYSIZE(GPlotStyleVarInfo) == ImPlotStyleVar_COUNT); return &GPlotStyleVarInfo[idx]; } +static const mvGuiStyleVarInfo GNodeStyleVarInfo[] = { + // ImNodesStyleVar_GridSpacing + {ImGuiDataType_Float, 1, (ImU32)IM_OFFSETOF(ImNodesStyle, GridSpacing)}, + // ImNodesStyleVar_NodeCornerRounding + {ImGuiDataType_Float, 1, (ImU32)IM_OFFSETOF(ImNodesStyle, NodeCornerRounding)}, + // ImNodesStyleVar_NodePadding + {ImGuiDataType_Float, 2, (ImU32)IM_OFFSETOF(ImNodesStyle, NodePadding)}, + // ImNodesStyleVar_NodeBorderThickness + {ImGuiDataType_Float, 1, (ImU32)IM_OFFSETOF(ImNodesStyle, NodeBorderThickness)}, + // ImNodesStyleVar_LinkThickness + {ImGuiDataType_Float, 1, (ImU32)IM_OFFSETOF(ImNodesStyle, LinkThickness)}, + // ImNodesStyleVar_LinkLineSegmentsPerLength + {ImGuiDataType_Float, 1, (ImU32)IM_OFFSETOF(ImNodesStyle, LinkLineSegmentsPerLength)}, + // ImNodesStyleVar_LinkHoverDistance + {ImGuiDataType_Float, 1, (ImU32)IM_OFFSETOF(ImNodesStyle, LinkHoverDistance)}, + // ImNodesStyleVar_PinCircleRadius + {ImGuiDataType_Float, 1, (ImU32)IM_OFFSETOF(ImNodesStyle, PinCircleRadius)}, + // ImNodesStyleVar_PinQuadSideLength + {ImGuiDataType_Float, 1, (ImU32)IM_OFFSETOF(ImNodesStyle, PinQuadSideLength)}, + // ImNodesStyleVar_PinTriangleSideLength + {ImGuiDataType_Float, 1, (ImU32)IM_OFFSETOF(ImNodesStyle, PinTriangleSideLength)}, + // ImNodesStyleVar_PinLineThickness + {ImGuiDataType_Float, 1, (ImU32)IM_OFFSETOF(ImNodesStyle, PinLineThickness)}, + // ImNodesStyleVar_PinHoverRadius + {ImGuiDataType_Float, 1, (ImU32)IM_OFFSETOF(ImNodesStyle, PinHoverRadius)}, + // ImNodesStyleVar_PinOffset + {ImGuiDataType_Float, 1, (ImU32)IM_OFFSETOF(ImNodesStyle, PinOffset)}, + // ImNodesStyleVar_MiniMapPadding + {ImGuiDataType_Float, 2, (ImU32)IM_OFFSETOF(ImNodesStyle, MiniMapPadding)}, + // ImNodesStyleVar_MiniMapOffset + {ImGuiDataType_Float, 2, (ImU32)IM_OFFSETOF(ImNodesStyle, MiniMapOffset)}, +}; + +static const mvGuiStyleVarInfo* GetNodeStyleVarInfo(ImPlotStyleVar idx) { + IM_ASSERT(idx >= 0 && idx < ImNodesStyleVar_COUNT); + IM_ASSERT(IM_ARRAYSIZE(GNodeStyleVarInfo) == ImNodesStyleVar_COUNT); + return &GNodeStyleVarInfo[idx]; +} + mvThemeStyle::mvThemeStyle(mvUUID uuid) : mvAppItem(uuid) @@ -516,7 +548,7 @@ void mvThemeStyle::push_theme_style() } else if (_libType == mvLibType::MV_IMPLOT) { - const mvPlotStyleVarInfo* var_info = GetPlotStyleVarInfo(_targetStyle); + const mvGuiStyleVarInfo* var_info = GetPlotStyleVarInfo(_targetStyle); if (var_info->Type == ImGuiDataType_Float && var_info->Count == 1) ImPlot::PushStyleVar(_targetStyle, (*_value)[0]); else if (var_info->Type == ImGuiDataType_S32 && var_info->Count == 1) @@ -525,7 +557,13 @@ void mvThemeStyle::push_theme_style() ImPlot::PushStyleVar(_targetStyle, { (*_value)[0], (*_value)[1] }); } else if (_libType == mvLibType::MV_IMNODES) - ImNodes::PushStyleVar(_targetStyle, (*_value)[0]); + { + const mvGuiStyleVarInfo* var_info = GetNodeStyleVarInfo(_targetStyle); + if (var_info->Type == ImGuiDataType_Float && var_info->Count == 2) + ImNodes::PushStyleVar(_targetStyle, { (*_value)[0], (*_value)[1] }); + else if (var_info->Type == ImGuiDataType_Float && var_info->Count == 1) + ImNodes::PushStyleVar(_targetStyle, (*_value)[0]); + } } void mvThemeStyle::pop_theme_style()