Fix enums bindings

Add missed bindings for enums
Move some enums to class to have correct output of api.json
This commit is contained in:
Maxim Sheronov 2017-09-12 22:09:06 +03:00
parent 69017974be
commit 0fffa45158
62 changed files with 412 additions and 210 deletions

View File

@ -440,7 +440,7 @@ bool _OS::is_vsync_enabled() const {
return OS::get_singleton()->is_vsync_enabled(); return OS::get_singleton()->is_vsync_enabled();
} }
PowerState _OS::get_power_state() { OS::PowerState _OS::get_power_state() {
return OS::get_singleton()->get_power_state(); return OS::get_singleton()->get_power_state();
} }
@ -1142,11 +1142,11 @@ void _OS::_bind_methods() {
BIND_ENUM_CONSTANT(SYSTEM_DIR_PICTURES); BIND_ENUM_CONSTANT(SYSTEM_DIR_PICTURES);
BIND_ENUM_CONSTANT(SYSTEM_DIR_RINGTONES); BIND_ENUM_CONSTANT(SYSTEM_DIR_RINGTONES);
BIND_ENUM_CONSTANT(POWERSTATE_UNKNOWN); BIND_ENUM_CONSTANT(OS::POWERSTATE_UNKNOWN);
BIND_ENUM_CONSTANT(POWERSTATE_ON_BATTERY); BIND_ENUM_CONSTANT(OS::POWERSTATE_ON_BATTERY);
BIND_ENUM_CONSTANT(POWERSTATE_NO_BATTERY); BIND_ENUM_CONSTANT(OS::POWERSTATE_NO_BATTERY);
BIND_ENUM_CONSTANT(POWERSTATE_CHARGING); BIND_ENUM_CONSTANT(OS::POWERSTATE_CHARGING);
BIND_ENUM_CONSTANT(POWERSTATE_CHARGED); BIND_ENUM_CONSTANT(OS::POWERSTATE_CHARGED);
} }
_OS::_OS() { _OS::_OS() {

View File

@ -36,7 +36,7 @@
#include "io/resource_saver.h" #include "io/resource_saver.h"
#include "os/dir_access.h" #include "os/dir_access.h"
#include "os/file_access.h" #include "os/file_access.h"
#include "os/power.h" #include "os/os.h"
#include "os/semaphore.h" #include "os/semaphore.h"
#include "os/thread.h" #include "os/thread.h"
@ -303,7 +303,7 @@ public:
void set_use_vsync(bool p_enable); void set_use_vsync(bool p_enable);
bool is_vsync_enabled() const; bool is_vsync_enabled() const;
PowerState get_power_state(); OS::PowerState get_power_state();
int get_power_seconds_left(); int get_power_seconds_left();
int get_power_percent_left(); int get_power_percent_left();

View File

@ -485,7 +485,7 @@ bool OS::is_vsync_enabled() const {
return true; return true;
} }
PowerState OS::get_power_state() { OS::PowerState OS::get_power_state() {
return POWERSTATE_UNKNOWN; return POWERSTATE_UNKNOWN;
} }
int OS::get_power_seconds_left() { int OS::get_power_seconds_left() {

View File

@ -34,7 +34,6 @@
#include "image.h" #include "image.h"
#include "list.h" #include "list.h"
#include "os/main_loop.h" #include "os/main_loop.h"
#include "power.h"
#include "ustring.h" #include "ustring.h"
#include "vector.h" #include "vector.h"
#include <stdarg.h> #include <stdarg.h>
@ -65,6 +64,14 @@ class OS {
public: public:
typedef void (*ImeCallback)(void *p_inp, String p_text, Point2 p_selection); typedef void (*ImeCallback)(void *p_inp, String p_text, Point2 p_selection);
enum PowerState {
POWERSTATE_UNKNOWN, /**< cannot determine power status */
POWERSTATE_ON_BATTERY, /**< Not plugged in, running on the battery */
POWERSTATE_NO_BATTERY, /**< Plugged in, no battery available */
POWERSTATE_CHARGING, /**< Plugged in, charging battery */
POWERSTATE_CHARGED /**< Plugged in, battery charged */
};
enum RenderThreadMode { enum RenderThreadMode {
RENDER_THREAD_UNSAFE, RENDER_THREAD_UNSAFE,
@ -410,7 +417,7 @@ public:
virtual void set_use_vsync(bool p_enable); virtual void set_use_vsync(bool p_enable);
virtual bool is_vsync_enabled() const; virtual bool is_vsync_enabled() const;
virtual PowerState get_power_state(); virtual OS::PowerState get_power_state();
virtual int get_power_seconds_left(); virtual int get_power_seconds_left();
virtual int get_power_percent_left(); virtual int get_power_percent_left();
@ -428,6 +435,6 @@ public:
virtual ~OS(); virtual ~OS();
}; };
VARIANT_ENUM_CAST(PowerState); VARIANT_ENUM_CAST(OS::PowerState);
#endif #endif

View File

@ -1,42 +0,0 @@
/*************************************************************************/
/* power.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 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 CORE_OS_POWER_H_
#define CORE_OS_POWER_H_
typedef enum {
POWERSTATE_UNKNOWN, /**< cannot determine power status */
POWERSTATE_ON_BATTERY, /**< Not plugged in, running on the battery */
POWERSTATE_NO_BATTERY, /**< Plugged in, no battery available */
POWERSTATE_CHARGING, /**< Plugged in, charging battery */
POWERSTATE_CHARGED /**< Plugged in, battery charged */
} PowerState;
#endif /* CORE_OS_POWER_H_ */

View File

@ -43,7 +43,6 @@
#include "math_2d.h" #include "math_2d.h"
#include "matrix3.h" #include "matrix3.h"
#include "node_path.h" #include "node_path.h"
#include "os/power.h"
#include "plane.h" #include "plane.h"
#include "quat.h" #include "quat.h"
#include "rect3.h" #include "rect3.h"

View File

@ -1214,6 +1214,9 @@ void EditorFileDialog::_bind_methods() {
BIND_ENUM_CONSTANT(ACCESS_RESOURCES); BIND_ENUM_CONSTANT(ACCESS_RESOURCES);
BIND_ENUM_CONSTANT(ACCESS_USERDATA); BIND_ENUM_CONSTANT(ACCESS_USERDATA);
BIND_ENUM_CONSTANT(ACCESS_FILESYSTEM); BIND_ENUM_CONSTANT(ACCESS_FILESYSTEM);
BIND_ENUM_CONSTANT(DISPLAY_THUMBNAILS);
BIND_ENUM_CONSTANT(DISPLAY_LIST);
} }
void EditorFileDialog::set_show_hidden_files(bool p_show) { void EditorFileDialog::set_show_hidden_files(bool p_show) {

View File

@ -1175,6 +1175,65 @@ void VisualScriptBuiltinFunc::_bind_methods() {
cc += func_name[i]; cc += func_name[i];
} }
ADD_PROPERTY(PropertyInfo(Variant::INT, "function", PROPERTY_HINT_ENUM, cc), "set_func", "get_func"); ADD_PROPERTY(PropertyInfo(Variant::INT, "function", PROPERTY_HINT_ENUM, cc), "set_func", "get_func");
BIND_ENUM_CONSTANT(MATH_SIN);
BIND_ENUM_CONSTANT(MATH_COS);
BIND_ENUM_CONSTANT(MATH_TAN);
BIND_ENUM_CONSTANT(MATH_SINH);
BIND_ENUM_CONSTANT(MATH_COSH);
BIND_ENUM_CONSTANT(MATH_TANH);
BIND_ENUM_CONSTANT(MATH_ASIN);
BIND_ENUM_CONSTANT(MATH_ACOS);
BIND_ENUM_CONSTANT(MATH_ATAN);
BIND_ENUM_CONSTANT(MATH_ATAN2);
BIND_ENUM_CONSTANT(MATH_SQRT);
BIND_ENUM_CONSTANT(MATH_FMOD);
BIND_ENUM_CONSTANT(MATH_FPOSMOD);
BIND_ENUM_CONSTANT(MATH_FLOOR);
BIND_ENUM_CONSTANT(MATH_CEIL);
BIND_ENUM_CONSTANT(MATH_ROUND);
BIND_ENUM_CONSTANT(MATH_ABS);
BIND_ENUM_CONSTANT(MATH_SIGN);
BIND_ENUM_CONSTANT(MATH_POW);
BIND_ENUM_CONSTANT(MATH_LOG);
BIND_ENUM_CONSTANT(MATH_EXP);
BIND_ENUM_CONSTANT(MATH_ISNAN);
BIND_ENUM_CONSTANT(MATH_ISINF);
BIND_ENUM_CONSTANT(MATH_EASE);
BIND_ENUM_CONSTANT(MATH_DECIMALS);
BIND_ENUM_CONSTANT(MATH_STEPIFY);
BIND_ENUM_CONSTANT(MATH_LERP);
BIND_ENUM_CONSTANT(MATH_DECTIME);
BIND_ENUM_CONSTANT(MATH_RANDOMIZE);
BIND_ENUM_CONSTANT(MATH_RAND);
BIND_ENUM_CONSTANT(MATH_RANDF);
BIND_ENUM_CONSTANT(MATH_RANDOM);
BIND_ENUM_CONSTANT(MATH_SEED);
BIND_ENUM_CONSTANT(MATH_RANDSEED);
BIND_ENUM_CONSTANT(MATH_DEG2RAD);
BIND_ENUM_CONSTANT(MATH_RAD2DEG);
BIND_ENUM_CONSTANT(MATH_LINEAR2DB);
BIND_ENUM_CONSTANT(MATH_DB2LINEAR);
BIND_ENUM_CONSTANT(LOGIC_MAX);
BIND_ENUM_CONSTANT(LOGIC_MIN);
BIND_ENUM_CONSTANT(LOGIC_CLAMP);
BIND_ENUM_CONSTANT(LOGIC_NEAREST_PO2);
BIND_ENUM_CONSTANT(OBJ_WEAKREF);
BIND_ENUM_CONSTANT(FUNC_FUNCREF);
BIND_ENUM_CONSTANT(TYPE_CONVERT);
BIND_ENUM_CONSTANT(TYPE_OF);
BIND_ENUM_CONSTANT(TYPE_EXISTS);
BIND_ENUM_CONSTANT(TEXT_CHAR);
BIND_ENUM_CONSTANT(TEXT_STR);
BIND_ENUM_CONSTANT(TEXT_PRINT);
BIND_ENUM_CONSTANT(TEXT_PRINTERR);
BIND_ENUM_CONSTANT(TEXT_PRINTRAW);
BIND_ENUM_CONSTANT(VAR_TO_STR);
BIND_ENUM_CONSTANT(STR_TO_VAR);
BIND_ENUM_CONSTANT(VAR_TO_BYTES);
BIND_ENUM_CONSTANT(BYTES_TO_VAR);
BIND_ENUM_CONSTANT(COLORN);
BIND_ENUM_CONSTANT(FUNC_MAX);
} }
VisualScriptBuiltinFunc::VisualScriptBuiltinFunc() { VisualScriptBuiltinFunc::VisualScriptBuiltinFunc() {

View File

@ -748,6 +748,13 @@ void VisualScriptFunctionCall::_bind_methods() {
BIND_ENUM_CONSTANT(CALL_MODE_NODE_PATH); BIND_ENUM_CONSTANT(CALL_MODE_NODE_PATH);
BIND_ENUM_CONSTANT(CALL_MODE_INSTANCE); BIND_ENUM_CONSTANT(CALL_MODE_INSTANCE);
BIND_ENUM_CONSTANT(CALL_MODE_BASIC_TYPE); BIND_ENUM_CONSTANT(CALL_MODE_BASIC_TYPE);
BIND_ENUM_CONSTANT(CALL_MODE_SINGLETON);
BIND_ENUM_CONSTANT(RPC_DISABLED);
BIND_ENUM_CONSTANT(RPC_RELIABLE);
BIND_ENUM_CONSTANT(RPC_UNRELIABLE);
BIND_ENUM_CONSTANT(RPC_RELIABLE_TO_ID);
BIND_ENUM_CONSTANT(RPC_UNRELIABLE_TO_ID);
} }
class VisualScriptNodeInstanceFunctionCall : public VisualScriptNodeInstance { class VisualScriptNodeInstanceFunctionCall : public VisualScriptNodeInstance {
@ -1487,6 +1494,19 @@ void VisualScriptPropertySet::_bind_methods() {
BIND_ENUM_CONSTANT(CALL_MODE_SELF); BIND_ENUM_CONSTANT(CALL_MODE_SELF);
BIND_ENUM_CONSTANT(CALL_MODE_NODE_PATH); BIND_ENUM_CONSTANT(CALL_MODE_NODE_PATH);
BIND_ENUM_CONSTANT(CALL_MODE_INSTANCE); BIND_ENUM_CONSTANT(CALL_MODE_INSTANCE);
BIND_ENUM_CONSTANT(CALL_MODE_BASIC_TYPE);
BIND_ENUM_CONSTANT(ASSIGN_OP_NONE);
BIND_ENUM_CONSTANT(ASSIGN_OP_ADD);
BIND_ENUM_CONSTANT(ASSIGN_OP_SUB);
BIND_ENUM_CONSTANT(ASSIGN_OP_MUL);
BIND_ENUM_CONSTANT(ASSIGN_OP_DIV);
BIND_ENUM_CONSTANT(ASSIGN_OP_MOD);
BIND_ENUM_CONSTANT(ASSIGN_OP_SHIFT_LEFT);
BIND_ENUM_CONSTANT(ASSIGN_OP_SHIFT_RIGHT);
BIND_ENUM_CONSTANT(ASSIGN_OP_BIT_AND);
BIND_ENUM_CONSTANT(ASSIGN_OP_BIT_OR);
BIND_ENUM_CONSTANT(ASSIGN_OP_BIT_XOR);
} }
class VisualScriptNodeInstancePropertySet : public VisualScriptNodeInstance { class VisualScriptNodeInstancePropertySet : public VisualScriptNodeInstance {

View File

@ -1882,6 +1882,16 @@ void VisualScriptMathConstant::_bind_methods() {
cc += const_name[i]; cc += const_name[i];
} }
ADD_PROPERTY(PropertyInfo(Variant::INT, "constant", PROPERTY_HINT_ENUM, cc), "set_math_constant", "get_math_constant"); ADD_PROPERTY(PropertyInfo(Variant::INT, "constant", PROPERTY_HINT_ENUM, cc), "set_math_constant", "get_math_constant");
BIND_ENUM_CONSTANT(MATH_CONSTANT_ONE);
BIND_ENUM_CONSTANT(MATH_CONSTANT_PI);
BIND_ENUM_CONSTANT(MATH_CONSTANT_2PI);
BIND_ENUM_CONSTANT(MATH_CONSTANT_HALF_PI);
BIND_ENUM_CONSTANT(MATH_CONSTANT_E);
BIND_ENUM_CONSTANT(MATH_CONSTANT_SQRT2);
BIND_ENUM_CONSTANT(MATH_CONSTANT_INF);
BIND_ENUM_CONSTANT(MATH_CONSTANT_NAN);
BIND_ENUM_CONSTANT(MATH_CONSTANT_MAX);
} }
VisualScriptMathConstant::VisualScriptMathConstant() { VisualScriptMathConstant::VisualScriptMathConstant() {
@ -3535,6 +3545,11 @@ void VisualScriptInputAction::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::STRING, "action"), "set_action_name", "get_action_name"); ADD_PROPERTY(PropertyInfo(Variant::STRING, "action"), "set_action_name", "get_action_name");
ADD_PROPERTY(PropertyInfo(Variant::INT, "mode", PROPERTY_HINT_ENUM, "Pressed,Released,JustPressed,JustReleased"), "set_action_mode", "get_action_mode"); ADD_PROPERTY(PropertyInfo(Variant::INT, "mode", PROPERTY_HINT_ENUM, "Pressed,Released,JustPressed,JustReleased"), "set_action_mode", "get_action_mode");
BIND_ENUM_CONSTANT(MODE_PRESSED);
BIND_ENUM_CONSTANT(MODE_RELEASED);
BIND_ENUM_CONSTANT(MODE_JUST_PRESSED);
BIND_ENUM_CONSTANT(MODE_JUST_RELEASED);
} }
VisualScriptInputAction::VisualScriptInputAction() { VisualScriptInputAction::VisualScriptInputAction() {

View File

@ -198,19 +198,19 @@ bool power_android::GetPowerInfo_Android() {
if (Android_JNI_GetPowerInfo(&plugged, &charged, &battery, &this->nsecs_left, &this->percent_left) != -1) { if (Android_JNI_GetPowerInfo(&plugged, &charged, &battery, &this->nsecs_left, &this->percent_left) != -1) {
if (plugged) { if (plugged) {
if (charged) { if (charged) {
this->power_state = POWERSTATE_CHARGED; this->power_state = OS::POWERSTATE_CHARGED;
} else if (battery) { } else if (battery) {
this->power_state = POWERSTATE_CHARGING; this->power_state = OS::POWERSTATE_CHARGING;
} else { } else {
this->power_state = POWERSTATE_NO_BATTERY; this->power_state = OS::POWERSTATE_NO_BATTERY;
this->nsecs_left = -1; this->nsecs_left = -1;
this->percent_left = -1; this->percent_left = -1;
} }
} else { } else {
this->power_state = POWERSTATE_ON_BATTERY; this->power_state = OS::POWERSTATE_ON_BATTERY;
} }
} else { } else {
this->power_state = POWERSTATE_UNKNOWN; this->power_state = OS::POWERSTATE_UNKNOWN;
this->nsecs_left = -1; this->nsecs_left = -1;
this->percent_left = -1; this->percent_left = -1;
} }
@ -218,12 +218,12 @@ bool power_android::GetPowerInfo_Android() {
return true; return true;
} }
PowerState power_android::get_power_state() { OS::PowerState power_android::get_power_state() {
if (GetPowerInfo_Android()) { if (GetPowerInfo_Android()) {
return power_state; return power_state;
} else { } else {
WARN_PRINT("Power management is not implemented on this platform, defaulting to POWERSTATE_UNKNOWN"); WARN_PRINT("Power management is not implemented on this platform, defaulting to POWERSTATE_UNKNOWN");
return POWERSTATE_UNKNOWN; return OS::POWERSTATE_UNKNOWN;
} }
} }
@ -246,7 +246,7 @@ int power_android::get_power_percent_left() {
} }
power_android::power_android() power_android::power_android()
: nsecs_left(-1), percent_left(-1), power_state(POWERSTATE_UNKNOWN) { : nsecs_left(-1), percent_left(-1), power_state(OS::POWERSTATE_UNKNOWN) {
} }
power_android::~power_android() { power_android::~power_android() {

View File

@ -31,7 +31,7 @@
#ifndef PLATFORM_ANDROID_POWER_ANDROID_H_ #ifndef PLATFORM_ANDROID_POWER_ANDROID_H_
#define PLATFORM_ANDROID_POWER_ANDROID_H_ #define PLATFORM_ANDROID_POWER_ANDROID_H_
#include "os/power.h" #include "os/os.h"
#include <android/native_window_jni.h> #include <android/native_window_jni.h>
class power_android { class power_android {
@ -57,7 +57,7 @@ private:
int nsecs_left; int nsecs_left;
int percent_left; int percent_left;
PowerState power_state; OS::PowerState power_state;
bool GetPowerInfo_Android(); bool GetPowerInfo_Android();
bool UpdatePowerInfo(); bool UpdatePowerInfo();
@ -71,7 +71,7 @@ public:
static struct LocalReferenceHolder LocalReferenceHolder_Setup(const char *func); static struct LocalReferenceHolder LocalReferenceHolder_Setup(const char *func);
static void LocalReferenceHolder_Cleanup(struct LocalReferenceHolder *refholder); static void LocalReferenceHolder_Cleanup(struct LocalReferenceHolder *refholder);
PowerState get_power_state(); OS::PowerState get_power_state();
int get_power_seconds_left(); int get_power_seconds_left();
int get_power_percent_left(); int get_power_percent_left();
}; };

View File

@ -117,7 +117,7 @@ public:
virtual void get_fullscreen_mode_list(List<VideoMode> *p_list, int p_screen = 0) const; virtual void get_fullscreen_mode_list(List<VideoMode> *p_list, int p_screen = 0) const;
virtual String get_executable_path() const; virtual String get_executable_path() const;
virtual PowerState get_power_state(); virtual OS::PowerState get_power_state();
virtual int get_power_seconds_left(); virtual int get_power_seconds_left();
virtual int get_power_percent_left(); virtual int get_power_percent_left();

View File

@ -37,12 +37,12 @@ bool PowerHaiku::UpdatePowerInfo() {
return false; return false;
} }
PowerState PowerHaiku::get_power_state() { OS::PowerState PowerHaiku::get_power_state() {
if (UpdatePowerInfo()) { if (UpdatePowerInfo()) {
return power_state; return power_state;
} else { } else {
WARN_PRINT("Power management is not implemented on this platform, defaulting to POWERSTATE_UNKNOWN"); WARN_PRINT("Power management is not implemented on this platform, defaulting to POWERSTATE_UNKNOWN");
return POWERSTATE_UNKNOWN; return OS::POWERSTATE_UNKNOWN;
} }
} }
@ -65,7 +65,7 @@ int PowerX11::get_power_percent_left() {
} }
PowerHaiku::PowerHaiku() PowerHaiku::PowerHaiku()
: nsecs_left(-1), percent_left(-1), power_state(POWERSTATE_UNKNOWN) { : nsecs_left(-1), percent_left(-1), power_state(OS::POWERSTATE_UNKNOWN) {
} }
PowerHaiku::~PowerHaiku() { PowerHaiku::~PowerHaiku() {

View File

@ -31,11 +31,13 @@
#ifndef PLATFORM_HAIKU_POWER_HAIKU_H_ #ifndef PLATFORM_HAIKU_POWER_HAIKU_H_
#define PLATFORM_HAIKU_POWER_HAIKU_H_ #define PLATFORM_HAIKU_POWER_HAIKU_H_
#include <os/os.h>
class PowerHaiku { class PowerHaiku {
private: private:
int nsecs_left; int nsecs_left;
int percent_left; int percent_left;
PowerState power_state; OS::PowerState power_state;
bool UpdatePowerInfo(); bool UpdatePowerInfo();
@ -43,7 +45,7 @@ public:
PowerHaiku(); PowerHaiku();
virtual ~PowerHaiku(); virtual ~PowerHaiku();
PowerState get_power_state(); OS::PowerState get_power_state();
int get_power_seconds_left(); int get_power_seconds_left();
int get_power_percent_left(); int get_power_percent_left();
}; };

View File

@ -30,15 +30,15 @@
#include "power_iphone.h" #include "power_iphone.h"
bool PowerState::UpdatePowerInfo() { bool OS::PowerState::UpdatePowerInfo() {
return false; return false;
} }
PowerState PowerIphone::get_power_state() { OS::PowerState PowerIphone::get_power_state() {
if (UpdatePowerInfo()) { if (UpdatePowerInfo()) {
return power_state; return power_state;
} else { } else {
return POWERSTATE_UNKNOWN; return OS::POWERSTATE_UNKNOWN;
} }
} }
@ -59,7 +59,7 @@ int PowerIphone::get_power_percent_left() {
} }
PowerIphone::PowerIphone() PowerIphone::PowerIphone()
: nsecs_left(-1), percent_left(-1), power_state(POWERSTATE_UNKNOWN) { : nsecs_left(-1), percent_left(-1), power_state(OS::POWERSTATE_UNKNOWN) {
// TODO Auto-generated constructor stub // TODO Auto-generated constructor stub
} }

View File

@ -31,11 +31,13 @@
#ifndef PLATFORM_IPHONE_POWER_IPHONE_H_ #ifndef PLATFORM_IPHONE_POWER_IPHONE_H_
#define PLATFORM_IPHONE_POWER_IPHONE_H_ #define PLATFORM_IPHONE_POWER_IPHONE_H_
#include <os/os.h>
class PowerIphone { class PowerIphone {
private: private:
int nsecs_left; int nsecs_left;
int percent_left; int percent_left;
PowerState power_state; OS::PowerState power_state;
bool UpdatePowerInfo(); bool UpdatePowerInfo();
@ -43,7 +45,7 @@ public:
PowerIphone(); PowerIphone();
virtual ~PowerIphone(); virtual ~PowerIphone();
PowerState get_power_state(); OS::PowerState get_power_state();
int get_power_seconds_left(); int get_power_seconds_left();
int get_power_percent_left(); int get_power_percent_left();
}; };

View File

@ -976,7 +976,7 @@ String OS_JavaScript::get_joy_guid(int p_device) const {
return input->get_joy_guid_remapped(p_device); return input->get_joy_guid_remapped(p_device);
} }
PowerState OS_JavaScript::get_power_state() { OS::PowerState OS_JavaScript::get_power_state() {
return power_manager->get_power_state(); return power_manager->get_power_state();
} }

View File

@ -165,7 +165,7 @@ public:
virtual String get_joy_guid(int p_device) const; virtual String get_joy_guid(int p_device) const;
bool joy_connection_changed(int p_type, const EmscriptenGamepadEvent *p_event); bool joy_connection_changed(int p_type, const EmscriptenGamepadEvent *p_event);
virtual PowerState get_power_state(); virtual OS::PowerState get_power_state();
virtual int get_power_seconds_left(); virtual int get_power_seconds_left();
virtual int get_power_percent_left(); virtual int get_power_percent_left();

View File

@ -36,12 +36,12 @@ bool PowerJavascript::UpdatePowerInfo() {
return false; return false;
} }
PowerState PowerJavascript::get_power_state() { OS::PowerState PowerJavascript::get_power_state() {
if (UpdatePowerInfo()) { if (UpdatePowerInfo()) {
return power_state; return power_state;
} else { } else {
WARN_PRINT("Power management is not implemented on this platform, defaulting to POWERSTATE_UNKNOWN"); WARN_PRINT("Power management is not implemented on this platform, defaulting to POWERSTATE_UNKNOWN");
return POWERSTATE_UNKNOWN; return OS::POWERSTATE_UNKNOWN;
} }
} }
@ -64,7 +64,7 @@ int PowerJavascript::get_power_percent_left() {
} }
PowerJavascript::PowerJavascript() PowerJavascript::PowerJavascript()
: nsecs_left(-1), percent_left(-1), power_state(POWERSTATE_UNKNOWN) { : nsecs_left(-1), percent_left(-1), power_state(OS::POWERSTATE_UNKNOWN) {
} }
PowerJavascript::~PowerJavascript() { PowerJavascript::~PowerJavascript() {

View File

@ -31,13 +31,13 @@
#ifndef PLATFORM_JAVASCRIPT_POWER_JAVASCRIPT_H_ #ifndef PLATFORM_JAVASCRIPT_POWER_JAVASCRIPT_H_
#define PLATFORM_JAVASCRIPT_POWER_JAVASCRIPT_H_ #define PLATFORM_JAVASCRIPT_POWER_JAVASCRIPT_H_
#include "os/power.h" #include "os/os.h"
class PowerJavascript { class PowerJavascript {
private: private:
int nsecs_left; int nsecs_left;
int percent_left; int percent_left;
PowerState power_state; OS::PowerState power_state;
bool UpdatePowerInfo(); bool UpdatePowerInfo();
@ -45,7 +45,7 @@ public:
PowerJavascript(); PowerJavascript();
virtual ~PowerJavascript(); virtual ~PowerJavascript();
PowerState get_power_state(); OS::PowerState get_power_state();
int get_power_seconds_left(); int get_power_seconds_left();
int get_power_percent_left(); int get_power_percent_left();
}; };

View File

@ -212,7 +212,7 @@ public:
virtual void set_ime_position(const Point2 &p_pos); virtual void set_ime_position(const Point2 &p_pos);
virtual void set_ime_intermediate_text_callback(ImeCallback p_callback, void *p_inp); virtual void set_ime_intermediate_text_callback(ImeCallback p_callback, void *p_inp);
virtual PowerState get_power_state(); virtual OS::PowerState get_power_state();
virtual int get_power_seconds_left(); virtual int get_power_seconds_left();
virtual int get_power_percent_left(); virtual int get_power_percent_left();

View File

@ -1901,7 +1901,7 @@ String OS_OSX::get_joy_guid(int p_device) const {
return input->get_joy_guid_remapped(p_device); return input->get_joy_guid_remapped(p_device);
} }
PowerState OS_OSX::get_power_state() { OS::PowerState OS_OSX::get_power_state() {
return power_manager->get_power_state(); return power_manager->get_power_state();
} }

View File

@ -174,7 +174,7 @@ bool power_osx::GetPowerInfo_MacOSX() {
nsecs_left = -1; nsecs_left = -1;
percent_left = -1; percent_left = -1;
power_state = POWERSTATE_UNKNOWN; power_state = OS::POWERSTATE_UNKNOWN;
if (blob != NULL) { if (blob != NULL) {
CFArrayRef list = IOPSCopyPowerSourcesList(blob); CFArrayRef list = IOPSCopyPowerSourcesList(blob);
@ -194,13 +194,13 @@ bool power_osx::GetPowerInfo_MacOSX() {
} }
if (!have_battery) { if (!have_battery) {
power_state = POWERSTATE_NO_BATTERY; power_state = OS::POWERSTATE_NO_BATTERY;
} else if (charging) { } else if (charging) {
power_state = POWERSTATE_CHARGING; power_state = OS::POWERSTATE_CHARGING;
} else if (have_ac) { } else if (have_ac) {
power_state = POWERSTATE_CHARGED; power_state = OS::POWERSTATE_CHARGED;
} else { } else {
power_state = POWERSTATE_ON_BATTERY; power_state = OS::POWERSTATE_ON_BATTERY;
} }
CFRelease(list); CFRelease(list);
@ -218,11 +218,11 @@ bool power_osx::UpdatePowerInfo() {
return false; return false;
} }
PowerState power_osx::get_power_state() { OS::PowerState power_osx::get_power_state() {
if (UpdatePowerInfo()) { if (UpdatePowerInfo()) {
return power_state; return power_state;
} else { } else {
return POWERSTATE_UNKNOWN; return OS::POWERSTATE_UNKNOWN;
} }
} }
@ -243,7 +243,7 @@ int power_osx::get_power_percent_left() {
} }
power_osx::power_osx() power_osx::power_osx()
: nsecs_left(-1), percent_left(-1), power_state(POWERSTATE_UNKNOWN) { : nsecs_left(-1), percent_left(-1), power_state(OS::POWERSTATE_UNKNOWN) {
} }
power_osx::~power_osx() { power_osx::~power_osx() {

View File

@ -33,7 +33,7 @@
#include "dir_access_osx.h" #include "dir_access_osx.h"
#include "os/file_access.h" #include "os/file_access.h"
#include "os/power.h" #include "os/os.h"
#include <CoreFoundation/CoreFoundation.h> #include <CoreFoundation/CoreFoundation.h>
class power_osx { class power_osx {
@ -41,7 +41,7 @@ class power_osx {
private: private:
int nsecs_left; int nsecs_left;
int percent_left; int percent_left;
PowerState power_state; OS::PowerState power_state;
void checkps(CFDictionaryRef dict, bool *have_ac, bool *have_battery, bool *charging); void checkps(CFDictionaryRef dict, bool *have_ac, bool *have_battery, bool *charging);
bool GetPowerInfo_MacOSX(/*PowerState * state, int *seconds, int *percent*/); bool GetPowerInfo_MacOSX(/*PowerState * state, int *seconds, int *percent*/);
bool UpdatePowerInfo(); bool UpdatePowerInfo();
@ -50,7 +50,7 @@ public:
power_osx(); power_osx();
virtual ~power_osx(); virtual ~power_osx();
PowerState get_power_state(); OS::PowerState get_power_state();
int get_power_seconds_left(); int get_power_seconds_left();
int get_power_percent_left(); int get_power_percent_left();
}; };

View File

@ -200,7 +200,7 @@ void OS_Server::move_window_to_foreground() {
void OS_Server::set_cursor_shape(CursorShape p_shape) { void OS_Server::set_cursor_shape(CursorShape p_shape) {
} }
PowerState OS_Server::get_power_state() { OS::PowerState OS_Server::get_power_state() {
return power_manager->get_power_state(); return power_manager->get_power_state();
} }

View File

@ -106,7 +106,7 @@ public:
void run(); void run();
virtual PowerState get_power_state(); virtual OS::PowerState get_power_state();
virtual int get_power_seconds_left(); virtual int get_power_seconds_left();
virtual int get_power_percent_left(); virtual int get_power_percent_left();

View File

@ -855,7 +855,7 @@ bool OSUWP::_check_internal_feature_support(const String &p_feature) {
return p_feature == "pc" || p_feature == "s3tc"; return p_feature == "pc" || p_feature == "s3tc";
} }
PowerState OSUWP::get_power_state() { OS::PowerState OSUWP::get_power_state() {
return power_manager->get_power_state(); return power_manager->get_power_state();
} }

View File

@ -259,7 +259,7 @@ public:
void input_event(const Ref<InputEvent> &p_event); void input_event(const Ref<InputEvent> &p_event);
virtual PowerState get_power_state(); virtual OS::PowerState get_power_state();
virtual int get_power_seconds_left(); virtual int get_power_seconds_left();
virtual int get_power_percent_left(); virtual int get_power_percent_left();

View File

@ -31,7 +31,7 @@
#include "power_uwp.h" #include "power_uwp.h"
PowerUWP::PowerUWP() PowerUWP::PowerUWP()
: nsecs_left(-1), percent_left(-1), power_state(POWERSTATE_UNKNOWN) { : nsecs_left(-1), percent_left(-1), power_state(OS::POWERSTATE_UNKNOWN) {
} }
PowerUWP::~PowerUWP() { PowerUWP::~PowerUWP() {
@ -47,12 +47,12 @@ bool PowerUWP::UpdatePowerInfo() {
return false; return false;
} }
PowerState PowerUWP::get_power_state() { OS::PowerState PowerUWP::get_power_state() {
if (UpdatePowerInfo()) { if (UpdatePowerInfo()) {
return power_state; return power_state;
} else { } else {
WARN_PRINT("Power management is not implemented on this platform, defaulting to POWERSTATE_UNKNOWN"); WARN_PRINT("Power management is not implemented on this platform, defaulting to POWERSTATE_UNKNOWN");
return POWERSTATE_UNKNOWN; return OS::POWERSTATE_UNKNOWN;
} }
} }

View File

@ -33,14 +33,14 @@
#include "os/dir_access.h" #include "os/dir_access.h"
#include "os/file_access.h" #include "os/file_access.h"
#include "os/power.h" #include "os/os.h"
class PowerUWP { class PowerUWP {
private: private:
int nsecs_left; int nsecs_left;
int percent_left; int percent_left;
PowerState power_state; OS::PowerState power_state;
bool UpdatePowerInfo(); bool UpdatePowerInfo();
@ -48,7 +48,7 @@ public:
PowerUWP(); PowerUWP();
virtual ~PowerUWP(); virtual ~PowerUWP();
PowerState get_power_state(); OS::PowerState get_power_state();
int get_power_seconds_left(); int get_power_seconds_left();
int get_power_percent_left(); int get_power_percent_left();
}; };

View File

@ -2331,7 +2331,7 @@ bool OS_Windows::is_vsync_enabled() const {
return true; return true;
} }
PowerState OS_Windows::get_power_state() { OS::PowerState OS_Windows::get_power_state() {
return power_manager->get_power_state(); return power_manager->get_power_state();
} }

View File

@ -278,7 +278,7 @@ public:
virtual void set_use_vsync(bool p_enable); virtual void set_use_vsync(bool p_enable);
virtual bool is_vsync_enabled() const; virtual bool is_vsync_enabled() const;
virtual PowerState get_power_state(); virtual OS::PowerState get_power_state();
virtual int get_power_seconds_left(); virtual int get_power_seconds_left();
virtual int get_power_percent_left(); virtual int get_power_percent_left();

View File

@ -64,19 +64,19 @@ bool PowerWindows::GetPowerInfo_Windows() {
/* This API should exist back to Win95. */ /* This API should exist back to Win95. */
if (!GetSystemPowerStatus(&status)) { if (!GetSystemPowerStatus(&status)) {
/* !!! FIXME: push GetLastError() into GetError() */ /* !!! FIXME: push GetLastError() into GetError() */
power_state = POWERSTATE_UNKNOWN; power_state = OS::POWERSTATE_UNKNOWN;
} else if (status.BatteryFlag == 0xFF) { /* unknown state */ } else if (status.BatteryFlag == 0xFF) { /* unknown state */
power_state = POWERSTATE_UNKNOWN; power_state = OS::POWERSTATE_UNKNOWN;
} else if (status.BatteryFlag & (1 << 7)) { /* no battery */ } else if (status.BatteryFlag & (1 << 7)) { /* no battery */
power_state = POWERSTATE_NO_BATTERY; power_state = OS::POWERSTATE_NO_BATTERY;
} else if (status.BatteryFlag & (1 << 3)) { /* charging */ } else if (status.BatteryFlag & (1 << 3)) { /* charging */
power_state = POWERSTATE_CHARGING; power_state = OS::POWERSTATE_CHARGING;
need_details = TRUE; need_details = TRUE;
} else if (status.ACLineStatus == 1) { } else if (status.ACLineStatus == 1) {
power_state = POWERSTATE_CHARGED; /* on AC, not charging. */ power_state = OS::POWERSTATE_CHARGED; /* on AC, not charging. */
need_details = TRUE; need_details = TRUE;
} else { } else {
power_state = POWERSTATE_ON_BATTERY; /* not on AC. */ power_state = OS::POWERSTATE_ON_BATTERY; /* not on AC. */
need_details = TRUE; need_details = TRUE;
} }
@ -97,11 +97,11 @@ bool PowerWindows::GetPowerInfo_Windows() {
return TRUE; /* always the definitive answer on Windows. */ return TRUE; /* always the definitive answer on Windows. */
} }
PowerState PowerWindows::get_power_state() { OS::PowerState PowerWindows::get_power_state() {
if (GetPowerInfo_Windows()) { if (GetPowerInfo_Windows()) {
return power_state; return power_state;
} else { } else {
return POWERSTATE_UNKNOWN; return OS::POWERSTATE_UNKNOWN;
} }
} }
@ -122,7 +122,7 @@ int PowerWindows::get_power_percent_left() {
} }
PowerWindows::PowerWindows() PowerWindows::PowerWindows()
: nsecs_left(-1), percent_left(-1), power_state(POWERSTATE_UNKNOWN) { : nsecs_left(-1), percent_left(-1), power_state(OS::POWERSTATE_UNKNOWN) {
} }
PowerWindows::~PowerWindows() { PowerWindows::~PowerWindows() {

View File

@ -33,7 +33,7 @@
#include "os/dir_access.h" #include "os/dir_access.h"
#include "os/file_access.h" #include "os/file_access.h"
#include "os/power.h" #include "os/os.h"
#include <windows.h> #include <windows.h>
@ -42,7 +42,7 @@ class PowerWindows {
private: private:
int nsecs_left; int nsecs_left;
int percent_left; int percent_left;
PowerState power_state; OS::PowerState power_state;
bool GetPowerInfo_Windows(); bool GetPowerInfo_Windows();
@ -50,7 +50,7 @@ public:
PowerWindows(); PowerWindows();
virtual ~PowerWindows(); virtual ~PowerWindows();
PowerState get_power_state(); OS::PowerState get_power_state();
int get_power_seconds_left(); int get_power_seconds_left();
int get_power_percent_left(); int get_power_percent_left();
}; };

View File

@ -2149,7 +2149,7 @@ void OS_X11::set_context(int p_context) {
} }
} }
PowerState OS_X11::get_power_state() { OS::PowerState OS_X11::get_power_state() {
return power_manager->get_power_state(); return power_manager->get_power_state();
} }

View File

@ -265,7 +265,7 @@ public:
virtual void set_use_vsync(bool p_enable); virtual void set_use_vsync(bool p_enable);
virtual bool is_vsync_enabled() const; virtual bool is_vsync_enabled() const;
virtual PowerState get_power_state(); virtual OS::PowerState get_power_state();
virtual int get_power_seconds_left(); virtual int get_power_seconds_left();
virtual int get_power_percent_left(); virtual int get_power_percent_left();

View File

@ -252,7 +252,7 @@ bool PowerX11::GetPowerInfo_Linux_proc_acpi() {
this->nsecs_left = -1; this->nsecs_left = -1;
this->percent_left = -1; this->percent_left = -1;
this->power_state = POWERSTATE_UNKNOWN; this->power_state = OS::POWERSTATE_UNKNOWN;
dirp->change_dir(proc_acpi_battery_path); dirp->change_dir(proc_acpi_battery_path);
Error err = dirp->list_dir_begin(); Error err = dirp->list_dir_begin();
@ -282,13 +282,13 @@ bool PowerX11::GetPowerInfo_Linux_proc_acpi() {
} }
if (!have_battery) { if (!have_battery) {
this->power_state = POWERSTATE_NO_BATTERY; this->power_state = OS::POWERSTATE_NO_BATTERY;
} else if (charging) { } else if (charging) {
this->power_state = POWERSTATE_CHARGING; this->power_state = OS::POWERSTATE_CHARGING;
} else if (have_ac) { } else if (have_ac) {
this->power_state = POWERSTATE_CHARGED; this->power_state = OS::POWERSTATE_CHARGED;
} else { } else {
this->power_state = POWERSTATE_ON_BATTERY; this->power_state = OS::POWERSTATE_ON_BATTERY;
} }
return true; /* definitive answer. */ return true; /* definitive answer. */
@ -400,17 +400,17 @@ bool PowerX11::GetPowerInfo_Linux_proc_apm() {
} }
if (battery_flag == 0xFF) { /* unknown state */ if (battery_flag == 0xFF) { /* unknown state */
this->power_state = POWERSTATE_UNKNOWN; this->power_state = OS::POWERSTATE_UNKNOWN;
} else if (battery_flag & (1 << 7)) { /* no battery */ } else if (battery_flag & (1 << 7)) { /* no battery */
this->power_state = POWERSTATE_NO_BATTERY; this->power_state = OS::POWERSTATE_NO_BATTERY;
} else if (battery_flag & (1 << 3)) { /* charging */ } else if (battery_flag & (1 << 3)) { /* charging */
this->power_state = POWERSTATE_CHARGING; this->power_state = OS::POWERSTATE_CHARGING;
need_details = true; need_details = true;
} else if (ac_status == 1) { } else if (ac_status == 1) {
this->power_state = POWERSTATE_CHARGED; /* on AC, not charging. */ this->power_state = OS::POWERSTATE_CHARGED; /* on AC, not charging. */
need_details = true; need_details = true;
} else { } else {
this->power_state = POWERSTATE_ON_BATTERY; this->power_state = OS::POWERSTATE_ON_BATTERY;
need_details = true; need_details = true;
} }
@ -445,7 +445,7 @@ bool PowerX11::GetPowerInfo_Linux_sys_class_power_supply(/*PowerState *state, in
return false; return false;
} }
this->power_state = POWERSTATE_NO_BATTERY; /* assume we're just plugged in. */ this->power_state = OS::POWERSTATE_NO_BATTERY; /* assume we're just plugged in. */
this->nsecs_left = -1; this->nsecs_left = -1;
this->percent_left = -1; this->percent_left = -1;
@ -454,7 +454,7 @@ bool PowerX11::GetPowerInfo_Linux_sys_class_power_supply(/*PowerState *state, in
while (name != "") { while (name != "") {
bool choose = false; bool choose = false;
char str[64]; char str[64];
PowerState st; OS::PowerState st;
int secs; int secs;
int pct; int pct;
@ -475,17 +475,17 @@ bool PowerX11::GetPowerInfo_Linux_sys_class_power_supply(/*PowerState *state, in
/* some drivers don't offer this, so if it's not explicitly reported assume it's present. */ /* some drivers don't offer this, so if it's not explicitly reported assume it's present. */
if (read_power_file(base, name.utf8().get_data(), "present", str, sizeof(str)) && (String(str) == "0\n")) { if (read_power_file(base, name.utf8().get_data(), "present", str, sizeof(str)) && (String(str) == "0\n")) {
st = POWERSTATE_NO_BATTERY; st = OS::POWERSTATE_NO_BATTERY;
} else if (!read_power_file(base, name.utf8().get_data(), "status", str, sizeof(str))) { } else if (!read_power_file(base, name.utf8().get_data(), "status", str, sizeof(str))) {
st = POWERSTATE_UNKNOWN; /* uh oh */ st = OS::POWERSTATE_UNKNOWN; /* uh oh */
} else if (String(str) == "Charging\n") { } else if (String(str) == "Charging\n") {
st = POWERSTATE_CHARGING; st = OS::POWERSTATE_CHARGING;
} else if (String(str) == "Discharging\n") { } else if (String(str) == "Discharging\n") {
st = POWERSTATE_ON_BATTERY; st = OS::POWERSTATE_ON_BATTERY;
} else if ((String(str) == "Full\n") || (String(str) == "Not charging\n")) { } else if ((String(str) == "Full\n") || (String(str) == "Not charging\n")) {
st = POWERSTATE_CHARGED; st = OS::POWERSTATE_CHARGED;
} else { } else {
st = POWERSTATE_UNKNOWN; /* uh oh */ st = OS::POWERSTATE_UNKNOWN; /* uh oh */
} }
if (!read_power_file(base, name.utf8().get_data(), "capacity", str, sizeof(str))) { if (!read_power_file(base, name.utf8().get_data(), "capacity", str, sizeof(str))) {
@ -543,17 +543,17 @@ bool PowerX11::UpdatePowerInfo() {
} }
PowerX11::PowerX11() PowerX11::PowerX11()
: nsecs_left(-1), percent_left(-1), power_state(POWERSTATE_UNKNOWN) { : nsecs_left(-1), percent_left(-1), power_state(OS::POWERSTATE_UNKNOWN) {
} }
PowerX11::~PowerX11() { PowerX11::~PowerX11() {
} }
PowerState PowerX11::get_power_state() { OS::PowerState PowerX11::get_power_state() {
if (UpdatePowerInfo()) { if (UpdatePowerInfo()) {
return power_state; return power_state;
} else { } else {
return POWERSTATE_UNKNOWN; return OS::POWERSTATE_UNKNOWN;
} }
} }

View File

@ -33,14 +33,14 @@
#include "os/dir_access.h" #include "os/dir_access.h"
#include "os/file_access.h" #include "os/file_access.h"
#include "os/power.h" #include "os/os.h"
class PowerX11 { class PowerX11 {
private: private:
int nsecs_left; int nsecs_left;
int percent_left; int percent_left;
PowerState power_state; OS::PowerState power_state;
FileAccessRef open_power_file(const char *base, const char *node, const char *key); FileAccessRef open_power_file(const char *base, const char *node, const char *key);
bool read_power_file(const char *base, const char *node, const char *key, char *buf, size_t buflen); bool read_power_file(const char *base, const char *node, const char *key, char *buf, size_t buflen);
@ -58,7 +58,7 @@ public:
PowerX11(); PowerX11();
virtual ~PowerX11(); virtual ~PowerX11();
PowerState get_power_state(); OS::PowerState get_power_state();
int get_power_seconds_left(); int get_power_seconds_left();
int get_power_percent_left(); int get_power_percent_left();
}; };

View File

@ -302,6 +302,9 @@ void CollisionPolygon2D::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::POOL_VECTOR2_ARRAY, "polygon"), "set_polygon", "get_polygon"); ADD_PROPERTY(PropertyInfo(Variant::POOL_VECTOR2_ARRAY, "polygon"), "set_polygon", "get_polygon");
ADD_PROPERTYNZ(PropertyInfo(Variant::BOOL, "disabled"), "set_disabled", "is_disabled"); ADD_PROPERTYNZ(PropertyInfo(Variant::BOOL, "disabled"), "set_disabled", "is_disabled");
ADD_PROPERTYNZ(PropertyInfo(Variant::BOOL, "one_way_collision"), "set_one_way_collision", "is_one_way_collision_enabled"); ADD_PROPERTYNZ(PropertyInfo(Variant::BOOL, "one_way_collision"), "set_one_way_collision", "is_one_way_collision_enabled");
BIND_ENUM_CONSTANT(BUILD_SOLIDS);
BIND_ENUM_CONSTANT(BUILD_SEGMENTS);
} }
CollisionPolygon2D::CollisionPolygon2D() { CollisionPolygon2D::CollisionPolygon2D() {

View File

@ -443,6 +443,13 @@ void Light2D::_bind_methods() {
BIND_ENUM_CONSTANT(MODE_SUB); BIND_ENUM_CONSTANT(MODE_SUB);
BIND_ENUM_CONSTANT(MODE_MIX); BIND_ENUM_CONSTANT(MODE_MIX);
BIND_ENUM_CONSTANT(MODE_MASK); BIND_ENUM_CONSTANT(MODE_MASK);
BIND_ENUM_CONSTANT(SHADOW_FILTER_NONE);
BIND_ENUM_CONSTANT(SHADOW_FILTER_PCF3);
BIND_ENUM_CONSTANT(SHADOW_FILTER_PCF5);
BIND_ENUM_CONSTANT(SHADOW_FILTER_PCF7);
BIND_ENUM_CONSTANT(SHADOW_FILTER_PCF9);
BIND_ENUM_CONSTANT(SHADOW_FILTER_PCF13);
} }
Light2D::Light2D() { Light2D::Light2D() {

View File

@ -28,13 +28,14 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/ /*************************************************************************/
#include "line_2d.h" #include "line_2d.h"
#include "line_builder.h"
#include "core_string_names.h" #include "core_string_names.h"
// Needed so we can bind functions // Needed so we can bind functions
VARIANT_ENUM_CAST(LineJointMode) VARIANT_ENUM_CAST(Line2D::LineJointMode)
VARIANT_ENUM_CAST(LineCapMode) VARIANT_ENUM_CAST(Line2D::LineCapMode)
VARIANT_ENUM_CAST(LineTextureMode) VARIANT_ENUM_CAST(Line2D::LineTextureMode)
Line2D::Line2D() Line2D::Line2D()
: Node2D() { : Node2D() {
@ -134,7 +135,7 @@ void Line2D::set_texture_mode(const LineTextureMode mode) {
update(); update();
} }
LineTextureMode Line2D::get_texture_mode() const { Line2D::LineTextureMode Line2D::get_texture_mode() const {
return _texture_mode; return _texture_mode;
} }
@ -143,7 +144,7 @@ void Line2D::set_joint_mode(LineJointMode mode) {
update(); update();
} }
LineJointMode Line2D::get_joint_mode() const { Line2D::LineJointMode Line2D::get_joint_mode() const {
return _joint_mode; return _joint_mode;
} }
@ -152,7 +153,7 @@ void Line2D::set_begin_cap_mode(LineCapMode mode) {
update(); update();
} }
LineCapMode Line2D::get_begin_cap_mode() const { Line2D::LineCapMode Line2D::get_begin_cap_mode() const {
return _begin_cap_mode; return _begin_cap_mode;
} }
@ -161,7 +162,7 @@ void Line2D::set_end_cap_mode(LineCapMode mode) {
update(); update();
} }
LineCapMode Line2D::get_end_cap_mode() const { Line2D::LineCapMode Line2D::get_end_cap_mode() const {
return _end_cap_mode; return _end_cap_mode;
} }

View File

@ -30,7 +30,6 @@
#ifndef LINE2D_H #ifndef LINE2D_H
#define LINE2D_H #define LINE2D_H
#include "line_builder.h"
#include "node_2d.h" #include "node_2d.h"
class Line2D : public Node2D { class Line2D : public Node2D {
@ -38,6 +37,24 @@ class Line2D : public Node2D {
GDCLASS(Line2D, Node2D) GDCLASS(Line2D, Node2D)
public: public:
enum LineJointMode {
LINE_JOINT_SHARP = 0,
LINE_JOINT_BEVEL,
LINE_JOINT_ROUND
};
enum LineCapMode {
LINE_CAP_NONE = 0,
LINE_CAP_BOX,
LINE_CAP_ROUND
};
enum LineTextureMode {
LINE_TEXTURE_NONE = 0,
LINE_TEXTURE_TILE
// TODO STRETCH mode
};
Line2D(); Line2D();
void set_points(const PoolVector<Vector2> &p_points); void set_points(const PoolVector<Vector2> &p_points);

View File

@ -92,14 +92,14 @@ static inline Vector2 interpolate(const Rect2 &r, const Vector2 &v) {
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
LineBuilder::LineBuilder() { LineBuilder::LineBuilder() {
joint_mode = LINE_JOINT_SHARP; joint_mode = Line2D::LINE_JOINT_SHARP;
width = 10; width = 10;
default_color = Color(0.4, 0.5, 1); default_color = Color(0.4, 0.5, 1);
gradient = NULL; gradient = NULL;
sharp_limit = 2.f; sharp_limit = 2.f;
round_precision = 8; round_precision = 8;
begin_cap_mode = LINE_CAP_NONE; begin_cap_mode = Line2D::LINE_CAP_NONE;
end_cap_mode = LINE_CAP_NONE; end_cap_mode = Line2D::LINE_CAP_NONE;
_interpolate_color = false; _interpolate_color = false;
_last_index[0] = 0; _last_index[0] = 0;
@ -141,7 +141,7 @@ void LineBuilder::build() {
float current_distance1 = 0.f; float current_distance1 = 0.f;
float total_distance = 0.f; float total_distance = 0.f;
_interpolate_color = gradient != NULL; _interpolate_color = gradient != NULL;
bool distance_required = _interpolate_color || texture_mode == LINE_TEXTURE_TILE; bool distance_required = _interpolate_color || texture_mode == Line2D::LINE_TEXTURE_TILE;
if (distance_required) if (distance_required)
total_distance = calculate_total_distance(points); total_distance = calculate_total_distance(points);
if (_interpolate_color) if (_interpolate_color)
@ -153,7 +153,7 @@ void LineBuilder::build() {
float uvx1 = 0.f; float uvx1 = 0.f;
// Begin cap // Begin cap
if (begin_cap_mode == LINE_CAP_BOX) { if (begin_cap_mode == Line2D::LINE_CAP_BOX) {
// Push back first vertices a little bit // Push back first vertices a little bit
pos_up0 -= f0 * hw; pos_up0 -= f0 * hw;
pos_down0 -= f0 * hw; pos_down0 -= f0 * hw;
@ -161,8 +161,8 @@ void LineBuilder::build() {
total_distance += width; total_distance += width;
current_distance0 += hw; current_distance0 += hw;
current_distance1 = current_distance0; current_distance1 = current_distance0;
} else if (begin_cap_mode == LINE_CAP_ROUND) { } else if (begin_cap_mode == Line2D::LINE_CAP_ROUND) {
if (texture_mode == LINE_TEXTURE_TILE) { if (texture_mode == Line2D::LINE_TEXTURE_TILE) {
uvx0 = 0.5f; uvx0 = 0.5f;
} }
new_arc(pos0, pos_up0 - pos0, -Math_PI, color0, Rect2(0.f, 0.f, 1.f, 1.f)); new_arc(pos0, pos_up0 - pos0, -Math_PI, color0, Rect2(0.f, 0.f, 1.f, 1.f));
@ -247,15 +247,15 @@ void LineBuilder::build() {
corner_pos_down = corner_pos_in; corner_pos_down = corner_pos_in;
} }
LineJointMode current_joint_mode = joint_mode; Line2D::LineJointMode current_joint_mode = joint_mode;
Vector2 pos_up1, pos_down1; Vector2 pos_up1, pos_down1;
if (intersection_result == SEGMENT_INTERSECT) { if (intersection_result == SEGMENT_INTERSECT) {
// Fallback on bevel if sharp angle is too high (because it would produce very long miters) // Fallback on bevel if sharp angle is too high (because it would produce very long miters)
if (current_joint_mode == LINE_JOINT_SHARP && corner_pos_out.distance_squared_to(pos1) / hw_sq > sharp_limit_sq) { if (current_joint_mode == Line2D::LINE_JOINT_SHARP && corner_pos_out.distance_squared_to(pos1) / hw_sq > sharp_limit_sq) {
current_joint_mode = LINE_JOINT_BEVEL; current_joint_mode = Line2D::LINE_JOINT_BEVEL;
} }
if (current_joint_mode == LINE_JOINT_SHARP) { if (current_joint_mode == Line2D::LINE_JOINT_SHARP) {
// In this case, we won't create joint geometry, // In this case, we won't create joint geometry,
// The previous and next line quads will directly share an edge. // The previous and next line quads will directly share an edge.
pos_up1 = corner_pos_up; pos_up1 = corner_pos_up;
@ -284,7 +284,7 @@ void LineBuilder::build() {
if (_interpolate_color) { if (_interpolate_color) {
color1 = gradient->get_color_at_offset(current_distance1 / total_distance); color1 = gradient->get_color_at_offset(current_distance1 / total_distance);
} }
if (texture_mode == LINE_TEXTURE_TILE) { if (texture_mode == Line2D::LINE_TEXTURE_TILE) {
uvx0 = current_distance0 / width; uvx0 = current_distance0 / width;
uvx1 = current_distance1 / width; uvx1 = current_distance1 / width;
} }
@ -298,7 +298,7 @@ void LineBuilder::build() {
pos0 = pos1; pos0 = pos1;
current_distance0 = current_distance1; current_distance0 = current_distance1;
if (intersection_result == SEGMENT_INTERSECT) { if (intersection_result == SEGMENT_INTERSECT) {
if (current_joint_mode == LINE_JOINT_SHARP) { if (current_joint_mode == Line2D::LINE_JOINT_SHARP) {
pos_up0 = pos_up1; pos_up0 = pos_up1;
pos_down0 = pos_down1; pos_down0 = pos_down1;
} else { } else {
@ -317,7 +317,7 @@ void LineBuilder::build() {
// From this point, bu0 and bd0 concern the next segment // From this point, bu0 and bd0 concern the next segment
// Add joint geometry // Add joint geometry
if (current_joint_mode != LINE_JOINT_SHARP) { if (current_joint_mode != Line2D::LINE_JOINT_SHARP) {
/* ________________ cbegin /* ________________ cbegin
* / \ * / \
@ -337,9 +337,9 @@ void LineBuilder::build() {
cend = pos_up0; cend = pos_up0;
} }
if (current_joint_mode == LINE_JOINT_BEVEL) { if (current_joint_mode == Line2D::LINE_JOINT_BEVEL) {
strip_add_tri(cend, orientation); strip_add_tri(cend, orientation);
} else if (current_joint_mode == LINE_JOINT_ROUND) { } else if (current_joint_mode == Line2D::LINE_JOINT_ROUND) {
Vector2 vbegin = cbegin - pos1; Vector2 vbegin = cbegin - pos1;
Vector2 vend = cend - pos1; Vector2 vend = cend - pos1;
strip_add_arc(pos1, vbegin.angle_to(vend), orientation); strip_add_arc(pos1, vbegin.angle_to(vend), orientation);
@ -360,7 +360,7 @@ void LineBuilder::build() {
Vector2 pos_down1 = pos1 - u0 * hw; Vector2 pos_down1 = pos1 - u0 * hw;
// End cap (box) // End cap (box)
if (end_cap_mode == LINE_CAP_BOX) { if (end_cap_mode == Line2D::LINE_CAP_BOX) {
pos_up1 += f0 * hw; pos_up1 += f0 * hw;
pos_down1 += f0 * hw; pos_down1 += f0 * hw;
} }
@ -371,14 +371,14 @@ void LineBuilder::build() {
if (_interpolate_color) { if (_interpolate_color) {
color1 = gradient->get_color(gradient->get_points_count() - 1); color1 = gradient->get_color(gradient->get_points_count() - 1);
} }
if (texture_mode == LINE_TEXTURE_TILE) { if (texture_mode == Line2D::LINE_TEXTURE_TILE) {
uvx1 = current_distance1 / width; uvx1 = current_distance1 / width;
} }
strip_add_quad(pos_up1, pos_down1, color1, uvx1); strip_add_quad(pos_up1, pos_down1, color1, uvx1);
// End cap (round) // End cap (round)
if (end_cap_mode == LINE_CAP_ROUND) { if (end_cap_mode == Line2D::LINE_CAP_ROUND) {
// Note: color is not used in case we don't interpolate... // Note: color is not used in case we don't interpolate...
Color color = _interpolate_color ? gradient->get_color(gradient->get_points_count() - 1) : Color(0, 0, 0); Color color = _interpolate_color ? gradient->get_color(gradient->get_points_count() - 1) : Color(0, 0, 0);
new_arc(pos1, pos_up1 - pos1, Math_PI, color, Rect2(uvx1 - 0.5f, 0.f, 1.f, 1.f)); new_arc(pos1, pos_up1 - pos1, Math_PI, color, Rect2(uvx1 - 0.5f, 0.f, 1.f, 1.f));
@ -396,7 +396,7 @@ void LineBuilder::strip_begin(Vector2 up, Vector2 down, Color color, float uvx)
colors.push_back(color); colors.push_back(color);
} }
if (texture_mode != LINE_TEXTURE_NONE) { if (texture_mode != Line2D::LINE_TEXTURE_NONE) {
uvs.push_back(Vector2(uvx, 0.f)); uvs.push_back(Vector2(uvx, 0.f));
uvs.push_back(Vector2(uvx, 1.f)); uvs.push_back(Vector2(uvx, 1.f));
} }
@ -420,7 +420,7 @@ void LineBuilder::strip_new_quad(Vector2 up, Vector2 down, Color color, float uv
colors.push_back(color); colors.push_back(color);
} }
if (texture_mode != LINE_TEXTURE_NONE) { if (texture_mode != Line2D::LINE_TEXTURE_NONE) {
uvs.push_back(uvs[_last_index[UP]]); uvs.push_back(uvs[_last_index[UP]]);
uvs.push_back(uvs[_last_index[DOWN]]); uvs.push_back(uvs[_last_index[DOWN]]);
uvs.push_back(Vector2(uvx, UP)); uvs.push_back(Vector2(uvx, UP));
@ -449,7 +449,7 @@ void LineBuilder::strip_add_quad(Vector2 up, Vector2 down, Color color, float uv
colors.push_back(color); colors.push_back(color);
} }
if (texture_mode != LINE_TEXTURE_NONE) { if (texture_mode != Line2D::LINE_TEXTURE_NONE) {
uvs.push_back(Vector2(uvx, 0.f)); uvs.push_back(Vector2(uvx, 0.f));
uvs.push_back(Vector2(uvx, 1.f)); uvs.push_back(Vector2(uvx, 1.f));
} }
@ -476,7 +476,7 @@ void LineBuilder::strip_add_tri(Vector2 up, Orientation orientation) {
Orientation opposite_orientation = orientation == UP ? DOWN : UP; Orientation opposite_orientation = orientation == UP ? DOWN : UP;
if (texture_mode != LINE_TEXTURE_NONE) { if (texture_mode != Line2D::LINE_TEXTURE_NONE) {
// UVs are just one slice of the texture all along // UVs are just one slice of the texture all along
// (otherwise we can't share the bottom vertice) // (otherwise we can't share the bottom vertice)
uvs.push_back(uvs[_last_index[opposite_orientation]]); uvs.push_back(uvs[_last_index[opposite_orientation]]);
@ -541,7 +541,7 @@ void LineBuilder::new_arc(Vector2 center, Vector2 vbegin, float angle_delta, Col
vertices.push_back(center); vertices.push_back(center);
if (_interpolate_color) if (_interpolate_color)
colors.push_back(color); colors.push_back(color);
if (texture_mode != LINE_TEXTURE_NONE) if (texture_mode != Line2D::LINE_TEXTURE_NONE)
uvs.push_back(interpolate(uv_rect, Vector2(0.5f, 0.5f))); uvs.push_back(interpolate(uv_rect, Vector2(0.5f, 0.5f)));
// Arc vertices // Arc vertices
@ -552,7 +552,7 @@ void LineBuilder::new_arc(Vector2 center, Vector2 vbegin, float angle_delta, Col
vertices.push_back(rpos); vertices.push_back(rpos);
if (_interpolate_color) if (_interpolate_color)
colors.push_back(color); colors.push_back(color);
if (texture_mode != LINE_TEXTURE_NONE) { if (texture_mode != Line2D::LINE_TEXTURE_NONE) {
Vector2 tsc = Vector2(Math::cos(tt), Math::sin(tt)); Vector2 tsc = Vector2(Math::cos(tt), Math::sin(tt));
uvs.push_back(interpolate(uv_rect, 0.5f * (tsc + Vector2(1.f, 1.f)))); uvs.push_back(interpolate(uv_rect, 0.5f * (tsc + Vector2(1.f, 1.f))));
tt += angle_step; tt += angle_step;
@ -565,7 +565,7 @@ void LineBuilder::new_arc(Vector2 center, Vector2 vbegin, float angle_delta, Col
vertices.push_back(rpos); vertices.push_back(rpos);
if (_interpolate_color) if (_interpolate_color)
colors.push_back(color); colors.push_back(color);
if (texture_mode != LINE_TEXTURE_NONE) { if (texture_mode != Line2D::LINE_TEXTURE_NONE) {
tt = tt_begin + angle_delta; tt = tt_begin + angle_delta;
Vector2 tsc = Vector2(Math::cos(tt), Math::sin(tt)); Vector2 tsc = Vector2(Math::cos(tt), Math::sin(tt));
uvs.push_back(interpolate(uv_rect, 0.5f * (tsc + Vector2(1.f, 1.f)))); uvs.push_back(interpolate(uv_rect, 0.5f * (tsc + Vector2(1.f, 1.f))));

View File

@ -31,39 +31,22 @@
#define LINE_BUILDER_H #define LINE_BUILDER_H
#include "color.h" #include "color.h"
#include "line_2d.h"
#include "math_2d.h" #include "math_2d.h"
#include "scene/resources/color_ramp.h" #include "scene/resources/color_ramp.h"
enum LineJointMode {
LINE_JOINT_SHARP = 0,
LINE_JOINT_BEVEL,
LINE_JOINT_ROUND
};
enum LineCapMode {
LINE_CAP_NONE = 0,
LINE_CAP_BOX,
LINE_CAP_ROUND
};
enum LineTextureMode {
LINE_TEXTURE_NONE = 0,
LINE_TEXTURE_TILE
// TODO STRETCH mode
};
class LineBuilder { class LineBuilder {
public: public:
// TODO Move in a struct and reference it // TODO Move in a struct and reference it
// Input // Input
Vector<Vector2> points; Vector<Vector2> points;
LineJointMode joint_mode; Line2D::LineJointMode joint_mode;
LineCapMode begin_cap_mode; Line2D::LineCapMode begin_cap_mode;
LineCapMode end_cap_mode; Line2D::LineCapMode end_cap_mode;
float width; float width;
Color default_color; Color default_color;
Gradient *gradient; Gradient *gradient;
LineTextureMode texture_mode; Line2D::LineTextureMode texture_mode;
float sharp_limit; float sharp_limit;
int round_precision; int round_precision;
// TODO offset_joints option (offers alternative implementation of round joints) // TODO offset_joints option (offers alternative implementation of round joints)

View File

@ -399,6 +399,9 @@ void TouchScreenButton::_bind_methods() {
ADD_SIGNAL(MethodInfo("pressed")); ADD_SIGNAL(MethodInfo("pressed"));
ADD_SIGNAL(MethodInfo("released")); ADD_SIGNAL(MethodInfo("released"));
BIND_ENUM_CONSTANT(VISIBILITY_ALWAYS);
BIND_ENUM_CONSTANT(VISIBILITY_TOUCHSCREEN_ONLY);
} }
TouchScreenButton::TouchScreenButton() { TouchScreenButton::TouchScreenButton() {

View File

@ -729,6 +729,12 @@ void Area::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::STRING, "reverb_bus_name", PROPERTY_HINT_ENUM, ""), "set_reverb_bus", "get_reverb_bus"); ADD_PROPERTY(PropertyInfo(Variant::STRING, "reverb_bus_name", PROPERTY_HINT_ENUM, ""), "set_reverb_bus", "get_reverb_bus");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "reverb_bus_amount", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_reverb_amount", "get_reverb_amount"); ADD_PROPERTY(PropertyInfo(Variant::REAL, "reverb_bus_amount", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_reverb_amount", "get_reverb_amount");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "reverb_bus_uniformity", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_reverb_uniformity", "get_reverb_uniformity"); ADD_PROPERTY(PropertyInfo(Variant::REAL, "reverb_bus_uniformity", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_reverb_uniformity", "get_reverb_uniformity");
BIND_ENUM_CONSTANT(SPACE_OVERRIDE_DISABLED);
BIND_ENUM_CONSTANT(SPACE_OVERRIDE_COMBINE);
BIND_ENUM_CONSTANT(SPACE_OVERRIDE_COMBINE_REPLACE);
BIND_ENUM_CONSTANT(SPACE_OVERRIDE_REPLACE);
BIND_ENUM_CONSTANT(SPACE_OVERRIDE_REPLACE_COMBINE);
} }
Area::Area() Area::Area()

View File

@ -405,6 +405,12 @@ void OmniLight::_bind_methods() {
ADD_PROPERTYI(PropertyInfo(Variant::REAL, "omni_attenuation", PROPERTY_HINT_EXP_EASING), "set_param", "get_param", PARAM_ATTENUATION); ADD_PROPERTYI(PropertyInfo(Variant::REAL, "omni_attenuation", PROPERTY_HINT_EXP_EASING), "set_param", "get_param", PARAM_ATTENUATION);
ADD_PROPERTY(PropertyInfo(Variant::INT, "omni_shadow_mode", PROPERTY_HINT_ENUM, "Dual Paraboloid,Cube"), "set_shadow_mode", "get_shadow_mode"); ADD_PROPERTY(PropertyInfo(Variant::INT, "omni_shadow_mode", PROPERTY_HINT_ENUM, "Dual Paraboloid,Cube"), "set_shadow_mode", "get_shadow_mode");
ADD_PROPERTY(PropertyInfo(Variant::INT, "omni_shadow_detail", PROPERTY_HINT_ENUM, "Vertical,Horizontal"), "set_shadow_detail", "get_shadow_detail"); ADD_PROPERTY(PropertyInfo(Variant::INT, "omni_shadow_detail", PROPERTY_HINT_ENUM, "Vertical,Horizontal"), "set_shadow_detail", "get_shadow_detail");
BIND_ENUM_CONSTANT(SHADOW_DUAL_PARABOLOID);
BIND_ENUM_CONSTANT(SHADOW_CUBE);
BIND_ENUM_CONSTANT(SHADOW_DETAIL_VERTICAL);
BIND_ENUM_CONSTANT(SHADOW_DETAIL_HORIZONTAL);
} }
OmniLight::OmniLight() OmniLight::OmniLight()

View File

@ -874,6 +874,11 @@ void RigidBody::_bind_methods() {
BIND_ENUM_CONSTANT(MODE_KINEMATIC); BIND_ENUM_CONSTANT(MODE_KINEMATIC);
BIND_ENUM_CONSTANT(MODE_RIGID); BIND_ENUM_CONSTANT(MODE_RIGID);
BIND_ENUM_CONSTANT(MODE_CHARACTER); BIND_ENUM_CONSTANT(MODE_CHARACTER);
BIND_ENUM_CONSTANT(AXIS_LOCK_DISABLED);
BIND_ENUM_CONSTANT(AXIS_LOCK_X);
BIND_ENUM_CONSTANT(AXIS_LOCK_Y);
BIND_ENUM_CONSTANT(AXIS_LOCK_Z);
} }
RigidBody::RigidBody() RigidBody::RigidBody()

View File

@ -288,12 +288,13 @@ void GeometryInstance::_bind_methods() {
//ADD_SIGNAL( MethodInfo("visibility_changed")); //ADD_SIGNAL( MethodInfo("visibility_changed"));
BIND_CONSTANT(FLAG_MAX); BIND_ENUM_CONSTANT(SHADOW_CASTING_SETTING_OFF);
BIND_ENUM_CONSTANT(SHADOW_CASTING_SETTING_ON);
BIND_ENUM_CONSTANT(SHADOW_CASTING_SETTING_DOUBLE_SIDED);
BIND_ENUM_CONSTANT(SHADOW_CASTING_SETTING_SHADOWS_ONLY);
BIND_CONSTANT(SHADOW_CASTING_SETTING_OFF); BIND_ENUM_CONSTANT(FLAG_USE_BAKED_LIGHT);
BIND_CONSTANT(SHADOW_CASTING_SETTING_ON); BIND_ENUM_CONSTANT(FLAG_MAX);
BIND_CONSTANT(SHADOW_CASTING_SETTING_DOUBLE_SIDED);
BIND_CONSTANT(SHADOW_CASTING_SETTING_SHADOWS_ONLY);
} }
GeometryInstance::GeometryInstance() { GeometryInstance::GeometryInstance() {

View File

@ -1808,6 +1808,9 @@ void AnimationTreePlayer::_bind_methods() {
BIND_ENUM_CONSTANT(NODE_TIMESCALE); BIND_ENUM_CONSTANT(NODE_TIMESCALE);
BIND_ENUM_CONSTANT(NODE_TIMESEEK); BIND_ENUM_CONSTANT(NODE_TIMESEEK);
BIND_ENUM_CONSTANT(NODE_TRANSITION); BIND_ENUM_CONSTANT(NODE_TRANSITION);
BIND_ENUM_CONSTANT(ANIMATION_PROCESS_FIXED);
BIND_ENUM_CONSTANT(ANIMATION_PROCESS_IDLE);
} }
AnimationTreePlayer::AnimationTreePlayer() { AnimationTreePlayer::AnimationTreePlayer() {

View File

@ -310,6 +310,10 @@ void AudioStreamPlayer::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::STRING, "bus", PROPERTY_HINT_ENUM, ""), "set_bus", "get_bus"); ADD_PROPERTY(PropertyInfo(Variant::STRING, "bus", PROPERTY_HINT_ENUM, ""), "set_bus", "get_bus");
ADD_SIGNAL(MethodInfo("finished")); ADD_SIGNAL(MethodInfo("finished"));
BIND_ENUM_CONSTANT(MIX_TARGET_STEREO);
BIND_ENUM_CONSTANT(MIX_TARGET_SURROUND);
BIND_ENUM_CONSTANT(MIX_TARGET_CENTER);
} }
AudioStreamPlayer::AudioStreamPlayer() { AudioStreamPlayer::AudioStreamPlayer() {

View File

@ -655,6 +655,10 @@ void TabContainer::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::INT, "tab_align", PROPERTY_HINT_ENUM, "Left,Center,Right"), "set_tab_align", "get_tab_align"); ADD_PROPERTY(PropertyInfo(Variant::INT, "tab_align", PROPERTY_HINT_ENUM, "Left,Center,Right"), "set_tab_align", "get_tab_align");
ADD_PROPERTY(PropertyInfo(Variant::INT, "current_tab", PROPERTY_HINT_RANGE, "-1,4096,1", PROPERTY_USAGE_EDITOR), "set_current_tab", "get_current_tab"); ADD_PROPERTY(PropertyInfo(Variant::INT, "current_tab", PROPERTY_HINT_RANGE, "-1,4096,1", PROPERTY_USAGE_EDITOR), "set_current_tab", "get_current_tab");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "tabs_visible"), "set_tabs_visible", "are_tabs_visible"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "tabs_visible"), "set_tabs_visible", "are_tabs_visible");
BIND_ENUM_CONSTANT(ALIGN_LEFT);
BIND_ENUM_CONSTANT(ALIGN_CENTER);
BIND_ENUM_CONSTANT(ALIGN_RIGHT);
} }
TabContainer::TabContainer() { TabContainer::TabContainer() {

View File

@ -759,6 +759,10 @@ void TreeItem::_bind_methods() {
BIND_ENUM_CONSTANT(CELL_MODE_RANGE_EXPRESSION); BIND_ENUM_CONSTANT(CELL_MODE_RANGE_EXPRESSION);
BIND_ENUM_CONSTANT(CELL_MODE_ICON); BIND_ENUM_CONSTANT(CELL_MODE_ICON);
BIND_ENUM_CONSTANT(CELL_MODE_CUSTOM); BIND_ENUM_CONSTANT(CELL_MODE_CUSTOM);
BIND_ENUM_CONSTANT(ALIGN_LEFT);
BIND_ENUM_CONSTANT(ALIGN_CENTER);
BIND_ENUM_CONSTANT(ALIGN_RIGHT);
} }
void TreeItem::clear_children() { void TreeItem::clear_children() {

View File

@ -2762,6 +2762,15 @@ void Viewport::_bind_methods() {
BIND_ENUM_CONSTANT(MSAA_4X); BIND_ENUM_CONSTANT(MSAA_4X);
BIND_ENUM_CONSTANT(MSAA_8X); BIND_ENUM_CONSTANT(MSAA_8X);
BIND_ENUM_CONSTANT(MSAA_16X); BIND_ENUM_CONSTANT(MSAA_16X);
BIND_ENUM_CONSTANT(USAGE_2D);
BIND_ENUM_CONSTANT(USAGE_2D_NO_SAMPLING);
BIND_ENUM_CONSTANT(USAGE_3D);
BIND_ENUM_CONSTANT(USAGE_3D_NO_EFFECTS);
BIND_ENUM_CONSTANT(CLEAR_MODE_ALWAYS);
BIND_ENUM_CONSTANT(CLEAR_MODE_NEVER);
BIND_ENUM_CONSTANT(CLEAR_MODE_ONLY_NEXT_FRAME);
} }
Viewport::Viewport() { Viewport::Viewport() {

View File

@ -536,6 +536,14 @@ void AudioStreamSample::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::INT, "mix_rate"), "set_mix_rate", "get_mix_rate"); ADD_PROPERTY(PropertyInfo(Variant::INT, "mix_rate"), "set_mix_rate", "get_mix_rate");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "stereo"), "set_stereo", "is_stereo"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "stereo"), "set_stereo", "is_stereo");
ADD_PROPERTY(PropertyInfo(Variant::POOL_BYTE_ARRAY, "data", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "set_data", "get_data"); ADD_PROPERTY(PropertyInfo(Variant::POOL_BYTE_ARRAY, "data", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "set_data", "get_data");
BIND_ENUM_CONSTANT(FORMAT_8_BITS);
BIND_ENUM_CONSTANT(FORMAT_16_BITS);
BIND_ENUM_CONSTANT(FORMAT_IMA_ADPCM);
BIND_ENUM_CONSTANT(LOOP_DISABLED);
BIND_ENUM_CONSTANT(LOOP_FORWARD);
BIND_ENUM_CONSTANT(LOOP_PING_PONG);
} }
AudioStreamSample::AudioStreamSample() { AudioStreamSample::AudioStreamSample() {

View File

@ -514,6 +514,10 @@ void Curve::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::INT, "_data", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "_set_data", "_get_data"); ADD_PROPERTY(PropertyInfo(Variant::INT, "_data", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "_set_data", "_get_data");
ADD_SIGNAL(MethodInfo(SIGNAL_RANGE_CHANGED)); ADD_SIGNAL(MethodInfo(SIGNAL_RANGE_CHANGED));
BIND_ENUM_CONSTANT(TANGENT_FREE);
BIND_ENUM_CONSTANT(TANGENT_LINEAR);
BIND_ENUM_CONSTANT(TANGENT_MODE_COUNT);
} }
int Curve2D::get_point_count() const { int Curve2D::get_point_count() const {

View File

@ -422,6 +422,46 @@ void Mesh::_bind_methods() {
BIND_ENUM_CONSTANT(PRIMITIVE_TRIANGLES); BIND_ENUM_CONSTANT(PRIMITIVE_TRIANGLES);
BIND_ENUM_CONSTANT(PRIMITIVE_TRIANGLE_STRIP); BIND_ENUM_CONSTANT(PRIMITIVE_TRIANGLE_STRIP);
BIND_ENUM_CONSTANT(PRIMITIVE_TRIANGLE_FAN); BIND_ENUM_CONSTANT(PRIMITIVE_TRIANGLE_FAN);
BIND_ENUM_CONSTANT(BLEND_SHAPE_MODE_NORMALIZED);
BIND_ENUM_CONSTANT(BLEND_SHAPE_MODE_RELATIVE);
BIND_ENUM_CONSTANT(ARRAY_FORMAT_VERTEX);
BIND_ENUM_CONSTANT(ARRAY_FORMAT_NORMAL);
BIND_ENUM_CONSTANT(ARRAY_FORMAT_TANGENT);
BIND_ENUM_CONSTANT(ARRAY_FORMAT_COLOR);
BIND_ENUM_CONSTANT(ARRAY_FORMAT_TEX_UV);
BIND_ENUM_CONSTANT(ARRAY_FORMAT_TEX_UV2);
BIND_ENUM_CONSTANT(ARRAY_FORMAT_BONES);
BIND_ENUM_CONSTANT(ARRAY_FORMAT_WEIGHTS);
BIND_ENUM_CONSTANT(ARRAY_FORMAT_INDEX);
BIND_ENUM_CONSTANT(ARRAY_COMPRESS_BASE);
BIND_ENUM_CONSTANT(ARRAY_COMPRESS_VERTEX);
BIND_ENUM_CONSTANT(ARRAY_COMPRESS_NORMAL);
BIND_ENUM_CONSTANT(ARRAY_COMPRESS_TANGENT);
BIND_ENUM_CONSTANT(ARRAY_COMPRESS_COLOR);
BIND_ENUM_CONSTANT(ARRAY_COMPRESS_TEX_UV);
BIND_ENUM_CONSTANT(ARRAY_COMPRESS_TEX_UV2);
BIND_ENUM_CONSTANT(ARRAY_COMPRESS_BONES);
BIND_ENUM_CONSTANT(ARRAY_COMPRESS_WEIGHTS);
BIND_ENUM_CONSTANT(ARRAY_COMPRESS_INDEX);
BIND_ENUM_CONSTANT(ARRAY_FLAG_USE_2D_VERTICES);
BIND_ENUM_CONSTANT(ARRAY_FLAG_USE_16_BIT_BONES);
BIND_ENUM_CONSTANT(ARRAY_COMPRESS_DEFAULT);
BIND_ENUM_CONSTANT(ARRAY_VERTEX);
BIND_ENUM_CONSTANT(ARRAY_NORMAL);
BIND_ENUM_CONSTANT(ARRAY_TANGENT);
BIND_ENUM_CONSTANT(ARRAY_COLOR);
BIND_ENUM_CONSTANT(ARRAY_TEX_UV);
BIND_ENUM_CONSTANT(ARRAY_TEX_UV2);
BIND_ENUM_CONSTANT(ARRAY_BONES);
BIND_ENUM_CONSTANT(ARRAY_WEIGHTS);
BIND_ENUM_CONSTANT(ARRAY_INDEX);
BIND_ENUM_CONSTANT(ARRAY_MAX);
} }
Mesh::Mesh() { Mesh::Mesh() {

View File

@ -175,6 +175,12 @@ void AudioEffectDistortion::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::REAL, "keep_hf_hz", PROPERTY_HINT_RANGE, "1,20000,1"), "set_keep_hf_hz", "get_keep_hf_hz"); ADD_PROPERTY(PropertyInfo(Variant::REAL, "keep_hf_hz", PROPERTY_HINT_RANGE, "1,20000,1"), "set_keep_hf_hz", "get_keep_hf_hz");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "drive", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_drive", "get_drive"); ADD_PROPERTY(PropertyInfo(Variant::REAL, "drive", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_drive", "get_drive");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "post_gain", PROPERTY_HINT_RANGE, "-80,24,0.01"), "set_post_gain", "get_post_gain"); ADD_PROPERTY(PropertyInfo(Variant::REAL, "post_gain", PROPERTY_HINT_RANGE, "-80,24,0.01"), "set_post_gain", "get_post_gain");
BIND_ENUM_CONSTANT(MODE_CLIP);
BIND_ENUM_CONSTANT(MODE_ATAN);
BIND_ENUM_CONSTANT(MODE_LOFI);
BIND_ENUM_CONSTANT(MODE_OVERDRIVE);
BIND_ENUM_CONSTANT(MODE_WAVESHAPE);
} }
AudioEffectDistortion::AudioEffectDistortion() { AudioEffectDistortion::AudioEffectDistortion() {

View File

@ -159,6 +159,11 @@ void AudioEffectFilter::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::REAL, "resonance", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_resonance", "get_resonance"); ADD_PROPERTY(PropertyInfo(Variant::REAL, "resonance", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_resonance", "get_resonance");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "gain", PROPERTY_HINT_RANGE, "0,4,0.01"), "set_gain", "get_gain"); ADD_PROPERTY(PropertyInfo(Variant::REAL, "gain", PROPERTY_HINT_RANGE, "0,4,0.01"), "set_gain", "get_gain");
ADD_PROPERTY(PropertyInfo(Variant::INT, "dB", PROPERTY_HINT_ENUM, "6db,12db,18db,24db"), "set_db", "get_db"); ADD_PROPERTY(PropertyInfo(Variant::INT, "dB", PROPERTY_HINT_ENUM, "6db,12db,18db,24db"), "set_db", "get_db");
BIND_ENUM_CONSTANT(FILTER_6DB);
BIND_ENUM_CONSTANT(FILTER_12DB);
BIND_ENUM_CONSTANT(FILTER_18DB);
BIND_ENUM_CONSTANT(FILTER_24DB);
} }
AudioEffectFilter::AudioEffectFilter(AudioFilterSW::Mode p_mode) { AudioEffectFilter::AudioEffectFilter(AudioFilterSW::Mode p_mode) {

View File

@ -1081,6 +1081,10 @@ void AudioServer::_bind_methods() {
ClassDB::bind_method(D_METHOD("generate_bus_layout"), &AudioServer::generate_bus_layout); ClassDB::bind_method(D_METHOD("generate_bus_layout"), &AudioServer::generate_bus_layout);
ADD_SIGNAL(MethodInfo("bus_layout_changed")); ADD_SIGNAL(MethodInfo("bus_layout_changed"));
BIND_ENUM_CONSTANT(SPEAKER_MODE_STEREO);
BIND_ENUM_CONSTANT(SPEAKER_SURROUND_51);
BIND_ENUM_CONSTANT(SPEAKER_SURROUND_71);
} }
AudioServer::AudioServer() { AudioServer::AudioServer() {

View File

@ -704,6 +704,20 @@ void PhysicsServer::_bind_methods() {
BIND_ENUM_CONSTANT(INFO_ACTIVE_OBJECTS); BIND_ENUM_CONSTANT(INFO_ACTIVE_OBJECTS);
BIND_ENUM_CONSTANT(INFO_COLLISION_PAIRS); BIND_ENUM_CONSTANT(INFO_COLLISION_PAIRS);
BIND_ENUM_CONSTANT(INFO_ISLAND_COUNT); BIND_ENUM_CONSTANT(INFO_ISLAND_COUNT);
BIND_ENUM_CONSTANT(SPACE_PARAM_CONTACT_RECYCLE_RADIUS);
BIND_ENUM_CONSTANT(SPACE_PARAM_CONTACT_MAX_SEPARATION);
BIND_ENUM_CONSTANT(SPACE_PARAM_BODY_MAX_ALLOWED_PENETRATION);
BIND_ENUM_CONSTANT(SPACE_PARAM_BODY_LINEAR_VELOCITY_SLEEP_THRESHOLD);
BIND_ENUM_CONSTANT(SPACE_PARAM_BODY_ANGULAR_VELOCITY_SLEEP_THRESHOLD);
BIND_ENUM_CONSTANT(SPACE_PARAM_BODY_TIME_TO_SLEEP);
BIND_ENUM_CONSTANT(SPACE_PARAM_BODY_ANGULAR_VELOCITY_DAMP_RATIO);
BIND_ENUM_CONSTANT(SPACE_PARAM_CONSTRAINT_DEFAULT_BIAS);
BIND_ENUM_CONSTANT(BODY_AXIS_LOCK_DISABLED);
BIND_ENUM_CONSTANT(BODY_AXIS_LOCK_X);
BIND_ENUM_CONSTANT(BODY_AXIS_LOCK_Y);
BIND_ENUM_CONSTANT(BODY_AXIS_LOCK_Z);
} }
PhysicsServer::PhysicsServer() { PhysicsServer::PhysicsServer() {