mirror of
https://github.com/godotengine/godot-visual-script.git
synced 2025-12-31 21:48:42 +03:00
Codebase Enhancements and Performance Improvements
We've made several updates to improve our codebase and application performance. - Clang format was applied for better readability and consistency, aiding other developers in understanding and contributing to the code. - We resolved issues that were causing visual script compilation failure. The visual script now compiles successfully, ensuring application functionality. - Broken sections within the codebase were fixed, improving overall stability. - Built-in functions from the visual script were removed to simplify the code and enhance readability. - Generic search performance was improved to provide faster results, enhancing user experience. - Missing flow nodes were added to the Visual Script, ensuring all necessary components are present for correct functioning. In an effort to streamline the codebase: - `VisualScriptComment` class and related code were removed, reducing complexity and improving maintainability. - Error messages were optimized for quicker feedback when errors occur. - Licenses were updated to reflect recent changes, ensuring legal compliance and project transparency. - The `get_global_name()` override in `visual_script.h` was fixed, and `TYPE_BUILTIN_FUNC` in `visual_script_expression.h` was removed, improving code functionality. - Search logic was refactored to avoid double searching, enhancing performance. - Documentation was updated to reflect recent changes, providing accurate information to users and developers. - Property selection logic in `VisualScriptPropertySelector` was refactored for easier understanding and modification. - Code was refactored to avoid variable shadowing, improving readability and reducing potential errors. - `.clang-format` and `.clang-tidy` configuration files were added to ensure consistent code styling. To make the code more robust and easier to understand: - Variable names were corrected for clarity, and error handling in `visual_script_expression.cpp` was improved. - Function and variable names were refactored for better readability and maintainability. - Member editing logic in `VisualScriptEditor` was simplified. - Name variables were updated to be unique, avoiding potential conflicts and errors. - The `VisualScriptSubCall` class was refactored for simplicity and ease of understanding. For macOS workflow: - It was updated to use the latest version and correct path for installing Vulkan SDK, enabling the application to leverage the latest features and improvements from the Vulkan SDK. - Mac Vulkan SDK was installed to support Vulkan-based functionalities. Lastly, we made necessary changes to pass CI/CD tests, ensuring the code quality and stability of the application.
This commit is contained in:
199
.clang-format
Normal file
199
.clang-format
Normal file
@@ -0,0 +1,199 @@
|
||||
# Commented out parameters are those with the same value as base LLVM style.
|
||||
# We can uncomment them if we want to change their value, or enforce the
|
||||
# chosen value in case the base style changes (last sync: Clang 14.0).
|
||||
---
|
||||
### General config, applies to all languages ###
|
||||
BasedOnStyle: LLVM
|
||||
AccessModifierOffset: -4
|
||||
AlignAfterOpenBracket: DontAlign
|
||||
# AlignArrayOfStructures: None
|
||||
# AlignConsecutiveMacros: None
|
||||
# AlignConsecutiveAssignments: None
|
||||
# AlignConsecutiveBitFields: None
|
||||
# AlignConsecutiveDeclarations: None
|
||||
# AlignEscapedNewlines: Right
|
||||
AlignOperands: DontAlign
|
||||
AlignTrailingComments: false
|
||||
# AllowAllArgumentsOnNextLine: true
|
||||
AllowAllParametersOfDeclarationOnNextLine: false
|
||||
# AllowShortEnumsOnASingleLine: true
|
||||
# AllowShortBlocksOnASingleLine: Never
|
||||
# AllowShortCaseLabelsOnASingleLine: false
|
||||
# AllowShortFunctionsOnASingleLine: All
|
||||
# AllowShortLambdasOnASingleLine: All
|
||||
# AllowShortIfStatementsOnASingleLine: Never
|
||||
# AllowShortLoopsOnASingleLine: false
|
||||
# AlwaysBreakAfterDefinitionReturnType: None
|
||||
# AlwaysBreakAfterReturnType: None
|
||||
# AlwaysBreakBeforeMultilineStrings: false
|
||||
# AlwaysBreakTemplateDeclarations: MultiLine
|
||||
# AttributeMacros:
|
||||
# - __capability
|
||||
# BinPackArguments: true
|
||||
# BinPackParameters: true
|
||||
# BraceWrapping:
|
||||
# AfterCaseLabel: false
|
||||
# AfterClass: false
|
||||
# AfterControlStatement: Never
|
||||
# AfterEnum: false
|
||||
# AfterFunction: false
|
||||
# AfterNamespace: false
|
||||
# AfterObjCDeclaration: false
|
||||
# AfterStruct: false
|
||||
# AfterUnion: false
|
||||
# AfterExternBlock: false
|
||||
# BeforeCatch: false
|
||||
# BeforeElse: false
|
||||
# BeforeLambdaBody: false
|
||||
# BeforeWhile: false
|
||||
# IndentBraces: false
|
||||
# SplitEmptyFunction: true
|
||||
# SplitEmptyRecord: true
|
||||
# SplitEmptyNamespace: true
|
||||
# BreakBeforeBinaryOperators: None
|
||||
# BreakBeforeConceptDeclarations: true
|
||||
# BreakBeforeBraces: Attach
|
||||
# BreakBeforeInheritanceComma: false
|
||||
# BreakInheritanceList: BeforeColon
|
||||
# BreakBeforeTernaryOperators: true
|
||||
# BreakConstructorInitializersBeforeComma: false
|
||||
BreakConstructorInitializers: AfterColon
|
||||
# BreakStringLiterals: true
|
||||
ColumnLimit: 0
|
||||
# CommentPragmas: '^ IWYU pragma:'
|
||||
# QualifierAlignment: Leave
|
||||
# CompactNamespaces: false
|
||||
ConstructorInitializerIndentWidth: 8
|
||||
ContinuationIndentWidth: 8
|
||||
Cpp11BracedListStyle: false
|
||||
# DeriveLineEnding: true
|
||||
# DerivePointerAlignment: false
|
||||
# DisableFormat: false
|
||||
# EmptyLineAfterAccessModifier: Never
|
||||
# EmptyLineBeforeAccessModifier: LogicalBlock
|
||||
# ExperimentalAutoDetectBinPacking: false
|
||||
# PackConstructorInitializers: BinPack
|
||||
ConstructorInitializerAllOnOneLineOrOnePerLine: true
|
||||
# AllowAllConstructorInitializersOnNextLine: true
|
||||
# FixNamespaceComments: true
|
||||
# ForEachMacros:
|
||||
# - foreach
|
||||
# - Q_FOREACH
|
||||
# - BOOST_FOREACH
|
||||
# IfMacros:
|
||||
# - KJ_IF_MAYBE
|
||||
# IncludeBlocks: Preserve
|
||||
IncludeCategories:
|
||||
- Regex: '".*"'
|
||||
Priority: 1
|
||||
- Regex: '^<.*\.h>'
|
||||
Priority: 2
|
||||
- Regex: '^<.*'
|
||||
Priority: 3
|
||||
# IncludeIsMainRegex: '(Test)?$'
|
||||
# IncludeIsMainSourceRegex: ''
|
||||
# IndentAccessModifiers: false
|
||||
IndentCaseLabels: true
|
||||
# IndentCaseBlocks: false
|
||||
# IndentGotoLabels: true
|
||||
# IndentPPDirectives: None
|
||||
# IndentExternBlock: AfterExternBlock
|
||||
# IndentRequires: false
|
||||
IndentWidth: 4
|
||||
# IndentWrappedFunctionNames: false
|
||||
# InsertTrailingCommas: None
|
||||
# JavaScriptQuotes: Leave
|
||||
# JavaScriptWrapImports: true
|
||||
KeepEmptyLinesAtTheStartOfBlocks: false
|
||||
# LambdaBodyIndentation: Signature
|
||||
# MacroBlockBegin: ''
|
||||
# MacroBlockEnd: ''
|
||||
# MaxEmptyLinesToKeep: 1
|
||||
# NamespaceIndentation: None
|
||||
# PenaltyBreakAssignment: 2
|
||||
# PenaltyBreakBeforeFirstCallParameter: 19
|
||||
# PenaltyBreakComment: 300
|
||||
# PenaltyBreakFirstLessLess: 120
|
||||
# PenaltyBreakOpenParenthesis: 0
|
||||
# PenaltyBreakString: 1000
|
||||
# PenaltyBreakTemplateDeclaration: 10
|
||||
# PenaltyExcessCharacter: 1000000
|
||||
# PenaltyReturnTypeOnItsOwnLine: 60
|
||||
# PenaltyIndentedWhitespace: 0
|
||||
# PointerAlignment: Right
|
||||
# PPIndentWidth: -1
|
||||
# ReferenceAlignment: Pointer
|
||||
# ReflowComments: true
|
||||
# RemoveBracesLLVM: false
|
||||
# SeparateDefinitionBlocks: Leave
|
||||
# ShortNamespaceLines: 1
|
||||
# SortIncludes: CaseSensitive
|
||||
# SortJavaStaticImport: Before
|
||||
# SortUsingDeclarations: true
|
||||
# SpaceAfterCStyleCast: false
|
||||
# SpaceAfterLogicalNot: false
|
||||
# SpaceAfterTemplateKeyword: true
|
||||
# SpaceBeforeAssignmentOperators: true
|
||||
# SpaceBeforeCaseColon: false
|
||||
# SpaceBeforeCpp11BracedList: false
|
||||
# SpaceBeforeCtorInitializerColon: true
|
||||
# SpaceBeforeInheritanceColon: true
|
||||
# SpaceBeforeParens: ControlStatements
|
||||
# SpaceBeforeParensOptions:
|
||||
# AfterControlStatements: true
|
||||
# AfterForeachMacros: true
|
||||
# AfterFunctionDefinitionName: false
|
||||
# AfterFunctionDeclarationName: false
|
||||
# AfterIfMacros: true
|
||||
# AfterOverloadedOperator: false
|
||||
# BeforeNonEmptyParentheses: false
|
||||
# SpaceAroundPointerQualifiers: Default
|
||||
# SpaceBeforeRangeBasedForLoopColon: true
|
||||
# SpaceInEmptyBlock: false
|
||||
# SpaceInEmptyParentheses: false
|
||||
# SpacesBeforeTrailingComments: 1
|
||||
# SpacesInAngles: Never
|
||||
# SpacesInConditionalStatement: false
|
||||
# SpacesInContainerLiterals: true
|
||||
# SpacesInCStyleCastParentheses: false
|
||||
## Godot TODO: We'll want to use a min of 1, but we need to see how to fix
|
||||
## our comment capitalization at the same time.
|
||||
SpacesInLineCommentPrefix:
|
||||
Minimum: 0
|
||||
Maximum: -1
|
||||
# SpacesInParentheses: false
|
||||
# SpacesInSquareBrackets: false
|
||||
# SpaceBeforeSquareBrackets: false
|
||||
# BitFieldColonSpacing: Both
|
||||
# StatementAttributeLikeMacros:
|
||||
# - Q_EMIT
|
||||
# StatementMacros:
|
||||
# - Q_UNUSED
|
||||
# - QT_REQUIRE_VERSION
|
||||
TabWidth: 4
|
||||
# UseCRLF: false
|
||||
UseTab: Always
|
||||
# WhitespaceSensitiveMacros:
|
||||
# - STRINGIZE
|
||||
# - PP_STRINGIZE
|
||||
# - BOOST_PP_STRINGIZE
|
||||
# - NS_SWIFT_NAME
|
||||
# - CF_SWIFT_NAME
|
||||
---
|
||||
### C++ specific config ###
|
||||
Language: Cpp
|
||||
Standard: c++17
|
||||
---
|
||||
### ObjC specific config ###
|
||||
Language: ObjC
|
||||
# ObjCBinPackProtocolList: Auto
|
||||
ObjCBlockIndentWidth: 4
|
||||
# ObjCBreakBeforeNestedBlockParam: true
|
||||
# ObjCSpaceAfterProperty: false
|
||||
# ObjCSpaceBeforeProtocolList: true
|
||||
---
|
||||
### Java specific config ###
|
||||
Language: Java
|
||||
# BreakAfterJavaFieldAnnotations: false
|
||||
JavaImportGroups: ['org.godotengine', 'android', 'androidx', 'com.android', 'com.google', 'java', 'javax']
|
||||
...
|
||||
47
.clang-tidy
Normal file
47
.clang-tidy
Normal file
@@ -0,0 +1,47 @@
|
||||
---
|
||||
Checks: 'clang-diagnostic-*,clang-analyzer-*,-*,cppcoreguidelines-pro-type-member-init,modernize-redundant-void-arg,modernize-use-bool-literals,modernize-use-default-member-init,modernize-use-nullptr,readability-braces-around-statements,readability-redundant-member-init'
|
||||
WarningsAsErrors: ''
|
||||
HeaderFilterRegex: ''
|
||||
AnalyzeTemporaryDtors: false
|
||||
FormatStyle: none
|
||||
CheckOptions:
|
||||
- key: cert-dcl16-c.NewSuffixes
|
||||
value: 'L;LL;LU;LLU'
|
||||
- key: cert-oop54-cpp.WarnOnlyIfThisHasSuspiciousField
|
||||
value: '0'
|
||||
- key: cppcoreguidelines-explicit-virtual-functions.IgnoreDestructors
|
||||
value: '1'
|
||||
- key: cppcoreguidelines-non-private-member-variables-in-classes.IgnoreClassesWithAllMemberVariablesBeingPublic
|
||||
value: '1'
|
||||
- key: cppcoreguidelines-pro-type-member-init.IgnoreArrays
|
||||
value: '1'
|
||||
- key: cppcoreguidelines-pro-type-member-init.UseAssignment
|
||||
value: '1'
|
||||
- key: google-readability-function-size.StatementThreshold
|
||||
value: '800'
|
||||
- key: google-readability-namespace-comments.ShortNamespaceLines
|
||||
value: '10'
|
||||
- key: google-readability-namespace-comments.SpacesBeforeComments
|
||||
value: '2'
|
||||
- key: modernize-loop-convert.MaxCopySize
|
||||
value: '16'
|
||||
- key: modernize-loop-convert.MinConfidence
|
||||
value: reasonable
|
||||
- key: modernize-loop-convert.NamingStyle
|
||||
value: CamelCase
|
||||
- key: modernize-pass-by-value.IncludeStyle
|
||||
value: llvm
|
||||
- key: modernize-replace-auto-ptr.IncludeStyle
|
||||
value: llvm
|
||||
- key: modernize-use-bool-literals.IgnoreMacros
|
||||
value: '0'
|
||||
- key: modernize-use-default-member-init.IgnoreMacros
|
||||
value: '0'
|
||||
- key: modernize-use-default-member-init.UseAssignment
|
||||
value: '1'
|
||||
- key: modernize-use-nullptr.NullMacros
|
||||
value: 'NULL'
|
||||
- key: readability-braces-around-statements.ShortStatementLines
|
||||
value: '0'
|
||||
...
|
||||
|
||||
112
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
112
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
@@ -1,56 +1,56 @@
|
||||
name: Bug report
|
||||
description: Report a bug in Godot
|
||||
body:
|
||||
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
- Read our [CONTRIBUTING.md guide](https://github.com/godotengine/godot/blob/master/CONTRIBUTING.md#reporting-bugs) on reporting bugs.
|
||||
- Write a descriptive issue title above.
|
||||
- Search [open](https://github.com/godotengine/godot-visual-script/issues) and [closed](https://github.com/godotengine/godot-visual-script/issues?q=is%3Aissue+is%3Aclosed) issues to ensure it has not already been reported.
|
||||
- Verify that you are using a [supported Godot version](https://docs.godotengine.org/en/stable/about/release_policy.html).
|
||||
|
||||
- type: input
|
||||
attributes:
|
||||
label: Godot version
|
||||
description: >
|
||||
Specify the Git commit hash if using a development or non-official build.
|
||||
If you use a custom build, please test if your issue is reproducible in official builds too.
|
||||
placeholder: 3.3.stable, 4.0.dev (3041becc6)
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: input
|
||||
attributes:
|
||||
label: System information
|
||||
description: |
|
||||
Specify the OS version, and when relevant hardware information.
|
||||
For graphics-related issues, specify the GPU model, driver version, and the rendering backend (GLES2, GLES3, Vulkan).
|
||||
placeholder: Windows 10, GLES3, Intel HD Graphics 620 (27.20.100.9616)
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Issue description
|
||||
description: |
|
||||
Describe your issue briefly. What doesn't work, and how do you expect it to work instead?
|
||||
You can include images or videos with drag and drop, and format code blocks or logs with <code>```</code> tags.
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Steps to reproduce
|
||||
description: |
|
||||
List of steps or sample code that reproduces the issue. Having reproducible issues is a prerequisite for contributors to be able to solve them.
|
||||
If you include a minimal reproduction project below, you can detail how to use it here.
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Minimal reproduction project
|
||||
description: |
|
||||
A small Godot project which reproduces the issue. Highly recommended to speed up troubleshooting.
|
||||
Drag and drop a ZIP archive to upload it.
|
||||
name: Bug report
|
||||
description: Report a bug in Godot
|
||||
body:
|
||||
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
- Read our [CONTRIBUTING.md guide](https://github.com/godotengine/godot/blob/master/CONTRIBUTING.md#reporting-bugs) on reporting bugs.
|
||||
- Write a descriptive issue title above.
|
||||
- Search [open](https://github.com/godotengine/godot-visual-script/issues) and [closed](https://github.com/godotengine/godot-visual-script/issues?q=is%3Aissue+is%3Aclosed) issues to ensure it has not already been reported.
|
||||
- Verify that you are using a [supported Godot version](https://docs.godotengine.org/en/stable/about/release_policy.html).
|
||||
|
||||
- type: input
|
||||
attributes:
|
||||
label: Godot version
|
||||
description: >
|
||||
Specify the Git commit hash if using a development or non-official build.
|
||||
If you use a custom build, please test if your issue is reproducible in official builds too.
|
||||
placeholder: 3.3.stable, 4.0.dev (3041becc6)
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: input
|
||||
attributes:
|
||||
label: System information
|
||||
description: |
|
||||
Specify the OS version, and when relevant hardware information.
|
||||
For graphics-related issues, specify the GPU model, driver version, and the rendering backend (GLES2, GLES3, Vulkan).
|
||||
placeholder: Windows 10, GLES3, Intel HD Graphics 620 (27.20.100.9616)
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Issue description
|
||||
description: |
|
||||
Describe your issue briefly. What doesn't work, and how do you expect it to work instead?
|
||||
You can include images or videos with drag and drop, and format code blocks or logs with <code>```</code> tags.
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Steps to reproduce
|
||||
description: |
|
||||
List of steps or sample code that reproduces the issue. Having reproducible issues is a prerequisite for contributors to be able to solve them.
|
||||
If you include a minimal reproduction project below, you can detail how to use it here.
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Minimal reproduction project
|
||||
description: |
|
||||
A small Godot project which reproduces the issue. Highly recommended to speed up troubleshooting.
|
||||
Drag and drop a ZIP archive to upload it.
|
||||
|
||||
12
.github/ISSUE_TEMPLATE/config.yml
vendored
12
.github/ISSUE_TEMPLATE/config.yml
vendored
@@ -1,6 +1,6 @@
|
||||
blank_issues_enabled: false
|
||||
|
||||
contact_links:
|
||||
- name: Godot community channels
|
||||
url: https://godotengine.org/community
|
||||
about: Please ask for technical support on one of the other community channels, not here.
|
||||
blank_issues_enabled: false
|
||||
|
||||
contact_links:
|
||||
- name: Godot community channels
|
||||
url: https://godotengine.org/community
|
||||
about: Please ask for technical support on one of the other community channels, not here.
|
||||
|
||||
4
.github/workflows/linux.yml
vendored
4
.github/workflows/linux.yml
vendored
@@ -30,8 +30,6 @@ jobs:
|
||||
# Azure repositories are not reliable, we need to prevent azure giving us packages.
|
||||
- name: Make apt sources.list use the default Ubuntu repositories
|
||||
run: |
|
||||
sudo rm -f /etc/apt/sources.list.d/*
|
||||
sudo cp -f misc/ci/sources.list /etc/apt/sources.list
|
||||
sudo apt-get update
|
||||
|
||||
# Install all packages (except scons)
|
||||
@@ -74,7 +72,7 @@ jobs:
|
||||
env:
|
||||
SCONS_CACHE: ${{github.workspace}}/.scons_cache/
|
||||
run: |
|
||||
scons -j2 verbose=yes warnings=all werror=yes platform=linuxbsd tools=yes tests=no target=release_debug production=yes
|
||||
scons -j2 verbose=yes warnings=all werror=yes platform=linuxbsd tools=yes tests=no target=template_release production=yes
|
||||
|
||||
# TODO Such tests are able to run from Godot 4.0 only
|
||||
# Execute unit tests for the editor
|
||||
|
||||
8
.github/workflows/macos.yml
vendored
8
.github/workflows/macos.yml
vendored
@@ -12,7 +12,7 @@ env:
|
||||
|
||||
jobs:
|
||||
macos-editor:
|
||||
runs-on: "macos-10.15"
|
||||
runs-on: "macos-latest"
|
||||
name: Editor
|
||||
|
||||
steps:
|
||||
@@ -56,12 +56,16 @@ jobs:
|
||||
python --version
|
||||
scons --version
|
||||
|
||||
- name: Setup Vulkan SDK
|
||||
run: |
|
||||
sh misc/scripts/install_vulkan_sdk_macos.sh
|
||||
|
||||
# We should always be explicit with our flags usage here since it's gonna be sure to always set those flags
|
||||
- name: Compilation
|
||||
env:
|
||||
SCONS_CACHE: ${{github.workspace}}/.scons_cache/
|
||||
run: |
|
||||
scons -j2 verbose=yes warnings=all werror=yes platform=osx tools=yes tests=no target=release_debug production=yes module_text_server_fb_enabled=yes
|
||||
scons -j2 verbose=yes warnings=all werror=yes platform=macos tools=yes tests=no target=template_release production=yes module_text_server_fb_enabled=yes
|
||||
|
||||
# TODO Such tests are able to run from Godot 4.0 only
|
||||
# Execute unit tests for the editor
|
||||
|
||||
0
.github/workflows/scripts/clang_format.sh
vendored
Normal file → Executable file
0
.github/workflows/scripts/clang_format.sh
vendored
Normal file → Executable file
5
.github/workflows/scripts/file_format.sh
vendored
5
.github/workflows/scripts/file_format.sh
vendored
@@ -46,9 +46,9 @@ while IFS= read -rd '' f; do
|
||||
continue
|
||||
fi
|
||||
# Disallow empty lines after the opening brace.
|
||||
sed -z -i 's/\x7B\x0A\x0A/\x7B\x0A/g' "$f"
|
||||
perl -i -0777 -pe 's/\x7B\x0A\x0A/\x7B\x0A/g' "$f"
|
||||
# Disallow some empty lines before the closing brace.
|
||||
sed -z -i 's/\x0A\x0A\x7D/\x0A\x7D/g' "$f"
|
||||
perl -i -0777 -pe 's/\x0A\x0A\x7D/\x0A\x7D/g' "$f"
|
||||
done
|
||||
|
||||
git diff > patch.patch
|
||||
@@ -66,4 +66,5 @@ printf "and the formatting rules:\n\n"
|
||||
cat patch.patch
|
||||
printf "\n*** Aborting, please fix your commit(s) with 'git commit --amend' or 'git rebase -i <hash>'\n"
|
||||
rm -f patch.patch
|
||||
|
||||
exit 1
|
||||
|
||||
22
.github/workflows/scripts/install_vulkan_sdk_macos.sh
vendored
Executable file
22
.github/workflows/scripts/install_vulkan_sdk_macos.sh
vendored
Executable file
@@ -0,0 +1,22 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
set -euo pipefail
|
||||
IFS=$'\n\t'
|
||||
|
||||
# Download and install the Vulkan SDK.
|
||||
curl -L "https://sdk.lunarg.com/sdk/download/latest/mac/vulkan-sdk.dmg" -o /tmp/vulkan-sdk.dmg
|
||||
hdiutil attach /tmp/vulkan-sdk.dmg -mountpoint /Volumes/vulkan-sdk
|
||||
/Volumes/vulkan-sdk/InstallVulkan.app/Contents/MacOS/InstallVulkan \
|
||||
--accept-licenses --default-answer --confirm-command install
|
||||
|
||||
cnt=5
|
||||
until hdiutil detach -force /Volumes/vulkan-sdk
|
||||
do
|
||||
[[ cnt -eq "0" ]] && break
|
||||
sleep 1
|
||||
((cnt--))
|
||||
done
|
||||
|
||||
rm -f /tmp/vulkan-sdk.dmg
|
||||
|
||||
echo 'Vulkan SDK installed successfully! You can now build Godot by running "scons".'
|
||||
4
.github/workflows/windows.yml
vendored
4
.github/workflows/windows.yml
vendored
@@ -65,7 +65,7 @@ jobs:
|
||||
env:
|
||||
SCONS_CACHE: /.scons_cache/
|
||||
run: |
|
||||
scons -j2 verbose=yes warnings=all werror=yes platform=windows tools=yes tests=no target=release_debug
|
||||
scons -j2 verbose=yes warnings=all werror=yes platform=windows tools=yes tests=no target=template_release
|
||||
|
||||
# TODO Such tests are able to run from Godot 4.0 only
|
||||
# Execute unit tests for the editor
|
||||
@@ -131,7 +131,7 @@ jobs:
|
||||
env:
|
||||
SCONS_CACHE: /.scons_cache/
|
||||
run: |
|
||||
scons -j2 verbose=yes warnings=all werror=yes platform=windows tools=no tests=no target=release
|
||||
scons -j2 verbose=yes warnings=all werror=yes platform=windows tools=no tests=no target=template_release
|
||||
|
||||
# TODO Such tests are able to run from Godot 4.0 only
|
||||
# Execute unit tests for the editor
|
||||
|
||||
@@ -11,7 +11,6 @@ def get_doc_classes():
|
||||
"VisualScriptBasicTypeConstant",
|
||||
"VisualScriptBuiltinFunc",
|
||||
"VisualScriptClassConstant",
|
||||
"VisualScriptComment",
|
||||
"VisualScriptComposeArray",
|
||||
"VisualScriptCondition",
|
||||
"VisualScriptConstant",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<class name="VisualScript" inherits="Script" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
|
||||
<class name="VisualScript" inherits="Script" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
|
||||
<brief_description>
|
||||
A script implemented in the Visual Script programming environment.
|
||||
</brief_description>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<class name="VisualScriptBasicTypeConstant" inherits="VisualScriptNode" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
|
||||
<class name="VisualScriptBasicTypeConstant" inherits="VisualScriptNode" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
|
||||
<brief_description>
|
||||
A Visual Script node representing a constant from the base types.
|
||||
</brief_description>
|
||||
|
||||
@@ -1,221 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<class name="VisualScriptBuiltinFunc" inherits="VisualScriptNode" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
|
||||
<brief_description>
|
||||
A Visual Script node used to call built-in functions.
|
||||
</brief_description>
|
||||
<description>
|
||||
A built-in function used inside a [VisualScript]. It is usually a math function or an utility function.
|
||||
See also [@GDScript], for the same functions in the GDScript language.
|
||||
</description>
|
||||
<tutorials>
|
||||
</tutorials>
|
||||
<members>
|
||||
<member name="function" type="int" setter="set_func" getter="get_func" enum="VisualScriptBuiltinFunc.BuiltinFunc" default="0">
|
||||
The function to be executed.
|
||||
</member>
|
||||
</members>
|
||||
<constants>
|
||||
<constant name="MATH_SIN" value="0" enum="BuiltinFunc">
|
||||
Returns the sine of the input.
|
||||
</constant>
|
||||
<constant name="MATH_COS" value="1" enum="BuiltinFunc">
|
||||
Returns the cosine of the input.
|
||||
</constant>
|
||||
<constant name="MATH_TAN" value="2" enum="BuiltinFunc">
|
||||
Returns the tangent of the input.
|
||||
</constant>
|
||||
<constant name="MATH_SINH" value="3" enum="BuiltinFunc">
|
||||
Returns the hyperbolic sine of the input.
|
||||
</constant>
|
||||
<constant name="MATH_COSH" value="4" enum="BuiltinFunc">
|
||||
Returns the hyperbolic cosine of the input.
|
||||
</constant>
|
||||
<constant name="MATH_TANH" value="5" enum="BuiltinFunc">
|
||||
Returns the hyperbolic tangent of the input.
|
||||
</constant>
|
||||
<constant name="MATH_ASIN" value="6" enum="BuiltinFunc">
|
||||
Returns the arc sine of the input.
|
||||
</constant>
|
||||
<constant name="MATH_ACOS" value="7" enum="BuiltinFunc">
|
||||
Returns the arc cosine of the input.
|
||||
</constant>
|
||||
<constant name="MATH_ATAN" value="8" enum="BuiltinFunc">
|
||||
Returns the arc tangent of the input.
|
||||
</constant>
|
||||
<constant name="MATH_ATAN2" value="9" enum="BuiltinFunc">
|
||||
Returns the arc tangent of the input, using the signs of both parameters to determine the exact angle.
|
||||
</constant>
|
||||
<constant name="MATH_SQRT" value="10" enum="BuiltinFunc">
|
||||
Returns the square root of the input.
|
||||
</constant>
|
||||
<constant name="MATH_FMOD" value="11" enum="BuiltinFunc">
|
||||
Returns the remainder of one input divided by the other, using floating-point numbers.
|
||||
</constant>
|
||||
<constant name="MATH_FPOSMOD" value="12" enum="BuiltinFunc">
|
||||
Returns the positive remainder of one input divided by the other, using floating-point numbers.
|
||||
</constant>
|
||||
<constant name="MATH_FLOOR" value="13" enum="BuiltinFunc">
|
||||
Returns the input rounded down.
|
||||
</constant>
|
||||
<constant name="MATH_CEIL" value="14" enum="BuiltinFunc">
|
||||
Returns the input rounded up.
|
||||
</constant>
|
||||
<constant name="MATH_ROUND" value="15" enum="BuiltinFunc">
|
||||
Returns the input rounded to the nearest integer.
|
||||
</constant>
|
||||
<constant name="MATH_ABS" value="16" enum="BuiltinFunc">
|
||||
Returns the absolute value of the input.
|
||||
</constant>
|
||||
<constant name="MATH_SIGN" value="17" enum="BuiltinFunc">
|
||||
Returns the sign of the input, turning it into 1, -1, or 0. Useful to determine if the input is positive or negative.
|
||||
</constant>
|
||||
<constant name="MATH_POW" value="18" enum="BuiltinFunc">
|
||||
Returns the input raised to a given power.
|
||||
</constant>
|
||||
<constant name="MATH_LOG" value="19" enum="BuiltinFunc">
|
||||
Returns the natural logarithm of the input. Note that this is not the typical base-10 logarithm function calculators use.
|
||||
</constant>
|
||||
<constant name="MATH_EXP" value="20" enum="BuiltinFunc">
|
||||
Returns the mathematical constant [b]e[/b] raised to the specified power of the input. [b]e[/b] has an approximate value of 2.71828.
|
||||
</constant>
|
||||
<constant name="MATH_ISNAN" value="21" enum="BuiltinFunc">
|
||||
Returns whether the input is NaN (Not a Number) or not. NaN is usually produced by dividing 0 by 0, though other ways exist.
|
||||
</constant>
|
||||
<constant name="MATH_ISINF" value="22" enum="BuiltinFunc">
|
||||
Returns whether the input is an infinite floating-point number or not. Infinity is usually produced by dividing a number by 0, though other ways exist.
|
||||
</constant>
|
||||
<constant name="MATH_EASE" value="23" enum="BuiltinFunc">
|
||||
Easing function, based on exponent. 0 is constant, 1 is linear, 0 to 1 is ease-in, 1+ is ease out. Negative values are in-out/out in.
|
||||
</constant>
|
||||
<constant name="MATH_STEP_DECIMALS" value="24" enum="BuiltinFunc">
|
||||
Returns the number of digit places after the decimal that the first non-zero digit occurs.
|
||||
</constant>
|
||||
<constant name="MATH_SNAPPED" value="25" enum="BuiltinFunc">
|
||||
Returns the input snapped to a given step.
|
||||
</constant>
|
||||
<constant name="MATH_LERP" value="26" enum="BuiltinFunc">
|
||||
Returns a number linearly interpolated between the first two inputs, based on the third input. Uses the formula [code]a + (a - b) * t[/code].
|
||||
</constant>
|
||||
<constant name="MATH_CUBIC_INTERPOLATE" value="27" enum="BuiltinFunc">
|
||||
</constant>
|
||||
<constant name="MATH_INVERSE_LERP" value="28" enum="BuiltinFunc">
|
||||
</constant>
|
||||
<constant name="MATH_RANGE_LERP" value="29" enum="BuiltinFunc">
|
||||
</constant>
|
||||
<constant name="MATH_MOVE_TOWARD" value="30" enum="BuiltinFunc">
|
||||
Moves the number toward a value, based on the third input.
|
||||
</constant>
|
||||
<constant name="MATH_RANDOMIZE" value="31" enum="BuiltinFunc">
|
||||
Randomize the seed (or the internal state) of the random number generator. Current implementation reseeds using a number based on time.
|
||||
</constant>
|
||||
<constant name="MATH_RANDI" value="32" enum="BuiltinFunc">
|
||||
Returns a random 32 bits integer value. To obtain a random value between 0 to N (where N is smaller than 2^32 - 1), you can use it with the remainder function.
|
||||
</constant>
|
||||
<constant name="MATH_RANDF" value="33" enum="BuiltinFunc">
|
||||
Returns a random floating-point value between 0 and 1. To obtain a random value between 0 to N, you can use it with multiplication.
|
||||
</constant>
|
||||
<constant name="MATH_RANDI_RANGE" value="34" enum="BuiltinFunc">
|
||||
Returns a random 32-bit integer value between the two inputs.
|
||||
</constant>
|
||||
<constant name="MATH_RANDF_RANGE" value="35" enum="BuiltinFunc">
|
||||
Returns a random floating-point value between the two inputs.
|
||||
</constant>
|
||||
<constant name="MATH_RANDFN" value="36" enum="BuiltinFunc">
|
||||
Returns a normally-distributed pseudo-random number, using Box-Muller transform with the specified mean and a standard deviation. This is also called Gaussian distribution.
|
||||
</constant>
|
||||
<constant name="MATH_SEED" value="37" enum="BuiltinFunc">
|
||||
Set the seed for the random number generator.
|
||||
</constant>
|
||||
<constant name="MATH_RANDSEED" value="38" enum="BuiltinFunc">
|
||||
Returns a random value from the given seed, along with the new seed.
|
||||
</constant>
|
||||
<constant name="MATH_DEG2RAD" value="39" enum="BuiltinFunc">
|
||||
Convert the input from degrees to radians.
|
||||
</constant>
|
||||
<constant name="MATH_RAD2DEG" value="40" enum="BuiltinFunc">
|
||||
Convert the input from radians to degrees.
|
||||
</constant>
|
||||
<constant name="MATH_LINEAR2DB" value="41" enum="BuiltinFunc">
|
||||
Convert the input from linear volume to decibel volume.
|
||||
</constant>
|
||||
<constant name="MATH_DB2LINEAR" value="42" enum="BuiltinFunc">
|
||||
Convert the input from decibel volume to linear volume.
|
||||
</constant>
|
||||
<constant name="MATH_WRAP" value="43" enum="BuiltinFunc">
|
||||
</constant>
|
||||
<constant name="MATH_WRAPF" value="44" enum="BuiltinFunc">
|
||||
</constant>
|
||||
<constant name="MATH_PINGPONG" value="45" enum="BuiltinFunc">
|
||||
Returns the [code]value[/code] wrapped between [code]0[/code] and the [code]length[/code]. If the limit is reached, the next value the function returned is decreased to the [code]0[/code] side or increased to the [code]length[/code] side (like a triangle wave). If [code]length[/code] is less than zero, it becomes positive.
|
||||
</constant>
|
||||
<constant name="LOGIC_MAX" value="46" enum="BuiltinFunc">
|
||||
Returns the greater of the two numbers, also known as their maximum.
|
||||
</constant>
|
||||
<constant name="LOGIC_MIN" value="47" enum="BuiltinFunc">
|
||||
Returns the lesser of the two numbers, also known as their minimum.
|
||||
</constant>
|
||||
<constant name="LOGIC_CLAMP" value="48" enum="BuiltinFunc">
|
||||
Returns the input clamped inside the given range, ensuring the result is never outside it. Equivalent to [code]min(max(input, range_low), range_high)[/code].
|
||||
</constant>
|
||||
<constant name="LOGIC_NEAREST_PO2" value="49" enum="BuiltinFunc">
|
||||
Returns the nearest power of 2 to the input.
|
||||
</constant>
|
||||
<constant name="OBJ_WEAKREF" value="50" enum="BuiltinFunc">
|
||||
Create a [WeakRef] from the input.
|
||||
</constant>
|
||||
<constant name="TYPE_CONVERT" value="51" enum="BuiltinFunc">
|
||||
Convert between types.
|
||||
</constant>
|
||||
<constant name="TYPE_OF" value="52" enum="BuiltinFunc">
|
||||
Returns the type of the input as an integer. Check [enum Variant.Type] for the integers that might be returned.
|
||||
</constant>
|
||||
<constant name="TYPE_EXISTS" value="53" enum="BuiltinFunc">
|
||||
Checks if a type is registered in the [ClassDB].
|
||||
</constant>
|
||||
<constant name="TEXT_CHAR" value="54" enum="BuiltinFunc">
|
||||
Returns a character with the given ascii value.
|
||||
</constant>
|
||||
<constant name="TEXT_STR" value="55" enum="BuiltinFunc">
|
||||
Convert the input to a string.
|
||||
</constant>
|
||||
<constant name="TEXT_PRINT" value="56" enum="BuiltinFunc">
|
||||
Print the given string to the output window.
|
||||
</constant>
|
||||
<constant name="TEXT_PRINTERR" value="57" enum="BuiltinFunc">
|
||||
Print the given string to the standard error output.
|
||||
</constant>
|
||||
<constant name="TEXT_PRINTRAW" value="58" enum="BuiltinFunc">
|
||||
Print the given string to the standard output, without adding a newline.
|
||||
</constant>
|
||||
<constant name="TEXT_PRINT_VERBOSE" value="59" enum="BuiltinFunc">
|
||||
</constant>
|
||||
<constant name="VAR_TO_STR" value="60" enum="BuiltinFunc">
|
||||
Serialize a [Variant] to a string.
|
||||
</constant>
|
||||
<constant name="STR_TO_VAR" value="61" enum="BuiltinFunc">
|
||||
Deserialize a [Variant] from a string serialized using [constant VAR_TO_STR].
|
||||
</constant>
|
||||
<constant name="VAR_TO_BYTES" value="62" enum="BuiltinFunc">
|
||||
Serialize a [Variant] to a [PackedByteArray].
|
||||
</constant>
|
||||
<constant name="BYTES_TO_VAR" value="63" enum="BuiltinFunc">
|
||||
Deserialize a [Variant] from a [PackedByteArray] serialized using [constant VAR_TO_BYTES].
|
||||
</constant>
|
||||
<constant name="MATH_SMOOTHSTEP" value="64" enum="BuiltinFunc">
|
||||
Returns a number smoothly interpolated between the first two inputs, based on the third input. Similar to [constant MATH_LERP], but interpolates faster at the beginning and slower at the end. Using Hermite interpolation formula:
|
||||
[codeblock]
|
||||
var t = clamp((weight - from) / (to - from), 0.0, 1.0)
|
||||
return t * t * (3.0 - 2.0 * t)
|
||||
[/codeblock]
|
||||
</constant>
|
||||
<constant name="MATH_POSMOD" value="65" enum="BuiltinFunc">
|
||||
</constant>
|
||||
<constant name="MATH_LERP_ANGLE" value="66" enum="BuiltinFunc">
|
||||
</constant>
|
||||
<constant name="TEXT_ORD" value="67" enum="BuiltinFunc">
|
||||
</constant>
|
||||
<constant name="FUNC_MAX" value="68" enum="BuiltinFunc">
|
||||
Represents the size of the [enum BuiltinFunc] enum.
|
||||
</constant>
|
||||
</constants>
|
||||
</class>
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<class name="VisualScriptClassConstant" inherits="VisualScriptNode" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
|
||||
<class name="VisualScriptClassConstant" inherits="VisualScriptNode" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
|
||||
<brief_description>
|
||||
Gets a constant from a given class.
|
||||
</brief_description>
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<class name="VisualScriptComment" inherits="VisualScriptNode" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
|
||||
<brief_description>
|
||||
A Visual Script node used to annotate the script.
|
||||
</brief_description>
|
||||
<description>
|
||||
A Visual Script node used to display annotations in the script, so that code may be documented.
|
||||
Comment nodes can be resized so they encompass a group of nodes.
|
||||
</description>
|
||||
<tutorials>
|
||||
</tutorials>
|
||||
<members>
|
||||
<member name="description" type="String" setter="set_description" getter="get_description" default="""">
|
||||
The text inside the comment node.
|
||||
</member>
|
||||
<member name="size" type="Vector2" setter="set_size" getter="get_size" default="Vector2(150, 150)">
|
||||
The comment node's size (in pixels).
|
||||
</member>
|
||||
<member name="title" type="String" setter="set_title" getter="get_title" default=""Comment"">
|
||||
The comment node's title.
|
||||
</member>
|
||||
</members>
|
||||
</class>
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<class name="VisualScriptComposeArray" inherits="VisualScriptLists" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
|
||||
<class name="VisualScriptComposeArray" inherits="VisualScriptLists" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
|
||||
<brief_description>
|
||||
A Visual Script Node used to create array from a list of items.
|
||||
</brief_description>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<class name="VisualScriptCondition" inherits="VisualScriptNode" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
|
||||
<class name="VisualScriptCondition" inherits="VisualScriptNode" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
|
||||
<brief_description>
|
||||
A Visual Script node which branches the flow.
|
||||
</brief_description>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<class name="VisualScriptConstant" inherits="VisualScriptNode" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
|
||||
<class name="VisualScriptConstant" inherits="VisualScriptNode" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
|
||||
<brief_description>
|
||||
Gets a contant's value.
|
||||
</brief_description>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<class name="VisualScriptConstructor" inherits="VisualScriptNode" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
|
||||
<class name="VisualScriptConstructor" inherits="VisualScriptNode" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
|
||||
<brief_description>
|
||||
A Visual Script node which calls a base type constructor.
|
||||
</brief_description>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<class name="VisualScriptCustomNode" inherits="VisualScriptNode" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
|
||||
<class name="VisualScriptCustomNode" inherits="VisualScriptNode" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
|
||||
<brief_description>
|
||||
A scripted Visual Script node.
|
||||
</brief_description>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<class name="VisualScriptCustomNodes" inherits="Object" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
|
||||
<class name="VisualScriptCustomNodes" inherits="Object" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
|
||||
<brief_description>
|
||||
Manages custom nodes for the Visual Script editor.
|
||||
</brief_description>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<class name="VisualScriptDeconstruct" inherits="VisualScriptNode" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
|
||||
<class name="VisualScriptDeconstruct" inherits="VisualScriptNode" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
|
||||
<brief_description>
|
||||
A Visual Script node which deconstructs a base type instance into its parts.
|
||||
</brief_description>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<class name="VisualScriptEmitSignal" inherits="VisualScriptNode" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
|
||||
<class name="VisualScriptEmitSignal" inherits="VisualScriptNode" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
|
||||
<brief_description>
|
||||
Emits a specified signal.
|
||||
</brief_description>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<class name="VisualScriptEngineSingleton" inherits="VisualScriptNode" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
|
||||
<class name="VisualScriptEngineSingleton" inherits="VisualScriptNode" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
|
||||
<brief_description>
|
||||
A Visual Script node returning a singleton from [@GlobalScope].
|
||||
</brief_description>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<class name="VisualScriptExpression" inherits="VisualScriptNode" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
|
||||
<class name="VisualScriptExpression" inherits="VisualScriptNode" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
|
||||
<brief_description>
|
||||
A Visual Script node that can execute a custom expression.
|
||||
</brief_description>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<class name="VisualScriptFunction" inherits="VisualScriptNode" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
|
||||
<class name="VisualScriptFunction" inherits="VisualScriptNode" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
|
||||
<brief_description>
|
||||
A Visual Script node representing a function.
|
||||
</brief_description>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<class name="VisualScriptFunctionCall" inherits="VisualScriptNode" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
|
||||
<class name="VisualScriptFunctionCall" inherits="VisualScriptNode" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
|
||||
<brief_description>
|
||||
A Visual Script node for calling a function.
|
||||
</brief_description>
|
||||
@@ -33,7 +33,7 @@
|
||||
<member name="singleton" type="StringName" setter="set_singleton" getter="get_singleton">
|
||||
The singleton to call the method on. Used when [member call_mode] is set to [constant CALL_MODE_SINGLETON].
|
||||
</member>
|
||||
<member name="use_default_args" type="int" setter="set_use_default_args" getter="get_use_default_args">
|
||||
<member name="use_default_args" type="int" setter="set_use_default_args" getter="get_use_default_args" default="0">
|
||||
Number of default arguments that will be used when calling the function. Can't be higher than the number of available default arguments in the method's declaration.
|
||||
</member>
|
||||
<member name="validate" type="bool" setter="set_validate" getter="get_validate" default="true">
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<class name="VisualScriptFunctionState" inherits="RefCounted" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
|
||||
<class name="VisualScriptFunctionState" inherits="RefCounted" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
|
||||
<brief_description>
|
||||
A Visual Script node representing a function state.
|
||||
</brief_description>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<class name="VisualScriptGlobalConstant" inherits="VisualScriptNode" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
|
||||
<class name="VisualScriptGlobalConstant" inherits="VisualScriptNode" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
|
||||
<brief_description>
|
||||
A Visual Script node returning a constant from [@GlobalScope].
|
||||
</brief_description>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<class name="VisualScriptIndexGet" inherits="VisualScriptNode" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
|
||||
<class name="VisualScriptIndexGet" inherits="VisualScriptNode" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
|
||||
<brief_description>
|
||||
A Visual Script node for getting a value from an array or a dictionary.
|
||||
</brief_description>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<class name="VisualScriptIndexSet" inherits="VisualScriptNode" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
|
||||
<class name="VisualScriptIndexSet" inherits="VisualScriptNode" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
|
||||
<brief_description>
|
||||
A Visual Script node for setting a value in an array or a dictionary.
|
||||
</brief_description>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<class name="VisualScriptInputAction" inherits="VisualScriptNode" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
|
||||
<class name="VisualScriptInputAction" inherits="VisualScriptNode" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
|
||||
<brief_description>
|
||||
A Visual Script node returning a state of an action.
|
||||
</brief_description>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<class name="VisualScriptIterator" inherits="VisualScriptNode" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
|
||||
<class name="VisualScriptIterator" inherits="VisualScriptNode" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
|
||||
<brief_description>
|
||||
Steps through items in a given input.
|
||||
</brief_description>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<class name="VisualScriptLists" inherits="VisualScriptNode" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
|
||||
<class name="VisualScriptLists" inherits="VisualScriptNode" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
|
||||
<brief_description>
|
||||
A Visual Script virtual class for in-graph editable nodes.
|
||||
</brief_description>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<class name="VisualScriptLocalVar" inherits="VisualScriptNode" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
|
||||
<class name="VisualScriptLocalVar" inherits="VisualScriptNode" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
|
||||
<brief_description>
|
||||
Gets a local variable's value.
|
||||
</brief_description>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<class name="VisualScriptLocalVarSet" inherits="VisualScriptNode" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
|
||||
<class name="VisualScriptLocalVarSet" inherits="VisualScriptNode" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
|
||||
<brief_description>
|
||||
Changes a local variable's value.
|
||||
</brief_description>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<class name="VisualScriptMathConstant" inherits="VisualScriptNode" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
|
||||
<class name="VisualScriptMathConstant" inherits="VisualScriptNode" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
|
||||
<brief_description>
|
||||
Commonly used mathematical constants.
|
||||
</brief_description>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<class name="VisualScriptNode" inherits="Resource" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
|
||||
<class name="VisualScriptNode" inherits="Resource" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
|
||||
<brief_description>
|
||||
A node which is part of a [VisualScript].
|
||||
</brief_description>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<class name="VisualScriptOperator" inherits="VisualScriptNode" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
|
||||
<class name="VisualScriptOperator" inherits="VisualScriptNode" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
|
||||
<brief_description>
|
||||
A Visual Script node that performs an operation on two values.
|
||||
</brief_description>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<class name="VisualScriptPreload" inherits="VisualScriptNode" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
|
||||
<class name="VisualScriptPreload" inherits="VisualScriptNode" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
|
||||
<brief_description>
|
||||
Creates a new [Resource] or loads one from the filesystem.
|
||||
</brief_description>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<class name="VisualScriptPropertyGet" inherits="VisualScriptNode" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
|
||||
<class name="VisualScriptPropertyGet" inherits="VisualScriptNode" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
|
||||
<brief_description>
|
||||
A Visual Script node returning a value of a property from an [Object].
|
||||
</brief_description>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<class name="VisualScriptPropertySet" inherits="VisualScriptNode" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
|
||||
<class name="VisualScriptPropertySet" inherits="VisualScriptNode" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
|
||||
<brief_description>
|
||||
A Visual Script node that sets a property of an [Object].
|
||||
</brief_description>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<class name="VisualScriptResourcePath" inherits="VisualScriptNode" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
|
||||
<class name="VisualScriptResourcePath" inherits="VisualScriptNode" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
|
||||
<brief_description>
|
||||
</brief_description>
|
||||
<description>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<class name="VisualScriptReturn" inherits="VisualScriptNode" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
|
||||
<class name="VisualScriptReturn" inherits="VisualScriptNode" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
|
||||
<brief_description>
|
||||
Exits a function and returns an optional value.
|
||||
</brief_description>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<class name="VisualScriptSceneNode" inherits="VisualScriptNode" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
|
||||
<class name="VisualScriptSceneNode" inherits="VisualScriptNode" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
|
||||
<brief_description>
|
||||
Node reference.
|
||||
</brief_description>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<class name="VisualScriptSceneTree" inherits="VisualScriptNode" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
|
||||
<class name="VisualScriptSceneTree" inherits="VisualScriptNode" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
|
||||
<brief_description>
|
||||
A Visual Script node for accessing [SceneTree] methods.
|
||||
</brief_description>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<class name="VisualScriptSelect" inherits="VisualScriptNode" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
|
||||
<class name="VisualScriptSelect" inherits="VisualScriptNode" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
|
||||
<brief_description>
|
||||
Chooses between two input values.
|
||||
</brief_description>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<class name="VisualScriptSelf" inherits="VisualScriptNode" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
|
||||
<class name="VisualScriptSelf" inherits="VisualScriptNode" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
|
||||
<brief_description>
|
||||
Outputs a reference to the current instance.
|
||||
</brief_description>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<class name="VisualScriptSequence" inherits="VisualScriptNode" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
|
||||
<class name="VisualScriptSequence" inherits="VisualScriptNode" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
|
||||
<brief_description>
|
||||
Executes a series of Sequence ports.
|
||||
</brief_description>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<class name="VisualScriptSubCall" inherits="VisualScriptNode" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
|
||||
<class name="VisualScriptSubCall" inherits="VisualScriptNode" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
|
||||
<brief_description>
|
||||
Calls a method called [code]_subcall[/code] in this object.
|
||||
</brief_description>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<class name="VisualScriptSwitch" inherits="VisualScriptNode" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
|
||||
<class name="VisualScriptSwitch" inherits="VisualScriptNode" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
|
||||
<brief_description>
|
||||
Branches program flow based on a given input's value.
|
||||
</brief_description>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<class name="VisualScriptTypeCast" inherits="VisualScriptNode" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
|
||||
<class name="VisualScriptTypeCast" inherits="VisualScriptNode" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
|
||||
<brief_description>
|
||||
A Visual Script node that casts the given value to another type.
|
||||
</brief_description>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<class name="VisualScriptVariableGet" inherits="VisualScriptNode" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
|
||||
<class name="VisualScriptVariableGet" inherits="VisualScriptNode" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
|
||||
<brief_description>
|
||||
Gets a variable's value.
|
||||
</brief_description>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<class name="VisualScriptVariableSet" inherits="VisualScriptNode" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
|
||||
<class name="VisualScriptVariableSet" inherits="VisualScriptNode" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
|
||||
<brief_description>
|
||||
Changes a variable's value.
|
||||
</brief_description>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<class name="VisualScriptWhile" inherits="VisualScriptNode" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
|
||||
<class name="VisualScriptWhile" inherits="VisualScriptNode" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
|
||||
<brief_description>
|
||||
Conditional loop.
|
||||
</brief_description>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<class name="VisualScriptYield" inherits="VisualScriptNode" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
|
||||
<class name="VisualScriptYield" inherits="VisualScriptNode" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
|
||||
<brief_description>
|
||||
A Visual Script node used to pause a function execution.
|
||||
</brief_description>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<class name="VisualScriptYieldSignal" inherits="VisualScriptNode" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
|
||||
<class name="VisualScriptYieldSignal" inherits="VisualScriptNode" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
|
||||
<brief_description>
|
||||
A Visual Script node yielding for a signal.
|
||||
</brief_description>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,32 +1,32 @@
|
||||
/*************************************************************************/
|
||||
/* visual_script_editor.h */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* https://godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
|
||||
/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
/**************************************************************************/
|
||||
/* visual_script_editor.h */
|
||||
/**************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* https://godotengine.org */
|
||||
/**************************************************************************/
|
||||
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
|
||||
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef VISUAL_SCRIPT_EDITOR_H
|
||||
#define VISUAL_SCRIPT_EDITOR_H
|
||||
@@ -35,6 +35,7 @@
|
||||
#include "editor/create_dialog.h"
|
||||
#include "editor/editor_inspector.h"
|
||||
#include "editor/plugins/script_editor_plugin.h"
|
||||
#include "scene/resources/style_box_flat.h"
|
||||
#include "visual_script_property_selector.h"
|
||||
|
||||
class GraphEdit;
|
||||
@@ -131,7 +132,7 @@ class VisualScriptEditor : public ScriptEditorBase {
|
||||
EditorProperty *default_property_editor = nullptr;
|
||||
Ref<VisualScriptEditedProperty> edited_default_property_holder;
|
||||
|
||||
Ref<EditorUndoRedoManager> undo_redo;
|
||||
EditorUndoRedoManager *undo_redo = nullptr;
|
||||
Tree *members = nullptr;
|
||||
AcceptDialog *function_name_edit = nullptr;
|
||||
LineEdit *function_name_box = nullptr;
|
||||
@@ -183,10 +184,10 @@ class VisualScriptEditor : public ScriptEditorBase {
|
||||
|
||||
PopupMenu *popup_menu = nullptr;
|
||||
PopupMenu *member_popup = nullptr;
|
||||
MemberType member_type;
|
||||
MemberType member_type{};
|
||||
String member_name;
|
||||
|
||||
PortAction port_action;
|
||||
PortAction port_action{};
|
||||
int port_action_node = 0;
|
||||
int port_action_output = 0;
|
||||
Vector2 port_action_pos;
|
||||
@@ -291,11 +292,9 @@ class VisualScriptEditor : public ScriptEditorBase {
|
||||
void _on_nodes_delete();
|
||||
void _on_nodes_duplicate();
|
||||
|
||||
Variant get_drag_data_fw(const Point2 &p_point, Control *p_from);
|
||||
bool can_drop_data_fw(const Point2 &p_point, const Variant &p_data,
|
||||
Control *p_from) const;
|
||||
void drop_data_fw(const Point2 &p_point, const Variant &p_data,
|
||||
Control *p_from);
|
||||
Variant get_drag_data_fw(const Point2 &p_point);
|
||||
bool can_drop_data_fw(const Point2 &p_point, const Variant &p_data) const;
|
||||
void drop_data_fw(const Point2 &p_point, const Variant &p_data);
|
||||
|
||||
int editing_id = 0;
|
||||
int editing_input = 0;
|
||||
@@ -304,6 +303,8 @@ class VisualScriptEditor : public ScriptEditorBase {
|
||||
int data_disconnect_node = 0;
|
||||
int data_disconnect_port = 0;
|
||||
|
||||
String current_base_type;
|
||||
|
||||
void _default_value_changed(const StringName &p_property,
|
||||
const Variant &p_value, const String &p_field,
|
||||
bool p_changing);
|
||||
@@ -329,6 +330,10 @@ class VisualScriptEditor : public ScriptEditorBase {
|
||||
|
||||
void _toggle_scripts_pressed();
|
||||
|
||||
void _set_base_type_and_script(Ref<VisualScriptNode> &node,
|
||||
const String &base_type,
|
||||
const String &base_script);
|
||||
|
||||
protected:
|
||||
void _notification(int p_what);
|
||||
static void _bind_methods();
|
||||
@@ -339,6 +344,7 @@ public:
|
||||
virtual void
|
||||
set_syntax_highlighter(Ref<EditorSyntaxHighlighter> p_highlighter) override;
|
||||
|
||||
virtual void convert_indent() override;
|
||||
virtual void apply_code() override;
|
||||
virtual Ref<Resource> get_edited_resource() const override;
|
||||
virtual void set_edited_resource(const Ref<Resource> &p_res) override;
|
||||
@@ -355,8 +361,6 @@ public:
|
||||
virtual void clear_executing_line() override;
|
||||
virtual void trim_trailing_whitespace() override;
|
||||
virtual void insert_final_newline() override;
|
||||
virtual void convert_indent_to_spaces() override;
|
||||
virtual void convert_indent_to_tabs() override;
|
||||
virtual void ensure_focus() override;
|
||||
virtual void tag_saved_version() override;
|
||||
virtual void reload(bool p_soft) override;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,37 +1,38 @@
|
||||
/*************************************************************************/
|
||||
/* visual_script_property_selector.h */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* https://godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
|
||||
/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
/**************************************************************************/
|
||||
/* visual_script_property_selector.h */
|
||||
/**************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* https://godotengine.org */
|
||||
/**************************************************************************/
|
||||
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
|
||||
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef VISUAL_SCRIPT_PROPERTY_SELECTOR_H
|
||||
#define VISUAL_SCRIPT_PROPERTY_SELECTOR_H
|
||||
|
||||
#include "../visual_script.h"
|
||||
#include "core/variant/variant.h"
|
||||
#include "editor/editor_help.h"
|
||||
#include "scene/gui/dialogs.h"
|
||||
#include "scene/gui/option_button.h"
|
||||
@@ -39,228 +40,228 @@
|
||||
#include "scene/gui/tree.h"
|
||||
|
||||
class VisualScriptPropertySelector : public ConfirmationDialog {
|
||||
GDCLASS(VisualScriptPropertySelector, ConfirmationDialog);
|
||||
GDCLASS(VisualScriptPropertySelector, ConfirmationDialog);
|
||||
|
||||
enum SearchFlags {
|
||||
SEARCH_CLASSES = 1 << 0,
|
||||
SEARCH_CONSTRUCTORS = 1 << 1,
|
||||
SEARCH_METHODS = 1 << 2,
|
||||
SEARCH_OPERATORS = 1 << 3,
|
||||
SEARCH_SIGNALS = 1 << 4,
|
||||
SEARCH_CONSTANTS = 1 << 5,
|
||||
SEARCH_PROPERTIES = 1 << 6,
|
||||
SEARCH_THEME_ITEMS = 1 << 7,
|
||||
SEARCH_VISUAL_SCRIPT_NODES = 1 << 8,
|
||||
SEARCH_ALL = SEARCH_CLASSES | SEARCH_CONSTRUCTORS | SEARCH_METHODS |
|
||||
SEARCH_OPERATORS | SEARCH_SIGNALS | SEARCH_CONSTANTS |
|
||||
SEARCH_PROPERTIES | SEARCH_THEME_ITEMS,
|
||||
SEARCH_CASE_SENSITIVE = 1 << 29,
|
||||
SEARCH_SHOW_HIERARCHY = 1 << 30,
|
||||
};
|
||||
enum SearchFlags {
|
||||
SEARCH_CLASSES = 1 << 0,
|
||||
SEARCH_CONSTRUCTORS = 1 << 1,
|
||||
SEARCH_METHODS = 1 << 2,
|
||||
SEARCH_OPERATORS = 1 << 3,
|
||||
SEARCH_SIGNALS = 1 << 4,
|
||||
SEARCH_CONSTANTS = 1 << 5,
|
||||
SEARCH_PROPERTIES = 1 << 6,
|
||||
SEARCH_THEME_ITEMS = 1 << 7,
|
||||
SEARCH_VISUAL_SCRIPT_NODES = 1 << 8,
|
||||
SEARCH_ALL = SEARCH_CLASSES | SEARCH_CONSTRUCTORS | SEARCH_METHODS |
|
||||
SEARCH_OPERATORS | SEARCH_SIGNALS | SEARCH_CONSTANTS |
|
||||
SEARCH_PROPERTIES | SEARCH_THEME_ITEMS,
|
||||
SEARCH_CASE_SENSITIVE = 1 << 29,
|
||||
SEARCH_SHOW_HIERARCHY = 1 << 30,
|
||||
};
|
||||
|
||||
enum ScopeFlags {
|
||||
SCOPE_BASE = 1 << 0,
|
||||
SCOPE_INHERITERS = 1 << 1,
|
||||
SCOPE_UNRELATED = 1 << 2,
|
||||
SCOPE_RELATED = SCOPE_BASE | SCOPE_INHERITERS,
|
||||
SCOPE_ALL = SCOPE_BASE | SCOPE_INHERITERS | SCOPE_UNRELATED
|
||||
};
|
||||
enum ScopeFlags {
|
||||
SCOPE_BASE = 1 << 0,
|
||||
SCOPE_INHERITERS = 1 << 1,
|
||||
SCOPE_UNRELATED = 1 << 2,
|
||||
SCOPE_GLOBAL = 1 << 3,
|
||||
SCOPE_RELATED = SCOPE_BASE | SCOPE_INHERITERS,
|
||||
SCOPE_ALL = SCOPE_BASE | SCOPE_INHERITERS | SCOPE_UNRELATED
|
||||
};
|
||||
|
||||
enum ScopeCombo {
|
||||
COMBO_RELATED,
|
||||
COMBO_SEPARATOR,
|
||||
COMBO_BASE,
|
||||
COMBO_INHERITERS,
|
||||
COMBO_UNRELATED,
|
||||
COMBO_ALL,
|
||||
};
|
||||
enum ScopeCombo {
|
||||
COMBO_RELATED,
|
||||
COMBO_SEPARATOR,
|
||||
COMBO_BASE,
|
||||
COMBO_INHERITERS,
|
||||
COMBO_UNRELATED,
|
||||
COMBO_ALL,
|
||||
};
|
||||
|
||||
LineEdit *search_box = nullptr;
|
||||
LineEdit *search_box = nullptr;
|
||||
|
||||
Button *case_sensitive_button = nullptr;
|
||||
Button *hierarchy_button = nullptr;
|
||||
Button *case_sensitive_button = nullptr;
|
||||
Button *hierarchy_button = nullptr;
|
||||
|
||||
Button *search_visual_script_nodes = nullptr;
|
||||
Button *search_classes = nullptr;
|
||||
Button *search_operators = nullptr;
|
||||
Button *search_visual_script_nodes = nullptr;
|
||||
Button *search_classes = nullptr;
|
||||
Button *search_operators = nullptr;
|
||||
|
||||
Button *search_methods = nullptr;
|
||||
Button *search_signals = nullptr;
|
||||
Button *search_constants = nullptr;
|
||||
Button *search_properties = nullptr;
|
||||
Button *search_theme_items = nullptr;
|
||||
Button *search_methods = nullptr;
|
||||
Button *search_signals = nullptr;
|
||||
Button *search_constants = nullptr;
|
||||
Button *search_properties = nullptr;
|
||||
Button *search_theme_items = nullptr;
|
||||
|
||||
OptionButton *scope_combo = nullptr;
|
||||
Tree *results_tree = nullptr;
|
||||
OptionButton *scope_combo = nullptr;
|
||||
Tree *results_tree = nullptr;
|
||||
|
||||
class SearchRunner;
|
||||
Ref<SearchRunner> search_runner;
|
||||
class SearchRunner;
|
||||
Ref<SearchRunner> search_runner;
|
||||
|
||||
void _update_icons();
|
||||
void _update_icons();
|
||||
|
||||
void _sbox_input(const Ref<InputEvent> &p_ie);
|
||||
void _update_results_i(int p_int);
|
||||
void _update_results_s(String p_string);
|
||||
void _update_results_search_all();
|
||||
void _update_results();
|
||||
void _sbox_input(const Ref<InputEvent> &p_ie);
|
||||
void _update_results_i(int p_int);
|
||||
void _update_results_s(String p_string);
|
||||
void _update_results_search_all();
|
||||
void _update_results();
|
||||
|
||||
void _confirmed();
|
||||
void _item_selected();
|
||||
void _hide_requested();
|
||||
void _confirmed();
|
||||
void _item_selected();
|
||||
void _hide_requested();
|
||||
|
||||
EditorHelpBit *help_bit = nullptr;
|
||||
EditorHelpBit *help_bit = nullptr;
|
||||
|
||||
bool properties = false;
|
||||
bool visual_script_generic = false;
|
||||
bool connecting = false;
|
||||
String selected;
|
||||
Variant::Type type;
|
||||
String base_type;
|
||||
String base_script;
|
||||
ObjectID script;
|
||||
Object *instance = nullptr;
|
||||
bool virtuals_only = false;
|
||||
VBoxContainer *vbox = nullptr;
|
||||
bool properties = false;
|
||||
bool visual_script_generic = false;
|
||||
bool connecting = false;
|
||||
String selected;
|
||||
Variant::Type type = Variant::OBJECT;
|
||||
String base_type = "Object";
|
||||
String base_script;
|
||||
ObjectID script;
|
||||
Object *instance = nullptr;
|
||||
bool virtuals_only = false;
|
||||
VBoxContainer *vbox = nullptr;
|
||||
|
||||
protected:
|
||||
void _notification(int p_what);
|
||||
static void _bind_methods();
|
||||
void _notification(int p_what);
|
||||
static void _bind_methods();
|
||||
|
||||
public:
|
||||
void select_method_from_base_type(const String &p_base,
|
||||
const bool p_virtuals_only = false,
|
||||
const bool p_connecting = true,
|
||||
bool clear_text = true);
|
||||
void select_from_base_type(const String &p_base,
|
||||
const String &p_base_script = "",
|
||||
bool p_virtuals_only = false,
|
||||
const bool p_connecting = true,
|
||||
bool clear_text = true);
|
||||
void select_from_script(const Ref<Script> &p_script,
|
||||
const bool p_connecting = true,
|
||||
bool clear_text = true);
|
||||
void select_from_basic_type(Variant::Type p_type,
|
||||
const bool p_connecting = true,
|
||||
bool clear_text = true);
|
||||
void select_from_action(const String &p_type, const bool p_connecting = true,
|
||||
bool clear_text = true);
|
||||
void select_from_instance(Object *p_instance, const bool p_connecting = true,
|
||||
bool clear_text = true);
|
||||
void select_from_visual_script(const Ref<Script> &p_script,
|
||||
bool clear_text = true);
|
||||
void select_from_visual_script(
|
||||
const Ref<Script> &p_script);
|
||||
|
||||
void show_window(float p_screen_ratio);
|
||||
void select_method_from_base_type(const String &p_base,
|
||||
const bool p_virtuals_only = false,
|
||||
const bool p_connecting = true,
|
||||
bool clear_text = true);
|
||||
void select_from_base_type(const String &p_base,
|
||||
const String &p_base_script = "",
|
||||
bool p_virtuals_only = false,
|
||||
const bool p_connecting = true,
|
||||
bool clear_text = true);
|
||||
void select_from_script(const Ref<Script> &p_script,
|
||||
const bool p_connecting = true,
|
||||
bool clear_text = true);
|
||||
void select_from_basic_type(Variant::Type p_type,
|
||||
const bool p_connecting = true,
|
||||
bool clear_text = true);
|
||||
void select_from_instance(Object *p_instance, const bool p_connecting = true,
|
||||
bool clear_text = true);
|
||||
|
||||
VisualScriptPropertySelector();
|
||||
void show_window(float p_screen_ratio);
|
||||
|
||||
VisualScriptPropertySelector();
|
||||
};
|
||||
|
||||
class VisualScriptPropertySelector::SearchRunner : public RefCounted {
|
||||
enum Phase {
|
||||
PHASE_INIT,
|
||||
PHASE_MATCH_CLASSES_INIT,
|
||||
PHASE_NODE_CLASSES_INIT,
|
||||
PHASE_NODE_CLASSES_BUILD,
|
||||
PHASE_MATCH_CLASSES,
|
||||
PHASE_CLASS_ITEMS_INIT,
|
||||
PHASE_CLASS_ITEMS,
|
||||
PHASE_MEMBER_ITEMS_INIT,
|
||||
PHASE_MEMBER_ITEMS,
|
||||
PHASE_SELECT_MATCH,
|
||||
PHASE_MAX
|
||||
};
|
||||
int phase = 0;
|
||||
enum Phase {
|
||||
PHASE_INIT,
|
||||
PHASE_MATCH_CLASSES_INIT,
|
||||
PHASE_NODE_CLASSES_INIT,
|
||||
PHASE_NODE_CLASSES_BUILD,
|
||||
PHASE_MATCH_CLASSES,
|
||||
PHASE_CLASS_ITEMS_INIT,
|
||||
PHASE_CLASS_ITEMS,
|
||||
PHASE_MEMBER_ITEMS_INIT,
|
||||
PHASE_MEMBER_ITEMS,
|
||||
PHASE_SELECT_MATCH,
|
||||
PHASE_MAX
|
||||
};
|
||||
int phase = 0;
|
||||
|
||||
struct ClassMatch {
|
||||
DocData::ClassDoc *doc;
|
||||
bool name = false;
|
||||
String category = "";
|
||||
Vector<DocData::MethodDoc *> constructors;
|
||||
Vector<DocData::MethodDoc *> methods;
|
||||
Vector<DocData::MethodDoc *> operators;
|
||||
Vector<DocData::MethodDoc *> signals;
|
||||
Vector<DocData::ConstantDoc *> constants;
|
||||
Vector<DocData::PropertyDoc *> properties;
|
||||
Vector<DocData::ThemeItemDoc *> theme_properties;
|
||||
struct ClassMatch {
|
||||
DocData::ClassDoc *doc;
|
||||
bool name = false;
|
||||
String category = "";
|
||||
Vector<DocData::MethodDoc *> constructors;
|
||||
Vector<DocData::MethodDoc *> methods;
|
||||
Vector<DocData::MethodDoc *> operators;
|
||||
Vector<DocData::MethodDoc *> signals;
|
||||
Vector<DocData::ConstantDoc *> constants;
|
||||
Vector<DocData::PropertyDoc *> properties;
|
||||
Vector<DocData::ThemeItemDoc *> theme_properties;
|
||||
|
||||
bool required() {
|
||||
return name || methods.size() || signals.size() || constants.size() ||
|
||||
properties.size() || theme_properties.size();
|
||||
}
|
||||
};
|
||||
bool required() {
|
||||
return name || methods.size() || signals.size() || constants.size() ||
|
||||
properties.size() || theme_properties.size();
|
||||
}
|
||||
};
|
||||
|
||||
VisualScriptPropertySelector *selector_ui = nullptr;
|
||||
Control *ui_service = nullptr;
|
||||
Tree *results_tree = nullptr;
|
||||
String term;
|
||||
int search_flags = 0;
|
||||
int scope_flags = 0;
|
||||
VisualScriptPropertySelector *selector_ui = nullptr;
|
||||
Control *ui_service = nullptr;
|
||||
Tree *results_tree = nullptr;
|
||||
String term;
|
||||
int search_flags = 0;
|
||||
int scope_flags = 0;
|
||||
|
||||
Ref<Texture2D> empty_icon;
|
||||
Color disabled_color;
|
||||
Ref<Texture2D> empty_icon;
|
||||
Color disabled_color;
|
||||
|
||||
HashMap<String, DocData::ClassDoc>::Iterator iterator_doc;
|
||||
HashMap<String, ClassMatch> matches;
|
||||
HashMap<String, ClassMatch>::Iterator iterator_match;
|
||||
TreeItem *root_item = nullptr;
|
||||
HashMap<String, TreeItem *> class_items;
|
||||
TreeItem *matched_item = nullptr;
|
||||
float match_highest_score = 0;
|
||||
HashMap<String, DocData::ClassDoc>::Iterator iterator_doc;
|
||||
HashMap<String, ClassMatch> matches;
|
||||
HashMap<String, ClassMatch>::Iterator iterator_match;
|
||||
TreeItem *root_item = nullptr;
|
||||
HashMap<String, TreeItem *> class_items;
|
||||
TreeItem *matched_item = nullptr;
|
||||
float match_highest_score = 0;
|
||||
|
||||
HashMap<String, DocData::ClassDoc> combined_docs;
|
||||
List<String> vs_nodes;
|
||||
HashMap<String, DocData::ClassDoc> combined_docs;
|
||||
List<String> vs_nodes;
|
||||
|
||||
bool _is_class_disabled_by_feature_profile(const StringName &p_class);
|
||||
bool _is_class_disabled_by_scope(const StringName &p_class);
|
||||
bool _is_class_disabled_by_feature_profile(const StringName &p_class);
|
||||
bool _is_class_disabled_by_scope(const StringName &p_class);
|
||||
|
||||
bool _slice();
|
||||
bool _phase_init();
|
||||
bool _phase_match_classes_init();
|
||||
bool _phase_node_classes_init();
|
||||
bool _phase_node_classes_build();
|
||||
bool _phase_match_classes();
|
||||
bool _phase_class_items_init();
|
||||
bool _phase_class_items();
|
||||
bool _phase_member_items_init();
|
||||
bool _phase_member_items();
|
||||
bool _phase_select_match();
|
||||
bool _slice();
|
||||
bool _phase_init();
|
||||
bool _phase_match_classes_init();
|
||||
bool _phase_node_classes_init();
|
||||
bool _phase_node_classes_build();
|
||||
bool _phase_match_classes();
|
||||
bool _phase_class_items_init();
|
||||
bool _phase_class_items();
|
||||
bool _phase_member_items_init();
|
||||
bool _phase_member_items();
|
||||
bool _phase_select_match();
|
||||
|
||||
bool _match_string(const String &p_term, const String &p_string) const;
|
||||
bool _match_visual_script(DocData::ClassDoc &class_doc);
|
||||
bool _match_is_hidden(DocData::ClassDoc &class_doc);
|
||||
void _match_item(TreeItem *p_item, const String &p_text);
|
||||
void _add_class_doc(String class_name, String inherits, String category);
|
||||
DocData::MethodDoc _get_method_doc(MethodInfo method_info);
|
||||
TreeItem *_create_class_hierarchy(const ClassMatch &p_match);
|
||||
TreeItem *_create_class_item(TreeItem *p_parent,
|
||||
const DocData::ClassDoc *p_doc, bool p_gray);
|
||||
TreeItem *_create_method_item(TreeItem *p_parent,
|
||||
const DocData::ClassDoc *p_class_doc,
|
||||
const String &p_text,
|
||||
const DocData::MethodDoc *p_doc);
|
||||
TreeItem *_create_signal_item(TreeItem *p_parent,
|
||||
const DocData::ClassDoc *p_class_doc,
|
||||
const DocData::MethodDoc *p_doc);
|
||||
TreeItem *_create_constant_item(TreeItem *p_parent,
|
||||
const DocData::ClassDoc *p_class_doc,
|
||||
const DocData::ConstantDoc *p_doc);
|
||||
TreeItem *_create_property_item(TreeItem *p_parent,
|
||||
const DocData::ClassDoc *p_class_doc,
|
||||
const DocData::PropertyDoc *p_doc);
|
||||
TreeItem *_create_theme_property_item(TreeItem *p_parent,
|
||||
const DocData::ClassDoc *p_class_doc,
|
||||
const DocData::ThemeItemDoc *p_doc);
|
||||
TreeItem *_create_member_item(TreeItem *p_parent, const String &p_class_name,
|
||||
const String &p_icon, const String &p_name,
|
||||
const String &p_text, const String &p_type,
|
||||
const String &p_metatype,
|
||||
const String &p_tooltip,
|
||||
const String &p_description);
|
||||
bool _match_string(const String &p_term, const String &p_string) const;
|
||||
bool _match_visual_script(DocData::ClassDoc &class_doc);
|
||||
bool _match_is_hidden(DocData::ClassDoc &class_doc);
|
||||
void _match_item(TreeItem *p_item, const String &p_text);
|
||||
void _add_class_doc(String class_name, String inherits, String category);
|
||||
DocData::MethodDoc _get_method_doc(MethodInfo method_info);
|
||||
TreeItem *_create_class_hierarchy(const ClassMatch &p_match);
|
||||
TreeItem *_create_class_item(TreeItem *p_parent,
|
||||
const DocData::ClassDoc *p_doc, bool p_gray);
|
||||
TreeItem *_create_method_item(TreeItem *p_parent,
|
||||
const DocData::ClassDoc *p_class_doc,
|
||||
const String &p_text,
|
||||
const DocData::MethodDoc *p_doc);
|
||||
TreeItem *_create_signal_item(TreeItem *p_parent,
|
||||
const DocData::ClassDoc *p_class_doc,
|
||||
const DocData::MethodDoc *p_doc);
|
||||
TreeItem *_create_constant_item(TreeItem *p_parent,
|
||||
const DocData::ClassDoc *p_class_doc,
|
||||
const DocData::ConstantDoc *p_doc);
|
||||
TreeItem *_create_property_item(TreeItem *p_parent,
|
||||
const DocData::ClassDoc *p_class_doc,
|
||||
const DocData::PropertyDoc *p_doc);
|
||||
TreeItem *_create_theme_property_item(TreeItem *p_parent,
|
||||
const DocData::ClassDoc *p_class_doc,
|
||||
const DocData::ThemeItemDoc *p_doc);
|
||||
TreeItem *_create_member_item(TreeItem *p_parent, const String &p_class_name,
|
||||
const String &p_icon, const String &p_name,
|
||||
const String &p_text, const String &p_type,
|
||||
const String &p_metatype,
|
||||
const String &p_tooltip,
|
||||
const String &p_description);
|
||||
|
||||
public:
|
||||
bool work(uint64_t slot = 100000);
|
||||
bool work(uint64_t slot = 100000);
|
||||
|
||||
SearchRunner(VisualScriptPropertySelector *p_selector_ui,
|
||||
Tree *p_results_tree);
|
||||
SearchRunner(VisualScriptPropertySelector *p_selector_ui,
|
||||
Tree *p_results_tree);
|
||||
};
|
||||
|
||||
#endif // VISUAL_SCRIPT_PROPERTY_SELECTOR_H
|
||||
|
||||
@@ -1,39 +1,38 @@
|
||||
/*************************************************************************/
|
||||
/* register_types.cpp */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* https://godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
|
||||
/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
/**************************************************************************/
|
||||
/* register_types.cpp */
|
||||
/**************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* https://godotengine.org */
|
||||
/**************************************************************************/
|
||||
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
|
||||
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#include "register_types.h"
|
||||
|
||||
#include "core/config/engine.h"
|
||||
#include "core/io/resource_loader.h"
|
||||
#include "visual_script.h"
|
||||
#include "visual_script_builtin_funcs.h"
|
||||
#include "visual_script_expression.h"
|
||||
#include "visual_script_flow_control.h"
|
||||
#include "visual_script_func_nodes.h"
|
||||
@@ -50,7 +49,7 @@ static VisualScriptCustomNodes *vs_custom_nodes_singleton = nullptr;
|
||||
void initialize_visual_script_module(ModuleInitializationLevel p_level) {
|
||||
if (p_level == MODULE_INITIALIZATION_LEVEL_SERVERS) {
|
||||
visual_script_language = memnew(VisualScriptLanguage);
|
||||
//script_language_gd->init();
|
||||
// script_language_gd->init();
|
||||
ScriptServer::register_language(visual_script_language);
|
||||
|
||||
GDREGISTER_CLASS(VisualScript);
|
||||
@@ -76,7 +75,6 @@ void initialize_visual_script_module(ModuleInitializationLevel p_level) {
|
||||
GDREGISTER_CLASS(VisualScriptSelf);
|
||||
GDREGISTER_CLASS(VisualScriptCustomNode);
|
||||
GDREGISTER_CLASS(VisualScriptSubCall);
|
||||
GDREGISTER_CLASS(VisualScriptComment);
|
||||
GDREGISTER_CLASS(VisualScriptConstructor);
|
||||
GDREGISTER_CLASS(VisualScriptLocalVar);
|
||||
GDREGISTER_CLASS(VisualScriptLocalVarSet);
|
||||
@@ -88,7 +86,6 @@ void initialize_visual_script_module(ModuleInitializationLevel p_level) {
|
||||
GDREGISTER_CLASS(VisualScriptFunctionCall);
|
||||
GDREGISTER_CLASS(VisualScriptPropertySet);
|
||||
GDREGISTER_CLASS(VisualScriptPropertyGet);
|
||||
//ClassDB::register_type<VisualScriptScriptCall>();
|
||||
GDREGISTER_CLASS(VisualScriptEmitSignal);
|
||||
|
||||
GDREGISTER_CLASS(VisualScriptReturn);
|
||||
@@ -96,20 +93,16 @@ void initialize_visual_script_module(ModuleInitializationLevel p_level) {
|
||||
GDREGISTER_CLASS(VisualScriptWhile);
|
||||
GDREGISTER_CLASS(VisualScriptIterator);
|
||||
GDREGISTER_CLASS(VisualScriptSequence);
|
||||
//GDREGISTER_CLASS(VisualScriptInputFilter);
|
||||
GDREGISTER_CLASS(VisualScriptSwitch);
|
||||
GDREGISTER_CLASS(VisualScriptSelect);
|
||||
|
||||
GDREGISTER_CLASS(VisualScriptYield);
|
||||
GDREGISTER_CLASS(VisualScriptYieldSignal);
|
||||
|
||||
GDREGISTER_CLASS(VisualScriptBuiltinFunc);
|
||||
|
||||
GDREGISTER_CLASS(VisualScriptExpression);
|
||||
|
||||
register_visual_script_nodes();
|
||||
register_visual_script_func_nodes();
|
||||
register_visual_script_builtin_func_node();
|
||||
register_visual_script_flow_control_nodes();
|
||||
register_visual_script_yield_nodes();
|
||||
register_visual_script_expression_node();
|
||||
@@ -121,7 +114,8 @@ void initialize_visual_script_module(ModuleInitializationLevel p_level) {
|
||||
GDREGISTER_CLASS(VisualScriptCustomNodes);
|
||||
ClassDB::set_current_api(ClassDB::API_CORE);
|
||||
vs_custom_nodes_singleton = memnew(VisualScriptCustomNodes);
|
||||
Engine::get_singleton()->add_singleton(Engine::Singleton("VisualScriptCustomNodes", VisualScriptCustomNodes::get_singleton()));
|
||||
Engine::get_singleton()->add_singleton(Engine::Singleton(
|
||||
"VisualScriptCustomNodes", VisualScriptCustomNodes::get_singleton()));
|
||||
|
||||
VisualScriptEditor::register_editor();
|
||||
}
|
||||
|
||||
@@ -1,32 +1,32 @@
|
||||
/*************************************************************************/
|
||||
/* register_types.h */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* https://godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
|
||||
/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
/**************************************************************************/
|
||||
/* register_types.h */
|
||||
/**************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* https://godotengine.org */
|
||||
/**************************************************************************/
|
||||
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
|
||||
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef VISUAL_SCRIPT_REGISTER_TYPES_H
|
||||
#define VISUAL_SCRIPT_REGISTER_TYPES_H
|
||||
|
||||
1022
visual_script.cpp
1022
visual_script.cpp
File diff suppressed because it is too large
Load Diff
274
visual_script.h
274
visual_script.h
@@ -1,32 +1,32 @@
|
||||
/*************************************************************************/
|
||||
/* visual_script.h */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* https://godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
|
||||
/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
/**************************************************************************/
|
||||
/* visual_script.h */
|
||||
/**************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* https://godotengine.org */
|
||||
/**************************************************************************/
|
||||
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
|
||||
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef VISUAL_SCRIPT_H
|
||||
#define VISUAL_SCRIPT_H
|
||||
@@ -88,7 +88,8 @@ public:
|
||||
void set_breakpoint(bool p_breakpoint);
|
||||
bool is_breakpoint() const;
|
||||
|
||||
virtual VisualScriptNodeInstance *instantiate(VisualScriptInstance *p_instance) = 0;
|
||||
virtual VisualScriptNodeInstance *
|
||||
instantiate(VisualScriptInstance *p_instance) = 0;
|
||||
|
||||
struct TypeGuess {
|
||||
Variant::Type type = Variant::NIL;
|
||||
@@ -108,7 +109,8 @@ class VisualScriptNodeInstance {
|
||||
enum { // Input argument addressing.
|
||||
INPUT_SHIFT = 1 << 24,
|
||||
INPUT_MASK = INPUT_SHIFT - 1,
|
||||
INPUT_DEFAULT_VALUE_BIT = INPUT_SHIFT, // from unassigned input port, using default value (edited by user)
|
||||
INPUT_DEFAULT_VALUE_BIT = INPUT_SHIFT, // from unassigned input port, using
|
||||
// default value (edited by user)
|
||||
};
|
||||
|
||||
int id = 0;
|
||||
@@ -139,22 +141,31 @@ public:
|
||||
STEP_FLAG_GO_BACK_BIT = STEP_SHIFT << 1, // go back to previous node
|
||||
STEP_NO_ADVANCE_BIT = STEP_SHIFT << 2, // do not advance past this node
|
||||
STEP_EXIT_FUNCTION_BIT = STEP_SHIFT << 3, // return from function
|
||||
STEP_YIELD_BIT = STEP_SHIFT << 4, // yield (will find VisualScriptFunctionState state in first working memory)
|
||||
STEP_YIELD_BIT = STEP_SHIFT
|
||||
<< 4, // yield (will find VisualScriptFunctionState state
|
||||
// in first working memory)
|
||||
|
||||
FLOW_STACK_PUSHED_BIT = 1 << 30, // in flow stack, means bit was pushed (must go back here if end of sequence)
|
||||
FLOW_STACK_PUSHED_BIT = 1 << 30, // in flow stack, means bit was pushed
|
||||
// (must go back here if end of sequence)
|
||||
FLOW_STACK_MASK = FLOW_STACK_PUSHED_BIT - 1
|
||||
|
||||
};
|
||||
|
||||
_FORCE_INLINE_ int get_input_port_count() const { return input_port_count; }
|
||||
_FORCE_INLINE_ int get_output_port_count() const { return output_port_count; }
|
||||
_FORCE_INLINE_ int get_sequence_output_count() const { return sequence_output_count; }
|
||||
_FORCE_INLINE_ int get_sequence_output_count() const {
|
||||
return sequence_output_count;
|
||||
}
|
||||
|
||||
_FORCE_INLINE_ int get_id() const { return id; }
|
||||
|
||||
virtual int get_working_memory_size() const { return 0; }
|
||||
|
||||
virtual int step(const Variant **p_inputs, Variant **p_outputs, StartMode p_start_mode, Variant *p_working_mem, Callable::CallError &r_error, String &r_error_str) = 0; // Do a step, return which sequence port to go out.
|
||||
virtual int
|
||||
step(const Variant **p_inputs, Variant **p_outputs, StartMode p_start_mode,
|
||||
Variant *p_working_mem, Callable::CallError &r_error,
|
||||
String &
|
||||
r_error_str) = 0; // Do a step, return which sequence port to go out.
|
||||
|
||||
Ref<VisualScriptNode> get_base_node() { return Ref<VisualScriptNode>(base); }
|
||||
|
||||
@@ -244,7 +255,8 @@ private:
|
||||
#ifdef TOOLS_ENABLED
|
||||
RBSet<PlaceHolderScriptInstance *> placeholders;
|
||||
// void _update_placeholder(PlaceHolderScriptInstance *p_placeholder);
|
||||
virtual void _placeholder_erased(PlaceHolderScriptInstance *p_placeholder) override;
|
||||
virtual void
|
||||
_placeholder_erased(PlaceHolderScriptInstance *p_placeholder) override;
|
||||
void _update_placeholders();
|
||||
#endif
|
||||
|
||||
@@ -272,7 +284,8 @@ public:
|
||||
int get_function_node_id(const StringName &p_name) const;
|
||||
void set_tool_enabled(bool p_enabled);
|
||||
|
||||
void add_node(int p_id, const Ref<VisualScriptNode> &p_node, const Point2 &p_pos = Point2());
|
||||
void add_node(int p_id, const Ref<VisualScriptNode> &p_node,
|
||||
const Point2 &p_pos = Point2());
|
||||
void remove_node(int p_id);
|
||||
bool has_node(int p_id) const;
|
||||
Ref<VisualScriptNode> get_node(int p_id) const;
|
||||
@@ -282,22 +295,31 @@ public:
|
||||
|
||||
void sequence_connect(int p_from_node, int p_from_output, int p_to_node);
|
||||
void sequence_disconnect(int p_from_node, int p_from_output, int p_to_node);
|
||||
bool has_sequence_connection(int p_from_node, int p_from_output, int p_to_node) const;
|
||||
void get_sequence_connection_list(List<SequenceConnection> *r_connection) const;
|
||||
bool has_sequence_connection(int p_from_node, int p_from_output,
|
||||
int p_to_node) const;
|
||||
void
|
||||
get_sequence_connection_list(List<SequenceConnection> *r_connection) const;
|
||||
RBSet<int> get_output_sequence_ports_connected(int from_node);
|
||||
|
||||
void data_connect(int p_from_node, int p_from_port, int p_to_node, int p_to_port);
|
||||
void data_disconnect(int p_from_node, int p_from_port, int p_to_node, int p_to_port);
|
||||
bool has_data_connection(int p_from_node, int p_from_port, int p_to_node, int p_to_port) const;
|
||||
void data_connect(int p_from_node, int p_from_port, int p_to_node,
|
||||
int p_to_port);
|
||||
void data_disconnect(int p_from_node, int p_from_port, int p_to_node,
|
||||
int p_to_port);
|
||||
bool has_data_connection(int p_from_node, int p_from_port, int p_to_node,
|
||||
int p_to_port) const;
|
||||
void get_data_connection_list(List<DataConnection> *r_connection) const;
|
||||
|
||||
bool is_input_value_port_connected(int p_node, int p_port) const;
|
||||
bool get_input_value_port_connection_source(int p_node, int p_port, int *r_node, int *r_port) const;
|
||||
bool get_input_value_port_connection_source(int p_node, int p_port,
|
||||
int *r_node, int *r_port) const;
|
||||
|
||||
void add_variable(const StringName &p_name, const Variant &p_default_value = Variant(), bool p_export = false);
|
||||
void add_variable(const StringName &p_name,
|
||||
const Variant &p_default_value = Variant(),
|
||||
bool p_export = false);
|
||||
bool has_variable(const StringName &p_name) const;
|
||||
void remove_variable(const StringName &p_name);
|
||||
void set_variable_default_value(const StringName &p_name, const Variant &p_value);
|
||||
void set_variable_default_value(const StringName &p_name,
|
||||
const Variant &p_value);
|
||||
Variant get_variable_default_value(const StringName &p_name) const;
|
||||
void set_variable_info(const StringName &p_name, const PropertyInfo &p_info);
|
||||
PropertyInfo get_variable_info(const StringName &p_name) const;
|
||||
@@ -308,17 +330,26 @@ public:
|
||||
|
||||
void add_custom_signal(const StringName &p_name);
|
||||
bool has_custom_signal(const StringName &p_name) const;
|
||||
void custom_signal_add_argument(const StringName &p_func, Variant::Type p_type, const String &p_name, int p_index = -1);
|
||||
void custom_signal_set_argument_type(const StringName &p_func, int p_argidx, Variant::Type p_type);
|
||||
Variant::Type custom_signal_get_argument_type(const StringName &p_func, int p_argidx) const;
|
||||
void custom_signal_set_argument_name(const StringName &p_func, int p_argidx, const String &p_name);
|
||||
String custom_signal_get_argument_name(const StringName &p_func, int p_argidx) const;
|
||||
void custom_signal_add_argument(const StringName &p_func,
|
||||
Variant::Type p_type, const String &p_name,
|
||||
int p_index = -1);
|
||||
void custom_signal_set_argument_type(const StringName &p_func, int p_argidx,
|
||||
Variant::Type p_type);
|
||||
Variant::Type custom_signal_get_argument_type(const StringName &p_func,
|
||||
int p_argidx) const;
|
||||
void custom_signal_set_argument_name(const StringName &p_func, int p_argidx,
|
||||
const String &p_name);
|
||||
String custom_signal_get_argument_name(const StringName &p_func,
|
||||
int p_argidx) const;
|
||||
void custom_signal_remove_argument(const StringName &p_func, int p_argidx);
|
||||
int custom_signal_get_argument_count(const StringName &p_func) const;
|
||||
void custom_signal_swap_argument(const StringName &p_func, int p_argidx, int p_with_argidx);
|
||||
void custom_signal_swap_argument(const StringName &p_func, int p_argidx,
|
||||
int p_with_argidx);
|
||||
void remove_custom_signal(const StringName &p_name);
|
||||
void rename_custom_signal(const StringName &p_name, const StringName &p_new_name);
|
||||
RBSet<int> get_output_sequence_ports_connected(const String &edited_func, int from_node);
|
||||
void rename_custom_signal(const StringName &p_name,
|
||||
const StringName &p_new_name);
|
||||
RBSet<int> get_output_sequence_ports_connected(const String &edited_func,
|
||||
int from_node);
|
||||
|
||||
void get_custom_signal_list(List<StringName> *r_custom_signals) const;
|
||||
|
||||
@@ -329,6 +360,7 @@ public:
|
||||
virtual bool can_instantiate() const override;
|
||||
|
||||
virtual Ref<Script> get_base_script() const override;
|
||||
virtual StringName get_global_name() const override;
|
||||
virtual StringName get_instance_base_type() const override;
|
||||
virtual ScriptInstance *instance_create(Object *p_this) override;
|
||||
virtual bool instance_has(const Object *p_this) const override;
|
||||
@@ -351,15 +383,18 @@ public:
|
||||
virtual ScriptLanguage *get_language() const override;
|
||||
|
||||
virtual bool has_script_signal(const StringName &p_signal) const override;
|
||||
virtual void get_script_signal_list(List<MethodInfo> *r_signals) const override;
|
||||
virtual void
|
||||
get_script_signal_list(List<MethodInfo> *r_signals) const override;
|
||||
|
||||
virtual bool get_property_default_value(const StringName &p_property, Variant &r_value) const override;
|
||||
virtual bool get_property_default_value(const StringName &p_property,
|
||||
Variant &r_value) const override;
|
||||
virtual void get_script_method_list(List<MethodInfo> *p_list) const override;
|
||||
|
||||
virtual bool has_method(const StringName &p_method) const override;
|
||||
virtual MethodInfo get_method_info(const StringName &p_method) const override;
|
||||
|
||||
virtual void get_script_property_list(List<PropertyInfo> *p_list) const override;
|
||||
virtual void
|
||||
get_script_property_list(List<PropertyInfo> *p_list) const override;
|
||||
|
||||
virtual int get_member_line(const StringName &p_member) const override;
|
||||
|
||||
@@ -398,8 +433,15 @@ class VisualScriptInstance : public ScriptInstance {
|
||||
|
||||
StringName source;
|
||||
|
||||
void _dependency_step(VisualScriptNodeInstance *node, int p_pass, int *pass_stack, const Variant **input_args, Variant **output_args, Variant *variant_stack, Callable::CallError &r_error, String &error_str, VisualScriptNodeInstance **r_error_node);
|
||||
Variant _call_internal(const StringName &p_method, void *p_stack, int p_stack_size, VisualScriptNodeInstance *p_node, int p_flow_stack_pos, int p_pass, bool p_resuming_yield, Callable::CallError &r_error);
|
||||
void _dependency_step(VisualScriptNodeInstance *node, int p_pass,
|
||||
int *pass_stack, const Variant **input_args,
|
||||
Variant **output_args, Variant *variant_stack,
|
||||
Callable::CallError &r_error, String &error_str,
|
||||
VisualScriptNodeInstance **r_error_node);
|
||||
Variant _call_internal(const StringName &p_method, void *p_stack,
|
||||
int p_stack_size, VisualScriptNodeInstance *p_node,
|
||||
int p_flow_stack_pos, int p_pass,
|
||||
bool p_resuming_yield, Callable::CallError &r_error);
|
||||
|
||||
friend class VisualScriptFunctionState; // For yield.
|
||||
friend class VisualScriptLanguage; // For debugger.
|
||||
@@ -407,14 +449,21 @@ public:
|
||||
virtual bool set(const StringName &p_name, const Variant &p_value);
|
||||
virtual bool get(const StringName &p_name, Variant &r_ret) const;
|
||||
virtual void get_property_list(List<PropertyInfo> *p_properties) const;
|
||||
virtual Variant::Type get_property_type(const StringName &p_name, bool *r_is_valid = nullptr) const;
|
||||
virtual Variant::Type get_property_type(const StringName &p_name,
|
||||
bool *r_is_valid = nullptr) const;
|
||||
|
||||
virtual bool property_can_revert(const StringName &p_name) const { return false; };
|
||||
virtual bool property_get_revert(const StringName &p_name, Variant &r_ret) const { return false; };
|
||||
virtual bool property_can_revert(const StringName &p_name) const {
|
||||
return false;
|
||||
};
|
||||
virtual bool property_get_revert(const StringName &p_name,
|
||||
Variant &r_ret) const {
|
||||
return false;
|
||||
};
|
||||
|
||||
virtual void get_method_list(List<MethodInfo> *p_list) const;
|
||||
virtual bool has_method(const StringName &p_method) const;
|
||||
virtual Variant callp(const StringName &p_method, const Variant **p_args, int p_argcount, Callable::CallError &r_error);
|
||||
virtual Variant callp(const StringName &p_method, const Variant **p_args,
|
||||
int p_argcount, Callable::CallError &r_error);
|
||||
virtual void notification(int p_notification);
|
||||
String to_string(bool *r_valid);
|
||||
|
||||
@@ -468,7 +517,8 @@ class VisualScriptFunctionState : public RefCounted {
|
||||
int flow_stack_pos = 0;
|
||||
int pass = 0;
|
||||
|
||||
Variant _signal_callback(const Variant **p_args, int p_argcount, Callable::CallError &r_error);
|
||||
Variant _signal_callback(const Variant **p_args, int p_argcount,
|
||||
Callable::CallError &r_error);
|
||||
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
@@ -481,7 +531,8 @@ public:
|
||||
~VisualScriptFunctionState();
|
||||
};
|
||||
|
||||
typedef Ref<VisualScriptNode> (*VisualScriptNodeRegisterFunc)(const String &p_type);
|
||||
typedef Ref<VisualScriptNode> (*VisualScriptNodeRegisterFunc)(
|
||||
const String &p_type);
|
||||
|
||||
class VisualScriptLanguage : public ScriptLanguage {
|
||||
HashMap<String, VisualScriptNodeRegisterFunc> register_funcs;
|
||||
@@ -512,20 +563,28 @@ public:
|
||||
Mutex lock;
|
||||
|
||||
bool debug_break(const String &p_error, bool p_allow_continue = true);
|
||||
bool debug_break_parse(const String &p_file, int p_node, const String &p_error);
|
||||
bool debug_break_parse(const String &p_file, int p_node,
|
||||
const String &p_error);
|
||||
|
||||
_FORCE_INLINE_ void enter_function(VisualScriptInstance *p_instance, const StringName *p_function, Variant *p_stack, Variant **p_work_mem, int *current_id) {
|
||||
_FORCE_INLINE_ void enter_function(VisualScriptInstance *p_instance,
|
||||
const StringName *p_function,
|
||||
Variant *p_stack, Variant **p_work_mem,
|
||||
int *current_id) {
|
||||
if (Thread::get_main_id() != Thread::get_caller_id()) {
|
||||
return; // No support for other threads than main for now.
|
||||
}
|
||||
|
||||
if (EngineDebugger::get_script_debugger()->get_lines_left() > 0 && EngineDebugger::get_script_debugger()->get_depth() >= 0) {
|
||||
EngineDebugger::get_script_debugger()->set_depth(EngineDebugger::get_script_debugger()->get_depth() + 1);
|
||||
if (EngineDebugger::get_script_debugger()->get_lines_left() > 0 &&
|
||||
EngineDebugger::get_script_debugger()->get_depth() >= 0) {
|
||||
EngineDebugger::get_script_debugger()->set_depth(
|
||||
EngineDebugger::get_script_debugger()->get_depth() + 1);
|
||||
}
|
||||
|
||||
if (_debug_call_stack_pos >= _debug_max_call_stack) {
|
||||
// Stack overflow.
|
||||
_debug_error = vformat("Stack overflow (stack size: %s). Check for infinite recursion in your script.", _debug_max_call_stack);
|
||||
_debug_error = vformat("Stack overflow (stack size: %s). Check for "
|
||||
"infinite recursion in your script.",
|
||||
_debug_max_call_stack);
|
||||
EngineDebugger::get_script_debugger()->debug(this);
|
||||
return;
|
||||
}
|
||||
@@ -543,8 +602,10 @@ public:
|
||||
return; // No support for other threads than main for now.
|
||||
}
|
||||
|
||||
if (EngineDebugger::get_script_debugger()->get_lines_left() > 0 && EngineDebugger::get_script_debugger()->get_depth() >= 0) {
|
||||
EngineDebugger::get_script_debugger()->set_depth(EngineDebugger::get_script_debugger()->get_depth() - 1);
|
||||
if (EngineDebugger::get_script_debugger()->get_lines_left() > 0 &&
|
||||
EngineDebugger::get_script_debugger()->get_depth() >= 0) {
|
||||
EngineDebugger::get_script_debugger()->set_depth(
|
||||
EngineDebugger::get_script_debugger()->get_depth() - 1);
|
||||
}
|
||||
|
||||
if (_debug_call_stack_pos == 0) {
|
||||
@@ -564,24 +625,34 @@ public:
|
||||
virtual void init() override;
|
||||
virtual String get_type() const override;
|
||||
virtual String get_extension() const override;
|
||||
virtual Error execute_file(const String &p_path) override;
|
||||
virtual void finish() override;
|
||||
|
||||
/* EDITOR FUNCTIONS */
|
||||
virtual void get_reserved_words(List<String> *p_words) const override;
|
||||
virtual bool is_control_flow_keyword(String p_keyword) const override;
|
||||
virtual void get_comment_delimiters(List<String> *p_delimiters) const override;
|
||||
virtual void
|
||||
get_comment_delimiters(List<String> *p_delimiters) const override;
|
||||
virtual void get_string_delimiters(List<String> *p_delimiters) const override;
|
||||
virtual bool is_using_templates() override;
|
||||
virtual Ref<Script> make_template(const String &p_template, const String &p_class_name, const String &p_base_class_name) const override;
|
||||
virtual bool validate(const String &p_script, const String &p_path = "", List<String> *r_functions = nullptr, List<ScriptLanguage::ScriptError> *r_errors = nullptr, List<ScriptLanguage::Warning> *r_warnings = nullptr, HashSet<int> *r_safe_lines = nullptr) const override;
|
||||
virtual Ref<Script>
|
||||
make_template(const String &p_template, const String &p_class_name,
|
||||
const String &p_base_class_name) const override;
|
||||
virtual bool validate(const String &p_script, const String &p_path = "",
|
||||
List<String> *r_functions = nullptr,
|
||||
List<ScriptLanguage::ScriptError> *r_errors = nullptr,
|
||||
List<ScriptLanguage::Warning> *r_warnings = nullptr,
|
||||
HashSet<int> *r_safe_lines = nullptr) const override;
|
||||
virtual Script *create_script() const override;
|
||||
virtual bool has_named_classes() const override;
|
||||
virtual bool supports_builtin_mode() const override;
|
||||
virtual int find_function(const String &p_function, const String &p_code) const override;
|
||||
virtual String make_function(const String &p_class, const String &p_name, const PackedStringArray &p_args) const override;
|
||||
virtual void auto_indent_code(String &p_code, int p_from_line, int p_to_line) const override;
|
||||
virtual void add_global_constant(const StringName &p_variable, const Variant &p_value) override;
|
||||
virtual int find_function(const String &p_function,
|
||||
const String &p_code) const override;
|
||||
virtual String make_function(const String &p_class, const String &p_name,
|
||||
const PackedStringArray &p_args) const override;
|
||||
virtual void auto_indent_code(String &p_code, int p_from_line,
|
||||
int p_to_line) const override;
|
||||
virtual void add_global_constant(const StringName &p_variable,
|
||||
const Variant &p_value) override;
|
||||
|
||||
/* DEBUGGER FUNCTIONS */
|
||||
|
||||
@@ -590,27 +661,48 @@ public:
|
||||
virtual int debug_get_stack_level_line(int p_level) const override;
|
||||
virtual String debug_get_stack_level_function(int p_level) const override;
|
||||
virtual String debug_get_stack_level_source(int p_level) const override;
|
||||
virtual void debug_get_stack_level_locals(int p_level, List<String> *p_locals, List<Variant> *p_values, int p_max_subitems = -1, int p_max_depth = -1) override;
|
||||
virtual void debug_get_stack_level_members(int p_level, List<String> *p_members, List<Variant> *p_values, int p_max_subitems = -1, int p_max_depth = -1) override;
|
||||
virtual void debug_get_globals(List<String> *p_locals, List<Variant> *p_values, int p_max_subitems = -1, int p_max_depth = -1) override;
|
||||
virtual String debug_parse_stack_level_expression(int p_level, const String &p_expression, int p_max_subitems = -1, int p_max_depth = -1) override;
|
||||
virtual void debug_get_stack_level_locals(int p_level, List<String> *p_locals,
|
||||
List<Variant> *p_values,
|
||||
int p_max_subitems = -1,
|
||||
int p_max_depth = -1) override;
|
||||
virtual void debug_get_stack_level_members(int p_level,
|
||||
List<String> *p_members,
|
||||
List<Variant> *p_values,
|
||||
int p_max_subitems = -1,
|
||||
int p_max_depth = -1) override;
|
||||
virtual void debug_get_globals(List<String> *p_locals,
|
||||
List<Variant> *p_values,
|
||||
int p_max_subitems = -1,
|
||||
int p_max_depth = -1) override;
|
||||
virtual String
|
||||
debug_parse_stack_level_expression(int p_level, const String &p_expression,
|
||||
int p_max_subitems = -1,
|
||||
int p_max_depth = -1) override;
|
||||
|
||||
virtual void reload_all_scripts() override;
|
||||
virtual void reload_tool_script(const Ref<Script> &p_script, bool p_soft_reload) override;
|
||||
virtual void reload_tool_script(const Ref<Script> &p_script,
|
||||
bool p_soft_reload) override;
|
||||
/* LOADER FUNCTIONS */
|
||||
|
||||
virtual void get_recognized_extensions(List<String> *p_extensions) const override;
|
||||
virtual void get_public_functions(List<MethodInfo> *p_functions) const override;
|
||||
virtual void get_public_constants(List<Pair<String, Variant>> *p_constants) const override;
|
||||
virtual void get_public_annotations(List<MethodInfo> *p_annotations) const override;
|
||||
virtual void
|
||||
get_recognized_extensions(List<String> *p_extensions) const override;
|
||||
virtual void
|
||||
get_public_functions(List<MethodInfo> *p_functions) const override;
|
||||
virtual void
|
||||
get_public_constants(List<Pair<String, Variant>> *p_constants) const override;
|
||||
virtual void
|
||||
get_public_annotations(List<MethodInfo> *p_annotations) const override;
|
||||
|
||||
virtual void profiling_start() override;
|
||||
virtual void profiling_stop() override;
|
||||
|
||||
virtual int profiling_get_accumulated_data(ProfilingInfo *p_info_arr, int p_info_max) override;
|
||||
virtual int profiling_get_frame_data(ProfilingInfo *p_info_arr, int p_info_max) override;
|
||||
virtual int profiling_get_accumulated_data(ProfilingInfo *p_info_arr,
|
||||
int p_info_max) override;
|
||||
virtual int profiling_get_frame_data(ProfilingInfo *p_info_arr,
|
||||
int p_info_max) override;
|
||||
|
||||
void add_register_func(const String &p_name, VisualScriptNodeRegisterFunc p_func);
|
||||
void add_register_func(const String &p_name,
|
||||
VisualScriptNodeRegisterFunc p_func);
|
||||
void remove_register_func(const String &p_name);
|
||||
Ref<VisualScriptNode> create_node_from_name(const String &p_name);
|
||||
void get_registered_node_names(List<String> *r_names);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,153 +0,0 @@
|
||||
/*************************************************************************/
|
||||
/* visual_script_builtin_funcs.h */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* https://godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
|
||||
/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
|
||||
#ifndef VISUAL_SCRIPT_BUILTIN_FUNCS_H
|
||||
#define VISUAL_SCRIPT_BUILTIN_FUNCS_H
|
||||
|
||||
#include "visual_script.h"
|
||||
|
||||
class VisualScriptBuiltinFunc : public VisualScriptNode {
|
||||
GDCLASS(VisualScriptBuiltinFunc, VisualScriptNode);
|
||||
|
||||
public:
|
||||
enum BuiltinFunc {
|
||||
MATH_SIN,
|
||||
MATH_COS,
|
||||
MATH_TAN,
|
||||
MATH_SINH,
|
||||
MATH_COSH,
|
||||
MATH_TANH,
|
||||
MATH_ASIN,
|
||||
MATH_ACOS,
|
||||
MATH_ATAN,
|
||||
MATH_ATAN2,
|
||||
MATH_SQRT,
|
||||
MATH_FMOD,
|
||||
MATH_FPOSMOD,
|
||||
MATH_FLOOR,
|
||||
MATH_CEIL,
|
||||
MATH_ROUND,
|
||||
MATH_ABS,
|
||||
MATH_SIGN,
|
||||
MATH_POW,
|
||||
MATH_LOG,
|
||||
MATH_EXP,
|
||||
MATH_ISNAN,
|
||||
MATH_ISINF,
|
||||
MATH_EASE,
|
||||
MATH_STEP_DECIMALS,
|
||||
MATH_SNAPPED,
|
||||
MATH_LERP,
|
||||
MATH_CUBIC_INTERPOLATE,
|
||||
MATH_INVERSE_LERP,
|
||||
MATH_REMAP,
|
||||
MATH_MOVE_TOWARD,
|
||||
MATH_RANDOMIZE,
|
||||
MATH_RANDI,
|
||||
MATH_RANDF,
|
||||
MATH_RANDI_RANGE,
|
||||
MATH_RANDF_RANGE,
|
||||
MATH_RANDFN,
|
||||
MATH_SEED,
|
||||
MATH_RANDSEED,
|
||||
MATH_DEG_TO_RAD,
|
||||
MATH_RAD_TO_DEG,
|
||||
MATH_LINEAR_TO_DB,
|
||||
MATH_DB_TO_LINEAR,
|
||||
MATH_WRAP,
|
||||
MATH_WRAPF,
|
||||
MATH_PINGPONG,
|
||||
LOGIC_MAX,
|
||||
LOGIC_MIN,
|
||||
LOGIC_CLAMP,
|
||||
LOGIC_NEAREST_PO2,
|
||||
OBJ_WEAKREF,
|
||||
TYPE_CONVERT,
|
||||
TYPE_OF,
|
||||
TYPE_EXISTS,
|
||||
TEXT_CHAR,
|
||||
TEXT_STR,
|
||||
TEXT_PRINT,
|
||||
TEXT_PRINTERR,
|
||||
TEXT_PRINTRAW,
|
||||
TEXT_PRINT_VERBOSE,
|
||||
VAR_TO_STR,
|
||||
STR_TO_VAR,
|
||||
VAR_TO_BYTES,
|
||||
BYTES_TO_VAR,
|
||||
MATH_SMOOTHSTEP,
|
||||
MATH_POSMOD,
|
||||
MATH_LERP_ANGLE,
|
||||
TEXT_ORD,
|
||||
FUNC_MAX
|
||||
};
|
||||
|
||||
static int get_func_argument_count(BuiltinFunc p_func);
|
||||
static String get_func_name(BuiltinFunc p_func);
|
||||
static void exec_func(BuiltinFunc p_func, const Variant **p_inputs, Variant *r_return, Callable::CallError &r_error, String &r_error_str);
|
||||
static BuiltinFunc find_function(const String &p_string);
|
||||
|
||||
private:
|
||||
static const char *func_name[FUNC_MAX];
|
||||
BuiltinFunc func;
|
||||
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
|
||||
public:
|
||||
virtual int get_output_sequence_port_count() const override;
|
||||
virtual bool has_input_sequence_port() const override;
|
||||
|
||||
virtual String get_output_sequence_port_text(int p_port) const override;
|
||||
|
||||
virtual int get_input_value_port_count() const override;
|
||||
virtual int get_output_value_port_count() const override;
|
||||
|
||||
virtual PropertyInfo get_input_value_port_info(int p_idx) const override;
|
||||
virtual PropertyInfo get_output_value_port_info(int p_idx) const override;
|
||||
|
||||
virtual String get_caption() const override;
|
||||
//virtual String get_text() const;
|
||||
virtual String get_category() const override { return "functions"; }
|
||||
|
||||
void set_func(BuiltinFunc p_which);
|
||||
BuiltinFunc get_func();
|
||||
|
||||
virtual VisualScriptNodeInstance *instantiate(VisualScriptInstance *p_instance) override;
|
||||
|
||||
VisualScriptBuiltinFunc(VisualScriptBuiltinFunc::BuiltinFunc func);
|
||||
VisualScriptBuiltinFunc();
|
||||
};
|
||||
|
||||
VARIANT_ENUM_CAST(VisualScriptBuiltinFunc::BuiltinFunc)
|
||||
|
||||
void register_visual_script_builtin_func_node();
|
||||
|
||||
#endif // VISUAL_SCRIPT_BUILTIN_FUNCS_H
|
||||
@@ -1,36 +1,37 @@
|
||||
/*************************************************************************/
|
||||
/* visual_script_expression.cpp */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* https://godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
|
||||
/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
/**************************************************************************/
|
||||
/* visual_script_expression.cpp */
|
||||
/**************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* https://godotengine.org */
|
||||
/**************************************************************************/
|
||||
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
|
||||
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#include "visual_script_expression.h"
|
||||
|
||||
bool VisualScriptExpression::_set(const StringName &p_name, const Variant &p_value) {
|
||||
bool VisualScriptExpression::_set(const StringName &p_name,
|
||||
const Variant &p_value) {
|
||||
if (String(p_name) == "expression") {
|
||||
expression = p_value;
|
||||
expression_dirty = true;
|
||||
@@ -89,7 +90,8 @@ bool VisualScriptExpression::_set(const StringName &p_name, const Variant &p_val
|
||||
return false;
|
||||
}
|
||||
|
||||
bool VisualScriptExpression::_get(const StringName &p_name, Variant &r_ret) const {
|
||||
bool VisualScriptExpression::_get(const StringName &p_name,
|
||||
Variant &r_ret) const {
|
||||
if (String(p_name) == "expression") {
|
||||
r_ret = expression;
|
||||
return true;
|
||||
@@ -130,20 +132,27 @@ bool VisualScriptExpression::_get(const StringName &p_name, Variant &r_ret) cons
|
||||
return false;
|
||||
}
|
||||
|
||||
void VisualScriptExpression::_get_property_list(List<PropertyInfo> *p_list) const {
|
||||
void VisualScriptExpression::_get_property_list(
|
||||
List<PropertyInfo> *p_list) const {
|
||||
String argt = "Any";
|
||||
for (int i = 1; i < Variant::VARIANT_MAX; i++) {
|
||||
argt += "," + Variant::get_type_name(Variant::Type(i));
|
||||
}
|
||||
|
||||
p_list->push_back(PropertyInfo(Variant::STRING, "expression", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NO_EDITOR));
|
||||
p_list->push_back(PropertyInfo(Variant::INT, "out_type", PROPERTY_HINT_ENUM, argt));
|
||||
p_list->push_back(PropertyInfo(Variant::INT, "input_count", PROPERTY_HINT_RANGE, "0,64,1"));
|
||||
p_list->push_back(PropertyInfo(Variant::STRING, "expression",
|
||||
PROPERTY_HINT_NONE, "",
|
||||
PROPERTY_USAGE_NO_EDITOR));
|
||||
p_list->push_back(
|
||||
PropertyInfo(Variant::INT, "out_type", PROPERTY_HINT_ENUM, argt));
|
||||
p_list->push_back(
|
||||
PropertyInfo(Variant::INT, "input_count", PROPERTY_HINT_RANGE, "0,64,1"));
|
||||
p_list->push_back(PropertyInfo(Variant::BOOL, "sequenced"));
|
||||
|
||||
for (int i = 0; i < inputs.size(); i++) {
|
||||
p_list->push_back(PropertyInfo(Variant::INT, "input_" + itos(i) + "/type", PROPERTY_HINT_ENUM, argt));
|
||||
p_list->push_back(PropertyInfo(Variant::STRING, "input_" + itos(i) + "/name"));
|
||||
p_list->push_back(PropertyInfo(Variant::INT, "input_" + itos(i) + "/type",
|
||||
PROPERTY_HINT_ENUM, argt));
|
||||
p_list->push_back(
|
||||
PropertyInfo(Variant::STRING, "input_" + itos(i) + "/name"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -163,25 +172,21 @@ int VisualScriptExpression::get_input_value_port_count() const {
|
||||
return inputs.size();
|
||||
}
|
||||
|
||||
int VisualScriptExpression::get_output_value_port_count() const {
|
||||
return 1;
|
||||
}
|
||||
int VisualScriptExpression::get_output_value_port_count() const { return 1; }
|
||||
|
||||
PropertyInfo VisualScriptExpression::get_input_value_port_info(int p_idx) const {
|
||||
PropertyInfo
|
||||
VisualScriptExpression::get_input_value_port_info(int p_idx) const {
|
||||
return PropertyInfo(inputs[p_idx].type, inputs[p_idx].name);
|
||||
}
|
||||
|
||||
PropertyInfo VisualScriptExpression::get_output_value_port_info(int p_idx) const {
|
||||
PropertyInfo
|
||||
VisualScriptExpression::get_output_value_port_info(int p_idx) const {
|
||||
return PropertyInfo(output_type, "result");
|
||||
}
|
||||
|
||||
String VisualScriptExpression::get_caption() const {
|
||||
return RTR("Expression");
|
||||
}
|
||||
String VisualScriptExpression::get_caption() const { return RTR("Expression"); }
|
||||
|
||||
String VisualScriptExpression::get_text() const {
|
||||
return expression;
|
||||
}
|
||||
String VisualScriptExpression::get_text() const { return expression; }
|
||||
|
||||
Error VisualScriptExpression::_get_token(Token &r_token) {
|
||||
while (true) {
|
||||
@@ -339,7 +344,7 @@ Error VisualScriptExpression::_get_token(Token &r_token) {
|
||||
} else if (ch == '"') {
|
||||
break;
|
||||
} else if (ch == '\\') {
|
||||
//escaped characters...
|
||||
// escaped characters...
|
||||
|
||||
char32_t next = GET_CHAR();
|
||||
if (next == 0) {
|
||||
@@ -412,29 +417,34 @@ Error VisualScriptExpression::_get_token(Token &r_token) {
|
||||
prev = res;
|
||||
continue;
|
||||
} else {
|
||||
_set_error("Invalid UTF-16 sequence in string, unpaired lead surrogate");
|
||||
_set_error(
|
||||
"Invalid UTF-16 sequence in string, unpaired lead surrogate");
|
||||
r_token.type = TK_ERROR;
|
||||
return ERR_PARSE_ERROR;
|
||||
}
|
||||
} else if ((res & 0xfffffc00) == 0xdc00) {
|
||||
if (prev == 0) {
|
||||
_set_error("Invalid UTF-16 sequence in string, unpaired trail surrogate");
|
||||
_set_error("Invalid UTF-16 sequence in string, unpaired trail "
|
||||
"surrogate");
|
||||
r_token.type = TK_ERROR;
|
||||
return ERR_PARSE_ERROR;
|
||||
} else {
|
||||
res = (prev << 10UL) + res - ((0xd800 << 10UL) + 0xdc00 - 0x10000);
|
||||
res =
|
||||
(prev << 10UL) + res - ((0xd800 << 10UL) + 0xdc00 - 0x10000);
|
||||
prev = 0;
|
||||
}
|
||||
}
|
||||
if (prev != 0) {
|
||||
_set_error("Invalid UTF-16 sequence in string, unpaired lead surrogate");
|
||||
_set_error(
|
||||
"Invalid UTF-16 sequence in string, unpaired lead surrogate");
|
||||
r_token.type = TK_ERROR;
|
||||
return ERR_PARSE_ERROR;
|
||||
}
|
||||
str += res;
|
||||
} else {
|
||||
if (prev != 0) {
|
||||
_set_error("Invalid UTF-16 sequence in string, unpaired lead surrogate");
|
||||
_set_error(
|
||||
"Invalid UTF-16 sequence in string, unpaired lead surrogate");
|
||||
r_token.type = TK_ERROR;
|
||||
return ERR_PARSE_ERROR;
|
||||
}
|
||||
@@ -442,7 +452,8 @@ Error VisualScriptExpression::_get_token(Token &r_token) {
|
||||
}
|
||||
}
|
||||
if (prev != 0) {
|
||||
_set_error("Invalid UTF-16 sequence in string, unpaired lead surrogate");
|
||||
_set_error(
|
||||
"Invalid UTF-16 sequence in string, unpaired lead surrogate");
|
||||
r_token.type = TK_ERROR;
|
||||
return ERR_PARSE_ERROR;
|
||||
}
|
||||
@@ -458,7 +469,7 @@ Error VisualScriptExpression::_get_token(Token &r_token) {
|
||||
}
|
||||
|
||||
if (is_digit(cchar)) {
|
||||
//a number
|
||||
// a number
|
||||
|
||||
String num;
|
||||
#define READING_SIGN 0
|
||||
@@ -477,7 +488,7 @@ Error VisualScriptExpression::_get_token(Token &r_token) {
|
||||
switch (reading) {
|
||||
case READING_INT: {
|
||||
if (is_digit(c)) {
|
||||
//pass
|
||||
// pass
|
||||
} else if (c == '.') {
|
||||
reading = READING_DEC;
|
||||
is_float = true;
|
||||
@@ -536,13 +547,14 @@ Error VisualScriptExpression::_get_token(Token &r_token) {
|
||||
String id;
|
||||
bool first = true;
|
||||
|
||||
while (is_ascii_char(cchar) || cchar == '_' || (!first && is_digit(cchar))) {
|
||||
while (is_ascii_char(cchar) || cchar == '_' ||
|
||||
(!first && is_digit(cchar))) {
|
||||
id += String::chr(cchar);
|
||||
cchar = GET_CHAR();
|
||||
first = false;
|
||||
}
|
||||
|
||||
str_ofs--; //go back one
|
||||
str_ofs--; // go back one
|
||||
|
||||
if (id == "in") {
|
||||
r_token.type = TK_OP_IN;
|
||||
@@ -584,13 +596,6 @@ Error VisualScriptExpression::_get_token(Token &r_token) {
|
||||
}
|
||||
}
|
||||
|
||||
VisualScriptBuiltinFunc::BuiltinFunc bifunc = VisualScriptBuiltinFunc::find_function(id);
|
||||
if (bifunc != VisualScriptBuiltinFunc::FUNC_MAX) {
|
||||
r_token.type = TK_BUILTIN_FUNC;
|
||||
r_token.value = bifunc;
|
||||
return OK;
|
||||
}
|
||||
|
||||
r_token.type = TK_IDENTIFIER;
|
||||
r_token.value = id;
|
||||
}
|
||||
@@ -609,8 +614,7 @@ Error VisualScriptExpression::_get_token(Token &r_token) {
|
||||
return ERR_PARSE_ERROR;
|
||||
}
|
||||
|
||||
const char *VisualScriptExpression::token_name[TK_MAX] = {
|
||||
"CURLY BRACKET OPEN",
|
||||
const char *VisualScriptExpression::token_name[TK_MAX] = { "CURLY BRACKET OPEN",
|
||||
"CURLY BRACKET CLOSE",
|
||||
"BRACKET OPEN",
|
||||
"BRACKET CLOSE",
|
||||
@@ -646,14 +650,13 @@ const char *VisualScriptExpression::token_name[TK_MAX] = {
|
||||
"OP BIT XOR",
|
||||
"OP BIT INVERT",
|
||||
"EOF",
|
||||
"ERROR"
|
||||
};
|
||||
"ERROR" };
|
||||
|
||||
VisualScriptExpression::ENode *VisualScriptExpression::_parse_expression() {
|
||||
Vector<Expression> expression;
|
||||
Vector<Expression> parse_expression;
|
||||
|
||||
while (true) {
|
||||
//keep appending stuff to expression
|
||||
// keep appending stuff to expression
|
||||
ENode *expr = nullptr;
|
||||
|
||||
Token tk;
|
||||
@@ -664,7 +667,7 @@ VisualScriptExpression::ENode *VisualScriptExpression::_parse_expression() {
|
||||
|
||||
switch (tk.type) {
|
||||
case TK_CURLY_BRACKET_OPEN: {
|
||||
//a dictionary
|
||||
// a dictionary
|
||||
DictionaryNode *dn = alloc_node<DictionaryNode>();
|
||||
|
||||
while (true) {
|
||||
@@ -673,8 +676,8 @@ VisualScriptExpression::ENode *VisualScriptExpression::_parse_expression() {
|
||||
if (tk.type == TK_CURLY_BRACKET_CLOSE) {
|
||||
break;
|
||||
}
|
||||
str_ofs = cofs; //revert
|
||||
//parse an expression
|
||||
str_ofs = cofs; // revert
|
||||
// parse an expression
|
||||
ENode *expr2 = _parse_expression();
|
||||
if (!expr2) {
|
||||
return nullptr;
|
||||
@@ -697,7 +700,7 @@ VisualScriptExpression::ENode *VisualScriptExpression::_parse_expression() {
|
||||
cofs = str_ofs;
|
||||
_get_token(tk);
|
||||
if (tk.type == TK_COMMA) {
|
||||
//all good
|
||||
// all good
|
||||
} else if (tk.type == TK_CURLY_BRACKET_CLOSE) {
|
||||
str_ofs = cofs;
|
||||
} else {
|
||||
@@ -708,7 +711,7 @@ VisualScriptExpression::ENode *VisualScriptExpression::_parse_expression() {
|
||||
expr = dn;
|
||||
} break;
|
||||
case TK_BRACKET_OPEN: {
|
||||
//an array
|
||||
// an array
|
||||
|
||||
ArrayNode *an = alloc_node<ArrayNode>();
|
||||
|
||||
@@ -718,8 +721,8 @@ VisualScriptExpression::ENode *VisualScriptExpression::_parse_expression() {
|
||||
if (tk.type == TK_BRACKET_CLOSE) {
|
||||
break;
|
||||
}
|
||||
str_ofs = cofs; //revert
|
||||
//parse an expression
|
||||
str_ofs = cofs; // revert
|
||||
// parse an expression
|
||||
ENode *expr2 = _parse_expression();
|
||||
if (!expr2) {
|
||||
return nullptr;
|
||||
@@ -729,7 +732,7 @@ VisualScriptExpression::ENode *VisualScriptExpression::_parse_expression() {
|
||||
cofs = str_ofs;
|
||||
_get_token(tk);
|
||||
if (tk.type == TK_COMMA) {
|
||||
//all good
|
||||
// all good
|
||||
} else if (tk.type == TK_BRACKET_CLOSE) {
|
||||
str_ofs = cofs;
|
||||
} else {
|
||||
@@ -740,7 +743,7 @@ VisualScriptExpression::ENode *VisualScriptExpression::_parse_expression() {
|
||||
expr = an;
|
||||
} break;
|
||||
case TK_PARENTHESIS_OPEN: {
|
||||
//a suexpression
|
||||
// a suexpression
|
||||
ENode *e = _parse_expression();
|
||||
if (error_set) {
|
||||
return nullptr;
|
||||
@@ -769,7 +772,10 @@ VisualScriptExpression::ENode *VisualScriptExpression::_parse_expression() {
|
||||
input->index = index;
|
||||
expr = input;
|
||||
} else {
|
||||
_set_error("Invalid input identifier '" + what + "'. For script variables, use self (locals are for inputs)." + what);
|
||||
_set_error(
|
||||
"Invalid input identifier '" + what +
|
||||
"'. For script variables, use self (locals are for inputs)." +
|
||||
what);
|
||||
return nullptr;
|
||||
}
|
||||
} break;
|
||||
@@ -783,7 +789,7 @@ VisualScriptExpression::ENode *VisualScriptExpression::_parse_expression() {
|
||||
expr = constant;
|
||||
} break;
|
||||
case TK_BASIC_TYPE: {
|
||||
//constructor..
|
||||
// constructor..
|
||||
|
||||
Variant::Type bt = Variant::Type(int(tk.value));
|
||||
_get_token(tk);
|
||||
@@ -801,8 +807,8 @@ VisualScriptExpression::ENode *VisualScriptExpression::_parse_expression() {
|
||||
if (tk.type == TK_PARENTHESIS_CLOSE) {
|
||||
break;
|
||||
}
|
||||
str_ofs = cofs; //revert
|
||||
//parse an expression
|
||||
str_ofs = cofs; // revert
|
||||
// parse an expression
|
||||
ENode *expr2 = _parse_expression();
|
||||
if (!expr2) {
|
||||
return nullptr;
|
||||
@@ -813,7 +819,7 @@ VisualScriptExpression::ENode *VisualScriptExpression::_parse_expression() {
|
||||
cofs = str_ofs;
|
||||
_get_token(tk);
|
||||
if (tk.type == TK_COMMA) {
|
||||
//all good
|
||||
// all good
|
||||
} else if (tk.type == TK_PARENTHESIS_CLOSE) {
|
||||
str_ofs = cofs;
|
||||
} else {
|
||||
@@ -823,65 +829,19 @@ VisualScriptExpression::ENode *VisualScriptExpression::_parse_expression() {
|
||||
|
||||
expr = constructor;
|
||||
|
||||
} break;
|
||||
case TK_BUILTIN_FUNC: {
|
||||
//builtin function
|
||||
|
||||
_get_token(tk);
|
||||
if (tk.type != TK_PARENTHESIS_OPEN) {
|
||||
_set_error("Expected '('");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
BuiltinFuncNode *bifunc = alloc_node<BuiltinFuncNode>();
|
||||
bifunc->func = VisualScriptBuiltinFunc::BuiltinFunc(int(tk.value));
|
||||
|
||||
while (true) {
|
||||
int cofs = str_ofs;
|
||||
_get_token(tk);
|
||||
if (tk.type == TK_PARENTHESIS_CLOSE) {
|
||||
break;
|
||||
}
|
||||
str_ofs = cofs; //revert
|
||||
//parse an expression
|
||||
ENode *expr2 = _parse_expression();
|
||||
if (!expr2) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bifunc->arguments.push_back(expr2);
|
||||
|
||||
cofs = str_ofs;
|
||||
_get_token(tk);
|
||||
if (tk.type == TK_COMMA) {
|
||||
//all good
|
||||
} else if (tk.type == TK_PARENTHESIS_CLOSE) {
|
||||
str_ofs = cofs;
|
||||
} else {
|
||||
_set_error("Expected ',' or ')'");
|
||||
}
|
||||
}
|
||||
|
||||
int expected_args = VisualScriptBuiltinFunc::get_func_argument_count(bifunc->func);
|
||||
if (bifunc->arguments.size() != expected_args) {
|
||||
_set_error("Builtin func '" + VisualScriptBuiltinFunc::get_func_name(bifunc->func) + "' expects " + itos(expected_args) + " arguments.");
|
||||
}
|
||||
|
||||
expr = bifunc;
|
||||
|
||||
} break;
|
||||
case TK_OP_SUB: {
|
||||
Expression e;
|
||||
e.is_op = true;
|
||||
e.op = Variant::OP_NEGATE;
|
||||
expression.push_back(e);
|
||||
parse_expression.push_back(e);
|
||||
continue;
|
||||
} break;
|
||||
case TK_OP_NOT: {
|
||||
Expression e;
|
||||
e.is_op = true;
|
||||
e.op = Variant::OP_NOT;
|
||||
expression.push_back(e);
|
||||
parse_expression.push_back(e);
|
||||
continue;
|
||||
} break;
|
||||
|
||||
@@ -891,7 +851,7 @@ VisualScriptExpression::ENode *VisualScriptExpression::_parse_expression() {
|
||||
} break;
|
||||
}
|
||||
|
||||
//before going to operators, must check indexing!
|
||||
// before going to operators, must check indexing!
|
||||
|
||||
while (true) {
|
||||
int cofs2 = str_ofs;
|
||||
@@ -904,7 +864,7 @@ VisualScriptExpression::ENode *VisualScriptExpression::_parse_expression() {
|
||||
|
||||
switch (tk.type) {
|
||||
case TK_BRACKET_OPEN: {
|
||||
//value indexing
|
||||
// value indexing
|
||||
|
||||
IndexNode *index = alloc_node<IndexNode>();
|
||||
index->base = expr;
|
||||
@@ -925,7 +885,7 @@ VisualScriptExpression::ENode *VisualScriptExpression::_parse_expression() {
|
||||
|
||||
} break;
|
||||
case TK_PERIOD: {
|
||||
//named indexing or function call
|
||||
// named indexing or function call
|
||||
_get_token(tk);
|
||||
if (tk.type != TK_IDENTIFIER) {
|
||||
_set_error("Expected identifier after '.'");
|
||||
@@ -937,7 +897,7 @@ VisualScriptExpression::ENode *VisualScriptExpression::_parse_expression() {
|
||||
int cofs = str_ofs;
|
||||
_get_token(tk);
|
||||
if (tk.type == TK_PARENTHESIS_OPEN) {
|
||||
//function call
|
||||
// function call
|
||||
CallNode *func_call = alloc_node<CallNode>();
|
||||
func_call->method = identifier;
|
||||
func_call->base = expr;
|
||||
@@ -948,8 +908,8 @@ VisualScriptExpression::ENode *VisualScriptExpression::_parse_expression() {
|
||||
if (tk.type == TK_PARENTHESIS_CLOSE) {
|
||||
break;
|
||||
}
|
||||
str_ofs = cofs3; //revert
|
||||
//parse an expression
|
||||
str_ofs = cofs3; // revert
|
||||
// parse an expression
|
||||
ENode *expr2 = _parse_expression();
|
||||
if (!expr2) {
|
||||
return nullptr;
|
||||
@@ -960,7 +920,7 @@ VisualScriptExpression::ENode *VisualScriptExpression::_parse_expression() {
|
||||
cofs3 = str_ofs;
|
||||
_get_token(tk);
|
||||
if (tk.type == TK_COMMA) {
|
||||
//all good
|
||||
// all good
|
||||
} else if (tk.type == TK_PARENTHESIS_CLOSE) {
|
||||
str_ofs = cofs3;
|
||||
} else {
|
||||
@@ -970,7 +930,7 @@ VisualScriptExpression::ENode *VisualScriptExpression::_parse_expression() {
|
||||
|
||||
expr = func_call;
|
||||
} else {
|
||||
//named indexing
|
||||
// named indexing
|
||||
str_ofs = cofs;
|
||||
|
||||
NamedIndexNode *index = alloc_node<NamedIndexNode>();
|
||||
@@ -991,15 +951,15 @@ VisualScriptExpression::ENode *VisualScriptExpression::_parse_expression() {
|
||||
}
|
||||
}
|
||||
|
||||
//push expression
|
||||
// push expression
|
||||
{
|
||||
Expression e;
|
||||
e.is_op = false;
|
||||
e.node = expr;
|
||||
expression.push_back(e);
|
||||
parse_expression.push_back(e);
|
||||
}
|
||||
|
||||
//ok finally look for an operator
|
||||
// ok finally look for an operator
|
||||
|
||||
int cofs = str_ofs;
|
||||
_get_token(tk);
|
||||
@@ -1077,29 +1037,30 @@ VisualScriptExpression::ENode *VisualScriptExpression::_parse_expression() {
|
||||
};
|
||||
}
|
||||
|
||||
if (op == Variant::OP_MAX) { //stop appending stuff
|
||||
if (op == Variant::OP_MAX) { // stop appending stuff
|
||||
str_ofs = cofs;
|
||||
break;
|
||||
}
|
||||
|
||||
//push operator and go on
|
||||
// push operator and go on
|
||||
{
|
||||
Expression e;
|
||||
e.is_op = true;
|
||||
e.op = op;
|
||||
expression.push_back(e);
|
||||
parse_expression.push_back(e);
|
||||
}
|
||||
}
|
||||
|
||||
/* Reduce the set of expressions and place them in an operator tree, respecting precedence */
|
||||
/* Reduce the set of expressions and place them in an operator tree,
|
||||
* respecting precedence */
|
||||
|
||||
while (expression.size() > 1) {
|
||||
while (parse_expression.size() > 1) {
|
||||
int next_op = -1;
|
||||
int min_priority = 0xFFFFF;
|
||||
bool is_unary = false;
|
||||
|
||||
for (int i = 0; i < expression.size(); i++) {
|
||||
if (!expression[i].is_op) {
|
||||
for (int i = 0; i < parse_expression.size(); i++) {
|
||||
if (!parse_expression[i].is_op) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -1107,7 +1068,7 @@ VisualScriptExpression::ENode *VisualScriptExpression::_parse_expression() {
|
||||
|
||||
bool unary = false;
|
||||
|
||||
switch (expression[i].op) {
|
||||
switch (parse_expression[i].op) {
|
||||
case Variant::OP_BIT_NEGATE:
|
||||
priority = 0;
|
||||
unary = true;
|
||||
@@ -1187,7 +1148,8 @@ VisualScriptExpression::ENode *VisualScriptExpression::_parse_expression() {
|
||||
break;
|
||||
|
||||
default: {
|
||||
_set_error("Parser bug, invalid operator in expression: " + itos(expression[i].op));
|
||||
_set_error("Parser bug, invalid operator in expression: " +
|
||||
itos(parse_expression[i].op));
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
@@ -1210,41 +1172,41 @@ VisualScriptExpression::ENode *VisualScriptExpression::_parse_expression() {
|
||||
// OK! create operator..
|
||||
if (is_unary) {
|
||||
int expr_pos = next_op;
|
||||
while (expression[expr_pos].is_op) {
|
||||
while (parse_expression[expr_pos].is_op) {
|
||||
expr_pos++;
|
||||
if (expr_pos == expression.size()) {
|
||||
//can happen..
|
||||
// can happen..
|
||||
_set_error("Unexpected end of expression...");
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
//consecutively do unary operators
|
||||
// consecutively do unary operators
|
||||
for (int i = expr_pos - 1; i >= next_op; i--) {
|
||||
OperatorNode *op = alloc_node<OperatorNode>();
|
||||
op->op = expression[i].op;
|
||||
op->nodes[0] = expression[i + 1].node;
|
||||
op->op = parse_expression[i].op;
|
||||
op->nodes[0] = parse_expression[i + 1].node;
|
||||
op->nodes[1] = nullptr;
|
||||
expression.write[i].is_op = false;
|
||||
expression.write[i].node = op;
|
||||
expression.remove_at(i + 1);
|
||||
parse_expression.write[i].is_op = false;
|
||||
parse_expression.write[i].node = op;
|
||||
parse_expression.remove_at(i + 1);
|
||||
}
|
||||
|
||||
} else {
|
||||
if (next_op < 1 || next_op >= (expression.size() - 1)) {
|
||||
if (next_op < 1 || next_op >= (parse_expression.size() - 1)) {
|
||||
_set_error("Parser bug...");
|
||||
ERR_FAIL_V(nullptr);
|
||||
}
|
||||
|
||||
OperatorNode *op = alloc_node<OperatorNode>();
|
||||
op->op = expression[next_op].op;
|
||||
op->op = parse_expression[next_op].op;
|
||||
|
||||
if (expression[next_op - 1].is_op) {
|
||||
if (parse_expression[next_op - 1].is_op) {
|
||||
_set_error("Parser bug...");
|
||||
ERR_FAIL_V(nullptr);
|
||||
}
|
||||
|
||||
if (expression[next_op + 1].is_op) {
|
||||
if (parse_expression[next_op + 1].is_op) {
|
||||
// this is not invalid and can really appear
|
||||
// but it becomes invalid anyway because no binary op
|
||||
// can be followed by a unary op in a valid combination,
|
||||
@@ -1254,17 +1216,17 @@ VisualScriptExpression::ENode *VisualScriptExpression::_parse_expression() {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
op->nodes[0] = expression[next_op - 1].node; //expression goes as left
|
||||
op->nodes[1] = expression[next_op + 1].node; //next expression goes as right
|
||||
op->nodes[0] = parse_expression[next_op - 1].node; // expression goes as left
|
||||
op->nodes[1] = parse_expression[next_op + 1].node; // next expression goes as right
|
||||
|
||||
//replace all 3 nodes by this operator and make it an expression
|
||||
expression.write[next_op - 1].node = op;
|
||||
expression.remove_at(next_op);
|
||||
expression.remove_at(next_op);
|
||||
// replace all 3 nodes by this operator and make it an expression
|
||||
parse_expression.write[next_op - 1].node = op;
|
||||
parse_expression.remove_at(next_op);
|
||||
parse_expression.remove_at(next_op);
|
||||
}
|
||||
}
|
||||
|
||||
return expression[0].node;
|
||||
return parse_expression[0].node;
|
||||
}
|
||||
|
||||
bool VisualScriptExpression::_compile_expression() {
|
||||
@@ -1302,16 +1264,20 @@ public:
|
||||
VisualScriptInstance *instance = nullptr;
|
||||
VisualScriptExpression *expression = nullptr;
|
||||
|
||||
//virtual int get_working_memory_size() const override { return 0; }
|
||||
//execute by parsing the tree directly
|
||||
virtual bool _execute(const Variant **p_inputs, VisualScriptExpression::ENode *p_node, Variant &r_ret, String &r_error_str, Callable::CallError &ce) {
|
||||
// virtual int get_working_memory_size() const override { return 0; }
|
||||
// execute by parsing the tree directly
|
||||
virtual bool _execute(const Variant **p_inputs,
|
||||
VisualScriptExpression::ENode *p_node, Variant &r_ret,
|
||||
String &r_error_str, Callable::CallError &ce) {
|
||||
switch (p_node->type) {
|
||||
case VisualScriptExpression::ENode::TYPE_INPUT: {
|
||||
const VisualScriptExpression::InputNode *in = static_cast<const VisualScriptExpression::InputNode *>(p_node);
|
||||
const VisualScriptExpression::InputNode *in =
|
||||
static_cast<const VisualScriptExpression::InputNode *>(p_node);
|
||||
r_ret = *p_inputs[in->index];
|
||||
} break;
|
||||
case VisualScriptExpression::ENode::TYPE_CONSTANT: {
|
||||
const VisualScriptExpression::ConstantNode *c = static_cast<const VisualScriptExpression::ConstantNode *>(p_node);
|
||||
const VisualScriptExpression::ConstantNode *c =
|
||||
static_cast<const VisualScriptExpression::ConstantNode *>(p_node);
|
||||
r_ret = c->value;
|
||||
|
||||
} break;
|
||||
@@ -1319,7 +1285,8 @@ public:
|
||||
r_ret = instance->get_owner_ptr();
|
||||
} break;
|
||||
case VisualScriptExpression::ENode::TYPE_OPERATOR: {
|
||||
const VisualScriptExpression::OperatorNode *op = static_cast<const VisualScriptExpression::OperatorNode *>(p_node);
|
||||
const VisualScriptExpression::OperatorNode *op =
|
||||
static_cast<const VisualScriptExpression::OperatorNode *>(p_node);
|
||||
|
||||
Variant a;
|
||||
bool ret = _execute(p_inputs, op->nodes[0], a, r_error_str, ce);
|
||||
@@ -1339,16 +1306,20 @@ public:
|
||||
bool valid = true;
|
||||
Variant::evaluate(op->op, a, b, r_ret, valid);
|
||||
if (!valid) {
|
||||
r_error_str = "Invalid operands to operator " + Variant::get_operator_name(op->op) + ": " + Variant::get_type_name(a.get_type()) + " and " + Variant::get_type_name(b.get_type()) + ".";
|
||||
r_error_str = "Invalid operands to operator " +
|
||||
Variant::get_operator_name(op->op) + ": " +
|
||||
Variant::get_type_name(a.get_type()) + " and " +
|
||||
Variant::get_type_name(b.get_type()) + ".";
|
||||
return true;
|
||||
}
|
||||
|
||||
} break;
|
||||
case VisualScriptExpression::ENode::TYPE_INDEX: {
|
||||
const VisualScriptExpression::IndexNode *index = static_cast<const VisualScriptExpression::IndexNode *>(p_node);
|
||||
const VisualScriptExpression::IndexNode *index =
|
||||
static_cast<const VisualScriptExpression::IndexNode *>(p_node);
|
||||
|
||||
Variant base;
|
||||
bool ret = _execute(p_inputs, index->base, base, r_error_str, ce);
|
||||
Variant expression_base;
|
||||
bool ret = _execute(p_inputs, index->base, expression_base, r_error_str, ce);
|
||||
if (ret) {
|
||||
return true;
|
||||
}
|
||||
@@ -1361,32 +1332,39 @@ public:
|
||||
}
|
||||
|
||||
bool valid;
|
||||
r_ret = base.get(idx, &valid);
|
||||
r_ret = expression_base.get(idx, &valid);
|
||||
if (!valid) {
|
||||
r_error_str = "Invalid index of type " + Variant::get_type_name(idx.get_type()) + " for base of type " + Variant::get_type_name(base.get_type()) + ".";
|
||||
r_error_str = "Invalid index of type " +
|
||||
Variant::get_type_name(idx.get_type()) +
|
||||
" for base of type " +
|
||||
Variant::get_type_name(expression_base.get_type()) + ".";
|
||||
return true;
|
||||
}
|
||||
|
||||
} break;
|
||||
case VisualScriptExpression::ENode::TYPE_NAMED_INDEX: {
|
||||
const VisualScriptExpression::NamedIndexNode *index = static_cast<const VisualScriptExpression::NamedIndexNode *>(p_node);
|
||||
const VisualScriptExpression::NamedIndexNode *index =
|
||||
static_cast<const VisualScriptExpression::NamedIndexNode *>(p_node);
|
||||
|
||||
Variant base;
|
||||
bool ret = _execute(p_inputs, index->base, base, r_error_str, ce);
|
||||
Variant typed_named_expression_base;
|
||||
bool ret = _execute(p_inputs, index->base, typed_named_expression_base, r_error_str, ce);
|
||||
if (ret) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool valid;
|
||||
r_ret = base.get_named(index->name, valid);
|
||||
r_ret = typed_named_expression_base.get_named(index->name, valid);
|
||||
if (!valid) {
|
||||
r_error_str = "Invalid index '" + String(index->name) + "' for base of type " + Variant::get_type_name(base.get_type()) + ".";
|
||||
r_error_str = "Invalid index '" + String(index->name) +
|
||||
"' for base of type " +
|
||||
Variant::get_type_name(typed_named_expression_base.get_type()) + ".";
|
||||
return true;
|
||||
}
|
||||
|
||||
} break;
|
||||
case VisualScriptExpression::ENode::TYPE_ARRAY: {
|
||||
const VisualScriptExpression::ArrayNode *array = static_cast<const VisualScriptExpression::ArrayNode *>(p_node);
|
||||
const VisualScriptExpression::ArrayNode *array =
|
||||
static_cast<const VisualScriptExpression::ArrayNode *>(p_node);
|
||||
|
||||
Array arr;
|
||||
arr.resize(array->array.size());
|
||||
@@ -1403,18 +1381,21 @@ public:
|
||||
|
||||
} break;
|
||||
case VisualScriptExpression::ENode::TYPE_DICTIONARY: {
|
||||
const VisualScriptExpression::DictionaryNode *dictionary = static_cast<const VisualScriptExpression::DictionaryNode *>(p_node);
|
||||
const VisualScriptExpression::DictionaryNode *dictionary =
|
||||
static_cast<const VisualScriptExpression::DictionaryNode *>(p_node);
|
||||
|
||||
Dictionary d;
|
||||
for (int i = 0; i < dictionary->dict.size(); i += 2) {
|
||||
Variant key;
|
||||
bool ret = _execute(p_inputs, dictionary->dict[i + 0], key, r_error_str, ce);
|
||||
bool ret =
|
||||
_execute(p_inputs, dictionary->dict[i + 0], key, r_error_str, ce);
|
||||
if (ret) {
|
||||
return true;
|
||||
}
|
||||
|
||||
Variant value;
|
||||
ret = _execute(p_inputs, dictionary->dict[i + 1], value, r_error_str, ce);
|
||||
ret =
|
||||
_execute(p_inputs, dictionary->dict[i + 1], value, r_error_str, ce);
|
||||
if (ret) {
|
||||
return true;
|
||||
}
|
||||
@@ -1425,7 +1406,8 @@ public:
|
||||
r_ret = d;
|
||||
} break;
|
||||
case VisualScriptExpression::ENode::TYPE_CONSTRUCTOR: {
|
||||
const VisualScriptExpression::ConstructorNode *constructor = static_cast<const VisualScriptExpression::ConstructorNode *>(p_node);
|
||||
const VisualScriptExpression::ConstructorNode *constructor =
|
||||
static_cast<const VisualScriptExpression::ConstructorNode *>(p_node);
|
||||
|
||||
Vector<Variant> arr;
|
||||
Vector<const Variant *> argp;
|
||||
@@ -1434,7 +1416,8 @@ public:
|
||||
|
||||
for (int i = 0; i < constructor->arguments.size(); i++) {
|
||||
Variant value;
|
||||
bool ret = _execute(p_inputs, constructor->arguments[i], value, r_error_str, ce);
|
||||
bool ret = _execute(p_inputs, constructor->arguments[i], value,
|
||||
r_error_str, ce);
|
||||
if (ret) {
|
||||
return true;
|
||||
}
|
||||
@@ -1442,45 +1425,22 @@ public:
|
||||
argp.write[i] = &arr[i];
|
||||
}
|
||||
|
||||
Variant::construct(constructor->data_type, r_ret, (const Variant **)argp.ptr(), argp.size(), ce);
|
||||
Variant::construct(constructor->data_type, r_ret,
|
||||
(const Variant **)argp.ptr(), argp.size(), ce);
|
||||
|
||||
if (ce.error != Callable::CallError::CALL_OK) {
|
||||
r_error_str = "Invalid arguments to construct '" + Variant::get_type_name(constructor->data_type) + "'.";
|
||||
return true;
|
||||
}
|
||||
|
||||
} break;
|
||||
case VisualScriptExpression::ENode::TYPE_BUILTIN_FUNC: {
|
||||
const VisualScriptExpression::BuiltinFuncNode *bifunc = static_cast<const VisualScriptExpression::BuiltinFuncNode *>(p_node);
|
||||
|
||||
Vector<Variant> arr;
|
||||
Vector<const Variant *> argp;
|
||||
arr.resize(bifunc->arguments.size());
|
||||
argp.resize(bifunc->arguments.size());
|
||||
|
||||
for (int i = 0; i < bifunc->arguments.size(); i++) {
|
||||
Variant value;
|
||||
bool ret = _execute(p_inputs, bifunc->arguments[i], value, r_error_str, ce);
|
||||
if (ret) {
|
||||
return true;
|
||||
}
|
||||
arr.write[i] = value;
|
||||
argp.write[i] = &arr[i];
|
||||
}
|
||||
|
||||
VisualScriptBuiltinFunc::exec_func(bifunc->func, (const Variant **)argp.ptr(), &r_ret, ce, r_error_str);
|
||||
|
||||
if (ce.error != Callable::CallError::CALL_OK) {
|
||||
r_error_str = "Builtin Call Failed. " + r_error_str;
|
||||
r_error_str = "Invalid arguments to construct '" +
|
||||
Variant::get_type_name(constructor->data_type) + "'.";
|
||||
return true;
|
||||
}
|
||||
|
||||
} break;
|
||||
case VisualScriptExpression::ENode::TYPE_CALL: {
|
||||
const VisualScriptExpression::CallNode *call = static_cast<const VisualScriptExpression::CallNode *>(p_node);
|
||||
const VisualScriptExpression::CallNode *call =
|
||||
static_cast<const VisualScriptExpression::CallNode *>(p_node);
|
||||
|
||||
Variant base;
|
||||
bool ret = _execute(p_inputs, call->base, base, r_error_str, ce);
|
||||
Variant call_expression_base;
|
||||
bool ret = _execute(p_inputs, call->base, call_expression_base, r_error_str, ce);
|
||||
if (ret) {
|
||||
return true;
|
||||
}
|
||||
@@ -1492,7 +1452,8 @@ public:
|
||||
|
||||
for (int i = 0; i < call->arguments.size(); i++) {
|
||||
Variant value;
|
||||
bool ret2 = _execute(p_inputs, call->arguments[i], value, r_error_str, ce);
|
||||
bool ret2 =
|
||||
_execute(p_inputs, call->arguments[i], value, r_error_str, ce);
|
||||
if (ret2) {
|
||||
return true;
|
||||
}
|
||||
@@ -1500,7 +1461,8 @@ public:
|
||||
argp.write[i] = &arr[i];
|
||||
}
|
||||
|
||||
base.callp(call->method, (const Variant **)argp.ptr(), argp.size(), r_ret, ce);
|
||||
call_expression_base.callp(call->method, (const Variant **)argp.ptr(), argp.size(), r_ret,
|
||||
ce);
|
||||
|
||||
if (ce.error != Callable::CallError::CALL_OK) {
|
||||
r_error_str = "On call to '" + String(call->method) + "':";
|
||||
@@ -1512,21 +1474,28 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
virtual int step(const Variant **p_inputs, Variant **p_outputs, StartMode p_start_mode, Variant *p_working_mem, Callable::CallError &r_error, String &r_error_str) override {
|
||||
virtual int step(const Variant **p_inputs, Variant **p_outputs,
|
||||
StartMode p_start_mode, Variant *p_working_mem,
|
||||
Callable::CallError &r_error, String &r_error_str) override {
|
||||
if (!expression->root || expression->error_set) {
|
||||
r_error_str = expression->error_str;
|
||||
r_error.error = Callable::CallError::CALL_ERROR_INVALID_METHOD;
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool error = _execute(p_inputs, expression->root, *p_outputs[0], r_error_str, r_error);
|
||||
bool error = _execute(p_inputs, expression->root, *p_outputs[0],
|
||||
r_error_str, r_error);
|
||||
if (error && r_error.error == Callable::CallError::CALL_OK) {
|
||||
r_error.error = Callable::CallError::CALL_ERROR_INVALID_METHOD;
|
||||
}
|
||||
|
||||
#ifdef DEBUG_ENABLED
|
||||
if (!error && expression->output_type != Variant::NIL && !Variant::can_convert_strict(p_outputs[0]->get_type(), expression->output_type)) {
|
||||
r_error_str += "Can't convert expression result from " + Variant::get_type_name(p_outputs[0]->get_type()) + " to " + Variant::get_type_name(expression->output_type) + ".";
|
||||
if (!error && expression->output_type != Variant::NIL &&
|
||||
!Variant::can_convert_strict(p_outputs[0]->get_type(),
|
||||
expression->output_type)) {
|
||||
r_error_str += "Can't convert expression result from " +
|
||||
Variant::get_type_name(p_outputs[0]->get_type()) + " to " +
|
||||
Variant::get_type_name(expression->output_type) + ".";
|
||||
r_error.error = Callable::CallError::CALL_ERROR_INVALID_METHOD;
|
||||
}
|
||||
#endif
|
||||
@@ -1535,9 +1504,11 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
VisualScriptNodeInstance *VisualScriptExpression::instantiate(VisualScriptInstance *p_instance) {
|
||||
VisualScriptNodeInstance *
|
||||
VisualScriptExpression::instantiate(VisualScriptInstance *p_instance) {
|
||||
_compile_expression();
|
||||
VisualScriptNodeInstanceExpression *instance = memnew(VisualScriptNodeInstanceExpression);
|
||||
VisualScriptNodeInstanceExpression *instance =
|
||||
memnew(VisualScriptNodeInstanceExpression);
|
||||
instance->instance = p_instance;
|
||||
instance->expression = this;
|
||||
return instance;
|
||||
@@ -1556,8 +1527,7 @@ void VisualScriptExpression::reset_state() {
|
||||
inputs.clear();
|
||||
}
|
||||
|
||||
VisualScriptExpression::VisualScriptExpression() {
|
||||
}
|
||||
VisualScriptExpression::VisualScriptExpression() {}
|
||||
|
||||
VisualScriptExpression::~VisualScriptExpression() {
|
||||
if (nodes) {
|
||||
@@ -1566,5 +1536,6 @@ VisualScriptExpression::~VisualScriptExpression() {
|
||||
}
|
||||
|
||||
void register_visual_script_expression_node() {
|
||||
VisualScriptLanguage::singleton->add_register_func("operators/expression", create_node_generic<VisualScriptExpression>);
|
||||
VisualScriptLanguage::singleton->add_register_func(
|
||||
"operators/expression", create_node_generic<VisualScriptExpression>);
|
||||
}
|
||||
|
||||
@@ -1,38 +1,37 @@
|
||||
/*************************************************************************/
|
||||
/* visual_script_expression.h */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* https://godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
|
||||
/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
/**************************************************************************/
|
||||
/* visual_script_expression.h */
|
||||
/**************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* https://godotengine.org */
|
||||
/**************************************************************************/
|
||||
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
|
||||
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef VISUAL_SCRIPT_EXPRESSION_H
|
||||
#define VISUAL_SCRIPT_EXPRESSION_H
|
||||
|
||||
#include "visual_script.h"
|
||||
#include "visual_script_builtin_funcs.h"
|
||||
|
||||
class VisualScriptExpression : public VisualScriptNode {
|
||||
GDCLASS(VisualScriptExpression, VisualScriptNode);
|
||||
@@ -125,7 +124,6 @@ class VisualScriptExpression : public VisualScriptNode {
|
||||
TYPE_ARRAY,
|
||||
TYPE_DICTIONARY,
|
||||
TYPE_CONSTRUCTOR,
|
||||
TYPE_BUILTIN_FUNC,
|
||||
TYPE_CALL
|
||||
};
|
||||
|
||||
@@ -152,16 +150,12 @@ class VisualScriptExpression : public VisualScriptNode {
|
||||
|
||||
struct InputNode : public ENode {
|
||||
int index = 0;
|
||||
InputNode() {
|
||||
type = TYPE_INPUT;
|
||||
}
|
||||
InputNode() { type = TYPE_INPUT; }
|
||||
};
|
||||
|
||||
struct ConstantNode : public ENode {
|
||||
Variant value;
|
||||
ConstantNode() {
|
||||
type = TYPE_CONSTANT;
|
||||
}
|
||||
ConstantNode() { type = TYPE_CONSTANT; }
|
||||
};
|
||||
|
||||
struct OperatorNode : public ENode {
|
||||
@@ -169,42 +163,32 @@ class VisualScriptExpression : public VisualScriptNode {
|
||||
|
||||
ENode *nodes[2] = { nullptr, nullptr };
|
||||
|
||||
OperatorNode() {
|
||||
type = TYPE_OPERATOR;
|
||||
}
|
||||
OperatorNode() { type = TYPE_OPERATOR; }
|
||||
};
|
||||
|
||||
struct SelfNode : public ENode {
|
||||
SelfNode() {
|
||||
type = TYPE_SELF;
|
||||
}
|
||||
SelfNode() { type = TYPE_SELF; }
|
||||
};
|
||||
|
||||
struct IndexNode : public ENode {
|
||||
ENode *base = nullptr;
|
||||
ENode *index = nullptr;
|
||||
|
||||
IndexNode() {
|
||||
type = TYPE_INDEX;
|
||||
}
|
||||
IndexNode() { type = TYPE_INDEX; }
|
||||
};
|
||||
|
||||
struct NamedIndexNode : public ENode {
|
||||
ENode *base = nullptr;
|
||||
StringName name;
|
||||
|
||||
NamedIndexNode() {
|
||||
type = TYPE_NAMED_INDEX;
|
||||
}
|
||||
NamedIndexNode() { type = TYPE_NAMED_INDEX; }
|
||||
};
|
||||
|
||||
struct ConstructorNode : public ENode {
|
||||
Variant::Type data_type = Variant::Type::NIL;
|
||||
Vector<ENode *> arguments;
|
||||
|
||||
ConstructorNode() {
|
||||
type = TYPE_CONSTRUCTOR;
|
||||
}
|
||||
ConstructorNode() { type = TYPE_CONSTRUCTOR; }
|
||||
};
|
||||
|
||||
struct CallNode : public ENode {
|
||||
@@ -212,31 +196,17 @@ class VisualScriptExpression : public VisualScriptNode {
|
||||
StringName method;
|
||||
Vector<ENode *> arguments;
|
||||
|
||||
CallNode() {
|
||||
type = TYPE_CALL;
|
||||
}
|
||||
CallNode() { type = TYPE_CALL; }
|
||||
};
|
||||
|
||||
struct ArrayNode : public ENode {
|
||||
Vector<ENode *> array;
|
||||
ArrayNode() {
|
||||
type = TYPE_ARRAY;
|
||||
}
|
||||
ArrayNode() { type = TYPE_ARRAY; }
|
||||
};
|
||||
|
||||
struct DictionaryNode : public ENode {
|
||||
Vector<ENode *> dict;
|
||||
DictionaryNode() {
|
||||
type = TYPE_DICTIONARY;
|
||||
}
|
||||
};
|
||||
|
||||
struct BuiltinFuncNode : public ENode {
|
||||
VisualScriptBuiltinFunc::BuiltinFunc func = VisualScriptBuiltinFunc::BuiltinFunc::BYTES_TO_VAR;
|
||||
Vector<ENode *> arguments;
|
||||
BuiltinFuncNode() {
|
||||
type = TYPE_BUILTIN_FUNC;
|
||||
}
|
||||
DictionaryNode() { type = TYPE_DICTIONARY; }
|
||||
};
|
||||
|
||||
template <class T>
|
||||
@@ -273,7 +243,8 @@ public:
|
||||
virtual String get_text() const override;
|
||||
virtual String get_category() const override { return "operators"; }
|
||||
|
||||
virtual VisualScriptNodeInstance *instantiate(VisualScriptInstance *p_instance) override;
|
||||
virtual VisualScriptNodeInstance *
|
||||
instantiate(VisualScriptInstance *p_instance) override;
|
||||
|
||||
VisualScriptExpression();
|
||||
~VisualScriptExpression();
|
||||
|
||||
@@ -1,32 +1,32 @@
|
||||
/*************************************************************************/
|
||||
/* visual_script_flow_control.cpp */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* https://godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
|
||||
/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
/**************************************************************************/
|
||||
/* visual_script_flow_control.cpp */
|
||||
/**************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* https://godotengine.org */
|
||||
/**************************************************************************/
|
||||
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
|
||||
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#include "visual_script_flow_control.h"
|
||||
|
||||
@@ -38,21 +38,15 @@
|
||||
////////////////RETURN////////////////////
|
||||
//////////////////////////////////////////
|
||||
|
||||
int VisualScriptReturn::get_output_sequence_port_count() const {
|
||||
return 0;
|
||||
}
|
||||
int VisualScriptReturn::get_output_sequence_port_count() const { return 0; }
|
||||
|
||||
bool VisualScriptReturn::has_input_sequence_port() const {
|
||||
return true;
|
||||
}
|
||||
bool VisualScriptReturn::has_input_sequence_port() const { return true; }
|
||||
|
||||
int VisualScriptReturn::get_input_value_port_count() const {
|
||||
return with_value ? 1 : 0;
|
||||
}
|
||||
|
||||
int VisualScriptReturn::get_output_value_port_count() const {
|
||||
return 0;
|
||||
}
|
||||
int VisualScriptReturn::get_output_value_port_count() const { return 0; }
|
||||
|
||||
String VisualScriptReturn::get_output_sequence_port_text(int p_port) const {
|
||||
return String();
|
||||
@@ -69,13 +63,9 @@ PropertyInfo VisualScriptReturn::get_output_value_port_info(int p_idx) const {
|
||||
return PropertyInfo();
|
||||
}
|
||||
|
||||
String VisualScriptReturn::get_caption() const {
|
||||
return RTR("Return");
|
||||
}
|
||||
String VisualScriptReturn::get_caption() const { return RTR("Return"); }
|
||||
|
||||
String VisualScriptReturn::get_text() const {
|
||||
return get_name();
|
||||
}
|
||||
String VisualScriptReturn::get_text() const { return get_name(); }
|
||||
|
||||
void VisualScriptReturn::set_return_type(Variant::Type p_type) {
|
||||
if (type == p_type) {
|
||||
@@ -85,9 +75,7 @@ void VisualScriptReturn::set_return_type(Variant::Type p_type) {
|
||||
ports_changed_notify();
|
||||
}
|
||||
|
||||
Variant::Type VisualScriptReturn::get_return_type() const {
|
||||
return type;
|
||||
}
|
||||
Variant::Type VisualScriptReturn::get_return_type() const { return type; }
|
||||
|
||||
void VisualScriptReturn::set_enable_return_value(bool p_enable) {
|
||||
if (with_value == p_enable) {
|
||||
@@ -98,23 +86,28 @@ void VisualScriptReturn::set_enable_return_value(bool p_enable) {
|
||||
ports_changed_notify();
|
||||
}
|
||||
|
||||
bool VisualScriptReturn::is_return_value_enabled() const {
|
||||
return with_value;
|
||||
}
|
||||
bool VisualScriptReturn::is_return_value_enabled() const { return with_value; }
|
||||
|
||||
void VisualScriptReturn::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("set_return_type", "type"), &VisualScriptReturn::set_return_type);
|
||||
ClassDB::bind_method(D_METHOD("get_return_type"), &VisualScriptReturn::get_return_type);
|
||||
ClassDB::bind_method(D_METHOD("set_enable_return_value", "enable"), &VisualScriptReturn::set_enable_return_value);
|
||||
ClassDB::bind_method(D_METHOD("is_return_value_enabled"), &VisualScriptReturn::is_return_value_enabled);
|
||||
ClassDB::bind_method(D_METHOD("set_return_type", "type"),
|
||||
&VisualScriptReturn::set_return_type);
|
||||
ClassDB::bind_method(D_METHOD("get_return_type"),
|
||||
&VisualScriptReturn::get_return_type);
|
||||
ClassDB::bind_method(D_METHOD("set_enable_return_value", "enable"),
|
||||
&VisualScriptReturn::set_enable_return_value);
|
||||
ClassDB::bind_method(D_METHOD("is_return_value_enabled"),
|
||||
&VisualScriptReturn::is_return_value_enabled);
|
||||
|
||||
String argt = "Any";
|
||||
for (int i = 1; i < Variant::VARIANT_MAX; i++) {
|
||||
argt += "," + Variant::get_type_name(Variant::Type(i));
|
||||
}
|
||||
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "return_enabled"), "set_enable_return_value", "is_return_value_enabled");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "return_type", PROPERTY_HINT_ENUM, argt), "set_return_type", "get_return_type");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "return_enabled"),
|
||||
"set_enable_return_value", "is_return_value_enabled");
|
||||
ADD_PROPERTY(
|
||||
PropertyInfo(Variant::INT, "return_type", PROPERTY_HINT_ENUM, argt),
|
||||
"set_return_type", "get_return_type");
|
||||
}
|
||||
|
||||
class VisualScriptNodeInstanceReturn : public VisualScriptNodeInstance {
|
||||
@@ -124,10 +117,13 @@ public:
|
||||
bool with_value = false;
|
||||
|
||||
virtual int get_working_memory_size() const override { return 1; }
|
||||
//virtual bool is_output_port_unsequenced(int p_idx) const { return false; }
|
||||
//virtual bool get_output_port_unsequenced(int p_idx,Variant* r_value,Variant* p_working_mem,String &r_error) const { return true; }
|
||||
// virtual bool is_output_port_unsequenced(int p_idx) const { return false; }
|
||||
// virtual bool get_output_port_unsequenced(int p_idx,Variant*
|
||||
// r_value,Variant* p_working_mem,String &r_error) const { return true; }
|
||||
|
||||
virtual int step(const Variant **p_inputs, Variant **p_outputs, StartMode p_start_mode, Variant *p_working_mem, Callable::CallError &r_error, String &r_error_str) override {
|
||||
virtual int step(const Variant **p_inputs, Variant **p_outputs,
|
||||
StartMode p_start_mode, Variant *p_working_mem,
|
||||
Callable::CallError &r_error, String &r_error_str) override {
|
||||
if (with_value) {
|
||||
*p_working_mem = *p_inputs[0];
|
||||
return STEP_EXIT_FUNCTION_BIT;
|
||||
@@ -138,8 +134,10 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
VisualScriptNodeInstance *VisualScriptReturn::instantiate(VisualScriptInstance *p_instance) {
|
||||
VisualScriptNodeInstanceReturn *instance = memnew(VisualScriptNodeInstanceReturn);
|
||||
VisualScriptNodeInstance *
|
||||
VisualScriptReturn::instantiate(VisualScriptInstance *p_instance) {
|
||||
VisualScriptNodeInstanceReturn *instance =
|
||||
memnew(VisualScriptNodeInstanceReturn);
|
||||
instance->node = this;
|
||||
instance->instance = p_instance;
|
||||
instance->with_value = with_value;
|
||||
@@ -163,21 +161,13 @@ static Ref<VisualScriptNode> create_return_node(const String &p_name) {
|
||||
////////////////CONDITION/////////////////
|
||||
//////////////////////////////////////////
|
||||
|
||||
int VisualScriptCondition::get_output_sequence_port_count() const {
|
||||
return 3;
|
||||
}
|
||||
int VisualScriptCondition::get_output_sequence_port_count() const { return 3; }
|
||||
|
||||
bool VisualScriptCondition::has_input_sequence_port() const {
|
||||
return true;
|
||||
}
|
||||
bool VisualScriptCondition::has_input_sequence_port() const { return true; }
|
||||
|
||||
int VisualScriptCondition::get_input_value_port_count() const {
|
||||
return 1;
|
||||
}
|
||||
int VisualScriptCondition::get_input_value_port_count() const { return 1; }
|
||||
|
||||
int VisualScriptCondition::get_output_value_port_count() const {
|
||||
return 0;
|
||||
}
|
||||
int VisualScriptCondition::get_output_value_port_count() const { return 0; }
|
||||
|
||||
String VisualScriptCondition::get_output_sequence_port_text(int p_port) const {
|
||||
if (p_port == 0) {
|
||||
@@ -196,31 +186,30 @@ PropertyInfo VisualScriptCondition::get_input_value_port_info(int p_idx) const {
|
||||
return pinfo;
|
||||
}
|
||||
|
||||
PropertyInfo VisualScriptCondition::get_output_value_port_info(int p_idx) const {
|
||||
PropertyInfo
|
||||
VisualScriptCondition::get_output_value_port_info(int p_idx) const {
|
||||
return PropertyInfo();
|
||||
}
|
||||
|
||||
String VisualScriptCondition::get_caption() const {
|
||||
return RTR("Condition");
|
||||
}
|
||||
String VisualScriptCondition::get_caption() const { return RTR("Condition"); }
|
||||
|
||||
String VisualScriptCondition::get_text() const {
|
||||
return RTR("if (cond) is:");
|
||||
}
|
||||
String VisualScriptCondition::get_text() const { return RTR("if (cond) is:"); }
|
||||
|
||||
void VisualScriptCondition::_bind_methods() {
|
||||
}
|
||||
void VisualScriptCondition::_bind_methods() {}
|
||||
|
||||
class VisualScriptNodeInstanceCondition : public VisualScriptNodeInstance {
|
||||
public:
|
||||
VisualScriptCondition *node = nullptr;
|
||||
VisualScriptInstance *instance = nullptr;
|
||||
|
||||
//virtual int get_working_memory_size() const override { return 1; }
|
||||
//virtual bool is_output_port_unsequenced(int p_idx) const { return false; }
|
||||
//virtual bool get_output_port_unsequenced(int p_idx,Variant* r_value,Variant* p_working_mem,String &r_error) const { return true; }
|
||||
// virtual int get_working_memory_size() const override { return 1; }
|
||||
// virtual bool is_output_port_unsequenced(int p_idx) const { return false; }
|
||||
// virtual bool get_output_port_unsequenced(int p_idx,Variant*
|
||||
// r_value,Variant* p_working_mem,String &r_error) const { return true; }
|
||||
|
||||
virtual int step(const Variant **p_inputs, Variant **p_outputs, StartMode p_start_mode, Variant *p_working_mem, Callable::CallError &r_error, String &r_error_str) override {
|
||||
virtual int step(const Variant **p_inputs, Variant **p_outputs,
|
||||
StartMode p_start_mode, Variant *p_working_mem,
|
||||
Callable::CallError &r_error, String &r_error_str) override {
|
||||
if (p_start_mode == START_MODE_CONTINUE_SEQUENCE) {
|
||||
return 2;
|
||||
} else if (p_inputs[0]->operator bool()) {
|
||||
@@ -231,35 +220,28 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
VisualScriptNodeInstance *VisualScriptCondition::instantiate(VisualScriptInstance *p_instance) {
|
||||
VisualScriptNodeInstanceCondition *instance = memnew(VisualScriptNodeInstanceCondition);
|
||||
VisualScriptNodeInstance *
|
||||
VisualScriptCondition::instantiate(VisualScriptInstance *p_instance) {
|
||||
VisualScriptNodeInstanceCondition *instance =
|
||||
memnew(VisualScriptNodeInstanceCondition);
|
||||
instance->node = this;
|
||||
instance->instance = p_instance;
|
||||
return instance;
|
||||
}
|
||||
|
||||
VisualScriptCondition::VisualScriptCondition() {
|
||||
}
|
||||
VisualScriptCondition::VisualScriptCondition() {}
|
||||
|
||||
//////////////////////////////////////////
|
||||
////////////////WHILE/////////////////
|
||||
//////////////////////////////////////////
|
||||
|
||||
int VisualScriptWhile::get_output_sequence_port_count() const {
|
||||
return 2;
|
||||
}
|
||||
int VisualScriptWhile::get_output_sequence_port_count() const { return 2; }
|
||||
|
||||
bool VisualScriptWhile::has_input_sequence_port() const {
|
||||
return true;
|
||||
}
|
||||
bool VisualScriptWhile::has_input_sequence_port() const { return true; }
|
||||
|
||||
int VisualScriptWhile::get_input_value_port_count() const {
|
||||
return 1;
|
||||
}
|
||||
int VisualScriptWhile::get_input_value_port_count() const { return 1; }
|
||||
|
||||
int VisualScriptWhile::get_output_value_port_count() const {
|
||||
return 0;
|
||||
}
|
||||
int VisualScriptWhile::get_output_value_port_count() const { return 0; }
|
||||
|
||||
String VisualScriptWhile::get_output_sequence_port_text(int p_port) const {
|
||||
if (p_port == 0) {
|
||||
@@ -280,27 +262,25 @@ PropertyInfo VisualScriptWhile::get_output_value_port_info(int p_idx) const {
|
||||
return PropertyInfo();
|
||||
}
|
||||
|
||||
String VisualScriptWhile::get_caption() const {
|
||||
return RTR("While");
|
||||
}
|
||||
String VisualScriptWhile::get_caption() const { return RTR("While"); }
|
||||
|
||||
String VisualScriptWhile::get_text() const {
|
||||
return RTR("while (cond):");
|
||||
}
|
||||
String VisualScriptWhile::get_text() const { return RTR("while (cond):"); }
|
||||
|
||||
void VisualScriptWhile::_bind_methods() {
|
||||
}
|
||||
void VisualScriptWhile::_bind_methods() {}
|
||||
|
||||
class VisualScriptNodeInstanceWhile : public VisualScriptNodeInstance {
|
||||
public:
|
||||
VisualScriptWhile *node = nullptr;
|
||||
VisualScriptInstance *instance = nullptr;
|
||||
|
||||
//virtual int get_working_memory_size() const override { return 1; }
|
||||
//virtual bool is_output_port_unsequenced(int p_idx) const { return false; }
|
||||
//virtual bool get_output_port_unsequenced(int p_idx,Variant* r_value,Variant* p_working_mem,String &r_error) const { return true; }
|
||||
// virtual int get_working_memory_size() const override { return 1; }
|
||||
// virtual bool is_output_port_unsequenced(int p_idx) const { return false; }
|
||||
// virtual bool get_output_port_unsequenced(int p_idx,Variant*
|
||||
// r_value,Variant* p_working_mem,String &r_error) const { return true; }
|
||||
|
||||
virtual int step(const Variant **p_inputs, Variant **p_outputs, StartMode p_start_mode, Variant *p_working_mem, Callable::CallError &r_error, String &r_error_str) override {
|
||||
virtual int step(const Variant **p_inputs, Variant **p_outputs,
|
||||
StartMode p_start_mode, Variant *p_working_mem,
|
||||
Callable::CallError &r_error, String &r_error_str) override {
|
||||
bool keep_going = p_inputs[0]->operator bool();
|
||||
|
||||
if (keep_going) {
|
||||
@@ -311,35 +291,28 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
VisualScriptNodeInstance *VisualScriptWhile::instantiate(VisualScriptInstance *p_instance) {
|
||||
VisualScriptNodeInstanceWhile *instance = memnew(VisualScriptNodeInstanceWhile);
|
||||
VisualScriptNodeInstance *
|
||||
VisualScriptWhile::instantiate(VisualScriptInstance *p_instance) {
|
||||
VisualScriptNodeInstanceWhile *instance =
|
||||
memnew(VisualScriptNodeInstanceWhile);
|
||||
instance->node = this;
|
||||
instance->instance = p_instance;
|
||||
return instance;
|
||||
}
|
||||
|
||||
VisualScriptWhile::VisualScriptWhile() {
|
||||
}
|
||||
VisualScriptWhile::VisualScriptWhile() {}
|
||||
|
||||
//////////////////////////////////////////
|
||||
////////////////ITERATOR/////////////////
|
||||
//////////////////////////////////////////
|
||||
|
||||
int VisualScriptIterator::get_output_sequence_port_count() const {
|
||||
return 2;
|
||||
}
|
||||
int VisualScriptIterator::get_output_sequence_port_count() const { return 2; }
|
||||
|
||||
bool VisualScriptIterator::has_input_sequence_port() const {
|
||||
return true;
|
||||
}
|
||||
bool VisualScriptIterator::has_input_sequence_port() const { return true; }
|
||||
|
||||
int VisualScriptIterator::get_input_value_port_count() const {
|
||||
return 1;
|
||||
}
|
||||
int VisualScriptIterator::get_input_value_port_count() const { return 1; }
|
||||
|
||||
int VisualScriptIterator::get_output_value_port_count() const {
|
||||
return 1;
|
||||
}
|
||||
int VisualScriptIterator::get_output_value_port_count() const { return 1; }
|
||||
|
||||
String VisualScriptIterator::get_output_sequence_port_text(int p_port) const {
|
||||
if (p_port == 0) {
|
||||
@@ -363,16 +336,13 @@ PropertyInfo VisualScriptIterator::get_output_value_port_info(int p_idx) const {
|
||||
return pinfo;
|
||||
}
|
||||
|
||||
String VisualScriptIterator::get_caption() const {
|
||||
return RTR("Iterator");
|
||||
}
|
||||
String VisualScriptIterator::get_caption() const { return RTR("Iterator"); }
|
||||
|
||||
String VisualScriptIterator::get_text() const {
|
||||
return RTR("for (elem) in (input):");
|
||||
}
|
||||
|
||||
void VisualScriptIterator::_bind_methods() {
|
||||
}
|
||||
void VisualScriptIterator::_bind_methods() {}
|
||||
|
||||
class VisualScriptNodeInstanceIterator : public VisualScriptNodeInstance {
|
||||
public:
|
||||
@@ -380,10 +350,13 @@ public:
|
||||
VisualScriptInstance *instance = nullptr;
|
||||
|
||||
virtual int get_working_memory_size() const override { return 2; }
|
||||
//virtual bool is_output_port_unsequenced(int p_idx) const { return false; }
|
||||
//virtual bool get_output_port_unsequenced(int p_idx,Variant* r_value,Variant* p_working_mem,String &r_error) const { return true; }
|
||||
// virtual bool is_output_port_unsequenced(int p_idx) const { return false; }
|
||||
// virtual bool get_output_port_unsequenced(int p_idx,Variant*
|
||||
// r_value,Variant* p_working_mem,String &r_error) const { return true; }
|
||||
|
||||
virtual int step(const Variant **p_inputs, Variant **p_outputs, StartMode p_start_mode, Variant *p_working_mem, Callable::CallError &r_error, String &r_error_str) override {
|
||||
virtual int step(const Variant **p_inputs, Variant **p_outputs,
|
||||
StartMode p_start_mode, Variant *p_working_mem,
|
||||
Callable::CallError &r_error, String &r_error_str) override {
|
||||
if (p_start_mode == START_MODE_BEGIN_SEQUENCE) {
|
||||
p_working_mem[0] = *p_inputs[0];
|
||||
bool valid;
|
||||
@@ -391,12 +364,13 @@ public:
|
||||
|
||||
if (!valid) {
|
||||
r_error.error = Callable::CallError::CALL_ERROR_INVALID_METHOD;
|
||||
r_error_str = RTR("Input type not iterable:") + " " + Variant::get_type_name(p_inputs[0]->get_type());
|
||||
r_error_str = RTR("Input type not iterable:") + " " +
|
||||
Variant::get_type_name(p_inputs[0]->get_type());
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!can_iter) {
|
||||
return 1; //nothing to iterate
|
||||
return 1; // nothing to iterate
|
||||
}
|
||||
|
||||
*p_outputs[0] = p_working_mem[0].iter_get(p_working_mem[1], valid);
|
||||
@@ -407,19 +381,20 @@ public:
|
||||
return 0;
|
||||
}
|
||||
|
||||
} else { //continue sequence
|
||||
} else { // continue sequence
|
||||
|
||||
bool valid;
|
||||
bool can_iter = p_working_mem[0].iter_next(p_working_mem[1], valid);
|
||||
|
||||
if (!valid) {
|
||||
r_error.error = Callable::CallError::CALL_ERROR_INVALID_METHOD;
|
||||
r_error_str = RTR("Iterator became invalid:") + " " + Variant::get_type_name(p_inputs[0]->get_type());
|
||||
r_error_str = RTR("Iterator became invalid:") + " " +
|
||||
Variant::get_type_name(p_inputs[0]->get_type());
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!can_iter) {
|
||||
return 1; //nothing to iterate
|
||||
return 1; // nothing to iterate
|
||||
}
|
||||
|
||||
*p_outputs[0] = p_working_mem[0].iter_get(p_working_mem[1], valid);
|
||||
@@ -431,19 +406,20 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
return 0 | STEP_FLAG_PUSH_STACK_BIT; //go around
|
||||
return 0 | STEP_FLAG_PUSH_STACK_BIT; // go around
|
||||
}
|
||||
};
|
||||
|
||||
VisualScriptNodeInstance *VisualScriptIterator::instantiate(VisualScriptInstance *p_instance) {
|
||||
VisualScriptNodeInstanceIterator *instance = memnew(VisualScriptNodeInstanceIterator);
|
||||
VisualScriptNodeInstance *
|
||||
VisualScriptIterator::instantiate(VisualScriptInstance *p_instance) {
|
||||
VisualScriptNodeInstanceIterator *instance =
|
||||
memnew(VisualScriptNodeInstanceIterator);
|
||||
instance->node = this;
|
||||
instance->instance = p_instance;
|
||||
return instance;
|
||||
}
|
||||
|
||||
VisualScriptIterator::VisualScriptIterator() {
|
||||
}
|
||||
VisualScriptIterator::VisualScriptIterator() {}
|
||||
|
||||
//////////////////////////////////////////
|
||||
////////////////SEQUENCE/////////////////
|
||||
@@ -453,17 +429,11 @@ int VisualScriptSequence::get_output_sequence_port_count() const {
|
||||
return steps;
|
||||
}
|
||||
|
||||
bool VisualScriptSequence::has_input_sequence_port() const {
|
||||
return true;
|
||||
}
|
||||
bool VisualScriptSequence::has_input_sequence_port() const { return true; }
|
||||
|
||||
int VisualScriptSequence::get_input_value_port_count() const {
|
||||
return 0;
|
||||
}
|
||||
int VisualScriptSequence::get_input_value_port_count() const { return 0; }
|
||||
|
||||
int VisualScriptSequence::get_output_value_port_count() const {
|
||||
return 1;
|
||||
}
|
||||
int VisualScriptSequence::get_output_value_port_count() const { return 1; }
|
||||
|
||||
String VisualScriptSequence::get_output_sequence_port_text(int p_port) const {
|
||||
return itos(p_port + 1);
|
||||
@@ -477,13 +447,9 @@ PropertyInfo VisualScriptSequence::get_output_value_port_info(int p_idx) const {
|
||||
return PropertyInfo(Variant::INT, "current");
|
||||
}
|
||||
|
||||
String VisualScriptSequence::get_caption() const {
|
||||
return RTR("Sequence");
|
||||
}
|
||||
String VisualScriptSequence::get_caption() const { return RTR("Sequence"); }
|
||||
|
||||
String VisualScriptSequence::get_text() const {
|
||||
return RTR("in order:");
|
||||
}
|
||||
String VisualScriptSequence::get_text() const { return RTR("in order:"); }
|
||||
|
||||
void VisualScriptSequence::set_steps(int p_steps) {
|
||||
ERR_FAIL_COND(p_steps < 1);
|
||||
@@ -495,15 +461,16 @@ void VisualScriptSequence::set_steps(int p_steps) {
|
||||
ports_changed_notify();
|
||||
}
|
||||
|
||||
int VisualScriptSequence::get_steps() const {
|
||||
return steps;
|
||||
}
|
||||
int VisualScriptSequence::get_steps() const { return steps; }
|
||||
|
||||
void VisualScriptSequence::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("set_steps", "steps"), &VisualScriptSequence::set_steps);
|
||||
ClassDB::bind_method(D_METHOD("set_steps", "steps"),
|
||||
&VisualScriptSequence::set_steps);
|
||||
ClassDB::bind_method(D_METHOD("get_steps"), &VisualScriptSequence::get_steps);
|
||||
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "steps", PROPERTY_HINT_RANGE, "1,64,1"), "set_steps", "get_steps");
|
||||
ADD_PROPERTY(
|
||||
PropertyInfo(Variant::INT, "steps", PROPERTY_HINT_RANGE, "1,64,1"),
|
||||
"set_steps", "get_steps");
|
||||
}
|
||||
|
||||
class VisualScriptNodeInstanceSequence : public VisualScriptNodeInstance {
|
||||
@@ -513,10 +480,13 @@ public:
|
||||
int steps = 0;
|
||||
|
||||
virtual int get_working_memory_size() const override { return 1; }
|
||||
//virtual bool is_output_port_unsequenced(int p_idx) const { return false; }
|
||||
//virtual bool get_output_port_unsequenced(int p_idx,Variant* r_value,Variant* p_working_mem,String &r_error) const { return true; }
|
||||
// virtual bool is_output_port_unsequenced(int p_idx) const { return false; }
|
||||
// virtual bool get_output_port_unsequenced(int p_idx,Variant*
|
||||
// r_value,Variant* p_working_mem,String &r_error) const { return true; }
|
||||
|
||||
virtual int step(const Variant **p_inputs, Variant **p_outputs, StartMode p_start_mode, Variant *p_working_mem, Callable::CallError &r_error, String &r_error_str) override {
|
||||
virtual int step(const Variant **p_inputs, Variant **p_outputs,
|
||||
StartMode p_start_mode, Variant *p_working_mem,
|
||||
Callable::CallError &r_error, String &r_error_str) override {
|
||||
if (p_start_mode == START_MODE_BEGIN_SEQUENCE) {
|
||||
p_working_mem[0] = 0;
|
||||
}
|
||||
@@ -534,17 +504,17 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
VisualScriptNodeInstance *VisualScriptSequence::instantiate(VisualScriptInstance *p_instance) {
|
||||
VisualScriptNodeInstanceSequence *instance = memnew(VisualScriptNodeInstanceSequence);
|
||||
VisualScriptNodeInstance *
|
||||
VisualScriptSequence::instantiate(VisualScriptInstance *p_instance) {
|
||||
VisualScriptNodeInstanceSequence *instance =
|
||||
memnew(VisualScriptNodeInstanceSequence);
|
||||
instance->node = this;
|
||||
instance->instance = p_instance;
|
||||
instance->steps = steps;
|
||||
return instance;
|
||||
}
|
||||
|
||||
VisualScriptSequence::VisualScriptSequence() {
|
||||
steps = 1;
|
||||
}
|
||||
VisualScriptSequence::VisualScriptSequence() { steps = 1; }
|
||||
|
||||
//////////////////////////////////////////
|
||||
////////////////EVENT TYPE FILTER///////////
|
||||
@@ -554,17 +524,13 @@ int VisualScriptSwitch::get_output_sequence_port_count() const {
|
||||
return case_values.size() + 1;
|
||||
}
|
||||
|
||||
bool VisualScriptSwitch::has_input_sequence_port() const {
|
||||
return true;
|
||||
}
|
||||
bool VisualScriptSwitch::has_input_sequence_port() const { return true; }
|
||||
|
||||
int VisualScriptSwitch::get_input_value_port_count() const {
|
||||
return case_values.size() + 1;
|
||||
}
|
||||
|
||||
int VisualScriptSwitch::get_output_value_port_count() const {
|
||||
return 0;
|
||||
}
|
||||
int VisualScriptSwitch::get_output_value_port_count() const { return 0; }
|
||||
|
||||
String VisualScriptSwitch::get_output_sequence_port_text(int p_port) const {
|
||||
if (p_port == case_values.size()) {
|
||||
@@ -586,26 +552,25 @@ PropertyInfo VisualScriptSwitch::get_output_value_port_info(int p_idx) const {
|
||||
return PropertyInfo();
|
||||
}
|
||||
|
||||
String VisualScriptSwitch::get_caption() const {
|
||||
return RTR("Switch");
|
||||
}
|
||||
String VisualScriptSwitch::get_caption() const { return RTR("Switch"); }
|
||||
|
||||
String VisualScriptSwitch::get_text() const {
|
||||
return RTR("'input' is:");
|
||||
}
|
||||
String VisualScriptSwitch::get_text() const { return RTR("'input' is:"); }
|
||||
|
||||
class VisualScriptNodeInstanceSwitch : public VisualScriptNodeInstance {
|
||||
public:
|
||||
VisualScriptInstance *instance = nullptr;
|
||||
int case_count = 0;
|
||||
|
||||
//virtual int get_working_memory_size() const override { return 0; }
|
||||
//virtual bool is_output_port_unsequenced(int p_idx) const { return false; }
|
||||
//virtual bool get_output_port_unsequenced(int p_idx,Variant* r_value,Variant* p_working_mem,String &r_error) const { return false; }
|
||||
// virtual int get_working_memory_size() const override { return 0; }
|
||||
// virtual bool is_output_port_unsequenced(int p_idx) const { return false; }
|
||||
// virtual bool get_output_port_unsequenced(int p_idx,Variant*
|
||||
// r_value,Variant* p_working_mem,String &r_error) const { return false; }
|
||||
|
||||
virtual int step(const Variant **p_inputs, Variant **p_outputs, StartMode p_start_mode, Variant *p_working_mem, Callable::CallError &r_error, String &r_error_str) override {
|
||||
virtual int step(const Variant **p_inputs, Variant **p_outputs,
|
||||
StartMode p_start_mode, Variant *p_working_mem,
|
||||
Callable::CallError &r_error, String &r_error_str) override {
|
||||
if (p_start_mode == START_MODE_CONTINUE_SEQUENCE) {
|
||||
return case_count; //exit
|
||||
return case_count; // exit
|
||||
}
|
||||
|
||||
for (int i = 0; i < case_count; i++) {
|
||||
@@ -618,14 +583,17 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
VisualScriptNodeInstance *VisualScriptSwitch::instantiate(VisualScriptInstance *p_instance) {
|
||||
VisualScriptNodeInstanceSwitch *instance = memnew(VisualScriptNodeInstanceSwitch);
|
||||
VisualScriptNodeInstance *
|
||||
VisualScriptSwitch::instantiate(VisualScriptInstance *p_instance) {
|
||||
VisualScriptNodeInstanceSwitch *instance =
|
||||
memnew(VisualScriptNodeInstanceSwitch);
|
||||
instance->instance = p_instance;
|
||||
instance->case_count = case_values.size();
|
||||
return instance;
|
||||
}
|
||||
|
||||
bool VisualScriptSwitch::_set(const StringName &p_name, const Variant &p_value) {
|
||||
bool VisualScriptSwitch::_set(const StringName &p_name,
|
||||
const Variant &p_value) {
|
||||
if (String(p_name) == "case_count") {
|
||||
case_values.resize(p_value);
|
||||
notify_property_list_changed();
|
||||
@@ -665,7 +633,8 @@ bool VisualScriptSwitch::_get(const StringName &p_name, Variant &r_ret) const {
|
||||
}
|
||||
|
||||
void VisualScriptSwitch::_get_property_list(List<PropertyInfo> *p_list) const {
|
||||
p_list->push_back(PropertyInfo(Variant::INT, "case_count", PROPERTY_HINT_RANGE, "0,128"));
|
||||
p_list->push_back(
|
||||
PropertyInfo(Variant::INT, "case_count", PROPERTY_HINT_RANGE, "0,128"));
|
||||
|
||||
String argt = "Any";
|
||||
for (int i = 1; i < Variant::VARIANT_MAX; i++) {
|
||||
@@ -673,39 +642,28 @@ void VisualScriptSwitch::_get_property_list(List<PropertyInfo> *p_list) const {
|
||||
}
|
||||
|
||||
for (int i = 0; i < case_values.size(); i++) {
|
||||
p_list->push_back(PropertyInfo(Variant::INT, "case/" + itos(i), PROPERTY_HINT_ENUM, argt));
|
||||
p_list->push_back(PropertyInfo(Variant::INT, "case/" + itos(i),
|
||||
PROPERTY_HINT_ENUM, argt));
|
||||
}
|
||||
}
|
||||
|
||||
void VisualScriptSwitch::reset_state() {
|
||||
case_values.clear();
|
||||
}
|
||||
void VisualScriptSwitch::reset_state() { case_values.clear(); }
|
||||
|
||||
void VisualScriptSwitch::_bind_methods() {
|
||||
}
|
||||
void VisualScriptSwitch::_bind_methods() {}
|
||||
|
||||
VisualScriptSwitch::VisualScriptSwitch() {
|
||||
}
|
||||
VisualScriptSwitch::VisualScriptSwitch() {}
|
||||
|
||||
//////////////////////////////////////////
|
||||
////////////////TYPE CAST///////////
|
||||
//////////////////////////////////////////
|
||||
|
||||
int VisualScriptTypeCast::get_output_sequence_port_count() const {
|
||||
return 2;
|
||||
}
|
||||
int VisualScriptTypeCast::get_output_sequence_port_count() const { return 2; }
|
||||
|
||||
bool VisualScriptTypeCast::has_input_sequence_port() const {
|
||||
return true;
|
||||
}
|
||||
bool VisualScriptTypeCast::has_input_sequence_port() const { return true; }
|
||||
|
||||
int VisualScriptTypeCast::get_input_value_port_count() const {
|
||||
return 1;
|
||||
}
|
||||
int VisualScriptTypeCast::get_input_value_port_count() const { return 1; }
|
||||
|
||||
int VisualScriptTypeCast::get_output_value_port_count() const {
|
||||
return 1;
|
||||
}
|
||||
int VisualScriptTypeCast::get_output_value_port_count() const { return 1; }
|
||||
|
||||
String VisualScriptTypeCast::get_output_sequence_port_text(int p_port) const {
|
||||
return p_port == 0 ? "yes" : "no";
|
||||
@@ -716,12 +674,11 @@ PropertyInfo VisualScriptTypeCast::get_input_value_port_info(int p_idx) const {
|
||||
}
|
||||
|
||||
PropertyInfo VisualScriptTypeCast::get_output_value_port_info(int p_idx) const {
|
||||
return PropertyInfo(Variant::OBJECT, "", PROPERTY_HINT_TYPE_STRING, get_base_type());
|
||||
return PropertyInfo(Variant::OBJECT, "", PROPERTY_HINT_TYPE_STRING,
|
||||
get_base_type());
|
||||
}
|
||||
|
||||
String VisualScriptTypeCast::get_caption() const {
|
||||
return RTR("Type Cast");
|
||||
}
|
||||
String VisualScriptTypeCast::get_caption() const { return RTR("Type Cast"); }
|
||||
|
||||
String VisualScriptTypeCast::get_text() const {
|
||||
if (!script.is_empty()) {
|
||||
@@ -741,9 +698,7 @@ void VisualScriptTypeCast::set_base_type(const StringName &p_type) {
|
||||
ports_changed_notify();
|
||||
}
|
||||
|
||||
StringName VisualScriptTypeCast::get_base_type() const {
|
||||
return base_type;
|
||||
}
|
||||
StringName VisualScriptTypeCast::get_base_type() const { return base_type; }
|
||||
|
||||
void VisualScriptTypeCast::set_base_script(const String &p_path) {
|
||||
if (script == p_path) {
|
||||
@@ -755,19 +710,19 @@ void VisualScriptTypeCast::set_base_script(const String &p_path) {
|
||||
ports_changed_notify();
|
||||
}
|
||||
|
||||
String VisualScriptTypeCast::get_base_script() const {
|
||||
return script;
|
||||
}
|
||||
String VisualScriptTypeCast::get_base_script() const { return script; }
|
||||
|
||||
VisualScriptTypeCast::TypeGuess VisualScriptTypeCast::guess_output_type(TypeGuess *p_inputs, int p_output) const {
|
||||
VisualScriptTypeCast::TypeGuess
|
||||
VisualScriptTypeCast::guess_output_type(TypeGuess *p_inputs,
|
||||
int p_output) const {
|
||||
TypeGuess tg;
|
||||
tg.type = Variant::OBJECT;
|
||||
if (!script.is_empty()) {
|
||||
tg.script = ResourceLoader::load(script);
|
||||
}
|
||||
//if (!tg.script.is_valid()) {
|
||||
// if (!tg.script.is_valid()) {
|
||||
// tg.gdclass = base_type;
|
||||
//}
|
||||
// }
|
||||
|
||||
return tg;
|
||||
}
|
||||
@@ -778,11 +733,14 @@ public:
|
||||
StringName base_type;
|
||||
String script;
|
||||
|
||||
//virtual int get_working_memory_size() const override { return 0; }
|
||||
//virtual bool is_output_port_unsequenced(int p_idx) const { return false; }
|
||||
//virtual bool get_output_port_unsequenced(int p_idx,Variant* r_value,Variant* p_working_mem,String &r_error) const { return false; }
|
||||
// virtual int get_working_memory_size() const override { return 0; }
|
||||
// virtual bool is_output_port_unsequenced(int p_idx) const { return false; }
|
||||
// virtual bool get_output_port_unsequenced(int p_idx,Variant*
|
||||
// r_value,Variant* p_working_mem,String &r_error) const { return false; }
|
||||
|
||||
virtual int step(const Variant **p_inputs, Variant **p_outputs, StartMode p_start_mode, Variant *p_working_mem, Callable::CallError &r_error, String &r_error_str) override {
|
||||
virtual int step(const Variant **p_inputs, Variant **p_outputs,
|
||||
StartMode p_start_mode, Variant *p_working_mem,
|
||||
Callable::CallError &r_error, String &r_error_str) override {
|
||||
Object *obj = *p_inputs[0];
|
||||
|
||||
*p_outputs[0] = Variant();
|
||||
@@ -796,11 +754,13 @@ public:
|
||||
if (!script.is_empty()) {
|
||||
Ref<Script> obj_script = obj->get_script();
|
||||
if (!obj_script.is_valid()) {
|
||||
return 1; //well, definitely not the script because object we got has no script.
|
||||
return 1; // well, definitely not the script because object we got has
|
||||
// no script.
|
||||
}
|
||||
|
||||
if (!ResourceCache::has(script)) {
|
||||
//if the script is not in use by anyone, we can safely assume whatever we got is not casting to it.
|
||||
// if the script is not in use by anyone, we can safely assume whatever
|
||||
// we got is not casting to it.
|
||||
return 1;
|
||||
}
|
||||
Ref<Script> cast_script = ResourceCache::get_ref(script);
|
||||
@@ -812,18 +772,18 @@ public:
|
||||
|
||||
while (obj_script.is_valid()) {
|
||||
if (cast_script == obj_script) {
|
||||
*p_outputs[0] = *p_inputs[0]; //copy
|
||||
*p_outputs[0] = *p_inputs[0]; // copy
|
||||
return 0; // it is the script, yey
|
||||
}
|
||||
|
||||
obj_script = obj_script->get_base_script();
|
||||
}
|
||||
|
||||
return 1; //not found sorry
|
||||
return 1; // not found sorry
|
||||
}
|
||||
|
||||
if (ClassDB::is_parent_class(obj->get_class_name(), base_type)) {
|
||||
*p_outputs[0] = *p_inputs[0]; //copy
|
||||
*p_outputs[0] = *p_inputs[0]; // copy
|
||||
return 0;
|
||||
} else {
|
||||
return 1;
|
||||
@@ -831,8 +791,10 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
VisualScriptNodeInstance *VisualScriptTypeCast::instantiate(VisualScriptInstance *p_instance) {
|
||||
VisualScriptNodeInstanceTypeCast *instance = memnew(VisualScriptNodeInstanceTypeCast);
|
||||
VisualScriptNodeInstance *
|
||||
VisualScriptTypeCast::instantiate(VisualScriptInstance *p_instance) {
|
||||
VisualScriptNodeInstanceTypeCast *instance =
|
||||
memnew(VisualScriptNodeInstanceTypeCast);
|
||||
instance->instance = p_instance;
|
||||
instance->base_type = base_type;
|
||||
instance->script = script;
|
||||
@@ -840,15 +802,20 @@ VisualScriptNodeInstance *VisualScriptTypeCast::instantiate(VisualScriptInstance
|
||||
}
|
||||
|
||||
void VisualScriptTypeCast::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("set_base_type", "type"), &VisualScriptTypeCast::set_base_type);
|
||||
ClassDB::bind_method(D_METHOD("get_base_type"), &VisualScriptTypeCast::get_base_type);
|
||||
ClassDB::bind_method(D_METHOD("set_base_type", "type"),
|
||||
&VisualScriptTypeCast::set_base_type);
|
||||
ClassDB::bind_method(D_METHOD("get_base_type"),
|
||||
&VisualScriptTypeCast::get_base_type);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_base_script", "path"), &VisualScriptTypeCast::set_base_script);
|
||||
ClassDB::bind_method(D_METHOD("get_base_script"), &VisualScriptTypeCast::get_base_script);
|
||||
ClassDB::bind_method(D_METHOD("set_base_script", "path"),
|
||||
&VisualScriptTypeCast::set_base_script);
|
||||
ClassDB::bind_method(D_METHOD("get_base_script"),
|
||||
&VisualScriptTypeCast::get_base_script);
|
||||
|
||||
List<String> script_extensions;
|
||||
for (int i = 0; i > ScriptServer::get_language_count(); i++) {
|
||||
ScriptServer::get_language(i)->get_recognized_extensions(&script_extensions);
|
||||
ScriptServer::get_language(i)->get_recognized_extensions(
|
||||
&script_extensions);
|
||||
}
|
||||
|
||||
String script_ext_hint;
|
||||
@@ -859,22 +826,33 @@ void VisualScriptTypeCast::_bind_methods() {
|
||||
script_ext_hint += "*." + E;
|
||||
}
|
||||
|
||||
ADD_PROPERTY(PropertyInfo(Variant::STRING, "base_type", PROPERTY_HINT_TYPE_STRING, "Object"), "set_base_type", "get_base_type");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::STRING, "base_script", PROPERTY_HINT_FILE, script_ext_hint), "set_base_script", "get_base_script");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::STRING, "base_type",
|
||||
PROPERTY_HINT_TYPE_STRING, "Object"),
|
||||
"set_base_type", "get_base_type");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::STRING, "base_script", PROPERTY_HINT_FILE,
|
||||
script_ext_hint),
|
||||
"set_base_script", "get_base_script");
|
||||
}
|
||||
|
||||
VisualScriptTypeCast::VisualScriptTypeCast() {
|
||||
base_type = "Object";
|
||||
}
|
||||
VisualScriptTypeCast::VisualScriptTypeCast() { base_type = "Object"; }
|
||||
|
||||
void register_visual_script_flow_control_nodes() {
|
||||
VisualScriptLanguage::singleton->add_register_func("flow_control/return", create_return_node<false>);
|
||||
VisualScriptLanguage::singleton->add_register_func("flow_control/return_with_value", create_return_node<true>);
|
||||
VisualScriptLanguage::singleton->add_register_func("flow_control/condition", create_node_generic<VisualScriptCondition>);
|
||||
VisualScriptLanguage::singleton->add_register_func("flow_control/while", create_node_generic<VisualScriptWhile>);
|
||||
VisualScriptLanguage::singleton->add_register_func("flow_control/iterator", create_node_generic<VisualScriptIterator>);
|
||||
VisualScriptLanguage::singleton->add_register_func("flow_control/sequence", create_node_generic<VisualScriptSequence>);
|
||||
VisualScriptLanguage::singleton->add_register_func("flow_control/switch", create_node_generic<VisualScriptSwitch>);
|
||||
//VisualScriptLanguage::singleton->add_register_func("flow_control/input", create_node_generic<VisualScriptInputFilter>);
|
||||
VisualScriptLanguage::singleton->add_register_func("flow_control/type_cast", create_node_generic<VisualScriptTypeCast>);
|
||||
VisualScriptLanguage::singleton->add_register_func("flow_control/return",
|
||||
create_return_node<false>);
|
||||
VisualScriptLanguage::singleton->add_register_func(
|
||||
"flow_control/return_with_value", create_return_node<true>);
|
||||
VisualScriptLanguage::singleton->add_register_func(
|
||||
"flow_control/condition", create_node_generic<VisualScriptCondition>);
|
||||
VisualScriptLanguage::singleton->add_register_func(
|
||||
"flow_control/while", create_node_generic<VisualScriptWhile>);
|
||||
VisualScriptLanguage::singleton->add_register_func(
|
||||
"flow_control/iterator", create_node_generic<VisualScriptIterator>);
|
||||
VisualScriptLanguage::singleton->add_register_func(
|
||||
"flow_control/sequence", create_node_generic<VisualScriptSequence>);
|
||||
VisualScriptLanguage::singleton->add_register_func(
|
||||
"flow_control/switch", create_node_generic<VisualScriptSwitch>);
|
||||
// VisualScriptLanguage::singleton->add_register_func("flow_control/input",
|
||||
// create_node_generic<VisualScriptInputFilter>);
|
||||
VisualScriptLanguage::singleton->add_register_func(
|
||||
"flow_control/type_cast", create_node_generic<VisualScriptTypeCast>);
|
||||
}
|
||||
|
||||
@@ -1,32 +1,32 @@
|
||||
/*************************************************************************/
|
||||
/* visual_script_flow_control.h */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* https://godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
|
||||
/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
/**************************************************************************/
|
||||
/* visual_script_flow_control.h */
|
||||
/**************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* https://godotengine.org */
|
||||
/**************************************************************************/
|
||||
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
|
||||
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef VISUAL_SCRIPT_FLOW_CONTROL_H
|
||||
#define VISUAL_SCRIPT_FLOW_CONTROL_H
|
||||
@@ -64,7 +64,8 @@ public:
|
||||
void set_enable_return_value(bool p_enable);
|
||||
bool is_return_value_enabled() const;
|
||||
|
||||
virtual VisualScriptNodeInstance *instantiate(VisualScriptInstance *p_instance) override;
|
||||
virtual VisualScriptNodeInstance *
|
||||
instantiate(VisualScriptInstance *p_instance) override;
|
||||
|
||||
VisualScriptReturn();
|
||||
};
|
||||
@@ -91,7 +92,8 @@ public:
|
||||
virtual String get_text() const override;
|
||||
virtual String get_category() const override { return "flow_control"; }
|
||||
|
||||
virtual VisualScriptNodeInstance *instantiate(VisualScriptInstance *p_instance) override;
|
||||
virtual VisualScriptNodeInstance *
|
||||
instantiate(VisualScriptInstance *p_instance) override;
|
||||
|
||||
VisualScriptCondition();
|
||||
};
|
||||
@@ -118,7 +120,8 @@ public:
|
||||
virtual String get_text() const override;
|
||||
virtual String get_category() const override { return "flow_control"; }
|
||||
|
||||
virtual VisualScriptNodeInstance *instantiate(VisualScriptInstance *p_instance) override;
|
||||
virtual VisualScriptNodeInstance *
|
||||
instantiate(VisualScriptInstance *p_instance) override;
|
||||
|
||||
VisualScriptWhile();
|
||||
};
|
||||
@@ -145,7 +148,8 @@ public:
|
||||
virtual String get_text() const override;
|
||||
virtual String get_category() const override { return "flow_control"; }
|
||||
|
||||
virtual VisualScriptNodeInstance *instantiate(VisualScriptInstance *p_instance) override;
|
||||
virtual VisualScriptNodeInstance *
|
||||
instantiate(VisualScriptInstance *p_instance) override;
|
||||
|
||||
VisualScriptIterator();
|
||||
};
|
||||
@@ -177,7 +181,8 @@ public:
|
||||
void set_steps(int p_steps);
|
||||
int get_steps() const;
|
||||
|
||||
virtual VisualScriptNodeInstance *instantiate(VisualScriptInstance *p_instance) override;
|
||||
virtual VisualScriptNodeInstance *
|
||||
instantiate(VisualScriptInstance *p_instance) override;
|
||||
|
||||
VisualScriptSequence();
|
||||
};
|
||||
@@ -208,7 +213,9 @@ public:
|
||||
virtual bool has_input_sequence_port() const override;
|
||||
|
||||
virtual String get_output_sequence_port_text(int p_port) const override;
|
||||
virtual bool has_mixed_input_and_sequence_ports() const override { return true; }
|
||||
virtual bool has_mixed_input_and_sequence_ports() const override {
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual int get_input_value_port_count() const override;
|
||||
virtual int get_output_value_port_count() const override;
|
||||
@@ -220,7 +227,8 @@ public:
|
||||
virtual String get_text() const override;
|
||||
virtual String get_category() const override { return "flow_control"; }
|
||||
|
||||
virtual VisualScriptNodeInstance *instantiate(VisualScriptInstance *p_instance) override;
|
||||
virtual VisualScriptNodeInstance *
|
||||
instantiate(VisualScriptInstance *p_instance) override;
|
||||
|
||||
VisualScriptSwitch();
|
||||
};
|
||||
@@ -256,9 +264,11 @@ public:
|
||||
void set_base_script(const String &p_path);
|
||||
String get_base_script() const;
|
||||
|
||||
virtual TypeGuess guess_output_type(TypeGuess *p_inputs, int p_output) const override;
|
||||
virtual TypeGuess guess_output_type(TypeGuess *p_inputs,
|
||||
int p_output) const override;
|
||||
|
||||
virtual VisualScriptNodeInstance *instantiate(VisualScriptInstance *p_instance) override;
|
||||
virtual VisualScriptNodeInstance *
|
||||
instantiate(VisualScriptInstance *p_instance) override;
|
||||
|
||||
VisualScriptTypeCast();
|
||||
};
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,32 +1,32 @@
|
||||
/*************************************************************************/
|
||||
/* visual_script_func_nodes.h */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* https://godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
|
||||
/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
/**************************************************************************/
|
||||
/* visual_script_func_nodes.h */
|
||||
/**************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* https://godotengine.org */
|
||||
/**************************************************************************/
|
||||
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
|
||||
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef VISUAL_SCRIPT_FUNC_NODES_H
|
||||
#define VISUAL_SCRIPT_FUNC_NODES_H
|
||||
@@ -125,9 +125,11 @@ public:
|
||||
void set_rpc_call_mode(RPCCallMode p_mode);
|
||||
RPCCallMode get_rpc_call_mode() const;
|
||||
|
||||
virtual VisualScriptNodeInstance *instantiate(VisualScriptInstance *p_instance) override;
|
||||
virtual VisualScriptNodeInstance *
|
||||
instantiate(VisualScriptInstance *p_instance) override;
|
||||
|
||||
virtual TypeGuess guess_output_type(TypeGuess *p_inputs, int p_output) const override;
|
||||
virtual TypeGuess guess_output_type(TypeGuess *p_inputs,
|
||||
int p_output) const override;
|
||||
|
||||
VisualScriptFunctionCall();
|
||||
};
|
||||
@@ -231,8 +233,10 @@ public:
|
||||
void set_assign_op(AssignOp p_op);
|
||||
AssignOp get_assign_op() const;
|
||||
|
||||
virtual VisualScriptNodeInstance *instantiate(VisualScriptInstance *p_instance) override;
|
||||
virtual TypeGuess guess_output_type(TypeGuess *p_inputs, int p_output) const override;
|
||||
virtual VisualScriptNodeInstance *
|
||||
instantiate(VisualScriptInstance *p_instance) override;
|
||||
virtual TypeGuess guess_output_type(TypeGuess *p_inputs,
|
||||
int p_output) const override;
|
||||
|
||||
VisualScriptPropertySet();
|
||||
};
|
||||
@@ -316,7 +320,8 @@ public:
|
||||
void set_index(const StringName &p_type);
|
||||
StringName get_index() const;
|
||||
|
||||
virtual VisualScriptNodeInstance *instantiate(VisualScriptInstance *p_instance) override;
|
||||
virtual VisualScriptNodeInstance *
|
||||
instantiate(VisualScriptInstance *p_instance) override;
|
||||
|
||||
VisualScriptPropertyGet();
|
||||
};
|
||||
@@ -347,13 +352,14 @@ public:
|
||||
virtual PropertyInfo get_output_value_port_info(int p_idx) const override;
|
||||
|
||||
virtual String get_caption() const override;
|
||||
//virtual String get_text() const;
|
||||
// virtual String get_text() const;
|
||||
virtual String get_category() const override { return "functions"; }
|
||||
|
||||
void set_signal(const StringName &p_type);
|
||||
StringName get_signal() const;
|
||||
|
||||
virtual VisualScriptNodeInstance *instantiate(VisualScriptInstance *p_instance) override;
|
||||
virtual VisualScriptNodeInstance *
|
||||
instantiate(VisualScriptInstance *p_instance) override;
|
||||
|
||||
VisualScriptEmitSignal();
|
||||
};
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,32 +1,32 @@
|
||||
/*************************************************************************/
|
||||
/* visual_script_nodes.h */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* https://godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
|
||||
/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
/**************************************************************************/
|
||||
/* visual_script_nodes.h */
|
||||
/**************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* https://godotengine.org */
|
||||
/**************************************************************************/
|
||||
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
|
||||
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef VISUAL_SCRIPT_NODES_H
|
||||
#define VISUAL_SCRIPT_NODES_H
|
||||
@@ -74,7 +74,10 @@ public:
|
||||
virtual String get_text() const override;
|
||||
virtual String get_category() const override { return "flow_control"; }
|
||||
|
||||
void add_argument(Variant::Type p_type, const String &p_name, int p_index = -1, const PropertyHint p_hint = PROPERTY_HINT_NONE, const String &p_hint_string = String(""));
|
||||
void add_argument(Variant::Type p_type, const String &p_name,
|
||||
int p_index = -1,
|
||||
const PropertyHint p_hint = PROPERTY_HINT_NONE,
|
||||
const String &p_hint_string = String(""));
|
||||
void set_argument_type(int p_argidx, Variant::Type p_type);
|
||||
Variant::Type get_argument_type(int p_argidx) const;
|
||||
void set_argument_name(int p_argidx, const String &p_name);
|
||||
@@ -94,7 +97,8 @@ public:
|
||||
void set_rpc_mode(MultiplayerAPI::RPCMode p_mode);
|
||||
MultiplayerAPI::RPCMode get_rpc_mode() const;
|
||||
|
||||
virtual VisualScriptNodeInstance *instantiate(VisualScriptInstance *p_instance) override;
|
||||
virtual VisualScriptNodeInstance *
|
||||
instantiate(VisualScriptInstance *p_instance) override;
|
||||
|
||||
virtual void reset_state() override;
|
||||
|
||||
@@ -154,12 +158,14 @@ public:
|
||||
virtual PropertyInfo get_input_value_port_info(int p_idx) const override;
|
||||
virtual PropertyInfo get_output_value_port_info(int p_idx) const override;
|
||||
|
||||
void add_input_data_port(Variant::Type p_type, const String &p_name, int p_index = -1);
|
||||
void add_input_data_port(Variant::Type p_type, const String &p_name,
|
||||
int p_index = -1);
|
||||
void set_input_data_port_type(int p_idx, Variant::Type p_type);
|
||||
void set_input_data_port_name(int p_idx, const String &p_name);
|
||||
void remove_input_data_port(int p_argidx);
|
||||
|
||||
void add_output_data_port(Variant::Type p_type, const String &p_name, int p_index = -1);
|
||||
void add_output_data_port(Variant::Type p_type, const String &p_name,
|
||||
int p_index = -1);
|
||||
void set_output_data_port_type(int p_idx, Variant::Type p_type);
|
||||
void set_output_data_port_name(int p_idx, const String &p_name);
|
||||
void remove_output_data_port(int p_argidx);
|
||||
@@ -189,7 +195,8 @@ public:
|
||||
virtual String get_text() const override;
|
||||
virtual String get_category() const override { return "functions"; }
|
||||
|
||||
virtual VisualScriptNodeInstance *instantiate(VisualScriptInstance *p_instance) override;
|
||||
virtual VisualScriptNodeInstance *
|
||||
instantiate(VisualScriptInstance *p_instance) override;
|
||||
|
||||
VisualScriptComposeArray();
|
||||
};
|
||||
@@ -226,7 +233,8 @@ public:
|
||||
|
||||
static String get_operator_name(Variant::Operator p_op);
|
||||
|
||||
virtual VisualScriptNodeInstance *instantiate(VisualScriptInstance *p_instance) override;
|
||||
virtual VisualScriptNodeInstance *
|
||||
instantiate(VisualScriptInstance *p_instance) override;
|
||||
|
||||
VisualScriptOperator();
|
||||
};
|
||||
@@ -258,7 +266,8 @@ public:
|
||||
void set_typed(Variant::Type p_op);
|
||||
Variant::Type get_typed() const;
|
||||
|
||||
virtual VisualScriptNodeInstance *instantiate(VisualScriptInstance *p_instance) override;
|
||||
virtual VisualScriptNodeInstance *
|
||||
instantiate(VisualScriptInstance *p_instance) override;
|
||||
|
||||
VisualScriptSelect();
|
||||
};
|
||||
@@ -290,7 +299,8 @@ public:
|
||||
void set_variable(StringName p_variable);
|
||||
StringName get_variable() const;
|
||||
|
||||
virtual VisualScriptNodeInstance *instantiate(VisualScriptInstance *p_instance) override;
|
||||
virtual VisualScriptNodeInstance *
|
||||
instantiate(VisualScriptInstance *p_instance) override;
|
||||
|
||||
VisualScriptVariableGet();
|
||||
};
|
||||
@@ -322,7 +332,8 @@ public:
|
||||
void set_variable(StringName p_variable);
|
||||
StringName get_variable() const;
|
||||
|
||||
virtual VisualScriptNodeInstance *instantiate(VisualScriptInstance *p_instance) override;
|
||||
virtual VisualScriptNodeInstance *
|
||||
instantiate(VisualScriptInstance *p_instance) override;
|
||||
|
||||
VisualScriptVariableSet();
|
||||
};
|
||||
@@ -358,7 +369,8 @@ public:
|
||||
void set_constant_value(Variant p_value);
|
||||
Variant get_constant_value() const;
|
||||
|
||||
virtual VisualScriptNodeInstance *instantiate(VisualScriptInstance *p_instance) override;
|
||||
virtual VisualScriptNodeInstance *
|
||||
instantiate(VisualScriptInstance *p_instance) override;
|
||||
|
||||
VisualScriptConstant();
|
||||
};
|
||||
@@ -389,7 +401,8 @@ public:
|
||||
void set_preload(const Ref<Resource> &p_preload);
|
||||
Ref<Resource> get_preload() const;
|
||||
|
||||
virtual VisualScriptNodeInstance *instantiate(VisualScriptInstance *p_instance) override;
|
||||
virtual VisualScriptNodeInstance *
|
||||
instantiate(VisualScriptInstance *p_instance) override;
|
||||
|
||||
VisualScriptPreload();
|
||||
};
|
||||
@@ -412,7 +425,8 @@ public:
|
||||
virtual String get_caption() const override;
|
||||
virtual String get_category() const override { return "operators"; }
|
||||
|
||||
virtual VisualScriptNodeInstance *instantiate(VisualScriptInstance *p_instance) override;
|
||||
virtual VisualScriptNodeInstance *
|
||||
instantiate(VisualScriptInstance *p_instance) override;
|
||||
|
||||
VisualScriptIndexGet();
|
||||
};
|
||||
@@ -435,7 +449,8 @@ public:
|
||||
virtual String get_caption() const override;
|
||||
virtual String get_category() const override { return "operators"; }
|
||||
|
||||
virtual VisualScriptNodeInstance *instantiate(VisualScriptInstance *p_instance) override;
|
||||
virtual VisualScriptNodeInstance *
|
||||
instantiate(VisualScriptInstance *p_instance) override;
|
||||
|
||||
VisualScriptIndexSet();
|
||||
};
|
||||
@@ -465,7 +480,8 @@ public:
|
||||
void set_global_constant(int p_which);
|
||||
int get_global_constant();
|
||||
|
||||
virtual VisualScriptNodeInstance *instantiate(VisualScriptInstance *p_instance) override;
|
||||
virtual VisualScriptNodeInstance *
|
||||
instantiate(VisualScriptInstance *p_instance) override;
|
||||
|
||||
VisualScriptGlobalConstant();
|
||||
};
|
||||
@@ -501,7 +517,8 @@ public:
|
||||
void set_base_type(const StringName &p_which);
|
||||
StringName get_base_type();
|
||||
|
||||
virtual VisualScriptNodeInstance *instantiate(VisualScriptInstance *p_instance) override;
|
||||
virtual VisualScriptNodeInstance *
|
||||
instantiate(VisualScriptInstance *p_instance) override;
|
||||
|
||||
VisualScriptClassConstant();
|
||||
};
|
||||
@@ -538,7 +555,8 @@ public:
|
||||
void set_basic_type(Variant::Type p_which);
|
||||
Variant::Type get_basic_type() const;
|
||||
|
||||
virtual VisualScriptNodeInstance *instantiate(VisualScriptInstance *p_instance) override;
|
||||
virtual VisualScriptNodeInstance *
|
||||
instantiate(VisualScriptInstance *p_instance) override;
|
||||
|
||||
VisualScriptBasicTypeConstant();
|
||||
};
|
||||
@@ -585,7 +603,8 @@ public:
|
||||
void set_math_constant(MathConstant p_which);
|
||||
MathConstant get_math_constant();
|
||||
|
||||
virtual VisualScriptNodeInstance *instantiate(VisualScriptInstance *p_instance) override;
|
||||
virtual VisualScriptNodeInstance *
|
||||
instantiate(VisualScriptInstance *p_instance) override;
|
||||
|
||||
VisualScriptMathConstant();
|
||||
};
|
||||
@@ -620,9 +639,11 @@ public:
|
||||
void set_singleton(const String &p_string);
|
||||
String get_singleton();
|
||||
|
||||
virtual VisualScriptNodeInstance *instantiate(VisualScriptInstance *p_instance) override;
|
||||
virtual VisualScriptNodeInstance *
|
||||
instantiate(VisualScriptInstance *p_instance) override;
|
||||
|
||||
virtual TypeGuess guess_output_type(TypeGuess *p_inputs, int p_output) const override;
|
||||
virtual TypeGuess guess_output_type(TypeGuess *p_inputs,
|
||||
int p_output) const override;
|
||||
|
||||
VisualScriptEngineSingleton();
|
||||
};
|
||||
@@ -654,9 +675,11 @@ public:
|
||||
void set_node_path(const NodePath &p_path);
|
||||
NodePath get_node_path();
|
||||
|
||||
virtual VisualScriptNodeInstance *instantiate(VisualScriptInstance *p_instance) override;
|
||||
virtual VisualScriptNodeInstance *
|
||||
instantiate(VisualScriptInstance *p_instance) override;
|
||||
|
||||
virtual TypeGuess guess_output_type(TypeGuess *p_inputs, int p_output) const override;
|
||||
virtual TypeGuess guess_output_type(TypeGuess *p_inputs,
|
||||
int p_output) const override;
|
||||
|
||||
VisualScriptSceneNode();
|
||||
};
|
||||
@@ -683,9 +706,11 @@ public:
|
||||
virtual String get_caption() const override;
|
||||
virtual String get_category() const override { return "data"; }
|
||||
|
||||
virtual VisualScriptNodeInstance *instantiate(VisualScriptInstance *p_instance) override;
|
||||
virtual VisualScriptNodeInstance *
|
||||
instantiate(VisualScriptInstance *p_instance) override;
|
||||
|
||||
virtual TypeGuess guess_output_type(TypeGuess *p_inputs, int p_output) const override;
|
||||
virtual TypeGuess guess_output_type(TypeGuess *p_inputs,
|
||||
int p_output) const override;
|
||||
|
||||
VisualScriptSceneTree();
|
||||
};
|
||||
@@ -716,7 +741,8 @@ public:
|
||||
void set_resource_path(const String &p_path);
|
||||
String get_resource_path();
|
||||
|
||||
virtual VisualScriptNodeInstance *instantiate(VisualScriptInstance *p_instance) override;
|
||||
virtual VisualScriptNodeInstance *
|
||||
instantiate(VisualScriptInstance *p_instance) override;
|
||||
|
||||
VisualScriptResourcePath();
|
||||
};
|
||||
@@ -742,9 +768,11 @@ public:
|
||||
virtual String get_caption() const override;
|
||||
virtual String get_category() const override { return "data"; }
|
||||
|
||||
virtual VisualScriptNodeInstance *instantiate(VisualScriptInstance *p_instance) override;
|
||||
virtual VisualScriptNodeInstance *
|
||||
instantiate(VisualScriptInstance *p_instance) override;
|
||||
|
||||
virtual TypeGuess guess_output_type(TypeGuess *p_inputs, int p_output) const override;
|
||||
virtual TypeGuess guess_output_type(TypeGuess *p_inputs,
|
||||
int p_output) const override;
|
||||
|
||||
VisualScriptSelf();
|
||||
};
|
||||
@@ -780,20 +808,22 @@ protected:
|
||||
GDVIRTUAL4RC(Variant, _step, Array, Array, int, Array)
|
||||
|
||||
public:
|
||||
enum StartMode { //replicated for step
|
||||
enum StartMode { // replicated for step
|
||||
START_MODE_BEGIN_SEQUENCE,
|
||||
START_MODE_CONTINUE_SEQUENCE,
|
||||
START_MODE_RESUME_YIELD
|
||||
};
|
||||
|
||||
enum { //replicated for step
|
||||
enum { // replicated for step
|
||||
STEP_SHIFT = 1 << 24,
|
||||
STEP_MASK = STEP_SHIFT - 1,
|
||||
STEP_PUSH_STACK_BIT = STEP_SHIFT, //push bit to stack
|
||||
STEP_GO_BACK_BIT = STEP_SHIFT << 1, //go back to previous node
|
||||
STEP_NO_ADVANCE_BIT = STEP_SHIFT << 2, //do not advance past this node
|
||||
STEP_EXIT_FUNCTION_BIT = STEP_SHIFT << 3, //return from function
|
||||
STEP_YIELD_BIT = STEP_SHIFT << 4, //yield (will find VisualScriptFunctionState state in first working memory)
|
||||
STEP_PUSH_STACK_BIT = STEP_SHIFT, // push bit to stack
|
||||
STEP_GO_BACK_BIT = STEP_SHIFT << 1, // go back to previous node
|
||||
STEP_NO_ADVANCE_BIT = STEP_SHIFT << 2, // do not advance past this node
|
||||
STEP_EXIT_FUNCTION_BIT = STEP_SHIFT << 3, // return from function
|
||||
STEP_YIELD_BIT = STEP_SHIFT
|
||||
<< 4, // yield (will find VisualScriptFunctionState state
|
||||
// in first working memory)
|
||||
};
|
||||
|
||||
virtual int get_output_sequence_port_count() const override;
|
||||
@@ -811,9 +841,11 @@ public:
|
||||
virtual String get_text() const override;
|
||||
virtual String get_category() const override;
|
||||
|
||||
virtual VisualScriptNodeInstance *instantiate(VisualScriptInstance *p_instance) override;
|
||||
virtual VisualScriptNodeInstance *
|
||||
instantiate(VisualScriptInstance *p_instance) override;
|
||||
|
||||
virtual TypeGuess guess_output_type(TypeGuess *p_inputs, int p_output) const override;
|
||||
virtual TypeGuess guess_output_type(TypeGuess *p_inputs,
|
||||
int p_output) const override;
|
||||
|
||||
void _script_changed();
|
||||
|
||||
@@ -844,51 +876,12 @@ public:
|
||||
virtual String get_text() const override;
|
||||
virtual String get_category() const override;
|
||||
|
||||
virtual VisualScriptNodeInstance *instantiate(VisualScriptInstance *p_instance) override;
|
||||
virtual VisualScriptNodeInstance *
|
||||
instantiate(VisualScriptInstance *p_instance) override;
|
||||
|
||||
VisualScriptSubCall();
|
||||
};
|
||||
|
||||
class VisualScriptComment : public VisualScriptNode {
|
||||
GDCLASS(VisualScriptComment, VisualScriptNode);
|
||||
|
||||
String title;
|
||||
String description;
|
||||
Size2 size;
|
||||
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
|
||||
public:
|
||||
virtual int get_output_sequence_port_count() const override;
|
||||
virtual bool has_input_sequence_port() const override;
|
||||
|
||||
virtual String get_output_sequence_port_text(int p_port) const override;
|
||||
|
||||
virtual int get_input_value_port_count() const override;
|
||||
virtual int get_output_value_port_count() const override;
|
||||
|
||||
virtual PropertyInfo get_input_value_port_info(int p_idx) const override;
|
||||
virtual PropertyInfo get_output_value_port_info(int p_idx) const override;
|
||||
|
||||
virtual String get_caption() const override;
|
||||
virtual String get_text() const override;
|
||||
virtual String get_category() const override;
|
||||
|
||||
void set_title(const String &p_title);
|
||||
String get_title() const;
|
||||
|
||||
void set_description(const String &p_description);
|
||||
String get_description() const;
|
||||
|
||||
void set_size(const Size2 &p_size);
|
||||
Size2 get_size() const;
|
||||
|
||||
virtual VisualScriptNodeInstance *instantiate(VisualScriptInstance *p_instance) override;
|
||||
|
||||
VisualScriptComment();
|
||||
};
|
||||
|
||||
class VisualScriptConstructor : public VisualScriptNode {
|
||||
GDCLASS(VisualScriptConstructor, VisualScriptNode);
|
||||
|
||||
@@ -919,7 +912,8 @@ public:
|
||||
void set_constructor(const Dictionary &p_info);
|
||||
Dictionary get_constructor() const;
|
||||
|
||||
virtual VisualScriptNodeInstance *instantiate(VisualScriptInstance *p_instance) override;
|
||||
virtual VisualScriptNodeInstance *
|
||||
instantiate(VisualScriptInstance *p_instance) override;
|
||||
|
||||
VisualScriptConstructor();
|
||||
};
|
||||
@@ -954,7 +948,8 @@ public:
|
||||
void set_var_type(Variant::Type p_type);
|
||||
Variant::Type get_var_type() const;
|
||||
|
||||
virtual VisualScriptNodeInstance *instantiate(VisualScriptInstance *p_instance) override;
|
||||
virtual VisualScriptNodeInstance *
|
||||
instantiate(VisualScriptInstance *p_instance) override;
|
||||
|
||||
VisualScriptLocalVar();
|
||||
};
|
||||
@@ -990,7 +985,8 @@ public:
|
||||
void set_var_type(Variant::Type p_type);
|
||||
Variant::Type get_var_type() const;
|
||||
|
||||
virtual VisualScriptNodeInstance *instantiate(VisualScriptInstance *p_instance) override;
|
||||
virtual VisualScriptNodeInstance *
|
||||
instantiate(VisualScriptInstance *p_instance) override;
|
||||
|
||||
VisualScriptLocalVarSet();
|
||||
};
|
||||
@@ -1035,7 +1031,8 @@ public:
|
||||
void set_action_mode(Mode p_mode);
|
||||
Mode get_action_mode() const;
|
||||
|
||||
virtual VisualScriptNodeInstance *instantiate(VisualScriptInstance *p_instance) override;
|
||||
virtual VisualScriptNodeInstance *
|
||||
instantiate(VisualScriptInstance *p_instance) override;
|
||||
|
||||
VisualScriptInputAction();
|
||||
};
|
||||
@@ -1081,7 +1078,8 @@ public:
|
||||
void set_deconstruct_type(Variant::Type p_type);
|
||||
Variant::Type get_deconstruct_type() const;
|
||||
|
||||
virtual VisualScriptNodeInstance *instantiate(VisualScriptInstance *p_instance) override;
|
||||
virtual VisualScriptNodeInstance *
|
||||
instantiate(VisualScriptInstance *p_instance) override;
|
||||
|
||||
VisualScriptDeconstruct();
|
||||
};
|
||||
|
||||
@@ -1,32 +1,32 @@
|
||||
/*************************************************************************/
|
||||
/* visual_script_yield_nodes.cpp */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* https://godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
|
||||
/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
/**************************************************************************/
|
||||
/* visual_script_yield_nodes.cpp */
|
||||
/**************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* https://godotengine.org */
|
||||
/**************************************************************************/
|
||||
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
|
||||
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#include "visual_script_yield_nodes.h"
|
||||
|
||||
@@ -39,21 +39,13 @@
|
||||
////////////////YIELD///////////
|
||||
//////////////////////////////////////////
|
||||
|
||||
int VisualScriptYield::get_output_sequence_port_count() const {
|
||||
return 1;
|
||||
}
|
||||
int VisualScriptYield::get_output_sequence_port_count() const { return 1; }
|
||||
|
||||
bool VisualScriptYield::has_input_sequence_port() const {
|
||||
return true;
|
||||
}
|
||||
bool VisualScriptYield::has_input_sequence_port() const { return true; }
|
||||
|
||||
int VisualScriptYield::get_input_value_port_count() const {
|
||||
return 0;
|
||||
}
|
||||
int VisualScriptYield::get_input_value_port_count() const { return 0; }
|
||||
|
||||
int VisualScriptYield::get_output_value_port_count() const {
|
||||
return 0;
|
||||
}
|
||||
int VisualScriptYield::get_output_value_port_count() const { return 0; }
|
||||
|
||||
String VisualScriptYield::get_output_sequence_port_text(int p_port) const {
|
||||
return String();
|
||||
@@ -95,17 +87,23 @@ public:
|
||||
VisualScriptYield::YieldMode mode;
|
||||
double wait_time = 0.0;
|
||||
|
||||
virtual int get_working_memory_size() const override { return 1; } //yield needs at least 1
|
||||
//virtual bool is_output_port_unsequenced(int p_idx) const { return false; }
|
||||
//virtual bool get_output_port_unsequenced(int p_idx,Variant* r_value,Variant* p_working_mem,String &r_error) const { return false; }
|
||||
virtual int get_working_memory_size() const override {
|
||||
return 1;
|
||||
} // yield needs at least 1
|
||||
// virtual bool is_output_port_unsequenced(int p_idx) const { return false; }
|
||||
// virtual bool get_output_port_unsequenced(int p_idx,Variant*
|
||||
// r_value,Variant* p_working_mem,String &r_error) const { return false; }
|
||||
|
||||
virtual int step(const Variant **p_inputs, Variant **p_outputs, StartMode p_start_mode, Variant *p_working_mem, Callable::CallError &r_error, String &r_error_str) override {
|
||||
virtual int step(const Variant **p_inputs, Variant **p_outputs,
|
||||
StartMode p_start_mode, Variant *p_working_mem,
|
||||
Callable::CallError &r_error, String &r_error_str) override {
|
||||
if (p_start_mode == START_MODE_RESUME_YIELD) {
|
||||
return 0; //resuming yield
|
||||
return 0; // resuming yield
|
||||
} else {
|
||||
//yield
|
||||
// yield
|
||||
|
||||
SceneTree *tree = Object::cast_to<SceneTree>(OS::get_singleton()->get_main_loop());
|
||||
SceneTree *tree =
|
||||
Object::cast_to<SceneTree>(OS::get_singleton()->get_main_loop());
|
||||
if (!tree) {
|
||||
r_error_str = "Main Loop is not SceneTree";
|
||||
r_error.error = Callable::CallError::CALL_ERROR_INVALID_METHOD;
|
||||
@@ -119,7 +117,7 @@ public:
|
||||
switch (mode) {
|
||||
case VisualScriptYield::YIELD_RETURN:
|
||||
ret = STEP_EXIT_FUNCTION_BIT;
|
||||
break; //return the yield
|
||||
break; // return the yield
|
||||
case VisualScriptYield::YIELD_FRAME:
|
||||
state->connect_to_signal(tree, "process_frame", Array());
|
||||
break;
|
||||
@@ -127,7 +125,8 @@ public:
|
||||
state->connect_to_signal(tree, "physics_frame", Array());
|
||||
break;
|
||||
case VisualScriptYield::YIELD_WAIT:
|
||||
state->connect_to_signal(tree->create_timer(wait_time).ptr(), "timeout", Array());
|
||||
state->connect_to_signal(tree->create_timer(wait_time).ptr(), "timeout",
|
||||
Array());
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -138,9 +137,11 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
VisualScriptNodeInstance *VisualScriptYield::instantiate(VisualScriptInstance *p_instance) {
|
||||
VisualScriptNodeInstanceYield *instance = memnew(VisualScriptNodeInstanceYield);
|
||||
//instance->instance=p_instance;
|
||||
VisualScriptNodeInstance *
|
||||
VisualScriptYield::instantiate(VisualScriptInstance *p_instance) {
|
||||
VisualScriptNodeInstanceYield *instance =
|
||||
memnew(VisualScriptNodeInstanceYield);
|
||||
// instance->instance=p_instance;
|
||||
instance->mode = yield_mode;
|
||||
instance->wait_time = wait_time;
|
||||
return instance;
|
||||
@@ -167,9 +168,7 @@ void VisualScriptYield::set_wait_time(double p_time) {
|
||||
ports_changed_notify();
|
||||
}
|
||||
|
||||
double VisualScriptYield::get_wait_time() {
|
||||
return wait_time;
|
||||
}
|
||||
double VisualScriptYield::get_wait_time() { return wait_time; }
|
||||
|
||||
void VisualScriptYield::_validate_property(PropertyInfo &p_property) const {
|
||||
if (p_property.name == "wait_time") {
|
||||
@@ -180,14 +179,22 @@ void VisualScriptYield::_validate_property(PropertyInfo &p_property) const {
|
||||
}
|
||||
|
||||
void VisualScriptYield::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("set_yield_mode", "mode"), &VisualScriptYield::set_yield_mode);
|
||||
ClassDB::bind_method(D_METHOD("get_yield_mode"), &VisualScriptYield::get_yield_mode);
|
||||
ClassDB::bind_method(D_METHOD("set_yield_mode", "mode"),
|
||||
&VisualScriptYield::set_yield_mode);
|
||||
ClassDB::bind_method(D_METHOD("get_yield_mode"),
|
||||
&VisualScriptYield::get_yield_mode);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_wait_time", "sec"), &VisualScriptYield::set_wait_time);
|
||||
ClassDB::bind_method(D_METHOD("get_wait_time"), &VisualScriptYield::get_wait_time);
|
||||
ClassDB::bind_method(D_METHOD("set_wait_time", "sec"),
|
||||
&VisualScriptYield::set_wait_time);
|
||||
ClassDB::bind_method(D_METHOD("get_wait_time"),
|
||||
&VisualScriptYield::get_wait_time);
|
||||
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "mode", PROPERTY_HINT_ENUM, "Frame,Physics Frame,Time", PROPERTY_USAGE_NO_EDITOR), "set_yield_mode", "get_yield_mode");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "wait_time"), "set_wait_time", "get_wait_time");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "mode", PROPERTY_HINT_ENUM,
|
||||
"Frame,Physics Frame,Time",
|
||||
PROPERTY_USAGE_NO_EDITOR),
|
||||
"set_yield_mode", "get_yield_mode");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "wait_time"), "set_wait_time",
|
||||
"get_wait_time");
|
||||
|
||||
BIND_ENUM_CONSTANT(YIELD_FRAME);
|
||||
BIND_ENUM_CONSTANT(YIELD_PHYSICS_FRAME);
|
||||
@@ -215,13 +222,13 @@ int VisualScriptYieldSignal::get_output_sequence_port_count() const {
|
||||
return 1;
|
||||
}
|
||||
|
||||
bool VisualScriptYieldSignal::has_input_sequence_port() const {
|
||||
return true;
|
||||
}
|
||||
bool VisualScriptYieldSignal::has_input_sequence_port() const { return true; }
|
||||
#ifdef TOOLS_ENABLED
|
||||
|
||||
static Node *_find_script_node(Node *p_edited_scene, Node *p_current_node, const Ref<Script> &script) {
|
||||
if (p_edited_scene != p_current_node && p_current_node->get_owner() != p_edited_scene) {
|
||||
static Node *_find_script_node(Node *p_edited_scene, Node *p_current_node,
|
||||
const Ref<Script> &script) {
|
||||
if (p_edited_scene != p_current_node &&
|
||||
p_current_node->get_owner() != p_edited_scene) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -232,7 +239,8 @@ static Node *_find_script_node(Node *p_edited_scene, Node *p_current_node, const
|
||||
}
|
||||
|
||||
for (int i = 0; i < p_current_node->get_child_count(); i++) {
|
||||
Node *n = _find_script_node(p_edited_scene, p_current_node->get_child(i), script);
|
||||
Node *n =
|
||||
_find_script_node(p_edited_scene, p_current_node->get_child(i), script);
|
||||
if (n) {
|
||||
return n;
|
||||
}
|
||||
@@ -244,8 +252,8 @@ static Node *_find_script_node(Node *p_edited_scene, Node *p_current_node, const
|
||||
#endif
|
||||
Node *VisualScriptYieldSignal::_get_base_node() const {
|
||||
#ifdef TOOLS_ENABLED
|
||||
Ref<Script> script = get_visual_script();
|
||||
if (!script.is_valid()) {
|
||||
Ref<Script> yield_script = get_visual_script();
|
||||
if (!yield_script.is_valid()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -262,7 +270,7 @@ Node *VisualScriptYieldSignal::_get_base_node() const {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Node *script_node = _find_script_node(edited_scene, edited_scene, script);
|
||||
Node *script_node = _find_script_node(edited_scene, edited_scene, yield_script);
|
||||
|
||||
if (!script_node) {
|
||||
return nullptr;
|
||||
@@ -284,7 +292,8 @@ Node *VisualScriptYieldSignal::_get_base_node() const {
|
||||
StringName VisualScriptYieldSignal::_get_base_type() const {
|
||||
if (call_mode == CALL_MODE_SELF && get_visual_script().is_valid()) {
|
||||
return get_visual_script()->get_instance_base_type();
|
||||
} else if (call_mode == CALL_MODE_NODE_PATH && get_visual_script().is_valid()) {
|
||||
} else if (call_mode == CALL_MODE_NODE_PATH &&
|
||||
get_visual_script().is_valid()) {
|
||||
Node *path = _get_base_node();
|
||||
if (path) {
|
||||
return path->get_class();
|
||||
@@ -312,11 +321,13 @@ int VisualScriptYieldSignal::get_output_value_port_count() const {
|
||||
return sr.arguments.size();
|
||||
}
|
||||
|
||||
String VisualScriptYieldSignal::get_output_sequence_port_text(int p_port) const {
|
||||
String
|
||||
VisualScriptYieldSignal::get_output_sequence_port_text(int p_port) const {
|
||||
return String();
|
||||
}
|
||||
|
||||
PropertyInfo VisualScriptYieldSignal::get_input_value_port_info(int p_idx) const {
|
||||
PropertyInfo
|
||||
VisualScriptYieldSignal::get_input_value_port_info(int p_idx) const {
|
||||
if (call_mode == CALL_MODE_INSTANCE) {
|
||||
return PropertyInfo(Variant::OBJECT, "instance");
|
||||
} else {
|
||||
@@ -324,11 +335,12 @@ PropertyInfo VisualScriptYieldSignal::get_input_value_port_info(int p_idx) const
|
||||
}
|
||||
}
|
||||
|
||||
PropertyInfo VisualScriptYieldSignal::get_output_value_port_info(int p_idx) const {
|
||||
PropertyInfo
|
||||
VisualScriptYieldSignal::get_output_value_port_info(int p_idx) const {
|
||||
MethodInfo sr;
|
||||
|
||||
if (!ClassDB::get_signal(_get_base_type(), signal, &sr)) {
|
||||
return PropertyInfo(); //no signal
|
||||
return PropertyInfo(); // no signal
|
||||
}
|
||||
ERR_FAIL_INDEX_V(p_idx, sr.arguments.size(), PropertyInfo());
|
||||
return sr.arguments[p_idx];
|
||||
@@ -368,9 +380,7 @@ void VisualScriptYieldSignal::set_base_type(const StringName &p_type) {
|
||||
ports_changed_notify();
|
||||
}
|
||||
|
||||
StringName VisualScriptYieldSignal::get_base_type() const {
|
||||
return base_type;
|
||||
}
|
||||
StringName VisualScriptYieldSignal::get_base_type() const { return base_type; }
|
||||
|
||||
void VisualScriptYieldSignal::set_signal(const StringName &p_type) {
|
||||
if (signal == p_type) {
|
||||
@@ -383,9 +393,7 @@ void VisualScriptYieldSignal::set_signal(const StringName &p_type) {
|
||||
ports_changed_notify();
|
||||
}
|
||||
|
||||
StringName VisualScriptYieldSignal::get_signal() const {
|
||||
return signal;
|
||||
}
|
||||
StringName VisualScriptYieldSignal::get_signal() const { return signal; }
|
||||
|
||||
void VisualScriptYieldSignal::set_base_path(const NodePath &p_type) {
|
||||
if (base_path == p_type) {
|
||||
@@ -398,9 +406,7 @@ void VisualScriptYieldSignal::set_base_path(const NodePath &p_type) {
|
||||
ports_changed_notify();
|
||||
}
|
||||
|
||||
NodePath VisualScriptYieldSignal::get_base_path() const {
|
||||
return base_path;
|
||||
}
|
||||
NodePath VisualScriptYieldSignal::get_base_path() const { return base_path; }
|
||||
|
||||
void VisualScriptYieldSignal::set_call_mode(CallMode p_mode) {
|
||||
if (call_mode == p_mode) {
|
||||
@@ -413,11 +419,13 @@ void VisualScriptYieldSignal::set_call_mode(CallMode p_mode) {
|
||||
ports_changed_notify();
|
||||
}
|
||||
|
||||
VisualScriptYieldSignal::CallMode VisualScriptYieldSignal::get_call_mode() const {
|
||||
VisualScriptYieldSignal::CallMode
|
||||
VisualScriptYieldSignal::get_call_mode() const {
|
||||
return call_mode;
|
||||
}
|
||||
|
||||
void VisualScriptYieldSignal::_validate_property(PropertyInfo &p_property) const {
|
||||
void VisualScriptYieldSignal::_validate_property(
|
||||
PropertyInfo &p_property) const {
|
||||
if (p_property.name == "base_type") {
|
||||
if (call_mode != CALL_MODE_INSTANCE) {
|
||||
p_property.usage = PROPERTY_USAGE_NO_EDITOR;
|
||||
@@ -430,7 +438,7 @@ void VisualScriptYieldSignal::_validate_property(PropertyInfo &p_property) const
|
||||
} else {
|
||||
Node *bnode = _get_base_node();
|
||||
if (bnode) {
|
||||
p_property.hint_string = bnode->get_path(); //convert to long string
|
||||
p_property.hint_string = bnode->get_path(); // convert to long string
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -465,17 +473,25 @@ void VisualScriptYieldSignal::_validate_property(PropertyInfo &p_property) const
|
||||
}
|
||||
|
||||
void VisualScriptYieldSignal::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("set_base_type", "base_type"), &VisualScriptYieldSignal::set_base_type);
|
||||
ClassDB::bind_method(D_METHOD("get_base_type"), &VisualScriptYieldSignal::get_base_type);
|
||||
ClassDB::bind_method(D_METHOD("set_base_type", "base_type"),
|
||||
&VisualScriptYieldSignal::set_base_type);
|
||||
ClassDB::bind_method(D_METHOD("get_base_type"),
|
||||
&VisualScriptYieldSignal::get_base_type);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_signal", "signal"), &VisualScriptYieldSignal::set_signal);
|
||||
ClassDB::bind_method(D_METHOD("get_signal"), &VisualScriptYieldSignal::get_signal);
|
||||
ClassDB::bind_method(D_METHOD("set_signal", "signal"),
|
||||
&VisualScriptYieldSignal::set_signal);
|
||||
ClassDB::bind_method(D_METHOD("get_signal"),
|
||||
&VisualScriptYieldSignal::get_signal);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_call_mode", "mode"), &VisualScriptYieldSignal::set_call_mode);
|
||||
ClassDB::bind_method(D_METHOD("get_call_mode"), &VisualScriptYieldSignal::get_call_mode);
|
||||
ClassDB::bind_method(D_METHOD("set_call_mode", "mode"),
|
||||
&VisualScriptYieldSignal::set_call_mode);
|
||||
ClassDB::bind_method(D_METHOD("get_call_mode"),
|
||||
&VisualScriptYieldSignal::get_call_mode);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_base_path", "base_path"), &VisualScriptYieldSignal::set_base_path);
|
||||
ClassDB::bind_method(D_METHOD("get_base_path"), &VisualScriptYieldSignal::get_base_path);
|
||||
ClassDB::bind_method(D_METHOD("set_base_path", "base_path"),
|
||||
&VisualScriptYieldSignal::set_base_path);
|
||||
ClassDB::bind_method(D_METHOD("get_base_path"),
|
||||
&VisualScriptYieldSignal::get_base_path);
|
||||
|
||||
String bt;
|
||||
for (int i = 0; i < Variant::VARIANT_MAX; i++) {
|
||||
@@ -486,10 +502,17 @@ void VisualScriptYieldSignal::_bind_methods() {
|
||||
bt += Variant::get_type_name(Variant::Type(i));
|
||||
}
|
||||
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "call_mode", PROPERTY_HINT_ENUM, "Self,Node Path,Instance"), "set_call_mode", "get_call_mode");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::STRING, "base_type", PROPERTY_HINT_TYPE_STRING, "Object"), "set_base_type", "get_base_type");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::NODE_PATH, "node_path", PROPERTY_HINT_NODE_PATH_TO_EDITED_NODE), "set_base_path", "get_base_path");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::STRING, "signal"), "set_signal", "get_signal");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "call_mode", PROPERTY_HINT_ENUM,
|
||||
"Self,Node Path,Instance"),
|
||||
"set_call_mode", "get_call_mode");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::STRING, "base_type",
|
||||
PROPERTY_HINT_TYPE_STRING, "Object"),
|
||||
"set_base_type", "get_base_type");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::NODE_PATH, "node_path",
|
||||
PROPERTY_HINT_NODE_PATH_TO_EDITED_NODE),
|
||||
"set_base_path", "get_base_path");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::STRING, "signal"), "set_signal",
|
||||
"get_signal");
|
||||
|
||||
BIND_ENUM_CONSTANT(CALL_MODE_SELF);
|
||||
BIND_ENUM_CONSTANT(CALL_MODE_NODE_PATH);
|
||||
@@ -507,14 +530,17 @@ public:
|
||||
VisualScriptInstance *instance = nullptr;
|
||||
|
||||
virtual int get_working_memory_size() const override { return 1; }
|
||||
//virtual bool is_output_port_unsequenced(int p_idx) const { return false; }
|
||||
//virtual bool get_output_port_unsequenced(int p_idx,Variant* r_value,Variant* p_working_mem,String &r_error) const { return true; }
|
||||
// virtual bool is_output_port_unsequenced(int p_idx) const { return false; }
|
||||
// virtual bool get_output_port_unsequenced(int p_idx,Variant*
|
||||
// r_value,Variant* p_working_mem,String &r_error) const { return true; }
|
||||
|
||||
virtual int step(const Variant **p_inputs, Variant **p_outputs, StartMode p_start_mode, Variant *p_working_mem, Callable::CallError &r_error, String &r_error_str) override {
|
||||
virtual int step(const Variant **p_inputs, Variant **p_outputs,
|
||||
StartMode p_start_mode, Variant *p_working_mem,
|
||||
Callable::CallError &r_error, String &r_error_str) override {
|
||||
if (p_start_mode == START_MODE_RESUME_YIELD) {
|
||||
return 0; //resuming yield
|
||||
return 0; // resuming yield
|
||||
} else {
|
||||
//yield
|
||||
// yield
|
||||
|
||||
Object *object = nullptr;
|
||||
|
||||
@@ -524,14 +550,14 @@ public:
|
||||
|
||||
} break;
|
||||
case VisualScriptYieldSignal::CALL_MODE_NODE_PATH: {
|
||||
Node *node = Object::cast_to<Node>(instance->get_owner_ptr());
|
||||
if (!node) {
|
||||
Node *yield_node = Object::cast_to<Node>(instance->get_owner_ptr());
|
||||
if (!yield_node) {
|
||||
r_error.error = Callable::CallError::CALL_ERROR_INVALID_METHOD;
|
||||
r_error_str = "Base object is not a Node!";
|
||||
return 0;
|
||||
}
|
||||
|
||||
Node *another = node->get_node(node_path);
|
||||
Node *another = yield_node->get_node(node_path);
|
||||
if (!another) {
|
||||
r_error.error = Callable::CallError::CALL_ERROR_INVALID_METHOD;
|
||||
r_error_str = "Path does not lead Node!";
|
||||
@@ -564,8 +590,10 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
VisualScriptNodeInstance *VisualScriptYieldSignal::instantiate(VisualScriptInstance *p_instance) {
|
||||
VisualScriptNodeInstanceYieldSignal *instance = memnew(VisualScriptNodeInstanceYieldSignal);
|
||||
VisualScriptNodeInstance *
|
||||
VisualScriptYieldSignal::instantiate(VisualScriptInstance *p_instance) {
|
||||
VisualScriptNodeInstanceYieldSignal *instance =
|
||||
memnew(VisualScriptNodeInstanceYieldSignal);
|
||||
instance->node = this;
|
||||
instance->instance = p_instance;
|
||||
instance->signal = signal;
|
||||
@@ -589,10 +617,18 @@ static Ref<VisualScriptNode> create_yield_signal_node(const String &p_name) {
|
||||
}
|
||||
|
||||
void register_visual_script_yield_nodes() {
|
||||
VisualScriptLanguage::singleton->add_register_func("functions/wait/wait_frame", create_yield_node<VisualScriptYield::YIELD_FRAME>);
|
||||
VisualScriptLanguage::singleton->add_register_func("functions/wait/wait_physics_frame", create_yield_node<VisualScriptYield::YIELD_PHYSICS_FRAME>);
|
||||
VisualScriptLanguage::singleton->add_register_func("functions/wait/wait_time", create_yield_node<VisualScriptYield::YIELD_WAIT>);
|
||||
VisualScriptLanguage::singleton->add_register_func(
|
||||
"functions/wait/wait_frame",
|
||||
create_yield_node<VisualScriptYield::YIELD_FRAME>);
|
||||
VisualScriptLanguage::singleton->add_register_func(
|
||||
"functions/wait/wait_physics_frame",
|
||||
create_yield_node<VisualScriptYield::YIELD_PHYSICS_FRAME>);
|
||||
VisualScriptLanguage::singleton->add_register_func(
|
||||
"functions/wait/wait_time",
|
||||
create_yield_node<VisualScriptYield::YIELD_WAIT>);
|
||||
|
||||
VisualScriptLanguage::singleton->add_register_func("functions/yield", create_yield_node<VisualScriptYield::YIELD_RETURN>);
|
||||
VisualScriptLanguage::singleton->add_register_func("functions/yield_signal", create_node_generic<VisualScriptYieldSignal>);
|
||||
VisualScriptLanguage::singleton->add_register_func(
|
||||
"functions/yield", create_yield_node<VisualScriptYield::YIELD_RETURN>);
|
||||
VisualScriptLanguage::singleton->add_register_func(
|
||||
"functions/yield_signal", create_node_generic<VisualScriptYieldSignal>);
|
||||
}
|
||||
|
||||
@@ -1,32 +1,32 @@
|
||||
/*************************************************************************/
|
||||
/* visual_script_yield_nodes.h */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* https://godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
|
||||
/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
/**************************************************************************/
|
||||
/* visual_script_yield_nodes.h */
|
||||
/**************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* https://godotengine.org */
|
||||
/**************************************************************************/
|
||||
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
|
||||
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef VISUAL_SCRIPT_YIELD_NODES_H
|
||||
#define VISUAL_SCRIPT_YIELD_NODES_H
|
||||
@@ -76,7 +76,8 @@ public:
|
||||
void set_wait_time(double p_time);
|
||||
double get_wait_time();
|
||||
|
||||
virtual VisualScriptNodeInstance *instantiate(VisualScriptInstance *p_instance) override;
|
||||
virtual VisualScriptNodeInstance *
|
||||
instantiate(VisualScriptInstance *p_instance) override;
|
||||
|
||||
VisualScriptYield();
|
||||
};
|
||||
@@ -135,7 +136,8 @@ public:
|
||||
void set_call_mode(CallMode p_mode);
|
||||
CallMode get_call_mode() const;
|
||||
|
||||
virtual VisualScriptNodeInstance *instantiate(VisualScriptInstance *p_instance) override;
|
||||
virtual VisualScriptNodeInstance *
|
||||
instantiate(VisualScriptInstance *p_instance) override;
|
||||
|
||||
VisualScriptYieldSignal();
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user