Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document new post-import plugin preprocessing stage to amend settings #10553

Open
fire opened this issue Jan 27, 2025 · 5 comments
Open

Document new post-import plugin preprocessing stage to amend settings #10553

fire opened this issue Jan 27, 2025 · 5 comments
Labels
area:manual Issues and PRs related to the Manual/Tutorials section of the documentation enhancement topic:import

Comments

@fire
Copy link
Member

fire commented Jan 27, 2025

Your Godot version:

godotengine/godot@6dc78c8

Issue description:

Update the documentation.

Allow post-import plugins to modify _subresources godotengine/godot#100792

The use case is to write the .import manually. For example, take a glTF2 character and add HumanoidProfile remapping via script.

This was added as a last-minute advanced post-import plugin feature: post-import plugins can amend the ["_subresources"]["nodes"]["PATH:Armature/Skeleton3D"]["retarget/bone_map"] settings from the preprocessing phase of a post import plugin

We can do it by writing a custom .import file, or we can do it with a plugin.

URL to the documentation page (if already existing):

https://docs.godotengine.org/en/stable/tutorials/plugins/editor/import_plugins.html

@fire fire changed the title Document post-import plugins to amend settings from the preprocessing phase of a post import plugin Document post-import plugins to amend settings from the preprocessing phase Jan 27, 2025
@fire fire changed the title Document post-import plugins to amend settings from the preprocessing phase Document new post-import feature to amend settings from the preprocessing phase from a plugin Jan 27, 2025
@fire
Copy link
Member Author

fire commented Jan 27, 2025

See also godotengine/godot#95461

@GuilhermeGSousa
Copy link

The feature works great as a plugin, I agree updating the docs is needed. Here's what I've been using to edit animation import settings on pre import for posteriority:

void AnimationPostImportPlugin::_pre_process(Node* p_scene) {

    const String export_path = get_option_value("export/animation_export_path");

    if (export_path.is_empty()) {
        return;
    }

    Dictionary animations;
    _export_animations(p_scene, animations, export_path);

    Dictionary subresources = get_option_value("_subresources");
    subresources["animations"] = animations;
}

@fire fire changed the title Document new post-import feature to amend settings from the preprocessing phase from a plugin Document new post-import plugin preprocessing stage to amend settings Jan 28, 2025
@fire
Copy link
Member Author

fire commented Jan 30, 2025

@tetrapod00 tetrapod00 added enhancement area:manual Issues and PRs related to the Manual/Tutorials section of the documentation topic:import labels Feb 3, 2025
@SamDevelopsCode
Copy link

We can do it by writing a custom .import file, or we can do it with a plugin.

We don't need to use a plugin? This can be achieved with just a custom import script? By this, I specifically mean changing the subresources, like changing the bonemap

@fire
Copy link
Member Author

fire commented Feb 7, 2025

A custom import script is too late. You'll need to recode the bone map algorithm in gdscript.. which we've done in godot-vrm.

Edited:

The preprocessing stage is to modify the input parameters to the importer.

Changing the bone map is straightforward. The algorithm to turn the existing bones to the Humanoid Profile is what is wanted without reimplementing it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:manual Issues and PRs related to the Manual/Tutorials section of the documentation enhancement topic:import
Projects
None yet
Development

No branches or pull requests

4 participants