Check out our latest project ✨ OpenChapter.io: free ebooks the way its meant to be 📖

Godot - DTag

An asset by Daylily
The page banner background of a mountain and forest
Godot - DTag thumbnail image
Godot - DTag thumbnail image
Godot - DTag thumbnail image
Godot - DTag hero image

Quick Information

0 ratings
Godot - DTag icon image
Daylily
Godot - DTag

DTag, a tool for creating tag like "GameplayTag" in Unreal Engine.DTag,为 Godot 提供一个类似 Unreal Engine 中 GameplayTag 的 Tag 机制。

Supported Engine Version
4.5
Version String
0.0.1
License Version
MIT
Support Level
community
Modified Date
1 day ago
Git URL
Issue URL

Godot - DTag

点击此处查看中文自述文件。

README

DTag, a tool for creating tag like "GameplayTag" in Unreal Engine.

The essence of DTag is StringName, this plugin provide tool to generate structured constant Dictionary, and provide editor inspector plugin to select tag and tag domain.

Install:

This plugin is fully implemented by GDScript. You can plugin it in your project like general plugin and enabled "Godot - DTag" in project setting.

How to use (Basic):

README

Step1: Define your tags.

Exclude "res://addons/", including internal class in GDScript, any type which extends from DTagDefinition will be scanned.

For example:

# res://dtag_example.gd
extends DTagDefinition

const MainDomain1 = {
    Domain1 = {
        Tag1 = "Example tag1", # Case 1:Use String/StringName as value will be recognized as comment in generated script.
        Tag2 = null, # Case 2:Use "null" as value will be recognized as tag, too.
    },
    Tag3 = "", # Case 3:Empty string as value will be recognized as tag, too.
}

class InternalClass extends DTagDefinition:
    const MainDomain2 = {
        Domain2 = {
            Tag1 = "Example tag",
            Tag2 = "Example tag",
        }
    }
...

Step2: Generate tag def.

Generate "res://dtag_def.gen.gd" by using tool "Project->Tool->Generate dtag_def.gen.gd".

Here is the generated file of step1.

# res://dtag_def.gen.gd
# NOTE: This file is generated, any modify maybe discard.
class_name DTagDef


const MainDomain1 = {
    Domain1 = {
        ## Example tag1
        Tag1 = &"MainDomain1.Domain1.Tag1",
        Tag2 = &"MainDomain1.Domain1.Tag2",
    },
    Tag3 = &"MainDomain1.Tag3",
}

Step3: Just use it.

Now you can use tags through DTagDef.


func example() -> void:
    var example_tag1 := DTagDef.MainDomain1.Domain1.Tag1
    print(example_tag1) # Output &"MainDomain1.Domain1.Tag1"

How to use (Advance):

This plugin provide an EditorInspectorPlugin to edit tag/tag domain through inspector by using a special selector.

1. Use resource DTag

README

DTag has properties value/tag(alias of "value" for inspector) and domain.

2. Custom property with specific hint_string:

README

  • DTagEdit: A hint string to recognize a StringName/String property as tag.

    • Basically work with StringName/String property:

      # This can select any tag in inspector.
      @export_custom(PROPERTY_HINT_NONE, "DTagEdit") var tag1: StringName
      
    • You can specific tag's domain, for example, Use "DTagEdit: MainDomain1.Domain1", you can limit choices in the domain "MainDomain1.Domain1".

      # This will limit domain in "MainDomain1.Domain1":
      @export_custom(PROPERTY_HINT_NONE, "DTagEdit: MainDomain1.Domain1") var tag2: StringName
      
    • It can work with Array[StringName]/Array[String] property:

      # This will recognize each element as tag in inspector.
      @export_custom(PROPERTY_HINT_TYPE_STRING, "%s:DTagEditor" % TYPE_STRING_NAME) var tag_list: Array[StringName]
      
  • DTagDomainEdit: A hint string to recognize a Array/Array[StringName]/Array[String]/PackedStringName property as tag domain.

    • Basically work with Array/Array[StringName]/Array[String]/PackedStringName property:

      # This can select any domain in inspector.
      @export_custom(PROPERTY_HINT_NONE, "DTagDomainEdit") var tag_domain: Array[StringName]
      
    • It can work with Array[Array]/Array[PackedStringArray] property:

      # This will recognize each element as tag domain in inspector.
      @export_custom(PROPERTY_HINT_TYPE_STRING, "%s:DTagDomainEditor" % TYPE_PACKED_STRING_ARRAY) var domain_list :Array[PackedStringArray]
      

DTag, a tool for creating tag like "GameplayTag" in Unreal Engine.


DTag,为 Godot 提供一个类似 Unreal Engine 中 GameplayTag 的 Tag 机制。

Reviews

0 ratings

Your Rating

Headline must be at least 3 characters but not more than 50
Review must be at least 5 characters but not more than 500
Please sign in to add a review

Quick Information

0 ratings
Godot - DTag icon image
Daylily
Godot - DTag

DTag, a tool for creating tag like "GameplayTag" in Unreal Engine.DTag,为 Godot 提供一个类似 Unreal Engine 中 GameplayTag 的 Tag 机制。

Supported Engine Version
4.5
Version String
0.0.1
License Version
MIT
Support Level
community
Modified Date
1 day ago
Git URL
Issue URL

Open Source

Released under the AGPLv3 license

Plug and Play

Browse assets directly from Godot

Community Driven

Created by developers for developers