Developing a custom UI module in C++. Is there a better way?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By unknown llama
:warning: Old Version Published before Godot 3 was released.

Hello Everyone,

I am looking into creating a new UI control in C++. I know simple custom controls can be GDScript-ed, but this question is about C++ modules.

I have read the Custom Modules section and I am now looking for further advise.

The docs say, "As you see, it’s really easy to develop Godot in C++. Just write your stuff normally and remember to ‘macro, bind, etc’ ".

I can see that approach working for modules that are not tied to Godot; they can be fully written and tested outside Godot first, then incorporated as the docs describe.

But what about developing new UI components in C++? It seems you would have to re-link the entire project each time you want to check your work, which would really slow things down.

So, my questions are…

  1. Am I way off base here and just don’t understand what I’m talking
    about?
  2. Does anyone know of a simplified way to develop for the UI system
    without having to write it against the entire Godot source?
  3. Is there a minimal project somewhere that would allow for
    faster development. Perhaps that only contains minimal core and
    rendering features?

Thanks for you help, and patients for my long-winded questions.

:bust_in_silhouette: Reply From: neikeq

If you write your UI components as a C++ module, you will have to compile your changes everytime. This may not slow things down that much, but you may prefer to prototype your Control in GDScript first and then move to C++ (only if there is a good reason to do so, like performance issues).

I guess the simpler example of a Control in C++ is Panel, which only draws a rect. Another simple one is ProgressBar which has methods binding.

EDIT: And, of course, don’t forget to read the docs about writing custom modules in C++ :stuck_out_tongue:

Thanks for your help.

It is mostly the build times that I’m concerned about.

I don’t know how I would create a custom control in c++ without compiling against the entire engine, which can take a minute or more just to re-link with my module after the initial 10min build. Meaning every time I want to run my module during development, I will have to wait a minute or more to view the changes, which will drive me crazy.

So, the only way I know to test a custom control is from within the editor.

Am I correct about this assumption, or is there a way to write and test custom Controls in C++ outside of Godot, and then only compile them into the engine when they are done?
(I assume not)

Thanks again, I really do appreciate your time.

unknown llama | 2016-03-08 20:28

No, there is no way to do that. You have to compile the whole thing. But if you already compiled the engine before, the next time it should only compile your changes.
Still I recommend you to first prototype your Control in GDScript and then translate it to C++.

neikeq | 2016-03-09 09:47