Commit graph

66 commits

Author SHA1 Message Date
gladmin 7f3e37fead Fix import hints being ignored by glTF importer
This fixes a regression introduced in commit 72d2468
due to hyphens being removed from nodes names.
2019-09-25 16:58:05 +02:00
Rémi Verschelde dec10dd776
Merge pull request #32051 from qarmin/some_error_explanation
Added some obvious errors explanations
2019-09-25 11:51:54 +02:00
qarmin 17732fe698 Added some obvious errors explanations 2019-09-25 10:28:50 +02:00
Rémi Verschelde 8c0595b722
Merge pull request #32306 from hbina/unused_variable
Fixed incorrect usage of variables in querying values.
2019-09-25 08:49:31 +02:00
Marios Staikopoulos 4631b0ca62 glTF: Fixed mistake with root node calculation in skin_verify
Was not actually grabbing the computed roots for comparison, but instead
was grabbing the disjoint_set representatives.
2019-09-24 21:49:25 -07:00
Hanif Bin Ariffin d1e069ea23 Fixed incorrect use of variables
The previous committer mistakenly used the wrong variable to query some values.
This commit simply changes it so that it queries the right Dict.
2019-09-24 16:45:34 -04:00
Marios Staikopoulos 77e223ff94 GLTF: Fixed some issues with skin groups joining incorrectly and removed unused code
- Skin groups now merge more cleanly together
- Skins whose highest nodes are siblings of another skin now get merged also
- Skin nodes who have children of another skin now also fuse together
- Removed the re-rooting of IBM code, as it is no longer needed with the Skin system
2019-09-22 17:45:36 -07:00
Marios Staikopoulos 72d2468d68 More GLTF Fixes
1: Depth draw mode set for transparent materials (iFire)
2: Skeletons
  - Bone names now unique and seperate from scene names
  - Due to mixture of fake joints and joints, new bone sanitizing for names added
  - Fixed an issue where some disjoint skins were not being joined due to a logic error
  - Deterministic and Depth-first bone creation order
3: Skins
  - Removed duplicate skins when possible
4: Animations
  - Fixed invalid morph target names
2019-09-21 21:45:38 -07:00
Marios Staikopoulos 6fc5647bc3 GLTF Importer - Add more Index types and const-ed up the code 2019-09-21 15:21:02 -07:00
Marios Staikopoulos 11e09e59d1 GLTF2 Import Fixes - Skin(s) to Skeleton - Skin Support 2019-09-20 23:08:58 -07:00
Juan Linietsky d81ddaf33e Added skin support and simplified APIs to override bone position. 2019-09-18 19:46:32 -03:00
Fabio Alessandrelli c19871af6d Move CryptoCore to it's own folder.
Crypto classes will be placed in core/crypto.
2019-08-19 16:31:05 +02:00
Braden Bodily 71d71d55b5 Replace 'ERR_EXPLAIN' with 'ERR_FAIL_*_MSG' in 'core/' and 'editor/'
Condensed some if and ERR statements. Added dots to end of error messages

Couldn't figure out EXPLAINC. These files gave me trouble: core/error_macros.h, core/io/file_access_buffered_fa.h (where is it?),
core/os/memory.cpp,
drivers/png/png_driver_common.cpp,
drivers/xaudio2/audio_driver_xaudio2.cpp (where is it?)
2019-08-17 12:33:15 +02:00
Joseph Catrambone c2e91005ef Bugfix in GLTF import: Flipping boolean check. Reindexing should _NOT_ happen when blend shapes are present. 2019-07-27 14:34:54 -07:00
Rémi Verschelde a1b4568ba9
Revert "Tweak SpatialMaterial's default metallic and roughness texture channels" 2019-07-22 11:56:41 +02:00
Fabio Alessandrelli 564d93ff10 CryptoCore class to access to base crypto utils.
Godot core needs MD5/SHA256/AES/Base64 which used to be provided by
separate libraries.
Since we bundle mbedtls in most cases, and we can easily only include
the needed sources if we so desire, let's use it.

To simplify library changes in the future, and better isolate header
dependencies all functions have been wrapped around inside a class in
`core/math/crypto_base.h`.

If the mbedtls module is disabled, we only bundle the needed source
files independently of the `builtin_mbedtls` option.
If the module is enabled, the `builtin_mbedtls` option works as usual.

Also remove some unused headers from StreamPeerMbedTLS which were
causing build issues.
2019-07-02 12:36:27 +02:00
Rémi Verschelde b9f8e072ce
Merge pull request #26205 from Calinou/spatialmaterial-use-packed-channels
Tweak SpatialMaterial's default metallic and roughness texture channels
2019-06-20 11:46:01 +02:00
Rémi Verschelde b486f5dde0 glTF: Fix import of animations with INTERPOLATION_LINEAR
Bug found thanks to GCC 8's -Wduplicated-branches.
Slight refactor for readability.
2019-06-15 15:20:13 +02:00
Rémi Verschelde c8994b56f9 Style: Apply new changes from clang-format 8.0
It seems to stay compatible with formatting done by clang-format 6.0 and 7.0,
so contributors can keep using those versions for now (they will not undo those
changes).
2019-04-09 17:09:48 +02:00
Rémi Verschelde e6979adb1b
Merge pull request #26918 from aqnuep/skeleton_reparenting_fix
Fix skeleton reparenting to also work when the skeleton node is not a bone
2019-04-05 16:48:42 +02:00
Vivatchai Kaveeta 32dd9c67c6 Fix order of transformation in GLTF import
From the gltf 2 spec, the order is R  * S. Previously we did S * R, which broke some mesh with non-uniform scale.

Fix #23356, Fix #14725
2019-03-18 03:08:46 +07:00
Daniel Rakos 1cf7ca87ce Fix skeleton reparenting to also work when the skeleton node is not a bone
Existing code only did the reparenting when the parent node was a bone. This
change fixes that, plus the reparenting code itself, which used the index of
the skin instead of the skin index itself to address the skeleton array.
2019-03-11 16:26:45 +01:00
Juan Linietsky 2f32a75d2e Skeletons can now choose between using local or world coords for processing, fixes #26468 2019-03-03 12:24:00 -03:00
Juan Linietsky 3f681b0681 Clean up blend shape support in GLES2 and GLES3. 2019-03-01 16:01:44 -03:00
Hugo Locurcio eb79833770
Tweak SpatialMaterial's default metallic and roughness texture channels
To follow the glTF 2.0 specification in all cases (including outside
of imported glTF scenes), the blue channel is now used for metallic
and the green channel is now used for roughness.
2019-02-23 19:10:31 +01:00
marxin 8d51618949 Add -Wshadow=local to warnings and fix reported issues.
Fixes #25316.
2019-02-20 19:44:12 +01:00
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