The demo is outdated now Godot Engine 4 has fbx2gltf built in.
This commit is contained in:
parent
e32a046066
commit
ba08bc210a
|
@ -1,56 +0,0 @@
|
||||||
@tool
|
|
||||||
extends EditorSceneFormatImporter
|
|
||||||
|
|
||||||
var settings = ProjectSettings
|
|
||||||
|
|
||||||
const settings_fbx2gltf_path = "filesystem/import/fbx/fbx2gltf_path"
|
|
||||||
|
|
||||||
var fbx2gltf_path : String
|
|
||||||
|
|
||||||
func _get_extensions():
|
|
||||||
return ["fbx"]
|
|
||||||
|
|
||||||
|
|
||||||
func _get_import_flags():
|
|
||||||
return EditorSceneFormatImporter.IMPORT_SCENE
|
|
||||||
|
|
||||||
|
|
||||||
func _import_scene(path: String, flags: int, bake_fps: int):
|
|
||||||
if not ProjectSettings.has_setting(settings_fbx2gltf_path):
|
|
||||||
ProjectSettings.set_initial_value(settings_fbx2gltf_path, "FBX2glTF")
|
|
||||||
ProjectSettings.set_setting(settings_fbx2gltf_path, "FBX2glTF")
|
|
||||||
else:
|
|
||||||
fbx2gltf_path = ProjectSettings.get_setting(settings_fbx2gltf_path)
|
|
||||||
if fbx2gltf_path.is_empty():
|
|
||||||
return null
|
|
||||||
var property_info = {
|
|
||||||
"name": settings_fbx2gltf_path,
|
|
||||||
"type": TYPE_STRING,
|
|
||||||
"hint": PROPERTY_HINT_GLOBAL_FILE,
|
|
||||||
"hint_string": ""
|
|
||||||
}
|
|
||||||
ProjectSettings.add_property_info(property_info)
|
|
||||||
var user_path_base = OS.get_user_data_dir()
|
|
||||||
var path_global : String = ProjectSettings.globalize_path(path)
|
|
||||||
var output_path : String = "res://.godot/imported/" + path.get_file().get_basename() + "-" + path.md5_text() + ".gltf"
|
|
||||||
var output_path_global = ProjectSettings.globalize_path(output_path)
|
|
||||||
var stdout = [].duplicate()
|
|
||||||
var temp_dir_global = ProjectSettings.globalize_path("res://.godot/imported/")
|
|
||||||
var fbx2gltf_path_global = ProjectSettings.globalize_path(fbx2gltf_path)
|
|
||||||
var ret = OS.execute(fbx2gltf_path_global, [
|
|
||||||
"--fbx-temp-dir", temp_dir_global,
|
|
||||||
"-i", path_global,
|
|
||||||
"-o", output_path_global], stdout, true)
|
|
||||||
|
|
||||||
for line in stdout:
|
|
||||||
print(line)
|
|
||||||
if ret != 0:
|
|
||||||
print("FBX2glTF returned " + str(ret))
|
|
||||||
return null
|
|
||||||
|
|
||||||
var gstate : GLTFState = GLTFState.new()
|
|
||||||
var gltf : GLTFDocument = GLTFDocument.new()
|
|
||||||
var root_node : Node = gltf.import_scene(output_path, 0, 1000.0, gstate)
|
|
||||||
root_node.name = path.get_basename().get_file()
|
|
||||||
|
|
||||||
return root_node
|
|
|
@ -1,7 +0,0 @@
|
||||||
[plugin]
|
|
||||||
|
|
||||||
name="FBX"
|
|
||||||
description="FBX Importer"
|
|
||||||
author="V-Sekai"
|
|
||||||
version="1.1.0"
|
|
||||||
script="plugin.gd"
|
|
|
@ -1,13 +0,0 @@
|
||||||
@tool
|
|
||||||
extends EditorPlugin
|
|
||||||
|
|
||||||
var import_plugin
|
|
||||||
|
|
||||||
func _enter_tree():
|
|
||||||
import_plugin = preload("res://addons/fbx/import_fbx.gd").new()
|
|
||||||
add_scene_format_importer_plugin(import_plugin)
|
|
||||||
|
|
||||||
|
|
||||||
func _exit_tree():
|
|
||||||
add_scene_format_importer_plugin(import_plugin)
|
|
||||||
import_plugin = null
|
|
|
@ -1,7 +0,0 @@
|
||||||
[gd_resource type="Environment" load_steps=2 format=2]
|
|
||||||
|
|
||||||
[sub_resource type="ProceduralSky" id=1]
|
|
||||||
|
|
||||||
[resource]
|
|
||||||
background_mode = 2
|
|
||||||
background_sky = SubResource( 1 )
|
|
|
@ -1,35 +0,0 @@
|
||||||
[remap]
|
|
||||||
|
|
||||||
importer="texture"
|
|
||||||
type="StreamTexture2D"
|
|
||||||
uid="uid://syqf374gcodm"
|
|
||||||
path="res://.godot/imported/icon.png-487276ed1e3a0c39cad0279d744ee560.stex"
|
|
||||||
metadata={
|
|
||||||
"vram_texture": false
|
|
||||||
}
|
|
||||||
|
|
||||||
[deps]
|
|
||||||
|
|
||||||
source_file="res://icon.png"
|
|
||||||
dest_files=["res://.godot/imported/icon.png-487276ed1e3a0c39cad0279d744ee560.stex"]
|
|
||||||
|
|
||||||
[params]
|
|
||||||
|
|
||||||
compress/mode=0
|
|
||||||
compress/lossy_quality=0.7
|
|
||||||
compress/hdr_compression=1
|
|
||||||
compress/bptc_ldr=0
|
|
||||||
compress/normal_map=0
|
|
||||||
compress/channel_pack=0
|
|
||||||
compress/streamed=false
|
|
||||||
mipmaps/generate=false
|
|
||||||
mipmaps/limit=-1
|
|
||||||
roughness/mode=0
|
|
||||||
roughness/src_normal=""
|
|
||||||
process/fix_alpha_border=true
|
|
||||||
process/premult_alpha=false
|
|
||||||
process/normal_map_invert_y=false
|
|
||||||
process/HDR_as_SRGB=false
|
|
||||||
process/size_limit=0
|
|
||||||
detect_3d/compress_to=1
|
|
||||||
svg/scale=1.0
|
|
|
@ -1,32 +0,0 @@
|
||||||
; Engine configuration file.
|
|
||||||
; It's best edited using the editor UI and not directly,
|
|
||||||
; since the parameters that go here are not all obvious.
|
|
||||||
;
|
|
||||||
; Format:
|
|
||||||
; [section] ; section goes between []
|
|
||||||
; param=value ; assign values to parameters
|
|
||||||
|
|
||||||
config_version=5
|
|
||||||
|
|
||||||
[application]
|
|
||||||
|
|
||||||
config/name="FBX Game Project"
|
|
||||||
config/icon="res://icon.png"
|
|
||||||
config/features=PackedStringArray("4.0")
|
|
||||||
|
|
||||||
[editor_plugins]
|
|
||||||
|
|
||||||
enabled=PackedStringArray("res://addons/fbx/plugin.cfg")
|
|
||||||
|
|
||||||
[filesystem]
|
|
||||||
|
|
||||||
import/fbx/use_fbx=false
|
|
||||||
import/fbx/fbx2gltf_path="res://addons/fbx/FBX2glTF"
|
|
||||||
|
|
||||||
[physics]
|
|
||||||
|
|
||||||
common/enable_pause_aware_picking=true
|
|
||||||
|
|
||||||
[rendering]
|
|
||||||
|
|
||||||
environment/default_environment="res://default_env.tres"
|
|
Loading…
Reference in New Issue