Skip to content

Commit

Permalink
Merge pull request #68460 from Geometror/split_texture_src
Browse files Browse the repository at this point in the history
Extract and reorganize texture resource classes
  • Loading branch information
YuriSizov committed Jul 14, 2023
2 parents c10b8ac + 7e21eb7 commit a758388
Show file tree
Hide file tree
Showing 106 changed files with 5,117 additions and 4,356 deletions.
2 changes: 1 addition & 1 deletion drivers/png/resource_saver_png.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
#include "core/io/file_access.h"
#include "core/io/image.h"
#include "drivers/png/png_driver_common.h"
#include "scene/resources/texture.h"
#include "scene/resources/image_texture.h"

Error ResourceSaverPNG::save(const Ref<Resource> &p_resource, const String &p_path, uint32_t p_flags) {
Ref<ImageTexture> texture = p_resource;
Expand Down
1 change: 1 addition & 0 deletions editor/debugger/editor_profiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#include "core/os/os.h"
#include "editor/editor_scale.h"
#include "editor/editor_settings.h"
#include "scene/resources/image_texture.h"

void EditorProfiler::_make_metric_ptrs(Metric &m) {
for (int i = 0; i < m.categories.size(); i++) {
Expand Down
2 changes: 2 additions & 0 deletions editor/debugger/editor_profiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@
#include "scene/gui/texture_rect.h"
#include "scene/gui/tree.h"

class ImageTexture;

class EditorProfiler : public VBoxContainer {
GDCLASS(EditorProfiler, VBoxContainer);

Expand Down
1 change: 1 addition & 0 deletions editor/debugger/editor_visual_profiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#include "core/os/os.h"
#include "editor/editor_scale.h"
#include "editor/editor_settings.h"
#include "scene/resources/image_texture.h"

void EditorVisualProfiler::add_frame_metric(const Metric &p_metric) {
++last_metric;
Expand Down
2 changes: 2 additions & 0 deletions editor/debugger/editor_visual_profiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@
#include "scene/gui/texture_rect.h"
#include "scene/gui/tree.h"

class ImageTexture;

class EditorVisualProfiler : public VBoxContainer {
GDCLASS(EditorVisualProfiler, VBoxContainer);

Expand Down
2 changes: 2 additions & 0 deletions editor/editor_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,9 @@
#include "scene/gui/tab_container.h"
#include "scene/main/window.h"
#include "scene/property_utils.h"
#include "scene/resources/image_texture.h"
#include "scene/resources/packed_scene.h"
#include "scene/resources/portable_compressed_texture.h"
#include "servers/display_server.h"
#include "servers/navigation_server_3d.h"
#include "servers/physics_server_2d.h"
Expand Down
1 change: 1 addition & 0 deletions editor/editor_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
#include "editor/scene_tree_dock.h"
#include "scene/3d/camera_3d.h"
#include "scene/gui/popup_menu.h"
#include "scene/resources/image_texture.h"
#include "servers/rendering_server.h"

void EditorPlugin::add_custom_type(const String &p_type, const String &p_base, const Ref<Script> &p_script, const Ref<Texture2D> &p_icon) {
Expand Down
2 changes: 2 additions & 0 deletions editor/editor_resource_picker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@
#include "editor/plugins/editor_resource_conversion_plugin.h"
#include "editor/plugins/script_editor_plugin.h"
#include "editor/scene_tree_dock.h"
#include "scene/resources/gradient_texture.h"
#include "scene/resources/image_texture.h"

void EditorResourcePicker::_update_resource() {
String resource_path;
Expand Down
1 change: 1 addition & 0 deletions editor/editor_resource_preview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
#include "editor/editor_paths.h"
#include "editor/editor_scale.h"
#include "editor/editor_settings.h"
#include "scene/resources/image_texture.h"

bool EditorResourcePreviewGenerator::handles(const String &p_type) const {
bool success = false;
Expand Down
4 changes: 3 additions & 1 deletion editor/editor_resource_preview.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@
#include "core/os/thread.h"
#include "core/templates/safe_refcount.h"
#include "scene/main/node.h"
#include "scene/resources/texture.h"

class ImageTexture;
class Texture2D;

class EditorResourcePreviewGenerator : public RefCounted {
GDCLASS(EditorResourcePreviewGenerator, RefCounted);
Expand Down
1 change: 1 addition & 0 deletions editor/editor_run_native.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
#include "editor/editor_settings.h"
#include "editor/export/editor_export.h"
#include "editor/export/editor_export_platform.h"
#include "scene/resources/image_texture.h"

void EditorRunNative::_notification(int p_what) {
switch (p_what) {
Expand Down
1 change: 1 addition & 0 deletions editor/editor_themes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
#include "editor/editor_icons.gen.h"
#include "editor/editor_scale.h"
#include "editor/editor_settings.h"
#include "scene/resources/image_texture.h"

#include "modules/modules_enabled.gen.h" // For svg.
#ifdef MODULE_SVG_ENABLED
Expand Down
1 change: 1 addition & 0 deletions editor/export/editor_export_platform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
#include "editor/export/editor_export.h"
#include "editor/plugins/script_editor_plugin.h"
#include "editor_export_plugin.h"
#include "scene/resources/image_texture.h"
#include "scene/resources/packed_scene.h"

static int _get_pad(int p_alignment, int p_n) {
Expand Down
1 change: 1 addition & 0 deletions editor/export/editor_export_platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ struct EditorProgress;
#include "editor_export_shared_object.h"
#include "scene/gui/rich_text_label.h"
#include "scene/main/node.h"
#include "scene/resources/image_texture.h"

class EditorExportPlugin;

Expand Down
1 change: 1 addition & 0 deletions editor/export/editor_export_platform_pc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#include "editor_export_platform_pc.h"

#include "core/config/project_settings.h"
#include "scene/resources/image_texture.h"

void EditorExportPlatformPC::get_preset_features(const Ref<EditorExportPreset> &p_preset, List<String> *r_features) const {
if (p_preset->get("texture_format/bptc")) {
Expand Down
1 change: 1 addition & 0 deletions editor/import/resource_importer_layered_texture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
#include "editor/editor_node.h"
#include "editor/import/resource_importer_texture.h"
#include "editor/import/resource_importer_texture_settings.h"
#include "scene/resources/compressed_texture.h"
#include "scene/resources/texture.h"

String ResourceImporterLayeredTexture::get_importer_name() const {
Expand Down
1 change: 1 addition & 0 deletions editor/import/resource_importer_texture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
#include "editor/editor_scale.h"
#include "editor/editor_settings.h"
#include "editor/import/resource_importer_texture_settings.h"
#include "scene/resources/compressed_texture.h"

void ResourceImporterTexture::_texture_reimport_roughness(const Ref<CompressedTexture2D> &p_tex, const String &p_normal_path, RS::TextureDetectRoughnessChannel p_channel) {
ERR_FAIL_COND(p_tex.is_null());
Expand Down
4 changes: 3 additions & 1 deletion editor/import/resource_importer_texture_atlas.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,10 @@
#include "core/io/resource_saver.h"
#include "core/math/geometry_2d.h"
#include "editor/editor_atlas_packer.h"
#include "scene/resources/atlas_texture.h"
#include "scene/resources/image_texture.h"
#include "scene/resources/mesh.h"
#include "scene/resources/texture.h"
#include "scene/resources/mesh_texture.h"

String ResourceImporterTextureAtlas::get_importer_name() const {
return "texture_atlas";
Expand Down
1 change: 1 addition & 0 deletions editor/plugins/animation_player_editor_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
#include "scene/gui/separator.h"
#include "scene/main/window.h"
#include "scene/resources/animation.h"
#include "scene/resources/image_texture.h"
#include "scene/scene_string_names.h"
#include "servers/rendering_server.h"

Expand Down
1 change: 1 addition & 0 deletions editor/plugins/animation_player_editor_plugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
#include "scene/gui/tree.h"

class AnimationPlayerEditorPlugin;
class ImageTexture;

class AnimationPlayerEditor : public VBoxContainer {
GDCLASS(AnimationPlayerEditor, VBoxContainer);
Expand Down
1 change: 1 addition & 0 deletions editor/plugins/asset_library_editor_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
#include "editor/gui/editor_file_dialog.h"
#include "editor/project_settings_editor.h"
#include "scene/gui/menu_button.h"
#include "scene/resources/image_texture.h"

static inline void setup_http_request(HTTPRequest *request) {
request->set_use_threads(EDITOR_DEF("asset_library/use_threads", true));
Expand Down
1 change: 1 addition & 0 deletions editor/plugins/bit_map_editor_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#include "editor/editor_scale.h"
#include "scene/gui/label.h"
#include "scene/gui/texture_rect.h"
#include "scene/resources/image_texture.h"

void BitMapEditor::setup(const Ref<BitMap> &p_bitmap) {
texture_rect->set_texture(ImageTexture::create_from_image(p_bitmap->convert_to_image()));
Expand Down
1 change: 1 addition & 0 deletions editor/plugins/curve_editor_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
#include "scene/gui/menu_button.h"
#include "scene/gui/popup_menu.h"
#include "scene/gui/separator.h"
#include "scene/resources/image_texture.h"

CurveEdit::CurveEdit() {
set_focus_mode(FOCUS_ALL);
Expand Down
3 changes: 3 additions & 0 deletions editor/plugins/editor_preview_plugins.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,11 @@
#include "editor/editor_paths.h"
#include "editor/editor_scale.h"
#include "editor/editor_settings.h"
#include "scene/resources/atlas_texture.h"
#include "scene/resources/bit_map.h"
#include "scene/resources/font.h"
#include "scene/resources/gradient_texture.h"
#include "scene/resources/image_texture.h"
#include "scene/resources/material.h"
#include "scene/resources/mesh.h"
#include "servers/audio/audio_stream.h"
Expand Down
1 change: 1 addition & 0 deletions editor/plugins/gpu_particles_2d_editor_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
#include "scene/2d/cpu_particles_2d.h"
#include "scene/gui/menu_button.h"
#include "scene/gui/separator.h"
#include "scene/resources/image_texture.h"
#include "scene/resources/particle_process_material.h"

void GPUParticles2DEditorPlugin::edit(Object *p_object) {
Expand Down
1 change: 1 addition & 0 deletions editor/plugins/gpu_particles_3d_editor_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
#include "scene/3d/cpu_particles_3d.h"
#include "scene/3d/mesh_instance_3d.h"
#include "scene/gui/menu_button.h"
#include "scene/resources/image_texture.h"
#include "scene/resources/particle_process_material.h"

bool GPUParticles3DEditorBase::_generate(Vector<Vector3> &points, Vector<Vector3> &normals) {
Expand Down
1 change: 1 addition & 0 deletions editor/plugins/gradient_editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
#include "editor/editor_node.h"
#include "editor/editor_scale.h"
#include "editor/editor_undo_redo_manager.h"
#include "scene/resources/gradient_texture.h"

void GradientEditor::set_gradient(const Ref<Gradient> &p_gradient) {
gradient = p_gradient;
Expand Down
2 changes: 2 additions & 0 deletions editor/plugins/gradient_editor.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
#include "scene/gui/popup.h"
#include "scene/resources/gradient.h"

class GradientTexture1D;

class GradientEditor : public Control {
GDCLASS(GradientEditor, Control);

Expand Down
1 change: 1 addition & 0 deletions editor/plugins/gradient_texture_2d_editor_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
#include "scene/gui/button.h"
#include "scene/gui/flow_container.h"
#include "scene/gui/separator.h"
#include "scene/resources/gradient_texture.h"

Point2 GradientTexture2DEdit::_get_handle_pos(const Handle p_handle) {
// Get the handle's mouse position in pixels relative to offset.
Expand Down
1 change: 1 addition & 0 deletions editor/plugins/gradient_texture_2d_editor_plugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@

class Button;
class EditorSpinSlider;
class GradientTexture2D;

class GradientTexture2DEdit : public Control {
GDCLASS(GradientTexture2DEdit, Control);
Expand Down
1 change: 1 addition & 0 deletions editor/plugins/sprite_frames_editor_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
#include "scene/gui/option_button.h"
#include "scene/gui/panel_container.h"
#include "scene/gui/separator.h"
#include "scene/resources/atlas_texture.h"

static void _draw_shadowed_line(Control *p_control, const Point2 &p_from, const Size2 &p_size, const Size2 &p_shadow_offset, Color p_color, Color p_shadow_color) {
p_control->draw_line(p_from, p_from + p_size, p_color);
Expand Down
1 change: 1 addition & 0 deletions editor/plugins/sprite_frames_editor_plugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
#include "scene/gui/split_container.h"
#include "scene/gui/texture_rect.h"
#include "scene/gui/tree.h"
#include "scene/resources/image_texture.h"

class OptionButton;
class EditorFileDialog;
Expand Down
5 changes: 5 additions & 0 deletions editor/plugins/texture_editor_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,14 @@
/**************************************************************************/

#include "texture_editor_plugin.h"

#include "editor/editor_scale.h"
#include "scene/gui/label.h"
#include "scene/gui/texture_rect.h"
#include "scene/resources/animated_texture.h"
#include "scene/resources/atlas_texture.h"
#include "scene/resources/compressed_texture.h"
#include "scene/resources/image_texture.h"

TextureRect *TexturePreview::get_texture_display() {
return texture_display;
Expand Down
2 changes: 1 addition & 1 deletion editor/plugins/texture_region_editor_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
#include "scene/gui/separator.h"
#include "scene/gui/spin_box.h"
#include "scene/gui/view_panner.h"
#include "scene/resources/texture.h"
#include "scene/resources/atlas_texture.h"

void draw_margin_line(Control *edit_draw, Vector2 from, Vector2 to) {
Vector2 line = (to - from).normalized() * 10;
Expand Down
4 changes: 2 additions & 2 deletions editor/plugins/texture_region_editor_plugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@
#include "scene/gui/dialogs.h"
#include "scene/gui/nine_patch_rect.h"
#include "scene/resources/style_box.h"
#include "scene/resources/texture.h"

class ViewPanner;
class AtlasTexture;
class OptionButton;
class ViewPanner;

class TextureRegionEditor : public AcceptDialog {
GDCLASS(TextureRegionEditor, AcceptDialog);
Expand Down
1 change: 1 addition & 0 deletions editor/plugins/tiles/atlas_merging_dialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
#include "editor/gui/editor_file_dialog.h"
#include "scene/gui/control.h"
#include "scene/gui/split_container.h"
#include "scene/resources/image_texture.h"

void AtlasMergingDialog::_property_changed(const StringName &p_property, const Variant &p_value, const String &p_field, bool p_changing) {
_set(p_property, p_value);
Expand Down
1 change: 1 addition & 0 deletions editor/plugins/tiles/tiles_editor_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
#include "scene/gui/button.h"
#include "scene/gui/control.h"
#include "scene/gui/separator.h"
#include "scene/resources/image_texture.h"
#include "scene/resources/tile_set.h"

TilesEditorPlugin *TilesEditorPlugin::singleton = nullptr;
Expand Down
2 changes: 2 additions & 0 deletions editor/plugins/visual_shader_editor_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@
#include "scene/gui/tree.h"
#include "scene/gui/view_panner.h"
#include "scene/main/window.h"
#include "scene/resources/curve_texture.h"
#include "scene/resources/image_texture.h"
#include "scene/resources/visual_shader_nodes.h"
#include "scene/resources/visual_shader_particle_nodes.h"
#include "servers/display_server.h"
Expand Down
1 change: 1 addition & 0 deletions editor/project_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
#include "scene/gui/separator.h"
#include "scene/gui/texture_rect.h"
#include "scene/main/window.h"
#include "scene/resources/image_texture.h"
#include "servers/display_server.h"
#include "servers/navigation_server_3d.h"
#include "servers/physics_server_2d.h"
Expand Down
1 change: 1 addition & 0 deletions modules/dds/texture_loader_dds.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#include "texture_loader_dds.h"

#include "core/io/file_access.h"
#include "scene/resources/image_texture.h"

#define PF_FOURCC(s) ((uint32_t)(((s)[3] << 24U) | ((s)[2] << 16U) | ((s)[1] << 8U) | ((s)[0])))

Expand Down
1 change: 0 additions & 1 deletion modules/dds/texture_loader_dds.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
#define TEXTURE_LOADER_DDS_H

#include "core/io/resource_loader.h"
#include "scene/resources/texture.h"

class ResourceFormatDDS : public ResourceFormatLoader {
public:
Expand Down
2 changes: 2 additions & 0 deletions modules/gltf/gltf_document.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@
#include "scene/3d/light_3d.h"
#include "scene/3d/mesh_instance_3d.h"
#include "scene/3d/multimesh_instance_3d.h"
#include "scene/resources/image_texture.h"
#include "scene/resources/portable_compressed_texture.h"
#include "scene/resources/skin.h"
#include "scene/resources/surface_tool.h"

Expand Down
1 change: 1 addition & 0 deletions modules/text_server_adv/text_server_adv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ using namespace godot;
#include "core/object/worker_thread_pool.h"
#include "core/string/print_string.h"
#include "core/string/translation.h"
#include "scene/resources/image_texture.h"

#include "modules/modules_enabled.gen.h" // For freetype, msdfgen, svg.

Expand Down
2 changes: 1 addition & 1 deletion modules/text_server_adv/text_server_adv.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ using namespace godot;
#include "core/object/worker_thread_pool.h"
#include "core/templates/hash_map.h"
#include "core/templates/rid_owner.h"
#include "scene/resources/texture.h"
#include "scene/resources/image_texture.h"
#include "servers/text/text_server_extension.h"

#include "modules/modules_enabled.gen.h" // For freetype, msdfgen, svg.
Expand Down
2 changes: 1 addition & 1 deletion modules/text_server_fb/text_server_fb.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ using namespace godot;
#include "core/object/worker_thread_pool.h"
#include "core/templates/hash_map.h"
#include "core/templates/rid_owner.h"
#include "scene/resources/texture.h"
#include "scene/resources/image_texture.h"
#include "servers/text/text_server_extension.h"

#include "modules/modules_enabled.gen.h" // For freetype, msdfgen, svg.
Expand Down
Loading

0 comments on commit a758388

Please sign in to comment.