-
Notifications
You must be signed in to change notification settings - Fork 361
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
Feature: Porting MFC tools #649
base: master
Are you sure you want to change the base?
Conversation
incl. dhewm3-specific adjustments to imgui_impl_opengl2.cpp (two additional qgl #defines)
c2dcc80 Docking: fixed ImGuiWindowFlags_DockNodeHost / ImGuiWindowFlags_NavFlattened clash introduced by c38c18c just for 1.91.7 (#8357) 1.91.7-docking crashed when opening the dhewm3 settings window, now this issue is fixed upstream so upgrade to the latest code.
using commit 719e925b2eabeef "Started to simplify the light editor" (afterwards they started integrating ImGuizmo, let's do that later once things work...) compiles (without AfEditor), but not functional yet
seems to work! at least as long as the MFC tools are disabled
unless ImGui is disabled, then use the MFC one, unless that's also disabled, then just print a warning
shows a little grey overlay window with given text in the upper left corner of the window
- functionality is the same as the old dialog (video/audio editing does not work)
Thank you very much! The screenshot looks pretty good :) I'll look at the code later; are the questions from #647 (comment) regarding modal dialogs and layout still open or have you figured that out already? |
I think I figured modals out. The code:
translates to the opening of the dialog:
and it's drawing & output handling routine:
Yes, I wanted to have a 3-column layout like in the original MFC dialog and have it scale or change according to the available space. For this dialog, I think the fixed layout will suffice, for other dialogs we may have to get creative. There is also the issue that the window position is reset when PDA is selected. |
Ok, I'll have a look! By the way, did you check out the ImGui Demo (open Dhewm3Settings menu with F10 -> Other Options -> [Show ImGui Demo])? |
Thank you, I'll check it out! |
- the name of the window passed to ImGui must be stable
@DanielGibson Table layout works nicely! Also, fixed the reappearing window bug: the name of the window passed to ImGui must be stable. |
That's awesome! Regarding the stable title: You can use Simlarly, you could use for example |
I know this was already the case in the original PDA editor, but I wonder why the buttons in the left pane use "Add" and "Del" while the others use "Add..." and "Delete..." Also, I just tried that "Add" (PDA) button and it asked me for a name and I entered it and clicked ok, but the modal didn't close (neither when clicking cancel or pressing escape or anything else). The .pda file was written, though. |
A problem with the ImGui-based ingame editors is that when clicking into the game window the cursor is grabbed by the game again (because then the ImGui window doesn't have focus anymore) and it's hard to get it back. I feel like the ingame editor integration could overall be better, maybe with a command to launch a menu that allows launching and editor; that command could also free the mousecursor?
except for the ones that already were in the ImGui namespace
In https://github.com/DanielGibson/dhewm3/tree/imgui-tools I have (based on your branch) integrated the AfEditor and also modified |
} | ||
|
||
void PDAEditor::OnBtnClickedPDADel() | ||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe this could be implemented like
idStr fileName = "newpdas/";
fileName += pdaName; // TODO
fileName += ".pda";
fileSystem->RemoveFile( fileName );
I just tried to implement deletion, cannot get it to work. The Decl manager keeps a copy of PDA decl in memory, so even if the file is deleted, it will still get re-created.
Fixed that. I'll add the missing dialogs for audio & video and include this fix. |
cmdSystem->AddCommand( "editSounds", Com_EditSounds_f, CMD_FL_TOOL, "launches the in-game Sound Editor" ); | ||
cmdSystem->AddCommand( "editDecls", Com_EditDecls_f, CMD_FL_TOOL, "launches the in-game Declaration Editor" ); | ||
cmdSystem->AddCommand( "editAFs", Com_EditAFs_f, CMD_FL_TOOL, "launches the in-game Articulated Figure Editor" ); | ||
cmdSystem->AddCommand( "editParticles", Com_EditParticles_f, CMD_FL_TOOL, "launches the in-game Particle Editor" ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remember to also move the lines for editParticles and editScripts above the #ifdef ID_ALLOW_TOOLS
:)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.. and Com_EditScripts_f()
and Com_EditDecls_f()
as well ;)
Great work so far!
I couldn't reproduce this, what particle did you use when you had issues with r_useSoftParticles 1?
You could try setting the By the way: I think it would be nice if those lists of materials etc were sorted alphabetically. I think it should work to just call And I think it'd be cool if the material picker could show a preview image for a selected material. static idImage* GetLightEditorImage( const idMaterial* mat )
{
// this is similar to what the original light editor does; rbd3bfg iterates through all stages to find a non-null image
idImage* ret = (mat->GetNumStages() > 0) ? mat->GetStage(0)->texture.image : NULL;
return ret ? ret : mat->GetEditorImage();
}
void DrawTexture() {
if( currentTexture != nullptr )
{
ImVec2 size( currentTexture->uploadWidth, currentTexture->uploadHeight );
ImGui::Image( currentTexture->texnum, size, ImVec2( 0, 0 ), ImVec2( 1, 1 ),
ImColor( 255, 255, 255, 255 ), ImColor( 255, 255, 255, 128 ) );
}
} (also, at some point check if |
void OnEditFindNext(); | ||
void OnEditReplace(); | ||
LRESULT OnFindDialogMessage( WPARAM wParam, LPARAM lParam ); | ||
void OnEnChangeEdit( NMHDR *pNMHDR, LRESULT *pResult ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
probably to be expected at this early point of the script editor, but remember that all those FULLCAPS types are windows-only, so this currently breaks the build on Linux and macOS
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry about that, I'm currently trying to just get something out the door. ^_^ Thanks for the feedback, much appreciated!
- draws a decl tree and allows searching - FIXME: for some reason, keeps the root node searchable and viewable (e..g searching by name `*/material/right*` works, you have to skip the root node) - doesn't allow editing or creating decls
- give a descriptive message if the binary was compiled without editors
Thanks! This works great!
Should be working now, also, on-the-fly filtering should be working too. ^_^
Noted! I'll get back to this before finishing up the PR. |
@DanielGibson I have a question two questions. ScriptEditorI'm choosing between the following editors to embed:
You mentioned ImGuiColorTextEdit earlier, but it's not been updated in a while. There are also some tiny Emacs clones floating around that we could embed: To name a few. We could probably just 're-target' one of these to use ImGui output instead of CLI output since they are so tiny. Anyways, just looking for feedback. Could you get me up to speed on which one to embed, and what's the process of including it into the codebase? Could I just copy it over? Should I use CMake to pull it from its source repo? Etc. Memory management in
|
Regarding editors: zep also looks good!
I guess it still would be non-trivial to get ImGui to render this, which includes cursor and text selection, properly (and with good performance). Not sure of those emacs clones offer that, but it's important that the editor can be used without being familiar with emacs (or vi) shortcuts. Having such a mode as an option is fine, but by default it should behave like a standard GUI text editor (think notepad++, geany, kate, ...).
Yes, just copy it over, like I do with ImGui. Regarding the memory management, I'll have to take a closer look, will reply later. |
This depends on what types you allocate with it. If your types need idStr or similar, just use regular (I first thought that hacking |
Correction: Still not quite the behavior one would (probably) expect - but maybe good enough for your usecase? |
- fix PathTreeCtrl node allocation, add selection & tooltips - Decl New dialog is mostly working - fix: Decl Browser no longer adds an extra root node - Decl Browser has a bug searching: still need to enter "*/" to skip the implicit root node ImGui issue: only one window is displayed by ImGui? repro: editDecls, then select any particle under particles, click New, enter a name, click OK.
- do not insert the root node more than once
Extremely barebones. Now is the time to improve script editor & generic decl editor.
[ColorTextEdit](https://github.com/santaclose/ImGuiColorTextEdit) commit `cd9090d`. This fork is still using C++11, but usage of `boost::regex` is removed. Let's try Zep next, but this already looks like it could do the job!
@DanielGibson Got ColorTextEditor working in the Script Editor, and finished up Decl Browser. I would like to try using Zep next, to see if it's worth the cost. Next I'll need to make use of the new editor in Decl Editor dialog, and reimplement tooltips, autosuggestions and find/replace, bringing Script Editor and Decl Editor at feature parity with MFC. |
This looks awesome! One thing that just came to my mind: It would be cool if the text editing widget could also be used for the Script Debugger. So if any of the text editing widgets supports "read-only mode that still allows figuring out the line one just clicked in and render something in front of the line number to signify a breakpoint", that one would be preferable :) |
@DanielGibson My thoughts exactly! In fact it's the ability to debug things what's drawn me initially to dhewm3. I then found a whole host of other great things, like fully-maintained source code for mods that I can build on. I'll keep an eye on those features. |
Great! :) I took a quick look and ImGuiColorTextEdit seems to directly support these features ( |
The ImGuiColorTextEdit code needed some small changes to make it build with GCC (and C++11 instead of C++14): texteditor.patch.txt (Haven't actually tested the code yet, just made sure it builds because the testbuilds are failing) |
Thanks for the fix! That's something I didn't tell you about. Looks like we'll have to either figure out how to embed Zep (or some other similarly-featured editor), or we'll have to add features to our own fork of ImGuiColorTextEdit. Those forks that I found have the following shortcomings:
None of these have support for:
I've tried to use the single-file inclusion of Zep but it uses C++17 so it doesn't compile, that's a bummer. So I'll probably just go forth and implement those features in our own fork, shouldn't be too difficult, since we already have it implemented in MFC. |
Regarding the forks: I definitely do not want a dependency on boost. Otherwise, use whichever fork works best, and patching it is also ok :) Regarding the C++ standard: Most of dhewm3 still uses C++98, and unless there's a good reason I'd like to keep it that way so people can build dhewm3 on obscure old platforms like PowerPC Macs. |
I've been tweaking the ParticleEditor a bit, so it's narrower, more like the MFC version. Together with my other tweaks it now looks like this: The patch implementing these changes: parteditor.diff.txt |
Okay, that's reasonable and makes my job easier. :)
I'll probably add those tabs some time later, in the meantime, this looks much better! So I'll apply it. Thanks! |
This adds editors ported from MFC and builds on top of imgui-docking.
Currently ported tools: