0 votes

I can't figure out what the optional parameters given in this function do: http://docs.godotengine.org/en/latest/classes/class_editorimportplugin.html#class-editorimportplugin-get-import-options

The docs don't really explain any of them.
The only one that has any visible effect at all is the usage key, which completely removes the option from the menu when set to any string.

Namely, I'm trying to figure out how to give each property a tooltip for when the user hovers over them for more information (neither hint_string nor usage do this), as well as how to change the type of one property to become an image-flags selector, like the ones built into Godot, so the user can choose different flags as they need them.

Below is my current get_import_options just as an example, the commented-out portions are me changing values to try and find which does what.

func get_import_options(preset):
var options =  [
        {
            name = "post_script",
            default_value = "",
            #hint_string = "Post-Import Script",
            #usage = "A script to run and tweak the generated scene. Calls post_import(scene) on the script, post_import() has to return the changed scene. (optional)",
        },
        {
            name = "custom_properties",
            default_value = true,
            #hint_string = "Custom properties",
            #usage = "Whether to import custom properties as meta data.",
        },
        {
            name = "single_tileset",
            default_value = true,
            #hint_string = "Single TileSet",
            #usage = "Mix all Tiled TileSets into a single Godot resource. Needed if your layers uses more than one tileset each.",
        },
        {
            name = "embed",
            default_value = false,
            #hint_string = "Embed resources",
            #usage = "Save the resources (images, tilesets) embedded in the scene, as opposed to saving as external files.",
        },
        (etc..)
    ]

    return options
in Engine by (25 points)

1 Answer

0 votes

You have to use predefined constants for "type" "property_hint" and "usage"
See: https://docs.godotengine.org/de/stable/classes/class_%40globalscope.html#enum-globalscope-propertyhint

an example is

            {
                "name": "prop_name",
                "type": TYPE_STRING,
                "property_hint": PROPERTY_HINT_ENUM,
                "hint_string": "EnumVal1,EnumVal2,EnumVal3",
                "default_value": "Forward",
                "usage": PROPERTY_USAGE_EDITOR
            }

In my opinion the problem also arises from untyped (initial) nature of gdscript. Hope that this is getting better with C# and the corresponding doc.

by (25 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.