Commit graph

40 commits

Author SHA1 Message Date
Juan Linietsky ed1b9c1f15 Avoid crash in import (though model still does not work well), fixes #19346 2019-01-26 16:32:05 -03:00
Rémi Verschelde d54894ffae
Merge pull request #24647 from WindyDarian/gltf_morph_fix
Fix for blend shape incorrectly scaling skinned gltf mesh
2019-01-04 15:21:38 +01:00
Rémi Verschelde b16c309f82 Update copyright statements to 2019
Happy new year to the wonderful Godot community!
2019-01-01 12:58:10 +01:00
Windy Darian d9d6119b6e Partial fix for blend shape with gltf
This fixes https://github.com/godotengine/godot/issues/20377 , where blend shape scales the mesh if the mesh is also skinned.
The issue was that the blend shape was trying to blend using BLEND_SHAPE_MODE_RELATIVE (directly adding everything in morph shape as displacement), while bone weights were copied in the morph shape, which resulted in 2x bone weights causing mesh to become bigger when blended.
Setting the blend mode to BLEND_SHAPE_MODE_NORMALIZED while guaranteeing the data is correct fixes the issue (previously treating gltf2's morph displacement data as blend target data).  Ideally we still want to use BLEND_SHAPE_MODE_RELATIVE since it may need much less data, but that seems to require a larger refactor?
2018-12-29 01:13:35 -05:00
Bastiaan Olij fa63a0fe83 Reverse bitangent on everythings to ensure default normal map behavriour is consistent 2018-12-08 13:43:46 +11:00
Juan Linietsky 9efc6d85d8 Do not crash on invalid file, closes #21083 2018-11-22 17:27:01 -03:00
Bastiaan Olij bcef4b8dc6 Fixing tangent and binormal logic 2018-11-19 22:27:05 +11:00
Aaron Franke 4f7b33cdcf Remove redundant "== false" code
Some of this code has been re-organized.
f
2018-10-06 16:20:41 -04:00
Rémi Verschelde cdc411fd54 Fix various warnings: [-Waddress], [-Wpointer-arith], [-Wwrite-strings], [-Wreturn-local-addr] and more
Fixes the following GCC 5 warnings:
```
core/os/file_access.cpp:49:19: warning: the address of 'FileAccess::create_func' will always evaluate as 'true' [-Waddress]
servers/audio_server.cpp:192:70: warning: comparison with string literal results in unspecified behaviour [-Waddress]

drivers/gles2/rasterizer_storage_gles2.cpp:4095:90: warning: NULL used in arithmetic [-Wpointer-arith]

modules/gdnative/register_types.cpp:237:3: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
platform/android/export/export.cpp:207:1: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

modules/gdscript/gdscript.h:150:67: warning: returning reference to temporary [-Wreturn-local-addr]
servers/physics_2d/collision_object_2d_sw.h:119:56: warning: returning reference to temporary [-Wreturn-local-addr]
servers/physics_2d/collision_object_2d_sw.h:123:56: warning: returning reference to temporary [-Wreturn-local-addr]
servers/physics_2d/collision_object_2d_sw.h:127:50: warning: returning reference to temporary [-Wreturn-local-addr]
servers/physics_2d/collision_object_2d_sw.h:131:52: warning: returning reference to temporary [-Wreturn-local-addr]

editor/plugins/skeleton_editor_plugin.cpp:34:36: warning: extra tokens at end of #include directive
modules/bullet/bullet_types_converter.cpp:31:9: warning: #pragma once in main file

editor/import/editor_scene_importer_gltf.cpp:1996:51: warning: name lookup of 'i' changed
modules/visual_script/visual_script_property_selector.cpp:402:45: warning: name lookup of 'E' changed
scene/gui/tree.cpp:1268:25: warning: name lookup of 'i' changed
scene/resources/visual_shader.cpp:808:32: warning: name lookup of 'i' changed
```
2018-09-27 16:33:52 +02:00
Rémi Verschelde cc5ab22204
Merge pull request #21935 from goodyttoor/gltf_cubic
Fix cubic spline interpolation in glTF importer
2018-09-12 14:12:32 +02:00
Rémi Verschelde 277b24dfb7 Make core/ includes absolute, remove subfolders from include path
This allows more consistency in the manner we include core headers,
where previously there would be a mix of absolute, relative and
include path-dependent includes.
2018-09-12 09:52:22 +02:00
Vivatchai Kaveeta 463ead1eb7 Fix cubic spline interpolation in glTF importer
Should solve #21001 #14636
2018-09-10 20:02:39 +07:00
K. S. Ernest (iFire) Lee fa62037ff6 In the GLTF importer normalize Quaternions after every operation and when reading from the format. 2018-08-27 14:59:28 -07:00
Rémi Verschelde 52466d57e9 Make some debug prints verbose-only, remove others 2018-08-24 14:59:01 +02:00
Juan Linietsky 5b70ad9d34 Respect process order for out of order skeleton bones (fixes GLTF2 import issues). 2018-08-06 22:35:09 -03:00
Juan Linietsky 00c573c255 Several fixes to GLTF2 importer 2018-08-06 18:41:37 -03:00
Hein-Pieter van Braam 0e29f7974b Reduce unnecessary COW on Vector by make writing explicit
This commit makes operator[] on Vector const and adds a write proxy to it.  From
now on writes to Vectors need to happen through the .write proxy. So for
instance:

Vector<int> vec;
vec.push_back(10);
std::cout << vec[0] << std::endl;
vec.write[0] = 20;

Failing to use the .write proxy will cause a compilation error.

In addition COWable datatypes can now embed a CowData pointer to their data.
This means that String, CharString, and VMap no longer use or derive from
Vector.

_ALWAYS_INLINE_ and _FORCE_INLINE_ are now equivalent for debug and non-debug
builds. This is a lot faster for Vector in the editor and while running tests.
The reason why this difference used to exist is because force-inlined methods
used to give a bad debugging experience. After extensive testing with modern
compilers this is no longer the case.
2018-07-26 00:54:16 +02:00
K. S. Ernest (iFire) Lee ac541f5d16 Bones are now named and their parents are correct. 2018-07-24 15:29:53 -07:00
Juan Linietsky ad4666f8e0
Merge pull request #19193 from tagcup/quat_norm
Fixed Basis -> Quat conversions, added a few safety checks.
2018-06-25 10:58:04 -03:00
Rodolfo Ribeiro Gomes 01b01209a3 fix default glTF metallic & roughness factor values
The glTF 2.0 spec says that these pbrMetallicRoughness material
properties should be set as 1.0 by default.
In fact, KhronosGroup's official Blender Exporter does not even write
down those parameters if they are set as 1.0.

However, Godot import them as 0.0.

https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#pbrmetallicroughness

Fixes: #19613 https://github.com/godotengine/godot/issues/19613
2018-06-21 00:00:58 -03:00
Pedro J. Estébanez 4810eae03b Import morph target names from glTF
If mesh.extras.targetNames is available. Keep the former naming pattern as fallback.
2018-06-14 00:25:22 +02:00
tagcup 9d41161596 Fixed Basis -> Quat conversions, added a few safety checks.
Fixes #19027.
2018-05-27 14:15:47 -04:00
Yaakuro 9a50a4442d Use mimetype according to glTF spec. 2018-05-10 23:21:05 +02:00
Pedro J. Estébanez d8765dd103 Fix skeleton import from glTF
For some glTF files, the order of bones in the skeleton array wasn't matching the joints array in the meshes.

Fixes #17808.
2018-04-06 22:22:59 +02:00
Pedro J. Estébanez 1f26da0ad1 Fix animation length from glTF not correctly set 2018-03-19 00:27:14 +01:00
Pedro J. Estébanez adbe749513 Fix glTF not accepting VEC3 colors
Aside from the colors themselves, the rejection was adding somes issues later in the mesh import process.
2018-03-19 00:27:14 +01:00
Florian Zwoch 1abf464b59 gltf: improve embedded data discovery
Some editors seems to use the image resource's mime type (e.g. "image/png") for data embedded uris instead of "application/octet-stream".
2018-02-21 12:18:52 +01:00
Juan Linietsky a8a3d5c835 Fixes to GLTF2 importer skeleton positioning, though vertex bone indices still look broken somehow.. 2018-01-05 09:53:40 -03:00
Rémi Verschelde e4213e66b2 Add missing copyright headers and fix formatting
Using `misc/scripts/fix_headers.py` on all Godot files.
Some missing header guards were added, and the header inclusion order
was fixed in the Bullet module.
2018-01-05 01:22:23 +01:00
Juan Linietsky f11a138505 Added more hacks to GLTF2 importer to support crap exporter (MakeHuman in this case), fixes #13393 2017-12-28 16:07:45 -03:00
Webster Sheets 74b68d2e71 Fix importing GLTF meshes as external files. 2017-12-09 17:40:48 -05:00
Juan Linietsky 209cb3830c Exposed EditorSceneImporter to script. Added APIs to use intermediate converters more easily. 2017-12-07 15:44:20 -03:00
Juan Linietsky bc2e8d99e5 Made Vector::ptrw explicit for writing, compiler was sometimes using the wrong function,
leading to unnecesary copy on writes and reduced performance.
2017-11-25 00:09:40 -03:00
Webster Sheets 05dce362d5 Fix for #12056, though GTLF import of that file is still incorrect. 2017-11-12 23:47:51 -05:00
Hein-Pieter van Braam b2a38854fd Fix unused variable warnings
The forth in my quest to make Godot 3.x compile with -Werror on GCC7
2017-09-08 15:03:53 +02:00
Juan Linietsky ded74dedef Fixed missing return value in glTF2.0 importer camera, closes #10130 2017-09-01 22:36:49 -03:00
Hein-Pieter van Braam f9467ec1ea Fix signed and unsigned comparisons
The first in my quest to make Godot 3.x compile with -Werror on GCC7
2017-09-01 08:13:12 +02:00
Ferenc Arn 609ef89362 Fix the channels gltf importer uses for metallic and AO textures.
Khronos blender gltf exporter uses red channel for occlusion and blue channel for metallic, whereas the current behavior is the opposite.

Fixes #10700.
2017-08-28 15:09:47 -04:00
Juan Linietsky 26ff90eaed Full GLTF 2.0 Specification support! cheers! 2017-08-03 19:42:32 -03:00
Juan Linietsky 5c361485db -Added GLTF scene support (still missing animations and .glb extension)
-Fixed bugs regarding tangent generation in SurfaceTool
2017-08-02 15:43:49 -03:00