diff --git a/.gitattributes b/.gitattributes index 7d8c8bc0cd..9ab6efaa6a 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,2 +1,2 @@ -kt/godot-library/src/main/kotlin/godot/gen/godot/*.kt linguist-generated=true +kt/godot-api-library/src/main/kotlin/godot/gen/godot/*.kt linguist-generated=true harness/tests/.godot/**/* linguist-generated=true \ No newline at end of file diff --git a/.github/workflows/build_jvm.yml b/.github/workflows/build_jvm.yml index d3cb79bf1d..acb9e0d076 100644 --- a/.github/workflows/build_jvm.yml +++ b/.github/workflows/build_jvm.yml @@ -53,7 +53,7 @@ jobs: uses: actions/upload-artifact@v4 with: name: jvm_godot-bootstrap_release - path: modules/kotlin_jvm/kt/godot-library/build/libs/godot-bootstrap.jar + path: modules/kotlin_jvm/kt/godot-library/godot-api-library/build/libs/godot-bootstrap.jar - name: Upload entry-generator artifact uses: actions/upload-artifact@v4 @@ -99,7 +99,7 @@ jobs: uses: actions/upload-artifact@v4 with: name: jvm_godot-bootstrap_debug - path: modules/kotlin_jvm/kt/godot-library/build/libs/godot-bootstrap.jar + path: modules/kotlin_jvm/kt/godot-library/godot-api-library/build/libs/godot-bootstrap.jar - name: Verify ide plugin run: | diff --git a/.github/workflows/deploy_jvm.yml b/.github/workflows/deploy_jvm.yml index e577bb28fe..033e067441 100644 --- a/.github/workflows/deploy_jvm.yml +++ b/.github/workflows/deploy_jvm.yml @@ -67,15 +67,25 @@ jobs: run: | modules/kotlin_jvm/kt/gradlew -p modules/kotlin_jvm/kt/ :godot-kotlin-symbol-processor:publish - - name: Publish godot-library debug + - name: Publish godot-core-library debug shell: sh run: | - modules/kotlin_jvm/kt/gradlew -p modules/kotlin_jvm/kt/ :godot-library:publish -Pdebug + modules/kotlin_jvm/kt/gradlew -p modules/kotlin_jvm/kt/ :godot-core-library:publish -Pdebug - - name: Publish godot-library release + - name: Publish godot-core-library release shell: sh run: | - modules/kotlin_jvm/kt/gradlew -p modules/kotlin_jvm/kt/ :godot-library:publish -Prelease + modules/kotlin_jvm/kt/gradlew -p modules/kotlin_jvm/kt/ :godot-core-library:publish -Prelease + + - name: Publish godot-api-library debug + shell: sh + run: | + modules/kotlin_jvm/kt/gradlew -p modules/kotlin_jvm/kt/ :godot-api-library:publish -Pdebug + + - name: Publish godot-api-library release + shell: sh + run: | + modules/kotlin_jvm/kt/gradlew -p modules/kotlin_jvm/kt/ :godot-api-library:publish -Prelease - name: Publish godot-coroutine-library debug shell: sh diff --git a/harness/flattened-library-tests/settings.gradle.kts b/harness/flattened-library-tests/settings.gradle.kts index 3cf1c39be0..00d06bda84 100644 --- a/harness/flattened-library-tests/settings.gradle.kts +++ b/harness/flattened-library-tests/settings.gradle.kts @@ -8,7 +8,10 @@ includeBuild("../../kt/api-generator") { includeBuild("../../kt") { dependencySubstitution { substitute(module("com.utopia-rise:godot-gradle-plugin")).using(project(":godot-gradle-plugin")) - substitute(module("com.utopia-rise:godot-library")).using(project(":godot-library")) + substitute(module("com.utopia-rise:godot-core-library-release")).using(project(":godot-core-library")) + substitute(module("com.utopia-rise:godot-api-library-release")).using(project(":godot-api-library")) + substitute(module("com.utopia-rise:godot-core-library-debug")).using(project(":godot-core-library")) + substitute(module("com.utopia-rise:godot-api-library-debug")).using(project(":godot-api-library")) substitute(module("com.utopia-rise:godot-kotlin-symbol-processor")).using(project(":godot-kotlin-symbol-processor")) substitute(module("com.utopia-rise:godot-entry-generator")).using(project(":godot-entry-generator")) } diff --git a/harness/fqname-library-tests/settings.gradle.kts b/harness/fqname-library-tests/settings.gradle.kts index e97a5bf385..80c29d6570 100644 --- a/harness/fqname-library-tests/settings.gradle.kts +++ b/harness/fqname-library-tests/settings.gradle.kts @@ -8,7 +8,10 @@ includeBuild("../../kt/api-generator") { includeBuild("../../kt") { dependencySubstitution { substitute(module("com.utopia-rise:godot-gradle-plugin")).using(project(":godot-gradle-plugin")) - substitute(module("com.utopia-rise:godot-library")).using(project(":godot-library")) + substitute(module("com.utopia-rise:godot-core-library-release")).using(project(":godot-core-library")) + substitute(module("com.utopia-rise:godot-api-library-release")).using(project(":godot-api-library")) + substitute(module("com.utopia-rise:godot-core-library-debug")).using(project(":godot-core-library")) + substitute(module("com.utopia-rise:godot-api-library-debug")).using(project(":godot-api-library")) substitute(module("com.utopia-rise:godot-kotlin-symbol-processor")).using(project(":godot-kotlin-symbol-processor")) substitute(module("com.utopia-rise:godot-entry-generator")).using(project(":godot-entry-generator")) } diff --git a/harness/hierarchical-library-tests/settings.gradle.kts b/harness/hierarchical-library-tests/settings.gradle.kts index c40ca53fab..46de4cbbd3 100644 --- a/harness/hierarchical-library-tests/settings.gradle.kts +++ b/harness/hierarchical-library-tests/settings.gradle.kts @@ -8,7 +8,10 @@ includeBuild("../../kt/api-generator") { includeBuild("../../kt") { dependencySubstitution { substitute(module("com.utopia-rise:godot-gradle-plugin")).using(project(":godot-gradle-plugin")) - substitute(module("com.utopia-rise:godot-library")).using(project(":godot-library")) + substitute(module("com.utopia-rise:godot-core-library-release")).using(project(":godot-core-library")) + substitute(module("com.utopia-rise:godot-api-library-release")).using(project(":godot-api-library")) + substitute(module("com.utopia-rise:godot-core-library-debug")).using(project(":godot-core-library")) + substitute(module("com.utopia-rise:godot-api-library-debug")).using(project(":godot-api-library")) substitute(module("com.utopia-rise:godot-kotlin-symbol-processor")).using(project(":godot-kotlin-symbol-processor")) substitute(module("com.utopia-rise:godot-entry-generator")).using(project(":godot-entry-generator")) } diff --git a/harness/tests/scripts/godot/tests/Invocation.gdj b/harness/tests/scripts/godot/tests/Invocation.gdj index 1de7614948..514052f873 100644 --- a/harness/tests/scripts/godot/tests/Invocation.gdj +++ b/harness/tests/scripts/godot/tests/Invocation.gdj @@ -40,6 +40,7 @@ properties = [ nav_meshes_dictionary, nullable_dictionary, color, + rid, packed_byte_array, packed_int32_array, packed_float64_array, diff --git a/harness/tests/scripts/godot/tests/JavaTestClass.gdj b/harness/tests/scripts/godot/tests/JavaTestClass.gdj index 2ac65467a3..8f5e99a539 100644 --- a/harness/tests/scripts/godot/tests/JavaTestClass.gdj +++ b/harness/tests/scripts/godot/tests/JavaTestClass.gdj @@ -30,7 +30,8 @@ properties = [ dictionary ] functions = [ - greeting, + _ready, + greeting, connect_and_trigger_signal, signal_callback ] \ No newline at end of file diff --git a/harness/tests/settings.gradle.kts b/harness/tests/settings.gradle.kts index d9412335c9..388b7f074c 100644 --- a/harness/tests/settings.gradle.kts +++ b/harness/tests/settings.gradle.kts @@ -8,8 +8,10 @@ includeBuild("../../kt/api-generator") { includeBuild("../../kt") { dependencySubstitution { substitute(module("com.utopia-rise:godot-gradle-plugin")).using(project(":godot-gradle-plugin")) - substitute(module("com.utopia-rise:godot-library-debug")).using(project(":godot-library")) - substitute(module("com.utopia-rise:godot-library-release")).using(project(":godot-library")) + substitute(module("com.utopia-rise:godot-core-library-release")).using(project(":godot-core-library")) + substitute(module("com.utopia-rise:godot-api-library-release")).using(project(":godot-api-library")) + substitute(module("com.utopia-rise:godot-core-library-debug")).using(project(":godot-core-library")) + substitute(module("com.utopia-rise:godot-api-library-debug")).using(project(":godot-api-library")) substitute(module("com.utopia-rise:godot-coroutine-library-debug")).using(project(":godot-coroutine-library")) substitute(module("com.utopia-rise:godot-coroutine-library-release")).using(project(":godot-coroutine-library")) substitute(module("com.utopia-rise:godot-kotlin-symbol-processor")).using(project(":godot-kotlin-symbol-processor")) diff --git a/harness/tests/src/main/kotlin/godot/tests/FuncRefTest.kt b/harness/tests/src/main/kotlin/godot/tests/FuncRefTest.kt index 9cd92c7d4d..a0d9d0157b 100644 --- a/harness/tests/src/main/kotlin/godot/tests/FuncRefTest.kt +++ b/harness/tests/src/main/kotlin/godot/tests/FuncRefTest.kt @@ -7,8 +7,8 @@ import godot.annotation.RegisterProperty import godot.annotation.RegisterSignal import godot.annotation.Rpc import godot.core.signal0 -import godot.extensions.call -import godot.extensions.callDeferred +import godot.extension.call +import godot.extension.callDeferred @RegisterClass class FuncRefTest : Node() { diff --git a/harness/tests/src/main/kotlin/godot/tests/GodotStaticTest.kt b/harness/tests/src/main/kotlin/godot/tests/GodotStaticTest.kt index 2888c1566a..ad16b6e03d 100644 --- a/harness/tests/src/main/kotlin/godot/tests/GodotStaticTest.kt +++ b/harness/tests/src/main/kotlin/godot/tests/GodotStaticTest.kt @@ -3,7 +3,7 @@ package godot.tests import godot.Node import godot.PackedScene import godot.ResourceLoader -import godot.extensions.asStatic +import godot.extension.asStatic object GodotStaticDelegateTest { diff --git a/harness/tests/src/main/kotlin/godot/tests/Invocation.kt b/harness/tests/src/main/kotlin/godot/tests/Invocation.kt index 0296a49104..ed1eef6213 100644 --- a/harness/tests/src/main/kotlin/godot/tests/Invocation.kt +++ b/harness/tests/src/main/kotlin/godot/tests/Invocation.kt @@ -19,6 +19,7 @@ import godot.annotation.IntRange import godot.annotation.LongRange import godot.annotation.MultilineText import godot.annotation.PlaceHolderText +import godot.annotation.Range import godot.annotation.RegisterClass import godot.annotation.RegisterFunction import godot.annotation.RegisterProperty @@ -38,8 +39,7 @@ import godot.core.Vector2 import godot.core.Vector3 import godot.core.dictionaryOf import godot.core.variantArrayOf -import godot.extensions.getNodeAs -import godot.registration.Range +import godot.extension.getNodeAs import godot.tests.subpackage.OtherScript import godot.util.RealT import org.joda.time.DateTime diff --git a/kt/api-generator/src/main/kotlin/godot/codegen/extensions/TypedExtensions.kt b/kt/api-generator/src/main/kotlin/godot/codegen/extensions/TypedExtensions.kt index 643e6356e9..47c34e476c 100644 --- a/kt/api-generator/src/main/kotlin/godot/codegen/extensions/TypedExtensions.kt +++ b/kt/api-generator/src/main/kotlin/godot/codegen/extensions/TypedExtensions.kt @@ -41,7 +41,7 @@ import godot.tools.common.constants.VARIANT_PARSER_PACKED_VECTOR2_ARRAY import godot.tools.common.constants.VARIANT_PARSER_PACKED_VECTOR3_ARRAY import godot.tools.common.constants.VARIANT_PARSER_STRING_NAME import godot.tools.common.constants.VARIANT_PARSER__RID -import godot.tools.common.constants.godotApiPackage +import godot.tools.common.constants.godotPackage import godot.tools.common.constants.godotCorePackage import godot.tools.common.constants.variantParserPackage import java.util.* @@ -124,7 +124,7 @@ fun TypedTrait.getTypeClassName(): ClassTypeNameWrapper { type == GodotTypes.variant -> ClassTypeNameWrapper(ANY) type == GodotTypes.callable -> ClassTypeNameWrapper(GODOT_CALLABLE_BASE) isCoreType() -> ClassTypeNameWrapper(ClassName(godotCorePackage, type!!)) - else -> ClassTypeNameWrapper(ClassName(godotApiPackage, type!!)) + else -> ClassTypeNameWrapper(ClassName(godotPackage, type!!)) } if (this is NullableTrait) { diff --git a/kt/api-generator/src/main/kotlin/godot/codegen/generationEntry.kt b/kt/api-generator/src/main/kotlin/godot/codegen/generationEntry.kt index 154237ae7f..e82ec8d4ca 100644 --- a/kt/api-generator/src/main/kotlin/godot/codegen/generationEntry.kt +++ b/kt/api-generator/src/main/kotlin/godot/codegen/generationEntry.kt @@ -2,10 +2,8 @@ package godot.codegen import com.fasterxml.jackson.core.type.TypeReference import com.fasterxml.jackson.databind.ObjectMapper -import com.squareup.kotlinpoet.FileSpec import godot.codegen.models.ApiDescription import godot.codegen.models.enriched.toEnriched -import godot.codegen.poet.RegistrationFileSpec import godot.codegen.repositories.ClassRepository import godot.codegen.repositories.CoreTypeEnumRepository import godot.codegen.repositories.GlobalEnumRepository @@ -16,22 +14,18 @@ import godot.codegen.repositories.impl.JsonSingletonRepository import godot.codegen.repositories.impl.KnownCoreTypeEnumRepository import godot.codegen.repositories.impl.NativeStructureRepository import godot.codegen.services.IClassGraphService -import godot.codegen.services.IClassService -import godot.codegen.services.IEnumService -import godot.codegen.services.IGenerationService +import godot.codegen.services.IApiService +import godot.codegen.services.IApiGenerationService import godot.codegen.services.impl.AwaitGenerationService import godot.codegen.services.impl.ClassGraphService -import godot.codegen.services.impl.ClassService -import godot.codegen.services.impl.EnumService -import godot.codegen.services.impl.GenerationService +import godot.codegen.services.impl.ApiService +import godot.codegen.services.impl.ApiGenerationService import godot.codegen.services.impl.LambdaCallableGenerationService import godot.codegen.services.impl.SignalGenerationService import godot.tools.common.constants.Constraints -import godot.tools.common.constants.GENERATED_COMMENT -import godot.tools.common.constants.godotApiPackage import java.io.File -fun File.generateApiFrom(jsonSource: File) { +fun generateApiFrom(jsonSource: File, coreDir: File, apiDir: File) { val apiDescription = ObjectMapper().readValue(jsonSource, object : TypeReference() {}) val classRepository: ClassRepository = JsonClassRepository(apiDescription.classes.toEnriched()) @@ -41,65 +35,22 @@ fun File.generateApiFrom(jsonSource: File) { val nativeStructureRepository = NativeStructureRepository(apiDescription.nativeStructures.toEnriched()) val classGraphService: IClassGraphService = ClassGraphService(classRepository) - val classService: IClassService = ClassService( + val apiService: IApiService = ApiService( classRepository, singletonRepository, + globalEnumRepository, + coreTypeEnumRepository, classGraphService ) - val enumService: IEnumService = EnumService(globalEnumRepository, coreTypeEnumRepository, classService) - val generationService: IGenerationService = GenerationService(classGraphService, enumService, nativeStructureRepository) - classService.findGetSetMethodsAndUpdateProperties() + val generationService: IApiGenerationService = ApiGenerationService(classGraphService, apiService, nativeStructureRepository) + generationService.generateCore(coreDir) + generationService.generateApi(apiDir) - //TODO: generateEngineTypesRegistration - - val engineIndexFile = FileSpec.builder(godotApiPackage, "EngineIndexes") - val registrationFileSpec = RegistrationFileSpec() - - //We first generate singletons so that their index in engine types and engine singleton lists are same. - for (singleton in classService.getSingletons()) { - for (property in singleton.properties) { - classService.updatePropertyIfShouldUseSuper(singleton.name, property.name) - } - - generationService.generateSingleton(singleton).writeTo(this) - generationService.generateEngineIndexesForClass(engineIndexFile, singleton) - generationService.generateEngineTypesRegistrationForSingleton(registrationFileSpec, singleton) - } - - for (enrichedClass in classService.getClasses()) { - for (property in enrichedClass.properties) { - classService.updatePropertyIfShouldUseSuper(enrichedClass.name, property.name) - } - - generationService.generateClass(enrichedClass).writeTo(this) - generationService.generateEngineIndexesForClass(engineIndexFile, enrichedClass) - generationService.generateEngineTypesRegistrationForClass(registrationFileSpec, enrichedClass) - } - - engineIndexFile.build().writeTo(this) - registrationFileSpec.build().writeTo(this) - - for (enum in enumService.getGlobalEnums()) { - val enumAndExtensions = generationService.generateEnum(enum) - val fileBuilder = FileSpec.builder(godotApiPackage, enum.name) - for (typeSpec in enumAndExtensions.first) { - fileBuilder.addType(typeSpec) - } - for (extension in enumAndExtensions.second) { - fileBuilder.addFunction(extension) - } - - fileBuilder - .addFileComment(GENERATED_COMMENT) - .build() - .writeTo(this) - } - - LambdaCallableGenerationService().generate(Constraints.MAX_FUNCTION_ARG_COUNT).writeTo(this) - SignalGenerationService().generate(Constraints.MAX_FUNCTION_ARG_COUNT).writeTo(this) + LambdaCallableGenerationService().generate(coreDir, apiDir) + SignalGenerationService().generate(coreDir, apiDir) } -fun File.generateCoroutine() { - AwaitGenerationService.generate(Constraints.MAX_FUNCTION_ARG_COUNT).writeTo(this) +fun generateCoroutine(outputDir: File) { + AwaitGenerationService.generate(outputDir) } diff --git a/kt/api-generator/src/main/kotlin/godot/codegen/models/enriched/EnrichedClass.kt b/kt/api-generator/src/main/kotlin/godot/codegen/models/enriched/EnrichedClass.kt index 58bf664a73..0d12ecd95e 100644 --- a/kt/api-generator/src/main/kotlin/godot/codegen/models/enriched/EnrichedClass.kt +++ b/kt/api-generator/src/main/kotlin/godot/codegen/models/enriched/EnrichedClass.kt @@ -13,7 +13,7 @@ class EnrichedClass(val internal: Class) : TypedTrait, IDocumented { val signals = internal.signals?.toEnriched() ?: listOf() val name = internal.name.escapeUnderscore() val inherits = internal.inherits?.escapeUnderscore() - val engineClassDBIndexName = "ENGINECLASS_${internal.name.uppercase(Locale.US)}" + val engineClassDBIndexName = "ENGINE_CLASS_${internal.name.uppercase(Locale.US)}_INDEX" val properties= internal.properties?.toEnriched() ?: listOf() val methods = internal.methods?.toEnriched(engineClassDBIndexName) ?: listOf() val apiType = ApiType.from(internal.apiType) diff --git a/kt/api-generator/src/main/kotlin/godot/codegen/poet/RegistrationFileSpec.kt b/kt/api-generator/src/main/kotlin/godot/codegen/poet/RegistrationFileSpec.kt index 6285f33844..39dcc7ab91 100644 --- a/kt/api-generator/src/main/kotlin/godot/codegen/poet/RegistrationFileSpec.kt +++ b/kt/api-generator/src/main/kotlin/godot/codegen/poet/RegistrationFileSpec.kt @@ -3,10 +3,10 @@ package godot.codegen.poet import com.squareup.kotlinpoet.FileSpec import com.squareup.kotlinpoet.FunSpec import godot.tools.common.constants.GENERATED_COMMENT -import godot.tools.common.constants.godotApiPackage +import godot.tools.common.constants.godotPackage class RegistrationFileSpec { - val registrationFile = FileSpec.builder(godotApiPackage, "RegisterEngineTypes") + val registrationFile = FileSpec.builder(godotPackage, "RegisterEngineTypes") val registerVariantMappingFunBuilder = FunSpec.builder("registerVariantMapping") val registerMethodsFunBuilder = FunSpec.builder("registerEngineTypeMethods") val registerTypesFunBuilder = FunSpec.builder("registerEngineTypes") diff --git a/kt/api-generator/src/main/kotlin/godot/codegen/services/IApiGenerationService.kt b/kt/api-generator/src/main/kotlin/godot/codegen/services/IApiGenerationService.kt new file mode 100644 index 0000000000..48fc1ae45b --- /dev/null +++ b/kt/api-generator/src/main/kotlin/godot/codegen/services/IApiGenerationService.kt @@ -0,0 +1,28 @@ +package godot.codegen.services + +import com.squareup.kotlinpoet.FileSpec +import com.squareup.kotlinpoet.FunSpec +import com.squareup.kotlinpoet.PropertySpec +import com.squareup.kotlinpoet.TypeSpec +import godot.codegen.models.enriched.* +import godot.codegen.poet.RegistrationFileSpec +import java.io.File + +interface IApiGenerationService { + fun generateSingleton(singletonClass: EnrichedClass): FileSpec + fun generateClass(clazz: EnrichedClass): FileSpec + fun generateEnum(enum: EnrichedEnum, containingClassName: String? = null): Pair, List> + fun generateConstant(constant: EnrichedConstant, containingClassName: String?): PropertySpec + + fun generateEngineTypesRegistrationForClass( + registrationFileSpec: RegistrationFileSpec, + clazz: EnrichedClass + ) + fun generateEngineTypesRegistrationForSingleton( + registrationFileSpec: RegistrationFileSpec, + singleton: EnrichedClass + ) + + fun generateCore(outputDir: File) + fun generateApi(outputDir: File) +} diff --git a/kt/api-generator/src/main/kotlin/godot/codegen/services/IApiService.kt b/kt/api-generator/src/main/kotlin/godot/codegen/services/IApiService.kt new file mode 100644 index 0000000000..8d196f49f9 --- /dev/null +++ b/kt/api-generator/src/main/kotlin/godot/codegen/services/IApiService.kt @@ -0,0 +1,17 @@ +package godot.codegen.services + +import godot.codegen.models.custom.DefaultEnumValue +import godot.codegen.models.enriched.EnrichedClass +import godot.codegen.models.enriched.EnrichedEnum +import godot.codegen.poet.ClassTypeNameWrapper + +interface IApiService { + fun getSingletons(): List + fun getClasses(): List + fun getGlobalEnums() : List + + + fun updatePropertyIfShouldUseSuper(className: String, propertyName: String) + fun findGetSetMethodsAndUpdateProperties() + fun findEnumValue(enumClassName: ClassTypeNameWrapper, enumValue: Long): DefaultEnumValue +} diff --git a/kt/api-generator/src/main/kotlin/godot/codegen/services/IAwaitGenerationService.kt b/kt/api-generator/src/main/kotlin/godot/codegen/services/IAwaitGenerationService.kt index cc8a242c09..94dc6648bb 100644 --- a/kt/api-generator/src/main/kotlin/godot/codegen/services/IAwaitGenerationService.kt +++ b/kt/api-generator/src/main/kotlin/godot/codegen/services/IAwaitGenerationService.kt @@ -1,7 +1,8 @@ package godot.codegen.services import com.squareup.kotlinpoet.FileSpec +import java.io.File interface IAwaitGenerationService { - fun generate(maxArgumentCount: Int): FileSpec + fun generate(output: File) } diff --git a/kt/api-generator/src/main/kotlin/godot/codegen/services/IClassService.kt b/kt/api-generator/src/main/kotlin/godot/codegen/services/IClassService.kt deleted file mode 100644 index fa53aa46aa..0000000000 --- a/kt/api-generator/src/main/kotlin/godot/codegen/services/IClassService.kt +++ /dev/null @@ -1,10 +0,0 @@ -package godot.codegen.services - -import godot.codegen.models.enriched.EnrichedClass - -interface IClassService { - fun getSingletons(): List - fun getClasses(): List - fun updatePropertyIfShouldUseSuper(className: String, propertyName: String) - fun findGetSetMethodsAndUpdateProperties() -} diff --git a/kt/api-generator/src/main/kotlin/godot/codegen/services/IEnumService.kt b/kt/api-generator/src/main/kotlin/godot/codegen/services/IEnumService.kt deleted file mode 100644 index 82520925a8..0000000000 --- a/kt/api-generator/src/main/kotlin/godot/codegen/services/IEnumService.kt +++ /dev/null @@ -1,10 +0,0 @@ -package godot.codegen.services - -import godot.codegen.models.custom.DefaultEnumValue -import godot.codegen.models.enriched.EnrichedEnum -import godot.codegen.poet.ClassTypeNameWrapper - -interface IEnumService { - fun getGlobalEnums() : List - fun findEnumValue(enumClassName: ClassTypeNameWrapper, enumValue: Long): DefaultEnumValue -} \ No newline at end of file diff --git a/kt/api-generator/src/main/kotlin/godot/codegen/services/IGenerationService.kt b/kt/api-generator/src/main/kotlin/godot/codegen/services/IGenerationService.kt deleted file mode 100644 index 4d23bb45d0..0000000000 --- a/kt/api-generator/src/main/kotlin/godot/codegen/services/IGenerationService.kt +++ /dev/null @@ -1,25 +0,0 @@ -package godot.codegen.services - -import com.squareup.kotlinpoet.FileSpec -import com.squareup.kotlinpoet.FunSpec -import com.squareup.kotlinpoet.PropertySpec -import com.squareup.kotlinpoet.TypeSpec -import godot.codegen.models.enriched.* -import godot.codegen.poet.RegistrationFileSpec - -interface IGenerationService { - fun generateSingleton(singletonClass: EnrichedClass): FileSpec - fun generateClass(clazz: EnrichedClass): FileSpec - fun generateEngineIndexesForClass(fileSpecBuilder: FileSpec.Builder, clazz: EnrichedClass) - fun generateEnum(enum: EnrichedEnum, containingClassName: String? = null): Pair, List> - fun generateConstant(constant: EnrichedConstant, containingClassName: String?): PropertySpec - - fun generateEngineTypesRegistrationForClass( - registrationFileSpec: RegistrationFileSpec, - clazz: EnrichedClass - ) - fun generateEngineTypesRegistrationForSingleton( - registrationFileSpec: RegistrationFileSpec, - singleton: EnrichedClass - ) -} diff --git a/kt/api-generator/src/main/kotlin/godot/codegen/services/ILambdaCallableGenerationService.kt b/kt/api-generator/src/main/kotlin/godot/codegen/services/ILambdaCallableGenerationService.kt index 9690a064f7..34b8d5192f 100644 --- a/kt/api-generator/src/main/kotlin/godot/codegen/services/ILambdaCallableGenerationService.kt +++ b/kt/api-generator/src/main/kotlin/godot/codegen/services/ILambdaCallableGenerationService.kt @@ -1,7 +1,8 @@ package godot.codegen.services import com.squareup.kotlinpoet.FileSpec +import java.io.File interface ILambdaCallableGenerationService { - fun generate(maxArgumentCount: Int): FileSpec + fun generate(coreDir: File, apiDir: File) } diff --git a/kt/api-generator/src/main/kotlin/godot/codegen/services/ISignalGenerationService.kt b/kt/api-generator/src/main/kotlin/godot/codegen/services/ISignalGenerationService.kt index a2bd1ca889..060290185e 100644 --- a/kt/api-generator/src/main/kotlin/godot/codegen/services/ISignalGenerationService.kt +++ b/kt/api-generator/src/main/kotlin/godot/codegen/services/ISignalGenerationService.kt @@ -1,7 +1,8 @@ package godot.codegen.services import com.squareup.kotlinpoet.FileSpec +import java.io.File interface ISignalGenerationService { - fun generate(maxArgumentCount: Int): FileSpec -} \ No newline at end of file + fun generate(coreDir: File, apiDir: File) +} diff --git a/kt/api-generator/src/main/kotlin/godot/codegen/services/impl/ApiGenerationService.kt b/kt/api-generator/src/main/kotlin/godot/codegen/services/impl/ApiGenerationService.kt new file mode 100644 index 0000000000..39c918259f --- /dev/null +++ b/kt/api-generator/src/main/kotlin/godot/codegen/services/impl/ApiGenerationService.kt @@ -0,0 +1,1110 @@ +package godot.codegen.services.impl + +import com.squareup.kotlinpoet.ANY +import com.squareup.kotlinpoet.AnnotationSpec +import com.squareup.kotlinpoet.ClassName +import com.squareup.kotlinpoet.CodeBlock +import com.squareup.kotlinpoet.FileSpec +import com.squareup.kotlinpoet.FunSpec +import com.squareup.kotlinpoet.INT +import com.squareup.kotlinpoet.KModifier +import com.squareup.kotlinpoet.LONG +import com.squareup.kotlinpoet.LambdaTypeName +import com.squareup.kotlinpoet.MemberName +import com.squareup.kotlinpoet.ParameterSpec +import com.squareup.kotlinpoet.ParameterizedTypeName.Companion.parameterizedBy +import com.squareup.kotlinpoet.PropertySpec +import com.squareup.kotlinpoet.TypeSpec +import com.squareup.kotlinpoet.TypeVariableName +import com.squareup.kotlinpoet.UNIT +import com.squareup.kotlinpoet.asClassName +import godot.codegen.constants.VOID_PTR +import godot.codegen.constants.jvmReservedMethods +import godot.codegen.extensions.applyJvmNameIfNecessary +import godot.codegen.extensions.getDefaultValueKotlinString +import godot.codegen.extensions.getTypeClassName +import godot.codegen.extensions.isBitField +import godot.codegen.extensions.isEnum +import godot.codegen.extensions.isLocalCopyCoreTypes +import godot.codegen.extensions.jvmVariantTypeValue +import godot.codegen.models.custom.AdditionalImport +import godot.codegen.models.enriched.EnrichedClass +import godot.codegen.models.enriched.EnrichedConstant +import godot.codegen.models.enriched.EnrichedEnum +import godot.codegen.models.enriched.EnrichedMethod +import godot.codegen.models.enriched.EnrichedProperty +import godot.codegen.models.enriched.EnrichedSignal +import godot.codegen.models.enriched.isSameSignature +import godot.codegen.poet.RegistrationFileSpec +import godot.codegen.repositories.INativeStructureRepository +import godot.codegen.rpc.RpcFunctionMode +import godot.codegen.services.IApiService +import godot.codegen.services.IClassGraphService +import godot.codegen.services.IApiGenerationService +import godot.codegen.traits.CallableTrait +import godot.codegen.traits.addKdoc +import godot.tools.common.constants.TO_GODOT_NAME_UTIL_FUNCTION +import godot.tools.common.constants.CORE_TYPE_HELPER +import godot.tools.common.constants.CORE_TYPE_LOCAL_COPY +import godot.tools.common.constants.GENERATED_COMMENT +import godot.tools.common.constants.GODOT_BASE_TYPE +import godot.tools.common.constants.GODOT_ERROR +import godot.tools.common.constants.GodotKotlinJvmTypes +import godot.tools.common.constants.GodotTypes +import godot.tools.common.constants.INTERNALS +import godot.tools.common.constants.KT_OBJECT +import godot.tools.common.constants.VARIANT_CASTER_ANY +import godot.tools.common.constants.VARIANT_PARSER_LONG +import godot.tools.common.constants.godotPackage +import godot.tools.common.constants.godotCorePackage +import java.io.File +import java.util.* + +private const val methodBindingsInnerClassName = "MethodBindings" + +class ApiGenerationService( + private val classGraphService: IClassGraphService, + private val apiService: IApiService, + private val nativeStructureRepository: INativeStructureRepository +) : IApiGenerationService { + private var nextEngineClassIndex = 0 + + override fun generateCore(outputDir: File) { + val apiClasses = apiService.getClasses().filter { + it.name == "Object" || it.name == "RefCounted" + } + + for (enrichedClass in apiClasses) { + for (property in enrichedClass.properties) { + apiService.updatePropertyIfShouldUseSuper(enrichedClass.name, property.name) + } + generateClass(enrichedClass).writeTo(outputDir) + } + + for (enum in apiService.getGlobalEnums()) { + val enumAndExtensions = generateEnum(enum) + val fileBuilder = FileSpec.builder(godotPackage, enum.name) + for (typeSpec in enumAndExtensions.first) { + fileBuilder.addType(typeSpec) + } + for (extension in enumAndExtensions.second) { + fileBuilder.addFunction(extension) + } + + fileBuilder + .addFileComment(GENERATED_COMMENT) + .build() + .writeTo(outputDir) + } + } + + override fun generateApi(outputDir: File) { + apiService.findGetSetMethodsAndUpdateProperties() + + //TODO: generateEngineTypesRegistration + + val registrationFileSpec = RegistrationFileSpec() + + //We first generate singletons so that their index in engine types and engine singleton lists are same. + for (singleton in apiService.getSingletons()) { + for (property in singleton.properties) { + apiService.updatePropertyIfShouldUseSuper(singleton.name, property.name) + } + + generateSingleton(singleton).writeTo(outputDir) + generateEngineTypesRegistrationForSingleton(registrationFileSpec, singleton) + } + + for (enrichedClass in apiService.getClasses()) { + for (property in enrichedClass.properties) { + apiService.updatePropertyIfShouldUseSuper(enrichedClass.name, property.name) + } + + if (enrichedClass.name != "Object" && enrichedClass.name != "RefCounted") { + generateClass(enrichedClass).writeTo(outputDir) + } + generateEngineTypesRegistrationForClass(registrationFileSpec, enrichedClass) + } + + registrationFileSpec.build().writeTo(outputDir) + } + + + override fun generateSingleton(singletonClass: EnrichedClass): FileSpec { + val fileBuilder = FileSpec.builder(godotPackage, singletonClass.name) + fileBuilder.generateEngineIndexesForClass(singletonClass) + + val singletonTypeName = singletonClass.getTypeClassName() + val baseClass = singletonClass.inherits ?: GodotKotlinJvmTypes.obj + val singletonBuilder = TypeSpec + .objectBuilder(singletonTypeName.className) + .superclass(ClassName(godotPackage, baseClass)) + .generateSingletonConstructor(singletonClass.engineClassDBIndexName) + + return generateCommonsForClass( + fileBuilder, + singletonBuilder, + singletonClass, + true, + singletonBuilder + ) + } + + override fun generateClass(clazz: EnrichedClass): FileSpec { + val fileBuilder = FileSpec.builder(godotPackage, clazz.name) + fileBuilder.generateEngineIndexesForClass(clazz) + + val className = clazz.getTypeClassName() + + val classTypeBuilder = TypeSpec + .classBuilder(className.className) + .addModifiers(KModifier.OPEN) + + if (!clazz.internal.isInstantiable) { + classTypeBuilder.primaryConstructor( + FunSpec.constructorBuilder() + .addModifiers(KModifier.INTERNAL) + .build() + ) + } + + val baseClass = clazz.inherits + if (!baseClass.isNullOrEmpty()) { + classTypeBuilder.superclass(ClassName(godotPackage, baseClass)) + } + + classTypeBuilder.generateClassConstructor(clazz.engineClassDBIndexName) + + return generateCommonsForClass(fileBuilder, classTypeBuilder, clazz, false) + } + + private fun generateCommonsForClass( + fileBuilder: FileSpec.Builder, + classTypeBuilder: TypeSpec.Builder, + enrichedClass: EnrichedClass, + isSingleton: Boolean, + constantsTypeReceiver: TypeSpec.Builder = TypeSpec.companionObjectBuilder() + ): FileSpec { + + classTypeBuilder + .addKdoc(enrichedClass) + .addAnnotation(GODOT_BASE_TYPE) + + val name = enrichedClass.name + if (name == GodotKotlinJvmTypes.obj) { + classTypeBuilder.superclass(KT_OBJECT) + } + if (name == GodotKotlinJvmTypes.refCounted) { + classTypeBuilder.preventOnDestroyUsage() + } + if (name == GodotTypes.node) { + classTypeBuilder.generateTypesafeRpc() + } + + val enumExtensions = mutableListOf() + + for (enum in enrichedClass.enums) { + val enumAndExtensions = generateEnum(enum, name) + enumExtensions.addAll(enumAndExtensions.second) + for (typeSpec in enumAndExtensions.first) { + classTypeBuilder.addType(typeSpec) + } + } + + for (constant in enrichedClass.constants) { + constantsTypeReceiver.addProperty(generateConstant(constant, name)) + } + + for (method in enrichedClass.methods.filter { it.internal.isStatic }) { + constantsTypeReceiver.addFunction(generateMethod(enrichedClass, method, true, isSingleton)) + } + + if (constantsTypeReceiver != classTypeBuilder) { + constantsTypeReceiver.build().let { classTypeBuilder.addType(it) } + } + + for (signal in enrichedClass.signals) { + classTypeBuilder.addProperty(generateSignals(signal, isSingleton)) + } + + for (property in enrichedClass.properties) { + val propertySpec = generateProperty(enrichedClass, property, isSingleton) ?: continue + classTypeBuilder.addProperty(propertySpec) + if (property.hasValidSetterInClass && property.isLocalCopyCoreTypes()) { + classTypeBuilder.addFunction(generateCoreTypeHelper(enrichedClass, property, isSingleton)) + } + } + + for (method in enrichedClass.methods.filter { !it.internal.isStatic }) { + // TODO: Implement native structure when value class are here. + var shouldGenerate = true + for (argument in method.arguments) { + if (nativeStructureRepository.findMatchingType(argument) != null) { + shouldGenerate = false + break + } + } + shouldGenerate = shouldGenerate && nativeStructureRepository.findMatchingType(method) == null + if (shouldGenerate) { + classTypeBuilder.addFunction(generateMethod(enrichedClass, method, false, isSingleton)) + } + } + + val methodBindPtrReceiver = TypeSpec + .objectBuilder(methodBindingsInnerClassName) + + for (method in enrichedClass.methods.filter { !it.internal.isVirtual }) { + methodBindPtrReceiver.addProperty(generateMethodVoidPtr(enrichedClass, method)) + } + + val generatedClass = classTypeBuilder + .addType(methodBindPtrReceiver.build()) + .build() + + for (enumExtension in enumExtensions) { + fileBuilder.addFunction(enumExtension) + } + + for (import in enrichedClass.additionalImports) { + fileBuilder.addImport(import.pckge, import.name) + } + + return fileBuilder + .addType(generatedClass) + .generateSuppressWarnings() + .addFileComment(GENERATED_COMMENT) + .build() + } + + private fun FileSpec.Builder.generateEngineIndexesForClass(clazz: EnrichedClass) { + addProperty( + PropertySpec + .builder(clazz.engineClassDBIndexName, INT, KModifier.CONST) + .initializer("%L", nextEngineClassIndex) + .addModifiers(KModifier.PRIVATE) + .build() + ) + ++nextEngineClassIndex + } + + override fun generateEnum(enum: EnrichedEnum, containingClassName: String?): Pair, List> { + return if (enum.internal.isBitField) { + val packageName = if (enum.encapsulatingType == null) { + godotPackage + } else { + "$godotPackage.${enum.encapsulatingType.type}" + } + + val bitFieldInterfaceName = ClassName(packageName, enum.name) + + val bitFlagValueClassName = "${enum.name}Value" + + val bitFlagValueClass = TypeSpec.classBuilder(bitFlagValueClassName) + .addSuperinterface(bitFieldInterfaceName) + .addModifiers(KModifier.VALUE) + .addAnnotation(JvmInline::class) + .addProperty( + PropertySpec.builder(BIT_FLAG_VALUE_MEMBER, LONG) + .addModifiers(KModifier.OVERRIDE) + .initializer(BIT_FLAG_VALUE_MEMBER) + .build() + ) + .primaryConstructor( + FunSpec.constructorBuilder() + .addParameter( + ParameterSpec + .builder(BIT_FLAG_VALUE_MEMBER, LONG) + .build() + ) + .build() + ) + .build() + val bitfieldInterface = TypeSpec.interfaceBuilder(enum.name) + .addModifiers(KModifier.SEALED) + .addProperty( + PropertySpec.builder(BIT_FLAG_VALUE_MEMBER, LONG) + .build() + ) + + val logicalOperations = arrayOf("or", "xor", "and") + val extensionsOperator = generateBitFlagExtensionsOperators(logicalOperations, enum).toMutableList() + bitfieldInterface.generateOperatorMethods(logicalOperations, enum) + + val commonOperators = arrayOf("plus", "minus", "times", "div", "rem") + extensionsOperator.addAll(generateBitFlagExtensionsOperators(commonOperators, enum, true)) + bitfieldInterface.generateOperatorMethods(commonOperators, enum, true) + + val unaryOperations = arrayOf("unaryPlus", "unaryMinus", "inv") + + for (unaryOperation in unaryOperations) { + bitfieldInterface.addFunction( + FunSpec.builder(unaryOperation) + .returns(bitFieldInterfaceName) + .addCode(CodeBlock.of("return·%L(%L.%L())", bitFlagValueClassName, BIT_FLAG_VALUE_MEMBER, unaryOperation)) + .build() + ) + } + + val shiftOperations = arrayOf("shl", "shr", "ushr") + val shiftOperationsParameterName = "bits" + + for (shiftOperation in shiftOperations) { + bitfieldInterface.addFunction( + FunSpec.builder(shiftOperation) + .addModifiers(KModifier.INFIX) + .addParameter(shiftOperationsParameterName, INT) + .returns(bitFieldInterfaceName) + .addCode( + CodeBlock.of( + "return·%L(%L·%L·%L)", + bitFlagValueClassName, BIT_FLAG_VALUE_MEMBER, shiftOperation, shiftOperationsParameterName + ) + ) + .build() + ) + } + + val bitfieldInterfaceCompanion = TypeSpec.companionObjectBuilder() + + for (value in enum.internal.values) { + val bitFieldValueClassName = ClassName(packageName, bitFlagValueClassName) + bitfieldInterfaceCompanion + .addProperty( + PropertySpec.builder(value.name, bitFieldInterfaceName) + .initializer(CodeBlock.of("%T(%L)", bitFieldValueClassName, value.value)) + .build() + ) + } + + bitfieldInterface.addType(bitfieldInterfaceCompanion.build()) + + listOf(bitfieldInterface.build(), bitFlagValueClass) to extensionsOperator + } else { + val enumBuilder = TypeSpec.enumBuilder(enum.name) + enumBuilder.primaryConstructor( + FunSpec.constructorBuilder() + .addParameter("id", Long::class) + .addStatement("this.%N = %N", "id", "id") + .build() + ) + enumBuilder.addProperty("id", Long::class) + + for (value in enum.internal.values) { + val valueName = value.name + enumBuilder.addEnumConstant( + valueName, + TypeSpec.anonymousClassBuilder() + .addSuperclassConstructorParameter("%L", value.value) + .also { + it.addKdoc(value) + } + .build() + ) + } + + val companion = TypeSpec.companionObjectBuilder() + .addFunction( + FunSpec.builder("from") + .returns(ClassName("${godotPackage}.${containingClassName ?: ""}", enum.name)) + .addParameter("value", Long::class) + .addStatement("return·entries.single·{·it.%N·==·%N·}", "id", "value") + .build() + ) + .build() + enumBuilder.addType(companion) + listOf(enumBuilder.build()) to listOf() + } + } + + override fun generateConstant(constant: EnrichedConstant, containingClassName: String?): PropertySpec { + val constantName = constant.internal.name + return PropertySpec + .builder(constantName, constant.getTypeClassName().typeName) + .addModifiers(KModifier.CONST, KModifier.FINAL) + .initializer("%L", constant.internal.value) + .also { + it.addKdoc(constant) + } + .build() + } + + override fun generateEngineTypesRegistrationForClass( + registrationFileSpec: RegistrationFileSpec, + clazz: EnrichedClass + ) { + generateCommonRegistrationForClass( + registrationFileSpec, + clazz + ) { addRegisterEngineType(it, false) } + } + + override fun generateEngineTypesRegistrationForSingleton( + registrationFileSpec: RegistrationFileSpec, + singleton: EnrichedClass + ) { + generateCommonRegistrationForClass( + registrationFileSpec, + singleton + ) { + addRegisterEngineType(it, true) + addRegisterSingleton(it) + } + } + + private fun generateSignals(signal: EnrichedSignal, isSingleton: Boolean): PropertySpec { + val signalClass = signal.getTypeClassName() + val arguments = signal.arguments + + val builder = PropertySpec + .builder( + signal.name, + signalClass.typeName + ) + .addKdoc(signal) + .delegate( + "%T", + ClassName(godotCorePackage, "Signal" + arguments.size) + ) + + if (isSingleton) { + builder.addAnnotation(JvmStatic::class) + } + + return builder.build() + } + + private fun generateProperty(enrichedClass: EnrichedClass, property: EnrichedProperty, isSingleton: Boolean): PropertySpec? { + if (!property.hasValidGetterInClass && !property.hasValidSetterInClass) return null + + // We can't trust the property alone because some of them don't have a getter so we have to check on the setter's first parameter as well. + val argumentIndex = if (property.isIndexed) 1 else 0 + val propertyTypeName = (property.getterMethod ?: property.setterMethod!!.arguments[argumentIndex]).getCastedType() + + val propertyType = propertyTypeName.typeName + val propertySpecBuilder = PropertySpec.builder(property.name, propertyType).addModifiers(KModifier.FINAL) + + if (isSingleton) { + propertySpecBuilder.addAnnotation(JvmStatic::class) + } + + if (property.hasValidGetterInClass) { + val methodName = property.getter + + propertySpecBuilder.getter( + FunSpec.getterBuilder() + .addStatement( + if (property.isIndexed) { + val indexArgument = property.getterMethod!!.arguments[0] + if (indexArgument.isEnum() || indexArgument.isBitField()) { + val argumentValue = apiService.findEnumValue( + indexArgument.getBufferType(), + property.internal.index!!.toLong() + ).name + "return $methodName($argumentValue)" + } else { + "return $methodName(${property.internal.index})" + } + + } else { + "return $methodName()" + } + ) + .addAnnotation( + AnnotationSpec.builder(JvmName::class) + .addMember("\"${property.name}Property\"") + .build() + ) + .addModifiers(KModifier.INLINE) + .build() + ) + } else { + propertySpecBuilder.getter( + FunSpec.getterBuilder() + .addStatement( + "%L %T(%S)", + "throw", + UninitializedPropertyAccessException::class, + "Cannot access property ${property.name}: has no getter" + ) + .build() + ) + } + + val getterAndSetterAreCompatible = property.getterMethod?.getCastedType() == property.setterMethod?.arguments?.get(argumentIndex)?.getCastedType() + + // We don't generate the setter if its type doesn't match the getter. + if (property.hasValidSetterInClass && getterAndSetterAreCompatible) { + val methodName = property.setter + + propertySpecBuilder.mutable().setter( + FunSpec.setterBuilder() + .addParameter("value", property.getCastedType().typeName) + .addStatement( + if (property.isIndexed) { + val indexArgument = property.setterMethod!!.arguments[0] + if (indexArgument.isEnum() || indexArgument.isBitField()) { + val argumentValue = apiService.findEnumValue( + indexArgument.getBufferType(), + property.internal.index!!.toLong() + ).name + "$methodName($argumentValue, value)" + } else { + "$methodName(${property.internal.index}, value)" + } + + } else { + "$methodName(value)" + } + + ) + .addModifiers(KModifier.INLINE) + .addAnnotation( + AnnotationSpec.builder(JvmName::class) + .addMember("\"${property.name}Property\"") + .build() + ) + .build() + ) + } + + if (property.isLocalCopyCoreTypes()) { + propertySpecBuilder.addAnnotation(CORE_TYPE_LOCAL_COPY) + } + + propertySpecBuilder.addKdoc(property) + + return propertySpecBuilder.build() + } + + private fun generateCoreTypeHelper(enrichedClass: EnrichedClass, property: EnrichedProperty, isSingleton: Boolean): FunSpec { + val parameterTypeName = property.getCastedType() + val parameterName = property.name + val propertyFunSpec = FunSpec.builder("${parameterName}Mutate").addModifiers(KModifier.FINAL) + + if (isSingleton) { + propertyFunSpec.addAnnotation(JvmStatic::class) + } + + return propertyFunSpec + .addParameter( + ParameterSpec.builder( + "block", + LambdaTypeName.get( + receiver = parameterTypeName.typeName, + returnType = UNIT + ) + ).build() + ) + .addAnnotation(CORE_TYPE_HELPER) + .returns(parameterTypeName.typeName) + .addStatement( + """return $parameterName.apply{ + | block(this) + | $parameterName = this + |} + |""".trimMargin() + ).apply { + val kDoc = buildString { + val propertyKdoc = + property.sanitizedDocumentation + if (propertyKdoc != null) { + appendLine(propertyKdoc.replace("/*", "/*")) + appendLine() + } + + appendLine( + """This is a helper function to make dealing with local copies easier. + | + |For more information, see our [documentation](https://godot-kotl.in/en/stable/user-guide/api-differences/#core-types). + | + |Allow to directly modify the local copy of the property and assign it back to the Object. + | + |Prefer that over writing: + |`````` + |val myCoreType = ${enrichedClass.name.lowercase()}.${property.name} + |//Your changes + |${enrichedClass.name.lowercase()}.${property.name} = myCoreType + |`````` + |""".trimMargin() + ) + } + addKdoc(kDoc) + } + .build() + } + + private fun generateMethod(enrichedClass: EnrichedClass, method: EnrichedMethod, isStatic: Boolean, isSingleton: Boolean): FunSpec { + val modifiers = mutableListOf() + + // This method already exist in the Kotlin class Any. We have to override it because Godot uses the same name in Object. + if (method.name == "toString") { + modifiers.add(KModifier.OVERRIDE) + } + + // Godot doesn't override its methods, they are either final or meant to be implemented by script or extension. + if (method.internal.isVirtual) { + modifiers.add(KModifier.OPEN) + } else { + modifiers.add(KModifier.FINAL) + } + + val generatedFunBuilder = FunSpec + .builder(method.name) + .addModifiers(modifiers) + .applyJvmNameIfNecessary(method.name) + + val methodTypeName = method.getCastedType() + val shouldReturn = method.getTypeClassName().typeName != UNIT + + if (shouldReturn) { + generatedFunBuilder.returns(methodTypeName.typeName) + + if (method.isEnum()) { + val methodTypeSimpleName = methodTypeName.className.simpleName + if (methodTypeSimpleName.contains('.')) { + enrichedClass.additionalImports.add( + AdditionalImport( + methodTypeName.className.packageName, + methodTypeSimpleName.split('.')[0] + ) + ) + } + } + } + + //TODO: move adding arguments to generatedFunBuilder to separate function + val callArgumentsAsString = buildCallArgumentsString( + enrichedClass, + generatedFunBuilder, + method + ) //cannot be inlined as it also adds the arguments to the generatedFunBuilder + + if (method.internal.isVararg) { + generatedFunBuilder.addParameter( + "__var_args", + ANY.copy(nullable = true), + KModifier.VARARG + ) + } + + generatedFunBuilder.generateCodeBlock(enrichedClass, method, callArgumentsAsString, isStatic) + + generatedFunBuilder.addKdoc(method) + + for (jvmReservedMethod in jvmReservedMethods) { + if (method.isSameSignature(jvmReservedMethod) && !method.internal.isVirtual) { + generatedFunBuilder.addAnnotation( + AnnotationSpec.builder(JvmName::class) + .addMember( + CodeBlock.of( + "\"%L%L\"", + enrichedClass.name.replaceFirstChar { it.lowercase(Locale.US) }, + method.name.replaceFirstChar { if (it.isLowerCase()) it.titlecase(Locale.US) else it.toString() } + ) + ) + .build() + ) + + } + } + + if (isSingleton) { + generatedFunBuilder.addAnnotation(JvmStatic::class) + } + + return generatedFunBuilder.build() + } + + private fun generateMethodVoidPtr(enrichedClass: EnrichedClass, method: EnrichedMethod) = PropertySpec + .builder("${method.name}Ptr", VOID_PTR) + .addModifiers(KModifier.INTERNAL) + .initializer( + "%T.getMethodBindPtr(%S,·%S,·%L)", + INTERNALS, + enrichedClass.internal.name, + method.internal.name, + method.internal.hash + ) + .build() + + private fun TypeSpec.Builder.preventOnDestroyUsage() { + addFunction( + FunSpec.builder("_onDestroy") + .addModifiers(KModifier.OVERRIDE, KModifier.FINAL) + .returns(Unit::class) + .addStatement("") + .build() + ) + } + + private fun TypeSpec.Builder.generateTypesafeRpc() { + for (i in 0..10) { + val kFunctionTypeParameters = mutableListOf() + if (i != 0) { + for (argIndex in 0 until i) { + kFunctionTypeParameters.add(TypeVariableName.invoke("ARG$argIndex")) + } + } + + val kFunctionClassName = ClassName("kotlin.reflect", "KFunction$i") + .parameterizedBy(*kFunctionTypeParameters.toTypedArray(), TypeVariableName.invoke("*")) + + RpcFunctionMode.entries.forEach { rpcFunctionMode -> + val rpcFunSpec = FunSpec + .builder(rpcFunctionMode.functionName) + .returns(GODOT_ERROR) + .addModifiers(KModifier.INLINE) + + if (rpcFunctionMode.hasId) { + rpcFunSpec.addParameter("id", Long::class.asClassName()) + } + + rpcFunSpec.addParameter("function", TypeVariableName.invoke("FUNCTION")) + + var templateString = "return ${rpcFunctionMode.functionName}(" + + if (rpcFunctionMode.hasId) { + templateString += "id, " + } + + templateString += "function.name.%M()" + + kFunctionTypeParameters.forEachIndexed { index, typeVariableName -> + rpcFunSpec.addTypeVariable(typeVariableName) + val argParamName = "arg$index" + rpcFunSpec.addParameter(argParamName, typeVariableName) + templateString += ", $argParamName" + } + templateString += ")" + rpcFunSpec.addStatement(templateString, TO_GODOT_NAME_UTIL_FUNCTION) + + rpcFunSpec.addTypeVariable(TypeVariableName.invoke("FUNCTION", kFunctionClassName).copy(reified = true)) + addFunction(rpcFunSpec.build()) + } + } + } + + private fun TypeSpec.Builder.generateSingletonConstructor(classIndexName: String): TypeSpec.Builder { + addFunction( + FunSpec.builder("new") + .addModifiers(KModifier.OVERRIDE) + .addParameter("scriptIndex", Int::class) + .returns(Unit::class) + .addStatement( + "%T.getSingleton(this, %M)", + INTERNALS, + MemberName(godotPackage, classIndexName), + ) + .build() + ) + return this + } + + private fun TypeSpec.Builder.generateClassConstructor(classIndexName: String): TypeSpec.Builder { + addFunction( + FunSpec.builder("new") + .addModifiers(KModifier.OVERRIDE) + .addParameter("scriptIndex", Int::class) + .returns(Unit::class) + .addStatement( + "%T.callConstructor(this, %M, scriptIndex)", + INTERNALS, + MemberName(godotPackage, classIndexName), + ) + .build() + ) + return this + } + + private fun buildCallArgumentsString( + cl: EnrichedClass, + generatedFunBuilder: FunSpec.Builder, + method: EnrichedMethod + ): String { + return buildString { + method.arguments.withIndex().forEach { + val index = it.index + val argument = it.value + + val shouldAddComa = index != 0 + + if (shouldAddComa) append(",·") + + val sanitisedArgumentName = classGraphService.getSanitisedArgumentName(cl, method, index) + + append("%T·to·$sanitisedArgumentName${argument.getToBufferCastingMethod()}") + + if (argument.isEnum()) append(".id") + if (argument.isBitField()) append(".flag") + + val argumentTypeClassName = argument.getCastedType() + val parameterBuilder = ParameterSpec.builder( + sanitisedArgumentName, + argumentTypeClassName.typeName + ) + + val defaultValueKotlinCode = argument.getDefaultValueKotlinString() + val appliedDefault = if ((argument.isEnum() || argument.isBitField()) && defaultValueKotlinCode != null) { + apiService.findEnumValue( + argumentTypeClassName, + defaultValueKotlinCode.first.toLong() + ).name + } else { + defaultValueKotlinCode?.first + } + if (appliedDefault != null) { + parameterBuilder.defaultValue(appliedDefault, *defaultValueKotlinCode!!.second) + + // add @JvmOverloads annotation for java support if not already present + val jvmOverloadAnnotationSpec = AnnotationSpec.builder(JvmOverloads::class.asClassName()).build() + if (!generatedFunBuilder.annotations.contains(jvmOverloadAnnotationSpec)) { + generatedFunBuilder.addAnnotation(jvmOverloadAnnotationSpec) + } + } + + generatedFunBuilder.addParameter(parameterBuilder.build()) + } + if (method.internal.isVararg && isNotEmpty()) append(",·") + } + } + + private fun FunSpec.Builder.generateCodeBlock( + clazz: EnrichedClass, + enrichedMethod: EnrichedMethod, + callArgumentsAsString: String, + isStatic: Boolean + ) { + if (!enrichedMethod.internal.isVirtual) { + generateJvmMethodCall( + clazz, + callable = enrichedMethod, + callArgumentsAsString = callArgumentsAsString, + isStatic = isStatic + ) + } else if (enrichedMethod.getTypeClassName().typeName != UNIT) { + addStatement( + "%L·%T(%S)", + "throw", + NotImplementedError::class, + "${enrichedMethod.internal.name} is not implemented for ${clazz.internal.name}" + ) + } + } + + private fun FunSpec.Builder.generateJvmMethodCall( + clazz: EnrichedClass, + callable: T, + callArgumentsAsString: String, + isStatic: Boolean + ): FunSpec.Builder { + val ktVariantClassNames = callable.arguments.map { + it.jvmVariantTypeValue + }.toTypedArray() + + if (callable.isVararg) { + addStatement( + "%T.writeArguments($callArgumentsAsString·*__var_args.map·{·%T·to·it·}.toTypedArray())", + INTERNALS, + *ktVariantClassNames, + VARIANT_CASTER_ANY + ) + } else { + addStatement( + "%T.writeArguments($callArgumentsAsString)", + INTERNALS, + *ktVariantClassNames + ) + } + + val returnTypeVariantTypeClass = callable.jvmVariantTypeValue + + val rawPtr = if (isStatic) { + "0" //nullpointer + } else { + "rawPtr" + } + + addStatement( + "%T.callMethod($rawPtr, %T.%M, %T)", + INTERNALS, + clazz.getTypeClassName().className.nestedClass(methodBindingsInnerClassName), + MemberName("godot", callable.voidPtrVariableName), + returnTypeVariantTypeClass + ) + + val methodReturnType = callable.getBufferType() + + if (methodReturnType.typeName != UNIT) { + if (callable.isEnum()) { + addStatement( + "return·${methodReturnType.className.simpleNames.joinToString(".")}.from(%T.readReturnValue(%T)·as·%T)", + INTERNALS, + VARIANT_PARSER_LONG, + LONG + ) + } else if (callable.isBitField()) { + val simpleNames = methodReturnType.className.simpleNames + addStatement( + "return·%T(%T.readReturnValue(%T)·as·%T)", + ClassName( + "${methodReturnType.className.packageName}.${simpleNames.subList(0, simpleNames.size - 1).joinToString(".")}", + "${callable.getTypeClassName().className.simpleName}Value" + ), + INTERNALS, + VARIANT_PARSER_LONG, + LONG + ) + } else { + addStatement( + "return·(%T.readReturnValue(%T)·as·%T)${callable.getFromBufferCastingMethod()}", + INTERNALS, + returnTypeVariantTypeClass, + methodReturnType.typeName + ) + } + } + return this + } + + private fun FileSpec.Builder.generateSuppressWarnings(): FileSpec.Builder { + addAnnotation( + AnnotationSpec.builder(ClassName("kotlin", "Suppress")) + .addMember( + "\"PackageDirectoryMismatch\", \"unused\", \"FunctionName\", \"RedundantModalityModifier\", " + + "\"UNCHECKED_CAST\", \"JoinDeclarationAndAssignment\", \"USELESS_CAST\", \"RemoveRedundantQualifierName\", " + + "\"NOTHING_TO_INLINE\", \"NON_FINAL_MEMBER_IN_OBJECT\", \"RedundantVisibilityModifier\", " + + "\"RedundantUnitReturnType\", \"MemberVisibilityCanBePrivate\"" + ) + .build() + ) + return this + } + + private fun generateCommonRegistrationForClass( + registrationFileSpec: RegistrationFileSpec, + clazz: EnrichedClass, + registrationFunc: RegistrationFileSpec.(EnrichedClass) -> Unit + ) { + registrationFileSpec.registrationFunc(clazz) + + registrationFileSpec.registerMethodsFunBuilder.addStatement( + "%T", + clazz.getTypeClassName().className.nestedClass(methodBindingsInnerClassName) + ) + } + + private fun RegistrationFileSpec.addRegisterEngineType(clazz: EnrichedClass, isSingleton: Boolean) { + val formatString = if (isSingleton) { + "%T.registerEngineType(%S, %T::class) { %T }" + } else { + "%T.registerEngineType(%S, %T::class, ::%T)" + } + val typeName = clazz.getTypeClassName().typeName + registerTypesFunBuilder.addStatement( + formatString, + INTERNALS, + clazz.internal.name, + typeName, + typeName + ) + } + + private fun RegistrationFileSpec.addRegisterSingleton(clazz: EnrichedClass) { + registerTypesFunBuilder.addStatement( + "%T.registerSingleton(%S)", + INTERNALS, + clazz.name + ) + } + + private fun TypeSpec.Builder.generateOperatorMethods( + operations: Array, + enum: EnrichedEnum, + isOperator: Boolean = false + ) { + val packageName = if (enum.encapsulatingType == null) { + godotPackage + } else { + "$godotPackage.${enum.encapsulatingType.type}" + } + + val bitFieldInterfaceName = ClassName(packageName, enum.name) + + val bitFlagValueClassName = "${enum.name}Value" + + val operatorModifier = if (isOperator) KModifier.OPERATOR else KModifier.INFIX + + for (operation in operations) { + this.addFunction( + FunSpec.builder(operation) + .addModifiers(operatorModifier) + .addParameter( + ParameterSpec + .builder("other", bitFieldInterfaceName) + .build() + ) + .returns(bitFieldInterfaceName) + .addCode( + CodeBlock.of( + "return·%L(%L.%L(other.%L))", + bitFlagValueClassName, + BIT_FLAG_VALUE_MEMBER, + operation, + BIT_FLAG_VALUE_MEMBER + ) + ) + .build() + ) + this.addFunction( + FunSpec.builder(operation) + .addModifiers(operatorModifier) + .addParameter( + ParameterSpec + .builder("other", LONG) + .build() + ) + .returns(bitFieldInterfaceName) + .addCode( + CodeBlock.of("return·%L(%L.%L(other))", bitFlagValueClassName, BIT_FLAG_VALUE_MEMBER, operation) + ) + .build() + ) + } + } + + companion object { + private const val BIT_FLAG_VALUE_MEMBER = "flag" + + fun generateBitFlagExtensionsOperators( + bitOperations: Array, + enum: EnrichedEnum, + isOperator: Boolean = false + ): List { + val packageName = if (enum.encapsulatingType == null) { + godotPackage + } else { + "$godotPackage.${enum.encapsulatingType.type}" + } + + val bitFieldInterfaceName = ClassName(packageName, enum.name) + + val operatorModifier = if (isOperator) KModifier.OPERATOR else KModifier.INFIX + + return bitOperations + .map { + FunSpec.builder(it) + .addModifiers(operatorModifier) + .receiver(LONG) + .addParameter( + ParameterSpec + .builder("other", bitFieldInterfaceName) + .build() + ) + .returns(LONG) + .addCode( + CodeBlock.of("return·this.%L(other.%L)", it, BIT_FLAG_VALUE_MEMBER) + ).build() + } + } + } +} diff --git a/kt/api-generator/src/main/kotlin/godot/codegen/services/impl/ApiService.kt b/kt/api-generator/src/main/kotlin/godot/codegen/services/impl/ApiService.kt new file mode 100644 index 0000000000..fa25853e32 --- /dev/null +++ b/kt/api-generator/src/main/kotlin/godot/codegen/services/impl/ApiService.kt @@ -0,0 +1,172 @@ +package godot.codegen.services.impl + +import com.squareup.kotlinpoet.UNIT +import godot.codegen.exceptions.NoMatchingClassFoundException +import godot.codegen.exceptions.NoMatchingEnumFound +import godot.codegen.extensions.getTypeClassName +import godot.codegen.extensions.isBitField +import godot.codegen.extensions.isEnum +import godot.codegen.models.ApiType +import godot.codegen.models.Argument +import godot.codegen.models.Method +import godot.codegen.models.ReturnValue +import godot.codegen.models.custom.DefaultEnumValue +import godot.codegen.models.enriched.EnrichedEnum +import godot.codegen.models.enriched.EnrichedMethod +import godot.codegen.poet.ClassTypeNameWrapper +import godot.codegen.repositories.ClassRepository +import godot.codegen.repositories.CoreTypeEnumRepository +import godot.codegen.repositories.GlobalEnumRepository +import godot.codegen.repositories.SingletonRepository +import godot.codegen.services.IClassGraphService +import godot.codegen.services.IApiService +import godot.tools.common.constants.GodotTypes + +class ApiService( + private val classRepository: ClassRepository, + private val singletonRepository: SingletonRepository, + private val globalEnumRepository: GlobalEnumRepository, + private val coreTypeEnumRepository: CoreTypeEnumRepository, + private val classGraphService: IClassGraphService +) : IApiService{ + override fun getSingletons() = singletonRepository + .list() + .map { + classRepository.findByClassName(it.type)?.copy(it.name) ?: throw NoMatchingClassFoundException(it.type) + } + .filter { it.apiType == ApiType.CORE } + + override fun getClasses() = classRepository + .list() + .filter { + for (singleton in singletonRepository.list()) { + if (singleton.type == it.type || classGraphService.doClassInherits(it, singleton.type)) return@filter false + } + it.apiType == ApiType.CORE + } + + override fun getGlobalEnums() = globalEnumRepository.list() + + override fun updatePropertyIfShouldUseSuper(className: String, propertyName: String) { + fun inner(className: String, propertyName: String, isSetter: Boolean) { + val clazz = classRepository.findByClassName(className) ?: throw NoMatchingClassFoundException(className) + val property = clazz.properties.first { it.name == propertyName } + + val setter = property.internal.setter + + if (isSetter && setter == null) return + + val methodName = if (isSetter) setter!! else property.internal.getter + val returnType = if (isSetter) "" else property.type + val arguments = if (isSetter) { + listOf(Argument(property.name, property.type, null, null)) + } else { + listOf() + } + + val method = EnrichedMethod( + Method( + name = methodName, + isConst = false, + isVararg = false, + isVirtual = false, + isStatic = false, + hash = 0, + hashCompatibility = listOf(), + returnValue = ReturnValue(returnType, null), + returnType = null, + arguments = arguments, + description = null, + briefDescription = null + ), + clazz.engineClassDBIndexName + ) + + val parentClassAndMethod = classGraphService.getMethodFromAncestor(clazz, method) + val hasValidAccessor = if (isSetter) property.hasValidSetterInClass else property.hasValidGetterInClass + if (parentClassAndMethod != null && !hasValidAccessor) { + if (isSetter) { + property.setterMethod = parentClassAndMethod.second + } else { + property.getterMethod = parentClassAndMethod.second + } + } + } + + inner(className, propertyName, true) + inner(className, propertyName, false) + } + + override fun findGetSetMethodsAndUpdateProperties() { + for (enrichedClass in classRepository.list()) { + for (property in enrichedClass.properties) { + for (method in enrichedClass.methods) { + if (property.name == "") continue + + when (method.name) { + property.getter -> { + if (method.getTypeClassName().className == UNIT || method.arguments.size > 1 || method.internal.isVirtual) continue + + if (!property.isIndexed && method.arguments.size == 1) continue + + if (method.arguments.size == 1 && !method.arguments[0].isEnum() && method.arguments[0].type != GodotTypes.int) continue + + property.getterMethod = method + } + property.setter -> { + if (method.getTypeClassName().className != UNIT || method.arguments.size > 2 || method.internal.isVirtual) continue + + if (!property.isIndexed && method.arguments.size == 2) continue + + if (method.arguments.size == 2 && !method.arguments[0].isEnum() && method.arguments[0].type != GodotTypes.int) continue + + property.setterMethod = method + } + } + } + } + } + } + + override fun findEnumValue(enumClassName: ClassTypeNameWrapper, enumValue: Long): DefaultEnumValue { + val simpleNames = enumClassName.className.simpleNames + return if (simpleNames.size > 1) { + val className = simpleNames[0] + val enrichedEnum = if (GodotTypes.coreTypes.contains(className)) { + coreTypeEnumRepository.listForCoreType(className) + } else { + getClasses() + .plus(getSingletons()) + .first { it.name == className } + .enums + }?.firstOrNull { it.getTypeClassName() == enumClassName } ?: + throw NoMatchingEnumFound(simpleNames.joinToString(".")) + + val value = enrichedEnum + .internal + .values + .firstOrNull { it.value == enumValue } ?: + if (enrichedEnum.isBitField()) { + return DefaultEnumValue( + null, + "${enrichedEnum.name}Value($enumValue)", + enrichedEnum.encapsulatingType + ) + } + else { + throw NoMatchingEnumFound(simpleNames.joinToString(".")) + } + + DefaultEnumValue(enrichedEnum, value) + } else { + val enum = getGlobalEnums() + .first { it.name == simpleNames[0] } + val value = enum + .internal + .values + .first { it.value == enumValue } + + DefaultEnumValue(enum, value) + } + } +} diff --git a/kt/api-generator/src/main/kotlin/godot/codegen/services/impl/AwaitGenerationService.kt b/kt/api-generator/src/main/kotlin/godot/codegen/services/impl/AwaitGenerationService.kt index 59812956fc..bf72e196ef 100644 --- a/kt/api-generator/src/main/kotlin/godot/codegen/services/impl/AwaitGenerationService.kt +++ b/kt/api-generator/src/main/kotlin/godot/codegen/services/impl/AwaitGenerationService.kt @@ -13,27 +13,30 @@ import com.squareup.kotlinpoet.TypeSpec import com.squareup.kotlinpoet.TypeVariableName import com.squareup.kotlinpoet.UNIT import godot.codegen.services.IAwaitGenerationService +import godot.tools.common.constants.Constraints import godot.tools.common.constants.GODOT_OBJECT import godot.tools.common.constants.GodotKotlinJvmTypes.signal import godot.tools.common.constants.godotCorePackage import godot.tools.common.constants.godotCoroutinePackage +import godot.tools.common.constants.godotExtensionPackage import godot.tools.common.constants.kotlinCoroutinePackage import godot.tools.common.constants.kotlinxCoroutinePackage +import java.io.File private val cancellableContinuationClass = ClassName(kotlinxCoroutinePackage, "CancellableContinuation") private val suspendCancellableCoroutine = MemberName(kotlinxCoroutinePackage, "suspendCancellableCoroutine") -private val connect = MemberName(godotCorePackage, "connectThreadSafe") +private val connect = MemberName(godotExtensionPackage, "connectThreadSafe") private val resume = MemberName(kotlinCoroutinePackage, "resume") object AwaitGenerationService : IAwaitGenerationService { - override fun generate(maxArgumentCount: Int): FileSpec { + override fun generate(output: File) { val awaitFile = FileSpec.builder(godotCoroutinePackage, "Await") - val allParameters = Array(maxArgumentCount) { index -> + val allParameters = Array(Constraints.MAX_FUNCTION_ARG_COUNT) { index -> TypeVariableName("P$index") }.toList() - for (argCount in 0..maxArgumentCount) { + for (argCount in 0..Constraints.MAX_FUNCTION_ARG_COUNT) { val parameters = allParameters.take(argCount) val baseReceiver = ClassName(godotCorePackage, signal + argCount) @@ -92,7 +95,7 @@ object AwaitGenerationService : IAwaitGenerationService { ) } - return awaitFile + awaitFile .addAnnotation( AnnotationSpec.builder(Suppress::class) .addMember("\"PackageDirectoryMismatch\", \"unused\"") @@ -100,6 +103,7 @@ object AwaitGenerationService : IAwaitGenerationService { ) .indent(" ") .build() + .writeTo(output) } diff --git a/kt/api-generator/src/main/kotlin/godot/codegen/services/impl/ClassService.kt b/kt/api-generator/src/main/kotlin/godot/codegen/services/impl/ClassService.kt deleted file mode 100644 index 5a376f5022..0000000000 --- a/kt/api-generator/src/main/kotlin/godot/codegen/services/impl/ClassService.kt +++ /dev/null @@ -1,119 +0,0 @@ -package godot.codegen.services.impl - -import com.squareup.kotlinpoet.UNIT -import godot.codegen.exceptions.NoMatchingClassFoundException -import godot.codegen.extensions.getTypeClassName -import godot.codegen.extensions.isEnum -import godot.codegen.models.ApiType -import godot.codegen.models.Argument -import godot.codegen.models.Method -import godot.codegen.models.ReturnValue -import godot.codegen.models.enriched.EnrichedMethod -import godot.codegen.repositories.ClassRepository -import godot.codegen.repositories.SingletonRepository -import godot.codegen.services.IClassGraphService -import godot.codegen.services.IClassService -import godot.tools.common.constants.GodotTypes - -class ClassService( - private val classRepository: ClassRepository, - private val singletonRepository: SingletonRepository, - private val classGraphService: IClassGraphService -) : IClassService{ - override fun getSingletons() = singletonRepository - .list() - .map { - classRepository.findByClassName(it.type)?.copy(it.name) ?: throw NoMatchingClassFoundException(it.type) - } - .filter { it.apiType == ApiType.CORE } - - override fun getClasses() = classRepository - .list() - .filter { - for (singleton in singletonRepository.list()) { - if (singleton.type == it.type || classGraphService.doClassInherits(it, singleton.type)) return@filter false - } - it.apiType == ApiType.CORE - } - - override fun updatePropertyIfShouldUseSuper(className: String, propertyName: String) { - fun inner(className: String, propertyName: String, isSetter: Boolean) { - val clazz = classRepository.findByClassName(className) ?: throw NoMatchingClassFoundException(className) - val property = clazz.properties.first { it.name == propertyName } - - val setter = property.internal.setter - - if (isSetter && setter == null) return - - val methodName = if (isSetter) setter!! else property.internal.getter - val returnType = if (isSetter) "" else property.type - val arguments = if (isSetter) { - listOf(Argument(property.name, property.type, null, null)) - } else { - listOf() - } - - val method = EnrichedMethod( - Method( - name = methodName, - isConst = false, - isVararg = false, - isVirtual = false, - isStatic = false, - hash = 0, - hashCompatibility = listOf(), - returnValue = ReturnValue(returnType, null), - returnType = null, - arguments = arguments, - description = null, - briefDescription = null - ), - clazz.engineClassDBIndexName - ) - - val parentClassAndMethod = classGraphService.getMethodFromAncestor(clazz, method) - val hasValidAccessor = if (isSetter) property.hasValidSetterInClass else property.hasValidGetterInClass - if (parentClassAndMethod != null && !hasValidAccessor) { - if (isSetter) { - property.setterMethod = parentClassAndMethod.second - } else { - property.getterMethod = parentClassAndMethod.second - } - } - } - - inner(className, propertyName, true) - inner(className, propertyName, false) - } - - override fun findGetSetMethodsAndUpdateProperties() { - for (enrichedClass in classRepository.list()) { - for (property in enrichedClass.properties) { - for (method in enrichedClass.methods) { - if (property.name == "") continue - - when (method.name) { - property.getter -> { - if (method.getTypeClassName().className == UNIT || method.arguments.size > 1 || method.internal.isVirtual) continue - - if (!property.isIndexed && method.arguments.size == 1) continue - - if (method.arguments.size == 1 && !method.arguments[0].isEnum() && method.arguments[0].type != GodotTypes.int) continue - - property.getterMethod = method - } - property.setter -> { - if (method.getTypeClassName().className != UNIT || method.arguments.size > 2 || method.internal.isVirtual) continue - - if (!property.isIndexed && method.arguments.size == 2) continue - - if (method.arguments.size == 2 && !method.arguments[0].isEnum() && method.arguments[0].type != GodotTypes.int) continue - - property.setterMethod = method - } - } - } - } - } - } -} diff --git a/kt/api-generator/src/main/kotlin/godot/codegen/services/impl/EnumService.kt b/kt/api-generator/src/main/kotlin/godot/codegen/services/impl/EnumService.kt deleted file mode 100644 index c0622c929d..0000000000 --- a/kt/api-generator/src/main/kotlin/godot/codegen/services/impl/EnumService.kt +++ /dev/null @@ -1,61 +0,0 @@ -package godot.codegen.services.impl - -import godot.tools.common.constants.GodotTypes -import godot.codegen.exceptions.NoMatchingEnumFound -import godot.codegen.extensions.getTypeClassName -import godot.codegen.extensions.isBitField -import godot.codegen.models.custom.DefaultEnumValue -import godot.codegen.poet.ClassTypeNameWrapper -import godot.codegen.repositories.CoreTypeEnumRepository -import godot.codegen.repositories.GlobalEnumRepository -import godot.codegen.services.IClassService -import godot.codegen.services.IEnumService - -class EnumService( - private val globalEnumRepository: GlobalEnumRepository, - private val coreTypeEnumRepository: CoreTypeEnumRepository, - private val classService: IClassService -) : IEnumService { - override fun getGlobalEnums() = globalEnumRepository.list() - override fun findEnumValue(enumClassName: ClassTypeNameWrapper, enumValue: Long) : DefaultEnumValue { - val simpleNames = enumClassName.className.simpleNames - return if (simpleNames.size > 1) { - val className = simpleNames[0] - val enrichedEnum = if (GodotTypes.coreTypes.contains(className)) { - coreTypeEnumRepository.listForCoreType(className) - } else { - classService.getClasses() - .plus(classService.getSingletons()) - .first { it.name == className } - .enums - }?.firstOrNull { it.getTypeClassName() == enumClassName } ?: - throw NoMatchingEnumFound(simpleNames.joinToString(".")) - - val value = enrichedEnum - .internal - .values - .firstOrNull { it.value == enumValue } ?: - if (enrichedEnum.isBitField()) { - return DefaultEnumValue( - null, - "${enrichedEnum.name}Value($enumValue)", - enrichedEnum.encapsulatingType - ) - } - else { - throw NoMatchingEnumFound(simpleNames.joinToString(".")) - } - - DefaultEnumValue(enrichedEnum, value) - } else { - val enum = getGlobalEnums() - .first { it.name == simpleNames[0] } - val value = enum - .internal - .values - .first { it.value == enumValue } - - DefaultEnumValue(enum, value) - } - } -} diff --git a/kt/api-generator/src/main/kotlin/godot/codegen/services/impl/GenerationService.kt b/kt/api-generator/src/main/kotlin/godot/codegen/services/impl/GenerationService.kt deleted file mode 100644 index c916af1959..0000000000 --- a/kt/api-generator/src/main/kotlin/godot/codegen/services/impl/GenerationService.kt +++ /dev/null @@ -1,1051 +0,0 @@ -package godot.codegen.services.impl - -import com.squareup.kotlinpoet.ANY -import com.squareup.kotlinpoet.AnnotationSpec -import com.squareup.kotlinpoet.ClassName -import com.squareup.kotlinpoet.CodeBlock -import com.squareup.kotlinpoet.FileSpec -import com.squareup.kotlinpoet.FunSpec -import com.squareup.kotlinpoet.INT -import com.squareup.kotlinpoet.KModifier -import com.squareup.kotlinpoet.LONG -import com.squareup.kotlinpoet.LambdaTypeName -import com.squareup.kotlinpoet.MemberName -import com.squareup.kotlinpoet.ParameterSpec -import com.squareup.kotlinpoet.ParameterizedTypeName.Companion.parameterizedBy -import com.squareup.kotlinpoet.PropertySpec -import com.squareup.kotlinpoet.TypeSpec -import com.squareup.kotlinpoet.TypeVariableName -import com.squareup.kotlinpoet.UNIT -import com.squareup.kotlinpoet.asClassName -import godot.codegen.constants.VOID_PTR -import godot.codegen.constants.jvmReservedMethods -import godot.codegen.exceptions.ClassGenerationException -import godot.codegen.extensions.applyJvmNameIfNecessary -import godot.codegen.extensions.getDefaultValueKotlinString -import godot.codegen.extensions.getTypeClassName -import godot.codegen.extensions.isBitField -import godot.codegen.extensions.isEnum -import godot.codegen.extensions.isLocalCopyCoreTypes -import godot.codegen.extensions.jvmVariantTypeValue -import godot.codegen.models.custom.AdditionalImport -import godot.codegen.models.enriched.EnrichedClass -import godot.codegen.models.enriched.EnrichedConstant -import godot.codegen.models.enriched.EnrichedEnum -import godot.codegen.models.enriched.EnrichedMethod -import godot.codegen.models.enriched.EnrichedProperty -import godot.codegen.models.enriched.EnrichedSignal -import godot.codegen.models.enriched.isSameSignature -import godot.codegen.poet.RegistrationFileSpec -import godot.codegen.repositories.INativeStructureRepository -import godot.codegen.rpc.RpcFunctionMode -import godot.codegen.services.IClassGraphService -import godot.codegen.services.IEnumService -import godot.codegen.services.IGenerationService -import godot.codegen.traits.CallableTrait -import godot.codegen.traits.addKdoc -import godot.tools.common.constants.TO_GODOT_NAME_UTIL_FUNCTION -import godot.tools.common.constants.CORE_TYPE_HELPER -import godot.tools.common.constants.CORE_TYPE_LOCAL_COPY -import godot.tools.common.constants.GENERATED_COMMENT -import godot.tools.common.constants.GODOT_BASE_TYPE -import godot.tools.common.constants.GODOT_ERROR -import godot.tools.common.constants.GodotKotlinJvmTypes -import godot.tools.common.constants.GodotTypes -import godot.tools.common.constants.KT_OBJECT -import godot.tools.common.constants.TRANSFER_CONTEXT -import godot.tools.common.constants.TYPE_MANAGER -import godot.tools.common.constants.VARIANT_CASTER_ANY -import godot.tools.common.constants.VARIANT_PARSER_LONG -import godot.tools.common.constants.godotApiPackage -import godot.tools.common.constants.godotCorePackage -import java.util.* - -private const val methodBindingsInnerClassName = "MethodBindings" - -class GenerationService( - private val classGraphService: IClassGraphService, - private val enumService: IEnumService, - private val nativeStructureRepository: INativeStructureRepository -) : IGenerationService { - private var nextEngineClassIndex = 0 - - override fun generateSingleton(singletonClass: EnrichedClass): FileSpec { - val singletonTypeName = singletonClass.getTypeClassName() - val baseClass = singletonClass.inherits ?: GodotKotlinJvmTypes.obj - val classTypeBuilder = TypeSpec - .objectBuilder(singletonTypeName.className) - .superclass(ClassName(godotApiPackage, baseClass)) - - classTypeBuilder.generateSingletonConstructor(singletonClass.engineClassDBIndexName) - - return generateCommonsForClass( - classTypeBuilder, - singletonClass, - true, - classTypeBuilder - - ) - } - - override fun generateClass(clazz: EnrichedClass): FileSpec { - val className = clazz.getTypeClassName() - val classTypeBuilder = TypeSpec.classBuilder(className.className).addModifiers(KModifier.OPEN) - - if (!clazz.internal.isInstantiable) { - classTypeBuilder.primaryConstructor( - FunSpec.constructorBuilder() - .addModifiers(KModifier.INTERNAL) - .build() - ) - } - - val baseClass = clazz.inherits - if (!baseClass.isNullOrEmpty()) { - classTypeBuilder.superclass(ClassName(godotApiPackage, baseClass)) - } - - classTypeBuilder.generateClassConstructor(clazz.engineClassDBIndexName) - - return generateCommonsForClass(classTypeBuilder, clazz, false) - } - - private fun generateCommonsForClass( - classTypeBuilder: TypeSpec.Builder, - enrichedClass: EnrichedClass, - isSingleton: Boolean, - constantsTypeReceiver: TypeSpec.Builder = TypeSpec.companionObjectBuilder() - ): FileSpec { - val name = enrichedClass.name - val methodBindPtrReceiver = TypeSpec - .objectBuilder(methodBindingsInnerClassName) - .addModifiers(KModifier.INTERNAL) - - classTypeBuilder - .addKdoc(enrichedClass) - .addAnnotation(GODOT_BASE_TYPE) - - if (name == GodotKotlinJvmTypes.obj) { - classTypeBuilder.superclass(KT_OBJECT) - } - if (name == GodotKotlinJvmTypes.refCounted) { - classTypeBuilder.preventOnDestroyUsage() - } - if (name == GodotTypes.node) { - classTypeBuilder.generateTypesafeRpc() - } - - val enumExtensions = mutableListOf() - - for (enum in enrichedClass.enums) { - val enumAndExtensions = generateEnum(enum, name) - enumExtensions.addAll(enumAndExtensions.second) - for (typeSpec in enumAndExtensions.first) { - classTypeBuilder.addType(typeSpec) - } - } - - for (constant in enrichedClass.constants) { - constantsTypeReceiver.addProperty(generateConstant(constant, name)) - } - - for (method in enrichedClass.methods.filter { !it.internal.isVirtual }) { - methodBindPtrReceiver.addProperty(generateMethodVoidPtr(enrichedClass, method)) - } - - for (method in enrichedClass.methods.filter { it.internal.isStatic }) { - constantsTypeReceiver.addFunction(generateMethod(enrichedClass, method, true, isSingleton)) - } - - if (constantsTypeReceiver != classTypeBuilder) { - constantsTypeReceiver.build().let { classTypeBuilder.addType(it) } - } - - for (signal in enrichedClass.signals) { - classTypeBuilder.addProperty(generateSignals(signal, isSingleton)) - } - - for (property in enrichedClass.properties) { - val propertySpec = generateProperty(enrichedClass, property, isSingleton) ?: continue - classTypeBuilder.addProperty(propertySpec) - if (property.hasValidSetterInClass && property.isLocalCopyCoreTypes()) { - classTypeBuilder.addFunction(generateCoreTypeHelper(enrichedClass, property, isSingleton)) - } - } - - for (method in enrichedClass.methods.filter { !it.internal.isStatic }) { - // TODO: Implement native structure when value class are here. - var shouldGenerate = true - for (argument in method.arguments) { - if (nativeStructureRepository.findMatchingType(argument) != null) { - shouldGenerate = false - break - } - } - shouldGenerate = shouldGenerate && nativeStructureRepository.findMatchingType(method) == null - if (shouldGenerate) { - classTypeBuilder.addFunction(generateMethod(enrichedClass, method, false, isSingleton)) - } - } - - val generatedClass = classTypeBuilder - .addType(methodBindPtrReceiver.build()) - .build() - - val fileBuilder = FileSpec - .builder(godotApiPackage, generatedClass.name ?: throw ClassGenerationException(enrichedClass)) - .addType(generatedClass) - - for (enumExtension in enumExtensions) { - fileBuilder.addFunction(enumExtension) - } - - for (import in enrichedClass.additionalImports) { - fileBuilder.addImport(import.pckge, import.name) - } - - fileBuilder.generateSuppressWarnings() - - return fileBuilder - .addFileComment(GENERATED_COMMENT) - .build() - } - - override fun generateEngineIndexesForClass(fileSpecBuilder: FileSpec.Builder, clazz: EnrichedClass) { - fileSpecBuilder.addProperty( - PropertySpec - .builder(clazz.engineClassDBIndexName, INT, KModifier.CONST) - .initializer("%L", nextEngineClassIndex) - .addModifiers(KModifier.INTERNAL) - .build() - ) - - ++nextEngineClassIndex - } - - override fun generateEnum(enum: EnrichedEnum, containingClassName: String?): Pair, List> { - return if (enum.internal.isBitField) { - val packageName = if (enum.encapsulatingType == null) { - godotApiPackage - } else { - "$godotApiPackage.${enum.encapsulatingType.type}" - } - - val bitFieldInterfaceName = ClassName(packageName, enum.name) - - val bitFlagValueClassName = "${enum.name}Value" - - val bitFlagValueClass = TypeSpec.classBuilder(bitFlagValueClassName) - .addSuperinterface(bitFieldInterfaceName) - .addModifiers(KModifier.INTERNAL, KModifier.VALUE) - .addAnnotation(JvmInline::class) - .addProperty( - PropertySpec.builder(BIT_FLAG_VALUE_MEMBER, LONG) - .addModifiers(KModifier.OVERRIDE) - .initializer(BIT_FLAG_VALUE_MEMBER) - .build() - ) - .primaryConstructor( - FunSpec.constructorBuilder() - .addModifiers(KModifier.INTERNAL) - .addParameter( - ParameterSpec - .builder(BIT_FLAG_VALUE_MEMBER, LONG) - .build() - ) - .build() - ) - .build() - val bitfieldInterface = TypeSpec.interfaceBuilder(enum.name) - .addModifiers(KModifier.SEALED) - .addProperty( - PropertySpec.builder(BIT_FLAG_VALUE_MEMBER, LONG) - .build() - ) - - val logicalOperations = arrayOf("or", "xor", "and") - val extensionsOperator = generateBitFlagExtensionsOperators(logicalOperations, enum).toMutableList() - bitfieldInterface.generateOperatorMethods(logicalOperations, enum) - - val commonOperators = arrayOf("plus", "minus", "times", "div", "rem") - extensionsOperator.addAll(generateBitFlagExtensionsOperators(commonOperators, enum, true)) - bitfieldInterface.generateOperatorMethods(commonOperators, enum, true) - - val unaryOperations = arrayOf("unaryPlus", "unaryMinus", "inv") - - for (unaryOperation in unaryOperations) { - bitfieldInterface.addFunction( - FunSpec.builder(unaryOperation) - .returns(bitFieldInterfaceName) - .addCode(CodeBlock.of("return·%L(%L.%L())", bitFlagValueClassName, BIT_FLAG_VALUE_MEMBER, unaryOperation)) - .build() - ) - } - - val shiftOperations = arrayOf("shl", "shr", "ushr") - val shiftOperationsParameterName = "bits" - - for (shiftOperation in shiftOperations) { - bitfieldInterface.addFunction( - FunSpec.builder(shiftOperation) - .addModifiers(KModifier.INFIX) - .addParameter(shiftOperationsParameterName, INT) - .returns(bitFieldInterfaceName) - .addCode( - CodeBlock.of( - "return·%L(%L·%L·%L)", - bitFlagValueClassName, BIT_FLAG_VALUE_MEMBER, shiftOperation, shiftOperationsParameterName - ) - ) - .build() - ) - } - - val bitfieldInterfaceCompanion = TypeSpec.companionObjectBuilder() - - for (value in enum.internal.values) { - val bitFieldValueClassName = ClassName(packageName, bitFlagValueClassName) - bitfieldInterfaceCompanion - .addProperty( - PropertySpec.builder(value.name, bitFieldInterfaceName) - .initializer(CodeBlock.of("%T(%L)", bitFieldValueClassName, value.value)) - .build() - ) - } - - bitfieldInterface.addType(bitfieldInterfaceCompanion.build()) - - listOf(bitfieldInterface.build(), bitFlagValueClass) to extensionsOperator - } else { - val enumBuilder = TypeSpec.enumBuilder(enum.name) - enumBuilder.primaryConstructor( - FunSpec.constructorBuilder() - .addParameter("id", Long::class) - .addStatement("this.%N = %N", "id", "id") - .build() - ) - enumBuilder.addProperty("id", Long::class) - - for (value in enum.internal.values) { - val valueName = value.name - enumBuilder.addEnumConstant( - valueName, - TypeSpec.anonymousClassBuilder() - .addSuperclassConstructorParameter("%L", value.value) - .also { - it.addKdoc(value) - } - .build() - ) - } - - val companion = TypeSpec.companionObjectBuilder() - .addFunction( - FunSpec.builder("from") - .returns(ClassName("${godotApiPackage}.${containingClassName ?: ""}", enum.name)) - .addParameter("value", Long::class) - .addStatement("return·entries.single·{·it.%N·==·%N·}", "id", "value") - .build() - ) - .build() - enumBuilder.addType(companion) - listOf(enumBuilder.build()) to listOf() - } - } - - override fun generateConstant(constant: EnrichedConstant, containingClassName: String?): PropertySpec { - val constantName = constant.internal.name - return PropertySpec - .builder(constantName, constant.getTypeClassName().typeName) - .addModifiers(KModifier.CONST, KModifier.FINAL) - .initializer("%L", constant.internal.value) - .also { - it.addKdoc(constant) - } - .build() - } - - override fun generateEngineTypesRegistrationForClass( - registrationFileSpec: RegistrationFileSpec, - clazz: EnrichedClass - ) { - generateCommonRegistrationForClass( - registrationFileSpec, - clazz - ) { addRegisterEngineType(it, false) } - } - - override fun generateEngineTypesRegistrationForSingleton( - registrationFileSpec: RegistrationFileSpec, - singleton: EnrichedClass - ) { - generateCommonRegistrationForClass( - registrationFileSpec, - singleton - ) { - addRegisterEngineType(it, true) - addRegisterSingleton(it) - } - } - - private fun generateSignals(signal: EnrichedSignal, isSingleton: Boolean): PropertySpec { - val signalClass = signal.getTypeClassName() - val arguments = signal.arguments - - val builder = PropertySpec - .builder( - signal.name, - signalClass.typeName - ) - .addKdoc(signal) - .delegate( - "%T", - ClassName(godotCorePackage, "Signal" + arguments.size) - ) - - if (isSingleton) { - builder.addAnnotation(JvmStatic::class) - } - - return builder.build() - } - - private fun generateProperty(enrichedClass: EnrichedClass, property: EnrichedProperty, isSingleton: Boolean): PropertySpec? { - if (!property.hasValidGetterInClass && !property.hasValidSetterInClass) return null - - // We can't trust the property alone because some of them don't have a getter so we have to check on the setter's first parameter as well. - val argumentIndex = if (property.isIndexed) 1 else 0 - val propertyTypeName = (property.getterMethod ?: property.setterMethod!!.arguments[argumentIndex]).getCastedType() - - val propertyType = propertyTypeName.typeName - val propertySpecBuilder = PropertySpec.builder(property.name, propertyType).addModifiers(KModifier.FINAL) - - if (isSingleton) { - propertySpecBuilder.addAnnotation(JvmStatic::class) - } - - if (property.hasValidGetterInClass) { - val methodName = property.getter - - propertySpecBuilder.getter( - FunSpec.getterBuilder() - .addStatement( - if (property.isIndexed) { - val indexArgument = property.getterMethod!!.arguments[0] - if (indexArgument.isEnum() || indexArgument.isBitField()) { - val argumentValue = enumService.findEnumValue( - indexArgument.getBufferType(), - property.internal.index!!.toLong() - ).name - "return $methodName($argumentValue)" - } else { - "return $methodName(${property.internal.index})" - } - - } else { - "return $methodName()" - } - ) - .addAnnotation( - AnnotationSpec.builder(JvmName::class) - .addMember("\"${property.name}Property\"") - .build() - ) - .addModifiers(KModifier.INLINE) - .build() - ) - } else { - propertySpecBuilder.getter( - FunSpec.getterBuilder() - .addStatement( - "%L %T(%S)", - "throw", - UninitializedPropertyAccessException::class, - "Cannot access property ${property.name}: has no getter" - ) - .build() - ) - } - - val getterAndSetterAreCompatible = property.getterMethod?.getCastedType() == property.setterMethod?.arguments?.get(argumentIndex)?.getCastedType() - - // We don't generate the setter if its type doesn't match the getter. - if (property.hasValidSetterInClass && getterAndSetterAreCompatible) { - val methodName = property.setter - - propertySpecBuilder.mutable().setter( - FunSpec.setterBuilder() - .addParameter("value", property.getCastedType().typeName) - .addStatement( - if (property.isIndexed) { - val indexArgument = property.setterMethod!!.arguments[0] - if (indexArgument.isEnum() || indexArgument.isBitField()) { - val argumentValue = enumService.findEnumValue( - indexArgument.getBufferType(), - property.internal.index!!.toLong() - ).name - "$methodName($argumentValue, value)" - } else { - "$methodName(${property.internal.index}, value)" - } - - } else { - "$methodName(value)" - } - - ) - .addModifiers(KModifier.INLINE) - .addAnnotation( - AnnotationSpec.builder(JvmName::class) - .addMember("\"${property.name}Property\"") - .build() - ) - .build() - ) - } - - if (property.isLocalCopyCoreTypes()) { - propertySpecBuilder.addAnnotation(CORE_TYPE_LOCAL_COPY) - } - - propertySpecBuilder.addKdoc(property) - - return propertySpecBuilder.build() - } - - private fun generateCoreTypeHelper(enrichedClass: EnrichedClass, property: EnrichedProperty, isSingleton: Boolean): FunSpec { - val parameterTypeName = property.getCastedType() - val parameterName = property.name - val propertyFunSpec = FunSpec.builder("${parameterName}Mutate").addModifiers(KModifier.FINAL) - - if (isSingleton) { - propertyFunSpec.addAnnotation(JvmStatic::class) - } - - return propertyFunSpec - .addParameter( - ParameterSpec.builder( - "block", - LambdaTypeName.get( - receiver = parameterTypeName.typeName, - returnType = UNIT - ) - ).build() - ) - .addAnnotation(CORE_TYPE_HELPER) - .returns(parameterTypeName.typeName) - .addStatement( - """return $parameterName.apply{ - | block(this) - | $parameterName = this - |} - |""".trimMargin() - ).apply { - val kDoc = buildString { - val propertyKdoc = - property.sanitizedDocumentation - if (propertyKdoc != null) { - appendLine(propertyKdoc.replace("/*", "/*")) - appendLine() - } - - appendLine( - """This is a helper function to make dealing with local copies easier. - | - |For more information, see our [documentation](https://godot-kotl.in/en/stable/user-guide/api-differences/#core-types). - | - |Allow to directly modify the local copy of the property and assign it back to the Object. - | - |Prefer that over writing: - |`````` - |val myCoreType = ${enrichedClass.name.lowercase()}.${property.name} - |//Your changes - |${enrichedClass.name.lowercase()}.${property.name} = myCoreType - |`````` - |""".trimMargin() - ) - } - addKdoc(kDoc) - } - .build() - } - - private fun generateMethod(enrichedClass: EnrichedClass, method: EnrichedMethod, isStatic: Boolean, isSingleton: Boolean): FunSpec { - val modifiers = mutableListOf() - - // This method already exist in the Kotlin class Any. We have to override it because Godot uses the same name in Object. - if (method.name == "toString") { - modifiers.add(KModifier.OVERRIDE) - } - - // Godot doesn't override its methods, they are either final or meant to be implemented by script or extension. - if (method.internal.isVirtual) { - modifiers.add(KModifier.OPEN) - } else { - modifiers.add(KModifier.FINAL) - } - - val generatedFunBuilder = FunSpec - .builder(method.name) - .addModifiers(modifiers) - .applyJvmNameIfNecessary(method.name) - - val methodTypeName = method.getCastedType() - val shouldReturn = method.getTypeClassName().typeName != UNIT - - if (shouldReturn) { - generatedFunBuilder.returns(methodTypeName.typeName) - - if (method.isEnum()) { - val methodTypeSimpleName = methodTypeName.className.simpleName - if (methodTypeSimpleName.contains('.')) { - enrichedClass.additionalImports.add( - AdditionalImport( - methodTypeName.className.packageName, - methodTypeSimpleName.split('.')[0] - ) - ) - } - } - } - - //TODO: move adding arguments to generatedFunBuilder to separate function - val callArgumentsAsString = buildCallArgumentsString( - enrichedClass, - generatedFunBuilder, - method - ) //cannot be inlined as it also adds the arguments to the generatedFunBuilder - - if (method.internal.isVararg) { - generatedFunBuilder.addParameter( - "__var_args", - ANY.copy(nullable = true), - KModifier.VARARG - ) - } - - generatedFunBuilder.generateCodeBlock(enrichedClass, method, callArgumentsAsString, isStatic) - - generatedFunBuilder.addKdoc(method) - - for (jvmReservedMethod in jvmReservedMethods) { - if (method.isSameSignature(jvmReservedMethod) && !method.internal.isVirtual) { - generatedFunBuilder.addAnnotation( - AnnotationSpec.builder(JvmName::class) - .addMember( - CodeBlock.of( - "\"%L%L\"", - enrichedClass.name.replaceFirstChar { it.lowercase(Locale.US) }, - method.name.replaceFirstChar { if (it.isLowerCase()) it.titlecase(Locale.US) else it.toString() } - ) - ) - .build() - ) - - } - } - - if (isSingleton) { - generatedFunBuilder.addAnnotation(JvmStatic::class) - } - - return generatedFunBuilder.build() - } - - private fun generateMethodVoidPtr(enrichedClass: EnrichedClass, method: EnrichedMethod) = PropertySpec - .builder("${method.name}Ptr", VOID_PTR) - .initializer( - "%T.getMethodBindPtr(%S,·%S,·%L)", - ClassName("godot.core", "TypeManager"), - enrichedClass.internal.name, - method.internal.name, - method.internal.hash - ) - .build() - - private fun TypeSpec.Builder.preventOnDestroyUsage() { - addFunction( - FunSpec.builder("_onDestroy") - .addModifiers(KModifier.OVERRIDE, KModifier.FINAL) - .returns(Unit::class) - .addStatement("") - .build() - ) - } - - private fun TypeSpec.Builder.generateTypesafeRpc() { - for (i in 0..10) { - val kFunctionTypeParameters = mutableListOf() - if (i != 0) { - for (argIndex in 0 until i) { - kFunctionTypeParameters.add(TypeVariableName.invoke("ARG$argIndex")) - } - } - - val kFunctionClassName = ClassName("kotlin.reflect", "KFunction$i") - .parameterizedBy(*kFunctionTypeParameters.toTypedArray(), TypeVariableName.invoke("*")) - - RpcFunctionMode.entries.forEach { rpcFunctionMode -> - val rpcFunSpec = FunSpec - .builder(rpcFunctionMode.functionName) - .returns(GODOT_ERROR) - .addModifiers(KModifier.INLINE) - - if (rpcFunctionMode.hasId) { - rpcFunSpec.addParameter("id", Long::class.asClassName()) - } - - rpcFunSpec.addParameter("function", TypeVariableName.invoke("FUNCTION")) - - var templateString = "return ${rpcFunctionMode.functionName}(" - - if (rpcFunctionMode.hasId) { - templateString += "id, " - } - - templateString += "function.name.%M()" - - kFunctionTypeParameters.forEachIndexed { index, typeVariableName -> - rpcFunSpec.addTypeVariable(typeVariableName) - val argParamName = "arg$index" - rpcFunSpec.addParameter(argParamName, typeVariableName) - templateString += ", $argParamName" - } - templateString += ")" - rpcFunSpec.addStatement(templateString, TO_GODOT_NAME_UTIL_FUNCTION) - - rpcFunSpec.addTypeVariable(TypeVariableName.invoke("FUNCTION", kFunctionClassName).copy(reified = true)) - addFunction(rpcFunSpec.build()) - } - } - } - - private fun TypeSpec.Builder.generateClassConstructor(classIndexName: String) { - addFunction( - FunSpec.builder("new") - .addModifiers(KModifier.OVERRIDE) - .addParameter("scriptIndex", Int::class) - .returns(Unit::class) - .addStatement( - "callConstructor(%M, scriptIndex)", - MemberName(godotApiPackage, classIndexName), - ) - .build() - ) - } - - private fun TypeSpec.Builder.generateSingletonConstructor(classIndexName: String) { - addFunction( - FunSpec.builder("new") - .addModifiers(KModifier.OVERRIDE) - .addParameter("scriptIndex", Int::class) - .returns(Unit::class) - .addStatement( - "getSingleton(%M)", - MemberName(godotApiPackage, classIndexName), - ) - .build() - ) - } - - private fun buildCallArgumentsString( - cl: EnrichedClass, - generatedFunBuilder: FunSpec.Builder, - method: EnrichedMethod - ): String { - return buildString { - method.arguments.withIndex().forEach { - val index = it.index - val argument = it.value - - val shouldAddComa = index != 0 - - if (shouldAddComa) append(",·") - - val sanitisedArgumentName = classGraphService.getSanitisedArgumentName(cl, method, index) - - append("%T·to·$sanitisedArgumentName${argument.getToBufferCastingMethod()}") - - if (argument.isEnum()) append(".id") - if (argument.isBitField()) append(".flag") - - val argumentTypeClassName = argument.getCastedType() - val parameterBuilder = ParameterSpec.builder( - sanitisedArgumentName, - argumentTypeClassName.typeName - ) - - val defaultValueKotlinCode = argument.getDefaultValueKotlinString() - val appliedDefault = if ((argument.isEnum() || argument.isBitField()) && defaultValueKotlinCode != null) { - enumService.findEnumValue( - argumentTypeClassName, - defaultValueKotlinCode.first.toLong() - ).name - } else { - defaultValueKotlinCode?.first - } - if (appliedDefault != null) { - parameterBuilder.defaultValue(appliedDefault, *defaultValueKotlinCode!!.second) - - // add @JvmOverloads annotation for java support if not already present - val jvmOverloadAnnotationSpec = AnnotationSpec.builder(JvmOverloads::class.asClassName()).build() - if (!generatedFunBuilder.annotations.contains(jvmOverloadAnnotationSpec)) { - generatedFunBuilder.addAnnotation(jvmOverloadAnnotationSpec) - } - } - - generatedFunBuilder.addParameter(parameterBuilder.build()) - } - if (method.internal.isVararg && isNotEmpty()) append(",·") - } - } - - private fun FunSpec.Builder.generateCodeBlock( - clazz: EnrichedClass, - enrichedMethod: EnrichedMethod, - callArgumentsAsString: String, - isStatic: Boolean - ) { - if (!enrichedMethod.internal.isVirtual) { - generateJvmMethodCall( - clazz, - callable = enrichedMethod, - callArgumentsAsString = callArgumentsAsString, - isStatic = isStatic - ) - } else if (enrichedMethod.getTypeClassName().typeName != UNIT) { - addStatement( - "%L·%T(%S)", - "throw", - NotImplementedError::class, - "${enrichedMethod.internal.name} is not implemented for ${clazz.internal.name}" - ) - } - } - - private fun FunSpec.Builder.generateJvmMethodCall( - clazz: EnrichedClass, - callable: T, - callArgumentsAsString: String, - isStatic: Boolean - ): FunSpec.Builder { - val ktVariantClassNames = callable.arguments.map { - it.jvmVariantTypeValue - }.toTypedArray() - - if (callable.isVararg) { - addStatement( - "%T.writeArguments($callArgumentsAsString·*__var_args.map·{·%T·to·it·}.toTypedArray())", - TRANSFER_CONTEXT, - *ktVariantClassNames, - VARIANT_CASTER_ANY - ) - } else { - addStatement( - "%T.writeArguments($callArgumentsAsString)", - TRANSFER_CONTEXT, - *ktVariantClassNames - ) - } - - val returnTypeVariantTypeClass = callable.jvmVariantTypeValue - - val rawPtr = if (isStatic) { - "0" //nullpointer - } else { - "rawPtr" - } - - addStatement( - "%T.callMethod($rawPtr, %T.%M, %T)", - TRANSFER_CONTEXT, - clazz.getTypeClassName().className.nestedClass(methodBindingsInnerClassName), - MemberName("godot", callable.voidPtrVariableName), - returnTypeVariantTypeClass - ) - - val methodReturnType = callable.getBufferType() - - if (methodReturnType.typeName != UNIT) { - if (callable.isEnum()) { - addStatement( - "return·${methodReturnType.className.simpleNames.joinToString(".")}.from(%T.readReturnValue(%T)·as·%T)", - TRANSFER_CONTEXT, - VARIANT_PARSER_LONG, - LONG - ) - } else if (callable.isBitField()) { - val simpleNames = methodReturnType.className.simpleNames - addStatement( - "return·%T(%T.readReturnValue(%T)·as·%T)", - ClassName( - "${methodReturnType.className.packageName}.${simpleNames.subList(0, simpleNames.size - 1).joinToString(".")}", - "${callable.getTypeClassName().className.simpleName}Value" - ), - TRANSFER_CONTEXT, - VARIANT_PARSER_LONG, - LONG - ) - } else { - addStatement( - "return·(%T.readReturnValue(%T)·as·%T)${callable.getFromBufferCastingMethod()}", - TRANSFER_CONTEXT, - returnTypeVariantTypeClass, - methodReturnType.typeName - ) - } - } - return this - } - - private fun FileSpec.Builder.generateSuppressWarnings() { - addAnnotation( - AnnotationSpec.builder(ClassName("kotlin", "Suppress")) - .addMember( - "\"PackageDirectoryMismatch\", \"unused\", \"FunctionName\", \"RedundantModalityModifier\", " + - "\"UNCHECKED_CAST\", \"JoinDeclarationAndAssignment\", \"USELESS_CAST\", \"RemoveRedundantQualifierName\", " + - "\"NOTHING_TO_INLINE\", \"NON_FINAL_MEMBER_IN_OBJECT\", \"RedundantVisibilityModifier\", " + - "\"RedundantUnitReturnType\", \"MemberVisibilityCanBePrivate\"" - ) - .build() - ) - } - - private fun generateCommonRegistrationForClass( - registrationFileSpec: RegistrationFileSpec, - clazz: EnrichedClass, - registrationFunc: RegistrationFileSpec.(EnrichedClass) -> Unit - ) { - registrationFileSpec.registrationFunc(clazz) - registrationFileSpec.addVariantMapping(clazz) - - registrationFileSpec.registerMethodsFunBuilder.addStatement( - "%T", - clazz.getTypeClassName().className.nestedClass(methodBindingsInnerClassName) - ) - } - - private fun RegistrationFileSpec.addVariantMapping(enrichedClass: EnrichedClass) { - registerVariantMappingFunBuilder.addStatement( - "%M[%T::class] = %T", - MemberName(godotCorePackage, "variantMapper"), - enrichedClass.getTypeClassName().typeName, - enrichedClass.jvmVariantTypeValue - ) - } - - private fun RegistrationFileSpec.addRegisterEngineType(clazz: EnrichedClass, isSingleton: Boolean) { - val formatString = if (isSingleton) { - "%T.registerEngineType(%S, %T::class) { %T }" - } else { - "%T.registerEngineType(%S, %T::class, ::%T)" - } - val typeName = clazz.getTypeClassName().typeName - registerTypesFunBuilder.addStatement( - formatString, - TYPE_MANAGER, - clazz.internal.name, - typeName, - typeName - ) - } - - private fun RegistrationFileSpec.addRegisterSingleton(clazz: EnrichedClass) { - registerTypesFunBuilder.addStatement( - "%T.registerSingleton(%S)", - TYPE_MANAGER, - clazz.name - ) - } - - private fun TypeSpec.Builder.generateOperatorMethods( - operations: Array, - enum: EnrichedEnum, - isOperator: Boolean = false - ) { - val packageName = if (enum.encapsulatingType == null) { - godotApiPackage - } else { - "$godotApiPackage.${enum.encapsulatingType.type}" - } - - val bitFieldInterfaceName = ClassName(packageName, enum.name) - - val bitFlagValueClassName = "${enum.name}Value" - - val operatorModifier = if (isOperator) KModifier.OPERATOR else KModifier.INFIX - - for (operation in operations) { - this.addFunction( - FunSpec.builder(operation) - .addModifiers(operatorModifier) - .addParameter( - ParameterSpec - .builder("other", bitFieldInterfaceName) - .build() - ) - .returns(bitFieldInterfaceName) - .addCode( - CodeBlock.of( - "return·%L(%L.%L(other.%L))", - bitFlagValueClassName, - BIT_FLAG_VALUE_MEMBER, - operation, - BIT_FLAG_VALUE_MEMBER - ) - ) - .build() - ) - this.addFunction( - FunSpec.builder(operation) - .addModifiers(operatorModifier) - .addParameter( - ParameterSpec - .builder("other", LONG) - .build() - ) - .returns(bitFieldInterfaceName) - .addCode( - CodeBlock.of("return·%L(%L.%L(other))", bitFlagValueClassName, BIT_FLAG_VALUE_MEMBER, operation) - ) - .build() - ) - } - } - - companion object { - private const val BIT_FLAG_VALUE_MEMBER = "flag" - - fun generateBitFlagExtensionsOperators( - bitOperations: Array, - enum: EnrichedEnum, - isOperator: Boolean = false - ): List { - val packageName = if (enum.encapsulatingType == null) { - godotApiPackage - } else { - "$godotApiPackage.${enum.encapsulatingType.type}" - } - - val bitFieldInterfaceName = ClassName(packageName, enum.name) - - val operatorModifier = if (isOperator) KModifier.OPERATOR else KModifier.INFIX - - return bitOperations - .map { - FunSpec.builder(it) - .addModifiers(operatorModifier) - .receiver(LONG) - .addParameter( - ParameterSpec - .builder("other", bitFieldInterfaceName) - .build() - ) - .returns(LONG) - .addCode( - CodeBlock.of("return·this.%L(other.%L)", it, BIT_FLAG_VALUE_MEMBER) - ).build() - } - } - } -} diff --git a/kt/api-generator/src/main/kotlin/godot/codegen/services/impl/LambdaCallableGenerationService.kt b/kt/api-generator/src/main/kotlin/godot/codegen/services/impl/LambdaCallableGenerationService.kt index fa45662f2d..58be48ad4f 100644 --- a/kt/api-generator/src/main/kotlin/godot/codegen/services/impl/LambdaCallableGenerationService.kt +++ b/kt/api-generator/src/main/kotlin/godot/codegen/services/impl/LambdaCallableGenerationService.kt @@ -16,16 +16,18 @@ import com.squareup.kotlinpoet.TypeSpec import com.squareup.kotlinpoet.TypeVariableName import godot.codegen.services.ILambdaCallableGenerationService import godot.codegen.utils.GenericClassNameInfo +import godot.tools.common.constants.Constraints import godot.tools.common.constants.GodotFunctions import godot.tools.common.constants.GodotKotlinJvmTypes import godot.tools.common.constants.VARIANT_PARSER_NIL import godot.tools.common.constants.godotCorePackage +import java.io.File class LambdaCallableGenerationService : ILambdaCallableGenerationService { - override fun generate(maxArgumentCount: Int): FileSpec { + override fun generate(coreDir: File, apiDir: File) { val callableFileSpec = FileSpec.builder(godotCorePackage, "LambdaCallables") - for (argCount in 0..maxArgumentCount) { + for (argCount in 0..Constraints.MAX_FUNCTION_ARG_COUNT) { val ktCallableClassName = ClassName(godotCorePackage, "$KT_CALLABLE_NAME$argCount") val classBuilder = TypeSpec .classBuilder(ktCallableClassName) @@ -329,8 +331,8 @@ class LambdaCallableGenerationService : ILambdaCallableGenerationService { .addMember("\"PackageDirectoryMismatch\", \"UNCHECKED_CAST\"") .build() ) - - return callableFileSpec.build() + .build() + .writeTo(coreDir) } // JAVA BRIDGE FUNCTION diff --git a/kt/api-generator/src/main/kotlin/godot/codegen/services/impl/SignalGenerationService.kt b/kt/api-generator/src/main/kotlin/godot/codegen/services/impl/SignalGenerationService.kt index 2736c2a4fb..eb185b49cd 100644 --- a/kt/api-generator/src/main/kotlin/godot/codegen/services/impl/SignalGenerationService.kt +++ b/kt/api-generator/src/main/kotlin/godot/codegen/services/impl/SignalGenerationService.kt @@ -21,21 +21,25 @@ import com.squareup.kotlinpoet.asClassName import godot.codegen.services.ISignalGenerationService import godot.codegen.utils.GenericClassNameInfo import godot.tools.common.constants.AS_CALLABLE_UTIL_FUNCTION +import godot.tools.common.constants.Constraints import godot.tools.common.constants.GODOT_CALLABLE import godot.tools.common.constants.GODOT_ERROR import godot.tools.common.constants.GODOT_OBJECT import godot.tools.common.constants.TO_GODOT_NAME_UTIL_FUNCTION import godot.tools.common.constants.godotCorePackage +import godot.tools.common.constants.godotExtensionPackage import godot.tools.common.constants.kotlinReflectPackage +import java.io.File import kotlin.reflect.KCallable class SignalGenerationService : ISignalGenerationService { - override fun generate(maxArgumentCount: Int): FileSpec { + override fun generate(coreDir: File, apiDir: File) { val signalFileSpec = FileSpec.builder(godotCorePackage, "Signals") + val signalExtFileSpec = FileSpec.builder(godotExtensionPackage, "SignalsExt") - for (argCount in 0..maxArgumentCount) { + for (argCount in 0..Constraints.MAX_FUNCTION_ARG_COUNT) { val signalClassName = ClassName(godotCorePackage, "$SIGNAL_CLASS_NAME$argCount") val genericClassNameInfo = GenericClassNameInfo(signalClassName, argCount) @@ -44,10 +48,12 @@ class SignalGenerationService : ISignalGenerationService { signalFileSpec.addFunction(generateFakeSignalConstructor(argCount, genericClassNameInfo)) signalFileSpec.addFunction(generateSignalDelegate(argCount, genericClassNameInfo)) signalFileSpec.addFunction(generateSignalExtension(genericClassNameInfo, false)) - signalFileSpec.addFunction(generateSignalExtension(genericClassNameInfo, true)) + + signalExtFileSpec.addFunction(generateThreadSafeExtension(argCount, genericClassNameInfo)) + signalExtFileSpec.addFunction(generateSignalExtension(genericClassNameInfo, true)) } - return signalFileSpec + signalFileSpec .addAnnotation( AnnotationSpec .builder(Suppress::class) @@ -58,7 +64,30 @@ class SignalGenerationService : ISignalGenerationService { ) .indent(" ") .build() + .writeTo(coreDir) + signalExtFileSpec + .addAnnotation( + AnnotationSpec + .builder(Suppress::class) + .addMember("\"PackageDirectoryMismatch\"") + .addMember("\"NOTHING_TO_INLINE\"") + .addMember("\"UNUSED_PARAMETER\"") + .build() + ) + .addAnnotation( + AnnotationSpec + .builder(JvmName::class) + .addMember("\"SignalsExt\"") + .build() + ) + .indent(" ") + .addImport( + "godot.extension", + "connectThreadSafe" + ) + .build() + .writeTo(apiDir) } @@ -125,19 +154,6 @@ class SignalGenerationService : ISignalGenerationService { .addCode(generateConnectionCodeBlock()) .build(), - FunSpec.builder(CONNECT_THREAD_SAFE_METHOD_NAME) - .addTypeVariable(godotObjectBoundTypeVariable) - .addParameters( - listOf( - ParameterSpec.builder(TARGET_PARAMETER_NAME, godotObjectBoundTypeVariable).build(), - ParameterSpec.builder(METHOD_PARAMETER_NAME, lambdaTypeName).build(), - flagsParameter - ) - ) - .returns(ANY.copy(nullable = true)) - .addCode(generateConnectionCodeBlock(false, true)) - .build(), - FunSpec.builder(DISCONNECT_METHOD_NAME) .addTypeVariable(godotObjectBoundTypeVariable) .addParameters( @@ -155,6 +171,32 @@ class SignalGenerationService : ISignalGenerationService { .build() } + private fun generateThreadSafeExtension(argCount: Int, genericClassNameInfo: GenericClassNameInfo): FunSpec { + val flagsParameter = ParameterSpec.builder(FLAGS_PARAMETER_NAME, INT) + .defaultValue("0") + .build() + + val lambdaTypeName = LambdaTypeName.get( + receiver = godotObjectBoundTypeVariable, + parameters = genericClassNameInfo.toParameterSpecList(), + returnType = UNIT + ) + + return genericClassNameInfo + .toExtensionFunSpecBuilder(CONNECT_THREAD_SAFE_METHOD_NAME) + .addTypeVariable(godotObjectBoundTypeVariable) + .addParameters( + listOf( + ParameterSpec.builder(TARGET_PARAMETER_NAME, godotObjectBoundTypeVariable).build(), + ParameterSpec.builder(METHOD_PARAMETER_NAME, lambdaTypeName).build(), + flagsParameter + ) + ) + .returns(ANY.copy(nullable = true)) + .addCode(generateConnectionCodeBlock(false, true)) + .build() + } + private fun generateConnectionCodeBlock(isDisconnect: Boolean = false, isThreadSafe: Boolean = false): CodeBlock { val methodName = if (isDisconnect) { DISCONNECT_METHOD_NAME diff --git a/kt/api-generator/src/main/kotlin/godot/gradle/ApiGeneratorPlugin.kt b/kt/api-generator/src/main/kotlin/godot/gradle/ApiGeneratorPlugin.kt index 03db9d5991..f400beb489 100644 --- a/kt/api-generator/src/main/kotlin/godot/gradle/ApiGeneratorPlugin.kt +++ b/kt/api-generator/src/main/kotlin/godot/gradle/ApiGeneratorPlugin.kt @@ -13,6 +13,7 @@ import org.gradle.api.tasks.TaskAction open class ApiGeneratorPluginExtension(objects: ObjectFactory) { var sourceJson = objects.fileProperty() var coreOutputDir = objects.directoryProperty() + var apiOutputDir = objects.directoryProperty() var coroutineOutputDir = objects.directoryProperty() } @@ -23,6 +24,9 @@ open class GenerateAPI : DefaultTask() { @OutputDirectory val coreOutputDir = project.objects.directoryProperty() + @OutputDirectory + val apiOutputDir = project.objects.directoryProperty() + @OutputDirectory val coroutineOutputDir = project.objects.directoryProperty() @@ -30,11 +34,19 @@ open class GenerateAPI : DefaultTask() { fun execute() { val coreOutput = coreOutputDir.get().asFile coreOutput.deleteRecursively() - coreOutput.generateApiFrom(sourceJson.get().asFile) + + val apiOutput = apiOutputDir.get().asFile + apiOutput.deleteRecursively() + + generateApiFrom( + sourceJson.get().asFile, + coreOutput, + apiOutput, + ) val coroutineOutput = coroutineOutputDir.get().asFile coroutineOutput.deleteRecursively() - coroutineOutput.generateCoroutine() + generateCoroutine(coroutineOutput) } } @@ -44,6 +56,7 @@ class ApiGeneratorPlugin : Plugin { project.tasks.register("generateAPI", GenerateAPI::class.java) { task -> task.sourceJson.set(extension.sourceJson) task.coreOutputDir.set(extension.coreOutputDir) + task.apiOutputDir.set(extension.apiOutputDir) task.coroutineOutputDir.set(extension.coroutineOutputDir) task.group = "godot-jvm" diff --git a/kt/entry-generation/godot-entry-generator/build.gradle.kts b/kt/entry-generation/godot-entry-generator/build.gradle.kts index f049707b85..674318e1f4 100644 --- a/kt/entry-generation/godot-entry-generator/build.gradle.kts +++ b/kt/entry-generation/godot-entry-generator/build.gradle.kts @@ -12,7 +12,8 @@ kotlin { dependencies { implementation("com.utopia-rise:tools-common:$fullGodotKotlinJvmVersion") - implementation(project(":godot-library")) + implementation(project(":godot-core-library")) + implementation(project(":godot-api-library")) implementation(libs.kotlinPoet) } diff --git a/kt/entry-generation/godot-entry-generator/src/main/kotlin/godot/entrygenerator/ext/TypeExtensions.kt b/kt/entry-generation/godot-entry-generator/src/main/kotlin/godot/entrygenerator/ext/TypeExtensions.kt index ee83db8958..0d99391973 100644 --- a/kt/entry-generation/godot-entry-generator/src/main/kotlin/godot/entrygenerator/ext/TypeExtensions.kt +++ b/kt/entry-generation/godot-entry-generator/src/main/kotlin/godot/entrygenerator/ext/TypeExtensions.kt @@ -34,7 +34,7 @@ import godot.tools.common.constants.VARIANT_PARSER_STRING_NAME import godot.tools.common.constants.VARIANT_PARSER_TRANSFORM2D import godot.tools.common.constants.VARIANT_PARSER_TRANSFORM3D import godot.tools.common.constants.VARIANT_PARSER__RID -import godot.tools.common.constants.godotApiPackage +import godot.tools.common.constants.godotPackage import godot.tools.common.constants.godotCorePackage import godot.tools.common.constants.godotUtilPackage import godot.tools.common.constants.kotlinCollectionsPackage @@ -100,14 +100,14 @@ fun Type.isCoreType(): Boolean { } fun Type.isNodeType(): Boolean { - return fqName == "$godotApiPackage.${GodotTypes.node}" || allSuperTypes.any { supertype -> supertype.fqName == "$godotApiPackage.${GodotTypes.node}" } + return fqName == "$godotPackage.${GodotTypes.node}" || allSuperTypes.any { supertype -> supertype.fqName == "$godotPackage.${GodotTypes.node}" } } fun Type.baseGodotType(): Type? { - return if (fqName.startsWith(godotApiPackage)) { + return if (fqName.startsWith(godotPackage)) { this } else { - allSuperTypes.firstOrNull { supertype -> supertype.fqName.startsWith(godotApiPackage) } + allSuperTypes.firstOrNull { supertype -> supertype.fqName.startsWith(godotPackage) } } } @@ -125,13 +125,13 @@ fun Type.isKotlinCollection(): Boolean = fqName.contains(kotlinCollectionsPackag fun Type.isEnum(): Boolean = kind == TypeKind.ENUM_CLASS -fun Type.isRefCounted(): Boolean = fqName == "$godotApiPackage.${GodotKotlinJvmTypes.refCounted}" || this +fun Type.isRefCounted(): Boolean = fqName == "$godotPackage.${GodotKotlinJvmTypes.refCounted}" || this .allSuperTypes - .any { supertype -> supertype.fqName == "$godotApiPackage.${GodotKotlinJvmTypes.refCounted}" } + .any { supertype -> supertype.fqName == "$godotPackage.${GodotKotlinJvmTypes.refCounted}" } -fun Type.isResource(): Boolean = fqName == "$godotApiPackage.${GodotKotlinJvmTypes.resource}" || this +fun Type.isResource(): Boolean = fqName == "$godotPackage.${GodotKotlinJvmTypes.resource}" || this .allSuperTypes - .any { supertype -> supertype.fqName == "$godotApiPackage.${GodotKotlinJvmTypes.resource}" } + .any { supertype -> supertype.fqName == "$godotPackage.${GodotKotlinJvmTypes.resource}" } fun Type.isGodotPrimitive(): Boolean = when (fqName) { Int::class.qualifiedName, diff --git a/kt/entry-generation/godot-entry-generator/src/main/kotlin/godot/entrygenerator/filebuilder/MainEntryFileBuilder.kt b/kt/entry-generation/godot-entry-generator/src/main/kotlin/godot/entrygenerator/filebuilder/MainEntryFileBuilder.kt index 0bbd444aeb..92a6e93c05 100644 --- a/kt/entry-generation/godot-entry-generator/src/main/kotlin/godot/entrygenerator/filebuilder/MainEntryFileBuilder.kt +++ b/kt/entry-generation/godot-entry-generator/src/main/kotlin/godot/entrygenerator/filebuilder/MainEntryFileBuilder.kt @@ -14,7 +14,7 @@ import godot.entrygenerator.model.RegisteredClass import godot.tools.common.constants.GENERATED_COMMENT import godot.tools.common.constants.GodotKotlinJvmTypes import godot.tools.common.constants.KOTLIN_LIST_OF -import godot.tools.common.constants.godotApiPackage +import godot.tools.common.constants.godotPackage import godot.tools.common.constants.godotEntryBasePackage import godot.tools.common.constants.godotRegistrationPackage import java.io.BufferedWriter @@ -30,9 +30,9 @@ object MainEntryFileBuilder { .builder("initEngineTypes") .receiver(ClassName("$godotRegistrationPackage.${GodotKotlinJvmTypes.entry}", GodotKotlinJvmTypes.context)) .addModifiers(KModifier.OVERRIDE) - .addStatement("%M()", MemberName(godotApiPackage, "registerVariantMapping")) - .addStatement("%M()", MemberName(godotApiPackage, "registerEngineTypes")) - .addStatement("%M()", MemberName(godotApiPackage, "registerEngineTypeMethods")) + .addStatement("%M()", MemberName(godotPackage, "registerVariantMapping")) + .addStatement("%M()", MemberName(godotPackage, "registerEngineTypes")) + .addStatement("%M()", MemberName(godotPackage, "registerEngineTypeMethods")) private val registerUserTypesVariantMappingsFunSpec = FunSpec .builder("getRegisteredClasses") diff --git a/kt/entry-generation/godot-entry-generator/src/main/kotlin/godot/entrygenerator/generator/ConstructorRegistrationGenerator.kt b/kt/entry-generation/godot-entry-generator/src/main/kotlin/godot/entrygenerator/generator/ConstructorRegistrationGenerator.kt index 52d11d8ab0..cdfdc95b51 100644 --- a/kt/entry-generation/godot-entry-generator/src/main/kotlin/godot/entrygenerator/generator/ConstructorRegistrationGenerator.kt +++ b/kt/entry-generation/godot-entry-generator/src/main/kotlin/godot/entrygenerator/generator/ConstructorRegistrationGenerator.kt @@ -8,6 +8,7 @@ import godot.entrygenerator.ext.toTypeName import godot.entrygenerator.model.RegisterConstructorAnnotation import godot.entrygenerator.model.RegisteredClass import godot.tools.common.constants.godotCorePackage +import godot.tools.common.constants.godotRegistrationPackage object ConstructorRegistrationGenerator { @@ -24,7 +25,7 @@ object ConstructorRegistrationGenerator { if (ctorParamsCount == 0) { registerClassControlFlow.addStatement( "constructor(%T(::%T))", - ClassName(godotCorePackage, "KtConstructor$ctorParamsCount"), + ClassName(godotRegistrationPackage, "KtConstructor$ctorParamsCount"), className ) } else { @@ -90,7 +91,7 @@ object ConstructorRegistrationGenerator { registerClassControlFlow.addStatement( "constructor(%T($templateString))", - ClassName(godotCorePackage, "KtConstructor$ctorParamsCount"), + ClassName(godotRegistrationPackage, "KtConstructor$ctorParamsCount"), *templateArgs.toTypedArray() ) } diff --git a/kt/entry-generation/godot-entry-generator/src/main/kotlin/godot/entrygenerator/generator/FunctionRegistrationGenerator.kt b/kt/entry-generation/godot-entry-generator/src/main/kotlin/godot/entrygenerator/generator/FunctionRegistrationGenerator.kt index 1cd783da1b..9cd27cbec7 100644 --- a/kt/entry-generation/godot-entry-generator/src/main/kotlin/godot/entrygenerator/generator/FunctionRegistrationGenerator.kt +++ b/kt/entry-generation/godot-entry-generator/src/main/kotlin/godot/entrygenerator/generator/FunctionRegistrationGenerator.kt @@ -17,7 +17,7 @@ import godot.tools.common.constants.GodotKotlinJvmTypes import godot.tools.common.constants.GodotTypes import godot.tools.common.constants.KOTLIN_LIST_OF import godot.tools.common.constants.VARIANT_PARSER_NIL -import godot.tools.common.constants.godotApiPackage +import godot.tools.common.constants.godotPackage import godot.tools.common.constants.godotCorePackage import godot.tools.common.constants.godotRegistrationPackage @@ -113,7 +113,7 @@ object FunctionRegistrationGenerator { add(ktFunctionArgumentClassName) add(registeredFunction.returnType.toKtVariantType()) add(registeredFunction.returnType?.fqName ?: requireNotNull(Unit::class.qualifiedName)) - add(ClassName(godotCorePackage, GodotKotlinJvmTypes.ktRpcConfig)) + add(ClassName(godotRegistrationPackage, GodotKotlinJvmTypes.ktRpcConfig)) add(getRpcModeEnum(registeredFunction)) add(getRpcCallLocal(registeredFunction)) add(getRpcTransferModeEnum(registeredFunction)) @@ -130,18 +130,18 @@ object FunctionRegistrationGenerator { private fun getRpcModeEnum(registeredFunction: RegisteredFunction): ClassName { return when (registeredFunction.annotations.getAnnotation()?.rpcMode) { null, - RpcMode.DISABLED -> ClassName("$godotApiPackage.${GodotTypes.rpcMode}", "RPC_MODE_DISABLED") - RpcMode.ANY -> ClassName("$godotApiPackage.${GodotTypes.rpcMode}", "RPC_MODE_ANY_PEER") - RpcMode.AUTHORITY -> ClassName("$godotApiPackage.${GodotTypes.rpcMode}", "RPC_MODE_AUTHORITY") + RpcMode.DISABLED -> ClassName("$godotPackage.${GodotTypes.rpcMode}", "RPC_MODE_DISABLED") + RpcMode.ANY -> ClassName("$godotPackage.${GodotTypes.rpcMode}", "RPC_MODE_ANY_PEER") + RpcMode.AUTHORITY -> ClassName("$godotPackage.${GodotTypes.rpcMode}", "RPC_MODE_AUTHORITY") } } private fun getRpcTransferModeEnum(registeredFunction: RegisteredFunction): ClassName { return when (registeredFunction.annotations.getAnnotation()?.transferMode) { null, - TransferMode.RELIABLE -> ClassName("$godotApiPackage.${GodotTypes.transferMode}", "TRANSFER_MODE_RELIABLE") - TransferMode.UNRELIABLE -> ClassName("$godotApiPackage.${GodotTypes.transferMode}", "TRANSFER_MODE_UNRELIABLE") - TransferMode.UNRELIABLE_ORDERED -> ClassName("$godotApiPackage.${GodotTypes.transferMode}", "TRANSFER_MODE_UNRELIABLE_ORDERED") + TransferMode.RELIABLE -> ClassName("$godotPackage.${GodotTypes.transferMode}", "TRANSFER_MODE_RELIABLE") + TransferMode.UNRELIABLE -> ClassName("$godotPackage.${GodotTypes.transferMode}", "TRANSFER_MODE_UNRELIABLE") + TransferMode.UNRELIABLE_ORDERED -> ClassName("$godotPackage.${GodotTypes.transferMode}", "TRANSFER_MODE_UNRELIABLE_ORDERED") } } diff --git a/kt/entry-generation/godot-entry-generator/src/main/kotlin/godot/entrygenerator/generator/PropertyRegistrationGenerator.kt b/kt/entry-generation/godot-entry-generator/src/main/kotlin/godot/entrygenerator/generator/PropertyRegistrationGenerator.kt index f4c7e1cd47..be03e89733 100644 --- a/kt/entry-generation/godot-entry-generator/src/main/kotlin/godot/entrygenerator/generator/PropertyRegistrationGenerator.kt +++ b/kt/entry-generation/godot-entry-generator/src/main/kotlin/godot/entrygenerator/generator/PropertyRegistrationGenerator.kt @@ -15,7 +15,7 @@ import godot.entrygenerator.model.RegisteredClass import godot.entrygenerator.model.RegisteredProperty import godot.entrygenerator.model.TypeKind import godot.tools.common.constants.GodotTypes -import godot.tools.common.constants.godotApiPackage +import godot.tools.common.constants.godotPackage object PropertyRegistrationGenerator { fun generate( @@ -140,12 +140,12 @@ object PropertyRegistrationGenerator { private fun getPropertyUsage(registeredProperty: RegisteredProperty): ClassName { return if (registeredProperty.annotations.hasAnnotation()) { ClassName( - "$godotApiPackage.${GodotTypes.propertyUsage}", + "$godotPackage.${GodotTypes.propertyUsage}", "PROPERTY_USAGE_DEFAULT" ) } else { ClassName( - "$godotApiPackage.${GodotTypes.propertyUsage}", + "$godotPackage.${GodotTypes.propertyUsage}", "PROPERTY_USAGE_NONE" ) } diff --git a/kt/entry-generation/godot-entry-generator/src/main/kotlin/godot/entrygenerator/generator/typehint/PropertyTypeHintProvider.kt b/kt/entry-generation/godot-entry-generator/src/main/kotlin/godot/entrygenerator/generator/typehint/PropertyTypeHintProvider.kt index 43105c1209..e0581319a8 100644 --- a/kt/entry-generation/godot-entry-generator/src/main/kotlin/godot/entrygenerator/generator/typehint/PropertyTypeHintProvider.kt +++ b/kt/entry-generation/godot-entry-generator/src/main/kotlin/godot/entrygenerator/generator/typehint/PropertyTypeHintProvider.kt @@ -15,7 +15,7 @@ import godot.entrygenerator.model.PlaceHolderTextHintAnnotation import godot.entrygenerator.model.RegisteredProperty import godot.entrygenerator.model.TypeKind import godot.tools.common.constants.GodotTypes -import godot.tools.common.constants.godotApiPackage +import godot.tools.common.constants.godotPackage object PropertyTypeHintProvider { @@ -24,20 +24,20 @@ object PropertyTypeHintProvider { ): ClassName { return when { registeredProperty.type.fqName == Int::class.qualifiedName -> if (registeredProperty.annotations.hasAnnotation()) { - ClassName("$godotApiPackage.${GodotTypes.propertyHint}", "PROPERTY_HINT_FLAGS") + ClassName("$godotPackage.${GodotTypes.propertyHint}", "PROPERTY_HINT_FLAGS") } else { JvmPrimitivesTypeHintGenerator(registeredProperty).getPropertyTypeHint() } registeredProperty.type.fqName == String::class.qualifiedName -> when { registeredProperty.annotations.hasAnnotation() -> { ClassName( - "$godotApiPackage.${GodotTypes.propertyHint}", + "$godotPackage.${GodotTypes.propertyHint}", "PROPERTY_HINT_MULTILINE_TEXT" ) } registeredProperty.annotations.hasAnnotation() -> { ClassName( - "$godotApiPackage.${GodotTypes.propertyHint}", + "$godotPackage.${GodotTypes.propertyHint}", "PROPERTY_HINT_PLACEHOLDER_TEXT" ) } @@ -58,22 +58,22 @@ object PropertyTypeHintProvider { ).getPropertyTypeHint() registeredProperty.type.isRefCounted() -> ClassName( - "$godotApiPackage.${GodotTypes.propertyHint}", + "$godotPackage.${GodotTypes.propertyHint}", "PROPERTY_HINT_RESOURCE_TYPE" ) registeredProperty.type.isCompatibleList() -> JvmArrayTypeHintGenerator(registeredProperty).getPropertyTypeHint() registeredProperty.type.fqName.matches(Regex("^kotlin\\.collections\\..*Set\$")) -> ClassName( - "$godotApiPackage.${GodotTypes.propertyHint}", + "$godotPackage.${GodotTypes.propertyHint}", "PROPERTY_HINT_RESOURCE_TYPE" ) registeredProperty.type.isNodeType() -> ClassName( - "$godotApiPackage.${GodotTypes.propertyHint}", + "$godotPackage.${GodotTypes.propertyHint}", "PROPERTY_HINT_NODE_TYPE" ) - else -> ClassName("$godotApiPackage.${GodotTypes.propertyHint}", "PROPERTY_HINT_NONE") + else -> ClassName("$godotPackage.${GodotTypes.propertyHint}", "PROPERTY_HINT_NONE") } } } diff --git a/kt/entry-generation/godot-entry-generator/src/main/kotlin/godot/entrygenerator/generator/typehint/array/JvmArrayTypeHintGenerator.kt b/kt/entry-generation/godot-entry-generator/src/main/kotlin/godot/entrygenerator/generator/typehint/array/JvmArrayTypeHintGenerator.kt index c190e8e459..fea83d622f 100644 --- a/kt/entry-generation/godot-entry-generator/src/main/kotlin/godot/entrygenerator/generator/typehint/array/JvmArrayTypeHintGenerator.kt +++ b/kt/entry-generation/godot-entry-generator/src/main/kotlin/godot/entrygenerator/generator/typehint/array/JvmArrayTypeHintGenerator.kt @@ -5,14 +5,14 @@ import godot.entrygenerator.exceptions.WrongAnnotationUsageException import godot.entrygenerator.generator.typehint.PropertyTypeHintGenerator import godot.entrygenerator.model.RegisteredProperty import godot.tools.common.constants.GodotTypes -import godot.tools.common.constants.godotApiPackage +import godot.tools.common.constants.godotPackage class JvmArrayTypeHintGenerator( private val registeredProperty: RegisteredProperty ) : PropertyTypeHintGenerator(registeredProperty) { override fun getPropertyTypeHint(): ClassName { return when (propertyHintAnnotation) { - null -> ClassName("$godotApiPackage.${GodotTypes.propertyHint}", "PROPERTY_HINT_NONE") + null -> ClassName("$godotPackage.${GodotTypes.propertyHint}", "PROPERTY_HINT_NONE") else -> throw WrongAnnotationUsageException(registeredProperty, propertyHintAnnotation) } } diff --git a/kt/entry-generation/godot-entry-generator/src/main/kotlin/godot/entrygenerator/generator/typehint/coretypes/JvmCoreTypeTypeHintGenerator.kt b/kt/entry-generation/godot-entry-generator/src/main/kotlin/godot/entrygenerator/generator/typehint/coretypes/JvmCoreTypeTypeHintGenerator.kt index 0c35da8a9b..ab97b18242 100644 --- a/kt/entry-generation/godot-entry-generator/src/main/kotlin/godot/entrygenerator/generator/typehint/coretypes/JvmCoreTypeTypeHintGenerator.kt +++ b/kt/entry-generation/godot-entry-generator/src/main/kotlin/godot/entrygenerator/generator/typehint/coretypes/JvmCoreTypeTypeHintGenerator.kt @@ -6,19 +6,19 @@ import godot.entrygenerator.generator.typehint.PropertyTypeHintGenerator import godot.entrygenerator.model.ColorNoAlphaHintAnnotation import godot.entrygenerator.model.RegisteredProperty import godot.tools.common.constants.GodotTypes -import godot.tools.common.constants.godotApiPackage +import godot.tools.common.constants.godotPackage class JvmCoreTypeTypeHintGenerator( private val registeredProperty: RegisteredProperty ) : PropertyTypeHintGenerator(registeredProperty) { override fun getPropertyTypeHint(): ClassName { return when (propertyHintAnnotation) { - is ColorNoAlphaHintAnnotation -> ClassName("$godotApiPackage.${GodotTypes.propertyHint}", "PROPERTY_HINT_COLOR_NO_ALPHA") + is ColorNoAlphaHintAnnotation -> ClassName("$godotPackage.${GodotTypes.propertyHint}", "PROPERTY_HINT_COLOR_NO_ALPHA") //TODO: implement ImageCompressLossy //TODO: implement ImageCompressLossLess //TODO: implement NodePathToEditedNode //TODO: implement NodePathValidTypes - null -> ClassName("$godotApiPackage.${GodotTypes.propertyHint}", "PROPERTY_HINT_NONE") + null -> ClassName("$godotPackage.${GodotTypes.propertyHint}", "PROPERTY_HINT_NONE") else -> throw WrongAnnotationUsageException(registeredProperty, propertyHintAnnotation) } } diff --git a/kt/entry-generation/godot-entry-generator/src/main/kotlin/godot/entrygenerator/generator/typehint/primitives/JvmPrimitivesTypeHintGenerator.kt b/kt/entry-generation/godot-entry-generator/src/main/kotlin/godot/entrygenerator/generator/typehint/primitives/JvmPrimitivesTypeHintGenerator.kt index 8ba54afd91..fe77f9e9f4 100644 --- a/kt/entry-generation/godot-entry-generator/src/main/kotlin/godot/entrygenerator/generator/typehint/primitives/JvmPrimitivesTypeHintGenerator.kt +++ b/kt/entry-generation/godot-entry-generator/src/main/kotlin/godot/entrygenerator/generator/typehint/primitives/JvmPrimitivesTypeHintGenerator.kt @@ -11,28 +11,28 @@ import godot.entrygenerator.model.PlaceHolderTextHintAnnotation import godot.entrygenerator.model.RangeHintAnnotation import godot.entrygenerator.model.RegisteredProperty import godot.tools.common.constants.GodotTypes -import godot.tools.common.constants.godotApiPackage +import godot.tools.common.constants.godotPackage class JvmPrimitivesTypeHintGenerator( private val registeredProperty: RegisteredProperty ) : PropertyTypeHintGenerator(registeredProperty) { override fun getPropertyTypeHint(): ClassName { return when (propertyHintAnnotation) { - is RangeHintAnnotation<*> -> ClassName("$godotApiPackage.${GodotTypes.propertyHint}", "PROPERTY_HINT_RANGE") - is ExpEasingHintAnnotation -> ClassName("$godotApiPackage.${GodotTypes.propertyHint}", "PROPERTY_HINT_EXP_EASING") + is RangeHintAnnotation<*> -> ClassName("$godotPackage.${GodotTypes.propertyHint}", "PROPERTY_HINT_RANGE") + is ExpEasingHintAnnotation -> ClassName("$godotPackage.${GodotTypes.propertyHint}", "PROPERTY_HINT_EXP_EASING") is FileHintAnnotation -> if (propertyHintAnnotation.global) { - ClassName("$godotApiPackage.${GodotTypes.propertyHint}", "PROPERTY_HINT_GLOBAL_FILE") + ClassName("$godotPackage.${GodotTypes.propertyHint}", "PROPERTY_HINT_GLOBAL_FILE") } else { - ClassName("$godotApiPackage.${GodotTypes.propertyHint}", "PROPERTY_HINT_FILE") + ClassName("$godotPackage.${GodotTypes.propertyHint}", "PROPERTY_HINT_FILE") } is DirHintAnnotation -> if (propertyHintAnnotation.global) { - ClassName("$godotApiPackage.${GodotTypes.propertyHint}", "PROPERTY_HINT_GLOBAL_DIR") + ClassName("$godotPackage.${GodotTypes.propertyHint}", "PROPERTY_HINT_GLOBAL_DIR") } else { - ClassName("$godotApiPackage.${GodotTypes.propertyHint}", "PROPERTY_HINT_DIR") + ClassName("$godotPackage.${GodotTypes.propertyHint}", "PROPERTY_HINT_DIR") } - is MultilineTextHintAnnotation -> ClassName("$godotApiPackage.${GodotTypes.propertyHint}", "PROPERTY_HINT_MULTILINE_TEXT") - is PlaceHolderTextHintAnnotation -> ClassName("$godotApiPackage.${GodotTypes.propertyHint}", "PROPERTY_HINT_PLACE_HOLDER_TEXT") - null -> ClassName("$godotApiPackage.${GodotTypes.propertyHint}", "PROPERTY_HINT_NONE") + is MultilineTextHintAnnotation -> ClassName("$godotPackage.${GodotTypes.propertyHint}", "PROPERTY_HINT_MULTILINE_TEXT") + is PlaceHolderTextHintAnnotation -> ClassName("$godotPackage.${GodotTypes.propertyHint}", "PROPERTY_HINT_PLACE_HOLDER_TEXT") + null -> ClassName("$godotPackage.${GodotTypes.propertyHint}", "PROPERTY_HINT_NONE") else -> throw WrongAnnotationUsageException(registeredProperty, propertyHintAnnotation) } diff --git a/kt/entry-generation/godot-entry-generator/src/main/kotlin/godot/entrygenerator/model/Clazz.kt b/kt/entry-generation/godot-entry-generator/src/main/kotlin/godot/entrygenerator/model/Clazz.kt index a056518ca8..aa9823912e 100644 --- a/kt/entry-generation/godot-entry-generator/src/main/kotlin/godot/entrygenerator/model/Clazz.kt +++ b/kt/entry-generation/godot-entry-generator/src/main/kotlin/godot/entrygenerator/model/Clazz.kt @@ -2,7 +2,7 @@ package godot.entrygenerator.model import godot.entrygenerator.ext.hasAnnotation import godot.tools.common.constants.GodotKotlinJvmTypes -import godot.tools.common.constants.godotApiPackage +import godot.tools.common.constants.godotPackage open class Clazz( open val fqName: String, @@ -26,5 +26,5 @@ open class Clazz( ?.hasAnnotation() == true internal val inheritsRefCounted: Boolean - get() = supertypes.any { it.fqName == "$godotApiPackage.${GodotKotlinJvmTypes.refCounted}" } + get() = supertypes.any { it.fqName == "$godotPackage.${GodotKotlinJvmTypes.refCounted}" } } diff --git a/kt/entry-generation/godot-kotlin-symbol-processor/build.gradle.kts b/kt/entry-generation/godot-kotlin-symbol-processor/build.gradle.kts index 926cc123aa..52b077950c 100644 --- a/kt/entry-generation/godot-kotlin-symbol-processor/build.gradle.kts +++ b/kt/entry-generation/godot-kotlin-symbol-processor/build.gradle.kts @@ -13,7 +13,8 @@ kotlin { dependencies { implementation("com.utopia-rise:tools-common:$fullGodotKotlinJvmVersion") - implementation(project(":godot-library")) + implementation(project(":godot-core-library")) + implementation(project(":godot-api-library")) implementation(project(":godot-entry-generator")) implementation(libs.ksp) diff --git a/kt/entry-generation/godot-kotlin-symbol-processor/src/main/kotlin/godot/annotation/processor/ext/ksAnnotationExt.kt b/kt/entry-generation/godot-kotlin-symbol-processor/src/main/kotlin/godot/annotation/processor/ext/ksAnnotationExt.kt index 78daf22c9e..8b61540101 100644 --- a/kt/entry-generation/godot-kotlin-symbol-processor/src/main/kotlin/godot/annotation/processor/ext/ksAnnotationExt.kt +++ b/kt/entry-generation/godot-kotlin-symbol-processor/src/main/kotlin/godot/annotation/processor/ext/ksAnnotationExt.kt @@ -58,9 +58,9 @@ internal val KSAnnotation.rangeEnum: Range ?.asString() ?.let { enumFqName -> when (enumFqName) { - "${godot.registration.Range::class.qualifiedName}.${godot.registration.Range.NONE.name}" -> Range.NONE - "${godot.registration.Range::class.qualifiedName}.${godot.registration.Range.OR_GREATER.name}" -> Range.OR_GREATER - "${godot.registration.Range::class.qualifiedName}.${godot.registration.Range.OR_LESSER.name}" -> Range.OR_LESSER + "${godot.annotation.Range::class.qualifiedName}.${godot.annotation.Range.NONE.name}" -> Range.NONE + "${godot.annotation.Range::class.qualifiedName}.${godot.annotation.Range.OR_GREATER.name}" -> Range.OR_GREATER + "${godot.annotation.Range::class.qualifiedName}.${godot.annotation.Range.OR_LESSER.name}" -> Range.OR_LESSER else -> throw IllegalArgumentException("Unknown enum $enumFqName for hint annotation IntRange") } } ?: Range.NONE diff --git a/kt/godot-coroutine-library/build.gradle.kts b/kt/godot-coroutine-library/build.gradle.kts deleted file mode 100644 index 057725f415..0000000000 --- a/kt/godot-coroutine-library/build.gradle.kts +++ /dev/null @@ -1,58 +0,0 @@ -import versioninfo.fullGodotKotlinJvmVersion - -plugins { - alias(libs.plugins.kotlin.jvm) - id("com.utopia-rise.godot-publish") - id("com.utopia-rise.versioninfo") - alias(libs.plugins.kotlinPreProcessors) -} - -val isRelease = project.hasProperty("release") - -kotlinDefinitions { - definitionsObjectName.set("GodotJvmBuildConfig") - - define("DEBUG", !isRelease) -} - - -kotlin { - jvmToolchain(11) -} - -java { - withSourcesJar() - withJavadocJar() -} - -dependencies { - compileOnly(project(":godot-library")) - implementation("com.utopia-rise:tools-common:$fullGodotKotlinJvmVersion") - api("org.jetbrains.kotlinx:kotlinx-coroutines-core:${libs.versions.kotlinCoroutine.get()}") -} - -tasks { - // here so the sourcesJar task has an explicit dependency on the generateApi task. Needed since gradle 8 - getByName("sourcesJar") { - dependsOn(":godot-library:sourcesJar") - } -} - -val targetSuffix = if (isRelease) "release" else "debug" - -publishing { - publications { - @Suppress("UNUSED_VARIABLE") - val godotCoroutineLibraryPublication by creating(MavenPublication::class) { - pom { - name.set("${project.name}-$targetSuffix") - description.set("Godot library extension allowing the use of coroutines in a Godot context.") - } - artifactId = "godot-coroutine-library-$targetSuffix" - description = "Godot library extension allowing the use of coroutines in a Godot context." - artifact(tasks.jar) - artifact(tasks.getByName("sourcesJar")) - artifact(tasks.getByName("javadocJar")) - } - } -} diff --git a/kt/godot-library/build.gradle.kts b/kt/godot-library/build.gradle.kts deleted file mode 100644 index b953bf0c76..0000000000 --- a/kt/godot-library/build.gradle.kts +++ /dev/null @@ -1,100 +0,0 @@ -import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar -import versioninfo.fullGodotKotlinJvmVersion - -plugins { - alias(libs.plugins.kotlin.jvm) - id("com.utopia-rise.api-generator") - id("com.utopia-rise.godot-publish") - id("com.utopia-rise.versioninfo") - alias(libs.plugins.shadowJar) - alias(libs.plugins.kotlinPreProcessors) -} - -val isRelease = project.hasProperty("release") - -kotlinDefinitions { - definitionsObjectName.set("GodotJvmBuildConfig") - - define("DEBUG", !isRelease) -} - -apiGenerator { - sourceJson.set(project.file("$rootDir/api-generator/src/main/resources/api.json")) - coreOutputDir.set(project.file("$rootDir/godot-library/src/main/kotlin/godot/gen")) - coroutineOutputDir.set(project.file("$rootDir/godot-coroutine-library/src/main/kotlin/gen")) -} - -kotlin { - jvmToolchain(11) -} - -java { - withSourcesJar() - withJavadocJar() -} - -dependencies { - // added here as a transitive dependency so the user can use reflection - // we need to add it here so reflection is available where the code is loaded (Bootstrap.kt) otherwise it will not work - api(kotlin("reflect", version = libs.versions.kotlin.get())) - implementation("com.utopia-rise:tools-common:$fullGodotKotlinJvmVersion") - testImplementation("junit", "junit", "4.12") -} - - -tasks { - compileKotlin { - dependsOn(generateAPI) - } - - build.get().finalizedBy(shadowJar) - - @Suppress("UNUSED_VARIABLE") - val jar by getting { - outputs.upToDateWhen { - // force this to always run. So we ensure that the bootstrap jar in the godot bin dir is always up to date - // only relevant for local testing - false - } - finalizedBy(shadowJar) - } - - val copyBootstrapJar by creating(Copy::class.java) { - group = "godot-kotlin-jvm" - from(shadowJar) - destinationDir = File("${projectDir.absolutePath}/../../../../bin/") - dependsOn(shadowJar) - } - - withType { - archiveBaseName.set("godot-bootstrap") - archiveVersion.set("") - archiveClassifier.set("") - exclude("**/module-info.class") //for android support: excludes java 9+ module info which cannot be parsed by the dx tool - finalizedBy(copyBootstrapJar) - } - - // here so the sourcesJar task has an explicit dependency on the generateApi task. Needed since gradle 8 - withType { - dependsOn(generateAPI) - } -} - -val targetSuffix = if (isRelease) "release" else "debug" - -publishing { - publications { - @Suppress("UNUSED_VARIABLE") - val godotLibraryPublication by creating(MavenPublication::class) { - pom { - name.set("${project.name}-$targetSuffix") - description.set("Contains godot api as kotlin classes and jvm cpp interaction code.") - } - artifactId = "godot-library-$targetSuffix" - description = "Contains godot api as kotlin classes and jvm cpp interaction code." - artifact(tasks.jar) - artifact(tasks.getByName("sourcesJar")) - artifact(tasks.getByName("javadocJar")) - } - } -} diff --git a/kt/godot-library/godot-api-library/build.gradle.kts b/kt/godot-library/godot-api-library/build.gradle.kts new file mode 100644 index 0000000000..75c1ad8579 --- /dev/null +++ b/kt/godot-library/godot-api-library/build.gradle.kts @@ -0,0 +1,88 @@ +import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar +import versioninfo.fullGodotKotlinJvmVersion + +plugins { + alias(libs.plugins.kotlin.jvm) + id("com.utopia-rise.godot-publish") + id("com.utopia-rise.versioninfo") + alias(libs.plugins.shadowJar) + alias(libs.plugins.kotlinPreProcessors) +} + +val isRelease = project.hasProperty("release") + +kotlinDefinitions { + definitionsObjectName.set("GodotJvmBuildConfig") + + define("DEBUG", !isRelease) +} + +kotlin { + jvmToolchain(11) +} + +java { + withSourcesJar() + withJavadocJar() +} + +dependencies { + // added here as a transitive dependency so the user can use reflection + // we need to add it here so reflection is available where the code is loaded (Bootstrap.kt) otherwise it will not work + api(kotlin("reflect", version = libs.versions.kotlin.get())) + api(project(":godot-core-library")) +} + + +tasks { + // here so the sourcesJar task has an explicit dependency on the generateApi task. Needed since gradle 8 + getByName("sourcesJar") { + dependsOn(":godot-core-library:sourcesJar") + } + + build.get().finalizedBy(shadowJar) + + @Suppress("UNUSED_VARIABLE") + val jar by getting { + outputs.upToDateWhen { + // force this to always run. So we ensure that the bootstrap jar in the godot bin dir is always up to date + // only relevant for local testing + false + } + finalizedBy(shadowJar) + } + + val copyBootstrapJar by creating(Copy::class.java) { + group = "godot-kotlin-jvm" + from(shadowJar) + destinationDir = File("${projectDir.absolutePath}/../../../../../bin/") + dependsOn(shadowJar) + } + + withType { + archiveBaseName.set("godot-bootstrap") + archiveVersion.set("") + archiveClassifier.set("") + exclude("**/module-info.class") //for android support: excludes java 9+ module info which cannot be parsed by the dx tool + finalizedBy(copyBootstrapJar) + } +} + +val targetSuffix = if (isRelease) "release" else "debug" + +publishing { + publications { + @Suppress("UNUSED_VARIABLE") + val godotLibraryPublication by creating(MavenPublication::class) { + pom { + name.set("${project.name}-$targetSuffix") + description.set("Contains godot api as kotlin classes and jvm cpp interaction code.") + } + artifactId = "godot-api-library-$targetSuffix" + description = "Contains godot generated api as kotlin classes and jvm cpp interaction code." + artifact(tasks.jar) + artifact(tasks.getByName("sourcesJar")) + artifact(tasks.getByName("javadocJar")) + } + } +} diff --git a/kt/godot-library/src/main/kotlin/godot/extensions/NodeExt.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/extension/NodeExt.kt similarity index 90% rename from kt/godot-library/src/main/kotlin/godot/extensions/NodeExt.kt rename to kt/godot-library/godot-api-library/src/main/kotlin/godot/extension/NodeExt.kt index 01fad16ea8..9cbfc61476 100644 --- a/kt/godot-library/src/main/kotlin/godot/extensions/NodeExt.kt +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/extension/NodeExt.kt @@ -1,5 +1,5 @@ -@file:JvmName("NodeUtils") -package godot.extensions +@file:JvmName("NodeExt") +package godot.extension import godot.Node import godot.core.NodePath diff --git a/kt/godot-library/src/main/kotlin/godot/extensions/ObjectExt.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/extension/ObjectExt.kt similarity index 96% rename from kt/godot-library/src/main/kotlin/godot/extensions/ObjectExt.kt rename to kt/godot-library/godot-api-library/src/main/kotlin/godot/extension/ObjectExt.kt index 0cc1845e60..5213506860 100644 --- a/kt/godot-library/src/main/kotlin/godot/extensions/ObjectExt.kt +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/extension/ObjectExt.kt @@ -1,15 +1,16 @@ -@file:JvmName("ObjectUtils") +@file:JvmName("ObjectExt") + +package godot.extension -package godot.extensions import godot.Object import godot.RefCounted import godot.core.Callable import godot.core.VariantArray -import godot.core.memory.MemoryManager import godot.core.Signal import godot.core.asCachedStringName import godot.core.toGodotName +import godot.util.Internals import kotlin.reflect.KFunction /** @@ -141,8 +142,8 @@ fun T.asStatic(): T { if (this == null || this is RefCounted) { return this } - MemoryManager.registerCallback { - if (!MemoryManager.isInstanceValid(this)) { + Internals.registerCallback { + if (!Internals.isInstanceValid(this)) { return@registerCallback } free() diff --git a/kt/godot-library/src/main/kotlin/godot/extensions/PackedSceneExt.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/extension/PackedSceneExt.kt similarity index 82% rename from kt/godot-library/src/main/kotlin/godot/extensions/PackedSceneExt.kt rename to kt/godot-library/godot-api-library/src/main/kotlin/godot/extension/PackedSceneExt.kt index d8a5392919..b280337f88 100644 --- a/kt/godot-library/src/main/kotlin/godot/extensions/PackedSceneExt.kt +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/extension/PackedSceneExt.kt @@ -1,5 +1,6 @@ -@file:JvmName("PackedSceneUtils") -package godot.extensions +@file:JvmName("PackedSceneExt") +package godot.extension + import godot.Node import godot.PackedScene diff --git a/kt/godot-library/src/main/kotlin/godot/extensions/ResourceLoaderExt.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/extension/ResourceLoaderExt.kt similarity index 84% rename from kt/godot-library/src/main/kotlin/godot/extensions/ResourceLoaderExt.kt rename to kt/godot-library/godot-api-library/src/main/kotlin/godot/extension/ResourceLoaderExt.kt index 69661aa9c9..d873a92f1e 100644 --- a/kt/godot-library/src/main/kotlin/godot/extensions/ResourceLoaderExt.kt +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/extension/ResourceLoaderExt.kt @@ -1,5 +1,6 @@ -@file:JvmName("ResourceLoaderUtils") -package godot.extensions +@file:JvmName("ResourceLoaderExt") +package godot.extension + import godot.Resource import godot.ResourceLoader diff --git a/kt/godot-library/godot-api-library/src/main/kotlin/godot/extension/SignalExt.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/extension/SignalExt.kt new file mode 100644 index 0000000000..e9d5c1cf65 --- /dev/null +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/extension/SignalExt.kt @@ -0,0 +1,21 @@ +@file:JvmName("SignalExt") +package godot.extension + +import godot.Node +import godot.core.Callable +import godot.core.Signal +import godot.core.asStringName + +private val connectMethodName = "connect".asStringName() + +fun Signal.connectThreadSafe( + callable: Callable, + flags: Int = 0 +): Any? { + val obj = godotObject + return if(obj is Node){ + obj.callThreadSafe(connectMethodName, name, callable, flags.toLong()) + } else { + obj.connect(name, callable, flags.toLong()) + } +} diff --git a/kt/godot-library/src/main/kotlin/godot/gen/godot/AESContext.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AESContext.kt similarity index 81% rename from kt/godot-library/src/main/kotlin/godot/gen/godot/AESContext.kt rename to kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AESContext.kt index 8bb8312c9b..f5187a6749 100644 --- a/kt/godot-library/src/main/kotlin/godot/gen/godot/AESContext.kt +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AESContext.kt @@ -8,11 +8,10 @@ package godot import godot.`annotation`.GodotBaseType import godot.core.PackedByteArray -import godot.core.TypeManager import godot.core.VariantParser.LONG import godot.core.VariantParser.NIL import godot.core.VariantParser.PACKED_BYTE_ARRAY -import godot.core.memory.TransferContext +import godot.util.Internals import godot.util.VoidPtr import kotlin.Int import kotlin.Long @@ -20,6 +19,8 @@ import kotlin.Suppress import kotlin.Unit import kotlin.jvm.JvmOverloads +private const val ENGINE_CLASS_AESCONTEXT_INDEX: Int = 38 + /** * This class holds the context information required for encryption and decryption operations with * AES (Advanced Encryption Standard). Both AES-ECB and AES-CBC modes are supported. @@ -100,7 +101,7 @@ import kotlin.jvm.JvmOverloads @GodotBaseType public open class AESContext : RefCounted() { public override fun new(scriptIndex: Int): Unit { - callConstructor(ENGINECLASS_AESCONTEXT, scriptIndex) + Internals.callConstructor(this, ENGINE_CLASS_AESCONTEXT_INDEX, scriptIndex) } /** @@ -114,9 +115,9 @@ public open class AESContext : RefCounted() { key: PackedByteArray, iv: PackedByteArray = PackedByteArray(), ): Error { - TransferContext.writeArguments(LONG to mode.id, PACKED_BYTE_ARRAY to key, PACKED_BYTE_ARRAY to iv) - TransferContext.callMethod(rawPtr, MethodBindings.startPtr, LONG) - return Error.from(TransferContext.readReturnValue(LONG) as Long) + Internals.writeArguments(LONG to mode.id, PACKED_BYTE_ARRAY to key, PACKED_BYTE_ARRAY to iv) + Internals.callMethod(rawPtr, MethodBindings.startPtr, LONG) + return Error.from(Internals.readReturnValue(LONG) as Long) } /** @@ -125,9 +126,9 @@ public open class AESContext : RefCounted() { * **Note:** The size of [src] must be a multiple of 16. Apply some padding if needed. */ public final fun update(src: PackedByteArray): PackedByteArray { - TransferContext.writeArguments(PACKED_BYTE_ARRAY to src) - TransferContext.callMethod(rawPtr, MethodBindings.updatePtr, PACKED_BYTE_ARRAY) - return (TransferContext.readReturnValue(PACKED_BYTE_ARRAY) as PackedByteArray) + Internals.writeArguments(PACKED_BYTE_ARRAY to src) + Internals.callMethod(rawPtr, MethodBindings.updatePtr, PACKED_BYTE_ARRAY) + return (Internals.readReturnValue(PACKED_BYTE_ARRAY) as PackedByteArray) } /** @@ -137,17 +138,17 @@ public open class AESContext : RefCounted() { * [MODE_CBC_DECRYPT]. */ public final fun getIvState(): PackedByteArray { - TransferContext.writeArguments() - TransferContext.callMethod(rawPtr, MethodBindings.getIvStatePtr, PACKED_BYTE_ARRAY) - return (TransferContext.readReturnValue(PACKED_BYTE_ARRAY) as PackedByteArray) + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getIvStatePtr, PACKED_BYTE_ARRAY) + return (Internals.readReturnValue(PACKED_BYTE_ARRAY) as PackedByteArray) } /** * Close this AES context so it can be started again. See [start]. */ public final fun finish(): Unit { - TransferContext.writeArguments() - TransferContext.callMethod(rawPtr, MethodBindings.finishPtr, NIL) + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.finishPtr, NIL) } public enum class Mode( @@ -187,14 +188,14 @@ public open class AESContext : RefCounted() { public companion object - internal object MethodBindings { - public val startPtr: VoidPtr = TypeManager.getMethodBindPtr("AESContext", "start", 3122411423) + public object MethodBindings { + internal val startPtr: VoidPtr = Internals.getMethodBindPtr("AESContext", "start", 3122411423) - public val updatePtr: VoidPtr = TypeManager.getMethodBindPtr("AESContext", "update", 527836100) + internal val updatePtr: VoidPtr = Internals.getMethodBindPtr("AESContext", "update", 527836100) - public val getIvStatePtr: VoidPtr = - TypeManager.getMethodBindPtr("AESContext", "get_iv_state", 2115431945) + internal val getIvStatePtr: VoidPtr = + Internals.getMethodBindPtr("AESContext", "get_iv_state", 2115431945) - public val finishPtr: VoidPtr = TypeManager.getMethodBindPtr("AESContext", "finish", 3218959716) + internal val finishPtr: VoidPtr = Internals.getMethodBindPtr("AESContext", "finish", 3218959716) } } diff --git a/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AStar2D.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AStar2D.kt new file mode 100644 index 0000000000..7cf150f3b9 --- /dev/null +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AStar2D.kt @@ -0,0 +1,497 @@ +// THIS FILE IS GENERATED! DO NOT EDIT IT MANUALLY! +@file:Suppress("PackageDirectoryMismatch", "unused", "FunctionName", "RedundantModalityModifier", + "UNCHECKED_CAST", "JoinDeclarationAndAssignment", "USELESS_CAST", + "RemoveRedundantQualifierName", "NOTHING_TO_INLINE", "NON_FINAL_MEMBER_IN_OBJECT", + "RedundantVisibilityModifier", "RedundantUnitReturnType", "MemberVisibilityCanBePrivate") + +package godot + +import godot.`annotation`.GodotBaseType +import godot.core.PackedInt64Array +import godot.core.PackedVector2Array +import godot.core.VariantParser.BOOL +import godot.core.VariantParser.DOUBLE +import godot.core.VariantParser.LONG +import godot.core.VariantParser.NIL +import godot.core.VariantParser.PACKED_INT_64_ARRAY +import godot.core.VariantParser.PACKED_VECTOR2_ARRAY +import godot.core.VariantParser.VECTOR2 +import godot.core.Vector2 +import godot.util.Internals +import godot.util.VoidPtr +import kotlin.Boolean +import kotlin.Double +import kotlin.Float +import kotlin.Int +import kotlin.Long +import kotlin.NotImplementedError +import kotlin.Suppress +import kotlin.Unit +import kotlin.jvm.JvmOverloads + +private const val ENGINE_CLASS_ASTAR2D_INDEX: Int = 39 + +/** + * An implementation of the A* algorithm, used to find the shortest path between two vertices on a + * connected graph in 2D space. + * See [AStar3D] for a more thorough explanation on how to use this class. [AStar2D] is a wrapper + * for [AStar3D] that enforces 2D coordinates. + */ +@GodotBaseType +public open class AStar2D : RefCounted() { + public override fun new(scriptIndex: Int): Unit { + Internals.callConstructor(this, ENGINE_CLASS_ASTAR2D_INDEX, scriptIndex) + } + + /** + * Called when estimating the cost between a point and the path's ending point. + * Note that this function is hidden in the default [AStar2D] class. + */ + public open fun _estimateCost(fromId: Long, toId: Long): Float { + throw NotImplementedError("_estimate_cost is not implemented for AStar2D") + } + + /** + * Called when computing the cost between two connected points. + * Note that this function is hidden in the default [AStar2D] class. + */ + public open fun _computeCost(fromId: Long, toId: Long): Float { + throw NotImplementedError("_compute_cost is not implemented for AStar2D") + } + + /** + * Returns the next available point ID with no point associated to it. + */ + public final fun getAvailablePointId(): Long { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getAvailablePointIdPtr, LONG) + return (Internals.readReturnValue(LONG) as Long) + } + + /** + * Adds a new point at the given position with the given identifier. The [id] must be 0 or larger, + * and the [weightScale] must be 0.0 or greater. + * The [weightScale] is multiplied by the result of [_computeCost] when determining the overall + * cost of traveling across a segment from a neighboring point to this point. Thus, all else being + * equal, the algorithm prefers points with lower [weightScale]s to form a path. + * + * gdscript: + * ```gdscript + * var astar = AStar2D.new() + * astar.add_point(1, Vector2(1, 0), 4) # Adds the point (1, 0) with weight_scale 4 and id 1 + * ``` + * csharp: + * ```csharp + * var astar = new AStar2D(); + * astar.AddPoint(1, new Vector2(1, 0), 4); // Adds the point (1, 0) with weight_scale 4 and id 1 + * ``` + * + * If there already exists a point for the given [id], its position and weight scale are updated + * to the given values. + */ + @JvmOverloads + public final fun addPoint( + id: Long, + position: Vector2, + weightScale: Float = 1.0f, + ): Unit { + Internals.writeArguments(LONG to id, VECTOR2 to position, DOUBLE to weightScale.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.addPointPtr, NIL) + } + + /** + * Returns the position of the point associated with the given [id]. + */ + public final fun getPointPosition(id: Long): Vector2 { + Internals.writeArguments(LONG to id) + Internals.callMethod(rawPtr, MethodBindings.getPointPositionPtr, VECTOR2) + return (Internals.readReturnValue(VECTOR2) as Vector2) + } + + /** + * Sets the [position] for the point with the given [id]. + */ + public final fun setPointPosition(id: Long, position: Vector2): Unit { + Internals.writeArguments(LONG to id, VECTOR2 to position) + Internals.callMethod(rawPtr, MethodBindings.setPointPositionPtr, NIL) + } + + /** + * Returns the weight scale of the point associated with the given [id]. + */ + public final fun getPointWeightScale(id: Long): Float { + Internals.writeArguments(LONG to id) + Internals.callMethod(rawPtr, MethodBindings.getPointWeightScalePtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + /** + * Sets the [weightScale] for the point with the given [id]. The [weightScale] is multiplied by + * the result of [_computeCost] when determining the overall cost of traveling across a segment from + * a neighboring point to this point. + */ + public final fun setPointWeightScale(id: Long, weightScale: Float): Unit { + Internals.writeArguments(LONG to id, DOUBLE to weightScale.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setPointWeightScalePtr, NIL) + } + + /** + * Removes the point associated with the given [id] from the points pool. + */ + public final fun removePoint(id: Long): Unit { + Internals.writeArguments(LONG to id) + Internals.callMethod(rawPtr, MethodBindings.removePointPtr, NIL) + } + + /** + * Returns whether a point associated with the given [id] exists. + */ + public final fun hasPoint(id: Long): Boolean { + Internals.writeArguments(LONG to id) + Internals.callMethod(rawPtr, MethodBindings.hasPointPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + /** + * Returns an array with the IDs of the points that form the connection with the given point. + * + * gdscript: + * ```gdscript + * var astar = AStar2D.new() + * astar.add_point(1, Vector2(0, 0)) + * astar.add_point(2, Vector2(0, 1)) + * astar.add_point(3, Vector2(1, 1)) + * astar.add_point(4, Vector2(2, 0)) + * + * astar.connect_points(1, 2, true) + * astar.connect_points(1, 3, true) + * + * var neighbors = astar.get_point_connections(1) # Returns [2, 3] + * ``` + * csharp: + * ```csharp + * var astar = new AStar2D(); + * astar.AddPoint(1, new Vector2(0, 0)); + * astar.AddPoint(2, new Vector2(0, 1)); + * astar.AddPoint(3, new Vector2(1, 1)); + * astar.AddPoint(4, new Vector2(2, 0)); + * + * astar.ConnectPoints(1, 2, true); + * astar.ConnectPoints(1, 3, true); + * + * int[] neighbors = astar.GetPointConnections(1); // Returns [2, 3] + * ``` + */ + public final fun getPointConnections(id: Long): PackedInt64Array { + Internals.writeArguments(LONG to id) + Internals.callMethod(rawPtr, MethodBindings.getPointConnectionsPtr, PACKED_INT_64_ARRAY) + return (Internals.readReturnValue(PACKED_INT_64_ARRAY) as PackedInt64Array) + } + + /** + * Returns an array of all point IDs. + */ + public final fun getPointIds(): PackedInt64Array { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getPointIdsPtr, PACKED_INT_64_ARRAY) + return (Internals.readReturnValue(PACKED_INT_64_ARRAY) as PackedInt64Array) + } + + /** + * Disables or enables the specified point for pathfinding. Useful for making a temporary + * obstacle. + */ + @JvmOverloads + public final fun setPointDisabled(id: Long, disabled: Boolean = true): Unit { + Internals.writeArguments(LONG to id, BOOL to disabled) + Internals.callMethod(rawPtr, MethodBindings.setPointDisabledPtr, NIL) + } + + /** + * Returns whether a point is disabled or not for pathfinding. By default, all points are enabled. + */ + public final fun isPointDisabled(id: Long): Boolean { + Internals.writeArguments(LONG to id) + Internals.callMethod(rawPtr, MethodBindings.isPointDisabledPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + /** + * Creates a segment between the given points. If [bidirectional] is `false`, only movement from + * [id] to [toId] is allowed, not the reverse direction. + * + * gdscript: + * ```gdscript + * var astar = AStar2D.new() + * astar.add_point(1, Vector2(1, 1)) + * astar.add_point(2, Vector2(0, 5)) + * astar.connect_points(1, 2, false) + * ``` + * csharp: + * ```csharp + * var astar = new AStar2D(); + * astar.AddPoint(1, new Vector2(1, 1)); + * astar.AddPoint(2, new Vector2(0, 5)); + * astar.ConnectPoints(1, 2, false); + * ``` + */ + @JvmOverloads + public final fun connectPoints( + id: Long, + toId: Long, + bidirectional: Boolean = true, + ): Unit { + Internals.writeArguments(LONG to id, LONG to toId, BOOL to bidirectional) + Internals.callMethod(rawPtr, MethodBindings.connectPointsPtr, NIL) + } + + /** + * Deletes the segment between the given points. If [bidirectional] is `false`, only movement from + * [id] to [toId] is prevented, and a unidirectional segment possibly remains. + */ + @JvmOverloads + public final fun disconnectPoints( + id: Long, + toId: Long, + bidirectional: Boolean = true, + ): Unit { + Internals.writeArguments(LONG to id, LONG to toId, BOOL to bidirectional) + Internals.callMethod(rawPtr, MethodBindings.disconnectPointsPtr, NIL) + } + + /** + * Returns whether there is a connection/segment between the given points. If [bidirectional] is + * `false`, returns whether movement from [id] to [toId] is possible through this segment. + */ + @JvmOverloads + public final fun arePointsConnected( + id: Long, + toId: Long, + bidirectional: Boolean = true, + ): Boolean { + Internals.writeArguments(LONG to id, LONG to toId, BOOL to bidirectional) + Internals.callMethod(rawPtr, MethodBindings.arePointsConnectedPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + /** + * Returns the number of points currently in the points pool. + */ + public final fun getPointCount(): Long { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getPointCountPtr, LONG) + return (Internals.readReturnValue(LONG) as Long) + } + + /** + * Returns the capacity of the structure backing the points, useful in conjunction with + * [reserveSpace]. + */ + public final fun getPointCapacity(): Long { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getPointCapacityPtr, LONG) + return (Internals.readReturnValue(LONG) as Long) + } + + /** + * Reserves space internally for [numNodes] points, useful if you're adding a known large number + * of points at once, such as points on a grid. New capacity must be greater or equals to old + * capacity. + */ + public final fun reserveSpace(numNodes: Long): Unit { + Internals.writeArguments(LONG to numNodes) + Internals.callMethod(rawPtr, MethodBindings.reserveSpacePtr, NIL) + } + + /** + * Clears all the points and segments. + */ + public final fun clear(): Unit { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.clearPtr, NIL) + } + + /** + * Returns the ID of the closest point to [toPosition], optionally taking disabled points into + * account. Returns `-1` if there are no points in the points pool. + * **Note:** If several points are the closest to [toPosition], the one with the smallest ID will + * be returned, ensuring a deterministic result. + */ + @JvmOverloads + public final fun getClosestPoint(toPosition: Vector2, includeDisabled: Boolean = false): Long { + Internals.writeArguments(VECTOR2 to toPosition, BOOL to includeDisabled) + Internals.callMethod(rawPtr, MethodBindings.getClosestPointPtr, LONG) + return (Internals.readReturnValue(LONG) as Long) + } + + /** + * Returns the closest position to [toPosition] that resides inside a segment between two + * connected points. + * + * gdscript: + * ```gdscript + * var astar = AStar2D.new() + * astar.add_point(1, Vector2(0, 0)) + * astar.add_point(2, Vector2(0, 5)) + * astar.connect_points(1, 2) + * var res = astar.get_closest_position_in_segment(Vector2(3, 3)) # Returns (0, 3) + * ``` + * csharp: + * ```csharp + * var astar = new AStar2D(); + * astar.AddPoint(1, new Vector2(0, 0)); + * astar.AddPoint(2, new Vector2(0, 5)); + * astar.ConnectPoints(1, 2); + * Vector2 res = astar.GetClosestPositionInSegment(new Vector2(3, 3)); // Returns (0, 3) + * ``` + * + * The result is in the segment that goes from `y = 0` to `y = 5`. It's the closest position in + * the segment to the given point. + */ + public final fun getClosestPositionInSegment(toPosition: Vector2): Vector2 { + Internals.writeArguments(VECTOR2 to toPosition) + Internals.callMethod(rawPtr, MethodBindings.getClosestPositionInSegmentPtr, VECTOR2) + return (Internals.readReturnValue(VECTOR2) as Vector2) + } + + /** + * Returns an array with the points that are in the path found by AStar2D between the given + * points. The array is ordered from the starting point to the ending point of the path. + * If there is no valid path to the target, and [allowPartialPath] is `true`, returns a path to + * the point closest to the target that can be reached. + * **Note:** This method is not thread-safe. If called from a [Thread], it will return an empty + * array and will print an error message. + */ + @JvmOverloads + public final fun getPointPath( + fromId: Long, + toId: Long, + allowPartialPath: Boolean = false, + ): PackedVector2Array { + Internals.writeArguments(LONG to fromId, LONG to toId, BOOL to allowPartialPath) + Internals.callMethod(rawPtr, MethodBindings.getPointPathPtr, PACKED_VECTOR2_ARRAY) + return (Internals.readReturnValue(PACKED_VECTOR2_ARRAY) as PackedVector2Array) + } + + /** + * Returns an array with the IDs of the points that form the path found by AStar2D between the + * given points. The array is ordered from the starting point to the ending point of the path. + * If there is no valid path to the target, and [allowPartialPath] is `true`, returns a path to + * the point closest to the target that can be reached. + * + * gdscript: + * ```gdscript + * var astar = AStar2D.new() + * astar.add_point(1, Vector2(0, 0)) + * astar.add_point(2, Vector2(0, 1), 1) # Default weight is 1 + * astar.add_point(3, Vector2(1, 1)) + * astar.add_point(4, Vector2(2, 0)) + * + * astar.connect_points(1, 2, false) + * astar.connect_points(2, 3, false) + * astar.connect_points(4, 3, false) + * astar.connect_points(1, 4, false) + * + * var res = astar.get_id_path(1, 3) # Returns [1, 2, 3] + * ``` + * csharp: + * ```csharp + * var astar = new AStar2D(); + * astar.AddPoint(1, new Vector2(0, 0)); + * astar.AddPoint(2, new Vector2(0, 1), 1); // Default weight is 1 + * astar.AddPoint(3, new Vector2(1, 1)); + * astar.AddPoint(4, new Vector2(2, 0)); + * + * astar.ConnectPoints(1, 2, false); + * astar.ConnectPoints(2, 3, false); + * astar.ConnectPoints(4, 3, false); + * astar.ConnectPoints(1, 4, false); + * int[] res = astar.GetIdPath(1, 3); // Returns [1, 2, 3] + * ``` + * + * If you change the 2nd point's weight to 3, then the result will be `[1, 4, 3]` instead, because + * now even though the distance is longer, it's "easier" to get through point 4 than through point 2. + */ + @JvmOverloads + public final fun getIdPath( + fromId: Long, + toId: Long, + allowPartialPath: Boolean = false, + ): PackedInt64Array { + Internals.writeArguments(LONG to fromId, LONG to toId, BOOL to allowPartialPath) + Internals.callMethod(rawPtr, MethodBindings.getIdPathPtr, PACKED_INT_64_ARRAY) + return (Internals.readReturnValue(PACKED_INT_64_ARRAY) as PackedInt64Array) + } + + public companion object + + public object MethodBindings { + internal val getAvailablePointIdPtr: VoidPtr = + Internals.getMethodBindPtr("AStar2D", "get_available_point_id", 3905245786) + + internal val addPointPtr: VoidPtr = + Internals.getMethodBindPtr("AStar2D", "add_point", 4074201818) + + internal val getPointPositionPtr: VoidPtr = + Internals.getMethodBindPtr("AStar2D", "get_point_position", 2299179447) + + internal val setPointPositionPtr: VoidPtr = + Internals.getMethodBindPtr("AStar2D", "set_point_position", 163021252) + + internal val getPointWeightScalePtr: VoidPtr = + Internals.getMethodBindPtr("AStar2D", "get_point_weight_scale", 2339986948) + + internal val setPointWeightScalePtr: VoidPtr = + Internals.getMethodBindPtr("AStar2D", "set_point_weight_scale", 1602489585) + + internal val removePointPtr: VoidPtr = + Internals.getMethodBindPtr("AStar2D", "remove_point", 1286410249) + + internal val hasPointPtr: VoidPtr = + Internals.getMethodBindPtr("AStar2D", "has_point", 1116898809) + + internal val getPointConnectionsPtr: VoidPtr = + Internals.getMethodBindPtr("AStar2D", "get_point_connections", 2865087369) + + internal val getPointIdsPtr: VoidPtr = + Internals.getMethodBindPtr("AStar2D", "get_point_ids", 3851388692) + + internal val setPointDisabledPtr: VoidPtr = + Internals.getMethodBindPtr("AStar2D", "set_point_disabled", 972357352) + + internal val isPointDisabledPtr: VoidPtr = + Internals.getMethodBindPtr("AStar2D", "is_point_disabled", 1116898809) + + internal val connectPointsPtr: VoidPtr = + Internals.getMethodBindPtr("AStar2D", "connect_points", 3710494224) + + internal val disconnectPointsPtr: VoidPtr = + Internals.getMethodBindPtr("AStar2D", "disconnect_points", 3710494224) + + internal val arePointsConnectedPtr: VoidPtr = + Internals.getMethodBindPtr("AStar2D", "are_points_connected", 2288175859) + + internal val getPointCountPtr: VoidPtr = + Internals.getMethodBindPtr("AStar2D", "get_point_count", 3905245786) + + internal val getPointCapacityPtr: VoidPtr = + Internals.getMethodBindPtr("AStar2D", "get_point_capacity", 3905245786) + + internal val reserveSpacePtr: VoidPtr = + Internals.getMethodBindPtr("AStar2D", "reserve_space", 1286410249) + + internal val clearPtr: VoidPtr = Internals.getMethodBindPtr("AStar2D", "clear", 3218959716) + + internal val getClosestPointPtr: VoidPtr = + Internals.getMethodBindPtr("AStar2D", "get_closest_point", 2300324924) + + internal val getClosestPositionInSegmentPtr: VoidPtr = + Internals.getMethodBindPtr("AStar2D", "get_closest_position_in_segment", 2656412154) + + internal val getPointPathPtr: VoidPtr = + Internals.getMethodBindPtr("AStar2D", "get_point_path", 3427490392) + + internal val getIdPathPtr: VoidPtr = + Internals.getMethodBindPtr("AStar2D", "get_id_path", 3136199648) + } +} diff --git a/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AStar3D.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AStar3D.kt new file mode 100644 index 0000000000..931daa3f83 --- /dev/null +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AStar3D.kt @@ -0,0 +1,541 @@ +// THIS FILE IS GENERATED! DO NOT EDIT IT MANUALLY! +@file:Suppress("PackageDirectoryMismatch", "unused", "FunctionName", "RedundantModalityModifier", + "UNCHECKED_CAST", "JoinDeclarationAndAssignment", "USELESS_CAST", + "RemoveRedundantQualifierName", "NOTHING_TO_INLINE", "NON_FINAL_MEMBER_IN_OBJECT", + "RedundantVisibilityModifier", "RedundantUnitReturnType", "MemberVisibilityCanBePrivate") + +package godot + +import godot.`annotation`.GodotBaseType +import godot.core.PackedInt64Array +import godot.core.PackedVector3Array +import godot.core.VariantParser.BOOL +import godot.core.VariantParser.DOUBLE +import godot.core.VariantParser.LONG +import godot.core.VariantParser.NIL +import godot.core.VariantParser.PACKED_INT_64_ARRAY +import godot.core.VariantParser.PACKED_VECTOR3_ARRAY +import godot.core.VariantParser.VECTOR3 +import godot.core.Vector3 +import godot.util.Internals +import godot.util.VoidPtr +import kotlin.Boolean +import kotlin.Double +import kotlin.Float +import kotlin.Int +import kotlin.Long +import kotlin.NotImplementedError +import kotlin.Suppress +import kotlin.Unit +import kotlin.jvm.JvmOverloads + +private const val ENGINE_CLASS_ASTAR3D_INDEX: Int = 40 + +/** + * A* (A star) is a computer algorithm used in pathfinding and graph traversal, the process of + * plotting short paths among vertices (points), passing through a given set of edges (segments). It + * enjoys widespread use due to its performance and accuracy. Godot's A* implementation uses points in + * 3D space and Euclidean distances by default. + * You must add points manually with [addPoint] and create segments manually with [connectPoints]. + * Once done, you can test if there is a path between two points with the [arePointsConnected] + * function, get a path containing indices by [getIdPath], or one containing actual coordinates with + * [getPointPath]. + * It is also possible to use non-Euclidean distances. To do so, create a class that extends + * [AStar3D] and override methods [_computeCost] and [_estimateCost]. Both take two indices and return + * a length, as is shown in the following example. + * + * gdscript: + * ```gdscript + * class MyAStar: + * extends AStar3D + * + * func _compute_cost(u, v): + * return abs(u - v) + * + * func _estimate_cost(u, v): + * return min(0, abs(u - v) - 1) + * ``` + * csharp: + * ```csharp + * public partial class MyAStar : AStar3D + * { + * public override float _ComputeCost(long fromId, long toId) + * { + * return Mathf.Abs((int)(fromId - toId)); + * } + * + * public override float _EstimateCost(long fromId, long toId) + * { + * return Mathf.Min(0, Mathf.Abs((int)(fromId - toId)) - 1); + * } + * } + * ``` + * + * [_estimateCost] should return a lower bound of the distance, i.e. `_estimate_cost(u, v) <= + * _compute_cost(u, v)`. This serves as a hint to the algorithm because the custom [_computeCost] might + * be computation-heavy. If this is not the case, make [_estimateCost] return the same value as + * [_computeCost] to provide the algorithm with the most accurate information. + * If the default [_estimateCost] and [_computeCost] methods are used, or if the supplied + * [_estimateCost] method returns a lower bound of the cost, then the paths returned by A* will be the + * lowest-cost paths. Here, the cost of a path equals the sum of the [_computeCost] results of all + * segments in the path multiplied by the `weight_scale`s of the endpoints of the respective segments. + * If the default methods are used and the `weight_scale`s of all points are set to `1.0`, then this + * equals the sum of Euclidean distances of all segments in the path. + */ +@GodotBaseType +public open class AStar3D : RefCounted() { + public override fun new(scriptIndex: Int): Unit { + Internals.callConstructor(this, ENGINE_CLASS_ASTAR3D_INDEX, scriptIndex) + } + + /** + * Called when estimating the cost between a point and the path's ending point. + * Note that this function is hidden in the default [AStar3D] class. + */ + public open fun _estimateCost(fromId: Long, toId: Long): Float { + throw NotImplementedError("_estimate_cost is not implemented for AStar3D") + } + + /** + * Called when computing the cost between two connected points. + * Note that this function is hidden in the default [AStar3D] class. + */ + public open fun _computeCost(fromId: Long, toId: Long): Float { + throw NotImplementedError("_compute_cost is not implemented for AStar3D") + } + + /** + * Returns the next available point ID with no point associated to it. + */ + public final fun getAvailablePointId(): Long { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getAvailablePointIdPtr, LONG) + return (Internals.readReturnValue(LONG) as Long) + } + + /** + * Adds a new point at the given position with the given identifier. The [id] must be 0 or larger, + * and the [weightScale] must be 0.0 or greater. + * The [weightScale] is multiplied by the result of [_computeCost] when determining the overall + * cost of traveling across a segment from a neighboring point to this point. Thus, all else being + * equal, the algorithm prefers points with lower [weightScale]s to form a path. + * + * gdscript: + * ```gdscript + * var astar = AStar3D.new() + * astar.add_point(1, Vector3(1, 0, 0), 4) # Adds the point (1, 0, 0) with weight_scale 4 and id 1 + * ``` + * csharp: + * ```csharp + * var astar = new AStar3D(); + * astar.AddPoint(1, new Vector3(1, 0, 0), 4); // Adds the point (1, 0, 0) with weight_scale 4 and + * id 1 + * ``` + * + * If there already exists a point for the given [id], its position and weight scale are updated + * to the given values. + */ + @JvmOverloads + public final fun addPoint( + id: Long, + position: Vector3, + weightScale: Float = 1.0f, + ): Unit { + Internals.writeArguments(LONG to id, VECTOR3 to position, DOUBLE to weightScale.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.addPointPtr, NIL) + } + + /** + * Returns the position of the point associated with the given [id]. + */ + public final fun getPointPosition(id: Long): Vector3 { + Internals.writeArguments(LONG to id) + Internals.callMethod(rawPtr, MethodBindings.getPointPositionPtr, VECTOR3) + return (Internals.readReturnValue(VECTOR3) as Vector3) + } + + /** + * Sets the [position] for the point with the given [id]. + */ + public final fun setPointPosition(id: Long, position: Vector3): Unit { + Internals.writeArguments(LONG to id, VECTOR3 to position) + Internals.callMethod(rawPtr, MethodBindings.setPointPositionPtr, NIL) + } + + /** + * Returns the weight scale of the point associated with the given [id]. + */ + public final fun getPointWeightScale(id: Long): Float { + Internals.writeArguments(LONG to id) + Internals.callMethod(rawPtr, MethodBindings.getPointWeightScalePtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + /** + * Sets the [weightScale] for the point with the given [id]. The [weightScale] is multiplied by + * the result of [_computeCost] when determining the overall cost of traveling across a segment from + * a neighboring point to this point. + */ + public final fun setPointWeightScale(id: Long, weightScale: Float): Unit { + Internals.writeArguments(LONG to id, DOUBLE to weightScale.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setPointWeightScalePtr, NIL) + } + + /** + * Removes the point associated with the given [id] from the points pool. + */ + public final fun removePoint(id: Long): Unit { + Internals.writeArguments(LONG to id) + Internals.callMethod(rawPtr, MethodBindings.removePointPtr, NIL) + } + + /** + * Returns whether a point associated with the given [id] exists. + */ + public final fun hasPoint(id: Long): Boolean { + Internals.writeArguments(LONG to id) + Internals.callMethod(rawPtr, MethodBindings.hasPointPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + /** + * Returns an array with the IDs of the points that form the connection with the given point. + * + * gdscript: + * ```gdscript + * var astar = AStar3D.new() + * astar.add_point(1, Vector3(0, 0, 0)) + * astar.add_point(2, Vector3(0, 1, 0)) + * astar.add_point(3, Vector3(1, 1, 0)) + * astar.add_point(4, Vector3(2, 0, 0)) + * + * astar.connect_points(1, 2, true) + * astar.connect_points(1, 3, true) + * + * var neighbors = astar.get_point_connections(1) # Returns [2, 3] + * ``` + * csharp: + * ```csharp + * var astar = new AStar3D(); + * astar.AddPoint(1, new Vector3(0, 0, 0)); + * astar.AddPoint(2, new Vector3(0, 1, 0)); + * astar.AddPoint(3, new Vector3(1, 1, 0)); + * astar.AddPoint(4, new Vector3(2, 0, 0)); + * astar.ConnectPoints(1, 2, true); + * astar.ConnectPoints(1, 3, true); + * + * int[] neighbors = astar.GetPointConnections(1); // Returns [2, 3] + * ``` + */ + public final fun getPointConnections(id: Long): PackedInt64Array { + Internals.writeArguments(LONG to id) + Internals.callMethod(rawPtr, MethodBindings.getPointConnectionsPtr, PACKED_INT_64_ARRAY) + return (Internals.readReturnValue(PACKED_INT_64_ARRAY) as PackedInt64Array) + } + + /** + * Returns an array of all point IDs. + */ + public final fun getPointIds(): PackedInt64Array { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getPointIdsPtr, PACKED_INT_64_ARRAY) + return (Internals.readReturnValue(PACKED_INT_64_ARRAY) as PackedInt64Array) + } + + /** + * Disables or enables the specified point for pathfinding. Useful for making a temporary + * obstacle. + */ + @JvmOverloads + public final fun setPointDisabled(id: Long, disabled: Boolean = true): Unit { + Internals.writeArguments(LONG to id, BOOL to disabled) + Internals.callMethod(rawPtr, MethodBindings.setPointDisabledPtr, NIL) + } + + /** + * Returns whether a point is disabled or not for pathfinding. By default, all points are enabled. + */ + public final fun isPointDisabled(id: Long): Boolean { + Internals.writeArguments(LONG to id) + Internals.callMethod(rawPtr, MethodBindings.isPointDisabledPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + /** + * Creates a segment between the given points. If [bidirectional] is `false`, only movement from + * [id] to [toId] is allowed, not the reverse direction. + * + * gdscript: + * ```gdscript + * var astar = AStar3D.new() + * astar.add_point(1, Vector3(1, 1, 0)) + * astar.add_point(2, Vector3(0, 5, 0)) + * astar.connect_points(1, 2, false) + * ``` + * csharp: + * ```csharp + * var astar = new AStar3D(); + * astar.AddPoint(1, new Vector3(1, 1, 0)); + * astar.AddPoint(2, new Vector3(0, 5, 0)); + * astar.ConnectPoints(1, 2, false); + * ``` + */ + @JvmOverloads + public final fun connectPoints( + id: Long, + toId: Long, + bidirectional: Boolean = true, + ): Unit { + Internals.writeArguments(LONG to id, LONG to toId, BOOL to bidirectional) + Internals.callMethod(rawPtr, MethodBindings.connectPointsPtr, NIL) + } + + /** + * Deletes the segment between the given points. If [bidirectional] is `false`, only movement from + * [id] to [toId] is prevented, and a unidirectional segment possibly remains. + */ + @JvmOverloads + public final fun disconnectPoints( + id: Long, + toId: Long, + bidirectional: Boolean = true, + ): Unit { + Internals.writeArguments(LONG to id, LONG to toId, BOOL to bidirectional) + Internals.callMethod(rawPtr, MethodBindings.disconnectPointsPtr, NIL) + } + + /** + * Returns whether the two given points are directly connected by a segment. If [bidirectional] is + * `false`, returns whether movement from [id] to [toId] is possible through this segment. + */ + @JvmOverloads + public final fun arePointsConnected( + id: Long, + toId: Long, + bidirectional: Boolean = true, + ): Boolean { + Internals.writeArguments(LONG to id, LONG to toId, BOOL to bidirectional) + Internals.callMethod(rawPtr, MethodBindings.arePointsConnectedPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + /** + * Returns the number of points currently in the points pool. + */ + public final fun getPointCount(): Long { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getPointCountPtr, LONG) + return (Internals.readReturnValue(LONG) as Long) + } + + /** + * Returns the capacity of the structure backing the points, useful in conjunction with + * [reserveSpace]. + */ + public final fun getPointCapacity(): Long { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getPointCapacityPtr, LONG) + return (Internals.readReturnValue(LONG) as Long) + } + + /** + * Reserves space internally for [numNodes] points. Useful if you're adding a known large number + * of points at once, such as points on a grid. New capacity must be greater or equals to old + * capacity. + */ + public final fun reserveSpace(numNodes: Long): Unit { + Internals.writeArguments(LONG to numNodes) + Internals.callMethod(rawPtr, MethodBindings.reserveSpacePtr, NIL) + } + + /** + * Clears all the points and segments. + */ + public final fun clear(): Unit { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.clearPtr, NIL) + } + + /** + * Returns the ID of the closest point to [toPosition], optionally taking disabled points into + * account. Returns `-1` if there are no points in the points pool. + * **Note:** If several points are the closest to [toPosition], the one with the smallest ID will + * be returned, ensuring a deterministic result. + */ + @JvmOverloads + public final fun getClosestPoint(toPosition: Vector3, includeDisabled: Boolean = false): Long { + Internals.writeArguments(VECTOR3 to toPosition, BOOL to includeDisabled) + Internals.callMethod(rawPtr, MethodBindings.getClosestPointPtr, LONG) + return (Internals.readReturnValue(LONG) as Long) + } + + /** + * Returns the closest position to [toPosition] that resides inside a segment between two + * connected points. + * + * gdscript: + * ```gdscript + * var astar = AStar3D.new() + * astar.add_point(1, Vector3(0, 0, 0)) + * astar.add_point(2, Vector3(0, 5, 0)) + * astar.connect_points(1, 2) + * var res = astar.get_closest_position_in_segment(Vector3(3, 3, 0)) # Returns (0, 3, 0) + * ``` + * csharp: + * ```csharp + * var astar = new AStar3D(); + * astar.AddPoint(1, new Vector3(0, 0, 0)); + * astar.AddPoint(2, new Vector3(0, 5, 0)); + * astar.ConnectPoints(1, 2); + * Vector3 res = astar.GetClosestPositionInSegment(new Vector3(3, 3, 0)); // Returns (0, 3, 0) + * ``` + * + * The result is in the segment that goes from `y = 0` to `y = 5`. It's the closest position in + * the segment to the given point. + */ + public final fun getClosestPositionInSegment(toPosition: Vector3): Vector3 { + Internals.writeArguments(VECTOR3 to toPosition) + Internals.callMethod(rawPtr, MethodBindings.getClosestPositionInSegmentPtr, VECTOR3) + return (Internals.readReturnValue(VECTOR3) as Vector3) + } + + /** + * Returns an array with the points that are in the path found by AStar3D between the given + * points. The array is ordered from the starting point to the ending point of the path. + * If there is no valid path to the target, and [allowPartialPath] is `true`, returns a path to + * the point closest to the target that can be reached. + * **Note:** This method is not thread-safe. If called from a [Thread], it will return an empty + * array and will print an error message. + */ + @JvmOverloads + public final fun getPointPath( + fromId: Long, + toId: Long, + allowPartialPath: Boolean = false, + ): PackedVector3Array { + Internals.writeArguments(LONG to fromId, LONG to toId, BOOL to allowPartialPath) + Internals.callMethod(rawPtr, MethodBindings.getPointPathPtr, PACKED_VECTOR3_ARRAY) + return (Internals.readReturnValue(PACKED_VECTOR3_ARRAY) as PackedVector3Array) + } + + /** + * Returns an array with the IDs of the points that form the path found by AStar3D between the + * given points. The array is ordered from the starting point to the ending point of the path. + * If there is no valid path to the target, and [allowPartialPath] is `true`, returns a path to + * the point closest to the target that can be reached. + * + * gdscript: + * ```gdscript + * var astar = AStar3D.new() + * astar.add_point(1, Vector3(0, 0, 0)) + * astar.add_point(2, Vector3(0, 1, 0), 1) # Default weight is 1 + * astar.add_point(3, Vector3(1, 1, 0)) + * astar.add_point(4, Vector3(2, 0, 0)) + * + * astar.connect_points(1, 2, false) + * astar.connect_points(2, 3, false) + * astar.connect_points(4, 3, false) + * astar.connect_points(1, 4, false) + * + * var res = astar.get_id_path(1, 3) # Returns [1, 2, 3] + * ``` + * csharp: + * ```csharp + * var astar = new AStar3D(); + * astar.AddPoint(1, new Vector3(0, 0, 0)); + * astar.AddPoint(2, new Vector3(0, 1, 0), 1); // Default weight is 1 + * astar.AddPoint(3, new Vector3(1, 1, 0)); + * astar.AddPoint(4, new Vector3(2, 0, 0)); + * astar.ConnectPoints(1, 2, false); + * astar.ConnectPoints(2, 3, false); + * astar.ConnectPoints(4, 3, false); + * astar.ConnectPoints(1, 4, false); + * int[] res = astar.GetIdPath(1, 3); // Returns [1, 2, 3] + * ``` + * + * If you change the 2nd point's weight to 3, then the result will be `[1, 4, 3]` instead, because + * now even though the distance is longer, it's "easier" to get through point 4 than through point 2. + */ + @JvmOverloads + public final fun getIdPath( + fromId: Long, + toId: Long, + allowPartialPath: Boolean = false, + ): PackedInt64Array { + Internals.writeArguments(LONG to fromId, LONG to toId, BOOL to allowPartialPath) + Internals.callMethod(rawPtr, MethodBindings.getIdPathPtr, PACKED_INT_64_ARRAY) + return (Internals.readReturnValue(PACKED_INT_64_ARRAY) as PackedInt64Array) + } + + public companion object + + public object MethodBindings { + internal val getAvailablePointIdPtr: VoidPtr = + Internals.getMethodBindPtr("AStar3D", "get_available_point_id", 3905245786) + + internal val addPointPtr: VoidPtr = + Internals.getMethodBindPtr("AStar3D", "add_point", 1038703438) + + internal val getPointPositionPtr: VoidPtr = + Internals.getMethodBindPtr("AStar3D", "get_point_position", 711720468) + + internal val setPointPositionPtr: VoidPtr = + Internals.getMethodBindPtr("AStar3D", "set_point_position", 1530502735) + + internal val getPointWeightScalePtr: VoidPtr = + Internals.getMethodBindPtr("AStar3D", "get_point_weight_scale", 2339986948) + + internal val setPointWeightScalePtr: VoidPtr = + Internals.getMethodBindPtr("AStar3D", "set_point_weight_scale", 1602489585) + + internal val removePointPtr: VoidPtr = + Internals.getMethodBindPtr("AStar3D", "remove_point", 1286410249) + + internal val hasPointPtr: VoidPtr = + Internals.getMethodBindPtr("AStar3D", "has_point", 1116898809) + + internal val getPointConnectionsPtr: VoidPtr = + Internals.getMethodBindPtr("AStar3D", "get_point_connections", 2865087369) + + internal val getPointIdsPtr: VoidPtr = + Internals.getMethodBindPtr("AStar3D", "get_point_ids", 3851388692) + + internal val setPointDisabledPtr: VoidPtr = + Internals.getMethodBindPtr("AStar3D", "set_point_disabled", 972357352) + + internal val isPointDisabledPtr: VoidPtr = + Internals.getMethodBindPtr("AStar3D", "is_point_disabled", 1116898809) + + internal val connectPointsPtr: VoidPtr = + Internals.getMethodBindPtr("AStar3D", "connect_points", 3710494224) + + internal val disconnectPointsPtr: VoidPtr = + Internals.getMethodBindPtr("AStar3D", "disconnect_points", 3710494224) + + internal val arePointsConnectedPtr: VoidPtr = + Internals.getMethodBindPtr("AStar3D", "are_points_connected", 2288175859) + + internal val getPointCountPtr: VoidPtr = + Internals.getMethodBindPtr("AStar3D", "get_point_count", 3905245786) + + internal val getPointCapacityPtr: VoidPtr = + Internals.getMethodBindPtr("AStar3D", "get_point_capacity", 3905245786) + + internal val reserveSpacePtr: VoidPtr = + Internals.getMethodBindPtr("AStar3D", "reserve_space", 1286410249) + + internal val clearPtr: VoidPtr = Internals.getMethodBindPtr("AStar3D", "clear", 3218959716) + + internal val getClosestPointPtr: VoidPtr = + Internals.getMethodBindPtr("AStar3D", "get_closest_point", 3241074317) + + internal val getClosestPositionInSegmentPtr: VoidPtr = + Internals.getMethodBindPtr("AStar3D", "get_closest_position_in_segment", 192990374) + + internal val getPointPathPtr: VoidPtr = + Internals.getMethodBindPtr("AStar3D", "get_point_path", 1562654675) + + internal val getIdPathPtr: VoidPtr = + Internals.getMethodBindPtr("AStar3D", "get_id_path", 3136199648) + } +} diff --git a/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AStarGrid2D.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AStarGrid2D.kt new file mode 100644 index 0000000000..630306ba18 --- /dev/null +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AStarGrid2D.kt @@ -0,0 +1,793 @@ +// THIS FILE IS GENERATED! DO NOT EDIT IT MANUALLY! +@file:Suppress("PackageDirectoryMismatch", "unused", "FunctionName", "RedundantModalityModifier", + "UNCHECKED_CAST", "JoinDeclarationAndAssignment", "USELESS_CAST", + "RemoveRedundantQualifierName", "NOTHING_TO_INLINE", "NON_FINAL_MEMBER_IN_OBJECT", + "RedundantVisibilityModifier", "RedundantUnitReturnType", "MemberVisibilityCanBePrivate") + +package godot + +import godot.`annotation`.CoreTypeHelper +import godot.`annotation`.CoreTypeLocalCopy +import godot.`annotation`.GodotBaseType +import godot.core.PackedVector2Array +import godot.core.Rect2i +import godot.core.VariantArray +import godot.core.VariantParser.ARRAY +import godot.core.VariantParser.BOOL +import godot.core.VariantParser.DOUBLE +import godot.core.VariantParser.LONG +import godot.core.VariantParser.NIL +import godot.core.VariantParser.PACKED_VECTOR2_ARRAY +import godot.core.VariantParser.RECT2I +import godot.core.VariantParser.VECTOR2 +import godot.core.VariantParser.VECTOR2I +import godot.core.Vector2 +import godot.core.Vector2i +import godot.util.Internals +import godot.util.VoidPtr +import kotlin.Boolean +import kotlin.Double +import kotlin.Float +import kotlin.Int +import kotlin.Long +import kotlin.NotImplementedError +import kotlin.Suppress +import kotlin.Unit +import kotlin.jvm.JvmName +import kotlin.jvm.JvmOverloads + +private const val ENGINE_CLASS_ASTARGRID2D_INDEX: Int = 41 + +/** + * [AStarGrid2D] is a variant of [AStar2D] that is specialized for partial 2D grids. It is simpler + * to use because it doesn't require you to manually create points and connect them together. This + * class also supports multiple types of heuristics, modes for diagonal movement, and a jumping mode to + * speed up calculations. + * To use [AStarGrid2D], you only need to set the [region] of the grid, optionally set the + * [cellSize], and then call the [update] method: + * + * gdscript: + * ```gdscript + * var astar_grid = AStarGrid2D.new() + * astar_grid.region = Rect2i(0, 0, 32, 32) + * astar_grid.cell_size = Vector2(16, 16) + * astar_grid.update() + * print(astar_grid.get_id_path(Vector2i(0, 0), Vector2i(3, 4))) # prints (0, 0), (1, 1), (2, 2), + * (3, 3), (3, 4) + * print(astar_grid.get_point_path(Vector2i(0, 0), Vector2i(3, 4))) # prints (0, 0), (16, 16), (32, + * 32), (48, 48), (48, 64) + * ``` + * csharp: + * ```csharp + * AStarGrid2D astarGrid = new AStarGrid2D(); + * astarGrid.Region = new Rect2I(0, 0, 32, 32); + * astarGrid.CellSize = new Vector2I(16, 16); + * astarGrid.Update(); + * GD.Print(astarGrid.GetIdPath(Vector2I.Zero, new Vector2I(3, 4))); // prints (0, 0), (1, 1), (2, + * 2), (3, 3), (3, 4) + * GD.Print(astarGrid.GetPointPath(Vector2I.Zero, new Vector2I(3, 4))); // prints (0, 0), (16, 16), + * (32, 32), (48, 48), (48, 64) + * ``` + * + * To remove a point from the pathfinding grid, it must be set as "solid" with [setPointSolid]. + */ +@GodotBaseType +public open class AStarGrid2D : RefCounted() { + /** + * The region of grid cells available for pathfinding. If changed, [update] needs to be called + * before finding the next path. + */ + @CoreTypeLocalCopy + public final inline var region: Rect2i + @JvmName("regionProperty") + get() = getRegion() + @JvmName("regionProperty") + set(`value`) { + setRegion(value) + } + + /** + * The size of the grid (number of cells of size [cellSize] on each axis). If changed, [update] + * needs to be called before finding the next path. + */ + @CoreTypeLocalCopy + public final inline var size: Vector2i + @JvmName("sizeProperty") + get() = getSize() + @JvmName("sizeProperty") + set(`value`) { + setSize(value) + } + + /** + * The offset of the grid which will be applied to calculate the resulting point position returned + * by [getPointPath]. If changed, [update] needs to be called before finding the next path. + */ + @CoreTypeLocalCopy + public final inline var offset: Vector2 + @JvmName("offsetProperty") + get() = getOffset() + @JvmName("offsetProperty") + set(`value`) { + setOffset(value) + } + + /** + * The size of the point cell which will be applied to calculate the resulting point position + * returned by [getPointPath]. If changed, [update] needs to be called before finding the next path. + */ + @CoreTypeLocalCopy + public final inline var cellSize: Vector2 + @JvmName("cellSizeProperty") + get() = getCellSize() + @JvmName("cellSizeProperty") + set(`value`) { + setCellSize(value) + } + + /** + * The cell shape. Affects how the positions are placed in the grid. If changed, [update] needs to + * be called before finding the next path. + */ + public final inline var cellShape: CellShape + @JvmName("cellShapeProperty") + get() = getCellShape() + @JvmName("cellShapeProperty") + set(`value`) { + setCellShape(value) + } + + /** + * Enables or disables jumping to skip up the intermediate points and speeds up the searching + * algorithm. + * **Note:** Currently, toggling it on disables the consideration of weight scaling in + * pathfinding. + */ + public final inline var jumpingEnabled: Boolean + @JvmName("jumpingEnabledProperty") + get() = isJumpingEnabled() + @JvmName("jumpingEnabledProperty") + set(`value`) { + setJumpingEnabled(value) + } + + /** + * The default [Heuristic] which will be used to calculate the cost between two points if + * [_computeCost] was not overridden. + */ + public final inline var defaultComputeHeuristic: Heuristic + @JvmName("defaultComputeHeuristicProperty") + get() = getDefaultComputeHeuristic() + @JvmName("defaultComputeHeuristicProperty") + set(`value`) { + setDefaultComputeHeuristic(value) + } + + /** + * The default [Heuristic] which will be used to calculate the cost between the point and the end + * point if [_estimateCost] was not overridden. + */ + public final inline var defaultEstimateHeuristic: Heuristic + @JvmName("defaultEstimateHeuristicProperty") + get() = getDefaultEstimateHeuristic() + @JvmName("defaultEstimateHeuristicProperty") + set(`value`) { + setDefaultEstimateHeuristic(value) + } + + /** + * A specific [DiagonalMode] mode which will force the path to avoid or accept the specified + * diagonals. + */ + public final inline var diagonalMode: DiagonalMode + @JvmName("diagonalModeProperty") + get() = getDiagonalMode() + @JvmName("diagonalModeProperty") + set(`value`) { + setDiagonalMode(value) + } + + public override fun new(scriptIndex: Int): Unit { + Internals.callConstructor(this, ENGINE_CLASS_ASTARGRID2D_INDEX, scriptIndex) + } + + /** + * The region of grid cells available for pathfinding. If changed, [update] needs to be called + * before finding the next path. + * + * This is a helper function to make dealing with local copies easier. + * + * For more information, see our + * [documentation](https://godot-kotl.in/en/stable/user-guide/api-differences/#core-types). + * + * Allow to directly modify the local copy of the property and assign it back to the Object. + * + * Prefer that over writing: + * `````` + * val myCoreType = astargrid2d.region + * //Your changes + * astargrid2d.region = myCoreType + * `````` + */ + @CoreTypeHelper + public final fun regionMutate(block: Rect2i.() -> Unit): Rect2i = region.apply{ + block(this) + region = this + } + + + /** + * The size of the grid (number of cells of size [cellSize] on each axis). If changed, [update] + * needs to be called before finding the next path. + * + * This is a helper function to make dealing with local copies easier. + * + * For more information, see our + * [documentation](https://godot-kotl.in/en/stable/user-guide/api-differences/#core-types). + * + * Allow to directly modify the local copy of the property and assign it back to the Object. + * + * Prefer that over writing: + * `````` + * val myCoreType = astargrid2d.size + * //Your changes + * astargrid2d.size = myCoreType + * `````` + */ + @CoreTypeHelper + public final fun sizeMutate(block: Vector2i.() -> Unit): Vector2i = size.apply{ + block(this) + size = this + } + + + /** + * The offset of the grid which will be applied to calculate the resulting point position returned + * by [getPointPath]. If changed, [update] needs to be called before finding the next path. + * + * This is a helper function to make dealing with local copies easier. + * + * For more information, see our + * [documentation](https://godot-kotl.in/en/stable/user-guide/api-differences/#core-types). + * + * Allow to directly modify the local copy of the property and assign it back to the Object. + * + * Prefer that over writing: + * `````` + * val myCoreType = astargrid2d.offset + * //Your changes + * astargrid2d.offset = myCoreType + * `````` + */ + @CoreTypeHelper + public final fun offsetMutate(block: Vector2.() -> Unit): Vector2 = offset.apply{ + block(this) + offset = this + } + + + /** + * The size of the point cell which will be applied to calculate the resulting point position + * returned by [getPointPath]. If changed, [update] needs to be called before finding the next path. + * + * This is a helper function to make dealing with local copies easier. + * + * For more information, see our + * [documentation](https://godot-kotl.in/en/stable/user-guide/api-differences/#core-types). + * + * Allow to directly modify the local copy of the property and assign it back to the Object. + * + * Prefer that over writing: + * `````` + * val myCoreType = astargrid2d.cellSize + * //Your changes + * astargrid2d.cellSize = myCoreType + * `````` + */ + @CoreTypeHelper + public final fun cellSizeMutate(block: Vector2.() -> Unit): Vector2 = cellSize.apply{ + block(this) + cellSize = this + } + + + /** + * Called when estimating the cost between a point and the path's ending point. + * Note that this function is hidden in the default [AStarGrid2D] class. + */ + public open fun _estimateCost(fromId: Vector2i, toId: Vector2i): Float { + throw NotImplementedError("_estimate_cost is not implemented for AStarGrid2D") + } + + /** + * Called when computing the cost between two connected points. + * Note that this function is hidden in the default [AStarGrid2D] class. + */ + public open fun _computeCost(fromId: Vector2i, toId: Vector2i): Float { + throw NotImplementedError("_compute_cost is not implemented for AStarGrid2D") + } + + public final fun setRegion(region: Rect2i): Unit { + Internals.writeArguments(RECT2I to region) + Internals.callMethod(rawPtr, MethodBindings.setRegionPtr, NIL) + } + + public final fun getRegion(): Rect2i { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getRegionPtr, RECT2I) + return (Internals.readReturnValue(RECT2I) as Rect2i) + } + + public final fun setSize(size: Vector2i): Unit { + Internals.writeArguments(VECTOR2I to size) + Internals.callMethod(rawPtr, MethodBindings.setSizePtr, NIL) + } + + public final fun getSize(): Vector2i { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getSizePtr, VECTOR2I) + return (Internals.readReturnValue(VECTOR2I) as Vector2i) + } + + public final fun setOffset(offset: Vector2): Unit { + Internals.writeArguments(VECTOR2 to offset) + Internals.callMethod(rawPtr, MethodBindings.setOffsetPtr, NIL) + } + + public final fun getOffset(): Vector2 { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getOffsetPtr, VECTOR2) + return (Internals.readReturnValue(VECTOR2) as Vector2) + } + + public final fun setCellSize(cellSize: Vector2): Unit { + Internals.writeArguments(VECTOR2 to cellSize) + Internals.callMethod(rawPtr, MethodBindings.setCellSizePtr, NIL) + } + + public final fun getCellSize(): Vector2 { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getCellSizePtr, VECTOR2) + return (Internals.readReturnValue(VECTOR2) as Vector2) + } + + public final fun setCellShape(cellShape: CellShape): Unit { + Internals.writeArguments(LONG to cellShape.id) + Internals.callMethod(rawPtr, MethodBindings.setCellShapePtr, NIL) + } + + public final fun getCellShape(): CellShape { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getCellShapePtr, LONG) + return AStarGrid2D.CellShape.from(Internals.readReturnValue(LONG) as Long) + } + + /** + * Returns `true` if the [x] and [y] is a valid grid coordinate (id), i.e. if it is inside + * [region]. Equivalent to `region.has_point(Vector2i(x, y))`. + */ + public final fun isInBounds(x: Int, y: Int): Boolean { + Internals.writeArguments(LONG to x.toLong(), LONG to y.toLong()) + Internals.callMethod(rawPtr, MethodBindings.isInBoundsPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + /** + * Returns `true` if the [id] vector is a valid grid coordinate, i.e. if it is inside [region]. + * Equivalent to `region.has_point(id)`. + */ + public final fun isInBoundsv(id: Vector2i): Boolean { + Internals.writeArguments(VECTOR2I to id) + Internals.callMethod(rawPtr, MethodBindings.isInBoundsvPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + /** + * Indicates that the grid parameters were changed and [update] needs to be called. + */ + public final fun isDirty(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isDirtyPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + /** + * Updates the internal state of the grid according to the parameters to prepare it to search the + * path. Needs to be called if parameters like [region], [cellSize] or [offset] are changed. + * [isDirty] will return `true` if this is the case and this needs to be called. + * **Note:** All point data (solidity and weight scale) will be cleared. + */ + public final fun update(): Unit { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.updatePtr, NIL) + } + + public final fun setJumpingEnabled(enabled: Boolean): Unit { + Internals.writeArguments(BOOL to enabled) + Internals.callMethod(rawPtr, MethodBindings.setJumpingEnabledPtr, NIL) + } + + public final fun isJumpingEnabled(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isJumpingEnabledPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public final fun setDiagonalMode(mode: DiagonalMode): Unit { + Internals.writeArguments(LONG to mode.id) + Internals.callMethod(rawPtr, MethodBindings.setDiagonalModePtr, NIL) + } + + public final fun getDiagonalMode(): DiagonalMode { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getDiagonalModePtr, LONG) + return AStarGrid2D.DiagonalMode.from(Internals.readReturnValue(LONG) as Long) + } + + public final fun setDefaultComputeHeuristic(heuristic: Heuristic): Unit { + Internals.writeArguments(LONG to heuristic.id) + Internals.callMethod(rawPtr, MethodBindings.setDefaultComputeHeuristicPtr, NIL) + } + + public final fun getDefaultComputeHeuristic(): Heuristic { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getDefaultComputeHeuristicPtr, LONG) + return AStarGrid2D.Heuristic.from(Internals.readReturnValue(LONG) as Long) + } + + public final fun setDefaultEstimateHeuristic(heuristic: Heuristic): Unit { + Internals.writeArguments(LONG to heuristic.id) + Internals.callMethod(rawPtr, MethodBindings.setDefaultEstimateHeuristicPtr, NIL) + } + + public final fun getDefaultEstimateHeuristic(): Heuristic { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getDefaultEstimateHeuristicPtr, LONG) + return AStarGrid2D.Heuristic.from(Internals.readReturnValue(LONG) as Long) + } + + /** + * Disables or enables the specified point for pathfinding. Useful for making an obstacle. By + * default, all points are enabled. + * **Note:** Calling [update] is not needed after the call of this function. + */ + @JvmOverloads + public final fun setPointSolid(id: Vector2i, solid: Boolean = true): Unit { + Internals.writeArguments(VECTOR2I to id, BOOL to solid) + Internals.callMethod(rawPtr, MethodBindings.setPointSolidPtr, NIL) + } + + /** + * Returns `true` if a point is disabled for pathfinding. By default, all points are enabled. + */ + public final fun isPointSolid(id: Vector2i): Boolean { + Internals.writeArguments(VECTOR2I to id) + Internals.callMethod(rawPtr, MethodBindings.isPointSolidPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + /** + * Sets the [weightScale] for the point with the given [id]. The [weightScale] is multiplied by + * the result of [_computeCost] when determining the overall cost of traveling across a segment from + * a neighboring point to this point. + * **Note:** Calling [update] is not needed after the call of this function. + */ + public final fun setPointWeightScale(id: Vector2i, weightScale: Float): Unit { + Internals.writeArguments(VECTOR2I to id, DOUBLE to weightScale.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setPointWeightScalePtr, NIL) + } + + /** + * Returns the weight scale of the point associated with the given [id]. + */ + public final fun getPointWeightScale(id: Vector2i): Float { + Internals.writeArguments(VECTOR2I to id) + Internals.callMethod(rawPtr, MethodBindings.getPointWeightScalePtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + /** + * Fills the given [region] on the grid with the specified value for the solid flag. + * **Note:** Calling [update] is not needed after the call of this function. + */ + @JvmOverloads + public final fun fillSolidRegion(region: Rect2i, solid: Boolean = true): Unit { + Internals.writeArguments(RECT2I to region, BOOL to solid) + Internals.callMethod(rawPtr, MethodBindings.fillSolidRegionPtr, NIL) + } + + /** + * Fills the given [region] on the grid with the specified value for the weight scale. + * **Note:** Calling [update] is not needed after the call of this function. + */ + public final fun fillWeightScaleRegion(region: Rect2i, weightScale: Float): Unit { + Internals.writeArguments(RECT2I to region, DOUBLE to weightScale.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.fillWeightScaleRegionPtr, NIL) + } + + /** + * Clears the grid and sets the [region] to `Rect2i(0, 0, 0, 0)`. + */ + public final fun clear(): Unit { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.clearPtr, NIL) + } + + /** + * Returns the position of the point associated with the given [id]. + */ + public final fun getPointPosition(id: Vector2i): Vector2 { + Internals.writeArguments(VECTOR2I to id) + Internals.callMethod(rawPtr, MethodBindings.getPointPositionPtr, VECTOR2) + return (Internals.readReturnValue(VECTOR2) as Vector2) + } + + /** + * Returns an array with the points that are in the path found by [AStarGrid2D] between the given + * points. The array is ordered from the starting point to the ending point of the path. + * If there is no valid path to the target, and [allowPartialPath] is `true`, returns a path to + * the point closest to the target that can be reached. + * **Note:** This method is not thread-safe. If called from a [Thread], it will return an empty + * array and will print an error message. + */ + @JvmOverloads + public final fun getPointPath( + fromId: Vector2i, + toId: Vector2i, + allowPartialPath: Boolean = false, + ): PackedVector2Array { + Internals.writeArguments(VECTOR2I to fromId, VECTOR2I to toId, BOOL to allowPartialPath) + Internals.callMethod(rawPtr, MethodBindings.getPointPathPtr, PACKED_VECTOR2_ARRAY) + return (Internals.readReturnValue(PACKED_VECTOR2_ARRAY) as PackedVector2Array) + } + + /** + * Returns an array with the IDs of the points that form the path found by AStar2D between the + * given points. The array is ordered from the starting point to the ending point of the path. + * If there is no valid path to the target, and [allowPartialPath] is `true`, returns a path to + * the point closest to the target that can be reached. + */ + @JvmOverloads + public final fun getIdPath( + fromId: Vector2i, + toId: Vector2i, + allowPartialPath: Boolean = false, + ): VariantArray { + Internals.writeArguments(VECTOR2I to fromId, VECTOR2I to toId, BOOL to allowPartialPath) + Internals.callMethod(rawPtr, MethodBindings.getIdPathPtr, ARRAY) + return (Internals.readReturnValue(ARRAY) as VariantArray) + } + + public enum class Heuristic( + id: Long, + ) { + /** + * The [url=https://en.wikipedia.org/wiki/Euclidean_distance]Euclidean heuristic[/url] to be + * used for the pathfinding using the following formula: + * [codeblock] + * dx = abs(to_id.x - from_id.x) + * dy = abs(to_id.y - from_id.y) + * result = sqrt(dx * dx + dy * dy) + * [/codeblock] + * **Note:** This is also the internal heuristic used in [AStar3D] and [AStar2D] by default + * (with the inclusion of possible z-axis coordinate). + */ + HEURISTIC_EUCLIDEAN(0), + /** + * The [url=https://en.wikipedia.org/wiki/Taxicab_geometry]Manhattan heuristic[/url] to be used + * for the pathfinding using the following formula: + * [codeblock] + * dx = abs(to_id.x - from_id.x) + * dy = abs(to_id.y - from_id.y) + * result = dx + dy + * [/codeblock] + * **Note:** This heuristic is intended to be used with 4-side orthogonal movements, provided by + * setting the [diagonalMode] to [DIAGONAL_MODE_NEVER]. + */ + HEURISTIC_MANHATTAN(1), + /** + * The Octile heuristic to be used for the pathfinding using the following formula: + * [codeblock] + * dx = abs(to_id.x - from_id.x) + * dy = abs(to_id.y - from_id.y) + * f = sqrt(2) - 1 + * result = (dx < dy) ? f * dx + dy : f * dy + dx; + * [/codeblock] + */ + HEURISTIC_OCTILE(2), + /** + * The [url=https://en.wikipedia.org/wiki/Chebyshev_distance]Chebyshev heuristic[/url] to be + * used for the pathfinding using the following formula: + * [codeblock] + * dx = abs(to_id.x - from_id.x) + * dy = abs(to_id.y - from_id.y) + * result = max(dx, dy) + * [/codeblock] + */ + HEURISTIC_CHEBYSHEV(3), + /** + * Represents the size of the [Heuristic] enum. + */ + HEURISTIC_MAX(4), + ; + + public val id: Long + init { + this.id = id + } + + public companion object { + public fun from(`value`: Long): Heuristic = entries.single { it.id == `value` } + } + } + + public enum class DiagonalMode( + id: Long, + ) { + /** + * The pathfinding algorithm will ignore solid neighbors around the target cell and allow + * passing using diagonals. + */ + DIAGONAL_MODE_ALWAYS(0), + /** + * The pathfinding algorithm will ignore all diagonals and the way will be always orthogonal. + */ + DIAGONAL_MODE_NEVER(1), + /** + * The pathfinding algorithm will avoid using diagonals if at least two obstacles have been + * placed around the neighboring cells of the specific path segment. + */ + DIAGONAL_MODE_AT_LEAST_ONE_WALKABLE(2), + /** + * The pathfinding algorithm will avoid using diagonals if any obstacle has been placed around + * the neighboring cells of the specific path segment. + */ + DIAGONAL_MODE_ONLY_IF_NO_OBSTACLES(3), + /** + * Represents the size of the [DiagonalMode] enum. + */ + DIAGONAL_MODE_MAX(4), + ; + + public val id: Long + init { + this.id = id + } + + public companion object { + public fun from(`value`: Long): DiagonalMode = entries.single { it.id == `value` } + } + } + + public enum class CellShape( + id: Long, + ) { + /** + * Rectangular cell shape. + */ + CELL_SHAPE_SQUARE(0), + /** + * Diamond cell shape (for isometric look). Cell coordinates layout where the horizontal axis + * goes up-right, and the vertical one goes down-right. + */ + CELL_SHAPE_ISOMETRIC_RIGHT(1), + /** + * Diamond cell shape (for isometric look). Cell coordinates layout where the horizontal axis + * goes down-right, and the vertical one goes down-left. + */ + CELL_SHAPE_ISOMETRIC_DOWN(2), + /** + * Represents the size of the [CellShape] enum. + */ + CELL_SHAPE_MAX(3), + ; + + public val id: Long + init { + this.id = id + } + + public companion object { + public fun from(`value`: Long): CellShape = entries.single { it.id == `value` } + } + } + + public companion object + + public object MethodBindings { + internal val setRegionPtr: VoidPtr = + Internals.getMethodBindPtr("AStarGrid2D", "set_region", 1763793166) + + internal val getRegionPtr: VoidPtr = + Internals.getMethodBindPtr("AStarGrid2D", "get_region", 410525958) + + internal val setSizePtr: VoidPtr = + Internals.getMethodBindPtr("AStarGrid2D", "set_size", 1130785943) + + internal val getSizePtr: VoidPtr = + Internals.getMethodBindPtr("AStarGrid2D", "get_size", 3690982128) + + internal val setOffsetPtr: VoidPtr = + Internals.getMethodBindPtr("AStarGrid2D", "set_offset", 743155724) + + internal val getOffsetPtr: VoidPtr = + Internals.getMethodBindPtr("AStarGrid2D", "get_offset", 3341600327) + + internal val setCellSizePtr: VoidPtr = + Internals.getMethodBindPtr("AStarGrid2D", "set_cell_size", 743155724) + + internal val getCellSizePtr: VoidPtr = + Internals.getMethodBindPtr("AStarGrid2D", "get_cell_size", 3341600327) + + internal val setCellShapePtr: VoidPtr = + Internals.getMethodBindPtr("AStarGrid2D", "set_cell_shape", 4130591146) + + internal val getCellShapePtr: VoidPtr = + Internals.getMethodBindPtr("AStarGrid2D", "get_cell_shape", 3293463634) + + internal val isInBoundsPtr: VoidPtr = + Internals.getMethodBindPtr("AStarGrid2D", "is_in_bounds", 2522259332) + + internal val isInBoundsvPtr: VoidPtr = + Internals.getMethodBindPtr("AStarGrid2D", "is_in_boundsv", 3900751641) + + internal val isDirtyPtr: VoidPtr = + Internals.getMethodBindPtr("AStarGrid2D", "is_dirty", 36873697) + + internal val updatePtr: VoidPtr = + Internals.getMethodBindPtr("AStarGrid2D", "update", 3218959716) + + internal val setJumpingEnabledPtr: VoidPtr = + Internals.getMethodBindPtr("AStarGrid2D", "set_jumping_enabled", 2586408642) + + internal val isJumpingEnabledPtr: VoidPtr = + Internals.getMethodBindPtr("AStarGrid2D", "is_jumping_enabled", 36873697) + + internal val setDiagonalModePtr: VoidPtr = + Internals.getMethodBindPtr("AStarGrid2D", "set_diagonal_mode", 1017829798) + + internal val getDiagonalModePtr: VoidPtr = + Internals.getMethodBindPtr("AStarGrid2D", "get_diagonal_mode", 3129282674) + + internal val setDefaultComputeHeuristicPtr: VoidPtr = + Internals.getMethodBindPtr("AStarGrid2D", "set_default_compute_heuristic", 1044375519) + + internal val getDefaultComputeHeuristicPtr: VoidPtr = + Internals.getMethodBindPtr("AStarGrid2D", "get_default_compute_heuristic", 2074731422) + + internal val setDefaultEstimateHeuristicPtr: VoidPtr = + Internals.getMethodBindPtr("AStarGrid2D", "set_default_estimate_heuristic", 1044375519) + + internal val getDefaultEstimateHeuristicPtr: VoidPtr = + Internals.getMethodBindPtr("AStarGrid2D", "get_default_estimate_heuristic", 2074731422) + + internal val setPointSolidPtr: VoidPtr = + Internals.getMethodBindPtr("AStarGrid2D", "set_point_solid", 1765703753) + + internal val isPointSolidPtr: VoidPtr = + Internals.getMethodBindPtr("AStarGrid2D", "is_point_solid", 3900751641) + + internal val setPointWeightScalePtr: VoidPtr = + Internals.getMethodBindPtr("AStarGrid2D", "set_point_weight_scale", 2262553149) + + internal val getPointWeightScalePtr: VoidPtr = + Internals.getMethodBindPtr("AStarGrid2D", "get_point_weight_scale", 719993801) + + internal val fillSolidRegionPtr: VoidPtr = + Internals.getMethodBindPtr("AStarGrid2D", "fill_solid_region", 2261970063) + + internal val fillWeightScaleRegionPtr: VoidPtr = + Internals.getMethodBindPtr("AStarGrid2D", "fill_weight_scale_region", 2793244083) + + internal val clearPtr: VoidPtr = Internals.getMethodBindPtr("AStarGrid2D", "clear", 3218959716) + + internal val getPointPositionPtr: VoidPtr = + Internals.getMethodBindPtr("AStarGrid2D", "get_point_position", 108438297) + + internal val getPointPathPtr: VoidPtr = + Internals.getMethodBindPtr("AStarGrid2D", "get_point_path", 1641925693) + + internal val getIdPathPtr: VoidPtr = + Internals.getMethodBindPtr("AStarGrid2D", "get_id_path", 1918132273) + } +} diff --git a/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AcceptDialog.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AcceptDialog.kt new file mode 100644 index 0000000000..e96f5ee1fc --- /dev/null +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AcceptDialog.kt @@ -0,0 +1,292 @@ +// THIS FILE IS GENERATED! DO NOT EDIT IT MANUALLY! +@file:Suppress("PackageDirectoryMismatch", "unused", "FunctionName", "RedundantModalityModifier", + "UNCHECKED_CAST", "JoinDeclarationAndAssignment", "USELESS_CAST", + "RemoveRedundantQualifierName", "NOTHING_TO_INLINE", "NON_FINAL_MEMBER_IN_OBJECT", + "RedundantVisibilityModifier", "RedundantUnitReturnType", "MemberVisibilityCanBePrivate") + +package godot + +import godot.`annotation`.GodotBaseType +import godot.core.Signal0 +import godot.core.Signal1 +import godot.core.StringName +import godot.core.VariantParser.BOOL +import godot.core.VariantParser.NIL +import godot.core.VariantParser.OBJECT +import godot.core.VariantParser.STRING +import godot.util.Internals +import godot.util.VoidPtr +import kotlin.Boolean +import kotlin.Int +import kotlin.String +import kotlin.Suppress +import kotlin.Unit +import kotlin.jvm.JvmName +import kotlin.jvm.JvmOverloads + +private const val ENGINE_CLASS_ACCEPTDIALOG_INDEX: Int = 42 + +/** + * The default use of [AcceptDialog] is to allow it to only be accepted or closed, with the same + * result. However, the [signal confirmed] and [signal canceled] signals allow to make the two actions + * different, and the [addButton] method allows to add custom buttons and actions. + */ +@GodotBaseType +public open class AcceptDialog : Window() { + /** + * Emitted when the dialog is accepted, i.e. the OK button is pressed. + */ + public val confirmed: Signal0 by Signal0 + + /** + * Emitted when the dialog is closed or the button created with [addCancelButton] is pressed. + */ + public val canceled: Signal0 by Signal0 + + /** + * Emitted when a custom button is pressed. See [addButton]. + */ + public val customAction: Signal1 by Signal1 + + /** + * The text displayed by the OK button (see [getOkButton]). + */ + public final inline var okButtonText: String + @JvmName("okButtonTextProperty") + get() = getOkButtonText() + @JvmName("okButtonTextProperty") + set(`value`) { + setOkButtonText(value) + } + + /** + * The text displayed by the dialog. + */ + public final inline var dialogText: String + @JvmName("dialogTextProperty") + get() = getText() + @JvmName("dialogTextProperty") + set(`value`) { + setText(value) + } + + /** + * If `true`, the dialog is hidden when the OK button is pressed. You can set it to `false` if you + * want to do e.g. input validation when receiving the [signal confirmed] signal, and handle hiding + * the dialog in your own logic. + * **Note:** Some nodes derived from this class can have a different default value, and + * potentially their own built-in logic overriding this setting. For example [FileDialog] defaults to + * `false`, and has its own input validation code that is called when you press OK, which eventually + * hides the dialog if the input is valid. As such, this property can't be used in [FileDialog] to + * disable hiding the dialog when pressing OK. + */ + public final inline var dialogHideOnOk: Boolean + @JvmName("dialogHideOnOkProperty") + get() = getHideOnOk() + @JvmName("dialogHideOnOkProperty") + set(`value`) { + setHideOnOk(value) + } + + /** + * If `true`, the dialog will be hidden when the escape key ([KEY_ESCAPE]) is pressed. + */ + public final inline var dialogCloseOnEscape: Boolean + @JvmName("dialogCloseOnEscapeProperty") + get() = getCloseOnEscape() + @JvmName("dialogCloseOnEscapeProperty") + set(`value`) { + setCloseOnEscape(value) + } + + /** + * Sets autowrapping for the text in the dialog. + */ + public final inline var dialogAutowrap: Boolean + @JvmName("dialogAutowrapProperty") + get() = hasAutowrap() + @JvmName("dialogAutowrapProperty") + set(`value`) { + setAutowrap(value) + } + + public override fun new(scriptIndex: Int): Unit { + Internals.callConstructor(this, ENGINE_CLASS_ACCEPTDIALOG_INDEX, scriptIndex) + } + + /** + * Returns the OK [Button] instance. + * **Warning:** This is a required internal node, removing and freeing it may cause a crash. If + * you wish to hide it or any of its children, use their [CanvasItem.visible] property. + */ + public final fun getOkButton(): Button? { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getOkButtonPtr, OBJECT) + return (Internals.readReturnValue(OBJECT) as Button?) + } + + /** + * Returns the label used for built-in text. + * **Warning:** This is a required internal node, removing and freeing it may cause a crash. If + * you wish to hide it or any of its children, use their [CanvasItem.visible] property. + */ + public final fun getLabel(): Label? { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getLabelPtr, OBJECT) + return (Internals.readReturnValue(OBJECT) as Label?) + } + + public final fun setHideOnOk(enabled: Boolean): Unit { + Internals.writeArguments(BOOL to enabled) + Internals.callMethod(rawPtr, MethodBindings.setHideOnOkPtr, NIL) + } + + public final fun getHideOnOk(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getHideOnOkPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public final fun setCloseOnEscape(enabled: Boolean): Unit { + Internals.writeArguments(BOOL to enabled) + Internals.callMethod(rawPtr, MethodBindings.setCloseOnEscapePtr, NIL) + } + + public final fun getCloseOnEscape(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getCloseOnEscapePtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + /** + * Adds a button with label [text] and a custom [action] to the dialog and returns the created + * button. [action] will be passed to the [signal custom_action] signal when pressed. + * If `true`, [right] will place the button to the right of any sibling buttons. + * You can use [removeButton] method to remove a button created with this method from the dialog. + */ + @JvmOverloads + public final fun addButton( + text: String, + right: Boolean = false, + action: String = "", + ): Button? { + Internals.writeArguments(STRING to text, BOOL to right, STRING to action) + Internals.callMethod(rawPtr, MethodBindings.addButtonPtr, OBJECT) + return (Internals.readReturnValue(OBJECT) as Button?) + } + + /** + * Adds a button with label [name] and a cancel action to the dialog and returns the created + * button. + * You can use [removeButton] method to remove a button created with this method from the dialog. + */ + public final fun addCancelButton(name: String): Button? { + Internals.writeArguments(STRING to name) + Internals.callMethod(rawPtr, MethodBindings.addCancelButtonPtr, OBJECT) + return (Internals.readReturnValue(OBJECT) as Button?) + } + + /** + * Removes the [button] from the dialog. Does NOT free the [button]. The [button] must be a + * [Button] added with [addButton] or [addCancelButton] method. After removal, pressing the [button] + * will no longer emit this dialog's [signal custom_action] or [signal canceled] signals. + */ + public final fun removeButton(button: Button?): Unit { + Internals.writeArguments(OBJECT to button) + Internals.callMethod(rawPtr, MethodBindings.removeButtonPtr, NIL) + } + + /** + * Registers a [LineEdit] in the dialog. When the enter key is pressed, the dialog will be + * accepted. + */ + public final fun registerTextEnter(lineEdit: LineEdit?): Unit { + Internals.writeArguments(OBJECT to lineEdit) + Internals.callMethod(rawPtr, MethodBindings.registerTextEnterPtr, NIL) + } + + public final fun setText(text: String): Unit { + Internals.writeArguments(STRING to text) + Internals.callMethod(rawPtr, MethodBindings.setTextPtr, NIL) + } + + public final fun getText(): String { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getTextPtr, STRING) + return (Internals.readReturnValue(STRING) as String) + } + + public final fun setAutowrap(autowrap: Boolean): Unit { + Internals.writeArguments(BOOL to autowrap) + Internals.callMethod(rawPtr, MethodBindings.setAutowrapPtr, NIL) + } + + public final fun hasAutowrap(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.hasAutowrapPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public final fun setOkButtonText(text: String): Unit { + Internals.writeArguments(STRING to text) + Internals.callMethod(rawPtr, MethodBindings.setOkButtonTextPtr, NIL) + } + + public final fun getOkButtonText(): String { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getOkButtonTextPtr, STRING) + return (Internals.readReturnValue(STRING) as String) + } + + public companion object + + public object MethodBindings { + internal val getOkButtonPtr: VoidPtr = + Internals.getMethodBindPtr("AcceptDialog", "get_ok_button", 1856205918) + + internal val getLabelPtr: VoidPtr = + Internals.getMethodBindPtr("AcceptDialog", "get_label", 566733104) + + internal val setHideOnOkPtr: VoidPtr = + Internals.getMethodBindPtr("AcceptDialog", "set_hide_on_ok", 2586408642) + + internal val getHideOnOkPtr: VoidPtr = + Internals.getMethodBindPtr("AcceptDialog", "get_hide_on_ok", 36873697) + + internal val setCloseOnEscapePtr: VoidPtr = + Internals.getMethodBindPtr("AcceptDialog", "set_close_on_escape", 2586408642) + + internal val getCloseOnEscapePtr: VoidPtr = + Internals.getMethodBindPtr("AcceptDialog", "get_close_on_escape", 36873697) + + internal val addButtonPtr: VoidPtr = + Internals.getMethodBindPtr("AcceptDialog", "add_button", 3328440682) + + internal val addCancelButtonPtr: VoidPtr = + Internals.getMethodBindPtr("AcceptDialog", "add_cancel_button", 242045556) + + internal val removeButtonPtr: VoidPtr = + Internals.getMethodBindPtr("AcceptDialog", "remove_button", 2068354942) + + internal val registerTextEnterPtr: VoidPtr = + Internals.getMethodBindPtr("AcceptDialog", "register_text_enter", 3714008017) + + internal val setTextPtr: VoidPtr = + Internals.getMethodBindPtr("AcceptDialog", "set_text", 83702148) + + internal val getTextPtr: VoidPtr = + Internals.getMethodBindPtr("AcceptDialog", "get_text", 201670096) + + internal val setAutowrapPtr: VoidPtr = + Internals.getMethodBindPtr("AcceptDialog", "set_autowrap", 2586408642) + + internal val hasAutowrapPtr: VoidPtr = + Internals.getMethodBindPtr("AcceptDialog", "has_autowrap", 2240911060) + + internal val setOkButtonTextPtr: VoidPtr = + Internals.getMethodBindPtr("AcceptDialog", "set_ok_button_text", 83702148) + + internal val getOkButtonTextPtr: VoidPtr = + Internals.getMethodBindPtr("AcceptDialog", "get_ok_button_text", 201670096) + } +} diff --git a/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AnimatableBody2D.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AnimatableBody2D.kt new file mode 100644 index 0000000000..5d5f4f8e28 --- /dev/null +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AnimatableBody2D.kt @@ -0,0 +1,69 @@ +// THIS FILE IS GENERATED! DO NOT EDIT IT MANUALLY! +@file:Suppress("PackageDirectoryMismatch", "unused", "FunctionName", "RedundantModalityModifier", + "UNCHECKED_CAST", "JoinDeclarationAndAssignment", "USELESS_CAST", + "RemoveRedundantQualifierName", "NOTHING_TO_INLINE", "NON_FINAL_MEMBER_IN_OBJECT", + "RedundantVisibilityModifier", "RedundantUnitReturnType", "MemberVisibilityCanBePrivate") + +package godot + +import godot.`annotation`.GodotBaseType +import godot.core.VariantParser.BOOL +import godot.core.VariantParser.NIL +import godot.util.Internals +import godot.util.VoidPtr +import kotlin.Boolean +import kotlin.Int +import kotlin.Suppress +import kotlin.Unit +import kotlin.jvm.JvmName + +private const val ENGINE_CLASS_ANIMATABLEBODY2D_INDEX: Int = 43 + +/** + * An animatable 2D physics body. It can't be moved by external forces or contacts, but can be moved + * manually by other means such as code, [AnimationMixer]s (with [AnimationMixer.callbackModeProcess] + * set to [AnimationMixer.ANIMATION_CALLBACK_MODE_PROCESS_PHYSICS]), and [RemoteTransform2D]. + * When [AnimatableBody2D] is moved, its linear and angular velocity are estimated and used to + * affect other physics bodies in its path. This makes it useful for moving platforms, doors, and other + * moving objects. + */ +@GodotBaseType +public open class AnimatableBody2D : StaticBody2D() { + /** + * If `true`, the body's movement will be synchronized to the physics frame. This is useful when + * animating movement via [AnimationPlayer], for example on moving platforms. Do **not** use together + * with [PhysicsBody2D.moveAndCollide]. + */ + public final inline var syncToPhysics: Boolean + @JvmName("syncToPhysicsProperty") + get() = isSyncToPhysicsEnabled() + @JvmName("syncToPhysicsProperty") + set(`value`) { + setSyncToPhysics(value) + } + + public override fun new(scriptIndex: Int): Unit { + Internals.callConstructor(this, ENGINE_CLASS_ANIMATABLEBODY2D_INDEX, scriptIndex) + } + + public final fun setSyncToPhysics(enable: Boolean): Unit { + Internals.writeArguments(BOOL to enable) + Internals.callMethod(rawPtr, MethodBindings.setSyncToPhysicsPtr, NIL) + } + + public final fun isSyncToPhysicsEnabled(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isSyncToPhysicsEnabledPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public companion object + + public object MethodBindings { + internal val setSyncToPhysicsPtr: VoidPtr = + Internals.getMethodBindPtr("AnimatableBody2D", "set_sync_to_physics", 2586408642) + + internal val isSyncToPhysicsEnabledPtr: VoidPtr = + Internals.getMethodBindPtr("AnimatableBody2D", "is_sync_to_physics_enabled", 36873697) + } +} diff --git a/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AnimatableBody3D.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AnimatableBody3D.kt new file mode 100644 index 0000000000..4c16b361cd --- /dev/null +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AnimatableBody3D.kt @@ -0,0 +1,69 @@ +// THIS FILE IS GENERATED! DO NOT EDIT IT MANUALLY! +@file:Suppress("PackageDirectoryMismatch", "unused", "FunctionName", "RedundantModalityModifier", + "UNCHECKED_CAST", "JoinDeclarationAndAssignment", "USELESS_CAST", + "RemoveRedundantQualifierName", "NOTHING_TO_INLINE", "NON_FINAL_MEMBER_IN_OBJECT", + "RedundantVisibilityModifier", "RedundantUnitReturnType", "MemberVisibilityCanBePrivate") + +package godot + +import godot.`annotation`.GodotBaseType +import godot.core.VariantParser.BOOL +import godot.core.VariantParser.NIL +import godot.util.Internals +import godot.util.VoidPtr +import kotlin.Boolean +import kotlin.Int +import kotlin.Suppress +import kotlin.Unit +import kotlin.jvm.JvmName + +private const val ENGINE_CLASS_ANIMATABLEBODY3D_INDEX: Int = 44 + +/** + * An animatable 3D physics body. It can't be moved by external forces or contacts, but can be moved + * manually by other means such as code, [AnimationMixer]s (with [AnimationMixer.callbackModeProcess] + * set to [AnimationMixer.ANIMATION_CALLBACK_MODE_PROCESS_PHYSICS]), and [RemoteTransform3D]. + * When [AnimatableBody3D] is moved, its linear and angular velocity are estimated and used to + * affect other physics bodies in its path. This makes it useful for moving platforms, doors, and other + * moving objects. + */ +@GodotBaseType +public open class AnimatableBody3D : StaticBody3D() { + /** + * If `true`, the body's movement will be synchronized to the physics frame. This is useful when + * animating movement via [AnimationPlayer], for example on moving platforms. Do **not** use together + * with [PhysicsBody3D.moveAndCollide]. + */ + public final inline var syncToPhysics: Boolean + @JvmName("syncToPhysicsProperty") + get() = isSyncToPhysicsEnabled() + @JvmName("syncToPhysicsProperty") + set(`value`) { + setSyncToPhysics(value) + } + + public override fun new(scriptIndex: Int): Unit { + Internals.callConstructor(this, ENGINE_CLASS_ANIMATABLEBODY3D_INDEX, scriptIndex) + } + + public final fun setSyncToPhysics(enable: Boolean): Unit { + Internals.writeArguments(BOOL to enable) + Internals.callMethod(rawPtr, MethodBindings.setSyncToPhysicsPtr, NIL) + } + + public final fun isSyncToPhysicsEnabled(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isSyncToPhysicsEnabledPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public companion object + + public object MethodBindings { + internal val setSyncToPhysicsPtr: VoidPtr = + Internals.getMethodBindPtr("AnimatableBody3D", "set_sync_to_physics", 2586408642) + + internal val isSyncToPhysicsEnabledPtr: VoidPtr = + Internals.getMethodBindPtr("AnimatableBody3D", "is_sync_to_physics_enabled", 36873697) + } +} diff --git a/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AnimatedSprite2D.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AnimatedSprite2D.kt new file mode 100644 index 0000000000..d185235020 --- /dev/null +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AnimatedSprite2D.kt @@ -0,0 +1,506 @@ +// THIS FILE IS GENERATED! DO NOT EDIT IT MANUALLY! +@file:Suppress("PackageDirectoryMismatch", "unused", "FunctionName", "RedundantModalityModifier", + "UNCHECKED_CAST", "JoinDeclarationAndAssignment", "USELESS_CAST", + "RemoveRedundantQualifierName", "NOTHING_TO_INLINE", "NON_FINAL_MEMBER_IN_OBJECT", + "RedundantVisibilityModifier", "RedundantUnitReturnType", "MemberVisibilityCanBePrivate") + +package godot + +import godot.`annotation`.CoreTypeHelper +import godot.`annotation`.CoreTypeLocalCopy +import godot.`annotation`.GodotBaseType +import godot.core.Signal0 +import godot.core.StringName +import godot.core.VariantParser.BOOL +import godot.core.VariantParser.DOUBLE +import godot.core.VariantParser.LONG +import godot.core.VariantParser.NIL +import godot.core.VariantParser.OBJECT +import godot.core.VariantParser.STRING +import godot.core.VariantParser.STRING_NAME +import godot.core.VariantParser.VECTOR2 +import godot.core.Vector2 +import godot.util.Internals +import godot.util.VoidPtr +import kotlin.Boolean +import kotlin.Double +import kotlin.Float +import kotlin.Int +import kotlin.Long +import kotlin.String +import kotlin.Suppress +import kotlin.Unit +import kotlin.jvm.JvmName +import kotlin.jvm.JvmOverloads + +private const val ENGINE_CLASS_ANIMATEDSPRITE2D_INDEX: Int = 45 + +/** + * [AnimatedSprite2D] is similar to the [Sprite2D] node, except it carries multiple textures as + * animation frames. Animations are created using a [SpriteFrames] resource, which allows you to import + * image files (or a folder containing said files) to provide the animation frames for the sprite. The + * [SpriteFrames] resource can be configured in the editor via the SpriteFrames bottom panel. + */ +@GodotBaseType +public open class AnimatedSprite2D : Node2D() { + /** + * Emitted when [spriteFrames] changes. + */ + public val spriteFramesChanged: Signal0 by Signal0 + + /** + * Emitted when [animation] changes. + */ + public val animationChanged: Signal0 by Signal0 + + /** + * Emitted when [frame] changes. + */ + public val frameChanged: Signal0 by Signal0 + + /** + * Emitted when the animation loops. + */ + public val animationLooped: Signal0 by Signal0 + + /** + * Emitted when the animation reaches the end, or the start if it is played in reverse. When the + * animation finishes, it pauses the playback. + * **Note:** This signal is not emitted if an animation is looping. + */ + public val animationFinished: Signal0 by Signal0 + + /** + * The [SpriteFrames] resource containing the animation(s). Allows you the option to load, edit, + * clear, make unique and save the states of the [SpriteFrames] resource. + */ + public final inline var spriteFrames: SpriteFrames? + @JvmName("spriteFramesProperty") + get() = getSpriteFrames() + @JvmName("spriteFramesProperty") + set(`value`) { + setSpriteFrames(value) + } + + /** + * The current animation from the [spriteFrames] resource. If this value is changed, the [frame] + * counter and the [frameProgress] are reset. + */ + public final inline var animation: StringName + @JvmName("animationProperty") + get() = getAnimation() + @JvmName("animationProperty") + set(`value`) { + setAnimation(value) + } + + /** + * The key of the animation to play when the scene loads. + */ + public final inline var autoplay: String + @JvmName("autoplayProperty") + get() = getAutoplay() + @JvmName("autoplayProperty") + set(`value`) { + setAutoplay(value) + } + + /** + * The displayed animation frame's index. Setting this property also resets [frameProgress]. If + * this is not desired, use [setFrameAndProgress]. + */ + public final inline var frame: Int + @JvmName("frameProperty") + get() = getFrame() + @JvmName("frameProperty") + set(`value`) { + setFrame(value) + } + + /** + * The progress value between `0.0` and `1.0` until the current frame transitions to the next + * frame. If the animation is playing backwards, the value transitions from `1.0` to `0.0`. + */ + public final inline var frameProgress: Float + @JvmName("frameProgressProperty") + get() = getFrameProgress() + @JvmName("frameProgressProperty") + set(`value`) { + setFrameProgress(value) + } + + /** + * The speed scaling ratio. For example, if this value is `1`, then the animation plays at normal + * speed. If it's `0.5`, then it plays at half speed. If it's `2`, then it plays at double speed. + * If set to a negative value, the animation is played in reverse. If set to `0`, the animation + * will not advance. + */ + public final inline var speedScale: Float + @JvmName("speedScaleProperty") + get() = getSpeedScale() + @JvmName("speedScaleProperty") + set(`value`) { + setSpeedScale(value) + } + + /** + * If `true`, texture will be centered. + * **Note:** For games with a pixel art aesthetic, textures may appear deformed when centered. + * This is caused by their position being between pixels. To prevent this, set this property to + * `false`, or consider enabling [ProjectSettings.rendering/2d/snap/snap2dVerticesToPixel] and + * [ProjectSettings.rendering/2d/snap/snap2dTransformsToPixel]. + */ + public final inline var centered: Boolean + @JvmName("centeredProperty") + get() = isCentered() + @JvmName("centeredProperty") + set(`value`) { + setCentered(value) + } + + /** + * The texture's drawing offset. + */ + @CoreTypeLocalCopy + public final inline var offset: Vector2 + @JvmName("offsetProperty") + get() = getOffset() + @JvmName("offsetProperty") + set(`value`) { + setOffset(value) + } + + /** + * If `true`, texture is flipped horizontally. + */ + public final inline var flipH: Boolean + @JvmName("flipHProperty") + get() = isFlippedH() + @JvmName("flipHProperty") + set(`value`) { + setFlipH(value) + } + + /** + * If `true`, texture is flipped vertically. + */ + public final inline var flipV: Boolean + @JvmName("flipVProperty") + get() = isFlippedV() + @JvmName("flipVProperty") + set(`value`) { + setFlipV(value) + } + + public override fun new(scriptIndex: Int): Unit { + Internals.callConstructor(this, ENGINE_CLASS_ANIMATEDSPRITE2D_INDEX, scriptIndex) + } + + /** + * The texture's drawing offset. + * + * This is a helper function to make dealing with local copies easier. + * + * For more information, see our + * [documentation](https://godot-kotl.in/en/stable/user-guide/api-differences/#core-types). + * + * Allow to directly modify the local copy of the property and assign it back to the Object. + * + * Prefer that over writing: + * `````` + * val myCoreType = animatedsprite2d.offset + * //Your changes + * animatedsprite2d.offset = myCoreType + * `````` + */ + @CoreTypeHelper + public final fun offsetMutate(block: Vector2.() -> Unit): Vector2 = offset.apply{ + block(this) + offset = this + } + + + public final fun setSpriteFrames(spriteFrames: SpriteFrames?): Unit { + Internals.writeArguments(OBJECT to spriteFrames) + Internals.callMethod(rawPtr, MethodBindings.setSpriteFramesPtr, NIL) + } + + public final fun getSpriteFrames(): SpriteFrames? { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getSpriteFramesPtr, OBJECT) + return (Internals.readReturnValue(OBJECT) as SpriteFrames?) + } + + public final fun setAnimation(name: StringName): Unit { + Internals.writeArguments(STRING_NAME to name) + Internals.callMethod(rawPtr, MethodBindings.setAnimationPtr, NIL) + } + + public final fun getAnimation(): StringName { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getAnimationPtr, STRING_NAME) + return (Internals.readReturnValue(STRING_NAME) as StringName) + } + + public final fun setAutoplay(name: String): Unit { + Internals.writeArguments(STRING to name) + Internals.callMethod(rawPtr, MethodBindings.setAutoplayPtr, NIL) + } + + public final fun getAutoplay(): String { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getAutoplayPtr, STRING) + return (Internals.readReturnValue(STRING) as String) + } + + /** + * Returns `true` if an animation is currently playing (even if [speedScale] and/or `custom_speed` + * are `0`). + */ + public final fun isPlaying(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isPlayingPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + /** + * Plays the animation with key [name]. If [customSpeed] is negative and [fromEnd] is `true`, the + * animation will play backwards (which is equivalent to calling [playBackwards]). + * If this method is called with that same animation [name], or with no [name] parameter, the + * assigned animation will resume playing if it was paused. + */ + @JvmOverloads + public final fun play( + name: StringName = StringName(""), + customSpeed: Float = 1.0f, + fromEnd: Boolean = false, + ): Unit { + Internals.writeArguments(STRING_NAME to name, DOUBLE to customSpeed.toDouble(), BOOL to fromEnd) + Internals.callMethod(rawPtr, MethodBindings.playPtr, NIL) + } + + /** + * Plays the animation with key [name] in reverse. + * This method is a shorthand for [play] with `custom_speed = -1.0` and `from_end = true`, so see + * its description for more information. + */ + @JvmOverloads + public final fun playBackwards(name: StringName = StringName("")): Unit { + Internals.writeArguments(STRING_NAME to name) + Internals.callMethod(rawPtr, MethodBindings.playBackwardsPtr, NIL) + } + + /** + * Pauses the currently playing animation. The [frame] and [frameProgress] will be kept and + * calling [play] or [playBackwards] without arguments will resume the animation from the current + * playback position. + * See also [stop]. + */ + public final fun pause(): Unit { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.pausePtr, NIL) + } + + /** + * Stops the currently playing animation. The animation position is reset to `0` and the + * `custom_speed` is reset to `1.0`. See also [pause]. + */ + public final fun stop(): Unit { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.stopPtr, NIL) + } + + public final fun setCentered(centered: Boolean): Unit { + Internals.writeArguments(BOOL to centered) + Internals.callMethod(rawPtr, MethodBindings.setCenteredPtr, NIL) + } + + public final fun isCentered(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isCenteredPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public final fun setOffset(offset: Vector2): Unit { + Internals.writeArguments(VECTOR2 to offset) + Internals.callMethod(rawPtr, MethodBindings.setOffsetPtr, NIL) + } + + public final fun getOffset(): Vector2 { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getOffsetPtr, VECTOR2) + return (Internals.readReturnValue(VECTOR2) as Vector2) + } + + public final fun setFlipH(flipH: Boolean): Unit { + Internals.writeArguments(BOOL to flipH) + Internals.callMethod(rawPtr, MethodBindings.setFlipHPtr, NIL) + } + + public final fun isFlippedH(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isFlippedHPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public final fun setFlipV(flipV: Boolean): Unit { + Internals.writeArguments(BOOL to flipV) + Internals.callMethod(rawPtr, MethodBindings.setFlipVPtr, NIL) + } + + public final fun isFlippedV(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isFlippedVPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public final fun setFrame(frame: Int): Unit { + Internals.writeArguments(LONG to frame.toLong()) + Internals.callMethod(rawPtr, MethodBindings.setFramePtr, NIL) + } + + public final fun getFrame(): Int { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getFramePtr, LONG) + return (Internals.readReturnValue(LONG) as Long).toInt() + } + + public final fun setFrameProgress(progress: Float): Unit { + Internals.writeArguments(DOUBLE to progress.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setFrameProgressPtr, NIL) + } + + public final fun getFrameProgress(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getFrameProgressPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + /** + * The setter of [frame] resets the [frameProgress] to `0.0` implicitly, but this method avoids + * that. + * This is useful when you want to carry over the current [frameProgress] to another [frame]. + * **Example:** + * + * gdscript: + * ```gdscript + * # Change the animation with keeping the frame index and progress. + * var current_frame = animated_sprite.get_frame() + * var current_progress = animated_sprite.get_frame_progress() + * animated_sprite.play("walk_another_skin") + * animated_sprite.set_frame_and_progress(current_frame, current_progress) + * ``` + */ + public final fun setFrameAndProgress(frame: Int, progress: Float): Unit { + Internals.writeArguments(LONG to frame.toLong(), DOUBLE to progress.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setFrameAndProgressPtr, NIL) + } + + public final fun setSpeedScale(speedScale: Float): Unit { + Internals.writeArguments(DOUBLE to speedScale.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setSpeedScalePtr, NIL) + } + + public final fun getSpeedScale(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getSpeedScalePtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + /** + * Returns the actual playing speed of current animation or `0` if not playing. This speed is the + * [speedScale] property multiplied by `custom_speed` argument specified when calling the [play] + * method. + * Returns a negative value if the current animation is playing backwards. + */ + public final fun getPlayingSpeed(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getPlayingSpeedPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public companion object + + public object MethodBindings { + internal val setSpriteFramesPtr: VoidPtr = + Internals.getMethodBindPtr("AnimatedSprite2D", "set_sprite_frames", 905781144) + + internal val getSpriteFramesPtr: VoidPtr = + Internals.getMethodBindPtr("AnimatedSprite2D", "get_sprite_frames", 3804851214) + + internal val setAnimationPtr: VoidPtr = + Internals.getMethodBindPtr("AnimatedSprite2D", "set_animation", 3304788590) + + internal val getAnimationPtr: VoidPtr = + Internals.getMethodBindPtr("AnimatedSprite2D", "get_animation", 2002593661) + + internal val setAutoplayPtr: VoidPtr = + Internals.getMethodBindPtr("AnimatedSprite2D", "set_autoplay", 83702148) + + internal val getAutoplayPtr: VoidPtr = + Internals.getMethodBindPtr("AnimatedSprite2D", "get_autoplay", 201670096) + + internal val isPlayingPtr: VoidPtr = + Internals.getMethodBindPtr("AnimatedSprite2D", "is_playing", 36873697) + + internal val playPtr: VoidPtr = + Internals.getMethodBindPtr("AnimatedSprite2D", "play", 2372066587) + + internal val playBackwardsPtr: VoidPtr = + Internals.getMethodBindPtr("AnimatedSprite2D", "play_backwards", 1421762485) + + internal val pausePtr: VoidPtr = + Internals.getMethodBindPtr("AnimatedSprite2D", "pause", 3218959716) + + internal val stopPtr: VoidPtr = + Internals.getMethodBindPtr("AnimatedSprite2D", "stop", 3218959716) + + internal val setCenteredPtr: VoidPtr = + Internals.getMethodBindPtr("AnimatedSprite2D", "set_centered", 2586408642) + + internal val isCenteredPtr: VoidPtr = + Internals.getMethodBindPtr("AnimatedSprite2D", "is_centered", 36873697) + + internal val setOffsetPtr: VoidPtr = + Internals.getMethodBindPtr("AnimatedSprite2D", "set_offset", 743155724) + + internal val getOffsetPtr: VoidPtr = + Internals.getMethodBindPtr("AnimatedSprite2D", "get_offset", 3341600327) + + internal val setFlipHPtr: VoidPtr = + Internals.getMethodBindPtr("AnimatedSprite2D", "set_flip_h", 2586408642) + + internal val isFlippedHPtr: VoidPtr = + Internals.getMethodBindPtr("AnimatedSprite2D", "is_flipped_h", 36873697) + + internal val setFlipVPtr: VoidPtr = + Internals.getMethodBindPtr("AnimatedSprite2D", "set_flip_v", 2586408642) + + internal val isFlippedVPtr: VoidPtr = + Internals.getMethodBindPtr("AnimatedSprite2D", "is_flipped_v", 36873697) + + internal val setFramePtr: VoidPtr = + Internals.getMethodBindPtr("AnimatedSprite2D", "set_frame", 1286410249) + + internal val getFramePtr: VoidPtr = + Internals.getMethodBindPtr("AnimatedSprite2D", "get_frame", 3905245786) + + internal val setFrameProgressPtr: VoidPtr = + Internals.getMethodBindPtr("AnimatedSprite2D", "set_frame_progress", 373806689) + + internal val getFrameProgressPtr: VoidPtr = + Internals.getMethodBindPtr("AnimatedSprite2D", "get_frame_progress", 1740695150) + + internal val setFrameAndProgressPtr: VoidPtr = + Internals.getMethodBindPtr("AnimatedSprite2D", "set_frame_and_progress", 1602489585) + + internal val setSpeedScalePtr: VoidPtr = + Internals.getMethodBindPtr("AnimatedSprite2D", "set_speed_scale", 373806689) + + internal val getSpeedScalePtr: VoidPtr = + Internals.getMethodBindPtr("AnimatedSprite2D", "get_speed_scale", 1740695150) + + internal val getPlayingSpeedPtr: VoidPtr = + Internals.getMethodBindPtr("AnimatedSprite2D", "get_playing_speed", 1740695150) + } +} diff --git a/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AnimatedSprite3D.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AnimatedSprite3D.kt new file mode 100644 index 0000000000..5c6fc1b0c6 --- /dev/null +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AnimatedSprite3D.kt @@ -0,0 +1,362 @@ +// THIS FILE IS GENERATED! DO NOT EDIT IT MANUALLY! +@file:Suppress("PackageDirectoryMismatch", "unused", "FunctionName", "RedundantModalityModifier", + "UNCHECKED_CAST", "JoinDeclarationAndAssignment", "USELESS_CAST", + "RemoveRedundantQualifierName", "NOTHING_TO_INLINE", "NON_FINAL_MEMBER_IN_OBJECT", + "RedundantVisibilityModifier", "RedundantUnitReturnType", "MemberVisibilityCanBePrivate") + +package godot + +import godot.`annotation`.GodotBaseType +import godot.core.Signal0 +import godot.core.StringName +import godot.core.VariantParser.BOOL +import godot.core.VariantParser.DOUBLE +import godot.core.VariantParser.LONG +import godot.core.VariantParser.NIL +import godot.core.VariantParser.OBJECT +import godot.core.VariantParser.STRING +import godot.core.VariantParser.STRING_NAME +import godot.util.Internals +import godot.util.VoidPtr +import kotlin.Boolean +import kotlin.Double +import kotlin.Float +import kotlin.Int +import kotlin.Long +import kotlin.String +import kotlin.Suppress +import kotlin.Unit +import kotlin.jvm.JvmName +import kotlin.jvm.JvmOverloads + +private const val ENGINE_CLASS_ANIMATEDSPRITE3D_INDEX: Int = 46 + +/** + * [AnimatedSprite3D] is similar to the [Sprite3D] node, except it carries multiple textures as + * animation [spriteFrames]. Animations are created using a [SpriteFrames] resource, which allows you + * to import image files (or a folder containing said files) to provide the animation frames for the + * sprite. The [SpriteFrames] resource can be configured in the editor via the SpriteFrames bottom + * panel. + */ +@GodotBaseType +public open class AnimatedSprite3D : SpriteBase3D() { + /** + * Emitted when [spriteFrames] changes. + */ + public val spriteFramesChanged: Signal0 by Signal0 + + /** + * Emitted when [animation] changes. + */ + public val animationChanged: Signal0 by Signal0 + + /** + * Emitted when [frame] changes. + */ + public val frameChanged: Signal0 by Signal0 + + /** + * Emitted when the animation loops. + */ + public val animationLooped: Signal0 by Signal0 + + /** + * Emitted when the animation reaches the end, or the start if it is played in reverse. When the + * animation finishes, it pauses the playback. + * **Note:** This signal is not emitted if an animation is looping. + */ + public val animationFinished: Signal0 by Signal0 + + /** + * The [SpriteFrames] resource containing the animation(s). Allows you the option to load, edit, + * clear, make unique and save the states of the [SpriteFrames] resource. + */ + public final inline var spriteFrames: SpriteFrames? + @JvmName("spriteFramesProperty") + get() = getSpriteFrames() + @JvmName("spriteFramesProperty") + set(`value`) { + setSpriteFrames(value) + } + + /** + * The current animation from the [spriteFrames] resource. If this value is changed, the [frame] + * counter and the [frameProgress] are reset. + */ + public final inline var animation: StringName + @JvmName("animationProperty") + get() = getAnimation() + @JvmName("animationProperty") + set(`value`) { + setAnimation(value) + } + + /** + * The key of the animation to play when the scene loads. + */ + public final inline var autoplay: String + @JvmName("autoplayProperty") + get() = getAutoplay() + @JvmName("autoplayProperty") + set(`value`) { + setAutoplay(value) + } + + /** + * The displayed animation frame's index. Setting this property also resets [frameProgress]. If + * this is not desired, use [setFrameAndProgress]. + */ + public final inline var frame: Int + @JvmName("frameProperty") + get() = getFrame() + @JvmName("frameProperty") + set(`value`) { + setFrame(value) + } + + /** + * The progress value between `0.0` and `1.0` until the current frame transitions to the next + * frame. If the animation is playing backwards, the value transitions from `1.0` to `0.0`. + */ + public final inline var frameProgress: Float + @JvmName("frameProgressProperty") + get() = getFrameProgress() + @JvmName("frameProgressProperty") + set(`value`) { + setFrameProgress(value) + } + + /** + * The speed scaling ratio. For example, if this value is `1`, then the animation plays at normal + * speed. If it's `0.5`, then it plays at half speed. If it's `2`, then it plays at double speed. + * If set to a negative value, the animation is played in reverse. If set to `0`, the animation + * will not advance. + */ + public final inline var speedScale: Float + @JvmName("speedScaleProperty") + get() = getSpeedScale() + @JvmName("speedScaleProperty") + set(`value`) { + setSpeedScale(value) + } + + public override fun new(scriptIndex: Int): Unit { + Internals.callConstructor(this, ENGINE_CLASS_ANIMATEDSPRITE3D_INDEX, scriptIndex) + } + + public final fun setSpriteFrames(spriteFrames: SpriteFrames?): Unit { + Internals.writeArguments(OBJECT to spriteFrames) + Internals.callMethod(rawPtr, MethodBindings.setSpriteFramesPtr, NIL) + } + + public final fun getSpriteFrames(): SpriteFrames? { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getSpriteFramesPtr, OBJECT) + return (Internals.readReturnValue(OBJECT) as SpriteFrames?) + } + + public final fun setAnimation(name: StringName): Unit { + Internals.writeArguments(STRING_NAME to name) + Internals.callMethod(rawPtr, MethodBindings.setAnimationPtr, NIL) + } + + public final fun getAnimation(): StringName { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getAnimationPtr, STRING_NAME) + return (Internals.readReturnValue(STRING_NAME) as StringName) + } + + public final fun setAutoplay(name: String): Unit { + Internals.writeArguments(STRING to name) + Internals.callMethod(rawPtr, MethodBindings.setAutoplayPtr, NIL) + } + + public final fun getAutoplay(): String { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getAutoplayPtr, STRING) + return (Internals.readReturnValue(STRING) as String) + } + + /** + * Returns `true` if an animation is currently playing (even if [speedScale] and/or `custom_speed` + * are `0`). + */ + public final fun isPlaying(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isPlayingPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + /** + * Plays the animation with key [name]. If [customSpeed] is negative and [fromEnd] is `true`, the + * animation will play backwards (which is equivalent to calling [playBackwards]). + * If this method is called with that same animation [name], or with no [name] parameter, the + * assigned animation will resume playing if it was paused. + */ + @JvmOverloads + public final fun play( + name: StringName = StringName(""), + customSpeed: Float = 1.0f, + fromEnd: Boolean = false, + ): Unit { + Internals.writeArguments(STRING_NAME to name, DOUBLE to customSpeed.toDouble(), BOOL to fromEnd) + Internals.callMethod(rawPtr, MethodBindings.playPtr, NIL) + } + + /** + * Plays the animation with key [name] in reverse. + * This method is a shorthand for [play] with `custom_speed = -1.0` and `from_end = true`, so see + * its description for more information. + */ + @JvmOverloads + public final fun playBackwards(name: StringName = StringName("")): Unit { + Internals.writeArguments(STRING_NAME to name) + Internals.callMethod(rawPtr, MethodBindings.playBackwardsPtr, NIL) + } + + /** + * Pauses the currently playing animation. The [frame] and [frameProgress] will be kept and + * calling [play] or [playBackwards] without arguments will resume the animation from the current + * playback position. + * See also [stop]. + */ + public final fun pause(): Unit { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.pausePtr, NIL) + } + + /** + * Stops the currently playing animation. The animation position is reset to `0` and the + * `custom_speed` is reset to `1.0`. See also [pause]. + */ + public final fun stop(): Unit { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.stopPtr, NIL) + } + + public final fun setFrame(frame: Int): Unit { + Internals.writeArguments(LONG to frame.toLong()) + Internals.callMethod(rawPtr, MethodBindings.setFramePtr, NIL) + } + + public final fun getFrame(): Int { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getFramePtr, LONG) + return (Internals.readReturnValue(LONG) as Long).toInt() + } + + public final fun setFrameProgress(progress: Float): Unit { + Internals.writeArguments(DOUBLE to progress.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setFrameProgressPtr, NIL) + } + + public final fun getFrameProgress(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getFrameProgressPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + /** + * The setter of [frame] resets the [frameProgress] to `0.0` implicitly, but this method avoids + * that. + * This is useful when you want to carry over the current [frameProgress] to another [frame]. + * **Example:** + * + * gdscript: + * ```gdscript + * # Change the animation with keeping the frame index and progress. + * var current_frame = animated_sprite.get_frame() + * var current_progress = animated_sprite.get_frame_progress() + * animated_sprite.play("walk_another_skin") + * animated_sprite.set_frame_and_progress(current_frame, current_progress) + * ``` + */ + public final fun setFrameAndProgress(frame: Int, progress: Float): Unit { + Internals.writeArguments(LONG to frame.toLong(), DOUBLE to progress.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setFrameAndProgressPtr, NIL) + } + + public final fun setSpeedScale(speedScale: Float): Unit { + Internals.writeArguments(DOUBLE to speedScale.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setSpeedScalePtr, NIL) + } + + public final fun getSpeedScale(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getSpeedScalePtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + /** + * Returns the actual playing speed of current animation or `0` if not playing. This speed is the + * [speedScale] property multiplied by `custom_speed` argument specified when calling the [play] + * method. + * Returns a negative value if the current animation is playing backwards. + */ + public final fun getPlayingSpeed(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getPlayingSpeedPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public companion object + + public object MethodBindings { + internal val setSpriteFramesPtr: VoidPtr = + Internals.getMethodBindPtr("AnimatedSprite3D", "set_sprite_frames", 905781144) + + internal val getSpriteFramesPtr: VoidPtr = + Internals.getMethodBindPtr("AnimatedSprite3D", "get_sprite_frames", 3804851214) + + internal val setAnimationPtr: VoidPtr = + Internals.getMethodBindPtr("AnimatedSprite3D", "set_animation", 3304788590) + + internal val getAnimationPtr: VoidPtr = + Internals.getMethodBindPtr("AnimatedSprite3D", "get_animation", 2002593661) + + internal val setAutoplayPtr: VoidPtr = + Internals.getMethodBindPtr("AnimatedSprite3D", "set_autoplay", 83702148) + + internal val getAutoplayPtr: VoidPtr = + Internals.getMethodBindPtr("AnimatedSprite3D", "get_autoplay", 201670096) + + internal val isPlayingPtr: VoidPtr = + Internals.getMethodBindPtr("AnimatedSprite3D", "is_playing", 36873697) + + internal val playPtr: VoidPtr = + Internals.getMethodBindPtr("AnimatedSprite3D", "play", 2372066587) + + internal val playBackwardsPtr: VoidPtr = + Internals.getMethodBindPtr("AnimatedSprite3D", "play_backwards", 1421762485) + + internal val pausePtr: VoidPtr = + Internals.getMethodBindPtr("AnimatedSprite3D", "pause", 3218959716) + + internal val stopPtr: VoidPtr = + Internals.getMethodBindPtr("AnimatedSprite3D", "stop", 3218959716) + + internal val setFramePtr: VoidPtr = + Internals.getMethodBindPtr("AnimatedSprite3D", "set_frame", 1286410249) + + internal val getFramePtr: VoidPtr = + Internals.getMethodBindPtr("AnimatedSprite3D", "get_frame", 3905245786) + + internal val setFrameProgressPtr: VoidPtr = + Internals.getMethodBindPtr("AnimatedSprite3D", "set_frame_progress", 373806689) + + internal val getFrameProgressPtr: VoidPtr = + Internals.getMethodBindPtr("AnimatedSprite3D", "get_frame_progress", 1740695150) + + internal val setFrameAndProgressPtr: VoidPtr = + Internals.getMethodBindPtr("AnimatedSprite3D", "set_frame_and_progress", 1602489585) + + internal val setSpeedScalePtr: VoidPtr = + Internals.getMethodBindPtr("AnimatedSprite3D", "set_speed_scale", 373806689) + + internal val getSpeedScalePtr: VoidPtr = + Internals.getMethodBindPtr("AnimatedSprite3D", "get_speed_scale", 1740695150) + + internal val getPlayingSpeedPtr: VoidPtr = + Internals.getMethodBindPtr("AnimatedSprite3D", "get_playing_speed", 1740695150) + } +} diff --git a/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AnimatedTexture.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AnimatedTexture.kt new file mode 100644 index 0000000000..730cc35bf4 --- /dev/null +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AnimatedTexture.kt @@ -0,0 +1,253 @@ +// THIS FILE IS GENERATED! DO NOT EDIT IT MANUALLY! +@file:Suppress("PackageDirectoryMismatch", "unused", "FunctionName", "RedundantModalityModifier", + "UNCHECKED_CAST", "JoinDeclarationAndAssignment", "USELESS_CAST", + "RemoveRedundantQualifierName", "NOTHING_TO_INLINE", "NON_FINAL_MEMBER_IN_OBJECT", + "RedundantVisibilityModifier", "RedundantUnitReturnType", "MemberVisibilityCanBePrivate") + +package godot + +import godot.`annotation`.GodotBaseType +import godot.core.VariantParser.BOOL +import godot.core.VariantParser.DOUBLE +import godot.core.VariantParser.LONG +import godot.core.VariantParser.NIL +import godot.core.VariantParser.OBJECT +import godot.util.Internals +import godot.util.VoidPtr +import kotlin.Boolean +import kotlin.Double +import kotlin.Float +import kotlin.Int +import kotlin.Long +import kotlin.Suppress +import kotlin.Unit +import kotlin.jvm.JvmName + +private const val ENGINE_CLASS_ANIMATEDTEXTURE_INDEX: Int = 47 + +/** + * [AnimatedTexture] is a resource format for frame-based animations, where multiple textures can be + * chained automatically with a predefined delay for each frame. Unlike [AnimationPlayer] or + * [AnimatedSprite2D], it isn't a [Node], but has the advantage of being usable anywhere a [Texture2D] + * resource can be used, e.g. in a [TileSet]. + * The playback of the animation is controlled by the [speedScale] property, as well as each frame's + * duration (see [setFrameDuration]). The animation loops, i.e. it will restart at frame 0 + * automatically after playing the last frame. + * [AnimatedTexture] currently requires all frame textures to have the same size, otherwise the + * bigger ones will be cropped to match the smallest one. + * **Note:** AnimatedTexture doesn't support using [AtlasTexture]s. Each frame needs to be a + * separate [Texture2D]. + * **Warning:** The current implementation is not efficient for the modern renderers. + */ +@GodotBaseType +public open class AnimatedTexture : Texture2D() { + /** + * Number of frames to use in the animation. While you can create the frames independently with + * [setFrameTexture], you need to set this value for the animation to take new frames into account. + * The maximum number of frames is [MAX_FRAMES]. + */ + public final inline var frames: Int + @JvmName("framesProperty") + get() = getFrames() + @JvmName("framesProperty") + set(`value`) { + setFrames(value) + } + + /** + * Sets the currently visible frame of the texture. Setting this frame while playing resets the + * current frame time, so the newly selected frame plays for its whole configured frame duration. + */ + public final inline var currentFrame: Int + @JvmName("currentFrameProperty") + get() = getCurrentFrame() + @JvmName("currentFrameProperty") + set(`value`) { + setCurrentFrame(value) + } + + /** + * If `true`, the animation will pause where it currently is (i.e. at [currentFrame]). The + * animation will continue from where it was paused when changing this property to `false`. + */ + public final inline var pause: Boolean + @JvmName("pauseProperty") + get() = getPause() + @JvmName("pauseProperty") + set(`value`) { + setPause(value) + } + + /** + * If `true`, the animation will only play once and will not loop back to the first frame after + * reaching the end. Note that reaching the end will not set [pause] to `true`. + */ + public final inline var oneShot: Boolean + @JvmName("oneShotProperty") + get() = getOneShot() + @JvmName("oneShotProperty") + set(`value`) { + setOneShot(value) + } + + /** + * The animation speed is multiplied by this value. If set to a negative value, the animation is + * played in reverse. + */ + public final inline var speedScale: Float + @JvmName("speedScaleProperty") + get() = getSpeedScale() + @JvmName("speedScaleProperty") + set(`value`) { + setSpeedScale(value) + } + + public override fun new(scriptIndex: Int): Unit { + Internals.callConstructor(this, ENGINE_CLASS_ANIMATEDTEXTURE_INDEX, scriptIndex) + } + + public final fun setFrames(frames: Int): Unit { + Internals.writeArguments(LONG to frames.toLong()) + Internals.callMethod(rawPtr, MethodBindings.setFramesPtr, NIL) + } + + public final fun getFrames(): Int { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getFramesPtr, LONG) + return (Internals.readReturnValue(LONG) as Long).toInt() + } + + public final fun setCurrentFrame(frame: Int): Unit { + Internals.writeArguments(LONG to frame.toLong()) + Internals.callMethod(rawPtr, MethodBindings.setCurrentFramePtr, NIL) + } + + public final fun getCurrentFrame(): Int { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getCurrentFramePtr, LONG) + return (Internals.readReturnValue(LONG) as Long).toInt() + } + + public final fun setPause(pause: Boolean): Unit { + Internals.writeArguments(BOOL to pause) + Internals.callMethod(rawPtr, MethodBindings.setPausePtr, NIL) + } + + public final fun getPause(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getPausePtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public final fun setOneShot(oneShot: Boolean): Unit { + Internals.writeArguments(BOOL to oneShot) + Internals.callMethod(rawPtr, MethodBindings.setOneShotPtr, NIL) + } + + public final fun getOneShot(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getOneShotPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public final fun setSpeedScale(scale: Float): Unit { + Internals.writeArguments(DOUBLE to scale.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setSpeedScalePtr, NIL) + } + + public final fun getSpeedScale(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getSpeedScalePtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + /** + * Assigns a [Texture2D] to the given frame. Frame IDs start at 0, so the first frame has ID 0, + * and the last frame of the animation has ID [frames] - 1. + * You can define any number of textures up to [MAX_FRAMES], but keep in mind that only frames + * from 0 to [frames] - 1 will be part of the animation. + */ + public final fun setFrameTexture(frame: Int, texture: Texture2D?): Unit { + Internals.writeArguments(LONG to frame.toLong(), OBJECT to texture) + Internals.callMethod(rawPtr, MethodBindings.setFrameTexturePtr, NIL) + } + + /** + * Returns the given frame's [Texture2D]. + */ + public final fun getFrameTexture(frame: Int): Texture2D? { + Internals.writeArguments(LONG to frame.toLong()) + Internals.callMethod(rawPtr, MethodBindings.getFrameTexturePtr, OBJECT) + return (Internals.readReturnValue(OBJECT) as Texture2D?) + } + + /** + * Sets the duration of any given [frame]. The final duration is affected by the [speedScale]. If + * set to `0`, the frame is skipped during playback. + */ + public final fun setFrameDuration(frame: Int, duration: Float): Unit { + Internals.writeArguments(LONG to frame.toLong(), DOUBLE to duration.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setFrameDurationPtr, NIL) + } + + /** + * Returns the given [frame]'s duration, in seconds. + */ + public final fun getFrameDuration(frame: Int): Float { + Internals.writeArguments(LONG to frame.toLong()) + Internals.callMethod(rawPtr, MethodBindings.getFrameDurationPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public companion object { + /** + * The maximum number of frames supported by [AnimatedTexture]. If you need more frames in your + * animation, use [AnimationPlayer] or [AnimatedSprite2D]. + */ + public final const val MAX_FRAMES: Long = 256 + } + + public object MethodBindings { + internal val setFramesPtr: VoidPtr = + Internals.getMethodBindPtr("AnimatedTexture", "set_frames", 1286410249) + + internal val getFramesPtr: VoidPtr = + Internals.getMethodBindPtr("AnimatedTexture", "get_frames", 3905245786) + + internal val setCurrentFramePtr: VoidPtr = + Internals.getMethodBindPtr("AnimatedTexture", "set_current_frame", 1286410249) + + internal val getCurrentFramePtr: VoidPtr = + Internals.getMethodBindPtr("AnimatedTexture", "get_current_frame", 3905245786) + + internal val setPausePtr: VoidPtr = + Internals.getMethodBindPtr("AnimatedTexture", "set_pause", 2586408642) + + internal val getPausePtr: VoidPtr = + Internals.getMethodBindPtr("AnimatedTexture", "get_pause", 36873697) + + internal val setOneShotPtr: VoidPtr = + Internals.getMethodBindPtr("AnimatedTexture", "set_one_shot", 2586408642) + + internal val getOneShotPtr: VoidPtr = + Internals.getMethodBindPtr("AnimatedTexture", "get_one_shot", 36873697) + + internal val setSpeedScalePtr: VoidPtr = + Internals.getMethodBindPtr("AnimatedTexture", "set_speed_scale", 373806689) + + internal val getSpeedScalePtr: VoidPtr = + Internals.getMethodBindPtr("AnimatedTexture", "get_speed_scale", 1740695150) + + internal val setFrameTexturePtr: VoidPtr = + Internals.getMethodBindPtr("AnimatedTexture", "set_frame_texture", 666127730) + + internal val getFrameTexturePtr: VoidPtr = + Internals.getMethodBindPtr("AnimatedTexture", "get_frame_texture", 3536238170) + + internal val setFrameDurationPtr: VoidPtr = + Internals.getMethodBindPtr("AnimatedTexture", "set_frame_duration", 1602489585) + + internal val getFrameDurationPtr: VoidPtr = + Internals.getMethodBindPtr("AnimatedTexture", "get_frame_duration", 2339986948) + } +} diff --git a/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/Animation.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/Animation.kt new file mode 100644 index 0000000000..872387660d --- /dev/null +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/Animation.kt @@ -0,0 +1,1350 @@ +// THIS FILE IS GENERATED! DO NOT EDIT IT MANUALLY! +@file:Suppress("PackageDirectoryMismatch", "unused", "FunctionName", "RedundantModalityModifier", + "UNCHECKED_CAST", "JoinDeclarationAndAssignment", "USELESS_CAST", + "RemoveRedundantQualifierName", "NOTHING_TO_INLINE", "NON_FINAL_MEMBER_IN_OBJECT", + "RedundantVisibilityModifier", "RedundantUnitReturnType", "MemberVisibilityCanBePrivate") + +package godot + +import godot.`annotation`.GodotBaseType +import godot.core.NodePath +import godot.core.Quaternion +import godot.core.StringName +import godot.core.VariantArray +import godot.core.VariantCaster.ANY +import godot.core.VariantParser.ARRAY +import godot.core.VariantParser.BOOL +import godot.core.VariantParser.DOUBLE +import godot.core.VariantParser.LONG +import godot.core.VariantParser.NIL +import godot.core.VariantParser.NODE_PATH +import godot.core.VariantParser.OBJECT +import godot.core.VariantParser.QUATERNION +import godot.core.VariantParser.STRING_NAME +import godot.core.VariantParser.VECTOR2 +import godot.core.VariantParser.VECTOR3 +import godot.core.Vector2 +import godot.core.Vector3 +import godot.util.Internals +import godot.util.VoidPtr +import kotlin.Any +import kotlin.Boolean +import kotlin.Double +import kotlin.Float +import kotlin.Int +import kotlin.Long +import kotlin.Suppress +import kotlin.Unit +import kotlin.jvm.JvmName +import kotlin.jvm.JvmOverloads + +private const val ENGINE_CLASS_ANIMATION_INDEX: Int = 48 + +/** + * This resource holds data that can be used to animate anything in the engine. Animations are + * divided into tracks and each track must be linked to a node. The state of that node can be changed + * through time, by adding timed keys (events) to the track. + * + * gdscript: + * ```gdscript + * # This creates an animation that makes the node "Enemy" move to the right by + * # 100 pixels in 2.0 seconds. + * var animation = Animation.new() + * var track_index = animation.add_track(Animation.TYPE_VALUE) + * animation.track_set_path(track_index, "Enemy:position:x") + * animation.track_insert_key(track_index, 0.0, 0) + * animation.track_insert_key(track_index, 2.0, 100) + * animation.length = 2.0 + * ``` + * csharp: + * ```csharp + * // This creates an animation that makes the node "Enemy" move to the right by + * // 100 pixels in 2.0 seconds. + * var animation = new Animation(); + * int trackIndex = animation.AddTrack(Animation.TrackType.Value); + * animation.TrackSetPath(trackIndex, "Enemy:position:x"); + * animation.TrackInsertKey(trackIndex, 0.0f, 0); + * animation.TrackInsertKey(trackIndex, 2.0f, 100); + * animation.Length = 2.0f; + * ``` + * + * Animations are just data containers, and must be added to nodes such as an [AnimationPlayer] to + * be played back. Animation tracks have different types, each with its own set of dedicated methods. + * Check [TrackType] to see available types. + * **Note:** For 3D position/rotation/scale, using the dedicated [TYPE_POSITION_3D], + * [TYPE_ROTATION_3D] and [TYPE_SCALE_3D] track types instead of [TYPE_VALUE] is recommended for + * performance reasons. + */ +@GodotBaseType +public open class Animation : Resource() { + /** + * The total length of the animation (in seconds). + * **Note:** Length is not delimited by the last key, as this one may be before or after the end + * to ensure correct interpolation and looping. + */ + public final inline var length: Float + @JvmName("lengthProperty") + get() = getLength() + @JvmName("lengthProperty") + set(`value`) { + setLength(value) + } + + /** + * Determines the behavior of both ends of the animation timeline during animation playback. This + * is used for correct interpolation of animation cycles, and for hinting the player that it must + * restart the animation. + */ + public final inline var loopMode: LoopMode + @JvmName("loopModeProperty") + get() = getLoopMode() + @JvmName("loopModeProperty") + set(`value`) { + setLoopMode(value) + } + + /** + * The animation step value. + */ + public final inline var step: Float + @JvmName("stepProperty") + get() = getStep() + @JvmName("stepProperty") + set(`value`) { + setStep(value) + } + + /** + * Returns `true` if the capture track is included. This is a cached readonly value for + * performance. + */ + public final inline val captureIncluded: Boolean + @JvmName("captureIncludedProperty") + get() = isCaptureIncluded() + + public override fun new(scriptIndex: Int): Unit { + Internals.callConstructor(this, ENGINE_CLASS_ANIMATION_INDEX, scriptIndex) + } + + /** + * Adds a track to the Animation. + */ + @JvmOverloads + public final fun addTrack(type: TrackType, atPosition: Int = -1): Int { + Internals.writeArguments(LONG to type.id, LONG to atPosition.toLong()) + Internals.callMethod(rawPtr, MethodBindings.addTrackPtr, LONG) + return (Internals.readReturnValue(LONG) as Long).toInt() + } + + /** + * Removes a track by specifying the track index. + */ + public final fun removeTrack(trackIdx: Int): Unit { + Internals.writeArguments(LONG to trackIdx.toLong()) + Internals.callMethod(rawPtr, MethodBindings.removeTrackPtr, NIL) + } + + /** + * Returns the amount of tracks in the animation. + */ + public final fun getTrackCount(): Int { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getTrackCountPtr, LONG) + return (Internals.readReturnValue(LONG) as Long).toInt() + } + + /** + * Gets the type of a track. + */ + public final fun trackGetType(trackIdx: Int): TrackType { + Internals.writeArguments(LONG to trackIdx.toLong()) + Internals.callMethod(rawPtr, MethodBindings.trackGetTypePtr, LONG) + return Animation.TrackType.from(Internals.readReturnValue(LONG) as Long) + } + + /** + * Gets the path of a track. For more information on the path format, see [trackSetPath]. + */ + public final fun trackGetPath(trackIdx: Int): NodePath { + Internals.writeArguments(LONG to trackIdx.toLong()) + Internals.callMethod(rawPtr, MethodBindings.trackGetPathPtr, NODE_PATH) + return (Internals.readReturnValue(NODE_PATH) as NodePath) + } + + /** + * Sets the path of a track. Paths must be valid scene-tree paths to a node and must be specified + * starting from the [AnimationMixer.rootNode] that will reproduce the animation. Tracks that control + * properties or bones must append their name after the path, separated by `":"`. + * For example, `"character/skeleton:ankle"` or `"character/mesh:transform/local"`. + */ + public final fun trackSetPath(trackIdx: Int, path: NodePath): Unit { + Internals.writeArguments(LONG to trackIdx.toLong(), NODE_PATH to path) + Internals.callMethod(rawPtr, MethodBindings.trackSetPathPtr, NIL) + } + + /** + * Returns the index of the specified track. If the track is not found, return -1. + */ + public final fun findTrack(path: NodePath, type: TrackType): Int { + Internals.writeArguments(NODE_PATH to path, LONG to type.id) + Internals.callMethod(rawPtr, MethodBindings.findTrackPtr, LONG) + return (Internals.readReturnValue(LONG) as Long).toInt() + } + + /** + * Moves a track up. + */ + public final fun trackMoveUp(trackIdx: Int): Unit { + Internals.writeArguments(LONG to trackIdx.toLong()) + Internals.callMethod(rawPtr, MethodBindings.trackMoveUpPtr, NIL) + } + + /** + * Moves a track down. + */ + public final fun trackMoveDown(trackIdx: Int): Unit { + Internals.writeArguments(LONG to trackIdx.toLong()) + Internals.callMethod(rawPtr, MethodBindings.trackMoveDownPtr, NIL) + } + + /** + * Changes the index position of track [trackIdx] to the one defined in [toIdx]. + */ + public final fun trackMoveTo(trackIdx: Int, toIdx: Int): Unit { + Internals.writeArguments(LONG to trackIdx.toLong(), LONG to toIdx.toLong()) + Internals.callMethod(rawPtr, MethodBindings.trackMoveToPtr, NIL) + } + + /** + * Swaps the track [trackIdx]'s index position with the track [withIdx]. + */ + public final fun trackSwap(trackIdx: Int, withIdx: Int): Unit { + Internals.writeArguments(LONG to trackIdx.toLong(), LONG to withIdx.toLong()) + Internals.callMethod(rawPtr, MethodBindings.trackSwapPtr, NIL) + } + + /** + * Sets the given track as imported or not. + */ + public final fun trackSetImported(trackIdx: Int, imported: Boolean): Unit { + Internals.writeArguments(LONG to trackIdx.toLong(), BOOL to imported) + Internals.callMethod(rawPtr, MethodBindings.trackSetImportedPtr, NIL) + } + + /** + * Returns `true` if the given track is imported. Else, return `false`. + */ + public final fun trackIsImported(trackIdx: Int): Boolean { + Internals.writeArguments(LONG to trackIdx.toLong()) + Internals.callMethod(rawPtr, MethodBindings.trackIsImportedPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + /** + * Enables/disables the given track. Tracks are enabled by default. + */ + public final fun trackSetEnabled(trackIdx: Int, enabled: Boolean): Unit { + Internals.writeArguments(LONG to trackIdx.toLong(), BOOL to enabled) + Internals.callMethod(rawPtr, MethodBindings.trackSetEnabledPtr, NIL) + } + + /** + * Returns `true` if the track at index [trackIdx] is enabled. + */ + public final fun trackIsEnabled(trackIdx: Int): Boolean { + Internals.writeArguments(LONG to trackIdx.toLong()) + Internals.callMethod(rawPtr, MethodBindings.trackIsEnabledPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + /** + * Inserts a key in a given 3D position track. Returns the key index. + */ + public final fun positionTrackInsertKey( + trackIdx: Int, + time: Double, + position: Vector3, + ): Int { + Internals.writeArguments(LONG to trackIdx.toLong(), DOUBLE to time, VECTOR3 to position) + Internals.callMethod(rawPtr, MethodBindings.positionTrackInsertKeyPtr, LONG) + return (Internals.readReturnValue(LONG) as Long).toInt() + } + + /** + * Inserts a key in a given 3D rotation track. Returns the key index. + */ + public final fun rotationTrackInsertKey( + trackIdx: Int, + time: Double, + rotation: Quaternion, + ): Int { + Internals.writeArguments(LONG to trackIdx.toLong(), DOUBLE to time, QUATERNION to rotation) + Internals.callMethod(rawPtr, MethodBindings.rotationTrackInsertKeyPtr, LONG) + return (Internals.readReturnValue(LONG) as Long).toInt() + } + + /** + * Inserts a key in a given 3D scale track. Returns the key index. + */ + public final fun scaleTrackInsertKey( + trackIdx: Int, + time: Double, + scale: Vector3, + ): Int { + Internals.writeArguments(LONG to trackIdx.toLong(), DOUBLE to time, VECTOR3 to scale) + Internals.callMethod(rawPtr, MethodBindings.scaleTrackInsertKeyPtr, LONG) + return (Internals.readReturnValue(LONG) as Long).toInt() + } + + /** + * Inserts a key in a given blend shape track. Returns the key index. + */ + public final fun blendShapeTrackInsertKey( + trackIdx: Int, + time: Double, + amount: Float, + ): Int { + Internals.writeArguments(LONG to trackIdx.toLong(), DOUBLE to time, DOUBLE to amount.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.blendShapeTrackInsertKeyPtr, LONG) + return (Internals.readReturnValue(LONG) as Long).toInt() + } + + /** + * Returns the interpolated position value at the given time (in seconds). The [trackIdx] must be + * the index of a 3D position track. + */ + @JvmOverloads + public final fun positionTrackInterpolate( + trackIdx: Int, + timeSec: Double, + backward: Boolean = false, + ): Vector3 { + Internals.writeArguments(LONG to trackIdx.toLong(), DOUBLE to timeSec, BOOL to backward) + Internals.callMethod(rawPtr, MethodBindings.positionTrackInterpolatePtr, VECTOR3) + return (Internals.readReturnValue(VECTOR3) as Vector3) + } + + /** + * Returns the interpolated rotation value at the given time (in seconds). The [trackIdx] must be + * the index of a 3D rotation track. + */ + @JvmOverloads + public final fun rotationTrackInterpolate( + trackIdx: Int, + timeSec: Double, + backward: Boolean = false, + ): Quaternion { + Internals.writeArguments(LONG to trackIdx.toLong(), DOUBLE to timeSec, BOOL to backward) + Internals.callMethod(rawPtr, MethodBindings.rotationTrackInterpolatePtr, QUATERNION) + return (Internals.readReturnValue(QUATERNION) as Quaternion) + } + + /** + * Returns the interpolated scale value at the given time (in seconds). The [trackIdx] must be the + * index of a 3D scale track. + */ + @JvmOverloads + public final fun scaleTrackInterpolate( + trackIdx: Int, + timeSec: Double, + backward: Boolean = false, + ): Vector3 { + Internals.writeArguments(LONG to trackIdx.toLong(), DOUBLE to timeSec, BOOL to backward) + Internals.callMethod(rawPtr, MethodBindings.scaleTrackInterpolatePtr, VECTOR3) + return (Internals.readReturnValue(VECTOR3) as Vector3) + } + + /** + * Returns the interpolated blend shape value at the given time (in seconds). The [trackIdx] must + * be the index of a blend shape track. + */ + @JvmOverloads + public final fun blendShapeTrackInterpolate( + trackIdx: Int, + timeSec: Double, + backward: Boolean = false, + ): Float { + Internals.writeArguments(LONG to trackIdx.toLong(), DOUBLE to timeSec, BOOL to backward) + Internals.callMethod(rawPtr, MethodBindings.blendShapeTrackInterpolatePtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + /** + * Inserts a generic key in a given track. Returns the key index. + */ + @JvmOverloads + public final fun trackInsertKey( + trackIdx: Int, + time: Double, + key: Any?, + transition: Float = 1.0f, + ): Int { + Internals.writeArguments(LONG to trackIdx.toLong(), DOUBLE to time, ANY to key, DOUBLE to transition.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.trackInsertKeyPtr, LONG) + return (Internals.readReturnValue(LONG) as Long).toInt() + } + + /** + * Removes a key by index in a given track. + */ + public final fun trackRemoveKey(trackIdx: Int, keyIdx: Int): Unit { + Internals.writeArguments(LONG to trackIdx.toLong(), LONG to keyIdx.toLong()) + Internals.callMethod(rawPtr, MethodBindings.trackRemoveKeyPtr, NIL) + } + + /** + * Removes a key at [time] in a given track. + */ + public final fun trackRemoveKeyAtTime(trackIdx: Int, time: Double): Unit { + Internals.writeArguments(LONG to trackIdx.toLong(), DOUBLE to time) + Internals.callMethod(rawPtr, MethodBindings.trackRemoveKeyAtTimePtr, NIL) + } + + /** + * Sets the value of an existing key. + */ + public final fun trackSetKeyValue( + trackIdx: Int, + key: Int, + `value`: Any?, + ): Unit { + Internals.writeArguments(LONG to trackIdx.toLong(), LONG to key.toLong(), ANY to value) + Internals.callMethod(rawPtr, MethodBindings.trackSetKeyValuePtr, NIL) + } + + /** + * Sets the transition curve (easing) for a specific key (see the built-in math function + * [@GlobalScope.ease]). + */ + public final fun trackSetKeyTransition( + trackIdx: Int, + keyIdx: Int, + transition: Float, + ): Unit { + Internals.writeArguments(LONG to trackIdx.toLong(), LONG to keyIdx.toLong(), DOUBLE to transition.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.trackSetKeyTransitionPtr, NIL) + } + + /** + * Sets the time of an existing key. + */ + public final fun trackSetKeyTime( + trackIdx: Int, + keyIdx: Int, + time: Double, + ): Unit { + Internals.writeArguments(LONG to trackIdx.toLong(), LONG to keyIdx.toLong(), DOUBLE to time) + Internals.callMethod(rawPtr, MethodBindings.trackSetKeyTimePtr, NIL) + } + + /** + * Returns the transition curve (easing) for a specific key (see the built-in math function + * [@GlobalScope.ease]). + */ + public final fun trackGetKeyTransition(trackIdx: Int, keyIdx: Int): Float { + Internals.writeArguments(LONG to trackIdx.toLong(), LONG to keyIdx.toLong()) + Internals.callMethod(rawPtr, MethodBindings.trackGetKeyTransitionPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + /** + * Returns the number of keys in a given track. + */ + public final fun trackGetKeyCount(trackIdx: Int): Int { + Internals.writeArguments(LONG to trackIdx.toLong()) + Internals.callMethod(rawPtr, MethodBindings.trackGetKeyCountPtr, LONG) + return (Internals.readReturnValue(LONG) as Long).toInt() + } + + /** + * Returns the value of a given key in a given track. + */ + public final fun trackGetKeyValue(trackIdx: Int, keyIdx: Int): Any? { + Internals.writeArguments(LONG to trackIdx.toLong(), LONG to keyIdx.toLong()) + Internals.callMethod(rawPtr, MethodBindings.trackGetKeyValuePtr, ANY) + return (Internals.readReturnValue(ANY) as Any?) + } + + /** + * Returns the time at which the key is located. + */ + public final fun trackGetKeyTime(trackIdx: Int, keyIdx: Int): Double { + Internals.writeArguments(LONG to trackIdx.toLong(), LONG to keyIdx.toLong()) + Internals.callMethod(rawPtr, MethodBindings.trackGetKeyTimePtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double) + } + + /** + * Finds the key index by time in a given track. Optionally, only find it if the approx/exact time + * is given. + * If [limit] is `true`, it does not return keys outside the animation range. + * If [backward] is `true`, the direction is reversed in methods that rely on one directional + * processing. + * For example, in case [findMode] is [FIND_MODE_NEAREST], if there is no key in the current + * position just after seeked, the first key found is retrieved by searching before the position, but + * if [backward] is `true`, the first key found is retrieved after the position. + */ + @JvmOverloads + public final fun trackFindKey( + trackIdx: Int, + time: Double, + findMode: FindMode = Animation.FindMode.FIND_MODE_NEAREST, + limit: Boolean = false, + backward: Boolean = false, + ): Int { + Internals.writeArguments(LONG to trackIdx.toLong(), DOUBLE to time, LONG to findMode.id, BOOL to limit, BOOL to backward) + Internals.callMethod(rawPtr, MethodBindings.trackFindKeyPtr, LONG) + return (Internals.readReturnValue(LONG) as Long).toInt() + } + + /** + * Sets the interpolation type of a given track. + */ + public final fun trackSetInterpolationType(trackIdx: Int, interpolation: InterpolationType): + Unit { + Internals.writeArguments(LONG to trackIdx.toLong(), LONG to interpolation.id) + Internals.callMethod(rawPtr, MethodBindings.trackSetInterpolationTypePtr, NIL) + } + + /** + * Returns the interpolation type of a given track. + */ + public final fun trackGetInterpolationType(trackIdx: Int): InterpolationType { + Internals.writeArguments(LONG to trackIdx.toLong()) + Internals.callMethod(rawPtr, MethodBindings.trackGetInterpolationTypePtr, LONG) + return Animation.InterpolationType.from(Internals.readReturnValue(LONG) as Long) + } + + /** + * If `true`, the track at [trackIdx] wraps the interpolation loop. + */ + public final fun trackSetInterpolationLoopWrap(trackIdx: Int, interpolation: Boolean): Unit { + Internals.writeArguments(LONG to trackIdx.toLong(), BOOL to interpolation) + Internals.callMethod(rawPtr, MethodBindings.trackSetInterpolationLoopWrapPtr, NIL) + } + + /** + * Returns `true` if the track at [trackIdx] wraps the interpolation loop. New tracks wrap the + * interpolation loop by default. + */ + public final fun trackGetInterpolationLoopWrap(trackIdx: Int): Boolean { + Internals.writeArguments(LONG to trackIdx.toLong()) + Internals.callMethod(rawPtr, MethodBindings.trackGetInterpolationLoopWrapPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + /** + * Returns `true` if the track is compressed, `false` otherwise. See also [compress]. + */ + public final fun trackIsCompressed(trackIdx: Int): Boolean { + Internals.writeArguments(LONG to trackIdx.toLong()) + Internals.callMethod(rawPtr, MethodBindings.trackIsCompressedPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + /** + * Sets the update mode (see [UpdateMode]) of a value track. + */ + public final fun valueTrackSetUpdateMode(trackIdx: Int, mode: UpdateMode): Unit { + Internals.writeArguments(LONG to trackIdx.toLong(), LONG to mode.id) + Internals.callMethod(rawPtr, MethodBindings.valueTrackSetUpdateModePtr, NIL) + } + + /** + * Returns the update mode of a value track. + */ + public final fun valueTrackGetUpdateMode(trackIdx: Int): UpdateMode { + Internals.writeArguments(LONG to trackIdx.toLong()) + Internals.callMethod(rawPtr, MethodBindings.valueTrackGetUpdateModePtr, LONG) + return Animation.UpdateMode.from(Internals.readReturnValue(LONG) as Long) + } + + /** + * Returns the interpolated value at the given time (in seconds). The [trackIdx] must be the index + * of a value track. + * A [backward] mainly affects the direction of key retrieval of the track with [UPDATE_DISCRETE] + * converted by [AnimationMixer.ANIMATION_CALLBACK_MODE_DISCRETE_FORCE_CONTINUOUS] to match the + * result with [trackFindKey]. + */ + @JvmOverloads + public final fun valueTrackInterpolate( + trackIdx: Int, + timeSec: Double, + backward: Boolean = false, + ): Any? { + Internals.writeArguments(LONG to trackIdx.toLong(), DOUBLE to timeSec, BOOL to backward) + Internals.callMethod(rawPtr, MethodBindings.valueTrackInterpolatePtr, ANY) + return (Internals.readReturnValue(ANY) as Any?) + } + + /** + * Returns the method name of a method track. + */ + public final fun methodTrackGetName(trackIdx: Int, keyIdx: Int): StringName { + Internals.writeArguments(LONG to trackIdx.toLong(), LONG to keyIdx.toLong()) + Internals.callMethod(rawPtr, MethodBindings.methodTrackGetNamePtr, STRING_NAME) + return (Internals.readReturnValue(STRING_NAME) as StringName) + } + + /** + * Returns the arguments values to be called on a method track for a given key in a given track. + */ + public final fun methodTrackGetParams(trackIdx: Int, keyIdx: Int): VariantArray { + Internals.writeArguments(LONG to trackIdx.toLong(), LONG to keyIdx.toLong()) + Internals.callMethod(rawPtr, MethodBindings.methodTrackGetParamsPtr, ARRAY) + return (Internals.readReturnValue(ARRAY) as VariantArray) + } + + /** + * Inserts a Bezier Track key at the given [time] in seconds. The [trackIdx] must be the index of + * a Bezier Track. + * [inHandle] is the left-side weight of the added Bezier curve point, [outHandle] is the + * right-side one, while [value] is the actual value at this point. + */ + @JvmOverloads + public final fun bezierTrackInsertKey( + trackIdx: Int, + time: Double, + `value`: Float, + inHandle: Vector2 = Vector2(0, 0), + outHandle: Vector2 = Vector2(0, 0), + ): Int { + Internals.writeArguments(LONG to trackIdx.toLong(), DOUBLE to time, DOUBLE to value.toDouble(), VECTOR2 to inHandle, VECTOR2 to outHandle) + Internals.callMethod(rawPtr, MethodBindings.bezierTrackInsertKeyPtr, LONG) + return (Internals.readReturnValue(LONG) as Long).toInt() + } + + /** + * Sets the value of the key identified by [keyIdx] to the given value. The [trackIdx] must be the + * index of a Bezier Track. + */ + public final fun bezierTrackSetKeyValue( + trackIdx: Int, + keyIdx: Int, + `value`: Float, + ): Unit { + Internals.writeArguments(LONG to trackIdx.toLong(), LONG to keyIdx.toLong(), DOUBLE to value.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.bezierTrackSetKeyValuePtr, NIL) + } + + /** + * Sets the in handle of the key identified by [keyIdx] to value [inHandle]. The [trackIdx] must + * be the index of a Bezier Track. + */ + @JvmOverloads + public final fun bezierTrackSetKeyInHandle( + trackIdx: Int, + keyIdx: Int, + inHandle: Vector2, + balancedValueTimeRatio: Float = 1.0f, + ): Unit { + Internals.writeArguments(LONG to trackIdx.toLong(), LONG to keyIdx.toLong(), VECTOR2 to inHandle, DOUBLE to balancedValueTimeRatio.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.bezierTrackSetKeyInHandlePtr, NIL) + } + + /** + * Sets the out handle of the key identified by [keyIdx] to value [outHandle]. The [trackIdx] must + * be the index of a Bezier Track. + */ + @JvmOverloads + public final fun bezierTrackSetKeyOutHandle( + trackIdx: Int, + keyIdx: Int, + outHandle: Vector2, + balancedValueTimeRatio: Float = 1.0f, + ): Unit { + Internals.writeArguments(LONG to trackIdx.toLong(), LONG to keyIdx.toLong(), VECTOR2 to outHandle, DOUBLE to balancedValueTimeRatio.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.bezierTrackSetKeyOutHandlePtr, NIL) + } + + /** + * Returns the value of the key identified by [keyIdx]. The [trackIdx] must be the index of a + * Bezier Track. + */ + public final fun bezierTrackGetKeyValue(trackIdx: Int, keyIdx: Int): Float { + Internals.writeArguments(LONG to trackIdx.toLong(), LONG to keyIdx.toLong()) + Internals.callMethod(rawPtr, MethodBindings.bezierTrackGetKeyValuePtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + /** + * Returns the in handle of the key identified by [keyIdx]. The [trackIdx] must be the index of a + * Bezier Track. + */ + public final fun bezierTrackGetKeyInHandle(trackIdx: Int, keyIdx: Int): Vector2 { + Internals.writeArguments(LONG to trackIdx.toLong(), LONG to keyIdx.toLong()) + Internals.callMethod(rawPtr, MethodBindings.bezierTrackGetKeyInHandlePtr, VECTOR2) + return (Internals.readReturnValue(VECTOR2) as Vector2) + } + + /** + * Returns the out handle of the key identified by [keyIdx]. The [trackIdx] must be the index of a + * Bezier Track. + */ + public final fun bezierTrackGetKeyOutHandle(trackIdx: Int, keyIdx: Int): Vector2 { + Internals.writeArguments(LONG to trackIdx.toLong(), LONG to keyIdx.toLong()) + Internals.callMethod(rawPtr, MethodBindings.bezierTrackGetKeyOutHandlePtr, VECTOR2) + return (Internals.readReturnValue(VECTOR2) as Vector2) + } + + /** + * Returns the interpolated value at the given [time] (in seconds). The [trackIdx] must be the + * index of a Bezier Track. + */ + public final fun bezierTrackInterpolate(trackIdx: Int, time: Double): Float { + Internals.writeArguments(LONG to trackIdx.toLong(), DOUBLE to time) + Internals.callMethod(rawPtr, MethodBindings.bezierTrackInterpolatePtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + /** + * Inserts an Audio Track key at the given [time] in seconds. The [trackIdx] must be the index of + * an Audio Track. + * [stream] is the [AudioStream] resource to play. [startOffset] is the number of seconds cut off + * at the beginning of the audio stream, while [endOffset] is at the ending. + */ + @JvmOverloads + public final fun audioTrackInsertKey( + trackIdx: Int, + time: Double, + stream: Resource?, + startOffset: Float = 0.0f, + endOffset: Float = 0.0f, + ): Int { + Internals.writeArguments(LONG to trackIdx.toLong(), DOUBLE to time, OBJECT to stream, DOUBLE to startOffset.toDouble(), DOUBLE to endOffset.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.audioTrackInsertKeyPtr, LONG) + return (Internals.readReturnValue(LONG) as Long).toInt() + } + + /** + * Sets the stream of the key identified by [keyIdx] to value [stream]. The [trackIdx] must be the + * index of an Audio Track. + */ + public final fun audioTrackSetKeyStream( + trackIdx: Int, + keyIdx: Int, + stream: Resource?, + ): Unit { + Internals.writeArguments(LONG to trackIdx.toLong(), LONG to keyIdx.toLong(), OBJECT to stream) + Internals.callMethod(rawPtr, MethodBindings.audioTrackSetKeyStreamPtr, NIL) + } + + /** + * Sets the start offset of the key identified by [keyIdx] to value [offset]. The [trackIdx] must + * be the index of an Audio Track. + */ + public final fun audioTrackSetKeyStartOffset( + trackIdx: Int, + keyIdx: Int, + offset: Float, + ): Unit { + Internals.writeArguments(LONG to trackIdx.toLong(), LONG to keyIdx.toLong(), DOUBLE to offset.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.audioTrackSetKeyStartOffsetPtr, NIL) + } + + /** + * Sets the end offset of the key identified by [keyIdx] to value [offset]. The [trackIdx] must be + * the index of an Audio Track. + */ + public final fun audioTrackSetKeyEndOffset( + trackIdx: Int, + keyIdx: Int, + offset: Float, + ): Unit { + Internals.writeArguments(LONG to trackIdx.toLong(), LONG to keyIdx.toLong(), DOUBLE to offset.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.audioTrackSetKeyEndOffsetPtr, NIL) + } + + /** + * Returns the audio stream of the key identified by [keyIdx]. The [trackIdx] must be the index of + * an Audio Track. + */ + public final fun audioTrackGetKeyStream(trackIdx: Int, keyIdx: Int): Resource? { + Internals.writeArguments(LONG to trackIdx.toLong(), LONG to keyIdx.toLong()) + Internals.callMethod(rawPtr, MethodBindings.audioTrackGetKeyStreamPtr, OBJECT) + return (Internals.readReturnValue(OBJECT) as Resource?) + } + + /** + * Returns the start offset of the key identified by [keyIdx]. The [trackIdx] must be the index of + * an Audio Track. + * Start offset is the number of seconds cut off at the beginning of the audio stream. + */ + public final fun audioTrackGetKeyStartOffset(trackIdx: Int, keyIdx: Int): Float { + Internals.writeArguments(LONG to trackIdx.toLong(), LONG to keyIdx.toLong()) + Internals.callMethod(rawPtr, MethodBindings.audioTrackGetKeyStartOffsetPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + /** + * Returns the end offset of the key identified by [keyIdx]. The [trackIdx] must be the index of + * an Audio Track. + * End offset is the number of seconds cut off at the ending of the audio stream. + */ + public final fun audioTrackGetKeyEndOffset(trackIdx: Int, keyIdx: Int): Float { + Internals.writeArguments(LONG to trackIdx.toLong(), LONG to keyIdx.toLong()) + Internals.callMethod(rawPtr, MethodBindings.audioTrackGetKeyEndOffsetPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + /** + * Sets whether the track will be blended with other animations. If `true`, the audio playback + * volume changes depending on the blend value. + */ + public final fun audioTrackSetUseBlend(trackIdx: Int, enable: Boolean): Unit { + Internals.writeArguments(LONG to trackIdx.toLong(), BOOL to enable) + Internals.callMethod(rawPtr, MethodBindings.audioTrackSetUseBlendPtr, NIL) + } + + /** + * Returns `true` if the track at [trackIdx] will be blended with other animations. + */ + public final fun audioTrackIsUseBlend(trackIdx: Int): Boolean { + Internals.writeArguments(LONG to trackIdx.toLong()) + Internals.callMethod(rawPtr, MethodBindings.audioTrackIsUseBlendPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + /** + * Inserts a key with value [animation] at the given [time] (in seconds). The [trackIdx] must be + * the index of an Animation Track. + */ + public final fun animationTrackInsertKey( + trackIdx: Int, + time: Double, + animation: StringName, + ): Int { + Internals.writeArguments(LONG to trackIdx.toLong(), DOUBLE to time, STRING_NAME to animation) + Internals.callMethod(rawPtr, MethodBindings.animationTrackInsertKeyPtr, LONG) + return (Internals.readReturnValue(LONG) as Long).toInt() + } + + /** + * Sets the key identified by [keyIdx] to value [animation]. The [trackIdx] must be the index of + * an Animation Track. + */ + public final fun animationTrackSetKeyAnimation( + trackIdx: Int, + keyIdx: Int, + animation: StringName, + ): Unit { + Internals.writeArguments(LONG to trackIdx.toLong(), LONG to keyIdx.toLong(), STRING_NAME to animation) + Internals.callMethod(rawPtr, MethodBindings.animationTrackSetKeyAnimationPtr, NIL) + } + + /** + * Returns the animation name at the key identified by [keyIdx]. The [trackIdx] must be the index + * of an Animation Track. + */ + public final fun animationTrackGetKeyAnimation(trackIdx: Int, keyIdx: Int): StringName { + Internals.writeArguments(LONG to trackIdx.toLong(), LONG to keyIdx.toLong()) + Internals.callMethod(rawPtr, MethodBindings.animationTrackGetKeyAnimationPtr, STRING_NAME) + return (Internals.readReturnValue(STRING_NAME) as StringName) + } + + public final fun setLength(timeSec: Float): Unit { + Internals.writeArguments(DOUBLE to timeSec.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setLengthPtr, NIL) + } + + public final fun getLength(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getLengthPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setLoopMode(loopMode: LoopMode): Unit { + Internals.writeArguments(LONG to loopMode.id) + Internals.callMethod(rawPtr, MethodBindings.setLoopModePtr, NIL) + } + + public final fun getLoopMode(): LoopMode { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getLoopModePtr, LONG) + return Animation.LoopMode.from(Internals.readReturnValue(LONG) as Long) + } + + public final fun setStep(sizeSec: Float): Unit { + Internals.writeArguments(DOUBLE to sizeSec.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setStepPtr, NIL) + } + + public final fun getStep(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getStepPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + /** + * Clear the animation (clear all tracks and reset all). + */ + public final fun clear(): Unit { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.clearPtr, NIL) + } + + /** + * Adds a new track to [toAnimation] that is a copy of the given track from this animation. + */ + public final fun copyTrack(trackIdx: Int, toAnimation: Animation?): Unit { + Internals.writeArguments(LONG to trackIdx.toLong(), OBJECT to toAnimation) + Internals.callMethod(rawPtr, MethodBindings.copyTrackPtr, NIL) + } + + /** + * Compress the animation and all its tracks in-place. This will make [trackIsCompressed] return + * `true` once called on this [Animation]. Compressed tracks require less memory to be played, and + * are designed to be used for complex 3D animations (such as cutscenes) imported from external 3D + * software. Compression is lossy, but the difference is usually not noticeable in real world + * conditions. + * **Note:** Compressed tracks have various limitations (such as not being editable from the + * editor), so only use compressed animations if you actually need them. + */ + @JvmOverloads + public final fun compress( + pageSize: Long = 8192, + fps: Long = 120, + splitTolerance: Float = 4.0f, + ): Unit { + Internals.writeArguments(LONG to pageSize, LONG to fps, DOUBLE to splitTolerance.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.compressPtr, NIL) + } + + public final fun isCaptureIncluded(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isCaptureIncludedPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public enum class TrackType( + id: Long, + ) { + /** + * Value tracks set values in node properties, but only those which can be interpolated. For 3D + * position/rotation/scale, using the dedicated [TYPE_POSITION_3D], [TYPE_ROTATION_3D] and + * [TYPE_SCALE_3D] track types instead of [TYPE_VALUE] is recommended for performance reasons. + */ + TYPE_VALUE(0), + /** + * 3D position track (values are stored in [Vector3]s). + */ + TYPE_POSITION_3D(1), + /** + * 3D rotation track (values are stored in [Quaternion]s). + */ + TYPE_ROTATION_3D(2), + /** + * 3D scale track (values are stored in [Vector3]s). + */ + TYPE_SCALE_3D(3), + /** + * Blend shape track. + */ + TYPE_BLEND_SHAPE(4), + /** + * Method tracks call functions with given arguments per key. + */ + TYPE_METHOD(5), + /** + * Bezier tracks are used to interpolate a value using custom curves. They can also be used to + * animate sub-properties of vectors and colors (e.g. alpha value of a [Color]). + */ + TYPE_BEZIER(6), + /** + * Audio tracks are used to play an audio stream with either type of [AudioStreamPlayer]. The + * stream can be trimmed and previewed in the animation. + */ + TYPE_AUDIO(7), + /** + * Animation tracks play animations in other [AnimationPlayer] nodes. + */ + TYPE_ANIMATION(8), + ; + + public val id: Long + init { + this.id = id + } + + public companion object { + public fun from(`value`: Long): TrackType = entries.single { it.id == `value` } + } + } + + public enum class InterpolationType( + id: Long, + ) { + /** + * No interpolation (nearest value). + */ + INTERPOLATION_NEAREST(0), + /** + * Linear interpolation. + */ + INTERPOLATION_LINEAR(1), + /** + * Cubic interpolation. This looks smoother than linear interpolation, but is more expensive to + * interpolate. Stick to [INTERPOLATION_LINEAR] for complex 3D animations imported from external + * software, even if it requires using a higher animation framerate in return. + */ + INTERPOLATION_CUBIC(2), + /** + * Linear interpolation with shortest path rotation. + * **Note:** The result value is always normalized and may not match the key value. + */ + INTERPOLATION_LINEAR_ANGLE(3), + /** + * Cubic interpolation with shortest path rotation. + * **Note:** The result value is always normalized and may not match the key value. + */ + INTERPOLATION_CUBIC_ANGLE(4), + ; + + public val id: Long + init { + this.id = id + } + + public companion object { + public fun from(`value`: Long): InterpolationType = entries.single { it.id == `value` } + } + } + + public enum class UpdateMode( + id: Long, + ) { + /** + * Update between keyframes and hold the value. + */ + UPDATE_CONTINUOUS(0), + /** + * Update at the keyframes. + */ + UPDATE_DISCRETE(1), + /** + * Same as [UPDATE_CONTINUOUS] but works as a flag to capture the value of the current object + * and perform interpolation in some methods. See also [AnimationMixer.capture], + * [AnimationPlayer.playbackAutoCapture], and [AnimationPlayer.playWithCapture]. + */ + UPDATE_CAPTURE(2), + ; + + public val id: Long + init { + this.id = id + } + + public companion object { + public fun from(`value`: Long): UpdateMode = entries.single { it.id == `value` } + } + } + + public enum class LoopMode( + id: Long, + ) { + /** + * At both ends of the animation, the animation will stop playing. + */ + LOOP_NONE(0), + /** + * At both ends of the animation, the animation will be repeated without changing the playback + * direction. + */ + LOOP_LINEAR(1), + /** + * Repeats playback and reverse playback at both ends of the animation. + */ + LOOP_PINGPONG(2), + ; + + public val id: Long + init { + this.id = id + } + + public companion object { + public fun from(`value`: Long): LoopMode = entries.single { it.id == `value` } + } + } + + public enum class LoopedFlag( + id: Long, + ) { + /** + * This flag indicates that the animation proceeds without any looping. + */ + LOOPED_FLAG_NONE(0), + /** + * This flag indicates that the animation has reached the end of the animation and just after + * loop processed. + */ + LOOPED_FLAG_END(1), + /** + * This flag indicates that the animation has reached the start of the animation and just after + * loop processed. + */ + LOOPED_FLAG_START(2), + ; + + public val id: Long + init { + this.id = id + } + + public companion object { + public fun from(`value`: Long): LoopedFlag = entries.single { it.id == `value` } + } + } + + public enum class FindMode( + id: Long, + ) { + /** + * Finds the nearest time key. + */ + FIND_MODE_NEAREST(0), + /** + * Finds only the key with approximating the time. + */ + FIND_MODE_APPROX(1), + /** + * Finds only the key with matching the time. + */ + FIND_MODE_EXACT(2), + ; + + public val id: Long + init { + this.id = id + } + + public companion object { + public fun from(`value`: Long): FindMode = entries.single { it.id == `value` } + } + } + + public companion object + + public object MethodBindings { + internal val addTrackPtr: VoidPtr = + Internals.getMethodBindPtr("Animation", "add_track", 3843682357) + + internal val removeTrackPtr: VoidPtr = + Internals.getMethodBindPtr("Animation", "remove_track", 1286410249) + + internal val getTrackCountPtr: VoidPtr = + Internals.getMethodBindPtr("Animation", "get_track_count", 3905245786) + + internal val trackGetTypePtr: VoidPtr = + Internals.getMethodBindPtr("Animation", "track_get_type", 3445944217) + + internal val trackGetPathPtr: VoidPtr = + Internals.getMethodBindPtr("Animation", "track_get_path", 408788394) + + internal val trackSetPathPtr: VoidPtr = + Internals.getMethodBindPtr("Animation", "track_set_path", 2761262315) + + internal val findTrackPtr: VoidPtr = + Internals.getMethodBindPtr("Animation", "find_track", 245376003) + + internal val trackMoveUpPtr: VoidPtr = + Internals.getMethodBindPtr("Animation", "track_move_up", 1286410249) + + internal val trackMoveDownPtr: VoidPtr = + Internals.getMethodBindPtr("Animation", "track_move_down", 1286410249) + + internal val trackMoveToPtr: VoidPtr = + Internals.getMethodBindPtr("Animation", "track_move_to", 3937882851) + + internal val trackSwapPtr: VoidPtr = + Internals.getMethodBindPtr("Animation", "track_swap", 3937882851) + + internal val trackSetImportedPtr: VoidPtr = + Internals.getMethodBindPtr("Animation", "track_set_imported", 300928843) + + internal val trackIsImportedPtr: VoidPtr = + Internals.getMethodBindPtr("Animation", "track_is_imported", 1116898809) + + internal val trackSetEnabledPtr: VoidPtr = + Internals.getMethodBindPtr("Animation", "track_set_enabled", 300928843) + + internal val trackIsEnabledPtr: VoidPtr = + Internals.getMethodBindPtr("Animation", "track_is_enabled", 1116898809) + + internal val positionTrackInsertKeyPtr: VoidPtr = + Internals.getMethodBindPtr("Animation", "position_track_insert_key", 2540608232) + + internal val rotationTrackInsertKeyPtr: VoidPtr = + Internals.getMethodBindPtr("Animation", "rotation_track_insert_key", 4165004800) + + internal val scaleTrackInsertKeyPtr: VoidPtr = + Internals.getMethodBindPtr("Animation", "scale_track_insert_key", 2540608232) + + internal val blendShapeTrackInsertKeyPtr: VoidPtr = + Internals.getMethodBindPtr("Animation", "blend_shape_track_insert_key", 1534913637) + + internal val positionTrackInterpolatePtr: VoidPtr = + Internals.getMethodBindPtr("Animation", "position_track_interpolate", 3530011197) + + internal val rotationTrackInterpolatePtr: VoidPtr = + Internals.getMethodBindPtr("Animation", "rotation_track_interpolate", 2915876792) + + internal val scaleTrackInterpolatePtr: VoidPtr = + Internals.getMethodBindPtr("Animation", "scale_track_interpolate", 3530011197) + + internal val blendShapeTrackInterpolatePtr: VoidPtr = + Internals.getMethodBindPtr("Animation", "blend_shape_track_interpolate", 2482365182) + + internal val trackInsertKeyPtr: VoidPtr = + Internals.getMethodBindPtr("Animation", "track_insert_key", 808952278) + + internal val trackRemoveKeyPtr: VoidPtr = + Internals.getMethodBindPtr("Animation", "track_remove_key", 3937882851) + + internal val trackRemoveKeyAtTimePtr: VoidPtr = + Internals.getMethodBindPtr("Animation", "track_remove_key_at_time", 1602489585) + + internal val trackSetKeyValuePtr: VoidPtr = + Internals.getMethodBindPtr("Animation", "track_set_key_value", 2060538656) + + internal val trackSetKeyTransitionPtr: VoidPtr = + Internals.getMethodBindPtr("Animation", "track_set_key_transition", 3506521499) + + internal val trackSetKeyTimePtr: VoidPtr = + Internals.getMethodBindPtr("Animation", "track_set_key_time", 3506521499) + + internal val trackGetKeyTransitionPtr: VoidPtr = + Internals.getMethodBindPtr("Animation", "track_get_key_transition", 3085491603) + + internal val trackGetKeyCountPtr: VoidPtr = + Internals.getMethodBindPtr("Animation", "track_get_key_count", 923996154) + + internal val trackGetKeyValuePtr: VoidPtr = + Internals.getMethodBindPtr("Animation", "track_get_key_value", 678354945) + + internal val trackGetKeyTimePtr: VoidPtr = + Internals.getMethodBindPtr("Animation", "track_get_key_time", 3085491603) + + internal val trackFindKeyPtr: VoidPtr = + Internals.getMethodBindPtr("Animation", "track_find_key", 4230953007) + + internal val trackSetInterpolationTypePtr: VoidPtr = + Internals.getMethodBindPtr("Animation", "track_set_interpolation_type", 4112932513) + + internal val trackGetInterpolationTypePtr: VoidPtr = + Internals.getMethodBindPtr("Animation", "track_get_interpolation_type", 1530756894) + + internal val trackSetInterpolationLoopWrapPtr: VoidPtr = + Internals.getMethodBindPtr("Animation", "track_set_interpolation_loop_wrap", 300928843) + + internal val trackGetInterpolationLoopWrapPtr: VoidPtr = + Internals.getMethodBindPtr("Animation", "track_get_interpolation_loop_wrap", 1116898809) + + internal val trackIsCompressedPtr: VoidPtr = + Internals.getMethodBindPtr("Animation", "track_is_compressed", 1116898809) + + internal val valueTrackSetUpdateModePtr: VoidPtr = + Internals.getMethodBindPtr("Animation", "value_track_set_update_mode", 2854058312) + + internal val valueTrackGetUpdateModePtr: VoidPtr = + Internals.getMethodBindPtr("Animation", "value_track_get_update_mode", 1440326473) + + internal val valueTrackInterpolatePtr: VoidPtr = + Internals.getMethodBindPtr("Animation", "value_track_interpolate", 747269075) + + internal val methodTrackGetNamePtr: VoidPtr = + Internals.getMethodBindPtr("Animation", "method_track_get_name", 351665558) + + internal val methodTrackGetParamsPtr: VoidPtr = + Internals.getMethodBindPtr("Animation", "method_track_get_params", 2345056839) + + internal val bezierTrackInsertKeyPtr: VoidPtr = + Internals.getMethodBindPtr("Animation", "bezier_track_insert_key", 3656773645) + + internal val bezierTrackSetKeyValuePtr: VoidPtr = + Internals.getMethodBindPtr("Animation", "bezier_track_set_key_value", 3506521499) + + internal val bezierTrackSetKeyInHandlePtr: VoidPtr = + Internals.getMethodBindPtr("Animation", "bezier_track_set_key_in_handle", 1719223284) + + internal val bezierTrackSetKeyOutHandlePtr: VoidPtr = + Internals.getMethodBindPtr("Animation", "bezier_track_set_key_out_handle", 1719223284) + + internal val bezierTrackGetKeyValuePtr: VoidPtr = + Internals.getMethodBindPtr("Animation", "bezier_track_get_key_value", 3085491603) + + internal val bezierTrackGetKeyInHandlePtr: VoidPtr = + Internals.getMethodBindPtr("Animation", "bezier_track_get_key_in_handle", 3016396712) + + internal val bezierTrackGetKeyOutHandlePtr: VoidPtr = + Internals.getMethodBindPtr("Animation", "bezier_track_get_key_out_handle", 3016396712) + + internal val bezierTrackInterpolatePtr: VoidPtr = + Internals.getMethodBindPtr("Animation", "bezier_track_interpolate", 1900462983) + + internal val audioTrackInsertKeyPtr: VoidPtr = + Internals.getMethodBindPtr("Animation", "audio_track_insert_key", 4021027286) + + internal val audioTrackSetKeyStreamPtr: VoidPtr = + Internals.getMethodBindPtr("Animation", "audio_track_set_key_stream", 3886397084) + + internal val audioTrackSetKeyStartOffsetPtr: VoidPtr = + Internals.getMethodBindPtr("Animation", "audio_track_set_key_start_offset", 3506521499) + + internal val audioTrackSetKeyEndOffsetPtr: VoidPtr = + Internals.getMethodBindPtr("Animation", "audio_track_set_key_end_offset", 3506521499) + + internal val audioTrackGetKeyStreamPtr: VoidPtr = + Internals.getMethodBindPtr("Animation", "audio_track_get_key_stream", 635277205) + + internal val audioTrackGetKeyStartOffsetPtr: VoidPtr = + Internals.getMethodBindPtr("Animation", "audio_track_get_key_start_offset", 3085491603) + + internal val audioTrackGetKeyEndOffsetPtr: VoidPtr = + Internals.getMethodBindPtr("Animation", "audio_track_get_key_end_offset", 3085491603) + + internal val audioTrackSetUseBlendPtr: VoidPtr = + Internals.getMethodBindPtr("Animation", "audio_track_set_use_blend", 300928843) + + internal val audioTrackIsUseBlendPtr: VoidPtr = + Internals.getMethodBindPtr("Animation", "audio_track_is_use_blend", 1116898809) + + internal val animationTrackInsertKeyPtr: VoidPtr = + Internals.getMethodBindPtr("Animation", "animation_track_insert_key", 158676774) + + internal val animationTrackSetKeyAnimationPtr: VoidPtr = + Internals.getMethodBindPtr("Animation", "animation_track_set_key_animation", 117615382) + + internal val animationTrackGetKeyAnimationPtr: VoidPtr = + Internals.getMethodBindPtr("Animation", "animation_track_get_key_animation", 351665558) + + internal val setLengthPtr: VoidPtr = + Internals.getMethodBindPtr("Animation", "set_length", 373806689) + + internal val getLengthPtr: VoidPtr = + Internals.getMethodBindPtr("Animation", "get_length", 1740695150) + + internal val setLoopModePtr: VoidPtr = + Internals.getMethodBindPtr("Animation", "set_loop_mode", 3155355575) + + internal val getLoopModePtr: VoidPtr = + Internals.getMethodBindPtr("Animation", "get_loop_mode", 1988889481) + + internal val setStepPtr: VoidPtr = + Internals.getMethodBindPtr("Animation", "set_step", 373806689) + + internal val getStepPtr: VoidPtr = + Internals.getMethodBindPtr("Animation", "get_step", 1740695150) + + internal val clearPtr: VoidPtr = Internals.getMethodBindPtr("Animation", "clear", 3218959716) + + internal val copyTrackPtr: VoidPtr = + Internals.getMethodBindPtr("Animation", "copy_track", 148001024) + + internal val compressPtr: VoidPtr = + Internals.getMethodBindPtr("Animation", "compress", 3608408117) + + internal val isCaptureIncludedPtr: VoidPtr = + Internals.getMethodBindPtr("Animation", "is_capture_included", 36873697) + } +} diff --git a/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AnimationLibrary.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AnimationLibrary.kt new file mode 100644 index 0000000000..bd716102c1 --- /dev/null +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AnimationLibrary.kt @@ -0,0 +1,136 @@ +// THIS FILE IS GENERATED! DO NOT EDIT IT MANUALLY! +@file:Suppress("PackageDirectoryMismatch", "unused", "FunctionName", "RedundantModalityModifier", + "UNCHECKED_CAST", "JoinDeclarationAndAssignment", "USELESS_CAST", + "RemoveRedundantQualifierName", "NOTHING_TO_INLINE", "NON_FINAL_MEMBER_IN_OBJECT", + "RedundantVisibilityModifier", "RedundantUnitReturnType", "MemberVisibilityCanBePrivate") + +package godot + +import godot.`annotation`.GodotBaseType +import godot.core.Signal1 +import godot.core.Signal2 +import godot.core.StringName +import godot.core.VariantArray +import godot.core.VariantParser.ARRAY +import godot.core.VariantParser.BOOL +import godot.core.VariantParser.LONG +import godot.core.VariantParser.NIL +import godot.core.VariantParser.OBJECT +import godot.core.VariantParser.STRING_NAME +import godot.util.Internals +import godot.util.VoidPtr +import kotlin.Boolean +import kotlin.Int +import kotlin.Long +import kotlin.Suppress +import kotlin.Unit + +private const val ENGINE_CLASS_ANIMATIONLIBRARY_INDEX: Int = 49 + +/** + * An animation library stores a set of animations accessible through [StringName] keys, for use + * with [AnimationPlayer] nodes. + */ +@GodotBaseType +public open class AnimationLibrary : Resource() { + /** + * Emitted when an [Animation] is added, under the key [name]. + */ + public val animationAdded: Signal1 by Signal1 + + /** + * Emitted when an [Animation] stored with the key [name] is removed. + */ + public val animationRemoved: Signal1 by Signal1 + + /** + * Emitted when the key for an [Animation] is changed, from [name] to [toName]. + */ + public val animationRenamed: Signal2 by Signal2 + + /** + * Emitted when there's a change in one of the animations, e.g. tracks are added, moved or have + * changed paths. [name] is the key of the animation that was changed. + * See also [signal Resource.changed], which this acts as a relay for. + */ + public val animationChanged: Signal1 by Signal1 + + public override fun new(scriptIndex: Int): Unit { + Internals.callConstructor(this, ENGINE_CLASS_ANIMATIONLIBRARY_INDEX, scriptIndex) + } + + /** + * Adds the [animation] to the library, accessible by the key [name]. + */ + public final fun addAnimation(name: StringName, animation: Animation?): Error { + Internals.writeArguments(STRING_NAME to name, OBJECT to animation) + Internals.callMethod(rawPtr, MethodBindings.addAnimationPtr, LONG) + return Error.from(Internals.readReturnValue(LONG) as Long) + } + + /** + * Removes the [Animation] with the key [name]. + */ + public final fun removeAnimation(name: StringName): Unit { + Internals.writeArguments(STRING_NAME to name) + Internals.callMethod(rawPtr, MethodBindings.removeAnimationPtr, NIL) + } + + /** + * Changes the key of the [Animation] associated with the key [name] to [newname]. + */ + public final fun renameAnimation(name: StringName, newname: StringName): Unit { + Internals.writeArguments(STRING_NAME to name, STRING_NAME to newname) + Internals.callMethod(rawPtr, MethodBindings.renameAnimationPtr, NIL) + } + + /** + * Returns `true` if the library stores an [Animation] with [name] as the key. + */ + public final fun hasAnimation(name: StringName): Boolean { + Internals.writeArguments(STRING_NAME to name) + Internals.callMethod(rawPtr, MethodBindings.hasAnimationPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + /** + * Returns the [Animation] with the key [name]. If the animation does not exist, `null` is + * returned and an error is logged. + */ + public final fun getAnimation(name: StringName): Animation? { + Internals.writeArguments(STRING_NAME to name) + Internals.callMethod(rawPtr, MethodBindings.getAnimationPtr, OBJECT) + return (Internals.readReturnValue(OBJECT) as Animation?) + } + + /** + * Returns the keys for the [Animation]s stored in the library. + */ + public final fun getAnimationList(): VariantArray { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getAnimationListPtr, ARRAY) + return (Internals.readReturnValue(ARRAY) as VariantArray) + } + + public companion object + + public object MethodBindings { + internal val addAnimationPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationLibrary", "add_animation", 1811855551) + + internal val removeAnimationPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationLibrary", "remove_animation", 3304788590) + + internal val renameAnimationPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationLibrary", "rename_animation", 3740211285) + + internal val hasAnimationPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationLibrary", "has_animation", 2619796661) + + internal val getAnimationPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationLibrary", "get_animation", 2933122410) + + internal val getAnimationListPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationLibrary", "get_animation_list", 3995934104) + } +} diff --git a/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AnimationMixer.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AnimationMixer.kt new file mode 100644 index 0000000000..bc1da15c53 --- /dev/null +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AnimationMixer.kt @@ -0,0 +1,883 @@ +// THIS FILE IS GENERATED! DO NOT EDIT IT MANUALLY! +@file:Suppress("PackageDirectoryMismatch", "unused", "FunctionName", "RedundantModalityModifier", + "UNCHECKED_CAST", "JoinDeclarationAndAssignment", "USELESS_CAST", + "RemoveRedundantQualifierName", "NOTHING_TO_INLINE", "NON_FINAL_MEMBER_IN_OBJECT", + "RedundantVisibilityModifier", "RedundantUnitReturnType", "MemberVisibilityCanBePrivate") + +package godot + +import godot.`annotation`.GodotBaseType +import godot.core.NodePath +import godot.core.PackedStringArray +import godot.core.Quaternion +import godot.core.Signal0 +import godot.core.Signal1 +import godot.core.StringName +import godot.core.VariantArray +import godot.core.VariantParser.ARRAY +import godot.core.VariantParser.BOOL +import godot.core.VariantParser.DOUBLE +import godot.core.VariantParser.LONG +import godot.core.VariantParser.NIL +import godot.core.VariantParser.NODE_PATH +import godot.core.VariantParser.OBJECT +import godot.core.VariantParser.PACKED_STRING_ARRAY +import godot.core.VariantParser.QUATERNION +import godot.core.VariantParser.STRING_NAME +import godot.core.VariantParser.VECTOR3 +import godot.core.Vector3 +import godot.util.Internals +import godot.util.VoidPtr +import kotlin.Any +import kotlin.Boolean +import kotlin.Double +import kotlin.Int +import kotlin.Long +import kotlin.NotImplementedError +import kotlin.Suppress +import kotlin.Unit +import kotlin.jvm.JvmName +import kotlin.jvm.JvmOverloads + +private const val ENGINE_CLASS_ANIMATIONMIXER_INDEX: Int = 50 + +/** + * Base class for [AnimationPlayer] and [AnimationTree] to manage animation lists. It also has + * general properties and methods for playback and blending. + * After instantiating the playback information data within the extended class, the blending is + * processed by the [AnimationMixer]. + */ +@GodotBaseType +public open class AnimationMixer internal constructor() : Node() { + /** + * Notifies when an animation list is changed. + */ + public val animationListChanged: Signal0 by Signal0 + + /** + * Notifies when the animation libraries have changed. + */ + public val animationLibrariesUpdated: Signal0 by Signal0 + + /** + * Notifies when an animation finished playing. + * **Note:** This signal is not emitted if an animation is looping. + */ + public val animationFinished: Signal1 by Signal1 + + /** + * Notifies when an animation starts playing. + */ + public val animationStarted: Signal1 by Signal1 + + /** + * Notifies when the caches have been cleared, either automatically, or manually via + * [clearCaches]. + */ + public val cachesCleared: Signal0 by Signal0 + + /** + * Notifies when the blending result related have been applied to the target objects. + */ + public val mixerApplied: Signal0 by Signal0 + + /** + * Notifies when the property related process have been updated. + */ + public val mixerUpdated: Signal0 by Signal0 + + /** + * If `true`, the [AnimationMixer] will be processing. + */ + public final inline var active: Boolean + @JvmName("activeProperty") + get() = isActive() + @JvmName("activeProperty") + set(`value`) { + setActive(value) + } + + /** + * If `true`, the blending uses the deterministic algorithm. The total weight is not normalized + * and the result is accumulated with an initial value (`0` or a `"RESET"` animation if present). + * This means that if the total amount of blending is `0.0`, the result is equal to the `"RESET"` + * animation. + * If the number of tracks between the blended animations is different, the animation with the + * missing track is treated as if it had the initial value. + * If `false`, The blend does not use the deterministic algorithm. The total weight is normalized + * and always `1.0`. If the number of tracks between the blended animations is different, nothing is + * done about the animation that is missing a track. + * **Note:** In [AnimationTree], the blending with [AnimationNodeAdd2], [AnimationNodeAdd3], + * [AnimationNodeSub2] or the weight greater than `1.0` may produce unexpected results. + * For example, if [AnimationNodeAdd2] blends two nodes with the amount `1.0`, then total weight + * is `2.0` but it will be normalized to make the total amount `1.0` and the result will be equal to + * [AnimationNodeBlend2] with the amount `0.5`. + */ + public final inline var deterministic: Boolean + @JvmName("deterministicProperty") + get() = isDeterministic() + @JvmName("deterministicProperty") + set(`value`) { + setDeterministic(value) + } + + /** + * This is used by the editor. If set to `true`, the scene will be saved with the effects of the + * reset animation (the animation with the key `"RESET"`) applied as if it had been seeked to time 0, + * with the editor keeping the values that the scene had before saving. + * This makes it more convenient to preview and edit animations in the editor, as changes to the + * scene will not be saved as long as they are set in the reset animation. + */ + public final inline var resetOnSave: Boolean + @JvmName("resetOnSaveProperty") + get() = isResetOnSaveEnabled() + @JvmName("resetOnSaveProperty") + set(`value`) { + setResetOnSaveEnabled(value) + } + + /** + * The node which node path references will travel from. + */ + public final inline var rootNode: NodePath + @JvmName("rootNodeProperty") + get() = getRootNode() + @JvmName("rootNodeProperty") + set(`value`) { + setRootNode(value) + } + + /** + * The path to the Animation track used for root motion. Paths must be valid scene-tree paths to a + * node, and must be specified starting from the parent node of the node that will reproduce the + * animation. The [rootMotionTrack] uses the same format as [Animation.trackSetPath], but note that a + * bone must be specified. + * If the track has type [Animation.TYPE_POSITION_3D], [Animation.TYPE_ROTATION_3D], or + * [Animation.TYPE_SCALE_3D] the transformation will be canceled visually, and the animation will + * appear to stay in place. See also [getRootMotionPosition], [getRootMotionRotation], + * [getRootMotionScale], and [RootMotionView]. + */ + public final inline var rootMotionTrack: NodePath + @JvmName("rootMotionTrackProperty") + get() = getRootMotionTrack() + @JvmName("rootMotionTrackProperty") + set(`value`) { + setRootMotionTrack(value) + } + + /** + * The number of possible simultaneous sounds for each of the assigned AudioStreamPlayers. + * For example, if this value is `32` and the animation has two audio tracks, the two + * [AudioStreamPlayer]s assigned can play simultaneously up to `32` voices each. + */ + public final inline var audioMaxPolyphony: Int + @JvmName("audioMaxPolyphonyProperty") + get() = getAudioMaxPolyphony() + @JvmName("audioMaxPolyphonyProperty") + set(`value`) { + setAudioMaxPolyphony(value) + } + + /** + * The process notification in which to update animations. + */ + public final inline var callbackModeProcess: AnimationCallbackModeProcess + @JvmName("callbackModeProcessProperty") + get() = getCallbackModeProcess() + @JvmName("callbackModeProcessProperty") + set(`value`) { + setCallbackModeProcess(value) + } + + /** + * The call mode used for "Call Method" tracks. + */ + public final inline var callbackModeMethod: AnimationCallbackModeMethod + @JvmName("callbackModeMethodProperty") + get() = getCallbackModeMethod() + @JvmName("callbackModeMethodProperty") + set(`value`) { + setCallbackModeMethod(value) + } + + /** + * Ordinarily, tracks can be set to [Animation.UPDATE_DISCRETE] to update infrequently, usually + * when using nearest interpolation. + * However, when blending with [Animation.UPDATE_CONTINUOUS] several results are considered. The + * [callbackModeDiscrete] specify it explicitly. See also [AnimationCallbackModeDiscrete]. + * To make the blended results look good, it is recommended to set this to + * [ANIMATION_CALLBACK_MODE_DISCRETE_FORCE_CONTINUOUS] to update every frame during blending. Other + * values exist for compatibility and they are fine if there is no blending, but not so, may produce + * artifacts. + */ + public final inline var callbackModeDiscrete: AnimationCallbackModeDiscrete + @JvmName("callbackModeDiscreteProperty") + get() = getCallbackModeDiscrete() + @JvmName("callbackModeDiscreteProperty") + set(`value`) { + setCallbackModeDiscrete(value) + } + + public override fun new(scriptIndex: Int): Unit { + Internals.callConstructor(this, ENGINE_CLASS_ANIMATIONMIXER_INDEX, scriptIndex) + } + + /** + * A virtual function for processing after getting a key during playback. + */ + public open fun _postProcessKeyValue( + animation: Animation?, + track: Int, + `value`: Any?, + objectId: Long, + objectSubIdx: Int, + ): Any? { + throw NotImplementedError("_post_process_key_value is not implemented for AnimationMixer") + } + + /** + * Adds [library] to the animation player, under the key [name]. + * AnimationMixer has a global library by default with an empty string as key. For adding an + * animation to the global library: + * + * gdscript: + * ```gdscript + * var global_library = mixer.get_animation_library("") + * global_library.add_animation("animation_name", animation_resource) + * ``` + */ + public final fun addAnimationLibrary(name: StringName, library: AnimationLibrary?): Error { + Internals.writeArguments(STRING_NAME to name, OBJECT to library) + Internals.callMethod(rawPtr, MethodBindings.addAnimationLibraryPtr, LONG) + return Error.from(Internals.readReturnValue(LONG) as Long) + } + + /** + * Removes the [AnimationLibrary] associated with the key [name]. + */ + public final fun removeAnimationLibrary(name: StringName): Unit { + Internals.writeArguments(STRING_NAME to name) + Internals.callMethod(rawPtr, MethodBindings.removeAnimationLibraryPtr, NIL) + } + + /** + * Moves the [AnimationLibrary] associated with the key [name] to the key [newname]. + */ + public final fun renameAnimationLibrary(name: StringName, newname: StringName): Unit { + Internals.writeArguments(STRING_NAME to name, STRING_NAME to newname) + Internals.callMethod(rawPtr, MethodBindings.renameAnimationLibraryPtr, NIL) + } + + /** + * Returns `true` if the [AnimationMixer] stores an [AnimationLibrary] with key [name]. + */ + public final fun hasAnimationLibrary(name: StringName): Boolean { + Internals.writeArguments(STRING_NAME to name) + Internals.callMethod(rawPtr, MethodBindings.hasAnimationLibraryPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + /** + * Returns the first [AnimationLibrary] with key [name] or `null` if not found. + * To get the [AnimationMixer]'s global animation library, use `get_animation_library("")`. + */ + public final fun getAnimationLibrary(name: StringName): AnimationLibrary? { + Internals.writeArguments(STRING_NAME to name) + Internals.callMethod(rawPtr, MethodBindings.getAnimationLibraryPtr, OBJECT) + return (Internals.readReturnValue(OBJECT) as AnimationLibrary?) + } + + /** + * Returns the list of stored library keys. + */ + public final fun getAnimationLibraryList(): VariantArray { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getAnimationLibraryListPtr, ARRAY) + return (Internals.readReturnValue(ARRAY) as VariantArray) + } + + /** + * Returns `true` if the [AnimationMixer] stores an [Animation] with key [name]. + */ + public final fun hasAnimation(name: StringName): Boolean { + Internals.writeArguments(STRING_NAME to name) + Internals.callMethod(rawPtr, MethodBindings.hasAnimationPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + /** + * Returns the [Animation] with the key [name]. If the animation does not exist, `null` is + * returned and an error is logged. + */ + public final fun getAnimation(name: StringName): Animation? { + Internals.writeArguments(STRING_NAME to name) + Internals.callMethod(rawPtr, MethodBindings.getAnimationPtr, OBJECT) + return (Internals.readReturnValue(OBJECT) as Animation?) + } + + /** + * Returns the list of stored animation keys. + */ + public final fun getAnimationList(): PackedStringArray { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getAnimationListPtr, PACKED_STRING_ARRAY) + return (Internals.readReturnValue(PACKED_STRING_ARRAY) as PackedStringArray) + } + + public final fun setActive(active: Boolean): Unit { + Internals.writeArguments(BOOL to active) + Internals.callMethod(rawPtr, MethodBindings.setActivePtr, NIL) + } + + public final fun isActive(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isActivePtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public final fun setDeterministic(deterministic: Boolean): Unit { + Internals.writeArguments(BOOL to deterministic) + Internals.callMethod(rawPtr, MethodBindings.setDeterministicPtr, NIL) + } + + public final fun isDeterministic(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isDeterministicPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public final fun setRootNode(path: NodePath): Unit { + Internals.writeArguments(NODE_PATH to path) + Internals.callMethod(rawPtr, MethodBindings.setRootNodePtr, NIL) + } + + public final fun getRootNode(): NodePath { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getRootNodePtr, NODE_PATH) + return (Internals.readReturnValue(NODE_PATH) as NodePath) + } + + public final fun setCallbackModeProcess(mode: AnimationCallbackModeProcess): Unit { + Internals.writeArguments(LONG to mode.id) + Internals.callMethod(rawPtr, MethodBindings.setCallbackModeProcessPtr, NIL) + } + + public final fun getCallbackModeProcess(): AnimationCallbackModeProcess { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getCallbackModeProcessPtr, LONG) + return AnimationMixer.AnimationCallbackModeProcess.from(Internals.readReturnValue(LONG) as Long) + } + + public final fun setCallbackModeMethod(mode: AnimationCallbackModeMethod): Unit { + Internals.writeArguments(LONG to mode.id) + Internals.callMethod(rawPtr, MethodBindings.setCallbackModeMethodPtr, NIL) + } + + public final fun getCallbackModeMethod(): AnimationCallbackModeMethod { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getCallbackModeMethodPtr, LONG) + return AnimationMixer.AnimationCallbackModeMethod.from(Internals.readReturnValue(LONG) as Long) + } + + public final fun setCallbackModeDiscrete(mode: AnimationCallbackModeDiscrete): Unit { + Internals.writeArguments(LONG to mode.id) + Internals.callMethod(rawPtr, MethodBindings.setCallbackModeDiscretePtr, NIL) + } + + public final fun getCallbackModeDiscrete(): AnimationCallbackModeDiscrete { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getCallbackModeDiscretePtr, LONG) + return AnimationMixer.AnimationCallbackModeDiscrete.from(Internals.readReturnValue(LONG) as Long) + } + + public final fun setAudioMaxPolyphony(maxPolyphony: Int): Unit { + Internals.writeArguments(LONG to maxPolyphony.toLong()) + Internals.callMethod(rawPtr, MethodBindings.setAudioMaxPolyphonyPtr, NIL) + } + + public final fun getAudioMaxPolyphony(): Int { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getAudioMaxPolyphonyPtr, LONG) + return (Internals.readReturnValue(LONG) as Long).toInt() + } + + public final fun setRootMotionTrack(path: NodePath): Unit { + Internals.writeArguments(NODE_PATH to path) + Internals.callMethod(rawPtr, MethodBindings.setRootMotionTrackPtr, NIL) + } + + public final fun getRootMotionTrack(): NodePath { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getRootMotionTrackPtr, NODE_PATH) + return (Internals.readReturnValue(NODE_PATH) as NodePath) + } + + /** + * Retrieve the motion delta of position with the [rootMotionTrack] as a [Vector3] that can be + * used elsewhere. + * If [rootMotionTrack] is not a path to a track of type [Animation.TYPE_POSITION_3D], returns + * `Vector3(0, 0, 0)`. + * See also [rootMotionTrack] and [RootMotionView]. + * The most basic example is applying position to [CharacterBody3D]: + * + * gdscript: + * ```gdscript + * var current_rotation: Quaternion + * + * func _process(delta): + * if Input.is_action_just_pressed("animate"): + * current_rotation = get_quaternion() + * state_machine.travel("Animate") + * var velocity: Vector3 = current_rotation * animation_tree.get_root_motion_position() / + * delta + * set_velocity(velocity) + * move_and_slide() + * ``` + * + * By using this in combination with [getRootMotionRotationAccumulator], you can apply the root + * motion position more correctly to account for the rotation of the node. + * + * gdscript: + * ```gdscript + * func _process(delta): + * if Input.is_action_just_pressed("animate"): + * state_machine.travel("Animate") + * set_quaternion(get_quaternion() * animation_tree.get_root_motion_rotation()) + * var velocity: Vector3 = (animation_tree.get_root_motion_rotation_accumulator().inverse() * + * get_quaternion()) * animation_tree.get_root_motion_position() / delta + * set_velocity(velocity) + * move_and_slide() + * ``` + */ + public final fun getRootMotionPosition(): Vector3 { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getRootMotionPositionPtr, VECTOR3) + return (Internals.readReturnValue(VECTOR3) as Vector3) + } + + /** + * Retrieve the motion delta of rotation with the [rootMotionTrack] as a [Quaternion] that can be + * used elsewhere. + * If [rootMotionTrack] is not a path to a track of type [Animation.TYPE_ROTATION_3D], returns + * `Quaternion(0, 0, 0, 1)`. + * See also [rootMotionTrack] and [RootMotionView]. + * The most basic example is applying rotation to [CharacterBody3D]: + * + * gdscript: + * ```gdscript + * func _process(delta): + * if Input.is_action_just_pressed("animate"): + * state_machine.travel("Animate") + * set_quaternion(get_quaternion() * animation_tree.get_root_motion_rotation()) + * ``` + */ + public final fun getRootMotionRotation(): Quaternion { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getRootMotionRotationPtr, QUATERNION) + return (Internals.readReturnValue(QUATERNION) as Quaternion) + } + + /** + * Retrieve the motion delta of scale with the [rootMotionTrack] as a [Vector3] that can be used + * elsewhere. + * If [rootMotionTrack] is not a path to a track of type [Animation.TYPE_SCALE_3D], returns + * `Vector3(0, 0, 0)`. + * See also [rootMotionTrack] and [RootMotionView]. + * The most basic example is applying scale to [CharacterBody3D]: + * + * gdscript: + * ```gdscript + * var current_scale: Vector3 = Vector3(1, 1, 1) + * var scale_accum: Vector3 = Vector3(1, 1, 1) + * + * func _process(delta): + * if Input.is_action_just_pressed("animate"): + * current_scale = get_scale() + * scale_accum = Vector3(1, 1, 1) + * state_machine.travel("Animate") + * scale_accum += animation_tree.get_root_motion_scale() + * set_scale(current_scale * scale_accum) + * ``` + */ + public final fun getRootMotionScale(): Vector3 { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getRootMotionScalePtr, VECTOR3) + return (Internals.readReturnValue(VECTOR3) as Vector3) + } + + /** + * Retrieve the blended value of the position tracks with the [rootMotionTrack] as a [Vector3] + * that can be used elsewhere. + * This is useful in cases where you want to respect the initial key values of the animation. + * For example, if an animation with only one key `Vector3(0, 0, 0)` is played in the previous + * frame and then an animation with only one key `Vector3(1, 0, 1)` is played in the next frame, the + * difference can be calculated as follows: + * + * gdscript: + * ```gdscript + * var prev_root_motion_position_accumulator: Vector3 + * + * func _process(delta): + * if Input.is_action_just_pressed("animate"): + * state_machine.travel("Animate") + * var current_root_motion_position_accumulator: Vector3 = + * animation_tree.get_root_motion_position_accumulator() + * var difference: Vector3 = current_root_motion_position_accumulator - + * prev_root_motion_position_accumulator + * prev_root_motion_position_accumulator = current_root_motion_position_accumulator + * transform.origin += difference + * ``` + * + * However, if the animation loops, an unintended discrete change may occur, so this is only + * useful for some simple use cases. + */ + public final fun getRootMotionPositionAccumulator(): Vector3 { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getRootMotionPositionAccumulatorPtr, VECTOR3) + return (Internals.readReturnValue(VECTOR3) as Vector3) + } + + /** + * Retrieve the blended value of the rotation tracks with the [rootMotionTrack] as a [Quaternion] + * that can be used elsewhere. + * This is necessary to apply the root motion position correctly, taking rotation into account. + * See also [getRootMotionPosition]. + * Also, this is useful in cases where you want to respect the initial key values of the + * animation. + * For example, if an animation with only one key `Quaternion(0, 0, 0, 1)` is played in the + * previous frame and then an animation with only one key `Quaternion(0, 0.707, 0, 0.707)` is played + * in the next frame, the difference can be calculated as follows: + * + * gdscript: + * ```gdscript + * var prev_root_motion_rotation_accumulator: Quaternion + * + * func _process(delta): + * if Input.is_action_just_pressed("animate"): + * state_machine.travel("Animate") + * var current_root_motion_rotation_accumulator: Quaternion = + * animation_tree.get_root_motion_rotation_accumulator() + * var difference: Quaternion = prev_root_motion_rotation_accumulator.inverse() * + * current_root_motion_rotation_accumulator + * prev_root_motion_rotation_accumulator = current_root_motion_rotation_accumulator + * transform.basis *= Basis(difference) + * ``` + * + * However, if the animation loops, an unintended discrete change may occur, so this is only + * useful for some simple use cases. + */ + public final fun getRootMotionRotationAccumulator(): Quaternion { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getRootMotionRotationAccumulatorPtr, QUATERNION) + return (Internals.readReturnValue(QUATERNION) as Quaternion) + } + + /** + * Retrieve the blended value of the scale tracks with the [rootMotionTrack] as a [Vector3] that + * can be used elsewhere. + * For example, if an animation with only one key `Vector3(1, 1, 1)` is played in the previous + * frame and then an animation with only one key `Vector3(2, 2, 2)` is played in the next frame, the + * difference can be calculated as follows: + * + * gdscript: + * ```gdscript + * var prev_root_motion_scale_accumulator: Vector3 + * + * func _process(delta): + * if Input.is_action_just_pressed("animate"): + * state_machine.travel("Animate") + * var current_root_motion_scale_accumulator: Vector3 = + * animation_tree.get_root_motion_scale_accumulator() + * var difference: Vector3 = current_root_motion_scale_accumulator - + * prev_root_motion_scale_accumulator + * prev_root_motion_scale_accumulator = current_root_motion_scale_accumulator + * transform.basis = transform.basis.scaled(difference) + * ``` + * + * However, if the animation loops, an unintended discrete change may occur, so this is only + * useful for some simple use cases. + */ + public final fun getRootMotionScaleAccumulator(): Vector3 { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getRootMotionScaleAccumulatorPtr, VECTOR3) + return (Internals.readReturnValue(VECTOR3) as Vector3) + } + + /** + * [AnimationMixer] caches animated nodes. It may not notice if a node disappears; [clearCaches] + * forces it to update the cache again. + */ + public final fun clearCaches(): Unit { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.clearCachesPtr, NIL) + } + + /** + * Manually advance the animations by the specified time (in seconds). + */ + public final fun advance(delta: Double): Unit { + Internals.writeArguments(DOUBLE to delta) + Internals.callMethod(rawPtr, MethodBindings.advancePtr, NIL) + } + + /** + * If the animation track specified by [name] has an option [Animation.UPDATE_CAPTURE], stores + * current values of the objects indicated by the track path as a cache. If there is already a + * captured cache, the old cache is discarded. + * After this it will interpolate with current animation blending result during the playback + * process for the time specified by [duration], working like a crossfade. + * You can specify [transType] as the curve for the interpolation. For better results, it may be + * appropriate to specify [Tween.TRANS_LINEAR] for cases where the first key of the track begins with + * a non-zero value or where the key value does not change, and [Tween.TRANS_QUAD] for cases where + * the key value changes linearly. + */ + @JvmOverloads + public final fun capture( + name: StringName, + duration: Double, + transType: Tween.TransitionType = Tween.TransitionType.TRANS_LINEAR, + easeType: Tween.EaseType = Tween.EaseType.EASE_IN, + ): Unit { + Internals.writeArguments(STRING_NAME to name, DOUBLE to duration, LONG to transType.id, LONG to easeType.id) + Internals.callMethod(rawPtr, MethodBindings.capturePtr, NIL) + } + + public final fun setResetOnSaveEnabled(enabled: Boolean): Unit { + Internals.writeArguments(BOOL to enabled) + Internals.callMethod(rawPtr, MethodBindings.setResetOnSaveEnabledPtr, NIL) + } + + public final fun isResetOnSaveEnabled(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isResetOnSaveEnabledPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + /** + * Returns the key of [animation] or an empty [StringName] if not found. + */ + public final fun findAnimation(animation: Animation?): StringName { + Internals.writeArguments(OBJECT to animation) + Internals.callMethod(rawPtr, MethodBindings.findAnimationPtr, STRING_NAME) + return (Internals.readReturnValue(STRING_NAME) as StringName) + } + + /** + * Returns the key for the [AnimationLibrary] that contains [animation] or an empty [StringName] + * if not found. + */ + public final fun findAnimationLibrary(animation: Animation?): StringName { + Internals.writeArguments(OBJECT to animation) + Internals.callMethod(rawPtr, MethodBindings.findAnimationLibraryPtr, STRING_NAME) + return (Internals.readReturnValue(STRING_NAME) as StringName) + } + + public enum class AnimationCallbackModeProcess( + id: Long, + ) { + /** + * Process animation during physics frames (see [Node.NOTIFICATION_INTERNAL_PHYSICS_PROCESS]). + * This is especially useful when animating physics bodies. + */ + ANIMATION_CALLBACK_MODE_PROCESS_PHYSICS(0), + /** + * Process animation during process frames (see [Node.NOTIFICATION_INTERNAL_PROCESS]). + */ + ANIMATION_CALLBACK_MODE_PROCESS_IDLE(1), + /** + * Do not process animation. Use [advance] to process the animation manually. + */ + ANIMATION_CALLBACK_MODE_PROCESS_MANUAL(2), + ; + + public val id: Long + init { + this.id = id + } + + public companion object { + public fun from(`value`: Long): AnimationCallbackModeProcess = + entries.single { it.id == `value` } + } + } + + public enum class AnimationCallbackModeMethod( + id: Long, + ) { + /** + * Batch method calls during the animation process, then do the calls after events are + * processed. This avoids bugs involving deleting nodes or modifying the AnimationPlayer while + * playing. + */ + ANIMATION_CALLBACK_MODE_METHOD_DEFERRED(0), + /** + * Make method calls immediately when reached in the animation. + */ + ANIMATION_CALLBACK_MODE_METHOD_IMMEDIATE(1), + ; + + public val id: Long + init { + this.id = id + } + + public companion object { + public fun from(`value`: Long): AnimationCallbackModeMethod = + entries.single { it.id == `value` } + } + } + + public enum class AnimationCallbackModeDiscrete( + id: Long, + ) { + /** + * An [Animation.UPDATE_DISCRETE] track value takes precedence when blending + * [Animation.UPDATE_CONTINUOUS] or [Animation.UPDATE_CAPTURE] track values and + * [Animation.UPDATE_DISCRETE] track values. + */ + ANIMATION_CALLBACK_MODE_DISCRETE_DOMINANT(0), + /** + * An [Animation.UPDATE_CONTINUOUS] or [Animation.UPDATE_CAPTURE] track value takes precedence + * when blending the [Animation.UPDATE_CONTINUOUS] or [Animation.UPDATE_CAPTURE] track values and + * the [Animation.UPDATE_DISCRETE] track values. This is the default behavior for + * [AnimationPlayer]. + */ + ANIMATION_CALLBACK_MODE_DISCRETE_RECESSIVE(1), + /** + * Always treat the [Animation.UPDATE_DISCRETE] track value as [Animation.UPDATE_CONTINUOUS] + * with [Animation.INTERPOLATION_NEAREST]. This is the default behavior for [AnimationTree]. + * If a value track has non-numeric type key values, it is internally converted to use + * [ANIMATION_CALLBACK_MODE_DISCRETE_RECESSIVE] with [Animation.UPDATE_DISCRETE]. + */ + ANIMATION_CALLBACK_MODE_DISCRETE_FORCE_CONTINUOUS(2), + ; + + public val id: Long + init { + this.id = id + } + + public companion object { + public fun from(`value`: Long): AnimationCallbackModeDiscrete = + entries.single { it.id == `value` } + } + } + + public companion object + + public object MethodBindings { + internal val addAnimationLibraryPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationMixer", "add_animation_library", 618909818) + + internal val removeAnimationLibraryPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationMixer", "remove_animation_library", 3304788590) + + internal val renameAnimationLibraryPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationMixer", "rename_animation_library", 3740211285) + + internal val hasAnimationLibraryPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationMixer", "has_animation_library", 2619796661) + + internal val getAnimationLibraryPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationMixer", "get_animation_library", 147342321) + + internal val getAnimationLibraryListPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationMixer", "get_animation_library_list", 3995934104) + + internal val hasAnimationPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationMixer", "has_animation", 2619796661) + + internal val getAnimationPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationMixer", "get_animation", 2933122410) + + internal val getAnimationListPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationMixer", "get_animation_list", 1139954409) + + internal val setActivePtr: VoidPtr = + Internals.getMethodBindPtr("AnimationMixer", "set_active", 2586408642) + + internal val isActivePtr: VoidPtr = + Internals.getMethodBindPtr("AnimationMixer", "is_active", 36873697) + + internal val setDeterministicPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationMixer", "set_deterministic", 2586408642) + + internal val isDeterministicPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationMixer", "is_deterministic", 36873697) + + internal val setRootNodePtr: VoidPtr = + Internals.getMethodBindPtr("AnimationMixer", "set_root_node", 1348162250) + + internal val getRootNodePtr: VoidPtr = + Internals.getMethodBindPtr("AnimationMixer", "get_root_node", 4075236667) + + internal val setCallbackModeProcessPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationMixer", "set_callback_mode_process", 2153733086) + + internal val getCallbackModeProcessPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationMixer", "get_callback_mode_process", 1394468472) + + internal val setCallbackModeMethodPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationMixer", "set_callback_mode_method", 742218271) + + internal val getCallbackModeMethodPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationMixer", "get_callback_mode_method", 489449656) + + internal val setCallbackModeDiscretePtr: VoidPtr = + Internals.getMethodBindPtr("AnimationMixer", "set_callback_mode_discrete", 1998944670) + + internal val getCallbackModeDiscretePtr: VoidPtr = + Internals.getMethodBindPtr("AnimationMixer", "get_callback_mode_discrete", 3493168860) + + internal val setAudioMaxPolyphonyPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationMixer", "set_audio_max_polyphony", 1286410249) + + internal val getAudioMaxPolyphonyPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationMixer", "get_audio_max_polyphony", 3905245786) + + internal val setRootMotionTrackPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationMixer", "set_root_motion_track", 1348162250) + + internal val getRootMotionTrackPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationMixer", "get_root_motion_track", 4075236667) + + internal val getRootMotionPositionPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationMixer", "get_root_motion_position", 3360562783) + + internal val getRootMotionRotationPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationMixer", "get_root_motion_rotation", 1222331677) + + internal val getRootMotionScalePtr: VoidPtr = + Internals.getMethodBindPtr("AnimationMixer", "get_root_motion_scale", 3360562783) + + internal val getRootMotionPositionAccumulatorPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationMixer", "get_root_motion_position_accumulator", 3360562783) + + internal val getRootMotionRotationAccumulatorPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationMixer", "get_root_motion_rotation_accumulator", 1222331677) + + internal val getRootMotionScaleAccumulatorPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationMixer", "get_root_motion_scale_accumulator", 3360562783) + + internal val clearCachesPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationMixer", "clear_caches", 3218959716) + + internal val advancePtr: VoidPtr = + Internals.getMethodBindPtr("AnimationMixer", "advance", 373806689) + + internal val capturePtr: VoidPtr = + Internals.getMethodBindPtr("AnimationMixer", "capture", 1333632127) + + internal val setResetOnSaveEnabledPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationMixer", "set_reset_on_save_enabled", 2586408642) + + internal val isResetOnSaveEnabledPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationMixer", "is_reset_on_save_enabled", 36873697) + + internal val findAnimationPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationMixer", "find_animation", 1559484580) + + internal val findAnimationLibraryPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationMixer", "find_animation_library", 1559484580) + } +} diff --git a/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AnimationNode.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AnimationNode.kt new file mode 100644 index 0000000000..42b5446073 --- /dev/null +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AnimationNode.kt @@ -0,0 +1,421 @@ +// THIS FILE IS GENERATED! DO NOT EDIT IT MANUALLY! +@file:Suppress("PackageDirectoryMismatch", "unused", "FunctionName", "RedundantModalityModifier", + "UNCHECKED_CAST", "JoinDeclarationAndAssignment", "USELESS_CAST", + "RemoveRedundantQualifierName", "NOTHING_TO_INLINE", "NON_FINAL_MEMBER_IN_OBJECT", + "RedundantVisibilityModifier", "RedundantUnitReturnType", "MemberVisibilityCanBePrivate") + +package godot + +import godot.`annotation`.GodotBaseType +import godot.core.Dictionary +import godot.core.NodePath +import godot.core.Signal0 +import godot.core.Signal2 +import godot.core.Signal3 +import godot.core.StringName +import godot.core.VariantArray +import godot.core.VariantCaster.ANY +import godot.core.VariantParser.BOOL +import godot.core.VariantParser.DOUBLE +import godot.core.VariantParser.LONG +import godot.core.VariantParser.NIL +import godot.core.VariantParser.NODE_PATH +import godot.core.VariantParser.OBJECT +import godot.core.VariantParser.STRING +import godot.core.VariantParser.STRING_NAME +import godot.util.Internals +import godot.util.VoidPtr +import kotlin.Any +import kotlin.Boolean +import kotlin.Double +import kotlin.Float +import kotlin.Int +import kotlin.Long +import kotlin.NotImplementedError +import kotlin.String +import kotlin.Suppress +import kotlin.Unit +import kotlin.jvm.JvmName +import kotlin.jvm.JvmOverloads + +private const val ENGINE_CLASS_ANIMATIONNODE_INDEX: Int = 51 + +/** + * Base resource for [AnimationTree] nodes. In general, it's not used directly, but you can create + * custom ones with custom blending formulas. + * Inherit this when creating animation nodes mainly for use in [AnimationNodeBlendTree], otherwise + * [AnimationRootNode] should be used instead. + * You can access the time information as read-only parameter which is processed and stored in the + * previous frame for all nodes except [AnimationNodeOutput]. + * **Note:** If multiple inputs exist in the [AnimationNode], which time information takes + * precedence depends on the type of [AnimationNode]. + * [codeblock] + * var current_length = $AnimationTree[parameters/AnimationNodeName/current_length] + * var current_position = $AnimationTree[parameters/AnimationNodeName/current_position] + * var current_delta = $AnimationTree[parameters/AnimationNodeName/current_delta] + * [/codeblock] + */ +@GodotBaseType +public open class AnimationNode : Resource() { + /** + * Emitted by nodes that inherit from this class and that have an internal tree when one of their + * animation nodes changes. The animation nodes that emit this signal are + * [AnimationNodeBlendSpace1D], [AnimationNodeBlendSpace2D], [AnimationNodeStateMachine], + * [AnimationNodeBlendTree] and [AnimationNodeTransition]. + */ + public val treeChanged: Signal0 by Signal0 + + /** + * Emitted by nodes that inherit from this class and that have an internal tree when one of their + * animation node names changes. The animation nodes that emit this signal are + * [AnimationNodeBlendSpace1D], [AnimationNodeBlendSpace2D], [AnimationNodeStateMachine], and + * [AnimationNodeBlendTree]. + */ + public val animationNodeRenamed: Signal3 by Signal3 + + /** + * Emitted by nodes that inherit from this class and that have an internal tree when one of their + * animation nodes removes. The animation nodes that emit this signal are + * [AnimationNodeBlendSpace1D], [AnimationNodeBlendSpace2D], [AnimationNodeStateMachine], and + * [AnimationNodeBlendTree]. + */ + public val animationNodeRemoved: Signal2 by Signal2 + + /** + * If `true`, filtering is enabled. + */ + public final inline var filterEnabled: Boolean + @JvmName("filterEnabledProperty") + get() = isFilterEnabled() + @JvmName("filterEnabledProperty") + set(`value`) { + setFilterEnabled(value) + } + + public override fun new(scriptIndex: Int): Unit { + Internals.callConstructor(this, ENGINE_CLASS_ANIMATIONNODE_INDEX, scriptIndex) + } + + /** + * When inheriting from [AnimationRootNode], implement this virtual method to return all child + * animation nodes in order as a `name: node` dictionary. + */ + public open fun _getChildNodes(): Dictionary { + throw NotImplementedError("_get_child_nodes is not implemented for AnimationNode") + } + + /** + * When inheriting from [AnimationRootNode], implement this virtual method to return a list of the + * properties on this animation node. Parameters are custom local memory used for your animation + * nodes, given a resource can be reused in multiple trees. Format is similar to + * [Object.getPropertyList]. + */ + public open fun _getParameterList(): VariantArray { + throw NotImplementedError("_get_parameter_list is not implemented for AnimationNode") + } + + /** + * When inheriting from [AnimationRootNode], implement this virtual method to return a child + * animation node by its [name]. + */ + public open fun _getChildByName(name: StringName): AnimationNode? { + throw NotImplementedError("_get_child_by_name is not implemented for AnimationNode") + } + + /** + * When inheriting from [AnimationRootNode], implement this virtual method to return the default + * value of a [parameter]. Parameters are custom local memory used for your animation nodes, given a + * resource can be reused in multiple trees. + */ + public open fun _getParameterDefaultValue(parameter: StringName): Any? { + throw NotImplementedError("_get_parameter_default_value is not implemented for AnimationNode") + } + + /** + * When inheriting from [AnimationRootNode], implement this virtual method to return whether the + * [parameter] is read-only. Parameters are custom local memory used for your animation nodes, given + * a resource can be reused in multiple trees. + */ + public open fun _isParameterReadOnly(parameter: StringName): Boolean { + throw NotImplementedError("_is_parameter_read_only is not implemented for AnimationNode") + } + + /** + * When inheriting from [AnimationRootNode], implement this virtual method to run some code when + * this animation node is processed. The [time] parameter is a relative delta, unless [seek] is + * `true`, in which case it is absolute. + * Here, call the [blendInput], [blendNode] or [blendAnimation] functions. You can also use + * [getParameter] and [setParameter] to modify local memory. + * This function should return the delta. + */ + public open fun _process( + time: Double, + seek: Boolean, + isExternalSeeking: Boolean, + testOnly: Boolean, + ): Double { + throw NotImplementedError("_process is not implemented for AnimationNode") + } + + /** + * When inheriting from [AnimationRootNode], implement this virtual method to override the text + * caption for this animation node. + */ + public open fun _getCaption(): String { + throw NotImplementedError("_get_caption is not implemented for AnimationNode") + } + + /** + * When inheriting from [AnimationRootNode], implement this virtual method to return whether the + * blend tree editor should display filter editing on this animation node. + */ + public open fun _hasFilter(): Boolean { + throw NotImplementedError("_has_filter is not implemented for AnimationNode") + } + + /** + * Adds an input to the animation node. This is only useful for animation nodes created for use in + * an [AnimationNodeBlendTree]. If the addition fails, returns `false`. + */ + public final fun addInput(name: String): Boolean { + Internals.writeArguments(STRING to name) + Internals.callMethod(rawPtr, MethodBindings.addInputPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + /** + * Removes an input, call this only when inactive. + */ + public final fun removeInput(index: Int): Unit { + Internals.writeArguments(LONG to index.toLong()) + Internals.callMethod(rawPtr, MethodBindings.removeInputPtr, NIL) + } + + /** + * Sets the name of the input at the given [input] index. If the setting fails, returns `false`. + */ + public final fun setInputName(input: Int, name: String): Boolean { + Internals.writeArguments(LONG to input.toLong(), STRING to name) + Internals.callMethod(rawPtr, MethodBindings.setInputNamePtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + /** + * Gets the name of an input by index. + */ + public final fun getInputName(input: Int): String { + Internals.writeArguments(LONG to input.toLong()) + Internals.callMethod(rawPtr, MethodBindings.getInputNamePtr, STRING) + return (Internals.readReturnValue(STRING) as String) + } + + /** + * Amount of inputs in this animation node, only useful for animation nodes that go into + * [AnimationNodeBlendTree]. + */ + public final fun getInputCount(): Int { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getInputCountPtr, LONG) + return (Internals.readReturnValue(LONG) as Long).toInt() + } + + /** + * Returns the input index which corresponds to [name]. If not found, returns `-1`. + */ + public final fun findInput(name: String): Int { + Internals.writeArguments(STRING to name) + Internals.callMethod(rawPtr, MethodBindings.findInputPtr, LONG) + return (Internals.readReturnValue(LONG) as Long).toInt() + } + + /** + * Adds or removes a path for the filter. + */ + public final fun setFilterPath(path: NodePath, enable: Boolean): Unit { + Internals.writeArguments(NODE_PATH to path, BOOL to enable) + Internals.callMethod(rawPtr, MethodBindings.setFilterPathPtr, NIL) + } + + /** + * Returns whether the given path is filtered. + */ + public final fun isPathFiltered(path: NodePath): Boolean { + Internals.writeArguments(NODE_PATH to path) + Internals.callMethod(rawPtr, MethodBindings.isPathFilteredPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public final fun setFilterEnabled(enable: Boolean): Unit { + Internals.writeArguments(BOOL to enable) + Internals.callMethod(rawPtr, MethodBindings.setFilterEnabledPtr, NIL) + } + + public final fun isFilterEnabled(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isFilterEnabledPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + /** + * Blend an animation by [blend] amount (name must be valid in the linked [AnimationPlayer]). A + * [time] and [delta] may be passed, as well as whether [seeked] happened. + * A [loopedFlag] is used by internal processing immediately after the loop. See also + * [Animation.LoopedFlag]. + */ + @JvmOverloads + public final fun blendAnimation( + animation: StringName, + time: Double, + delta: Double, + seeked: Boolean, + isExternalSeeking: Boolean, + blend: Float, + loopedFlag: Animation.LoopedFlag = Animation.LoopedFlag.LOOPED_FLAG_NONE, + ): Unit { + Internals.writeArguments(STRING_NAME to animation, DOUBLE to time, DOUBLE to delta, BOOL to seeked, BOOL to isExternalSeeking, DOUBLE to blend.toDouble(), LONG to loopedFlag.id) + Internals.callMethod(rawPtr, MethodBindings.blendAnimationPtr, NIL) + } + + /** + * Blend another animation node (in case this animation node contains child animation nodes). This + * function is only useful if you inherit from [AnimationRootNode] instead, otherwise editors will + * not display your animation node for addition. + */ + @JvmOverloads + public final fun blendNode( + name: StringName, + node: AnimationNode?, + time: Double, + seek: Boolean, + isExternalSeeking: Boolean, + blend: Float, + filter: FilterAction = AnimationNode.FilterAction.FILTER_IGNORE, + sync: Boolean = true, + testOnly: Boolean = false, + ): Double { + Internals.writeArguments(STRING_NAME to name, OBJECT to node, DOUBLE to time, BOOL to seek, BOOL to isExternalSeeking, DOUBLE to blend.toDouble(), LONG to filter.id, BOOL to sync, BOOL to testOnly) + Internals.callMethod(rawPtr, MethodBindings.blendNodePtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double) + } + + /** + * Blend an input. This is only useful for animation nodes created for an + * [AnimationNodeBlendTree]. The [time] parameter is a relative delta, unless [seek] is `true`, in + * which case it is absolute. A filter mode may be optionally passed (see [FilterAction] for + * options). + */ + @JvmOverloads + public final fun blendInput( + inputIndex: Int, + time: Double, + seek: Boolean, + isExternalSeeking: Boolean, + blend: Float, + filter: FilterAction = AnimationNode.FilterAction.FILTER_IGNORE, + sync: Boolean = true, + testOnly: Boolean = false, + ): Double { + Internals.writeArguments(LONG to inputIndex.toLong(), DOUBLE to time, BOOL to seek, BOOL to isExternalSeeking, DOUBLE to blend.toDouble(), LONG to filter.id, BOOL to sync, BOOL to testOnly) + Internals.callMethod(rawPtr, MethodBindings.blendInputPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double) + } + + /** + * Sets a custom parameter. These are used as local memory, because resources can be reused across + * the tree or scenes. + */ + public final fun setParameter(name: StringName, `value`: Any?): Unit { + Internals.writeArguments(STRING_NAME to name, ANY to value) + Internals.callMethod(rawPtr, MethodBindings.setParameterPtr, NIL) + } + + /** + * Gets the value of a parameter. Parameters are custom local memory used for your animation + * nodes, given a resource can be reused in multiple trees. + */ + public final fun getParameter(name: StringName): Any? { + Internals.writeArguments(STRING_NAME to name) + Internals.callMethod(rawPtr, MethodBindings.getParameterPtr, ANY) + return (Internals.readReturnValue(ANY) as Any?) + } + + public enum class FilterAction( + id: Long, + ) { + /** + * Do not use filtering. + */ + FILTER_IGNORE(0), + /** + * Paths matching the filter will be allowed to pass. + */ + FILTER_PASS(1), + /** + * Paths matching the filter will be discarded. + */ + FILTER_STOP(2), + /** + * Paths matching the filter will be blended (by the blend value). + */ + FILTER_BLEND(3), + ; + + public val id: Long + init { + this.id = id + } + + public companion object { + public fun from(`value`: Long): FilterAction = entries.single { it.id == `value` } + } + } + + public companion object + + public object MethodBindings { + internal val addInputPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNode", "add_input", 2323990056) + + internal val removeInputPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNode", "remove_input", 1286410249) + + internal val setInputNamePtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNode", "set_input_name", 215573526) + + internal val getInputNamePtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNode", "get_input_name", 844755477) + + internal val getInputCountPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNode", "get_input_count", 3905245786) + + internal val findInputPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNode", "find_input", 1321353865) + + internal val setFilterPathPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNode", "set_filter_path", 3868023870) + + internal val isPathFilteredPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNode", "is_path_filtered", 861721659) + + internal val setFilterEnabledPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNode", "set_filter_enabled", 2586408642) + + internal val isFilterEnabledPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNode", "is_filter_enabled", 36873697) + + internal val blendAnimationPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNode", "blend_animation", 1630801826) + + internal val blendNodePtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNode", "blend_node", 1746075988) + + internal val blendInputPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNode", "blend_input", 1361527350) + + internal val setParameterPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNode", "set_parameter", 3776071444) + + internal val getParameterPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNode", "get_parameter", 2760726917) + } +} diff --git a/kt/godot-library/src/main/kotlin/godot/gen/godot/AnimationNodeAdd2.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AnimationNodeAdd2.kt similarity index 83% rename from kt/godot-library/src/main/kotlin/godot/gen/godot/AnimationNodeAdd2.kt rename to kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AnimationNodeAdd2.kt index 698ce26016..d7cc90cf92 100644 --- a/kt/godot-library/src/main/kotlin/godot/gen/godot/AnimationNodeAdd2.kt +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AnimationNodeAdd2.kt @@ -7,10 +7,13 @@ package godot import godot.`annotation`.GodotBaseType +import godot.util.Internals import kotlin.Int import kotlin.Suppress import kotlin.Unit +private const val ENGINE_CLASS_ANIMATIONNODEADD2_INDEX: Int = 52 + /** * A resource to add to an [AnimationNodeBlendTree]. Blends two animations additively based on the * amount value. @@ -22,10 +25,10 @@ import kotlin.Unit @GodotBaseType public open class AnimationNodeAdd2 : AnimationNodeSync() { public override fun new(scriptIndex: Int): Unit { - callConstructor(ENGINECLASS_ANIMATIONNODEADD2, scriptIndex) + Internals.callConstructor(this, ENGINE_CLASS_ANIMATIONNODEADD2_INDEX, scriptIndex) } public companion object - internal object MethodBindings + public object MethodBindings } diff --git a/kt/godot-library/src/main/kotlin/godot/gen/godot/AnimationNodeAdd3.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AnimationNodeAdd3.kt similarity index 85% rename from kt/godot-library/src/main/kotlin/godot/gen/godot/AnimationNodeAdd3.kt rename to kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AnimationNodeAdd3.kt index da70d2b856..9b362f53e8 100644 --- a/kt/godot-library/src/main/kotlin/godot/gen/godot/AnimationNodeAdd3.kt +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AnimationNodeAdd3.kt @@ -7,10 +7,13 @@ package godot import godot.`annotation`.GodotBaseType +import godot.util.Internals import kotlin.Int import kotlin.Suppress import kotlin.Unit +private const val ENGINE_CLASS_ANIMATIONNODEADD3_INDEX: Int = 53 + /** * A resource to add to an [AnimationNodeBlendTree]. Blends two animations out of three additively * out of three based on the amount value. @@ -24,10 +27,10 @@ import kotlin.Unit @GodotBaseType public open class AnimationNodeAdd3 : AnimationNodeSync() { public override fun new(scriptIndex: Int): Unit { - callConstructor(ENGINECLASS_ANIMATIONNODEADD3, scriptIndex) + Internals.callConstructor(this, ENGINE_CLASS_ANIMATIONNODEADD3_INDEX, scriptIndex) } public companion object - internal object MethodBindings + public object MethodBindings } diff --git a/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AnimationNodeAnimation.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AnimationNodeAnimation.kt new file mode 100644 index 0000000000..7c49cadc05 --- /dev/null +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AnimationNodeAnimation.kt @@ -0,0 +1,270 @@ +// THIS FILE IS GENERATED! DO NOT EDIT IT MANUALLY! +@file:Suppress("PackageDirectoryMismatch", "unused", "FunctionName", "RedundantModalityModifier", + "UNCHECKED_CAST", "JoinDeclarationAndAssignment", "USELESS_CAST", + "RemoveRedundantQualifierName", "NOTHING_TO_INLINE", "NON_FINAL_MEMBER_IN_OBJECT", + "RedundantVisibilityModifier", "RedundantUnitReturnType", "MemberVisibilityCanBePrivate") + +package godot + +import godot.`annotation`.GodotBaseType +import godot.core.StringName +import godot.core.VariantParser.BOOL +import godot.core.VariantParser.DOUBLE +import godot.core.VariantParser.LONG +import godot.core.VariantParser.NIL +import godot.core.VariantParser.STRING_NAME +import godot.util.Internals +import godot.util.VoidPtr +import kotlin.Boolean +import kotlin.Double +import kotlin.Int +import kotlin.Long +import kotlin.Suppress +import kotlin.Unit +import kotlin.jvm.JvmName + +private const val ENGINE_CLASS_ANIMATIONNODEANIMATION_INDEX: Int = 54 + +/** + * A resource to add to an [AnimationNodeBlendTree]. Only has one output port using the [animation] + * property. Used as an input for [AnimationNode]s that blend animations together. + */ +@GodotBaseType +public open class AnimationNodeAnimation : AnimationRootNode() { + /** + * Animation to use as an output. It is one of the animations provided by + * [AnimationTree.animPlayer]. + */ + public final inline var animation: StringName + @JvmName("animationProperty") + get() = getAnimation() + @JvmName("animationProperty") + set(`value`) { + setAnimation(value) + } + + /** + * Determines the playback direction of the animation. + */ + public final inline var playMode: PlayMode + @JvmName("playModeProperty") + get() = getPlayMode() + @JvmName("playModeProperty") + set(`value`) { + setPlayMode(value) + } + + /** + * If `true`, [AnimationNode] provides an animation based on the [Animation] resource with some + * parameters adjusted. + */ + public final inline var useCustomTimeline: Boolean + @JvmName("useCustomTimelineProperty") + get() = isUsingCustomTimeline() + @JvmName("useCustomTimelineProperty") + set(`value`) { + setUseCustomTimeline(value) + } + + /** + * If [useCustomTimeline] is `true`, offset the start position of the animation. + */ + public final inline var timelineLength: Double + @JvmName("timelineLengthProperty") + get() = getTimelineLength() + @JvmName("timelineLengthProperty") + set(`value`) { + setTimelineLength(value) + } + + /** + * If `true`, scales the time so that the length specified in [timelineLength] is one cycle. + * This is useful for matching the periods of walking and running animations. + * If `false`, the original animation length is respected. If you set the loop to [loopMode], the + * animation will loop in [timelineLength]. + */ + public final inline var stretchTimeScale: Boolean + @JvmName("stretchTimeScaleProperty") + get() = isStretchingTimeScale() + @JvmName("stretchTimeScaleProperty") + set(`value`) { + setStretchTimeScale(value) + } + + /** + * If [useCustomTimeline] is `true`, offset the start position of the animation. + * This is useful for adjusting which foot steps first in 3D walking animations. + */ + public final inline var startOffset: Double + @JvmName("startOffsetProperty") + get() = getStartOffset() + @JvmName("startOffsetProperty") + set(`value`) { + setStartOffset(value) + } + + /** + * If [useCustomTimeline] is `true`, override the loop settings of the original [Animation] + * resource with the value. + * **Note:** If the [Animation.loopMode] isn't set to looping, the + * [Animation.trackSetInterpolationLoopWrap] option will not be respected. If you cannot get the + * expected behavior, consider duplicating the [Animation] resource and changing the loop settings. + */ + public final inline var loopMode: Animation.LoopMode + @JvmName("loopModeProperty") + get() = getLoopMode() + @JvmName("loopModeProperty") + set(`value`) { + setLoopMode(value) + } + + public override fun new(scriptIndex: Int): Unit { + Internals.callConstructor(this, ENGINE_CLASS_ANIMATIONNODEANIMATION_INDEX, scriptIndex) + } + + public final fun setAnimation(name: StringName): Unit { + Internals.writeArguments(STRING_NAME to name) + Internals.callMethod(rawPtr, MethodBindings.setAnimationPtr, NIL) + } + + public final fun getAnimation(): StringName { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getAnimationPtr, STRING_NAME) + return (Internals.readReturnValue(STRING_NAME) as StringName) + } + + public final fun setPlayMode(mode: PlayMode): Unit { + Internals.writeArguments(LONG to mode.id) + Internals.callMethod(rawPtr, MethodBindings.setPlayModePtr, NIL) + } + + public final fun getPlayMode(): PlayMode { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getPlayModePtr, LONG) + return AnimationNodeAnimation.PlayMode.from(Internals.readReturnValue(LONG) as Long) + } + + public final fun setUseCustomTimeline(useCustomTimeline: Boolean): Unit { + Internals.writeArguments(BOOL to useCustomTimeline) + Internals.callMethod(rawPtr, MethodBindings.setUseCustomTimelinePtr, NIL) + } + + public final fun isUsingCustomTimeline(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isUsingCustomTimelinePtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public final fun setTimelineLength(timelineLength: Double): Unit { + Internals.writeArguments(DOUBLE to timelineLength) + Internals.callMethod(rawPtr, MethodBindings.setTimelineLengthPtr, NIL) + } + + public final fun getTimelineLength(): Double { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getTimelineLengthPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double) + } + + public final fun setStretchTimeScale(stretchTimeScale: Boolean): Unit { + Internals.writeArguments(BOOL to stretchTimeScale) + Internals.callMethod(rawPtr, MethodBindings.setStretchTimeScalePtr, NIL) + } + + public final fun isStretchingTimeScale(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isStretchingTimeScalePtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public final fun setStartOffset(startOffset: Double): Unit { + Internals.writeArguments(DOUBLE to startOffset) + Internals.callMethod(rawPtr, MethodBindings.setStartOffsetPtr, NIL) + } + + public final fun getStartOffset(): Double { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getStartOffsetPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double) + } + + public final fun setLoopMode(loopMode: Animation.LoopMode): Unit { + Internals.writeArguments(LONG to loopMode.id) + Internals.callMethod(rawPtr, MethodBindings.setLoopModePtr, NIL) + } + + public final fun getLoopMode(): Animation.LoopMode { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getLoopModePtr, LONG) + return Animation.LoopMode.from(Internals.readReturnValue(LONG) as Long) + } + + public enum class PlayMode( + id: Long, + ) { + /** + * Plays animation in forward direction. + */ + PLAY_MODE_FORWARD(0), + /** + * Plays animation in backward direction. + */ + PLAY_MODE_BACKWARD(1), + ; + + public val id: Long + init { + this.id = id + } + + public companion object { + public fun from(`value`: Long): PlayMode = entries.single { it.id == `value` } + } + } + + public companion object + + public object MethodBindings { + internal val setAnimationPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeAnimation", "set_animation", 3304788590) + + internal val getAnimationPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeAnimation", "get_animation", 2002593661) + + internal val setPlayModePtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeAnimation", "set_play_mode", 3347718873) + + internal val getPlayModePtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeAnimation", "get_play_mode", 2061244637) + + internal val setUseCustomTimelinePtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeAnimation", "set_use_custom_timeline", 2586408642) + + internal val isUsingCustomTimelinePtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeAnimation", "is_using_custom_timeline", 36873697) + + internal val setTimelineLengthPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeAnimation", "set_timeline_length", 373806689) + + internal val getTimelineLengthPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeAnimation", "get_timeline_length", 1740695150) + + internal val setStretchTimeScalePtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeAnimation", "set_stretch_time_scale", 2586408642) + + internal val isStretchingTimeScalePtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeAnimation", "is_stretching_time_scale", 36873697) + + internal val setStartOffsetPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeAnimation", "set_start_offset", 373806689) + + internal val getStartOffsetPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeAnimation", "get_start_offset", 1740695150) + + internal val setLoopModePtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeAnimation", "set_loop_mode", 3155355575) + + internal val getLoopModePtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeAnimation", "get_loop_mode", 1988889481) + } +} diff --git a/kt/godot-library/src/main/kotlin/godot/gen/godot/AnimationNodeBlend2.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AnimationNodeBlend2.kt similarity index 82% rename from kt/godot-library/src/main/kotlin/godot/gen/godot/AnimationNodeBlend2.kt rename to kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AnimationNodeBlend2.kt index 402b54af1c..186b1c60b0 100644 --- a/kt/godot-library/src/main/kotlin/godot/gen/godot/AnimationNodeBlend2.kt +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AnimationNodeBlend2.kt @@ -7,10 +7,13 @@ package godot import godot.`annotation`.GodotBaseType +import godot.util.Internals import kotlin.Int import kotlin.Suppress import kotlin.Unit +private const val ENGINE_CLASS_ANIMATIONNODEBLEND2_INDEX: Int = 55 + /** * A resource to add to an [AnimationNodeBlendTree]. Blends two animations linearly based on the * amount value. @@ -20,10 +23,10 @@ import kotlin.Unit @GodotBaseType public open class AnimationNodeBlend2 : AnimationNodeSync() { public override fun new(scriptIndex: Int): Unit { - callConstructor(ENGINECLASS_ANIMATIONNODEBLEND2, scriptIndex) + Internals.callConstructor(this, ENGINE_CLASS_ANIMATIONNODEBLEND2_INDEX, scriptIndex) } public companion object - internal object MethodBindings + public object MethodBindings } diff --git a/kt/godot-library/src/main/kotlin/godot/gen/godot/AnimationNodeBlend3.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AnimationNodeBlend3.kt similarity index 85% rename from kt/godot-library/src/main/kotlin/godot/gen/godot/AnimationNodeBlend3.kt rename to kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AnimationNodeBlend3.kt index 2119f30b69..1c6319e8e1 100644 --- a/kt/godot-library/src/main/kotlin/godot/gen/godot/AnimationNodeBlend3.kt +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AnimationNodeBlend3.kt @@ -7,10 +7,13 @@ package godot import godot.`annotation`.GodotBaseType +import godot.util.Internals import kotlin.Int import kotlin.Suppress import kotlin.Unit +private const val ENGINE_CLASS_ANIMATIONNODEBLEND3_INDEX: Int = 56 + /** * A resource to add to an [AnimationNodeBlendTree]. Blends two animations out of three linearly out * of three based on the amount value. @@ -24,10 +27,10 @@ import kotlin.Unit @GodotBaseType public open class AnimationNodeBlend3 : AnimationNodeSync() { public override fun new(scriptIndex: Int): Unit { - callConstructor(ENGINECLASS_ANIMATIONNODEBLEND3, scriptIndex) + Internals.callConstructor(this, ENGINE_CLASS_ANIMATIONNODEBLEND3_INDEX, scriptIndex) } public companion object - internal object MethodBindings + public object MethodBindings } diff --git a/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AnimationNodeBlendSpace1D.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AnimationNodeBlendSpace1D.kt new file mode 100644 index 0000000000..4396b647a1 --- /dev/null +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AnimationNodeBlendSpace1D.kt @@ -0,0 +1,332 @@ +// THIS FILE IS GENERATED! DO NOT EDIT IT MANUALLY! +@file:Suppress("PackageDirectoryMismatch", "unused", "FunctionName", "RedundantModalityModifier", + "UNCHECKED_CAST", "JoinDeclarationAndAssignment", "USELESS_CAST", + "RemoveRedundantQualifierName", "NOTHING_TO_INLINE", "NON_FINAL_MEMBER_IN_OBJECT", + "RedundantVisibilityModifier", "RedundantUnitReturnType", "MemberVisibilityCanBePrivate") + +package godot + +import godot.`annotation`.GodotBaseType +import godot.core.VariantParser.BOOL +import godot.core.VariantParser.DOUBLE +import godot.core.VariantParser.LONG +import godot.core.VariantParser.NIL +import godot.core.VariantParser.OBJECT +import godot.core.VariantParser.STRING +import godot.util.Internals +import godot.util.VoidPtr +import kotlin.Boolean +import kotlin.Double +import kotlin.Float +import kotlin.Int +import kotlin.Long +import kotlin.String +import kotlin.Suppress +import kotlin.Unit +import kotlin.jvm.JvmName +import kotlin.jvm.JvmOverloads + +private const val ENGINE_CLASS_ANIMATIONNODEBLENDSPACE1D_INDEX: Int = 57 + +/** + * A resource used by [AnimationNodeBlendTree]. + * [AnimationNodeBlendSpace1D] represents a virtual axis on which any type of [AnimationRootNode]s + * can be added using [addBlendPoint]. Outputs the linear blend of the two [AnimationRootNode]s + * adjacent to the current value. + * You can set the extents of the axis with [minSpace] and [maxSpace]. + */ +@GodotBaseType +public open class AnimationNodeBlendSpace1D : AnimationRootNode() { + /** + * The blend space's axis's lower limit for the points' position. See [addBlendPoint]. + */ + public final inline var minSpace: Float + @JvmName("minSpaceProperty") + get() = getMinSpace() + @JvmName("minSpaceProperty") + set(`value`) { + setMinSpace(value) + } + + /** + * The blend space's axis's upper limit for the points' position. See [addBlendPoint]. + */ + public final inline var maxSpace: Float + @JvmName("maxSpaceProperty") + get() = getMaxSpace() + @JvmName("maxSpaceProperty") + set(`value`) { + setMaxSpace(value) + } + + /** + * Position increment to snap to when moving a point on the axis. + */ + public final inline var snap: Float + @JvmName("snapProperty") + get() = getSnap() + @JvmName("snapProperty") + set(`value`) { + setSnap(value) + } + + /** + * Label of the virtual axis of the blend space. + */ + public final inline var valueLabel: String + @JvmName("valueLabelProperty") + get() = getValueLabel() + @JvmName("valueLabelProperty") + set(`value`) { + setValueLabel(value) + } + + /** + * Controls the interpolation between animations. See [BlendMode] constants. + */ + public final inline var blendMode: BlendMode + @JvmName("blendModeProperty") + get() = getBlendMode() + @JvmName("blendModeProperty") + set(`value`) { + setBlendMode(value) + } + + /** + * If `false`, the blended animations' frame are stopped when the blend value is `0`. + * If `true`, forcing the blended animations to advance frame. + */ + public final inline var sync: Boolean + @JvmName("syncProperty") + get() = isUsingSync() + @JvmName("syncProperty") + set(`value`) { + setUseSync(value) + } + + public override fun new(scriptIndex: Int): Unit { + Internals.callConstructor(this, ENGINE_CLASS_ANIMATIONNODEBLENDSPACE1D_INDEX, scriptIndex) + } + + /** + * Adds a new point that represents a [node] on the virtual axis at a given position set by [pos]. + * You can insert it at a specific index using the [atIndex] argument. If you use the default value + * for [atIndex], the point is inserted at the end of the blend points array. + */ + @JvmOverloads + public final fun addBlendPoint( + node: AnimationRootNode?, + pos: Float, + atIndex: Int = -1, + ): Unit { + Internals.writeArguments(OBJECT to node, DOUBLE to pos.toDouble(), LONG to atIndex.toLong()) + Internals.callMethod(rawPtr, MethodBindings.addBlendPointPtr, NIL) + } + + /** + * Updates the position of the point at index [point] on the blend axis. + */ + public final fun setBlendPointPosition(point: Int, pos: Float): Unit { + Internals.writeArguments(LONG to point.toLong(), DOUBLE to pos.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setBlendPointPositionPtr, NIL) + } + + /** + * Returns the position of the point at index [point]. + */ + public final fun getBlendPointPosition(point: Int): Float { + Internals.writeArguments(LONG to point.toLong()) + Internals.callMethod(rawPtr, MethodBindings.getBlendPointPositionPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + /** + * Changes the [AnimationNode] referenced by the point at index [point]. + */ + public final fun setBlendPointNode(point: Int, node: AnimationRootNode?): Unit { + Internals.writeArguments(LONG to point.toLong(), OBJECT to node) + Internals.callMethod(rawPtr, MethodBindings.setBlendPointNodePtr, NIL) + } + + /** + * Returns the [AnimationNode] referenced by the point at index [point]. + */ + public final fun getBlendPointNode(point: Int): AnimationRootNode? { + Internals.writeArguments(LONG to point.toLong()) + Internals.callMethod(rawPtr, MethodBindings.getBlendPointNodePtr, OBJECT) + return (Internals.readReturnValue(OBJECT) as AnimationRootNode?) + } + + /** + * Removes the point at index [point] from the blend axis. + */ + public final fun removeBlendPoint(point: Int): Unit { + Internals.writeArguments(LONG to point.toLong()) + Internals.callMethod(rawPtr, MethodBindings.removeBlendPointPtr, NIL) + } + + /** + * Returns the number of points on the blend axis. + */ + public final fun getBlendPointCount(): Int { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getBlendPointCountPtr, LONG) + return (Internals.readReturnValue(LONG) as Long).toInt() + } + + public final fun setMinSpace(minSpace: Float): Unit { + Internals.writeArguments(DOUBLE to minSpace.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setMinSpacePtr, NIL) + } + + public final fun getMinSpace(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getMinSpacePtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setMaxSpace(maxSpace: Float): Unit { + Internals.writeArguments(DOUBLE to maxSpace.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setMaxSpacePtr, NIL) + } + + public final fun getMaxSpace(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getMaxSpacePtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setSnap(snap: Float): Unit { + Internals.writeArguments(DOUBLE to snap.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setSnapPtr, NIL) + } + + public final fun getSnap(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getSnapPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setValueLabel(text: String): Unit { + Internals.writeArguments(STRING to text) + Internals.callMethod(rawPtr, MethodBindings.setValueLabelPtr, NIL) + } + + public final fun getValueLabel(): String { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getValueLabelPtr, STRING) + return (Internals.readReturnValue(STRING) as String) + } + + public final fun setBlendMode(mode: BlendMode): Unit { + Internals.writeArguments(LONG to mode.id) + Internals.callMethod(rawPtr, MethodBindings.setBlendModePtr, NIL) + } + + public final fun getBlendMode(): BlendMode { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getBlendModePtr, LONG) + return AnimationNodeBlendSpace1D.BlendMode.from(Internals.readReturnValue(LONG) as Long) + } + + public final fun setUseSync(enable: Boolean): Unit { + Internals.writeArguments(BOOL to enable) + Internals.callMethod(rawPtr, MethodBindings.setUseSyncPtr, NIL) + } + + public final fun isUsingSync(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isUsingSyncPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public enum class BlendMode( + id: Long, + ) { + /** + * The interpolation between animations is linear. + */ + BLEND_MODE_INTERPOLATED(0), + /** + * The blend space plays the animation of the animation node which blending position is closest + * to. Useful for frame-by-frame 2D animations. + */ + BLEND_MODE_DISCRETE(1), + /** + * Similar to [BLEND_MODE_DISCRETE], but starts the new animation at the last animation's + * playback position. + */ + BLEND_MODE_DISCRETE_CARRY(2), + ; + + public val id: Long + init { + this.id = id + } + + public companion object { + public fun from(`value`: Long): BlendMode = entries.single { it.id == `value` } + } + } + + public companion object + + public object MethodBindings { + internal val addBlendPointPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeBlendSpace1D", "add_blend_point", 285050433) + + internal val setBlendPointPositionPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeBlendSpace1D", "set_blend_point_position", 1602489585) + + internal val getBlendPointPositionPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeBlendSpace1D", "get_blend_point_position", 2339986948) + + internal val setBlendPointNodePtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeBlendSpace1D", "set_blend_point_node", 4240341528) + + internal val getBlendPointNodePtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeBlendSpace1D", "get_blend_point_node", 665599029) + + internal val removeBlendPointPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeBlendSpace1D", "remove_blend_point", 1286410249) + + internal val getBlendPointCountPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeBlendSpace1D", "get_blend_point_count", 3905245786) + + internal val setMinSpacePtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeBlendSpace1D", "set_min_space", 373806689) + + internal val getMinSpacePtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeBlendSpace1D", "get_min_space", 1740695150) + + internal val setMaxSpacePtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeBlendSpace1D", "set_max_space", 373806689) + + internal val getMaxSpacePtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeBlendSpace1D", "get_max_space", 1740695150) + + internal val setSnapPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeBlendSpace1D", "set_snap", 373806689) + + internal val getSnapPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeBlendSpace1D", "get_snap", 1740695150) + + internal val setValueLabelPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeBlendSpace1D", "set_value_label", 83702148) + + internal val getValueLabelPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeBlendSpace1D", "get_value_label", 201670096) + + internal val setBlendModePtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeBlendSpace1D", "set_blend_mode", 2600869457) + + internal val getBlendModePtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeBlendSpace1D", "get_blend_mode", 1547667849) + + internal val setUseSyncPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeBlendSpace1D", "set_use_sync", 2586408642) + + internal val isUsingSyncPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeBlendSpace1D", "is_using_sync", 36873697) + } +} diff --git a/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AnimationNodeBlendSpace2D.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AnimationNodeBlendSpace2D.kt new file mode 100644 index 0000000000..aac9ad1384 --- /dev/null +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AnimationNodeBlendSpace2D.kt @@ -0,0 +1,529 @@ +// THIS FILE IS GENERATED! DO NOT EDIT IT MANUALLY! +@file:Suppress("PackageDirectoryMismatch", "unused", "FunctionName", "RedundantModalityModifier", + "UNCHECKED_CAST", "JoinDeclarationAndAssignment", "USELESS_CAST", + "RemoveRedundantQualifierName", "NOTHING_TO_INLINE", "NON_FINAL_MEMBER_IN_OBJECT", + "RedundantVisibilityModifier", "RedundantUnitReturnType", "MemberVisibilityCanBePrivate") + +package godot + +import godot.`annotation`.CoreTypeHelper +import godot.`annotation`.CoreTypeLocalCopy +import godot.`annotation`.GodotBaseType +import godot.core.Signal0 +import godot.core.VariantParser.BOOL +import godot.core.VariantParser.LONG +import godot.core.VariantParser.NIL +import godot.core.VariantParser.OBJECT +import godot.core.VariantParser.STRING +import godot.core.VariantParser.VECTOR2 +import godot.core.Vector2 +import godot.util.Internals +import godot.util.VoidPtr +import kotlin.Boolean +import kotlin.Int +import kotlin.Long +import kotlin.String +import kotlin.Suppress +import kotlin.Unit +import kotlin.jvm.JvmName +import kotlin.jvm.JvmOverloads + +private const val ENGINE_CLASS_ANIMATIONNODEBLENDSPACE2D_INDEX: Int = 58 + +/** + * A resource used by [AnimationNodeBlendTree]. + * [AnimationNodeBlendSpace1D] represents a virtual 2D space on which [AnimationRootNode]s are + * placed. Outputs the linear blend of the three adjacent animations using a [Vector2] weight. Adjacent + * in this context means the three [AnimationRootNode]s making up the triangle that contains the + * current value. + * You can add vertices to the blend space with [addBlendPoint] and automatically triangulate it by + * setting [autoTriangles] to `true`. Otherwise, use [addTriangle] and [removeTriangle] to triangulate + * the blend space by hand. + */ +@GodotBaseType +public open class AnimationNodeBlendSpace2D : AnimationRootNode() { + /** + * Emitted every time the blend space's triangles are created, removed, or when one of their + * vertices changes position. + */ + public val trianglesUpdated: Signal0 by Signal0 + + /** + * If `true`, the blend space is triangulated automatically. The mesh updates every time you add + * or remove points with [addBlendPoint] and [removeBlendPoint]. + */ + public final inline var autoTriangles: Boolean + @JvmName("autoTrianglesProperty") + get() = getAutoTriangles() + @JvmName("autoTrianglesProperty") + set(`value`) { + setAutoTriangles(value) + } + + /** + * The blend space's X and Y axes' lower limit for the points' position. See [addBlendPoint]. + */ + @CoreTypeLocalCopy + public final inline var minSpace: Vector2 + @JvmName("minSpaceProperty") + get() = getMinSpace() + @JvmName("minSpaceProperty") + set(`value`) { + setMinSpace(value) + } + + /** + * The blend space's X and Y axes' upper limit for the points' position. See [addBlendPoint]. + */ + @CoreTypeLocalCopy + public final inline var maxSpace: Vector2 + @JvmName("maxSpaceProperty") + get() = getMaxSpace() + @JvmName("maxSpaceProperty") + set(`value`) { + setMaxSpace(value) + } + + /** + * Position increment to snap to when moving a point. + */ + @CoreTypeLocalCopy + public final inline var snap: Vector2 + @JvmName("snapProperty") + get() = getSnap() + @JvmName("snapProperty") + set(`value`) { + setSnap(value) + } + + /** + * Name of the blend space's X axis. + */ + public final inline var xLabel: String + @JvmName("xLabelProperty") + get() = getXLabel() + @JvmName("xLabelProperty") + set(`value`) { + setXLabel(value) + } + + /** + * Name of the blend space's Y axis. + */ + public final inline var yLabel: String + @JvmName("yLabelProperty") + get() = getYLabel() + @JvmName("yLabelProperty") + set(`value`) { + setYLabel(value) + } + + /** + * Controls the interpolation between animations. See [BlendMode] constants. + */ + public final inline var blendMode: BlendMode + @JvmName("blendModeProperty") + get() = getBlendMode() + @JvmName("blendModeProperty") + set(`value`) { + setBlendMode(value) + } + + /** + * If `false`, the blended animations' frame are stopped when the blend value is `0`. + * If `true`, forcing the blended animations to advance frame. + */ + public final inline var sync: Boolean + @JvmName("syncProperty") + get() = isUsingSync() + @JvmName("syncProperty") + set(`value`) { + setUseSync(value) + } + + public override fun new(scriptIndex: Int): Unit { + Internals.callConstructor(this, ENGINE_CLASS_ANIMATIONNODEBLENDSPACE2D_INDEX, scriptIndex) + } + + /** + * The blend space's X and Y axes' lower limit for the points' position. See [addBlendPoint]. + * + * This is a helper function to make dealing with local copies easier. + * + * For more information, see our + * [documentation](https://godot-kotl.in/en/stable/user-guide/api-differences/#core-types). + * + * Allow to directly modify the local copy of the property and assign it back to the Object. + * + * Prefer that over writing: + * `````` + * val myCoreType = animationnodeblendspace2d.minSpace + * //Your changes + * animationnodeblendspace2d.minSpace = myCoreType + * `````` + */ + @CoreTypeHelper + public final fun minSpaceMutate(block: Vector2.() -> Unit): Vector2 = minSpace.apply{ + block(this) + minSpace = this + } + + + /** + * The blend space's X and Y axes' upper limit for the points' position. See [addBlendPoint]. + * + * This is a helper function to make dealing with local copies easier. + * + * For more information, see our + * [documentation](https://godot-kotl.in/en/stable/user-guide/api-differences/#core-types). + * + * Allow to directly modify the local copy of the property and assign it back to the Object. + * + * Prefer that over writing: + * `````` + * val myCoreType = animationnodeblendspace2d.maxSpace + * //Your changes + * animationnodeblendspace2d.maxSpace = myCoreType + * `````` + */ + @CoreTypeHelper + public final fun maxSpaceMutate(block: Vector2.() -> Unit): Vector2 = maxSpace.apply{ + block(this) + maxSpace = this + } + + + /** + * Position increment to snap to when moving a point. + * + * This is a helper function to make dealing with local copies easier. + * + * For more information, see our + * [documentation](https://godot-kotl.in/en/stable/user-guide/api-differences/#core-types). + * + * Allow to directly modify the local copy of the property and assign it back to the Object. + * + * Prefer that over writing: + * `````` + * val myCoreType = animationnodeblendspace2d.snap + * //Your changes + * animationnodeblendspace2d.snap = myCoreType + * `````` + */ + @CoreTypeHelper + public final fun snapMutate(block: Vector2.() -> Unit): Vector2 = snap.apply{ + block(this) + snap = this + } + + + /** + * Adds a new point that represents a [node] at the position set by [pos]. You can insert it at a + * specific index using the [atIndex] argument. If you use the default value for [atIndex], the point + * is inserted at the end of the blend points array. + */ + @JvmOverloads + public final fun addBlendPoint( + node: AnimationRootNode?, + pos: Vector2, + atIndex: Int = -1, + ): Unit { + Internals.writeArguments(OBJECT to node, VECTOR2 to pos, LONG to atIndex.toLong()) + Internals.callMethod(rawPtr, MethodBindings.addBlendPointPtr, NIL) + } + + /** + * Updates the position of the point at index [point] on the blend axis. + */ + public final fun setBlendPointPosition(point: Int, pos: Vector2): Unit { + Internals.writeArguments(LONG to point.toLong(), VECTOR2 to pos) + Internals.callMethod(rawPtr, MethodBindings.setBlendPointPositionPtr, NIL) + } + + /** + * Returns the position of the point at index [point]. + */ + public final fun getBlendPointPosition(point: Int): Vector2 { + Internals.writeArguments(LONG to point.toLong()) + Internals.callMethod(rawPtr, MethodBindings.getBlendPointPositionPtr, VECTOR2) + return (Internals.readReturnValue(VECTOR2) as Vector2) + } + + /** + * Changes the [AnimationNode] referenced by the point at index [point]. + */ + public final fun setBlendPointNode(point: Int, node: AnimationRootNode?): Unit { + Internals.writeArguments(LONG to point.toLong(), OBJECT to node) + Internals.callMethod(rawPtr, MethodBindings.setBlendPointNodePtr, NIL) + } + + /** + * Returns the [AnimationRootNode] referenced by the point at index [point]. + */ + public final fun getBlendPointNode(point: Int): AnimationRootNode? { + Internals.writeArguments(LONG to point.toLong()) + Internals.callMethod(rawPtr, MethodBindings.getBlendPointNodePtr, OBJECT) + return (Internals.readReturnValue(OBJECT) as AnimationRootNode?) + } + + /** + * Removes the point at index [point] from the blend space. + */ + public final fun removeBlendPoint(point: Int): Unit { + Internals.writeArguments(LONG to point.toLong()) + Internals.callMethod(rawPtr, MethodBindings.removeBlendPointPtr, NIL) + } + + /** + * Returns the number of points in the blend space. + */ + public final fun getBlendPointCount(): Int { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getBlendPointCountPtr, LONG) + return (Internals.readReturnValue(LONG) as Long).toInt() + } + + /** + * Creates a new triangle using three points [x], [y], and [z]. Triangles can overlap. You can + * insert the triangle at a specific index using the [atIndex] argument. If you use the default value + * for [atIndex], the point is inserted at the end of the blend points array. + */ + @JvmOverloads + public final fun addTriangle( + x: Int, + y: Int, + z: Int, + atIndex: Int = -1, + ): Unit { + Internals.writeArguments(LONG to x.toLong(), LONG to y.toLong(), LONG to z.toLong(), LONG to atIndex.toLong()) + Internals.callMethod(rawPtr, MethodBindings.addTrianglePtr, NIL) + } + + /** + * Returns the position of the point at index [point] in the triangle of index [triangle]. + */ + public final fun getTrianglePoint(triangle: Int, point: Int): Int { + Internals.writeArguments(LONG to triangle.toLong(), LONG to point.toLong()) + Internals.callMethod(rawPtr, MethodBindings.getTrianglePointPtr, LONG) + return (Internals.readReturnValue(LONG) as Long).toInt() + } + + /** + * Removes the triangle at index [triangle] from the blend space. + */ + public final fun removeTriangle(triangle: Int): Unit { + Internals.writeArguments(LONG to triangle.toLong()) + Internals.callMethod(rawPtr, MethodBindings.removeTrianglePtr, NIL) + } + + /** + * Returns the number of triangles in the blend space. + */ + public final fun getTriangleCount(): Int { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getTriangleCountPtr, LONG) + return (Internals.readReturnValue(LONG) as Long).toInt() + } + + public final fun setMinSpace(minSpace: Vector2): Unit { + Internals.writeArguments(VECTOR2 to minSpace) + Internals.callMethod(rawPtr, MethodBindings.setMinSpacePtr, NIL) + } + + public final fun getMinSpace(): Vector2 { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getMinSpacePtr, VECTOR2) + return (Internals.readReturnValue(VECTOR2) as Vector2) + } + + public final fun setMaxSpace(maxSpace: Vector2): Unit { + Internals.writeArguments(VECTOR2 to maxSpace) + Internals.callMethod(rawPtr, MethodBindings.setMaxSpacePtr, NIL) + } + + public final fun getMaxSpace(): Vector2 { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getMaxSpacePtr, VECTOR2) + return (Internals.readReturnValue(VECTOR2) as Vector2) + } + + public final fun setSnap(snap: Vector2): Unit { + Internals.writeArguments(VECTOR2 to snap) + Internals.callMethod(rawPtr, MethodBindings.setSnapPtr, NIL) + } + + public final fun getSnap(): Vector2 { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getSnapPtr, VECTOR2) + return (Internals.readReturnValue(VECTOR2) as Vector2) + } + + public final fun setXLabel(text: String): Unit { + Internals.writeArguments(STRING to text) + Internals.callMethod(rawPtr, MethodBindings.setXLabelPtr, NIL) + } + + public final fun getXLabel(): String { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getXLabelPtr, STRING) + return (Internals.readReturnValue(STRING) as String) + } + + public final fun setYLabel(text: String): Unit { + Internals.writeArguments(STRING to text) + Internals.callMethod(rawPtr, MethodBindings.setYLabelPtr, NIL) + } + + public final fun getYLabel(): String { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getYLabelPtr, STRING) + return (Internals.readReturnValue(STRING) as String) + } + + public final fun setAutoTriangles(enable: Boolean): Unit { + Internals.writeArguments(BOOL to enable) + Internals.callMethod(rawPtr, MethodBindings.setAutoTrianglesPtr, NIL) + } + + public final fun getAutoTriangles(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getAutoTrianglesPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public final fun setBlendMode(mode: BlendMode): Unit { + Internals.writeArguments(LONG to mode.id) + Internals.callMethod(rawPtr, MethodBindings.setBlendModePtr, NIL) + } + + public final fun getBlendMode(): BlendMode { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getBlendModePtr, LONG) + return AnimationNodeBlendSpace2D.BlendMode.from(Internals.readReturnValue(LONG) as Long) + } + + public final fun setUseSync(enable: Boolean): Unit { + Internals.writeArguments(BOOL to enable) + Internals.callMethod(rawPtr, MethodBindings.setUseSyncPtr, NIL) + } + + public final fun isUsingSync(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isUsingSyncPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public enum class BlendMode( + id: Long, + ) { + /** + * The interpolation between animations is linear. + */ + BLEND_MODE_INTERPOLATED(0), + /** + * The blend space plays the animation of the animation node which blending position is closest + * to. Useful for frame-by-frame 2D animations. + */ + BLEND_MODE_DISCRETE(1), + /** + * Similar to [BLEND_MODE_DISCRETE], but starts the new animation at the last animation's + * playback position. + */ + BLEND_MODE_DISCRETE_CARRY(2), + ; + + public val id: Long + init { + this.id = id + } + + public companion object { + public fun from(`value`: Long): BlendMode = entries.single { it.id == `value` } + } + } + + public companion object + + public object MethodBindings { + internal val addBlendPointPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeBlendSpace2D", "add_blend_point", 402261981) + + internal val setBlendPointPositionPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeBlendSpace2D", "set_blend_point_position", 163021252) + + internal val getBlendPointPositionPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeBlendSpace2D", "get_blend_point_position", 2299179447) + + internal val setBlendPointNodePtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeBlendSpace2D", "set_blend_point_node", 4240341528) + + internal val getBlendPointNodePtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeBlendSpace2D", "get_blend_point_node", 665599029) + + internal val removeBlendPointPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeBlendSpace2D", "remove_blend_point", 1286410249) + + internal val getBlendPointCountPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeBlendSpace2D", "get_blend_point_count", 3905245786) + + internal val addTrianglePtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeBlendSpace2D", "add_triangle", 753017335) + + internal val getTrianglePointPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeBlendSpace2D", "get_triangle_point", 50157827) + + internal val removeTrianglePtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeBlendSpace2D", "remove_triangle", 1286410249) + + internal val getTriangleCountPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeBlendSpace2D", "get_triangle_count", 3905245786) + + internal val setMinSpacePtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeBlendSpace2D", "set_min_space", 743155724) + + internal val getMinSpacePtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeBlendSpace2D", "get_min_space", 3341600327) + + internal val setMaxSpacePtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeBlendSpace2D", "set_max_space", 743155724) + + internal val getMaxSpacePtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeBlendSpace2D", "get_max_space", 3341600327) + + internal val setSnapPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeBlendSpace2D", "set_snap", 743155724) + + internal val getSnapPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeBlendSpace2D", "get_snap", 3341600327) + + internal val setXLabelPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeBlendSpace2D", "set_x_label", 83702148) + + internal val getXLabelPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeBlendSpace2D", "get_x_label", 201670096) + + internal val setYLabelPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeBlendSpace2D", "set_y_label", 83702148) + + internal val getYLabelPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeBlendSpace2D", "get_y_label", 201670096) + + internal val setAutoTrianglesPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeBlendSpace2D", "set_auto_triangles", 2586408642) + + internal val getAutoTrianglesPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeBlendSpace2D", "get_auto_triangles", 36873697) + + internal val setBlendModePtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeBlendSpace2D", "set_blend_mode", 81193520) + + internal val getBlendModePtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeBlendSpace2D", "get_blend_mode", 1398433632) + + internal val setUseSyncPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeBlendSpace2D", "set_use_sync", 2586408642) + + internal val isUsingSyncPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeBlendSpace2D", "is_using_sync", 36873697) + } +} diff --git a/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AnimationNodeBlendTree.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AnimationNodeBlendTree.kt new file mode 100644 index 0000000000..78ab5b293c --- /dev/null +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AnimationNodeBlendTree.kt @@ -0,0 +1,249 @@ +// THIS FILE IS GENERATED! DO NOT EDIT IT MANUALLY! +@file:Suppress("PackageDirectoryMismatch", "unused", "FunctionName", "RedundantModalityModifier", + "UNCHECKED_CAST", "JoinDeclarationAndAssignment", "USELESS_CAST", + "RemoveRedundantQualifierName", "NOTHING_TO_INLINE", "NON_FINAL_MEMBER_IN_OBJECT", + "RedundantVisibilityModifier", "RedundantUnitReturnType", "MemberVisibilityCanBePrivate") + +package godot + +import godot.`annotation`.CoreTypeHelper +import godot.`annotation`.CoreTypeLocalCopy +import godot.`annotation`.GodotBaseType +import godot.core.Signal1 +import godot.core.StringName +import godot.core.VariantParser.BOOL +import godot.core.VariantParser.LONG +import godot.core.VariantParser.NIL +import godot.core.VariantParser.OBJECT +import godot.core.VariantParser.STRING_NAME +import godot.core.VariantParser.VECTOR2 +import godot.core.Vector2 +import godot.util.Internals +import godot.util.VoidPtr +import kotlin.Boolean +import kotlin.Int +import kotlin.Long +import kotlin.Suppress +import kotlin.Unit +import kotlin.jvm.JvmName +import kotlin.jvm.JvmOverloads + +private const val ENGINE_CLASS_ANIMATIONNODEBLENDTREE_INDEX: Int = 59 + +/** + * This animation node may contain a sub-tree of any other type animation nodes, such as + * [AnimationNodeTransition], [AnimationNodeBlend2], [AnimationNodeBlend3], [AnimationNodeOneShot], + * etc. This is one of the most commonly used animation node roots. + * An [AnimationNodeOutput] node named `output` is created by default. + */ +@GodotBaseType +public open class AnimationNodeBlendTree : AnimationRootNode() { + /** + * Emitted when the input port information is changed. + */ + public val nodeChanged: Signal1 by Signal1 + + /** + * The global offset of all sub animation nodes. + */ + @CoreTypeLocalCopy + public final inline var graphOffset: Vector2 + @JvmName("graphOffsetProperty") + get() = getGraphOffset() + @JvmName("graphOffsetProperty") + set(`value`) { + setGraphOffset(value) + } + + public override fun new(scriptIndex: Int): Unit { + Internals.callConstructor(this, ENGINE_CLASS_ANIMATIONNODEBLENDTREE_INDEX, scriptIndex) + } + + /** + * The global offset of all sub animation nodes. + * + * This is a helper function to make dealing with local copies easier. + * + * For more information, see our + * [documentation](https://godot-kotl.in/en/stable/user-guide/api-differences/#core-types). + * + * Allow to directly modify the local copy of the property and assign it back to the Object. + * + * Prefer that over writing: + * `````` + * val myCoreType = animationnodeblendtree.graphOffset + * //Your changes + * animationnodeblendtree.graphOffset = myCoreType + * `````` + */ + @CoreTypeHelper + public final fun graphOffsetMutate(block: Vector2.() -> Unit): Vector2 = graphOffset.apply{ + block(this) + graphOffset = this + } + + + /** + * Adds an [AnimationNode] at the given [position]. The [name] is used to identify the created sub + * animation node later. + */ + @JvmOverloads + public final fun addNode( + name: StringName, + node: AnimationNode?, + position: Vector2 = Vector2(0, 0), + ): Unit { + Internals.writeArguments(STRING_NAME to name, OBJECT to node, VECTOR2 to position) + Internals.callMethod(rawPtr, MethodBindings.addNodePtr, NIL) + } + + /** + * Returns the sub animation node with the specified [name]. + */ + public final fun getNode(name: StringName): AnimationNode? { + Internals.writeArguments(STRING_NAME to name) + Internals.callMethod(rawPtr, MethodBindings.getNodePtr, OBJECT) + return (Internals.readReturnValue(OBJECT) as AnimationNode?) + } + + /** + * Removes a sub animation node. + */ + public final fun removeNode(name: StringName): Unit { + Internals.writeArguments(STRING_NAME to name) + Internals.callMethod(rawPtr, MethodBindings.removeNodePtr, NIL) + } + + /** + * Changes the name of a sub animation node. + */ + public final fun renameNode(name: StringName, newName: StringName): Unit { + Internals.writeArguments(STRING_NAME to name, STRING_NAME to newName) + Internals.callMethod(rawPtr, MethodBindings.renameNodePtr, NIL) + } + + /** + * Returns `true` if a sub animation node with specified [name] exists. + */ + public final fun hasNode(name: StringName): Boolean { + Internals.writeArguments(STRING_NAME to name) + Internals.callMethod(rawPtr, MethodBindings.hasNodePtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + /** + * Connects the output of an [AnimationNode] as input for another [AnimationNode], at the input + * port specified by [inputIndex]. + */ + public final fun connectNode( + inputNode: StringName, + inputIndex: Int, + outputNode: StringName, + ): Unit { + Internals.writeArguments(STRING_NAME to inputNode, LONG to inputIndex.toLong(), STRING_NAME to outputNode) + Internals.callMethod(rawPtr, MethodBindings.connectNodePtr, NIL) + } + + /** + * Disconnects the animation node connected to the specified input. + */ + public final fun disconnectNode(inputNode: StringName, inputIndex: Int): Unit { + Internals.writeArguments(STRING_NAME to inputNode, LONG to inputIndex.toLong()) + Internals.callMethod(rawPtr, MethodBindings.disconnectNodePtr, NIL) + } + + /** + * Modifies the position of a sub animation node. + */ + public final fun setNodePosition(name: StringName, position: Vector2): Unit { + Internals.writeArguments(STRING_NAME to name, VECTOR2 to position) + Internals.callMethod(rawPtr, MethodBindings.setNodePositionPtr, NIL) + } + + /** + * Returns the position of the sub animation node with the specified [name]. + */ + public final fun getNodePosition(name: StringName): Vector2 { + Internals.writeArguments(STRING_NAME to name) + Internals.callMethod(rawPtr, MethodBindings.getNodePositionPtr, VECTOR2) + return (Internals.readReturnValue(VECTOR2) as Vector2) + } + + public final fun setGraphOffset(offset: Vector2): Unit { + Internals.writeArguments(VECTOR2 to offset) + Internals.callMethod(rawPtr, MethodBindings.setGraphOffsetPtr, NIL) + } + + public final fun getGraphOffset(): Vector2 { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getGraphOffsetPtr, VECTOR2) + return (Internals.readReturnValue(VECTOR2) as Vector2) + } + + public companion object { + /** + * The connection was successful. + */ + public final const val CONNECTION_OK: Long = 0 + + /** + * The input node is `null`. + */ + public final const val CONNECTION_ERROR_NO_INPUT: Long = 1 + + /** + * The specified input port is out of range. + */ + public final const val CONNECTION_ERROR_NO_INPUT_INDEX: Long = 2 + + /** + * The output node is `null`. + */ + public final const val CONNECTION_ERROR_NO_OUTPUT: Long = 3 + + /** + * Input and output nodes are the same. + */ + public final const val CONNECTION_ERROR_SAME_NODE: Long = 4 + + /** + * The specified connection already exists. + */ + public final const val CONNECTION_ERROR_CONNECTION_EXISTS: Long = 5 + } + + public object MethodBindings { + internal val addNodePtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeBlendTree", "add_node", 1980270704) + + internal val getNodePtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeBlendTree", "get_node", 625644256) + + internal val removeNodePtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeBlendTree", "remove_node", 3304788590) + + internal val renameNodePtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeBlendTree", "rename_node", 3740211285) + + internal val hasNodePtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeBlendTree", "has_node", 2619796661) + + internal val connectNodePtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeBlendTree", "connect_node", 2168001410) + + internal val disconnectNodePtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeBlendTree", "disconnect_node", 2415702435) + + internal val setNodePositionPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeBlendTree", "set_node_position", 1999414630) + + internal val getNodePositionPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeBlendTree", "get_node_position", 3100822709) + + internal val setGraphOffsetPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeBlendTree", "set_graph_offset", 743155724) + + internal val getGraphOffsetPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeBlendTree", "get_graph_offset", 3341600327) + } +} diff --git a/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AnimationNodeOneShot.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AnimationNodeOneShot.kt new file mode 100644 index 0000000000..df7af6d227 --- /dev/null +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AnimationNodeOneShot.kt @@ -0,0 +1,416 @@ +// THIS FILE IS GENERATED! DO NOT EDIT IT MANUALLY! +@file:Suppress("PackageDirectoryMismatch", "unused", "FunctionName", "RedundantModalityModifier", + "UNCHECKED_CAST", "JoinDeclarationAndAssignment", "USELESS_CAST", + "RemoveRedundantQualifierName", "NOTHING_TO_INLINE", "NON_FINAL_MEMBER_IN_OBJECT", + "RedundantVisibilityModifier", "RedundantUnitReturnType", "MemberVisibilityCanBePrivate") + +package godot + +import godot.`annotation`.GodotBaseType +import godot.core.VariantParser.BOOL +import godot.core.VariantParser.DOUBLE +import godot.core.VariantParser.LONG +import godot.core.VariantParser.NIL +import godot.core.VariantParser.OBJECT +import godot.util.Internals +import godot.util.VoidPtr +import kotlin.Boolean +import kotlin.Double +import kotlin.Int +import kotlin.Long +import kotlin.Suppress +import kotlin.Unit +import kotlin.jvm.JvmName + +private const val ENGINE_CLASS_ANIMATIONNODEONESHOT_INDEX: Int = 60 + +/** + * A resource to add to an [AnimationNodeBlendTree]. This animation node will execute a + * sub-animation and return once it finishes. Blend times for fading in and out can be customized, as + * well as filters. + * After setting the request and changing the animation playback, the one-shot node automatically + * clears the request on the next process frame by setting its `request` value to + * [ONE_SHOT_REQUEST_NONE]. + * + * gdscript: + * ```gdscript + * # Play child animation connected to "shot" port. + * animation_tree.set("parameters/OneShot/request", AnimationNodeOneShot.ONE_SHOT_REQUEST_FIRE) + * # Alternative syntax (same result as above). + * animation_tree["parameters/OneShot/request"] = AnimationNodeOneShot.ONE_SHOT_REQUEST_FIRE + * + * # Abort child animation connected to "shot" port. + * animation_tree.set("parameters/OneShot/request", AnimationNodeOneShot.ONE_SHOT_REQUEST_ABORT) + * # Alternative syntax (same result as above). + * animation_tree["parameters/OneShot/request"] = AnimationNodeOneShot.ONE_SHOT_REQUEST_ABORT + * + * # Abort child animation with fading out connected to "shot" port. + * animation_tree.set("parameters/OneShot/request", AnimationNodeOneShot.ONE_SHOT_REQUEST_FADE_OUT) + * # Alternative syntax (same result as above). + * animation_tree["parameters/OneShot/request"] = AnimationNodeOneShot.ONE_SHOT_REQUEST_FADE_OUT + * + * # Get current state (read-only). + * animation_tree.get("parameters/OneShot/active") + * # Alternative syntax (same result as above). + * animation_tree["parameters/OneShot/active"] + * + * # Get current internal state (read-only). + * animation_tree.get("parameters/OneShot/internal_active") + * # Alternative syntax (same result as above). + * animation_tree["parameters/OneShot/internal_active"] + * ``` + * csharp: + * ```csharp + * // Play child animation connected to "shot" port. + * animationTree.Set("parameters/OneShot/request", (int)AnimationNodeOneShot.OneShotRequest.Fire); + * + * // Abort child animation connected to "shot" port. + * animationTree.Set("parameters/OneShot/request", (int)AnimationNodeOneShot.OneShotRequest.Abort); + * + * // Abort child animation with fading out connected to "shot" port. + * animationTree.Set("parameters/OneShot/request", + * (int)AnimationNodeOneShot.OneShotRequest.FadeOut); + * + * // Get current state (read-only). + * animationTree.Get("parameters/OneShot/active"); + * + * // Get current internal state (read-only). + * animationTree.Get("parameters/OneShot/internal_active"); + * ``` + */ +@GodotBaseType +public open class AnimationNodeOneShot : AnimationNodeSync() { + /** + * The blend type. + */ + public final inline var mixMode: MixMode + @JvmName("mixModeProperty") + get() = getMixMode() + @JvmName("mixModeProperty") + set(`value`) { + setMixMode(value) + } + + /** + * The fade-in duration. For example, setting this to `1.0` for a 5 second length animation will + * produce a cross-fade that starts at 0 second and ends at 1 second during the animation. + * **Note:** [AnimationNodeOneShot] transitions the current state after the end of the fading. + * When [AnimationNodeOutput] is considered as the most upstream, so the [fadeinTime] is scaled + * depending on the downstream delta. For example, if this value is set to `1.0` and a + * [AnimationNodeTimeScale] with a value of `2.0` is chained downstream, the actual processing time + * will be 0.5 second. + */ + public final inline var fadeinTime: Double + @JvmName("fadeinTimeProperty") + get() = getFadeinTime() + @JvmName("fadeinTimeProperty") + set(`value`) { + setFadeinTime(value) + } + + /** + * Determines how cross-fading between animations is eased. If empty, the transition will be + * linear. + */ + public final inline var fadeinCurve: Curve? + @JvmName("fadeinCurveProperty") + get() = getFadeinCurve() + @JvmName("fadeinCurveProperty") + set(`value`) { + setFadeinCurve(value) + } + + /** + * The fade-out duration. For example, setting this to `1.0` for a 5 second length animation will + * produce a cross-fade that starts at 4 second and ends at 5 second during the animation. + * **Note:** [AnimationNodeOneShot] transitions the current state after the end of the fading. + * When [AnimationNodeOutput] is considered as the most upstream, so the [fadeoutTime] is scaled + * depending on the downstream delta. For example, if this value is set to `1.0` and an + * [AnimationNodeTimeScale] with a value of `2.0` is chained downstream, the actual processing time + * will be 0.5 second. + */ + public final inline var fadeoutTime: Double + @JvmName("fadeoutTimeProperty") + get() = getFadeoutTime() + @JvmName("fadeoutTimeProperty") + set(`value`) { + setFadeoutTime(value) + } + + /** + * Determines how cross-fading between animations is eased. If empty, the transition will be + * linear. + */ + public final inline var fadeoutCurve: Curve? + @JvmName("fadeoutCurveProperty") + get() = getFadeoutCurve() + @JvmName("fadeoutCurveProperty") + set(`value`) { + setFadeoutCurve(value) + } + + /** + * If `true`, breaks the loop at the end of the loop cycle for transition, even if the animation + * is looping. + */ + public final inline var breakLoopAtEnd: Boolean + @JvmName("breakLoopAtEndProperty") + get() = isLoopBrokenAtEnd() + @JvmName("breakLoopAtEndProperty") + set(`value`) { + setBreakLoopAtEnd(value) + } + + /** + * If `true`, the sub-animation will restart automatically after finishing. + * In other words, to start auto restarting, the animation must be played once with the + * [ONE_SHOT_REQUEST_FIRE] request. The [ONE_SHOT_REQUEST_ABORT] request stops the auto restarting, + * but it does not disable the [autorestart] itself. So, the [ONE_SHOT_REQUEST_FIRE] request will + * start auto restarting again. + */ + public final inline var autorestart: Boolean + @JvmName("autorestartProperty") + get() = hasAutorestart() + @JvmName("autorestartProperty") + set(`value`) { + setAutorestart(value) + } + + /** + * The delay after which the automatic restart is triggered, in seconds. + */ + public final inline var autorestartDelay: Double + @JvmName("autorestartDelayProperty") + get() = getAutorestartDelay() + @JvmName("autorestartDelayProperty") + set(`value`) { + setAutorestartDelay(value) + } + + /** + * If [autorestart] is `true`, a random additional delay (in seconds) between 0 and this value + * will be added to [autorestartDelay]. + */ + public final inline var autorestartRandomDelay: Double + @JvmName("autorestartRandomDelayProperty") + get() = getAutorestartRandomDelay() + @JvmName("autorestartRandomDelayProperty") + set(`value`) { + setAutorestartRandomDelay(value) + } + + public override fun new(scriptIndex: Int): Unit { + Internals.callConstructor(this, ENGINE_CLASS_ANIMATIONNODEONESHOT_INDEX, scriptIndex) + } + + public final fun setFadeinTime(time: Double): Unit { + Internals.writeArguments(DOUBLE to time) + Internals.callMethod(rawPtr, MethodBindings.setFadeinTimePtr, NIL) + } + + public final fun getFadeinTime(): Double { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getFadeinTimePtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double) + } + + public final fun setFadeinCurve(curve: Curve?): Unit { + Internals.writeArguments(OBJECT to curve) + Internals.callMethod(rawPtr, MethodBindings.setFadeinCurvePtr, NIL) + } + + public final fun getFadeinCurve(): Curve? { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getFadeinCurvePtr, OBJECT) + return (Internals.readReturnValue(OBJECT) as Curve?) + } + + public final fun setFadeoutTime(time: Double): Unit { + Internals.writeArguments(DOUBLE to time) + Internals.callMethod(rawPtr, MethodBindings.setFadeoutTimePtr, NIL) + } + + public final fun getFadeoutTime(): Double { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getFadeoutTimePtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double) + } + + public final fun setFadeoutCurve(curve: Curve?): Unit { + Internals.writeArguments(OBJECT to curve) + Internals.callMethod(rawPtr, MethodBindings.setFadeoutCurvePtr, NIL) + } + + public final fun getFadeoutCurve(): Curve? { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getFadeoutCurvePtr, OBJECT) + return (Internals.readReturnValue(OBJECT) as Curve?) + } + + public final fun setBreakLoopAtEnd(enable: Boolean): Unit { + Internals.writeArguments(BOOL to enable) + Internals.callMethod(rawPtr, MethodBindings.setBreakLoopAtEndPtr, NIL) + } + + public final fun isLoopBrokenAtEnd(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isLoopBrokenAtEndPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public final fun setAutorestart(active: Boolean): Unit { + Internals.writeArguments(BOOL to active) + Internals.callMethod(rawPtr, MethodBindings.setAutorestartPtr, NIL) + } + + public final fun hasAutorestart(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.hasAutorestartPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public final fun setAutorestartDelay(time: Double): Unit { + Internals.writeArguments(DOUBLE to time) + Internals.callMethod(rawPtr, MethodBindings.setAutorestartDelayPtr, NIL) + } + + public final fun getAutorestartDelay(): Double { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getAutorestartDelayPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double) + } + + public final fun setAutorestartRandomDelay(time: Double): Unit { + Internals.writeArguments(DOUBLE to time) + Internals.callMethod(rawPtr, MethodBindings.setAutorestartRandomDelayPtr, NIL) + } + + public final fun getAutorestartRandomDelay(): Double { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getAutorestartRandomDelayPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double) + } + + public final fun setMixMode(mode: MixMode): Unit { + Internals.writeArguments(LONG to mode.id) + Internals.callMethod(rawPtr, MethodBindings.setMixModePtr, NIL) + } + + public final fun getMixMode(): MixMode { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getMixModePtr, LONG) + return AnimationNodeOneShot.MixMode.from(Internals.readReturnValue(LONG) as Long) + } + + public enum class OneShotRequest( + id: Long, + ) { + /** + * The default state of the request. Nothing is done. + */ + ONE_SHOT_REQUEST_NONE(0), + /** + * The request to play the animation connected to "shot" port. + */ + ONE_SHOT_REQUEST_FIRE(1), + /** + * The request to stop the animation connected to "shot" port. + */ + ONE_SHOT_REQUEST_ABORT(2), + /** + * The request to fade out the animation connected to "shot" port. + */ + ONE_SHOT_REQUEST_FADE_OUT(3), + ; + + public val id: Long + init { + this.id = id + } + + public companion object { + public fun from(`value`: Long): OneShotRequest = entries.single { it.id == `value` } + } + } + + public enum class MixMode( + id: Long, + ) { + /** + * Blends two animations. See also [AnimationNodeBlend2]. + */ + MIX_MODE_BLEND(0), + /** + * Blends two animations additively. See also [AnimationNodeAdd2]. + */ + MIX_MODE_ADD(1), + ; + + public val id: Long + init { + this.id = id + } + + public companion object { + public fun from(`value`: Long): MixMode = entries.single { it.id == `value` } + } + } + + public companion object + + public object MethodBindings { + internal val setFadeinTimePtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeOneShot", "set_fadein_time", 373806689) + + internal val getFadeinTimePtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeOneShot", "get_fadein_time", 1740695150) + + internal val setFadeinCurvePtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeOneShot", "set_fadein_curve", 270443179) + + internal val getFadeinCurvePtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeOneShot", "get_fadein_curve", 2460114913) + + internal val setFadeoutTimePtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeOneShot", "set_fadeout_time", 373806689) + + internal val getFadeoutTimePtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeOneShot", "get_fadeout_time", 1740695150) + + internal val setFadeoutCurvePtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeOneShot", "set_fadeout_curve", 270443179) + + internal val getFadeoutCurvePtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeOneShot", "get_fadeout_curve", 2460114913) + + internal val setBreakLoopAtEndPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeOneShot", "set_break_loop_at_end", 2586408642) + + internal val isLoopBrokenAtEndPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeOneShot", "is_loop_broken_at_end", 36873697) + + internal val setAutorestartPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeOneShot", "set_autorestart", 2586408642) + + internal val hasAutorestartPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeOneShot", "has_autorestart", 36873697) + + internal val setAutorestartDelayPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeOneShot", "set_autorestart_delay", 373806689) + + internal val getAutorestartDelayPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeOneShot", "get_autorestart_delay", 1740695150) + + internal val setAutorestartRandomDelayPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeOneShot", "set_autorestart_random_delay", 373806689) + + internal val getAutorestartRandomDelayPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeOneShot", "get_autorestart_random_delay", 1740695150) + + internal val setMixModePtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeOneShot", "set_mix_mode", 1018899799) + + internal val getMixModePtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeOneShot", "get_mix_mode", 3076550526) + } +} diff --git a/kt/godot-library/src/main/kotlin/godot/gen/godot/AnimationNodeOutput.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AnimationNodeOutput.kt similarity index 78% rename from kt/godot-library/src/main/kotlin/godot/gen/godot/AnimationNodeOutput.kt rename to kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AnimationNodeOutput.kt index 1371941550..b74b47bf5e 100644 --- a/kt/godot-library/src/main/kotlin/godot/gen/godot/AnimationNodeOutput.kt +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AnimationNodeOutput.kt @@ -7,20 +7,23 @@ package godot import godot.`annotation`.GodotBaseType +import godot.util.Internals import kotlin.Int import kotlin.Suppress import kotlin.Unit +private const val ENGINE_CLASS_ANIMATIONNODEOUTPUT_INDEX: Int = 61 + /** * A node created automatically in an [AnimationNodeBlendTree] that outputs the final animation. */ @GodotBaseType public open class AnimationNodeOutput : AnimationNode() { public override fun new(scriptIndex: Int): Unit { - callConstructor(ENGINECLASS_ANIMATIONNODEOUTPUT, scriptIndex) + Internals.callConstructor(this, ENGINE_CLASS_ANIMATIONNODEOUTPUT_INDEX, scriptIndex) } public companion object - internal object MethodBindings + public object MethodBindings } diff --git a/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AnimationNodeStateMachine.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AnimationNodeStateMachine.kt new file mode 100644 index 0000000000..16aef9bf76 --- /dev/null +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AnimationNodeStateMachine.kt @@ -0,0 +1,408 @@ +// THIS FILE IS GENERATED! DO NOT EDIT IT MANUALLY! +@file:Suppress("PackageDirectoryMismatch", "unused", "FunctionName", "RedundantModalityModifier", + "UNCHECKED_CAST", "JoinDeclarationAndAssignment", "USELESS_CAST", + "RemoveRedundantQualifierName", "NOTHING_TO_INLINE", "NON_FINAL_MEMBER_IN_OBJECT", + "RedundantVisibilityModifier", "RedundantUnitReturnType", "MemberVisibilityCanBePrivate") + +package godot + +import godot.`annotation`.GodotBaseType +import godot.core.StringName +import godot.core.VariantParser.BOOL +import godot.core.VariantParser.LONG +import godot.core.VariantParser.NIL +import godot.core.VariantParser.OBJECT +import godot.core.VariantParser.STRING_NAME +import godot.core.VariantParser.VECTOR2 +import godot.core.Vector2 +import godot.util.Internals +import godot.util.VoidPtr +import kotlin.Boolean +import kotlin.Int +import kotlin.Long +import kotlin.Suppress +import kotlin.Unit +import kotlin.jvm.JvmName +import kotlin.jvm.JvmOverloads + +private const val ENGINE_CLASS_ANIMATIONNODESTATEMACHINE_INDEX: Int = 62 + +/** + * Contains multiple [AnimationRootNode]s representing animation states, connected in a graph. State + * transitions can be configured to happen automatically or via code, using a shortest-path algorithm. + * Retrieve the [AnimationNodeStateMachinePlayback] object from the [AnimationTree] node to control it + * programmatically. + * **Example:** + * + * gdscript: + * ```gdscript + * var state_machine = $AnimationTree.get("parameters/playback") + * state_machine.travel("some_state") + * ``` + * csharp: + * ```csharp + * var stateMachine = GetNode("AnimationTree").Get("parameters/playback") as + * AnimationNodeStateMachinePlayback; + * stateMachine.Travel("some_state"); + * ``` + */ +@GodotBaseType +public open class AnimationNodeStateMachine : AnimationRootNode() { + /** + * This property can define the process of transitions for different use cases. See also + * [AnimationNodeStateMachine.StateMachineType]. + */ + public final inline var stateMachineType: StateMachineType + @JvmName("stateMachineTypeProperty") + get() = getStateMachineType() + @JvmName("stateMachineTypeProperty") + set(`value`) { + setStateMachineType(value) + } + + /** + * If `true`, allows teleport to the self state with [AnimationNodeStateMachinePlayback.travel]. + * When the reset option is enabled in [AnimationNodeStateMachinePlayback.travel], the animation is + * restarted. If `false`, nothing happens on the teleportation to the self state. + */ + public final inline var allowTransitionToSelf: Boolean + @JvmName("allowTransitionToSelfProperty") + get() = isAllowTransitionToSelf() + @JvmName("allowTransitionToSelfProperty") + set(`value`) { + setAllowTransitionToSelf(value) + } + + /** + * If `true`, treat the cross-fade to the start and end nodes as a blend with the RESET animation. + * In most cases, when additional cross-fades are performed in the parent [AnimationNode] of the + * state machine, setting this property to `false` and matching the cross-fade time of the parent + * [AnimationNode] and the state machine's start node and end node gives good results. + */ + public final inline var resetEnds: Boolean + @JvmName("resetEndsProperty") + get() = areEndsReset() + @JvmName("resetEndsProperty") + set(`value`) { + setResetEnds(value) + } + + public override fun new(scriptIndex: Int): Unit { + Internals.callConstructor(this, ENGINE_CLASS_ANIMATIONNODESTATEMACHINE_INDEX, scriptIndex) + } + + /** + * Adds a new animation node to the graph. The [position] is used for display in the editor. + */ + @JvmOverloads + public final fun addNode( + name: StringName, + node: AnimationNode?, + position: Vector2 = Vector2(0, 0), + ): Unit { + Internals.writeArguments(STRING_NAME to name, OBJECT to node, VECTOR2 to position) + Internals.callMethod(rawPtr, MethodBindings.addNodePtr, NIL) + } + + /** + * Replaces the given animation node with a new animation node. + */ + public final fun replaceNode(name: StringName, node: AnimationNode?): Unit { + Internals.writeArguments(STRING_NAME to name, OBJECT to node) + Internals.callMethod(rawPtr, MethodBindings.replaceNodePtr, NIL) + } + + /** + * Returns the animation node with the given name. + */ + public final fun getNode(name: StringName): AnimationNode? { + Internals.writeArguments(STRING_NAME to name) + Internals.callMethod(rawPtr, MethodBindings.getNodePtr, OBJECT) + return (Internals.readReturnValue(OBJECT) as AnimationNode?) + } + + /** + * Deletes the given animation node from the graph. + */ + public final fun removeNode(name: StringName): Unit { + Internals.writeArguments(STRING_NAME to name) + Internals.callMethod(rawPtr, MethodBindings.removeNodePtr, NIL) + } + + /** + * Renames the given animation node. + */ + public final fun renameNode(name: StringName, newName: StringName): Unit { + Internals.writeArguments(STRING_NAME to name, STRING_NAME to newName) + Internals.callMethod(rawPtr, MethodBindings.renameNodePtr, NIL) + } + + /** + * Returns `true` if the graph contains the given animation node. + */ + public final fun hasNode(name: StringName): Boolean { + Internals.writeArguments(STRING_NAME to name) + Internals.callMethod(rawPtr, MethodBindings.hasNodePtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + /** + * Returns the given animation node's name. + */ + public final fun getNodeName(node: AnimationNode?): StringName { + Internals.writeArguments(OBJECT to node) + Internals.callMethod(rawPtr, MethodBindings.getNodeNamePtr, STRING_NAME) + return (Internals.readReturnValue(STRING_NAME) as StringName) + } + + /** + * Sets the animation node's coordinates. Used for display in the editor. + */ + public final fun setNodePosition(name: StringName, position: Vector2): Unit { + Internals.writeArguments(STRING_NAME to name, VECTOR2 to position) + Internals.callMethod(rawPtr, MethodBindings.setNodePositionPtr, NIL) + } + + /** + * Returns the given animation node's coordinates. Used for display in the editor. + */ + public final fun getNodePosition(name: StringName): Vector2 { + Internals.writeArguments(STRING_NAME to name) + Internals.callMethod(rawPtr, MethodBindings.getNodePositionPtr, VECTOR2) + return (Internals.readReturnValue(VECTOR2) as Vector2) + } + + /** + * Returns `true` if there is a transition between the given animation nodes. + */ + public final fun hasTransition(from: StringName, to: StringName): Boolean { + Internals.writeArguments(STRING_NAME to from, STRING_NAME to to) + Internals.callMethod(rawPtr, MethodBindings.hasTransitionPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + /** + * Adds a transition between the given animation nodes. + */ + public final fun addTransition( + from: StringName, + to: StringName, + transition: AnimationNodeStateMachineTransition?, + ): Unit { + Internals.writeArguments(STRING_NAME to from, STRING_NAME to to, OBJECT to transition) + Internals.callMethod(rawPtr, MethodBindings.addTransitionPtr, NIL) + } + + /** + * Returns the given transition. + */ + public final fun getTransition(idx: Int): AnimationNodeStateMachineTransition? { + Internals.writeArguments(LONG to idx.toLong()) + Internals.callMethod(rawPtr, MethodBindings.getTransitionPtr, OBJECT) + return (Internals.readReturnValue(OBJECT) as AnimationNodeStateMachineTransition?) + } + + /** + * Returns the given transition's start node. + */ + public final fun getTransitionFrom(idx: Int): StringName { + Internals.writeArguments(LONG to idx.toLong()) + Internals.callMethod(rawPtr, MethodBindings.getTransitionFromPtr, STRING_NAME) + return (Internals.readReturnValue(STRING_NAME) as StringName) + } + + /** + * Returns the given transition's end node. + */ + public final fun getTransitionTo(idx: Int): StringName { + Internals.writeArguments(LONG to idx.toLong()) + Internals.callMethod(rawPtr, MethodBindings.getTransitionToPtr, STRING_NAME) + return (Internals.readReturnValue(STRING_NAME) as StringName) + } + + /** + * Returns the number of connections in the graph. + */ + public final fun getTransitionCount(): Int { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getTransitionCountPtr, LONG) + return (Internals.readReturnValue(LONG) as Long).toInt() + } + + /** + * Deletes the given transition by index. + */ + public final fun removeTransitionByIndex(idx: Int): Unit { + Internals.writeArguments(LONG to idx.toLong()) + Internals.callMethod(rawPtr, MethodBindings.removeTransitionByIndexPtr, NIL) + } + + /** + * Deletes the transition between the two specified animation nodes. + */ + public final fun removeTransition(from: StringName, to: StringName): Unit { + Internals.writeArguments(STRING_NAME to from, STRING_NAME to to) + Internals.callMethod(rawPtr, MethodBindings.removeTransitionPtr, NIL) + } + + /** + * Sets the draw offset of the graph. Used for display in the editor. + */ + public final fun setGraphOffset(offset: Vector2): Unit { + Internals.writeArguments(VECTOR2 to offset) + Internals.callMethod(rawPtr, MethodBindings.setGraphOffsetPtr, NIL) + } + + /** + * Returns the draw offset of the graph. Used for display in the editor. + */ + public final fun getGraphOffset(): Vector2 { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getGraphOffsetPtr, VECTOR2) + return (Internals.readReturnValue(VECTOR2) as Vector2) + } + + public final fun setStateMachineType(stateMachineType: StateMachineType): Unit { + Internals.writeArguments(LONG to stateMachineType.id) + Internals.callMethod(rawPtr, MethodBindings.setStateMachineTypePtr, NIL) + } + + public final fun getStateMachineType(): StateMachineType { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getStateMachineTypePtr, LONG) + return AnimationNodeStateMachine.StateMachineType.from(Internals.readReturnValue(LONG) as Long) + } + + public final fun setAllowTransitionToSelf(enable: Boolean): Unit { + Internals.writeArguments(BOOL to enable) + Internals.callMethod(rawPtr, MethodBindings.setAllowTransitionToSelfPtr, NIL) + } + + public final fun isAllowTransitionToSelf(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isAllowTransitionToSelfPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public final fun setResetEnds(enable: Boolean): Unit { + Internals.writeArguments(BOOL to enable) + Internals.callMethod(rawPtr, MethodBindings.setResetEndsPtr, NIL) + } + + public final fun areEndsReset(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.areEndsResetPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public enum class StateMachineType( + id: Long, + ) { + /** + * Seeking to the beginning is treated as playing from the start state. Transition to the end + * state is treated as exiting the state machine. + */ + STATE_MACHINE_TYPE_ROOT(0), + /** + * Seeking to the beginning is treated as seeking to the beginning of the animation in the + * current state. Transition to the end state, or the absence of transitions in each state, is + * treated as exiting the state machine. + */ + STATE_MACHINE_TYPE_NESTED(1), + /** + * This is a grouped state machine that can be controlled from a parent state machine. It does + * not work independently. There must be a state machine with [stateMachineType] of + * [STATE_MACHINE_TYPE_ROOT] or [STATE_MACHINE_TYPE_NESTED] in the parent or ancestor. + */ + STATE_MACHINE_TYPE_GROUPED(2), + ; + + public val id: Long + init { + this.id = id + } + + public companion object { + public fun from(`value`: Long): StateMachineType = entries.single { it.id == `value` } + } + } + + public companion object + + public object MethodBindings { + internal val addNodePtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeStateMachine", "add_node", 1980270704) + + internal val replaceNodePtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeStateMachine", "replace_node", 2559412862) + + internal val getNodePtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeStateMachine", "get_node", 625644256) + + internal val removeNodePtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeStateMachine", "remove_node", 3304788590) + + internal val renameNodePtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeStateMachine", "rename_node", 3740211285) + + internal val hasNodePtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeStateMachine", "has_node", 2619796661) + + internal val getNodeNamePtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeStateMachine", "get_node_name", 739213945) + + internal val setNodePositionPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeStateMachine", "set_node_position", 1999414630) + + internal val getNodePositionPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeStateMachine", "get_node_position", 3100822709) + + internal val hasTransitionPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeStateMachine", "has_transition", 471820014) + + internal val addTransitionPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeStateMachine", "add_transition", 795486887) + + internal val getTransitionPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeStateMachine", "get_transition", 4192381260) + + internal val getTransitionFromPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeStateMachine", "get_transition_from", 659327637) + + internal val getTransitionToPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeStateMachine", "get_transition_to", 659327637) + + internal val getTransitionCountPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeStateMachine", "get_transition_count", 3905245786) + + internal val removeTransitionByIndexPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeStateMachine", "remove_transition_by_index", 1286410249) + + internal val removeTransitionPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeStateMachine", "remove_transition", 3740211285) + + internal val setGraphOffsetPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeStateMachine", "set_graph_offset", 743155724) + + internal val getGraphOffsetPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeStateMachine", "get_graph_offset", 3341600327) + + internal val setStateMachineTypePtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeStateMachine", "set_state_machine_type", 2584759088) + + internal val getStateMachineTypePtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeStateMachine", "get_state_machine_type", 1140726469) + + internal val setAllowTransitionToSelfPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeStateMachine", "set_allow_transition_to_self", 2586408642) + + internal val isAllowTransitionToSelfPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeStateMachine", "is_allow_transition_to_self", 36873697) + + internal val setResetEndsPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeStateMachine", "set_reset_ends", 2586408642) + + internal val areEndsResetPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeStateMachine", "are_ends_reset", 36873697) + } +} diff --git a/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AnimationNodeStateMachinePlayback.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AnimationNodeStateMachinePlayback.kt new file mode 100644 index 0000000000..97fe81f98b --- /dev/null +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AnimationNodeStateMachinePlayback.kt @@ -0,0 +1,186 @@ +// THIS FILE IS GENERATED! DO NOT EDIT IT MANUALLY! +@file:Suppress("PackageDirectoryMismatch", "unused", "FunctionName", "RedundantModalityModifier", + "UNCHECKED_CAST", "JoinDeclarationAndAssignment", "USELESS_CAST", + "RemoveRedundantQualifierName", "NOTHING_TO_INLINE", "NON_FINAL_MEMBER_IN_OBJECT", + "RedundantVisibilityModifier", "RedundantUnitReturnType", "MemberVisibilityCanBePrivate") + +package godot + +import godot.`annotation`.GodotBaseType +import godot.core.StringName +import godot.core.VariantArray +import godot.core.VariantParser.ARRAY +import godot.core.VariantParser.BOOL +import godot.core.VariantParser.DOUBLE +import godot.core.VariantParser.NIL +import godot.core.VariantParser.STRING_NAME +import godot.util.Internals +import godot.util.VoidPtr +import kotlin.Boolean +import kotlin.Double +import kotlin.Float +import kotlin.Int +import kotlin.Suppress +import kotlin.Unit +import kotlin.jvm.JvmOverloads + +private const val ENGINE_CLASS_ANIMATIONNODESTATEMACHINEPLAYBACK_INDEX: Int = 63 + +/** + * Allows control of [AnimationTree] state machines created with [AnimationNodeStateMachine]. + * Retrieve with `$AnimationTree.get("parameters/playback")`. + * **Example:** + * + * gdscript: + * ```gdscript + * var state_machine = $AnimationTree.get("parameters/playback") + * state_machine.travel("some_state") + * ``` + * csharp: + * ```csharp + * var stateMachine = + * GetNode("AnimationTree").Get("parameters/playback").As(); + * stateMachine.Travel("some_state"); + * ``` + */ +@GodotBaseType +public open class AnimationNodeStateMachinePlayback : Resource() { + public override fun new(scriptIndex: Int): Unit { + Internals.callConstructor(this, ENGINE_CLASS_ANIMATIONNODESTATEMACHINEPLAYBACK_INDEX, + scriptIndex) + } + + /** + * Transitions from the current state to another one, following the shortest path. + * If the path does not connect from the current state, the animation will play after the state + * teleports. + * If [resetOnTeleport] is `true`, the animation is played from the beginning when the travel + * cause a teleportation. + */ + @JvmOverloads + public final fun travel(toNode: StringName, resetOnTeleport: Boolean = true): Unit { + Internals.writeArguments(STRING_NAME to toNode, BOOL to resetOnTeleport) + Internals.callMethod(rawPtr, MethodBindings.travelPtr, NIL) + } + + /** + * Starts playing the given animation. + * If [reset] is `true`, the animation is played from the beginning. + */ + @JvmOverloads + public final fun start(node: StringName, reset: Boolean = true): Unit { + Internals.writeArguments(STRING_NAME to node, BOOL to reset) + Internals.callMethod(rawPtr, MethodBindings.startPtr, NIL) + } + + /** + * If there is a next path by travel or auto advance, immediately transitions from the current + * state to the next state. + */ + public final fun next(): Unit { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.nextPtr, NIL) + } + + /** + * Stops the currently playing animation. + */ + public final fun stop(): Unit { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.stopPtr, NIL) + } + + /** + * Returns `true` if an animation is playing. + */ + public final fun isPlaying(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isPlayingPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + /** + * Returns the currently playing animation state. + * **Note:** When using a cross-fade, the current state changes to the next state immediately + * after the cross-fade begins. + */ + public final fun getCurrentNode(): StringName { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getCurrentNodePtr, STRING_NAME) + return (Internals.readReturnValue(STRING_NAME) as StringName) + } + + /** + * Returns the playback position within the current animation state. + */ + public final fun getCurrentPlayPosition(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getCurrentPlayPositionPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + /** + * Returns the current state length. + * **Note:** It is possible that any [AnimationRootNode] can be nodes as well as animations. This + * means that there can be multiple animations within a single state. Which animation length has + * priority depends on the nodes connected inside it. Also, if a transition does not reset, the + * remaining length at that point will be returned. + */ + public final fun getCurrentLength(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getCurrentLengthPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + /** + * Returns the starting state of currently fading animation. + */ + public final fun getFadingFromNode(): StringName { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getFadingFromNodePtr, STRING_NAME) + return (Internals.readReturnValue(STRING_NAME) as StringName) + } + + /** + * Returns the current travel path as computed internally by the A* algorithm. + */ + public final fun getTravelPath(): VariantArray { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getTravelPathPtr, ARRAY) + return (Internals.readReturnValue(ARRAY) as VariantArray) + } + + public companion object + + public object MethodBindings { + internal val travelPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeStateMachinePlayback", "travel", 3823612587) + + internal val startPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeStateMachinePlayback", "start", 3823612587) + + internal val nextPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeStateMachinePlayback", "next", 3218959716) + + internal val stopPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeStateMachinePlayback", "stop", 3218959716) + + internal val isPlayingPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeStateMachinePlayback", "is_playing", 36873697) + + internal val getCurrentNodePtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeStateMachinePlayback", "get_current_node", 2002593661) + + internal val getCurrentPlayPositionPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeStateMachinePlayback", "get_current_play_position", 1740695150) + + internal val getCurrentLengthPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeStateMachinePlayback", "get_current_length", 1740695150) + + internal val getFadingFromNodePtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeStateMachinePlayback", "get_fading_from_node", 2002593661) + + internal val getTravelPathPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeStateMachinePlayback", "get_travel_path", 3995934104) + } +} diff --git a/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AnimationNodeStateMachineTransition.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AnimationNodeStateMachineTransition.kt new file mode 100644 index 0000000000..5b4991b4d9 --- /dev/null +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AnimationNodeStateMachineTransition.kt @@ -0,0 +1,387 @@ +// THIS FILE IS GENERATED! DO NOT EDIT IT MANUALLY! +@file:Suppress("PackageDirectoryMismatch", "unused", "FunctionName", "RedundantModalityModifier", + "UNCHECKED_CAST", "JoinDeclarationAndAssignment", "USELESS_CAST", + "RemoveRedundantQualifierName", "NOTHING_TO_INLINE", "NON_FINAL_MEMBER_IN_OBJECT", + "RedundantVisibilityModifier", "RedundantUnitReturnType", "MemberVisibilityCanBePrivate") + +package godot + +import godot.`annotation`.GodotBaseType +import godot.core.Signal0 +import godot.core.StringName +import godot.core.VariantParser.BOOL +import godot.core.VariantParser.DOUBLE +import godot.core.VariantParser.LONG +import godot.core.VariantParser.NIL +import godot.core.VariantParser.OBJECT +import godot.core.VariantParser.STRING +import godot.core.VariantParser.STRING_NAME +import godot.util.Internals +import godot.util.VoidPtr +import kotlin.Boolean +import kotlin.Double +import kotlin.Float +import kotlin.Int +import kotlin.Long +import kotlin.String +import kotlin.Suppress +import kotlin.Unit +import kotlin.jvm.JvmName + +private const val ENGINE_CLASS_ANIMATIONNODESTATEMACHINETRANSITION_INDEX: Int = 64 + +/** + * The path generated when using [AnimationNodeStateMachinePlayback.travel] is limited to the nodes + * connected by [AnimationNodeStateMachineTransition]. + * You can set the timing and conditions of the transition in detail. + */ +@GodotBaseType +public open class AnimationNodeStateMachineTransition : Resource() { + /** + * Emitted when [advanceCondition] is changed. + */ + public val advanceConditionChanged: Signal0 by Signal0 + + /** + * The time to cross-fade between this state and the next. + * **Note:** [AnimationNodeStateMachine] transitions the current state immediately after the start + * of the fading. The precise remaining time can only be inferred from the main animation. When + * [AnimationNodeOutput] is considered as the most upstream, so the [xfadeTime] is not scaled + * depending on the downstream delta. See also [AnimationNodeOneShot.fadeoutTime]. + */ + public final inline var xfadeTime: Float + @JvmName("xfadeTimeProperty") + get() = getXfadeTime() + @JvmName("xfadeTimeProperty") + set(`value`) { + setXfadeTime(value) + } + + /** + * Ease curve for better control over cross-fade between this state and the next. + */ + public final inline var xfadeCurve: Curve? + @JvmName("xfadeCurveProperty") + get() = getXfadeCurve() + @JvmName("xfadeCurveProperty") + set(`value`) { + setXfadeCurve(value) + } + + /** + * If `true`, breaks the loop at the end of the loop cycle for transition, even if the animation + * is looping. + */ + public final inline var breakLoopAtEnd: Boolean + @JvmName("breakLoopAtEndProperty") + get() = isLoopBrokenAtEnd() + @JvmName("breakLoopAtEndProperty") + set(`value`) { + setBreakLoopAtEnd(value) + } + + /** + * If `true`, the destination animation is played back from the beginning when switched. + */ + public final inline var reset: Boolean + @JvmName("resetProperty") + get() = isReset() + @JvmName("resetProperty") + set(`value`) { + setReset(value) + } + + /** + * Lower priority transitions are preferred when travelling through the tree via + * [AnimationNodeStateMachinePlayback.travel] or [advanceMode] is set to [ADVANCE_MODE_AUTO]. + */ + public final inline var priority: Int + @JvmName("priorityProperty") + get() = getPriority() + @JvmName("priorityProperty") + set(`value`) { + setPriority(value) + } + + /** + * The transition type. + */ + public final inline var switchMode: SwitchMode + @JvmName("switchModeProperty") + get() = getSwitchMode() + @JvmName("switchModeProperty") + set(`value`) { + setSwitchMode(value) + } + + /** + * Determines whether the transition should disabled, enabled when using + * [AnimationNodeStateMachinePlayback.travel], or traversed automatically if the [advanceCondition] + * and [advanceExpression] checks are true (if assigned). + */ + public final inline var advanceMode: AdvanceMode + @JvmName("advanceModeProperty") + get() = getAdvanceMode() + @JvmName("advanceModeProperty") + set(`value`) { + setAdvanceMode(value) + } + + /** + * Turn on auto advance when this condition is set. The provided name will become a boolean + * parameter on the [AnimationTree] that can be controlled from code (see + * [url=$DOCS_URL/tutorials/animation/animation_tree.html#controlling-from-code]Using + * AnimationTree[/url]). For example, if [AnimationTree.treeRoot] is an [AnimationNodeStateMachine] + * and [advanceCondition] is set to `"idle"`: + * + * gdscript: + * ```gdscript + * $animation_tree.set("parameters/conditions/idle", is_on_floor and (linear_velocity.x == 0)) + * ``` + * csharp: + * ```csharp + * GetNode("animation_tree").Set("parameters/conditions/idle", IsOnFloor && + * (LinearVelocity.X == 0)); + * ``` + */ + public final inline var advanceCondition: StringName + @JvmName("advanceConditionProperty") + get() = getAdvanceCondition() + @JvmName("advanceConditionProperty") + set(`value`) { + setAdvanceCondition(value) + } + + /** + * Use an expression as a condition for state machine transitions. It is possible to create + * complex animation advance conditions for switching between states and gives much greater + * flexibility for creating complex state machines by directly interfacing with the script code. + */ + public final inline var advanceExpression: String + @JvmName("advanceExpressionProperty") + get() = getAdvanceExpression() + @JvmName("advanceExpressionProperty") + set(`value`) { + setAdvanceExpression(value) + } + + public override fun new(scriptIndex: Int): Unit { + Internals.callConstructor(this, ENGINE_CLASS_ANIMATIONNODESTATEMACHINETRANSITION_INDEX, + scriptIndex) + } + + public final fun setSwitchMode(mode: SwitchMode): Unit { + Internals.writeArguments(LONG to mode.id) + Internals.callMethod(rawPtr, MethodBindings.setSwitchModePtr, NIL) + } + + public final fun getSwitchMode(): SwitchMode { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getSwitchModePtr, LONG) + return AnimationNodeStateMachineTransition.SwitchMode.from(Internals.readReturnValue(LONG) as Long) + } + + public final fun setAdvanceMode(mode: AdvanceMode): Unit { + Internals.writeArguments(LONG to mode.id) + Internals.callMethod(rawPtr, MethodBindings.setAdvanceModePtr, NIL) + } + + public final fun getAdvanceMode(): AdvanceMode { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getAdvanceModePtr, LONG) + return AnimationNodeStateMachineTransition.AdvanceMode.from(Internals.readReturnValue(LONG) as Long) + } + + public final fun setAdvanceCondition(name: StringName): Unit { + Internals.writeArguments(STRING_NAME to name) + Internals.callMethod(rawPtr, MethodBindings.setAdvanceConditionPtr, NIL) + } + + public final fun getAdvanceCondition(): StringName { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getAdvanceConditionPtr, STRING_NAME) + return (Internals.readReturnValue(STRING_NAME) as StringName) + } + + public final fun setXfadeTime(secs: Float): Unit { + Internals.writeArguments(DOUBLE to secs.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setXfadeTimePtr, NIL) + } + + public final fun getXfadeTime(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getXfadeTimePtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setXfadeCurve(curve: Curve?): Unit { + Internals.writeArguments(OBJECT to curve) + Internals.callMethod(rawPtr, MethodBindings.setXfadeCurvePtr, NIL) + } + + public final fun getXfadeCurve(): Curve? { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getXfadeCurvePtr, OBJECT) + return (Internals.readReturnValue(OBJECT) as Curve?) + } + + public final fun setBreakLoopAtEnd(enable: Boolean): Unit { + Internals.writeArguments(BOOL to enable) + Internals.callMethod(rawPtr, MethodBindings.setBreakLoopAtEndPtr, NIL) + } + + public final fun isLoopBrokenAtEnd(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isLoopBrokenAtEndPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public final fun setReset(reset: Boolean): Unit { + Internals.writeArguments(BOOL to reset) + Internals.callMethod(rawPtr, MethodBindings.setResetPtr, NIL) + } + + public final fun isReset(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isResetPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public final fun setPriority(priority: Int): Unit { + Internals.writeArguments(LONG to priority.toLong()) + Internals.callMethod(rawPtr, MethodBindings.setPriorityPtr, NIL) + } + + public final fun getPriority(): Int { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getPriorityPtr, LONG) + return (Internals.readReturnValue(LONG) as Long).toInt() + } + + public final fun setAdvanceExpression(text: String): Unit { + Internals.writeArguments(STRING to text) + Internals.callMethod(rawPtr, MethodBindings.setAdvanceExpressionPtr, NIL) + } + + public final fun getAdvanceExpression(): String { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getAdvanceExpressionPtr, STRING) + return (Internals.readReturnValue(STRING) as String) + } + + public enum class SwitchMode( + id: Long, + ) { + /** + * Switch to the next state immediately. The current state will end and blend into the beginning + * of the new one. + */ + SWITCH_MODE_IMMEDIATE(0), + /** + * Switch to the next state immediately, but will seek the new state to the playback position of + * the old state. + */ + SWITCH_MODE_SYNC(1), + /** + * Wait for the current state playback to end, then switch to the beginning of the next state + * animation. + */ + SWITCH_MODE_AT_END(2), + ; + + public val id: Long + init { + this.id = id + } + + public companion object { + public fun from(`value`: Long): SwitchMode = entries.single { it.id == `value` } + } + } + + public enum class AdvanceMode( + id: Long, + ) { + /** + * Don't use this transition. + */ + ADVANCE_MODE_DISABLED(0), + /** + * Only use this transition during [AnimationNodeStateMachinePlayback.travel]. + */ + ADVANCE_MODE_ENABLED(1), + /** + * Automatically use this transition if the [advanceCondition] and [advanceExpression] checks + * are true (if assigned). + */ + ADVANCE_MODE_AUTO(2), + ; + + public val id: Long + init { + this.id = id + } + + public companion object { + public fun from(`value`: Long): AdvanceMode = entries.single { it.id == `value` } + } + } + + public companion object + + public object MethodBindings { + internal val setSwitchModePtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeStateMachineTransition", "set_switch_mode", 2074906633) + + internal val getSwitchModePtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeStateMachineTransition", "get_switch_mode", 2138562085) + + internal val setAdvanceModePtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeStateMachineTransition", "set_advance_mode", 1210869868) + + internal val getAdvanceModePtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeStateMachineTransition", "get_advance_mode", 61101689) + + internal val setAdvanceConditionPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeStateMachineTransition", "set_advance_condition", 3304788590) + + internal val getAdvanceConditionPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeStateMachineTransition", "get_advance_condition", 2002593661) + + internal val setXfadeTimePtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeStateMachineTransition", "set_xfade_time", 373806689) + + internal val getXfadeTimePtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeStateMachineTransition", "get_xfade_time", 1740695150) + + internal val setXfadeCurvePtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeStateMachineTransition", "set_xfade_curve", 270443179) + + internal val getXfadeCurvePtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeStateMachineTransition", "get_xfade_curve", 2460114913) + + internal val setBreakLoopAtEndPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeStateMachineTransition", "set_break_loop_at_end", 2586408642) + + internal val isLoopBrokenAtEndPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeStateMachineTransition", "is_loop_broken_at_end", 36873697) + + internal val setResetPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeStateMachineTransition", "set_reset", 2586408642) + + internal val isResetPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeStateMachineTransition", "is_reset", 36873697) + + internal val setPriorityPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeStateMachineTransition", "set_priority", 1286410249) + + internal val getPriorityPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeStateMachineTransition", "get_priority", 3905245786) + + internal val setAdvanceExpressionPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeStateMachineTransition", "set_advance_expression", 83702148) + + internal val getAdvanceExpressionPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeStateMachineTransition", "get_advance_expression", 201670096) + } +} diff --git a/kt/godot-library/src/main/kotlin/godot/gen/godot/AnimationNodeSub2.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AnimationNodeSub2.kt similarity index 87% rename from kt/godot-library/src/main/kotlin/godot/gen/godot/AnimationNodeSub2.kt rename to kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AnimationNodeSub2.kt index f31f970cd0..bc20feeccc 100644 --- a/kt/godot-library/src/main/kotlin/godot/gen/godot/AnimationNodeSub2.kt +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AnimationNodeSub2.kt @@ -7,10 +7,13 @@ package godot import godot.`annotation`.GodotBaseType +import godot.util.Internals import kotlin.Int import kotlin.Suppress import kotlin.Unit +private const val ENGINE_CLASS_ANIMATIONNODESUB2_INDEX: Int = 65 + /** * A resource to add to an [AnimationNodeBlendTree]. Blends two animations subtractively based on * the amount value. @@ -26,10 +29,10 @@ import kotlin.Unit @GodotBaseType public open class AnimationNodeSub2 : AnimationNodeSync() { public override fun new(scriptIndex: Int): Unit { - callConstructor(ENGINECLASS_ANIMATIONNODESUB2, scriptIndex) + Internals.callConstructor(this, ENGINE_CLASS_ANIMATIONNODESUB2_INDEX, scriptIndex) } public companion object - internal object MethodBindings + public object MethodBindings } diff --git a/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AnimationNodeSync.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AnimationNodeSync.kt new file mode 100644 index 0000000000..9a3d54fa0f --- /dev/null +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AnimationNodeSync.kt @@ -0,0 +1,64 @@ +// THIS FILE IS GENERATED! DO NOT EDIT IT MANUALLY! +@file:Suppress("PackageDirectoryMismatch", "unused", "FunctionName", "RedundantModalityModifier", + "UNCHECKED_CAST", "JoinDeclarationAndAssignment", "USELESS_CAST", + "RemoveRedundantQualifierName", "NOTHING_TO_INLINE", "NON_FINAL_MEMBER_IN_OBJECT", + "RedundantVisibilityModifier", "RedundantUnitReturnType", "MemberVisibilityCanBePrivate") + +package godot + +import godot.`annotation`.GodotBaseType +import godot.core.VariantParser.BOOL +import godot.core.VariantParser.NIL +import godot.util.Internals +import godot.util.VoidPtr +import kotlin.Boolean +import kotlin.Int +import kotlin.Suppress +import kotlin.Unit +import kotlin.jvm.JvmName + +private const val ENGINE_CLASS_ANIMATIONNODESYNC_INDEX: Int = 66 + +/** + * An animation node used to combine, mix, or blend two or more animations together while keeping + * them synchronized within an [AnimationTree]. + */ +@GodotBaseType +public open class AnimationNodeSync : AnimationNode() { + /** + * If `false`, the blended animations' frame are stopped when the blend value is `0`. + * If `true`, forcing the blended animations to advance frame. + */ + public final inline var sync: Boolean + @JvmName("syncProperty") + get() = isUsingSync() + @JvmName("syncProperty") + set(`value`) { + setUseSync(value) + } + + public override fun new(scriptIndex: Int): Unit { + Internals.callConstructor(this, ENGINE_CLASS_ANIMATIONNODESYNC_INDEX, scriptIndex) + } + + public final fun setUseSync(enable: Boolean): Unit { + Internals.writeArguments(BOOL to enable) + Internals.callMethod(rawPtr, MethodBindings.setUseSyncPtr, NIL) + } + + public final fun isUsingSync(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isUsingSyncPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public companion object + + public object MethodBindings { + internal val setUseSyncPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeSync", "set_use_sync", 2586408642) + + internal val isUsingSyncPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeSync", "is_using_sync", 36873697) + } +} diff --git a/kt/godot-library/src/main/kotlin/godot/gen/godot/AnimationNodeTimeScale.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AnimationNodeTimeScale.kt similarity index 78% rename from kt/godot-library/src/main/kotlin/godot/gen/godot/AnimationNodeTimeScale.kt rename to kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AnimationNodeTimeScale.kt index cfa34b4729..d590327d90 100644 --- a/kt/godot-library/src/main/kotlin/godot/gen/godot/AnimationNodeTimeScale.kt +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AnimationNodeTimeScale.kt @@ -7,10 +7,13 @@ package godot import godot.`annotation`.GodotBaseType +import godot.util.Internals import kotlin.Int import kotlin.Suppress import kotlin.Unit +private const val ENGINE_CLASS_ANIMATIONNODETIMESCALE_INDEX: Int = 67 + /** * Allows to scale the speed of the animation (or reverse it) in any child [AnimationNode]s. Setting * it to `0.0` will pause the animation. @@ -18,10 +21,10 @@ import kotlin.Unit @GodotBaseType public open class AnimationNodeTimeScale : AnimationNode() { public override fun new(scriptIndex: Int): Unit { - callConstructor(ENGINECLASS_ANIMATIONNODETIMESCALE, scriptIndex) + Internals.callConstructor(this, ENGINE_CLASS_ANIMATIONNODETIMESCALE_INDEX, scriptIndex) } public companion object - internal object MethodBindings + public object MethodBindings } diff --git a/kt/godot-library/src/main/kotlin/godot/gen/godot/AnimationNodeTimeSeek.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AnimationNodeTimeSeek.kt similarity index 89% rename from kt/godot-library/src/main/kotlin/godot/gen/godot/AnimationNodeTimeSeek.kt rename to kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AnimationNodeTimeSeek.kt index 17c5b2edb8..3424d11053 100644 --- a/kt/godot-library/src/main/kotlin/godot/gen/godot/AnimationNodeTimeSeek.kt +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AnimationNodeTimeSeek.kt @@ -7,10 +7,13 @@ package godot import godot.`annotation`.GodotBaseType +import godot.util.Internals import kotlin.Int import kotlin.Suppress import kotlin.Unit +private const val ENGINE_CLASS_ANIMATIONNODETIMESEEK_INDEX: Int = 68 + /** * This animation node can be used to cause a seek command to happen to any sub-children of the * animation graph. Use to play an [Animation] from the start or a certain playback position inside the @@ -42,10 +45,10 @@ import kotlin.Unit @GodotBaseType public open class AnimationNodeTimeSeek : AnimationNode() { public override fun new(scriptIndex: Int): Unit { - callConstructor(ENGINECLASS_ANIMATIONNODETIMESEEK, scriptIndex) + Internals.callConstructor(this, ENGINE_CLASS_ANIMATIONNODETIMESEEK_INDEX, scriptIndex) } public companion object - internal object MethodBindings + public object MethodBindings } diff --git a/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AnimationNodeTransition.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AnimationNodeTransition.kt new file mode 100644 index 0000000000..45fde16cdd --- /dev/null +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AnimationNodeTransition.kt @@ -0,0 +1,253 @@ +// THIS FILE IS GENERATED! DO NOT EDIT IT MANUALLY! +@file:Suppress("PackageDirectoryMismatch", "unused", "FunctionName", "RedundantModalityModifier", + "UNCHECKED_CAST", "JoinDeclarationAndAssignment", "USELESS_CAST", + "RemoveRedundantQualifierName", "NOTHING_TO_INLINE", "NON_FINAL_MEMBER_IN_OBJECT", + "RedundantVisibilityModifier", "RedundantUnitReturnType", "MemberVisibilityCanBePrivate") + +package godot + +import godot.`annotation`.GodotBaseType +import godot.core.VariantParser.BOOL +import godot.core.VariantParser.DOUBLE +import godot.core.VariantParser.LONG +import godot.core.VariantParser.NIL +import godot.core.VariantParser.OBJECT +import godot.util.Internals +import godot.util.VoidPtr +import kotlin.Boolean +import kotlin.Double +import kotlin.Int +import kotlin.Suppress +import kotlin.Unit +import kotlin.jvm.JvmName + +private const val ENGINE_CLASS_ANIMATIONNODETRANSITION_INDEX: Int = 69 + +/** + * Simple state machine for cases which don't require a more advanced [AnimationNodeStateMachine]. + * Animations can be connected to the inputs and transition times can be specified. + * After setting the request and changing the animation playback, the transition node automatically + * clears the request on the next process frame by setting its `transition_request` value to empty. + * **Note:** When using a cross-fade, `current_state` and `current_index` change to the next state + * immediately after the cross-fade begins. + * + * gdscript: + * ```gdscript + * # Play child animation connected to "state_2" port. + * animation_tree.set("parameters/Transition/transition_request", "state_2") + * # Alternative syntax (same result as above). + * animation_tree["parameters/Transition/transition_request"] = "state_2" + * + * # Get current state name (read-only). + * animation_tree.get("parameters/Transition/current_state") + * # Alternative syntax (same result as above). + * animation_tree["parameters/Transition/current_state"] + * + * # Get current state index (read-only). + * animation_tree.get("parameters/Transition/current_index") + * # Alternative syntax (same result as above). + * animation_tree["parameters/Transition/current_index"] + * ``` + * csharp: + * ```csharp + * // Play child animation connected to "state_2" port. + * animationTree.Set("parameters/Transition/transition_request", "state_2"); + * + * // Get current state name (read-only). + * animationTree.Get("parameters/Transition/current_state"); + * + * // Get current state index (read-only). + * animationTree.Get("parameters/Transition/current_index"); + * ``` + */ +@GodotBaseType +public open class AnimationNodeTransition : AnimationNodeSync() { + /** + * Cross-fading time (in seconds) between each animation connected to the inputs. + * **Note:** [AnimationNodeTransition] transitions the current state immediately after the start + * of the fading. The precise remaining time can only be inferred from the main animation. When + * [AnimationNodeOutput] is considered as the most upstream, so the [xfadeTime] is not scaled + * depending on the downstream delta. See also [AnimationNodeOneShot.fadeoutTime]. + */ + public final inline var xfadeTime: Double + @JvmName("xfadeTimeProperty") + get() = getXfadeTime() + @JvmName("xfadeTimeProperty") + set(`value`) { + setXfadeTime(value) + } + + /** + * Determines how cross-fading between animations is eased. If empty, the transition will be + * linear. + */ + public final inline var xfadeCurve: Curve? + @JvmName("xfadeCurveProperty") + get() = getXfadeCurve() + @JvmName("xfadeCurveProperty") + set(`value`) { + setXfadeCurve(value) + } + + /** + * If `true`, allows transition to the self state. When the reset option is enabled in input, the + * animation is restarted. If `false`, nothing happens on the transition to the self state. + */ + public final inline var allowTransitionToSelf: Boolean + @JvmName("allowTransitionToSelfProperty") + get() = isAllowTransitionToSelf() + @JvmName("allowTransitionToSelfProperty") + set(`value`) { + setAllowTransitionToSelf(value) + } + + /** + * The number of enabled input ports for this animation node. + */ + public final inline var inputCount: Int + @JvmName("inputCountProperty") + get() = getInputCount() + @JvmName("inputCountProperty") + set(`value`) { + setInputCount(value) + } + + public override fun new(scriptIndex: Int): Unit { + Internals.callConstructor(this, ENGINE_CLASS_ANIMATIONNODETRANSITION_INDEX, scriptIndex) + } + + public final fun setInputCount(inputCount: Int): Unit { + Internals.writeArguments(LONG to inputCount.toLong()) + Internals.callMethod(rawPtr, MethodBindings.setInputCountPtr, NIL) + } + + /** + * Enables or disables auto-advance for the given [input] index. If enabled, state changes to the + * next input after playing the animation once. If enabled for the last input state, it loops to the + * first. + */ + public final fun setInputAsAutoAdvance(input: Int, enable: Boolean): Unit { + Internals.writeArguments(LONG to input.toLong(), BOOL to enable) + Internals.callMethod(rawPtr, MethodBindings.setInputAsAutoAdvancePtr, NIL) + } + + /** + * Returns `true` if auto-advance is enabled for the given [input] index. + */ + public final fun isInputSetAsAutoAdvance(input: Int): Boolean { + Internals.writeArguments(LONG to input.toLong()) + Internals.callMethod(rawPtr, MethodBindings.isInputSetAsAutoAdvancePtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + /** + * If `true`, breaks the loop at the end of the loop cycle for transition, even if the animation + * is looping. + */ + public final fun setInputBreakLoopAtEnd(input: Int, enable: Boolean): Unit { + Internals.writeArguments(LONG to input.toLong(), BOOL to enable) + Internals.callMethod(rawPtr, MethodBindings.setInputBreakLoopAtEndPtr, NIL) + } + + /** + * Returns whether the animation breaks the loop at the end of the loop cycle for transition. + */ + public final fun isInputLoopBrokenAtEnd(input: Int): Boolean { + Internals.writeArguments(LONG to input.toLong()) + Internals.callMethod(rawPtr, MethodBindings.isInputLoopBrokenAtEndPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + /** + * If `true`, the destination animation is restarted when the animation transitions. + */ + public final fun setInputReset(input: Int, enable: Boolean): Unit { + Internals.writeArguments(LONG to input.toLong(), BOOL to enable) + Internals.callMethod(rawPtr, MethodBindings.setInputResetPtr, NIL) + } + + /** + * Returns whether the animation restarts when the animation transitions from the other animation. + */ + public final fun isInputReset(input: Int): Boolean { + Internals.writeArguments(LONG to input.toLong()) + Internals.callMethod(rawPtr, MethodBindings.isInputResetPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public final fun setXfadeTime(time: Double): Unit { + Internals.writeArguments(DOUBLE to time) + Internals.callMethod(rawPtr, MethodBindings.setXfadeTimePtr, NIL) + } + + public final fun getXfadeTime(): Double { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getXfadeTimePtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double) + } + + public final fun setXfadeCurve(curve: Curve?): Unit { + Internals.writeArguments(OBJECT to curve) + Internals.callMethod(rawPtr, MethodBindings.setXfadeCurvePtr, NIL) + } + + public final fun getXfadeCurve(): Curve? { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getXfadeCurvePtr, OBJECT) + return (Internals.readReturnValue(OBJECT) as Curve?) + } + + public final fun setAllowTransitionToSelf(enable: Boolean): Unit { + Internals.writeArguments(BOOL to enable) + Internals.callMethod(rawPtr, MethodBindings.setAllowTransitionToSelfPtr, NIL) + } + + public final fun isAllowTransitionToSelf(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isAllowTransitionToSelfPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public companion object + + public object MethodBindings { + internal val setInputCountPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeTransition", "set_input_count", 1286410249) + + internal val setInputAsAutoAdvancePtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeTransition", "set_input_as_auto_advance", 300928843) + + internal val isInputSetAsAutoAdvancePtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeTransition", "is_input_set_as_auto_advance", 1116898809) + + internal val setInputBreakLoopAtEndPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeTransition", "set_input_break_loop_at_end", 300928843) + + internal val isInputLoopBrokenAtEndPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeTransition", "is_input_loop_broken_at_end", 1116898809) + + internal val setInputResetPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeTransition", "set_input_reset", 300928843) + + internal val isInputResetPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeTransition", "is_input_reset", 1116898809) + + internal val setXfadeTimePtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeTransition", "set_xfade_time", 373806689) + + internal val getXfadeTimePtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeTransition", "get_xfade_time", 1740695150) + + internal val setXfadeCurvePtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeTransition", "set_xfade_curve", 270443179) + + internal val getXfadeCurvePtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeTransition", "get_xfade_curve", 2460114913) + + internal val setAllowTransitionToSelfPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeTransition", "set_allow_transition_to_self", 2586408642) + + internal val isAllowTransitionToSelfPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationNodeTransition", "is_allow_transition_to_self", 36873697) + } +} diff --git a/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AnimationPlayer.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AnimationPlayer.kt new file mode 100644 index 0000000000..57898b7262 --- /dev/null +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AnimationPlayer.kt @@ -0,0 +1,749 @@ +// THIS FILE IS GENERATED! DO NOT EDIT IT MANUALLY! +@file:Suppress("PackageDirectoryMismatch", "unused", "FunctionName", "RedundantModalityModifier", + "UNCHECKED_CAST", "JoinDeclarationAndAssignment", "USELESS_CAST", + "RemoveRedundantQualifierName", "NOTHING_TO_INLINE", "NON_FINAL_MEMBER_IN_OBJECT", + "RedundantVisibilityModifier", "RedundantUnitReturnType", "MemberVisibilityCanBePrivate") + +package godot + +import godot.`annotation`.GodotBaseType +import godot.core.NodePath +import godot.core.PackedStringArray +import godot.core.Signal1 +import godot.core.Signal2 +import godot.core.StringName +import godot.core.VariantParser.BOOL +import godot.core.VariantParser.DOUBLE +import godot.core.VariantParser.LONG +import godot.core.VariantParser.NIL +import godot.core.VariantParser.NODE_PATH +import godot.core.VariantParser.PACKED_STRING_ARRAY +import godot.core.VariantParser.STRING +import godot.core.VariantParser.STRING_NAME +import godot.util.Internals +import godot.util.VoidPtr +import kotlin.Boolean +import kotlin.Double +import kotlin.Float +import kotlin.Int +import kotlin.Long +import kotlin.String +import kotlin.Suppress +import kotlin.Unit +import kotlin.jvm.JvmName +import kotlin.jvm.JvmOverloads + +private const val ENGINE_CLASS_ANIMATIONPLAYER_INDEX: Int = 70 + +/** + * An animation player is used for general-purpose playback of animations. It contains a dictionary + * of [AnimationLibrary] resources and custom blend times between animation transitions. + * Some methods and properties use a single key to reference an animation directly. These keys are + * formatted as the key for the library, followed by a forward slash, then the key for the animation + * within the library, for example `"movement/run"`. If the library's key is an empty string (known as + * the default library), the forward slash is omitted, being the same key used by the library. + * [AnimationPlayer] is better-suited than [Tween] for more complex animations, for example ones + * with non-trivial timings. It can also be used over [Tween] if the animation track editor is more + * convenient than doing it in code. + * Updating the target properties of animations occurs at the process frame. + */ +@GodotBaseType +public open class AnimationPlayer : AnimationMixer() { + /** + * Emitted when [currentAnimation] changes. + */ + public val currentAnimationChanged: Signal1 by Signal1 + + /** + * Emitted when a queued animation plays after the previous animation finished. See also + * [AnimationPlayer.queue]. + * **Note:** The signal is not emitted when the animation is changed via [AnimationPlayer.play] or + * by an [AnimationTree]. + */ + public val animationChanged: Signal2 by Signal2 + + /** + * The key of the currently playing animation. If no animation is playing, the property's value is + * an empty string. Changing this value does not restart the animation. See [play] for more + * information on playing animations. + * **Note:** While this property appears in the Inspector, it's not meant to be edited, and it's + * not saved in the scene. This property is mainly used to get the currently playing animation, and + * internally for animation playback tracks. For more information, see [Animation]. + */ + public final inline var currentAnimation: String + @JvmName("currentAnimationProperty") + get() = getCurrentAnimation() + @JvmName("currentAnimationProperty") + set(`value`) { + setCurrentAnimation(value) + } + + /** + * If playing, the current animation's key, otherwise, the animation last played. When set, this + * changes the animation, but will not play it unless already playing. See also [currentAnimation]. + */ + public final inline var assignedAnimation: String + @JvmName("assignedAnimationProperty") + get() = getAssignedAnimation() + @JvmName("assignedAnimationProperty") + set(`value`) { + setAssignedAnimation(value) + } + + /** + * The key of the animation to play when the scene loads. + */ + public final inline var autoplay: String + @JvmName("autoplayProperty") + get() = getAutoplay() + @JvmName("autoplayProperty") + set(`value`) { + setAutoplay(value) + } + + /** + * The length (in seconds) of the currently playing animation. + */ + public final inline val currentAnimationLength: Double + @JvmName("currentAnimationLengthProperty") + get() = getCurrentAnimationLength() + + /** + * The position (in seconds) of the currently playing animation. + */ + public final inline val currentAnimationPosition: Double + @JvmName("currentAnimationPositionProperty") + get() = getCurrentAnimationPosition() + + /** + * If `true`, performs [AnimationMixer.capture] before playback automatically. This means just + * [playWithCapture] is executed with default arguments instead of [play]. + * **Note:** Capture interpolation is only performed if the animation contains a capture track. + * See also [Animation.UPDATE_CAPTURE]. + */ + public final inline var playbackAutoCapture: Boolean + @JvmName("playbackAutoCaptureProperty") + get() = isAutoCapture() + @JvmName("playbackAutoCaptureProperty") + set(`value`) { + setAutoCapture(value) + } + + /** + * See also [playWithCapture] and [AnimationMixer.capture]. + * If [playbackAutoCaptureDuration] is negative value, the duration is set to the interval between + * the current position and the first key. + */ + public final inline var playbackAutoCaptureDuration: Double + @JvmName("playbackAutoCaptureDurationProperty") + get() = getAutoCaptureDuration() + @JvmName("playbackAutoCaptureDurationProperty") + set(`value`) { + setAutoCaptureDuration(value) + } + + /** + * The transition type of the capture interpolation. See also [Tween.TransitionType]. + */ + public final inline var playbackAutoCaptureTransitionType: Tween.TransitionType + @JvmName("playbackAutoCaptureTransitionTypeProperty") + get() = getAutoCaptureTransitionType() + @JvmName("playbackAutoCaptureTransitionTypeProperty") + set(`value`) { + setAutoCaptureTransitionType(value) + } + + /** + * The ease type of the capture interpolation. See also [Tween.EaseType]. + */ + public final inline var playbackAutoCaptureEaseType: Tween.EaseType + @JvmName("playbackAutoCaptureEaseTypeProperty") + get() = getAutoCaptureEaseType() + @JvmName("playbackAutoCaptureEaseTypeProperty") + set(`value`) { + setAutoCaptureEaseType(value) + } + + /** + * The default time in which to blend animations. Ranges from 0 to 4096 with 0.01 precision. + */ + public final inline var playbackDefaultBlendTime: Double + @JvmName("playbackDefaultBlendTimeProperty") + get() = getDefaultBlendTime() + @JvmName("playbackDefaultBlendTimeProperty") + set(`value`) { + setDefaultBlendTime(value) + } + + /** + * The speed scaling ratio. For example, if this value is `1`, then the animation plays at normal + * speed. If it's `0.5`, then it plays at half speed. If it's `2`, then it plays at double speed. + * If set to a negative value, the animation is played in reverse. If set to `0`, the animation + * will not advance. + */ + public final inline var speedScale: Float + @JvmName("speedScaleProperty") + get() = getSpeedScale() + @JvmName("speedScaleProperty") + set(`value`) { + setSpeedScale(value) + } + + /** + * If `true` and the engine is running in Movie Maker mode (see [MovieWriter]), exits the engine + * with [SceneTree.quit] as soon as an animation is done playing in this [AnimationPlayer]. A message + * is printed when the engine quits for this reason. + * **Note:** This obeys the same logic as the [signal AnimationMixer.animation_finished] signal, + * so it will not quit the engine if the animation is set to be looping. + */ + public final inline var movieQuitOnFinish: Boolean + @JvmName("movieQuitOnFinishProperty") + get() = isMovieQuitOnFinishEnabled() + @JvmName("movieQuitOnFinishProperty") + set(`value`) { + setMovieQuitOnFinishEnabled(value) + } + + public override fun new(scriptIndex: Int): Unit { + Internals.callConstructor(this, ENGINE_CLASS_ANIMATIONPLAYER_INDEX, scriptIndex) + } + + /** + * Triggers the [animationTo] animation when the [animationFrom] animation completes. + */ + public final fun animationSetNext(animationFrom: StringName, animationTo: StringName): Unit { + Internals.writeArguments(STRING_NAME to animationFrom, STRING_NAME to animationTo) + Internals.callMethod(rawPtr, MethodBindings.animationSetNextPtr, NIL) + } + + /** + * Returns the key of the animation which is queued to play after the [animationFrom] animation. + */ + public final fun animationGetNext(animationFrom: StringName): StringName { + Internals.writeArguments(STRING_NAME to animationFrom) + Internals.callMethod(rawPtr, MethodBindings.animationGetNextPtr, STRING_NAME) + return (Internals.readReturnValue(STRING_NAME) as StringName) + } + + /** + * Specifies a blend time (in seconds) between two animations, referenced by their keys. + */ + public final fun setBlendTime( + animationFrom: StringName, + animationTo: StringName, + sec: Double, + ): Unit { + Internals.writeArguments(STRING_NAME to animationFrom, STRING_NAME to animationTo, DOUBLE to sec) + Internals.callMethod(rawPtr, MethodBindings.setBlendTimePtr, NIL) + } + + /** + * Returns the blend time (in seconds) between two animations, referenced by their keys. + */ + public final fun getBlendTime(animationFrom: StringName, animationTo: StringName): Double { + Internals.writeArguments(STRING_NAME to animationFrom, STRING_NAME to animationTo) + Internals.callMethod(rawPtr, MethodBindings.getBlendTimePtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double) + } + + public final fun setDefaultBlendTime(sec: Double): Unit { + Internals.writeArguments(DOUBLE to sec) + Internals.callMethod(rawPtr, MethodBindings.setDefaultBlendTimePtr, NIL) + } + + public final fun getDefaultBlendTime(): Double { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getDefaultBlendTimePtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double) + } + + public final fun setAutoCapture(autoCapture: Boolean): Unit { + Internals.writeArguments(BOOL to autoCapture) + Internals.callMethod(rawPtr, MethodBindings.setAutoCapturePtr, NIL) + } + + public final fun isAutoCapture(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isAutoCapturePtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public final fun setAutoCaptureDuration(autoCaptureDuration: Double): Unit { + Internals.writeArguments(DOUBLE to autoCaptureDuration) + Internals.callMethod(rawPtr, MethodBindings.setAutoCaptureDurationPtr, NIL) + } + + public final fun getAutoCaptureDuration(): Double { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getAutoCaptureDurationPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double) + } + + public final fun setAutoCaptureTransitionType(autoCaptureTransitionType: Tween.TransitionType): + Unit { + Internals.writeArguments(LONG to autoCaptureTransitionType.id) + Internals.callMethod(rawPtr, MethodBindings.setAutoCaptureTransitionTypePtr, NIL) + } + + public final fun getAutoCaptureTransitionType(): Tween.TransitionType { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getAutoCaptureTransitionTypePtr, LONG) + return Tween.TransitionType.from(Internals.readReturnValue(LONG) as Long) + } + + public final fun setAutoCaptureEaseType(autoCaptureEaseType: Tween.EaseType): Unit { + Internals.writeArguments(LONG to autoCaptureEaseType.id) + Internals.callMethod(rawPtr, MethodBindings.setAutoCaptureEaseTypePtr, NIL) + } + + public final fun getAutoCaptureEaseType(): Tween.EaseType { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getAutoCaptureEaseTypePtr, LONG) + return Tween.EaseType.from(Internals.readReturnValue(LONG) as Long) + } + + /** + * Plays the animation with key [name]. Custom blend times and speed can be set. + * The [fromEnd] option only affects when switching to a new animation track, or if the same track + * but at the start or end. It does not affect resuming playback that was paused in the middle of an + * animation. If [customSpeed] is negative and [fromEnd] is `true`, the animation will play backwards + * (which is equivalent to calling [playBackwards]). + * The [AnimationPlayer] keeps track of its current or last played animation with + * [assignedAnimation]. If this method is called with that same animation [name], or with no [name] + * parameter, the assigned animation will resume playing if it was paused. + * **Note:** The animation will be updated the next time the [AnimationPlayer] is processed. If + * other variables are updated at the same time this is called, they may be updated too early. To + * perform the update immediately, call `advance(0)`. + */ + @JvmOverloads + public final fun play( + name: StringName = StringName(""), + customBlend: Double = -1.0, + customSpeed: Float = 1.0f, + fromEnd: Boolean = false, + ): Unit { + Internals.writeArguments(STRING_NAME to name, DOUBLE to customBlend, DOUBLE to customSpeed.toDouble(), BOOL to fromEnd) + Internals.callMethod(rawPtr, MethodBindings.playPtr, NIL) + } + + /** + * Plays the animation with key [name] in reverse. + * This method is a shorthand for [play] with `custom_speed = -1.0` and `from_end = true`, so see + * its description for more information. + */ + @JvmOverloads + public final fun playBackwards(name: StringName = StringName(""), customBlend: Double = -1.0): + Unit { + Internals.writeArguments(STRING_NAME to name, DOUBLE to customBlend) + Internals.callMethod(rawPtr, MethodBindings.playBackwardsPtr, NIL) + } + + /** + * See also [AnimationMixer.capture]. + * You can use this method to use more detailed options for capture than those performed by + * [playbackAutoCapture]. When [playbackAutoCapture] is `false`, this method is almost the same as + * the following: + * [codeblock] + * capture(name, duration, trans_type, ease_type) + * play(name, custom_blend, custom_speed, from_end) + * [/codeblock] + * If [name] is blank, it specifies [assignedAnimation]. + * If [duration] is a negative value, the duration is set to the interval between the current + * position and the first key, when [fromEnd] is `true`, uses the interval between the current + * position and the last key instead. + * **Note:** The [duration] takes [speedScale] into account, but [customSpeed] does not, because + * the capture cache is interpolated with the blend result and the result may contain multiple + * animations. + */ + @JvmOverloads + public final fun playWithCapture( + name: StringName = StringName(""), + duration: Double = -1.0, + customBlend: Double = -1.0, + customSpeed: Float = 1.0f, + fromEnd: Boolean = false, + transType: Tween.TransitionType = Tween.TransitionType.TRANS_LINEAR, + easeType: Tween.EaseType = Tween.EaseType.EASE_IN, + ): Unit { + Internals.writeArguments(STRING_NAME to name, DOUBLE to duration, DOUBLE to customBlend, DOUBLE to customSpeed.toDouble(), BOOL to fromEnd, LONG to transType.id, LONG to easeType.id) + Internals.callMethod(rawPtr, MethodBindings.playWithCapturePtr, NIL) + } + + /** + * Pauses the currently playing animation. The [currentAnimationPosition] will be kept and calling + * [play] or [playBackwards] without arguments or with the same animation name as [assignedAnimation] + * will resume the animation. + * See also [stop]. + */ + public final fun pause(): Unit { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.pausePtr, NIL) + } + + /** + * Stops the currently playing animation. The animation position is reset to `0` and the + * `custom_speed` is reset to `1.0`. See also [pause]. + * If [keepState] is `true`, the animation state is not updated visually. + * **Note:** The method / audio / animation playback tracks will not be processed by this method. + */ + @JvmOverloads + public final fun stop(keepState: Boolean = false): Unit { + Internals.writeArguments(BOOL to keepState) + Internals.callMethod(rawPtr, MethodBindings.stopPtr, NIL) + } + + /** + * Returns `true` if an animation is currently playing (even if [speedScale] and/or `custom_speed` + * are `0`). + */ + public final fun isPlaying(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isPlayingPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public final fun setCurrentAnimation(animation: String): Unit { + Internals.writeArguments(STRING to animation) + Internals.callMethod(rawPtr, MethodBindings.setCurrentAnimationPtr, NIL) + } + + public final fun getCurrentAnimation(): String { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getCurrentAnimationPtr, STRING) + return (Internals.readReturnValue(STRING) as String) + } + + public final fun setAssignedAnimation(animation: String): Unit { + Internals.writeArguments(STRING to animation) + Internals.callMethod(rawPtr, MethodBindings.setAssignedAnimationPtr, NIL) + } + + public final fun getAssignedAnimation(): String { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getAssignedAnimationPtr, STRING) + return (Internals.readReturnValue(STRING) as String) + } + + /** + * Queues an animation for playback once the current animation and all previously queued + * animations are done. + * **Note:** If a looped animation is currently playing, the queued animation will never play + * unless the looped animation is stopped somehow. + */ + public final fun queue(name: StringName): Unit { + Internals.writeArguments(STRING_NAME to name) + Internals.callMethod(rawPtr, MethodBindings.queuePtr, NIL) + } + + /** + * Returns a list of the animation keys that are currently queued to play. + */ + public final fun getQueue(): PackedStringArray { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getQueuePtr, PACKED_STRING_ARRAY) + return (Internals.readReturnValue(PACKED_STRING_ARRAY) as PackedStringArray) + } + + /** + * Clears all queued, unplayed animations. + */ + public final fun clearQueue(): Unit { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.clearQueuePtr, NIL) + } + + public final fun setSpeedScale(speed: Float): Unit { + Internals.writeArguments(DOUBLE to speed.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setSpeedScalePtr, NIL) + } + + public final fun getSpeedScale(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getSpeedScalePtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + /** + * Returns the actual playing speed of current animation or `0` if not playing. This speed is the + * [speedScale] property multiplied by `custom_speed` argument specified when calling the [play] + * method. + * Returns a negative value if the current animation is playing backwards. + */ + public final fun getPlayingSpeed(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getPlayingSpeedPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setAutoplay(name: String): Unit { + Internals.writeArguments(STRING to name) + Internals.callMethod(rawPtr, MethodBindings.setAutoplayPtr, NIL) + } + + public final fun getAutoplay(): String { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getAutoplayPtr, STRING) + return (Internals.readReturnValue(STRING) as String) + } + + public final fun setMovieQuitOnFinishEnabled(enabled: Boolean): Unit { + Internals.writeArguments(BOOL to enabled) + Internals.callMethod(rawPtr, MethodBindings.setMovieQuitOnFinishEnabledPtr, NIL) + } + + public final fun isMovieQuitOnFinishEnabled(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isMovieQuitOnFinishEnabledPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public final fun getCurrentAnimationPosition(): Double { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getCurrentAnimationPositionPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double) + } + + public final fun getCurrentAnimationLength(): Double { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getCurrentAnimationLengthPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double) + } + + /** + * Seeks the animation to the [seconds] point in time (in seconds). If [update] is `true`, the + * animation updates too, otherwise it updates at process time. Events between the current frame and + * [seconds] are skipped. + * If [updateOnly] is `true`, the method / audio / animation playback tracks will not be + * processed. + * **Note:** Seeking to the end of the animation doesn't emit [signal + * AnimationMixer.animation_finished]. If you want to skip animation and emit the signal, use + * [AnimationMixer.advance]. + */ + @JvmOverloads + public final fun seek( + seconds: Double, + update: Boolean = false, + updateOnly: Boolean = false, + ): Unit { + Internals.writeArguments(DOUBLE to seconds, BOOL to update, BOOL to updateOnly) + Internals.callMethod(rawPtr, MethodBindings.seekPtr, NIL) + } + + /** + * Sets the process notification in which to update animations. + */ + public final fun setProcessCallback(mode: AnimationProcessCallback): Unit { + Internals.writeArguments(LONG to mode.id) + Internals.callMethod(rawPtr, MethodBindings.setProcessCallbackPtr, NIL) + } + + /** + * Returns the process notification in which to update animations. + */ + public final fun getProcessCallback(): AnimationProcessCallback { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getProcessCallbackPtr, LONG) + return AnimationPlayer.AnimationProcessCallback.from(Internals.readReturnValue(LONG) as Long) + } + + /** + * Sets the call mode used for "Call Method" tracks. + */ + public final fun setMethodCallMode(mode: AnimationMethodCallMode): Unit { + Internals.writeArguments(LONG to mode.id) + Internals.callMethod(rawPtr, MethodBindings.setMethodCallModePtr, NIL) + } + + /** + * Returns the call mode used for "Call Method" tracks. + */ + public final fun getMethodCallMode(): AnimationMethodCallMode { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getMethodCallModePtr, LONG) + return AnimationPlayer.AnimationMethodCallMode.from(Internals.readReturnValue(LONG) as Long) + } + + /** + * Sets the node which node path references will travel from. + */ + public final fun setRoot(path: NodePath): Unit { + Internals.writeArguments(NODE_PATH to path) + Internals.callMethod(rawPtr, MethodBindings.setRootPtr, NIL) + } + + /** + * Returns the node which node path references will travel from. + */ + public final fun getRoot(): NodePath { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getRootPtr, NODE_PATH) + return (Internals.readReturnValue(NODE_PATH) as NodePath) + } + + public enum class AnimationProcessCallback( + id: Long, + ) { + ANIMATION_PROCESS_PHYSICS(0), + ANIMATION_PROCESS_IDLE(1), + ANIMATION_PROCESS_MANUAL(2), + ; + + public val id: Long + init { + this.id = id + } + + public companion object { + public fun from(`value`: Long): AnimationProcessCallback = entries.single { it.id == `value` } + } + } + + public enum class AnimationMethodCallMode( + id: Long, + ) { + ANIMATION_METHOD_CALL_DEFERRED(0), + ANIMATION_METHOD_CALL_IMMEDIATE(1), + ; + + public val id: Long + init { + this.id = id + } + + public companion object { + public fun from(`value`: Long): AnimationMethodCallMode = entries.single { it.id == `value` } + } + } + + public companion object + + public object MethodBindings { + internal val animationSetNextPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationPlayer", "animation_set_next", 3740211285) + + internal val animationGetNextPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationPlayer", "animation_get_next", 1965194235) + + internal val setBlendTimePtr: VoidPtr = + Internals.getMethodBindPtr("AnimationPlayer", "set_blend_time", 3231131886) + + internal val getBlendTimePtr: VoidPtr = + Internals.getMethodBindPtr("AnimationPlayer", "get_blend_time", 1958752504) + + internal val setDefaultBlendTimePtr: VoidPtr = + Internals.getMethodBindPtr("AnimationPlayer", "set_default_blend_time", 373806689) + + internal val getDefaultBlendTimePtr: VoidPtr = + Internals.getMethodBindPtr("AnimationPlayer", "get_default_blend_time", 1740695150) + + internal val setAutoCapturePtr: VoidPtr = + Internals.getMethodBindPtr("AnimationPlayer", "set_auto_capture", 2586408642) + + internal val isAutoCapturePtr: VoidPtr = + Internals.getMethodBindPtr("AnimationPlayer", "is_auto_capture", 36873697) + + internal val setAutoCaptureDurationPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationPlayer", "set_auto_capture_duration", 373806689) + + internal val getAutoCaptureDurationPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationPlayer", "get_auto_capture_duration", 1740695150) + + internal val setAutoCaptureTransitionTypePtr: VoidPtr = + Internals.getMethodBindPtr("AnimationPlayer", "set_auto_capture_transition_type", 1058637742) + + internal val getAutoCaptureTransitionTypePtr: VoidPtr = + Internals.getMethodBindPtr("AnimationPlayer", "get_auto_capture_transition_type", 3842314528) + + internal val setAutoCaptureEaseTypePtr: VoidPtr = + Internals.getMethodBindPtr("AnimationPlayer", "set_auto_capture_ease_type", 1208105857) + + internal val getAutoCaptureEaseTypePtr: VoidPtr = + Internals.getMethodBindPtr("AnimationPlayer", "get_auto_capture_ease_type", 631880200) + + internal val playPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationPlayer", "play", 3697947785) + + internal val playBackwardsPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationPlayer", "play_backwards", 3890664824) + + internal val playWithCapturePtr: VoidPtr = + Internals.getMethodBindPtr("AnimationPlayer", "play_with_capture", 3180464118) + + internal val pausePtr: VoidPtr = + Internals.getMethodBindPtr("AnimationPlayer", "pause", 3218959716) + + internal val stopPtr: VoidPtr = Internals.getMethodBindPtr("AnimationPlayer", "stop", 107499316) + + internal val isPlayingPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationPlayer", "is_playing", 36873697) + + internal val setCurrentAnimationPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationPlayer", "set_current_animation", 83702148) + + internal val getCurrentAnimationPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationPlayer", "get_current_animation", 201670096) + + internal val setAssignedAnimationPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationPlayer", "set_assigned_animation", 83702148) + + internal val getAssignedAnimationPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationPlayer", "get_assigned_animation", 201670096) + + internal val queuePtr: VoidPtr = + Internals.getMethodBindPtr("AnimationPlayer", "queue", 3304788590) + + internal val getQueuePtr: VoidPtr = + Internals.getMethodBindPtr("AnimationPlayer", "get_queue", 2981934095) + + internal val clearQueuePtr: VoidPtr = + Internals.getMethodBindPtr("AnimationPlayer", "clear_queue", 3218959716) + + internal val setSpeedScalePtr: VoidPtr = + Internals.getMethodBindPtr("AnimationPlayer", "set_speed_scale", 373806689) + + internal val getSpeedScalePtr: VoidPtr = + Internals.getMethodBindPtr("AnimationPlayer", "get_speed_scale", 1740695150) + + internal val getPlayingSpeedPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationPlayer", "get_playing_speed", 1740695150) + + internal val setAutoplayPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationPlayer", "set_autoplay", 83702148) + + internal val getAutoplayPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationPlayer", "get_autoplay", 201670096) + + internal val setMovieQuitOnFinishEnabledPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationPlayer", "set_movie_quit_on_finish_enabled", 2586408642) + + internal val isMovieQuitOnFinishEnabledPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationPlayer", "is_movie_quit_on_finish_enabled", 36873697) + + internal val getCurrentAnimationPositionPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationPlayer", "get_current_animation_position", 1740695150) + + internal val getCurrentAnimationLengthPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationPlayer", "get_current_animation_length", 1740695150) + + internal val seekPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationPlayer", "seek", 1807872683) + + internal val setProcessCallbackPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationPlayer", "set_process_callback", 1663839457) + + internal val getProcessCallbackPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationPlayer", "get_process_callback", 4207496604) + + internal val setMethodCallModePtr: VoidPtr = + Internals.getMethodBindPtr("AnimationPlayer", "set_method_call_mode", 3413514846) + + internal val getMethodCallModePtr: VoidPtr = + Internals.getMethodBindPtr("AnimationPlayer", "get_method_call_mode", 3583380054) + + internal val setRootPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationPlayer", "set_root", 1348162250) + + internal val getRootPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationPlayer", "get_root", 4075236667) + } +} diff --git a/kt/godot-library/src/main/kotlin/godot/gen/godot/AnimationRootNode.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AnimationRootNode.kt similarity index 87% rename from kt/godot-library/src/main/kotlin/godot/gen/godot/AnimationRootNode.kt rename to kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AnimationRootNode.kt index 0b0d8af70e..59bdcfb6d0 100644 --- a/kt/godot-library/src/main/kotlin/godot/gen/godot/AnimationRootNode.kt +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AnimationRootNode.kt @@ -7,10 +7,13 @@ package godot import godot.`annotation`.GodotBaseType +import godot.util.Internals import kotlin.Int import kotlin.Suppress import kotlin.Unit +private const val ENGINE_CLASS_ANIMATIONROOTNODE_INDEX: Int = 71 + /** * [AnimationRootNode] is a base class for [AnimationNode]s that hold a complete animation. A * complete animation refers to the output of an [AnimationNodeOutput] in an [AnimationNodeBlendTree] @@ -25,10 +28,10 @@ import kotlin.Unit @GodotBaseType public open class AnimationRootNode : AnimationNode() { public override fun new(scriptIndex: Int): Unit { - callConstructor(ENGINECLASS_ANIMATIONROOTNODE, scriptIndex) + Internals.callConstructor(this, ENGINE_CLASS_ANIMATIONROOTNODE_INDEX, scriptIndex) } public companion object - internal object MethodBindings + public object MethodBindings } diff --git a/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AnimationTree.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AnimationTree.kt new file mode 100644 index 0000000000..9da9f9d563 --- /dev/null +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AnimationTree.kt @@ -0,0 +1,173 @@ +// THIS FILE IS GENERATED! DO NOT EDIT IT MANUALLY! +@file:Suppress("PackageDirectoryMismatch", "unused", "FunctionName", "RedundantModalityModifier", + "UNCHECKED_CAST", "JoinDeclarationAndAssignment", "USELESS_CAST", + "RemoveRedundantQualifierName", "NOTHING_TO_INLINE", "NON_FINAL_MEMBER_IN_OBJECT", + "RedundantVisibilityModifier", "RedundantUnitReturnType", "MemberVisibilityCanBePrivate") + +package godot + +import godot.`annotation`.GodotBaseType +import godot.core.NodePath +import godot.core.Signal0 +import godot.core.VariantParser.LONG +import godot.core.VariantParser.NIL +import godot.core.VariantParser.NODE_PATH +import godot.core.VariantParser.OBJECT +import godot.util.Internals +import godot.util.VoidPtr +import kotlin.Int +import kotlin.Long +import kotlin.Suppress +import kotlin.Unit +import kotlin.jvm.JvmName + +private const val ENGINE_CLASS_ANIMATIONTREE_INDEX: Int = 72 + +/** + * A node used for advanced animation transitions in an [AnimationPlayer]. + * **Note:** When linked with an [AnimationPlayer], several properties and methods of the + * corresponding [AnimationPlayer] will not function as expected. Playback and transitions should be + * handled using only the [AnimationTree] and its constituent [AnimationNode](s). The [AnimationPlayer] + * node should be used solely for adding, deleting, and editing animations. + */ +@GodotBaseType +public open class AnimationTree : AnimationMixer() { + /** + * Emitted when the [animPlayer] is changed. + */ + public val animationPlayerChanged: Signal0 by Signal0 + + /** + * The root animation node of this [AnimationTree]. See [AnimationRootNode]. + */ + public final inline var treeRoot: AnimationRootNode? + @JvmName("treeRootProperty") + get() = getTreeRoot() + @JvmName("treeRootProperty") + set(`value`) { + setTreeRoot(value) + } + + /** + * The path to the [Node] used to evaluate the [AnimationNode] [Expression] if one is not + * explicitly specified internally. + */ + public final inline var advanceExpressionBaseNode: NodePath + @JvmName("advanceExpressionBaseNodeProperty") + get() = getAdvanceExpressionBaseNode() + @JvmName("advanceExpressionBaseNodeProperty") + set(`value`) { + setAdvanceExpressionBaseNode(value) + } + + /** + * The path to the [AnimationPlayer] used for animating. + */ + public final inline var animPlayer: NodePath + @JvmName("animPlayerProperty") + get() = getAnimationPlayer() + @JvmName("animPlayerProperty") + set(`value`) { + setAnimationPlayer(value) + } + + public override fun new(scriptIndex: Int): Unit { + Internals.callConstructor(this, ENGINE_CLASS_ANIMATIONTREE_INDEX, scriptIndex) + } + + public final fun setTreeRoot(animationNode: AnimationRootNode?): Unit { + Internals.writeArguments(OBJECT to animationNode) + Internals.callMethod(rawPtr, MethodBindings.setTreeRootPtr, NIL) + } + + public final fun getTreeRoot(): AnimationRootNode? { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getTreeRootPtr, OBJECT) + return (Internals.readReturnValue(OBJECT) as AnimationRootNode?) + } + + public final fun setAdvanceExpressionBaseNode(path: NodePath): Unit { + Internals.writeArguments(NODE_PATH to path) + Internals.callMethod(rawPtr, MethodBindings.setAdvanceExpressionBaseNodePtr, NIL) + } + + public final fun getAdvanceExpressionBaseNode(): NodePath { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getAdvanceExpressionBaseNodePtr, NODE_PATH) + return (Internals.readReturnValue(NODE_PATH) as NodePath) + } + + public final fun setAnimationPlayer(path: NodePath): Unit { + Internals.writeArguments(NODE_PATH to path) + Internals.callMethod(rawPtr, MethodBindings.setAnimationPlayerPtr, NIL) + } + + public final fun getAnimationPlayer(): NodePath { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getAnimationPlayerPtr, NODE_PATH) + return (Internals.readReturnValue(NODE_PATH) as NodePath) + } + + /** + * Sets the process notification in which to update animations. + */ + public final fun setProcessCallback(mode: AnimationProcessCallback): Unit { + Internals.writeArguments(LONG to mode.id) + Internals.callMethod(rawPtr, MethodBindings.setProcessCallbackPtr, NIL) + } + + /** + * Returns the process notification in which to update animations. + */ + public final fun getProcessCallback(): AnimationProcessCallback { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getProcessCallbackPtr, LONG) + return AnimationTree.AnimationProcessCallback.from(Internals.readReturnValue(LONG) as Long) + } + + public enum class AnimationProcessCallback( + id: Long, + ) { + ANIMATION_PROCESS_PHYSICS(0), + ANIMATION_PROCESS_IDLE(1), + ANIMATION_PROCESS_MANUAL(2), + ; + + public val id: Long + init { + this.id = id + } + + public companion object { + public fun from(`value`: Long): AnimationProcessCallback = entries.single { it.id == `value` } + } + } + + public companion object + + public object MethodBindings { + internal val setTreeRootPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationTree", "set_tree_root", 2581683800) + + internal val getTreeRootPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationTree", "get_tree_root", 4110384712) + + internal val setAdvanceExpressionBaseNodePtr: VoidPtr = + Internals.getMethodBindPtr("AnimationTree", "set_advance_expression_base_node", 1348162250) + + internal val getAdvanceExpressionBaseNodePtr: VoidPtr = + Internals.getMethodBindPtr("AnimationTree", "get_advance_expression_base_node", 4075236667) + + internal val setAnimationPlayerPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationTree", "set_animation_player", 1348162250) + + internal val getAnimationPlayerPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationTree", "get_animation_player", 4075236667) + + internal val setProcessCallbackPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationTree", "set_process_callback", 1723352826) + + internal val getProcessCallbackPtr: VoidPtr = + Internals.getMethodBindPtr("AnimationTree", "get_process_callback", 891317132) + } +} diff --git a/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/Area2D.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/Area2D.kt new file mode 100644 index 0000000000..cefe71882b --- /dev/null +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/Area2D.kt @@ -0,0 +1,763 @@ +// THIS FILE IS GENERATED! DO NOT EDIT IT MANUALLY! +@file:Suppress("PackageDirectoryMismatch", "unused", "FunctionName", "RedundantModalityModifier", + "UNCHECKED_CAST", "JoinDeclarationAndAssignment", "USELESS_CAST", + "RemoveRedundantQualifierName", "NOTHING_TO_INLINE", "NON_FINAL_MEMBER_IN_OBJECT", + "RedundantVisibilityModifier", "RedundantUnitReturnType", "MemberVisibilityCanBePrivate") + +package godot + +import godot.`annotation`.CoreTypeHelper +import godot.`annotation`.CoreTypeLocalCopy +import godot.`annotation`.GodotBaseType +import godot.core.RID +import godot.core.Signal1 +import godot.core.Signal4 +import godot.core.StringName +import godot.core.VariantArray +import godot.core.VariantParser.ARRAY +import godot.core.VariantParser.BOOL +import godot.core.VariantParser.DOUBLE +import godot.core.VariantParser.LONG +import godot.core.VariantParser.NIL +import godot.core.VariantParser.OBJECT +import godot.core.VariantParser.STRING_NAME +import godot.core.VariantParser.VECTOR2 +import godot.core.Vector2 +import godot.util.Internals +import godot.util.VoidPtr +import kotlin.Boolean +import kotlin.Double +import kotlin.Float +import kotlin.Int +import kotlin.Long +import kotlin.Suppress +import kotlin.Unit +import kotlin.jvm.JvmName + +private const val ENGINE_CLASS_AREA2D_INDEX: Int = 73 + +/** + * [Area2D] is a region of 2D space defined by one or multiple [CollisionShape2D] or + * [CollisionPolygon2D] child nodes. It detects when other [CollisionObject2D]s enter or exit it, and + * it also keeps track of which collision objects haven't exited it yet (i.e. which one are overlapping + * it). + * This node can also locally alter or override physics parameters (gravity, damping) and route + * audio to custom audio buses. + * **Note:** Areas and bodies created with [PhysicsServer2D] might not interact as expected with + * [Area2D]s, and might not emit signals or track objects correctly. + */ +@GodotBaseType +public open class Area2D : CollisionObject2D() { + /** + * Emitted when a [Shape2D] of the received [body] enters a shape of this area. [body] can be a + * [PhysicsBody2D] or a [TileMap]. [TileMap]s are detected if their [TileSet] has collision shapes + * configured. Requires [monitoring] to be set to `true`. + * [localShapeIndex] and [bodyShapeIndex] contain indices of the interacting shapes from this area + * and the interacting body, respectively. [bodyRid] contains the [RID] of the body. These values can + * be used with the [PhysicsServer2D]. + * **Example of getting the** [CollisionShape2D] **node from the shape index:** + * + * gdscript: + * ```gdscript + * var body_shape_owner = body.shape_find_owner(body_shape_index) + * var body_shape_node = body.shape_owner_get_owner(body_shape_owner) + * + * var local_shape_owner = shape_find_owner(local_shape_index) + * var local_shape_node = shape_owner_get_owner(local_shape_owner) + * ``` + */ + public val bodyShapeEntered: Signal4 by Signal4 + + /** + * Emitted when a [Shape2D] of the received [body] exits a shape of this area. [body] can be a + * [PhysicsBody2D] or a [TileMap]. [TileMap]s are detected if their [TileSet] has collision shapes + * configured. Requires [monitoring] to be set to `true`. + * See also [signal body_shape_entered]. + */ + public val bodyShapeExited: Signal4 by Signal4 + + /** + * Emitted when the received [body] enters this area. [body] can be a [PhysicsBody2D] or a + * [TileMap]. [TileMap]s are detected if their [TileSet] has collision shapes configured. Requires + * [monitoring] to be set to `true`. + */ + public val bodyEntered: Signal1 by Signal1 + + /** + * Emitted when the received [body] exits this area. [body] can be a [PhysicsBody2D] or a + * [TileMap]. [TileMap]s are detected if their [TileSet] has collision shapes configured. Requires + * [monitoring] to be set to `true`. + */ + public val bodyExited: Signal1 by Signal1 + + /** + * Emitted when a [Shape2D] of the received [area] enters a shape of this area. Requires + * [monitoring] to be set to `true`. + * [localShapeIndex] and [areaShapeIndex] contain indices of the interacting shapes from this area + * and the other area, respectively. [areaRid] contains the [RID] of the other area. These values can + * be used with the [PhysicsServer2D]. + * **Example of getting the** [CollisionShape2D] **node from the shape index:** + * + * gdscript: + * ```gdscript + * var other_shape_owner = area.shape_find_owner(area_shape_index) + * var other_shape_node = area.shape_owner_get_owner(other_shape_owner) + * + * var local_shape_owner = shape_find_owner(local_shape_index) + * var local_shape_node = shape_owner_get_owner(local_shape_owner) + * ``` + */ + public val areaShapeEntered: Signal4 by Signal4 + + /** + * Emitted when a [Shape2D] of the received [area] exits a shape of this area. Requires + * [monitoring] to be set to `true`. + * See also [signal area_shape_entered]. + */ + public val areaShapeExited: Signal4 by Signal4 + + /** + * Emitted when the received [area] enters this area. Requires [monitoring] to be set to `true`. + */ + public val areaEntered: Signal1 by Signal1 + + /** + * Emitted when the received [area] exits this area. Requires [monitoring] to be set to `true`. + */ + public val areaExited: Signal1 by Signal1 + + /** + * If `true`, the area detects bodies or areas entering and exiting it. + */ + public final inline var monitoring: Boolean + @JvmName("monitoringProperty") + get() = isMonitoring() + @JvmName("monitoringProperty") + set(`value`) { + setMonitoring(value) + } + + /** + * If `true`, other monitoring areas can detect this area. + */ + public final inline var monitorable: Boolean + @JvmName("monitorableProperty") + get() = isMonitorable() + @JvmName("monitorableProperty") + set(`value`) { + setMonitorable(value) + } + + /** + * The area's priority. Higher priority areas are processed first. The [World2D]'s physics is + * always processed last, after all areas. + */ + public final inline var priority: Int + @JvmName("priorityProperty") + get() = getPriority() + @JvmName("priorityProperty") + set(`value`) { + setPriority(value) + } + + /** + * Override mode for gravity calculations within this area. See [SpaceOverride] for possible + * values. + */ + public final inline var gravitySpaceOverride: SpaceOverride + @JvmName("gravitySpaceOverrideProperty") + get() = getGravitySpaceOverrideMode() + @JvmName("gravitySpaceOverrideProperty") + set(`value`) { + setGravitySpaceOverrideMode(value) + } + + /** + * If `true`, gravity is calculated from a point (set via [gravityPointCenter]). See also + * [gravitySpaceOverride]. + */ + public final inline var gravityPoint: Boolean + @JvmName("gravityPointProperty") + get() = isGravityAPoint() + @JvmName("gravityPointProperty") + set(`value`) { + setGravityIsPoint(value) + } + + /** + * The distance at which the gravity strength is equal to [gravity]. For example, on a planet 100 + * pixels in radius with a surface gravity of 4.0 px/s², set the [gravity] to 4.0 and the unit + * distance to 100.0. The gravity will have falloff according to the inverse square law, so in the + * example, at 200 pixels from the center the gravity will be 1.0 px/s² (twice the distance, 1/4th + * the gravity), at 50 pixels it will be 16.0 px/s² (half the distance, 4x the gravity), and so on. + * The above is true only when the unit distance is a positive number. When this is set to 0.0, + * the gravity will be constant regardless of distance. + */ + public final inline var gravityPointUnitDistance: Float + @JvmName("gravityPointUnitDistanceProperty") + get() = getGravityPointUnitDistance() + @JvmName("gravityPointUnitDistanceProperty") + set(`value`) { + setGravityPointUnitDistance(value) + } + + /** + * If gravity is a point (see [gravityPoint]), this will be the point of attraction. + */ + @CoreTypeLocalCopy + public final inline var gravityPointCenter: Vector2 + @JvmName("gravityPointCenterProperty") + get() = getGravityPointCenter() + @JvmName("gravityPointCenterProperty") + set(`value`) { + setGravityPointCenter(value) + } + + /** + * The area's gravity vector (not normalized). + */ + @CoreTypeLocalCopy + public final inline var gravityDirection: Vector2 + @JvmName("gravityDirectionProperty") + get() = getGravityDirection() + @JvmName("gravityDirectionProperty") + set(`value`) { + setGravityDirection(value) + } + + /** + * The area's gravity intensity (in pixels per second squared). This value multiplies the gravity + * direction. This is useful to alter the force of gravity without altering its direction. + */ + public final inline var gravity: Float + @JvmName("gravityProperty") + get() = getGravity() + @JvmName("gravityProperty") + set(`value`) { + setGravity(value) + } + + /** + * Override mode for linear damping calculations within this area. See [SpaceOverride] for + * possible values. + */ + public final inline var linearDampSpaceOverride: SpaceOverride + @JvmName("linearDampSpaceOverrideProperty") + get() = getLinearDampSpaceOverrideMode() + @JvmName("linearDampSpaceOverrideProperty") + set(`value`) { + setLinearDampSpaceOverrideMode(value) + } + + /** + * The rate at which objects stop moving in this area. Represents the linear velocity lost per + * second. + * See [ProjectSettings.physics/2d/defaultLinearDamp] for more details about damping. + */ + public final inline var linearDamp: Float + @JvmName("linearDampProperty") + get() = getLinearDamp() + @JvmName("linearDampProperty") + set(`value`) { + setLinearDamp(value) + } + + /** + * Override mode for angular damping calculations within this area. See [SpaceOverride] for + * possible values. + */ + public final inline var angularDampSpaceOverride: SpaceOverride + @JvmName("angularDampSpaceOverrideProperty") + get() = getAngularDampSpaceOverrideMode() + @JvmName("angularDampSpaceOverrideProperty") + set(`value`) { + setAngularDampSpaceOverrideMode(value) + } + + /** + * The rate at which objects stop spinning in this area. Represents the angular velocity lost per + * second. + * See [ProjectSettings.physics/2d/defaultAngularDamp] for more details about damping. + */ + public final inline var angularDamp: Float + @JvmName("angularDampProperty") + get() = getAngularDamp() + @JvmName("angularDampProperty") + set(`value`) { + setAngularDamp(value) + } + + /** + * If `true`, the area's audio bus overrides the default audio bus. + */ + public final inline var audioBusOverride: Boolean + @JvmName("audioBusOverrideProperty") + get() = isOverridingAudioBus() + @JvmName("audioBusOverrideProperty") + set(`value`) { + setAudioBusOverride(value) + } + + /** + * The name of the area's audio bus. + */ + public final inline var audioBusName: StringName + @JvmName("audioBusNameProperty") + get() = getAudioBusName() + @JvmName("audioBusNameProperty") + set(`value`) { + setAudioBusName(value) + } + + public override fun new(scriptIndex: Int): Unit { + Internals.callConstructor(this, ENGINE_CLASS_AREA2D_INDEX, scriptIndex) + } + + /** + * If gravity is a point (see [gravityPoint]), this will be the point of attraction. + * + * This is a helper function to make dealing with local copies easier. + * + * For more information, see our + * [documentation](https://godot-kotl.in/en/stable/user-guide/api-differences/#core-types). + * + * Allow to directly modify the local copy of the property and assign it back to the Object. + * + * Prefer that over writing: + * `````` + * val myCoreType = area2d.gravityPointCenter + * //Your changes + * area2d.gravityPointCenter = myCoreType + * `````` + */ + @CoreTypeHelper + public final fun gravityPointCenterMutate(block: Vector2.() -> Unit): Vector2 = + gravityPointCenter.apply{ + block(this) + gravityPointCenter = this + } + + + /** + * The area's gravity vector (not normalized). + * + * This is a helper function to make dealing with local copies easier. + * + * For more information, see our + * [documentation](https://godot-kotl.in/en/stable/user-guide/api-differences/#core-types). + * + * Allow to directly modify the local copy of the property and assign it back to the Object. + * + * Prefer that over writing: + * `````` + * val myCoreType = area2d.gravityDirection + * //Your changes + * area2d.gravityDirection = myCoreType + * `````` + */ + @CoreTypeHelper + public final fun gravityDirectionMutate(block: Vector2.() -> Unit): Vector2 = + gravityDirection.apply{ + block(this) + gravityDirection = this + } + + + public final fun setGravitySpaceOverrideMode(spaceOverrideMode: SpaceOverride): Unit { + Internals.writeArguments(LONG to spaceOverrideMode.id) + Internals.callMethod(rawPtr, MethodBindings.setGravitySpaceOverrideModePtr, NIL) + } + + public final fun getGravitySpaceOverrideMode(): SpaceOverride { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getGravitySpaceOverrideModePtr, LONG) + return Area2D.SpaceOverride.from(Internals.readReturnValue(LONG) as Long) + } + + public final fun setGravityIsPoint(enable: Boolean): Unit { + Internals.writeArguments(BOOL to enable) + Internals.callMethod(rawPtr, MethodBindings.setGravityIsPointPtr, NIL) + } + + public final fun isGravityAPoint(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isGravityAPointPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public final fun setGravityPointUnitDistance(distanceScale: Float): Unit { + Internals.writeArguments(DOUBLE to distanceScale.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setGravityPointUnitDistancePtr, NIL) + } + + public final fun getGravityPointUnitDistance(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getGravityPointUnitDistancePtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setGravityPointCenter(center: Vector2): Unit { + Internals.writeArguments(VECTOR2 to center) + Internals.callMethod(rawPtr, MethodBindings.setGravityPointCenterPtr, NIL) + } + + public final fun getGravityPointCenter(): Vector2 { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getGravityPointCenterPtr, VECTOR2) + return (Internals.readReturnValue(VECTOR2) as Vector2) + } + + public final fun setGravityDirection(direction: Vector2): Unit { + Internals.writeArguments(VECTOR2 to direction) + Internals.callMethod(rawPtr, MethodBindings.setGravityDirectionPtr, NIL) + } + + public final fun getGravityDirection(): Vector2 { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getGravityDirectionPtr, VECTOR2) + return (Internals.readReturnValue(VECTOR2) as Vector2) + } + + public final fun setGravity(gravity: Float): Unit { + Internals.writeArguments(DOUBLE to gravity.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setGravityPtr, NIL) + } + + public final fun getGravity(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getGravityPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setLinearDampSpaceOverrideMode(spaceOverrideMode: SpaceOverride): Unit { + Internals.writeArguments(LONG to spaceOverrideMode.id) + Internals.callMethod(rawPtr, MethodBindings.setLinearDampSpaceOverrideModePtr, NIL) + } + + public final fun getLinearDampSpaceOverrideMode(): SpaceOverride { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getLinearDampSpaceOverrideModePtr, LONG) + return Area2D.SpaceOverride.from(Internals.readReturnValue(LONG) as Long) + } + + public final fun setAngularDampSpaceOverrideMode(spaceOverrideMode: SpaceOverride): Unit { + Internals.writeArguments(LONG to spaceOverrideMode.id) + Internals.callMethod(rawPtr, MethodBindings.setAngularDampSpaceOverrideModePtr, NIL) + } + + public final fun getAngularDampSpaceOverrideMode(): SpaceOverride { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getAngularDampSpaceOverrideModePtr, LONG) + return Area2D.SpaceOverride.from(Internals.readReturnValue(LONG) as Long) + } + + public final fun setLinearDamp(linearDamp: Float): Unit { + Internals.writeArguments(DOUBLE to linearDamp.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setLinearDampPtr, NIL) + } + + public final fun getLinearDamp(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getLinearDampPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setAngularDamp(angularDamp: Float): Unit { + Internals.writeArguments(DOUBLE to angularDamp.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setAngularDampPtr, NIL) + } + + public final fun getAngularDamp(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getAngularDampPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setPriority(priority: Int): Unit { + Internals.writeArguments(LONG to priority.toLong()) + Internals.callMethod(rawPtr, MethodBindings.setPriorityPtr, NIL) + } + + public final fun getPriority(): Int { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getPriorityPtr, LONG) + return (Internals.readReturnValue(LONG) as Long).toInt() + } + + public final fun setMonitoring(enable: Boolean): Unit { + Internals.writeArguments(BOOL to enable) + Internals.callMethod(rawPtr, MethodBindings.setMonitoringPtr, NIL) + } + + public final fun isMonitoring(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isMonitoringPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public final fun setMonitorable(enable: Boolean): Unit { + Internals.writeArguments(BOOL to enable) + Internals.callMethod(rawPtr, MethodBindings.setMonitorablePtr, NIL) + } + + public final fun isMonitorable(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isMonitorablePtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + /** + * Returns a list of intersecting [PhysicsBody2D]s and [TileMap]s. The overlapping body's + * [CollisionObject2D.collisionLayer] must be part of this area's [CollisionObject2D.collisionMask] + * in order to be detected. + * For performance reasons (collisions are all processed at the same time) this list is modified + * once during the physics step, not immediately after objects are moved. Consider using signals + * instead. + */ + public final fun getOverlappingBodies(): VariantArray { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getOverlappingBodiesPtr, ARRAY) + return (Internals.readReturnValue(ARRAY) as VariantArray) + } + + /** + * Returns a list of intersecting [Area2D]s. The overlapping area's + * [CollisionObject2D.collisionLayer] must be part of this area's [CollisionObject2D.collisionMask] + * in order to be detected. + * For performance reasons (collisions are all processed at the same time) this list is modified + * once during the physics step, not immediately after objects are moved. Consider using signals + * instead. + */ + public final fun getOverlappingAreas(): VariantArray { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getOverlappingAreasPtr, ARRAY) + return (Internals.readReturnValue(ARRAY) as VariantArray) + } + + /** + * Returns `true` if intersecting any [PhysicsBody2D]s or [TileMap]s, otherwise returns `false`. + * The overlapping body's [CollisionObject2D.collisionLayer] must be part of this area's + * [CollisionObject2D.collisionMask] in order to be detected. + * For performance reasons (collisions are all processed at the same time) the list of overlapping + * bodies is modified once during the physics step, not immediately after objects are moved. Consider + * using signals instead. + */ + public final fun hasOverlappingBodies(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.hasOverlappingBodiesPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + /** + * Returns `true` if intersecting any [Area2D]s, otherwise returns `false`. The overlapping area's + * [CollisionObject2D.collisionLayer] must be part of this area's [CollisionObject2D.collisionMask] + * in order to be detected. + * For performance reasons (collisions are all processed at the same time) the list of overlapping + * areas is modified once during the physics step, not immediately after objects are moved. Consider + * using signals instead. + */ + public final fun hasOverlappingAreas(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.hasOverlappingAreasPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + /** + * Returns `true` if the given physics body intersects or overlaps this [Area2D], `false` + * otherwise. + * **Note:** The result of this test is not immediate after moving objects. For performance, list + * of overlaps is updated once per frame and before the physics step. Consider using signals instead. + * The [body] argument can either be a [PhysicsBody2D] or a [TileMap] instance. While TileMaps are + * not physics bodies themselves, they register their tiles with collision shapes as a virtual + * physics body. + */ + public final fun overlapsBody(body: Node?): Boolean { + Internals.writeArguments(OBJECT to body) + Internals.callMethod(rawPtr, MethodBindings.overlapsBodyPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + /** + * Returns `true` if the given [Area2D] intersects or overlaps this [Area2D], `false` otherwise. + * **Note:** The result of this test is not immediate after moving objects. For performance, the + * list of overlaps is updated once per frame and before the physics step. Consider using signals + * instead. + */ + public final fun overlapsArea(area: Node?): Boolean { + Internals.writeArguments(OBJECT to area) + Internals.callMethod(rawPtr, MethodBindings.overlapsAreaPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public final fun setAudioBusName(name: StringName): Unit { + Internals.writeArguments(STRING_NAME to name) + Internals.callMethod(rawPtr, MethodBindings.setAudioBusNamePtr, NIL) + } + + public final fun getAudioBusName(): StringName { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getAudioBusNamePtr, STRING_NAME) + return (Internals.readReturnValue(STRING_NAME) as StringName) + } + + public final fun setAudioBusOverride(enable: Boolean): Unit { + Internals.writeArguments(BOOL to enable) + Internals.callMethod(rawPtr, MethodBindings.setAudioBusOverridePtr, NIL) + } + + public final fun isOverridingAudioBus(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isOverridingAudioBusPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public enum class SpaceOverride( + id: Long, + ) { + /** + * This area does not affect gravity/damping. + */ + SPACE_OVERRIDE_DISABLED(0), + /** + * This area adds its gravity/damping values to whatever has been calculated so far (in + * [priority] order). + */ + SPACE_OVERRIDE_COMBINE(1), + /** + * This area adds its gravity/damping values to whatever has been calculated so far (in + * [priority] order), ignoring any lower priority areas. + */ + SPACE_OVERRIDE_COMBINE_REPLACE(2), + /** + * This area replaces any gravity/damping, even the defaults, ignoring any lower priority areas. + */ + SPACE_OVERRIDE_REPLACE(3), + /** + * This area replaces any gravity/damping calculated so far (in [priority] order), but keeps + * calculating the rest of the areas. + */ + SPACE_OVERRIDE_REPLACE_COMBINE(4), + ; + + public val id: Long + init { + this.id = id + } + + public companion object { + public fun from(`value`: Long): SpaceOverride = entries.single { it.id == `value` } + } + } + + public companion object + + public object MethodBindings { + internal val setGravitySpaceOverrideModePtr: VoidPtr = + Internals.getMethodBindPtr("Area2D", "set_gravity_space_override_mode", 2879900038) + + internal val getGravitySpaceOverrideModePtr: VoidPtr = + Internals.getMethodBindPtr("Area2D", "get_gravity_space_override_mode", 3990256304) + + internal val setGravityIsPointPtr: VoidPtr = + Internals.getMethodBindPtr("Area2D", "set_gravity_is_point", 2586408642) + + internal val isGravityAPointPtr: VoidPtr = + Internals.getMethodBindPtr("Area2D", "is_gravity_a_point", 36873697) + + internal val setGravityPointUnitDistancePtr: VoidPtr = + Internals.getMethodBindPtr("Area2D", "set_gravity_point_unit_distance", 373806689) + + internal val getGravityPointUnitDistancePtr: VoidPtr = + Internals.getMethodBindPtr("Area2D", "get_gravity_point_unit_distance", 1740695150) + + internal val setGravityPointCenterPtr: VoidPtr = + Internals.getMethodBindPtr("Area2D", "set_gravity_point_center", 743155724) + + internal val getGravityPointCenterPtr: VoidPtr = + Internals.getMethodBindPtr("Area2D", "get_gravity_point_center", 3341600327) + + internal val setGravityDirectionPtr: VoidPtr = + Internals.getMethodBindPtr("Area2D", "set_gravity_direction", 743155724) + + internal val getGravityDirectionPtr: VoidPtr = + Internals.getMethodBindPtr("Area2D", "get_gravity_direction", 3341600327) + + internal val setGravityPtr: VoidPtr = + Internals.getMethodBindPtr("Area2D", "set_gravity", 373806689) + + internal val getGravityPtr: VoidPtr = + Internals.getMethodBindPtr("Area2D", "get_gravity", 1740695150) + + internal val setLinearDampSpaceOverrideModePtr: VoidPtr = + Internals.getMethodBindPtr("Area2D", "set_linear_damp_space_override_mode", 2879900038) + + internal val getLinearDampSpaceOverrideModePtr: VoidPtr = + Internals.getMethodBindPtr("Area2D", "get_linear_damp_space_override_mode", 3990256304) + + internal val setAngularDampSpaceOverrideModePtr: VoidPtr = + Internals.getMethodBindPtr("Area2D", "set_angular_damp_space_override_mode", 2879900038) + + internal val getAngularDampSpaceOverrideModePtr: VoidPtr = + Internals.getMethodBindPtr("Area2D", "get_angular_damp_space_override_mode", 3990256304) + + internal val setLinearDampPtr: VoidPtr = + Internals.getMethodBindPtr("Area2D", "set_linear_damp", 373806689) + + internal val getLinearDampPtr: VoidPtr = + Internals.getMethodBindPtr("Area2D", "get_linear_damp", 1740695150) + + internal val setAngularDampPtr: VoidPtr = + Internals.getMethodBindPtr("Area2D", "set_angular_damp", 373806689) + + internal val getAngularDampPtr: VoidPtr = + Internals.getMethodBindPtr("Area2D", "get_angular_damp", 1740695150) + + internal val setPriorityPtr: VoidPtr = + Internals.getMethodBindPtr("Area2D", "set_priority", 1286410249) + + internal val getPriorityPtr: VoidPtr = + Internals.getMethodBindPtr("Area2D", "get_priority", 3905245786) + + internal val setMonitoringPtr: VoidPtr = + Internals.getMethodBindPtr("Area2D", "set_monitoring", 2586408642) + + internal val isMonitoringPtr: VoidPtr = + Internals.getMethodBindPtr("Area2D", "is_monitoring", 36873697) + + internal val setMonitorablePtr: VoidPtr = + Internals.getMethodBindPtr("Area2D", "set_monitorable", 2586408642) + + internal val isMonitorablePtr: VoidPtr = + Internals.getMethodBindPtr("Area2D", "is_monitorable", 36873697) + + internal val getOverlappingBodiesPtr: VoidPtr = + Internals.getMethodBindPtr("Area2D", "get_overlapping_bodies", 3995934104) + + internal val getOverlappingAreasPtr: VoidPtr = + Internals.getMethodBindPtr("Area2D", "get_overlapping_areas", 3995934104) + + internal val hasOverlappingBodiesPtr: VoidPtr = + Internals.getMethodBindPtr("Area2D", "has_overlapping_bodies", 36873697) + + internal val hasOverlappingAreasPtr: VoidPtr = + Internals.getMethodBindPtr("Area2D", "has_overlapping_areas", 36873697) + + internal val overlapsBodyPtr: VoidPtr = + Internals.getMethodBindPtr("Area2D", "overlaps_body", 3093956946) + + internal val overlapsAreaPtr: VoidPtr = + Internals.getMethodBindPtr("Area2D", "overlaps_area", 3093956946) + + internal val setAudioBusNamePtr: VoidPtr = + Internals.getMethodBindPtr("Area2D", "set_audio_bus_name", 3304788590) + + internal val getAudioBusNamePtr: VoidPtr = + Internals.getMethodBindPtr("Area2D", "get_audio_bus_name", 2002593661) + + internal val setAudioBusOverridePtr: VoidPtr = + Internals.getMethodBindPtr("Area2D", "set_audio_bus_override", 2586408642) + + internal val isOverridingAudioBusPtr: VoidPtr = + Internals.getMethodBindPtr("Area2D", "is_overriding_audio_bus", 36873697) + } +} diff --git a/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/Area3D.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/Area3D.kt new file mode 100644 index 0000000000..965dd98cb1 --- /dev/null +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/Area3D.kt @@ -0,0 +1,976 @@ +// THIS FILE IS GENERATED! DO NOT EDIT IT MANUALLY! +@file:Suppress("PackageDirectoryMismatch", "unused", "FunctionName", "RedundantModalityModifier", + "UNCHECKED_CAST", "JoinDeclarationAndAssignment", "USELESS_CAST", + "RemoveRedundantQualifierName", "NOTHING_TO_INLINE", "NON_FINAL_MEMBER_IN_OBJECT", + "RedundantVisibilityModifier", "RedundantUnitReturnType", "MemberVisibilityCanBePrivate") + +package godot + +import godot.`annotation`.CoreTypeHelper +import godot.`annotation`.CoreTypeLocalCopy +import godot.`annotation`.GodotBaseType +import godot.core.NodePath +import godot.core.RID +import godot.core.Signal1 +import godot.core.Signal4 +import godot.core.StringName +import godot.core.VariantArray +import godot.core.VariantParser.ARRAY +import godot.core.VariantParser.BOOL +import godot.core.VariantParser.DOUBLE +import godot.core.VariantParser.LONG +import godot.core.VariantParser.NIL +import godot.core.VariantParser.NODE_PATH +import godot.core.VariantParser.OBJECT +import godot.core.VariantParser.STRING_NAME +import godot.core.VariantParser.VECTOR3 +import godot.core.Vector3 +import godot.util.Internals +import godot.util.VoidPtr +import kotlin.Boolean +import kotlin.Double +import kotlin.Float +import kotlin.Int +import kotlin.Long +import kotlin.Suppress +import kotlin.Unit +import kotlin.jvm.JvmName + +private const val ENGINE_CLASS_AREA3D_INDEX: Int = 74 + +/** + * [Area3D] is a region of 3D space defined by one or multiple [CollisionShape3D] or + * [CollisionPolygon3D] child nodes. It detects when other [CollisionObject3D]s enter or exit it, and + * it also keeps track of which collision objects haven't exited it yet (i.e. which one are overlapping + * it). + * This node can also locally alter or override physics parameters (gravity, damping) and route + * audio to custom audio buses. + * **Note:** Areas and bodies created with [PhysicsServer3D] might not interact as expected with + * [Area3D]s, and might not emit signals or track objects correctly. + * **Warning:** Using a [ConcavePolygonShape3D] inside a [CollisionShape3D] child of this node + * (created e.g. by using the **Create Trimesh Collision Sibling** option in the **Mesh** menu that + * appears when selecting a [MeshInstance3D] node) may give unexpected results, since this collision + * shape is hollow. If this is not desired, it has to be split into multiple [ConvexPolygonShape3D]s or + * primitive shapes like [BoxShape3D], or in some cases it may be replaceable by a + * [CollisionPolygon3D]. + */ +@GodotBaseType +public open class Area3D : CollisionObject3D() { + /** + * Emitted when a [Shape3D] of the received [body] enters a shape of this area. [body] can be a + * [PhysicsBody3D] or a [GridMap]. [GridMap]s are detected if their [MeshLibrary] has collision + * shapes configured. Requires [monitoring] to be set to `true`. + * [localShapeIndex] and [bodyShapeIndex] contain indices of the interacting shapes from this area + * and the interacting body, respectively. [bodyRid] contains the [RID] of the body. These values can + * be used with the [PhysicsServer3D]. + * **Example of getting the** [CollisionShape3D] **node from the shape index:** + * + * gdscript: + * ```gdscript + * var body_shape_owner = body.shape_find_owner(body_shape_index) + * var body_shape_node = body.shape_owner_get_owner(body_shape_owner) + * + * var local_shape_owner = shape_find_owner(local_shape_index) + * var local_shape_node = shape_owner_get_owner(local_shape_owner) + * ``` + */ + public val bodyShapeEntered: Signal4 by Signal4 + + /** + * Emitted when a [Shape3D] of the received [body] exits a shape of this area. [body] can be a + * [PhysicsBody3D] or a [GridMap]. [GridMap]s are detected if their [MeshLibrary] has collision + * shapes configured. Requires [monitoring] to be set to `true`. + * See also [signal body_shape_entered]. + */ + public val bodyShapeExited: Signal4 by Signal4 + + /** + * Emitted when the received [body] enters this area. [body] can be a [PhysicsBody3D] or a + * [GridMap]. [GridMap]s are detected if their [MeshLibrary] has collision shapes configured. + * Requires [monitoring] to be set to `true`. + */ + public val bodyEntered: Signal1 by Signal1 + + /** + * Emitted when the received [body] exits this area. [body] can be a [PhysicsBody3D] or a + * [GridMap]. [GridMap]s are detected if their [MeshLibrary] has collision shapes configured. + * Requires [monitoring] to be set to `true`. + */ + public val bodyExited: Signal1 by Signal1 + + /** + * Emitted when a [Shape3D] of the received [area] enters a shape of this area. Requires + * [monitoring] to be set to `true`. + * [localShapeIndex] and [areaShapeIndex] contain indices of the interacting shapes from this area + * and the other area, respectively. [areaRid] contains the [RID] of the other area. These values can + * be used with the [PhysicsServer3D]. + * **Example of getting the** [CollisionShape3D] **node from the shape index:** + * + * gdscript: + * ```gdscript + * var other_shape_owner = area.shape_find_owner(area_shape_index) + * var other_shape_node = area.shape_owner_get_owner(other_shape_owner) + * + * var local_shape_owner = shape_find_owner(local_shape_index) + * var local_shape_node = shape_owner_get_owner(local_shape_owner) + * ``` + */ + public val areaShapeEntered: Signal4 by Signal4 + + /** + * Emitted when a [Shape3D] of the received [area] exits a shape of this area. Requires + * [monitoring] to be set to `true`. + * See also [signal area_shape_entered]. + */ + public val areaShapeExited: Signal4 by Signal4 + + /** + * Emitted when the received [area] enters this area. Requires [monitoring] to be set to `true`. + */ + public val areaEntered: Signal1 by Signal1 + + /** + * Emitted when the received [area] exits this area. Requires [monitoring] to be set to `true`. + */ + public val areaExited: Signal1 by Signal1 + + /** + * If `true`, the area detects bodies or areas entering and exiting it. + */ + public final inline var monitoring: Boolean + @JvmName("monitoringProperty") + get() = isMonitoring() + @JvmName("monitoringProperty") + set(`value`) { + setMonitoring(value) + } + + /** + * If `true`, other monitoring areas can detect this area. + */ + public final inline var monitorable: Boolean + @JvmName("monitorableProperty") + get() = isMonitorable() + @JvmName("monitorableProperty") + set(`value`) { + setMonitorable(value) + } + + /** + * The area's priority. Higher priority areas are processed first. The [World3D]'s physics is + * always processed last, after all areas. + */ + public final inline var priority: Int + @JvmName("priorityProperty") + get() = getPriority() + @JvmName("priorityProperty") + set(`value`) { + setPriority(value) + } + + /** + * Override mode for gravity calculations within this area. See [SpaceOverride] for possible + * values. + */ + public final inline var gravitySpaceOverride: SpaceOverride + @JvmName("gravitySpaceOverrideProperty") + get() = getGravitySpaceOverrideMode() + @JvmName("gravitySpaceOverrideProperty") + set(`value`) { + setGravitySpaceOverrideMode(value) + } + + /** + * If `true`, gravity is calculated from a point (set via [gravityPointCenter]). See also + * [gravitySpaceOverride]. + */ + public final inline var gravityPoint: Boolean + @JvmName("gravityPointProperty") + get() = isGravityAPoint() + @JvmName("gravityPointProperty") + set(`value`) { + setGravityIsPoint(value) + } + + /** + * The distance at which the gravity strength is equal to [gravity]. For example, on a planet 100 + * meters in radius with a surface gravity of 4.0 m/s², set the [gravity] to 4.0 and the unit + * distance to 100.0. The gravity will have falloff according to the inverse square law, so in the + * example, at 200 meters from the center the gravity will be 1.0 m/s² (twice the distance, 1/4th the + * gravity), at 50 meters it will be 16.0 m/s² (half the distance, 4x the gravity), and so on. + * The above is true only when the unit distance is a positive number. When this is set to 0.0, + * the gravity will be constant regardless of distance. + */ + public final inline var gravityPointUnitDistance: Float + @JvmName("gravityPointUnitDistanceProperty") + get() = getGravityPointUnitDistance() + @JvmName("gravityPointUnitDistanceProperty") + set(`value`) { + setGravityPointUnitDistance(value) + } + + /** + * If gravity is a point (see [gravityPoint]), this will be the point of attraction. + */ + @CoreTypeLocalCopy + public final inline var gravityPointCenter: Vector3 + @JvmName("gravityPointCenterProperty") + get() = getGravityPointCenter() + @JvmName("gravityPointCenterProperty") + set(`value`) { + setGravityPointCenter(value) + } + + /** + * The area's gravity vector (not normalized). + */ + @CoreTypeLocalCopy + public final inline var gravityDirection: Vector3 + @JvmName("gravityDirectionProperty") + get() = getGravityDirection() + @JvmName("gravityDirectionProperty") + set(`value`) { + setGravityDirection(value) + } + + /** + * The area's gravity intensity (in meters per second squared). This value multiplies the gravity + * direction. This is useful to alter the force of gravity without altering its direction. + */ + public final inline var gravity: Float + @JvmName("gravityProperty") + get() = getGravity() + @JvmName("gravityProperty") + set(`value`) { + setGravity(value) + } + + /** + * Override mode for linear damping calculations within this area. See [SpaceOverride] for + * possible values. + */ + public final inline var linearDampSpaceOverride: SpaceOverride + @JvmName("linearDampSpaceOverrideProperty") + get() = getLinearDampSpaceOverrideMode() + @JvmName("linearDampSpaceOverrideProperty") + set(`value`) { + setLinearDampSpaceOverrideMode(value) + } + + /** + * The rate at which objects stop moving in this area. Represents the linear velocity lost per + * second. + * See [ProjectSettings.physics/3d/defaultLinearDamp] for more details about damping. + */ + public final inline var linearDamp: Float + @JvmName("linearDampProperty") + get() = getLinearDamp() + @JvmName("linearDampProperty") + set(`value`) { + setLinearDamp(value) + } + + /** + * Override mode for angular damping calculations within this area. See [SpaceOverride] for + * possible values. + */ + public final inline var angularDampSpaceOverride: SpaceOverride + @JvmName("angularDampSpaceOverrideProperty") + get() = getAngularDampSpaceOverrideMode() + @JvmName("angularDampSpaceOverrideProperty") + set(`value`) { + setAngularDampSpaceOverrideMode(value) + } + + /** + * The rate at which objects stop spinning in this area. Represents the angular velocity lost per + * second. + * See [ProjectSettings.physics/3d/defaultAngularDamp] for more details about damping. + */ + public final inline var angularDamp: Float + @JvmName("angularDampProperty") + get() = getAngularDamp() + @JvmName("angularDampProperty") + set(`value`) { + setAngularDamp(value) + } + + /** + * The magnitude of area-specific wind force. + * **Note:** This wind force only applies to [SoftBody3D] nodes. Other physics bodies are + * currently not affected by wind. + */ + public final inline var windForceMagnitude: Float + @JvmName("windForceMagnitudeProperty") + get() = getWindForceMagnitude() + @JvmName("windForceMagnitudeProperty") + set(`value`) { + setWindForceMagnitude(value) + } + + /** + * The exponential rate at which wind force decreases with distance from its origin. + * **Note:** This wind force only applies to [SoftBody3D] nodes. Other physics bodies are + * currently not affected by wind. + */ + public final inline var windAttenuationFactor: Float + @JvmName("windAttenuationFactorProperty") + get() = getWindAttenuationFactor() + @JvmName("windAttenuationFactorProperty") + set(`value`) { + setWindAttenuationFactor(value) + } + + /** + * The [Node3D] which is used to specify the direction and origin of an area-specific wind force. + * The direction is opposite to the z-axis of the [Node3D]'s local transform, and its origin is the + * origin of the [Node3D]'s local transform. + * **Note:** This wind force only applies to [SoftBody3D] nodes. Other physics bodies are + * currently not affected by wind. + */ + public final inline var windSourcePath: NodePath + @JvmName("windSourcePathProperty") + get() = getWindSourcePath() + @JvmName("windSourcePathProperty") + set(`value`) { + setWindSourcePath(value) + } + + /** + * If `true`, the area's audio bus overrides the default audio bus. + */ + public final inline var audioBusOverride: Boolean + @JvmName("audioBusOverrideProperty") + get() = isOverridingAudioBus() + @JvmName("audioBusOverrideProperty") + set(`value`) { + setAudioBusOverride(value) + } + + /** + * The name of the area's audio bus. + */ + public final inline var audioBusName: StringName + @JvmName("audioBusNameProperty") + get() = getAudioBusName() + @JvmName("audioBusNameProperty") + set(`value`) { + setAudioBusName(value) + } + + /** + * If `true`, the area applies reverb to its associated audio. + */ + public final inline var reverbBusEnabled: Boolean + @JvmName("reverbBusEnabledProperty") + get() = isUsingReverbBus() + @JvmName("reverbBusEnabledProperty") + set(`value`) { + setUseReverbBus(value) + } + + /** + * The name of the reverb bus to use for this area's associated audio. + */ + public final inline var reverbBusName: StringName + @JvmName("reverbBusNameProperty") + get() = getReverbBusName() + @JvmName("reverbBusNameProperty") + set(`value`) { + setReverbBusName(value) + } + + /** + * The degree to which this area applies reverb to its associated audio. Ranges from `0` to `1` + * with `0.1` precision. + */ + public final inline var reverbBusAmount: Float + @JvmName("reverbBusAmountProperty") + get() = getReverbAmount() + @JvmName("reverbBusAmountProperty") + set(`value`) { + setReverbAmount(value) + } + + /** + * The degree to which this area's reverb is a uniform effect. Ranges from `0` to `1` with `0.1` + * precision. + */ + public final inline var reverbBusUniformity: Float + @JvmName("reverbBusUniformityProperty") + get() = getReverbUniformity() + @JvmName("reverbBusUniformityProperty") + set(`value`) { + setReverbUniformity(value) + } + + public override fun new(scriptIndex: Int): Unit { + Internals.callConstructor(this, ENGINE_CLASS_AREA3D_INDEX, scriptIndex) + } + + /** + * If gravity is a point (see [gravityPoint]), this will be the point of attraction. + * + * This is a helper function to make dealing with local copies easier. + * + * For more information, see our + * [documentation](https://godot-kotl.in/en/stable/user-guide/api-differences/#core-types). + * + * Allow to directly modify the local copy of the property and assign it back to the Object. + * + * Prefer that over writing: + * `````` + * val myCoreType = area3d.gravityPointCenter + * //Your changes + * area3d.gravityPointCenter = myCoreType + * `````` + */ + @CoreTypeHelper + public final fun gravityPointCenterMutate(block: Vector3.() -> Unit): Vector3 = + gravityPointCenter.apply{ + block(this) + gravityPointCenter = this + } + + + /** + * The area's gravity vector (not normalized). + * + * This is a helper function to make dealing with local copies easier. + * + * For more information, see our + * [documentation](https://godot-kotl.in/en/stable/user-guide/api-differences/#core-types). + * + * Allow to directly modify the local copy of the property and assign it back to the Object. + * + * Prefer that over writing: + * `````` + * val myCoreType = area3d.gravityDirection + * //Your changes + * area3d.gravityDirection = myCoreType + * `````` + */ + @CoreTypeHelper + public final fun gravityDirectionMutate(block: Vector3.() -> Unit): Vector3 = + gravityDirection.apply{ + block(this) + gravityDirection = this + } + + + public final fun setGravitySpaceOverrideMode(spaceOverrideMode: SpaceOverride): Unit { + Internals.writeArguments(LONG to spaceOverrideMode.id) + Internals.callMethod(rawPtr, MethodBindings.setGravitySpaceOverrideModePtr, NIL) + } + + public final fun getGravitySpaceOverrideMode(): SpaceOverride { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getGravitySpaceOverrideModePtr, LONG) + return Area3D.SpaceOverride.from(Internals.readReturnValue(LONG) as Long) + } + + public final fun setGravityIsPoint(enable: Boolean): Unit { + Internals.writeArguments(BOOL to enable) + Internals.callMethod(rawPtr, MethodBindings.setGravityIsPointPtr, NIL) + } + + public final fun isGravityAPoint(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isGravityAPointPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public final fun setGravityPointUnitDistance(distanceScale: Float): Unit { + Internals.writeArguments(DOUBLE to distanceScale.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setGravityPointUnitDistancePtr, NIL) + } + + public final fun getGravityPointUnitDistance(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getGravityPointUnitDistancePtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setGravityPointCenter(center: Vector3): Unit { + Internals.writeArguments(VECTOR3 to center) + Internals.callMethod(rawPtr, MethodBindings.setGravityPointCenterPtr, NIL) + } + + public final fun getGravityPointCenter(): Vector3 { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getGravityPointCenterPtr, VECTOR3) + return (Internals.readReturnValue(VECTOR3) as Vector3) + } + + public final fun setGravityDirection(direction: Vector3): Unit { + Internals.writeArguments(VECTOR3 to direction) + Internals.callMethod(rawPtr, MethodBindings.setGravityDirectionPtr, NIL) + } + + public final fun getGravityDirection(): Vector3 { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getGravityDirectionPtr, VECTOR3) + return (Internals.readReturnValue(VECTOR3) as Vector3) + } + + public final fun setGravity(gravity: Float): Unit { + Internals.writeArguments(DOUBLE to gravity.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setGravityPtr, NIL) + } + + public final fun getGravity(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getGravityPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setLinearDampSpaceOverrideMode(spaceOverrideMode: SpaceOverride): Unit { + Internals.writeArguments(LONG to spaceOverrideMode.id) + Internals.callMethod(rawPtr, MethodBindings.setLinearDampSpaceOverrideModePtr, NIL) + } + + public final fun getLinearDampSpaceOverrideMode(): SpaceOverride { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getLinearDampSpaceOverrideModePtr, LONG) + return Area3D.SpaceOverride.from(Internals.readReturnValue(LONG) as Long) + } + + public final fun setAngularDampSpaceOverrideMode(spaceOverrideMode: SpaceOverride): Unit { + Internals.writeArguments(LONG to spaceOverrideMode.id) + Internals.callMethod(rawPtr, MethodBindings.setAngularDampSpaceOverrideModePtr, NIL) + } + + public final fun getAngularDampSpaceOverrideMode(): SpaceOverride { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getAngularDampSpaceOverrideModePtr, LONG) + return Area3D.SpaceOverride.from(Internals.readReturnValue(LONG) as Long) + } + + public final fun setAngularDamp(angularDamp: Float): Unit { + Internals.writeArguments(DOUBLE to angularDamp.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setAngularDampPtr, NIL) + } + + public final fun getAngularDamp(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getAngularDampPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setLinearDamp(linearDamp: Float): Unit { + Internals.writeArguments(DOUBLE to linearDamp.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setLinearDampPtr, NIL) + } + + public final fun getLinearDamp(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getLinearDampPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setPriority(priority: Int): Unit { + Internals.writeArguments(LONG to priority.toLong()) + Internals.callMethod(rawPtr, MethodBindings.setPriorityPtr, NIL) + } + + public final fun getPriority(): Int { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getPriorityPtr, LONG) + return (Internals.readReturnValue(LONG) as Long).toInt() + } + + public final fun setWindForceMagnitude(windForceMagnitude: Float): Unit { + Internals.writeArguments(DOUBLE to windForceMagnitude.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setWindForceMagnitudePtr, NIL) + } + + public final fun getWindForceMagnitude(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getWindForceMagnitudePtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setWindAttenuationFactor(windAttenuationFactor: Float): Unit { + Internals.writeArguments(DOUBLE to windAttenuationFactor.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setWindAttenuationFactorPtr, NIL) + } + + public final fun getWindAttenuationFactor(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getWindAttenuationFactorPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setWindSourcePath(windSourcePath: NodePath): Unit { + Internals.writeArguments(NODE_PATH to windSourcePath) + Internals.callMethod(rawPtr, MethodBindings.setWindSourcePathPtr, NIL) + } + + public final fun getWindSourcePath(): NodePath { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getWindSourcePathPtr, NODE_PATH) + return (Internals.readReturnValue(NODE_PATH) as NodePath) + } + + public final fun setMonitorable(enable: Boolean): Unit { + Internals.writeArguments(BOOL to enable) + Internals.callMethod(rawPtr, MethodBindings.setMonitorablePtr, NIL) + } + + public final fun isMonitorable(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isMonitorablePtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public final fun setMonitoring(enable: Boolean): Unit { + Internals.writeArguments(BOOL to enable) + Internals.callMethod(rawPtr, MethodBindings.setMonitoringPtr, NIL) + } + + public final fun isMonitoring(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isMonitoringPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + /** + * Returns a list of intersecting [PhysicsBody3D]s and [GridMap]s. The overlapping body's + * [CollisionObject3D.collisionLayer] must be part of this area's [CollisionObject3D.collisionMask] + * in order to be detected. + * For performance reasons (collisions are all processed at the same time) this list is modified + * once during the physics step, not immediately after objects are moved. Consider using signals + * instead. + */ + public final fun getOverlappingBodies(): VariantArray { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getOverlappingBodiesPtr, ARRAY) + return (Internals.readReturnValue(ARRAY) as VariantArray) + } + + /** + * Returns a list of intersecting [Area3D]s. The overlapping area's + * [CollisionObject3D.collisionLayer] must be part of this area's [CollisionObject3D.collisionMask] + * in order to be detected. + * For performance reasons (collisions are all processed at the same time) this list is modified + * once during the physics step, not immediately after objects are moved. Consider using signals + * instead. + */ + public final fun getOverlappingAreas(): VariantArray { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getOverlappingAreasPtr, ARRAY) + return (Internals.readReturnValue(ARRAY) as VariantArray) + } + + /** + * Returns `true` if intersecting any [PhysicsBody3D]s or [GridMap]s, otherwise returns `false`. + * The overlapping body's [CollisionObject3D.collisionLayer] must be part of this area's + * [CollisionObject3D.collisionMask] in order to be detected. + * For performance reasons (collisions are all processed at the same time) the list of overlapping + * bodies is modified once during the physics step, not immediately after objects are moved. Consider + * using signals instead. + */ + public final fun hasOverlappingBodies(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.hasOverlappingBodiesPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + /** + * Returns `true` if intersecting any [Area3D]s, otherwise returns `false`. The overlapping area's + * [CollisionObject3D.collisionLayer] must be part of this area's [CollisionObject3D.collisionMask] + * in order to be detected. + * For performance reasons (collisions are all processed at the same time) the list of overlapping + * areas is modified once during the physics step, not immediately after objects are moved. Consider + * using signals instead. + */ + public final fun hasOverlappingAreas(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.hasOverlappingAreasPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + /** + * Returns `true` if the given physics body intersects or overlaps this [Area3D], `false` + * otherwise. + * **Note:** The result of this test is not immediate after moving objects. For performance, list + * of overlaps is updated once per frame and before the physics step. Consider using signals instead. + * The [body] argument can either be a [PhysicsBody3D] or a [GridMap] instance. While GridMaps are + * not physics body themselves, they register their tiles with collision shapes as a virtual physics + * body. + */ + public final fun overlapsBody(body: Node?): Boolean { + Internals.writeArguments(OBJECT to body) + Internals.callMethod(rawPtr, MethodBindings.overlapsBodyPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + /** + * Returns `true` if the given [Area3D] intersects or overlaps this [Area3D], `false` otherwise. + * **Note:** The result of this test is not immediate after moving objects. For performance, list + * of overlaps is updated once per frame and before the physics step. Consider using signals instead. + */ + public final fun overlapsArea(area: Node?): Boolean { + Internals.writeArguments(OBJECT to area) + Internals.callMethod(rawPtr, MethodBindings.overlapsAreaPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public final fun setAudioBusOverride(enable: Boolean): Unit { + Internals.writeArguments(BOOL to enable) + Internals.callMethod(rawPtr, MethodBindings.setAudioBusOverridePtr, NIL) + } + + public final fun isOverridingAudioBus(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isOverridingAudioBusPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public final fun setAudioBusName(name: StringName): Unit { + Internals.writeArguments(STRING_NAME to name) + Internals.callMethod(rawPtr, MethodBindings.setAudioBusNamePtr, NIL) + } + + public final fun getAudioBusName(): StringName { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getAudioBusNamePtr, STRING_NAME) + return (Internals.readReturnValue(STRING_NAME) as StringName) + } + + public final fun setUseReverbBus(enable: Boolean): Unit { + Internals.writeArguments(BOOL to enable) + Internals.callMethod(rawPtr, MethodBindings.setUseReverbBusPtr, NIL) + } + + public final fun isUsingReverbBus(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isUsingReverbBusPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public final fun setReverbBusName(name: StringName): Unit { + Internals.writeArguments(STRING_NAME to name) + Internals.callMethod(rawPtr, MethodBindings.setReverbBusNamePtr, NIL) + } + + public final fun getReverbBusName(): StringName { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getReverbBusNamePtr, STRING_NAME) + return (Internals.readReturnValue(STRING_NAME) as StringName) + } + + public final fun setReverbAmount(amount: Float): Unit { + Internals.writeArguments(DOUBLE to amount.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setReverbAmountPtr, NIL) + } + + public final fun getReverbAmount(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getReverbAmountPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setReverbUniformity(amount: Float): Unit { + Internals.writeArguments(DOUBLE to amount.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setReverbUniformityPtr, NIL) + } + + public final fun getReverbUniformity(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getReverbUniformityPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public enum class SpaceOverride( + id: Long, + ) { + /** + * This area does not affect gravity/damping. + */ + SPACE_OVERRIDE_DISABLED(0), + /** + * This area adds its gravity/damping values to whatever has been calculated so far (in + * [priority] order). + */ + SPACE_OVERRIDE_COMBINE(1), + /** + * This area adds its gravity/damping values to whatever has been calculated so far (in + * [priority] order), ignoring any lower priority areas. + */ + SPACE_OVERRIDE_COMBINE_REPLACE(2), + /** + * This area replaces any gravity/damping, even the defaults, ignoring any lower priority areas. + */ + SPACE_OVERRIDE_REPLACE(3), + /** + * This area replaces any gravity/damping calculated so far (in [priority] order), but keeps + * calculating the rest of the areas. + */ + SPACE_OVERRIDE_REPLACE_COMBINE(4), + ; + + public val id: Long + init { + this.id = id + } + + public companion object { + public fun from(`value`: Long): SpaceOverride = entries.single { it.id == `value` } + } + } + + public companion object + + public object MethodBindings { + internal val setGravitySpaceOverrideModePtr: VoidPtr = + Internals.getMethodBindPtr("Area3D", "set_gravity_space_override_mode", 2311433571) + + internal val getGravitySpaceOverrideModePtr: VoidPtr = + Internals.getMethodBindPtr("Area3D", "get_gravity_space_override_mode", 958191869) + + internal val setGravityIsPointPtr: VoidPtr = + Internals.getMethodBindPtr("Area3D", "set_gravity_is_point", 2586408642) + + internal val isGravityAPointPtr: VoidPtr = + Internals.getMethodBindPtr("Area3D", "is_gravity_a_point", 36873697) + + internal val setGravityPointUnitDistancePtr: VoidPtr = + Internals.getMethodBindPtr("Area3D", "set_gravity_point_unit_distance", 373806689) + + internal val getGravityPointUnitDistancePtr: VoidPtr = + Internals.getMethodBindPtr("Area3D", "get_gravity_point_unit_distance", 1740695150) + + internal val setGravityPointCenterPtr: VoidPtr = + Internals.getMethodBindPtr("Area3D", "set_gravity_point_center", 3460891852) + + internal val getGravityPointCenterPtr: VoidPtr = + Internals.getMethodBindPtr("Area3D", "get_gravity_point_center", 3360562783) + + internal val setGravityDirectionPtr: VoidPtr = + Internals.getMethodBindPtr("Area3D", "set_gravity_direction", 3460891852) + + internal val getGravityDirectionPtr: VoidPtr = + Internals.getMethodBindPtr("Area3D", "get_gravity_direction", 3360562783) + + internal val setGravityPtr: VoidPtr = + Internals.getMethodBindPtr("Area3D", "set_gravity", 373806689) + + internal val getGravityPtr: VoidPtr = + Internals.getMethodBindPtr("Area3D", "get_gravity", 1740695150) + + internal val setLinearDampSpaceOverrideModePtr: VoidPtr = + Internals.getMethodBindPtr("Area3D", "set_linear_damp_space_override_mode", 2311433571) + + internal val getLinearDampSpaceOverrideModePtr: VoidPtr = + Internals.getMethodBindPtr("Area3D", "get_linear_damp_space_override_mode", 958191869) + + internal val setAngularDampSpaceOverrideModePtr: VoidPtr = + Internals.getMethodBindPtr("Area3D", "set_angular_damp_space_override_mode", 2311433571) + + internal val getAngularDampSpaceOverrideModePtr: VoidPtr = + Internals.getMethodBindPtr("Area3D", "get_angular_damp_space_override_mode", 958191869) + + internal val setAngularDampPtr: VoidPtr = + Internals.getMethodBindPtr("Area3D", "set_angular_damp", 373806689) + + internal val getAngularDampPtr: VoidPtr = + Internals.getMethodBindPtr("Area3D", "get_angular_damp", 1740695150) + + internal val setLinearDampPtr: VoidPtr = + Internals.getMethodBindPtr("Area3D", "set_linear_damp", 373806689) + + internal val getLinearDampPtr: VoidPtr = + Internals.getMethodBindPtr("Area3D", "get_linear_damp", 1740695150) + + internal val setPriorityPtr: VoidPtr = + Internals.getMethodBindPtr("Area3D", "set_priority", 1286410249) + + internal val getPriorityPtr: VoidPtr = + Internals.getMethodBindPtr("Area3D", "get_priority", 3905245786) + + internal val setWindForceMagnitudePtr: VoidPtr = + Internals.getMethodBindPtr("Area3D", "set_wind_force_magnitude", 373806689) + + internal val getWindForceMagnitudePtr: VoidPtr = + Internals.getMethodBindPtr("Area3D", "get_wind_force_magnitude", 1740695150) + + internal val setWindAttenuationFactorPtr: VoidPtr = + Internals.getMethodBindPtr("Area3D", "set_wind_attenuation_factor", 373806689) + + internal val getWindAttenuationFactorPtr: VoidPtr = + Internals.getMethodBindPtr("Area3D", "get_wind_attenuation_factor", 1740695150) + + internal val setWindSourcePathPtr: VoidPtr = + Internals.getMethodBindPtr("Area3D", "set_wind_source_path", 1348162250) + + internal val getWindSourcePathPtr: VoidPtr = + Internals.getMethodBindPtr("Area3D", "get_wind_source_path", 4075236667) + + internal val setMonitorablePtr: VoidPtr = + Internals.getMethodBindPtr("Area3D", "set_monitorable", 2586408642) + + internal val isMonitorablePtr: VoidPtr = + Internals.getMethodBindPtr("Area3D", "is_monitorable", 36873697) + + internal val setMonitoringPtr: VoidPtr = + Internals.getMethodBindPtr("Area3D", "set_monitoring", 2586408642) + + internal val isMonitoringPtr: VoidPtr = + Internals.getMethodBindPtr("Area3D", "is_monitoring", 36873697) + + internal val getOverlappingBodiesPtr: VoidPtr = + Internals.getMethodBindPtr("Area3D", "get_overlapping_bodies", 3995934104) + + internal val getOverlappingAreasPtr: VoidPtr = + Internals.getMethodBindPtr("Area3D", "get_overlapping_areas", 3995934104) + + internal val hasOverlappingBodiesPtr: VoidPtr = + Internals.getMethodBindPtr("Area3D", "has_overlapping_bodies", 36873697) + + internal val hasOverlappingAreasPtr: VoidPtr = + Internals.getMethodBindPtr("Area3D", "has_overlapping_areas", 36873697) + + internal val overlapsBodyPtr: VoidPtr = + Internals.getMethodBindPtr("Area3D", "overlaps_body", 3093956946) + + internal val overlapsAreaPtr: VoidPtr = + Internals.getMethodBindPtr("Area3D", "overlaps_area", 3093956946) + + internal val setAudioBusOverridePtr: VoidPtr = + Internals.getMethodBindPtr("Area3D", "set_audio_bus_override", 2586408642) + + internal val isOverridingAudioBusPtr: VoidPtr = + Internals.getMethodBindPtr("Area3D", "is_overriding_audio_bus", 36873697) + + internal val setAudioBusNamePtr: VoidPtr = + Internals.getMethodBindPtr("Area3D", "set_audio_bus_name", 3304788590) + + internal val getAudioBusNamePtr: VoidPtr = + Internals.getMethodBindPtr("Area3D", "get_audio_bus_name", 2002593661) + + internal val setUseReverbBusPtr: VoidPtr = + Internals.getMethodBindPtr("Area3D", "set_use_reverb_bus", 2586408642) + + internal val isUsingReverbBusPtr: VoidPtr = + Internals.getMethodBindPtr("Area3D", "is_using_reverb_bus", 36873697) + + internal val setReverbBusNamePtr: VoidPtr = + Internals.getMethodBindPtr("Area3D", "set_reverb_bus_name", 3304788590) + + internal val getReverbBusNamePtr: VoidPtr = + Internals.getMethodBindPtr("Area3D", "get_reverb_bus_name", 2002593661) + + internal val setReverbAmountPtr: VoidPtr = + Internals.getMethodBindPtr("Area3D", "set_reverb_amount", 373806689) + + internal val getReverbAmountPtr: VoidPtr = + Internals.getMethodBindPtr("Area3D", "get_reverb_amount", 1740695150) + + internal val setReverbUniformityPtr: VoidPtr = + Internals.getMethodBindPtr("Area3D", "set_reverb_uniformity", 373806689) + + internal val getReverbUniformityPtr: VoidPtr = + Internals.getMethodBindPtr("Area3D", "get_reverb_uniformity", 1740695150) + } +} diff --git a/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/ArrayMesh.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/ArrayMesh.kt new file mode 100644 index 0000000000..a5be754dd0 --- /dev/null +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/ArrayMesh.kt @@ -0,0 +1,473 @@ +// THIS FILE IS GENERATED! DO NOT EDIT IT MANUALLY! +@file:Suppress("PackageDirectoryMismatch", "unused", "FunctionName", "RedundantModalityModifier", + "UNCHECKED_CAST", "JoinDeclarationAndAssignment", "USELESS_CAST", + "RemoveRedundantQualifierName", "NOTHING_TO_INLINE", "NON_FINAL_MEMBER_IN_OBJECT", + "RedundantVisibilityModifier", "RedundantUnitReturnType", "MemberVisibilityCanBePrivate") + +package godot + +import godot.Mesh.ArrayFormatValue +import godot.`annotation`.CoreTypeHelper +import godot.`annotation`.CoreTypeLocalCopy +import godot.`annotation`.GodotBaseType +import godot.core.AABB +import godot.core.Dictionary +import godot.core.PackedByteArray +import godot.core.StringName +import godot.core.Transform3D +import godot.core.VariantArray +import godot.core.VariantParser.ARRAY +import godot.core.VariantParser.DICTIONARY +import godot.core.VariantParser.DOUBLE +import godot.core.VariantParser.LONG +import godot.core.VariantParser.NIL +import godot.core.VariantParser.OBJECT +import godot.core.VariantParser.PACKED_BYTE_ARRAY +import godot.core.VariantParser.STRING +import godot.core.VariantParser.STRING_NAME +import godot.core.VariantParser.TRANSFORM3D +import godot.util.Internals +import godot.util.VoidPtr +import kotlin.Any +import kotlin.Float +import kotlin.Int +import kotlin.Long +import kotlin.String +import kotlin.Suppress +import kotlin.Unit +import kotlin.jvm.JvmName +import kotlin.jvm.JvmOverloads + +private const val ENGINE_CLASS_ARRAYMESH_INDEX: Int = 75 + +/** + * The [ArrayMesh] is used to construct a [Mesh] by specifying the attributes as arrays. + * The most basic example is the creation of a single triangle: + * + * gdscript: + * ```gdscript + * var vertices = PackedVector3Array() + * vertices.push_back(Vector3(0, 1, 0)) + * vertices.push_back(Vector3(1, 0, 0)) + * vertices.push_back(Vector3(0, 0, 1)) + * + * # Initialize the ArrayMesh. + * var arr_mesh = ArrayMesh.new() + * var arrays = [] + * arrays.resize(Mesh.ARRAY_MAX) + * arrays[Mesh.ARRAY_VERTEX] = vertices + * + * # Create the Mesh. + * arr_mesh.add_surface_from_arrays(Mesh.PRIMITIVE_TRIANGLES, arrays) + * var m = MeshInstance3D.new() + * m.mesh = arr_mesh + * ``` + * csharp: + * ```csharp + * var vertices = new Vector3[] + * { + * new Vector3(0, 1, 0), + * new Vector3(1, 0, 0), + * new Vector3(0, 0, 1), + * }; + * + * // Initialize the ArrayMesh. + * var arrMesh = new ArrayMesh(); + * var arrays = new Godot.Collections.Array(); + * arrays.Resize((int)Mesh.ArrayType.Max); + * arrays[(int)Mesh.ArrayType.Vertex] = vertices; + * + * // Create the Mesh. + * arrMesh.AddSurfaceFromArrays(Mesh.PrimitiveType.Triangles, arrays); + * var m = new MeshInstance3D(); + * m.Mesh = arrMesh; + * ``` + * + * The [MeshInstance3D] is ready to be added to the [SceneTree] to be shown. + * See also [ImmediateMesh], [MeshDataTool] and [SurfaceTool] for procedural geometry generation. + * **Note:** Godot uses clockwise [url=https://learnopengl.com/Advanced-OpenGL/Face-culling]winding + * order[/url] for front faces of triangle primitive modes. + */ +@GodotBaseType +public open class ArrayMesh : Mesh() { + /** + * Sets the blend shape mode to one of [Mesh.BlendShapeMode]. + */ + public final inline var blendShapeMode: Mesh.BlendShapeMode + @JvmName("blendShapeModeProperty") + get() = getBlendShapeMode() + @JvmName("blendShapeModeProperty") + set(`value`) { + setBlendShapeMode(value) + } + + /** + * Overrides the [AABB] with one defined by user for use with frustum culling. Especially useful + * to avoid unexpected culling when using a shader to offset vertices. + */ + @CoreTypeLocalCopy + public final inline var customAabb: AABB + @JvmName("customAabbProperty") + get() = getCustomAabb() + @JvmName("customAabbProperty") + set(`value`) { + setCustomAabb(value) + } + + /** + * An optional mesh which can be used for rendering shadows and the depth prepass. Can be used to + * increase performance by supplying a mesh with fused vertices and only vertex position data + * (without normals, UVs, colors, etc.). + * **Note:** This mesh must have exactly the same vertex positions as the source mesh (including + * the source mesh's LODs, if present). If vertex positions differ, then the mesh will not draw + * correctly. + */ + public final inline var shadowMesh: ArrayMesh? + @JvmName("shadowMeshProperty") + get() = getShadowMesh() + @JvmName("shadowMeshProperty") + set(`value`) { + setShadowMesh(value) + } + + public override fun new(scriptIndex: Int): Unit { + Internals.callConstructor(this, ENGINE_CLASS_ARRAYMESH_INDEX, scriptIndex) + } + + /** + * Overrides the [AABB] with one defined by user for use with frustum culling. Especially useful + * to avoid unexpected culling when using a shader to offset vertices. + * + * This is a helper function to make dealing with local copies easier. + * + * For more information, see our + * [documentation](https://godot-kotl.in/en/stable/user-guide/api-differences/#core-types). + * + * Allow to directly modify the local copy of the property and assign it back to the Object. + * + * Prefer that over writing: + * `````` + * val myCoreType = arraymesh.customAabb + * //Your changes + * arraymesh.customAabb = myCoreType + * `````` + */ + @CoreTypeHelper + public final fun customAabbMutate(block: AABB.() -> Unit): AABB = customAabb.apply{ + block(this) + customAabb = this + } + + + /** + * Adds name for a blend shape that will be added with [addSurfaceFromArrays]. Must be called + * before surface is added. + */ + public final fun addBlendShape(name: StringName): Unit { + Internals.writeArguments(STRING_NAME to name) + Internals.callMethod(rawPtr, MethodBindings.addBlendShapePtr, NIL) + } + + /** + * Returns the number of blend shapes that the [ArrayMesh] holds. + */ + public final fun getBlendShapeCount(): Int { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getBlendShapeCountPtr, LONG) + return (Internals.readReturnValue(LONG) as Long).toInt() + } + + /** + * Returns the name of the blend shape at this index. + */ + public final fun getBlendShapeName(index: Int): StringName { + Internals.writeArguments(LONG to index.toLong()) + Internals.callMethod(rawPtr, MethodBindings.getBlendShapeNamePtr, STRING_NAME) + return (Internals.readReturnValue(STRING_NAME) as StringName) + } + + /** + * Sets the name of the blend shape at this index. + */ + public final fun setBlendShapeName(index: Int, name: StringName): Unit { + Internals.writeArguments(LONG to index.toLong(), STRING_NAME to name) + Internals.callMethod(rawPtr, MethodBindings.setBlendShapeNamePtr, NIL) + } + + /** + * Removes all blend shapes from this [ArrayMesh]. + */ + public final fun clearBlendShapes(): Unit { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.clearBlendShapesPtr, NIL) + } + + public final fun setBlendShapeMode(mode: Mesh.BlendShapeMode): Unit { + Internals.writeArguments(LONG to mode.id) + Internals.callMethod(rawPtr, MethodBindings.setBlendShapeModePtr, NIL) + } + + public final fun getBlendShapeMode(): Mesh.BlendShapeMode { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getBlendShapeModePtr, LONG) + return Mesh.BlendShapeMode.from(Internals.readReturnValue(LONG) as Long) + } + + /** + * Creates a new surface. [Mesh.getSurfaceCount] will become the `surf_idx` for this new surface. + * Surfaces are created to be rendered using a [primitive], which may be any of the values defined + * in [Mesh.PrimitiveType]. + * The [arrays] argument is an array of arrays. Each of the [Mesh.ARRAY_MAX] elements contains an + * array with some of the mesh data for this surface as described by the corresponding member of + * [Mesh.ArrayType] or `null` if it is not used by the surface. For example, `arrays[0]` is the array + * of vertices. That first vertex sub-array is always required; the others are optional. Adding an + * index array puts this surface into "index mode" where the vertex and other arrays become the + * sources of data and the index array defines the vertex order. All sub-arrays must have the same + * length as the vertex array (or be an exact multiple of the vertex array's length, when multiple + * elements of a sub-array correspond to a single vertex) or be empty, except for [Mesh.ARRAY_INDEX] + * if it is used. + * The [blendShapes] argument is an array of vertex data for each blend shape. Each element is an + * array of the same structure as [arrays], but [Mesh.ARRAY_VERTEX], [Mesh.ARRAY_NORMAL], and + * [Mesh.ARRAY_TANGENT] are set if and only if they are set in [arrays] and all other entries are + * `null`. + * The [lods] argument is a dictionary with [float] keys and [PackedInt32Array] values. Each entry + * in the dictionary represents an LOD level of the surface, where the value is the + * [Mesh.ARRAY_INDEX] array to use for the LOD level and the key is roughly proportional to the + * distance at which the LOD stats being used. I.e., increasing the key of an LOD also increases the + * distance that the objects has to be from the camera before the LOD is used. + * The [flags] argument is the bitwise or of, as required: One value of [Mesh.ArrayCustomFormat] + * left shifted by `ARRAY_FORMAT_CUSTOMn_SHIFT` for each custom channel in use, + * [Mesh.ARRAY_FLAG_USE_DYNAMIC_UPDATE], [Mesh.ARRAY_FLAG_USE_8_BONE_WEIGHTS], or + * [Mesh.ARRAY_FLAG_USES_EMPTY_VERTEX_ARRAY]. + * **Note:** When using indices, it is recommended to only use points, lines, or triangles. + */ + @JvmOverloads + public final fun addSurfaceFromArrays( + primitive: Mesh.PrimitiveType, + arrays: VariantArray, + blendShapes: VariantArray> = godot.core.variantArrayOf(), + lods: Dictionary = Dictionary(), + flags: Mesh.ArrayFormat = Mesh.ArrayFormatValue(0), + ): Unit { + Internals.writeArguments(LONG to primitive.id, ARRAY to arrays, ARRAY to blendShapes, DICTIONARY to lods, LONG to flags.flag) + Internals.callMethod(rawPtr, MethodBindings.addSurfaceFromArraysPtr, NIL) + } + + /** + * Removes all surfaces from this [ArrayMesh]. + */ + public final fun clearSurfaces(): Unit { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.clearSurfacesPtr, NIL) + } + + public final fun surfaceUpdateVertexRegion( + surfIdx: Int, + offset: Int, + `data`: PackedByteArray, + ): Unit { + Internals.writeArguments(LONG to surfIdx.toLong(), LONG to offset.toLong(), PACKED_BYTE_ARRAY to data) + Internals.callMethod(rawPtr, MethodBindings.surfaceUpdateVertexRegionPtr, NIL) + } + + public final fun surfaceUpdateAttributeRegion( + surfIdx: Int, + offset: Int, + `data`: PackedByteArray, + ): Unit { + Internals.writeArguments(LONG to surfIdx.toLong(), LONG to offset.toLong(), PACKED_BYTE_ARRAY to data) + Internals.callMethod(rawPtr, MethodBindings.surfaceUpdateAttributeRegionPtr, NIL) + } + + public final fun surfaceUpdateSkinRegion( + surfIdx: Int, + offset: Int, + `data`: PackedByteArray, + ): Unit { + Internals.writeArguments(LONG to surfIdx.toLong(), LONG to offset.toLong(), PACKED_BYTE_ARRAY to data) + Internals.callMethod(rawPtr, MethodBindings.surfaceUpdateSkinRegionPtr, NIL) + } + + /** + * Returns the length in vertices of the vertex array in the requested surface (see + * [addSurfaceFromArrays]). + */ + public final fun surfaceGetArrayLen(surfIdx: Int): Int { + Internals.writeArguments(LONG to surfIdx.toLong()) + Internals.callMethod(rawPtr, MethodBindings.surfaceGetArrayLenPtr, LONG) + return (Internals.readReturnValue(LONG) as Long).toInt() + } + + /** + * Returns the length in indices of the index array in the requested surface (see + * [addSurfaceFromArrays]). + */ + public final fun surfaceGetArrayIndexLen(surfIdx: Int): Int { + Internals.writeArguments(LONG to surfIdx.toLong()) + Internals.callMethod(rawPtr, MethodBindings.surfaceGetArrayIndexLenPtr, LONG) + return (Internals.readReturnValue(LONG) as Long).toInt() + } + + /** + * Returns the format mask of the requested surface (see [addSurfaceFromArrays]). + */ + public final fun surfaceGetFormat(surfIdx: Int): Mesh.ArrayFormat { + Internals.writeArguments(LONG to surfIdx.toLong()) + Internals.callMethod(rawPtr, MethodBindings.surfaceGetFormatPtr, LONG) + return ArrayFormatValue(Internals.readReturnValue(LONG) as Long) + } + + /** + * Returns the primitive type of the requested surface (see [addSurfaceFromArrays]). + */ + public final fun surfaceGetPrimitiveType(surfIdx: Int): Mesh.PrimitiveType { + Internals.writeArguments(LONG to surfIdx.toLong()) + Internals.callMethod(rawPtr, MethodBindings.surfaceGetPrimitiveTypePtr, LONG) + return Mesh.PrimitiveType.from(Internals.readReturnValue(LONG) as Long) + } + + /** + * Returns the index of the first surface with this name held within this [ArrayMesh]. If none are + * found, -1 is returned. + */ + public final fun surfaceFindByName(name: String): Int { + Internals.writeArguments(STRING to name) + Internals.callMethod(rawPtr, MethodBindings.surfaceFindByNamePtr, LONG) + return (Internals.readReturnValue(LONG) as Long).toInt() + } + + /** + * Sets a name for a given surface. + */ + public final fun surfaceSetName(surfIdx: Int, name: String): Unit { + Internals.writeArguments(LONG to surfIdx.toLong(), STRING to name) + Internals.callMethod(rawPtr, MethodBindings.surfaceSetNamePtr, NIL) + } + + /** + * Gets the name assigned to this surface. + */ + public final fun surfaceGetName(surfIdx: Int): String { + Internals.writeArguments(LONG to surfIdx.toLong()) + Internals.callMethod(rawPtr, MethodBindings.surfaceGetNamePtr, STRING) + return (Internals.readReturnValue(STRING) as String) + } + + /** + * Regenerates tangents for each of the [ArrayMesh]'s surfaces. + */ + public final fun regenNormalMaps(): Unit { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.regenNormalMapsPtr, NIL) + } + + /** + * Performs a UV unwrap on the [ArrayMesh] to prepare the mesh for lightmapping. + */ + public final fun lightmapUnwrap(transform: Transform3D, texelSize: Float): Error { + Internals.writeArguments(TRANSFORM3D to transform, DOUBLE to texelSize.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.lightmapUnwrapPtr, LONG) + return Error.from(Internals.readReturnValue(LONG) as Long) + } + + public final fun setCustomAabb(aabb: AABB): Unit { + Internals.writeArguments(godot.core.VariantParser.AABB to aabb) + Internals.callMethod(rawPtr, MethodBindings.setCustomAabbPtr, NIL) + } + + public final fun getCustomAabb(): AABB { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getCustomAabbPtr, godot.core.VariantParser.AABB) + return (Internals.readReturnValue(godot.core.VariantParser.AABB) as AABB) + } + + public final fun setShadowMesh(mesh: ArrayMesh?): Unit { + Internals.writeArguments(OBJECT to mesh) + Internals.callMethod(rawPtr, MethodBindings.setShadowMeshPtr, NIL) + } + + public final fun getShadowMesh(): ArrayMesh? { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getShadowMeshPtr, OBJECT) + return (Internals.readReturnValue(OBJECT) as ArrayMesh?) + } + + public companion object + + public object MethodBindings { + internal val addBlendShapePtr: VoidPtr = + Internals.getMethodBindPtr("ArrayMesh", "add_blend_shape", 3304788590) + + internal val getBlendShapeCountPtr: VoidPtr = + Internals.getMethodBindPtr("ArrayMesh", "get_blend_shape_count", 3905245786) + + internal val getBlendShapeNamePtr: VoidPtr = + Internals.getMethodBindPtr("ArrayMesh", "get_blend_shape_name", 659327637) + + internal val setBlendShapeNamePtr: VoidPtr = + Internals.getMethodBindPtr("ArrayMesh", "set_blend_shape_name", 3780747571) + + internal val clearBlendShapesPtr: VoidPtr = + Internals.getMethodBindPtr("ArrayMesh", "clear_blend_shapes", 3218959716) + + internal val setBlendShapeModePtr: VoidPtr = + Internals.getMethodBindPtr("ArrayMesh", "set_blend_shape_mode", 227983991) + + internal val getBlendShapeModePtr: VoidPtr = + Internals.getMethodBindPtr("ArrayMesh", "get_blend_shape_mode", 836485024) + + internal val addSurfaceFromArraysPtr: VoidPtr = + Internals.getMethodBindPtr("ArrayMesh", "add_surface_from_arrays", 1796411378) + + internal val clearSurfacesPtr: VoidPtr = + Internals.getMethodBindPtr("ArrayMesh", "clear_surfaces", 3218959716) + + internal val surfaceUpdateVertexRegionPtr: VoidPtr = + Internals.getMethodBindPtr("ArrayMesh", "surface_update_vertex_region", 3837166854) + + internal val surfaceUpdateAttributeRegionPtr: VoidPtr = + Internals.getMethodBindPtr("ArrayMesh", "surface_update_attribute_region", 3837166854) + + internal val surfaceUpdateSkinRegionPtr: VoidPtr = + Internals.getMethodBindPtr("ArrayMesh", "surface_update_skin_region", 3837166854) + + internal val surfaceGetArrayLenPtr: VoidPtr = + Internals.getMethodBindPtr("ArrayMesh", "surface_get_array_len", 923996154) + + internal val surfaceGetArrayIndexLenPtr: VoidPtr = + Internals.getMethodBindPtr("ArrayMesh", "surface_get_array_index_len", 923996154) + + internal val surfaceGetFormatPtr: VoidPtr = + Internals.getMethodBindPtr("ArrayMesh", "surface_get_format", 3718287884) + + internal val surfaceGetPrimitiveTypePtr: VoidPtr = + Internals.getMethodBindPtr("ArrayMesh", "surface_get_primitive_type", 4141943888) + + internal val surfaceFindByNamePtr: VoidPtr = + Internals.getMethodBindPtr("ArrayMesh", "surface_find_by_name", 1321353865) + + internal val surfaceSetNamePtr: VoidPtr = + Internals.getMethodBindPtr("ArrayMesh", "surface_set_name", 501894301) + + internal val surfaceGetNamePtr: VoidPtr = + Internals.getMethodBindPtr("ArrayMesh", "surface_get_name", 844755477) + + internal val regenNormalMapsPtr: VoidPtr = + Internals.getMethodBindPtr("ArrayMesh", "regen_normal_maps", 3218959716) + + internal val lightmapUnwrapPtr: VoidPtr = + Internals.getMethodBindPtr("ArrayMesh", "lightmap_unwrap", 1476641071) + + internal val setCustomAabbPtr: VoidPtr = + Internals.getMethodBindPtr("ArrayMesh", "set_custom_aabb", 259215842) + + internal val getCustomAabbPtr: VoidPtr = + Internals.getMethodBindPtr("ArrayMesh", "get_custom_aabb", 1068685055) + + internal val setShadowMeshPtr: VoidPtr = + Internals.getMethodBindPtr("ArrayMesh", "set_shadow_mesh", 3377897901) + + internal val getShadowMeshPtr: VoidPtr = + Internals.getMethodBindPtr("ArrayMesh", "get_shadow_mesh", 3206942465) + } +} diff --git a/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/ArrayOccluder3D.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/ArrayOccluder3D.kt new file mode 100644 index 0000000000..666535151a --- /dev/null +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/ArrayOccluder3D.kt @@ -0,0 +1,95 @@ +// THIS FILE IS GENERATED! DO NOT EDIT IT MANUALLY! +@file:Suppress("PackageDirectoryMismatch", "unused", "FunctionName", "RedundantModalityModifier", + "UNCHECKED_CAST", "JoinDeclarationAndAssignment", "USELESS_CAST", + "RemoveRedundantQualifierName", "NOTHING_TO_INLINE", "NON_FINAL_MEMBER_IN_OBJECT", + "RedundantVisibilityModifier", "RedundantUnitReturnType", "MemberVisibilityCanBePrivate") + +package godot + +import godot.`annotation`.GodotBaseType +import godot.core.PackedInt32Array +import godot.core.PackedVector3Array +import godot.core.VariantParser.NIL +import godot.core.VariantParser.PACKED_INT_32_ARRAY +import godot.core.VariantParser.PACKED_VECTOR3_ARRAY +import godot.util.Internals +import godot.util.VoidPtr +import kotlin.Int +import kotlin.Suppress +import kotlin.Unit +import kotlin.jvm.JvmName + +private const val ENGINE_CLASS_ARRAYOCCLUDER3D_INDEX: Int = 76 + +/** + * [ArrayOccluder3D] stores an arbitrary 3D polygon shape that can be used by the engine's occlusion + * culling system. This is analogous to [ArrayMesh], but for occluders. + * See [OccluderInstance3D]'s documentation for instructions on setting up occlusion culling. + */ +@GodotBaseType +public open class ArrayOccluder3D : Occluder3D() { + /** + * The occluder's vertex positions in local 3D coordinates. + * **Note:** The occluder is always updated after setting this value. If creating occluders + * procedurally, consider using [setArrays] instead to avoid updating the occluder twice when it's + * created. + */ + public final inline var vertices: PackedVector3Array + @JvmName("verticesProperty") + get() = getVertices() + @JvmName("verticesProperty") + set(`value`) { + setVertices(value) + } + + /** + * The occluder's index position. Indices determine which points from the [vertices] array should + * be drawn, and in which order. + * **Note:** The occluder is always updated after setting this value. If creating occluders + * procedurally, consider using [setArrays] instead to avoid updating the occluder twice when it's + * created. + */ + public final inline var indices: PackedInt32Array + @JvmName("indicesProperty") + get() = getIndices() + @JvmName("indicesProperty") + set(`value`) { + setIndices(value) + } + + public override fun new(scriptIndex: Int): Unit { + Internals.callConstructor(this, ENGINE_CLASS_ARRAYOCCLUDER3D_INDEX, scriptIndex) + } + + /** + * Sets [indices] and [vertices], while updating the final occluder only once after both values + * are set. + */ + public final fun setArrays(vertices: PackedVector3Array, indices: PackedInt32Array): Unit { + Internals.writeArguments(PACKED_VECTOR3_ARRAY to vertices, PACKED_INT_32_ARRAY to indices) + Internals.callMethod(rawPtr, MethodBindings.setArraysPtr, NIL) + } + + public final fun setVertices(vertices: PackedVector3Array): Unit { + Internals.writeArguments(PACKED_VECTOR3_ARRAY to vertices) + Internals.callMethod(rawPtr, MethodBindings.setVerticesPtr, NIL) + } + + public final fun setIndices(indices: PackedInt32Array): Unit { + Internals.writeArguments(PACKED_INT_32_ARRAY to indices) + Internals.callMethod(rawPtr, MethodBindings.setIndicesPtr, NIL) + } + + public companion object + + public object MethodBindings { + internal val setArraysPtr: VoidPtr = + Internals.getMethodBindPtr("ArrayOccluder3D", "set_arrays", 3233972621) + + internal val setVerticesPtr: VoidPtr = + Internals.getMethodBindPtr("ArrayOccluder3D", "set_vertices", 334873810) + + internal val setIndicesPtr: VoidPtr = + Internals.getMethodBindPtr("ArrayOccluder3D", "set_indices", 3614634198) + } +} diff --git a/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AspectRatioContainer.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AspectRatioContainer.kt new file mode 100644 index 0000000000..2d2979568e --- /dev/null +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AspectRatioContainer.kt @@ -0,0 +1,215 @@ +// THIS FILE IS GENERATED! DO NOT EDIT IT MANUALLY! +@file:Suppress("PackageDirectoryMismatch", "unused", "FunctionName", "RedundantModalityModifier", + "UNCHECKED_CAST", "JoinDeclarationAndAssignment", "USELESS_CAST", + "RemoveRedundantQualifierName", "NOTHING_TO_INLINE", "NON_FINAL_MEMBER_IN_OBJECT", + "RedundantVisibilityModifier", "RedundantUnitReturnType", "MemberVisibilityCanBePrivate") + +package godot + +import godot.`annotation`.GodotBaseType +import godot.core.VariantParser.DOUBLE +import godot.core.VariantParser.LONG +import godot.core.VariantParser.NIL +import godot.util.Internals +import godot.util.VoidPtr +import kotlin.Double +import kotlin.Float +import kotlin.Int +import kotlin.Long +import kotlin.Suppress +import kotlin.Unit +import kotlin.jvm.JvmName + +private const val ENGINE_CLASS_ASPECTRATIOCONTAINER_INDEX: Int = 77 + +/** + * A container type that arranges its child controls in a way that preserves their proportions + * automatically when the container is resized. Useful when a container has a dynamic size and the + * child nodes must adjust their sizes accordingly without losing their aspect ratios. + */ +@GodotBaseType +public open class AspectRatioContainer : Container() { + /** + * The aspect ratio to enforce on child controls. This is the width divided by the height. The + * ratio depends on the [stretchMode]. + */ + public final inline var ratio: Float + @JvmName("ratioProperty") + get() = getRatio() + @JvmName("ratioProperty") + set(`value`) { + setRatio(value) + } + + /** + * The stretch mode used to align child controls. + */ + public final inline var stretchMode: StretchMode + @JvmName("stretchModeProperty") + get() = getStretchMode() + @JvmName("stretchModeProperty") + set(`value`) { + setStretchMode(value) + } + + /** + * Specifies the horizontal relative position of child controls. + */ + public final inline var alignmentHorizontal: AlignmentMode + @JvmName("alignmentHorizontalProperty") + get() = getAlignmentHorizontal() + @JvmName("alignmentHorizontalProperty") + set(`value`) { + setAlignmentHorizontal(value) + } + + /** + * Specifies the vertical relative position of child controls. + */ + public final inline var alignmentVertical: AlignmentMode + @JvmName("alignmentVerticalProperty") + get() = getAlignmentVertical() + @JvmName("alignmentVerticalProperty") + set(`value`) { + setAlignmentVertical(value) + } + + public override fun new(scriptIndex: Int): Unit { + Internals.callConstructor(this, ENGINE_CLASS_ASPECTRATIOCONTAINER_INDEX, scriptIndex) + } + + public final fun setRatio(ratio: Float): Unit { + Internals.writeArguments(DOUBLE to ratio.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setRatioPtr, NIL) + } + + public final fun getRatio(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getRatioPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setStretchMode(stretchMode: StretchMode): Unit { + Internals.writeArguments(LONG to stretchMode.id) + Internals.callMethod(rawPtr, MethodBindings.setStretchModePtr, NIL) + } + + public final fun getStretchMode(): StretchMode { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getStretchModePtr, LONG) + return AspectRatioContainer.StretchMode.from(Internals.readReturnValue(LONG) as Long) + } + + public final fun setAlignmentHorizontal(alignmentHorizontal: AlignmentMode): Unit { + Internals.writeArguments(LONG to alignmentHorizontal.id) + Internals.callMethod(rawPtr, MethodBindings.setAlignmentHorizontalPtr, NIL) + } + + public final fun getAlignmentHorizontal(): AlignmentMode { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getAlignmentHorizontalPtr, LONG) + return AspectRatioContainer.AlignmentMode.from(Internals.readReturnValue(LONG) as Long) + } + + public final fun setAlignmentVertical(alignmentVertical: AlignmentMode): Unit { + Internals.writeArguments(LONG to alignmentVertical.id) + Internals.callMethod(rawPtr, MethodBindings.setAlignmentVerticalPtr, NIL) + } + + public final fun getAlignmentVertical(): AlignmentMode { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getAlignmentVerticalPtr, LONG) + return AspectRatioContainer.AlignmentMode.from(Internals.readReturnValue(LONG) as Long) + } + + public enum class StretchMode( + id: Long, + ) { + /** + * The height of child controls is automatically adjusted based on the width of the container. + */ + STRETCH_WIDTH_CONTROLS_HEIGHT(0), + /** + * The width of child controls is automatically adjusted based on the height of the container. + */ + STRETCH_HEIGHT_CONTROLS_WIDTH(1), + /** + * The bounding rectangle of child controls is automatically adjusted to fit inside the + * container while keeping the aspect ratio. + */ + STRETCH_FIT(2), + /** + * The width and height of child controls is automatically adjusted to make their bounding + * rectangle cover the entire area of the container while keeping the aspect ratio. + * When the bounding rectangle of child controls exceed the container's size and + * [Control.clipContents] is enabled, this allows to show only the container's area restricted by + * its own bounding rectangle. + */ + STRETCH_COVER(3), + ; + + public val id: Long + init { + this.id = id + } + + public companion object { + public fun from(`value`: Long): StretchMode = entries.single { it.id == `value` } + } + } + + public enum class AlignmentMode( + id: Long, + ) { + /** + * Aligns child controls with the beginning (left or top) of the container. + */ + ALIGNMENT_BEGIN(0), + /** + * Aligns child controls with the center of the container. + */ + ALIGNMENT_CENTER(1), + /** + * Aligns child controls with the end (right or bottom) of the container. + */ + ALIGNMENT_END(2), + ; + + public val id: Long + init { + this.id = id + } + + public companion object { + public fun from(`value`: Long): AlignmentMode = entries.single { it.id == `value` } + } + } + + public companion object + + public object MethodBindings { + internal val setRatioPtr: VoidPtr = + Internals.getMethodBindPtr("AspectRatioContainer", "set_ratio", 373806689) + + internal val getRatioPtr: VoidPtr = + Internals.getMethodBindPtr("AspectRatioContainer", "get_ratio", 1740695150) + + internal val setStretchModePtr: VoidPtr = + Internals.getMethodBindPtr("AspectRatioContainer", "set_stretch_mode", 1876743467) + + internal val getStretchModePtr: VoidPtr = + Internals.getMethodBindPtr("AspectRatioContainer", "get_stretch_mode", 3416449033) + + internal val setAlignmentHorizontalPtr: VoidPtr = + Internals.getMethodBindPtr("AspectRatioContainer", "set_alignment_horizontal", 2147829016) + + internal val getAlignmentHorizontalPtr: VoidPtr = + Internals.getMethodBindPtr("AspectRatioContainer", "get_alignment_horizontal", 3838875429) + + internal val setAlignmentVerticalPtr: VoidPtr = + Internals.getMethodBindPtr("AspectRatioContainer", "set_alignment_vertical", 2147829016) + + internal val getAlignmentVerticalPtr: VoidPtr = + Internals.getMethodBindPtr("AspectRatioContainer", "get_alignment_vertical", 3838875429) + } +} diff --git a/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AtlasTexture.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AtlasTexture.kt new file mode 100644 index 0000000000..b38e48cff9 --- /dev/null +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AtlasTexture.kt @@ -0,0 +1,214 @@ +// THIS FILE IS GENERATED! DO NOT EDIT IT MANUALLY! +@file:Suppress("PackageDirectoryMismatch", "unused", "FunctionName", "RedundantModalityModifier", + "UNCHECKED_CAST", "JoinDeclarationAndAssignment", "USELESS_CAST", + "RemoveRedundantQualifierName", "NOTHING_TO_INLINE", "NON_FINAL_MEMBER_IN_OBJECT", + "RedundantVisibilityModifier", "RedundantUnitReturnType", "MemberVisibilityCanBePrivate") + +package godot + +import godot.`annotation`.CoreTypeHelper +import godot.`annotation`.CoreTypeLocalCopy +import godot.`annotation`.GodotBaseType +import godot.core.Rect2 +import godot.core.VariantParser.BOOL +import godot.core.VariantParser.NIL +import godot.core.VariantParser.OBJECT +import godot.core.VariantParser.RECT2 +import godot.util.Internals +import godot.util.VoidPtr +import kotlin.Boolean +import kotlin.Int +import kotlin.Suppress +import kotlin.Unit +import kotlin.jvm.JvmName + +private const val ENGINE_CLASS_ATLASTEXTURE_INDEX: Int = 78 + +/** + * [Texture2D] resource that draws only part of its [atlas] texture, as defined by the [region]. An + * additional [margin] can also be set, which is useful for small adjustments. + * Multiple [AtlasTexture] resources can be cropped from the same [atlas]. Packing many smaller + * textures into a singular large texture helps to optimize video memory costs and render calls. + * **Note:** [AtlasTexture] cannot be used in an [AnimatedTexture], and may not tile properly in + * nodes such as [TextureRect], when inside other [AtlasTexture] resources. + */ +@GodotBaseType +public open class AtlasTexture : Texture2D() { + /** + * The texture that contains the atlas. Can be any type inheriting from [Texture2D], including + * another [AtlasTexture]. + */ + public final inline var atlas: Texture2D? + @JvmName("atlasProperty") + get() = getAtlas() + @JvmName("atlasProperty") + set(`value`) { + setAtlas(value) + } + + /** + * The region used to draw the [atlas]. If either dimension of the region's size is `0`, the value + * from [atlas] size will be used for that axis instead. + */ + @CoreTypeLocalCopy + public final inline var region: Rect2 + @JvmName("regionProperty") + get() = getRegion() + @JvmName("regionProperty") + set(`value`) { + setRegion(value) + } + + /** + * The margin around the [region]. Useful for small adjustments. If the [Rect2.size] of this + * property ("w" and "h" in the editor) is set, the drawn texture is resized to fit within the + * margin. + */ + @CoreTypeLocalCopy + public final inline var margin: Rect2 + @JvmName("marginProperty") + get() = getMargin() + @JvmName("marginProperty") + set(`value`) { + setMargin(value) + } + + /** + * If `true`, the area outside of the [region] is clipped to avoid bleeding of the surrounding + * texture pixels. + */ + public final inline var filterClip: Boolean + @JvmName("filterClipProperty") + get() = hasFilterClip() + @JvmName("filterClipProperty") + set(`value`) { + setFilterClip(value) + } + + public override fun new(scriptIndex: Int): Unit { + Internals.callConstructor(this, ENGINE_CLASS_ATLASTEXTURE_INDEX, scriptIndex) + } + + /** + * The region used to draw the [atlas]. If either dimension of the region's size is `0`, the value + * from [atlas] size will be used for that axis instead. + * + * This is a helper function to make dealing with local copies easier. + * + * For more information, see our + * [documentation](https://godot-kotl.in/en/stable/user-guide/api-differences/#core-types). + * + * Allow to directly modify the local copy of the property and assign it back to the Object. + * + * Prefer that over writing: + * `````` + * val myCoreType = atlastexture.region + * //Your changes + * atlastexture.region = myCoreType + * `````` + */ + @CoreTypeHelper + public final fun regionMutate(block: Rect2.() -> Unit): Rect2 = region.apply{ + block(this) + region = this + } + + + /** + * The margin around the [region]. Useful for small adjustments. If the [Rect2.size] of this + * property ("w" and "h" in the editor) is set, the drawn texture is resized to fit within the + * margin. + * + * This is a helper function to make dealing with local copies easier. + * + * For more information, see our + * [documentation](https://godot-kotl.in/en/stable/user-guide/api-differences/#core-types). + * + * Allow to directly modify the local copy of the property and assign it back to the Object. + * + * Prefer that over writing: + * `````` + * val myCoreType = atlastexture.margin + * //Your changes + * atlastexture.margin = myCoreType + * `````` + */ + @CoreTypeHelper + public final fun marginMutate(block: Rect2.() -> Unit): Rect2 = margin.apply{ + block(this) + margin = this + } + + + public final fun setAtlas(atlas: Texture2D?): Unit { + Internals.writeArguments(OBJECT to atlas) + Internals.callMethod(rawPtr, MethodBindings.setAtlasPtr, NIL) + } + + public final fun getAtlas(): Texture2D? { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getAtlasPtr, OBJECT) + return (Internals.readReturnValue(OBJECT) as Texture2D?) + } + + public final fun setRegion(region: Rect2): Unit { + Internals.writeArguments(RECT2 to region) + Internals.callMethod(rawPtr, MethodBindings.setRegionPtr, NIL) + } + + public final fun getRegion(): Rect2 { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getRegionPtr, RECT2) + return (Internals.readReturnValue(RECT2) as Rect2) + } + + public final fun setMargin(margin: Rect2): Unit { + Internals.writeArguments(RECT2 to margin) + Internals.callMethod(rawPtr, MethodBindings.setMarginPtr, NIL) + } + + public final fun getMargin(): Rect2 { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getMarginPtr, RECT2) + return (Internals.readReturnValue(RECT2) as Rect2) + } + + public final fun setFilterClip(enable: Boolean): Unit { + Internals.writeArguments(BOOL to enable) + Internals.callMethod(rawPtr, MethodBindings.setFilterClipPtr, NIL) + } + + public final fun hasFilterClip(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.hasFilterClipPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public companion object + + public object MethodBindings { + internal val setAtlasPtr: VoidPtr = + Internals.getMethodBindPtr("AtlasTexture", "set_atlas", 4051416890) + + internal val getAtlasPtr: VoidPtr = + Internals.getMethodBindPtr("AtlasTexture", "get_atlas", 3635182373) + + internal val setRegionPtr: VoidPtr = + Internals.getMethodBindPtr("AtlasTexture", "set_region", 2046264180) + + internal val getRegionPtr: VoidPtr = + Internals.getMethodBindPtr("AtlasTexture", "get_region", 1639390495) + + internal val setMarginPtr: VoidPtr = + Internals.getMethodBindPtr("AtlasTexture", "set_margin", 2046264180) + + internal val getMarginPtr: VoidPtr = + Internals.getMethodBindPtr("AtlasTexture", "get_margin", 1639390495) + + internal val setFilterClipPtr: VoidPtr = + Internals.getMethodBindPtr("AtlasTexture", "set_filter_clip", 2586408642) + + internal val hasFilterClipPtr: VoidPtr = + Internals.getMethodBindPtr("AtlasTexture", "has_filter_clip", 36873697) + } +} diff --git a/kt/godot-library/src/main/kotlin/godot/gen/godot/AudioBusLayout.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioBusLayout.kt similarity index 79% rename from kt/godot-library/src/main/kotlin/godot/gen/godot/AudioBusLayout.kt rename to kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioBusLayout.kt index 3f50c28ea2..2ee22542b0 100644 --- a/kt/godot-library/src/main/kotlin/godot/gen/godot/AudioBusLayout.kt +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioBusLayout.kt @@ -7,10 +7,13 @@ package godot import godot.`annotation`.GodotBaseType +import godot.util.Internals import kotlin.Int import kotlin.Suppress import kotlin.Unit +private const val ENGINE_CLASS_AUDIOBUSLAYOUT_INDEX: Int = 79 + /** * Stores position, muting, solo, bypass, effects, effect position, volume, and the connections * between buses. See [AudioServer] for usage. @@ -18,10 +21,10 @@ import kotlin.Unit @GodotBaseType public open class AudioBusLayout : Resource() { public override fun new(scriptIndex: Int): Unit { - callConstructor(ENGINECLASS_AUDIOBUSLAYOUT, scriptIndex) + Internals.callConstructor(this, ENGINE_CLASS_AUDIOBUSLAYOUT_INDEX, scriptIndex) } public companion object - internal object MethodBindings + public object MethodBindings } diff --git a/kt/godot-library/src/main/kotlin/godot/gen/godot/AudioEffect.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioEffect.kt similarity index 91% rename from kt/godot-library/src/main/kotlin/godot/gen/godot/AudioEffect.kt rename to kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioEffect.kt index a6254a9773..a278225cf7 100644 --- a/kt/godot-library/src/main/kotlin/godot/gen/godot/AudioEffect.kt +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioEffect.kt @@ -7,11 +7,14 @@ package godot import godot.`annotation`.GodotBaseType +import godot.util.Internals import kotlin.Int import kotlin.NotImplementedError import kotlin.Suppress import kotlin.Unit +private const val ENGINE_CLASS_AUDIOEFFECT_INDEX: Int = 80 + /** * The base [Resource] for every audio effect. In the editor, an audio effect can be added to the * current bus layout through the Audio panel. At run-time, it is also possible to manipulate audio @@ -24,7 +27,7 @@ import kotlin.Unit @GodotBaseType public open class AudioEffect : Resource() { public override fun new(scriptIndex: Int): Unit { - callConstructor(ENGINECLASS_AUDIOEFFECT, scriptIndex) + Internals.callConstructor(this, ENGINE_CLASS_AUDIOEFFECT_INDEX, scriptIndex) } /** @@ -51,5 +54,5 @@ public open class AudioEffect : Resource() { public companion object - internal object MethodBindings + public object MethodBindings } diff --git a/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioEffectAmplify.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioEffectAmplify.kt new file mode 100644 index 0000000000..a941d46848 --- /dev/null +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioEffectAmplify.kt @@ -0,0 +1,64 @@ +// THIS FILE IS GENERATED! DO NOT EDIT IT MANUALLY! +@file:Suppress("PackageDirectoryMismatch", "unused", "FunctionName", "RedundantModalityModifier", + "UNCHECKED_CAST", "JoinDeclarationAndAssignment", "USELESS_CAST", + "RemoveRedundantQualifierName", "NOTHING_TO_INLINE", "NON_FINAL_MEMBER_IN_OBJECT", + "RedundantVisibilityModifier", "RedundantUnitReturnType", "MemberVisibilityCanBePrivate") + +package godot + +import godot.`annotation`.GodotBaseType +import godot.core.VariantParser.DOUBLE +import godot.core.VariantParser.NIL +import godot.util.Internals +import godot.util.VoidPtr +import kotlin.Double +import kotlin.Float +import kotlin.Int +import kotlin.Suppress +import kotlin.Unit +import kotlin.jvm.JvmName + +private const val ENGINE_CLASS_AUDIOEFFECTAMPLIFY_INDEX: Int = 81 + +/** + * Increases or decreases the volume being routed through the audio bus. + */ +@GodotBaseType +public open class AudioEffectAmplify : AudioEffect() { + /** + * Amount of amplification in decibels. Positive values make the sound louder, negative values + * make it quieter. Value can range from -80 to 24. + */ + public final inline var volumeDb: Float + @JvmName("volumeDbProperty") + get() = getVolumeDb() + @JvmName("volumeDbProperty") + set(`value`) { + setVolumeDb(value) + } + + public override fun new(scriptIndex: Int): Unit { + Internals.callConstructor(this, ENGINE_CLASS_AUDIOEFFECTAMPLIFY_INDEX, scriptIndex) + } + + public final fun setVolumeDb(volume: Float): Unit { + Internals.writeArguments(DOUBLE to volume.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setVolumeDbPtr, NIL) + } + + public final fun getVolumeDb(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getVolumeDbPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public companion object + + public object MethodBindings { + internal val setVolumeDbPtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectAmplify", "set_volume_db", 373806689) + + internal val getVolumeDbPtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectAmplify", "get_volume_db", 1740695150) + } +} diff --git a/kt/godot-library/src/main/kotlin/godot/gen/godot/AudioEffectBandLimitFilter.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioEffectBandLimitFilter.kt similarity index 78% rename from kt/godot-library/src/main/kotlin/godot/gen/godot/AudioEffectBandLimitFilter.kt rename to kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioEffectBandLimitFilter.kt index 61aa5b933f..675163505c 100644 --- a/kt/godot-library/src/main/kotlin/godot/gen/godot/AudioEffectBandLimitFilter.kt +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioEffectBandLimitFilter.kt @@ -7,10 +7,13 @@ package godot import godot.`annotation`.GodotBaseType +import godot.util.Internals import kotlin.Int import kotlin.Suppress import kotlin.Unit +private const val ENGINE_CLASS_AUDIOEFFECTBANDLIMITFILTER_INDEX: Int = 82 + /** * Limits the frequencies in a range around the [AudioEffectFilter.cutoffHz] and allows frequencies * outside of this range to pass. @@ -18,10 +21,10 @@ import kotlin.Unit @GodotBaseType public open class AudioEffectBandLimitFilter : AudioEffectFilter() { public override fun new(scriptIndex: Int): Unit { - callConstructor(ENGINECLASS_AUDIOEFFECTBANDLIMITFILTER, scriptIndex) + Internals.callConstructor(this, ENGINE_CLASS_AUDIOEFFECTBANDLIMITFILTER_INDEX, scriptIndex) } public companion object - internal object MethodBindings + public object MethodBindings } diff --git a/kt/godot-library/src/main/kotlin/godot/gen/godot/AudioEffectBandPassFilter.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioEffectBandPassFilter.kt similarity index 78% rename from kt/godot-library/src/main/kotlin/godot/gen/godot/AudioEffectBandPassFilter.kt rename to kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioEffectBandPassFilter.kt index 779e90d197..ad51ff7890 100644 --- a/kt/godot-library/src/main/kotlin/godot/gen/godot/AudioEffectBandPassFilter.kt +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioEffectBandPassFilter.kt @@ -7,10 +7,13 @@ package godot import godot.`annotation`.GodotBaseType +import godot.util.Internals import kotlin.Int import kotlin.Suppress import kotlin.Unit +private const val ENGINE_CLASS_AUDIOEFFECTBANDPASSFILTER_INDEX: Int = 83 + /** * Attenuates the frequencies inside of a range around the [AudioEffectFilter.cutoffHz] and cuts * frequencies outside of this band. @@ -18,10 +21,10 @@ import kotlin.Unit @GodotBaseType public open class AudioEffectBandPassFilter : AudioEffectFilter() { public override fun new(scriptIndex: Int): Unit { - callConstructor(ENGINECLASS_AUDIOEFFECTBANDPASSFILTER, scriptIndex) + Internals.callConstructor(this, ENGINE_CLASS_AUDIOEFFECTBANDPASSFILTER_INDEX, scriptIndex) } public companion object - internal object MethodBindings + public object MethodBindings } diff --git a/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioEffectCapture.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioEffectCapture.kt new file mode 100644 index 0000000000..f93d7afabe --- /dev/null +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioEffectCapture.kt @@ -0,0 +1,167 @@ +// THIS FILE IS GENERATED! DO NOT EDIT IT MANUALLY! +@file:Suppress("PackageDirectoryMismatch", "unused", "FunctionName", "RedundantModalityModifier", + "UNCHECKED_CAST", "JoinDeclarationAndAssignment", "USELESS_CAST", + "RemoveRedundantQualifierName", "NOTHING_TO_INLINE", "NON_FINAL_MEMBER_IN_OBJECT", + "RedundantVisibilityModifier", "RedundantUnitReturnType", "MemberVisibilityCanBePrivate") + +package godot + +import godot.`annotation`.GodotBaseType +import godot.core.PackedVector2Array +import godot.core.VariantParser.BOOL +import godot.core.VariantParser.DOUBLE +import godot.core.VariantParser.LONG +import godot.core.VariantParser.NIL +import godot.core.VariantParser.PACKED_VECTOR2_ARRAY +import godot.util.Internals +import godot.util.VoidPtr +import kotlin.Boolean +import kotlin.Double +import kotlin.Float +import kotlin.Int +import kotlin.Long +import kotlin.Suppress +import kotlin.Unit +import kotlin.jvm.JvmName + +private const val ENGINE_CLASS_AUDIOEFFECTCAPTURE_INDEX: Int = 84 + +/** + * AudioEffectCapture is an AudioEffect which copies all audio frames from the attached audio effect + * bus into its internal ring buffer. + * Application code should consume these audio frames from this ring buffer using [getBuffer] and + * process it as needed, for example to capture data from an [AudioStreamMicrophone], implement + * application-defined effects, or to transmit audio over the network. When capturing audio data from a + * microphone, the format of the samples will be stereo 32-bit floating-point PCM. + * Unlike [AudioEffectRecord], this effect only returns the raw audio samples instead of encoding + * them into an [AudioStream]. + */ +@GodotBaseType +public open class AudioEffectCapture : AudioEffect() { + /** + * Length of the internal ring buffer, in seconds. Setting the buffer length will have no effect + * if already initialized. + */ + public final inline var bufferLength: Float + @JvmName("bufferLengthProperty") + get() = getBufferLength() + @JvmName("bufferLengthProperty") + set(`value`) { + setBufferLength(value) + } + + public override fun new(scriptIndex: Int): Unit { + Internals.callConstructor(this, ENGINE_CLASS_AUDIOEFFECTCAPTURE_INDEX, scriptIndex) + } + + /** + * Returns `true` if at least [frames] audio frames are available to read in the internal ring + * buffer. + */ + public final fun canGetBuffer(frames: Int): Boolean { + Internals.writeArguments(LONG to frames.toLong()) + Internals.callMethod(rawPtr, MethodBindings.canGetBufferPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + /** + * Gets the next [frames] audio samples from the internal ring buffer. + * Returns a [PackedVector2Array] containing exactly [frames] audio samples if available, or an + * empty [PackedVector2Array] if insufficient data was available. + * The samples are signed floating-point PCM between `-1` and `1`. You will have to scale them if + * you want to use them as 8 or 16-bit integer samples. (`v = 0x7fff * samples[0].x`) + */ + public final fun getBuffer(frames: Int): PackedVector2Array { + Internals.writeArguments(LONG to frames.toLong()) + Internals.callMethod(rawPtr, MethodBindings.getBufferPtr, PACKED_VECTOR2_ARRAY) + return (Internals.readReturnValue(PACKED_VECTOR2_ARRAY) as PackedVector2Array) + } + + /** + * Clears the internal ring buffer. + * **Note:** Calling this during a capture can cause the loss of samples which causes popping in + * the playback. + */ + public final fun clearBuffer(): Unit { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.clearBufferPtr, NIL) + } + + public final fun setBufferLength(bufferLengthSeconds: Float): Unit { + Internals.writeArguments(DOUBLE to bufferLengthSeconds.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setBufferLengthPtr, NIL) + } + + public final fun getBufferLength(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getBufferLengthPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + /** + * Returns the number of frames available to read using [getBuffer]. + */ + public final fun getFramesAvailable(): Int { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getFramesAvailablePtr, LONG) + return (Internals.readReturnValue(LONG) as Long).toInt() + } + + /** + * Returns the number of audio frames discarded from the audio bus due to full buffer. + */ + public final fun getDiscardedFrames(): Long { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getDiscardedFramesPtr, LONG) + return (Internals.readReturnValue(LONG) as Long) + } + + /** + * Returns the total size of the internal ring buffer in frames. + */ + public final fun getBufferLengthFrames(): Int { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getBufferLengthFramesPtr, LONG) + return (Internals.readReturnValue(LONG) as Long).toInt() + } + + /** + * Returns the number of audio frames inserted from the audio bus. + */ + public final fun getPushedFrames(): Long { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getPushedFramesPtr, LONG) + return (Internals.readReturnValue(LONG) as Long) + } + + public companion object + + public object MethodBindings { + internal val canGetBufferPtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectCapture", "can_get_buffer", 1116898809) + + internal val getBufferPtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectCapture", "get_buffer", 2649534757) + + internal val clearBufferPtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectCapture", "clear_buffer", 3218959716) + + internal val setBufferLengthPtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectCapture", "set_buffer_length", 373806689) + + internal val getBufferLengthPtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectCapture", "get_buffer_length", 191475506) + + internal val getFramesAvailablePtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectCapture", "get_frames_available", 3905245786) + + internal val getDiscardedFramesPtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectCapture", "get_discarded_frames", 3905245786) + + internal val getBufferLengthFramesPtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectCapture", "get_buffer_length_frames", 3905245786) + + internal val getPushedFramesPtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectCapture", "get_pushed_frames", 3905245786) + } +} diff --git a/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioEffectChorus.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioEffectChorus.kt new file mode 100644 index 0000000000..4526694e66 --- /dev/null +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioEffectChorus.kt @@ -0,0 +1,224 @@ +// THIS FILE IS GENERATED! DO NOT EDIT IT MANUALLY! +@file:Suppress("PackageDirectoryMismatch", "unused", "FunctionName", "RedundantModalityModifier", + "UNCHECKED_CAST", "JoinDeclarationAndAssignment", "USELESS_CAST", + "RemoveRedundantQualifierName", "NOTHING_TO_INLINE", "NON_FINAL_MEMBER_IN_OBJECT", + "RedundantVisibilityModifier", "RedundantUnitReturnType", "MemberVisibilityCanBePrivate") + +package godot + +import godot.`annotation`.GodotBaseType +import godot.core.VariantParser.DOUBLE +import godot.core.VariantParser.LONG +import godot.core.VariantParser.NIL +import godot.util.Internals +import godot.util.VoidPtr +import kotlin.Double +import kotlin.Float +import kotlin.Int +import kotlin.Long +import kotlin.Suppress +import kotlin.Unit +import kotlin.jvm.JvmName + +private const val ENGINE_CLASS_AUDIOEFFECTCHORUS_INDEX: Int = 85 + +/** + * Adds a chorus audio effect. The effect applies a filter with voices to duplicate the audio source + * and manipulate it through the filter. + */ +@GodotBaseType +public open class AudioEffectChorus : AudioEffect() { + /** + * The number of voices in the effect. + */ + public final inline var voiceCount: Int + @JvmName("voiceCountProperty") + get() = getVoiceCount() + @JvmName("voiceCountProperty") + set(`value`) { + setVoiceCount(value) + } + + /** + * The effect's raw signal. + */ + public final inline var dry: Float + @JvmName("dryProperty") + get() = getDry() + @JvmName("dryProperty") + set(`value`) { + setDry(value) + } + + /** + * The effect's processed signal. + */ + public final inline var wet: Float + @JvmName("wetProperty") + get() = getWet() + @JvmName("wetProperty") + set(`value`) { + setWet(value) + } + + public override fun new(scriptIndex: Int): Unit { + Internals.callConstructor(this, ENGINE_CLASS_AUDIOEFFECTCHORUS_INDEX, scriptIndex) + } + + public final fun setVoiceCount(voices: Int): Unit { + Internals.writeArguments(LONG to voices.toLong()) + Internals.callMethod(rawPtr, MethodBindings.setVoiceCountPtr, NIL) + } + + public final fun getVoiceCount(): Int { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getVoiceCountPtr, LONG) + return (Internals.readReturnValue(LONG) as Long).toInt() + } + + public final fun setVoiceDelayMs(voiceIdx: Int, delayMs: Float): Unit { + Internals.writeArguments(LONG to voiceIdx.toLong(), DOUBLE to delayMs.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setVoiceDelayMsPtr, NIL) + } + + public final fun getVoiceDelayMs(voiceIdx: Int): Float { + Internals.writeArguments(LONG to voiceIdx.toLong()) + Internals.callMethod(rawPtr, MethodBindings.getVoiceDelayMsPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setVoiceRateHz(voiceIdx: Int, rateHz: Float): Unit { + Internals.writeArguments(LONG to voiceIdx.toLong(), DOUBLE to rateHz.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setVoiceRateHzPtr, NIL) + } + + public final fun getVoiceRateHz(voiceIdx: Int): Float { + Internals.writeArguments(LONG to voiceIdx.toLong()) + Internals.callMethod(rawPtr, MethodBindings.getVoiceRateHzPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setVoiceDepthMs(voiceIdx: Int, depthMs: Float): Unit { + Internals.writeArguments(LONG to voiceIdx.toLong(), DOUBLE to depthMs.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setVoiceDepthMsPtr, NIL) + } + + public final fun getVoiceDepthMs(voiceIdx: Int): Float { + Internals.writeArguments(LONG to voiceIdx.toLong()) + Internals.callMethod(rawPtr, MethodBindings.getVoiceDepthMsPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setVoiceLevelDb(voiceIdx: Int, levelDb: Float): Unit { + Internals.writeArguments(LONG to voiceIdx.toLong(), DOUBLE to levelDb.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setVoiceLevelDbPtr, NIL) + } + + public final fun getVoiceLevelDb(voiceIdx: Int): Float { + Internals.writeArguments(LONG to voiceIdx.toLong()) + Internals.callMethod(rawPtr, MethodBindings.getVoiceLevelDbPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setVoiceCutoffHz(voiceIdx: Int, cutoffHz: Float): Unit { + Internals.writeArguments(LONG to voiceIdx.toLong(), DOUBLE to cutoffHz.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setVoiceCutoffHzPtr, NIL) + } + + public final fun getVoiceCutoffHz(voiceIdx: Int): Float { + Internals.writeArguments(LONG to voiceIdx.toLong()) + Internals.callMethod(rawPtr, MethodBindings.getVoiceCutoffHzPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setVoicePan(voiceIdx: Int, pan: Float): Unit { + Internals.writeArguments(LONG to voiceIdx.toLong(), DOUBLE to pan.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setVoicePanPtr, NIL) + } + + public final fun getVoicePan(voiceIdx: Int): Float { + Internals.writeArguments(LONG to voiceIdx.toLong()) + Internals.callMethod(rawPtr, MethodBindings.getVoicePanPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setWet(amount: Float): Unit { + Internals.writeArguments(DOUBLE to amount.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setWetPtr, NIL) + } + + public final fun getWet(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getWetPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setDry(amount: Float): Unit { + Internals.writeArguments(DOUBLE to amount.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setDryPtr, NIL) + } + + public final fun getDry(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getDryPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public companion object + + public object MethodBindings { + internal val setVoiceCountPtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectChorus", "set_voice_count", 1286410249) + + internal val getVoiceCountPtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectChorus", "get_voice_count", 3905245786) + + internal val setVoiceDelayMsPtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectChorus", "set_voice_delay_ms", 1602489585) + + internal val getVoiceDelayMsPtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectChorus", "get_voice_delay_ms", 2339986948) + + internal val setVoiceRateHzPtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectChorus", "set_voice_rate_hz", 1602489585) + + internal val getVoiceRateHzPtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectChorus", "get_voice_rate_hz", 2339986948) + + internal val setVoiceDepthMsPtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectChorus", "set_voice_depth_ms", 1602489585) + + internal val getVoiceDepthMsPtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectChorus", "get_voice_depth_ms", 2339986948) + + internal val setVoiceLevelDbPtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectChorus", "set_voice_level_db", 1602489585) + + internal val getVoiceLevelDbPtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectChorus", "get_voice_level_db", 2339986948) + + internal val setVoiceCutoffHzPtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectChorus", "set_voice_cutoff_hz", 1602489585) + + internal val getVoiceCutoffHzPtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectChorus", "get_voice_cutoff_hz", 2339986948) + + internal val setVoicePanPtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectChorus", "set_voice_pan", 1602489585) + + internal val getVoicePanPtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectChorus", "get_voice_pan", 2339986948) + + internal val setWetPtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectChorus", "set_wet", 373806689) + + internal val getWetPtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectChorus", "get_wet", 1740695150) + + internal val setDryPtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectChorus", "set_dry", 373806689) + + internal val getDryPtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectChorus", "get_dry", 1740695150) + } +} diff --git a/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioEffectCompressor.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioEffectCompressor.kt new file mode 100644 index 0000000000..03e7adfdde --- /dev/null +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioEffectCompressor.kt @@ -0,0 +1,247 @@ +// THIS FILE IS GENERATED! DO NOT EDIT IT MANUALLY! +@file:Suppress("PackageDirectoryMismatch", "unused", "FunctionName", "RedundantModalityModifier", + "UNCHECKED_CAST", "JoinDeclarationAndAssignment", "USELESS_CAST", + "RemoveRedundantQualifierName", "NOTHING_TO_INLINE", "NON_FINAL_MEMBER_IN_OBJECT", + "RedundantVisibilityModifier", "RedundantUnitReturnType", "MemberVisibilityCanBePrivate") + +package godot + +import godot.`annotation`.GodotBaseType +import godot.core.StringName +import godot.core.VariantParser.DOUBLE +import godot.core.VariantParser.NIL +import godot.core.VariantParser.STRING_NAME +import godot.util.Internals +import godot.util.VoidPtr +import kotlin.Double +import kotlin.Float +import kotlin.Int +import kotlin.Suppress +import kotlin.Unit +import kotlin.jvm.JvmName + +private const val ENGINE_CLASS_AUDIOEFFECTCOMPRESSOR_INDEX: Int = 86 + +/** + * Dynamic range compressor reduces the level of the sound when the amplitude goes over a certain + * threshold in Decibels. One of the main uses of a compressor is to increase the dynamic range by + * clipping as little as possible (when sound goes over 0dB). + * Compressor has many uses in the mix: + * - In the Master bus to compress the whole output (although an [AudioEffectLimiter] is probably + * better). + * - In voice channels to ensure they sound as balanced as possible. + * - Sidechained. This can reduce the sound level sidechained with another audio bus for threshold + * detection. This technique is common in video game mixing to the level of music and SFX while voices + * are being heard. + * - Accentuates transients by using a wider attack, making effects sound more punchy. + */ +@GodotBaseType +public open class AudioEffectCompressor : AudioEffect() { + /** + * The level above which compression is applied to the audio. Value can range from -60 to 0. + */ + public final inline var threshold: Float + @JvmName("thresholdProperty") + get() = getThreshold() + @JvmName("thresholdProperty") + set(`value`) { + setThreshold(value) + } + + /** + * Amount of compression applied to the audio once it passes the threshold level. The higher the + * ratio, the more the loud parts of the audio will be compressed. Value can range from 1 to 48. + */ + public final inline var ratio: Float + @JvmName("ratioProperty") + get() = getRatio() + @JvmName("ratioProperty") + set(`value`) { + setRatio(value) + } + + /** + * Gain applied to the output signal. + */ + public final inline var gain: Float + @JvmName("gainProperty") + get() = getGain() + @JvmName("gainProperty") + set(`value`) { + setGain(value) + } + + /** + * Compressor's reaction time when the signal exceeds the threshold, in microseconds. Value can + * range from 20 to 2000. + */ + public final inline var attackUs: Float + @JvmName("attackUsProperty") + get() = getAttackUs() + @JvmName("attackUsProperty") + set(`value`) { + setAttackUs(value) + } + + /** + * Compressor's delay time to stop reducing the signal after the signal level falls below the + * threshold, in milliseconds. Value can range from 20 to 2000. + */ + public final inline var releaseMs: Float + @JvmName("releaseMsProperty") + get() = getReleaseMs() + @JvmName("releaseMsProperty") + set(`value`) { + setReleaseMs(value) + } + + /** + * Balance between original signal and effect signal. Value can range from 0 (totally dry) to 1 + * (totally wet). + */ + public final inline var mix: Float + @JvmName("mixProperty") + get() = getMix() + @JvmName("mixProperty") + set(`value`) { + setMix(value) + } + + /** + * Reduce the sound level using another audio bus for threshold detection. + */ + public final inline var sidechain: StringName + @JvmName("sidechainProperty") + get() = getSidechain() + @JvmName("sidechainProperty") + set(`value`) { + setSidechain(value) + } + + public override fun new(scriptIndex: Int): Unit { + Internals.callConstructor(this, ENGINE_CLASS_AUDIOEFFECTCOMPRESSOR_INDEX, scriptIndex) + } + + public final fun setThreshold(threshold: Float): Unit { + Internals.writeArguments(DOUBLE to threshold.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setThresholdPtr, NIL) + } + + public final fun getThreshold(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getThresholdPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setRatio(ratio: Float): Unit { + Internals.writeArguments(DOUBLE to ratio.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setRatioPtr, NIL) + } + + public final fun getRatio(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getRatioPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setGain(gain: Float): Unit { + Internals.writeArguments(DOUBLE to gain.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setGainPtr, NIL) + } + + public final fun getGain(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getGainPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setAttackUs(attackUs: Float): Unit { + Internals.writeArguments(DOUBLE to attackUs.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setAttackUsPtr, NIL) + } + + public final fun getAttackUs(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getAttackUsPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setReleaseMs(releaseMs: Float): Unit { + Internals.writeArguments(DOUBLE to releaseMs.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setReleaseMsPtr, NIL) + } + + public final fun getReleaseMs(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getReleaseMsPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setMix(mix: Float): Unit { + Internals.writeArguments(DOUBLE to mix.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setMixPtr, NIL) + } + + public final fun getMix(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getMixPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setSidechain(sidechain: StringName): Unit { + Internals.writeArguments(STRING_NAME to sidechain) + Internals.callMethod(rawPtr, MethodBindings.setSidechainPtr, NIL) + } + + public final fun getSidechain(): StringName { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getSidechainPtr, STRING_NAME) + return (Internals.readReturnValue(STRING_NAME) as StringName) + } + + public companion object + + public object MethodBindings { + internal val setThresholdPtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectCompressor", "set_threshold", 373806689) + + internal val getThresholdPtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectCompressor", "get_threshold", 1740695150) + + internal val setRatioPtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectCompressor", "set_ratio", 373806689) + + internal val getRatioPtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectCompressor", "get_ratio", 1740695150) + + internal val setGainPtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectCompressor", "set_gain", 373806689) + + internal val getGainPtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectCompressor", "get_gain", 1740695150) + + internal val setAttackUsPtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectCompressor", "set_attack_us", 373806689) + + internal val getAttackUsPtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectCompressor", "get_attack_us", 1740695150) + + internal val setReleaseMsPtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectCompressor", "set_release_ms", 373806689) + + internal val getReleaseMsPtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectCompressor", "get_release_ms", 1740695150) + + internal val setMixPtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectCompressor", "set_mix", 373806689) + + internal val getMixPtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectCompressor", "get_mix", 1740695150) + + internal val setSidechainPtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectCompressor", "set_sidechain", 3304788590) + + internal val getSidechainPtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectCompressor", "get_sidechain", 2002593661) + } +} diff --git a/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioEffectDelay.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioEffectDelay.kt new file mode 100644 index 0000000000..00de401789 --- /dev/null +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioEffectDelay.kt @@ -0,0 +1,405 @@ +// THIS FILE IS GENERATED! DO NOT EDIT IT MANUALLY! +@file:Suppress("PackageDirectoryMismatch", "unused", "FunctionName", "RedundantModalityModifier", + "UNCHECKED_CAST", "JoinDeclarationAndAssignment", "USELESS_CAST", + "RemoveRedundantQualifierName", "NOTHING_TO_INLINE", "NON_FINAL_MEMBER_IN_OBJECT", + "RedundantVisibilityModifier", "RedundantUnitReturnType", "MemberVisibilityCanBePrivate") + +package godot + +import godot.`annotation`.GodotBaseType +import godot.core.VariantParser.BOOL +import godot.core.VariantParser.DOUBLE +import godot.core.VariantParser.NIL +import godot.util.Internals +import godot.util.VoidPtr +import kotlin.Boolean +import kotlin.Double +import kotlin.Float +import kotlin.Int +import kotlin.Suppress +import kotlin.Unit +import kotlin.jvm.JvmName + +private const val ENGINE_CLASS_AUDIOEFFECTDELAY_INDEX: Int = 87 + +/** + * Plays input signal back after a period of time. The delayed signal may be played back multiple + * times to create the sound of a repeating, decaying echo. Delay effects range from a subtle echo + * effect to a pronounced blending of previous sounds with new sounds. + */ +@GodotBaseType +public open class AudioEffectDelay : AudioEffect() { + /** + * Output percent of original sound. At 0, only delayed sounds are output. Value can range from 0 + * to 1. + */ + public final inline var dry: Float + @JvmName("dryProperty") + get() = getDry() + @JvmName("dryProperty") + set(`value`) { + setDry(value) + } + + /** + * If `true`, the first tap will be enabled. + */ + public final inline var tap1Active: Boolean + @JvmName("tap1ActiveProperty") + get() = isTap1Active() + @JvmName("tap1ActiveProperty") + set(`value`) { + setTap1Active(value) + } + + /** + * First tap delay time in milliseconds. + */ + public final inline var tap1DelayMs: Float + @JvmName("tap1DelayMsProperty") + get() = getTap1DelayMs() + @JvmName("tap1DelayMsProperty") + set(`value`) { + setTap1DelayMs(value) + } + + /** + * Sound level for the first tap. + */ + public final inline var tap1LevelDb: Float + @JvmName("tap1LevelDbProperty") + get() = getTap1LevelDb() + @JvmName("tap1LevelDbProperty") + set(`value`) { + setTap1LevelDb(value) + } + + /** + * Pan position for the first tap. Value can range from -1 (fully left) to 1 (fully right). + */ + public final inline var tap1Pan: Float + @JvmName("tap1PanProperty") + get() = getTap1Pan() + @JvmName("tap1PanProperty") + set(`value`) { + setTap1Pan(value) + } + + /** + * If `true`, the second tap will be enabled. + */ + public final inline var tap2Active: Boolean + @JvmName("tap2ActiveProperty") + get() = isTap2Active() + @JvmName("tap2ActiveProperty") + set(`value`) { + setTap2Active(value) + } + + /** + * Second tap delay time in milliseconds. + */ + public final inline var tap2DelayMs: Float + @JvmName("tap2DelayMsProperty") + get() = getTap2DelayMs() + @JvmName("tap2DelayMsProperty") + set(`value`) { + setTap2DelayMs(value) + } + + /** + * Sound level for the second tap. + */ + public final inline var tap2LevelDb: Float + @JvmName("tap2LevelDbProperty") + get() = getTap2LevelDb() + @JvmName("tap2LevelDbProperty") + set(`value`) { + setTap2LevelDb(value) + } + + /** + * Pan position for the second tap. Value can range from -1 (fully left) to 1 (fully right). + */ + public final inline var tap2Pan: Float + @JvmName("tap2PanProperty") + get() = getTap2Pan() + @JvmName("tap2PanProperty") + set(`value`) { + setTap2Pan(value) + } + + /** + * If `true`, feedback is enabled. + */ + public final inline var feedbackActive: Boolean + @JvmName("feedbackActiveProperty") + get() = isFeedbackActive() + @JvmName("feedbackActiveProperty") + set(`value`) { + setFeedbackActive(value) + } + + /** + * Feedback delay time in milliseconds. + */ + public final inline var feedbackDelayMs: Float + @JvmName("feedbackDelayMsProperty") + get() = getFeedbackDelayMs() + @JvmName("feedbackDelayMsProperty") + set(`value`) { + setFeedbackDelayMs(value) + } + + /** + * Sound level for feedback. + */ + public final inline var feedbackLevelDb: Float + @JvmName("feedbackLevelDbProperty") + get() = getFeedbackLevelDb() + @JvmName("feedbackLevelDbProperty") + set(`value`) { + setFeedbackLevelDb(value) + } + + /** + * Low-pass filter for feedback, in Hz. Frequencies below this value are filtered out of the + * source signal. + */ + public final inline var feedbackLowpass: Float + @JvmName("feedbackLowpassProperty") + get() = getFeedbackLowpass() + @JvmName("feedbackLowpassProperty") + set(`value`) { + setFeedbackLowpass(value) + } + + public override fun new(scriptIndex: Int): Unit { + Internals.callConstructor(this, ENGINE_CLASS_AUDIOEFFECTDELAY_INDEX, scriptIndex) + } + + public final fun setDry(amount: Float): Unit { + Internals.writeArguments(DOUBLE to amount.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setDryPtr, NIL) + } + + public final fun getDry(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getDryPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setTap1Active(amount: Boolean): Unit { + Internals.writeArguments(BOOL to amount) + Internals.callMethod(rawPtr, MethodBindings.setTap1ActivePtr, NIL) + } + + public final fun isTap1Active(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isTap1ActivePtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public final fun setTap1DelayMs(amount: Float): Unit { + Internals.writeArguments(DOUBLE to amount.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setTap1DelayMsPtr, NIL) + } + + public final fun getTap1DelayMs(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getTap1DelayMsPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setTap1LevelDb(amount: Float): Unit { + Internals.writeArguments(DOUBLE to amount.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setTap1LevelDbPtr, NIL) + } + + public final fun getTap1LevelDb(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getTap1LevelDbPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setTap1Pan(amount: Float): Unit { + Internals.writeArguments(DOUBLE to amount.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setTap1PanPtr, NIL) + } + + public final fun getTap1Pan(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getTap1PanPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setTap2Active(amount: Boolean): Unit { + Internals.writeArguments(BOOL to amount) + Internals.callMethod(rawPtr, MethodBindings.setTap2ActivePtr, NIL) + } + + public final fun isTap2Active(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isTap2ActivePtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public final fun setTap2DelayMs(amount: Float): Unit { + Internals.writeArguments(DOUBLE to amount.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setTap2DelayMsPtr, NIL) + } + + public final fun getTap2DelayMs(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getTap2DelayMsPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setTap2LevelDb(amount: Float): Unit { + Internals.writeArguments(DOUBLE to amount.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setTap2LevelDbPtr, NIL) + } + + public final fun getTap2LevelDb(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getTap2LevelDbPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setTap2Pan(amount: Float): Unit { + Internals.writeArguments(DOUBLE to amount.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setTap2PanPtr, NIL) + } + + public final fun getTap2Pan(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getTap2PanPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setFeedbackActive(amount: Boolean): Unit { + Internals.writeArguments(BOOL to amount) + Internals.callMethod(rawPtr, MethodBindings.setFeedbackActivePtr, NIL) + } + + public final fun isFeedbackActive(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isFeedbackActivePtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public final fun setFeedbackDelayMs(amount: Float): Unit { + Internals.writeArguments(DOUBLE to amount.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setFeedbackDelayMsPtr, NIL) + } + + public final fun getFeedbackDelayMs(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getFeedbackDelayMsPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setFeedbackLevelDb(amount: Float): Unit { + Internals.writeArguments(DOUBLE to amount.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setFeedbackLevelDbPtr, NIL) + } + + public final fun getFeedbackLevelDb(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getFeedbackLevelDbPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setFeedbackLowpass(amount: Float): Unit { + Internals.writeArguments(DOUBLE to amount.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setFeedbackLowpassPtr, NIL) + } + + public final fun getFeedbackLowpass(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getFeedbackLowpassPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public companion object + + public object MethodBindings { + internal val setDryPtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectDelay", "set_dry", 373806689) + + internal val getDryPtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectDelay", "get_dry", 191475506) + + internal val setTap1ActivePtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectDelay", "set_tap1_active", 2586408642) + + internal val isTap1ActivePtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectDelay", "is_tap1_active", 36873697) + + internal val setTap1DelayMsPtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectDelay", "set_tap1_delay_ms", 373806689) + + internal val getTap1DelayMsPtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectDelay", "get_tap1_delay_ms", 1740695150) + + internal val setTap1LevelDbPtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectDelay", "set_tap1_level_db", 373806689) + + internal val getTap1LevelDbPtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectDelay", "get_tap1_level_db", 1740695150) + + internal val setTap1PanPtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectDelay", "set_tap1_pan", 373806689) + + internal val getTap1PanPtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectDelay", "get_tap1_pan", 1740695150) + + internal val setTap2ActivePtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectDelay", "set_tap2_active", 2586408642) + + internal val isTap2ActivePtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectDelay", "is_tap2_active", 36873697) + + internal val setTap2DelayMsPtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectDelay", "set_tap2_delay_ms", 373806689) + + internal val getTap2DelayMsPtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectDelay", "get_tap2_delay_ms", 1740695150) + + internal val setTap2LevelDbPtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectDelay", "set_tap2_level_db", 373806689) + + internal val getTap2LevelDbPtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectDelay", "get_tap2_level_db", 1740695150) + + internal val setTap2PanPtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectDelay", "set_tap2_pan", 373806689) + + internal val getTap2PanPtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectDelay", "get_tap2_pan", 1740695150) + + internal val setFeedbackActivePtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectDelay", "set_feedback_active", 2586408642) + + internal val isFeedbackActivePtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectDelay", "is_feedback_active", 36873697) + + internal val setFeedbackDelayMsPtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectDelay", "set_feedback_delay_ms", 373806689) + + internal val getFeedbackDelayMsPtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectDelay", "get_feedback_delay_ms", 1740695150) + + internal val setFeedbackLevelDbPtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectDelay", "set_feedback_level_db", 373806689) + + internal val getFeedbackLevelDbPtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectDelay", "get_feedback_level_db", 1740695150) + + internal val setFeedbackLowpassPtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectDelay", "set_feedback_lowpass", 373806689) + + internal val getFeedbackLowpassPtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectDelay", "get_feedback_lowpass", 1740695150) + } +} diff --git a/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioEffectDistortion.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioEffectDistortion.kt new file mode 100644 index 0000000000..cd46ef5aa7 --- /dev/null +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioEffectDistortion.kt @@ -0,0 +1,218 @@ +// THIS FILE IS GENERATED! DO NOT EDIT IT MANUALLY! +@file:Suppress("PackageDirectoryMismatch", "unused", "FunctionName", "RedundantModalityModifier", + "UNCHECKED_CAST", "JoinDeclarationAndAssignment", "USELESS_CAST", + "RemoveRedundantQualifierName", "NOTHING_TO_INLINE", "NON_FINAL_MEMBER_IN_OBJECT", + "RedundantVisibilityModifier", "RedundantUnitReturnType", "MemberVisibilityCanBePrivate") + +package godot + +import godot.`annotation`.GodotBaseType +import godot.core.VariantParser.DOUBLE +import godot.core.VariantParser.LONG +import godot.core.VariantParser.NIL +import godot.util.Internals +import godot.util.VoidPtr +import kotlin.Double +import kotlin.Float +import kotlin.Int +import kotlin.Long +import kotlin.Suppress +import kotlin.Unit +import kotlin.jvm.JvmName + +private const val ENGINE_CLASS_AUDIOEFFECTDISTORTION_INDEX: Int = 88 + +/** + * Different types are available: clip, tan, lo-fi (bit crushing), overdrive, or waveshape. + * By distorting the waveform the frequency content changes, which will often make the sound + * "crunchy" or "abrasive". For games, it can simulate sound coming from some saturated device or + * speaker very efficiently. + */ +@GodotBaseType +public open class AudioEffectDistortion : AudioEffect() { + /** + * Distortion type. + */ + public final inline var mode: Mode + @JvmName("modeProperty") + get() = getMode() + @JvmName("modeProperty") + set(`value`) { + setMode(value) + } + + /** + * Increases or decreases the volume before the effect, in decibels. Value can range from -60 to + * 60. + */ + public final inline var preGain: Float + @JvmName("preGainProperty") + get() = getPreGain() + @JvmName("preGainProperty") + set(`value`) { + setPreGain(value) + } + + /** + * High-pass filter, in Hz. Frequencies higher than this value will not be affected by the + * distortion. Value can range from 1 to 20000. + */ + public final inline var keepHfHz: Float + @JvmName("keepHfHzProperty") + get() = getKeepHfHz() + @JvmName("keepHfHzProperty") + set(`value`) { + setKeepHfHz(value) + } + + /** + * Distortion power. Value can range from 0 to 1. + */ + public final inline var drive: Float + @JvmName("driveProperty") + get() = getDrive() + @JvmName("driveProperty") + set(`value`) { + setDrive(value) + } + + /** + * Increases or decreases the volume after the effect, in decibels. Value can range from -80 to + * 24. + */ + public final inline var postGain: Float + @JvmName("postGainProperty") + get() = getPostGain() + @JvmName("postGainProperty") + set(`value`) { + setPostGain(value) + } + + public override fun new(scriptIndex: Int): Unit { + Internals.callConstructor(this, ENGINE_CLASS_AUDIOEFFECTDISTORTION_INDEX, scriptIndex) + } + + public final fun setMode(mode: Mode): Unit { + Internals.writeArguments(LONG to mode.id) + Internals.callMethod(rawPtr, MethodBindings.setModePtr, NIL) + } + + public final fun getMode(): Mode { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getModePtr, LONG) + return AudioEffectDistortion.Mode.from(Internals.readReturnValue(LONG) as Long) + } + + public final fun setPreGain(preGain: Float): Unit { + Internals.writeArguments(DOUBLE to preGain.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setPreGainPtr, NIL) + } + + public final fun getPreGain(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getPreGainPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setKeepHfHz(keepHfHz: Float): Unit { + Internals.writeArguments(DOUBLE to keepHfHz.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setKeepHfHzPtr, NIL) + } + + public final fun getKeepHfHz(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getKeepHfHzPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setDrive(drive: Float): Unit { + Internals.writeArguments(DOUBLE to drive.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setDrivePtr, NIL) + } + + public final fun getDrive(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getDrivePtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setPostGain(postGain: Float): Unit { + Internals.writeArguments(DOUBLE to postGain.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setPostGainPtr, NIL) + } + + public final fun getPostGain(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getPostGainPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public enum class Mode( + id: Long, + ) { + /** + * Digital distortion effect which cuts off peaks at the top and bottom of the waveform. + */ + MODE_CLIP(0), + MODE_ATAN(1), + /** + * Low-resolution digital distortion effect (bit depth reduction). You can use it to emulate the + * sound of early digital audio devices. + */ + MODE_LOFI(2), + /** + * Emulates the warm distortion produced by a field effect transistor, which is commonly used in + * solid-state musical instrument amplifiers. The [drive] property has no effect in this mode. + */ + MODE_OVERDRIVE(3), + /** + * Waveshaper distortions are used mainly by electronic musicians to achieve an extra-abrasive + * sound. + */ + MODE_WAVESHAPE(4), + ; + + public val id: Long + init { + this.id = id + } + + public companion object { + public fun from(`value`: Long): Mode = entries.single { it.id == `value` } + } + } + + public companion object + + public object MethodBindings { + internal val setModePtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectDistortion", "set_mode", 1314744793) + + internal val getModePtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectDistortion", "get_mode", 809118343) + + internal val setPreGainPtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectDistortion", "set_pre_gain", 373806689) + + internal val getPreGainPtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectDistortion", "get_pre_gain", 1740695150) + + internal val setKeepHfHzPtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectDistortion", "set_keep_hf_hz", 373806689) + + internal val getKeepHfHzPtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectDistortion", "get_keep_hf_hz", 1740695150) + + internal val setDrivePtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectDistortion", "set_drive", 373806689) + + internal val getDrivePtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectDistortion", "get_drive", 1740695150) + + internal val setPostGainPtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectDistortion", "set_post_gain", 373806689) + + internal val getPostGainPtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectDistortion", "get_post_gain", 1740695150) + } +} diff --git a/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioEffectEQ.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioEffectEQ.kt new file mode 100644 index 0000000000..975dca984c --- /dev/null +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioEffectEQ.kt @@ -0,0 +1,74 @@ +// THIS FILE IS GENERATED! DO NOT EDIT IT MANUALLY! +@file:Suppress("PackageDirectoryMismatch", "unused", "FunctionName", "RedundantModalityModifier", + "UNCHECKED_CAST", "JoinDeclarationAndAssignment", "USELESS_CAST", + "RemoveRedundantQualifierName", "NOTHING_TO_INLINE", "NON_FINAL_MEMBER_IN_OBJECT", + "RedundantVisibilityModifier", "RedundantUnitReturnType", "MemberVisibilityCanBePrivate") + +package godot + +import godot.`annotation`.GodotBaseType +import godot.core.VariantParser.DOUBLE +import godot.core.VariantParser.LONG +import godot.core.VariantParser.NIL +import godot.util.Internals +import godot.util.VoidPtr +import kotlin.Double +import kotlin.Float +import kotlin.Int +import kotlin.Long +import kotlin.Suppress +import kotlin.Unit + +private const val ENGINE_CLASS_AUDIOEFFECTEQ_INDEX: Int = 89 + +/** + * AudioEffectEQ gives you control over frequencies. Use it to compensate for existing deficiencies + * in audio. AudioEffectEQs are useful on the Master bus to completely master a mix and give it more + * character. They are also useful when a game is run on a mobile device, to adjust the mix to that + * kind of speakers (it can be added but disabled when headphones are plugged). + */ +@GodotBaseType +public open class AudioEffectEQ : AudioEffect() { + public override fun new(scriptIndex: Int): Unit { + Internals.callConstructor(this, ENGINE_CLASS_AUDIOEFFECTEQ_INDEX, scriptIndex) + } + + /** + * Sets band's gain at the specified index, in dB. + */ + public final fun setBandGainDb(bandIdx: Int, volumeDb: Float): Unit { + Internals.writeArguments(LONG to bandIdx.toLong(), DOUBLE to volumeDb.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setBandGainDbPtr, NIL) + } + + /** + * Returns the band's gain at the specified index, in dB. + */ + public final fun getBandGainDb(bandIdx: Int): Float { + Internals.writeArguments(LONG to bandIdx.toLong()) + Internals.callMethod(rawPtr, MethodBindings.getBandGainDbPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + /** + * Returns the number of bands of the equalizer. + */ + public final fun getBandCount(): Int { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getBandCountPtr, LONG) + return (Internals.readReturnValue(LONG) as Long).toInt() + } + + public companion object + + public object MethodBindings { + internal val setBandGainDbPtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectEQ", "set_band_gain_db", 1602489585) + + internal val getBandGainDbPtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectEQ", "get_band_gain_db", 2339986948) + + internal val getBandCountPtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectEQ", "get_band_count", 3905245786) + } +} diff --git a/kt/godot-library/src/main/kotlin/godot/gen/godot/AudioEffectEQ10.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioEffectEQ10.kt similarity index 82% rename from kt/godot-library/src/main/kotlin/godot/gen/godot/AudioEffectEQ10.kt rename to kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioEffectEQ10.kt index e3b23d5974..c767479692 100644 --- a/kt/godot-library/src/main/kotlin/godot/gen/godot/AudioEffectEQ10.kt +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioEffectEQ10.kt @@ -7,10 +7,13 @@ package godot import godot.`annotation`.GodotBaseType +import godot.util.Internals import kotlin.Int import kotlin.Suppress import kotlin.Unit +private const val ENGINE_CLASS_AUDIOEFFECTEQ10_INDEX: Int = 90 + /** * Frequency bands: * Band 1: 31 Hz @@ -28,10 +31,10 @@ import kotlin.Unit @GodotBaseType public open class AudioEffectEQ10 : AudioEffectEQ() { public override fun new(scriptIndex: Int): Unit { - callConstructor(ENGINECLASS_AUDIOEFFECTEQ10, scriptIndex) + Internals.callConstructor(this, ENGINE_CLASS_AUDIOEFFECTEQ10_INDEX, scriptIndex) } public companion object - internal object MethodBindings + public object MethodBindings } diff --git a/kt/godot-library/src/main/kotlin/godot/gen/godot/AudioEffectEQ21.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioEffectEQ21.kt similarity index 84% rename from kt/godot-library/src/main/kotlin/godot/gen/godot/AudioEffectEQ21.kt rename to kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioEffectEQ21.kt index ad9ed05f42..fa41b1a2a3 100644 --- a/kt/godot-library/src/main/kotlin/godot/gen/godot/AudioEffectEQ21.kt +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioEffectEQ21.kt @@ -7,10 +7,13 @@ package godot import godot.`annotation`.GodotBaseType +import godot.util.Internals import kotlin.Int import kotlin.Suppress import kotlin.Unit +private const val ENGINE_CLASS_AUDIOEFFECTEQ21_INDEX: Int = 91 + /** * Frequency bands: * Band 1: 22 Hz @@ -39,10 +42,10 @@ import kotlin.Unit @GodotBaseType public open class AudioEffectEQ21 : AudioEffectEQ() { public override fun new(scriptIndex: Int): Unit { - callConstructor(ENGINECLASS_AUDIOEFFECTEQ21, scriptIndex) + Internals.callConstructor(this, ENGINE_CLASS_AUDIOEFFECTEQ21_INDEX, scriptIndex) } public companion object - internal object MethodBindings + public object MethodBindings } diff --git a/kt/godot-library/src/main/kotlin/godot/gen/godot/AudioEffectEQ6.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioEffectEQ6.kt similarity index 80% rename from kt/godot-library/src/main/kotlin/godot/gen/godot/AudioEffectEQ6.kt rename to kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioEffectEQ6.kt index 18c45a9031..e2097de38e 100644 --- a/kt/godot-library/src/main/kotlin/godot/gen/godot/AudioEffectEQ6.kt +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioEffectEQ6.kt @@ -7,10 +7,13 @@ package godot import godot.`annotation`.GodotBaseType +import godot.util.Internals import kotlin.Int import kotlin.Suppress import kotlin.Unit +private const val ENGINE_CLASS_AUDIOEFFECTEQ6_INDEX: Int = 92 + /** * Frequency bands: * Band 1: 32 Hz @@ -24,10 +27,10 @@ import kotlin.Unit @GodotBaseType public open class AudioEffectEQ6 : AudioEffectEQ() { public override fun new(scriptIndex: Int): Unit { - callConstructor(ENGINECLASS_AUDIOEFFECTEQ6, scriptIndex) + Internals.callConstructor(this, ENGINE_CLASS_AUDIOEFFECTEQ6_INDEX, scriptIndex) } public companion object - internal object MethodBindings + public object MethodBindings } diff --git a/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioEffectFilter.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioEffectFilter.kt new file mode 100644 index 0000000000..e342d3cdc1 --- /dev/null +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioEffectFilter.kt @@ -0,0 +1,165 @@ +// THIS FILE IS GENERATED! DO NOT EDIT IT MANUALLY! +@file:Suppress("PackageDirectoryMismatch", "unused", "FunctionName", "RedundantModalityModifier", + "UNCHECKED_CAST", "JoinDeclarationAndAssignment", "USELESS_CAST", + "RemoveRedundantQualifierName", "NOTHING_TO_INLINE", "NON_FINAL_MEMBER_IN_OBJECT", + "RedundantVisibilityModifier", "RedundantUnitReturnType", "MemberVisibilityCanBePrivate") + +package godot + +import godot.`annotation`.GodotBaseType +import godot.core.VariantParser.DOUBLE +import godot.core.VariantParser.LONG +import godot.core.VariantParser.NIL +import godot.util.Internals +import godot.util.VoidPtr +import kotlin.Double +import kotlin.Float +import kotlin.Int +import kotlin.Long +import kotlin.Suppress +import kotlin.Unit +import kotlin.jvm.JvmName + +private const val ENGINE_CLASS_AUDIOEFFECTFILTER_INDEX: Int = 93 + +/** + * Allows frequencies other than the [cutoffHz] to pass. + */ +@GodotBaseType +public open class AudioEffectFilter : AudioEffect() { + /** + * Threshold frequency for the filter, in Hz. + */ + public final inline var cutoffHz: Float + @JvmName("cutoffHzProperty") + get() = getCutoff() + @JvmName("cutoffHzProperty") + set(`value`) { + setCutoff(value) + } + + /** + * Amount of boost in the frequency range near the cutoff frequency. + */ + public final inline var resonance: Float + @JvmName("resonanceProperty") + get() = getResonance() + @JvmName("resonanceProperty") + set(`value`) { + setResonance(value) + } + + /** + * Gain amount of the frequencies after the filter. + */ + public final inline var gain: Float + @JvmName("gainProperty") + get() = getGain() + @JvmName("gainProperty") + set(`value`) { + setGain(value) + } + + public final inline var db: FilterDB + @JvmName("dbProperty") + get() = getDb() + @JvmName("dbProperty") + set(`value`) { + setDb(value) + } + + public override fun new(scriptIndex: Int): Unit { + Internals.callConstructor(this, ENGINE_CLASS_AUDIOEFFECTFILTER_INDEX, scriptIndex) + } + + public final fun setCutoff(freq: Float): Unit { + Internals.writeArguments(DOUBLE to freq.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setCutoffPtr, NIL) + } + + public final fun getCutoff(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getCutoffPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setResonance(amount: Float): Unit { + Internals.writeArguments(DOUBLE to amount.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setResonancePtr, NIL) + } + + public final fun getResonance(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getResonancePtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setGain(amount: Float): Unit { + Internals.writeArguments(DOUBLE to amount.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setGainPtr, NIL) + } + + public final fun getGain(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getGainPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setDb(amount: FilterDB): Unit { + Internals.writeArguments(LONG to amount.id) + Internals.callMethod(rawPtr, MethodBindings.setDbPtr, NIL) + } + + public final fun getDb(): FilterDB { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getDbPtr, LONG) + return AudioEffectFilter.FilterDB.from(Internals.readReturnValue(LONG) as Long) + } + + public enum class FilterDB( + id: Long, + ) { + FILTER_6DB(0), + FILTER_12DB(1), + FILTER_18DB(2), + FILTER_24DB(3), + ; + + public val id: Long + init { + this.id = id + } + + public companion object { + public fun from(`value`: Long): FilterDB = entries.single { it.id == `value` } + } + } + + public companion object + + public object MethodBindings { + internal val setCutoffPtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectFilter", "set_cutoff", 373806689) + + internal val getCutoffPtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectFilter", "get_cutoff", 1740695150) + + internal val setResonancePtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectFilter", "set_resonance", 373806689) + + internal val getResonancePtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectFilter", "get_resonance", 1740695150) + + internal val setGainPtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectFilter", "set_gain", 373806689) + + internal val getGainPtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectFilter", "get_gain", 1740695150) + + internal val setDbPtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectFilter", "set_db", 771740901) + + internal val getDbPtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectFilter", "get_db", 3981721890) + } +} diff --git a/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioEffectHardLimiter.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioEffectHardLimiter.kt new file mode 100644 index 0000000000..2e7616de7d --- /dev/null +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioEffectHardLimiter.kt @@ -0,0 +1,125 @@ +// THIS FILE IS GENERATED! DO NOT EDIT IT MANUALLY! +@file:Suppress("PackageDirectoryMismatch", "unused", "FunctionName", "RedundantModalityModifier", + "UNCHECKED_CAST", "JoinDeclarationAndAssignment", "USELESS_CAST", + "RemoveRedundantQualifierName", "NOTHING_TO_INLINE", "NON_FINAL_MEMBER_IN_OBJECT", + "RedundantVisibilityModifier", "RedundantUnitReturnType", "MemberVisibilityCanBePrivate") + +package godot + +import godot.`annotation`.GodotBaseType +import godot.core.VariantParser.DOUBLE +import godot.core.VariantParser.NIL +import godot.util.Internals +import godot.util.VoidPtr +import kotlin.Double +import kotlin.Float +import kotlin.Int +import kotlin.Suppress +import kotlin.Unit +import kotlin.jvm.JvmName + +private const val ENGINE_CLASS_AUDIOEFFECTHARDLIMITER_INDEX: Int = 94 + +/** + * A limiter is an effect designed to disallow sound from going over a given dB threshold. Hard + * limiters predict volume peaks, and will smoothly apply gain reduction when a peak crosses the + * ceiling threshold to prevent clipping and distortion. It preserves the waveform and prevents it from + * crossing the ceiling threshold. Adding one in the Master bus is recommended as a safety measure to + * prevent sudden volume peaks from occurring, and to prevent distortion caused by clipping. + */ +@GodotBaseType +public open class AudioEffectHardLimiter : AudioEffect() { + /** + * Gain to apply before limiting, in decibels. + */ + public final inline var preGainDb: Float + @JvmName("preGainDbProperty") + get() = getPreGainDb() + @JvmName("preGainDbProperty") + set(`value`) { + setPreGainDb(value) + } + + /** + * The waveform's maximum allowed value, in decibels. This value can range from `-24.0` to `0.0`. + * The default value of `-0.3` prevents potential inter-sample peaks (ISP) from crossing over 0 + * dB, which can cause slight distortion on some older hardware. + */ + public final inline var ceilingDb: Float + @JvmName("ceilingDbProperty") + get() = getCeilingDb() + @JvmName("ceilingDbProperty") + set(`value`) { + setCeilingDb(value) + } + + /** + * Time it takes in seconds for the gain reduction to fully release. + */ + public final inline var release: Float + @JvmName("releaseProperty") + get() = getRelease() + @JvmName("releaseProperty") + set(`value`) { + setRelease(value) + } + + public override fun new(scriptIndex: Int): Unit { + Internals.callConstructor(this, ENGINE_CLASS_AUDIOEFFECTHARDLIMITER_INDEX, scriptIndex) + } + + public final fun setCeilingDb(ceiling: Float): Unit { + Internals.writeArguments(DOUBLE to ceiling.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setCeilingDbPtr, NIL) + } + + public final fun getCeilingDb(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getCeilingDbPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setPreGainDb(pPreGain: Float): Unit { + Internals.writeArguments(DOUBLE to pPreGain.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setPreGainDbPtr, NIL) + } + + public final fun getPreGainDb(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getPreGainDbPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setRelease(pRelease: Float): Unit { + Internals.writeArguments(DOUBLE to pRelease.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setReleasePtr, NIL) + } + + public final fun getRelease(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getReleasePtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public companion object + + public object MethodBindings { + internal val setCeilingDbPtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectHardLimiter", "set_ceiling_db", 373806689) + + internal val getCeilingDbPtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectHardLimiter", "get_ceiling_db", 1740695150) + + internal val setPreGainDbPtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectHardLimiter", "set_pre_gain_db", 373806689) + + internal val getPreGainDbPtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectHardLimiter", "get_pre_gain_db", 1740695150) + + internal val setReleasePtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectHardLimiter", "set_release", 373806689) + + internal val getReleasePtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectHardLimiter", "get_release", 1740695150) + } +} diff --git a/kt/godot-library/src/main/kotlin/godot/gen/godot/AudioEffectHighPassFilter.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioEffectHighPassFilter.kt similarity index 77% rename from kt/godot-library/src/main/kotlin/godot/gen/godot/AudioEffectHighPassFilter.kt rename to kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioEffectHighPassFilter.kt index b9f7112f7b..4e77b80551 100644 --- a/kt/godot-library/src/main/kotlin/godot/gen/godot/AudioEffectHighPassFilter.kt +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioEffectHighPassFilter.kt @@ -7,10 +7,13 @@ package godot import godot.`annotation`.GodotBaseType +import godot.util.Internals import kotlin.Int import kotlin.Suppress import kotlin.Unit +private const val ENGINE_CLASS_AUDIOEFFECTHIGHPASSFILTER_INDEX: Int = 95 + /** * Cuts frequencies lower than the [AudioEffectFilter.cutoffHz] and allows higher frequencies to * pass. @@ -18,10 +21,10 @@ import kotlin.Unit @GodotBaseType public open class AudioEffectHighPassFilter : AudioEffectFilter() { public override fun new(scriptIndex: Int): Unit { - callConstructor(ENGINECLASS_AUDIOEFFECTHIGHPASSFILTER, scriptIndex) + Internals.callConstructor(this, ENGINE_CLASS_AUDIOEFFECTHIGHPASSFILTER_INDEX, scriptIndex) } public companion object - internal object MethodBindings + public object MethodBindings } diff --git a/kt/godot-library/src/main/kotlin/godot/gen/godot/AudioEffectHighShelfFilter.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioEffectHighShelfFilter.kt similarity index 76% rename from kt/godot-library/src/main/kotlin/godot/gen/godot/AudioEffectHighShelfFilter.kt rename to kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioEffectHighShelfFilter.kt index ef8c00f207..089378b4de 100644 --- a/kt/godot-library/src/main/kotlin/godot/gen/godot/AudioEffectHighShelfFilter.kt +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioEffectHighShelfFilter.kt @@ -7,20 +7,23 @@ package godot import godot.`annotation`.GodotBaseType +import godot.util.Internals import kotlin.Int import kotlin.Suppress import kotlin.Unit +private const val ENGINE_CLASS_AUDIOEFFECTHIGHSHELFFILTER_INDEX: Int = 96 + /** * Reduces all frequencies above the [AudioEffectFilter.cutoffHz]. */ @GodotBaseType public open class AudioEffectHighShelfFilter : AudioEffectFilter() { public override fun new(scriptIndex: Int): Unit { - callConstructor(ENGINECLASS_AUDIOEFFECTHIGHSHELFFILTER, scriptIndex) + Internals.callConstructor(this, ENGINE_CLASS_AUDIOEFFECTHIGHSHELFFILTER_INDEX, scriptIndex) } public companion object - internal object MethodBindings + public object MethodBindings } diff --git a/kt/godot-library/src/main/kotlin/godot/gen/godot/AudioEffectInstance.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioEffectInstance.kt similarity index 86% rename from kt/godot-library/src/main/kotlin/godot/gen/godot/AudioEffectInstance.kt rename to kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioEffectInstance.kt index eea560fc5f..2950c65c7b 100644 --- a/kt/godot-library/src/main/kotlin/godot/gen/godot/AudioEffectInstance.kt +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioEffectInstance.kt @@ -7,12 +7,15 @@ package godot import godot.`annotation`.GodotBaseType +import godot.util.Internals import kotlin.Boolean import kotlin.Int import kotlin.NotImplementedError import kotlin.Suppress import kotlin.Unit +private const val ENGINE_CLASS_AUDIOEFFECTINSTANCE_INDEX: Int = 97 + /** * An audio effect instance manipulates the audio it receives for a given effect. This instance is * automatically created by an [AudioEffect] when it is added to a bus, and should usually not be @@ -22,7 +25,7 @@ import kotlin.Unit @GodotBaseType public open class AudioEffectInstance : RefCounted() { public override fun new(scriptIndex: Int): Unit { - callConstructor(ENGINECLASS_AUDIOEFFECTINSTANCE, scriptIndex) + Internals.callConstructor(this, ENGINE_CLASS_AUDIOEFFECTINSTANCE_INDEX, scriptIndex) } /** @@ -36,5 +39,5 @@ public open class AudioEffectInstance : RefCounted() { public companion object - internal object MethodBindings + public object MethodBindings } diff --git a/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioEffectLimiter.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioEffectLimiter.kt new file mode 100644 index 0000000000..4308f23cd1 --- /dev/null +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioEffectLimiter.kt @@ -0,0 +1,149 @@ +// THIS FILE IS GENERATED! DO NOT EDIT IT MANUALLY! +@file:Suppress("PackageDirectoryMismatch", "unused", "FunctionName", "RedundantModalityModifier", + "UNCHECKED_CAST", "JoinDeclarationAndAssignment", "USELESS_CAST", + "RemoveRedundantQualifierName", "NOTHING_TO_INLINE", "NON_FINAL_MEMBER_IN_OBJECT", + "RedundantVisibilityModifier", "RedundantUnitReturnType", "MemberVisibilityCanBePrivate") + +package godot + +import godot.`annotation`.GodotBaseType +import godot.core.VariantParser.DOUBLE +import godot.core.VariantParser.NIL +import godot.util.Internals +import godot.util.VoidPtr +import kotlin.Double +import kotlin.Float +import kotlin.Int +import kotlin.Suppress +import kotlin.Unit +import kotlin.jvm.JvmName + +private const val ENGINE_CLASS_AUDIOEFFECTLIMITER_INDEX: Int = 98 + +/** + * A limiter is similar to a compressor, but it's less flexible and designed to disallow sound going + * over a given dB threshold. Adding one in the Master bus is always recommended to reduce the effects + * of clipping. + * Soft clipping starts to reduce the peaks a little below the threshold level and progressively + * increases its effect as the input level increases such that the threshold is never exceeded. + */ +@GodotBaseType +public open class AudioEffectLimiter : AudioEffect() { + /** + * The waveform's maximum allowed value, in decibels. Value can range from -20 to -0.1. + */ + public final inline var ceilingDb: Float + @JvmName("ceilingDbProperty") + get() = getCeilingDb() + @JvmName("ceilingDbProperty") + set(`value`) { + setCeilingDb(value) + } + + /** + * Threshold from which the limiter begins to be active, in decibels. Value can range from -30 to + * 0. + */ + public final inline var thresholdDb: Float + @JvmName("thresholdDbProperty") + get() = getThresholdDb() + @JvmName("thresholdDbProperty") + set(`value`) { + setThresholdDb(value) + } + + /** + * Applies a gain to the limited waves, in decibels. Value can range from 0 to 6. + */ + public final inline var softClipDb: Float + @JvmName("softClipDbProperty") + get() = getSoftClipDb() + @JvmName("softClipDbProperty") + set(`value`) { + setSoftClipDb(value) + } + + public final inline var softClipRatio: Float + @JvmName("softClipRatioProperty") + get() = getSoftClipRatio() + @JvmName("softClipRatioProperty") + set(`value`) { + setSoftClipRatio(value) + } + + public override fun new(scriptIndex: Int): Unit { + Internals.callConstructor(this, ENGINE_CLASS_AUDIOEFFECTLIMITER_INDEX, scriptIndex) + } + + public final fun setCeilingDb(ceiling: Float): Unit { + Internals.writeArguments(DOUBLE to ceiling.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setCeilingDbPtr, NIL) + } + + public final fun getCeilingDb(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getCeilingDbPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setThresholdDb(threshold: Float): Unit { + Internals.writeArguments(DOUBLE to threshold.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setThresholdDbPtr, NIL) + } + + public final fun getThresholdDb(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getThresholdDbPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setSoftClipDb(softClip: Float): Unit { + Internals.writeArguments(DOUBLE to softClip.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setSoftClipDbPtr, NIL) + } + + public final fun getSoftClipDb(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getSoftClipDbPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setSoftClipRatio(softClip: Float): Unit { + Internals.writeArguments(DOUBLE to softClip.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setSoftClipRatioPtr, NIL) + } + + public final fun getSoftClipRatio(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getSoftClipRatioPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public companion object + + public object MethodBindings { + internal val setCeilingDbPtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectLimiter", "set_ceiling_db", 373806689) + + internal val getCeilingDbPtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectLimiter", "get_ceiling_db", 1740695150) + + internal val setThresholdDbPtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectLimiter", "set_threshold_db", 373806689) + + internal val getThresholdDbPtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectLimiter", "get_threshold_db", 1740695150) + + internal val setSoftClipDbPtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectLimiter", "set_soft_clip_db", 373806689) + + internal val getSoftClipDbPtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectLimiter", "get_soft_clip_db", 1740695150) + + internal val setSoftClipRatioPtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectLimiter", "set_soft_clip_ratio", 373806689) + + internal val getSoftClipRatioPtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectLimiter", "get_soft_clip_ratio", 1740695150) + } +} diff --git a/kt/godot-library/src/main/kotlin/godot/gen/godot/AudioEffectLowPassFilter.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioEffectLowPassFilter.kt similarity index 77% rename from kt/godot-library/src/main/kotlin/godot/gen/godot/AudioEffectLowPassFilter.kt rename to kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioEffectLowPassFilter.kt index a497280d33..478baa98d9 100644 --- a/kt/godot-library/src/main/kotlin/godot/gen/godot/AudioEffectLowPassFilter.kt +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioEffectLowPassFilter.kt @@ -7,10 +7,13 @@ package godot import godot.`annotation`.GodotBaseType +import godot.util.Internals import kotlin.Int import kotlin.Suppress import kotlin.Unit +private const val ENGINE_CLASS_AUDIOEFFECTLOWPASSFILTER_INDEX: Int = 99 + /** * Cuts frequencies higher than the [AudioEffectFilter.cutoffHz] and allows lower frequencies to * pass. @@ -18,10 +21,10 @@ import kotlin.Unit @GodotBaseType public open class AudioEffectLowPassFilter : AudioEffectFilter() { public override fun new(scriptIndex: Int): Unit { - callConstructor(ENGINECLASS_AUDIOEFFECTLOWPASSFILTER, scriptIndex) + Internals.callConstructor(this, ENGINE_CLASS_AUDIOEFFECTLOWPASSFILTER_INDEX, scriptIndex) } public companion object - internal object MethodBindings + public object MethodBindings } diff --git a/kt/godot-library/src/main/kotlin/godot/gen/godot/AudioEffectLowShelfFilter.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioEffectLowShelfFilter.kt similarity index 76% rename from kt/godot-library/src/main/kotlin/godot/gen/godot/AudioEffectLowShelfFilter.kt rename to kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioEffectLowShelfFilter.kt index 51c92d0d05..f8230ced11 100644 --- a/kt/godot-library/src/main/kotlin/godot/gen/godot/AudioEffectLowShelfFilter.kt +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioEffectLowShelfFilter.kt @@ -7,20 +7,23 @@ package godot import godot.`annotation`.GodotBaseType +import godot.util.Internals import kotlin.Int import kotlin.Suppress import kotlin.Unit +private const val ENGINE_CLASS_AUDIOEFFECTLOWSHELFFILTER_INDEX: Int = 100 + /** * Reduces all frequencies below the [AudioEffectFilter.cutoffHz]. */ @GodotBaseType public open class AudioEffectLowShelfFilter : AudioEffectFilter() { public override fun new(scriptIndex: Int): Unit { - callConstructor(ENGINECLASS_AUDIOEFFECTLOWSHELFFILTER, scriptIndex) + Internals.callConstructor(this, ENGINE_CLASS_AUDIOEFFECTLOWSHELFFILTER_INDEX, scriptIndex) } public companion object - internal object MethodBindings + public object MethodBindings } diff --git a/kt/godot-library/src/main/kotlin/godot/gen/godot/AudioEffectNotchFilter.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioEffectNotchFilter.kt similarity index 78% rename from kt/godot-library/src/main/kotlin/godot/gen/godot/AudioEffectNotchFilter.kt rename to kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioEffectNotchFilter.kt index b15b37f048..b65d71aa5f 100644 --- a/kt/godot-library/src/main/kotlin/godot/gen/godot/AudioEffectNotchFilter.kt +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioEffectNotchFilter.kt @@ -7,10 +7,13 @@ package godot import godot.`annotation`.GodotBaseType +import godot.util.Internals import kotlin.Int import kotlin.Suppress import kotlin.Unit +private const val ENGINE_CLASS_AUDIOEFFECTNOTCHFILTER_INDEX: Int = 101 + /** * Attenuates frequencies in a narrow band around the [AudioEffectFilter.cutoffHz] and cuts * frequencies outside of this range. @@ -18,10 +21,10 @@ import kotlin.Unit @GodotBaseType public open class AudioEffectNotchFilter : AudioEffectFilter() { public override fun new(scriptIndex: Int): Unit { - callConstructor(ENGINECLASS_AUDIOEFFECTNOTCHFILTER, scriptIndex) + Internals.callConstructor(this, ENGINE_CLASS_AUDIOEFFECTNOTCHFILTER_INDEX, scriptIndex) } public companion object - internal object MethodBindings + public object MethodBindings } diff --git a/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioEffectPanner.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioEffectPanner.kt new file mode 100644 index 0000000000..44449d3c96 --- /dev/null +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioEffectPanner.kt @@ -0,0 +1,63 @@ +// THIS FILE IS GENERATED! DO NOT EDIT IT MANUALLY! +@file:Suppress("PackageDirectoryMismatch", "unused", "FunctionName", "RedundantModalityModifier", + "UNCHECKED_CAST", "JoinDeclarationAndAssignment", "USELESS_CAST", + "RemoveRedundantQualifierName", "NOTHING_TO_INLINE", "NON_FINAL_MEMBER_IN_OBJECT", + "RedundantVisibilityModifier", "RedundantUnitReturnType", "MemberVisibilityCanBePrivate") + +package godot + +import godot.`annotation`.GodotBaseType +import godot.core.VariantParser.DOUBLE +import godot.core.VariantParser.NIL +import godot.util.Internals +import godot.util.VoidPtr +import kotlin.Double +import kotlin.Float +import kotlin.Int +import kotlin.Suppress +import kotlin.Unit +import kotlin.jvm.JvmName + +private const val ENGINE_CLASS_AUDIOEFFECTPANNER_INDEX: Int = 102 + +/** + * Determines how much of an audio signal is sent to the left and right buses. + */ +@GodotBaseType +public open class AudioEffectPanner : AudioEffect() { + /** + * Pan position. Value can range from -1 (fully left) to 1 (fully right). + */ + public final inline var pan: Float + @JvmName("panProperty") + get() = getPan() + @JvmName("panProperty") + set(`value`) { + setPan(value) + } + + public override fun new(scriptIndex: Int): Unit { + Internals.callConstructor(this, ENGINE_CLASS_AUDIOEFFECTPANNER_INDEX, scriptIndex) + } + + public final fun setPan(cpanume: Float): Unit { + Internals.writeArguments(DOUBLE to cpanume.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setPanPtr, NIL) + } + + public final fun getPan(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getPanPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public companion object + + public object MethodBindings { + internal val setPanPtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectPanner", "set_pan", 373806689) + + internal val getPanPtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectPanner", "get_pan", 1740695150) + } +} diff --git a/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioEffectPhaser.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioEffectPhaser.kt new file mode 100644 index 0000000000..da78773cf8 --- /dev/null +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioEffectPhaser.kt @@ -0,0 +1,179 @@ +// THIS FILE IS GENERATED! DO NOT EDIT IT MANUALLY! +@file:Suppress("PackageDirectoryMismatch", "unused", "FunctionName", "RedundantModalityModifier", + "UNCHECKED_CAST", "JoinDeclarationAndAssignment", "USELESS_CAST", + "RemoveRedundantQualifierName", "NOTHING_TO_INLINE", "NON_FINAL_MEMBER_IN_OBJECT", + "RedundantVisibilityModifier", "RedundantUnitReturnType", "MemberVisibilityCanBePrivate") + +package godot + +import godot.`annotation`.GodotBaseType +import godot.core.VariantParser.DOUBLE +import godot.core.VariantParser.NIL +import godot.util.Internals +import godot.util.VoidPtr +import kotlin.Double +import kotlin.Float +import kotlin.Int +import kotlin.Suppress +import kotlin.Unit +import kotlin.jvm.JvmName + +private const val ENGINE_CLASS_AUDIOEFFECTPHASER_INDEX: Int = 103 + +/** + * Combines phase-shifted signals with the original signal. The movement of the phase-shifted + * signals is controlled using a low-frequency oscillator. + */ +@GodotBaseType +public open class AudioEffectPhaser : AudioEffect() { + /** + * Determines the minimum frequency affected by the LFO modulations, in Hz. Value can range from + * 10 to 10000. + */ + public final inline var rangeMinHz: Float + @JvmName("rangeMinHzProperty") + get() = getRangeMinHz() + @JvmName("rangeMinHzProperty") + set(`value`) { + setRangeMinHz(value) + } + + /** + * Determines the maximum frequency affected by the LFO modulations, in Hz. Value can range from + * 10 to 10000. + */ + public final inline var rangeMaxHz: Float + @JvmName("rangeMaxHzProperty") + get() = getRangeMaxHz() + @JvmName("rangeMaxHzProperty") + set(`value`) { + setRangeMaxHz(value) + } + + /** + * Adjusts the rate in Hz at which the effect sweeps up and down across the frequency range. + */ + public final inline var rateHz: Float + @JvmName("rateHzProperty") + get() = getRateHz() + @JvmName("rateHzProperty") + set(`value`) { + setRateHz(value) + } + + /** + * Output percent of modified sound. Value can range from 0.1 to 0.9. + */ + public final inline var feedback: Float + @JvmName("feedbackProperty") + get() = getFeedback() + @JvmName("feedbackProperty") + set(`value`) { + setFeedback(value) + } + + /** + * Governs how high the filter frequencies sweep. Low value will primarily affect bass + * frequencies. High value can sweep high into the treble. Value can range from 0.1 to 4. + */ + public final inline var depth: Float + @JvmName("depthProperty") + get() = getDepth() + @JvmName("depthProperty") + set(`value`) { + setDepth(value) + } + + public override fun new(scriptIndex: Int): Unit { + Internals.callConstructor(this, ENGINE_CLASS_AUDIOEFFECTPHASER_INDEX, scriptIndex) + } + + public final fun setRangeMinHz(hz: Float): Unit { + Internals.writeArguments(DOUBLE to hz.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setRangeMinHzPtr, NIL) + } + + public final fun getRangeMinHz(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getRangeMinHzPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setRangeMaxHz(hz: Float): Unit { + Internals.writeArguments(DOUBLE to hz.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setRangeMaxHzPtr, NIL) + } + + public final fun getRangeMaxHz(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getRangeMaxHzPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setRateHz(hz: Float): Unit { + Internals.writeArguments(DOUBLE to hz.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setRateHzPtr, NIL) + } + + public final fun getRateHz(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getRateHzPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setFeedback(fbk: Float): Unit { + Internals.writeArguments(DOUBLE to fbk.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setFeedbackPtr, NIL) + } + + public final fun getFeedback(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getFeedbackPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setDepth(depth: Float): Unit { + Internals.writeArguments(DOUBLE to depth.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setDepthPtr, NIL) + } + + public final fun getDepth(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getDepthPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public companion object + + public object MethodBindings { + internal val setRangeMinHzPtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectPhaser", "set_range_min_hz", 373806689) + + internal val getRangeMinHzPtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectPhaser", "get_range_min_hz", 1740695150) + + internal val setRangeMaxHzPtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectPhaser", "set_range_max_hz", 373806689) + + internal val getRangeMaxHzPtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectPhaser", "get_range_max_hz", 1740695150) + + internal val setRateHzPtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectPhaser", "set_rate_hz", 373806689) + + internal val getRateHzPtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectPhaser", "get_rate_hz", 1740695150) + + internal val setFeedbackPtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectPhaser", "set_feedback", 373806689) + + internal val getFeedbackPtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectPhaser", "get_feedback", 1740695150) + + internal val setDepthPtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectPhaser", "set_depth", 373806689) + + internal val getDepthPtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectPhaser", "get_depth", 1740695150) + } +} diff --git a/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioEffectPitchShift.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioEffectPitchShift.kt new file mode 100644 index 0000000000..5a8bb45b4f --- /dev/null +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioEffectPitchShift.kt @@ -0,0 +1,172 @@ +// THIS FILE IS GENERATED! DO NOT EDIT IT MANUALLY! +@file:Suppress("PackageDirectoryMismatch", "unused", "FunctionName", "RedundantModalityModifier", + "UNCHECKED_CAST", "JoinDeclarationAndAssignment", "USELESS_CAST", + "RemoveRedundantQualifierName", "NOTHING_TO_INLINE", "NON_FINAL_MEMBER_IN_OBJECT", + "RedundantVisibilityModifier", "RedundantUnitReturnType", "MemberVisibilityCanBePrivate") + +package godot + +import godot.`annotation`.GodotBaseType +import godot.core.VariantParser.DOUBLE +import godot.core.VariantParser.LONG +import godot.core.VariantParser.NIL +import godot.util.Internals +import godot.util.VoidPtr +import kotlin.Double +import kotlin.Float +import kotlin.Int +import kotlin.Long +import kotlin.Suppress +import kotlin.Unit +import kotlin.jvm.JvmName + +private const val ENGINE_CLASS_AUDIOEFFECTPITCHSHIFT_INDEX: Int = 104 + +/** + * Allows modulation of pitch independently of tempo. All frequencies can be increased/decreased + * with minimal effect on transients. + */ +@GodotBaseType +public open class AudioEffectPitchShift : AudioEffect() { + /** + * The pitch scale to use. `1.0` is the default pitch and plays sounds unaffected. [pitchScale] + * can range from `0.0` (infinitely low pitch, inaudible) to `16` (16 times higher than the initial + * pitch). + */ + public final inline var pitchScale: Float + @JvmName("pitchScaleProperty") + get() = getPitchScale() + @JvmName("pitchScaleProperty") + set(`value`) { + setPitchScale(value) + } + + /** + * The oversampling factor to use. Higher values result in better quality, but are more demanding + * on the CPU and may cause audio cracking if the CPU can't keep up. + */ + public final inline var oversampling: Int + @JvmName("oversamplingProperty") + get() = getOversampling() + @JvmName("oversamplingProperty") + set(`value`) { + setOversampling(value) + } + + /** + * The size of the [url=https://en.wikipedia.org/wiki/Fast_Fourier_transform]Fast Fourier + * transform[/url] buffer. Higher values smooth out the effect over time, but have greater latency. + * The effects of this higher latency are especially noticeable on sounds that have sudden amplitude + * changes. + */ + public final inline var fftSize: FFTSize + @JvmName("fftSizeProperty") + get() = getFftSize() + @JvmName("fftSizeProperty") + set(`value`) { + setFftSize(value) + } + + public override fun new(scriptIndex: Int): Unit { + Internals.callConstructor(this, ENGINE_CLASS_AUDIOEFFECTPITCHSHIFT_INDEX, scriptIndex) + } + + public final fun setPitchScale(rate: Float): Unit { + Internals.writeArguments(DOUBLE to rate.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setPitchScalePtr, NIL) + } + + public final fun getPitchScale(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getPitchScalePtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setOversampling(amount: Int): Unit { + Internals.writeArguments(LONG to amount.toLong()) + Internals.callMethod(rawPtr, MethodBindings.setOversamplingPtr, NIL) + } + + public final fun getOversampling(): Int { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getOversamplingPtr, LONG) + return (Internals.readReturnValue(LONG) as Long).toInt() + } + + public final fun setFftSize(size: FFTSize): Unit { + Internals.writeArguments(LONG to size.id) + Internals.callMethod(rawPtr, MethodBindings.setFftSizePtr, NIL) + } + + public final fun getFftSize(): FFTSize { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getFftSizePtr, LONG) + return AudioEffectPitchShift.FFTSize.from(Internals.readReturnValue(LONG) as Long) + } + + public enum class FFTSize( + id: Long, + ) { + /** + * Use a buffer of 256 samples for the Fast Fourier transform. Lowest latency, but least stable + * over time. + */ + FFT_SIZE_256(0), + /** + * Use a buffer of 512 samples for the Fast Fourier transform. Low latency, but less stable over + * time. + */ + FFT_SIZE_512(1), + /** + * Use a buffer of 1024 samples for the Fast Fourier transform. This is a compromise between + * latency and stability over time. + */ + FFT_SIZE_1024(2), + /** + * Use a buffer of 2048 samples for the Fast Fourier transform. High latency, but stable over + * time. + */ + FFT_SIZE_2048(3), + /** + * Use a buffer of 4096 samples for the Fast Fourier transform. Highest latency, but most stable + * over time. + */ + FFT_SIZE_4096(4), + /** + * Represents the size of the [FFTSize] enum. + */ + FFT_SIZE_MAX(5), + ; + + public val id: Long + init { + this.id = id + } + + public companion object { + public fun from(`value`: Long): FFTSize = entries.single { it.id == `value` } + } + } + + public companion object + + public object MethodBindings { + internal val setPitchScalePtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectPitchShift", "set_pitch_scale", 373806689) + + internal val getPitchScalePtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectPitchShift", "get_pitch_scale", 1740695150) + + internal val setOversamplingPtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectPitchShift", "set_oversampling", 1286410249) + + internal val getOversamplingPtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectPitchShift", "get_oversampling", 3905245786) + + internal val setFftSizePtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectPitchShift", "set_fft_size", 2323518741) + + internal val getFftSizePtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectPitchShift", "get_fft_size", 2361246789) + } +} diff --git a/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioEffectRecord.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioEffectRecord.kt new file mode 100644 index 0000000000..9a426fe99d --- /dev/null +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioEffectRecord.kt @@ -0,0 +1,109 @@ +// THIS FILE IS GENERATED! DO NOT EDIT IT MANUALLY! +@file:Suppress("PackageDirectoryMismatch", "unused", "FunctionName", "RedundantModalityModifier", + "UNCHECKED_CAST", "JoinDeclarationAndAssignment", "USELESS_CAST", + "RemoveRedundantQualifierName", "NOTHING_TO_INLINE", "NON_FINAL_MEMBER_IN_OBJECT", + "RedundantVisibilityModifier", "RedundantUnitReturnType", "MemberVisibilityCanBePrivate") + +package godot + +import godot.`annotation`.GodotBaseType +import godot.core.VariantParser.BOOL +import godot.core.VariantParser.LONG +import godot.core.VariantParser.NIL +import godot.core.VariantParser.OBJECT +import godot.util.Internals +import godot.util.VoidPtr +import kotlin.Boolean +import kotlin.Int +import kotlin.Long +import kotlin.Suppress +import kotlin.Unit +import kotlin.jvm.JvmName + +private const val ENGINE_CLASS_AUDIOEFFECTRECORD_INDEX: Int = 105 + +/** + * Allows the user to record the sound from an audio bus into an [AudioStreamWAV]. When used on the + * "Master" audio bus, this includes all audio output by Godot. + * Unlike [AudioEffectCapture], this effect encodes the recording with the given format (8-bit, + * 16-bit, or compressed) instead of giving access to the raw audio samples. + * Can be used (with an [AudioStreamMicrophone]) to record from a microphone. + * **Note:** [ProjectSettings.audio/driver/enableInput] must be `true` for audio input to work. See + * also that setting's description for caveats related to permissions and operating system privacy + * settings. + */ +@GodotBaseType +public open class AudioEffectRecord : AudioEffect() { + /** + * Specifies the format in which the sample will be recorded. See [AudioStreamWAV.Format] for + * available formats. + */ + public final inline var format: AudioStreamWAV.Format + @JvmName("formatProperty") + get() = getFormat() + @JvmName("formatProperty") + set(`value`) { + setFormat(value) + } + + public override fun new(scriptIndex: Int): Unit { + Internals.callConstructor(this, ENGINE_CLASS_AUDIOEFFECTRECORD_INDEX, scriptIndex) + } + + /** + * If `true`, the sound will be recorded. Note that restarting the recording will remove the + * previously recorded sample. + */ + public final fun setRecordingActive(record: Boolean): Unit { + Internals.writeArguments(BOOL to record) + Internals.callMethod(rawPtr, MethodBindings.setRecordingActivePtr, NIL) + } + + /** + * Returns whether the recording is active or not. + */ + public final fun isRecordingActive(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isRecordingActivePtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public final fun setFormat(format: AudioStreamWAV.Format): Unit { + Internals.writeArguments(LONG to format.id) + Internals.callMethod(rawPtr, MethodBindings.setFormatPtr, NIL) + } + + public final fun getFormat(): AudioStreamWAV.Format { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getFormatPtr, LONG) + return AudioStreamWAV.Format.from(Internals.readReturnValue(LONG) as Long) + } + + /** + * Returns the recorded sample. + */ + public final fun getRecording(): AudioStreamWAV? { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getRecordingPtr, OBJECT) + return (Internals.readReturnValue(OBJECT) as AudioStreamWAV?) + } + + public companion object + + public object MethodBindings { + internal val setRecordingActivePtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectRecord", "set_recording_active", 2586408642) + + internal val isRecordingActivePtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectRecord", "is_recording_active", 36873697) + + internal val setFormatPtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectRecord", "set_format", 60648488) + + internal val getFormatPtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectRecord", "get_format", 3151724922) + + internal val getRecordingPtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectRecord", "get_recording", 2964110865) + } +} diff --git a/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioEffectReverb.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioEffectReverb.kt new file mode 100644 index 0000000000..77436e905a --- /dev/null +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioEffectReverb.kt @@ -0,0 +1,265 @@ +// THIS FILE IS GENERATED! DO NOT EDIT IT MANUALLY! +@file:Suppress("PackageDirectoryMismatch", "unused", "FunctionName", "RedundantModalityModifier", + "UNCHECKED_CAST", "JoinDeclarationAndAssignment", "USELESS_CAST", + "RemoveRedundantQualifierName", "NOTHING_TO_INLINE", "NON_FINAL_MEMBER_IN_OBJECT", + "RedundantVisibilityModifier", "RedundantUnitReturnType", "MemberVisibilityCanBePrivate") + +package godot + +import godot.`annotation`.GodotBaseType +import godot.core.VariantParser.DOUBLE +import godot.core.VariantParser.NIL +import godot.util.Internals +import godot.util.VoidPtr +import kotlin.Double +import kotlin.Float +import kotlin.Int +import kotlin.Suppress +import kotlin.Unit +import kotlin.jvm.JvmName + +private const val ENGINE_CLASS_AUDIOEFFECTREVERB_INDEX: Int = 106 + +/** + * Simulates the sound of acoustic environments such as rooms, concert halls, caverns, or an open + * spaces. + */ +@GodotBaseType +public open class AudioEffectReverb : AudioEffect() { + /** + * Time between the original signal and the early reflections of the reverb signal, in + * milliseconds. + */ + public final inline var predelayMsec: Float + @JvmName("predelayMsecProperty") + get() = getPredelayMsec() + @JvmName("predelayMsecProperty") + set(`value`) { + setPredelayMsec(value) + } + + /** + * Output percent of predelay. Value can range from 0 to 1. + */ + public final inline var predelayFeedback: Float + @JvmName("predelayFeedbackProperty") + get() = getPredelayFeedback() + @JvmName("predelayFeedbackProperty") + set(`value`) { + setPredelayFeedback(value) + } + + /** + * Dimensions of simulated room. Bigger means more echoes. Value can range from 0 to 1. + */ + public final inline var roomSize: Float + @JvmName("roomSizeProperty") + get() = getRoomSize() + @JvmName("roomSizeProperty") + set(`value`) { + setRoomSize(value) + } + + /** + * Defines how reflective the imaginary room's walls are. Value can range from 0 to 1. + */ + public final inline var damping: Float + @JvmName("dampingProperty") + get() = getDamping() + @JvmName("dampingProperty") + set(`value`) { + setDamping(value) + } + + /** + * Widens or narrows the stereo image of the reverb tail. 1 means fully widens. Value can range + * from 0 to 1. + */ + public final inline var spread: Float + @JvmName("spreadProperty") + get() = getSpread() + @JvmName("spreadProperty") + set(`value`) { + setSpread(value) + } + + /** + * High-pass filter passes signals with a frequency higher than a certain cutoff frequency and + * attenuates signals with frequencies lower than the cutoff frequency. Value can range from 0 to 1. + */ + public final inline var hipass: Float + @JvmName("hipassProperty") + get() = getHpf() + @JvmName("hipassProperty") + set(`value`) { + setHpf(value) + } + + /** + * Output percent of original sound. At 0, only modified sound is outputted. Value can range from + * 0 to 1. + */ + public final inline var dry: Float + @JvmName("dryProperty") + get() = getDry() + @JvmName("dryProperty") + set(`value`) { + setDry(value) + } + + /** + * Output percent of modified sound. At 0, only original sound is outputted. Value can range from + * 0 to 1. + */ + public final inline var wet: Float + @JvmName("wetProperty") + get() = getWet() + @JvmName("wetProperty") + set(`value`) { + setWet(value) + } + + public override fun new(scriptIndex: Int): Unit { + Internals.callConstructor(this, ENGINE_CLASS_AUDIOEFFECTREVERB_INDEX, scriptIndex) + } + + public final fun setPredelayMsec(msec: Float): Unit { + Internals.writeArguments(DOUBLE to msec.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setPredelayMsecPtr, NIL) + } + + public final fun getPredelayMsec(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getPredelayMsecPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setPredelayFeedback(feedback: Float): Unit { + Internals.writeArguments(DOUBLE to feedback.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setPredelayFeedbackPtr, NIL) + } + + public final fun getPredelayFeedback(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getPredelayFeedbackPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setRoomSize(size: Float): Unit { + Internals.writeArguments(DOUBLE to size.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setRoomSizePtr, NIL) + } + + public final fun getRoomSize(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getRoomSizePtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setDamping(amount: Float): Unit { + Internals.writeArguments(DOUBLE to amount.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setDampingPtr, NIL) + } + + public final fun getDamping(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getDampingPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setSpread(amount: Float): Unit { + Internals.writeArguments(DOUBLE to amount.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setSpreadPtr, NIL) + } + + public final fun getSpread(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getSpreadPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setDry(amount: Float): Unit { + Internals.writeArguments(DOUBLE to amount.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setDryPtr, NIL) + } + + public final fun getDry(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getDryPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setWet(amount: Float): Unit { + Internals.writeArguments(DOUBLE to amount.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setWetPtr, NIL) + } + + public final fun getWet(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getWetPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setHpf(amount: Float): Unit { + Internals.writeArguments(DOUBLE to amount.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setHpfPtr, NIL) + } + + public final fun getHpf(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getHpfPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public companion object + + public object MethodBindings { + internal val setPredelayMsecPtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectReverb", "set_predelay_msec", 373806689) + + internal val getPredelayMsecPtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectReverb", "get_predelay_msec", 1740695150) + + internal val setPredelayFeedbackPtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectReverb", "set_predelay_feedback", 373806689) + + internal val getPredelayFeedbackPtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectReverb", "get_predelay_feedback", 1740695150) + + internal val setRoomSizePtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectReverb", "set_room_size", 373806689) + + internal val getRoomSizePtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectReverb", "get_room_size", 1740695150) + + internal val setDampingPtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectReverb", "set_damping", 373806689) + + internal val getDampingPtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectReverb", "get_damping", 1740695150) + + internal val setSpreadPtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectReverb", "set_spread", 373806689) + + internal val getSpreadPtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectReverb", "get_spread", 1740695150) + + internal val setDryPtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectReverb", "set_dry", 373806689) + + internal val getDryPtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectReverb", "get_dry", 1740695150) + + internal val setWetPtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectReverb", "set_wet", 373806689) + + internal val getWetPtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectReverb", "get_wet", 1740695150) + + internal val setHpfPtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectReverb", "set_hpf", 373806689) + + internal val getHpfPtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectReverb", "get_hpf", 1740695150) + } +} diff --git a/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioEffectSpectrumAnalyzer.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioEffectSpectrumAnalyzer.kt new file mode 100644 index 0000000000..c672463f2a --- /dev/null +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioEffectSpectrumAnalyzer.kt @@ -0,0 +1,170 @@ +// THIS FILE IS GENERATED! DO NOT EDIT IT MANUALLY! +@file:Suppress("PackageDirectoryMismatch", "unused", "FunctionName", "RedundantModalityModifier", + "UNCHECKED_CAST", "JoinDeclarationAndAssignment", "USELESS_CAST", + "RemoveRedundantQualifierName", "NOTHING_TO_INLINE", "NON_FINAL_MEMBER_IN_OBJECT", + "RedundantVisibilityModifier", "RedundantUnitReturnType", "MemberVisibilityCanBePrivate") + +package godot + +import godot.`annotation`.GodotBaseType +import godot.core.VariantParser.DOUBLE +import godot.core.VariantParser.LONG +import godot.core.VariantParser.NIL +import godot.util.Internals +import godot.util.VoidPtr +import kotlin.Double +import kotlin.Float +import kotlin.Int +import kotlin.Long +import kotlin.Suppress +import kotlin.Unit +import kotlin.jvm.JvmName + +private const val ENGINE_CLASS_AUDIOEFFECTSPECTRUMANALYZER_INDEX: Int = 107 + +/** + * This audio effect does not affect sound output, but can be used for real-time audio + * visualizations. + * This resource configures an [AudioEffectSpectrumAnalyzerInstance], which performs the actual + * analysis at runtime. An instance can be acquired with [AudioServer.getBusEffectInstance]. + * See also [AudioStreamGenerator] for procedurally generating sounds. + */ +@GodotBaseType +public open class AudioEffectSpectrumAnalyzer : AudioEffect() { + /** + * The length of the buffer to keep (in seconds). Higher values keep data around for longer, but + * require more memory. + */ + public final inline var bufferLength: Float + @JvmName("bufferLengthProperty") + get() = getBufferLength() + @JvmName("bufferLengthProperty") + set(`value`) { + setBufferLength(value) + } + + public final inline var tapBackPos: Float + @JvmName("tapBackPosProperty") + get() = getTapBackPos() + @JvmName("tapBackPosProperty") + set(`value`) { + setTapBackPos(value) + } + + /** + * The size of the [url=https://en.wikipedia.org/wiki/Fast_Fourier_transform]Fast Fourier + * transform[/url] buffer. Higher values smooth out the spectrum analysis over time, but have greater + * latency. The effects of this higher latency are especially noticeable with sudden amplitude + * changes. + */ + public final inline var fftSize: FFTSize + @JvmName("fftSizeProperty") + get() = getFftSize() + @JvmName("fftSizeProperty") + set(`value`) { + setFftSize(value) + } + + public override fun new(scriptIndex: Int): Unit { + Internals.callConstructor(this, ENGINE_CLASS_AUDIOEFFECTSPECTRUMANALYZER_INDEX, scriptIndex) + } + + public final fun setBufferLength(seconds: Float): Unit { + Internals.writeArguments(DOUBLE to seconds.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setBufferLengthPtr, NIL) + } + + public final fun getBufferLength(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getBufferLengthPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setTapBackPos(seconds: Float): Unit { + Internals.writeArguments(DOUBLE to seconds.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setTapBackPosPtr, NIL) + } + + public final fun getTapBackPos(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getTapBackPosPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setFftSize(size: FFTSize): Unit { + Internals.writeArguments(LONG to size.id) + Internals.callMethod(rawPtr, MethodBindings.setFftSizePtr, NIL) + } + + public final fun getFftSize(): FFTSize { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getFftSizePtr, LONG) + return AudioEffectSpectrumAnalyzer.FFTSize.from(Internals.readReturnValue(LONG) as Long) + } + + public enum class FFTSize( + id: Long, + ) { + /** + * Use a buffer of 256 samples for the Fast Fourier transform. Lowest latency, but least stable + * over time. + */ + FFT_SIZE_256(0), + /** + * Use a buffer of 512 samples for the Fast Fourier transform. Low latency, but less stable over + * time. + */ + FFT_SIZE_512(1), + /** + * Use a buffer of 1024 samples for the Fast Fourier transform. This is a compromise between + * latency and stability over time. + */ + FFT_SIZE_1024(2), + /** + * Use a buffer of 2048 samples for the Fast Fourier transform. High latency, but stable over + * time. + */ + FFT_SIZE_2048(3), + /** + * Use a buffer of 4096 samples for the Fast Fourier transform. Highest latency, but most stable + * over time. + */ + FFT_SIZE_4096(4), + /** + * Represents the size of the [FFTSize] enum. + */ + FFT_SIZE_MAX(5), + ; + + public val id: Long + init { + this.id = id + } + + public companion object { + public fun from(`value`: Long): FFTSize = entries.single { it.id == `value` } + } + } + + public companion object + + public object MethodBindings { + internal val setBufferLengthPtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectSpectrumAnalyzer", "set_buffer_length", 373806689) + + internal val getBufferLengthPtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectSpectrumAnalyzer", "get_buffer_length", 1740695150) + + internal val setTapBackPosPtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectSpectrumAnalyzer", "set_tap_back_pos", 373806689) + + internal val getTapBackPosPtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectSpectrumAnalyzer", "get_tap_back_pos", 1740695150) + + internal val setFftSizePtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectSpectrumAnalyzer", "set_fft_size", 1202879215) + + internal val getFftSizePtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectSpectrumAnalyzer", "get_fft_size", 3925405343) + } +} diff --git a/kt/godot-library/src/main/kotlin/godot/gen/godot/AudioEffectSpectrumAnalyzerInstance.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioEffectSpectrumAnalyzerInstance.kt similarity index 76% rename from kt/godot-library/src/main/kotlin/godot/gen/godot/AudioEffectSpectrumAnalyzerInstance.kt rename to kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioEffectSpectrumAnalyzerInstance.kt index fb61eab87c..5e1d227a65 100644 --- a/kt/godot-library/src/main/kotlin/godot/gen/godot/AudioEffectSpectrumAnalyzerInstance.kt +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioEffectSpectrumAnalyzerInstance.kt @@ -7,12 +7,11 @@ package godot import godot.`annotation`.GodotBaseType -import godot.core.TypeManager import godot.core.VariantParser.DOUBLE import godot.core.VariantParser.LONG import godot.core.VariantParser.VECTOR2 import godot.core.Vector2 -import godot.core.memory.TransferContext +import godot.util.Internals import godot.util.VoidPtr import kotlin.Float import kotlin.Int @@ -21,6 +20,8 @@ import kotlin.Suppress import kotlin.Unit import kotlin.jvm.JvmOverloads +private const val ENGINE_CLASS_AUDIOEFFECTSPECTRUMANALYZERINSTANCE_INDEX: Int = 108 + /** * The runtime part of an [AudioEffectSpectrumAnalyzer], which can be used to query the magnitude of * a frequency range on its host bus. @@ -30,7 +31,8 @@ import kotlin.jvm.JvmOverloads public open class AudioEffectSpectrumAnalyzerInstance internal constructor() : AudioEffectInstance() { public override fun new(scriptIndex: Int): Unit { - callConstructor(ENGINECLASS_AUDIOEFFECTSPECTRUMANALYZERINSTANCE, scriptIndex) + Internals.callConstructor(this, ENGINE_CLASS_AUDIOEFFECTSPECTRUMANALYZERINSTANCE_INDEX, + scriptIndex) } /** @@ -45,9 +47,9 @@ public open class AudioEffectSpectrumAnalyzerInstance internal constructor() : A toHz: Float, mode: MagnitudeMode = AudioEffectSpectrumAnalyzerInstance.MagnitudeMode.MAGNITUDE_MAX, ): Vector2 { - TransferContext.writeArguments(DOUBLE to fromHz.toDouble(), DOUBLE to toHz.toDouble(), LONG to mode.id) - TransferContext.callMethod(rawPtr, MethodBindings.getMagnitudeForFrequencyRangePtr, VECTOR2) - return (TransferContext.readReturnValue(VECTOR2) as Vector2) + Internals.writeArguments(DOUBLE to fromHz.toDouble(), DOUBLE to toHz.toDouble(), LONG to mode.id) + Internals.callMethod(rawPtr, MethodBindings.getMagnitudeForFrequencyRangePtr, VECTOR2) + return (Internals.readReturnValue(VECTOR2) as Vector2) } public enum class MagnitudeMode( @@ -75,8 +77,8 @@ public open class AudioEffectSpectrumAnalyzerInstance internal constructor() : A public companion object - internal object MethodBindings { - public val getMagnitudeForFrequencyRangePtr: VoidPtr = - TypeManager.getMethodBindPtr("AudioEffectSpectrumAnalyzerInstance", "get_magnitude_for_frequency_range", 797993915) + public object MethodBindings { + internal val getMagnitudeForFrequencyRangePtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectSpectrumAnalyzerInstance", "get_magnitude_for_frequency_range", 797993915) } } diff --git a/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioEffectStereoEnhance.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioEffectStereoEnhance.kt new file mode 100644 index 0000000000..5c0efa842c --- /dev/null +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioEffectStereoEnhance.kt @@ -0,0 +1,115 @@ +// THIS FILE IS GENERATED! DO NOT EDIT IT MANUALLY! +@file:Suppress("PackageDirectoryMismatch", "unused", "FunctionName", "RedundantModalityModifier", + "UNCHECKED_CAST", "JoinDeclarationAndAssignment", "USELESS_CAST", + "RemoveRedundantQualifierName", "NOTHING_TO_INLINE", "NON_FINAL_MEMBER_IN_OBJECT", + "RedundantVisibilityModifier", "RedundantUnitReturnType", "MemberVisibilityCanBePrivate") + +package godot + +import godot.`annotation`.GodotBaseType +import godot.core.VariantParser.DOUBLE +import godot.core.VariantParser.NIL +import godot.util.Internals +import godot.util.VoidPtr +import kotlin.Double +import kotlin.Float +import kotlin.Int +import kotlin.Suppress +import kotlin.Unit +import kotlin.jvm.JvmName + +private const val ENGINE_CLASS_AUDIOEFFECTSTEREOENHANCE_INDEX: Int = 109 + +/** + * An audio effect that can be used to adjust the intensity of stereo panning. + */ +@GodotBaseType +public open class AudioEffectStereoEnhance : AudioEffect() { + /** + * Values greater than 1.0 increase intensity of any panning on audio passing through this effect, + * whereas values less than 1.0 will decrease the panning intensity. A value of 0.0 will downmix + * audio to mono. + */ + public final inline var panPullout: Float + @JvmName("panPulloutProperty") + get() = getPanPullout() + @JvmName("panPulloutProperty") + set(`value`) { + setPanPullout(value) + } + + public final inline var timePulloutMs: Float + @JvmName("timePulloutMsProperty") + get() = getTimePullout() + @JvmName("timePulloutMsProperty") + set(`value`) { + setTimePullout(value) + } + + public final inline var surround: Float + @JvmName("surroundProperty") + get() = getSurround() + @JvmName("surroundProperty") + set(`value`) { + setSurround(value) + } + + public override fun new(scriptIndex: Int): Unit { + Internals.callConstructor(this, ENGINE_CLASS_AUDIOEFFECTSTEREOENHANCE_INDEX, scriptIndex) + } + + public final fun setPanPullout(amount: Float): Unit { + Internals.writeArguments(DOUBLE to amount.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setPanPulloutPtr, NIL) + } + + public final fun getPanPullout(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getPanPulloutPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setTimePullout(amount: Float): Unit { + Internals.writeArguments(DOUBLE to amount.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setTimePulloutPtr, NIL) + } + + public final fun getTimePullout(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getTimePulloutPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setSurround(amount: Float): Unit { + Internals.writeArguments(DOUBLE to amount.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setSurroundPtr, NIL) + } + + public final fun getSurround(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getSurroundPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public companion object + + public object MethodBindings { + internal val setPanPulloutPtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectStereoEnhance", "set_pan_pullout", 373806689) + + internal val getPanPulloutPtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectStereoEnhance", "get_pan_pullout", 1740695150) + + internal val setTimePulloutPtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectStereoEnhance", "set_time_pullout", 373806689) + + internal val getTimePulloutPtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectStereoEnhance", "get_time_pullout", 1740695150) + + internal val setSurroundPtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectStereoEnhance", "set_surround", 373806689) + + internal val getSurroundPtr: VoidPtr = + Internals.getMethodBindPtr("AudioEffectStereoEnhance", "get_surround", 1740695150) + } +} diff --git a/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioListener2D.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioListener2D.kt new file mode 100644 index 0000000000..4bb565cab6 --- /dev/null +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioListener2D.kt @@ -0,0 +1,73 @@ +// THIS FILE IS GENERATED! DO NOT EDIT IT MANUALLY! +@file:Suppress("PackageDirectoryMismatch", "unused", "FunctionName", "RedundantModalityModifier", + "UNCHECKED_CAST", "JoinDeclarationAndAssignment", "USELESS_CAST", + "RemoveRedundantQualifierName", "NOTHING_TO_INLINE", "NON_FINAL_MEMBER_IN_OBJECT", + "RedundantVisibilityModifier", "RedundantUnitReturnType", "MemberVisibilityCanBePrivate") + +package godot + +import godot.`annotation`.GodotBaseType +import godot.core.VariantParser.BOOL +import godot.core.VariantParser.NIL +import godot.util.Internals +import godot.util.VoidPtr +import kotlin.Boolean +import kotlin.Int +import kotlin.Suppress +import kotlin.Unit + +private const val ENGINE_CLASS_AUDIOLISTENER2D_INDEX: Int = 110 + +/** + * Once added to the scene tree and enabled using [makeCurrent], this node will override the + * location sounds are heard from. Only one [AudioListener2D] can be current. Using [makeCurrent] will + * disable the previous [AudioListener2D]. + * If there is no active [AudioListener2D] in the current [Viewport], center of the screen will be + * used as a hearing point for the audio. [AudioListener2D] needs to be inside [SceneTree] to function. + */ +@GodotBaseType +public open class AudioListener2D : Node2D() { + public override fun new(scriptIndex: Int): Unit { + Internals.callConstructor(this, ENGINE_CLASS_AUDIOLISTENER2D_INDEX, scriptIndex) + } + + /** + * Makes the [AudioListener2D] active, setting it as the hearing point for the sounds. If there is + * already another active [AudioListener2D], it will be disabled. + * This method will have no effect if the [AudioListener2D] is not added to [SceneTree]. + */ + public final fun makeCurrent(): Unit { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.makeCurrentPtr, NIL) + } + + /** + * Disables the [AudioListener2D]. If it's not set as current, this method will have no effect. + */ + public final fun clearCurrent(): Unit { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.clearCurrentPtr, NIL) + } + + /** + * Returns `true` if this [AudioListener2D] is currently active. + */ + public final fun isCurrent(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isCurrentPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public companion object + + public object MethodBindings { + internal val makeCurrentPtr: VoidPtr = + Internals.getMethodBindPtr("AudioListener2D", "make_current", 3218959716) + + internal val clearCurrentPtr: VoidPtr = + Internals.getMethodBindPtr("AudioListener2D", "clear_current", 3218959716) + + internal val isCurrentPtr: VoidPtr = + Internals.getMethodBindPtr("AudioListener2D", "is_current", 36873697) + } +} diff --git a/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioListener3D.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioListener3D.kt new file mode 100644 index 0000000000..baf0de63f0 --- /dev/null +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioListener3D.kt @@ -0,0 +1,85 @@ +// THIS FILE IS GENERATED! DO NOT EDIT IT MANUALLY! +@file:Suppress("PackageDirectoryMismatch", "unused", "FunctionName", "RedundantModalityModifier", + "UNCHECKED_CAST", "JoinDeclarationAndAssignment", "USELESS_CAST", + "RemoveRedundantQualifierName", "NOTHING_TO_INLINE", "NON_FINAL_MEMBER_IN_OBJECT", + "RedundantVisibilityModifier", "RedundantUnitReturnType", "MemberVisibilityCanBePrivate") + +package godot + +import godot.`annotation`.GodotBaseType +import godot.core.Transform3D +import godot.core.VariantParser.BOOL +import godot.core.VariantParser.NIL +import godot.core.VariantParser.TRANSFORM3D +import godot.util.Internals +import godot.util.VoidPtr +import kotlin.Boolean +import kotlin.Int +import kotlin.Suppress +import kotlin.Unit + +private const val ENGINE_CLASS_AUDIOLISTENER3D_INDEX: Int = 111 + +/** + * Once added to the scene tree and enabled using [makeCurrent], this node will override the + * location sounds are heard from. This can be used to listen from a location different from the + * [Camera3D]. + */ +@GodotBaseType +public open class AudioListener3D : Node3D() { + public override fun new(scriptIndex: Int): Unit { + Internals.callConstructor(this, ENGINE_CLASS_AUDIOLISTENER3D_INDEX, scriptIndex) + } + + /** + * Enables the listener. This will override the current camera's listener. + */ + public final fun makeCurrent(): Unit { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.makeCurrentPtr, NIL) + } + + /** + * Disables the listener to use the current camera's listener instead. + */ + public final fun clearCurrent(): Unit { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.clearCurrentPtr, NIL) + } + + /** + * Returns `true` if the listener was made current using [makeCurrent], `false` otherwise. + * **Note:** There may be more than one AudioListener3D marked as "current" in the scene tree, but + * only the one that was made current last will be used. + */ + public final fun isCurrent(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isCurrentPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + /** + * Returns the listener's global orthonormalized [Transform3D]. + */ + public final fun getListenerTransform(): Transform3D { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getListenerTransformPtr, TRANSFORM3D) + return (Internals.readReturnValue(TRANSFORM3D) as Transform3D) + } + + public companion object + + public object MethodBindings { + internal val makeCurrentPtr: VoidPtr = + Internals.getMethodBindPtr("AudioListener3D", "make_current", 3218959716) + + internal val clearCurrentPtr: VoidPtr = + Internals.getMethodBindPtr("AudioListener3D", "clear_current", 3218959716) + + internal val isCurrentPtr: VoidPtr = + Internals.getMethodBindPtr("AudioListener3D", "is_current", 36873697) + + internal val getListenerTransformPtr: VoidPtr = + Internals.getMethodBindPtr("AudioListener3D", "get_listener_transform", 3229777777) + } +} diff --git a/kt/godot-library/src/main/kotlin/godot/gen/godot/AudioSample.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioSample.kt similarity index 77% rename from kt/godot-library/src/main/kotlin/godot/gen/godot/AudioSample.kt rename to kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioSample.kt index eb75bb14d2..23db2d1b4b 100644 --- a/kt/godot-library/src/main/kotlin/godot/gen/godot/AudioSample.kt +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioSample.kt @@ -7,20 +7,23 @@ package godot import godot.`annotation`.GodotBaseType +import godot.util.Internals import kotlin.Int import kotlin.Suppress import kotlin.Unit +private const val ENGINE_CLASS_AUDIOSAMPLE_INDEX: Int = 112 + /** * Base class for audio samples. */ @GodotBaseType public open class AudioSample : RefCounted() { public override fun new(scriptIndex: Int): Unit { - callConstructor(ENGINECLASS_AUDIOSAMPLE, scriptIndex) + Internals.callConstructor(this, ENGINE_CLASS_AUDIOSAMPLE_INDEX, scriptIndex) } public companion object - internal object MethodBindings + public object MethodBindings } diff --git a/kt/godot-library/src/main/kotlin/godot/gen/godot/AudioSamplePlayback.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioSamplePlayback.kt similarity index 77% rename from kt/godot-library/src/main/kotlin/godot/gen/godot/AudioSamplePlayback.kt rename to kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioSamplePlayback.kt index 703f9f1b03..7c62986410 100644 --- a/kt/godot-library/src/main/kotlin/godot/gen/godot/AudioSamplePlayback.kt +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioSamplePlayback.kt @@ -7,20 +7,23 @@ package godot import godot.`annotation`.GodotBaseType +import godot.util.Internals import kotlin.Int import kotlin.Suppress import kotlin.Unit +private const val ENGINE_CLASS_AUDIOSAMPLEPLAYBACK_INDEX: Int = 113 + /** * Meta class for playing back audio samples. */ @GodotBaseType public open class AudioSamplePlayback : RefCounted() { public override fun new(scriptIndex: Int): Unit { - callConstructor(ENGINECLASS_AUDIOSAMPLEPLAYBACK, scriptIndex) + Internals.callConstructor(this, ENGINE_CLASS_AUDIOSAMPLEPLAYBACK_INDEX, scriptIndex) } public companion object - internal object MethodBindings + public object MethodBindings } diff --git a/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioServer.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioServer.kt new file mode 100644 index 0000000000..aa483cf1f1 --- /dev/null +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioServer.kt @@ -0,0 +1,753 @@ +// THIS FILE IS GENERATED! DO NOT EDIT IT MANUALLY! +@file:Suppress("PackageDirectoryMismatch", "unused", "FunctionName", "RedundantModalityModifier", + "UNCHECKED_CAST", "JoinDeclarationAndAssignment", "USELESS_CAST", + "RemoveRedundantQualifierName", "NOTHING_TO_INLINE", "NON_FINAL_MEMBER_IN_OBJECT", + "RedundantVisibilityModifier", "RedundantUnitReturnType", "MemberVisibilityCanBePrivate") + +package godot + +import godot.`annotation`.GodotBaseType +import godot.core.PackedStringArray +import godot.core.Signal0 +import godot.core.Signal3 +import godot.core.StringName +import godot.core.VariantParser.BOOL +import godot.core.VariantParser.DOUBLE +import godot.core.VariantParser.LONG +import godot.core.VariantParser.NIL +import godot.core.VariantParser.OBJECT +import godot.core.VariantParser.PACKED_STRING_ARRAY +import godot.core.VariantParser.STRING +import godot.core.VariantParser.STRING_NAME +import godot.util.Internals +import godot.util.VoidPtr +import kotlin.Boolean +import kotlin.Double +import kotlin.Float +import kotlin.Int +import kotlin.Long +import kotlin.String +import kotlin.Suppress +import kotlin.Unit +import kotlin.jvm.JvmOverloads +import kotlin.jvm.JvmStatic + +private const val ENGINE_CLASS_AUDIOSERVER_INDEX: Int = 28 + +/** + * [AudioServer] is a low-level server interface for audio access. It is in charge of creating + * sample data (playable audio) as well as its playback via a voice interface. + */ +@GodotBaseType +public object AudioServer : Object() { + /** + * Emitted when an audio bus is added, deleted, or moved. + */ + @JvmStatic + public val busLayoutChanged: Signal0 by Signal0 + + /** + * Emitted when the audio bus at [busIndex] is renamed from [oldName] to [newName]. + */ + @JvmStatic + public val busRenamed: Signal3 by Signal3 + + public override fun new(scriptIndex: Int): Unit { + Internals.getSingleton(this, ENGINE_CLASS_AUDIOSERVER_INDEX) + } + + @JvmStatic + public final fun setBusCount(amount: Int): Unit { + Internals.writeArguments(LONG to amount.toLong()) + Internals.callMethod(rawPtr, MethodBindings.setBusCountPtr, NIL) + } + + @JvmStatic + public final fun getBusCount(): Int { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getBusCountPtr, LONG) + return (Internals.readReturnValue(LONG) as Long).toInt() + } + + /** + * Removes the bus at index [index]. + */ + @JvmStatic + public final fun removeBus(index: Int): Unit { + Internals.writeArguments(LONG to index.toLong()) + Internals.callMethod(rawPtr, MethodBindings.removeBusPtr, NIL) + } + + /** + * Adds a bus at [atPosition]. + */ + @JvmOverloads + @JvmStatic + public final fun addBus(atPosition: Int = -1): Unit { + Internals.writeArguments(LONG to atPosition.toLong()) + Internals.callMethod(rawPtr, MethodBindings.addBusPtr, NIL) + } + + /** + * Moves the bus from index [index] to index [toIndex]. + */ + @JvmStatic + public final fun moveBus(index: Int, toIndex: Int): Unit { + Internals.writeArguments(LONG to index.toLong(), LONG to toIndex.toLong()) + Internals.callMethod(rawPtr, MethodBindings.moveBusPtr, NIL) + } + + /** + * Sets the name of the bus at index [busIdx] to [name]. + */ + @JvmStatic + public final fun setBusName(busIdx: Int, name: String): Unit { + Internals.writeArguments(LONG to busIdx.toLong(), STRING to name) + Internals.callMethod(rawPtr, MethodBindings.setBusNamePtr, NIL) + } + + /** + * Returns the name of the bus with the index [busIdx]. + */ + @JvmStatic + public final fun getBusName(busIdx: Int): String { + Internals.writeArguments(LONG to busIdx.toLong()) + Internals.callMethod(rawPtr, MethodBindings.getBusNamePtr, STRING) + return (Internals.readReturnValue(STRING) as String) + } + + /** + * Returns the index of the bus with the name [busName]. Returns `-1` if no bus with the specified + * name exist. + */ + @JvmStatic + public final fun getBusIndex(busName: StringName): Int { + Internals.writeArguments(STRING_NAME to busName) + Internals.callMethod(rawPtr, MethodBindings.getBusIndexPtr, LONG) + return (Internals.readReturnValue(LONG) as Long).toInt() + } + + /** + * Returns the number of channels of the bus at index [busIdx]. + */ + @JvmStatic + public final fun getBusChannels(busIdx: Int): Int { + Internals.writeArguments(LONG to busIdx.toLong()) + Internals.callMethod(rawPtr, MethodBindings.getBusChannelsPtr, LONG) + return (Internals.readReturnValue(LONG) as Long).toInt() + } + + /** + * Sets the volume of the bus at index [busIdx] to [volumeDb]. + */ + @JvmStatic + public final fun setBusVolumeDb(busIdx: Int, volumeDb: Float): Unit { + Internals.writeArguments(LONG to busIdx.toLong(), DOUBLE to volumeDb.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setBusVolumeDbPtr, NIL) + } + + /** + * Returns the volume of the bus at index [busIdx] in dB. + */ + @JvmStatic + public final fun getBusVolumeDb(busIdx: Int): Float { + Internals.writeArguments(LONG to busIdx.toLong()) + Internals.callMethod(rawPtr, MethodBindings.getBusVolumeDbPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + /** + * Connects the output of the bus at [busIdx] to the bus named [send]. + */ + @JvmStatic + public final fun setBusSend(busIdx: Int, send: StringName): Unit { + Internals.writeArguments(LONG to busIdx.toLong(), STRING_NAME to send) + Internals.callMethod(rawPtr, MethodBindings.setBusSendPtr, NIL) + } + + /** + * Returns the name of the bus that the bus at index [busIdx] sends to. + */ + @JvmStatic + public final fun getBusSend(busIdx: Int): StringName { + Internals.writeArguments(LONG to busIdx.toLong()) + Internals.callMethod(rawPtr, MethodBindings.getBusSendPtr, STRING_NAME) + return (Internals.readReturnValue(STRING_NAME) as StringName) + } + + /** + * If `true`, the bus at index [busIdx] is in solo mode. + */ + @JvmStatic + public final fun setBusSolo(busIdx: Int, enable: Boolean): Unit { + Internals.writeArguments(LONG to busIdx.toLong(), BOOL to enable) + Internals.callMethod(rawPtr, MethodBindings.setBusSoloPtr, NIL) + } + + /** + * If `true`, the bus at index [busIdx] is in solo mode. + */ + @JvmStatic + public final fun isBusSolo(busIdx: Int): Boolean { + Internals.writeArguments(LONG to busIdx.toLong()) + Internals.callMethod(rawPtr, MethodBindings.isBusSoloPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + /** + * If `true`, the bus at index [busIdx] is muted. + */ + @JvmStatic + public final fun setBusMute(busIdx: Int, enable: Boolean): Unit { + Internals.writeArguments(LONG to busIdx.toLong(), BOOL to enable) + Internals.callMethod(rawPtr, MethodBindings.setBusMutePtr, NIL) + } + + /** + * If `true`, the bus at index [busIdx] is muted. + */ + @JvmStatic + public final fun isBusMute(busIdx: Int): Boolean { + Internals.writeArguments(LONG to busIdx.toLong()) + Internals.callMethod(rawPtr, MethodBindings.isBusMutePtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + /** + * If `true`, the bus at index [busIdx] is bypassing effects. + */ + @JvmStatic + public final fun setBusBypassEffects(busIdx: Int, enable: Boolean): Unit { + Internals.writeArguments(LONG to busIdx.toLong(), BOOL to enable) + Internals.callMethod(rawPtr, MethodBindings.setBusBypassEffectsPtr, NIL) + } + + /** + * If `true`, the bus at index [busIdx] is bypassing effects. + */ + @JvmStatic + public final fun isBusBypassingEffects(busIdx: Int): Boolean { + Internals.writeArguments(LONG to busIdx.toLong()) + Internals.callMethod(rawPtr, MethodBindings.isBusBypassingEffectsPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + /** + * Adds an [AudioEffect] effect to the bus [busIdx] at [atPosition]. + */ + @JvmOverloads + @JvmStatic + public final fun addBusEffect( + busIdx: Int, + effect: AudioEffect?, + atPosition: Int = -1, + ): Unit { + Internals.writeArguments(LONG to busIdx.toLong(), OBJECT to effect, LONG to atPosition.toLong()) + Internals.callMethod(rawPtr, MethodBindings.addBusEffectPtr, NIL) + } + + /** + * Removes the effect at index [effectIdx] from the bus at index [busIdx]. + */ + @JvmStatic + public final fun removeBusEffect(busIdx: Int, effectIdx: Int): Unit { + Internals.writeArguments(LONG to busIdx.toLong(), LONG to effectIdx.toLong()) + Internals.callMethod(rawPtr, MethodBindings.removeBusEffectPtr, NIL) + } + + /** + * Returns the number of effects on the bus at [busIdx]. + */ + @JvmStatic + public final fun getBusEffectCount(busIdx: Int): Int { + Internals.writeArguments(LONG to busIdx.toLong()) + Internals.callMethod(rawPtr, MethodBindings.getBusEffectCountPtr, LONG) + return (Internals.readReturnValue(LONG) as Long).toInt() + } + + /** + * Returns the [AudioEffect] at position [effectIdx] in bus [busIdx]. + */ + @JvmStatic + public final fun getBusEffect(busIdx: Int, effectIdx: Int): AudioEffect? { + Internals.writeArguments(LONG to busIdx.toLong(), LONG to effectIdx.toLong()) + Internals.callMethod(rawPtr, MethodBindings.getBusEffectPtr, OBJECT) + return (Internals.readReturnValue(OBJECT) as AudioEffect?) + } + + /** + * Returns the [AudioEffectInstance] assigned to the given bus and effect indices (and optionally + * channel). + */ + @JvmOverloads + @JvmStatic + public final fun getBusEffectInstance( + busIdx: Int, + effectIdx: Int, + channel: Int = 0, + ): AudioEffectInstance? { + Internals.writeArguments(LONG to busIdx.toLong(), LONG to effectIdx.toLong(), LONG to channel.toLong()) + Internals.callMethod(rawPtr, MethodBindings.getBusEffectInstancePtr, OBJECT) + return (Internals.readReturnValue(OBJECT) as AudioEffectInstance?) + } + + /** + * Swaps the position of two effects in bus [busIdx]. + */ + @JvmStatic + public final fun swapBusEffects( + busIdx: Int, + effectIdx: Int, + byEffectIdx: Int, + ): Unit { + Internals.writeArguments(LONG to busIdx.toLong(), LONG to effectIdx.toLong(), LONG to byEffectIdx.toLong()) + Internals.callMethod(rawPtr, MethodBindings.swapBusEffectsPtr, NIL) + } + + /** + * If `true`, the effect at index [effectIdx] on the bus at index [busIdx] is enabled. + */ + @JvmStatic + public final fun setBusEffectEnabled( + busIdx: Int, + effectIdx: Int, + enabled: Boolean, + ): Unit { + Internals.writeArguments(LONG to busIdx.toLong(), LONG to effectIdx.toLong(), BOOL to enabled) + Internals.callMethod(rawPtr, MethodBindings.setBusEffectEnabledPtr, NIL) + } + + /** + * If `true`, the effect at index [effectIdx] on the bus at index [busIdx] is enabled. + */ + @JvmStatic + public final fun isBusEffectEnabled(busIdx: Int, effectIdx: Int): Boolean { + Internals.writeArguments(LONG to busIdx.toLong(), LONG to effectIdx.toLong()) + Internals.callMethod(rawPtr, MethodBindings.isBusEffectEnabledPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + /** + * Returns the peak volume of the left speaker at bus index [busIdx] and channel index [channel]. + */ + @JvmStatic + public final fun getBusPeakVolumeLeftDb(busIdx: Int, channel: Int): Float { + Internals.writeArguments(LONG to busIdx.toLong(), LONG to channel.toLong()) + Internals.callMethod(rawPtr, MethodBindings.getBusPeakVolumeLeftDbPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + /** + * Returns the peak volume of the right speaker at bus index [busIdx] and channel index [channel]. + */ + @JvmStatic + public final fun getBusPeakVolumeRightDb(busIdx: Int, channel: Int): Float { + Internals.writeArguments(LONG to busIdx.toLong(), LONG to channel.toLong()) + Internals.callMethod(rawPtr, MethodBindings.getBusPeakVolumeRightDbPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + @JvmStatic + public final fun setPlaybackSpeedScale(scale: Float): Unit { + Internals.writeArguments(DOUBLE to scale.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setPlaybackSpeedScalePtr, NIL) + } + + @JvmStatic + public final fun getPlaybackSpeedScale(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getPlaybackSpeedScalePtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + /** + * Locks the audio driver's main loop. + * **Note:** Remember to unlock it afterwards. + */ + @JvmStatic + public final fun lock(): Unit { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.lockPtr, NIL) + } + + /** + * Unlocks the audio driver's main loop. (After locking it, you should always unlock it.) + */ + @JvmStatic + public final fun unlock(): Unit { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.unlockPtr, NIL) + } + + /** + * Returns the speaker configuration. + */ + @JvmStatic + public final fun getSpeakerMode(): SpeakerMode { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getSpeakerModePtr, LONG) + return AudioServer.SpeakerMode.from(Internals.readReturnValue(LONG) as Long) + } + + /** + * Returns the sample rate at the output of the [AudioServer]. + */ + @JvmStatic + public final fun getMixRate(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getMixRatePtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + /** + * Returns the names of all audio output devices detected on the system. + */ + @JvmStatic + public final fun getOutputDeviceList(): PackedStringArray { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getOutputDeviceListPtr, PACKED_STRING_ARRAY) + return (Internals.readReturnValue(PACKED_STRING_ARRAY) as PackedStringArray) + } + + @JvmStatic + public final fun getOutputDevice(): String { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getOutputDevicePtr, STRING) + return (Internals.readReturnValue(STRING) as String) + } + + @JvmStatic + public final fun setOutputDevice(name: String): Unit { + Internals.writeArguments(STRING to name) + Internals.callMethod(rawPtr, MethodBindings.setOutputDevicePtr, NIL) + } + + /** + * Returns the relative time until the next mix occurs. + */ + @JvmStatic + public final fun getTimeToNextMix(): Double { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getTimeToNextMixPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double) + } + + /** + * Returns the relative time since the last mix occurred. + */ + @JvmStatic + public final fun getTimeSinceLastMix(): Double { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getTimeSinceLastMixPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double) + } + + /** + * Returns the audio driver's effective output latency. This is based on + * [ProjectSettings.audio/driver/outputLatency], but the exact returned value will differ depending + * on the operating system and audio driver. + * **Note:** This can be expensive; it is not recommended to call [getOutputLatency] every frame. + */ + @JvmStatic + public final fun getOutputLatency(): Double { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getOutputLatencyPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double) + } + + /** + * Returns the names of all audio input devices detected on the system. + * **Note:** [ProjectSettings.audio/driver/enableInput] must be `true` for audio input to work. + * See also that setting's description for caveats related to permissions and operating system + * privacy settings. + */ + @JvmStatic + public final fun getInputDeviceList(): PackedStringArray { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getInputDeviceListPtr, PACKED_STRING_ARRAY) + return (Internals.readReturnValue(PACKED_STRING_ARRAY) as PackedStringArray) + } + + @JvmStatic + public final fun getInputDevice(): String { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getInputDevicePtr, STRING) + return (Internals.readReturnValue(STRING) as String) + } + + @JvmStatic + public final fun setInputDevice(name: String): Unit { + Internals.writeArguments(STRING to name) + Internals.callMethod(rawPtr, MethodBindings.setInputDevicePtr, NIL) + } + + /** + * Overwrites the currently used [AudioBusLayout]. + */ + @JvmStatic + public final fun setBusLayout(busLayout: AudioBusLayout?): Unit { + Internals.writeArguments(OBJECT to busLayout) + Internals.callMethod(rawPtr, MethodBindings.setBusLayoutPtr, NIL) + } + + /** + * Generates an [AudioBusLayout] using the available buses and effects. + */ + @JvmStatic + public final fun generateBusLayout(): AudioBusLayout? { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.generateBusLayoutPtr, OBJECT) + return (Internals.readReturnValue(OBJECT) as AudioBusLayout?) + } + + /** + * If set to `true`, all instances of [AudioStreamPlayback] will call + * [AudioStreamPlayback.TagUsedStreams] every mix step. + * **Note:** This is enabled by default in the editor, as it is used by editor plugins for the + * audio stream previews. + */ + @JvmStatic + public final fun setEnableTaggingUsedAudioStreams(enable: Boolean): Unit { + Internals.writeArguments(BOOL to enable) + Internals.callMethod(rawPtr, MethodBindings.setEnableTaggingUsedAudioStreamsPtr, NIL) + } + + /** + * If `true`, the stream is registered as a sample. The engine will not have to register it before + * playing the sample. + * If `false`, the stream will have to be registered before playing it. To prevent lag spikes, + * register the stream as sample with [registerStreamAsSample]. + */ + @JvmStatic + public final fun isStreamRegisteredAsSample(stream: AudioStream?): Boolean { + Internals.writeArguments(OBJECT to stream) + Internals.callMethod(rawPtr, MethodBindings.isStreamRegisteredAsSamplePtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + /** + * Forces the registration of a stream as a sample. + * **Note:** Lag spikes may occur when calling this method, especially on single-threaded builds. + * It is suggested to call this method while loading assets, where the lag spike could be masked, + * instead of registering the sample right before it needs to be played. + */ + @JvmStatic + public final fun registerStreamAsSample(stream: AudioStream?): Unit { + Internals.writeArguments(OBJECT to stream) + Internals.callMethod(rawPtr, MethodBindings.registerStreamAsSamplePtr, NIL) + } + + public enum class SpeakerMode( + id: Long, + ) { + /** + * Two or fewer speakers were detected. + */ + SPEAKER_MODE_STEREO(0), + /** + * A 3.1 channel surround setup was detected. + */ + SPEAKER_SURROUND_31(1), + /** + * A 5.1 channel surround setup was detected. + */ + SPEAKER_SURROUND_51(2), + /** + * A 7.1 channel surround setup was detected. + */ + SPEAKER_SURROUND_71(3), + ; + + public val id: Long + init { + this.id = id + } + + public companion object { + public fun from(`value`: Long): SpeakerMode = entries.single { it.id == `value` } + } + } + + public enum class PlaybackType( + id: Long, + ) { + /** + * The playback will be considered of the type declared at + * [ProjectSettings.audio/general/defaultPlaybackType]. + */ + PLAYBACK_TYPE_DEFAULT(0), + /** + * Force the playback to be considered as a stream. + */ + PLAYBACK_TYPE_STREAM(1), + /** + * Force the playback to be considered as a sample. This can provide lower latency and more + * stable playback (with less risk of audio crackling), at the cost of having less flexibility. + * **Note:** Only currently supported on the web platform. + * **Note:** [AudioEffect]s are not supported when playback is considered as a sample. + */ + PLAYBACK_TYPE_SAMPLE(2), + /** + * Represents the size of the [PlaybackType] enum. + */ + PLAYBACK_TYPE_MAX(3), + ; + + public val id: Long + init { + this.id = id + } + + public companion object { + public fun from(`value`: Long): PlaybackType = entries.single { it.id == `value` } + } + } + + public object MethodBindings { + internal val setBusCountPtr: VoidPtr = + Internals.getMethodBindPtr("AudioServer", "set_bus_count", 1286410249) + + internal val getBusCountPtr: VoidPtr = + Internals.getMethodBindPtr("AudioServer", "get_bus_count", 3905245786) + + internal val removeBusPtr: VoidPtr = + Internals.getMethodBindPtr("AudioServer", "remove_bus", 1286410249) + + internal val addBusPtr: VoidPtr = + Internals.getMethodBindPtr("AudioServer", "add_bus", 1025054187) + + internal val moveBusPtr: VoidPtr = + Internals.getMethodBindPtr("AudioServer", "move_bus", 3937882851) + + internal val setBusNamePtr: VoidPtr = + Internals.getMethodBindPtr("AudioServer", "set_bus_name", 501894301) + + internal val getBusNamePtr: VoidPtr = + Internals.getMethodBindPtr("AudioServer", "get_bus_name", 844755477) + + internal val getBusIndexPtr: VoidPtr = + Internals.getMethodBindPtr("AudioServer", "get_bus_index", 2458036349) + + internal val getBusChannelsPtr: VoidPtr = + Internals.getMethodBindPtr("AudioServer", "get_bus_channels", 923996154) + + internal val setBusVolumeDbPtr: VoidPtr = + Internals.getMethodBindPtr("AudioServer", "set_bus_volume_db", 1602489585) + + internal val getBusVolumeDbPtr: VoidPtr = + Internals.getMethodBindPtr("AudioServer", "get_bus_volume_db", 2339986948) + + internal val setBusSendPtr: VoidPtr = + Internals.getMethodBindPtr("AudioServer", "set_bus_send", 3780747571) + + internal val getBusSendPtr: VoidPtr = + Internals.getMethodBindPtr("AudioServer", "get_bus_send", 659327637) + + internal val setBusSoloPtr: VoidPtr = + Internals.getMethodBindPtr("AudioServer", "set_bus_solo", 300928843) + + internal val isBusSoloPtr: VoidPtr = + Internals.getMethodBindPtr("AudioServer", "is_bus_solo", 1116898809) + + internal val setBusMutePtr: VoidPtr = + Internals.getMethodBindPtr("AudioServer", "set_bus_mute", 300928843) + + internal val isBusMutePtr: VoidPtr = + Internals.getMethodBindPtr("AudioServer", "is_bus_mute", 1116898809) + + internal val setBusBypassEffectsPtr: VoidPtr = + Internals.getMethodBindPtr("AudioServer", "set_bus_bypass_effects", 300928843) + + internal val isBusBypassingEffectsPtr: VoidPtr = + Internals.getMethodBindPtr("AudioServer", "is_bus_bypassing_effects", 1116898809) + + internal val addBusEffectPtr: VoidPtr = + Internals.getMethodBindPtr("AudioServer", "add_bus_effect", 4068819785) + + internal val removeBusEffectPtr: VoidPtr = + Internals.getMethodBindPtr("AudioServer", "remove_bus_effect", 3937882851) + + internal val getBusEffectCountPtr: VoidPtr = + Internals.getMethodBindPtr("AudioServer", "get_bus_effect_count", 3744713108) + + internal val getBusEffectPtr: VoidPtr = + Internals.getMethodBindPtr("AudioServer", "get_bus_effect", 726064442) + + internal val getBusEffectInstancePtr: VoidPtr = + Internals.getMethodBindPtr("AudioServer", "get_bus_effect_instance", 1829771234) + + internal val swapBusEffectsPtr: VoidPtr = + Internals.getMethodBindPtr("AudioServer", "swap_bus_effects", 1649997291) + + internal val setBusEffectEnabledPtr: VoidPtr = + Internals.getMethodBindPtr("AudioServer", "set_bus_effect_enabled", 1383440665) + + internal val isBusEffectEnabledPtr: VoidPtr = + Internals.getMethodBindPtr("AudioServer", "is_bus_effect_enabled", 2522259332) + + internal val getBusPeakVolumeLeftDbPtr: VoidPtr = + Internals.getMethodBindPtr("AudioServer", "get_bus_peak_volume_left_db", 3085491603) + + internal val getBusPeakVolumeRightDbPtr: VoidPtr = + Internals.getMethodBindPtr("AudioServer", "get_bus_peak_volume_right_db", 3085491603) + + internal val setPlaybackSpeedScalePtr: VoidPtr = + Internals.getMethodBindPtr("AudioServer", "set_playback_speed_scale", 373806689) + + internal val getPlaybackSpeedScalePtr: VoidPtr = + Internals.getMethodBindPtr("AudioServer", "get_playback_speed_scale", 1740695150) + + internal val lockPtr: VoidPtr = Internals.getMethodBindPtr("AudioServer", "lock", 3218959716) + + internal val unlockPtr: VoidPtr = + Internals.getMethodBindPtr("AudioServer", "unlock", 3218959716) + + internal val getSpeakerModePtr: VoidPtr = + Internals.getMethodBindPtr("AudioServer", "get_speaker_mode", 2549190337) + + internal val getMixRatePtr: VoidPtr = + Internals.getMethodBindPtr("AudioServer", "get_mix_rate", 1740695150) + + internal val getOutputDeviceListPtr: VoidPtr = + Internals.getMethodBindPtr("AudioServer", "get_output_device_list", 2981934095) + + internal val getOutputDevicePtr: VoidPtr = + Internals.getMethodBindPtr("AudioServer", "get_output_device", 2841200299) + + internal val setOutputDevicePtr: VoidPtr = + Internals.getMethodBindPtr("AudioServer", "set_output_device", 83702148) + + internal val getTimeToNextMixPtr: VoidPtr = + Internals.getMethodBindPtr("AudioServer", "get_time_to_next_mix", 1740695150) + + internal val getTimeSinceLastMixPtr: VoidPtr = + Internals.getMethodBindPtr("AudioServer", "get_time_since_last_mix", 1740695150) + + internal val getOutputLatencyPtr: VoidPtr = + Internals.getMethodBindPtr("AudioServer", "get_output_latency", 1740695150) + + internal val getInputDeviceListPtr: VoidPtr = + Internals.getMethodBindPtr("AudioServer", "get_input_device_list", 2981934095) + + internal val getInputDevicePtr: VoidPtr = + Internals.getMethodBindPtr("AudioServer", "get_input_device", 2841200299) + + internal val setInputDevicePtr: VoidPtr = + Internals.getMethodBindPtr("AudioServer", "set_input_device", 83702148) + + internal val setBusLayoutPtr: VoidPtr = + Internals.getMethodBindPtr("AudioServer", "set_bus_layout", 3319058824) + + internal val generateBusLayoutPtr: VoidPtr = + Internals.getMethodBindPtr("AudioServer", "generate_bus_layout", 3769973890) + + internal val setEnableTaggingUsedAudioStreamsPtr: VoidPtr = + Internals.getMethodBindPtr("AudioServer", "set_enable_tagging_used_audio_streams", 2586408642) + + internal val isStreamRegisteredAsSamplePtr: VoidPtr = + Internals.getMethodBindPtr("AudioServer", "is_stream_registered_as_sample", 500225754) + + internal val registerStreamAsSamplePtr: VoidPtr = + Internals.getMethodBindPtr("AudioServer", "register_stream_as_sample", 2210767741) + } +} diff --git a/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioStream.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioStream.kt new file mode 100644 index 0000000000..c472bbfe3b --- /dev/null +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioStream.kt @@ -0,0 +1,185 @@ +// THIS FILE IS GENERATED! DO NOT EDIT IT MANUALLY! +@file:Suppress("PackageDirectoryMismatch", "unused", "FunctionName", "RedundantModalityModifier", + "UNCHECKED_CAST", "JoinDeclarationAndAssignment", "USELESS_CAST", + "RemoveRedundantQualifierName", "NOTHING_TO_INLINE", "NON_FINAL_MEMBER_IN_OBJECT", + "RedundantVisibilityModifier", "RedundantUnitReturnType", "MemberVisibilityCanBePrivate") + +package godot + +import godot.`annotation`.GodotBaseType +import godot.core.Dictionary +import godot.core.Signal0 +import godot.core.VariantArray +import godot.core.VariantParser.BOOL +import godot.core.VariantParser.DOUBLE +import godot.core.VariantParser.OBJECT +import godot.util.Internals +import godot.util.VoidPtr +import kotlin.Any +import kotlin.Boolean +import kotlin.Double +import kotlin.Int +import kotlin.NotImplementedError +import kotlin.String +import kotlin.Suppress +import kotlin.Unit + +private const val ENGINE_CLASS_AUDIOSTREAM_INDEX: Int = 114 + +/** + * Base class for audio streams. Audio streams are used for sound effects and music playback, and + * support WAV (via [AudioStreamWAV]) and Ogg (via [AudioStreamOggVorbis]) file formats. + */ +@GodotBaseType +public open class AudioStream : Resource() { + /** + * Signal to be emitted to notify when the parameter list changed. + */ + public val parameterListChanged: Signal0 by Signal0 + + public override fun new(scriptIndex: Int): Unit { + Internals.callConstructor(this, ENGINE_CLASS_AUDIOSTREAM_INDEX, scriptIndex) + } + + /** + * Override this method to customize the returned value of [instantiatePlayback]. Should returned + * a new [AudioStreamPlayback] created when the stream is played (such as by an + * [AudioStreamPlayer]).. + */ + public open fun _instantiatePlayback(): AudioStreamPlayback? { + throw NotImplementedError("_instantiate_playback is not implemented for AudioStream") + } + + /** + * Override this method to customize the name assigned to this audio stream. Unused by the engine. + */ + public open fun _getStreamName(): String { + throw NotImplementedError("_get_stream_name is not implemented for AudioStream") + } + + /** + * Override this method to customize the returned value of [getLength]. Should return the length + * of this audio stream, in seconds. + */ + public open fun _getLength(): Double { + throw NotImplementedError("_get_length is not implemented for AudioStream") + } + + /** + * Override this method to customize the returned value of [isMonophonic]. Should return `true` if + * this audio stream only supports one channel. + */ + public open fun _isMonophonic(): Boolean { + throw NotImplementedError("_is_monophonic is not implemented for AudioStream") + } + + /** + * Overridable method. Should return the tempo of this audio stream, in beats per minute (BPM). + * Used by the engine to determine the position of every beat. + * Ideally, the returned value should be based off the stream's sample rate + * ([AudioStreamWAV.mixRate], for example). + */ + public open fun _getBpm(): Double { + throw NotImplementedError("_get_bpm is not implemented for AudioStream") + } + + /** + * Overridable method. Should return the total number of beats of this audio stream. Used by the + * engine to determine the position of every beat. + * Ideally, the returned value should be based off the stream's sample rate + * ([AudioStreamWAV.mixRate], for example). + */ + public open fun _getBeatCount(): Int { + throw NotImplementedError("_get_beat_count is not implemented for AudioStream") + } + + /** + * Return the controllable parameters of this stream. This array contains dictionaries with a + * property info description format (see [Object.getPropertyList]). Additionally, the default value + * for this parameter must be added tho each dictionary in "default_value" field. + */ + public open fun _getParameterList(): VariantArray> { + throw NotImplementedError("_get_parameter_list is not implemented for AudioStream") + } + + /** + * Returns the length of the audio stream in seconds. + */ + public final fun getLength(): Double { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getLengthPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double) + } + + /** + * Returns `true` if this audio stream only supports one channel (*monophony*), or `false` if the + * audio stream supports two or more channels (*polyphony*). + */ + public final fun isMonophonic(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isMonophonicPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + /** + * Returns a newly created [AudioStreamPlayback] intended to play this audio stream. Useful for + * when you want to extend [_instantiatePlayback] but call [instantiatePlayback] from an internally + * held AudioStream subresource. An example of this can be found in the source code for + * `AudioStreamRandomPitch::instantiate_playback`. + */ + public final fun instantiatePlayback(): AudioStreamPlayback? { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.instantiatePlaybackPtr, OBJECT) + return (Internals.readReturnValue(OBJECT) as AudioStreamPlayback?) + } + + /** + * Returns if the current [AudioStream] can be used as a sample. Only static streams can be + * sampled. + */ + public final fun canBeSampled(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.canBeSampledPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + /** + * Generates an [AudioSample] based on the current stream. + */ + public final fun generateSample(): AudioSample? { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.generateSamplePtr, OBJECT) + return (Internals.readReturnValue(OBJECT) as AudioSample?) + } + + /** + * Returns `true` if the stream is a collection of other streams, `false` otherwise. + */ + public final fun isMetaStream(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isMetaStreamPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public companion object + + public object MethodBindings { + internal val getLengthPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStream", "get_length", 1740695150) + + internal val isMonophonicPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStream", "is_monophonic", 36873697) + + internal val instantiatePlaybackPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStream", "instantiate_playback", 210135309) + + internal val canBeSampledPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStream", "can_be_sampled", 36873697) + + internal val generateSamplePtr: VoidPtr = + Internals.getMethodBindPtr("AudioStream", "generate_sample", 2646048999) + + internal val isMetaStreamPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStream", "is_meta_stream", 36873697) + } +} diff --git a/kt/godot-library/src/main/kotlin/godot/gen/godot/AudioStreamGenerator.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioStreamGenerator.kt similarity index 78% rename from kt/godot-library/src/main/kotlin/godot/gen/godot/AudioStreamGenerator.kt rename to kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioStreamGenerator.kt index 6e9c5bd997..e501c6423c 100644 --- a/kt/godot-library/src/main/kotlin/godot/gen/godot/AudioStreamGenerator.kt +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioStreamGenerator.kt @@ -7,10 +7,9 @@ package godot import godot.`annotation`.GodotBaseType -import godot.core.TypeManager import godot.core.VariantParser.DOUBLE import godot.core.VariantParser.NIL -import godot.core.memory.TransferContext +import godot.util.Internals import godot.util.VoidPtr import kotlin.Double import kotlin.Float @@ -19,6 +18,8 @@ import kotlin.Suppress import kotlin.Unit import kotlin.jvm.JvmName +private const val ENGINE_CLASS_AUDIOSTREAMGENERATOR_INDEX: Int = 115 + /** * [AudioStreamGenerator] is a type of audio stream that does not play back sounds on its own; * instead, it expects a script to generate audio data for it. See also [AudioStreamGeneratorPlayback]. @@ -121,44 +122,44 @@ public open class AudioStreamGenerator : AudioStream() { } public override fun new(scriptIndex: Int): Unit { - callConstructor(ENGINECLASS_AUDIOSTREAMGENERATOR, scriptIndex) + Internals.callConstructor(this, ENGINE_CLASS_AUDIOSTREAMGENERATOR_INDEX, scriptIndex) } public final fun setMixRate(hz: Float): Unit { - TransferContext.writeArguments(DOUBLE to hz.toDouble()) - TransferContext.callMethod(rawPtr, MethodBindings.setMixRatePtr, NIL) + Internals.writeArguments(DOUBLE to hz.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setMixRatePtr, NIL) } public final fun getMixRate(): Float { - TransferContext.writeArguments() - TransferContext.callMethod(rawPtr, MethodBindings.getMixRatePtr, DOUBLE) - return (TransferContext.readReturnValue(DOUBLE) as Double).toFloat() + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getMixRatePtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() } public final fun setBufferLength(seconds: Float): Unit { - TransferContext.writeArguments(DOUBLE to seconds.toDouble()) - TransferContext.callMethod(rawPtr, MethodBindings.setBufferLengthPtr, NIL) + Internals.writeArguments(DOUBLE to seconds.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setBufferLengthPtr, NIL) } public final fun getBufferLength(): Float { - TransferContext.writeArguments() - TransferContext.callMethod(rawPtr, MethodBindings.getBufferLengthPtr, DOUBLE) - return (TransferContext.readReturnValue(DOUBLE) as Double).toFloat() + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getBufferLengthPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() } public companion object - internal object MethodBindings { - public val setMixRatePtr: VoidPtr = - TypeManager.getMethodBindPtr("AudioStreamGenerator", "set_mix_rate", 373806689) + public object MethodBindings { + internal val setMixRatePtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamGenerator", "set_mix_rate", 373806689) - public val getMixRatePtr: VoidPtr = - TypeManager.getMethodBindPtr("AudioStreamGenerator", "get_mix_rate", 1740695150) + internal val getMixRatePtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamGenerator", "get_mix_rate", 1740695150) - public val setBufferLengthPtr: VoidPtr = - TypeManager.getMethodBindPtr("AudioStreamGenerator", "set_buffer_length", 373806689) + internal val setBufferLengthPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamGenerator", "set_buffer_length", 373806689) - public val getBufferLengthPtr: VoidPtr = - TypeManager.getMethodBindPtr("AudioStreamGenerator", "get_buffer_length", 1740695150) + internal val getBufferLengthPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamGenerator", "get_buffer_length", 1740695150) } } diff --git a/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioStreamGeneratorPlayback.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioStreamGeneratorPlayback.kt new file mode 100644 index 0000000000..4bd88a1e4a --- /dev/null +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioStreamGeneratorPlayback.kt @@ -0,0 +1,119 @@ +// THIS FILE IS GENERATED! DO NOT EDIT IT MANUALLY! +@file:Suppress("PackageDirectoryMismatch", "unused", "FunctionName", "RedundantModalityModifier", + "UNCHECKED_CAST", "JoinDeclarationAndAssignment", "USELESS_CAST", + "RemoveRedundantQualifierName", "NOTHING_TO_INLINE", "NON_FINAL_MEMBER_IN_OBJECT", + "RedundantVisibilityModifier", "RedundantUnitReturnType", "MemberVisibilityCanBePrivate") + +package godot + +import godot.`annotation`.GodotBaseType +import godot.core.PackedVector2Array +import godot.core.VariantParser.BOOL +import godot.core.VariantParser.LONG +import godot.core.VariantParser.NIL +import godot.core.VariantParser.PACKED_VECTOR2_ARRAY +import godot.core.VariantParser.VECTOR2 +import godot.core.Vector2 +import godot.util.Internals +import godot.util.VoidPtr +import kotlin.Boolean +import kotlin.Int +import kotlin.Long +import kotlin.Suppress +import kotlin.Unit + +private const val ENGINE_CLASS_AUDIOSTREAMGENERATORPLAYBACK_INDEX: Int = 116 + +/** + * This class is meant to be used with [AudioStreamGenerator] to play back the generated audio in + * real-time. + */ +@GodotBaseType +public open class AudioStreamGeneratorPlayback internal constructor() : + AudioStreamPlaybackResampled() { + public override fun new(scriptIndex: Int): Unit { + Internals.callConstructor(this, ENGINE_CLASS_AUDIOSTREAMGENERATORPLAYBACK_INDEX, scriptIndex) + } + + /** + * Pushes a single audio data frame to the buffer. This is usually less efficient than + * [pushBuffer] in C# and compiled languages via GDExtension, but [pushFrame] may be *more* efficient + * in GDScript. + */ + public final fun pushFrame(frame: Vector2): Boolean { + Internals.writeArguments(VECTOR2 to frame) + Internals.callMethod(rawPtr, MethodBindings.pushFramePtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + /** + * Returns `true` if a buffer of the size [amount] can be pushed to the audio sample data buffer + * without overflowing it, `false` otherwise. + */ + public final fun canPushBuffer(amount: Int): Boolean { + Internals.writeArguments(LONG to amount.toLong()) + Internals.callMethod(rawPtr, MethodBindings.canPushBufferPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + /** + * Pushes several audio data frames to the buffer. This is usually more efficient than [pushFrame] + * in C# and compiled languages via GDExtension, but [pushBuffer] may be *less* efficient in + * GDScript. + */ + public final fun pushBuffer(frames: PackedVector2Array): Boolean { + Internals.writeArguments(PACKED_VECTOR2_ARRAY to frames) + Internals.callMethod(rawPtr, MethodBindings.pushBufferPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + /** + * Returns the number of frames that can be pushed to the audio sample data buffer without + * overflowing it. If the result is `0`, the buffer is full. + */ + public final fun getFramesAvailable(): Int { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getFramesAvailablePtr, LONG) + return (Internals.readReturnValue(LONG) as Long).toInt() + } + + /** + * Returns the number of times the playback skipped due to a buffer underrun in the audio sample + * data. This value is reset at the start of the playback. + */ + public final fun getSkips(): Int { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getSkipsPtr, LONG) + return (Internals.readReturnValue(LONG) as Long).toInt() + } + + /** + * Clears the audio sample data buffer. + */ + public final fun clearBuffer(): Unit { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.clearBufferPtr, NIL) + } + + public companion object + + public object MethodBindings { + internal val pushFramePtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamGeneratorPlayback", "push_frame", 3975407249) + + internal val canPushBufferPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamGeneratorPlayback", "can_push_buffer", 1116898809) + + internal val pushBufferPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamGeneratorPlayback", "push_buffer", 1361156557) + + internal val getFramesAvailablePtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamGeneratorPlayback", "get_frames_available", 3905245786) + + internal val getSkipsPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamGeneratorPlayback", "get_skips", 3905245786) + + internal val clearBufferPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamGeneratorPlayback", "clear_buffer", 3218959716) + } +} diff --git a/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioStreamInteractive.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioStreamInteractive.kt new file mode 100644 index 0000000000..2e0b83b323 --- /dev/null +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioStreamInteractive.kt @@ -0,0 +1,480 @@ +// THIS FILE IS GENERATED! DO NOT EDIT IT MANUALLY! +@file:Suppress("PackageDirectoryMismatch", "unused", "FunctionName", "RedundantModalityModifier", + "UNCHECKED_CAST", "JoinDeclarationAndAssignment", "USELESS_CAST", + "RemoveRedundantQualifierName", "NOTHING_TO_INLINE", "NON_FINAL_MEMBER_IN_OBJECT", + "RedundantVisibilityModifier", "RedundantUnitReturnType", "MemberVisibilityCanBePrivate") + +package godot + +import godot.`annotation`.GodotBaseType +import godot.core.PackedInt32Array +import godot.core.StringName +import godot.core.VariantParser.BOOL +import godot.core.VariantParser.DOUBLE +import godot.core.VariantParser.LONG +import godot.core.VariantParser.NIL +import godot.core.VariantParser.OBJECT +import godot.core.VariantParser.PACKED_INT_32_ARRAY +import godot.core.VariantParser.STRING_NAME +import godot.util.Internals +import godot.util.VoidPtr +import kotlin.Boolean +import kotlin.Double +import kotlin.Float +import kotlin.Int +import kotlin.Long +import kotlin.Suppress +import kotlin.Unit +import kotlin.jvm.JvmName +import kotlin.jvm.JvmOverloads + +private const val ENGINE_CLASS_AUDIOSTREAMINTERACTIVE_INDEX: Int = 117 + +/** + * This is an audio stream that can playback music interactively, combining clips and a transition + * table. Clips must be added first, and the transition rules via the [addTransition]. Additionally, + * this stream export a property parameter to control the playback via [AudioStreamPlayer], + * [AudioStreamPlayer2D], or [AudioStreamPlayer3D]. + * The way this is used is by filling a number of clips, then configuring the transition table. From + * there, clips are selected for playback and the music will smoothly go from the current to the new + * one while using the corresponding transition rule defined in the transition table. + */ +@GodotBaseType +public open class AudioStreamInteractive : AudioStream() { + /** + * Index of the initial clip, which will be played first when this stream is played. + */ + public final inline var initialClip: Int + @JvmName("initialClipProperty") + get() = getInitialClip() + @JvmName("initialClipProperty") + set(`value`) { + setInitialClip(value) + } + + /** + * Amount of clips contained in this interactive player. + */ + public final inline var clipCount: Int + @JvmName("clipCountProperty") + get() = getClipCount() + @JvmName("clipCountProperty") + set(`value`) { + setClipCount(value) + } + + public override fun new(scriptIndex: Int): Unit { + Internals.callConstructor(this, ENGINE_CLASS_AUDIOSTREAMINTERACTIVE_INDEX, scriptIndex) + } + + public final fun setClipCount(clipCount: Int): Unit { + Internals.writeArguments(LONG to clipCount.toLong()) + Internals.callMethod(rawPtr, MethodBindings.setClipCountPtr, NIL) + } + + public final fun getClipCount(): Int { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getClipCountPtr, LONG) + return (Internals.readReturnValue(LONG) as Long).toInt() + } + + public final fun setInitialClip(clipIndex: Int): Unit { + Internals.writeArguments(LONG to clipIndex.toLong()) + Internals.callMethod(rawPtr, MethodBindings.setInitialClipPtr, NIL) + } + + public final fun getInitialClip(): Int { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getInitialClipPtr, LONG) + return (Internals.readReturnValue(LONG) as Long).toInt() + } + + /** + * Set the name of the current clip (for easier identification). + */ + public final fun setClipName(clipIndex: Int, name: StringName): Unit { + Internals.writeArguments(LONG to clipIndex.toLong(), STRING_NAME to name) + Internals.callMethod(rawPtr, MethodBindings.setClipNamePtr, NIL) + } + + /** + * Return the name of a clip. + */ + public final fun getClipName(clipIndex: Int): StringName { + Internals.writeArguments(LONG to clipIndex.toLong()) + Internals.callMethod(rawPtr, MethodBindings.getClipNamePtr, STRING_NAME) + return (Internals.readReturnValue(STRING_NAME) as StringName) + } + + /** + * Set the [AudioStream] associated with the current clip. + */ + public final fun setClipStream(clipIndex: Int, stream: AudioStream?): Unit { + Internals.writeArguments(LONG to clipIndex.toLong(), OBJECT to stream) + Internals.callMethod(rawPtr, MethodBindings.setClipStreamPtr, NIL) + } + + /** + * Return the [AudioStream] associated with a clip. + */ + public final fun getClipStream(clipIndex: Int): AudioStream? { + Internals.writeArguments(LONG to clipIndex.toLong()) + Internals.callMethod(rawPtr, MethodBindings.getClipStreamPtr, OBJECT) + return (Internals.readReturnValue(OBJECT) as AudioStream?) + } + + /** + * Set whether a clip will auto-advance by changing the auto-advance mode. + */ + public final fun setClipAutoAdvance(clipIndex: Int, mode: AutoAdvanceMode): Unit { + Internals.writeArguments(LONG to clipIndex.toLong(), LONG to mode.id) + Internals.callMethod(rawPtr, MethodBindings.setClipAutoAdvancePtr, NIL) + } + + /** + * Return whether a clip has auto-advance enabled. See [setClipAutoAdvance]. + */ + public final fun getClipAutoAdvance(clipIndex: Int): AutoAdvanceMode { + Internals.writeArguments(LONG to clipIndex.toLong()) + Internals.callMethod(rawPtr, MethodBindings.getClipAutoAdvancePtr, LONG) + return AudioStreamInteractive.AutoAdvanceMode.from(Internals.readReturnValue(LONG) as Long) + } + + /** + * Set the index of the next clip towards which this clip will auto advance to when finished. If + * the clip being played loops, then auto-advance will be ignored. + */ + public final fun setClipAutoAdvanceNextClip(clipIndex: Int, autoAdvanceNextClip: Int): Unit { + Internals.writeArguments(LONG to clipIndex.toLong(), LONG to autoAdvanceNextClip.toLong()) + Internals.callMethod(rawPtr, MethodBindings.setClipAutoAdvanceNextClipPtr, NIL) + } + + /** + * Return the clip towards which the clip referenced by [clipIndex] will auto-advance to. + */ + public final fun getClipAutoAdvanceNextClip(clipIndex: Int): Int { + Internals.writeArguments(LONG to clipIndex.toLong()) + Internals.callMethod(rawPtr, MethodBindings.getClipAutoAdvanceNextClipPtr, LONG) + return (Internals.readReturnValue(LONG) as Long).toInt() + } + + /** + * Add a transition between two clips. Provide the indices of the source and destination clips, or + * use the [CLIP_ANY] constant to indicate that transition happens to/from any clip to this one. + * * [fromTime] indicates the moment in the current clip the transition will begin after + * triggered. + * * [toTime] indicates the time in the next clip that the playback will start from. + * * [fadeMode] indicates how the fade will happen between clips. If unsure, just use + * [FADE_AUTOMATIC] which uses the most common type of fade for each situation. + * * [fadeBeats] indicates how many beats the fade will take. Using decimals is allowed. + * * [useFillerClip] indicates that there will be a filler clip used between the source and + * destination clips. + * * [fillerClip] the index of the filler clip. + * * If [holdPrevious] is used, then this clip will be remembered. This can be used together with + * [AUTO_ADVANCE_RETURN_TO_HOLD] to return to this clip after another is done playing. + */ + @JvmOverloads + public final fun addTransition( + fromClip: Int, + toClip: Int, + fromTime: TransitionFromTime, + toTime: TransitionToTime, + fadeMode: FadeMode, + fadeBeats: Float, + useFillerClip: Boolean = false, + fillerClip: Int = -1, + holdPrevious: Boolean = false, + ): Unit { + Internals.writeArguments(LONG to fromClip.toLong(), LONG to toClip.toLong(), LONG to fromTime.id, LONG to toTime.id, LONG to fadeMode.id, DOUBLE to fadeBeats.toDouble(), BOOL to useFillerClip, LONG to fillerClip.toLong(), BOOL to holdPrevious) + Internals.callMethod(rawPtr, MethodBindings.addTransitionPtr, NIL) + } + + /** + * Return true if a given transition exists (was added via [addTransition]). + */ + public final fun hasTransition(fromClip: Int, toClip: Int): Boolean { + Internals.writeArguments(LONG to fromClip.toLong(), LONG to toClip.toLong()) + Internals.callMethod(rawPtr, MethodBindings.hasTransitionPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + /** + * Erase a transition by providing [fromClip] and [toClip] clip indices. [CLIP_ANY] can be used + * for either argument or both. + */ + public final fun eraseTransition(fromClip: Int, toClip: Int): Unit { + Internals.writeArguments(LONG to fromClip.toLong(), LONG to toClip.toLong()) + Internals.callMethod(rawPtr, MethodBindings.eraseTransitionPtr, NIL) + } + + /** + * Return the list of transitions (from, to interleaved). + */ + public final fun getTransitionList(): PackedInt32Array { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getTransitionListPtr, PACKED_INT_32_ARRAY) + return (Internals.readReturnValue(PACKED_INT_32_ARRAY) as PackedInt32Array) + } + + /** + * Return the source time position for a transition (see [addTransition]). + */ + public final fun getTransitionFromTime(fromClip: Int, toClip: Int): TransitionFromTime { + Internals.writeArguments(LONG to fromClip.toLong(), LONG to toClip.toLong()) + Internals.callMethod(rawPtr, MethodBindings.getTransitionFromTimePtr, LONG) + return AudioStreamInteractive.TransitionFromTime.from(Internals.readReturnValue(LONG) as Long) + } + + /** + * Return the destination time position for a transition (see [addTransition]). + */ + public final fun getTransitionToTime(fromClip: Int, toClip: Int): TransitionToTime { + Internals.writeArguments(LONG to fromClip.toLong(), LONG to toClip.toLong()) + Internals.callMethod(rawPtr, MethodBindings.getTransitionToTimePtr, LONG) + return AudioStreamInteractive.TransitionToTime.from(Internals.readReturnValue(LONG) as Long) + } + + /** + * Return the mode for a transition (see [addTransition]). + */ + public final fun getTransitionFadeMode(fromClip: Int, toClip: Int): FadeMode { + Internals.writeArguments(LONG to fromClip.toLong(), LONG to toClip.toLong()) + Internals.callMethod(rawPtr, MethodBindings.getTransitionFadeModePtr, LONG) + return AudioStreamInteractive.FadeMode.from(Internals.readReturnValue(LONG) as Long) + } + + /** + * Return the time (in beats) for a transition (see [addTransition]). + */ + public final fun getTransitionFadeBeats(fromClip: Int, toClip: Int): Float { + Internals.writeArguments(LONG to fromClip.toLong(), LONG to toClip.toLong()) + Internals.callMethod(rawPtr, MethodBindings.getTransitionFadeBeatsPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + /** + * Return whether a transition uses the *filler clip* functionality (see [addTransition]). + */ + public final fun isTransitionUsingFillerClip(fromClip: Int, toClip: Int): Boolean { + Internals.writeArguments(LONG to fromClip.toLong(), LONG to toClip.toLong()) + Internals.callMethod(rawPtr, MethodBindings.isTransitionUsingFillerClipPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + /** + * Return the filler clip for a transition (see [addTransition]). + */ + public final fun getTransitionFillerClip(fromClip: Int, toClip: Int): Int { + Internals.writeArguments(LONG to fromClip.toLong(), LONG to toClip.toLong()) + Internals.callMethod(rawPtr, MethodBindings.getTransitionFillerClipPtr, LONG) + return (Internals.readReturnValue(LONG) as Long).toInt() + } + + /** + * Return whether a transition uses the *hold previous* functionality (see [addTransition]). + */ + public final fun isTransitionHoldingPrevious(fromClip: Int, toClip: Int): Boolean { + Internals.writeArguments(LONG to fromClip.toLong(), LONG to toClip.toLong()) + Internals.callMethod(rawPtr, MethodBindings.isTransitionHoldingPreviousPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public enum class TransitionFromTime( + id: Long, + ) { + /** + * Start transition as soon as possible, don't wait for any specific time position. + */ + TRANSITION_FROM_TIME_IMMEDIATE(0), + /** + * Transition when the clip playback position reaches the next beat. + */ + TRANSITION_FROM_TIME_NEXT_BEAT(1), + /** + * Transition when the clip playback position reaches the next bar. + */ + TRANSITION_FROM_TIME_NEXT_BAR(2), + /** + * Transition when the current clip finished playing. + */ + TRANSITION_FROM_TIME_END(3), + ; + + public val id: Long + init { + this.id = id + } + + public companion object { + public fun from(`value`: Long): TransitionFromTime = entries.single { it.id == `value` } + } + } + + public enum class TransitionToTime( + id: Long, + ) { + /** + * Transition to the same position in the destination clip. This is useful when both clips have + * exactly the same length and the music should fade between them. + */ + TRANSITION_TO_TIME_SAME_POSITION(0), + /** + * Transition to the start of the destination clip. + */ + TRANSITION_TO_TIME_START(1), + ; + + public val id: Long + init { + this.id = id + } + + public companion object { + public fun from(`value`: Long): TransitionToTime = entries.single { it.id == `value` } + } + } + + public enum class FadeMode( + id: Long, + ) { + /** + * Do not use fade for the transition. This is useful when transitioning from a clip-end to + * clip-beginning, and each clip has their begin/end. + */ + FADE_DISABLED(0), + /** + * Use a fade-in in the next clip, let the current clip finish. + */ + FADE_IN(1), + /** + * Use a fade-out in the current clip, the next clip will start by itself. + */ + FADE_OUT(2), + /** + * Use a cross-fade between clips. + */ + FADE_CROSS(3), + /** + * Use automatic fade logic depending on the transition from/to. It is recommended to use this + * by default. + */ + FADE_AUTOMATIC(4), + ; + + public val id: Long + init { + this.id = id + } + + public companion object { + public fun from(`value`: Long): FadeMode = entries.single { it.id == `value` } + } + } + + public enum class AutoAdvanceMode( + id: Long, + ) { + /** + * Disable auto-advance (default). + */ + AUTO_ADVANCE_DISABLED(0), + /** + * Enable auto-advance, a clip must be specified. + */ + AUTO_ADVANCE_ENABLED(1), + /** + * Enable auto-advance, but instead of specifying a clip, the playback will return to hold (see + * [addTransition]). + */ + AUTO_ADVANCE_RETURN_TO_HOLD(2), + ; + + public val id: Long + init { + this.id = id + } + + public companion object { + public fun from(`value`: Long): AutoAdvanceMode = entries.single { it.id == `value` } + } + } + + public companion object { + /** + * This constant describes that any clip is valid for a specific transition as either source or + * destination. + */ + public final const val CLIP_ANY: Long = -1 + } + + public object MethodBindings { + internal val setClipCountPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamInteractive", "set_clip_count", 1286410249) + + internal val getClipCountPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamInteractive", "get_clip_count", 3905245786) + + internal val setInitialClipPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamInteractive", "set_initial_clip", 1286410249) + + internal val getInitialClipPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamInteractive", "get_initial_clip", 3905245786) + + internal val setClipNamePtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamInteractive", "set_clip_name", 3780747571) + + internal val getClipNamePtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamInteractive", "get_clip_name", 659327637) + + internal val setClipStreamPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamInteractive", "set_clip_stream", 111075094) + + internal val getClipStreamPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamInteractive", "get_clip_stream", 2739380747) + + internal val setClipAutoAdvancePtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamInteractive", "set_clip_auto_advance", 57217598) + + internal val getClipAutoAdvancePtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamInteractive", "get_clip_auto_advance", 1778634807) + + internal val setClipAutoAdvanceNextClipPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamInteractive", "set_clip_auto_advance_next_clip", 3937882851) + + internal val getClipAutoAdvanceNextClipPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamInteractive", "get_clip_auto_advance_next_clip", 923996154) + + internal val addTransitionPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamInteractive", "add_transition", 1630280552) + + internal val hasTransitionPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamInteractive", "has_transition", 2522259332) + + internal val eraseTransitionPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamInteractive", "erase_transition", 3937882851) + + internal val getTransitionListPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamInteractive", "get_transition_list", 1930428628) + + internal val getTransitionFromTimePtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamInteractive", "get_transition_from_time", 3453338158) + + internal val getTransitionToTimePtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamInteractive", "get_transition_to_time", 1369651373) + + internal val getTransitionFadeModePtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamInteractive", "get_transition_fade_mode", 4065396087) + + internal val getTransitionFadeBeatsPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamInteractive", "get_transition_fade_beats", 3085491603) + + internal val isTransitionUsingFillerClipPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamInteractive", "is_transition_using_filler_clip", 2522259332) + + internal val getTransitionFillerClipPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamInteractive", "get_transition_filler_clip", 3175239445) + + internal val isTransitionHoldingPreviousPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamInteractive", "is_transition_holding_previous", 2522259332) + } +} diff --git a/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioStreamMP3.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioStreamMP3.kt new file mode 100644 index 0000000000..37df251a77 --- /dev/null +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioStreamMP3.kt @@ -0,0 +1,221 @@ +// THIS FILE IS GENERATED! DO NOT EDIT IT MANUALLY! +@file:Suppress("PackageDirectoryMismatch", "unused", "FunctionName", "RedundantModalityModifier", + "UNCHECKED_CAST", "JoinDeclarationAndAssignment", "USELESS_CAST", + "RemoveRedundantQualifierName", "NOTHING_TO_INLINE", "NON_FINAL_MEMBER_IN_OBJECT", + "RedundantVisibilityModifier", "RedundantUnitReturnType", "MemberVisibilityCanBePrivate") + +package godot + +import godot.`annotation`.GodotBaseType +import godot.core.PackedByteArray +import godot.core.VariantParser.BOOL +import godot.core.VariantParser.DOUBLE +import godot.core.VariantParser.LONG +import godot.core.VariantParser.NIL +import godot.core.VariantParser.PACKED_BYTE_ARRAY +import godot.util.Internals +import godot.util.VoidPtr +import kotlin.Boolean +import kotlin.Double +import kotlin.Int +import kotlin.Long +import kotlin.Suppress +import kotlin.Unit +import kotlin.jvm.JvmName + +private const val ENGINE_CLASS_AUDIOSTREAMMP3_INDEX: Int = 118 + +/** + * MP3 audio stream driver. See [data] if you want to load an MP3 file at run-time. + */ +@GodotBaseType +public open class AudioStreamMP3 : AudioStream() { + /** + * Contains the audio data in bytes. + * You can load a file without having to import it beforehand using the code snippet below. Keep + * in mind that this snippet loads the whole file into memory and may not be ideal for huge files + * (hundreds of megabytes or more). + * + * gdscript: + * ```gdscript + * func load_mp3(path): + * var file = FileAccess.open(path, FileAccess.READ) + * var sound = AudioStreamMP3.new() + * sound.data = file.get_buffer(file.get_length()) + * return sound + * ``` + * csharp: + * ```csharp + * public AudioStreamMP3 LoadMP3(string path) + * { + * using var file = FileAccess.Open(path, FileAccess.ModeFlags.Read); + * var sound = new AudioStreamMP3(); + * sound.Data = file.GetBuffer(file.GetLength()); + * return sound; + * } + * ``` + */ + public final inline var `data`: PackedByteArray + @JvmName("dataProperty") + get() = getData() + @JvmName("dataProperty") + set(`value`) { + setData(value) + } + + public final inline var bpm: Double + @JvmName("bpmProperty") + get() = getBpm() + @JvmName("bpmProperty") + set(`value`) { + setBpm(value) + } + + public final inline var beatCount: Int + @JvmName("beatCountProperty") + get() = getBeatCount() + @JvmName("beatCountProperty") + set(`value`) { + setBeatCount(value) + } + + public final inline var barBeats: Int + @JvmName("barBeatsProperty") + get() = getBarBeats() + @JvmName("barBeatsProperty") + set(`value`) { + setBarBeats(value) + } + + /** + * If `true`, the stream will automatically loop when it reaches the end. + */ + public final inline var loop: Boolean + @JvmName("loopProperty") + get() = hasLoop() + @JvmName("loopProperty") + set(`value`) { + setLoop(value) + } + + /** + * Time in seconds at which the stream starts after being looped. + */ + public final inline var loopOffset: Double + @JvmName("loopOffsetProperty") + get() = getLoopOffset() + @JvmName("loopOffsetProperty") + set(`value`) { + setLoopOffset(value) + } + + public override fun new(scriptIndex: Int): Unit { + Internals.callConstructor(this, ENGINE_CLASS_AUDIOSTREAMMP3_INDEX, scriptIndex) + } + + public final fun setData(`data`: PackedByteArray): Unit { + Internals.writeArguments(PACKED_BYTE_ARRAY to data) + Internals.callMethod(rawPtr, MethodBindings.setDataPtr, NIL) + } + + public final fun getData(): PackedByteArray { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getDataPtr, PACKED_BYTE_ARRAY) + return (Internals.readReturnValue(PACKED_BYTE_ARRAY) as PackedByteArray) + } + + public final fun setLoop(enable: Boolean): Unit { + Internals.writeArguments(BOOL to enable) + Internals.callMethod(rawPtr, MethodBindings.setLoopPtr, NIL) + } + + public final fun hasLoop(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.hasLoopPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public final fun setLoopOffset(seconds: Double): Unit { + Internals.writeArguments(DOUBLE to seconds) + Internals.callMethod(rawPtr, MethodBindings.setLoopOffsetPtr, NIL) + } + + public final fun getLoopOffset(): Double { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getLoopOffsetPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double) + } + + public final fun setBpm(bpm: Double): Unit { + Internals.writeArguments(DOUBLE to bpm) + Internals.callMethod(rawPtr, MethodBindings.setBpmPtr, NIL) + } + + public final fun getBpm(): Double { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getBpmPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double) + } + + public final fun setBeatCount(count: Int): Unit { + Internals.writeArguments(LONG to count.toLong()) + Internals.callMethod(rawPtr, MethodBindings.setBeatCountPtr, NIL) + } + + public final fun getBeatCount(): Int { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getBeatCountPtr, LONG) + return (Internals.readReturnValue(LONG) as Long).toInt() + } + + public final fun setBarBeats(count: Int): Unit { + Internals.writeArguments(LONG to count.toLong()) + Internals.callMethod(rawPtr, MethodBindings.setBarBeatsPtr, NIL) + } + + public final fun getBarBeats(): Int { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getBarBeatsPtr, LONG) + return (Internals.readReturnValue(LONG) as Long).toInt() + } + + public companion object + + public object MethodBindings { + internal val setDataPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamMP3", "set_data", 2971499966) + + internal val getDataPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamMP3", "get_data", 2362200018) + + internal val setLoopPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamMP3", "set_loop", 2586408642) + + internal val hasLoopPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamMP3", "has_loop", 36873697) + + internal val setLoopOffsetPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamMP3", "set_loop_offset", 373806689) + + internal val getLoopOffsetPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamMP3", "get_loop_offset", 1740695150) + + internal val setBpmPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamMP3", "set_bpm", 373806689) + + internal val getBpmPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamMP3", "get_bpm", 1740695150) + + internal val setBeatCountPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamMP3", "set_beat_count", 1286410249) + + internal val getBeatCountPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamMP3", "get_beat_count", 3905245786) + + internal val setBarBeatsPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamMP3", "set_bar_beats", 1286410249) + + internal val getBarBeatsPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamMP3", "get_bar_beats", 3905245786) + } +} diff --git a/kt/godot-library/src/main/kotlin/godot/gen/godot/AudioStreamMicrophone.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioStreamMicrophone.kt similarity index 83% rename from kt/godot-library/src/main/kotlin/godot/gen/godot/AudioStreamMicrophone.kt rename to kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioStreamMicrophone.kt index f81976242e..51d065cbbd 100644 --- a/kt/godot-library/src/main/kotlin/godot/gen/godot/AudioStreamMicrophone.kt +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioStreamMicrophone.kt @@ -7,10 +7,13 @@ package godot import godot.`annotation`.GodotBaseType +import godot.util.Internals import kotlin.Int import kotlin.Suppress import kotlin.Unit +private const val ENGINE_CLASS_AUDIOSTREAMMICROPHONE_INDEX: Int = 119 + /** * When used directly in an [AudioStreamPlayer] node, [AudioStreamMicrophone] plays back microphone * input in real-time. This can be used in conjunction with [AudioEffectCapture] to process the data or @@ -22,10 +25,10 @@ import kotlin.Unit @GodotBaseType public open class AudioStreamMicrophone : AudioStream() { public override fun new(scriptIndex: Int): Unit { - callConstructor(ENGINECLASS_AUDIOSTREAMMICROPHONE, scriptIndex) + Internals.callConstructor(this, ENGINE_CLASS_AUDIOSTREAMMICROPHONE_INDEX, scriptIndex) } public companion object - internal object MethodBindings + public object MethodBindings } diff --git a/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioStreamOggVorbis.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioStreamOggVorbis.kt new file mode 100644 index 0000000000..8f2d0792d6 --- /dev/null +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioStreamOggVorbis.kt @@ -0,0 +1,232 @@ +// THIS FILE IS GENERATED! DO NOT EDIT IT MANUALLY! +@file:Suppress("PackageDirectoryMismatch", "unused", "FunctionName", "RedundantModalityModifier", + "UNCHECKED_CAST", "JoinDeclarationAndAssignment", "USELESS_CAST", + "RemoveRedundantQualifierName", "NOTHING_TO_INLINE", "NON_FINAL_MEMBER_IN_OBJECT", + "RedundantVisibilityModifier", "RedundantUnitReturnType", "MemberVisibilityCanBePrivate") + +package godot + +import godot.`annotation`.GodotBaseType +import godot.core.PackedByteArray +import godot.core.VariantParser.BOOL +import godot.core.VariantParser.DOUBLE +import godot.core.VariantParser.LONG +import godot.core.VariantParser.NIL +import godot.core.VariantParser.OBJECT +import godot.core.VariantParser.PACKED_BYTE_ARRAY +import godot.core.VariantParser.STRING +import godot.util.Internals +import godot.util.VoidPtr +import kotlin.Boolean +import kotlin.Double +import kotlin.Int +import kotlin.Long +import kotlin.String +import kotlin.Suppress +import kotlin.Unit +import kotlin.jvm.JvmName + +private const val ENGINE_CLASS_AUDIOSTREAMOGGVORBIS_INDEX: Int = 120 + +/** + * The AudioStreamOggVorbis class is a specialized [AudioStream] for handling Ogg Vorbis file + * formats. It offers functionality for loading and playing back Ogg Vorbis files, as well as managing + * looping and other playback properties. This class is part of the audio stream system, which also + * supports WAV files through the [AudioStreamWAV] class. + */ +@GodotBaseType +public open class AudioStreamOggVorbis : AudioStream() { + /** + * Contains the raw Ogg data for this stream. + */ + public final inline var packetSequence: OggPacketSequence? + @JvmName("packetSequenceProperty") + get() = getPacketSequence() + @JvmName("packetSequenceProperty") + set(`value`) { + setPacketSequence(value) + } + + public final inline var bpm: Double + @JvmName("bpmProperty") + get() = getBpm() + @JvmName("bpmProperty") + set(`value`) { + setBpm(value) + } + + public final inline var beatCount: Int + @JvmName("beatCountProperty") + get() = getBeatCount() + @JvmName("beatCountProperty") + set(`value`) { + setBeatCount(value) + } + + public final inline var barBeats: Int + @JvmName("barBeatsProperty") + get() = getBarBeats() + @JvmName("barBeatsProperty") + set(`value`) { + setBarBeats(value) + } + + /** + * If `true`, the audio will play again from the specified [loopOffset] once it is done playing. + * Useful for ambient sounds and background music. + */ + public final inline var loop: Boolean + @JvmName("loopProperty") + get() = hasLoop() + @JvmName("loopProperty") + set(`value`) { + setLoop(value) + } + + /** + * Time in seconds at which the stream starts after being looped. + */ + public final inline var loopOffset: Double + @JvmName("loopOffsetProperty") + get() = getLoopOffset() + @JvmName("loopOffsetProperty") + set(`value`) { + setLoopOffset(value) + } + + public override fun new(scriptIndex: Int): Unit { + Internals.callConstructor(this, ENGINE_CLASS_AUDIOSTREAMOGGVORBIS_INDEX, scriptIndex) + } + + public final fun setPacketSequence(packetSequence: OggPacketSequence?): Unit { + Internals.writeArguments(OBJECT to packetSequence) + Internals.callMethod(rawPtr, MethodBindings.setPacketSequencePtr, NIL) + } + + public final fun getPacketSequence(): OggPacketSequence? { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getPacketSequencePtr, OBJECT) + return (Internals.readReturnValue(OBJECT) as OggPacketSequence?) + } + + public final fun setLoop(enable: Boolean): Unit { + Internals.writeArguments(BOOL to enable) + Internals.callMethod(rawPtr, MethodBindings.setLoopPtr, NIL) + } + + public final fun hasLoop(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.hasLoopPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public final fun setLoopOffset(seconds: Double): Unit { + Internals.writeArguments(DOUBLE to seconds) + Internals.callMethod(rawPtr, MethodBindings.setLoopOffsetPtr, NIL) + } + + public final fun getLoopOffset(): Double { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getLoopOffsetPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double) + } + + public final fun setBpm(bpm: Double): Unit { + Internals.writeArguments(DOUBLE to bpm) + Internals.callMethod(rawPtr, MethodBindings.setBpmPtr, NIL) + } + + public final fun getBpm(): Double { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getBpmPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double) + } + + public final fun setBeatCount(count: Int): Unit { + Internals.writeArguments(LONG to count.toLong()) + Internals.callMethod(rawPtr, MethodBindings.setBeatCountPtr, NIL) + } + + public final fun getBeatCount(): Int { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getBeatCountPtr, LONG) + return (Internals.readReturnValue(LONG) as Long).toInt() + } + + public final fun setBarBeats(count: Int): Unit { + Internals.writeArguments(LONG to count.toLong()) + Internals.callMethod(rawPtr, MethodBindings.setBarBeatsPtr, NIL) + } + + public final fun getBarBeats(): Int { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getBarBeatsPtr, LONG) + return (Internals.readReturnValue(LONG) as Long).toInt() + } + + public companion object { + /** + * Creates a new AudioStreamOggVorbis instance from the given buffer. The buffer must contain + * Ogg Vorbis data. + */ + public final fun loadFromBuffer(buffer: PackedByteArray): AudioStreamOggVorbis? { + Internals.writeArguments(PACKED_BYTE_ARRAY to buffer) + Internals.callMethod(0, MethodBindings.loadFromBufferPtr, OBJECT) + return (Internals.readReturnValue(OBJECT) as AudioStreamOggVorbis?) + } + + /** + * Creates a new AudioStreamOggVorbis instance from the given file path. The file must be in Ogg + * Vorbis format. + */ + public final fun loadFromFile(path: String): AudioStreamOggVorbis? { + Internals.writeArguments(STRING to path) + Internals.callMethod(0, MethodBindings.loadFromFilePtr, OBJECT) + return (Internals.readReturnValue(OBJECT) as AudioStreamOggVorbis?) + } + } + + public object MethodBindings { + internal val loadFromBufferPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamOggVorbis", "load_from_buffer", 354904730) + + internal val loadFromFilePtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamOggVorbis", "load_from_file", 797568536) + + internal val setPacketSequencePtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamOggVorbis", "set_packet_sequence", 438882457) + + internal val getPacketSequencePtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamOggVorbis", "get_packet_sequence", 2801636033) + + internal val setLoopPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamOggVorbis", "set_loop", 2586408642) + + internal val hasLoopPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamOggVorbis", "has_loop", 36873697) + + internal val setLoopOffsetPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamOggVorbis", "set_loop_offset", 373806689) + + internal val getLoopOffsetPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamOggVorbis", "get_loop_offset", 1740695150) + + internal val setBpmPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamOggVorbis", "set_bpm", 373806689) + + internal val getBpmPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamOggVorbis", "get_bpm", 1740695150) + + internal val setBeatCountPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamOggVorbis", "set_beat_count", 1286410249) + + internal val getBeatCountPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamOggVorbis", "get_beat_count", 3905245786) + + internal val setBarBeatsPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamOggVorbis", "set_bar_beats", 1286410249) + + internal val getBarBeatsPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamOggVorbis", "get_bar_beats", 3905245786) + } +} diff --git a/kt/godot-library/src/main/kotlin/godot/gen/godot/AudioStreamPlayback.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioStreamPlayback.kt similarity index 81% rename from kt/godot-library/src/main/kotlin/godot/gen/godot/AudioStreamPlayback.kt rename to kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioStreamPlayback.kt index 8753457f7b..d2de20941f 100644 --- a/kt/godot-library/src/main/kotlin/godot/gen/godot/AudioStreamPlayback.kt +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioStreamPlayback.kt @@ -8,10 +8,9 @@ package godot import godot.`annotation`.GodotBaseType import godot.core.StringName -import godot.core.TypeManager import godot.core.VariantParser.NIL import godot.core.VariantParser.OBJECT -import godot.core.memory.TransferContext +import godot.util.Internals import godot.util.VoidPtr import kotlin.Any import kotlin.Boolean @@ -21,6 +20,8 @@ import kotlin.NotImplementedError import kotlin.Suppress import kotlin.Unit +private const val ENGINE_CLASS_AUDIOSTREAMPLAYBACK_INDEX: Int = 121 + /** * Can play, loop, pause a scroll through audio. See [AudioStream] and [AudioStreamOggVorbis] for * usage. @@ -28,7 +29,7 @@ import kotlin.Unit @GodotBaseType public open class AudioStreamPlayback : RefCounted() { public override fun new(scriptIndex: Int): Unit { - callConstructor(ENGINECLASS_AUDIOSTREAMPLAYBACK, scriptIndex) + Internals.callConstructor(this, ENGINE_CLASS_AUDIOSTREAMPLAYBACK_INDEX, scriptIndex) } /** @@ -101,8 +102,8 @@ public open class AudioStreamPlayback : RefCounted() { * sample of this stream. */ public final fun setSamplePlayback(playbackSample: AudioSamplePlayback?): Unit { - TransferContext.writeArguments(OBJECT to playbackSample) - TransferContext.callMethod(rawPtr, MethodBindings.setSamplePlaybackPtr, NIL) + Internals.writeArguments(OBJECT to playbackSample) + Internals.callMethod(rawPtr, MethodBindings.setSamplePlaybackPtr, NIL) } /** @@ -110,18 +111,18 @@ public open class AudioStreamPlayback : RefCounted() { * the audio sample of this stream. */ public final fun getSamplePlayback(): AudioSamplePlayback? { - TransferContext.writeArguments() - TransferContext.callMethod(rawPtr, MethodBindings.getSamplePlaybackPtr, OBJECT) - return (TransferContext.readReturnValue(OBJECT) as AudioSamplePlayback?) + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getSamplePlaybackPtr, OBJECT) + return (Internals.readReturnValue(OBJECT) as AudioSamplePlayback?) } public companion object - internal object MethodBindings { - public val setSamplePlaybackPtr: VoidPtr = - TypeManager.getMethodBindPtr("AudioStreamPlayback", "set_sample_playback", 3195455091) + public object MethodBindings { + internal val setSamplePlaybackPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamPlayback", "set_sample_playback", 3195455091) - public val getSamplePlaybackPtr: VoidPtr = - TypeManager.getMethodBindPtr("AudioStreamPlayback", "get_sample_playback", 3482738536) + internal val getSamplePlaybackPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamPlayback", "get_sample_playback", 3482738536) } } diff --git a/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioStreamPlaybackInteractive.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioStreamPlaybackInteractive.kt new file mode 100644 index 0000000000..d2efdc0d92 --- /dev/null +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioStreamPlaybackInteractive.kt @@ -0,0 +1,57 @@ +// THIS FILE IS GENERATED! DO NOT EDIT IT MANUALLY! +@file:Suppress("PackageDirectoryMismatch", "unused", "FunctionName", "RedundantModalityModifier", + "UNCHECKED_CAST", "JoinDeclarationAndAssignment", "USELESS_CAST", + "RemoveRedundantQualifierName", "NOTHING_TO_INLINE", "NON_FINAL_MEMBER_IN_OBJECT", + "RedundantVisibilityModifier", "RedundantUnitReturnType", "MemberVisibilityCanBePrivate") + +package godot + +import godot.`annotation`.GodotBaseType +import godot.core.StringName +import godot.core.VariantParser.LONG +import godot.core.VariantParser.NIL +import godot.core.VariantParser.STRING_NAME +import godot.util.Internals +import godot.util.VoidPtr +import kotlin.Int +import kotlin.Suppress +import kotlin.Unit + +private const val ENGINE_CLASS_AUDIOSTREAMPLAYBACKINTERACTIVE_INDEX: Int = 122 + +/** + * Playback component of [AudioStreamInteractive]. Contains functions to change the currently played + * clip. + */ +@GodotBaseType +public open class AudioStreamPlaybackInteractive internal constructor() : AudioStreamPlayback() { + public override fun new(scriptIndex: Int): Unit { + Internals.callConstructor(this, ENGINE_CLASS_AUDIOSTREAMPLAYBACKINTERACTIVE_INDEX, scriptIndex) + } + + /** + * Switch to a clip (by name). + */ + public final fun switchToClipByName(clipName: StringName): Unit { + Internals.writeArguments(STRING_NAME to clipName) + Internals.callMethod(rawPtr, MethodBindings.switchToClipByNamePtr, NIL) + } + + /** + * Switch to a clip (by index). + */ + public final fun switchToClip(clipIndex: Int): Unit { + Internals.writeArguments(LONG to clipIndex.toLong()) + Internals.callMethod(rawPtr, MethodBindings.switchToClipPtr, NIL) + } + + public companion object + + public object MethodBindings { + internal val switchToClipByNamePtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamPlaybackInteractive", "switch_to_clip_by_name", 3304788590) + + internal val switchToClipPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamPlaybackInteractive", "switch_to_clip", 1286410249) + } +} diff --git a/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioStreamPlaybackOggVorbis.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioStreamPlaybackOggVorbis.kt new file mode 100644 index 0000000000..20f57b5c11 --- /dev/null +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioStreamPlaybackOggVorbis.kt @@ -0,0 +1,26 @@ +// THIS FILE IS GENERATED! DO NOT EDIT IT MANUALLY! +@file:Suppress("PackageDirectoryMismatch", "unused", "FunctionName", "RedundantModalityModifier", + "UNCHECKED_CAST", "JoinDeclarationAndAssignment", "USELESS_CAST", + "RemoveRedundantQualifierName", "NOTHING_TO_INLINE", "NON_FINAL_MEMBER_IN_OBJECT", + "RedundantVisibilityModifier", "RedundantUnitReturnType", "MemberVisibilityCanBePrivate") + +package godot + +import godot.`annotation`.GodotBaseType +import godot.util.Internals +import kotlin.Int +import kotlin.Suppress +import kotlin.Unit + +private const val ENGINE_CLASS_AUDIOSTREAMPLAYBACKOGGVORBIS_INDEX: Int = 123 + +@GodotBaseType +public open class AudioStreamPlaybackOggVorbis : AudioStreamPlaybackResampled() { + public override fun new(scriptIndex: Int): Unit { + Internals.callConstructor(this, ENGINE_CLASS_AUDIOSTREAMPLAYBACKOGGVORBIS_INDEX, scriptIndex) + } + + public companion object + + public object MethodBindings +} diff --git a/kt/godot-library/src/main/kotlin/godot/gen/godot/AudioStreamPlaybackPlaylist.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioStreamPlaybackPlaylist.kt similarity index 75% rename from kt/godot-library/src/main/kotlin/godot/gen/godot/AudioStreamPlaybackPlaylist.kt rename to kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioStreamPlaybackPlaylist.kt index 89a1c5c0cc..937addcab6 100644 --- a/kt/godot-library/src/main/kotlin/godot/gen/godot/AudioStreamPlaybackPlaylist.kt +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioStreamPlaybackPlaylist.kt @@ -7,17 +7,20 @@ package godot import godot.`annotation`.GodotBaseType +import godot.util.Internals import kotlin.Int import kotlin.Suppress import kotlin.Unit +private const val ENGINE_CLASS_AUDIOSTREAMPLAYBACKPLAYLIST_INDEX: Int = 124 + @GodotBaseType public open class AudioStreamPlaybackPlaylist internal constructor() : AudioStreamPlayback() { public override fun new(scriptIndex: Int): Unit { - callConstructor(ENGINECLASS_AUDIOSTREAMPLAYBACKPLAYLIST, scriptIndex) + Internals.callConstructor(this, ENGINE_CLASS_AUDIOSTREAMPLAYBACKPLAYLIST_INDEX, scriptIndex) } public companion object - internal object MethodBindings + public object MethodBindings } diff --git a/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioStreamPlaybackPolyphonic.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioStreamPlaybackPolyphonic.kt new file mode 100644 index 0000000000..3edd6d3adc --- /dev/null +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioStreamPlaybackPolyphonic.kt @@ -0,0 +1,125 @@ +// THIS FILE IS GENERATED! DO NOT EDIT IT MANUALLY! +@file:Suppress("PackageDirectoryMismatch", "unused", "FunctionName", "RedundantModalityModifier", + "UNCHECKED_CAST", "JoinDeclarationAndAssignment", "USELESS_CAST", + "RemoveRedundantQualifierName", "NOTHING_TO_INLINE", "NON_FINAL_MEMBER_IN_OBJECT", + "RedundantVisibilityModifier", "RedundantUnitReturnType", "MemberVisibilityCanBePrivate") + +package godot + +import godot.`annotation`.GodotBaseType +import godot.core.StringName +import godot.core.VariantParser.BOOL +import godot.core.VariantParser.DOUBLE +import godot.core.VariantParser.LONG +import godot.core.VariantParser.NIL +import godot.core.VariantParser.OBJECT +import godot.core.VariantParser.STRING_NAME +import godot.util.Internals +import godot.util.VoidPtr +import kotlin.Boolean +import kotlin.Float +import kotlin.Int +import kotlin.Long +import kotlin.Suppress +import kotlin.Unit +import kotlin.jvm.JvmOverloads + +private const val ENGINE_CLASS_AUDIOSTREAMPLAYBACKPOLYPHONIC_INDEX: Int = 125 + +/** + * Playback instance for [AudioStreamPolyphonic]. After setting the `stream` property of + * [AudioStreamPlayer], [AudioStreamPlayer2D], or [AudioStreamPlayer3D], the playback instance can be + * obtained by calling [AudioStreamPlayer.getStreamPlayback], [AudioStreamPlayer2D.getStreamPlayback] + * or [AudioStreamPlayer3D.getStreamPlayback] methods. + */ +@GodotBaseType +public open class AudioStreamPlaybackPolyphonic internal constructor() : AudioStreamPlayback() { + public override fun new(scriptIndex: Int): Unit { + Internals.callConstructor(this, ENGINE_CLASS_AUDIOSTREAMPLAYBACKPOLYPHONIC_INDEX, scriptIndex) + } + + /** + * Play an [AudioStream] at a given offset, volume, pitch scale, playback type, and bus. Playback + * starts immediately. + * The return value is a unique integer ID that is associated to this playback stream and which + * can be used to control it. + * This ID becomes invalid when the stream ends (if it does not loop), when the + * [AudioStreamPlaybackPolyphonic] is stopped, or when [stopStream] is called. + * This function returns [INVALID_ID] if the amount of streams currently playing equals + * [AudioStreamPolyphonic.polyphony]. If you need a higher amount of maximum polyphony, raise this + * value. + */ + @JvmOverloads + public final fun playStream( + stream: AudioStream?, + fromOffset: Float = 0.0f, + volumeDb: Float = 0.0f, + pitchScale: Float = 1.0f, + playbackType: AudioServer.PlaybackType = AudioServer.PlaybackType.PLAYBACK_TYPE_DEFAULT, + bus: StringName = StringName("Master"), + ): Long { + Internals.writeArguments(OBJECT to stream, DOUBLE to fromOffset.toDouble(), DOUBLE to volumeDb.toDouble(), DOUBLE to pitchScale.toDouble(), LONG to playbackType.id, STRING_NAME to bus) + Internals.callMethod(rawPtr, MethodBindings.playStreamPtr, LONG) + return (Internals.readReturnValue(LONG) as Long) + } + + /** + * Change the stream volume (in db). The [stream] argument is an integer ID returned by + * [playStream]. + */ + public final fun setStreamVolume(stream: Long, volumeDb: Float): Unit { + Internals.writeArguments(LONG to stream, DOUBLE to volumeDb.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setStreamVolumePtr, NIL) + } + + /** + * Change the stream pitch scale. The [stream] argument is an integer ID returned by [playStream]. + */ + public final fun setStreamPitchScale(stream: Long, pitchScale: Float): Unit { + Internals.writeArguments(LONG to stream, DOUBLE to pitchScale.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setStreamPitchScalePtr, NIL) + } + + /** + * Return true whether the stream associated with an integer ID is still playing. Check + * [playStream] for information on when this ID becomes invalid. + */ + public final fun isStreamPlaying(stream: Long): Boolean { + Internals.writeArguments(LONG to stream) + Internals.callMethod(rawPtr, MethodBindings.isStreamPlayingPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + /** + * Stop a stream. The [stream] argument is an integer ID returned by [playStream], which becomes + * invalid after calling this function. + */ + public final fun stopStream(stream: Long): Unit { + Internals.writeArguments(LONG to stream) + Internals.callMethod(rawPtr, MethodBindings.stopStreamPtr, NIL) + } + + public companion object { + /** + * Returned by [playStream] in case it could not allocate a stream for playback. + */ + public final const val INVALID_ID: Long = -1 + } + + public object MethodBindings { + internal val playStreamPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamPlaybackPolyphonic", "play_stream", 1846744803) + + internal val setStreamVolumePtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamPlaybackPolyphonic", "set_stream_volume", 1602489585) + + internal val setStreamPitchScalePtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamPlaybackPolyphonic", "set_stream_pitch_scale", 1602489585) + + internal val isStreamPlayingPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamPlaybackPolyphonic", "is_stream_playing", 1116898809) + + internal val stopStreamPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamPlaybackPolyphonic", "stop_stream", 1286410249) + } +} diff --git a/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioStreamPlaybackResampled.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioStreamPlaybackResampled.kt new file mode 100644 index 0000000000..5d87593273 --- /dev/null +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioStreamPlaybackResampled.kt @@ -0,0 +1,42 @@ +// THIS FILE IS GENERATED! DO NOT EDIT IT MANUALLY! +@file:Suppress("PackageDirectoryMismatch", "unused", "FunctionName", "RedundantModalityModifier", + "UNCHECKED_CAST", "JoinDeclarationAndAssignment", "USELESS_CAST", + "RemoveRedundantQualifierName", "NOTHING_TO_INLINE", "NON_FINAL_MEMBER_IN_OBJECT", + "RedundantVisibilityModifier", "RedundantUnitReturnType", "MemberVisibilityCanBePrivate") + +package godot + +import godot.`annotation`.GodotBaseType +import godot.core.VariantParser.NIL +import godot.util.Internals +import godot.util.VoidPtr +import kotlin.Float +import kotlin.Int +import kotlin.NotImplementedError +import kotlin.Suppress +import kotlin.Unit + +private const val ENGINE_CLASS_AUDIOSTREAMPLAYBACKRESAMPLED_INDEX: Int = 126 + +@GodotBaseType +public open class AudioStreamPlaybackResampled : AudioStreamPlayback() { + public override fun new(scriptIndex: Int): Unit { + Internals.callConstructor(this, ENGINE_CLASS_AUDIOSTREAMPLAYBACKRESAMPLED_INDEX, scriptIndex) + } + + public open fun _getStreamSamplingRate(): Float { + throw NotImplementedError("_get_stream_sampling_rate is not implemented for AudioStreamPlaybackResampled") + } + + public final fun beginResample(): Unit { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.beginResamplePtr, NIL) + } + + public companion object + + public object MethodBindings { + internal val beginResamplePtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamPlaybackResampled", "begin_resample", 3218959716) + } +} diff --git a/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioStreamPlaybackSynchronized.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioStreamPlaybackSynchronized.kt new file mode 100644 index 0000000000..718aa244c7 --- /dev/null +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioStreamPlaybackSynchronized.kt @@ -0,0 +1,26 @@ +// THIS FILE IS GENERATED! DO NOT EDIT IT MANUALLY! +@file:Suppress("PackageDirectoryMismatch", "unused", "FunctionName", "RedundantModalityModifier", + "UNCHECKED_CAST", "JoinDeclarationAndAssignment", "USELESS_CAST", + "RemoveRedundantQualifierName", "NOTHING_TO_INLINE", "NON_FINAL_MEMBER_IN_OBJECT", + "RedundantVisibilityModifier", "RedundantUnitReturnType", "MemberVisibilityCanBePrivate") + +package godot + +import godot.`annotation`.GodotBaseType +import godot.util.Internals +import kotlin.Int +import kotlin.Suppress +import kotlin.Unit + +private const val ENGINE_CLASS_AUDIOSTREAMPLAYBACKSYNCHRONIZED_INDEX: Int = 127 + +@GodotBaseType +public open class AudioStreamPlaybackSynchronized internal constructor() : AudioStreamPlayback() { + public override fun new(scriptIndex: Int): Unit { + Internals.callConstructor(this, ENGINE_CLASS_AUDIOSTREAMPLAYBACKSYNCHRONIZED_INDEX, scriptIndex) + } + + public companion object + + public object MethodBindings +} diff --git a/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioStreamPlayer.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioStreamPlayer.kt new file mode 100644 index 0000000000..35f308b16d --- /dev/null +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioStreamPlayer.kt @@ -0,0 +1,439 @@ +// THIS FILE IS GENERATED! DO NOT EDIT IT MANUALLY! +@file:Suppress("PackageDirectoryMismatch", "unused", "FunctionName", "RedundantModalityModifier", + "UNCHECKED_CAST", "JoinDeclarationAndAssignment", "USELESS_CAST", + "RemoveRedundantQualifierName", "NOTHING_TO_INLINE", "NON_FINAL_MEMBER_IN_OBJECT", + "RedundantVisibilityModifier", "RedundantUnitReturnType", "MemberVisibilityCanBePrivate") + +package godot + +import godot.`annotation`.GodotBaseType +import godot.core.Signal0 +import godot.core.StringName +import godot.core.VariantParser.BOOL +import godot.core.VariantParser.DOUBLE +import godot.core.VariantParser.LONG +import godot.core.VariantParser.NIL +import godot.core.VariantParser.OBJECT +import godot.core.VariantParser.STRING_NAME +import godot.util.Internals +import godot.util.VoidPtr +import kotlin.Boolean +import kotlin.Double +import kotlin.Float +import kotlin.Int +import kotlin.Long +import kotlin.Suppress +import kotlin.Unit +import kotlin.jvm.JvmName +import kotlin.jvm.JvmOverloads + +private const val ENGINE_CLASS_AUDIOSTREAMPLAYER_INDEX: Int = 128 + +/** + * The [AudioStreamPlayer] node plays an audio stream non-positionally. It is ideal for user + * interfaces, menus, or background music. + * To use this node, [stream] needs to be set to a valid [AudioStream] resource. Playing more than + * one sound at the same time is also supported, see [maxPolyphony]. + * If you need to play audio at a specific position, use [AudioStreamPlayer2D] or + * [AudioStreamPlayer3D] instead. + */ +@GodotBaseType +public open class AudioStreamPlayer : Node() { + /** + * Emitted when a sound finishes playing without interruptions. This signal is *not* emitted when + * calling [stop], or when exiting the tree while sounds are playing. + */ + public val finished: Signal0 by Signal0 + + /** + * The [AudioStream] resource to be played. Setting this property stops all currently playing + * sounds. If left empty, the [AudioStreamPlayer] does not work. + */ + public final inline var stream: AudioStream? + @JvmName("streamProperty") + get() = getStream() + @JvmName("streamProperty") + set(`value`) { + setStream(value) + } + + /** + * Volume of sound, in decibel. This is an offset of the [stream]'s volume. + * **Note:** To convert between decibel and linear energy (like most volume sliders do), use + * [@GlobalScope.dbToLinear] and [@GlobalScope.linearToDb]. + */ + public final inline var volumeDb: Float + @JvmName("volumeDbProperty") + get() = getVolumeDb() + @JvmName("volumeDbProperty") + set(`value`) { + setVolumeDb(value) + } + + /** + * The audio's pitch and tempo, as a multiplier of the [stream]'s sample rate. A value of `2.0` + * doubles the audio's pitch, while a value of `0.5` halves the pitch. + */ + public final inline var pitchScale: Float + @JvmName("pitchScaleProperty") + get() = getPitchScale() + @JvmName("pitchScaleProperty") + set(`value`) { + setPitchScale(value) + } + + /** + * If `true`, this node is playing sounds. Setting this property has the same effect as [play] and + * [stop]. + */ + public final inline val playing: Boolean + @JvmName("playingProperty") + get() = isPlaying() + + /** + * If `true`, this node calls [play] when entering the tree. + */ + public final inline var autoplay: Boolean + @JvmName("autoplayProperty") + get() = isAutoplayEnabled() + @JvmName("autoplayProperty") + set(`value`) { + setAutoplay(value) + } + + /** + * If `true`, the sounds are paused. Setting [streamPaused] to `false` resumes all sounds. + * **Note:** This property is automatically changed when exiting or entering the tree, or this + * node is paused (see [Node.processMode]). + */ + public final inline var streamPaused: Boolean + @JvmName("streamPausedProperty") + get() = getStreamPaused() + @JvmName("streamPausedProperty") + set(`value`) { + setStreamPaused(value) + } + + /** + * The mix target channels, as one of the [MixTarget] constants. Has no effect when two speakers + * or less are detected (see [AudioServer.SpeakerMode]). + */ + public final inline var mixTarget: MixTarget + @JvmName("mixTargetProperty") + get() = getMixTarget() + @JvmName("mixTargetProperty") + set(`value`) { + setMixTarget(value) + } + + /** + * The maximum number of sounds this node can play at the same time. Calling [play] after this + * value is reached will cut off the oldest sounds. + */ + public final inline var maxPolyphony: Int + @JvmName("maxPolyphonyProperty") + get() = getMaxPolyphony() + @JvmName("maxPolyphonyProperty") + set(`value`) { + setMaxPolyphony(value) + } + + /** + * The target bus name. All sounds from this node will be playing on this bus. + * **Note:** At runtime, if no bus with the given name exists, all sounds will fall back on + * `"Master"`. See also [AudioServer.getBusName]. + */ + public final inline var bus: StringName + @JvmName("busProperty") + get() = getBus() + @JvmName("busProperty") + set(`value`) { + setBus(value) + } + + /** + * The playback type of the stream player. If set other than to the default value, it will force + * that playback type. + */ + public final inline var playbackType: AudioServer.PlaybackType + @JvmName("playbackTypeProperty") + get() = getPlaybackType() + @JvmName("playbackTypeProperty") + set(`value`) { + setPlaybackType(value) + } + + public override fun new(scriptIndex: Int): Unit { + Internals.callConstructor(this, ENGINE_CLASS_AUDIOSTREAMPLAYER_INDEX, scriptIndex) + } + + public final fun setStream(stream: AudioStream?): Unit { + Internals.writeArguments(OBJECT to stream) + Internals.callMethod(rawPtr, MethodBindings.setStreamPtr, NIL) + } + + public final fun getStream(): AudioStream? { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getStreamPtr, OBJECT) + return (Internals.readReturnValue(OBJECT) as AudioStream?) + } + + public final fun setVolumeDb(volumeDb: Float): Unit { + Internals.writeArguments(DOUBLE to volumeDb.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setVolumeDbPtr, NIL) + } + + public final fun getVolumeDb(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getVolumeDbPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setPitchScale(pitchScale: Float): Unit { + Internals.writeArguments(DOUBLE to pitchScale.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setPitchScalePtr, NIL) + } + + public final fun getPitchScale(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getPitchScalePtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + /** + * Plays a sound from the beginning, or the given [fromPosition] in seconds. + */ + @JvmOverloads + public final fun play(fromPosition: Float = 0.0f): Unit { + Internals.writeArguments(DOUBLE to fromPosition.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.playPtr, NIL) + } + + /** + * Restarts all sounds to be played from the given [toPosition], in seconds. Does nothing if no + * sounds are playing. + */ + public final fun seek(toPosition: Float): Unit { + Internals.writeArguments(DOUBLE to toPosition.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.seekPtr, NIL) + } + + /** + * Stops all sounds from this node. + */ + public final fun stop(): Unit { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.stopPtr, NIL) + } + + public final fun isPlaying(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isPlayingPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + /** + * Returns the position in the [AudioStream] of the latest sound, in seconds. Returns `0.0` if no + * sounds are playing. + * **Note:** The position is not always accurate, as the [AudioServer] does not mix audio every + * processed frame. To get more accurate results, add [AudioServer.getTimeSinceLastMix] to the + * returned position. + */ + public final fun getPlaybackPosition(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getPlaybackPositionPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setBus(bus: StringName): Unit { + Internals.writeArguments(STRING_NAME to bus) + Internals.callMethod(rawPtr, MethodBindings.setBusPtr, NIL) + } + + public final fun getBus(): StringName { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getBusPtr, STRING_NAME) + return (Internals.readReturnValue(STRING_NAME) as StringName) + } + + public final fun setAutoplay(enable: Boolean): Unit { + Internals.writeArguments(BOOL to enable) + Internals.callMethod(rawPtr, MethodBindings.setAutoplayPtr, NIL) + } + + public final fun isAutoplayEnabled(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isAutoplayEnabledPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public final fun setMixTarget(mixTarget: MixTarget): Unit { + Internals.writeArguments(LONG to mixTarget.id) + Internals.callMethod(rawPtr, MethodBindings.setMixTargetPtr, NIL) + } + + public final fun getMixTarget(): MixTarget { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getMixTargetPtr, LONG) + return AudioStreamPlayer.MixTarget.from(Internals.readReturnValue(LONG) as Long) + } + + public final fun setStreamPaused(pause: Boolean): Unit { + Internals.writeArguments(BOOL to pause) + Internals.callMethod(rawPtr, MethodBindings.setStreamPausedPtr, NIL) + } + + public final fun getStreamPaused(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getStreamPausedPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public final fun setMaxPolyphony(maxPolyphony: Int): Unit { + Internals.writeArguments(LONG to maxPolyphony.toLong()) + Internals.callMethod(rawPtr, MethodBindings.setMaxPolyphonyPtr, NIL) + } + + public final fun getMaxPolyphony(): Int { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getMaxPolyphonyPtr, LONG) + return (Internals.readReturnValue(LONG) as Long).toInt() + } + + /** + * Returns `true` if any sound is active, even if [streamPaused] is set to `true`. See also + * [playing] and [getStreamPlayback]. + */ + public final fun hasStreamPlayback(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.hasStreamPlaybackPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + /** + * Returns the latest [AudioStreamPlayback] of this node, usually the most recently created by + * [play]. If no sounds are playing, this method fails and returns an empty playback. + */ + public final fun getStreamPlayback(): AudioStreamPlayback? { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getStreamPlaybackPtr, OBJECT) + return (Internals.readReturnValue(OBJECT) as AudioStreamPlayback?) + } + + public final fun setPlaybackType(playbackType: AudioServer.PlaybackType): Unit { + Internals.writeArguments(LONG to playbackType.id) + Internals.callMethod(rawPtr, MethodBindings.setPlaybackTypePtr, NIL) + } + + public final fun getPlaybackType(): AudioServer.PlaybackType { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getPlaybackTypePtr, LONG) + return AudioServer.PlaybackType.from(Internals.readReturnValue(LONG) as Long) + } + + public enum class MixTarget( + id: Long, + ) { + /** + * The audio will be played only on the first channel. This is the default. + */ + MIX_TARGET_STEREO(0), + /** + * The audio will be played on all surround channels. + */ + MIX_TARGET_SURROUND(1), + /** + * The audio will be played on the second channel, which is usually the center. + */ + MIX_TARGET_CENTER(2), + ; + + public val id: Long + init { + this.id = id + } + + public companion object { + public fun from(`value`: Long): MixTarget = entries.single { it.id == `value` } + } + } + + public companion object + + public object MethodBindings { + internal val setStreamPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamPlayer", "set_stream", 2210767741) + + internal val getStreamPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamPlayer", "get_stream", 160907539) + + internal val setVolumeDbPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamPlayer", "set_volume_db", 373806689) + + internal val getVolumeDbPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamPlayer", "get_volume_db", 1740695150) + + internal val setPitchScalePtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamPlayer", "set_pitch_scale", 373806689) + + internal val getPitchScalePtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamPlayer", "get_pitch_scale", 1740695150) + + internal val playPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamPlayer", "play", 1958160172) + + internal val seekPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamPlayer", "seek", 373806689) + + internal val stopPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamPlayer", "stop", 3218959716) + + internal val isPlayingPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamPlayer", "is_playing", 36873697) + + internal val getPlaybackPositionPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamPlayer", "get_playback_position", 191475506) + + internal val setBusPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamPlayer", "set_bus", 3304788590) + + internal val getBusPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamPlayer", "get_bus", 2002593661) + + internal val setAutoplayPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamPlayer", "set_autoplay", 2586408642) + + internal val isAutoplayEnabledPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamPlayer", "is_autoplay_enabled", 36873697) + + internal val setMixTargetPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamPlayer", "set_mix_target", 2300306138) + + internal val getMixTargetPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamPlayer", "get_mix_target", 172807476) + + internal val setStreamPausedPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamPlayer", "set_stream_paused", 2586408642) + + internal val getStreamPausedPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamPlayer", "get_stream_paused", 36873697) + + internal val setMaxPolyphonyPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamPlayer", "set_max_polyphony", 1286410249) + + internal val getMaxPolyphonyPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamPlayer", "get_max_polyphony", 3905245786) + + internal val hasStreamPlaybackPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamPlayer", "has_stream_playback", 2240911060) + + internal val getStreamPlaybackPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamPlayer", "get_stream_playback", 210135309) + + internal val setPlaybackTypePtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamPlayer", "set_playback_type", 725473817) + + internal val getPlaybackTypePtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamPlayer", "get_playback_type", 4011264623) + } +} diff --git a/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioStreamPlayer2D.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioStreamPlayer2D.kt new file mode 100644 index 0000000000..f7cbd6a930 --- /dev/null +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioStreamPlayer2D.kt @@ -0,0 +1,489 @@ +// THIS FILE IS GENERATED! DO NOT EDIT IT MANUALLY! +@file:Suppress("PackageDirectoryMismatch", "unused", "FunctionName", "RedundantModalityModifier", + "UNCHECKED_CAST", "JoinDeclarationAndAssignment", "USELESS_CAST", + "RemoveRedundantQualifierName", "NOTHING_TO_INLINE", "NON_FINAL_MEMBER_IN_OBJECT", + "RedundantVisibilityModifier", "RedundantUnitReturnType", "MemberVisibilityCanBePrivate") + +package godot + +import godot.`annotation`.GodotBaseType +import godot.core.Signal0 +import godot.core.StringName +import godot.core.VariantParser.BOOL +import godot.core.VariantParser.DOUBLE +import godot.core.VariantParser.LONG +import godot.core.VariantParser.NIL +import godot.core.VariantParser.OBJECT +import godot.core.VariantParser.STRING_NAME +import godot.util.Internals +import godot.util.VoidPtr +import kotlin.Boolean +import kotlin.Double +import kotlin.Float +import kotlin.Int +import kotlin.Long +import kotlin.Suppress +import kotlin.Unit +import kotlin.jvm.JvmName +import kotlin.jvm.JvmOverloads + +private const val ENGINE_CLASS_AUDIOSTREAMPLAYER2D_INDEX: Int = 129 + +/** + * Plays audio that is attenuated with distance to the listener. + * By default, audio is heard from the screen center. This can be changed by adding an + * [AudioListener2D] node to the scene and enabling it by calling [AudioListener2D.makeCurrent] on it. + * See also [AudioStreamPlayer] to play a sound non-positionally. + * **Note:** Hiding an [AudioStreamPlayer2D] node does not disable its audio output. To temporarily + * disable an [AudioStreamPlayer2D]'s audio output, set [volumeDb] to a very low value like `-100` + * (which isn't audible to human hearing). + */ +@GodotBaseType +public open class AudioStreamPlayer2D : Node2D() { + /** + * Emitted when the audio stops playing. + */ + public val finished: Signal0 by Signal0 + + /** + * The [AudioStream] object to be played. + */ + public final inline var stream: AudioStream? + @JvmName("streamProperty") + get() = getStream() + @JvmName("streamProperty") + set(`value`) { + setStream(value) + } + + /** + * Base volume before attenuation. + */ + public final inline var volumeDb: Float + @JvmName("volumeDbProperty") + get() = getVolumeDb() + @JvmName("volumeDbProperty") + set(`value`) { + setVolumeDb(value) + } + + /** + * The pitch and the tempo of the audio, as a multiplier of the audio sample's sample rate. + */ + public final inline var pitchScale: Float + @JvmName("pitchScaleProperty") + get() = getPitchScale() + @JvmName("pitchScaleProperty") + set(`value`) { + setPitchScale(value) + } + + /** + * If `true`, audio is playing or is queued to be played (see [play]). + */ + public final inline val playing: Boolean + @JvmName("playingProperty") + get() = isPlaying() + + /** + * If `true`, audio plays when added to scene tree. + */ + public final inline var autoplay: Boolean + @JvmName("autoplayProperty") + get() = isAutoplayEnabled() + @JvmName("autoplayProperty") + set(`value`) { + setAutoplay(value) + } + + /** + * If `true`, the playback is paused. You can resume it by setting [streamPaused] to `false`. + */ + public final inline var streamPaused: Boolean + @JvmName("streamPausedProperty") + get() = getStreamPaused() + @JvmName("streamPausedProperty") + set(`value`) { + setStreamPaused(value) + } + + /** + * Maximum distance from which audio is still hearable. + */ + public final inline var maxDistance: Float + @JvmName("maxDistanceProperty") + get() = getMaxDistance() + @JvmName("maxDistanceProperty") + set(`value`) { + setMaxDistance(value) + } + + /** + * The volume is attenuated over distance with this as an exponent. + */ + public final inline var attenuation: Float + @JvmName("attenuationProperty") + get() = getAttenuation() + @JvmName("attenuationProperty") + set(`value`) { + setAttenuation(value) + } + + /** + * The maximum number of sounds this node can play at the same time. Playing additional sounds + * after this value is reached will cut off the oldest sounds. + */ + public final inline var maxPolyphony: Int + @JvmName("maxPolyphonyProperty") + get() = getMaxPolyphony() + @JvmName("maxPolyphonyProperty") + set(`value`) { + setMaxPolyphony(value) + } + + /** + * Scales the panning strength for this node by multiplying the base + * [ProjectSettings.audio/general/2dPanningStrength] with this factor. Higher values will pan audio + * from left to right more dramatically than lower values. + */ + public final inline var panningStrength: Float + @JvmName("panningStrengthProperty") + get() = getPanningStrength() + @JvmName("panningStrengthProperty") + set(`value`) { + setPanningStrength(value) + } + + /** + * Bus on which this audio is playing. + * **Note:** When setting this property, keep in mind that no validation is performed to see if + * the given name matches an existing bus. This is because audio bus layouts might be loaded after + * this property is set. If this given name can't be resolved at runtime, it will fall back to + * `"Master"`. + */ + public final inline var bus: StringName + @JvmName("busProperty") + get() = getBus() + @JvmName("busProperty") + set(`value`) { + setBus(value) + } + + /** + * Determines which [Area2D] layers affect the sound for reverb and audio bus effects. Areas can + * be used to redirect [AudioStream]s so that they play in a certain audio bus. An example of how you + * might use this is making a "water" area so that sounds played in the water are redirected through + * an audio bus to make them sound like they are being played underwater. + */ + public final inline var areaMask: Long + @JvmName("areaMaskProperty") + get() = getAreaMask() + @JvmName("areaMaskProperty") + set(`value`) { + setAreaMask(value) + } + + /** + * The playback type of the stream player. If set other than to the default value, it will force + * that playback type. + */ + public final inline var playbackType: AudioServer.PlaybackType + @JvmName("playbackTypeProperty") + get() = getPlaybackType() + @JvmName("playbackTypeProperty") + set(`value`) { + setPlaybackType(value) + } + + public override fun new(scriptIndex: Int): Unit { + Internals.callConstructor(this, ENGINE_CLASS_AUDIOSTREAMPLAYER2D_INDEX, scriptIndex) + } + + public final fun setStream(stream: AudioStream?): Unit { + Internals.writeArguments(OBJECT to stream) + Internals.callMethod(rawPtr, MethodBindings.setStreamPtr, NIL) + } + + public final fun getStream(): AudioStream? { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getStreamPtr, OBJECT) + return (Internals.readReturnValue(OBJECT) as AudioStream?) + } + + public final fun setVolumeDb(volumeDb: Float): Unit { + Internals.writeArguments(DOUBLE to volumeDb.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setVolumeDbPtr, NIL) + } + + public final fun getVolumeDb(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getVolumeDbPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setPitchScale(pitchScale: Float): Unit { + Internals.writeArguments(DOUBLE to pitchScale.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setPitchScalePtr, NIL) + } + + public final fun getPitchScale(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getPitchScalePtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + /** + * Queues the audio to play on the next physics frame, from the given position [fromPosition], in + * seconds. + */ + @JvmOverloads + public final fun play(fromPosition: Float = 0.0f): Unit { + Internals.writeArguments(DOUBLE to fromPosition.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.playPtr, NIL) + } + + /** + * Sets the position from which audio will be played, in seconds. + */ + public final fun seek(toPosition: Float): Unit { + Internals.writeArguments(DOUBLE to toPosition.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.seekPtr, NIL) + } + + /** + * Stops the audio. + */ + public final fun stop(): Unit { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.stopPtr, NIL) + } + + public final fun isPlaying(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isPlayingPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + /** + * Returns the position in the [AudioStream]. + */ + public final fun getPlaybackPosition(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getPlaybackPositionPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setBus(bus: StringName): Unit { + Internals.writeArguments(STRING_NAME to bus) + Internals.callMethod(rawPtr, MethodBindings.setBusPtr, NIL) + } + + public final fun getBus(): StringName { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getBusPtr, STRING_NAME) + return (Internals.readReturnValue(STRING_NAME) as StringName) + } + + public final fun setAutoplay(enable: Boolean): Unit { + Internals.writeArguments(BOOL to enable) + Internals.callMethod(rawPtr, MethodBindings.setAutoplayPtr, NIL) + } + + public final fun isAutoplayEnabled(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isAutoplayEnabledPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public final fun setMaxDistance(pixels: Float): Unit { + Internals.writeArguments(DOUBLE to pixels.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setMaxDistancePtr, NIL) + } + + public final fun getMaxDistance(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getMaxDistancePtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setAttenuation(curve: Float): Unit { + Internals.writeArguments(DOUBLE to curve.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setAttenuationPtr, NIL) + } + + public final fun getAttenuation(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getAttenuationPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setAreaMask(mask: Long): Unit { + Internals.writeArguments(LONG to mask) + Internals.callMethod(rawPtr, MethodBindings.setAreaMaskPtr, NIL) + } + + public final fun getAreaMask(): Long { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getAreaMaskPtr, LONG) + return (Internals.readReturnValue(LONG) as Long) + } + + public final fun setStreamPaused(pause: Boolean): Unit { + Internals.writeArguments(BOOL to pause) + Internals.callMethod(rawPtr, MethodBindings.setStreamPausedPtr, NIL) + } + + public final fun getStreamPaused(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getStreamPausedPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public final fun setMaxPolyphony(maxPolyphony: Int): Unit { + Internals.writeArguments(LONG to maxPolyphony.toLong()) + Internals.callMethod(rawPtr, MethodBindings.setMaxPolyphonyPtr, NIL) + } + + public final fun getMaxPolyphony(): Int { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getMaxPolyphonyPtr, LONG) + return (Internals.readReturnValue(LONG) as Long).toInt() + } + + public final fun setPanningStrength(panningStrength: Float): Unit { + Internals.writeArguments(DOUBLE to panningStrength.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setPanningStrengthPtr, NIL) + } + + public final fun getPanningStrength(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getPanningStrengthPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + /** + * Returns whether the [AudioStreamPlayer] can return the [AudioStreamPlayback] object or not. + */ + public final fun hasStreamPlayback(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.hasStreamPlaybackPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + /** + * Returns the [AudioStreamPlayback] object associated with this [AudioStreamPlayer2D]. + */ + public final fun getStreamPlayback(): AudioStreamPlayback? { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getStreamPlaybackPtr, OBJECT) + return (Internals.readReturnValue(OBJECT) as AudioStreamPlayback?) + } + + public final fun setPlaybackType(playbackType: AudioServer.PlaybackType): Unit { + Internals.writeArguments(LONG to playbackType.id) + Internals.callMethod(rawPtr, MethodBindings.setPlaybackTypePtr, NIL) + } + + public final fun getPlaybackType(): AudioServer.PlaybackType { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getPlaybackTypePtr, LONG) + return AudioServer.PlaybackType.from(Internals.readReturnValue(LONG) as Long) + } + + public companion object + + public object MethodBindings { + internal val setStreamPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamPlayer2D", "set_stream", 2210767741) + + internal val getStreamPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamPlayer2D", "get_stream", 160907539) + + internal val setVolumeDbPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamPlayer2D", "set_volume_db", 373806689) + + internal val getVolumeDbPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamPlayer2D", "get_volume_db", 1740695150) + + internal val setPitchScalePtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamPlayer2D", "set_pitch_scale", 373806689) + + internal val getPitchScalePtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamPlayer2D", "get_pitch_scale", 1740695150) + + internal val playPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamPlayer2D", "play", 1958160172) + + internal val seekPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamPlayer2D", "seek", 373806689) + + internal val stopPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamPlayer2D", "stop", 3218959716) + + internal val isPlayingPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamPlayer2D", "is_playing", 36873697) + + internal val getPlaybackPositionPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamPlayer2D", "get_playback_position", 191475506) + + internal val setBusPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamPlayer2D", "set_bus", 3304788590) + + internal val getBusPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamPlayer2D", "get_bus", 2002593661) + + internal val setAutoplayPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamPlayer2D", "set_autoplay", 2586408642) + + internal val isAutoplayEnabledPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamPlayer2D", "is_autoplay_enabled", 36873697) + + internal val setMaxDistancePtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamPlayer2D", "set_max_distance", 373806689) + + internal val getMaxDistancePtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamPlayer2D", "get_max_distance", 1740695150) + + internal val setAttenuationPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamPlayer2D", "set_attenuation", 373806689) + + internal val getAttenuationPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamPlayer2D", "get_attenuation", 1740695150) + + internal val setAreaMaskPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamPlayer2D", "set_area_mask", 1286410249) + + internal val getAreaMaskPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamPlayer2D", "get_area_mask", 3905245786) + + internal val setStreamPausedPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamPlayer2D", "set_stream_paused", 2586408642) + + internal val getStreamPausedPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamPlayer2D", "get_stream_paused", 36873697) + + internal val setMaxPolyphonyPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamPlayer2D", "set_max_polyphony", 1286410249) + + internal val getMaxPolyphonyPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamPlayer2D", "get_max_polyphony", 3905245786) + + internal val setPanningStrengthPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamPlayer2D", "set_panning_strength", 373806689) + + internal val getPanningStrengthPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamPlayer2D", "get_panning_strength", 1740695150) + + internal val hasStreamPlaybackPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamPlayer2D", "has_stream_playback", 2240911060) + + internal val getStreamPlaybackPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamPlayer2D", "get_stream_playback", 210135309) + + internal val setPlaybackTypePtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamPlayer2D", "set_playback_type", 725473817) + + internal val getPlaybackTypePtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamPlayer2D", "get_playback_type", 4011264623) + } +} diff --git a/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioStreamPlayer3D.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioStreamPlayer3D.kt new file mode 100644 index 0000000000..bd7f555a0d --- /dev/null +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioStreamPlayer3D.kt @@ -0,0 +1,786 @@ +// THIS FILE IS GENERATED! DO NOT EDIT IT MANUALLY! +@file:Suppress("PackageDirectoryMismatch", "unused", "FunctionName", "RedundantModalityModifier", + "UNCHECKED_CAST", "JoinDeclarationAndAssignment", "USELESS_CAST", + "RemoveRedundantQualifierName", "NOTHING_TO_INLINE", "NON_FINAL_MEMBER_IN_OBJECT", + "RedundantVisibilityModifier", "RedundantUnitReturnType", "MemberVisibilityCanBePrivate") + +package godot + +import godot.`annotation`.GodotBaseType +import godot.core.Signal0 +import godot.core.StringName +import godot.core.VariantParser.BOOL +import godot.core.VariantParser.DOUBLE +import godot.core.VariantParser.LONG +import godot.core.VariantParser.NIL +import godot.core.VariantParser.OBJECT +import godot.core.VariantParser.STRING_NAME +import godot.util.Internals +import godot.util.VoidPtr +import kotlin.Boolean +import kotlin.Double +import kotlin.Float +import kotlin.Int +import kotlin.Long +import kotlin.Suppress +import kotlin.Unit +import kotlin.jvm.JvmName +import kotlin.jvm.JvmOverloads + +private const val ENGINE_CLASS_AUDIOSTREAMPLAYER3D_INDEX: Int = 130 + +/** + * Plays audio with positional sound effects, based on the relative position of the audio listener. + * Positional effects include distance attenuation, directionality, and the Doppler effect. For greater + * realism, a low-pass filter is applied to distant sounds. This can be disabled by setting + * [attenuationFilterCutoffHz] to `20500`. + * By default, audio is heard from the camera position. This can be changed by adding an + * [AudioListener3D] node to the scene and enabling it by calling [AudioListener3D.makeCurrent] on it. + * See also [AudioStreamPlayer] to play a sound non-positionally. + * **Note:** Hiding an [AudioStreamPlayer3D] node does not disable its audio output. To temporarily + * disable an [AudioStreamPlayer3D]'s audio output, set [volumeDb] to a very low value like `-100` + * (which isn't audible to human hearing). + */ +@GodotBaseType +public open class AudioStreamPlayer3D : Node3D() { + /** + * Emitted when the audio stops playing. + */ + public val finished: Signal0 by Signal0 + + /** + * The [AudioStream] resource to be played. + */ + public final inline var stream: AudioStream? + @JvmName("streamProperty") + get() = getStream() + @JvmName("streamProperty") + set(`value`) { + setStream(value) + } + + /** + * Decides if audio should get quieter with distance linearly, quadratically, logarithmically, or + * not be affected by distance, effectively disabling attenuation. + */ + public final inline var attenuationModel: AttenuationModel + @JvmName("attenuationModelProperty") + get() = getAttenuationModel() + @JvmName("attenuationModelProperty") + set(`value`) { + setAttenuationModel(value) + } + + /** + * The base sound level before attenuation, in decibels. + */ + public final inline var volumeDb: Float + @JvmName("volumeDbProperty") + get() = getVolumeDb() + @JvmName("volumeDbProperty") + set(`value`) { + setVolumeDb(value) + } + + /** + * The factor for the attenuation effect. Higher values make the sound audible over a larger + * distance. + */ + public final inline var unitSize: Float + @JvmName("unitSizeProperty") + get() = getUnitSize() + @JvmName("unitSizeProperty") + set(`value`) { + setUnitSize(value) + } + + /** + * Sets the absolute maximum of the sound level, in decibels. + */ + public final inline var maxDb: Float + @JvmName("maxDbProperty") + get() = getMaxDb() + @JvmName("maxDbProperty") + set(`value`) { + setMaxDb(value) + } + + /** + * The pitch and the tempo of the audio, as a multiplier of the audio sample's sample rate. + */ + public final inline var pitchScale: Float + @JvmName("pitchScaleProperty") + get() = getPitchScale() + @JvmName("pitchScaleProperty") + set(`value`) { + setPitchScale(value) + } + + /** + * If `true`, audio is playing or is queued to be played (see [play]). + */ + public final inline val playing: Boolean + @JvmName("playingProperty") + get() = isPlaying() + + /** + * If `true`, audio plays when the AudioStreamPlayer3D node is added to scene tree. + */ + public final inline var autoplay: Boolean + @JvmName("autoplayProperty") + get() = isAutoplayEnabled() + @JvmName("autoplayProperty") + set(`value`) { + setAutoplay(value) + } + + /** + * If `true`, the playback is paused. You can resume it by setting [streamPaused] to `false`. + */ + public final inline var streamPaused: Boolean + @JvmName("streamPausedProperty") + get() = getStreamPaused() + @JvmName("streamPausedProperty") + set(`value`) { + setStreamPaused(value) + } + + /** + * The distance past which the sound can no longer be heard at all. Only has an effect if set to a + * value greater than `0.0`. [maxDistance] works in tandem with [unitSize]. However, unlike + * [unitSize] whose behavior depends on the [attenuationModel], [maxDistance] always works in a + * linear fashion. This can be used to prevent the [AudioStreamPlayer3D] from requiring audio mixing + * when the listener is far away, which saves CPU resources. + */ + public final inline var maxDistance: Float + @JvmName("maxDistanceProperty") + get() = getMaxDistance() + @JvmName("maxDistanceProperty") + set(`value`) { + setMaxDistance(value) + } + + /** + * The maximum number of sounds this node can play at the same time. Playing additional sounds + * after this value is reached will cut off the oldest sounds. + */ + public final inline var maxPolyphony: Int + @JvmName("maxPolyphonyProperty") + get() = getMaxPolyphony() + @JvmName("maxPolyphonyProperty") + set(`value`) { + setMaxPolyphony(value) + } + + /** + * Scales the panning strength for this node by multiplying the base + * [ProjectSettings.audio/general/3dPanningStrength] with this factor. Higher values will pan audio + * from left to right more dramatically than lower values. + */ + public final inline var panningStrength: Float + @JvmName("panningStrengthProperty") + get() = getPanningStrength() + @JvmName("panningStrengthProperty") + set(`value`) { + setPanningStrength(value) + } + + /** + * The bus on which this audio is playing. + * **Note:** When setting this property, keep in mind that no validation is performed to see if + * the given name matches an existing bus. This is because audio bus layouts might be loaded after + * this property is set. If this given name can't be resolved at runtime, it will fall back to + * `"Master"`. + */ + public final inline var bus: StringName + @JvmName("busProperty") + get() = getBus() + @JvmName("busProperty") + set(`value`) { + setBus(value) + } + + /** + * Determines which [Area3D] layers affect the sound for reverb and audio bus effects. Areas can + * be used to redirect [AudioStream]s so that they play in a certain audio bus. An example of how you + * might use this is making a "water" area so that sounds played in the water are redirected through + * an audio bus to make them sound like they are being played underwater. + */ + public final inline var areaMask: Long + @JvmName("areaMaskProperty") + get() = getAreaMask() + @JvmName("areaMaskProperty") + set(`value`) { + setAreaMask(value) + } + + /** + * The playback type of the stream player. If set other than to the default value, it will force + * that playback type. + */ + public final inline var playbackType: AudioServer.PlaybackType + @JvmName("playbackTypeProperty") + get() = getPlaybackType() + @JvmName("playbackTypeProperty") + set(`value`) { + setPlaybackType(value) + } + + /** + * If `true`, the audio should be attenuated according to the direction of the sound. + */ + public final inline var emissionAngleEnabled: Boolean + @JvmName("emissionAngleEnabledProperty") + get() = isEmissionAngleEnabled() + @JvmName("emissionAngleEnabledProperty") + set(`value`) { + setEmissionAngleEnabled(value) + } + + /** + * The angle in which the audio reaches a listener unattenuated. + */ + public final inline var emissionAngleDegrees: Float + @JvmName("emissionAngleDegreesProperty") + get() = getEmissionAngle() + @JvmName("emissionAngleDegreesProperty") + set(`value`) { + setEmissionAngle(value) + } + + /** + * Attenuation factor used if listener is outside of [emissionAngleDegrees] and + * [emissionAngleEnabled] is set, in decibels. + */ + public final inline var emissionAngleFilterAttenuationDb: Float + @JvmName("emissionAngleFilterAttenuationDbProperty") + get() = getEmissionAngleFilterAttenuationDb() + @JvmName("emissionAngleFilterAttenuationDbProperty") + set(`value`) { + setEmissionAngleFilterAttenuationDb(value) + } + + /** + * The cutoff frequency of the attenuation low-pass filter, in Hz. A sound above this frequency is + * attenuated more than a sound below this frequency. To disable this effect, set this to `20500` as + * this frequency is above the human hearing limit. + */ + public final inline var attenuationFilterCutoffHz: Float + @JvmName("attenuationFilterCutoffHzProperty") + get() = getAttenuationFilterCutoffHz() + @JvmName("attenuationFilterCutoffHzProperty") + set(`value`) { + setAttenuationFilterCutoffHz(value) + } + + /** + * Amount how much the filter affects the loudness, in decibels. + */ + public final inline var attenuationFilterDb: Float + @JvmName("attenuationFilterDbProperty") + get() = getAttenuationFilterDb() + @JvmName("attenuationFilterDbProperty") + set(`value`) { + setAttenuationFilterDb(value) + } + + /** + * Decides in which step the Doppler effect should be calculated. + */ + public final inline var dopplerTracking: DopplerTracking + @JvmName("dopplerTrackingProperty") + get() = getDopplerTracking() + @JvmName("dopplerTrackingProperty") + set(`value`) { + setDopplerTracking(value) + } + + public override fun new(scriptIndex: Int): Unit { + Internals.callConstructor(this, ENGINE_CLASS_AUDIOSTREAMPLAYER3D_INDEX, scriptIndex) + } + + public final fun setStream(stream: AudioStream?): Unit { + Internals.writeArguments(OBJECT to stream) + Internals.callMethod(rawPtr, MethodBindings.setStreamPtr, NIL) + } + + public final fun getStream(): AudioStream? { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getStreamPtr, OBJECT) + return (Internals.readReturnValue(OBJECT) as AudioStream?) + } + + public final fun setVolumeDb(volumeDb: Float): Unit { + Internals.writeArguments(DOUBLE to volumeDb.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setVolumeDbPtr, NIL) + } + + public final fun getVolumeDb(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getVolumeDbPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setUnitSize(unitSize: Float): Unit { + Internals.writeArguments(DOUBLE to unitSize.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setUnitSizePtr, NIL) + } + + public final fun getUnitSize(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getUnitSizePtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setMaxDb(maxDb: Float): Unit { + Internals.writeArguments(DOUBLE to maxDb.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setMaxDbPtr, NIL) + } + + public final fun getMaxDb(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getMaxDbPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setPitchScale(pitchScale: Float): Unit { + Internals.writeArguments(DOUBLE to pitchScale.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setPitchScalePtr, NIL) + } + + public final fun getPitchScale(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getPitchScalePtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + /** + * Queues the audio to play on the next physics frame, from the given position [fromPosition], in + * seconds. + */ + @JvmOverloads + public final fun play(fromPosition: Float = 0.0f): Unit { + Internals.writeArguments(DOUBLE to fromPosition.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.playPtr, NIL) + } + + /** + * Sets the position from which audio will be played, in seconds. + */ + public final fun seek(toPosition: Float): Unit { + Internals.writeArguments(DOUBLE to toPosition.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.seekPtr, NIL) + } + + /** + * Stops the audio. + */ + public final fun stop(): Unit { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.stopPtr, NIL) + } + + public final fun isPlaying(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isPlayingPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + /** + * Returns the position in the [AudioStream]. + */ + public final fun getPlaybackPosition(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getPlaybackPositionPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setBus(bus: StringName): Unit { + Internals.writeArguments(STRING_NAME to bus) + Internals.callMethod(rawPtr, MethodBindings.setBusPtr, NIL) + } + + public final fun getBus(): StringName { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getBusPtr, STRING_NAME) + return (Internals.readReturnValue(STRING_NAME) as StringName) + } + + public final fun setAutoplay(enable: Boolean): Unit { + Internals.writeArguments(BOOL to enable) + Internals.callMethod(rawPtr, MethodBindings.setAutoplayPtr, NIL) + } + + public final fun isAutoplayEnabled(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isAutoplayEnabledPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public final fun setMaxDistance(meters: Float): Unit { + Internals.writeArguments(DOUBLE to meters.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setMaxDistancePtr, NIL) + } + + public final fun getMaxDistance(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getMaxDistancePtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setAreaMask(mask: Long): Unit { + Internals.writeArguments(LONG to mask) + Internals.callMethod(rawPtr, MethodBindings.setAreaMaskPtr, NIL) + } + + public final fun getAreaMask(): Long { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getAreaMaskPtr, LONG) + return (Internals.readReturnValue(LONG) as Long) + } + + public final fun setEmissionAngle(degrees: Float): Unit { + Internals.writeArguments(DOUBLE to degrees.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setEmissionAnglePtr, NIL) + } + + public final fun getEmissionAngle(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getEmissionAnglePtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setEmissionAngleEnabled(enabled: Boolean): Unit { + Internals.writeArguments(BOOL to enabled) + Internals.callMethod(rawPtr, MethodBindings.setEmissionAngleEnabledPtr, NIL) + } + + public final fun isEmissionAngleEnabled(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isEmissionAngleEnabledPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public final fun setEmissionAngleFilterAttenuationDb(db: Float): Unit { + Internals.writeArguments(DOUBLE to db.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setEmissionAngleFilterAttenuationDbPtr, NIL) + } + + public final fun getEmissionAngleFilterAttenuationDb(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getEmissionAngleFilterAttenuationDbPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setAttenuationFilterCutoffHz(degrees: Float): Unit { + Internals.writeArguments(DOUBLE to degrees.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setAttenuationFilterCutoffHzPtr, NIL) + } + + public final fun getAttenuationFilterCutoffHz(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getAttenuationFilterCutoffHzPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setAttenuationFilterDb(db: Float): Unit { + Internals.writeArguments(DOUBLE to db.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setAttenuationFilterDbPtr, NIL) + } + + public final fun getAttenuationFilterDb(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getAttenuationFilterDbPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setAttenuationModel(model: AttenuationModel): Unit { + Internals.writeArguments(LONG to model.id) + Internals.callMethod(rawPtr, MethodBindings.setAttenuationModelPtr, NIL) + } + + public final fun getAttenuationModel(): AttenuationModel { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getAttenuationModelPtr, LONG) + return AudioStreamPlayer3D.AttenuationModel.from(Internals.readReturnValue(LONG) as Long) + } + + public final fun setDopplerTracking(mode: DopplerTracking): Unit { + Internals.writeArguments(LONG to mode.id) + Internals.callMethod(rawPtr, MethodBindings.setDopplerTrackingPtr, NIL) + } + + public final fun getDopplerTracking(): DopplerTracking { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getDopplerTrackingPtr, LONG) + return AudioStreamPlayer3D.DopplerTracking.from(Internals.readReturnValue(LONG) as Long) + } + + public final fun setStreamPaused(pause: Boolean): Unit { + Internals.writeArguments(BOOL to pause) + Internals.callMethod(rawPtr, MethodBindings.setStreamPausedPtr, NIL) + } + + public final fun getStreamPaused(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getStreamPausedPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public final fun setMaxPolyphony(maxPolyphony: Int): Unit { + Internals.writeArguments(LONG to maxPolyphony.toLong()) + Internals.callMethod(rawPtr, MethodBindings.setMaxPolyphonyPtr, NIL) + } + + public final fun getMaxPolyphony(): Int { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getMaxPolyphonyPtr, LONG) + return (Internals.readReturnValue(LONG) as Long).toInt() + } + + public final fun setPanningStrength(panningStrength: Float): Unit { + Internals.writeArguments(DOUBLE to panningStrength.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setPanningStrengthPtr, NIL) + } + + public final fun getPanningStrength(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getPanningStrengthPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + /** + * Returns whether the [AudioStreamPlayer] can return the [AudioStreamPlayback] object or not. + */ + public final fun hasStreamPlayback(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.hasStreamPlaybackPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + /** + * Returns the [AudioStreamPlayback] object associated with this [AudioStreamPlayer3D]. + */ + public final fun getStreamPlayback(): AudioStreamPlayback? { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getStreamPlaybackPtr, OBJECT) + return (Internals.readReturnValue(OBJECT) as AudioStreamPlayback?) + } + + public final fun setPlaybackType(playbackType: AudioServer.PlaybackType): Unit { + Internals.writeArguments(LONG to playbackType.id) + Internals.callMethod(rawPtr, MethodBindings.setPlaybackTypePtr, NIL) + } + + public final fun getPlaybackType(): AudioServer.PlaybackType { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getPlaybackTypePtr, LONG) + return AudioServer.PlaybackType.from(Internals.readReturnValue(LONG) as Long) + } + + public enum class AttenuationModel( + id: Long, + ) { + /** + * Attenuation of loudness according to linear distance. + */ + ATTENUATION_INVERSE_DISTANCE(0), + /** + * Attenuation of loudness according to squared distance. + */ + ATTENUATION_INVERSE_SQUARE_DISTANCE(1), + /** + * Attenuation of loudness according to logarithmic distance. + */ + ATTENUATION_LOGARITHMIC(2), + /** + * No attenuation of loudness according to distance. The sound will still be heard positionally, + * unlike an [AudioStreamPlayer]. [ATTENUATION_DISABLED] can be combined with a [maxDistance] value + * greater than `0.0` to achieve linear attenuation clamped to a sphere of a defined size. + */ + ATTENUATION_DISABLED(3), + ; + + public val id: Long + init { + this.id = id + } + + public companion object { + public fun from(`value`: Long): AttenuationModel = entries.single { it.id == `value` } + } + } + + public enum class DopplerTracking( + id: Long, + ) { + /** + * Disables doppler tracking. + */ + DOPPLER_TRACKING_DISABLED(0), + /** + * Executes doppler tracking during process frames (see [Node.NOTIFICATION_INTERNAL_PROCESS]). + */ + DOPPLER_TRACKING_IDLE_STEP(1), + /** + * Executes doppler tracking during physics frames (see + * [Node.NOTIFICATION_INTERNAL_PHYSICS_PROCESS]). + */ + DOPPLER_TRACKING_PHYSICS_STEP(2), + ; + + public val id: Long + init { + this.id = id + } + + public companion object { + public fun from(`value`: Long): DopplerTracking = entries.single { it.id == `value` } + } + } + + public companion object + + public object MethodBindings { + internal val setStreamPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamPlayer3D", "set_stream", 2210767741) + + internal val getStreamPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamPlayer3D", "get_stream", 160907539) + + internal val setVolumeDbPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamPlayer3D", "set_volume_db", 373806689) + + internal val getVolumeDbPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamPlayer3D", "get_volume_db", 1740695150) + + internal val setUnitSizePtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamPlayer3D", "set_unit_size", 373806689) + + internal val getUnitSizePtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamPlayer3D", "get_unit_size", 1740695150) + + internal val setMaxDbPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamPlayer3D", "set_max_db", 373806689) + + internal val getMaxDbPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamPlayer3D", "get_max_db", 1740695150) + + internal val setPitchScalePtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamPlayer3D", "set_pitch_scale", 373806689) + + internal val getPitchScalePtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamPlayer3D", "get_pitch_scale", 1740695150) + + internal val playPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamPlayer3D", "play", 1958160172) + + internal val seekPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamPlayer3D", "seek", 373806689) + + internal val stopPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamPlayer3D", "stop", 3218959716) + + internal val isPlayingPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamPlayer3D", "is_playing", 36873697) + + internal val getPlaybackPositionPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamPlayer3D", "get_playback_position", 191475506) + + internal val setBusPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamPlayer3D", "set_bus", 3304788590) + + internal val getBusPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamPlayer3D", "get_bus", 2002593661) + + internal val setAutoplayPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamPlayer3D", "set_autoplay", 2586408642) + + internal val isAutoplayEnabledPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamPlayer3D", "is_autoplay_enabled", 36873697) + + internal val setMaxDistancePtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamPlayer3D", "set_max_distance", 373806689) + + internal val getMaxDistancePtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamPlayer3D", "get_max_distance", 1740695150) + + internal val setAreaMaskPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamPlayer3D", "set_area_mask", 1286410249) + + internal val getAreaMaskPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamPlayer3D", "get_area_mask", 3905245786) + + internal val setEmissionAnglePtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamPlayer3D", "set_emission_angle", 373806689) + + internal val getEmissionAnglePtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamPlayer3D", "get_emission_angle", 1740695150) + + internal val setEmissionAngleEnabledPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamPlayer3D", "set_emission_angle_enabled", 2586408642) + + internal val isEmissionAngleEnabledPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamPlayer3D", "is_emission_angle_enabled", 36873697) + + internal val setEmissionAngleFilterAttenuationDbPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamPlayer3D", "set_emission_angle_filter_attenuation_db", 373806689) + + internal val getEmissionAngleFilterAttenuationDbPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamPlayer3D", "get_emission_angle_filter_attenuation_db", 1740695150) + + internal val setAttenuationFilterCutoffHzPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamPlayer3D", "set_attenuation_filter_cutoff_hz", 373806689) + + internal val getAttenuationFilterCutoffHzPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamPlayer3D", "get_attenuation_filter_cutoff_hz", 1740695150) + + internal val setAttenuationFilterDbPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamPlayer3D", "set_attenuation_filter_db", 373806689) + + internal val getAttenuationFilterDbPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamPlayer3D", "get_attenuation_filter_db", 1740695150) + + internal val setAttenuationModelPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamPlayer3D", "set_attenuation_model", 2988086229) + + internal val getAttenuationModelPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamPlayer3D", "get_attenuation_model", 3035106060) + + internal val setDopplerTrackingPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamPlayer3D", "set_doppler_tracking", 3968161450) + + internal val getDopplerTrackingPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamPlayer3D", "get_doppler_tracking", 1702418664) + + internal val setStreamPausedPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamPlayer3D", "set_stream_paused", 2586408642) + + internal val getStreamPausedPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamPlayer3D", "get_stream_paused", 36873697) + + internal val setMaxPolyphonyPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamPlayer3D", "set_max_polyphony", 1286410249) + + internal val getMaxPolyphonyPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamPlayer3D", "get_max_polyphony", 3905245786) + + internal val setPanningStrengthPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamPlayer3D", "set_panning_strength", 373806689) + + internal val getPanningStrengthPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamPlayer3D", "get_panning_strength", 1740695150) + + internal val hasStreamPlaybackPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamPlayer3D", "has_stream_playback", 2240911060) + + internal val getStreamPlaybackPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamPlayer3D", "get_stream_playback", 210135309) + + internal val setPlaybackTypePtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamPlayer3D", "set_playback_type", 725473817) + + internal val getPlaybackTypePtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamPlayer3D", "get_playback_type", 4011264623) + } +} diff --git a/kt/godot-library/src/main/kotlin/godot/gen/godot/AudioStreamPlaylist.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioStreamPlaylist.kt similarity index 82% rename from kt/godot-library/src/main/kotlin/godot/gen/godot/AudioStreamPlaylist.kt rename to kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioStreamPlaylist.kt index e93e400d6f..5103e1bb14 100644 --- a/kt/godot-library/src/main/kotlin/godot/gen/godot/AudioStreamPlaylist.kt +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioStreamPlaylist.kt @@ -7,13 +7,12 @@ package godot import godot.`annotation`.GodotBaseType -import godot.core.TypeManager import godot.core.VariantParser.BOOL import godot.core.VariantParser.DOUBLE import godot.core.VariantParser.LONG import godot.core.VariantParser.NIL import godot.core.VariantParser.OBJECT -import godot.core.memory.TransferContext +import godot.util.Internals import godot.util.VoidPtr import kotlin.Boolean import kotlin.Double @@ -24,6 +23,8 @@ import kotlin.Suppress import kotlin.Unit import kotlin.jvm.JvmName +private const val ENGINE_CLASS_AUDIOSTREAMPLAYLIST_INDEX: Int = 131 + @GodotBaseType public open class AudioStreamPlaylist : AudioStream() { /** @@ -585,77 +586,77 @@ public open class AudioStreamPlaylist : AudioStream() { } public override fun new(scriptIndex: Int): Unit { - callConstructor(ENGINECLASS_AUDIOSTREAMPLAYLIST, scriptIndex) + Internals.callConstructor(this, ENGINE_CLASS_AUDIOSTREAMPLAYLIST_INDEX, scriptIndex) } public final fun setStreamCount(streamCount: Int): Unit { - TransferContext.writeArguments(LONG to streamCount.toLong()) - TransferContext.callMethod(rawPtr, MethodBindings.setStreamCountPtr, NIL) + Internals.writeArguments(LONG to streamCount.toLong()) + Internals.callMethod(rawPtr, MethodBindings.setStreamCountPtr, NIL) } public final fun getStreamCount(): Int { - TransferContext.writeArguments() - TransferContext.callMethod(rawPtr, MethodBindings.getStreamCountPtr, LONG) - return (TransferContext.readReturnValue(LONG) as Long).toInt() + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getStreamCountPtr, LONG) + return (Internals.readReturnValue(LONG) as Long).toInt() } /** * Returns the BPM of the playlist, which can vary depending on the clip being played. */ public final fun getBpm(): Double { - TransferContext.writeArguments() - TransferContext.callMethod(rawPtr, MethodBindings.getBpmPtr, DOUBLE) - return (TransferContext.readReturnValue(DOUBLE) as Double) + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getBpmPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double) } /** * Sets the stream at playback position index. */ public final fun setListStream(streamIndex: Int, audioStream: AudioStream?): Unit { - TransferContext.writeArguments(LONG to streamIndex.toLong(), OBJECT to audioStream) - TransferContext.callMethod(rawPtr, MethodBindings.setListStreamPtr, NIL) + Internals.writeArguments(LONG to streamIndex.toLong(), OBJECT to audioStream) + Internals.callMethod(rawPtr, MethodBindings.setListStreamPtr, NIL) } /** * Returns the stream at playback position index. */ public final fun getListStream(streamIndex: Int): AudioStream? { - TransferContext.writeArguments(LONG to streamIndex.toLong()) - TransferContext.callMethod(rawPtr, MethodBindings.getListStreamPtr, OBJECT) - return (TransferContext.readReturnValue(OBJECT) as AudioStream?) + Internals.writeArguments(LONG to streamIndex.toLong()) + Internals.callMethod(rawPtr, MethodBindings.getListStreamPtr, OBJECT) + return (Internals.readReturnValue(OBJECT) as AudioStream?) } public final fun setShuffle(shuffle: Boolean): Unit { - TransferContext.writeArguments(BOOL to shuffle) - TransferContext.callMethod(rawPtr, MethodBindings.setShufflePtr, NIL) + Internals.writeArguments(BOOL to shuffle) + Internals.callMethod(rawPtr, MethodBindings.setShufflePtr, NIL) } public final fun getShuffle(): Boolean { - TransferContext.writeArguments() - TransferContext.callMethod(rawPtr, MethodBindings.getShufflePtr, BOOL) - return (TransferContext.readReturnValue(BOOL) as Boolean) + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getShufflePtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) } public final fun setFadeTime(dec: Float): Unit { - TransferContext.writeArguments(DOUBLE to dec.toDouble()) - TransferContext.callMethod(rawPtr, MethodBindings.setFadeTimePtr, NIL) + Internals.writeArguments(DOUBLE to dec.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setFadeTimePtr, NIL) } public final fun getFadeTime(): Float { - TransferContext.writeArguments() - TransferContext.callMethod(rawPtr, MethodBindings.getFadeTimePtr, DOUBLE) - return (TransferContext.readReturnValue(DOUBLE) as Double).toFloat() + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getFadeTimePtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() } public final fun setLoop(loop: Boolean): Unit { - TransferContext.writeArguments(BOOL to loop) - TransferContext.callMethod(rawPtr, MethodBindings.setLoopPtr, NIL) + Internals.writeArguments(BOOL to loop) + Internals.callMethod(rawPtr, MethodBindings.setLoopPtr, NIL) } public final fun hasLoop(): Boolean { - TransferContext.writeArguments() - TransferContext.callMethod(rawPtr, MethodBindings.hasLoopPtr, BOOL) - return (TransferContext.readReturnValue(BOOL) as Boolean) + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.hasLoopPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) } public companion object { @@ -665,38 +666,38 @@ public open class AudioStreamPlaylist : AudioStream() { public final const val MAX_STREAMS: Long = 64 } - internal object MethodBindings { - public val setStreamCountPtr: VoidPtr = - TypeManager.getMethodBindPtr("AudioStreamPlaylist", "set_stream_count", 1286410249) + public object MethodBindings { + internal val setStreamCountPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamPlaylist", "set_stream_count", 1286410249) - public val getStreamCountPtr: VoidPtr = - TypeManager.getMethodBindPtr("AudioStreamPlaylist", "get_stream_count", 3905245786) + internal val getStreamCountPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamPlaylist", "get_stream_count", 3905245786) - public val getBpmPtr: VoidPtr = - TypeManager.getMethodBindPtr("AudioStreamPlaylist", "get_bpm", 1740695150) + internal val getBpmPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamPlaylist", "get_bpm", 1740695150) - public val setListStreamPtr: VoidPtr = - TypeManager.getMethodBindPtr("AudioStreamPlaylist", "set_list_stream", 111075094) + internal val setListStreamPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamPlaylist", "set_list_stream", 111075094) - public val getListStreamPtr: VoidPtr = - TypeManager.getMethodBindPtr("AudioStreamPlaylist", "get_list_stream", 2739380747) + internal val getListStreamPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamPlaylist", "get_list_stream", 2739380747) - public val setShufflePtr: VoidPtr = - TypeManager.getMethodBindPtr("AudioStreamPlaylist", "set_shuffle", 2586408642) + internal val setShufflePtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamPlaylist", "set_shuffle", 2586408642) - public val getShufflePtr: VoidPtr = - TypeManager.getMethodBindPtr("AudioStreamPlaylist", "get_shuffle", 36873697) + internal val getShufflePtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamPlaylist", "get_shuffle", 36873697) - public val setFadeTimePtr: VoidPtr = - TypeManager.getMethodBindPtr("AudioStreamPlaylist", "set_fade_time", 373806689) + internal val setFadeTimePtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamPlaylist", "set_fade_time", 373806689) - public val getFadeTimePtr: VoidPtr = - TypeManager.getMethodBindPtr("AudioStreamPlaylist", "get_fade_time", 1740695150) + internal val getFadeTimePtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamPlaylist", "get_fade_time", 1740695150) - public val setLoopPtr: VoidPtr = - TypeManager.getMethodBindPtr("AudioStreamPlaylist", "set_loop", 2586408642) + internal val setLoopPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamPlaylist", "set_loop", 2586408642) - public val hasLoopPtr: VoidPtr = - TypeManager.getMethodBindPtr("AudioStreamPlaylist", "has_loop", 36873697) + internal val hasLoopPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamPlaylist", "has_loop", 36873697) } } diff --git a/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioStreamPolyphonic.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioStreamPolyphonic.kt new file mode 100644 index 0000000000..a54d6a46de --- /dev/null +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioStreamPolyphonic.kt @@ -0,0 +1,68 @@ +// THIS FILE IS GENERATED! DO NOT EDIT IT MANUALLY! +@file:Suppress("PackageDirectoryMismatch", "unused", "FunctionName", "RedundantModalityModifier", + "UNCHECKED_CAST", "JoinDeclarationAndAssignment", "USELESS_CAST", + "RemoveRedundantQualifierName", "NOTHING_TO_INLINE", "NON_FINAL_MEMBER_IN_OBJECT", + "RedundantVisibilityModifier", "RedundantUnitReturnType", "MemberVisibilityCanBePrivate") + +package godot + +import godot.`annotation`.GodotBaseType +import godot.core.VariantParser.LONG +import godot.core.VariantParser.NIL +import godot.util.Internals +import godot.util.VoidPtr +import kotlin.Int +import kotlin.Long +import kotlin.Suppress +import kotlin.Unit +import kotlin.jvm.JvmName + +private const val ENGINE_CLASS_AUDIOSTREAMPOLYPHONIC_INDEX: Int = 132 + +/** + * AudioStream that lets the user play custom streams at any time from code, simultaneously using a + * single player. + * Playback control is done via the [AudioStreamPlaybackPolyphonic] instance set inside the player, + * which can be obtained via [AudioStreamPlayer.getStreamPlayback], + * [AudioStreamPlayer2D.getStreamPlayback] or [AudioStreamPlayer3D.getStreamPlayback] methods. + * Obtaining the playback instance is only valid after the `stream` property is set as an + * [AudioStreamPolyphonic] in those players. + */ +@GodotBaseType +public open class AudioStreamPolyphonic : AudioStream() { + /** + * Maximum amount of simultaneous streams that can be played. + */ + public final inline var polyphony: Int + @JvmName("polyphonyProperty") + get() = getPolyphony() + @JvmName("polyphonyProperty") + set(`value`) { + setPolyphony(value) + } + + public override fun new(scriptIndex: Int): Unit { + Internals.callConstructor(this, ENGINE_CLASS_AUDIOSTREAMPOLYPHONIC_INDEX, scriptIndex) + } + + public final fun setPolyphony(voices: Int): Unit { + Internals.writeArguments(LONG to voices.toLong()) + Internals.callMethod(rawPtr, MethodBindings.setPolyphonyPtr, NIL) + } + + public final fun getPolyphony(): Int { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getPolyphonyPtr, LONG) + return (Internals.readReturnValue(LONG) as Long).toInt() + } + + public companion object + + public object MethodBindings { + internal val setPolyphonyPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamPolyphonic", "set_polyphony", 1286410249) + + internal val getPolyphonyPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamPolyphonic", "get_polyphony", 3905245786) + } +} diff --git a/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioStreamRandomizer.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioStreamRandomizer.kt new file mode 100644 index 0000000000..9807ba85db --- /dev/null +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioStreamRandomizer.kt @@ -0,0 +1,269 @@ +// THIS FILE IS GENERATED! DO NOT EDIT IT MANUALLY! +@file:Suppress("PackageDirectoryMismatch", "unused", "FunctionName", "RedundantModalityModifier", + "UNCHECKED_CAST", "JoinDeclarationAndAssignment", "USELESS_CAST", + "RemoveRedundantQualifierName", "NOTHING_TO_INLINE", "NON_FINAL_MEMBER_IN_OBJECT", + "RedundantVisibilityModifier", "RedundantUnitReturnType", "MemberVisibilityCanBePrivate") + +package godot + +import godot.`annotation`.GodotBaseType +import godot.core.VariantParser.DOUBLE +import godot.core.VariantParser.LONG +import godot.core.VariantParser.NIL +import godot.core.VariantParser.OBJECT +import godot.util.Internals +import godot.util.VoidPtr +import kotlin.Double +import kotlin.Float +import kotlin.Int +import kotlin.Long +import kotlin.Suppress +import kotlin.Unit +import kotlin.jvm.JvmName +import kotlin.jvm.JvmOverloads + +private const val ENGINE_CLASS_AUDIOSTREAMRANDOMIZER_INDEX: Int = 133 + +/** + * Picks a random AudioStream from the pool, depending on the playback mode, and applies random + * pitch shifting and volume shifting during playback. + */ +@GodotBaseType +public open class AudioStreamRandomizer : AudioStream() { + /** + * Controls how this AudioStreamRandomizer picks which AudioStream to play next. + */ + public final inline var playbackMode: PlaybackMode + @JvmName("playbackModeProperty") + get() = getPlaybackMode() + @JvmName("playbackModeProperty") + set(`value`) { + setPlaybackMode(value) + } + + /** + * The intensity of random pitch variation. A value of 1 means no variation. + */ + public final inline var randomPitch: Float + @JvmName("randomPitchProperty") + get() = getRandomPitch() + @JvmName("randomPitchProperty") + set(`value`) { + setRandomPitch(value) + } + + /** + * The intensity of random volume variation. A value of 0 means no variation. + */ + public final inline var randomVolumeOffsetDb: Float + @JvmName("randomVolumeOffsetDbProperty") + get() = getRandomVolumeOffsetDb() + @JvmName("randomVolumeOffsetDbProperty") + set(`value`) { + setRandomVolumeOffsetDb(value) + } + + /** + * The number of streams in the stream pool. + */ + public final inline var streamsCount: Int + @JvmName("streamsCountProperty") + get() = getStreamsCount() + @JvmName("streamsCountProperty") + set(`value`) { + setStreamsCount(value) + } + + public override fun new(scriptIndex: Int): Unit { + Internals.callConstructor(this, ENGINE_CLASS_AUDIOSTREAMRANDOMIZER_INDEX, scriptIndex) + } + + /** + * Insert a stream at the specified index. If the index is less than zero, the insertion occurs at + * the end of the underlying pool. + */ + @JvmOverloads + public final fun addStream( + index: Int, + stream: AudioStream?, + weight: Float = 1.0f, + ): Unit { + Internals.writeArguments(LONG to index.toLong(), OBJECT to stream, DOUBLE to weight.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.addStreamPtr, NIL) + } + + /** + * Move a stream from one index to another. + */ + public final fun moveStream(indexFrom: Int, indexTo: Int): Unit { + Internals.writeArguments(LONG to indexFrom.toLong(), LONG to indexTo.toLong()) + Internals.callMethod(rawPtr, MethodBindings.moveStreamPtr, NIL) + } + + /** + * Remove the stream at the specified index. + */ + public final fun removeStream(index: Int): Unit { + Internals.writeArguments(LONG to index.toLong()) + Internals.callMethod(rawPtr, MethodBindings.removeStreamPtr, NIL) + } + + /** + * Set the AudioStream at the specified index. + */ + public final fun setStream(index: Int, stream: AudioStream?): Unit { + Internals.writeArguments(LONG to index.toLong(), OBJECT to stream) + Internals.callMethod(rawPtr, MethodBindings.setStreamPtr, NIL) + } + + /** + * Returns the stream at the specified index. + */ + public final fun getStream(index: Int): AudioStream? { + Internals.writeArguments(LONG to index.toLong()) + Internals.callMethod(rawPtr, MethodBindings.getStreamPtr, OBJECT) + return (Internals.readReturnValue(OBJECT) as AudioStream?) + } + + /** + * Set the probability weight of the stream at the specified index. The higher this value, the + * more likely that the randomizer will choose this stream during random playback modes. + */ + public final fun setStreamProbabilityWeight(index: Int, weight: Float): Unit { + Internals.writeArguments(LONG to index.toLong(), DOUBLE to weight.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setStreamProbabilityWeightPtr, NIL) + } + + /** + * Returns the probability weight associated with the stream at the given index. + */ + public final fun getStreamProbabilityWeight(index: Int): Float { + Internals.writeArguments(LONG to index.toLong()) + Internals.callMethod(rawPtr, MethodBindings.getStreamProbabilityWeightPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setStreamsCount(count: Int): Unit { + Internals.writeArguments(LONG to count.toLong()) + Internals.callMethod(rawPtr, MethodBindings.setStreamsCountPtr, NIL) + } + + public final fun getStreamsCount(): Int { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getStreamsCountPtr, LONG) + return (Internals.readReturnValue(LONG) as Long).toInt() + } + + public final fun setRandomPitch(scale: Float): Unit { + Internals.writeArguments(DOUBLE to scale.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setRandomPitchPtr, NIL) + } + + public final fun getRandomPitch(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getRandomPitchPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setRandomVolumeOffsetDb(dbOffset: Float): Unit { + Internals.writeArguments(DOUBLE to dbOffset.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setRandomVolumeOffsetDbPtr, NIL) + } + + public final fun getRandomVolumeOffsetDb(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getRandomVolumeOffsetDbPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setPlaybackMode(mode: PlaybackMode): Unit { + Internals.writeArguments(LONG to mode.id) + Internals.callMethod(rawPtr, MethodBindings.setPlaybackModePtr, NIL) + } + + public final fun getPlaybackMode(): PlaybackMode { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getPlaybackModePtr, LONG) + return AudioStreamRandomizer.PlaybackMode.from(Internals.readReturnValue(LONG) as Long) + } + + public enum class PlaybackMode( + id: Long, + ) { + /** + * Pick a stream at random according to the probability weights chosen for each stream, but + * avoid playing the same stream twice in a row whenever possible. If only 1 sound is present in + * the pool, the same sound will always play, effectively allowing repeats to occur. + */ + PLAYBACK_RANDOM_NO_REPEATS(0), + /** + * Pick a stream at random according to the probability weights chosen for each stream. If only + * 1 sound is present in the pool, the same sound will always play. + */ + PLAYBACK_RANDOM(1), + /** + * Play streams in the order they appear in the stream pool. If only 1 sound is present in the + * pool, the same sound will always play. + */ + PLAYBACK_SEQUENTIAL(2), + ; + + public val id: Long + init { + this.id = id + } + + public companion object { + public fun from(`value`: Long): PlaybackMode = entries.single { it.id == `value` } + } + } + + public companion object + + public object MethodBindings { + internal val addStreamPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamRandomizer", "add_stream", 1892018854) + + internal val moveStreamPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamRandomizer", "move_stream", 3937882851) + + internal val removeStreamPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamRandomizer", "remove_stream", 1286410249) + + internal val setStreamPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamRandomizer", "set_stream", 111075094) + + internal val getStreamPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamRandomizer", "get_stream", 2739380747) + + internal val setStreamProbabilityWeightPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamRandomizer", "set_stream_probability_weight", 1602489585) + + internal val getStreamProbabilityWeightPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamRandomizer", "get_stream_probability_weight", 2339986948) + + internal val setStreamsCountPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamRandomizer", "set_streams_count", 1286410249) + + internal val getStreamsCountPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamRandomizer", "get_streams_count", 3905245786) + + internal val setRandomPitchPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamRandomizer", "set_random_pitch", 373806689) + + internal val getRandomPitchPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamRandomizer", "get_random_pitch", 1740695150) + + internal val setRandomVolumeOffsetDbPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamRandomizer", "set_random_volume_offset_db", 373806689) + + internal val getRandomVolumeOffsetDbPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamRandomizer", "get_random_volume_offset_db", 1740695150) + + internal val setPlaybackModePtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamRandomizer", "set_playback_mode", 3950967023) + + internal val getPlaybackModePtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamRandomizer", "get_playback_mode", 3943055077) + } +} diff --git a/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioStreamSynchronized.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioStreamSynchronized.kt new file mode 100644 index 0000000000..e8c2d5b8dc --- /dev/null +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioStreamSynchronized.kt @@ -0,0 +1,119 @@ +// THIS FILE IS GENERATED! DO NOT EDIT IT MANUALLY! +@file:Suppress("PackageDirectoryMismatch", "unused", "FunctionName", "RedundantModalityModifier", + "UNCHECKED_CAST", "JoinDeclarationAndAssignment", "USELESS_CAST", + "RemoveRedundantQualifierName", "NOTHING_TO_INLINE", "NON_FINAL_MEMBER_IN_OBJECT", + "RedundantVisibilityModifier", "RedundantUnitReturnType", "MemberVisibilityCanBePrivate") + +package godot + +import godot.`annotation`.GodotBaseType +import godot.core.VariantParser.DOUBLE +import godot.core.VariantParser.LONG +import godot.core.VariantParser.NIL +import godot.core.VariantParser.OBJECT +import godot.util.Internals +import godot.util.VoidPtr +import kotlin.Double +import kotlin.Float +import kotlin.Int +import kotlin.Long +import kotlin.Suppress +import kotlin.Unit +import kotlin.jvm.JvmName + +private const val ENGINE_CLASS_AUDIOSTREAMSYNCHRONIZED_INDEX: Int = 134 + +/** + * This is a stream that can be fitted with sub-streams, which will be played in-sync. The streams + * being at exactly the same time when play is pressed, and will end when the last of them ends. If one + * of the sub-streams loops, then playback will continue. + */ +@GodotBaseType +public open class AudioStreamSynchronized : AudioStream() { + /** + * Set the total amount of streams that will be played back synchronized. + */ + public final inline var streamCount: Int + @JvmName("streamCountProperty") + get() = getStreamCount() + @JvmName("streamCountProperty") + set(`value`) { + setStreamCount(value) + } + + public override fun new(scriptIndex: Int): Unit { + Internals.callConstructor(this, ENGINE_CLASS_AUDIOSTREAMSYNCHRONIZED_INDEX, scriptIndex) + } + + public final fun setStreamCount(streamCount: Int): Unit { + Internals.writeArguments(LONG to streamCount.toLong()) + Internals.callMethod(rawPtr, MethodBindings.setStreamCountPtr, NIL) + } + + public final fun getStreamCount(): Int { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getStreamCountPtr, LONG) + return (Internals.readReturnValue(LONG) as Long).toInt() + } + + /** + * Set one of the synchronized streams, by index. + */ + public final fun setSyncStream(streamIndex: Int, audioStream: AudioStream?): Unit { + Internals.writeArguments(LONG to streamIndex.toLong(), OBJECT to audioStream) + Internals.callMethod(rawPtr, MethodBindings.setSyncStreamPtr, NIL) + } + + /** + * Get one of the synchronized streams, by index. + */ + public final fun getSyncStream(streamIndex: Int): AudioStream? { + Internals.writeArguments(LONG to streamIndex.toLong()) + Internals.callMethod(rawPtr, MethodBindings.getSyncStreamPtr, OBJECT) + return (Internals.readReturnValue(OBJECT) as AudioStream?) + } + + /** + * Set the volume of one of the synchronized streams, by index. + */ + public final fun setSyncStreamVolume(streamIndex: Int, volumeDb: Float): Unit { + Internals.writeArguments(LONG to streamIndex.toLong(), DOUBLE to volumeDb.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setSyncStreamVolumePtr, NIL) + } + + /** + * Get the volume of one of the synchronized streams, by index. + */ + public final fun getSyncStreamVolume(streamIndex: Int): Float { + Internals.writeArguments(LONG to streamIndex.toLong()) + Internals.callMethod(rawPtr, MethodBindings.getSyncStreamVolumePtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public companion object { + /** + * Maximum amount of streams that can be synchronized. + */ + public final const val MAX_STREAMS: Long = 32 + } + + public object MethodBindings { + internal val setStreamCountPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamSynchronized", "set_stream_count", 1286410249) + + internal val getStreamCountPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamSynchronized", "get_stream_count", 3905245786) + + internal val setSyncStreamPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamSynchronized", "set_sync_stream", 111075094) + + internal val getSyncStreamPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamSynchronized", "get_sync_stream", 2739380747) + + internal val setSyncStreamVolumePtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamSynchronized", "set_sync_stream_volume", 1602489585) + + internal val getSyncStreamVolumePtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamSynchronized", "get_sync_stream_volume", 2339986948) + } +} diff --git a/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioStreamWAV.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioStreamWAV.kt new file mode 100644 index 0000000000..7569f6f6b4 --- /dev/null +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/AudioStreamWAV.kt @@ -0,0 +1,330 @@ +// THIS FILE IS GENERATED! DO NOT EDIT IT MANUALLY! +@file:Suppress("PackageDirectoryMismatch", "unused", "FunctionName", "RedundantModalityModifier", + "UNCHECKED_CAST", "JoinDeclarationAndAssignment", "USELESS_CAST", + "RemoveRedundantQualifierName", "NOTHING_TO_INLINE", "NON_FINAL_MEMBER_IN_OBJECT", + "RedundantVisibilityModifier", "RedundantUnitReturnType", "MemberVisibilityCanBePrivate") + +package godot + +import godot.`annotation`.GodotBaseType +import godot.core.PackedByteArray +import godot.core.VariantParser.BOOL +import godot.core.VariantParser.LONG +import godot.core.VariantParser.NIL +import godot.core.VariantParser.PACKED_BYTE_ARRAY +import godot.core.VariantParser.STRING +import godot.util.Internals +import godot.util.VoidPtr +import kotlin.Boolean +import kotlin.Int +import kotlin.Long +import kotlin.String +import kotlin.Suppress +import kotlin.Unit +import kotlin.jvm.JvmName + +private const val ENGINE_CLASS_AUDIOSTREAMWAV_INDEX: Int = 135 + +/** + * AudioStreamWAV stores sound samples loaded from WAV files. To play the stored sound, use an + * [AudioStreamPlayer] (for non-positional audio) or [AudioStreamPlayer2D]/[AudioStreamPlayer3D] (for + * positional audio). The sound can be looped. + * This class can also be used to store dynamically-generated PCM audio data. See also + * [AudioStreamGenerator] for procedural audio generation. + */ +@GodotBaseType +public open class AudioStreamWAV : AudioStream() { + /** + * Contains the audio data in bytes. + * **Note:** This property expects signed PCM8 data. To convert unsigned PCM8 to signed PCM8, + * subtract 128 from each byte. + */ + public final inline var `data`: PackedByteArray + @JvmName("dataProperty") + get() = getData() + @JvmName("dataProperty") + set(`value`) { + setData(value) + } + + /** + * Audio format. See [Format] constants for values. + */ + public final inline var format: Format + @JvmName("formatProperty") + get() = getFormat() + @JvmName("formatProperty") + set(`value`) { + setFormat(value) + } + + /** + * The loop mode. This information will be imported automatically from the WAV file if present. + * See [LoopMode] constants for values. + */ + public final inline var loopMode: LoopMode + @JvmName("loopModeProperty") + get() = getLoopMode() + @JvmName("loopModeProperty") + set(`value`) { + setLoopMode(value) + } + + /** + * The loop start point (in number of samples, relative to the beginning of the stream). This + * information will be imported automatically from the WAV file if present. + */ + public final inline var loopBegin: Int + @JvmName("loopBeginProperty") + get() = getLoopBegin() + @JvmName("loopBeginProperty") + set(`value`) { + setLoopBegin(value) + } + + /** + * The loop end point (in number of samples, relative to the beginning of the stream). This + * information will be imported automatically from the WAV file if present. + */ + public final inline var loopEnd: Int + @JvmName("loopEndProperty") + get() = getLoopEnd() + @JvmName("loopEndProperty") + set(`value`) { + setLoopEnd(value) + } + + /** + * The sample rate for mixing this audio. Higher values require more storage space, but result in + * better quality. + * In games, common sample rates in use are `11025`, `16000`, `22050`, `32000`, `44100`, and + * `48000`. + * According to the + * [url=https://en.wikipedia.org/wiki/Nyquist%E2%80%93Shannon_sampling_theorem]Nyquist-Shannon + * sampling theorem[/url], there is no quality difference to human hearing when going past 40,000 Hz + * (since most humans can only hear up to ~20,000 Hz, often less). If you are using lower-pitched + * sounds such as voices, lower sample rates such as `32000` or `22050` may be usable with no loss in + * quality. + */ + public final inline var mixRate: Int + @JvmName("mixRateProperty") + get() = getMixRate() + @JvmName("mixRateProperty") + set(`value`) { + setMixRate(value) + } + + /** + * If `true`, audio is stereo. + */ + public final inline var stereo: Boolean + @JvmName("stereoProperty") + get() = isStereo() + @JvmName("stereoProperty") + set(`value`) { + setStereo(value) + } + + public override fun new(scriptIndex: Int): Unit { + Internals.callConstructor(this, ENGINE_CLASS_AUDIOSTREAMWAV_INDEX, scriptIndex) + } + + public final fun setData(`data`: PackedByteArray): Unit { + Internals.writeArguments(PACKED_BYTE_ARRAY to data) + Internals.callMethod(rawPtr, MethodBindings.setDataPtr, NIL) + } + + public final fun getData(): PackedByteArray { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getDataPtr, PACKED_BYTE_ARRAY) + return (Internals.readReturnValue(PACKED_BYTE_ARRAY) as PackedByteArray) + } + + public final fun setFormat(format: Format): Unit { + Internals.writeArguments(LONG to format.id) + Internals.callMethod(rawPtr, MethodBindings.setFormatPtr, NIL) + } + + public final fun getFormat(): Format { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getFormatPtr, LONG) + return AudioStreamWAV.Format.from(Internals.readReturnValue(LONG) as Long) + } + + public final fun setLoopMode(loopMode: LoopMode): Unit { + Internals.writeArguments(LONG to loopMode.id) + Internals.callMethod(rawPtr, MethodBindings.setLoopModePtr, NIL) + } + + public final fun getLoopMode(): LoopMode { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getLoopModePtr, LONG) + return AudioStreamWAV.LoopMode.from(Internals.readReturnValue(LONG) as Long) + } + + public final fun setLoopBegin(loopBegin: Int): Unit { + Internals.writeArguments(LONG to loopBegin.toLong()) + Internals.callMethod(rawPtr, MethodBindings.setLoopBeginPtr, NIL) + } + + public final fun getLoopBegin(): Int { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getLoopBeginPtr, LONG) + return (Internals.readReturnValue(LONG) as Long).toInt() + } + + public final fun setLoopEnd(loopEnd: Int): Unit { + Internals.writeArguments(LONG to loopEnd.toLong()) + Internals.callMethod(rawPtr, MethodBindings.setLoopEndPtr, NIL) + } + + public final fun getLoopEnd(): Int { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getLoopEndPtr, LONG) + return (Internals.readReturnValue(LONG) as Long).toInt() + } + + public final fun setMixRate(mixRate: Int): Unit { + Internals.writeArguments(LONG to mixRate.toLong()) + Internals.callMethod(rawPtr, MethodBindings.setMixRatePtr, NIL) + } + + public final fun getMixRate(): Int { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getMixRatePtr, LONG) + return (Internals.readReturnValue(LONG) as Long).toInt() + } + + public final fun setStereo(stereo: Boolean): Unit { + Internals.writeArguments(BOOL to stereo) + Internals.callMethod(rawPtr, MethodBindings.setStereoPtr, NIL) + } + + public final fun isStereo(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isStereoPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + /** + * Saves the AudioStreamWAV as a WAV file to [path]. Samples with IMA ADPCM or QOA formats can't + * be saved. + * **Note:** A `.wav` extension is automatically appended to [path] if it is missing. + */ + public final fun saveToWav(path: String): Error { + Internals.writeArguments(STRING to path) + Internals.callMethod(rawPtr, MethodBindings.saveToWavPtr, LONG) + return Error.from(Internals.readReturnValue(LONG) as Long) + } + + public enum class Format( + id: Long, + ) { + /** + * 8-bit audio codec. + */ + FORMAT_8_BITS(0), + /** + * 16-bit audio codec. + */ + FORMAT_16_BITS(1), + /** + * Audio is compressed using IMA ADPCM. + */ + FORMAT_IMA_ADPCM(2), + /** + * Audio is compressed as QOA ([url=https://qoaformat.org/]Quite OK Audio[/url]). + */ + FORMAT_QOA(3), + ; + + public val id: Long + init { + this.id = id + } + + public companion object { + public fun from(`value`: Long): Format = entries.single { it.id == `value` } + } + } + + public enum class LoopMode( + id: Long, + ) { + /** + * Audio does not loop. + */ + LOOP_DISABLED(0), + /** + * Audio loops the data between [loopBegin] and [loopEnd], playing forward only. + */ + LOOP_FORWARD(1), + /** + * Audio loops the data between [loopBegin] and [loopEnd], playing back and forth. + */ + LOOP_PINGPONG(2), + /** + * Audio loops the data between [loopBegin] and [loopEnd], playing backward only. + */ + LOOP_BACKWARD(3), + ; + + public val id: Long + init { + this.id = id + } + + public companion object { + public fun from(`value`: Long): LoopMode = entries.single { it.id == `value` } + } + } + + public companion object + + public object MethodBindings { + internal val setDataPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamWAV", "set_data", 2971499966) + + internal val getDataPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamWAV", "get_data", 2362200018) + + internal val setFormatPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamWAV", "set_format", 60648488) + + internal val getFormatPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamWAV", "get_format", 3151724922) + + internal val setLoopModePtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamWAV", "set_loop_mode", 2444882972) + + internal val getLoopModePtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamWAV", "get_loop_mode", 393560655) + + internal val setLoopBeginPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamWAV", "set_loop_begin", 1286410249) + + internal val getLoopBeginPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamWAV", "get_loop_begin", 3905245786) + + internal val setLoopEndPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamWAV", "set_loop_end", 1286410249) + + internal val getLoopEndPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamWAV", "get_loop_end", 3905245786) + + internal val setMixRatePtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamWAV", "set_mix_rate", 1286410249) + + internal val getMixRatePtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamWAV", "get_mix_rate", 3905245786) + + internal val setStereoPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamWAV", "set_stereo", 2586408642) + + internal val isStereoPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamWAV", "is_stereo", 36873697) + + internal val saveToWavPtr: VoidPtr = + Internals.getMethodBindPtr("AudioStreamWAV", "save_to_wav", 166001499) + } +} diff --git a/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/BackBufferCopy.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/BackBufferCopy.kt new file mode 100644 index 0000000000..bdbee64ee9 --- /dev/null +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/BackBufferCopy.kt @@ -0,0 +1,154 @@ +// THIS FILE IS GENERATED! DO NOT EDIT IT MANUALLY! +@file:Suppress("PackageDirectoryMismatch", "unused", "FunctionName", "RedundantModalityModifier", + "UNCHECKED_CAST", "JoinDeclarationAndAssignment", "USELESS_CAST", + "RemoveRedundantQualifierName", "NOTHING_TO_INLINE", "NON_FINAL_MEMBER_IN_OBJECT", + "RedundantVisibilityModifier", "RedundantUnitReturnType", "MemberVisibilityCanBePrivate") + +package godot + +import godot.`annotation`.CoreTypeHelper +import godot.`annotation`.CoreTypeLocalCopy +import godot.`annotation`.GodotBaseType +import godot.core.Rect2 +import godot.core.VariantParser.LONG +import godot.core.VariantParser.NIL +import godot.core.VariantParser.RECT2 +import godot.util.Internals +import godot.util.VoidPtr +import kotlin.Int +import kotlin.Long +import kotlin.Suppress +import kotlin.Unit +import kotlin.jvm.JvmName + +private const val ENGINE_CLASS_BACKBUFFERCOPY_INDEX: Int = 136 + +/** + * Node for back-buffering the currently-displayed screen. The region defined in the + * [BackBufferCopy] node is buffered with the content of the screen it covers, or the entire screen + * according to the [copyMode]. It can be accessed in shader scripts using the screen texture (i.e. a + * uniform sampler with `hint_screen_texture`). + * **Note:** Since this node inherits from [Node2D] (and not [Control]), anchors and margins won't + * apply to child [Control]-derived nodes. This can be problematic when resizing the window. To avoid + * this, add [Control]-derived nodes as *siblings* to the [BackBufferCopy] node instead of adding them + * as children. + */ +@GodotBaseType +public open class BackBufferCopy : Node2D() { + /** + * Buffer mode. See [CopyMode] constants. + */ + public final inline var copyMode: CopyMode + @JvmName("copyModeProperty") + get() = getCopyMode() + @JvmName("copyModeProperty") + set(`value`) { + setCopyMode(value) + } + + /** + * The area covered by the [BackBufferCopy]. Only used if [copyMode] is [COPY_MODE_RECT]. + */ + @CoreTypeLocalCopy + public final inline var rect: Rect2 + @JvmName("rectProperty") + get() = getRect() + @JvmName("rectProperty") + set(`value`) { + setRect(value) + } + + public override fun new(scriptIndex: Int): Unit { + Internals.callConstructor(this, ENGINE_CLASS_BACKBUFFERCOPY_INDEX, scriptIndex) + } + + /** + * The area covered by the [BackBufferCopy]. Only used if [copyMode] is [COPY_MODE_RECT]. + * + * This is a helper function to make dealing with local copies easier. + * + * For more information, see our + * [documentation](https://godot-kotl.in/en/stable/user-guide/api-differences/#core-types). + * + * Allow to directly modify the local copy of the property and assign it back to the Object. + * + * Prefer that over writing: + * `````` + * val myCoreType = backbuffercopy.rect + * //Your changes + * backbuffercopy.rect = myCoreType + * `````` + */ + @CoreTypeHelper + public final fun rectMutate(block: Rect2.() -> Unit): Rect2 = rect.apply{ + block(this) + rect = this + } + + + public final fun setRect(rect: Rect2): Unit { + Internals.writeArguments(RECT2 to rect) + Internals.callMethod(rawPtr, MethodBindings.setRectPtr, NIL) + } + + public final fun getRect(): Rect2 { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getRectPtr, RECT2) + return (Internals.readReturnValue(RECT2) as Rect2) + } + + public final fun setCopyMode(copyMode: CopyMode): Unit { + Internals.writeArguments(LONG to copyMode.id) + Internals.callMethod(rawPtr, MethodBindings.setCopyModePtr, NIL) + } + + public final fun getCopyMode(): CopyMode { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getCopyModePtr, LONG) + return BackBufferCopy.CopyMode.from(Internals.readReturnValue(LONG) as Long) + } + + public enum class CopyMode( + id: Long, + ) { + /** + * Disables the buffering mode. This means the [BackBufferCopy] node will directly use the + * portion of screen it covers. + */ + COPY_MODE_DISABLED(0), + /** + * [BackBufferCopy] buffers a rectangular region. + */ + COPY_MODE_RECT(1), + /** + * [BackBufferCopy] buffers the entire screen. + */ + COPY_MODE_VIEWPORT(2), + ; + + public val id: Long + init { + this.id = id + } + + public companion object { + public fun from(`value`: Long): CopyMode = entries.single { it.id == `value` } + } + } + + public companion object + + public object MethodBindings { + internal val setRectPtr: VoidPtr = + Internals.getMethodBindPtr("BackBufferCopy", "set_rect", 2046264180) + + internal val getRectPtr: VoidPtr = + Internals.getMethodBindPtr("BackBufferCopy", "get_rect", 1639390495) + + internal val setCopyModePtr: VoidPtr = + Internals.getMethodBindPtr("BackBufferCopy", "set_copy_mode", 1713538590) + + internal val getCopyModePtr: VoidPtr = + Internals.getMethodBindPtr("BackBufferCopy", "get_copy_mode", 3271169440) + } +} diff --git a/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/BaseButton.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/BaseButton.kt new file mode 100644 index 0000000000..9c4d9979bf --- /dev/null +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/BaseButton.kt @@ -0,0 +1,466 @@ +// THIS FILE IS GENERATED! DO NOT EDIT IT MANUALLY! +@file:Suppress("PackageDirectoryMismatch", "unused", "FunctionName", "RedundantModalityModifier", + "UNCHECKED_CAST", "JoinDeclarationAndAssignment", "USELESS_CAST", + "RemoveRedundantQualifierName", "NOTHING_TO_INLINE", "NON_FINAL_MEMBER_IN_OBJECT", + "RedundantVisibilityModifier", "RedundantUnitReturnType", "MemberVisibilityCanBePrivate") + +package godot + +import godot.MouseButtonMaskValue +import godot.`annotation`.GodotBaseType +import godot.core.Signal0 +import godot.core.Signal1 +import godot.core.VariantParser.BOOL +import godot.core.VariantParser.LONG +import godot.core.VariantParser.NIL +import godot.core.VariantParser.OBJECT +import godot.util.Internals +import godot.util.VoidPtr +import kotlin.Boolean +import kotlin.Int +import kotlin.Long +import kotlin.Suppress +import kotlin.Unit +import kotlin.jvm.JvmName + +private const val ENGINE_CLASS_BASEBUTTON_INDEX: Int = 137 + +/** + * [BaseButton] is an abstract base class for GUI buttons. It doesn't display anything by itself. + */ +@GodotBaseType +public open class BaseButton : Control() { + /** + * Emitted when the button is toggled or pressed. This is on [signal button_down] if [actionMode] + * is [ACTION_MODE_BUTTON_PRESS] and on [signal button_up] otherwise. + * If you need to know the button's pressed state (and [toggleMode] is active), use [signal + * toggled] instead. + */ + public val pressed: Signal0 by Signal0 + + /** + * Emitted when the button stops being held down. + */ + public val buttonUp: Signal0 by Signal0 + + /** + * Emitted when the button starts being held down. + */ + public val buttonDown: Signal0 by Signal0 + + /** + * Emitted when the button was just toggled between pressed and normal states (only if + * [toggleMode] is active). The new state is contained in the [toggledOn] argument. + */ + public val toggled: Signal1 by Signal1 + + /** + * If `true`, the button is in disabled state and can't be clicked or toggled. + */ + public final inline var disabled: Boolean + @JvmName("disabledProperty") + get() = isDisabled() + @JvmName("disabledProperty") + set(`value`) { + setDisabled(value) + } + + /** + * If `true`, the button is in toggle mode. Makes the button flip state between pressed and + * unpressed each time its area is clicked. + */ + public final inline var toggleMode: Boolean + @JvmName("toggleModeProperty") + get() = isToggleMode() + @JvmName("toggleModeProperty") + set(`value`) { + setToggleMode(value) + } + + /** + * If `true`, the button's state is pressed. Means the button is pressed down or toggled (if + * [toggleMode] is active). Only works if [toggleMode] is `true`. + * **Note:** Setting [buttonPressed] will result in [signal toggled] to be emitted. If you want to + * change the pressed state without emitting that signal, use [setPressedNoSignal]. + */ + public final inline var buttonPressed: Boolean + @JvmName("buttonPressedProperty") + get() = isPressed() + @JvmName("buttonPressedProperty") + set(`value`) { + setPressed(value) + } + + /** + * Determines when the button is considered clicked, one of the [ActionMode] constants. + */ + public final inline var actionMode: ActionMode + @JvmName("actionModeProperty") + get() = getActionMode() + @JvmName("actionModeProperty") + set(`value`) { + setActionMode(value) + } + + /** + * Binary mask to choose which mouse buttons this button will respond to. + * To allow both left-click and right-click, use `MOUSE_BUTTON_MASK_LEFT | + * MOUSE_BUTTON_MASK_RIGHT`. + */ + public final inline var buttonMask: MouseButtonMask + @JvmName("buttonMaskProperty") + get() = getButtonMask() + @JvmName("buttonMaskProperty") + set(`value`) { + setButtonMask(value) + } + + /** + * If `true`, the button stays pressed when moving the cursor outside the button while pressing + * it. + * **Note:** This property only affects the button's visual appearance. Signals will be emitted at + * the same moment regardless of this property's value. + */ + public final inline var keepPressedOutside: Boolean + @JvmName("keepPressedOutsideProperty") + get() = isKeepPressedOutside() + @JvmName("keepPressedOutsideProperty") + set(`value`) { + setKeepPressedOutside(value) + } + + /** + * The [ButtonGroup] associated with the button. Not to be confused with node groups. + * **Note:** The button will be configured as a radio button if a [ButtonGroup] is assigned to it. + */ + public final inline var buttonGroup: ButtonGroup? + @JvmName("buttonGroupProperty") + get() = getButtonGroup() + @JvmName("buttonGroupProperty") + set(`value`) { + setButtonGroup(value) + } + + /** + * [Shortcut] associated to the button. + */ + public final inline var shortcut: Shortcut? + @JvmName("shortcutProperty") + get() = getShortcut() + @JvmName("shortcutProperty") + set(`value`) { + setShortcut(value) + } + + /** + * If `true`, the button will highlight for a short amount of time when its shortcut is activated. + * If `false` and [toggleMode] is `false`, the shortcut will activate without any visual feedback. + */ + public final inline var shortcutFeedback: Boolean + @JvmName("shortcutFeedbackProperty") + get() = isShortcutFeedback() + @JvmName("shortcutFeedbackProperty") + set(`value`) { + setShortcutFeedback(value) + } + + /** + * If `true`, the button will add information about its shortcut in the tooltip. + */ + public final inline var shortcutInTooltip: Boolean + @JvmName("shortcutInTooltipProperty") + get() = isShortcutInTooltipEnabled() + @JvmName("shortcutInTooltipProperty") + set(`value`) { + setShortcutInTooltip(value) + } + + public override fun new(scriptIndex: Int): Unit { + Internals.callConstructor(this, ENGINE_CLASS_BASEBUTTON_INDEX, scriptIndex) + } + + /** + * Called when the button is pressed. If you need to know the button's pressed state (and + * [toggleMode] is active), use [_toggled] instead. + */ + public open fun _pressed(): Unit { + } + + /** + * Called when the button is toggled (only if [toggleMode] is active). + */ + public open fun _toggled(toggledOn: Boolean): Unit { + } + + public final fun setPressed(pressed: Boolean): Unit { + Internals.writeArguments(BOOL to pressed) + Internals.callMethod(rawPtr, MethodBindings.setPressedPtr, NIL) + } + + public final fun isPressed(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isPressedPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + /** + * Changes the [buttonPressed] state of the button, without emitting [signal toggled]. Use when + * you just want to change the state of the button without sending the pressed event (e.g. when + * initializing scene). Only works if [toggleMode] is `true`. + * **Note:** This method doesn't unpress other buttons in [buttonGroup]. + */ + public final fun setPressedNoSignal(pressed: Boolean): Unit { + Internals.writeArguments(BOOL to pressed) + Internals.callMethod(rawPtr, MethodBindings.setPressedNoSignalPtr, NIL) + } + + /** + * Returns `true` if the mouse has entered the button and has not left it yet. + */ + public final fun isHovered(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isHoveredPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public final fun setToggleMode(enabled: Boolean): Unit { + Internals.writeArguments(BOOL to enabled) + Internals.callMethod(rawPtr, MethodBindings.setToggleModePtr, NIL) + } + + public final fun isToggleMode(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isToggleModePtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public final fun setShortcutInTooltip(enabled: Boolean): Unit { + Internals.writeArguments(BOOL to enabled) + Internals.callMethod(rawPtr, MethodBindings.setShortcutInTooltipPtr, NIL) + } + + public final fun isShortcutInTooltipEnabled(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isShortcutInTooltipEnabledPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public final fun setDisabled(disabled: Boolean): Unit { + Internals.writeArguments(BOOL to disabled) + Internals.callMethod(rawPtr, MethodBindings.setDisabledPtr, NIL) + } + + public final fun isDisabled(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isDisabledPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public final fun setActionMode(mode: ActionMode): Unit { + Internals.writeArguments(LONG to mode.id) + Internals.callMethod(rawPtr, MethodBindings.setActionModePtr, NIL) + } + + public final fun getActionMode(): ActionMode { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getActionModePtr, LONG) + return BaseButton.ActionMode.from(Internals.readReturnValue(LONG) as Long) + } + + public final fun setButtonMask(mask: MouseButtonMask): Unit { + Internals.writeArguments(LONG to mask.flag) + Internals.callMethod(rawPtr, MethodBindings.setButtonMaskPtr, NIL) + } + + public final fun getButtonMask(): MouseButtonMask { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getButtonMaskPtr, LONG) + return MouseButtonMaskValue(Internals.readReturnValue(LONG) as Long) + } + + /** + * Returns the visual state used to draw the button. This is useful mainly when implementing your + * own draw code by either overriding _draw() or connecting to "draw" signal. The visual state of the + * button is defined by the [DrawMode] enum. + */ + public final fun getDrawMode(): DrawMode { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getDrawModePtr, LONG) + return BaseButton.DrawMode.from(Internals.readReturnValue(LONG) as Long) + } + + public final fun setKeepPressedOutside(enabled: Boolean): Unit { + Internals.writeArguments(BOOL to enabled) + Internals.callMethod(rawPtr, MethodBindings.setKeepPressedOutsidePtr, NIL) + } + + public final fun isKeepPressedOutside(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isKeepPressedOutsidePtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public final fun setShortcutFeedback(enabled: Boolean): Unit { + Internals.writeArguments(BOOL to enabled) + Internals.callMethod(rawPtr, MethodBindings.setShortcutFeedbackPtr, NIL) + } + + public final fun isShortcutFeedback(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isShortcutFeedbackPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public final fun setShortcut(shortcut: Shortcut?): Unit { + Internals.writeArguments(OBJECT to shortcut) + Internals.callMethod(rawPtr, MethodBindings.setShortcutPtr, NIL) + } + + public final fun getShortcut(): Shortcut? { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getShortcutPtr, OBJECT) + return (Internals.readReturnValue(OBJECT) as Shortcut?) + } + + public final fun setButtonGroup(buttonGroup: ButtonGroup?): Unit { + Internals.writeArguments(OBJECT to buttonGroup) + Internals.callMethod(rawPtr, MethodBindings.setButtonGroupPtr, NIL) + } + + public final fun getButtonGroup(): ButtonGroup? { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getButtonGroupPtr, OBJECT) + return (Internals.readReturnValue(OBJECT) as ButtonGroup?) + } + + public enum class DrawMode( + id: Long, + ) { + /** + * The normal state (i.e. not pressed, not hovered, not toggled and enabled) of buttons. + */ + DRAW_NORMAL(0), + /** + * The state of buttons are pressed. + */ + DRAW_PRESSED(1), + /** + * The state of buttons are hovered. + */ + DRAW_HOVER(2), + /** + * The state of buttons are disabled. + */ + DRAW_DISABLED(3), + /** + * The state of buttons are both hovered and pressed. + */ + DRAW_HOVER_PRESSED(4), + ; + + public val id: Long + init { + this.id = id + } + + public companion object { + public fun from(`value`: Long): DrawMode = entries.single { it.id == `value` } + } + } + + public enum class ActionMode( + id: Long, + ) { + /** + * Require just a press to consider the button clicked. + */ + ACTION_MODE_BUTTON_PRESS(0), + /** + * Require a press and a subsequent release before considering the button clicked. + */ + ACTION_MODE_BUTTON_RELEASE(1), + ; + + public val id: Long + init { + this.id = id + } + + public companion object { + public fun from(`value`: Long): ActionMode = entries.single { it.id == `value` } + } + } + + public companion object + + public object MethodBindings { + internal val setPressedPtr: VoidPtr = + Internals.getMethodBindPtr("BaseButton", "set_pressed", 2586408642) + + internal val isPressedPtr: VoidPtr = + Internals.getMethodBindPtr("BaseButton", "is_pressed", 36873697) + + internal val setPressedNoSignalPtr: VoidPtr = + Internals.getMethodBindPtr("BaseButton", "set_pressed_no_signal", 2586408642) + + internal val isHoveredPtr: VoidPtr = + Internals.getMethodBindPtr("BaseButton", "is_hovered", 36873697) + + internal val setToggleModePtr: VoidPtr = + Internals.getMethodBindPtr("BaseButton", "set_toggle_mode", 2586408642) + + internal val isToggleModePtr: VoidPtr = + Internals.getMethodBindPtr("BaseButton", "is_toggle_mode", 36873697) + + internal val setShortcutInTooltipPtr: VoidPtr = + Internals.getMethodBindPtr("BaseButton", "set_shortcut_in_tooltip", 2586408642) + + internal val isShortcutInTooltipEnabledPtr: VoidPtr = + Internals.getMethodBindPtr("BaseButton", "is_shortcut_in_tooltip_enabled", 36873697) + + internal val setDisabledPtr: VoidPtr = + Internals.getMethodBindPtr("BaseButton", "set_disabled", 2586408642) + + internal val isDisabledPtr: VoidPtr = + Internals.getMethodBindPtr("BaseButton", "is_disabled", 36873697) + + internal val setActionModePtr: VoidPtr = + Internals.getMethodBindPtr("BaseButton", "set_action_mode", 1985162088) + + internal val getActionModePtr: VoidPtr = + Internals.getMethodBindPtr("BaseButton", "get_action_mode", 2589712189) + + internal val setButtonMaskPtr: VoidPtr = + Internals.getMethodBindPtr("BaseButton", "set_button_mask", 3950145251) + + internal val getButtonMaskPtr: VoidPtr = + Internals.getMethodBindPtr("BaseButton", "get_button_mask", 2512161324) + + internal val getDrawModePtr: VoidPtr = + Internals.getMethodBindPtr("BaseButton", "get_draw_mode", 2492721305) + + internal val setKeepPressedOutsidePtr: VoidPtr = + Internals.getMethodBindPtr("BaseButton", "set_keep_pressed_outside", 2586408642) + + internal val isKeepPressedOutsidePtr: VoidPtr = + Internals.getMethodBindPtr("BaseButton", "is_keep_pressed_outside", 36873697) + + internal val setShortcutFeedbackPtr: VoidPtr = + Internals.getMethodBindPtr("BaseButton", "set_shortcut_feedback", 2586408642) + + internal val isShortcutFeedbackPtr: VoidPtr = + Internals.getMethodBindPtr("BaseButton", "is_shortcut_feedback", 36873697) + + internal val setShortcutPtr: VoidPtr = + Internals.getMethodBindPtr("BaseButton", "set_shortcut", 857163497) + + internal val getShortcutPtr: VoidPtr = + Internals.getMethodBindPtr("BaseButton", "get_shortcut", 3415666916) + + internal val setButtonGroupPtr: VoidPtr = + Internals.getMethodBindPtr("BaseButton", "set_button_group", 1794463739) + + internal val getButtonGroupPtr: VoidPtr = + Internals.getMethodBindPtr("BaseButton", "get_button_group", 281644053) + } +} diff --git a/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/BaseMaterial3D.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/BaseMaterial3D.kt new file mode 100644 index 0000000000..30667a0cd9 --- /dev/null +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/BaseMaterial3D.kt @@ -0,0 +1,3722 @@ +// THIS FILE IS GENERATED! DO NOT EDIT IT MANUALLY! +@file:Suppress("PackageDirectoryMismatch", "unused", "FunctionName", "RedundantModalityModifier", + "UNCHECKED_CAST", "JoinDeclarationAndAssignment", "USELESS_CAST", + "RemoveRedundantQualifierName", "NOTHING_TO_INLINE", "NON_FINAL_MEMBER_IN_OBJECT", + "RedundantVisibilityModifier", "RedundantUnitReturnType", "MemberVisibilityCanBePrivate") + +package godot + +import godot.`annotation`.CoreTypeHelper +import godot.`annotation`.CoreTypeLocalCopy +import godot.`annotation`.GodotBaseType +import godot.core.Color +import godot.core.VariantParser.BOOL +import godot.core.VariantParser.COLOR +import godot.core.VariantParser.DOUBLE +import godot.core.VariantParser.LONG +import godot.core.VariantParser.NIL +import godot.core.VariantParser.OBJECT +import godot.core.VariantParser.VECTOR3 +import godot.core.Vector3 +import godot.util.Internals +import godot.util.VoidPtr +import kotlin.Boolean +import kotlin.Double +import kotlin.Float +import kotlin.Int +import kotlin.Long +import kotlin.Suppress +import kotlin.Unit +import kotlin.jvm.JvmName + +private const val ENGINE_CLASS_BASEMATERIAL3D_INDEX: Int = 138 + +/** + * This class serves as a default material with a wide variety of rendering features and properties + * without the need to write shader code. See the tutorial below for details. + */ +@GodotBaseType +public open class BaseMaterial3D internal constructor() : Material() { + /** + * The material's transparency mode. Some transparency modes will disable shadow casting. Any + * transparency mode other than [TRANSPARENCY_DISABLED] has a greater performance impact compared to + * opaque rendering. See also [blendMode]. + */ + public final inline var transparency: Transparency + @JvmName("transparencyProperty") + get() = getTransparency() + @JvmName("transparencyProperty") + set(`value`) { + setTransparency(value) + } + + /** + * Threshold at which the alpha scissor will discard values. Higher values will result in more + * pixels being discarded. If the material becomes too opaque at a distance, try increasing + * [alphaScissorThreshold]. If the material disappears at a distance, try decreasing + * [alphaScissorThreshold]. + */ + public final inline var alphaScissorThreshold: Float + @JvmName("alphaScissorThresholdProperty") + get() = getAlphaScissorThreshold() + @JvmName("alphaScissorThresholdProperty") + set(`value`) { + setAlphaScissorThreshold(value) + } + + /** + * The hashing scale for Alpha Hash. Recommended values between `0` and `2`. + */ + public final inline var alphaHashScale: Float + @JvmName("alphaHashScaleProperty") + get() = getAlphaHashScale() + @JvmName("alphaHashScaleProperty") + set(`value`) { + setAlphaHashScale(value) + } + + /** + * The type of alpha antialiasing to apply. See [AlphaAntiAliasing]. + */ + public final inline var alphaAntialiasingMode: AlphaAntiAliasing + @JvmName("alphaAntialiasingModeProperty") + get() = getAlphaAntialiasing() + @JvmName("alphaAntialiasingModeProperty") + set(`value`) { + setAlphaAntialiasing(value) + } + + /** + * Threshold at which antialiasing will be applied on the alpha channel. + */ + public final inline var alphaAntialiasingEdge: Float + @JvmName("alphaAntialiasingEdgeProperty") + get() = getAlphaAntialiasingEdge() + @JvmName("alphaAntialiasingEdgeProperty") + set(`value`) { + setAlphaAntialiasingEdge(value) + } + + /** + * The material's blend mode. + * **Note:** Values other than `Mix` force the object into the transparent pipeline. See + * [BlendMode]. + */ + public final inline var blendMode: BlendMode + @JvmName("blendModeProperty") + get() = getBlendMode() + @JvmName("blendModeProperty") + set(`value`) { + setBlendMode(value) + } + + /** + * Determines which side of the triangle to cull depending on whether the triangle faces towards + * or away from the camera. See [CullMode]. + */ + public final inline var cullMode: CullMode + @JvmName("cullModeProperty") + get() = getCullMode() + @JvmName("cullModeProperty") + set(`value`) { + setCullMode(value) + } + + /** + * Determines when depth rendering takes place. See [DepthDrawMode]. See also [transparency]. + */ + public final inline var depthDrawMode: DepthDrawMode + @JvmName("depthDrawModeProperty") + get() = getDepthDrawMode() + @JvmName("depthDrawModeProperty") + set(`value`) { + setDepthDrawMode(value) + } + + /** + * If `true`, depth testing is disabled and the object will be drawn in render order. + */ + public final inline var noDepthTest: Boolean + @JvmName("noDepthTestProperty") + get() = getFlag(BaseMaterial3D.Flags.FLAG_DISABLE_DEPTH_TEST) + @JvmName("noDepthTestProperty") + set(`value`) { + setFlag(BaseMaterial3D.Flags.FLAG_DISABLE_DEPTH_TEST, value) + } + + /** + * Sets whether the shading takes place, per-pixel, per-vertex or unshaded. Per-vertex lighting is + * faster, making it the best choice for mobile applications, however it looks considerably worse + * than per-pixel. Unshaded rendering is the fastest, but disables all interactions with lights. + * **Note:** Setting the shading mode vertex shading currently has no effect, as vertex shading is + * not implemented yet. + */ + public final inline var shadingMode: ShadingMode + @JvmName("shadingModeProperty") + get() = getShadingMode() + @JvmName("shadingModeProperty") + set(`value`) { + setShadingMode(value) + } + + /** + * The algorithm used for diffuse light scattering. See [DiffuseMode]. + */ + public final inline var diffuseMode: DiffuseMode + @JvmName("diffuseModeProperty") + get() = getDiffuseMode() + @JvmName("diffuseModeProperty") + set(`value`) { + setDiffuseMode(value) + } + + /** + * The method for rendering the specular blob. See [SpecularMode]. + * **Note:** [specularMode] only applies to the specular blob. It does not affect specular + * reflections from the sky, screen-space reflections, [VoxelGI], SDFGI or [ReflectionProbe]s. To + * disable reflections from these sources as well, set [metallicSpecular] to `0.0` instead. + */ + public final inline var specularMode: SpecularMode + @JvmName("specularModeProperty") + get() = getSpecularMode() + @JvmName("specularModeProperty") + set(`value`) { + setSpecularMode(value) + } + + /** + * If `true`, the object receives no ambient light. + */ + public final inline var disableAmbientLight: Boolean + @JvmName("disableAmbientLightProperty") + get() = getFlag(BaseMaterial3D.Flags.FLAG_DISABLE_AMBIENT_LIGHT) + @JvmName("disableAmbientLightProperty") + set(`value`) { + setFlag(BaseMaterial3D.Flags.FLAG_DISABLE_AMBIENT_LIGHT, value) + } + + /** + * If `true`, the object will not be affected by fog (neither volumetric nor depth fog). This is + * useful for unshaded or transparent materials (e.g. particles), which without this setting will be + * affected even if fully transparent. + */ + public final inline var disableFog: Boolean + @JvmName("disableFogProperty") + get() = getFlag(BaseMaterial3D.Flags.FLAG_DISABLE_FOG) + @JvmName("disableFogProperty") + set(`value`) { + setFlag(BaseMaterial3D.Flags.FLAG_DISABLE_FOG, value) + } + + /** + * If `true`, the vertex color is used as albedo color. + */ + public final inline var vertexColorUseAsAlbedo: Boolean + @JvmName("vertexColorUseAsAlbedoProperty") + get() = getFlag(BaseMaterial3D.Flags.FLAG_ALBEDO_FROM_VERTEX_COLOR) + @JvmName("vertexColorUseAsAlbedoProperty") + set(`value`) { + setFlag(BaseMaterial3D.Flags.FLAG_ALBEDO_FROM_VERTEX_COLOR, value) + } + + /** + * If `true`, vertex colors are considered to be stored in sRGB color space and are converted to + * linear color space during rendering. If `false`, vertex colors are considered to be stored in + * linear color space and are rendered as-is. See also [albedoTextureForceSrgb]. + * **Note:** Only effective when using the Forward+ and Mobile rendering methods, not + * Compatibility. + */ + public final inline var vertexColorIsSrgb: Boolean + @JvmName("vertexColorIsSrgbProperty") + get() = getFlag(BaseMaterial3D.Flags.FLAG_SRGB_VERTEX_COLOR) + @JvmName("vertexColorIsSrgbProperty") + set(`value`) { + setFlag(BaseMaterial3D.Flags.FLAG_SRGB_VERTEX_COLOR, value) + } + + /** + * The material's base color. + * **Note:** If [detailEnabled] is `true` and a [detailAlbedo] texture is specified, [albedoColor] + * will *not* modulate the detail texture. This can be used to color partial areas of a material by + * not specifying an albedo texture and using a transparent [detailAlbedo] texture instead. + */ + @CoreTypeLocalCopy + public final inline var albedoColor: Color + @JvmName("albedoColorProperty") + get() = getAlbedo() + @JvmName("albedoColorProperty") + set(`value`) { + setAlbedo(value) + } + + /** + * Texture to multiply by [albedoColor]. Used for basic texturing of objects. + * If the texture appears unexpectedly too dark or too bright, check [albedoTextureForceSrgb]. + */ + public final inline var albedoTexture: Texture2D? + @JvmName("albedoTextureProperty") + get() = getTexture(BaseMaterial3D.TextureParam.TEXTURE_ALBEDO) + @JvmName("albedoTextureProperty") + set(`value`) { + setTexture(BaseMaterial3D.TextureParam.TEXTURE_ALBEDO, value) + } + + /** + * If `true`, forces a conversion of the [albedoTexture] from sRGB color space to linear color + * space. See also [vertexColorIsSrgb]. + * This should only be enabled when needed (typically when using a [ViewportTexture] as + * [albedoTexture]). If [albedoTextureForceSrgb] is `true` when it shouldn't be, the texture will + * appear to be too dark. If [albedoTextureForceSrgb] is `false` when it shouldn't be, the texture + * will appear to be too bright. + */ + public final inline var albedoTextureForceSrgb: Boolean + @JvmName("albedoTextureForceSrgbProperty") + get() = getFlag(BaseMaterial3D.Flags.FLAG_ALBEDO_TEXTURE_FORCE_SRGB) + @JvmName("albedoTextureForceSrgbProperty") + set(`value`) { + setFlag(BaseMaterial3D.Flags.FLAG_ALBEDO_TEXTURE_FORCE_SRGB, value) + } + + /** + * Enables multichannel signed distance field rendering shader. Use [msdfPixelRange] and + * [msdfOutlineSize] to configure MSDF parameters. + */ + public final inline var albedoTextureMsdf: Boolean + @JvmName("albedoTextureMsdfProperty") + get() = getFlag(BaseMaterial3D.Flags.FLAG_ALBEDO_TEXTURE_MSDF) + @JvmName("albedoTextureMsdfProperty") + set(`value`) { + setFlag(BaseMaterial3D.Flags.FLAG_ALBEDO_TEXTURE_MSDF, value) + } + + /** + * The Occlusion/Roughness/Metallic texture to use. This is a more efficient replacement of + * [aoTexture], [roughnessTexture] and [metallicTexture] in [ORMMaterial3D]. Ambient occlusion is + * stored in the red channel. Roughness map is stored in the green channel. Metallic map is stored in + * the blue channel. The alpha channel is ignored. + */ + public final inline var ormTexture: Texture2D? + @JvmName("ormTextureProperty") + get() = getTexture(BaseMaterial3D.TextureParam.TEXTURE_ORM) + @JvmName("ormTextureProperty") + set(`value`) { + setTexture(BaseMaterial3D.TextureParam.TEXTURE_ORM, value) + } + + /** + * A high value makes the material appear more like a metal. Non-metals use their albedo as the + * diffuse color and add diffuse to the specular reflection. With non-metals, the reflection appears + * on top of the albedo color. Metals use their albedo as a multiplier to the specular reflection and + * set the diffuse color to black resulting in a tinted reflection. Materials work better when fully + * metal or fully non-metal, values between `0` and `1` should only be used for blending between + * metal and non-metal sections. To alter the amount of reflection use [roughness]. + */ + public final inline var metallic: Float + @JvmName("metallicProperty") + get() = getMetallic() + @JvmName("metallicProperty") + set(`value`) { + setMetallic(value) + } + + /** + * Adjusts the strength of specular reflections. Specular reflections are composed of scene + * reflections and the specular lobe which is the bright spot that is reflected from light sources. + * When set to `0.0`, no specular reflections will be visible. This differs from the + * [SPECULAR_DISABLED] [SpecularMode] as [SPECULAR_DISABLED] only applies to the specular lobe from + * the light source. + * **Note:** Unlike [metallic], this is not energy-conserving, so it should be left at `0.5` in + * most cases. See also [roughness]. + */ + public final inline var metallicSpecular: Float + @JvmName("metallicSpecularProperty") + get() = getSpecular() + @JvmName("metallicSpecularProperty") + set(`value`) { + setSpecular(value) + } + + /** + * Texture used to specify metallic for an object. This is multiplied by [metallic]. + */ + public final inline var metallicTexture: Texture2D? + @JvmName("metallicTextureProperty") + get() = getTexture(BaseMaterial3D.TextureParam.TEXTURE_METALLIC) + @JvmName("metallicTextureProperty") + set(`value`) { + setTexture(BaseMaterial3D.TextureParam.TEXTURE_METALLIC, value) + } + + /** + * Specifies the channel of the [metallicTexture] in which the metallic information is stored. + * This is useful when you store the information for multiple effects in a single texture. For + * example if you stored metallic in the red channel, roughness in the blue, and ambient occlusion in + * the green you could reduce the number of textures you use. + */ + public final inline var metallicTextureChannel: TextureChannel + @JvmName("metallicTextureChannelProperty") + get() = getMetallicTextureChannel() + @JvmName("metallicTextureChannelProperty") + set(`value`) { + setMetallicTextureChannel(value) + } + + /** + * Surface reflection. A value of `0` represents a perfect mirror while a value of `1` completely + * blurs the reflection. See also [metallic]. + */ + public final inline var roughness: Float + @JvmName("roughnessProperty") + get() = getRoughness() + @JvmName("roughnessProperty") + set(`value`) { + setRoughness(value) + } + + /** + * Texture used to control the roughness per-pixel. Multiplied by [roughness]. + */ + public final inline var roughnessTexture: Texture2D? + @JvmName("roughnessTextureProperty") + get() = getTexture(BaseMaterial3D.TextureParam.TEXTURE_ROUGHNESS) + @JvmName("roughnessTextureProperty") + set(`value`) { + setTexture(BaseMaterial3D.TextureParam.TEXTURE_ROUGHNESS, value) + } + + /** + * Specifies the channel of the [roughnessTexture] in which the roughness information is stored. + * This is useful when you store the information for multiple effects in a single texture. For + * example if you stored metallic in the red channel, roughness in the blue, and ambient occlusion in + * the green you could reduce the number of textures you use. + */ + public final inline var roughnessTextureChannel: TextureChannel + @JvmName("roughnessTextureChannelProperty") + get() = getRoughnessTextureChannel() + @JvmName("roughnessTextureChannelProperty") + set(`value`) { + setRoughnessTextureChannel(value) + } + + /** + * If `true`, the body emits light. Emitting light makes the object appear brighter. The object + * can also cast light on other objects if a [VoxelGI], SDFGI, or [LightmapGI] is used and this + * object is used in baked lighting. + */ + public final inline var emissionEnabled: Boolean + @JvmName("emissionEnabledProperty") + get() = getFeature(BaseMaterial3D.Feature.FEATURE_EMISSION) + @JvmName("emissionEnabledProperty") + set(`value`) { + setFeature(BaseMaterial3D.Feature.FEATURE_EMISSION, value) + } + + /** + * The emitted light's color. See [emissionEnabled]. + */ + @CoreTypeLocalCopy + public final inline var emission: Color + @JvmName("emissionProperty") + get() = getEmission() + @JvmName("emissionProperty") + set(`value`) { + setEmission(value) + } + + /** + * Multiplier for emitted light. See [emissionEnabled]. + */ + public final inline var emissionEnergyMultiplier: Float + @JvmName("emissionEnergyMultiplierProperty") + get() = getEmissionEnergyMultiplier() + @JvmName("emissionEnergyMultiplierProperty") + set(`value`) { + setEmissionEnergyMultiplier(value) + } + + /** + * Luminance of emitted light, measured in nits (candela per square meter). Only available when + * [ProjectSettings.rendering/lightsAndShadows/usePhysicalLightUnits] is enabled. The default is + * roughly equivalent to an indoor lightbulb. + */ + public final inline var emissionIntensity: Float + @JvmName("emissionIntensityProperty") + get() = getEmissionIntensity() + @JvmName("emissionIntensityProperty") + set(`value`) { + setEmissionIntensity(value) + } + + /** + * Sets how [emission] interacts with [emissionTexture]. Can either add or multiply. See + * [EmissionOperator] for options. + */ + public final inline var emissionOperator: EmissionOperator + @JvmName("emissionOperatorProperty") + get() = getEmissionOperator() + @JvmName("emissionOperatorProperty") + set(`value`) { + setEmissionOperator(value) + } + + /** + * Use `UV2` to read from the [emissionTexture]. + */ + public final inline var emissionOnUv2: Boolean + @JvmName("emissionOnUv2Property") + get() = getFlag(BaseMaterial3D.Flags.FLAG_EMISSION_ON_UV2) + @JvmName("emissionOnUv2Property") + set(`value`) { + setFlag(BaseMaterial3D.Flags.FLAG_EMISSION_ON_UV2, value) + } + + /** + * Texture that specifies how much surface emits light at a given point. + */ + public final inline var emissionTexture: Texture2D? + @JvmName("emissionTextureProperty") + get() = getTexture(BaseMaterial3D.TextureParam.TEXTURE_EMISSION) + @JvmName("emissionTextureProperty") + set(`value`) { + setTexture(BaseMaterial3D.TextureParam.TEXTURE_EMISSION, value) + } + + /** + * If `true`, normal mapping is enabled. This has a slight performance cost, especially on mobile + * GPUs. + */ + public final inline var normalEnabled: Boolean + @JvmName("normalEnabledProperty") + get() = getFeature(BaseMaterial3D.Feature.FEATURE_NORMAL_MAPPING) + @JvmName("normalEnabledProperty") + set(`value`) { + setFeature(BaseMaterial3D.Feature.FEATURE_NORMAL_MAPPING, value) + } + + /** + * The strength of the normal map's effect. + */ + public final inline var normalScale: Float + @JvmName("normalScaleProperty") + get() = getNormalScale() + @JvmName("normalScaleProperty") + set(`value`) { + setNormalScale(value) + } + + /** + * Texture used to specify the normal at a given pixel. The [normalTexture] only uses the red and + * green channels; the blue and alpha channels are ignored. The normal read from [normalTexture] is + * oriented around the surface normal provided by the [Mesh]. + * **Note:** The mesh must have both normals and tangents defined in its vertex data. Otherwise, + * the normal map won't render correctly and will only appear to darken the whole surface. If + * creating geometry with [SurfaceTool], you can use [SurfaceTool.generateNormals] and + * [SurfaceTool.generateTangents] to automatically generate normals and tangents respectively. + * **Note:** Godot expects the normal map to use X+, Y+, and Z+ coordinates. See + * [url=http://wiki.polycount.com/wiki/Normal_Map_Technical_Details#Common_Swizzle_Coordinates]this + * page[/url] for a comparison of normal map coordinates expected by popular engines. + * **Note:** If [detailEnabled] is `true`, the [detailAlbedo] texture is drawn *below* the + * [normalTexture]. To display a normal map *above* the [detailAlbedo] texture, use [detailNormal] + * instead. + */ + public final inline var normalTexture: Texture2D? + @JvmName("normalTextureProperty") + get() = getTexture(BaseMaterial3D.TextureParam.TEXTURE_NORMAL) + @JvmName("normalTextureProperty") + set(`value`) { + setTexture(BaseMaterial3D.TextureParam.TEXTURE_NORMAL, value) + } + + /** + * If `true`, rim effect is enabled. Rim lighting increases the brightness at glancing angles on + * an object. + * **Note:** Rim lighting is not visible if the material's [shadingMode] is + * [SHADING_MODE_UNSHADED]. + */ + public final inline var rimEnabled: Boolean + @JvmName("rimEnabledProperty") + get() = getFeature(BaseMaterial3D.Feature.FEATURE_RIM) + @JvmName("rimEnabledProperty") + set(`value`) { + setFeature(BaseMaterial3D.Feature.FEATURE_RIM, value) + } + + /** + * Sets the strength of the rim lighting effect. + */ + public final inline var rim: Float + @JvmName("rimProperty") + get() = getRim() + @JvmName("rimProperty") + set(`value`) { + setRim(value) + } + + /** + * The amount of to blend light and albedo color when rendering rim effect. If `0` the light color + * is used, while `1` means albedo color is used. An intermediate value generally works best. + */ + public final inline var rimTint: Float + @JvmName("rimTintProperty") + get() = getRimTint() + @JvmName("rimTintProperty") + set(`value`) { + setRimTint(value) + } + + /** + * Texture used to set the strength of the rim lighting effect per-pixel. Multiplied by [rim]. + */ + public final inline var rimTexture: Texture2D? + @JvmName("rimTextureProperty") + get() = getTexture(BaseMaterial3D.TextureParam.TEXTURE_RIM) + @JvmName("rimTextureProperty") + set(`value`) { + setTexture(BaseMaterial3D.TextureParam.TEXTURE_RIM, value) + } + + /** + * If `true`, clearcoat rendering is enabled. Adds a secondary transparent pass to the lighting + * calculation resulting in an added specular blob. This makes materials appear as if they have a + * clear layer on them that can be either glossy or rough. + * **Note:** Clearcoat rendering is not visible if the material's [shadingMode] is + * [SHADING_MODE_UNSHADED]. + */ + public final inline var clearcoatEnabled: Boolean + @JvmName("clearcoatEnabledProperty") + get() = getFeature(BaseMaterial3D.Feature.FEATURE_CLEARCOAT) + @JvmName("clearcoatEnabledProperty") + set(`value`) { + setFeature(BaseMaterial3D.Feature.FEATURE_CLEARCOAT, value) + } + + /** + * Sets the strength of the clearcoat effect. Setting to `0` looks the same as disabling the + * clearcoat effect. + */ + public final inline var clearcoat: Float + @JvmName("clearcoatProperty") + get() = getClearcoat() + @JvmName("clearcoatProperty") + set(`value`) { + setClearcoat(value) + } + + /** + * Sets the roughness of the clearcoat pass. A higher value results in a rougher clearcoat while a + * lower value results in a smoother clearcoat. + */ + public final inline var clearcoatRoughness: Float + @JvmName("clearcoatRoughnessProperty") + get() = getClearcoatRoughness() + @JvmName("clearcoatRoughnessProperty") + set(`value`) { + setClearcoatRoughness(value) + } + + /** + * Texture that defines the strength of the clearcoat effect and the glossiness of the clearcoat. + * Strength is specified in the red channel while glossiness is specified in the green channel. + */ + public final inline var clearcoatTexture: Texture2D? + @JvmName("clearcoatTextureProperty") + get() = getTexture(BaseMaterial3D.TextureParam.TEXTURE_CLEARCOAT) + @JvmName("clearcoatTextureProperty") + set(`value`) { + setTexture(BaseMaterial3D.TextureParam.TEXTURE_CLEARCOAT, value) + } + + /** + * If `true`, anisotropy is enabled. Anisotropy changes the shape of the specular blob and aligns + * it to tangent space. This is useful for brushed aluminium and hair reflections. + * **Note:** Mesh tangents are needed for anisotropy to work. If the mesh does not contain + * tangents, the anisotropy effect will appear broken. + * **Note:** Material anisotropy should not to be confused with anisotropic texture filtering, + * which can be enabled by setting [textureFilter] to + * [TEXTURE_FILTER_LINEAR_WITH_MIPMAPS_ANISOTROPIC]. + */ + public final inline var anisotropyEnabled: Boolean + @JvmName("anisotropyEnabledProperty") + get() = getFeature(BaseMaterial3D.Feature.FEATURE_ANISOTROPY) + @JvmName("anisotropyEnabledProperty") + set(`value`) { + setFeature(BaseMaterial3D.Feature.FEATURE_ANISOTROPY, value) + } + + /** + * The strength of the anisotropy effect. This is multiplied by [anisotropyFlowmap]'s alpha + * channel if a texture is defined there and the texture contains an alpha channel. + */ + public final inline var anisotropy: Float + @JvmName("anisotropyProperty") + get() = getAnisotropy() + @JvmName("anisotropyProperty") + set(`value`) { + setAnisotropy(value) + } + + /** + * Texture that offsets the tangent map for anisotropy calculations and optionally controls the + * anisotropy effect (if an alpha channel is present). The flowmap texture is expected to be a + * derivative map, with the red channel representing distortion on the X axis and green channel + * representing distortion on the Y axis. Values below 0.5 will result in negative distortion, + * whereas values above 0.5 will result in positive distortion. + * If present, the texture's alpha channel will be used to multiply the strength of the + * [anisotropy] effect. Fully opaque pixels will keep the anisotropy effect's original strength while + * fully transparent pixels will disable the anisotropy effect entirely. The flowmap texture's blue + * channel is ignored. + */ + public final inline var anisotropyFlowmap: Texture2D? + @JvmName("anisotropyFlowmapProperty") + get() = getTexture(BaseMaterial3D.TextureParam.TEXTURE_FLOWMAP) + @JvmName("anisotropyFlowmapProperty") + set(`value`) { + setTexture(BaseMaterial3D.TextureParam.TEXTURE_FLOWMAP, value) + } + + /** + * If `true`, ambient occlusion is enabled. Ambient occlusion darkens areas based on the + * [aoTexture]. + */ + public final inline var aoEnabled: Boolean + @JvmName("aoEnabledProperty") + get() = getFeature(BaseMaterial3D.Feature.FEATURE_AMBIENT_OCCLUSION) + @JvmName("aoEnabledProperty") + set(`value`) { + setFeature(BaseMaterial3D.Feature.FEATURE_AMBIENT_OCCLUSION, value) + } + + /** + * Amount that ambient occlusion affects lighting from lights. If `0`, ambient occlusion only + * affects ambient light. If `1`, ambient occlusion affects lights just as much as it affects ambient + * light. This can be used to impact the strength of the ambient occlusion effect, but typically + * looks unrealistic. + */ + public final inline var aoLightAffect: Float + @JvmName("aoLightAffectProperty") + get() = getAoLightAffect() + @JvmName("aoLightAffectProperty") + set(`value`) { + setAoLightAffect(value) + } + + /** + * Texture that defines the amount of ambient occlusion for a given point on the object. + */ + public final inline var aoTexture: Texture2D? + @JvmName("aoTextureProperty") + get() = getTexture(BaseMaterial3D.TextureParam.TEXTURE_AMBIENT_OCCLUSION) + @JvmName("aoTextureProperty") + set(`value`) { + setTexture(BaseMaterial3D.TextureParam.TEXTURE_AMBIENT_OCCLUSION, value) + } + + /** + * If `true`, use `UV2` coordinates to look up from the [aoTexture]. + */ + public final inline var aoOnUv2: Boolean + @JvmName("aoOnUv2Property") + get() = getFlag(BaseMaterial3D.Flags.FLAG_AO_ON_UV2) + @JvmName("aoOnUv2Property") + set(`value`) { + setFlag(BaseMaterial3D.Flags.FLAG_AO_ON_UV2, value) + } + + /** + * Specifies the channel of the [aoTexture] in which the ambient occlusion information is stored. + * This is useful when you store the information for multiple effects in a single texture. For + * example if you stored metallic in the red channel, roughness in the blue, and ambient occlusion in + * the green you could reduce the number of textures you use. + */ + public final inline var aoTextureChannel: TextureChannel + @JvmName("aoTextureChannelProperty") + get() = getAoTextureChannel() + @JvmName("aoTextureChannelProperty") + set(`value`) { + setAoTextureChannel(value) + } + + /** + * If `true`, height mapping is enabled (also called "parallax mapping" or "depth mapping"). See + * also [normalEnabled]. Height mapping is a demanding feature on the GPU, so it should only be used + * on materials where it makes a significant visual difference. + * **Note:** Height mapping is not supported if triplanar mapping is used on the same material. + * The value of [heightmapEnabled] will be ignored if [uv1Triplanar] is enabled. + */ + public final inline var heightmapEnabled: Boolean + @JvmName("heightmapEnabledProperty") + get() = getFeature(BaseMaterial3D.Feature.FEATURE_HEIGHT_MAPPING) + @JvmName("heightmapEnabledProperty") + set(`value`) { + setFeature(BaseMaterial3D.Feature.FEATURE_HEIGHT_MAPPING, value) + } + + /** + * The heightmap scale to use for the parallax effect (see [heightmapEnabled]). The default value + * is tuned so that the highest point (value = 255) appears to be 5 cm higher than the lowest point + * (value = 0). Higher values result in a deeper appearance, but may result in artifacts appearing + * when looking at the material from oblique angles, especially when the camera moves. Negative + * values can be used to invert the parallax effect, but this is different from inverting the texture + * using [heightmapFlipTexture] as the material will also appear to be "closer" to the camera. In + * most cases, [heightmapScale] should be kept to a positive value. + * **Note:** If the height map effect looks strange regardless of this value, try adjusting + * [heightmapFlipBinormal] and [heightmapFlipTangent]. See also [heightmapTexture] for + * recommendations on authoring heightmap textures, as the way the heightmap texture is authored + * affects how [heightmapScale] behaves. + */ + public final inline var heightmapScale: Float + @JvmName("heightmapScaleProperty") + get() = getHeightmapScale() + @JvmName("heightmapScaleProperty") + set(`value`) { + setHeightmapScale(value) + } + + /** + * If `true`, uses parallax occlusion mapping to represent depth in the material instead of simple + * offset mapping (see [heightmapEnabled]). This results in a more convincing depth effect, but is + * much more expensive on the GPU. Only enable this on materials where it makes a significant visual + * difference. + */ + public final inline var heightmapDeepParallax: Boolean + @JvmName("heightmapDeepParallaxProperty") + get() = isHeightmapDeepParallaxEnabled() + @JvmName("heightmapDeepParallaxProperty") + set(`value`) { + setHeightmapDeepParallax(value) + } + + /** + * The number of layers to use for parallax occlusion mapping when the camera is far away from the + * material. Higher values result in a more convincing depth effect, especially in materials that + * have steep height changes. Higher values have a significant cost on the GPU, so it should only be + * increased on materials where it makes a significant visual difference. + * **Note:** Only effective if [heightmapDeepParallax] is `true`. + */ + public final inline var heightmapMinLayers: Int + @JvmName("heightmapMinLayersProperty") + get() = getHeightmapDeepParallaxMinLayers() + @JvmName("heightmapMinLayersProperty") + set(`value`) { + setHeightmapDeepParallaxMinLayers(value) + } + + /** + * The number of layers to use for parallax occlusion mapping when the camera is up close to the + * material. Higher values result in a more convincing depth effect, especially in materials that + * have steep height changes. Higher values have a significant cost on the GPU, so it should only be + * increased on materials where it makes a significant visual difference. + * **Note:** Only effective if [heightmapDeepParallax] is `true`. + */ + public final inline var heightmapMaxLayers: Int + @JvmName("heightmapMaxLayersProperty") + get() = getHeightmapDeepParallaxMaxLayers() + @JvmName("heightmapMaxLayersProperty") + set(`value`) { + setHeightmapDeepParallaxMaxLayers(value) + } + + /** + * If `true`, flips the mesh's tangent vectors when interpreting the height map. If the heightmap + * effect looks strange when the camera moves (even with a reasonable [heightmapScale]), try setting + * this to `true`. + */ + public final inline var heightmapFlipTangent: Boolean + @JvmName("heightmapFlipTangentProperty") + get() = getHeightmapDeepParallaxFlipTangent() + @JvmName("heightmapFlipTangentProperty") + set(`value`) { + setHeightmapDeepParallaxFlipTangent(value) + } + + /** + * If `true`, flips the mesh's binormal vectors when interpreting the height map. If the heightmap + * effect looks strange when the camera moves (even with a reasonable [heightmapScale]), try setting + * this to `true`. + */ + public final inline var heightmapFlipBinormal: Boolean + @JvmName("heightmapFlipBinormalProperty") + get() = getHeightmapDeepParallaxFlipBinormal() + @JvmName("heightmapFlipBinormalProperty") + set(`value`) { + setHeightmapDeepParallaxFlipBinormal(value) + } + + /** + * The texture to use as a height map. See also [heightmapEnabled]. + * For best results, the texture should be normalized (with [heightmapScale] reduced to + * compensate). In [url=https://gimp.org]GIMP[/url], this can be done using **Colors > Auto > + * Equalize**. If the texture only uses a small part of its available range, the parallax effect may + * look strange, especially when the camera moves. + * **Note:** To reduce memory usage and improve loading times, you may be able to use a + * lower-resolution heightmap texture as most heightmaps are only comprised of low-frequency data. + */ + public final inline var heightmapTexture: Texture2D? + @JvmName("heightmapTextureProperty") + get() = getTexture(BaseMaterial3D.TextureParam.TEXTURE_HEIGHTMAP) + @JvmName("heightmapTextureProperty") + set(`value`) { + setTexture(BaseMaterial3D.TextureParam.TEXTURE_HEIGHTMAP, value) + } + + /** + * If `true`, interprets the height map texture as a depth map, with brighter values appearing to + * be "lower" in altitude compared to darker values. + * This can be enabled for compatibility with some materials authored for Godot 3.x. This is not + * necessary if the Invert import option was used to invert the depth map in Godot 3.x, in which case + * [heightmapFlipTexture] should remain `false`. + */ + public final inline var heightmapFlipTexture: Boolean + @JvmName("heightmapFlipTextureProperty") + get() = getFlag(BaseMaterial3D.Flags.FLAG_INVERT_HEIGHTMAP) + @JvmName("heightmapFlipTextureProperty") + set(`value`) { + setFlag(BaseMaterial3D.Flags.FLAG_INVERT_HEIGHTMAP, value) + } + + /** + * If `true`, subsurface scattering is enabled. Emulates light that penetrates an object's + * surface, is scattered, and then emerges. Subsurface scattering quality is controlled by + * [ProjectSettings.rendering/environment/subsurfaceScattering/subsurfaceScatteringQuality]. + */ + public final inline var subsurfScatterEnabled: Boolean + @JvmName("subsurfScatterEnabledProperty") + get() = getFeature(BaseMaterial3D.Feature.FEATURE_SUBSURFACE_SCATTERING) + @JvmName("subsurfScatterEnabledProperty") + set(`value`) { + setFeature(BaseMaterial3D.Feature.FEATURE_SUBSURFACE_SCATTERING, value) + } + + /** + * The strength of the subsurface scattering effect. The depth of the effect is also controlled by + * [ProjectSettings.rendering/environment/subsurfaceScattering/subsurfaceScatteringScale], which is + * set globally. + */ + public final inline var subsurfScatterStrength: Float + @JvmName("subsurfScatterStrengthProperty") + get() = getSubsurfaceScatteringStrength() + @JvmName("subsurfScatterStrengthProperty") + set(`value`) { + setSubsurfaceScatteringStrength(value) + } + + /** + * If `true`, subsurface scattering will use a special mode optimized for the color and density of + * human skin, such as boosting the intensity of the red channel in subsurface scattering. + */ + public final inline var subsurfScatterSkinMode: Boolean + @JvmName("subsurfScatterSkinModeProperty") + get() = getFlag(BaseMaterial3D.Flags.FLAG_SUBSURFACE_MODE_SKIN) + @JvmName("subsurfScatterSkinModeProperty") + set(`value`) { + setFlag(BaseMaterial3D.Flags.FLAG_SUBSURFACE_MODE_SKIN, value) + } + + /** + * Texture used to control the subsurface scattering strength. Stored in the red texture channel. + * Multiplied by [subsurfScatterStrength]. + */ + public final inline var subsurfScatterTexture: Texture2D? + @JvmName("subsurfScatterTextureProperty") + get() = getTexture(BaseMaterial3D.TextureParam.TEXTURE_SUBSURFACE_SCATTERING) + @JvmName("subsurfScatterTextureProperty") + set(`value`) { + setTexture(BaseMaterial3D.TextureParam.TEXTURE_SUBSURFACE_SCATTERING, value) + } + + /** + * If `true`, enables subsurface scattering transmittance. Only effective if + * [subsurfScatterEnabled] is `true`. See also [backlightEnabled]. + */ + public final inline var subsurfScatterTransmittanceEnabled: Boolean + @JvmName("subsurfScatterTransmittanceEnabledProperty") + get() = getFeature(BaseMaterial3D.Feature.FEATURE_SUBSURFACE_TRANSMITTANCE) + @JvmName("subsurfScatterTransmittanceEnabledProperty") + set(`value`) { + setFeature(BaseMaterial3D.Feature.FEATURE_SUBSURFACE_TRANSMITTANCE, value) + } + + /** + * The color to multiply the subsurface scattering transmittance effect with. Ignored if + * [subsurfScatterSkinMode] is `true`. + */ + @CoreTypeLocalCopy + public final inline var subsurfScatterTransmittanceColor: Color + @JvmName("subsurfScatterTransmittanceColorProperty") + get() = getTransmittanceColor() + @JvmName("subsurfScatterTransmittanceColorProperty") + set(`value`) { + setTransmittanceColor(value) + } + + /** + * The texture to use for multiplying the intensity of the subsurface scattering transmittance + * intensity. See also [subsurfScatterTexture]. Ignored if [subsurfScatterSkinMode] is `true`. + */ + public final inline var subsurfScatterTransmittanceTexture: Texture2D? + @JvmName("subsurfScatterTransmittanceTextureProperty") + get() = getTexture(BaseMaterial3D.TextureParam.TEXTURE_SUBSURFACE_TRANSMITTANCE) + @JvmName("subsurfScatterTransmittanceTextureProperty") + set(`value`) { + setTexture(BaseMaterial3D.TextureParam.TEXTURE_SUBSURFACE_TRANSMITTANCE, value) + } + + /** + * The depth of the subsurface scattering transmittance effect. + */ + public final inline var subsurfScatterTransmittanceDepth: Float + @JvmName("subsurfScatterTransmittanceDepthProperty") + get() = getTransmittanceDepth() + @JvmName("subsurfScatterTransmittanceDepthProperty") + set(`value`) { + setTransmittanceDepth(value) + } + + /** + * The intensity of the subsurface scattering transmittance effect. + */ + public final inline var subsurfScatterTransmittanceBoost: Float + @JvmName("subsurfScatterTransmittanceBoostProperty") + get() = getTransmittanceBoost() + @JvmName("subsurfScatterTransmittanceBoostProperty") + set(`value`) { + setTransmittanceBoost(value) + } + + /** + * If `true`, the backlight effect is enabled. See also [subsurfScatterTransmittanceEnabled]. + */ + public final inline var backlightEnabled: Boolean + @JvmName("backlightEnabledProperty") + get() = getFeature(BaseMaterial3D.Feature.FEATURE_BACKLIGHT) + @JvmName("backlightEnabledProperty") + set(`value`) { + setFeature(BaseMaterial3D.Feature.FEATURE_BACKLIGHT, value) + } + + /** + * The color used by the backlight effect. Represents the light passing through an object. + */ + @CoreTypeLocalCopy + public final inline var backlight: Color + @JvmName("backlightProperty") + get() = getBacklight() + @JvmName("backlightProperty") + set(`value`) { + setBacklight(value) + } + + /** + * Texture used to control the backlight effect per-pixel. Added to [backlight]. + */ + public final inline var backlightTexture: Texture2D? + @JvmName("backlightTextureProperty") + get() = getTexture(BaseMaterial3D.TextureParam.TEXTURE_BACKLIGHT) + @JvmName("backlightTextureProperty") + set(`value`) { + setTexture(BaseMaterial3D.TextureParam.TEXTURE_BACKLIGHT, value) + } + + /** + * If `true`, the refraction effect is enabled. Distorts transparency based on light from behind + * the object. + */ + public final inline var refractionEnabled: Boolean + @JvmName("refractionEnabledProperty") + get() = getFeature(BaseMaterial3D.Feature.FEATURE_REFRACTION) + @JvmName("refractionEnabledProperty") + set(`value`) { + setFeature(BaseMaterial3D.Feature.FEATURE_REFRACTION, value) + } + + /** + * The strength of the refraction effect. + */ + public final inline var refractionScale: Float + @JvmName("refractionScaleProperty") + get() = getRefraction() + @JvmName("refractionScaleProperty") + set(`value`) { + setRefraction(value) + } + + /** + * Texture that controls the strength of the refraction per-pixel. Multiplied by + * [refractionScale]. + */ + public final inline var refractionTexture: Texture2D? + @JvmName("refractionTextureProperty") + get() = getTexture(BaseMaterial3D.TextureParam.TEXTURE_REFRACTION) + @JvmName("refractionTextureProperty") + set(`value`) { + setTexture(BaseMaterial3D.TextureParam.TEXTURE_REFRACTION, value) + } + + /** + * Specifies the channel of the [refractionTexture] in which the refraction information is stored. + * This is useful when you store the information for multiple effects in a single texture. For + * example if you stored refraction in the red channel, roughness in the blue, and ambient occlusion + * in the green you could reduce the number of textures you use. + */ + public final inline var refractionTextureChannel: TextureChannel + @JvmName("refractionTextureChannelProperty") + get() = getRefractionTextureChannel() + @JvmName("refractionTextureChannelProperty") + set(`value`) { + setRefractionTextureChannel(value) + } + + /** + * If `true`, enables the detail overlay. Detail is a second texture that gets mixed over the + * surface of the object based on [detailMask] and [detailAlbedo]'s alpha channel. This can be used + * to add variation to objects, or to blend between two different albedo/normal textures. + */ + public final inline var detailEnabled: Boolean + @JvmName("detailEnabledProperty") + get() = getFeature(BaseMaterial3D.Feature.FEATURE_DETAIL) + @JvmName("detailEnabledProperty") + set(`value`) { + setFeature(BaseMaterial3D.Feature.FEATURE_DETAIL, value) + } + + /** + * Texture used to specify how the detail textures get blended with the base textures. + * [detailMask] can be used together with [detailAlbedo]'s alpha channel (if any). + */ + public final inline var detailMask: Texture2D? + @JvmName("detailMaskProperty") + get() = getTexture(BaseMaterial3D.TextureParam.TEXTURE_DETAIL_MASK) + @JvmName("detailMaskProperty") + set(`value`) { + setTexture(BaseMaterial3D.TextureParam.TEXTURE_DETAIL_MASK, value) + } + + /** + * Specifies how the [detailAlbedo] should blend with the current `ALBEDO`. See [BlendMode] for + * options. + */ + public final inline var detailBlendMode: BlendMode + @JvmName("detailBlendModeProperty") + get() = getDetailBlendMode() + @JvmName("detailBlendModeProperty") + set(`value`) { + setDetailBlendMode(value) + } + + /** + * Specifies whether to use `UV` or `UV2` for the detail layer. See [DetailUV] for options. + */ + public final inline var detailUvLayer: DetailUV + @JvmName("detailUvLayerProperty") + get() = getDetailUv() + @JvmName("detailUvLayerProperty") + set(`value`) { + setDetailUv(value) + } + + /** + * Texture that specifies the color of the detail overlay. [detailAlbedo]'s alpha channel is used + * as a mask, even when the material is opaque. To use a dedicated texture as a mask, see + * [detailMask]. + * **Note:** [detailAlbedo] is *not* modulated by [albedoColor]. + */ + public final inline var detailAlbedo: Texture2D? + @JvmName("detailAlbedoProperty") + get() = getTexture(BaseMaterial3D.TextureParam.TEXTURE_DETAIL_ALBEDO) + @JvmName("detailAlbedoProperty") + set(`value`) { + setTexture(BaseMaterial3D.TextureParam.TEXTURE_DETAIL_ALBEDO, value) + } + + /** + * Texture that specifies the per-pixel normal of the detail overlay. The [detailNormal] texture + * only uses the red and green channels; the blue and alpha channels are ignored. The normal read + * from [detailNormal] is oriented around the surface normal provided by the [Mesh]. + * **Note:** Godot expects the normal map to use X+, Y+, and Z+ coordinates. See + * [url=http://wiki.polycount.com/wiki/Normal_Map_Technical_Details#Common_Swizzle_Coordinates]this + * page[/url] for a comparison of normal map coordinates expected by popular engines. + */ + public final inline var detailNormal: Texture2D? + @JvmName("detailNormalProperty") + get() = getTexture(BaseMaterial3D.TextureParam.TEXTURE_DETAIL_NORMAL) + @JvmName("detailNormalProperty") + set(`value`) { + setTexture(BaseMaterial3D.TextureParam.TEXTURE_DETAIL_NORMAL, value) + } + + /** + * How much to scale the `UV` coordinates. This is multiplied by `UV` in the vertex function. The + * Z component is used when [uv1Triplanar] is enabled, but it is not used anywhere else. + */ + @CoreTypeLocalCopy + public final inline var uv1Scale: Vector3 + @JvmName("uv1ScaleProperty") + get() = getUv1Scale() + @JvmName("uv1ScaleProperty") + set(`value`) { + setUv1Scale(value) + } + + /** + * How much to offset the `UV` coordinates. This amount will be added to `UV` in the vertex + * function. This can be used to offset a texture. The Z component is used when [uv1Triplanar] is + * enabled, but it is not used anywhere else. + */ + @CoreTypeLocalCopy + public final inline var uv1Offset: Vector3 + @JvmName("uv1OffsetProperty") + get() = getUv1Offset() + @JvmName("uv1OffsetProperty") + set(`value`) { + setUv1Offset(value) + } + + /** + * If `true`, instead of using `UV` textures will use a triplanar texture lookup to determine how + * to apply textures. Triplanar uses the orientation of the object's surface to blend between texture + * coordinates. It reads from the source texture 3 times, once for each axis and then blends between + * the results based on how closely the pixel aligns with each axis. This is often used for natural + * features to get a realistic blend of materials. Because triplanar texturing requires many more + * texture reads per-pixel it is much slower than normal UV texturing. Additionally, because it is + * blending the texture between the three axes, it is unsuitable when you are trying to achieve crisp + * texturing. + */ + public final inline var uv1Triplanar: Boolean + @JvmName("uv1TriplanarProperty") + get() = getFlag(BaseMaterial3D.Flags.FLAG_UV1_USE_TRIPLANAR) + @JvmName("uv1TriplanarProperty") + set(`value`) { + setFlag(BaseMaterial3D.Flags.FLAG_UV1_USE_TRIPLANAR, value) + } + + /** + * A lower number blends the texture more softly while a higher number blends the texture more + * sharply. + * **Note:** [uv1TriplanarSharpness] is clamped between `0.0` and `150.0` (inclusive) as values + * outside that range can look broken depending on the mesh. + */ + public final inline var uv1TriplanarSharpness: Float + @JvmName("uv1TriplanarSharpnessProperty") + get() = getUv1TriplanarBlendSharpness() + @JvmName("uv1TriplanarSharpnessProperty") + set(`value`) { + setUv1TriplanarBlendSharpness(value) + } + + /** + * If `true`, triplanar mapping for `UV` is calculated in world space rather than object local + * space. See also [uv1Triplanar]. + */ + public final inline var uv1WorldTriplanar: Boolean + @JvmName("uv1WorldTriplanarProperty") + get() = getFlag(BaseMaterial3D.Flags.FLAG_UV1_USE_WORLD_TRIPLANAR) + @JvmName("uv1WorldTriplanarProperty") + set(`value`) { + setFlag(BaseMaterial3D.Flags.FLAG_UV1_USE_WORLD_TRIPLANAR, value) + } + + /** + * How much to scale the `UV2` coordinates. This is multiplied by `UV2` in the vertex function. + * The Z component is used when [uv2Triplanar] is enabled, but it is not used anywhere else. + */ + @CoreTypeLocalCopy + public final inline var uv2Scale: Vector3 + @JvmName("uv2ScaleProperty") + get() = getUv2Scale() + @JvmName("uv2ScaleProperty") + set(`value`) { + setUv2Scale(value) + } + + /** + * How much to offset the `UV2` coordinates. This amount will be added to `UV2` in the vertex + * function. This can be used to offset a texture. The Z component is used when [uv2Triplanar] is + * enabled, but it is not used anywhere else. + */ + @CoreTypeLocalCopy + public final inline var uv2Offset: Vector3 + @JvmName("uv2OffsetProperty") + get() = getUv2Offset() + @JvmName("uv2OffsetProperty") + set(`value`) { + setUv2Offset(value) + } + + /** + * If `true`, instead of using `UV2` textures will use a triplanar texture lookup to determine how + * to apply textures. Triplanar uses the orientation of the object's surface to blend between texture + * coordinates. It reads from the source texture 3 times, once for each axis and then blends between + * the results based on how closely the pixel aligns with each axis. This is often used for natural + * features to get a realistic blend of materials. Because triplanar texturing requires many more + * texture reads per-pixel it is much slower than normal UV texturing. Additionally, because it is + * blending the texture between the three axes, it is unsuitable when you are trying to achieve crisp + * texturing. + */ + public final inline var uv2Triplanar: Boolean + @JvmName("uv2TriplanarProperty") + get() = getFlag(BaseMaterial3D.Flags.FLAG_UV2_USE_TRIPLANAR) + @JvmName("uv2TriplanarProperty") + set(`value`) { + setFlag(BaseMaterial3D.Flags.FLAG_UV2_USE_TRIPLANAR, value) + } + + /** + * A lower number blends the texture more softly while a higher number blends the texture more + * sharply. + * **Note:** [uv2TriplanarSharpness] is clamped between `0.0` and `150.0` (inclusive) as values + * outside that range can look broken depending on the mesh. + */ + public final inline var uv2TriplanarSharpness: Float + @JvmName("uv2TriplanarSharpnessProperty") + get() = getUv2TriplanarBlendSharpness() + @JvmName("uv2TriplanarSharpnessProperty") + set(`value`) { + setUv2TriplanarBlendSharpness(value) + } + + /** + * If `true`, triplanar mapping for `UV2` is calculated in world space rather than object local + * space. See also [uv2Triplanar]. + */ + public final inline var uv2WorldTriplanar: Boolean + @JvmName("uv2WorldTriplanarProperty") + get() = getFlag(BaseMaterial3D.Flags.FLAG_UV2_USE_WORLD_TRIPLANAR) + @JvmName("uv2WorldTriplanarProperty") + set(`value`) { + setFlag(BaseMaterial3D.Flags.FLAG_UV2_USE_WORLD_TRIPLANAR, value) + } + + /** + * Filter flags for the texture. See [TextureFilter] for options. + * **Note:** [heightmapTexture] is always sampled with linear filtering, even if nearest-neighbor + * filtering is selected here. This is to ensure the heightmap effect looks as intended. If you need + * sharper height transitions between pixels, resize the heightmap texture in an image editor with + * nearest-neighbor filtering. + */ + public final inline var textureFilter: TextureFilter + @JvmName("textureFilterProperty") + get() = getTextureFilter() + @JvmName("textureFilterProperty") + set(`value`) { + setTextureFilter(value) + } + + /** + * Repeat flags for the texture. See [TextureFilter] for options. + */ + public final inline var textureRepeat: Boolean + @JvmName("textureRepeatProperty") + get() = getFlag(BaseMaterial3D.Flags.FLAG_USE_TEXTURE_REPEAT) + @JvmName("textureRepeatProperty") + set(`value`) { + setFlag(BaseMaterial3D.Flags.FLAG_USE_TEXTURE_REPEAT, value) + } + + /** + * If `true`, the object receives no shadow that would otherwise be cast onto it. + */ + public final inline var disableReceiveShadows: Boolean + @JvmName("disableReceiveShadowsProperty") + get() = getFlag(BaseMaterial3D.Flags.FLAG_DONT_RECEIVE_SHADOWS) + @JvmName("disableReceiveShadowsProperty") + set(`value`) { + setFlag(BaseMaterial3D.Flags.FLAG_DONT_RECEIVE_SHADOWS, value) + } + + /** + * If `true`, enables the "shadow to opacity" render mode where lighting modifies the alpha so + * shadowed areas are opaque and non-shadowed areas are transparent. Useful for overlaying shadows + * onto a camera feed in AR. + */ + public final inline var shadowToOpacity: Boolean + @JvmName("shadowToOpacityProperty") + get() = getFlag(BaseMaterial3D.Flags.FLAG_USE_SHADOW_TO_OPACITY) + @JvmName("shadowToOpacityProperty") + set(`value`) { + setFlag(BaseMaterial3D.Flags.FLAG_USE_SHADOW_TO_OPACITY, value) + } + + /** + * Controls how the object faces the camera. See [BillboardMode]. + * **Note:** When billboarding is enabled and the material also casts shadows, billboards will + * face **the** camera in the scene when rendering shadows. In scenes with multiple cameras, the + * intended shadow cannot be determined and this will result in undefined behavior. See + * [url=https://github.com/godotengine/godot/pull/72638]GitHub Pull Request #72638[/url] for details. + * **Note:** Billboard mode is not suitable for VR because the left-right vector of the camera is + * not horizontal when the screen is attached to your head instead of on the table. See + * [url=https://github.com/godotengine/godot/issues/41567]GitHub issue #41567[/url] for details. + */ + public final inline var billboardMode: BillboardMode + @JvmName("billboardModeProperty") + get() = getBillboardMode() + @JvmName("billboardModeProperty") + set(`value`) { + setBillboardMode(value) + } + + /** + * If `true`, the shader will keep the scale set for the mesh. Otherwise, the scale is lost when + * billboarding. Only applies when [billboardMode] is not [BILLBOARD_DISABLED]. + */ + public final inline var billboardKeepScale: Boolean + @JvmName("billboardKeepScaleProperty") + get() = getFlag(BaseMaterial3D.Flags.FLAG_BILLBOARD_KEEP_SCALE) + @JvmName("billboardKeepScaleProperty") + set(`value`) { + setFlag(BaseMaterial3D.Flags.FLAG_BILLBOARD_KEEP_SCALE, value) + } + + /** + * The number of horizontal frames in the particle sprite sheet. Only enabled when using + * [BILLBOARD_PARTICLES]. See [billboardMode]. + */ + public final inline var particlesAnimHFrames: Int + @JvmName("particlesAnimHFramesProperty") + get() = getParticlesAnimHFrames() + @JvmName("particlesAnimHFramesProperty") + set(`value`) { + setParticlesAnimHFrames(value) + } + + /** + * The number of vertical frames in the particle sprite sheet. Only enabled when using + * [BILLBOARD_PARTICLES]. See [billboardMode]. + */ + public final inline var particlesAnimVFrames: Int + @JvmName("particlesAnimVFramesProperty") + get() = getParticlesAnimVFrames() + @JvmName("particlesAnimVFramesProperty") + set(`value`) { + setParticlesAnimVFrames(value) + } + + /** + * If `true`, particle animations are looped. Only enabled when using [BILLBOARD_PARTICLES]. See + * [billboardMode]. + */ + public final inline var particlesAnimLoop: Boolean + @JvmName("particlesAnimLoopProperty") + get() = getParticlesAnimLoop() + @JvmName("particlesAnimLoopProperty") + set(`value`) { + setParticlesAnimLoop(value) + } + + /** + * If `true`, enables the vertex grow setting. This can be used to create mesh-based outlines + * using a second material pass and its [cullMode] set to [CULL_FRONT]. See also [growAmount]. + * **Note:** Vertex growth cannot create new vertices, which means that visible gaps may occur in + * sharp corners. This can be alleviated by designing the mesh to use smooth normals exclusively + * using [url=https://wiki.polycount.com/wiki/Face_weighted_normals]face weighted normals[/url] in + * the 3D authoring software. In this case, grow will be able to join every outline together, just + * like in the original mesh. + */ + public final inline var grow: Boolean + @JvmName("growProperty") + get() = isGrowEnabled() + @JvmName("growProperty") + set(`value`) { + setGrowEnabled(value) + } + + /** + * Grows object vertices in the direction of their normals. Only effective if [grow] is `true`. + */ + public final inline var growAmount: Float + @JvmName("growAmountProperty") + get() = getGrow() + @JvmName("growAmountProperty") + set(`value`) { + setGrow(value) + } + + /** + * If `true`, the object is rendered at the same size regardless of distance. + */ + public final inline var fixedSize: Boolean + @JvmName("fixedSizeProperty") + get() = getFlag(BaseMaterial3D.Flags.FLAG_FIXED_SIZE) + @JvmName("fixedSizeProperty") + set(`value`) { + setFlag(BaseMaterial3D.Flags.FLAG_FIXED_SIZE, value) + } + + /** + * If `true`, render point size can be changed. + * **Note:** This is only effective for objects whose geometry is point-based rather than + * triangle-based. See also [pointSize]. + */ + public final inline var usePointSize: Boolean + @JvmName("usePointSizeProperty") + get() = getFlag(BaseMaterial3D.Flags.FLAG_USE_POINT_SIZE) + @JvmName("usePointSizeProperty") + set(`value`) { + setFlag(BaseMaterial3D.Flags.FLAG_USE_POINT_SIZE, value) + } + + /** + * The point size in pixels. See [usePointSize]. + */ + public final inline var pointSize: Float + @JvmName("pointSizeProperty") + get() = getPointSize() + @JvmName("pointSizeProperty") + set(`value`) { + setPointSize(value) + } + + /** + * If `true`, enables parts of the shader required for [GPUParticles3D] trails to function. This + * also requires using a mesh with appropriate skinning, such as [RibbonTrailMesh] or + * [TubeTrailMesh]. Enabling this feature outside of materials used in [GPUParticles3D] meshes will + * break material rendering. + */ + public final inline var useParticleTrails: Boolean + @JvmName("useParticleTrailsProperty") + get() = getFlag(BaseMaterial3D.Flags.FLAG_PARTICLE_TRAILS_MODE) + @JvmName("useParticleTrailsProperty") + set(`value`) { + setFlag(BaseMaterial3D.Flags.FLAG_PARTICLE_TRAILS_MODE, value) + } + + /** + * If `true`, the proximity fade effect is enabled. The proximity fade effect fades out each pixel + * based on its distance to another object. + */ + public final inline var proximityFadeEnabled: Boolean + @JvmName("proximityFadeEnabledProperty") + get() = isProximityFadeEnabled() + @JvmName("proximityFadeEnabledProperty") + set(`value`) { + setProximityFadeEnabled(value) + } + + /** + * Distance over which the fade effect takes place. The larger the distance the longer it takes + * for an object to fade. + */ + public final inline var proximityFadeDistance: Float + @JvmName("proximityFadeDistanceProperty") + get() = getProximityFadeDistance() + @JvmName("proximityFadeDistanceProperty") + set(`value`) { + setProximityFadeDistance(value) + } + + /** + * The width of the range around the shape between the minimum and maximum representable signed + * distance. + */ + public final inline var msdfPixelRange: Float + @JvmName("msdfPixelRangeProperty") + get() = getMsdfPixelRange() + @JvmName("msdfPixelRangeProperty") + set(`value`) { + setMsdfPixelRange(value) + } + + /** + * The width of the shape outline. + */ + public final inline var msdfOutlineSize: Float + @JvmName("msdfOutlineSizeProperty") + get() = getMsdfOutlineSize() + @JvmName("msdfOutlineSizeProperty") + set(`value`) { + setMsdfOutlineSize(value) + } + + /** + * Specifies which type of fade to use. Can be any of the [DistanceFadeMode]s. + */ + public final inline var distanceFadeMode: DistanceFadeMode + @JvmName("distanceFadeModeProperty") + get() = getDistanceFade() + @JvmName("distanceFadeModeProperty") + set(`value`) { + setDistanceFade(value) + } + + /** + * Distance at which the object starts to become visible. If the object is less than this distance + * away, it will be invisible. + * **Note:** If [distanceFadeMinDistance] is greater than [distanceFadeMaxDistance], the behavior + * will be reversed. The object will start to fade away at [distanceFadeMaxDistance] and will fully + * disappear once it reaches [distanceFadeMinDistance]. + */ + public final inline var distanceFadeMinDistance: Float + @JvmName("distanceFadeMinDistanceProperty") + get() = getDistanceFadeMinDistance() + @JvmName("distanceFadeMinDistanceProperty") + set(`value`) { + setDistanceFadeMinDistance(value) + } + + /** + * Distance at which the object appears fully opaque. + * **Note:** If [distanceFadeMaxDistance] is less than [distanceFadeMinDistance], the behavior + * will be reversed. The object will start to fade away at [distanceFadeMaxDistance] and will fully + * disappear once it reaches [distanceFadeMinDistance]. + */ + public final inline var distanceFadeMaxDistance: Float + @JvmName("distanceFadeMaxDistanceProperty") + get() = getDistanceFadeMaxDistance() + @JvmName("distanceFadeMaxDistanceProperty") + set(`value`) { + setDistanceFadeMaxDistance(value) + } + + public override fun new(scriptIndex: Int): Unit { + Internals.callConstructor(this, ENGINE_CLASS_BASEMATERIAL3D_INDEX, scriptIndex) + } + + /** + * The material's base color. + * **Note:** If [detailEnabled] is `true` and a [detailAlbedo] texture is specified, [albedoColor] + * will *not* modulate the detail texture. This can be used to color partial areas of a material by + * not specifying an albedo texture and using a transparent [detailAlbedo] texture instead. + * + * This is a helper function to make dealing with local copies easier. + * + * For more information, see our + * [documentation](https://godot-kotl.in/en/stable/user-guide/api-differences/#core-types). + * + * Allow to directly modify the local copy of the property and assign it back to the Object. + * + * Prefer that over writing: + * `````` + * val myCoreType = basematerial3d.albedoColor + * //Your changes + * basematerial3d.albedoColor = myCoreType + * `````` + */ + @CoreTypeHelper + public final fun albedoColorMutate(block: Color.() -> Unit): Color = albedoColor.apply{ + block(this) + albedoColor = this + } + + + /** + * The emitted light's color. See [emissionEnabled]. + * + * This is a helper function to make dealing with local copies easier. + * + * For more information, see our + * [documentation](https://godot-kotl.in/en/stable/user-guide/api-differences/#core-types). + * + * Allow to directly modify the local copy of the property and assign it back to the Object. + * + * Prefer that over writing: + * `````` + * val myCoreType = basematerial3d.emission + * //Your changes + * basematerial3d.emission = myCoreType + * `````` + */ + @CoreTypeHelper + public final fun emissionMutate(block: Color.() -> Unit): Color = emission.apply{ + block(this) + emission = this + } + + + /** + * The color to multiply the subsurface scattering transmittance effect with. Ignored if + * [subsurfScatterSkinMode] is `true`. + * + * This is a helper function to make dealing with local copies easier. + * + * For more information, see our + * [documentation](https://godot-kotl.in/en/stable/user-guide/api-differences/#core-types). + * + * Allow to directly modify the local copy of the property and assign it back to the Object. + * + * Prefer that over writing: + * `````` + * val myCoreType = basematerial3d.subsurfScatterTransmittanceColor + * //Your changes + * basematerial3d.subsurfScatterTransmittanceColor = myCoreType + * `````` + */ + @CoreTypeHelper + public final fun subsurfScatterTransmittanceColorMutate(block: Color.() -> Unit): Color = + subsurfScatterTransmittanceColor.apply{ + block(this) + subsurfScatterTransmittanceColor = this + } + + + /** + * The color used by the backlight effect. Represents the light passing through an object. + * + * This is a helper function to make dealing with local copies easier. + * + * For more information, see our + * [documentation](https://godot-kotl.in/en/stable/user-guide/api-differences/#core-types). + * + * Allow to directly modify the local copy of the property and assign it back to the Object. + * + * Prefer that over writing: + * `````` + * val myCoreType = basematerial3d.backlight + * //Your changes + * basematerial3d.backlight = myCoreType + * `````` + */ + @CoreTypeHelper + public final fun backlightMutate(block: Color.() -> Unit): Color = backlight.apply{ + block(this) + backlight = this + } + + + /** + * How much to scale the `UV` coordinates. This is multiplied by `UV` in the vertex function. The + * Z component is used when [uv1Triplanar] is enabled, but it is not used anywhere else. + * + * This is a helper function to make dealing with local copies easier. + * + * For more information, see our + * [documentation](https://godot-kotl.in/en/stable/user-guide/api-differences/#core-types). + * + * Allow to directly modify the local copy of the property and assign it back to the Object. + * + * Prefer that over writing: + * `````` + * val myCoreType = basematerial3d.uv1Scale + * //Your changes + * basematerial3d.uv1Scale = myCoreType + * `````` + */ + @CoreTypeHelper + public final fun uv1ScaleMutate(block: Vector3.() -> Unit): Vector3 = uv1Scale.apply{ + block(this) + uv1Scale = this + } + + + /** + * How much to offset the `UV` coordinates. This amount will be added to `UV` in the vertex + * function. This can be used to offset a texture. The Z component is used when [uv1Triplanar] is + * enabled, but it is not used anywhere else. + * + * This is a helper function to make dealing with local copies easier. + * + * For more information, see our + * [documentation](https://godot-kotl.in/en/stable/user-guide/api-differences/#core-types). + * + * Allow to directly modify the local copy of the property and assign it back to the Object. + * + * Prefer that over writing: + * `````` + * val myCoreType = basematerial3d.uv1Offset + * //Your changes + * basematerial3d.uv1Offset = myCoreType + * `````` + */ + @CoreTypeHelper + public final fun uv1OffsetMutate(block: Vector3.() -> Unit): Vector3 = uv1Offset.apply{ + block(this) + uv1Offset = this + } + + + /** + * How much to scale the `UV2` coordinates. This is multiplied by `UV2` in the vertex function. + * The Z component is used when [uv2Triplanar] is enabled, but it is not used anywhere else. + * + * This is a helper function to make dealing with local copies easier. + * + * For more information, see our + * [documentation](https://godot-kotl.in/en/stable/user-guide/api-differences/#core-types). + * + * Allow to directly modify the local copy of the property and assign it back to the Object. + * + * Prefer that over writing: + * `````` + * val myCoreType = basematerial3d.uv2Scale + * //Your changes + * basematerial3d.uv2Scale = myCoreType + * `````` + */ + @CoreTypeHelper + public final fun uv2ScaleMutate(block: Vector3.() -> Unit): Vector3 = uv2Scale.apply{ + block(this) + uv2Scale = this + } + + + /** + * How much to offset the `UV2` coordinates. This amount will be added to `UV2` in the vertex + * function. This can be used to offset a texture. The Z component is used when [uv2Triplanar] is + * enabled, but it is not used anywhere else. + * + * This is a helper function to make dealing with local copies easier. + * + * For more information, see our + * [documentation](https://godot-kotl.in/en/stable/user-guide/api-differences/#core-types). + * + * Allow to directly modify the local copy of the property and assign it back to the Object. + * + * Prefer that over writing: + * `````` + * val myCoreType = basematerial3d.uv2Offset + * //Your changes + * basematerial3d.uv2Offset = myCoreType + * `````` + */ + @CoreTypeHelper + public final fun uv2OffsetMutate(block: Vector3.() -> Unit): Vector3 = uv2Offset.apply{ + block(this) + uv2Offset = this + } + + + public final fun setAlbedo(albedo: Color): Unit { + Internals.writeArguments(COLOR to albedo) + Internals.callMethod(rawPtr, MethodBindings.setAlbedoPtr, NIL) + } + + public final fun getAlbedo(): Color { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getAlbedoPtr, COLOR) + return (Internals.readReturnValue(COLOR) as Color) + } + + public final fun setTransparency(transparency: Transparency): Unit { + Internals.writeArguments(LONG to transparency.id) + Internals.callMethod(rawPtr, MethodBindings.setTransparencyPtr, NIL) + } + + public final fun getTransparency(): Transparency { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getTransparencyPtr, LONG) + return BaseMaterial3D.Transparency.from(Internals.readReturnValue(LONG) as Long) + } + + public final fun setAlphaAntialiasing(alphaAa: AlphaAntiAliasing): Unit { + Internals.writeArguments(LONG to alphaAa.id) + Internals.callMethod(rawPtr, MethodBindings.setAlphaAntialiasingPtr, NIL) + } + + public final fun getAlphaAntialiasing(): AlphaAntiAliasing { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getAlphaAntialiasingPtr, LONG) + return BaseMaterial3D.AlphaAntiAliasing.from(Internals.readReturnValue(LONG) as Long) + } + + public final fun setAlphaAntialiasingEdge(edge: Float): Unit { + Internals.writeArguments(DOUBLE to edge.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setAlphaAntialiasingEdgePtr, NIL) + } + + public final fun getAlphaAntialiasingEdge(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getAlphaAntialiasingEdgePtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setShadingMode(shadingMode: ShadingMode): Unit { + Internals.writeArguments(LONG to shadingMode.id) + Internals.callMethod(rawPtr, MethodBindings.setShadingModePtr, NIL) + } + + public final fun getShadingMode(): ShadingMode { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getShadingModePtr, LONG) + return BaseMaterial3D.ShadingMode.from(Internals.readReturnValue(LONG) as Long) + } + + public final fun setSpecular(specular: Float): Unit { + Internals.writeArguments(DOUBLE to specular.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setSpecularPtr, NIL) + } + + public final fun getSpecular(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getSpecularPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setMetallic(metallic: Float): Unit { + Internals.writeArguments(DOUBLE to metallic.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setMetallicPtr, NIL) + } + + public final fun getMetallic(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getMetallicPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setRoughness(roughness: Float): Unit { + Internals.writeArguments(DOUBLE to roughness.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setRoughnessPtr, NIL) + } + + public final fun getRoughness(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getRoughnessPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setEmission(emission: Color): Unit { + Internals.writeArguments(COLOR to emission) + Internals.callMethod(rawPtr, MethodBindings.setEmissionPtr, NIL) + } + + public final fun getEmission(): Color { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getEmissionPtr, COLOR) + return (Internals.readReturnValue(COLOR) as Color) + } + + public final fun setEmissionEnergyMultiplier(emissionEnergyMultiplier: Float): Unit { + Internals.writeArguments(DOUBLE to emissionEnergyMultiplier.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setEmissionEnergyMultiplierPtr, NIL) + } + + public final fun getEmissionEnergyMultiplier(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getEmissionEnergyMultiplierPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setEmissionIntensity(emissionEnergyMultiplier: Float): Unit { + Internals.writeArguments(DOUBLE to emissionEnergyMultiplier.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setEmissionIntensityPtr, NIL) + } + + public final fun getEmissionIntensity(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getEmissionIntensityPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setNormalScale(normalScale: Float): Unit { + Internals.writeArguments(DOUBLE to normalScale.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setNormalScalePtr, NIL) + } + + public final fun getNormalScale(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getNormalScalePtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setRim(rim: Float): Unit { + Internals.writeArguments(DOUBLE to rim.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setRimPtr, NIL) + } + + public final fun getRim(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getRimPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setRimTint(rimTint: Float): Unit { + Internals.writeArguments(DOUBLE to rimTint.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setRimTintPtr, NIL) + } + + public final fun getRimTint(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getRimTintPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setClearcoat(clearcoat: Float): Unit { + Internals.writeArguments(DOUBLE to clearcoat.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setClearcoatPtr, NIL) + } + + public final fun getClearcoat(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getClearcoatPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setClearcoatRoughness(clearcoatRoughness: Float): Unit { + Internals.writeArguments(DOUBLE to clearcoatRoughness.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setClearcoatRoughnessPtr, NIL) + } + + public final fun getClearcoatRoughness(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getClearcoatRoughnessPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setAnisotropy(anisotropy: Float): Unit { + Internals.writeArguments(DOUBLE to anisotropy.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setAnisotropyPtr, NIL) + } + + public final fun getAnisotropy(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getAnisotropyPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setHeightmapScale(heightmapScale: Float): Unit { + Internals.writeArguments(DOUBLE to heightmapScale.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setHeightmapScalePtr, NIL) + } + + public final fun getHeightmapScale(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getHeightmapScalePtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setSubsurfaceScatteringStrength(strength: Float): Unit { + Internals.writeArguments(DOUBLE to strength.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setSubsurfaceScatteringStrengthPtr, NIL) + } + + public final fun getSubsurfaceScatteringStrength(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getSubsurfaceScatteringStrengthPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setTransmittanceColor(color: Color): Unit { + Internals.writeArguments(COLOR to color) + Internals.callMethod(rawPtr, MethodBindings.setTransmittanceColorPtr, NIL) + } + + public final fun getTransmittanceColor(): Color { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getTransmittanceColorPtr, COLOR) + return (Internals.readReturnValue(COLOR) as Color) + } + + public final fun setTransmittanceDepth(depth: Float): Unit { + Internals.writeArguments(DOUBLE to depth.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setTransmittanceDepthPtr, NIL) + } + + public final fun getTransmittanceDepth(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getTransmittanceDepthPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setTransmittanceBoost(boost: Float): Unit { + Internals.writeArguments(DOUBLE to boost.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setTransmittanceBoostPtr, NIL) + } + + public final fun getTransmittanceBoost(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getTransmittanceBoostPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setBacklight(backlight: Color): Unit { + Internals.writeArguments(COLOR to backlight) + Internals.callMethod(rawPtr, MethodBindings.setBacklightPtr, NIL) + } + + public final fun getBacklight(): Color { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getBacklightPtr, COLOR) + return (Internals.readReturnValue(COLOR) as Color) + } + + public final fun setRefraction(refraction: Float): Unit { + Internals.writeArguments(DOUBLE to refraction.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setRefractionPtr, NIL) + } + + public final fun getRefraction(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getRefractionPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setPointSize(pointSize: Float): Unit { + Internals.writeArguments(DOUBLE to pointSize.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setPointSizePtr, NIL) + } + + public final fun getPointSize(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getPointSizePtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setDetailUv(detailUv: DetailUV): Unit { + Internals.writeArguments(LONG to detailUv.id) + Internals.callMethod(rawPtr, MethodBindings.setDetailUvPtr, NIL) + } + + public final fun getDetailUv(): DetailUV { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getDetailUvPtr, LONG) + return BaseMaterial3D.DetailUV.from(Internals.readReturnValue(LONG) as Long) + } + + public final fun setBlendMode(blendMode: BlendMode): Unit { + Internals.writeArguments(LONG to blendMode.id) + Internals.callMethod(rawPtr, MethodBindings.setBlendModePtr, NIL) + } + + public final fun getBlendMode(): BlendMode { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getBlendModePtr, LONG) + return BaseMaterial3D.BlendMode.from(Internals.readReturnValue(LONG) as Long) + } + + public final fun setDepthDrawMode(depthDrawMode: DepthDrawMode): Unit { + Internals.writeArguments(LONG to depthDrawMode.id) + Internals.callMethod(rawPtr, MethodBindings.setDepthDrawModePtr, NIL) + } + + public final fun getDepthDrawMode(): DepthDrawMode { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getDepthDrawModePtr, LONG) + return BaseMaterial3D.DepthDrawMode.from(Internals.readReturnValue(LONG) as Long) + } + + public final fun setCullMode(cullMode: CullMode): Unit { + Internals.writeArguments(LONG to cullMode.id) + Internals.callMethod(rawPtr, MethodBindings.setCullModePtr, NIL) + } + + public final fun getCullMode(): CullMode { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getCullModePtr, LONG) + return BaseMaterial3D.CullMode.from(Internals.readReturnValue(LONG) as Long) + } + + public final fun setDiffuseMode(diffuseMode: DiffuseMode): Unit { + Internals.writeArguments(LONG to diffuseMode.id) + Internals.callMethod(rawPtr, MethodBindings.setDiffuseModePtr, NIL) + } + + public final fun getDiffuseMode(): DiffuseMode { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getDiffuseModePtr, LONG) + return BaseMaterial3D.DiffuseMode.from(Internals.readReturnValue(LONG) as Long) + } + + public final fun setSpecularMode(specularMode: SpecularMode): Unit { + Internals.writeArguments(LONG to specularMode.id) + Internals.callMethod(rawPtr, MethodBindings.setSpecularModePtr, NIL) + } + + public final fun getSpecularMode(): SpecularMode { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getSpecularModePtr, LONG) + return BaseMaterial3D.SpecularMode.from(Internals.readReturnValue(LONG) as Long) + } + + /** + * If `true`, enables the specified flag. Flags are optional behavior that can be turned on and + * off. Only one flag can be enabled at a time with this function, the flag enumerators cannot be + * bit-masked together to enable or disable multiple flags at once. Flags can also be enabled by + * setting the corresponding member to `true`. See [Flags] enumerator for options. + */ + public final fun setFlag(flag: Flags, enable: Boolean): Unit { + Internals.writeArguments(LONG to flag.id, BOOL to enable) + Internals.callMethod(rawPtr, MethodBindings.setFlagPtr, NIL) + } + + /** + * Returns `true`, if the specified flag is enabled. See [Flags] enumerator for options. + */ + public final fun getFlag(flag: Flags): Boolean { + Internals.writeArguments(LONG to flag.id) + Internals.callMethod(rawPtr, MethodBindings.getFlagPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public final fun setTextureFilter(mode: TextureFilter): Unit { + Internals.writeArguments(LONG to mode.id) + Internals.callMethod(rawPtr, MethodBindings.setTextureFilterPtr, NIL) + } + + public final fun getTextureFilter(): TextureFilter { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getTextureFilterPtr, LONG) + return BaseMaterial3D.TextureFilter.from(Internals.readReturnValue(LONG) as Long) + } + + /** + * If `true`, enables the specified [Feature]. Many features that are available in + * [BaseMaterial3D]s need to be enabled before use. This way the cost for using the feature is only + * incurred when specified. Features can also be enabled by setting the corresponding member to + * `true`. + */ + public final fun setFeature(feature: Feature, enable: Boolean): Unit { + Internals.writeArguments(LONG to feature.id, BOOL to enable) + Internals.callMethod(rawPtr, MethodBindings.setFeaturePtr, NIL) + } + + /** + * Returns `true`, if the specified [Feature] is enabled. + */ + public final fun getFeature(feature: Feature): Boolean { + Internals.writeArguments(LONG to feature.id) + Internals.callMethod(rawPtr, MethodBindings.getFeaturePtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + /** + * Sets the texture for the slot specified by [param]. See [TextureParam] for available slots. + */ + public final fun setTexture(`param`: TextureParam, texture: Texture2D?): Unit { + Internals.writeArguments(LONG to param.id, OBJECT to texture) + Internals.callMethod(rawPtr, MethodBindings.setTexturePtr, NIL) + } + + /** + * Returns the [Texture2D] associated with the specified [TextureParam]. + */ + public final fun getTexture(`param`: TextureParam): Texture2D? { + Internals.writeArguments(LONG to param.id) + Internals.callMethod(rawPtr, MethodBindings.getTexturePtr, OBJECT) + return (Internals.readReturnValue(OBJECT) as Texture2D?) + } + + public final fun setDetailBlendMode(detailBlendMode: BlendMode): Unit { + Internals.writeArguments(LONG to detailBlendMode.id) + Internals.callMethod(rawPtr, MethodBindings.setDetailBlendModePtr, NIL) + } + + public final fun getDetailBlendMode(): BlendMode { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getDetailBlendModePtr, LONG) + return BaseMaterial3D.BlendMode.from(Internals.readReturnValue(LONG) as Long) + } + + public final fun setUv1Scale(scale: Vector3): Unit { + Internals.writeArguments(VECTOR3 to scale) + Internals.callMethod(rawPtr, MethodBindings.setUv1ScalePtr, NIL) + } + + public final fun getUv1Scale(): Vector3 { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getUv1ScalePtr, VECTOR3) + return (Internals.readReturnValue(VECTOR3) as Vector3) + } + + public final fun setUv1Offset(offset: Vector3): Unit { + Internals.writeArguments(VECTOR3 to offset) + Internals.callMethod(rawPtr, MethodBindings.setUv1OffsetPtr, NIL) + } + + public final fun getUv1Offset(): Vector3 { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getUv1OffsetPtr, VECTOR3) + return (Internals.readReturnValue(VECTOR3) as Vector3) + } + + public final fun setUv1TriplanarBlendSharpness(sharpness: Float): Unit { + Internals.writeArguments(DOUBLE to sharpness.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setUv1TriplanarBlendSharpnessPtr, NIL) + } + + public final fun getUv1TriplanarBlendSharpness(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getUv1TriplanarBlendSharpnessPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setUv2Scale(scale: Vector3): Unit { + Internals.writeArguments(VECTOR3 to scale) + Internals.callMethod(rawPtr, MethodBindings.setUv2ScalePtr, NIL) + } + + public final fun getUv2Scale(): Vector3 { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getUv2ScalePtr, VECTOR3) + return (Internals.readReturnValue(VECTOR3) as Vector3) + } + + public final fun setUv2Offset(offset: Vector3): Unit { + Internals.writeArguments(VECTOR3 to offset) + Internals.callMethod(rawPtr, MethodBindings.setUv2OffsetPtr, NIL) + } + + public final fun getUv2Offset(): Vector3 { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getUv2OffsetPtr, VECTOR3) + return (Internals.readReturnValue(VECTOR3) as Vector3) + } + + public final fun setUv2TriplanarBlendSharpness(sharpness: Float): Unit { + Internals.writeArguments(DOUBLE to sharpness.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setUv2TriplanarBlendSharpnessPtr, NIL) + } + + public final fun getUv2TriplanarBlendSharpness(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getUv2TriplanarBlendSharpnessPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setBillboardMode(mode: BillboardMode): Unit { + Internals.writeArguments(LONG to mode.id) + Internals.callMethod(rawPtr, MethodBindings.setBillboardModePtr, NIL) + } + + public final fun getBillboardMode(): BillboardMode { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getBillboardModePtr, LONG) + return BaseMaterial3D.BillboardMode.from(Internals.readReturnValue(LONG) as Long) + } + + public final fun setParticlesAnimHFrames(frames: Int): Unit { + Internals.writeArguments(LONG to frames.toLong()) + Internals.callMethod(rawPtr, MethodBindings.setParticlesAnimHFramesPtr, NIL) + } + + public final fun getParticlesAnimHFrames(): Int { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getParticlesAnimHFramesPtr, LONG) + return (Internals.readReturnValue(LONG) as Long).toInt() + } + + public final fun setParticlesAnimVFrames(frames: Int): Unit { + Internals.writeArguments(LONG to frames.toLong()) + Internals.callMethod(rawPtr, MethodBindings.setParticlesAnimVFramesPtr, NIL) + } + + public final fun getParticlesAnimVFrames(): Int { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getParticlesAnimVFramesPtr, LONG) + return (Internals.readReturnValue(LONG) as Long).toInt() + } + + public final fun setParticlesAnimLoop(loop: Boolean): Unit { + Internals.writeArguments(BOOL to loop) + Internals.callMethod(rawPtr, MethodBindings.setParticlesAnimLoopPtr, NIL) + } + + public final fun getParticlesAnimLoop(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getParticlesAnimLoopPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public final fun setHeightmapDeepParallax(enable: Boolean): Unit { + Internals.writeArguments(BOOL to enable) + Internals.callMethod(rawPtr, MethodBindings.setHeightmapDeepParallaxPtr, NIL) + } + + public final fun isHeightmapDeepParallaxEnabled(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isHeightmapDeepParallaxEnabledPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public final fun setHeightmapDeepParallaxMinLayers(layer: Int): Unit { + Internals.writeArguments(LONG to layer.toLong()) + Internals.callMethod(rawPtr, MethodBindings.setHeightmapDeepParallaxMinLayersPtr, NIL) + } + + public final fun getHeightmapDeepParallaxMinLayers(): Int { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getHeightmapDeepParallaxMinLayersPtr, LONG) + return (Internals.readReturnValue(LONG) as Long).toInt() + } + + public final fun setHeightmapDeepParallaxMaxLayers(layer: Int): Unit { + Internals.writeArguments(LONG to layer.toLong()) + Internals.callMethod(rawPtr, MethodBindings.setHeightmapDeepParallaxMaxLayersPtr, NIL) + } + + public final fun getHeightmapDeepParallaxMaxLayers(): Int { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getHeightmapDeepParallaxMaxLayersPtr, LONG) + return (Internals.readReturnValue(LONG) as Long).toInt() + } + + public final fun setHeightmapDeepParallaxFlipTangent(flip: Boolean): Unit { + Internals.writeArguments(BOOL to flip) + Internals.callMethod(rawPtr, MethodBindings.setHeightmapDeepParallaxFlipTangentPtr, NIL) + } + + public final fun getHeightmapDeepParallaxFlipTangent(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getHeightmapDeepParallaxFlipTangentPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public final fun setHeightmapDeepParallaxFlipBinormal(flip: Boolean): Unit { + Internals.writeArguments(BOOL to flip) + Internals.callMethod(rawPtr, MethodBindings.setHeightmapDeepParallaxFlipBinormalPtr, NIL) + } + + public final fun getHeightmapDeepParallaxFlipBinormal(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getHeightmapDeepParallaxFlipBinormalPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public final fun setGrow(amount: Float): Unit { + Internals.writeArguments(DOUBLE to amount.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setGrowPtr, NIL) + } + + public final fun getGrow(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getGrowPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setEmissionOperator(`operator`: EmissionOperator): Unit { + Internals.writeArguments(LONG to `operator`.id) + Internals.callMethod(rawPtr, MethodBindings.setEmissionOperatorPtr, NIL) + } + + public final fun getEmissionOperator(): EmissionOperator { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getEmissionOperatorPtr, LONG) + return BaseMaterial3D.EmissionOperator.from(Internals.readReturnValue(LONG) as Long) + } + + public final fun setAoLightAffect(amount: Float): Unit { + Internals.writeArguments(DOUBLE to amount.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setAoLightAffectPtr, NIL) + } + + public final fun getAoLightAffect(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getAoLightAffectPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setAlphaScissorThreshold(threshold: Float): Unit { + Internals.writeArguments(DOUBLE to threshold.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setAlphaScissorThresholdPtr, NIL) + } + + public final fun getAlphaScissorThreshold(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getAlphaScissorThresholdPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setAlphaHashScale(threshold: Float): Unit { + Internals.writeArguments(DOUBLE to threshold.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setAlphaHashScalePtr, NIL) + } + + public final fun getAlphaHashScale(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getAlphaHashScalePtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setGrowEnabled(enable: Boolean): Unit { + Internals.writeArguments(BOOL to enable) + Internals.callMethod(rawPtr, MethodBindings.setGrowEnabledPtr, NIL) + } + + public final fun isGrowEnabled(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isGrowEnabledPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public final fun setMetallicTextureChannel(channel: TextureChannel): Unit { + Internals.writeArguments(LONG to channel.id) + Internals.callMethod(rawPtr, MethodBindings.setMetallicTextureChannelPtr, NIL) + } + + public final fun getMetallicTextureChannel(): TextureChannel { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getMetallicTextureChannelPtr, LONG) + return BaseMaterial3D.TextureChannel.from(Internals.readReturnValue(LONG) as Long) + } + + public final fun setRoughnessTextureChannel(channel: TextureChannel): Unit { + Internals.writeArguments(LONG to channel.id) + Internals.callMethod(rawPtr, MethodBindings.setRoughnessTextureChannelPtr, NIL) + } + + public final fun getRoughnessTextureChannel(): TextureChannel { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getRoughnessTextureChannelPtr, LONG) + return BaseMaterial3D.TextureChannel.from(Internals.readReturnValue(LONG) as Long) + } + + public final fun setAoTextureChannel(channel: TextureChannel): Unit { + Internals.writeArguments(LONG to channel.id) + Internals.callMethod(rawPtr, MethodBindings.setAoTextureChannelPtr, NIL) + } + + public final fun getAoTextureChannel(): TextureChannel { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getAoTextureChannelPtr, LONG) + return BaseMaterial3D.TextureChannel.from(Internals.readReturnValue(LONG) as Long) + } + + public final fun setRefractionTextureChannel(channel: TextureChannel): Unit { + Internals.writeArguments(LONG to channel.id) + Internals.callMethod(rawPtr, MethodBindings.setRefractionTextureChannelPtr, NIL) + } + + public final fun getRefractionTextureChannel(): TextureChannel { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getRefractionTextureChannelPtr, LONG) + return BaseMaterial3D.TextureChannel.from(Internals.readReturnValue(LONG) as Long) + } + + public final fun setProximityFadeEnabled(enabled: Boolean): Unit { + Internals.writeArguments(BOOL to enabled) + Internals.callMethod(rawPtr, MethodBindings.setProximityFadeEnabledPtr, NIL) + } + + public final fun isProximityFadeEnabled(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isProximityFadeEnabledPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public final fun setProximityFadeDistance(distance: Float): Unit { + Internals.writeArguments(DOUBLE to distance.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setProximityFadeDistancePtr, NIL) + } + + public final fun getProximityFadeDistance(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getProximityFadeDistancePtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setMsdfPixelRange(range: Float): Unit { + Internals.writeArguments(DOUBLE to range.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setMsdfPixelRangePtr, NIL) + } + + public final fun getMsdfPixelRange(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getMsdfPixelRangePtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setMsdfOutlineSize(size: Float): Unit { + Internals.writeArguments(DOUBLE to size.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setMsdfOutlineSizePtr, NIL) + } + + public final fun getMsdfOutlineSize(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getMsdfOutlineSizePtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setDistanceFade(mode: DistanceFadeMode): Unit { + Internals.writeArguments(LONG to mode.id) + Internals.callMethod(rawPtr, MethodBindings.setDistanceFadePtr, NIL) + } + + public final fun getDistanceFade(): DistanceFadeMode { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getDistanceFadePtr, LONG) + return BaseMaterial3D.DistanceFadeMode.from(Internals.readReturnValue(LONG) as Long) + } + + public final fun setDistanceFadeMaxDistance(distance: Float): Unit { + Internals.writeArguments(DOUBLE to distance.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setDistanceFadeMaxDistancePtr, NIL) + } + + public final fun getDistanceFadeMaxDistance(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getDistanceFadeMaxDistancePtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setDistanceFadeMinDistance(distance: Float): Unit { + Internals.writeArguments(DOUBLE to distance.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setDistanceFadeMinDistancePtr, NIL) + } + + public final fun getDistanceFadeMinDistance(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getDistanceFadeMinDistancePtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public enum class TextureParam( + id: Long, + ) { + /** + * Texture specifying per-pixel color. + */ + TEXTURE_ALBEDO(0), + /** + * Texture specifying per-pixel metallic value. + */ + TEXTURE_METALLIC(1), + /** + * Texture specifying per-pixel roughness value. + */ + TEXTURE_ROUGHNESS(2), + /** + * Texture specifying per-pixel emission color. + */ + TEXTURE_EMISSION(3), + /** + * Texture specifying per-pixel normal vector. + */ + TEXTURE_NORMAL(4), + /** + * Texture specifying per-pixel rim value. + */ + TEXTURE_RIM(5), + /** + * Texture specifying per-pixel clearcoat value. + */ + TEXTURE_CLEARCOAT(6), + /** + * Texture specifying per-pixel flowmap direction for use with [anisotropy]. + */ + TEXTURE_FLOWMAP(7), + /** + * Texture specifying per-pixel ambient occlusion value. + */ + TEXTURE_AMBIENT_OCCLUSION(8), + /** + * Texture specifying per-pixel height. + */ + TEXTURE_HEIGHTMAP(9), + /** + * Texture specifying per-pixel subsurface scattering. + */ + TEXTURE_SUBSURFACE_SCATTERING(10), + /** + * Texture specifying per-pixel transmittance for subsurface scattering. + */ + TEXTURE_SUBSURFACE_TRANSMITTANCE(11), + /** + * Texture specifying per-pixel backlight color. + */ + TEXTURE_BACKLIGHT(12), + /** + * Texture specifying per-pixel refraction strength. + */ + TEXTURE_REFRACTION(13), + /** + * Texture specifying per-pixel detail mask blending value. + */ + TEXTURE_DETAIL_MASK(14), + /** + * Texture specifying per-pixel detail color. + */ + TEXTURE_DETAIL_ALBEDO(15), + /** + * Texture specifying per-pixel detail normal. + */ + TEXTURE_DETAIL_NORMAL(16), + /** + * Texture holding ambient occlusion, roughness, and metallic. + */ + TEXTURE_ORM(17), + /** + * Represents the size of the [TextureParam] enum. + */ + TEXTURE_MAX(18), + ; + + public val id: Long + init { + this.id = id + } + + public companion object { + public fun from(`value`: Long): TextureParam = entries.single { it.id == `value` } + } + } + + public enum class TextureFilter( + id: Long, + ) { + /** + * The texture filter reads from the nearest pixel only. This makes the texture look pixelated + * from up close, and grainy from a distance (due to mipmaps not being sampled). + */ + TEXTURE_FILTER_NEAREST(0), + /** + * The texture filter blends between the nearest 4 pixels. This makes the texture look smooth + * from up close, and grainy from a distance (due to mipmaps not being sampled). + */ + TEXTURE_FILTER_LINEAR(1), + /** + * The texture filter reads from the nearest pixel and blends between the nearest 2 mipmaps (or + * uses the nearest mipmap if + * [ProjectSettings.rendering/textures/defaultFilters/useNearestMipmapFilter] is `true`). This + * makes the texture look pixelated from up close, and smooth from a distance. + */ + TEXTURE_FILTER_NEAREST_WITH_MIPMAPS(2), + /** + * The texture filter blends between the nearest 4 pixels and between the nearest 2 mipmaps (or + * uses the nearest mipmap if + * [ProjectSettings.rendering/textures/defaultFilters/useNearestMipmapFilter] is `true`). This + * makes the texture look smooth from up close, and smooth from a distance. + */ + TEXTURE_FILTER_LINEAR_WITH_MIPMAPS(3), + /** + * The texture filter reads from the nearest pixel and blends between 2 mipmaps (or uses the + * nearest mipmap if [ProjectSettings.rendering/textures/defaultFilters/useNearestMipmapFilter] is + * `true`) based on the angle between the surface and the camera view. This makes the texture look + * pixelated from up close, and smooth from a distance. Anisotropic filtering improves texture + * quality on surfaces that are almost in line with the camera, but is slightly slower. The + * anisotropic filtering level can be changed by adjusting + * [ProjectSettings.rendering/textures/defaultFilters/anisotropicFilteringLevel]. + */ + TEXTURE_FILTER_NEAREST_WITH_MIPMAPS_ANISOTROPIC(4), + /** + * The texture filter blends between the nearest 4 pixels and blends between 2 mipmaps (or uses + * the nearest mipmap if [ProjectSettings.rendering/textures/defaultFilters/useNearestMipmapFilter] + * is `true`) based on the angle between the surface and the camera view. This makes the texture + * look smooth from up close, and smooth from a distance. Anisotropic filtering improves texture + * quality on surfaces that are almost in line with the camera, but is slightly slower. The + * anisotropic filtering level can be changed by adjusting + * [ProjectSettings.rendering/textures/defaultFilters/anisotropicFilteringLevel]. + */ + TEXTURE_FILTER_LINEAR_WITH_MIPMAPS_ANISOTROPIC(5), + /** + * Represents the size of the [TextureFilter] enum. + */ + TEXTURE_FILTER_MAX(6), + ; + + public val id: Long + init { + this.id = id + } + + public companion object { + public fun from(`value`: Long): TextureFilter = entries.single { it.id == `value` } + } + } + + public enum class DetailUV( + id: Long, + ) { + /** + * Use `UV` with the detail texture. + */ + DETAIL_UV_1(0), + /** + * Use `UV2` with the detail texture. + */ + DETAIL_UV_2(1), + ; + + public val id: Long + init { + this.id = id + } + + public companion object { + public fun from(`value`: Long): DetailUV = entries.single { it.id == `value` } + } + } + + public enum class Transparency( + id: Long, + ) { + /** + * The material will not use transparency. This is the fastest to render. + */ + TRANSPARENCY_DISABLED(0), + /** + * The material will use the texture's alpha values for transparency. This is the slowest to + * render, and disables shadow casting. + */ + TRANSPARENCY_ALPHA(1), + /** + * The material will cut off all values below a threshold, the rest will remain opaque. The + * opaque portions will be rendered in the depth prepass. This is faster to render than alpha + * blending, but slower than opaque rendering. This also supports casting shadows. + */ + TRANSPARENCY_ALPHA_SCISSOR(2), + /** + * The material will cut off all values below a spatially-deterministic threshold, the rest will + * remain opaque. This is faster to render than alpha blending, but slower than opaque rendering. + * This also supports casting shadows. Alpha hashing is suited for hair rendering. + */ + TRANSPARENCY_ALPHA_HASH(3), + /** + * The material will use the texture's alpha value for transparency, but will discard fragments + * with an alpha of less than 0.99 during the depth prepass and fragments with an alpha less than + * 0.1 during the shadow pass. This also supports casting shadows. + */ + TRANSPARENCY_ALPHA_DEPTH_PRE_PASS(4), + /** + * Represents the size of the [Transparency] enum. + */ + TRANSPARENCY_MAX(5), + ; + + public val id: Long + init { + this.id = id + } + + public companion object { + public fun from(`value`: Long): Transparency = entries.single { it.id == `value` } + } + } + + public enum class ShadingMode( + id: Long, + ) { + /** + * The object will not receive shadows. This is the fastest to render, but it disables all + * interactions with lights. + */ + SHADING_MODE_UNSHADED(0), + /** + * The object will be shaded per pixel. Useful for realistic shading effects. + */ + SHADING_MODE_PER_PIXEL(1), + /** + * The object will be shaded per vertex. Useful when you want cheaper shaders and do not care + * about visual quality. Not implemented yet (this mode will act like [SHADING_MODE_PER_PIXEL]). + */ + SHADING_MODE_PER_VERTEX(2), + /** + * Represents the size of the [ShadingMode] enum. + */ + SHADING_MODE_MAX(3), + ; + + public val id: Long + init { + this.id = id + } + + public companion object { + public fun from(`value`: Long): ShadingMode = entries.single { it.id == `value` } + } + } + + public enum class Feature( + id: Long, + ) { + /** + * Constant for setting [emissionEnabled]. + */ + FEATURE_EMISSION(0), + /** + * Constant for setting [normalEnabled]. + */ + FEATURE_NORMAL_MAPPING(1), + /** + * Constant for setting [rimEnabled]. + */ + FEATURE_RIM(2), + /** + * Constant for setting [clearcoatEnabled]. + */ + FEATURE_CLEARCOAT(3), + /** + * Constant for setting [anisotropyEnabled]. + */ + FEATURE_ANISOTROPY(4), + /** + * Constant for setting [aoEnabled]. + */ + FEATURE_AMBIENT_OCCLUSION(5), + /** + * Constant for setting [heightmapEnabled]. + */ + FEATURE_HEIGHT_MAPPING(6), + /** + * Constant for setting [subsurfScatterEnabled]. + */ + FEATURE_SUBSURFACE_SCATTERING(7), + /** + * Constant for setting [subsurfScatterTransmittanceEnabled]. + */ + FEATURE_SUBSURFACE_TRANSMITTANCE(8), + /** + * Constant for setting [backlightEnabled]. + */ + FEATURE_BACKLIGHT(9), + /** + * Constant for setting [refractionEnabled]. + */ + FEATURE_REFRACTION(10), + /** + * Constant for setting [detailEnabled]. + */ + FEATURE_DETAIL(11), + /** + * Represents the size of the [Feature] enum. + */ + FEATURE_MAX(12), + ; + + public val id: Long + init { + this.id = id + } + + public companion object { + public fun from(`value`: Long): Feature = entries.single { it.id == `value` } + } + } + + public enum class BlendMode( + id: Long, + ) { + /** + * Default blend mode. The color of the object is blended over the background based on the + * object's alpha value. + */ + BLEND_MODE_MIX(0), + /** + * The color of the object is added to the background. + */ + BLEND_MODE_ADD(1), + /** + * The color of the object is subtracted from the background. + */ + BLEND_MODE_SUB(2), + /** + * The color of the object is multiplied by the background. + */ + BLEND_MODE_MUL(3), + /** + * The color of the object is added to the background and the alpha channel is used to mask out + * the background. This is effectively a hybrid of the blend mix and add modes, useful for effects + * like fire where you want the flame to add but the smoke to mix. By default, this works with + * unshaded materials using premultiplied textures. For shaded materials, use the + * `PREMUL_ALPHA_FACTOR` built-in so that lighting can be modulated as well. + */ + BLEND_MODE_PREMULT_ALPHA(4), + ; + + public val id: Long + init { + this.id = id + } + + public companion object { + public fun from(`value`: Long): BlendMode = entries.single { it.id == `value` } + } + } + + public enum class AlphaAntiAliasing( + id: Long, + ) { + /** + * Disables Alpha AntiAliasing for the material. + */ + ALPHA_ANTIALIASING_OFF(0), + /** + * Enables AlphaToCoverage. Alpha values in the material are passed to the AntiAliasing sample + * mask. + */ + ALPHA_ANTIALIASING_ALPHA_TO_COVERAGE(1), + /** + * Enables AlphaToCoverage and forces all non-zero alpha values to `1`. Alpha values in the + * material are passed to the AntiAliasing sample mask. + */ + ALPHA_ANTIALIASING_ALPHA_TO_COVERAGE_AND_TO_ONE(2), + ; + + public val id: Long + init { + this.id = id + } + + public companion object { + public fun from(`value`: Long): AlphaAntiAliasing = entries.single { it.id == `value` } + } + } + + public enum class DepthDrawMode( + id: Long, + ) { + /** + * Default depth draw mode. Depth is drawn only for opaque objects during the opaque prepass (if + * any) and during the opaque pass. + */ + DEPTH_DRAW_OPAQUE_ONLY(0), + /** + * Objects will write to depth during the opaque and the transparent passes. Transparent objects + * that are close to the camera may obscure other transparent objects behind them. + * **Note:** This does not influence whether transparent objects are included in the depth + * prepass or not. For that, see [Transparency]. + */ + DEPTH_DRAW_ALWAYS(1), + /** + * Objects will not write their depth to the depth buffer, even during the depth prepass (if + * enabled). + */ + DEPTH_DRAW_DISABLED(2), + ; + + public val id: Long + init { + this.id = id + } + + public companion object { + public fun from(`value`: Long): DepthDrawMode = entries.single { it.id == `value` } + } + } + + public enum class CullMode( + id: Long, + ) { + /** + * Default cull mode. The back of the object is culled when not visible. Back face triangles + * will be culled when facing the camera. This results in only the front side of triangles being + * drawn. For closed-surface meshes, this means that only the exterior of the mesh will be visible. + */ + CULL_BACK(0), + /** + * Front face triangles will be culled when facing the camera. This results in only the back + * side of triangles being drawn. For closed-surface meshes, this means that the interior of the + * mesh will be drawn instead of the exterior. + */ + CULL_FRONT(1), + /** + * No face culling is performed; both the front face and back face will be visible. + */ + CULL_DISABLED(2), + ; + + public val id: Long + init { + this.id = id + } + + public companion object { + public fun from(`value`: Long): CullMode = entries.single { it.id == `value` } + } + } + + public enum class Flags( + id: Long, + ) { + /** + * Disables the depth test, so this object is drawn on top of all others drawn before it. This + * puts the object in the transparent draw pass where it is sorted based on distance to camera. + * Objects drawn after it in the draw order may cover it. This also disables writing to depth. + */ + FLAG_DISABLE_DEPTH_TEST(0), + /** + * Set `ALBEDO` to the per-vertex color specified in the mesh. + */ + FLAG_ALBEDO_FROM_VERTEX_COLOR(1), + /** + * Vertex colors are considered to be stored in sRGB color space and are converted to linear + * color space during rendering. See also [vertexColorIsSrgb]. + * **Note:** Only effective when using the Forward+ and Mobile rendering methods. + */ + FLAG_SRGB_VERTEX_COLOR(2), + /** + * Uses point size to alter the size of primitive points. Also changes the albedo texture lookup + * to use `POINT_COORD` instead of `UV`. + */ + FLAG_USE_POINT_SIZE(3), + /** + * Object is scaled by depth so that it always appears the same size on screen. + */ + FLAG_FIXED_SIZE(4), + /** + * Shader will keep the scale set for the mesh. Otherwise the scale is lost when billboarding. + * Only applies when [billboardMode] is [BILLBOARD_ENABLED]. + */ + FLAG_BILLBOARD_KEEP_SCALE(5), + /** + * Use triplanar texture lookup for all texture lookups that would normally use `UV`. + */ + FLAG_UV1_USE_TRIPLANAR(6), + /** + * Use triplanar texture lookup for all texture lookups that would normally use `UV2`. + */ + FLAG_UV2_USE_TRIPLANAR(7), + /** + * Use triplanar texture lookup for all texture lookups that would normally use `UV`. + */ + FLAG_UV1_USE_WORLD_TRIPLANAR(8), + /** + * Use triplanar texture lookup for all texture lookups that would normally use `UV2`. + */ + FLAG_UV2_USE_WORLD_TRIPLANAR(9), + /** + * Use `UV2` coordinates to look up from the [aoTexture]. + */ + FLAG_AO_ON_UV2(10), + /** + * Use `UV2` coordinates to look up from the [emissionTexture]. + */ + FLAG_EMISSION_ON_UV2(11), + /** + * Forces the shader to convert albedo from sRGB space to linear space. See also + * [albedoTextureForceSrgb]. + */ + FLAG_ALBEDO_TEXTURE_FORCE_SRGB(12), + /** + * Disables receiving shadows from other objects. + */ + FLAG_DONT_RECEIVE_SHADOWS(13), + /** + * Disables receiving ambient light. + */ + FLAG_DISABLE_AMBIENT_LIGHT(14), + /** + * Enables the shadow to opacity feature. + */ + FLAG_USE_SHADOW_TO_OPACITY(15), + /** + * Enables the texture to repeat when UV coordinates are outside the 0-1 range. If using one of + * the linear filtering modes, this can result in artifacts at the edges of a texture when the + * sampler filters across the edges of the texture. + */ + FLAG_USE_TEXTURE_REPEAT(16), + /** + * Invert values read from a depth texture to convert them to height values (heightmap). + */ + FLAG_INVERT_HEIGHTMAP(17), + /** + * Enables the skin mode for subsurface scattering which is used to improve the look of + * subsurface scattering when used for human skin. + */ + FLAG_SUBSURFACE_MODE_SKIN(18), + /** + * Enables parts of the shader required for [GPUParticles3D] trails to function. This also + * requires using a mesh with appropriate skinning, such as [RibbonTrailMesh] or [TubeTrailMesh]. + * Enabling this feature outside of materials used in [GPUParticles3D] meshes will break material + * rendering. + */ + FLAG_PARTICLE_TRAILS_MODE(19), + /** + * Enables multichannel signed distance field rendering shader. + */ + FLAG_ALBEDO_TEXTURE_MSDF(20), + /** + * Disables receiving depth-based or volumetric fog. + */ + FLAG_DISABLE_FOG(21), + /** + * Represents the size of the [Flags] enum. + */ + FLAG_MAX(22), + ; + + public val id: Long + init { + this.id = id + } + + public companion object { + public fun from(`value`: Long): Flags = entries.single { it.id == `value` } + } + } + + public enum class DiffuseMode( + id: Long, + ) { + /** + * Default diffuse scattering algorithm. + */ + DIFFUSE_BURLEY(0), + /** + * Diffuse scattering ignores roughness. + */ + DIFFUSE_LAMBERT(1), + /** + * Extends Lambert to cover more than 90 degrees when roughness increases. + */ + DIFFUSE_LAMBERT_WRAP(2), + /** + * Uses a hard cut for lighting, with smoothing affected by roughness. + */ + DIFFUSE_TOON(3), + ; + + public val id: Long + init { + this.id = id + } + + public companion object { + public fun from(`value`: Long): DiffuseMode = entries.single { it.id == `value` } + } + } + + public enum class SpecularMode( + id: Long, + ) { + /** + * Default specular blob. + */ + SPECULAR_SCHLICK_GGX(0), + /** + * Toon blob which changes size based on roughness. + */ + SPECULAR_TOON(1), + /** + * No specular blob. This is slightly faster to render than other specular modes. + */ + SPECULAR_DISABLED(2), + ; + + public val id: Long + init { + this.id = id + } + + public companion object { + public fun from(`value`: Long): SpecularMode = entries.single { it.id == `value` } + } + } + + public enum class BillboardMode( + id: Long, + ) { + /** + * Billboard mode is disabled. + */ + BILLBOARD_DISABLED(0), + /** + * The object's Z axis will always face the camera. + */ + BILLBOARD_ENABLED(1), + /** + * The object's X axis will always face the camera. + */ + BILLBOARD_FIXED_Y(2), + /** + * Used for particle systems when assigned to [GPUParticles3D] and [CPUParticles3D] nodes + * (flipbook animation). Enables `particles_anim_*` properties. + * The [ParticleProcessMaterial.animSpeedMin] or [CPUParticles3D.animSpeedMin] should also be + * set to a value bigger than zero for the animation to play. + */ + BILLBOARD_PARTICLES(3), + ; + + public val id: Long + init { + this.id = id + } + + public companion object { + public fun from(`value`: Long): BillboardMode = entries.single { it.id == `value` } + } + } + + public enum class TextureChannel( + id: Long, + ) { + /** + * Used to read from the red channel of a texture. + */ + TEXTURE_CHANNEL_RED(0), + /** + * Used to read from the green channel of a texture. + */ + TEXTURE_CHANNEL_GREEN(1), + /** + * Used to read from the blue channel of a texture. + */ + TEXTURE_CHANNEL_BLUE(2), + /** + * Used to read from the alpha channel of a texture. + */ + TEXTURE_CHANNEL_ALPHA(3), + /** + * Used to read from the linear (non-perceptual) average of the red, green and blue channels of + * a texture. + */ + TEXTURE_CHANNEL_GRAYSCALE(4), + ; + + public val id: Long + init { + this.id = id + } + + public companion object { + public fun from(`value`: Long): TextureChannel = entries.single { it.id == `value` } + } + } + + public enum class EmissionOperator( + id: Long, + ) { + /** + * Adds the emission color to the color from the emission texture. + */ + EMISSION_OP_ADD(0), + /** + * Multiplies the emission color by the color from the emission texture. + */ + EMISSION_OP_MULTIPLY(1), + ; + + public val id: Long + init { + this.id = id + } + + public companion object { + public fun from(`value`: Long): EmissionOperator = entries.single { it.id == `value` } + } + } + + public enum class DistanceFadeMode( + id: Long, + ) { + /** + * Do not use distance fade. + */ + DISTANCE_FADE_DISABLED(0), + /** + * Smoothly fades the object out based on each pixel's distance from the camera using the alpha + * channel. + */ + DISTANCE_FADE_PIXEL_ALPHA(1), + /** + * Smoothly fades the object out based on each pixel's distance from the camera using a + * dithering approach. Dithering discards pixels based on a set pattern to smoothly fade without + * enabling transparency. On certain hardware, this can be faster than [DISTANCE_FADE_PIXEL_ALPHA]. + */ + DISTANCE_FADE_PIXEL_DITHER(2), + /** + * Smoothly fades the object out based on the object's distance from the camera using a + * dithering approach. Dithering discards pixels based on a set pattern to smoothly fade without + * enabling transparency. On certain hardware, this can be faster than [DISTANCE_FADE_PIXEL_ALPHA] + * and [DISTANCE_FADE_PIXEL_DITHER]. + */ + DISTANCE_FADE_OBJECT_DITHER(3), + ; + + public val id: Long + init { + this.id = id + } + + public companion object { + public fun from(`value`: Long): DistanceFadeMode = entries.single { it.id == `value` } + } + } + + public companion object + + public object MethodBindings { + internal val setAlbedoPtr: VoidPtr = + Internals.getMethodBindPtr("BaseMaterial3D", "set_albedo", 2920490490) + + internal val getAlbedoPtr: VoidPtr = + Internals.getMethodBindPtr("BaseMaterial3D", "get_albedo", 3444240500) + + internal val setTransparencyPtr: VoidPtr = + Internals.getMethodBindPtr("BaseMaterial3D", "set_transparency", 3435651667) + + internal val getTransparencyPtr: VoidPtr = + Internals.getMethodBindPtr("BaseMaterial3D", "get_transparency", 990903061) + + internal val setAlphaAntialiasingPtr: VoidPtr = + Internals.getMethodBindPtr("BaseMaterial3D", "set_alpha_antialiasing", 3212649852) + + internal val getAlphaAntialiasingPtr: VoidPtr = + Internals.getMethodBindPtr("BaseMaterial3D", "get_alpha_antialiasing", 2889939400) + + internal val setAlphaAntialiasingEdgePtr: VoidPtr = + Internals.getMethodBindPtr("BaseMaterial3D", "set_alpha_antialiasing_edge", 373806689) + + internal val getAlphaAntialiasingEdgePtr: VoidPtr = + Internals.getMethodBindPtr("BaseMaterial3D", "get_alpha_antialiasing_edge", 1740695150) + + internal val setShadingModePtr: VoidPtr = + Internals.getMethodBindPtr("BaseMaterial3D", "set_shading_mode", 3368750322) + + internal val getShadingModePtr: VoidPtr = + Internals.getMethodBindPtr("BaseMaterial3D", "get_shading_mode", 2132070559) + + internal val setSpecularPtr: VoidPtr = + Internals.getMethodBindPtr("BaseMaterial3D", "set_specular", 373806689) + + internal val getSpecularPtr: VoidPtr = + Internals.getMethodBindPtr("BaseMaterial3D", "get_specular", 1740695150) + + internal val setMetallicPtr: VoidPtr = + Internals.getMethodBindPtr("BaseMaterial3D", "set_metallic", 373806689) + + internal val getMetallicPtr: VoidPtr = + Internals.getMethodBindPtr("BaseMaterial3D", "get_metallic", 1740695150) + + internal val setRoughnessPtr: VoidPtr = + Internals.getMethodBindPtr("BaseMaterial3D", "set_roughness", 373806689) + + internal val getRoughnessPtr: VoidPtr = + Internals.getMethodBindPtr("BaseMaterial3D", "get_roughness", 1740695150) + + internal val setEmissionPtr: VoidPtr = + Internals.getMethodBindPtr("BaseMaterial3D", "set_emission", 2920490490) + + internal val getEmissionPtr: VoidPtr = + Internals.getMethodBindPtr("BaseMaterial3D", "get_emission", 3444240500) + + internal val setEmissionEnergyMultiplierPtr: VoidPtr = + Internals.getMethodBindPtr("BaseMaterial3D", "set_emission_energy_multiplier", 373806689) + + internal val getEmissionEnergyMultiplierPtr: VoidPtr = + Internals.getMethodBindPtr("BaseMaterial3D", "get_emission_energy_multiplier", 1740695150) + + internal val setEmissionIntensityPtr: VoidPtr = + Internals.getMethodBindPtr("BaseMaterial3D", "set_emission_intensity", 373806689) + + internal val getEmissionIntensityPtr: VoidPtr = + Internals.getMethodBindPtr("BaseMaterial3D", "get_emission_intensity", 1740695150) + + internal val setNormalScalePtr: VoidPtr = + Internals.getMethodBindPtr("BaseMaterial3D", "set_normal_scale", 373806689) + + internal val getNormalScalePtr: VoidPtr = + Internals.getMethodBindPtr("BaseMaterial3D", "get_normal_scale", 1740695150) + + internal val setRimPtr: VoidPtr = + Internals.getMethodBindPtr("BaseMaterial3D", "set_rim", 373806689) + + internal val getRimPtr: VoidPtr = + Internals.getMethodBindPtr("BaseMaterial3D", "get_rim", 1740695150) + + internal val setRimTintPtr: VoidPtr = + Internals.getMethodBindPtr("BaseMaterial3D", "set_rim_tint", 373806689) + + internal val getRimTintPtr: VoidPtr = + Internals.getMethodBindPtr("BaseMaterial3D", "get_rim_tint", 1740695150) + + internal val setClearcoatPtr: VoidPtr = + Internals.getMethodBindPtr("BaseMaterial3D", "set_clearcoat", 373806689) + + internal val getClearcoatPtr: VoidPtr = + Internals.getMethodBindPtr("BaseMaterial3D", "get_clearcoat", 1740695150) + + internal val setClearcoatRoughnessPtr: VoidPtr = + Internals.getMethodBindPtr("BaseMaterial3D", "set_clearcoat_roughness", 373806689) + + internal val getClearcoatRoughnessPtr: VoidPtr = + Internals.getMethodBindPtr("BaseMaterial3D", "get_clearcoat_roughness", 1740695150) + + internal val setAnisotropyPtr: VoidPtr = + Internals.getMethodBindPtr("BaseMaterial3D", "set_anisotropy", 373806689) + + internal val getAnisotropyPtr: VoidPtr = + Internals.getMethodBindPtr("BaseMaterial3D", "get_anisotropy", 1740695150) + + internal val setHeightmapScalePtr: VoidPtr = + Internals.getMethodBindPtr("BaseMaterial3D", "set_heightmap_scale", 373806689) + + internal val getHeightmapScalePtr: VoidPtr = + Internals.getMethodBindPtr("BaseMaterial3D", "get_heightmap_scale", 1740695150) + + internal val setSubsurfaceScatteringStrengthPtr: VoidPtr = + Internals.getMethodBindPtr("BaseMaterial3D", "set_subsurface_scattering_strength", 373806689) + + internal val getSubsurfaceScatteringStrengthPtr: VoidPtr = + Internals.getMethodBindPtr("BaseMaterial3D", "get_subsurface_scattering_strength", 1740695150) + + internal val setTransmittanceColorPtr: VoidPtr = + Internals.getMethodBindPtr("BaseMaterial3D", "set_transmittance_color", 2920490490) + + internal val getTransmittanceColorPtr: VoidPtr = + Internals.getMethodBindPtr("BaseMaterial3D", "get_transmittance_color", 3444240500) + + internal val setTransmittanceDepthPtr: VoidPtr = + Internals.getMethodBindPtr("BaseMaterial3D", "set_transmittance_depth", 373806689) + + internal val getTransmittanceDepthPtr: VoidPtr = + Internals.getMethodBindPtr("BaseMaterial3D", "get_transmittance_depth", 1740695150) + + internal val setTransmittanceBoostPtr: VoidPtr = + Internals.getMethodBindPtr("BaseMaterial3D", "set_transmittance_boost", 373806689) + + internal val getTransmittanceBoostPtr: VoidPtr = + Internals.getMethodBindPtr("BaseMaterial3D", "get_transmittance_boost", 1740695150) + + internal val setBacklightPtr: VoidPtr = + Internals.getMethodBindPtr("BaseMaterial3D", "set_backlight", 2920490490) + + internal val getBacklightPtr: VoidPtr = + Internals.getMethodBindPtr("BaseMaterial3D", "get_backlight", 3444240500) + + internal val setRefractionPtr: VoidPtr = + Internals.getMethodBindPtr("BaseMaterial3D", "set_refraction", 373806689) + + internal val getRefractionPtr: VoidPtr = + Internals.getMethodBindPtr("BaseMaterial3D", "get_refraction", 1740695150) + + internal val setPointSizePtr: VoidPtr = + Internals.getMethodBindPtr("BaseMaterial3D", "set_point_size", 373806689) + + internal val getPointSizePtr: VoidPtr = + Internals.getMethodBindPtr("BaseMaterial3D", "get_point_size", 1740695150) + + internal val setDetailUvPtr: VoidPtr = + Internals.getMethodBindPtr("BaseMaterial3D", "set_detail_uv", 456801921) + + internal val getDetailUvPtr: VoidPtr = + Internals.getMethodBindPtr("BaseMaterial3D", "get_detail_uv", 2306920512) + + internal val setBlendModePtr: VoidPtr = + Internals.getMethodBindPtr("BaseMaterial3D", "set_blend_mode", 2830186259) + + internal val getBlendModePtr: VoidPtr = + Internals.getMethodBindPtr("BaseMaterial3D", "get_blend_mode", 4022690962) + + internal val setDepthDrawModePtr: VoidPtr = + Internals.getMethodBindPtr("BaseMaterial3D", "set_depth_draw_mode", 1456584748) + + internal val getDepthDrawModePtr: VoidPtr = + Internals.getMethodBindPtr("BaseMaterial3D", "get_depth_draw_mode", 2578197639) + + internal val setCullModePtr: VoidPtr = + Internals.getMethodBindPtr("BaseMaterial3D", "set_cull_mode", 2338909218) + + internal val getCullModePtr: VoidPtr = + Internals.getMethodBindPtr("BaseMaterial3D", "get_cull_mode", 1941499586) + + internal val setDiffuseModePtr: VoidPtr = + Internals.getMethodBindPtr("BaseMaterial3D", "set_diffuse_mode", 1045299638) + + internal val getDiffuseModePtr: VoidPtr = + Internals.getMethodBindPtr("BaseMaterial3D", "get_diffuse_mode", 3973617136) + + internal val setSpecularModePtr: VoidPtr = + Internals.getMethodBindPtr("BaseMaterial3D", "set_specular_mode", 584737147) + + internal val getSpecularModePtr: VoidPtr = + Internals.getMethodBindPtr("BaseMaterial3D", "get_specular_mode", 2569953298) + + internal val setFlagPtr: VoidPtr = + Internals.getMethodBindPtr("BaseMaterial3D", "set_flag", 3070159527) + + internal val getFlagPtr: VoidPtr = + Internals.getMethodBindPtr("BaseMaterial3D", "get_flag", 1286410065) + + internal val setTextureFilterPtr: VoidPtr = + Internals.getMethodBindPtr("BaseMaterial3D", "set_texture_filter", 22904437) + + internal val getTextureFilterPtr: VoidPtr = + Internals.getMethodBindPtr("BaseMaterial3D", "get_texture_filter", 3289213076) + + internal val setFeaturePtr: VoidPtr = + Internals.getMethodBindPtr("BaseMaterial3D", "set_feature", 2819288693) + + internal val getFeaturePtr: VoidPtr = + Internals.getMethodBindPtr("BaseMaterial3D", "get_feature", 1965241794) + + internal val setTexturePtr: VoidPtr = + Internals.getMethodBindPtr("BaseMaterial3D", "set_texture", 464208135) + + internal val getTexturePtr: VoidPtr = + Internals.getMethodBindPtr("BaseMaterial3D", "get_texture", 329605813) + + internal val setDetailBlendModePtr: VoidPtr = + Internals.getMethodBindPtr("BaseMaterial3D", "set_detail_blend_mode", 2830186259) + + internal val getDetailBlendModePtr: VoidPtr = + Internals.getMethodBindPtr("BaseMaterial3D", "get_detail_blend_mode", 4022690962) + + internal val setUv1ScalePtr: VoidPtr = + Internals.getMethodBindPtr("BaseMaterial3D", "set_uv1_scale", 3460891852) + + internal val getUv1ScalePtr: VoidPtr = + Internals.getMethodBindPtr("BaseMaterial3D", "get_uv1_scale", 3360562783) + + internal val setUv1OffsetPtr: VoidPtr = + Internals.getMethodBindPtr("BaseMaterial3D", "set_uv1_offset", 3460891852) + + internal val getUv1OffsetPtr: VoidPtr = + Internals.getMethodBindPtr("BaseMaterial3D", "get_uv1_offset", 3360562783) + + internal val setUv1TriplanarBlendSharpnessPtr: VoidPtr = + Internals.getMethodBindPtr("BaseMaterial3D", "set_uv1_triplanar_blend_sharpness", 373806689) + + internal val getUv1TriplanarBlendSharpnessPtr: VoidPtr = + Internals.getMethodBindPtr("BaseMaterial3D", "get_uv1_triplanar_blend_sharpness", 1740695150) + + internal val setUv2ScalePtr: VoidPtr = + Internals.getMethodBindPtr("BaseMaterial3D", "set_uv2_scale", 3460891852) + + internal val getUv2ScalePtr: VoidPtr = + Internals.getMethodBindPtr("BaseMaterial3D", "get_uv2_scale", 3360562783) + + internal val setUv2OffsetPtr: VoidPtr = + Internals.getMethodBindPtr("BaseMaterial3D", "set_uv2_offset", 3460891852) + + internal val getUv2OffsetPtr: VoidPtr = + Internals.getMethodBindPtr("BaseMaterial3D", "get_uv2_offset", 3360562783) + + internal val setUv2TriplanarBlendSharpnessPtr: VoidPtr = + Internals.getMethodBindPtr("BaseMaterial3D", "set_uv2_triplanar_blend_sharpness", 373806689) + + internal val getUv2TriplanarBlendSharpnessPtr: VoidPtr = + Internals.getMethodBindPtr("BaseMaterial3D", "get_uv2_triplanar_blend_sharpness", 1740695150) + + internal val setBillboardModePtr: VoidPtr = + Internals.getMethodBindPtr("BaseMaterial3D", "set_billboard_mode", 4202036497) + + internal val getBillboardModePtr: VoidPtr = + Internals.getMethodBindPtr("BaseMaterial3D", "get_billboard_mode", 1283840139) + + internal val setParticlesAnimHFramesPtr: VoidPtr = + Internals.getMethodBindPtr("BaseMaterial3D", "set_particles_anim_h_frames", 1286410249) + + internal val getParticlesAnimHFramesPtr: VoidPtr = + Internals.getMethodBindPtr("BaseMaterial3D", "get_particles_anim_h_frames", 3905245786) + + internal val setParticlesAnimVFramesPtr: VoidPtr = + Internals.getMethodBindPtr("BaseMaterial3D", "set_particles_anim_v_frames", 1286410249) + + internal val getParticlesAnimVFramesPtr: VoidPtr = + Internals.getMethodBindPtr("BaseMaterial3D", "get_particles_anim_v_frames", 3905245786) + + internal val setParticlesAnimLoopPtr: VoidPtr = + Internals.getMethodBindPtr("BaseMaterial3D", "set_particles_anim_loop", 2586408642) + + internal val getParticlesAnimLoopPtr: VoidPtr = + Internals.getMethodBindPtr("BaseMaterial3D", "get_particles_anim_loop", 36873697) + + internal val setHeightmapDeepParallaxPtr: VoidPtr = + Internals.getMethodBindPtr("BaseMaterial3D", "set_heightmap_deep_parallax", 2586408642) + + internal val isHeightmapDeepParallaxEnabledPtr: VoidPtr = + Internals.getMethodBindPtr("BaseMaterial3D", "is_heightmap_deep_parallax_enabled", 36873697) + + internal val setHeightmapDeepParallaxMinLayersPtr: VoidPtr = + Internals.getMethodBindPtr("BaseMaterial3D", "set_heightmap_deep_parallax_min_layers", 1286410249) + + internal val getHeightmapDeepParallaxMinLayersPtr: VoidPtr = + Internals.getMethodBindPtr("BaseMaterial3D", "get_heightmap_deep_parallax_min_layers", 3905245786) + + internal val setHeightmapDeepParallaxMaxLayersPtr: VoidPtr = + Internals.getMethodBindPtr("BaseMaterial3D", "set_heightmap_deep_parallax_max_layers", 1286410249) + + internal val getHeightmapDeepParallaxMaxLayersPtr: VoidPtr = + Internals.getMethodBindPtr("BaseMaterial3D", "get_heightmap_deep_parallax_max_layers", 3905245786) + + internal val setHeightmapDeepParallaxFlipTangentPtr: VoidPtr = + Internals.getMethodBindPtr("BaseMaterial3D", "set_heightmap_deep_parallax_flip_tangent", 2586408642) + + internal val getHeightmapDeepParallaxFlipTangentPtr: VoidPtr = + Internals.getMethodBindPtr("BaseMaterial3D", "get_heightmap_deep_parallax_flip_tangent", 36873697) + + internal val setHeightmapDeepParallaxFlipBinormalPtr: VoidPtr = + Internals.getMethodBindPtr("BaseMaterial3D", "set_heightmap_deep_parallax_flip_binormal", 2586408642) + + internal val getHeightmapDeepParallaxFlipBinormalPtr: VoidPtr = + Internals.getMethodBindPtr("BaseMaterial3D", "get_heightmap_deep_parallax_flip_binormal", 36873697) + + internal val setGrowPtr: VoidPtr = + Internals.getMethodBindPtr("BaseMaterial3D", "set_grow", 373806689) + + internal val getGrowPtr: VoidPtr = + Internals.getMethodBindPtr("BaseMaterial3D", "get_grow", 1740695150) + + internal val setEmissionOperatorPtr: VoidPtr = + Internals.getMethodBindPtr("BaseMaterial3D", "set_emission_operator", 3825128922) + + internal val getEmissionOperatorPtr: VoidPtr = + Internals.getMethodBindPtr("BaseMaterial3D", "get_emission_operator", 974205018) + + internal val setAoLightAffectPtr: VoidPtr = + Internals.getMethodBindPtr("BaseMaterial3D", "set_ao_light_affect", 373806689) + + internal val getAoLightAffectPtr: VoidPtr = + Internals.getMethodBindPtr("BaseMaterial3D", "get_ao_light_affect", 1740695150) + + internal val setAlphaScissorThresholdPtr: VoidPtr = + Internals.getMethodBindPtr("BaseMaterial3D", "set_alpha_scissor_threshold", 373806689) + + internal val getAlphaScissorThresholdPtr: VoidPtr = + Internals.getMethodBindPtr("BaseMaterial3D", "get_alpha_scissor_threshold", 1740695150) + + internal val setAlphaHashScalePtr: VoidPtr = + Internals.getMethodBindPtr("BaseMaterial3D", "set_alpha_hash_scale", 373806689) + + internal val getAlphaHashScalePtr: VoidPtr = + Internals.getMethodBindPtr("BaseMaterial3D", "get_alpha_hash_scale", 1740695150) + + internal val setGrowEnabledPtr: VoidPtr = + Internals.getMethodBindPtr("BaseMaterial3D", "set_grow_enabled", 2586408642) + + internal val isGrowEnabledPtr: VoidPtr = + Internals.getMethodBindPtr("BaseMaterial3D", "is_grow_enabled", 36873697) + + internal val setMetallicTextureChannelPtr: VoidPtr = + Internals.getMethodBindPtr("BaseMaterial3D", "set_metallic_texture_channel", 744167988) + + internal val getMetallicTextureChannelPtr: VoidPtr = + Internals.getMethodBindPtr("BaseMaterial3D", "get_metallic_texture_channel", 568133867) + + internal val setRoughnessTextureChannelPtr: VoidPtr = + Internals.getMethodBindPtr("BaseMaterial3D", "set_roughness_texture_channel", 744167988) + + internal val getRoughnessTextureChannelPtr: VoidPtr = + Internals.getMethodBindPtr("BaseMaterial3D", "get_roughness_texture_channel", 568133867) + + internal val setAoTextureChannelPtr: VoidPtr = + Internals.getMethodBindPtr("BaseMaterial3D", "set_ao_texture_channel", 744167988) + + internal val getAoTextureChannelPtr: VoidPtr = + Internals.getMethodBindPtr("BaseMaterial3D", "get_ao_texture_channel", 568133867) + + internal val setRefractionTextureChannelPtr: VoidPtr = + Internals.getMethodBindPtr("BaseMaterial3D", "set_refraction_texture_channel", 744167988) + + internal val getRefractionTextureChannelPtr: VoidPtr = + Internals.getMethodBindPtr("BaseMaterial3D", "get_refraction_texture_channel", 568133867) + + internal val setProximityFadeEnabledPtr: VoidPtr = + Internals.getMethodBindPtr("BaseMaterial3D", "set_proximity_fade_enabled", 2586408642) + + internal val isProximityFadeEnabledPtr: VoidPtr = + Internals.getMethodBindPtr("BaseMaterial3D", "is_proximity_fade_enabled", 36873697) + + internal val setProximityFadeDistancePtr: VoidPtr = + Internals.getMethodBindPtr("BaseMaterial3D", "set_proximity_fade_distance", 373806689) + + internal val getProximityFadeDistancePtr: VoidPtr = + Internals.getMethodBindPtr("BaseMaterial3D", "get_proximity_fade_distance", 1740695150) + + internal val setMsdfPixelRangePtr: VoidPtr = + Internals.getMethodBindPtr("BaseMaterial3D", "set_msdf_pixel_range", 373806689) + + internal val getMsdfPixelRangePtr: VoidPtr = + Internals.getMethodBindPtr("BaseMaterial3D", "get_msdf_pixel_range", 1740695150) + + internal val setMsdfOutlineSizePtr: VoidPtr = + Internals.getMethodBindPtr("BaseMaterial3D", "set_msdf_outline_size", 373806689) + + internal val getMsdfOutlineSizePtr: VoidPtr = + Internals.getMethodBindPtr("BaseMaterial3D", "get_msdf_outline_size", 1740695150) + + internal val setDistanceFadePtr: VoidPtr = + Internals.getMethodBindPtr("BaseMaterial3D", "set_distance_fade", 1379478617) + + internal val getDistanceFadePtr: VoidPtr = + Internals.getMethodBindPtr("BaseMaterial3D", "get_distance_fade", 2694575734) + + internal val setDistanceFadeMaxDistancePtr: VoidPtr = + Internals.getMethodBindPtr("BaseMaterial3D", "set_distance_fade_max_distance", 373806689) + + internal val getDistanceFadeMaxDistancePtr: VoidPtr = + Internals.getMethodBindPtr("BaseMaterial3D", "get_distance_fade_max_distance", 1740695150) + + internal val setDistanceFadeMinDistancePtr: VoidPtr = + Internals.getMethodBindPtr("BaseMaterial3D", "set_distance_fade_min_distance", 373806689) + + internal val getDistanceFadeMinDistancePtr: VoidPtr = + Internals.getMethodBindPtr("BaseMaterial3D", "get_distance_fade_min_distance", 1740695150) + } +} diff --git a/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/BitMap.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/BitMap.kt new file mode 100644 index 0000000000..3c98e31e98 --- /dev/null +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/BitMap.kt @@ -0,0 +1,211 @@ +// THIS FILE IS GENERATED! DO NOT EDIT IT MANUALLY! +@file:Suppress("PackageDirectoryMismatch", "unused", "FunctionName", "RedundantModalityModifier", + "UNCHECKED_CAST", "JoinDeclarationAndAssignment", "USELESS_CAST", + "RemoveRedundantQualifierName", "NOTHING_TO_INLINE", "NON_FINAL_MEMBER_IN_OBJECT", + "RedundantVisibilityModifier", "RedundantUnitReturnType", "MemberVisibilityCanBePrivate") + +package godot + +import godot.`annotation`.GodotBaseType +import godot.core.PackedVector2Array +import godot.core.Rect2i +import godot.core.VariantArray +import godot.core.VariantParser.ARRAY +import godot.core.VariantParser.BOOL +import godot.core.VariantParser.DOUBLE +import godot.core.VariantParser.LONG +import godot.core.VariantParser.NIL +import godot.core.VariantParser.OBJECT +import godot.core.VariantParser.RECT2I +import godot.core.VariantParser.VECTOR2I +import godot.core.Vector2i +import godot.util.Internals +import godot.util.VoidPtr +import kotlin.Boolean +import kotlin.Float +import kotlin.Int +import kotlin.Long +import kotlin.Suppress +import kotlin.Unit +import kotlin.jvm.JvmOverloads + +private const val ENGINE_CLASS_BITMAP_INDEX: Int = 139 + +/** + * A two-dimensional array of boolean values, can be used to efficiently store a binary matrix + * (every matrix element takes only one bit) and query the values using natural cartesian coordinates. + */ +@GodotBaseType +public open class BitMap : Resource() { + public override fun new(scriptIndex: Int): Unit { + Internals.callConstructor(this, ENGINE_CLASS_BITMAP_INDEX, scriptIndex) + } + + /** + * Creates a bitmap with the specified size, filled with `false`. + */ + public final fun create(size: Vector2i): Unit { + Internals.writeArguments(VECTOR2I to size) + Internals.callMethod(rawPtr, MethodBindings.createPtr, NIL) + } + + /** + * Creates a bitmap that matches the given image dimensions, every element of the bitmap is set to + * `false` if the alpha value of the image at that position is equal to [threshold] or less, and + * `true` in other case. + */ + @JvmOverloads + public final fun createFromImageAlpha(image: Image?, threshold: Float = 0.1f): Unit { + Internals.writeArguments(OBJECT to image, DOUBLE to threshold.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.createFromImageAlphaPtr, NIL) + } + + /** + * Sets the bitmap's element at the specified position, to the specified value. + */ + public final fun setBitv(position: Vector2i, bit: Boolean): Unit { + Internals.writeArguments(VECTOR2I to position, BOOL to bit) + Internals.callMethod(rawPtr, MethodBindings.setBitvPtr, NIL) + } + + /** + * Sets the bitmap's element at the specified position, to the specified value. + */ + public final fun setBit( + x: Int, + y: Int, + bit: Boolean, + ): Unit { + Internals.writeArguments(LONG to x.toLong(), LONG to y.toLong(), BOOL to bit) + Internals.callMethod(rawPtr, MethodBindings.setBitPtr, NIL) + } + + /** + * Returns bitmap's value at the specified position. + */ + public final fun getBitv(position: Vector2i): Boolean { + Internals.writeArguments(VECTOR2I to position) + Internals.callMethod(rawPtr, MethodBindings.getBitvPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + /** + * Returns bitmap's value at the specified position. + */ + public final fun getBit(x: Int, y: Int): Boolean { + Internals.writeArguments(LONG to x.toLong(), LONG to y.toLong()) + Internals.callMethod(rawPtr, MethodBindings.getBitPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + /** + * Sets a rectangular portion of the bitmap to the specified value. + */ + public final fun setBitRect(rect: Rect2i, bit: Boolean): Unit { + Internals.writeArguments(RECT2I to rect, BOOL to bit) + Internals.callMethod(rawPtr, MethodBindings.setBitRectPtr, NIL) + } + + /** + * Returns the number of bitmap elements that are set to `true`. + */ + public final fun getTrueBitCount(): Int { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getTrueBitCountPtr, LONG) + return (Internals.readReturnValue(LONG) as Long).toInt() + } + + /** + * Returns bitmap's dimensions. + */ + public final fun getSize(): Vector2i { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getSizePtr, VECTOR2I) + return (Internals.readReturnValue(VECTOR2I) as Vector2i) + } + + /** + * Resizes the image to [newSize]. + */ + public final fun resize(newSize: Vector2i): Unit { + Internals.writeArguments(VECTOR2I to newSize) + Internals.callMethod(rawPtr, MethodBindings.resizePtr, NIL) + } + + /** + * Applies morphological dilation or erosion to the bitmap. If [pixels] is positive, dilation is + * applied to the bitmap. If [pixels] is negative, erosion is applied to the bitmap. [rect] defines + * the area where the morphological operation is applied. Pixels located outside the [rect] are + * unaffected by [growMask]. + */ + public final fun growMask(pixels: Int, rect: Rect2i): Unit { + Internals.writeArguments(LONG to pixels.toLong(), RECT2I to rect) + Internals.callMethod(rawPtr, MethodBindings.growMaskPtr, NIL) + } + + /** + * Returns an image of the same size as the bitmap and with a [Image.Format] of type + * [Image.FORMAT_L8]. `true` bits of the bitmap are being converted into white pixels, and `false` + * bits into black. + */ + public final fun convertToImage(): Image? { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.convertToImagePtr, OBJECT) + return (Internals.readReturnValue(OBJECT) as Image?) + } + + /** + * Creates an [Array] of polygons covering a rectangular portion of the bitmap. It uses a marching + * squares algorithm, followed by Ramer-Douglas-Peucker (RDP) reduction of the number of vertices. + * Each polygon is described as a [PackedVector2Array] of its vertices. + * To get polygons covering the whole bitmap, pass: + * [codeblock] + * Rect2(Vector2(), get_size()) + * [/codeblock] + * [epsilon] is passed to RDP to control how accurately the polygons cover the bitmap: a lower + * [epsilon] corresponds to more points in the polygons. + */ + @JvmOverloads + public final fun opaqueToPolygons(rect: Rect2i, epsilon: Float = 2.0f): + VariantArray { + Internals.writeArguments(RECT2I to rect, DOUBLE to epsilon.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.opaqueToPolygonsPtr, ARRAY) + return (Internals.readReturnValue(ARRAY) as VariantArray) + } + + public companion object + + public object MethodBindings { + internal val createPtr: VoidPtr = Internals.getMethodBindPtr("BitMap", "create", 1130785943) + + internal val createFromImageAlphaPtr: VoidPtr = + Internals.getMethodBindPtr("BitMap", "create_from_image_alpha", 106271684) + + internal val setBitvPtr: VoidPtr = Internals.getMethodBindPtr("BitMap", "set_bitv", 4153096796) + + internal val setBitPtr: VoidPtr = Internals.getMethodBindPtr("BitMap", "set_bit", 1383440665) + + internal val getBitvPtr: VoidPtr = Internals.getMethodBindPtr("BitMap", "get_bitv", 3900751641) + + internal val getBitPtr: VoidPtr = Internals.getMethodBindPtr("BitMap", "get_bit", 2522259332) + + internal val setBitRectPtr: VoidPtr = + Internals.getMethodBindPtr("BitMap", "set_bit_rect", 472162941) + + internal val getTrueBitCountPtr: VoidPtr = + Internals.getMethodBindPtr("BitMap", "get_true_bit_count", 3905245786) + + internal val getSizePtr: VoidPtr = Internals.getMethodBindPtr("BitMap", "get_size", 3690982128) + + internal val resizePtr: VoidPtr = Internals.getMethodBindPtr("BitMap", "resize", 1130785943) + + internal val growMaskPtr: VoidPtr = + Internals.getMethodBindPtr("BitMap", "grow_mask", 3317281434) + + internal val convertToImagePtr: VoidPtr = + Internals.getMethodBindPtr("BitMap", "convert_to_image", 4190603485) + + internal val opaqueToPolygonsPtr: VoidPtr = + Internals.getMethodBindPtr("BitMap", "opaque_to_polygons", 48478126) + } +} diff --git a/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/Bone2D.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/Bone2D.kt new file mode 100644 index 0000000000..881e106c4e --- /dev/null +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/Bone2D.kt @@ -0,0 +1,217 @@ +// THIS FILE IS GENERATED! DO NOT EDIT IT MANUALLY! +@file:Suppress("PackageDirectoryMismatch", "unused", "FunctionName", "RedundantModalityModifier", + "UNCHECKED_CAST", "JoinDeclarationAndAssignment", "USELESS_CAST", + "RemoveRedundantQualifierName", "NOTHING_TO_INLINE", "NON_FINAL_MEMBER_IN_OBJECT", + "RedundantVisibilityModifier", "RedundantUnitReturnType", "MemberVisibilityCanBePrivate") + +package godot + +import godot.`annotation`.CoreTypeHelper +import godot.`annotation`.CoreTypeLocalCopy +import godot.`annotation`.GodotBaseType +import godot.core.Transform2D +import godot.core.VariantParser.BOOL +import godot.core.VariantParser.DOUBLE +import godot.core.VariantParser.LONG +import godot.core.VariantParser.NIL +import godot.core.VariantParser.TRANSFORM2D +import godot.util.Internals +import godot.util.VoidPtr +import kotlin.Boolean +import kotlin.Double +import kotlin.Float +import kotlin.Int +import kotlin.Long +import kotlin.Suppress +import kotlin.Unit +import kotlin.jvm.JvmName + +private const val ENGINE_CLASS_BONE2D_INDEX: Int = 140 + +/** + * A hierarchy of [Bone2D]s can be bound to a [Skeleton2D] to control and animate other [Node2D] + * nodes. + * You can use [Bone2D] and [Skeleton2D] nodes to animate 2D meshes created with the [Polygon2D] UV + * editor. + * Each bone has a [rest] transform that you can reset to with [applyRest]. These rest poses are + * relative to the bone's parent. + * If in the editor, you can set the rest pose of an entire skeleton using a menu option, from the + * code, you need to iterate over the bones to set their individual rest poses. + */ +@GodotBaseType +public open class Bone2D : Node2D() { + /** + * Rest transform of the bone. You can reset the node's transforms to this value using + * [applyRest]. + */ + @CoreTypeLocalCopy + public final inline var rest: Transform2D + @JvmName("restProperty") + get() = getRest() + @JvmName("restProperty") + set(`value`) { + setRest(value) + } + + public override fun new(scriptIndex: Int): Unit { + Internals.callConstructor(this, ENGINE_CLASS_BONE2D_INDEX, scriptIndex) + } + + /** + * Rest transform of the bone. You can reset the node's transforms to this value using + * [applyRest]. + * + * This is a helper function to make dealing with local copies easier. + * + * For more information, see our + * [documentation](https://godot-kotl.in/en/stable/user-guide/api-differences/#core-types). + * + * Allow to directly modify the local copy of the property and assign it back to the Object. + * + * Prefer that over writing: + * `````` + * val myCoreType = bone2d.rest + * //Your changes + * bone2d.rest = myCoreType + * `````` + */ + @CoreTypeHelper + public final fun restMutate(block: Transform2D.() -> Unit): Transform2D = rest.apply{ + block(this) + rest = this + } + + + public final fun setRest(rest: Transform2D): Unit { + Internals.writeArguments(TRANSFORM2D to rest) + Internals.callMethod(rawPtr, MethodBindings.setRestPtr, NIL) + } + + public final fun getRest(): Transform2D { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getRestPtr, TRANSFORM2D) + return (Internals.readReturnValue(TRANSFORM2D) as Transform2D) + } + + /** + * Resets the bone to the rest pose. This is equivalent to setting [Node2D.transform] to [rest]. + */ + public final fun applyRest(): Unit { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.applyRestPtr, NIL) + } + + /** + * Returns the node's [rest] [Transform2D] if it doesn't have a parent, or its rest pose relative + * to its parent. + */ + public final fun getSkeletonRest(): Transform2D { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getSkeletonRestPtr, TRANSFORM2D) + return (Internals.readReturnValue(TRANSFORM2D) as Transform2D) + } + + /** + * Returns the node's index as part of the entire skeleton. See [Skeleton2D]. + */ + public final fun getIndexInSkeleton(): Int { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getIndexInSkeletonPtr, LONG) + return (Internals.readReturnValue(LONG) as Long).toInt() + } + + /** + * When set to `true`, the [Bone2D] node will attempt to automatically calculate the bone angle + * and length using the first child [Bone2D] node, if one exists. If none exist, the [Bone2D] cannot + * automatically calculate these values and will print a warning. + */ + public final fun setAutocalculateLengthAndAngle(autoCalculate: Boolean): Unit { + Internals.writeArguments(BOOL to autoCalculate) + Internals.callMethod(rawPtr, MethodBindings.setAutocalculateLengthAndAnglePtr, NIL) + } + + /** + * Returns whether this [Bone2D] is going to autocalculate its length and bone angle using its + * first [Bone2D] child node, if one exists. If there are no [Bone2D] children, then it cannot + * autocalculate these values and will print a warning. + */ + public final fun getAutocalculateLengthAndAngle(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getAutocalculateLengthAndAnglePtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + /** + * Sets the length of the bone in the [Bone2D]. + */ + public final fun setLength(length: Float): Unit { + Internals.writeArguments(DOUBLE to length.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setLengthPtr, NIL) + } + + /** + * Returns the length of the bone in the [Bone2D] node. + */ + public final fun getLength(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getLengthPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + /** + * Sets the bone angle for the [Bone2D]. This is typically set to the rotation from the [Bone2D] + * to a child [Bone2D] node. + * **Note:** This is different from the [Bone2D]'s rotation. The bone's angle is the rotation of + * the bone shown by the gizmo, which is unaffected by the [Bone2D]'s [Node2D.transform]. + */ + public final fun setBoneAngle(angle: Float): Unit { + Internals.writeArguments(DOUBLE to angle.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setBoneAnglePtr, NIL) + } + + /** + * Returns the angle of the bone in the [Bone2D]. + * **Note:** This is different from the [Bone2D]'s rotation. The bone's angle is the rotation of + * the bone shown by the gizmo, which is unaffected by the [Bone2D]'s [Node2D.transform]. + */ + public final fun getBoneAngle(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getBoneAnglePtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public companion object + + public object MethodBindings { + internal val setRestPtr: VoidPtr = Internals.getMethodBindPtr("Bone2D", "set_rest", 2761652528) + + internal val getRestPtr: VoidPtr = Internals.getMethodBindPtr("Bone2D", "get_rest", 3814499831) + + internal val applyRestPtr: VoidPtr = + Internals.getMethodBindPtr("Bone2D", "apply_rest", 3218959716) + + internal val getSkeletonRestPtr: VoidPtr = + Internals.getMethodBindPtr("Bone2D", "get_skeleton_rest", 3814499831) + + internal val getIndexInSkeletonPtr: VoidPtr = + Internals.getMethodBindPtr("Bone2D", "get_index_in_skeleton", 3905245786) + + internal val setAutocalculateLengthAndAnglePtr: VoidPtr = + Internals.getMethodBindPtr("Bone2D", "set_autocalculate_length_and_angle", 2586408642) + + internal val getAutocalculateLengthAndAnglePtr: VoidPtr = + Internals.getMethodBindPtr("Bone2D", "get_autocalculate_length_and_angle", 36873697) + + internal val setLengthPtr: VoidPtr = + Internals.getMethodBindPtr("Bone2D", "set_length", 373806689) + + internal val getLengthPtr: VoidPtr = + Internals.getMethodBindPtr("Bone2D", "get_length", 1740695150) + + internal val setBoneAnglePtr: VoidPtr = + Internals.getMethodBindPtr("Bone2D", "set_bone_angle", 373806689) + + internal val getBoneAnglePtr: VoidPtr = + Internals.getMethodBindPtr("Bone2D", "get_bone_angle", 1740695150) + } +} diff --git a/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/BoneAttachment3D.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/BoneAttachment3D.kt new file mode 100644 index 0000000000..70c3cddea9 --- /dev/null +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/BoneAttachment3D.kt @@ -0,0 +1,194 @@ +// THIS FILE IS GENERATED! DO NOT EDIT IT MANUALLY! +@file:Suppress("PackageDirectoryMismatch", "unused", "FunctionName", "RedundantModalityModifier", + "UNCHECKED_CAST", "JoinDeclarationAndAssignment", "USELESS_CAST", + "RemoveRedundantQualifierName", "NOTHING_TO_INLINE", "NON_FINAL_MEMBER_IN_OBJECT", + "RedundantVisibilityModifier", "RedundantUnitReturnType", "MemberVisibilityCanBePrivate") + +package godot + +import godot.`annotation`.GodotBaseType +import godot.core.NodePath +import godot.core.VariantParser.BOOL +import godot.core.VariantParser.LONG +import godot.core.VariantParser.NIL +import godot.core.VariantParser.NODE_PATH +import godot.core.VariantParser.STRING +import godot.util.Internals +import godot.util.VoidPtr +import kotlin.Boolean +import kotlin.Int +import kotlin.Long +import kotlin.String +import kotlin.Suppress +import kotlin.Unit +import kotlin.jvm.JvmName + +private const val ENGINE_CLASS_BONEATTACHMENT3D_INDEX: Int = 141 + +/** + * This node selects a bone in a [Skeleton3D] and attaches to it. This means that the + * [BoneAttachment3D] node will either dynamically copy or override the 3D transform of the selected + * bone. + */ +@GodotBaseType +public open class BoneAttachment3D : Node3D() { + /** + * The name of the attached bone. + */ + public final inline var boneName: String + @JvmName("boneNameProperty") + get() = getBoneName() + @JvmName("boneNameProperty") + set(`value`) { + setBoneName(value) + } + + /** + * The index of the attached bone. + */ + public final inline var boneIdx: Int + @JvmName("boneIdxProperty") + get() = getBoneIdx() + @JvmName("boneIdxProperty") + set(`value`) { + setBoneIdx(value) + } + + /** + * Whether the BoneAttachment3D node will override the bone pose of the bone it is attached to. + * When set to `true`, the BoneAttachment3D node can change the pose of the bone. When set to + * `false`, the BoneAttachment3D will always be set to the bone's transform. + * **Note:** This override performs interruptively in the skeleton update process using signals + * due to the old design. It may cause unintended behavior when used at the same time with + * [SkeletonModifier3D]. + */ + public final inline var overridePose: Boolean + @JvmName("overridePoseProperty") + get() = getOverridePose() + @JvmName("overridePoseProperty") + set(`value`) { + setOverridePose(value) + } + + public override fun new(scriptIndex: Int): Unit { + Internals.callConstructor(this, ENGINE_CLASS_BONEATTACHMENT3D_INDEX, scriptIndex) + } + + public final fun setBoneName(boneName: String): Unit { + Internals.writeArguments(STRING to boneName) + Internals.callMethod(rawPtr, MethodBindings.setBoneNamePtr, NIL) + } + + public final fun getBoneName(): String { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getBoneNamePtr, STRING) + return (Internals.readReturnValue(STRING) as String) + } + + public final fun setBoneIdx(boneIdx: Int): Unit { + Internals.writeArguments(LONG to boneIdx.toLong()) + Internals.callMethod(rawPtr, MethodBindings.setBoneIdxPtr, NIL) + } + + public final fun getBoneIdx(): Int { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getBoneIdxPtr, LONG) + return (Internals.readReturnValue(LONG) as Long).toInt() + } + + /** + * A function that is called automatically when the [Skeleton3D] is updated. This function is + * where the [BoneAttachment3D] node updates its position so it is correctly bound when it is *not* + * set to override the bone pose. + */ + public final fun onSkeletonUpdate(): Unit { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.onSkeletonUpdatePtr, NIL) + } + + public final fun setOverridePose(overridePose: Boolean): Unit { + Internals.writeArguments(BOOL to overridePose) + Internals.callMethod(rawPtr, MethodBindings.setOverridePosePtr, NIL) + } + + public final fun getOverridePose(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getOverridePosePtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + /** + * Sets whether the BoneAttachment3D node will use an external [Skeleton3D] node rather than + * attempting to use its parent node as the [Skeleton3D]. When set to `true`, the BoneAttachment3D + * node will use the external [Skeleton3D] node set in [setExternalSkeleton]. + */ + public final fun setUseExternalSkeleton(useExternalSkeleton: Boolean): Unit { + Internals.writeArguments(BOOL to useExternalSkeleton) + Internals.callMethod(rawPtr, MethodBindings.setUseExternalSkeletonPtr, NIL) + } + + /** + * Returns whether the BoneAttachment3D node is using an external [Skeleton3D] rather than + * attempting to use its parent node as the [Skeleton3D]. + */ + public final fun getUseExternalSkeleton(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getUseExternalSkeletonPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + /** + * Sets the [NodePath] to the external skeleton that the BoneAttachment3D node should use. See + * [setUseExternalSkeleton] to enable the external [Skeleton3D] node. + */ + public final fun setExternalSkeleton(externalSkeleton: NodePath): Unit { + Internals.writeArguments(NODE_PATH to externalSkeleton) + Internals.callMethod(rawPtr, MethodBindings.setExternalSkeletonPtr, NIL) + } + + /** + * Returns the [NodePath] to the external [Skeleton3D] node, if one has been set. + */ + public final fun getExternalSkeleton(): NodePath { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getExternalSkeletonPtr, NODE_PATH) + return (Internals.readReturnValue(NODE_PATH) as NodePath) + } + + public companion object + + public object MethodBindings { + internal val setBoneNamePtr: VoidPtr = + Internals.getMethodBindPtr("BoneAttachment3D", "set_bone_name", 83702148) + + internal val getBoneNamePtr: VoidPtr = + Internals.getMethodBindPtr("BoneAttachment3D", "get_bone_name", 201670096) + + internal val setBoneIdxPtr: VoidPtr = + Internals.getMethodBindPtr("BoneAttachment3D", "set_bone_idx", 1286410249) + + internal val getBoneIdxPtr: VoidPtr = + Internals.getMethodBindPtr("BoneAttachment3D", "get_bone_idx", 3905245786) + + internal val onSkeletonUpdatePtr: VoidPtr = + Internals.getMethodBindPtr("BoneAttachment3D", "on_skeleton_update", 3218959716) + + internal val setOverridePosePtr: VoidPtr = + Internals.getMethodBindPtr("BoneAttachment3D", "set_override_pose", 2586408642) + + internal val getOverridePosePtr: VoidPtr = + Internals.getMethodBindPtr("BoneAttachment3D", "get_override_pose", 36873697) + + internal val setUseExternalSkeletonPtr: VoidPtr = + Internals.getMethodBindPtr("BoneAttachment3D", "set_use_external_skeleton", 2586408642) + + internal val getUseExternalSkeletonPtr: VoidPtr = + Internals.getMethodBindPtr("BoneAttachment3D", "get_use_external_skeleton", 36873697) + + internal val setExternalSkeletonPtr: VoidPtr = + Internals.getMethodBindPtr("BoneAttachment3D", "set_external_skeleton", 1348162250) + + internal val getExternalSkeletonPtr: VoidPtr = + Internals.getMethodBindPtr("BoneAttachment3D", "get_external_skeleton", 4075236667) + } +} diff --git a/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/BoneMap.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/BoneMap.kt new file mode 100644 index 0000000000..e867753318 --- /dev/null +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/BoneMap.kt @@ -0,0 +1,119 @@ +// THIS FILE IS GENERATED! DO NOT EDIT IT MANUALLY! +@file:Suppress("PackageDirectoryMismatch", "unused", "FunctionName", "RedundantModalityModifier", + "UNCHECKED_CAST", "JoinDeclarationAndAssignment", "USELESS_CAST", + "RemoveRedundantQualifierName", "NOTHING_TO_INLINE", "NON_FINAL_MEMBER_IN_OBJECT", + "RedundantVisibilityModifier", "RedundantUnitReturnType", "MemberVisibilityCanBePrivate") + +package godot + +import godot.`annotation`.GodotBaseType +import godot.core.Signal0 +import godot.core.StringName +import godot.core.VariantParser.NIL +import godot.core.VariantParser.OBJECT +import godot.core.VariantParser.STRING_NAME +import godot.util.Internals +import godot.util.VoidPtr +import kotlin.Int +import kotlin.Suppress +import kotlin.Unit +import kotlin.jvm.JvmName + +private const val ENGINE_CLASS_BONEMAP_INDEX: Int = 142 + +/** + * This class contains a dictionary that uses a list of bone names in [SkeletonProfile] as key + * names. + * By assigning the actual [Skeleton3D] bone name as the key value, it maps the [Skeleton3D] to the + * [SkeletonProfile]. + */ +@GodotBaseType +public open class BoneMap : Resource() { + /** + * This signal is emitted when change the key value in the [BoneMap]. This is used to validate + * mapping and to update [BoneMap] editor. + */ + public val boneMapUpdated: Signal0 by Signal0 + + /** + * This signal is emitted when change the value in profile or change the reference of profile. + * This is used to update key names in the [BoneMap] and to redraw the [BoneMap] editor. + */ + public val profileUpdated: Signal0 by Signal0 + + /** + * A [SkeletonProfile] of the mapping target. Key names in the [BoneMap] are synchronized with it. + */ + public final inline var profile: SkeletonProfile? + @JvmName("profileProperty") + get() = getProfile() + @JvmName("profileProperty") + set(`value`) { + setProfile(value) + } + + public override fun new(scriptIndex: Int): Unit { + Internals.callConstructor(this, ENGINE_CLASS_BONEMAP_INDEX, scriptIndex) + } + + public final fun getProfile(): SkeletonProfile? { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getProfilePtr, OBJECT) + return (Internals.readReturnValue(OBJECT) as SkeletonProfile?) + } + + public final fun setProfile(profile: SkeletonProfile?): Unit { + Internals.writeArguments(OBJECT to profile) + Internals.callMethod(rawPtr, MethodBindings.setProfilePtr, NIL) + } + + /** + * Returns a skeleton bone name is mapped to [profileBoneName]. + * In the retargeting process, the returned bone name is the bone name of the source skeleton. + */ + public final fun getSkeletonBoneName(profileBoneName: StringName): StringName { + Internals.writeArguments(STRING_NAME to profileBoneName) + Internals.callMethod(rawPtr, MethodBindings.getSkeletonBoneNamePtr, STRING_NAME) + return (Internals.readReturnValue(STRING_NAME) as StringName) + } + + /** + * Maps a skeleton bone name to [profileBoneName]. + * In the retargeting process, the setting bone name is the bone name of the source skeleton. + */ + public final fun setSkeletonBoneName(profileBoneName: StringName, skeletonBoneName: StringName): + Unit { + Internals.writeArguments(STRING_NAME to profileBoneName, STRING_NAME to skeletonBoneName) + Internals.callMethod(rawPtr, MethodBindings.setSkeletonBoneNamePtr, NIL) + } + + /** + * Returns a profile bone name having [skeletonBoneName]. If not found, an empty [StringName] will + * be returned. + * In the retargeting process, the returned bone name is the bone name of the target skeleton. + */ + public final fun findProfileBoneName(skeletonBoneName: StringName): StringName { + Internals.writeArguments(STRING_NAME to skeletonBoneName) + Internals.callMethod(rawPtr, MethodBindings.findProfileBoneNamePtr, STRING_NAME) + return (Internals.readReturnValue(STRING_NAME) as StringName) + } + + public companion object + + public object MethodBindings { + internal val getProfilePtr: VoidPtr = + Internals.getMethodBindPtr("BoneMap", "get_profile", 4291782652) + + internal val setProfilePtr: VoidPtr = + Internals.getMethodBindPtr("BoneMap", "set_profile", 3870374136) + + internal val getSkeletonBoneNamePtr: VoidPtr = + Internals.getMethodBindPtr("BoneMap", "get_skeleton_bone_name", 1965194235) + + internal val setSkeletonBoneNamePtr: VoidPtr = + Internals.getMethodBindPtr("BoneMap", "set_skeleton_bone_name", 3740211285) + + internal val findProfileBoneNamePtr: VoidPtr = + Internals.getMethodBindPtr("BoneMap", "find_profile_bone_name", 1965194235) + } +} diff --git a/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/BoxContainer.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/BoxContainer.kt new file mode 100644 index 0000000000..d3c4138ce3 --- /dev/null +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/BoxContainer.kt @@ -0,0 +1,138 @@ +// THIS FILE IS GENERATED! DO NOT EDIT IT MANUALLY! +@file:Suppress("PackageDirectoryMismatch", "unused", "FunctionName", "RedundantModalityModifier", + "UNCHECKED_CAST", "JoinDeclarationAndAssignment", "USELESS_CAST", + "RemoveRedundantQualifierName", "NOTHING_TO_INLINE", "NON_FINAL_MEMBER_IN_OBJECT", + "RedundantVisibilityModifier", "RedundantUnitReturnType", "MemberVisibilityCanBePrivate") + +package godot + +import godot.`annotation`.GodotBaseType +import godot.core.VariantParser.BOOL +import godot.core.VariantParser.LONG +import godot.core.VariantParser.NIL +import godot.core.VariantParser.OBJECT +import godot.util.Internals +import godot.util.VoidPtr +import kotlin.Boolean +import kotlin.Int +import kotlin.Long +import kotlin.Suppress +import kotlin.Unit +import kotlin.jvm.JvmName + +private const val ENGINE_CLASS_BOXCONTAINER_INDEX: Int = 143 + +/** + * A container that arranges its child controls horizontally or vertically, rearranging them + * automatically when their minimum size changes. + */ +@GodotBaseType +public open class BoxContainer : Container() { + /** + * The alignment of the container's children (must be one of [ALIGNMENT_BEGIN], + * [ALIGNMENT_CENTER], or [ALIGNMENT_END]). + */ + public final inline var alignment: AlignmentMode + @JvmName("alignmentProperty") + get() = getAlignment() + @JvmName("alignmentProperty") + set(`value`) { + setAlignment(value) + } + + /** + * If `true`, the [BoxContainer] will arrange its children vertically, rather than horizontally. + * Can't be changed when using [HBoxContainer] and [VBoxContainer]. + */ + public final inline var vertical: Boolean + @JvmName("verticalProperty") + get() = isVertical() + @JvmName("verticalProperty") + set(`value`) { + setVertical(value) + } + + public override fun new(scriptIndex: Int): Unit { + Internals.callConstructor(this, ENGINE_CLASS_BOXCONTAINER_INDEX, scriptIndex) + } + + /** + * Adds a [Control] node to the box as a spacer. If [begin] is `true`, it will insert the + * [Control] node in front of all other children. + */ + public final fun addSpacer(begin: Boolean): Control? { + Internals.writeArguments(BOOL to begin) + Internals.callMethod(rawPtr, MethodBindings.addSpacerPtr, OBJECT) + return (Internals.readReturnValue(OBJECT) as Control?) + } + + public final fun setAlignment(alignment: AlignmentMode): Unit { + Internals.writeArguments(LONG to alignment.id) + Internals.callMethod(rawPtr, MethodBindings.setAlignmentPtr, NIL) + } + + public final fun getAlignment(): AlignmentMode { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getAlignmentPtr, LONG) + return BoxContainer.AlignmentMode.from(Internals.readReturnValue(LONG) as Long) + } + + public final fun setVertical(vertical: Boolean): Unit { + Internals.writeArguments(BOOL to vertical) + Internals.callMethod(rawPtr, MethodBindings.setVerticalPtr, NIL) + } + + public final fun isVertical(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isVerticalPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public enum class AlignmentMode( + id: Long, + ) { + /** + * The child controls will be arranged at the beginning of the container, i.e. top if + * orientation is vertical, left if orientation is horizontal (right for RTL layout). + */ + ALIGNMENT_BEGIN(0), + /** + * The child controls will be centered in the container. + */ + ALIGNMENT_CENTER(1), + /** + * The child controls will be arranged at the end of the container, i.e. bottom if orientation + * is vertical, right if orientation is horizontal (left for RTL layout). + */ + ALIGNMENT_END(2), + ; + + public val id: Long + init { + this.id = id + } + + public companion object { + public fun from(`value`: Long): AlignmentMode = entries.single { it.id == `value` } + } + } + + public companion object + + public object MethodBindings { + internal val addSpacerPtr: VoidPtr = + Internals.getMethodBindPtr("BoxContainer", "add_spacer", 1326660695) + + internal val setAlignmentPtr: VoidPtr = + Internals.getMethodBindPtr("BoxContainer", "set_alignment", 2456745134) + + internal val getAlignmentPtr: VoidPtr = + Internals.getMethodBindPtr("BoxContainer", "get_alignment", 1915476527) + + internal val setVerticalPtr: VoidPtr = + Internals.getMethodBindPtr("BoxContainer", "set_vertical", 2586408642) + + internal val isVerticalPtr: VoidPtr = + Internals.getMethodBindPtr("BoxContainer", "is_vertical", 36873697) + } +} diff --git a/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/BoxMesh.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/BoxMesh.kt new file mode 100644 index 0000000000..6554d078e6 --- /dev/null +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/BoxMesh.kt @@ -0,0 +1,179 @@ +// THIS FILE IS GENERATED! DO NOT EDIT IT MANUALLY! +@file:Suppress("PackageDirectoryMismatch", "unused", "FunctionName", "RedundantModalityModifier", + "UNCHECKED_CAST", "JoinDeclarationAndAssignment", "USELESS_CAST", + "RemoveRedundantQualifierName", "NOTHING_TO_INLINE", "NON_FINAL_MEMBER_IN_OBJECT", + "RedundantVisibilityModifier", "RedundantUnitReturnType", "MemberVisibilityCanBePrivate") + +package godot + +import godot.`annotation`.CoreTypeHelper +import godot.`annotation`.CoreTypeLocalCopy +import godot.`annotation`.GodotBaseType +import godot.core.VariantParser.LONG +import godot.core.VariantParser.NIL +import godot.core.VariantParser.VECTOR3 +import godot.core.Vector3 +import godot.util.Internals +import godot.util.VoidPtr +import kotlin.Int +import kotlin.Long +import kotlin.Suppress +import kotlin.Unit +import kotlin.jvm.JvmName + +private const val ENGINE_CLASS_BOXMESH_INDEX: Int = 144 + +/** + * Generate an axis-aligned box [PrimitiveMesh]. + * The box's UV layout is arranged in a 3×2 layout that allows texturing each face individually. To + * apply the same texture on all faces, change the material's UV property to `Vector3(3, 2, 1)`. This + * is equivalent to adding `UV *= vec2(3.0, 2.0)` in a vertex shader. + * **Note:** When using a large textured [BoxMesh] (e.g. as a floor), you may stumble upon UV + * jittering issues depending on the camera angle. To solve this, increase [subdivideDepth], + * [subdivideHeight] and [subdivideWidth] until you no longer notice UV jittering. + */ +@GodotBaseType +public open class BoxMesh : PrimitiveMesh() { + /** + * The box's width, height and depth. + */ + @CoreTypeLocalCopy + public final inline var size: Vector3 + @JvmName("sizeProperty") + get() = getSize() + @JvmName("sizeProperty") + set(`value`) { + setSize(value) + } + + /** + * Number of extra edge loops inserted along the X axis. + */ + public final inline var subdivideWidth: Int + @JvmName("subdivideWidthProperty") + get() = getSubdivideWidth() + @JvmName("subdivideWidthProperty") + set(`value`) { + setSubdivideWidth(value) + } + + /** + * Number of extra edge loops inserted along the Y axis. + */ + public final inline var subdivideHeight: Int + @JvmName("subdivideHeightProperty") + get() = getSubdivideHeight() + @JvmName("subdivideHeightProperty") + set(`value`) { + setSubdivideHeight(value) + } + + /** + * Number of extra edge loops inserted along the Z axis. + */ + public final inline var subdivideDepth: Int + @JvmName("subdivideDepthProperty") + get() = getSubdivideDepth() + @JvmName("subdivideDepthProperty") + set(`value`) { + setSubdivideDepth(value) + } + + public override fun new(scriptIndex: Int): Unit { + Internals.callConstructor(this, ENGINE_CLASS_BOXMESH_INDEX, scriptIndex) + } + + /** + * The box's width, height and depth. + * + * This is a helper function to make dealing with local copies easier. + * + * For more information, see our + * [documentation](https://godot-kotl.in/en/stable/user-guide/api-differences/#core-types). + * + * Allow to directly modify the local copy of the property and assign it back to the Object. + * + * Prefer that over writing: + * `````` + * val myCoreType = boxmesh.size + * //Your changes + * boxmesh.size = myCoreType + * `````` + */ + @CoreTypeHelper + public final fun sizeMutate(block: Vector3.() -> Unit): Vector3 = size.apply{ + block(this) + size = this + } + + + public final fun setSize(size: Vector3): Unit { + Internals.writeArguments(VECTOR3 to size) + Internals.callMethod(rawPtr, MethodBindings.setSizePtr, NIL) + } + + public final fun getSize(): Vector3 { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getSizePtr, VECTOR3) + return (Internals.readReturnValue(VECTOR3) as Vector3) + } + + public final fun setSubdivideWidth(subdivide: Int): Unit { + Internals.writeArguments(LONG to subdivide.toLong()) + Internals.callMethod(rawPtr, MethodBindings.setSubdivideWidthPtr, NIL) + } + + public final fun getSubdivideWidth(): Int { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getSubdivideWidthPtr, LONG) + return (Internals.readReturnValue(LONG) as Long).toInt() + } + + public final fun setSubdivideHeight(divisions: Int): Unit { + Internals.writeArguments(LONG to divisions.toLong()) + Internals.callMethod(rawPtr, MethodBindings.setSubdivideHeightPtr, NIL) + } + + public final fun getSubdivideHeight(): Int { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getSubdivideHeightPtr, LONG) + return (Internals.readReturnValue(LONG) as Long).toInt() + } + + public final fun setSubdivideDepth(divisions: Int): Unit { + Internals.writeArguments(LONG to divisions.toLong()) + Internals.callMethod(rawPtr, MethodBindings.setSubdivideDepthPtr, NIL) + } + + public final fun getSubdivideDepth(): Int { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getSubdivideDepthPtr, LONG) + return (Internals.readReturnValue(LONG) as Long).toInt() + } + + public companion object + + public object MethodBindings { + internal val setSizePtr: VoidPtr = Internals.getMethodBindPtr("BoxMesh", "set_size", 3460891852) + + internal val getSizePtr: VoidPtr = Internals.getMethodBindPtr("BoxMesh", "get_size", 3360562783) + + internal val setSubdivideWidthPtr: VoidPtr = + Internals.getMethodBindPtr("BoxMesh", "set_subdivide_width", 1286410249) + + internal val getSubdivideWidthPtr: VoidPtr = + Internals.getMethodBindPtr("BoxMesh", "get_subdivide_width", 3905245786) + + internal val setSubdivideHeightPtr: VoidPtr = + Internals.getMethodBindPtr("BoxMesh", "set_subdivide_height", 1286410249) + + internal val getSubdivideHeightPtr: VoidPtr = + Internals.getMethodBindPtr("BoxMesh", "get_subdivide_height", 3905245786) + + internal val setSubdivideDepthPtr: VoidPtr = + Internals.getMethodBindPtr("BoxMesh", "set_subdivide_depth", 1286410249) + + internal val getSubdivideDepthPtr: VoidPtr = + Internals.getMethodBindPtr("BoxMesh", "get_subdivide_depth", 3905245786) + } +} diff --git a/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/BoxOccluder3D.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/BoxOccluder3D.kt new file mode 100644 index 0000000000..45d192878c --- /dev/null +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/BoxOccluder3D.kt @@ -0,0 +1,90 @@ +// THIS FILE IS GENERATED! DO NOT EDIT IT MANUALLY! +@file:Suppress("PackageDirectoryMismatch", "unused", "FunctionName", "RedundantModalityModifier", + "UNCHECKED_CAST", "JoinDeclarationAndAssignment", "USELESS_CAST", + "RemoveRedundantQualifierName", "NOTHING_TO_INLINE", "NON_FINAL_MEMBER_IN_OBJECT", + "RedundantVisibilityModifier", "RedundantUnitReturnType", "MemberVisibilityCanBePrivate") + +package godot + +import godot.`annotation`.CoreTypeHelper +import godot.`annotation`.CoreTypeLocalCopy +import godot.`annotation`.GodotBaseType +import godot.core.VariantParser.NIL +import godot.core.VariantParser.VECTOR3 +import godot.core.Vector3 +import godot.util.Internals +import godot.util.VoidPtr +import kotlin.Int +import kotlin.Suppress +import kotlin.Unit +import kotlin.jvm.JvmName + +private const val ENGINE_CLASS_BOXOCCLUDER3D_INDEX: Int = 145 + +/** + * [BoxOccluder3D] stores a cuboid shape that can be used by the engine's occlusion culling system. + * See [OccluderInstance3D]'s documentation for instructions on setting up occlusion culling. + */ +@GodotBaseType +public open class BoxOccluder3D : Occluder3D() { + /** + * The box's size in 3D units. + */ + @CoreTypeLocalCopy + public final inline var size: Vector3 + @JvmName("sizeProperty") + get() = getSize() + @JvmName("sizeProperty") + set(`value`) { + setSize(value) + } + + public override fun new(scriptIndex: Int): Unit { + Internals.callConstructor(this, ENGINE_CLASS_BOXOCCLUDER3D_INDEX, scriptIndex) + } + + /** + * The box's size in 3D units. + * + * This is a helper function to make dealing with local copies easier. + * + * For more information, see our + * [documentation](https://godot-kotl.in/en/stable/user-guide/api-differences/#core-types). + * + * Allow to directly modify the local copy of the property and assign it back to the Object. + * + * Prefer that over writing: + * `````` + * val myCoreType = boxoccluder3d.size + * //Your changes + * boxoccluder3d.size = myCoreType + * `````` + */ + @CoreTypeHelper + public final fun sizeMutate(block: Vector3.() -> Unit): Vector3 = size.apply{ + block(this) + size = this + } + + + public final fun setSize(size: Vector3): Unit { + Internals.writeArguments(VECTOR3 to size) + Internals.callMethod(rawPtr, MethodBindings.setSizePtr, NIL) + } + + public final fun getSize(): Vector3 { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getSizePtr, VECTOR3) + return (Internals.readReturnValue(VECTOR3) as Vector3) + } + + public companion object + + public object MethodBindings { + internal val setSizePtr: VoidPtr = + Internals.getMethodBindPtr("BoxOccluder3D", "set_size", 3460891852) + + internal val getSizePtr: VoidPtr = + Internals.getMethodBindPtr("BoxOccluder3D", "get_size", 3360562783) + } +} diff --git a/kt/godot-library/src/main/kotlin/godot/gen/godot/BoxShape3D.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/BoxShape3D.kt similarity index 75% rename from kt/godot-library/src/main/kotlin/godot/gen/godot/BoxShape3D.kt rename to kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/BoxShape3D.kt index f2ba019f2f..332b98d08b 100644 --- a/kt/godot-library/src/main/kotlin/godot/gen/godot/BoxShape3D.kt +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/BoxShape3D.kt @@ -9,17 +9,18 @@ package godot import godot.`annotation`.CoreTypeHelper import godot.`annotation`.CoreTypeLocalCopy import godot.`annotation`.GodotBaseType -import godot.core.TypeManager import godot.core.VariantParser.NIL import godot.core.VariantParser.VECTOR3 import godot.core.Vector3 -import godot.core.memory.TransferContext +import godot.util.Internals import godot.util.VoidPtr import kotlin.Int import kotlin.Suppress import kotlin.Unit import kotlin.jvm.JvmName +private const val ENGINE_CLASS_BOXSHAPE3D_INDEX: Int = 146 + /** * A 3D box shape, intended for use in physics. Usually used to provide a shape for a * [CollisionShape3D]. @@ -41,7 +42,7 @@ public open class BoxShape3D : Shape3D() { } public override fun new(scriptIndex: Int): Unit { - callConstructor(ENGINECLASS_BOXSHAPE3D, scriptIndex) + Internals.callConstructor(this, ENGINE_CLASS_BOXSHAPE3D_INDEX, scriptIndex) } /** @@ -69,23 +70,23 @@ public open class BoxShape3D : Shape3D() { public final fun setSize(size: Vector3): Unit { - TransferContext.writeArguments(VECTOR3 to size) - TransferContext.callMethod(rawPtr, MethodBindings.setSizePtr, NIL) + Internals.writeArguments(VECTOR3 to size) + Internals.callMethod(rawPtr, MethodBindings.setSizePtr, NIL) } public final fun getSize(): Vector3 { - TransferContext.writeArguments() - TransferContext.callMethod(rawPtr, MethodBindings.getSizePtr, VECTOR3) - return (TransferContext.readReturnValue(VECTOR3) as Vector3) + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getSizePtr, VECTOR3) + return (Internals.readReturnValue(VECTOR3) as Vector3) } public companion object - internal object MethodBindings { - public val setSizePtr: VoidPtr = - TypeManager.getMethodBindPtr("BoxShape3D", "set_size", 3460891852) + public object MethodBindings { + internal val setSizePtr: VoidPtr = + Internals.getMethodBindPtr("BoxShape3D", "set_size", 3460891852) - public val getSizePtr: VoidPtr = - TypeManager.getMethodBindPtr("BoxShape3D", "get_size", 3360562783) + internal val getSizePtr: VoidPtr = + Internals.getMethodBindPtr("BoxShape3D", "get_size", 3360562783) } } diff --git a/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/Button.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/Button.kt new file mode 100644 index 0000000000..8c9c29c498 --- /dev/null +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/Button.kt @@ -0,0 +1,416 @@ +// THIS FILE IS GENERATED! DO NOT EDIT IT MANUALLY! +@file:Suppress("PackageDirectoryMismatch", "unused", "FunctionName", "RedundantModalityModifier", + "UNCHECKED_CAST", "JoinDeclarationAndAssignment", "USELESS_CAST", + "RemoveRedundantQualifierName", "NOTHING_TO_INLINE", "NON_FINAL_MEMBER_IN_OBJECT", + "RedundantVisibilityModifier", "RedundantUnitReturnType", "MemberVisibilityCanBePrivate") + +package godot + +import godot.`annotation`.GodotBaseType +import godot.core.VariantParser.BOOL +import godot.core.VariantParser.LONG +import godot.core.VariantParser.NIL +import godot.core.VariantParser.OBJECT +import godot.core.VariantParser.STRING +import godot.util.Internals +import godot.util.VoidPtr +import kotlin.Boolean +import kotlin.Int +import kotlin.Long +import kotlin.String +import kotlin.Suppress +import kotlin.Unit +import kotlin.jvm.JvmName + +private const val ENGINE_CLASS_BUTTON_INDEX: Int = 147 + +/** + * [Button] is the standard themed button. It can contain text and an icon, and it will display them + * according to the current [Theme]. + * **Example of creating a button and assigning an action when pressed by code:** + * + * gdscript: + * ```gdscript + * func _ready(): + * var button = Button.new() + * button.text = "Click me" + * button.pressed.connect(self._button_pressed) + * add_child(button) + * + * func _button_pressed(): + * print("Hello world!") + * ``` + * csharp: + * ```csharp + * public override void _Ready() + * { + * var button = new Button(); + * button.Text = "Click me"; + * button.Pressed += ButtonPressed; + * AddChild(button); + * } + * + * private void ButtonPressed() + * { + * GD.Print("Hello world!"); + * } + * ``` + * + * See also [BaseButton] which contains common properties and methods associated with this node. + * **Note:** Buttons do not interpret touch input and therefore don't support multitouch, since + * mouse emulation can only press one button at a given time. Use [TouchScreenButton] for buttons that + * trigger gameplay movement or actions. + */ +@GodotBaseType +public open class Button : BaseButton() { + /** + * The button's text that will be displayed inside the button's area. + */ + public final inline var text: String + @JvmName("textProperty") + get() = getText() + @JvmName("textProperty") + set(`value`) { + setText(value) + } + + /** + * Button's icon, if text is present the icon will be placed before the text. + * To edit margin and spacing of the icon, use [theme_item h_separation] theme property and + * `content_margin_*` properties of the used [StyleBox]es. + */ + public final inline var icon: Texture2D? + @JvmName("iconProperty") + get() = getButtonIcon() + @JvmName("iconProperty") + set(`value`) { + setButtonIcon(value) + } + + /** + * Flat buttons don't display decoration. + */ + public final inline var flat: Boolean + @JvmName("flatProperty") + get() = isFlat() + @JvmName("flatProperty") + set(`value`) { + setFlat(value) + } + + /** + * Text alignment policy for the button's text, use one of the [HorizontalAlignment] constants. + */ + public final inline var alignment: HorizontalAlignment + @JvmName("alignmentProperty") + get() = getTextAlignment() + @JvmName("alignmentProperty") + set(`value`) { + setTextAlignment(value) + } + + /** + * Sets the clipping behavior when the text exceeds the node's bounding rectangle. See + * [TextServer.OverrunBehavior] for a description of all modes. + */ + public final inline var textOverrunBehavior: TextServer.OverrunBehavior + @JvmName("textOverrunBehaviorProperty") + get() = getTextOverrunBehavior() + @JvmName("textOverrunBehaviorProperty") + set(`value`) { + setTextOverrunBehavior(value) + } + + /** + * If set to something other than [TextServer.AUTOWRAP_OFF], the text gets wrapped inside the + * node's bounding rectangle. + */ + public final inline var autowrapMode: TextServer.AutowrapMode + @JvmName("autowrapModeProperty") + get() = getAutowrapMode() + @JvmName("autowrapModeProperty") + set(`value`) { + setAutowrapMode(value) + } + + /** + * When this property is enabled, text that is too large to fit the button is clipped, when + * disabled the Button will always be wide enough to hold the text. + */ + public final inline var clipText: Boolean + @JvmName("clipTextProperty") + get() = getClipText() + @JvmName("clipTextProperty") + set(`value`) { + setClipText(value) + } + + /** + * Specifies if the icon should be aligned horizontally to the left, right, or center of a button. + * Uses the same [HorizontalAlignment] constants as the text alignment. If centered horizontally and + * vertically, text will draw on top of the icon. + */ + public final inline var iconAlignment: HorizontalAlignment + @JvmName("iconAlignmentProperty") + get() = getIconAlignment() + @JvmName("iconAlignmentProperty") + set(`value`) { + setIconAlignment(value) + } + + /** + * Specifies if the icon should be aligned vertically to the top, bottom, or center of a button. + * Uses the same [VerticalAlignment] constants as the text alignment. If centered horizontally and + * vertically, text will draw on top of the icon. + */ + public final inline var verticalIconAlignment: VerticalAlignment + @JvmName("verticalIconAlignmentProperty") + get() = getVerticalIconAlignment() + @JvmName("verticalIconAlignmentProperty") + set(`value`) { + setVerticalIconAlignment(value) + } + + /** + * When enabled, the button's icon will expand/shrink to fit the button's size while keeping its + * aspect. See also [theme_item icon_max_width]. + */ + public final inline var expandIcon: Boolean + @JvmName("expandIconProperty") + get() = isExpandIcon() + @JvmName("expandIconProperty") + set(`value`) { + setExpandIcon(value) + } + + /** + * Base text writing direction. + */ + public final inline var textDirection: Control.TextDirection + @JvmName("textDirectionProperty") + get() = getTextDirection() + @JvmName("textDirectionProperty") + set(`value`) { + setTextDirection(value) + } + + /** + * Language code used for line-breaking and text shaping algorithms, if left empty current locale + * is used instead. + */ + public final inline var language: String + @JvmName("languageProperty") + get() = getLanguage() + @JvmName("languageProperty") + set(`value`) { + setLanguage(value) + } + + public override fun new(scriptIndex: Int): Unit { + Internals.callConstructor(this, ENGINE_CLASS_BUTTON_INDEX, scriptIndex) + } + + public final fun setText(text: String): Unit { + Internals.writeArguments(STRING to text) + Internals.callMethod(rawPtr, MethodBindings.setTextPtr, NIL) + } + + public final fun getText(): String { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getTextPtr, STRING) + return (Internals.readReturnValue(STRING) as String) + } + + public final fun setTextOverrunBehavior(overrunBehavior: TextServer.OverrunBehavior): Unit { + Internals.writeArguments(LONG to overrunBehavior.id) + Internals.callMethod(rawPtr, MethodBindings.setTextOverrunBehaviorPtr, NIL) + } + + public final fun getTextOverrunBehavior(): TextServer.OverrunBehavior { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getTextOverrunBehaviorPtr, LONG) + return TextServer.OverrunBehavior.from(Internals.readReturnValue(LONG) as Long) + } + + public final fun setAutowrapMode(autowrapMode: TextServer.AutowrapMode): Unit { + Internals.writeArguments(LONG to autowrapMode.id) + Internals.callMethod(rawPtr, MethodBindings.setAutowrapModePtr, NIL) + } + + public final fun getAutowrapMode(): TextServer.AutowrapMode { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getAutowrapModePtr, LONG) + return TextServer.AutowrapMode.from(Internals.readReturnValue(LONG) as Long) + } + + public final fun setTextDirection(direction: Control.TextDirection): Unit { + Internals.writeArguments(LONG to direction.id) + Internals.callMethod(rawPtr, MethodBindings.setTextDirectionPtr, NIL) + } + + public final fun getTextDirection(): Control.TextDirection { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getTextDirectionPtr, LONG) + return Control.TextDirection.from(Internals.readReturnValue(LONG) as Long) + } + + public final fun setLanguage(language: String): Unit { + Internals.writeArguments(STRING to language) + Internals.callMethod(rawPtr, MethodBindings.setLanguagePtr, NIL) + } + + public final fun getLanguage(): String { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getLanguagePtr, STRING) + return (Internals.readReturnValue(STRING) as String) + } + + public final fun setButtonIcon(texture: Texture2D?): Unit { + Internals.writeArguments(OBJECT to texture) + Internals.callMethod(rawPtr, MethodBindings.setButtonIconPtr, NIL) + } + + public final fun getButtonIcon(): Texture2D? { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getButtonIconPtr, OBJECT) + return (Internals.readReturnValue(OBJECT) as Texture2D?) + } + + public final fun setFlat(enabled: Boolean): Unit { + Internals.writeArguments(BOOL to enabled) + Internals.callMethod(rawPtr, MethodBindings.setFlatPtr, NIL) + } + + public final fun isFlat(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isFlatPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public final fun setClipText(enabled: Boolean): Unit { + Internals.writeArguments(BOOL to enabled) + Internals.callMethod(rawPtr, MethodBindings.setClipTextPtr, NIL) + } + + public final fun getClipText(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getClipTextPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public final fun setTextAlignment(alignment: HorizontalAlignment): Unit { + Internals.writeArguments(LONG to alignment.id) + Internals.callMethod(rawPtr, MethodBindings.setTextAlignmentPtr, NIL) + } + + public final fun getTextAlignment(): HorizontalAlignment { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getTextAlignmentPtr, LONG) + return HorizontalAlignment.from(Internals.readReturnValue(LONG) as Long) + } + + public final fun setIconAlignment(iconAlignment: HorizontalAlignment): Unit { + Internals.writeArguments(LONG to iconAlignment.id) + Internals.callMethod(rawPtr, MethodBindings.setIconAlignmentPtr, NIL) + } + + public final fun getIconAlignment(): HorizontalAlignment { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getIconAlignmentPtr, LONG) + return HorizontalAlignment.from(Internals.readReturnValue(LONG) as Long) + } + + public final fun setVerticalIconAlignment(verticalIconAlignment: VerticalAlignment): Unit { + Internals.writeArguments(LONG to verticalIconAlignment.id) + Internals.callMethod(rawPtr, MethodBindings.setVerticalIconAlignmentPtr, NIL) + } + + public final fun getVerticalIconAlignment(): VerticalAlignment { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getVerticalIconAlignmentPtr, LONG) + return VerticalAlignment.from(Internals.readReturnValue(LONG) as Long) + } + + public final fun setExpandIcon(enabled: Boolean): Unit { + Internals.writeArguments(BOOL to enabled) + Internals.callMethod(rawPtr, MethodBindings.setExpandIconPtr, NIL) + } + + public final fun isExpandIcon(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isExpandIconPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public companion object + + public object MethodBindings { + internal val setTextPtr: VoidPtr = Internals.getMethodBindPtr("Button", "set_text", 83702148) + + internal val getTextPtr: VoidPtr = Internals.getMethodBindPtr("Button", "get_text", 201670096) + + internal val setTextOverrunBehaviorPtr: VoidPtr = + Internals.getMethodBindPtr("Button", "set_text_overrun_behavior", 1008890932) + + internal val getTextOverrunBehaviorPtr: VoidPtr = + Internals.getMethodBindPtr("Button", "get_text_overrun_behavior", 3779142101) + + internal val setAutowrapModePtr: VoidPtr = + Internals.getMethodBindPtr("Button", "set_autowrap_mode", 3289138044) + + internal val getAutowrapModePtr: VoidPtr = + Internals.getMethodBindPtr("Button", "get_autowrap_mode", 1549071663) + + internal val setTextDirectionPtr: VoidPtr = + Internals.getMethodBindPtr("Button", "set_text_direction", 119160795) + + internal val getTextDirectionPtr: VoidPtr = + Internals.getMethodBindPtr("Button", "get_text_direction", 797257663) + + internal val setLanguagePtr: VoidPtr = + Internals.getMethodBindPtr("Button", "set_language", 83702148) + + internal val getLanguagePtr: VoidPtr = + Internals.getMethodBindPtr("Button", "get_language", 201670096) + + internal val setButtonIconPtr: VoidPtr = + Internals.getMethodBindPtr("Button", "set_button_icon", 4051416890) + + internal val getButtonIconPtr: VoidPtr = + Internals.getMethodBindPtr("Button", "get_button_icon", 3635182373) + + internal val setFlatPtr: VoidPtr = Internals.getMethodBindPtr("Button", "set_flat", 2586408642) + + internal val isFlatPtr: VoidPtr = Internals.getMethodBindPtr("Button", "is_flat", 36873697) + + internal val setClipTextPtr: VoidPtr = + Internals.getMethodBindPtr("Button", "set_clip_text", 2586408642) + + internal val getClipTextPtr: VoidPtr = + Internals.getMethodBindPtr("Button", "get_clip_text", 36873697) + + internal val setTextAlignmentPtr: VoidPtr = + Internals.getMethodBindPtr("Button", "set_text_alignment", 2312603777) + + internal val getTextAlignmentPtr: VoidPtr = + Internals.getMethodBindPtr("Button", "get_text_alignment", 341400642) + + internal val setIconAlignmentPtr: VoidPtr = + Internals.getMethodBindPtr("Button", "set_icon_alignment", 2312603777) + + internal val getIconAlignmentPtr: VoidPtr = + Internals.getMethodBindPtr("Button", "get_icon_alignment", 341400642) + + internal val setVerticalIconAlignmentPtr: VoidPtr = + Internals.getMethodBindPtr("Button", "set_vertical_icon_alignment", 1796458609) + + internal val getVerticalIconAlignmentPtr: VoidPtr = + Internals.getMethodBindPtr("Button", "get_vertical_icon_alignment", 3274884059) + + internal val setExpandIconPtr: VoidPtr = + Internals.getMethodBindPtr("Button", "set_expand_icon", 2586408642) + + internal val isExpandIconPtr: VoidPtr = + Internals.getMethodBindPtr("Button", "is_expand_icon", 36873697) + } +} diff --git a/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/ButtonGroup.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/ButtonGroup.kt new file mode 100644 index 0000000000..f88adb7c8b --- /dev/null +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/ButtonGroup.kt @@ -0,0 +1,99 @@ +// THIS FILE IS GENERATED! DO NOT EDIT IT MANUALLY! +@file:Suppress("PackageDirectoryMismatch", "unused", "FunctionName", "RedundantModalityModifier", + "UNCHECKED_CAST", "JoinDeclarationAndAssignment", "USELESS_CAST", + "RemoveRedundantQualifierName", "NOTHING_TO_INLINE", "NON_FINAL_MEMBER_IN_OBJECT", + "RedundantVisibilityModifier", "RedundantUnitReturnType", "MemberVisibilityCanBePrivate") + +package godot + +import godot.`annotation`.GodotBaseType +import godot.core.Signal1 +import godot.core.VariantArray +import godot.core.VariantParser.ARRAY +import godot.core.VariantParser.BOOL +import godot.core.VariantParser.NIL +import godot.core.VariantParser.OBJECT +import godot.util.Internals +import godot.util.VoidPtr +import kotlin.Boolean +import kotlin.Int +import kotlin.Suppress +import kotlin.Unit +import kotlin.jvm.JvmName + +private const val ENGINE_CLASS_BUTTONGROUP_INDEX: Int = 148 + +/** + * A group of [BaseButton]-derived buttons. The buttons in a [ButtonGroup] are treated like radio + * buttons: No more than one button can be pressed at a time. Some types of buttons (such as + * [CheckBox]) may have a special appearance in this state. + * Every member of a [ButtonGroup] should have [BaseButton.toggleMode] set to `true`. + */ +@GodotBaseType +public open class ButtonGroup : Resource() { + /** + * Emitted when one of the buttons of the group is pressed. + */ + public val pressed: Signal1 by Signal1 + + /** + * If `true`, it is possible to unpress all buttons in this [ButtonGroup]. + */ + public final inline var allowUnpress: Boolean + @JvmName("allowUnpressProperty") + get() = isAllowUnpress() + @JvmName("allowUnpressProperty") + set(`value`) { + setAllowUnpress(value) + } + + public override fun new(scriptIndex: Int): Unit { + Internals.callConstructor(this, ENGINE_CLASS_BUTTONGROUP_INDEX, scriptIndex) + } + + /** + * Returns the current pressed button. + */ + public final fun getPressedButton(): BaseButton? { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getPressedButtonPtr, OBJECT) + return (Internals.readReturnValue(OBJECT) as BaseButton?) + } + + /** + * Returns an [Array] of [Button]s who have this as their [ButtonGroup] (see + * [BaseButton.buttonGroup]). + */ + public final fun getButtons(): VariantArray { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getButtonsPtr, ARRAY) + return (Internals.readReturnValue(ARRAY) as VariantArray) + } + + public final fun setAllowUnpress(enabled: Boolean): Unit { + Internals.writeArguments(BOOL to enabled) + Internals.callMethod(rawPtr, MethodBindings.setAllowUnpressPtr, NIL) + } + + public final fun isAllowUnpress(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isAllowUnpressPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public companion object + + public object MethodBindings { + internal val getPressedButtonPtr: VoidPtr = + Internals.getMethodBindPtr("ButtonGroup", "get_pressed_button", 3886434893) + + internal val getButtonsPtr: VoidPtr = + Internals.getMethodBindPtr("ButtonGroup", "get_buttons", 2915620761) + + internal val setAllowUnpressPtr: VoidPtr = + Internals.getMethodBindPtr("ButtonGroup", "set_allow_unpress", 2586408642) + + internal val isAllowUnpressPtr: VoidPtr = + Internals.getMethodBindPtr("ButtonGroup", "is_allow_unpress", 2240911060) + } +} diff --git a/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/CPUParticles2D.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/CPUParticles2D.kt new file mode 100644 index 0000000000..e4b2a4f4d0 --- /dev/null +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/CPUParticles2D.kt @@ -0,0 +1,1687 @@ +// THIS FILE IS GENERATED! DO NOT EDIT IT MANUALLY! +@file:Suppress("PackageDirectoryMismatch", "unused", "FunctionName", "RedundantModalityModifier", + "UNCHECKED_CAST", "JoinDeclarationAndAssignment", "USELESS_CAST", + "RemoveRedundantQualifierName", "NOTHING_TO_INLINE", "NON_FINAL_MEMBER_IN_OBJECT", + "RedundantVisibilityModifier", "RedundantUnitReturnType", "MemberVisibilityCanBePrivate") + +package godot + +import godot.`annotation`.CoreTypeHelper +import godot.`annotation`.CoreTypeLocalCopy +import godot.`annotation`.GodotBaseType +import godot.core.Color +import godot.core.PackedColorArray +import godot.core.PackedVector2Array +import godot.core.Signal0 +import godot.core.VariantParser.BOOL +import godot.core.VariantParser.COLOR +import godot.core.VariantParser.DOUBLE +import godot.core.VariantParser.LONG +import godot.core.VariantParser.NIL +import godot.core.VariantParser.OBJECT +import godot.core.VariantParser.PACKED_COLOR_ARRAY +import godot.core.VariantParser.PACKED_VECTOR2_ARRAY +import godot.core.VariantParser.VECTOR2 +import godot.core.Vector2 +import godot.util.Internals +import godot.util.VoidPtr +import kotlin.Boolean +import kotlin.Double +import kotlin.Float +import kotlin.Int +import kotlin.Long +import kotlin.Suppress +import kotlin.Unit +import kotlin.jvm.JvmName + +private const val ENGINE_CLASS_CPUPARTICLES2D_INDEX: Int = 149 + +/** + * CPU-based 2D particle node used to create a variety of particle systems and effects. + * See also [GPUParticles2D], which provides the same functionality with hardware acceleration, but + * may not run on older devices. + */ +@GodotBaseType +public open class CPUParticles2D : Node2D() { + /** + * Emitted when all active particles have finished processing. When [oneShot] is disabled, + * particles will process continuously, so this is never emitted. + */ + public val finished: Signal0 by Signal0 + + /** + * If `true`, particles are being emitted. [emitting] can be used to start and stop particles from + * emitting. However, if [oneShot] is `true` setting [emitting] to `true` will not restart the + * emission cycle until after all active particles finish processing. You can use the [signal + * finished] signal to be notified once all active particles finish processing. + */ + public final inline var emitting: Boolean + @JvmName("emittingProperty") + get() = isEmitting() + @JvmName("emittingProperty") + set(`value`) { + setEmitting(value) + } + + /** + * Number of particles emitted in one emission cycle. + */ + public final inline var amount: Int + @JvmName("amountProperty") + get() = getAmount() + @JvmName("amountProperty") + set(`value`) { + setAmount(value) + } + + /** + * Amount of time each particle will exist. + */ + public final inline var lifetime: Double + @JvmName("lifetimeProperty") + get() = getLifetime() + @JvmName("lifetimeProperty") + set(`value`) { + setLifetime(value) + } + + /** + * If `true`, only one emission cycle occurs. If set `true` during a cycle, emission will stop at + * the cycle's end. + */ + public final inline var oneShot: Boolean + @JvmName("oneShotProperty") + get() = getOneShot() + @JvmName("oneShotProperty") + set(`value`) { + setOneShot(value) + } + + /** + * Particle system starts as if it had already run for this many seconds. + */ + public final inline var preprocess: Double + @JvmName("preprocessProperty") + get() = getPreProcessTime() + @JvmName("preprocessProperty") + set(`value`) { + setPreProcessTime(value) + } + + /** + * Particle system's running speed scaling ratio. A value of `0` can be used to pause the + * particles. + */ + public final inline var speedScale: Double + @JvmName("speedScaleProperty") + get() = getSpeedScale() + @JvmName("speedScaleProperty") + set(`value`) { + setSpeedScale(value) + } + + /** + * How rapidly particles in an emission cycle are emitted. If greater than `0`, there will be a + * gap in emissions before the next cycle begins. + */ + public final inline var explosiveness: Float + @JvmName("explosivenessProperty") + get() = getExplosivenessRatio() + @JvmName("explosivenessProperty") + set(`value`) { + setExplosivenessRatio(value) + } + + /** + * Emission lifetime randomness ratio. + */ + public final inline var randomness: Float + @JvmName("randomnessProperty") + get() = getRandomnessRatio() + @JvmName("randomnessProperty") + set(`value`) { + setRandomnessRatio(value) + } + + /** + * Particle lifetime randomness ratio. + */ + public final inline var lifetimeRandomness: Double + @JvmName("lifetimeRandomnessProperty") + get() = getLifetimeRandomness() + @JvmName("lifetimeRandomnessProperty") + set(`value`) { + setLifetimeRandomness(value) + } + + /** + * The particle system's frame rate is fixed to a value. For example, changing the value to 2 will + * make the particles render at 2 frames per second. Note this does not slow down the simulation of + * the particle system itself. + */ + public final inline var fixedFps: Int + @JvmName("fixedFpsProperty") + get() = getFixedFps() + @JvmName("fixedFpsProperty") + set(`value`) { + setFixedFps(value) + } + + /** + * If `true`, results in fractional delta calculation which has a smoother particles display + * effect. + */ + public final inline var fractDelta: Boolean + @JvmName("fractDeltaProperty") + get() = getFractionalDelta() + @JvmName("fractDeltaProperty") + set(`value`) { + setFractionalDelta(value) + } + + /** + * If `true`, particles use the parent node's coordinate space (known as local coordinates). This + * will cause particles to move and rotate along the [CPUParticles2D] node (and its parents) when it + * is moved or rotated. If `false`, particles use global coordinates; they will not move or rotate + * along the [CPUParticles2D] node (and its parents) when it is moved or rotated. + */ + public final inline var localCoords: Boolean + @JvmName("localCoordsProperty") + get() = getUseLocalCoordinates() + @JvmName("localCoordsProperty") + set(`value`) { + setUseLocalCoordinates(value) + } + + /** + * Particle draw order. Uses [DrawOrder] values. + */ + public final inline var drawOrder: DrawOrder + @JvmName("drawOrderProperty") + get() = getDrawOrder() + @JvmName("drawOrderProperty") + set(`value`) { + setDrawOrder(value) + } + + /** + * Particle texture. If `null`, particles will be squares. + */ + public final inline var texture: Texture2D? + @JvmName("textureProperty") + get() = getTexture() + @JvmName("textureProperty") + set(`value`) { + setTexture(value) + } + + /** + * Particles will be emitted inside this region. See [EmissionShape] for possible values. + */ + public final inline var emissionShape: EmissionShape + @JvmName("emissionShapeProperty") + get() = getEmissionShape() + @JvmName("emissionShapeProperty") + set(`value`) { + setEmissionShape(value) + } + + /** + * The sphere's radius if [emissionShape] is set to [EMISSION_SHAPE_SPHERE]. + */ + public final inline var emissionSphereRadius: Float + @JvmName("emissionSphereRadiusProperty") + get() = getEmissionSphereRadius() + @JvmName("emissionSphereRadiusProperty") + set(`value`) { + setEmissionSphereRadius(value) + } + + /** + * The rectangle's extents if [emissionShape] is set to [EMISSION_SHAPE_RECTANGLE]. + */ + @CoreTypeLocalCopy + public final inline var emissionRectExtents: Vector2 + @JvmName("emissionRectExtentsProperty") + get() = getEmissionRectExtents() + @JvmName("emissionRectExtentsProperty") + set(`value`) { + setEmissionRectExtents(value) + } + + /** + * Sets the initial positions to spawn particles when using [EMISSION_SHAPE_POINTS] or + * [EMISSION_SHAPE_DIRECTED_POINTS]. + */ + public final inline var emissionPoints: PackedVector2Array + @JvmName("emissionPointsProperty") + get() = getEmissionPoints() + @JvmName("emissionPointsProperty") + set(`value`) { + setEmissionPoints(value) + } + + /** + * Sets the direction the particles will be emitted in when using + * [EMISSION_SHAPE_DIRECTED_POINTS]. + */ + public final inline var emissionNormals: PackedVector2Array + @JvmName("emissionNormalsProperty") + get() = getEmissionNormals() + @JvmName("emissionNormalsProperty") + set(`value`) { + setEmissionNormals(value) + } + + /** + * Sets the [Color]s to modulate particles by when using [EMISSION_SHAPE_POINTS] or + * [EMISSION_SHAPE_DIRECTED_POINTS]. + */ + public final inline var emissionColors: PackedColorArray + @JvmName("emissionColorsProperty") + get() = getEmissionColors() + @JvmName("emissionColorsProperty") + set(`value`) { + setEmissionColors(value) + } + + /** + * Align Y axis of particle with the direction of its velocity. + */ + public final inline var particleFlagAlignY: Boolean + @JvmName("particleFlagAlignYProperty") + get() = getParticleFlag(CPUParticles2D.ParticleFlags.PARTICLE_FLAG_ALIGN_Y_TO_VELOCITY) + @JvmName("particleFlagAlignYProperty") + set(`value`) { + setParticleFlag(CPUParticles2D.ParticleFlags.PARTICLE_FLAG_ALIGN_Y_TO_VELOCITY, value) + } + + /** + * Unit vector specifying the particles' emission direction. + */ + @CoreTypeLocalCopy + public final inline var direction: Vector2 + @JvmName("directionProperty") + get() = getDirection() + @JvmName("directionProperty") + set(`value`) { + setDirection(value) + } + + /** + * Each particle's initial direction range from `+spread` to `-spread` degrees. + */ + public final inline var spread: Float + @JvmName("spreadProperty") + get() = getSpread() + @JvmName("spreadProperty") + set(`value`) { + setSpread(value) + } + + /** + * Gravity applied to every particle. + */ + @CoreTypeLocalCopy + public final inline var gravity: Vector2 + @JvmName("gravityProperty") + get() = getGravity() + @JvmName("gravityProperty") + set(`value`) { + setGravity(value) + } + + /** + * Minimum equivalent of [initialVelocityMax]. + */ + public final inline var initialVelocityMin: Float + @JvmName("initialVelocityMinProperty") + get() = getParamMin(CPUParticles2D.Parameter.PARAM_INITIAL_LINEAR_VELOCITY) + @JvmName("initialVelocityMinProperty") + set(`value`) { + setParamMin(CPUParticles2D.Parameter.PARAM_INITIAL_LINEAR_VELOCITY, value) + } + + /** + * Maximum initial velocity magnitude for each particle. Direction comes from [direction] and + * [spread]. + */ + public final inline var initialVelocityMax: Float + @JvmName("initialVelocityMaxProperty") + get() = getParamMax(CPUParticles2D.Parameter.PARAM_INITIAL_LINEAR_VELOCITY) + @JvmName("initialVelocityMaxProperty") + set(`value`) { + setParamMax(CPUParticles2D.Parameter.PARAM_INITIAL_LINEAR_VELOCITY, value) + } + + /** + * Minimum equivalent of [angularVelocityMax]. + */ + public final inline var angularVelocityMin: Float + @JvmName("angularVelocityMinProperty") + get() = getParamMin(CPUParticles2D.Parameter.PARAM_ANGULAR_VELOCITY) + @JvmName("angularVelocityMinProperty") + set(`value`) { + setParamMin(CPUParticles2D.Parameter.PARAM_ANGULAR_VELOCITY, value) + } + + /** + * Maximum initial angular velocity (rotation speed) applied to each particle in *degrees* per + * second. + */ + public final inline var angularVelocityMax: Float + @JvmName("angularVelocityMaxProperty") + get() = getParamMax(CPUParticles2D.Parameter.PARAM_ANGULAR_VELOCITY) + @JvmName("angularVelocityMaxProperty") + set(`value`) { + setParamMax(CPUParticles2D.Parameter.PARAM_ANGULAR_VELOCITY, value) + } + + /** + * Each particle's angular velocity will vary along this [Curve]. + */ + public final inline var angularVelocityCurve: Curve? + @JvmName("angularVelocityCurveProperty") + get() = getParamCurve(CPUParticles2D.Parameter.PARAM_ANGULAR_VELOCITY) + @JvmName("angularVelocityCurveProperty") + set(`value`) { + setParamCurve(CPUParticles2D.Parameter.PARAM_ANGULAR_VELOCITY, value) + } + + /** + * Minimum equivalent of [orbitVelocityMax]. + */ + public final inline var orbitVelocityMin: Float + @JvmName("orbitVelocityMinProperty") + get() = getParamMin(CPUParticles2D.Parameter.PARAM_ORBIT_VELOCITY) + @JvmName("orbitVelocityMinProperty") + set(`value`) { + setParamMin(CPUParticles2D.Parameter.PARAM_ORBIT_VELOCITY, value) + } + + /** + * Maximum orbital velocity applied to each particle. Makes the particles circle around origin. + * Specified in number of full rotations around origin per second. + */ + public final inline var orbitVelocityMax: Float + @JvmName("orbitVelocityMaxProperty") + get() = getParamMax(CPUParticles2D.Parameter.PARAM_ORBIT_VELOCITY) + @JvmName("orbitVelocityMaxProperty") + set(`value`) { + setParamMax(CPUParticles2D.Parameter.PARAM_ORBIT_VELOCITY, value) + } + + /** + * Each particle's orbital velocity will vary along this [Curve]. + */ + public final inline var orbitVelocityCurve: Curve? + @JvmName("orbitVelocityCurveProperty") + get() = getParamCurve(CPUParticles2D.Parameter.PARAM_ORBIT_VELOCITY) + @JvmName("orbitVelocityCurveProperty") + set(`value`) { + setParamCurve(CPUParticles2D.Parameter.PARAM_ORBIT_VELOCITY, value) + } + + /** + * Minimum equivalent of [linearAccelMax]. + */ + public final inline var linearAccelMin: Float + @JvmName("linearAccelMinProperty") + get() = getParamMin(CPUParticles2D.Parameter.PARAM_LINEAR_ACCEL) + @JvmName("linearAccelMinProperty") + set(`value`) { + setParamMin(CPUParticles2D.Parameter.PARAM_LINEAR_ACCEL, value) + } + + /** + * Maximum linear acceleration applied to each particle in the direction of motion. + */ + public final inline var linearAccelMax: Float + @JvmName("linearAccelMaxProperty") + get() = getParamMax(CPUParticles2D.Parameter.PARAM_LINEAR_ACCEL) + @JvmName("linearAccelMaxProperty") + set(`value`) { + setParamMax(CPUParticles2D.Parameter.PARAM_LINEAR_ACCEL, value) + } + + /** + * Each particle's linear acceleration will vary along this [Curve]. + */ + public final inline var linearAccelCurve: Curve? + @JvmName("linearAccelCurveProperty") + get() = getParamCurve(CPUParticles2D.Parameter.PARAM_LINEAR_ACCEL) + @JvmName("linearAccelCurveProperty") + set(`value`) { + setParamCurve(CPUParticles2D.Parameter.PARAM_LINEAR_ACCEL, value) + } + + /** + * Minimum equivalent of [radialAccelMax]. + */ + public final inline var radialAccelMin: Float + @JvmName("radialAccelMinProperty") + get() = getParamMin(CPUParticles2D.Parameter.PARAM_RADIAL_ACCEL) + @JvmName("radialAccelMinProperty") + set(`value`) { + setParamMin(CPUParticles2D.Parameter.PARAM_RADIAL_ACCEL, value) + } + + /** + * Maximum radial acceleration applied to each particle. Makes particle accelerate away from the + * origin or towards it if negative. + */ + public final inline var radialAccelMax: Float + @JvmName("radialAccelMaxProperty") + get() = getParamMax(CPUParticles2D.Parameter.PARAM_RADIAL_ACCEL) + @JvmName("radialAccelMaxProperty") + set(`value`) { + setParamMax(CPUParticles2D.Parameter.PARAM_RADIAL_ACCEL, value) + } + + /** + * Each particle's radial acceleration will vary along this [Curve]. + */ + public final inline var radialAccelCurve: Curve? + @JvmName("radialAccelCurveProperty") + get() = getParamCurve(CPUParticles2D.Parameter.PARAM_RADIAL_ACCEL) + @JvmName("radialAccelCurveProperty") + set(`value`) { + setParamCurve(CPUParticles2D.Parameter.PARAM_RADIAL_ACCEL, value) + } + + /** + * Minimum equivalent of [tangentialAccelMax]. + */ + public final inline var tangentialAccelMin: Float + @JvmName("tangentialAccelMinProperty") + get() = getParamMin(CPUParticles2D.Parameter.PARAM_TANGENTIAL_ACCEL) + @JvmName("tangentialAccelMinProperty") + set(`value`) { + setParamMin(CPUParticles2D.Parameter.PARAM_TANGENTIAL_ACCEL, value) + } + + /** + * Maximum tangential acceleration applied to each particle. Tangential acceleration is + * perpendicular to the particle's velocity giving the particles a swirling motion. + */ + public final inline var tangentialAccelMax: Float + @JvmName("tangentialAccelMaxProperty") + get() = getParamMax(CPUParticles2D.Parameter.PARAM_TANGENTIAL_ACCEL) + @JvmName("tangentialAccelMaxProperty") + set(`value`) { + setParamMax(CPUParticles2D.Parameter.PARAM_TANGENTIAL_ACCEL, value) + } + + /** + * Each particle's tangential acceleration will vary along this [Curve]. + */ + public final inline var tangentialAccelCurve: Curve? + @JvmName("tangentialAccelCurveProperty") + get() = getParamCurve(CPUParticles2D.Parameter.PARAM_TANGENTIAL_ACCEL) + @JvmName("tangentialAccelCurveProperty") + set(`value`) { + setParamCurve(CPUParticles2D.Parameter.PARAM_TANGENTIAL_ACCEL, value) + } + + /** + * Minimum equivalent of [dampingMax]. + */ + public final inline var dampingMin: Float + @JvmName("dampingMinProperty") + get() = getParamMin(CPUParticles2D.Parameter.PARAM_DAMPING) + @JvmName("dampingMinProperty") + set(`value`) { + setParamMin(CPUParticles2D.Parameter.PARAM_DAMPING, value) + } + + /** + * The maximum rate at which particles lose velocity. For example value of `100` means that the + * particle will go from `100` velocity to `0` in `1` second. + */ + public final inline var dampingMax: Float + @JvmName("dampingMaxProperty") + get() = getParamMax(CPUParticles2D.Parameter.PARAM_DAMPING) + @JvmName("dampingMaxProperty") + set(`value`) { + setParamMax(CPUParticles2D.Parameter.PARAM_DAMPING, value) + } + + /** + * Damping will vary along this [Curve]. + */ + public final inline var dampingCurve: Curve? + @JvmName("dampingCurveProperty") + get() = getParamCurve(CPUParticles2D.Parameter.PARAM_DAMPING) + @JvmName("dampingCurveProperty") + set(`value`) { + setParamCurve(CPUParticles2D.Parameter.PARAM_DAMPING, value) + } + + /** + * Minimum equivalent of [angleMax]. + */ + public final inline var angleMin: Float + @JvmName("angleMinProperty") + get() = getParamMin(CPUParticles2D.Parameter.PARAM_ANGLE) + @JvmName("angleMinProperty") + set(`value`) { + setParamMin(CPUParticles2D.Parameter.PARAM_ANGLE, value) + } + + /** + * Maximum initial rotation applied to each particle, in degrees. + */ + public final inline var angleMax: Float + @JvmName("angleMaxProperty") + get() = getParamMax(CPUParticles2D.Parameter.PARAM_ANGLE) + @JvmName("angleMaxProperty") + set(`value`) { + setParamMax(CPUParticles2D.Parameter.PARAM_ANGLE, value) + } + + /** + * Each particle's rotation will be animated along this [Curve]. + */ + public final inline var angleCurve: Curve? + @JvmName("angleCurveProperty") + get() = getParamCurve(CPUParticles2D.Parameter.PARAM_ANGLE) + @JvmName("angleCurveProperty") + set(`value`) { + setParamCurve(CPUParticles2D.Parameter.PARAM_ANGLE, value) + } + + /** + * Minimum equivalent of [scaleAmountMax]. + */ + public final inline var scaleAmountMin: Float + @JvmName("scaleAmountMinProperty") + get() = getParamMin(CPUParticles2D.Parameter.PARAM_SCALE) + @JvmName("scaleAmountMinProperty") + set(`value`) { + setParamMin(CPUParticles2D.Parameter.PARAM_SCALE, value) + } + + /** + * Maximum initial scale applied to each particle. + */ + public final inline var scaleAmountMax: Float + @JvmName("scaleAmountMaxProperty") + get() = getParamMax(CPUParticles2D.Parameter.PARAM_SCALE) + @JvmName("scaleAmountMaxProperty") + set(`value`) { + setParamMax(CPUParticles2D.Parameter.PARAM_SCALE, value) + } + + /** + * Each particle's scale will vary along this [Curve]. + */ + public final inline var scaleAmountCurve: Curve? + @JvmName("scaleAmountCurveProperty") + get() = getParamCurve(CPUParticles2D.Parameter.PARAM_SCALE) + @JvmName("scaleAmountCurveProperty") + set(`value`) { + setParamCurve(CPUParticles2D.Parameter.PARAM_SCALE, value) + } + + /** + * If `true`, the scale curve will be split into x and y components. See [scaleCurveX] and + * [scaleCurveY]. + */ + public final inline var splitScale: Boolean + @JvmName("splitScaleProperty") + get() = getSplitScale() + @JvmName("splitScaleProperty") + set(`value`) { + setSplitScale(value) + } + + /** + * Each particle's horizontal scale will vary along this [Curve]. + * [splitScale] must be enabled. + */ + public final inline var scaleCurveX: Curve? + @JvmName("scaleCurveXProperty") + get() = getScaleCurveX() + @JvmName("scaleCurveXProperty") + set(`value`) { + setScaleCurveX(value) + } + + /** + * Each particle's vertical scale will vary along this [Curve]. + * [splitScale] must be enabled. + */ + public final inline var scaleCurveY: Curve? + @JvmName("scaleCurveYProperty") + get() = getScaleCurveY() + @JvmName("scaleCurveYProperty") + set(`value`) { + setScaleCurveY(value) + } + + /** + * Each particle's initial color. If [texture] is defined, it will be multiplied by this color. + */ + @CoreTypeLocalCopy + public final inline var color: Color + @JvmName("colorProperty") + get() = getColor() + @JvmName("colorProperty") + set(`value`) { + setColor(value) + } + + /** + * Each particle's color will vary along this [Gradient] (multiplied with [color]). + */ + public final inline var colorRamp: Gradient? + @JvmName("colorRampProperty") + get() = getColorRamp() + @JvmName("colorRampProperty") + set(`value`) { + setColorRamp(value) + } + + /** + * Each particle's initial color will vary along this [GradientTexture1D] (multiplied with + * [color]). + */ + public final inline var colorInitialRamp: Gradient? + @JvmName("colorInitialRampProperty") + get() = getColorInitialRamp() + @JvmName("colorInitialRampProperty") + set(`value`) { + setColorInitialRamp(value) + } + + /** + * Minimum equivalent of [hueVariationMax]. + */ + public final inline var hueVariationMin: Float + @JvmName("hueVariationMinProperty") + get() = getParamMin(CPUParticles2D.Parameter.PARAM_HUE_VARIATION) + @JvmName("hueVariationMinProperty") + set(`value`) { + setParamMin(CPUParticles2D.Parameter.PARAM_HUE_VARIATION, value) + } + + /** + * Maximum initial hue variation applied to each particle. It will shift the particle color's hue. + */ + public final inline var hueVariationMax: Float + @JvmName("hueVariationMaxProperty") + get() = getParamMax(CPUParticles2D.Parameter.PARAM_HUE_VARIATION) + @JvmName("hueVariationMaxProperty") + set(`value`) { + setParamMax(CPUParticles2D.Parameter.PARAM_HUE_VARIATION, value) + } + + /** + * Each particle's hue will vary along this [Curve]. + */ + public final inline var hueVariationCurve: Curve? + @JvmName("hueVariationCurveProperty") + get() = getParamCurve(CPUParticles2D.Parameter.PARAM_HUE_VARIATION) + @JvmName("hueVariationCurveProperty") + set(`value`) { + setParamCurve(CPUParticles2D.Parameter.PARAM_HUE_VARIATION, value) + } + + /** + * Minimum equivalent of [animSpeedMax]. + */ + public final inline var animSpeedMin: Float + @JvmName("animSpeedMinProperty") + get() = getParamMin(CPUParticles2D.Parameter.PARAM_ANIM_SPEED) + @JvmName("animSpeedMinProperty") + set(`value`) { + setParamMin(CPUParticles2D.Parameter.PARAM_ANIM_SPEED, value) + } + + /** + * Maximum particle animation speed. Animation speed of `1` means that the particles will make + * full `0` to `1` offset cycle during lifetime, `2` means `2` cycles etc. + * With animation speed greater than `1`, remember to enable + * [CanvasItemMaterial.particlesAnimLoop] property if you want the animation to repeat. + */ + public final inline var animSpeedMax: Float + @JvmName("animSpeedMaxProperty") + get() = getParamMax(CPUParticles2D.Parameter.PARAM_ANIM_SPEED) + @JvmName("animSpeedMaxProperty") + set(`value`) { + setParamMax(CPUParticles2D.Parameter.PARAM_ANIM_SPEED, value) + } + + /** + * Each particle's animation speed will vary along this [Curve]. + */ + public final inline var animSpeedCurve: Curve? + @JvmName("animSpeedCurveProperty") + get() = getParamCurve(CPUParticles2D.Parameter.PARAM_ANIM_SPEED) + @JvmName("animSpeedCurveProperty") + set(`value`) { + setParamCurve(CPUParticles2D.Parameter.PARAM_ANIM_SPEED, value) + } + + /** + * Minimum equivalent of [animOffsetMax]. + */ + public final inline var animOffsetMin: Float + @JvmName("animOffsetMinProperty") + get() = getParamMin(CPUParticles2D.Parameter.PARAM_ANIM_OFFSET) + @JvmName("animOffsetMinProperty") + set(`value`) { + setParamMin(CPUParticles2D.Parameter.PARAM_ANIM_OFFSET, value) + } + + /** + * Maximum animation offset that corresponds to frame index in the texture. `0` is the first + * frame, `1` is the last one. See [CanvasItemMaterial.particlesAnimation]. + */ + public final inline var animOffsetMax: Float + @JvmName("animOffsetMaxProperty") + get() = getParamMax(CPUParticles2D.Parameter.PARAM_ANIM_OFFSET) + @JvmName("animOffsetMaxProperty") + set(`value`) { + setParamMax(CPUParticles2D.Parameter.PARAM_ANIM_OFFSET, value) + } + + /** + * Each particle's animation offset will vary along this [Curve]. + */ + public final inline var animOffsetCurve: Curve? + @JvmName("animOffsetCurveProperty") + get() = getParamCurve(CPUParticles2D.Parameter.PARAM_ANIM_OFFSET) + @JvmName("animOffsetCurveProperty") + set(`value`) { + setParamCurve(CPUParticles2D.Parameter.PARAM_ANIM_OFFSET, value) + } + + public override fun new(scriptIndex: Int): Unit { + Internals.callConstructor(this, ENGINE_CLASS_CPUPARTICLES2D_INDEX, scriptIndex) + } + + /** + * The rectangle's extents if [emissionShape] is set to [EMISSION_SHAPE_RECTANGLE]. + * + * This is a helper function to make dealing with local copies easier. + * + * For more information, see our + * [documentation](https://godot-kotl.in/en/stable/user-guide/api-differences/#core-types). + * + * Allow to directly modify the local copy of the property and assign it back to the Object. + * + * Prefer that over writing: + * `````` + * val myCoreType = cpuparticles2d.emissionRectExtents + * //Your changes + * cpuparticles2d.emissionRectExtents = myCoreType + * `````` + */ + @CoreTypeHelper + public final fun emissionRectExtentsMutate(block: Vector2.() -> Unit): Vector2 = + emissionRectExtents.apply{ + block(this) + emissionRectExtents = this + } + + + /** + * Unit vector specifying the particles' emission direction. + * + * This is a helper function to make dealing with local copies easier. + * + * For more information, see our + * [documentation](https://godot-kotl.in/en/stable/user-guide/api-differences/#core-types). + * + * Allow to directly modify the local copy of the property and assign it back to the Object. + * + * Prefer that over writing: + * `````` + * val myCoreType = cpuparticles2d.direction + * //Your changes + * cpuparticles2d.direction = myCoreType + * `````` + */ + @CoreTypeHelper + public final fun directionMutate(block: Vector2.() -> Unit): Vector2 = direction.apply{ + block(this) + direction = this + } + + + /** + * Gravity applied to every particle. + * + * This is a helper function to make dealing with local copies easier. + * + * For more information, see our + * [documentation](https://godot-kotl.in/en/stable/user-guide/api-differences/#core-types). + * + * Allow to directly modify the local copy of the property and assign it back to the Object. + * + * Prefer that over writing: + * `````` + * val myCoreType = cpuparticles2d.gravity + * //Your changes + * cpuparticles2d.gravity = myCoreType + * `````` + */ + @CoreTypeHelper + public final fun gravityMutate(block: Vector2.() -> Unit): Vector2 = gravity.apply{ + block(this) + gravity = this + } + + + /** + * Each particle's initial color. If [texture] is defined, it will be multiplied by this color. + * + * This is a helper function to make dealing with local copies easier. + * + * For more information, see our + * [documentation](https://godot-kotl.in/en/stable/user-guide/api-differences/#core-types). + * + * Allow to directly modify the local copy of the property and assign it back to the Object. + * + * Prefer that over writing: + * `````` + * val myCoreType = cpuparticles2d.color + * //Your changes + * cpuparticles2d.color = myCoreType + * `````` + */ + @CoreTypeHelper + public final fun colorMutate(block: Color.() -> Unit): Color = color.apply{ + block(this) + color = this + } + + + public final fun setEmitting(emitting: Boolean): Unit { + Internals.writeArguments(BOOL to emitting) + Internals.callMethod(rawPtr, MethodBindings.setEmittingPtr, NIL) + } + + public final fun setAmount(amount: Int): Unit { + Internals.writeArguments(LONG to amount.toLong()) + Internals.callMethod(rawPtr, MethodBindings.setAmountPtr, NIL) + } + + public final fun setLifetime(secs: Double): Unit { + Internals.writeArguments(DOUBLE to secs) + Internals.callMethod(rawPtr, MethodBindings.setLifetimePtr, NIL) + } + + public final fun setOneShot(enable: Boolean): Unit { + Internals.writeArguments(BOOL to enable) + Internals.callMethod(rawPtr, MethodBindings.setOneShotPtr, NIL) + } + + public final fun setPreProcessTime(secs: Double): Unit { + Internals.writeArguments(DOUBLE to secs) + Internals.callMethod(rawPtr, MethodBindings.setPreProcessTimePtr, NIL) + } + + public final fun setExplosivenessRatio(ratio: Float): Unit { + Internals.writeArguments(DOUBLE to ratio.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setExplosivenessRatioPtr, NIL) + } + + public final fun setRandomnessRatio(ratio: Float): Unit { + Internals.writeArguments(DOUBLE to ratio.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setRandomnessRatioPtr, NIL) + } + + public final fun setLifetimeRandomness(random: Double): Unit { + Internals.writeArguments(DOUBLE to random) + Internals.callMethod(rawPtr, MethodBindings.setLifetimeRandomnessPtr, NIL) + } + + public final fun setUseLocalCoordinates(enable: Boolean): Unit { + Internals.writeArguments(BOOL to enable) + Internals.callMethod(rawPtr, MethodBindings.setUseLocalCoordinatesPtr, NIL) + } + + public final fun setFixedFps(fps: Int): Unit { + Internals.writeArguments(LONG to fps.toLong()) + Internals.callMethod(rawPtr, MethodBindings.setFixedFpsPtr, NIL) + } + + public final fun setFractionalDelta(enable: Boolean): Unit { + Internals.writeArguments(BOOL to enable) + Internals.callMethod(rawPtr, MethodBindings.setFractionalDeltaPtr, NIL) + } + + public final fun setSpeedScale(scale: Double): Unit { + Internals.writeArguments(DOUBLE to scale) + Internals.callMethod(rawPtr, MethodBindings.setSpeedScalePtr, NIL) + } + + public final fun isEmitting(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isEmittingPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public final fun getAmount(): Int { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getAmountPtr, LONG) + return (Internals.readReturnValue(LONG) as Long).toInt() + } + + public final fun getLifetime(): Double { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getLifetimePtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double) + } + + public final fun getOneShot(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getOneShotPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public final fun getPreProcessTime(): Double { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getPreProcessTimePtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double) + } + + public final fun getExplosivenessRatio(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getExplosivenessRatioPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun getRandomnessRatio(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getRandomnessRatioPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun getLifetimeRandomness(): Double { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getLifetimeRandomnessPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double) + } + + public final fun getUseLocalCoordinates(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getUseLocalCoordinatesPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public final fun getFixedFps(): Int { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getFixedFpsPtr, LONG) + return (Internals.readReturnValue(LONG) as Long).toInt() + } + + public final fun getFractionalDelta(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getFractionalDeltaPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public final fun getSpeedScale(): Double { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getSpeedScalePtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double) + } + + public final fun setDrawOrder(order: DrawOrder): Unit { + Internals.writeArguments(LONG to order.id) + Internals.callMethod(rawPtr, MethodBindings.setDrawOrderPtr, NIL) + } + + public final fun getDrawOrder(): DrawOrder { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getDrawOrderPtr, LONG) + return CPUParticles2D.DrawOrder.from(Internals.readReturnValue(LONG) as Long) + } + + public final fun setTexture(texture: Texture2D?): Unit { + Internals.writeArguments(OBJECT to texture) + Internals.callMethod(rawPtr, MethodBindings.setTexturePtr, NIL) + } + + public final fun getTexture(): Texture2D? { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getTexturePtr, OBJECT) + return (Internals.readReturnValue(OBJECT) as Texture2D?) + } + + /** + * Restarts the particle emitter. + */ + public final fun restart(): Unit { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.restartPtr, NIL) + } + + public final fun setDirection(direction: Vector2): Unit { + Internals.writeArguments(VECTOR2 to direction) + Internals.callMethod(rawPtr, MethodBindings.setDirectionPtr, NIL) + } + + public final fun getDirection(): Vector2 { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getDirectionPtr, VECTOR2) + return (Internals.readReturnValue(VECTOR2) as Vector2) + } + + public final fun setSpread(spread: Float): Unit { + Internals.writeArguments(DOUBLE to spread.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setSpreadPtr, NIL) + } + + public final fun getSpread(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getSpreadPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + /** + * Sets the minimum value for the given parameter. + */ + public final fun setParamMin(`param`: Parameter, `value`: Float): Unit { + Internals.writeArguments(LONG to param.id, DOUBLE to value.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setParamMinPtr, NIL) + } + + /** + * Returns the minimum value range for the given parameter. + */ + public final fun getParamMin(`param`: Parameter): Float { + Internals.writeArguments(LONG to param.id) + Internals.callMethod(rawPtr, MethodBindings.getParamMinPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + /** + * Sets the maximum value for the given parameter. + */ + public final fun setParamMax(`param`: Parameter, `value`: Float): Unit { + Internals.writeArguments(LONG to param.id, DOUBLE to value.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setParamMaxPtr, NIL) + } + + /** + * Returns the maximum value range for the given parameter. + */ + public final fun getParamMax(`param`: Parameter): Float { + Internals.writeArguments(LONG to param.id) + Internals.callMethod(rawPtr, MethodBindings.getParamMaxPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + /** + * Sets the [Curve] of the parameter specified by [Parameter]. + */ + public final fun setParamCurve(`param`: Parameter, curve: Curve?): Unit { + Internals.writeArguments(LONG to param.id, OBJECT to curve) + Internals.callMethod(rawPtr, MethodBindings.setParamCurvePtr, NIL) + } + + /** + * Returns the [Curve] of the parameter specified by [Parameter]. + */ + public final fun getParamCurve(`param`: Parameter): Curve? { + Internals.writeArguments(LONG to param.id) + Internals.callMethod(rawPtr, MethodBindings.getParamCurvePtr, OBJECT) + return (Internals.readReturnValue(OBJECT) as Curve?) + } + + public final fun setColor(color: Color): Unit { + Internals.writeArguments(COLOR to color) + Internals.callMethod(rawPtr, MethodBindings.setColorPtr, NIL) + } + + public final fun getColor(): Color { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getColorPtr, COLOR) + return (Internals.readReturnValue(COLOR) as Color) + } + + public final fun setColorRamp(ramp: Gradient?): Unit { + Internals.writeArguments(OBJECT to ramp) + Internals.callMethod(rawPtr, MethodBindings.setColorRampPtr, NIL) + } + + public final fun getColorRamp(): Gradient? { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getColorRampPtr, OBJECT) + return (Internals.readReturnValue(OBJECT) as Gradient?) + } + + public final fun setColorInitialRamp(ramp: Gradient?): Unit { + Internals.writeArguments(OBJECT to ramp) + Internals.callMethod(rawPtr, MethodBindings.setColorInitialRampPtr, NIL) + } + + public final fun getColorInitialRamp(): Gradient? { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getColorInitialRampPtr, OBJECT) + return (Internals.readReturnValue(OBJECT) as Gradient?) + } + + /** + * Enables or disables the given flag (see [ParticleFlags] for options). + */ + public final fun setParticleFlag(particleFlag: ParticleFlags, enable: Boolean): Unit { + Internals.writeArguments(LONG to particleFlag.id, BOOL to enable) + Internals.callMethod(rawPtr, MethodBindings.setParticleFlagPtr, NIL) + } + + /** + * Returns the enabled state of the given flag (see [ParticleFlags] for options). + */ + public final fun getParticleFlag(particleFlag: ParticleFlags): Boolean { + Internals.writeArguments(LONG to particleFlag.id) + Internals.callMethod(rawPtr, MethodBindings.getParticleFlagPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public final fun setEmissionShape(shape: EmissionShape): Unit { + Internals.writeArguments(LONG to shape.id) + Internals.callMethod(rawPtr, MethodBindings.setEmissionShapePtr, NIL) + } + + public final fun getEmissionShape(): EmissionShape { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getEmissionShapePtr, LONG) + return CPUParticles2D.EmissionShape.from(Internals.readReturnValue(LONG) as Long) + } + + public final fun setEmissionSphereRadius(radius: Float): Unit { + Internals.writeArguments(DOUBLE to radius.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setEmissionSphereRadiusPtr, NIL) + } + + public final fun getEmissionSphereRadius(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getEmissionSphereRadiusPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setEmissionRectExtents(extents: Vector2): Unit { + Internals.writeArguments(VECTOR2 to extents) + Internals.callMethod(rawPtr, MethodBindings.setEmissionRectExtentsPtr, NIL) + } + + public final fun getEmissionRectExtents(): Vector2 { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getEmissionRectExtentsPtr, VECTOR2) + return (Internals.readReturnValue(VECTOR2) as Vector2) + } + + public final fun setEmissionPoints(array: PackedVector2Array): Unit { + Internals.writeArguments(PACKED_VECTOR2_ARRAY to array) + Internals.callMethod(rawPtr, MethodBindings.setEmissionPointsPtr, NIL) + } + + public final fun getEmissionPoints(): PackedVector2Array { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getEmissionPointsPtr, PACKED_VECTOR2_ARRAY) + return (Internals.readReturnValue(PACKED_VECTOR2_ARRAY) as PackedVector2Array) + } + + public final fun setEmissionNormals(array: PackedVector2Array): Unit { + Internals.writeArguments(PACKED_VECTOR2_ARRAY to array) + Internals.callMethod(rawPtr, MethodBindings.setEmissionNormalsPtr, NIL) + } + + public final fun getEmissionNormals(): PackedVector2Array { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getEmissionNormalsPtr, PACKED_VECTOR2_ARRAY) + return (Internals.readReturnValue(PACKED_VECTOR2_ARRAY) as PackedVector2Array) + } + + public final fun setEmissionColors(array: PackedColorArray): Unit { + Internals.writeArguments(PACKED_COLOR_ARRAY to array) + Internals.callMethod(rawPtr, MethodBindings.setEmissionColorsPtr, NIL) + } + + public final fun getEmissionColors(): PackedColorArray { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getEmissionColorsPtr, PACKED_COLOR_ARRAY) + return (Internals.readReturnValue(PACKED_COLOR_ARRAY) as PackedColorArray) + } + + public final fun getGravity(): Vector2 { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getGravityPtr, VECTOR2) + return (Internals.readReturnValue(VECTOR2) as Vector2) + } + + public final fun setGravity(accelVec: Vector2): Unit { + Internals.writeArguments(VECTOR2 to accelVec) + Internals.callMethod(rawPtr, MethodBindings.setGravityPtr, NIL) + } + + public final fun getSplitScale(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getSplitScalePtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public final fun setSplitScale(splitScale: Boolean): Unit { + Internals.writeArguments(BOOL to splitScale) + Internals.callMethod(rawPtr, MethodBindings.setSplitScalePtr, NIL) + } + + public final fun getScaleCurveX(): Curve? { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getScaleCurveXPtr, OBJECT) + return (Internals.readReturnValue(OBJECT) as Curve?) + } + + public final fun setScaleCurveX(scaleCurve: Curve?): Unit { + Internals.writeArguments(OBJECT to scaleCurve) + Internals.callMethod(rawPtr, MethodBindings.setScaleCurveXPtr, NIL) + } + + public final fun getScaleCurveY(): Curve? { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getScaleCurveYPtr, OBJECT) + return (Internals.readReturnValue(OBJECT) as Curve?) + } + + public final fun setScaleCurveY(scaleCurve: Curve?): Unit { + Internals.writeArguments(OBJECT to scaleCurve) + Internals.callMethod(rawPtr, MethodBindings.setScaleCurveYPtr, NIL) + } + + /** + * Sets this node's properties to match a given [GPUParticles2D] node with an assigned + * [ParticleProcessMaterial]. + */ + public final fun convertFromParticles(particles: Node?): Unit { + Internals.writeArguments(OBJECT to particles) + Internals.callMethod(rawPtr, MethodBindings.convertFromParticlesPtr, NIL) + } + + public enum class DrawOrder( + id: Long, + ) { + /** + * Particles are drawn in the order emitted. + */ + DRAW_ORDER_INDEX(0), + /** + * Particles are drawn in order of remaining lifetime. In other words, the particle with the + * highest lifetime is drawn at the front. + */ + DRAW_ORDER_LIFETIME(1), + ; + + public val id: Long + init { + this.id = id + } + + public companion object { + public fun from(`value`: Long): DrawOrder = entries.single { it.id == `value` } + } + } + + public enum class Parameter( + id: Long, + ) { + /** + * Use with [setParamMin], [setParamMax], and [setParamCurve] to set initial velocity + * properties. + */ + PARAM_INITIAL_LINEAR_VELOCITY(0), + /** + * Use with [setParamMin], [setParamMax], and [setParamCurve] to set angular velocity + * properties. + */ + PARAM_ANGULAR_VELOCITY(1), + /** + * Use with [setParamMin], [setParamMax], and [setParamCurve] to set orbital velocity + * properties. + */ + PARAM_ORBIT_VELOCITY(2), + /** + * Use with [setParamMin], [setParamMax], and [setParamCurve] to set linear acceleration + * properties. + */ + PARAM_LINEAR_ACCEL(3), + /** + * Use with [setParamMin], [setParamMax], and [setParamCurve] to set radial acceleration + * properties. + */ + PARAM_RADIAL_ACCEL(4), + /** + * Use with [setParamMin], [setParamMax], and [setParamCurve] to set tangential acceleration + * properties. + */ + PARAM_TANGENTIAL_ACCEL(5), + /** + * Use with [setParamMin], [setParamMax], and [setParamCurve] to set damping properties. + */ + PARAM_DAMPING(6), + /** + * Use with [setParamMin], [setParamMax], and [setParamCurve] to set angle properties. + */ + PARAM_ANGLE(7), + /** + * Use with [setParamMin], [setParamMax], and [setParamCurve] to set scale properties. + */ + PARAM_SCALE(8), + /** + * Use with [setParamMin], [setParamMax], and [setParamCurve] to set hue variation properties. + */ + PARAM_HUE_VARIATION(9), + /** + * Use with [setParamMin], [setParamMax], and [setParamCurve] to set animation speed properties. + */ + PARAM_ANIM_SPEED(10), + /** + * Use with [setParamMin], [setParamMax], and [setParamCurve] to set animation offset + * properties. + */ + PARAM_ANIM_OFFSET(11), + /** + * Represents the size of the [Parameter] enum. + */ + PARAM_MAX(12), + ; + + public val id: Long + init { + this.id = id + } + + public companion object { + public fun from(`value`: Long): Parameter = entries.single { it.id == `value` } + } + } + + public enum class ParticleFlags( + id: Long, + ) { + /** + * Use with [setParticleFlag] to set [particleFlagAlignY]. + */ + PARTICLE_FLAG_ALIGN_Y_TO_VELOCITY(0), + /** + * Present for consistency with 3D particle nodes, not used in 2D. + */ + PARTICLE_FLAG_ROTATE_Y(1), + /** + * Present for consistency with 3D particle nodes, not used in 2D. + */ + PARTICLE_FLAG_DISABLE_Z(2), + /** + * Represents the size of the [ParticleFlags] enum. + */ + PARTICLE_FLAG_MAX(3), + ; + + public val id: Long + init { + this.id = id + } + + public companion object { + public fun from(`value`: Long): ParticleFlags = entries.single { it.id == `value` } + } + } + + public enum class EmissionShape( + id: Long, + ) { + /** + * All particles will be emitted from a single point. + */ + EMISSION_SHAPE_POINT(0), + /** + * Particles will be emitted in the volume of a sphere flattened to two dimensions. + */ + EMISSION_SHAPE_SPHERE(1), + /** + * Particles will be emitted on the surface of a sphere flattened to two dimensions. + */ + EMISSION_SHAPE_SPHERE_SURFACE(2), + /** + * Particles will be emitted in the area of a rectangle. + */ + EMISSION_SHAPE_RECTANGLE(3), + /** + * Particles will be emitted at a position chosen randomly among [emissionPoints]. Particle + * color will be modulated by [emissionColors]. + */ + EMISSION_SHAPE_POINTS(4), + /** + * Particles will be emitted at a position chosen randomly among [emissionPoints]. Particle + * velocity and rotation will be set based on [emissionNormals]. Particle color will be modulated + * by [emissionColors]. + */ + EMISSION_SHAPE_DIRECTED_POINTS(5), + /** + * Represents the size of the [EmissionShape] enum. + */ + EMISSION_SHAPE_MAX(6), + ; + + public val id: Long + init { + this.id = id + } + + public companion object { + public fun from(`value`: Long): EmissionShape = entries.single { it.id == `value` } + } + } + + public companion object + + public object MethodBindings { + internal val setEmittingPtr: VoidPtr = + Internals.getMethodBindPtr("CPUParticles2D", "set_emitting", 2586408642) + + internal val setAmountPtr: VoidPtr = + Internals.getMethodBindPtr("CPUParticles2D", "set_amount", 1286410249) + + internal val setLifetimePtr: VoidPtr = + Internals.getMethodBindPtr("CPUParticles2D", "set_lifetime", 373806689) + + internal val setOneShotPtr: VoidPtr = + Internals.getMethodBindPtr("CPUParticles2D", "set_one_shot", 2586408642) + + internal val setPreProcessTimePtr: VoidPtr = + Internals.getMethodBindPtr("CPUParticles2D", "set_pre_process_time", 373806689) + + internal val setExplosivenessRatioPtr: VoidPtr = + Internals.getMethodBindPtr("CPUParticles2D", "set_explosiveness_ratio", 373806689) + + internal val setRandomnessRatioPtr: VoidPtr = + Internals.getMethodBindPtr("CPUParticles2D", "set_randomness_ratio", 373806689) + + internal val setLifetimeRandomnessPtr: VoidPtr = + Internals.getMethodBindPtr("CPUParticles2D", "set_lifetime_randomness", 373806689) + + internal val setUseLocalCoordinatesPtr: VoidPtr = + Internals.getMethodBindPtr("CPUParticles2D", "set_use_local_coordinates", 2586408642) + + internal val setFixedFpsPtr: VoidPtr = + Internals.getMethodBindPtr("CPUParticles2D", "set_fixed_fps", 1286410249) + + internal val setFractionalDeltaPtr: VoidPtr = + Internals.getMethodBindPtr("CPUParticles2D", "set_fractional_delta", 2586408642) + + internal val setSpeedScalePtr: VoidPtr = + Internals.getMethodBindPtr("CPUParticles2D", "set_speed_scale", 373806689) + + internal val isEmittingPtr: VoidPtr = + Internals.getMethodBindPtr("CPUParticles2D", "is_emitting", 36873697) + + internal val getAmountPtr: VoidPtr = + Internals.getMethodBindPtr("CPUParticles2D", "get_amount", 3905245786) + + internal val getLifetimePtr: VoidPtr = + Internals.getMethodBindPtr("CPUParticles2D", "get_lifetime", 1740695150) + + internal val getOneShotPtr: VoidPtr = + Internals.getMethodBindPtr("CPUParticles2D", "get_one_shot", 36873697) + + internal val getPreProcessTimePtr: VoidPtr = + Internals.getMethodBindPtr("CPUParticles2D", "get_pre_process_time", 1740695150) + + internal val getExplosivenessRatioPtr: VoidPtr = + Internals.getMethodBindPtr("CPUParticles2D", "get_explosiveness_ratio", 1740695150) + + internal val getRandomnessRatioPtr: VoidPtr = + Internals.getMethodBindPtr("CPUParticles2D", "get_randomness_ratio", 1740695150) + + internal val getLifetimeRandomnessPtr: VoidPtr = + Internals.getMethodBindPtr("CPUParticles2D", "get_lifetime_randomness", 1740695150) + + internal val getUseLocalCoordinatesPtr: VoidPtr = + Internals.getMethodBindPtr("CPUParticles2D", "get_use_local_coordinates", 36873697) + + internal val getFixedFpsPtr: VoidPtr = + Internals.getMethodBindPtr("CPUParticles2D", "get_fixed_fps", 3905245786) + + internal val getFractionalDeltaPtr: VoidPtr = + Internals.getMethodBindPtr("CPUParticles2D", "get_fractional_delta", 36873697) + + internal val getSpeedScalePtr: VoidPtr = + Internals.getMethodBindPtr("CPUParticles2D", "get_speed_scale", 1740695150) + + internal val setDrawOrderPtr: VoidPtr = + Internals.getMethodBindPtr("CPUParticles2D", "set_draw_order", 4183193490) + + internal val getDrawOrderPtr: VoidPtr = + Internals.getMethodBindPtr("CPUParticles2D", "get_draw_order", 1668655735) + + internal val setTexturePtr: VoidPtr = + Internals.getMethodBindPtr("CPUParticles2D", "set_texture", 4051416890) + + internal val getTexturePtr: VoidPtr = + Internals.getMethodBindPtr("CPUParticles2D", "get_texture", 3635182373) + + internal val restartPtr: VoidPtr = + Internals.getMethodBindPtr("CPUParticles2D", "restart", 3218959716) + + internal val setDirectionPtr: VoidPtr = + Internals.getMethodBindPtr("CPUParticles2D", "set_direction", 743155724) + + internal val getDirectionPtr: VoidPtr = + Internals.getMethodBindPtr("CPUParticles2D", "get_direction", 3341600327) + + internal val setSpreadPtr: VoidPtr = + Internals.getMethodBindPtr("CPUParticles2D", "set_spread", 373806689) + + internal val getSpreadPtr: VoidPtr = + Internals.getMethodBindPtr("CPUParticles2D", "get_spread", 1740695150) + + internal val setParamMinPtr: VoidPtr = + Internals.getMethodBindPtr("CPUParticles2D", "set_param_min", 3320615296) + + internal val getParamMinPtr: VoidPtr = + Internals.getMethodBindPtr("CPUParticles2D", "get_param_min", 2038050600) + + internal val setParamMaxPtr: VoidPtr = + Internals.getMethodBindPtr("CPUParticles2D", "set_param_max", 3320615296) + + internal val getParamMaxPtr: VoidPtr = + Internals.getMethodBindPtr("CPUParticles2D", "get_param_max", 2038050600) + + internal val setParamCurvePtr: VoidPtr = + Internals.getMethodBindPtr("CPUParticles2D", "set_param_curve", 2959350143) + + internal val getParamCurvePtr: VoidPtr = + Internals.getMethodBindPtr("CPUParticles2D", "get_param_curve", 2603158474) + + internal val setColorPtr: VoidPtr = + Internals.getMethodBindPtr("CPUParticles2D", "set_color", 2920490490) + + internal val getColorPtr: VoidPtr = + Internals.getMethodBindPtr("CPUParticles2D", "get_color", 3444240500) + + internal val setColorRampPtr: VoidPtr = + Internals.getMethodBindPtr("CPUParticles2D", "set_color_ramp", 2756054477) + + internal val getColorRampPtr: VoidPtr = + Internals.getMethodBindPtr("CPUParticles2D", "get_color_ramp", 132272999) + + internal val setColorInitialRampPtr: VoidPtr = + Internals.getMethodBindPtr("CPUParticles2D", "set_color_initial_ramp", 2756054477) + + internal val getColorInitialRampPtr: VoidPtr = + Internals.getMethodBindPtr("CPUParticles2D", "get_color_initial_ramp", 132272999) + + internal val setParticleFlagPtr: VoidPtr = + Internals.getMethodBindPtr("CPUParticles2D", "set_particle_flag", 4178137949) + + internal val getParticleFlagPtr: VoidPtr = + Internals.getMethodBindPtr("CPUParticles2D", "get_particle_flag", 2829976507) + + internal val setEmissionShapePtr: VoidPtr = + Internals.getMethodBindPtr("CPUParticles2D", "set_emission_shape", 393763892) + + internal val getEmissionShapePtr: VoidPtr = + Internals.getMethodBindPtr("CPUParticles2D", "get_emission_shape", 1740246024) + + internal val setEmissionSphereRadiusPtr: VoidPtr = + Internals.getMethodBindPtr("CPUParticles2D", "set_emission_sphere_radius", 373806689) + + internal val getEmissionSphereRadiusPtr: VoidPtr = + Internals.getMethodBindPtr("CPUParticles2D", "get_emission_sphere_radius", 1740695150) + + internal val setEmissionRectExtentsPtr: VoidPtr = + Internals.getMethodBindPtr("CPUParticles2D", "set_emission_rect_extents", 743155724) + + internal val getEmissionRectExtentsPtr: VoidPtr = + Internals.getMethodBindPtr("CPUParticles2D", "get_emission_rect_extents", 3341600327) + + internal val setEmissionPointsPtr: VoidPtr = + Internals.getMethodBindPtr("CPUParticles2D", "set_emission_points", 1509147220) + + internal val getEmissionPointsPtr: VoidPtr = + Internals.getMethodBindPtr("CPUParticles2D", "get_emission_points", 2961356807) + + internal val setEmissionNormalsPtr: VoidPtr = + Internals.getMethodBindPtr("CPUParticles2D", "set_emission_normals", 1509147220) + + internal val getEmissionNormalsPtr: VoidPtr = + Internals.getMethodBindPtr("CPUParticles2D", "get_emission_normals", 2961356807) + + internal val setEmissionColorsPtr: VoidPtr = + Internals.getMethodBindPtr("CPUParticles2D", "set_emission_colors", 3546319833) + + internal val getEmissionColorsPtr: VoidPtr = + Internals.getMethodBindPtr("CPUParticles2D", "get_emission_colors", 1392750486) + + internal val getGravityPtr: VoidPtr = + Internals.getMethodBindPtr("CPUParticles2D", "get_gravity", 3341600327) + + internal val setGravityPtr: VoidPtr = + Internals.getMethodBindPtr("CPUParticles2D", "set_gravity", 743155724) + + internal val getSplitScalePtr: VoidPtr = + Internals.getMethodBindPtr("CPUParticles2D", "get_split_scale", 2240911060) + + internal val setSplitScalePtr: VoidPtr = + Internals.getMethodBindPtr("CPUParticles2D", "set_split_scale", 2586408642) + + internal val getScaleCurveXPtr: VoidPtr = + Internals.getMethodBindPtr("CPUParticles2D", "get_scale_curve_x", 2460114913) + + internal val setScaleCurveXPtr: VoidPtr = + Internals.getMethodBindPtr("CPUParticles2D", "set_scale_curve_x", 270443179) + + internal val getScaleCurveYPtr: VoidPtr = + Internals.getMethodBindPtr("CPUParticles2D", "get_scale_curve_y", 2460114913) + + internal val setScaleCurveYPtr: VoidPtr = + Internals.getMethodBindPtr("CPUParticles2D", "set_scale_curve_y", 270443179) + + internal val convertFromParticlesPtr: VoidPtr = + Internals.getMethodBindPtr("CPUParticles2D", "convert_from_particles", 1078189570) + } +} diff --git a/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/CPUParticles3D.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/CPUParticles3D.kt new file mode 100644 index 0000000000..d81d047b23 --- /dev/null +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/CPUParticles3D.kt @@ -0,0 +1,1983 @@ +// THIS FILE IS GENERATED! DO NOT EDIT IT MANUALLY! +@file:Suppress("PackageDirectoryMismatch", "unused", "FunctionName", "RedundantModalityModifier", + "UNCHECKED_CAST", "JoinDeclarationAndAssignment", "USELESS_CAST", + "RemoveRedundantQualifierName", "NOTHING_TO_INLINE", "NON_FINAL_MEMBER_IN_OBJECT", + "RedundantVisibilityModifier", "RedundantUnitReturnType", "MemberVisibilityCanBePrivate") + +package godot + +import godot.`annotation`.CoreTypeHelper +import godot.`annotation`.CoreTypeLocalCopy +import godot.`annotation`.GodotBaseType +import godot.core.AABB +import godot.core.Color +import godot.core.PackedColorArray +import godot.core.PackedVector3Array +import godot.core.Signal0 +import godot.core.VariantParser.BOOL +import godot.core.VariantParser.COLOR +import godot.core.VariantParser.DOUBLE +import godot.core.VariantParser.LONG +import godot.core.VariantParser.NIL +import godot.core.VariantParser.OBJECT +import godot.core.VariantParser.PACKED_COLOR_ARRAY +import godot.core.VariantParser.PACKED_VECTOR3_ARRAY +import godot.core.VariantParser.VECTOR3 +import godot.core.Vector3 +import godot.util.Internals +import godot.util.VoidPtr +import kotlin.Boolean +import kotlin.Double +import kotlin.Float +import kotlin.Int +import kotlin.Long +import kotlin.Suppress +import kotlin.Unit +import kotlin.jvm.JvmName + +private const val ENGINE_CLASS_CPUPARTICLES3D_INDEX: Int = 150 + +/** + * CPU-based 3D particle node used to create a variety of particle systems and effects. + * See also [GPUParticles3D], which provides the same functionality with hardware acceleration, but + * may not run on older devices. + */ +@GodotBaseType +public open class CPUParticles3D : GeometryInstance3D() { + /** + * Emitted when all active particles have finished processing. When [oneShot] is disabled, + * particles will process continuously, so this is never emitted. + */ + public val finished: Signal0 by Signal0 + + /** + * If `true`, particles are being emitted. [emitting] can be used to start and stop particles from + * emitting. However, if [oneShot] is `true` setting [emitting] to `true` will not restart the + * emission cycle until after all active particles finish processing. You can use the [signal + * finished] signal to be notified once all active particles finish processing. + */ + public final inline var emitting: Boolean + @JvmName("emittingProperty") + get() = isEmitting() + @JvmName("emittingProperty") + set(`value`) { + setEmitting(value) + } + + /** + * Number of particles emitted in one emission cycle. + */ + public final inline var amount: Int + @JvmName("amountProperty") + get() = getAmount() + @JvmName("amountProperty") + set(`value`) { + setAmount(value) + } + + /** + * Amount of time each particle will exist. + */ + public final inline var lifetime: Double + @JvmName("lifetimeProperty") + get() = getLifetime() + @JvmName("lifetimeProperty") + set(`value`) { + setLifetime(value) + } + + /** + * If `true`, only one emission cycle occurs. If set `true` during a cycle, emission will stop at + * the cycle's end. + */ + public final inline var oneShot: Boolean + @JvmName("oneShotProperty") + get() = getOneShot() + @JvmName("oneShotProperty") + set(`value`) { + setOneShot(value) + } + + /** + * Particle system starts as if it had already run for this many seconds. + */ + public final inline var preprocess: Double + @JvmName("preprocessProperty") + get() = getPreProcessTime() + @JvmName("preprocessProperty") + set(`value`) { + setPreProcessTime(value) + } + + /** + * Particle system's running speed scaling ratio. A value of `0` can be used to pause the + * particles. + */ + public final inline var speedScale: Double + @JvmName("speedScaleProperty") + get() = getSpeedScale() + @JvmName("speedScaleProperty") + set(`value`) { + setSpeedScale(value) + } + + /** + * How rapidly particles in an emission cycle are emitted. If greater than `0`, there will be a + * gap in emissions before the next cycle begins. + */ + public final inline var explosiveness: Float + @JvmName("explosivenessProperty") + get() = getExplosivenessRatio() + @JvmName("explosivenessProperty") + set(`value`) { + setExplosivenessRatio(value) + } + + /** + * Emission lifetime randomness ratio. + */ + public final inline var randomness: Float + @JvmName("randomnessProperty") + get() = getRandomnessRatio() + @JvmName("randomnessProperty") + set(`value`) { + setRandomnessRatio(value) + } + + /** + * Particle lifetime randomness ratio. + */ + public final inline var lifetimeRandomness: Double + @JvmName("lifetimeRandomnessProperty") + get() = getLifetimeRandomness() + @JvmName("lifetimeRandomnessProperty") + set(`value`) { + setLifetimeRandomness(value) + } + + /** + * The particle system's frame rate is fixed to a value. For example, changing the value to 2 will + * make the particles render at 2 frames per second. Note this does not slow down the particle system + * itself. + */ + public final inline var fixedFps: Int + @JvmName("fixedFpsProperty") + get() = getFixedFps() + @JvmName("fixedFpsProperty") + set(`value`) { + setFixedFps(value) + } + + /** + * If `true`, results in fractional delta calculation which has a smoother particles display + * effect. + */ + public final inline var fractDelta: Boolean + @JvmName("fractDeltaProperty") + get() = getFractionalDelta() + @JvmName("fractDeltaProperty") + set(`value`) { + setFractionalDelta(value) + } + + /** + * The [AABB] that determines the node's region which needs to be visible on screen for the + * particle system to be active. + * Grow the box if particles suddenly appear/disappear when the node enters/exits the screen. The + * [AABB] can be grown via code or with the **Particles → Generate AABB** editor tool. + */ + @CoreTypeLocalCopy + public final inline var visibilityAabb: AABB + @JvmName("visibilityAabbProperty") + get() = getVisibilityAabb() + @JvmName("visibilityAabbProperty") + set(`value`) { + setVisibilityAabb(value) + } + + /** + * If `true`, particles use the parent node's coordinate space (known as local coordinates). This + * will cause particles to move and rotate along the [CPUParticles3D] node (and its parents) when it + * is moved or rotated. If `false`, particles use global coordinates; they will not move or rotate + * along the [CPUParticles3D] node (and its parents) when it is moved or rotated. + */ + public final inline var localCoords: Boolean + @JvmName("localCoordsProperty") + get() = getUseLocalCoordinates() + @JvmName("localCoordsProperty") + set(`value`) { + setUseLocalCoordinates(value) + } + + /** + * Particle draw order. Uses [DrawOrder] values. + */ + public final inline var drawOrder: DrawOrder + @JvmName("drawOrderProperty") + get() = getDrawOrder() + @JvmName("drawOrderProperty") + set(`value`) { + setDrawOrder(value) + } + + /** + * The [Mesh] used for each particle. If `null`, particles will be spheres. + */ + public final inline var mesh: Mesh? + @JvmName("meshProperty") + get() = getMesh() + @JvmName("meshProperty") + set(`value`) { + setMesh(value) + } + + /** + * Particles will be emitted inside this region. See [EmissionShape] for possible values. + */ + public final inline var emissionShape: EmissionShape + @JvmName("emissionShapeProperty") + get() = getEmissionShape() + @JvmName("emissionShapeProperty") + set(`value`) { + setEmissionShape(value) + } + + /** + * The sphere's radius if [EmissionShape] is set to [EMISSION_SHAPE_SPHERE]. + */ + public final inline var emissionSphereRadius: Float + @JvmName("emissionSphereRadiusProperty") + get() = getEmissionSphereRadius() + @JvmName("emissionSphereRadiusProperty") + set(`value`) { + setEmissionSphereRadius(value) + } + + /** + * The rectangle's extents if [emissionShape] is set to [EMISSION_SHAPE_BOX]. + */ + @CoreTypeLocalCopy + public final inline var emissionBoxExtents: Vector3 + @JvmName("emissionBoxExtentsProperty") + get() = getEmissionBoxExtents() + @JvmName("emissionBoxExtentsProperty") + set(`value`) { + setEmissionBoxExtents(value) + } + + /** + * Sets the initial positions to spawn particles when using [EMISSION_SHAPE_POINTS] or + * [EMISSION_SHAPE_DIRECTED_POINTS]. + */ + public final inline var emissionPoints: PackedVector3Array + @JvmName("emissionPointsProperty") + get() = getEmissionPoints() + @JvmName("emissionPointsProperty") + set(`value`) { + setEmissionPoints(value) + } + + /** + * Sets the direction the particles will be emitted in when using + * [EMISSION_SHAPE_DIRECTED_POINTS]. + */ + public final inline var emissionNormals: PackedVector3Array + @JvmName("emissionNormalsProperty") + get() = getEmissionNormals() + @JvmName("emissionNormalsProperty") + set(`value`) { + setEmissionNormals(value) + } + + /** + * Sets the [Color]s to modulate particles by when using [EMISSION_SHAPE_POINTS] or + * [EMISSION_SHAPE_DIRECTED_POINTS]. + * **Note:** [emissionColors] multiplies the particle mesh's vertex colors. To have a visible + * effect on a [BaseMaterial3D], [BaseMaterial3D.vertexColorUseAsAlbedo] *must* be `true`. For a + * [ShaderMaterial], `ALBEDO *= COLOR.rgb;` must be inserted in the shader's `fragment()` function. + * Otherwise, [emissionColors] will have no visible effect. + */ + public final inline var emissionColors: PackedColorArray + @JvmName("emissionColorsProperty") + get() = getEmissionColors() + @JvmName("emissionColorsProperty") + set(`value`) { + setEmissionColors(value) + } + + /** + * The axis of the ring when using the emitter [EMISSION_SHAPE_RING]. + */ + @CoreTypeLocalCopy + public final inline var emissionRingAxis: Vector3 + @JvmName("emissionRingAxisProperty") + get() = getEmissionRingAxis() + @JvmName("emissionRingAxisProperty") + set(`value`) { + setEmissionRingAxis(value) + } + + /** + * The height of the ring when using the emitter [EMISSION_SHAPE_RING]. + */ + public final inline var emissionRingHeight: Float + @JvmName("emissionRingHeightProperty") + get() = getEmissionRingHeight() + @JvmName("emissionRingHeightProperty") + set(`value`) { + setEmissionRingHeight(value) + } + + /** + * The radius of the ring when using the emitter [EMISSION_SHAPE_RING]. + */ + public final inline var emissionRingRadius: Float + @JvmName("emissionRingRadiusProperty") + get() = getEmissionRingRadius() + @JvmName("emissionRingRadiusProperty") + set(`value`) { + setEmissionRingRadius(value) + } + + /** + * The inner radius of the ring when using the emitter [EMISSION_SHAPE_RING]. + */ + public final inline var emissionRingInnerRadius: Float + @JvmName("emissionRingInnerRadiusProperty") + get() = getEmissionRingInnerRadius() + @JvmName("emissionRingInnerRadiusProperty") + set(`value`) { + setEmissionRingInnerRadius(value) + } + + /** + * Align Y axis of particle with the direction of its velocity. + */ + public final inline var particleFlagAlignY: Boolean + @JvmName("particleFlagAlignYProperty") + get() = getParticleFlag(CPUParticles3D.ParticleFlags.PARTICLE_FLAG_ALIGN_Y_TO_VELOCITY) + @JvmName("particleFlagAlignYProperty") + set(`value`) { + setParticleFlag(CPUParticles3D.ParticleFlags.PARTICLE_FLAG_ALIGN_Y_TO_VELOCITY, value) + } + + /** + * If `true`, particles rotate around Y axis by [angleMin]. + */ + public final inline var particleFlagRotateY: Boolean + @JvmName("particleFlagRotateYProperty") + get() = getParticleFlag(CPUParticles3D.ParticleFlags.PARTICLE_FLAG_ROTATE_Y) + @JvmName("particleFlagRotateYProperty") + set(`value`) { + setParticleFlag(CPUParticles3D.ParticleFlags.PARTICLE_FLAG_ROTATE_Y, value) + } + + /** + * If `true`, particles will not move on the Z axis. + */ + public final inline var particleFlagDisableZ: Boolean + @JvmName("particleFlagDisableZProperty") + get() = getParticleFlag(CPUParticles3D.ParticleFlags.PARTICLE_FLAG_DISABLE_Z) + @JvmName("particleFlagDisableZProperty") + set(`value`) { + setParticleFlag(CPUParticles3D.ParticleFlags.PARTICLE_FLAG_DISABLE_Z, value) + } + + /** + * Unit vector specifying the particles' emission direction. + */ + @CoreTypeLocalCopy + public final inline var direction: Vector3 + @JvmName("directionProperty") + get() = getDirection() + @JvmName("directionProperty") + set(`value`) { + setDirection(value) + } + + /** + * Each particle's initial direction range from `+spread` to `-spread` degrees. Applied to X/Z + * plane and Y/Z planes. + */ + public final inline var spread: Float + @JvmName("spreadProperty") + get() = getSpread() + @JvmName("spreadProperty") + set(`value`) { + setSpread(value) + } + + /** + * Amount of [spread] in Y/Z plane. A value of `1` restricts particles to X/Z plane. + */ + public final inline var flatness: Float + @JvmName("flatnessProperty") + get() = getFlatness() + @JvmName("flatnessProperty") + set(`value`) { + setFlatness(value) + } + + /** + * Gravity applied to every particle. + */ + @CoreTypeLocalCopy + public final inline var gravity: Vector3 + @JvmName("gravityProperty") + get() = getGravity() + @JvmName("gravityProperty") + set(`value`) { + setGravity(value) + } + + /** + * Minimum value of the initial velocity. + */ + public final inline var initialVelocityMin: Float + @JvmName("initialVelocityMinProperty") + get() = getParamMin(CPUParticles3D.Parameter.PARAM_INITIAL_LINEAR_VELOCITY) + @JvmName("initialVelocityMinProperty") + set(`value`) { + setParamMin(CPUParticles3D.Parameter.PARAM_INITIAL_LINEAR_VELOCITY, value) + } + + /** + * Maximum value of the initial velocity. + */ + public final inline var initialVelocityMax: Float + @JvmName("initialVelocityMaxProperty") + get() = getParamMax(CPUParticles3D.Parameter.PARAM_INITIAL_LINEAR_VELOCITY) + @JvmName("initialVelocityMaxProperty") + set(`value`) { + setParamMax(CPUParticles3D.Parameter.PARAM_INITIAL_LINEAR_VELOCITY, value) + } + + /** + * Minimum initial angular velocity (rotation speed) applied to each particle in *degrees* per + * second. + */ + public final inline var angularVelocityMin: Float + @JvmName("angularVelocityMinProperty") + get() = getParamMin(CPUParticles3D.Parameter.PARAM_ANGULAR_VELOCITY) + @JvmName("angularVelocityMinProperty") + set(`value`) { + setParamMin(CPUParticles3D.Parameter.PARAM_ANGULAR_VELOCITY, value) + } + + /** + * Maximum initial angular velocity (rotation speed) applied to each particle in *degrees* per + * second. + */ + public final inline var angularVelocityMax: Float + @JvmName("angularVelocityMaxProperty") + get() = getParamMax(CPUParticles3D.Parameter.PARAM_ANGULAR_VELOCITY) + @JvmName("angularVelocityMaxProperty") + set(`value`) { + setParamMax(CPUParticles3D.Parameter.PARAM_ANGULAR_VELOCITY, value) + } + + /** + * Each particle's angular velocity (rotation speed) will vary along this [Curve] over its + * lifetime. + */ + public final inline var angularVelocityCurve: Curve? + @JvmName("angularVelocityCurveProperty") + get() = getParamCurve(CPUParticles3D.Parameter.PARAM_ANGULAR_VELOCITY) + @JvmName("angularVelocityCurveProperty") + set(`value`) { + setParamCurve(CPUParticles3D.Parameter.PARAM_ANGULAR_VELOCITY, value) + } + + /** + * Minimum orbit velocity. + */ + public final inline var orbitVelocityMin: Float + @JvmName("orbitVelocityMinProperty") + get() = getParamMin(CPUParticles3D.Parameter.PARAM_ORBIT_VELOCITY) + @JvmName("orbitVelocityMinProperty") + set(`value`) { + setParamMin(CPUParticles3D.Parameter.PARAM_ORBIT_VELOCITY, value) + } + + /** + * Maximum orbit velocity. + */ + public final inline var orbitVelocityMax: Float + @JvmName("orbitVelocityMaxProperty") + get() = getParamMax(CPUParticles3D.Parameter.PARAM_ORBIT_VELOCITY) + @JvmName("orbitVelocityMaxProperty") + set(`value`) { + setParamMax(CPUParticles3D.Parameter.PARAM_ORBIT_VELOCITY, value) + } + + /** + * Each particle's orbital velocity will vary along this [Curve]. + */ + public final inline var orbitVelocityCurve: Curve? + @JvmName("orbitVelocityCurveProperty") + get() = getParamCurve(CPUParticles3D.Parameter.PARAM_ORBIT_VELOCITY) + @JvmName("orbitVelocityCurveProperty") + set(`value`) { + setParamCurve(CPUParticles3D.Parameter.PARAM_ORBIT_VELOCITY, value) + } + + /** + * Minimum linear acceleration. + */ + public final inline var linearAccelMin: Float + @JvmName("linearAccelMinProperty") + get() = getParamMin(CPUParticles3D.Parameter.PARAM_LINEAR_ACCEL) + @JvmName("linearAccelMinProperty") + set(`value`) { + setParamMin(CPUParticles3D.Parameter.PARAM_LINEAR_ACCEL, value) + } + + /** + * Maximum linear acceleration. + */ + public final inline var linearAccelMax: Float + @JvmName("linearAccelMaxProperty") + get() = getParamMax(CPUParticles3D.Parameter.PARAM_LINEAR_ACCEL) + @JvmName("linearAccelMaxProperty") + set(`value`) { + setParamMax(CPUParticles3D.Parameter.PARAM_LINEAR_ACCEL, value) + } + + /** + * Each particle's linear acceleration will vary along this [Curve]. + */ + public final inline var linearAccelCurve: Curve? + @JvmName("linearAccelCurveProperty") + get() = getParamCurve(CPUParticles3D.Parameter.PARAM_LINEAR_ACCEL) + @JvmName("linearAccelCurveProperty") + set(`value`) { + setParamCurve(CPUParticles3D.Parameter.PARAM_LINEAR_ACCEL, value) + } + + /** + * Minimum radial acceleration. + */ + public final inline var radialAccelMin: Float + @JvmName("radialAccelMinProperty") + get() = getParamMin(CPUParticles3D.Parameter.PARAM_RADIAL_ACCEL) + @JvmName("radialAccelMinProperty") + set(`value`) { + setParamMin(CPUParticles3D.Parameter.PARAM_RADIAL_ACCEL, value) + } + + /** + * Maximum radial acceleration. + */ + public final inline var radialAccelMax: Float + @JvmName("radialAccelMaxProperty") + get() = getParamMax(CPUParticles3D.Parameter.PARAM_RADIAL_ACCEL) + @JvmName("radialAccelMaxProperty") + set(`value`) { + setParamMax(CPUParticles3D.Parameter.PARAM_RADIAL_ACCEL, value) + } + + /** + * Each particle's radial acceleration will vary along this [Curve]. + */ + public final inline var radialAccelCurve: Curve? + @JvmName("radialAccelCurveProperty") + get() = getParamCurve(CPUParticles3D.Parameter.PARAM_RADIAL_ACCEL) + @JvmName("radialAccelCurveProperty") + set(`value`) { + setParamCurve(CPUParticles3D.Parameter.PARAM_RADIAL_ACCEL, value) + } + + /** + * Minimum tangent acceleration. + */ + public final inline var tangentialAccelMin: Float + @JvmName("tangentialAccelMinProperty") + get() = getParamMin(CPUParticles3D.Parameter.PARAM_TANGENTIAL_ACCEL) + @JvmName("tangentialAccelMinProperty") + set(`value`) { + setParamMin(CPUParticles3D.Parameter.PARAM_TANGENTIAL_ACCEL, value) + } + + /** + * Maximum tangent acceleration. + */ + public final inline var tangentialAccelMax: Float + @JvmName("tangentialAccelMaxProperty") + get() = getParamMax(CPUParticles3D.Parameter.PARAM_TANGENTIAL_ACCEL) + @JvmName("tangentialAccelMaxProperty") + set(`value`) { + setParamMax(CPUParticles3D.Parameter.PARAM_TANGENTIAL_ACCEL, value) + } + + /** + * Each particle's tangential acceleration will vary along this [Curve]. + */ + public final inline var tangentialAccelCurve: Curve? + @JvmName("tangentialAccelCurveProperty") + get() = getParamCurve(CPUParticles3D.Parameter.PARAM_TANGENTIAL_ACCEL) + @JvmName("tangentialAccelCurveProperty") + set(`value`) { + setParamCurve(CPUParticles3D.Parameter.PARAM_TANGENTIAL_ACCEL, value) + } + + /** + * Minimum damping. + */ + public final inline var dampingMin: Float + @JvmName("dampingMinProperty") + get() = getParamMin(CPUParticles3D.Parameter.PARAM_DAMPING) + @JvmName("dampingMinProperty") + set(`value`) { + setParamMin(CPUParticles3D.Parameter.PARAM_DAMPING, value) + } + + /** + * Maximum damping. + */ + public final inline var dampingMax: Float + @JvmName("dampingMaxProperty") + get() = getParamMax(CPUParticles3D.Parameter.PARAM_DAMPING) + @JvmName("dampingMaxProperty") + set(`value`) { + setParamMax(CPUParticles3D.Parameter.PARAM_DAMPING, value) + } + + /** + * Damping will vary along this [Curve]. + */ + public final inline var dampingCurve: Curve? + @JvmName("dampingCurveProperty") + get() = getParamCurve(CPUParticles3D.Parameter.PARAM_DAMPING) + @JvmName("dampingCurveProperty") + set(`value`) { + setParamCurve(CPUParticles3D.Parameter.PARAM_DAMPING, value) + } + + /** + * Minimum angle. + */ + public final inline var angleMin: Float + @JvmName("angleMinProperty") + get() = getParamMin(CPUParticles3D.Parameter.PARAM_ANGLE) + @JvmName("angleMinProperty") + set(`value`) { + setParamMin(CPUParticles3D.Parameter.PARAM_ANGLE, value) + } + + /** + * Maximum angle. + */ + public final inline var angleMax: Float + @JvmName("angleMaxProperty") + get() = getParamMax(CPUParticles3D.Parameter.PARAM_ANGLE) + @JvmName("angleMaxProperty") + set(`value`) { + setParamMax(CPUParticles3D.Parameter.PARAM_ANGLE, value) + } + + /** + * Each particle's rotation will be animated along this [Curve]. + */ + public final inline var angleCurve: Curve? + @JvmName("angleCurveProperty") + get() = getParamCurve(CPUParticles3D.Parameter.PARAM_ANGLE) + @JvmName("angleCurveProperty") + set(`value`) { + setParamCurve(CPUParticles3D.Parameter.PARAM_ANGLE, value) + } + + /** + * Minimum scale. + */ + public final inline var scaleAmountMin: Float + @JvmName("scaleAmountMinProperty") + get() = getParamMin(CPUParticles3D.Parameter.PARAM_SCALE) + @JvmName("scaleAmountMinProperty") + set(`value`) { + setParamMin(CPUParticles3D.Parameter.PARAM_SCALE, value) + } + + /** + * Maximum scale. + */ + public final inline var scaleAmountMax: Float + @JvmName("scaleAmountMaxProperty") + get() = getParamMax(CPUParticles3D.Parameter.PARAM_SCALE) + @JvmName("scaleAmountMaxProperty") + set(`value`) { + setParamMax(CPUParticles3D.Parameter.PARAM_SCALE, value) + } + + /** + * Each particle's scale will vary along this [Curve]. + */ + public final inline var scaleAmountCurve: Curve? + @JvmName("scaleAmountCurveProperty") + get() = getParamCurve(CPUParticles3D.Parameter.PARAM_SCALE) + @JvmName("scaleAmountCurveProperty") + set(`value`) { + setParamCurve(CPUParticles3D.Parameter.PARAM_SCALE, value) + } + + /** + * If set to `true`, three different scale curves can be specified, one per scale axis. + */ + public final inline var splitScale: Boolean + @JvmName("splitScaleProperty") + get() = getSplitScale() + @JvmName("splitScaleProperty") + set(`value`) { + setSplitScale(value) + } + + /** + * Curve for the scale over life, along the x axis. + */ + public final inline var scaleCurveX: Curve? + @JvmName("scaleCurveXProperty") + get() = getScaleCurveX() + @JvmName("scaleCurveXProperty") + set(`value`) { + setScaleCurveX(value) + } + + /** + * Curve for the scale over life, along the y axis. + */ + public final inline var scaleCurveY: Curve? + @JvmName("scaleCurveYProperty") + get() = getScaleCurveY() + @JvmName("scaleCurveYProperty") + set(`value`) { + setScaleCurveY(value) + } + + /** + * Curve for the scale over life, along the z axis. + */ + public final inline var scaleCurveZ: Curve? + @JvmName("scaleCurveZProperty") + get() = getScaleCurveZ() + @JvmName("scaleCurveZProperty") + set(`value`) { + setScaleCurveZ(value) + } + + /** + * Each particle's initial color. + * **Note:** [color] multiplies the particle mesh's vertex colors. To have a visible effect on a + * [BaseMaterial3D], [BaseMaterial3D.vertexColorUseAsAlbedo] *must* be `true`. For a + * [ShaderMaterial], `ALBEDO *= COLOR.rgb;` must be inserted in the shader's `fragment()` function. + * Otherwise, [color] will have no visible effect. + */ + @CoreTypeLocalCopy + public final inline var color: Color + @JvmName("colorProperty") + get() = getColor() + @JvmName("colorProperty") + set(`value`) { + setColor(value) + } + + /** + * Each particle's color will vary along this [GradientTexture1D] over its lifetime (multiplied + * with [color]). + * **Note:** [colorRamp] multiplies the particle mesh's vertex colors. To have a visible effect on + * a [BaseMaterial3D], [BaseMaterial3D.vertexColorUseAsAlbedo] *must* be `true`. For a + * [ShaderMaterial], `ALBEDO *= COLOR.rgb;` must be inserted in the shader's `fragment()` function. + * Otherwise, [colorRamp] will have no visible effect. + */ + public final inline var colorRamp: Gradient? + @JvmName("colorRampProperty") + get() = getColorRamp() + @JvmName("colorRampProperty") + set(`value`) { + setColorRamp(value) + } + + /** + * Each particle's initial color will vary along this [GradientTexture1D] (multiplied with + * [color]). + * **Note:** [colorInitialRamp] multiplies the particle mesh's vertex colors. To have a visible + * effect on a [BaseMaterial3D], [BaseMaterial3D.vertexColorUseAsAlbedo] *must* be `true`. For a + * [ShaderMaterial], `ALBEDO *= COLOR.rgb;` must be inserted in the shader's `fragment()` function. + * Otherwise, [colorInitialRamp] will have no visible effect. + */ + public final inline var colorInitialRamp: Gradient? + @JvmName("colorInitialRampProperty") + get() = getColorInitialRamp() + @JvmName("colorInitialRampProperty") + set(`value`) { + setColorInitialRamp(value) + } + + /** + * Minimum hue variation. + */ + public final inline var hueVariationMin: Float + @JvmName("hueVariationMinProperty") + get() = getParamMin(CPUParticles3D.Parameter.PARAM_HUE_VARIATION) + @JvmName("hueVariationMinProperty") + set(`value`) { + setParamMin(CPUParticles3D.Parameter.PARAM_HUE_VARIATION, value) + } + + /** + * Maximum hue variation. + */ + public final inline var hueVariationMax: Float + @JvmName("hueVariationMaxProperty") + get() = getParamMax(CPUParticles3D.Parameter.PARAM_HUE_VARIATION) + @JvmName("hueVariationMaxProperty") + set(`value`) { + setParamMax(CPUParticles3D.Parameter.PARAM_HUE_VARIATION, value) + } + + /** + * Each particle's hue will vary along this [Curve]. + */ + public final inline var hueVariationCurve: Curve? + @JvmName("hueVariationCurveProperty") + get() = getParamCurve(CPUParticles3D.Parameter.PARAM_HUE_VARIATION) + @JvmName("hueVariationCurveProperty") + set(`value`) { + setParamCurve(CPUParticles3D.Parameter.PARAM_HUE_VARIATION, value) + } + + /** + * Minimum particle animation speed. + */ + public final inline var animSpeedMin: Float + @JvmName("animSpeedMinProperty") + get() = getParamMin(CPUParticles3D.Parameter.PARAM_ANIM_SPEED) + @JvmName("animSpeedMinProperty") + set(`value`) { + setParamMin(CPUParticles3D.Parameter.PARAM_ANIM_SPEED, value) + } + + /** + * Maximum particle animation speed. + */ + public final inline var animSpeedMax: Float + @JvmName("animSpeedMaxProperty") + get() = getParamMax(CPUParticles3D.Parameter.PARAM_ANIM_SPEED) + @JvmName("animSpeedMaxProperty") + set(`value`) { + setParamMax(CPUParticles3D.Parameter.PARAM_ANIM_SPEED, value) + } + + /** + * Each particle's animation speed will vary along this [Curve]. + */ + public final inline var animSpeedCurve: Curve? + @JvmName("animSpeedCurveProperty") + get() = getParamCurve(CPUParticles3D.Parameter.PARAM_ANIM_SPEED) + @JvmName("animSpeedCurveProperty") + set(`value`) { + setParamCurve(CPUParticles3D.Parameter.PARAM_ANIM_SPEED, value) + } + + /** + * Minimum animation offset. + */ + public final inline var animOffsetMin: Float + @JvmName("animOffsetMinProperty") + get() = getParamMin(CPUParticles3D.Parameter.PARAM_ANIM_OFFSET) + @JvmName("animOffsetMinProperty") + set(`value`) { + setParamMin(CPUParticles3D.Parameter.PARAM_ANIM_OFFSET, value) + } + + /** + * Maximum animation offset. + */ + public final inline var animOffsetMax: Float + @JvmName("animOffsetMaxProperty") + get() = getParamMax(CPUParticles3D.Parameter.PARAM_ANIM_OFFSET) + @JvmName("animOffsetMaxProperty") + set(`value`) { + setParamMax(CPUParticles3D.Parameter.PARAM_ANIM_OFFSET, value) + } + + /** + * Each particle's animation offset will vary along this [Curve]. + */ + public final inline var animOffsetCurve: Curve? + @JvmName("animOffsetCurveProperty") + get() = getParamCurve(CPUParticles3D.Parameter.PARAM_ANIM_OFFSET) + @JvmName("animOffsetCurveProperty") + set(`value`) { + setParamCurve(CPUParticles3D.Parameter.PARAM_ANIM_OFFSET, value) + } + + public override fun new(scriptIndex: Int): Unit { + Internals.callConstructor(this, ENGINE_CLASS_CPUPARTICLES3D_INDEX, scriptIndex) + } + + /** + * The [AABB] that determines the node's region which needs to be visible on screen for the + * particle system to be active. + * Grow the box if particles suddenly appear/disappear when the node enters/exits the screen. The + * [AABB] can be grown via code or with the **Particles → Generate AABB** editor tool. + * + * This is a helper function to make dealing with local copies easier. + * + * For more information, see our + * [documentation](https://godot-kotl.in/en/stable/user-guide/api-differences/#core-types). + * + * Allow to directly modify the local copy of the property and assign it back to the Object. + * + * Prefer that over writing: + * `````` + * val myCoreType = cpuparticles3d.visibilityAabb + * //Your changes + * cpuparticles3d.visibilityAabb = myCoreType + * `````` + */ + @CoreTypeHelper + public final fun visibilityAabbMutate(block: AABB.() -> Unit): AABB = visibilityAabb.apply{ + block(this) + visibilityAabb = this + } + + + /** + * The rectangle's extents if [emissionShape] is set to [EMISSION_SHAPE_BOX]. + * + * This is a helper function to make dealing with local copies easier. + * + * For more information, see our + * [documentation](https://godot-kotl.in/en/stable/user-guide/api-differences/#core-types). + * + * Allow to directly modify the local copy of the property and assign it back to the Object. + * + * Prefer that over writing: + * `````` + * val myCoreType = cpuparticles3d.emissionBoxExtents + * //Your changes + * cpuparticles3d.emissionBoxExtents = myCoreType + * `````` + */ + @CoreTypeHelper + public final fun emissionBoxExtentsMutate(block: Vector3.() -> Unit): Vector3 = + emissionBoxExtents.apply{ + block(this) + emissionBoxExtents = this + } + + + /** + * The axis of the ring when using the emitter [EMISSION_SHAPE_RING]. + * + * This is a helper function to make dealing with local copies easier. + * + * For more information, see our + * [documentation](https://godot-kotl.in/en/stable/user-guide/api-differences/#core-types). + * + * Allow to directly modify the local copy of the property and assign it back to the Object. + * + * Prefer that over writing: + * `````` + * val myCoreType = cpuparticles3d.emissionRingAxis + * //Your changes + * cpuparticles3d.emissionRingAxis = myCoreType + * `````` + */ + @CoreTypeHelper + public final fun emissionRingAxisMutate(block: Vector3.() -> Unit): Vector3 = + emissionRingAxis.apply{ + block(this) + emissionRingAxis = this + } + + + /** + * Unit vector specifying the particles' emission direction. + * + * This is a helper function to make dealing with local copies easier. + * + * For more information, see our + * [documentation](https://godot-kotl.in/en/stable/user-guide/api-differences/#core-types). + * + * Allow to directly modify the local copy of the property and assign it back to the Object. + * + * Prefer that over writing: + * `````` + * val myCoreType = cpuparticles3d.direction + * //Your changes + * cpuparticles3d.direction = myCoreType + * `````` + */ + @CoreTypeHelper + public final fun directionMutate(block: Vector3.() -> Unit): Vector3 = direction.apply{ + block(this) + direction = this + } + + + /** + * Gravity applied to every particle. + * + * This is a helper function to make dealing with local copies easier. + * + * For more information, see our + * [documentation](https://godot-kotl.in/en/stable/user-guide/api-differences/#core-types). + * + * Allow to directly modify the local copy of the property and assign it back to the Object. + * + * Prefer that over writing: + * `````` + * val myCoreType = cpuparticles3d.gravity + * //Your changes + * cpuparticles3d.gravity = myCoreType + * `````` + */ + @CoreTypeHelper + public final fun gravityMutate(block: Vector3.() -> Unit): Vector3 = gravity.apply{ + block(this) + gravity = this + } + + + /** + * Each particle's initial color. + * **Note:** [color] multiplies the particle mesh's vertex colors. To have a visible effect on a + * [BaseMaterial3D], [BaseMaterial3D.vertexColorUseAsAlbedo] *must* be `true`. For a + * [ShaderMaterial], `ALBEDO *= COLOR.rgb;` must be inserted in the shader's `fragment()` function. + * Otherwise, [color] will have no visible effect. + * + * This is a helper function to make dealing with local copies easier. + * + * For more information, see our + * [documentation](https://godot-kotl.in/en/stable/user-guide/api-differences/#core-types). + * + * Allow to directly modify the local copy of the property and assign it back to the Object. + * + * Prefer that over writing: + * `````` + * val myCoreType = cpuparticles3d.color + * //Your changes + * cpuparticles3d.color = myCoreType + * `````` + */ + @CoreTypeHelper + public final fun colorMutate(block: Color.() -> Unit): Color = color.apply{ + block(this) + color = this + } + + + public final fun setEmitting(emitting: Boolean): Unit { + Internals.writeArguments(BOOL to emitting) + Internals.callMethod(rawPtr, MethodBindings.setEmittingPtr, NIL) + } + + public final fun setAmount(amount: Int): Unit { + Internals.writeArguments(LONG to amount.toLong()) + Internals.callMethod(rawPtr, MethodBindings.setAmountPtr, NIL) + } + + public final fun setLifetime(secs: Double): Unit { + Internals.writeArguments(DOUBLE to secs) + Internals.callMethod(rawPtr, MethodBindings.setLifetimePtr, NIL) + } + + public final fun setOneShot(enable: Boolean): Unit { + Internals.writeArguments(BOOL to enable) + Internals.callMethod(rawPtr, MethodBindings.setOneShotPtr, NIL) + } + + public final fun setPreProcessTime(secs: Double): Unit { + Internals.writeArguments(DOUBLE to secs) + Internals.callMethod(rawPtr, MethodBindings.setPreProcessTimePtr, NIL) + } + + public final fun setExplosivenessRatio(ratio: Float): Unit { + Internals.writeArguments(DOUBLE to ratio.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setExplosivenessRatioPtr, NIL) + } + + public final fun setRandomnessRatio(ratio: Float): Unit { + Internals.writeArguments(DOUBLE to ratio.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setRandomnessRatioPtr, NIL) + } + + public final fun setVisibilityAabb(aabb: AABB): Unit { + Internals.writeArguments(godot.core.VariantParser.AABB to aabb) + Internals.callMethod(rawPtr, MethodBindings.setVisibilityAabbPtr, NIL) + } + + public final fun setLifetimeRandomness(random: Double): Unit { + Internals.writeArguments(DOUBLE to random) + Internals.callMethod(rawPtr, MethodBindings.setLifetimeRandomnessPtr, NIL) + } + + public final fun setUseLocalCoordinates(enable: Boolean): Unit { + Internals.writeArguments(BOOL to enable) + Internals.callMethod(rawPtr, MethodBindings.setUseLocalCoordinatesPtr, NIL) + } + + public final fun setFixedFps(fps: Int): Unit { + Internals.writeArguments(LONG to fps.toLong()) + Internals.callMethod(rawPtr, MethodBindings.setFixedFpsPtr, NIL) + } + + public final fun setFractionalDelta(enable: Boolean): Unit { + Internals.writeArguments(BOOL to enable) + Internals.callMethod(rawPtr, MethodBindings.setFractionalDeltaPtr, NIL) + } + + public final fun setSpeedScale(scale: Double): Unit { + Internals.writeArguments(DOUBLE to scale) + Internals.callMethod(rawPtr, MethodBindings.setSpeedScalePtr, NIL) + } + + public final fun isEmitting(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isEmittingPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public final fun getAmount(): Int { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getAmountPtr, LONG) + return (Internals.readReturnValue(LONG) as Long).toInt() + } + + public final fun getLifetime(): Double { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getLifetimePtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double) + } + + public final fun getOneShot(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getOneShotPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public final fun getPreProcessTime(): Double { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getPreProcessTimePtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double) + } + + public final fun getExplosivenessRatio(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getExplosivenessRatioPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun getRandomnessRatio(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getRandomnessRatioPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun getVisibilityAabb(): AABB { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getVisibilityAabbPtr, godot.core.VariantParser.AABB) + return (Internals.readReturnValue(godot.core.VariantParser.AABB) as AABB) + } + + public final fun getLifetimeRandomness(): Double { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getLifetimeRandomnessPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double) + } + + public final fun getUseLocalCoordinates(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getUseLocalCoordinatesPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public final fun getFixedFps(): Int { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getFixedFpsPtr, LONG) + return (Internals.readReturnValue(LONG) as Long).toInt() + } + + public final fun getFractionalDelta(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getFractionalDeltaPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public final fun getSpeedScale(): Double { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getSpeedScalePtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double) + } + + public final fun setDrawOrder(order: DrawOrder): Unit { + Internals.writeArguments(LONG to order.id) + Internals.callMethod(rawPtr, MethodBindings.setDrawOrderPtr, NIL) + } + + public final fun getDrawOrder(): DrawOrder { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getDrawOrderPtr, LONG) + return CPUParticles3D.DrawOrder.from(Internals.readReturnValue(LONG) as Long) + } + + public final fun setMesh(mesh: Mesh?): Unit { + Internals.writeArguments(OBJECT to mesh) + Internals.callMethod(rawPtr, MethodBindings.setMeshPtr, NIL) + } + + public final fun getMesh(): Mesh? { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getMeshPtr, OBJECT) + return (Internals.readReturnValue(OBJECT) as Mesh?) + } + + /** + * Restarts the particle emitter. + */ + public final fun restart(): Unit { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.restartPtr, NIL) + } + + public final fun setDirection(direction: Vector3): Unit { + Internals.writeArguments(VECTOR3 to direction) + Internals.callMethod(rawPtr, MethodBindings.setDirectionPtr, NIL) + } + + public final fun getDirection(): Vector3 { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getDirectionPtr, VECTOR3) + return (Internals.readReturnValue(VECTOR3) as Vector3) + } + + public final fun setSpread(degrees: Float): Unit { + Internals.writeArguments(DOUBLE to degrees.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setSpreadPtr, NIL) + } + + public final fun getSpread(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getSpreadPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setFlatness(amount: Float): Unit { + Internals.writeArguments(DOUBLE to amount.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setFlatnessPtr, NIL) + } + + public final fun getFlatness(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getFlatnessPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + /** + * Sets the minimum value for the given parameter. + */ + public final fun setParamMin(`param`: Parameter, `value`: Float): Unit { + Internals.writeArguments(LONG to param.id, DOUBLE to value.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setParamMinPtr, NIL) + } + + /** + * Returns the minimum value range for the given parameter. + */ + public final fun getParamMin(`param`: Parameter): Float { + Internals.writeArguments(LONG to param.id) + Internals.callMethod(rawPtr, MethodBindings.getParamMinPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + /** + * Sets the maximum value for the given parameter. + */ + public final fun setParamMax(`param`: Parameter, `value`: Float): Unit { + Internals.writeArguments(LONG to param.id, DOUBLE to value.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setParamMaxPtr, NIL) + } + + /** + * Returns the maximum value range for the given parameter. + */ + public final fun getParamMax(`param`: Parameter): Float { + Internals.writeArguments(LONG to param.id) + Internals.callMethod(rawPtr, MethodBindings.getParamMaxPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + /** + * Sets the [Curve] of the parameter specified by [Parameter]. + */ + public final fun setParamCurve(`param`: Parameter, curve: Curve?): Unit { + Internals.writeArguments(LONG to param.id, OBJECT to curve) + Internals.callMethod(rawPtr, MethodBindings.setParamCurvePtr, NIL) + } + + /** + * Returns the [Curve] of the parameter specified by [Parameter]. + */ + public final fun getParamCurve(`param`: Parameter): Curve? { + Internals.writeArguments(LONG to param.id) + Internals.callMethod(rawPtr, MethodBindings.getParamCurvePtr, OBJECT) + return (Internals.readReturnValue(OBJECT) as Curve?) + } + + public final fun setColor(color: Color): Unit { + Internals.writeArguments(COLOR to color) + Internals.callMethod(rawPtr, MethodBindings.setColorPtr, NIL) + } + + public final fun getColor(): Color { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getColorPtr, COLOR) + return (Internals.readReturnValue(COLOR) as Color) + } + + public final fun setColorRamp(ramp: Gradient?): Unit { + Internals.writeArguments(OBJECT to ramp) + Internals.callMethod(rawPtr, MethodBindings.setColorRampPtr, NIL) + } + + public final fun getColorRamp(): Gradient? { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getColorRampPtr, OBJECT) + return (Internals.readReturnValue(OBJECT) as Gradient?) + } + + public final fun setColorInitialRamp(ramp: Gradient?): Unit { + Internals.writeArguments(OBJECT to ramp) + Internals.callMethod(rawPtr, MethodBindings.setColorInitialRampPtr, NIL) + } + + public final fun getColorInitialRamp(): Gradient? { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getColorInitialRampPtr, OBJECT) + return (Internals.readReturnValue(OBJECT) as Gradient?) + } + + /** + * Enables or disables the given particle flag (see [ParticleFlags] for options). + */ + public final fun setParticleFlag(particleFlag: ParticleFlags, enable: Boolean): Unit { + Internals.writeArguments(LONG to particleFlag.id, BOOL to enable) + Internals.callMethod(rawPtr, MethodBindings.setParticleFlagPtr, NIL) + } + + /** + * Returns the enabled state of the given particle flag (see [ParticleFlags] for options). + */ + public final fun getParticleFlag(particleFlag: ParticleFlags): Boolean { + Internals.writeArguments(LONG to particleFlag.id) + Internals.callMethod(rawPtr, MethodBindings.getParticleFlagPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public final fun setEmissionShape(shape: EmissionShape): Unit { + Internals.writeArguments(LONG to shape.id) + Internals.callMethod(rawPtr, MethodBindings.setEmissionShapePtr, NIL) + } + + public final fun getEmissionShape(): EmissionShape { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getEmissionShapePtr, LONG) + return CPUParticles3D.EmissionShape.from(Internals.readReturnValue(LONG) as Long) + } + + public final fun setEmissionSphereRadius(radius: Float): Unit { + Internals.writeArguments(DOUBLE to radius.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setEmissionSphereRadiusPtr, NIL) + } + + public final fun getEmissionSphereRadius(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getEmissionSphereRadiusPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setEmissionBoxExtents(extents: Vector3): Unit { + Internals.writeArguments(VECTOR3 to extents) + Internals.callMethod(rawPtr, MethodBindings.setEmissionBoxExtentsPtr, NIL) + } + + public final fun getEmissionBoxExtents(): Vector3 { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getEmissionBoxExtentsPtr, VECTOR3) + return (Internals.readReturnValue(VECTOR3) as Vector3) + } + + public final fun setEmissionPoints(array: PackedVector3Array): Unit { + Internals.writeArguments(PACKED_VECTOR3_ARRAY to array) + Internals.callMethod(rawPtr, MethodBindings.setEmissionPointsPtr, NIL) + } + + public final fun getEmissionPoints(): PackedVector3Array { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getEmissionPointsPtr, PACKED_VECTOR3_ARRAY) + return (Internals.readReturnValue(PACKED_VECTOR3_ARRAY) as PackedVector3Array) + } + + public final fun setEmissionNormals(array: PackedVector3Array): Unit { + Internals.writeArguments(PACKED_VECTOR3_ARRAY to array) + Internals.callMethod(rawPtr, MethodBindings.setEmissionNormalsPtr, NIL) + } + + public final fun getEmissionNormals(): PackedVector3Array { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getEmissionNormalsPtr, PACKED_VECTOR3_ARRAY) + return (Internals.readReturnValue(PACKED_VECTOR3_ARRAY) as PackedVector3Array) + } + + public final fun setEmissionColors(array: PackedColorArray): Unit { + Internals.writeArguments(PACKED_COLOR_ARRAY to array) + Internals.callMethod(rawPtr, MethodBindings.setEmissionColorsPtr, NIL) + } + + public final fun getEmissionColors(): PackedColorArray { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getEmissionColorsPtr, PACKED_COLOR_ARRAY) + return (Internals.readReturnValue(PACKED_COLOR_ARRAY) as PackedColorArray) + } + + public final fun setEmissionRingAxis(axis: Vector3): Unit { + Internals.writeArguments(VECTOR3 to axis) + Internals.callMethod(rawPtr, MethodBindings.setEmissionRingAxisPtr, NIL) + } + + public final fun getEmissionRingAxis(): Vector3 { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getEmissionRingAxisPtr, VECTOR3) + return (Internals.readReturnValue(VECTOR3) as Vector3) + } + + public final fun setEmissionRingHeight(height: Float): Unit { + Internals.writeArguments(DOUBLE to height.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setEmissionRingHeightPtr, NIL) + } + + public final fun getEmissionRingHeight(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getEmissionRingHeightPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setEmissionRingRadius(radius: Float): Unit { + Internals.writeArguments(DOUBLE to radius.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setEmissionRingRadiusPtr, NIL) + } + + public final fun getEmissionRingRadius(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getEmissionRingRadiusPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setEmissionRingInnerRadius(innerRadius: Float): Unit { + Internals.writeArguments(DOUBLE to innerRadius.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setEmissionRingInnerRadiusPtr, NIL) + } + + public final fun getEmissionRingInnerRadius(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getEmissionRingInnerRadiusPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun getGravity(): Vector3 { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getGravityPtr, VECTOR3) + return (Internals.readReturnValue(VECTOR3) as Vector3) + } + + public final fun setGravity(accelVec: Vector3): Unit { + Internals.writeArguments(VECTOR3 to accelVec) + Internals.callMethod(rawPtr, MethodBindings.setGravityPtr, NIL) + } + + public final fun getSplitScale(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getSplitScalePtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public final fun setSplitScale(splitScale: Boolean): Unit { + Internals.writeArguments(BOOL to splitScale) + Internals.callMethod(rawPtr, MethodBindings.setSplitScalePtr, NIL) + } + + public final fun getScaleCurveX(): Curve? { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getScaleCurveXPtr, OBJECT) + return (Internals.readReturnValue(OBJECT) as Curve?) + } + + public final fun setScaleCurveX(scaleCurve: Curve?): Unit { + Internals.writeArguments(OBJECT to scaleCurve) + Internals.callMethod(rawPtr, MethodBindings.setScaleCurveXPtr, NIL) + } + + public final fun getScaleCurveY(): Curve? { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getScaleCurveYPtr, OBJECT) + return (Internals.readReturnValue(OBJECT) as Curve?) + } + + public final fun setScaleCurveY(scaleCurve: Curve?): Unit { + Internals.writeArguments(OBJECT to scaleCurve) + Internals.callMethod(rawPtr, MethodBindings.setScaleCurveYPtr, NIL) + } + + public final fun getScaleCurveZ(): Curve? { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getScaleCurveZPtr, OBJECT) + return (Internals.readReturnValue(OBJECT) as Curve?) + } + + public final fun setScaleCurveZ(scaleCurve: Curve?): Unit { + Internals.writeArguments(OBJECT to scaleCurve) + Internals.callMethod(rawPtr, MethodBindings.setScaleCurveZPtr, NIL) + } + + /** + * Sets this node's properties to match a given [GPUParticles3D] node with an assigned + * [ParticleProcessMaterial]. + */ + public final fun convertFromParticles(particles: Node?): Unit { + Internals.writeArguments(OBJECT to particles) + Internals.callMethod(rawPtr, MethodBindings.convertFromParticlesPtr, NIL) + } + + public enum class DrawOrder( + id: Long, + ) { + /** + * Particles are drawn in the order emitted. + */ + DRAW_ORDER_INDEX(0), + /** + * Particles are drawn in order of remaining lifetime. In other words, the particle with the + * highest lifetime is drawn at the front. + */ + DRAW_ORDER_LIFETIME(1), + /** + * Particles are drawn in order of depth. + */ + DRAW_ORDER_VIEW_DEPTH(2), + ; + + public val id: Long + init { + this.id = id + } + + public companion object { + public fun from(`value`: Long): DrawOrder = entries.single { it.id == `value` } + } + } + + public enum class Parameter( + id: Long, + ) { + /** + * Use with [setParamMin], [setParamMax], and [setParamCurve] to set initial velocity + * properties. + */ + PARAM_INITIAL_LINEAR_VELOCITY(0), + /** + * Use with [setParamMin], [setParamMax], and [setParamCurve] to set angular velocity + * properties. + */ + PARAM_ANGULAR_VELOCITY(1), + /** + * Use with [setParamMin], [setParamMax], and [setParamCurve] to set orbital velocity + * properties. + */ + PARAM_ORBIT_VELOCITY(2), + /** + * Use with [setParamMin], [setParamMax], and [setParamCurve] to set linear acceleration + * properties. + */ + PARAM_LINEAR_ACCEL(3), + /** + * Use with [setParamMin], [setParamMax], and [setParamCurve] to set radial acceleration + * properties. + */ + PARAM_RADIAL_ACCEL(4), + /** + * Use with [setParamMin], [setParamMax], and [setParamCurve] to set tangential acceleration + * properties. + */ + PARAM_TANGENTIAL_ACCEL(5), + /** + * Use with [setParamMin], [setParamMax], and [setParamCurve] to set damping properties. + */ + PARAM_DAMPING(6), + /** + * Use with [setParamMin], [setParamMax], and [setParamCurve] to set angle properties. + */ + PARAM_ANGLE(7), + /** + * Use with [setParamMin], [setParamMax], and [setParamCurve] to set scale properties. + */ + PARAM_SCALE(8), + /** + * Use with [setParamMin], [setParamMax], and [setParamCurve] to set hue variation properties. + */ + PARAM_HUE_VARIATION(9), + /** + * Use with [setParamMin], [setParamMax], and [setParamCurve] to set animation speed properties. + */ + PARAM_ANIM_SPEED(10), + /** + * Use with [setParamMin], [setParamMax], and [setParamCurve] to set animation offset + * properties. + */ + PARAM_ANIM_OFFSET(11), + /** + * Represents the size of the [Parameter] enum. + */ + PARAM_MAX(12), + ; + + public val id: Long + init { + this.id = id + } + + public companion object { + public fun from(`value`: Long): Parameter = entries.single { it.id == `value` } + } + } + + public enum class ParticleFlags( + id: Long, + ) { + /** + * Use with [setParticleFlag] to set [particleFlagAlignY]. + */ + PARTICLE_FLAG_ALIGN_Y_TO_VELOCITY(0), + /** + * Use with [setParticleFlag] to set [particleFlagRotateY]. + */ + PARTICLE_FLAG_ROTATE_Y(1), + /** + * Use with [setParticleFlag] to set [particleFlagDisableZ]. + */ + PARTICLE_FLAG_DISABLE_Z(2), + /** + * Represents the size of the [ParticleFlags] enum. + */ + PARTICLE_FLAG_MAX(3), + ; + + public val id: Long + init { + this.id = id + } + + public companion object { + public fun from(`value`: Long): ParticleFlags = entries.single { it.id == `value` } + } + } + + public enum class EmissionShape( + id: Long, + ) { + /** + * All particles will be emitted from a single point. + */ + EMISSION_SHAPE_POINT(0), + /** + * Particles will be emitted in the volume of a sphere. + */ + EMISSION_SHAPE_SPHERE(1), + /** + * Particles will be emitted on the surface of a sphere. + */ + EMISSION_SHAPE_SPHERE_SURFACE(2), + /** + * Particles will be emitted in the volume of a box. + */ + EMISSION_SHAPE_BOX(3), + /** + * Particles will be emitted at a position chosen randomly among [emissionPoints]. Particle + * color will be modulated by [emissionColors]. + */ + EMISSION_SHAPE_POINTS(4), + /** + * Particles will be emitted at a position chosen randomly among [emissionPoints]. Particle + * velocity and rotation will be set based on [emissionNormals]. Particle color will be modulated + * by [emissionColors]. + */ + EMISSION_SHAPE_DIRECTED_POINTS(5), + /** + * Particles will be emitted in a ring or cylinder. + */ + EMISSION_SHAPE_RING(6), + /** + * Represents the size of the [EmissionShape] enum. + */ + EMISSION_SHAPE_MAX(7), + ; + + public val id: Long + init { + this.id = id + } + + public companion object { + public fun from(`value`: Long): EmissionShape = entries.single { it.id == `value` } + } + } + + public companion object + + public object MethodBindings { + internal val setEmittingPtr: VoidPtr = + Internals.getMethodBindPtr("CPUParticles3D", "set_emitting", 2586408642) + + internal val setAmountPtr: VoidPtr = + Internals.getMethodBindPtr("CPUParticles3D", "set_amount", 1286410249) + + internal val setLifetimePtr: VoidPtr = + Internals.getMethodBindPtr("CPUParticles3D", "set_lifetime", 373806689) + + internal val setOneShotPtr: VoidPtr = + Internals.getMethodBindPtr("CPUParticles3D", "set_one_shot", 2586408642) + + internal val setPreProcessTimePtr: VoidPtr = + Internals.getMethodBindPtr("CPUParticles3D", "set_pre_process_time", 373806689) + + internal val setExplosivenessRatioPtr: VoidPtr = + Internals.getMethodBindPtr("CPUParticles3D", "set_explosiveness_ratio", 373806689) + + internal val setRandomnessRatioPtr: VoidPtr = + Internals.getMethodBindPtr("CPUParticles3D", "set_randomness_ratio", 373806689) + + internal val setVisibilityAabbPtr: VoidPtr = + Internals.getMethodBindPtr("CPUParticles3D", "set_visibility_aabb", 259215842) + + internal val setLifetimeRandomnessPtr: VoidPtr = + Internals.getMethodBindPtr("CPUParticles3D", "set_lifetime_randomness", 373806689) + + internal val setUseLocalCoordinatesPtr: VoidPtr = + Internals.getMethodBindPtr("CPUParticles3D", "set_use_local_coordinates", 2586408642) + + internal val setFixedFpsPtr: VoidPtr = + Internals.getMethodBindPtr("CPUParticles3D", "set_fixed_fps", 1286410249) + + internal val setFractionalDeltaPtr: VoidPtr = + Internals.getMethodBindPtr("CPUParticles3D", "set_fractional_delta", 2586408642) + + internal val setSpeedScalePtr: VoidPtr = + Internals.getMethodBindPtr("CPUParticles3D", "set_speed_scale", 373806689) + + internal val isEmittingPtr: VoidPtr = + Internals.getMethodBindPtr("CPUParticles3D", "is_emitting", 36873697) + + internal val getAmountPtr: VoidPtr = + Internals.getMethodBindPtr("CPUParticles3D", "get_amount", 3905245786) + + internal val getLifetimePtr: VoidPtr = + Internals.getMethodBindPtr("CPUParticles3D", "get_lifetime", 1740695150) + + internal val getOneShotPtr: VoidPtr = + Internals.getMethodBindPtr("CPUParticles3D", "get_one_shot", 36873697) + + internal val getPreProcessTimePtr: VoidPtr = + Internals.getMethodBindPtr("CPUParticles3D", "get_pre_process_time", 1740695150) + + internal val getExplosivenessRatioPtr: VoidPtr = + Internals.getMethodBindPtr("CPUParticles3D", "get_explosiveness_ratio", 1740695150) + + internal val getRandomnessRatioPtr: VoidPtr = + Internals.getMethodBindPtr("CPUParticles3D", "get_randomness_ratio", 1740695150) + + internal val getVisibilityAabbPtr: VoidPtr = + Internals.getMethodBindPtr("CPUParticles3D", "get_visibility_aabb", 1068685055) + + internal val getLifetimeRandomnessPtr: VoidPtr = + Internals.getMethodBindPtr("CPUParticles3D", "get_lifetime_randomness", 1740695150) + + internal val getUseLocalCoordinatesPtr: VoidPtr = + Internals.getMethodBindPtr("CPUParticles3D", "get_use_local_coordinates", 36873697) + + internal val getFixedFpsPtr: VoidPtr = + Internals.getMethodBindPtr("CPUParticles3D", "get_fixed_fps", 3905245786) + + internal val getFractionalDeltaPtr: VoidPtr = + Internals.getMethodBindPtr("CPUParticles3D", "get_fractional_delta", 36873697) + + internal val getSpeedScalePtr: VoidPtr = + Internals.getMethodBindPtr("CPUParticles3D", "get_speed_scale", 1740695150) + + internal val setDrawOrderPtr: VoidPtr = + Internals.getMethodBindPtr("CPUParticles3D", "set_draw_order", 1427401774) + + internal val getDrawOrderPtr: VoidPtr = + Internals.getMethodBindPtr("CPUParticles3D", "get_draw_order", 1321900776) + + internal val setMeshPtr: VoidPtr = + Internals.getMethodBindPtr("CPUParticles3D", "set_mesh", 194775623) + + internal val getMeshPtr: VoidPtr = + Internals.getMethodBindPtr("CPUParticles3D", "get_mesh", 1808005922) + + internal val restartPtr: VoidPtr = + Internals.getMethodBindPtr("CPUParticles3D", "restart", 3218959716) + + internal val setDirectionPtr: VoidPtr = + Internals.getMethodBindPtr("CPUParticles3D", "set_direction", 3460891852) + + internal val getDirectionPtr: VoidPtr = + Internals.getMethodBindPtr("CPUParticles3D", "get_direction", 3360562783) + + internal val setSpreadPtr: VoidPtr = + Internals.getMethodBindPtr("CPUParticles3D", "set_spread", 373806689) + + internal val getSpreadPtr: VoidPtr = + Internals.getMethodBindPtr("CPUParticles3D", "get_spread", 1740695150) + + internal val setFlatnessPtr: VoidPtr = + Internals.getMethodBindPtr("CPUParticles3D", "set_flatness", 373806689) + + internal val getFlatnessPtr: VoidPtr = + Internals.getMethodBindPtr("CPUParticles3D", "get_flatness", 1740695150) + + internal val setParamMinPtr: VoidPtr = + Internals.getMethodBindPtr("CPUParticles3D", "set_param_min", 557936109) + + internal val getParamMinPtr: VoidPtr = + Internals.getMethodBindPtr("CPUParticles3D", "get_param_min", 597646162) + + internal val setParamMaxPtr: VoidPtr = + Internals.getMethodBindPtr("CPUParticles3D", "set_param_max", 557936109) + + internal val getParamMaxPtr: VoidPtr = + Internals.getMethodBindPtr("CPUParticles3D", "get_param_max", 597646162) + + internal val setParamCurvePtr: VoidPtr = + Internals.getMethodBindPtr("CPUParticles3D", "set_param_curve", 4044142537) + + internal val getParamCurvePtr: VoidPtr = + Internals.getMethodBindPtr("CPUParticles3D", "get_param_curve", 4132790277) + + internal val setColorPtr: VoidPtr = + Internals.getMethodBindPtr("CPUParticles3D", "set_color", 2920490490) + + internal val getColorPtr: VoidPtr = + Internals.getMethodBindPtr("CPUParticles3D", "get_color", 3444240500) + + internal val setColorRampPtr: VoidPtr = + Internals.getMethodBindPtr("CPUParticles3D", "set_color_ramp", 2756054477) + + internal val getColorRampPtr: VoidPtr = + Internals.getMethodBindPtr("CPUParticles3D", "get_color_ramp", 132272999) + + internal val setColorInitialRampPtr: VoidPtr = + Internals.getMethodBindPtr("CPUParticles3D", "set_color_initial_ramp", 2756054477) + + internal val getColorInitialRampPtr: VoidPtr = + Internals.getMethodBindPtr("CPUParticles3D", "get_color_initial_ramp", 132272999) + + internal val setParticleFlagPtr: VoidPtr = + Internals.getMethodBindPtr("CPUParticles3D", "set_particle_flag", 3515406498) + + internal val getParticleFlagPtr: VoidPtr = + Internals.getMethodBindPtr("CPUParticles3D", "get_particle_flag", 2845201987) + + internal val setEmissionShapePtr: VoidPtr = + Internals.getMethodBindPtr("CPUParticles3D", "set_emission_shape", 491823814) + + internal val getEmissionShapePtr: VoidPtr = + Internals.getMethodBindPtr("CPUParticles3D", "get_emission_shape", 2961454842) + + internal val setEmissionSphereRadiusPtr: VoidPtr = + Internals.getMethodBindPtr("CPUParticles3D", "set_emission_sphere_radius", 373806689) + + internal val getEmissionSphereRadiusPtr: VoidPtr = + Internals.getMethodBindPtr("CPUParticles3D", "get_emission_sphere_radius", 1740695150) + + internal val setEmissionBoxExtentsPtr: VoidPtr = + Internals.getMethodBindPtr("CPUParticles3D", "set_emission_box_extents", 3460891852) + + internal val getEmissionBoxExtentsPtr: VoidPtr = + Internals.getMethodBindPtr("CPUParticles3D", "get_emission_box_extents", 3360562783) + + internal val setEmissionPointsPtr: VoidPtr = + Internals.getMethodBindPtr("CPUParticles3D", "set_emission_points", 334873810) + + internal val getEmissionPointsPtr: VoidPtr = + Internals.getMethodBindPtr("CPUParticles3D", "get_emission_points", 497664490) + + internal val setEmissionNormalsPtr: VoidPtr = + Internals.getMethodBindPtr("CPUParticles3D", "set_emission_normals", 334873810) + + internal val getEmissionNormalsPtr: VoidPtr = + Internals.getMethodBindPtr("CPUParticles3D", "get_emission_normals", 497664490) + + internal val setEmissionColorsPtr: VoidPtr = + Internals.getMethodBindPtr("CPUParticles3D", "set_emission_colors", 3546319833) + + internal val getEmissionColorsPtr: VoidPtr = + Internals.getMethodBindPtr("CPUParticles3D", "get_emission_colors", 1392750486) + + internal val setEmissionRingAxisPtr: VoidPtr = + Internals.getMethodBindPtr("CPUParticles3D", "set_emission_ring_axis", 3460891852) + + internal val getEmissionRingAxisPtr: VoidPtr = + Internals.getMethodBindPtr("CPUParticles3D", "get_emission_ring_axis", 3360562783) + + internal val setEmissionRingHeightPtr: VoidPtr = + Internals.getMethodBindPtr("CPUParticles3D", "set_emission_ring_height", 373806689) + + internal val getEmissionRingHeightPtr: VoidPtr = + Internals.getMethodBindPtr("CPUParticles3D", "get_emission_ring_height", 1740695150) + + internal val setEmissionRingRadiusPtr: VoidPtr = + Internals.getMethodBindPtr("CPUParticles3D", "set_emission_ring_radius", 373806689) + + internal val getEmissionRingRadiusPtr: VoidPtr = + Internals.getMethodBindPtr("CPUParticles3D", "get_emission_ring_radius", 1740695150) + + internal val setEmissionRingInnerRadiusPtr: VoidPtr = + Internals.getMethodBindPtr("CPUParticles3D", "set_emission_ring_inner_radius", 373806689) + + internal val getEmissionRingInnerRadiusPtr: VoidPtr = + Internals.getMethodBindPtr("CPUParticles3D", "get_emission_ring_inner_radius", 1740695150) + + internal val getGravityPtr: VoidPtr = + Internals.getMethodBindPtr("CPUParticles3D", "get_gravity", 3360562783) + + internal val setGravityPtr: VoidPtr = + Internals.getMethodBindPtr("CPUParticles3D", "set_gravity", 3460891852) + + internal val getSplitScalePtr: VoidPtr = + Internals.getMethodBindPtr("CPUParticles3D", "get_split_scale", 2240911060) + + internal val setSplitScalePtr: VoidPtr = + Internals.getMethodBindPtr("CPUParticles3D", "set_split_scale", 2586408642) + + internal val getScaleCurveXPtr: VoidPtr = + Internals.getMethodBindPtr("CPUParticles3D", "get_scale_curve_x", 2460114913) + + internal val setScaleCurveXPtr: VoidPtr = + Internals.getMethodBindPtr("CPUParticles3D", "set_scale_curve_x", 270443179) + + internal val getScaleCurveYPtr: VoidPtr = + Internals.getMethodBindPtr("CPUParticles3D", "get_scale_curve_y", 2460114913) + + internal val setScaleCurveYPtr: VoidPtr = + Internals.getMethodBindPtr("CPUParticles3D", "set_scale_curve_y", 270443179) + + internal val getScaleCurveZPtr: VoidPtr = + Internals.getMethodBindPtr("CPUParticles3D", "get_scale_curve_z", 2460114913) + + internal val setScaleCurveZPtr: VoidPtr = + Internals.getMethodBindPtr("CPUParticles3D", "set_scale_curve_z", 270443179) + + internal val convertFromParticlesPtr: VoidPtr = + Internals.getMethodBindPtr("CPUParticles3D", "convert_from_particles", 1078189570) + } +} diff --git a/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/CSGBox3D.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/CSGBox3D.kt new file mode 100644 index 0000000000..4f345f7f49 --- /dev/null +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/CSGBox3D.kt @@ -0,0 +1,122 @@ +// THIS FILE IS GENERATED! DO NOT EDIT IT MANUALLY! +@file:Suppress("PackageDirectoryMismatch", "unused", "FunctionName", "RedundantModalityModifier", + "UNCHECKED_CAST", "JoinDeclarationAndAssignment", "USELESS_CAST", + "RemoveRedundantQualifierName", "NOTHING_TO_INLINE", "NON_FINAL_MEMBER_IN_OBJECT", + "RedundantVisibilityModifier", "RedundantUnitReturnType", "MemberVisibilityCanBePrivate") + +package godot + +import godot.`annotation`.CoreTypeHelper +import godot.`annotation`.CoreTypeLocalCopy +import godot.`annotation`.GodotBaseType +import godot.core.VariantParser.NIL +import godot.core.VariantParser.OBJECT +import godot.core.VariantParser.VECTOR3 +import godot.core.Vector3 +import godot.util.Internals +import godot.util.VoidPtr +import kotlin.Int +import kotlin.Suppress +import kotlin.Unit +import kotlin.jvm.JvmName + +private const val ENGINE_CLASS_CSGBOX3D_INDEX: Int = 151 + +/** + * This node allows you to create a box for use with the CSG system. + * **Note:** CSG nodes are intended to be used for level prototyping. Creating CSG nodes has a + * significant CPU cost compared to creating a [MeshInstance3D] with a [PrimitiveMesh]. Moving a CSG + * node within another CSG node also has a significant CPU cost, so it should be avoided during + * gameplay. + */ +@GodotBaseType +public open class CSGBox3D : CSGPrimitive3D() { + /** + * The box's width, height and depth. + */ + @CoreTypeLocalCopy + public final inline var size: Vector3 + @JvmName("sizeProperty") + get() = getSize() + @JvmName("sizeProperty") + set(`value`) { + setSize(value) + } + + /** + * The material used to render the box. + */ + public final inline var material: Material? + @JvmName("materialProperty") + get() = getMaterial() + @JvmName("materialProperty") + set(`value`) { + setMaterial(value) + } + + public override fun new(scriptIndex: Int): Unit { + Internals.callConstructor(this, ENGINE_CLASS_CSGBOX3D_INDEX, scriptIndex) + } + + /** + * The box's width, height and depth. + * + * This is a helper function to make dealing with local copies easier. + * + * For more information, see our + * [documentation](https://godot-kotl.in/en/stable/user-guide/api-differences/#core-types). + * + * Allow to directly modify the local copy of the property and assign it back to the Object. + * + * Prefer that over writing: + * `````` + * val myCoreType = csgbox3d.size + * //Your changes + * csgbox3d.size = myCoreType + * `````` + */ + @CoreTypeHelper + public final fun sizeMutate(block: Vector3.() -> Unit): Vector3 = size.apply{ + block(this) + size = this + } + + + public final fun setSize(size: Vector3): Unit { + Internals.writeArguments(VECTOR3 to size) + Internals.callMethod(rawPtr, MethodBindings.setSizePtr, NIL) + } + + public final fun getSize(): Vector3 { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getSizePtr, VECTOR3) + return (Internals.readReturnValue(VECTOR3) as Vector3) + } + + public final fun setMaterial(material: Material?): Unit { + Internals.writeArguments(OBJECT to material) + Internals.callMethod(rawPtr, MethodBindings.setMaterialPtr, NIL) + } + + public final fun getMaterial(): Material? { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getMaterialPtr, OBJECT) + return (Internals.readReturnValue(OBJECT) as Material?) + } + + public companion object + + public object MethodBindings { + internal val setSizePtr: VoidPtr = + Internals.getMethodBindPtr("CSGBox3D", "set_size", 3460891852) + + internal val getSizePtr: VoidPtr = + Internals.getMethodBindPtr("CSGBox3D", "get_size", 3360562783) + + internal val setMaterialPtr: VoidPtr = + Internals.getMethodBindPtr("CSGBox3D", "set_material", 2757459619) + + internal val getMaterialPtr: VoidPtr = + Internals.getMethodBindPtr("CSGBox3D", "get_material", 5934680) + } +} diff --git a/kt/godot-library/src/main/kotlin/godot/gen/godot/CSGCombiner3D.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/CSGCombiner3D.kt similarity index 88% rename from kt/godot-library/src/main/kotlin/godot/gen/godot/CSGCombiner3D.kt rename to kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/CSGCombiner3D.kt index 1608b12c30..0afa3e4869 100644 --- a/kt/godot-library/src/main/kotlin/godot/gen/godot/CSGCombiner3D.kt +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/CSGCombiner3D.kt @@ -7,10 +7,13 @@ package godot import godot.`annotation`.GodotBaseType +import godot.util.Internals import kotlin.Int import kotlin.Suppress import kotlin.Unit +private const val ENGINE_CLASS_CSGCOMBINER3D_INDEX: Int = 152 + /** * For complex arrangements of shapes, it is sometimes needed to add structure to your CSG nodes. * The CSGCombiner3D node allows you to create this structure. The node encapsulates the result of the @@ -26,10 +29,10 @@ import kotlin.Unit @GodotBaseType public open class CSGCombiner3D : CSGShape3D() { public override fun new(scriptIndex: Int): Unit { - callConstructor(ENGINECLASS_CSGCOMBINER3D, scriptIndex) + Internals.callConstructor(this, ENGINE_CLASS_CSGCOMBINER3D_INDEX, scriptIndex) } public companion object - internal object MethodBindings + public object MethodBindings } diff --git a/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/CSGCylinder3D.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/CSGCylinder3D.kt new file mode 100644 index 0000000000..888678e8b4 --- /dev/null +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/CSGCylinder3D.kt @@ -0,0 +1,214 @@ +// THIS FILE IS GENERATED! DO NOT EDIT IT MANUALLY! +@file:Suppress("PackageDirectoryMismatch", "unused", "FunctionName", "RedundantModalityModifier", + "UNCHECKED_CAST", "JoinDeclarationAndAssignment", "USELESS_CAST", + "RemoveRedundantQualifierName", "NOTHING_TO_INLINE", "NON_FINAL_MEMBER_IN_OBJECT", + "RedundantVisibilityModifier", "RedundantUnitReturnType", "MemberVisibilityCanBePrivate") + +package godot + +import godot.`annotation`.GodotBaseType +import godot.core.VariantParser.BOOL +import godot.core.VariantParser.DOUBLE +import godot.core.VariantParser.LONG +import godot.core.VariantParser.NIL +import godot.core.VariantParser.OBJECT +import godot.util.Internals +import godot.util.VoidPtr +import kotlin.Boolean +import kotlin.Double +import kotlin.Float +import kotlin.Int +import kotlin.Long +import kotlin.Suppress +import kotlin.Unit +import kotlin.jvm.JvmName + +private const val ENGINE_CLASS_CSGCYLINDER3D_INDEX: Int = 153 + +/** + * This node allows you to create a cylinder (or cone) for use with the CSG system. + * **Note:** CSG nodes are intended to be used for level prototyping. Creating CSG nodes has a + * significant CPU cost compared to creating a [MeshInstance3D] with a [PrimitiveMesh]. Moving a CSG + * node within another CSG node also has a significant CPU cost, so it should be avoided during + * gameplay. + */ +@GodotBaseType +public open class CSGCylinder3D : CSGPrimitive3D() { + /** + * The radius of the cylinder. + */ + public final inline var radius: Float + @JvmName("radiusProperty") + get() = getRadius() + @JvmName("radiusProperty") + set(`value`) { + setRadius(value) + } + + /** + * The height of the cylinder. + */ + public final inline var height: Float + @JvmName("heightProperty") + get() = getHeight() + @JvmName("heightProperty") + set(`value`) { + setHeight(value) + } + + /** + * The number of sides of the cylinder, the higher this number the more detail there will be in + * the cylinder. + */ + public final inline var sides: Int + @JvmName("sidesProperty") + get() = getSides() + @JvmName("sidesProperty") + set(`value`) { + setSides(value) + } + + /** + * If `true` a cone is created, the [radius] will only apply to one side. + */ + public final inline var cone: Boolean + @JvmName("coneProperty") + get() = isCone() + @JvmName("coneProperty") + set(`value`) { + setCone(value) + } + + /** + * If `true` the normals of the cylinder are set to give a smooth effect making the cylinder seem + * rounded. If `false` the cylinder will have a flat shaded look. + */ + public final inline var smoothFaces: Boolean + @JvmName("smoothFacesProperty") + get() = getSmoothFaces() + @JvmName("smoothFacesProperty") + set(`value`) { + setSmoothFaces(value) + } + + /** + * The material used to render the cylinder. + */ + public final inline var material: Material? + @JvmName("materialProperty") + get() = getMaterial() + @JvmName("materialProperty") + set(`value`) { + setMaterial(value) + } + + public override fun new(scriptIndex: Int): Unit { + Internals.callConstructor(this, ENGINE_CLASS_CSGCYLINDER3D_INDEX, scriptIndex) + } + + public final fun setRadius(radius: Float): Unit { + Internals.writeArguments(DOUBLE to radius.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setRadiusPtr, NIL) + } + + public final fun getRadius(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getRadiusPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setHeight(height: Float): Unit { + Internals.writeArguments(DOUBLE to height.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setHeightPtr, NIL) + } + + public final fun getHeight(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getHeightPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setSides(sides: Int): Unit { + Internals.writeArguments(LONG to sides.toLong()) + Internals.callMethod(rawPtr, MethodBindings.setSidesPtr, NIL) + } + + public final fun getSides(): Int { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getSidesPtr, LONG) + return (Internals.readReturnValue(LONG) as Long).toInt() + } + + public final fun setCone(cone: Boolean): Unit { + Internals.writeArguments(BOOL to cone) + Internals.callMethod(rawPtr, MethodBindings.setConePtr, NIL) + } + + public final fun isCone(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isConePtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public final fun setMaterial(material: Material?): Unit { + Internals.writeArguments(OBJECT to material) + Internals.callMethod(rawPtr, MethodBindings.setMaterialPtr, NIL) + } + + public final fun getMaterial(): Material? { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getMaterialPtr, OBJECT) + return (Internals.readReturnValue(OBJECT) as Material?) + } + + public final fun setSmoothFaces(smoothFaces: Boolean): Unit { + Internals.writeArguments(BOOL to smoothFaces) + Internals.callMethod(rawPtr, MethodBindings.setSmoothFacesPtr, NIL) + } + + public final fun getSmoothFaces(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getSmoothFacesPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public companion object + + public object MethodBindings { + internal val setRadiusPtr: VoidPtr = + Internals.getMethodBindPtr("CSGCylinder3D", "set_radius", 373806689) + + internal val getRadiusPtr: VoidPtr = + Internals.getMethodBindPtr("CSGCylinder3D", "get_radius", 1740695150) + + internal val setHeightPtr: VoidPtr = + Internals.getMethodBindPtr("CSGCylinder3D", "set_height", 373806689) + + internal val getHeightPtr: VoidPtr = + Internals.getMethodBindPtr("CSGCylinder3D", "get_height", 1740695150) + + internal val setSidesPtr: VoidPtr = + Internals.getMethodBindPtr("CSGCylinder3D", "set_sides", 1286410249) + + internal val getSidesPtr: VoidPtr = + Internals.getMethodBindPtr("CSGCylinder3D", "get_sides", 3905245786) + + internal val setConePtr: VoidPtr = + Internals.getMethodBindPtr("CSGCylinder3D", "set_cone", 2586408642) + + internal val isConePtr: VoidPtr = + Internals.getMethodBindPtr("CSGCylinder3D", "is_cone", 36873697) + + internal val setMaterialPtr: VoidPtr = + Internals.getMethodBindPtr("CSGCylinder3D", "set_material", 2757459619) + + internal val getMaterialPtr: VoidPtr = + Internals.getMethodBindPtr("CSGCylinder3D", "get_material", 5934680) + + internal val setSmoothFacesPtr: VoidPtr = + Internals.getMethodBindPtr("CSGCylinder3D", "set_smooth_faces", 2586408642) + + internal val getSmoothFacesPtr: VoidPtr = + Internals.getMethodBindPtr("CSGCylinder3D", "get_smooth_faces", 36873697) + } +} diff --git a/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/CSGMesh3D.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/CSGMesh3D.kt new file mode 100644 index 0000000000..6caa171c29 --- /dev/null +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/CSGMesh3D.kt @@ -0,0 +1,102 @@ +// THIS FILE IS GENERATED! DO NOT EDIT IT MANUALLY! +@file:Suppress("PackageDirectoryMismatch", "unused", "FunctionName", "RedundantModalityModifier", + "UNCHECKED_CAST", "JoinDeclarationAndAssignment", "USELESS_CAST", + "RemoveRedundantQualifierName", "NOTHING_TO_INLINE", "NON_FINAL_MEMBER_IN_OBJECT", + "RedundantVisibilityModifier", "RedundantUnitReturnType", "MemberVisibilityCanBePrivate") + +package godot + +import godot.`annotation`.GodotBaseType +import godot.core.VariantParser.NIL +import godot.core.VariantParser.OBJECT +import godot.util.Internals +import godot.util.VoidPtr +import kotlin.Int +import kotlin.Suppress +import kotlin.Unit +import kotlin.jvm.JvmName + +private const val ENGINE_CLASS_CSGMESH3D_INDEX: Int = 154 + +/** + * This CSG node allows you to use any mesh resource as a CSG shape, provided it is closed, does not + * self-intersect, does not contain internal faces and has no edges that connect to more than two + * faces. See also [CSGPolygon3D] for drawing 2D extruded polygons to be used as CSG nodes. + * **Note:** CSG nodes are intended to be used for level prototyping. Creating CSG nodes has a + * significant CPU cost compared to creating a [MeshInstance3D] with a [PrimitiveMesh]. Moving a CSG + * node within another CSG node also has a significant CPU cost, so it should be avoided during + * gameplay. + */ +@GodotBaseType +public open class CSGMesh3D : CSGPrimitive3D() { + /** + * The [Mesh] resource to use as a CSG shape. + * **Note:** When using an [ArrayMesh], all vertex attributes except [Mesh.ARRAY_VERTEX], + * [Mesh.ARRAY_NORMAL] and [Mesh.ARRAY_TEX_UV] are left unused. Only [Mesh.ARRAY_VERTEX] and + * [Mesh.ARRAY_TEX_UV] will be passed to the GPU. + * [Mesh.ARRAY_NORMAL] is only used to determine which faces require the use of flat shading. By + * default, CSGMesh will ignore the mesh's vertex normals, recalculate them for each vertex and use a + * smooth shader. If a flat shader is required for a face, ensure that all vertex normals of the face + * are approximately equal. + */ + public final inline var mesh: Mesh? + @JvmName("meshProperty") + get() = getMesh() + @JvmName("meshProperty") + set(`value`) { + setMesh(value) + } + + /** + * The [Material] used in drawing the CSG shape. + */ + public final inline var material: Material? + @JvmName("materialProperty") + get() = getMaterial() + @JvmName("materialProperty") + set(`value`) { + setMaterial(value) + } + + public override fun new(scriptIndex: Int): Unit { + Internals.callConstructor(this, ENGINE_CLASS_CSGMESH3D_INDEX, scriptIndex) + } + + public final fun setMesh(mesh: Mesh?): Unit { + Internals.writeArguments(OBJECT to mesh) + Internals.callMethod(rawPtr, MethodBindings.setMeshPtr, NIL) + } + + public final fun getMesh(): Mesh? { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getMeshPtr, OBJECT) + return (Internals.readReturnValue(OBJECT) as Mesh?) + } + + public final fun setMaterial(material: Material?): Unit { + Internals.writeArguments(OBJECT to material) + Internals.callMethod(rawPtr, MethodBindings.setMaterialPtr, NIL) + } + + public final fun getMaterial(): Material? { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getMaterialPtr, OBJECT) + return (Internals.readReturnValue(OBJECT) as Material?) + } + + public companion object + + public object MethodBindings { + internal val setMeshPtr: VoidPtr = + Internals.getMethodBindPtr("CSGMesh3D", "set_mesh", 194775623) + + internal val getMeshPtr: VoidPtr = + Internals.getMethodBindPtr("CSGMesh3D", "get_mesh", 4081188045) + + internal val setMaterialPtr: VoidPtr = + Internals.getMethodBindPtr("CSGMesh3D", "set_material", 2757459619) + + internal val getMaterialPtr: VoidPtr = + Internals.getMethodBindPtr("CSGMesh3D", "get_material", 5934680) + } +} diff --git a/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/CSGPolygon3D.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/CSGPolygon3D.kt new file mode 100644 index 0000000000..989e536379 --- /dev/null +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/CSGPolygon3D.kt @@ -0,0 +1,592 @@ +// THIS FILE IS GENERATED! DO NOT EDIT IT MANUALLY! +@file:Suppress("PackageDirectoryMismatch", "unused", "FunctionName", "RedundantModalityModifier", + "UNCHECKED_CAST", "JoinDeclarationAndAssignment", "USELESS_CAST", + "RemoveRedundantQualifierName", "NOTHING_TO_INLINE", "NON_FINAL_MEMBER_IN_OBJECT", + "RedundantVisibilityModifier", "RedundantUnitReturnType", "MemberVisibilityCanBePrivate") + +package godot + +import godot.`annotation`.GodotBaseType +import godot.core.NodePath +import godot.core.PackedVector2Array +import godot.core.VariantParser.BOOL +import godot.core.VariantParser.DOUBLE +import godot.core.VariantParser.LONG +import godot.core.VariantParser.NIL +import godot.core.VariantParser.NODE_PATH +import godot.core.VariantParser.OBJECT +import godot.core.VariantParser.PACKED_VECTOR2_ARRAY +import godot.util.Internals +import godot.util.VoidPtr +import kotlin.Boolean +import kotlin.Double +import kotlin.Float +import kotlin.Int +import kotlin.Long +import kotlin.Suppress +import kotlin.Unit +import kotlin.jvm.JvmName + +private const val ENGINE_CLASS_CSGPOLYGON3D_INDEX: Int = 155 + +/** + * An array of 2D points is extruded to quickly and easily create a variety of 3D meshes. See also + * [CSGMesh3D] for using 3D meshes as CSG nodes. + * **Note:** CSG nodes are intended to be used for level prototyping. Creating CSG nodes has a + * significant CPU cost compared to creating a [MeshInstance3D] with a [PrimitiveMesh]. Moving a CSG + * node within another CSG node also has a significant CPU cost, so it should be avoided during + * gameplay. + */ +@GodotBaseType +public open class CSGPolygon3D : CSGPrimitive3D() { + /** + * The point array that defines the 2D polygon that is extruded. This can be a convex or concave + * polygon with 3 or more points. The polygon must *not* have any intersecting edges. Otherwise, + * triangulation will fail and no mesh will be generated. + * **Note:** If only 1 or 2 points are defined in [polygon], no mesh will be generated. + */ + public final inline var polygon: PackedVector2Array + @JvmName("polygonProperty") + get() = getPolygon() + @JvmName("polygonProperty") + set(`value`) { + setPolygon(value) + } + + /** + * The [mode] used to extrude the [polygon]. + */ + public final inline var mode: Mode + @JvmName("modeProperty") + get() = getMode() + @JvmName("modeProperty") + set(`value`) { + setMode(value) + } + + /** + * When [mode] is [MODE_DEPTH], the depth of the extrusion. + */ + public final inline var depth: Float + @JvmName("depthProperty") + get() = getDepth() + @JvmName("depthProperty") + set(`value`) { + setDepth(value) + } + + /** + * When [mode] is [MODE_SPIN], the total number of degrees the [polygon] is rotated when + * extruding. + */ + public final inline var spinDegrees: Float + @JvmName("spinDegreesProperty") + get() = getSpinDegrees() + @JvmName("spinDegreesProperty") + set(`value`) { + setSpinDegrees(value) + } + + /** + * When [mode] is [MODE_SPIN], the number of extrusions made. + */ + public final inline var spinSides: Int + @JvmName("spinSidesProperty") + get() = getSpinSides() + @JvmName("spinSidesProperty") + set(`value`) { + setSpinSides(value) + } + + /** + * When [mode] is [MODE_PATH], the location of the [Path3D] object used to extrude the [polygon]. + */ + public final inline var pathNode: NodePath + @JvmName("pathNodeProperty") + get() = getPathNode() + @JvmName("pathNodeProperty") + set(`value`) { + setPathNode(value) + } + + /** + * When [mode] is [MODE_PATH], this will determine if the interval should be by distance + * ([PATH_INTERVAL_DISTANCE]) or subdivision fractions ([PATH_INTERVAL_SUBDIVIDE]). + */ + public final inline var pathIntervalType: PathIntervalType + @JvmName("pathIntervalTypeProperty") + get() = getPathIntervalType() + @JvmName("pathIntervalTypeProperty") + set(`value`) { + setPathIntervalType(value) + } + + /** + * When [mode] is [MODE_PATH], the path interval or ratio of path points to extrusions. + */ + public final inline var pathInterval: Float + @JvmName("pathIntervalProperty") + get() = getPathInterval() + @JvmName("pathIntervalProperty") + set(`value`) { + setPathInterval(value) + } + + /** + * When [mode] is [MODE_PATH], extrusions that are less than this angle, will be merged together + * to reduce polygon count. + */ + public final inline var pathSimplifyAngle: Float + @JvmName("pathSimplifyAngleProperty") + get() = getPathSimplifyAngle() + @JvmName("pathSimplifyAngleProperty") + set(`value`) { + setPathSimplifyAngle(value) + } + + /** + * When [mode] is [MODE_PATH], the path rotation method used to rotate the [polygon] as it is + * extruded. + */ + public final inline var pathRotation: PathRotation + @JvmName("pathRotationProperty") + get() = getPathRotation() + @JvmName("pathRotationProperty") + set(`value`) { + setPathRotation(value) + } + + /** + * When [mode] is [MODE_PATH], if `true` the [Transform3D] of the [CSGPolygon3D] is used as the + * starting point for the extrusions, not the [Transform3D] of the [pathNode]. + */ + public final inline var pathLocal: Boolean + @JvmName("pathLocalProperty") + get() = isPathLocal() + @JvmName("pathLocalProperty") + set(`value`) { + setPathLocal(value) + } + + /** + * When [mode] is [MODE_PATH], by default, the top half of the [material] is stretched along the + * entire length of the extruded shape. If `false` the top half of the material is repeated every + * step of the extrusion. + */ + public final inline var pathContinuousU: Boolean + @JvmName("pathContinuousUProperty") + get() = isPathContinuousU() + @JvmName("pathContinuousUProperty") + set(`value`) { + setPathContinuousU(value) + } + + /** + * When [mode] is [MODE_PATH], this is the distance along the path, in meters, the texture + * coordinates will tile. When set to 0, texture coordinates will match geometry exactly with no + * tiling. + */ + public final inline var pathUDistance: Float + @JvmName("pathUDistanceProperty") + get() = getPathUDistance() + @JvmName("pathUDistanceProperty") + set(`value`) { + setPathUDistance(value) + } + + /** + * When [mode] is [MODE_PATH], if `true` the ends of the path are joined, by adding an extrusion + * between the last and first points of the path. + */ + public final inline var pathJoined: Boolean + @JvmName("pathJoinedProperty") + get() = isPathJoined() + @JvmName("pathJoinedProperty") + set(`value`) { + setPathJoined(value) + } + + /** + * If `true`, applies smooth shading to the extrusions. + */ + public final inline var smoothFaces: Boolean + @JvmName("smoothFacesProperty") + get() = getSmoothFaces() + @JvmName("smoothFacesProperty") + set(`value`) { + setSmoothFaces(value) + } + + /** + * Material to use for the resulting mesh. The UV maps the top half of the material to the + * extruded shape (U along the length of the extrusions and V around the outline of the [polygon]), + * the bottom-left quarter to the front end face, and the bottom-right quarter to the back end face. + */ + public final inline var material: Material? + @JvmName("materialProperty") + get() = getMaterial() + @JvmName("materialProperty") + set(`value`) { + setMaterial(value) + } + + public override fun new(scriptIndex: Int): Unit { + Internals.callConstructor(this, ENGINE_CLASS_CSGPOLYGON3D_INDEX, scriptIndex) + } + + public final fun setPolygon(polygon: PackedVector2Array): Unit { + Internals.writeArguments(PACKED_VECTOR2_ARRAY to polygon) + Internals.callMethod(rawPtr, MethodBindings.setPolygonPtr, NIL) + } + + public final fun getPolygon(): PackedVector2Array { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getPolygonPtr, PACKED_VECTOR2_ARRAY) + return (Internals.readReturnValue(PACKED_VECTOR2_ARRAY) as PackedVector2Array) + } + + public final fun setMode(mode: Mode): Unit { + Internals.writeArguments(LONG to mode.id) + Internals.callMethod(rawPtr, MethodBindings.setModePtr, NIL) + } + + public final fun getMode(): Mode { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getModePtr, LONG) + return CSGPolygon3D.Mode.from(Internals.readReturnValue(LONG) as Long) + } + + public final fun setDepth(depth: Float): Unit { + Internals.writeArguments(DOUBLE to depth.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setDepthPtr, NIL) + } + + public final fun getDepth(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getDepthPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setSpinDegrees(degrees: Float): Unit { + Internals.writeArguments(DOUBLE to degrees.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setSpinDegreesPtr, NIL) + } + + public final fun getSpinDegrees(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getSpinDegreesPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setSpinSides(spinSides: Int): Unit { + Internals.writeArguments(LONG to spinSides.toLong()) + Internals.callMethod(rawPtr, MethodBindings.setSpinSidesPtr, NIL) + } + + public final fun getSpinSides(): Int { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getSpinSidesPtr, LONG) + return (Internals.readReturnValue(LONG) as Long).toInt() + } + + public final fun setPathNode(path: NodePath): Unit { + Internals.writeArguments(NODE_PATH to path) + Internals.callMethod(rawPtr, MethodBindings.setPathNodePtr, NIL) + } + + public final fun getPathNode(): NodePath { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getPathNodePtr, NODE_PATH) + return (Internals.readReturnValue(NODE_PATH) as NodePath) + } + + public final fun setPathIntervalType(intervalType: PathIntervalType): Unit { + Internals.writeArguments(LONG to intervalType.id) + Internals.callMethod(rawPtr, MethodBindings.setPathIntervalTypePtr, NIL) + } + + public final fun getPathIntervalType(): PathIntervalType { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getPathIntervalTypePtr, LONG) + return CSGPolygon3D.PathIntervalType.from(Internals.readReturnValue(LONG) as Long) + } + + public final fun setPathInterval(interval: Float): Unit { + Internals.writeArguments(DOUBLE to interval.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setPathIntervalPtr, NIL) + } + + public final fun getPathInterval(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getPathIntervalPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setPathSimplifyAngle(degrees: Float): Unit { + Internals.writeArguments(DOUBLE to degrees.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setPathSimplifyAnglePtr, NIL) + } + + public final fun getPathSimplifyAngle(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getPathSimplifyAnglePtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setPathRotation(pathRotation: PathRotation): Unit { + Internals.writeArguments(LONG to pathRotation.id) + Internals.callMethod(rawPtr, MethodBindings.setPathRotationPtr, NIL) + } + + public final fun getPathRotation(): PathRotation { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getPathRotationPtr, LONG) + return CSGPolygon3D.PathRotation.from(Internals.readReturnValue(LONG) as Long) + } + + public final fun setPathLocal(enable: Boolean): Unit { + Internals.writeArguments(BOOL to enable) + Internals.callMethod(rawPtr, MethodBindings.setPathLocalPtr, NIL) + } + + public final fun isPathLocal(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isPathLocalPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public final fun setPathContinuousU(enable: Boolean): Unit { + Internals.writeArguments(BOOL to enable) + Internals.callMethod(rawPtr, MethodBindings.setPathContinuousUPtr, NIL) + } + + public final fun isPathContinuousU(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isPathContinuousUPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public final fun setPathUDistance(distance: Float): Unit { + Internals.writeArguments(DOUBLE to distance.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setPathUDistancePtr, NIL) + } + + public final fun getPathUDistance(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getPathUDistancePtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setPathJoined(enable: Boolean): Unit { + Internals.writeArguments(BOOL to enable) + Internals.callMethod(rawPtr, MethodBindings.setPathJoinedPtr, NIL) + } + + public final fun isPathJoined(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isPathJoinedPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public final fun setMaterial(material: Material?): Unit { + Internals.writeArguments(OBJECT to material) + Internals.callMethod(rawPtr, MethodBindings.setMaterialPtr, NIL) + } + + public final fun getMaterial(): Material? { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getMaterialPtr, OBJECT) + return (Internals.readReturnValue(OBJECT) as Material?) + } + + public final fun setSmoothFaces(smoothFaces: Boolean): Unit { + Internals.writeArguments(BOOL to smoothFaces) + Internals.callMethod(rawPtr, MethodBindings.setSmoothFacesPtr, NIL) + } + + public final fun getSmoothFaces(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getSmoothFacesPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public enum class Mode( + id: Long, + ) { + /** + * The [polygon] shape is extruded along the negative Z axis. + */ + MODE_DEPTH(0), + /** + * The [polygon] shape is extruded by rotating it around the Y axis. + */ + MODE_SPIN(1), + /** + * The [polygon] shape is extruded along the [Path3D] specified in [pathNode]. + */ + MODE_PATH(2), + ; + + public val id: Long + init { + this.id = id + } + + public companion object { + public fun from(`value`: Long): Mode = entries.single { it.id == `value` } + } + } + + public enum class PathRotation( + id: Long, + ) { + /** + * The [polygon] shape is not rotated. + * **Note:** Requires the path Z coordinates to continually decrease to ensure viable shapes. + */ + PATH_ROTATION_POLYGON(0), + /** + * The [polygon] shape is rotated along the path, but it is not rotated around the path axis. + * **Note:** Requires the path Z coordinates to continually decrease to ensure viable shapes. + */ + PATH_ROTATION_PATH(1), + /** + * The [polygon] shape follows the path and its rotations around the path axis. + */ + PATH_ROTATION_PATH_FOLLOW(2), + ; + + public val id: Long + init { + this.id = id + } + + public companion object { + public fun from(`value`: Long): PathRotation = entries.single { it.id == `value` } + } + } + + public enum class PathIntervalType( + id: Long, + ) { + /** + * When [mode] is set to [MODE_PATH], [pathInterval] will determine the distance, in meters, + * each interval of the path will extrude. + */ + PATH_INTERVAL_DISTANCE(0), + /** + * When [mode] is set to [MODE_PATH], [pathInterval] will subdivide the polygons along the path. + */ + PATH_INTERVAL_SUBDIVIDE(1), + ; + + public val id: Long + init { + this.id = id + } + + public companion object { + public fun from(`value`: Long): PathIntervalType = entries.single { it.id == `value` } + } + } + + public companion object + + public object MethodBindings { + internal val setPolygonPtr: VoidPtr = + Internals.getMethodBindPtr("CSGPolygon3D", "set_polygon", 1509147220) + + internal val getPolygonPtr: VoidPtr = + Internals.getMethodBindPtr("CSGPolygon3D", "get_polygon", 2961356807) + + internal val setModePtr: VoidPtr = + Internals.getMethodBindPtr("CSGPolygon3D", "set_mode", 3158377035) + + internal val getModePtr: VoidPtr = + Internals.getMethodBindPtr("CSGPolygon3D", "get_mode", 1201612222) + + internal val setDepthPtr: VoidPtr = + Internals.getMethodBindPtr("CSGPolygon3D", "set_depth", 373806689) + + internal val getDepthPtr: VoidPtr = + Internals.getMethodBindPtr("CSGPolygon3D", "get_depth", 1740695150) + + internal val setSpinDegreesPtr: VoidPtr = + Internals.getMethodBindPtr("CSGPolygon3D", "set_spin_degrees", 373806689) + + internal val getSpinDegreesPtr: VoidPtr = + Internals.getMethodBindPtr("CSGPolygon3D", "get_spin_degrees", 1740695150) + + internal val setSpinSidesPtr: VoidPtr = + Internals.getMethodBindPtr("CSGPolygon3D", "set_spin_sides", 1286410249) + + internal val getSpinSidesPtr: VoidPtr = + Internals.getMethodBindPtr("CSGPolygon3D", "get_spin_sides", 3905245786) + + internal val setPathNodePtr: VoidPtr = + Internals.getMethodBindPtr("CSGPolygon3D", "set_path_node", 1348162250) + + internal val getPathNodePtr: VoidPtr = + Internals.getMethodBindPtr("CSGPolygon3D", "get_path_node", 4075236667) + + internal val setPathIntervalTypePtr: VoidPtr = + Internals.getMethodBindPtr("CSGPolygon3D", "set_path_interval_type", 3744240707) + + internal val getPathIntervalTypePtr: VoidPtr = + Internals.getMethodBindPtr("CSGPolygon3D", "get_path_interval_type", 3434618397) + + internal val setPathIntervalPtr: VoidPtr = + Internals.getMethodBindPtr("CSGPolygon3D", "set_path_interval", 373806689) + + internal val getPathIntervalPtr: VoidPtr = + Internals.getMethodBindPtr("CSGPolygon3D", "get_path_interval", 1740695150) + + internal val setPathSimplifyAnglePtr: VoidPtr = + Internals.getMethodBindPtr("CSGPolygon3D", "set_path_simplify_angle", 373806689) + + internal val getPathSimplifyAnglePtr: VoidPtr = + Internals.getMethodBindPtr("CSGPolygon3D", "get_path_simplify_angle", 1740695150) + + internal val setPathRotationPtr: VoidPtr = + Internals.getMethodBindPtr("CSGPolygon3D", "set_path_rotation", 1412947288) + + internal val getPathRotationPtr: VoidPtr = + Internals.getMethodBindPtr("CSGPolygon3D", "get_path_rotation", 647219346) + + internal val setPathLocalPtr: VoidPtr = + Internals.getMethodBindPtr("CSGPolygon3D", "set_path_local", 2586408642) + + internal val isPathLocalPtr: VoidPtr = + Internals.getMethodBindPtr("CSGPolygon3D", "is_path_local", 36873697) + + internal val setPathContinuousUPtr: VoidPtr = + Internals.getMethodBindPtr("CSGPolygon3D", "set_path_continuous_u", 2586408642) + + internal val isPathContinuousUPtr: VoidPtr = + Internals.getMethodBindPtr("CSGPolygon3D", "is_path_continuous_u", 36873697) + + internal val setPathUDistancePtr: VoidPtr = + Internals.getMethodBindPtr("CSGPolygon3D", "set_path_u_distance", 373806689) + + internal val getPathUDistancePtr: VoidPtr = + Internals.getMethodBindPtr("CSGPolygon3D", "get_path_u_distance", 1740695150) + + internal val setPathJoinedPtr: VoidPtr = + Internals.getMethodBindPtr("CSGPolygon3D", "set_path_joined", 2586408642) + + internal val isPathJoinedPtr: VoidPtr = + Internals.getMethodBindPtr("CSGPolygon3D", "is_path_joined", 36873697) + + internal val setMaterialPtr: VoidPtr = + Internals.getMethodBindPtr("CSGPolygon3D", "set_material", 2757459619) + + internal val getMaterialPtr: VoidPtr = + Internals.getMethodBindPtr("CSGPolygon3D", "get_material", 5934680) + + internal val setSmoothFacesPtr: VoidPtr = + Internals.getMethodBindPtr("CSGPolygon3D", "set_smooth_faces", 2586408642) + + internal val getSmoothFacesPtr: VoidPtr = + Internals.getMethodBindPtr("CSGPolygon3D", "get_smooth_faces", 36873697) + } +} diff --git a/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/CSGPrimitive3D.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/CSGPrimitive3D.kt new file mode 100644 index 0000000000..1058ea7d54 --- /dev/null +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/CSGPrimitive3D.kt @@ -0,0 +1,69 @@ +// THIS FILE IS GENERATED! DO NOT EDIT IT MANUALLY! +@file:Suppress("PackageDirectoryMismatch", "unused", "FunctionName", "RedundantModalityModifier", + "UNCHECKED_CAST", "JoinDeclarationAndAssignment", "USELESS_CAST", + "RemoveRedundantQualifierName", "NOTHING_TO_INLINE", "NON_FINAL_MEMBER_IN_OBJECT", + "RedundantVisibilityModifier", "RedundantUnitReturnType", "MemberVisibilityCanBePrivate") + +package godot + +import godot.`annotation`.GodotBaseType +import godot.core.VariantParser.BOOL +import godot.core.VariantParser.NIL +import godot.util.Internals +import godot.util.VoidPtr +import kotlin.Boolean +import kotlin.Int +import kotlin.Suppress +import kotlin.Unit +import kotlin.jvm.JvmName + +private const val ENGINE_CLASS_CSGPRIMITIVE3D_INDEX: Int = 156 + +/** + * Parent class for various CSG primitives. It contains code and functionality that is common + * between them. It cannot be used directly. Instead use one of the various classes that inherit from + * it. + * **Note:** CSG nodes are intended to be used for level prototyping. Creating CSG nodes has a + * significant CPU cost compared to creating a [MeshInstance3D] with a [PrimitiveMesh]. Moving a CSG + * node within another CSG node also has a significant CPU cost, so it should be avoided during + * gameplay. + */ +@GodotBaseType +public open class CSGPrimitive3D internal constructor() : CSGShape3D() { + /** + * If set, the order of the vertices in each triangle are reversed resulting in the backside of + * the mesh being drawn. + */ + public final inline var flipFaces: Boolean + @JvmName("flipFacesProperty") + get() = getFlipFaces() + @JvmName("flipFacesProperty") + set(`value`) { + setFlipFaces(value) + } + + public override fun new(scriptIndex: Int): Unit { + Internals.callConstructor(this, ENGINE_CLASS_CSGPRIMITIVE3D_INDEX, scriptIndex) + } + + public final fun setFlipFaces(flipFaces: Boolean): Unit { + Internals.writeArguments(BOOL to flipFaces) + Internals.callMethod(rawPtr, MethodBindings.setFlipFacesPtr, NIL) + } + + public final fun getFlipFaces(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getFlipFacesPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public companion object + + public object MethodBindings { + internal val setFlipFacesPtr: VoidPtr = + Internals.getMethodBindPtr("CSGPrimitive3D", "set_flip_faces", 2586408642) + + internal val getFlipFacesPtr: VoidPtr = + Internals.getMethodBindPtr("CSGPrimitive3D", "get_flip_faces", 2240911060) + } +} diff --git a/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/CSGShape3D.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/CSGShape3D.kt new file mode 100644 index 0000000000..0b61eebccc --- /dev/null +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/CSGShape3D.kt @@ -0,0 +1,363 @@ +// THIS FILE IS GENERATED! DO NOT EDIT IT MANUALLY! +@file:Suppress("PackageDirectoryMismatch", "unused", "FunctionName", "RedundantModalityModifier", + "UNCHECKED_CAST", "JoinDeclarationAndAssignment", "USELESS_CAST", + "RemoveRedundantQualifierName", "NOTHING_TO_INLINE", "NON_FINAL_MEMBER_IN_OBJECT", + "RedundantVisibilityModifier", "RedundantUnitReturnType", "MemberVisibilityCanBePrivate") + +package godot + +import godot.`annotation`.GodotBaseType +import godot.core.VariantArray +import godot.core.VariantParser.ARRAY +import godot.core.VariantParser.BOOL +import godot.core.VariantParser.DOUBLE +import godot.core.VariantParser.LONG +import godot.core.VariantParser.NIL +import godot.util.Internals +import godot.util.VoidPtr +import kotlin.Any +import kotlin.Boolean +import kotlin.Double +import kotlin.Float +import kotlin.Int +import kotlin.Long +import kotlin.Suppress +import kotlin.Unit +import kotlin.jvm.JvmName + +private const val ENGINE_CLASS_CSGSHAPE3D_INDEX: Int = 157 + +/** + * This is the CSG base class that provides CSG operation support to the various CSG nodes in Godot. + * **Note:** CSG nodes are intended to be used for level prototyping. Creating CSG nodes has a + * significant CPU cost compared to creating a [MeshInstance3D] with a [PrimitiveMesh]. Moving a CSG + * node within another CSG node also has a significant CPU cost, so it should be avoided during + * gameplay. + */ +@GodotBaseType +public open class CSGShape3D internal constructor() : GeometryInstance3D() { + /** + * The operation that is performed on this shape. This is ignored for the first CSG child node as + * the operation is between this node and the previous child of this nodes parent. + */ + public final inline var operation: Operation + @JvmName("operationProperty") + get() = getOperation() + @JvmName("operationProperty") + set(`value`) { + setOperation(value) + } + + /** + * Snap makes the mesh vertices snap to a given distance so that the faces of two meshes can be + * perfectly aligned. A lower value results in greater precision but may be harder to adjust. The + * top-level CSG shape's snap value is used for the entire CSG tree. + */ + public final inline var snap: Float + @JvmName("snapProperty") + get() = getSnap() + @JvmName("snapProperty") + set(`value`) { + setSnap(value) + } + + /** + * Calculate tangents for the CSG shape which allows the use of normal maps. This is only applied + * on the root shape, this setting is ignored on any child. + */ + public final inline var calculateTangents: Boolean + @JvmName("calculateTangentsProperty") + get() = isCalculatingTangents() + @JvmName("calculateTangentsProperty") + set(`value`) { + setCalculateTangents(value) + } + + /** + * Adds a collision shape to the physics engine for our CSG shape. This will always act like a + * static body. Note that the collision shape is still active even if the CSG shape itself is hidden. + * See also [collisionMask] and [collisionPriority]. + */ + public final inline var useCollision: Boolean + @JvmName("useCollisionProperty") + get() = isUsingCollision() + @JvmName("useCollisionProperty") + set(`value`) { + setUseCollision(value) + } + + /** + * The physics layers this area is in. + * Collidable objects can exist in any of 32 different layers. These layers work like a tagging + * system, and are not visual. A collidable can use these layers to select with which objects it can + * collide, using the collision_mask property. + * A contact is detected if object A is in any of the layers that object B scans, or object B is + * in any layer scanned by object A. See + * [url=$DOCS_URL/tutorials/physics/physics_introduction.html#collision-layers-and-masks]Collision + * layers and masks[/url] in the documentation for more information. + */ + public final inline var collisionLayer: Long + @JvmName("collisionLayerProperty") + get() = getCollisionLayer() + @JvmName("collisionLayerProperty") + set(`value`) { + setCollisionLayer(value) + } + + /** + * The physics layers this CSG shape scans for collisions. Only effective if [useCollision] is + * `true`. See + * [url=$DOCS_URL/tutorials/physics/physics_introduction.html#collision-layers-and-masks]Collision + * layers and masks[/url] in the documentation for more information. + */ + public final inline var collisionMask: Long + @JvmName("collisionMaskProperty") + get() = getCollisionMask() + @JvmName("collisionMaskProperty") + set(`value`) { + setCollisionMask(value) + } + + /** + * The priority used to solve colliding when occurring penetration. Only effective if + * [useCollision] is `true`. The higher the priority is, the lower the penetration into the object + * will be. This can for example be used to prevent the player from breaking through the boundaries + * of a level. + */ + public final inline var collisionPriority: Float + @JvmName("collisionPriorityProperty") + get() = getCollisionPriority() + @JvmName("collisionPriorityProperty") + set(`value`) { + setCollisionPriority(value) + } + + public override fun new(scriptIndex: Int): Unit { + Internals.callConstructor(this, ENGINE_CLASS_CSGSHAPE3D_INDEX, scriptIndex) + } + + /** + * Returns `true` if this is a root shape and is thus the object that is rendered. + */ + public final fun isRootShape(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isRootShapePtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public final fun setOperation(operation: Operation): Unit { + Internals.writeArguments(LONG to operation.id) + Internals.callMethod(rawPtr, MethodBindings.setOperationPtr, NIL) + } + + public final fun getOperation(): Operation { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getOperationPtr, LONG) + return CSGShape3D.Operation.from(Internals.readReturnValue(LONG) as Long) + } + + public final fun setSnap(snap: Float): Unit { + Internals.writeArguments(DOUBLE to snap.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setSnapPtr, NIL) + } + + public final fun getSnap(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getSnapPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setUseCollision(operation: Boolean): Unit { + Internals.writeArguments(BOOL to operation) + Internals.callMethod(rawPtr, MethodBindings.setUseCollisionPtr, NIL) + } + + public final fun isUsingCollision(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isUsingCollisionPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public final fun setCollisionLayer(layer: Long): Unit { + Internals.writeArguments(LONG to layer) + Internals.callMethod(rawPtr, MethodBindings.setCollisionLayerPtr, NIL) + } + + public final fun getCollisionLayer(): Long { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getCollisionLayerPtr, LONG) + return (Internals.readReturnValue(LONG) as Long) + } + + public final fun setCollisionMask(mask: Long): Unit { + Internals.writeArguments(LONG to mask) + Internals.callMethod(rawPtr, MethodBindings.setCollisionMaskPtr, NIL) + } + + public final fun getCollisionMask(): Long { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getCollisionMaskPtr, LONG) + return (Internals.readReturnValue(LONG) as Long) + } + + /** + * Based on [value], enables or disables the specified layer in the [collisionMask], given a + * [layerNumber] between 1 and 32. + */ + public final fun setCollisionMaskValue(layerNumber: Int, `value`: Boolean): Unit { + Internals.writeArguments(LONG to layerNumber.toLong(), BOOL to value) + Internals.callMethod(rawPtr, MethodBindings.setCollisionMaskValuePtr, NIL) + } + + /** + * Returns whether or not the specified layer of the [collisionMask] is enabled, given a + * [layerNumber] between 1 and 32. + */ + public final fun getCollisionMaskValue(layerNumber: Int): Boolean { + Internals.writeArguments(LONG to layerNumber.toLong()) + Internals.callMethod(rawPtr, MethodBindings.getCollisionMaskValuePtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + /** + * Based on [value], enables or disables the specified layer in the [collisionLayer], given a + * [layerNumber] between 1 and 32. + */ + public final fun setCollisionLayerValue(layerNumber: Int, `value`: Boolean): Unit { + Internals.writeArguments(LONG to layerNumber.toLong(), BOOL to value) + Internals.callMethod(rawPtr, MethodBindings.setCollisionLayerValuePtr, NIL) + } + + /** + * Returns whether or not the specified layer of the [collisionLayer] is enabled, given a + * [layerNumber] between 1 and 32. + */ + public final fun getCollisionLayerValue(layerNumber: Int): Boolean { + Internals.writeArguments(LONG to layerNumber.toLong()) + Internals.callMethod(rawPtr, MethodBindings.getCollisionLayerValuePtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public final fun setCollisionPriority(priority: Float): Unit { + Internals.writeArguments(DOUBLE to priority.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setCollisionPriorityPtr, NIL) + } + + public final fun getCollisionPriority(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getCollisionPriorityPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setCalculateTangents(enabled: Boolean): Unit { + Internals.writeArguments(BOOL to enabled) + Internals.callMethod(rawPtr, MethodBindings.setCalculateTangentsPtr, NIL) + } + + public final fun isCalculatingTangents(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isCalculatingTangentsPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + /** + * Returns an [Array] with two elements, the first is the [Transform3D] of this node and the + * second is the root [Mesh] of this node. Only works when this node is the root shape. + */ + public final fun getMeshes(): VariantArray { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getMeshesPtr, ARRAY) + return (Internals.readReturnValue(ARRAY) as VariantArray) + } + + public enum class Operation( + id: Long, + ) { + /** + * Geometry of both primitives is merged, intersecting geometry is removed. + */ + OPERATION_UNION(0), + /** + * Only intersecting geometry remains, the rest is removed. + */ + OPERATION_INTERSECTION(1), + /** + * The second shape is subtracted from the first, leaving a dent with its shape. + */ + OPERATION_SUBTRACTION(2), + ; + + public val id: Long + init { + this.id = id + } + + public companion object { + public fun from(`value`: Long): Operation = entries.single { it.id == `value` } + } + } + + public companion object + + public object MethodBindings { + internal val isRootShapePtr: VoidPtr = + Internals.getMethodBindPtr("CSGShape3D", "is_root_shape", 36873697) + + internal val setOperationPtr: VoidPtr = + Internals.getMethodBindPtr("CSGShape3D", "set_operation", 811425055) + + internal val getOperationPtr: VoidPtr = + Internals.getMethodBindPtr("CSGShape3D", "get_operation", 2662425879) + + internal val setSnapPtr: VoidPtr = + Internals.getMethodBindPtr("CSGShape3D", "set_snap", 373806689) + + internal val getSnapPtr: VoidPtr = + Internals.getMethodBindPtr("CSGShape3D", "get_snap", 1740695150) + + internal val setUseCollisionPtr: VoidPtr = + Internals.getMethodBindPtr("CSGShape3D", "set_use_collision", 2586408642) + + internal val isUsingCollisionPtr: VoidPtr = + Internals.getMethodBindPtr("CSGShape3D", "is_using_collision", 36873697) + + internal val setCollisionLayerPtr: VoidPtr = + Internals.getMethodBindPtr("CSGShape3D", "set_collision_layer", 1286410249) + + internal val getCollisionLayerPtr: VoidPtr = + Internals.getMethodBindPtr("CSGShape3D", "get_collision_layer", 3905245786) + + internal val setCollisionMaskPtr: VoidPtr = + Internals.getMethodBindPtr("CSGShape3D", "set_collision_mask", 1286410249) + + internal val getCollisionMaskPtr: VoidPtr = + Internals.getMethodBindPtr("CSGShape3D", "get_collision_mask", 3905245786) + + internal val setCollisionMaskValuePtr: VoidPtr = + Internals.getMethodBindPtr("CSGShape3D", "set_collision_mask_value", 300928843) + + internal val getCollisionMaskValuePtr: VoidPtr = + Internals.getMethodBindPtr("CSGShape3D", "get_collision_mask_value", 1116898809) + + internal val setCollisionLayerValuePtr: VoidPtr = + Internals.getMethodBindPtr("CSGShape3D", "set_collision_layer_value", 300928843) + + internal val getCollisionLayerValuePtr: VoidPtr = + Internals.getMethodBindPtr("CSGShape3D", "get_collision_layer_value", 1116898809) + + internal val setCollisionPriorityPtr: VoidPtr = + Internals.getMethodBindPtr("CSGShape3D", "set_collision_priority", 373806689) + + internal val getCollisionPriorityPtr: VoidPtr = + Internals.getMethodBindPtr("CSGShape3D", "get_collision_priority", 1740695150) + + internal val setCalculateTangentsPtr: VoidPtr = + Internals.getMethodBindPtr("CSGShape3D", "set_calculate_tangents", 2586408642) + + internal val isCalculatingTangentsPtr: VoidPtr = + Internals.getMethodBindPtr("CSGShape3D", "is_calculating_tangents", 36873697) + + internal val getMeshesPtr: VoidPtr = + Internals.getMethodBindPtr("CSGShape3D", "get_meshes", 3995934104) + } +} diff --git a/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/CSGSphere3D.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/CSGSphere3D.kt new file mode 100644 index 0000000000..1e83ecf668 --- /dev/null +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/CSGSphere3D.kt @@ -0,0 +1,185 @@ +// THIS FILE IS GENERATED! DO NOT EDIT IT MANUALLY! +@file:Suppress("PackageDirectoryMismatch", "unused", "FunctionName", "RedundantModalityModifier", + "UNCHECKED_CAST", "JoinDeclarationAndAssignment", "USELESS_CAST", + "RemoveRedundantQualifierName", "NOTHING_TO_INLINE", "NON_FINAL_MEMBER_IN_OBJECT", + "RedundantVisibilityModifier", "RedundantUnitReturnType", "MemberVisibilityCanBePrivate") + +package godot + +import godot.`annotation`.GodotBaseType +import godot.core.VariantParser.BOOL +import godot.core.VariantParser.DOUBLE +import godot.core.VariantParser.LONG +import godot.core.VariantParser.NIL +import godot.core.VariantParser.OBJECT +import godot.util.Internals +import godot.util.VoidPtr +import kotlin.Boolean +import kotlin.Double +import kotlin.Float +import kotlin.Int +import kotlin.Long +import kotlin.Suppress +import kotlin.Unit +import kotlin.jvm.JvmName + +private const val ENGINE_CLASS_CSGSPHERE3D_INDEX: Int = 158 + +/** + * This node allows you to create a sphere for use with the CSG system. + * **Note:** CSG nodes are intended to be used for level prototyping. Creating CSG nodes has a + * significant CPU cost compared to creating a [MeshInstance3D] with a [PrimitiveMesh]. Moving a CSG + * node within another CSG node also has a significant CPU cost, so it should be avoided during + * gameplay. + */ +@GodotBaseType +public open class CSGSphere3D : CSGPrimitive3D() { + /** + * Radius of the sphere. + */ + public final inline var radius: Float + @JvmName("radiusProperty") + get() = getRadius() + @JvmName("radiusProperty") + set(`value`) { + setRadius(value) + } + + /** + * Number of vertical slices for the sphere. + */ + public final inline var radialSegments: Int + @JvmName("radialSegmentsProperty") + get() = getRadialSegments() + @JvmName("radialSegmentsProperty") + set(`value`) { + setRadialSegments(value) + } + + /** + * Number of horizontal slices for the sphere. + */ + public final inline var rings: Int + @JvmName("ringsProperty") + get() = getRings() + @JvmName("ringsProperty") + set(`value`) { + setRings(value) + } + + /** + * If `true` the normals of the sphere are set to give a smooth effect making the sphere seem + * rounded. If `false` the sphere will have a flat shaded look. + */ + public final inline var smoothFaces: Boolean + @JvmName("smoothFacesProperty") + get() = getSmoothFaces() + @JvmName("smoothFacesProperty") + set(`value`) { + setSmoothFaces(value) + } + + /** + * The material used to render the sphere. + */ + public final inline var material: Material? + @JvmName("materialProperty") + get() = getMaterial() + @JvmName("materialProperty") + set(`value`) { + setMaterial(value) + } + + public override fun new(scriptIndex: Int): Unit { + Internals.callConstructor(this, ENGINE_CLASS_CSGSPHERE3D_INDEX, scriptIndex) + } + + public final fun setRadius(radius: Float): Unit { + Internals.writeArguments(DOUBLE to radius.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setRadiusPtr, NIL) + } + + public final fun getRadius(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getRadiusPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setRadialSegments(radialSegments: Int): Unit { + Internals.writeArguments(LONG to radialSegments.toLong()) + Internals.callMethod(rawPtr, MethodBindings.setRadialSegmentsPtr, NIL) + } + + public final fun getRadialSegments(): Int { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getRadialSegmentsPtr, LONG) + return (Internals.readReturnValue(LONG) as Long).toInt() + } + + public final fun setRings(rings: Int): Unit { + Internals.writeArguments(LONG to rings.toLong()) + Internals.callMethod(rawPtr, MethodBindings.setRingsPtr, NIL) + } + + public final fun getRings(): Int { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getRingsPtr, LONG) + return (Internals.readReturnValue(LONG) as Long).toInt() + } + + public final fun setSmoothFaces(smoothFaces: Boolean): Unit { + Internals.writeArguments(BOOL to smoothFaces) + Internals.callMethod(rawPtr, MethodBindings.setSmoothFacesPtr, NIL) + } + + public final fun getSmoothFaces(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getSmoothFacesPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public final fun setMaterial(material: Material?): Unit { + Internals.writeArguments(OBJECT to material) + Internals.callMethod(rawPtr, MethodBindings.setMaterialPtr, NIL) + } + + public final fun getMaterial(): Material? { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getMaterialPtr, OBJECT) + return (Internals.readReturnValue(OBJECT) as Material?) + } + + public companion object + + public object MethodBindings { + internal val setRadiusPtr: VoidPtr = + Internals.getMethodBindPtr("CSGSphere3D", "set_radius", 373806689) + + internal val getRadiusPtr: VoidPtr = + Internals.getMethodBindPtr("CSGSphere3D", "get_radius", 1740695150) + + internal val setRadialSegmentsPtr: VoidPtr = + Internals.getMethodBindPtr("CSGSphere3D", "set_radial_segments", 1286410249) + + internal val getRadialSegmentsPtr: VoidPtr = + Internals.getMethodBindPtr("CSGSphere3D", "get_radial_segments", 3905245786) + + internal val setRingsPtr: VoidPtr = + Internals.getMethodBindPtr("CSGSphere3D", "set_rings", 1286410249) + + internal val getRingsPtr: VoidPtr = + Internals.getMethodBindPtr("CSGSphere3D", "get_rings", 3905245786) + + internal val setSmoothFacesPtr: VoidPtr = + Internals.getMethodBindPtr("CSGSphere3D", "set_smooth_faces", 2586408642) + + internal val getSmoothFacesPtr: VoidPtr = + Internals.getMethodBindPtr("CSGSphere3D", "get_smooth_faces", 36873697) + + internal val setMaterialPtr: VoidPtr = + Internals.getMethodBindPtr("CSGSphere3D", "set_material", 2757459619) + + internal val getMaterialPtr: VoidPtr = + Internals.getMethodBindPtr("CSGSphere3D", "get_material", 5934680) + } +} diff --git a/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/CSGTorus3D.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/CSGTorus3D.kt new file mode 100644 index 0000000000..fa9110fba0 --- /dev/null +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/CSGTorus3D.kt @@ -0,0 +1,213 @@ +// THIS FILE IS GENERATED! DO NOT EDIT IT MANUALLY! +@file:Suppress("PackageDirectoryMismatch", "unused", "FunctionName", "RedundantModalityModifier", + "UNCHECKED_CAST", "JoinDeclarationAndAssignment", "USELESS_CAST", + "RemoveRedundantQualifierName", "NOTHING_TO_INLINE", "NON_FINAL_MEMBER_IN_OBJECT", + "RedundantVisibilityModifier", "RedundantUnitReturnType", "MemberVisibilityCanBePrivate") + +package godot + +import godot.`annotation`.GodotBaseType +import godot.core.VariantParser.BOOL +import godot.core.VariantParser.DOUBLE +import godot.core.VariantParser.LONG +import godot.core.VariantParser.NIL +import godot.core.VariantParser.OBJECT +import godot.util.Internals +import godot.util.VoidPtr +import kotlin.Boolean +import kotlin.Double +import kotlin.Float +import kotlin.Int +import kotlin.Long +import kotlin.Suppress +import kotlin.Unit +import kotlin.jvm.JvmName + +private const val ENGINE_CLASS_CSGTORUS3D_INDEX: Int = 159 + +/** + * This node allows you to create a torus for use with the CSG system. + * **Note:** CSG nodes are intended to be used for level prototyping. Creating CSG nodes has a + * significant CPU cost compared to creating a [MeshInstance3D] with a [PrimitiveMesh]. Moving a CSG + * node within another CSG node also has a significant CPU cost, so it should be avoided during + * gameplay. + */ +@GodotBaseType +public open class CSGTorus3D : CSGPrimitive3D() { + /** + * The inner radius of the torus. + */ + public final inline var innerRadius: Float + @JvmName("innerRadiusProperty") + get() = getInnerRadius() + @JvmName("innerRadiusProperty") + set(`value`) { + setInnerRadius(value) + } + + /** + * The outer radius of the torus. + */ + public final inline var outerRadius: Float + @JvmName("outerRadiusProperty") + get() = getOuterRadius() + @JvmName("outerRadiusProperty") + set(`value`) { + setOuterRadius(value) + } + + /** + * The number of slices the torus is constructed of. + */ + public final inline var sides: Int + @JvmName("sidesProperty") + get() = getSides() + @JvmName("sidesProperty") + set(`value`) { + setSides(value) + } + + /** + * The number of edges each ring of the torus is constructed of. + */ + public final inline var ringSides: Int + @JvmName("ringSidesProperty") + get() = getRingSides() + @JvmName("ringSidesProperty") + set(`value`) { + setRingSides(value) + } + + /** + * If `true` the normals of the torus are set to give a smooth effect making the torus seem + * rounded. If `false` the torus will have a flat shaded look. + */ + public final inline var smoothFaces: Boolean + @JvmName("smoothFacesProperty") + get() = getSmoothFaces() + @JvmName("smoothFacesProperty") + set(`value`) { + setSmoothFaces(value) + } + + /** + * The material used to render the torus. + */ + public final inline var material: Material? + @JvmName("materialProperty") + get() = getMaterial() + @JvmName("materialProperty") + set(`value`) { + setMaterial(value) + } + + public override fun new(scriptIndex: Int): Unit { + Internals.callConstructor(this, ENGINE_CLASS_CSGTORUS3D_INDEX, scriptIndex) + } + + public final fun setInnerRadius(radius: Float): Unit { + Internals.writeArguments(DOUBLE to radius.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setInnerRadiusPtr, NIL) + } + + public final fun getInnerRadius(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getInnerRadiusPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setOuterRadius(radius: Float): Unit { + Internals.writeArguments(DOUBLE to radius.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setOuterRadiusPtr, NIL) + } + + public final fun getOuterRadius(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getOuterRadiusPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setSides(sides: Int): Unit { + Internals.writeArguments(LONG to sides.toLong()) + Internals.callMethod(rawPtr, MethodBindings.setSidesPtr, NIL) + } + + public final fun getSides(): Int { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getSidesPtr, LONG) + return (Internals.readReturnValue(LONG) as Long).toInt() + } + + public final fun setRingSides(sides: Int): Unit { + Internals.writeArguments(LONG to sides.toLong()) + Internals.callMethod(rawPtr, MethodBindings.setRingSidesPtr, NIL) + } + + public final fun getRingSides(): Int { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getRingSidesPtr, LONG) + return (Internals.readReturnValue(LONG) as Long).toInt() + } + + public final fun setMaterial(material: Material?): Unit { + Internals.writeArguments(OBJECT to material) + Internals.callMethod(rawPtr, MethodBindings.setMaterialPtr, NIL) + } + + public final fun getMaterial(): Material? { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getMaterialPtr, OBJECT) + return (Internals.readReturnValue(OBJECT) as Material?) + } + + public final fun setSmoothFaces(smoothFaces: Boolean): Unit { + Internals.writeArguments(BOOL to smoothFaces) + Internals.callMethod(rawPtr, MethodBindings.setSmoothFacesPtr, NIL) + } + + public final fun getSmoothFaces(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getSmoothFacesPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public companion object + + public object MethodBindings { + internal val setInnerRadiusPtr: VoidPtr = + Internals.getMethodBindPtr("CSGTorus3D", "set_inner_radius", 373806689) + + internal val getInnerRadiusPtr: VoidPtr = + Internals.getMethodBindPtr("CSGTorus3D", "get_inner_radius", 1740695150) + + internal val setOuterRadiusPtr: VoidPtr = + Internals.getMethodBindPtr("CSGTorus3D", "set_outer_radius", 373806689) + + internal val getOuterRadiusPtr: VoidPtr = + Internals.getMethodBindPtr("CSGTorus3D", "get_outer_radius", 1740695150) + + internal val setSidesPtr: VoidPtr = + Internals.getMethodBindPtr("CSGTorus3D", "set_sides", 1286410249) + + internal val getSidesPtr: VoidPtr = + Internals.getMethodBindPtr("CSGTorus3D", "get_sides", 3905245786) + + internal val setRingSidesPtr: VoidPtr = + Internals.getMethodBindPtr("CSGTorus3D", "set_ring_sides", 1286410249) + + internal val getRingSidesPtr: VoidPtr = + Internals.getMethodBindPtr("CSGTorus3D", "get_ring_sides", 3905245786) + + internal val setMaterialPtr: VoidPtr = + Internals.getMethodBindPtr("CSGTorus3D", "set_material", 2757459619) + + internal val getMaterialPtr: VoidPtr = + Internals.getMethodBindPtr("CSGTorus3D", "get_material", 5934680) + + internal val setSmoothFacesPtr: VoidPtr = + Internals.getMethodBindPtr("CSGTorus3D", "set_smooth_faces", 2586408642) + + internal val getSmoothFacesPtr: VoidPtr = + Internals.getMethodBindPtr("CSGTorus3D", "get_smooth_faces", 36873697) + } +} diff --git a/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/CallbackTweener.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/CallbackTweener.kt new file mode 100644 index 0000000000..f3ed45bb32 --- /dev/null +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/CallbackTweener.kt @@ -0,0 +1,54 @@ +// THIS FILE IS GENERATED! DO NOT EDIT IT MANUALLY! +@file:Suppress("PackageDirectoryMismatch", "unused", "FunctionName", "RedundantModalityModifier", + "UNCHECKED_CAST", "JoinDeclarationAndAssignment", "USELESS_CAST", + "RemoveRedundantQualifierName", "NOTHING_TO_INLINE", "NON_FINAL_MEMBER_IN_OBJECT", + "RedundantVisibilityModifier", "RedundantUnitReturnType", "MemberVisibilityCanBePrivate") + +package godot + +import godot.`annotation`.GodotBaseType +import godot.core.VariantParser.DOUBLE +import godot.core.VariantParser.OBJECT +import godot.util.Internals +import godot.util.VoidPtr +import kotlin.Double +import kotlin.Int +import kotlin.Suppress +import kotlin.Unit + +private const val ENGINE_CLASS_CALLBACKTWEENER_INDEX: Int = 160 + +/** + * [CallbackTweener] is used to call a method in a tweening sequence. See [Tween.tweenCallback] for + * more usage information. + * The tweener will finish automatically if the callback's target object is freed. + * **Note:** [Tween.tweenCallback] is the only correct way to create [CallbackTweener]. Any + * [CallbackTweener] created manually will not function correctly. + */ +@GodotBaseType +public open class CallbackTweener : Tweener() { + public override fun new(scriptIndex: Int): Unit { + Internals.callConstructor(this, ENGINE_CLASS_CALLBACKTWEENER_INDEX, scriptIndex) + } + + /** + * Makes the callback call delayed by given time in seconds. + * **Example:** + * [codeblock] + * var tween = get_tree().create_tween() + * tween.tween_callback(queue_free).set_delay(2) #this will call queue_free() after 2 seconds + * [/codeblock] + */ + public final fun setDelay(delay: Double): CallbackTweener? { + Internals.writeArguments(DOUBLE to delay) + Internals.callMethod(rawPtr, MethodBindings.setDelayPtr, OBJECT) + return (Internals.readReturnValue(OBJECT) as CallbackTweener?) + } + + public companion object + + public object MethodBindings { + internal val setDelayPtr: VoidPtr = + Internals.getMethodBindPtr("CallbackTweener", "set_delay", 3008182292) + } +} diff --git a/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/Camera2D.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/Camera2D.kt new file mode 100644 index 0000000000..4ce65a425a --- /dev/null +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/Camera2D.kt @@ -0,0 +1,959 @@ +// THIS FILE IS GENERATED! DO NOT EDIT IT MANUALLY! +@file:Suppress("PackageDirectoryMismatch", "unused", "FunctionName", "RedundantModalityModifier", + "UNCHECKED_CAST", "JoinDeclarationAndAssignment", "USELESS_CAST", + "RemoveRedundantQualifierName", "NOTHING_TO_INLINE", "NON_FINAL_MEMBER_IN_OBJECT", + "RedundantVisibilityModifier", "RedundantUnitReturnType", "MemberVisibilityCanBePrivate") + +package godot + +import godot.`annotation`.CoreTypeHelper +import godot.`annotation`.CoreTypeLocalCopy +import godot.`annotation`.GodotBaseType +import godot.core.VariantParser.BOOL +import godot.core.VariantParser.DOUBLE +import godot.core.VariantParser.LONG +import godot.core.VariantParser.NIL +import godot.core.VariantParser.OBJECT +import godot.core.VariantParser.VECTOR2 +import godot.core.Vector2 +import godot.util.Internals +import godot.util.VoidPtr +import kotlin.Boolean +import kotlin.Double +import kotlin.Float +import kotlin.Int +import kotlin.Long +import kotlin.Suppress +import kotlin.Unit +import kotlin.jvm.JvmName + +private const val ENGINE_CLASS_CAMERA2D_INDEX: Int = 161 + +/** + * Camera node for 2D scenes. It forces the screen (current layer) to scroll following this node. + * This makes it easier (and faster) to program scrollable scenes than manually changing the position + * of [CanvasItem]-based nodes. + * Cameras register themselves in the nearest [Viewport] node (when ascending the tree). Only one + * camera can be active per viewport. If no viewport is available ascending the tree, the camera will + * register in the global viewport. + * This node is intended to be a simple helper to get things going quickly, but more functionality + * may be desired to change how the camera works. To make your own custom camera node, inherit it from + * [Node2D] and change the transform of the canvas by setting [Viewport.canvasTransform] in [Viewport] + * (you can obtain the current [Viewport] by using [Node.getViewport]). + * Note that the [Camera2D] node's `position` doesn't represent the actual position of the screen, + * which may differ due to applied smoothing or limits. You can use [getScreenCenterPosition] to get + * the real position. + */ +@GodotBaseType +public open class Camera2D : Node2D() { + /** + * The camera's relative offset. Useful for looking around or camera shake animations. The + * offsetted camera can go past the limits defined in [limitTop], [limitBottom], [limitLeft] and + * [limitRight]. + */ + @CoreTypeLocalCopy + public final inline var offset: Vector2 + @JvmName("offsetProperty") + get() = getOffset() + @JvmName("offsetProperty") + set(`value`) { + setOffset(value) + } + + /** + * The Camera2D's anchor point. See [AnchorMode] constants. + */ + public final inline var anchorMode: AnchorMode + @JvmName("anchorModeProperty") + get() = getAnchorMode() + @JvmName("anchorModeProperty") + set(`value`) { + setAnchorMode(value) + } + + /** + * If `true`, the camera's rendered view is not affected by its [Node2D.rotation] and + * [Node2D.globalRotation]. + */ + public final inline var ignoreRotation: Boolean + @JvmName("ignoreRotationProperty") + get() = isIgnoringRotation() + @JvmName("ignoreRotationProperty") + set(`value`) { + setIgnoreRotation(value) + } + + /** + * Controls whether the camera can be active or not. If `true`, the [Camera2D] will become the + * main camera when it enters the scene tree and there is no active camera currently (see + * [Viewport.getCamera2d]). + * When the camera is currently active and [enabled] is set to `false`, the next enabled + * [Camera2D] in the scene tree will become active. + */ + public final inline var enabled: Boolean + @JvmName("enabledProperty") + get() = isEnabled() + @JvmName("enabledProperty") + set(`value`) { + setEnabled(value) + } + + /** + * The camera's zoom. A zoom of `Vector(2, 2)` doubles the size seen in the viewport. A zoom of + * `Vector(0.5, 0.5)` halves the size seen in the viewport. + * **Note:** [FontFile.oversampling] does *not* take [Camera2D] zoom into account. This means that + * zooming in/out will cause bitmap fonts and rasterized (non-MSDF) dynamic fonts to appear blurry or + * pixelated unless the font is part of a [CanvasLayer] that makes it ignore camera zoom. To ensure + * text remains crisp regardless of zoom, you can enable MSDF font rendering by enabling + * [ProjectSettings.gui/theme/defaultFontMultichannelSignedDistanceField] (applies to the default + * project font only), or enabling **Multichannel Signed Distance Field** in the import options of a + * DynamicFont for custom fonts. On system fonts, [SystemFont.multichannelSignedDistanceField] can be + * enabled in the inspector. + */ + @CoreTypeLocalCopy + public final inline var zoom: Vector2 + @JvmName("zoomProperty") + get() = getZoom() + @JvmName("zoomProperty") + set(`value`) { + setZoom(value) + } + + /** + * The custom [Viewport] node attached to the [Camera2D]. If `null` or not a [Viewport], uses the + * default viewport instead. + */ + public final inline var customViewport: Node? + @JvmName("customViewportProperty") + get() = getCustomViewport() + @JvmName("customViewportProperty") + set(`value`) { + setCustomViewport(value) + } + + /** + * The camera's process callback. See [Camera2DProcessCallback]. + */ + public final inline var processCallback: Camera2DProcessCallback + @JvmName("processCallbackProperty") + get() = getProcessCallback() + @JvmName("processCallbackProperty") + set(`value`) { + setProcessCallback(value) + } + + /** + * Left scroll limit in pixels. The camera stops moving when reaching this value, but [offset] can + * push the view past the limit. + */ + public final inline var limitLeft: Int + @JvmName("limitLeftProperty") + get() = getLimit(Side.SIDE_LEFT) + @JvmName("limitLeftProperty") + set(`value`) { + setLimit(Side.SIDE_LEFT, value) + } + + /** + * Top scroll limit in pixels. The camera stops moving when reaching this value, but [offset] can + * push the view past the limit. + */ + public final inline var limitTop: Int + @JvmName("limitTopProperty") + get() = getLimit(Side.SIDE_TOP) + @JvmName("limitTopProperty") + set(`value`) { + setLimit(Side.SIDE_TOP, value) + } + + /** + * Right scroll limit in pixels. The camera stops moving when reaching this value, but [offset] + * can push the view past the limit. + */ + public final inline var limitRight: Int + @JvmName("limitRightProperty") + get() = getLimit(Side.SIDE_RIGHT) + @JvmName("limitRightProperty") + set(`value`) { + setLimit(Side.SIDE_RIGHT, value) + } + + /** + * Bottom scroll limit in pixels. The camera stops moving when reaching this value, but [offset] + * can push the view past the limit. + */ + public final inline var limitBottom: Int + @JvmName("limitBottomProperty") + get() = getLimit(Side.SIDE_BOTTOM) + @JvmName("limitBottomProperty") + set(`value`) { + setLimit(Side.SIDE_BOTTOM, value) + } + + /** + * If `true`, the camera smoothly stops when reaches its limits. + * This property has no effect if [positionSmoothingEnabled] is `false`. + * **Note:** To immediately update the camera's position to be within limits without smoothing, + * even with this setting enabled, invoke [resetSmoothing]. + */ + public final inline var limitSmoothed: Boolean + @JvmName("limitSmoothedProperty") + get() = isLimitSmoothingEnabled() + @JvmName("limitSmoothedProperty") + set(`value`) { + setLimitSmoothingEnabled(value) + } + + /** + * If `true`, the camera's view smoothly moves towards its target position at + * [positionSmoothingSpeed]. + */ + public final inline var positionSmoothingEnabled: Boolean + @JvmName("positionSmoothingEnabledProperty") + get() = isPositionSmoothingEnabled() + @JvmName("positionSmoothingEnabledProperty") + set(`value`) { + setPositionSmoothingEnabled(value) + } + + /** + * Speed in pixels per second of the camera's smoothing effect when [positionSmoothingEnabled] is + * `true`. + */ + public final inline var positionSmoothingSpeed: Float + @JvmName("positionSmoothingSpeedProperty") + get() = getPositionSmoothingSpeed() + @JvmName("positionSmoothingSpeedProperty") + set(`value`) { + setPositionSmoothingSpeed(value) + } + + /** + * If `true`, the camera's view smoothly rotates, via asymptotic smoothing, to align with its + * target rotation at [rotationSmoothingSpeed]. + * **Note:** This property has no effect if [ignoreRotation] is `true`. + */ + public final inline var rotationSmoothingEnabled: Boolean + @JvmName("rotationSmoothingEnabledProperty") + get() = isRotationSmoothingEnabled() + @JvmName("rotationSmoothingEnabledProperty") + set(`value`) { + setRotationSmoothingEnabled(value) + } + + /** + * The angular, asymptotic speed of the camera's rotation smoothing effect when + * [rotationSmoothingEnabled] is `true`. + */ + public final inline var rotationSmoothingSpeed: Float + @JvmName("rotationSmoothingSpeedProperty") + get() = getRotationSmoothingSpeed() + @JvmName("rotationSmoothingSpeedProperty") + set(`value`) { + setRotationSmoothingSpeed(value) + } + + /** + * If `true`, the camera only moves when reaching the horizontal (left and right) drag margins. If + * `false`, the camera moves horizontally regardless of margins. + */ + public final inline var dragHorizontalEnabled: Boolean + @JvmName("dragHorizontalEnabledProperty") + get() = isDragHorizontalEnabled() + @JvmName("dragHorizontalEnabledProperty") + set(`value`) { + setDragHorizontalEnabled(value) + } + + /** + * If `true`, the camera only moves when reaching the vertical (top and bottom) drag margins. If + * `false`, the camera moves vertically regardless of the drag margins. + */ + public final inline var dragVerticalEnabled: Boolean + @JvmName("dragVerticalEnabledProperty") + get() = isDragVerticalEnabled() + @JvmName("dragVerticalEnabledProperty") + set(`value`) { + setDragVerticalEnabled(value) + } + + /** + * The relative horizontal drag offset of the camera between the right (`-1`) and left (`1`) drag + * margins. + * **Note:** Used to set the initial horizontal drag offset; determine the current offset; or + * force the current offset. It's not automatically updated when [dragHorizontalEnabled] is `true` or + * the drag margins are changed. + */ + public final inline var dragHorizontalOffset: Float + @JvmName("dragHorizontalOffsetProperty") + get() = getDragHorizontalOffset() + @JvmName("dragHorizontalOffsetProperty") + set(`value`) { + setDragHorizontalOffset(value) + } + + /** + * The relative vertical drag offset of the camera between the bottom (`-1`) and top (`1`) drag + * margins. + * **Note:** Used to set the initial vertical drag offset; determine the current offset; or force + * the current offset. It's not automatically updated when [dragVerticalEnabled] is `true` or the + * drag margins are changed. + */ + public final inline var dragVerticalOffset: Float + @JvmName("dragVerticalOffsetProperty") + get() = getDragVerticalOffset() + @JvmName("dragVerticalOffsetProperty") + set(`value`) { + setDragVerticalOffset(value) + } + + /** + * Left margin needed to drag the camera. A value of `1` makes the camera move only when reaching + * the left edge of the screen. + */ + public final inline var dragLeftMargin: Float + @JvmName("dragLeftMarginProperty") + get() = getDragMargin(Side.SIDE_LEFT) + @JvmName("dragLeftMarginProperty") + set(`value`) { + setDragMargin(Side.SIDE_LEFT, value) + } + + /** + * Top margin needed to drag the camera. A value of `1` makes the camera move only when reaching + * the top edge of the screen. + */ + public final inline var dragTopMargin: Float + @JvmName("dragTopMarginProperty") + get() = getDragMargin(Side.SIDE_TOP) + @JvmName("dragTopMarginProperty") + set(`value`) { + setDragMargin(Side.SIDE_TOP, value) + } + + /** + * Right margin needed to drag the camera. A value of `1` makes the camera move only when reaching + * the right edge of the screen. + */ + public final inline var dragRightMargin: Float + @JvmName("dragRightMarginProperty") + get() = getDragMargin(Side.SIDE_RIGHT) + @JvmName("dragRightMarginProperty") + set(`value`) { + setDragMargin(Side.SIDE_RIGHT, value) + } + + /** + * Bottom margin needed to drag the camera. A value of `1` makes the camera move only when + * reaching the bottom edge of the screen. + */ + public final inline var dragBottomMargin: Float + @JvmName("dragBottomMarginProperty") + get() = getDragMargin(Side.SIDE_BOTTOM) + @JvmName("dragBottomMarginProperty") + set(`value`) { + setDragMargin(Side.SIDE_BOTTOM, value) + } + + /** + * If `true`, draws the camera's screen rectangle in the editor. + */ + public final inline var editorDrawScreen: Boolean + @JvmName("editorDrawScreenProperty") + get() = isScreenDrawingEnabled() + @JvmName("editorDrawScreenProperty") + set(`value`) { + setScreenDrawingEnabled(value) + } + + /** + * If `true`, draws the camera's limits rectangle in the editor. + */ + public final inline var editorDrawLimits: Boolean + @JvmName("editorDrawLimitsProperty") + get() = isLimitDrawingEnabled() + @JvmName("editorDrawLimitsProperty") + set(`value`) { + setLimitDrawingEnabled(value) + } + + /** + * If `true`, draws the camera's drag margin rectangle in the editor. + */ + public final inline var editorDrawDragMargin: Boolean + @JvmName("editorDrawDragMarginProperty") + get() = isMarginDrawingEnabled() + @JvmName("editorDrawDragMarginProperty") + set(`value`) { + setMarginDrawingEnabled(value) + } + + public override fun new(scriptIndex: Int): Unit { + Internals.callConstructor(this, ENGINE_CLASS_CAMERA2D_INDEX, scriptIndex) + } + + /** + * The camera's relative offset. Useful for looking around or camera shake animations. The + * offsetted camera can go past the limits defined in [limitTop], [limitBottom], [limitLeft] and + * [limitRight]. + * + * This is a helper function to make dealing with local copies easier. + * + * For more information, see our + * [documentation](https://godot-kotl.in/en/stable/user-guide/api-differences/#core-types). + * + * Allow to directly modify the local copy of the property and assign it back to the Object. + * + * Prefer that over writing: + * `````` + * val myCoreType = camera2d.offset + * //Your changes + * camera2d.offset = myCoreType + * `````` + */ + @CoreTypeHelper + public final fun offsetMutate(block: Vector2.() -> Unit): Vector2 = offset.apply{ + block(this) + offset = this + } + + + /** + * The camera's zoom. A zoom of `Vector(2, 2)` doubles the size seen in the viewport. A zoom of + * `Vector(0.5, 0.5)` halves the size seen in the viewport. + * **Note:** [FontFile.oversampling] does *not* take [Camera2D] zoom into account. This means that + * zooming in/out will cause bitmap fonts and rasterized (non-MSDF) dynamic fonts to appear blurry or + * pixelated unless the font is part of a [CanvasLayer] that makes it ignore camera zoom. To ensure + * text remains crisp regardless of zoom, you can enable MSDF font rendering by enabling + * [ProjectSettings.gui/theme/defaultFontMultichannelSignedDistanceField] (applies to the default + * project font only), or enabling **Multichannel Signed Distance Field** in the import options of a + * DynamicFont for custom fonts. On system fonts, [SystemFont.multichannelSignedDistanceField] can be + * enabled in the inspector. + * + * This is a helper function to make dealing with local copies easier. + * + * For more information, see our + * [documentation](https://godot-kotl.in/en/stable/user-guide/api-differences/#core-types). + * + * Allow to directly modify the local copy of the property and assign it back to the Object. + * + * Prefer that over writing: + * `````` + * val myCoreType = camera2d.zoom + * //Your changes + * camera2d.zoom = myCoreType + * `````` + */ + @CoreTypeHelper + public final fun zoomMutate(block: Vector2.() -> Unit): Vector2 = zoom.apply{ + block(this) + zoom = this + } + + + public final fun setOffset(offset: Vector2): Unit { + Internals.writeArguments(VECTOR2 to offset) + Internals.callMethod(rawPtr, MethodBindings.setOffsetPtr, NIL) + } + + public final fun getOffset(): Vector2 { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getOffsetPtr, VECTOR2) + return (Internals.readReturnValue(VECTOR2) as Vector2) + } + + public final fun setAnchorMode(anchorMode: AnchorMode): Unit { + Internals.writeArguments(LONG to anchorMode.id) + Internals.callMethod(rawPtr, MethodBindings.setAnchorModePtr, NIL) + } + + public final fun getAnchorMode(): AnchorMode { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getAnchorModePtr, LONG) + return Camera2D.AnchorMode.from(Internals.readReturnValue(LONG) as Long) + } + + public final fun setIgnoreRotation(ignore: Boolean): Unit { + Internals.writeArguments(BOOL to ignore) + Internals.callMethod(rawPtr, MethodBindings.setIgnoreRotationPtr, NIL) + } + + public final fun isIgnoringRotation(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isIgnoringRotationPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public final fun setProcessCallback(mode: Camera2DProcessCallback): Unit { + Internals.writeArguments(LONG to mode.id) + Internals.callMethod(rawPtr, MethodBindings.setProcessCallbackPtr, NIL) + } + + public final fun getProcessCallback(): Camera2DProcessCallback { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getProcessCallbackPtr, LONG) + return Camera2D.Camera2DProcessCallback.from(Internals.readReturnValue(LONG) as Long) + } + + public final fun setEnabled(enabled: Boolean): Unit { + Internals.writeArguments(BOOL to enabled) + Internals.callMethod(rawPtr, MethodBindings.setEnabledPtr, NIL) + } + + public final fun isEnabled(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isEnabledPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + /** + * Forces this [Camera2D] to become the current active one. [enabled] must be `true`. + */ + public final fun makeCurrent(): Unit { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.makeCurrentPtr, NIL) + } + + /** + * Returns `true` if this [Camera2D] is the active camera (see [Viewport.getCamera2d]). + */ + public final fun isCurrent(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isCurrentPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + /** + * Sets the camera limit for the specified [Side]. See also [limitBottom], [limitTop], + * [limitLeft], and [limitRight]. + */ + public final fun setLimit(margin: Side, limit: Int): Unit { + Internals.writeArguments(LONG to margin.id, LONG to limit.toLong()) + Internals.callMethod(rawPtr, MethodBindings.setLimitPtr, NIL) + } + + /** + * Returns the camera limit for the specified [Side]. See also [limitBottom], [limitTop], + * [limitLeft], and [limitRight]. + */ + public final fun getLimit(margin: Side): Int { + Internals.writeArguments(LONG to margin.id) + Internals.callMethod(rawPtr, MethodBindings.getLimitPtr, LONG) + return (Internals.readReturnValue(LONG) as Long).toInt() + } + + public final fun setLimitSmoothingEnabled(limitSmoothingEnabled: Boolean): Unit { + Internals.writeArguments(BOOL to limitSmoothingEnabled) + Internals.callMethod(rawPtr, MethodBindings.setLimitSmoothingEnabledPtr, NIL) + } + + public final fun isLimitSmoothingEnabled(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isLimitSmoothingEnabledPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public final fun setDragVerticalEnabled(enabled: Boolean): Unit { + Internals.writeArguments(BOOL to enabled) + Internals.callMethod(rawPtr, MethodBindings.setDragVerticalEnabledPtr, NIL) + } + + public final fun isDragVerticalEnabled(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isDragVerticalEnabledPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public final fun setDragHorizontalEnabled(enabled: Boolean): Unit { + Internals.writeArguments(BOOL to enabled) + Internals.callMethod(rawPtr, MethodBindings.setDragHorizontalEnabledPtr, NIL) + } + + public final fun isDragHorizontalEnabled(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isDragHorizontalEnabledPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public final fun setDragVerticalOffset(offset: Float): Unit { + Internals.writeArguments(DOUBLE to offset.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setDragVerticalOffsetPtr, NIL) + } + + public final fun getDragVerticalOffset(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getDragVerticalOffsetPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setDragHorizontalOffset(offset: Float): Unit { + Internals.writeArguments(DOUBLE to offset.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setDragHorizontalOffsetPtr, NIL) + } + + public final fun getDragHorizontalOffset(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getDragHorizontalOffsetPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + /** + * Sets the specified [Side]'s margin. See also [dragBottomMargin], [dragTopMargin], + * [dragLeftMargin], and [dragRightMargin]. + */ + public final fun setDragMargin(margin: Side, dragMargin: Float): Unit { + Internals.writeArguments(LONG to margin.id, DOUBLE to dragMargin.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setDragMarginPtr, NIL) + } + + /** + * Returns the specified [Side]'s margin. See also [dragBottomMargin], [dragTopMargin], + * [dragLeftMargin], and [dragRightMargin]. + */ + public final fun getDragMargin(margin: Side): Float { + Internals.writeArguments(LONG to margin.id) + Internals.callMethod(rawPtr, MethodBindings.getDragMarginPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + /** + * Returns this camera's target position, in global coordinates. + * **Note:** The returned value is not the same as [Node2D.globalPosition], as it is affected by + * the drag properties. It is also not the same as the current position if [positionSmoothingEnabled] + * is `true` (see [getScreenCenterPosition]). + */ + public final fun getTargetPosition(): Vector2 { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getTargetPositionPtr, VECTOR2) + return (Internals.readReturnValue(VECTOR2) as Vector2) + } + + /** + * Returns the center of the screen from this camera's point of view, in global coordinates. + * **Note:** The exact targeted position of the camera may be different. See [getTargetPosition]. + */ + public final fun getScreenCenterPosition(): Vector2 { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getScreenCenterPositionPtr, VECTOR2) + return (Internals.readReturnValue(VECTOR2) as Vector2) + } + + public final fun setZoom(zoom: Vector2): Unit { + Internals.writeArguments(VECTOR2 to zoom) + Internals.callMethod(rawPtr, MethodBindings.setZoomPtr, NIL) + } + + public final fun getZoom(): Vector2 { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getZoomPtr, VECTOR2) + return (Internals.readReturnValue(VECTOR2) as Vector2) + } + + public final fun setCustomViewport(viewport: Node?): Unit { + Internals.writeArguments(OBJECT to viewport) + Internals.callMethod(rawPtr, MethodBindings.setCustomViewportPtr, NIL) + } + + public final fun getCustomViewport(): Node? { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getCustomViewportPtr, OBJECT) + return (Internals.readReturnValue(OBJECT) as Node?) + } + + public final fun setPositionSmoothingSpeed(positionSmoothingSpeed: Float): Unit { + Internals.writeArguments(DOUBLE to positionSmoothingSpeed.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setPositionSmoothingSpeedPtr, NIL) + } + + public final fun getPositionSmoothingSpeed(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getPositionSmoothingSpeedPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setPositionSmoothingEnabled(positionSmoothingSpeed: Boolean): Unit { + Internals.writeArguments(BOOL to positionSmoothingSpeed) + Internals.callMethod(rawPtr, MethodBindings.setPositionSmoothingEnabledPtr, NIL) + } + + public final fun isPositionSmoothingEnabled(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isPositionSmoothingEnabledPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public final fun setRotationSmoothingEnabled(enabled: Boolean): Unit { + Internals.writeArguments(BOOL to enabled) + Internals.callMethod(rawPtr, MethodBindings.setRotationSmoothingEnabledPtr, NIL) + } + + public final fun isRotationSmoothingEnabled(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isRotationSmoothingEnabledPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public final fun setRotationSmoothingSpeed(speed: Float): Unit { + Internals.writeArguments(DOUBLE to speed.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setRotationSmoothingSpeedPtr, NIL) + } + + public final fun getRotationSmoothingSpeed(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getRotationSmoothingSpeedPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + /** + * Forces the camera to update scroll immediately. + */ + public final fun forceUpdateScroll(): Unit { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.forceUpdateScrollPtr, NIL) + } + + /** + * Sets the camera's position immediately to its current smoothing destination. + * This method has no effect if [positionSmoothingEnabled] is `false`. + */ + public final fun resetSmoothing(): Unit { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.resetSmoothingPtr, NIL) + } + + /** + * Aligns the camera to the tracked node. + */ + public final fun align(): Unit { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.alignPtr, NIL) + } + + public final fun setScreenDrawingEnabled(screenDrawingEnabled: Boolean): Unit { + Internals.writeArguments(BOOL to screenDrawingEnabled) + Internals.callMethod(rawPtr, MethodBindings.setScreenDrawingEnabledPtr, NIL) + } + + public final fun isScreenDrawingEnabled(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isScreenDrawingEnabledPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public final fun setLimitDrawingEnabled(limitDrawingEnabled: Boolean): Unit { + Internals.writeArguments(BOOL to limitDrawingEnabled) + Internals.callMethod(rawPtr, MethodBindings.setLimitDrawingEnabledPtr, NIL) + } + + public final fun isLimitDrawingEnabled(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isLimitDrawingEnabledPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public final fun setMarginDrawingEnabled(marginDrawingEnabled: Boolean): Unit { + Internals.writeArguments(BOOL to marginDrawingEnabled) + Internals.callMethod(rawPtr, MethodBindings.setMarginDrawingEnabledPtr, NIL) + } + + public final fun isMarginDrawingEnabled(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isMarginDrawingEnabledPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public enum class AnchorMode( + id: Long, + ) { + /** + * The camera's position is fixed so that the top-left corner is always at the origin. + */ + ANCHOR_MODE_FIXED_TOP_LEFT(0), + /** + * The camera's position takes into account vertical/horizontal offsets and the screen size. + */ + ANCHOR_MODE_DRAG_CENTER(1), + ; + + public val id: Long + init { + this.id = id + } + + public companion object { + public fun from(`value`: Long): AnchorMode = entries.single { it.id == `value` } + } + } + + public enum class Camera2DProcessCallback( + id: Long, + ) { + /** + * The camera updates during physics frames (see [Node.NOTIFICATION_INTERNAL_PHYSICS_PROCESS]). + */ + CAMERA2D_PROCESS_PHYSICS(0), + /** + * The camera updates during process frames (see [Node.NOTIFICATION_INTERNAL_PROCESS]). + */ + CAMERA2D_PROCESS_IDLE(1), + ; + + public val id: Long + init { + this.id = id + } + + public companion object { + public fun from(`value`: Long): Camera2DProcessCallback = entries.single { it.id == `value` } + } + } + + public companion object + + public object MethodBindings { + internal val setOffsetPtr: VoidPtr = + Internals.getMethodBindPtr("Camera2D", "set_offset", 743155724) + + internal val getOffsetPtr: VoidPtr = + Internals.getMethodBindPtr("Camera2D", "get_offset", 3341600327) + + internal val setAnchorModePtr: VoidPtr = + Internals.getMethodBindPtr("Camera2D", "set_anchor_mode", 2050398218) + + internal val getAnchorModePtr: VoidPtr = + Internals.getMethodBindPtr("Camera2D", "get_anchor_mode", 155978067) + + internal val setIgnoreRotationPtr: VoidPtr = + Internals.getMethodBindPtr("Camera2D", "set_ignore_rotation", 2586408642) + + internal val isIgnoringRotationPtr: VoidPtr = + Internals.getMethodBindPtr("Camera2D", "is_ignoring_rotation", 36873697) + + internal val setProcessCallbackPtr: VoidPtr = + Internals.getMethodBindPtr("Camera2D", "set_process_callback", 4201947462) + + internal val getProcessCallbackPtr: VoidPtr = + Internals.getMethodBindPtr("Camera2D", "get_process_callback", 2325344499) + + internal val setEnabledPtr: VoidPtr = + Internals.getMethodBindPtr("Camera2D", "set_enabled", 2586408642) + + internal val isEnabledPtr: VoidPtr = + Internals.getMethodBindPtr("Camera2D", "is_enabled", 36873697) + + internal val makeCurrentPtr: VoidPtr = + Internals.getMethodBindPtr("Camera2D", "make_current", 3218959716) + + internal val isCurrentPtr: VoidPtr = + Internals.getMethodBindPtr("Camera2D", "is_current", 36873697) + + internal val setLimitPtr: VoidPtr = + Internals.getMethodBindPtr("Camera2D", "set_limit", 437707142) + + internal val getLimitPtr: VoidPtr = + Internals.getMethodBindPtr("Camera2D", "get_limit", 1983885014) + + internal val setLimitSmoothingEnabledPtr: VoidPtr = + Internals.getMethodBindPtr("Camera2D", "set_limit_smoothing_enabled", 2586408642) + + internal val isLimitSmoothingEnabledPtr: VoidPtr = + Internals.getMethodBindPtr("Camera2D", "is_limit_smoothing_enabled", 36873697) + + internal val setDragVerticalEnabledPtr: VoidPtr = + Internals.getMethodBindPtr("Camera2D", "set_drag_vertical_enabled", 2586408642) + + internal val isDragVerticalEnabledPtr: VoidPtr = + Internals.getMethodBindPtr("Camera2D", "is_drag_vertical_enabled", 36873697) + + internal val setDragHorizontalEnabledPtr: VoidPtr = + Internals.getMethodBindPtr("Camera2D", "set_drag_horizontal_enabled", 2586408642) + + internal val isDragHorizontalEnabledPtr: VoidPtr = + Internals.getMethodBindPtr("Camera2D", "is_drag_horizontal_enabled", 36873697) + + internal val setDragVerticalOffsetPtr: VoidPtr = + Internals.getMethodBindPtr("Camera2D", "set_drag_vertical_offset", 373806689) + + internal val getDragVerticalOffsetPtr: VoidPtr = + Internals.getMethodBindPtr("Camera2D", "get_drag_vertical_offset", 1740695150) + + internal val setDragHorizontalOffsetPtr: VoidPtr = + Internals.getMethodBindPtr("Camera2D", "set_drag_horizontal_offset", 373806689) + + internal val getDragHorizontalOffsetPtr: VoidPtr = + Internals.getMethodBindPtr("Camera2D", "get_drag_horizontal_offset", 1740695150) + + internal val setDragMarginPtr: VoidPtr = + Internals.getMethodBindPtr("Camera2D", "set_drag_margin", 4290182280) + + internal val getDragMarginPtr: VoidPtr = + Internals.getMethodBindPtr("Camera2D", "get_drag_margin", 2869120046) + + internal val getTargetPositionPtr: VoidPtr = + Internals.getMethodBindPtr("Camera2D", "get_target_position", 3341600327) + + internal val getScreenCenterPositionPtr: VoidPtr = + Internals.getMethodBindPtr("Camera2D", "get_screen_center_position", 3341600327) + + internal val setZoomPtr: VoidPtr = Internals.getMethodBindPtr("Camera2D", "set_zoom", 743155724) + + internal val getZoomPtr: VoidPtr = + Internals.getMethodBindPtr("Camera2D", "get_zoom", 3341600327) + + internal val setCustomViewportPtr: VoidPtr = + Internals.getMethodBindPtr("Camera2D", "set_custom_viewport", 1078189570) + + internal val getCustomViewportPtr: VoidPtr = + Internals.getMethodBindPtr("Camera2D", "get_custom_viewport", 3160264692) + + internal val setPositionSmoothingSpeedPtr: VoidPtr = + Internals.getMethodBindPtr("Camera2D", "set_position_smoothing_speed", 373806689) + + internal val getPositionSmoothingSpeedPtr: VoidPtr = + Internals.getMethodBindPtr("Camera2D", "get_position_smoothing_speed", 1740695150) + + internal val setPositionSmoothingEnabledPtr: VoidPtr = + Internals.getMethodBindPtr("Camera2D", "set_position_smoothing_enabled", 2586408642) + + internal val isPositionSmoothingEnabledPtr: VoidPtr = + Internals.getMethodBindPtr("Camera2D", "is_position_smoothing_enabled", 36873697) + + internal val setRotationSmoothingEnabledPtr: VoidPtr = + Internals.getMethodBindPtr("Camera2D", "set_rotation_smoothing_enabled", 2586408642) + + internal val isRotationSmoothingEnabledPtr: VoidPtr = + Internals.getMethodBindPtr("Camera2D", "is_rotation_smoothing_enabled", 36873697) + + internal val setRotationSmoothingSpeedPtr: VoidPtr = + Internals.getMethodBindPtr("Camera2D", "set_rotation_smoothing_speed", 373806689) + + internal val getRotationSmoothingSpeedPtr: VoidPtr = + Internals.getMethodBindPtr("Camera2D", "get_rotation_smoothing_speed", 1740695150) + + internal val forceUpdateScrollPtr: VoidPtr = + Internals.getMethodBindPtr("Camera2D", "force_update_scroll", 3218959716) + + internal val resetSmoothingPtr: VoidPtr = + Internals.getMethodBindPtr("Camera2D", "reset_smoothing", 3218959716) + + internal val alignPtr: VoidPtr = Internals.getMethodBindPtr("Camera2D", "align", 3218959716) + + internal val setScreenDrawingEnabledPtr: VoidPtr = + Internals.getMethodBindPtr("Camera2D", "set_screen_drawing_enabled", 2586408642) + + internal val isScreenDrawingEnabledPtr: VoidPtr = + Internals.getMethodBindPtr("Camera2D", "is_screen_drawing_enabled", 36873697) + + internal val setLimitDrawingEnabledPtr: VoidPtr = + Internals.getMethodBindPtr("Camera2D", "set_limit_drawing_enabled", 2586408642) + + internal val isLimitDrawingEnabledPtr: VoidPtr = + Internals.getMethodBindPtr("Camera2D", "is_limit_drawing_enabled", 36873697) + + internal val setMarginDrawingEnabledPtr: VoidPtr = + Internals.getMethodBindPtr("Camera2D", "set_margin_drawing_enabled", 2586408642) + + internal val isMarginDrawingEnabledPtr: VoidPtr = + Internals.getMethodBindPtr("Camera2D", "is_margin_drawing_enabled", 36873697) + } +} diff --git a/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/Camera3D.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/Camera3D.kt new file mode 100644 index 0000000000..531f5687d6 --- /dev/null +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/Camera3D.kt @@ -0,0 +1,896 @@ +// THIS FILE IS GENERATED! DO NOT EDIT IT MANUALLY! +@file:Suppress("PackageDirectoryMismatch", "unused", "FunctionName", "RedundantModalityModifier", + "UNCHECKED_CAST", "JoinDeclarationAndAssignment", "USELESS_CAST", + "RemoveRedundantQualifierName", "NOTHING_TO_INLINE", "NON_FINAL_MEMBER_IN_OBJECT", + "RedundantVisibilityModifier", "RedundantUnitReturnType", "MemberVisibilityCanBePrivate") + +package godot + +import godot.`annotation`.CoreTypeHelper +import godot.`annotation`.CoreTypeLocalCopy +import godot.`annotation`.GodotBaseType +import godot.core.Plane +import godot.core.Projection +import godot.core.RID +import godot.core.Transform3D +import godot.core.VariantArray +import godot.core.VariantParser.ARRAY +import godot.core.VariantParser.BOOL +import godot.core.VariantParser.DOUBLE +import godot.core.VariantParser.LONG +import godot.core.VariantParser.NIL +import godot.core.VariantParser.OBJECT +import godot.core.VariantParser.PROJECTION +import godot.core.VariantParser.TRANSFORM3D +import godot.core.VariantParser.VECTOR2 +import godot.core.VariantParser.VECTOR3 +import godot.core.VariantParser._RID +import godot.core.Vector2 +import godot.core.Vector3 +import godot.util.Internals +import godot.util.VoidPtr +import kotlin.Boolean +import kotlin.Double +import kotlin.Float +import kotlin.Int +import kotlin.Long +import kotlin.Suppress +import kotlin.Unit +import kotlin.jvm.JvmName +import kotlin.jvm.JvmOverloads + +private const val ENGINE_CLASS_CAMERA3D_INDEX: Int = 162 + +/** + * [Camera3D] is a special node that displays what is visible from its current location. Cameras + * register themselves in the nearest [Viewport] node (when ascending the tree). Only one camera can be + * active per viewport. If no viewport is available ascending the tree, the camera will register in the + * global viewport. In other words, a camera just provides 3D display capabilities to a [Viewport], + * and, without one, a scene registered in that [Viewport] (or higher viewports) can't be displayed. + */ +@GodotBaseType +public open class Camera3D : Node3D() { + /** + * The axis to lock during [fov]/[size] adjustments. Can be either [KEEP_WIDTH] or [KEEP_HEIGHT]. + */ + public final inline var keepAspect: KeepAspect + @JvmName("keepAspectProperty") + get() = getKeepAspectMode() + @JvmName("keepAspectProperty") + set(`value`) { + setKeepAspectMode(value) + } + + /** + * The culling mask that describes which [VisualInstance3D.layers] are rendered by this camera. By + * default, all 20 user-visible layers are rendered. + * **Note:** Since the [cullMask] allows for 32 layers to be stored in total, there are an + * additional 12 layers that are only used internally by the engine and aren't exposed in the editor. + * Setting [cullMask] using a script allows you to toggle those reserved layers, which can be useful + * for editor plugins. + * To adjust [cullMask] more easily using a script, use [getCullMaskValue] and [setCullMaskValue]. + * **Note:** [VoxelGI], SDFGI and [LightmapGI] will always take all layers into account to + * determine what contributes to global illumination. If this is an issue, set + * [GeometryInstance3D.giMode] to [GeometryInstance3D.GI_MODE_DISABLED] for meshes and + * [Light3D.lightBakeMode] to [Light3D.BAKE_DISABLED] for lights to exclude them from global + * illumination. + */ + public final inline var cullMask: Long + @JvmName("cullMaskProperty") + get() = getCullMask() + @JvmName("cullMaskProperty") + set(`value`) { + setCullMask(value) + } + + /** + * The [Environment] to use for this camera. + */ + public final inline var environment: Environment? + @JvmName("environmentProperty") + get() = getEnvironment() + @JvmName("environmentProperty") + set(`value`) { + setEnvironment(value) + } + + /** + * The [CameraAttributes] to use for this camera. + */ + public final inline var attributes: CameraAttributes? + @JvmName("attributesProperty") + get() = getAttributes() + @JvmName("attributesProperty") + set(`value`) { + setAttributes(value) + } + + /** + * The [Compositor] to use for this camera. + */ + public final inline var compositor: Compositor? + @JvmName("compositorProperty") + get() = getCompositor() + @JvmName("compositorProperty") + set(`value`) { + setCompositor(value) + } + + /** + * The horizontal (X) offset of the camera viewport. + */ + public final inline var hOffset: Float + @JvmName("hOffsetProperty") + get() = getHOffset() + @JvmName("hOffsetProperty") + set(`value`) { + setHOffset(value) + } + + /** + * The vertical (Y) offset of the camera viewport. + */ + public final inline var vOffset: Float + @JvmName("vOffsetProperty") + get() = getVOffset() + @JvmName("vOffsetProperty") + set(`value`) { + setVOffset(value) + } + + /** + * If not [DOPPLER_TRACKING_DISABLED], this camera will simulate the + * [url=https://en.wikipedia.org/wiki/Doppler_effect]Doppler effect[/url] for objects changed in + * particular `_process` methods. See [DopplerTracking] for possible values. + */ + public final inline var dopplerTracking: DopplerTracking + @JvmName("dopplerTrackingProperty") + get() = getDopplerTracking() + @JvmName("dopplerTrackingProperty") + set(`value`) { + setDopplerTracking(value) + } + + /** + * The camera's projection mode. In [PROJECTION_PERSPECTIVE] mode, objects' Z distance from the + * camera's local space scales their perceived size. + */ + public final inline var projection: ProjectionType + @JvmName("projectionProperty") + get() = getProjection() + @JvmName("projectionProperty") + set(`value`) { + setProjection(value) + } + + /** + * If `true`, the ancestor [Viewport] is currently using this camera. + * If multiple cameras are in the scene, one will always be made current. For example, if two + * [Camera3D] nodes are present in the scene and only one is current, setting one camera's [current] + * to `false` will cause the other camera to be made current. + */ + public final inline var current: Boolean + @JvmName("currentProperty") + get() = isCurrent() + @JvmName("currentProperty") + set(`value`) { + setCurrent(value) + } + + /** + * The camera's field of view angle (in degrees). Only applicable in perspective mode. Since + * [keepAspect] locks one axis, [fov] sets the other axis' field of view angle. + * For reference, the default vertical field of view value (`75.0`) is equivalent to a horizontal + * FOV of: + * - ~91.31 degrees in a 4:3 viewport + * - ~101.67 degrees in a 16:10 viewport + * - ~107.51 degrees in a 16:9 viewport + * - ~121.63 degrees in a 21:9 viewport + */ + public final inline var fov: Float + @JvmName("fovProperty") + get() = getFov() + @JvmName("fovProperty") + set(`value`) { + setFov(value) + } + + /** + * The camera's size in meters measured as the diameter of the width or height, depending on + * [keepAspect]. Only applicable in orthogonal and frustum modes. + */ + public final inline var size: Float + @JvmName("sizeProperty") + get() = getSize() + @JvmName("sizeProperty") + set(`value`) { + setSize(value) + } + + /** + * The camera's frustum offset. This can be changed from the default to create "tilted frustum" + * effects such as [url=https://zdoom.org/wiki/Y-shearing]Y-shearing[/url]. + * **Note:** Only effective if [projection] is [PROJECTION_FRUSTUM]. + */ + @CoreTypeLocalCopy + public final inline var frustumOffset: Vector2 + @JvmName("frustumOffsetProperty") + get() = getFrustumOffset() + @JvmName("frustumOffsetProperty") + set(`value`) { + setFrustumOffset(value) + } + + /** + * The distance to the near culling boundary for this camera relative to its local Z axis. Lower + * values allow the camera to see objects more up close to its origin, at the cost of lower precision + * across the *entire* range. Values lower than the default can lead to increased Z-fighting. + */ + public final inline var near: Float + @JvmName("nearProperty") + get() = getNear() + @JvmName("nearProperty") + set(`value`) { + setNear(value) + } + + /** + * The distance to the far culling boundary for this camera relative to its local Z axis. Higher + * values allow the camera to see further away, while decreasing [far] can improve performance if it + * results in objects being partially or fully culled. + */ + public final inline var far: Float + @JvmName("farProperty") + get() = getFar() + @JvmName("farProperty") + set(`value`) { + setFar(value) + } + + public override fun new(scriptIndex: Int): Unit { + Internals.callConstructor(this, ENGINE_CLASS_CAMERA3D_INDEX, scriptIndex) + } + + /** + * The camera's frustum offset. This can be changed from the default to create "tilted frustum" + * effects such as [url=https://zdoom.org/wiki/Y-shearing]Y-shearing[/url]. + * **Note:** Only effective if [projection] is [PROJECTION_FRUSTUM]. + * + * This is a helper function to make dealing with local copies easier. + * + * For more information, see our + * [documentation](https://godot-kotl.in/en/stable/user-guide/api-differences/#core-types). + * + * Allow to directly modify the local copy of the property and assign it back to the Object. + * + * Prefer that over writing: + * `````` + * val myCoreType = camera3d.frustumOffset + * //Your changes + * camera3d.frustumOffset = myCoreType + * `````` + */ + @CoreTypeHelper + public final fun frustumOffsetMutate(block: Vector2.() -> Unit): Vector2 = frustumOffset.apply{ + block(this) + frustumOffset = this + } + + + /** + * Returns a normal vector in world space, that is the result of projecting a point on the + * [Viewport] rectangle by the inverse camera projection. This is useful for casting rays in the form + * of (origin, normal) for object intersection or picking. + */ + public final fun projectRayNormal(screenPoint: Vector2): Vector3 { + Internals.writeArguments(VECTOR2 to screenPoint) + Internals.callMethod(rawPtr, MethodBindings.projectRayNormalPtr, VECTOR3) + return (Internals.readReturnValue(VECTOR3) as Vector3) + } + + /** + * Returns a normal vector from the screen point location directed along the camera. Orthogonal + * cameras are normalized. Perspective cameras account for perspective, screen width/height, etc. + */ + public final fun projectLocalRayNormal(screenPoint: Vector2): Vector3 { + Internals.writeArguments(VECTOR2 to screenPoint) + Internals.callMethod(rawPtr, MethodBindings.projectLocalRayNormalPtr, VECTOR3) + return (Internals.readReturnValue(VECTOR3) as Vector3) + } + + /** + * Returns a 3D position in world space, that is the result of projecting a point on the + * [Viewport] rectangle by the inverse camera projection. This is useful for casting rays in the form + * of (origin, normal) for object intersection or picking. + */ + public final fun projectRayOrigin(screenPoint: Vector2): Vector3 { + Internals.writeArguments(VECTOR2 to screenPoint) + Internals.callMethod(rawPtr, MethodBindings.projectRayOriginPtr, VECTOR3) + return (Internals.readReturnValue(VECTOR3) as Vector3) + } + + /** + * Returns the 2D coordinate in the [Viewport] rectangle that maps to the given 3D point in world + * space. + * **Note:** When using this to position GUI elements over a 3D viewport, use [isPositionBehind] + * to prevent them from appearing if the 3D point is behind the camera: + * [codeblock] + * # This code block is part of a script that inherits from Node3D. + * # `control` is a reference to a node inheriting from Control. + * control.visible = not + * get_viewport().get_camera_3d().is_position_behind(global_transform.origin) + * control.position = get_viewport().get_camera_3d().unproject_position(global_transform.origin) + * [/codeblock] + */ + public final fun unprojectPosition(worldPoint: Vector3): Vector2 { + Internals.writeArguments(VECTOR3 to worldPoint) + Internals.callMethod(rawPtr, MethodBindings.unprojectPositionPtr, VECTOR2) + return (Internals.readReturnValue(VECTOR2) as Vector2) + } + + /** + * Returns `true` if the given position is behind the camera (the blue part of the linked + * diagram). + * [url=https://raw.githubusercontent.com/godotengine/godot-docs/master/img/camera3d_position_frustum.png]See + * this diagram[/url] for an overview of position query methods. + * **Note:** A position which returns `false` may still be outside the camera's field of view. + */ + public final fun isPositionBehind(worldPoint: Vector3): Boolean { + Internals.writeArguments(VECTOR3 to worldPoint) + Internals.callMethod(rawPtr, MethodBindings.isPositionBehindPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + /** + * Returns the 3D point in world space that maps to the given 2D coordinate in the [Viewport] + * rectangle on a plane that is the given [zDepth] distance into the scene away from the camera. + */ + public final fun projectPosition(screenPoint: Vector2, zDepth: Float): Vector3 { + Internals.writeArguments(VECTOR2 to screenPoint, DOUBLE to zDepth.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.projectPositionPtr, VECTOR3) + return (Internals.readReturnValue(VECTOR3) as Vector3) + } + + /** + * Sets the camera projection to perspective mode (see [PROJECTION_PERSPECTIVE]), by specifying a + * [fov] (field of view) angle in degrees, and the [zNear] and [zFar] clip planes in world space + * units. + */ + public final fun setPerspective( + fov: Float, + zNear: Float, + zFar: Float, + ): Unit { + Internals.writeArguments(DOUBLE to fov.toDouble(), DOUBLE to zNear.toDouble(), DOUBLE to zFar.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setPerspectivePtr, NIL) + } + + /** + * Sets the camera projection to orthogonal mode (see [PROJECTION_ORTHOGONAL]), by specifying a + * [size], and the [zNear] and [zFar] clip planes in world space units. (As a hint, 2D games often + * use this projection, with values specified in pixels.) + */ + public final fun setOrthogonal( + size: Float, + zNear: Float, + zFar: Float, + ): Unit { + Internals.writeArguments(DOUBLE to size.toDouble(), DOUBLE to zNear.toDouble(), DOUBLE to zFar.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setOrthogonalPtr, NIL) + } + + /** + * Sets the camera projection to frustum mode (see [PROJECTION_FRUSTUM]), by specifying a [size], + * an [offset], and the [zNear] and [zFar] clip planes in world space units. See also + * [frustumOffset]. + */ + public final fun setFrustum( + size: Float, + offset: Vector2, + zNear: Float, + zFar: Float, + ): Unit { + Internals.writeArguments(DOUBLE to size.toDouble(), VECTOR2 to offset, DOUBLE to zNear.toDouble(), DOUBLE to zFar.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setFrustumPtr, NIL) + } + + /** + * Makes this camera the current camera for the [Viewport] (see class description). If the camera + * node is outside the scene tree, it will attempt to become current once it's added. + */ + public final fun makeCurrent(): Unit { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.makeCurrentPtr, NIL) + } + + /** + * If this is the current camera, remove it from being current. If [enableNext] is `true`, request + * to make the next camera current, if any. + */ + @JvmOverloads + public final fun clearCurrent(enableNext: Boolean = true): Unit { + Internals.writeArguments(BOOL to enableNext) + Internals.callMethod(rawPtr, MethodBindings.clearCurrentPtr, NIL) + } + + public final fun setCurrent(enabled: Boolean): Unit { + Internals.writeArguments(BOOL to enabled) + Internals.callMethod(rawPtr, MethodBindings.setCurrentPtr, NIL) + } + + public final fun isCurrent(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isCurrentPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + /** + * Returns the transform of the camera plus the vertical ([vOffset]) and horizontal ([hOffset]) + * offsets; and any other adjustments made to the position and orientation of the camera by + * subclassed cameras such as [XRCamera3D]. + */ + public final fun getCameraTransform(): Transform3D { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getCameraTransformPtr, TRANSFORM3D) + return (Internals.readReturnValue(TRANSFORM3D) as Transform3D) + } + + /** + * Returns the projection matrix that this camera uses to render to its associated viewport. The + * camera must be part of the scene tree to function. + */ + public final fun getCameraProjection(): Projection { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getCameraProjectionPtr, PROJECTION) + return (Internals.readReturnValue(PROJECTION) as Projection) + } + + public final fun getFov(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getFovPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun getFrustumOffset(): Vector2 { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getFrustumOffsetPtr, VECTOR2) + return (Internals.readReturnValue(VECTOR2) as Vector2) + } + + public final fun getSize(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getSizePtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun getFar(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getFarPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun getNear(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getNearPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setFov(fov: Float): Unit { + Internals.writeArguments(DOUBLE to fov.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setFovPtr, NIL) + } + + public final fun setFrustumOffset(offset: Vector2): Unit { + Internals.writeArguments(VECTOR2 to offset) + Internals.callMethod(rawPtr, MethodBindings.setFrustumOffsetPtr, NIL) + } + + public final fun setSize(size: Float): Unit { + Internals.writeArguments(DOUBLE to size.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setSizePtr, NIL) + } + + public final fun setFar(far: Float): Unit { + Internals.writeArguments(DOUBLE to far.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setFarPtr, NIL) + } + + public final fun setNear(near: Float): Unit { + Internals.writeArguments(DOUBLE to near.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setNearPtr, NIL) + } + + public final fun getProjection(): ProjectionType { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getProjectionPtr, LONG) + return Camera3D.ProjectionType.from(Internals.readReturnValue(LONG) as Long) + } + + public final fun setProjection(mode: ProjectionType): Unit { + Internals.writeArguments(LONG to mode.id) + Internals.callMethod(rawPtr, MethodBindings.setProjectionPtr, NIL) + } + + public final fun setHOffset(offset: Float): Unit { + Internals.writeArguments(DOUBLE to offset.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setHOffsetPtr, NIL) + } + + public final fun getHOffset(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getHOffsetPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setVOffset(offset: Float): Unit { + Internals.writeArguments(DOUBLE to offset.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setVOffsetPtr, NIL) + } + + public final fun getVOffset(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getVOffsetPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setCullMask(mask: Long): Unit { + Internals.writeArguments(LONG to mask) + Internals.callMethod(rawPtr, MethodBindings.setCullMaskPtr, NIL) + } + + public final fun getCullMask(): Long { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getCullMaskPtr, LONG) + return (Internals.readReturnValue(LONG) as Long) + } + + public final fun setEnvironment(env: Environment?): Unit { + Internals.writeArguments(OBJECT to env) + Internals.callMethod(rawPtr, MethodBindings.setEnvironmentPtr, NIL) + } + + public final fun getEnvironment(): Environment? { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getEnvironmentPtr, OBJECT) + return (Internals.readReturnValue(OBJECT) as Environment?) + } + + public final fun setAttributes(env: CameraAttributes?): Unit { + Internals.writeArguments(OBJECT to env) + Internals.callMethod(rawPtr, MethodBindings.setAttributesPtr, NIL) + } + + public final fun getAttributes(): CameraAttributes? { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getAttributesPtr, OBJECT) + return (Internals.readReturnValue(OBJECT) as CameraAttributes?) + } + + public final fun setCompositor(compositor: Compositor?): Unit { + Internals.writeArguments(OBJECT to compositor) + Internals.callMethod(rawPtr, MethodBindings.setCompositorPtr, NIL) + } + + public final fun getCompositor(): Compositor? { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getCompositorPtr, OBJECT) + return (Internals.readReturnValue(OBJECT) as Compositor?) + } + + public final fun setKeepAspectMode(mode: KeepAspect): Unit { + Internals.writeArguments(LONG to mode.id) + Internals.callMethod(rawPtr, MethodBindings.setKeepAspectModePtr, NIL) + } + + public final fun getKeepAspectMode(): KeepAspect { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getKeepAspectModePtr, LONG) + return Camera3D.KeepAspect.from(Internals.readReturnValue(LONG) as Long) + } + + public final fun setDopplerTracking(mode: DopplerTracking): Unit { + Internals.writeArguments(LONG to mode.id) + Internals.callMethod(rawPtr, MethodBindings.setDopplerTrackingPtr, NIL) + } + + public final fun getDopplerTracking(): DopplerTracking { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getDopplerTrackingPtr, LONG) + return Camera3D.DopplerTracking.from(Internals.readReturnValue(LONG) as Long) + } + + /** + * Returns the camera's frustum planes in world space units as an array of [Plane]s in the + * following order: near, far, left, top, right, bottom. Not to be confused with [frustumOffset]. + */ + public final fun getFrustum(): VariantArray { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getFrustumPtr, ARRAY) + return (Internals.readReturnValue(ARRAY) as VariantArray) + } + + /** + * Returns `true` if the given position is inside the camera's frustum (the green part of the + * linked diagram). + * [url=https://raw.githubusercontent.com/godotengine/godot-docs/master/img/camera3d_position_frustum.png]See + * this diagram[/url] for an overview of position query methods. + */ + public final fun isPositionInFrustum(worldPoint: Vector3): Boolean { + Internals.writeArguments(VECTOR3 to worldPoint) + Internals.callMethod(rawPtr, MethodBindings.isPositionInFrustumPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + /** + * Returns the camera's RID from the [RenderingServer]. + */ + public final fun getCameraRid(): RID { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getCameraRidPtr, _RID) + return (Internals.readReturnValue(_RID) as RID) + } + + /** + * Returns the RID of a pyramid shape encompassing the camera's view frustum, ignoring the + * camera's near plane. The tip of the pyramid represents the position of the camera. + */ + public final fun getPyramidShapeRid(): RID { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getPyramidShapeRidPtr, _RID) + return (Internals.readReturnValue(_RID) as RID) + } + + /** + * Based on [value], enables or disables the specified layer in the [cullMask], given a + * [layerNumber] between 1 and 20. + */ + public final fun setCullMaskValue(layerNumber: Int, `value`: Boolean): Unit { + Internals.writeArguments(LONG to layerNumber.toLong(), BOOL to value) + Internals.callMethod(rawPtr, MethodBindings.setCullMaskValuePtr, NIL) + } + + /** + * Returns whether or not the specified layer of the [cullMask] is enabled, given a [layerNumber] + * between 1 and 20. + */ + public final fun getCullMaskValue(layerNumber: Int): Boolean { + Internals.writeArguments(LONG to layerNumber.toLong()) + Internals.callMethod(rawPtr, MethodBindings.getCullMaskValuePtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public enum class ProjectionType( + id: Long, + ) { + /** + * Perspective projection. Objects on the screen becomes smaller when they are far away. + */ + PROJECTION_PERSPECTIVE(0), + /** + * Orthogonal projection, also known as orthographic projection. Objects remain the same size on + * the screen no matter how far away they are. + */ + PROJECTION_ORTHOGONAL(1), + /** + * Frustum projection. This mode allows adjusting [frustumOffset] to create "tilted frustum" + * effects. + */ + PROJECTION_FRUSTUM(2), + ; + + public val id: Long + init { + this.id = id + } + + public companion object { + public fun from(`value`: Long): ProjectionType = entries.single { it.id == `value` } + } + } + + public enum class KeepAspect( + id: Long, + ) { + /** + * Preserves the horizontal aspect ratio; also known as Vert- scaling. This is usually the best + * option for projects running in portrait mode, as taller aspect ratios will benefit from a wider + * vertical FOV. + */ + KEEP_WIDTH(0), + /** + * Preserves the vertical aspect ratio; also known as Hor+ scaling. This is usually the best + * option for projects running in landscape mode, as wider aspect ratios will automatically benefit + * from a wider horizontal FOV. + */ + KEEP_HEIGHT(1), + ; + + public val id: Long + init { + this.id = id + } + + public companion object { + public fun from(`value`: Long): KeepAspect = entries.single { it.id == `value` } + } + } + + public enum class DopplerTracking( + id: Long, + ) { + /** + * Disables [url=https://en.wikipedia.org/wiki/Doppler_effect]Doppler effect[/url] simulation + * (default). + */ + DOPPLER_TRACKING_DISABLED(0), + /** + * Simulate [url=https://en.wikipedia.org/wiki/Doppler_effect]Doppler effect[/url] by tracking + * positions of objects that are changed in `_process`. Changes in the relative velocity of this + * camera compared to those objects affect how audio is perceived (changing the audio's + * [AudioStreamPlayer3D.pitchScale]). + */ + DOPPLER_TRACKING_IDLE_STEP(1), + /** + * Simulate [url=https://en.wikipedia.org/wiki/Doppler_effect]Doppler effect[/url] by tracking + * positions of objects that are changed in `_physics_process`. Changes in the relative velocity of + * this camera compared to those objects affect how audio is perceived (changing the audio's + * [AudioStreamPlayer3D.pitchScale]). + */ + DOPPLER_TRACKING_PHYSICS_STEP(2), + ; + + public val id: Long + init { + this.id = id + } + + public companion object { + public fun from(`value`: Long): DopplerTracking = entries.single { it.id == `value` } + } + } + + public companion object + + public object MethodBindings { + internal val projectRayNormalPtr: VoidPtr = + Internals.getMethodBindPtr("Camera3D", "project_ray_normal", 1718073306) + + internal val projectLocalRayNormalPtr: VoidPtr = + Internals.getMethodBindPtr("Camera3D", "project_local_ray_normal", 1718073306) + + internal val projectRayOriginPtr: VoidPtr = + Internals.getMethodBindPtr("Camera3D", "project_ray_origin", 1718073306) + + internal val unprojectPositionPtr: VoidPtr = + Internals.getMethodBindPtr("Camera3D", "unproject_position", 3758901831) + + internal val isPositionBehindPtr: VoidPtr = + Internals.getMethodBindPtr("Camera3D", "is_position_behind", 3108956480) + + internal val projectPositionPtr: VoidPtr = + Internals.getMethodBindPtr("Camera3D", "project_position", 2171975744) + + internal val setPerspectivePtr: VoidPtr = + Internals.getMethodBindPtr("Camera3D", "set_perspective", 2385087082) + + internal val setOrthogonalPtr: VoidPtr = + Internals.getMethodBindPtr("Camera3D", "set_orthogonal", 2385087082) + + internal val setFrustumPtr: VoidPtr = + Internals.getMethodBindPtr("Camera3D", "set_frustum", 354890663) + + internal val makeCurrentPtr: VoidPtr = + Internals.getMethodBindPtr("Camera3D", "make_current", 3218959716) + + internal val clearCurrentPtr: VoidPtr = + Internals.getMethodBindPtr("Camera3D", "clear_current", 3216645846) + + internal val setCurrentPtr: VoidPtr = + Internals.getMethodBindPtr("Camera3D", "set_current", 2586408642) + + internal val isCurrentPtr: VoidPtr = + Internals.getMethodBindPtr("Camera3D", "is_current", 36873697) + + internal val getCameraTransformPtr: VoidPtr = + Internals.getMethodBindPtr("Camera3D", "get_camera_transform", 3229777777) + + internal val getCameraProjectionPtr: VoidPtr = + Internals.getMethodBindPtr("Camera3D", "get_camera_projection", 2910717950) + + internal val getFovPtr: VoidPtr = Internals.getMethodBindPtr("Camera3D", "get_fov", 1740695150) + + internal val getFrustumOffsetPtr: VoidPtr = + Internals.getMethodBindPtr("Camera3D", "get_frustum_offset", 3341600327) + + internal val getSizePtr: VoidPtr = + Internals.getMethodBindPtr("Camera3D", "get_size", 1740695150) + + internal val getFarPtr: VoidPtr = Internals.getMethodBindPtr("Camera3D", "get_far", 1740695150) + + internal val getNearPtr: VoidPtr = + Internals.getMethodBindPtr("Camera3D", "get_near", 1740695150) + + internal val setFovPtr: VoidPtr = Internals.getMethodBindPtr("Camera3D", "set_fov", 373806689) + + internal val setFrustumOffsetPtr: VoidPtr = + Internals.getMethodBindPtr("Camera3D", "set_frustum_offset", 743155724) + + internal val setSizePtr: VoidPtr = Internals.getMethodBindPtr("Camera3D", "set_size", 373806689) + + internal val setFarPtr: VoidPtr = Internals.getMethodBindPtr("Camera3D", "set_far", 373806689) + + internal val setNearPtr: VoidPtr = Internals.getMethodBindPtr("Camera3D", "set_near", 373806689) + + internal val getProjectionPtr: VoidPtr = + Internals.getMethodBindPtr("Camera3D", "get_projection", 2624185235) + + internal val setProjectionPtr: VoidPtr = + Internals.getMethodBindPtr("Camera3D", "set_projection", 4218540108) + + internal val setHOffsetPtr: VoidPtr = + Internals.getMethodBindPtr("Camera3D", "set_h_offset", 373806689) + + internal val getHOffsetPtr: VoidPtr = + Internals.getMethodBindPtr("Camera3D", "get_h_offset", 1740695150) + + internal val setVOffsetPtr: VoidPtr = + Internals.getMethodBindPtr("Camera3D", "set_v_offset", 373806689) + + internal val getVOffsetPtr: VoidPtr = + Internals.getMethodBindPtr("Camera3D", "get_v_offset", 1740695150) + + internal val setCullMaskPtr: VoidPtr = + Internals.getMethodBindPtr("Camera3D", "set_cull_mask", 1286410249) + + internal val getCullMaskPtr: VoidPtr = + Internals.getMethodBindPtr("Camera3D", "get_cull_mask", 3905245786) + + internal val setEnvironmentPtr: VoidPtr = + Internals.getMethodBindPtr("Camera3D", "set_environment", 4143518816) + + internal val getEnvironmentPtr: VoidPtr = + Internals.getMethodBindPtr("Camera3D", "get_environment", 3082064660) + + internal val setAttributesPtr: VoidPtr = + Internals.getMethodBindPtr("Camera3D", "set_attributes", 2817810567) + + internal val getAttributesPtr: VoidPtr = + Internals.getMethodBindPtr("Camera3D", "get_attributes", 3921283215) + + internal val setCompositorPtr: VoidPtr = + Internals.getMethodBindPtr("Camera3D", "set_compositor", 1586754307) + + internal val getCompositorPtr: VoidPtr = + Internals.getMethodBindPtr("Camera3D", "get_compositor", 3647707413) + + internal val setKeepAspectModePtr: VoidPtr = + Internals.getMethodBindPtr("Camera3D", "set_keep_aspect_mode", 1740651252) + + internal val getKeepAspectModePtr: VoidPtr = + Internals.getMethodBindPtr("Camera3D", "get_keep_aspect_mode", 2790278316) + + internal val setDopplerTrackingPtr: VoidPtr = + Internals.getMethodBindPtr("Camera3D", "set_doppler_tracking", 3109431270) + + internal val getDopplerTrackingPtr: VoidPtr = + Internals.getMethodBindPtr("Camera3D", "get_doppler_tracking", 1584483649) + + internal val getFrustumPtr: VoidPtr = + Internals.getMethodBindPtr("Camera3D", "get_frustum", 3995934104) + + internal val isPositionInFrustumPtr: VoidPtr = + Internals.getMethodBindPtr("Camera3D", "is_position_in_frustum", 3108956480) + + internal val getCameraRidPtr: VoidPtr = + Internals.getMethodBindPtr("Camera3D", "get_camera_rid", 2944877500) + + internal val getPyramidShapeRidPtr: VoidPtr = + Internals.getMethodBindPtr("Camera3D", "get_pyramid_shape_rid", 529393457) + + internal val setCullMaskValuePtr: VoidPtr = + Internals.getMethodBindPtr("Camera3D", "set_cull_mask_value", 300928843) + + internal val getCullMaskValuePtr: VoidPtr = + Internals.getMethodBindPtr("Camera3D", "get_cull_mask_value", 1116898809) + } +} diff --git a/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/CameraAttributes.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/CameraAttributes.kt new file mode 100644 index 0000000000..92cf47a073 --- /dev/null +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/CameraAttributes.kt @@ -0,0 +1,190 @@ +// THIS FILE IS GENERATED! DO NOT EDIT IT MANUALLY! +@file:Suppress("PackageDirectoryMismatch", "unused", "FunctionName", "RedundantModalityModifier", + "UNCHECKED_CAST", "JoinDeclarationAndAssignment", "USELESS_CAST", + "RemoveRedundantQualifierName", "NOTHING_TO_INLINE", "NON_FINAL_MEMBER_IN_OBJECT", + "RedundantVisibilityModifier", "RedundantUnitReturnType", "MemberVisibilityCanBePrivate") + +package godot + +import godot.`annotation`.GodotBaseType +import godot.core.VariantParser.BOOL +import godot.core.VariantParser.DOUBLE +import godot.core.VariantParser.NIL +import godot.util.Internals +import godot.util.VoidPtr +import kotlin.Boolean +import kotlin.Double +import kotlin.Float +import kotlin.Int +import kotlin.Suppress +import kotlin.Unit +import kotlin.jvm.JvmName + +private const val ENGINE_CLASS_CAMERAATTRIBUTES_INDEX: Int = 163 + +/** + * Controls camera-specific attributes such as depth of field and exposure override. + * When used in a [WorldEnvironment] it provides default settings for exposure, auto-exposure, and + * depth of field that will be used by all cameras without their own [CameraAttributes], including the + * editor camera. When used in a [Camera3D] it will override any [CameraAttributes] set in the + * [WorldEnvironment]. When used in [VoxelGI] or [LightmapGI], only the exposure settings will be used. + * See also [Environment] for general 3D environment settings. + * This is a pure virtual class that is inherited by [CameraAttributesPhysical] and + * [CameraAttributesPractical]. + */ +@GodotBaseType +public open class CameraAttributes : Resource() { + /** + * Sensitivity of camera sensors, measured in ISO. A higher sensitivity results in a brighter + * image. Only available when [ProjectSettings.rendering/lightsAndShadows/usePhysicalLightUnits] is + * enabled. When [autoExposureEnabled] this can be used as a method of exposure compensation, + * doubling the value will increase the exposure value (measured in EV100) by 1 stop. + */ + public final inline var exposureSensitivity: Float + @JvmName("exposureSensitivityProperty") + get() = getExposureSensitivity() + @JvmName("exposureSensitivityProperty") + set(`value`) { + setExposureSensitivity(value) + } + + /** + * Multiplier for the exposure amount. A higher value results in a brighter image. + */ + public final inline var exposureMultiplier: Float + @JvmName("exposureMultiplierProperty") + get() = getExposureMultiplier() + @JvmName("exposureMultiplierProperty") + set(`value`) { + setExposureMultiplier(value) + } + + /** + * If `true`, enables the tonemapping auto exposure mode of the scene renderer. If `true`, the + * renderer will automatically determine the exposure setting to adapt to the scene's illumination + * and the observed light. + */ + public final inline var autoExposureEnabled: Boolean + @JvmName("autoExposureEnabledProperty") + get() = isAutoExposureEnabled() + @JvmName("autoExposureEnabledProperty") + set(`value`) { + setAutoExposureEnabled(value) + } + + /** + * The scale of the auto exposure effect. Affects the intensity of auto exposure. + */ + public final inline var autoExposureScale: Float + @JvmName("autoExposureScaleProperty") + get() = getAutoExposureScale() + @JvmName("autoExposureScaleProperty") + set(`value`) { + setAutoExposureScale(value) + } + + /** + * The speed of the auto exposure effect. Affects the time needed for the camera to perform auto + * exposure. + */ + public final inline var autoExposureSpeed: Float + @JvmName("autoExposureSpeedProperty") + get() = getAutoExposureSpeed() + @JvmName("autoExposureSpeedProperty") + set(`value`) { + setAutoExposureSpeed(value) + } + + public override fun new(scriptIndex: Int): Unit { + Internals.callConstructor(this, ENGINE_CLASS_CAMERAATTRIBUTES_INDEX, scriptIndex) + } + + public final fun setExposureMultiplier(multiplier: Float): Unit { + Internals.writeArguments(DOUBLE to multiplier.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setExposureMultiplierPtr, NIL) + } + + public final fun getExposureMultiplier(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getExposureMultiplierPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setExposureSensitivity(sensitivity: Float): Unit { + Internals.writeArguments(DOUBLE to sensitivity.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setExposureSensitivityPtr, NIL) + } + + public final fun getExposureSensitivity(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getExposureSensitivityPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setAutoExposureEnabled(enabled: Boolean): Unit { + Internals.writeArguments(BOOL to enabled) + Internals.callMethod(rawPtr, MethodBindings.setAutoExposureEnabledPtr, NIL) + } + + public final fun isAutoExposureEnabled(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isAutoExposureEnabledPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public final fun setAutoExposureSpeed(exposureSpeed: Float): Unit { + Internals.writeArguments(DOUBLE to exposureSpeed.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setAutoExposureSpeedPtr, NIL) + } + + public final fun getAutoExposureSpeed(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getAutoExposureSpeedPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setAutoExposureScale(exposureGrey: Float): Unit { + Internals.writeArguments(DOUBLE to exposureGrey.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setAutoExposureScalePtr, NIL) + } + + public final fun getAutoExposureScale(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getAutoExposureScalePtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public companion object + + public object MethodBindings { + internal val setExposureMultiplierPtr: VoidPtr = + Internals.getMethodBindPtr("CameraAttributes", "set_exposure_multiplier", 373806689) + + internal val getExposureMultiplierPtr: VoidPtr = + Internals.getMethodBindPtr("CameraAttributes", "get_exposure_multiplier", 1740695150) + + internal val setExposureSensitivityPtr: VoidPtr = + Internals.getMethodBindPtr("CameraAttributes", "set_exposure_sensitivity", 373806689) + + internal val getExposureSensitivityPtr: VoidPtr = + Internals.getMethodBindPtr("CameraAttributes", "get_exposure_sensitivity", 1740695150) + + internal val setAutoExposureEnabledPtr: VoidPtr = + Internals.getMethodBindPtr("CameraAttributes", "set_auto_exposure_enabled", 2586408642) + + internal val isAutoExposureEnabledPtr: VoidPtr = + Internals.getMethodBindPtr("CameraAttributes", "is_auto_exposure_enabled", 36873697) + + internal val setAutoExposureSpeedPtr: VoidPtr = + Internals.getMethodBindPtr("CameraAttributes", "set_auto_exposure_speed", 373806689) + + internal val getAutoExposureSpeedPtr: VoidPtr = + Internals.getMethodBindPtr("CameraAttributes", "get_auto_exposure_speed", 1740695150) + + internal val setAutoExposureScalePtr: VoidPtr = + Internals.getMethodBindPtr("CameraAttributes", "set_auto_exposure_scale", 373806689) + + internal val getAutoExposureScalePtr: VoidPtr = + Internals.getMethodBindPtr("CameraAttributes", "get_auto_exposure_scale", 1740695150) + } +} diff --git a/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/CameraAttributesPhysical.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/CameraAttributesPhysical.kt new file mode 100644 index 0000000000..005feb7302 --- /dev/null +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/CameraAttributesPhysical.kt @@ -0,0 +1,310 @@ +// THIS FILE IS GENERATED! DO NOT EDIT IT MANUALLY! +@file:Suppress("PackageDirectoryMismatch", "unused", "FunctionName", "RedundantModalityModifier", + "UNCHECKED_CAST", "JoinDeclarationAndAssignment", "USELESS_CAST", + "RemoveRedundantQualifierName", "NOTHING_TO_INLINE", "NON_FINAL_MEMBER_IN_OBJECT", + "RedundantVisibilityModifier", "RedundantUnitReturnType", "MemberVisibilityCanBePrivate") + +package godot + +import godot.`annotation`.GodotBaseType +import godot.core.VariantParser.DOUBLE +import godot.core.VariantParser.NIL +import godot.util.Internals +import godot.util.VoidPtr +import kotlin.Double +import kotlin.Float +import kotlin.Int +import kotlin.Suppress +import kotlin.Unit +import kotlin.jvm.JvmName + +private const val ENGINE_CLASS_CAMERAATTRIBUTESPHYSICAL_INDEX: Int = 164 + +/** + * [CameraAttributesPhysical] is used to set rendering settings based on a physically-based camera's + * settings. It is responsible for exposure, auto-exposure, and depth of field. + * When used in a [WorldEnvironment] it provides default settings for exposure, auto-exposure, and + * depth of field that will be used by all cameras without their own [CameraAttributes], including the + * editor camera. When used in a [Camera3D] it will override any [CameraAttributes] set in the + * [WorldEnvironment] and will override the [Camera3D]s [Camera3D.far], [Camera3D.near], + * [Camera3D.fov], and [Camera3D.keepAspect] properties. When used in [VoxelGI] or [LightmapGI], only + * the exposure settings will be used. + * The default settings are intended for use in an outdoor environment, tips for settings for use in + * an indoor environment can be found in each setting's documentation. + * **Note:** Depth of field blur is only supported in the Forward+ and Mobile rendering methods, not + * Compatibility. + */ +@GodotBaseType +public open class CameraAttributesPhysical : CameraAttributes() { + /** + * Distance from camera of object that will be in focus, measured in meters. Internally this will + * be clamped to be at least 1 millimeter larger than [frustumFocalLength]. + */ + public final inline var frustumFocusDistance: Float + @JvmName("frustumFocusDistanceProperty") + get() = getFocusDistance() + @JvmName("frustumFocusDistanceProperty") + set(`value`) { + setFocusDistance(value) + } + + /** + * Distance between camera lens and camera aperture, measured in millimeters. Controls field of + * view and depth of field. A larger focal length will result in a smaller field of view and a + * narrower depth of field meaning fewer objects will be in focus. A smaller focal length will result + * in a wider field of view and a larger depth of field meaning more objects will be in focus. When + * attached to a [Camera3D] as its [Camera3D.attributes], it will override the [Camera3D.fov] + * property and the [Camera3D.keepAspect] property. + */ + public final inline var frustumFocalLength: Float + @JvmName("frustumFocalLengthProperty") + get() = getFocalLength() + @JvmName("frustumFocalLengthProperty") + set(`value`) { + setFocalLength(value) + } + + /** + * Override value for [Camera3D.near]. Used internally when calculating depth of field. When + * attached to a [Camera3D] as its [Camera3D.attributes], it will override the [Camera3D.near] + * property. + */ + public final inline var frustumNear: Float + @JvmName("frustumNearProperty") + get() = getNear() + @JvmName("frustumNearProperty") + set(`value`) { + setNear(value) + } + + /** + * Override value for [Camera3D.far]. Used internally when calculating depth of field. When + * attached to a [Camera3D] as its [Camera3D.attributes], it will override the [Camera3D.far] + * property. + */ + public final inline var frustumFar: Float + @JvmName("frustumFarProperty") + get() = getFar() + @JvmName("frustumFarProperty") + set(`value`) { + setFar(value) + } + + /** + * Size of the aperture of the camera, measured in f-stops. An f-stop is a unitless ratio between + * the focal length of the camera and the diameter of the aperture. A high aperture setting will + * result in a smaller aperture which leads to a dimmer image and sharper focus. A low aperture + * results in a wide aperture which lets in more light resulting in a brighter, less-focused image. + * Default is appropriate for outdoors at daytime (i.e. for use with a default [DirectionalLight3D]), + * for indoor lighting, a value between 2 and 4 is more appropriate. + * Only available when [ProjectSettings.rendering/lightsAndShadows/usePhysicalLightUnits] is + * enabled. + */ + public final inline var exposureAperture: Float + @JvmName("exposureApertureProperty") + get() = getAperture() + @JvmName("exposureApertureProperty") + set(`value`) { + setAperture(value) + } + + /** + * Time for shutter to open and close, evaluated as `1 / shutter_speed` seconds. A higher value + * will allow less light (leading to a darker image), while a lower value will allow more light + * (leading to a brighter image). + * Only available when [ProjectSettings.rendering/lightsAndShadows/usePhysicalLightUnits] is + * enabled. + */ + public final inline var exposureShutterSpeed: Float + @JvmName("exposureShutterSpeedProperty") + get() = getShutterSpeed() + @JvmName("exposureShutterSpeedProperty") + set(`value`) { + setShutterSpeed(value) + } + + /** + * The minimum luminance luminance (in EV100) used when calculating auto exposure. When + * calculating scene average luminance, color values will be clamped to at least this value. This + * limits the auto-exposure from exposing above a certain brightness, resulting in a cut off point + * where the scene will remain dark. + */ + public final inline var autoExposureMinExposureValue: Float + @JvmName("autoExposureMinExposureValueProperty") + get() = getAutoExposureMinExposureValue() + @JvmName("autoExposureMinExposureValueProperty") + set(`value`) { + setAutoExposureMinExposureValue(value) + } + + /** + * The maximum luminance (in EV100) used when calculating auto exposure. When calculating scene + * average luminance, color values will be clamped to at least this value. This limits the + * auto-exposure from exposing below a certain brightness, resulting in a cut off point where the + * scene will remain bright. + */ + public final inline var autoExposureMaxExposureValue: Float + @JvmName("autoExposureMaxExposureValueProperty") + get() = getAutoExposureMaxExposureValue() + @JvmName("autoExposureMaxExposureValueProperty") + set(`value`) { + setAutoExposureMaxExposureValue(value) + } + + public override fun new(scriptIndex: Int): Unit { + Internals.callConstructor(this, ENGINE_CLASS_CAMERAATTRIBUTESPHYSICAL_INDEX, scriptIndex) + } + + public final fun setAperture(aperture: Float): Unit { + Internals.writeArguments(DOUBLE to aperture.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setAperturePtr, NIL) + } + + public final fun getAperture(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getAperturePtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setShutterSpeed(shutterSpeed: Float): Unit { + Internals.writeArguments(DOUBLE to shutterSpeed.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setShutterSpeedPtr, NIL) + } + + public final fun getShutterSpeed(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getShutterSpeedPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setFocalLength(focalLength: Float): Unit { + Internals.writeArguments(DOUBLE to focalLength.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setFocalLengthPtr, NIL) + } + + public final fun getFocalLength(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getFocalLengthPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setFocusDistance(focusDistance: Float): Unit { + Internals.writeArguments(DOUBLE to focusDistance.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setFocusDistancePtr, NIL) + } + + public final fun getFocusDistance(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getFocusDistancePtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setNear(near: Float): Unit { + Internals.writeArguments(DOUBLE to near.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setNearPtr, NIL) + } + + public final fun getNear(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getNearPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setFar(far: Float): Unit { + Internals.writeArguments(DOUBLE to far.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setFarPtr, NIL) + } + + public final fun getFar(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getFarPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + /** + * Returns the vertical field of view that corresponds to the [frustumFocalLength]. This value is + * calculated internally whenever [frustumFocalLength] is changed. + */ + public final fun getFov(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getFovPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setAutoExposureMaxExposureValue(exposureValueMax: Float): Unit { + Internals.writeArguments(DOUBLE to exposureValueMax.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setAutoExposureMaxExposureValuePtr, NIL) + } + + public final fun getAutoExposureMaxExposureValue(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getAutoExposureMaxExposureValuePtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setAutoExposureMinExposureValue(exposureValueMin: Float): Unit { + Internals.writeArguments(DOUBLE to exposureValueMin.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setAutoExposureMinExposureValuePtr, NIL) + } + + public final fun getAutoExposureMinExposureValue(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getAutoExposureMinExposureValuePtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public companion object + + public object MethodBindings { + internal val setAperturePtr: VoidPtr = + Internals.getMethodBindPtr("CameraAttributesPhysical", "set_aperture", 373806689) + + internal val getAperturePtr: VoidPtr = + Internals.getMethodBindPtr("CameraAttributesPhysical", "get_aperture", 1740695150) + + internal val setShutterSpeedPtr: VoidPtr = + Internals.getMethodBindPtr("CameraAttributesPhysical", "set_shutter_speed", 373806689) + + internal val getShutterSpeedPtr: VoidPtr = + Internals.getMethodBindPtr("CameraAttributesPhysical", "get_shutter_speed", 1740695150) + + internal val setFocalLengthPtr: VoidPtr = + Internals.getMethodBindPtr("CameraAttributesPhysical", "set_focal_length", 373806689) + + internal val getFocalLengthPtr: VoidPtr = + Internals.getMethodBindPtr("CameraAttributesPhysical", "get_focal_length", 1740695150) + + internal val setFocusDistancePtr: VoidPtr = + Internals.getMethodBindPtr("CameraAttributesPhysical", "set_focus_distance", 373806689) + + internal val getFocusDistancePtr: VoidPtr = + Internals.getMethodBindPtr("CameraAttributesPhysical", "get_focus_distance", 1740695150) + + internal val setNearPtr: VoidPtr = + Internals.getMethodBindPtr("CameraAttributesPhysical", "set_near", 373806689) + + internal val getNearPtr: VoidPtr = + Internals.getMethodBindPtr("CameraAttributesPhysical", "get_near", 1740695150) + + internal val setFarPtr: VoidPtr = + Internals.getMethodBindPtr("CameraAttributesPhysical", "set_far", 373806689) + + internal val getFarPtr: VoidPtr = + Internals.getMethodBindPtr("CameraAttributesPhysical", "get_far", 1740695150) + + internal val getFovPtr: VoidPtr = + Internals.getMethodBindPtr("CameraAttributesPhysical", "get_fov", 1740695150) + + internal val setAutoExposureMaxExposureValuePtr: VoidPtr = + Internals.getMethodBindPtr("CameraAttributesPhysical", "set_auto_exposure_max_exposure_value", 373806689) + + internal val getAutoExposureMaxExposureValuePtr: VoidPtr = + Internals.getMethodBindPtr("CameraAttributesPhysical", "get_auto_exposure_max_exposure_value", 1740695150) + + internal val setAutoExposureMinExposureValuePtr: VoidPtr = + Internals.getMethodBindPtr("CameraAttributesPhysical", "set_auto_exposure_min_exposure_value", 373806689) + + internal val getAutoExposureMinExposureValuePtr: VoidPtr = + Internals.getMethodBindPtr("CameraAttributesPhysical", "get_auto_exposure_min_exposure_value", 1740695150) + } +} diff --git a/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/CameraAttributesPractical.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/CameraAttributesPractical.kt new file mode 100644 index 0000000000..1ec3e0c82e --- /dev/null +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/CameraAttributesPractical.kt @@ -0,0 +1,315 @@ +// THIS FILE IS GENERATED! DO NOT EDIT IT MANUALLY! +@file:Suppress("PackageDirectoryMismatch", "unused", "FunctionName", "RedundantModalityModifier", + "UNCHECKED_CAST", "JoinDeclarationAndAssignment", "USELESS_CAST", + "RemoveRedundantQualifierName", "NOTHING_TO_INLINE", "NON_FINAL_MEMBER_IN_OBJECT", + "RedundantVisibilityModifier", "RedundantUnitReturnType", "MemberVisibilityCanBePrivate") + +package godot + +import godot.`annotation`.GodotBaseType +import godot.core.VariantParser.BOOL +import godot.core.VariantParser.DOUBLE +import godot.core.VariantParser.NIL +import godot.util.Internals +import godot.util.VoidPtr +import kotlin.Boolean +import kotlin.Double +import kotlin.Float +import kotlin.Int +import kotlin.Suppress +import kotlin.Unit +import kotlin.jvm.JvmName + +private const val ENGINE_CLASS_CAMERAATTRIBUTESPRACTICAL_INDEX: Int = 165 + +/** + * Controls camera-specific attributes such as auto-exposure, depth of field, and exposure override. + * When used in a [WorldEnvironment] it provides default settings for exposure, auto-exposure, and + * depth of field that will be used by all cameras without their own [CameraAttributes], including the + * editor camera. When used in a [Camera3D] it will override any [CameraAttributes] set in the + * [WorldEnvironment]. When used in [VoxelGI] or [LightmapGI], only the exposure settings will be used. + */ +@GodotBaseType +public open class CameraAttributesPractical : CameraAttributes() { + /** + * Enables depth of field blur for objects further than [dofBlurFarDistance]. Strength of blur is + * controlled by [dofBlurAmount] and modulated by [dofBlurFarTransition]. + * **Note:** Depth of field blur is only supported in the Forward+ and Mobile rendering methods, + * not Compatibility. + */ + public final inline var dofBlurFarEnabled: Boolean + @JvmName("dofBlurFarEnabledProperty") + get() = isDofBlurFarEnabled() + @JvmName("dofBlurFarEnabledProperty") + set(`value`) { + setDofBlurFarEnabled(value) + } + + /** + * Objects further from the [Camera3D] by this amount will be blurred by the depth of field + * effect. Measured in meters. + */ + public final inline var dofBlurFarDistance: Float + @JvmName("dofBlurFarDistanceProperty") + get() = getDofBlurFarDistance() + @JvmName("dofBlurFarDistanceProperty") + set(`value`) { + setDofBlurFarDistance(value) + } + + /** + * When positive, distance over which (starting from [dofBlurFarDistance]) blur effect will scale + * from 0 to [dofBlurAmount]. When negative, uses physically-based scaling so depth of field effect + * will scale from 0 at [dofBlurFarDistance] and will increase in a physically accurate way as + * objects get further from the [Camera3D]. + */ + public final inline var dofBlurFarTransition: Float + @JvmName("dofBlurFarTransitionProperty") + get() = getDofBlurFarTransition() + @JvmName("dofBlurFarTransitionProperty") + set(`value`) { + setDofBlurFarTransition(value) + } + + /** + * Enables depth of field blur for objects closer than [dofBlurNearDistance]. Strength of blur is + * controlled by [dofBlurAmount] and modulated by [dofBlurNearTransition]. + * **Note:** Depth of field blur is only supported in the Forward+ and Mobile rendering methods, + * not Compatibility. + */ + public final inline var dofBlurNearEnabled: Boolean + @JvmName("dofBlurNearEnabledProperty") + get() = isDofBlurNearEnabled() + @JvmName("dofBlurNearEnabledProperty") + set(`value`) { + setDofBlurNearEnabled(value) + } + + /** + * Objects closer from the [Camera3D] by this amount will be blurred by the depth of field effect. + * Measured in meters. + */ + public final inline var dofBlurNearDistance: Float + @JvmName("dofBlurNearDistanceProperty") + get() = getDofBlurNearDistance() + @JvmName("dofBlurNearDistanceProperty") + set(`value`) { + setDofBlurNearDistance(value) + } + + /** + * When positive, distance over which blur effect will scale from 0 to [dofBlurAmount], ending at + * [dofBlurNearDistance]. When negative, uses physically-based scaling so depth of field effect will + * scale from 0 at [dofBlurNearDistance] and will increase in a physically accurate way as objects + * get closer to the [Camera3D]. + */ + public final inline var dofBlurNearTransition: Float + @JvmName("dofBlurNearTransitionProperty") + get() = getDofBlurNearTransition() + @JvmName("dofBlurNearTransitionProperty") + set(`value`) { + setDofBlurNearTransition(value) + } + + /** + * Sets the maximum amount of blur. When using physically-based blur amounts, will instead act as + * a multiplier. High values lead to an increased amount of blurriness, but can be much more + * expensive to calculate. It is best to keep this as low as possible for a given art style. + */ + public final inline var dofBlurAmount: Float + @JvmName("dofBlurAmountProperty") + get() = getDofBlurAmount() + @JvmName("dofBlurAmountProperty") + set(`value`) { + setDofBlurAmount(value) + } + + /** + * The minimum sensitivity (in ISO) used when calculating auto exposure. When calculating scene + * average luminance, color values will be clamped to at least this value. This limits the + * auto-exposure from exposing above a certain brightness, resulting in a cut off point where the + * scene will remain dark. + */ + public final inline var autoExposureMinSensitivity: Float + @JvmName("autoExposureMinSensitivityProperty") + get() = getAutoExposureMinSensitivity() + @JvmName("autoExposureMinSensitivityProperty") + set(`value`) { + setAutoExposureMinSensitivity(value) + } + + /** + * The maximum sensitivity (in ISO) used when calculating auto exposure. When calculating scene + * average luminance, color values will be clamped to at least this value. This limits the + * auto-exposure from exposing below a certain brightness, resulting in a cut off point where the + * scene will remain bright. + */ + public final inline var autoExposureMaxSensitivity: Float + @JvmName("autoExposureMaxSensitivityProperty") + get() = getAutoExposureMaxSensitivity() + @JvmName("autoExposureMaxSensitivityProperty") + set(`value`) { + setAutoExposureMaxSensitivity(value) + } + + public override fun new(scriptIndex: Int): Unit { + Internals.callConstructor(this, ENGINE_CLASS_CAMERAATTRIBUTESPRACTICAL_INDEX, scriptIndex) + } + + public final fun setDofBlurFarEnabled(enabled: Boolean): Unit { + Internals.writeArguments(BOOL to enabled) + Internals.callMethod(rawPtr, MethodBindings.setDofBlurFarEnabledPtr, NIL) + } + + public final fun isDofBlurFarEnabled(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isDofBlurFarEnabledPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public final fun setDofBlurFarDistance(distance: Float): Unit { + Internals.writeArguments(DOUBLE to distance.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setDofBlurFarDistancePtr, NIL) + } + + public final fun getDofBlurFarDistance(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getDofBlurFarDistancePtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setDofBlurFarTransition(distance: Float): Unit { + Internals.writeArguments(DOUBLE to distance.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setDofBlurFarTransitionPtr, NIL) + } + + public final fun getDofBlurFarTransition(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getDofBlurFarTransitionPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setDofBlurNearEnabled(enabled: Boolean): Unit { + Internals.writeArguments(BOOL to enabled) + Internals.callMethod(rawPtr, MethodBindings.setDofBlurNearEnabledPtr, NIL) + } + + public final fun isDofBlurNearEnabled(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isDofBlurNearEnabledPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public final fun setDofBlurNearDistance(distance: Float): Unit { + Internals.writeArguments(DOUBLE to distance.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setDofBlurNearDistancePtr, NIL) + } + + public final fun getDofBlurNearDistance(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getDofBlurNearDistancePtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setDofBlurNearTransition(distance: Float): Unit { + Internals.writeArguments(DOUBLE to distance.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setDofBlurNearTransitionPtr, NIL) + } + + public final fun getDofBlurNearTransition(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getDofBlurNearTransitionPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setDofBlurAmount(amount: Float): Unit { + Internals.writeArguments(DOUBLE to amount.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setDofBlurAmountPtr, NIL) + } + + public final fun getDofBlurAmount(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getDofBlurAmountPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setAutoExposureMaxSensitivity(maxSensitivity: Float): Unit { + Internals.writeArguments(DOUBLE to maxSensitivity.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setAutoExposureMaxSensitivityPtr, NIL) + } + + public final fun getAutoExposureMaxSensitivity(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getAutoExposureMaxSensitivityPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setAutoExposureMinSensitivity(minSensitivity: Float): Unit { + Internals.writeArguments(DOUBLE to minSensitivity.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setAutoExposureMinSensitivityPtr, NIL) + } + + public final fun getAutoExposureMinSensitivity(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getAutoExposureMinSensitivityPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public companion object + + public object MethodBindings { + internal val setDofBlurFarEnabledPtr: VoidPtr = + Internals.getMethodBindPtr("CameraAttributesPractical", "set_dof_blur_far_enabled", 2586408642) + + internal val isDofBlurFarEnabledPtr: VoidPtr = + Internals.getMethodBindPtr("CameraAttributesPractical", "is_dof_blur_far_enabled", 36873697) + + internal val setDofBlurFarDistancePtr: VoidPtr = + Internals.getMethodBindPtr("CameraAttributesPractical", "set_dof_blur_far_distance", 373806689) + + internal val getDofBlurFarDistancePtr: VoidPtr = + Internals.getMethodBindPtr("CameraAttributesPractical", "get_dof_blur_far_distance", 1740695150) + + internal val setDofBlurFarTransitionPtr: VoidPtr = + Internals.getMethodBindPtr("CameraAttributesPractical", "set_dof_blur_far_transition", 373806689) + + internal val getDofBlurFarTransitionPtr: VoidPtr = + Internals.getMethodBindPtr("CameraAttributesPractical", "get_dof_blur_far_transition", 1740695150) + + internal val setDofBlurNearEnabledPtr: VoidPtr = + Internals.getMethodBindPtr("CameraAttributesPractical", "set_dof_blur_near_enabled", 2586408642) + + internal val isDofBlurNearEnabledPtr: VoidPtr = + Internals.getMethodBindPtr("CameraAttributesPractical", "is_dof_blur_near_enabled", 36873697) + + internal val setDofBlurNearDistancePtr: VoidPtr = + Internals.getMethodBindPtr("CameraAttributesPractical", "set_dof_blur_near_distance", 373806689) + + internal val getDofBlurNearDistancePtr: VoidPtr = + Internals.getMethodBindPtr("CameraAttributesPractical", "get_dof_blur_near_distance", 1740695150) + + internal val setDofBlurNearTransitionPtr: VoidPtr = + Internals.getMethodBindPtr("CameraAttributesPractical", "set_dof_blur_near_transition", 373806689) + + internal val getDofBlurNearTransitionPtr: VoidPtr = + Internals.getMethodBindPtr("CameraAttributesPractical", "get_dof_blur_near_transition", 1740695150) + + internal val setDofBlurAmountPtr: VoidPtr = + Internals.getMethodBindPtr("CameraAttributesPractical", "set_dof_blur_amount", 373806689) + + internal val getDofBlurAmountPtr: VoidPtr = + Internals.getMethodBindPtr("CameraAttributesPractical", "get_dof_blur_amount", 1740695150) + + internal val setAutoExposureMaxSensitivityPtr: VoidPtr = + Internals.getMethodBindPtr("CameraAttributesPractical", "set_auto_exposure_max_sensitivity", 373806689) + + internal val getAutoExposureMaxSensitivityPtr: VoidPtr = + Internals.getMethodBindPtr("CameraAttributesPractical", "get_auto_exposure_max_sensitivity", 1740695150) + + internal val setAutoExposureMinSensitivityPtr: VoidPtr = + Internals.getMethodBindPtr("CameraAttributesPractical", "set_auto_exposure_min_sensitivity", 373806689) + + internal val getAutoExposureMinSensitivityPtr: VoidPtr = + Internals.getMethodBindPtr("CameraAttributesPractical", "get_auto_exposure_min_sensitivity", 1740695150) + } +} diff --git a/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/CameraFeed.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/CameraFeed.kt new file mode 100644 index 0000000000..774e7a8c73 --- /dev/null +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/CameraFeed.kt @@ -0,0 +1,233 @@ +// THIS FILE IS GENERATED! DO NOT EDIT IT MANUALLY! +@file:Suppress("PackageDirectoryMismatch", "unused", "FunctionName", "RedundantModalityModifier", + "UNCHECKED_CAST", "JoinDeclarationAndAssignment", "USELESS_CAST", + "RemoveRedundantQualifierName", "NOTHING_TO_INLINE", "NON_FINAL_MEMBER_IN_OBJECT", + "RedundantVisibilityModifier", "RedundantUnitReturnType", "MemberVisibilityCanBePrivate") + +package godot + +import godot.`annotation`.CoreTypeHelper +import godot.`annotation`.CoreTypeLocalCopy +import godot.`annotation`.GodotBaseType +import godot.core.Transform2D +import godot.core.VariantParser.BOOL +import godot.core.VariantParser.LONG +import godot.core.VariantParser.NIL +import godot.core.VariantParser.STRING +import godot.core.VariantParser.TRANSFORM2D +import godot.util.Internals +import godot.util.VoidPtr +import kotlin.Boolean +import kotlin.Int +import kotlin.Long +import kotlin.String +import kotlin.Suppress +import kotlin.Unit +import kotlin.jvm.JvmName + +private const val ENGINE_CLASS_CAMERAFEED_INDEX: Int = 166 + +/** + * A camera feed gives you access to a single physical camera attached to your device. When enabled, + * Godot will start capturing frames from the camera which can then be used. See also [CameraServer]. + * **Note:** Many cameras will return YCbCr images which are split into two textures and need to be + * combined in a shader. Godot does this automatically for you if you set the environment to show the + * camera image in the background. + */ +@GodotBaseType +public open class CameraFeed : RefCounted() { + /** + * If `true`, the feed is active. + */ + public final inline var feedIsActive: Boolean + @JvmName("feedIsActiveProperty") + get() = isActive() + @JvmName("feedIsActiveProperty") + set(`value`) { + setActive(value) + } + + /** + * The transform applied to the camera's image. + */ + @CoreTypeLocalCopy + public final inline var feedTransform: Transform2D + @JvmName("feedTransformProperty") + get() = getTransform() + @JvmName("feedTransformProperty") + set(`value`) { + setTransform(value) + } + + public override fun new(scriptIndex: Int): Unit { + Internals.callConstructor(this, ENGINE_CLASS_CAMERAFEED_INDEX, scriptIndex) + } + + /** + * The transform applied to the camera's image. + * + * This is a helper function to make dealing with local copies easier. + * + * For more information, see our + * [documentation](https://godot-kotl.in/en/stable/user-guide/api-differences/#core-types). + * + * Allow to directly modify the local copy of the property and assign it back to the Object. + * + * Prefer that over writing: + * `````` + * val myCoreType = camerafeed.feedTransform + * //Your changes + * camerafeed.feedTransform = myCoreType + * `````` + */ + @CoreTypeHelper + public final fun feedTransformMutate(block: Transform2D.() -> Unit): Transform2D = + feedTransform.apply{ + block(this) + feedTransform = this + } + + + /** + * Returns the unique ID for this feed. + */ + public final fun getId(): Int { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getIdPtr, LONG) + return (Internals.readReturnValue(LONG) as Long).toInt() + } + + public final fun isActive(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isActivePtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public final fun setActive(active: Boolean): Unit { + Internals.writeArguments(BOOL to active) + Internals.callMethod(rawPtr, MethodBindings.setActivePtr, NIL) + } + + /** + * Returns the camera's name. + */ + public final fun getName(): String { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getNamePtr, STRING) + return (Internals.readReturnValue(STRING) as String) + } + + /** + * Returns the position of camera on the device. + */ + public final fun getPosition(): FeedPosition { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getPositionPtr, LONG) + return CameraFeed.FeedPosition.from(Internals.readReturnValue(LONG) as Long) + } + + public final fun getTransform(): Transform2D { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getTransformPtr, TRANSFORM2D) + return (Internals.readReturnValue(TRANSFORM2D) as Transform2D) + } + + public final fun setTransform(transform: Transform2D): Unit { + Internals.writeArguments(TRANSFORM2D to transform) + Internals.callMethod(rawPtr, MethodBindings.setTransformPtr, NIL) + } + + /** + * Returns feed image data type. + */ + public final fun getDatatype(): FeedDataType { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getDatatypePtr, LONG) + return CameraFeed.FeedDataType.from(Internals.readReturnValue(LONG) as Long) + } + + public enum class FeedDataType( + id: Long, + ) { + /** + * No image set for the feed. + */ + FEED_NOIMAGE(0), + /** + * Feed supplies RGB images. + */ + FEED_RGB(1), + /** + * Feed supplies YCbCr images that need to be converted to RGB. + */ + FEED_YCBCR(2), + /** + * Feed supplies separate Y and CbCr images that need to be combined and converted to RGB. + */ + FEED_YCBCR_SEP(3), + ; + + public val id: Long + init { + this.id = id + } + + public companion object { + public fun from(`value`: Long): FeedDataType = entries.single { it.id == `value` } + } + } + + public enum class FeedPosition( + id: Long, + ) { + /** + * Unspecified position. + */ + FEED_UNSPECIFIED(0), + /** + * Camera is mounted at the front of the device. + */ + FEED_FRONT(1), + /** + * Camera is mounted at the back of the device. + */ + FEED_BACK(2), + ; + + public val id: Long + init { + this.id = id + } + + public companion object { + public fun from(`value`: Long): FeedPosition = entries.single { it.id == `value` } + } + } + + public companion object + + public object MethodBindings { + internal val getIdPtr: VoidPtr = Internals.getMethodBindPtr("CameraFeed", "get_id", 3905245786) + + internal val isActivePtr: VoidPtr = + Internals.getMethodBindPtr("CameraFeed", "is_active", 36873697) + + internal val setActivePtr: VoidPtr = + Internals.getMethodBindPtr("CameraFeed", "set_active", 2586408642) + + internal val getNamePtr: VoidPtr = + Internals.getMethodBindPtr("CameraFeed", "get_name", 201670096) + + internal val getPositionPtr: VoidPtr = + Internals.getMethodBindPtr("CameraFeed", "get_position", 2711679033) + + internal val getTransformPtr: VoidPtr = + Internals.getMethodBindPtr("CameraFeed", "get_transform", 3814499831) + + internal val setTransformPtr: VoidPtr = + Internals.getMethodBindPtr("CameraFeed", "set_transform", 2761652528) + + internal val getDatatypePtr: VoidPtr = + Internals.getMethodBindPtr("CameraFeed", "get_datatype", 1477782850) + } +} diff --git a/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/CameraServer.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/CameraServer.kt new file mode 100644 index 0000000000..a713a294dc --- /dev/null +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/CameraServer.kt @@ -0,0 +1,147 @@ +// THIS FILE IS GENERATED! DO NOT EDIT IT MANUALLY! +@file:Suppress("PackageDirectoryMismatch", "unused", "FunctionName", "RedundantModalityModifier", + "UNCHECKED_CAST", "JoinDeclarationAndAssignment", "USELESS_CAST", + "RemoveRedundantQualifierName", "NOTHING_TO_INLINE", "NON_FINAL_MEMBER_IN_OBJECT", + "RedundantVisibilityModifier", "RedundantUnitReturnType", "MemberVisibilityCanBePrivate") + +package godot + +import godot.`annotation`.GodotBaseType +import godot.core.Signal1 +import godot.core.VariantArray +import godot.core.VariantParser.ARRAY +import godot.core.VariantParser.LONG +import godot.core.VariantParser.NIL +import godot.core.VariantParser.OBJECT +import godot.util.Internals +import godot.util.VoidPtr +import kotlin.Int +import kotlin.Long +import kotlin.Suppress +import kotlin.Unit +import kotlin.jvm.JvmStatic + +private const val ENGINE_CLASS_CAMERASERVER_INDEX: Int = 29 + +/** + * The [CameraServer] keeps track of different cameras accessible in Godot. These are external + * cameras such as webcams or the cameras on your phone. + * It is notably used to provide AR modules with a video feed from the camera. + * **Note:** This class is currently only implemented on macOS and iOS. To get a [CameraFeed] on + * iOS, the camera plugin from + * [url=https://github.com/godotengine/godot-ios-plugins]godot-ios-plugins[/url] is required. On other + * platforms, no [CameraFeed]s will be available. + */ +@GodotBaseType +public object CameraServer : Object() { + /** + * Emitted when a [CameraFeed] is added (e.g. a webcam is plugged in). + */ + @JvmStatic + public val cameraFeedAdded: Signal1 by Signal1 + + /** + * Emitted when a [CameraFeed] is removed (e.g. a webcam is unplugged). + */ + @JvmStatic + public val cameraFeedRemoved: Signal1 by Signal1 + + public override fun new(scriptIndex: Int): Unit { + Internals.getSingleton(this, ENGINE_CLASS_CAMERASERVER_INDEX) + } + + /** + * Returns the [CameraFeed] corresponding to the camera with the given [index]. + */ + @JvmStatic + public final fun getFeed(index: Int): CameraFeed? { + Internals.writeArguments(LONG to index.toLong()) + Internals.callMethod(rawPtr, MethodBindings.getFeedPtr, OBJECT) + return (Internals.readReturnValue(OBJECT) as CameraFeed?) + } + + /** + * Returns the number of [CameraFeed]s registered. + */ + @JvmStatic + public final fun getFeedCount(): Int { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getFeedCountPtr, LONG) + return (Internals.readReturnValue(LONG) as Long).toInt() + } + + /** + * Returns an array of [CameraFeed]s. + */ + @JvmStatic + public final fun feeds(): VariantArray { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.feedsPtr, ARRAY) + return (Internals.readReturnValue(ARRAY) as VariantArray) + } + + /** + * Adds the camera [feed] to the camera server. + */ + @JvmStatic + public final fun addFeed(feed: CameraFeed?): Unit { + Internals.writeArguments(OBJECT to feed) + Internals.callMethod(rawPtr, MethodBindings.addFeedPtr, NIL) + } + + /** + * Removes the specified camera [feed]. + */ + @JvmStatic + public final fun removeFeed(feed: CameraFeed?): Unit { + Internals.writeArguments(OBJECT to feed) + Internals.callMethod(rawPtr, MethodBindings.removeFeedPtr, NIL) + } + + public enum class FeedImage( + id: Long, + ) { + /** + * The RGBA camera image. + */ + FEED_RGBA_IMAGE(0), + /** + * The [url=https://en.wikipedia.org/wiki/YCbCr]YCbCr[/url] camera image. + */ + FEED_YCBCR_IMAGE(0), + /** + * The Y component camera image. + */ + FEED_Y_IMAGE(0), + /** + * The CbCr component camera image. + */ + FEED_CBCR_IMAGE(1), + ; + + public val id: Long + init { + this.id = id + } + + public companion object { + public fun from(`value`: Long): FeedImage = entries.single { it.id == `value` } + } + } + + public object MethodBindings { + internal val getFeedPtr: VoidPtr = + Internals.getMethodBindPtr("CameraServer", "get_feed", 361927068) + + internal val getFeedCountPtr: VoidPtr = + Internals.getMethodBindPtr("CameraServer", "get_feed_count", 2455072627) + + internal val feedsPtr: VoidPtr = Internals.getMethodBindPtr("CameraServer", "feeds", 2915620761) + + internal val addFeedPtr: VoidPtr = + Internals.getMethodBindPtr("CameraServer", "add_feed", 3204782488) + + internal val removeFeedPtr: VoidPtr = + Internals.getMethodBindPtr("CameraServer", "remove_feed", 3204782488) + } +} diff --git a/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/CameraTexture.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/CameraTexture.kt new file mode 100644 index 0000000000..df2a41fc28 --- /dev/null +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/CameraTexture.kt @@ -0,0 +1,122 @@ +// THIS FILE IS GENERATED! DO NOT EDIT IT MANUALLY! +@file:Suppress("PackageDirectoryMismatch", "unused", "FunctionName", "RedundantModalityModifier", + "UNCHECKED_CAST", "JoinDeclarationAndAssignment", "USELESS_CAST", + "RemoveRedundantQualifierName", "NOTHING_TO_INLINE", "NON_FINAL_MEMBER_IN_OBJECT", + "RedundantVisibilityModifier", "RedundantUnitReturnType", "MemberVisibilityCanBePrivate") + +package godot + +import godot.`annotation`.GodotBaseType +import godot.core.VariantParser.BOOL +import godot.core.VariantParser.LONG +import godot.core.VariantParser.NIL +import godot.util.Internals +import godot.util.VoidPtr +import kotlin.Boolean +import kotlin.Int +import kotlin.Long +import kotlin.Suppress +import kotlin.Unit +import kotlin.jvm.JvmName + +private const val ENGINE_CLASS_CAMERATEXTURE_INDEX: Int = 167 + +/** + * This texture gives access to the camera texture provided by a [CameraFeed]. + * **Note:** Many cameras supply YCbCr images which need to be converted in a shader. + */ +@GodotBaseType +public open class CameraTexture : Texture2D() { + /** + * The ID of the [CameraFeed] for which we want to display the image. + */ + public final inline var cameraFeedId: Int + @JvmName("cameraFeedIdProperty") + get() = getCameraFeedId() + @JvmName("cameraFeedIdProperty") + set(`value`) { + setCameraFeedId(value) + } + + /** + * Which image within the [CameraFeed] we want access to, important if the camera image is split + * in a Y and CbCr component. + */ + public final inline var whichFeed: CameraServer.FeedImage + @JvmName("whichFeedProperty") + get() = getWhichFeed() + @JvmName("whichFeedProperty") + set(`value`) { + setWhichFeed(value) + } + + /** + * Convenience property that gives access to the active property of the [CameraFeed]. + */ + public final inline var cameraIsActive: Boolean + @JvmName("cameraIsActiveProperty") + get() = getCameraActive() + @JvmName("cameraIsActiveProperty") + set(`value`) { + setCameraActive(value) + } + + public override fun new(scriptIndex: Int): Unit { + Internals.callConstructor(this, ENGINE_CLASS_CAMERATEXTURE_INDEX, scriptIndex) + } + + public final fun setCameraFeedId(feedId: Int): Unit { + Internals.writeArguments(LONG to feedId.toLong()) + Internals.callMethod(rawPtr, MethodBindings.setCameraFeedIdPtr, NIL) + } + + public final fun getCameraFeedId(): Int { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getCameraFeedIdPtr, LONG) + return (Internals.readReturnValue(LONG) as Long).toInt() + } + + public final fun setWhichFeed(whichFeed: CameraServer.FeedImage): Unit { + Internals.writeArguments(LONG to whichFeed.id) + Internals.callMethod(rawPtr, MethodBindings.setWhichFeedPtr, NIL) + } + + public final fun getWhichFeed(): CameraServer.FeedImage { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getWhichFeedPtr, LONG) + return CameraServer.FeedImage.from(Internals.readReturnValue(LONG) as Long) + } + + public final fun setCameraActive(active: Boolean): Unit { + Internals.writeArguments(BOOL to active) + Internals.callMethod(rawPtr, MethodBindings.setCameraActivePtr, NIL) + } + + public final fun getCameraActive(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getCameraActivePtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public companion object + + public object MethodBindings { + internal val setCameraFeedIdPtr: VoidPtr = + Internals.getMethodBindPtr("CameraTexture", "set_camera_feed_id", 1286410249) + + internal val getCameraFeedIdPtr: VoidPtr = + Internals.getMethodBindPtr("CameraTexture", "get_camera_feed_id", 3905245786) + + internal val setWhichFeedPtr: VoidPtr = + Internals.getMethodBindPtr("CameraTexture", "set_which_feed", 1595299230) + + internal val getWhichFeedPtr: VoidPtr = + Internals.getMethodBindPtr("CameraTexture", "get_which_feed", 91039457) + + internal val setCameraActivePtr: VoidPtr = + Internals.getMethodBindPtr("CameraTexture", "set_camera_active", 2586408642) + + internal val getCameraActivePtr: VoidPtr = + Internals.getMethodBindPtr("CameraTexture", "get_camera_active", 36873697) + } +} diff --git a/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/CanvasGroup.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/CanvasGroup.kt new file mode 100644 index 0000000000..412e7da289 --- /dev/null +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/CanvasGroup.kt @@ -0,0 +1,156 @@ +// THIS FILE IS GENERATED! DO NOT EDIT IT MANUALLY! +@file:Suppress("PackageDirectoryMismatch", "unused", "FunctionName", "RedundantModalityModifier", + "UNCHECKED_CAST", "JoinDeclarationAndAssignment", "USELESS_CAST", + "RemoveRedundantQualifierName", "NOTHING_TO_INLINE", "NON_FINAL_MEMBER_IN_OBJECT", + "RedundantVisibilityModifier", "RedundantUnitReturnType", "MemberVisibilityCanBePrivate") + +package godot + +import godot.`annotation`.GodotBaseType +import godot.core.VariantParser.BOOL +import godot.core.VariantParser.DOUBLE +import godot.core.VariantParser.NIL +import godot.util.Internals +import godot.util.VoidPtr +import kotlin.Boolean +import kotlin.Double +import kotlin.Float +import kotlin.Int +import kotlin.Suppress +import kotlin.Unit +import kotlin.jvm.JvmName + +private const val ENGINE_CLASS_CANVASGROUP_INDEX: Int = 168 + +/** + * Child [CanvasItem] nodes of a [CanvasGroup] are drawn as a single object. It allows to e.g. draw + * overlapping translucent 2D nodes without blending (set [CanvasItem.selfModulate] property of + * [CanvasGroup] to achieve this effect). + * **Note:** The [CanvasGroup] uses a custom shader to read from the backbuffer to draw its + * children. Assigning a [Material] to the [CanvasGroup] overrides the builtin shader. To duplicate the + * behavior of the builtin shader in a custom [Shader] use the following: + * [codeblock] + * shader_type canvas_item; + * render_mode unshaded; + * + * uniform sampler2D screen_texture : hint_screen_texture, repeat_disable, filter_nearest; + * + * void fragment() { + * vec4 c = textureLod(screen_texture, SCREEN_UV, 0.0); + * + * if (c.a > 0.0001) { + * c.rgb /= c.a; + * } + * + * COLOR *= c; + * } + * [/codeblock] + * **Note:** Since [CanvasGroup] and [CanvasItem.clipChildren] both utilize the backbuffer, children + * of a [CanvasGroup] who have their [CanvasItem.clipChildren] set to anything other than + * [CanvasItem.CLIP_CHILDREN_DISABLED] will not function correctly. + */ +@GodotBaseType +public open class CanvasGroup : Node2D() { + /** + * Sets the size of a margin used to expand the drawable rect of this [CanvasGroup]. The size of + * the [CanvasGroup] is determined by fitting a rect around its children then expanding that rect by + * [fitMargin]. This increases both the backbuffer area used and the area covered by the + * [CanvasGroup] both of which can reduce performance. This should be kept as small as possible and + * should only be expanded when an increased size is needed (e.g. for custom shader effects). + */ + public final inline var fitMargin: Float + @JvmName("fitMarginProperty") + get() = getFitMargin() + @JvmName("fitMarginProperty") + set(`value`) { + setFitMargin(value) + } + + /** + * Sets the size of the margin used to expand the clearing rect of this [CanvasGroup]. This + * expands the area of the backbuffer that will be used by the [CanvasGroup]. A smaller margin will + * reduce the area of the backbuffer used which can increase performance, however if [useMipmaps] is + * enabled, a small margin may result in mipmap errors at the edge of the [CanvasGroup]. Accordingly, + * this should be left as small as possible, but should be increased if artifacts appear along the + * edges of the canvas group. + */ + public final inline var clearMargin: Float + @JvmName("clearMarginProperty") + get() = getClearMargin() + @JvmName("clearMarginProperty") + set(`value`) { + setClearMargin(value) + } + + /** + * If `true`, calculates mipmaps for the backbuffer before drawing the [CanvasGroup] so that + * mipmaps can be used in a custom [ShaderMaterial] attached to the [CanvasGroup]. Generating mipmaps + * has a performance cost so this should not be enabled unless required. + */ + public final inline var useMipmaps: Boolean + @JvmName("useMipmapsProperty") + get() = isUsingMipmaps() + @JvmName("useMipmapsProperty") + set(`value`) { + setUseMipmaps(value) + } + + public override fun new(scriptIndex: Int): Unit { + Internals.callConstructor(this, ENGINE_CLASS_CANVASGROUP_INDEX, scriptIndex) + } + + public final fun setFitMargin(fitMargin: Float): Unit { + Internals.writeArguments(DOUBLE to fitMargin.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setFitMarginPtr, NIL) + } + + public final fun getFitMargin(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getFitMarginPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setClearMargin(clearMargin: Float): Unit { + Internals.writeArguments(DOUBLE to clearMargin.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setClearMarginPtr, NIL) + } + + public final fun getClearMargin(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getClearMarginPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setUseMipmaps(useMipmaps: Boolean): Unit { + Internals.writeArguments(BOOL to useMipmaps) + Internals.callMethod(rawPtr, MethodBindings.setUseMipmapsPtr, NIL) + } + + public final fun isUsingMipmaps(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isUsingMipmapsPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public companion object + + public object MethodBindings { + internal val setFitMarginPtr: VoidPtr = + Internals.getMethodBindPtr("CanvasGroup", "set_fit_margin", 373806689) + + internal val getFitMarginPtr: VoidPtr = + Internals.getMethodBindPtr("CanvasGroup", "get_fit_margin", 1740695150) + + internal val setClearMarginPtr: VoidPtr = + Internals.getMethodBindPtr("CanvasGroup", "set_clear_margin", 373806689) + + internal val getClearMarginPtr: VoidPtr = + Internals.getMethodBindPtr("CanvasGroup", "get_clear_margin", 1740695150) + + internal val setUseMipmapsPtr: VoidPtr = + Internals.getMethodBindPtr("CanvasGroup", "set_use_mipmaps", 2586408642) + + internal val isUsingMipmapsPtr: VoidPtr = + Internals.getMethodBindPtr("CanvasGroup", "is_using_mipmaps", 36873697) + } +} diff --git a/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/CanvasItem.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/CanvasItem.kt new file mode 100644 index 0000000000..d06e7979cf --- /dev/null +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/CanvasItem.kt @@ -0,0 +1,1812 @@ +// THIS FILE IS GENERATED! DO NOT EDIT IT MANUALLY! +@file:Suppress("PackageDirectoryMismatch", "unused", "FunctionName", "RedundantModalityModifier", + "UNCHECKED_CAST", "JoinDeclarationAndAssignment", "USELESS_CAST", + "RemoveRedundantQualifierName", "NOTHING_TO_INLINE", "NON_FINAL_MEMBER_IN_OBJECT", + "RedundantVisibilityModifier", "RedundantUnitReturnType", "MemberVisibilityCanBePrivate") + +package godot + +import godot.`annotation`.CoreTypeHelper +import godot.`annotation`.CoreTypeLocalCopy +import godot.`annotation`.GodotBaseType +import godot.core.Color +import godot.core.PackedColorArray +import godot.core.PackedVector2Array +import godot.core.RID +import godot.core.Rect2 +import godot.core.Signal0 +import godot.core.Transform2D +import godot.core.VariantParser.BOOL +import godot.core.VariantParser.COLOR +import godot.core.VariantParser.DOUBLE +import godot.core.VariantParser.LONG +import godot.core.VariantParser.NIL +import godot.core.VariantParser.OBJECT +import godot.core.VariantParser.PACKED_COLOR_ARRAY +import godot.core.VariantParser.PACKED_VECTOR2_ARRAY +import godot.core.VariantParser.RECT2 +import godot.core.VariantParser.STRING +import godot.core.VariantParser.TRANSFORM2D +import godot.core.VariantParser.VECTOR2 +import godot.core.VariantParser._RID +import godot.core.Vector2 +import godot.util.Internals +import godot.util.VoidPtr +import kotlin.Boolean +import kotlin.Double +import kotlin.Float +import kotlin.Int +import kotlin.Long +import kotlin.String +import kotlin.Suppress +import kotlin.Unit +import kotlin.jvm.JvmName +import kotlin.jvm.JvmOverloads + +private const val ENGINE_CLASS_CANVASITEM_INDEX: Int = 169 + +/** + * Abstract base class for everything in 2D space. Canvas items are laid out in a tree; children + * inherit and extend their parent's transform. [CanvasItem] is extended by [Control] for GUI-related + * nodes, and by [Node2D] for 2D game objects. + * Any [CanvasItem] can draw. For this, [queueRedraw] is called by the engine, then + * [NOTIFICATION_DRAW] will be received on idle time to request a redraw. Because of this, canvas items + * don't need to be redrawn on every frame, improving the performance significantly. Several functions + * for drawing on the [CanvasItem] are provided (see `draw_*` functions). However, they can only be + * used inside [_draw], its corresponding [Object.Notification] or methods connected to the [signal + * draw] signal. + * Canvas items are drawn in tree order on their canvas layer. By default, children are on top of + * their parents, so a root [CanvasItem] will be drawn behind everything. This behavior can be changed + * on a per-item basis. + * A [CanvasItem] can be hidden, which will also hide its children. By adjusting various other + * properties of a [CanvasItem], you can also modulate its color (via [modulate] or [selfModulate]), + * change its Z-index, blend mode, and more. + * Note that properties like transform, modulation, and visibility are only propagated to *direct* + * [CanvasItem] child nodes. If there is a non-[CanvasItem] node in between, like [Node] or + * [AnimationPlayer], the [CanvasItem] nodes below will have an independent position and [modulate] + * chain. See also [topLevel]. + */ +@GodotBaseType +public open class CanvasItem internal constructor() : Node() { + /** + * Emitted when the [CanvasItem] must redraw, *after* the related [NOTIFICATION_DRAW] + * notification, and *before* [_draw] is called. + * **Note:** Deferred connections do not allow drawing through the `draw_*` methods. + */ + public val draw: Signal0 by Signal0 + + /** + * Emitted when the visibility (hidden/visible) changes. + */ + public val visibilityChanged: Signal0 by Signal0 + + /** + * Emitted when becoming hidden. + */ + public val hidden: Signal0 by Signal0 + + /** + * Emitted when the item's [Rect2] boundaries (position or size) have changed, or when an action + * is taking place that may have impacted these boundaries (e.g. changing [Sprite2D.texture]). + */ + public val itemRectChanged: Signal0 by Signal0 + + /** + * If `true`, this [CanvasItem] is drawn. The node is only visible if all of its ancestors are + * visible as well (in other words, [isVisibleInTree] must return `true`). + * **Note:** For controls that inherit [Popup], the correct way to make them visible is to call + * one of the multiple `popup*()` functions instead. + */ + public final inline var visible: Boolean + @JvmName("visibleProperty") + get() = isVisible() + @JvmName("visibleProperty") + set(`value`) { + setVisible(value) + } + + /** + * The color applied to this [CanvasItem]. This property does affect child [CanvasItem]s, unlike + * [selfModulate] which only affects the node itself. + */ + @CoreTypeLocalCopy + public final inline var modulate: Color + @JvmName("modulateProperty") + get() = getModulate() + @JvmName("modulateProperty") + set(`value`) { + setModulate(value) + } + + /** + * The color applied to this [CanvasItem]. This property does **not** affect child [CanvasItem]s, + * unlike [modulate] which affects both the node itself and its children. + * **Note:** Internal children (e.g. sliders in [ColorPicker] or tab bar in [TabContainer]) are + * also not affected by this property (see `include_internal` parameter of [Node.getChild] and other + * similar methods). + */ + @CoreTypeLocalCopy + public final inline var selfModulate: Color + @JvmName("selfModulateProperty") + get() = getSelfModulate() + @JvmName("selfModulateProperty") + set(`value`) { + setSelfModulate(value) + } + + /** + * If `true`, the object draws behind its parent. + */ + public final inline var showBehindParent: Boolean + @JvmName("showBehindParentProperty") + get() = isDrawBehindParentEnabled() + @JvmName("showBehindParentProperty") + set(`value`) { + setDrawBehindParent(value) + } + + /** + * If `true`, this [CanvasItem] will *not* inherit its transform from parent [CanvasItem]s. Its + * draw order will also be changed to make it draw on top of other [CanvasItem]s that do not have + * [topLevel] set to `true`. The [CanvasItem] will effectively act as if it was placed as a child of + * a bare [Node]. + */ + public final inline var topLevel: Boolean + @JvmName("topLevelProperty") + get() = isSetAsTopLevel() + @JvmName("topLevelProperty") + set(`value`) { + setAsTopLevel(value) + } + + /** + * Allows the current node to clip child nodes, essentially acting as a mask. + */ + public final inline var clipChildren: ClipChildrenMode + @JvmName("clipChildrenProperty") + get() = getClipChildrenMode() + @JvmName("clipChildrenProperty") + set(`value`) { + setClipChildrenMode(value) + } + + /** + * The rendering layers in which this [CanvasItem] responds to [Light2D] nodes. + */ + public final inline var lightMask: Int + @JvmName("lightMaskProperty") + get() = getLightMask() + @JvmName("lightMaskProperty") + set(`value`) { + setLightMask(value) + } + + /** + * The rendering layer in which this [CanvasItem] is rendered by [Viewport] nodes. A [Viewport] + * will render a [CanvasItem] if it and all its parents share a layer with the [Viewport]'s canvas + * cull mask. + */ + public final inline var visibilityLayer: Long + @JvmName("visibilityLayerProperty") + get() = getVisibilityLayer() + @JvmName("visibilityLayerProperty") + set(`value`) { + setVisibilityLayer(value) + } + + /** + * Controls the order in which the nodes render. A node with a higher Z index will display in + * front of others. Must be between [RenderingServer.CANVAS_ITEM_Z_MIN] and + * [RenderingServer.CANVAS_ITEM_Z_MAX] (inclusive). + * **Note:** Changing the Z index of a [Control] only affects the drawing order, not the order in + * which input events are handled. This can be useful to implement certain UI animations, e.g. a menu + * where hovered items are scaled and should overlap others. + */ + public final inline var zIndex: Int + @JvmName("zIndexProperty") + get() = getZIndex() + @JvmName("zIndexProperty") + set(`value`) { + setZIndex(value) + } + + /** + * If `true`, the node's Z index is relative to its parent's Z index. If this node's Z index is 2 + * and its parent's effective Z index is 3, then this node's effective Z index will be 2 + 3 = 5. + */ + public final inline var zAsRelative: Boolean + @JvmName("zAsRelativeProperty") + get() = isZRelative() + @JvmName("zAsRelativeProperty") + set(`value`) { + setZAsRelative(value) + } + + /** + * If `true`, this and child [CanvasItem] nodes with a higher Y position are rendered in front of + * nodes with a lower Y position. If `false`, this and child [CanvasItem] nodes are rendered normally + * in scene tree order. + * With Y-sorting enabled on a parent node ('A') but disabled on a child node ('B'), the child + * node ('B') is sorted but its children ('C1', 'C2', etc) render together on the same Y position as + * the child node ('B'). This allows you to organize the render order of a scene without changing the + * scene tree. + * Nodes sort relative to each other only if they are on the same [zIndex]. + */ + public final inline var ySortEnabled: Boolean + @JvmName("ySortEnabledProperty") + get() = isYSortEnabled() + @JvmName("ySortEnabledProperty") + set(`value`) { + setYSortEnabled(value) + } + + /** + * The texture filtering mode to use on this [CanvasItem]. + */ + public final inline var textureFilter: TextureFilter + @JvmName("textureFilterProperty") + get() = getTextureFilter() + @JvmName("textureFilterProperty") + set(`value`) { + setTextureFilter(value) + } + + /** + * The texture repeating mode to use on this [CanvasItem]. + */ + public final inline var textureRepeat: TextureRepeat + @JvmName("textureRepeatProperty") + get() = getTextureRepeat() + @JvmName("textureRepeatProperty") + set(`value`) { + setTextureRepeat(value) + } + + /** + * The material applied to this [CanvasItem]. + */ + public final inline var material: Material? + @JvmName("materialProperty") + get() = getMaterial() + @JvmName("materialProperty") + set(`value`) { + setMaterial(value) + } + + /** + * If `true`, the parent [CanvasItem]'s [material] property is used as this one's material. + */ + public final inline var useParentMaterial: Boolean + @JvmName("useParentMaterialProperty") + get() = getUseParentMaterial() + @JvmName("useParentMaterialProperty") + set(`value`) { + setUseParentMaterial(value) + } + + public override fun new(scriptIndex: Int): Unit { + Internals.callConstructor(this, ENGINE_CLASS_CANVASITEM_INDEX, scriptIndex) + } + + /** + * The color applied to this [CanvasItem]. This property does affect child [CanvasItem]s, unlike + * [selfModulate] which only affects the node itself. + * + * This is a helper function to make dealing with local copies easier. + * + * For more information, see our + * [documentation](https://godot-kotl.in/en/stable/user-guide/api-differences/#core-types). + * + * Allow to directly modify the local copy of the property and assign it back to the Object. + * + * Prefer that over writing: + * `````` + * val myCoreType = canvasitem.modulate + * //Your changes + * canvasitem.modulate = myCoreType + * `````` + */ + @CoreTypeHelper + public final fun modulateMutate(block: Color.() -> Unit): Color = modulate.apply{ + block(this) + modulate = this + } + + + /** + * The color applied to this [CanvasItem]. This property does **not** affect child [CanvasItem]s, + * unlike [modulate] which affects both the node itself and its children. + * **Note:** Internal children (e.g. sliders in [ColorPicker] or tab bar in [TabContainer]) are + * also not affected by this property (see `include_internal` parameter of [Node.getChild] and other + * similar methods). + * + * This is a helper function to make dealing with local copies easier. + * + * For more information, see our + * [documentation](https://godot-kotl.in/en/stable/user-guide/api-differences/#core-types). + * + * Allow to directly modify the local copy of the property and assign it back to the Object. + * + * Prefer that over writing: + * `````` + * val myCoreType = canvasitem.selfModulate + * //Your changes + * canvasitem.selfModulate = myCoreType + * `````` + */ + @CoreTypeHelper + public final fun selfModulateMutate(block: Color.() -> Unit): Color = selfModulate.apply{ + block(this) + selfModulate = this + } + + + /** + * Called when [CanvasItem] has been requested to redraw (after [queueRedraw] is called, either + * manually or by the engine). + * Corresponds to the [NOTIFICATION_DRAW] notification in [Object.Notification]. + */ + public open fun _draw(): Unit { + } + + /** + * Returns the canvas item RID used by [RenderingServer] for this item. + */ + public final fun getCanvasItem(): RID { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getCanvasItemPtr, _RID) + return (Internals.readReturnValue(_RID) as RID) + } + + public final fun setVisible(visible: Boolean): Unit { + Internals.writeArguments(BOOL to visible) + Internals.callMethod(rawPtr, MethodBindings.setVisiblePtr, NIL) + } + + public final fun isVisible(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isVisiblePtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + /** + * Returns `true` if the node is present in the [SceneTree], its [visible] property is `true` and + * all its ancestors are also visible. If any ancestor is hidden, this node will not be visible in + * the scene tree, and is therefore not drawn (see [_draw]). + * Visibility is checked only in parent nodes that inherit from [CanvasItem], [CanvasLayer], and + * [Window]. If the parent is of any other type (such as [Node], [AnimationPlayer], or [Node3D]), it + * is assumed to be visible. + */ + public final fun isVisibleInTree(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isVisibleInTreePtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + /** + * Show the [CanvasItem] if it's currently hidden. This is equivalent to setting [visible] to + * `true`. For controls that inherit [Popup], the correct way to make them visible is to call one of + * the multiple `popup*()` functions instead. + */ + public final fun show(): Unit { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.showPtr, NIL) + } + + /** + * Hide the [CanvasItem] if it's currently visible. This is equivalent to setting [visible] to + * `false`. + */ + public final fun hide(): Unit { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.hidePtr, NIL) + } + + /** + * Queues the [CanvasItem] to redraw. During idle time, if [CanvasItem] is visible, + * [NOTIFICATION_DRAW] is sent and [_draw] is called. This only occurs **once** per frame, even if + * this method has been called multiple times. + */ + public final fun queueRedraw(): Unit { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.queueRedrawPtr, NIL) + } + + /** + * Moves this node to display on top of its siblings. + * Internally, the node is moved to the bottom of parent's child list. The method has no effect on + * nodes without a parent. + */ + public final fun moveToFront(): Unit { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.moveToFrontPtr, NIL) + } + + public final fun setAsTopLevel(enable: Boolean): Unit { + Internals.writeArguments(BOOL to enable) + Internals.callMethod(rawPtr, MethodBindings.setAsTopLevelPtr, NIL) + } + + public final fun isSetAsTopLevel(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isSetAsTopLevelPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public final fun setLightMask(lightMask: Int): Unit { + Internals.writeArguments(LONG to lightMask.toLong()) + Internals.callMethod(rawPtr, MethodBindings.setLightMaskPtr, NIL) + } + + public final fun getLightMask(): Int { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getLightMaskPtr, LONG) + return (Internals.readReturnValue(LONG) as Long).toInt() + } + + public final fun setModulate(modulate: Color): Unit { + Internals.writeArguments(COLOR to modulate) + Internals.callMethod(rawPtr, MethodBindings.setModulatePtr, NIL) + } + + public final fun getModulate(): Color { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getModulatePtr, COLOR) + return (Internals.readReturnValue(COLOR) as Color) + } + + public final fun setSelfModulate(selfModulate: Color): Unit { + Internals.writeArguments(COLOR to selfModulate) + Internals.callMethod(rawPtr, MethodBindings.setSelfModulatePtr, NIL) + } + + public final fun getSelfModulate(): Color { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getSelfModulatePtr, COLOR) + return (Internals.readReturnValue(COLOR) as Color) + } + + public final fun setZIndex(zIndex: Int): Unit { + Internals.writeArguments(LONG to zIndex.toLong()) + Internals.callMethod(rawPtr, MethodBindings.setZIndexPtr, NIL) + } + + public final fun getZIndex(): Int { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getZIndexPtr, LONG) + return (Internals.readReturnValue(LONG) as Long).toInt() + } + + public final fun setZAsRelative(enable: Boolean): Unit { + Internals.writeArguments(BOOL to enable) + Internals.callMethod(rawPtr, MethodBindings.setZAsRelativePtr, NIL) + } + + public final fun isZRelative(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isZRelativePtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public final fun setYSortEnabled(enabled: Boolean): Unit { + Internals.writeArguments(BOOL to enabled) + Internals.callMethod(rawPtr, MethodBindings.setYSortEnabledPtr, NIL) + } + + public final fun isYSortEnabled(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isYSortEnabledPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public final fun setDrawBehindParent(enable: Boolean): Unit { + Internals.writeArguments(BOOL to enable) + Internals.callMethod(rawPtr, MethodBindings.setDrawBehindParentPtr, NIL) + } + + public final fun isDrawBehindParentEnabled(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isDrawBehindParentEnabledPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + /** + * Draws a line from a 2D point to another, with a given color and width. It can be optionally + * antialiased. See also [drawMultiline] and [drawPolyline]. + * If [width] is negative, then a two-point primitive will be drawn instead of a four-point one. + * This means that when the CanvasItem is scaled, the line will remain thin. If this behavior is not + * desired, then pass a positive [width] like `1.0`. + */ + @JvmOverloads + public final fun drawLine( + from: Vector2, + to: Vector2, + color: Color, + width: Float = -1.0f, + antialiased: Boolean = false, + ): Unit { + Internals.writeArguments(VECTOR2 to from, VECTOR2 to to, COLOR to color, DOUBLE to width.toDouble(), BOOL to antialiased) + Internals.callMethod(rawPtr, MethodBindings.drawLinePtr, NIL) + } + + /** + * Draws a dashed line from a 2D point to another, with a given color and width. See also + * [drawMultiline] and [drawPolyline]. + * If [width] is negative, then a two-point primitives will be drawn instead of a four-point ones. + * This means that when the CanvasItem is scaled, the line parts will remain thin. If this behavior + * is not desired, then pass a positive [width] like `1.0`. + * If [antialiased] is `true`, half transparent "feathers" will be attached to the boundary, + * making outlines smooth. + * **Note:** [antialiased] is only effective if [width] is greater than `0.0`. + */ + @JvmOverloads + public final fun drawDashedLine( + from: Vector2, + to: Vector2, + color: Color, + width: Float = -1.0f, + dash: Float = 2.0f, + aligned: Boolean = true, + antialiased: Boolean = false, + ): Unit { + Internals.writeArguments(VECTOR2 to from, VECTOR2 to to, COLOR to color, DOUBLE to width.toDouble(), DOUBLE to dash.toDouble(), BOOL to aligned, BOOL to antialiased) + Internals.callMethod(rawPtr, MethodBindings.drawDashedLinePtr, NIL) + } + + /** + * Draws interconnected line segments with a uniform [color] and [width] and optional antialiasing + * (supported only for positive [width]). When drawing large amounts of lines, this is faster than + * using individual [drawLine] calls. To draw disconnected lines, use [drawMultiline] instead. See + * also [drawPolygon]. + * If [width] is negative, it will be ignored and the polyline will be drawn using + * [RenderingServer.PRIMITIVE_LINE_STRIP]. This means that when the CanvasItem is scaled, the + * polyline will remain thin. If this behavior is not desired, then pass a positive [width] like + * `1.0`. + */ + @JvmOverloads + public final fun drawPolyline( + points: PackedVector2Array, + color: Color, + width: Float = -1.0f, + antialiased: Boolean = false, + ): Unit { + Internals.writeArguments(PACKED_VECTOR2_ARRAY to points, COLOR to color, DOUBLE to width.toDouble(), BOOL to antialiased) + Internals.callMethod(rawPtr, MethodBindings.drawPolylinePtr, NIL) + } + + /** + * Draws interconnected line segments with a uniform [width], point-by-point coloring, and + * optional antialiasing (supported only for positive [width]). Colors assigned to line points match + * by index between [points] and [colors], i.e. each line segment is filled with a gradient between + * the colors of the endpoints. When drawing large amounts of lines, this is faster than using + * individual [drawLine] calls. To draw disconnected lines, use [drawMultilineColors] instead. See + * also [drawPolygon]. + * If [width] is negative, it will be ignored and the polyline will be drawn using + * [RenderingServer.PRIMITIVE_LINE_STRIP]. This means that when the CanvasItem is scaled, the + * polyline will remain thin. If this behavior is not desired, then pass a positive [width] like + * `1.0`. + */ + @JvmOverloads + public final fun drawPolylineColors( + points: PackedVector2Array, + colors: PackedColorArray, + width: Float = -1.0f, + antialiased: Boolean = false, + ): Unit { + Internals.writeArguments(PACKED_VECTOR2_ARRAY to points, PACKED_COLOR_ARRAY to colors, DOUBLE to width.toDouble(), BOOL to antialiased) + Internals.callMethod(rawPtr, MethodBindings.drawPolylineColorsPtr, NIL) + } + + /** + * Draws an unfilled arc between the given angles with a uniform [color] and [width] and optional + * antialiasing (supported only for positive [width]). The larger the value of [pointCount], the + * smoother the curve. See also [drawCircle]. + * If [width] is negative, it will be ignored and the arc will be drawn using + * [RenderingServer.PRIMITIVE_LINE_STRIP]. This means that when the CanvasItem is scaled, the arc + * will remain thin. If this behavior is not desired, then pass a positive [width] like `1.0`. + * The arc is drawn from [startAngle] towards the value of [endAngle] so in clockwise direction if + * `start_angle < end_angle` and counter-clockwise otherwise. Passing the same angles but in reversed + * order will produce the same arc. If absolute difference of [startAngle] and [endAngle] is greater + * than [@GDScript.TAU] radians, then a full circle arc is drawn (i.e. arc will not overlap itself). + */ + @JvmOverloads + public final fun drawArc( + center: Vector2, + radius: Float, + startAngle: Float, + endAngle: Float, + pointCount: Int, + color: Color, + width: Float = -1.0f, + antialiased: Boolean = false, + ): Unit { + Internals.writeArguments(VECTOR2 to center, DOUBLE to radius.toDouble(), DOUBLE to startAngle.toDouble(), DOUBLE to endAngle.toDouble(), LONG to pointCount.toLong(), COLOR to color, DOUBLE to width.toDouble(), BOOL to antialiased) + Internals.callMethod(rawPtr, MethodBindings.drawArcPtr, NIL) + } + + /** + * Draws multiple disconnected lines with a uniform [width] and [color]. Each line is defined by + * two consecutive points from [points] array, i.e. i-th segment consists of `points[2 * i]`, + * `points[2 * i + 1]` endpoints. When drawing large amounts of lines, this is faster than using + * individual [drawLine] calls. To draw interconnected lines, use [drawPolyline] instead. + * If [width] is negative, then two-point primitives will be drawn instead of a four-point ones. + * This means that when the CanvasItem is scaled, the lines will remain thin. If this behavior is not + * desired, then pass a positive [width] like `1.0`. + * **Note:** [antialiased] is only effective if [width] is greater than `0.0`. + */ + @JvmOverloads + public final fun drawMultiline( + points: PackedVector2Array, + color: Color, + width: Float = -1.0f, + antialiased: Boolean = false, + ): Unit { + Internals.writeArguments(PACKED_VECTOR2_ARRAY to points, COLOR to color, DOUBLE to width.toDouble(), BOOL to antialiased) + Internals.callMethod(rawPtr, MethodBindings.drawMultilinePtr, NIL) + } + + /** + * Draws multiple disconnected lines with a uniform [width] and segment-by-segment coloring. Each + * segment is defined by two consecutive points from [points] array and a corresponding color from + * [colors] array, i.e. i-th segment consists of `points[2 * i]`, `points[2 * i + 1]` endpoints and + * has `colors[i]` color. When drawing large amounts of lines, this is faster than using individual + * [drawLine] calls. To draw interconnected lines, use [drawPolylineColors] instead. + * If [width] is negative, then two-point primitives will be drawn instead of a four-point ones. + * This means that when the CanvasItem is scaled, the lines will remain thin. If this behavior is not + * desired, then pass a positive [width] like `1.0`. + * **Note:** [antialiased] is only effective if [width] is greater than `0.0`. + */ + @JvmOverloads + public final fun drawMultilineColors( + points: PackedVector2Array, + colors: PackedColorArray, + width: Float = -1.0f, + antialiased: Boolean = false, + ): Unit { + Internals.writeArguments(PACKED_VECTOR2_ARRAY to points, PACKED_COLOR_ARRAY to colors, DOUBLE to width.toDouble(), BOOL to antialiased) + Internals.callMethod(rawPtr, MethodBindings.drawMultilineColorsPtr, NIL) + } + + /** + * Draws a rectangle. If [filled] is `true`, the rectangle will be filled with the [color] + * specified. If [filled] is `false`, the rectangle will be drawn as a stroke with the [color] and + * [width] specified. See also [drawTextureRect]. + * If [width] is negative, then two-point primitives will be drawn instead of a four-point ones. + * This means that when the CanvasItem is scaled, the lines will remain thin. If this behavior is not + * desired, then pass a positive [width] like `1.0`. + * If [antialiased] is `true`, half transparent "feathers" will be attached to the boundary, + * making outlines smooth. + * **Note:** [width] is only effective if [filled] is `false`. + * **Note:** Unfilled rectangles drawn with a negative [width] may not display perfectly. For + * example, corners may be missing or brighter due to overlapping lines (for a translucent [color]). + */ + @JvmOverloads + public final fun drawRect( + rect: Rect2, + color: Color, + filled: Boolean = true, + width: Float = -1.0f, + antialiased: Boolean = false, + ): Unit { + Internals.writeArguments(RECT2 to rect, COLOR to color, BOOL to filled, DOUBLE to width.toDouble(), BOOL to antialiased) + Internals.callMethod(rawPtr, MethodBindings.drawRectPtr, NIL) + } + + /** + * Draws a circle. See also [drawArc], [drawPolyline], and [drawPolygon]. + * If [filled] is `true`, the circle will be filled with the [color] specified. If [filled] is + * `false`, the circle will be drawn as a stroke with the [color] and [width] specified. + * If [width] is negative, then two-point primitives will be drawn instead of a four-point ones. + * This means that when the CanvasItem is scaled, the lines will remain thin. If this behavior is not + * desired, then pass a positive [width] like `1.0`. + * If [antialiased] is `true`, half transparent "feathers" will be attached to the boundary, + * making outlines smooth. + * **Note:** [width] is only effective if [filled] is `false`. + */ + @JvmOverloads + public final fun drawCircle( + position: Vector2, + radius: Float, + color: Color, + filled: Boolean = true, + width: Float = -1.0f, + antialiased: Boolean = false, + ): Unit { + Internals.writeArguments(VECTOR2 to position, DOUBLE to radius.toDouble(), COLOR to color, BOOL to filled, DOUBLE to width.toDouble(), BOOL to antialiased) + Internals.callMethod(rawPtr, MethodBindings.drawCirclePtr, NIL) + } + + /** + * Draws a texture at a given position. + */ + @JvmOverloads + public final fun drawTexture( + texture: Texture2D?, + position: Vector2, + modulate: Color = Color(Color(1, 1, 1, 1)), + ): Unit { + Internals.writeArguments(OBJECT to texture, VECTOR2 to position, COLOR to modulate) + Internals.callMethod(rawPtr, MethodBindings.drawTexturePtr, NIL) + } + + /** + * Draws a textured rectangle at a given position, optionally modulated by a color. If [transpose] + * is `true`, the texture will have its X and Y coordinates swapped. See also [drawRect] and + * [drawTextureRectRegion]. + */ + @JvmOverloads + public final fun drawTextureRect( + texture: Texture2D?, + rect: Rect2, + tile: Boolean, + modulate: Color = Color(Color(1, 1, 1, 1)), + transpose: Boolean = false, + ): Unit { + Internals.writeArguments(OBJECT to texture, RECT2 to rect, BOOL to tile, COLOR to modulate, BOOL to transpose) + Internals.callMethod(rawPtr, MethodBindings.drawTextureRectPtr, NIL) + } + + /** + * Draws a textured rectangle from a texture's region (specified by [srcRect]) at a given + * position, optionally modulated by a color. If [transpose] is `true`, the texture will have its X + * and Y coordinates swapped. See also [drawTextureRect]. + */ + @JvmOverloads + public final fun drawTextureRectRegion( + texture: Texture2D?, + rect: Rect2, + srcRect: Rect2, + modulate: Color = Color(Color(1, 1, 1, 1)), + transpose: Boolean = false, + clipUv: Boolean = true, + ): Unit { + Internals.writeArguments(OBJECT to texture, RECT2 to rect, RECT2 to srcRect, COLOR to modulate, BOOL to transpose, BOOL to clipUv) + Internals.callMethod(rawPtr, MethodBindings.drawTextureRectRegionPtr, NIL) + } + + /** + * Draws a textured rectangle region of the multi-channel signed distance field texture at a given + * position, optionally modulated by a color. See [FontFile.multichannelSignedDistanceField] for more + * information and caveats about MSDF font rendering. + * If [outline] is positive, each alpha channel value of pixel in region is set to maximum value + * of true distance in the [outline] radius. + * Value of the [pixelRange] should the same that was used during distance field texture + * generation. + */ + @JvmOverloads + public final fun drawMsdfTextureRectRegion( + texture: Texture2D?, + rect: Rect2, + srcRect: Rect2, + modulate: Color = Color(Color(1, 1, 1, 1)), + outline: Double = 0.0, + pixelRange: Double = 4.0, + scale: Double = 1.0, + ): Unit { + Internals.writeArguments(OBJECT to texture, RECT2 to rect, RECT2 to srcRect, COLOR to modulate, DOUBLE to outline, DOUBLE to pixelRange, DOUBLE to scale) + Internals.callMethod(rawPtr, MethodBindings.drawMsdfTextureRectRegionPtr, NIL) + } + + /** + * Draws a textured rectangle region of the font texture with LCD subpixel anti-aliasing at a + * given position, optionally modulated by a color. + * Texture is drawn using the following blend operation, blend mode of the [CanvasItemMaterial] is + * ignored: + * [codeblock] + * dst.r = texture.r * modulate.r * modulate.a + dst.r * (1.0 - texture.r * modulate.a); + * dst.g = texture.g * modulate.g * modulate.a + dst.g * (1.0 - texture.g * modulate.a); + * dst.b = texture.b * modulate.b * modulate.a + dst.b * (1.0 - texture.b * modulate.a); + * dst.a = modulate.a + dst.a * (1.0 - modulate.a); + * [/codeblock] + */ + @JvmOverloads + public final fun drawLcdTextureRectRegion( + texture: Texture2D?, + rect: Rect2, + srcRect: Rect2, + modulate: Color = Color(Color(1, 1, 1, 1)), + ): Unit { + Internals.writeArguments(OBJECT to texture, RECT2 to rect, RECT2 to srcRect, COLOR to modulate) + Internals.callMethod(rawPtr, MethodBindings.drawLcdTextureRectRegionPtr, NIL) + } + + /** + * Draws a styled rectangle. + */ + public final fun drawStyleBox(styleBox: StyleBox?, rect: Rect2): Unit { + Internals.writeArguments(OBJECT to styleBox, RECT2 to rect) + Internals.callMethod(rawPtr, MethodBindings.drawStyleBoxPtr, NIL) + } + + /** + * Draws a custom primitive. 1 point for a point, 2 points for a line, 3 points for a triangle, + * and 4 points for a quad. If 0 points or more than 4 points are specified, nothing will be drawn + * and an error message will be printed. See also [drawLine], [drawPolyline], [drawPolygon], and + * [drawRect]. + */ + @JvmOverloads + public final fun drawPrimitive( + points: PackedVector2Array, + colors: PackedColorArray, + uvs: PackedVector2Array, + texture: Texture2D? = null, + ): Unit { + Internals.writeArguments(PACKED_VECTOR2_ARRAY to points, PACKED_COLOR_ARRAY to colors, PACKED_VECTOR2_ARRAY to uvs, OBJECT to texture) + Internals.callMethod(rawPtr, MethodBindings.drawPrimitivePtr, NIL) + } + + /** + * Draws a solid polygon of any number of points, convex or concave. Unlike [drawColoredPolygon], + * each point's color can be changed individually. See also [drawPolyline] and [drawPolylineColors]. + * If you need more flexibility (such as being able to use bones), use + * [RenderingServer.canvasItemAddTriangleArray] instead. + */ + @JvmOverloads + public final fun drawPolygon( + points: PackedVector2Array, + colors: PackedColorArray, + uvs: PackedVector2Array = PackedVector2Array(), + texture: Texture2D? = null, + ): Unit { + Internals.writeArguments(PACKED_VECTOR2_ARRAY to points, PACKED_COLOR_ARRAY to colors, PACKED_VECTOR2_ARRAY to uvs, OBJECT to texture) + Internals.callMethod(rawPtr, MethodBindings.drawPolygonPtr, NIL) + } + + /** + * Draws a colored polygon of any number of points, convex or concave. Unlike [drawPolygon], a + * single color must be specified for the whole polygon. + */ + @JvmOverloads + public final fun drawColoredPolygon( + points: PackedVector2Array, + color: Color, + uvs: PackedVector2Array = PackedVector2Array(), + texture: Texture2D? = null, + ): Unit { + Internals.writeArguments(PACKED_VECTOR2_ARRAY to points, COLOR to color, PACKED_VECTOR2_ARRAY to uvs, OBJECT to texture) + Internals.callMethod(rawPtr, MethodBindings.drawColoredPolygonPtr, NIL) + } + + /** + * Draws [text] using the specified [font] at the [pos] (bottom-left corner using the baseline of + * the font). The text will have its color multiplied by [modulate]. If [width] is greater than or + * equal to 0, the text will be clipped if it exceeds the specified width. + * **Example using the default project font:** + * + * gdscript: + * ```gdscript + * # If using this method in a script that redraws constantly, move the + * # `default_font` declaration to a member variable assigned in `_ready()` + * # so the Control is only created once. + * var default_font = ThemeDB.fallback_font + * var default_font_size = ThemeDB.fallback_font_size + * draw_string(default_font, Vector2(64, 64), "Hello world", HORIZONTAL_ALIGNMENT_LEFT, -1, + * default_font_size) + * ``` + * csharp: + * ```csharp + * // If using this method in a script that redraws constantly, move the + * // `default_font` declaration to a member variable assigned in `_Ready()` + * // so the Control is only created once. + * Font defaultFont = ThemeDB.FallbackFont; + * int defaultFontSize = ThemeDB.FallbackFontSize; + * DrawString(defaultFont, new Vector2(64, 64), "Hello world", HORIZONTAL_ALIGNMENT_LEFT, -1, + * defaultFontSize); + * ``` + * + * See also [Font.drawString]. + */ + @JvmOverloads + public final fun drawString( + font: Font?, + pos: Vector2, + text: String, + alignment: HorizontalAlignment = HorizontalAlignment.HORIZONTAL_ALIGNMENT_LEFT, + width: Float = -1.0f, + fontSize: Int = 16, + modulate: Color = Color(Color(1, 1, 1, 1)), + justificationFlags: TextServer.JustificationFlag = TextServer.JustificationFlagValue(3), + direction: TextServer.Direction = TextServer.Direction.DIRECTION_AUTO, + orientation: TextServer.Orientation = TextServer.Orientation.ORIENTATION_HORIZONTAL, + ): Unit { + Internals.writeArguments(OBJECT to font, VECTOR2 to pos, STRING to text, LONG to alignment.id, DOUBLE to width.toDouble(), LONG to fontSize.toLong(), COLOR to modulate, LONG to justificationFlags.flag, LONG to direction.id, LONG to orientation.id) + Internals.callMethod(rawPtr, MethodBindings.drawStringPtr, NIL) + } + + /** + * Breaks [text] into lines and draws it using the specified [font] at the [pos] (top-left + * corner). The text will have its color multiplied by [modulate]. If [width] is greater than or + * equal to 0, the text will be clipped if it exceeds the specified width. + */ + @JvmOverloads + public final fun drawMultilineString( + font: Font?, + pos: Vector2, + text: String, + alignment: HorizontalAlignment = HorizontalAlignment.HORIZONTAL_ALIGNMENT_LEFT, + width: Float = -1.0f, + fontSize: Int = 16, + maxLines: Int = -1, + modulate: Color = Color(Color(1, 1, 1, 1)), + brkFlags: TextServer.LineBreakFlag = TextServer.LineBreakFlagValue(3), + justificationFlags: TextServer.JustificationFlag = TextServer.JustificationFlagValue(3), + direction: TextServer.Direction = TextServer.Direction.DIRECTION_AUTO, + orientation: TextServer.Orientation = TextServer.Orientation.ORIENTATION_HORIZONTAL, + ): Unit { + Internals.writeArguments(OBJECT to font, VECTOR2 to pos, STRING to text, LONG to alignment.id, DOUBLE to width.toDouble(), LONG to fontSize.toLong(), LONG to maxLines.toLong(), COLOR to modulate, LONG to brkFlags.flag, LONG to justificationFlags.flag, LONG to direction.id, LONG to orientation.id) + Internals.callMethod(rawPtr, MethodBindings.drawMultilineStringPtr, NIL) + } + + /** + * Draws [text] outline using the specified [font] at the [pos] (bottom-left corner using the + * baseline of the font). The text will have its color multiplied by [modulate]. If [width] is + * greater than or equal to 0, the text will be clipped if it exceeds the specified width. + */ + @JvmOverloads + public final fun drawStringOutline( + font: Font?, + pos: Vector2, + text: String, + alignment: HorizontalAlignment = HorizontalAlignment.HORIZONTAL_ALIGNMENT_LEFT, + width: Float = -1.0f, + fontSize: Int = 16, + size: Int = 1, + modulate: Color = Color(Color(1, 1, 1, 1)), + justificationFlags: TextServer.JustificationFlag = TextServer.JustificationFlagValue(3), + direction: TextServer.Direction = TextServer.Direction.DIRECTION_AUTO, + orientation: TextServer.Orientation = TextServer.Orientation.ORIENTATION_HORIZONTAL, + ): Unit { + Internals.writeArguments(OBJECT to font, VECTOR2 to pos, STRING to text, LONG to alignment.id, DOUBLE to width.toDouble(), LONG to fontSize.toLong(), LONG to size.toLong(), COLOR to modulate, LONG to justificationFlags.flag, LONG to direction.id, LONG to orientation.id) + Internals.callMethod(rawPtr, MethodBindings.drawStringOutlinePtr, NIL) + } + + /** + * Breaks [text] to the lines and draws text outline using the specified [font] at the [pos] + * (top-left corner). The text will have its color multiplied by [modulate]. If [width] is greater + * than or equal to 0, the text will be clipped if it exceeds the specified width. + */ + @JvmOverloads + public final fun drawMultilineStringOutline( + font: Font?, + pos: Vector2, + text: String, + alignment: HorizontalAlignment = HorizontalAlignment.HORIZONTAL_ALIGNMENT_LEFT, + width: Float = -1.0f, + fontSize: Int = 16, + maxLines: Int = -1, + size: Int = 1, + modulate: Color = Color(Color(1, 1, 1, 1)), + brkFlags: TextServer.LineBreakFlag = TextServer.LineBreakFlagValue(3), + justificationFlags: TextServer.JustificationFlag = TextServer.JustificationFlagValue(3), + direction: TextServer.Direction = TextServer.Direction.DIRECTION_AUTO, + orientation: TextServer.Orientation = TextServer.Orientation.ORIENTATION_HORIZONTAL, + ): Unit { + Internals.writeArguments(OBJECT to font, VECTOR2 to pos, STRING to text, LONG to alignment.id, DOUBLE to width.toDouble(), LONG to fontSize.toLong(), LONG to maxLines.toLong(), LONG to size.toLong(), COLOR to modulate, LONG to brkFlags.flag, LONG to justificationFlags.flag, LONG to direction.id, LONG to orientation.id) + Internals.callMethod(rawPtr, MethodBindings.drawMultilineStringOutlinePtr, NIL) + } + + /** + * Draws a string first character using a custom font. + */ + @JvmOverloads + public final fun drawChar( + font: Font?, + pos: Vector2, + char: String, + fontSize: Int = 16, + modulate: Color = Color(Color(1, 1, 1, 1)), + ): Unit { + Internals.writeArguments(OBJECT to font, VECTOR2 to pos, STRING to char, LONG to fontSize.toLong(), COLOR to modulate) + Internals.callMethod(rawPtr, MethodBindings.drawCharPtr, NIL) + } + + /** + * Draws a string first character outline using a custom font. + */ + @JvmOverloads + public final fun drawCharOutline( + font: Font?, + pos: Vector2, + char: String, + fontSize: Int = 16, + size: Int = -1, + modulate: Color = Color(Color(1, 1, 1, 1)), + ): Unit { + Internals.writeArguments(OBJECT to font, VECTOR2 to pos, STRING to char, LONG to fontSize.toLong(), LONG to size.toLong(), COLOR to modulate) + Internals.callMethod(rawPtr, MethodBindings.drawCharOutlinePtr, NIL) + } + + /** + * Draws a [Mesh] in 2D, using the provided texture. See [MeshInstance2D] for related + * documentation. + */ + @JvmOverloads + public final fun drawMesh( + mesh: Mesh?, + texture: Texture2D?, + transform: Transform2D = Transform2D(), + modulate: Color = Color(Color(1, 1, 1, 1)), + ): Unit { + Internals.writeArguments(OBJECT to mesh, OBJECT to texture, TRANSFORM2D to transform, COLOR to modulate) + Internals.callMethod(rawPtr, MethodBindings.drawMeshPtr, NIL) + } + + /** + * Draws a [MultiMesh] in 2D with the provided texture. See [MultiMeshInstance2D] for related + * documentation. + */ + public final fun drawMultimesh(multimesh: MultiMesh?, texture: Texture2D?): Unit { + Internals.writeArguments(OBJECT to multimesh, OBJECT to texture) + Internals.callMethod(rawPtr, MethodBindings.drawMultimeshPtr, NIL) + } + + /** + * Sets a custom transform for drawing via components. Anything drawn afterwards will be + * transformed by this. + * **Note:** [FontFile.oversampling] does *not* take [scale] into account. This means that scaling + * up/down will cause bitmap fonts and rasterized (non-MSDF) dynamic fonts to appear blurry or + * pixelated. To ensure text remains crisp regardless of scale, you can enable MSDF font rendering by + * enabling [ProjectSettings.gui/theme/defaultFontMultichannelSignedDistanceField] (applies to the + * default project font only), or enabling **Multichannel Signed Distance Field** in the import + * options of a DynamicFont for custom fonts. On system fonts, + * [SystemFont.multichannelSignedDistanceField] can be enabled in the inspector. + */ + @JvmOverloads + public final fun drawSetTransform( + position: Vector2, + rotation: Float = 0.0f, + scale: Vector2 = Vector2(1, 1), + ): Unit { + Internals.writeArguments(VECTOR2 to position, DOUBLE to rotation.toDouble(), VECTOR2 to scale) + Internals.callMethod(rawPtr, MethodBindings.drawSetTransformPtr, NIL) + } + + /** + * Sets a custom transform for drawing via matrix. Anything drawn afterwards will be transformed + * by this. + */ + public final fun drawSetTransformMatrix(xform: Transform2D): Unit { + Internals.writeArguments(TRANSFORM2D to xform) + Internals.callMethod(rawPtr, MethodBindings.drawSetTransformMatrixPtr, NIL) + } + + /** + * Subsequent drawing commands will be ignored unless they fall within the specified animation + * slice. This is a faster way to implement animations that loop on background rather than redrawing + * constantly. + */ + @JvmOverloads + public final fun drawAnimationSlice( + animationLength: Double, + sliceBegin: Double, + sliceEnd: Double, + offset: Double = 0.0, + ): Unit { + Internals.writeArguments(DOUBLE to animationLength, DOUBLE to sliceBegin, DOUBLE to sliceEnd, DOUBLE to offset) + Internals.callMethod(rawPtr, MethodBindings.drawAnimationSlicePtr, NIL) + } + + /** + * After submitting all animations slices via [drawAnimationSlice], this function can be used to + * revert drawing to its default state (all subsequent drawing commands will be visible). If you + * don't care about this particular use case, usage of this function after submitting the slices is + * not required. + */ + public final fun drawEndAnimation(): Unit { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.drawEndAnimationPtr, NIL) + } + + /** + * Returns the transform matrix of this item. + */ + public final fun getTransform(): Transform2D { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getTransformPtr, TRANSFORM2D) + return (Internals.readReturnValue(TRANSFORM2D) as Transform2D) + } + + /** + * Returns the global transform matrix of this item, i.e. the combined transform up to the topmost + * [CanvasItem] node. The topmost item is a [CanvasItem] that either has no parent, has + * non-[CanvasItem] parent or it has [topLevel] enabled. + */ + public final fun getGlobalTransform(): Transform2D { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getGlobalTransformPtr, TRANSFORM2D) + return (Internals.readReturnValue(TRANSFORM2D) as Transform2D) + } + + /** + * Returns the transform from the local coordinate system of this [CanvasItem] to the [Viewport]s + * coordinate system. + */ + public final fun getGlobalTransformWithCanvas(): Transform2D { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getGlobalTransformWithCanvasPtr, TRANSFORM2D) + return (Internals.readReturnValue(TRANSFORM2D) as Transform2D) + } + + /** + * Returns the transform from the coordinate system of the canvas, this item is in, to the + * [Viewport]s embedders coordinate system. + */ + public final fun getViewportTransform(): Transform2D { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getViewportTransformPtr, TRANSFORM2D) + return (Internals.readReturnValue(TRANSFORM2D) as Transform2D) + } + + /** + * Returns the viewport's boundaries as a [Rect2]. + */ + public final fun getViewportRect(): Rect2 { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getViewportRectPtr, RECT2) + return (Internals.readReturnValue(RECT2) as Rect2) + } + + /** + * Returns the transform from the coordinate system of the canvas, this item is in, to the + * [Viewport]s coordinate system. + */ + public final fun getCanvasTransform(): Transform2D { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getCanvasTransformPtr, TRANSFORM2D) + return (Internals.readReturnValue(TRANSFORM2D) as Transform2D) + } + + /** + * Returns the transform of this [CanvasItem] in global screen coordinates (i.e. taking window + * position into account). Mostly useful for editor plugins. + * Equals to [getGlobalTransform] if the window is embedded (see [Viewport.guiEmbedSubwindows]). + */ + public final fun getScreenTransform(): Transform2D { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getScreenTransformPtr, TRANSFORM2D) + return (Internals.readReturnValue(TRANSFORM2D) as Transform2D) + } + + /** + * Returns the mouse's position in this [CanvasItem] using the local coordinate system of this + * [CanvasItem]. + */ + public final fun getLocalMousePosition(): Vector2 { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getLocalMousePositionPtr, VECTOR2) + return (Internals.readReturnValue(VECTOR2) as Vector2) + } + + /** + * Returns the mouse's position in the [CanvasLayer] that this [CanvasItem] is in using the + * coordinate system of the [CanvasLayer]. + * **Note:** For screen-space coordinates (e.g. when using a non-embedded [Popup]), you can use + * [DisplayServer.mouseGetPosition]. + */ + public final fun getGlobalMousePosition(): Vector2 { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getGlobalMousePositionPtr, VECTOR2) + return (Internals.readReturnValue(VECTOR2) as Vector2) + } + + /** + * Returns the [RID] of the [World2D] canvas where this item is in. + */ + public final fun getCanvas(): RID { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getCanvasPtr, _RID) + return (Internals.readReturnValue(_RID) as RID) + } + + /** + * Returns the [CanvasLayer] that contains this node, or `null` if the node is not in any + * [CanvasLayer]. + */ + public final fun getCanvasLayerNode(): CanvasLayer? { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getCanvasLayerNodePtr, OBJECT) + return (Internals.readReturnValue(OBJECT) as CanvasLayer?) + } + + /** + * Returns the [World2D] where this item is in. + */ + public final fun getWorld2d(): World2D? { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getWorld2dPtr, OBJECT) + return (Internals.readReturnValue(OBJECT) as World2D?) + } + + public final fun setMaterial(material: Material?): Unit { + Internals.writeArguments(OBJECT to material) + Internals.callMethod(rawPtr, MethodBindings.setMaterialPtr, NIL) + } + + public final fun getMaterial(): Material? { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getMaterialPtr, OBJECT) + return (Internals.readReturnValue(OBJECT) as Material?) + } + + public final fun setUseParentMaterial(enable: Boolean): Unit { + Internals.writeArguments(BOOL to enable) + Internals.callMethod(rawPtr, MethodBindings.setUseParentMaterialPtr, NIL) + } + + public final fun getUseParentMaterial(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getUseParentMaterialPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + /** + * If [enable] is `true`, this node will receive [NOTIFICATION_LOCAL_TRANSFORM_CHANGED] when its + * local transform changes. + */ + public final fun setNotifyLocalTransform(enable: Boolean): Unit { + Internals.writeArguments(BOOL to enable) + Internals.callMethod(rawPtr, MethodBindings.setNotifyLocalTransformPtr, NIL) + } + + /** + * Returns `true` if local transform notifications are communicated to children. + */ + public final fun isLocalTransformNotificationEnabled(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isLocalTransformNotificationEnabledPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + /** + * If [enable] is `true`, this node will receive [NOTIFICATION_TRANSFORM_CHANGED] when its global + * transform changes. + */ + public final fun setNotifyTransform(enable: Boolean): Unit { + Internals.writeArguments(BOOL to enable) + Internals.callMethod(rawPtr, MethodBindings.setNotifyTransformPtr, NIL) + } + + /** + * Returns `true` if global transform notifications are communicated to children. + */ + public final fun isTransformNotificationEnabled(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isTransformNotificationEnabledPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + /** + * Forces the transform to update. Transform changes in physics are not instant for performance + * reasons. Transforms are accumulated and then set. Use this if you need an up-to-date transform + * when doing physics operations. + */ + public final fun forceUpdateTransform(): Unit { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.forceUpdateTransformPtr, NIL) + } + + /** + * Assigns [screenPoint] as this node's new local transform. + */ + public final fun makeCanvasPositionLocal(screenPoint: Vector2): Vector2 { + Internals.writeArguments(VECTOR2 to screenPoint) + Internals.callMethod(rawPtr, MethodBindings.makeCanvasPositionLocalPtr, VECTOR2) + return (Internals.readReturnValue(VECTOR2) as Vector2) + } + + /** + * Transformations issued by [event]'s inputs are applied in local space instead of global space. + */ + public final fun makeInputLocal(event: InputEvent?): InputEvent? { + Internals.writeArguments(OBJECT to event) + Internals.callMethod(rawPtr, MethodBindings.makeInputLocalPtr, OBJECT) + return (Internals.readReturnValue(OBJECT) as InputEvent?) + } + + public final fun setVisibilityLayer(layer: Long): Unit { + Internals.writeArguments(LONG to layer) + Internals.callMethod(rawPtr, MethodBindings.setVisibilityLayerPtr, NIL) + } + + public final fun getVisibilityLayer(): Long { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getVisibilityLayerPtr, LONG) + return (Internals.readReturnValue(LONG) as Long) + } + + /** + * Set/clear individual bits on the rendering visibility layer. This simplifies editing this + * [CanvasItem]'s visibility layer. + */ + public final fun setVisibilityLayerBit(layer: Long, enabled: Boolean): Unit { + Internals.writeArguments(LONG to layer, BOOL to enabled) + Internals.callMethod(rawPtr, MethodBindings.setVisibilityLayerBitPtr, NIL) + } + + /** + * Returns an individual bit on the rendering visibility layer. + */ + public final fun getVisibilityLayerBit(layer: Long): Boolean { + Internals.writeArguments(LONG to layer) + Internals.callMethod(rawPtr, MethodBindings.getVisibilityLayerBitPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public final fun setTextureFilter(mode: TextureFilter): Unit { + Internals.writeArguments(LONG to mode.id) + Internals.callMethod(rawPtr, MethodBindings.setTextureFilterPtr, NIL) + } + + public final fun getTextureFilter(): TextureFilter { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getTextureFilterPtr, LONG) + return CanvasItem.TextureFilter.from(Internals.readReturnValue(LONG) as Long) + } + + public final fun setTextureRepeat(mode: TextureRepeat): Unit { + Internals.writeArguments(LONG to mode.id) + Internals.callMethod(rawPtr, MethodBindings.setTextureRepeatPtr, NIL) + } + + public final fun getTextureRepeat(): TextureRepeat { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getTextureRepeatPtr, LONG) + return CanvasItem.TextureRepeat.from(Internals.readReturnValue(LONG) as Long) + } + + public final fun setClipChildrenMode(mode: ClipChildrenMode): Unit { + Internals.writeArguments(LONG to mode.id) + Internals.callMethod(rawPtr, MethodBindings.setClipChildrenModePtr, NIL) + } + + public final fun getClipChildrenMode(): ClipChildrenMode { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getClipChildrenModePtr, LONG) + return CanvasItem.ClipChildrenMode.from(Internals.readReturnValue(LONG) as Long) + } + + public enum class TextureFilter( + id: Long, + ) { + /** + * The [CanvasItem] will inherit the filter from its parent. + */ + TEXTURE_FILTER_PARENT_NODE(0), + /** + * The texture filter reads from the nearest pixel only. This makes the texture look pixelated + * from up close, and grainy from a distance (due to mipmaps not being sampled). + */ + TEXTURE_FILTER_NEAREST(1), + /** + * The texture filter blends between the nearest 4 pixels. This makes the texture look smooth + * from up close, and grainy from a distance (due to mipmaps not being sampled). + */ + TEXTURE_FILTER_LINEAR(2), + /** + * The texture filter reads from the nearest pixel and blends between the nearest 2 mipmaps (or + * uses the nearest mipmap if + * [ProjectSettings.rendering/textures/defaultFilters/useNearestMipmapFilter] is `true`). This + * makes the texture look pixelated from up close, and smooth from a distance. + * Use this for non-pixel art textures that may be viewed at a low scale (e.g. due to [Camera2D] + * zoom or sprite scaling), as mipmaps are important to smooth out pixels that are smaller than + * on-screen pixels. + */ + TEXTURE_FILTER_NEAREST_WITH_MIPMAPS(3), + /** + * The texture filter blends between the nearest 4 pixels and between the nearest 2 mipmaps (or + * uses the nearest mipmap if + * [ProjectSettings.rendering/textures/defaultFilters/useNearestMipmapFilter] is `true`). This + * makes the texture look smooth from up close, and smooth from a distance. + * Use this for non-pixel art textures that may be viewed at a low scale (e.g. due to [Camera2D] + * zoom or sprite scaling), as mipmaps are important to smooth out pixels that are smaller than + * on-screen pixels. + */ + TEXTURE_FILTER_LINEAR_WITH_MIPMAPS(4), + /** + * The texture filter reads from the nearest pixel and blends between 2 mipmaps (or uses the + * nearest mipmap if [ProjectSettings.rendering/textures/defaultFilters/useNearestMipmapFilter] is + * `true`) based on the angle between the surface and the camera view. This makes the texture look + * pixelated from up close, and smooth from a distance. Anisotropic filtering improves texture + * quality on surfaces that are almost in line with the camera, but is slightly slower. The + * anisotropic filtering level can be changed by adjusting + * [ProjectSettings.rendering/textures/defaultFilters/anisotropicFilteringLevel]. + * **Note:** This texture filter is rarely useful in 2D projects. + * [TEXTURE_FILTER_NEAREST_WITH_MIPMAPS] is usually more appropriate in this case. + */ + TEXTURE_FILTER_NEAREST_WITH_MIPMAPS_ANISOTROPIC(5), + /** + * The texture filter blends between the nearest 4 pixels and blends between 2 mipmaps (or uses + * the nearest mipmap if [ProjectSettings.rendering/textures/defaultFilters/useNearestMipmapFilter] + * is `true`) based on the angle between the surface and the camera view. This makes the texture + * look smooth from up close, and smooth from a distance. Anisotropic filtering improves texture + * quality on surfaces that are almost in line with the camera, but is slightly slower. The + * anisotropic filtering level can be changed by adjusting + * [ProjectSettings.rendering/textures/defaultFilters/anisotropicFilteringLevel]. + * **Note:** This texture filter is rarely useful in 2D projects. + * [TEXTURE_FILTER_LINEAR_WITH_MIPMAPS] is usually more appropriate in this case. + */ + TEXTURE_FILTER_LINEAR_WITH_MIPMAPS_ANISOTROPIC(6), + /** + * Represents the size of the [TextureFilter] enum. + */ + TEXTURE_FILTER_MAX(7), + ; + + public val id: Long + init { + this.id = id + } + + public companion object { + public fun from(`value`: Long): TextureFilter = entries.single { it.id == `value` } + } + } + + public enum class TextureRepeat( + id: Long, + ) { + /** + * The [CanvasItem] will inherit the filter from its parent. + */ + TEXTURE_REPEAT_PARENT_NODE(0), + /** + * Texture will not repeat. + */ + TEXTURE_REPEAT_DISABLED(1), + /** + * Texture will repeat normally. + */ + TEXTURE_REPEAT_ENABLED(2), + /** + * Texture will repeat in a 2×2 tiled mode, where elements at even positions are mirrored. + */ + TEXTURE_REPEAT_MIRROR(3), + /** + * Represents the size of the [TextureRepeat] enum. + */ + TEXTURE_REPEAT_MAX(4), + ; + + public val id: Long + init { + this.id = id + } + + public companion object { + public fun from(`value`: Long): TextureRepeat = entries.single { it.id == `value` } + } + } + + public enum class ClipChildrenMode( + id: Long, + ) { + /** + * Child draws over parent and is not clipped. + */ + CLIP_CHILDREN_DISABLED(0), + /** + * Parent is used for the purposes of clipping only. Child is clipped to the parent's visible + * area, parent is not drawn. + */ + CLIP_CHILDREN_ONLY(1), + /** + * Parent is used for clipping child, but parent is also drawn underneath child as normal before + * clipping child to its visible area. + */ + CLIP_CHILDREN_AND_DRAW(2), + /** + * Represents the size of the [ClipChildrenMode] enum. + */ + CLIP_CHILDREN_MAX(3), + ; + + public val id: Long + init { + this.id = id + } + + public companion object { + public fun from(`value`: Long): ClipChildrenMode = entries.single { it.id == `value` } + } + } + + public companion object { + /** + * The [CanvasItem]'s global transform has changed. This notification is only received if + * enabled by [setNotifyTransform]. + */ + public final const val NOTIFICATION_TRANSFORM_CHANGED: Long = 2000 + + /** + * The [CanvasItem]'s local transform has changed. This notification is only received if enabled + * by [setNotifyLocalTransform]. + */ + public final const val NOTIFICATION_LOCAL_TRANSFORM_CHANGED: Long = 35 + + /** + * The [CanvasItem] is requested to draw (see [_draw]). + */ + public final const val NOTIFICATION_DRAW: Long = 30 + + /** + * The [CanvasItem]'s visibility has changed. + */ + public final const val NOTIFICATION_VISIBILITY_CHANGED: Long = 31 + + /** + * The [CanvasItem] has entered the canvas. + */ + public final const val NOTIFICATION_ENTER_CANVAS: Long = 32 + + /** + * The [CanvasItem] has exited the canvas. + */ + public final const val NOTIFICATION_EXIT_CANVAS: Long = 33 + + /** + * The [CanvasItem]'s active [World2D] changed. + */ + public final const val NOTIFICATION_WORLD_2D_CHANGED: Long = 36 + } + + public object MethodBindings { + internal val getCanvasItemPtr: VoidPtr = + Internals.getMethodBindPtr("CanvasItem", "get_canvas_item", 2944877500) + + internal val setVisiblePtr: VoidPtr = + Internals.getMethodBindPtr("CanvasItem", "set_visible", 2586408642) + + internal val isVisiblePtr: VoidPtr = + Internals.getMethodBindPtr("CanvasItem", "is_visible", 36873697) + + internal val isVisibleInTreePtr: VoidPtr = + Internals.getMethodBindPtr("CanvasItem", "is_visible_in_tree", 36873697) + + internal val showPtr: VoidPtr = Internals.getMethodBindPtr("CanvasItem", "show", 3218959716) + + internal val hidePtr: VoidPtr = Internals.getMethodBindPtr("CanvasItem", "hide", 3218959716) + + internal val queueRedrawPtr: VoidPtr = + Internals.getMethodBindPtr("CanvasItem", "queue_redraw", 3218959716) + + internal val moveToFrontPtr: VoidPtr = + Internals.getMethodBindPtr("CanvasItem", "move_to_front", 3218959716) + + internal val setAsTopLevelPtr: VoidPtr = + Internals.getMethodBindPtr("CanvasItem", "set_as_top_level", 2586408642) + + internal val isSetAsTopLevelPtr: VoidPtr = + Internals.getMethodBindPtr("CanvasItem", "is_set_as_top_level", 36873697) + + internal val setLightMaskPtr: VoidPtr = + Internals.getMethodBindPtr("CanvasItem", "set_light_mask", 1286410249) + + internal val getLightMaskPtr: VoidPtr = + Internals.getMethodBindPtr("CanvasItem", "get_light_mask", 3905245786) + + internal val setModulatePtr: VoidPtr = + Internals.getMethodBindPtr("CanvasItem", "set_modulate", 2920490490) + + internal val getModulatePtr: VoidPtr = + Internals.getMethodBindPtr("CanvasItem", "get_modulate", 3444240500) + + internal val setSelfModulatePtr: VoidPtr = + Internals.getMethodBindPtr("CanvasItem", "set_self_modulate", 2920490490) + + internal val getSelfModulatePtr: VoidPtr = + Internals.getMethodBindPtr("CanvasItem", "get_self_modulate", 3444240500) + + internal val setZIndexPtr: VoidPtr = + Internals.getMethodBindPtr("CanvasItem", "set_z_index", 1286410249) + + internal val getZIndexPtr: VoidPtr = + Internals.getMethodBindPtr("CanvasItem", "get_z_index", 3905245786) + + internal val setZAsRelativePtr: VoidPtr = + Internals.getMethodBindPtr("CanvasItem", "set_z_as_relative", 2586408642) + + internal val isZRelativePtr: VoidPtr = + Internals.getMethodBindPtr("CanvasItem", "is_z_relative", 36873697) + + internal val setYSortEnabledPtr: VoidPtr = + Internals.getMethodBindPtr("CanvasItem", "set_y_sort_enabled", 2586408642) + + internal val isYSortEnabledPtr: VoidPtr = + Internals.getMethodBindPtr("CanvasItem", "is_y_sort_enabled", 36873697) + + internal val setDrawBehindParentPtr: VoidPtr = + Internals.getMethodBindPtr("CanvasItem", "set_draw_behind_parent", 2586408642) + + internal val isDrawBehindParentEnabledPtr: VoidPtr = + Internals.getMethodBindPtr("CanvasItem", "is_draw_behind_parent_enabled", 36873697) + + internal val drawLinePtr: VoidPtr = + Internals.getMethodBindPtr("CanvasItem", "draw_line", 1562330099) + + internal val drawDashedLinePtr: VoidPtr = + Internals.getMethodBindPtr("CanvasItem", "draw_dashed_line", 3653831622) + + internal val drawPolylinePtr: VoidPtr = + Internals.getMethodBindPtr("CanvasItem", "draw_polyline", 3797364428) + + internal val drawPolylineColorsPtr: VoidPtr = + Internals.getMethodBindPtr("CanvasItem", "draw_polyline_colors", 2311979562) + + internal val drawArcPtr: VoidPtr = + Internals.getMethodBindPtr("CanvasItem", "draw_arc", 4140652635) + + internal val drawMultilinePtr: VoidPtr = + Internals.getMethodBindPtr("CanvasItem", "draw_multiline", 3797364428) + + internal val drawMultilineColorsPtr: VoidPtr = + Internals.getMethodBindPtr("CanvasItem", "draw_multiline_colors", 2311979562) + + internal val drawRectPtr: VoidPtr = + Internals.getMethodBindPtr("CanvasItem", "draw_rect", 2773573813) + + internal val drawCirclePtr: VoidPtr = + Internals.getMethodBindPtr("CanvasItem", "draw_circle", 3153026596) + + internal val drawTexturePtr: VoidPtr = + Internals.getMethodBindPtr("CanvasItem", "draw_texture", 520200117) + + internal val drawTextureRectPtr: VoidPtr = + Internals.getMethodBindPtr("CanvasItem", "draw_texture_rect", 3832805018) + + internal val drawTextureRectRegionPtr: VoidPtr = + Internals.getMethodBindPtr("CanvasItem", "draw_texture_rect_region", 3883821411) + + internal val drawMsdfTextureRectRegionPtr: VoidPtr = + Internals.getMethodBindPtr("CanvasItem", "draw_msdf_texture_rect_region", 4219163252) + + internal val drawLcdTextureRectRegionPtr: VoidPtr = + Internals.getMethodBindPtr("CanvasItem", "draw_lcd_texture_rect_region", 3212350954) + + internal val drawStyleBoxPtr: VoidPtr = + Internals.getMethodBindPtr("CanvasItem", "draw_style_box", 388176283) + + internal val drawPrimitivePtr: VoidPtr = + Internals.getMethodBindPtr("CanvasItem", "draw_primitive", 3288481815) + + internal val drawPolygonPtr: VoidPtr = + Internals.getMethodBindPtr("CanvasItem", "draw_polygon", 974537912) + + internal val drawColoredPolygonPtr: VoidPtr = + Internals.getMethodBindPtr("CanvasItem", "draw_colored_polygon", 15245644) + + internal val drawStringPtr: VoidPtr = + Internals.getMethodBindPtr("CanvasItem", "draw_string", 728290553) + + internal val drawMultilineStringPtr: VoidPtr = + Internals.getMethodBindPtr("CanvasItem", "draw_multiline_string", 1927038192) + + internal val drawStringOutlinePtr: VoidPtr = + Internals.getMethodBindPtr("CanvasItem", "draw_string_outline", 340562381) + + internal val drawMultilineStringOutlinePtr: VoidPtr = + Internals.getMethodBindPtr("CanvasItem", "draw_multiline_string_outline", 1912318525) + + internal val drawCharPtr: VoidPtr = + Internals.getMethodBindPtr("CanvasItem", "draw_char", 3339793283) + + internal val drawCharOutlinePtr: VoidPtr = + Internals.getMethodBindPtr("CanvasItem", "draw_char_outline", 3302344391) + + internal val drawMeshPtr: VoidPtr = + Internals.getMethodBindPtr("CanvasItem", "draw_mesh", 153818295) + + internal val drawMultimeshPtr: VoidPtr = + Internals.getMethodBindPtr("CanvasItem", "draw_multimesh", 937992368) + + internal val drawSetTransformPtr: VoidPtr = + Internals.getMethodBindPtr("CanvasItem", "draw_set_transform", 288975085) + + internal val drawSetTransformMatrixPtr: VoidPtr = + Internals.getMethodBindPtr("CanvasItem", "draw_set_transform_matrix", 2761652528) + + internal val drawAnimationSlicePtr: VoidPtr = + Internals.getMethodBindPtr("CanvasItem", "draw_animation_slice", 3112831842) + + internal val drawEndAnimationPtr: VoidPtr = + Internals.getMethodBindPtr("CanvasItem", "draw_end_animation", 3218959716) + + internal val getTransformPtr: VoidPtr = + Internals.getMethodBindPtr("CanvasItem", "get_transform", 3814499831) + + internal val getGlobalTransformPtr: VoidPtr = + Internals.getMethodBindPtr("CanvasItem", "get_global_transform", 3814499831) + + internal val getGlobalTransformWithCanvasPtr: VoidPtr = + Internals.getMethodBindPtr("CanvasItem", "get_global_transform_with_canvas", 3814499831) + + internal val getViewportTransformPtr: VoidPtr = + Internals.getMethodBindPtr("CanvasItem", "get_viewport_transform", 3814499831) + + internal val getViewportRectPtr: VoidPtr = + Internals.getMethodBindPtr("CanvasItem", "get_viewport_rect", 1639390495) + + internal val getCanvasTransformPtr: VoidPtr = + Internals.getMethodBindPtr("CanvasItem", "get_canvas_transform", 3814499831) + + internal val getScreenTransformPtr: VoidPtr = + Internals.getMethodBindPtr("CanvasItem", "get_screen_transform", 3814499831) + + internal val getLocalMousePositionPtr: VoidPtr = + Internals.getMethodBindPtr("CanvasItem", "get_local_mouse_position", 3341600327) + + internal val getGlobalMousePositionPtr: VoidPtr = + Internals.getMethodBindPtr("CanvasItem", "get_global_mouse_position", 3341600327) + + internal val getCanvasPtr: VoidPtr = + Internals.getMethodBindPtr("CanvasItem", "get_canvas", 2944877500) + + internal val getCanvasLayerNodePtr: VoidPtr = + Internals.getMethodBindPtr("CanvasItem", "get_canvas_layer_node", 2602762519) + + internal val getWorld2dPtr: VoidPtr = + Internals.getMethodBindPtr("CanvasItem", "get_world_2d", 2339128592) + + internal val setMaterialPtr: VoidPtr = + Internals.getMethodBindPtr("CanvasItem", "set_material", 2757459619) + + internal val getMaterialPtr: VoidPtr = + Internals.getMethodBindPtr("CanvasItem", "get_material", 5934680) + + internal val setUseParentMaterialPtr: VoidPtr = + Internals.getMethodBindPtr("CanvasItem", "set_use_parent_material", 2586408642) + + internal val getUseParentMaterialPtr: VoidPtr = + Internals.getMethodBindPtr("CanvasItem", "get_use_parent_material", 36873697) + + internal val setNotifyLocalTransformPtr: VoidPtr = + Internals.getMethodBindPtr("CanvasItem", "set_notify_local_transform", 2586408642) + + internal val isLocalTransformNotificationEnabledPtr: VoidPtr = + Internals.getMethodBindPtr("CanvasItem", "is_local_transform_notification_enabled", 36873697) + + internal val setNotifyTransformPtr: VoidPtr = + Internals.getMethodBindPtr("CanvasItem", "set_notify_transform", 2586408642) + + internal val isTransformNotificationEnabledPtr: VoidPtr = + Internals.getMethodBindPtr("CanvasItem", "is_transform_notification_enabled", 36873697) + + internal val forceUpdateTransformPtr: VoidPtr = + Internals.getMethodBindPtr("CanvasItem", "force_update_transform", 3218959716) + + internal val makeCanvasPositionLocalPtr: VoidPtr = + Internals.getMethodBindPtr("CanvasItem", "make_canvas_position_local", 2656412154) + + internal val makeInputLocalPtr: VoidPtr = + Internals.getMethodBindPtr("CanvasItem", "make_input_local", 811130057) + + internal val setVisibilityLayerPtr: VoidPtr = + Internals.getMethodBindPtr("CanvasItem", "set_visibility_layer", 1286410249) + + internal val getVisibilityLayerPtr: VoidPtr = + Internals.getMethodBindPtr("CanvasItem", "get_visibility_layer", 3905245786) + + internal val setVisibilityLayerBitPtr: VoidPtr = + Internals.getMethodBindPtr("CanvasItem", "set_visibility_layer_bit", 300928843) + + internal val getVisibilityLayerBitPtr: VoidPtr = + Internals.getMethodBindPtr("CanvasItem", "get_visibility_layer_bit", 1116898809) + + internal val setTextureFilterPtr: VoidPtr = + Internals.getMethodBindPtr("CanvasItem", "set_texture_filter", 1037999706) + + internal val getTextureFilterPtr: VoidPtr = + Internals.getMethodBindPtr("CanvasItem", "get_texture_filter", 121960042) + + internal val setTextureRepeatPtr: VoidPtr = + Internals.getMethodBindPtr("CanvasItem", "set_texture_repeat", 1716472974) + + internal val getTextureRepeatPtr: VoidPtr = + Internals.getMethodBindPtr("CanvasItem", "get_texture_repeat", 2667158319) + + internal val setClipChildrenModePtr: VoidPtr = + Internals.getMethodBindPtr("CanvasItem", "set_clip_children_mode", 1319393776) + + internal val getClipChildrenModePtr: VoidPtr = + Internals.getMethodBindPtr("CanvasItem", "get_clip_children_mode", 3581808349) + } +} diff --git a/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/CanvasItemMaterial.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/CanvasItemMaterial.kt new file mode 100644 index 0000000000..a4572f1492 --- /dev/null +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/CanvasItemMaterial.kt @@ -0,0 +1,280 @@ +// THIS FILE IS GENERATED! DO NOT EDIT IT MANUALLY! +@file:Suppress("PackageDirectoryMismatch", "unused", "FunctionName", "RedundantModalityModifier", + "UNCHECKED_CAST", "JoinDeclarationAndAssignment", "USELESS_CAST", + "RemoveRedundantQualifierName", "NOTHING_TO_INLINE", "NON_FINAL_MEMBER_IN_OBJECT", + "RedundantVisibilityModifier", "RedundantUnitReturnType", "MemberVisibilityCanBePrivate") + +package godot + +import godot.`annotation`.GodotBaseType +import godot.core.VariantParser.BOOL +import godot.core.VariantParser.LONG +import godot.core.VariantParser.NIL +import godot.util.Internals +import godot.util.VoidPtr +import kotlin.Boolean +import kotlin.Int +import kotlin.Long +import kotlin.Suppress +import kotlin.Unit +import kotlin.jvm.JvmName + +private const val ENGINE_CLASS_CANVASITEMMATERIAL_INDEX: Int = 170 + +/** + * [CanvasItemMaterial]s provide a means of modifying the textures associated with a CanvasItem. + * They specialize in describing blend and lighting behaviors for textures. Use a [ShaderMaterial] to + * more fully customize a material's interactions with a [CanvasItem]. + */ +@GodotBaseType +public open class CanvasItemMaterial : Material() { + /** + * The manner in which a material's rendering is applied to underlying textures. + */ + public final inline var blendMode: BlendMode + @JvmName("blendModeProperty") + get() = getBlendMode() + @JvmName("blendModeProperty") + set(`value`) { + setBlendMode(value) + } + + /** + * The manner in which material reacts to lighting. + */ + public final inline var lightMode: LightMode + @JvmName("lightModeProperty") + get() = getLightMode() + @JvmName("lightModeProperty") + set(`value`) { + setLightMode(value) + } + + /** + * If `true`, enable spritesheet-based animation features when assigned to [GPUParticles2D] and + * [CPUParticles2D] nodes. The [ParticleProcessMaterial.animSpeedMax] or + * [CPUParticles2D.animSpeedMax] should also be set to a positive value for the animation to play. + * This property (and other `particles_anim_*` properties that depend on it) has no effect on + * other types of nodes. + */ + public final inline var particlesAnimation: Boolean + @JvmName("particlesAnimationProperty") + get() = getParticlesAnimation() + @JvmName("particlesAnimationProperty") + set(`value`) { + setParticlesAnimation(value) + } + + /** + * The number of columns in the spritesheet assigned as [Texture2D] for a [GPUParticles2D] or + * [CPUParticles2D]. + * **Note:** This property is only used and visible in the editor if [particlesAnimation] is + * `true`. + */ + public final inline var particlesAnimHFrames: Int + @JvmName("particlesAnimHFramesProperty") + get() = getParticlesAnimHFrames() + @JvmName("particlesAnimHFramesProperty") + set(`value`) { + setParticlesAnimHFrames(value) + } + + /** + * The number of rows in the spritesheet assigned as [Texture2D] for a [GPUParticles2D] or + * [CPUParticles2D]. + * **Note:** This property is only used and visible in the editor if [particlesAnimation] is + * `true`. + */ + public final inline var particlesAnimVFrames: Int + @JvmName("particlesAnimVFramesProperty") + get() = getParticlesAnimVFrames() + @JvmName("particlesAnimVFramesProperty") + set(`value`) { + setParticlesAnimVFrames(value) + } + + /** + * If `true`, the particles animation will loop. + * **Note:** This property is only used and visible in the editor if [particlesAnimation] is + * `true`. + */ + public final inline var particlesAnimLoop: Boolean + @JvmName("particlesAnimLoopProperty") + get() = getParticlesAnimLoop() + @JvmName("particlesAnimLoopProperty") + set(`value`) { + setParticlesAnimLoop(value) + } + + public override fun new(scriptIndex: Int): Unit { + Internals.callConstructor(this, ENGINE_CLASS_CANVASITEMMATERIAL_INDEX, scriptIndex) + } + + public final fun setBlendMode(blendMode: BlendMode): Unit { + Internals.writeArguments(LONG to blendMode.id) + Internals.callMethod(rawPtr, MethodBindings.setBlendModePtr, NIL) + } + + public final fun getBlendMode(): BlendMode { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getBlendModePtr, LONG) + return CanvasItemMaterial.BlendMode.from(Internals.readReturnValue(LONG) as Long) + } + + public final fun setLightMode(lightMode: LightMode): Unit { + Internals.writeArguments(LONG to lightMode.id) + Internals.callMethod(rawPtr, MethodBindings.setLightModePtr, NIL) + } + + public final fun getLightMode(): LightMode { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getLightModePtr, LONG) + return CanvasItemMaterial.LightMode.from(Internals.readReturnValue(LONG) as Long) + } + + public final fun setParticlesAnimation(particlesAnim: Boolean): Unit { + Internals.writeArguments(BOOL to particlesAnim) + Internals.callMethod(rawPtr, MethodBindings.setParticlesAnimationPtr, NIL) + } + + public final fun getParticlesAnimation(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getParticlesAnimationPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public final fun setParticlesAnimHFrames(frames: Int): Unit { + Internals.writeArguments(LONG to frames.toLong()) + Internals.callMethod(rawPtr, MethodBindings.setParticlesAnimHFramesPtr, NIL) + } + + public final fun getParticlesAnimHFrames(): Int { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getParticlesAnimHFramesPtr, LONG) + return (Internals.readReturnValue(LONG) as Long).toInt() + } + + public final fun setParticlesAnimVFrames(frames: Int): Unit { + Internals.writeArguments(LONG to frames.toLong()) + Internals.callMethod(rawPtr, MethodBindings.setParticlesAnimVFramesPtr, NIL) + } + + public final fun getParticlesAnimVFrames(): Int { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getParticlesAnimVFramesPtr, LONG) + return (Internals.readReturnValue(LONG) as Long).toInt() + } + + public final fun setParticlesAnimLoop(loop: Boolean): Unit { + Internals.writeArguments(BOOL to loop) + Internals.callMethod(rawPtr, MethodBindings.setParticlesAnimLoopPtr, NIL) + } + + public final fun getParticlesAnimLoop(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getParticlesAnimLoopPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public enum class BlendMode( + id: Long, + ) { + /** + * Mix blending mode. Colors are assumed to be independent of the alpha (opacity) value. + */ + BLEND_MODE_MIX(0), + /** + * Additive blending mode. + */ + BLEND_MODE_ADD(1), + /** + * Subtractive blending mode. + */ + BLEND_MODE_SUB(2), + /** + * Multiplicative blending mode. + */ + BLEND_MODE_MUL(3), + /** + * Mix blending mode. Colors are assumed to be premultiplied by the alpha (opacity) value. + */ + BLEND_MODE_PREMULT_ALPHA(4), + ; + + public val id: Long + init { + this.id = id + } + + public companion object { + public fun from(`value`: Long): BlendMode = entries.single { it.id == `value` } + } + } + + public enum class LightMode( + id: Long, + ) { + /** + * Render the material using both light and non-light sensitive material properties. + */ + LIGHT_MODE_NORMAL(0), + /** + * Render the material as if there were no light. + */ + LIGHT_MODE_UNSHADED(1), + /** + * Render the material as if there were only light. + */ + LIGHT_MODE_LIGHT_ONLY(2), + ; + + public val id: Long + init { + this.id = id + } + + public companion object { + public fun from(`value`: Long): LightMode = entries.single { it.id == `value` } + } + } + + public companion object + + public object MethodBindings { + internal val setBlendModePtr: VoidPtr = + Internals.getMethodBindPtr("CanvasItemMaterial", "set_blend_mode", 1786054936) + + internal val getBlendModePtr: VoidPtr = + Internals.getMethodBindPtr("CanvasItemMaterial", "get_blend_mode", 3318684035) + + internal val setLightModePtr: VoidPtr = + Internals.getMethodBindPtr("CanvasItemMaterial", "set_light_mode", 628074070) + + internal val getLightModePtr: VoidPtr = + Internals.getMethodBindPtr("CanvasItemMaterial", "get_light_mode", 3863292382) + + internal val setParticlesAnimationPtr: VoidPtr = + Internals.getMethodBindPtr("CanvasItemMaterial", "set_particles_animation", 2586408642) + + internal val getParticlesAnimationPtr: VoidPtr = + Internals.getMethodBindPtr("CanvasItemMaterial", "get_particles_animation", 36873697) + + internal val setParticlesAnimHFramesPtr: VoidPtr = + Internals.getMethodBindPtr("CanvasItemMaterial", "set_particles_anim_h_frames", 1286410249) + + internal val getParticlesAnimHFramesPtr: VoidPtr = + Internals.getMethodBindPtr("CanvasItemMaterial", "get_particles_anim_h_frames", 3905245786) + + internal val setParticlesAnimVFramesPtr: VoidPtr = + Internals.getMethodBindPtr("CanvasItemMaterial", "set_particles_anim_v_frames", 1286410249) + + internal val getParticlesAnimVFramesPtr: VoidPtr = + Internals.getMethodBindPtr("CanvasItemMaterial", "get_particles_anim_v_frames", 3905245786) + + internal val setParticlesAnimLoopPtr: VoidPtr = + Internals.getMethodBindPtr("CanvasItemMaterial", "set_particles_anim_loop", 2586408642) + + internal val getParticlesAnimLoopPtr: VoidPtr = + Internals.getMethodBindPtr("CanvasItemMaterial", "get_particles_anim_loop", 36873697) + } +} diff --git a/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/CanvasLayer.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/CanvasLayer.kt new file mode 100644 index 0000000000..d990231880 --- /dev/null +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/CanvasLayer.kt @@ -0,0 +1,450 @@ +// THIS FILE IS GENERATED! DO NOT EDIT IT MANUALLY! +@file:Suppress("PackageDirectoryMismatch", "unused", "FunctionName", "RedundantModalityModifier", + "UNCHECKED_CAST", "JoinDeclarationAndAssignment", "USELESS_CAST", + "RemoveRedundantQualifierName", "NOTHING_TO_INLINE", "NON_FINAL_MEMBER_IN_OBJECT", + "RedundantVisibilityModifier", "RedundantUnitReturnType", "MemberVisibilityCanBePrivate") + +package godot + +import godot.`annotation`.CoreTypeHelper +import godot.`annotation`.CoreTypeLocalCopy +import godot.`annotation`.GodotBaseType +import godot.core.RID +import godot.core.Signal0 +import godot.core.Transform2D +import godot.core.VariantParser.BOOL +import godot.core.VariantParser.DOUBLE +import godot.core.VariantParser.LONG +import godot.core.VariantParser.NIL +import godot.core.VariantParser.OBJECT +import godot.core.VariantParser.TRANSFORM2D +import godot.core.VariantParser.VECTOR2 +import godot.core.VariantParser._RID +import godot.core.Vector2 +import godot.util.Internals +import godot.util.VoidPtr +import kotlin.Boolean +import kotlin.Double +import kotlin.Float +import kotlin.Int +import kotlin.Long +import kotlin.Suppress +import kotlin.Unit +import kotlin.jvm.JvmName + +private const val ENGINE_CLASS_CANVASLAYER_INDEX: Int = 171 + +/** + * [CanvasItem]-derived nodes that are direct or indirect children of a [CanvasLayer] will be drawn + * in that layer. The layer is a numeric index that defines the draw order. The default 2D scene + * renders with index `0`, so a [CanvasLayer] with index `-1` will be drawn below, and a [CanvasLayer] + * with index `1` will be drawn above. This order will hold regardless of the [CanvasItem.zIndex] of + * the nodes within each layer. + * [CanvasLayer]s can be hidden and they can also optionally follow the viewport. This makes them + * useful for HUDs like health bar overlays (on layers `1` and higher) or backgrounds (on layers `-1` + * and lower). + * **Note:** Embedded [Window]s are placed on layer `1024`. [CanvasItem]s on layers `1025` and + * higher appear in front of embedded windows. + * **Note:** Each [CanvasLayer] is drawn on one specific [Viewport] and cannot be shared between + * multiple [Viewport]s, see [customViewport]. When using multiple [Viewport]s, for example in a + * split-screen game, you need create an individual [CanvasLayer] for each [Viewport] you want it to be + * drawn on. + */ +@GodotBaseType +public open class CanvasLayer : Node() { + /** + * Emitted when visibility of the layer is changed. See [visible]. + */ + public val visibilityChanged: Signal0 by Signal0 + + /** + * Layer index for draw order. Lower values are drawn behind higher values. + * **Note:** If multiple CanvasLayers have the same layer index, [CanvasItem] children of one + * CanvasLayer are drawn behind the [CanvasItem] children of the other CanvasLayer. Which CanvasLayer + * is drawn in front is non-deterministic. + */ + public final inline var layer: Int + @JvmName("layerProperty") + get() = getLayer() + @JvmName("layerProperty") + set(`value`) { + setLayer(value) + } + + /** + * If `false`, any [CanvasItem] under this [CanvasLayer] will be hidden. + * Unlike [CanvasItem.visible], visibility of a [CanvasLayer] isn't propagated to underlying + * layers. + */ + public final inline var visible: Boolean + @JvmName("visibleProperty") + get() = isVisible() + @JvmName("visibleProperty") + set(`value`) { + setVisible(value) + } + + /** + * The layer's base offset. + */ + @CoreTypeLocalCopy + public final inline var offset: Vector2 + @JvmName("offsetProperty") + get() = getOffset() + @JvmName("offsetProperty") + set(`value`) { + setOffset(value) + } + + /** + * The layer's rotation in radians. + */ + public final inline var rotation: Float + @JvmName("rotationProperty") + get() = getRotation() + @JvmName("rotationProperty") + set(`value`) { + setRotation(value) + } + + /** + * The layer's scale. + */ + @CoreTypeLocalCopy + public final inline var scale: Vector2 + @JvmName("scaleProperty") + get() = getScale() + @JvmName("scaleProperty") + set(`value`) { + setScale(value) + } + + /** + * The layer's transform. + */ + @CoreTypeLocalCopy + public final inline var transform: Transform2D + @JvmName("transformProperty") + get() = getTransform() + @JvmName("transformProperty") + set(`value`) { + setTransform(value) + } + + /** + * The custom [Viewport] node assigned to the [CanvasLayer]. If `null`, uses the default viewport + * instead. + */ + public final inline var customViewport: Node? + @JvmName("customViewportProperty") + get() = getCustomViewport() + @JvmName("customViewportProperty") + set(`value`) { + setCustomViewport(value) + } + + /** + * If enabled, the [CanvasLayer] will use the viewport's transform, so it will move when camera + * moves instead of being anchored in a fixed position on the screen. + * Together with [followViewportScale] it can be used for a pseudo 3D effect. + */ + public final inline var followViewportEnabled: Boolean + @JvmName("followViewportEnabledProperty") + get() = isFollowingViewport() + @JvmName("followViewportEnabledProperty") + set(`value`) { + setFollowViewport(value) + } + + /** + * Scales the layer when using [followViewportEnabled]. Layers moving into the foreground should + * have increasing scales, while layers moving into the background should have decreasing scales. + */ + public final inline var followViewportScale: Float + @JvmName("followViewportScaleProperty") + get() = getFollowViewportScale() + @JvmName("followViewportScaleProperty") + set(`value`) { + setFollowViewportScale(value) + } + + public override fun new(scriptIndex: Int): Unit { + Internals.callConstructor(this, ENGINE_CLASS_CANVASLAYER_INDEX, scriptIndex) + } + + /** + * The layer's base offset. + * + * This is a helper function to make dealing with local copies easier. + * + * For more information, see our + * [documentation](https://godot-kotl.in/en/stable/user-guide/api-differences/#core-types). + * + * Allow to directly modify the local copy of the property and assign it back to the Object. + * + * Prefer that over writing: + * `````` + * val myCoreType = canvaslayer.offset + * //Your changes + * canvaslayer.offset = myCoreType + * `````` + */ + @CoreTypeHelper + public final fun offsetMutate(block: Vector2.() -> Unit): Vector2 = offset.apply{ + block(this) + offset = this + } + + + /** + * The layer's scale. + * + * This is a helper function to make dealing with local copies easier. + * + * For more information, see our + * [documentation](https://godot-kotl.in/en/stable/user-guide/api-differences/#core-types). + * + * Allow to directly modify the local copy of the property and assign it back to the Object. + * + * Prefer that over writing: + * `````` + * val myCoreType = canvaslayer.scale + * //Your changes + * canvaslayer.scale = myCoreType + * `````` + */ + @CoreTypeHelper + public final fun scaleMutate(block: Vector2.() -> Unit): Vector2 = scale.apply{ + block(this) + scale = this + } + + + /** + * The layer's transform. + * + * This is a helper function to make dealing with local copies easier. + * + * For more information, see our + * [documentation](https://godot-kotl.in/en/stable/user-guide/api-differences/#core-types). + * + * Allow to directly modify the local copy of the property and assign it back to the Object. + * + * Prefer that over writing: + * `````` + * val myCoreType = canvaslayer.transform + * //Your changes + * canvaslayer.transform = myCoreType + * `````` + */ + @CoreTypeHelper + public final fun transformMutate(block: Transform2D.() -> Unit): Transform2D = transform.apply{ + block(this) + transform = this + } + + + public final fun setLayer(layer: Int): Unit { + Internals.writeArguments(LONG to layer.toLong()) + Internals.callMethod(rawPtr, MethodBindings.setLayerPtr, NIL) + } + + public final fun getLayer(): Int { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getLayerPtr, LONG) + return (Internals.readReturnValue(LONG) as Long).toInt() + } + + public final fun setVisible(visible: Boolean): Unit { + Internals.writeArguments(BOOL to visible) + Internals.callMethod(rawPtr, MethodBindings.setVisiblePtr, NIL) + } + + public final fun isVisible(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isVisiblePtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + /** + * Shows any [CanvasItem] under this [CanvasLayer]. This is equivalent to setting [visible] to + * `true`. + */ + public final fun show(): Unit { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.showPtr, NIL) + } + + /** + * Hides any [CanvasItem] under this [CanvasLayer]. This is equivalent to setting [visible] to + * `false`. + */ + public final fun hide(): Unit { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.hidePtr, NIL) + } + + public final fun setTransform(transform: Transform2D): Unit { + Internals.writeArguments(TRANSFORM2D to transform) + Internals.callMethod(rawPtr, MethodBindings.setTransformPtr, NIL) + } + + public final fun getTransform(): Transform2D { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getTransformPtr, TRANSFORM2D) + return (Internals.readReturnValue(TRANSFORM2D) as Transform2D) + } + + /** + * Returns the transform from the [CanvasLayer]s coordinate system to the [Viewport]s coordinate + * system. + */ + public final fun getFinalTransform(): Transform2D { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getFinalTransformPtr, TRANSFORM2D) + return (Internals.readReturnValue(TRANSFORM2D) as Transform2D) + } + + public final fun setOffset(offset: Vector2): Unit { + Internals.writeArguments(VECTOR2 to offset) + Internals.callMethod(rawPtr, MethodBindings.setOffsetPtr, NIL) + } + + public final fun getOffset(): Vector2 { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getOffsetPtr, VECTOR2) + return (Internals.readReturnValue(VECTOR2) as Vector2) + } + + public final fun setRotation(radians: Float): Unit { + Internals.writeArguments(DOUBLE to radians.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setRotationPtr, NIL) + } + + public final fun getRotation(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getRotationPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setScale(scale: Vector2): Unit { + Internals.writeArguments(VECTOR2 to scale) + Internals.callMethod(rawPtr, MethodBindings.setScalePtr, NIL) + } + + public final fun getScale(): Vector2 { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getScalePtr, VECTOR2) + return (Internals.readReturnValue(VECTOR2) as Vector2) + } + + public final fun setFollowViewport(enable: Boolean): Unit { + Internals.writeArguments(BOOL to enable) + Internals.callMethod(rawPtr, MethodBindings.setFollowViewportPtr, NIL) + } + + public final fun isFollowingViewport(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isFollowingViewportPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public final fun setFollowViewportScale(scale: Float): Unit { + Internals.writeArguments(DOUBLE to scale.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setFollowViewportScalePtr, NIL) + } + + public final fun getFollowViewportScale(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getFollowViewportScalePtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setCustomViewport(viewport: Node?): Unit { + Internals.writeArguments(OBJECT to viewport) + Internals.callMethod(rawPtr, MethodBindings.setCustomViewportPtr, NIL) + } + + public final fun getCustomViewport(): Node? { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getCustomViewportPtr, OBJECT) + return (Internals.readReturnValue(OBJECT) as Node?) + } + + /** + * Returns the RID of the canvas used by this layer. + */ + public final fun getCanvas(): RID { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getCanvasPtr, _RID) + return (Internals.readReturnValue(_RID) as RID) + } + + public companion object + + public object MethodBindings { + internal val setLayerPtr: VoidPtr = + Internals.getMethodBindPtr("CanvasLayer", "set_layer", 1286410249) + + internal val getLayerPtr: VoidPtr = + Internals.getMethodBindPtr("CanvasLayer", "get_layer", 3905245786) + + internal val setVisiblePtr: VoidPtr = + Internals.getMethodBindPtr("CanvasLayer", "set_visible", 2586408642) + + internal val isVisiblePtr: VoidPtr = + Internals.getMethodBindPtr("CanvasLayer", "is_visible", 36873697) + + internal val showPtr: VoidPtr = Internals.getMethodBindPtr("CanvasLayer", "show", 3218959716) + + internal val hidePtr: VoidPtr = Internals.getMethodBindPtr("CanvasLayer", "hide", 3218959716) + + internal val setTransformPtr: VoidPtr = + Internals.getMethodBindPtr("CanvasLayer", "set_transform", 2761652528) + + internal val getTransformPtr: VoidPtr = + Internals.getMethodBindPtr("CanvasLayer", "get_transform", 3814499831) + + internal val getFinalTransformPtr: VoidPtr = + Internals.getMethodBindPtr("CanvasLayer", "get_final_transform", 3814499831) + + internal val setOffsetPtr: VoidPtr = + Internals.getMethodBindPtr("CanvasLayer", "set_offset", 743155724) + + internal val getOffsetPtr: VoidPtr = + Internals.getMethodBindPtr("CanvasLayer", "get_offset", 3341600327) + + internal val setRotationPtr: VoidPtr = + Internals.getMethodBindPtr("CanvasLayer", "set_rotation", 373806689) + + internal val getRotationPtr: VoidPtr = + Internals.getMethodBindPtr("CanvasLayer", "get_rotation", 1740695150) + + internal val setScalePtr: VoidPtr = + Internals.getMethodBindPtr("CanvasLayer", "set_scale", 743155724) + + internal val getScalePtr: VoidPtr = + Internals.getMethodBindPtr("CanvasLayer", "get_scale", 3341600327) + + internal val setFollowViewportPtr: VoidPtr = + Internals.getMethodBindPtr("CanvasLayer", "set_follow_viewport", 2586408642) + + internal val isFollowingViewportPtr: VoidPtr = + Internals.getMethodBindPtr("CanvasLayer", "is_following_viewport", 36873697) + + internal val setFollowViewportScalePtr: VoidPtr = + Internals.getMethodBindPtr("CanvasLayer", "set_follow_viewport_scale", 373806689) + + internal val getFollowViewportScalePtr: VoidPtr = + Internals.getMethodBindPtr("CanvasLayer", "get_follow_viewport_scale", 1740695150) + + internal val setCustomViewportPtr: VoidPtr = + Internals.getMethodBindPtr("CanvasLayer", "set_custom_viewport", 1078189570) + + internal val getCustomViewportPtr: VoidPtr = + Internals.getMethodBindPtr("CanvasLayer", "get_custom_viewport", 3160264692) + + internal val getCanvasPtr: VoidPtr = + Internals.getMethodBindPtr("CanvasLayer", "get_canvas", 2944877500) + } +} diff --git a/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/CanvasModulate.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/CanvasModulate.kt new file mode 100644 index 0000000000..3bf35a1d6c --- /dev/null +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/CanvasModulate.kt @@ -0,0 +1,90 @@ +// THIS FILE IS GENERATED! DO NOT EDIT IT MANUALLY! +@file:Suppress("PackageDirectoryMismatch", "unused", "FunctionName", "RedundantModalityModifier", + "UNCHECKED_CAST", "JoinDeclarationAndAssignment", "USELESS_CAST", + "RemoveRedundantQualifierName", "NOTHING_TO_INLINE", "NON_FINAL_MEMBER_IN_OBJECT", + "RedundantVisibilityModifier", "RedundantUnitReturnType", "MemberVisibilityCanBePrivate") + +package godot + +import godot.`annotation`.CoreTypeHelper +import godot.`annotation`.CoreTypeLocalCopy +import godot.`annotation`.GodotBaseType +import godot.core.Color +import godot.core.VariantParser.COLOR +import godot.core.VariantParser.NIL +import godot.util.Internals +import godot.util.VoidPtr +import kotlin.Int +import kotlin.Suppress +import kotlin.Unit +import kotlin.jvm.JvmName + +private const val ENGINE_CLASS_CANVASMODULATE_INDEX: Int = 172 + +/** + * [CanvasModulate] applies a color tint to all nodes on a canvas. Only one can be used to tint a + * canvas, but [CanvasLayer]s can be used to render things independently. + */ +@GodotBaseType +public open class CanvasModulate : Node2D() { + /** + * The tint color to apply. + */ + @CoreTypeLocalCopy + public final inline var color: Color + @JvmName("colorProperty") + get() = getColor() + @JvmName("colorProperty") + set(`value`) { + setColor(value) + } + + public override fun new(scriptIndex: Int): Unit { + Internals.callConstructor(this, ENGINE_CLASS_CANVASMODULATE_INDEX, scriptIndex) + } + + /** + * The tint color to apply. + * + * This is a helper function to make dealing with local copies easier. + * + * For more information, see our + * [documentation](https://godot-kotl.in/en/stable/user-guide/api-differences/#core-types). + * + * Allow to directly modify the local copy of the property and assign it back to the Object. + * + * Prefer that over writing: + * `````` + * val myCoreType = canvasmodulate.color + * //Your changes + * canvasmodulate.color = myCoreType + * `````` + */ + @CoreTypeHelper + public final fun colorMutate(block: Color.() -> Unit): Color = color.apply{ + block(this) + color = this + } + + + public final fun setColor(color: Color): Unit { + Internals.writeArguments(COLOR to color) + Internals.callMethod(rawPtr, MethodBindings.setColorPtr, NIL) + } + + public final fun getColor(): Color { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getColorPtr, COLOR) + return (Internals.readReturnValue(COLOR) as Color) + } + + public companion object + + public object MethodBindings { + internal val setColorPtr: VoidPtr = + Internals.getMethodBindPtr("CanvasModulate", "set_color", 2920490490) + + internal val getColorPtr: VoidPtr = + Internals.getMethodBindPtr("CanvasModulate", "get_color", 3444240500) + } +} diff --git a/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/CanvasTexture.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/CanvasTexture.kt new file mode 100644 index 0000000000..60a9f7cb8c --- /dev/null +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/CanvasTexture.kt @@ -0,0 +1,283 @@ +// THIS FILE IS GENERATED! DO NOT EDIT IT MANUALLY! +@file:Suppress("PackageDirectoryMismatch", "unused", "FunctionName", "RedundantModalityModifier", + "UNCHECKED_CAST", "JoinDeclarationAndAssignment", "USELESS_CAST", + "RemoveRedundantQualifierName", "NOTHING_TO_INLINE", "NON_FINAL_MEMBER_IN_OBJECT", + "RedundantVisibilityModifier", "RedundantUnitReturnType", "MemberVisibilityCanBePrivate") + +package godot + +import godot.`annotation`.CoreTypeHelper +import godot.`annotation`.CoreTypeLocalCopy +import godot.`annotation`.GodotBaseType +import godot.core.Color +import godot.core.VariantParser.COLOR +import godot.core.VariantParser.DOUBLE +import godot.core.VariantParser.LONG +import godot.core.VariantParser.NIL +import godot.core.VariantParser.OBJECT +import godot.util.Internals +import godot.util.VoidPtr +import kotlin.Double +import kotlin.Float +import kotlin.Int +import kotlin.Long +import kotlin.Suppress +import kotlin.Unit +import kotlin.jvm.JvmName + +private const val ENGINE_CLASS_CANVASTEXTURE_INDEX: Int = 173 + +/** + * [CanvasTexture] is an alternative to [ImageTexture] for 2D rendering. It allows using normal maps + * and specular maps in any node that inherits from [CanvasItem]. [CanvasTexture] also allows + * overriding the texture's filter and repeat mode independently of the node's properties (or the + * project settings). + * **Note:** [CanvasTexture] cannot be used in 3D. It will not display correctly when applied to any + * [VisualInstance3D], such as [Sprite3D] or [Decal]. For physically-based materials in 3D, use + * [BaseMaterial3D] instead. + */ +@GodotBaseType +public open class CanvasTexture : Texture2D() { + /** + * The diffuse (color) texture to use. This is the main texture you want to set in most cases. + */ + public final inline var diffuseTexture: Texture2D? + @JvmName("diffuseTextureProperty") + get() = getDiffuseTexture() + @JvmName("diffuseTextureProperty") + set(`value`) { + setDiffuseTexture(value) + } + + /** + * The normal map texture to use. Only has a visible effect if [Light2D]s are affecting this + * [CanvasTexture]. + * **Note:** Godot expects the normal map to use X+, Y+, and Z+ coordinates. See + * [url=http://wiki.polycount.com/wiki/Normal_Map_Technical_Details#Common_Swizzle_Coordinates]this + * page[/url] for a comparison of normal map coordinates expected by popular engines. + */ + public final inline var normalTexture: Texture2D? + @JvmName("normalTextureProperty") + get() = getNormalTexture() + @JvmName("normalTextureProperty") + set(`value`) { + setNormalTexture(value) + } + + /** + * The specular map to use for [Light2D] specular reflections. This should be a grayscale or + * colored texture, with brighter areas resulting in a higher [specularShininess] value. Using a + * colored [specularTexture] allows controlling specular shininess on a per-channel basis. Only has a + * visible effect if [Light2D]s are affecting this [CanvasTexture]. + */ + public final inline var specularTexture: Texture2D? + @JvmName("specularTextureProperty") + get() = getSpecularTexture() + @JvmName("specularTextureProperty") + set(`value`) { + setSpecularTexture(value) + } + + /** + * The multiplier for specular reflection colors. The [Light2D]'s color is also taken into account + * when determining the reflection color. Only has a visible effect if [Light2D]s are affecting this + * [CanvasTexture]. + */ + @CoreTypeLocalCopy + public final inline var specularColor: Color + @JvmName("specularColorProperty") + get() = getSpecularColor() + @JvmName("specularColorProperty") + set(`value`) { + setSpecularColor(value) + } + + /** + * The specular exponent for [Light2D] specular reflections. Higher values result in a more + * glossy/"wet" look, with reflections becoming more localized and less visible overall. The default + * value of `1.0` disables specular reflections entirely. Only has a visible effect if [Light2D]s are + * affecting this [CanvasTexture]. + */ + public final inline var specularShininess: Float + @JvmName("specularShininessProperty") + get() = getSpecularShininess() + @JvmName("specularShininessProperty") + set(`value`) { + setSpecularShininess(value) + } + + /** + * The texture filtering mode to use when drawing this [CanvasTexture]. + */ + public final inline var textureFilter: CanvasItem.TextureFilter + @JvmName("textureFilterProperty") + get() = getTextureFilter() + @JvmName("textureFilterProperty") + set(`value`) { + setTextureFilter(value) + } + + /** + * The texture repeat mode to use when drawing this [CanvasTexture]. + */ + public final inline var textureRepeat: CanvasItem.TextureRepeat + @JvmName("textureRepeatProperty") + get() = getTextureRepeat() + @JvmName("textureRepeatProperty") + set(`value`) { + setTextureRepeat(value) + } + + public override fun new(scriptIndex: Int): Unit { + Internals.callConstructor(this, ENGINE_CLASS_CANVASTEXTURE_INDEX, scriptIndex) + } + + /** + * The multiplier for specular reflection colors. The [Light2D]'s color is also taken into account + * when determining the reflection color. Only has a visible effect if [Light2D]s are affecting this + * [CanvasTexture]. + * + * This is a helper function to make dealing with local copies easier. + * + * For more information, see our + * [documentation](https://godot-kotl.in/en/stable/user-guide/api-differences/#core-types). + * + * Allow to directly modify the local copy of the property and assign it back to the Object. + * + * Prefer that over writing: + * `````` + * val myCoreType = canvastexture.specularColor + * //Your changes + * canvastexture.specularColor = myCoreType + * `````` + */ + @CoreTypeHelper + public final fun specularColorMutate(block: Color.() -> Unit): Color = specularColor.apply{ + block(this) + specularColor = this + } + + + public final fun setDiffuseTexture(texture: Texture2D?): Unit { + Internals.writeArguments(OBJECT to texture) + Internals.callMethod(rawPtr, MethodBindings.setDiffuseTexturePtr, NIL) + } + + public final fun getDiffuseTexture(): Texture2D? { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getDiffuseTexturePtr, OBJECT) + return (Internals.readReturnValue(OBJECT) as Texture2D?) + } + + public final fun setNormalTexture(texture: Texture2D?): Unit { + Internals.writeArguments(OBJECT to texture) + Internals.callMethod(rawPtr, MethodBindings.setNormalTexturePtr, NIL) + } + + public final fun getNormalTexture(): Texture2D? { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getNormalTexturePtr, OBJECT) + return (Internals.readReturnValue(OBJECT) as Texture2D?) + } + + public final fun setSpecularTexture(texture: Texture2D?): Unit { + Internals.writeArguments(OBJECT to texture) + Internals.callMethod(rawPtr, MethodBindings.setSpecularTexturePtr, NIL) + } + + public final fun getSpecularTexture(): Texture2D? { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getSpecularTexturePtr, OBJECT) + return (Internals.readReturnValue(OBJECT) as Texture2D?) + } + + public final fun setSpecularColor(color: Color): Unit { + Internals.writeArguments(COLOR to color) + Internals.callMethod(rawPtr, MethodBindings.setSpecularColorPtr, NIL) + } + + public final fun getSpecularColor(): Color { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getSpecularColorPtr, COLOR) + return (Internals.readReturnValue(COLOR) as Color) + } + + public final fun setSpecularShininess(shininess: Float): Unit { + Internals.writeArguments(DOUBLE to shininess.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setSpecularShininessPtr, NIL) + } + + public final fun getSpecularShininess(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getSpecularShininessPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setTextureFilter(filter: CanvasItem.TextureFilter): Unit { + Internals.writeArguments(LONG to filter.id) + Internals.callMethod(rawPtr, MethodBindings.setTextureFilterPtr, NIL) + } + + public final fun getTextureFilter(): CanvasItem.TextureFilter { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getTextureFilterPtr, LONG) + return CanvasItem.TextureFilter.from(Internals.readReturnValue(LONG) as Long) + } + + public final fun setTextureRepeat(repeat: CanvasItem.TextureRepeat): Unit { + Internals.writeArguments(LONG to repeat.id) + Internals.callMethod(rawPtr, MethodBindings.setTextureRepeatPtr, NIL) + } + + public final fun getTextureRepeat(): CanvasItem.TextureRepeat { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getTextureRepeatPtr, LONG) + return CanvasItem.TextureRepeat.from(Internals.readReturnValue(LONG) as Long) + } + + public companion object + + public object MethodBindings { + internal val setDiffuseTexturePtr: VoidPtr = + Internals.getMethodBindPtr("CanvasTexture", "set_diffuse_texture", 4051416890) + + internal val getDiffuseTexturePtr: VoidPtr = + Internals.getMethodBindPtr("CanvasTexture", "get_diffuse_texture", 3635182373) + + internal val setNormalTexturePtr: VoidPtr = + Internals.getMethodBindPtr("CanvasTexture", "set_normal_texture", 4051416890) + + internal val getNormalTexturePtr: VoidPtr = + Internals.getMethodBindPtr("CanvasTexture", "get_normal_texture", 3635182373) + + internal val setSpecularTexturePtr: VoidPtr = + Internals.getMethodBindPtr("CanvasTexture", "set_specular_texture", 4051416890) + + internal val getSpecularTexturePtr: VoidPtr = + Internals.getMethodBindPtr("CanvasTexture", "get_specular_texture", 3635182373) + + internal val setSpecularColorPtr: VoidPtr = + Internals.getMethodBindPtr("CanvasTexture", "set_specular_color", 2920490490) + + internal val getSpecularColorPtr: VoidPtr = + Internals.getMethodBindPtr("CanvasTexture", "get_specular_color", 3444240500) + + internal val setSpecularShininessPtr: VoidPtr = + Internals.getMethodBindPtr("CanvasTexture", "set_specular_shininess", 373806689) + + internal val getSpecularShininessPtr: VoidPtr = + Internals.getMethodBindPtr("CanvasTexture", "get_specular_shininess", 1740695150) + + internal val setTextureFilterPtr: VoidPtr = + Internals.getMethodBindPtr("CanvasTexture", "set_texture_filter", 1037999706) + + internal val getTextureFilterPtr: VoidPtr = + Internals.getMethodBindPtr("CanvasTexture", "get_texture_filter", 121960042) + + internal val setTextureRepeatPtr: VoidPtr = + Internals.getMethodBindPtr("CanvasTexture", "set_texture_repeat", 1716472974) + + internal val getTextureRepeatPtr: VoidPtr = + Internals.getMethodBindPtr("CanvasTexture", "get_texture_repeat", 2667158319) + } +} diff --git a/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/CapsuleMesh.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/CapsuleMesh.kt new file mode 100644 index 0000000000..531e64fe65 --- /dev/null +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/CapsuleMesh.kt @@ -0,0 +1,149 @@ +// THIS FILE IS GENERATED! DO NOT EDIT IT MANUALLY! +@file:Suppress("PackageDirectoryMismatch", "unused", "FunctionName", "RedundantModalityModifier", + "UNCHECKED_CAST", "JoinDeclarationAndAssignment", "USELESS_CAST", + "RemoveRedundantQualifierName", "NOTHING_TO_INLINE", "NON_FINAL_MEMBER_IN_OBJECT", + "RedundantVisibilityModifier", "RedundantUnitReturnType", "MemberVisibilityCanBePrivate") + +package godot + +import godot.`annotation`.GodotBaseType +import godot.core.VariantParser.DOUBLE +import godot.core.VariantParser.LONG +import godot.core.VariantParser.NIL +import godot.util.Internals +import godot.util.VoidPtr +import kotlin.Double +import kotlin.Float +import kotlin.Int +import kotlin.Long +import kotlin.Suppress +import kotlin.Unit +import kotlin.jvm.JvmName + +private const val ENGINE_CLASS_CAPSULEMESH_INDEX: Int = 174 + +/** + * Class representing a capsule-shaped [PrimitiveMesh]. + */ +@GodotBaseType +public open class CapsuleMesh : PrimitiveMesh() { + /** + * Radius of the capsule mesh. + */ + public final inline var radius: Float + @JvmName("radiusProperty") + get() = getRadius() + @JvmName("radiusProperty") + set(`value`) { + setRadius(value) + } + + /** + * Total height of the capsule mesh (including the hemispherical ends). + */ + public final inline var height: Float + @JvmName("heightProperty") + get() = getHeight() + @JvmName("heightProperty") + set(`value`) { + setHeight(value) + } + + /** + * Number of radial segments on the capsule mesh. + */ + public final inline var radialSegments: Int + @JvmName("radialSegmentsProperty") + get() = getRadialSegments() + @JvmName("radialSegmentsProperty") + set(`value`) { + setRadialSegments(value) + } + + /** + * Number of rings along the height of the capsule. + */ + public final inline var rings: Int + @JvmName("ringsProperty") + get() = getRings() + @JvmName("ringsProperty") + set(`value`) { + setRings(value) + } + + public override fun new(scriptIndex: Int): Unit { + Internals.callConstructor(this, ENGINE_CLASS_CAPSULEMESH_INDEX, scriptIndex) + } + + public final fun setRadius(radius: Float): Unit { + Internals.writeArguments(DOUBLE to radius.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setRadiusPtr, NIL) + } + + public final fun getRadius(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getRadiusPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setHeight(height: Float): Unit { + Internals.writeArguments(DOUBLE to height.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setHeightPtr, NIL) + } + + public final fun getHeight(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getHeightPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setRadialSegments(segments: Int): Unit { + Internals.writeArguments(LONG to segments.toLong()) + Internals.callMethod(rawPtr, MethodBindings.setRadialSegmentsPtr, NIL) + } + + public final fun getRadialSegments(): Int { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getRadialSegmentsPtr, LONG) + return (Internals.readReturnValue(LONG) as Long).toInt() + } + + public final fun setRings(rings: Int): Unit { + Internals.writeArguments(LONG to rings.toLong()) + Internals.callMethod(rawPtr, MethodBindings.setRingsPtr, NIL) + } + + public final fun getRings(): Int { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getRingsPtr, LONG) + return (Internals.readReturnValue(LONG) as Long).toInt() + } + + public companion object + + public object MethodBindings { + internal val setRadiusPtr: VoidPtr = + Internals.getMethodBindPtr("CapsuleMesh", "set_radius", 373806689) + + internal val getRadiusPtr: VoidPtr = + Internals.getMethodBindPtr("CapsuleMesh", "get_radius", 1740695150) + + internal val setHeightPtr: VoidPtr = + Internals.getMethodBindPtr("CapsuleMesh", "set_height", 373806689) + + internal val getHeightPtr: VoidPtr = + Internals.getMethodBindPtr("CapsuleMesh", "get_height", 1740695150) + + internal val setRadialSegmentsPtr: VoidPtr = + Internals.getMethodBindPtr("CapsuleMesh", "set_radial_segments", 1286410249) + + internal val getRadialSegmentsPtr: VoidPtr = + Internals.getMethodBindPtr("CapsuleMesh", "get_radial_segments", 3905245786) + + internal val setRingsPtr: VoidPtr = + Internals.getMethodBindPtr("CapsuleMesh", "set_rings", 1286410249) + + internal val getRingsPtr: VoidPtr = + Internals.getMethodBindPtr("CapsuleMesh", "get_rings", 3905245786) + } +} diff --git a/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/CapsuleShape2D.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/CapsuleShape2D.kt new file mode 100644 index 0000000000..69e6cd837e --- /dev/null +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/CapsuleShape2D.kt @@ -0,0 +1,94 @@ +// THIS FILE IS GENERATED! DO NOT EDIT IT MANUALLY! +@file:Suppress("PackageDirectoryMismatch", "unused", "FunctionName", "RedundantModalityModifier", + "UNCHECKED_CAST", "JoinDeclarationAndAssignment", "USELESS_CAST", + "RemoveRedundantQualifierName", "NOTHING_TO_INLINE", "NON_FINAL_MEMBER_IN_OBJECT", + "RedundantVisibilityModifier", "RedundantUnitReturnType", "MemberVisibilityCanBePrivate") + +package godot + +import godot.`annotation`.GodotBaseType +import godot.core.VariantParser.DOUBLE +import godot.core.VariantParser.NIL +import godot.util.Internals +import godot.util.VoidPtr +import kotlin.Double +import kotlin.Float +import kotlin.Int +import kotlin.Suppress +import kotlin.Unit +import kotlin.jvm.JvmName + +private const val ENGINE_CLASS_CAPSULESHAPE2D_INDEX: Int = 175 + +/** + * A 2D capsule shape, intended for use in physics. Usually used to provide a shape for a + * [CollisionShape2D]. + * **Performance:** [CapsuleShape2D] is fast to check collisions against, but it is slower than + * [RectangleShape2D] and [CircleShape2D]. + */ +@GodotBaseType +public open class CapsuleShape2D : Shape2D() { + /** + * The capsule's radius. + */ + public final inline var radius: Float + @JvmName("radiusProperty") + get() = getRadius() + @JvmName("radiusProperty") + set(`value`) { + setRadius(value) + } + + /** + * The capsule's height. + */ + public final inline var height: Float + @JvmName("heightProperty") + get() = getHeight() + @JvmName("heightProperty") + set(`value`) { + setHeight(value) + } + + public override fun new(scriptIndex: Int): Unit { + Internals.callConstructor(this, ENGINE_CLASS_CAPSULESHAPE2D_INDEX, scriptIndex) + } + + public final fun setRadius(radius: Float): Unit { + Internals.writeArguments(DOUBLE to radius.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setRadiusPtr, NIL) + } + + public final fun getRadius(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getRadiusPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setHeight(height: Float): Unit { + Internals.writeArguments(DOUBLE to height.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setHeightPtr, NIL) + } + + public final fun getHeight(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getHeightPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public companion object + + public object MethodBindings { + internal val setRadiusPtr: VoidPtr = + Internals.getMethodBindPtr("CapsuleShape2D", "set_radius", 373806689) + + internal val getRadiusPtr: VoidPtr = + Internals.getMethodBindPtr("CapsuleShape2D", "get_radius", 1740695150) + + internal val setHeightPtr: VoidPtr = + Internals.getMethodBindPtr("CapsuleShape2D", "set_height", 373806689) + + internal val getHeightPtr: VoidPtr = + Internals.getMethodBindPtr("CapsuleShape2D", "get_height", 1740695150) + } +} diff --git a/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/CapsuleShape3D.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/CapsuleShape3D.kt new file mode 100644 index 0000000000..a6f948f872 --- /dev/null +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/CapsuleShape3D.kt @@ -0,0 +1,94 @@ +// THIS FILE IS GENERATED! DO NOT EDIT IT MANUALLY! +@file:Suppress("PackageDirectoryMismatch", "unused", "FunctionName", "RedundantModalityModifier", + "UNCHECKED_CAST", "JoinDeclarationAndAssignment", "USELESS_CAST", + "RemoveRedundantQualifierName", "NOTHING_TO_INLINE", "NON_FINAL_MEMBER_IN_OBJECT", + "RedundantVisibilityModifier", "RedundantUnitReturnType", "MemberVisibilityCanBePrivate") + +package godot + +import godot.`annotation`.GodotBaseType +import godot.core.VariantParser.DOUBLE +import godot.core.VariantParser.NIL +import godot.util.Internals +import godot.util.VoidPtr +import kotlin.Double +import kotlin.Float +import kotlin.Int +import kotlin.Suppress +import kotlin.Unit +import kotlin.jvm.JvmName + +private const val ENGINE_CLASS_CAPSULESHAPE3D_INDEX: Int = 176 + +/** + * A 3D capsule shape, intended for use in physics. Usually used to provide a shape for a + * [CollisionShape3D]. + * **Performance:** [CapsuleShape3D] is fast to check collisions against. It is faster than + * [CylinderShape3D], but slower than [SphereShape3D] and [BoxShape3D]. + */ +@GodotBaseType +public open class CapsuleShape3D : Shape3D() { + /** + * The capsule's radius. + */ + public final inline var radius: Float + @JvmName("radiusProperty") + get() = getRadius() + @JvmName("radiusProperty") + set(`value`) { + setRadius(value) + } + + /** + * The capsule's height. + */ + public final inline var height: Float + @JvmName("heightProperty") + get() = getHeight() + @JvmName("heightProperty") + set(`value`) { + setHeight(value) + } + + public override fun new(scriptIndex: Int): Unit { + Internals.callConstructor(this, ENGINE_CLASS_CAPSULESHAPE3D_INDEX, scriptIndex) + } + + public final fun setRadius(radius: Float): Unit { + Internals.writeArguments(DOUBLE to radius.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setRadiusPtr, NIL) + } + + public final fun getRadius(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getRadiusPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setHeight(height: Float): Unit { + Internals.writeArguments(DOUBLE to height.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setHeightPtr, NIL) + } + + public final fun getHeight(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getHeightPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public companion object + + public object MethodBindings { + internal val setRadiusPtr: VoidPtr = + Internals.getMethodBindPtr("CapsuleShape3D", "set_radius", 373806689) + + internal val getRadiusPtr: VoidPtr = + Internals.getMethodBindPtr("CapsuleShape3D", "get_radius", 1740695150) + + internal val setHeightPtr: VoidPtr = + Internals.getMethodBindPtr("CapsuleShape3D", "set_height", 373806689) + + internal val getHeightPtr: VoidPtr = + Internals.getMethodBindPtr("CapsuleShape3D", "get_height", 1740695150) + } +} diff --git a/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/CenterContainer.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/CenterContainer.kt new file mode 100644 index 0000000000..ea2d71ec25 --- /dev/null +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/CenterContainer.kt @@ -0,0 +1,63 @@ +// THIS FILE IS GENERATED! DO NOT EDIT IT MANUALLY! +@file:Suppress("PackageDirectoryMismatch", "unused", "FunctionName", "RedundantModalityModifier", + "UNCHECKED_CAST", "JoinDeclarationAndAssignment", "USELESS_CAST", + "RemoveRedundantQualifierName", "NOTHING_TO_INLINE", "NON_FINAL_MEMBER_IN_OBJECT", + "RedundantVisibilityModifier", "RedundantUnitReturnType", "MemberVisibilityCanBePrivate") + +package godot + +import godot.`annotation`.GodotBaseType +import godot.core.VariantParser.BOOL +import godot.core.VariantParser.NIL +import godot.util.Internals +import godot.util.VoidPtr +import kotlin.Boolean +import kotlin.Int +import kotlin.Suppress +import kotlin.Unit +import kotlin.jvm.JvmName + +private const val ENGINE_CLASS_CENTERCONTAINER_INDEX: Int = 177 + +/** + * [CenterContainer] is a container that keeps all of its child controls in its center at their + * minimum size. + */ +@GodotBaseType +public open class CenterContainer : Container() { + /** + * If `true`, centers children relative to the [CenterContainer]'s top left corner. + */ + public final inline var useTopLeft: Boolean + @JvmName("useTopLeftProperty") + get() = isUsingTopLeft() + @JvmName("useTopLeftProperty") + set(`value`) { + setUseTopLeft(value) + } + + public override fun new(scriptIndex: Int): Unit { + Internals.callConstructor(this, ENGINE_CLASS_CENTERCONTAINER_INDEX, scriptIndex) + } + + public final fun setUseTopLeft(enable: Boolean): Unit { + Internals.writeArguments(BOOL to enable) + Internals.callMethod(rawPtr, MethodBindings.setUseTopLeftPtr, NIL) + } + + public final fun isUsingTopLeft(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isUsingTopLeftPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public companion object + + public object MethodBindings { + internal val setUseTopLeftPtr: VoidPtr = + Internals.getMethodBindPtr("CenterContainer", "set_use_top_left", 2586408642) + + internal val isUsingTopLeftPtr: VoidPtr = + Internals.getMethodBindPtr("CenterContainer", "is_using_top_left", 36873697) + } +} diff --git a/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/CharFXTransform.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/CharFXTransform.kt new file mode 100644 index 0000000000..16787eb2ac --- /dev/null +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/CharFXTransform.kt @@ -0,0 +1,542 @@ +// THIS FILE IS GENERATED! DO NOT EDIT IT MANUALLY! +@file:Suppress("PackageDirectoryMismatch", "unused", "FunctionName", "RedundantModalityModifier", + "UNCHECKED_CAST", "JoinDeclarationAndAssignment", "USELESS_CAST", + "RemoveRedundantQualifierName", "NOTHING_TO_INLINE", "NON_FINAL_MEMBER_IN_OBJECT", + "RedundantVisibilityModifier", "RedundantUnitReturnType", "MemberVisibilityCanBePrivate") + +package godot + +import godot.`annotation`.CoreTypeHelper +import godot.`annotation`.CoreTypeLocalCopy +import godot.`annotation`.GodotBaseType +import godot.core.Color +import godot.core.Dictionary +import godot.core.RID +import godot.core.Transform2D +import godot.core.VariantParser.BOOL +import godot.core.VariantParser.COLOR +import godot.core.VariantParser.DICTIONARY +import godot.core.VariantParser.DOUBLE +import godot.core.VariantParser.LONG +import godot.core.VariantParser.NIL +import godot.core.VariantParser.TRANSFORM2D +import godot.core.VariantParser.VECTOR2 +import godot.core.VariantParser.VECTOR2I +import godot.core.VariantParser._RID +import godot.core.Vector2 +import godot.core.Vector2i +import godot.util.Internals +import godot.util.VoidPtr +import kotlin.Any +import kotlin.Boolean +import kotlin.Double +import kotlin.Int +import kotlin.Long +import kotlin.Suppress +import kotlin.Unit +import kotlin.jvm.JvmName + +private const val ENGINE_CLASS_CHARFXTRANSFORM_INDEX: Int = 178 + +/** + * By setting various properties on this object, you can control how individual characters will be + * displayed in a [RichTextEffect]. + */ +@GodotBaseType +public open class CharFXTransform : RefCounted() { + /** + * The current transform of the current glyph. It can be overridden (for example, by driving the + * position and rotation from a curve). You can also alter the existing value to apply transforms on + * top of other effects. + */ + @CoreTypeLocalCopy + public final inline var transform: Transform2D + @JvmName("transformProperty") + get() = getTransform() + @JvmName("transformProperty") + set(`value`) { + setTransform(value) + } + + /** + * Absolute character range in the string, corresponding to the glyph. Setting this property won't + * affect drawing. + */ + @CoreTypeLocalCopy + public final inline var range: Vector2i + @JvmName("rangeProperty") + get() = getRange() + @JvmName("rangeProperty") + set(`value`) { + setRange(value) + } + + /** + * The time elapsed since the [RichTextLabel] was added to the scene tree (in seconds). Time stops + * when the [RichTextLabel] is paused (see [Node.processMode]). Resets when the text in the + * [RichTextLabel] is changed. + * **Note:** Time still passes while the [RichTextLabel] is hidden. + */ + public final inline var elapsedTime: Double + @JvmName("elapsedTimeProperty") + get() = getElapsedTime() + @JvmName("elapsedTimeProperty") + set(`value`) { + setElapsedTime(value) + } + + /** + * If `true`, the character will be drawn. If `false`, the character will be hidden. Characters + * around hidden characters will reflow to take the space of hidden characters. If this is not + * desired, set their [color] to `Color(1, 1, 1, 0)` instead. + */ + public final inline var visible: Boolean + @JvmName("visibleProperty") + get() = isVisible() + @JvmName("visibleProperty") + set(`value`) { + setVisibility(value) + } + + /** + * If `true`, FX transform is called for outline drawing. Setting this property won't affect + * drawing. + */ + public final inline var outline: Boolean + @JvmName("outlineProperty") + get() = isOutline() + @JvmName("outlineProperty") + set(`value`) { + setOutline(value) + } + + /** + * The position offset the character will be drawn with (in pixels). + */ + @CoreTypeLocalCopy + public final inline var offset: Vector2 + @JvmName("offsetProperty") + get() = getOffset() + @JvmName("offsetProperty") + set(`value`) { + setOffset(value) + } + + /** + * The color the character will be drawn with. + */ + @CoreTypeLocalCopy + public final inline var color: Color + @JvmName("colorProperty") + get() = getColor() + @JvmName("colorProperty") + set(`value`) { + setColor(value) + } + + /** + * Contains the arguments passed in the opening BBCode tag. By default, arguments are strings; if + * their contents match a type such as [bool], [int] or [float], they will be converted + * automatically. Color codes in the form `#rrggbb` or `#rgb` will be converted to an opaque [Color]. + * String arguments may not contain spaces, even if they're quoted. If present, quotes will also be + * present in the final string. + * For example, the opening BBCode tag `[example foo=hello bar=true baz=42 color=#ffffff]` will + * map to the following [Dictionary]: + * [codeblock] + * {"foo": "hello", "bar": true, "baz": 42, "color": Color(1, 1, 1, 1)} + * [/codeblock] + */ + public final inline var env: Dictionary + @JvmName("envProperty") + get() = getEnvironment() + @JvmName("envProperty") + set(`value`) { + setEnvironment(value) + } + + /** + * Font specific glyph index. + */ + public final inline var glyphIndex: Long + @JvmName("glyphIndexProperty") + get() = getGlyphIndex() + @JvmName("glyphIndexProperty") + set(`value`) { + setGlyphIndex(value) + } + + /** + * Number of glyphs in the grapheme cluster. This value is set in the first glyph of a cluster. + * Setting this property won't affect drawing. + */ + public final inline var glyphCount: Int + @JvmName("glyphCountProperty") + get() = getGlyphCount() + @JvmName("glyphCountProperty") + set(`value`) { + setGlyphCount(value) + } + + /** + * Glyph flags. See [TextServer.GraphemeFlag] for more info. Setting this property won't affect + * drawing. + */ + public final inline var glyphFlags: Int + @JvmName("glyphFlagsProperty") + get() = getGlyphFlags() + @JvmName("glyphFlagsProperty") + set(`value`) { + setGlyphFlags(value) + } + + /** + * The character offset of the glyph, relative to the current [RichTextEffect] custom block. + * Setting this property won't affect drawing. + */ + public final inline var relativeIndex: Int + @JvmName("relativeIndexProperty") + get() = getRelativeIndex() + @JvmName("relativeIndexProperty") + set(`value`) { + setRelativeIndex(value) + } + + /** + * Font resource used to render glyph. + */ + public final inline var font: RID + @JvmName("fontProperty") + get() = getFont() + @JvmName("fontProperty") + set(`value`) { + setFont(value) + } + + public override fun new(scriptIndex: Int): Unit { + Internals.callConstructor(this, ENGINE_CLASS_CHARFXTRANSFORM_INDEX, scriptIndex) + } + + /** + * The current transform of the current glyph. It can be overridden (for example, by driving the + * position and rotation from a curve). You can also alter the existing value to apply transforms on + * top of other effects. + * + * This is a helper function to make dealing with local copies easier. + * + * For more information, see our + * [documentation](https://godot-kotl.in/en/stable/user-guide/api-differences/#core-types). + * + * Allow to directly modify the local copy of the property and assign it back to the Object. + * + * Prefer that over writing: + * `````` + * val myCoreType = charfxtransform.transform + * //Your changes + * charfxtransform.transform = myCoreType + * `````` + */ + @CoreTypeHelper + public final fun transformMutate(block: Transform2D.() -> Unit): Transform2D = transform.apply{ + block(this) + transform = this + } + + + /** + * Absolute character range in the string, corresponding to the glyph. Setting this property won't + * affect drawing. + * + * This is a helper function to make dealing with local copies easier. + * + * For more information, see our + * [documentation](https://godot-kotl.in/en/stable/user-guide/api-differences/#core-types). + * + * Allow to directly modify the local copy of the property and assign it back to the Object. + * + * Prefer that over writing: + * `````` + * val myCoreType = charfxtransform.range + * //Your changes + * charfxtransform.range = myCoreType + * `````` + */ + @CoreTypeHelper + public final fun rangeMutate(block: Vector2i.() -> Unit): Vector2i = range.apply{ + block(this) + range = this + } + + + /** + * The position offset the character will be drawn with (in pixels). + * + * This is a helper function to make dealing with local copies easier. + * + * For more information, see our + * [documentation](https://godot-kotl.in/en/stable/user-guide/api-differences/#core-types). + * + * Allow to directly modify the local copy of the property and assign it back to the Object. + * + * Prefer that over writing: + * `````` + * val myCoreType = charfxtransform.offset + * //Your changes + * charfxtransform.offset = myCoreType + * `````` + */ + @CoreTypeHelper + public final fun offsetMutate(block: Vector2.() -> Unit): Vector2 = offset.apply{ + block(this) + offset = this + } + + + /** + * The color the character will be drawn with. + * + * This is a helper function to make dealing with local copies easier. + * + * For more information, see our + * [documentation](https://godot-kotl.in/en/stable/user-guide/api-differences/#core-types). + * + * Allow to directly modify the local copy of the property and assign it back to the Object. + * + * Prefer that over writing: + * `````` + * val myCoreType = charfxtransform.color + * //Your changes + * charfxtransform.color = myCoreType + * `````` + */ + @CoreTypeHelper + public final fun colorMutate(block: Color.() -> Unit): Color = color.apply{ + block(this) + color = this + } + + + public final fun getTransform(): Transform2D { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getTransformPtr, TRANSFORM2D) + return (Internals.readReturnValue(TRANSFORM2D) as Transform2D) + } + + public final fun setTransform(transform: Transform2D): Unit { + Internals.writeArguments(TRANSFORM2D to transform) + Internals.callMethod(rawPtr, MethodBindings.setTransformPtr, NIL) + } + + public final fun getRange(): Vector2i { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getRangePtr, VECTOR2I) + return (Internals.readReturnValue(VECTOR2I) as Vector2i) + } + + public final fun setRange(range: Vector2i): Unit { + Internals.writeArguments(VECTOR2I to range) + Internals.callMethod(rawPtr, MethodBindings.setRangePtr, NIL) + } + + public final fun getElapsedTime(): Double { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getElapsedTimePtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double) + } + + public final fun setElapsedTime(time: Double): Unit { + Internals.writeArguments(DOUBLE to time) + Internals.callMethod(rawPtr, MethodBindings.setElapsedTimePtr, NIL) + } + + public final fun isVisible(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isVisiblePtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public final fun setVisibility(visibility: Boolean): Unit { + Internals.writeArguments(BOOL to visibility) + Internals.callMethod(rawPtr, MethodBindings.setVisibilityPtr, NIL) + } + + public final fun isOutline(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isOutlinePtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public final fun setOutline(outline: Boolean): Unit { + Internals.writeArguments(BOOL to outline) + Internals.callMethod(rawPtr, MethodBindings.setOutlinePtr, NIL) + } + + public final fun getOffset(): Vector2 { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getOffsetPtr, VECTOR2) + return (Internals.readReturnValue(VECTOR2) as Vector2) + } + + public final fun setOffset(offset: Vector2): Unit { + Internals.writeArguments(VECTOR2 to offset) + Internals.callMethod(rawPtr, MethodBindings.setOffsetPtr, NIL) + } + + public final fun getColor(): Color { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getColorPtr, COLOR) + return (Internals.readReturnValue(COLOR) as Color) + } + + public final fun setColor(color: Color): Unit { + Internals.writeArguments(COLOR to color) + Internals.callMethod(rawPtr, MethodBindings.setColorPtr, NIL) + } + + public final fun getEnvironment(): Dictionary { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getEnvironmentPtr, DICTIONARY) + return (Internals.readReturnValue(DICTIONARY) as Dictionary) + } + + public final fun setEnvironment(environment: Dictionary): Unit { + Internals.writeArguments(DICTIONARY to environment) + Internals.callMethod(rawPtr, MethodBindings.setEnvironmentPtr, NIL) + } + + public final fun getGlyphIndex(): Long { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getGlyphIndexPtr, LONG) + return (Internals.readReturnValue(LONG) as Long) + } + + public final fun setGlyphIndex(glyphIndex: Long): Unit { + Internals.writeArguments(LONG to glyphIndex) + Internals.callMethod(rawPtr, MethodBindings.setGlyphIndexPtr, NIL) + } + + public final fun getRelativeIndex(): Int { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getRelativeIndexPtr, LONG) + return (Internals.readReturnValue(LONG) as Long).toInt() + } + + public final fun setRelativeIndex(relativeIndex: Int): Unit { + Internals.writeArguments(LONG to relativeIndex.toLong()) + Internals.callMethod(rawPtr, MethodBindings.setRelativeIndexPtr, NIL) + } + + public final fun getGlyphCount(): Int { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getGlyphCountPtr, LONG) + return (Internals.readReturnValue(LONG) as Long).toInt() + } + + public final fun setGlyphCount(glyphCount: Int): Unit { + Internals.writeArguments(LONG to glyphCount.toLong()) + Internals.callMethod(rawPtr, MethodBindings.setGlyphCountPtr, NIL) + } + + public final fun getGlyphFlags(): Int { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getGlyphFlagsPtr, LONG) + return (Internals.readReturnValue(LONG) as Long).toInt() + } + + public final fun setGlyphFlags(glyphFlags: Int): Unit { + Internals.writeArguments(LONG to glyphFlags.toLong()) + Internals.callMethod(rawPtr, MethodBindings.setGlyphFlagsPtr, NIL) + } + + public final fun getFont(): RID { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getFontPtr, _RID) + return (Internals.readReturnValue(_RID) as RID) + } + + public final fun setFont(font: RID): Unit { + Internals.writeArguments(_RID to font) + Internals.callMethod(rawPtr, MethodBindings.setFontPtr, NIL) + } + + public companion object + + public object MethodBindings { + internal val getTransformPtr: VoidPtr = + Internals.getMethodBindPtr("CharFXTransform", "get_transform", 3761352769) + + internal val setTransformPtr: VoidPtr = + Internals.getMethodBindPtr("CharFXTransform", "set_transform", 2761652528) + + internal val getRangePtr: VoidPtr = + Internals.getMethodBindPtr("CharFXTransform", "get_range", 2741790807) + + internal val setRangePtr: VoidPtr = + Internals.getMethodBindPtr("CharFXTransform", "set_range", 1130785943) + + internal val getElapsedTimePtr: VoidPtr = + Internals.getMethodBindPtr("CharFXTransform", "get_elapsed_time", 191475506) + + internal val setElapsedTimePtr: VoidPtr = + Internals.getMethodBindPtr("CharFXTransform", "set_elapsed_time", 373806689) + + internal val isVisiblePtr: VoidPtr = + Internals.getMethodBindPtr("CharFXTransform", "is_visible", 2240911060) + + internal val setVisibilityPtr: VoidPtr = + Internals.getMethodBindPtr("CharFXTransform", "set_visibility", 2586408642) + + internal val isOutlinePtr: VoidPtr = + Internals.getMethodBindPtr("CharFXTransform", "is_outline", 2240911060) + + internal val setOutlinePtr: VoidPtr = + Internals.getMethodBindPtr("CharFXTransform", "set_outline", 2586408642) + + internal val getOffsetPtr: VoidPtr = + Internals.getMethodBindPtr("CharFXTransform", "get_offset", 1497962370) + + internal val setOffsetPtr: VoidPtr = + Internals.getMethodBindPtr("CharFXTransform", "set_offset", 743155724) + + internal val getColorPtr: VoidPtr = + Internals.getMethodBindPtr("CharFXTransform", "get_color", 3200896285) + + internal val setColorPtr: VoidPtr = + Internals.getMethodBindPtr("CharFXTransform", "set_color", 2920490490) + + internal val getEnvironmentPtr: VoidPtr = + Internals.getMethodBindPtr("CharFXTransform", "get_environment", 2382534195) + + internal val setEnvironmentPtr: VoidPtr = + Internals.getMethodBindPtr("CharFXTransform", "set_environment", 4155329257) + + internal val getGlyphIndexPtr: VoidPtr = + Internals.getMethodBindPtr("CharFXTransform", "get_glyph_index", 3905245786) + + internal val setGlyphIndexPtr: VoidPtr = + Internals.getMethodBindPtr("CharFXTransform", "set_glyph_index", 1286410249) + + internal val getRelativeIndexPtr: VoidPtr = + Internals.getMethodBindPtr("CharFXTransform", "get_relative_index", 3905245786) + + internal val setRelativeIndexPtr: VoidPtr = + Internals.getMethodBindPtr("CharFXTransform", "set_relative_index", 1286410249) + + internal val getGlyphCountPtr: VoidPtr = + Internals.getMethodBindPtr("CharFXTransform", "get_glyph_count", 3905245786) + + internal val setGlyphCountPtr: VoidPtr = + Internals.getMethodBindPtr("CharFXTransform", "set_glyph_count", 1286410249) + + internal val getGlyphFlagsPtr: VoidPtr = + Internals.getMethodBindPtr("CharFXTransform", "get_glyph_flags", 3905245786) + + internal val setGlyphFlagsPtr: VoidPtr = + Internals.getMethodBindPtr("CharFXTransform", "set_glyph_flags", 1286410249) + + internal val getFontPtr: VoidPtr = + Internals.getMethodBindPtr("CharFXTransform", "get_font", 2944877500) + + internal val setFontPtr: VoidPtr = + Internals.getMethodBindPtr("CharFXTransform", "set_font", 2722037293) + } +} diff --git a/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/CharacterBody2D.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/CharacterBody2D.kt new file mode 100644 index 0000000000..69b01a8c41 --- /dev/null +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/CharacterBody2D.kt @@ -0,0 +1,888 @@ +// THIS FILE IS GENERATED! DO NOT EDIT IT MANUALLY! +@file:Suppress("PackageDirectoryMismatch", "unused", "FunctionName", "RedundantModalityModifier", + "UNCHECKED_CAST", "JoinDeclarationAndAssignment", "USELESS_CAST", + "RemoveRedundantQualifierName", "NOTHING_TO_INLINE", "NON_FINAL_MEMBER_IN_OBJECT", + "RedundantVisibilityModifier", "RedundantUnitReturnType", "MemberVisibilityCanBePrivate") + +package godot + +import godot.`annotation`.CoreTypeHelper +import godot.`annotation`.CoreTypeLocalCopy +import godot.`annotation`.GodotBaseType +import godot.core.VariantParser.BOOL +import godot.core.VariantParser.DOUBLE +import godot.core.VariantParser.LONG +import godot.core.VariantParser.NIL +import godot.core.VariantParser.OBJECT +import godot.core.VariantParser.VECTOR2 +import godot.core.Vector2 +import godot.util.Internals +import godot.util.VoidPtr +import kotlin.Boolean +import kotlin.Double +import kotlin.Float +import kotlin.Int +import kotlin.Long +import kotlin.Suppress +import kotlin.Unit +import kotlin.jvm.JvmName +import kotlin.jvm.JvmOverloads + +private const val ENGINE_CLASS_CHARACTERBODY2D_INDEX: Int = 179 + +/** + * [CharacterBody2D] is a specialized class for physics bodies that are meant to be user-controlled. + * They are not affected by physics at all, but they affect other physics bodies in their path. They + * are mainly used to provide high-level API to move objects with wall and slope detection + * ([moveAndSlide] method) in addition to the general collision detection provided by + * [PhysicsBody2D.moveAndCollide]. This makes it useful for highly configurable physics bodies that + * must move in specific ways and collide with the world, as is often the case with user-controlled + * characters. + * For game objects that don't require complex movement or collision detection, such as moving + * platforms, [AnimatableBody2D] is simpler to configure. + */ +@GodotBaseType +public open class CharacterBody2D : PhysicsBody2D() { + /** + * Sets the motion mode which defines the behavior of [moveAndSlide]. See [MotionMode] constants + * for available modes. + */ + public final inline var motionMode: MotionMode + @JvmName("motionModeProperty") + get() = getMotionMode() + @JvmName("motionModeProperty") + set(`value`) { + setMotionMode(value) + } + + /** + * Vector pointing upwards, used to determine what is a wall and what is a floor (or a ceiling) + * when calling [moveAndSlide]. Defaults to [Vector2.UP]. As the vector will be normalized it can't + * be equal to [Vector2.ZERO], if you want all collisions to be reported as walls, consider using + * [MOTION_MODE_FLOATING] as [motionMode]. + */ + @CoreTypeLocalCopy + public final inline var upDirection: Vector2 + @JvmName("upDirectionProperty") + get() = getUpDirection() + @JvmName("upDirectionProperty") + set(`value`) { + setUpDirection(value) + } + + /** + * Current velocity vector in pixels per second, used and modified during calls to [moveAndSlide]. + */ + @CoreTypeLocalCopy + public final inline var velocity: Vector2 + @JvmName("velocityProperty") + get() = getVelocity() + @JvmName("velocityProperty") + set(`value`) { + setVelocity(value) + } + + /** + * If `true`, during a jump against the ceiling, the body will slide, if `false` it will be + * stopped and will fall vertically. + */ + public final inline var slideOnCeiling: Boolean + @JvmName("slideOnCeilingProperty") + get() = isSlideOnCeilingEnabled() + @JvmName("slideOnCeilingProperty") + set(`value`) { + setSlideOnCeilingEnabled(value) + } + + /** + * Maximum number of times the body can change direction before it stops when calling + * [moveAndSlide]. + */ + public final inline var maxSlides: Int + @JvmName("maxSlidesProperty") + get() = getMaxSlides() + @JvmName("maxSlidesProperty") + set(`value`) { + setMaxSlides(value) + } + + /** + * Minimum angle (in radians) where the body is allowed to slide when it encounters a slope. The + * default value equals 15 degrees. This property only affects movement when [motionMode] is + * [MOTION_MODE_FLOATING]. + */ + public final inline var wallMinSlideAngle: Float + @JvmName("wallMinSlideAngleProperty") + get() = getWallMinSlideAngle() + @JvmName("wallMinSlideAngleProperty") + set(`value`) { + setWallMinSlideAngle(value) + } + + /** + * If `true`, the body will not slide on slopes when calling [moveAndSlide] when the body is + * standing still. + * If `false`, the body will slide on floor's slopes when [velocity] applies a downward force. + */ + public final inline var floorStopOnSlope: Boolean + @JvmName("floorStopOnSlopeProperty") + get() = isFloorStopOnSlopeEnabled() + @JvmName("floorStopOnSlopeProperty") + set(`value`) { + setFloorStopOnSlopeEnabled(value) + } + + /** + * If `false` (by default), the body will move faster on downward slopes and slower on upward + * slopes. + * If `true`, the body will always move at the same speed on the ground no matter the slope. Note + * that you need to use [floorSnapLength] to stick along a downward slope at constant speed. + */ + public final inline var floorConstantSpeed: Boolean + @JvmName("floorConstantSpeedProperty") + get() = isFloorConstantSpeedEnabled() + @JvmName("floorConstantSpeedProperty") + set(`value`) { + setFloorConstantSpeedEnabled(value) + } + + /** + * If `true`, the body will be able to move on the floor only. This option avoids to be able to + * walk on walls, it will however allow to slide down along them. + */ + public final inline var floorBlockOnWall: Boolean + @JvmName("floorBlockOnWallProperty") + get() = isFloorBlockOnWallEnabled() + @JvmName("floorBlockOnWallProperty") + set(`value`) { + setFloorBlockOnWallEnabled(value) + } + + /** + * Maximum angle (in radians) where a slope is still considered a floor (or a ceiling), rather + * than a wall, when calling [moveAndSlide]. The default value equals 45 degrees. + */ + public final inline var floorMaxAngle: Float + @JvmName("floorMaxAngleProperty") + get() = getFloorMaxAngle() + @JvmName("floorMaxAngleProperty") + set(`value`) { + setFloorMaxAngle(value) + } + + /** + * Sets a snapping distance. When set to a value different from `0.0`, the body is kept attached + * to slopes when calling [moveAndSlide]. The snapping vector is determined by the given distance + * along the opposite direction of the [upDirection]. + * As long as the snapping vector is in contact with the ground and the body moves against + * [upDirection], the body will remain attached to the surface. Snapping is not applied if the body + * moves along [upDirection], meaning it contains vertical rising velocity, so it will be able to + * detach from the ground when jumping or when the body is pushed up by something. If you want to + * apply a snap without taking into account the velocity, use [applyFloorSnap]. + */ + public final inline var floorSnapLength: Float + @JvmName("floorSnapLengthProperty") + get() = getFloorSnapLength() + @JvmName("floorSnapLengthProperty") + set(`value`) { + setFloorSnapLength(value) + } + + /** + * Sets the behavior to apply when you leave a moving platform. By default, to be physically + * accurate, when you leave the last platform velocity is applied. See [PlatformOnLeave] constants + * for available behavior. + */ + public final inline var platformOnLeave: PlatformOnLeave + @JvmName("platformOnLeaveProperty") + get() = getPlatformOnLeave() + @JvmName("platformOnLeaveProperty") + set(`value`) { + setPlatformOnLeave(value) + } + + /** + * Collision layers that will be included for detecting floor bodies that will act as moving + * platforms to be followed by the [CharacterBody2D]. By default, all floor bodies are detected and + * propagate their velocity. + */ + public final inline var platformFloorLayers: Long + @JvmName("platformFloorLayersProperty") + get() = getPlatformFloorLayers() + @JvmName("platformFloorLayersProperty") + set(`value`) { + setPlatformFloorLayers(value) + } + + /** + * Collision layers that will be included for detecting wall bodies that will act as moving + * platforms to be followed by the [CharacterBody2D]. By default, all wall bodies are ignored. + */ + public final inline var platformWallLayers: Long + @JvmName("platformWallLayersProperty") + get() = getPlatformWallLayers() + @JvmName("platformWallLayersProperty") + set(`value`) { + setPlatformWallLayers(value) + } + + /** + * Extra margin used for collision recovery when calling [moveAndSlide]. + * If the body is at least this close to another body, it will consider them to be colliding and + * will be pushed away before performing the actual motion. + * A higher value means it's more flexible for detecting collision, which helps with consistently + * detecting walls and floors. + * A lower value forces the collision algorithm to use more exact detection, so it can be used in + * cases that specifically require precision, e.g at very low scale to avoid visible jittering, or + * for stability with a stack of character bodies. + */ + public final inline var safeMargin: Float + @JvmName("safeMarginProperty") + get() = getSafeMargin() + @JvmName("safeMarginProperty") + set(`value`) { + setSafeMargin(value) + } + + public override fun new(scriptIndex: Int): Unit { + Internals.callConstructor(this, ENGINE_CLASS_CHARACTERBODY2D_INDEX, scriptIndex) + } + + /** + * Vector pointing upwards, used to determine what is a wall and what is a floor (or a ceiling) + * when calling [moveAndSlide]. Defaults to [Vector2.UP]. As the vector will be normalized it can't + * be equal to [Vector2.ZERO], if you want all collisions to be reported as walls, consider using + * [MOTION_MODE_FLOATING] as [motionMode]. + * + * This is a helper function to make dealing with local copies easier. + * + * For more information, see our + * [documentation](https://godot-kotl.in/en/stable/user-guide/api-differences/#core-types). + * + * Allow to directly modify the local copy of the property and assign it back to the Object. + * + * Prefer that over writing: + * `````` + * val myCoreType = characterbody2d.upDirection + * //Your changes + * characterbody2d.upDirection = myCoreType + * `````` + */ + @CoreTypeHelper + public final fun upDirectionMutate(block: Vector2.() -> Unit): Vector2 = upDirection.apply{ + block(this) + upDirection = this + } + + + /** + * Current velocity vector in pixels per second, used and modified during calls to [moveAndSlide]. + * + * This is a helper function to make dealing with local copies easier. + * + * For more information, see our + * [documentation](https://godot-kotl.in/en/stable/user-guide/api-differences/#core-types). + * + * Allow to directly modify the local copy of the property and assign it back to the Object. + * + * Prefer that over writing: + * `````` + * val myCoreType = characterbody2d.velocity + * //Your changes + * characterbody2d.velocity = myCoreType + * `````` + */ + @CoreTypeHelper + public final fun velocityMutate(block: Vector2.() -> Unit): Vector2 = velocity.apply{ + block(this) + velocity = this + } + + + /** + * Moves the body based on [velocity]. If the body collides with another, it will slide along the + * other body (by default only on floor) rather than stop immediately. If the other body is a + * [CharacterBody2D] or [RigidBody2D], it will also be affected by the motion of the other body. You + * can use this to make moving and rotating platforms, or to make nodes push other nodes. + * Modifies [velocity] if a slide collision occurred. To get the latest collision call + * [getLastSlideCollision], for detailed information about collisions that occurred, use + * [getSlideCollision]. + * When the body touches a moving platform, the platform's velocity is automatically added to the + * body motion. If a collision occurs due to the platform's motion, it will always be first in the + * slide collisions. + * The general behavior and available properties change according to the [motionMode]. + * Returns `true` if the body collided, otherwise, returns `false`. + */ + public final fun moveAndSlide(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.moveAndSlidePtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + /** + * Allows to manually apply a snap to the floor regardless of the body's velocity. This function + * does nothing when [isOnFloor] returns `true`. + */ + public final fun applyFloorSnap(): Unit { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.applyFloorSnapPtr, NIL) + } + + public final fun setVelocity(velocity: Vector2): Unit { + Internals.writeArguments(VECTOR2 to velocity) + Internals.callMethod(rawPtr, MethodBindings.setVelocityPtr, NIL) + } + + public final fun getVelocity(): Vector2 { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getVelocityPtr, VECTOR2) + return (Internals.readReturnValue(VECTOR2) as Vector2) + } + + public final fun setSafeMargin(margin: Float): Unit { + Internals.writeArguments(DOUBLE to margin.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setSafeMarginPtr, NIL) + } + + public final fun getSafeMargin(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getSafeMarginPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun isFloorStopOnSlopeEnabled(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isFloorStopOnSlopeEnabledPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public final fun setFloorStopOnSlopeEnabled(enabled: Boolean): Unit { + Internals.writeArguments(BOOL to enabled) + Internals.callMethod(rawPtr, MethodBindings.setFloorStopOnSlopeEnabledPtr, NIL) + } + + public final fun setFloorConstantSpeedEnabled(enabled: Boolean): Unit { + Internals.writeArguments(BOOL to enabled) + Internals.callMethod(rawPtr, MethodBindings.setFloorConstantSpeedEnabledPtr, NIL) + } + + public final fun isFloorConstantSpeedEnabled(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isFloorConstantSpeedEnabledPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public final fun setFloorBlockOnWallEnabled(enabled: Boolean): Unit { + Internals.writeArguments(BOOL to enabled) + Internals.callMethod(rawPtr, MethodBindings.setFloorBlockOnWallEnabledPtr, NIL) + } + + public final fun isFloorBlockOnWallEnabled(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isFloorBlockOnWallEnabledPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public final fun setSlideOnCeilingEnabled(enabled: Boolean): Unit { + Internals.writeArguments(BOOL to enabled) + Internals.callMethod(rawPtr, MethodBindings.setSlideOnCeilingEnabledPtr, NIL) + } + + public final fun isSlideOnCeilingEnabled(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isSlideOnCeilingEnabledPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public final fun setPlatformFloorLayers(excludeLayer: Long): Unit { + Internals.writeArguments(LONG to excludeLayer) + Internals.callMethod(rawPtr, MethodBindings.setPlatformFloorLayersPtr, NIL) + } + + public final fun getPlatformFloorLayers(): Long { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getPlatformFloorLayersPtr, LONG) + return (Internals.readReturnValue(LONG) as Long) + } + + public final fun setPlatformWallLayers(excludeLayer: Long): Unit { + Internals.writeArguments(LONG to excludeLayer) + Internals.callMethod(rawPtr, MethodBindings.setPlatformWallLayersPtr, NIL) + } + + public final fun getPlatformWallLayers(): Long { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getPlatformWallLayersPtr, LONG) + return (Internals.readReturnValue(LONG) as Long) + } + + public final fun getMaxSlides(): Int { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getMaxSlidesPtr, LONG) + return (Internals.readReturnValue(LONG) as Long).toInt() + } + + public final fun setMaxSlides(maxSlides: Int): Unit { + Internals.writeArguments(LONG to maxSlides.toLong()) + Internals.callMethod(rawPtr, MethodBindings.setMaxSlidesPtr, NIL) + } + + public final fun getFloorMaxAngle(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getFloorMaxAnglePtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setFloorMaxAngle(radians: Float): Unit { + Internals.writeArguments(DOUBLE to radians.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setFloorMaxAnglePtr, NIL) + } + + public final fun getFloorSnapLength(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getFloorSnapLengthPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setFloorSnapLength(floorSnapLength: Float): Unit { + Internals.writeArguments(DOUBLE to floorSnapLength.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setFloorSnapLengthPtr, NIL) + } + + public final fun getWallMinSlideAngle(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getWallMinSlideAnglePtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setWallMinSlideAngle(radians: Float): Unit { + Internals.writeArguments(DOUBLE to radians.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setWallMinSlideAnglePtr, NIL) + } + + public final fun getUpDirection(): Vector2 { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getUpDirectionPtr, VECTOR2) + return (Internals.readReturnValue(VECTOR2) as Vector2) + } + + public final fun setUpDirection(upDirection: Vector2): Unit { + Internals.writeArguments(VECTOR2 to upDirection) + Internals.callMethod(rawPtr, MethodBindings.setUpDirectionPtr, NIL) + } + + public final fun setMotionMode(mode: MotionMode): Unit { + Internals.writeArguments(LONG to mode.id) + Internals.callMethod(rawPtr, MethodBindings.setMotionModePtr, NIL) + } + + public final fun getMotionMode(): MotionMode { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getMotionModePtr, LONG) + return CharacterBody2D.MotionMode.from(Internals.readReturnValue(LONG) as Long) + } + + public final fun setPlatformOnLeave(onLeaveApplyVelocity: PlatformOnLeave): Unit { + Internals.writeArguments(LONG to onLeaveApplyVelocity.id) + Internals.callMethod(rawPtr, MethodBindings.setPlatformOnLeavePtr, NIL) + } + + public final fun getPlatformOnLeave(): PlatformOnLeave { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getPlatformOnLeavePtr, LONG) + return CharacterBody2D.PlatformOnLeave.from(Internals.readReturnValue(LONG) as Long) + } + + /** + * Returns `true` if the body collided with the floor on the last call of [moveAndSlide]. + * Otherwise, returns `false`. The [upDirection] and [floorMaxAngle] are used to determine whether a + * surface is "floor" or not. + */ + public final fun isOnFloor(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isOnFloorPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + /** + * Returns `true` if the body collided only with the floor on the last call of [moveAndSlide]. + * Otherwise, returns `false`. The [upDirection] and [floorMaxAngle] are used to determine whether a + * surface is "floor" or not. + */ + public final fun isOnFloorOnly(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isOnFloorOnlyPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + /** + * Returns `true` if the body collided with the ceiling on the last call of [moveAndSlide]. + * Otherwise, returns `false`. The [upDirection] and [floorMaxAngle] are used to determine whether a + * surface is "ceiling" or not. + */ + public final fun isOnCeiling(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isOnCeilingPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + /** + * Returns `true` if the body collided only with the ceiling on the last call of [moveAndSlide]. + * Otherwise, returns `false`. The [upDirection] and [floorMaxAngle] are used to determine whether a + * surface is "ceiling" or not. + */ + public final fun isOnCeilingOnly(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isOnCeilingOnlyPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + /** + * Returns `true` if the body collided with a wall on the last call of [moveAndSlide]. Otherwise, + * returns `false`. The [upDirection] and [floorMaxAngle] are used to determine whether a surface is + * "wall" or not. + */ + public final fun isOnWall(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isOnWallPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + /** + * Returns `true` if the body collided only with a wall on the last call of [moveAndSlide]. + * Otherwise, returns `false`. The [upDirection] and [floorMaxAngle] are used to determine whether a + * surface is "wall" or not. + */ + public final fun isOnWallOnly(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isOnWallOnlyPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + /** + * Returns the collision normal of the floor at the last collision point. Only valid after calling + * [moveAndSlide] and when [isOnFloor] returns `true`. + * **Warning:** The collision normal is not always the same as the surface normal. + */ + public final fun getFloorNormal(): Vector2 { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getFloorNormalPtr, VECTOR2) + return (Internals.readReturnValue(VECTOR2) as Vector2) + } + + /** + * Returns the collision normal of the wall at the last collision point. Only valid after calling + * [moveAndSlide] and when [isOnWall] returns `true`. + * **Warning:** The collision normal is not always the same as the surface normal. + */ + public final fun getWallNormal(): Vector2 { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getWallNormalPtr, VECTOR2) + return (Internals.readReturnValue(VECTOR2) as Vector2) + } + + /** + * Returns the last motion applied to the [CharacterBody2D] during the last call to + * [moveAndSlide]. The movement can be split into multiple motions when sliding occurs, and this + * method return the last one, which is useful to retrieve the current direction of the movement. + */ + public final fun getLastMotion(): Vector2 { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getLastMotionPtr, VECTOR2) + return (Internals.readReturnValue(VECTOR2) as Vector2) + } + + /** + * Returns the travel (position delta) that occurred during the last call to [moveAndSlide]. + */ + public final fun getPositionDelta(): Vector2 { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getPositionDeltaPtr, VECTOR2) + return (Internals.readReturnValue(VECTOR2) as Vector2) + } + + /** + * Returns the current real velocity since the last call to [moveAndSlide]. For example, when you + * climb a slope, you will move diagonally even though the velocity is horizontal. This method + * returns the diagonal movement, as opposed to [velocity] which returns the requested velocity. + */ + public final fun getRealVelocity(): Vector2 { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getRealVelocityPtr, VECTOR2) + return (Internals.readReturnValue(VECTOR2) as Vector2) + } + + /** + * Returns the floor's collision angle at the last collision point according to [upDirection], + * which is [Vector2.UP] by default. This value is always positive and only valid after calling + * [moveAndSlide] and when [isOnFloor] returns `true`. + */ + @JvmOverloads + public final fun getFloorAngle(upDirection: Vector2 = Vector2(0, -1)): Float { + Internals.writeArguments(VECTOR2 to upDirection) + Internals.callMethod(rawPtr, MethodBindings.getFloorAnglePtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + /** + * Returns the linear velocity of the platform at the last collision point. Only valid after + * calling [moveAndSlide]. + */ + public final fun getPlatformVelocity(): Vector2 { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getPlatformVelocityPtr, VECTOR2) + return (Internals.readReturnValue(VECTOR2) as Vector2) + } + + /** + * Returns the number of times the body collided and changed direction during the last call to + * [moveAndSlide]. + */ + public final fun getSlideCollisionCount(): Int { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getSlideCollisionCountPtr, LONG) + return (Internals.readReturnValue(LONG) as Long).toInt() + } + + /** + * Returns a [KinematicCollision2D], which contains information about a collision that occurred + * during the last call to [moveAndSlide]. Since the body can collide several times in a single call + * to [moveAndSlide], you must specify the index of the collision in the range 0 to + * ([getSlideCollisionCount] - 1). + * **Example usage:** + * + * gdscript: + * ```gdscript + * for i in get_slide_collision_count(): + * var collision = get_slide_collision(i) + * print("Collided with: ", collision.get_collider().name) + * ``` + * csharp: + * ```csharp + * for (int i = 0; i < GetSlideCollisionCount(); i++) + * { + * KinematicCollision2D collision = GetSlideCollision(i); + * GD.Print("Collided with: ", (collision.GetCollider() as Node).Name); + * } + * ``` + */ + public final fun getSlideCollision(slideIdx: Int): KinematicCollision2D? { + Internals.writeArguments(LONG to slideIdx.toLong()) + Internals.callMethod(rawPtr, MethodBindings.getSlideCollisionPtr, OBJECT) + return (Internals.readReturnValue(OBJECT) as KinematicCollision2D?) + } + + /** + * Returns a [KinematicCollision2D], which contains information about the latest collision that + * occurred during the last call to [moveAndSlide]. + */ + public final fun getLastSlideCollision(): KinematicCollision2D? { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getLastSlideCollisionPtr, OBJECT) + return (Internals.readReturnValue(OBJECT) as KinematicCollision2D?) + } + + public enum class MotionMode( + id: Long, + ) { + /** + * Apply when notions of walls, ceiling and floor are relevant. In this mode the body motion + * will react to slopes (acceleration/slowdown). This mode is suitable for sided games like + * platformers. + */ + MOTION_MODE_GROUNDED(0), + /** + * Apply when there is no notion of floor or ceiling. All collisions will be reported as + * `on_wall`. In this mode, when you slide, the speed will always be constant. This mode is + * suitable for top-down games. + */ + MOTION_MODE_FLOATING(1), + ; + + public val id: Long + init { + this.id = id + } + + public companion object { + public fun from(`value`: Long): MotionMode = entries.single { it.id == `value` } + } + } + + public enum class PlatformOnLeave( + id: Long, + ) { + /** + * Add the last platform velocity to the [velocity] when you leave a moving platform. + */ + PLATFORM_ON_LEAVE_ADD_VELOCITY(0), + /** + * Add the last platform velocity to the [velocity] when you leave a moving platform, but any + * downward motion is ignored. It's useful to keep full jump height even when the platform is + * moving down. + */ + PLATFORM_ON_LEAVE_ADD_UPWARD_VELOCITY(1), + /** + * Do nothing when leaving a platform. + */ + PLATFORM_ON_LEAVE_DO_NOTHING(2), + ; + + public val id: Long + init { + this.id = id + } + + public companion object { + public fun from(`value`: Long): PlatformOnLeave = entries.single { it.id == `value` } + } + } + + public companion object + + public object MethodBindings { + internal val moveAndSlidePtr: VoidPtr = + Internals.getMethodBindPtr("CharacterBody2D", "move_and_slide", 2240911060) + + internal val applyFloorSnapPtr: VoidPtr = + Internals.getMethodBindPtr("CharacterBody2D", "apply_floor_snap", 3218959716) + + internal val setVelocityPtr: VoidPtr = + Internals.getMethodBindPtr("CharacterBody2D", "set_velocity", 743155724) + + internal val getVelocityPtr: VoidPtr = + Internals.getMethodBindPtr("CharacterBody2D", "get_velocity", 3341600327) + + internal val setSafeMarginPtr: VoidPtr = + Internals.getMethodBindPtr("CharacterBody2D", "set_safe_margin", 373806689) + + internal val getSafeMarginPtr: VoidPtr = + Internals.getMethodBindPtr("CharacterBody2D", "get_safe_margin", 1740695150) + + internal val isFloorStopOnSlopeEnabledPtr: VoidPtr = + Internals.getMethodBindPtr("CharacterBody2D", "is_floor_stop_on_slope_enabled", 36873697) + + internal val setFloorStopOnSlopeEnabledPtr: VoidPtr = + Internals.getMethodBindPtr("CharacterBody2D", "set_floor_stop_on_slope_enabled", 2586408642) + + internal val setFloorConstantSpeedEnabledPtr: VoidPtr = + Internals.getMethodBindPtr("CharacterBody2D", "set_floor_constant_speed_enabled", 2586408642) + + internal val isFloorConstantSpeedEnabledPtr: VoidPtr = + Internals.getMethodBindPtr("CharacterBody2D", "is_floor_constant_speed_enabled", 36873697) + + internal val setFloorBlockOnWallEnabledPtr: VoidPtr = + Internals.getMethodBindPtr("CharacterBody2D", "set_floor_block_on_wall_enabled", 2586408642) + + internal val isFloorBlockOnWallEnabledPtr: VoidPtr = + Internals.getMethodBindPtr("CharacterBody2D", "is_floor_block_on_wall_enabled", 36873697) + + internal val setSlideOnCeilingEnabledPtr: VoidPtr = + Internals.getMethodBindPtr("CharacterBody2D", "set_slide_on_ceiling_enabled", 2586408642) + + internal val isSlideOnCeilingEnabledPtr: VoidPtr = + Internals.getMethodBindPtr("CharacterBody2D", "is_slide_on_ceiling_enabled", 36873697) + + internal val setPlatformFloorLayersPtr: VoidPtr = + Internals.getMethodBindPtr("CharacterBody2D", "set_platform_floor_layers", 1286410249) + + internal val getPlatformFloorLayersPtr: VoidPtr = + Internals.getMethodBindPtr("CharacterBody2D", "get_platform_floor_layers", 3905245786) + + internal val setPlatformWallLayersPtr: VoidPtr = + Internals.getMethodBindPtr("CharacterBody2D", "set_platform_wall_layers", 1286410249) + + internal val getPlatformWallLayersPtr: VoidPtr = + Internals.getMethodBindPtr("CharacterBody2D", "get_platform_wall_layers", 3905245786) + + internal val getMaxSlidesPtr: VoidPtr = + Internals.getMethodBindPtr("CharacterBody2D", "get_max_slides", 3905245786) + + internal val setMaxSlidesPtr: VoidPtr = + Internals.getMethodBindPtr("CharacterBody2D", "set_max_slides", 1286410249) + + internal val getFloorMaxAnglePtr: VoidPtr = + Internals.getMethodBindPtr("CharacterBody2D", "get_floor_max_angle", 1740695150) + + internal val setFloorMaxAnglePtr: VoidPtr = + Internals.getMethodBindPtr("CharacterBody2D", "set_floor_max_angle", 373806689) + + internal val getFloorSnapLengthPtr: VoidPtr = + Internals.getMethodBindPtr("CharacterBody2D", "get_floor_snap_length", 191475506) + + internal val setFloorSnapLengthPtr: VoidPtr = + Internals.getMethodBindPtr("CharacterBody2D", "set_floor_snap_length", 373806689) + + internal val getWallMinSlideAnglePtr: VoidPtr = + Internals.getMethodBindPtr("CharacterBody2D", "get_wall_min_slide_angle", 1740695150) + + internal val setWallMinSlideAnglePtr: VoidPtr = + Internals.getMethodBindPtr("CharacterBody2D", "set_wall_min_slide_angle", 373806689) + + internal val getUpDirectionPtr: VoidPtr = + Internals.getMethodBindPtr("CharacterBody2D", "get_up_direction", 3341600327) + + internal val setUpDirectionPtr: VoidPtr = + Internals.getMethodBindPtr("CharacterBody2D", "set_up_direction", 743155724) + + internal val setMotionModePtr: VoidPtr = + Internals.getMethodBindPtr("CharacterBody2D", "set_motion_mode", 1224392233) + + internal val getMotionModePtr: VoidPtr = + Internals.getMethodBindPtr("CharacterBody2D", "get_motion_mode", 1160151236) + + internal val setPlatformOnLeavePtr: VoidPtr = + Internals.getMethodBindPtr("CharacterBody2D", "set_platform_on_leave", 2423324375) + + internal val getPlatformOnLeavePtr: VoidPtr = + Internals.getMethodBindPtr("CharacterBody2D", "get_platform_on_leave", 4054324341) + + internal val isOnFloorPtr: VoidPtr = + Internals.getMethodBindPtr("CharacterBody2D", "is_on_floor", 36873697) + + internal val isOnFloorOnlyPtr: VoidPtr = + Internals.getMethodBindPtr("CharacterBody2D", "is_on_floor_only", 36873697) + + internal val isOnCeilingPtr: VoidPtr = + Internals.getMethodBindPtr("CharacterBody2D", "is_on_ceiling", 36873697) + + internal val isOnCeilingOnlyPtr: VoidPtr = + Internals.getMethodBindPtr("CharacterBody2D", "is_on_ceiling_only", 36873697) + + internal val isOnWallPtr: VoidPtr = + Internals.getMethodBindPtr("CharacterBody2D", "is_on_wall", 36873697) + + internal val isOnWallOnlyPtr: VoidPtr = + Internals.getMethodBindPtr("CharacterBody2D", "is_on_wall_only", 36873697) + + internal val getFloorNormalPtr: VoidPtr = + Internals.getMethodBindPtr("CharacterBody2D", "get_floor_normal", 3341600327) + + internal val getWallNormalPtr: VoidPtr = + Internals.getMethodBindPtr("CharacterBody2D", "get_wall_normal", 3341600327) + + internal val getLastMotionPtr: VoidPtr = + Internals.getMethodBindPtr("CharacterBody2D", "get_last_motion", 3341600327) + + internal val getPositionDeltaPtr: VoidPtr = + Internals.getMethodBindPtr("CharacterBody2D", "get_position_delta", 3341600327) + + internal val getRealVelocityPtr: VoidPtr = + Internals.getMethodBindPtr("CharacterBody2D", "get_real_velocity", 3341600327) + + internal val getFloorAnglePtr: VoidPtr = + Internals.getMethodBindPtr("CharacterBody2D", "get_floor_angle", 2841063350) + + internal val getPlatformVelocityPtr: VoidPtr = + Internals.getMethodBindPtr("CharacterBody2D", "get_platform_velocity", 3341600327) + + internal val getSlideCollisionCountPtr: VoidPtr = + Internals.getMethodBindPtr("CharacterBody2D", "get_slide_collision_count", 3905245786) + + internal val getSlideCollisionPtr: VoidPtr = + Internals.getMethodBindPtr("CharacterBody2D", "get_slide_collision", 860659811) + + internal val getLastSlideCollisionPtr: VoidPtr = + Internals.getMethodBindPtr("CharacterBody2D", "get_last_slide_collision", 2161834755) + } +} diff --git a/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/CharacterBody3D.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/CharacterBody3D.kt new file mode 100644 index 0000000000..12b39b106c --- /dev/null +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/CharacterBody3D.kt @@ -0,0 +1,886 @@ +// THIS FILE IS GENERATED! DO NOT EDIT IT MANUALLY! +@file:Suppress("PackageDirectoryMismatch", "unused", "FunctionName", "RedundantModalityModifier", + "UNCHECKED_CAST", "JoinDeclarationAndAssignment", "USELESS_CAST", + "RemoveRedundantQualifierName", "NOTHING_TO_INLINE", "NON_FINAL_MEMBER_IN_OBJECT", + "RedundantVisibilityModifier", "RedundantUnitReturnType", "MemberVisibilityCanBePrivate") + +package godot + +import godot.`annotation`.CoreTypeHelper +import godot.`annotation`.CoreTypeLocalCopy +import godot.`annotation`.GodotBaseType +import godot.core.VariantParser.BOOL +import godot.core.VariantParser.DOUBLE +import godot.core.VariantParser.LONG +import godot.core.VariantParser.NIL +import godot.core.VariantParser.OBJECT +import godot.core.VariantParser.VECTOR3 +import godot.core.Vector3 +import godot.util.Internals +import godot.util.VoidPtr +import kotlin.Boolean +import kotlin.Double +import kotlin.Float +import kotlin.Int +import kotlin.Long +import kotlin.Suppress +import kotlin.Unit +import kotlin.jvm.JvmName +import kotlin.jvm.JvmOverloads + +private const val ENGINE_CLASS_CHARACTERBODY3D_INDEX: Int = 180 + +/** + * [CharacterBody3D] is a specialized class for physics bodies that are meant to be user-controlled. + * They are not affected by physics at all, but they affect other physics bodies in their path. They + * are mainly used to provide high-level API to move objects with wall and slope detection + * ([moveAndSlide] method) in addition to the general collision detection provided by + * [PhysicsBody3D.moveAndCollide]. This makes it useful for highly configurable physics bodies that + * must move in specific ways and collide with the world, as is often the case with user-controlled + * characters. + * For game objects that don't require complex movement or collision detection, such as moving + * platforms, [AnimatableBody3D] is simpler to configure. + */ +@GodotBaseType +public open class CharacterBody3D : PhysicsBody3D() { + /** + * Sets the motion mode which defines the behavior of [moveAndSlide]. See [MotionMode] constants + * for available modes. + */ + public final inline var motionMode: MotionMode + @JvmName("motionModeProperty") + get() = getMotionMode() + @JvmName("motionModeProperty") + set(`value`) { + setMotionMode(value) + } + + /** + * Vector pointing upwards, used to determine what is a wall and what is a floor (or a ceiling) + * when calling [moveAndSlide]. Defaults to [Vector3.UP]. As the vector will be normalized it can't + * be equal to [Vector3.ZERO], if you want all collisions to be reported as walls, consider using + * [MOTION_MODE_FLOATING] as [motionMode]. + */ + @CoreTypeLocalCopy + public final inline var upDirection: Vector3 + @JvmName("upDirectionProperty") + get() = getUpDirection() + @JvmName("upDirectionProperty") + set(`value`) { + setUpDirection(value) + } + + /** + * If `true`, during a jump against the ceiling, the body will slide, if `false` it will be + * stopped and will fall vertically. + */ + public final inline var slideOnCeiling: Boolean + @JvmName("slideOnCeilingProperty") + get() = isSlideOnCeilingEnabled() + @JvmName("slideOnCeilingProperty") + set(`value`) { + setSlideOnCeilingEnabled(value) + } + + /** + * Current velocity vector (typically meters per second), used and modified during calls to + * [moveAndSlide]. + */ + @CoreTypeLocalCopy + public final inline var velocity: Vector3 + @JvmName("velocityProperty") + get() = getVelocity() + @JvmName("velocityProperty") + set(`value`) { + setVelocity(value) + } + + /** + * Maximum number of times the body can change direction before it stops when calling + * [moveAndSlide]. + */ + public final inline var maxSlides: Int + @JvmName("maxSlidesProperty") + get() = getMaxSlides() + @JvmName("maxSlidesProperty") + set(`value`) { + setMaxSlides(value) + } + + /** + * Minimum angle (in radians) where the body is allowed to slide when it encounters a slope. The + * default value equals 15 degrees. When [motionMode] is [MOTION_MODE_GROUNDED], it only affects + * movement if [floorBlockOnWall] is `true`. + */ + public final inline var wallMinSlideAngle: Float + @JvmName("wallMinSlideAngleProperty") + get() = getWallMinSlideAngle() + @JvmName("wallMinSlideAngleProperty") + set(`value`) { + setWallMinSlideAngle(value) + } + + /** + * If `true`, the body will not slide on slopes when calling [moveAndSlide] when the body is + * standing still. + * If `false`, the body will slide on floor's slopes when [velocity] applies a downward force. + */ + public final inline var floorStopOnSlope: Boolean + @JvmName("floorStopOnSlopeProperty") + get() = isFloorStopOnSlopeEnabled() + @JvmName("floorStopOnSlopeProperty") + set(`value`) { + setFloorStopOnSlopeEnabled(value) + } + + /** + * If `false` (by default), the body will move faster on downward slopes and slower on upward + * slopes. + * If `true`, the body will always move at the same speed on the ground no matter the slope. Note + * that you need to use [floorSnapLength] to stick along a downward slope at constant speed. + */ + public final inline var floorConstantSpeed: Boolean + @JvmName("floorConstantSpeedProperty") + get() = isFloorConstantSpeedEnabled() + @JvmName("floorConstantSpeedProperty") + set(`value`) { + setFloorConstantSpeedEnabled(value) + } + + /** + * If `true`, the body will be able to move on the floor only. This option avoids to be able to + * walk on walls, it will however allow to slide down along them. + */ + public final inline var floorBlockOnWall: Boolean + @JvmName("floorBlockOnWallProperty") + get() = isFloorBlockOnWallEnabled() + @JvmName("floorBlockOnWallProperty") + set(`value`) { + setFloorBlockOnWallEnabled(value) + } + + /** + * Maximum angle (in radians) where a slope is still considered a floor (or a ceiling), rather + * than a wall, when calling [moveAndSlide]. The default value equals 45 degrees. + */ + public final inline var floorMaxAngle: Float + @JvmName("floorMaxAngleProperty") + get() = getFloorMaxAngle() + @JvmName("floorMaxAngleProperty") + set(`value`) { + setFloorMaxAngle(value) + } + + /** + * Sets a snapping distance. When set to a value different from `0.0`, the body is kept attached + * to slopes when calling [moveAndSlide]. The snapping vector is determined by the given distance + * along the opposite direction of the [upDirection]. + * As long as the snapping vector is in contact with the ground and the body moves against + * [upDirection], the body will remain attached to the surface. Snapping is not applied if the body + * moves along [upDirection], meaning it contains vertical rising velocity, so it will be able to + * detach from the ground when jumping or when the body is pushed up by something. If you want to + * apply a snap without taking into account the velocity, use [applyFloorSnap]. + */ + public final inline var floorSnapLength: Float + @JvmName("floorSnapLengthProperty") + get() = getFloorSnapLength() + @JvmName("floorSnapLengthProperty") + set(`value`) { + setFloorSnapLength(value) + } + + /** + * Sets the behavior to apply when you leave a moving platform. By default, to be physically + * accurate, when you leave the last platform velocity is applied. See [PlatformOnLeave] constants + * for available behavior. + */ + public final inline var platformOnLeave: PlatformOnLeave + @JvmName("platformOnLeaveProperty") + get() = getPlatformOnLeave() + @JvmName("platformOnLeaveProperty") + set(`value`) { + setPlatformOnLeave(value) + } + + /** + * Collision layers that will be included for detecting floor bodies that will act as moving + * platforms to be followed by the [CharacterBody3D]. By default, all floor bodies are detected and + * propagate their velocity. + */ + public final inline var platformFloorLayers: Long + @JvmName("platformFloorLayersProperty") + get() = getPlatformFloorLayers() + @JvmName("platformFloorLayersProperty") + set(`value`) { + setPlatformFloorLayers(value) + } + + /** + * Collision layers that will be included for detecting wall bodies that will act as moving + * platforms to be followed by the [CharacterBody3D]. By default, all wall bodies are ignored. + */ + public final inline var platformWallLayers: Long + @JvmName("platformWallLayersProperty") + get() = getPlatformWallLayers() + @JvmName("platformWallLayersProperty") + set(`value`) { + setPlatformWallLayers(value) + } + + /** + * Extra margin used for collision recovery when calling [moveAndSlide]. + * If the body is at least this close to another body, it will consider them to be colliding and + * will be pushed away before performing the actual motion. + * A higher value means it's more flexible for detecting collision, which helps with consistently + * detecting walls and floors. + * A lower value forces the collision algorithm to use more exact detection, so it can be used in + * cases that specifically require precision, e.g at very low scale to avoid visible jittering, or + * for stability with a stack of character bodies. + */ + public final inline var safeMargin: Float + @JvmName("safeMarginProperty") + get() = getSafeMargin() + @JvmName("safeMarginProperty") + set(`value`) { + setSafeMargin(value) + } + + public override fun new(scriptIndex: Int): Unit { + Internals.callConstructor(this, ENGINE_CLASS_CHARACTERBODY3D_INDEX, scriptIndex) + } + + /** + * Vector pointing upwards, used to determine what is a wall and what is a floor (or a ceiling) + * when calling [moveAndSlide]. Defaults to [Vector3.UP]. As the vector will be normalized it can't + * be equal to [Vector3.ZERO], if you want all collisions to be reported as walls, consider using + * [MOTION_MODE_FLOATING] as [motionMode]. + * + * This is a helper function to make dealing with local copies easier. + * + * For more information, see our + * [documentation](https://godot-kotl.in/en/stable/user-guide/api-differences/#core-types). + * + * Allow to directly modify the local copy of the property and assign it back to the Object. + * + * Prefer that over writing: + * `````` + * val myCoreType = characterbody3d.upDirection + * //Your changes + * characterbody3d.upDirection = myCoreType + * `````` + */ + @CoreTypeHelper + public final fun upDirectionMutate(block: Vector3.() -> Unit): Vector3 = upDirection.apply{ + block(this) + upDirection = this + } + + + /** + * Current velocity vector (typically meters per second), used and modified during calls to + * [moveAndSlide]. + * + * This is a helper function to make dealing with local copies easier. + * + * For more information, see our + * [documentation](https://godot-kotl.in/en/stable/user-guide/api-differences/#core-types). + * + * Allow to directly modify the local copy of the property and assign it back to the Object. + * + * Prefer that over writing: + * `````` + * val myCoreType = characterbody3d.velocity + * //Your changes + * characterbody3d.velocity = myCoreType + * `````` + */ + @CoreTypeHelper + public final fun velocityMutate(block: Vector3.() -> Unit): Vector3 = velocity.apply{ + block(this) + velocity = this + } + + + /** + * Moves the body based on [velocity]. If the body collides with another, it will slide along the + * other body rather than stop immediately. If the other body is a [CharacterBody3D] or + * [RigidBody3D], it will also be affected by the motion of the other body. You can use this to make + * moving and rotating platforms, or to make nodes push other nodes. + * Modifies [velocity] if a slide collision occurred. To get the latest collision call + * [getLastSlideCollision], for more detailed information about collisions that occurred, use + * [getSlideCollision]. + * When the body touches a moving platform, the platform's velocity is automatically added to the + * body motion. If a collision occurs due to the platform's motion, it will always be first in the + * slide collisions. + * Returns `true` if the body collided, otherwise, returns `false`. + */ + public final fun moveAndSlide(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.moveAndSlidePtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + /** + * Allows to manually apply a snap to the floor regardless of the body's velocity. This function + * does nothing when [isOnFloor] returns `true`. + */ + public final fun applyFloorSnap(): Unit { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.applyFloorSnapPtr, NIL) + } + + public final fun setVelocity(velocity: Vector3): Unit { + Internals.writeArguments(VECTOR3 to velocity) + Internals.callMethod(rawPtr, MethodBindings.setVelocityPtr, NIL) + } + + public final fun getVelocity(): Vector3 { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getVelocityPtr, VECTOR3) + return (Internals.readReturnValue(VECTOR3) as Vector3) + } + + public final fun setSafeMargin(margin: Float): Unit { + Internals.writeArguments(DOUBLE to margin.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setSafeMarginPtr, NIL) + } + + public final fun getSafeMargin(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getSafeMarginPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun isFloorStopOnSlopeEnabled(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isFloorStopOnSlopeEnabledPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public final fun setFloorStopOnSlopeEnabled(enabled: Boolean): Unit { + Internals.writeArguments(BOOL to enabled) + Internals.callMethod(rawPtr, MethodBindings.setFloorStopOnSlopeEnabledPtr, NIL) + } + + public final fun setFloorConstantSpeedEnabled(enabled: Boolean): Unit { + Internals.writeArguments(BOOL to enabled) + Internals.callMethod(rawPtr, MethodBindings.setFloorConstantSpeedEnabledPtr, NIL) + } + + public final fun isFloorConstantSpeedEnabled(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isFloorConstantSpeedEnabledPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public final fun setFloorBlockOnWallEnabled(enabled: Boolean): Unit { + Internals.writeArguments(BOOL to enabled) + Internals.callMethod(rawPtr, MethodBindings.setFloorBlockOnWallEnabledPtr, NIL) + } + + public final fun isFloorBlockOnWallEnabled(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isFloorBlockOnWallEnabledPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public final fun setSlideOnCeilingEnabled(enabled: Boolean): Unit { + Internals.writeArguments(BOOL to enabled) + Internals.callMethod(rawPtr, MethodBindings.setSlideOnCeilingEnabledPtr, NIL) + } + + public final fun isSlideOnCeilingEnabled(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isSlideOnCeilingEnabledPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public final fun setPlatformFloorLayers(excludeLayer: Long): Unit { + Internals.writeArguments(LONG to excludeLayer) + Internals.callMethod(rawPtr, MethodBindings.setPlatformFloorLayersPtr, NIL) + } + + public final fun getPlatformFloorLayers(): Long { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getPlatformFloorLayersPtr, LONG) + return (Internals.readReturnValue(LONG) as Long) + } + + public final fun setPlatformWallLayers(excludeLayer: Long): Unit { + Internals.writeArguments(LONG to excludeLayer) + Internals.callMethod(rawPtr, MethodBindings.setPlatformWallLayersPtr, NIL) + } + + public final fun getPlatformWallLayers(): Long { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getPlatformWallLayersPtr, LONG) + return (Internals.readReturnValue(LONG) as Long) + } + + public final fun getMaxSlides(): Int { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getMaxSlidesPtr, LONG) + return (Internals.readReturnValue(LONG) as Long).toInt() + } + + public final fun setMaxSlides(maxSlides: Int): Unit { + Internals.writeArguments(LONG to maxSlides.toLong()) + Internals.callMethod(rawPtr, MethodBindings.setMaxSlidesPtr, NIL) + } + + public final fun getFloorMaxAngle(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getFloorMaxAnglePtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setFloorMaxAngle(radians: Float): Unit { + Internals.writeArguments(DOUBLE to radians.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setFloorMaxAnglePtr, NIL) + } + + public final fun getFloorSnapLength(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getFloorSnapLengthPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setFloorSnapLength(floorSnapLength: Float): Unit { + Internals.writeArguments(DOUBLE to floorSnapLength.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setFloorSnapLengthPtr, NIL) + } + + public final fun getWallMinSlideAngle(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getWallMinSlideAnglePtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setWallMinSlideAngle(radians: Float): Unit { + Internals.writeArguments(DOUBLE to radians.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setWallMinSlideAnglePtr, NIL) + } + + public final fun getUpDirection(): Vector3 { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getUpDirectionPtr, VECTOR3) + return (Internals.readReturnValue(VECTOR3) as Vector3) + } + + public final fun setUpDirection(upDirection: Vector3): Unit { + Internals.writeArguments(VECTOR3 to upDirection) + Internals.callMethod(rawPtr, MethodBindings.setUpDirectionPtr, NIL) + } + + public final fun setMotionMode(mode: MotionMode): Unit { + Internals.writeArguments(LONG to mode.id) + Internals.callMethod(rawPtr, MethodBindings.setMotionModePtr, NIL) + } + + public final fun getMotionMode(): MotionMode { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getMotionModePtr, LONG) + return CharacterBody3D.MotionMode.from(Internals.readReturnValue(LONG) as Long) + } + + public final fun setPlatformOnLeave(onLeaveApplyVelocity: PlatformOnLeave): Unit { + Internals.writeArguments(LONG to onLeaveApplyVelocity.id) + Internals.callMethod(rawPtr, MethodBindings.setPlatformOnLeavePtr, NIL) + } + + public final fun getPlatformOnLeave(): PlatformOnLeave { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getPlatformOnLeavePtr, LONG) + return CharacterBody3D.PlatformOnLeave.from(Internals.readReturnValue(LONG) as Long) + } + + /** + * Returns `true` if the body collided with the floor on the last call of [moveAndSlide]. + * Otherwise, returns `false`. The [upDirection] and [floorMaxAngle] are used to determine whether a + * surface is "floor" or not. + */ + public final fun isOnFloor(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isOnFloorPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + /** + * Returns `true` if the body collided only with the floor on the last call of [moveAndSlide]. + * Otherwise, returns `false`. The [upDirection] and [floorMaxAngle] are used to determine whether a + * surface is "floor" or not. + */ + public final fun isOnFloorOnly(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isOnFloorOnlyPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + /** + * Returns `true` if the body collided with the ceiling on the last call of [moveAndSlide]. + * Otherwise, returns `false`. The [upDirection] and [floorMaxAngle] are used to determine whether a + * surface is "ceiling" or not. + */ + public final fun isOnCeiling(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isOnCeilingPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + /** + * Returns `true` if the body collided only with the ceiling on the last call of [moveAndSlide]. + * Otherwise, returns `false`. The [upDirection] and [floorMaxAngle] are used to determine whether a + * surface is "ceiling" or not. + */ + public final fun isOnCeilingOnly(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isOnCeilingOnlyPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + /** + * Returns `true` if the body collided with a wall on the last call of [moveAndSlide]. Otherwise, + * returns `false`. The [upDirection] and [floorMaxAngle] are used to determine whether a surface is + * "wall" or not. + */ + public final fun isOnWall(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isOnWallPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + /** + * Returns `true` if the body collided only with a wall on the last call of [moveAndSlide]. + * Otherwise, returns `false`. The [upDirection] and [floorMaxAngle] are used to determine whether a + * surface is "wall" or not. + */ + public final fun isOnWallOnly(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isOnWallOnlyPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + /** + * Returns the collision normal of the floor at the last collision point. Only valid after calling + * [moveAndSlide] and when [isOnFloor] returns `true`. + * **Warning:** The collision normal is not always the same as the surface normal. + */ + public final fun getFloorNormal(): Vector3 { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getFloorNormalPtr, VECTOR3) + return (Internals.readReturnValue(VECTOR3) as Vector3) + } + + /** + * Returns the collision normal of the wall at the last collision point. Only valid after calling + * [moveAndSlide] and when [isOnWall] returns `true`. + * **Warning:** The collision normal is not always the same as the surface normal. + */ + public final fun getWallNormal(): Vector3 { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getWallNormalPtr, VECTOR3) + return (Internals.readReturnValue(VECTOR3) as Vector3) + } + + /** + * Returns the last motion applied to the [CharacterBody3D] during the last call to + * [moveAndSlide]. The movement can be split into multiple motions when sliding occurs, and this + * method return the last one, which is useful to retrieve the current direction of the movement. + */ + public final fun getLastMotion(): Vector3 { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getLastMotionPtr, VECTOR3) + return (Internals.readReturnValue(VECTOR3) as Vector3) + } + + /** + * Returns the travel (position delta) that occurred during the last call to [moveAndSlide]. + */ + public final fun getPositionDelta(): Vector3 { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getPositionDeltaPtr, VECTOR3) + return (Internals.readReturnValue(VECTOR3) as Vector3) + } + + /** + * Returns the current real velocity since the last call to [moveAndSlide]. For example, when you + * climb a slope, you will move diagonally even though the velocity is horizontal. This method + * returns the diagonal movement, as opposed to [velocity] which returns the requested velocity. + */ + public final fun getRealVelocity(): Vector3 { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getRealVelocityPtr, VECTOR3) + return (Internals.readReturnValue(VECTOR3) as Vector3) + } + + /** + * Returns the floor's collision angle at the last collision point according to [upDirection], + * which is [Vector3.UP] by default. This value is always positive and only valid after calling + * [moveAndSlide] and when [isOnFloor] returns `true`. + */ + @JvmOverloads + public final fun getFloorAngle(upDirection: Vector3 = Vector3(0, 1, 0)): Float { + Internals.writeArguments(VECTOR3 to upDirection) + Internals.callMethod(rawPtr, MethodBindings.getFloorAnglePtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + /** + * Returns the linear velocity of the platform at the last collision point. Only valid after + * calling [moveAndSlide]. + */ + public final fun getPlatformVelocity(): Vector3 { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getPlatformVelocityPtr, VECTOR3) + return (Internals.readReturnValue(VECTOR3) as Vector3) + } + + /** + * Returns the angular velocity of the platform at the last collision point. Only valid after + * calling [moveAndSlide]. + */ + public final fun getPlatformAngularVelocity(): Vector3 { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getPlatformAngularVelocityPtr, VECTOR3) + return (Internals.readReturnValue(VECTOR3) as Vector3) + } + + /** + * Returns the number of times the body collided and changed direction during the last call to + * [moveAndSlide]. + */ + public final fun getSlideCollisionCount(): Int { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getSlideCollisionCountPtr, LONG) + return (Internals.readReturnValue(LONG) as Long).toInt() + } + + /** + * Returns a [KinematicCollision3D], which contains information about a collision that occurred + * during the last call to [moveAndSlide]. Since the body can collide several times in a single call + * to [moveAndSlide], you must specify the index of the collision in the range 0 to + * ([getSlideCollisionCount] - 1). + */ + public final fun getSlideCollision(slideIdx: Int): KinematicCollision3D? { + Internals.writeArguments(LONG to slideIdx.toLong()) + Internals.callMethod(rawPtr, MethodBindings.getSlideCollisionPtr, OBJECT) + return (Internals.readReturnValue(OBJECT) as KinematicCollision3D?) + } + + /** + * Returns a [KinematicCollision3D], which contains information about the latest collision that + * occurred during the last call to [moveAndSlide]. + */ + public final fun getLastSlideCollision(): KinematicCollision3D? { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getLastSlideCollisionPtr, OBJECT) + return (Internals.readReturnValue(OBJECT) as KinematicCollision3D?) + } + + public enum class MotionMode( + id: Long, + ) { + /** + * Apply when notions of walls, ceiling and floor are relevant. In this mode the body motion + * will react to slopes (acceleration/slowdown). This mode is suitable for grounded games like + * platformers. + */ + MOTION_MODE_GROUNDED(0), + /** + * Apply when there is no notion of floor or ceiling. All collisions will be reported as + * `on_wall`. In this mode, when you slide, the speed will always be constant. This mode is + * suitable for games without ground like space games. + */ + MOTION_MODE_FLOATING(1), + ; + + public val id: Long + init { + this.id = id + } + + public companion object { + public fun from(`value`: Long): MotionMode = entries.single { it.id == `value` } + } + } + + public enum class PlatformOnLeave( + id: Long, + ) { + /** + * Add the last platform velocity to the [velocity] when you leave a moving platform. + */ + PLATFORM_ON_LEAVE_ADD_VELOCITY(0), + /** + * Add the last platform velocity to the [velocity] when you leave a moving platform, but any + * downward motion is ignored. It's useful to keep full jump height even when the platform is + * moving down. + */ + PLATFORM_ON_LEAVE_ADD_UPWARD_VELOCITY(1), + /** + * Do nothing when leaving a platform. + */ + PLATFORM_ON_LEAVE_DO_NOTHING(2), + ; + + public val id: Long + init { + this.id = id + } + + public companion object { + public fun from(`value`: Long): PlatformOnLeave = entries.single { it.id == `value` } + } + } + + public companion object + + public object MethodBindings { + internal val moveAndSlidePtr: VoidPtr = + Internals.getMethodBindPtr("CharacterBody3D", "move_and_slide", 2240911060) + + internal val applyFloorSnapPtr: VoidPtr = + Internals.getMethodBindPtr("CharacterBody3D", "apply_floor_snap", 3218959716) + + internal val setVelocityPtr: VoidPtr = + Internals.getMethodBindPtr("CharacterBody3D", "set_velocity", 3460891852) + + internal val getVelocityPtr: VoidPtr = + Internals.getMethodBindPtr("CharacterBody3D", "get_velocity", 3360562783) + + internal val setSafeMarginPtr: VoidPtr = + Internals.getMethodBindPtr("CharacterBody3D", "set_safe_margin", 373806689) + + internal val getSafeMarginPtr: VoidPtr = + Internals.getMethodBindPtr("CharacterBody3D", "get_safe_margin", 1740695150) + + internal val isFloorStopOnSlopeEnabledPtr: VoidPtr = + Internals.getMethodBindPtr("CharacterBody3D", "is_floor_stop_on_slope_enabled", 36873697) + + internal val setFloorStopOnSlopeEnabledPtr: VoidPtr = + Internals.getMethodBindPtr("CharacterBody3D", "set_floor_stop_on_slope_enabled", 2586408642) + + internal val setFloorConstantSpeedEnabledPtr: VoidPtr = + Internals.getMethodBindPtr("CharacterBody3D", "set_floor_constant_speed_enabled", 2586408642) + + internal val isFloorConstantSpeedEnabledPtr: VoidPtr = + Internals.getMethodBindPtr("CharacterBody3D", "is_floor_constant_speed_enabled", 36873697) + + internal val setFloorBlockOnWallEnabledPtr: VoidPtr = + Internals.getMethodBindPtr("CharacterBody3D", "set_floor_block_on_wall_enabled", 2586408642) + + internal val isFloorBlockOnWallEnabledPtr: VoidPtr = + Internals.getMethodBindPtr("CharacterBody3D", "is_floor_block_on_wall_enabled", 36873697) + + internal val setSlideOnCeilingEnabledPtr: VoidPtr = + Internals.getMethodBindPtr("CharacterBody3D", "set_slide_on_ceiling_enabled", 2586408642) + + internal val isSlideOnCeilingEnabledPtr: VoidPtr = + Internals.getMethodBindPtr("CharacterBody3D", "is_slide_on_ceiling_enabled", 36873697) + + internal val setPlatformFloorLayersPtr: VoidPtr = + Internals.getMethodBindPtr("CharacterBody3D", "set_platform_floor_layers", 1286410249) + + internal val getPlatformFloorLayersPtr: VoidPtr = + Internals.getMethodBindPtr("CharacterBody3D", "get_platform_floor_layers", 3905245786) + + internal val setPlatformWallLayersPtr: VoidPtr = + Internals.getMethodBindPtr("CharacterBody3D", "set_platform_wall_layers", 1286410249) + + internal val getPlatformWallLayersPtr: VoidPtr = + Internals.getMethodBindPtr("CharacterBody3D", "get_platform_wall_layers", 3905245786) + + internal val getMaxSlidesPtr: VoidPtr = + Internals.getMethodBindPtr("CharacterBody3D", "get_max_slides", 3905245786) + + internal val setMaxSlidesPtr: VoidPtr = + Internals.getMethodBindPtr("CharacterBody3D", "set_max_slides", 1286410249) + + internal val getFloorMaxAnglePtr: VoidPtr = + Internals.getMethodBindPtr("CharacterBody3D", "get_floor_max_angle", 1740695150) + + internal val setFloorMaxAnglePtr: VoidPtr = + Internals.getMethodBindPtr("CharacterBody3D", "set_floor_max_angle", 373806689) + + internal val getFloorSnapLengthPtr: VoidPtr = + Internals.getMethodBindPtr("CharacterBody3D", "get_floor_snap_length", 191475506) + + internal val setFloorSnapLengthPtr: VoidPtr = + Internals.getMethodBindPtr("CharacterBody3D", "set_floor_snap_length", 373806689) + + internal val getWallMinSlideAnglePtr: VoidPtr = + Internals.getMethodBindPtr("CharacterBody3D", "get_wall_min_slide_angle", 1740695150) + + internal val setWallMinSlideAnglePtr: VoidPtr = + Internals.getMethodBindPtr("CharacterBody3D", "set_wall_min_slide_angle", 373806689) + + internal val getUpDirectionPtr: VoidPtr = + Internals.getMethodBindPtr("CharacterBody3D", "get_up_direction", 3360562783) + + internal val setUpDirectionPtr: VoidPtr = + Internals.getMethodBindPtr("CharacterBody3D", "set_up_direction", 3460891852) + + internal val setMotionModePtr: VoidPtr = + Internals.getMethodBindPtr("CharacterBody3D", "set_motion_mode", 2690739026) + + internal val getMotionModePtr: VoidPtr = + Internals.getMethodBindPtr("CharacterBody3D", "get_motion_mode", 3529553604) + + internal val setPlatformOnLeavePtr: VoidPtr = + Internals.getMethodBindPtr("CharacterBody3D", "set_platform_on_leave", 1459986142) + + internal val getPlatformOnLeavePtr: VoidPtr = + Internals.getMethodBindPtr("CharacterBody3D", "get_platform_on_leave", 996491171) + + internal val isOnFloorPtr: VoidPtr = + Internals.getMethodBindPtr("CharacterBody3D", "is_on_floor", 36873697) + + internal val isOnFloorOnlyPtr: VoidPtr = + Internals.getMethodBindPtr("CharacterBody3D", "is_on_floor_only", 36873697) + + internal val isOnCeilingPtr: VoidPtr = + Internals.getMethodBindPtr("CharacterBody3D", "is_on_ceiling", 36873697) + + internal val isOnCeilingOnlyPtr: VoidPtr = + Internals.getMethodBindPtr("CharacterBody3D", "is_on_ceiling_only", 36873697) + + internal val isOnWallPtr: VoidPtr = + Internals.getMethodBindPtr("CharacterBody3D", "is_on_wall", 36873697) + + internal val isOnWallOnlyPtr: VoidPtr = + Internals.getMethodBindPtr("CharacterBody3D", "is_on_wall_only", 36873697) + + internal val getFloorNormalPtr: VoidPtr = + Internals.getMethodBindPtr("CharacterBody3D", "get_floor_normal", 3360562783) + + internal val getWallNormalPtr: VoidPtr = + Internals.getMethodBindPtr("CharacterBody3D", "get_wall_normal", 3360562783) + + internal val getLastMotionPtr: VoidPtr = + Internals.getMethodBindPtr("CharacterBody3D", "get_last_motion", 3360562783) + + internal val getPositionDeltaPtr: VoidPtr = + Internals.getMethodBindPtr("CharacterBody3D", "get_position_delta", 3360562783) + + internal val getRealVelocityPtr: VoidPtr = + Internals.getMethodBindPtr("CharacterBody3D", "get_real_velocity", 3360562783) + + internal val getFloorAnglePtr: VoidPtr = + Internals.getMethodBindPtr("CharacterBody3D", "get_floor_angle", 2906300789) + + internal val getPlatformVelocityPtr: VoidPtr = + Internals.getMethodBindPtr("CharacterBody3D", "get_platform_velocity", 3360562783) + + internal val getPlatformAngularVelocityPtr: VoidPtr = + Internals.getMethodBindPtr("CharacterBody3D", "get_platform_angular_velocity", 3360562783) + + internal val getSlideCollisionCountPtr: VoidPtr = + Internals.getMethodBindPtr("CharacterBody3D", "get_slide_collision_count", 3905245786) + + internal val getSlideCollisionPtr: VoidPtr = + Internals.getMethodBindPtr("CharacterBody3D", "get_slide_collision", 107003663) + + internal val getLastSlideCollisionPtr: VoidPtr = + Internals.getMethodBindPtr("CharacterBody3D", "get_last_slide_collision", 186875014) + } +} diff --git a/kt/godot-library/src/main/kotlin/godot/gen/godot/CheckBox.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/CheckBox.kt similarity index 87% rename from kt/godot-library/src/main/kotlin/godot/gen/godot/CheckBox.kt rename to kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/CheckBox.kt index cb8af9d781..6be7ad30b9 100644 --- a/kt/godot-library/src/main/kotlin/godot/gen/godot/CheckBox.kt +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/CheckBox.kt @@ -7,10 +7,13 @@ package godot import godot.`annotation`.GodotBaseType +import godot.util.Internals import kotlin.Int import kotlin.Suppress import kotlin.Unit +private const val ENGINE_CLASS_CHECKBOX_INDEX: Int = 181 + /** * [CheckBox] allows the user to choose one of only two possible options. It's similar to * [CheckButton] in functionality, but it has a different appearance. To follow established UX @@ -24,10 +27,10 @@ import kotlin.Unit @GodotBaseType public open class CheckBox : Button() { public override fun new(scriptIndex: Int): Unit { - callConstructor(ENGINECLASS_CHECKBOX, scriptIndex) + Internals.callConstructor(this, ENGINE_CLASS_CHECKBOX_INDEX, scriptIndex) } public companion object - internal object MethodBindings + public object MethodBindings } diff --git a/kt/godot-library/src/main/kotlin/godot/gen/godot/CheckButton.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/CheckButton.kt similarity index 85% rename from kt/godot-library/src/main/kotlin/godot/gen/godot/CheckButton.kt rename to kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/CheckButton.kt index 63271192da..4fdadc0b1a 100644 --- a/kt/godot-library/src/main/kotlin/godot/gen/godot/CheckButton.kt +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/CheckButton.kt @@ -7,10 +7,13 @@ package godot import godot.`annotation`.GodotBaseType +import godot.util.Internals import kotlin.Int import kotlin.Suppress import kotlin.Unit +private const val ENGINE_CLASS_CHECKBUTTON_INDEX: Int = 182 + /** * [CheckButton] is a toggle button displayed as a check field. It's similar to [CheckBox] in * functionality, but it has a different appearance. To follow established UX patterns, it's @@ -22,10 +25,10 @@ import kotlin.Unit @GodotBaseType public open class CheckButton : Button() { public override fun new(scriptIndex: Int): Unit { - callConstructor(ENGINECLASS_CHECKBUTTON, scriptIndex) + Internals.callConstructor(this, ENGINE_CLASS_CHECKBUTTON_INDEX, scriptIndex) } public companion object - internal object MethodBindings + public object MethodBindings } diff --git a/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/CircleShape2D.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/CircleShape2D.kt new file mode 100644 index 0000000000..aa4202d330 --- /dev/null +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/CircleShape2D.kt @@ -0,0 +1,66 @@ +// THIS FILE IS GENERATED! DO NOT EDIT IT MANUALLY! +@file:Suppress("PackageDirectoryMismatch", "unused", "FunctionName", "RedundantModalityModifier", + "UNCHECKED_CAST", "JoinDeclarationAndAssignment", "USELESS_CAST", + "RemoveRedundantQualifierName", "NOTHING_TO_INLINE", "NON_FINAL_MEMBER_IN_OBJECT", + "RedundantVisibilityModifier", "RedundantUnitReturnType", "MemberVisibilityCanBePrivate") + +package godot + +import godot.`annotation`.GodotBaseType +import godot.core.VariantParser.DOUBLE +import godot.core.VariantParser.NIL +import godot.util.Internals +import godot.util.VoidPtr +import kotlin.Double +import kotlin.Float +import kotlin.Int +import kotlin.Suppress +import kotlin.Unit +import kotlin.jvm.JvmName + +private const val ENGINE_CLASS_CIRCLESHAPE2D_INDEX: Int = 183 + +/** + * A 2D circle shape, intended for use in physics. Usually used to provide a shape for a + * [CollisionShape2D]. + * **Performance:** [CircleShape2D] is fast to check collisions against. It is faster than + * [RectangleShape2D] and [CapsuleShape2D]. + */ +@GodotBaseType +public open class CircleShape2D : Shape2D() { + /** + * The circle's radius. + */ + public final inline var radius: Float + @JvmName("radiusProperty") + get() = getRadius() + @JvmName("radiusProperty") + set(`value`) { + setRadius(value) + } + + public override fun new(scriptIndex: Int): Unit { + Internals.callConstructor(this, ENGINE_CLASS_CIRCLESHAPE2D_INDEX, scriptIndex) + } + + public final fun setRadius(radius: Float): Unit { + Internals.writeArguments(DOUBLE to radius.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setRadiusPtr, NIL) + } + + public final fun getRadius(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getRadiusPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public companion object + + public object MethodBindings { + internal val setRadiusPtr: VoidPtr = + Internals.getMethodBindPtr("CircleShape2D", "set_radius", 373806689) + + internal val getRadiusPtr: VoidPtr = + Internals.getMethodBindPtr("CircleShape2D", "get_radius", 1740695150) + } +} diff --git a/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/ClassDB.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/ClassDB.kt new file mode 100644 index 0000000000..7372078041 --- /dev/null +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/ClassDB.kt @@ -0,0 +1,440 @@ +// THIS FILE IS GENERATED! DO NOT EDIT IT MANUALLY! +@file:Suppress("PackageDirectoryMismatch", "unused", "FunctionName", "RedundantModalityModifier", + "UNCHECKED_CAST", "JoinDeclarationAndAssignment", "USELESS_CAST", + "RemoveRedundantQualifierName", "NOTHING_TO_INLINE", "NON_FINAL_MEMBER_IN_OBJECT", + "RedundantVisibilityModifier", "RedundantUnitReturnType", "MemberVisibilityCanBePrivate") + +package godot + +import godot.`annotation`.GodotBaseType +import godot.core.Dictionary +import godot.core.PackedStringArray +import godot.core.StringName +import godot.core.VariantArray +import godot.core.VariantCaster.ANY +import godot.core.VariantParser.ARRAY +import godot.core.VariantParser.BOOL +import godot.core.VariantParser.DICTIONARY +import godot.core.VariantParser.LONG +import godot.core.VariantParser.OBJECT +import godot.core.VariantParser.PACKED_STRING_ARRAY +import godot.core.VariantParser.STRING_NAME +import godot.util.Internals +import godot.util.VoidPtr +import kotlin.Any +import kotlin.Boolean +import kotlin.Int +import kotlin.Long +import kotlin.Suppress +import kotlin.Unit +import kotlin.jvm.JvmOverloads +import kotlin.jvm.JvmStatic + +private const val ENGINE_CLASS_CLASSDB_INDEX: Int = 15 + +/** + * Provides access to metadata stored for every available class. + */ +@GodotBaseType +public object ClassDB : Object() { + public override fun new(scriptIndex: Int): Unit { + Internals.getSingleton(this, ENGINE_CLASS_CLASSDB_INDEX) + } + + /** + * Returns the names of all the classes available. + */ + @JvmStatic + public final fun getClassList(): PackedStringArray { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getClassListPtr, PACKED_STRING_ARRAY) + return (Internals.readReturnValue(PACKED_STRING_ARRAY) as PackedStringArray) + } + + /** + * Returns the names of all the classes that directly or indirectly inherit from [class]. + */ + @JvmStatic + public final fun getInheritersFromClass(`class`: StringName): PackedStringArray { + Internals.writeArguments(STRING_NAME to `class`) + Internals.callMethod(rawPtr, MethodBindings.getInheritersFromClassPtr, PACKED_STRING_ARRAY) + return (Internals.readReturnValue(PACKED_STRING_ARRAY) as PackedStringArray) + } + + /** + * Returns the parent class of [class]. + */ + @JvmStatic + public final fun getParentClass(`class`: StringName): StringName { + Internals.writeArguments(STRING_NAME to `class`) + Internals.callMethod(rawPtr, MethodBindings.getParentClassPtr, STRING_NAME) + return (Internals.readReturnValue(STRING_NAME) as StringName) + } + + /** + * Returns whether the specified [class] is available or not. + */ + @JvmStatic + public final fun classExists(`class`: StringName): Boolean { + Internals.writeArguments(STRING_NAME to `class`) + Internals.callMethod(rawPtr, MethodBindings.classExistsPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + /** + * Returns whether [inherits] is an ancestor of [class] or not. + */ + @JvmStatic + public final fun isParentClass(`class`: StringName, inherits: StringName): Boolean { + Internals.writeArguments(STRING_NAME to `class`, STRING_NAME to inherits) + Internals.callMethod(rawPtr, MethodBindings.isParentClassPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + /** + * Returns `true` if objects can be instantiated from the specified [class], otherwise returns + * `false`. + */ + @JvmStatic + public final fun canInstantiate(`class`: StringName): Boolean { + Internals.writeArguments(STRING_NAME to `class`) + Internals.callMethod(rawPtr, MethodBindings.canInstantiatePtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + /** + * Creates an instance of [class]. + */ + @JvmStatic + public final fun instantiate(`class`: StringName): Any? { + Internals.writeArguments(STRING_NAME to `class`) + Internals.callMethod(rawPtr, MethodBindings.instantiatePtr, ANY) + return (Internals.readReturnValue(ANY) as Any?) + } + + /** + * Returns whether [class] or its ancestry has a signal called [signal] or not. + */ + @JvmStatic + public final fun classHasSignal(`class`: StringName, signal: StringName): Boolean { + Internals.writeArguments(STRING_NAME to `class`, STRING_NAME to signal) + Internals.callMethod(rawPtr, MethodBindings.classHasSignalPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + /** + * Returns the [signal] data of [class] or its ancestry. The returned value is a [Dictionary] with + * the following keys: `args`, `default_args`, `flags`, `id`, `name`, `return: (class_name, hint, + * hint_string, name, type, usage)`. + */ + @JvmStatic + public final fun classGetSignal(`class`: StringName, signal: StringName): Dictionary { + Internals.writeArguments(STRING_NAME to `class`, STRING_NAME to signal) + Internals.callMethod(rawPtr, MethodBindings.classGetSignalPtr, DICTIONARY) + return (Internals.readReturnValue(DICTIONARY) as Dictionary) + } + + /** + * Returns an array with all the signals of [class] or its ancestry if [noInheritance] is `false`. + * Every element of the array is a [Dictionary] as described in [classGetSignal]. + */ + @JvmOverloads + @JvmStatic + public final fun classGetSignalList(`class`: StringName, noInheritance: Boolean = false): + VariantArray> { + Internals.writeArguments(STRING_NAME to `class`, BOOL to noInheritance) + Internals.callMethod(rawPtr, MethodBindings.classGetSignalListPtr, ARRAY) + return (Internals.readReturnValue(ARRAY) as VariantArray>) + } + + /** + * Returns an array with all the properties of [class] or its ancestry if [noInheritance] is + * `false`. + */ + @JvmOverloads + @JvmStatic + public final fun classGetPropertyList(`class`: StringName, noInheritance: Boolean = false): + VariantArray> { + Internals.writeArguments(STRING_NAME to `class`, BOOL to noInheritance) + Internals.callMethod(rawPtr, MethodBindings.classGetPropertyListPtr, ARRAY) + return (Internals.readReturnValue(ARRAY) as VariantArray>) + } + + /** + * Returns the value of [property] of [object] or its ancestry. + */ + @JvmStatic + public final fun classGetProperty(`object`: Object?, `property`: StringName): Any? { + Internals.writeArguments(OBJECT to `object`, STRING_NAME to property) + Internals.callMethod(rawPtr, MethodBindings.classGetPropertyPtr, ANY) + return (Internals.readReturnValue(ANY) as Any?) + } + + /** + * Sets [property] value of [object] to [value]. + */ + @JvmStatic + public final fun classSetProperty( + `object`: Object?, + `property`: StringName, + `value`: Any?, + ): Error { + Internals.writeArguments(OBJECT to `object`, STRING_NAME to property, ANY to value) + Internals.callMethod(rawPtr, MethodBindings.classSetPropertyPtr, LONG) + return Error.from(Internals.readReturnValue(LONG) as Long) + } + + /** + * Returns the default value of [property] of [class] or its ancestor classes. + */ + @JvmStatic + public final fun classGetPropertyDefaultValue(`class`: StringName, `property`: StringName): Any? { + Internals.writeArguments(STRING_NAME to `class`, STRING_NAME to property) + Internals.callMethod(rawPtr, MethodBindings.classGetPropertyDefaultValuePtr, ANY) + return (Internals.readReturnValue(ANY) as Any?) + } + + /** + * Returns whether [class] (or its ancestry if [noInheritance] is `false`) has a method called + * [method] or not. + */ + @JvmOverloads + @JvmStatic + public final fun classHasMethod( + `class`: StringName, + method: StringName, + noInheritance: Boolean = false, + ): Boolean { + Internals.writeArguments(STRING_NAME to `class`, STRING_NAME to method, BOOL to noInheritance) + Internals.callMethod(rawPtr, MethodBindings.classHasMethodPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + /** + * Returns the number of arguments of the method [method] of [class] or its ancestry if + * [noInheritance] is `false`. + */ + @JvmOverloads + @JvmStatic + public final fun classGetMethodArgumentCount( + `class`: StringName, + method: StringName, + noInheritance: Boolean = false, + ): Int { + Internals.writeArguments(STRING_NAME to `class`, STRING_NAME to method, BOOL to noInheritance) + Internals.callMethod(rawPtr, MethodBindings.classGetMethodArgumentCountPtr, LONG) + return (Internals.readReturnValue(LONG) as Long).toInt() + } + + /** + * Returns an array with all the methods of [class] or its ancestry if [noInheritance] is `false`. + * Every element of the array is a [Dictionary] with the following keys: `args`, `default_args`, + * `flags`, `id`, `name`, `return: (class_name, hint, hint_string, name, type, usage)`. + * **Note:** In exported release builds the debug info is not available, so the returned + * dictionaries will contain only method names. + */ + @JvmOverloads + @JvmStatic + public final fun classGetMethodList(`class`: StringName, noInheritance: Boolean = false): + VariantArray> { + Internals.writeArguments(STRING_NAME to `class`, BOOL to noInheritance) + Internals.callMethod(rawPtr, MethodBindings.classGetMethodListPtr, ARRAY) + return (Internals.readReturnValue(ARRAY) as VariantArray>) + } + + /** + * Returns an array with the names all the integer constants of [class] or its ancestry. + */ + @JvmOverloads + @JvmStatic + public final fun classGetIntegerConstantList(`class`: StringName, noInheritance: Boolean = false): + PackedStringArray { + Internals.writeArguments(STRING_NAME to `class`, BOOL to noInheritance) + Internals.callMethod(rawPtr, MethodBindings.classGetIntegerConstantListPtr, PACKED_STRING_ARRAY) + return (Internals.readReturnValue(PACKED_STRING_ARRAY) as PackedStringArray) + } + + /** + * Returns whether [class] or its ancestry has an integer constant called [name] or not. + */ + @JvmStatic + public final fun classHasIntegerConstant(`class`: StringName, name: StringName): Boolean { + Internals.writeArguments(STRING_NAME to `class`, STRING_NAME to name) + Internals.callMethod(rawPtr, MethodBindings.classHasIntegerConstantPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + /** + * Returns the value of the integer constant [name] of [class] or its ancestry. Always returns 0 + * when the constant could not be found. + */ + @JvmStatic + public final fun classGetIntegerConstant(`class`: StringName, name: StringName): Long { + Internals.writeArguments(STRING_NAME to `class`, STRING_NAME to name) + Internals.callMethod(rawPtr, MethodBindings.classGetIntegerConstantPtr, LONG) + return (Internals.readReturnValue(LONG) as Long) + } + + /** + * Returns whether [class] or its ancestry has an enum called [name] or not. + */ + @JvmOverloads + @JvmStatic + public final fun classHasEnum( + `class`: StringName, + name: StringName, + noInheritance: Boolean = false, + ): Boolean { + Internals.writeArguments(STRING_NAME to `class`, STRING_NAME to name, BOOL to noInheritance) + Internals.callMethod(rawPtr, MethodBindings.classHasEnumPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + /** + * Returns an array with all the enums of [class] or its ancestry. + */ + @JvmOverloads + @JvmStatic + public final fun classGetEnumList(`class`: StringName, noInheritance: Boolean = false): + PackedStringArray { + Internals.writeArguments(STRING_NAME to `class`, BOOL to noInheritance) + Internals.callMethod(rawPtr, MethodBindings.classGetEnumListPtr, PACKED_STRING_ARRAY) + return (Internals.readReturnValue(PACKED_STRING_ARRAY) as PackedStringArray) + } + + /** + * Returns an array with all the keys in [enum] of [class] or its ancestry. + */ + @JvmOverloads + @JvmStatic + public final fun classGetEnumConstants( + `class`: StringName, + `enum`: StringName, + noInheritance: Boolean = false, + ): PackedStringArray { + Internals.writeArguments(STRING_NAME to `class`, STRING_NAME to `enum`, BOOL to noInheritance) + Internals.callMethod(rawPtr, MethodBindings.classGetEnumConstantsPtr, PACKED_STRING_ARRAY) + return (Internals.readReturnValue(PACKED_STRING_ARRAY) as PackedStringArray) + } + + /** + * Returns which enum the integer constant [name] of [class] or its ancestry belongs to. + */ + @JvmOverloads + @JvmStatic + public final fun classGetIntegerConstantEnum( + `class`: StringName, + name: StringName, + noInheritance: Boolean = false, + ): StringName { + Internals.writeArguments(STRING_NAME to `class`, STRING_NAME to name, BOOL to noInheritance) + Internals.callMethod(rawPtr, MethodBindings.classGetIntegerConstantEnumPtr, STRING_NAME) + return (Internals.readReturnValue(STRING_NAME) as StringName) + } + + /** + * Returns whether [class] (or its ancestor classes if [noInheritance] is `false`) has an enum + * called [enum] that is a bitfield. + */ + @JvmOverloads + @JvmStatic + public final fun isClassEnumBitfield( + `class`: StringName, + `enum`: StringName, + noInheritance: Boolean = false, + ): Boolean { + Internals.writeArguments(STRING_NAME to `class`, STRING_NAME to `enum`, BOOL to noInheritance) + Internals.callMethod(rawPtr, MethodBindings.isClassEnumBitfieldPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + /** + * Returns whether this [class] is enabled or not. + */ + @JvmStatic + public final fun isClassEnabled(`class`: StringName): Boolean { + Internals.writeArguments(STRING_NAME to `class`) + Internals.callMethod(rawPtr, MethodBindings.isClassEnabledPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public object MethodBindings { + internal val getClassListPtr: VoidPtr = + Internals.getMethodBindPtr("ClassDB", "get_class_list", 1139954409) + + internal val getInheritersFromClassPtr: VoidPtr = + Internals.getMethodBindPtr("ClassDB", "get_inheriters_from_class", 1761182771) + + internal val getParentClassPtr: VoidPtr = + Internals.getMethodBindPtr("ClassDB", "get_parent_class", 1965194235) + + internal val classExistsPtr: VoidPtr = + Internals.getMethodBindPtr("ClassDB", "class_exists", 2619796661) + + internal val isParentClassPtr: VoidPtr = + Internals.getMethodBindPtr("ClassDB", "is_parent_class", 471820014) + + internal val canInstantiatePtr: VoidPtr = + Internals.getMethodBindPtr("ClassDB", "can_instantiate", 2619796661) + + internal val instantiatePtr: VoidPtr = + Internals.getMethodBindPtr("ClassDB", "instantiate", 2760726917) + + internal val classHasSignalPtr: VoidPtr = + Internals.getMethodBindPtr("ClassDB", "class_has_signal", 471820014) + + internal val classGetSignalPtr: VoidPtr = + Internals.getMethodBindPtr("ClassDB", "class_get_signal", 3061114238) + + internal val classGetSignalListPtr: VoidPtr = + Internals.getMethodBindPtr("ClassDB", "class_get_signal_list", 3504980660) + + internal val classGetPropertyListPtr: VoidPtr = + Internals.getMethodBindPtr("ClassDB", "class_get_property_list", 3504980660) + + internal val classGetPropertyPtr: VoidPtr = + Internals.getMethodBindPtr("ClassDB", "class_get_property", 2498641674) + + internal val classSetPropertyPtr: VoidPtr = + Internals.getMethodBindPtr("ClassDB", "class_set_property", 1690314931) + + internal val classGetPropertyDefaultValuePtr: VoidPtr = + Internals.getMethodBindPtr("ClassDB", "class_get_property_default_value", 2718203076) + + internal val classHasMethodPtr: VoidPtr = + Internals.getMethodBindPtr("ClassDB", "class_has_method", 3860701026) + + internal val classGetMethodArgumentCountPtr: VoidPtr = + Internals.getMethodBindPtr("ClassDB", "class_get_method_argument_count", 3885694822) + + internal val classGetMethodListPtr: VoidPtr = + Internals.getMethodBindPtr("ClassDB", "class_get_method_list", 3504980660) + + internal val classGetIntegerConstantListPtr: VoidPtr = + Internals.getMethodBindPtr("ClassDB", "class_get_integer_constant_list", 3031669221) + + internal val classHasIntegerConstantPtr: VoidPtr = + Internals.getMethodBindPtr("ClassDB", "class_has_integer_constant", 471820014) + + internal val classGetIntegerConstantPtr: VoidPtr = + Internals.getMethodBindPtr("ClassDB", "class_get_integer_constant", 2419549490) + + internal val classHasEnumPtr: VoidPtr = + Internals.getMethodBindPtr("ClassDB", "class_has_enum", 3860701026) + + internal val classGetEnumListPtr: VoidPtr = + Internals.getMethodBindPtr("ClassDB", "class_get_enum_list", 3031669221) + + internal val classGetEnumConstantsPtr: VoidPtr = + Internals.getMethodBindPtr("ClassDB", "class_get_enum_constants", 661528303) + + internal val classGetIntegerConstantEnumPtr: VoidPtr = + Internals.getMethodBindPtr("ClassDB", "class_get_integer_constant_enum", 2457504236) + + internal val isClassEnumBitfieldPtr: VoidPtr = + Internals.getMethodBindPtr("ClassDB", "is_class_enum_bitfield", 3860701026) + + internal val isClassEnabledPtr: VoidPtr = + Internals.getMethodBindPtr("ClassDB", "is_class_enabled", 2619796661) + } +} diff --git a/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/CodeEdit.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/CodeEdit.kt new file mode 100644 index 0000000000..89d38fbb72 --- /dev/null +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/CodeEdit.kt @@ -0,0 +1,1617 @@ +// THIS FILE IS GENERATED! DO NOT EDIT IT MANUALLY! +@file:Suppress("PackageDirectoryMismatch", "unused", "FunctionName", "RedundantModalityModifier", + "UNCHECKED_CAST", "JoinDeclarationAndAssignment", "USELESS_CAST", + "RemoveRedundantQualifierName", "NOTHING_TO_INLINE", "NON_FINAL_MEMBER_IN_OBJECT", + "RedundantVisibilityModifier", "RedundantUnitReturnType", "MemberVisibilityCanBePrivate") + +package godot + +import godot.`annotation`.GodotBaseType +import godot.core.Color +import godot.core.Dictionary +import godot.core.PackedInt32Array +import godot.core.Signal0 +import godot.core.Signal1 +import godot.core.Signal3 +import godot.core.VariantArray +import godot.core.VariantCaster.ANY +import godot.core.VariantParser.ARRAY +import godot.core.VariantParser.BOOL +import godot.core.VariantParser.COLOR +import godot.core.VariantParser.DICTIONARY +import godot.core.VariantParser.LONG +import godot.core.VariantParser.NIL +import godot.core.VariantParser.OBJECT +import godot.core.VariantParser.PACKED_INT_32_ARRAY +import godot.core.VariantParser.STRING +import godot.core.VariantParser.VECTOR2 +import godot.core.Vector2 +import godot.util.Internals +import godot.util.VoidPtr +import kotlin.Any +import kotlin.Boolean +import kotlin.Int +import kotlin.Long +import kotlin.NotImplementedError +import kotlin.String +import kotlin.Suppress +import kotlin.Unit +import kotlin.jvm.JvmName +import kotlin.jvm.JvmOverloads + +private const val ENGINE_CLASS_CODEEDIT_INDEX: Int = 184 + +/** + * CodeEdit is a specialized [TextEdit] designed for editing plain text code files. It has many + * features commonly found in code editors such as line numbers, line folding, code completion, indent + * management, and string/comment management. + * **Note:** Regardless of locale, [CodeEdit] will by default always use left-to-right text + * direction to correctly display source code. + */ +@GodotBaseType +public open class CodeEdit : TextEdit() { + /** + * Emitted when a breakpoint is added or removed from a line. If the line is moved via backspace a + * removed is emitted at the old line. + */ + public val breakpointToggled: Signal1 by Signal1 + + /** + * Emitted when the user requests code completion. + */ + public val codeCompletionRequested: Signal0 by Signal0 + + /** + * Emitted when the user has clicked on a valid symbol. + */ + public val symbolLookup: Signal3 by Signal3 + + /** + * Emitted when the user hovers over a symbol. The symbol should be validated and responded to, by + * calling [setSymbolLookupWordAsValid]. + */ + public val symbolValidate: Signal1 by Signal1 + + /** + * Set when a validated word from [signal symbol_validate] is clicked, the [signal symbol_lookup] + * should be emitted. + */ + public final inline var symbolLookupOnClick: Boolean + @JvmName("symbolLookupOnClickProperty") + get() = isSymbolLookupOnClickEnabled() + @JvmName("symbolLookupOnClickProperty") + set(`value`) { + setSymbolLookupOnClickEnabled(value) + } + + /** + * Sets whether line folding is allowed. + */ + public final inline var lineFolding: Boolean + @JvmName("lineFoldingProperty") + get() = isLineFoldingEnabled() + @JvmName("lineFoldingProperty") + set(`value`) { + setLineFoldingEnabled(value) + } + + /** + * Draws vertical lines at the provided columns. The first entry is considered a main hard + * guideline and is draw more prominently. + */ + public final inline var lineLengthGuidelines: VariantArray + @JvmName("lineLengthGuidelinesProperty") + get() = getLineLengthGuidelines() + @JvmName("lineLengthGuidelinesProperty") + set(`value`) { + setLineLengthGuidelines(value) + } + + /** + * Sets if breakpoints should be drawn in the gutter. This gutter is shared with bookmarks and + * executing lines. + */ + public final inline var guttersDrawBreakpointsGutter: Boolean + @JvmName("guttersDrawBreakpointsGutterProperty") + get() = isDrawingBreakpointsGutter() + @JvmName("guttersDrawBreakpointsGutterProperty") + set(`value`) { + setDrawBreakpointsGutter(value) + } + + /** + * Sets if bookmarked should be drawn in the gutter. This gutter is shared with breakpoints and + * executing lines. + */ + public final inline var guttersDrawBookmarks: Boolean + @JvmName("guttersDrawBookmarksProperty") + get() = isDrawingBookmarksGutter() + @JvmName("guttersDrawBookmarksProperty") + set(`value`) { + setDrawBookmarksGutter(value) + } + + /** + * Sets if executing lines should be marked in the gutter. This gutter is shared with breakpoints + * and bookmarks lines. + */ + public final inline var guttersDrawExecutingLines: Boolean + @JvmName("guttersDrawExecutingLinesProperty") + get() = isDrawingExecutingLinesGutter() + @JvmName("guttersDrawExecutingLinesProperty") + set(`value`) { + setDrawExecutingLinesGutter(value) + } + + /** + * Sets if line numbers should be drawn in the gutter. + */ + public final inline var guttersDrawLineNumbers: Boolean + @JvmName("guttersDrawLineNumbersProperty") + get() = isDrawLineNumbersEnabled() + @JvmName("guttersDrawLineNumbersProperty") + set(`value`) { + setDrawLineNumbers(value) + } + + /** + * Sets if line numbers drawn in the gutter are zero padded. + */ + public final inline var guttersZeroPadLineNumbers: Boolean + @JvmName("guttersZeroPadLineNumbersProperty") + get() = isLineNumbersZeroPadded() + @JvmName("guttersZeroPadLineNumbersProperty") + set(`value`) { + setLineNumbersZeroPadded(value) + } + + /** + * Sets if foldable lines icons should be drawn in the gutter. + */ + public final inline var guttersDrawFoldGutter: Boolean + @JvmName("guttersDrawFoldGutterProperty") + get() = isDrawingFoldGutter() + @JvmName("guttersDrawFoldGutterProperty") + set(`value`) { + setDrawFoldGutter(value) + } + + /** + * Sets the string delimiters. All existing string delimiters will be removed. + */ + public final inline var delimiterStrings: VariantArray + @JvmName("delimiterStringsProperty") + get() = getStringDelimiters() + @JvmName("delimiterStringsProperty") + set(`value`) { + setStringDelimiters(value) + } + + /** + * Sets the comment delimiters. All existing comment delimiters will be removed. + */ + public final inline var delimiterComments: VariantArray + @JvmName("delimiterCommentsProperty") + get() = getCommentDelimiters() + @JvmName("delimiterCommentsProperty") + set(`value`) { + setCommentDelimiters(value) + } + + /** + * Sets whether code completion is allowed. + */ + public final inline var codeCompletionEnabled: Boolean + @JvmName("codeCompletionEnabledProperty") + get() = isCodeCompletionEnabled() + @JvmName("codeCompletionEnabledProperty") + set(`value`) { + setCodeCompletionEnabled(value) + } + + /** + * Sets prefixes that will trigger code completion. + */ + public final inline var codeCompletionPrefixes: VariantArray + @JvmName("codeCompletionPrefixesProperty") + get() = getCodeCompletionPrefixes() + @JvmName("codeCompletionPrefixesProperty") + set(`value`) { + setCodeCompletionPrefixes(value) + } + + /** + * Size of the tabulation indent (one [kbd]Tab[/kbd] press) in characters. If [indentUseSpaces] is + * enabled the number of spaces to use. + */ + public final inline var indentSize: Int + @JvmName("indentSizeProperty") + get() = getIndentSize() + @JvmName("indentSizeProperty") + set(`value`) { + setIndentSize(value) + } + + /** + * Use spaces instead of tabs for indentation. + */ + public final inline var indentUseSpaces: Boolean + @JvmName("indentUseSpacesProperty") + get() = isIndentUsingSpaces() + @JvmName("indentUseSpacesProperty") + set(`value`) { + setIndentUsingSpaces(value) + } + + /** + * Sets whether automatic indent are enabled, this will add an extra indent if a prefix or brace + * is found. + */ + public final inline var indentAutomatic: Boolean + @JvmName("indentAutomaticProperty") + get() = isAutoIndentEnabled() + @JvmName("indentAutomaticProperty") + set(`value`) { + setAutoIndentEnabled(value) + } + + /** + * Prefixes to trigger an automatic indent. + */ + public final inline var indentAutomaticPrefixes: VariantArray + @JvmName("indentAutomaticPrefixesProperty") + get() = getAutoIndentPrefixes() + @JvmName("indentAutomaticPrefixesProperty") + set(`value`) { + setAutoIndentPrefixes(value) + } + + /** + * Sets whether brace pairs should be autocompleted. + */ + public final inline var autoBraceCompletionEnabled: Boolean + @JvmName("autoBraceCompletionEnabledProperty") + get() = isAutoBraceCompletionEnabled() + @JvmName("autoBraceCompletionEnabledProperty") + set(`value`) { + setAutoBraceCompletionEnabled(value) + } + + /** + * Highlight mismatching brace pairs. + */ + public final inline var autoBraceCompletionHighlightMatching: Boolean + @JvmName("autoBraceCompletionHighlightMatchingProperty") + get() = isHighlightMatchingBracesEnabled() + @JvmName("autoBraceCompletionHighlightMatchingProperty") + set(`value`) { + setHighlightMatchingBracesEnabled(value) + } + + /** + * Sets the brace pairs to be autocompleted. + */ + public final inline var autoBraceCompletionPairs: Dictionary + @JvmName("autoBraceCompletionPairsProperty") + get() = getAutoBraceCompletionPairs() + @JvmName("autoBraceCompletionPairsProperty") + set(`value`) { + setAutoBraceCompletionPairs(value) + } + + public override fun new(scriptIndex: Int): Unit { + Internals.callConstructor(this, ENGINE_CLASS_CODEEDIT_INDEX, scriptIndex) + } + + /** + * Override this method to define how the selected entry should be inserted. If [replace] is + * `true`, any existing text should be replaced. + */ + public open fun _confirmCodeCompletion(replace: Boolean): Unit { + } + + /** + * Override this method to define what happens when the user requests code completion. If [force] + * is `true`, any checks should be bypassed. + */ + public open fun _requestCodeCompletion(force: Boolean): Unit { + } + + /** + * Override this method to define what items in [candidates] should be displayed. + * Both [candidates] and the return is a [Array] of [Dictionary], see [getCodeCompletionOption] + * for [Dictionary] content. + */ + public open fun _filterCodeCompletionCandidates(candidates: VariantArray>): + VariantArray> { + throw NotImplementedError("_filter_code_completion_candidates is not implemented for CodeEdit") + } + + public final fun setIndentSize(size: Int): Unit { + Internals.writeArguments(LONG to size.toLong()) + Internals.callMethod(rawPtr, MethodBindings.setIndentSizePtr, NIL) + } + + public final fun getIndentSize(): Int { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getIndentSizePtr, LONG) + return (Internals.readReturnValue(LONG) as Long).toInt() + } + + public final fun setIndentUsingSpaces(useSpaces: Boolean): Unit { + Internals.writeArguments(BOOL to useSpaces) + Internals.callMethod(rawPtr, MethodBindings.setIndentUsingSpacesPtr, NIL) + } + + public final fun isIndentUsingSpaces(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isIndentUsingSpacesPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public final fun setAutoIndentEnabled(enable: Boolean): Unit { + Internals.writeArguments(BOOL to enable) + Internals.callMethod(rawPtr, MethodBindings.setAutoIndentEnabledPtr, NIL) + } + + public final fun isAutoIndentEnabled(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isAutoIndentEnabledPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public final fun setAutoIndentPrefixes(prefixes: VariantArray): Unit { + Internals.writeArguments(ARRAY to prefixes) + Internals.callMethod(rawPtr, MethodBindings.setAutoIndentPrefixesPtr, NIL) + } + + public final fun getAutoIndentPrefixes(): VariantArray { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getAutoIndentPrefixesPtr, ARRAY) + return (Internals.readReturnValue(ARRAY) as VariantArray) + } + + /** + * Perform an indent as if the user activated the "ui_text_indent" action. + */ + public final fun doIndent(): Unit { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.doIndentPtr, NIL) + } + + /** + * Indents selected lines, or in the case of no selection the caret line by one. + */ + public final fun indentLines(): Unit { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.indentLinesPtr, NIL) + } + + /** + * Unindents selected lines, or in the case of no selection the caret line by one. Same as + * performing "ui_text_unindent" action. + */ + public final fun unindentLines(): Unit { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.unindentLinesPtr, NIL) + } + + /** + * Converts the indents of lines between [fromLine] and [toLine] to tabs or spaces as set by + * [indentUseSpaces]. + * Values of `-1` convert the entire text. + */ + @JvmOverloads + public final fun convertIndent(fromLine: Int = -1, toLine: Int = -1): Unit { + Internals.writeArguments(LONG to fromLine.toLong(), LONG to toLine.toLong()) + Internals.callMethod(rawPtr, MethodBindings.convertIndentPtr, NIL) + } + + public final fun setAutoBraceCompletionEnabled(enable: Boolean): Unit { + Internals.writeArguments(BOOL to enable) + Internals.callMethod(rawPtr, MethodBindings.setAutoBraceCompletionEnabledPtr, NIL) + } + + public final fun isAutoBraceCompletionEnabled(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isAutoBraceCompletionEnabledPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public final fun setHighlightMatchingBracesEnabled(enable: Boolean): Unit { + Internals.writeArguments(BOOL to enable) + Internals.callMethod(rawPtr, MethodBindings.setHighlightMatchingBracesEnabledPtr, NIL) + } + + public final fun isHighlightMatchingBracesEnabled(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isHighlightMatchingBracesEnabledPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + /** + * Adds a brace pair. + * Both the start and end keys must be symbols. Only the start key has to be unique. + */ + public final fun addAutoBraceCompletionPair(startKey: String, endKey: String): Unit { + Internals.writeArguments(STRING to startKey, STRING to endKey) + Internals.callMethod(rawPtr, MethodBindings.addAutoBraceCompletionPairPtr, NIL) + } + + public final fun setAutoBraceCompletionPairs(pairs: Dictionary): Unit { + Internals.writeArguments(DICTIONARY to pairs) + Internals.callMethod(rawPtr, MethodBindings.setAutoBraceCompletionPairsPtr, NIL) + } + + public final fun getAutoBraceCompletionPairs(): Dictionary { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getAutoBraceCompletionPairsPtr, DICTIONARY) + return (Internals.readReturnValue(DICTIONARY) as Dictionary) + } + + /** + * Returns `true` if open key [openKey] exists. + */ + public final fun hasAutoBraceCompletionOpenKey(openKey: String): Boolean { + Internals.writeArguments(STRING to openKey) + Internals.callMethod(rawPtr, MethodBindings.hasAutoBraceCompletionOpenKeyPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + /** + * Returns `true` if close key [closeKey] exists. + */ + public final fun hasAutoBraceCompletionCloseKey(closeKey: String): Boolean { + Internals.writeArguments(STRING to closeKey) + Internals.callMethod(rawPtr, MethodBindings.hasAutoBraceCompletionCloseKeyPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + /** + * Gets the matching auto brace close key for [openKey]. + */ + public final fun getAutoBraceCompletionCloseKey(openKey: String): String { + Internals.writeArguments(STRING to openKey) + Internals.callMethod(rawPtr, MethodBindings.getAutoBraceCompletionCloseKeyPtr, STRING) + return (Internals.readReturnValue(STRING) as String) + } + + public final fun setDrawBreakpointsGutter(enable: Boolean): Unit { + Internals.writeArguments(BOOL to enable) + Internals.callMethod(rawPtr, MethodBindings.setDrawBreakpointsGutterPtr, NIL) + } + + public final fun isDrawingBreakpointsGutter(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isDrawingBreakpointsGutterPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public final fun setDrawBookmarksGutter(enable: Boolean): Unit { + Internals.writeArguments(BOOL to enable) + Internals.callMethod(rawPtr, MethodBindings.setDrawBookmarksGutterPtr, NIL) + } + + public final fun isDrawingBookmarksGutter(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isDrawingBookmarksGutterPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public final fun setDrawExecutingLinesGutter(enable: Boolean): Unit { + Internals.writeArguments(BOOL to enable) + Internals.callMethod(rawPtr, MethodBindings.setDrawExecutingLinesGutterPtr, NIL) + } + + public final fun isDrawingExecutingLinesGutter(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isDrawingExecutingLinesGutterPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + /** + * Sets the line as breakpointed. + */ + public final fun setLineAsBreakpoint(line: Int, breakpointed: Boolean): Unit { + Internals.writeArguments(LONG to line.toLong(), BOOL to breakpointed) + Internals.callMethod(rawPtr, MethodBindings.setLineAsBreakpointPtr, NIL) + } + + /** + * Returns whether the line at the specified index is breakpointed or not. + */ + public final fun isLineBreakpointed(line: Int): Boolean { + Internals.writeArguments(LONG to line.toLong()) + Internals.callMethod(rawPtr, MethodBindings.isLineBreakpointedPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + /** + * Clears all breakpointed lines. + */ + public final fun clearBreakpointedLines(): Unit { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.clearBreakpointedLinesPtr, NIL) + } + + /** + * Gets all breakpointed lines. + */ + public final fun getBreakpointedLines(): PackedInt32Array { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getBreakpointedLinesPtr, PACKED_INT_32_ARRAY) + return (Internals.readReturnValue(PACKED_INT_32_ARRAY) as PackedInt32Array) + } + + /** + * Sets the line as bookmarked. + */ + public final fun setLineAsBookmarked(line: Int, bookmarked: Boolean): Unit { + Internals.writeArguments(LONG to line.toLong(), BOOL to bookmarked) + Internals.callMethod(rawPtr, MethodBindings.setLineAsBookmarkedPtr, NIL) + } + + /** + * Returns whether the line at the specified index is bookmarked or not. + */ + public final fun isLineBookmarked(line: Int): Boolean { + Internals.writeArguments(LONG to line.toLong()) + Internals.callMethod(rawPtr, MethodBindings.isLineBookmarkedPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + /** + * Clears all bookmarked lines. + */ + public final fun clearBookmarkedLines(): Unit { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.clearBookmarkedLinesPtr, NIL) + } + + /** + * Gets all bookmarked lines. + */ + public final fun getBookmarkedLines(): PackedInt32Array { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getBookmarkedLinesPtr, PACKED_INT_32_ARRAY) + return (Internals.readReturnValue(PACKED_INT_32_ARRAY) as PackedInt32Array) + } + + /** + * Sets the line as executing. + */ + public final fun setLineAsExecuting(line: Int, executing: Boolean): Unit { + Internals.writeArguments(LONG to line.toLong(), BOOL to executing) + Internals.callMethod(rawPtr, MethodBindings.setLineAsExecutingPtr, NIL) + } + + /** + * Returns whether the line at the specified index is marked as executing or not. + */ + public final fun isLineExecuting(line: Int): Boolean { + Internals.writeArguments(LONG to line.toLong()) + Internals.callMethod(rawPtr, MethodBindings.isLineExecutingPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + /** + * Clears all executed lines. + */ + public final fun clearExecutingLines(): Unit { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.clearExecutingLinesPtr, NIL) + } + + /** + * Gets all executing lines. + */ + public final fun getExecutingLines(): PackedInt32Array { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getExecutingLinesPtr, PACKED_INT_32_ARRAY) + return (Internals.readReturnValue(PACKED_INT_32_ARRAY) as PackedInt32Array) + } + + public final fun setDrawLineNumbers(enable: Boolean): Unit { + Internals.writeArguments(BOOL to enable) + Internals.callMethod(rawPtr, MethodBindings.setDrawLineNumbersPtr, NIL) + } + + public final fun isDrawLineNumbersEnabled(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isDrawLineNumbersEnabledPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public final fun setLineNumbersZeroPadded(enable: Boolean): Unit { + Internals.writeArguments(BOOL to enable) + Internals.callMethod(rawPtr, MethodBindings.setLineNumbersZeroPaddedPtr, NIL) + } + + public final fun isLineNumbersZeroPadded(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isLineNumbersZeroPaddedPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public final fun setDrawFoldGutter(enable: Boolean): Unit { + Internals.writeArguments(BOOL to enable) + Internals.callMethod(rawPtr, MethodBindings.setDrawFoldGutterPtr, NIL) + } + + public final fun isDrawingFoldGutter(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isDrawingFoldGutterPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public final fun setLineFoldingEnabled(enabled: Boolean): Unit { + Internals.writeArguments(BOOL to enabled) + Internals.callMethod(rawPtr, MethodBindings.setLineFoldingEnabledPtr, NIL) + } + + public final fun isLineFoldingEnabled(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isLineFoldingEnabledPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + /** + * Returns if the given line is foldable, that is, it has indented lines right below it or a + * comment / string block. + */ + public final fun canFoldLine(line: Int): Boolean { + Internals.writeArguments(LONG to line.toLong()) + Internals.callMethod(rawPtr, MethodBindings.canFoldLinePtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + /** + * Folds the given line, if possible (see [canFoldLine]). + */ + public final fun foldLine(line: Int): Unit { + Internals.writeArguments(LONG to line.toLong()) + Internals.callMethod(rawPtr, MethodBindings.foldLinePtr, NIL) + } + + /** + * Unfolds all lines that were previously folded. + */ + public final fun unfoldLine(line: Int): Unit { + Internals.writeArguments(LONG to line.toLong()) + Internals.callMethod(rawPtr, MethodBindings.unfoldLinePtr, NIL) + } + + /** + * Folds all lines that are possible to be folded (see [canFoldLine]). + */ + public final fun foldAllLines(): Unit { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.foldAllLinesPtr, NIL) + } + + /** + * Unfolds all lines, folded or not. + */ + public final fun unfoldAllLines(): Unit { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.unfoldAllLinesPtr, NIL) + } + + /** + * Toggle the folding of the code block at the given line. + */ + public final fun toggleFoldableLine(line: Int): Unit { + Internals.writeArguments(LONG to line.toLong()) + Internals.callMethod(rawPtr, MethodBindings.toggleFoldableLinePtr, NIL) + } + + /** + * Toggle the folding of the code block on all lines with a caret on them. + */ + public final fun toggleFoldableLinesAtCarets(): Unit { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.toggleFoldableLinesAtCaretsPtr, NIL) + } + + /** + * Returns whether the line at the specified index is folded or not. + */ + public final fun isLineFolded(line: Int): Boolean { + Internals.writeArguments(LONG to line.toLong()) + Internals.callMethod(rawPtr, MethodBindings.isLineFoldedPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + /** + * Returns all lines that are current folded. + */ + public final fun getFoldedLines(): VariantArray { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getFoldedLinesPtr, ARRAY) + return (Internals.readReturnValue(ARRAY) as VariantArray) + } + + /** + * Creates a new code region with the selection. At least one single line comment delimiter have + * to be defined (see [addCommentDelimiter]). + * A code region is a part of code that is highlighted when folded and can help organize your + * script. + * Code region start and end tags can be customized (see [setCodeRegionTags]). + * Code regions are delimited using start and end tags (respectively `region` and `endregion` by + * default) preceded by one line comment delimiter. (eg. `#region` and `#endregion`) + */ + public final fun createCodeRegion(): Unit { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.createCodeRegionPtr, NIL) + } + + /** + * Returns the code region start tag (without comment delimiter). + */ + public final fun getCodeRegionStartTag(): String { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getCodeRegionStartTagPtr, STRING) + return (Internals.readReturnValue(STRING) as String) + } + + /** + * Returns the code region end tag (without comment delimiter). + */ + public final fun getCodeRegionEndTag(): String { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getCodeRegionEndTagPtr, STRING) + return (Internals.readReturnValue(STRING) as String) + } + + /** + * Sets the code region start and end tags (without comment delimiter). + */ + @JvmOverloads + public final fun setCodeRegionTags(start: String = "region", end: String = "endregion"): Unit { + Internals.writeArguments(STRING to start, STRING to end) + Internals.callMethod(rawPtr, MethodBindings.setCodeRegionTagsPtr, NIL) + } + + /** + * Returns whether the line at the specified index is a code region start. + */ + public final fun isLineCodeRegionStart(line: Int): Boolean { + Internals.writeArguments(LONG to line.toLong()) + Internals.callMethod(rawPtr, MethodBindings.isLineCodeRegionStartPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + /** + * Returns whether the line at the specified index is a code region end. + */ + public final fun isLineCodeRegionEnd(line: Int): Boolean { + Internals.writeArguments(LONG to line.toLong()) + Internals.callMethod(rawPtr, MethodBindings.isLineCodeRegionEndPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + /** + * Defines a string delimiter from [startKey] to [endKey]. Both keys should be symbols, and + * [startKey] must not be shared with other delimiters. + * If [lineOnly] is `true` or [endKey] is an empty [String], the region does not carry over to the + * next line. + */ + @JvmOverloads + public final fun addStringDelimiter( + startKey: String, + endKey: String, + lineOnly: Boolean = false, + ): Unit { + Internals.writeArguments(STRING to startKey, STRING to endKey, BOOL to lineOnly) + Internals.callMethod(rawPtr, MethodBindings.addStringDelimiterPtr, NIL) + } + + /** + * Removes the string delimiter with [startKey]. + */ + public final fun removeStringDelimiter(startKey: String): Unit { + Internals.writeArguments(STRING to startKey) + Internals.callMethod(rawPtr, MethodBindings.removeStringDelimiterPtr, NIL) + } + + /** + * Returns `true` if string [startKey] exists. + */ + public final fun hasStringDelimiter(startKey: String): Boolean { + Internals.writeArguments(STRING to startKey) + Internals.callMethod(rawPtr, MethodBindings.hasStringDelimiterPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public final fun setStringDelimiters(stringDelimiters: VariantArray): Unit { + Internals.writeArguments(ARRAY to stringDelimiters) + Internals.callMethod(rawPtr, MethodBindings.setStringDelimitersPtr, NIL) + } + + /** + * Removes all string delimiters. + */ + public final fun clearStringDelimiters(): Unit { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.clearStringDelimitersPtr, NIL) + } + + public final fun getStringDelimiters(): VariantArray { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getStringDelimitersPtr, ARRAY) + return (Internals.readReturnValue(ARRAY) as VariantArray) + } + + /** + * Returns the delimiter index if [line] [column] is in a string. If [column] is not provided, + * will return the delimiter index if the entire [line] is a string. Otherwise `-1`. + */ + @JvmOverloads + public final fun isInString(line: Int, column: Int = -1): Int { + Internals.writeArguments(LONG to line.toLong(), LONG to column.toLong()) + Internals.callMethod(rawPtr, MethodBindings.isInStringPtr, LONG) + return (Internals.readReturnValue(LONG) as Long).toInt() + } + + /** + * Adds a comment delimiter from [startKey] to [endKey]. Both keys should be symbols, and + * [startKey] must not be shared with other delimiters. + * If [lineOnly] is `true` or [endKey] is an empty [String], the region does not carry over to the + * next line. + */ + @JvmOverloads + public final fun addCommentDelimiter( + startKey: String, + endKey: String, + lineOnly: Boolean = false, + ): Unit { + Internals.writeArguments(STRING to startKey, STRING to endKey, BOOL to lineOnly) + Internals.callMethod(rawPtr, MethodBindings.addCommentDelimiterPtr, NIL) + } + + /** + * Removes the comment delimiter with [startKey]. + */ + public final fun removeCommentDelimiter(startKey: String): Unit { + Internals.writeArguments(STRING to startKey) + Internals.callMethod(rawPtr, MethodBindings.removeCommentDelimiterPtr, NIL) + } + + /** + * Returns `true` if comment [startKey] exists. + */ + public final fun hasCommentDelimiter(startKey: String): Boolean { + Internals.writeArguments(STRING to startKey) + Internals.callMethod(rawPtr, MethodBindings.hasCommentDelimiterPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public final fun setCommentDelimiters(commentDelimiters: VariantArray): Unit { + Internals.writeArguments(ARRAY to commentDelimiters) + Internals.callMethod(rawPtr, MethodBindings.setCommentDelimitersPtr, NIL) + } + + /** + * Removes all comment delimiters. + */ + public final fun clearCommentDelimiters(): Unit { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.clearCommentDelimitersPtr, NIL) + } + + public final fun getCommentDelimiters(): VariantArray { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getCommentDelimitersPtr, ARRAY) + return (Internals.readReturnValue(ARRAY) as VariantArray) + } + + /** + * Returns delimiter index if [line] [column] is in a comment. If [column] is not provided, will + * return delimiter index if the entire [line] is a comment. Otherwise `-1`. + */ + @JvmOverloads + public final fun isInComment(line: Int, column: Int = -1): Int { + Internals.writeArguments(LONG to line.toLong(), LONG to column.toLong()) + Internals.callMethod(rawPtr, MethodBindings.isInCommentPtr, LONG) + return (Internals.readReturnValue(LONG) as Long).toInt() + } + + /** + * Gets the start key for a string or comment region index. + */ + public final fun getDelimiterStartKey(delimiterIndex: Int): String { + Internals.writeArguments(LONG to delimiterIndex.toLong()) + Internals.callMethod(rawPtr, MethodBindings.getDelimiterStartKeyPtr, STRING) + return (Internals.readReturnValue(STRING) as String) + } + + /** + * Gets the end key for a string or comment region index. + */ + public final fun getDelimiterEndKey(delimiterIndex: Int): String { + Internals.writeArguments(LONG to delimiterIndex.toLong()) + Internals.callMethod(rawPtr, MethodBindings.getDelimiterEndKeyPtr, STRING) + return (Internals.readReturnValue(STRING) as String) + } + + /** + * If [line] [column] is in a string or comment, returns the start position of the region. If not + * or no start could be found, both [Vector2] values will be `-1`. + */ + public final fun getDelimiterStartPosition(line: Int, column: Int): Vector2 { + Internals.writeArguments(LONG to line.toLong(), LONG to column.toLong()) + Internals.callMethod(rawPtr, MethodBindings.getDelimiterStartPositionPtr, VECTOR2) + return (Internals.readReturnValue(VECTOR2) as Vector2) + } + + /** + * If [line] [column] is in a string or comment, returns the end position of the region. If not or + * no end could be found, both [Vector2] values will be `-1`. + */ + public final fun getDelimiterEndPosition(line: Int, column: Int): Vector2 { + Internals.writeArguments(LONG to line.toLong(), LONG to column.toLong()) + Internals.callMethod(rawPtr, MethodBindings.getDelimiterEndPositionPtr, VECTOR2) + return (Internals.readReturnValue(VECTOR2) as Vector2) + } + + /** + * Sets the code hint text. Pass an empty string to clear. + */ + public final fun setCodeHint(codeHint: String): Unit { + Internals.writeArguments(STRING to codeHint) + Internals.callMethod(rawPtr, MethodBindings.setCodeHintPtr, NIL) + } + + /** + * Sets if the code hint should draw below the text. + */ + public final fun setCodeHintDrawBelow(drawBelow: Boolean): Unit { + Internals.writeArguments(BOOL to drawBelow) + Internals.callMethod(rawPtr, MethodBindings.setCodeHintDrawBelowPtr, NIL) + } + + /** + * Returns the full text with char `0xFFFF` at the caret location. + */ + public final fun getTextForCodeCompletion(): String { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getTextForCodeCompletionPtr, STRING) + return (Internals.readReturnValue(STRING) as String) + } + + /** + * Emits [signal code_completion_requested], if [force] is `true` will bypass all checks. + * Otherwise will check that the caret is in a word or in front of a prefix. Will ignore the request + * if all current options are of type file path, node path, or signal. + */ + @JvmOverloads + public final fun requestCodeCompletion(force: Boolean = false): Unit { + Internals.writeArguments(BOOL to force) + Internals.callMethod(rawPtr, MethodBindings.requestCodeCompletionPtr, NIL) + } + + /** + * Submits an item to the queue of potential candidates for the autocomplete menu. Call + * [updateCodeCompletionOptions] to update the list. + * [location] indicates location of the option relative to the location of the code completion + * query. See [CodeEdit.CodeCompletionLocation] for how to set this value. + * **Note:** This list will replace all current candidates. + */ + @JvmOverloads + public final fun addCodeCompletionOption( + type: CodeCompletionKind, + displayText: String, + insertText: String, + textColor: Color = Color(Color(1, 1, 1, 1)), + icon: Resource? = null, + `value`: Any? = null, + location: Int = 1024, + ): Unit { + Internals.writeArguments(LONG to type.id, STRING to displayText, STRING to insertText, COLOR to textColor, OBJECT to icon, ANY to value, LONG to location.toLong()) + Internals.callMethod(rawPtr, MethodBindings.addCodeCompletionOptionPtr, NIL) + } + + /** + * Submits all completion options added with [addCodeCompletionOption]. Will try to force the + * autocomplete menu to popup, if [force] is `true`. + * **Note:** This will replace all current candidates. + */ + public final fun updateCodeCompletionOptions(force: Boolean): Unit { + Internals.writeArguments(BOOL to force) + Internals.callMethod(rawPtr, MethodBindings.updateCodeCompletionOptionsPtr, NIL) + } + + /** + * Gets all completion options, see [getCodeCompletionOption] for return content. + */ + public final fun getCodeCompletionOptions(): VariantArray> { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getCodeCompletionOptionsPtr, ARRAY) + return (Internals.readReturnValue(ARRAY) as VariantArray>) + } + + /** + * Gets the completion option at [index]. The return [Dictionary] has the following key-values: + * `kind`: [CodeCompletionKind] + * `display_text`: Text that is shown on the autocomplete menu. + * `insert_text`: Text that is to be inserted when this item is selected. + * `font_color`: Color of the text on the autocomplete menu. + * `icon`: Icon to draw on the autocomplete menu. + * `default_value`: Value of the symbol. + */ + public final fun getCodeCompletionOption(index: Int): Dictionary { + Internals.writeArguments(LONG to index.toLong()) + Internals.callMethod(rawPtr, MethodBindings.getCodeCompletionOptionPtr, DICTIONARY) + return (Internals.readReturnValue(DICTIONARY) as Dictionary) + } + + /** + * Gets the index of the current selected completion option. + */ + public final fun getCodeCompletionSelectedIndex(): Int { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getCodeCompletionSelectedIndexPtr, LONG) + return (Internals.readReturnValue(LONG) as Long).toInt() + } + + /** + * Sets the current selected completion option. + */ + public final fun setCodeCompletionSelectedIndex(index: Int): Unit { + Internals.writeArguments(LONG to index.toLong()) + Internals.callMethod(rawPtr, MethodBindings.setCodeCompletionSelectedIndexPtr, NIL) + } + + /** + * Inserts the selected entry into the text. If [replace] is `true`, any existing text is replaced + * rather than merged. + */ + @JvmOverloads + public final fun confirmCodeCompletion(replace: Boolean = false): Unit { + Internals.writeArguments(BOOL to replace) + Internals.callMethod(rawPtr, MethodBindings.confirmCodeCompletionPtr, NIL) + } + + /** + * Cancels the autocomplete menu. + */ + public final fun cancelCodeCompletion(): Unit { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.cancelCodeCompletionPtr, NIL) + } + + public final fun setCodeCompletionEnabled(enable: Boolean): Unit { + Internals.writeArguments(BOOL to enable) + Internals.callMethod(rawPtr, MethodBindings.setCodeCompletionEnabledPtr, NIL) + } + + public final fun isCodeCompletionEnabled(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isCodeCompletionEnabledPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public final fun setCodeCompletionPrefixes(prefixes: VariantArray): Unit { + Internals.writeArguments(ARRAY to prefixes) + Internals.callMethod(rawPtr, MethodBindings.setCodeCompletionPrefixesPtr, NIL) + } + + public final fun getCodeCompletionPrefixes(): VariantArray { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getCodeCompletionPrefixesPtr, ARRAY) + return (Internals.readReturnValue(ARRAY) as VariantArray) + } + + public final fun setLineLengthGuidelines(guidelineColumns: VariantArray): Unit { + Internals.writeArguments(ARRAY to guidelineColumns) + Internals.callMethod(rawPtr, MethodBindings.setLineLengthGuidelinesPtr, NIL) + } + + public final fun getLineLengthGuidelines(): VariantArray { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getLineLengthGuidelinesPtr, ARRAY) + return (Internals.readReturnValue(ARRAY) as VariantArray) + } + + public final fun setSymbolLookupOnClickEnabled(enable: Boolean): Unit { + Internals.writeArguments(BOOL to enable) + Internals.callMethod(rawPtr, MethodBindings.setSymbolLookupOnClickEnabledPtr, NIL) + } + + public final fun isSymbolLookupOnClickEnabled(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isSymbolLookupOnClickEnabledPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + /** + * Returns the full text with char `0xFFFF` at the cursor location. + */ + public final fun getTextForSymbolLookup(): String { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getTextForSymbolLookupPtr, STRING) + return (Internals.readReturnValue(STRING) as String) + } + + /** + * Returns the full text with char `0xFFFF` at the specified location. + */ + public final fun getTextWithCursorChar(line: Int, column: Int): String { + Internals.writeArguments(LONG to line.toLong(), LONG to column.toLong()) + Internals.callMethod(rawPtr, MethodBindings.getTextWithCursorCharPtr, STRING) + return (Internals.readReturnValue(STRING) as String) + } + + /** + * Sets the symbol emitted by [signal symbol_validate] as a valid lookup. + */ + public final fun setSymbolLookupWordAsValid(valid: Boolean): Unit { + Internals.writeArguments(BOOL to valid) + Internals.callMethod(rawPtr, MethodBindings.setSymbolLookupWordAsValidPtr, NIL) + } + + /** + * Moves all lines up that are selected or have a caret on them. + */ + public final fun moveLinesUp(): Unit { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.moveLinesUpPtr, NIL) + } + + /** + * Moves all lines down that are selected or have a caret on them. + */ + public final fun moveLinesDown(): Unit { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.moveLinesDownPtr, NIL) + } + + /** + * Deletes all lines that are selected or have a caret on them. + */ + public final fun deleteLines(): Unit { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.deleteLinesPtr, NIL) + } + + /** + * Duplicates all selected text and duplicates all lines with a caret on them. + */ + public final fun duplicateSelection(): Unit { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.duplicateSelectionPtr, NIL) + } + + /** + * Duplicates all lines currently selected with any caret. Duplicates the entire line beneath the + * current one no matter where the caret is within the line. + */ + public final fun duplicateLines(): Unit { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.duplicateLinesPtr, NIL) + } + + public enum class CodeCompletionKind( + id: Long, + ) { + /** + * Marks the option as a class. + */ + KIND_CLASS(0), + /** + * Marks the option as a function. + */ + KIND_FUNCTION(1), + /** + * Marks the option as a Godot signal. + */ + KIND_SIGNAL(2), + /** + * Marks the option as a variable. + */ + KIND_VARIABLE(3), + /** + * Marks the option as a member. + */ + KIND_MEMBER(4), + /** + * Marks the option as an enum entry. + */ + KIND_ENUM(5), + /** + * Marks the option as a constant. + */ + KIND_CONSTANT(6), + /** + * Marks the option as a Godot node path. + */ + KIND_NODE_PATH(7), + /** + * Marks the option as a file path. + */ + KIND_FILE_PATH(8), + /** + * Marks the option as unclassified or plain text. + */ + KIND_PLAIN_TEXT(9), + ; + + public val id: Long + init { + this.id = id + } + + public companion object { + public fun from(`value`: Long): CodeCompletionKind = entries.single { it.id == `value` } + } + } + + public enum class CodeCompletionLocation( + id: Long, + ) { + /** + * The option is local to the location of the code completion query - e.g. a local variable. + * Subsequent value of location represent options from the outer class, the exact value represent + * how far they are (in terms of inner classes). + */ + LOCATION_LOCAL(0), + /** + * The option is from the containing class or a parent class, relative to the location of the + * code completion query. Perform a bitwise OR with the class depth (e.g. `0` for the local class, + * `1` for the parent, `2` for the grandparent, etc.) to store the depth of an option in the class + * or a parent class. + */ + LOCATION_PARENT_MASK(256), + /** + * The option is from user code which is not local and not in a derived class (e.g. Autoload + * Singletons). + */ + LOCATION_OTHER_USER_CODE(512), + /** + * The option is from other engine code, not covered by the other enum constants - e.g. built-in + * classes. + */ + LOCATION_OTHER(1024), + ; + + public val id: Long + init { + this.id = id + } + + public companion object { + public fun from(`value`: Long): CodeCompletionLocation = entries.single { it.id == `value` } + } + } + + public companion object + + public object MethodBindings { + internal val setIndentSizePtr: VoidPtr = + Internals.getMethodBindPtr("CodeEdit", "set_indent_size", 1286410249) + + internal val getIndentSizePtr: VoidPtr = + Internals.getMethodBindPtr("CodeEdit", "get_indent_size", 3905245786) + + internal val setIndentUsingSpacesPtr: VoidPtr = + Internals.getMethodBindPtr("CodeEdit", "set_indent_using_spaces", 2586408642) + + internal val isIndentUsingSpacesPtr: VoidPtr = + Internals.getMethodBindPtr("CodeEdit", "is_indent_using_spaces", 36873697) + + internal val setAutoIndentEnabledPtr: VoidPtr = + Internals.getMethodBindPtr("CodeEdit", "set_auto_indent_enabled", 2586408642) + + internal val isAutoIndentEnabledPtr: VoidPtr = + Internals.getMethodBindPtr("CodeEdit", "is_auto_indent_enabled", 36873697) + + internal val setAutoIndentPrefixesPtr: VoidPtr = + Internals.getMethodBindPtr("CodeEdit", "set_auto_indent_prefixes", 381264803) + + internal val getAutoIndentPrefixesPtr: VoidPtr = + Internals.getMethodBindPtr("CodeEdit", "get_auto_indent_prefixes", 3995934104) + + internal val doIndentPtr: VoidPtr = + Internals.getMethodBindPtr("CodeEdit", "do_indent", 3218959716) + + internal val indentLinesPtr: VoidPtr = + Internals.getMethodBindPtr("CodeEdit", "indent_lines", 3218959716) + + internal val unindentLinesPtr: VoidPtr = + Internals.getMethodBindPtr("CodeEdit", "unindent_lines", 3218959716) + + internal val convertIndentPtr: VoidPtr = + Internals.getMethodBindPtr("CodeEdit", "convert_indent", 423910286) + + internal val setAutoBraceCompletionEnabledPtr: VoidPtr = + Internals.getMethodBindPtr("CodeEdit", "set_auto_brace_completion_enabled", 2586408642) + + internal val isAutoBraceCompletionEnabledPtr: VoidPtr = + Internals.getMethodBindPtr("CodeEdit", "is_auto_brace_completion_enabled", 36873697) + + internal val setHighlightMatchingBracesEnabledPtr: VoidPtr = + Internals.getMethodBindPtr("CodeEdit", "set_highlight_matching_braces_enabled", 2586408642) + + internal val isHighlightMatchingBracesEnabledPtr: VoidPtr = + Internals.getMethodBindPtr("CodeEdit", "is_highlight_matching_braces_enabled", 36873697) + + internal val addAutoBraceCompletionPairPtr: VoidPtr = + Internals.getMethodBindPtr("CodeEdit", "add_auto_brace_completion_pair", 3186203200) + + internal val setAutoBraceCompletionPairsPtr: VoidPtr = + Internals.getMethodBindPtr("CodeEdit", "set_auto_brace_completion_pairs", 4155329257) + + internal val getAutoBraceCompletionPairsPtr: VoidPtr = + Internals.getMethodBindPtr("CodeEdit", "get_auto_brace_completion_pairs", 3102165223) + + internal val hasAutoBraceCompletionOpenKeyPtr: VoidPtr = + Internals.getMethodBindPtr("CodeEdit", "has_auto_brace_completion_open_key", 3927539163) + + internal val hasAutoBraceCompletionCloseKeyPtr: VoidPtr = + Internals.getMethodBindPtr("CodeEdit", "has_auto_brace_completion_close_key", 3927539163) + + internal val getAutoBraceCompletionCloseKeyPtr: VoidPtr = + Internals.getMethodBindPtr("CodeEdit", "get_auto_brace_completion_close_key", 3135753539) + + internal val setDrawBreakpointsGutterPtr: VoidPtr = + Internals.getMethodBindPtr("CodeEdit", "set_draw_breakpoints_gutter", 2586408642) + + internal val isDrawingBreakpointsGutterPtr: VoidPtr = + Internals.getMethodBindPtr("CodeEdit", "is_drawing_breakpoints_gutter", 36873697) + + internal val setDrawBookmarksGutterPtr: VoidPtr = + Internals.getMethodBindPtr("CodeEdit", "set_draw_bookmarks_gutter", 2586408642) + + internal val isDrawingBookmarksGutterPtr: VoidPtr = + Internals.getMethodBindPtr("CodeEdit", "is_drawing_bookmarks_gutter", 36873697) + + internal val setDrawExecutingLinesGutterPtr: VoidPtr = + Internals.getMethodBindPtr("CodeEdit", "set_draw_executing_lines_gutter", 2586408642) + + internal val isDrawingExecutingLinesGutterPtr: VoidPtr = + Internals.getMethodBindPtr("CodeEdit", "is_drawing_executing_lines_gutter", 36873697) + + internal val setLineAsBreakpointPtr: VoidPtr = + Internals.getMethodBindPtr("CodeEdit", "set_line_as_breakpoint", 300928843) + + internal val isLineBreakpointedPtr: VoidPtr = + Internals.getMethodBindPtr("CodeEdit", "is_line_breakpointed", 1116898809) + + internal val clearBreakpointedLinesPtr: VoidPtr = + Internals.getMethodBindPtr("CodeEdit", "clear_breakpointed_lines", 3218959716) + + internal val getBreakpointedLinesPtr: VoidPtr = + Internals.getMethodBindPtr("CodeEdit", "get_breakpointed_lines", 1930428628) + + internal val setLineAsBookmarkedPtr: VoidPtr = + Internals.getMethodBindPtr("CodeEdit", "set_line_as_bookmarked", 300928843) + + internal val isLineBookmarkedPtr: VoidPtr = + Internals.getMethodBindPtr("CodeEdit", "is_line_bookmarked", 1116898809) + + internal val clearBookmarkedLinesPtr: VoidPtr = + Internals.getMethodBindPtr("CodeEdit", "clear_bookmarked_lines", 3218959716) + + internal val getBookmarkedLinesPtr: VoidPtr = + Internals.getMethodBindPtr("CodeEdit", "get_bookmarked_lines", 1930428628) + + internal val setLineAsExecutingPtr: VoidPtr = + Internals.getMethodBindPtr("CodeEdit", "set_line_as_executing", 300928843) + + internal val isLineExecutingPtr: VoidPtr = + Internals.getMethodBindPtr("CodeEdit", "is_line_executing", 1116898809) + + internal val clearExecutingLinesPtr: VoidPtr = + Internals.getMethodBindPtr("CodeEdit", "clear_executing_lines", 3218959716) + + internal val getExecutingLinesPtr: VoidPtr = + Internals.getMethodBindPtr("CodeEdit", "get_executing_lines", 1930428628) + + internal val setDrawLineNumbersPtr: VoidPtr = + Internals.getMethodBindPtr("CodeEdit", "set_draw_line_numbers", 2586408642) + + internal val isDrawLineNumbersEnabledPtr: VoidPtr = + Internals.getMethodBindPtr("CodeEdit", "is_draw_line_numbers_enabled", 36873697) + + internal val setLineNumbersZeroPaddedPtr: VoidPtr = + Internals.getMethodBindPtr("CodeEdit", "set_line_numbers_zero_padded", 2586408642) + + internal val isLineNumbersZeroPaddedPtr: VoidPtr = + Internals.getMethodBindPtr("CodeEdit", "is_line_numbers_zero_padded", 36873697) + + internal val setDrawFoldGutterPtr: VoidPtr = + Internals.getMethodBindPtr("CodeEdit", "set_draw_fold_gutter", 2586408642) + + internal val isDrawingFoldGutterPtr: VoidPtr = + Internals.getMethodBindPtr("CodeEdit", "is_drawing_fold_gutter", 36873697) + + internal val setLineFoldingEnabledPtr: VoidPtr = + Internals.getMethodBindPtr("CodeEdit", "set_line_folding_enabled", 2586408642) + + internal val isLineFoldingEnabledPtr: VoidPtr = + Internals.getMethodBindPtr("CodeEdit", "is_line_folding_enabled", 36873697) + + internal val canFoldLinePtr: VoidPtr = + Internals.getMethodBindPtr("CodeEdit", "can_fold_line", 1116898809) + + internal val foldLinePtr: VoidPtr = + Internals.getMethodBindPtr("CodeEdit", "fold_line", 1286410249) + + internal val unfoldLinePtr: VoidPtr = + Internals.getMethodBindPtr("CodeEdit", "unfold_line", 1286410249) + + internal val foldAllLinesPtr: VoidPtr = + Internals.getMethodBindPtr("CodeEdit", "fold_all_lines", 3218959716) + + internal val unfoldAllLinesPtr: VoidPtr = + Internals.getMethodBindPtr("CodeEdit", "unfold_all_lines", 3218959716) + + internal val toggleFoldableLinePtr: VoidPtr = + Internals.getMethodBindPtr("CodeEdit", "toggle_foldable_line", 1286410249) + + internal val toggleFoldableLinesAtCaretsPtr: VoidPtr = + Internals.getMethodBindPtr("CodeEdit", "toggle_foldable_lines_at_carets", 3218959716) + + internal val isLineFoldedPtr: VoidPtr = + Internals.getMethodBindPtr("CodeEdit", "is_line_folded", 1116898809) + + internal val getFoldedLinesPtr: VoidPtr = + Internals.getMethodBindPtr("CodeEdit", "get_folded_lines", 3995934104) + + internal val createCodeRegionPtr: VoidPtr = + Internals.getMethodBindPtr("CodeEdit", "create_code_region", 3218959716) + + internal val getCodeRegionStartTagPtr: VoidPtr = + Internals.getMethodBindPtr("CodeEdit", "get_code_region_start_tag", 201670096) + + internal val getCodeRegionEndTagPtr: VoidPtr = + Internals.getMethodBindPtr("CodeEdit", "get_code_region_end_tag", 201670096) + + internal val setCodeRegionTagsPtr: VoidPtr = + Internals.getMethodBindPtr("CodeEdit", "set_code_region_tags", 708800718) + + internal val isLineCodeRegionStartPtr: VoidPtr = + Internals.getMethodBindPtr("CodeEdit", "is_line_code_region_start", 1116898809) + + internal val isLineCodeRegionEndPtr: VoidPtr = + Internals.getMethodBindPtr("CodeEdit", "is_line_code_region_end", 1116898809) + + internal val addStringDelimiterPtr: VoidPtr = + Internals.getMethodBindPtr("CodeEdit", "add_string_delimiter", 3146098955) + + internal val removeStringDelimiterPtr: VoidPtr = + Internals.getMethodBindPtr("CodeEdit", "remove_string_delimiter", 83702148) + + internal val hasStringDelimiterPtr: VoidPtr = + Internals.getMethodBindPtr("CodeEdit", "has_string_delimiter", 3927539163) + + internal val setStringDelimitersPtr: VoidPtr = + Internals.getMethodBindPtr("CodeEdit", "set_string_delimiters", 381264803) + + internal val clearStringDelimitersPtr: VoidPtr = + Internals.getMethodBindPtr("CodeEdit", "clear_string_delimiters", 3218959716) + + internal val getStringDelimitersPtr: VoidPtr = + Internals.getMethodBindPtr("CodeEdit", "get_string_delimiters", 3995934104) + + internal val isInStringPtr: VoidPtr = + Internals.getMethodBindPtr("CodeEdit", "is_in_string", 688195400) + + internal val addCommentDelimiterPtr: VoidPtr = + Internals.getMethodBindPtr("CodeEdit", "add_comment_delimiter", 3146098955) + + internal val removeCommentDelimiterPtr: VoidPtr = + Internals.getMethodBindPtr("CodeEdit", "remove_comment_delimiter", 83702148) + + internal val hasCommentDelimiterPtr: VoidPtr = + Internals.getMethodBindPtr("CodeEdit", "has_comment_delimiter", 3927539163) + + internal val setCommentDelimitersPtr: VoidPtr = + Internals.getMethodBindPtr("CodeEdit", "set_comment_delimiters", 381264803) + + internal val clearCommentDelimitersPtr: VoidPtr = + Internals.getMethodBindPtr("CodeEdit", "clear_comment_delimiters", 3218959716) + + internal val getCommentDelimitersPtr: VoidPtr = + Internals.getMethodBindPtr("CodeEdit", "get_comment_delimiters", 3995934104) + + internal val isInCommentPtr: VoidPtr = + Internals.getMethodBindPtr("CodeEdit", "is_in_comment", 688195400) + + internal val getDelimiterStartKeyPtr: VoidPtr = + Internals.getMethodBindPtr("CodeEdit", "get_delimiter_start_key", 844755477) + + internal val getDelimiterEndKeyPtr: VoidPtr = + Internals.getMethodBindPtr("CodeEdit", "get_delimiter_end_key", 844755477) + + internal val getDelimiterStartPositionPtr: VoidPtr = + Internals.getMethodBindPtr("CodeEdit", "get_delimiter_start_position", 3016396712) + + internal val getDelimiterEndPositionPtr: VoidPtr = + Internals.getMethodBindPtr("CodeEdit", "get_delimiter_end_position", 3016396712) + + internal val setCodeHintPtr: VoidPtr = + Internals.getMethodBindPtr("CodeEdit", "set_code_hint", 83702148) + + internal val setCodeHintDrawBelowPtr: VoidPtr = + Internals.getMethodBindPtr("CodeEdit", "set_code_hint_draw_below", 2586408642) + + internal val getTextForCodeCompletionPtr: VoidPtr = + Internals.getMethodBindPtr("CodeEdit", "get_text_for_code_completion", 201670096) + + internal val requestCodeCompletionPtr: VoidPtr = + Internals.getMethodBindPtr("CodeEdit", "request_code_completion", 107499316) + + internal val addCodeCompletionOptionPtr: VoidPtr = + Internals.getMethodBindPtr("CodeEdit", "add_code_completion_option", 3944379502) + + internal val updateCodeCompletionOptionsPtr: VoidPtr = + Internals.getMethodBindPtr("CodeEdit", "update_code_completion_options", 2586408642) + + internal val getCodeCompletionOptionsPtr: VoidPtr = + Internals.getMethodBindPtr("CodeEdit", "get_code_completion_options", 3995934104) + + internal val getCodeCompletionOptionPtr: VoidPtr = + Internals.getMethodBindPtr("CodeEdit", "get_code_completion_option", 3485342025) + + internal val getCodeCompletionSelectedIndexPtr: VoidPtr = + Internals.getMethodBindPtr("CodeEdit", "get_code_completion_selected_index", 3905245786) + + internal val setCodeCompletionSelectedIndexPtr: VoidPtr = + Internals.getMethodBindPtr("CodeEdit", "set_code_completion_selected_index", 1286410249) + + internal val confirmCodeCompletionPtr: VoidPtr = + Internals.getMethodBindPtr("CodeEdit", "confirm_code_completion", 107499316) + + internal val cancelCodeCompletionPtr: VoidPtr = + Internals.getMethodBindPtr("CodeEdit", "cancel_code_completion", 3218959716) + + internal val setCodeCompletionEnabledPtr: VoidPtr = + Internals.getMethodBindPtr("CodeEdit", "set_code_completion_enabled", 2586408642) + + internal val isCodeCompletionEnabledPtr: VoidPtr = + Internals.getMethodBindPtr("CodeEdit", "is_code_completion_enabled", 36873697) + + internal val setCodeCompletionPrefixesPtr: VoidPtr = + Internals.getMethodBindPtr("CodeEdit", "set_code_completion_prefixes", 381264803) + + internal val getCodeCompletionPrefixesPtr: VoidPtr = + Internals.getMethodBindPtr("CodeEdit", "get_code_completion_prefixes", 3995934104) + + internal val setLineLengthGuidelinesPtr: VoidPtr = + Internals.getMethodBindPtr("CodeEdit", "set_line_length_guidelines", 381264803) + + internal val getLineLengthGuidelinesPtr: VoidPtr = + Internals.getMethodBindPtr("CodeEdit", "get_line_length_guidelines", 3995934104) + + internal val setSymbolLookupOnClickEnabledPtr: VoidPtr = + Internals.getMethodBindPtr("CodeEdit", "set_symbol_lookup_on_click_enabled", 2586408642) + + internal val isSymbolLookupOnClickEnabledPtr: VoidPtr = + Internals.getMethodBindPtr("CodeEdit", "is_symbol_lookup_on_click_enabled", 36873697) + + internal val getTextForSymbolLookupPtr: VoidPtr = + Internals.getMethodBindPtr("CodeEdit", "get_text_for_symbol_lookup", 201670096) + + internal val getTextWithCursorCharPtr: VoidPtr = + Internals.getMethodBindPtr("CodeEdit", "get_text_with_cursor_char", 1391810591) + + internal val setSymbolLookupWordAsValidPtr: VoidPtr = + Internals.getMethodBindPtr("CodeEdit", "set_symbol_lookup_word_as_valid", 2586408642) + + internal val moveLinesUpPtr: VoidPtr = + Internals.getMethodBindPtr("CodeEdit", "move_lines_up", 3218959716) + + internal val moveLinesDownPtr: VoidPtr = + Internals.getMethodBindPtr("CodeEdit", "move_lines_down", 3218959716) + + internal val deleteLinesPtr: VoidPtr = + Internals.getMethodBindPtr("CodeEdit", "delete_lines", 3218959716) + + internal val duplicateSelectionPtr: VoidPtr = + Internals.getMethodBindPtr("CodeEdit", "duplicate_selection", 3218959716) + + internal val duplicateLinesPtr: VoidPtr = + Internals.getMethodBindPtr("CodeEdit", "duplicate_lines", 3218959716) + } +} diff --git a/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/CodeHighlighter.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/CodeHighlighter.kt new file mode 100644 index 0000000000..e84d06fd32 --- /dev/null +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/CodeHighlighter.kt @@ -0,0 +1,518 @@ +// THIS FILE IS GENERATED! DO NOT EDIT IT MANUALLY! +@file:Suppress("PackageDirectoryMismatch", "unused", "FunctionName", "RedundantModalityModifier", + "UNCHECKED_CAST", "JoinDeclarationAndAssignment", "USELESS_CAST", + "RemoveRedundantQualifierName", "NOTHING_TO_INLINE", "NON_FINAL_MEMBER_IN_OBJECT", + "RedundantVisibilityModifier", "RedundantUnitReturnType", "MemberVisibilityCanBePrivate") + +package godot + +import godot.`annotation`.CoreTypeHelper +import godot.`annotation`.CoreTypeLocalCopy +import godot.`annotation`.GodotBaseType +import godot.core.Color +import godot.core.Dictionary +import godot.core.VariantParser.BOOL +import godot.core.VariantParser.COLOR +import godot.core.VariantParser.DICTIONARY +import godot.core.VariantParser.NIL +import godot.core.VariantParser.STRING +import godot.util.Internals +import godot.util.VoidPtr +import kotlin.Any +import kotlin.Boolean +import kotlin.Int +import kotlin.String +import kotlin.Suppress +import kotlin.Unit +import kotlin.jvm.JvmName +import kotlin.jvm.JvmOverloads + +private const val ENGINE_CLASS_CODEHIGHLIGHTER_INDEX: Int = 185 + +/** + * By adjusting various properties of this resource, you can change the colors of strings, comments, + * numbers, and other text patterns inside a [TextEdit] control. + */ +@GodotBaseType +public open class CodeHighlighter : SyntaxHighlighter() { + /** + * Sets the color for numbers. + */ + @CoreTypeLocalCopy + public final inline var numberColor: Color + @JvmName("numberColorProperty") + get() = getNumberColor() + @JvmName("numberColorProperty") + set(`value`) { + setNumberColor(value) + } + + /** + * Sets the color for symbols. + */ + @CoreTypeLocalCopy + public final inline var symbolColor: Color + @JvmName("symbolColorProperty") + get() = getSymbolColor() + @JvmName("symbolColorProperty") + set(`value`) { + setSymbolColor(value) + } + + /** + * Sets color for functions. A function is a non-keyword string followed by a '('. + */ + @CoreTypeLocalCopy + public final inline var functionColor: Color + @JvmName("functionColorProperty") + get() = getFunctionColor() + @JvmName("functionColorProperty") + set(`value`) { + setFunctionColor(value) + } + + /** + * Sets color for member variables. A member variable is non-keyword, non-function string + * proceeded with a '.'. + */ + @CoreTypeLocalCopy + public final inline var memberVariableColor: Color + @JvmName("memberVariableColorProperty") + get() = getMemberVariableColor() + @JvmName("memberVariableColorProperty") + set(`value`) { + setMemberVariableColor(value) + } + + /** + * Sets the keyword colors. All existing keywords will be removed. The [Dictionary] key is the + * keyword. The value is the keyword color. + */ + public final inline var keywordColors: Dictionary + @JvmName("keywordColorsProperty") + get() = getKeywordColors() + @JvmName("keywordColorsProperty") + set(`value`) { + setKeywordColors(value) + } + + /** + * Sets the member keyword colors. All existing member keyword will be removed. The [Dictionary] + * key is the member keyword. The value is the member keyword color. + */ + public final inline var memberKeywordColors: Dictionary + @JvmName("memberKeywordColorsProperty") + get() = getMemberKeywordColors() + @JvmName("memberKeywordColorsProperty") + set(`value`) { + setMemberKeywordColors(value) + } + + /** + * Sets the color regions. All existing regions will be removed. The [Dictionary] key is the + * region start and end key, separated by a space. The value is the region color. + */ + public final inline var colorRegions: Dictionary + @JvmName("colorRegionsProperty") + get() = getColorRegions() + @JvmName("colorRegionsProperty") + set(`value`) { + setColorRegions(value) + } + + public override fun new(scriptIndex: Int): Unit { + Internals.callConstructor(this, ENGINE_CLASS_CODEHIGHLIGHTER_INDEX, scriptIndex) + } + + /** + * Sets the color for numbers. + * + * This is a helper function to make dealing with local copies easier. + * + * For more information, see our + * [documentation](https://godot-kotl.in/en/stable/user-guide/api-differences/#core-types). + * + * Allow to directly modify the local copy of the property and assign it back to the Object. + * + * Prefer that over writing: + * `````` + * val myCoreType = codehighlighter.numberColor + * //Your changes + * codehighlighter.numberColor = myCoreType + * `````` + */ + @CoreTypeHelper + public final fun numberColorMutate(block: Color.() -> Unit): Color = numberColor.apply{ + block(this) + numberColor = this + } + + + /** + * Sets the color for symbols. + * + * This is a helper function to make dealing with local copies easier. + * + * For more information, see our + * [documentation](https://godot-kotl.in/en/stable/user-guide/api-differences/#core-types). + * + * Allow to directly modify the local copy of the property and assign it back to the Object. + * + * Prefer that over writing: + * `````` + * val myCoreType = codehighlighter.symbolColor + * //Your changes + * codehighlighter.symbolColor = myCoreType + * `````` + */ + @CoreTypeHelper + public final fun symbolColorMutate(block: Color.() -> Unit): Color = symbolColor.apply{ + block(this) + symbolColor = this + } + + + /** + * Sets color for functions. A function is a non-keyword string followed by a '('. + * + * This is a helper function to make dealing with local copies easier. + * + * For more information, see our + * [documentation](https://godot-kotl.in/en/stable/user-guide/api-differences/#core-types). + * + * Allow to directly modify the local copy of the property and assign it back to the Object. + * + * Prefer that over writing: + * `````` + * val myCoreType = codehighlighter.functionColor + * //Your changes + * codehighlighter.functionColor = myCoreType + * `````` + */ + @CoreTypeHelper + public final fun functionColorMutate(block: Color.() -> Unit): Color = functionColor.apply{ + block(this) + functionColor = this + } + + + /** + * Sets color for member variables. A member variable is non-keyword, non-function string + * proceeded with a '.'. + * + * This is a helper function to make dealing with local copies easier. + * + * For more information, see our + * [documentation](https://godot-kotl.in/en/stable/user-guide/api-differences/#core-types). + * + * Allow to directly modify the local copy of the property and assign it back to the Object. + * + * Prefer that over writing: + * `````` + * val myCoreType = codehighlighter.memberVariableColor + * //Your changes + * codehighlighter.memberVariableColor = myCoreType + * `````` + */ + @CoreTypeHelper + public final fun memberVariableColorMutate(block: Color.() -> Unit): Color = + memberVariableColor.apply{ + block(this) + memberVariableColor = this + } + + + /** + * Sets the color for a keyword. + * The keyword cannot contain any symbols except '_'. + */ + public final fun addKeywordColor(keyword: String, color: Color): Unit { + Internals.writeArguments(STRING to keyword, COLOR to color) + Internals.callMethod(rawPtr, MethodBindings.addKeywordColorPtr, NIL) + } + + /** + * Removes the keyword. + */ + public final fun removeKeywordColor(keyword: String): Unit { + Internals.writeArguments(STRING to keyword) + Internals.callMethod(rawPtr, MethodBindings.removeKeywordColorPtr, NIL) + } + + /** + * Returns `true` if the keyword exists, else `false`. + */ + public final fun hasKeywordColor(keyword: String): Boolean { + Internals.writeArguments(STRING to keyword) + Internals.callMethod(rawPtr, MethodBindings.hasKeywordColorPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + /** + * Returns the color for a keyword. + */ + public final fun getKeywordColor(keyword: String): Color { + Internals.writeArguments(STRING to keyword) + Internals.callMethod(rawPtr, MethodBindings.getKeywordColorPtr, COLOR) + return (Internals.readReturnValue(COLOR) as Color) + } + + public final fun setKeywordColors(keywords: Dictionary): Unit { + Internals.writeArguments(DICTIONARY to keywords) + Internals.callMethod(rawPtr, MethodBindings.setKeywordColorsPtr, NIL) + } + + /** + * Removes all keywords. + */ + public final fun clearKeywordColors(): Unit { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.clearKeywordColorsPtr, NIL) + } + + public final fun getKeywordColors(): Dictionary { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getKeywordColorsPtr, DICTIONARY) + return (Internals.readReturnValue(DICTIONARY) as Dictionary) + } + + /** + * Sets the color for a member keyword. + * The member keyword cannot contain any symbols except '_'. + * It will not be highlighted if preceded by a '.'. + */ + public final fun addMemberKeywordColor(memberKeyword: String, color: Color): Unit { + Internals.writeArguments(STRING to memberKeyword, COLOR to color) + Internals.callMethod(rawPtr, MethodBindings.addMemberKeywordColorPtr, NIL) + } + + /** + * Removes the member keyword. + */ + public final fun removeMemberKeywordColor(memberKeyword: String): Unit { + Internals.writeArguments(STRING to memberKeyword) + Internals.callMethod(rawPtr, MethodBindings.removeMemberKeywordColorPtr, NIL) + } + + /** + * Returns `true` if the member keyword exists, else `false`. + */ + public final fun hasMemberKeywordColor(memberKeyword: String): Boolean { + Internals.writeArguments(STRING to memberKeyword) + Internals.callMethod(rawPtr, MethodBindings.hasMemberKeywordColorPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + /** + * Returns the color for a member keyword. + */ + public final fun getMemberKeywordColor(memberKeyword: String): Color { + Internals.writeArguments(STRING to memberKeyword) + Internals.callMethod(rawPtr, MethodBindings.getMemberKeywordColorPtr, COLOR) + return (Internals.readReturnValue(COLOR) as Color) + } + + public final fun setMemberKeywordColors(memberKeyword: Dictionary): Unit { + Internals.writeArguments(DICTIONARY to memberKeyword) + Internals.callMethod(rawPtr, MethodBindings.setMemberKeywordColorsPtr, NIL) + } + + /** + * Removes all member keywords. + */ + public final fun clearMemberKeywordColors(): Unit { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.clearMemberKeywordColorsPtr, NIL) + } + + public final fun getMemberKeywordColors(): Dictionary { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getMemberKeywordColorsPtr, DICTIONARY) + return (Internals.readReturnValue(DICTIONARY) as Dictionary) + } + + /** + * Adds a color region (such as for comments or strings) from [startKey] to [endKey]. Both keys + * should be symbols, and [startKey] must not be shared with other delimiters. + * If [lineOnly] is `true` or [endKey] is an empty [String], the region does not carry over to the + * next line. + */ + @JvmOverloads + public final fun addColorRegion( + startKey: String, + endKey: String, + color: Color, + lineOnly: Boolean = false, + ): Unit { + Internals.writeArguments(STRING to startKey, STRING to endKey, COLOR to color, BOOL to lineOnly) + Internals.callMethod(rawPtr, MethodBindings.addColorRegionPtr, NIL) + } + + /** + * Removes the color region that uses that start key. + */ + public final fun removeColorRegion(startKey: String): Unit { + Internals.writeArguments(STRING to startKey) + Internals.callMethod(rawPtr, MethodBindings.removeColorRegionPtr, NIL) + } + + /** + * Returns `true` if the start key exists, else `false`. + */ + public final fun hasColorRegion(startKey: String): Boolean { + Internals.writeArguments(STRING to startKey) + Internals.callMethod(rawPtr, MethodBindings.hasColorRegionPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public final fun setColorRegions(colorRegions: Dictionary): Unit { + Internals.writeArguments(DICTIONARY to colorRegions) + Internals.callMethod(rawPtr, MethodBindings.setColorRegionsPtr, NIL) + } + + /** + * Removes all color regions. + */ + public final fun clearColorRegions(): Unit { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.clearColorRegionsPtr, NIL) + } + + public final fun getColorRegions(): Dictionary { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getColorRegionsPtr, DICTIONARY) + return (Internals.readReturnValue(DICTIONARY) as Dictionary) + } + + public final fun setFunctionColor(color: Color): Unit { + Internals.writeArguments(COLOR to color) + Internals.callMethod(rawPtr, MethodBindings.setFunctionColorPtr, NIL) + } + + public final fun getFunctionColor(): Color { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getFunctionColorPtr, COLOR) + return (Internals.readReturnValue(COLOR) as Color) + } + + public final fun setNumberColor(color: Color): Unit { + Internals.writeArguments(COLOR to color) + Internals.callMethod(rawPtr, MethodBindings.setNumberColorPtr, NIL) + } + + public final fun getNumberColor(): Color { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getNumberColorPtr, COLOR) + return (Internals.readReturnValue(COLOR) as Color) + } + + public final fun setSymbolColor(color: Color): Unit { + Internals.writeArguments(COLOR to color) + Internals.callMethod(rawPtr, MethodBindings.setSymbolColorPtr, NIL) + } + + public final fun getSymbolColor(): Color { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getSymbolColorPtr, COLOR) + return (Internals.readReturnValue(COLOR) as Color) + } + + public final fun setMemberVariableColor(color: Color): Unit { + Internals.writeArguments(COLOR to color) + Internals.callMethod(rawPtr, MethodBindings.setMemberVariableColorPtr, NIL) + } + + public final fun getMemberVariableColor(): Color { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getMemberVariableColorPtr, COLOR) + return (Internals.readReturnValue(COLOR) as Color) + } + + public companion object + + public object MethodBindings { + internal val addKeywordColorPtr: VoidPtr = + Internals.getMethodBindPtr("CodeHighlighter", "add_keyword_color", 1636512886) + + internal val removeKeywordColorPtr: VoidPtr = + Internals.getMethodBindPtr("CodeHighlighter", "remove_keyword_color", 83702148) + + internal val hasKeywordColorPtr: VoidPtr = + Internals.getMethodBindPtr("CodeHighlighter", "has_keyword_color", 3927539163) + + internal val getKeywordColorPtr: VoidPtr = + Internals.getMethodBindPtr("CodeHighlighter", "get_keyword_color", 3855908743) + + internal val setKeywordColorsPtr: VoidPtr = + Internals.getMethodBindPtr("CodeHighlighter", "set_keyword_colors", 4155329257) + + internal val clearKeywordColorsPtr: VoidPtr = + Internals.getMethodBindPtr("CodeHighlighter", "clear_keyword_colors", 3218959716) + + internal val getKeywordColorsPtr: VoidPtr = + Internals.getMethodBindPtr("CodeHighlighter", "get_keyword_colors", 3102165223) + + internal val addMemberKeywordColorPtr: VoidPtr = + Internals.getMethodBindPtr("CodeHighlighter", "add_member_keyword_color", 1636512886) + + internal val removeMemberKeywordColorPtr: VoidPtr = + Internals.getMethodBindPtr("CodeHighlighter", "remove_member_keyword_color", 83702148) + + internal val hasMemberKeywordColorPtr: VoidPtr = + Internals.getMethodBindPtr("CodeHighlighter", "has_member_keyword_color", 3927539163) + + internal val getMemberKeywordColorPtr: VoidPtr = + Internals.getMethodBindPtr("CodeHighlighter", "get_member_keyword_color", 3855908743) + + internal val setMemberKeywordColorsPtr: VoidPtr = + Internals.getMethodBindPtr("CodeHighlighter", "set_member_keyword_colors", 4155329257) + + internal val clearMemberKeywordColorsPtr: VoidPtr = + Internals.getMethodBindPtr("CodeHighlighter", "clear_member_keyword_colors", 3218959716) + + internal val getMemberKeywordColorsPtr: VoidPtr = + Internals.getMethodBindPtr("CodeHighlighter", "get_member_keyword_colors", 3102165223) + + internal val addColorRegionPtr: VoidPtr = + Internals.getMethodBindPtr("CodeHighlighter", "add_color_region", 2924977451) + + internal val removeColorRegionPtr: VoidPtr = + Internals.getMethodBindPtr("CodeHighlighter", "remove_color_region", 83702148) + + internal val hasColorRegionPtr: VoidPtr = + Internals.getMethodBindPtr("CodeHighlighter", "has_color_region", 3927539163) + + internal val setColorRegionsPtr: VoidPtr = + Internals.getMethodBindPtr("CodeHighlighter", "set_color_regions", 4155329257) + + internal val clearColorRegionsPtr: VoidPtr = + Internals.getMethodBindPtr("CodeHighlighter", "clear_color_regions", 3218959716) + + internal val getColorRegionsPtr: VoidPtr = + Internals.getMethodBindPtr("CodeHighlighter", "get_color_regions", 3102165223) + + internal val setFunctionColorPtr: VoidPtr = + Internals.getMethodBindPtr("CodeHighlighter", "set_function_color", 2920490490) + + internal val getFunctionColorPtr: VoidPtr = + Internals.getMethodBindPtr("CodeHighlighter", "get_function_color", 3444240500) + + internal val setNumberColorPtr: VoidPtr = + Internals.getMethodBindPtr("CodeHighlighter", "set_number_color", 2920490490) + + internal val getNumberColorPtr: VoidPtr = + Internals.getMethodBindPtr("CodeHighlighter", "get_number_color", 3444240500) + + internal val setSymbolColorPtr: VoidPtr = + Internals.getMethodBindPtr("CodeHighlighter", "set_symbol_color", 2920490490) + + internal val getSymbolColorPtr: VoidPtr = + Internals.getMethodBindPtr("CodeHighlighter", "get_symbol_color", 3444240500) + + internal val setMemberVariableColorPtr: VoidPtr = + Internals.getMethodBindPtr("CodeHighlighter", "set_member_variable_color", 2920490490) + + internal val getMemberVariableColorPtr: VoidPtr = + Internals.getMethodBindPtr("CodeHighlighter", "get_member_variable_color", 3444240500) + } +} diff --git a/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/CollisionObject2D.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/CollisionObject2D.kt new file mode 100644 index 0000000000..bc9115141f --- /dev/null +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/CollisionObject2D.kt @@ -0,0 +1,616 @@ +// THIS FILE IS GENERATED! DO NOT EDIT IT MANUALLY! +@file:Suppress("PackageDirectoryMismatch", "unused", "FunctionName", "RedundantModalityModifier", + "UNCHECKED_CAST", "JoinDeclarationAndAssignment", "USELESS_CAST", + "RemoveRedundantQualifierName", "NOTHING_TO_INLINE", "NON_FINAL_MEMBER_IN_OBJECT", + "RedundantVisibilityModifier", "RedundantUnitReturnType", "MemberVisibilityCanBePrivate") + +package godot + +import godot.`annotation`.GodotBaseType +import godot.core.PackedInt32Array +import godot.core.RID +import godot.core.Signal0 +import godot.core.Signal1 +import godot.core.Signal3 +import godot.core.Transform2D +import godot.core.VariantParser.BOOL +import godot.core.VariantParser.DOUBLE +import godot.core.VariantParser.LONG +import godot.core.VariantParser.NIL +import godot.core.VariantParser.OBJECT +import godot.core.VariantParser.PACKED_INT_32_ARRAY +import godot.core.VariantParser.TRANSFORM2D +import godot.core.VariantParser._RID +import godot.util.Internals +import godot.util.VoidPtr +import kotlin.Boolean +import kotlin.Double +import kotlin.Float +import kotlin.Int +import kotlin.Long +import kotlin.Suppress +import kotlin.Unit +import kotlin.jvm.JvmName + +private const val ENGINE_CLASS_COLLISIONOBJECT2D_INDEX: Int = 186 + +/** + * Abstract base class for 2D physics objects. [CollisionObject2D] can hold any number of [Shape2D]s + * for collision. Each shape must be assigned to a *shape owner*. Shape owners are not nodes and do not + * appear in the editor, but are accessible through code using the `shape_owner_*` methods. + * **Note:** Only collisions between objects within the same canvas ([Viewport] canvas or + * [CanvasLayer]) are supported. The behavior of collisions between objects in different canvases is + * undefined. + */ +@GodotBaseType +public open class CollisionObject2D internal constructor() : Node2D() { + /** + * Emitted when an input event occurs. Requires [inputPickable] to be `true` and at least one + * [collisionLayer] bit to be set. See [_inputEvent] for details. + */ + public val inputEvent: Signal3 by Signal3 + + /** + * Emitted when the mouse pointer enters any of this object's shapes. Requires [inputPickable] to + * be `true` and at least one [collisionLayer] bit to be set. Note that moving between different + * shapes within a single [CollisionObject2D] won't cause this signal to be emitted. + * **Note:** Due to the lack of continuous collision detection, this signal may not be emitted in + * the expected order if the mouse moves fast enough and the [CollisionObject2D]'s area is small. + * This signal may also not be emitted if another [CollisionObject2D] is overlapping the + * [CollisionObject2D] in question. + */ + public val mouseEntered: Signal0 by Signal0 + + /** + * Emitted when the mouse pointer exits all this object's shapes. Requires [inputPickable] to be + * `true` and at least one [collisionLayer] bit to be set. Note that moving between different shapes + * within a single [CollisionObject2D] won't cause this signal to be emitted. + * **Note:** Due to the lack of continuous collision detection, this signal may not be emitted in + * the expected order if the mouse moves fast enough and the [CollisionObject2D]'s area is small. + * This signal may also not be emitted if another [CollisionObject2D] is overlapping the + * [CollisionObject2D] in question. + */ + public val mouseExited: Signal0 by Signal0 + + /** + * Emitted when the mouse pointer enters any of this object's shapes or moves from one shape to + * another. [shapeIdx] is the child index of the newly entered [Shape2D]. Requires [inputPickable] to + * be `true` and at least one [collisionLayer] bit to be set. + */ + public val mouseShapeEntered: Signal1 by Signal1 + + /** + * Emitted when the mouse pointer exits any of this object's shapes. [shapeIdx] is the child index + * of the exited [Shape2D]. Requires [inputPickable] to be `true` and at least one [collisionLayer] + * bit to be set. + */ + public val mouseShapeExited: Signal1 by Signal1 + + /** + * Defines the behavior in physics when [Node.processMode] is set to [Node.PROCESS_MODE_DISABLED]. + * See [DisableMode] for more details about the different modes. + */ + public final inline var disableMode: DisableMode + @JvmName("disableModeProperty") + get() = getDisableMode() + @JvmName("disableModeProperty") + set(`value`) { + setDisableMode(value) + } + + /** + * The physics layers this CollisionObject2D is in. Collision objects can exist in one or more of + * 32 different layers. See also [collisionMask]. + * **Note:** Object A can detect a contact with object B only if object B is in any of the layers + * that object A scans. See + * [url=$DOCS_URL/tutorials/physics/physics_introduction.html#collision-layers-and-masks]Collision + * layers and masks[/url] in the documentation for more information. + */ + public final inline var collisionLayer: Long + @JvmName("collisionLayerProperty") + get() = getCollisionLayer() + @JvmName("collisionLayerProperty") + set(`value`) { + setCollisionLayer(value) + } + + /** + * The physics layers this CollisionObject2D scans. Collision objects can scan one or more of 32 + * different layers. See also [collisionLayer]. + * **Note:** Object A can detect a contact with object B only if object B is in any of the layers + * that object A scans. See + * [url=$DOCS_URL/tutorials/physics/physics_introduction.html#collision-layers-and-masks]Collision + * layers and masks[/url] in the documentation for more information. + */ + public final inline var collisionMask: Long + @JvmName("collisionMaskProperty") + get() = getCollisionMask() + @JvmName("collisionMaskProperty") + set(`value`) { + setCollisionMask(value) + } + + /** + * The priority used to solve colliding when occurring penetration. The higher the priority is, + * the lower the penetration into the object will be. This can for example be used to prevent the + * player from breaking through the boundaries of a level. + */ + public final inline var collisionPriority: Float + @JvmName("collisionPriorityProperty") + get() = getCollisionPriority() + @JvmName("collisionPriorityProperty") + set(`value`) { + setCollisionPriority(value) + } + + /** + * If `true`, this object is pickable. A pickable object can detect the mouse pointer + * entering/leaving, and if the mouse is inside it, report input events. Requires at least one + * [collisionLayer] bit to be set. + */ + public final inline var inputPickable: Boolean + @JvmName("inputPickableProperty") + get() = isPickable() + @JvmName("inputPickableProperty") + set(`value`) { + setPickable(value) + } + + public override fun new(scriptIndex: Int): Unit { + Internals.callConstructor(this, ENGINE_CLASS_COLLISIONOBJECT2D_INDEX, scriptIndex) + } + + /** + * Accepts unhandled [InputEvent]s. [shapeIdx] is the child index of the clicked [Shape2D]. + * Connect to [signal input_event] to easily pick up these events. + * **Note:** [_inputEvent] requires [inputPickable] to be `true` and at least one [collisionLayer] + * bit to be set. + */ + public open fun _inputEvent( + viewport: Viewport?, + event: InputEvent?, + shapeIdx: Int, + ): Unit { + } + + /** + * Called when the mouse pointer enters any of this object's shapes. Requires [inputPickable] to + * be `true` and at least one [collisionLayer] bit to be set. Note that moving between different + * shapes within a single [CollisionObject2D] won't cause this function to be called. + */ + public open fun _mouseEnter(): Unit { + } + + /** + * Called when the mouse pointer exits all this object's shapes. Requires [inputPickable] to be + * `true` and at least one [collisionLayer] bit to be set. Note that moving between different shapes + * within a single [CollisionObject2D] won't cause this function to be called. + */ + public open fun _mouseExit(): Unit { + } + + /** + * Called when the mouse pointer enters any of this object's shapes or moves from one shape to + * another. [shapeIdx] is the child index of the newly entered [Shape2D]. Requires [inputPickable] to + * be `true` and at least one [collisionLayer] bit to be called. + */ + public open fun _mouseShapeEnter(shapeIdx: Int): Unit { + } + + /** + * Called when the mouse pointer exits any of this object's shapes. [shapeIdx] is the child index + * of the exited [Shape2D]. Requires [inputPickable] to be `true` and at least one [collisionLayer] + * bit to be called. + */ + public open fun _mouseShapeExit(shapeIdx: Int): Unit { + } + + /** + * Returns the object's [RID]. + */ + public final fun getRid(): RID { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getRidPtr, _RID) + return (Internals.readReturnValue(_RID) as RID) + } + + public final fun setCollisionLayer(layer: Long): Unit { + Internals.writeArguments(LONG to layer) + Internals.callMethod(rawPtr, MethodBindings.setCollisionLayerPtr, NIL) + } + + public final fun getCollisionLayer(): Long { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getCollisionLayerPtr, LONG) + return (Internals.readReturnValue(LONG) as Long) + } + + public final fun setCollisionMask(mask: Long): Unit { + Internals.writeArguments(LONG to mask) + Internals.callMethod(rawPtr, MethodBindings.setCollisionMaskPtr, NIL) + } + + public final fun getCollisionMask(): Long { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getCollisionMaskPtr, LONG) + return (Internals.readReturnValue(LONG) as Long) + } + + /** + * Based on [value], enables or disables the specified layer in the [collisionLayer], given a + * [layerNumber] between 1 and 32. + */ + public final fun setCollisionLayerValue(layerNumber: Int, `value`: Boolean): Unit { + Internals.writeArguments(LONG to layerNumber.toLong(), BOOL to value) + Internals.callMethod(rawPtr, MethodBindings.setCollisionLayerValuePtr, NIL) + } + + /** + * Returns whether or not the specified layer of the [collisionLayer] is enabled, given a + * [layerNumber] between 1 and 32. + */ + public final fun getCollisionLayerValue(layerNumber: Int): Boolean { + Internals.writeArguments(LONG to layerNumber.toLong()) + Internals.callMethod(rawPtr, MethodBindings.getCollisionLayerValuePtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + /** + * Based on [value], enables or disables the specified layer in the [collisionMask], given a + * [layerNumber] between 1 and 32. + */ + public final fun setCollisionMaskValue(layerNumber: Int, `value`: Boolean): Unit { + Internals.writeArguments(LONG to layerNumber.toLong(), BOOL to value) + Internals.callMethod(rawPtr, MethodBindings.setCollisionMaskValuePtr, NIL) + } + + /** + * Returns whether or not the specified layer of the [collisionMask] is enabled, given a + * [layerNumber] between 1 and 32. + */ + public final fun getCollisionMaskValue(layerNumber: Int): Boolean { + Internals.writeArguments(LONG to layerNumber.toLong()) + Internals.callMethod(rawPtr, MethodBindings.getCollisionMaskValuePtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public final fun setCollisionPriority(priority: Float): Unit { + Internals.writeArguments(DOUBLE to priority.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setCollisionPriorityPtr, NIL) + } + + public final fun getCollisionPriority(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getCollisionPriorityPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setDisableMode(mode: DisableMode): Unit { + Internals.writeArguments(LONG to mode.id) + Internals.callMethod(rawPtr, MethodBindings.setDisableModePtr, NIL) + } + + public final fun getDisableMode(): DisableMode { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getDisableModePtr, LONG) + return CollisionObject2D.DisableMode.from(Internals.readReturnValue(LONG) as Long) + } + + public final fun setPickable(enabled: Boolean): Unit { + Internals.writeArguments(BOOL to enabled) + Internals.callMethod(rawPtr, MethodBindings.setPickablePtr, NIL) + } + + public final fun isPickable(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isPickablePtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + /** + * Creates a new shape owner for the given object. Returns `owner_id` of the new owner for future + * reference. + */ + public final fun createShapeOwner(owner: Object?): Long { + Internals.writeArguments(OBJECT to owner) + Internals.callMethod(rawPtr, MethodBindings.createShapeOwnerPtr, LONG) + return (Internals.readReturnValue(LONG) as Long) + } + + /** + * Removes the given shape owner. + */ + public final fun removeShapeOwner(ownerId: Long): Unit { + Internals.writeArguments(LONG to ownerId) + Internals.callMethod(rawPtr, MethodBindings.removeShapeOwnerPtr, NIL) + } + + /** + * Returns an [Array] of `owner_id` identifiers. You can use these ids in other methods that take + * `owner_id` as an argument. + */ + public final fun getShapeOwners(): PackedInt32Array { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getShapeOwnersPtr, PACKED_INT_32_ARRAY) + return (Internals.readReturnValue(PACKED_INT_32_ARRAY) as PackedInt32Array) + } + + /** + * Sets the [Transform2D] of the given shape owner. + */ + public final fun shapeOwnerSetTransform(ownerId: Long, transform: Transform2D): Unit { + Internals.writeArguments(LONG to ownerId, TRANSFORM2D to transform) + Internals.callMethod(rawPtr, MethodBindings.shapeOwnerSetTransformPtr, NIL) + } + + /** + * Returns the shape owner's [Transform2D]. + */ + public final fun shapeOwnerGetTransform(ownerId: Long): Transform2D { + Internals.writeArguments(LONG to ownerId) + Internals.callMethod(rawPtr, MethodBindings.shapeOwnerGetTransformPtr, TRANSFORM2D) + return (Internals.readReturnValue(TRANSFORM2D) as Transform2D) + } + + /** + * Returns the parent object of the given shape owner. + */ + public final fun shapeOwnerGetOwner(ownerId: Long): Object? { + Internals.writeArguments(LONG to ownerId) + Internals.callMethod(rawPtr, MethodBindings.shapeOwnerGetOwnerPtr, OBJECT) + return (Internals.readReturnValue(OBJECT) as Object?) + } + + /** + * If `true`, disables the given shape owner. + */ + public final fun shapeOwnerSetDisabled(ownerId: Long, disabled: Boolean): Unit { + Internals.writeArguments(LONG to ownerId, BOOL to disabled) + Internals.callMethod(rawPtr, MethodBindings.shapeOwnerSetDisabledPtr, NIL) + } + + /** + * If `true`, the shape owner and its shapes are disabled. + */ + public final fun isShapeOwnerDisabled(ownerId: Long): Boolean { + Internals.writeArguments(LONG to ownerId) + Internals.callMethod(rawPtr, MethodBindings.isShapeOwnerDisabledPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + /** + * If [enable] is `true`, collisions for the shape owner originating from this [CollisionObject2D] + * will not be reported to collided with [CollisionObject2D]s. + */ + public final fun shapeOwnerSetOneWayCollision(ownerId: Long, enable: Boolean): Unit { + Internals.writeArguments(LONG to ownerId, BOOL to enable) + Internals.callMethod(rawPtr, MethodBindings.shapeOwnerSetOneWayCollisionPtr, NIL) + } + + /** + * Returns `true` if collisions for the shape owner originating from this [CollisionObject2D] will + * not be reported to collided with [CollisionObject2D]s. + */ + public final fun isShapeOwnerOneWayCollisionEnabled(ownerId: Long): Boolean { + Internals.writeArguments(LONG to ownerId) + Internals.callMethod(rawPtr, MethodBindings.isShapeOwnerOneWayCollisionEnabledPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + /** + * Sets the `one_way_collision_margin` of the shape owner identified by given [ownerId] to + * [margin] pixels. + */ + public final fun shapeOwnerSetOneWayCollisionMargin(ownerId: Long, margin: Float): Unit { + Internals.writeArguments(LONG to ownerId, DOUBLE to margin.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.shapeOwnerSetOneWayCollisionMarginPtr, NIL) + } + + /** + * Returns the `one_way_collision_margin` of the shape owner identified by given [ownerId]. + */ + public final fun getShapeOwnerOneWayCollisionMargin(ownerId: Long): Float { + Internals.writeArguments(LONG to ownerId) + Internals.callMethod(rawPtr, MethodBindings.getShapeOwnerOneWayCollisionMarginPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + /** + * Adds a [Shape2D] to the shape owner. + */ + public final fun shapeOwnerAddShape(ownerId: Long, shape: Shape2D?): Unit { + Internals.writeArguments(LONG to ownerId, OBJECT to shape) + Internals.callMethod(rawPtr, MethodBindings.shapeOwnerAddShapePtr, NIL) + } + + /** + * Returns the number of shapes the given shape owner contains. + */ + public final fun shapeOwnerGetShapeCount(ownerId: Long): Int { + Internals.writeArguments(LONG to ownerId) + Internals.callMethod(rawPtr, MethodBindings.shapeOwnerGetShapeCountPtr, LONG) + return (Internals.readReturnValue(LONG) as Long).toInt() + } + + /** + * Returns the [Shape2D] with the given ID from the given shape owner. + */ + public final fun shapeOwnerGetShape(ownerId: Long, shapeId: Int): Shape2D? { + Internals.writeArguments(LONG to ownerId, LONG to shapeId.toLong()) + Internals.callMethod(rawPtr, MethodBindings.shapeOwnerGetShapePtr, OBJECT) + return (Internals.readReturnValue(OBJECT) as Shape2D?) + } + + /** + * Returns the child index of the [Shape2D] with the given ID from the given shape owner. + */ + public final fun shapeOwnerGetShapeIndex(ownerId: Long, shapeId: Int): Int { + Internals.writeArguments(LONG to ownerId, LONG to shapeId.toLong()) + Internals.callMethod(rawPtr, MethodBindings.shapeOwnerGetShapeIndexPtr, LONG) + return (Internals.readReturnValue(LONG) as Long).toInt() + } + + /** + * Removes a shape from the given shape owner. + */ + public final fun shapeOwnerRemoveShape(ownerId: Long, shapeId: Int): Unit { + Internals.writeArguments(LONG to ownerId, LONG to shapeId.toLong()) + Internals.callMethod(rawPtr, MethodBindings.shapeOwnerRemoveShapePtr, NIL) + } + + /** + * Removes all shapes from the shape owner. + */ + public final fun shapeOwnerClearShapes(ownerId: Long): Unit { + Internals.writeArguments(LONG to ownerId) + Internals.callMethod(rawPtr, MethodBindings.shapeOwnerClearShapesPtr, NIL) + } + + /** + * Returns the `owner_id` of the given shape. + */ + public final fun shapeFindOwner(shapeIndex: Int): Long { + Internals.writeArguments(LONG to shapeIndex.toLong()) + Internals.callMethod(rawPtr, MethodBindings.shapeFindOwnerPtr, LONG) + return (Internals.readReturnValue(LONG) as Long) + } + + public enum class DisableMode( + id: Long, + ) { + /** + * When [Node.processMode] is set to [Node.PROCESS_MODE_DISABLED], remove from the physics + * simulation to stop all physics interactions with this [CollisionObject2D]. + * Automatically re-added to the physics simulation when the [Node] is processed again. + */ + DISABLE_MODE_REMOVE(0), + /** + * When [Node.processMode] is set to [Node.PROCESS_MODE_DISABLED], make the body static. Doesn't + * affect [Area2D]. [PhysicsBody2D] can't be affected by forces or other bodies while static. + * Automatically set [PhysicsBody2D] back to its original mode when the [Node] is processed + * again. + */ + DISABLE_MODE_MAKE_STATIC(1), + /** + * When [Node.processMode] is set to [Node.PROCESS_MODE_DISABLED], do not affect the physics + * simulation. + */ + DISABLE_MODE_KEEP_ACTIVE(2), + ; + + public val id: Long + init { + this.id = id + } + + public companion object { + public fun from(`value`: Long): DisableMode = entries.single { it.id == `value` } + } + } + + public companion object + + public object MethodBindings { + internal val getRidPtr: VoidPtr = + Internals.getMethodBindPtr("CollisionObject2D", "get_rid", 2944877500) + + internal val setCollisionLayerPtr: VoidPtr = + Internals.getMethodBindPtr("CollisionObject2D", "set_collision_layer", 1286410249) + + internal val getCollisionLayerPtr: VoidPtr = + Internals.getMethodBindPtr("CollisionObject2D", "get_collision_layer", 3905245786) + + internal val setCollisionMaskPtr: VoidPtr = + Internals.getMethodBindPtr("CollisionObject2D", "set_collision_mask", 1286410249) + + internal val getCollisionMaskPtr: VoidPtr = + Internals.getMethodBindPtr("CollisionObject2D", "get_collision_mask", 3905245786) + + internal val setCollisionLayerValuePtr: VoidPtr = + Internals.getMethodBindPtr("CollisionObject2D", "set_collision_layer_value", 300928843) + + internal val getCollisionLayerValuePtr: VoidPtr = + Internals.getMethodBindPtr("CollisionObject2D", "get_collision_layer_value", 1116898809) + + internal val setCollisionMaskValuePtr: VoidPtr = + Internals.getMethodBindPtr("CollisionObject2D", "set_collision_mask_value", 300928843) + + internal val getCollisionMaskValuePtr: VoidPtr = + Internals.getMethodBindPtr("CollisionObject2D", "get_collision_mask_value", 1116898809) + + internal val setCollisionPriorityPtr: VoidPtr = + Internals.getMethodBindPtr("CollisionObject2D", "set_collision_priority", 373806689) + + internal val getCollisionPriorityPtr: VoidPtr = + Internals.getMethodBindPtr("CollisionObject2D", "get_collision_priority", 1740695150) + + internal val setDisableModePtr: VoidPtr = + Internals.getMethodBindPtr("CollisionObject2D", "set_disable_mode", 1919204045) + + internal val getDisableModePtr: VoidPtr = + Internals.getMethodBindPtr("CollisionObject2D", "get_disable_mode", 3172846349) + + internal val setPickablePtr: VoidPtr = + Internals.getMethodBindPtr("CollisionObject2D", "set_pickable", 2586408642) + + internal val isPickablePtr: VoidPtr = + Internals.getMethodBindPtr("CollisionObject2D", "is_pickable", 36873697) + + internal val createShapeOwnerPtr: VoidPtr = + Internals.getMethodBindPtr("CollisionObject2D", "create_shape_owner", 3429307534) + + internal val removeShapeOwnerPtr: VoidPtr = + Internals.getMethodBindPtr("CollisionObject2D", "remove_shape_owner", 1286410249) + + internal val getShapeOwnersPtr: VoidPtr = + Internals.getMethodBindPtr("CollisionObject2D", "get_shape_owners", 969006518) + + internal val shapeOwnerSetTransformPtr: VoidPtr = + Internals.getMethodBindPtr("CollisionObject2D", "shape_owner_set_transform", 30160968) + + internal val shapeOwnerGetTransformPtr: VoidPtr = + Internals.getMethodBindPtr("CollisionObject2D", "shape_owner_get_transform", 3836996910) + + internal val shapeOwnerGetOwnerPtr: VoidPtr = + Internals.getMethodBindPtr("CollisionObject2D", "shape_owner_get_owner", 3332903315) + + internal val shapeOwnerSetDisabledPtr: VoidPtr = + Internals.getMethodBindPtr("CollisionObject2D", "shape_owner_set_disabled", 300928843) + + internal val isShapeOwnerDisabledPtr: VoidPtr = + Internals.getMethodBindPtr("CollisionObject2D", "is_shape_owner_disabled", 1116898809) + + internal val shapeOwnerSetOneWayCollisionPtr: VoidPtr = + Internals.getMethodBindPtr("CollisionObject2D", "shape_owner_set_one_way_collision", 300928843) + + internal val isShapeOwnerOneWayCollisionEnabledPtr: VoidPtr = + Internals.getMethodBindPtr("CollisionObject2D", "is_shape_owner_one_way_collision_enabled", 1116898809) + + internal val shapeOwnerSetOneWayCollisionMarginPtr: VoidPtr = + Internals.getMethodBindPtr("CollisionObject2D", "shape_owner_set_one_way_collision_margin", 1602489585) + + internal val getShapeOwnerOneWayCollisionMarginPtr: VoidPtr = + Internals.getMethodBindPtr("CollisionObject2D", "get_shape_owner_one_way_collision_margin", 2339986948) + + internal val shapeOwnerAddShapePtr: VoidPtr = + Internals.getMethodBindPtr("CollisionObject2D", "shape_owner_add_shape", 2077425081) + + internal val shapeOwnerGetShapeCountPtr: VoidPtr = + Internals.getMethodBindPtr("CollisionObject2D", "shape_owner_get_shape_count", 923996154) + + internal val shapeOwnerGetShapePtr: VoidPtr = + Internals.getMethodBindPtr("CollisionObject2D", "shape_owner_get_shape", 3106725749) + + internal val shapeOwnerGetShapeIndexPtr: VoidPtr = + Internals.getMethodBindPtr("CollisionObject2D", "shape_owner_get_shape_index", 3175239445) + + internal val shapeOwnerRemoveShapePtr: VoidPtr = + Internals.getMethodBindPtr("CollisionObject2D", "shape_owner_remove_shape", 3937882851) + + internal val shapeOwnerClearShapesPtr: VoidPtr = + Internals.getMethodBindPtr("CollisionObject2D", "shape_owner_clear_shapes", 1286410249) + + internal val shapeFindOwnerPtr: VoidPtr = + Internals.getMethodBindPtr("CollisionObject2D", "shape_find_owner", 923996154) + } +} diff --git a/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/CollisionObject3D.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/CollisionObject3D.kt new file mode 100644 index 0000000000..799b29b158 --- /dev/null +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/CollisionObject3D.kt @@ -0,0 +1,567 @@ +// THIS FILE IS GENERATED! DO NOT EDIT IT MANUALLY! +@file:Suppress("PackageDirectoryMismatch", "unused", "FunctionName", "RedundantModalityModifier", + "UNCHECKED_CAST", "JoinDeclarationAndAssignment", "USELESS_CAST", + "RemoveRedundantQualifierName", "NOTHING_TO_INLINE", "NON_FINAL_MEMBER_IN_OBJECT", + "RedundantVisibilityModifier", "RedundantUnitReturnType", "MemberVisibilityCanBePrivate") + +package godot + +import godot.`annotation`.GodotBaseType +import godot.core.PackedInt32Array +import godot.core.RID +import godot.core.Signal0 +import godot.core.Signal5 +import godot.core.Transform3D +import godot.core.VariantParser.BOOL +import godot.core.VariantParser.DOUBLE +import godot.core.VariantParser.LONG +import godot.core.VariantParser.NIL +import godot.core.VariantParser.OBJECT +import godot.core.VariantParser.PACKED_INT_32_ARRAY +import godot.core.VariantParser.TRANSFORM3D +import godot.core.VariantParser._RID +import godot.core.Vector3 +import godot.util.Internals +import godot.util.VoidPtr +import kotlin.Boolean +import kotlin.Double +import kotlin.Float +import kotlin.Int +import kotlin.Long +import kotlin.Suppress +import kotlin.Unit +import kotlin.jvm.JvmName + +private const val ENGINE_CLASS_COLLISIONOBJECT3D_INDEX: Int = 187 + +/** + * Abstract base class for 3D physics objects. [CollisionObject3D] can hold any number of [Shape3D]s + * for collision. Each shape must be assigned to a *shape owner*. Shape owners are not nodes and do not + * appear in the editor, but are accessible through code using the `shape_owner_*` methods. + * **Warning:** With a non-uniform scale, this node will likely not behave as expected. It is + * advised to keep its scale the same on all axes and adjust its collision shape(s) instead. + */ +@GodotBaseType +public open class CollisionObject3D internal constructor() : Node3D() { + /** + * Emitted when the object receives an unhandled [InputEvent]. [eventPosition] is the location in + * world space of the mouse pointer on the surface of the shape with index [shapeIdx] and [normal] is + * the normal vector of the surface at that point. + */ + public val inputEvent: Signal5 by Signal5 + + /** + * Emitted when the mouse pointer enters any of this object's shapes. Requires [inputRayPickable] + * to be `true` and at least one [collisionLayer] bit to be set. + * **Note:** Due to the lack of continuous collision detection, this signal may not be emitted in + * the expected order if the mouse moves fast enough and the [CollisionObject3D]'s area is small. + * This signal may also not be emitted if another [CollisionObject3D] is overlapping the + * [CollisionObject3D] in question. + */ + public val mouseEntered: Signal0 by Signal0 + + /** + * Emitted when the mouse pointer exits all this object's shapes. Requires [inputRayPickable] to + * be `true` and at least one [collisionLayer] bit to be set. + * **Note:** Due to the lack of continuous collision detection, this signal may not be emitted in + * the expected order if the mouse moves fast enough and the [CollisionObject3D]'s area is small. + * This signal may also not be emitted if another [CollisionObject3D] is overlapping the + * [CollisionObject3D] in question. + */ + public val mouseExited: Signal0 by Signal0 + + /** + * Defines the behavior in physics when [Node.processMode] is set to [Node.PROCESS_MODE_DISABLED]. + * See [DisableMode] for more details about the different modes. + */ + public final inline var disableMode: DisableMode + @JvmName("disableModeProperty") + get() = getDisableMode() + @JvmName("disableModeProperty") + set(`value`) { + setDisableMode(value) + } + + /** + * The physics layers this CollisionObject3D **is in**. Collision objects can exist in one or more + * of 32 different layers. See also [collisionMask]. + * **Note:** Object A can detect a contact with object B only if object B is in any of the layers + * that object A scans. See + * [url=$DOCS_URL/tutorials/physics/physics_introduction.html#collision-layers-and-masks]Collision + * layers and masks[/url] in the documentation for more information. + */ + public final inline var collisionLayer: Long + @JvmName("collisionLayerProperty") + get() = getCollisionLayer() + @JvmName("collisionLayerProperty") + set(`value`) { + setCollisionLayer(value) + } + + /** + * The physics layers this CollisionObject3D **scans**. Collision objects can scan one or more of + * 32 different layers. See also [collisionLayer]. + * **Note:** Object A can detect a contact with object B only if object B is in any of the layers + * that object A scans. See + * [url=$DOCS_URL/tutorials/physics/physics_introduction.html#collision-layers-and-masks]Collision + * layers and masks[/url] in the documentation for more information. + */ + public final inline var collisionMask: Long + @JvmName("collisionMaskProperty") + get() = getCollisionMask() + @JvmName("collisionMaskProperty") + set(`value`) { + setCollisionMask(value) + } + + /** + * The priority used to solve colliding when occurring penetration. The higher the priority is, + * the lower the penetration into the object will be. This can for example be used to prevent the + * player from breaking through the boundaries of a level. + */ + public final inline var collisionPriority: Float + @JvmName("collisionPriorityProperty") + get() = getCollisionPriority() + @JvmName("collisionPriorityProperty") + set(`value`) { + setCollisionPriority(value) + } + + /** + * If `true`, this object is pickable. A pickable object can detect the mouse pointer + * entering/leaving, and if the mouse is inside it, report input events. Requires at least one + * [collisionLayer] bit to be set. + */ + public final inline var inputRayPickable: Boolean + @JvmName("inputRayPickableProperty") + get() = isRayPickable() + @JvmName("inputRayPickableProperty") + set(`value`) { + setRayPickable(value) + } + + /** + * If `true`, the [CollisionObject3D] will continue to receive input events as the mouse is + * dragged across its shapes. + */ + public final inline var inputCaptureOnDrag: Boolean + @JvmName("inputCaptureOnDragProperty") + get() = getCaptureInputOnDrag() + @JvmName("inputCaptureOnDragProperty") + set(`value`) { + setCaptureInputOnDrag(value) + } + + public override fun new(scriptIndex: Int): Unit { + Internals.callConstructor(this, ENGINE_CLASS_COLLISIONOBJECT3D_INDEX, scriptIndex) + } + + /** + * Receives unhandled [InputEvent]s. [eventPosition] is the location in world space of the mouse + * pointer on the surface of the shape with index [shapeIdx] and [normal] is the normal vector of the + * surface at that point. Connect to the [signal input_event] signal to easily pick up these events. + * **Note:** [_inputEvent] requires [inputRayPickable] to be `true` and at least one + * [collisionLayer] bit to be set. + */ + public open fun _inputEvent( + camera: Camera3D?, + event: InputEvent?, + eventPosition: Vector3, + normal: Vector3, + shapeIdx: Int, + ): Unit { + } + + /** + * Called when the mouse pointer enters any of this object's shapes. Requires [inputRayPickable] + * to be `true` and at least one [collisionLayer] bit to be set. Note that moving between different + * shapes within a single [CollisionObject3D] won't cause this function to be called. + */ + public open fun _mouseEnter(): Unit { + } + + /** + * Called when the mouse pointer exits all this object's shapes. Requires [inputRayPickable] to be + * `true` and at least one [collisionLayer] bit to be set. Note that moving between different shapes + * within a single [CollisionObject3D] won't cause this function to be called. + */ + public open fun _mouseExit(): Unit { + } + + public final fun setCollisionLayer(layer: Long): Unit { + Internals.writeArguments(LONG to layer) + Internals.callMethod(rawPtr, MethodBindings.setCollisionLayerPtr, NIL) + } + + public final fun getCollisionLayer(): Long { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getCollisionLayerPtr, LONG) + return (Internals.readReturnValue(LONG) as Long) + } + + public final fun setCollisionMask(mask: Long): Unit { + Internals.writeArguments(LONG to mask) + Internals.callMethod(rawPtr, MethodBindings.setCollisionMaskPtr, NIL) + } + + public final fun getCollisionMask(): Long { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getCollisionMaskPtr, LONG) + return (Internals.readReturnValue(LONG) as Long) + } + + /** + * Based on [value], enables or disables the specified layer in the [collisionLayer], given a + * [layerNumber] between 1 and 32. + */ + public final fun setCollisionLayerValue(layerNumber: Int, `value`: Boolean): Unit { + Internals.writeArguments(LONG to layerNumber.toLong(), BOOL to value) + Internals.callMethod(rawPtr, MethodBindings.setCollisionLayerValuePtr, NIL) + } + + /** + * Returns whether or not the specified layer of the [collisionLayer] is enabled, given a + * [layerNumber] between 1 and 32. + */ + public final fun getCollisionLayerValue(layerNumber: Int): Boolean { + Internals.writeArguments(LONG to layerNumber.toLong()) + Internals.callMethod(rawPtr, MethodBindings.getCollisionLayerValuePtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + /** + * Based on [value], enables or disables the specified layer in the [collisionMask], given a + * [layerNumber] between 1 and 32. + */ + public final fun setCollisionMaskValue(layerNumber: Int, `value`: Boolean): Unit { + Internals.writeArguments(LONG to layerNumber.toLong(), BOOL to value) + Internals.callMethod(rawPtr, MethodBindings.setCollisionMaskValuePtr, NIL) + } + + /** + * Returns whether or not the specified layer of the [collisionMask] is enabled, given a + * [layerNumber] between 1 and 32. + */ + public final fun getCollisionMaskValue(layerNumber: Int): Boolean { + Internals.writeArguments(LONG to layerNumber.toLong()) + Internals.callMethod(rawPtr, MethodBindings.getCollisionMaskValuePtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public final fun setCollisionPriority(priority: Float): Unit { + Internals.writeArguments(DOUBLE to priority.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setCollisionPriorityPtr, NIL) + } + + public final fun getCollisionPriority(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getCollisionPriorityPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setDisableMode(mode: DisableMode): Unit { + Internals.writeArguments(LONG to mode.id) + Internals.callMethod(rawPtr, MethodBindings.setDisableModePtr, NIL) + } + + public final fun getDisableMode(): DisableMode { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getDisableModePtr, LONG) + return CollisionObject3D.DisableMode.from(Internals.readReturnValue(LONG) as Long) + } + + public final fun setRayPickable(rayPickable: Boolean): Unit { + Internals.writeArguments(BOOL to rayPickable) + Internals.callMethod(rawPtr, MethodBindings.setRayPickablePtr, NIL) + } + + public final fun isRayPickable(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isRayPickablePtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public final fun setCaptureInputOnDrag(enable: Boolean): Unit { + Internals.writeArguments(BOOL to enable) + Internals.callMethod(rawPtr, MethodBindings.setCaptureInputOnDragPtr, NIL) + } + + public final fun getCaptureInputOnDrag(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getCaptureInputOnDragPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + /** + * Returns the object's [RID]. + */ + public final fun getRid(): RID { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getRidPtr, _RID) + return (Internals.readReturnValue(_RID) as RID) + } + + /** + * Creates a new shape owner for the given object. Returns `owner_id` of the new owner for future + * reference. + */ + public final fun createShapeOwner(owner: Object?): Long { + Internals.writeArguments(OBJECT to owner) + Internals.callMethod(rawPtr, MethodBindings.createShapeOwnerPtr, LONG) + return (Internals.readReturnValue(LONG) as Long) + } + + /** + * Removes the given shape owner. + */ + public final fun removeShapeOwner(ownerId: Long): Unit { + Internals.writeArguments(LONG to ownerId) + Internals.callMethod(rawPtr, MethodBindings.removeShapeOwnerPtr, NIL) + } + + /** + * Returns an [Array] of `owner_id` identifiers. You can use these ids in other methods that take + * `owner_id` as an argument. + */ + public final fun getShapeOwners(): PackedInt32Array { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getShapeOwnersPtr, PACKED_INT_32_ARRAY) + return (Internals.readReturnValue(PACKED_INT_32_ARRAY) as PackedInt32Array) + } + + /** + * Sets the [Transform3D] of the given shape owner. + */ + public final fun shapeOwnerSetTransform(ownerId: Long, transform: Transform3D): Unit { + Internals.writeArguments(LONG to ownerId, TRANSFORM3D to transform) + Internals.callMethod(rawPtr, MethodBindings.shapeOwnerSetTransformPtr, NIL) + } + + /** + * Returns the shape owner's [Transform3D]. + */ + public final fun shapeOwnerGetTransform(ownerId: Long): Transform3D { + Internals.writeArguments(LONG to ownerId) + Internals.callMethod(rawPtr, MethodBindings.shapeOwnerGetTransformPtr, TRANSFORM3D) + return (Internals.readReturnValue(TRANSFORM3D) as Transform3D) + } + + /** + * Returns the parent object of the given shape owner. + */ + public final fun shapeOwnerGetOwner(ownerId: Long): Object? { + Internals.writeArguments(LONG to ownerId) + Internals.callMethod(rawPtr, MethodBindings.shapeOwnerGetOwnerPtr, OBJECT) + return (Internals.readReturnValue(OBJECT) as Object?) + } + + /** + * If `true`, disables the given shape owner. + */ + public final fun shapeOwnerSetDisabled(ownerId: Long, disabled: Boolean): Unit { + Internals.writeArguments(LONG to ownerId, BOOL to disabled) + Internals.callMethod(rawPtr, MethodBindings.shapeOwnerSetDisabledPtr, NIL) + } + + /** + * If `true`, the shape owner and its shapes are disabled. + */ + public final fun isShapeOwnerDisabled(ownerId: Long): Boolean { + Internals.writeArguments(LONG to ownerId) + Internals.callMethod(rawPtr, MethodBindings.isShapeOwnerDisabledPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + /** + * Adds a [Shape3D] to the shape owner. + */ + public final fun shapeOwnerAddShape(ownerId: Long, shape: Shape3D?): Unit { + Internals.writeArguments(LONG to ownerId, OBJECT to shape) + Internals.callMethod(rawPtr, MethodBindings.shapeOwnerAddShapePtr, NIL) + } + + /** + * Returns the number of shapes the given shape owner contains. + */ + public final fun shapeOwnerGetShapeCount(ownerId: Long): Int { + Internals.writeArguments(LONG to ownerId) + Internals.callMethod(rawPtr, MethodBindings.shapeOwnerGetShapeCountPtr, LONG) + return (Internals.readReturnValue(LONG) as Long).toInt() + } + + /** + * Returns the [Shape3D] with the given ID from the given shape owner. + */ + public final fun shapeOwnerGetShape(ownerId: Long, shapeId: Int): Shape3D? { + Internals.writeArguments(LONG to ownerId, LONG to shapeId.toLong()) + Internals.callMethod(rawPtr, MethodBindings.shapeOwnerGetShapePtr, OBJECT) + return (Internals.readReturnValue(OBJECT) as Shape3D?) + } + + /** + * Returns the child index of the [Shape3D] with the given ID from the given shape owner. + */ + public final fun shapeOwnerGetShapeIndex(ownerId: Long, shapeId: Int): Int { + Internals.writeArguments(LONG to ownerId, LONG to shapeId.toLong()) + Internals.callMethod(rawPtr, MethodBindings.shapeOwnerGetShapeIndexPtr, LONG) + return (Internals.readReturnValue(LONG) as Long).toInt() + } + + /** + * Removes a shape from the given shape owner. + */ + public final fun shapeOwnerRemoveShape(ownerId: Long, shapeId: Int): Unit { + Internals.writeArguments(LONG to ownerId, LONG to shapeId.toLong()) + Internals.callMethod(rawPtr, MethodBindings.shapeOwnerRemoveShapePtr, NIL) + } + + /** + * Removes all shapes from the shape owner. + */ + public final fun shapeOwnerClearShapes(ownerId: Long): Unit { + Internals.writeArguments(LONG to ownerId) + Internals.callMethod(rawPtr, MethodBindings.shapeOwnerClearShapesPtr, NIL) + } + + /** + * Returns the `owner_id` of the given shape. + */ + public final fun shapeFindOwner(shapeIndex: Int): Long { + Internals.writeArguments(LONG to shapeIndex.toLong()) + Internals.callMethod(rawPtr, MethodBindings.shapeFindOwnerPtr, LONG) + return (Internals.readReturnValue(LONG) as Long) + } + + public enum class DisableMode( + id: Long, + ) { + /** + * When [Node.processMode] is set to [Node.PROCESS_MODE_DISABLED], remove from the physics + * simulation to stop all physics interactions with this [CollisionObject3D]. + * Automatically re-added to the physics simulation when the [Node] is processed again. + */ + DISABLE_MODE_REMOVE(0), + /** + * When [Node.processMode] is set to [Node.PROCESS_MODE_DISABLED], make the body static. Doesn't + * affect [Area3D]. [PhysicsBody3D] can't be affected by forces or other bodies while static. + * Automatically set [PhysicsBody3D] back to its original mode when the [Node] is processed + * again. + */ + DISABLE_MODE_MAKE_STATIC(1), + /** + * When [Node.processMode] is set to [Node.PROCESS_MODE_DISABLED], do not affect the physics + * simulation. + */ + DISABLE_MODE_KEEP_ACTIVE(2), + ; + + public val id: Long + init { + this.id = id + } + + public companion object { + public fun from(`value`: Long): DisableMode = entries.single { it.id == `value` } + } + } + + public companion object + + public object MethodBindings { + internal val setCollisionLayerPtr: VoidPtr = + Internals.getMethodBindPtr("CollisionObject3D", "set_collision_layer", 1286410249) + + internal val getCollisionLayerPtr: VoidPtr = + Internals.getMethodBindPtr("CollisionObject3D", "get_collision_layer", 3905245786) + + internal val setCollisionMaskPtr: VoidPtr = + Internals.getMethodBindPtr("CollisionObject3D", "set_collision_mask", 1286410249) + + internal val getCollisionMaskPtr: VoidPtr = + Internals.getMethodBindPtr("CollisionObject3D", "get_collision_mask", 3905245786) + + internal val setCollisionLayerValuePtr: VoidPtr = + Internals.getMethodBindPtr("CollisionObject3D", "set_collision_layer_value", 300928843) + + internal val getCollisionLayerValuePtr: VoidPtr = + Internals.getMethodBindPtr("CollisionObject3D", "get_collision_layer_value", 1116898809) + + internal val setCollisionMaskValuePtr: VoidPtr = + Internals.getMethodBindPtr("CollisionObject3D", "set_collision_mask_value", 300928843) + + internal val getCollisionMaskValuePtr: VoidPtr = + Internals.getMethodBindPtr("CollisionObject3D", "get_collision_mask_value", 1116898809) + + internal val setCollisionPriorityPtr: VoidPtr = + Internals.getMethodBindPtr("CollisionObject3D", "set_collision_priority", 373806689) + + internal val getCollisionPriorityPtr: VoidPtr = + Internals.getMethodBindPtr("CollisionObject3D", "get_collision_priority", 1740695150) + + internal val setDisableModePtr: VoidPtr = + Internals.getMethodBindPtr("CollisionObject3D", "set_disable_mode", 1623620376) + + internal val getDisableModePtr: VoidPtr = + Internals.getMethodBindPtr("CollisionObject3D", "get_disable_mode", 410164780) + + internal val setRayPickablePtr: VoidPtr = + Internals.getMethodBindPtr("CollisionObject3D", "set_ray_pickable", 2586408642) + + internal val isRayPickablePtr: VoidPtr = + Internals.getMethodBindPtr("CollisionObject3D", "is_ray_pickable", 36873697) + + internal val setCaptureInputOnDragPtr: VoidPtr = + Internals.getMethodBindPtr("CollisionObject3D", "set_capture_input_on_drag", 2586408642) + + internal val getCaptureInputOnDragPtr: VoidPtr = + Internals.getMethodBindPtr("CollisionObject3D", "get_capture_input_on_drag", 36873697) + + internal val getRidPtr: VoidPtr = + Internals.getMethodBindPtr("CollisionObject3D", "get_rid", 2944877500) + + internal val createShapeOwnerPtr: VoidPtr = + Internals.getMethodBindPtr("CollisionObject3D", "create_shape_owner", 3429307534) + + internal val removeShapeOwnerPtr: VoidPtr = + Internals.getMethodBindPtr("CollisionObject3D", "remove_shape_owner", 1286410249) + + internal val getShapeOwnersPtr: VoidPtr = + Internals.getMethodBindPtr("CollisionObject3D", "get_shape_owners", 969006518) + + internal val shapeOwnerSetTransformPtr: VoidPtr = + Internals.getMethodBindPtr("CollisionObject3D", "shape_owner_set_transform", 3616898986) + + internal val shapeOwnerGetTransformPtr: VoidPtr = + Internals.getMethodBindPtr("CollisionObject3D", "shape_owner_get_transform", 1965739696) + + internal val shapeOwnerGetOwnerPtr: VoidPtr = + Internals.getMethodBindPtr("CollisionObject3D", "shape_owner_get_owner", 3332903315) + + internal val shapeOwnerSetDisabledPtr: VoidPtr = + Internals.getMethodBindPtr("CollisionObject3D", "shape_owner_set_disabled", 300928843) + + internal val isShapeOwnerDisabledPtr: VoidPtr = + Internals.getMethodBindPtr("CollisionObject3D", "is_shape_owner_disabled", 1116898809) + + internal val shapeOwnerAddShapePtr: VoidPtr = + Internals.getMethodBindPtr("CollisionObject3D", "shape_owner_add_shape", 2566676345) + + internal val shapeOwnerGetShapeCountPtr: VoidPtr = + Internals.getMethodBindPtr("CollisionObject3D", "shape_owner_get_shape_count", 923996154) + + internal val shapeOwnerGetShapePtr: VoidPtr = + Internals.getMethodBindPtr("CollisionObject3D", "shape_owner_get_shape", 4015519174) + + internal val shapeOwnerGetShapeIndexPtr: VoidPtr = + Internals.getMethodBindPtr("CollisionObject3D", "shape_owner_get_shape_index", 3175239445) + + internal val shapeOwnerRemoveShapePtr: VoidPtr = + Internals.getMethodBindPtr("CollisionObject3D", "shape_owner_remove_shape", 3937882851) + + internal val shapeOwnerClearShapesPtr: VoidPtr = + Internals.getMethodBindPtr("CollisionObject3D", "shape_owner_clear_shapes", 1286410249) + + internal val shapeFindOwnerPtr: VoidPtr = + Internals.getMethodBindPtr("CollisionObject3D", "shape_find_owner", 923996154) + } +} diff --git a/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/CollisionPolygon2D.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/CollisionPolygon2D.kt new file mode 100644 index 0000000000..6a6acfeb3a --- /dev/null +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/CollisionPolygon2D.kt @@ -0,0 +1,220 @@ +// THIS FILE IS GENERATED! DO NOT EDIT IT MANUALLY! +@file:Suppress("PackageDirectoryMismatch", "unused", "FunctionName", "RedundantModalityModifier", + "UNCHECKED_CAST", "JoinDeclarationAndAssignment", "USELESS_CAST", + "RemoveRedundantQualifierName", "NOTHING_TO_INLINE", "NON_FINAL_MEMBER_IN_OBJECT", + "RedundantVisibilityModifier", "RedundantUnitReturnType", "MemberVisibilityCanBePrivate") + +package godot + +import godot.`annotation`.GodotBaseType +import godot.core.PackedVector2Array +import godot.core.VariantParser.BOOL +import godot.core.VariantParser.DOUBLE +import godot.core.VariantParser.LONG +import godot.core.VariantParser.NIL +import godot.core.VariantParser.PACKED_VECTOR2_ARRAY +import godot.util.Internals +import godot.util.VoidPtr +import kotlin.Boolean +import kotlin.Double +import kotlin.Float +import kotlin.Int +import kotlin.Long +import kotlin.Suppress +import kotlin.Unit +import kotlin.jvm.JvmName + +private const val ENGINE_CLASS_COLLISIONPOLYGON2D_INDEX: Int = 188 + +/** + * A node that provides a polygon shape to a [CollisionObject2D] parent and allows to edit it. The + * polygon can be concave or convex. This can give a detection shape to an [Area2D], turn + * [PhysicsBody2D] into a solid object, or give a hollow shape to a [StaticBody2D]. + * **Warning:** A non-uniformly scaled [CollisionShape2D] will likely not behave as expected. Make + * sure to keep its scale the same on all axes and adjust its shape resource instead. + */ +@GodotBaseType +public open class CollisionPolygon2D : Node2D() { + /** + * Collision build mode. Use one of the [BuildMode] constants. + */ + public final inline var buildMode: BuildMode + @JvmName("buildModeProperty") + get() = getBuildMode() + @JvmName("buildModeProperty") + set(`value`) { + setBuildMode(value) + } + + /** + * The polygon's list of vertices. Each point will be connected to the next, and the final point + * will be connected to the first. + * **Note:** The returned vertices are in the local coordinate space of the given + * [CollisionPolygon2D]. + */ + public final inline var polygon: PackedVector2Array + @JvmName("polygonProperty") + get() = getPolygon() + @JvmName("polygonProperty") + set(`value`) { + setPolygon(value) + } + + /** + * If `true`, no collisions will be detected. + */ + public final inline var disabled: Boolean + @JvmName("disabledProperty") + get() = isDisabled() + @JvmName("disabledProperty") + set(`value`) { + setDisabled(value) + } + + /** + * If `true`, only edges that face up, relative to [CollisionPolygon2D]'s rotation, will collide + * with other objects. + * **Note:** This property has no effect if this [CollisionPolygon2D] is a child of an [Area2D] + * node. + */ + public final inline var oneWayCollision: Boolean + @JvmName("oneWayCollisionProperty") + get() = isOneWayCollisionEnabled() + @JvmName("oneWayCollisionProperty") + set(`value`) { + setOneWayCollision(value) + } + + /** + * The margin used for one-way collision (in pixels). Higher values will make the shape thicker, + * and work better for colliders that enter the polygon at a high velocity. + */ + public final inline var oneWayCollisionMargin: Float + @JvmName("oneWayCollisionMarginProperty") + get() = getOneWayCollisionMargin() + @JvmName("oneWayCollisionMarginProperty") + set(`value`) { + setOneWayCollisionMargin(value) + } + + public override fun new(scriptIndex: Int): Unit { + Internals.callConstructor(this, ENGINE_CLASS_COLLISIONPOLYGON2D_INDEX, scriptIndex) + } + + public final fun setPolygon(polygon: PackedVector2Array): Unit { + Internals.writeArguments(PACKED_VECTOR2_ARRAY to polygon) + Internals.callMethod(rawPtr, MethodBindings.setPolygonPtr, NIL) + } + + public final fun getPolygon(): PackedVector2Array { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getPolygonPtr, PACKED_VECTOR2_ARRAY) + return (Internals.readReturnValue(PACKED_VECTOR2_ARRAY) as PackedVector2Array) + } + + public final fun setBuildMode(buildMode: BuildMode): Unit { + Internals.writeArguments(LONG to buildMode.id) + Internals.callMethod(rawPtr, MethodBindings.setBuildModePtr, NIL) + } + + public final fun getBuildMode(): BuildMode { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getBuildModePtr, LONG) + return CollisionPolygon2D.BuildMode.from(Internals.readReturnValue(LONG) as Long) + } + + public final fun setDisabled(disabled: Boolean): Unit { + Internals.writeArguments(BOOL to disabled) + Internals.callMethod(rawPtr, MethodBindings.setDisabledPtr, NIL) + } + + public final fun isDisabled(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isDisabledPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public final fun setOneWayCollision(enabled: Boolean): Unit { + Internals.writeArguments(BOOL to enabled) + Internals.callMethod(rawPtr, MethodBindings.setOneWayCollisionPtr, NIL) + } + + public final fun isOneWayCollisionEnabled(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isOneWayCollisionEnabledPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public final fun setOneWayCollisionMargin(margin: Float): Unit { + Internals.writeArguments(DOUBLE to margin.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setOneWayCollisionMarginPtr, NIL) + } + + public final fun getOneWayCollisionMargin(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getOneWayCollisionMarginPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public enum class BuildMode( + id: Long, + ) { + /** + * Collisions will include the polygon and its contained area. In this mode the node has the + * same effect as several [ConvexPolygonShape2D] nodes, one for each convex shape in the convex + * decomposition of the polygon (but without the overhead of multiple nodes). + */ + BUILD_SOLIDS(0), + /** + * Collisions will only include the polygon edges. In this mode the node has the same effect as + * a single [ConcavePolygonShape2D] made of segments, with the restriction that each segment (after + * the first one) starts where the previous one ends, and the last one ends where the first one + * starts (forming a closed but hollow polygon). + */ + BUILD_SEGMENTS(1), + ; + + public val id: Long + init { + this.id = id + } + + public companion object { + public fun from(`value`: Long): BuildMode = entries.single { it.id == `value` } + } + } + + public companion object + + public object MethodBindings { + internal val setPolygonPtr: VoidPtr = + Internals.getMethodBindPtr("CollisionPolygon2D", "set_polygon", 1509147220) + + internal val getPolygonPtr: VoidPtr = + Internals.getMethodBindPtr("CollisionPolygon2D", "get_polygon", 2961356807) + + internal val setBuildModePtr: VoidPtr = + Internals.getMethodBindPtr("CollisionPolygon2D", "set_build_mode", 2780803135) + + internal val getBuildModePtr: VoidPtr = + Internals.getMethodBindPtr("CollisionPolygon2D", "get_build_mode", 3044948800) + + internal val setDisabledPtr: VoidPtr = + Internals.getMethodBindPtr("CollisionPolygon2D", "set_disabled", 2586408642) + + internal val isDisabledPtr: VoidPtr = + Internals.getMethodBindPtr("CollisionPolygon2D", "is_disabled", 36873697) + + internal val setOneWayCollisionPtr: VoidPtr = + Internals.getMethodBindPtr("CollisionPolygon2D", "set_one_way_collision", 2586408642) + + internal val isOneWayCollisionEnabledPtr: VoidPtr = + Internals.getMethodBindPtr("CollisionPolygon2D", "is_one_way_collision_enabled", 36873697) + + internal val setOneWayCollisionMarginPtr: VoidPtr = + Internals.getMethodBindPtr("CollisionPolygon2D", "set_one_way_collision_margin", 373806689) + + internal val getOneWayCollisionMarginPtr: VoidPtr = + Internals.getMethodBindPtr("CollisionPolygon2D", "get_one_way_collision_margin", 1740695150) + } +} diff --git a/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/CollisionPolygon3D.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/CollisionPolygon3D.kt new file mode 100644 index 0000000000..d1b317b3fb --- /dev/null +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/CollisionPolygon3D.kt @@ -0,0 +1,156 @@ +// THIS FILE IS GENERATED! DO NOT EDIT IT MANUALLY! +@file:Suppress("PackageDirectoryMismatch", "unused", "FunctionName", "RedundantModalityModifier", + "UNCHECKED_CAST", "JoinDeclarationAndAssignment", "USELESS_CAST", + "RemoveRedundantQualifierName", "NOTHING_TO_INLINE", "NON_FINAL_MEMBER_IN_OBJECT", + "RedundantVisibilityModifier", "RedundantUnitReturnType", "MemberVisibilityCanBePrivate") + +package godot + +import godot.`annotation`.GodotBaseType +import godot.core.PackedVector2Array +import godot.core.VariantParser.BOOL +import godot.core.VariantParser.DOUBLE +import godot.core.VariantParser.NIL +import godot.core.VariantParser.PACKED_VECTOR2_ARRAY +import godot.util.Internals +import godot.util.VoidPtr +import kotlin.Boolean +import kotlin.Double +import kotlin.Float +import kotlin.Int +import kotlin.Suppress +import kotlin.Unit +import kotlin.jvm.JvmName + +private const val ENGINE_CLASS_COLLISIONPOLYGON3D_INDEX: Int = 189 + +/** + * A node that provides a thickened polygon shape (a prism) to a [CollisionObject3D] parent and + * allows to edit it. The polygon can be concave or convex. This can give a detection shape to an + * [Area3D] or turn [PhysicsBody3D] into a solid object. + * **Warning:** A non-uniformly scaled [CollisionShape3D] will likely not behave as expected. Make + * sure to keep its scale the same on all axes and adjust its shape resource instead. + */ +@GodotBaseType +public open class CollisionPolygon3D : Node3D() { + /** + * Length that the resulting collision extends in either direction perpendicular to its 2D + * polygon. + */ + public final inline var depth: Float + @JvmName("depthProperty") + get() = getDepth() + @JvmName("depthProperty") + set(`value`) { + setDepth(value) + } + + /** + * If `true`, no collision will be produced. + */ + public final inline var disabled: Boolean + @JvmName("disabledProperty") + get() = isDisabled() + @JvmName("disabledProperty") + set(`value`) { + setDisabled(value) + } + + /** + * Array of vertices which define the 2D polygon in the local XY plane. + */ + public final inline var polygon: PackedVector2Array + @JvmName("polygonProperty") + get() = getPolygon() + @JvmName("polygonProperty") + set(`value`) { + setPolygon(value) + } + + /** + * The collision margin for the generated [Shape3D]. See [Shape3D.margin] for more details. + */ + public final inline var margin: Float + @JvmName("marginProperty") + get() = getMargin() + @JvmName("marginProperty") + set(`value`) { + setMargin(value) + } + + public override fun new(scriptIndex: Int): Unit { + Internals.callConstructor(this, ENGINE_CLASS_COLLISIONPOLYGON3D_INDEX, scriptIndex) + } + + public final fun setDepth(depth: Float): Unit { + Internals.writeArguments(DOUBLE to depth.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setDepthPtr, NIL) + } + + public final fun getDepth(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getDepthPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setPolygon(polygon: PackedVector2Array): Unit { + Internals.writeArguments(PACKED_VECTOR2_ARRAY to polygon) + Internals.callMethod(rawPtr, MethodBindings.setPolygonPtr, NIL) + } + + public final fun getPolygon(): PackedVector2Array { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getPolygonPtr, PACKED_VECTOR2_ARRAY) + return (Internals.readReturnValue(PACKED_VECTOR2_ARRAY) as PackedVector2Array) + } + + public final fun setDisabled(disabled: Boolean): Unit { + Internals.writeArguments(BOOL to disabled) + Internals.callMethod(rawPtr, MethodBindings.setDisabledPtr, NIL) + } + + public final fun isDisabled(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isDisabledPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public final fun setMargin(margin: Float): Unit { + Internals.writeArguments(DOUBLE to margin.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setMarginPtr, NIL) + } + + public final fun getMargin(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getMarginPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public companion object + + public object MethodBindings { + internal val setDepthPtr: VoidPtr = + Internals.getMethodBindPtr("CollisionPolygon3D", "set_depth", 373806689) + + internal val getDepthPtr: VoidPtr = + Internals.getMethodBindPtr("CollisionPolygon3D", "get_depth", 1740695150) + + internal val setPolygonPtr: VoidPtr = + Internals.getMethodBindPtr("CollisionPolygon3D", "set_polygon", 1509147220) + + internal val getPolygonPtr: VoidPtr = + Internals.getMethodBindPtr("CollisionPolygon3D", "get_polygon", 2961356807) + + internal val setDisabledPtr: VoidPtr = + Internals.getMethodBindPtr("CollisionPolygon3D", "set_disabled", 2586408642) + + internal val isDisabledPtr: VoidPtr = + Internals.getMethodBindPtr("CollisionPolygon3D", "is_disabled", 36873697) + + internal val setMarginPtr: VoidPtr = + Internals.getMethodBindPtr("CollisionPolygon3D", "set_margin", 373806689) + + internal val getMarginPtr: VoidPtr = + Internals.getMethodBindPtr("CollisionPolygon3D", "get_margin", 1740695150) + } +} diff --git a/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/CollisionShape2D.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/CollisionShape2D.kt new file mode 100644 index 0000000000..a6da3eb3cf --- /dev/null +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/CollisionShape2D.kt @@ -0,0 +1,218 @@ +// THIS FILE IS GENERATED! DO NOT EDIT IT MANUALLY! +@file:Suppress("PackageDirectoryMismatch", "unused", "FunctionName", "RedundantModalityModifier", + "UNCHECKED_CAST", "JoinDeclarationAndAssignment", "USELESS_CAST", + "RemoveRedundantQualifierName", "NOTHING_TO_INLINE", "NON_FINAL_MEMBER_IN_OBJECT", + "RedundantVisibilityModifier", "RedundantUnitReturnType", "MemberVisibilityCanBePrivate") + +package godot + +import godot.`annotation`.CoreTypeHelper +import godot.`annotation`.CoreTypeLocalCopy +import godot.`annotation`.GodotBaseType +import godot.core.Color +import godot.core.VariantParser.BOOL +import godot.core.VariantParser.COLOR +import godot.core.VariantParser.DOUBLE +import godot.core.VariantParser.NIL +import godot.core.VariantParser.OBJECT +import godot.util.Internals +import godot.util.VoidPtr +import kotlin.Boolean +import kotlin.Double +import kotlin.Float +import kotlin.Int +import kotlin.Suppress +import kotlin.Unit +import kotlin.jvm.JvmName + +private const val ENGINE_CLASS_COLLISIONSHAPE2D_INDEX: Int = 190 + +/** + * A node that provides a [Shape2D] to a [CollisionObject2D] parent and allows to edit it. This can + * give a detection shape to an [Area2D] or turn a [PhysicsBody2D] into a solid object. + */ +@GodotBaseType +public open class CollisionShape2D : Node2D() { + /** + * The actual shape owned by this collision shape. + */ + public final inline var shape: Shape2D? + @JvmName("shapeProperty") + get() = getShape() + @JvmName("shapeProperty") + set(`value`) { + setShape(value) + } + + /** + * A disabled collision shape has no effect in the world. This property should be changed with + * [Object.setDeferred]. + */ + public final inline var disabled: Boolean + @JvmName("disabledProperty") + get() = isDisabled() + @JvmName("disabledProperty") + set(`value`) { + setDisabled(value) + } + + /** + * Sets whether this collision shape should only detect collision on one side (top or bottom). + * **Note:** This property has no effect if this [CollisionShape2D] is a child of an [Area2D] + * node. + */ + public final inline var oneWayCollision: Boolean + @JvmName("oneWayCollisionProperty") + get() = isOneWayCollisionEnabled() + @JvmName("oneWayCollisionProperty") + set(`value`) { + setOneWayCollision(value) + } + + /** + * The margin used for one-way collision (in pixels). Higher values will make the shape thicker, + * and work better for colliders that enter the shape at a high velocity. + */ + public final inline var oneWayCollisionMargin: Float + @JvmName("oneWayCollisionMarginProperty") + get() = getOneWayCollisionMargin() + @JvmName("oneWayCollisionMarginProperty") + set(`value`) { + setOneWayCollisionMargin(value) + } + + /** + * The collision shape debug color. + * **Note:** The default value is [ProjectSettings.debug/shapes/collision/shapeColor]. The + * `Color(0, 0, 0, 1)` value documented here is a placeholder, and not the actual default debug + * color. + */ + @CoreTypeLocalCopy + public final inline var debugColor: Color + @JvmName("debugColorProperty") + get() = getDebugColor() + @JvmName("debugColorProperty") + set(`value`) { + setDebugColor(value) + } + + public override fun new(scriptIndex: Int): Unit { + Internals.callConstructor(this, ENGINE_CLASS_COLLISIONSHAPE2D_INDEX, scriptIndex) + } + + /** + * The collision shape debug color. + * **Note:** The default value is [ProjectSettings.debug/shapes/collision/shapeColor]. The + * `Color(0, 0, 0, 1)` value documented here is a placeholder, and not the actual default debug + * color. + * + * This is a helper function to make dealing with local copies easier. + * + * For more information, see our + * [documentation](https://godot-kotl.in/en/stable/user-guide/api-differences/#core-types). + * + * Allow to directly modify the local copy of the property and assign it back to the Object. + * + * Prefer that over writing: + * `````` + * val myCoreType = collisionshape2d.debugColor + * //Your changes + * collisionshape2d.debugColor = myCoreType + * `````` + */ + @CoreTypeHelper + public final fun debugColorMutate(block: Color.() -> Unit): Color = debugColor.apply{ + block(this) + debugColor = this + } + + + public final fun setShape(shape: Shape2D?): Unit { + Internals.writeArguments(OBJECT to shape) + Internals.callMethod(rawPtr, MethodBindings.setShapePtr, NIL) + } + + public final fun getShape(): Shape2D? { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getShapePtr, OBJECT) + return (Internals.readReturnValue(OBJECT) as Shape2D?) + } + + public final fun setDisabled(disabled: Boolean): Unit { + Internals.writeArguments(BOOL to disabled) + Internals.callMethod(rawPtr, MethodBindings.setDisabledPtr, NIL) + } + + public final fun isDisabled(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isDisabledPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public final fun setOneWayCollision(enabled: Boolean): Unit { + Internals.writeArguments(BOOL to enabled) + Internals.callMethod(rawPtr, MethodBindings.setOneWayCollisionPtr, NIL) + } + + public final fun isOneWayCollisionEnabled(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isOneWayCollisionEnabledPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public final fun setOneWayCollisionMargin(margin: Float): Unit { + Internals.writeArguments(DOUBLE to margin.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setOneWayCollisionMarginPtr, NIL) + } + + public final fun getOneWayCollisionMargin(): Float { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getOneWayCollisionMarginPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() + } + + public final fun setDebugColor(color: Color): Unit { + Internals.writeArguments(COLOR to color) + Internals.callMethod(rawPtr, MethodBindings.setDebugColorPtr, NIL) + } + + public final fun getDebugColor(): Color { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getDebugColorPtr, COLOR) + return (Internals.readReturnValue(COLOR) as Color) + } + + public companion object + + public object MethodBindings { + internal val setShapePtr: VoidPtr = + Internals.getMethodBindPtr("CollisionShape2D", "set_shape", 771364740) + + internal val getShapePtr: VoidPtr = + Internals.getMethodBindPtr("CollisionShape2D", "get_shape", 522005891) + + internal val setDisabledPtr: VoidPtr = + Internals.getMethodBindPtr("CollisionShape2D", "set_disabled", 2586408642) + + internal val isDisabledPtr: VoidPtr = + Internals.getMethodBindPtr("CollisionShape2D", "is_disabled", 36873697) + + internal val setOneWayCollisionPtr: VoidPtr = + Internals.getMethodBindPtr("CollisionShape2D", "set_one_way_collision", 2586408642) + + internal val isOneWayCollisionEnabledPtr: VoidPtr = + Internals.getMethodBindPtr("CollisionShape2D", "is_one_way_collision_enabled", 36873697) + + internal val setOneWayCollisionMarginPtr: VoidPtr = + Internals.getMethodBindPtr("CollisionShape2D", "set_one_way_collision_margin", 373806689) + + internal val getOneWayCollisionMarginPtr: VoidPtr = + Internals.getMethodBindPtr("CollisionShape2D", "get_one_way_collision_margin", 1740695150) + + internal val setDebugColorPtr: VoidPtr = + Internals.getMethodBindPtr("CollisionShape2D", "set_debug_color", 2920490490) + + internal val getDebugColorPtr: VoidPtr = + Internals.getMethodBindPtr("CollisionShape2D", "get_debug_color", 3444240500) + } +} diff --git a/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/CollisionShape3D.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/CollisionShape3D.kt new file mode 100644 index 0000000000..c7c78e6724 --- /dev/null +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/CollisionShape3D.kt @@ -0,0 +1,117 @@ +// THIS FILE IS GENERATED! DO NOT EDIT IT MANUALLY! +@file:Suppress("PackageDirectoryMismatch", "unused", "FunctionName", "RedundantModalityModifier", + "UNCHECKED_CAST", "JoinDeclarationAndAssignment", "USELESS_CAST", + "RemoveRedundantQualifierName", "NOTHING_TO_INLINE", "NON_FINAL_MEMBER_IN_OBJECT", + "RedundantVisibilityModifier", "RedundantUnitReturnType", "MemberVisibilityCanBePrivate") + +package godot + +import godot.`annotation`.GodotBaseType +import godot.core.VariantParser.BOOL +import godot.core.VariantParser.NIL +import godot.core.VariantParser.OBJECT +import godot.util.Internals +import godot.util.VoidPtr +import kotlin.Boolean +import kotlin.Int +import kotlin.Suppress +import kotlin.Unit +import kotlin.jvm.JvmName + +private const val ENGINE_CLASS_COLLISIONSHAPE3D_INDEX: Int = 191 + +/** + * A node that provides a [Shape3D] to a [CollisionObject3D] parent and allows to edit it. This can + * give a detection shape to an [Area3D] or turn a [PhysicsBody3D] into a solid object. + * **Warning:** A non-uniformly scaled [CollisionShape3D] will likely not behave as expected. Make + * sure to keep its scale the same on all axes and adjust its [shape] resource instead. + */ +@GodotBaseType +public open class CollisionShape3D : Node3D() { + /** + * The actual shape owned by this collision shape. + */ + public final inline var shape: Shape3D? + @JvmName("shapeProperty") + get() = getShape() + @JvmName("shapeProperty") + set(`value`) { + setShape(value) + } + + /** + * A disabled collision shape has no effect in the world. + */ + public final inline var disabled: Boolean + @JvmName("disabledProperty") + get() = isDisabled() + @JvmName("disabledProperty") + set(`value`) { + setDisabled(value) + } + + public override fun new(scriptIndex: Int): Unit { + Internals.callConstructor(this, ENGINE_CLASS_COLLISIONSHAPE3D_INDEX, scriptIndex) + } + + /** + * This method does nothing. + */ + public final fun resourceChanged(resource: Resource?): Unit { + Internals.writeArguments(OBJECT to resource) + Internals.callMethod(rawPtr, MethodBindings.resourceChangedPtr, NIL) + } + + public final fun setShape(shape: Shape3D?): Unit { + Internals.writeArguments(OBJECT to shape) + Internals.callMethod(rawPtr, MethodBindings.setShapePtr, NIL) + } + + public final fun getShape(): Shape3D? { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getShapePtr, OBJECT) + return (Internals.readReturnValue(OBJECT) as Shape3D?) + } + + public final fun setDisabled(enable: Boolean): Unit { + Internals.writeArguments(BOOL to enable) + Internals.callMethod(rawPtr, MethodBindings.setDisabledPtr, NIL) + } + + public final fun isDisabled(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isDisabledPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + /** + * Sets the collision shape's shape to the addition of all its convexed [MeshInstance3D] siblings + * geometry. + */ + public final fun makeConvexFromSiblings(): Unit { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.makeConvexFromSiblingsPtr, NIL) + } + + public companion object + + public object MethodBindings { + internal val resourceChangedPtr: VoidPtr = + Internals.getMethodBindPtr("CollisionShape3D", "resource_changed", 968641751) + + internal val setShapePtr: VoidPtr = + Internals.getMethodBindPtr("CollisionShape3D", "set_shape", 1549710052) + + internal val getShapePtr: VoidPtr = + Internals.getMethodBindPtr("CollisionShape3D", "get_shape", 3214262478) + + internal val setDisabledPtr: VoidPtr = + Internals.getMethodBindPtr("CollisionShape3D", "set_disabled", 2586408642) + + internal val isDisabledPtr: VoidPtr = + Internals.getMethodBindPtr("CollisionShape3D", "is_disabled", 36873697) + + internal val makeConvexFromSiblingsPtr: VoidPtr = + Internals.getMethodBindPtr("CollisionShape3D", "make_convex_from_siblings", 3218959716) + } +} diff --git a/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/ColorPicker.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/ColorPicker.kt new file mode 100644 index 0000000000..1b44287dd7 --- /dev/null +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/ColorPicker.kt @@ -0,0 +1,541 @@ +// THIS FILE IS GENERATED! DO NOT EDIT IT MANUALLY! +@file:Suppress("PackageDirectoryMismatch", "unused", "FunctionName", "RedundantModalityModifier", + "UNCHECKED_CAST", "JoinDeclarationAndAssignment", "USELESS_CAST", + "RemoveRedundantQualifierName", "NOTHING_TO_INLINE", "NON_FINAL_MEMBER_IN_OBJECT", + "RedundantVisibilityModifier", "RedundantUnitReturnType", "MemberVisibilityCanBePrivate") + +package godot + +import godot.`annotation`.CoreTypeHelper +import godot.`annotation`.CoreTypeLocalCopy +import godot.`annotation`.GodotBaseType +import godot.core.Color +import godot.core.PackedColorArray +import godot.core.Signal1 +import godot.core.VariantParser.BOOL +import godot.core.VariantParser.COLOR +import godot.core.VariantParser.LONG +import godot.core.VariantParser.NIL +import godot.core.VariantParser.PACKED_COLOR_ARRAY +import godot.util.Internals +import godot.util.VoidPtr +import kotlin.Boolean +import kotlin.Int +import kotlin.Long +import kotlin.Suppress +import kotlin.Unit +import kotlin.jvm.JvmName + +private const val ENGINE_CLASS_COLORPICKER_INDEX: Int = 192 + +/** + * A widget that provides an interface for selecting or modifying a color. It can optionally provide + * functionalities like a color sampler (eyedropper), color modes, and presets. + * **Note:** This control is the color picker widget itself. You can use a [ColorPickerButton] + * instead if you need a button that brings up a [ColorPicker] in a popup. + */ +@GodotBaseType +public open class ColorPicker : VBoxContainer() { + /** + * Emitted when the color is changed. + */ + public val colorChanged: Signal1 by Signal1 + + /** + * Emitted when a preset is added. + */ + public val presetAdded: Signal1 by Signal1 + + /** + * Emitted when a preset is removed. + */ + public val presetRemoved: Signal1 by Signal1 + + /** + * The currently selected color. + */ + @CoreTypeLocalCopy + public final inline var color: Color + @JvmName("colorProperty") + get() = getPickColor() + @JvmName("colorProperty") + set(`value`) { + setPickColor(value) + } + + /** + * If `true`, shows an alpha channel slider (opacity). + */ + public final inline var editAlpha: Boolean + @JvmName("editAlphaProperty") + get() = isEditingAlpha() + @JvmName("editAlphaProperty") + set(`value`) { + setEditAlpha(value) + } + + /** + * The currently selected color mode. See [ColorModeType]. + */ + public final inline var colorMode: ColorModeType + @JvmName("colorModeProperty") + get() = getColorMode() + @JvmName("colorModeProperty") + set(`value`) { + setColorMode(value) + } + + /** + * If `true`, the color will apply only after the user releases the mouse button, otherwise it + * will apply immediately even in mouse motion event (which can cause performance issues). + */ + public final inline var deferredMode: Boolean + @JvmName("deferredModeProperty") + get() = isDeferredMode() + @JvmName("deferredModeProperty") + set(`value`) { + setDeferredMode(value) + } + + /** + * The shape of the color space view. See [PickerShapeType]. + */ + public final inline var pickerShape: PickerShapeType + @JvmName("pickerShapeProperty") + get() = getPickerShape() + @JvmName("pickerShapeProperty") + set(`value`) { + setPickerShape(value) + } + + /** + * If `true`, it's possible to add presets under Swatches. If `false`, the button to add presets + * is disabled. + */ + public final inline var canAddSwatches: Boolean + @JvmName("canAddSwatchesProperty") + get() = areSwatchesEnabled() + @JvmName("canAddSwatchesProperty") + set(`value`) { + setCanAddSwatches(value) + } + + /** + * If `true`, the color sampler and color preview are visible. + */ + public final inline var samplerVisible: Boolean + @JvmName("samplerVisibleProperty") + get() = isSamplerVisible() + @JvmName("samplerVisibleProperty") + set(`value`) { + setSamplerVisible(value) + } + + /** + * If `true`, the color mode buttons are visible. + */ + public final inline var colorModesVisible: Boolean + @JvmName("colorModesVisibleProperty") + get() = areModesVisible() + @JvmName("colorModesVisibleProperty") + set(`value`) { + setModesVisible(value) + } + + /** + * If `true`, the color sliders are visible. + */ + public final inline var slidersVisible: Boolean + @JvmName("slidersVisibleProperty") + get() = areSlidersVisible() + @JvmName("slidersVisibleProperty") + set(`value`) { + setSlidersVisible(value) + } + + /** + * If `true`, the hex color code input field is visible. + */ + public final inline var hexVisible: Boolean + @JvmName("hexVisibleProperty") + get() = isHexVisible() + @JvmName("hexVisibleProperty") + set(`value`) { + setHexVisible(value) + } + + /** + * If `true`, the Swatches and Recent Colors presets are visible. + */ + public final inline var presetsVisible: Boolean + @JvmName("presetsVisibleProperty") + get() = arePresetsVisible() + @JvmName("presetsVisibleProperty") + set(`value`) { + setPresetsVisible(value) + } + + public override fun new(scriptIndex: Int): Unit { + Internals.callConstructor(this, ENGINE_CLASS_COLORPICKER_INDEX, scriptIndex) + } + + /** + * The currently selected color. + * + * This is a helper function to make dealing with local copies easier. + * + * For more information, see our + * [documentation](https://godot-kotl.in/en/stable/user-guide/api-differences/#core-types). + * + * Allow to directly modify the local copy of the property and assign it back to the Object. + * + * Prefer that over writing: + * `````` + * val myCoreType = colorpicker.color + * //Your changes + * colorpicker.color = myCoreType + * `````` + */ + @CoreTypeHelper + public final fun colorMutate(block: Color.() -> Unit): Color = color.apply{ + block(this) + color = this + } + + + public final fun setPickColor(color: Color): Unit { + Internals.writeArguments(COLOR to color) + Internals.callMethod(rawPtr, MethodBindings.setPickColorPtr, NIL) + } + + public final fun getPickColor(): Color { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getPickColorPtr, COLOR) + return (Internals.readReturnValue(COLOR) as Color) + } + + public final fun setDeferredMode(mode: Boolean): Unit { + Internals.writeArguments(BOOL to mode) + Internals.callMethod(rawPtr, MethodBindings.setDeferredModePtr, NIL) + } + + public final fun isDeferredMode(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isDeferredModePtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public final fun setColorMode(colorMode: ColorModeType): Unit { + Internals.writeArguments(LONG to colorMode.id) + Internals.callMethod(rawPtr, MethodBindings.setColorModePtr, NIL) + } + + public final fun getColorMode(): ColorModeType { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getColorModePtr, LONG) + return ColorPicker.ColorModeType.from(Internals.readReturnValue(LONG) as Long) + } + + public final fun setEditAlpha(show: Boolean): Unit { + Internals.writeArguments(BOOL to show) + Internals.callMethod(rawPtr, MethodBindings.setEditAlphaPtr, NIL) + } + + public final fun isEditingAlpha(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isEditingAlphaPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public final fun setCanAddSwatches(enabled: Boolean): Unit { + Internals.writeArguments(BOOL to enabled) + Internals.callMethod(rawPtr, MethodBindings.setCanAddSwatchesPtr, NIL) + } + + public final fun areSwatchesEnabled(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.areSwatchesEnabledPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public final fun setPresetsVisible(visible: Boolean): Unit { + Internals.writeArguments(BOOL to visible) + Internals.callMethod(rawPtr, MethodBindings.setPresetsVisiblePtr, NIL) + } + + public final fun arePresetsVisible(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.arePresetsVisiblePtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public final fun setModesVisible(visible: Boolean): Unit { + Internals.writeArguments(BOOL to visible) + Internals.callMethod(rawPtr, MethodBindings.setModesVisiblePtr, NIL) + } + + public final fun areModesVisible(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.areModesVisiblePtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public final fun setSamplerVisible(visible: Boolean): Unit { + Internals.writeArguments(BOOL to visible) + Internals.callMethod(rawPtr, MethodBindings.setSamplerVisiblePtr, NIL) + } + + public final fun isSamplerVisible(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isSamplerVisiblePtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public final fun setSlidersVisible(visible: Boolean): Unit { + Internals.writeArguments(BOOL to visible) + Internals.callMethod(rawPtr, MethodBindings.setSlidersVisiblePtr, NIL) + } + + public final fun areSlidersVisible(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.areSlidersVisiblePtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public final fun setHexVisible(visible: Boolean): Unit { + Internals.writeArguments(BOOL to visible) + Internals.callMethod(rawPtr, MethodBindings.setHexVisiblePtr, NIL) + } + + public final fun isHexVisible(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isHexVisiblePtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + /** + * Adds the given color to a list of color presets. The presets are displayed in the color picker + * and the user will be able to select them. + * **Note:** The presets list is only for *this* color picker. + */ + public final fun addPreset(color: Color): Unit { + Internals.writeArguments(COLOR to color) + Internals.callMethod(rawPtr, MethodBindings.addPresetPtr, NIL) + } + + /** + * Removes the given color from the list of color presets of this color picker. + */ + public final fun erasePreset(color: Color): Unit { + Internals.writeArguments(COLOR to color) + Internals.callMethod(rawPtr, MethodBindings.erasePresetPtr, NIL) + } + + /** + * Returns the list of colors in the presets of the color picker. + */ + public final fun getPresets(): PackedColorArray { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getPresetsPtr, PACKED_COLOR_ARRAY) + return (Internals.readReturnValue(PACKED_COLOR_ARRAY) as PackedColorArray) + } + + /** + * Adds the given color to a list of color recent presets so that it can be picked later. Recent + * presets are the colors that were picked recently, a new preset is automatically created and added + * to recent presets when you pick a new color. + * **Note:** The recent presets list is only for *this* color picker. + */ + public final fun addRecentPreset(color: Color): Unit { + Internals.writeArguments(COLOR to color) + Internals.callMethod(rawPtr, MethodBindings.addRecentPresetPtr, NIL) + } + + /** + * Removes the given color from the list of color recent presets of this color picker. + */ + public final fun eraseRecentPreset(color: Color): Unit { + Internals.writeArguments(COLOR to color) + Internals.callMethod(rawPtr, MethodBindings.eraseRecentPresetPtr, NIL) + } + + /** + * Returns the list of colors in the recent presets of the color picker. + */ + public final fun getRecentPresets(): PackedColorArray { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getRecentPresetsPtr, PACKED_COLOR_ARRAY) + return (Internals.readReturnValue(PACKED_COLOR_ARRAY) as PackedColorArray) + } + + public final fun setPickerShape(shape: PickerShapeType): Unit { + Internals.writeArguments(LONG to shape.id) + Internals.callMethod(rawPtr, MethodBindings.setPickerShapePtr, NIL) + } + + public final fun getPickerShape(): PickerShapeType { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getPickerShapePtr, LONG) + return ColorPicker.PickerShapeType.from(Internals.readReturnValue(LONG) as Long) + } + + public enum class ColorModeType( + id: Long, + ) { + /** + * Allows editing the color with Red/Green/Blue sliders. + */ + MODE_RGB(0), + /** + * Allows editing the color with Hue/Saturation/Value sliders. + */ + MODE_HSV(1), + /** + * Allows the color R, G, B component values to go beyond 1.0, which can be used for certain + * special operations that require it (like tinting without darkening or rendering sprites in HDR). + */ + MODE_RAW(2), + /** + * Allows editing the color with Hue/Saturation/Lightness sliders. + * OKHSL is a new color space similar to HSL but that better match perception by leveraging the + * Oklab color space which is designed to be simple to use, while doing a good job at predicting + * perceived lightness, chroma and hue. + * [url=https://bottosson.github.io/posts/colorpicker/]Okhsv and Okhsl color spaces[/url] + */ + MODE_OKHSL(3), + ; + + public val id: Long + init { + this.id = id + } + + public companion object { + public fun from(`value`: Long): ColorModeType = entries.single { it.id == `value` } + } + } + + public enum class PickerShapeType( + id: Long, + ) { + /** + * HSV Color Model rectangle color space. + */ + SHAPE_HSV_RECTANGLE(0), + /** + * HSV Color Model rectangle color space with a wheel. + */ + SHAPE_HSV_WHEEL(1), + /** + * HSV Color Model circle color space. Use Saturation as a radius. + */ + SHAPE_VHS_CIRCLE(2), + /** + * HSL OK Color Model circle color space. + */ + SHAPE_OKHSL_CIRCLE(3), + /** + * The color space shape and the shape select button are hidden. Can't be selected from the + * shapes popup. + */ + SHAPE_NONE(4), + ; + + public val id: Long + init { + this.id = id + } + + public companion object { + public fun from(`value`: Long): PickerShapeType = entries.single { it.id == `value` } + } + } + + public companion object + + public object MethodBindings { + internal val setPickColorPtr: VoidPtr = + Internals.getMethodBindPtr("ColorPicker", "set_pick_color", 2920490490) + + internal val getPickColorPtr: VoidPtr = + Internals.getMethodBindPtr("ColorPicker", "get_pick_color", 3444240500) + + internal val setDeferredModePtr: VoidPtr = + Internals.getMethodBindPtr("ColorPicker", "set_deferred_mode", 2586408642) + + internal val isDeferredModePtr: VoidPtr = + Internals.getMethodBindPtr("ColorPicker", "is_deferred_mode", 36873697) + + internal val setColorModePtr: VoidPtr = + Internals.getMethodBindPtr("ColorPicker", "set_color_mode", 1579114136) + + internal val getColorModePtr: VoidPtr = + Internals.getMethodBindPtr("ColorPicker", "get_color_mode", 392907674) + + internal val setEditAlphaPtr: VoidPtr = + Internals.getMethodBindPtr("ColorPicker", "set_edit_alpha", 2586408642) + + internal val isEditingAlphaPtr: VoidPtr = + Internals.getMethodBindPtr("ColorPicker", "is_editing_alpha", 36873697) + + internal val setCanAddSwatchesPtr: VoidPtr = + Internals.getMethodBindPtr("ColorPicker", "set_can_add_swatches", 2586408642) + + internal val areSwatchesEnabledPtr: VoidPtr = + Internals.getMethodBindPtr("ColorPicker", "are_swatches_enabled", 36873697) + + internal val setPresetsVisiblePtr: VoidPtr = + Internals.getMethodBindPtr("ColorPicker", "set_presets_visible", 2586408642) + + internal val arePresetsVisiblePtr: VoidPtr = + Internals.getMethodBindPtr("ColorPicker", "are_presets_visible", 36873697) + + internal val setModesVisiblePtr: VoidPtr = + Internals.getMethodBindPtr("ColorPicker", "set_modes_visible", 2586408642) + + internal val areModesVisiblePtr: VoidPtr = + Internals.getMethodBindPtr("ColorPicker", "are_modes_visible", 36873697) + + internal val setSamplerVisiblePtr: VoidPtr = + Internals.getMethodBindPtr("ColorPicker", "set_sampler_visible", 2586408642) + + internal val isSamplerVisiblePtr: VoidPtr = + Internals.getMethodBindPtr("ColorPicker", "is_sampler_visible", 36873697) + + internal val setSlidersVisiblePtr: VoidPtr = + Internals.getMethodBindPtr("ColorPicker", "set_sliders_visible", 2586408642) + + internal val areSlidersVisiblePtr: VoidPtr = + Internals.getMethodBindPtr("ColorPicker", "are_sliders_visible", 36873697) + + internal val setHexVisiblePtr: VoidPtr = + Internals.getMethodBindPtr("ColorPicker", "set_hex_visible", 2586408642) + + internal val isHexVisiblePtr: VoidPtr = + Internals.getMethodBindPtr("ColorPicker", "is_hex_visible", 36873697) + + internal val addPresetPtr: VoidPtr = + Internals.getMethodBindPtr("ColorPicker", "add_preset", 2920490490) + + internal val erasePresetPtr: VoidPtr = + Internals.getMethodBindPtr("ColorPicker", "erase_preset", 2920490490) + + internal val getPresetsPtr: VoidPtr = + Internals.getMethodBindPtr("ColorPicker", "get_presets", 1392750486) + + internal val addRecentPresetPtr: VoidPtr = + Internals.getMethodBindPtr("ColorPicker", "add_recent_preset", 2920490490) + + internal val eraseRecentPresetPtr: VoidPtr = + Internals.getMethodBindPtr("ColorPicker", "erase_recent_preset", 2920490490) + + internal val getRecentPresetsPtr: VoidPtr = + Internals.getMethodBindPtr("ColorPicker", "get_recent_presets", 1392750486) + + internal val setPickerShapePtr: VoidPtr = + Internals.getMethodBindPtr("ColorPicker", "set_picker_shape", 3981373861) + + internal val getPickerShapePtr: VoidPtr = + Internals.getMethodBindPtr("ColorPicker", "get_picker_shape", 1143229889) + } +} diff --git a/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/ColorPickerButton.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/ColorPickerButton.kt new file mode 100644 index 0000000000..1537a51848 --- /dev/null +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/ColorPickerButton.kt @@ -0,0 +1,171 @@ +// THIS FILE IS GENERATED! DO NOT EDIT IT MANUALLY! +@file:Suppress("PackageDirectoryMismatch", "unused", "FunctionName", "RedundantModalityModifier", + "UNCHECKED_CAST", "JoinDeclarationAndAssignment", "USELESS_CAST", + "RemoveRedundantQualifierName", "NOTHING_TO_INLINE", "NON_FINAL_MEMBER_IN_OBJECT", + "RedundantVisibilityModifier", "RedundantUnitReturnType", "MemberVisibilityCanBePrivate") + +package godot + +import godot.`annotation`.CoreTypeHelper +import godot.`annotation`.CoreTypeLocalCopy +import godot.`annotation`.GodotBaseType +import godot.core.Color +import godot.core.Signal0 +import godot.core.Signal1 +import godot.core.VariantParser.BOOL +import godot.core.VariantParser.COLOR +import godot.core.VariantParser.NIL +import godot.core.VariantParser.OBJECT +import godot.util.Internals +import godot.util.VoidPtr +import kotlin.Boolean +import kotlin.Int +import kotlin.Suppress +import kotlin.Unit +import kotlin.jvm.JvmName + +private const val ENGINE_CLASS_COLORPICKERBUTTON_INDEX: Int = 193 + +/** + * Encapsulates a [ColorPicker], making it accessible by pressing a button. Pressing the button will + * toggle the [ColorPicker]'s visibility. + * See also [BaseButton] which contains common properties and methods associated with this node. + * **Note:** By default, the button may not be wide enough for the color preview swatch to be + * visible. Make sure to set [Control.customMinimumSize] to a big enough value to give the button + * enough space. + */ +@GodotBaseType +public open class ColorPickerButton : Button() { + /** + * Emitted when the color changes. + */ + public val colorChanged: Signal1 by Signal1 + + /** + * Emitted when the [ColorPicker] is closed. + */ + public val popupClosed: Signal0 by Signal0 + + /** + * Emitted when the [ColorPicker] is created (the button is pressed for the first time). + */ + public val pickerCreated: Signal0 by Signal0 + + /** + * The currently selected color. + */ + @CoreTypeLocalCopy + public final inline var color: Color + @JvmName("colorProperty") + get() = getPickColor() + @JvmName("colorProperty") + set(`value`) { + setPickColor(value) + } + + /** + * If `true`, the alpha channel in the displayed [ColorPicker] will be visible. + */ + public final inline var editAlpha: Boolean + @JvmName("editAlphaProperty") + get() = isEditingAlpha() + @JvmName("editAlphaProperty") + set(`value`) { + setEditAlpha(value) + } + + public override fun new(scriptIndex: Int): Unit { + Internals.callConstructor(this, ENGINE_CLASS_COLORPICKERBUTTON_INDEX, scriptIndex) + } + + /** + * The currently selected color. + * + * This is a helper function to make dealing with local copies easier. + * + * For more information, see our + * [documentation](https://godot-kotl.in/en/stable/user-guide/api-differences/#core-types). + * + * Allow to directly modify the local copy of the property and assign it back to the Object. + * + * Prefer that over writing: + * `````` + * val myCoreType = colorpickerbutton.color + * //Your changes + * colorpickerbutton.color = myCoreType + * `````` + */ + @CoreTypeHelper + public final fun colorMutate(block: Color.() -> Unit): Color = color.apply{ + block(this) + color = this + } + + + public final fun setPickColor(color: Color): Unit { + Internals.writeArguments(COLOR to color) + Internals.callMethod(rawPtr, MethodBindings.setPickColorPtr, NIL) + } + + public final fun getPickColor(): Color { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getPickColorPtr, COLOR) + return (Internals.readReturnValue(COLOR) as Color) + } + + /** + * Returns the [ColorPicker] that this node toggles. + * **Warning:** This is a required internal node, removing and freeing it may cause a crash. If + * you wish to hide it or any of its children, use their [CanvasItem.visible] property. + */ + public final fun getPicker(): ColorPicker? { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getPickerPtr, OBJECT) + return (Internals.readReturnValue(OBJECT) as ColorPicker?) + } + + /** + * Returns the control's [PopupPanel] which allows you to connect to popup signals. This allows + * you to handle events when the ColorPicker is shown or hidden. + * **Warning:** This is a required internal node, removing and freeing it may cause a crash. If + * you wish to hide it or any of its children, use their [Window.visible] property. + */ + public final fun getPopup(): PopupPanel? { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getPopupPtr, OBJECT) + return (Internals.readReturnValue(OBJECT) as PopupPanel?) + } + + public final fun setEditAlpha(show: Boolean): Unit { + Internals.writeArguments(BOOL to show) + Internals.callMethod(rawPtr, MethodBindings.setEditAlphaPtr, NIL) + } + + public final fun isEditingAlpha(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isEditingAlphaPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public companion object + + public object MethodBindings { + internal val setPickColorPtr: VoidPtr = + Internals.getMethodBindPtr("ColorPickerButton", "set_pick_color", 2920490490) + + internal val getPickColorPtr: VoidPtr = + Internals.getMethodBindPtr("ColorPickerButton", "get_pick_color", 3444240500) + + internal val getPickerPtr: VoidPtr = + Internals.getMethodBindPtr("ColorPickerButton", "get_picker", 331835996) + + internal val getPopupPtr: VoidPtr = + Internals.getMethodBindPtr("ColorPickerButton", "get_popup", 1322440207) + + internal val setEditAlphaPtr: VoidPtr = + Internals.getMethodBindPtr("ColorPickerButton", "set_edit_alpha", 2586408642) + + internal val isEditingAlphaPtr: VoidPtr = + Internals.getMethodBindPtr("ColorPickerButton", "is_editing_alpha", 36873697) + } +} diff --git a/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/ColorRect.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/ColorRect.kt new file mode 100644 index 0000000000..c8641d464e --- /dev/null +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/ColorRect.kt @@ -0,0 +1,90 @@ +// THIS FILE IS GENERATED! DO NOT EDIT IT MANUALLY! +@file:Suppress("PackageDirectoryMismatch", "unused", "FunctionName", "RedundantModalityModifier", + "UNCHECKED_CAST", "JoinDeclarationAndAssignment", "USELESS_CAST", + "RemoveRedundantQualifierName", "NOTHING_TO_INLINE", "NON_FINAL_MEMBER_IN_OBJECT", + "RedundantVisibilityModifier", "RedundantUnitReturnType", "MemberVisibilityCanBePrivate") + +package godot + +import godot.`annotation`.CoreTypeHelper +import godot.`annotation`.CoreTypeLocalCopy +import godot.`annotation`.GodotBaseType +import godot.core.Color +import godot.core.VariantParser.COLOR +import godot.core.VariantParser.NIL +import godot.util.Internals +import godot.util.VoidPtr +import kotlin.Int +import kotlin.Suppress +import kotlin.Unit +import kotlin.jvm.JvmName + +private const val ENGINE_CLASS_COLORRECT_INDEX: Int = 194 + +/** + * Displays a rectangle filled with a solid [color]. If you need to display the border alone, + * consider using a [Panel] instead. + */ +@GodotBaseType +public open class ColorRect : Control() { + /** + * The fill color of the rectangle. + */ + @CoreTypeLocalCopy + public final inline var color: Color + @JvmName("colorProperty") + get() = getColor() + @JvmName("colorProperty") + set(`value`) { + setColor(value) + } + + public override fun new(scriptIndex: Int): Unit { + Internals.callConstructor(this, ENGINE_CLASS_COLORRECT_INDEX, scriptIndex) + } + + /** + * The fill color of the rectangle. + * + * This is a helper function to make dealing with local copies easier. + * + * For more information, see our + * [documentation](https://godot-kotl.in/en/stable/user-guide/api-differences/#core-types). + * + * Allow to directly modify the local copy of the property and assign it back to the Object. + * + * Prefer that over writing: + * `````` + * val myCoreType = colorrect.color + * //Your changes + * colorrect.color = myCoreType + * `````` + */ + @CoreTypeHelper + public final fun colorMutate(block: Color.() -> Unit): Color = color.apply{ + block(this) + color = this + } + + + public final fun setColor(color: Color): Unit { + Internals.writeArguments(COLOR to color) + Internals.callMethod(rawPtr, MethodBindings.setColorPtr, NIL) + } + + public final fun getColor(): Color { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getColorPtr, COLOR) + return (Internals.readReturnValue(COLOR) as Color) + } + + public companion object + + public object MethodBindings { + internal val setColorPtr: VoidPtr = + Internals.getMethodBindPtr("ColorRect", "set_color", 2920490490) + + internal val getColorPtr: VoidPtr = + Internals.getMethodBindPtr("ColorRect", "get_color", 3444240500) + } +} diff --git a/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/Compositor.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/Compositor.kt new file mode 100644 index 0000000000..06a3bd84ec --- /dev/null +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/Compositor.kt @@ -0,0 +1,63 @@ +// THIS FILE IS GENERATED! DO NOT EDIT IT MANUALLY! +@file:Suppress("PackageDirectoryMismatch", "unused", "FunctionName", "RedundantModalityModifier", + "UNCHECKED_CAST", "JoinDeclarationAndAssignment", "USELESS_CAST", + "RemoveRedundantQualifierName", "NOTHING_TO_INLINE", "NON_FINAL_MEMBER_IN_OBJECT", + "RedundantVisibilityModifier", "RedundantUnitReturnType", "MemberVisibilityCanBePrivate") + +package godot + +import godot.`annotation`.GodotBaseType +import godot.core.VariantArray +import godot.core.VariantParser.ARRAY +import godot.core.VariantParser.NIL +import godot.util.Internals +import godot.util.VoidPtr +import kotlin.Int +import kotlin.Suppress +import kotlin.Unit +import kotlin.jvm.JvmName + +private const val ENGINE_CLASS_COMPOSITOR_INDEX: Int = 195 + +/** + * The compositor resource stores attributes used to customize how a [Viewport] is rendered. + */ +@GodotBaseType +public open class Compositor : Resource() { + /** + * The custom [CompositorEffect]s that are applied during rendering of viewports using this + * compositor. + */ + public final inline var compositorEffects: VariantArray + @JvmName("compositorEffectsProperty") + get() = getCompositorEffects() + @JvmName("compositorEffectsProperty") + set(`value`) { + setCompositorEffects(value) + } + + public override fun new(scriptIndex: Int): Unit { + Internals.callConstructor(this, ENGINE_CLASS_COMPOSITOR_INDEX, scriptIndex) + } + + public final fun setCompositorEffects(compositorEffects: VariantArray): Unit { + Internals.writeArguments(ARRAY to compositorEffects) + Internals.callMethod(rawPtr, MethodBindings.setCompositorEffectsPtr, NIL) + } + + public final fun getCompositorEffects(): VariantArray { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getCompositorEffectsPtr, ARRAY) + return (Internals.readReturnValue(ARRAY) as VariantArray) + } + + public companion object + + public object MethodBindings { + internal val setCompositorEffectsPtr: VoidPtr = + Internals.getMethodBindPtr("Compositor", "set_compositor_effects", 381264803) + + internal val getCompositorEffectsPtr: VoidPtr = + Internals.getMethodBindPtr("Compositor", "get_compositor_effects", 3995934104) + } +} diff --git a/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/CompositorEffect.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/CompositorEffect.kt new file mode 100644 index 0000000000..607d666c26 --- /dev/null +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/CompositorEffect.kt @@ -0,0 +1,313 @@ +// THIS FILE IS GENERATED! DO NOT EDIT IT MANUALLY! +@file:Suppress("PackageDirectoryMismatch", "unused", "FunctionName", "RedundantModalityModifier", + "UNCHECKED_CAST", "JoinDeclarationAndAssignment", "USELESS_CAST", + "RemoveRedundantQualifierName", "NOTHING_TO_INLINE", "NON_FINAL_MEMBER_IN_OBJECT", + "RedundantVisibilityModifier", "RedundantUnitReturnType", "MemberVisibilityCanBePrivate") + +package godot + +import godot.`annotation`.GodotBaseType +import godot.core.VariantParser.BOOL +import godot.core.VariantParser.LONG +import godot.core.VariantParser.NIL +import godot.util.Internals +import godot.util.VoidPtr +import kotlin.Boolean +import kotlin.Int +import kotlin.Long +import kotlin.Suppress +import kotlin.Unit +import kotlin.jvm.JvmName + +private const val ENGINE_CLASS_COMPOSITOREFFECT_INDEX: Int = 196 + +/** + * This resource defines a custom rendering effect that can be applied to [Viewport]s through the + * viewports' [Environment]. You can implement a callback that is called during rendering at a given + * stage of the rendering pipeline and allows you to insert additional passes. Note that this callback + * happens on the rendering thread. CompositorEffect is an abstract base class and must be extended to + * implement specific rendering logic. + */ +@GodotBaseType +public open class CompositorEffect : Resource() { + /** + * If `true` this rendering effect is applied to any viewport it is added to. + */ + public final inline var enabled: Boolean + @JvmName("enabledProperty") + get() = getEnabled() + @JvmName("enabledProperty") + set(`value`) { + setEnabled(value) + } + + /** + * The type of effect that is implemented, determines at what stage of rendering the callback is + * called. + */ + public final inline var effectCallbackType: EffectCallbackType + @JvmName("effectCallbackTypeProperty") + get() = getEffectCallbackType() + @JvmName("effectCallbackTypeProperty") + set(`value`) { + setEffectCallbackType(value) + } + + /** + * If `true` and MSAA is enabled, this will trigger a color buffer resolve before the effect is + * run. + * **Note:** In [_renderCallback], to access the resolved buffer use: + * [codeblock] + * var render_scene_buffers : RenderSceneBuffersRD = render_data.get_render_scene_buffers() + * var color_buffer = render_scene_buffers.get_texture("render_buffers", "color") + * [/codeblock] + */ + public final inline var accessResolvedColor: Boolean + @JvmName("accessResolvedColorProperty") + get() = getAccessResolvedColor() + @JvmName("accessResolvedColorProperty") + set(`value`) { + setAccessResolvedColor(value) + } + + /** + * If `true` and MSAA is enabled, this will trigger a depth buffer resolve before the effect is + * run. + * **Note:** In [_renderCallback], to access the resolved buffer use: + * [codeblock] + * var render_scene_buffers : RenderSceneBuffersRD = render_data.get_render_scene_buffers() + * var depth_buffer = render_scene_buffers.get_texture("render_buffers", "depth") + * [/codeblock] + */ + public final inline var accessResolvedDepth: Boolean + @JvmName("accessResolvedDepthProperty") + get() = getAccessResolvedDepth() + @JvmName("accessResolvedDepthProperty") + set(`value`) { + setAccessResolvedDepth(value) + } + + /** + * If `true` this triggers motion vectors being calculated during the opaque render state. + * **Note:** In [_renderCallback], to access the motion vector buffer use: + * [codeblock] + * var render_scene_buffers : RenderSceneBuffersRD = render_data.get_render_scene_buffers() + * var motion_buffer = render_scene_buffers.get_velocity_texture() + * [/codeblock] + */ + public final inline var needsMotionVectors: Boolean + @JvmName("needsMotionVectorsProperty") + get() = getNeedsMotionVectors() + @JvmName("needsMotionVectorsProperty") + set(`value`) { + setNeedsMotionVectors(value) + } + + /** + * If `true` this triggers normal and roughness data to be output during our depth pre-pass, only + * applicable for the Forward+ renderer. + * **Note:** In [_renderCallback], to access the roughness buffer use: + * [codeblock] + * var render_scene_buffers : RenderSceneBuffersRD = render_data.get_render_scene_buffers() + * var roughness_buffer = render_scene_buffers.get_texture("forward_clustered", + * "normal_roughness") + * [/codeblock] + */ + public final inline var needsNormalRoughness: Boolean + @JvmName("needsNormalRoughnessProperty") + get() = getNeedsNormalRoughness() + @JvmName("needsNormalRoughnessProperty") + set(`value`) { + setNeedsNormalRoughness(value) + } + + /** + * If `true` this triggers specular data being rendered to a separate buffer and combined after + * effects have been applied, only applicable for the Forward+ renderer. + */ + public final inline var needsSeparateSpecular: Boolean + @JvmName("needsSeparateSpecularProperty") + get() = getNeedsSeparateSpecular() + @JvmName("needsSeparateSpecularProperty") + set(`value`) { + setNeedsSeparateSpecular(value) + } + + public override fun new(scriptIndex: Int): Unit { + Internals.callConstructor(this, ENGINE_CLASS_COMPOSITOREFFECT_INDEX, scriptIndex) + } + + /** + * Implement this function with your custom rendering code. [effectCallbackType] should always + * match the effect callback type you've specified in [effectCallbackType]. [renderData] provides + * access to the rendering state, it is only valid during rendering and should not be stored. + */ + public open fun _renderCallback(effectCallbackType: Int, renderData: RenderData?): Unit { + } + + public final fun setEnabled(enabled: Boolean): Unit { + Internals.writeArguments(BOOL to enabled) + Internals.callMethod(rawPtr, MethodBindings.setEnabledPtr, NIL) + } + + public final fun getEnabled(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getEnabledPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public final fun setEffectCallbackType(effectCallbackType: EffectCallbackType): Unit { + Internals.writeArguments(LONG to effectCallbackType.id) + Internals.callMethod(rawPtr, MethodBindings.setEffectCallbackTypePtr, NIL) + } + + public final fun getEffectCallbackType(): EffectCallbackType { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getEffectCallbackTypePtr, LONG) + return CompositorEffect.EffectCallbackType.from(Internals.readReturnValue(LONG) as Long) + } + + public final fun setAccessResolvedColor(enable: Boolean): Unit { + Internals.writeArguments(BOOL to enable) + Internals.callMethod(rawPtr, MethodBindings.setAccessResolvedColorPtr, NIL) + } + + public final fun getAccessResolvedColor(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getAccessResolvedColorPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public final fun setAccessResolvedDepth(enable: Boolean): Unit { + Internals.writeArguments(BOOL to enable) + Internals.callMethod(rawPtr, MethodBindings.setAccessResolvedDepthPtr, NIL) + } + + public final fun getAccessResolvedDepth(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getAccessResolvedDepthPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public final fun setNeedsMotionVectors(enable: Boolean): Unit { + Internals.writeArguments(BOOL to enable) + Internals.callMethod(rawPtr, MethodBindings.setNeedsMotionVectorsPtr, NIL) + } + + public final fun getNeedsMotionVectors(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getNeedsMotionVectorsPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public final fun setNeedsNormalRoughness(enable: Boolean): Unit { + Internals.writeArguments(BOOL to enable) + Internals.callMethod(rawPtr, MethodBindings.setNeedsNormalRoughnessPtr, NIL) + } + + public final fun getNeedsNormalRoughness(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getNeedsNormalRoughnessPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public final fun setNeedsSeparateSpecular(enable: Boolean): Unit { + Internals.writeArguments(BOOL to enable) + Internals.callMethod(rawPtr, MethodBindings.setNeedsSeparateSpecularPtr, NIL) + } + + public final fun getNeedsSeparateSpecular(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getNeedsSeparateSpecularPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public enum class EffectCallbackType( + id: Long, + ) { + /** + * The callback is called before our opaque rendering pass, but after depth prepass (if + * applicable). + */ + EFFECT_CALLBACK_TYPE_PRE_OPAQUE(0), + /** + * The callback is called after our opaque rendering pass, but before our sky is rendered. + */ + EFFECT_CALLBACK_TYPE_POST_OPAQUE(1), + /** + * The callback is called after our sky is rendered, but before our back buffers are created + * (and if enabled, before subsurface scattering and/or screen space reflections). + */ + EFFECT_CALLBACK_TYPE_POST_SKY(2), + /** + * The callback is called before our transparent rendering pass, but after our sky is rendered + * and we've created our back buffers. + */ + EFFECT_CALLBACK_TYPE_PRE_TRANSPARENT(3), + /** + * The callback is called after our transparent rendering pass, but before any build in post + * effects and output to our render target. + */ + EFFECT_CALLBACK_TYPE_POST_TRANSPARENT(4), + /** + * Represents the size of the [EffectCallbackType] enum. + */ + EFFECT_CALLBACK_TYPE_MAX(5), + ; + + public val id: Long + init { + this.id = id + } + + public companion object { + public fun from(`value`: Long): EffectCallbackType = entries.single { it.id == `value` } + } + } + + public companion object + + public object MethodBindings { + internal val setEnabledPtr: VoidPtr = + Internals.getMethodBindPtr("CompositorEffect", "set_enabled", 2586408642) + + internal val getEnabledPtr: VoidPtr = + Internals.getMethodBindPtr("CompositorEffect", "get_enabled", 36873697) + + internal val setEffectCallbackTypePtr: VoidPtr = + Internals.getMethodBindPtr("CompositorEffect", "set_effect_callback_type", 1390728419) + + internal val getEffectCallbackTypePtr: VoidPtr = + Internals.getMethodBindPtr("CompositorEffect", "get_effect_callback_type", 1221912590) + + internal val setAccessResolvedColorPtr: VoidPtr = + Internals.getMethodBindPtr("CompositorEffect", "set_access_resolved_color", 2586408642) + + internal val getAccessResolvedColorPtr: VoidPtr = + Internals.getMethodBindPtr("CompositorEffect", "get_access_resolved_color", 36873697) + + internal val setAccessResolvedDepthPtr: VoidPtr = + Internals.getMethodBindPtr("CompositorEffect", "set_access_resolved_depth", 2586408642) + + internal val getAccessResolvedDepthPtr: VoidPtr = + Internals.getMethodBindPtr("CompositorEffect", "get_access_resolved_depth", 36873697) + + internal val setNeedsMotionVectorsPtr: VoidPtr = + Internals.getMethodBindPtr("CompositorEffect", "set_needs_motion_vectors", 2586408642) + + internal val getNeedsMotionVectorsPtr: VoidPtr = + Internals.getMethodBindPtr("CompositorEffect", "get_needs_motion_vectors", 36873697) + + internal val setNeedsNormalRoughnessPtr: VoidPtr = + Internals.getMethodBindPtr("CompositorEffect", "set_needs_normal_roughness", 2586408642) + + internal val getNeedsNormalRoughnessPtr: VoidPtr = + Internals.getMethodBindPtr("CompositorEffect", "get_needs_normal_roughness", 36873697) + + internal val setNeedsSeparateSpecularPtr: VoidPtr = + Internals.getMethodBindPtr("CompositorEffect", "set_needs_separate_specular", 2586408642) + + internal val getNeedsSeparateSpecularPtr: VoidPtr = + Internals.getMethodBindPtr("CompositorEffect", "get_needs_separate_specular", 36873697) + } +} diff --git a/kt/godot-library/src/main/kotlin/godot/gen/godot/CompressedCubemap.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/CompressedCubemap.kt similarity index 89% rename from kt/godot-library/src/main/kotlin/godot/gen/godot/CompressedCubemap.kt rename to kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/CompressedCubemap.kt index 9700f91bdb..7b09f2739a 100644 --- a/kt/godot-library/src/main/kotlin/godot/gen/godot/CompressedCubemap.kt +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/CompressedCubemap.kt @@ -7,10 +7,13 @@ package godot import godot.`annotation`.GodotBaseType +import godot.util.Internals import kotlin.Int import kotlin.Suppress import kotlin.Unit +private const val ENGINE_CLASS_COMPRESSEDCUBEMAP_INDEX: Int = 197 + /** * A cubemap that is loaded from a `.ccube` file. This file format is internal to Godot; it is * created by importing other image formats with the import system. [CompressedCubemap] can use one of @@ -32,10 +35,10 @@ import kotlin.Unit @GodotBaseType public open class CompressedCubemap : CompressedTextureLayered() { public override fun new(scriptIndex: Int): Unit { - callConstructor(ENGINECLASS_COMPRESSEDCUBEMAP, scriptIndex) + Internals.callConstructor(this, ENGINE_CLASS_COMPRESSEDCUBEMAP_INDEX, scriptIndex) } public companion object - internal object MethodBindings + public object MethodBindings } diff --git a/kt/godot-library/src/main/kotlin/godot/gen/godot/CompressedCubemapArray.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/CompressedCubemapArray.kt similarity index 89% rename from kt/godot-library/src/main/kotlin/godot/gen/godot/CompressedCubemapArray.kt rename to kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/CompressedCubemapArray.kt index 1aef0ac424..9138f9cec7 100644 --- a/kt/godot-library/src/main/kotlin/godot/gen/godot/CompressedCubemapArray.kt +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/CompressedCubemapArray.kt @@ -7,10 +7,13 @@ package godot import godot.`annotation`.GodotBaseType +import godot.util.Internals import kotlin.Int import kotlin.Suppress import kotlin.Unit +private const val ENGINE_CLASS_COMPRESSEDCUBEMAPARRAY_INDEX: Int = 198 + /** * A cubemap array that is loaded from a `.ccubearray` file. This file format is internal to Godot; * it is created by importing other image formats with the import system. [CompressedCubemapArray] can @@ -32,10 +35,10 @@ import kotlin.Unit @GodotBaseType public open class CompressedCubemapArray : CompressedTextureLayered() { public override fun new(scriptIndex: Int): Unit { - callConstructor(ENGINECLASS_COMPRESSEDCUBEMAPARRAY, scriptIndex) + Internals.callConstructor(this, ENGINE_CLASS_COMPRESSEDCUBEMAPARRAY_INDEX, scriptIndex) } public companion object - internal object MethodBindings + public object MethodBindings } diff --git a/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/CompressedTexture2D.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/CompressedTexture2D.kt new file mode 100644 index 0000000000..c23cf59008 --- /dev/null +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/CompressedTexture2D.kt @@ -0,0 +1,77 @@ +// THIS FILE IS GENERATED! DO NOT EDIT IT MANUALLY! +@file:Suppress("PackageDirectoryMismatch", "unused", "FunctionName", "RedundantModalityModifier", + "UNCHECKED_CAST", "JoinDeclarationAndAssignment", "USELESS_CAST", + "RemoveRedundantQualifierName", "NOTHING_TO_INLINE", "NON_FINAL_MEMBER_IN_OBJECT", + "RedundantVisibilityModifier", "RedundantUnitReturnType", "MemberVisibilityCanBePrivate") + +package godot + +import godot.`annotation`.GodotBaseType +import godot.core.VariantParser.LONG +import godot.core.VariantParser.STRING +import godot.util.Internals +import godot.util.VoidPtr +import kotlin.Int +import kotlin.Long +import kotlin.String +import kotlin.Suppress +import kotlin.Unit +import kotlin.jvm.JvmName + +private const val ENGINE_CLASS_COMPRESSEDTEXTURE2D_INDEX: Int = 199 + +/** + * A texture that is loaded from a `.ctex` file. This file format is internal to Godot; it is + * created by importing other image formats with the import system. [CompressedTexture2D] can use one + * of 4 compression methods (including a lack of any compression): + * - Lossless (WebP or PNG, uncompressed on the GPU) + * - Lossy (WebP, uncompressed on the GPU) + * - VRAM Compressed (compressed on the GPU) + * - VRAM Uncompressed (uncompressed on the GPU) + * - Basis Universal (compressed on the GPU. Lower file sizes than VRAM Compressed, but slower to + * compress and lower quality than VRAM Compressed) + * Only **VRAM Compressed** actually reduces the memory usage on the GPU. The **Lossless** and + * **Lossy** compression methods will reduce the required storage on disk, but they will not reduce + * memory usage on the GPU as the texture is sent to the GPU uncompressed. + * Using **VRAM Compressed** also improves loading times, as VRAM-compressed textures are faster to + * load compared to textures using lossless or lossy compression. VRAM compression can exhibit + * noticeable artifacts and is intended to be used for 3D rendering, not 2D. + */ +@GodotBaseType +public open class CompressedTexture2D : Texture2D() { + /** + * The [CompressedTexture2D]'s file path to a `.ctex` file. + */ + public final inline val loadPath: String + @JvmName("loadPathProperty") + get() = getLoadPath() + + public override fun new(scriptIndex: Int): Unit { + Internals.callConstructor(this, ENGINE_CLASS_COMPRESSEDTEXTURE2D_INDEX, scriptIndex) + } + + /** + * Loads the texture from the specified [path]. + */ + public final fun load(path: String): Error { + Internals.writeArguments(STRING to path) + Internals.callMethod(rawPtr, MethodBindings.loadPtr, LONG) + return Error.from(Internals.readReturnValue(LONG) as Long) + } + + public final fun getLoadPath(): String { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getLoadPathPtr, STRING) + return (Internals.readReturnValue(STRING) as String) + } + + public companion object + + public object MethodBindings { + internal val loadPtr: VoidPtr = + Internals.getMethodBindPtr("CompressedTexture2D", "load", 166001499) + + internal val getLoadPathPtr: VoidPtr = + Internals.getMethodBindPtr("CompressedTexture2D", "get_load_path", 201670096) + } +} diff --git a/kt/godot-library/src/main/kotlin/godot/gen/godot/CompressedTexture2DArray.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/CompressedTexture2DArray.kt similarity index 89% rename from kt/godot-library/src/main/kotlin/godot/gen/godot/CompressedTexture2DArray.kt rename to kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/CompressedTexture2DArray.kt index 68cf726e6b..c1e17e03ae 100644 --- a/kt/godot-library/src/main/kotlin/godot/gen/godot/CompressedTexture2DArray.kt +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/CompressedTexture2DArray.kt @@ -7,10 +7,13 @@ package godot import godot.`annotation`.GodotBaseType +import godot.util.Internals import kotlin.Int import kotlin.Suppress import kotlin.Unit +private const val ENGINE_CLASS_COMPRESSEDTEXTURE2DARRAY_INDEX: Int = 200 + /** * A texture array that is loaded from a `.ctexarray` file. This file format is internal to Godot; * it is created by importing other image formats with the import system. [CompressedTexture2DArray] @@ -32,10 +35,10 @@ import kotlin.Unit @GodotBaseType public open class CompressedTexture2DArray : CompressedTextureLayered() { public override fun new(scriptIndex: Int): Unit { - callConstructor(ENGINECLASS_COMPRESSEDTEXTURE2DARRAY, scriptIndex) + Internals.callConstructor(this, ENGINE_CLASS_COMPRESSEDTEXTURE2DARRAY_INDEX, scriptIndex) } public companion object - internal object MethodBindings + public object MethodBindings } diff --git a/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/CompressedTexture3D.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/CompressedTexture3D.kt new file mode 100644 index 0000000000..2f92efe77f --- /dev/null +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/CompressedTexture3D.kt @@ -0,0 +1,70 @@ +// THIS FILE IS GENERATED! DO NOT EDIT IT MANUALLY! +@file:Suppress("PackageDirectoryMismatch", "unused", "FunctionName", "RedundantModalityModifier", + "UNCHECKED_CAST", "JoinDeclarationAndAssignment", "USELESS_CAST", + "RemoveRedundantQualifierName", "NOTHING_TO_INLINE", "NON_FINAL_MEMBER_IN_OBJECT", + "RedundantVisibilityModifier", "RedundantUnitReturnType", "MemberVisibilityCanBePrivate") + +package godot + +import godot.`annotation`.GodotBaseType +import godot.core.VariantParser.LONG +import godot.core.VariantParser.STRING +import godot.util.Internals +import godot.util.VoidPtr +import kotlin.Int +import kotlin.Long +import kotlin.String +import kotlin.Suppress +import kotlin.Unit +import kotlin.jvm.JvmName + +private const val ENGINE_CLASS_COMPRESSEDTEXTURE3D_INDEX: Int = 201 + +/** + * [CompressedTexture3D] is the VRAM-compressed counterpart of [ImageTexture3D]. The file extension + * for [CompressedTexture3D] files is `.ctex3d`. This file format is internal to Godot; it is created + * by importing other image formats with the import system. + * [CompressedTexture3D] uses VRAM compression, which allows to reduce memory usage on the GPU when + * rendering the texture. This also improves loading times, as VRAM-compressed textures are faster to + * load compared to textures using lossless compression. VRAM compression can exhibit noticeable + * artifacts and is intended to be used for 3D rendering, not 2D. + * See [Texture3D] for a general description of 3D textures. + */ +@GodotBaseType +public open class CompressedTexture3D : Texture3D() { + /** + * The [CompressedTexture3D]'s file path to a `.ctex3d` file. + */ + public final inline val loadPath: String + @JvmName("loadPathProperty") + get() = getLoadPath() + + public override fun new(scriptIndex: Int): Unit { + Internals.callConstructor(this, ENGINE_CLASS_COMPRESSEDTEXTURE3D_INDEX, scriptIndex) + } + + /** + * Loads the texture from the specified [path]. + */ + public final fun load(path: String): Error { + Internals.writeArguments(STRING to path) + Internals.callMethod(rawPtr, MethodBindings.loadPtr, LONG) + return Error.from(Internals.readReturnValue(LONG) as Long) + } + + public final fun getLoadPath(): String { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getLoadPathPtr, STRING) + return (Internals.readReturnValue(STRING) as String) + } + + public companion object + + public object MethodBindings { + internal val loadPtr: VoidPtr = + Internals.getMethodBindPtr("CompressedTexture3D", "load", 166001499) + + internal val getLoadPathPtr: VoidPtr = + Internals.getMethodBindPtr("CompressedTexture3D", "get_load_path", 201670096) + } +} diff --git a/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/CompressedTextureLayered.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/CompressedTextureLayered.kt new file mode 100644 index 0000000000..f208894662 --- /dev/null +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/CompressedTextureLayered.kt @@ -0,0 +1,65 @@ +// THIS FILE IS GENERATED! DO NOT EDIT IT MANUALLY! +@file:Suppress("PackageDirectoryMismatch", "unused", "FunctionName", "RedundantModalityModifier", + "UNCHECKED_CAST", "JoinDeclarationAndAssignment", "USELESS_CAST", + "RemoveRedundantQualifierName", "NOTHING_TO_INLINE", "NON_FINAL_MEMBER_IN_OBJECT", + "RedundantVisibilityModifier", "RedundantUnitReturnType", "MemberVisibilityCanBePrivate") + +package godot + +import godot.`annotation`.GodotBaseType +import godot.core.VariantParser.LONG +import godot.core.VariantParser.STRING +import godot.util.Internals +import godot.util.VoidPtr +import kotlin.Int +import kotlin.Long +import kotlin.String +import kotlin.Suppress +import kotlin.Unit +import kotlin.jvm.JvmName + +private const val ENGINE_CLASS_COMPRESSEDTEXTURELAYERED_INDEX: Int = 202 + +/** + * Base class for [CompressedTexture2DArray] and [CompressedTexture3D]. Cannot be used directly, but + * contains all the functions necessary for accessing the derived resource types. See also + * [TextureLayered]. + */ +@GodotBaseType +public open class CompressedTextureLayered internal constructor() : TextureLayered() { + /** + * The path the texture should be loaded from. + */ + public final inline val loadPath: String + @JvmName("loadPathProperty") + get() = getLoadPath() + + public override fun new(scriptIndex: Int): Unit { + Internals.callConstructor(this, ENGINE_CLASS_COMPRESSEDTEXTURELAYERED_INDEX, scriptIndex) + } + + /** + * Loads the texture at [path]. + */ + public final fun load(path: String): Error { + Internals.writeArguments(STRING to path) + Internals.callMethod(rawPtr, MethodBindings.loadPtr, LONG) + return Error.from(Internals.readReturnValue(LONG) as Long) + } + + public final fun getLoadPath(): String { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getLoadPathPtr, STRING) + return (Internals.readReturnValue(STRING) as String) + } + + public companion object + + public object MethodBindings { + internal val loadPtr: VoidPtr = + Internals.getMethodBindPtr("CompressedTextureLayered", "load", 166001499) + + internal val getLoadPathPtr: VoidPtr = + Internals.getMethodBindPtr("CompressedTextureLayered", "get_load_path", 201670096) + } +} diff --git a/kt/godot-library/src/main/kotlin/godot/gen/godot/ConcavePolygonShape2D.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/ConcavePolygonShape2D.kt similarity index 78% rename from kt/godot-library/src/main/kotlin/godot/gen/godot/ConcavePolygonShape2D.kt rename to kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/ConcavePolygonShape2D.kt index 6a1c97ac12..6606616d8d 100644 --- a/kt/godot-library/src/main/kotlin/godot/gen/godot/ConcavePolygonShape2D.kt +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/ConcavePolygonShape2D.kt @@ -8,16 +8,17 @@ package godot import godot.`annotation`.GodotBaseType import godot.core.PackedVector2Array -import godot.core.TypeManager import godot.core.VariantParser.NIL import godot.core.VariantParser.PACKED_VECTOR2_ARRAY -import godot.core.memory.TransferContext +import godot.util.Internals import godot.util.VoidPtr import kotlin.Int import kotlin.Suppress import kotlin.Unit import kotlin.jvm.JvmName +private const val ENGINE_CLASS_CONCAVEPOLYGONSHAPE2D_INDEX: Int = 203 + /** * A 2D polyline shape, intended for use in physics. Used internally in [CollisionPolygon2D] when * it's in [CollisionPolygon2D.BUILD_SEGMENTS] mode. @@ -54,27 +55,27 @@ public open class ConcavePolygonShape2D : Shape2D() { } public override fun new(scriptIndex: Int): Unit { - callConstructor(ENGINECLASS_CONCAVEPOLYGONSHAPE2D, scriptIndex) + Internals.callConstructor(this, ENGINE_CLASS_CONCAVEPOLYGONSHAPE2D_INDEX, scriptIndex) } public final fun setSegments(segments: PackedVector2Array): Unit { - TransferContext.writeArguments(PACKED_VECTOR2_ARRAY to segments) - TransferContext.callMethod(rawPtr, MethodBindings.setSegmentsPtr, NIL) + Internals.writeArguments(PACKED_VECTOR2_ARRAY to segments) + Internals.callMethod(rawPtr, MethodBindings.setSegmentsPtr, NIL) } public final fun getSegments(): PackedVector2Array { - TransferContext.writeArguments() - TransferContext.callMethod(rawPtr, MethodBindings.getSegmentsPtr, PACKED_VECTOR2_ARRAY) - return (TransferContext.readReturnValue(PACKED_VECTOR2_ARRAY) as PackedVector2Array) + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getSegmentsPtr, PACKED_VECTOR2_ARRAY) + return (Internals.readReturnValue(PACKED_VECTOR2_ARRAY) as PackedVector2Array) } public companion object - internal object MethodBindings { - public val setSegmentsPtr: VoidPtr = - TypeManager.getMethodBindPtr("ConcavePolygonShape2D", "set_segments", 1509147220) + public object MethodBindings { + internal val setSegmentsPtr: VoidPtr = + Internals.getMethodBindPtr("ConcavePolygonShape2D", "set_segments", 1509147220) - public val getSegmentsPtr: VoidPtr = - TypeManager.getMethodBindPtr("ConcavePolygonShape2D", "get_segments", 2961356807) + internal val getSegmentsPtr: VoidPtr = + Internals.getMethodBindPtr("ConcavePolygonShape2D", "get_segments", 2961356807) } } diff --git a/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/ConcavePolygonShape3D.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/ConcavePolygonShape3D.kt new file mode 100644 index 0000000000..bb4f7eba06 --- /dev/null +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/ConcavePolygonShape3D.kt @@ -0,0 +1,115 @@ +// THIS FILE IS GENERATED! DO NOT EDIT IT MANUALLY! +@file:Suppress("PackageDirectoryMismatch", "unused", "FunctionName", "RedundantModalityModifier", + "UNCHECKED_CAST", "JoinDeclarationAndAssignment", "USELESS_CAST", + "RemoveRedundantQualifierName", "NOTHING_TO_INLINE", "NON_FINAL_MEMBER_IN_OBJECT", + "RedundantVisibilityModifier", "RedundantUnitReturnType", "MemberVisibilityCanBePrivate") + +package godot + +import godot.`annotation`.GodotBaseType +import godot.core.PackedVector3Array +import godot.core.VariantParser.BOOL +import godot.core.VariantParser.NIL +import godot.core.VariantParser.PACKED_VECTOR3_ARRAY +import godot.util.Internals +import godot.util.VoidPtr +import kotlin.Boolean +import kotlin.Int +import kotlin.Suppress +import kotlin.Unit +import kotlin.jvm.JvmName + +private const val ENGINE_CLASS_CONCAVEPOLYGONSHAPE3D_INDEX: Int = 204 + +/** + * A 3D trimesh shape, intended for use in physics. Usually used to provide a shape for a + * [CollisionShape3D]. + * Being just a collection of interconnected triangles, [ConcavePolygonShape3D] is the most freely + * configurable single 3D shape. It can be used to form polyhedra of any nature, or even shapes that + * don't enclose a volume. However, [ConcavePolygonShape3D] is *hollow* even if the interconnected + * triangles do enclose a volume, which often makes it unsuitable for physics or detection. + * **Note:** When used for collision, [ConcavePolygonShape3D] is intended to work with static + * [CollisionShape3D] nodes like [StaticBody3D] and will likely not behave well for [CharacterBody3D]s + * or [RigidBody3D]s in a mode other than Static. + * **Warning:** Physics bodies that are small have a chance to clip through this shape when moving + * fast. This happens because on one frame, the physics body may be on the "outside" of the shape, and + * on the next frame it may be "inside" it. [ConcavePolygonShape3D] is hollow, so it won't detect a + * collision. + * **Performance:** Due to its complexity, [ConcavePolygonShape3D] is the slowest 3D collision shape + * to check collisions against. Its use should generally be limited to level geometry. For convex + * geometry, [ConvexPolygonShape3D] should be used. For dynamic physics bodies that need concave + * collision, several [ConvexPolygonShape3D]s can be used to represent its collision by using convex + * decomposition; see [ConvexPolygonShape3D]'s documentation for instructions. + */ +@GodotBaseType +public open class ConcavePolygonShape3D : Shape3D() { + public final inline var `data`: PackedVector3Array + @JvmName("dataProperty") + get() = getFaces() + @JvmName("dataProperty") + set(`value`) { + setFaces(value) + } + + /** + * If set to `true`, collisions occur on both sides of the concave shape faces. Otherwise they + * occur only along the face normals. + */ + public final inline var backfaceCollision: Boolean + @JvmName("backfaceCollisionProperty") + get() = isBackfaceCollisionEnabled() + @JvmName("backfaceCollisionProperty") + set(`value`) { + setBackfaceCollisionEnabled(value) + } + + public override fun new(scriptIndex: Int): Unit { + Internals.callConstructor(this, ENGINE_CLASS_CONCAVEPOLYGONSHAPE3D_INDEX, scriptIndex) + } + + /** + * Sets the faces of the trimesh shape from an array of vertices. The [faces] array should be + * composed of triples such that each triple of vertices defines a triangle. + */ + public final fun setFaces(faces: PackedVector3Array): Unit { + Internals.writeArguments(PACKED_VECTOR3_ARRAY to faces) + Internals.callMethod(rawPtr, MethodBindings.setFacesPtr, NIL) + } + + /** + * Returns the faces of the trimesh shape as an array of vertices. The array (of length divisible + * by three) is naturally divided into triples; each triple of vertices defines a triangle. + */ + public final fun getFaces(): PackedVector3Array { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getFacesPtr, PACKED_VECTOR3_ARRAY) + return (Internals.readReturnValue(PACKED_VECTOR3_ARRAY) as PackedVector3Array) + } + + public final fun setBackfaceCollisionEnabled(enabled: Boolean): Unit { + Internals.writeArguments(BOOL to enabled) + Internals.callMethod(rawPtr, MethodBindings.setBackfaceCollisionEnabledPtr, NIL) + } + + public final fun isBackfaceCollisionEnabled(): Boolean { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.isBackfaceCollisionEnabledPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + public companion object + + public object MethodBindings { + internal val setFacesPtr: VoidPtr = + Internals.getMethodBindPtr("ConcavePolygonShape3D", "set_faces", 334873810) + + internal val getFacesPtr: VoidPtr = + Internals.getMethodBindPtr("ConcavePolygonShape3D", "get_faces", 497664490) + + internal val setBackfaceCollisionEnabledPtr: VoidPtr = + Internals.getMethodBindPtr("ConcavePolygonShape3D", "set_backface_collision_enabled", 2586408642) + + internal val isBackfaceCollisionEnabledPtr: VoidPtr = + Internals.getMethodBindPtr("ConcavePolygonShape3D", "is_backface_collision_enabled", 36873697) + } +} diff --git a/kt/godot-library/src/main/kotlin/godot/gen/godot/ConeTwistJoint3D.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/ConeTwistJoint3D.kt similarity index 86% rename from kt/godot-library/src/main/kotlin/godot/gen/godot/ConeTwistJoint3D.kt rename to kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/ConeTwistJoint3D.kt index 9fad3ef292..f956477f3a 100644 --- a/kt/godot-library/src/main/kotlin/godot/gen/godot/ConeTwistJoint3D.kt +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/ConeTwistJoint3D.kt @@ -7,11 +7,10 @@ package godot import godot.`annotation`.GodotBaseType -import godot.core.TypeManager import godot.core.VariantParser.DOUBLE import godot.core.VariantParser.LONG import godot.core.VariantParser.NIL -import godot.core.memory.TransferContext +import godot.util.Internals import godot.util.VoidPtr import kotlin.Double import kotlin.Float @@ -21,6 +20,8 @@ import kotlin.Suppress import kotlin.Unit import kotlin.jvm.JvmName +private const val ENGINE_CLASS_CONETWISTJOINT3D_INDEX: Int = 205 + /** * A physics joint that connects two 3D physics bodies in a way that simulates a ball-and-socket * joint. The twist axis is initiated as the X axis of the [ConeTwistJoint3D]. Once the physics bodies @@ -91,24 +92,24 @@ public open class ConeTwistJoint3D : Joint3D() { } public override fun new(scriptIndex: Int): Unit { - callConstructor(ENGINECLASS_CONETWISTJOINT3D, scriptIndex) + Internals.callConstructor(this, ENGINE_CLASS_CONETWISTJOINT3D_INDEX, scriptIndex) } /** * Sets the value of the specified parameter. */ public final fun setParam(`param`: Param, `value`: Float): Unit { - TransferContext.writeArguments(LONG to param.id, DOUBLE to value.toDouble()) - TransferContext.callMethod(rawPtr, MethodBindings.setParamPtr, NIL) + Internals.writeArguments(LONG to param.id, DOUBLE to value.toDouble()) + Internals.callMethod(rawPtr, MethodBindings.setParamPtr, NIL) } /** * Returns the value of the specified parameter. */ public final fun getParam(`param`: Param): Float { - TransferContext.writeArguments(LONG to param.id) - TransferContext.callMethod(rawPtr, MethodBindings.getParamPtr, DOUBLE) - return (TransferContext.readReturnValue(DOUBLE) as Double).toFloat() + Internals.writeArguments(LONG to param.id) + Internals.callMethod(rawPtr, MethodBindings.getParamPtr, DOUBLE) + return (Internals.readReturnValue(DOUBLE) as Double).toFloat() } public enum class Param( @@ -158,11 +159,11 @@ public open class ConeTwistJoint3D : Joint3D() { public companion object - internal object MethodBindings { - public val setParamPtr: VoidPtr = - TypeManager.getMethodBindPtr("ConeTwistJoint3D", "set_param", 1062470226) + public object MethodBindings { + internal val setParamPtr: VoidPtr = + Internals.getMethodBindPtr("ConeTwistJoint3D", "set_param", 1062470226) - public val getParamPtr: VoidPtr = - TypeManager.getMethodBindPtr("ConeTwistJoint3D", "get_param", 2928790850) + internal val getParamPtr: VoidPtr = + Internals.getMethodBindPtr("ConeTwistJoint3D", "get_param", 2928790850) } } diff --git a/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/ConfigFile.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/ConfigFile.kt new file mode 100644 index 0000000000..9541a10d41 --- /dev/null +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/ConfigFile.kt @@ -0,0 +1,371 @@ +// THIS FILE IS GENERATED! DO NOT EDIT IT MANUALLY! +@file:Suppress("PackageDirectoryMismatch", "unused", "FunctionName", "RedundantModalityModifier", + "UNCHECKED_CAST", "JoinDeclarationAndAssignment", "USELESS_CAST", + "RemoveRedundantQualifierName", "NOTHING_TO_INLINE", "NON_FINAL_MEMBER_IN_OBJECT", + "RedundantVisibilityModifier", "RedundantUnitReturnType", "MemberVisibilityCanBePrivate") + +package godot + +import godot.`annotation`.GodotBaseType +import godot.core.PackedByteArray +import godot.core.PackedStringArray +import godot.core.VariantCaster.ANY +import godot.core.VariantParser.BOOL +import godot.core.VariantParser.LONG +import godot.core.VariantParser.NIL +import godot.core.VariantParser.PACKED_BYTE_ARRAY +import godot.core.VariantParser.PACKED_STRING_ARRAY +import godot.core.VariantParser.STRING +import godot.util.Internals +import godot.util.VoidPtr +import kotlin.Any +import kotlin.Boolean +import kotlin.Int +import kotlin.Long +import kotlin.String +import kotlin.Suppress +import kotlin.Unit +import kotlin.jvm.JvmOverloads + +private const val ENGINE_CLASS_CONFIGFILE_INDEX: Int = 206 + +/** + * This helper class can be used to store [Variant] values on the filesystem using INI-style + * formatting. The stored values are identified by a section and a key: + * [codeblock lang=text] + * [section] + * some_key=42 + * string_example="Hello World3D!" + * a_vector=Vector3(1, 0, 2) + * [/codeblock] + * The stored data can be saved to or parsed from a file, though ConfigFile objects can also be used + * directly without accessing the filesystem. + * The following example shows how to create a simple [ConfigFile] and save it on disc: + * + * gdscript: + * ```gdscript + * # Create new ConfigFile object. + * var config = ConfigFile.new() + * + * # Store some values. + * config.set_value("Player1", "player_name", "Steve") + * config.set_value("Player1", "best_score", 10) + * config.set_value("Player2", "player_name", "V3geta") + * config.set_value("Player2", "best_score", 9001) + * + * # Save it to a file (overwrite if already exists). + * config.save("user://scores.cfg") + * ``` + * csharp: + * ```csharp + * // Create new ConfigFile object. + * var config = new ConfigFile(); + * + * // Store some values. + * config.SetValue("Player1", "player_name", "Steve"); + * config.SetValue("Player1", "best_score", 10); + * config.SetValue("Player2", "player_name", "V3geta"); + * config.SetValue("Player2", "best_score", 9001); + * + * // Save it to a file (overwrite if already exists). + * config.Save("user://scores.cfg"); + * ``` + * + * This example shows how the above file could be loaded: + * + * gdscript: + * ```gdscript + * var score_data = {} + * var config = ConfigFile.new() + * + * # Load data from a file. + * var err = config.load("user://scores.cfg") + * + * # If the file didn't load, ignore it. + * if err != OK: + * return + * + * # Iterate over all sections. + * for player in config.get_sections(): + * # Fetch the data for each section. + * var player_name = config.get_value(player, "player_name") + * var player_score = config.get_value(player, "best_score") + * score_data[player_name] = player_score + * ``` + * csharp: + * ```csharp + * var score_data = new Godot.Collections.Dictionary(); + * var config = new ConfigFile(); + * + * // Load data from a file. + * Error err = config.Load("user://scores.cfg"); + * + * // If the file didn't load, ignore it. + * if (err != Error.Ok) + * { + * return; + * } + * + * // Iterate over all sections. + * foreach (String player in config.GetSections()) + * { + * // Fetch the data for each section. + * var player_name = (String)config.GetValue(player, "player_name"); + * var player_score = (int)config.GetValue(player, "best_score"); + * score_data[player_name] = player_score; + * } + * ``` + * + * Any operation that mutates the ConfigFile such as [setValue], [clear], or [eraseSection], only + * changes what is loaded in memory. If you want to write the change to a file, you have to save the + * changes with [save], [saveEncrypted], or [saveEncryptedPass]. + * Keep in mind that section and property names can't contain spaces. Anything after a space will be + * ignored on save and on load. + * ConfigFiles can also contain manually written comment lines starting with a semicolon (`;`). + * Those lines will be ignored when parsing the file. Note that comments will be lost when saving the + * ConfigFile. This can still be useful for dedicated server configuration files, which are typically + * never overwritten without explicit user action. + * **Note:** The file extension given to a ConfigFile does not have any impact on its formatting or + * behavior. By convention, the `.cfg` extension is used here, but any other extension such as `.ini` + * is also valid. Since neither `.cfg` nor `.ini` are standardized, Godot's ConfigFile formatting may + * differ from files written by other programs. + */ +@GodotBaseType +public open class ConfigFile : RefCounted() { + public override fun new(scriptIndex: Int): Unit { + Internals.callConstructor(this, ENGINE_CLASS_CONFIGFILE_INDEX, scriptIndex) + } + + /** + * Assigns a value to the specified key of the specified section. If either the section or the key + * do not exist, they are created. Passing a `null` value deletes the specified key if it exists, and + * deletes the section if it ends up empty once the key has been removed. + */ + public final fun setValue( + section: String, + key: String, + `value`: Any?, + ): Unit { + Internals.writeArguments(STRING to section, STRING to key, ANY to value) + Internals.callMethod(rawPtr, MethodBindings.setValuePtr, NIL) + } + + /** + * Returns the current value for the specified section and key. If either the section or the key + * do not exist, the method returns the fallback [default] value. If [default] is not specified or + * set to `null`, an error is also raised. + */ + @JvmOverloads + public final fun getValue( + section: String, + key: String, + default: Any? = null, + ): Any? { + Internals.writeArguments(STRING to section, STRING to key, ANY to default) + Internals.callMethod(rawPtr, MethodBindings.getValuePtr, ANY) + return (Internals.readReturnValue(ANY) as Any?) + } + + /** + * Returns `true` if the specified section exists. + */ + public final fun hasSection(section: String): Boolean { + Internals.writeArguments(STRING to section) + Internals.callMethod(rawPtr, MethodBindings.hasSectionPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + /** + * Returns `true` if the specified section-key pair exists. + */ + public final fun hasSectionKey(section: String, key: String): Boolean { + Internals.writeArguments(STRING to section, STRING to key) + Internals.callMethod(rawPtr, MethodBindings.hasSectionKeyPtr, BOOL) + return (Internals.readReturnValue(BOOL) as Boolean) + } + + /** + * Returns an array of all defined section identifiers. + */ + public final fun getSections(): PackedStringArray { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getSectionsPtr, PACKED_STRING_ARRAY) + return (Internals.readReturnValue(PACKED_STRING_ARRAY) as PackedStringArray) + } + + /** + * Returns an array of all defined key identifiers in the specified section. Raises an error and + * returns an empty array if the section does not exist. + */ + public final fun getSectionKeys(section: String): PackedStringArray { + Internals.writeArguments(STRING to section) + Internals.callMethod(rawPtr, MethodBindings.getSectionKeysPtr, PACKED_STRING_ARRAY) + return (Internals.readReturnValue(PACKED_STRING_ARRAY) as PackedStringArray) + } + + /** + * Deletes the specified section along with all the key-value pairs inside. Raises an error if the + * section does not exist. + */ + public final fun eraseSection(section: String): Unit { + Internals.writeArguments(STRING to section) + Internals.callMethod(rawPtr, MethodBindings.eraseSectionPtr, NIL) + } + + /** + * Deletes the specified key in a section. Raises an error if either the section or the key do not + * exist. + */ + public final fun eraseSectionKey(section: String, key: String): Unit { + Internals.writeArguments(STRING to section, STRING to key) + Internals.callMethod(rawPtr, MethodBindings.eraseSectionKeyPtr, NIL) + } + + /** + * Loads the config file specified as a parameter. The file's contents are parsed and loaded in + * the [ConfigFile] object which the method was called on. + * Returns [OK] on success, or one of the other [Error] values if the operation failed. + */ + public final fun load(path: String): Error { + Internals.writeArguments(STRING to path) + Internals.callMethod(rawPtr, MethodBindings.loadPtr, LONG) + return Error.from(Internals.readReturnValue(LONG) as Long) + } + + /** + * Parses the passed string as the contents of a config file. The string is parsed and loaded in + * the ConfigFile object which the method was called on. + * Returns [OK] on success, or one of the other [Error] values if the operation failed. + */ + public final fun parse(`data`: String): Error { + Internals.writeArguments(STRING to data) + Internals.callMethod(rawPtr, MethodBindings.parsePtr, LONG) + return Error.from(Internals.readReturnValue(LONG) as Long) + } + + /** + * Saves the contents of the [ConfigFile] object to the file specified as a parameter. The output + * file uses an INI-style structure. + * Returns [OK] on success, or one of the other [Error] values if the operation failed. + */ + public final fun save(path: String): Error { + Internals.writeArguments(STRING to path) + Internals.callMethod(rawPtr, MethodBindings.savePtr, LONG) + return Error.from(Internals.readReturnValue(LONG) as Long) + } + + /** + * Obtain the text version of this config file (the same text that would be written to a file). + */ + public final fun encodeToText(): String { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.encodeToTextPtr, STRING) + return (Internals.readReturnValue(STRING) as String) + } + + /** + * Loads the encrypted config file specified as a parameter, using the provided [key] to decrypt + * it. The file's contents are parsed and loaded in the [ConfigFile] object which the method was + * called on. + * Returns [OK] on success, or one of the other [Error] values if the operation failed. + */ + public final fun loadEncrypted(path: String, key: PackedByteArray): Error { + Internals.writeArguments(STRING to path, PACKED_BYTE_ARRAY to key) + Internals.callMethod(rawPtr, MethodBindings.loadEncryptedPtr, LONG) + return Error.from(Internals.readReturnValue(LONG) as Long) + } + + /** + * Loads the encrypted config file specified as a parameter, using the provided [password] to + * decrypt it. The file's contents are parsed and loaded in the [ConfigFile] object which the method + * was called on. + * Returns [OK] on success, or one of the other [Error] values if the operation failed. + */ + public final fun loadEncryptedPass(path: String, password: String): Error { + Internals.writeArguments(STRING to path, STRING to password) + Internals.callMethod(rawPtr, MethodBindings.loadEncryptedPassPtr, LONG) + return Error.from(Internals.readReturnValue(LONG) as Long) + } + + /** + * Saves the contents of the [ConfigFile] object to the AES-256 encrypted file specified as a + * parameter, using the provided [key] to encrypt it. The output file uses an INI-style structure. + * Returns [OK] on success, or one of the other [Error] values if the operation failed. + */ + public final fun saveEncrypted(path: String, key: PackedByteArray): Error { + Internals.writeArguments(STRING to path, PACKED_BYTE_ARRAY to key) + Internals.callMethod(rawPtr, MethodBindings.saveEncryptedPtr, LONG) + return Error.from(Internals.readReturnValue(LONG) as Long) + } + + /** + * Saves the contents of the [ConfigFile] object to the AES-256 encrypted file specified as a + * parameter, using the provided [password] to encrypt it. The output file uses an INI-style + * structure. + * Returns [OK] on success, or one of the other [Error] values if the operation failed. + */ + public final fun saveEncryptedPass(path: String, password: String): Error { + Internals.writeArguments(STRING to path, STRING to password) + Internals.callMethod(rawPtr, MethodBindings.saveEncryptedPassPtr, LONG) + return Error.from(Internals.readReturnValue(LONG) as Long) + } + + /** + * Removes the entire contents of the config. + */ + public final fun clear(): Unit { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.clearPtr, NIL) + } + + public companion object + + public object MethodBindings { + internal val setValuePtr: VoidPtr = + Internals.getMethodBindPtr("ConfigFile", "set_value", 2504492430) + + internal val getValuePtr: VoidPtr = + Internals.getMethodBindPtr("ConfigFile", "get_value", 89809366) + + internal val hasSectionPtr: VoidPtr = + Internals.getMethodBindPtr("ConfigFile", "has_section", 3927539163) + + internal val hasSectionKeyPtr: VoidPtr = + Internals.getMethodBindPtr("ConfigFile", "has_section_key", 820780508) + + internal val getSectionsPtr: VoidPtr = + Internals.getMethodBindPtr("ConfigFile", "get_sections", 1139954409) + + internal val getSectionKeysPtr: VoidPtr = + Internals.getMethodBindPtr("ConfigFile", "get_section_keys", 4291131558) + + internal val eraseSectionPtr: VoidPtr = + Internals.getMethodBindPtr("ConfigFile", "erase_section", 83702148) + + internal val eraseSectionKeyPtr: VoidPtr = + Internals.getMethodBindPtr("ConfigFile", "erase_section_key", 3186203200) + + internal val loadPtr: VoidPtr = Internals.getMethodBindPtr("ConfigFile", "load", 166001499) + + internal val parsePtr: VoidPtr = Internals.getMethodBindPtr("ConfigFile", "parse", 166001499) + + internal val savePtr: VoidPtr = Internals.getMethodBindPtr("ConfigFile", "save", 166001499) + + internal val encodeToTextPtr: VoidPtr = + Internals.getMethodBindPtr("ConfigFile", "encode_to_text", 201670096) + + internal val loadEncryptedPtr: VoidPtr = + Internals.getMethodBindPtr("ConfigFile", "load_encrypted", 887037711) + + internal val loadEncryptedPassPtr: VoidPtr = + Internals.getMethodBindPtr("ConfigFile", "load_encrypted_pass", 852856452) + + internal val saveEncryptedPtr: VoidPtr = + Internals.getMethodBindPtr("ConfigFile", "save_encrypted", 887037711) + + internal val saveEncryptedPassPtr: VoidPtr = + Internals.getMethodBindPtr("ConfigFile", "save_encrypted_pass", 852856452) + + internal val clearPtr: VoidPtr = Internals.getMethodBindPtr("ConfigFile", "clear", 3218959716) + } +} diff --git a/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/ConfirmationDialog.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/ConfirmationDialog.kt new file mode 100644 index 0000000000..77a0f9a83e --- /dev/null +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/ConfirmationDialog.kt @@ -0,0 +1,89 @@ +// THIS FILE IS GENERATED! DO NOT EDIT IT MANUALLY! +@file:Suppress("PackageDirectoryMismatch", "unused", "FunctionName", "RedundantModalityModifier", + "UNCHECKED_CAST", "JoinDeclarationAndAssignment", "USELESS_CAST", + "RemoveRedundantQualifierName", "NOTHING_TO_INLINE", "NON_FINAL_MEMBER_IN_OBJECT", + "RedundantVisibilityModifier", "RedundantUnitReturnType", "MemberVisibilityCanBePrivate") + +package godot + +import godot.`annotation`.GodotBaseType +import godot.core.VariantParser.NIL +import godot.core.VariantParser.OBJECT +import godot.core.VariantParser.STRING +import godot.util.Internals +import godot.util.VoidPtr +import kotlin.Int +import kotlin.String +import kotlin.Suppress +import kotlin.Unit +import kotlin.jvm.JvmName + +private const val ENGINE_CLASS_CONFIRMATIONDIALOG_INDEX: Int = 207 + +/** + * A dialog used for confirmation of actions. This window is similar to [AcceptDialog], but pressing + * its Cancel button can have a different outcome from pressing the OK button. The order of the two + * buttons varies depending on the host OS. + * To get cancel action, you can use: + * + * gdscript: + * ```gdscript + * get_cancel_button().pressed.connect(_on_canceled) + * ``` + * csharp: + * ```csharp + * GetCancelButton().Pressed += OnCanceled; + * ``` + */ +@GodotBaseType +public open class ConfirmationDialog : AcceptDialog() { + /** + * The text displayed by the cancel button (see [getCancelButton]). + */ + public final inline var cancelButtonText: String + @JvmName("cancelButtonTextProperty") + get() = getCancelButtonText() + @JvmName("cancelButtonTextProperty") + set(`value`) { + setCancelButtonText(value) + } + + public override fun new(scriptIndex: Int): Unit { + Internals.callConstructor(this, ENGINE_CLASS_CONFIRMATIONDIALOG_INDEX, scriptIndex) + } + + /** + * Returns the cancel button. + * **Warning:** This is a required internal node, removing and freeing it may cause a crash. If + * you wish to hide it or any of its children, use their [CanvasItem.visible] property. + */ + public final fun getCancelButton(): Button? { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getCancelButtonPtr, OBJECT) + return (Internals.readReturnValue(OBJECT) as Button?) + } + + public final fun setCancelButtonText(text: String): Unit { + Internals.writeArguments(STRING to text) + Internals.callMethod(rawPtr, MethodBindings.setCancelButtonTextPtr, NIL) + } + + public final fun getCancelButtonText(): String { + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.getCancelButtonTextPtr, STRING) + return (Internals.readReturnValue(STRING) as String) + } + + public companion object + + public object MethodBindings { + internal val getCancelButtonPtr: VoidPtr = + Internals.getMethodBindPtr("ConfirmationDialog", "get_cancel_button", 1856205918) + + internal val setCancelButtonTextPtr: VoidPtr = + Internals.getMethodBindPtr("ConfirmationDialog", "set_cancel_button_text", 83702148) + + internal val getCancelButtonTextPtr: VoidPtr = + Internals.getMethodBindPtr("ConfirmationDialog", "get_cancel_button_text", 201670096) + } +} diff --git a/kt/godot-library/src/main/kotlin/godot/gen/godot/Container.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/Container.kt similarity index 83% rename from kt/godot-library/src/main/kotlin/godot/gen/godot/Container.kt rename to kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/Container.kt index 9fbf5588f2..f70983de7c 100644 --- a/kt/godot-library/src/main/kotlin/godot/gen/godot/Container.kt +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/Container.kt @@ -10,11 +10,10 @@ import godot.`annotation`.GodotBaseType import godot.core.PackedInt32Array import godot.core.Rect2 import godot.core.Signal0 -import godot.core.TypeManager import godot.core.VariantParser.NIL import godot.core.VariantParser.OBJECT import godot.core.VariantParser.RECT2 -import godot.core.memory.TransferContext +import godot.util.Internals import godot.util.VoidPtr import kotlin.Int import kotlin.Long @@ -22,6 +21,8 @@ import kotlin.NotImplementedError import kotlin.Suppress import kotlin.Unit +private const val ENGINE_CLASS_CONTAINER_INDEX: Int = 208 + /** * Base class for all GUI containers. A [Container] automatically arranges its child controls in a * certain way. This class can be inherited to make custom container types. @@ -39,7 +40,7 @@ public open class Container : Control() { public val sortChildren: Signal0 by Signal0 public override fun new(scriptIndex: Int): Unit { - callConstructor(ENGINECLASS_CONTAINER, scriptIndex) + Internals.callConstructor(this, ENGINE_CLASS_CONTAINER_INDEX, scriptIndex) } /** @@ -69,8 +70,8 @@ public open class Container : Control() { * upon request. */ public final fun queueSort(): Unit { - TransferContext.writeArguments() - TransferContext.callMethod(rawPtr, MethodBindings.queueSortPtr, NIL) + Internals.writeArguments() + Internals.callMethod(rawPtr, MethodBindings.queueSortPtr, NIL) } /** @@ -78,8 +79,8 @@ public open class Container : Control() { * classes. */ public final fun fitChildInRect(child: Control?, rect: Rect2): Unit { - TransferContext.writeArguments(OBJECT to child, RECT2 to rect) - TransferContext.callMethod(rawPtr, MethodBindings.fitChildInRectPtr, NIL) + Internals.writeArguments(OBJECT to child, RECT2 to rect) + Internals.callMethod(rawPtr, MethodBindings.fitChildInRectPtr, NIL) } public companion object { @@ -95,11 +96,11 @@ public open class Container : Control() { public final const val NOTIFICATION_SORT_CHILDREN: Long = 51 } - internal object MethodBindings { - public val queueSortPtr: VoidPtr = - TypeManager.getMethodBindPtr("Container", "queue_sort", 3218959716) + public object MethodBindings { + internal val queueSortPtr: VoidPtr = + Internals.getMethodBindPtr("Container", "queue_sort", 3218959716) - public val fitChildInRectPtr: VoidPtr = - TypeManager.getMethodBindPtr("Container", "fit_child_in_rect", 1993438598) + internal val fitChildInRectPtr: VoidPtr = + Internals.getMethodBindPtr("Container", "fit_child_in_rect", 1993438598) } } diff --git a/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/Control.kt b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/Control.kt new file mode 100644 index 0000000000..eed0172707 --- /dev/null +++ b/kt/godot-library/godot-api-library/src/main/kotlin/godot/gen/godot/Control.kt @@ -0,0 +1,3242 @@ +// THIS FILE IS GENERATED! DO NOT EDIT IT MANUALLY! +@file:Suppress("PackageDirectoryMismatch", "unused", "FunctionName", "RedundantModalityModifier", + "UNCHECKED_CAST", "JoinDeclarationAndAssignment", "USELESS_CAST", + "RemoveRedundantQualifierName", "NOTHING_TO_INLINE", "NON_FINAL_MEMBER_IN_OBJECT", + "RedundantVisibilityModifier", "RedundantUnitReturnType", "MemberVisibilityCanBePrivate") + +package godot + +import godot.`annotation`.CoreTypeHelper +import godot.`annotation`.CoreTypeLocalCopy +import godot.`annotation`.GodotBaseType +import godot.core.Callable +import godot.core.Color +import godot.core.NodePath +import godot.core.Rect2 +import godot.core.Signal0 +import godot.core.Signal1 +import godot.core.StringName +import godot.core.VariantArray +import godot.core.VariantCaster.ANY +import godot.core.VariantParser.BOOL +import godot.core.VariantParser.CALLABLE +import godot.core.VariantParser.COLOR +import godot.core.VariantParser.DOUBLE +import godot.core.VariantParser.LONG +import godot.core.VariantParser.NIL +import godot.core.VariantParser.NODE_PATH +import godot.core.VariantParser.OBJECT +import godot.core.VariantParser.RECT2 +import godot.core.VariantParser.STRING +import godot.core.VariantParser.STRING_NAME +import godot.core.VariantParser.VECTOR2 +import godot.core.Vector2 +import godot.core.Vector3i +import godot.util.Internals +import godot.util.VoidPtr +import kotlin.Any +import kotlin.Boolean +import kotlin.Double +import kotlin.Float +import kotlin.Int +import kotlin.Long +import kotlin.NotImplementedError +import kotlin.String +import kotlin.Suppress +import kotlin.Unit +import kotlin.jvm.JvmInline +import kotlin.jvm.JvmName +import kotlin.jvm.JvmOverloads + +private const val ENGINE_CLASS_CONTROL_INDEX: Int = 209 + +public infix fun Long.or(other: godot.Control.SizeFlags): Long = this.or(other.flag) + +public infix fun Long.xor(other: godot.Control.SizeFlags): Long = this.xor(other.flag) + +public infix fun Long.and(other: godot.Control.SizeFlags): Long = this.and(other.flag) + +public operator fun Long.plus(other: godot.Control.SizeFlags): Long = this.plus(other.flag) + +public operator fun Long.minus(other: godot.Control.SizeFlags): Long = this.minus(other.flag) + +public operator fun Long.times(other: godot.Control.SizeFlags): Long = this.times(other.flag) + +public operator fun Long.div(other: godot.Control.SizeFlags): Long = this.div(other.flag) + +public operator fun Long.rem(other: godot.Control.SizeFlags): Long = this.rem(other.flag) + +/** + * Base class for all UI-related nodes. [Control] features a bounding rectangle that defines its + * extents, an anchor position relative to its parent control or the current viewport, and offsets + * relative to the anchor. The offsets update automatically when the node, any of its parents, or the + * screen size change. + * For more information on Godot's UI system, anchors, offsets, and containers, see the related + * tutorials in the manual. To build flexible UIs, you'll need a mix of UI elements that inherit from + * [Control] and [Container] nodes. + * **User Interface nodes and input** + * Godot propagates input events via viewports. Each [Viewport] is responsible for propagating + * [InputEvent]s to their child nodes. As the [SceneTree.root] is a [Window], this already happens + * automatically for all UI elements in your game. + * Input events are propagated through the [SceneTree] from the root node to all child nodes by + * calling [Node.Input]. For UI elements specifically, it makes more sense to override the virtual + * method [_guiInput], which filters out unrelated input events, such as by checking z-order, + * [mouseFilter], focus, or if the event was inside of the control's bounding box. + * Call [acceptEvent] so no other node receives the event. Once you accept an input, it becomes + * handled so [Node.UnhandledInput] will not process it. + * Only one [Control] node can be in focus. Only the node in focus will receive events. To get the + * focus, call [grabFocus]. [Control] nodes lose focus when another node grabs it, or if you hide the + * node in focus. + * Sets [mouseFilter] to [MOUSE_FILTER_IGNORE] to tell a [Control] node to ignore mouse or touch + * events. You'll need it if you place an icon on top of a button. + * [Theme] resources change the Control's appearance. If you change the [Theme] on a [Control] node, + * it affects all of its children. To override some of the theme's parameters, call one of the + * `add_theme_*_override` methods, like [addThemeFontOverride]. You can override the theme with the + * Inspector. + * **Note:** Theme items are *not* [Object] properties. This means you can't access their values + * using [Object.get] and [Object.set]. Instead, use the `get_theme_*` and `add_theme_*_override` + * methods provided by this class. + */ +@GodotBaseType +public open class Control : CanvasItem() { + /** + * Emitted when the control changes size. + */ + public val resized: Signal0 by Signal0 + + /** + * Emitted when the node receives an [InputEvent]. + */ + public val guiInput: Signal1 by Signal1 + + /** + * Emitted when the mouse cursor enters the control's (or any child control's) visible area, that + * is not occluded behind other Controls or Windows, provided its [mouseFilter] lets the event reach + * it and regardless if it's currently focused or not. + * **Note:** [CanvasItem.zIndex] doesn't affect, which Control receives the signal. + */ + public val mouseEntered: Signal0 by Signal0 + + /** + * Emitted when the mouse cursor leaves the control's (and all child control's) visible area, that + * is not occluded behind other Controls or Windows, provided its [mouseFilter] lets the event reach + * it and regardless if it's currently focused or not. + * **Note:** [CanvasItem.zIndex] doesn't affect, which Control receives the signal. + * **Note:** If you want to check whether the mouse truly left the area, ignoring any top nodes, + * you can use code like this: + * [codeblock] + * func _on_mouse_exited(): + * if not Rect2(Vector2(), size).has_point(get_local_mouse_position()): + * # Not hovering over area. + * [/codeblock] + */ + public val mouseExited: Signal0 by Signal0 + + /** + * Emitted when the node gains focus. + */ + public val focusEntered: Signal0 by Signal0 + + /** + * Emitted when the node loses focus. + */ + public val focusExited: Signal0 by Signal0 + + /** + * Emitted when one of the size flags changes. See [sizeFlagsHorizontal] and [sizeFlagsVertical]. + */ + public val sizeFlagsChanged: Signal0 by Signal0 + + /** + * Emitted when the node's minimum size changes. + */ + public val minimumSizeChanged: Signal0 by Signal0 + + /** + * Emitted when the [NOTIFICATION_THEME_CHANGED] notification is sent. + */ + public val themeChanged: Signal0 by Signal0 + + /** + * Enables whether rendering of [CanvasItem] based children should be clipped to this control's + * rectangle. If `true`, parts of a child which would be visibly outside of this control's rectangle + * will not be rendered and won't receive input. + */ + public final inline var clipContents: Boolean + @JvmName("clipContentsProperty") + get() = isClippingContents() + @JvmName("clipContentsProperty") + set(`value`) { + setClipContents(value) + } + + /** + * The minimum size of the node's bounding rectangle. If you set it to a value greater than `(0, + * 0)`, the node's bounding rectangle will always have at least this size. Note that [Control] nodes + * have their internal minimum size returned by [getMinimumSize]. It depends on the control's + * contents, like text, textures, or style boxes. The actual minimum size is the maximum value of + * this property and the internal minimum size (see [getCombinedMinimumSize]). + */ + @CoreTypeLocalCopy + public final inline var customMinimumSize: Vector2 + @JvmName("customMinimumSizeProperty") + get() = getCustomMinimumSize() + @JvmName("customMinimumSizeProperty") + set(`value`) { + setCustomMinimumSize(value) + } + + /** + * Controls layout direction and text writing direction. Right-to-left layouts are necessary for + * certain languages (e.g. Arabic and Hebrew). + */ + public final inline var layoutDirection: LayoutDirection + @JvmName("layoutDirectionProperty") + get() = getLayoutDirection() + @JvmName("layoutDirectionProperty") + set(`value`) { + setLayoutDirection(value) + } + + /** + * Anchors the left edge of the node to the origin, the center or the end of its parent control. + * It changes how the left offset updates when the node moves or changes size. You can use one of the + * [Anchor] constants for convenience. + */ + public final inline val anchorLeft: Float + @JvmName("anchorLeftProperty") + get() = getAnchor(Side.SIDE_LEFT) + + /** + * Anchors the top edge of the node to the origin, the center or the end of its parent control. It + * changes how the top offset updates when the node moves or changes size. You can use one of the + * [Anchor] constants for convenience. + */ + public final inline val anchorTop: Float + @JvmName("anchorTopProperty") + get() = getAnchor(Side.SIDE_TOP) + + /** + * Anchors the right edge of the node to the origin, the center or the end of its parent control. + * It changes how the right offset updates when the node moves or changes size. You can use one of + * the [Anchor] constants for convenience. + */ + public final inline val anchorRight: Float + @JvmName("anchorRightProperty") + get() = getAnchor(Side.SIDE_RIGHT) + + /** + * Anchors the bottom edge of the node to the origin, the center, or the end of its parent + * control. It changes how the bottom offset updates when the node moves or changes size. You can use + * one of the [Anchor] constants for convenience. + */ + public final inline val anchorBottom: Float + @JvmName("anchorBottomProperty") + get() = getAnchor(Side.SIDE_BOTTOM) + + /** + * Distance between the node's left edge and its parent control, based on [anchorLeft]. + * Offsets are often controlled by one or multiple parent [Container] nodes, so you should not + * modify them manually if your node is a direct child of a [Container]. Offsets update automatically + * when you move or resize the node. + */ + public final inline var offsetLeft: Float + @JvmName("offsetLeftProperty") + get() = getOffset(Side.SIDE_LEFT) + @JvmName("offsetLeftProperty") + set(`value`) { + setOffset(Side.SIDE_LEFT, value) + } + + /** + * Distance between the node's top edge and its parent control, based on [anchorTop]. + * Offsets are often controlled by one or multiple parent [Container] nodes, so you should not + * modify them manually if your node is a direct child of a [Container]. Offsets update automatically + * when you move or resize the node. + */ + public final inline var offsetTop: Float + @JvmName("offsetTopProperty") + get() = getOffset(Side.SIDE_TOP) + @JvmName("offsetTopProperty") + set(`value`) { + setOffset(Side.SIDE_TOP, value) + } + + /** + * Distance between the node's right edge and its parent control, based on [anchorRight]. + * Offsets are often controlled by one or multiple parent [Container] nodes, so you should not + * modify them manually if your node is a direct child of a [Container]. Offsets update automatically + * when you move or resize the node. + */ + public final inline var offsetRight: Float + @JvmName("offsetRightProperty") + get() = getOffset(Side.SIDE_RIGHT) + @JvmName("offsetRightProperty") + set(`value`) { + setOffset(Side.SIDE_RIGHT, value) + } + + /** + * Distance between the node's bottom edge and its parent control, based on [anchorBottom]. + * Offsets are often controlled by one or multiple parent [Container] nodes, so you should not + * modify them manually if your node is a direct child of a [Container]. Offsets update automatically + * when you move or resize the node. + */ + public final inline var offsetBottom: Float + @JvmName("offsetBottomProperty") + get() = getOffset(Side.SIDE_BOTTOM) + @JvmName("offsetBottomProperty") + set(`value`) { + setOffset(Side.SIDE_BOTTOM, value) + } + + /** + * Controls the direction on the horizontal axis in which the control should grow if its + * horizontal minimum size is changed to be greater than its current size, as the control always has + * to be at least the minimum size. + */ + public final inline var growHorizontal: GrowDirection + @JvmName("growHorizontalProperty") + get() = getHGrowDirection() + @JvmName("growHorizontalProperty") + set(`value`) { + setHGrowDirection(value) + } + + /** + * Controls the direction on the vertical axis in which the control should grow if its vertical + * minimum size is changed to be greater than its current size, as the control always has to be at + * least the minimum size. + */ + public final inline var growVertical: GrowDirection + @JvmName("growVerticalProperty") + get() = getVGrowDirection() + @JvmName("growVerticalProperty") + set(`value`) { + setVGrowDirection(value) + } + + /** + * The size of the node's bounding rectangle, in the node's coordinate system. [Container] nodes + * update this property automatically. + */ + @CoreTypeLocalCopy + public final inline val size: Vector2 + @JvmName("sizeProperty") + get() = getSize() + + /** + * The node's position, relative to its containing node. It corresponds to the rectangle's + * top-left corner. The property is not affected by [pivotOffset]. + */ + @CoreTypeLocalCopy + public final inline val position: Vector2 + @JvmName("positionProperty") + get() = getPosition() + + /** + * The node's global position, relative to the world (usually to the [CanvasLayer]). + */ + @CoreTypeLocalCopy + public final inline val globalPosition: Vector2 + @JvmName("globalPositionProperty") + get() = getGlobalPosition() + + /** + * The node's rotation around its pivot, in radians. See [pivotOffset] to change the pivot's + * position. + * **Note:** This property is edited in the inspector in degrees. If you want to use degrees in a + * script, use [rotationDegrees]. + */ + public final inline var rotation: Float + @JvmName("rotationProperty") + get() = getRotation() + @JvmName("rotationProperty") + set(`value`) { + setRotation(value) + } + + /** + * Helper property to access [rotation] in degrees instead of radians. + */ + public final inline var rotationDegrees: Float + @JvmName("rotationDegreesProperty") + get() = getRotationDegrees() + @JvmName("rotationDegreesProperty") + set(`value`) { + setRotationDegrees(value) + } + + /** + * The node's scale, relative to its [size]. Change this property to scale the node around its + * [pivotOffset]. The Control's [tooltipText] will also scale according to this value. + * **Note:** This property is mainly intended to be used for animation purposes. To support + * multiple resolutions in your project, use an appropriate viewport stretch mode as described in the + * [url=$DOCS_URL/tutorials/rendering/multiple_resolutions.html]documentation[/url] instead of + * scaling Controls individually. + * **Note:** [FontFile.oversampling] does *not* take [Control] [scale] into account. This means + * that scaling up/down will cause bitmap fonts and rasterized (non-MSDF) dynamic fonts to appear + * blurry or pixelated. To ensure text remains crisp regardless of scale, you can enable MSDF font + * rendering by enabling [ProjectSettings.gui/theme/defaultFontMultichannelSignedDistanceField] + * (applies to the default project font only), or enabling **Multichannel Signed Distance Field** in + * the import options of a DynamicFont for custom fonts. On system fonts, + * [SystemFont.multichannelSignedDistanceField] can be enabled in the inspector. + * **Note:** If the Control node is a child of a [Container] node, the scale will be reset to + * `Vector2(1, 1)` when the scene is instantiated. To set the Control's scale when it's instantiated, + * wait for one frame using `await get_tree().process_frame` then set its [scale] property. + */ + @CoreTypeLocalCopy + public final inline var scale: Vector2 + @JvmName("scaleProperty") + get() = getScale() + @JvmName("scaleProperty") + set(`value`) { + setScale(value) + } + + /** + * By default, the node's pivot is its top-left corner. When you change its [rotation] or [scale], + * it will rotate or scale around this pivot. Set this property to [size] / 2 to pivot around the + * Control's center. + */ + @CoreTypeLocalCopy + public final inline var pivotOffset: Vector2 + @JvmName("pivotOffsetProperty") + get() = getPivotOffset() + @JvmName("pivotOffsetProperty") + set(`value`) { + setPivotOffset(value) + } + + /** + * Tells the parent [Container] nodes how they should resize and place the node on the X axis. Use + * a combination of the [SizeFlags] constants to change the flags. See the constants to learn what + * each does. + */ + public final inline var sizeFlagsHorizontal: SizeFlags + @JvmName("sizeFlagsHorizontalProperty") + get() = getHSizeFlags() + @JvmName("sizeFlagsHorizontalProperty") + set(`value`) { + setHSizeFlags(value) + } + + /** + * Tells the parent [Container] nodes how they should resize and place the node on the Y axis. Use + * a combination of the [SizeFlags] constants to change the flags. See the constants to learn what + * each does. + */ + public final inline var sizeFlagsVertical: SizeFlags + @JvmName("sizeFlagsVerticalProperty") + get() = getVSizeFlags() + @JvmName("sizeFlagsVerticalProperty") + set(`value`) { + setVSizeFlags(value) + } + + /** + * If the node and at least one of its neighbors uses the [SIZE_EXPAND] size flag, the parent + * [Container] will let it take more or less space depending on this property. If this node has a + * stretch ratio of 2 and its neighbor a ratio of 1, this node will take two thirds of the available + * space. + */ + public final inline var sizeFlagsStretchRatio: Float + @JvmName("sizeFlagsStretchRatioProperty") + get() = getStretchRatio() + @JvmName("sizeFlagsStretchRatioProperty") + set(`value`) { + setStretchRatio(value) + } + + /** + * If `true`, automatically converts code line numbers, list indices, [SpinBox] and [ProgressBar] + * values from the Western Arabic (0..9) to the numeral systems used in current locale. + * **Note:** Numbers within the text are not automatically converted, it can be done manually, + * using [TextServer.formatNumber]. + */ + public final inline var localizeNumeralSystem: Boolean + @JvmName("localizeNumeralSystemProperty") + get() = isLocalizingNumeralSystem() + @JvmName("localizeNumeralSystemProperty") + set(`value`) { + setLocalizeNumeralSystem(value) + } + + /** + * Toggles if any text should automatically change to its translated version depending on the + * current locale. + */ + public final inline var autoTranslate: Boolean + @JvmName("autoTranslateProperty") + get() = isAutoTranslating() + @JvmName("autoTranslateProperty") + set(`value`) { + setAutoTranslate(value) + } + + /** + * The default tooltip text. The tooltip appears when the user's mouse cursor stays idle over this + * control for a few moments, provided that the [mouseFilter] property is not [MOUSE_FILTER_IGNORE]. + * The time required for the tooltip to appear can be changed with the + * [ProjectSettings.gui/timers/tooltipDelaySec] option. See also [getTooltip]. + * The tooltip popup will use either a default implementation, or a custom one that you can + * provide by overriding [_makeCustomTooltip]. The default tooltip includes a [PopupPanel] and + * [Label] whose theme properties can be customized using [Theme] methods with the `"TooltipPanel"` + * and `"TooltipLabel"` respectively. For example: + * + * gdscript: + * ```gdscript + * var style_box = StyleBoxFlat.new() + * style_box.set_bg_color(Color(1, 1, 0)) + * style_box.set_border_width_all(2) + * # We assume here that the `theme` property has been assigned a custom Theme beforehand. + * theme.set_stylebox("panel", "TooltipPanel", style_box) + * theme.set_color("font_color", "TooltipLabel", Color(0, 1, 1)) + * ``` + * csharp: + * ```csharp + * var styleBox = new StyleBoxFlat(); + * styleBox.SetBgColor(new Color(1, 1, 0)); + * styleBox.SetBorderWidthAll(2); + * // We assume here that the `Theme` property has been assigned a custom Theme beforehand. + * Theme.SetStyleBox("panel", "TooltipPanel", styleBox); + * Theme.SetColor("font_color", "TooltipLabel", new Color(0, 1, 1)); + * ``` + */ + public final inline var tooltipText: String + @JvmName("tooltipTextProperty") + get() = getTooltipText() + @JvmName("tooltipTextProperty") + set(`value`) { + setTooltipText(value) + } + + /** + * Tells Godot which node it should give focus to if the user presses the left arrow on the + * keyboard or left on a gamepad by default. You can change the key by editing the + * [ProjectSettings.input/uiLeft] input action. The node must be a [Control]. If this property is not + * set, Godot will give focus to the closest [Control] to the left of this one. + */ + public final inline var focusNeighborLeft: NodePath + @JvmName("focusNeighborLeftProperty") + get() = getFocusNeighbor(Side.SIDE_LEFT) + @JvmName("focusNeighborLeftProperty") + set(`value`) { + setFocusNeighbor(Side.SIDE_LEFT, value) + } + + /** + * Tells Godot which node it should give focus to if the user presses the top arrow on the + * keyboard or top on a gamepad by default. You can change the key by editing the + * [ProjectSettings.input/uiUp] input action. The node must be a [Control]. If this property is not + * set, Godot will give focus to the closest [Control] to the top of this one. + */ + public final inline var focusNeighborTop: NodePath + @JvmName("focusNeighborTopProperty") + get() = getFocusNeighbor(Side.SIDE_TOP) + @JvmName("focusNeighborTopProperty") + set(`value`) { + setFocusNeighbor(Side.SIDE_TOP, value) + } + + /** + * Tells Godot which node it should give focus to if the user presses the right arrow on the + * keyboard or right on a gamepad by default. You can change the key by editing the + * [ProjectSettings.input/uiRight] input action. The node must be a [Control]. If this property is + * not set, Godot will give focus to the closest [Control] to the right of this one. + */ + public final inline var focusNeighborRight: NodePath + @JvmName("focusNeighborRightProperty") + get() = getFocusNeighbor(Side.SIDE_RIGHT) + @JvmName("focusNeighborRightProperty") + set(`value`) { + setFocusNeighbor(Side.SIDE_RIGHT, value) + } + + /** + * Tells Godot which node it should give focus to if the user presses the down arrow on the + * keyboard or down on a gamepad by default. You can change the key by editing the + * [ProjectSettings.input/uiDown] input action. The node must be a [Control]. If this property is not + * set, Godot will give focus to the closest [Control] to the bottom of this one. + */ + public final inline var focusNeighborBottom: NodePath + @JvmName("focusNeighborBottomProperty") + get() = getFocusNeighbor(Side.SIDE_BOTTOM) + @JvmName("focusNeighborBottomProperty") + set(`value`) { + setFocusNeighbor(Side.SIDE_BOTTOM, value) + } + + /** + * Tells Godot which node it should give focus to if the user presses [kbd]Tab[/kbd] on a keyboard + * by default. You can change the key by editing the [ProjectSettings.input/uiFocusNext] input + * action. + * If this property is not set, Godot will select a "best guess" based on surrounding nodes in the + * scene tree. + */ + public final inline var focusNext: NodePath + @JvmName("focusNextProperty") + get() = getFocusNext() + @JvmName("focusNextProperty") + set(`value`) { + setFocusNext(value) + } + + /** + * Tells Godot which node it should give focus to if the user presses [kbd]Shift + Tab[/kbd] on a + * keyboard by default. You can change the key by editing the [ProjectSettings.input/uiFocusPrev] + * input action. + * If this property is not set, Godot will select a "best guess" based on surrounding nodes in the + * scene tree. + */ + public final inline var focusPrevious: NodePath + @JvmName("focusPreviousProperty") + get() = getFocusPrevious() + @JvmName("focusPreviousProperty") + set(`value`) { + setFocusPrevious(value) + } + + /** + * The focus access mode for the control (None, Click or All). Only one Control can be focused at + * the same time, and it will receive keyboard, gamepad, and mouse signals. + */ + public final inline var focusMode: FocusMode + @JvmName("focusModeProperty") + get() = getFocusMode() + @JvmName("focusModeProperty") + set(`value`) { + setFocusMode(value) + } + + /** + * Controls whether the control will be able to receive mouse button input events through + * [_guiInput] and how these events should be handled. Also controls whether the control can receive + * the [signal mouse_entered], and [signal mouse_exited] signals. See the constants to learn what + * each does. + */ + public final inline var mouseFilter: MouseFilter + @JvmName("mouseFilterProperty") + get() = getMouseFilter() + @JvmName("mouseFilterProperty") + set(`value`) { + setMouseFilter(value) + } + + /** + * When enabled, scroll wheel events processed by [_guiInput] will be passed to the parent control + * even if [mouseFilter] is set to [MOUSE_FILTER_STOP]. As it defaults to true, this allows nested + * scrollable containers to work out of the box. + * You should disable it on the root of your UI if you do not want scroll events to go to the + * [Node.UnhandledInput] processing. + */ + public final inline var mouseForcePassScrollEvents: Boolean + @JvmName("mouseForcePassScrollEventsProperty") + get() = isForcePassScrollEvents() + @JvmName("mouseForcePassScrollEventsProperty") + set(`value`) { + setForcePassScrollEvents(value) + } + + /** + * The default cursor shape for this control. Useful for Godot plugins and applications or games + * that use the system's mouse cursors. + * **Note:** On Linux, shapes may vary depending on the cursor theme of the system. + */ + public final inline var mouseDefaultCursorShape: CursorShape + @JvmName("mouseDefaultCursorShapeProperty") + get() = getDefaultCursorShape() + @JvmName("mouseDefaultCursorShapeProperty") + set(`value`) { + setDefaultCursorShape(value) + } + + /** + * The [Node] which must be a parent of the focused [Control] for the shortcut to be activated. If + * `null`, the shortcut can be activated when any control is focused (a global shortcut). This allows + * shortcuts to be accepted only when the user has a certain area of the GUI focused. + */ + public final inline var shortcutContext: Node? + @JvmName("shortcutContextProperty") + get() = getShortcutContext() + @JvmName("shortcutContextProperty") + set(`value`) { + setShortcutContext(value) + } + + /** + * The [Theme] resource this node and all its [Control] and [Window] children use. If a child node + * has its own [Theme] resource set, theme items are merged with child's definitions having higher + * priority. + * **Note:** [Window] styles will have no effect unless the window is embedded. + */ + public final inline var theme: Theme? + @JvmName("themeProperty") + get() = getTheme() + @JvmName("themeProperty") + set(`value`) { + setTheme(value) + } + + /** + * The name of a theme type variation used by this [Control] to look up its own theme items. When + * empty, the class name of the node is used (e.g. [code skip-lint]Button[/code] for the [Button] + * control), as well as the class names of all parent classes (in order of inheritance). + * When set, this property gives the highest priority to the type of the specified name. This type + * can in turn extend another type, forming a dependency chain. See [Theme.setTypeVariation]. If the + * theme item cannot be found using this type or its base types, lookup falls back on the class + * names. + * **Note:** To look up [Control]'s own items use various `get_theme_*` methods without specifying + * `theme_type`. + * **Note:** Theme items are looked for in the tree order, from branch to root, where each + * [Control] node is checked for its [theme] property. The earliest match against any type/class name + * is returned. The project-level Theme and the default Theme are checked last. + */ + public final inline var themeTypeVariation: StringName + @JvmName("themeTypeVariationProperty") + get() = getThemeTypeVariation() + @JvmName("themeTypeVariationProperty") + set(`value`) { + setThemeTypeVariation(value) + } + + public override fun new(scriptIndex: Int): Unit { + Internals.callConstructor(this, ENGINE_CLASS_CONTROL_INDEX, scriptIndex) + } + + /** + * The minimum size of the node's bounding rectangle. If you set it to a value greater than `(0, + * 0)`, the node's bounding rectangle will always have at least this size. Note that [Control] nodes + * have their internal minimum size returned by [getMinimumSize]. It depends on the control's + * contents, like text, textures, or style boxes. The actual minimum size is the maximum value of + * this property and the internal minimum size (see [getCombinedMinimumSize]). + * + * This is a helper function to make dealing with local copies easier. + * + * For more information, see our + * [documentation](https://godot-kotl.in/en/stable/user-guide/api-differences/#core-types). + * + * Allow to directly modify the local copy of the property and assign it back to the Object. + * + * Prefer that over writing: + * `````` + * val myCoreType = control.customMinimumSize + * //Your changes + * control.customMinimumSize = myCoreType + * `````` + */ + @CoreTypeHelper + public final fun customMinimumSizeMutate(block: Vector2.() -> Unit): Vector2 = + customMinimumSize.apply{ + block(this) + customMinimumSize = this + } + + + /** + * The node's scale, relative to its [size]. Change this property to scale the node around its + * [pivotOffset]. The Control's [tooltipText] will also scale according to this value. + * **Note:** This property is mainly intended to be used for animation purposes. To support + * multiple resolutions in your project, use an appropriate viewport stretch mode as described in the + * [url=$DOCS_URL/tutorials/rendering/multiple_resolutions.html]documentation[/url] instead of + * scaling Controls individually. + * **Note:** [FontFile.oversampling] does *not* take [Control] [scale] into account. This means + * that scaling up/down will cause bitmap fonts and rasterized (non-MSDF) dynamic fonts to appear + * blurry or pixelated. To ensure text remains crisp regardless of scale, you can enable MSDF font + * rendering by enabling [ProjectSettings.gui/theme/defaultFontMultichannelSignedDistanceField] + * (applies to the default project font only), or enabling **Multichannel Signed Distance Field** in + * the import options of a DynamicFont for custom fonts. On system fonts, + * [SystemFont.multichannelSignedDistanceField] can be enabled in the inspector. + * **Note:** If the Control node is a child of a [Container] node, the scale will be reset to + * `Vector2(1, 1)` when the scene is instantiated. To set the Control's scale when it's instantiated, + * wait for one frame using `await get_tree().process_frame` then set its [scale] property. + * + * This is a helper function to make dealing with local copies easier. + * + * For more information, see our + * [documentation](https://godot-kotl.in/en/stable/user-guide/api-differences/#core-types). + * + * Allow to directly modify the local copy of the property and assign it back to the Object. + * + * Prefer that over writing: + * `````` + * val myCoreType = control.scale + * //Your changes + * control.scale = myCoreType + * `````` + */ + @CoreTypeHelper + public final fun scaleMutate(block: Vector2.() -> Unit): Vector2 = scale.apply{ + block(this) + scale = this + } + + + /** + * By default, the node's pivot is its top-left corner. When you change its [rotation] or [scale], + * it will rotate or scale around this pivot. Set this property to [size] / 2 to pivot around the + * Control's center. + * + * This is a helper function to make dealing with local copies easier. + * + * For more information, see our + * [documentation](https://godot-kotl.in/en/stable/user-guide/api-differences/#core-types). + * + * Allow to directly modify the local copy of the property and assign it back to the Object. + * + * Prefer that over writing: + * `````` + * val myCoreType = control.pivotOffset + * //Your changes + * control.pivotOffset = myCoreType + * `````` + */ + @CoreTypeHelper + public final fun pivotOffsetMutate(block: Vector2.() -> Unit): Vector2 = pivotOffset.apply{ + block(this) + pivotOffset = this + } + + + /** + * Virtual method to be implemented by the user. Returns whether the given [point] is inside this + * control. + * If not overridden, default behavior is checking if the point is within control's Rect. + * **Note:** If you want to check if a point is inside the control, you can use + * `Rect2(Vector2.ZERO, size).has_point(point)`. + */ + public open fun _hasPoint(point: Vector2): Boolean { + throw NotImplementedError("_has_point is not implemented for Control") + } + + /** + * User defined BiDi algorithm override function. + * Returns an [Array] of [Vector3i] text ranges and text base directions, in the left-to-right + * order. Ranges should cover full source [text] without overlaps. BiDi algorithm will be used on + * each range separately. + */ + public open fun _structuredTextParser(args: VariantArray, text: String): + VariantArray { + throw NotImplementedError("_structured_text_parser is not implemented for Control") + } + + /** + * Virtual method to be implemented by the user. Returns the minimum size for this control. + * Alternative to [customMinimumSize] for controlling minimum size via code. The actual minimum size + * will be the max value of these two (in each axis separately). + * If not overridden, defaults to [Vector2.ZERO]. + * **Note:** This method will not be called when the script is attached to a [Control] node that + * already overrides its minimum size (e.g. [Label], [Button], [PanelContainer] etc.). It can only be + * used with most basic GUI nodes, like [Control], [Container], [Panel] etc. + */ + public open fun _getMinimumSize(): Vector2 { + throw NotImplementedError("_get_minimum_size is not implemented for Control") + } + + /** + * Virtual method to be implemented by the user. Returns the tooltip text for the position + * [atPosition] in control's local coordinates, which will typically appear when the cursor is + * resting over this control. See [getTooltip]. + * **Note:** If this method returns an empty [String], no tooltip is displayed. + */ + public open fun _getTooltip(atPosition: Vector2): String { + throw NotImplementedError("_get_tooltip is not implemented for Control") + } + + /** + * Godot calls this method to get data that can be dragged and dropped onto controls that expect + * drop data. Returns `null` if there is no data to drag. Controls that want to receive drop data + * should implement [_canDropData] and [_dropData]. [atPosition] is local to this control. Drag may + * be forced with [forceDrag]. + * A preview that will follow the mouse that should represent the data can be set with + * [setDragPreview]. A good time to set the preview is in this method. + * + * gdscript: + * ```gdscript + * func _get_drag_data(position): + * var mydata = make_data() # This is your custom method generating the drag data. + * set_drag_preview(make_preview(mydata)) # This is your custom method generating the preview + * of the drag data. + * return mydata + * ``` + * csharp: + * ```csharp + * public override Variant _GetDragData(Vector2 atPosition) + * { + * var myData = MakeData(); // This is your custom method generating the drag data. + * SetDragPreview(MakePreview(myData)); // This is your custom method generating the preview + * of the drag data. + * return myData; + * } + * ``` + */ + public open fun _getDragData(atPosition: Vector2): Any? { + throw NotImplementedError("_get_drag_data is not implemented for Control") + } + + /** + * Godot calls this method to test if [data] from a control's [_getDragData] can be dropped at + * [atPosition]. [atPosition] is local to this control. + * This method should only be used to test the data. Process the data in [_dropData]. + * + * gdscript: + * ```gdscript + * func _can_drop_data(position, data): + * # Check position if it is relevant to you + * # Otherwise, just check data + * return typeof(data) == TYPE_DICTIONARY and data.has("expected") + * ``` + * csharp: + * ```csharp + * public override bool _CanDropData(Vector2 atPosition, Variant data) + * { + * // Check position if it is relevant to you + * // Otherwise, just check data + * return data.VariantType == Variant.Type.Dictionary && + * data.AsGodotDictionary().ContainsKey("expected"); + * } + * ``` + */ + public open fun _canDropData(atPosition: Vector2, `data`: Any?): Boolean { + throw NotImplementedError("_can_drop_data is not implemented for Control") + } + + /** + * Godot calls this method to pass you the [data] from a control's [_getDragData] result. Godot + * first calls [_canDropData] to test if [data] is allowed to drop at [atPosition] where [atPosition] + * is local to this control. + * + * gdscript: + * ```gdscript + * func _can_drop_data(position, data): + * return typeof(data) == TYPE_DICTIONARY and data.has("color") + * + * func _drop_data(position, data): + * var color = data["color"] + * ``` + * csharp: + * ```csharp + * public override bool _CanDropData(Vector2 atPosition, Variant data) + * { + * return data.VariantType == Variant.Type.Dictionary && + * dict.AsGodotDictionary().ContainsKey("color"); + * } + * + * public override void _DropData(Vector2 atPosition, Variant data) + * { + * Color color = data.AsGodotDictionary()["color"].AsColor(); + * } + * ``` + */ + public open fun _dropData(atPosition: Vector2, `data`: Any?): Unit { + } + + /** + * Virtual method to be implemented by the user. Returns a [Control] node that should be used as a + * tooltip instead of the default one. The [forText] includes the contents of the [tooltipText] + * property. + * The returned node must be of type [Control] or Control-derived. It can have child nodes of any + * type. It is freed when the tooltip disappears, so make sure you always provide a new instance (if + * you want to use a pre-existing node from your scene tree, you can duplicate it and pass the + * duplicated instance). When `null` or a non-Control node is returned, the default tooltip will be + * used instead. + * The returned node will be added as child to a [PopupPanel], so you should only provide the + * contents of that panel. That [PopupPanel] can be themed using [Theme.setStylebox] for the type + * `"TooltipPanel"` (see [tooltipText] for an example). + * **Note:** The tooltip is shrunk to minimal size. If you want to ensure it's fully visible, you + * might want to set its [customMinimumSize] to some non-zero value. + * **Note:** The node (and any relevant children) should be [CanvasItem.visible] when returned, + * otherwise, the viewport that instantiates it will not be able to calculate its minimum size + * reliably. + * **Example of usage with a custom-constructed node:** + * + * gdscript: + * ```gdscript + * func _make_custom_tooltip(for_text): + * var label = Label.new() + * label.text = for_text + * return label + * ``` + * csharp: + * ```csharp + * public override Control _MakeCustomTooltip(string forText) + * { + * var label = new Label(); + * label.Text = forText; + * return label; + * } + * ``` + * + * **Example of usage with a custom scene instance:** + * + * gdscript: + * ```gdscript + * func _make_custom_tooltip(for_text): + * var tooltip = preload("res://some_tooltip_scene.tscn").instantiate() + * tooltip.get_node("Label").text = for_text + * return tooltip + * ``` + * csharp: + * ```csharp + * public override Control _MakeCustomTooltip(string forText) + * { + * Node tooltip = + * ResourceLoader.Load("res://some_tooltip_scene.tscn").Instantiate(); + * tooltip.GetNode