Skip to content

Commit 5e3e630

Browse files
authored
Merge pull request #373 from gucio321/cimcte-upgrade-2
Update dependencies
2 parents 5ad6857 + c1205dc commit 5e3e630

35 files changed

+183
-121
lines changed

ImGuiColorTextEdit/cimcte_funcs.go

Lines changed: 2 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ImGuiColorTextEdit/cimcte_wrapper.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
#include "cimcte_wrapper.h"
55
#include "../cwrappers/cimCTE.h"
66

7-
void wrap_TextEditor_ImGuiDebugPanel(TextEditor* self) { TextEditor_ImGuiDebugPanel(self,"Debug"); }
87
void wrap_TextEditor_Redo(TextEditor* self) { TextEditor_Redo(self,1); }
98
bool wrap_TextEditor_Render(TextEditor* self,const char* aTitle) { return TextEditor_Render(self,aTitle,false,ImVec2(),false); }
109
void wrap_TextEditor_SelectAllOccurrencesOf(TextEditor* self,const char* aText,int aTextSize) { TextEditor_SelectAllOccurrencesOf(self,aText,aTextSize,true); }

ImGuiColorTextEdit/cimcte_wrapper.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
extern "C" {
1010
#endif
1111

12-
extern void wrap_TextEditor_ImGuiDebugPanel(TextEditor* self);
1312
extern void wrap_TextEditor_Redo(TextEditor* self);
1413
extern bool wrap_TextEditor_Render(TextEditor* self,const char* aTitle);
1514
extern void wrap_TextEditor_SelectAllOccurrencesOf(TextEditor* self,const char* aText,int aTextSize);

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ update: setup
143143
$(call cimmarkdown)
144144
$(call update,cimguizmo,https://github.com/cimgui/cimguizmo,ImGuizmo,master)
145145
$(call cimguizmo)
146-
$(call update,cimCTE,https://github.com/cimgui/cimcte,ImGuiColorTextEdit,master_santa)
146+
$(call update,cimCTE,https://github.com/cimgui/cimcte,ImGuiColorTextEdit,master)
147147
$(call cimcte)
148148
$(call dummy)
149149

cmd/codegen/arguments_wrapper.go

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,9 @@ func getArgWrapper(
3737
context *Context,
3838
) (argDeclaration string, data ArgumentWrapperData, err error) {
3939
argWrapperMap := map[CIdentifier]argumentWrapper{
40-
"char": simpleW("rune", "C.char"),
41-
"char*": constCharW,
42-
"const char*": constCharW,
43-
// used by code editor
44-
"const std::string": constCharW,
40+
"char": simpleW("rune", "C.char"),
41+
"char*": constCharW,
42+
"const char*": constCharW,
4543
"const char**": charPtrPtrW,
4644
"const char* const[]": charPtrPtrW,
4745
"unsigned char": simpleW("uint", "C.uchar"),

cmd/codegen/gencpp.go

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,13 @@ import (
77
"unicode"
88
)
99

10+
// cppFunctionsReplace allows to force-replace function name with some other name.
11+
// Introduced to replace TextEditor_GetText -> TextEditor_GetText_alloc
12+
// but could be re-used to force use of another function than json tells us to use.
13+
var cppFunctionsReplace = map[CIdentifier]CIdentifier{
14+
"TextEditor_GetText": "TextEditor_GetText_alloc",
15+
}
16+
1017
// Name of argument in cpp/go files.
1118
// It is used by functions that has text and text_end arguments.
1219
// In this case text_end is replaced by this argument (of type int)
@@ -108,7 +115,7 @@ extern "C" {
108115
// could be generated in Go code.
109116
// So, could be skip cimgui_wrapper.ccp/.h entirely?
110117

111-
cWrapperFuncName := "wrap_" + funcName
118+
cWrapperFuncName := "wrap_" + f.FuncName
112119

113120
// Remove all ... arg
114121
f.Args = strings.Replace(f.Args, ",...", "", 1)
@@ -389,6 +396,11 @@ extern "C" {
389396
cppSb.WriteString(fmt.Sprintf("%s %s%s { return %s%s; }\n", f.Ret, cWrapperFuncName, f.Args, invokeFunctionName, actualCallArgsStr))
390397
}
391398
}
399+
400+
if v, ok := cppFunctionsReplace[funcName]; ok {
401+
cWrapperFuncName = v
402+
}
403+
392404
appendValidFunc()
393405
}
394406

cmd/codegen/return_wrapper.go

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,14 @@ func getReturnWrapper(
2020
context *Context,
2121
) (returnWrapper, error) {
2222
returnWrapperMap := map[CIdentifier]returnWrapper{
23-
"bool": {"bool", "%s == C.bool(true)", "C.bool"},
24-
"bool*": simplePtrR("bool", "C.bool"),
25-
"const bool*": simplePtrR("bool", "c.bool"),
26-
"char": simpleR("rune", "C.char"),
27-
"unsigned char": simpleR("uint", "C.char"),
28-
"unsigned char*": {"*uint", "(*uint)(unsafe.Pointer(%s))", "C.uchar"}, // NOTE: This should work but I'm not 100% sure
29-
"char*": {"string", "C.GoString(%s)", "*C.char"},
30-
"const char*": {"string", "C.GoString(%s)", "*C.char"},
31-
// this is randomly used by cimCTE. It is const char* in c code but string in json for some reason
32-
// probably should fix in cimCTE
33-
"string": {"string", "C.GoString(%s)", "*C.char"},
23+
"bool": {"bool", "%s == C.bool(true)", "C.bool"},
24+
"bool*": simplePtrR("bool", "C.bool"),
25+
"const bool*": simplePtrR("bool", "c.bool"),
26+
"char": simpleR("rune", "C.char"),
27+
"unsigned char": simpleR("uint", "C.char"),
28+
"unsigned char*": {"*uint", "(*uint)(unsafe.Pointer(%s))", "C.uchar"}, // NOTE: This should work but I'm not 100% sure
29+
"char*": {"string", "C.GoString(%s)", "*C.char"},
30+
"const char*": {"string", "C.GoString(%s)", "*C.char"},
3431
"const ImWchar*": simpleR("(*Wchar)", "*C.ImWchar"),
3532
"ImWchar*": simpleR("(*Wchar)", "*C.ImWchar"),
3633
"ImWchar": simpleR("Wchar", "C.ImWchar"),

cwrappers/ImGuizmo/ImGuizmo.cpp

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -666,9 +666,8 @@ namespace IMGUIZMO_NAMESPACE
666666

667667
struct Context
668668
{
669-
Context() : mbUsing(false), mbUsingViewManipulate(false), mbEnable(true), mbUsingBounds(false)
669+
Context() : mbUsing(false), mbUsingViewManipulate(false), mbEnable(true), mIsViewManipulatorHovered(false), mbUsingBounds(false)
670670
{
671-
mIDStack.push_back(-1);
672671
}
673672

674673
ImDrawList* mDrawList;
@@ -707,6 +706,7 @@ namespace IMGUIZMO_NAMESPACE
707706
bool mbEnable;
708707
bool mbMouseOver;
709708
bool mReversed; // reversed projection matrix
709+
bool mIsViewManipulatorHovered;
710710

711711
// translation
712712
vec_t mTranslationPlan;
@@ -768,7 +768,14 @@ namespace IMGUIZMO_NAMESPACE
768768
bool mAllowAxisFlip = true;
769769
float mGizmoSizeClipSpace = 0.1f;
770770

771-
inline ImGuiID GetCurrentID() {return mIDStack.back();}
771+
inline ImGuiID GetCurrentID()
772+
{
773+
if (mIDStack.empty())
774+
{
775+
mIDStack.push_back(-1);
776+
}
777+
return mIDStack.back();
778+
}
772779
};
773780

774781
static Context gContext;
@@ -1007,6 +1014,11 @@ namespace IMGUIZMO_NAMESPACE
10071014
return gContext.mbUsingViewManipulate;
10081015
}
10091016

1017+
bool IsViewManipulateHovered()
1018+
{
1019+
return gContext.mIsViewManipulatorHovered;
1020+
}
1021+
10101022
bool IsUsingAny()
10111023
{
10121024
return gContext.mbUsing || gContext.mbUsingBounds;
@@ -1094,7 +1106,6 @@ namespace IMGUIZMO_NAMESPACE
10941106
// compute scale from the size of camera right vector projected on screen at the matrix position
10951107
vec_t pointRight = viewInverse.v.right;
10961108
pointRight.TransformPoint(gContext.mViewProjection);
1097-
gContext.mScreenFactor = gContext.mGizmoSizeClipSpace / (pointRight.x / pointRight.w - gContext.mMVP.v.position.x / gContext.mMVP.v.position.w);
10981109

10991110
vec_t rightViewInverse = viewInverse.v.right;
11001111
rightViewInverse.TransformVector(gContext.mModelInverse);
@@ -2543,12 +2554,16 @@ namespace IMGUIZMO_NAMESPACE
25432554

25442555
void SetID(int id)
25452556
{
2557+
if (gContext.mIDStack.empty())
2558+
{
2559+
gContext.mIDStack.push_back(-1);
2560+
}
25462561
gContext.mIDStack.back() = id;
25472562
}
25482563

25492564
ImGuiID GetID(const char* str, const char* str_end)
25502565
{
2551-
ImGuiID seed = gContext.mIDStack.back();
2566+
ImGuiID seed = gContext.GetCurrentID();
25522567
ImGuiID id = ImHashStr(str, str_end ? (str_end - str) : 0, seed);
25532568
return id;
25542569
}
@@ -2560,14 +2575,14 @@ namespace IMGUIZMO_NAMESPACE
25602575

25612576
ImGuiID GetID(const void* ptr)
25622577
{
2563-
ImGuiID seed = gContext.mIDStack.back();
2578+
ImGuiID seed = gContext.GetCurrentID();
25642579
ImGuiID id = ImHashData(&ptr, sizeof(void*), seed);
25652580
return id;
25662581
}
25672582

25682583
ImGuiID GetID(int n)
25692584
{
2570-
ImGuiID seed = gContext.mIDStack.back();
2585+
ImGuiID seed = gContext.GetCurrentID();
25712586
ImGuiID id = ImHashData(&n, sizeof(n), seed);
25722587
return id;
25732588
}
@@ -2907,7 +2922,6 @@ namespace IMGUIZMO_NAMESPACE
29072922
{
29082923
static bool isDraging = false;
29092924
static bool isClicking = false;
2910-
static bool isInside = false;
29112925
static vec_t interpolationUp;
29122926
static vec_t interpolationDir;
29132927
static int interpolationFrames = 0;
@@ -3020,7 +3034,7 @@ namespace IMGUIZMO_NAMESPACE
30203034
if (iPass)
30213035
{
30223036
ImU32 directionColor = GetColorU32(DIRECTION_X + normalIndex);
3023-
gContext.mDrawList->AddConvexPolyFilled(faceCoordsScreen, 4, (directionColor | IM_COL32(0x80, 0x80, 0x80, 0x80)) | (isInside ? IM_COL32(0x08, 0x08, 0x08, 0) : 0));
3037+
gContext.mDrawList->AddConvexPolyFilled(faceCoordsScreen, 4, (directionColor | IM_COL32(0x80, 0x80, 0x80, 0x80)) | (gContext.mIsViewManipulatorHovered ? IM_COL32(0x08, 0x08, 0x08, 0) : 0));
30243038
if (boxes[boxCoordInt])
30253039
{
30263040
gContext.mDrawList->AddConvexPolyFilled(faceCoordsScreen, 4, IM_COL32(0xF0, 0xA0, 0x60, 0x80));
@@ -3049,7 +3063,7 @@ namespace IMGUIZMO_NAMESPACE
30493063
vec_t newEye = camTarget + newDir * length;
30503064
LookAt(&newEye.x, &camTarget.x, &newUp.x, view);
30513065
}
3052-
isInside = gContext.mbMouseOver && ImRect(position, position + size).Contains(io.MousePos);
3066+
gContext.mIsViewManipulatorHovered = gContext.mbMouseOver && ImRect(position, position + size).Contains(io.MousePos);
30533067

30543068
if (io.MouseDown[0] && (fabsf(io.MouseDelta[0]) || fabsf(io.MouseDelta[1])) && isClicking)
30553069
{

cwrappers/ImGuizmo/ImGuizmo.h

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@
3939
// - display rotation/translation/scale infos in local/world space and not only local
4040
// - finish local/world matrix application
4141
// - OPERATION as bitmask
42-
//
42+
//
4343
// -------------------------------------------------------------------------------------------
44-
// Example
44+
// Example
4545
#if 0
4646
void EditTransform(const Camera& camera, matrix_t& matrix)
4747
{
@@ -140,6 +140,8 @@ namespace IMGUIZMO_NAMESPACE
140140

141141
// return true if the view gizmo is in moving state
142142
IMGUI_API bool IsUsingViewManipulate();
143+
// only check if your mouse is over the view manipulator - no matter whether it's active or not
144+
IMGUI_API bool IsViewManipulateHovered();
143145

144146
// return true if any gizmo is in moving state
145147
IMGUI_API bool IsUsingAny();
@@ -172,7 +174,7 @@ namespace IMGUIZMO_NAMESPACE
172174
IMGUI_API void DrawGrid(const float* view, const float* projection, const float* matrix, const float gridSize);
173175

174176
// call it when you want a gizmo
175-
// Needs view and projection matrices.
177+
// Needs view and projection matrices.
176178
// matrix parameter is the source matrix (where will be gizmo be drawn) and might be transformed by the function. Return deltaMatrix is optional
177179
// translation is applied in world space
178180
enum OPERATION
@@ -222,7 +224,7 @@ namespace IMGUIZMO_NAMESPACE
222224
IMGUI_API void ViewManipulate(float* view, const float* projection, OPERATION operation, MODE mode, float* matrix, float length, ImVec2 position, ImVec2 size, ImU32 backgroundColor);
223225

224226
IMGUI_API void SetAlternativeWindow(ImGuiWindow* window);
225-
227+
226228
[[deprecated("Use PushID/PopID instead.")]]
227229
IMGUI_API void SetID(int id);
228230

cwrappers/VERSION.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
cimgui (https://github.com/cimgui/cimgui) HEAD is on: fdd07821bbcc6583431fd42ad3ffad3a82e69501
2-
cimgui/imgui HEAD is on: ee1deccc08c14ab1e6abcfa6aae11d915763cdb7
1+
cimgui (https://github.com/cimgui/cimgui) HEAD is on: be19fd11eb9684462aa50ae98fa68d657daa588d
2+
cimgui/imgui HEAD is on: a63220e3e0b28dfcd51e2e23aa79c1359fcace78
33
cimplot (https://github.com/cimgui/cimplot) HEAD is on: 19c90f3fb469aeba2cc66f29c29c23cf438b5dfc
44
cimplot/implot HEAD is on: 419a8a0f5fcb77e1e7c19ab540441686bfe21bca
55
cimnodes (https://github.com/cimgui/cimnodes) HEAD is on: f20c83c3cab8e99828d85c66ed3acd087f632c21
66
cimnodes/imnodes HEAD is on: 8563e1655bd9bb1f249e6552cc6274d506ee788b
77
cimmarkdown (https://github.com/gucio321/cimmarkdown) HEAD is on: 6e921ffc2b57a9969b98bf8f5aeed912bfb497f6
88
cimmarkdown/imgui_markdown HEAD is on: 4eb198f68090c9a1622bb9c78ee61f65b6ddc898
99
cimguizmo (https://github.com/cimgui/cimguizmo) HEAD is on: b360304e3e184cb4eb387429b55d7d41bbc40660
10-
cimguizmo/ImGuizmo HEAD is on: 4298a220f113da33a73fb8357e238307c924f167
11-
cimCTE (https://github.com/cimgui/cimcte) HEAD is on: d31240389693ade0e86273984ea8f521c679cead
10+
cimguizmo/ImGuizmo HEAD is on: e552f632bbb17a0ebf5a91a22900f6f68bac6545
11+
cimCTE (https://github.com/cimgui/cimcte) HEAD is on: d79dad531be6fcb76a587eefe7d0e49ef7e93bb3
1212
cimCTE/ImGuiColorTextEdit HEAD is on: 8927d95742d4ad05540277435bab3d9ac3678bf6

0 commit comments

Comments
 (0)