Giter VIP home page Giter VIP logo

unidot_importer's Introduction

Unidot Importer

Unify your Godot asset interop with Unidot, a Universal Godot Engine source asset translator and interoperability pipeline for Godot 4.

At its heart, Unidot Importer can convert .unitypackage assets and asset folders into Godot 4.x compatible formats.

It takes original source assets and translates them into Godot native equivalents. For example, .unity and .prefab become .tscn and .prefab.tscn.

FBX Files are currently ported to glTF but this may be made more flexible in the future.

Raw mesh, anim, material assets and more are converted directly to godot .tres/.res equivalents.

Due to being a translator, Unidot may safely be removed from the project when completed. (other than runtime/anim_tree.gd)

Quick links

Made for Godot Engine 4

We rely on automatic FBX to glTF translation during .unitypackage import using FBX2glTF. please download the FBX2glTF exe and configure FBX Import in Godot Editor Settings before using Unidot.

Please use a version of Godot 4.0 or later with FBX2glTF configured in Editor Settings to run this addon.

System requirements:

Unidot has been tested on Windows, macOS and Linux versions. Currently supports Godot Editor versions 4.0 through 4.2.

Unidot recommends a system with at least 16GB of RAM for many assets. It is uncommon for large imports to take more than 10-12GB.

Due to pre-caching of assets in memory, it is okay if some data is swapped to disk with virtual memory, especially in large imports of thousands of files..

Installation:

  1. This repository should be imported at addons/unidot_importer in the project, such as using git submodule or unzipping.
    • Note that runtime/anim_tree.gd will be referenced by scenes and should be kept even if the rest of unidot is removed.
  2. Enable the Unidot Importer plugin in Project Settings -> Plugins tab -> Unidot
  3. Unidot requires an installation of FBX2glTF from https://github.com/godotengine/FBX2glTF/releases and set in the FBX2glTF.exe path in the Import category of Editor Settings (not Project Settings)
  4. To add TIFF / .tif and PSD / .psd support, install ImageMagick or GraphicsMagick into your system path or copy convert.exe into this addon directory.
  5. Access the importer through Project -> Tools -> Import .unitypackage... and select a package or an asset folder

Screenshot showing FBX2glTF in Editor Settings, and enabling the plugin in Project Settings

Read more at our documentation site.

Features

  • .unitypackage importer and translation shim.
  • Translates native filetypes (such as .unity or .mat) to Godot native scene or resource types.
  • Animation and animation tree porting, including humanoid .anim format.
  • Support for humanoid armatures, including from prefabs, unpacked prefabs and model import.
  • Translates prefabs and inherited prefabs to native Godot scenes and inherited scenes.
  • Supports both binary and text YAML encoding
  • Implementation of an asset database by GUID

Note that scripts and shaders will need to be ported by hand. However, it will be possible to map scripts/shaders to Godot equivalents after porting.

Supported asset types:

  • Mesh/MeshFilter/MeshRenderer/SkinnedMeshRenderer
  • Material (standard shader only)
  • Avatar
  • AnimationClip
  • AnimatorController (relies on small runtime helper script unidot_importer/runtime/anim_tree.gd)
  • AnimatorState/AnimatorStateMachine/AnimatorTransitionBase/BlendTree
  • PrefabInstance (prefabs)
  • GameObject/Transform/Collider/SkinnedMeshRenderer/MeshFilter/Animator/Light/Camera etc. (scenes)
  • Texture2D/CubeMap/Texture2DArray etc.
  • AssetImporter
  • AudioClip/AudioSource
  • Collider/Rigidbody
  • Terrain (limited support for detail meshes as MultiMeshInstance)
  • LightingSettings/PostProcessLayer

Unsupported

  • Shader: a system may someday be added to create mappings of equivalent Godot Engine shaders, but porting must be done by hand.
  • MonoBehaviour (C# Script porting)
  • AvatarMask (waiting for better Godot engine support)
  • Canvas / UI is not implemented.
  • PlayableDirector
  • Anything not listed above

Troubleshooting

  • If an import fails, it is possible to view the logs of the most recently completed import.

    • Use Project -> Tools -> Show last import logs.
    • Click the yellow or red columns to see all errors in the project.
    • Or, click a Logs button on a file to see the entire log.
    • Clicking the Logs for Assets may take time to collect all logs in the project, but can be helpful for submitting a bug report.
    • The Godot console output may also be helpful if submitting a bug report.
  • It would be good to double check that all dependencies imported, and then try again.

  • If Godot crashes during an import, it may be good to try a smaller import.

  • If importing a subset of files, import assets in the correct order: make sure to do materials after textures, and scenes after models / materials they may need. Using the shift key while selecting assets can ensure you include the needed depdencies.

  • If models in a scene are looking corrupted, it may be due to the scene using unpacked prefabs. In this case, replacing them with the original converted ".gltf" should work.

Known issues

  • There may be large memory consumption in the earlier phases of the import process. Unidot will pre-parse most assets upfront in the "Preprocessing" stage. Additionally, Godot may read textures from disk while assigning materials.
  • Due to memory constraints, large animation files currently import in the main thread.
    • This could cause Godot to hang or freeze for a long time in animation packs with a message such as "Importing 50 textures, animations and audio...".
  • Reimporting animations after import can lose the correct track paths, since the animations are modified during scene import.
  • Unidot does not indicate clearly when assets are missing GUID references. Models missing referenced data may not import correctly.
  • Models missing UpperChest, Shoulder or Neck bones may animate incorrectly due to lack of missing bone compensation in Godot's Humanoid retargeter.
  • Unpacked prefabs of humanoid models may malfunction due to the retargeting. Unidot does its best to correct these cases, but some models, especially those with rotated hips and scaled armature, may malfunction.
  • non-weight-painted vertices currently go to skeleton origin instead of hips (bone index 0)
  • FBX2glTF which is used to convert .fbx to .gltf has some rare bugs. These would currently affect all FBX imports into Godot Engine.
    • Some rare fbx models with ngons may be missing triangles.
    • Models using RotationPivots may not have the meshes centered at the pivot points, which could impact content or animations that expect the correct pivots.
  • Shift to select dependencies does not find all texture assets referenced by models.

Future work

  • Repacking unpacked avatar prefabs where possible
  • Better support for attaching outfits to imported models. For example, if any skinned meshes are humanoid but missing animator or no avatar set, treat skeleton hierarchy as having humanoid avatar enabled from that model.
  • Reduce the dependency on FBX conversion tools

A final note:

This tool is designed to assist with importing or translating source assets made for use in the editor. It makes an assumption that (other than animator controllers) most yaml files contain only one object).

Unidot solely translates existing usable source assets into equivalent Godot source assets. There are no plans to add functionality for decompiling asset bundles or ripping game content. That is not the goal of this project.

Join our community

Thanks

it is only thanks to all of you in the community using and supporting the project, and for the many contributors that Unidot released in the form it has today <3

Special Thanks to

  • Cthulhoo for some incredibly useful testcases for various humanoid rigs and animations, and for their explanation and insight into how Root Motion works that allowed me to implement RM support.
  • Stan for sending over some really cool gamejam projects filled with all sorts of different ways to reference prefabs.
  • And quite a number of others who provided test assets or testing.
  • The V-Sekai community for all your support.
  • The V-Sekai team for contributions and inspiration.

Screenshot showing an import dialog open with a scene underneath

unidot_importer's People

Contributors

fire avatar illauriel avatar lyuma avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

unidot_importer's Issues

Some models are off by 90 degrees.

sometimes it will import models where the toplevel node is -90 rotation and the child is also -90 rotation
Usually, it only happens for a few objects, so it can be manually fixed.

The cause is probably models whose root node got excluded due to having only one child, but maybe applied an extra 90 degree rotation to the parent or the child in the prefab properties.

Unable to load addon script from path, this might be due to a code error in that script.

Currently attempting to load this addon and getting a warning of:

Unable to load addon script from path: 'res://addons/unidot/plugin.gd'. This might be due to a code error in that script. Disabling the addon at 'res://addons/unidot/plugin.cfg' to prevent further errors.

I made an fgx2gltf install, and I found a closing parenthesis that might've caused an error, but neither ended up fixed the error and I don't know what else to try. I'm running Godot 4.1.1-stable for Windows. Hope that I gave enough info, please let me know what to try!

Converted meshes have offset origins

When importing a unity package, each prefab that contains multiple meshes has each sub mesh offset. (See photo below)

image

Additional Information

  • I've tried converting multiple unitypackages, the picture comes from a Synty package.
  • I'm using this build of FBX2glTF but also tried the official release from June 2023.
  • v4.2.stable.mono.official [46dc27791]
  • Windows 10

Please let me know if anyone has any ideas or needs more information. I searched quite extensively before posting here, so apologies if this is a resolved issue somewhere.

FBX files are not converting

I am trying to use this tool, but mine isn't converting FBX assets. I placed the exe in addons/unidot/FBX2glTF.exe, but it didn't seem to work. Not sure if there is something I am missing, or if there is something wrong with the version I installed.

Godot: 4.1.1 stable
FBX2glTF: 0.13.1

One Complex example with unknow reasons why conversion has limited success

The complex project:
Geographical-Adventures

  • Issue 1:
    Need advice on the license if this is for study not commercial, is this fine?

  • Issue 2:
    Not sure if limited success is attributed to shaders.
    Request: Even though shaders need manual porting, it would be great if at least these shaders are attached correctly

  • Issue 3:
    It seems many of the textures e.g. for the Globe are not attached correctly. This is the first time I encounter this using unidot.

Can't Enable as Addon or Open Project

I previously used unidot importer in conjunction with (https://github.com/barcoderdev/unitypackage_godot) ---> their version of FBX2glTF and it worked fantastically for my game project. However, I had to reinstall my project recently and in turn re-install both FBX2glTF and unidot importer (your updated version). But now I'm getting the error below and can't open my project.

*Version of FBX2glTF ( https://github.com/barcoderdev/FBX2glTF/actions/runs/7305203107) I used

Trying to figure out where the issue is. Any help would be much appreciated.

Screenshot (1)
Screenshot (2)

imported cameras include internal layers above 20

Godot appears to use some of the layers above 20 internally for things such as gizmos or collision shape debug. This leads to certain artifacts in the editor when imported meshes include layers about 20.

The problem is Godot's inspector doesn't show these, so the scene needs to be edited by hand to exclude them

Importing Synty City Zombie Pack combines all zombies into one

I am importing the demo scene from the Synty City Zombie Pack. Here is what it looks like when imported into Unity:
image

and here is what happens when I use unidot to import it into Godot 4.2.2:
image
each one of these characters is all characters overlaid over each other. I can individually drag them out of these messy piles. They also all seem to be lying on their backs, where Unity imports them standing upright.

Enhance Import Efficiency with Batch Processing and Recursive Discovery

Primary Request:

  • Batch Import Functionality:
    • Need: Ability to select and sequentially process multiple files for batch conversion.
    • Benefit: This will significantly reduce manual effort and time, especially critical for older hardware systems.

Additional Enhancements:

  • Selective Default Import Settings:
    • Function: Option to auto-select all file types for import, including .cs files, with a feature to skip files that cause import issues.
  • Persistent Folder Memory:
    • Function: The plugin should remember the last-used folder, simplifying repetitive import tasks.
  • Folder View Customization:
    • Preference: Switch from a grid of thumbnails to a list view in the folder selection window, and remember this setting.
  • Import Status Indicator:
    • Utility: Display whether a package has been previously imported to avoid duplication.
  • Post-Import Workflow Enhancement:
    • Convenience: An option to automatically reopen the file explorer after completing an import, aiding in continuous asset management.

Positive Feedback:

  • User Experience: The tool is highly valued for its user-friendly interface and high-quality output. The addition of batch import functionality would further establish this tool as a superior choice in asset importing.

Conclusion:
These enhancements are aimed at improving efficiency and user experience. The primary request for batch processing, along with the additional features, would greatly benefit users dealing with large asset libraries.

Unpacked prefabs referencing imported meshes with "force humanoid" should use a GeneralSkeleton

Currently when force humanoid is used, the model usually successfully imports as humanoid, but the prefabs referencing the model do not have an Avatar set, or in some cases do not have an Animator at all, so we should add additional logic to handle this case.

The logic should be if force humanoid is on, and there is a skinned mesh referencing a model imported as humanoid (even if forced), the entire skeleton that skinned mesh is in should switch to being a GeneralSkeleton.

This is really useful for importing outfits such that they can be copied and pasted directly from the unpacked prefab (with materials assigned), into the model the outfit is for.

Assets being mixed up

Hey,

Thanks for making this it's really a nice initiative.

For fun I'm trying to port a game jam project to Godot but when running the addon at version 8a5956c (and prior versions) some of the assets get replaced by others, I'm not sure exactly why and I was wondering if there was anything I could do to help you fix it? more logs patching etc. One of the object is being used everywhere.

image

PS: Not sure if that's any interest to you but a friend of mind made a Godot C# => GDScript converter using Roslyn, might serve as base for a Unity => Godot C# => GDscript https://github.com/seb776/CSToGDScript

Godot Crashes Importing Specific Package Files containing NaN vertices

I've been importing some asset packs from a recent Humble Bundle. Some of the packages import with no issues, however some cause Godot to crash during the import process. The import runs for a few seconds and then Godot closes.
Reopening Godot will cause it to crash again, the only way to get back into the project is to remove the files created for the package in the Assets folder.

I thought this might be from the amount of logs that are generated but i am still having the same issues after removing the print statements in Unidot.

I've been unable to figure out why its happening with specific packages, as im finding it hard to debug the addon as you can not use breakpoints in Godot Editor Addons (afaik)

Link to packages (I can provide if needed):

Support for RigidBody3D scale

FYI


Ball



The warning disappears once the Ball (non-uniform scale => 1,1,1) is transferred to MeshRenderer


Cube


The transform of Cube, warning disappears once the Cube (non-uniform scale) is transferred to MeshRenderer


Animation keyframes are imported but the they're not moving the rig?

First of all thank you for this amazing tool saves me such much time learning Blender animation.

But when I import an animation from Unity all the keyframes are imported correctly but they dont seem to move the skeleton?
I get this error for every keyframe that i think is related to it:

Node not found: "Arms/Root/Left Shoulder/Left Upper Arm" (relative to "/root/@EditorNode@17140/@Panel@13/@VBoxContainer@14/@HSplitContainer@17/@HSplitContainer@25/@HSplitContainer@33/@VBoxContainer@34/@VSplitContainer@36/@VSplitContainer@62/@VBoxContainer@63/@PanelContainer@110/MainScreen/@CanvasItemEditor@9462/@VSplitContainer@9281/@HSplitContainer@9283/@HSplitContainer@9285/@Control@9286/@SubViewportContainer@9287/@SubViewport@9288/M4A1_Model"). scene/animation/animation_mixer.cpp:635 - AnimationMixer: 'M4A1 Equipped Prefab.library/M4A1_SwapFireMode',

Thanks for any help ^-^

Import fails on both macOS and Windows. Tried Godot 4.0 and 4.2.

I've tried two separate .unitypackage exports, and they both give the same results. The UI shows no assets to import, and the error log shows several errors.

image

Full log:

/Users/me/Library/FBX2glTF-barcoderdev/FBX2glTF-macos-x86_64
Running tar with ["-C", ".godot/unidot_extracted_tar", "-zxvf", "/Users/me/Godot Projects/weapons.unitypackage"]
๐Ÿ”ด core/variant/variant_utility.cpp:903 - Invalid member of .unitypackage: [".", ""]
๐Ÿ”ด res://addons/unidot_importer/unitypackagefile.gd:15 - Attempt to call function 'get_length' in base 'null instance' on a null instance.
[repeat many times]
๐Ÿ”ด res://addons/unidot_importer/unitypackagefile.gd:15 - Attempt to call function 'get_length' in base 'null instance' on a null instance.
Starting thread
Starting thread
Starting thread
I'm a thread! Userdata is: THR1
I'm a thread! Userdata is: THR2
Starting thread
I'm a thread! Userdata is: THR3
Starting thread
I'm a thread! Userdata is: THR4
Starting thread
I'm a thread! Userdata is: THR5
Starting thread
I'm a thread! Userdata is: THR6
Starting thread
I'm a thread! Userdata is: THR7
Starting thread
I'm a thread! Userdata is: THR8
Starting thread
I'm a thread! Userdata is: THR9
I'm a thread! Userdata is: THR10
/Users/me/Library/FBX2glTF-barcoderdev/FBX2glTF-macos-x86_64

I've tried to debug the problem a bit. There appear to be several problems. The first of which stem from the parsing of the output of tar. tar -zxvf on macOS Ventura (14.0) writes a first line entry for the current-directory indicator ('.'), which 'ExtractedTarFile.new' cannot parse -- therefore the error in the guard code (Invalid member of .unitypackage: [".", ""]). In addition to that, there seems to be another error in fnparts parsing? When each line is parsed via line.trim_prefix("x").strip_edges().split("/"), the results for directory lines appear like [ ".", "1234abcd0000ffff", "" ]. This seems to be breaking the whole script via the failure of the following guard code, which appears to be designed to skip directory-only lines and fix lines that are prepended with the current-directory indicator, but doesn't seem to actually work where there is both leading current-directory indicator and also a trailing empty string, which pushes len(fnparts) over two in the case of directories and over 3 in the case of files.

if len(fnparts) < 2:
	continue
var guid: String = fnparts[0]
var type_part: String = fnparts[1]
if len(fnparts[1]) == 32:
	if len(fnparts) < 3:
		continue
	guid = fnparts[1]
	type_part = fnparts[2]

Importing AnimationController on FBX model scene fails

I'm trying to import some AnimationControllers that are a part of an asset pack that uses FBX for the meshes. From my understanding the animations themselves are a part of the FBX files. All of the other assets in the pack import fine, including the conversion from FBX to GLTF for the meshes. However, when the AnimationControllers import, I receive this error:

00030904 GLOBAL: Queueing work: state=5
00030905 GLOBAL: Done Queueing work: state=5
00030906 GLOBAL: Scanning percentage: 0
00030907 GLOBAL: Writing non-imported assets: state=5
00030908 GLOBAL: Writing Animals/Peacock_bass_anim_controller.controller.res
00030909 Animals/Peacock_bass_anim_cont...controller: FAIL: .ref: Target ref Animals/peacock_bass_unity_exp.gltf:7400000 (2a5896e4bc9653246a81cc47df74b6cf) was not yet parsed! from Animals/Peacock_bass_anim_controller.controller.res (560b354f6ac93c94db2b4500474fd6ad) ref peacock_bass_unity_exp.gltf:7400000
00030910 Animals/Peacock_bass_anim_cont...controller: FAIL: .ref: Target ref Animals/peacock_bass_unity_exp.gltf:7400006 (2a5896e4bc9653246a81cc47df74b6cf) was not yet parsed! from Animals/Peacock_bass_anim_controller.controller.res (560b354f6ac93c94db2b4500474fd6ad) ref peacock_bass_unity_exp.gltf:7400006
00030911 Animals/Peacock_bass_anim_cont...controller: FAIL: .ref: Target ref Animals/peacock_bass_unity_exp.gltf:7400002 (2a5896e4bc9653246a81cc47df74b6cf) was not yet parsed! from Animals/Peacock_bass_anim_controller.controller.res (560b354f6ac93c94db2b4500474fd6ad) ref peacock_bass_unity_exp.gltf:7400002
00030912 Animals/Peacock_bass_anim_cont...controller: FAIL: .ref: Target ref Animals/peacock_bass_unity_exp.gltf:7400008 (2a5896e4bc9653246a81cc47df74b6cf) was not yet parsed! from Animals/Peacock_bass_anim_controller.controller.res (560b354f6ac93c94db2b4500474fd6ad) ref peacock_bass_unity_exp.gltf:7400008
00030913 Animals/Peacock_bass_anim_cont...controller: FAIL: .ref: Target ref Animals/peacock_bass_unity_exp.gltf:7400004 (2a5896e4bc9653246a81cc47df74b6cf) was not yet parsed! from Animals/Peacock_bass_anim_controller.controller.res (560b354f6ac93c94db2b4500474fd6ad) ref peacock_bass_unity_exp.gltf:7400004
00030914 GLOBAL: RESOURCES WRITTEN ============
00030915 GLOBAL: Animals/Peacock_bass_anim_controller.controller.res

When I try to open the generated prefab scenes, the AnimationTree has nodes corresponding to the names of the animations, but attempting to play any results in the "animation not found" message. The corresponding animation library seems to have no animations in it, as well.

It looks like the importer is somehow looking for the asset in its GLTF form, but there is none since it's getting generated by the importer? I can't help much, this is unfortunately outside of my domain. I'm happy to provide files if it helps repro, though.

I see that 4.3 will support FBX natively. Feel free to ignore if this issue will be resolved by that.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.