-
Notifications
You must be signed in to change notification settings - Fork 283
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support to access certain things within ImGuiContext
#108
Comments
Only structs appearing in imgui.h are wrapped and considered in the public API |
@sonoro1234 I understand that, but being able to add widgets which animations do them does require accessing the internal |
@sonoro1234 Thank you. I am also trying to use a bit more of the internal stuff too, but thank you. I'll keep to my current solution. |
Perhaps @ocornut has something to say about imgui.h and imgui_internal.h? |
You could probably provide a cimgui_internal.h with some data structure if you wanted. Nothing in there is guaranteed to be fwd compatible tho. |
@gingerBill typedef struct ImVector{int Size;int Capacity;void* Data;} ImVector;
typedef struct ImVector_float {int Size;int Capacity;float* Data;} ImVector_float;
typedef struct ImVector_ImWchar {int Size;int Capacity;ImWchar* Data;} ImVector_ImWchar;
typedef struct ImVector_unsigned_char {int Size;int Capacity;unsigned char* Data;} ImVector_unsigned_char;
typedef struct ImVector_ImGuiSettingsHandler {int Size;int Capacity;ImGuiSettingsHandler* Data;} ImVector_ImGuiSettingsHandle
r;
typedef struct ImVector_T {int Size;int Capacity;T* Data;} ImVector_T;
typedef struct ImVector_ImGuiStyleMod {int Size;int Capacity;ImGuiStyleMod* Data;} ImVector_ImGuiStyleMod;
typedef struct ImVector_ImGuiPopupData {int Size;int Capacity;ImGuiPopupData* Data;} ImVector_ImGuiPopupData;
typedef struct ImVector_ImGuiItemFlags {int Size;int Capacity;ImGuiItemFlags* Data;} ImVector_ImGuiItemFlags;
typedef struct ImVector_ImGuiTabItem {int Size;int Capacity;ImGuiTabItem* Data;} ImVector_ImGuiTabItem;
typedef struct ImVector_ImGuiWindowPtr {int Size;int Capacity;ImGuiWindow** Data;} ImVector_ImGuiWindowPtr;
typedef struct ImVector_ImGuiColumns {int Size;int Capacity;ImGuiColumns* Data;} ImVector_ImGuiColumns;
typedef struct ImVector_ImGuiShrinkWidthItem {int Size;int Capacity;ImGuiShrinkWidthItem* Data;} ImVector_ImGuiShrinkWidthIte
m;
typedef struct ImVector_ImGuiID {int Size;int Capacity;ImGuiID* Data;} ImVector_ImGuiID;
typedef struct ImVector_ImGuiGroupData {int Size;int Capacity;ImGuiGroupData* Data;} ImVector_ImGuiGroupData;
typedef struct ImVector_int {int Size;int Capacity;int* Data;} ImVector_int;
typedef struct ImVector_ImGuiColumnData {int Size;int Capacity;ImGuiColumnData* Data;} ImVector_ImGuiColumnData;
typedef struct ImVector_ImDrawListPtr {int Size;int Capacity;ImDrawList** Data;} ImVector_ImDrawListPtr;
typedef struct ImVector_ImFontPtr {int Size;int Capacity;ImFont** Data;} ImVector_ImFontPtr;
typedef struct ImVector_ImGuiWindowSettings {int Size;int Capacity;ImGuiWindowSettings* Data;} ImVector_ImGuiWindowSettings;
typedef struct ImVector_char {int Size;int Capacity;char* Data;} ImVector_char;
typedef struct ImVector_ImGuiColorMod {int Size;int Capacity;ImGuiColorMod* Data;} ImVector_ImGuiColorMod;
typedef struct ImVector_ImGuiPtrOrIndex {int Size;int Capacity;ImGuiPtrOrIndex* Data;} ImVector_ImGuiPtrOrIndex;
struct ImGuiContext
{
bool Initialized;
bool FrameScopeActive;
bool FrameScopePushedImplicitWindow;
bool FontAtlasOwnedByContext;
ImGuiIO IO;
ImGuiStyle Style;
ImFont* Font;
float FontSize;
float FontBaseSize;
ImDrawListSharedData DrawListSharedData;
double Time;
int FrameCount;
int FrameCountEnded;
int FrameCountRendered;
ImVector_ImGuiWindowPtr Windows;
ImVector_ImGuiWindowPtr WindowsFocusOrder;
ImVector_ImGuiWindowPtr WindowsSortBuffer;
ImVector_ImGuiWindowPtr CurrentWindowStack;
ImGuiStorage WindowsById;
int WindowsActiveCount;
ImGuiWindow* CurrentWindow;
ImGuiWindow* HoveredWindow;
ImGuiWindow* HoveredRootWindow;
ImGuiWindow* MovingWindow;
ImGuiWindow* WheelingWindow;
ImVec2 WheelingWindowRefMousePos;
float WheelingWindowTimer;
ImGuiID HoveredId;
bool HoveredIdAllowOverlap;
ImGuiID HoveredIdPreviousFrame;
float HoveredIdTimer;
float HoveredIdNotActiveTimer;
ImGuiID ActiveId;
ImGuiID ActiveIdIsAlive;
float ActiveIdTimer;
bool ActiveIdIsJustActivated;
bool ActiveIdAllowOverlap;
bool ActiveIdHasBeenPressedBefore;
bool ActiveIdHasBeenEditedBefore;
bool ActiveIdHasBeenEditedThisFrame;
int ActiveIdAllowNavDirFlags;
int ActiveIdBlockNavInputFlags;
ImVec2 ActiveIdClickOffset;
ImGuiWindow* ActiveIdWindow;
ImGuiInputSource ActiveIdSource;
ImGuiID ActiveIdPreviousFrame;
bool ActiveIdPreviousFrameIsAlive;
bool ActiveIdPreviousFrameHasBeenEditedBefore;
ImGuiWindow* ActiveIdPreviousFrameWindow;
ImGuiID LastActiveId;
float LastActiveIdTimer;
ImGuiNextWindowData NextWindowData;
ImGuiNextItemData NextItemData;
ImVector_ImGuiColorMod ColorModifiers;
ImVector_ImGuiStyleMod StyleModifiers;
ImVector_ImFontPtr FontStack;
ImVector_ImGuiPopupData OpenPopupStack;
ImVector_ImGuiPopupData BeginPopupStack;
ImGuiWindow* NavWindow;
ImGuiID NavId;
ImGuiID NavActivateId;
ImGuiID NavActivateDownId;
ImGuiID NavActivatePressedId;
ImGuiID NavInputId;
ImGuiID NavJustTabbedId;
ImGuiID NavJustMovedToId;
ImGuiID NavJustMovedToMultiSelectScopeId;
ImGuiID NavNextActivateId;
ImGuiInputSource NavInputSource;
ImRect NavScoringRectScreen;
int NavScoringCount;
ImGuiWindow* NavWindowingTarget;
ImGuiWindow* NavWindowingTargetAnim;
ImGuiWindow* NavWindowingList;
float NavWindowingTimer;
float NavWindowingHighlightAlpha;
bool NavWindowingToggleLayer;
ImGuiNavLayer NavLayer;
int NavIdTabCounter;
bool NavIdIsAlive;
bool NavMousePosDirty;
bool NavDisableHighlight;
bool NavDisableMouseHover;
bool NavAnyRequest;
bool NavInitRequest;
bool NavInitRequestFromMove;
ImGuiID NavInitResultId;
ImRect NavInitResultRectRel;
bool NavMoveFromClampedRefRect;
bool NavMoveRequest;
ImGuiNavMoveFlags NavMoveRequestFlags;
ImGuiNavForward NavMoveRequestForward;
ImGuiDir NavMoveDir;
ImGuiDir NavMoveDirLast;
ImGuiDir NavMoveClipDir;
ImGuiNavMoveResult NavMoveResultLocal;
ImGuiNavMoveResult NavMoveResultLocalVisibleSet;
ImGuiNavMoveResult NavMoveResultOther;
ImGuiWindow* FocusRequestCurrWindow;
ImGuiWindow* FocusRequestNextWindow;
int FocusRequestCurrCounterAll;
int FocusRequestCurrCounterTab;
int FocusRequestNextCounterAll;
int FocusRequestNextCounterTab;
bool FocusTabPressed;
ImDrawData DrawData;
ImDrawDataBuilder DrawDataBuilder;
float DimBgRatio;
ImDrawList BackgroundDrawList;
ImDrawList ForegroundDrawList;
ImGuiMouseCursor MouseCursor;
bool DragDropActive;
bool DragDropWithinSourceOrTarget;
ImGuiDragDropFlags DragDropSourceFlags;
int DragDropSourceFrameCount;
int DragDropMouseButton;
ImGuiPayload DragDropPayload;
ImRect DragDropTargetRect;
ImGuiID DragDropTargetId;
ImGuiDragDropFlags DragDropAcceptFlags;
float DragDropAcceptIdCurrRectSurface;
ImGuiID DragDropAcceptIdCurr;
ImGuiID DragDropAcceptIdPrev;
int DragDropAcceptFrameCount;
ImVector_unsigned_char DragDropPayloadBufHeap;
unsigned char DragDropPayloadBufLocal[8];
ImGuiTabBar* CurrentTabBar;
ImPool_ImGuiTabBar TabBars;
ImVector_ImGuiPtrOrIndex CurrentTabBarStack;
ImVector_ImGuiShrinkWidthItem ShrinkWidthBuffer;
ImVec2 LastValidMousePos;
ImGuiInputTextState InputTextState;
ImFont InputTextPasswordFont;
ImGuiID TempInputTextId;
ImGuiColorEditFlags ColorEditOptions;
float ColorEditLastHue;
float ColorEditLastColor[3];
ImVec4 ColorPickerRef;
bool DragCurrentAccumDirty;
float DragCurrentAccum;
float DragSpeedDefaultRatio;
float ScrollbarClickDeltaToGrabCenter;
int TooltipOverrideCount;
ImVector_char PrivateClipboard;
ImGuiID MultiSelectScopeId;
ImVec2 PlatformImePos;
ImVec2 PlatformImeLastPos;
bool SettingsLoaded;
float SettingsDirtyTimer;
ImGuiTextBuffer SettingsIniData;
ImVector_ImGuiSettingsHandler SettingsHandlers;
ImVector_ImGuiWindowSettings SettingsWindows;
bool LogEnabled;
ImGuiLogType LogType;
FILE* LogFile;
ImGuiTextBuffer LogBuffer;
float LogLinePosY;
bool LogLineFirstItem;
int LogDepthRef;
int LogDepthToExpand;
int LogDepthToExpandDefault;
bool DebugItemPickerActive;
ImGuiID DebugItemPickerBreakID;
float FramerateSecPerFrame[120];
int FramerateSecPerFrameIdx;
float FramerateSecPerFrameAccum;
int WantCaptureMouseNextFrame;
int WantCaptureKeyboardNextFrame;
int WantTextInputNextFrame;
char TempBuffer[1024*3+1];
} Would it be useful? |
@sonoro1234 Just wanted to chime in that this would be very useful. I know it's not part of the public API and subject to change, but the flexibility this gives is often used in C++ projects and would be very helpful in cimgui-based bindings. |
What should I provide? |
This would be very useful!!! Thank you! I'm not too bothered about forward compatibility as I just fix the version any way for the project I am using. |
I still have no answer to my questions. |
@sonoro1234 Who were the questions directed at? Myself? If so, just exposing the context structure alone is more than enough for 99.9% of things. |
To everybody having any interest in imgui_internal.h
I your case I would propose just changing ImGuiContext definition in cimgui.h by the definition in imgui_internal.h |
trying the above and compiling the test says
|
Adding the structures definitions missing it says
Which could be still worked adding enum keyword before enum types declaration and dropping namespace ImStb But now cimgui.h is too big for only having ImGuiContext defined in it!!! |
@ocornut
It is caused by https://github.com/ocornut/imgui/blob/master/imgui_internal.h#L1603 |
Pushed fix. |
@ocornut
where this typedef needed in C code The workaround would be to use |
I don't understand how ImGuiTabBar (imgui_internal.h) can be declared before ImGuiStorage (imgui.h). Why is this code in cimgui.h anyway shouldn't it be in cimgui_internal.h ?
Unfortunately that's not acceptable (to add an extra indirection/alloc) in such a low-level primitive. |
Because it is a typedef created by cimgui before all stuff is written to allow C compatibility.
Ok. Then I will hack a little to move ImGuiStorage declaration before the relevant typedef. |
@gingerBill just pushed cimgui_internal.h generation providing acces to structs and enums in imgui_internal. It should be included after cimgui.h. Does it work correctly? |
@sonoro1234 I will give it a go tomorrow. Thank you for everything :) |
Just dropped cimgui_internal.h generation because #111 |
Have you looked into how to support it? It is mostly a parsing issue? The exporter generally "only" need to replace
by
|
Well, gingerBill just didn't answer!! |
The reason I found this issue again is that I often see people using other languages (relying on cimgui) being stuck with some of the more experimental features. If you expose it it should definitively be in another header file (e.g. |
I apologize I did not answer. I did test it and it did work. The solution that I have worked out for my stuff is to just replicate the I do agree that this should be a completely separate header file because of a lot of it is more "advanced" than the non-internal API. |
Too busy at the moment, I expect to work on this next week. |
@ocornut I have been working a little |
~ inverts all the bits, so ~0 is all bits sets.
|
Thanks (I should have googled C++ operators) I think it is finished? |
If it works with Docking branch then I would say yes! Bonus suggestion :)
imgui.h has
And others depending on branches/features, so if those are somehow copied to |
My git knowledge is quite limited, but perhaps you have some suggestion. Perhaps you know a better way? Added branch docking_last |
Are the .json/.lua metadata for other bindings output as well for the internal parts? What distinguishes them?
|
They can be generated but I only add generated files in the commit of last_docking branch |
seeing ocornut/imgui#2951 It is done now in internal_functions branch. Could not generate separated cimgui and cimgui_internal files because the parsing cant be separated to avoid collisions between both. An option was added to |
Would it be possible to add support for things that in the
ImGuiContext
such asActiveIdTimer
,LastActiveIdTimer
and many of the otherActiveId*
tracking information.I understand why the
ImGuiContext
is not defined in the definitions but certain things such as the*ActiveIdTimer
s are useful for adding custom animated widgets.I am currently just making my own wrappers, which is fine. I am not sure if others have wanted this, or if they are just adding their own functionality to get this.
The text was updated successfully, but these errors were encountered: