Commit graph

85 commits

Author SHA1 Message Date
qarmin 072e40368e Fix always true/false values 2019-06-20 16:59:48 +02:00
Rémi Verschelde e3735a5d5a
Merge pull request #28606 from bojidar-bg/25889-indexed-set-defaults
Fix default values not being read correctly in VS, take two
2019-05-28 10:54:49 +02:00
Leonard Meagher f7eb426e2e Allow overriding how scripted objects are converted to strings
solves #26796

- ADD `String to_string()` method to Object which can be overriden by `String _to_string()` in scripts
- ADD `String to_string(r_valid)` method to ScriptInstance to allow langauges to control how scripted objects are converted to strings
- IMPLEMENT to_string for GDScriptInstance, VisualScriptInstance, and NativeScriptInstance
- ADD Documentation about `Object.to_string` and `Object._to_string`
- Changed `Variant::operator String` to use `obj->to_string()`
2019-05-03 15:06:05 -07:00
Bojidar Marinov b291cfde1b
Fix default values not being read correctly in VS, take two
Fixes #25889.
2019-05-02 20:57:00 +03:00
Bojidar Marinov 4b3db1de3d
Fix default values not being read correctly in VisualScript
Fixes #25889
2019-03-04 20:41:50 +02:00
marxin 8d51618949 Add -Wshadow=local to warnings and fix reported issues.
Fixes #25316.
2019-02-20 19:44:12 +01:00
Rémi Verschelde b16c309f82 Update copyright statements to 2019
Happy new year to the wonderful Godot community!
2019-01-01 12:58:10 +01:00
Juan Linietsky 3a93499f89 Allow signal connecting even if script is invalid (only when compiled with tools), fixes #17070 2018-11-27 19:55:37 -03:00
Rémi Verschelde 1169196f04
Merge pull request #22779 from Superwaitsum/LimitSettings
Limit several project settings
2018-10-25 11:38:06 +02:00
Superwaitsum e5041ad0f5 Add some limits on the Editor Settings 2018-10-24 19:46:33 -05:00
the 8th mage d3fc5e6c89 Fixed the problem with vector3 constructor
Whenever there's a port change that may change the inputs, the default inputs will be recalculated.

Moving the update port loop into its own function.

Signed-off-by: K. S. Ernest (iFire) Lee <ernest.lee@chibifire.com>
2018-10-11 12:21:05 -07:00
Rémi Verschelde 277b24dfb7 Make core/ includes absolute, remove subfolders from include path
This allows more consistency in the manner we include core headers,
where previously there would be a mix of absolute, relative and
include path-dependent includes.
2018-09-12 09:52:22 +02:00
George Marques eb48119821
Added system for GDScript warnings
- Count and panel per script.
- Ability to disable warnings per script using special comments.
- Ability to disable warnings globally using Project Settings.
- Option to treat enabled warnings as errors.
2018-08-10 16:00:47 -03:00
Hein-Pieter van Braam 0e29f7974b Reduce unnecessary COW on Vector by make writing explicit
This commit makes operator[] on Vector const and adds a write proxy to it.  From
now on writes to Vectors need to happen through the .write proxy. So for
instance:

Vector<int> vec;
vec.push_back(10);
std::cout << vec[0] << std::endl;
vec.write[0] = 20;

Failing to use the .write proxy will cause a compilation error.

In addition COWable datatypes can now embed a CowData pointer to their data.
This means that String, CharString, and VMap no longer use or derive from
Vector.

_ALWAYS_INLINE_ and _FORCE_INLINE_ are now equivalent for debug and non-debug
builds. This is a lot faster for Vector in the editor and while running tests.
The reason why this difference used to exist is because force-inlined methods
used to give a bad debugging experience. After extensive testing with modern
compilers this is no longer the case.
2018-07-26 00:54:16 +02:00
K. S. Ernest (iFire) Lee 85670726fd Improve VisualScript UX
* Prototype faster function call ux.
* Work on general search ux.
* Able to create nodes from search.
* Show class for variables but not methods.
* Get actions search working.
* Descriptions now show for both methods and properties.
* Enable zooming on mouse wheel up and down.
* Make the drag trigger on right mouse button.
* Search now shows for action visual script nodes.
* Able to search visual node names.
* Search works better.
* Change zooming scale to hide artifacts better.
* Remove zoom changes
* Select from base should check properties too like the other functions.
* Seq_connect flag is needed to set sequence lines correctly.
* Remove comment
* Code cleanup with function names and arguments.
* Use brief description for search descriptions.
* Clean and fix bug with input nodes connecting with sequence lines.
* Add a warning and fix some edge conditions with sequence into data lines and vice versa.
* Don't search functions when pulling from a sequence node.
* Don't show actions when pulling from a data line.
* Set set and get properties.
* Convert visual script operators to the correct type
* Create a function preset finds only functions.
* Singletons can now find functions.
* Add shift-a for generic search.
* Add brief descriptions for Visual Script nodes.
* Search boxes can now filter names.
* Add bigger hit zones to node connect.
* For the drop zones, make all the rect2 areas the same size.
* Function names in visual script node should be lower case so that search works better.
* Use the convention of capitalize() for set, set, visual script nodes and methods.
* Make search more general. Ignore "_" and make case-insensitive. Also made the search window smaller and remove extra info from search
* Make type_cast use the connecting node's type and remove use of found variable.
* Fix case where you call an instance's call function where it becomes an invalid call.
* Make get_visual_node_names use a set of filters, move action creations and fix bug with sequence node connections.
* Make the window bigger.
* Make connect_data and connect_seq more robust.
* Add icons to search items.
* Add vs constructors in shift-a menu.
* Operators, builtins and constructors show type name. Fix several problems with port connections.
* In shift-a mode search everything.
* Code cleanup
* Work on autocompleting the type.
  * Use type guess in action creation.
  * Check if type hint string exists in object variables when generating the visual script search.
  * Add the hint to SceneTree.
  * Add original type detection.
  * Make type casting great again. This puts the type casted base type as the data output type string hint.
  * Pass the type in a VisualScriptFunctionCall too.
  * Set the base type correctly in VisualScriptFunctionGet and VisualScriptFunctionSet using hint string.
  * Make sure the instance is passed in VisualScriptPropertySet.
  * Restore search on the node's type.
* Remove dependencies from graph_edit.
* Remove dependencies from property_selector and name the class visual_script_property_selector.
* Extract hot zones into a function.
* Move hot_zones constants into default theme.
* Bigger capture zones.
* Clean messy port_grab_distance variables.
* Remove RMB functionality.
* Remove memory leak on showing visual script descriptions.
* Read the port_grab_distance constants on enter tree and theme changed.
2018-07-24 13:59:28 -07:00
George Marques 03746da73f
Add editor highlight for type-safe lines
The line number is hightlighted to indicate that the line contains only
type-safe code.
2018-07-20 21:55:18 -03:00
Fabio Alessandrelli 1400f6fdc4 Refactor RPCMode enum and checks 2018-05-29 20:26:41 +02:00
Max Hilbrunner 4c69a495c9
Revert "RPCMode refactor, more sync modes" 2018-05-29 11:47:52 +02:00
Max Hilbrunner d0b62ce155
Merge pull request #19021 from Faless/rpc_sync_fix
RPCMode refactor, more sync modes
2018-05-29 09:44:03 +02:00
Max Hilbrunner 2fca33ac7b
Merge pull request #18516 from PJB3005/18-04-30-visual-script-title-bars
Move things into the title bars of Visual Script nodes.
2018-05-26 18:06:58 +02:00
Fabio Alessandrelli 9de4ffde61 Refactor RPCMode enum and checks 2018-05-26 10:43:43 +02:00
Pieter-Jan Briers 8d9d847a1a Move things into the title bars of Visual Script nodes.
This is an attempt to make VS slightly nicer to use.

WiP.
2018-04-30 01:28:31 +02:00
Rémi Verschelde bf7ca623a6 Fix Coverity reports of uninitialized scalar variable
Fixes most current reports on Coverity Scan of uninitialized scalar
variable (CWE-457): https://cwe.mitre.org/data/definitions/457.html

These happen most of the time (in our code) when instanciating structs
without a constructor (or with an incomplete one), and later returning
the instance. This is sometimes intended though, as some parameters are
only used in some situations and should not be double-initialized for
performance reasons (e.g. `constant` in ShaderLanguage::Token).
2018-04-19 15:20:45 +02:00
luz.paz 612ab4bbc6 Fix typos with codespell
Found via `codespell -q 3 --skip="./thirdparty,./editor/translations" -I ../godot-word-whitelist.txt`
Whitelist consists of:
```
ang
doubleclick
lod
nd
que
te
unselect
```
2018-02-21 19:46:06 +01:00
Bojidar Marinov 9b8e8b2220
Bind many more properties to scripts
Notable potentially breaking changes:
- PROPERTY_USAGE_NOEDITOR is now PROPERTY_USAGE_STORAGE | PROPERTY_USAGE_NETWORK, without PROPERTY_USAGE_INTERNAL
- Some properties were renamed, and sometimes even shadowed by new ones
- New getter methods (some virtual) were added
2018-01-12 00:58:14 +02:00
Rémi Verschelde e4213e66b2 Add missing copyright headers and fix formatting
Using `misc/scripts/fix_headers.py` on all Godot files.
Some missing header guards were added, and the header inclusion order
was fixed in the Bullet module.
2018-01-05 01:22:23 +01:00
Rémi Verschelde b50a9114b1 Update copyright statements to 2018
Happy new year to the wonderful Godot community!
2018-01-01 14:40:47 +01:00
Pedro J. Estébanez c68300b88d Fix function arg count not considered in VisualScript 2017-12-07 02:19:56 +01:00
Matthias Hoelzl c825a58fe0 Connect signal for VisualScript "Yield Signal" using oneshot mode
Since the first call to a VisualScriptFunctionState invalidates the
state, any further call results in errors.
2017-12-01 04:44:47 +01:00
Juan Linietsky bc2e8d99e5 Made Vector::ptrw explicit for writing, compiler was sometimes using the wrong function,
leading to unnecesary copy on writes and reduced performance.
2017-11-25 00:09:40 -03:00
George Marques 0284727e7b
Create API to add and remove VisualScript custom nodes
This makes a VisualScriptEditor singleton, which gives plugins the
ability to register their own custom nodes. Those will be available for
insertion in the Visual Script editor, under the "Custom Nodes"
category.
2017-11-15 17:13:13 -02:00
Jerome67000 2609cc9ef4 Removes Script::get_node_type()
used before GDScript, with squirrel apparently
2017-10-25 20:11:30 +02:00
Ignacio Etcheverry e218a13a64 Add ScriptLanguage::supports_builtin_mode and improve ScriptCreateDialog
- Make ScriptCreateDialog disable the built-in script checked button if the language does not support it.
- ScriptLanguage's get_template and make_template now receive the script path as class name if the the script language does not have named classes.
2017-10-24 15:48:58 +02:00
Nathan Lovato cc40784728 Merge pull request #11653 from bojidar-bg/doc-vscript-1
[DOCS] Document some of the VisualScript classes
2017-10-03 11:58:06 +02:00
Bojidar Marinov 10469c1962
Document some of the VisualScript classes. 2017-10-03 12:01:53 +03:00
AndreaCatania 4537977d6d Renamed fixed_process to physics_process 2017-09-30 16:19:07 +02:00
letheed 5ad9be4c24 Rename pos to position in user facing methods and variables
Rename user facing methods and variables as well as the corresponding
C++ methods according to the folloming changes:

* pos -> position
* rot -> rotation
* loc -> location

C++ variables are left as is.
2017-09-20 13:11:10 +02:00
Rémi Verschelde bd282ff43f Use HTTPS URL for Godot's website in the headers 2017-08-27 14:16:55 +02:00
Hein-Pieter van Braam cacced7e50 Convert Object::cast_to() to the static version
Currently we rely on some undefined behavior when Object->cast_to() gets
called with a Null pointer. This used to work fine with GCC < 6 but
newer versions of GCC remove all codepaths in which the this pointer is
Null. However, the non-static cast_to() was supposed to be null safe.

This patch makes cast_to() Null safe and removes the now redundant Null
checks where they existed.

It is explained in this article: https://www.viva64.com/en/b/0226/
2017-08-24 23:08:24 +02:00
Juan Linietsky 541fdffc0a Merge pull request #10319 from neikeq/pr-engine-editor-hint
Adds Engine::is_editor_hint() method
2017-08-20 12:55:46 -03:00
Bojidar Marinov 4a0b4417a3
Fix #6583, Condition + Wait nodes freezing the game
Make sure that only the first node after VS resume gets resumed
2017-08-19 17:54:32 +03:00
Ignacio Etcheverry 90b8a5b71e Removes editor_hint from SceneTree 2017-08-19 01:29:45 +02:00
Ignacio Etcheverry 2f290038d6 Removes type information from method binds 2017-08-10 07:17:50 +02:00
Juan Linietsky 8a4bce6ebd Ability to set a function as sequenced, so when called you can choose not to use sequence ports. Fixes #6346 2017-08-08 13:14:36 -03:00
Indah Sylvia 5ae78fdf6a Makes all Godot API's methods Lower Case 2017-08-07 18:24:35 +07:00
Poommetee Ketson 2777f81d29 Add object type hint for docs 2017-07-23 18:57:03 +07:00
Juan Linietsky 25678b1876 -Renamed GlobalConfig to ProjectSettings, makes more sense.
-Added system for feature overrides, it's pretty cool :)
2017-07-19 17:06:03 -03:00
Juan Linietsky bbada82f80 -Reorganized all properties of project settings (Sorry, Again).
(Lot's of bloat accumulated, so it was time for clean up.)
-Made EditorSettings and ProjectSettings search more useful (search in sections too)
2017-07-17 22:18:58 -03:00
Juan Linietsky 2a3e00c8c7 -Many fixes to VisualScript, fixed property names, etc.
-Added ability to set/get a field in GetSet, as well as assignment ops
-Added a Select node
-Fixed update bugs related to variable list and exported properties, closes #9458
2017-06-30 21:35:05 -03:00
Andreas Haas 8361b1ce07 Add ability to use custom script templates.
Templates will be loaded from .godot/script_templates
For now they're disabled for GDNative.

Ideas for further improvements:

- Add a "Save as Template" option to the script editor, as it can normally only save to res://
- Support more placeholders / custom placeholders
2017-06-13 20:03:08 +00:00