Skip to content

Commit

Permalink
Merge pull request #69447 from aaronfranke/3.x-gltf-organize-files
Browse files Browse the repository at this point in the history
[3.x] GLTF: Organize structures and extensions into subfolders
  • Loading branch information
akien-mga committed Dec 1, 2022
2 parents 4d5ef72 + d8aa3b3 commit 01574a5
Show file tree
Hide file tree
Showing 31 changed files with 45 additions and 23 deletions.
10 changes: 10 additions & 0 deletions modules/gltf/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Godot GLTF import and export module

In a nutshell, the GLTF module works like this:

* The [`structures/`](structures/) folder contains GLTF structures, the
small pieces that make up a GLTF file, represented as C++ classes.
* The [`extensions/`](extensions/) folder contains GLTF extensions, which
are optional features that build on top of the base GLTF spec.
* [`GLTFState`](gltf_state.h) holds collections of structures and extensions.
* [`GLTFDocument`](gltf_document.h) operates on GLTFState and its elements.
2 changes: 2 additions & 0 deletions modules/gltf/SCsub
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@ env_gltf = env_modules.Clone()

# Godot source files
env_gltf.add_source_files(env.modules_sources, "*.cpp")
env_gltf.add_source_files(env.modules_sources, "structures/*.cpp")
SConscript("extensions/SCsub")
9 changes: 9 additions & 0 deletions modules/gltf/extensions/SCsub
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env python

Import("env")
Import("env_modules")

env_gltf = env_modules.Clone()

# Godot source files
env_gltf.add_source_files(env.modules_sources, "*.cpp")
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#ifndef GLTF_LIGHT_H
#define GLTF_LIGHT_H

#include "../gltf_defines.h"
#include "core/resource.h"

class GLTFLight : public Resource {
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#ifndef GLTF_SPEC_GLOSS_H
#define GLTF_SPEC_GLOSS_H

#include "../gltf_defines.h"
#include "core/image.h"
#include "core/resource.h"

Expand Down
2 changes: 1 addition & 1 deletion modules/gltf/gltf_document.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

#include "gltf_document.h"

#include "gltf_spec_gloss.h"
#include "extensions/gltf_spec_gloss.h"
#include "gltf_state.h"

#include "core/bind/core_bind.h" // FIXME: Shouldn't use _Directory but DirAccess.
Expand Down
3 changes: 1 addition & 2 deletions modules/gltf/gltf_document.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#define GLTF_DOCUMENT_H

#include "gltf_defines.h"
#include "structures/gltf_animation.h"

#include "scene/3d/bone_attachment.h"
#include "scene/3d/camera.h"
Expand All @@ -43,8 +44,6 @@
#include "scene/resources/material.h"
#include "scene/resources/texture.h"

#include "gltf_animation.h"

#include "modules/modules_enabled.gen.h" // For csg, gridmap.

#ifdef MODULE_CSG_ENABLED
Expand Down
22 changes: 11 additions & 11 deletions modules/gltf/gltf_state.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,18 @@
#ifndef GLTF_STATE_H
#define GLTF_STATE_H

#include "gltf_accessor.h"
#include "gltf_animation.h"
#include "gltf_buffer_view.h"
#include "gltf_camera.h"
#include "gltf_light.h"
#include "gltf_mesh.h"
#include "gltf_node.h"
#include "gltf_skeleton.h"
#include "gltf_skin.h"
#include "extensions/gltf_light.h"
#include "gltf_template_convert.h"
#include "gltf_texture.h"
#include "gltf_texture_sampler.h"
#include "structures/gltf_accessor.h"
#include "structures/gltf_animation.h"
#include "structures/gltf_buffer_view.h"
#include "structures/gltf_camera.h"
#include "structures/gltf_mesh.h"
#include "structures/gltf_node.h"
#include "structures/gltf_skeleton.h"
#include "structures/gltf_skin.h"
#include "structures/gltf_texture.h"
#include "structures/gltf_texture_sampler.h"

class GLTFState : public Resource {
GDCLASS(GLTFState, Resource);
Expand Down
2 changes: 1 addition & 1 deletion modules/gltf/register_types.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

#include "register_types.h"

#include "gltf_spec_gloss.h"
#include "extensions/gltf_spec_gloss.h"
#include "gltf_state.h"

#ifdef TOOLS_ENABLED
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
#ifndef GLTF_ACCESSOR_H
#define GLTF_ACCESSOR_H

#include "../gltf_defines.h"
#include "core/resource.h"
#include "gltf_defines.h"

struct GLTFAccessor : public Resource {
GDCLASS(GLTFAccessor, Resource);
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
#ifndef GLTF_BUFFER_VIEW_H
#define GLTF_BUFFER_VIEW_H

#include "../gltf_defines.h"
#include "core/resource.h"
#include "gltf_defines.h"

class GLTFBufferView : public Resource {
GDCLASS(GLTFBufferView, Resource);
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
#ifndef GLTF_NODE_H
#define GLTF_NODE_H

#include "../gltf_defines.h"
#include "core/resource.h"
#include "gltf_defines.h"

class GLTFNode : public Resource {
GDCLASS(GLTFNode, Resource);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

#include "gltf_skeleton.h"

#include "gltf_template_convert.h"
#include "../gltf_template_convert.h"
#include "scene/3d/bone_attachment.h"

void GLTFSkeleton::_bind_methods() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
#ifndef GLTF_SKELETON_H
#define GLTF_SKELETON_H

#include "../gltf_defines.h"
#include "core/resource.h"
#include "gltf_defines.h"

class GLTFSkeleton : public Resource {
GDCLASS(GLTFSkeleton, Resource);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

#include "gltf_skin.h"

#include "gltf_template_convert.h"
#include "../gltf_template_convert.h"
#include "scene/resources/skin.h"

void GLTFSkin::_bind_methods() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
#ifndef GLTF_SKIN_H
#define GLTF_SKIN_H

#include "../gltf_defines.h"
#include "core/resource.h"
#include "gltf_defines.h"

class GLTFSkin : public Resource {
GDCLASS(GLTFSkin, Resource);
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
#ifndef GLTF_TEXTURE_H
#define GLTF_TEXTURE_H

#include "../gltf_defines.h"
#include "core/resource.h"
#include "gltf_defines.h"

class GLTFTexture : public Resource {
GDCLASS(GLTFTexture, Resource);
Expand Down
File renamed without changes.
File renamed without changes.

0 comments on commit 01574a5

Please sign in to comment.