Merge branch 'master' of github.com:okamstudio/godot
This commit is contained in:
commit
a7875c586a
@ -80,6 +80,7 @@ MainLoop* test() {
|
|||||||
|
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
// print_line("NUM: "+itos(237641278346127));
|
// print_line("NUM: "+itos(237641278346127));
|
||||||
print_line("NUM: "+itos(-128));
|
print_line("NUM: "+itos(-128));
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -186,11 +186,13 @@ Error Dictionary::parse_json(const String& p_json) {
|
|||||||
|
|
||||||
String errstr;
|
String errstr;
|
||||||
int errline=0;
|
int errline=0;
|
||||||
|
if (p_json != ""){
|
||||||
Error err = JSON::parse(p_json,*this,errstr,errline);
|
Error err = JSON::parse(p_json,*this,errstr,errline);
|
||||||
if (err!=OK) {
|
if (err!=OK) {
|
||||||
ERR_EXPLAIN("Error parsing JSON: "+errstr+" at line: "+itos(errline));
|
ERR_EXPLAIN("Error parsing JSON: "+errstr+" at line: "+itos(errline));
|
||||||
ERR_FAIL_COND_V(err!=OK,err);
|
ERR_FAIL_COND_V(err!=OK,err);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
@ -250,7 +250,7 @@ Error JSON::_get_token(const CharType *p_str, int &idx, int p_len, Token& r_toke
|
|||||||
if (p_str[idx]=='-' || (p_str[idx]>='0' && p_str[idx]<='9')) {
|
if (p_str[idx]=='-' || (p_str[idx]>='0' && p_str[idx]<='9')) {
|
||||||
//a number
|
//a number
|
||||||
const CharType *rptr;
|
const CharType *rptr;
|
||||||
double number = String::to_double(&p_str[idx],-1,&rptr);
|
double number = String::to_double(&p_str[idx],&rptr);
|
||||||
idx+=(rptr - &p_str[idx]);
|
idx+=(rptr - &p_str[idx]);
|
||||||
r_token.type=TK_NUMBER;
|
r_token.type=TK_NUMBER;
|
||||||
r_token.value=number;
|
r_token.value=number;
|
||||||
|
@ -32,7 +32,7 @@ StreamPeerTCP* (*StreamPeerTCP::_create)()=NULL;
|
|||||||
|
|
||||||
void StreamPeerTCP::_bind_methods() {
|
void StreamPeerTCP::_bind_methods() {
|
||||||
|
|
||||||
ObjectTypeDB::bind_method(_MD("connect","host","ip"),&StreamPeerTCP::connect);
|
ObjectTypeDB::bind_method(_MD("connect","host","port"),&StreamPeerTCP::connect);
|
||||||
ObjectTypeDB::bind_method(_MD("is_connected"),&StreamPeerTCP::is_connected);
|
ObjectTypeDB::bind_method(_MD("is_connected"),&StreamPeerTCP::is_connected);
|
||||||
ObjectTypeDB::bind_method(_MD("get_status"),&StreamPeerTCP::get_status);
|
ObjectTypeDB::bind_method(_MD("get_status"),&StreamPeerTCP::get_status);
|
||||||
ObjectTypeDB::bind_method(_MD("get_connected_host"),&StreamPeerTCP::get_connected_host);
|
ObjectTypeDB::bind_method(_MD("get_connected_host"),&StreamPeerTCP::get_connected_host);
|
||||||
|
@ -178,6 +178,7 @@ public:
|
|||||||
#ifdef DEBUG_METHODS_ENABLED
|
#ifdef DEBUG_METHODS_ENABLED
|
||||||
|
|
||||||
_FORCE_INLINE_ void set_return_type(const StringName& p_type) { ret_type=p_type; }
|
_FORCE_INLINE_ void set_return_type(const StringName& p_type) { ret_type=p_type; }
|
||||||
|
_FORCE_INLINE_ StringName get_return_type() const { return ret_type; }
|
||||||
|
|
||||||
_FORCE_INLINE_ Variant::Type get_argument_type(int p_argument) const {
|
_FORCE_INLINE_ Variant::Type get_argument_type(int p_argument) const {
|
||||||
|
|
||||||
|
@ -191,6 +191,7 @@ MethodDefinition _MD(const char* p_name,const char *p_arg1,const char *p_arg2,co
|
|||||||
|
|
||||||
HashMap<StringName,ObjectTypeDB::TypeInfo,StringNameHasher> ObjectTypeDB::types;
|
HashMap<StringName,ObjectTypeDB::TypeInfo,StringNameHasher> ObjectTypeDB::types;
|
||||||
HashMap<StringName,StringName,StringNameHasher> ObjectTypeDB::resource_base_extensions;
|
HashMap<StringName,StringName,StringNameHasher> ObjectTypeDB::resource_base_extensions;
|
||||||
|
HashMap<StringName,StringName,StringNameHasher> ObjectTypeDB::compat_types;
|
||||||
|
|
||||||
ObjectTypeDB::TypeInfo::TypeInfo() {
|
ObjectTypeDB::TypeInfo::TypeInfo() {
|
||||||
|
|
||||||
@ -263,12 +264,22 @@ bool ObjectTypeDB::type_exists(const String &p_type) {
|
|||||||
return types.has(p_type);
|
return types.has(p_type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ObjectTypeDB::add_compatibility_type(const StringName& p_type,const StringName& p_fallback) {
|
||||||
|
|
||||||
|
compat_types[p_type]=p_fallback;
|
||||||
|
}
|
||||||
|
|
||||||
Object *ObjectTypeDB::instance(const String &p_type) {
|
Object *ObjectTypeDB::instance(const String &p_type) {
|
||||||
|
|
||||||
TypeInfo *ti;
|
TypeInfo *ti;
|
||||||
{
|
{
|
||||||
OBJTYPE_LOCK;
|
OBJTYPE_LOCK;
|
||||||
ti=types.getptr(p_type);
|
ti=types.getptr(p_type);
|
||||||
|
if (!ti || ti->disabled || !ti->creation_func) {
|
||||||
|
if (compat_types.has(p_type)) {
|
||||||
|
ti=types.getptr(compat_types[p_type]);
|
||||||
|
}
|
||||||
|
}
|
||||||
ERR_FAIL_COND_V(!ti,NULL);
|
ERR_FAIL_COND_V(!ti,NULL);
|
||||||
ERR_FAIL_COND_V(ti->disabled,NULL);
|
ERR_FAIL_COND_V(ti->disabled,NULL);
|
||||||
ERR_FAIL_COND_V(!ti->creation_func,NULL);
|
ERR_FAIL_COND_V(!ti->creation_func,NULL);
|
||||||
@ -914,6 +925,7 @@ void ObjectTypeDB::cleanup() {
|
|||||||
}
|
}
|
||||||
types.clear();
|
types.clear();
|
||||||
resource_base_extensions.clear();
|
resource_base_extensions.clear();
|
||||||
|
compat_types.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -151,6 +151,7 @@ class ObjectTypeDB {
|
|||||||
static Mutex *lock;
|
static Mutex *lock;
|
||||||
static HashMap<StringName,TypeInfo,StringNameHasher> types;
|
static HashMap<StringName,TypeInfo,StringNameHasher> types;
|
||||||
static HashMap<StringName,StringName,StringNameHasher> resource_base_extensions;
|
static HashMap<StringName,StringName,StringNameHasher> resource_base_extensions;
|
||||||
|
static HashMap<StringName,StringName,StringNameHasher> compat_types;
|
||||||
|
|
||||||
#ifdef DEBUG_METHODS_ENABLED
|
#ifdef DEBUG_METHODS_ENABLED
|
||||||
static MethodBind* bind_methodfi(uint32_t p_flags, MethodBind *p_bind , const MethodDefinition &method_name, const Variant **p_defs, int p_defcount);
|
static MethodBind* bind_methodfi(uint32_t p_flags, MethodBind *p_bind , const MethodDefinition &method_name, const Variant **p_defs, int p_defcount);
|
||||||
@ -482,6 +483,7 @@ public:
|
|||||||
static void get_resource_base_extensions(List<String> *p_extensions);
|
static void get_resource_base_extensions(List<String> *p_extensions);
|
||||||
static void get_extensions_for_type(const StringName& p_type,List<String> *p_extensions);
|
static void get_extensions_for_type(const StringName& p_type,List<String> *p_extensions);
|
||||||
|
|
||||||
|
static void add_compatibility_type(const StringName& p_type,const StringName& p_fallback);
|
||||||
static void init();
|
static void init();
|
||||||
static void cleanup();
|
static void cleanup();
|
||||||
};
|
};
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
#include "input.h"
|
#include "input.h"
|
||||||
#include "input_map.h"
|
#include "input_map.h"
|
||||||
#include "os/os.h"
|
#include "os/os.h"
|
||||||
|
#include "globals.h"
|
||||||
Input *Input::singleton=NULL;
|
Input *Input::singleton=NULL;
|
||||||
|
|
||||||
Input *Input::get_singleton() {
|
Input *Input::get_singleton() {
|
||||||
@ -69,6 +70,30 @@ void Input::_bind_methods() {
|
|||||||
ADD_SIGNAL( MethodInfo("joy_connection_changed", PropertyInfo(Variant::INT, "index"), PropertyInfo(Variant::BOOL, "connected")) );
|
ADD_SIGNAL( MethodInfo("joy_connection_changed", PropertyInfo(Variant::INT, "index"), PropertyInfo(Variant::BOOL, "connected")) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Input::get_argument_options(const StringName& p_function,int p_idx,List<String>*r_options) const {
|
||||||
|
#ifdef TOOLS_ENABLED
|
||||||
|
|
||||||
|
String pf=p_function;
|
||||||
|
if (p_idx==0 && (pf=="is_action_pressed" || pf=="action_press" || pf=="action_release")) {
|
||||||
|
|
||||||
|
List<PropertyInfo> pinfo;
|
||||||
|
Globals::get_singleton()->get_property_list(&pinfo);
|
||||||
|
|
||||||
|
for(List<PropertyInfo>::Element *E=pinfo.front();E;E=E->next()) {
|
||||||
|
const PropertyInfo &pi=E->get();
|
||||||
|
|
||||||
|
if (!pi.name.begins_with("input/"))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
String name = pi.name.substr(pi.name.find("/")+1,pi.name.length());
|
||||||
|
r_options->push_back("\""+name+"\"");
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
Input::Input() {
|
Input::Input() {
|
||||||
|
|
||||||
singleton=this;
|
singleton=this;
|
||||||
|
@ -76,6 +76,8 @@ public:
|
|||||||
virtual void action_press(const StringName& p_action)=0;
|
virtual void action_press(const StringName& p_action)=0;
|
||||||
virtual void action_release(const StringName& p_action)=0;
|
virtual void action_release(const StringName& p_action)=0;
|
||||||
|
|
||||||
|
void get_argument_options(const StringName& p_function,int p_idx,List<String>*r_options) const;
|
||||||
|
|
||||||
|
|
||||||
Input();
|
Input();
|
||||||
};
|
};
|
||||||
|
@ -353,3 +353,8 @@ int find_keycode(const String& p_code) {
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int latin_keyboard_keycode_convert(int p_keycode){
|
||||||
|
|
||||||
|
return p_keycode;
|
||||||
|
}
|
||||||
|
@ -328,5 +328,6 @@ enum KeyModifierMask {
|
|||||||
String keycode_get_string(uint32_t p_code);
|
String keycode_get_string(uint32_t p_code);
|
||||||
bool keycode_has_unicode(uint32_t p_unicode);
|
bool keycode_has_unicode(uint32_t p_unicode);
|
||||||
int find_keycode(const String& p_code);
|
int find_keycode(const String& p_code);
|
||||||
|
int latin_keyboard_keycode_convert(int p_keycode);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -485,6 +485,11 @@ void OS::set_time_scale(float p_scale) {
|
|||||||
_time_scale=p_scale;
|
_time_scale=p_scale;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
OS::LatinKeyboardVariant OS::get_latin_keyboard_variant() const {
|
||||||
|
|
||||||
|
return LATIN_KEYBOARD_QWERTY;
|
||||||
|
}
|
||||||
|
|
||||||
float OS::get_time_scale() const {
|
float OS::get_time_scale() const {
|
||||||
|
|
||||||
return _time_scale;
|
return _time_scale;
|
||||||
|
13
core/os/os.h
13
core/os/os.h
@ -34,6 +34,7 @@
|
|||||||
#include "vector.h"
|
#include "vector.h"
|
||||||
#include "os/main_loop.h"
|
#include "os/main_loop.h"
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@author Juan Linietsky <reduzio@gmail.com>
|
@author Juan Linietsky <reduzio@gmail.com>
|
||||||
*/
|
*/
|
||||||
@ -348,6 +349,18 @@ public:
|
|||||||
virtual Error dialog_input_text(String p_title, String p_description, String p_partial, Object* p_obj, String p_callback);
|
virtual Error dialog_input_text(String p_title, String p_description, String p_partial, Object* p_obj, String p_callback);
|
||||||
|
|
||||||
|
|
||||||
|
enum LatinKeyboardVariant {
|
||||||
|
LATIN_KEYBOARD_QWERTY,
|
||||||
|
LATIN_KEYBOARD_QWERTZ,
|
||||||
|
LATIN_KEYBOARD_AZERTY,
|
||||||
|
LATIN_KEYBOARD_QZERTY,
|
||||||
|
LATIN_KEYBOARD_DVORAK,
|
||||||
|
LATIN_KEYBOARD_NEO,
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
virtual LatinKeyboardVariant get_latin_keyboard_variant() const;
|
||||||
|
|
||||||
void set_time_scale(float p_scale);
|
void set_time_scale(float p_scale);
|
||||||
float get_time_scale() const;
|
float get_time_scale() const;
|
||||||
|
|
||||||
|
@ -550,7 +550,7 @@ StringName TranslationServer::translate(const StringName& p_message) const {
|
|||||||
continue; // locale not match
|
continue; // locale not match
|
||||||
|
|
||||||
//near match
|
//near match
|
||||||
bool match = (l!=lptr);
|
bool match = (l!=locale);
|
||||||
|
|
||||||
if (near_match && !match)
|
if (near_match && !match)
|
||||||
continue; //only near-match once
|
continue; //only near-match once
|
||||||
@ -570,6 +570,42 @@ StringName TranslationServer::translate(const StringName& p_message) const {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!res) {
|
||||||
|
//try again with fallback
|
||||||
|
if (fallback.length()>=2) {
|
||||||
|
|
||||||
|
const CharType *fptr=&fallback[0];
|
||||||
|
bool near_match=false;
|
||||||
|
for (const Set< Ref<Translation> >::Element *E=translations.front();E;E=E->next()) {
|
||||||
|
|
||||||
|
const Ref<Translation>& t = E->get();
|
||||||
|
String l = t->get_locale();
|
||||||
|
if (fptr[0]!=l[0] || fptr[1]!=l[1])
|
||||||
|
continue; // locale not match
|
||||||
|
|
||||||
|
//near match
|
||||||
|
bool match = (l!=fallback);
|
||||||
|
|
||||||
|
if (near_match && !match)
|
||||||
|
continue; //only near-match once
|
||||||
|
|
||||||
|
StringName r=t->get_message(p_message);
|
||||||
|
|
||||||
|
if (!r)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
res=r;
|
||||||
|
|
||||||
|
if (match)
|
||||||
|
break;
|
||||||
|
else
|
||||||
|
near_match=true;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (!res)
|
if (!res)
|
||||||
return p_message;
|
return p_message;
|
||||||
|
|
||||||
@ -604,9 +640,27 @@ bool TranslationServer::_load_translations(const String& p_from) {
|
|||||||
|
|
||||||
void TranslationServer::setup() {
|
void TranslationServer::setup() {
|
||||||
|
|
||||||
|
String test = GLOBAL_DEF("locale/test","");
|
||||||
|
test=test.strip_edges();
|
||||||
|
if (test!="")
|
||||||
|
set_locale( test );
|
||||||
|
else
|
||||||
|
set_locale( OS::get_singleton()->get_locale() );
|
||||||
|
fallback = GLOBAL_DEF("locale/fallback","en");
|
||||||
|
#ifdef TOOLS_ENABLED
|
||||||
|
|
||||||
set_locale( GLOBAL_DEF("locale/default",OS::get_singleton()->get_locale()) );
|
{
|
||||||
fallback = GLOBAL_DEF("locale/fallback","");
|
String options="";
|
||||||
|
int idx=0;
|
||||||
|
while(locale_list[idx]) {
|
||||||
|
if (idx>0)
|
||||||
|
options+=", ";
|
||||||
|
options+=locale_list[idx];
|
||||||
|
idx++;
|
||||||
|
}
|
||||||
|
Globals::get_singleton()->set_custom_property_info("locale/fallback",PropertyInfo(Variant::STRING,"locale/fallback",PROPERTY_HINT_ENUM,options));
|
||||||
|
}
|
||||||
|
#endif
|
||||||
//load translations
|
//load translations
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -629,6 +683,7 @@ void TranslationServer::load_translations() {
|
|||||||
|
|
||||||
String locale = get_locale();
|
String locale = get_locale();
|
||||||
bool found = _load_translations("locale/translations"); //all
|
bool found = _load_translations("locale/translations"); //all
|
||||||
|
|
||||||
if (_load_translations("locale/translations_"+locale.substr(0,2)))
|
if (_load_translations("locale/translations_"+locale.substr(0,2)))
|
||||||
found=true;
|
found=true;
|
||||||
if ( locale.substr(0,2) != locale ) {
|
if ( locale.substr(0,2) != locale ) {
|
||||||
@ -637,17 +692,6 @@ void TranslationServer::load_translations() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (!found && fallback!="") { //none found anywhere, use fallback
|
|
||||||
|
|
||||||
_load_translations("locale/translations_"+fallback.substr(0,2));
|
|
||||||
if ( fallback.substr(0,2) != fallback ) {
|
|
||||||
_load_translations("locale/translations_"+fallback);
|
|
||||||
}
|
|
||||||
|
|
||||||
this->locale=fallback;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TranslationServer::TranslationServer() {
|
TranslationServer::TranslationServer() {
|
||||||
|
@ -626,7 +626,7 @@ Vector<float> String::split_floats(const String &p_splitter,bool p_allow_empty)
|
|||||||
if (end<0)
|
if (end<0)
|
||||||
end=len;
|
end=len;
|
||||||
if (p_allow_empty || (end>from))
|
if (p_allow_empty || (end>from))
|
||||||
ret.push_back(String::to_double(&c_str()[from],end-from));
|
ret.push_back(String::to_double(&c_str()[from]));
|
||||||
|
|
||||||
if (end==len)
|
if (end==len)
|
||||||
break;
|
break;
|
||||||
@ -654,8 +654,9 @@ Vector<float> String::split_floats_mk(const Vector<String> &p_splitters,bool p_a
|
|||||||
spl_len=p_splitters[idx].length();
|
spl_len=p_splitters[idx].length();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (p_allow_empty || (end>from))
|
if (p_allow_empty || (end>from)) {
|
||||||
ret.push_back(String::to_double(&c_str()[from],end-from));
|
ret.push_back(String::to_double(&c_str()[from]));
|
||||||
|
}
|
||||||
|
|
||||||
if (end==len)
|
if (end==len)
|
||||||
break;
|
break;
|
||||||
@ -1959,8 +1960,10 @@ float String::to_float() const {
|
|||||||
return to_double();
|
return to_double();
|
||||||
}
|
}
|
||||||
|
|
||||||
double String::to_double(const CharType* p_str, int p_len, const CharType **r_end) {
|
double String::to_double(const CharType* p_str, const CharType **r_end) {
|
||||||
|
|
||||||
|
return built_in_strtod<CharType>(p_str,(CharType**)r_end);
|
||||||
|
#if 0
|
||||||
#if 0
|
#if 0
|
||||||
//ndef NO_USE_STDLIB
|
//ndef NO_USE_STDLIB
|
||||||
return wcstod(p_str,p_len<0?NULL:p_str+p_len);
|
return wcstod(p_str,p_len<0?NULL:p_str+p_len);
|
||||||
@ -2053,6 +2056,7 @@ double String::to_double(const CharType* p_str, int p_len, const CharType **r_en
|
|||||||
|
|
||||||
return sign*(integer+decimal)*Math::pow(10,exp_sign*exp);
|
return sign*(integer+decimal)*Math::pow(10,exp_sign*exp);
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t String::to_int(const CharType* p_str,int p_len) {
|
int64_t String::to_int(const CharType* p_str,int p_len) {
|
||||||
@ -3437,7 +3441,7 @@ String String::percent_encode() const {
|
|||||||
uint8_t c = cs[i];
|
uint8_t c = cs[i];
|
||||||
if ( (c>='A' && c<='Z') || (c>='a' && c<='z') || (c>='0' && c<='9') || c=='-' || c=='_' || c=='~' || c=='.') {
|
if ( (c>='A' && c<='Z') || (c>='a' && c<='z') || (c>='0' && c<='9') || c=='-' || c=='_' || c=='~' || c=='.') {
|
||||||
|
|
||||||
char p[2]={c,0};
|
char p[2]={(char)c,0};
|
||||||
encoded+=p;
|
encoded+=p;
|
||||||
} else {
|
} else {
|
||||||
char p[4]={'%',0,0,0};
|
char p[4]={'%',0,0,0};
|
||||||
|
@ -142,7 +142,7 @@ public:
|
|||||||
int64_t to_int64() const;
|
int64_t to_int64() const;
|
||||||
static int to_int(const char* p_str);
|
static int to_int(const char* p_str);
|
||||||
static double to_double(const char* p_str);
|
static double to_double(const char* p_str);
|
||||||
static double to_double(const CharType* p_str, int p_len=-1, const CharType **r_end=NULL);
|
static double to_double(const CharType* p_str, const CharType **r_end=NULL);
|
||||||
static int64_t to_int(const CharType* p_str,int p_len=-1);
|
static int64_t to_int(const CharType* p_str,int p_len=-1);
|
||||||
String capitalize() const;
|
String capitalize() const;
|
||||||
|
|
||||||
|
@ -922,20 +922,30 @@ void Variant::set(const Variant& p_index, const Variant& p_value, bool *r_valid)
|
|||||||
case REAL: { return; } break;
|
case REAL: { return; } break;
|
||||||
case STRING: {
|
case STRING: {
|
||||||
|
|
||||||
if (p_value.type!=Variant::STRING)
|
|
||||||
|
if (p_index.type!=Variant::INT && p_index.type!=Variant::REAL)
|
||||||
return;
|
return;
|
||||||
if (p_index.get_type()==Variant::INT || p_index.get_type()==Variant::REAL) {
|
|
||||||
//string index
|
|
||||||
|
|
||||||
int idx=p_index;
|
int idx=p_index;
|
||||||
String *str=reinterpret_cast<String*>(_data._mem);
|
String *str=reinterpret_cast<String*>(_data._mem);
|
||||||
if (idx >=0 && idx<str->length()) {
|
if (idx <0 || idx>=str->length())
|
||||||
String chr = p_value;
|
return;
|
||||||
|
|
||||||
|
String chr;
|
||||||
|
if (p_value.type==Variant::INT || p_value.type==Variant::REAL) {
|
||||||
|
|
||||||
|
chr = String::chr(p_value);
|
||||||
|
} else if (p_value.type==Variant::STRING) {
|
||||||
|
|
||||||
|
chr = p_value;
|
||||||
|
} else {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
*str = str->substr(0,idx-1)+chr+str->substr(idx+1,str->length());
|
*str = str->substr(0,idx-1)+chr+str->substr(idx+1,str->length());
|
||||||
valid=true;
|
valid=true;
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case VECTOR2: {
|
case VECTOR2: {
|
||||||
@ -951,7 +961,7 @@ void Variant::set(const Variant& p_index, const Variant& p_value, bool *r_valid)
|
|||||||
|
|
||||||
Vector2 *v=reinterpret_cast<Vector2*>(_data._mem);
|
Vector2 *v=reinterpret_cast<Vector2*>(_data._mem);
|
||||||
valid=true;
|
valid=true;
|
||||||
v[idx]=p_value;
|
(*v)[idx]=p_value;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else if (p_index.get_type()==Variant::STRING) {
|
} else if (p_index.get_type()==Variant::STRING) {
|
||||||
@ -1045,7 +1055,7 @@ void Variant::set(const Variant& p_index, const Variant& p_value, bool *r_valid)
|
|||||||
|
|
||||||
Vector3 *v=reinterpret_cast<Vector3*>(_data._mem);
|
Vector3 *v=reinterpret_cast<Vector3*>(_data._mem);
|
||||||
valid=true;
|
valid=true;
|
||||||
v[idx]=p_value;
|
(*v)[idx]=p_value;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else if (p_index.get_type()==Variant::STRING) {
|
} else if (p_index.get_type()==Variant::STRING) {
|
||||||
|
@ -53,12 +53,15 @@ var enemy
|
|||||||
|
|
||||||
func _integrate_forces(s):
|
func _integrate_forces(s):
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
var lv = s.get_linear_velocity()
|
var lv = s.get_linear_velocity()
|
||||||
var step = s.get_step()
|
var step = s.get_step()
|
||||||
|
|
||||||
var new_anim=anim
|
var new_anim=anim
|
||||||
var new_siding_left=siding_left
|
var new_siding_left=siding_left
|
||||||
|
|
||||||
|
|
||||||
# Get the controls
|
# Get the controls
|
||||||
var move_left = Input.is_action_pressed("move_left")
|
var move_left = Input.is_action_pressed("move_left")
|
||||||
var move_right = Input.is_action_pressed("move_right")
|
var move_right = Input.is_action_pressed("move_right")
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" ?>
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
<resource_file type="PackedScene" subresource_count="24" version="1.0" version_name="Godot Engine v1.0.3917-beta1">
|
<resource_file type="PackedScene" subresource_count="24" version="1.0" version_name="Godot Engine v1.0.rc2.custom_build">
|
||||||
<ext_resource path="res://osb_jump.png" type="Texture"></ext_resource>
|
<ext_resource path="res://osb_jump.png" type="Texture"></ext_resource>
|
||||||
<ext_resource path="res://bullet.png" type="Texture"></ext_resource>
|
<ext_resource path="res://bullet.png" type="Texture"></ext_resource>
|
||||||
<ext_resource path="res://osb_right.png" type="Texture"></ext_resource>
|
<ext_resource path="res://osb_right.png" type="Texture"></ext_resource>
|
||||||
<ext_resource path="res://sound_coin.wav" type="Sample"></ext_resource>
|
<ext_resource path="res://sound_coin.wav" type="Sample"></ext_resource>
|
||||||
<ext_resource path="res://sound_shoot.wav" type="Sample"></ext_resource>
|
|
||||||
<ext_resource path="res://osb_fire.png" type="Texture"></ext_resource>
|
<ext_resource path="res://osb_fire.png" type="Texture"></ext_resource>
|
||||||
<ext_resource path="res://robot_demo.png" type="Texture"></ext_resource>
|
<ext_resource path="res://sound_shoot.wav" type="Sample"></ext_resource>
|
||||||
<ext_resource path="res://osb_left.png" type="Texture"></ext_resource>
|
<ext_resource path="res://osb_left.png" type="Texture"></ext_resource>
|
||||||
|
<ext_resource path="res://robot_demo.png" type="Texture"></ext_resource>
|
||||||
<ext_resource path="res://player.gd" type="Script"></ext_resource>
|
<ext_resource path="res://player.gd" type="Script"></ext_resource>
|
||||||
<ext_resource path="res://sound_jump.wav" type="Sample"></ext_resource>
|
<ext_resource path="res://sound_jump.wav" type="Sample"></ext_resource>
|
||||||
<resource type="RayShape2D" path="local://1">
|
<resource type="RayShape2D" path="local://1">
|
||||||
@ -50,7 +50,52 @@
|
|||||||
|
|
||||||
</resource>
|
</resource>
|
||||||
<resource type="Animation" path="local://4">
|
<resource type="Animation" path="local://4">
|
||||||
<string name="resource/name"> "run" </string>
|
<string name="resource/name"> "jumping" </string>
|
||||||
|
<real name="length"> 0.5 </real>
|
||||||
|
<bool name="loop"> True </bool>
|
||||||
|
<real name="step"> 0.25 </real>
|
||||||
|
<string name="tracks/0/type"> "value" </string>
|
||||||
|
<node_path name="tracks/0/path"> "sprite:frame" </node_path>
|
||||||
|
<int name="tracks/0/interp"> 1 </int>
|
||||||
|
<dictionary name="tracks/0/keys" shared="false">
|
||||||
|
<string> "cont" </string>
|
||||||
|
<bool> False </bool>
|
||||||
|
<string> "transitions" </string>
|
||||||
|
<real_array len="3"> 1, 1, 1 </real_array>
|
||||||
|
<string> "values" </string>
|
||||||
|
<array len="3" shared="false">
|
||||||
|
<int> 23 </int>
|
||||||
|
<int> 24 </int>
|
||||||
|
<int> 23 </int>
|
||||||
|
</array>
|
||||||
|
<string> "times" </string>
|
||||||
|
<real_array len="3"> 0, 0.25, 0.5 </real_array>
|
||||||
|
</dictionary>
|
||||||
|
|
||||||
|
</resource>
|
||||||
|
<resource type="Animation" path="local://5">
|
||||||
|
<string name="resource/name"> "idle_weapon" </string>
|
||||||
|
<real name="length"> 0.5 </real>
|
||||||
|
<bool name="loop"> True </bool>
|
||||||
|
<real name="step"> 0.25 </real>
|
||||||
|
<string name="tracks/0/type"> "value" </string>
|
||||||
|
<node_path name="tracks/0/path"> "sprite:frame" </node_path>
|
||||||
|
<int name="tracks/0/interp"> 1 </int>
|
||||||
|
<dictionary name="tracks/0/keys" shared="false">
|
||||||
|
<string> "cont" </string>
|
||||||
|
<bool> False </bool>
|
||||||
|
<string> "transitions" </string>
|
||||||
|
<real_array len="1"> 1 </real_array>
|
||||||
|
<string> "values" </string>
|
||||||
|
<array len="1" shared="false">
|
||||||
|
<int> 25 </int>
|
||||||
|
</array>
|
||||||
|
<string> "times" </string>
|
||||||
|
<real_array len="1"> 0 </real_array>
|
||||||
|
</dictionary>
|
||||||
|
|
||||||
|
</resource>
|
||||||
|
<resource type="Animation" path="local://6">
|
||||||
<real name="length"> 1.25 </real>
|
<real name="length"> 1.25 </real>
|
||||||
<bool name="loop"> True </bool>
|
<bool name="loop"> True </bool>
|
||||||
<real name="step"> 0.25 </real>
|
<real name="step"> 0.25 </real>
|
||||||
@ -75,55 +120,6 @@
|
|||||||
<real_array len="6"> 0, 0.25, 0.5, 0.75, 1, 1.25 </real_array>
|
<real_array len="6"> 0, 0.25, 0.5, 0.75, 1, 1.25 </real_array>
|
||||||
</dictionary>
|
</dictionary>
|
||||||
|
|
||||||
</resource>
|
|
||||||
<resource type="Animation" path="local://5">
|
|
||||||
<string name="resource/name"> "run_gun_fire" </string>
|
|
||||||
<real name="length"> 1.25 </real>
|
|
||||||
<bool name="loop"> True </bool>
|
|
||||||
<real name="step"> 0.25 </real>
|
|
||||||
<string name="tracks/0/type"> "value" </string>
|
|
||||||
<node_path name="tracks/0/path"> "sprite:frame" </node_path>
|
|
||||||
<int name="tracks/0/interp"> 1 </int>
|
|
||||||
<dictionary name="tracks/0/keys" shared="false">
|
|
||||||
<string> "cont" </string>
|
|
||||||
<bool> False </bool>
|
|
||||||
<string> "transitions" </string>
|
|
||||||
<real_array len="6"> 1, 1, 1, 1, 1, 1 </real_array>
|
|
||||||
<string> "values" </string>
|
|
||||||
<array len="6" shared="false">
|
|
||||||
<int> 10 </int>
|
|
||||||
<int> 11 </int>
|
|
||||||
<int> 12 </int>
|
|
||||||
<int> 13 </int>
|
|
||||||
<int> 14 </int>
|
|
||||||
<int> 5 </int>
|
|
||||||
</array>
|
|
||||||
<string> "times" </string>
|
|
||||||
<real_array len="6"> 0, 0.25, 0.5, 0.75, 1, 1.25 </real_array>
|
|
||||||
</dictionary>
|
|
||||||
|
|
||||||
</resource>
|
|
||||||
<resource type="Animation" path="local://6">
|
|
||||||
<string name="resource/name"> "jumping_weapon" </string>
|
|
||||||
<real name="length"> 0.5 </real>
|
|
||||||
<bool name="loop"> True </bool>
|
|
||||||
<real name="step"> 0.25 </real>
|
|
||||||
<string name="tracks/0/type"> "value" </string>
|
|
||||||
<node_path name="tracks/0/path"> "sprite:frame" </node_path>
|
|
||||||
<int name="tracks/0/interp"> 1 </int>
|
|
||||||
<dictionary name="tracks/0/keys" shared="false">
|
|
||||||
<string> "cont" </string>
|
|
||||||
<bool> False </bool>
|
|
||||||
<string> "transitions" </string>
|
|
||||||
<real_array len="1"> 1 </real_array>
|
|
||||||
<string> "values" </string>
|
|
||||||
<array len="1" shared="false">
|
|
||||||
<int> 26 </int>
|
|
||||||
</array>
|
|
||||||
<string> "times" </string>
|
|
||||||
<real_array len="1"> 0 </real_array>
|
|
||||||
</dictionary>
|
|
||||||
|
|
||||||
</resource>
|
</resource>
|
||||||
<resource type="Animation" path="local://7">
|
<resource type="Animation" path="local://7">
|
||||||
<string name="resource/name"> "crouch" </string>
|
<string name="resource/name"> "crouch" </string>
|
||||||
@ -148,7 +144,55 @@
|
|||||||
|
|
||||||
</resource>
|
</resource>
|
||||||
<resource type="Animation" path="local://8">
|
<resource type="Animation" path="local://8">
|
||||||
<string name="resource/name"> "jumping" </string>
|
<string name="resource/name"> "falling" </string>
|
||||||
|
<real name="length"> 0.01 </real>
|
||||||
|
<bool name="loop"> True </bool>
|
||||||
|
<real name="step"> 0.25 </real>
|
||||||
|
<string name="tracks/0/type"> "value" </string>
|
||||||
|
<node_path name="tracks/0/path"> "sprite:frame" </node_path>
|
||||||
|
<int name="tracks/0/interp"> 1 </int>
|
||||||
|
<dictionary name="tracks/0/keys" shared="false">
|
||||||
|
<string> "cont" </string>
|
||||||
|
<bool> False </bool>
|
||||||
|
<string> "transitions" </string>
|
||||||
|
<real_array len="1"> 1 </real_array>
|
||||||
|
<string> "values" </string>
|
||||||
|
<array len="1" shared="false">
|
||||||
|
<int> 21 </int>
|
||||||
|
</array>
|
||||||
|
<string> "times" </string>
|
||||||
|
<real_array len="1"> 0 </real_array>
|
||||||
|
</dictionary>
|
||||||
|
|
||||||
|
</resource>
|
||||||
|
<resource type="Animation" path="local://9">
|
||||||
|
<real name="length"> 1.25 </real>
|
||||||
|
<bool name="loop"> True </bool>
|
||||||
|
<real name="step"> 0.25 </real>
|
||||||
|
<string name="tracks/0/type"> "value" </string>
|
||||||
|
<node_path name="tracks/0/path"> "sprite:frame" </node_path>
|
||||||
|
<int name="tracks/0/interp"> 1 </int>
|
||||||
|
<dictionary name="tracks/0/keys" shared="false">
|
||||||
|
<string> "cont" </string>
|
||||||
|
<bool> False </bool>
|
||||||
|
<string> "transitions" </string>
|
||||||
|
<real_array len="6"> 1, 1, 1, 1, 1, 1 </real_array>
|
||||||
|
<string> "values" </string>
|
||||||
|
<array len="6" shared="false">
|
||||||
|
<int> 10 </int>
|
||||||
|
<int> 11 </int>
|
||||||
|
<int> 12 </int>
|
||||||
|
<int> 13 </int>
|
||||||
|
<int> 14 </int>
|
||||||
|
<int> 5 </int>
|
||||||
|
</array>
|
||||||
|
<string> "times" </string>
|
||||||
|
<real_array len="6"> 0, 0.25, 0.5, 0.75, 1, 1.25 </real_array>
|
||||||
|
</dictionary>
|
||||||
|
|
||||||
|
</resource>
|
||||||
|
<resource type="Animation" path="local://10">
|
||||||
|
<string name="resource/name"> "falling_weapon" </string>
|
||||||
<real name="length"> 0.5 </real>
|
<real name="length"> 0.5 </real>
|
||||||
<bool name="loop"> True </bool>
|
<bool name="loop"> True </bool>
|
||||||
<real name="step"> 0.25 </real>
|
<real name="step"> 0.25 </real>
|
||||||
@ -159,20 +203,17 @@
|
|||||||
<string> "cont" </string>
|
<string> "cont" </string>
|
||||||
<bool> False </bool>
|
<bool> False </bool>
|
||||||
<string> "transitions" </string>
|
<string> "transitions" </string>
|
||||||
<real_array len="3"> 1, 1, 1 </real_array>
|
<real_array len="1"> 1 </real_array>
|
||||||
<string> "values" </string>
|
<string> "values" </string>
|
||||||
<array len="3" shared="false">
|
<array len="1" shared="false">
|
||||||
<int> 23 </int>
|
<int> 26 </int>
|
||||||
<int> 24 </int>
|
|
||||||
<int> 23 </int>
|
|
||||||
</array>
|
</array>
|
||||||
<string> "times" </string>
|
<string> "times" </string>
|
||||||
<real_array len="3"> 0, 0.25, 0.5 </real_array>
|
<real_array len="1"> 0 </real_array>
|
||||||
</dictionary>
|
</dictionary>
|
||||||
|
|
||||||
</resource>
|
</resource>
|
||||||
<resource type="Animation" path="local://9">
|
<resource type="Animation" path="local://11">
|
||||||
<string name="resource/name"> "run_weapon" </string>
|
|
||||||
<real name="length"> 1.25 </real>
|
<real name="length"> 1.25 </real>
|
||||||
<bool name="loop"> True </bool>
|
<bool name="loop"> True </bool>
|
||||||
<real name="step"> 0.25 </real>
|
<real name="step"> 0.25 </real>
|
||||||
@ -198,30 +239,7 @@
|
|||||||
</dictionary>
|
</dictionary>
|
||||||
|
|
||||||
</resource>
|
</resource>
|
||||||
<resource type="Animation" path="local://10">
|
<resource type="Animation" path="local://12">
|
||||||
<string name="resource/name"> "idle_weapon" </string>
|
|
||||||
<real name="length"> 0.5 </real>
|
|
||||||
<bool name="loop"> True </bool>
|
|
||||||
<real name="step"> 0.25 </real>
|
|
||||||
<string name="tracks/0/type"> "value" </string>
|
|
||||||
<node_path name="tracks/0/path"> "sprite:frame" </node_path>
|
|
||||||
<int name="tracks/0/interp"> 1 </int>
|
|
||||||
<dictionary name="tracks/0/keys" shared="false">
|
|
||||||
<string> "cont" </string>
|
|
||||||
<bool> False </bool>
|
|
||||||
<string> "transitions" </string>
|
|
||||||
<real_array len="1"> 1 </real_array>
|
|
||||||
<string> "values" </string>
|
|
||||||
<array len="1" shared="false">
|
|
||||||
<int> 25 </int>
|
|
||||||
</array>
|
|
||||||
<string> "times" </string>
|
|
||||||
<real_array len="1"> 0 </real_array>
|
|
||||||
</dictionary>
|
|
||||||
|
|
||||||
</resource>
|
|
||||||
<resource type="Animation" path="local://11">
|
|
||||||
<string name="resource/name"> "falling_weapon" </string>
|
|
||||||
<real name="length"> 0.5 </real>
|
<real name="length"> 0.5 </real>
|
||||||
<bool name="loop"> True </bool>
|
<bool name="loop"> True </bool>
|
||||||
<real name="step"> 0.25 </real>
|
<real name="step"> 0.25 </real>
|
||||||
@ -241,28 +259,6 @@
|
|||||||
<real_array len="1"> 0 </real_array>
|
<real_array len="1"> 0 </real_array>
|
||||||
</dictionary>
|
</dictionary>
|
||||||
|
|
||||||
</resource>
|
|
||||||
<resource type="Animation" path="local://12">
|
|
||||||
<string name="resource/name"> "falling" </string>
|
|
||||||
<real name="length"> 0.01 </real>
|
|
||||||
<bool name="loop"> True </bool>
|
|
||||||
<real name="step"> 0.25 </real>
|
|
||||||
<string name="tracks/0/type"> "value" </string>
|
|
||||||
<node_path name="tracks/0/path"> "sprite:frame" </node_path>
|
|
||||||
<int name="tracks/0/interp"> 1 </int>
|
|
||||||
<dictionary name="tracks/0/keys" shared="false">
|
|
||||||
<string> "cont" </string>
|
|
||||||
<bool> False </bool>
|
|
||||||
<string> "transitions" </string>
|
|
||||||
<real_array len="1"> 1 </real_array>
|
|
||||||
<string> "values" </string>
|
|
||||||
<array len="1" shared="false">
|
|
||||||
<int> 21 </int>
|
|
||||||
</array>
|
|
||||||
<string> "times" </string>
|
|
||||||
<real_array len="1"> 0 </real_array>
|
|
||||||
</dictionary>
|
|
||||||
|
|
||||||
</resource>
|
</resource>
|
||||||
<resource type="SampleLibrary" path="local://13">
|
<resource type="SampleLibrary" path="local://13">
|
||||||
<dictionary name="samples/jump" shared="false">
|
<dictionary name="samples/jump" shared="false">
|
||||||
@ -294,9 +290,10 @@
|
|||||||
<main_resource>
|
<main_resource>
|
||||||
<dictionary name="_bundled" shared="false">
|
<dictionary name="_bundled" shared="false">
|
||||||
<string> "names" </string>
|
<string> "names" </string>
|
||||||
<string_array len="170">
|
<string_array len="180">
|
||||||
<string> "player" </string>
|
<string> "player" </string>
|
||||||
<string> "RigidBody2D" </string>
|
<string> "RigidBody2D" </string>
|
||||||
|
<string> "_import_path" </string>
|
||||||
<string> "visibility/visible" </string>
|
<string> "visibility/visible" </string>
|
||||||
<string> "visibility/opacity" </string>
|
<string> "visibility/opacity" </string>
|
||||||
<string> "visibility/self_opacity" </string>
|
<string> "visibility/self_opacity" </string>
|
||||||
@ -311,6 +308,7 @@
|
|||||||
<string> "shapes/1/shape" </string>
|
<string> "shapes/1/shape" </string>
|
||||||
<string> "shapes/1/transform" </string>
|
<string> "shapes/1/transform" </string>
|
||||||
<string> "shapes/1/trigger" </string>
|
<string> "shapes/1/trigger" </string>
|
||||||
|
<string> "layers" </string>
|
||||||
<string> "mode" </string>
|
<string> "mode" </string>
|
||||||
<string> "mass" </string>
|
<string> "mass" </string>
|
||||||
<string> "friction" </string>
|
<string> "friction" </string>
|
||||||
@ -319,7 +317,7 @@
|
|||||||
<string> "continuous_cd" </string>
|
<string> "continuous_cd" </string>
|
||||||
<string> "contacts_reported" </string>
|
<string> "contacts_reported" </string>
|
||||||
<string> "contact_monitor" </string>
|
<string> "contact_monitor" </string>
|
||||||
<string> "active" </string>
|
<string> "sleeping" </string>
|
||||||
<string> "can_sleep" </string>
|
<string> "can_sleep" </string>
|
||||||
<string> "velocity/linear" </string>
|
<string> "velocity/linear" </string>
|
||||||
<string> "velocity/angular" </string>
|
<string> "velocity/angular" </string>
|
||||||
@ -354,6 +352,8 @@
|
|||||||
<string> "config/flip_h" </string>
|
<string> "config/flip_h" </string>
|
||||||
<string> "config/flip_v" </string>
|
<string> "config/flip_v" </string>
|
||||||
<string> "config/texture" </string>
|
<string> "config/texture" </string>
|
||||||
|
<string> "config/h_frames" </string>
|
||||||
|
<string> "config/v_frames" </string>
|
||||||
<string> "params/direction" </string>
|
<string> "params/direction" </string>
|
||||||
<string> "params/spread" </string>
|
<string> "params/spread" </string>
|
||||||
<string> "params/linear_velocity" </string>
|
<string> "params/linear_velocity" </string>
|
||||||
@ -364,9 +364,12 @@
|
|||||||
<string> "params/radial_accel" </string>
|
<string> "params/radial_accel" </string>
|
||||||
<string> "params/tangential_accel" </string>
|
<string> "params/tangential_accel" </string>
|
||||||
<string> "params/damping" </string>
|
<string> "params/damping" </string>
|
||||||
|
<string> "params/initial_angle" </string>
|
||||||
<string> "params/initial_size" </string>
|
<string> "params/initial_size" </string>
|
||||||
<string> "params/final_size" </string>
|
<string> "params/final_size" </string>
|
||||||
<string> "params/hue_variation" </string>
|
<string> "params/hue_variation" </string>
|
||||||
|
<string> "params/anim_speed_scale" </string>
|
||||||
|
<string> "params/anim_initial_pos" </string>
|
||||||
<string> "randomness/direction" </string>
|
<string> "randomness/direction" </string>
|
||||||
<string> "randomness/spread" </string>
|
<string> "randomness/spread" </string>
|
||||||
<string> "randomness/linear_velocity" </string>
|
<string> "randomness/linear_velocity" </string>
|
||||||
@ -377,9 +380,12 @@
|
|||||||
<string> "randomness/radial_accel" </string>
|
<string> "randomness/radial_accel" </string>
|
||||||
<string> "randomness/tangential_accel" </string>
|
<string> "randomness/tangential_accel" </string>
|
||||||
<string> "randomness/damping" </string>
|
<string> "randomness/damping" </string>
|
||||||
|
<string> "randomness/initial_angle" </string>
|
||||||
<string> "randomness/initial_size" </string>
|
<string> "randomness/initial_size" </string>
|
||||||
<string> "randomness/final_size" </string>
|
<string> "randomness/final_size" </string>
|
||||||
<string> "randomness/hue_variation" </string>
|
<string> "randomness/hue_variation" </string>
|
||||||
|
<string> "randomness/anim_speed_scale" </string>
|
||||||
|
<string> "randomness/anim_initial_pos" </string>
|
||||||
<string> "color_phases/count" </string>
|
<string> "color_phases/count" </string>
|
||||||
<string> "phase_0/pos" </string>
|
<string> "phase_0/pos" </string>
|
||||||
<string> "phase_0/color" </string>
|
<string> "phase_0/color" </string>
|
||||||
@ -396,15 +402,15 @@
|
|||||||
<string> "playback/default_blend_time" </string>
|
<string> "playback/default_blend_time" </string>
|
||||||
<string> "root/root" </string>
|
<string> "root/root" </string>
|
||||||
<string> "anims/idle" </string>
|
<string> "anims/idle" </string>
|
||||||
<string> "anims/run" </string>
|
|
||||||
<string> "anims/standing_weapon_ready" </string>
|
|
||||||
<string> "anims/jumping_weapon" </string>
|
|
||||||
<string> "anims/crouch" </string>
|
|
||||||
<string> "anims/jumping" </string>
|
<string> "anims/jumping" </string>
|
||||||
<string> "anims/run_weapon" </string>
|
|
||||||
<string> "anims/idle_weapon" </string>
|
<string> "anims/idle_weapon" </string>
|
||||||
<string> "anims/falling_weapon" </string>
|
<string> "anims/run" </string>
|
||||||
|
<string> "anims/crouch" </string>
|
||||||
<string> "anims/falling" </string>
|
<string> "anims/falling" </string>
|
||||||
|
<string> "anims/standing_weapon_ready" </string>
|
||||||
|
<string> "anims/falling_weapon" </string>
|
||||||
|
<string> "anims/run_weapon" </string>
|
||||||
|
<string> "anims/jumping_weapon" </string>
|
||||||
<string> "playback/active" </string>
|
<string> "playback/active" </string>
|
||||||
<string> "playback/speed" </string>
|
<string> "playback/speed" </string>
|
||||||
<string> "blend_times" </string>
|
<string> "blend_times" </string>
|
||||||
@ -473,7 +479,8 @@
|
|||||||
<string> "node_count" </string>
|
<string> "node_count" </string>
|
||||||
<int> 14 </int>
|
<int> 14 </int>
|
||||||
<string> "variants" </string>
|
<string> "variants" </string>
|
||||||
<array len="71" shared="false">
|
<array len="72" shared="false">
|
||||||
|
<node_path> "" </node_path>
|
||||||
<bool> True </bool>
|
<bool> True </bool>
|
||||||
<real> 1 </real>
|
<real> 1 </real>
|
||||||
<bool> False </bool>
|
<bool> False </bool>
|
||||||
@ -485,6 +492,7 @@
|
|||||||
<matrix32> 1, -0, 0, 1.76469, 0.291992, -12.1587 </matrix32>
|
<matrix32> 1, -0, 0, 1.76469, 0.291992, -12.1587 </matrix32>
|
||||||
<resource resource_type="Shape2D" path="local://2"> </resource>
|
<resource resource_type="Shape2D" path="local://2"> </resource>
|
||||||
<matrix32> 1, -0, 0, 1, 0, 0 </matrix32>
|
<matrix32> 1, -0, 0, 1, 0, 0 </matrix32>
|
||||||
|
<int> 1 </int>
|
||||||
<real> 3 </real>
|
<real> 3 </real>
|
||||||
<int> 0 </int>
|
<int> 0 </int>
|
||||||
<int> 3 </int>
|
<int> 3 </int>
|
||||||
@ -507,11 +515,17 @@
|
|||||||
<bool> False </bool>
|
<bool> False </bool>
|
||||||
<string> "zoom" </string>
|
<string> "zoom" </string>
|
||||||
<real> 2.272073 </real>
|
<real> 2.272073 </real>
|
||||||
|
<string> "use_snap" </string>
|
||||||
|
<bool> False </bool>
|
||||||
<string> "ofs" </string>
|
<string> "ofs" </string>
|
||||||
<vector2> -181.946, -86.2812 </vector2>
|
<vector2> -181.946, -86.2812 </vector2>
|
||||||
|
<string> "snap" </string>
|
||||||
|
<int> 10 </int>
|
||||||
</dictionary>
|
</dictionary>
|
||||||
<string> "3D" </string>
|
<string> "3D" </string>
|
||||||
<dictionary shared="false">
|
<dictionary shared="false">
|
||||||
|
<string> "deflight_rot_y" </string>
|
||||||
|
<real> 0.628319 </real>
|
||||||
<string> "zfar" </string>
|
<string> "zfar" </string>
|
||||||
<real> 500 </real>
|
<real> 500 </real>
|
||||||
<string> "fov" </string>
|
<string> "fov" </string>
|
||||||
@ -525,10 +539,12 @@
|
|||||||
<real> 0 </real>
|
<real> 0 </real>
|
||||||
<string> "y_rot" </string>
|
<string> "y_rot" </string>
|
||||||
<real> 0 </real>
|
<real> 0 </real>
|
||||||
<string> "use_orthogonal" </string>
|
<string> "listener" </string>
|
||||||
<bool> False </bool>
|
<bool> True </bool>
|
||||||
<string> "use_environment" </string>
|
<string> "use_environment" </string>
|
||||||
<bool> False </bool>
|
<bool> False </bool>
|
||||||
|
<string> "use_orthogonal" </string>
|
||||||
|
<bool> False </bool>
|
||||||
<string> "pos" </string>
|
<string> "pos" </string>
|
||||||
<vector3> 0, 0, 0 </vector3>
|
<vector3> 0, 0, 0 </vector3>
|
||||||
</dictionary>
|
</dictionary>
|
||||||
@ -539,10 +555,12 @@
|
|||||||
<real> 0 </real>
|
<real> 0 </real>
|
||||||
<string> "y_rot" </string>
|
<string> "y_rot" </string>
|
||||||
<real> 0 </real>
|
<real> 0 </real>
|
||||||
<string> "use_orthogonal" </string>
|
<string> "listener" </string>
|
||||||
<bool> False </bool>
|
<bool> False </bool>
|
||||||
<string> "use_environment" </string>
|
<string> "use_environment" </string>
|
||||||
<bool> False </bool>
|
<bool> False </bool>
|
||||||
|
<string> "use_orthogonal" </string>
|
||||||
|
<bool> False </bool>
|
||||||
<string> "pos" </string>
|
<string> "pos" </string>
|
||||||
<vector3> 0, 0, 0 </vector3>
|
<vector3> 0, 0, 0 </vector3>
|
||||||
</dictionary>
|
</dictionary>
|
||||||
@ -553,10 +571,12 @@
|
|||||||
<real> 0 </real>
|
<real> 0 </real>
|
||||||
<string> "y_rot" </string>
|
<string> "y_rot" </string>
|
||||||
<real> 0 </real>
|
<real> 0 </real>
|
||||||
<string> "use_orthogonal" </string>
|
<string> "listener" </string>
|
||||||
<bool> False </bool>
|
<bool> False </bool>
|
||||||
<string> "use_environment" </string>
|
<string> "use_environment" </string>
|
||||||
<bool> False </bool>
|
<bool> False </bool>
|
||||||
|
<string> "use_orthogonal" </string>
|
||||||
|
<bool> False </bool>
|
||||||
<string> "pos" </string>
|
<string> "pos" </string>
|
||||||
<vector3> 0, 0, 0 </vector3>
|
<vector3> 0, 0, 0 </vector3>
|
||||||
</dictionary>
|
</dictionary>
|
||||||
@ -567,10 +587,12 @@
|
|||||||
<real> 0 </real>
|
<real> 0 </real>
|
||||||
<string> "y_rot" </string>
|
<string> "y_rot" </string>
|
||||||
<real> 0 </real>
|
<real> 0 </real>
|
||||||
<string> "use_orthogonal" </string>
|
<string> "listener" </string>
|
||||||
<bool> False </bool>
|
<bool> False </bool>
|
||||||
<string> "use_environment" </string>
|
<string> "use_environment" </string>
|
||||||
<bool> False </bool>
|
<bool> False </bool>
|
||||||
|
<string> "use_orthogonal" </string>
|
||||||
|
<bool> False </bool>
|
||||||
<string> "pos" </string>
|
<string> "pos" </string>
|
||||||
<vector3> 0, 0, 0 </vector3>
|
<vector3> 0, 0, 0 </vector3>
|
||||||
</dictionary>
|
</dictionary>
|
||||||
@ -579,12 +601,18 @@
|
|||||||
<int> 1 </int>
|
<int> 1 </int>
|
||||||
<string> "default_light" </string>
|
<string> "default_light" </string>
|
||||||
<bool> True </bool>
|
<bool> True </bool>
|
||||||
|
<string> "ambient_light_color" </string>
|
||||||
|
<color> 0.15, 0.15, 0.15, 1 </color>
|
||||||
<string> "show_grid" </string>
|
<string> "show_grid" </string>
|
||||||
<bool> True </bool>
|
<bool> True </bool>
|
||||||
<string> "show_origin" </string>
|
<string> "show_origin" </string>
|
||||||
<bool> True </bool>
|
<bool> True </bool>
|
||||||
<string> "znear" </string>
|
<string> "znear" </string>
|
||||||
<real> 0.1 </real>
|
<real> 0.1 </real>
|
||||||
|
<string> "default_srgb" </string>
|
||||||
|
<bool> False </bool>
|
||||||
|
<string> "deflight_rot_x" </string>
|
||||||
|
<real> 0.942478 </real>
|
||||||
</dictionary>
|
</dictionary>
|
||||||
</dictionary>
|
</dictionary>
|
||||||
<string> "__editor_run_settings__" </string>
|
<string> "__editor_run_settings__" </string>
|
||||||
@ -595,14 +623,13 @@
|
|||||||
<int> 0 </int>
|
<int> 0 </int>
|
||||||
</dictionary>
|
</dictionary>
|
||||||
<string> "__editor_plugin_screen__" </string>
|
<string> "__editor_plugin_screen__" </string>
|
||||||
<string> "3D" </string>
|
<string> "Script" </string>
|
||||||
</dictionary>
|
</dictionary>
|
||||||
<resource resource_type="Texture" path="res://robot_demo.png"> </resource>
|
<resource resource_type="Texture" path="res://robot_demo.png"> </resource>
|
||||||
<int> 16 </int>
|
<int> 16 </int>
|
||||||
<color> 1, 1, 1, 1 </color>
|
<color> 1, 1, 1, 1 </color>
|
||||||
<rect2> 0, 0, 0, 0 </rect2>
|
<rect2> 0, 0, 0, 0 </rect2>
|
||||||
<real> 0.363636 </real>
|
<real> 0.363636 </real>
|
||||||
<int> 1 </int>
|
|
||||||
<vector2> 20.7312, 3.21187 </vector2>
|
<vector2> 20.7312, 3.21187 </vector2>
|
||||||
<real> 83.450417 </real>
|
<real> 83.450417 </real>
|
||||||
<int> 4 </int>
|
<int> 4 </int>
|
||||||
@ -654,7 +681,7 @@
|
|||||||
<string> "shoot" </string>
|
<string> "shoot" </string>
|
||||||
</array>
|
</array>
|
||||||
<string> "nodes" </string>
|
<string> "nodes" </string>
|
||||||
<int_array len="572"> -1, -1, 1, 0, -1, 28, 2, 0, 3, 1, 4, 1, 5, 2, 6, 3, 7, 4, 8, 5, 9, 6, 10, 7, 11, 8, 12, 2, 13, 9, 14, 10, 15, 2, 16, 6, 17, 11, 18, 4, 19, 4, 20, 0, 21, 12, 22, 13, 23, 2, 24, 0, 25, 0, 26, 3, 27, 4, 28, 14, 29, 15, 0, 0, 0, 31, 30, -1, 18, 2, 0, 3, 1, 4, 1, 5, 2, 6, 3, 7, 4, 8, 5, 32, 16, 33, 0, 34, 3, 35, 2, 36, 2, 37, 6, 38, 17, 39, 12, 40, 18, 41, 2, 42, 19, 0, 1, 0, 44, 43, -1, 57, 2, 0, 3, 1, 4, 20, 5, 2, 45, 21, 6, 22, 7, 23, 8, 5, 46, 24, 47, 25, 48, 1, 49, 4, 50, 25, 51, 2, 52, 3, 53, 3, 54, 2, 55, 26, 56, 2, 57, 2, 58, 27, 59, 4, 60, 28, 61, 29, 62, 1, 63, 4, 64, 4, 65, 30, 66, 4, 67, 4, 68, 4, 69, 31, 70, 31, 71, 4, 72, 4, 73, 4, 74, 4, 75, 31, 76, 4, 77, 4, 78, 4, 79, 4, 80, 4, 81, 4, 82, 4, 83, 4, 84, 4, 85, 6, 86, 4, 87, 18, 88, 1, 89, 32, 90, 1, 91, 33, 92, 1, 93, 34, 94, 35, 0, 0, 0, 96, 95, -1, 17, 97, 21, 98, 4, 99, 36, 100, 37, 101, 38, 102, 39, 103, 40, 104, 41, 105, 42, 106, 43, 107, 44, 108, 45, 109, 46, 110, 0, 111, 31, 112, 47, 113, 48, 0, 0, 0, 115, 114, -1, 22, 2, 0, 3, 1, 4, 1, 5, 2, 6, 3, 7, 4, 8, 5, 33, 0, 116, 2, 117, 0, 118, 4, 119, 5, 120, 12, 121, 12, 122, 49, 123, 49, 124, 0, 125, 0, 126, 50, 127, 50, 128, 50, 129, 50, 0, 0, 0, 131, 130, -1, 7, 2, 0, 3, 1, 4, 1, 5, 2, 6, 51, 7, 4, 8, 5, 0, 0, 0, 132, 132, -1, 9, 2, 0, 3, 1, 4, 1, 5, 2, 6, 52, 7, 4, 8, 53, 133, 7, 134, 2, 0, 0, 0, 136, 135, -1, 14, 137, 13, 138, 54, 139, 4, 140, 1, 141, 4, 142, 4, 143, 4, 144, 55, 145, 55, 146, 55, 147, 55, 148, 6, 149, 4, 150, 4, 0, 0, 0, 151, 151, -1, 9, 2, 0, 3, 1, 4, 1, 5, 2, 6, 3, 7, 4, 8, 5, 152, 12, 153, 56, 0, 0, 0, 155, 154, -1, 4, 156, 12, 34, 3, 157, 4, 158, 5, 0, 9, 0, 160, 159, -1, 13, 2, 0, 3, 1, 4, 1, 5, 2, 6, 57, 7, 4, 8, 58, 161, 59, 162, 60, 163, 60, 164, 0, 165, 61, 166, 21, 0, 9, 0, 160, 167, -1, 13, 2, 0, 3, 1, 4, 1, 5, 2, 6, 62, 7, 4, 8, 58, 161, 63, 162, 60, 163, 60, 164, 0, 165, 64, 166, 21, 0, 9, 0, 160, 168, -1, 13, 2, 0, 3, 1, 4, 1, 5, 2, 6, 65, 7, 4, 8, 58, 161, 66, 162, 60, 163, 60, 164, 2, 165, 67, 166, 21, 0, 9, 0, 160, 169, -1, 13, 2, 0, 3, 1, 4, 1, 5, 2, 6, 68, 7, 4, 8, 58, 161, 69, 162, 60, 163, 60, 164, 2, 165, 70, 166, 21, 0 </int_array>
|
<int_array len="618"> -1, -1, 1, 0, -1, 30, 2, 0, 3, 1, 4, 2, 5, 2, 6, 3, 7, 4, 8, 5, 9, 6, 10, 7, 11, 8, 12, 9, 13, 3, 14, 10, 15, 11, 16, 3, 17, 12, 18, 7, 19, 13, 20, 5, 21, 5, 22, 1, 23, 14, 24, 15, 25, 3, 26, 3, 27, 1, 28, 4, 29, 5, 30, 16, 31, 17, 0, 0, 0, 33, 32, -1, 19, 2, 0, 3, 1, 4, 2, 5, 2, 6, 3, 7, 4, 8, 5, 9, 6, 34, 18, 35, 1, 36, 4, 37, 3, 38, 3, 39, 7, 40, 19, 41, 14, 42, 20, 43, 3, 44, 21, 0, 1, 0, 46, 45, -1, 66, 2, 0, 3, 1, 4, 2, 5, 22, 6, 3, 47, 12, 7, 23, 8, 24, 9, 6, 48, 25, 49, 26, 50, 2, 51, 5, 52, 26, 53, 3, 54, 4, 55, 4, 56, 3, 57, 27, 58, 3, 59, 3, 60, 28, 61, 12, 62, 12, 63, 5, 64, 29, 65, 30, 66, 2, 67, 5, 68, 5, 69, 31, 70, 5, 71, 5, 72, 5, 73, 5, 74, 32, 75, 32, 76, 5, 77, 2, 78, 5, 79, 5, 80, 5, 81, 5, 82, 32, 83, 5, 84, 5, 85, 5, 86, 5, 87, 5, 88, 5, 89, 5, 90, 5, 91, 5, 92, 5, 93, 5, 94, 5, 95, 7, 96, 5, 97, 20, 98, 2, 99, 33, 100, 2, 101, 34, 102, 2, 103, 35, 104, 36, 0, 0, 0, 106, 105, -1, 18, 2, 0, 107, 12, 108, 5, 109, 37, 110, 38, 111, 39, 112, 40, 113, 41, 114, 42, 115, 43, 116, 44, 117, 45, 118, 46, 119, 47, 120, 1, 121, 32, 122, 48, 123, 49, 0, 0, 0, 125, 124, -1, 23, 2, 0, 3, 1, 4, 2, 5, 2, 6, 3, 7, 4, 8, 5, 9, 6, 35, 1, 126, 3, 127, 1, 128, 5, 129, 6, 130, 14, 131, 14, 132, 50, 133, 50, 134, 1, 135, 1, 136, 51, 137, 51, 138, 51, 139, 51, 0, 0, 0, 141, 140, -1, 8, 2, 0, 3, 1, 4, 2, 5, 2, 6, 3, 7, 52, 8, 5, 9, 6, 0, 0, 0, 142, 142, -1, 10, 2, 0, 3, 1, 4, 2, 5, 2, 6, 3, 7, 53, 8, 5, 9, 54, 143, 8, 144, 3, 0, 0, 0, 146, 145, -1, 15, 2, 0, 147, 15, 148, 55, 149, 5, 150, 2, 151, 5, 152, 5, 153, 5, 154, 56, 155, 56, 156, 56, 157, 56, 158, 7, 159, 5, 160, 5, 0, 0, 0, 161, 161, -1, 10, 2, 0, 3, 1, 4, 2, 5, 2, 6, 3, 7, 4, 8, 5, 9, 6, 162, 14, 163, 57, 0, 0, 0, 165, 164, -1, 5, 2, 0, 166, 14, 36, 4, 167, 5, 168, 6, 0, 9, 0, 170, 169, -1, 14, 2, 0, 3, 1, 4, 2, 5, 2, 6, 3, 7, 58, 8, 5, 9, 59, 171, 60, 172, 61, 173, 61, 174, 1, 175, 62, 176, 12, 0, 9, 0, 170, 177, -1, 14, 2, 0, 3, 1, 4, 2, 5, 2, 6, 3, 7, 63, 8, 5, 9, 59, 171, 64, 172, 61, 173, 61, 174, 1, 175, 65, 176, 12, 0, 9, 0, 170, 178, -1, 14, 2, 0, 3, 1, 4, 2, 5, 2, 6, 3, 7, 66, 8, 5, 9, 59, 171, 67, 172, 61, 173, 61, 174, 3, 175, 68, 176, 12, 0, 9, 0, 170, 179, -1, 14, 2, 0, 3, 1, 4, 2, 5, 2, 6, 3, 7, 69, 8, 5, 9, 59, 171, 70, 172, 61, 173, 61, 174, 3, 175, 71, 176, 12, 0 </int_array>
|
||||||
<string> "conns" </string>
|
<string> "conns" </string>
|
||||||
<int_array len="0"> </int_array>
|
<int_array len="0"> </int_array>
|
||||||
</dictionary>
|
</dictionary>
|
||||||
|
@ -105,9 +105,9 @@ typedef struct MD5state_st
|
|||||||
unsigned int num;
|
unsigned int num;
|
||||||
} MD5_CTX;
|
} MD5_CTX;
|
||||||
|
|
||||||
#ifdef OPENSSL_FIPS
|
//#ifdef OPENSSL_FIPS
|
||||||
int private_MD5_Init(MD5_CTX *c);
|
int private_MD5_Init(MD5_CTX *c);
|
||||||
#endif
|
//#endif
|
||||||
|
|
||||||
//#define MD5_Init _SSL_MD5_Init
|
//#define MD5_Init _SSL_MD5_Init
|
||||||
#define MD5_Final _SSL_MD5_Final
|
#define MD5_Final _SSL_MD5_Final
|
||||||
|
@ -139,11 +139,13 @@ static _FORCE_INLINE_ uint16_t make_half_float(float f) {
|
|||||||
else if (exp <= 0x38000000)
|
else if (exp <= 0x38000000)
|
||||||
{
|
{
|
||||||
|
|
||||||
// store a denorm half-float value or zero
|
/*// store a denorm half-float value or zero
|
||||||
exp = (0x38000000 - exp) >> 23;
|
exp = (0x38000000 - exp) >> 23;
|
||||||
mantissa >>= (14 + exp);
|
mantissa >>= (14 + exp);
|
||||||
|
|
||||||
hf = (((uint16_t)sign) << 15) | (uint16_t)(mantissa);
|
hf = (((uint16_t)sign) << 15) | (uint16_t)(mantissa);
|
||||||
|
*/
|
||||||
|
hf=0; //denormals do not work for 3D, convert to zero
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -969,7 +971,7 @@ void RasterizerGLES2::texture_set_data(RID p_texture,const Image& p_image,VS::Cu
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (img.detect_alpha()==Image::ALPHA_BLEND) {
|
if ((!texture->flags&VS::TEXTURE_FLAG_VIDEO_SURFACE) && img.detect_alpha()==Image::ALPHA_BLEND) {
|
||||||
texture->has_alpha=true;
|
texture->has_alpha=true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4224,7 +4226,6 @@ void RasterizerGLES2::capture_viewport(Image* r_capture) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
w=DVector<uint8_t>::Write();
|
w=DVector<uint8_t>::Write();
|
||||||
|
|
||||||
r_capture->create(viewport.width,viewport.height,0,Image::FORMAT_RGBA,pixels);
|
r_capture->create(viewport.width,viewport.height,0,Image::FORMAT_RGBA,pixels);
|
||||||
//r_capture->flip_y();
|
//r_capture->flip_y();
|
||||||
|
|
||||||
@ -8188,8 +8189,18 @@ void RasterizerGLES2::canvas_draw_polygon(int p_vertex_count, const int* p_indic
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (p_indices) {
|
if (p_indices) {
|
||||||
|
#ifdef GLEW_ENABLED
|
||||||
glDrawElements(GL_TRIANGLES, p_vertex_count, GL_UNSIGNED_INT, p_indices );
|
glDrawElements(GL_TRIANGLES, p_vertex_count, GL_UNSIGNED_INT, p_indices );
|
||||||
|
#else
|
||||||
|
static const int _max_draw_poly_indices = 16*1024; // change this size if needed!!!
|
||||||
|
ERR_FAIL_COND(p_vertex_count > _max_draw_poly_indices);
|
||||||
|
static uint16_t _draw_poly_indices[_max_draw_poly_indices];
|
||||||
|
for (int i=0; i<p_vertex_count; i++) {
|
||||||
|
_draw_poly_indices[i] = p_indices[i];
|
||||||
|
};
|
||||||
|
glDrawElements(GL_TRIANGLES, p_vertex_count, GL_UNSIGNED_SHORT, _draw_poly_indices );
|
||||||
|
#endif
|
||||||
|
//glDrawElements(GL_TRIANGLES, p_vertex_count, GL_UNSIGNED_INT, p_indices );
|
||||||
} else {
|
} else {
|
||||||
glDrawArrays(GL_TRIANGLES,0,p_vertex_count);
|
glDrawArrays(GL_TRIANGLES,0,p_vertex_count);
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,7 @@ Error AudioStreamMPC::_open_file() {
|
|||||||
f=NULL;
|
f=NULL;
|
||||||
}
|
}
|
||||||
Error err;
|
Error err;
|
||||||
|
//printf("mpc open file %ls\n", file.c_str());
|
||||||
f=FileAccess::open(file,FileAccess::READ,&err);
|
f=FileAccess::open(file,FileAccess::READ,&err);
|
||||||
|
|
||||||
if (err) {
|
if (err) {
|
||||||
@ -16,9 +17,10 @@ Error AudioStreamMPC::_open_file() {
|
|||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
f->seek_end(0);
|
//printf("file size is %i\n", f->get_len());
|
||||||
streamlen=f->get_pos();
|
//f->seek_end(0);
|
||||||
f->seek(0);
|
streamlen=f->get_len();
|
||||||
|
//f->seek(0);
|
||||||
if (streamlen<=0) {
|
if (streamlen<=0) {
|
||||||
memdelete(f);
|
memdelete(f);
|
||||||
f=NULL;
|
f=NULL;
|
||||||
|
@ -61,13 +61,17 @@ src/YUV/C/yuv420_rgb_c.c
|
|||||||
src/TheoraVideoFrame.cpp
|
src/TheoraVideoFrame.cpp
|
||||||
""")
|
""")
|
||||||
|
|
||||||
|
env_theora = env.Clone()
|
||||||
|
|
||||||
if env["platform"] == "iphone":
|
if env["platform"] == "iphone":
|
||||||
sources.append("src/AVFoundation/TheoraVideoClip_AVFoundation.mm")
|
sources.append("src/AVFoundation/TheoraVideoClip_AVFoundation.mm")
|
||||||
env.Append(LINKFLAGS=['-framework', 'CoreVideo', '-framework', 'CoreMedia', '-framework', 'AVFoundation'])
|
env.Append(LINKFLAGS=['-framework', 'CoreVideo', '-framework', 'CoreMedia', '-framework', 'AVFoundation'])
|
||||||
|
if env["target"] == "release":
|
||||||
|
env_theora.Append(CPPFLAGS=["-D_IOS", "-D__ARM_NEON__", "-fstrict-aliasing", "-fmessage-length=210", "-fdiagnostics-show-note-include-stack", "-fmacro-backtrace-limit=0", "-fcolor-diagnostics", "-Wno-trigraphs", "-fpascal-strings", "-fvisibility=hidden", "-fvisibility-inlines-hidden"])
|
||||||
|
|
||||||
env_theora = env.Clone()
|
env_theora.Append(CPPFLAGS=["-D_LIB", "-D__THEORA"]) # removed -D_YUV_C
|
||||||
|
env_theora.Append(CPPFLAGS=["-D_YUV_LIBYUV", "-DLIBYUV_NEON"])
|
||||||
env_theora.Append(CPPFLAGS=["-D_YUV_C", "-D_LIB", "-D__THEORA"])
|
#env_theora.Append(CPPFLAGS=["-D_YUV_C"])
|
||||||
|
|
||||||
if env["platform"] == "iphone":
|
if env["platform"] == "iphone":
|
||||||
env_theora.Append(CPPFLAGS=["-D__AVFOUNDATION"])
|
env_theora.Append(CPPFLAGS=["-D__AVFOUNDATION"])
|
||||||
|
@ -249,6 +249,7 @@ int TheoraVideoClip::discardOutdatedFrames(float absTime)
|
|||||||
|
|
||||||
if (nPop > 0)
|
if (nPop > 0)
|
||||||
{
|
{
|
||||||
|
#define _DEBUG
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
std::string log = getName() + ": dropped frame ";
|
std::string log = getName() + ": dropped frame ";
|
||||||
|
|
||||||
|
@ -215,7 +215,7 @@ public:
|
|||||||
channels = p_channels;
|
channels = p_channels;
|
||||||
freq = p_freq;
|
freq = p_freq;
|
||||||
total_wrote = 0;
|
total_wrote = 0;
|
||||||
rb_power = 12;
|
rb_power = 22;
|
||||||
rb.resize(rb_power);
|
rb.resize(rb_power);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -258,10 +258,12 @@ public:
|
|||||||
|
|
||||||
void update(float time_increase)
|
void update(float time_increase)
|
||||||
{
|
{
|
||||||
|
float prev_time = mTime;
|
||||||
//mTime = (float)(stream->get_total_wrote()) / freq;
|
//mTime = (float)(stream->get_total_wrote()) / freq;
|
||||||
//mTime = MAX(0,mTime-AudioServer::get_singleton()->get_output_delay());
|
//mTime = MAX(0,mTime-AudioServer::get_singleton()->get_output_delay());
|
||||||
//mTime = (float)sample_count / channels / freq;
|
//mTime = (float)sample_count / channels / freq;
|
||||||
mTime += time_increase;
|
mTime += time_increase;
|
||||||
|
if (mTime - prev_time > .02) printf("time increase %f secs\n", mTime - prev_time);
|
||||||
//float duration=mClip->getDuration();
|
//float duration=mClip->getDuration();
|
||||||
//if (mTime > duration) mTime=duration;
|
//if (mTime > duration) mTime=duration;
|
||||||
//printf("time at timer is %f, %f, samples %i\n", mTime, time_increase, sample_count);
|
//printf("time at timer is %f, %f, samples %i\n", mTime, time_increase, sample_count);
|
||||||
@ -386,7 +388,7 @@ void VideoStreamTheoraplayer::pop_frame(Ref<ImageTexture> p_tex) {
|
|||||||
{
|
{
|
||||||
DVector<uint8_t>::Write wr = data.write();
|
DVector<uint8_t>::Write wr = data.write();
|
||||||
uint8_t* ptr = wr.ptr();
|
uint8_t* ptr = wr.ptr();
|
||||||
copymem(ptr, f->getBuffer(), imgsize);
|
memcpy(ptr, f->getBuffer(), imgsize);
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
for (int i=0; i<h; i++) {
|
for (int i=0; i<h; i++) {
|
||||||
|
@ -40,10 +40,9 @@
|
|||||||
* so BE CAREFUL!
|
* so BE CAREFUL!
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
void* MemoryPoolStaticMalloc::alloc(size_t p_bytes,const char *p_description) {
|
void* MemoryPoolStaticMalloc::alloc(size_t p_bytes,const char *p_description) {
|
||||||
|
|
||||||
#if DFAULT_ALIGNMENT == 1
|
#if DEFAULT_ALIGNMENT == 1
|
||||||
|
|
||||||
return _alloc(p_bytes, p_description);
|
return _alloc(p_bytes, p_description);
|
||||||
|
|
||||||
@ -123,7 +122,7 @@ void* MemoryPoolStaticMalloc::_alloc(size_t p_bytes,const char *p_description) {
|
|||||||
|
|
||||||
void* MemoryPoolStaticMalloc::realloc(void *p_memory,size_t p_bytes) {
|
void* MemoryPoolStaticMalloc::realloc(void *p_memory,size_t p_bytes) {
|
||||||
|
|
||||||
#if DFAULT_ALIGNMENT == 1
|
#if DEFAULT_ALIGNMENT == 1
|
||||||
|
|
||||||
return _realloc(p_memory,p_bytes);
|
return _realloc(p_memory,p_bytes);
|
||||||
#else
|
#else
|
||||||
@ -172,7 +171,6 @@ void* MemoryPoolStaticMalloc::_realloc(void *p_memory,size_t p_bytes) {
|
|||||||
bool single_element = (ringptr->next == ringptr) && (ringptr->prev == ringptr);
|
bool single_element = (ringptr->next == ringptr) && (ringptr->prev == ringptr);
|
||||||
bool is_list = ( ringlist == ringptr );
|
bool is_list = ( ringlist == ringptr );
|
||||||
|
|
||||||
|
|
||||||
RingPtr *new_ringptr=(RingPtr*)::realloc(ringptr, p_bytes+sizeof(RingPtr));
|
RingPtr *new_ringptr=(RingPtr*)::realloc(ringptr, p_bytes+sizeof(RingPtr));
|
||||||
|
|
||||||
ERR_FAIL_COND_V( new_ringptr == 0, NULL ); /// reallocation failed
|
ERR_FAIL_COND_V( new_ringptr == 0, NULL ); /// reallocation failed
|
||||||
@ -213,7 +211,7 @@ void MemoryPoolStaticMalloc::free(void *p_ptr) {
|
|||||||
|
|
||||||
ERR_FAIL_COND( !MemoryPoolStatic::get_singleton());
|
ERR_FAIL_COND( !MemoryPoolStatic::get_singleton());
|
||||||
|
|
||||||
#if DFAULT_ALIGNMENT == 1
|
#if DEFAULT_ALIGNMENT == 1
|
||||||
|
|
||||||
_free(p_ptr);
|
_free(p_ptr);
|
||||||
#else
|
#else
|
||||||
|
@ -33,7 +33,7 @@ extern "C" {
|
|||||||
#define WEBP_ANDROID_NEON // Android targets that might support NEON
|
#define WEBP_ANDROID_NEON // Android targets that might support NEON
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if (defined(__ARM_NEON__) || defined(WEBP_ANDROID_NEON)) && !defined(PSP2_ENABLED)
|
#if ( (defined(__ARM_NEON__) && !defined(__aarch64__)) || defined(WEBP_ANDROID_NEON)) && !defined(PSP2_ENABLED)
|
||||||
#define WEBP_USE_NEON
|
#define WEBP_USE_NEON
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
//
|
||||||
// Copyright 2010 Google Inc. All Rights Reserved.
|
// Copyright 2010 Google Inc. All Rights Reserved.
|
||||||
//
|
//
|
||||||
// This code is licensed under the same terms as WebM:
|
// This code is licensed under the same terms as WebM:
|
||||||
|
@ -45,8 +45,13 @@ void GDCompiler::_set_error(const String& p_error,const GDParser::Node *p_node)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
error=p_error;
|
error=p_error;
|
||||||
|
if (p_node) {
|
||||||
err_line=p_node->line;
|
err_line=p_node->line;
|
||||||
err_column=p_node->column;
|
err_column=p_node->column;
|
||||||
|
} else {
|
||||||
|
err_line=0;
|
||||||
|
err_column=0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GDCompiler::_create_unary_operator(CodeGen& codegen,const GDParser::OperatorNode *on,Variant::Operator op, int p_stack_level) {
|
bool GDCompiler::_create_unary_operator(CodeGen& codegen,const GDParser::OperatorNode *on,Variant::Operator op, int p_stack_level) {
|
||||||
@ -1586,6 +1591,48 @@ Error GDCompiler::_parse_class(GDScript *p_script,GDScript *p_owner,const GDPars
|
|||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef DEBUG_ENABLED
|
||||||
|
//validate setters/getters if debug is enabled
|
||||||
|
for(int i=0;i<p_class->variables.size();i++) {
|
||||||
|
|
||||||
|
if (p_class->variables[i].setter) {
|
||||||
|
const Map<StringName,GDFunction>::Element *E=p_script->get_member_functions().find(p_class->variables[i].setter);
|
||||||
|
if (!E) {
|
||||||
|
_set_error("Setter function '"+String(p_class->variables[i].setter)+"' not found in class.",NULL);
|
||||||
|
err_line=p_class->variables[i].line;
|
||||||
|
err_column=0;
|
||||||
|
return ERR_PARSE_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (E->get().is_static()) {
|
||||||
|
|
||||||
|
_set_error("Setter function '"+String(p_class->variables[i].setter)+"' is static.",NULL);
|
||||||
|
err_line=p_class->variables[i].line;
|
||||||
|
err_column=0;
|
||||||
|
return ERR_PARSE_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
if (p_class->variables[i].getter) {
|
||||||
|
const Map<StringName,GDFunction>::Element *E=p_script->get_member_functions().find(p_class->variables[i].getter);
|
||||||
|
if (!E) {
|
||||||
|
_set_error("Getter function '"+String(p_class->variables[i].getter)+"' not found in class.",NULL);
|
||||||
|
err_line=p_class->variables[i].line;
|
||||||
|
err_column=0;
|
||||||
|
return ERR_PARSE_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (E->get().is_static()) {
|
||||||
|
|
||||||
|
_set_error("Getter function '"+String(p_class->variables[i].getter)+"' is static.",NULL);
|
||||||
|
err_line=p_class->variables[i].line;
|
||||||
|
err_column=0;
|
||||||
|
return ERR_PARSE_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
#include "gd_script.h"
|
#include "gd_script.h"
|
||||||
#include "gd_compiler.h"
|
#include "gd_compiler.h"
|
||||||
|
#include "globals.h"
|
||||||
|
|
||||||
void GDScriptLanguage::get_comment_delimiters(List<String> *p_delimiters) const {
|
void GDScriptLanguage::get_comment_delimiters(List<String> *p_delimiters) const {
|
||||||
|
|
||||||
@ -1276,7 +1276,23 @@ static void _make_function_hint(const GDParser::FunctionNode* p_func,int p_argid
|
|||||||
static void _find_type_arguments(const GDParser::Node*p_node,int p_line,const StringName& p_method,const GDCompletionIdentifier& id, int p_argidx, Set<String>& result, String& arghint) {
|
static void _find_type_arguments(const GDParser::Node*p_node,int p_line,const StringName& p_method,const GDCompletionIdentifier& id, int p_argidx, Set<String>& result, String& arghint) {
|
||||||
|
|
||||||
|
|
||||||
if (id.type==Variant::OBJECT && id.obj_type!=StringName()) {
|
if (id.type==Variant::INPUT_EVENT && String(p_method)=="is_action" && p_argidx==0) {
|
||||||
|
|
||||||
|
List<PropertyInfo> pinfo;
|
||||||
|
Globals::get_singleton()->get_property_list(&pinfo);
|
||||||
|
|
||||||
|
for(List<PropertyInfo>::Element *E=pinfo.front();E;E=E->next()) {
|
||||||
|
const PropertyInfo &pi=E->get();
|
||||||
|
|
||||||
|
if (!pi.name.begins_with("input/"))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
String name = pi.name.substr(pi.name.find("/")+1,pi.name.length());
|
||||||
|
result.insert("\""+name+"\"");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
} else if (id.type==Variant::OBJECT && id.obj_type!=StringName()) {
|
||||||
|
|
||||||
|
|
||||||
MethodBind *m = ObjectTypeDB::get_method(id.obj_type,p_method);
|
MethodBind *m = ObjectTypeDB::get_method(id.obj_type,p_method);
|
||||||
@ -1826,6 +1842,37 @@ Error GDScriptLanguage::complete_code(const String& p_code, const String& p_base
|
|||||||
|
|
||||||
_find_call_arguments(context,p.get_completion_node(),p.get_completion_line(),p.get_completion_argument_index(),options,r_call_hint);
|
_find_call_arguments(context,p.get_completion_node(),p.get_completion_line(),p.get_completion_argument_index(),options,r_call_hint);
|
||||||
} break;
|
} break;
|
||||||
|
case GDParser::COMPLETION_VIRTUAL_FUNC: {
|
||||||
|
|
||||||
|
GDCompletionIdentifier cid = _get_native_class(context);
|
||||||
|
|
||||||
|
if (cid.obj_type!=StringName()) {
|
||||||
|
List<MethodInfo> vm;
|
||||||
|
ObjectTypeDB::get_virtual_methods(cid.obj_type,&vm);
|
||||||
|
for(List<MethodInfo>::Element *E=vm.front();E;E=E->next()) {
|
||||||
|
|
||||||
|
MethodInfo &mi=E->get();
|
||||||
|
String m = mi.name;
|
||||||
|
if (m.find(":")!=-1)
|
||||||
|
m=m.substr(0,m.find(":"));
|
||||||
|
m+="(";
|
||||||
|
|
||||||
|
if (mi.arguments.size()) {
|
||||||
|
for(int i=0;i<mi.arguments.size();i++) {
|
||||||
|
if (i>0)
|
||||||
|
m+=", ";
|
||||||
|
String n =mi.arguments[i].name;
|
||||||
|
if (n.find(":")!=-1)
|
||||||
|
n=n.substr(0,n.find(":"));
|
||||||
|
m+=n;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
m+="):";
|
||||||
|
|
||||||
|
options.insert(m);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} break;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1166,6 +1166,8 @@ MethodInfo GDFunctions::get_info(Function p_func) {
|
|||||||
|
|
||||||
MethodInfo mi("weakref",PropertyInfo(Variant::OBJECT,"obj"));
|
MethodInfo mi("weakref",PropertyInfo(Variant::OBJECT,"obj"));
|
||||||
mi.return_val.type=Variant::OBJECT;
|
mi.return_val.type=Variant::OBJECT;
|
||||||
|
mi.return_val.name="WeakRef";
|
||||||
|
|
||||||
return mi;
|
return mi;
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
@ -1173,6 +1175,7 @@ MethodInfo GDFunctions::get_info(Function p_func) {
|
|||||||
|
|
||||||
MethodInfo mi("funcref",PropertyInfo(Variant::OBJECT,"instance"),PropertyInfo(Variant::STRING,"funcname"));
|
MethodInfo mi("funcref",PropertyInfo(Variant::OBJECT,"instance"),PropertyInfo(Variant::STRING,"funcname"));
|
||||||
mi.return_val.type=Variant::OBJECT;
|
mi.return_val.type=Variant::OBJECT;
|
||||||
|
mi.return_val.name="FuncRef";
|
||||||
return mi;
|
return mi;
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
@ -1231,6 +1234,7 @@ MethodInfo GDFunctions::get_info(Function p_func) {
|
|||||||
|
|
||||||
MethodInfo mi("load",PropertyInfo(Variant::STRING,"path"));
|
MethodInfo mi("load",PropertyInfo(Variant::STRING,"path"));
|
||||||
mi.return_val.type=Variant::OBJECT;
|
mi.return_val.type=Variant::OBJECT;
|
||||||
|
mi.return_val.name="Resource";
|
||||||
return mi;
|
return mi;
|
||||||
} break;
|
} break;
|
||||||
case INST2DICT: {
|
case INST2DICT: {
|
||||||
|
@ -2027,14 +2027,20 @@ void GDParser::_parse_class(ClassNode *p_class) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (tokenizer->get_token(1)!=GDTokenizer::TK_IDENTIFIER) {
|
tokenizer->advance();
|
||||||
|
StringName name;
|
||||||
|
|
||||||
|
if (_get_completable_identifier(COMPLETION_VIRTUAL_FUNC,name)) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (name==StringName()) {
|
||||||
|
|
||||||
_set_error("Expected identifier after 'func' (syntax: 'func <identifier>([arguments]):' ).");
|
_set_error("Expected identifier after 'func' (syntax: 'func <identifier>([arguments]):' ).");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
StringName name = tokenizer->get_token_identifier(1);
|
|
||||||
|
|
||||||
for(int i=0;i<p_class->functions.size();i++) {
|
for(int i=0;i<p_class->functions.size();i++) {
|
||||||
if (p_class->functions[i]->name==name) {
|
if (p_class->functions[i]->name==name) {
|
||||||
_set_error("Function '"+String(name)+"' already exists in this class (at line: "+itos(p_class->functions[i]->line)+").");
|
_set_error("Function '"+String(name)+"' already exists in this class (at line: "+itos(p_class->functions[i]->line)+").");
|
||||||
@ -2045,7 +2051,7 @@ void GDParser::_parse_class(ClassNode *p_class) {
|
|||||||
_set_error("Function '"+String(name)+"' already exists in this class (at line: "+itos(p_class->static_functions[i]->line)+").");
|
_set_error("Function '"+String(name)+"' already exists in this class (at line: "+itos(p_class->static_functions[i]->line)+").");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
tokenizer->advance(2);
|
|
||||||
|
|
||||||
if (tokenizer->get_token()!=GDTokenizer::TK_PARENTHESIS_OPEN) {
|
if (tokenizer->get_token()!=GDTokenizer::TK_PARENTHESIS_OPEN) {
|
||||||
|
|
||||||
|
@ -363,6 +363,7 @@ public:
|
|||||||
COMPLETION_METHOD,
|
COMPLETION_METHOD,
|
||||||
COMPLETION_CALL_ARGUMENTS,
|
COMPLETION_CALL_ARGUMENTS,
|
||||||
COMPLETION_INDEX,
|
COMPLETION_INDEX,
|
||||||
|
COMPLETION_VIRTUAL_FUNC
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -1192,8 +1192,8 @@ GridMapEditor::GridMapEditor(EditorNode *p_editor) {
|
|||||||
undo_redo=p_editor->get_undo_redo();
|
undo_redo=p_editor->get_undo_redo();
|
||||||
|
|
||||||
int mw = EDITOR_DEF("grid_map/palette_min_width",230);
|
int mw = EDITOR_DEF("grid_map/palette_min_width",230);
|
||||||
EmptyControl *ec = memnew( EmptyControl);
|
Control *ec = memnew( Control);
|
||||||
ec->set_minsize(Size2(mw,0));
|
ec->set_custom_minimum_size(Size2(mw,0));
|
||||||
add_child(ec);
|
add_child(ec);
|
||||||
|
|
||||||
|
|
||||||
|
@ -27,16 +27,20 @@
|
|||||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
#include "register_types.h"
|
#include "register_types.h"
|
||||||
|
#ifndef _3D_DISABLED
|
||||||
#include "object_type_db.h"
|
#include "object_type_db.h"
|
||||||
#include "grid_map.h"
|
#include "grid_map.h"
|
||||||
#include "grid_map_editor_plugin.h"
|
#include "grid_map_editor_plugin.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
void register_gridmap_types() {
|
void register_gridmap_types() {
|
||||||
|
|
||||||
|
#ifndef _3D_DISABLED
|
||||||
ObjectTypeDB::register_type<GridMap>();
|
ObjectTypeDB::register_type<GridMap>();
|
||||||
#ifdef TOOLS_ENABLED
|
#ifdef TOOLS_ENABLED
|
||||||
EditorPlugins::add_by_type<GridMapEditorPlugin>();
|
EditorPlugins::add_by_type<GridMapEditorPlugin>();
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -124,11 +124,11 @@ def configure(env):
|
|||||||
# env['CCFLAGS'] = string.split('-DNO_THREADS -MMD -MP -MF -fpic -ffunction-sections -funwind-tables -fstack-protector -D__ARM_ARCH_5__ -D__ARM_ARCH_5T__ -D__ARM_ARCH_5E__ -D__ARM_ARCH_5TE__ -Wno-psabi -march=armv5te -mtune=xscale -msoft-float -fno-exceptions -mthumb -fno-strict-aliasing -DANDROID -Wa,--noexecstack -DGLES2_ENABLED ')
|
# env['CCFLAGS'] = string.split('-DNO_THREADS -MMD -MP -MF -fpic -ffunction-sections -funwind-tables -fstack-protector -D__ARM_ARCH_5__ -D__ARM_ARCH_5T__ -D__ARM_ARCH_5E__ -D__ARM_ARCH_5TE__ -Wno-psabi -march=armv5te -mtune=xscale -msoft-float -fno-exceptions -mthumb -fno-strict-aliasing -DANDROID -Wa,--noexecstack -DGLES2_ENABLED ')
|
||||||
|
|
||||||
if env['x86']=='yes':
|
if env['x86']=='yes':
|
||||||
env['CCFLAGS'] = string.split('-DNO_STATVFS -MMD -MP -MF -fpic -ffunction-sections -funwind-tables -fstack-protector -D__GLIBC__ -Wno-psabi -ftree-vectorize -funsafe-math-optimizations -fno-strict-aliasing -DANDROID -Wa,--noexecstack -DGLES2_ENABLED -DGLES1_ENABLED')
|
env['CCFLAGS'] = string.split('-DNO_STATVFS -MMD -MP -MF -fpic -ffunction-sections -funwind-tables -fstack-protector -fvisibility=hidden -D__GLIBC__ -Wno-psabi -ftree-vectorize -funsafe-math-optimizations -fno-strict-aliasing -DANDROID -Wa,--noexecstack -DGLES2_ENABLED -DGLES1_ENABLED')
|
||||||
elif env["armv6"]!="no":
|
elif env["armv6"]!="no":
|
||||||
env['CCFLAGS'] = string.split('-DNO_STATVFS -MMD -MP -MF -fpic -ffunction-sections -funwind-tables -fstack-protector -D__ARM_ARCH_6__ -D__GLIBC__ -Wno-psabi -march=armv6 -mfpu=vfp -mfloat-abi=softfp -funsafe-math-optimizations -fno-strict-aliasing -DANDROID -Wa,--noexecstack -DGLES2_ENABLED -DGLES1_ENABLED')
|
env['CCFLAGS'] = string.split('-DNO_STATVFS -MMD -MP -MF -fpic -ffunction-sections -funwind-tables -fstack-protector -fvisibility=hidden -D__ARM_ARCH_6__ -D__GLIBC__ -Wno-psabi -march=armv6 -mfpu=vfp -mfloat-abi=softfp -funsafe-math-optimizations -fno-strict-aliasing -DANDROID -Wa,--noexecstack -DGLES2_ENABLED -DGLES1_ENABLED')
|
||||||
else:
|
else:
|
||||||
env['CCFLAGS'] = string.split('-DNO_STATVFS -MMD -MP -MF -fpic -ffunction-sections -funwind-tables -fstack-protector -D__ARM_ARCH_7__ -D__GLIBC__ -Wno-psabi -march=armv6 -mfpu=neon -mfloat-abi=softfp -ftree-vectorize -funsafe-math-optimizations -fno-strict-aliasing -DANDROID -Wa,--noexecstack -DGLES2_ENABLED -DGLES1_ENABLED')
|
env['CCFLAGS'] = string.split('-DNO_STATVFS -MMD -MP -MF -fpic -ffunction-sections -funwind-tables -fstack-protector -fvisibility=hidden -D__ARM_ARCH_7__ -D__GLIBC__ -Wno-psabi -march=armv6 -mfpu=neon -mfloat-abi=softfp -ftree-vectorize -funsafe-math-optimizations -fno-strict-aliasing -DANDROID -Wa,--noexecstack -DGLES2_ENABLED -DGLES1_ENABLED')
|
||||||
|
|
||||||
env.Append(LDPATH=[ld_path])
|
env.Append(LDPATH=[ld_path])
|
||||||
env.Append(LIBS=['OpenSLES'])
|
env.Append(LIBS=['OpenSLES'])
|
||||||
|
@ -358,7 +358,7 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
|
|||||||
GodotLib.initialize(this,io.needsReloadHooks(),command_line);
|
GodotLib.initialize(this,io.needsReloadHooks(),command_line);
|
||||||
mSensorManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE);
|
mSensorManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE);
|
||||||
mAccelerometer = mSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER);
|
mAccelerometer = mSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER);
|
||||||
mSensorManager.registerListener(this, mAccelerometer, SensorManager.SENSOR_DELAY_NORMAL);
|
mSensorManager.registerListener(this, mAccelerometer, SensorManager.SENSOR_DELAY_GAME);
|
||||||
|
|
||||||
result_callback = null;
|
result_callback = null;
|
||||||
|
|
||||||
|
@ -54,20 +54,35 @@ def configure(env):
|
|||||||
env['AR'] = 'ar'
|
env['AR'] = 'ar'
|
||||||
|
|
||||||
import string
|
import string
|
||||||
#env['CCFLAGS'] = string.split('-arch armv7 -Wall -fno-strict-aliasing -fno-common -D__IPHONE_OS_VERSION_MIN_REQUIRED=20000 -isysroot $IPHONESDK -fvisibility=hidden -mmacosx-version-min=10.5 -DCUSTOM_MATRIX_TRANSFORM_H=\\\"build/iphone/matrix4_iphone.h\\\" -DCUSTOM_VECTOR3_TRANSFORM_H=\\\"build/iphone/vector3_iphone.h\\\" -DNO_THUMB')
|
if (env["bits"]=="64"):
|
||||||
|
#env['CCFLAGS'] = string.split('-arch arm64 -fmessage-length=0 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit=0 -Wno-trigraphs -fpascal-strings -O0 -Wno-missing-field-initializers -Wno-missing-prototypes -Wno-return-type -Wno-non-virtual-dtor -Wno-overloaded-virtual -Wno-exit-time-destructors -Wno-missing-braces -Wparentheses -Wswitch -Wno-unused-function -Wno-unused-label -Wno-unused-parameter -Wno-unused-variable -Wunused-value -Wno-empty-body -Wno-uninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wno-constant-conversion -Wno-int-conversion -Wno-bool-conversion -Wno-enum-conversion -Wshorten-64-to-32 -Wno-newline-eof -Wno-c++11-extensions -fstrict-aliasing -Wdeprecated-declarations -Winvalid-offsetof -g -Wno-sign-conversion -miphoneos-version-min=5.1.1 -Wmost -Wno-four-char-constants -Wno-unknown-pragmas -Wno-invalid-offsetof -ffast-math -m64 -DDEBUG -D_DEBUG -MMD -MT dependencies -isysroot $IPHONESDK')
|
||||||
|
env['CCFLAGS'] = string.split('-fno-objc-arc -arch arm64 -fmessage-length=0 -fno-strict-aliasing -fdiagnostics-print-source-range-info -fdiagnostics-show-category=id -fdiagnostics-parseable-fixits -Wno-trigraphs -fpascal-strings -Wmissing-prototypes -Wreturn-type -Wparentheses -Wswitch -Wno-unused-parameter -Wunused-variable -Wunused-value -Wno-shorten-64-to-32 -gdwarf-2 -fvisibility=hidden -Wno-sign-conversion -MMD -MT dependencies -miphoneos-version-min=5.1.1 -isysroot $IPHONESDK')
|
||||||
|
env.Append(CPPFLAGS=['-DNEED_LONG_INT'])
|
||||||
|
env.Append(CPPFLAGS=['-DLIBYUV_DISABLE_NEON'])
|
||||||
|
else:
|
||||||
env['CCFLAGS'] = string.split('-fno-objc-arc -arch armv7 -fmessage-length=0 -fno-strict-aliasing -fdiagnostics-print-source-range-info -fdiagnostics-show-category=id -fdiagnostics-parseable-fixits -Wno-trigraphs -fpascal-strings -Wmissing-prototypes -Wreturn-type -Wparentheses -Wswitch -Wno-unused-parameter -Wunused-variable -Wunused-value -Wno-shorten-64-to-32 -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk -gdwarf-2 -fvisibility=hidden -Wno-sign-conversion -mthumb "-DIBOutlet=__attribute__((iboutlet))" "-DIBOutletCollection(ClassName)=__attribute__((iboutletcollection(ClassName)))" "-DIBAction=void)__attribute__((ibaction)" -miphoneos-version-min=4.3 -MMD -MT dependencies -isysroot $IPHONESDK')
|
env['CCFLAGS'] = string.split('-fno-objc-arc -arch armv7 -fmessage-length=0 -fno-strict-aliasing -fdiagnostics-print-source-range-info -fdiagnostics-show-category=id -fdiagnostics-parseable-fixits -Wno-trigraphs -fpascal-strings -Wmissing-prototypes -Wreturn-type -Wparentheses -Wswitch -Wno-unused-parameter -Wunused-variable -Wunused-value -Wno-shorten-64-to-32 -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk -gdwarf-2 -fvisibility=hidden -Wno-sign-conversion -mthumb "-DIBOutlet=__attribute__((iboutlet))" "-DIBOutletCollection(ClassName)=__attribute__((iboutletcollection(ClassName)))" "-DIBAction=void)__attribute__((ibaction)" -miphoneos-version-min=4.3 -MMD -MT dependencies -isysroot $IPHONESDK')
|
||||||
|
|
||||||
|
if (env["bits"]=="64"):
|
||||||
#/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/clang++ fno-objc-arc -arch armv7 -fmessage-length=0 -fdiagnostics-print-source-range-info -fdiagnostics-show-category=id -fdiagnostics-parseable-fixits -Wno-trigraphs -fpascal-strings -Wmissing-prototypes -Wreturn-type -Wparentheses -Wswitch -Wno-unused-parameter -Wunused-variable -Wunused-value -Wno-shorten-64-to-32 -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk -gdwarf-2 -fvisibility=hidden -Wno-sign-conversion -mthumb "-DIBOutlet=__attribute__((iboutlet))" "-DIBOutletCollection(ClassName)=__attribute__((iboutletcollection(ClassName)))" "-DIBAction=void)__attribute__((ibaction)" -miphoneos-version-min=4.3 -MMD -MT dependencies -v -Os -ffast-math -DSTOREKIT_ENABLED -DIPHONE_ENABLED -DUNIX_ENABLED -DGLES2_ENABLED -DNO_THREADS -DMODULE_GRIDMAP_ENABLED -DMUSEPACK_ENABLED -DOLD_SCENE_FORMAT_ENABLED -DSQUIRREL_ENABLED -DVORBIS_ENABLED -DTHEORA_ENABLED -DPNG_ENABLED -DDDS_ENABLED -DPVR_ENABLED -DJPG_ENABLED -DSPEEX_ENABLED -DTOOLS_ENABLED -DGDSCRIPT_ENABLED -DMINIZIP_ENABLED -DXML_ENABLED -Icore -Icore/math -Itools -Idrivers -I. -Iplatform/iphone -Iplatform/iphone/include -Iplatform/iphone/scoreloop/SDKs -I/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk/System/Library/Frameworks/OpenGLES.framework/Headers -Iscript/squirrel/src -Iscript/vorbis script/gdscript/gd_script.cpp
|
env.Append(LINKFLAGS=['-arch', 'arm64', '-Wl,-dead_strip', '-miphoneos-version-min=5.1.1',
|
||||||
#/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/clang -x objective-c -arch armv7 -fmessage-length=0 -fdiagnostics-print-source-range-info -fdiagnostics-show-category=id -fdiagnostics-parseable-fixits -std=gnu99 -fobjc-arc -Wno-trigraphs -fpascal-strings -Os -Wmissing-prototypes -Wreturn-type -Wparentheses -Wswitch -Wno-unused-parameter -Wunused-variable -Wunused-value -Wno-shorten-64-to-32 -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk -gdwarf-2 -fvisibility=hidden -Wno-sign-conversion -mthumb "-DIBOutlet=__attribute__((iboutlet))" "-DIBOutletCollection(ClassName)=__attribute__((iboutletcollection(ClassName)))" "-DIBAction=void)__attribute__((ibaction)" -miphoneos-version-min=4.3 -iquote /Users/red/test2/build/test2.build/Release-iphoneos/test2.build/test2-generated-files.hmap -I/Users/red/test2/build/test2.build/Release-iphoneos/test2.build/test2-own-target-headers.hmap -I/Users/red/test2/build/test2.build/Release-iphoneos/test2.build/test2-all-target-headers.hmap -iquote /Users/red/test2/build/test2.build/Release-iphoneos/test2.build/test2-project-headers.hmap -I/Users/red/test2/build/Release-iphoneos/include -I/Users/red/test2/build/test2.build/Release-iphoneos/test2.build/DerivedSources/armv7 -I/Users/red/test2/build/test2.build/Release-iphoneos/test2.build/DerivedSources -F/Users/red/test2/build/Release-iphoneos -DNS_BLOCK_ASSERTIONS=1 -include /var/folders/LX/LXYXHTeSHSqbkhuPJRIsuE+++TI/-Caches-/com.apple.Xcode.501/SharedPrecompiledHeaders/test2-Prefix-dvdhnltoisfpmyalexovdrmfyeky/test2-Prefix.pch -MMD -MT dependencies -MF /Users/red/test2/build/test2.build/Release-iphoneos/test2.build/Objects-normal/armv7/main.d -c /Users/red/test2/test2/main.m -o /Users/red/test2/build/test2.build/Release-iphoneos/test2.build/Objects-normal/armv7/main.o
|
'-isysroot', '$IPHONESDK',
|
||||||
|
#'-stdlib=libc++',
|
||||||
|
'-framework', 'Foundation',
|
||||||
|
'-framework', 'UIKit',
|
||||||
|
'-framework', 'CoreGraphics',
|
||||||
|
'-framework', 'OpenGLES',
|
||||||
|
'-framework', 'QuartzCore',
|
||||||
|
'-framework', 'CoreAudio',
|
||||||
|
'-framework', 'AudioToolbox',
|
||||||
|
'-framework', 'SystemConfiguration',
|
||||||
|
'-framework', 'Security',
|
||||||
|
#'-framework', 'AdSupport',
|
||||||
|
'-framework', 'MediaPlayer',
|
||||||
|
'-framework', 'AVFoundation',
|
||||||
|
'-framework', 'CoreMedia',
|
||||||
|
])
|
||||||
|
else:
|
||||||
env.Append(LINKFLAGS=['-arch', 'armv7', '-Wl,-dead_strip', '-miphoneos-version-min=4.3',
|
env.Append(LINKFLAGS=['-arch', 'armv7', '-Wl,-dead_strip', '-miphoneos-version-min=4.3',
|
||||||
'-isysroot', '$IPHONESDK',
|
'-isysroot', '$IPHONESDK',
|
||||||
#'-mmacosx-version-min=10.5',
|
|
||||||
'-framework', 'Foundation',
|
'-framework', 'Foundation',
|
||||||
'-framework', 'UIKit',
|
'-framework', 'UIKit',
|
||||||
'-framework', 'CoreGraphics',
|
'-framework', 'CoreGraphics',
|
||||||
@ -128,4 +143,4 @@ def configure(env):
|
|||||||
env.Append( BUILDERS = { 'GLSL' : env.Builder(action = methods.build_glsl_headers, suffix = 'glsl.h',src_suffix = '.glsl') } )
|
env.Append( BUILDERS = { 'GLSL' : env.Builder(action = methods.build_glsl_headers, suffix = 'glsl.h',src_suffix = '.glsl') } )
|
||||||
env.Append( BUILDERS = { 'GLSL120GLES' : env.Builder(action = methods.build_gles2_headers, suffix = 'glsl.h',src_suffix = '.glsl') } )
|
env.Append( BUILDERS = { 'GLSL120GLES' : env.Builder(action = methods.build_gles2_headers, suffix = 'glsl.h',src_suffix = '.glsl') } )
|
||||||
|
|
||||||
# /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x objective-c-header -arch armv7s -fmessage-length=0 -std=gnu99 -fobjc-arc -Wno-trigraphs -fpascal-strings -Os -Wno-missing-field-initializers -Wno-missing-prototypes -Wreturn-type -Wno-implicit-atomic-properties -Wno-receiver-is-weak -Wduplicate-method-match -Wformat -Wno-missing-braces -Wparentheses -Wswitch -Wno-unused-function -Wno-unused-label -Wno-unused-parameter -Wunused-variable -Wunused-value -Wempty-body -Wuninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wno-shorten-64-to-32 -Wpointer-sign -Wno-newline-eof -Wno-selector -Wno-strict-selector-match -Wno-undeclared-selector -Wno-deprecated-implementations -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.0.sdk -Wprotocol -Wdeprecated-declarations -g -fvisibility=hidden -Wno-sign-conversion "-DIBOutlet=__attribute__((iboutlet))" "-DIBOutletCollection(ClassName)=__attribute__((iboutletcollection(ClassName)))" "-DIBAction=void)__attribute__((ibaction)" -miphoneos-version-min=4.3 -iquote /Users/lucasgondolo/test/build/test.build/Release-iphoneos/test.build/test-generated-files.hmap -I/Users/lucasgondolo/test/build/test.build/Release-iphoneos/test.build/test-own-target-headers.hmap -I/Users/lucasgondolo/test/build/test.build/Release-iphoneos/test.build/test-all-target-headers.hmap -iquote /Users/lucasgondolo/test/build/test.build/Release-iphoneos/test.build/test-project-headers.hmap -I/Users/lucasgondolo/test/build/Release-iphoneos/include -I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include -I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include -I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include -I/Users/lucasgondolo/test/build/test.build/Release-iphoneos/test.build/DerivedSources/armv7s -I/Users/lucasgondolo/test/build/test.build/Release-iphoneos/test.build/DerivedSources -F/Users/lucasgondolo/test/build/Release-iphoneos -DNS_BLOCK_ASSERTIONS=1 --serialize-diagnostics /var/folders/9r/_65jj9457bgb4n4nxcsm0xl80000gn/C/com.apple.Xcode.501/SharedPrecompiledHeaders/test-Prefix-esrzoamhgruxcxbhemvvlrjmmvoh/test-Prefix.pch.dia -c /Users/lucasgondolo/test/test/test-Prefix.pch -o /var/folders/9r/_65jj9457bgb4n4nxcsm0xl80000gn/C/com.apple.Xcode.501/SharedPrecompiledHeaders/test-Prefix-esrzoamhgruxcxbhemvvlrjmmvoh/test-Prefix.pch.pth -MMD -MT dependencies -MF /var/folders/9r/_65jj9457bgb4n4nxcsm0xl80000gn/C/com.apple.Xcode.501/SharedPrecompiledHeaders/test-Prefix-esrzoamhgruxcxbhemvvlrjmmvoh/test-Prefix.pch.d
|
|
||||||
|
@ -30,3 +30,4 @@
|
|||||||
#define GLES2_INCLUDE_H <ES2/gl.h>
|
#define GLES2_INCLUDE_H <ES2/gl.h>
|
||||||
#define GLES1_INCLUDE_H <ES1/gl.h>
|
#define GLES1_INCLUDE_H <ES1/gl.h>
|
||||||
|
|
||||||
|
#define PLATFORM_REFCOUNT
|
||||||
|
18
platform/iphone/platform_refcount.h
Normal file
18
platform/iphone/platform_refcount.h
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
#include "safe_refcount.h"
|
||||||
|
|
||||||
|
#ifdef IPHONE_ENABLED
|
||||||
|
|
||||||
|
#define REFCOUNT_T int
|
||||||
|
#define REFCOUNT_GET_T int const volatile&
|
||||||
|
|
||||||
|
#include <libkern/OSAtomic.h>
|
||||||
|
|
||||||
|
inline int atomic_conditional_increment(volatile int* v) {
|
||||||
|
return (*v==0)? 0 : OSAtomicIncrement32(v);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline int atomic_decrement(volatile int* v) {
|
||||||
|
return OSAtomicDecrement32(v);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
@ -135,6 +135,27 @@ def configure(env):
|
|||||||
env.Append(LIBPATH=[DIRECTX_PATH+"/Lib/x86"])
|
env.Append(LIBPATH=[DIRECTX_PATH+"/Lib/x86"])
|
||||||
env['ENV'] = os.environ;
|
env['ENV'] = os.environ;
|
||||||
else:
|
else:
|
||||||
|
|
||||||
|
# Workaround for MinGW. See:
|
||||||
|
# http://www.scons.org/wiki/LongCmdLinesOnWin32
|
||||||
|
if (os.name=="nt"):
|
||||||
|
import subprocess
|
||||||
|
def mySpawn(sh, escape, cmd, args, env):
|
||||||
|
newargs = ' '.join(args[1:])
|
||||||
|
cmdline = cmd + " " + newargs
|
||||||
|
startupinfo = subprocess.STARTUPINFO()
|
||||||
|
startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
|
||||||
|
proc = subprocess.Popen(cmdline, stdin=subprocess.PIPE, stdout=subprocess.PIPE,
|
||||||
|
stderr=subprocess.PIPE, startupinfo=startupinfo, shell = False, env = env)
|
||||||
|
data, err = proc.communicate()
|
||||||
|
rv = proc.wait()
|
||||||
|
if rv:
|
||||||
|
print "====="
|
||||||
|
print err
|
||||||
|
print "====="
|
||||||
|
return rv
|
||||||
|
env['SPAWN'] = mySpawn
|
||||||
|
|
||||||
#build using mingw
|
#build using mingw
|
||||||
if (os.name=="nt"):
|
if (os.name=="nt"):
|
||||||
env['ENV']['TMP'] = os.environ['TMP'] #way to go scons, you can be so stupid sometimes
|
env['ENV']['TMP'] = os.environ['TMP'] #way to go scons, you can be so stupid sometimes
|
||||||
|
37
platform/winrt/include/angle_windowsstore.h
Normal file
37
platform/winrt/include/angle_windowsstore.h
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
//
|
||||||
|
// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
|
// found in the LICENSE file.
|
||||||
|
//
|
||||||
|
// angle_windowsstore.h:
|
||||||
|
|
||||||
|
#ifndef ANGLE_WINDOWSSTORE_H_
|
||||||
|
#define ANGLE_WINDOWSSTORE_H_
|
||||||
|
|
||||||
|
// The following properties can be set on the CoreApplication to support additional
|
||||||
|
// ANGLE configuration options.
|
||||||
|
//
|
||||||
|
// The Visual Studio sample templates provided with this version of ANGLE have examples
|
||||||
|
// of how to set these property values.
|
||||||
|
|
||||||
|
//
|
||||||
|
// Property: EGLNativeWindowTypeProperty
|
||||||
|
// Type: IInspectable
|
||||||
|
// Description: Set this property to specify the window type to use for creating a surface.
|
||||||
|
// If this property is missing, surface creation will fail.
|
||||||
|
//
|
||||||
|
const wchar_t EGLNativeWindowTypeProperty[] = L"EGLNativeWindowTypeProperty";
|
||||||
|
|
||||||
|
//
|
||||||
|
// Property: EGLRenderSurfaceSizeProperty
|
||||||
|
// Type: Size
|
||||||
|
// Description: Set this property to specify a preferred size in pixels of the render surface.
|
||||||
|
// The render surface size width and height must be greater than 0.
|
||||||
|
// If this property is set, then the render surface size is fixed.
|
||||||
|
// If this property is missing, a default behavior will be provided.
|
||||||
|
// The default behavior uses the window size if a CoreWindow is specified or
|
||||||
|
// the size of the SwapChainPanel control if one is specified.
|
||||||
|
//
|
||||||
|
const wchar_t EGLRenderSurfaceSizeProperty[] = L"EGLRenderSurfaceSizeProperty";
|
||||||
|
|
||||||
|
#endif // ANGLE_WINDOWSSTORE_H_
|
@ -102,6 +102,7 @@ void SamplePlayer2D::_notification(int p_what) {
|
|||||||
void SamplePlayer2D::set_sample_library(const Ref<SampleLibrary>& p_library) {
|
void SamplePlayer2D::set_sample_library(const Ref<SampleLibrary>& p_library) {
|
||||||
|
|
||||||
library=p_library;
|
library=p_library;
|
||||||
|
_change_notify();
|
||||||
}
|
}
|
||||||
|
|
||||||
Ref<SampleLibrary> SamplePlayer2D::get_sample_library() const {
|
Ref<SampleLibrary> SamplePlayer2D::get_sample_library() const {
|
||||||
|
@ -86,6 +86,10 @@ bool Camera::_set(const StringName& p_name, const Variant& p_value) {
|
|||||||
set_keep_aspect_mode(KeepAspect(int(p_value)));
|
set_keep_aspect_mode(KeepAspect(int(p_value)));
|
||||||
else if (p_name=="vaspect")
|
else if (p_name=="vaspect")
|
||||||
set_keep_aspect_mode(p_value?KEEP_WIDTH:KEEP_HEIGHT);
|
set_keep_aspect_mode(p_value?KEEP_WIDTH:KEEP_HEIGHT);
|
||||||
|
else if (p_name=="h_offset")
|
||||||
|
h_offset=p_value;
|
||||||
|
else if (p_name=="v_offset")
|
||||||
|
v_offset=p_value;
|
||||||
else if (p_name=="current") {
|
else if (p_name=="current") {
|
||||||
if (p_value.operator bool()) {
|
if (p_value.operator bool()) {
|
||||||
make_current();
|
make_current();
|
||||||
@ -128,6 +132,10 @@ bool Camera::_get(const StringName& p_name,Variant &r_ret) const {
|
|||||||
}
|
}
|
||||||
} else if (p_name=="visible_layers") {
|
} else if (p_name=="visible_layers") {
|
||||||
r_ret=get_visible_layers();
|
r_ret=get_visible_layers();
|
||||||
|
} else if (p_name=="h_offset") {
|
||||||
|
r_ret=get_h_offset();
|
||||||
|
} else if (p_name=="v_offset") {
|
||||||
|
r_ret=get_v_offset();
|
||||||
} else if (p_name=="environment") {
|
} else if (p_name=="environment") {
|
||||||
r_ret=get_environment();
|
r_ret=get_environment();
|
||||||
} else
|
} else
|
||||||
@ -170,12 +178,16 @@ void Camera::_get_property_list( List<PropertyInfo> *p_list) const {
|
|||||||
p_list->push_back( PropertyInfo( Variant::BOOL, "current" ) );
|
p_list->push_back( PropertyInfo( Variant::BOOL, "current" ) );
|
||||||
p_list->push_back( PropertyInfo( Variant::INT, "visible_layers",PROPERTY_HINT_ALL_FLAGS ) );
|
p_list->push_back( PropertyInfo( Variant::INT, "visible_layers",PROPERTY_HINT_ALL_FLAGS ) );
|
||||||
p_list->push_back( PropertyInfo( Variant::OBJECT, "environment",PROPERTY_HINT_RESOURCE_TYPE,"Environment" ) );
|
p_list->push_back( PropertyInfo( Variant::OBJECT, "environment",PROPERTY_HINT_RESOURCE_TYPE,"Environment" ) );
|
||||||
|
p_list->push_back( PropertyInfo( Variant::REAL, "h_offset" ) );
|
||||||
|
p_list->push_back( PropertyInfo( Variant::REAL, "v_offset" ) );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Camera::_update_camera() {
|
void Camera::_update_camera() {
|
||||||
|
|
||||||
Transform tr = get_camera_transform();
|
Transform tr = get_camera_transform();
|
||||||
|
tr.origin+=tr.basis.get_axis(1)*v_offset;
|
||||||
|
tr.origin+=tr.basis.get_axis(0)*h_offset;
|
||||||
VisualServer::get_singleton()->camera_set_transform( camera, tr );
|
VisualServer::get_singleton()->camera_set_transform( camera, tr );
|
||||||
|
|
||||||
// here goes listener stuff
|
// here goes listener stuff
|
||||||
@ -757,6 +769,27 @@ void Camera::look_at_from_pos(const Vector3& p_pos,const Vector3& p_target, cons
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Camera::set_v_offset(float p_offset) {
|
||||||
|
|
||||||
|
v_offset=p_offset;
|
||||||
|
_update_camera();;
|
||||||
|
}
|
||||||
|
|
||||||
|
float Camera::get_v_offset() const {
|
||||||
|
|
||||||
|
return v_offset;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Camera::set_h_offset(float p_offset) {
|
||||||
|
h_offset=p_offset;
|
||||||
|
_update_camera();
|
||||||
|
}
|
||||||
|
|
||||||
|
float Camera::get_h_offset() const {
|
||||||
|
|
||||||
|
return h_offset;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
Camera::Camera() {
|
Camera::Camera() {
|
||||||
|
|
||||||
@ -772,6 +805,8 @@ Camera::Camera() {
|
|||||||
set_perspective(60.0,0.1,100.0);
|
set_perspective(60.0,0.1,100.0);
|
||||||
keep_aspect=KEEP_HEIGHT;
|
keep_aspect=KEEP_HEIGHT;
|
||||||
layers=0xfffff;
|
layers=0xfffff;
|
||||||
|
v_offset=0;
|
||||||
|
h_offset=0;
|
||||||
VisualServer::get_singleton()->camera_set_visible_layers(camera,layers);
|
VisualServer::get_singleton()->camera_set_visible_layers(camera,layers);
|
||||||
//active=false;
|
//active=false;
|
||||||
}
|
}
|
||||||
|
@ -61,6 +61,8 @@ private:
|
|||||||
float fov;
|
float fov;
|
||||||
float size;
|
float size;
|
||||||
float near,far;
|
float near,far;
|
||||||
|
float v_offset;
|
||||||
|
float h_offset;
|
||||||
KeepAspect keep_aspect;
|
KeepAspect keep_aspect;
|
||||||
|
|
||||||
RID camera;
|
RID camera;
|
||||||
@ -140,6 +142,12 @@ public:
|
|||||||
void look_at(const Vector3& p_target, const Vector3& p_up_normal);
|
void look_at(const Vector3& p_target, const Vector3& p_up_normal);
|
||||||
void look_at_from_pos(const Vector3& p_pos,const Vector3& p_target, const Vector3& p_up_normal);
|
void look_at_from_pos(const Vector3& p_pos,const Vector3& p_target, const Vector3& p_up_normal);
|
||||||
|
|
||||||
|
void set_v_offset(float p_offset);
|
||||||
|
float get_v_offset() const;
|
||||||
|
|
||||||
|
void set_h_offset(float p_offset);
|
||||||
|
float get_h_offset() const;
|
||||||
|
|
||||||
|
|
||||||
Camera();
|
Camera();
|
||||||
~Camera();
|
~Camera();
|
||||||
|
@ -47,6 +47,11 @@ void CollisionObject::_notification(int p_what) {
|
|||||||
|
|
||||||
case NOTIFICATION_ENTER_WORLD: {
|
case NOTIFICATION_ENTER_WORLD: {
|
||||||
|
|
||||||
|
if (area)
|
||||||
|
PhysicsServer::get_singleton()->area_set_transform(rid,get_global_transform());
|
||||||
|
else
|
||||||
|
PhysicsServer::get_singleton()->body_set_state(rid,PhysicsServer::BODY_STATE_TRANSFORM,get_global_transform());
|
||||||
|
|
||||||
RID space = get_world()->get_space();
|
RID space = get_world()->get_space();
|
||||||
if (area) {
|
if (area) {
|
||||||
PhysicsServer::get_singleton()->area_set_space(rid,space);
|
PhysicsServer::get_singleton()->area_set_space(rid,space);
|
||||||
|
@ -127,7 +127,7 @@ void ImmediateGeometry::_bind_methods() {
|
|||||||
ObjectTypeDB::bind_method(_MD("set_color","color"),&ImmediateGeometry::set_color);
|
ObjectTypeDB::bind_method(_MD("set_color","color"),&ImmediateGeometry::set_color);
|
||||||
ObjectTypeDB::bind_method(_MD("set_uv","uv"),&ImmediateGeometry::set_uv);
|
ObjectTypeDB::bind_method(_MD("set_uv","uv"),&ImmediateGeometry::set_uv);
|
||||||
ObjectTypeDB::bind_method(_MD("set_uv2","uv"),&ImmediateGeometry::set_uv2);
|
ObjectTypeDB::bind_method(_MD("set_uv2","uv"),&ImmediateGeometry::set_uv2);
|
||||||
ObjectTypeDB::bind_method(_MD("add_vertex","color"),&ImmediateGeometry::add_vertex);
|
ObjectTypeDB::bind_method(_MD("add_vertex","pos"),&ImmediateGeometry::add_vertex);
|
||||||
ObjectTypeDB::bind_method(_MD("add_sphere","lats","lons","radius"),&ImmediateGeometry::add_sphere);
|
ObjectTypeDB::bind_method(_MD("add_sphere","lats","lons","radius"),&ImmediateGeometry::add_sphere);
|
||||||
ObjectTypeDB::bind_method(_MD("end"),&ImmediateGeometry::end);
|
ObjectTypeDB::bind_method(_MD("end"),&ImmediateGeometry::end);
|
||||||
ObjectTypeDB::bind_method(_MD("clear"),&ImmediateGeometry::clear);
|
ObjectTypeDB::bind_method(_MD("clear"),&ImmediateGeometry::clear);
|
||||||
|
@ -852,6 +852,8 @@ Vector3 KinematicBody::move(const Vector3& p_motion) {
|
|||||||
//motion recover
|
//motion recover
|
||||||
for(int i=0;i<get_shape_count();i++) {
|
for(int i=0;i<get_shape_count();i++) {
|
||||||
|
|
||||||
|
if (is_shape_set_as_trigger(i))
|
||||||
|
continue;
|
||||||
|
|
||||||
if (dss->collide_shape(get_shape(i)->get_rid(), get_global_transform() * get_shape_transform(i),m,sr,max_shapes,res_shapes,exclude,get_layer_mask(),mask)) {
|
if (dss->collide_shape(get_shape(i)->get_rid(), get_global_transform() * get_shape_transform(i),m,sr,max_shapes,res_shapes,exclude,get_layer_mask(),mask)) {
|
||||||
collided=true;
|
collided=true;
|
||||||
@ -870,9 +872,6 @@ Vector3 KinematicBody::move(const Vector3& p_motion) {
|
|||||||
for(int j=0;j<8;j++) {
|
for(int j=0;j<8;j++) {
|
||||||
for(int i=0;i<res_shapes;i++) {
|
for(int i=0;i<res_shapes;i++) {
|
||||||
|
|
||||||
if (is_shape_set_as_trigger(i))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
Vector3 a = sr[i*2+0];
|
Vector3 a = sr[i*2+0];
|
||||||
Vector3 b = sr[i*2+1];
|
Vector3 b = sr[i*2+1];
|
||||||
//print_line(String()+a+" -> "+b);
|
//print_line(String()+a+" -> "+b);
|
||||||
|
@ -95,18 +95,6 @@ void RayCast::_notification(int p_what) {
|
|||||||
|
|
||||||
if (enabled && !get_tree()->is_editor_hint()) {
|
if (enabled && !get_tree()->is_editor_hint()) {
|
||||||
set_fixed_process(true);
|
set_fixed_process(true);
|
||||||
Node *p = get_parent();
|
|
||||||
while( p && p->cast_to<Spatial>() ) {
|
|
||||||
|
|
||||||
CollisionObject *co = p->cast_to<CollisionObject>();
|
|
||||||
if (co) {
|
|
||||||
|
|
||||||
exception=co->get_rid();
|
|
||||||
exceptions.insert(exception);
|
|
||||||
}
|
|
||||||
|
|
||||||
p=p->get_parent();
|
|
||||||
}
|
|
||||||
} else
|
} else
|
||||||
set_fixed_process(false);
|
set_fixed_process(false);
|
||||||
|
|
||||||
@ -119,7 +107,6 @@ void RayCast::_notification(int p_what) {
|
|||||||
set_fixed_process(false);
|
set_fixed_process(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
exceptions.erase(exception);
|
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case NOTIFICATION_FIXED_PROCESS: {
|
case NOTIFICATION_FIXED_PROCESS: {
|
||||||
@ -143,7 +130,7 @@ void RayCast::_notification(int p_what) {
|
|||||||
|
|
||||||
PhysicsDirectSpaceState::RayResult rr;
|
PhysicsDirectSpaceState::RayResult rr;
|
||||||
|
|
||||||
if (dss->intersect_ray(gt.get_origin(),gt.xform(to),rr,exceptions)) {
|
if (dss->intersect_ray(gt.get_origin(),gt.xform(to),rr,exclude)) {
|
||||||
|
|
||||||
collided=true;
|
collided=true;
|
||||||
against=rr.collider_id;
|
against=rr.collider_id;
|
||||||
@ -160,6 +147,41 @@ void RayCast::_notification(int p_what) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RayCast::add_exception_rid(const RID& p_rid) {
|
||||||
|
|
||||||
|
exclude.insert(p_rid);
|
||||||
|
}
|
||||||
|
|
||||||
|
void RayCast::add_exception(const Object* p_object){
|
||||||
|
|
||||||
|
ERR_FAIL_NULL(p_object);
|
||||||
|
CollisionObject *co=((Object*)p_object)->cast_to<CollisionObject>();
|
||||||
|
if (!co)
|
||||||
|
return;
|
||||||
|
add_exception_rid(co->get_rid());
|
||||||
|
}
|
||||||
|
|
||||||
|
void RayCast::remove_exception_rid(const RID& p_rid) {
|
||||||
|
|
||||||
|
exclude.erase(p_rid);
|
||||||
|
}
|
||||||
|
|
||||||
|
void RayCast::remove_exception(const Object* p_object){
|
||||||
|
|
||||||
|
ERR_FAIL_NULL(p_object);
|
||||||
|
CollisionObject *co=((Object*)p_object)->cast_to<CollisionObject>();
|
||||||
|
if (!co)
|
||||||
|
return;
|
||||||
|
remove_exception_rid(co->get_rid());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void RayCast::clear_exceptions(){
|
||||||
|
|
||||||
|
exclude.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void RayCast::_bind_methods() {
|
void RayCast::_bind_methods() {
|
||||||
|
|
||||||
|
|
||||||
@ -176,6 +198,14 @@ void RayCast::_bind_methods() {
|
|||||||
ObjectTypeDB::bind_method(_MD("get_collision_point"),&RayCast::get_collision_point);
|
ObjectTypeDB::bind_method(_MD("get_collision_point"),&RayCast::get_collision_point);
|
||||||
ObjectTypeDB::bind_method(_MD("get_collision_normal"),&RayCast::get_collision_normal);
|
ObjectTypeDB::bind_method(_MD("get_collision_normal"),&RayCast::get_collision_normal);
|
||||||
|
|
||||||
|
ObjectTypeDB::bind_method(_MD("add_exception_rid","rid"),&RayCast::add_exception_rid);
|
||||||
|
ObjectTypeDB::bind_method(_MD("add_exception","node"),&RayCast::add_exception);
|
||||||
|
|
||||||
|
ObjectTypeDB::bind_method(_MD("remove_exception_rid","rid"),&RayCast::remove_exception_rid);
|
||||||
|
ObjectTypeDB::bind_method(_MD("remove_exception","node"),&RayCast::remove_exception);
|
||||||
|
|
||||||
|
ObjectTypeDB::bind_method(_MD("clear_exceptions"),&RayCast::clear_exceptions);
|
||||||
|
|
||||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL,"enabled"),_SCS("set_enabled"),_SCS("is_enabled"));
|
ADD_PROPERTY(PropertyInfo(Variant::BOOL,"enabled"),_SCS("set_enabled"),_SCS("is_enabled"));
|
||||||
ADD_PROPERTY(PropertyInfo(Variant::VECTOR3,"cast_to"),_SCS("set_cast_to"),_SCS("get_cast_to"));
|
ADD_PROPERTY(PropertyInfo(Variant::VECTOR3,"cast_to"),_SCS("set_cast_to"),_SCS("get_cast_to"));
|
||||||
}
|
}
|
||||||
|
@ -45,8 +45,7 @@ class RayCast : public Spatial {
|
|||||||
|
|
||||||
Vector3 cast_to;
|
Vector3 cast_to;
|
||||||
|
|
||||||
RID exception;
|
Set<RID> exclude;
|
||||||
Set<RID> exceptions;
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
@ -66,6 +65,12 @@ public:
|
|||||||
Vector3 get_collision_point() const;
|
Vector3 get_collision_point() const;
|
||||||
Vector3 get_collision_normal() const;
|
Vector3 get_collision_normal() const;
|
||||||
|
|
||||||
|
void add_exception_rid(const RID& p_rid);
|
||||||
|
void add_exception(const Object* p_object);
|
||||||
|
void remove_exception_rid(const RID& p_rid);
|
||||||
|
void remove_exception(const Object* p_object);
|
||||||
|
void clear_exceptions();
|
||||||
|
|
||||||
RayCast();
|
RayCast();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -103,6 +103,7 @@ void SpatialSamplePlayer::_notification(int p_what) {
|
|||||||
void SpatialSamplePlayer::set_sample_library(const Ref<SampleLibrary>& p_library) {
|
void SpatialSamplePlayer::set_sample_library(const Ref<SampleLibrary>& p_library) {
|
||||||
|
|
||||||
library=p_library;
|
library=p_library;
|
||||||
|
_change_notify();
|
||||||
}
|
}
|
||||||
|
|
||||||
Ref<SampleLibrary> SpatialSamplePlayer::get_sample_library() const {
|
Ref<SampleLibrary> SpatialSamplePlayer::get_sample_library() const {
|
||||||
|
@ -497,7 +497,7 @@ void Sprite3D::set_frame(int p_frame) {
|
|||||||
|
|
||||||
frame=p_frame;
|
frame=p_frame;
|
||||||
_queue_update();
|
_queue_update();
|
||||||
ADD_SIGNAL(MethodInfo("frame_changed"));
|
emit_signal(SceneStringNames::get_singleton()->frame_changed);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -83,6 +83,7 @@ bool AnimationTreePlayer::_set(const StringName& p_name, const Variant& p_value)
|
|||||||
|
|
||||||
ERR_FAIL_COND_V(nt==NODE_MAX,false);
|
ERR_FAIL_COND_V(nt==NODE_MAX,false);
|
||||||
|
|
||||||
|
if (nt!=NODE_OUTPUT)
|
||||||
add_node(nt,id);
|
add_node(nt,id);
|
||||||
node_set_pos(id,pos);
|
node_set_pos(id,pos);
|
||||||
|
|
||||||
|
@ -498,6 +498,7 @@ bool SamplePlayer::is_active() const {
|
|||||||
void SamplePlayer::set_sample_library(const Ref<SampleLibrary>& p_library) {
|
void SamplePlayer::set_sample_library(const Ref<SampleLibrary>& p_library) {
|
||||||
|
|
||||||
library=p_library;
|
library=p_library;
|
||||||
|
_change_notify();
|
||||||
}
|
}
|
||||||
|
|
||||||
Ref<SampleLibrary> SamplePlayer::get_sample_library() const {
|
Ref<SampleLibrary> SamplePlayer::get_sample_library() const {
|
||||||
|
@ -1126,6 +1126,7 @@ void Control::_window_input_event(InputEvent p_event) {
|
|||||||
over = _find_control_at_pos(this,pos,parent_xform,window->focus_inv_xform);
|
over = _find_control_at_pos(this,pos,parent_xform,window->focus_inv_xform);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (window->drag_data.get_type()==Variant::NIL && over && !window->modal_stack.empty()) {
|
if (window->drag_data.get_type()==Variant::NIL && over && !window->modal_stack.empty()) {
|
||||||
|
|
||||||
Control *top = window->modal_stack.back()->get();
|
Control *top = window->modal_stack.back()->get();
|
||||||
@ -2267,6 +2268,7 @@ void Control::_window_sort_subwindows() {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
window->modal_stack.sort_custom<CComparator>();
|
window->modal_stack.sort_custom<CComparator>();
|
||||||
|
window->subwindows.sort_custom<CComparator>();
|
||||||
window->subwindow_order_dirty=false;
|
window->subwindow_order_dirty=false;
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -2682,8 +2684,8 @@ bool Control::is_stopping_mouse() const {
|
|||||||
Control *Control::get_focus_owner() const {
|
Control *Control::get_focus_owner() const {
|
||||||
|
|
||||||
ERR_FAIL_COND_V(!is_inside_tree(),NULL);
|
ERR_FAIL_COND_V(!is_inside_tree(),NULL);
|
||||||
ERR_FAIL_COND_V(!window,NULL);
|
ERR_FAIL_COND_V(!data.window,NULL);
|
||||||
return window->key_focus;
|
return data.window->window->key_focus;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Control::_bind_methods() {
|
void Control::_bind_methods() {
|
||||||
|
@ -1,59 +0,0 @@
|
|||||||
/*************************************************************************/
|
|
||||||
/* empty_control.cpp */
|
|
||||||
/*************************************************************************/
|
|
||||||
/* This file is part of: */
|
|
||||||
/* GODOT ENGINE */
|
|
||||||
/* http://www.godotengine.org */
|
|
||||||
/*************************************************************************/
|
|
||||||
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
|
|
||||||
/* */
|
|
||||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
|
||||||
/* a copy of this software and associated documentation files (the */
|
|
||||||
/* "Software"), to deal in the Software without restriction, including */
|
|
||||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
|
||||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
|
||||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
|
||||||
/* the following conditions: */
|
|
||||||
/* */
|
|
||||||
/* The above copyright notice and this permission notice shall be */
|
|
||||||
/* included in all copies or substantial portions of the Software. */
|
|
||||||
/* */
|
|
||||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
|
||||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
|
||||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
|
||||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
|
||||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
|
||||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
|
||||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
|
||||||
/*************************************************************************/
|
|
||||||
#include "empty_control.h"
|
|
||||||
|
|
||||||
Size2 EmptyControl::get_minimum_size() const {
|
|
||||||
|
|
||||||
return minsize;
|
|
||||||
}
|
|
||||||
|
|
||||||
void EmptyControl::set_minsize(const Size2& p_size) {
|
|
||||||
|
|
||||||
minsize=p_size;
|
|
||||||
minimum_size_changed();
|
|
||||||
}
|
|
||||||
|
|
||||||
Size2 EmptyControl::get_minsize() const {
|
|
||||||
|
|
||||||
return minsize;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void EmptyControl::_bind_methods() {
|
|
||||||
|
|
||||||
|
|
||||||
ObjectTypeDB::bind_method(_MD("set_minsize","minsize"),&EmptyControl::set_minsize);
|
|
||||||
ObjectTypeDB::bind_method(_MD("get_minsize"),&EmptyControl::get_minsize);
|
|
||||||
|
|
||||||
ADD_PROPERTY( PropertyInfo(Variant::VECTOR2,"minsize"), _SCS("set_minsize"),_SCS("get_minsize") );
|
|
||||||
}
|
|
||||||
|
|
||||||
EmptyControl::EmptyControl()
|
|
||||||
{
|
|
||||||
}
|
|
@ -1,48 +0,0 @@
|
|||||||
/*************************************************************************/
|
|
||||||
/* empty_control.h */
|
|
||||||
/*************************************************************************/
|
|
||||||
/* This file is part of: */
|
|
||||||
/* GODOT ENGINE */
|
|
||||||
/* http://www.godotengine.org */
|
|
||||||
/*************************************************************************/
|
|
||||||
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
|
|
||||||
/* */
|
|
||||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
|
||||||
/* a copy of this software and associated documentation files (the */
|
|
||||||
/* "Software"), to deal in the Software without restriction, including */
|
|
||||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
|
||||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
|
||||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
|
||||||
/* the following conditions: */
|
|
||||||
/* */
|
|
||||||
/* The above copyright notice and this permission notice shall be */
|
|
||||||
/* included in all copies or substantial portions of the Software. */
|
|
||||||
/* */
|
|
||||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
|
||||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
|
||||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
|
||||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
|
||||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
|
||||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
|
||||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
|
||||||
/*************************************************************************/
|
|
||||||
#ifndef EMPTY_CONTROL_H
|
|
||||||
#define EMPTY_CONTROL_H
|
|
||||||
|
|
||||||
#include "scene/gui/control.h"
|
|
||||||
|
|
||||||
class EmptyControl : public Control {
|
|
||||||
|
|
||||||
OBJ_TYPE(EmptyControl,Control);
|
|
||||||
Size2 minsize;
|
|
||||||
protected:
|
|
||||||
static void _bind_methods();
|
|
||||||
public:
|
|
||||||
virtual Size2 get_minimum_size() const;
|
|
||||||
void set_minsize(const Size2& p_size);
|
|
||||||
Size2 get_minsize() const;
|
|
||||||
|
|
||||||
EmptyControl();
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // EMPTY_CONTROL_H
|
|
517
scene/gui/graph_edit.cpp
Normal file
517
scene/gui/graph_edit.cpp
Normal file
@ -0,0 +1,517 @@
|
|||||||
|
#include "graph_edit.h"
|
||||||
|
|
||||||
|
bool GraphEditFilter::has_point(const Point2& p_point) const {
|
||||||
|
|
||||||
|
return ge->_filter_input(p_point);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
GraphEditFilter::GraphEditFilter(GraphEdit *p_edit) {
|
||||||
|
|
||||||
|
ge=p_edit;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Error GraphEdit::connect_node(const StringName& p_from, int p_from_port,const StringName& p_to,int p_to_port) {
|
||||||
|
|
||||||
|
if (is_node_connected(p_from,p_from_port,p_to,p_to_port))
|
||||||
|
return OK;
|
||||||
|
Connection c;
|
||||||
|
c.from=p_from;
|
||||||
|
c.from_port=p_from_port;
|
||||||
|
c.to=p_to;
|
||||||
|
c.to_port=p_to_port;
|
||||||
|
connections.push_back(c);
|
||||||
|
top_layer->update();
|
||||||
|
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool GraphEdit::is_node_connected(const StringName& p_from, int p_from_port,const StringName& p_to,int p_to_port) {
|
||||||
|
|
||||||
|
for(List<Connection>::Element *E=connections.front();E;E=E->next()) {
|
||||||
|
|
||||||
|
if (E->get().from==p_from && E->get().from_port==p_from_port && E->get().to==p_to && E->get().to_port==p_to_port)
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void GraphEdit::disconnect_node(const StringName& p_from, int p_from_port,const StringName& p_to,int p_to_port){
|
||||||
|
|
||||||
|
|
||||||
|
for(List<Connection>::Element *E=connections.front();E;E=E->next()) {
|
||||||
|
|
||||||
|
if (E->get().from==p_from && E->get().from_port==p_from_port && E->get().to==p_to && E->get().to_port==p_to_port) {
|
||||||
|
|
||||||
|
connections.erase(E);
|
||||||
|
top_layer->update();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void GraphEdit::get_connection_list(List<Connection> *r_connections) {
|
||||||
|
|
||||||
|
*r_connections=connections;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void GraphEdit::_scroll_moved(double) {
|
||||||
|
|
||||||
|
|
||||||
|
_update_scroll_offset();
|
||||||
|
top_layer->update();
|
||||||
|
}
|
||||||
|
|
||||||
|
void GraphEdit::_update_scroll_offset() {
|
||||||
|
|
||||||
|
for(int i=0;i<get_child_count();i++) {
|
||||||
|
|
||||||
|
GraphNode *gn=get_child(i)->cast_to<GraphNode>();
|
||||||
|
if (!gn)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
Point2 pos=gn->get_offset();
|
||||||
|
pos-=Point2(h_scroll->get_val(),v_scroll->get_val());
|
||||||
|
gn->set_pos(pos);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void GraphEdit::_update_scroll() {
|
||||||
|
|
||||||
|
if (updating)
|
||||||
|
return;
|
||||||
|
|
||||||
|
updating=true;
|
||||||
|
Rect2 screen;
|
||||||
|
screen.size=get_size();
|
||||||
|
for(int i=0;i<get_child_count();i++) {
|
||||||
|
|
||||||
|
GraphNode *gn=get_child(i)->cast_to<GraphNode>();
|
||||||
|
if (!gn)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
Rect2 r;
|
||||||
|
r.pos=gn->get_offset();
|
||||||
|
r.size=gn->get_size();
|
||||||
|
screen = screen.merge(r);
|
||||||
|
}
|
||||||
|
|
||||||
|
h_scroll->set_min(screen.pos.x);
|
||||||
|
h_scroll->set_max(screen.pos.x+screen.size.x);
|
||||||
|
h_scroll->set_page(get_size().x);
|
||||||
|
if (h_scroll->get_max() - h_scroll->get_min() <= h_scroll->get_page())
|
||||||
|
h_scroll->hide();
|
||||||
|
else
|
||||||
|
h_scroll->show();
|
||||||
|
|
||||||
|
v_scroll->set_min(screen.pos.y);
|
||||||
|
v_scroll->set_max(screen.pos.y+screen.size.y);
|
||||||
|
v_scroll->set_page(get_size().y);
|
||||||
|
|
||||||
|
if (v_scroll->get_max() - v_scroll->get_min() <= v_scroll->get_page())
|
||||||
|
v_scroll->hide();
|
||||||
|
else
|
||||||
|
v_scroll->show();
|
||||||
|
|
||||||
|
_update_scroll_offset();
|
||||||
|
updating=false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void GraphEdit::_graph_node_raised(Node* p_gn) {
|
||||||
|
|
||||||
|
GraphNode *gn=p_gn->cast_to<GraphNode>();
|
||||||
|
ERR_FAIL_COND(!gn);
|
||||||
|
gn->raise();
|
||||||
|
top_layer->raise();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void GraphEdit::_graph_node_moved(Node *p_gn) {
|
||||||
|
|
||||||
|
GraphNode *gn=p_gn->cast_to<GraphNode>();
|
||||||
|
ERR_FAIL_COND(!gn);
|
||||||
|
|
||||||
|
//gn->set_pos(gn->get_offset()+scroll_offset);
|
||||||
|
|
||||||
|
top_layer->update();
|
||||||
|
}
|
||||||
|
|
||||||
|
void GraphEdit::add_child_notify(Node *p_child) {
|
||||||
|
|
||||||
|
top_layer->call_deferred("raise"); //top layer always on top!
|
||||||
|
GraphNode *gn = p_child->cast_to<GraphNode>();
|
||||||
|
if (gn) {
|
||||||
|
gn->connect("offset_changed",this,"_graph_node_moved",varray(gn));
|
||||||
|
gn->connect("raise_request",this,"_graph_node_raised",varray(gn));
|
||||||
|
_graph_node_moved(gn);
|
||||||
|
gn->set_stop_mouse(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void GraphEdit::remove_child_notify(Node *p_child) {
|
||||||
|
|
||||||
|
top_layer->call_deferred("raise"); //top layer always on top!
|
||||||
|
GraphNode *gn = p_child->cast_to<GraphNode>();
|
||||||
|
if (gn) {
|
||||||
|
gn->disconnect("offset_changed",this,"_graph_node_moved");
|
||||||
|
gn->disconnect("raise_request",this,"_graph_node_raised");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void GraphEdit::_notification(int p_what) {
|
||||||
|
|
||||||
|
if (p_what==NOTIFICATION_READY) {
|
||||||
|
Size2 size = top_layer->get_size();
|
||||||
|
Size2 hmin = h_scroll->get_combined_minimum_size();
|
||||||
|
Size2 vmin = v_scroll->get_combined_minimum_size();
|
||||||
|
|
||||||
|
v_scroll->set_anchor_and_margin(MARGIN_LEFT,ANCHOR_END,vmin.width);
|
||||||
|
v_scroll->set_anchor_and_margin(MARGIN_RIGHT,ANCHOR_END,0);
|
||||||
|
v_scroll->set_anchor_and_margin(MARGIN_TOP,ANCHOR_BEGIN,0);
|
||||||
|
v_scroll->set_anchor_and_margin(MARGIN_BOTTOM,ANCHOR_END,0);
|
||||||
|
|
||||||
|
h_scroll->set_anchor_and_margin(MARGIN_LEFT,ANCHOR_BEGIN,0);
|
||||||
|
h_scroll->set_anchor_and_margin(MARGIN_RIGHT,ANCHOR_END,0);
|
||||||
|
h_scroll->set_anchor_and_margin(MARGIN_TOP,ANCHOR_END,hmin.height);
|
||||||
|
h_scroll->set_anchor_and_margin(MARGIN_BOTTOM,ANCHOR_END,0);
|
||||||
|
|
||||||
|
}
|
||||||
|
if (p_what==NOTIFICATION_DRAW) {
|
||||||
|
VS::get_singleton()->canvas_item_set_clip(get_canvas_item(),true);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if (p_what==NOTIFICATION_RESIZED) {
|
||||||
|
_update_scroll();
|
||||||
|
top_layer->update();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool GraphEdit::_filter_input(const Point2& p_point) {
|
||||||
|
|
||||||
|
Ref<Texture> port =get_icon("port","GraphNode");
|
||||||
|
|
||||||
|
float grab_r=port->get_width()*0.5;
|
||||||
|
for(int i=get_child_count()-1;i>=0;i--) {
|
||||||
|
|
||||||
|
GraphNode *gn=get_child(i)->cast_to<GraphNode>();
|
||||||
|
if (!gn)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
for(int j=0;j<gn->get_connection_output_count();j++) {
|
||||||
|
|
||||||
|
Vector2 pos = gn->get_connection_output_pos(j)+gn->get_pos();
|
||||||
|
if (pos.distance_to(p_point)<grab_r)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
for(int j=0;j<gn->get_connection_input_count();j++) {
|
||||||
|
|
||||||
|
Vector2 pos = gn->get_connection_input_pos(j)+gn->get_pos();
|
||||||
|
if (pos.distance_to(p_point)<grab_r)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void GraphEdit::_top_layer_input(const InputEvent& p_ev) {
|
||||||
|
|
||||||
|
if (p_ev.type==InputEvent::MOUSE_BUTTON && p_ev.mouse_button.button_index==BUTTON_LEFT && p_ev.mouse_button.pressed) {
|
||||||
|
|
||||||
|
Ref<Texture> port =get_icon("port","GraphNode");
|
||||||
|
Vector2 mpos(p_ev.mouse_button.x,p_ev.mouse_button.y);
|
||||||
|
float grab_r=port->get_width()*0.5;
|
||||||
|
for(int i=get_child_count()-1;i>=0;i--) {
|
||||||
|
|
||||||
|
GraphNode *gn=get_child(i)->cast_to<GraphNode>();
|
||||||
|
if (!gn)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
for(int j=0;j<gn->get_connection_output_count();j++) {
|
||||||
|
|
||||||
|
Vector2 pos = gn->get_connection_output_pos(j)+gn->get_pos();
|
||||||
|
if (pos.distance_to(mpos)<grab_r) {
|
||||||
|
|
||||||
|
connecting=true;
|
||||||
|
connecting_from=gn->get_name();
|
||||||
|
connecting_index=j;
|
||||||
|
connecting_out=true;
|
||||||
|
connecting_type=gn->get_connection_output_type(j);
|
||||||
|
connecting_color=gn->get_connection_output_color(j);
|
||||||
|
connecting_target=false;
|
||||||
|
connecting_to=pos;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
for(int j=0;j<gn->get_connection_input_count();j++) {
|
||||||
|
|
||||||
|
Vector2 pos = gn->get_connection_input_pos(j)+gn->get_pos();
|
||||||
|
|
||||||
|
if (pos.distance_to(mpos)<grab_r) {
|
||||||
|
connecting=true;
|
||||||
|
connecting_from=gn->get_name();
|
||||||
|
connecting_index=j;
|
||||||
|
connecting_out=false;
|
||||||
|
connecting_type=gn->get_connection_input_type(j);
|
||||||
|
connecting_color=gn->get_connection_input_color(j);
|
||||||
|
connecting_target=false;
|
||||||
|
connecting_to=pos;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (p_ev.type==InputEvent::MOUSE_MOTION && connecting) {
|
||||||
|
|
||||||
|
connecting_to=Vector2(p_ev.mouse_motion.x,p_ev.mouse_motion.y);
|
||||||
|
connecting_target=false;
|
||||||
|
top_layer->update();
|
||||||
|
|
||||||
|
Ref<Texture> port =get_icon("port","GraphNode");
|
||||||
|
Vector2 mpos(p_ev.mouse_button.x,p_ev.mouse_button.y);
|
||||||
|
float grab_r=port->get_width()*0.5;
|
||||||
|
for(int i=get_child_count()-1;i>=0;i--) {
|
||||||
|
|
||||||
|
GraphNode *gn=get_child(i)->cast_to<GraphNode>();
|
||||||
|
if (!gn)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (!connecting_out) {
|
||||||
|
for(int j=0;j<gn->get_connection_output_count();j++) {
|
||||||
|
|
||||||
|
Vector2 pos = gn->get_connection_output_pos(j)+gn->get_pos();
|
||||||
|
int type =gn->get_connection_output_type(j);
|
||||||
|
if (type==connecting_type && pos.distance_to(mpos)<grab_r) {
|
||||||
|
|
||||||
|
connecting_target=true;
|
||||||
|
connecting_to=pos;
|
||||||
|
connecting_target_to=gn->get_name();
|
||||||
|
connecting_target_index=j;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
|
||||||
|
for(int j=0;j<gn->get_connection_input_count();j++) {
|
||||||
|
|
||||||
|
Vector2 pos = gn->get_connection_input_pos(j)+gn->get_pos();
|
||||||
|
int type =gn->get_connection_input_type(j);
|
||||||
|
if (type==connecting_type && pos.distance_to(mpos)<grab_r) {
|
||||||
|
connecting_target=true;
|
||||||
|
connecting_to=pos;
|
||||||
|
connecting_target_to=gn->get_name();
|
||||||
|
connecting_target_index=j;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (p_ev.type==InputEvent::MOUSE_BUTTON && p_ev.mouse_button.button_index==BUTTON_LEFT && !p_ev.mouse_button.pressed) {
|
||||||
|
|
||||||
|
if (connecting && connecting_target) {
|
||||||
|
|
||||||
|
String from = connecting_from;
|
||||||
|
int from_slot = connecting_index;
|
||||||
|
String to =connecting_target_to;
|
||||||
|
int to_slot = connecting_target_index;
|
||||||
|
|
||||||
|
if (!connecting_out) {
|
||||||
|
SWAP(from,to);
|
||||||
|
SWAP(from_slot,to_slot);
|
||||||
|
}
|
||||||
|
emit_signal("connection_request",from,from_slot,to,to_slot);
|
||||||
|
|
||||||
|
}
|
||||||
|
connecting=false;
|
||||||
|
top_layer->update();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void GraphEdit::_draw_cos_line(const Vector2& p_from, const Vector2& p_to,const Color& p_color) {
|
||||||
|
|
||||||
|
static const int steps = 20;
|
||||||
|
|
||||||
|
Rect2 r;
|
||||||
|
r.pos=p_from;
|
||||||
|
r.expand_to(p_to);
|
||||||
|
Vector2 sign=Vector2((p_from.x < p_to.x) ? 1 : -1,(p_from.y < p_to.y) ? 1 : -1);
|
||||||
|
bool flip = sign.x * sign.y < 0;
|
||||||
|
|
||||||
|
Vector2 prev;
|
||||||
|
for(int i=0;i<=steps;i++) {
|
||||||
|
|
||||||
|
float d = i/float(steps);
|
||||||
|
float c=-Math::cos(d*Math_PI) * 0.5+0.5;
|
||||||
|
if (flip)
|
||||||
|
c=1.0-c;
|
||||||
|
Vector2 p = r.pos+Vector2(d*r.size.width,c*r.size.height);
|
||||||
|
|
||||||
|
if (i>0) {
|
||||||
|
|
||||||
|
top_layer->draw_line(prev,p,p_color,2);
|
||||||
|
}
|
||||||
|
|
||||||
|
prev=p;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void GraphEdit::_top_layer_draw() {
|
||||||
|
|
||||||
|
_update_scroll();
|
||||||
|
|
||||||
|
if (connecting) {
|
||||||
|
|
||||||
|
Node *fromn = get_node(connecting_from);
|
||||||
|
ERR_FAIL_COND(!fromn);
|
||||||
|
GraphNode *from = fromn->cast_to<GraphNode>();
|
||||||
|
ERR_FAIL_COND(!from);
|
||||||
|
Vector2 pos;
|
||||||
|
if (connecting_out)
|
||||||
|
pos=from->get_connection_output_pos(connecting_index);
|
||||||
|
else
|
||||||
|
pos=from->get_connection_input_pos(connecting_index);
|
||||||
|
pos+=from->get_pos();
|
||||||
|
|
||||||
|
Vector2 topos;
|
||||||
|
topos=connecting_to;
|
||||||
|
|
||||||
|
Color col=connecting_color;
|
||||||
|
|
||||||
|
if (connecting_target) {
|
||||||
|
col.r+=0.4;
|
||||||
|
col.g+=0.4;
|
||||||
|
col.b+=0.4;
|
||||||
|
}
|
||||||
|
_draw_cos_line(pos,topos,col);
|
||||||
|
}
|
||||||
|
|
||||||
|
List<List<Connection>::Element* > to_erase;
|
||||||
|
for(List<Connection>::Element *E=connections.front();E;E=E->next()) {
|
||||||
|
|
||||||
|
NodePath fromnp(E->get().from);
|
||||||
|
|
||||||
|
Node * from = get_node(fromnp);
|
||||||
|
if (!from) {
|
||||||
|
to_erase.push_back(E);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
GraphNode *gfrom = from->cast_to<GraphNode>();
|
||||||
|
|
||||||
|
if (!gfrom) {
|
||||||
|
to_erase.push_back(E);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
NodePath tonp(E->get().to);
|
||||||
|
Node * to = get_node(tonp);
|
||||||
|
if (!to) {
|
||||||
|
to_erase.push_back(E);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
GraphNode *gto = to->cast_to<GraphNode>();
|
||||||
|
|
||||||
|
if (!gto) {
|
||||||
|
to_erase.push_back(E);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
Vector2 frompos=gfrom->get_connection_output_pos(E->get().from_port)+gfrom->get_pos();
|
||||||
|
Color color = gfrom->get_connection_output_color(E->get().from_port);
|
||||||
|
Vector2 topos=gto->get_connection_input_pos(E->get().to_port)+gto->get_pos();
|
||||||
|
_draw_cos_line(frompos,topos,color);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
while(to_erase.size()) {
|
||||||
|
connections.erase(to_erase.front()->get());
|
||||||
|
to_erase.pop_front();
|
||||||
|
}
|
||||||
|
//draw connections
|
||||||
|
}
|
||||||
|
|
||||||
|
void GraphEdit::_input_event(const InputEvent& p_ev) {
|
||||||
|
|
||||||
|
if (p_ev.type==InputEvent::MOUSE_MOTION && p_ev.mouse_motion.button_mask&BUTTON_MASK_MIDDLE) {
|
||||||
|
h_scroll->set_val( h_scroll->get_val() - p_ev.mouse_motion.relative_x );
|
||||||
|
v_scroll->set_val( v_scroll->get_val() - p_ev.mouse_motion.relative_y );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void GraphEdit::clear_connections() {
|
||||||
|
|
||||||
|
connections.clear();
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void GraphEdit::_bind_methods() {
|
||||||
|
|
||||||
|
ObjectTypeDB::bind_method(_MD("connect_node:Error","from","from_port","to","to_port"),&GraphEdit::connect_node);
|
||||||
|
ObjectTypeDB::bind_method(_MD("is_node_connected","from","from_port","to","to_port"),&GraphEdit::is_node_connected);
|
||||||
|
ObjectTypeDB::bind_method(_MD("disconnect_node","from","from_port","to","to_port"),&GraphEdit::disconnect_node);
|
||||||
|
ObjectTypeDB::bind_method(_MD("_graph_node_moved"),&GraphEdit::_graph_node_moved);
|
||||||
|
ObjectTypeDB::bind_method(_MD("_graph_node_raised"),&GraphEdit::_graph_node_raised);
|
||||||
|
|
||||||
|
ObjectTypeDB::bind_method(_MD("_top_layer_input"),&GraphEdit::_top_layer_input);
|
||||||
|
ObjectTypeDB::bind_method(_MD("_top_layer_draw"),&GraphEdit::_top_layer_draw);
|
||||||
|
ObjectTypeDB::bind_method(_MD("_scroll_moved"),&GraphEdit::_scroll_moved);
|
||||||
|
|
||||||
|
ObjectTypeDB::bind_method(_MD("_input_event"),&GraphEdit::_input_event);
|
||||||
|
|
||||||
|
ADD_SIGNAL(MethodInfo("connection_request",PropertyInfo(Variant::STRING,"from"),PropertyInfo(Variant::INT,"from_slot"),PropertyInfo(Variant::STRING,"to"),PropertyInfo(Variant::INT,"to_slot")));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
GraphEdit::GraphEdit() {
|
||||||
|
top_layer=NULL;
|
||||||
|
top_layer=memnew(GraphEditFilter(this));
|
||||||
|
add_child(top_layer);
|
||||||
|
top_layer->set_stop_mouse(false);
|
||||||
|
top_layer->set_area_as_parent_rect();
|
||||||
|
top_layer->connect("draw",this,"_top_layer_draw");
|
||||||
|
top_layer->set_stop_mouse(false);
|
||||||
|
top_layer->connect("input_event",this,"_top_layer_input");
|
||||||
|
|
||||||
|
h_scroll = memnew(HScrollBar);
|
||||||
|
h_scroll->set_name("_h_scroll");
|
||||||
|
top_layer->add_child(h_scroll);
|
||||||
|
|
||||||
|
v_scroll = memnew(VScrollBar);
|
||||||
|
v_scroll->set_name("_v_scroll");
|
||||||
|
top_layer->add_child(v_scroll);
|
||||||
|
updating=false;
|
||||||
|
connecting=false;
|
||||||
|
|
||||||
|
h_scroll->connect("value_changed", this,"_scroll_moved");
|
||||||
|
v_scroll->connect("value_changed", this,"_scroll_moved");
|
||||||
|
}
|
93
scene/gui/graph_edit.h
Normal file
93
scene/gui/graph_edit.h
Normal file
@ -0,0 +1,93 @@
|
|||||||
|
#ifndef GRAPH_EDIT_H
|
||||||
|
#define GRAPH_EDIT_H
|
||||||
|
|
||||||
|
#include "scene/gui/graph_node.h"
|
||||||
|
#include "scene/gui/scroll_bar.h"
|
||||||
|
|
||||||
|
class GraphEdit;
|
||||||
|
|
||||||
|
class GraphEditFilter : public Control {
|
||||||
|
|
||||||
|
OBJ_TYPE(GraphEditFilter,Control);
|
||||||
|
|
||||||
|
friend class GraphEdit;
|
||||||
|
GraphEdit *ge;
|
||||||
|
virtual bool has_point(const Point2& p_point) const;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
|
||||||
|
GraphEditFilter(GraphEdit *p_edit);
|
||||||
|
};
|
||||||
|
|
||||||
|
class GraphEdit : public Control {
|
||||||
|
|
||||||
|
OBJ_TYPE(GraphEdit,Control);
|
||||||
|
public:
|
||||||
|
|
||||||
|
struct Connection {
|
||||||
|
StringName from;
|
||||||
|
StringName to;
|
||||||
|
int from_port;
|
||||||
|
int to_port;
|
||||||
|
|
||||||
|
};
|
||||||
|
private:
|
||||||
|
|
||||||
|
HScrollBar* h_scroll;
|
||||||
|
VScrollBar* v_scroll;
|
||||||
|
|
||||||
|
|
||||||
|
bool connecting;
|
||||||
|
String connecting_from;
|
||||||
|
bool connecting_out;
|
||||||
|
int connecting_index;
|
||||||
|
int connecting_type;
|
||||||
|
Color connecting_color;
|
||||||
|
bool connecting_target;
|
||||||
|
Vector2 connecting_to;
|
||||||
|
String connecting_target_to;
|
||||||
|
int connecting_target_index;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
bool updating;
|
||||||
|
List<Connection> connections;
|
||||||
|
|
||||||
|
void _draw_cos_line(const Vector2& p_from, const Vector2& p_to,const Color& p_color);
|
||||||
|
|
||||||
|
void _graph_node_raised(Node* p_gn);
|
||||||
|
void _graph_node_moved(Node *p_gn);
|
||||||
|
|
||||||
|
void _update_scroll();
|
||||||
|
void _scroll_moved(double);
|
||||||
|
void _input_event(const InputEvent& p_ev);
|
||||||
|
|
||||||
|
GraphEditFilter *top_layer;
|
||||||
|
void _top_layer_input(const InputEvent& p_ev);
|
||||||
|
void _top_layer_draw();
|
||||||
|
void _update_scroll_offset();
|
||||||
|
|
||||||
|
friend class GraphEditFilter;
|
||||||
|
bool _filter_input(const Point2& p_point);
|
||||||
|
protected:
|
||||||
|
|
||||||
|
static void _bind_methods();
|
||||||
|
virtual void add_child_notify(Node *p_child);
|
||||||
|
virtual void remove_child_notify(Node *p_child);
|
||||||
|
void _notification(int p_what);
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
Error connect_node(const StringName& p_from, int p_from_port,const StringName& p_to,int p_to_port);
|
||||||
|
bool is_node_connected(const StringName& p_from, int p_from_port,const StringName& p_to,int p_to_port);
|
||||||
|
void disconnect_node(const StringName& p_from, int p_from_port,const StringName& p_to,int p_to_port);
|
||||||
|
void clear_connections();
|
||||||
|
|
||||||
|
void get_connection_list(List<Connection> *r_connections);
|
||||||
|
|
||||||
|
|
||||||
|
GraphEdit();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // GRAPHEdit_H
|
@ -76,7 +76,7 @@ void GraphNode::_get_property_list( List<PropertyInfo> *p_list) const{
|
|||||||
int idx=0;
|
int idx=0;
|
||||||
for(int i=0;i<get_child_count();i++) {
|
for(int i=0;i<get_child_count();i++) {
|
||||||
Control *c=get_child(i)->cast_to<Control>();
|
Control *c=get_child(i)->cast_to<Control>();
|
||||||
if (!c || c->is_set_as_toplevel() || !c->get_owner())
|
if (!c || c->is_set_as_toplevel() )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
String base="slot/"+itos(idx)+"/";
|
String base="slot/"+itos(idx)+"/";
|
||||||
@ -122,6 +122,7 @@ void GraphNode::_resort() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int vofs=0;
|
int vofs=0;
|
||||||
int w = get_size().x - sb->get_minimum_size().x;
|
int w = get_size().x - sb->get_minimum_size().x;
|
||||||
|
|
||||||
@ -131,7 +132,7 @@ void GraphNode::_resort() {
|
|||||||
Control *c=get_child(i)->cast_to<Control>();
|
Control *c=get_child(i)->cast_to<Control>();
|
||||||
if (!c)
|
if (!c)
|
||||||
continue;
|
continue;
|
||||||
if (c->is_set_as_toplevel() || !c->get_owner())
|
if (c->is_set_as_toplevel())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
Size2i size=c->get_combined_minimum_size();
|
Size2i size=c->get_combined_minimum_size();
|
||||||
@ -150,6 +151,8 @@ void GraphNode::_resort() {
|
|||||||
|
|
||||||
_change_notify();
|
_change_notify();
|
||||||
update();
|
update();
|
||||||
|
connpos_dirty=true;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -160,14 +163,34 @@ void GraphNode::_notification(int p_what) {
|
|||||||
|
|
||||||
Ref<StyleBox> sb=get_stylebox("frame");
|
Ref<StyleBox> sb=get_stylebox("frame");
|
||||||
Ref<Texture> port =get_icon("port");
|
Ref<Texture> port =get_icon("port");
|
||||||
|
Ref<Texture> close =get_icon("close");
|
||||||
|
int close_offset = get_constant("close_offset");
|
||||||
|
Ref<Font> title_font = get_font("title_font");
|
||||||
|
int title_offset = get_constant("title_offset");
|
||||||
|
Color title_color = get_color("title_color");
|
||||||
Point2i icofs = -port->get_size()*0.5;
|
Point2i icofs = -port->get_size()*0.5;
|
||||||
int edgeofs=3;
|
int edgeofs=get_constant("port_offset");
|
||||||
icofs.y+=sb->get_margin(MARGIN_TOP);
|
icofs.y+=sb->get_margin(MARGIN_TOP);
|
||||||
draw_style_box(sb,Rect2(Point2(),get_size()));
|
draw_style_box(sb,Rect2(Point2(),get_size()));
|
||||||
|
|
||||||
|
int w = get_size().width-sb->get_minimum_size().x;
|
||||||
|
|
||||||
|
if (show_close)
|
||||||
|
w-=close->get_width();
|
||||||
|
|
||||||
|
draw_string(title_font,Point2(sb->get_margin(MARGIN_LEFT),-title_font->get_height()+title_font->get_ascent()+title_offset),title,title_color,w);
|
||||||
|
if (show_close) {
|
||||||
|
Vector2 cpos = Point2(w+sb->get_margin(MARGIN_LEFT),-close->get_height()+close_offset);
|
||||||
|
draw_texture(close,cpos);
|
||||||
|
close_rect.pos=cpos;
|
||||||
|
close_rect.size=close->get_size();
|
||||||
|
} else {
|
||||||
|
close_rect=Rect2();
|
||||||
|
}
|
||||||
|
|
||||||
for (Map<int,Slot>::Element *E=slot_info.front();E;E=E->next()) {
|
for (Map<int,Slot>::Element *E=slot_info.front();E;E=E->next()) {
|
||||||
|
|
||||||
if (E->key()>cache_y.size())
|
if (E->key() < 0 || E->key()>=cache_y.size())
|
||||||
continue;
|
continue;
|
||||||
if (!slot_info.has(E->key()))
|
if (!slot_info.has(E->key()))
|
||||||
continue;
|
continue;
|
||||||
@ -180,6 +203,7 @@ void GraphNode::_notification(int p_what) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (p_what==NOTIFICATION_SORT_CHILDREN) {
|
if (p_what==NOTIFICATION_SORT_CHILDREN) {
|
||||||
|
|
||||||
_resort();
|
_resort();
|
||||||
@ -187,16 +211,6 @@ void GraphNode::_notification(int p_what) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GraphNode::set_title(const String& p_title) {
|
|
||||||
|
|
||||||
title=p_title;
|
|
||||||
update();
|
|
||||||
}
|
|
||||||
|
|
||||||
String GraphNode::get_title() const {
|
|
||||||
|
|
||||||
return title;
|
|
||||||
}
|
|
||||||
|
|
||||||
void GraphNode::set_slot(int p_idx,bool p_enable_left,int p_type_left,const Color& p_color_left, bool p_enable_right,int p_type_right,const Color& p_color_right) {
|
void GraphNode::set_slot(int p_idx,bool p_enable_left,int p_type_left,const Color& p_color_left, bool p_enable_right,int p_type_right,const Color& p_color_right) {
|
||||||
|
|
||||||
@ -216,17 +230,23 @@ void GraphNode::set_slot(int p_idx,bool p_enable_left,int p_type_left,const Colo
|
|||||||
s.color_right=p_color_right;
|
s.color_right=p_color_right;
|
||||||
slot_info[p_idx]=s;
|
slot_info[p_idx]=s;
|
||||||
update();
|
update();
|
||||||
|
connpos_dirty=true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GraphNode::clear_slot(int p_idx){
|
void GraphNode::clear_slot(int p_idx){
|
||||||
|
|
||||||
slot_info.erase(p_idx);
|
slot_info.erase(p_idx);
|
||||||
update();
|
update();
|
||||||
|
connpos_dirty=true;
|
||||||
|
|
||||||
}
|
}
|
||||||
void GraphNode::clear_all_slots(){
|
void GraphNode::clear_all_slots(){
|
||||||
|
|
||||||
slot_info.clear();
|
slot_info.clear();
|
||||||
update();
|
update();
|
||||||
|
connpos_dirty=true;
|
||||||
|
|
||||||
}
|
}
|
||||||
bool GraphNode::is_slot_enabled_left(int p_idx) const{
|
bool GraphNode::is_slot_enabled_left(int p_idx) const{
|
||||||
|
|
||||||
@ -280,18 +300,26 @@ Color GraphNode::get_slot_color_right(int p_idx) const{
|
|||||||
|
|
||||||
Size2 GraphNode::get_minimum_size() const {
|
Size2 GraphNode::get_minimum_size() const {
|
||||||
|
|
||||||
|
Ref<Font> title_font = get_font("title_font");
|
||||||
|
|
||||||
int sep=get_constant("separation");
|
int sep=get_constant("separation");
|
||||||
Ref<StyleBox> sb=get_stylebox("frame");
|
Ref<StyleBox> sb=get_stylebox("frame");
|
||||||
bool first=true;
|
bool first=true;
|
||||||
|
|
||||||
Size2 minsize;
|
Size2 minsize;
|
||||||
|
minsize.x=title_font->get_string_size(title).x;
|
||||||
|
if (show_close) {
|
||||||
|
Ref<Texture> close =get_icon("close");
|
||||||
|
minsize.x+=sep+close->get_width();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
for(int i=0;i<get_child_count();i++) {
|
for(int i=0;i<get_child_count();i++) {
|
||||||
|
|
||||||
Control *c=get_child(i)->cast_to<Control>();
|
Control *c=get_child(i)->cast_to<Control>();
|
||||||
if (!c)
|
if (!c)
|
||||||
continue;
|
continue;
|
||||||
if (c->is_set_as_toplevel() || !c->get_owner())
|
if (c->is_set_as_toplevel())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
Size2i size=c->get_combined_minimum_size();
|
Size2i size=c->get_combined_minimum_size();
|
||||||
@ -308,13 +336,225 @@ Size2 GraphNode::get_minimum_size() const {
|
|||||||
return minsize+sb->get_minimum_size();
|
return minsize+sb->get_minimum_size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GraphNode::set_title(const String& p_title) {
|
||||||
|
|
||||||
|
title=p_title;
|
||||||
|
minimum_size_changed();
|
||||||
|
update();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
String GraphNode::get_title() const{
|
||||||
|
|
||||||
|
return title;
|
||||||
|
}
|
||||||
|
|
||||||
|
void GraphNode::set_offset(const Vector2& p_offset) {
|
||||||
|
|
||||||
|
offset=p_offset;
|
||||||
|
emit_signal("offset_changed");
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
|
||||||
|
Vector2 GraphNode::get_offset() const {
|
||||||
|
|
||||||
|
return offset;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void GraphNode::set_show_close_button(bool p_enable){
|
||||||
|
|
||||||
|
show_close=p_enable;
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
bool GraphNode::is_close_button_visible() const{
|
||||||
|
|
||||||
|
return show_close;
|
||||||
|
}
|
||||||
|
|
||||||
|
void GraphNode::_connpos_update() {
|
||||||
|
|
||||||
|
|
||||||
|
int edgeofs=get_constant("port_offset");
|
||||||
|
int sep=get_constant("separation");
|
||||||
|
|
||||||
|
Ref<StyleBox> sb=get_stylebox("frame");
|
||||||
|
Ref<Texture> port =get_icon("port");
|
||||||
|
conn_input_cache.clear();
|
||||||
|
conn_output_cache.clear();
|
||||||
|
int vofs=0;
|
||||||
|
|
||||||
|
int idx=0;
|
||||||
|
|
||||||
|
for(int i=0;i<get_child_count();i++) {
|
||||||
|
Control *c=get_child(i)->cast_to<Control>();
|
||||||
|
if (!c)
|
||||||
|
continue;
|
||||||
|
if (c->is_set_as_toplevel())
|
||||||
|
continue;
|
||||||
|
|
||||||
|
Size2i size=c->get_combined_minimum_size();
|
||||||
|
|
||||||
|
int y = sb->get_margin(MARGIN_TOP)+vofs;
|
||||||
|
int h = size.y;
|
||||||
|
|
||||||
|
|
||||||
|
if (slot_info.has(idx)) {
|
||||||
|
|
||||||
|
if (slot_info[idx].enable_left) {
|
||||||
|
ConnCache cc;
|
||||||
|
cc.pos=Point2i(edgeofs,y+h/2);
|
||||||
|
cc.type=slot_info[idx].type_left;
|
||||||
|
cc.color=slot_info[idx].color_left;
|
||||||
|
conn_input_cache.push_back(cc);
|
||||||
|
}
|
||||||
|
if (slot_info[idx].enable_right) {
|
||||||
|
ConnCache cc;
|
||||||
|
cc.pos=Point2i(get_size().width-edgeofs,y+h/2);
|
||||||
|
cc.type=slot_info[idx].type_right;
|
||||||
|
cc.color=slot_info[idx].color_right;
|
||||||
|
conn_output_cache.push_back(cc);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (vofs>0)
|
||||||
|
vofs+=sep;
|
||||||
|
vofs+=size.y;
|
||||||
|
idx++;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
connpos_dirty=false;
|
||||||
|
}
|
||||||
|
|
||||||
|
int GraphNode::get_connection_input_count() {
|
||||||
|
|
||||||
|
if (connpos_dirty)
|
||||||
|
_connpos_update();
|
||||||
|
|
||||||
|
return conn_input_cache.size();
|
||||||
|
|
||||||
|
}
|
||||||
|
int GraphNode::get_connection_output_count() {
|
||||||
|
|
||||||
|
if (connpos_dirty)
|
||||||
|
_connpos_update();
|
||||||
|
|
||||||
|
return conn_output_cache.size();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Vector2 GraphNode::get_connection_input_pos(int p_idx) {
|
||||||
|
|
||||||
|
if (connpos_dirty)
|
||||||
|
_connpos_update();
|
||||||
|
|
||||||
|
ERR_FAIL_INDEX_V(p_idx,conn_input_cache.size(),Vector2());
|
||||||
|
return conn_input_cache[p_idx].pos;
|
||||||
|
}
|
||||||
|
|
||||||
|
int GraphNode::get_connection_input_type(int p_idx) {
|
||||||
|
|
||||||
|
if (connpos_dirty)
|
||||||
|
_connpos_update();
|
||||||
|
|
||||||
|
ERR_FAIL_INDEX_V(p_idx,conn_input_cache.size(),0);
|
||||||
|
return conn_input_cache[p_idx].type;
|
||||||
|
}
|
||||||
|
|
||||||
|
Color GraphNode::get_connection_input_color(int p_idx) {
|
||||||
|
|
||||||
|
if (connpos_dirty)
|
||||||
|
_connpos_update();
|
||||||
|
|
||||||
|
ERR_FAIL_INDEX_V(p_idx,conn_input_cache.size(),Color());
|
||||||
|
return conn_input_cache[p_idx].color;
|
||||||
|
}
|
||||||
|
|
||||||
|
Vector2 GraphNode::get_connection_output_pos(int p_idx){
|
||||||
|
|
||||||
|
if (connpos_dirty)
|
||||||
|
_connpos_update();
|
||||||
|
|
||||||
|
ERR_FAIL_INDEX_V(p_idx,conn_output_cache.size(),Vector2());
|
||||||
|
return conn_output_cache[p_idx].pos;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
int GraphNode::get_connection_output_type(int p_idx) {
|
||||||
|
|
||||||
|
if (connpos_dirty)
|
||||||
|
_connpos_update();
|
||||||
|
|
||||||
|
ERR_FAIL_INDEX_V(p_idx,conn_output_cache.size(),0);
|
||||||
|
return conn_output_cache[p_idx].type;
|
||||||
|
}
|
||||||
|
|
||||||
|
Color GraphNode::get_connection_output_color(int p_idx) {
|
||||||
|
|
||||||
|
if (connpos_dirty)
|
||||||
|
_connpos_update();
|
||||||
|
|
||||||
|
ERR_FAIL_INDEX_V(p_idx,conn_output_cache.size(),Color());
|
||||||
|
return conn_output_cache[p_idx].color;
|
||||||
|
}
|
||||||
|
|
||||||
|
void GraphNode::_input_event(const InputEvent& p_ev) {
|
||||||
|
|
||||||
|
if (p_ev.type==InputEvent::MOUSE_BUTTON && p_ev.mouse_button.pressed && p_ev.mouse_button.button_index==BUTTON_LEFT) {
|
||||||
|
|
||||||
|
Vector2 mpos = Vector2(p_ev.mouse_button.x,p_ev.mouse_button.y);
|
||||||
|
if (close_rect.size!=Size2() && close_rect.has_point(mpos)) {
|
||||||
|
emit_signal("close_request");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
drag_from=get_offset();
|
||||||
|
drag_accum=Vector2();
|
||||||
|
dragging=true;
|
||||||
|
emit_signal("raise_request");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if (p_ev.type==InputEvent::MOUSE_BUTTON && !p_ev.mouse_button.pressed && p_ev.mouse_button.button_index==BUTTON_LEFT) {
|
||||||
|
|
||||||
|
dragging=false;
|
||||||
|
emit_signal("dragged",drag_from,get_offset()); //useful for undo/redo
|
||||||
|
}
|
||||||
|
|
||||||
|
if (p_ev.type==InputEvent::MOUSE_MOTION && dragging) {
|
||||||
|
|
||||||
|
drag_accum+=Vector2(p_ev.mouse_motion.relative_x,p_ev.mouse_motion.relative_y);
|
||||||
|
set_offset(drag_from+drag_accum);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void GraphNode::_bind_methods() {
|
void GraphNode::_bind_methods() {
|
||||||
|
|
||||||
|
ObjectTypeDB::bind_method(_MD("set_title","title"),&GraphNode::set_title);
|
||||||
|
ObjectTypeDB::bind_method(_MD("get_title"),&GraphNode::get_title);
|
||||||
|
ObjectTypeDB::bind_method(_MD("_input_event"),&GraphNode::_input_event);
|
||||||
|
|
||||||
|
ObjectTypeDB::bind_method(_MD("set_show_close_button","show"),&GraphNode::set_show_close_button);
|
||||||
|
ObjectTypeDB::bind_method(_MD("is_close_button_visible"),&GraphNode::is_close_button_visible);
|
||||||
|
|
||||||
|
ADD_PROPERTY( PropertyInfo(Variant::STRING,"title"),_SCS("set_title"),_SCS("get_title"));
|
||||||
|
ADD_PROPERTY( PropertyInfo(Variant::BOOL,"show_close"),_SCS("set_show_close_button"),_SCS("is_close_button_visible"));
|
||||||
|
|
||||||
|
ADD_SIGNAL(MethodInfo("offset_changed"));
|
||||||
|
ADD_SIGNAL(MethodInfo("dragged",PropertyInfo(Variant::VECTOR2,"from"),PropertyInfo(Variant::VECTOR2,"to")));
|
||||||
|
ADD_SIGNAL(MethodInfo("raise_request"));
|
||||||
|
ADD_SIGNAL(MethodInfo("close_request"));
|
||||||
}
|
}
|
||||||
|
|
||||||
GraphNode::GraphNode() {
|
GraphNode::GraphNode() {
|
||||||
|
|
||||||
|
dragging=false;
|
||||||
|
show_close=false;
|
||||||
|
connpos_dirty=true;
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@ class GraphNode : public Container {
|
|||||||
OBJ_TYPE(GraphNode,Container);
|
OBJ_TYPE(GraphNode,Container);
|
||||||
|
|
||||||
|
|
||||||
String title;
|
|
||||||
struct Slot {
|
struct Slot {
|
||||||
bool enable_left;
|
bool enable_left;
|
||||||
int type_left;
|
int type_left;
|
||||||
@ -21,13 +21,36 @@ class GraphNode : public Container {
|
|||||||
Slot() { enable_left=false; type_left=0; color_left=Color(1,1,1,1); enable_right=false; type_right=0; color_right=Color(1,1,1,1); };
|
Slot() { enable_left=false; type_left=0; color_left=Color(1,1,1,1); enable_right=false; type_right=0; color_right=Color(1,1,1,1); };
|
||||||
};
|
};
|
||||||
|
|
||||||
|
String title;
|
||||||
|
bool show_close;
|
||||||
|
Vector2 offset;
|
||||||
|
|
||||||
|
Rect2 close_rect;
|
||||||
|
|
||||||
Vector<int> cache_y;
|
Vector<int> cache_y;
|
||||||
|
|
||||||
|
struct ConnCache {
|
||||||
|
Vector2 pos;
|
||||||
|
int type;
|
||||||
|
Color color;
|
||||||
|
};
|
||||||
|
|
||||||
|
Vector<ConnCache> conn_input_cache;
|
||||||
|
Vector<ConnCache> conn_output_cache;
|
||||||
|
|
||||||
Map<int,Slot> slot_info;
|
Map<int,Slot> slot_info;
|
||||||
|
|
||||||
|
bool connpos_dirty;
|
||||||
|
|
||||||
|
void _connpos_update();
|
||||||
void _resort();
|
void _resort();
|
||||||
|
|
||||||
|
Vector2 drag_from;
|
||||||
|
Vector2 drag_accum;
|
||||||
|
bool dragging;
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
void _input_event(const InputEvent& p_ev);
|
||||||
void _notification(int p_what);
|
void _notification(int p_what);
|
||||||
static void _bind_methods();
|
static void _bind_methods();
|
||||||
|
|
||||||
@ -39,8 +62,6 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
void set_title(const String& p_title);
|
|
||||||
String get_title() const;
|
|
||||||
|
|
||||||
void set_slot(int p_idx,bool p_enable_left,int p_type_left,const Color& p_color_left, bool p_enable_right,int p_type_right,const Color& p_color_right);
|
void set_slot(int p_idx,bool p_enable_left,int p_type_left,const Color& p_color_left, bool p_enable_right,int p_type_right,const Color& p_color_right);
|
||||||
void clear_slot(int p_idx);
|
void clear_slot(int p_idx);
|
||||||
@ -52,6 +73,25 @@ public:
|
|||||||
int get_slot_type_right(int p_idx) const;
|
int get_slot_type_right(int p_idx) const;
|
||||||
Color get_slot_color_right(int p_idx) const;
|
Color get_slot_color_right(int p_idx) const;
|
||||||
|
|
||||||
|
void set_title(const String& p_title);
|
||||||
|
String get_title() const;
|
||||||
|
|
||||||
|
void set_offset(const Vector2& p_offset);
|
||||||
|
Vector2 get_offset() const;
|
||||||
|
|
||||||
|
void set_show_close_button(bool p_enable);
|
||||||
|
bool is_close_button_visible() const;
|
||||||
|
|
||||||
|
int get_connection_input_count() ;
|
||||||
|
int get_connection_output_count() ;
|
||||||
|
Vector2 get_connection_input_pos(int p_idx);
|
||||||
|
int get_connection_input_type(int p_idx);
|
||||||
|
Color get_connection_input_color(int p_idx);
|
||||||
|
Vector2 get_connection_output_pos(int p_idx);
|
||||||
|
int get_connection_output_type(int p_idx);
|
||||||
|
Color get_connection_output_color(int p_idx);
|
||||||
|
|
||||||
|
|
||||||
virtual Size2 get_minimum_size() const;
|
virtual Size2 get_minimum_size() const;
|
||||||
|
|
||||||
GraphNode();
|
GraphNode();
|
||||||
|
@ -84,6 +84,7 @@ void MenuButton::pressed() {
|
|||||||
popup->set_parent_rect( Rect2(Point2(gp-popup->get_global_pos()),get_size()));
|
popup->set_parent_rect( Rect2(Point2(gp-popup->get_global_pos()),get_size()));
|
||||||
popup->popup();
|
popup->popup();
|
||||||
popup->call_deferred("grab_click_focus");
|
popup->call_deferred("grab_click_focus");
|
||||||
|
popup->set_invalidate_click_until_motion();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,10 +52,17 @@ void Popup::_fix_size() {
|
|||||||
Control *window = get_window();
|
Control *window = get_window();
|
||||||
ERR_FAIL_COND(!window);
|
ERR_FAIL_COND(!window);
|
||||||
|
|
||||||
|
#if 0
|
||||||
Point2 pos = get_pos();
|
Point2 pos = get_pos();
|
||||||
Size2 size = get_size();
|
Size2 size = get_size();
|
||||||
Point2 window_size = window==this ? get_parent_area_size() :window->get_size();
|
Point2 window_size = window==this ? get_parent_area_size() :window->get_size();
|
||||||
|
#else
|
||||||
|
|
||||||
|
Point2 pos = get_global_pos();
|
||||||
|
Size2 size = get_size();
|
||||||
|
Point2 window_size = get_viewport_rect().size;
|
||||||
|
|
||||||
|
#endif
|
||||||
if (pos.x+size.width > window_size.width)
|
if (pos.x+size.width > window_size.width)
|
||||||
pos.x=window_size.width-size.width;
|
pos.x=window_size.width-size.width;
|
||||||
if (pos.x<0)
|
if (pos.x<0)
|
||||||
@ -65,8 +72,14 @@ void Popup::_fix_size() {
|
|||||||
pos.y=window_size.height-size.height;
|
pos.y=window_size.height-size.height;
|
||||||
if (pos.y<0)
|
if (pos.y<0)
|
||||||
pos.y=0;
|
pos.y=0;
|
||||||
|
#if 0
|
||||||
if (pos!=get_pos())
|
if (pos!=get_pos())
|
||||||
set_pos(pos);
|
set_pos(pos);
|
||||||
|
#else
|
||||||
|
if (pos!=get_pos())
|
||||||
|
set_global_pos(pos);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,6 +30,7 @@
|
|||||||
#include "print_string.h"
|
#include "print_string.h"
|
||||||
#include "os/keyboard.h"
|
#include "os/keyboard.h"
|
||||||
#include "translation.h"
|
#include "translation.h"
|
||||||
|
#include "os/input.h"
|
||||||
|
|
||||||
String PopupMenu::_get_accel_text(uint32_t p_accel) const {
|
String PopupMenu::_get_accel_text(uint32_t p_accel) const {
|
||||||
|
|
||||||
@ -318,6 +319,10 @@ void PopupMenu::_input_event(const InputEvent &p_event) {
|
|||||||
|
|
||||||
int over=_get_mouse_over(Point2(b.x,b.y));
|
int over=_get_mouse_over(Point2(b.x,b.y));
|
||||||
|
|
||||||
|
if (invalidated_click) {
|
||||||
|
invalidated_click=false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
if (over<0 || items[over].separator || items[over].disabled)
|
if (over<0 || items[over].separator || items[over].disabled)
|
||||||
break; //non-activable
|
break; //non-activable
|
||||||
|
|
||||||
@ -336,6 +341,13 @@ void PopupMenu::_input_event(const InputEvent &p_event) {
|
|||||||
case InputEvent::MOUSE_MOTION: {
|
case InputEvent::MOUSE_MOTION: {
|
||||||
|
|
||||||
|
|
||||||
|
if (invalidated_click) {
|
||||||
|
moved+=Vector2(p_event.mouse_motion.relative_x,p_event.mouse_motion.relative_y);
|
||||||
|
if (moved.length()>4)
|
||||||
|
invalidated_click=false;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
const InputEventMouseMotion &m=p_event.mouse_motion;
|
const InputEventMouseMotion &m=p_event.mouse_motion;
|
||||||
for(List<Rect2>::Element *E=autohide_areas.front();E;E=E->next()) {
|
for(List<Rect2>::Element *E=autohide_areas.front();E;E=E->next()) {
|
||||||
|
|
||||||
@ -893,12 +905,17 @@ void PopupMenu::_bind_methods() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void PopupMenu::set_invalidate_click_until_motion() {
|
||||||
|
moved=Vector2();
|
||||||
|
invalidated_click=true;
|
||||||
|
}
|
||||||
|
|
||||||
PopupMenu::PopupMenu() {
|
PopupMenu::PopupMenu() {
|
||||||
|
|
||||||
idcount=0;
|
idcount=0;
|
||||||
mouse_over=-1;
|
mouse_over=-1;
|
||||||
|
|
||||||
|
|
||||||
set_focus_mode(FOCUS_ALL);
|
set_focus_mode(FOCUS_ALL);
|
||||||
set_as_toplevel(true);
|
set_as_toplevel(true);
|
||||||
|
|
||||||
|
@ -70,6 +70,8 @@ class PopupMenu : public Popup {
|
|||||||
void _activate_submenu(int over);
|
void _activate_submenu(int over);
|
||||||
void _submenu_timeout();
|
void _submenu_timeout();
|
||||||
|
|
||||||
|
bool invalidated_click;
|
||||||
|
Vector2 moved;
|
||||||
|
|
||||||
Array _get_items() const;
|
Array _get_items() const;
|
||||||
void _set_items(const Array& p_items);
|
void _set_items(const Array& p_items);
|
||||||
@ -134,6 +136,8 @@ public:
|
|||||||
void add_autohide_area(const Rect2& p_area);
|
void add_autohide_area(const Rect2& p_area);
|
||||||
void clear_autohide_areas();
|
void clear_autohide_areas();
|
||||||
|
|
||||||
|
void set_invalidate_click_until_motion();
|
||||||
|
|
||||||
PopupMenu();
|
PopupMenu();
|
||||||
~PopupMenu();
|
~PopupMenu();
|
||||||
|
|
||||||
|
@ -602,6 +602,39 @@ void TabContainer::get_translatable_strings(List<String> *p_strings) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Size2 TabContainer::get_minimum_size() const {
|
||||||
|
|
||||||
|
Size2 ms;
|
||||||
|
|
||||||
|
for(int i=0;i<get_child_count();i++) {
|
||||||
|
|
||||||
|
Control *c = get_child(i)->cast_to<Control>();
|
||||||
|
if (!c)
|
||||||
|
continue;
|
||||||
|
if (c->is_set_as_toplevel())
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (!c->has_meta("_tab_name"))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (!c->is_visible())
|
||||||
|
continue;
|
||||||
|
|
||||||
|
Size2 cms = c->get_minimum_size();
|
||||||
|
ms.x=MAX(ms.x,cms.x);
|
||||||
|
ms.y=MAX(ms.y,cms.y);
|
||||||
|
}
|
||||||
|
|
||||||
|
Ref<StyleBox> tab_bg = get_stylebox("tab_bg");
|
||||||
|
Ref<StyleBox> tab_fg = get_stylebox("tab_fg");
|
||||||
|
Ref<Font> font = get_font("font");
|
||||||
|
|
||||||
|
ms.y+=MAX(tab_bg->get_minimum_size().y,tab_fg->get_minimum_size().y);
|
||||||
|
ms.y+=font->get_height();
|
||||||
|
|
||||||
|
return ms;
|
||||||
|
}
|
||||||
|
|
||||||
void TabContainer::_bind_methods() {
|
void TabContainer::_bind_methods() {
|
||||||
|
|
||||||
ObjectTypeDB::bind_method(_MD("_input_event"),&TabContainer::_input_event);
|
ObjectTypeDB::bind_method(_MD("_input_event"),&TabContainer::_input_event);
|
||||||
|
@ -85,6 +85,8 @@ public:
|
|||||||
void set_current_tab(int p_current);
|
void set_current_tab(int p_current);
|
||||||
int get_current_tab() const;
|
int get_current_tab() const;
|
||||||
|
|
||||||
|
virtual Size2 get_minimum_size() const;
|
||||||
|
|
||||||
virtual void get_translatable_strings(List<String> *p_strings) const;
|
virtual void get_translatable_strings(List<String> *p_strings) const;
|
||||||
|
|
||||||
TabContainer();
|
TabContainer();
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
/*****f********************************************/
|
/*****f********************************************/
|
||||||
/* text_edit.cpp */
|
/* text_edit.cpp */
|
||||||
/*************************************************/
|
/*************************************************/
|
||||||
/* This file is part of: */
|
/* This file is part of: */
|
||||||
@ -829,7 +829,7 @@ void TextEdit::_notification(int p_what) {
|
|||||||
completion_rect.pos.x=cursor_pos.x-nofs;
|
completion_rect.pos.x=cursor_pos.x-nofs;
|
||||||
}
|
}
|
||||||
|
|
||||||
completion_rect.size.width=w;
|
completion_rect.size.width=w+2;
|
||||||
completion_rect.size.height=h;
|
completion_rect.size.height=h;
|
||||||
if (completion_options.size()<=maxlines)
|
if (completion_options.size()<=maxlines)
|
||||||
scrollw=0;
|
scrollw=0;
|
||||||
@ -1034,6 +1034,8 @@ void TextEdit::_consume_backspace_for_pair_symbol(int prev_line, int prev_column
|
|||||||
}
|
}
|
||||||
|
|
||||||
void TextEdit::backspace_at_cursor() {
|
void TextEdit::backspace_at_cursor() {
|
||||||
|
if (readonly)
|
||||||
|
return;
|
||||||
|
|
||||||
if (cursor.column==0 && cursor.line==0)
|
if (cursor.column==0 && cursor.line==0)
|
||||||
return;
|
return;
|
||||||
@ -1150,19 +1152,55 @@ void TextEdit::_input_event(const InputEvent& p_input_event) {
|
|||||||
|
|
||||||
if (mb.mod.shift && (cursor.column!=prev_col || cursor.line!=prev_line)) {
|
if (mb.mod.shift && (cursor.column!=prev_col || cursor.line!=prev_line)) {
|
||||||
|
|
||||||
|
if (!selection.active) {
|
||||||
selection.active=true;
|
selection.active=true;
|
||||||
selection.selecting_mode=Selection::MODE_POINTER;
|
selection.selecting_mode=Selection::MODE_POINTER;
|
||||||
selection.from_column=prev_col;
|
selection.from_column=prev_col;
|
||||||
selection.from_line=prev_line;
|
selection.from_line=prev_line;
|
||||||
selection.to_column=cursor.column;
|
selection.to_column=cursor.column;
|
||||||
selection.to_line=cursor.line;
|
selection.to_line=cursor.line;
|
||||||
if (selection.from_column>selection.to_column) {
|
|
||||||
|
if (selection.from_line>selection.to_line || (selection.from_line==selection.to_line && selection.from_column>selection.to_column)) {
|
||||||
SWAP(selection.from_column,selection.to_column);
|
SWAP(selection.from_column,selection.to_column);
|
||||||
SWAP(selection.from_line,selection.to_line);
|
SWAP(selection.from_line,selection.to_line);
|
||||||
|
selection.shiftclick_left=false;
|
||||||
|
} else {
|
||||||
|
selection.shiftclick_left=true;
|
||||||
}
|
}
|
||||||
selection.selecting_line=prev_line;
|
selection.selecting_line=prev_line;
|
||||||
selection.selecting_column=prev_col;
|
selection.selecting_column=prev_col;
|
||||||
update();
|
update();
|
||||||
|
} else {
|
||||||
|
|
||||||
|
if (cursor.line<selection.from_line || (cursor.line==selection.from_line && cursor.column<=selection.from_column)) {
|
||||||
|
selection.from_column=cursor.column;
|
||||||
|
selection.from_line=cursor.line;
|
||||||
|
} else if (cursor.line>selection.to_line || (cursor.line==selection.to_line && cursor.column>=selection.to_column)) {
|
||||||
|
selection.to_column=cursor.column;
|
||||||
|
selection.to_line=cursor.line;
|
||||||
|
|
||||||
|
} else if (!selection.shiftclick_left) {
|
||||||
|
|
||||||
|
selection.from_column=cursor.column;
|
||||||
|
selection.from_line=cursor.line;
|
||||||
|
} else {
|
||||||
|
|
||||||
|
selection.to_column=cursor.column;
|
||||||
|
selection.to_line=cursor.line;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (selection.from_line>selection.to_line || (selection.from_line==selection.to_line && selection.from_column>selection.to_column)) {
|
||||||
|
SWAP(selection.from_column,selection.to_column);
|
||||||
|
SWAP(selection.from_line,selection.to_line);
|
||||||
|
}
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
@ -1251,6 +1289,8 @@ void TextEdit::_input_event(const InputEvent& p_input_event) {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if (completion_active) {
|
if (completion_active) {
|
||||||
|
if (readonly)
|
||||||
|
break;
|
||||||
|
|
||||||
bool valid=true;
|
bool valid=true;
|
||||||
if (k.mod.command || k.mod.alt || k.mod.meta)
|
if (k.mod.command || k.mod.alt || k.mod.meta)
|
||||||
@ -1400,6 +1440,9 @@ void TextEdit::_input_event(const InputEvent& p_input_event) {
|
|||||||
|
|
||||||
if (selection.active) {
|
if (selection.active) {
|
||||||
|
|
||||||
|
if (readonly)
|
||||||
|
break;
|
||||||
|
|
||||||
bool clear=false;
|
bool clear=false;
|
||||||
bool unselect=false;
|
bool unselect=false;
|
||||||
bool dobreak=false;
|
bool dobreak=false;
|
||||||
@ -1513,6 +1556,9 @@ void TextEdit::_input_event(const InputEvent& p_input_event) {
|
|||||||
case KEY_ENTER:
|
case KEY_ENTER:
|
||||||
case KEY_RETURN: {
|
case KEY_RETURN: {
|
||||||
|
|
||||||
|
if (readonly)
|
||||||
|
break;
|
||||||
|
|
||||||
String ins="\n";
|
String ins="\n";
|
||||||
|
|
||||||
//keep indentation
|
//keep indentation
|
||||||
@ -1911,7 +1957,11 @@ void TextEdit::_input_event(const InputEvent& p_input_event) {
|
|||||||
update();
|
update();
|
||||||
} break;
|
} break;
|
||||||
case KEY_SPACE: {
|
case KEY_SPACE: {
|
||||||
|
#ifdef OSX_ENABLED
|
||||||
|
if (completion_enabled && k.mod.meta) { //cmd-space is spotlight shortcut in OSX
|
||||||
|
#else
|
||||||
if (completion_enabled && k.mod.command) {
|
if (completion_enabled && k.mod.command) {
|
||||||
|
#endif
|
||||||
|
|
||||||
query_code_comple();
|
query_code_comple();
|
||||||
scancode_handled=true;
|
scancode_handled=true;
|
||||||
@ -1953,7 +2003,7 @@ void TextEdit::_input_event(const InputEvent& p_input_event) {
|
|||||||
|
|
||||||
if (scancode_handled)
|
if (scancode_handled)
|
||||||
accept_event();
|
accept_event();
|
||||||
/*
|
/*
|
||||||
if (!scancode_handled && !k.mod.command && !k.mod.alt) {
|
if (!scancode_handled && !k.mod.command && !k.mod.alt) {
|
||||||
|
|
||||||
if (k.unicode>=32) {
|
if (k.unicode>=32) {
|
||||||
@ -2311,7 +2361,7 @@ void TextEdit::adjust_viewport_to_cursor() {
|
|||||||
cursor.x_ofs=cursor_x;
|
cursor.x_ofs=cursor_x;
|
||||||
|
|
||||||
update();
|
update();
|
||||||
/*
|
/*
|
||||||
get_range()->set_max(text.size());
|
get_range()->set_max(text.size());
|
||||||
|
|
||||||
get_range()->set_page(get_visible_rows());
|
get_range()->set_page(get_visible_rows());
|
||||||
@ -3229,6 +3279,27 @@ void TextEdit::_update_completion_candidates() {
|
|||||||
|
|
||||||
String s;
|
String s;
|
||||||
|
|
||||||
|
//look for keywords first
|
||||||
|
|
||||||
|
bool pre_keyword=false;
|
||||||
|
|
||||||
|
if (cofs>0 && l[cofs-1]==' ') {
|
||||||
|
int kofs=cofs-1;
|
||||||
|
String kw;
|
||||||
|
while (kofs>=0 && l[kofs]==' ')
|
||||||
|
kofs--;
|
||||||
|
|
||||||
|
while(kofs>=0 && l[kofs]>32 && _is_completable(l[kofs])) {
|
||||||
|
kw=String::chr(l[kofs])+kw;
|
||||||
|
kofs--;
|
||||||
|
}
|
||||||
|
|
||||||
|
pre_keyword=keywords.has(kw);
|
||||||
|
print_line("KW "+kw+"? "+itos(pre_keyword));
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
|
||||||
while(cofs>0 && l[cofs-1]>32 && _is_completable(l[cofs-1])) {
|
while(cofs>0 && l[cofs-1]>32 && _is_completable(l[cofs-1])) {
|
||||||
s=String::chr(l[cofs-1])+s;
|
s=String::chr(l[cofs-1])+s;
|
||||||
if (l[cofs-1]=='\'' || l[cofs-1]=='"')
|
if (l[cofs-1]=='\'' || l[cofs-1]=='"')
|
||||||
@ -3236,11 +3307,12 @@ void TextEdit::_update_completion_candidates() {
|
|||||||
|
|
||||||
cofs--;
|
cofs--;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
update();
|
update();
|
||||||
|
|
||||||
if (s=="" && (cofs==0 || !completion_prefixes.has(String::chr(l[cofs-1])))) {
|
if (!pre_keyword && s=="" && (cofs==0 || !completion_prefixes.has(String::chr(l[cofs-1])))) {
|
||||||
//none to complete, cancel
|
//none to complete, cancel
|
||||||
_cancel_completion();
|
_cancel_completion();
|
||||||
return;
|
return;
|
||||||
@ -3288,7 +3360,7 @@ void TextEdit::_update_completion_candidates() {
|
|||||||
if (completion_options.size()==1) {
|
if (completion_options.size()==1) {
|
||||||
//one option to complete, just complete it automagically
|
//one option to complete, just complete it automagically
|
||||||
_confirm_completion();
|
_confirm_completion();
|
||||||
// insert_text_at_cursor(completion_options[0].substr(s.length(),completion_options[0].length()-s.length()));
|
// insert_text_at_cursor(completion_options[0].substr(s.length(),completion_options[0].length()-s.length()));
|
||||||
_cancel_completion();
|
_cancel_completion();
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -3328,7 +3400,7 @@ void TextEdit::code_complete(const Vector<String> &p_strings) {
|
|||||||
completion_current="";
|
completion_current="";
|
||||||
completion_index=0;
|
completion_index=0;
|
||||||
_update_completion_candidates();
|
_update_completion_candidates();
|
||||||
//
|
//
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -3414,7 +3486,7 @@ void TextEdit::_bind_methods() {
|
|||||||
BIND_CONSTANT( SEARCH_WHOLE_WORDS );
|
BIND_CONSTANT( SEARCH_WHOLE_WORDS );
|
||||||
BIND_CONSTANT( SEARCH_BACKWARDS );
|
BIND_CONSTANT( SEARCH_BACKWARDS );
|
||||||
|
|
||||||
/*
|
/*
|
||||||
ObjectTypeDB::bind_method(_MD("delete_char"),&TextEdit::delete_char);
|
ObjectTypeDB::bind_method(_MD("delete_char"),&TextEdit::delete_char);
|
||||||
ObjectTypeDB::bind_method(_MD("delete_line"),&TextEdit::delete_line);
|
ObjectTypeDB::bind_method(_MD("delete_line"),&TextEdit::delete_line);
|
||||||
*/
|
*/
|
||||||
@ -3487,8 +3559,8 @@ TextEdit::TextEdit() {
|
|||||||
tab_size=4;
|
tab_size=4;
|
||||||
text.set_tab_size(tab_size);
|
text.set_tab_size(tab_size);
|
||||||
text.clear();
|
text.clear();
|
||||||
// text.insert(1,"Mongolia..");
|
// text.insert(1,"Mongolia..");
|
||||||
// text.insert(2,"PAIS GENEROSO!!");
|
// text.insert(2,"PAIS GENEROSO!!");
|
||||||
text.set_color_regions(&color_regions);
|
text.set_color_regions(&color_regions);
|
||||||
|
|
||||||
h_scroll = memnew( HScrollBar );
|
h_scroll = memnew( HScrollBar );
|
||||||
|
@ -63,6 +63,7 @@ class TextEdit : public Control {
|
|||||||
int from_line,from_column;
|
int from_line,from_column;
|
||||||
int to_line,to_column;
|
int to_line,to_column;
|
||||||
|
|
||||||
|
bool shiftclick_left;
|
||||||
|
|
||||||
} selection;
|
} selection;
|
||||||
|
|
||||||
|
@ -31,28 +31,37 @@
|
|||||||
|
|
||||||
Size2 TextureButton::get_minimum_size() const {
|
Size2 TextureButton::get_minimum_size() const {
|
||||||
|
|
||||||
|
Size2 rscale;
|
||||||
if (normal.is_null()) {
|
if (normal.is_null()) {
|
||||||
if (pressed.is_null()) {
|
if (pressed.is_null()) {
|
||||||
if (hover.is_null())
|
if (hover.is_null())
|
||||||
if (click_mask.is_null())
|
if (click_mask.is_null())
|
||||||
return Size2();
|
rscale= Size2();
|
||||||
else
|
else
|
||||||
return click_mask->get_size();
|
rscale= click_mask->get_size();
|
||||||
else
|
else
|
||||||
return hover->get_size();
|
rscale= hover->get_size();
|
||||||
} else
|
} else
|
||||||
return pressed->get_size();
|
rscale= pressed->get_size()*scale;
|
||||||
|
|
||||||
} else
|
} else
|
||||||
return normal->get_size();
|
rscale= normal->get_size();
|
||||||
|
|
||||||
|
return rscale*scale;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool TextureButton::has_point(const Point2& p_point) const {
|
bool TextureButton::has_point(const Point2& p_point) const {
|
||||||
|
|
||||||
|
if (scale[0] <= 0 || scale[1] <= 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
Point2 ppos = p_point/scale;
|
||||||
|
|
||||||
if (click_mask.is_valid()) {
|
if (click_mask.is_valid()) {
|
||||||
|
|
||||||
Point2i p =p_point;
|
Point2i p =ppos;
|
||||||
if (p.x<0 || p.x>=click_mask->get_size().width || p.y<0 || p.y>=click_mask->get_size().height)
|
if (p.x<0 || p.x>=click_mask->get_size().width || p.y<0 || p.y>=click_mask->get_size().height)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@ -71,46 +80,57 @@ void TextureButton::_notification(int p_what) {
|
|||||||
DrawMode draw_mode = get_draw_mode();
|
DrawMode draw_mode = get_draw_mode();
|
||||||
// if (normal.is_null())
|
// if (normal.is_null())
|
||||||
// break;
|
// break;
|
||||||
|
|
||||||
|
Ref<Texture> texdraw;
|
||||||
|
|
||||||
switch (draw_mode) {
|
switch (draw_mode) {
|
||||||
case DRAW_NORMAL: {
|
case DRAW_NORMAL: {
|
||||||
|
|
||||||
if (normal.is_valid())
|
if (normal.is_valid())
|
||||||
normal->draw(canvas_item,Point2());
|
texdraw=normal;
|
||||||
} break;
|
} break;
|
||||||
case DRAW_PRESSED: {
|
case DRAW_PRESSED: {
|
||||||
|
|
||||||
if (pressed.is_null()) {
|
if (pressed.is_null()) {
|
||||||
if (hover.is_null()) {
|
if (hover.is_null()) {
|
||||||
if (normal.is_valid())
|
if (normal.is_valid())
|
||||||
normal->draw(canvas_item,Point2());
|
texdraw=normal;
|
||||||
} else
|
} else
|
||||||
hover->draw(canvas_item,Point2());
|
texdraw=hover;
|
||||||
|
|
||||||
} else
|
} else
|
||||||
pressed->draw(canvas_item,Point2());
|
texdraw=pressed;
|
||||||
} break;
|
} break;
|
||||||
case DRAW_HOVER: {
|
case DRAW_HOVER: {
|
||||||
|
|
||||||
if (hover.is_null()) {
|
if (hover.is_null()) {
|
||||||
if (pressed.is_valid() && is_pressed())
|
if (pressed.is_valid() && is_pressed())
|
||||||
pressed->draw(canvas_item,Point2());
|
texdraw=pressed;
|
||||||
else if (normal.is_valid())
|
else if (normal.is_valid())
|
||||||
normal->draw(canvas_item,Point2());
|
texdraw=normal;
|
||||||
} else
|
} else
|
||||||
hover->draw(canvas_item,Point2());
|
texdraw=hover;
|
||||||
} break;
|
} break;
|
||||||
case DRAW_DISABLED: {
|
case DRAW_DISABLED: {
|
||||||
|
|
||||||
if (disabled.is_null()) {
|
if (disabled.is_null()) {
|
||||||
if (normal.is_valid())
|
if (normal.is_valid())
|
||||||
normal->draw(canvas_item,Point2());
|
texdraw=normal;
|
||||||
} else
|
} else
|
||||||
disabled->draw(canvas_item,Point2());
|
texdraw=disabled;
|
||||||
} break;
|
} break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (texdraw.is_valid()) {
|
||||||
|
Rect2 drect(Point2(),texdraw->get_size()*scale);
|
||||||
|
draw_texture_rect(texdraw,drect,false,modulate);
|
||||||
|
|
||||||
|
}
|
||||||
if (has_focus() && focused.is_valid()) {
|
if (has_focus() && focused.is_valid()) {
|
||||||
|
|
||||||
focused->draw(canvas_item, Point2());
|
Rect2 drect(Point2(),focused->get_size()*scale);
|
||||||
|
draw_texture_rect(focused,drect,false,modulate);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
@ -125,6 +145,8 @@ void TextureButton::_bind_methods() {
|
|||||||
ObjectTypeDB::bind_method(_MD("set_disabled_texture","texture:Texture"),&TextureButton::set_disabled_texture);
|
ObjectTypeDB::bind_method(_MD("set_disabled_texture","texture:Texture"),&TextureButton::set_disabled_texture);
|
||||||
ObjectTypeDB::bind_method(_MD("set_focused_texture","texture:Texture"),&TextureButton::set_focused_texture);
|
ObjectTypeDB::bind_method(_MD("set_focused_texture","texture:Texture"),&TextureButton::set_focused_texture);
|
||||||
ObjectTypeDB::bind_method(_MD("set_click_mask","mask:BitMap"),&TextureButton::set_click_mask);
|
ObjectTypeDB::bind_method(_MD("set_click_mask","mask:BitMap"),&TextureButton::set_click_mask);
|
||||||
|
ObjectTypeDB::bind_method(_MD("set_scale","scale"),&TextureButton::set_scale);
|
||||||
|
ObjectTypeDB::bind_method(_MD("set_modulate","color"),&TextureButton::set_modulate);
|
||||||
|
|
||||||
ObjectTypeDB::bind_method(_MD("get_normal_texture:Texture"),&TextureButton::get_normal_texture);
|
ObjectTypeDB::bind_method(_MD("get_normal_texture:Texture"),&TextureButton::get_normal_texture);
|
||||||
ObjectTypeDB::bind_method(_MD("get_pressed_texture:Texture"),&TextureButton::get_pressed_texture);
|
ObjectTypeDB::bind_method(_MD("get_pressed_texture:Texture"),&TextureButton::get_pressed_texture);
|
||||||
@ -132,6 +154,8 @@ void TextureButton::_bind_methods() {
|
|||||||
ObjectTypeDB::bind_method(_MD("get_disabled_texture:Texture"),&TextureButton::get_disabled_texture);
|
ObjectTypeDB::bind_method(_MD("get_disabled_texture:Texture"),&TextureButton::get_disabled_texture);
|
||||||
ObjectTypeDB::bind_method(_MD("get_focused_texture:Texture"),&TextureButton::get_focused_texture);
|
ObjectTypeDB::bind_method(_MD("get_focused_texture:Texture"),&TextureButton::get_focused_texture);
|
||||||
ObjectTypeDB::bind_method(_MD("get_click_mask:BitMap"),&TextureButton::get_click_mask);
|
ObjectTypeDB::bind_method(_MD("get_click_mask:BitMap"),&TextureButton::get_click_mask);
|
||||||
|
ObjectTypeDB::bind_method(_MD("get_scale"),&TextureButton::get_scale);
|
||||||
|
ObjectTypeDB::bind_method(_MD("get_modulate"),&TextureButton::get_modulate);
|
||||||
|
|
||||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT,"textures/normal",PROPERTY_HINT_RESOURCE_TYPE,"Texture"), _SCS("set_normal_texture"), _SCS("get_normal_texture"));
|
ADD_PROPERTY(PropertyInfo(Variant::OBJECT,"textures/normal",PROPERTY_HINT_RESOURCE_TYPE,"Texture"), _SCS("set_normal_texture"), _SCS("get_normal_texture"));
|
||||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT,"textures/pressed",PROPERTY_HINT_RESOURCE_TYPE,"Texture"), _SCS("set_pressed_texture"), _SCS("get_pressed_texture"));
|
ADD_PROPERTY(PropertyInfo(Variant::OBJECT,"textures/pressed",PROPERTY_HINT_RESOURCE_TYPE,"Texture"), _SCS("set_pressed_texture"), _SCS("get_pressed_texture"));
|
||||||
@ -139,6 +163,8 @@ void TextureButton::_bind_methods() {
|
|||||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT,"textures/disabled",PROPERTY_HINT_RESOURCE_TYPE,"Texture"), _SCS("set_disabled_texture"), _SCS("get_disabled_texture"));
|
ADD_PROPERTY(PropertyInfo(Variant::OBJECT,"textures/disabled",PROPERTY_HINT_RESOURCE_TYPE,"Texture"), _SCS("set_disabled_texture"), _SCS("get_disabled_texture"));
|
||||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT,"textures/focused",PROPERTY_HINT_RESOURCE_TYPE,"Texture"), _SCS("set_focused_texture"), _SCS("get_focused_texture"));
|
ADD_PROPERTY(PropertyInfo(Variant::OBJECT,"textures/focused",PROPERTY_HINT_RESOURCE_TYPE,"Texture"), _SCS("set_focused_texture"), _SCS("get_focused_texture"));
|
||||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT,"textures/click_mask",PROPERTY_HINT_RESOURCE_TYPE,"BitMap"), _SCS("set_click_mask"), _SCS("get_click_mask")) ;
|
ADD_PROPERTY(PropertyInfo(Variant::OBJECT,"textures/click_mask",PROPERTY_HINT_RESOURCE_TYPE,"BitMap"), _SCS("set_click_mask"), _SCS("get_click_mask")) ;
|
||||||
|
ADD_PROPERTY(PropertyInfo(Variant::VECTOR2,"params/scale",PROPERTY_HINT_RANGE,"0.01,1024,0.01"), _SCS("set_scale"), _SCS("get_scale"));
|
||||||
|
ADD_PROPERTY(PropertyInfo(Variant::COLOR,"params/modulate"), _SCS("set_modulate"), _SCS("get_modulate"));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -206,6 +232,29 @@ void TextureButton::set_focused_texture(const Ref<Texture>& p_focused) {
|
|||||||
focused = p_focused;
|
focused = p_focused;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void TextureButton::set_scale(Size2 p_scale) {
|
||||||
|
|
||||||
|
scale=p_scale;
|
||||||
|
minimum_size_changed();
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
|
||||||
|
Size2 TextureButton::get_scale() const{
|
||||||
|
|
||||||
|
return scale;
|
||||||
|
}
|
||||||
|
|
||||||
|
void TextureButton::set_modulate(const Color& p_modulate) {
|
||||||
|
modulate=p_modulate;
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
|
||||||
|
Color TextureButton::get_modulate() const {
|
||||||
|
return modulate;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
TextureButton::TextureButton() {
|
TextureButton::TextureButton() {
|
||||||
|
scale=Size2(1.0, 1.0);
|
||||||
|
modulate=Color(1,1,1);
|
||||||
}
|
}
|
||||||
|
@ -41,6 +41,8 @@ class TextureButton : public BaseButton {
|
|||||||
Ref<Texture> disabled;
|
Ref<Texture> disabled;
|
||||||
Ref<Texture> focused;
|
Ref<Texture> focused;
|
||||||
Ref<BitMap> click_mask;
|
Ref<BitMap> click_mask;
|
||||||
|
Size2 scale;
|
||||||
|
Color modulate;
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@ -66,6 +68,11 @@ public:
|
|||||||
Ref<Texture> get_focused_texture() const;
|
Ref<Texture> get_focused_texture() const;
|
||||||
Ref<BitMap> get_click_mask() const;
|
Ref<BitMap> get_click_mask() const;
|
||||||
|
|
||||||
|
void set_scale(Size2 p_scale);
|
||||||
|
Size2 get_scale() const;
|
||||||
|
|
||||||
|
void set_modulate(const Color& p_modulate);
|
||||||
|
Color get_modulate() const;
|
||||||
|
|
||||||
TextureButton();
|
TextureButton();
|
||||||
};
|
};
|
||||||
|
@ -382,6 +382,8 @@ bool Node::can_process() const {
|
|||||||
|
|
||||||
if (get_tree()->is_paused()) {
|
if (get_tree()->is_paused()) {
|
||||||
|
|
||||||
|
if (data.pause_mode==PAUSE_MODE_STOP)
|
||||||
|
return false;
|
||||||
if (data.pause_mode==PAUSE_MODE_PROCESS)
|
if (data.pause_mode==PAUSE_MODE_PROCESS)
|
||||||
return true;
|
return true;
|
||||||
if (data.pause_mode==PAUSE_MODE_INHERIT) {
|
if (data.pause_mode==PAUSE_MODE_INHERIT) {
|
||||||
@ -391,6 +393,9 @@ bool Node::can_process() const {
|
|||||||
|
|
||||||
if (data.pause_owner->data.pause_mode==PAUSE_MODE_PROCESS)
|
if (data.pause_owner->data.pause_mode==PAUSE_MODE_PROCESS)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
if (data.pause_owner->data.pause_mode==PAUSE_MODE_STOP)
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,6 @@
|
|||||||
#include "scene/main/viewport.h"
|
#include "scene/main/viewport.h"
|
||||||
#include "scene/gui/control.h"
|
#include "scene/gui/control.h"
|
||||||
#include "scene/gui/texture_progress.h"
|
#include "scene/gui/texture_progress.h"
|
||||||
#include "scene/gui/empty_control.h"
|
|
||||||
#include "scene/gui/button.h"
|
#include "scene/gui/button.h"
|
||||||
#include "scene/gui/button_array.h"
|
#include "scene/gui/button_array.h"
|
||||||
#include "scene/gui/button_group.h"
|
#include "scene/gui/button_group.h"
|
||||||
@ -76,6 +75,7 @@
|
|||||||
#include "scene/gui/video_player.h"
|
#include "scene/gui/video_player.h"
|
||||||
#include "scene/gui/reference_frame.h"
|
#include "scene/gui/reference_frame.h"
|
||||||
#include "scene/gui/graph_node.h"
|
#include "scene/gui/graph_node.h"
|
||||||
|
#include "scene/gui/graph_edit.h"
|
||||||
#include "scene/resources/video_stream.h"
|
#include "scene/resources/video_stream.h"
|
||||||
#include "scene/2d/particles_2d.h"
|
#include "scene/2d/particles_2d.h"
|
||||||
#include "scene/2d/path_2d.h"
|
#include "scene/2d/path_2d.h"
|
||||||
@ -153,6 +153,8 @@
|
|||||||
#include "scene/resources/mesh.h"
|
#include "scene/resources/mesh.h"
|
||||||
#include "scene/resources/room.h"
|
#include "scene/resources/room.h"
|
||||||
|
|
||||||
|
#include "scene/resources/shader_graph.h"
|
||||||
|
|
||||||
#include "scene/resources/world.h"
|
#include "scene/resources/world.h"
|
||||||
#include "scene/resources/world_2d.h"
|
#include "scene/resources/world_2d.h"
|
||||||
#include "scene/resources/volume.h"
|
#include "scene/resources/volume.h"
|
||||||
@ -269,7 +271,8 @@ void register_scene_types() {
|
|||||||
OS::get_singleton()->yield(); //may take time to init
|
OS::get_singleton()->yield(); //may take time to init
|
||||||
|
|
||||||
ObjectTypeDB::register_type<Control>();
|
ObjectTypeDB::register_type<Control>();
|
||||||
ObjectTypeDB::register_type<EmptyControl>();
|
// ObjectTypeDB::register_type<EmptyControl>();
|
||||||
|
ObjectTypeDB::add_compatibility_type("EmptyControl","control");
|
||||||
ObjectTypeDB::register_type<Button>();
|
ObjectTypeDB::register_type<Button>();
|
||||||
ObjectTypeDB::register_type<Label>();
|
ObjectTypeDB::register_type<Label>();
|
||||||
ObjectTypeDB::register_type<HScrollBar>();
|
ObjectTypeDB::register_type<HScrollBar>();
|
||||||
@ -305,6 +308,7 @@ void register_scene_types() {
|
|||||||
ObjectTypeDB::register_type<HSplitContainer>();
|
ObjectTypeDB::register_type<HSplitContainer>();
|
||||||
ObjectTypeDB::register_type<VSplitContainer>();
|
ObjectTypeDB::register_type<VSplitContainer>();
|
||||||
ObjectTypeDB::register_type<GraphNode>();
|
ObjectTypeDB::register_type<GraphNode>();
|
||||||
|
ObjectTypeDB::register_type<GraphEdit>();
|
||||||
|
|
||||||
OS::get_singleton()->yield(); //may take time to init
|
OS::get_singleton()->yield(); //may take time to init
|
||||||
|
|
||||||
@ -496,11 +500,17 @@ void register_scene_types() {
|
|||||||
ObjectTypeDB::register_type<Mesh>();
|
ObjectTypeDB::register_type<Mesh>();
|
||||||
ObjectTypeDB::register_virtual_type<Material>();
|
ObjectTypeDB::register_virtual_type<Material>();
|
||||||
ObjectTypeDB::register_type<FixedMaterial>();
|
ObjectTypeDB::register_type<FixedMaterial>();
|
||||||
ObjectTypeDB::register_type<ParticleSystemMaterial>();
|
//ObjectTypeDB::register_type<ParticleSystemMaterial>();
|
||||||
ObjectTypeDB::register_type<UnshadedMaterial>();
|
//ObjectTypeDB::register_type<UnshadedMaterial>();
|
||||||
ObjectTypeDB::register_type<ShaderMaterial>();
|
ObjectTypeDB::register_type<ShaderMaterial>();
|
||||||
ObjectTypeDB::register_type<RoomBounds>();
|
ObjectTypeDB::register_type<RoomBounds>();
|
||||||
ObjectTypeDB::register_type<Shader>();
|
ObjectTypeDB::register_virtual_type<Shader>();
|
||||||
|
ObjectTypeDB::register_virtual_type<ShaderGraph>();
|
||||||
|
ObjectTypeDB::register_type<MaterialShaderGraph>();
|
||||||
|
ObjectTypeDB::register_type<MaterialShader>();
|
||||||
|
ObjectTypeDB::add_compatibility_type("Shader","MaterialShader");
|
||||||
|
ObjectTypeDB::add_compatibility_type("ParticleSystemMaterial","FixedMaterial");
|
||||||
|
ObjectTypeDB::add_compatibility_type("UnshadedMaterial","FixedMaterial");
|
||||||
ObjectTypeDB::register_type<MultiMesh>();
|
ObjectTypeDB::register_type<MultiMesh>();
|
||||||
ObjectTypeDB::register_type<MeshLibrary>();
|
ObjectTypeDB::register_type<MeshLibrary>();
|
||||||
|
|
||||||
|
@ -417,12 +417,18 @@ void make_default_theme() {
|
|||||||
t->set_constant("hseparation","PopupMenu",2);
|
t->set_constant("hseparation","PopupMenu",2);
|
||||||
t->set_constant("vseparation","PopupMenu",1);
|
t->set_constant("vseparation","PopupMenu",1);
|
||||||
|
|
||||||
Ref<StyleBoxTexture> graphsb = make_stylebox(graph_node_png,6,21,6,5,16,21,16,5);
|
Ref<StyleBoxTexture> graphsb = make_stylebox(graph_node_png,6,24,6,5,16,24,16,5);
|
||||||
//graphsb->set_expand_margin_size(MARGIN_LEFT,10);
|
//graphsb->set_expand_margin_size(MARGIN_LEFT,10);
|
||||||
//graphsb->set_expand_margin_size(MARGIN_RIGHT,10);
|
//graphsb->set_expand_margin_size(MARGIN_RIGHT,10);
|
||||||
t->set_stylebox("frame","GraphNode", graphsb );
|
t->set_stylebox("frame","GraphNode", graphsb );
|
||||||
t->set_constant("separation","GraphNode", 1 );
|
t->set_constant("separation","GraphNode", 1 );
|
||||||
t->set_icon("port","GraphNode", make_icon( graph_port_png ) );
|
t->set_icon("port","GraphNode", make_icon( graph_port_png ) );
|
||||||
|
t->set_icon("close","GraphNode", make_icon( graph_node_close_png ) );
|
||||||
|
t->set_font("title_font","GraphNode", default_font );
|
||||||
|
t->set_color("title_color","GraphNode", Color(0,0,0,1));
|
||||||
|
t->set_constant("title_offset","GraphNode", 18);
|
||||||
|
t->set_constant("close_offset","GraphNode", 18);
|
||||||
|
t->set_constant("port_offset","GraphNode", 3);
|
||||||
|
|
||||||
|
|
||||||
t->set_stylebox("bg","Tree", make_stylebox( tree_bg_png,4,4,4,5,3,3,3,3) );
|
t->set_stylebox("bg","Tree", make_stylebox( tree_bg_png,4,4,4,5,3,3,3,3) );
|
||||||
|
BIN
scene/resources/default_theme/graph_node_close.png
Normal file
BIN
scene/resources/default_theme/graph_node_close.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 243 B |
@ -104,6 +104,11 @@ static const unsigned char graph_node_png[]={
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
static const unsigned char graph_node_close_png[]={
|
||||||
|
0x89,0x50,0x4e,0x47,0xd,0xa,0x1a,0xa,0x0,0x0,0x0,0xd,0x49,0x48,0x44,0x52,0x0,0x0,0x0,0xc,0x0,0x0,0x0,0xc,0x8,0x6,0x0,0x0,0x0,0x56,0x75,0x5c,0xe7,0x0,0x0,0x0,0x6,0x62,0x4b,0x47,0x44,0x0,0xff,0x0,0xff,0x0,0xff,0xa0,0xbd,0xa7,0x93,0x0,0x0,0x0,0x9,0x70,0x48,0x59,0x73,0x0,0x0,0xb,0x13,0x0,0x0,0xb,0x13,0x1,0x0,0x9a,0x9c,0x18,0x0,0x0,0x0,0x7,0x74,0x49,0x4d,0x45,0x7,0xde,0xc,0x15,0x14,0x15,0x39,0x35,0x48,0xf8,0xe3,0x0,0x0,0x0,0x80,0x49,0x44,0x41,0x54,0x28,0xcf,0xa5,0xd1,0xb1,0xa,0xc2,0x40,0x10,0x84,0xe1,0x4f,0xe5,0x30,0xad,0x9d,0xb5,0x60,0xeb,0x3,0x88,0x2f,0x6d,0xfa,0xb4,0x29,0x83,0xbd,0xb5,0xb5,0x9d,0x68,0x15,0x9b,0x3d,0xb9,0x4,0x11,0xe,0x7,0xb6,0xd9,0xfd,0x67,0xb9,0xb9,0xa5,0x52,0xab,0xa8,0x13,0xb6,0x78,0xe0,0x39,0x63,0x36,0x38,0x60,0x87,0x1b,0x34,0xb8,0x60,0xc4,0x19,0xa9,0x80,0x53,0xf4,0xc6,0x60,0x9a,0x72,0xd0,0xc6,0xa0,0x2b,0xc,0x5d,0xf4,0xda,0xd9,0xa2,0x8f,0x29,0x3,0x43,0x54,0x5e,0x90,0x7e,0xe5,0xca,0x60,0x36,0x4e,0xb4,0xf4,0x87,0xaa,0x9e,0x54,0x15,0xba,0xea,0x5b,0x17,0x71,0xb8,0x23,0x5e,0xb8,0xe2,0xfe,0xe5,0x70,0x7b,0xac,0xd1,0x57,0x7,0x7d,0x3,0x51,0x8f,0x29,0x6b,0x3c,0x49,0x28,0x81,0x0,0x0,0x0,0x0,0x49,0x45,0x4e,0x44,0xae,0x42,0x60,0x82
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
static const unsigned char graph_port_png[]={
|
static const unsigned char graph_port_png[]={
|
||||||
0x89,0x50,0x4e,0x47,0xd,0xa,0x1a,0xa,0x0,0x0,0x0,0xd,0x49,0x48,0x44,0x52,0x0,0x0,0x0,0xa,0x0,0x0,0x0,0xa,0x8,0x6,0x0,0x0,0x0,0x8d,0x32,0xcf,0xbd,0x0,0x0,0x0,0x6,0x62,0x4b,0x47,0x44,0x0,0x0,0x0,0x0,0x0,0x0,0xf9,0x43,0xbb,0x7f,0x0,0x0,0x0,0x9,0x70,0x48,0x59,0x73,0x0,0x0,0xb,0x13,0x0,0x0,0xb,0x13,0x1,0x0,0x9a,0x9c,0x18,0x0,0x0,0x0,0x7,0x74,0x49,0x4d,0x45,0x7,0xde,0xc,0x14,0x17,0x20,0x3,0xeb,0x8f,0x3a,0xdb,0x0,0x0,0x0,0x19,0x74,0x45,0x58,0x74,0x43,0x6f,0x6d,0x6d,0x65,0x6e,0x74,0x0,0x43,0x72,0x65,0x61,0x74,0x65,0x64,0x20,0x77,0x69,0x74,0x68,0x20,0x47,0x49,0x4d,0x50,0x57,0x81,0xe,0x17,0x0,0x0,0x1,0x65,0x49,0x44,0x41,0x54,0x18,0xd3,0x4d,0xd0,0x4f,0x6b,0xda,0x70,0x1c,0x7,0xe0,0xcf,0x37,0x7f,0x7e,0x49,0x66,0xd2,0x64,0x61,0x5,0x61,0x76,0x47,0xf1,0xa4,0x2d,0xdb,0x75,0x5,0x11,0x84,0xb0,0x5e,0xeb,0xd9,0xeb,0xf4,0x6d,0xec,0x2d,0xf8,0x26,0xb6,0x77,0xe0,0x45,0xba,0xa3,0x6c,0xa0,0x3b,0xad,0x39,0xb6,0x36,0x8,0x1b,0x4b,0x32,0xd2,0xc6,0x6c,0x9a,0x4f,0x4f,0x85,0x3e,0x2f,0xe1,0x11,0x0,0x20,0x29,0xd3,0xe9,0xd4,0xda,0x6e,0xb7,0x23,0xdf,0xf7,0xbb,0x0,0x90,0xe7,0xf9,0x8f,0x66,0xb3,0xf9,0x79,0x36,0x9b,0x55,0x22,0x42,0x83,0xa4,0x44,0x51,0xf4,0xea,0xe2,0xe2,0xc3,0xf7,0xf1,0x78,0xdc,0xa,0x82,0x40,0x8,0x20,0xcf,0x32,0x2e,0x97,0xcb,0x4f,0x51,0x14,0xbd,0x25,0xf9,0x5b,0x26,0x93,0x89,0xdd,0xe9,0x74,0xe2,0xf7,0xe7,0xe7,0x27,0x59,0xfa,0x87,0x65,0xb9,0x13,0x0,0xb0,0x1d,0x9b,0xe1,0xcb,0x50,0xbe,0x5e,0x5d,0xdd,0xfe,0xbc,0xbe,0x6e,0x6b,0x49,0x92,0x8c,0x4e,0x7b,0xa7,0xad,0xbf,0x79,0x4e,0xd3,0x54,0x12,0x86,0x21,0xc2,0x30,0x84,0x32,0x95,0xe4,0x79,0xc6,0xde,0xd9,0x59,0x2b,0x49,0xee,0x46,0x86,0xeb,0xba,0x5d,0xfb,0x85,0x23,0x87,0xfd,0x1e,0xb6,0xed,0x40,0xd7,0x35,0x0,0x40,0x7d,0x38,0xa0,0xdc,0xed,0x44,0x37,0x74,0xb8,0xae,0xd7,0x35,0x48,0x62,0xff,0xff,0x1f,0xfc,0x20,0x80,0xae,0xe9,0x78,0x42,0x0,0xca,0xb2,0x90,0x65,0x19,0x58,0xd7,0xd0,0x8a,0xa2,0x58,0xa7,0x69,0x56,0x6b,0xa2,0x51,0x29,0x5,0xcb,0x52,0xb0,0x94,0x5,0x4b,0x29,0x88,0x8,0xd3,0x34,0xad,0x8b,0xfb,0x62,0xad,0xf,0x6,0x83,0xb8,0xaa,0xaa,0xb1,0xe7,0x79,0xbe,0x77,0x74,0x44,0xb7,0xe1,0x89,0x69,0x1a,0x28,0xcb,0x92,0x9b,0xcd,0x46,0x56,0xab,0xd5,0x86,0xe4,0x47,0x21,0x29,0xc3,0xe1,0xf0,0xb8,0xdf,0xef,0x7f,0x6b,0xb7,0xdb,0xaf,0x1b,0x8d,0x86,0x46,0x10,0xf,0xf7,0xf,0x75,0x1c,0xc7,0x77,0x8b,0xc5,0xe2,0xdd,0x7c,0x3e,0xff,0x25,0xcf,0xc3,0x6f,0x6e,0x6f,0x2e,0x1d,0xdb,0xe9,0x9,0x80,0xb2,0x2a,0xd7,0x27,0xad,0x37,0x5f,0x9e,0xc2,0x1f,0x1,0x3a,0xe6,0xa5,0x7b,0xef,0xf2,0xf3,0xcd,0x0,0x0,0x0,0x0,0x49,0x45,0x4e,0x44,0xae,0x42,0x60,0x82
|
0x89,0x50,0x4e,0x47,0xd,0xa,0x1a,0xa,0x0,0x0,0x0,0xd,0x49,0x48,0x44,0x52,0x0,0x0,0x0,0xa,0x0,0x0,0x0,0xa,0x8,0x6,0x0,0x0,0x0,0x8d,0x32,0xcf,0xbd,0x0,0x0,0x0,0x6,0x62,0x4b,0x47,0x44,0x0,0x0,0x0,0x0,0x0,0x0,0xf9,0x43,0xbb,0x7f,0x0,0x0,0x0,0x9,0x70,0x48,0x59,0x73,0x0,0x0,0xb,0x13,0x0,0x0,0xb,0x13,0x1,0x0,0x9a,0x9c,0x18,0x0,0x0,0x0,0x7,0x74,0x49,0x4d,0x45,0x7,0xde,0xc,0x14,0x17,0x20,0x3,0xeb,0x8f,0x3a,0xdb,0x0,0x0,0x0,0x19,0x74,0x45,0x58,0x74,0x43,0x6f,0x6d,0x6d,0x65,0x6e,0x74,0x0,0x43,0x72,0x65,0x61,0x74,0x65,0x64,0x20,0x77,0x69,0x74,0x68,0x20,0x47,0x49,0x4d,0x50,0x57,0x81,0xe,0x17,0x0,0x0,0x1,0x65,0x49,0x44,0x41,0x54,0x18,0xd3,0x4d,0xd0,0x4f,0x6b,0xda,0x70,0x1c,0x7,0xe0,0xcf,0x37,0x7f,0x7e,0x49,0x66,0xd2,0x64,0x61,0x5,0x61,0x76,0x47,0xf1,0xa4,0x2d,0xdb,0x75,0x5,0x11,0x84,0xb0,0x5e,0xeb,0xd9,0xeb,0xf4,0x6d,0xec,0x2d,0xf8,0x26,0xb6,0x77,0xe0,0x45,0xba,0xa3,0x6c,0xa0,0x3b,0xad,0x39,0xb6,0x36,0x8,0x1b,0x4b,0x32,0xd2,0xc6,0x6c,0x9a,0x4f,0x4f,0x85,0x3e,0x2f,0xe1,0x11,0x0,0x20,0x29,0xd3,0xe9,0xd4,0xda,0x6e,0xb7,0x23,0xdf,0xf7,0xbb,0x0,0x90,0xe7,0xf9,0x8f,0x66,0xb3,0xf9,0x79,0x36,0x9b,0x55,0x22,0x42,0x83,0xa4,0x44,0x51,0xf4,0xea,0xe2,0xe2,0xc3,0xf7,0xf1,0x78,0xdc,0xa,0x82,0x40,0x8,0x20,0xcf,0x32,0x2e,0x97,0xcb,0x4f,0x51,0x14,0xbd,0x25,0xf9,0x5b,0x26,0x93,0x89,0xdd,0xe9,0x74,0xe2,0xf7,0xe7,0xe7,0x27,0x59,0xfa,0x87,0x65,0xb9,0x13,0x0,0xb0,0x1d,0x9b,0xe1,0xcb,0x50,0xbe,0x5e,0x5d,0xdd,0xfe,0xbc,0xbe,0x6e,0x6b,0x49,0x92,0x8c,0x4e,0x7b,0xa7,0xad,0xbf,0x79,0x4e,0xd3,0x54,0x12,0x86,0x21,0xc2,0x30,0x84,0x32,0x95,0xe4,0x79,0xc6,0xde,0xd9,0x59,0x2b,0x49,0xee,0x46,0x86,0xeb,0xba,0x5d,0xfb,0x85,0x23,0x87,0xfd,0x1e,0xb6,0xed,0x40,0xd7,0x35,0x0,0x40,0x7d,0x38,0xa0,0xdc,0xed,0x44,0x37,0x74,0xb8,0xae,0xd7,0x35,0x48,0x62,0xff,0xff,0x1f,0xfc,0x20,0x80,0xae,0xe9,0x78,0x42,0x0,0xca,0xb2,0x90,0x65,0x19,0x58,0xd7,0xd0,0x8a,0xa2,0x58,0xa7,0x69,0x56,0x6b,0xa2,0x51,0x29,0x5,0xcb,0x52,0xb0,0x94,0x5,0x4b,0x29,0x88,0x8,0xd3,0x34,0xad,0x8b,0xfb,0x62,0xad,0xf,0x6,0x83,0xb8,0xaa,0xaa,0xb1,0xe7,0x79,0xbe,0x77,0x74,0x44,0xb7,0xe1,0x89,0x69,0x1a,0x28,0xcb,0x92,0x9b,0xcd,0x46,0x56,0xab,0xd5,0x86,0xe4,0x47,0x21,0x29,0xc3,0xe1,0xf0,0xb8,0xdf,0xef,0x7f,0x6b,0xb7,0xdb,0xaf,0x1b,0x8d,0x86,0x46,0x10,0xf,0xf7,0xf,0x75,0x1c,0xc7,0x77,0x8b,0xc5,0xe2,0xdd,0x7c,0x3e,0xff,0x25,0xcf,0xc3,0x6f,0x6e,0x6f,0x2e,0x1d,0xdb,0xe9,0x9,0x80,0xb2,0x2a,0xd7,0x27,0xad,0x37,0x5f,0x9e,0xc2,0x1f,0x1,0x3a,0xe6,0xa5,0x7b,0xef,0xf2,0xf3,0xcd,0x0,0x0,0x0,0x0,0x49,0x45,0x4e,0x44,0xae,0x42,0x60,0x82
|
||||||
};
|
};
|
||||||
|
@ -501,7 +501,7 @@ bool ShaderMaterial::_get(const StringName& p_name,Variant &r_ret) const {
|
|||||||
|
|
||||||
void ShaderMaterial::_get_property_list( List<PropertyInfo> *p_list) const {
|
void ShaderMaterial::_get_property_list( List<PropertyInfo> *p_list) const {
|
||||||
|
|
||||||
p_list->push_back( PropertyInfo( Variant::OBJECT, "shader/shader", PROPERTY_HINT_RESOURCE_TYPE,"Shader" ) );
|
p_list->push_back( PropertyInfo( Variant::OBJECT, "shader/shader", PROPERTY_HINT_RESOURCE_TYPE,"MaterialShader,MaterialShaderGraph" ) );
|
||||||
|
|
||||||
if (!shader.is_null()) {
|
if (!shader.is_null()) {
|
||||||
|
|
||||||
|
@ -33,12 +33,6 @@
|
|||||||
#include "scene/scene_string_names.h"
|
#include "scene/scene_string_names.h"
|
||||||
|
|
||||||
|
|
||||||
void Shader::set_mode(Mode p_mode) {
|
|
||||||
|
|
||||||
ERR_FAIL_INDEX(p_mode,2);
|
|
||||||
VisualServer::get_singleton()->shader_set_mode(shader,VisualServer::ShaderMode(p_mode));
|
|
||||||
emit_signal(SceneStringNames::get_singleton()->changed);
|
|
||||||
}
|
|
||||||
|
|
||||||
Shader::Mode Shader::get_mode() const {
|
Shader::Mode Shader::get_mode() const {
|
||||||
|
|
||||||
@ -176,7 +170,6 @@ void Shader::get_default_texture_param_list(List<StringName>* r_textures) const{
|
|||||||
|
|
||||||
void Shader::_bind_methods() {
|
void Shader::_bind_methods() {
|
||||||
|
|
||||||
ObjectTypeDB::bind_method(_MD("set_mode","mode"),&Shader::set_mode);
|
|
||||||
ObjectTypeDB::bind_method(_MD("get_mode"),&Shader::get_mode);
|
ObjectTypeDB::bind_method(_MD("get_mode"),&Shader::get_mode);
|
||||||
|
|
||||||
ObjectTypeDB::bind_method(_MD("set_code","vcode","fcode","lcode","fofs","lofs"),&Shader::set_code,DEFVAL(0),DEFVAL(0));
|
ObjectTypeDB::bind_method(_MD("set_code","vcode","fcode","lcode","fofs","lofs"),&Shader::set_code,DEFVAL(0),DEFVAL(0));
|
||||||
@ -203,9 +196,9 @@ void Shader::_bind_methods() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Shader::Shader() {
|
Shader::Shader(Mode p_mode) {
|
||||||
|
|
||||||
shader = VisualServer::get_singleton()->shader_create();
|
shader = VisualServer::get_singleton()->shader_create(VS::ShaderMode(p_mode));
|
||||||
params_cache_dirty=true;
|
params_cache_dirty=true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -237,7 +230,7 @@ RES ResourceFormatLoaderShader::load(const String &p_path,const String& p_origin
|
|||||||
String base_path = p_path.get_base_dir();
|
String base_path = p_path.get_base_dir();
|
||||||
|
|
||||||
|
|
||||||
Ref<Shader> shader( memnew( Shader ) );
|
Ref<Shader> shader;//( memnew( Shader ) );
|
||||||
|
|
||||||
int line=0;
|
int line=0;
|
||||||
|
|
||||||
|
@ -50,6 +50,8 @@ class Shader : public Resource {
|
|||||||
mutable Map<StringName,StringName> params_cache; //map a shader param to a material param..
|
mutable Map<StringName,StringName> params_cache; //map a shader param to a material param..
|
||||||
Map<StringName,Ref<Texture> > default_textures;
|
Map<StringName,Ref<Texture> > default_textures;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
|
||||||
@ -59,10 +61,11 @@ public:
|
|||||||
|
|
||||||
MODE_MATERIAL,
|
MODE_MATERIAL,
|
||||||
MODE_CANVAS_ITEM,
|
MODE_CANVAS_ITEM,
|
||||||
MODE_POST_PROCESS
|
MODE_POST_PROCESS,
|
||||||
|
MODE_MAX
|
||||||
};
|
};
|
||||||
|
|
||||||
void set_mode(Mode p_mode);
|
//void set_mode(Mode p_mode);
|
||||||
Mode get_mode() const;
|
Mode get_mode() const;
|
||||||
|
|
||||||
void set_code( const String& p_vertex, const String& p_fragment, const String& p_light,int p_fragment_ofs=0,int p_light_ofs=0);
|
void set_code( const String& p_vertex, const String& p_fragment, const String& p_light,int p_fragment_ofs=0,int p_light_ofs=0);
|
||||||
@ -79,13 +82,22 @@ public:
|
|||||||
|
|
||||||
virtual RID get_rid() const;
|
virtual RID get_rid() const;
|
||||||
|
|
||||||
Shader();
|
Shader(Mode p_mode);
|
||||||
~Shader();
|
~Shader();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
VARIANT_ENUM_CAST( Shader::Mode );
|
VARIANT_ENUM_CAST( Shader::Mode );
|
||||||
|
|
||||||
|
class MaterialShader : public Shader {
|
||||||
|
|
||||||
|
OBJ_TYPE(MaterialShader,Shader);
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
MaterialShader() : Shader(MODE_MATERIAL) {};
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class ResourceFormatLoaderShader : public ResourceFormatLoader {
|
class ResourceFormatLoaderShader : public ResourceFormatLoader {
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -29,87 +29,54 @@
|
|||||||
#ifndef SHADER_GRAPH_H
|
#ifndef SHADER_GRAPH_H
|
||||||
#define SHADER_GRAPH_H
|
#define SHADER_GRAPH_H
|
||||||
|
|
||||||
#if 0
|
|
||||||
|
|
||||||
#include "map.h"
|
#include "map.h"
|
||||||
#include "scene/resources/shader.h"
|
#include "scene/resources/shader.h"
|
||||||
|
|
||||||
class ShaderGraph : public Resource {
|
class ShaderGraph : public Shader {
|
||||||
|
|
||||||
OBJ_TYPE( ShaderGraph, Resource );
|
OBJ_TYPE( ShaderGraph, Shader );
|
||||||
RES_BASE_EXTENSION("sgp");
|
RES_BASE_EXTENSION("sgp");
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
enum NodeType {
|
enum NodeType {
|
||||||
NODE_IN, ///< param 0: name
|
NODE_INPUT, // all inputs (shader type dependent)
|
||||||
NODE_OUT, ///< param 0: name
|
NODE_SCALAR_CONST, //scalar constant
|
||||||
NODE_CONSTANT, ///< param 0: value
|
NODE_VEC_CONST, //vec3 constant
|
||||||
NODE_PARAMETER, ///< param 0: name
|
NODE_RGB_CONST, //rgb constant (shows a color picker instead)
|
||||||
NODE_ADD,
|
NODE_XFORM_CONST, // 4x4 matrix constant
|
||||||
NODE_SUB,
|
NODE_TIME, // time in seconds
|
||||||
NODE_MUL,
|
NODE_SCREEN_TEX, // screen texture sampler (takes UV) (only usable in fragment shader)
|
||||||
NODE_DIV,
|
NODE_SCALAR_OP, // scalar vs scalar op (mul, add, div, etc)
|
||||||
NODE_MOD,
|
NODE_VEC_OP, // vec3 vs vec3 op (mul,ad,div,crossprod,etc)
|
||||||
NODE_SIN,
|
NODE_VEC_SCALAR_OP, // vec3 vs scalar op (mul, add, div, etc)
|
||||||
NODE_COS,
|
NODE_RGB_OP, // vec3 vs vec3 rgb op (with scalar amount), like brighten, darken, burn, dodge, multiply, etc.
|
||||||
NODE_TAN,
|
NODE_XFORM_MULT, // mat4 x mat4
|
||||||
NODE_ARCSIN,
|
NODE_XFORM_VEC_MULT, // mat4 x vec3 mult (with no-translation option)
|
||||||
NODE_ARCCOS,
|
NODE_XFORM_VEC_INV_MULT, // mat4 x vec3 inverse mult (with no-translation option)
|
||||||
NODE_ARCTAN,
|
NODE_SCALAR_FUNC, // scalar function (sin, cos, etc)
|
||||||
NODE_POW,
|
NODE_VEC_FUNC, // vector function (normalize, negate, reciprocal, rgb2hsv, hsv2rgb, etc, etc)
|
||||||
NODE_LOG,
|
NODE_VEC_LEN, // vec3 length
|
||||||
NODE_MAX,
|
NODE_DOT_PROD, // vec3 . vec3 (dot product -> scalar output)
|
||||||
NODE_MIN,
|
NODE_VEC_TO_SCALAR, // 1 vec3 input, 3 scalar outputs
|
||||||
NODE_COMPARE,
|
NODE_SCALAR_TO_VEC, // 3 scalar input, 1 vec3 output
|
||||||
NODE_TEXTURE, ///< param 0: texture
|
NODE_XFORM_TO_VEC, // 3 vec input, 1 xform output
|
||||||
NODE_TIME, ///< param 0: interval length
|
NODE_VEC_TO_XFORM, // 3 vec input, 1 xform output
|
||||||
NODE_NOISE,
|
NODE_SCALAR_INTERP, // scalar interpolation (with optional curve)
|
||||||
NODE_PASS,
|
NODE_VEC_INTERP, // vec3 interpolation (with optional curve)
|
||||||
NODE_VEC_IN, ///< param 0: name
|
NODE_SCALAR_INPUT, // scalar uniform (assignable in material)
|
||||||
NODE_VEC_OUT, ///< param 0: name
|
NODE_VEC_INPUT, // vec3 uniform (assignable in material)
|
||||||
NODE_VEC_CONSTANT, ///< param 0: value
|
NODE_RGB_INPUT, // color uniform (assignable in material)
|
||||||
NODE_VEC_PARAMETER, ///< param 0: name
|
NODE_XFORM_INPUT, // mat4 uniform (assignable in material)
|
||||||
NODE_VEC_ADD,
|
NODE_TEXTURE_INPUT, // texture input (assignable in material)
|
||||||
NODE_VEC_SUB,
|
NODE_CUBEMAP_INPUT, // cubemap input (assignable in material)
|
||||||
NODE_VEC_MUL,
|
NODE_OUTPUT, // output (shader type dependent)
|
||||||
NODE_VEC_DIV,
|
NODE_COMMENT, // comment
|
||||||
NODE_VEC_MOD,
|
|
||||||
NODE_VEC_CROSS,
|
|
||||||
NODE_VEC_DOT,
|
|
||||||
NODE_VEC_POW,
|
|
||||||
NODE_VEC_NORMALIZE,
|
|
||||||
NODE_VEC_INTERPOLATE,
|
|
||||||
NODE_VEC_SCREEN_TO_UV,
|
|
||||||
NODE_VEC_TRANSFORM3,
|
|
||||||
NODE_VEC_TRANSFORM4,
|
|
||||||
NODE_VEC_COMPARE,
|
|
||||||
NODE_VEC_TEXTURE_2D,
|
|
||||||
NODE_VEC_TEXTURE_CUBE,
|
|
||||||
NODE_VEC_NOISE,
|
|
||||||
NODE_VEC_0,
|
|
||||||
NODE_VEC_1,
|
|
||||||
NODE_VEC_2,
|
|
||||||
NODE_VEC_BUILD,
|
|
||||||
NODE_VEC_PASS,
|
|
||||||
NODE_COLOR_CONSTANT,
|
|
||||||
NODE_COLOR_PARAMETER,
|
|
||||||
NODE_TEXTURE_PARAMETER,
|
|
||||||
NODE_TEXTURE_2D_PARAMETER,
|
|
||||||
NODE_TEXTURE_CUBE_PARAMETER,
|
|
||||||
NODE_TRANSFORM_CONSTANT,
|
|
||||||
NODE_TRANSFORM_PARAMETER,
|
|
||||||
NODE_LABEL,
|
|
||||||
NODE_TYPE_MAX
|
NODE_TYPE_MAX
|
||||||
};
|
};
|
||||||
|
|
||||||
enum ShaderType {
|
|
||||||
SHADER_VERTEX,
|
|
||||||
SHADER_FRAGMENT,
|
|
||||||
SHADER_LIGHT
|
|
||||||
};
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
struct Connection {
|
struct Connection {
|
||||||
|
|
||||||
@ -119,70 +86,287 @@ private:
|
|||||||
int dst_slot;
|
int dst_slot;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum SlotType {
|
||||||
|
|
||||||
|
SLOT_TYPE_SCALAR,
|
||||||
|
SLOT_TYPE_VEC,
|
||||||
|
SLOT_TYPE_XFORM,
|
||||||
|
SLOT_TYPE_TEXTURE,
|
||||||
|
SLOT_MAX
|
||||||
|
};
|
||||||
|
|
||||||
|
enum ShaderType {
|
||||||
|
SHADER_TYPE_VERTEX,
|
||||||
|
SHADER_TYPE_FRAGMENT,
|
||||||
|
SHADER_TYPE_LIGHT,
|
||||||
|
SHADER_TYPE_MAX
|
||||||
|
};
|
||||||
|
|
||||||
|
enum SlotDir {
|
||||||
|
SLOT_IN,
|
||||||
|
SLOT_OUT
|
||||||
|
};
|
||||||
|
|
||||||
|
enum GraphError {
|
||||||
|
GRAPH_OK,
|
||||||
|
GRAPH_ERROR_CYCLIC,
|
||||||
|
GRAPH_ERROR_MISSING_CONNECTIONS
|
||||||
|
};
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
String _find_unique_name(ShaderType p_which, const String& p_base);
|
||||||
|
|
||||||
|
struct SourceSlot {
|
||||||
|
|
||||||
|
int id;
|
||||||
|
int slot;
|
||||||
|
bool operator==(const SourceSlot& p_slot) const {
|
||||||
|
return id==p_slot.id && slot==p_slot.slot;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
struct Node {
|
struct Node {
|
||||||
|
|
||||||
int16_t x,y;
|
Vector2 pos;
|
||||||
NodeType type;
|
NodeType type;
|
||||||
Variant param;
|
Variant param1;
|
||||||
|
Variant param2;
|
||||||
int id;
|
int id;
|
||||||
mutable int order; // used for sorting
|
mutable int order; // used for sorting
|
||||||
mutable bool out_valid;
|
int sort_order;
|
||||||
mutable bool in_valid;
|
Map<int,SourceSlot> connections;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ShaderData {
|
struct ShaderData {
|
||||||
Map<int,Node> node_map;
|
Map<int,Node> node_map;
|
||||||
List<Connection> connections;
|
GraphError error;
|
||||||
} shader[3];
|
} shader[3];
|
||||||
uint64_t version;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
struct InOutParamInfo {
|
||||||
|
Mode shader_mode;
|
||||||
|
ShaderType shader_type;
|
||||||
|
const char *name;
|
||||||
|
const char *variable;
|
||||||
|
SlotType slot_type;
|
||||||
|
SlotDir dir;
|
||||||
|
};
|
||||||
|
|
||||||
|
static const InOutParamInfo inout_param_info[];
|
||||||
|
|
||||||
|
struct NodeSlotInfo {
|
||||||
|
|
||||||
|
enum { MAX_INS=3, MAX_OUTS=3 };
|
||||||
|
NodeType type;
|
||||||
|
const SlotType ins[MAX_INS];
|
||||||
|
const SlotType outs[MAX_OUTS];
|
||||||
|
};
|
||||||
|
|
||||||
|
static const NodeSlotInfo node_slot_info[];
|
||||||
|
|
||||||
|
bool _pending_update_shader;
|
||||||
|
void _update_shader();
|
||||||
|
void _request_update();
|
||||||
|
|
||||||
|
void _add_node_code(ShaderType p_type,Node *p_node,const Vector<String>& p_inputs,String& code);
|
||||||
|
|
||||||
|
Array _get_node_list(ShaderType p_type) const;
|
||||||
|
Array _get_connections(ShaderType p_type) const;
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
/* bool _set(const StringName& p_name, const Variant& p_value);
|
|
||||||
bool _get(const StringName& p_name,Variant &r_ret) const;
|
|
||||||
void _get_property_list( List<PropertyInfo> *p_list) const;*/
|
|
||||||
|
|
||||||
static void _bind_methods();
|
static void _bind_methods();
|
||||||
|
|
||||||
Array _get_connections_helper() const;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
|
||||||
void node_add(ShaderType p_which, NodeType p_type,int p_id);
|
void node_add(ShaderType p_type, NodeType p_node_type, int p_id);
|
||||||
void node_remove(ShaderType p_which,int p_id);
|
void node_remove(ShaderType p_which,int p_id);
|
||||||
void node_set_param(ShaderType p_which, int p_id, const Variant& p_value);
|
|
||||||
void node_set_pos(ShaderType p_which,int p_id,const Point2& p_pos);
|
void node_set_pos(ShaderType p_which,int p_id,const Point2& p_pos);
|
||||||
void node_change_type(ShaderType p_which,int p_id, NodeType p_type);
|
|
||||||
Point2 node_get_pos(ShaderType p_which,int p_id) const;
|
Point2 node_get_pos(ShaderType p_which,int p_id) const;
|
||||||
|
|
||||||
void get_node_list(ShaderType p_which,List<int> *p_node_list) const;
|
void get_node_list(ShaderType p_which,List<int> *p_node_list) const;
|
||||||
NodeType node_get_type(ShaderType p_which,int p_id) const;
|
NodeType node_get_type(ShaderType p_which,int p_id) const;
|
||||||
Variant node_get_param(ShaderType p_which,int p_id) const;
|
|
||||||
|
|
||||||
Error connect(ShaderType p_which,int p_src_id,int p_src_slot, int p_dst_id,int p_dst_slot);
|
void scalar_const_node_set_value(ShaderType p_which,int p_id,float p_value);
|
||||||
bool is_connected(ShaderType p_which,int p_src_id,int p_src_slot, int p_dst_id,int p_dst_slot) const;
|
float scalar_const_node_get_value(ShaderType p_which,int p_id) const;
|
||||||
void disconnect(ShaderType p_which,int p_src_id,int p_src_slot, int p_dst_id,int p_dst_slot);
|
|
||||||
|
|
||||||
void get_connections(ShaderType p_which,List<Connection> *p_connections) const;
|
void vec_const_node_set_value(ShaderType p_which,int p_id,const Vector3& p_value);
|
||||||
|
Vector3 vec_const_node_get_value(ShaderType p_which,int p_id) const;
|
||||||
|
|
||||||
void clear();
|
void rgb_const_node_set_value(ShaderType p_which,int p_id,const Color& p_value);
|
||||||
|
Color rgb_const_node_get_value(ShaderType p_which,int p_id) const;
|
||||||
|
|
||||||
uint64_t get_version() const { return version; }
|
void xform_const_node_set_value(ShaderType p_which,int p_id,const Transform& p_value);
|
||||||
|
Transform xform_const_node_get_value(ShaderType p_which,int p_id) const;
|
||||||
|
|
||||||
static void get_default_input_nodes(Mode p_type,List<PropertyInfo> *p_inputs);
|
void texture_node_set_filter_size(ShaderType p_which,int p_id,int p_size);
|
||||||
static void get_default_output_nodes(Mode p_type,List<PropertyInfo> *p_outputs);
|
int texture_node_get_filter_size(ShaderType p_which,int p_id) const;
|
||||||
|
|
||||||
static PropertyInfo node_get_type_info(NodeType p_type);
|
void texture_node_set_filter_strength(ShaderType p_which,float p_id,float p_strength);
|
||||||
static int get_input_count(NodeType p_type);
|
float texture_node_get_filter_strength(ShaderType p_which,float p_id) const;
|
||||||
static int get_output_count(NodeType p_type);
|
|
||||||
static String get_input_name(NodeType p_type,int p_input);
|
enum ScalarOp {
|
||||||
static String get_output_name(NodeType p_type,int p_output);
|
SCALAR_OP_ADD,
|
||||||
static bool is_input_vector(NodeType p_type,int p_input);
|
SCALAR_OP_SUB,
|
||||||
static bool is_output_vector(NodeType p_type,int p_input);
|
SCALAR_OP_MUL,
|
||||||
|
SCALAR_OP_DIV,
|
||||||
|
SCALAR_OP_MOD,
|
||||||
|
SCALAR_OP_POW,
|
||||||
|
SCALAR_OP_MAX,
|
||||||
|
SCALAR_OP_MIN,
|
||||||
|
SCALAR_OP_ATAN2,
|
||||||
|
SCALAR_MAX_OP
|
||||||
|
};
|
||||||
|
|
||||||
|
void scalar_op_node_set_op(ShaderType p_which,float p_id,ScalarOp p_op);
|
||||||
|
ScalarOp scalar_op_node_get_op(ShaderType p_which,float p_id) const;
|
||||||
|
|
||||||
|
enum VecOp {
|
||||||
|
VEC_OP_ADD,
|
||||||
|
VEC_OP_SUB,
|
||||||
|
VEC_OP_MUL,
|
||||||
|
VEC_OP_DIV,
|
||||||
|
VEC_OP_MOD,
|
||||||
|
VEC_OP_POW,
|
||||||
|
VEC_OP_MAX,
|
||||||
|
VEC_OP_MIN,
|
||||||
|
VEC_OP_CROSS,
|
||||||
|
VEC_MAX_OP
|
||||||
|
};
|
||||||
|
|
||||||
|
void vec_op_node_set_op(ShaderType p_which,float p_id,VecOp p_op);
|
||||||
|
VecOp vec_op_node_get_op(ShaderType p_which,float p_id) const;
|
||||||
|
|
||||||
|
enum VecScalarOp {
|
||||||
|
VEC_SCALAR_OP_MUL,
|
||||||
|
VEC_SCALAR_OP_DIV,
|
||||||
|
VEC_SCALAR_OP_POW,
|
||||||
|
VEC_SCALAR_MAX_OP
|
||||||
|
};
|
||||||
|
|
||||||
|
void vec_scalar_op_node_set_op(ShaderType p_which,float p_id,VecScalarOp p_op);
|
||||||
|
VecScalarOp vec_scalar_op_node_get_op(ShaderType p_which,float p_id) const;
|
||||||
|
|
||||||
|
enum RGBOp {
|
||||||
|
RGB_OP_SCREEN,
|
||||||
|
RGB_OP_DIFFERENCE,
|
||||||
|
RGB_OP_DARKEN,
|
||||||
|
RGB_OP_LIGHTEN,
|
||||||
|
RGB_OP_OVERLAY,
|
||||||
|
RGB_OP_DODGE,
|
||||||
|
RGB_OP_BURN,
|
||||||
|
RGB_OP_SOFT_LIGHT,
|
||||||
|
RGB_OP_HARD_LIGHT,
|
||||||
|
RGB_MAX_OP
|
||||||
|
};
|
||||||
|
|
||||||
|
void rgb_op_node_set_op(ShaderType p_which,float p_id,RGBOp p_op,float p_c);
|
||||||
|
RGBOp rgb_op_node_get_op(ShaderType p_which,float p_id) const;
|
||||||
|
float rgb_op_node_get_c(ShaderType p_which,float p_id) const;
|
||||||
|
|
||||||
|
void xform_vec_mult_node_set_no_translation(ShaderType p_which,int p_id,bool p_no_translation);
|
||||||
|
bool xform_vec_mult_node_get_no_translation(ShaderType p_which,int p_id) const;
|
||||||
|
|
||||||
|
enum ScalarFunc {
|
||||||
|
SCALAR_FUNC_SIN,
|
||||||
|
SCALAR_FUNC_COS,
|
||||||
|
SCALAR_FUNC_TAN,
|
||||||
|
SCALAR_FUNC_ASIN,
|
||||||
|
SCALAR_FUNC_ACOS,
|
||||||
|
SCALAR_FUNC_ATAN,
|
||||||
|
SCALAR_FUNC_SINH,
|
||||||
|
SCALAR_FUNC_COSH,
|
||||||
|
SCALAR_FUNC_TANH,
|
||||||
|
SCALAR_FUNC_LOG,
|
||||||
|
SCALAR_FUNC_EXP,
|
||||||
|
SCALAR_FUNC_SQRT,
|
||||||
|
SCALAR_FUNC_ABS,
|
||||||
|
SCALAR_FUNC_SIGN,
|
||||||
|
SCALAR_FUNC_FLOOR,
|
||||||
|
SCALAR_FUNC_ROUND,
|
||||||
|
SCALAR_FUNC_CEIL,
|
||||||
|
SCALAR_FUNC_FRAC,
|
||||||
|
SCALAR_FUNC_SATURATE,
|
||||||
|
SCALAR_FUNC_NEGATE,
|
||||||
|
SCALAR_MAX_FUNC
|
||||||
|
};
|
||||||
|
|
||||||
|
void scalar_func_node_set_function(ShaderType p_which,int p_id,ScalarFunc p_func);
|
||||||
|
ScalarFunc scalar_func_node_get_function(ShaderType p_which,int p_id) const;
|
||||||
|
|
||||||
|
enum VecFunc {
|
||||||
|
VEC_FUNC_NORMALIZE,
|
||||||
|
VEC_FUNC_SATURATE,
|
||||||
|
VEC_FUNC_NEGATE,
|
||||||
|
VEC_FUNC_RECIPROCAL,
|
||||||
|
VEC_FUNC_RGB2HSV,
|
||||||
|
VEC_FUNC_HSV2RGB,
|
||||||
|
VEC_MAX_FUNC
|
||||||
|
};
|
||||||
|
|
||||||
|
void vec_func_node_set_function(ShaderType p_which,int p_id,VecFunc p_func);
|
||||||
|
VecFunc vec_func_node_get_function(ShaderType p_which,int p_id) const;
|
||||||
|
|
||||||
|
void input_node_set_name(ShaderType p_which,int p_id,const String& p_name);
|
||||||
|
String input_node_get_name(ShaderType p_which,int p_id);
|
||||||
|
|
||||||
|
void scalar_input_node_set_value(ShaderType p_which,int p_id,float p_value);
|
||||||
|
float scalar_input_node_get_value(ShaderType p_which,int p_id) const;
|
||||||
|
|
||||||
|
void vec_input_node_set_value(ShaderType p_which,int p_id,const Vector3& p_value);
|
||||||
|
Vector3 vec_input_node_get_value(ShaderType p_which,int p_id) const;
|
||||||
|
|
||||||
|
void rgb_input_node_set_value(ShaderType p_which,int p_id,const Color& p_value);
|
||||||
|
Color rgb_input_node_get_value(ShaderType p_which,int p_id) const;
|
||||||
|
|
||||||
|
void xform_input_node_set_value(ShaderType p_which,int p_id,const Transform& p_value);
|
||||||
|
Transform xform_input_node_get_value(ShaderType p_which,int p_id) const;
|
||||||
|
|
||||||
|
void texture_input_node_set_value(ShaderType p_which,int p_id,const Ref<Texture>& p_texture);
|
||||||
|
Ref<Texture> texture_input_node_get_value(ShaderType p_which,int p_id) const;
|
||||||
|
|
||||||
|
void cubemap_input_node_set_value(ShaderType p_which,int p_id,const Ref<CubeMap>& p_cubemap);
|
||||||
|
Ref<CubeMap> cubemap_input_node_get_value(ShaderType p_which,int p_id) const;
|
||||||
|
|
||||||
|
void comment_node_set_text(ShaderType p_which,int p_id,const String& p_comment);
|
||||||
|
String comment_node_get_text(ShaderType p_which,int p_id) const;
|
||||||
|
|
||||||
|
Error connect_node(ShaderType p_which,int p_src_id,int p_src_slot, int p_dst_id,int p_dst_slot);
|
||||||
|
bool is_node_connected(ShaderType p_which,int p_src_id,int p_src_slot, int p_dst_id,int p_dst_slot) const;
|
||||||
|
void disconnect_node(ShaderType p_which,int p_src_id,int p_src_slot, int p_dst_id,int p_dst_slot);
|
||||||
|
|
||||||
|
void get_node_connections(ShaderType p_which,List<Connection> *p_connections) const;
|
||||||
|
|
||||||
|
void clear(ShaderType p_which);
|
||||||
|
|
||||||
|
Variant node_get_state(ShaderType p_type, int p_node) const;
|
||||||
|
void node_set_state(ShaderType p_type, int p_id, const Variant& p_state);
|
||||||
|
|
||||||
|
static int get_type_input_count(NodeType p_type);
|
||||||
|
static int get_type_output_count(NodeType p_type);
|
||||||
|
static SlotType get_type_input_type(NodeType p_type,int p_idx);
|
||||||
|
static SlotType get_type_output_type(NodeType p_type,int p_idx);
|
||||||
|
static bool is_type_valid(Mode p_mode,ShaderType p_type);
|
||||||
|
|
||||||
|
|
||||||
ShaderGraph();
|
struct SlotInfo {
|
||||||
|
String name;
|
||||||
|
SlotType type;
|
||||||
|
SlotDir dir;
|
||||||
|
};
|
||||||
|
|
||||||
|
static void get_input_output_node_slot_info(Mode p_mode, ShaderType p_type, List<SlotInfo> *r_slots);
|
||||||
|
|
||||||
|
static int get_node_input_slot_count(Mode p_mode, ShaderType p_shader_type,NodeType p_type);
|
||||||
|
static int get_node_output_slot_count(Mode p_mode, ShaderType p_shader_type,NodeType p_type);
|
||||||
|
static SlotType get_node_input_slot_type(Mode p_mode, ShaderType p_shader_type,NodeType p_type,int p_idx);
|
||||||
|
static SlotType get_node_output_slot_type(Mode p_mode, ShaderType p_shader_type,NodeType p_type,int p_idx);
|
||||||
|
|
||||||
|
|
||||||
|
ShaderGraph(Mode p_mode);
|
||||||
~ShaderGraph();
|
~ShaderGraph();
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -192,6 +376,27 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
VARIANT_ENUM_CAST( ShaderGraph::NodeType );
|
VARIANT_ENUM_CAST( ShaderGraph::NodeType );
|
||||||
|
VARIANT_ENUM_CAST( ShaderGraph::ShaderType );
|
||||||
|
VARIANT_ENUM_CAST( ShaderGraph::SlotType );
|
||||||
|
VARIANT_ENUM_CAST( ShaderGraph::ScalarOp );
|
||||||
|
VARIANT_ENUM_CAST( ShaderGraph::VecOp );
|
||||||
|
VARIANT_ENUM_CAST( ShaderGraph::VecScalarOp );
|
||||||
|
VARIANT_ENUM_CAST( ShaderGraph::RGBOp );
|
||||||
|
VARIANT_ENUM_CAST( ShaderGraph::ScalarFunc );
|
||||||
|
VARIANT_ENUM_CAST( ShaderGraph::VecFunc );
|
||||||
|
|
||||||
|
|
||||||
|
class MaterialShaderGraph : public ShaderGraph {
|
||||||
|
|
||||||
|
OBJ_TYPE( MaterialShaderGraph, ShaderGraph );
|
||||||
|
RES_BASE_EXTENSION("sgp");
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
|
||||||
|
MaterialShaderGraph() : ShaderGraph(MODE_MATERIAL) {
|
||||||
|
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
#endif
|
|
||||||
#endif // SHADER_GRAPH_H
|
#endif // SHADER_GRAPH_H
|
||||||
|
@ -650,8 +650,8 @@ void SurfaceTool::mikktGetTexCoord(const SMikkTSpaceContext * pContext, float fv
|
|||||||
Vector<List<Vertex>::Element*> &varr = *((Vector<List<Vertex>::Element*>*)pContext->m_pUserData);
|
Vector<List<Vertex>::Element*> &varr = *((Vector<List<Vertex>::Element*>*)pContext->m_pUserData);
|
||||||
Vector2 v = varr[iFace*3+iVert]->get().uv;
|
Vector2 v = varr[iFace*3+iVert]->get().uv;
|
||||||
fvTexcOut[0]=v.x;
|
fvTexcOut[0]=v.x;
|
||||||
//fvTexcOut[1]=v.y;
|
fvTexcOut[1]=v.y;
|
||||||
fvTexcOut[1]=1.0-v.y;
|
//fvTexcOut[1]=1.0-v.y;
|
||||||
|
|
||||||
}
|
}
|
||||||
void SurfaceTool::mikktSetTSpaceBasic(const SMikkTSpaceContext * pContext, const float fvTangent[], const float fSign, const int iFace, const int iVert){
|
void SurfaceTool::mikktSetTSpaceBasic(const SMikkTSpaceContext * pContext, const float fvTangent[], const float fSign, const int iFace, const int iVert){
|
||||||
|
@ -770,7 +770,7 @@ void PhysicsServerSW::body_remove_collision_exception(RID p_body, RID p_body_b)
|
|||||||
BodySW *body = body_owner.get(p_body);
|
BodySW *body = body_owner.get(p_body);
|
||||||
ERR_FAIL_COND(!body);
|
ERR_FAIL_COND(!body);
|
||||||
|
|
||||||
body->remove_exception(p_body);
|
body->remove_exception(p_body_b);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -26,8 +26,6 @@
|
|||||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
#ifndef SHADER_GRAPH_H
|
|
||||||
#define SHADER_GRAPH_H
|
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
|
|
||||||
@ -109,4 +107,3 @@ public:
|
|||||||
|
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
|
17
tools/SCsub
17
tools/SCsub
@ -5,13 +5,16 @@ env.add_source_files(env.tool_sources,"*.cpp")
|
|||||||
|
|
||||||
Export('env')
|
Export('env')
|
||||||
|
|
||||||
SConscript('editor/SCsub');
|
if (env["tools"]!="no"):
|
||||||
#SConscript('scintilla/SCsub');
|
SConscript('editor/SCsub');
|
||||||
SConscript('collada/SCsub');
|
#SConscript('scintilla/SCsub');
|
||||||
SConscript('docdump/SCsub');
|
SConscript('collada/SCsub');
|
||||||
SConscript('freetype/SCsub');
|
SConscript('docdump/SCsub');
|
||||||
SConscript('doc/SCsub');
|
SConscript('freetype/SCsub');
|
||||||
SConscript('pck/SCsub');
|
SConscript('doc/SCsub')
|
||||||
|
SConscript('pck/SCsub')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
lib = env.Library("tool",env.tool_sources)
|
lib = env.Library("tool",env.tool_sources)
|
||||||
|
|
||||||
|
@ -186,7 +186,9 @@ void DocData::generate(bool p_basic_types) {
|
|||||||
arginfo=E->get().return_val;
|
arginfo=E->get().return_val;
|
||||||
if (arginfo.type==Variant::NIL)
|
if (arginfo.type==Variant::NIL)
|
||||||
continue;
|
continue;
|
||||||
|
if (m && m->get_return_type()!=StringName())
|
||||||
|
method.return_type=m->get_return_type();
|
||||||
|
else
|
||||||
method.return_type=(arginfo.hint==PROPERTY_HINT_RESOURCE_TYPE)?arginfo.hint_string:Variant::get_type_name(arginfo.type);
|
method.return_type=(arginfo.hint==PROPERTY_HINT_RESOURCE_TYPE)?arginfo.hint_string:Variant::get_type_name(arginfo.type);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
@ -2909,11 +2909,11 @@ void AnimationKeyEditor::set_anim_pos(float p_pos) {
|
|||||||
|
|
||||||
void AnimationKeyEditor::_pane_drag(const Point2& p_delta) {
|
void AnimationKeyEditor::_pane_drag(const Point2& p_delta) {
|
||||||
|
|
||||||
Size2 ecs = ec->get_minsize();
|
Size2 ecs = ec->get_custom_minimum_size();
|
||||||
ecs.y-=p_delta.y;
|
ecs.y-=p_delta.y;
|
||||||
if (ecs.y<100)
|
if (ecs.y<100)
|
||||||
ecs.y=100;
|
ecs.y=100;
|
||||||
ec->set_minsize(ecs);;
|
ec->set_custom_minimum_size(ecs);;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3238,7 +3238,7 @@ AnimationKeyEditor::AnimationKeyEditor(UndoRedo *p_undo_redo, EditorHistory *p_h
|
|||||||
move_down_button->connect("pressed",this,"_menu_track",make_binds(TRACK_MENU_MOVE_DOWN));
|
move_down_button->connect("pressed",this,"_menu_track",make_binds(TRACK_MENU_MOVE_DOWN));
|
||||||
move_down_button->set_focus_mode(FOCUS_NONE);
|
move_down_button->set_focus_mode(FOCUS_NONE);
|
||||||
move_down_button->set_disabled(true);
|
move_down_button->set_disabled(true);
|
||||||
move_down_button->set_tooltip("Move current track dosn.");
|
move_down_button->set_tooltip("Move current track down.");
|
||||||
|
|
||||||
remove_button = memnew( ToolButton );
|
remove_button = memnew( ToolButton );
|
||||||
hb->add_child(remove_button);
|
hb->add_child(remove_button);
|
||||||
@ -3296,8 +3296,8 @@ AnimationKeyEditor::AnimationKeyEditor(UndoRedo *p_undo_redo, EditorHistory *p_h
|
|||||||
|
|
||||||
// menu->get_popup()->connect("item_pressed",this,"_menu_callback");
|
// menu->get_popup()->connect("item_pressed",this,"_menu_callback");
|
||||||
|
|
||||||
ec = memnew (EmptyControl);
|
ec = memnew (Control);
|
||||||
ec->set_minsize(Size2(0,50));
|
ec->set_custom_minimum_size(Size2(0,50));
|
||||||
add_child(ec);
|
add_child(ec);
|
||||||
ec->set_v_size_flags(SIZE_EXPAND_FILL);
|
ec->set_v_size_flags(SIZE_EXPAND_FILL);
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@
|
|||||||
#include "scene/gui/scroll_bar.h"
|
#include "scene/gui/scroll_bar.h"
|
||||||
#include "scene/gui/tool_button.h"
|
#include "scene/gui/tool_button.h"
|
||||||
#include "scene/gui/file_dialog.h"
|
#include "scene/gui/file_dialog.h"
|
||||||
#include "scene/gui/empty_control.h"
|
|
||||||
#include "scene/resources/animation.h"
|
#include "scene/resources/animation.h"
|
||||||
#include "scene/animation/animation_cache.h"
|
#include "scene/animation/animation_cache.h"
|
||||||
#include "scene_tree_editor.h"
|
#include "scene_tree_editor.h"
|
||||||
@ -157,7 +157,7 @@ class AnimationKeyEditor : public VBoxContainer {
|
|||||||
PopupMenu *track_menu;
|
PopupMenu *track_menu;
|
||||||
PopupMenu *type_menu;
|
PopupMenu *type_menu;
|
||||||
|
|
||||||
EmptyControl *ec;
|
Control *ec;
|
||||||
TextureFrame *zoomicon;
|
TextureFrame *zoomicon;
|
||||||
HSlider *zoom;
|
HSlider *zoom;
|
||||||
//MenuButton *menu;
|
//MenuButton *menu;
|
||||||
|
@ -599,6 +599,18 @@ CodeTextEditor::CodeTextEditor() {
|
|||||||
add_child(text_editor);
|
add_child(text_editor);
|
||||||
text_editor->set_area_as_parent_rect();
|
text_editor->set_area_as_parent_rect();
|
||||||
text_editor->set_margin(MARGIN_BOTTOM,20);
|
text_editor->set_margin(MARGIN_BOTTOM,20);
|
||||||
|
|
||||||
|
String editor_font = EDITOR_DEF("text_editor/font", "");
|
||||||
|
bool font_overrode = false;
|
||||||
|
if (editor_font!="") {
|
||||||
|
Ref<Font> fnt = ResourceLoader::load(editor_font);
|
||||||
|
if (fnt.is_valid()) {
|
||||||
|
text_editor->add_font_override("font",fnt);
|
||||||
|
font_overrode = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!font_overrode)
|
||||||
text_editor->add_font_override("font",get_font("source","Fonts"));
|
text_editor->add_font_override("font",get_font("source","Fonts"));
|
||||||
text_editor->set_show_line_numbers(true);
|
text_editor->set_show_line_numbers(true);
|
||||||
text_editor->set_brace_matching(true);
|
text_editor->set_brace_matching(true);
|
||||||
|
@ -1361,8 +1361,8 @@ EditorHelp::EditorHelp(EditorNode *p_editor) {
|
|||||||
|
|
||||||
Separator *hs = memnew( VSeparator );
|
Separator *hs = memnew( VSeparator );
|
||||||
panel_hb->add_child(hs);
|
panel_hb->add_child(hs);
|
||||||
EmptyControl *ec = memnew( EmptyControl );
|
Control *ec = memnew( Control );
|
||||||
ec->set_minsize(Size2(200,1));
|
ec->set_custom_minimum_size(Size2(200,1));
|
||||||
panel_hb->add_child(ec);
|
panel_hb->add_child(ec);
|
||||||
search = memnew( LineEdit );
|
search = memnew( LineEdit );
|
||||||
ec->add_child(search);
|
ec->add_child(search);
|
||||||
|
@ -292,7 +292,11 @@ Vector<StringName> EditorExportPlatform::get_dependencies(bool p_bundles) const
|
|||||||
_add_filter_to_list(exported,"*");
|
_add_filter_to_list(exported,"*");
|
||||||
} else {
|
} else {
|
||||||
_add_to_list(EditorFileSystem::get_singleton()->get_filesystem(),exported);
|
_add_to_list(EditorFileSystem::get_singleton()->get_filesystem(),exported);
|
||||||
_add_filter_to_list(exported,EditorImportExport::get_singleton()->get_export_custom_filter());
|
String cf = EditorImportExport::get_singleton()->get_export_custom_filter();
|
||||||
|
if (cf!="")
|
||||||
|
cf+=",";
|
||||||
|
cf+="*.flags";
|
||||||
|
_add_filter_to_list(exported,cf);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -361,8 +365,12 @@ Vector<StringName> EditorExportPlatform::get_dependencies(bool p_bundles) const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
String cf = EditorImportExport::get_singleton()->get_export_custom_filter();
|
||||||
|
if (cf!="")
|
||||||
|
cf+=",";
|
||||||
|
cf+="*.flags";
|
||||||
|
_add_filter_to_list(exported,cf);
|
||||||
|
|
||||||
_add_filter_to_list(exported,EditorImportExport::get_singleton()->get_export_custom_filter());
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -203,9 +203,9 @@ EditorLog::EditorLog() {
|
|||||||
tb->connect("pressed",this,"_close_request");
|
tb->connect("pressed",this,"_close_request");
|
||||||
|
|
||||||
|
|
||||||
ec = memnew( EmptyControl);
|
ec = memnew( Control);
|
||||||
vb->add_child(ec);
|
vb->add_child(ec);
|
||||||
ec->set_minsize(Size2(0,100));
|
ec->set_custom_minimum_size(Size2(0,100));
|
||||||
ec->set_v_size_flags(SIZE_EXPAND_FILL);
|
ec->set_v_size_flags(SIZE_EXPAND_FILL);
|
||||||
|
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@
|
|||||||
#include "scene/gui/label.h"
|
#include "scene/gui/label.h"
|
||||||
#include "scene/gui/rich_text_label.h"
|
#include "scene/gui/rich_text_label.h"
|
||||||
#include "scene/gui/texture_button.h"
|
#include "scene/gui/texture_button.h"
|
||||||
#include "scene/gui/empty_control.h"
|
//#include "scene/gui/empty_control.h"
|
||||||
#include "scene/gui/box_container.h"
|
#include "scene/gui/box_container.h"
|
||||||
#include "scene/gui/panel_container.h"
|
#include "scene/gui/panel_container.h"
|
||||||
#include "scene/gui/texture_frame.h"
|
#include "scene/gui/texture_frame.h"
|
||||||
@ -50,7 +50,7 @@ class EditorLog : public PanelContainer {
|
|||||||
TextureButton *tb;
|
TextureButton *tb;
|
||||||
HBoxContainer *title_hb;
|
HBoxContainer *title_hb;
|
||||||
// PaneDrag *pd;
|
// PaneDrag *pd;
|
||||||
EmptyControl *ec;
|
Control *ec;
|
||||||
|
|
||||||
static void _error_handler(void *p_self, const char*p_func, const char*p_file,int p_line, const char*p_error,const char*p_errorexp,ErrorHandlerType p_type);
|
static void _error_handler(void *p_self, const char*p_func, const char*p_file,int p_line, const char*p_error,const char*p_errorexp,ErrorHandlerType p_type);
|
||||||
|
|
||||||
|
@ -75,6 +75,7 @@
|
|||||||
#include "plugins/tile_map_editor_plugin.h"
|
#include "plugins/tile_map_editor_plugin.h"
|
||||||
#include "plugins/cube_grid_theme_editor_plugin.h"
|
#include "plugins/cube_grid_theme_editor_plugin.h"
|
||||||
#include "plugins/shader_editor_plugin.h"
|
#include "plugins/shader_editor_plugin.h"
|
||||||
|
#include "plugins/shader_graph_editor_plugin.h"
|
||||||
#include "plugins/path_editor_plugin.h"
|
#include "plugins/path_editor_plugin.h"
|
||||||
#include "plugins/rich_text_editor_plugin.h"
|
#include "plugins/rich_text_editor_plugin.h"
|
||||||
#include "plugins/collision_polygon_editor_plugin.h"
|
#include "plugins/collision_polygon_editor_plugin.h"
|
||||||
@ -3245,7 +3246,7 @@ EditorNode::EditorNode() {
|
|||||||
gui_base->set_area_as_parent_rect();
|
gui_base->set_area_as_parent_rect();
|
||||||
|
|
||||||
|
|
||||||
Ref<Theme> theme( memnew( Theme ) );
|
theme = Ref<Theme>( memnew( Theme ) );
|
||||||
gui_base->set_theme( theme );
|
gui_base->set_theme( theme );
|
||||||
editor_register_icons(theme);
|
editor_register_icons(theme);
|
||||||
editor_register_fonts(theme);
|
editor_register_fonts(theme);
|
||||||
@ -3308,13 +3309,13 @@ EditorNode::EditorNode() {
|
|||||||
main_editor_tabs->connect("tab_changed",this,"_editor_select");
|
main_editor_tabs->connect("tab_changed",this,"_editor_select");
|
||||||
HBoxContainer *srth = memnew( HBoxContainer );
|
HBoxContainer *srth = memnew( HBoxContainer );
|
||||||
srt->add_child( srth );
|
srt->add_child( srth );
|
||||||
EmptyControl *tec = memnew( EmptyControl );
|
Control *tec = memnew( Control );
|
||||||
tec->set_minsize(Size2(100,0));
|
tec->set_custom_minimum_size(Size2(100,0));
|
||||||
tec->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
tec->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||||
srth->add_child(tec);
|
srth->add_child(tec);
|
||||||
srth->add_child(main_editor_tabs);
|
srth->add_child(main_editor_tabs);
|
||||||
tec = memnew( EmptyControl );
|
tec = memnew( Control );
|
||||||
tec->set_minsize(Size2(100,0));
|
tec->set_custom_minimum_size(Size2(100,0));
|
||||||
srth->add_child(tec);
|
srth->add_child(tec);
|
||||||
tec->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
tec->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||||
|
|
||||||
@ -3674,8 +3675,8 @@ EditorNode::EditorNode() {
|
|||||||
top_pallete->add_child(resources_dock);
|
top_pallete->add_child(resources_dock);
|
||||||
top_pallete->set_v_size_flags(Control::SIZE_EXPAND_FILL);
|
top_pallete->set_v_size_flags(Control::SIZE_EXPAND_FILL);
|
||||||
|
|
||||||
EmptyControl *editor_spacer = memnew( EmptyControl );
|
Control *editor_spacer = memnew( Control );
|
||||||
editor_spacer->set_minsize(Size2(260,200));
|
editor_spacer->set_custom_minimum_size(Size2(260,200));
|
||||||
editor_spacer->set_v_size_flags(Control::SIZE_EXPAND_FILL);
|
editor_spacer->set_v_size_flags(Control::SIZE_EXPAND_FILL);
|
||||||
editor_vsplit->add_child( editor_spacer );
|
editor_vsplit->add_child( editor_spacer );
|
||||||
editor_spacer->add_child( top_pallete );
|
editor_spacer->add_child( top_pallete );
|
||||||
@ -3686,8 +3687,8 @@ EditorNode::EditorNode() {
|
|||||||
|
|
||||||
prop_pallete->set_v_size_flags(Control::SIZE_EXPAND_FILL);
|
prop_pallete->set_v_size_flags(Control::SIZE_EXPAND_FILL);
|
||||||
|
|
||||||
editor_spacer = memnew( EmptyControl );
|
editor_spacer = memnew( Control );
|
||||||
editor_spacer->set_minsize(Size2(260,200));
|
editor_spacer->set_custom_minimum_size(Size2(260,200));
|
||||||
editor_spacer->set_v_size_flags(Control::SIZE_EXPAND_FILL);
|
editor_spacer->set_v_size_flags(Control::SIZE_EXPAND_FILL);
|
||||||
editor_vsplit->add_child( editor_spacer );
|
editor_vsplit->add_child( editor_spacer );
|
||||||
editor_spacer->add_child( prop_pallete );
|
editor_spacer->add_child( prop_pallete );
|
||||||
@ -4016,6 +4017,7 @@ EditorNode::EditorNode() {
|
|||||||
add_editor_plugin( memnew( ScriptEditorPlugin(this) ) );
|
add_editor_plugin( memnew( ScriptEditorPlugin(this) ) );
|
||||||
add_editor_plugin( memnew( EditorHelpPlugin(this) ) );
|
add_editor_plugin( memnew( EditorHelpPlugin(this) ) );
|
||||||
add_editor_plugin( memnew( AnimationPlayerEditorPlugin(this) ) );
|
add_editor_plugin( memnew( AnimationPlayerEditorPlugin(this) ) );
|
||||||
|
add_editor_plugin( memnew( ShaderGraphEditorPlugin(this) ) );
|
||||||
add_editor_plugin( memnew( ShaderEditorPlugin(this) ) );
|
add_editor_plugin( memnew( ShaderEditorPlugin(this) ) );
|
||||||
add_editor_plugin( memnew( CameraEditorPlugin(this) ) );
|
add_editor_plugin( memnew( CameraEditorPlugin(this) ) );
|
||||||
add_editor_plugin( memnew( SampleEditorPlugin(this) ) );
|
add_editor_plugin( memnew( SampleEditorPlugin(this) ) );
|
||||||
|
@ -212,6 +212,7 @@ class EditorNode : public Node {
|
|||||||
AcceptDialog *load_error_dialog;
|
AcceptDialog *load_error_dialog;
|
||||||
|
|
||||||
Control *scene_root_base;
|
Control *scene_root_base;
|
||||||
|
Ref<Theme> theme;
|
||||||
|
|
||||||
PopupMenu *recent_scenes;
|
PopupMenu *recent_scenes;
|
||||||
Button *property_back;
|
Button *property_back;
|
||||||
@ -472,6 +473,9 @@ public:
|
|||||||
|
|
||||||
void stop_child_process();
|
void stop_child_process();
|
||||||
|
|
||||||
|
Ref<Theme> get_editor_theme() const { return theme; }
|
||||||
|
|
||||||
|
|
||||||
Error export_platform(const String& p_platform, const String& p_path, bool p_debug,const String& p_password,bool p_quit_after=false);
|
Error export_platform(const String& p_platform, const String& p_path, bool p_debug,const String& p_password,bool p_quit_after=false);
|
||||||
|
|
||||||
static void register_editor_types();
|
static void register_editor_types();
|
||||||
|
@ -419,6 +419,8 @@ void EditorSettings::_load_defaults() {
|
|||||||
|
|
||||||
set("3d_editor/navigation_scheme",0);
|
set("3d_editor/navigation_scheme",0);
|
||||||
hints["3d_editor/navigation_scheme"]=PropertyInfo(Variant::INT,"3d_editor/navigation_scheme",PROPERTY_HINT_ENUM,"Godot,Maya,Modo");
|
hints["3d_editor/navigation_scheme"]=PropertyInfo(Variant::INT,"3d_editor/navigation_scheme",PROPERTY_HINT_ENUM,"Godot,Maya,Modo");
|
||||||
|
set("3d_editor/zoom_style",0);
|
||||||
|
hints["3d_editor/zoom_style"]=PropertyInfo(Variant::INT,"3d_editor/zoom_style",PROPERTY_HINT_ENUM,"Vertical, Horizontal");
|
||||||
set("3d_editor/orbit_modifier",0);
|
set("3d_editor/orbit_modifier",0);
|
||||||
hints["3d_editor/orbit_modifier"]=PropertyInfo(Variant::INT,"3d_editor/orbit_modifier",PROPERTY_HINT_ENUM,"None,Shift,Alt,Meta,Ctrl");
|
hints["3d_editor/orbit_modifier"]=PropertyInfo(Variant::INT,"3d_editor/orbit_modifier",PROPERTY_HINT_ENUM,"None,Shift,Alt,Meta,Ctrl");
|
||||||
set("3d_editor/pan_modifier",1);
|
set("3d_editor/pan_modifier",1);
|
||||||
@ -444,6 +446,7 @@ void EditorSettings::_load_defaults() {
|
|||||||
set("animation/confirm_insert_track",true);
|
set("animation/confirm_insert_track",true);
|
||||||
|
|
||||||
set("property_editor/texture_preview_width",48);
|
set("property_editor/texture_preview_width",48);
|
||||||
|
set("property_editor/auto_refresh_interval",0.3);
|
||||||
set("help/doc_path","");
|
set("help/doc_path","");
|
||||||
|
|
||||||
set("import/ask_save_before_reimport",false);
|
set("import/ask_save_before_reimport",false);
|
||||||
|
BIN
tools/editor/icons/icon_canvas_item_shader.png
Normal file
BIN
tools/editor/icons/icon_canvas_item_shader.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 568 B |
BIN
tools/editor/icons/icon_canvas_item_shader_graph.png
Normal file
BIN
tools/editor/icons/icon_canvas_item_shader_graph.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 575 B |
BIN
tools/editor/icons/icon_material_shader.png
Normal file
BIN
tools/editor/icons/icon_material_shader.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 844 B |
BIN
tools/editor/icons/icon_material_shader_graph.png
Normal file
BIN
tools/editor/icons/icon_material_shader_graph.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 949 B |
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user