mirror of
https://github.com/godotengine/godot-contributing-docs.git
synced 2026-01-06 06:10:24 +03:00
Remove the architecture documentation for the editor (keeping it in the docs). Only the style guide remains on this site.
This commit is contained in:
@@ -1,94 +0,0 @@
|
|||||||
.. _doc_editor_icons:
|
|
||||||
|
|
||||||
Editor icons
|
|
||||||
============
|
|
||||||
|
|
||||||
When a new class is created and exposed to scripting, the editor's interface
|
|
||||||
will display it with a default icon representing the base class it inherits
|
|
||||||
from. In most cases, it's still recommended to create icons for new classes to
|
|
||||||
improve the user experience.
|
|
||||||
|
|
||||||
Creating icons
|
|
||||||
~~~~~~~~~~~~~~
|
|
||||||
|
|
||||||
To create new icons, you first need a vector graphics editor installed.
|
|
||||||
For instance, you can use the open source `Inkscape <https://inkscape.org/>`_ editor.
|
|
||||||
|
|
||||||
Clone the ``godot`` repository containing all the editor icons:
|
|
||||||
|
|
||||||
.. code-block:: bash
|
|
||||||
|
|
||||||
git clone https://github.com/godotengine/godot.git
|
|
||||||
|
|
||||||
The icons must be created in a vector graphics editor in SVG format. There are
|
|
||||||
two main requirements to follow:
|
|
||||||
|
|
||||||
- Icons must be 16×16. In Inkscape, you can configure the document size in
|
|
||||||
**File > Document Properties**.
|
|
||||||
- Lines should be snapped to pixels whenever possible to remain crisp at lower DPI.
|
|
||||||
You can create a 16×16 grid in Inkscape to make this easier.
|
|
||||||
|
|
||||||
Once you're satisfied with the icon's design, save the icon in the cloned
|
|
||||||
repository's ``editor/icons`` folder. The icon name should match the intended
|
|
||||||
name in a case-sensitive manner. For example, to create an icon for
|
|
||||||
CPUParticles2D, name the file ``CPUParticles2D.svg``.
|
|
||||||
|
|
||||||
Color conversion for light editor themes
|
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
|
|
||||||
If the user has configured their editor to use a light theme, Godot will
|
|
||||||
convert the icon's colors based on a
|
|
||||||
`set of predefined color mappings <https://github.com/godotengine/godot/blob/master/editor/themes/editor_color_map.cpp>`__.
|
|
||||||
This is to ensure the icon always displays with a sufficient contrast rate.
|
|
||||||
Try to restrict your icon's color palette to colors found in the list above.
|
|
||||||
Otherwise, your icon may become difficult to read on a light background.
|
|
||||||
|
|
||||||
.. note::
|
|
||||||
To enable color conversion for light editor themes:
|
|
||||||
1. :ui:`Import > Import As > Texture2D`
|
|
||||||
2. Set ``editor/convert_colors_with_editor_theme`` to ``true``
|
|
||||||
|
|
||||||
Icon optimization
|
|
||||||
~~~~~~~~~~~~~~~~~
|
|
||||||
|
|
||||||
Because the editor renders SVGs once at load time, they need to be small
|
|
||||||
in size so they can be efficiently parsed. When the
|
|
||||||
:ref:`pre-commit hook <doc_code_style_guidelines_pre_commit_hook>` runs, it automatically optimizes
|
|
||||||
the SVG using `svgo <https://github.com/svg/svgo>`_.
|
|
||||||
|
|
||||||
.. note::
|
|
||||||
|
|
||||||
While this optimization step won't impact the icon's quality noticeably, it
|
|
||||||
will still remove editor-only information such as guides. Therefore, it's
|
|
||||||
recommended to keep the source SVG around if you need to make further
|
|
||||||
changes.
|
|
||||||
|
|
||||||
Integrating and sharing the icons
|
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
|
|
||||||
If you're contributing to the engine itself, you should make a pull request to
|
|
||||||
add optimized icons to ``editor/icons`` in the main repository. Recompile the
|
|
||||||
engine to make it pick up new icons for classes.
|
|
||||||
|
|
||||||
It's also possible to create custom icons within a module. If you're creating
|
|
||||||
your own module and don't plan to integrate it with Godot, you don't need to
|
|
||||||
make a separate pull request for your icons to be available within the editor
|
|
||||||
as they can be self-contained.
|
|
||||||
|
|
||||||
For specific instructions on how to create module icons, refer to
|
|
||||||
:ref:`Creating custom module icons<doc_custom_module_icons>`.
|
|
||||||
|
|
||||||
Troubleshooting
|
|
||||||
~~~~~~~~~~~~~~~
|
|
||||||
|
|
||||||
If icons don't appear in the editor, make sure that:
|
|
||||||
|
|
||||||
1. Each icon's filename matches the naming requirement as described previously.
|
|
||||||
|
|
||||||
2. ``modules/svg`` is enabled (it should be enabled by default). Without it,
|
|
||||||
icons won't appear in the editor at all.
|
|
||||||
|
|
||||||
References
|
|
||||||
~~~~~~~~~~
|
|
||||||
|
|
||||||
- `editor/icons <https://github.com/godotengine/godot/tree/master/editor/icons>`__
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
:allow_comments: False
|
|
||||||
|
|
||||||
Contributing to the editor
|
|
||||||
==========================
|
|
||||||
|
|
||||||
.. toctree::
|
|
||||||
:maxdepth: 1
|
|
||||||
:name: toc-devel-editor
|
|
||||||
|
|
||||||
introduction_to_editor_development
|
|
||||||
creating_icons
|
|
||||||
editor_style_guide
|
|
||||||
@@ -1,88 +0,0 @@
|
|||||||
.. _doc_introduction_to_editor_development:
|
|
||||||
|
|
||||||
Introduction to editor development
|
|
||||||
==================================
|
|
||||||
|
|
||||||
On this page, you will learn:
|
|
||||||
|
|
||||||
- The **design decisions** behind the Godot editor.
|
|
||||||
- How to work efficiently on the Godot editor's C++ code.
|
|
||||||
|
|
||||||
This guide is aimed at current or future engine contributors.
|
|
||||||
To create editor plugins in GDScript, see :ref:`doc_making_plugins` instead.
|
|
||||||
|
|
||||||
.. seealso::
|
|
||||||
|
|
||||||
If you are new to Godot, we recommended you to read
|
|
||||||
:ref:`doc_godot_design_philosophy` before continuing. Since the Godot editor
|
|
||||||
is a Godot project written in C++, much of the engine's philosophy applies
|
|
||||||
to the editor.
|
|
||||||
|
|
||||||
Technical choices
|
|
||||||
-----------------
|
|
||||||
|
|
||||||
The Godot editor is drawn using Godot's renderer and
|
|
||||||
:ref:`UI system <doc_user_interface>`. It does *not* rely on a toolkit
|
|
||||||
such as GTK or Qt. This is similar in spirit to software like Blender.
|
|
||||||
While using toolkits makes it easier to achieve a "native" appearance, they are
|
|
||||||
also quite heavy and their licensing is not compatible with Godot's.
|
|
||||||
|
|
||||||
The editor is fully written in C++. It can't contain any GDScript or C# code.
|
|
||||||
|
|
||||||
Directory structure
|
|
||||||
-------------------
|
|
||||||
|
|
||||||
The editor's code is fully self-contained in the
|
|
||||||
`editor/ <https://github.com/godotengine/godot/tree/master/editor>`__ folder
|
|
||||||
of the Godot source repository.
|
|
||||||
|
|
||||||
Some editor functionality is also implemented via
|
|
||||||
:ref:`modules <doc_custom_modules_in_cpp>`. Some of these are only enabled in
|
|
||||||
editor builds to decrease the binary size of export templates. See the
|
|
||||||
`modules/ <https://github.com/godotengine/godot/tree/master/modules>`__ folder
|
|
||||||
in the Godot source repository.
|
|
||||||
|
|
||||||
Some important files in the editor are:
|
|
||||||
|
|
||||||
- `editor/editor_node.cpp <https://github.com/godotengine/godot/blob/master/editor/editor_node.cpp>`__:
|
|
||||||
Main editor initialization file. Effectively the "main scene" of the editor.
|
|
||||||
- `editor/project_manager.cpp <https://github.com/godotengine/godot/blob/master/editor/project_manager.cpp>`__:
|
|
||||||
Main Project Manager initialization file. Effectively the "main scene" of the Project Manager.
|
|
||||||
- `editor/plugins/canvas_item_editor_plugin.cpp <https://github.com/godotengine/godot/blob/master/editor/plugins/canvas_item_editor_plugin.cpp>`__:
|
|
||||||
The 2D editor viewport and related functionality (toolbar at the top, editing modes, overlaid helpers/panels, …).
|
|
||||||
- `editor/plugins/node_3d_editor_plugin.cpp <https://github.com/godotengine/godot/blob/master/editor/plugins/node_3d_editor_plugin.cpp>`__:
|
|
||||||
The 3D editor viewport and related functionality (toolbar at the top, editing modes, overlaid panels, …).
|
|
||||||
- `editor/plugins/node_3d_editor_gizmos.cpp <https://github.com/godotengine/godot/blob/master/editor/plugins/node_3d_editor_gizmos.cpp>`__:
|
|
||||||
Where the 3D editor gizmos are defined and drawn.
|
|
||||||
This file doesn't have a 2D counterpart as 2D gizmos are drawn by the nodes themselves.
|
|
||||||
|
|
||||||
Editor dependencies in ``scene/`` files
|
|
||||||
---------------------------------------
|
|
||||||
|
|
||||||
When working on an editor feature, you may have to modify files in
|
|
||||||
Godot's GUI nodes, which you can find in the ``scene/`` folder.
|
|
||||||
|
|
||||||
One rule to keep in mind is that you must **not** introduce new dependencies to
|
|
||||||
``editor/`` includes in other folders such as ``scene/``. This applies even if
|
|
||||||
you use ``#ifdef TOOLS_ENABLED``.
|
|
||||||
|
|
||||||
To make the codebase easier to follow and more self-contained, the allowed
|
|
||||||
dependency order is:
|
|
||||||
|
|
||||||
- ``editor/`` -> ``scene/`` -> ``servers/`` -> ``core/``
|
|
||||||
|
|
||||||
This means that files in ``editor/`` can depend on includes from ``scene/``,
|
|
||||||
``servers/``, and ``core/``. But, for example, while ``scene/`` can depend on includes
|
|
||||||
from ``servers/`` and ``core/``, it cannot depend on includes from ``editor/``.
|
|
||||||
|
|
||||||
Currently, there are some dependencies to ``editor/`` includes in ``scene/``
|
|
||||||
files, but
|
|
||||||
`they are in the process of being removed <https://github.com/godotengine/godot/issues/53295>`__.
|
|
||||||
|
|
||||||
Development tips
|
|
||||||
----------------
|
|
||||||
|
|
||||||
To iterate quickly on the editor, we recommend to set up a test project and
|
|
||||||
:ref:`open it from the command line <doc_command_line_tutorial>` after compiling
|
|
||||||
the editor. This way, you don't have to go through the Project Manager every
|
|
||||||
time you start Godot.
|
|
||||||
@@ -10,6 +10,7 @@ This section explains guidelines for contributing to the engine.
|
|||||||
best_practices
|
best_practices
|
||||||
cpp_usage_guidelines
|
cpp_usage_guidelines
|
||||||
code_style
|
code_style
|
||||||
|
editor_style_guide
|
||||||
|
|
||||||
.. _doc_handling_compatibility_breakages:
|
.. _doc_handling_compatibility_breakages:
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user