mirror of
https://github.com/godotengine/godot-visual-script.git
synced 2026-01-04 18:10:07 +03:00
Merge pull request #52 from fire/restore-builds
Restore Godot engine builds.
This commit is contained in:
89
.github/workflows/linux.yml
vendored
Normal file
89
.github/workflows/linux.yml
vendored
Normal file
@@ -0,0 +1,89 @@
|
|||||||
|
name: 🐧 Linux Builds
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [main, github_actions]
|
||||||
|
pull_request:
|
||||||
|
branches: [main]
|
||||||
|
|
||||||
|
# Global Cache Settings
|
||||||
|
env:
|
||||||
|
GODOT_BASE_BRANCH: master
|
||||||
|
SCONS_CACHE_LIMIT: 4096
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
linux-editor:
|
||||||
|
runs-on: "ubuntu-20.04"
|
||||||
|
name: Editor
|
||||||
|
|
||||||
|
steps:
|
||||||
|
# Clone Godot
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
repository: godotengine/godot
|
||||||
|
ref: master
|
||||||
|
|
||||||
|
# Clone our module under the correct directory
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
path: modules/visual_script
|
||||||
|
|
||||||
|
# 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)
|
||||||
|
- name: Configure dependencies
|
||||||
|
run: |
|
||||||
|
sudo apt-get install build-essential pkg-config libx11-dev libxcursor-dev \
|
||||||
|
libxinerama-dev libgl1-mesa-dev libglu-dev libasound2-dev libpulse-dev libudev-dev libxi-dev libxrandr-dev yasm
|
||||||
|
|
||||||
|
# Upload cache on completion and check it out now
|
||||||
|
- name: Load .scons_cache directory
|
||||||
|
id: linux-editor-cache
|
||||||
|
uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: ${{github.workspace}}/.scons_cache/
|
||||||
|
key: ${{github.job}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}-${{github.sha}}
|
||||||
|
restore-keys: |
|
||||||
|
${{github.job}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}-${{github.sha}}
|
||||||
|
${{github.job}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}
|
||||||
|
${{github.job}}-${{env.GODOT_BASE_BRANCH}}
|
||||||
|
|
||||||
|
# Use python 3.x release (works cross platform; best to keep self contained in it's own step)
|
||||||
|
- name: Set up Python 3.x
|
||||||
|
uses: actions/setup-python@v2
|
||||||
|
with:
|
||||||
|
# Semantic version range syntax or exact version of a Python version
|
||||||
|
python-version: "3.x"
|
||||||
|
# Optional - x64 or x86 architecture, defaults to x64
|
||||||
|
architecture: "x64"
|
||||||
|
|
||||||
|
# Setup scons, print python version and scons version info, so if anything is broken it won't run the build.
|
||||||
|
- name: Configuring Python packages
|
||||||
|
run: |
|
||||||
|
python -c "import sys; print(sys.version)"
|
||||||
|
python -m pip install scons
|
||||||
|
python --version
|
||||||
|
scons --version
|
||||||
|
|
||||||
|
# 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=linuxbsd tools=yes tests=no target=release_debug production=yes
|
||||||
|
|
||||||
|
# TODO Such tests are able to run from Godot 4.0 only
|
||||||
|
# Execute unit tests for the editor
|
||||||
|
#- name: Unit Tests
|
||||||
|
# run: |
|
||||||
|
# ./bin/godot.linuxbsd.opt.tools.64 --test
|
||||||
|
|
||||||
|
# Make build available
|
||||||
|
- uses: actions/upload-artifact@v2
|
||||||
|
with:
|
||||||
|
name: godot.linuxbsd.opt.tools.64
|
||||||
|
path: bin/godot.linuxbsd.opt.tools.64
|
||||||
76
.github/workflows/macos.yml
vendored
Normal file
76
.github/workflows/macos.yml
vendored
Normal file
@@ -0,0 +1,76 @@
|
|||||||
|
name: 🍎 Macos Builds
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [main, github_actions]
|
||||||
|
pull_request:
|
||||||
|
branches: [main]
|
||||||
|
|
||||||
|
# Global Cache Settings
|
||||||
|
env:
|
||||||
|
GODOT_BASE_BRANCH: master
|
||||||
|
SCONS_CACHE_LIMIT: 4096
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
macos-editor:
|
||||||
|
runs-on: "macos-10.15"
|
||||||
|
name: Editor
|
||||||
|
|
||||||
|
steps:
|
||||||
|
# Clone Godot
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
repository: godotengine/godot
|
||||||
|
ref: master
|
||||||
|
|
||||||
|
# Clone our module under the correct directory
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
path: modules/visual_script
|
||||||
|
|
||||||
|
# Upload cache on completion and check it out now
|
||||||
|
- name: Load .scons_cache directory
|
||||||
|
id: macos-editor-cache
|
||||||
|
uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: ${{github.workspace}}/.scons_cache/
|
||||||
|
key: ${{github.job}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}-${{github.sha}}
|
||||||
|
restore-keys: |
|
||||||
|
${{github.job}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}-${{github.sha}}
|
||||||
|
${{github.job}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}
|
||||||
|
${{github.job}}-${{env.GODOT_BASE_BRANCH}}
|
||||||
|
|
||||||
|
# Use python 3.x release (works cross platform; best to keep self contained in it's own step)
|
||||||
|
- name: Set up Python 3.x
|
||||||
|
uses: actions/setup-python@v2
|
||||||
|
with:
|
||||||
|
# Semantic version range syntax or exact version of a Python version
|
||||||
|
python-version: "3.x"
|
||||||
|
# Optional - x64 or x86 architecture, defaults to x64
|
||||||
|
architecture: "x64"
|
||||||
|
|
||||||
|
# Setup scons, print python version and scons version info, so if anything is broken it won't run the build.
|
||||||
|
- name: Configuring Python packages
|
||||||
|
run: |
|
||||||
|
python -c "import sys; print(sys.version)"
|
||||||
|
python -m pip install scons
|
||||||
|
python --version
|
||||||
|
scons --version
|
||||||
|
|
||||||
|
# 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
|
||||||
|
|
||||||
|
# TODO Such tests are able to run from Godot 4.0 only
|
||||||
|
# Execute unit tests for the editor
|
||||||
|
#- name: Unit Tests
|
||||||
|
# run: |
|
||||||
|
# ./bin/godot.linuxbsd.opt.tools.64 --test
|
||||||
|
|
||||||
|
# Make build available
|
||||||
|
- uses: actions/upload-artifact@v2
|
||||||
|
with:
|
||||||
|
name: godot.osx.opt.tools.64
|
||||||
|
path: bin/godot.osx.opt.tools.64
|
||||||
53
.github/workflows/scripts/clang_format.sh
vendored
Normal file
53
.github/workflows/scripts/clang_format.sh
vendored
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# This script runs clang-format and fixes copyright headers on all relevant files in the repo.
|
||||||
|
# This is the primary script responsible for fixing style violations.
|
||||||
|
|
||||||
|
set -uo pipefail
|
||||||
|
IFS=$'\n\t'
|
||||||
|
|
||||||
|
CLANG_FORMAT_FILE_EXTS=(".c" ".h" ".cpp" ".hpp" ".cc" ".hh" ".cxx" ".m" ".mm" ".inc" ".java" ".glsl")
|
||||||
|
|
||||||
|
# Loops through all text files tracked by Git.
|
||||||
|
git grep -zIl '' |
|
||||||
|
while IFS= read -rd '' f; do
|
||||||
|
# Exclude 3rd party files.
|
||||||
|
if [[ "$f" == "glad"* ]]; then
|
||||||
|
continue
|
||||||
|
elif [[ "$f" == "godot-cpp"* ]]; then
|
||||||
|
continue
|
||||||
|
elif [[ "$f" == "thirdparty"* ]]; then
|
||||||
|
continue
|
||||||
|
elif [[ "$f" == "gradle"* ]]; then
|
||||||
|
continue
|
||||||
|
elif [[ "$f" == "build"* ]]; then
|
||||||
|
continue
|
||||||
|
elif [[ "$f" == "android"* ]]; then
|
||||||
|
continue
|
||||||
|
elif [[ "$f" == ".github"* ]]; then
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
for extension in ${CLANG_FORMAT_FILE_EXTS[@]}; do
|
||||||
|
if [[ "$f" == *"$extension" ]]; then
|
||||||
|
# Run clang-format.
|
||||||
|
clang-format -i "$f"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
done
|
||||||
|
|
||||||
|
git diff > patch.patch
|
||||||
|
|
||||||
|
# If no patch has been generated all is OK, clean up, and exit.
|
||||||
|
if [ ! -s patch.patch ] ; then
|
||||||
|
printf "Files in this commit comply with the clang-format style rules.\n"
|
||||||
|
rm -f patch.patch
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# A patch has been created, notify the user, clean up, and exit.
|
||||||
|
printf "\n*** The following differences were found between the code "
|
||||||
|
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
|
||||||
69
.github/workflows/scripts/file_format.sh
vendored
Normal file
69
.github/workflows/scripts/file_format.sh
vendored
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# This script ensures proper POSIX text file formatting and a few other things.
|
||||||
|
# This is supplementary to clang_format.sh, but should be run before it.
|
||||||
|
|
||||||
|
# We need dos2unix and recode.
|
||||||
|
if [ ! -x "$(command -v dos2unix)" -o ! -x "$(command -v recode)" ]; then
|
||||||
|
printf "Install 'dos2unix' and 'recode' to use this script.\n"
|
||||||
|
fi
|
||||||
|
|
||||||
|
set -uo pipefail
|
||||||
|
IFS=$'\n\t'
|
||||||
|
|
||||||
|
# Loops through all text files tracked by Git.
|
||||||
|
git grep -zIl '' |
|
||||||
|
while IFS= read -rd '' f; do
|
||||||
|
# Exclude 3rd party files
|
||||||
|
if [[ "$f" == "glad"* ]]; then
|
||||||
|
continue
|
||||||
|
elif [[ "$f" == "godot-cpp"* ]]; then
|
||||||
|
continue
|
||||||
|
elif [[ "$f" == "thirdparty"* ]]; then
|
||||||
|
continue
|
||||||
|
elif [[ "$f" == "gradle"* ]]; then
|
||||||
|
continue
|
||||||
|
elif [[ "$f" == "build"* ]]; then
|
||||||
|
continue
|
||||||
|
elif [[ "$f" == "android"* ]]; then
|
||||||
|
continue
|
||||||
|
elif [[ "$f" == "api.json" ]]; then
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
# Ensure that files are UTF-8 formatted.
|
||||||
|
recode UTF-8 "$f" 2> /dev/null
|
||||||
|
# Ensure that files have LF line endings and do not contain a BOM.
|
||||||
|
dos2unix "$f" 2> /dev/null
|
||||||
|
# Remove trailing space characters and ensures that files end
|
||||||
|
# with newline characters. -l option handles newlines conveniently.
|
||||||
|
perl -i -ple 's/\s*$//g' "$f"
|
||||||
|
# Remove the character sequence "== true" if it has a leading space.
|
||||||
|
perl -i -pe 's/\x20== true//g' "$f"
|
||||||
|
# We don't want to change lines around braces in godot/tscn files.
|
||||||
|
if [[ "$f" == *"godot" ]]; then
|
||||||
|
continue
|
||||||
|
elif [[ "$f" == *"tscn" ]]; then
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
# Disallow empty lines after the opening brace.
|
||||||
|
sed -z -i '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"
|
||||||
|
done
|
||||||
|
|
||||||
|
git diff > patch.patch
|
||||||
|
|
||||||
|
# If no patch has been generated all is OK, clean up, and exit.
|
||||||
|
if [ ! -s patch.patch ] ; then
|
||||||
|
printf "Files in this commit comply with the formatting rules.\n"
|
||||||
|
rm -f patch.patch
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# A patch has been created, notify the user, clean up, and exit.
|
||||||
|
printf "\n*** The following differences were found between the code "
|
||||||
|
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
|
||||||
26
.github/workflows/static_checks.yml
vendored
Normal file
26
.github/workflows/static_checks.yml
vendored
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
name: 📊 Static Checks
|
||||||
|
on: [push, pull_request]
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: ci-${{github.actor}}-${{github.head_ref || github.run_number}}-${{github.ref}}-static-checks
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
static-checks:
|
||||||
|
name: Formatting (clang-format, file format)
|
||||||
|
runs-on: ubuntu-20.04
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: |
|
||||||
|
sudo apt-get install -qq dos2unix recode clang-format
|
||||||
|
|
||||||
|
- name: File formatting checks (file_format.sh)
|
||||||
|
run: |
|
||||||
|
bash ./.github/workflows/scripts/file_format.sh
|
||||||
|
|
||||||
|
- name: Style checks via clang-format (clang_format.sh)
|
||||||
|
run: |
|
||||||
|
bash ./.github/workflows/scripts/clang_format.sh
|
||||||
146
.github/workflows/windows.yml
vendored
Normal file
146
.github/workflows/windows.yml
vendored
Normal file
@@ -0,0 +1,146 @@
|
|||||||
|
name: 🚪 Windows Builds
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [main, github_actions]
|
||||||
|
pull_request:
|
||||||
|
branches: [main]
|
||||||
|
|
||||||
|
# Global Cache Settings
|
||||||
|
# SCONS_CACHE for windows must be set in the build environment
|
||||||
|
env:
|
||||||
|
GODOT_BASE_BRANCH: master
|
||||||
|
SCONS_CACHE_MSVC_CONFIG: true
|
||||||
|
SCONS_CACHE_LIMIT: 4096
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
windows-editor:
|
||||||
|
# Windows 10 with latest image
|
||||||
|
runs-on: "windows-latest"
|
||||||
|
name: Editor
|
||||||
|
|
||||||
|
steps:
|
||||||
|
# Clone Godot
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
repository: v-sekai/godot
|
||||||
|
ref: groups-4.x
|
||||||
|
|
||||||
|
# Clone our module under the correct directory
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
path: modules/visual_script
|
||||||
|
|
||||||
|
# Upload cache on completion and check it out now
|
||||||
|
# Editing this is pretty dangerous for Windows since it can break and needs to be properly tested with a fresh cache.
|
||||||
|
- name: Load .scons_cache directory
|
||||||
|
id: windows-editor-cache
|
||||||
|
uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: /.scons_cache/
|
||||||
|
key: ${{github.job}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}-${{github.sha}}
|
||||||
|
restore-keys: |
|
||||||
|
${{github.job}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}-${{github.sha}}
|
||||||
|
${{github.job}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}
|
||||||
|
${{github.job}}-${{env.GODOT_BASE_BRANCH}}
|
||||||
|
|
||||||
|
# Use python 3.x release (works cross platform; best to keep self contained in it's own step)
|
||||||
|
- name: Set up Python 3.x
|
||||||
|
uses: actions/setup-python@v2
|
||||||
|
with:
|
||||||
|
# Semantic version range syntax or exact version of a Python version
|
||||||
|
python-version: "3.x"
|
||||||
|
# Optional - x64 or x86 architecture, defaults to x64
|
||||||
|
architecture: "x64"
|
||||||
|
|
||||||
|
# Setup scons, print python version and scons version info, so if anything is broken it won't run the build.
|
||||||
|
- name: Configuring Python packages
|
||||||
|
run: |
|
||||||
|
python -c "import sys; print(sys.version)"
|
||||||
|
python -m pip install scons pywin32
|
||||||
|
python --version
|
||||||
|
scons --version
|
||||||
|
|
||||||
|
# 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: /.scons_cache/
|
||||||
|
run: |
|
||||||
|
scons -j2 verbose=yes warnings=all werror=yes platform=windows tools=yes tests=no target=release_debug
|
||||||
|
|
||||||
|
# TODO Such tests are able to run from Godot 4.0 only
|
||||||
|
# Execute unit tests for the editor
|
||||||
|
#- name: Unit Tests
|
||||||
|
# run: |
|
||||||
|
# ./bin/godot.windows.opt.tools.64.exe --test
|
||||||
|
|
||||||
|
# Make build available
|
||||||
|
- uses: actions/upload-artifact@v2
|
||||||
|
with:
|
||||||
|
name: godot.windows.opt.tools.64.exe
|
||||||
|
path: bin/godot.windows.opt.tools.64.exe
|
||||||
|
|
||||||
|
windows-template:
|
||||||
|
# Windows 10 with latest image
|
||||||
|
runs-on: "windows-latest"
|
||||||
|
name: Release
|
||||||
|
|
||||||
|
steps:
|
||||||
|
# Clone Godot
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
repository: v-sekai/godot
|
||||||
|
ref: groups-4.x
|
||||||
|
|
||||||
|
# Clone our module under the correct directory
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
path: modules/visual_script
|
||||||
|
|
||||||
|
# Upload cache on completion and check it out now
|
||||||
|
# Editing this is pretty dangerous for Windows since it can break and needs to be properly tested with a fresh cache.
|
||||||
|
- name: Load .scons_cache directory
|
||||||
|
id: windows-editor-cache
|
||||||
|
uses: RevoluPowered/cache@v2.1
|
||||||
|
with:
|
||||||
|
path: /.scons_cache/
|
||||||
|
key: ${{github.job}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}-${{github.sha}}
|
||||||
|
restore-keys: |
|
||||||
|
${{github.job}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}-${{github.sha}}
|
||||||
|
${{github.job}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}
|
||||||
|
${{github.job}}-${{env.GODOT_BASE_BRANCH}}
|
||||||
|
|
||||||
|
# Use python 3.x release (works cross platform; best to keep self contained in it's own step)
|
||||||
|
- name: Set up Python 3.x
|
||||||
|
uses: actions/setup-python@v2
|
||||||
|
with:
|
||||||
|
# Semantic version range syntax or exact version of a Python version
|
||||||
|
python-version: "3.x"
|
||||||
|
# Optional - x64 or x86 architecture, defaults to x64
|
||||||
|
architecture: "x64"
|
||||||
|
|
||||||
|
# Setup scons, print python version and scons version info, so if anything is broken it won't run the build.
|
||||||
|
- name: Configuring Python packages
|
||||||
|
run: |
|
||||||
|
python -c "import sys; print(sys.version)"
|
||||||
|
python -m pip install scons pywin32
|
||||||
|
python --version
|
||||||
|
scons --version
|
||||||
|
|
||||||
|
# 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: /.scons_cache/
|
||||||
|
run: |
|
||||||
|
scons -j2 verbose=yes warnings=all werror=yes platform=windows tools=no tests=no target=release
|
||||||
|
|
||||||
|
# TODO Such tests are able to run from Godot 4.0 only
|
||||||
|
# Execute unit tests for the editor
|
||||||
|
#- name: Unit Tests
|
||||||
|
# run: |
|
||||||
|
# ./bin/godot.windows.opt.tools.64.exe --test
|
||||||
|
|
||||||
|
# Make build available
|
||||||
|
- uses: actions/upload-artifact@v2
|
||||||
|
with:
|
||||||
|
name: godot.windows.opt.64.exe
|
||||||
|
path: bin/godot.windows.opt.64.exe
|
||||||
2
SCsub
2
SCsub
@@ -7,5 +7,5 @@ env_vs = env_modules.Clone()
|
|||||||
|
|
||||||
env_vs.add_source_files(env.modules_sources, "*.cpp")
|
env_vs.add_source_files(env.modules_sources, "*.cpp")
|
||||||
|
|
||||||
if env["tools"]:
|
if env["target"] == "editor":
|
||||||
env_vs.add_source_files(env.modules_sources, "editor/*.cpp")
|
env_vs.add_source_files(env.modules_sources, "editor/*.cpp")
|
||||||
|
|||||||
@@ -48,6 +48,7 @@
|
|||||||
#include "scene/gui/graph_edit.h"
|
#include "scene/gui/graph_edit.h"
|
||||||
#include "scene/gui/separator.h"
|
#include "scene/gui/separator.h"
|
||||||
#include "scene/gui/view_panner.h"
|
#include "scene/gui/view_panner.h"
|
||||||
|
#include "editor/inspector_dock.h"
|
||||||
#include "scene/main/window.h"
|
#include "scene/main/window.h"
|
||||||
|
|
||||||
#ifdef TOOLS_ENABLED
|
#ifdef TOOLS_ENABLED
|
||||||
@@ -1404,7 +1405,7 @@ void VisualScriptEditor::_create_function_dialog() {
|
|||||||
func_name_box->grab_focus();
|
func_name_box->grab_focus();
|
||||||
for (int i = 0; i < func_input_vbox->get_child_count(); i++) {
|
for (int i = 0; i < func_input_vbox->get_child_count(); i++) {
|
||||||
Node *nd = func_input_vbox->get_child(i);
|
Node *nd = func_input_vbox->get_child(i);
|
||||||
nd->queue_delete();
|
nd->queue_free();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1497,7 +1498,7 @@ void VisualScriptEditor::_add_func_input() {
|
|||||||
|
|
||||||
void VisualScriptEditor::_remove_func_input(Node *p_node) {
|
void VisualScriptEditor::_remove_func_input(Node *p_node) {
|
||||||
func_input_vbox->remove_child(p_node);
|
func_input_vbox->remove_child(p_node);
|
||||||
p_node->queue_delete();
|
p_node->queue_free();
|
||||||
}
|
}
|
||||||
|
|
||||||
void VisualScriptEditor::_deselect_input_names() {
|
void VisualScriptEditor::_deselect_input_names() {
|
||||||
@@ -2700,7 +2701,7 @@ void VisualScriptEditor::set_edited_resource(const Ref<Resource> &p_res) {
|
|||||||
call_deferred(SNAME("_update_members"));
|
call_deferred(SNAME("_update_members"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void VisualScriptEditor::enable_editor() {
|
void VisualScriptEditor::enable_editor(Control *p_shortcut_context) {
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector<String> VisualScriptEditor::get_functions() {
|
Vector<String> VisualScriptEditor::get_functions() {
|
||||||
|
|||||||
@@ -33,6 +33,7 @@
|
|||||||
|
|
||||||
#include "../visual_script.h"
|
#include "../visual_script.h"
|
||||||
#include "editor/create_dialog.h"
|
#include "editor/create_dialog.h"
|
||||||
|
#include "editor/editor_inspector.h"
|
||||||
#include "editor/plugins/script_editor_plugin.h"
|
#include "editor/plugins/script_editor_plugin.h"
|
||||||
#include "visual_script_property_selector.h"
|
#include "visual_script_property_selector.h"
|
||||||
|
|
||||||
@@ -65,10 +66,8 @@ public:
|
|||||||
class VisualScriptEditor : public ScriptEditorBase {
|
class VisualScriptEditor : public ScriptEditorBase {
|
||||||
GDCLASS(VisualScriptEditor, ScriptEditorBase);
|
GDCLASS(VisualScriptEditor, ScriptEditorBase);
|
||||||
|
|
||||||
enum {
|
enum { TYPE_SEQUENCE = 1000,
|
||||||
TYPE_SEQUENCE = 1000,
|
INDEX_BASE_SEQUENCE = 1024 };
|
||||||
INDEX_BASE_SEQUENCE = 1024
|
|
||||||
};
|
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
EDIT_ADD_NODE,
|
EDIT_ADD_NODE,
|
||||||
@@ -91,16 +90,12 @@ class VisualScriptEditor : public ScriptEditorBase {
|
|||||||
CREATE_ACTION,
|
CREATE_ACTION,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum MemberAction {
|
enum MemberAction { MEMBER_EDIT,
|
||||||
MEMBER_EDIT,
|
MEMBER_REMOVE };
|
||||||
MEMBER_REMOVE
|
|
||||||
};
|
|
||||||
|
|
||||||
enum MemberType {
|
enum MemberType { MEMBER_FUNCTION,
|
||||||
MEMBER_FUNCTION,
|
|
||||||
MEMBER_VARIABLE,
|
MEMBER_VARIABLE,
|
||||||
MEMBER_SIGNAL
|
MEMBER_SIGNAL };
|
||||||
};
|
|
||||||
|
|
||||||
VBoxContainer *members_section = nullptr;
|
VBoxContainer *members_section = nullptr;
|
||||||
MenuButton *edit_menu = nullptr;
|
MenuButton *edit_menu = nullptr;
|
||||||
@@ -203,17 +198,22 @@ class VisualScriptEditor : public ScriptEditorBase {
|
|||||||
|
|
||||||
void _port_action_menu(int p_option);
|
void _port_action_menu(int p_option);
|
||||||
|
|
||||||
void connect_data(Ref<VisualScriptNode> vnode_old, Ref<VisualScriptNode> vnode, int new_id);
|
void connect_data(Ref<VisualScriptNode> vnode_old,
|
||||||
|
Ref<VisualScriptNode> vnode, int new_id);
|
||||||
|
|
||||||
NodePath drop_path;
|
NodePath drop_path;
|
||||||
Node *drop_node = nullptr;
|
Node *drop_node = nullptr;
|
||||||
Vector2 drop_position;
|
Vector2 drop_position;
|
||||||
void _selected_connect_node(const String &p_text, const String &p_category, const bool p_connecting = true);
|
void _selected_connect_node(const String &p_text, const String &p_category,
|
||||||
void connect_seq(Ref<VisualScriptNode> vnode_old, Ref<VisualScriptNode> vnode_new, int new_id);
|
const bool p_connecting = true);
|
||||||
|
void connect_seq(Ref<VisualScriptNode> vnode_old,
|
||||||
|
Ref<VisualScriptNode> vnode_new, int new_id);
|
||||||
|
|
||||||
void _cancel_connect_node();
|
void _cancel_connect_node();
|
||||||
int _create_new_node_from_name(const String &p_text, const Vector2 &p_point);
|
int _create_new_node_from_name(const String &p_text, const Vector2 &p_point);
|
||||||
void _selected_new_virtual_method(const String &p_text, const String &p_category, const bool p_connecting);
|
void _selected_new_virtual_method(const String &p_text,
|
||||||
|
const String &p_category,
|
||||||
|
const bool p_connecting);
|
||||||
|
|
||||||
int error_line = -1;
|
int error_line = -1;
|
||||||
|
|
||||||
@@ -231,20 +231,26 @@ class VisualScriptEditor : public ScriptEditorBase {
|
|||||||
void _end_node_move();
|
void _end_node_move();
|
||||||
void _move_node(int p_id, const Vector2 &p_to);
|
void _move_node(int p_id, const Vector2 &p_to);
|
||||||
|
|
||||||
void _get_ends(int p_node, const List<VisualScript::SequenceConnection> &p_seqs, const RBSet<int> &p_selected, RBSet<int> &r_end_nodes);
|
void _get_ends(int p_node,
|
||||||
|
const List<VisualScript::SequenceConnection> &p_seqs,
|
||||||
|
const RBSet<int> &p_selected, RBSet<int> &r_end_nodes);
|
||||||
|
|
||||||
void _node_moved(Vector2 p_from, Vector2 p_to, int p_id);
|
void _node_moved(Vector2 p_from, Vector2 p_to, int p_id);
|
||||||
void _remove_node(int p_id);
|
void _remove_node(int p_id);
|
||||||
void _graph_connected(const String &p_from, int p_from_slot, const String &p_to, int p_to_slot);
|
void _graph_connected(const String &p_from, int p_from_slot,
|
||||||
void _graph_disconnected(const String &p_from, int p_from_slot, const String &p_to, int p_to_slot);
|
const String &p_to, int p_to_slot);
|
||||||
void _graph_connect_to_empty(const String &p_from, int p_from_slot, const Vector2 &p_release_pos);
|
void _graph_disconnected(const String &p_from, int p_from_slot,
|
||||||
|
const String &p_to, int p_to_slot);
|
||||||
|
void _graph_connect_to_empty(const String &p_from, int p_from_slot,
|
||||||
|
const Vector2 &p_release_pos);
|
||||||
|
|
||||||
void _node_ports_changed(int p_id);
|
void _node_ports_changed(int p_id);
|
||||||
void _node_create();
|
void _node_create();
|
||||||
|
|
||||||
void _update_available_nodes();
|
void _update_available_nodes();
|
||||||
|
|
||||||
void _member_button(Object *p_item, int p_column, int p_button, MouseButton p_mouse_button);
|
void _member_button(Object *p_item, int p_column, int p_button,
|
||||||
|
MouseButton p_mouse_button);
|
||||||
|
|
||||||
void _expression_text_changed(const String &p_text, int p_id);
|
void _expression_text_changed(const String &p_text, int p_id);
|
||||||
void _add_input_port(int p_id);
|
void _add_input_port(int p_id);
|
||||||
@@ -253,10 +259,12 @@ class VisualScriptEditor : public ScriptEditorBase {
|
|||||||
void _remove_output_port(int p_id, int p_port);
|
void _remove_output_port(int p_id, int p_port);
|
||||||
void _change_port_type(int p_select, int p_id, int p_port, bool is_input);
|
void _change_port_type(int p_select, int p_id, int p_port, bool is_input);
|
||||||
void _update_node_size(int p_id);
|
void _update_node_size(int p_id);
|
||||||
void _port_name_focus_out(const Node *p_name_box, int p_id, int p_port, bool is_input);
|
void _port_name_focus_out(const Node *p_name_box, int p_id, int p_port,
|
||||||
|
bool is_input);
|
||||||
|
|
||||||
Vector2 _get_pos_in_graph(Vector2 p_point) const;
|
Vector2 _get_pos_in_graph(Vector2 p_point) const;
|
||||||
Vector2 _get_available_pos(bool p_centered = true, Vector2 p_pos = Vector2()) const;
|
Vector2 _get_available_pos(bool p_centered = true,
|
||||||
|
Vector2 p_pos = Vector2()) const;
|
||||||
|
|
||||||
bool node_has_sequence_connections(int p_id);
|
bool node_has_sequence_connections(int p_id);
|
||||||
|
|
||||||
@@ -284,8 +292,10 @@ class VisualScriptEditor : public ScriptEditorBase {
|
|||||||
void _on_nodes_duplicate();
|
void _on_nodes_duplicate();
|
||||||
|
|
||||||
Variant get_drag_data_fw(const Point2 &p_point, Control *p_from);
|
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;
|
bool can_drop_data_fw(const Point2 &p_point, const Variant &p_data,
|
||||||
void drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from);
|
Control *p_from) const;
|
||||||
|
void drop_data_fw(const Point2 &p_point, const Variant &p_data,
|
||||||
|
Control *p_from);
|
||||||
|
|
||||||
int editing_id = 0;
|
int editing_id = 0;
|
||||||
int editing_input = 0;
|
int editing_input = 0;
|
||||||
@@ -294,7 +304,9 @@ class VisualScriptEditor : public ScriptEditorBase {
|
|||||||
int data_disconnect_node = 0;
|
int data_disconnect_node = 0;
|
||||||
int data_disconnect_port = 0;
|
int data_disconnect_port = 0;
|
||||||
|
|
||||||
void _default_value_changed(const StringName &p_property, const Variant &p_value, const String &p_field, bool p_changing);
|
void _default_value_changed(const StringName &p_property,
|
||||||
|
const Variant &p_value, const String &p_field,
|
||||||
|
bool p_changing);
|
||||||
void _default_value_edited(Node *p_button, int p_id, int p_input_port);
|
void _default_value_edited(Node *p_button, int p_id, int p_input_port);
|
||||||
|
|
||||||
void _menu_option(int p_what);
|
void _menu_option(int p_what);
|
||||||
@@ -303,9 +315,14 @@ class VisualScriptEditor : public ScriptEditorBase {
|
|||||||
void _comment_node_resized(const Vector2 &p_new_size, int p_node);
|
void _comment_node_resized(const Vector2 &p_new_size, int p_node);
|
||||||
|
|
||||||
void _draw_color_over_button(Object *obj, Color p_color);
|
void _draw_color_over_button(Object *obj, Color p_color);
|
||||||
void _button_resource_previewed(const String &p_path, const Ref<Texture2D> &p_preview, const Ref<Texture2D> &p_small_preview, Variant p_ud);
|
void _button_resource_previewed(const String &p_path,
|
||||||
|
const Ref<Texture2D> &p_preview,
|
||||||
|
const Ref<Texture2D> &p_small_preview,
|
||||||
|
Variant p_ud);
|
||||||
|
|
||||||
VisualScriptNode::TypeGuess _guess_output_type(int p_port_action_node, int p_port_action_output, RBSet<int> &p_visited_nodes);
|
VisualScriptNode::TypeGuess _guess_output_type(int p_port_action_node,
|
||||||
|
int p_port_action_output,
|
||||||
|
RBSet<int> &p_visited_nodes);
|
||||||
|
|
||||||
void _member_rmb_selected(const Vector2 &p_pos, MouseButton p_button);
|
void _member_rmb_selected(const Vector2 &p_pos, MouseButton p_button);
|
||||||
void _member_option(int p_option);
|
void _member_option(int p_option);
|
||||||
@@ -317,13 +334,15 @@ protected:
|
|||||||
static void _bind_methods();
|
static void _bind_methods();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual void add_syntax_highlighter(Ref<EditorSyntaxHighlighter> p_highlighter) override;
|
virtual void
|
||||||
virtual void set_syntax_highlighter(Ref<EditorSyntaxHighlighter> p_highlighter) override;
|
add_syntax_highlighter(Ref<EditorSyntaxHighlighter> p_highlighter) override;
|
||||||
|
virtual void
|
||||||
|
set_syntax_highlighter(Ref<EditorSyntaxHighlighter> p_highlighter) override;
|
||||||
|
|
||||||
virtual void apply_code() override;
|
virtual void apply_code() override;
|
||||||
virtual Ref<Resource> get_edited_resource() const override;
|
virtual Ref<Resource> get_edited_resource() const override;
|
||||||
virtual void set_edited_resource(const Ref<Resource> &p_res) override;
|
virtual void set_edited_resource(const Ref<Resource> &p_res) override;
|
||||||
virtual void enable_editor() override;
|
virtual void enable_editor(Control *p_shortcut_context) override;
|
||||||
virtual Vector<String> get_functions() override;
|
virtual Vector<String> get_functions() override;
|
||||||
virtual void reload_text() override;
|
virtual void reload_text() override;
|
||||||
virtual String get_name() override;
|
virtual String get_name() override;
|
||||||
@@ -344,16 +363,21 @@ public:
|
|||||||
virtual PackedInt32Array get_breakpoints() override;
|
virtual PackedInt32Array get_breakpoints() override;
|
||||||
virtual void set_breakpoint(int p_line, bool p_enable) override{};
|
virtual void set_breakpoint(int p_line, bool p_enable) override{};
|
||||||
virtual void clear_breakpoints() override{};
|
virtual void clear_breakpoints() override{};
|
||||||
virtual void add_callback(const String &p_function, PackedStringArray p_args) override;
|
virtual void add_callback(const String &p_function,
|
||||||
|
PackedStringArray p_args) override;
|
||||||
virtual void update_settings() override;
|
virtual void update_settings() override;
|
||||||
virtual bool show_members_overview() override;
|
virtual bool show_members_overview() override;
|
||||||
virtual void set_debugger_active(bool p_active) override;
|
virtual void set_debugger_active(bool p_active) override;
|
||||||
virtual void set_tooltip_request_func(const Callable &p_toolip_callback) override;
|
virtual void
|
||||||
|
set_tooltip_request_func(const Callable &p_toolip_callback) override;
|
||||||
virtual Control *get_edit_menu() override;
|
virtual Control *get_edit_menu() override;
|
||||||
virtual void clear_edit_menu() override;
|
virtual void clear_edit_menu() override;
|
||||||
virtual void set_find_replace_bar(FindReplaceBar *p_bar) override { p_bar->hide(); }; // Not needed here.
|
virtual void set_find_replace_bar(FindReplaceBar *p_bar) override {
|
||||||
|
p_bar->hide();
|
||||||
|
}; // Not needed here.
|
||||||
virtual bool can_lose_focus_on_node_selection() override { return false; }
|
virtual bool can_lose_focus_on_node_selection() override { return false; }
|
||||||
virtual void validate() override;
|
virtual void validate() override;
|
||||||
|
virtual Variant get_navigation_state() override { return Variant(); }
|
||||||
|
|
||||||
virtual Control *get_base_editor() const override;
|
virtual Control *get_base_editor() const override;
|
||||||
|
|
||||||
@@ -383,7 +407,8 @@ protected:
|
|||||||
public:
|
public:
|
||||||
static VisualScriptCustomNodes *get_singleton() { return singleton; }
|
static VisualScriptCustomNodes *get_singleton() { return singleton; }
|
||||||
|
|
||||||
void add_custom_node(const String &p_name, const String &p_category, const Ref<Script> &p_script);
|
void add_custom_node(const String &p_name, const String &p_category,
|
||||||
|
const Ref<Script> &p_script);
|
||||||
void remove_custom_node(const String &p_name, const String &p_category);
|
void remove_custom_node(const String &p_name, const String &p_category);
|
||||||
|
|
||||||
VisualScriptCustomNodes();
|
VisualScriptCustomNodes();
|
||||||
|
|||||||
@@ -33,197 +33,234 @@
|
|||||||
|
|
||||||
#include "../visual_script.h"
|
#include "../visual_script.h"
|
||||||
#include "editor/editor_help.h"
|
#include "editor/editor_help.h"
|
||||||
|
#include "scene/gui/dialogs.h"
|
||||||
|
#include "scene/gui/option_button.h"
|
||||||
#include "scene/gui/rich_text_label.h"
|
#include "scene/gui/rich_text_label.h"
|
||||||
#include "scene/gui/tree.h"
|
#include "scene/gui/tree.h"
|
||||||
|
|
||||||
class VisualScriptPropertySelector : public ConfirmationDialog {
|
class VisualScriptPropertySelector : public ConfirmationDialog {
|
||||||
GDCLASS(VisualScriptPropertySelector, ConfirmationDialog);
|
GDCLASS(VisualScriptPropertySelector, ConfirmationDialog);
|
||||||
|
|
||||||
enum SearchFlags {
|
enum SearchFlags {
|
||||||
SEARCH_CLASSES = 1 << 0,
|
SEARCH_CLASSES = 1 << 0,
|
||||||
SEARCH_CONSTRUCTORS = 1 << 1,
|
SEARCH_CONSTRUCTORS = 1 << 1,
|
||||||
SEARCH_METHODS = 1 << 2,
|
SEARCH_METHODS = 1 << 2,
|
||||||
SEARCH_OPERATORS = 1 << 3,
|
SEARCH_OPERATORS = 1 << 3,
|
||||||
SEARCH_SIGNALS = 1 << 4,
|
SEARCH_SIGNALS = 1 << 4,
|
||||||
SEARCH_CONSTANTS = 1 << 5,
|
SEARCH_CONSTANTS = 1 << 5,
|
||||||
SEARCH_PROPERTIES = 1 << 6,
|
SEARCH_PROPERTIES = 1 << 6,
|
||||||
SEARCH_THEME_ITEMS = 1 << 7,
|
SEARCH_THEME_ITEMS = 1 << 7,
|
||||||
SEARCH_VISUAL_SCRIPT_NODES = 1 << 8,
|
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_ALL = SEARCH_CLASSES | SEARCH_CONSTRUCTORS | SEARCH_METHODS |
|
||||||
SEARCH_CASE_SENSITIVE = 1 << 29,
|
SEARCH_OPERATORS | SEARCH_SIGNALS | SEARCH_CONSTANTS |
|
||||||
SEARCH_SHOW_HIERARCHY = 1 << 30,
|
SEARCH_PROPERTIES | SEARCH_THEME_ITEMS,
|
||||||
};
|
SEARCH_CASE_SENSITIVE = 1 << 29,
|
||||||
|
SEARCH_SHOW_HIERARCHY = 1 << 30,
|
||||||
|
};
|
||||||
|
|
||||||
enum ScopeFlags {
|
enum ScopeFlags {
|
||||||
SCOPE_BASE = 1 << 0,
|
SCOPE_BASE = 1 << 0,
|
||||||
SCOPE_INHERITERS = 1 << 1,
|
SCOPE_INHERITERS = 1 << 1,
|
||||||
SCOPE_UNRELATED = 1 << 2,
|
SCOPE_UNRELATED = 1 << 2,
|
||||||
SCOPE_RELATED = SCOPE_BASE | SCOPE_INHERITERS,
|
SCOPE_RELATED = SCOPE_BASE | SCOPE_INHERITERS,
|
||||||
SCOPE_ALL = SCOPE_BASE | SCOPE_INHERITERS | SCOPE_UNRELATED
|
SCOPE_ALL = SCOPE_BASE | SCOPE_INHERITERS | SCOPE_UNRELATED
|
||||||
};
|
};
|
||||||
|
|
||||||
enum ScopeCombo {
|
enum ScopeCombo {
|
||||||
COMBO_RELATED,
|
COMBO_RELATED,
|
||||||
COMBO_SEPARATOR,
|
COMBO_SEPARATOR,
|
||||||
COMBO_BASE,
|
COMBO_BASE,
|
||||||
COMBO_INHERITERS,
|
COMBO_INHERITERS,
|
||||||
COMBO_UNRELATED,
|
COMBO_UNRELATED,
|
||||||
COMBO_ALL,
|
COMBO_ALL,
|
||||||
};
|
};
|
||||||
|
|
||||||
LineEdit *search_box = nullptr;
|
LineEdit *search_box = nullptr;
|
||||||
|
|
||||||
Button *case_sensitive_button = nullptr;
|
Button *case_sensitive_button = nullptr;
|
||||||
Button *hierarchy_button = nullptr;
|
Button *hierarchy_button = nullptr;
|
||||||
|
|
||||||
Button *search_visual_script_nodes = nullptr;
|
Button *search_visual_script_nodes = nullptr;
|
||||||
Button *search_classes = nullptr;
|
Button *search_classes = nullptr;
|
||||||
Button *search_operators = nullptr;
|
Button *search_operators = nullptr;
|
||||||
|
|
||||||
Button *search_methods = nullptr;
|
Button *search_methods = nullptr;
|
||||||
Button *search_signals = nullptr;
|
Button *search_signals = nullptr;
|
||||||
Button *search_constants = nullptr;
|
Button *search_constants = nullptr;
|
||||||
Button *search_properties = nullptr;
|
Button *search_properties = nullptr;
|
||||||
Button *search_theme_items = nullptr;
|
Button *search_theme_items = nullptr;
|
||||||
|
|
||||||
OptionButton *scope_combo = nullptr;
|
OptionButton *scope_combo = nullptr;
|
||||||
Tree *results_tree = nullptr;
|
Tree *results_tree = nullptr;
|
||||||
|
|
||||||
class SearchRunner;
|
class SearchRunner;
|
||||||
Ref<SearchRunner> search_runner;
|
Ref<SearchRunner> search_runner;
|
||||||
|
|
||||||
void _update_icons();
|
void _update_icons();
|
||||||
|
|
||||||
void _sbox_input(const Ref<InputEvent> &p_ie);
|
void _sbox_input(const Ref<InputEvent> &p_ie);
|
||||||
void _update_results_i(int p_int);
|
void _update_results_i(int p_int);
|
||||||
void _update_results_s(String p_string);
|
void _update_results_s(String p_string);
|
||||||
void _update_results_search_all();
|
void _update_results_search_all();
|
||||||
void _update_results();
|
void _update_results();
|
||||||
|
|
||||||
void _confirmed();
|
void _confirmed();
|
||||||
void _item_selected();
|
void _item_selected();
|
||||||
void _hide_requested();
|
void _hide_requested();
|
||||||
|
|
||||||
EditorHelpBit *help_bit = nullptr;
|
EditorHelpBit *help_bit = nullptr;
|
||||||
|
|
||||||
bool properties = false;
|
bool properties = false;
|
||||||
bool visual_script_generic = false;
|
bool visual_script_generic = false;
|
||||||
bool connecting = false;
|
bool connecting = false;
|
||||||
String selected;
|
String selected;
|
||||||
Variant::Type type;
|
Variant::Type type;
|
||||||
String base_type;
|
String base_type;
|
||||||
String base_script;
|
String base_script;
|
||||||
ObjectID script;
|
ObjectID script;
|
||||||
Object *instance = nullptr;
|
Object *instance = nullptr;
|
||||||
bool virtuals_only = false;
|
bool virtuals_only = false;
|
||||||
VBoxContainer *vbox = nullptr;
|
VBoxContainer *vbox = nullptr;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void _notification(int p_what);
|
void _notification(int p_what);
|
||||||
static void _bind_methods();
|
static void _bind_methods();
|
||||||
|
|
||||||
public:
|
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_method_from_base_type(const String &p_base,
|
||||||
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);
|
const bool p_virtuals_only = false,
|
||||||
void select_from_script(const Ref<Script> &p_script, const bool p_connecting = true, bool clear_text = true);
|
const bool p_connecting = true,
|
||||||
void select_from_basic_type(Variant::Type p_type, const bool p_connecting = true, bool clear_text = 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_base_type(const String &p_base,
|
||||||
void select_from_instance(Object *p_instance, const bool p_connecting = true, bool clear_text = true);
|
const String &p_base_script = "",
|
||||||
void select_from_visual_script(const Ref<Script> &p_script, bool clear_text = true);
|
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 show_window(float p_screen_ratio);
|
void show_window(float p_screen_ratio);
|
||||||
|
|
||||||
VisualScriptPropertySelector();
|
VisualScriptPropertySelector();
|
||||||
};
|
};
|
||||||
|
|
||||||
class VisualScriptPropertySelector::SearchRunner : public RefCounted {
|
class VisualScriptPropertySelector::SearchRunner : public RefCounted {
|
||||||
enum Phase {
|
enum Phase {
|
||||||
PHASE_INIT,
|
PHASE_INIT,
|
||||||
PHASE_MATCH_CLASSES_INIT,
|
PHASE_MATCH_CLASSES_INIT,
|
||||||
PHASE_NODE_CLASSES_INIT,
|
PHASE_NODE_CLASSES_INIT,
|
||||||
PHASE_NODE_CLASSES_BUILD,
|
PHASE_NODE_CLASSES_BUILD,
|
||||||
PHASE_MATCH_CLASSES,
|
PHASE_MATCH_CLASSES,
|
||||||
PHASE_CLASS_ITEMS_INIT,
|
PHASE_CLASS_ITEMS_INIT,
|
||||||
PHASE_CLASS_ITEMS,
|
PHASE_CLASS_ITEMS,
|
||||||
PHASE_MEMBER_ITEMS_INIT,
|
PHASE_MEMBER_ITEMS_INIT,
|
||||||
PHASE_MEMBER_ITEMS,
|
PHASE_MEMBER_ITEMS,
|
||||||
PHASE_SELECT_MATCH,
|
PHASE_SELECT_MATCH,
|
||||||
PHASE_MAX
|
PHASE_MAX
|
||||||
};
|
};
|
||||||
int phase = 0;
|
int phase = 0;
|
||||||
|
|
||||||
struct ClassMatch {
|
struct ClassMatch {
|
||||||
DocData::ClassDoc *doc;
|
DocData::ClassDoc *doc;
|
||||||
bool name = false;
|
bool name = false;
|
||||||
String category = "";
|
String category = "";
|
||||||
Vector<DocData::MethodDoc *> constructors;
|
Vector<DocData::MethodDoc *> constructors;
|
||||||
Vector<DocData::MethodDoc *> methods;
|
Vector<DocData::MethodDoc *> methods;
|
||||||
Vector<DocData::MethodDoc *> operators;
|
Vector<DocData::MethodDoc *> operators;
|
||||||
Vector<DocData::MethodDoc *> signals;
|
Vector<DocData::MethodDoc *> signals;
|
||||||
Vector<DocData::ConstantDoc *> constants;
|
Vector<DocData::ConstantDoc *> constants;
|
||||||
Vector<DocData::PropertyDoc *> properties;
|
Vector<DocData::PropertyDoc *> properties;
|
||||||
Vector<DocData::ThemeItemDoc *> theme_properties;
|
Vector<DocData::ThemeItemDoc *> theme_properties;
|
||||||
|
|
||||||
bool required() {
|
bool required() {
|
||||||
return name || methods.size() || signals.size() || constants.size() || properties.size() || theme_properties.size();
|
return name || methods.size() || signals.size() || constants.size() ||
|
||||||
}
|
properties.size() || theme_properties.size();
|
||||||
};
|
}
|
||||||
|
};
|
||||||
|
|
||||||
VisualScriptPropertySelector *selector_ui = nullptr;
|
VisualScriptPropertySelector *selector_ui = nullptr;
|
||||||
Control *ui_service = nullptr;
|
Control *ui_service = nullptr;
|
||||||
Tree *results_tree = nullptr;
|
Tree *results_tree = nullptr;
|
||||||
String term;
|
String term;
|
||||||
int search_flags = 0;
|
int search_flags = 0;
|
||||||
int scope_flags = 0;
|
int scope_flags = 0;
|
||||||
|
|
||||||
Ref<Texture2D> empty_icon;
|
Ref<Texture2D> empty_icon;
|
||||||
Color disabled_color;
|
Color disabled_color;
|
||||||
|
|
||||||
HashMap<String, DocData::ClassDoc>::Iterator iterator_doc;
|
HashMap<String, DocData::ClassDoc>::Iterator iterator_doc;
|
||||||
HashMap<String, ClassMatch> matches;
|
HashMap<String, ClassMatch> matches;
|
||||||
HashMap<String, ClassMatch>::Iterator iterator_match;
|
HashMap<String, ClassMatch>::Iterator iterator_match;
|
||||||
TreeItem *root_item = nullptr;
|
TreeItem *root_item = nullptr;
|
||||||
HashMap<String, TreeItem *> class_items;
|
HashMap<String, TreeItem *> class_items;
|
||||||
TreeItem *matched_item = nullptr;
|
TreeItem *matched_item = nullptr;
|
||||||
float match_highest_score = 0;
|
float match_highest_score = 0;
|
||||||
|
|
||||||
HashMap<String, DocData::ClassDoc> combined_docs;
|
HashMap<String, DocData::ClassDoc> combined_docs;
|
||||||
List<String> vs_nodes;
|
List<String> vs_nodes;
|
||||||
|
|
||||||
bool _is_class_disabled_by_feature_profile(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 _is_class_disabled_by_scope(const StringName &p_class);
|
||||||
|
|
||||||
bool _slice();
|
bool _slice();
|
||||||
bool _phase_init();
|
bool _phase_init();
|
||||||
bool _phase_match_classes_init();
|
bool _phase_match_classes_init();
|
||||||
bool _phase_node_classes_init();
|
bool _phase_node_classes_init();
|
||||||
bool _phase_node_classes_build();
|
bool _phase_node_classes_build();
|
||||||
bool _phase_match_classes();
|
bool _phase_match_classes();
|
||||||
bool _phase_class_items_init();
|
bool _phase_class_items_init();
|
||||||
bool _phase_class_items();
|
bool _phase_class_items();
|
||||||
bool _phase_member_items_init();
|
bool _phase_member_items_init();
|
||||||
bool _phase_member_items();
|
bool _phase_member_items();
|
||||||
bool _phase_select_match();
|
bool _phase_select_match();
|
||||||
|
|
||||||
bool _match_string(const String &p_term, const String &p_string) const;
|
bool _match_string(const String &p_term, const String &p_string) const;
|
||||||
bool _match_visual_script(DocData::ClassDoc &class_doc);
|
bool _match_visual_script(DocData::ClassDoc &class_doc);
|
||||||
bool _match_is_hidden(DocData::ClassDoc &class_doc);
|
bool _match_is_hidden(DocData::ClassDoc &class_doc);
|
||||||
void _match_item(TreeItem *p_item, const String &p_text);
|
void _match_item(TreeItem *p_item, const String &p_text);
|
||||||
void _add_class_doc(String class_name, String inherits, String category);
|
void _add_class_doc(String class_name, String inherits, String category);
|
||||||
DocData::MethodDoc _get_method_doc(MethodInfo method_info);
|
DocData::MethodDoc _get_method_doc(MethodInfo method_info);
|
||||||
TreeItem *_create_class_hierarchy(const ClassMatch &p_match);
|
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_class_item(TreeItem *p_parent,
|
||||||
TreeItem *_create_method_item(TreeItem *p_parent, const DocData::ClassDoc *p_class_doc, const String &p_text, const DocData::MethodDoc *p_doc);
|
const DocData::ClassDoc *p_doc, bool p_gray);
|
||||||
TreeItem *_create_signal_item(TreeItem *p_parent, const DocData::ClassDoc *p_class_doc, const DocData::MethodDoc *p_doc);
|
TreeItem *_create_method_item(TreeItem *p_parent,
|
||||||
TreeItem *_create_constant_item(TreeItem *p_parent, const DocData::ClassDoc *p_class_doc, const DocData::ConstantDoc *p_doc);
|
const DocData::ClassDoc *p_class_doc,
|
||||||
TreeItem *_create_property_item(TreeItem *p_parent, const DocData::ClassDoc *p_class_doc, const DocData::PropertyDoc *p_doc);
|
const String &p_text,
|
||||||
TreeItem *_create_theme_property_item(TreeItem *p_parent, const DocData::ClassDoc *p_class_doc, const DocData::ThemeItemDoc *p_doc);
|
const DocData::MethodDoc *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);
|
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:
|
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
|
#endif // VISUAL_SCRIPT_PROPERTY_SELECTOR_H
|
||||||
|
|||||||
Reference in New Issue
Block a user