Commit graph

493 commits

Author SHA1 Message Date
Anilforextra cc51b045da Construct values only when necessary. 2021-09-23 22:26:07 +05:45
bruvzg 545db3c8af Update Font advanced import dialog character ranges to Unicode 14. Fix character range selector column number. 2021-09-22 16:55:39 +03:00
Rémi Verschelde ba57252bd8
Merge pull request #52878 from AnilBK/add-get-center 2021-09-21 21:30:30 +02:00
Anilforextra 90908cd67d Add Get Center Method for Rect2/Rect2i and AABB. 2021-09-21 21:14:17 +05:45
Rémi Verschelde 2d1699ef82
Merge pull request #42103 from dankan1890/import_atlas_fix 2021-09-20 16:09:36 +02:00
Rémi Verschelde 7da6fcb89e
Import: Disable thread import for OBJ meshes
This can currently lead to deadlocks, possibly due to some race condition
in the Vulkan renderer.

Works around #48265.
2021-09-20 11:57:16 +02:00
Camille Mohr-Daurat 3581b893ed
Merge pull request #52681 from nekomatata/rename-rigid-body
Rename RigidBody to RigidDynamicBody and SoftBody to SoftDynamicBody
2021-09-16 11:20:21 -07:00
PouleyKetchoupp 85819b199a Rename RigidBody to RigidDynamicBody and SoftBody to SoftDynamicBody 2021-09-16 09:55:20 -07:00
Camille Mohr-Daurat 1852afb6b0
Merge pull request #52679 from nekomatata/world-boundary-shape
Rename WorldMarginShape to WorldBoundaryShape
2021-09-15 16:02:40 -07:00
PouleyKetchoupp 2ca94e51e4 Clean convex hull decomposition code
Remove unnecessary conversion between triangle data and vertex data
whenever possible.
2021-09-14 17:14:06 -07:00
PouleyKetchoupp bb75aec8bc Rename WorldMarginShape to WorldBoundaryShape 2021-09-14 11:16:31 -07:00
Rémi Verschelde e13d8eda1b
Merge pull request #52266 from AndreaCatania/coll 2021-09-14 14:34:22 +02:00
Lyuma aca4b737f1 8 uvs for glTF2, URI decode and Vertex Custom api.
Add glTF2 uri decode for paths.

Add vertex custom apis.

Add scene importer api.

Change Color to float; add support for float-based custom channels in SurfaceTool and EditorSceneImporterMesh

Co-authored-by: darth negative hunter
 <thenegativehunter2@users.noreply.github.com>
2021-09-10 09:16:48 -07:00
AndreaCatania e3a06c3a9e Improve collision generation usability in the new 3D scene import workflow.
With this PR it's possible to add a collision during the Mesh import, directly in editor.
To generate the shape is possible to chose between the following options:
- Decompose Convex: The Mesh is decomposed in one or many Convex Shapes (Using the VHACD library).
- Simple Convex: Is generated a convex shape that enclose the entire mesh.
- Trimesh: Generate a trimesh shape using the Mesh faces.
- Box: Add a primitive box shape, where you can tweak the `size`, `position`, `rotation`.
- Sphere: Add a primitive sphere shape, where you can tweak the `radius`, `position`, `rotation`.
- Cylinder: Add a primitive cylinder shape, where you can tweak the `height`, `radius`, `position`, `rotation`.
- Capsule: Add a primitive capsule shape, where you can tweak the `height`, `radius`, `position`, `rotation`.

It's also possible to chose the generated body, so you can create:
- Rigid Body
- Static Body
- Area
2021-09-08 08:12:51 +02:00
Kirill Diduk 92fa2bac23 Explicitly convert signed to unsigned value 2021-09-06 15:40:41 +02:00
Wilson E. Alvarez d11c1afc04
Rename String::is_rel_path to String::is_relative_path 2021-08-29 20:41:29 -04:00
K. S. Ernest (iFire) Lee 90a35dac48
Merge pull request #51908 from bruvzg/msdf_fonts2
Make FontData importable resource. Add multi-channel SDF font rendering.
2021-08-27 08:51:37 -07:00
bruvzg 4c3f7d1290 Makes FontData importable resource.
Adds multi-channel SDF font texture generation and rendering support.
Adds per-font oversampling support.
Adds FontData import plugins (for dynamic fonts, BMFonts and monospaced image fonts), font texture cache pre-generation and loading.
Adds BMFont binary format and outline support.
2021-08-27 15:43:18 +03:00
PouleyKetchoupp 3d5dc80348 Rename RayShape to SeparationRayShape
Makes it clearer that it's used for special cases when picking a
collision shape.
2021-08-24 17:34:55 -07:00
PouleyKetchoupp 45c7af9862 Restore RayShape as a regular shape type
Partial revert from previously removing ray shapes completely, added
back as a shape type but without the specific character controller code.
2021-08-24 16:03:05 -07:00
Lyuma e6962729d5 Implement set_surface_material and set_surface_name methods in EditorSceneImporterMesh, and add documentation. 2021-08-22 19:42:35 -07:00
reduz 3682978aee Replace BIND_VMETHOD by new GDVIRTUAL syntax
* New syntax is type safe.
* New syntax allows for type safe virtuals in native extensions.
* New syntax permits extremely fast calling.

Note: Everything was replaced where possible except for `_gui_input` `_input` and `_unhandled_input`.
These will require API rework on a separate PR as they work different than the rest of the functions.

Added a new method flag METHOD_FLAG_OBJECT_CORE, used internally. Allows to not dump the core virtuals like `_notification` to the json API, since each language will implement those as it is best fits.
2021-08-22 08:23:58 -03:00
Rémi Verschelde 8b6c168b3a
Merge pull request #48560 from SaracenOne/collada_semantic_fix_4_0 2021-08-19 09:02:16 +02:00
Anilforextra d73d8b8d78 Fix duplicate conditions. 2021-08-13 12:22:38 +05:45
PouleyKetchoupp 4da3a87f7d Remove infinite inertia and ray shapes from CharacterBody
Infinite inertia:
Not needed anymore, since it's now possible to set one-directional
collision layers in order for characters to ignore rigid bodies, while
rigid bodies still collide with characters.

Ray shapes:
They were introduced as a work around to allow constant speed on slopes,
which is now possible with the new property in CharacterBody instead.
2021-08-10 12:10:26 -07:00
Aaron Franke 430ad75963
Some work on double support 2021-08-09 17:43:48 -05:00
K. S. Ernest (iFire) Lee 9d1979ba62 Make animation reset do less spam. 2021-08-05 11:33:01 -07:00
K. S. Ernest (iFire) Lee d393708e75
Merge pull request #51285 from V-Sekai/reset-anim-spam
Reset baking should not spam on lack of animation players.
2021-08-05 13:17:18 -04:00
K. S. Ernest (iFire) Lee 48001d9cb9
Merge pull request #50797 from AndreaCatania/AndreaCatania-patch-4
Fix Static & Rigid body generation on mesh import.
2021-08-05 13:00:14 -04:00
K. S. Ernest (iFire) Lee 6fa7cf1380 Reset baking should not spam on lack of animation players. 2021-08-05 09:14:27 -07:00
K. S. Ernest (iFire) Lee b742076e17 Bake RESET animation.
Co-authored-by: MMMaellon <mmmaellon@gmail.com>
Co-authored-by: Eron <rufsketch1@gmail.com>
2021-07-30 02:00:21 -07:00
Rémi Verschelde 92299989bd
Use Ref<T> references as iterators where relevant
And const when possible.
2021-07-26 19:27:11 +02:00
Rémi Verschelde ac3322b0af
Use const references where possible for List range iterators 2021-07-25 12:22:25 +02:00
Aaron Franke c0ce2b3397
Fix scene import following List iterator changes 2021-07-24 14:56:53 -04:00
Andrea Catania 21a13649be
Fix Static & Rigid body generation on mesh import.
The function `_gen_shape_list` is using the resource `Res<Mesh>`, but during the import phase the resource used is instead `Ref<EditorSceneImporterMesh>`.

Note: the `Ref<EditorSceneImporterMesh>` is an intermediate resource, that will be used to create a `Res<Mesh>` at the end of the import process. `Ref<EditorSceneImporterMesh>` and `Ref<Mesh>` are not inheriting each other, so the internal cast done by `Ref<>` during the assignment, is always null:

```c++
Ref<EditorSceneImporterMesh> import_mesh(/* Assume it's initialized */);
CRASH_NOW(import_mesh.is_null());

Ref<Mesh> mesh = import_mesh;
CRASH_NOW(mesh.is_null()); // <--- Here we have a crash, since it's impossible perform the above cast, and the `mesh` is always null.
```

Here the full list of call to `_gen_shape_list`, where we can notice that a `Ref<EditorSceneImporterMesh>` is passed:
- https://github.com/AndreaCatania/godot/blob/master/editor/import/resource_importer_scene.cpp#L428
- https://github.com/AndreaCatania/godot/blob/master/editor/import/resource_importer_scene.cpp#L454-L458
- https://github.com/AndreaCatania/godot/blob/master/editor/import/resource_importer_scene.cpp#L512-L516

As you can notice, we always pass the following mesh: `Ref<EditorSceneImporterMesh> mesh = mi->get_mesh();`.

We already have the function `_pre_gen_shape_list` that executes the exact same job but using the correct type; Since there is no further usage of the function `_gen_shape_list` in the code base, I think it's just some leftover code, so I removed it entirely to use the proper function.
2021-07-24 08:39:18 +02:00
Aaron Franke 4e6efd1b07
Use C++ iterators for Lists in many situations 2021-07-23 17:38:28 -04:00
Hugo Locurcio 7f83977f37
Expose an ImportOrder enum in ResourceImporter
This avoids using magic numbers in code.
2021-07-23 12:12:25 +02:00
reduz 6631f66c2a Optimize StringName usage
* Added a new macro SNAME() that constructs and caches a local stringname.
* Subsequent usages use the cached version.
* Since these use a global static variable, a second refcounter of static usages need to be kept for cleanup time.
* Replaced all theme usages by this new macro.
* Replace all signal emission usages by this new macro.
* Replace all call_deferred usages by this new macro.

This is part of ongoing work to optimize GUI and the editor.
2021-07-18 21:20:02 -03:00
PouleyKetchoupp 1de995ae99 Options to clean/simplify convex hull generated from mesh
Clean: remove duplicate and interior vertices (uses Bullet algorithm)
Simplify: modify the geometry for further simplification (uses VHACD
algorithm)

In the editor, single convex hull now uses the clean option.
Added a new editor entry to create a simplified convex hull, can be
useful for creating convex hull from highly tessellated triangle meshes.
2021-07-07 12:14:12 -07:00
reduz 75688772b3 Fix editor suffixes and degrees conversion
* Functions to convert to/from degrees are all gone. Conversion is done by the editor.
* Use PROPERTY_HINT_ANGLE instead of PROPERTY_HINT_RANGE to edit radian angles in degrees.
* Added possibility to add suffixes to range properties, use "min,max[,step][,suffix:<something>]" example "0,100,1,suffix:m"
* In general, can add suffixes for EditorSpinSlider
Not covered by this PR, will have to be addressed by future ones:

* Ability to switch radians/degrees in the inspector for angle properties (if actually wanted).
* Animations previously made will most likely break, need to add a way to make old ones compatible.
* Only added a "px" suffix to 2D position and a "m" one to 3D position, someone needs to go through the rest of the engine and add all remaining suffixes.
* Likely also need to track down usage of EditorSpinSlider outside properties to add suffixes to it too.
2021-06-30 12:38:25 -03:00
Gilles Roudière d7d32ced5b Implement Tree's internal minimum width calculation 2021-06-28 15:54:31 +02:00
K. S. Ernest (iFire) Lee b8fb765a65 Fix for LOD is broken 49706 2021-06-20 04:27:32 -07:00
Rémi Verschelde 671bd64e4a
Merge pull request #49754 from aaronfranke/is-eq-approx-sub-opt
Fix sub-optimal uses of is_equal_approx
2021-06-20 11:44:56 +02:00
Aaron Franke 45c24fd039
Fix sub-optimal uses of is_equal_approx 2021-06-20 03:03:06 -04:00
Lightning_A e28fd07b2b Rename instance()->instantiate() when it's a verb 2021-06-19 20:49:18 -06:00
K. S. Ernest (iFire) Lee b74bc42a43 ERR_FAIL_NULL check file access
Null in ResourceImporterTexture::_save_stex
2021-06-16 16:13:36 -07:00
Rémi Verschelde 07b8fffa7c
Merge pull request #49458 from JFonS/fix_unwrap_xform
Rename get_parent_spatial() to get_parent_node_3d()
2021-06-14 18:32:33 +02:00
jfons ee702334a1 Rename get_parent_spatial() to get_parent_node3d()
Renames get_parent_spatial() to get_parent_node3d() and changes its
implementation. Before it was not returning a correct pointer if the
node wasn't added to a SceneTree. Now it uses the same implementation as
CanvasItem, which will be correct even for nodes outside a SceneTree.
2021-06-14 14:05:13 +02:00
kobewi 7ff135b015 Consistently prefix bound virtual methods with _ 2021-06-12 00:55:52 +02:00
Rémi Verschelde 530e069bc3
Merge pull request #49312 from RandomShaper/reference_to_ref_count
Rename `Reference` to `RefCounted`
2021-06-11 19:46:25 +02:00