101 Commits

Author SHA1 Message Date
Henry Conklin
eaf80e476a Store the draw type when exporting empty nodes
Supports using empties as placeholders for collision shapes
2021-08-28 06:58:18 -04:00
Lu Jiacheng
95fde85e03 Merge pull request #396 from timjklein36/tk/bugfix-docker-build
Fix Docker Build Upgrading Python to 3.6
2021-03-07 20:34:04 +08:00
Tim Klein
44a894f2ee [-] Add ordered_bones method to ensure bone order matches armature hierarchy
- This is done for the iteration during `generate_bones_mapping`.
- Adds a test export blend file and reference export escn file.
- Another reference export needed to be updated due to a new (correct)
  bone order upon export, but does not affect the rest of that test.
2021-03-05 21:51:44 -05:00
Tim Klein
35b6da5f57 [-] Update default PYLINT command in entrypoint script
- Also, update README to include working docker command examples
2021-03-04 15:58:04 -05:00
Ryan Roden-Corrent
47cca0e758 Add a Dockerfile for local reference updates.
This allows local users to test and generate reference exports without
installing a specific version of Blender locally.

Linting currently doesn't work due to a python version mismatch.
2021-01-04 10:40:49 -05:00
Lu Jiacheng
0619f241ee Add script to generate a scene diff for a failed regression test (#384) 2020-12-15 22:34:24 +08:00
scurest
a35395770c Only triangulate n-gons when necessary for calc_tangents (#379)
* Export from mesh.loop_triangles instead of mesh.polygons

This shouldn't change anything atm since the mesh is triangulated
beforehand, but this will allow us a non-triangulated mesh in the
future, which avoids problems where the mesh triangulation is wrong;
loop_triangles is always the "true" triangulation.

* Use mesh.loop_triangles for concave_shape

No longer need to ask the mesh converter to triangulate.

* Triangulate meshes if necessary for tangents

This means it is no longer required to ask for triangulation if
asking for tangents.

* Remove triangulate argument; now only triangulate for tangents

It is now as if it were always False. Triangulation will only
occur if needed for calc_tangents.

This was only True in mesh.py. Now that it is False there,
triangulate_mesh will be skipped for any meshes without (>4)-gons,
which solves issues of bad triangulation/damaged normals for these
meshes.

* Only triangulate n-gons when we can't calc_tangents

This should confine damage caused by triangulation to n-gons only.

* Warn when triangulating that exported n-gons may look wrong

* Test: make update-examples
2020-11-26 00:30:36 +08:00
Ryan Roden-Corrent
27ffa28078 Set physics properties on a PhysicsMaterial. (#365)
* Don't set friction/bounce on KinematicBody.

These are properties only of Rigid and Static bodies.

* Set physics properties on a PhysicsMaterial.

```
The method set_friction has been deprecated and will be removed in the future, use physics material instead.
The method set_bounce has been deprecated and will be removed in the future, use physics material instead.
```

Fixes #364.
2020-11-22 14:30:02 +08:00
Willian Galvani
6083284095 Add missing material properties to contraint_with_underform_bone.escn 2020-10-19 22:00:07 -03:00
Ryan Roden-Corrent
274f668963 Improve our attempt at exporting SpatialMaterials. (#341)
* Attempt basic spatial material conversion.

This improves our attempt at converting several material types
(Principled, Diffuse, and Emission) to SpatialMaterials. It still leaves
a lot to be desired, but implements more than our current approach.

What works:

- Principled albedo, metallic, roughness, anisotropy, emission, and
  clearcoat. Principled does not have emission strength, so we just
  assume 1.
- Emission strength and color
- Diffuse color and roughness.

Fixes #332.

* Add alpha support for spatial materials.

Everywhere we currently export a color we use mathutils.Color, which
doesn't support alpha. This adds an RGBA type we can use to export
colors with alpha.

Maybe we could use this in other places, but I'm not sure the
implications right now.

* Null-check NodeTree in SpatialMaterial export

* Add config.json for spatial export test.

* Update tests for spatial material export.
2020-06-05 15:53:55 +08:00
Jason0214
5b57e6981f Fix regression test looped animation exporting
Loop suffix is changed from '_loop' to '-loop', update reference scene
accordingly.
2020-02-25 23:14:46 -08:00
Ryan Roden-Corrent
088a64ecdf Change _loop suffix to -loop.
This is a breaking change.

For consistency with other exporters, we should use the suffix "-loop",
not "_loop", to indicate that an animation is looping. If we detect the
suffix "_loop" or any variation on the capitilization, we will print a
warning.

While we could be more flexible with the suffix and not break existing
exports, this would set the precedent for needing to support multiple
suffixes in other areas too. It seems safer to get strict as soon as we
can.

Fixes #310.
Relates to https://github.com/godotengine/godot/issues/32678.
2020-02-25 06:50:48 -05:00
Lu Jiacheng
97244579a5 Merge pull request #283 from rcorre/geometry_shader
Implement some Geometry node shader outputs.
2020-01-11 11:00:57 -08:00
Lu Jiacheng
5c72113bb7 Merge pull request #291 from akien-mga/travis-blender-2.81
Travis: Add build job with Blender 2.81
2019-12-15 16:49:50 -08:00
Jason0214
04ab6cbcc5 Conformance with Blender2.81
1. ShaderNodeMapping socket and property change,
see https://wiki.blender.org/wiki/Reference/Release_Notes/2.81/Python_API
2. Exclude two unused input socket (dhdx, dhdy) in BumpNode
2019-12-15 14:34:29 -08:00
Ryan Roden-Corrent
7bf96d5b5e Use is_direction=True for Tangent and Normal. 2019-12-10 08:07:20 -05:00
Ryan Roden-Corrent
3775e4edc0 Merge remote-tracking branch 'upstream/master' into geometry_shader 2019-12-10 07:51:40 -05:00
Jason0214
8ca6b07a86 Fix testing failing in CI
1. Last commit changes `spot_range` mapping from `distance` to
`cutoff_distance`, it breaks some light tests.
2. Fix a pylint line-too-long error
2019-12-08 21:50:05 -08:00
Rémi Verschelde
0ed31b2a0f Travis: Add build job with Blender 2.81 2019-11-22 12:30:22 +01:00
Ryan Roden-Corrent
6b2decd37f Implement some Geometry node shader outputs.
Implements a subset of the geometry shader node outputs that trivially
map to godot shader inputs.

See #280.
2019-09-26 22:41:43 -04:00
Jason0214
e7a4f3b963 Use Blender2.80 stable build for travis CI
Blender API is keep changing in Blender master branch, which makes it
hard to do regression tests. Here, switch back to Blender2.80 stable
for all the testing. Will consider testing with up-to-date API when
Blender2.81 releases.
2019-09-02 23:02:41 -07:00
Andrea Catania
89f07c64ab Generate concave shapes has godot does
Generate concave shapes with inverted faces as Godot does
2019-08-04 13:57:19 -06:00
Jason0214
bae7431678 Refactor CollisionShape generating in physics
1. Remove triangulating in exporting any convex CollisionShape
2. Add utils to reuse mesh exporting related functions in CollisionShape
exporting
2019-08-04 13:42:46 -06:00
Jason0214
de3815fa51 Fix crash on sharing Concave/Convex collision mesh 2019-08-03 23:29:47 -06:00
Jason0214
cd95348ade Explicitly normalize quaternion in exporting 2019-07-28 19:35:07 -06:00
Jason0214
163e2ad659 Support exporting Blender Generated Texture Coord
1. Implement exporting Generated Texture Coordinates by evaluting
bounding box of blender object and passing AABB as uniforms.
2. Make ImageTexture node default to use Generated Texture Coordinates.
2019-07-26 00:27:50 -06:00
Jason0214
c4ead530c6 Update shape key with subdivision test scene
test scene diff was broken due to update of blender2.8
2019-06-30 11:15:40 -06:00
Tom Wilson
b534efb0aa Squashed commit, multiple bug fixes + improvements.
----------------

Fixed pylint errors.

Removed commented code.
Formatted code.

Update test scene

Include Godot Resource Name in to MeshResourceKey

Same mesh may be used both as CollisionShape and ArrayMesh

Simplify MeshResourceKey construction

The previously implementation is kind of risk because of the recursive
calling, here introduce a simpler one with some fault allowance.

Minor changes and fixes to last commit.

- Added functionality to export all object types.
  - Replaced 'MESH' in object_types with more general 'GEOMETRY' option, allowing for all the following types to be converted: MESH, CURVE, SURFACE, META, FONT. These are all treated similarly using mesh.py. Beziers and Surfaces shapekeys tested and working.
- Moved + rejigged Mesh/Skeleton path resolving to end of export_scene() in export_godot.py for better functionality.
- Fixed bugs when attempting to export empty geometry.
- Added MeshResourceKey to mesh.py, this produces an identifier key for meshes with modifiers. Now, if more than one object use the exact same object data and modifiers then the exporter refers to a single resource.
- Reverted ArrayMeshResource resource_name values to object.data.name.
- Fixed some newline spacing inconsistencies that happened during serialization, so it now matches the same spacing that Godot uses.

Fully updated to work with latest Blender 2.8 build (March 31st 2019)
- Fixed use_mesh_modifiers when converting meshes.
- Added MeshConverter class to assist in all object to mesh conversions.
- Implemented new mesh naming convention to prevent clashing resource names.
- Commented out modifier disabling during ArrayMeshResourceExporter's export_morphs(), based on several tests that suggested it was not necessary.
- Fixed default_settings in __init__.py.
- Renamed MeshResourceExporter to ArrayMeshResourceExporter for consistency.

Implemented property "use_mesh_modifiers" prior to which was no longer working and had no effect on the resulting mesh.

Updated all props to use Python's type annotations, fixes start-up warning.

Updated all references of Object.to_mesh() to work with latest changes to Blender 2.8 API.
2019-06-13 11:27:56 +01:00
Jason0214
cffffa9691 Update light exporting, shader material due to blender change
1. spot light and point light has its energy unit enlarged by 100 times
2. a new attribute 'Alpha' is added to principled BSDF node
2019-05-17 17:04:32 +08:00
Jason0214
5aa6ab3b81 update test scene after blender mesh API change 2019-05-17 15:36:33 +08:00
Jason0214
3c1df89581 perform baking on armature with non-inheirt bones 2019-05-16 15:22:33 +08:00
Jason0214
b23d995ef5 force a transform clear after an armature action being exporter 2019-04-20 15:43:30 -07:00
Ryan Roden-Corrent
e819179edc Support export of looped animations.
Animations with a name ending in _loop will be exported with loop=true.
Fixes #161.
2019-03-31 11:24:53 -07:00
Jason0214
7663bbd1e1 use topology sort instead of bfs in traversal 2019-03-22 21:26:17 -07:00
Jason0214
abfed45b82 several improvements in script shader generating
1. change transparent object's default refraction offset to (0.0, 0.0)
2. successfuly generating shader script even if no texture image
provided
3. if image texture node has no coordinate input, default to UV
4. remove glass effection in transparent principled BSDF
5. set a assertion guard in defining output sockets
6. correct emission and transparent bsdf output
7. more safe property check in mix shader
8. fix possible SameFileError in texture exporting
2019-03-22 21:26:17 -07:00
Jason0214
22d2f396d9 explicitly set bones are in world transform 2019-03-15 10:00:25 -07:00
Ryan Roden-Corrent
91b8dac9ac Assign useful names to BoneAttachment nodes.
Instead of exporting BoneAttachments with names like `BoneAttachment`,
`BoneAttachment001`, `BoneAttachment002`, and so on, export them with
names like "${BoneName}BoneAttachment".

This makes your Godot code more robust and readable. If I have
attachments to bones named "Hand.L" and "Hand.R", now in Godot I can
refer to them as "HandLBoneAttachment" and "HandRBoneAttachment"
instead of "BoneAttachment" and "BoneAttachment001".
2019-03-15 10:00:16 -07:00
Jason0214
1900a09c36 rewrite script shader generate code 2019-03-13 00:11:11 -07:00
Jason0214
ce76bb279e support bezier track as beta feature 2019-03-03 15:41:48 -08:00
Lu Jiacheng
8109854dc6 Merge pull request #165 from Jason0214/support_transmission
Support transmission
2019-02-16 16:17:30 -08:00
Jason0214
ef4184b5e7 support 'transmission' in BSDF node 2019-02-16 16:11:42 -08:00
Lu Jiacheng
dfb78a7599 Implement basic cycles light handling. (#164)
Cycles lights are implemented using the node tree, and this patch
doesn't attempt to handle all the possibilities that enables.

However, it does succeed in exporting the basic options you can tweak
in the light settings panel, including:

- RGB Color (no alpha)
- Energy
- Negative Light (for strength < 0)
- Shadows enabled/disabled

This also removes the use_sphere check as cycles lights do not support
limited distance or use_sphere.

Fixes #150.

(cherry picked from commit b57cee82f3)
2019-02-16 16:06:00 -08:00
Lu Jiacheng
fe6d206098 Fix should obj exporting check, fix non-deform bone in constraint issue (#156)
* fix whether object should exported check

* fix constrained action with unexported bone

* use cached bone rest

* update test scene
2019-02-07 22:40:45 -08:00
Jason0214
c5c0bffd41 rewrite constraint baking 2019-02-03 16:09:26 -08:00
Jason0214
c4a36ef3ff make material export optional, add EEVEE support 2019-02-03 14:51:06 -08:00
Jason0214
b3d305bda5 format generated shader code better 2019-01-16 11:08:45 -08:00
Jason0214
5d18a77ead work around matrix decomposition 2019-01-08 17:53:49 +01:00
Jason0214
3f89937418 initial commit for blender 2.80 support 2018-12-16 21:23:24 -08:00
Lu Jiacheng
b7fca53a2a Merge pull request #129 from Jason0214/fix_collisionShape_children_transform
fix transform matrix of children of CollisionShape
2018-12-16 20:47:37 -08:00
Jason0214
494ddd1cef fix transform matrix of children of CollisionShape 2018-12-16 17:44:49 -08:00