jkvargas / russimp

Assimp bindings for Rust
Other
84 stars 27 forks source link

Add ability to load scenes with custom properties #62

Closed cmilatinov closed 8 months ago

cmilatinov commented 8 months ago

Example scene loading code

let props: PropertyStore = [(
    AI_CONFIG_IMPORT_FBX_PRESERVE_PIVOTS as &[u8],
    Property::Integer(0),
)]
    .into_iter()
    .into();
let scene = Scene::from_file_with_props(
    path.to_str().unwrap(),
    vec![
        PostProcess::Triangulate,
        PostProcess::GenerateSmoothNormals,
        PostProcess::FlipUVs,
        PostProcess::FlipWindingOrder,
        PostProcess::JoinIdenticalVertices,
    ],
    &props,
)?;
jkvargas commented 8 months ago

Hey mate, thanks for your contribution, I would like to ask you somethings before merging your work.

cmilatinov commented 8 months ago

Hey,

Yessir, no problem I will go through the checklist ASAP and update the PR.

Cheers

cmilatinov commented 8 months ago

Hey @jkvargas,

I've made the changes you requested, just requesting a final review.

I added an example usage for props in the examples folder :)

Also, I'm a windows user atm, so I hope running the tests with --features prebuilt is the correct thing to do

PS: Very cool rust package, I'm glad to be able to contribute!

Have a nice day!

jkvargas commented 8 months ago

Thanks for the additions, man. There are some tests failing. With those fixed I believe we are good to go.

cmilatinov commented 8 months ago

Yea its a compilation error since the bindings.rs file isn't generated for the tests I believe so rust can't find the AI_* constants.

error[E0432]: unresolved imports `crate::sys::AI_CONFIG_IMPORT_COLLADA_IGNORE_UP_DIRECTION`, `crate::sys::AI_CONFIG_IMPORT_COLLADA_USE_COLLADA_NAMES`, `crate::sys::AI_CONFIG_IMPORT_FBX_PRESERVE_PIVOTS`, `crate::sys::AI_CONFIG_IMPORT_FBX_READ_WEIGHTS`, `crate::sys::AI_CONFIG_PP_OG_EXCLUDE_LIST`, `crate::sys::AI_CONFIG_PP_PTV_ADD_ROOT_TRANSFORMATION`, `crate::sys::AI_CONFIG_PP_PTV_ROOT_TRANSFORMATION`
   --> src/property.rs:110:9
    |
110 |         AI_CONFIG_IMPORT_COLLADA_IGNORE_UP_DIRECTION, AI_CONFIG_IMPORT_COLLADA_USE_COLLADA_NAMES,
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `AI_CONFIG_IMPORT_COLLADA_USE_COLLADA_NAMES` in the root
    |         |
    |         no `AI_CONFIG_IMPORT_COLLADA_IGNORE_UP_DIRECTION` in the root
111 |         AI_CONFIG_IMPORT_FBX_PRESERVE_PIVOTS, AI_CONFIG_IMPORT_FBX_READ_WEIGHTS,
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `AI_CONFIG_IMPORT_FBX_READ_WEIGHTS` in the root
    |         |
    |         no `AI_CONFIG_IMPORT_FBX_PRESERVE_PIVOTS` in the root
112 |         AI_CONFIG_PP_OG_EXCLUDE_LIST, AI_CONFIG_PP_PTV_ADD_ROOT_TRANSFORMATION,
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `AI_CONFIG_PP_PTV_ADD_ROOT_TRANSFORMATION` in the root
    |         |
    |         no `AI_CONFIG_PP_OG_EXCLUDE_LIST` in the root
113 |         AI_CONFIG_PP_PTV_ROOT_TRANSFORMATION,
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `AI_CONFIG_PP_PTV_ROOT_TRANSFORMATION` in the root

For more information about this error, try `rustc --explain E0432`.
error: could not compile `russimp` (lib test) due to previous error

That's why I ran the tests with --features prebuilt locally. Should I just manually copy-paste the constant definitions in the tests?

jkvargas commented 8 months ago

Hey man, I will disable the tests for now till I get a better understanding on what is going on. =) Thanks brother.