Commit Graph
8412 Commits
Author SHA1 Message Date
Dmitry Stepanov ca6b3d5341 Merge pull request #922 from FyroxEngine/try_compare
`Reflect::try_compare`
2026-06-11 12:40:12 +03:00
Dmitry Stepanov 5e9cabba00 template fixes + more PartialEq impls 2026-06-11 12:25:21 +03:00
Dmitry Stepanov a86184e856 cargo fmt 2026-06-11 12:08:02 +03:00
Dmitry Stepanov 806c3ed297 finished with PartialEq impls 2026-06-11 12:05:30 +03:00
Dmitry Stepanov b0113664fa PartialEq impls + improvements for ui 2026-06-10 20:41:48 +03:00
Dmitry Stepanov c0978db579 continue with PartialEq impls 2026-06-09 23:15:40 +03:00
Dmitry Stepanov d35476c864 more PartialEq impls 2026-06-07 23:58:55 +03:00
Dmitry Stepanov 7a798f7e68 Reflect::try_compare impls 2026-06-06 22:37:34 +03:00
Dmitry Stepanov 0965df060c Reflect::try_compare draft 2026-06-05 23:06:29 +03:00
Dmitry Stepanov 6ffc26b274 more precise naming 2026-06-02 21:49:02 +03:00
Dmitry Stepanov b3c1d5586a fixed property revertion 2026-06-01 22:36:48 +03:00
Dmitry Stepanov 2ce1624186 renamed SceneGraphNode trait to NodeWrapper
- `SceneGraphNode` was implemented for types `struct Wrapper(Box<dyn NodeTrait>)`
- calling such types node itself is wrong, because the actual node is stored inside the box
2026-05-31 22:17:31 +03:00
Dmitry Stepanov e485a2fc37 removed unused associated type 2026-05-31 21:53:49 +03:00
Dmitry Stepanov bb3c7ca2eb fixed project template 2026-05-28 22:06:27 +03:00
Dmitry Stepanov 7f33a13ff9 merged TypeUuidProvider trait into Reflect 2026-05-28 21:50:17 +03:00
Dmitry Stepanov 768df4600d Reflection refactoring (#920)
* refactored `Reflect` trait to remove unnecessary proxying

- proxying to the inner value overly complicates the implementation and adds a lot overhead
- this is quite dangerous change since it may have subtle side effects, needs to be thoroughly tested

* ability to specify custom clone function for reflect trait

* use derived impls of Reflect for Script + Node

* use Reflect auto impl for trait object wrappers

* refactored `Reflect::as_xxx` methods to return value itself

- there's no reason anymore to use closures there because proxy structures now supports reflection in normal way

* doc improvements + corrections

* register scene nodes in inspector

* register ui widgets in inspector

* fixed `is_out_of_sync` to recursively check for out of sync

* fixed downcasting for widgets and scene nodes

- removed a bunch of unnecessary casts to &dyn Reflect

* use inner value of node/widget wrapper in the inspector

* fixed editing of inheritable vars

* fixed name column hiding in inspector

- setting name column width is not the correct way, because this property is recursively supplied to the inner inspectors and hides what shouldn't be hidden

* fixed editing of `RefCell<T>`

* fixed tests + docs comment
2026-05-25 19:54:13 +03:00
Dmitry Stepanov 4876827a6d fixed tests + docs comment 2026-05-25 19:53:56 +03:00
Dmitry Stepanov cc22d39928 fixed editing of RefCell<T> 2026-05-24 18:04:04 +03:00
Dmitry Stepanov 1db8a092f1 fixed name column hiding in inspector
- setting name column width is not the correct way, because this property is recursively supplied to the inner inspectors and hides what shouldn't be hidden
2026-05-24 11:48:29 +03:00
Dmitry Stepanov 13bf223e07 fixed editing of inheritable vars 2026-05-23 22:16:05 +03:00
Dmitry Stepanov 62501164b0 use inner value of node/widget wrapper in the inspector 2026-05-23 10:47:50 +03:00
Dmitry Stepanov bee807ea17 fixed downcasting for widgets and scene nodes
- removed a bunch of unnecessary casts to &dyn Reflect
2026-05-22 20:31:20 +03:00
Dmitry Stepanov d821684037 fixed is_out_of_sync to recursively check for out of sync 2026-05-21 22:04:23 +03:00
Dmitry Stepanov 8eb7496963 register ui widgets in inspector 2026-05-21 22:03:53 +03:00
Dmitry Stepanov e4c14c9546 register scene nodes in inspector 2026-05-21 21:47:43 +03:00
Dmitry Stepanov 3a6c36de6b doc improvements + corrections 2026-05-21 19:43:59 +03:00
Dmitry Stepanov 480559e07a refactored Reflect::as_xxx methods to return value itself
- there's no reason anymore to use closures there because proxy structures now supports reflection in normal way
2026-05-21 18:22:39 +03:00
Dmitry Stepanov 1799856ea3 use Reflect auto impl for trait object wrappers 2026-05-21 13:37:28 +03:00
Dmitry Stepanov 07566d95b4 use derived impls of Reflect for Script + Node 2026-05-20 23:47:38 +03:00
Dmitry Stepanov 32d37bde41 ability to specify custom clone function for reflect trait 2026-05-20 23:38:41 +03:00
Dmitry Stepanov ec83a5d6e5 refactored Reflect trait to remove unnecessary proxying
- proxying to the inner value overly complicates the implementation and adds a lot overhead
- this is quite dangerous change since it may have subtle side effects, needs to be thoroughly tested
2026-05-19 18:49:17 +03:00
Dmitry Stepanov 93d4920477 renamed methods with confusing naming + docs 2026-05-16 19:31:41 +03:00
Dmitry Stepanov e96d96544f mark inheritable variable as modified when accessing fields by _direct 2026-05-15 13:03:05 +03:00
Dmitry Stepanov e7f1b1d4d8 cleaned up type info fetching from Reflect + put type info in a struct 2026-05-15 11:32:33 +03:00
Dmitry Stepanov 0a6b7a9bf1 fixed doc test 2026-05-14 22:06:23 +03:00
Dmitry Stepanov b3be88a471 Reflect::into_any -> Reflect::into_inner_reflect + docs 2026-05-14 11:28:08 +03:00
June e8740b6452 Fix read_pixels_of_type UB: use bytemuck::cast_slice (#918)
* fix: eliminate UB in read_pixels_of_type via bytemuck::cast_slice

The previous implementation used Vec::from_raw_parts to reinterpret a
Vec<u8> as Vec<T>, then mem::forget to suppress the original Vec's
destructor. This was UB for two reasons:
1. mem::forget receives an invalid value (already-transferred ownership)
2. Vec<T> deallocates with align_of::<T>(), but the memory was allocated
   with align_of::<u8>() = 1, violating alloc/dealloc layout invariants

Replace with bytemuck::cast_slice + to_vec(), which safely casts the
byte slice and copies into a properly-aligned Vec<T>. The Pod bound
already guarantees valid bit patterns for any byte sequence.

Closes #827

* fix: zero-copy TypedPixels<T> wrapper preserves original byte layout

Per @mrDIMAS review: avoid the .to_vec() copy by introducing a
TypedPixels<T> proxy struct that owns the original Vec<u8> (preserving
its allocation layout for correct deallocation) and exposes &[T] via
Deref + bytemuck::cast_slice. Mirrors the BytesStorage pattern used in
fyrox-impl/src/scene/mesh/buffer.rs.

The single caller (HDR luminance histogram) uses &pixels as a slice,
which works unchanged via deref coercion.
2026-05-14 10:48:13 +03:00
Dmitry Stepanov 91f8c360b5 removed Reflect::as_any/as_any_mut
- useless methods because can be replaced via `Reflect::as_reflect` + `as &dyn Reflect` cast
2026-05-13 23:33:13 +03:00
Dmitry Stepanov 8df053acf4 fixed crash when closing a scene with a camera selected on other scene
- fixes #919
2026-05-13 19:11:01 +03:00
Dmitry Stepanov f8c7edb223 fixed animation player fetching in absm editor
- previous impl was using ComponentProvider with a hacky impl that did unsafe transmute on a handle reference type
- new impl is using strong typing without type mangling
2026-05-13 13:12:02 +03:00
Dmitry Stepanov d317a1179f fixed doc comments + fixed misleading docs 2026-05-10 20:06:56 +03:00
Dmitry Stepanov 1c0cf15c50 unified naming for field fetching via reflection
- previous approach with `ComponentProvider` trait was quite misleading, it didn't return a "component" - it simply returned marked fieds
- the new approach is more explicit - method names tells exactly what they do
2026-05-10 18:28:18 +03:00
Dmitry Stepanov fcd280057b count fields in proc macro
- much faster than calling the default impl
2026-05-10 10:54:41 +03:00
Dmitry Stepanov edc7bf0ec0 improved docs 2026-05-09 23:01:23 +03:00
Dmitry Stepanov b17c5f5801 fixed failing test 2026-05-09 20:01:49 +03:00
Dmitry Stepanov c03e4aa7e9 removed ComponentProvider, merged its functionality into Reflect
- chained component fetching isn't supported yet, so it is not one-to-one merge
2026-05-09 19:55:11 +03:00
Dmitry Stepanov e553174d5d Reflect::self_or_field_ref/mut_of_type 2026-05-08 17:30:09 +03:00
Dmitry Stepanov 5cf90dff53 Reflect::first_field_ref/mut_of_type 2026-05-08 15:18:08 +03:00
Dmitry Stepanov 1904f95519 Reflect::get_field_direct_ref/mut 2026-05-08 12:56:48 +03:00
Dmitry Stepanov 0899691cfc Reflect::fields_count 2026-05-07 22:31:44 +03:00