Merge branch 'master' of https://github.com/okamstudio/godot
This commit is contained in:
commit
2b12a8109d
|
@ -23,6 +23,9 @@ tools/editor/editor_icons.cpp
|
|||
make.bat
|
||||
log.txt
|
||||
|
||||
# Doxygen generated documentation
|
||||
doc/doxygen/*
|
||||
|
||||
# Javascript specific
|
||||
*.bc
|
||||
|
||||
|
@ -81,6 +84,8 @@ platform/android/libs/play_licensing/gen/*
|
|||
*.suo
|
||||
*.user
|
||||
*.sln.docstates
|
||||
*.sln
|
||||
*.vcxproj*
|
||||
|
||||
# Build results
|
||||
[Dd]ebug/
|
||||
|
|
6
Doxyfile
6
Doxyfile
|
@ -51,14 +51,14 @@ PROJECT_BRIEF = "Game Engine MIT"
|
|||
# pixels and the maximum width should not exceed 200 pixels. Doxygen will copy
|
||||
# the logo to the output directory.
|
||||
|
||||
PROJECT_LOGO = E:/development/godot/logo_small.png
|
||||
PROJECT_LOGO = ./logo_small.png
|
||||
|
||||
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path
|
||||
# into which the generated documentation will be written. If a relative path is
|
||||
# entered, it will be relative to the location where doxygen was started. If
|
||||
# left blank the current directory will be used.
|
||||
|
||||
OUTPUT_DIRECTORY = E:/development/godot/doxygen
|
||||
OUTPUT_DIRECTORY = ./doc/doxygen/
|
||||
|
||||
# If the CREATE_SUBDIRS tag is set to YES then doxygen will create 4096 sub-
|
||||
# directories (in 2 levels) under the output directory of each output format and
|
||||
|
@ -768,7 +768,7 @@ WARN_LOGFILE =
|
|||
# spaces.
|
||||
# Note: If this tag is empty the current directory is searched.
|
||||
|
||||
INPUT = E:/development/godot
|
||||
INPUT = ./core/ ./main/ ./scene/
|
||||
|
||||
# This tag can be used to specify the character encoding of the source files
|
||||
# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses
|
||||
|
|
|
@ -61,6 +61,7 @@ const char ** tests_get_names() {
|
|||
"gui",
|
||||
"io",
|
||||
"shaderlang",
|
||||
"physics",
|
||||
NULL
|
||||
};
|
||||
|
||||
|
|
|
@ -31,8 +31,7 @@ void FuncRef::_bind_methods() {
|
|||
|
||||
{
|
||||
MethodInfo mi;
|
||||
mi.name="call";
|
||||
mi.arguments.push_back( PropertyInfo( Variant::STRING, "method"));
|
||||
mi.name="call_func";
|
||||
Vector<Variant> defargs;
|
||||
for(int i=0;i<10;i++) {
|
||||
mi.arguments.push_back( PropertyInfo( Variant::NIL, "arg"+itos(i)));
|
||||
|
|
|
@ -299,10 +299,8 @@ Error decode_variant(Variant& r_variant,const uint8_t *p_buffer, int p_len,int *
|
|||
ERR_FAIL_COND_V(len<12,ERR_INVALID_DATA);
|
||||
Vector<StringName> names;
|
||||
Vector<StringName> subnames;
|
||||
bool absolute;
|
||||
StringName prop;
|
||||
|
||||
int i=0;
|
||||
uint32_t namecount=strlen&=0x7FFFFFFF;
|
||||
uint32_t subnamecount = decode_uint32(buf+4);
|
||||
uint32_t flags = decode_uint32(buf+8);
|
||||
|
@ -391,7 +389,6 @@ Error decode_variant(Variant& r_variant,const uint8_t *p_buffer, int p_len,int *
|
|||
|
||||
ie.type=decode_uint32(&buf[0]);
|
||||
ie.device=decode_uint32(&buf[4]);
|
||||
uint32_t len = decode_uint32(&buf[8])-12;
|
||||
|
||||
if (r_len)
|
||||
(*r_len)+=12;
|
||||
|
|
|
@ -231,14 +231,12 @@ Ref<ResourceImportMetadata> ResourceLoader::load_import_metadata(const String &p
|
|||
local_path = Globals::get_singleton()->localize_path(p_path);
|
||||
|
||||
String extension=p_path.extension();
|
||||
bool found=false;
|
||||
Ref<ResourceImportMetadata> ret;
|
||||
|
||||
for (int i=0;i<loader_count;i++) {
|
||||
|
||||
if (!loader[i]->recognize(extension))
|
||||
continue;
|
||||
found=true;
|
||||
|
||||
Error err = loader[i]->load_import_metadata(local_path,ret);
|
||||
if (err==OK)
|
||||
|
|
|
@ -1788,7 +1788,7 @@ extern int ZEXPORT unzReadCurrentFile (unzFile file, voidp buf, unsigned len)
|
|||
return UNZ_PARAMERROR;
|
||||
|
||||
|
||||
if ((pfile_in_zip_read_info->read_buffer == NULL))
|
||||
if (pfile_in_zip_read_info->read_buffer==NULL)
|
||||
return UNZ_END_OF_LIST_OF_FILE;
|
||||
if (len==0)
|
||||
return 0;
|
||||
|
|
|
@ -1114,9 +1114,9 @@ extern int ZEXPORT zipOpenNewFileInZip4_64 (zipFile file, const char* filename,
|
|||
zi->ci.flag = flagBase;
|
||||
if ((level==8) || (level==9))
|
||||
zi->ci.flag |= 2;
|
||||
if ((level==2))
|
||||
if (level==2)
|
||||
zi->ci.flag |= 4;
|
||||
if ((level==1))
|
||||
if (level==1)
|
||||
zi->ci.flag |= 6;
|
||||
if (password != NULL)
|
||||
zi->ci.flag |= 1;
|
||||
|
|
10
core/list.h
10
core/list.h
|
@ -518,10 +518,16 @@ public:
|
|||
|
||||
if (value->prev_ptr) {
|
||||
value->prev_ptr->next_ptr = value->next_ptr;
|
||||
};
|
||||
}
|
||||
else {
|
||||
_data->first = value->next_ptr;
|
||||
}
|
||||
if (value->next_ptr) {
|
||||
value->next_ptr->prev_ptr = value->prev_ptr;
|
||||
};
|
||||
}
|
||||
else {
|
||||
_data->last = value->prev_ptr;
|
||||
}
|
||||
|
||||
value->next_ptr = where;
|
||||
if (!where) {
|
||||
|
|
|
@ -40,11 +40,11 @@ struct Vector3 {
|
|||
enum Axis {
|
||||
AXIS_X,
|
||||
AXIS_Y,
|
||||
AXIS_Z,
|
||||
AXIS_Z,
|
||||
};
|
||||
|
||||
union {
|
||||
|
||||
|
||||
#ifdef USE_QUAD_VECTORS
|
||||
|
||||
struct {
|
||||
|
@ -52,7 +52,7 @@ struct Vector3 {
|
|||
real_t y;
|
||||
real_t z;
|
||||
real_t _unused;
|
||||
};
|
||||
};
|
||||
real_t coord[4];
|
||||
#else
|
||||
|
||||
|
@ -61,18 +61,18 @@ struct Vector3 {
|
|||
real_t y;
|
||||
real_t z;
|
||||
};
|
||||
|
||||
|
||||
real_t coord[3];
|
||||
#endif
|
||||
};
|
||||
|
||||
_FORCE_INLINE_ const real_t& operator[](int p_axis) const {
|
||||
|
||||
|
||||
return coord[p_axis];
|
||||
}
|
||||
|
||||
_FORCE_INLINE_ real_t& operator[](int p_axis) {
|
||||
|
||||
|
||||
return coord[p_axis];
|
||||
}
|
||||
|
||||
|
@ -84,7 +84,7 @@ struct Vector3 {
|
|||
|
||||
_FORCE_INLINE_ real_t length() const;
|
||||
_FORCE_INLINE_ real_t length_squared() const;
|
||||
|
||||
|
||||
_FORCE_INLINE_ void normalize();
|
||||
_FORCE_INLINE_ Vector3 normalized() const;
|
||||
_FORCE_INLINE_ Vector3 inverse() const;
|
||||
|
@ -107,6 +107,8 @@ struct Vector3 {
|
|||
_FORCE_INLINE_ real_t dot(const Vector3& p_b) const;
|
||||
|
||||
_FORCE_INLINE_ Vector3 abs() const;
|
||||
_FORCE_INLINE_ Vector3 floor() const;
|
||||
_FORCE_INLINE_ Vector3 ceil() const;
|
||||
|
||||
_FORCE_INLINE_ real_t distance_to(const Vector3& p_b) const;
|
||||
_FORCE_INLINE_ real_t distance_squared_to(const Vector3& p_b) const;
|
||||
|
@ -172,7 +174,17 @@ real_t Vector3::dot(const Vector3& p_b) const {
|
|||
Vector3 Vector3::abs() const {
|
||||
|
||||
return Vector3( Math::abs(x), Math::abs(y), Math::abs(z) );
|
||||
}
|
||||
}
|
||||
|
||||
Vector3 Vector3::floor() const {
|
||||
|
||||
return Vector3( Math::floor(x), Math::floor(y), Math::floor(z) );
|
||||
}
|
||||
|
||||
Vector3 Vector3::ceil() const {
|
||||
|
||||
return Vector3( Math::ceil(x), Math::ceil(y), Math::ceil(z) );
|
||||
}
|
||||
|
||||
Vector3 Vector3::linear_interpolate(const Vector3& p_b,float p_t) const {
|
||||
|
||||
|
@ -301,7 +313,7 @@ bool Vector3::operator<(const Vector3& p_v) const {
|
|||
return y<p_v.y;
|
||||
} else
|
||||
return x<p_v.x;
|
||||
|
||||
|
||||
}
|
||||
|
||||
bool Vector3::operator<=(const Vector3& p_v) const {
|
||||
|
|
|
@ -49,7 +49,7 @@
|
|||
|
||||
enum PropertyHint {
|
||||
PROPERTY_HINT_NONE, ///< no hint provided.
|
||||
PROPERTY_HINT_RANGE, ///< hint_text = "min,max,step"
|
||||
PROPERTY_HINT_RANGE, ///< hint_text = "min,max,step,slider; //slider is optional"
|
||||
PROPERTY_HINT_EXP_RANGE, ///< hint_text = "min,max,step", exponential edit
|
||||
PROPERTY_HINT_ENUM, ///< hint_text= "val1,val2,val3,etc"
|
||||
PROPERTY_HINT_EXP_EASING, /// exponential easing funciton (Math::ease)
|
||||
|
@ -58,12 +58,12 @@ enum PropertyHint {
|
|||
PROPERTY_HINT_KEY_ACCEL, ///< hint_text= "length" (as integer)
|
||||
PROPERTY_HINT_FLAGS, ///< hint_text= "flag1,flag2,etc" (as bit flags)
|
||||
PROPERTY_HINT_ALL_FLAGS,
|
||||
PROPERTY_HINT_FILE, ///< a file path must be passed, hint_text (optionally) is a filter "*.png,*.wav,*.doc,"
|
||||
PROPERTY_HINT_FILE, ///< a file path must be passed, hint_text (optionally) is a filter "*.png,*.wav,*.doc,"
|
||||
PROPERTY_HINT_DIR, ///< a directort path must be passed
|
||||
PROPERTY_HINT_GLOBAL_FILE, ///< a file path must be passed, hint_text (optionally) is a filter "*.png,*.wav,*.doc,"
|
||||
PROPERTY_HINT_GLOBAL_DIR, ///< a directort path must be passed
|
||||
PROPERTY_HINT_RESOURCE_TYPE, ///< a resource object type
|
||||
PROPERTY_HINT_MULTILINE_TEXT, ///< used for string properties that can contain multiple lines
|
||||
PROPERTY_HINT_MULTILINE_TEXT, ///< used for string properties that can contain multiple lines
|
||||
PROPERTY_HINT_COLOR_NO_ALPHA, ///< used for ignoring alpha component when editing a color
|
||||
PROPERTY_HINT_IMAGE_COMPRESS_LOSSY,
|
||||
PROPERTY_HINT_IMAGE_COMPRESS_LOSSLESS,
|
||||
|
@ -71,7 +71,7 @@ enum PropertyHint {
|
|||
};
|
||||
|
||||
enum PropertyUsageFlags {
|
||||
|
||||
|
||||
PROPERTY_USAGE_STORAGE=1,
|
||||
PROPERTY_USAGE_EDITOR=2,
|
||||
PROPERTY_USAGE_NETWORK=4,
|
||||
|
@ -102,15 +102,15 @@ enum PropertyUsageFlags {
|
|||
#define ADD_PROPERTYINO( m_property, m_setter, m_getter, m_index ) ObjectTypeDB::add_property( get_type_static(), (m_property).added_usage(PROPERTY_USAGE_STORE_IF_NONONE), m_setter, m_getter, m_index )
|
||||
|
||||
struct PropertyInfo {
|
||||
|
||||
Variant::Type type;
|
||||
|
||||
Variant::Type type;
|
||||
String name;
|
||||
PropertyHint hint;
|
||||
String hint_string;
|
||||
String hint_string;
|
||||
uint32_t usage;
|
||||
|
||||
_FORCE_INLINE_ PropertyInfo added_usage(int p_fl) const { PropertyInfo pi=*this; pi.usage|=p_fl; return pi; }
|
||||
|
||||
|
||||
PropertyInfo() { type=Variant::NIL; hint=PROPERTY_HINT_NONE; usage = PROPERTY_USAGE_DEFAULT; }
|
||||
PropertyInfo( Variant::Type p_type, const String p_name, PropertyHint p_hint=PROPERTY_HINT_NONE, const String& p_hint_string="",uint32_t p_usage=PROPERTY_USAGE_DEFAULT) {
|
||||
type=p_type; name=p_name; hint=p_hint; hint_string=p_hint_string; usage=p_usage;
|
||||
|
@ -125,23 +125,23 @@ struct PropertyInfo {
|
|||
Array convert_property_list(const List<PropertyInfo> * p_list);
|
||||
|
||||
struct MethodInfo {
|
||||
|
||||
|
||||
String name;
|
||||
List<PropertyInfo> arguments;
|
||||
Vector<Variant> default_arguments;
|
||||
PropertyInfo return_val;
|
||||
uint32_t flags;
|
||||
int id;
|
||||
|
||||
|
||||
inline bool operator<(const MethodInfo& p_method) const { return id==p_method.id?(name < p_method.name):(id<p_method.id); }
|
||||
|
||||
|
||||
MethodInfo();
|
||||
MethodInfo(const String& p_name);
|
||||
MethodInfo(const String& p_name, const PropertyInfo& p_param1);
|
||||
MethodInfo(const String& p_name, const PropertyInfo& p_param1,const PropertyInfo& p_param2);
|
||||
MethodInfo(const String& p_name, const PropertyInfo& p_param1,const PropertyInfo& p_param2,const PropertyInfo& p_param3);
|
||||
MethodInfo(const String& p_name, const PropertyInfo& p_param1,const PropertyInfo& p_param2,const PropertyInfo& p_param3,const PropertyInfo& p_param4);
|
||||
MethodInfo(const String& p_name, const PropertyInfo& p_param1,const PropertyInfo& p_param2,const PropertyInfo& p_param3,const PropertyInfo& p_param4,const PropertyInfo& p_param5);
|
||||
MethodInfo(const String& p_name, const PropertyInfo& p_param1,const PropertyInfo& p_param2,const PropertyInfo& p_param3,const PropertyInfo& p_param4,const PropertyInfo& p_param5);
|
||||
MethodInfo(Variant::Type ret);
|
||||
MethodInfo(Variant::Type ret,const String& p_name);
|
||||
MethodInfo(Variant::Type ret,const String& p_name, const PropertyInfo& p_param1);
|
||||
|
@ -158,7 +158,7 @@ struct MethodInfo {
|
|||
//return NULL;
|
||||
|
||||
/*
|
||||
the following is an uncomprehensible blob of hacks and workarounds to compensate for many of the fallencies in C++. As a plus, this macro pretty much alone defines the object model.
|
||||
the following is an uncomprehensible blob of hacks and workarounds to compensate for many of the fallencies in C++. As a plus, this macro pretty much alone defines the object model.
|
||||
*/
|
||||
|
||||
#define REVERSE_GET_PROPERTY_LIST \
|
||||
|
@ -314,7 +314,7 @@ private:
|
|||
class ScriptInstance;
|
||||
typedef uint32_t ObjectID;
|
||||
|
||||
class Object {
|
||||
class Object {
|
||||
public:
|
||||
|
||||
enum ConnectFlags {
|
||||
|
@ -404,7 +404,7 @@ friend void postinitialize_handler(Object*);
|
|||
|
||||
void property_list_changed_notify();
|
||||
|
||||
protected:
|
||||
protected:
|
||||
|
||||
virtual bool _use_builtin_script() const { return false; }
|
||||
virtual void _initialize_typev() { initialize_type(); }
|
||||
|
@ -412,14 +412,14 @@ protected:
|
|||
virtual bool _getv(const StringName& p_name,Variant &r_property) const { return false; };
|
||||
virtual void _get_property_listv(List<PropertyInfo> *p_list,bool p_reversed) const {};
|
||||
virtual void _notificationv(int p_notification,bool p_reversed) {};
|
||||
|
||||
|
||||
static String _get_category() { return ""; }
|
||||
static void _bind_methods();
|
||||
bool _set(const StringName& p_name,const Variant &p_property) { return false; };
|
||||
bool _get(const StringName& p_name,Variant &r_property) const { return false; };
|
||||
void _get_property_list(List<PropertyInfo> *p_list) const {};
|
||||
void _notification(int p_notification) {};
|
||||
|
||||
|
||||
_FORCE_INLINE_ static void (*_get_bind_methods())() {
|
||||
return &Object::_bind_methods;
|
||||
}
|
||||
|
@ -431,13 +431,13 @@ protected:
|
|||
}
|
||||
_FORCE_INLINE_ void (Object::* (_get_get_property_list() const))(List<PropertyInfo> *p_list) const{
|
||||
return &Object::_get_property_list;
|
||||
}
|
||||
}
|
||||
_FORCE_INLINE_ void (Object::* (_get_notification() const))(int){
|
||||
return &Object::_notification;
|
||||
}
|
||||
}
|
||||
static void get_valid_parents_static(List<String> *p_parents);
|
||||
static void _get_valid_parents_static(List<String> *p_parents);
|
||||
|
||||
|
||||
|
||||
void cancel_delete();
|
||||
|
||||
|
@ -485,7 +485,7 @@ public:
|
|||
|
||||
void add_change_receptor( Object *p_receptor );
|
||||
void remove_change_receptor( Object *p_receptor );
|
||||
|
||||
|
||||
template<class T>
|
||||
T *cast_to() {
|
||||
|
||||
|
@ -500,7 +500,7 @@ public:
|
|||
return NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
const T *cast_to() const {
|
||||
|
||||
|
@ -517,11 +517,11 @@ public:
|
|||
}
|
||||
|
||||
enum {
|
||||
|
||||
|
||||
NOTIFICATION_POSTINITIALIZE=0,
|
||||
NOTIFICATION_PREDELETE=1
|
||||
};
|
||||
|
||||
|
||||
/* TYPE API */
|
||||
static void get_inheritance_list_static(List<String>* p_inheritance_list) { p_inheritance_list->push_back("Object"); }
|
||||
|
||||
|
@ -545,7 +545,7 @@ public:
|
|||
return *_type_ptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* IAPI */
|
||||
// void set(const String& p_name, const Variant& p_value);
|
||||
// Variant get(const String& p_name) const;
|
||||
|
@ -554,7 +554,7 @@ public:
|
|||
Variant get(const StringName& p_name, bool *r_valid=NULL) const;
|
||||
|
||||
void get_property_list(List<PropertyInfo> *p_list,bool p_reversed=false) const;
|
||||
|
||||
|
||||
bool has_method(const StringName& p_method) const;
|
||||
void get_method_list(List<MethodInfo> *p_list) const;
|
||||
Variant callv(const StringName& p_method,const Array& p_args);
|
||||
|
@ -564,14 +564,14 @@ public:
|
|||
Variant call(const StringName& p_name, VARIANT_ARG_LIST); // C++ helper
|
||||
void call_multilevel(const StringName& p_name, VARIANT_ARG_LIST); // C++ helper
|
||||
|
||||
void notification(int p_notification,bool p_reversed=false);
|
||||
void notification(int p_notification,bool p_reversed=false);
|
||||
|
||||
//used mainly by script, get and set all INCLUDING string
|
||||
virtual Variant getvar(const Variant& p_key, bool *r_valid=NULL) const;
|
||||
virtual void setvar(const Variant& p_key, const Variant& p_value,bool *r_valid=NULL);
|
||||
|
||||
/* SCRIPT */
|
||||
|
||||
|
||||
void set_script(const RefPtr& p_script);
|
||||
RefPtr get_script() const;
|
||||
|
||||
|
@ -614,14 +614,14 @@ public:
|
|||
StringName tr(const StringName& p_message) const; //translate message (alternative)
|
||||
|
||||
bool _is_queued_for_deletion; // set to true by SceneTree::queue_delete()
|
||||
bool is_queued_for_deletion() const;
|
||||
bool is_queued_for_deletion() const;
|
||||
|
||||
_FORCE_INLINE_ void set_message_translation(bool p_enable) { _can_translate=p_enable; }
|
||||
_FORCE_INLINE_ bool can_translate_messages() const { return _can_translate; }
|
||||
|
||||
void clear_internal_resource_paths();
|
||||
|
||||
Object();
|
||||
Object();
|
||||
virtual ~Object();
|
||||
|
||||
};
|
||||
|
@ -649,13 +649,13 @@ class ObjectDB {
|
|||
static HashMap<Object*,ObjectID,ObjectPtrHash> instance_checks;
|
||||
|
||||
static uint32_t instance_counter;
|
||||
friend class Object;
|
||||
friend class Object;
|
||||
friend void unregister_core_types();
|
||||
|
||||
static void cleanup();
|
||||
static uint32_t add_instance(Object *p_object);
|
||||
static void remove_instance(Object *p_object);
|
||||
public:
|
||||
public:
|
||||
|
||||
typedef void (*DebugFunc)(Object *p_obj);
|
||||
|
||||
|
|
|
@ -286,6 +286,37 @@ NodePath::NodePath(const Vector<StringName>& p_path,const Vector<StringName>& p_
|
|||
data->property=p_property;
|
||||
}
|
||||
|
||||
|
||||
void NodePath::simplify() {
|
||||
|
||||
if (!data)
|
||||
return;
|
||||
for(int i=0;i<data->path.size();i++) {
|
||||
if (data->path.size()==1)
|
||||
break;
|
||||
if (data->path[i].operator String()==".") {
|
||||
data->path.remove(i);
|
||||
i--;
|
||||
} else if (data->path[i].operator String()==".." && i>0 && data->path[i-1].operator String()!="." && data->path[i-1].operator String()!="..") {
|
||||
//remove both
|
||||
data->path.remove(i-1);
|
||||
data->path.remove(i-1);
|
||||
i-=2;
|
||||
if (data->path.size()==0) {
|
||||
data->path.push_back(".");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
NodePath NodePath::simplified() const {
|
||||
|
||||
NodePath np=*this;
|
||||
np.simplify();
|
||||
return np;
|
||||
}
|
||||
|
||||
NodePath::NodePath(const String& p_path) {
|
||||
|
||||
data=NULL;
|
||||
|
|
|
@ -84,7 +84,10 @@ public:
|
|||
bool operator==(const NodePath& p_path) const;
|
||||
bool operator!=(const NodePath& p_path) const;
|
||||
void operator=(const NodePath& p_path);
|
||||
|
||||
|
||||
void simplify();
|
||||
NodePath simplified() const;
|
||||
|
||||
NodePath(const Vector<StringName>& p_path,bool p_absolute,const String& p_property="");
|
||||
NodePath(const Vector<StringName>& p_path,const Vector<StringName>& p_subpath,bool p_absolute,const String& p_property="");
|
||||
NodePath(const NodePath& p_path);
|
||||
|
|
|
@ -130,7 +130,7 @@ public:
|
|||
void set_name(const String& p_name);
|
||||
String get_name() const;
|
||||
|
||||
void set_path(const String& p_path,bool p_take_over=false);
|
||||
virtual void set_path(const String& p_path,bool p_take_over=false);
|
||||
String get_path() const;
|
||||
|
||||
void set_subindex(int p_sub_index);
|
||||
|
|
|
@ -3066,7 +3066,7 @@ String String::world_wrap(int p_chars_per_line) const {
|
|||
} else if (operator[](i)==' ' || operator[](i)=='\t') {
|
||||
last_space=i;
|
||||
} else if (operator[](i)=='\n') {
|
||||
ret+=substr(from,i-from);
|
||||
ret+=substr(from,i-from)+"\n";
|
||||
from=i+1;
|
||||
last_space=-1;
|
||||
}
|
||||
|
|
|
@ -359,6 +359,8 @@ static void _call_##m_type##_##m_method(Variant& r_ret,Variant& p_self,const Var
|
|||
VCALL_LOCALMEM1R(Vector3, dot);
|
||||
VCALL_LOCALMEM1R(Vector3, cross);
|
||||
VCALL_LOCALMEM0R(Vector3, abs);
|
||||
VCALL_LOCALMEM0R(Vector3, floor);
|
||||
VCALL_LOCALMEM0R(Vector3, ceil);
|
||||
VCALL_LOCALMEM1R(Vector3, distance_to);
|
||||
VCALL_LOCALMEM1R(Vector3, distance_squared_to);
|
||||
VCALL_LOCALMEM1R(Vector3, slide);
|
||||
|
@ -753,7 +755,7 @@ static void _call_##m_type##_##m_method(Variant& r_ret,Variant& p_self,const Var
|
|||
}
|
||||
|
||||
static void Matrix32_init2(Variant& r_ret,const Variant** p_args) {
|
||||
|
||||
|
||||
Matrix32 m(*p_args[0], *p_args[1]);
|
||||
r_ret=m;
|
||||
}
|
||||
|
@ -1133,7 +1135,7 @@ void Variant::get_method_list(List<MethodInfo> *p_list) const {
|
|||
if (fd.returns)
|
||||
ret.name="ret";
|
||||
mi.return_val=ret;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
p_list->push_back(mi);
|
||||
}
|
||||
|
@ -1336,6 +1338,8 @@ _VariantCall::addfunc(Variant::m_vtype,Variant::m_ret,_SCS(#m_method),VCALL(m_cl
|
|||
ADDFUNC1(VECTOR3,REAL,Vector3,dot,VECTOR3,"b",varray());
|
||||
ADDFUNC1(VECTOR3,VECTOR3,Vector3,cross,VECTOR3,"b",varray());
|
||||
ADDFUNC0(VECTOR3,VECTOR3,Vector3,abs,varray());
|
||||
ADDFUNC0(VECTOR3,VECTOR3,Vector3,floor,varray());
|
||||
ADDFUNC0(VECTOR3,VECTOR3,Vector3,ceil,varray());
|
||||
ADDFUNC1(VECTOR3,REAL,Vector3,distance_to,VECTOR3,"b",varray());
|
||||
ADDFUNC1(VECTOR3,REAL,Vector3,distance_squared_to,VECTOR3,"b",varray());
|
||||
ADDFUNC1(VECTOR3,VECTOR3,Vector3,slide,VECTOR3,"by",varray());
|
||||
|
@ -1535,10 +1539,10 @@ _VariantCall::addfunc(Variant::m_vtype,Variant::m_ret,_SCS(#m_method),VCALL(m_cl
|
|||
ADDFUNC1(TRANSFORM,NIL,Transform,xform,NIL,"v",varray());
|
||||
ADDFUNC1(TRANSFORM,NIL,Transform,xform_inv,NIL,"v",varray());
|
||||
|
||||
#ifdef DEBUG_ENABLED
|
||||
#ifdef DEBUG_ENABLED
|
||||
_VariantCall::type_funcs[Variant::TRANSFORM].functions["xform"].returns=true;
|
||||
_VariantCall::type_funcs[Variant::TRANSFORM].functions["xform_inv"].returns=true;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
ADDFUNC0(INPUT_EVENT,BOOL,InputEvent,is_pressed,varray());
|
||||
ADDFUNC1(INPUT_EVENT,BOOL,InputEvent,is_action,STRING,"action",varray());
|
||||
|
@ -1635,9 +1639,3 @@ void unregister_variant_methods() {
|
|||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -18,3 +18,11 @@ func _ready():
|
|||
# Initalization here
|
||||
pass
|
||||
|
||||
|
||||
|
||||
func _on_coin_area_enter( area ):
|
||||
pass # replace with function body
|
||||
|
||||
|
||||
func _on_coin_area_enter_shape( area_id, area, area_shape, area_shape ):
|
||||
pass # replace with function body
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
filter=false
|
|
@ -91,4 +91,5 @@ func _ready():
|
|||
# Initalization here
|
||||
pass
|
||||
|
||||
|
||||
func _die():
|
||||
queue_free()
|
||||
|
|
Binary file not shown.
|
@ -5905,7 +5905,7 @@
|
|||
<description>
|
||||
Base class of anything 2D. Canvas items are laid out in a tree and children inherit and extend the transform of their parent. CanvasItem is extended by [Control], for anything GUI related, and by [Node2D] for anything 2D engine related.
|
||||
Any CanvasItem can draw. For this, the "update" function must be called, then NOTIFICATION_DRAW will be received on idle time to request redraw. Because of this, canvas items don't need to be redraw on every frame, improving the performance significan'tly. Several functions for drawing on the CanvasItem are provided (see draw_* functions). They can only be used inside the notification, signal or _draw() overrided function, though.
|
||||
Canvas items are draw in tree order. By default, children are on top of their parents so a root CanvasItem will be drawn behind everything (this can be changed per item though).
|
||||
Canvas items are draw in tree order. By default, children are on top of their parents so a root CanvasItem will be drawn behind everything (this can be changed per item though).
|
||||
Canvas items can also be hidden (hiding also their subtree). They provide many means for changing standard parameters such as opacity (for it and the subtree) and self opacity, blend mode.
|
||||
Ultimately, a transform notification can be requested, which will notify the node that its global position changed in case the parent tree changed.
|
||||
</description>
|
||||
|
@ -11556,8 +11556,11 @@
|
|||
</class>
|
||||
<class name="GraphEdit" inherits="Control" category="Core">
|
||||
<brief_description>
|
||||
GraphEdit is an area capable of showing various GraphNodes. It manages connection events between them.
|
||||
</brief_description>
|
||||
<description>
|
||||
GraphEdit manages the showing of GraphNodes it contains, as well as connections an disconnections between them. Signals are sent for each of these two events. Disconnection between GraphNodes slots is disabled by default.
|
||||
It is greatly advised to enable low processor usage mode [OS.set_low_processor_usage_mode()] when using GraphEdits.
|
||||
</description>
|
||||
<methods>
|
||||
<method name="connect_node">
|
||||
|
@ -11572,6 +11575,7 @@
|
|||
<argument index="3" name="to_port" type="int">
|
||||
</argument>
|
||||
<description>
|
||||
Create a connection between 'from_port' slot of 'from' GraphNode and 'to_port' slot of 'to' GraphNode. If the connection already exists, no connection is created.
|
||||
</description>
|
||||
</method>
|
||||
<method name="is_node_connected">
|
||||
|
@ -11586,6 +11590,7 @@
|
|||
<argument index="3" name="to_port" type="int">
|
||||
</argument>
|
||||
<description>
|
||||
Return true if the 'from_port' slot of 'from' GraphNode is connected to the 'to_port' slot of 'to' GraphNode.
|
||||
</description>
|
||||
</method>
|
||||
<method name="disconnect_node">
|
||||
|
@ -11598,24 +11603,28 @@
|
|||
<argument index="3" name="to_port" type="int">
|
||||
</argument>
|
||||
<description>
|
||||
Remove the connection between 'from_port' slot of 'from' GraphNode and 'to_port' slot of 'to' GraphNode, if connection exists.
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_connection_list" qualifiers="const">
|
||||
<return type="Array">
|
||||
</return>
|
||||
<description>
|
||||
Return an Array containing the list of connections. A connection consists in a structure of the form {from_slot: 0, from: "GraphNode name 0", to_slot: 1, to: "GraphNode name 1" }
|
||||
</description>
|
||||
</method>
|
||||
<method name="set_right_disconnects">
|
||||
<argument index="0" name="enable" type="bool">
|
||||
</argument>
|
||||
<description>
|
||||
Enable the disconnection of existing connections in the visual GraphEdit by left-clicking a connection and releasing into the void.
|
||||
</description>
|
||||
</method>
|
||||
<method name="is_right_disconnects_enabled" qualifiers="const">
|
||||
<return type="bool">
|
||||
</return>
|
||||
<description>
|
||||
Return true is the disconnection of connections is enable in the visual GraphEdit. False otherwise.
|
||||
</description>
|
||||
</method>
|
||||
</methods>
|
||||
|
@ -11630,6 +11639,7 @@
|
|||
<argument index="3" name="to_slot" type="int">
|
||||
</argument>
|
||||
<description>
|
||||
Signal sent to the GraphEdit when the connection between 'from_slot' slot of 'from' GraphNode and 'to_slot' slot of 'to' GraphNode is attempted to be removed.
|
||||
</description>
|
||||
</signal>
|
||||
<signal name="connection_request">
|
||||
|
@ -11642,6 +11652,7 @@
|
|||
<argument index="3" name="to_slot" type="int">
|
||||
</argument>
|
||||
<description>
|
||||
Signal sent to the GraphEdit when the connection between 'from_slot' slot of 'from' GraphNode and 'to_slot' slot of 'to' GraphNode is attempted to be created.
|
||||
</description>
|
||||
</signal>
|
||||
</signals>
|
||||
|
@ -11650,20 +11661,24 @@
|
|||
</class>
|
||||
<class name="GraphNode" inherits="Container" category="Core">
|
||||
<brief_description>
|
||||
A GraphNode is a container with several input and output slots allowing connections between GraphNodes. Slots can have different, incompatible types.
|
||||
</brief_description>
|
||||
<description>
|
||||
A GraphNode is a container defined by a title. It can have 1 or more input and output slots, which can be enabled (shown) or disabled (not shown) and have different (incompatible) types. Colors can also be assigned to slots. A tuple of input and output slots is defined for each GUI element included in the GraphNode. Input and output connections are left and right slots, but only enabled slots are counted as connections.
|
||||
</description>
|
||||
<methods>
|
||||
<method name="set_title">
|
||||
<argument index="0" name="title" type="String">
|
||||
</argument>
|
||||
<description>
|
||||
Set the title of the GraphNode.
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_title" qualifiers="const">
|
||||
<return type="String">
|
||||
</return>
|
||||
<description>
|
||||
Return the title of the GraphNode.
|
||||
</description>
|
||||
</method>
|
||||
<method name="set_slot">
|
||||
|
@ -11682,16 +11697,19 @@
|
|||
<argument index="6" name="color_right" type="Color">
|
||||
</argument>
|
||||
<description>
|
||||
Set the tuple of input/output slots defined by 'idx' ID. 'left' slots are input, 'right' are output. 'type' is an integer defining the type of the slot. Refer to description for the compatibility between slot types.
|
||||
</description>
|
||||
</method>
|
||||
<method name="clear_slot">
|
||||
<argument index="0" name="idx" type="int">
|
||||
</argument>
|
||||
<description>
|
||||
Disable input and ouput slot whose index is 'idx'.
|
||||
</description>
|
||||
</method>
|
||||
<method name="clear_all_slots">
|
||||
<description>
|
||||
Disable all input and output slots of the GraphNode.
|
||||
</description>
|
||||
</method>
|
||||
<method name="is_slot_enabled_left" qualifiers="const">
|
||||
|
@ -11700,6 +11718,7 @@
|
|||
<argument index="0" name="idx" type="int">
|
||||
</argument>
|
||||
<description>
|
||||
Return true if left (input) slot 'idx' is enabled. False otherwise.
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_slot_type_left" qualifiers="const">
|
||||
|
@ -11708,6 +11727,7 @@
|
|||
<argument index="0" name="idx" type="int">
|
||||
</argument>
|
||||
<description>
|
||||
Return the (integer) type of left (input) 'idx' slot.
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_slot_color_left" qualifiers="const">
|
||||
|
@ -11716,6 +11736,7 @@
|
|||
<argument index="0" name="idx" type="int">
|
||||
</argument>
|
||||
<description>
|
||||
Return the color set to 'idx' left (input) slot.
|
||||
</description>
|
||||
</method>
|
||||
<method name="is_slot_enabled_right" qualifiers="const">
|
||||
|
@ -11724,6 +11745,7 @@
|
|||
<argument index="0" name="idx" type="int">
|
||||
</argument>
|
||||
<description>
|
||||
Return true if right (output) slot 'idx' is enabled. False otherwise.
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_slot_type_right" qualifiers="const">
|
||||
|
@ -11732,6 +11754,7 @@
|
|||
<argument index="0" name="idx" type="int">
|
||||
</argument>
|
||||
<description>
|
||||
Return the (integer) type of right (output) 'idx' slot.
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_slot_color_right" qualifiers="const">
|
||||
|
@ -11740,30 +11763,35 @@
|
|||
<argument index="0" name="idx" type="int">
|
||||
</argument>
|
||||
<description>
|
||||
Return the color set to 'idx' right (output) slot.
|
||||
</description>
|
||||
</method>
|
||||
<method name="set_offset">
|
||||
<argument index="0" name="offset" type="Vector2">
|
||||
</argument>
|
||||
<description>
|
||||
Set the offset of the GraphNode.
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_offset" qualifiers="const">
|
||||
<return type="Vector2">
|
||||
</return>
|
||||
<description>
|
||||
Return the offset of the GraphNode.
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_connection_output_count">
|
||||
<return type="int">
|
||||
</return>
|
||||
<description>
|
||||
Return the number of enabled output slots (connections) of the GraphNode.
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_connection_input_count">
|
||||
<return type="int">
|
||||
</return>
|
||||
<description>
|
||||
Return the number of enabled input slots (connections) to the GraphNode.
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_connection_output_pos">
|
||||
|
@ -11772,6 +11800,7 @@
|
|||
<argument index="0" name="idx" type="int">
|
||||
</argument>
|
||||
<description>
|
||||
Return the position of the output connection 'idx'.
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_connection_output_type">
|
||||
|
@ -11780,6 +11809,7 @@
|
|||
<argument index="0" name="idx" type="int">
|
||||
</argument>
|
||||
<description>
|
||||
Return the type of the output connection 'idx'.
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_connection_output_color">
|
||||
|
@ -11788,6 +11818,7 @@
|
|||
<argument index="0" name="idx" type="int">
|
||||
</argument>
|
||||
<description>
|
||||
Return the color of the output connection 'idx'.
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_connection_input_pos">
|
||||
|
@ -11796,6 +11827,7 @@
|
|||
<argument index="0" name="idx" type="int">
|
||||
</argument>
|
||||
<description>
|
||||
Return the position of the input connection 'idx'.
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_connection_input_type">
|
||||
|
@ -11804,6 +11836,7 @@
|
|||
<argument index="0" name="idx" type="int">
|
||||
</argument>
|
||||
<description>
|
||||
Return the type of the input connection 'idx'.
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_connection_input_color">
|
||||
|
@ -11812,28 +11845,33 @@
|
|||
<argument index="0" name="idx" type="int">
|
||||
</argument>
|
||||
<description>
|
||||
Return the color of the input connection 'idx'.
|
||||
</description>
|
||||
</method>
|
||||
<method name="set_show_close_button">
|
||||
<argument index="0" name="show" type="bool">
|
||||
</argument>
|
||||
<description>
|
||||
Show the close button on the GraphNode if 'show' is true (disabled by default). If enabled, a connection on the signal close_request is needed for the close button to work.
|
||||
</description>
|
||||
</method>
|
||||
<method name="is_close_button_visible" qualifiers="const">
|
||||
<return type="bool">
|
||||
</return>
|
||||
<description>
|
||||
Returns true if the close button is shown. False otherwise.
|
||||
</description>
|
||||
</method>
|
||||
</methods>
|
||||
<signals>
|
||||
<signal name="raise_request">
|
||||
<description>
|
||||
Signal sent when the GraphNode is requested to be displayed over other ones. Happens on focusing (clicking into) the GraphNode.
|
||||
</description>
|
||||
</signal>
|
||||
<signal name="close_request">
|
||||
<description>
|
||||
Signal sent on closing the GraphNode.
|
||||
</description>
|
||||
</signal>
|
||||
<signal name="dragged">
|
||||
|
@ -11842,10 +11880,12 @@
|
|||
<argument index="1" name="to" type="Vector2">
|
||||
</argument>
|
||||
<description>
|
||||
Signal sent when the GraphNode is dragged.
|
||||
</description>
|
||||
</signal>
|
||||
<signal name="offset_changed">
|
||||
<description>
|
||||
Signal sent when the GraphNode is moved.
|
||||
</description>
|
||||
</signal>
|
||||
</signals>
|
||||
|
@ -17934,7 +17974,7 @@
|
|||
</brief_description>
|
||||
<description>
|
||||
Nodes can be set as children of other nodes, resulting in a tree arrangement. Any tree of nodes is called a "Scene".
|
||||
Scenes can be saved to disk, and then instanced into other scenes. This allows for very high flexibility in the architecture and data model of the projects.
|
||||
Scenes can be saved to disk, and then instanced into other scenes. This allows for very high flexibility in the architecture and data model of the projects.
|
||||
[SceneMainLoop] contains the "active" tree of nodes, and a node becomes active (receinving NOTIFICATION_ENTER_SCENE) when added to that tree.
|
||||
A node can contain any number of nodes as a children (but there is only one tree root) with the requirement that no two childrens with the same name can exist.
|
||||
Nodes can, optionally, be added to groups. This makes it easy to reach a number of nodes from the code (for example an "enemies" group).
|
||||
|
@ -18684,11 +18724,11 @@
|
|||
<description>
|
||||
Operating System functions. OS Wraps the most common functionality to communicate with the host Operating System, such as:
|
||||
-Mouse Grabbing
|
||||
-Mouse Cursors
|
||||
-Mouse Cursors
|
||||
-Clipboard
|
||||
-Video Mode
|
||||
-Date " Time
|
||||
-Timers
|
||||
-Timers
|
||||
-Environment Variables
|
||||
-Execution of Binaries
|
||||
-Command Line
|
||||
|
@ -27567,7 +27607,7 @@
|
|||
Rigid body 2D node.
|
||||
</brief_description>
|
||||
<description>
|
||||
Rigid body 2D node. This node is used for placing rigid bodies in the scene. It can contain a number of shapes, and also shift state between regular Rigid Body to Character or even Static.
|
||||
Rigid body 2D node. This node is used for placing rigid bodies in the scene. It can contain a number of shapes, and also shift state between regular Rigid Body to Character or even Static.
|
||||
Character mode forbids the node from being rotated. This node can have a custom force integrator function, for writing complex physics motion behavior per node.
|
||||
As a warning, don't change this node position every frame or very often. Sporadic changes work fine, but physics runs at a different granularity (fixed hz) than usual rendering (process callback) and maybe even in a separate thread, so changing this from a process loop will yield strange behavior.
|
||||
</description>
|
||||
|
@ -37719,6 +37759,18 @@
|
|||
<description>
|
||||
</description>
|
||||
</method>
|
||||
<method name="set_audio_track">
|
||||
<argument index="0" name="track" type="int">
|
||||
</argument>
|
||||
<description>
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_audio_track" qualifiers="const">
|
||||
<return type="int">
|
||||
</return>
|
||||
<description>
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_stream_name" qualifiers="const">
|
||||
<return type="String">
|
||||
</return>
|
||||
|
@ -37755,6 +37807,18 @@
|
|||
<description>
|
||||
</description>
|
||||
</method>
|
||||
<method name="set_buffering_msec">
|
||||
<argument index="0" name="msec" type="int">
|
||||
</argument>
|
||||
<description>
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_buffering_msec" qualifiers="const">
|
||||
<return type="int">
|
||||
</return>
|
||||
<description>
|
||||
</description>
|
||||
</method>
|
||||
</methods>
|
||||
<constants>
|
||||
</constants>
|
||||
|
@ -37765,30 +37829,16 @@
|
|||
<description>
|
||||
</description>
|
||||
<methods>
|
||||
<method name="get_pending_frame_count" qualifiers="const">
|
||||
<return type="int">
|
||||
</return>
|
||||
<description>
|
||||
</description>
|
||||
</method>
|
||||
<method name="pop_frame">
|
||||
<argument index="0" name="arg0" type="Object">
|
||||
</argument>
|
||||
<description>
|
||||
</description>
|
||||
</method>
|
||||
<method name="peek_frame" qualifiers="const">
|
||||
<return type="Image">
|
||||
</return>
|
||||
<description>
|
||||
</description>
|
||||
</method>
|
||||
<method name="set_audio_track">
|
||||
<argument index="0" name="idx" type="int">
|
||||
</argument>
|
||||
<description>
|
||||
</description>
|
||||
</method>
|
||||
</methods>
|
||||
<constants>
|
||||
</constants>
|
||||
</class>
|
||||
<class name="VideoStreamTheora" inherits="VideoStream" category="Core">
|
||||
<brief_description>
|
||||
</brief_description>
|
||||
<description>
|
||||
</description>
|
||||
<methods>
|
||||
</methods>
|
||||
<constants>
|
||||
</constants>
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
#ifdef __HAIKU__
|
||||
#undef GLEW_ENABLED
|
||||
#endif
|
||||
|
||||
#ifdef GLEW_ENABLED
|
||||
/*
|
||||
** The OpenGL Extension Wrangler Library
|
||||
|
|
|
@ -243,7 +243,7 @@ OS::Date OS_Unix::get_date(bool utc) const {
|
|||
lt=localtime(&t);
|
||||
Date ret;
|
||||
ret.year=1900+lt->tm_year;
|
||||
ret.month=(Month)lt->tm_mon;
|
||||
ret.month=(Month)(lt->tm_mon + 1);
|
||||
ret.day=lt->tm_mday;
|
||||
ret.weekday=(Weekday)lt->tm_wday;
|
||||
ret.dst=lt->tm_isdst;
|
||||
|
|
|
@ -13,7 +13,11 @@
|
|||
#include <stdio.h>
|
||||
|
||||
#ifndef NO_FCNTL
|
||||
#include <sys/fcntl.h>
|
||||
#ifdef __HAIKU__
|
||||
#include <fcntl.h>
|
||||
#else
|
||||
#include <sys/fcntl.h>
|
||||
#endif
|
||||
#else
|
||||
#include <sys/ioctl.h>
|
||||
#endif
|
||||
|
|
|
@ -39,7 +39,11 @@
|
|||
#include <netdb.h>
|
||||
#include <sys/types.h>
|
||||
#ifndef NO_FCNTL
|
||||
#include <sys/fcntl.h>
|
||||
#ifdef __HAIKU__
|
||||
#include <fcntl.h>
|
||||
#else
|
||||
#include <sys/fcntl.h>
|
||||
#endif
|
||||
#else
|
||||
#include <sys/ioctl.h>
|
||||
#endif
|
||||
|
|
|
@ -41,7 +41,11 @@
|
|||
#include <netdb.h>
|
||||
#include <sys/types.h>
|
||||
#ifndef NO_FCNTL
|
||||
#include <sys/fcntl.h>
|
||||
#ifdef __HAIKU__
|
||||
#include <fcntl.h>
|
||||
#else
|
||||
#include <sys/fcntl.h>
|
||||
#endif
|
||||
#else
|
||||
#include <sys/ioctl.h>
|
||||
#endif
|
||||
|
|
|
@ -29,7 +29,7 @@ extern "C" {
|
|||
#define WEBP_USE_SSE2
|
||||
#endif
|
||||
|
||||
#if defined(__ANDROID__) && defined(__ARM_ARCH_7A__)
|
||||
#if defined(__ANDROID__) && defined(__ARM_ARCH_7A__) && defined(__ARM_NEON__)
|
||||
#define WEBP_ANDROID_NEON // Android targets that might support NEON
|
||||
#endif
|
||||
|
||||
|
|
|
@ -1007,61 +1007,49 @@ bool Main::start() {
|
|||
bool export_debug=false;
|
||||
List<String> args = OS::get_singleton()->get_cmdline_args();
|
||||
for (int i=0;i<args.size();i++) {
|
||||
|
||||
|
||||
if (args[i]=="-doctool" && i <(args.size()-1)) {
|
||||
|
||||
doc_tool=args[i+1];
|
||||
//parameters that have an argument to the right
|
||||
if (i < (args.size()-1)) {
|
||||
if (args[i]=="-doctool") {
|
||||
doc_tool=args[i+1];
|
||||
} else if (args[i]=="-script" || args[i]=="-s") {
|
||||
script=args[i+1];
|
||||
} else if (args[i]=="-level" || args[i]=="-l") {
|
||||
OS::get_singleton()->_custom_level=args[i+1];
|
||||
} else if (args[i]=="-test") {
|
||||
test=args[i+1];
|
||||
} else if (args[i]=="-optimize") {
|
||||
optimize=args[i+1];
|
||||
} else if (args[i]=="-optimize_preset") {
|
||||
optimize_preset=args[i+1];
|
||||
} else if (args[i]=="-export") {
|
||||
editor=true; //needs editor
|
||||
_export_platform=args[i+1];
|
||||
} else if (args[i]=="-export_debug") {
|
||||
editor=true; //needs editor
|
||||
_export_platform=args[i+1];
|
||||
export_debug=true;
|
||||
} else if (args[i]=="-import") {
|
||||
editor=true; //needs editor
|
||||
_import=args[i+1];
|
||||
} else if (args[i]=="-import_script") {
|
||||
editor=true; //needs editor
|
||||
_import_script=args[i+1];
|
||||
} else if (args[i]=="-dumpstrings") {
|
||||
editor=true; //needs editor
|
||||
dumpstrings=args[i+1];
|
||||
}
|
||||
i++;
|
||||
}else if (args[i]=="-nodocbase") {
|
||||
|
||||
}
|
||||
//parameters that do not have an argument to the right
|
||||
if (args[i]=="-nodocbase") {
|
||||
doc_base=false;
|
||||
} else if ((args[i]=="-script" || args[i]=="-s") && i <(args.size()-1)) {
|
||||
|
||||
script=args[i+1];
|
||||
i++;
|
||||
} else if ((args[i]=="-level" || args[i]=="-l") && i <(args.size()-1)) {
|
||||
|
||||
OS::get_singleton()->_custom_level=args[i+1];
|
||||
i++;
|
||||
} else if (args[i]=="-test" && i <(args.size()-1)) {
|
||||
test=args[i+1];
|
||||
i++;
|
||||
} else if (args[i]=="-optimize" && i <(args.size()-1)) {
|
||||
optimize=args[i+1];
|
||||
i++;
|
||||
} else if (args[i]=="-optimize_preset" && i <(args.size()-1)) {
|
||||
optimize_preset=args[i+1];
|
||||
i++;
|
||||
} else if (args[i]=="-export" && i <(args.size()-1)) {
|
||||
editor=true; //needs editor
|
||||
_export_platform=args[i+1];
|
||||
i++;
|
||||
} else if (args[i]=="-export_debug" && i <(args.size()-1)) {
|
||||
editor=true; //needs editor
|
||||
_export_platform=args[i+1];
|
||||
export_debug=true;
|
||||
i++;
|
||||
} else if (args[i]=="-import" && i <(args.size()-1)) {
|
||||
editor=true; //needs editor
|
||||
_import=args[i+1];
|
||||
i++;
|
||||
} else if (args[i]=="-import_script" && i <(args.size()-1)) {
|
||||
editor=true; //needs editor
|
||||
_import_script=args[i+1];
|
||||
i++;
|
||||
} else if (args[i]=="-noquit" ) {
|
||||
} else if (args[i]=="-noquit") {
|
||||
noquit=true;
|
||||
} else if (args[i]=="-dumpstrings" && i <(args.size()-1)) {
|
||||
editor=true; //needs editor
|
||||
dumpstrings=args[i+1];
|
||||
i++;
|
||||
} else if (args[i]=="-editor" || args[i]=="-e") {
|
||||
editor=true;
|
||||
} else if (args[i]=="-convert_old") {
|
||||
convert_old=true;
|
||||
} else if (args[i]=="-editor" || args[i]=="-e") {
|
||||
editor=true;
|
||||
} else if (args[i].length() && args[i][0] != '-' && game_path == "") {
|
||||
|
||||
game_path=args[i];
|
||||
}
|
||||
}
|
||||
|
@ -1556,9 +1544,9 @@ bool Main::iteration() {
|
|||
OS::get_singleton()->delay_usec( OS::get_singleton()->get_frame_delay()*1000 );
|
||||
}
|
||||
|
||||
int taret_fps = OS::get_singleton()->get_target_fps();
|
||||
if (taret_fps>0) {
|
||||
uint64_t time_step = 1000000L/taret_fps;
|
||||
int target_fps = OS::get_singleton()->get_target_fps();
|
||||
if (target_fps>0) {
|
||||
uint64_t time_step = 1000000L/target_fps;
|
||||
target_ticks += time_step;
|
||||
uint64_t current_ticks = OS::get_singleton()->get_ticks_usec();
|
||||
if (current_ticks<target_ticks) OS::get_singleton()->delay_usec(target_ticks-current_ticks);
|
||||
|
|
|
@ -904,6 +904,15 @@ void GDFunctions::call(Function p_func,const Variant **p_args,int p_arg_count,Va
|
|||
|
||||
r_ret = gdscr->_new(NULL,0,r_error);
|
||||
|
||||
GDInstance *ins = static_cast<GDInstance*>(static_cast<Object*>(r_ret)->get_script_instance());
|
||||
Ref<GDScript> gd_ref = ins->get_script();
|
||||
|
||||
for(Map<StringName,GDScript::MemberInfo>::Element *E = gd_ref->member_indices.front(); E; E = E->next()) {
|
||||
if(d.has(E->key())) {
|
||||
ins->members[E->get().index] = d[E->key()];
|
||||
}
|
||||
}
|
||||
|
||||
} break;
|
||||
case HASH: {
|
||||
|
||||
|
|
|
@ -2421,6 +2421,16 @@ void GDParser::_parse_class(ClassNode *p_class) {
|
|||
}; //fallthrough to use the same
|
||||
case Variant::REAL: {
|
||||
|
||||
if (tokenizer->get_token()==GDTokenizer::TK_IDENTIFIER && tokenizer->get_token_identifier()=="EASE") {
|
||||
current_export.hint=PROPERTY_HINT_EXP_EASING;
|
||||
tokenizer->advance();
|
||||
if (tokenizer->get_token()!=GDTokenizer::TK_PARENTHESIS_CLOSE) {
|
||||
_set_error("Expected ')' in hint.");
|
||||
return;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
float sign=1.0;
|
||||
|
||||
if (tokenizer->get_token()==GDTokenizer::TK_OP_SUB) {
|
||||
|
@ -2571,6 +2581,17 @@ void GDParser::_parse_class(ClassNode *p_class) {
|
|||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (tokenizer->get_token()==GDTokenizer::TK_IDENTIFIER && tokenizer->get_token_identifier()=="MULTILINE") {
|
||||
|
||||
current_export.hint=PROPERTY_HINT_MULTILINE_TEXT;
|
||||
tokenizer->advance();
|
||||
if (tokenizer->get_token()!=GDTokenizer::TK_PARENTHESIS_CLOSE) {
|
||||
_set_error("Expected ')' in hint.");
|
||||
return;
|
||||
}
|
||||
break;
|
||||
}
|
||||
} break;
|
||||
case Variant::COLOR: {
|
||||
|
||||
|
@ -2607,23 +2628,16 @@ void GDParser::_parse_class(ClassNode *p_class) {
|
|||
} else if (tokenizer->get_token()==GDTokenizer::TK_IDENTIFIER) {
|
||||
|
||||
String identifier = tokenizer->get_token_identifier();
|
||||
if (identifier == "flag") {
|
||||
current_export.type=Variant::INT;
|
||||
current_export.hint=PROPERTY_HINT_ALL_FLAGS;
|
||||
}else if (identifier == "multiline"){
|
||||
current_export.type=Variant::STRING;
|
||||
current_export.hint=PROPERTY_HINT_MULTILINE_TEXT;
|
||||
} else {
|
||||
if (!ObjectTypeDB::is_type(identifier,"Resource")) {
|
||||
|
||||
current_export=PropertyInfo();
|
||||
_set_error("Export hint not a type or resource.");
|
||||
}
|
||||
|
||||
current_export.type=Variant::OBJECT;
|
||||
current_export.hint=PROPERTY_HINT_RESOURCE_TYPE;
|
||||
current_export.hint_string=identifier;
|
||||
if (!ObjectTypeDB::is_type(identifier,"Resource")) {
|
||||
|
||||
current_export=PropertyInfo();
|
||||
_set_error("Export hint not a type or resource.");
|
||||
}
|
||||
|
||||
current_export.type=Variant::OBJECT;
|
||||
current_export.hint=PROPERTY_HINT_RESOURCE_TYPE;
|
||||
current_export.hint_string=identifier;
|
||||
|
||||
tokenizer->advance();
|
||||
}
|
||||
|
||||
|
|
|
@ -220,7 +220,9 @@ void GridMapEditor::_menu_option(int p_option) {
|
|||
|
||||
|
||||
} break;
|
||||
|
||||
case MENU_OPTION_GRIDMAP_SETTINGS: {
|
||||
settings_dialog->popup_centered(settings_vbc->get_combined_minimum_size() + Size2(50, 50));
|
||||
} break;
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -304,7 +306,7 @@ bool GridMapEditor::do_input_action(Camera* p_camera,const Point2& p_point,bool
|
|||
p.d=edit_floor[edit_axis]*node->get_cell_size();
|
||||
|
||||
Vector3 inters;
|
||||
if (!p.intersects_segment(from,from+normal*500,&inters))
|
||||
if (!p.intersects_segment(from, from + normal * settings_pick_distance->get_val(), &inters))
|
||||
return false;
|
||||
|
||||
|
||||
|
@ -1249,6 +1251,24 @@ GridMapEditor::GridMapEditor(EditorNode *p_editor) {
|
|||
//options->get_popup()->add_separator();
|
||||
//options->get_popup()->add_item("Configure",MENU_OPTION_CONFIGURE);
|
||||
|
||||
options->get_popup()->add_separator();
|
||||
options->get_popup()->add_item("Settings", MENU_OPTION_GRIDMAP_SETTINGS);
|
||||
|
||||
settings_dialog = memnew(ConfirmationDialog);
|
||||
settings_dialog->set_title("GridMap Settings");
|
||||
add_child(settings_dialog);
|
||||
settings_vbc = memnew(VBoxContainer);
|
||||
settings_vbc->set_custom_minimum_size(Size2(200, 0));
|
||||
settings_dialog->add_child(settings_vbc);
|
||||
settings_dialog->set_child_rect(settings_vbc);
|
||||
|
||||
settings_pick_distance = memnew(SpinBox);
|
||||
settings_pick_distance->set_max(10000.0f);
|
||||
settings_pick_distance->set_min(500.0f);
|
||||
settings_pick_distance->set_step(1.0f);
|
||||
settings_pick_distance->set_val(EDITOR_DEF("gridmap_editor/pick_distance", 5000.0));
|
||||
settings_vbc->add_margin_child("Pick Distance:", settings_pick_distance);
|
||||
|
||||
clip_mode=CLIP_DISABLED;
|
||||
options->get_popup()->connect("item_pressed", this,"_menu_option");
|
||||
|
||||
|
|
|
@ -78,6 +78,9 @@ class GridMapEditor : public VBoxContainer {
|
|||
ToolButton *mode_thumbnail;
|
||||
ToolButton *mode_list;
|
||||
HBoxContainer *spatial_editor_hb;
|
||||
ConfirmationDialog *settings_dialog;
|
||||
VBoxContainer *settings_vbc;
|
||||
SpinBox *settings_pick_distance;
|
||||
|
||||
struct SetItem {
|
||||
|
||||
|
@ -165,8 +168,8 @@ class GridMapEditor : public VBoxContainer {
|
|||
MENU_OPTION_SELECTION_MAKE_AREA,
|
||||
MENU_OPTION_SELECTION_MAKE_EXTERIOR_CONNECTOR,
|
||||
MENU_OPTION_SELECTION_CLEAR,
|
||||
MENU_OPTION_REMOVE_AREA
|
||||
|
||||
MENU_OPTION_REMOVE_AREA,
|
||||
MENU_OPTION_GRIDMAP_SETTINGS
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -236,13 +236,12 @@ void AudioDriverOpenSL::start(){
|
|||
|
||||
ERR_FAIL_COND( res !=SL_RESULT_SUCCESS );
|
||||
/* Initialize arrays required[] and iidArray[] */
|
||||
int i;
|
||||
SLboolean required[MAX_NUMBER_INTERFACES];
|
||||
SLInterfaceID iidArray[MAX_NUMBER_INTERFACES];
|
||||
|
||||
#if 0
|
||||
|
||||
for (i=0; i<MAX_NUMBER_INTERFACES; i++)
|
||||
for (int i=0; i<MAX_NUMBER_INTERFACES; i++)
|
||||
{
|
||||
required[i] = SL_BOOLEAN_FALSE;
|
||||
iidArray[i] = SL_IID_NULL;
|
||||
|
|
|
@ -127,7 +127,7 @@ static __inline__ void x86_cpuid(int func, int values[4])
|
|||
static int
|
||||
get_file_size(const char* pathname)
|
||||
{
|
||||
int fd, ret, result = 0;
|
||||
int fd, result = 0;
|
||||
char buffer[256];
|
||||
|
||||
fd = open(pathname, O_RDONLY);
|
||||
|
|
|
@ -20,15 +20,14 @@ def can_build():
|
|||
def get_opts():
|
||||
|
||||
return [
|
||||
('ANDROID_NDK_ROOT', 'the path to Android NDK', os.environ.get("ANDROID_NDK_ROOT", 0)),
|
||||
('NDK_TOOLCHAIN', 'toolchain to use for the NDK',"arm-eabi-4.4.0"),
|
||||
#android 2.3
|
||||
('ndk_platform', 'compile for platform: (2.2,2.3)',"2.2"),
|
||||
('NDK_TARGET', 'toolchain to use for the NDK',"arm-linux-androideabi-4.8"),
|
||||
('android_stl','enable STL support in android port (for modules)','no'),
|
||||
('armv6','compile for older phones running arm v6 (instead of v7+neon+smp)','no'),
|
||||
('x86','Xompile for Android-x86','no')
|
||||
|
||||
('ANDROID_NDK_ROOT', 'the path to Android NDK', os.environ.get("ANDROID_NDK_ROOT", 0)),
|
||||
('NDK_TOOLCHAIN', 'toolchain to use for the NDK',"arm-eabi-4.4.0"),
|
||||
('NDK_TARGET', 'toolchain to use for the NDK',"arm-linux-androideabi-4.8"),
|
||||
('NDK_TARGET_X86', 'toolchain to use for the NDK x86',"x86-4.8"),
|
||||
('ndk_platform', 'compile for platform: (android-<api> , example: android-15)',"android-15"),
|
||||
('android_arch', 'select compiler architecture: (armv7/armv6/x86)',"armv7"),
|
||||
('android_neon','enable neon (armv7 only)',"yes"),
|
||||
('android_stl','enable STL support in android port (for modules)',"no")
|
||||
]
|
||||
|
||||
def get_flags():
|
||||
|
@ -92,8 +91,13 @@ def configure(env):
|
|||
|
||||
env['SPAWN'] = mySpawn
|
||||
|
||||
if env['x86']=='yes':
|
||||
env['NDK_TARGET']='x86-4.8'
|
||||
ndk_platform=env['ndk_platform']
|
||||
|
||||
if env['android_arch'] not in ['armv7','armv6','x86']:
|
||||
env['android_arch']='armv7'
|
||||
|
||||
if env['android_arch']=='x86':
|
||||
env['NDK_TARGET']=env['NDK_TARGET_X86']
|
||||
|
||||
if env['PLATFORM'] == 'win32':
|
||||
import methods
|
||||
|
@ -101,22 +105,28 @@ def configure(env):
|
|||
#env['SPAWN'] = methods.win32_spawn
|
||||
env['SHLIBSUFFIX'] = '.so'
|
||||
|
||||
# env.android_source_modules.append("../libs/apk_expansion")
|
||||
#env.android_source_modules.append("../libs/apk_expansion")
|
||||
env.android_source_modules.append("../libs/google_play_services")
|
||||
env.android_source_modules.append("../libs/downloader_library")
|
||||
env.android_source_modules.append("../libs/play_licensing")
|
||||
|
||||
ndk_platform=""
|
||||
|
||||
ndk_platform="android-15"
|
||||
|
||||
print("Godot Android!!!!!")
|
||||
neon_text=""
|
||||
if env["android_arch"]=="armv7" and env['android_neon']=='yes':
|
||||
neon_text=" (with neon)"
|
||||
print("Godot Android!!!!! ("+env['android_arch']+")"+neon_text)
|
||||
|
||||
env.Append(CPPPATH=['#platform/android'])
|
||||
|
||||
if env['x86']=='yes':
|
||||
env.extra_suffix=".x86"
|
||||
|
||||
if env['android_arch']=='x86':
|
||||
env.extra_suffix=".x86"+env.extra_suffix
|
||||
elif env['android_arch']=='armv6':
|
||||
env.extra_suffix=".armv6"+env.extra_suffix
|
||||
elif env["android_arch"]=="armv7":
|
||||
if env['android_neon']=='yes':
|
||||
env.extra_suffix=".armv7.neon"+env.extra_suffix
|
||||
else:
|
||||
env.extra_suffix=".armv7"+env.extra_suffix
|
||||
|
||||
gcc_path=env["ANDROID_NDK_ROOT"]+"/toolchains/"+env["NDK_TARGET"]+"/prebuilt/";
|
||||
|
||||
import os
|
||||
|
@ -134,7 +144,7 @@ def configure(env):
|
|||
|
||||
|
||||
env['ENV']['PATH'] = gcc_path+":"+env['ENV']['PATH']
|
||||
if env['x86']=='yes':
|
||||
if env['android_arch']=='x86':
|
||||
env['CC'] = gcc_path+'/i686-linux-android-gcc'
|
||||
env['CXX'] = gcc_path+'/i686-linux-android-g++'
|
||||
env['AR'] = gcc_path+"/i686-linux-android-ar"
|
||||
|
@ -147,7 +157,7 @@ def configure(env):
|
|||
env['RANLIB'] = gcc_path+"/arm-linux-androideabi-ranlib"
|
||||
env['AS'] = gcc_path+"/arm-linux-androideabi-as"
|
||||
|
||||
if env['x86']=='yes':
|
||||
if env['android_arch']=='x86':
|
||||
env['ARCH'] = 'arch-x86'
|
||||
else:
|
||||
env['ARCH'] = 'arch-arm'
|
||||
|
@ -161,12 +171,18 @@ def configure(env):
|
|||
env.Append(CPPPATH=[gcc_include])
|
||||
# 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':
|
||||
env['neon_enabled']=False
|
||||
if env['android_arch']=='x86':
|
||||
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')
|
||||
elif env["armv6"]!="no":
|
||||
elif env["android_arch"]=="armv6":
|
||||
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')
|
||||
else:
|
||||
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')
|
||||
elif env["android_arch"]=="armv7":
|
||||
env['CCFLAGS'] = string.split('-DNO_STATVFS -MMD -MP -MF -fpic -ffunction-sections -funwind-tables -fstack-protector -fvisibility=hidden -D__ARM_ARCH_7__ -D__ARM_ARCH_7A__ -D__GLIBC__ -Wno-psabi -march=armv7-a -mfloat-abi=softfp -ftree-vectorize -funsafe-math-optimizations -fno-strict-aliasing -DANDROID -Wa,--noexecstack -DGLES2_ENABLED')
|
||||
if env['android_neon']=='yes':
|
||||
env['neon_enabled']=True
|
||||
env.Append(CCFLAGS=['-mfpu=neon','-D__ARM_NEON__'])
|
||||
else:
|
||||
env.Append(CCFLAGS=['-mfpu=vfpv3-d16'])
|
||||
|
||||
env.Append(LDPATH=[ld_path])
|
||||
env.Append(LIBS=['OpenSLES'])
|
||||
|
@ -190,9 +206,6 @@ def configure(env):
|
|||
env.Append(CCFLAGS=['-D_DEBUG', '-g1', '-Wall', '-O0', '-DDEBUG_ENABLED'])
|
||||
env.Append(CPPFLAGS=['-DDEBUG_MEMORY_ALLOC'])
|
||||
|
||||
if env["armv6"] == "no" and env['x86'] != 'yes':
|
||||
env['neon_enabled']=True
|
||||
|
||||
env.Append(CPPFLAGS=['-DANDROID_ENABLED', '-DUNIX_ENABLED', '-DNO_FCNTL','-DMPC_FIXED_POINT'])
|
||||
# env.Append(CPPFLAGS=['-DANDROID_ENABLED', '-DUNIX_ENABLED','-DMPC_FIXED_POINT'])
|
||||
|
||||
|
@ -202,9 +215,17 @@ def configure(env):
|
|||
|
||||
if (env['android_stl']=='yes'):
|
||||
#env.Append(CCFLAGS=[env["ANDROID_NDK_ROOT"]+"/sources/cxx-stl/system/include"])
|
||||
env.Append(CPPPATH=[env["ANDROID_NDK_ROOT"]+"/sources/cxx-stl/gnu-libstdc++/4.4.3/include"])
|
||||
env.Append(CPPPATH=[env["ANDROID_NDK_ROOT"]+"/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi/include"])
|
||||
env.Append(LIBPATH=[env["ANDROID_NDK_ROOT"]+"/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi"])
|
||||
env.Append(CPPPATH=[env["ANDROID_NDK_ROOT"]+"/sources/cxx-stl/gnu-libstdc++/4.8/include"])
|
||||
if env['android_arch']=='x86':
|
||||
env.Append(CPPPATH=[env["ANDROID_NDK_ROOT"]+"/sources/cxx-stl/gnu-libstdc++/4.8/libs/x86/include"])
|
||||
env.Append(LIBPATH=[env["ANDROID_NDK_ROOT"]+"/sources/cxx-stl/gnu-libstdc++/4.8/libs/x86"])
|
||||
elif env['android_arch']=='armv6':
|
||||
env.Append(CPPPATH=[env["ANDROID_NDK_ROOT"]+"/sources/cxx-stl/gnu-libstdc++/4.8/libs/armeabi/include"])
|
||||
env.Append(LIBPATH=[env["ANDROID_NDK_ROOT"]+"/sources/cxx-stl/gnu-libstdc++/4.8/libs/armeabi"])
|
||||
elif env["android_arch"]=="armv7":
|
||||
env.Append(CPPPATH=[env["ANDROID_NDK_ROOT"]+"/sources/cxx-stl/gnu-libstdc++/4.8/libs/armeabi-v7a/include"])
|
||||
env.Append(LIBPATH=[env["ANDROID_NDK_ROOT"]+"/sources/cxx-stl/gnu-libstdc++/4.8/libs/armeabi-v7a"])
|
||||
|
||||
env.Append(LIBS=["gnustl_static","supc++"])
|
||||
env.Append(CPPPATH=[env["ANDROID_NDK_ROOT"]+"/sources/cpufeatures"])
|
||||
|
||||
|
@ -215,10 +236,12 @@ def configure(env):
|
|||
|
||||
env.Append(CPPPATH=[env["ANDROID_NDK_ROOT"]+"/sources/cxx-stl/gabi++/include"])
|
||||
env.Append(CPPPATH=[env["ANDROID_NDK_ROOT"]+"/sources/cpufeatures"])
|
||||
if env['x86']=='yes':
|
||||
if env['android_arch']=='x86':
|
||||
env.Append(LIBPATH=[env["ANDROID_NDK_ROOT"]+"/sources/cxx-stl/gabi++/libs/x86"])
|
||||
else:
|
||||
elif env["android_arch"]=="armv6":
|
||||
env.Append(LIBPATH=[env["ANDROID_NDK_ROOT"]+"/sources/cxx-stl/gabi++/libs/armeabi"])
|
||||
elif env["android_arch"]=="armv7":
|
||||
env.Append(LIBPATH=[env["ANDROID_NDK_ROOT"]+"/sources/cxx-stl/gabi++/libs/armeabi-v7a"])
|
||||
env.Append(LIBS=['gabi++_static'])
|
||||
env.Append(CCFLAGS=["-fno-exceptions",'-DNO_SAFE_CAST'])
|
||||
|
||||
|
|
|
@ -47,8 +47,10 @@ public class PaymentsManager {
|
|||
}
|
||||
|
||||
public PaymentsManager initService(){
|
||||
Intent intent = new Intent("com.android.vending.billing.InAppBillingService.BIND");
|
||||
intent.setPackage("com.android.vending");
|
||||
activity.bindService(
|
||||
new Intent("com.android.vending.billing.InAppBillingService.BIND"),
|
||||
intent,
|
||||
mServiceConn,
|
||||
Context.BIND_AUTO_CREATE);
|
||||
return this;
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
/** Automatically generated file. DO NOT MODIFY */
|
||||
package com.android.vending.expansion.downloader;
|
||||
|
||||
public final class BuildConfig {
|
||||
public final static boolean DEBUG = false;
|
||||
}
|
|
@ -1,73 +0,0 @@
|
|||
/* AUTO-GENERATED FILE. DO NOT MODIFY.
|
||||
*
|
||||
* This class was automatically generated by the
|
||||
* aapt tool from the resource data it found. It
|
||||
* should not be modified by hand.
|
||||
*/
|
||||
|
||||
package com.android.vending.expansion.downloader;
|
||||
|
||||
public final class R {
|
||||
public static final class attr {
|
||||
}
|
||||
public static final class drawable {
|
||||
public static int notify_panel_notification_icon_bg=0x7f020000;
|
||||
}
|
||||
public static final class id {
|
||||
public static int appIcon=0x7f060001;
|
||||
public static int description=0x7f060007;
|
||||
public static int notificationLayout=0x7f060000;
|
||||
public static int progress_bar=0x7f060006;
|
||||
public static int progress_bar_frame=0x7f060005;
|
||||
public static int progress_text=0x7f060002;
|
||||
public static int time_remaining=0x7f060004;
|
||||
public static int title=0x7f060003;
|
||||
}
|
||||
public static final class layout {
|
||||
public static int status_bar_ongoing_event_progress_bar=0x7f030000;
|
||||
}
|
||||
public static final class string {
|
||||
public static int kilobytes_per_second=0x7f040014;
|
||||
/** When a download completes, a notification is displayed, and this
|
||||
string is used to indicate that the download successfully completed.
|
||||
Note that such a download could have been initiated by a variety of
|
||||
applications, including (but not limited to) the browser, an email
|
||||
application, a content marketplace.
|
||||
*/
|
||||
public static int notification_download_complete=0x7f040000;
|
||||
/** When a download completes, a notification is displayed, and this
|
||||
string is used to indicate that the download failed.
|
||||
Note that such a download could have been initiated by a variety of
|
||||
applications, including (but not limited to) the browser, an email
|
||||
application, a content marketplace.
|
||||
*/
|
||||
public static int notification_download_failed=0x7f040001;
|
||||
public static int state_completed=0x7f040007;
|
||||
public static int state_connecting=0x7f040005;
|
||||
public static int state_downloading=0x7f040006;
|
||||
public static int state_failed=0x7f040013;
|
||||
public static int state_failed_cancelled=0x7f040012;
|
||||
public static int state_failed_fetching_url=0x7f040010;
|
||||
public static int state_failed_sdcard_full=0x7f040011;
|
||||
public static int state_failed_unlicensed=0x7f04000f;
|
||||
public static int state_fetching_url=0x7f040004;
|
||||
public static int state_idle=0x7f040003;
|
||||
public static int state_paused_by_request=0x7f04000a;
|
||||
public static int state_paused_network_setup_failure=0x7f040009;
|
||||
public static int state_paused_network_unavailable=0x7f040008;
|
||||
public static int state_paused_roaming=0x7f04000d;
|
||||
public static int state_paused_sdcard_unavailable=0x7f04000e;
|
||||
public static int state_paused_wifi_disabled=0x7f04000c;
|
||||
public static int state_paused_wifi_unavailable=0x7f04000b;
|
||||
public static int state_unknown=0x7f040002;
|
||||
public static int time_remaining=0x7f040015;
|
||||
public static int time_remaining_notification=0x7f040016;
|
||||
}
|
||||
public static final class style {
|
||||
public static int ButtonBackground=0x7f050003;
|
||||
public static int NotificationText=0x7f050000;
|
||||
public static int NotificationTextSecondary=0x7f050004;
|
||||
public static int NotificationTextShadow=0x7f050001;
|
||||
public static int NotificationTitle=0x7f050002;
|
||||
}
|
||||
}
|
|
@ -53,7 +53,6 @@ Error AudioDriverBB10::init(const char* p_name) {
|
|||
dev_name = (char *) p_name;
|
||||
}
|
||||
printf("******** reconnecting to device %s\n", dev_name);
|
||||
int card, dev;
|
||||
int ret = snd_pcm_open_name(&pcm_handle, dev_name, SND_PCM_OPEN_PLAYBACK);
|
||||
ERR_FAIL_COND_V(ret < 0, FAILED);
|
||||
pcm_open = true;
|
||||
|
|
|
@ -577,7 +577,7 @@ class RasterizerFlash : public Rasterizer {
|
|||
}
|
||||
} else {
|
||||
|
||||
return B->material->shader_cache < B->material->shader_cache;
|
||||
return A->material->shader_cache < B->material->shader_cache;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
Import('env')
|
||||
|
||||
common_haiku = [
|
||||
'os_haiku.cpp',
|
||||
'context_gl_haiku.cpp',
|
||||
'haiku_application.cpp',
|
||||
'haiku_direct_window.cpp',
|
||||
'haiku_gl_view.cpp',
|
||||
'key_mapping_haiku.cpp',
|
||||
'audio_driver_media_kit.cpp'
|
||||
]
|
||||
|
||||
env.Program(
|
||||
'#bin/godot',
|
||||
['godot_haiku.cpp'] + common_haiku
|
||||
)
|
|
@ -0,0 +1,143 @@
|
|||
/*************************************************************************/
|
||||
/* audio_driver_media_kit.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 "audio_driver_media_kit.h"
|
||||
|
||||
#ifdef MEDIA_KIT_ENABLED
|
||||
|
||||
#include "globals.h"
|
||||
|
||||
int32_t* AudioDriverMediaKit::samples_in = NULL;
|
||||
|
||||
Error AudioDriverMediaKit::init() {
|
||||
active = false;
|
||||
|
||||
mix_rate = 44100;
|
||||
output_format = OUTPUT_STEREO;
|
||||
channels = 2;
|
||||
|
||||
int latency = GLOBAL_DEF("audio/output_latency", 25);
|
||||
buffer_size = nearest_power_of_2(latency * mix_rate / 1000);
|
||||
samples_in = memnew_arr(int32_t, buffer_size * channels);
|
||||
|
||||
media_raw_audio_format format;
|
||||
format = media_raw_audio_format::wildcard;
|
||||
format.frame_rate = mix_rate;
|
||||
format.channel_count = channels;
|
||||
format.format = media_raw_audio_format::B_AUDIO_INT;
|
||||
format.byte_order = B_MEDIA_LITTLE_ENDIAN;
|
||||
format.buffer_size = buffer_size * sizeof(int32_t) * channels;
|
||||
|
||||
player = new BSoundPlayer(
|
||||
&format,
|
||||
"godot_sound_server",
|
||||
AudioDriverMediaKit::PlayBuffer,
|
||||
NULL,
|
||||
this
|
||||
);
|
||||
|
||||
if (player->InitCheck() != B_OK) {
|
||||
fprintf(stderr, "MediaKit ERR: can not create a BSoundPlayer instance\n");
|
||||
ERR_FAIL_COND_V(player == NULL, ERR_CANT_OPEN);
|
||||
}
|
||||
|
||||
mutex = Mutex::create();
|
||||
player->Start();
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
void AudioDriverMediaKit::PlayBuffer(void* cookie, void* buffer, size_t size, const media_raw_audio_format& format) {
|
||||
AudioDriverMediaKit* ad = (AudioDriverMediaKit*) cookie;
|
||||
int32_t* buf = (int32_t*) buffer;
|
||||
|
||||
if (!ad->active) {
|
||||
for (unsigned int i = 0; i < ad->buffer_size * ad->channels; i++) {
|
||||
AudioDriverMediaKit::samples_in[i] = 0;
|
||||
}
|
||||
} else {
|
||||
ad->lock();
|
||||
ad->audio_server_process(ad->buffer_size, AudioDriverMediaKit::samples_in);
|
||||
ad->unlock();
|
||||
}
|
||||
|
||||
for (unsigned int i = 0; i < ad->buffer_size * ad->channels; i++) {
|
||||
buf[i] = AudioDriverMediaKit::samples_in[i];
|
||||
}
|
||||
}
|
||||
|
||||
void AudioDriverMediaKit::start() {
|
||||
active = true;
|
||||
}
|
||||
|
||||
int AudioDriverMediaKit::get_mix_rate() const {
|
||||
return mix_rate;
|
||||
}
|
||||
|
||||
AudioDriverSW::OutputFormat AudioDriverMediaKit::get_output_format() const {
|
||||
return output_format;
|
||||
}
|
||||
|
||||
void AudioDriverMediaKit::lock() {
|
||||
if (!mutex)
|
||||
return;
|
||||
|
||||
mutex->lock();
|
||||
}
|
||||
|
||||
void AudioDriverMediaKit::unlock() {
|
||||
if (!mutex)
|
||||
return;
|
||||
|
||||
mutex->unlock();
|
||||
}
|
||||
|
||||
void AudioDriverMediaKit::finish() {
|
||||
if (player)
|
||||
delete player;
|
||||
|
||||
if (samples_in) {
|
||||
memdelete_arr(samples_in);
|
||||
};
|
||||
|
||||
if (mutex) {
|
||||
memdelete(mutex);
|
||||
mutex = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
AudioDriverMediaKit::AudioDriverMediaKit() {
|
||||
mutex = NULL;
|
||||
player = NULL;
|
||||
}
|
||||
|
||||
AudioDriverMediaKit::~AudioDriverMediaKit() {
|
||||
|
||||
}
|
||||
|
||||
#endif
|
|
@ -0,0 +1,72 @@
|
|||
/*************************************************************************/
|
||||
/* audio_driver_media_kit.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. */
|
||||
/*************************************************************************/
|
||||
#include "servers/audio/audio_server_sw.h"
|
||||
|
||||
#ifdef MEDIA_KIT_ENABLED
|
||||
|
||||
#include "core/os/thread.h"
|
||||
#include "core/os/mutex.h"
|
||||
|
||||
#include <kernel/image.h> // needed for image_id
|
||||
#include <SoundPlayer.h>
|
||||
|
||||
class AudioDriverMediaKit : public AudioDriverSW {
|
||||
Mutex* mutex;
|
||||
|
||||
BSoundPlayer* player;
|
||||
static int32_t* samples_in;
|
||||
|
||||
static void PlayBuffer(void* cookie, void* buffer, size_t size, const media_raw_audio_format& format);
|
||||
|
||||
unsigned int mix_rate;
|
||||
OutputFormat output_format;
|
||||
unsigned int buffer_size;
|
||||
int channels;
|
||||
|
||||
bool active;
|
||||
|
||||
public:
|
||||
|
||||
const char* get_name() const {
|
||||
return "MediaKit";
|
||||
};
|
||||
|
||||
virtual Error init();
|
||||
virtual void start();
|
||||
virtual int get_mix_rate() const;
|
||||
virtual OutputFormat get_output_format() const;
|
||||
virtual void lock();
|
||||
virtual void unlock();
|
||||
virtual void finish();
|
||||
|
||||
AudioDriverMediaKit();
|
||||
~AudioDriverMediaKit();
|
||||
};
|
||||
|
||||
#endif
|
|
@ -0,0 +1,43 @@
|
|||
#include "context_gl_haiku.h"
|
||||
|
||||
#if defined(OPENGL_ENABLED) || defined(LEGACYGL_ENABLED)
|
||||
|
||||
ContextGL_Haiku::ContextGL_Haiku(HaikuDirectWindow* p_window) {
|
||||
window = p_window;
|
||||
|
||||
uint32 type = BGL_RGB | BGL_DOUBLE | BGL_DEPTH;
|
||||
view = new HaikuGLView(window->Bounds(), type);
|
||||
}
|
||||
|
||||
ContextGL_Haiku::~ContextGL_Haiku() {
|
||||
delete view;
|
||||
}
|
||||
|
||||
Error ContextGL_Haiku::initialize() {
|
||||
window->AddChild(view);
|
||||
window->SetHaikuGLView(view);
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
void ContextGL_Haiku::release_current() {
|
||||
view->UnlockGL();
|
||||
}
|
||||
|
||||
void ContextGL_Haiku::make_current() {
|
||||
view->LockGL();
|
||||
}
|
||||
|
||||
void ContextGL_Haiku::swap_buffers() {
|
||||
view->SwapBuffers();
|
||||
}
|
||||
|
||||
int ContextGL_Haiku::get_window_width() {
|
||||
return window->Bounds().IntegerWidth();
|
||||
}
|
||||
|
||||
int ContextGL_Haiku::get_window_height() {
|
||||
return window->Bounds().IntegerHeight();
|
||||
}
|
||||
|
||||
#endif
|
|
@ -0,0 +1,29 @@
|
|||
#ifndef CONTEXT_GL_HAIKU_H
|
||||
#define CONTEXT_GL_HAIKU_H
|
||||
|
||||
#if defined(OPENGL_ENABLED) || defined(LEGACYGL_ENABLED)
|
||||
|
||||
#include "drivers/gl_context/context_gl.h"
|
||||
|
||||
#include "haiku_direct_window.h"
|
||||
#include "haiku_gl_view.h"
|
||||
|
||||
class ContextGL_Haiku : public ContextGL {
|
||||
private:
|
||||
HaikuGLView* view;
|
||||
HaikuDirectWindow* window;
|
||||
|
||||
public:
|
||||
ContextGL_Haiku(HaikuDirectWindow* p_window);
|
||||
~ContextGL_Haiku();
|
||||
|
||||
virtual Error initialize();
|
||||
virtual void release_current();
|
||||
virtual void make_current();
|
||||
virtual void swap_buffers();
|
||||
virtual int get_window_width();
|
||||
virtual int get_window_height();
|
||||
};
|
||||
|
||||
#endif
|
||||
#endif
|
|
@ -0,0 +1,61 @@
|
|||
import os
|
||||
import sys
|
||||
|
||||
def is_active():
|
||||
return True
|
||||
|
||||
def get_name():
|
||||
return "Haiku"
|
||||
|
||||
def can_build():
|
||||
if (os.name != "posix"):
|
||||
return False
|
||||
|
||||
if (sys.platform == "darwin"):
|
||||
return False
|
||||
|
||||
return True
|
||||
|
||||
def get_opts():
|
||||
return [
|
||||
('debug_release', 'Add debug symbols to release version','no')
|
||||
]
|
||||
|
||||
def get_flags():
|
||||
return [
|
||||
('builtin_zlib', 'no')
|
||||
]
|
||||
|
||||
def configure(env):
|
||||
is64 = sys.maxsize > 2**32
|
||||
|
||||
if (env["bits"]=="default"):
|
||||
if (is64):
|
||||
env["bits"]="64"
|
||||
else:
|
||||
env["bits"]="32"
|
||||
|
||||
env.Append(CPPPATH = ['#platform/haiku'])
|
||||
|
||||
env["CC"] = "gcc"
|
||||
env["CXX"] = "g++"
|
||||
|
||||
if (env["target"]=="release"):
|
||||
if (env["debug_release"]=="yes"):
|
||||
env.Append(CCFLAGS=['-g2'])
|
||||
else:
|
||||
env.Append(CCFLAGS=['-O3','-ffast-math'])
|
||||
elif (env["target"]=="release_debug"):
|
||||
env.Append(CCFLAGS=['-O2','-ffast-math','-DDEBUG_ENABLED'])
|
||||
elif (env["target"]=="debug"):
|
||||
env.Append(CCFLAGS=['-g2', '-Wall','-DDEBUG_ENABLED','-DDEBUG_MEMORY_ENABLED'])
|
||||
|
||||
#env.Append(CCFLAGS=['-DFREETYPE_ENABLED'])
|
||||
env.Append(CPPFLAGS = ['-DGLEW_ENABLED', '-DOPENGL_ENABLED', '-DMEDIA_KIT_ENABLED'])
|
||||
env.Append(CPPFLAGS = ['-DUNIX_ENABLED', '-DGLES2_ENABLED', '-DGLES_OVER_GL'])
|
||||
env.Append(LIBS = ['be', 'game', 'media', 'network', 'bnetapi', 'z', 'GL', 'GLEW'])
|
||||
|
||||
import methods
|
||||
env.Append(BUILDERS = {'GLSL120' : env.Builder(action = methods.build_legacygl_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')})
|
|
@ -0,0 +1,19 @@
|
|||
#include "main/main.h"
|
||||
#include "os_haiku.h"
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
OS_Haiku os;
|
||||
|
||||
Error error = Main::setup(argv[0], argc-1, &argv[1]);
|
||||
if (error != OK) {
|
||||
return 255;
|
||||
}
|
||||
|
||||
if (Main::start()) {
|
||||
os.run();
|
||||
}
|
||||
|
||||
Main::cleanup();
|
||||
|
||||
return os.get_exit_code();
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
#include "haiku_application.h"
|
||||
|
||||
HaikuApplication::HaikuApplication()
|
||||
: BApplication("application/x-vnd.Godot")
|
||||
{
|
||||
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
#ifndef HAIKU_APPLICATION_H
|
||||
#define HAIKU_APPLICATION_H
|
||||
|
||||
#include <kernel/image.h> // needed for image_id
|
||||
#include <Application.h>
|
||||
|
||||
class HaikuApplication : public BApplication
|
||||
{
|
||||
public:
|
||||
HaikuApplication();
|
||||
};
|
||||
|
||||
#endif
|
|
@ -0,0 +1,344 @@
|
|||
#include <UnicodeChar.h>
|
||||
|
||||
#include "main/main.h"
|
||||
#include "os/keyboard.h"
|
||||
#include "haiku_direct_window.h"
|
||||
#include "key_mapping_haiku.h"
|
||||
|
||||
HaikuDirectWindow::HaikuDirectWindow(BRect p_frame)
|
||||
: BDirectWindow(p_frame, "Godot", B_TITLED_WINDOW, B_QUIT_ON_WINDOW_CLOSE)
|
||||
{
|
||||
last_mouse_pos_valid = false;
|
||||
last_buttons_state = 0;
|
||||
last_button_mask = 0;
|
||||
last_key_modifier_state = 0;
|
||||
}
|
||||
|
||||
|
||||
HaikuDirectWindow::~HaikuDirectWindow() {
|
||||
if (update_runner) {
|
||||
delete update_runner;
|
||||
}
|
||||
}
|
||||
|
||||
void HaikuDirectWindow::SetHaikuGLView(HaikuGLView* p_view) {
|
||||
view = p_view;
|
||||
}
|
||||
|
||||
void HaikuDirectWindow::StartMessageRunner() {
|
||||
update_runner = new BMessageRunner(BMessenger(this),
|
||||
new BMessage(REDRAW_MSG), 1000000/30 /* 30 fps */);
|
||||
}
|
||||
|
||||
void HaikuDirectWindow::StopMessageRunner() {
|
||||
delete update_runner;
|
||||
}
|
||||
|
||||
void HaikuDirectWindow::SetInput(InputDefault* p_input) {
|
||||
input = p_input;
|
||||
}
|
||||
|
||||
void HaikuDirectWindow::SetMainLoop(MainLoop* p_main_loop) {
|
||||
main_loop = p_main_loop;
|
||||
}
|
||||
|
||||
bool HaikuDirectWindow::QuitRequested() {
|
||||
main_loop->notification(MainLoop::NOTIFICATION_WM_QUIT_REQUEST);
|
||||
return false;
|
||||
}
|
||||
|
||||
void HaikuDirectWindow::DirectConnected(direct_buffer_info* info) {
|
||||
view->DirectConnected(info);
|
||||
view->EnableDirectMode(true);
|
||||
}
|
||||
|
||||
void HaikuDirectWindow::MessageReceived(BMessage* message) {
|
||||
switch (message->what) {
|
||||
case REDRAW_MSG:
|
||||
if (Main::iteration() == true) {
|
||||
view->EnableDirectMode(false);
|
||||
Quit();
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
BDirectWindow::MessageReceived(message);
|
||||
}
|
||||
}
|
||||
|
||||
void HaikuDirectWindow::DispatchMessage(BMessage* message, BHandler* handler) {
|
||||
switch (message->what) {
|
||||
case B_MOUSE_DOWN:
|
||||
case B_MOUSE_UP:
|
||||
HandleMouseButton(message);
|
||||
break;
|
||||
|
||||
case B_MOUSE_MOVED:
|
||||
HandleMouseMoved(message);
|
||||
break;
|
||||
|
||||
case B_MOUSE_WHEEL_CHANGED:
|
||||
HandleMouseWheelChanged(message);
|
||||
break;
|
||||
|
||||
case B_KEY_DOWN:
|
||||
case B_KEY_UP:
|
||||
HandleKeyboardEvent(message);
|
||||
break;
|
||||
|
||||
case B_MODIFIERS_CHANGED:
|
||||
HandleKeyboardModifierEvent(message);
|
||||
break;
|
||||
|
||||
case B_WINDOW_RESIZED:
|
||||
HandleWindowResized(message);
|
||||
break;
|
||||
|
||||
case LOCKGL_MSG:
|
||||
view->LockGL();
|
||||
break;
|
||||
|
||||
case UNLOCKGL_MSG:
|
||||
view->UnlockGL();
|
||||
break;
|
||||
|
||||
default:
|
||||
BDirectWindow::DispatchMessage(message, handler);
|
||||
}
|
||||
}
|
||||
|
||||
void HaikuDirectWindow::HandleMouseButton(BMessage* message) {
|
||||
BPoint where;
|
||||
if (message->FindPoint("where", &where) != B_OK) {
|
||||
return;
|
||||
}
|
||||
|
||||
uint32 modifiers = message->FindInt32("modifiers");
|
||||
uint32 buttons = message->FindInt32("buttons");
|
||||
uint32 button = buttons ^ last_buttons_state;
|
||||
last_buttons_state = buttons;
|
||||
|
||||
// TODO: implement the mouse_mode checks
|
||||
//if (mouse_mode == MOUSE_MODE_CAPTURED) {
|
||||
// event.xbutton.x=last_mouse_pos.x;
|
||||
// event.xbutton.y=last_mouse_pos.y;
|
||||
//}
|
||||
|
||||
InputEvent mouse_event;
|
||||
mouse_event.ID = ++event_id;
|
||||
mouse_event.type = InputEvent::MOUSE_BUTTON;
|
||||
mouse_event.device = 0;
|
||||
|
||||
mouse_event.mouse_button.mod = GetKeyModifierState(modifiers);
|
||||
mouse_event.mouse_button.button_mask = GetMouseButtonState(buttons);
|
||||
mouse_event.mouse_button.x = where.x;
|
||||
mouse_event.mouse_button.y = where.y;
|
||||
mouse_event.mouse_button.global_x = where.x;
|
||||
mouse_event.mouse_button.global_y = where.y;
|
||||
|
||||
switch (button) {
|
||||
default:
|
||||
case B_PRIMARY_MOUSE_BUTTON:
|
||||
mouse_event.mouse_button.button_index = 1;
|
||||
break;
|
||||
|
||||
case B_SECONDARY_MOUSE_BUTTON:
|
||||
mouse_event.mouse_button.button_index = 2;
|
||||
break;
|
||||
|
||||
case B_TERTIARY_MOUSE_BUTTON:
|
||||
mouse_event.mouse_button.button_index = 3;
|
||||
break;
|
||||
}
|
||||
|
||||
mouse_event.mouse_button.pressed = (message->what == B_MOUSE_DOWN);
|
||||
|
||||
if (message->what == B_MOUSE_DOWN && mouse_event.mouse_button.button_index == 1) {
|
||||
int32 clicks = message->FindInt32("clicks");
|
||||
|
||||
if (clicks > 1) {
|
||||
mouse_event.mouse_button.doubleclick=true;
|
||||
}
|
||||
}
|
||||
|
||||
input->parse_input_event(mouse_event);
|
||||
}
|
||||
|
||||
void HaikuDirectWindow::HandleMouseMoved(BMessage* message) {
|
||||
BPoint where;
|
||||
if (message->FindPoint("where", &where) != B_OK) {
|
||||
return;
|
||||
}
|
||||
|
||||
Point2i pos(where.x, where.y);
|
||||
uint32 modifiers = message->FindInt32("modifiers");
|
||||
uint32 buttons = message->FindInt32("buttons");
|
||||
|
||||
if (!last_mouse_pos_valid) {
|
||||
last_mouse_position = pos;
|
||||
last_mouse_pos_valid = true;
|
||||
}
|
||||
|
||||
Point2i rel = pos - last_mouse_position;
|
||||
|
||||
InputEvent motion_event;
|
||||
motion_event.ID = ++event_id;
|
||||
motion_event.type = InputEvent::MOUSE_MOTION;
|
||||
motion_event.device = 0;
|
||||
|
||||
motion_event.mouse_motion.mod = GetKeyModifierState(modifiers);
|
||||
motion_event.mouse_motion.button_mask = GetMouseButtonState(buttons);
|
||||
motion_event.mouse_motion.x = pos.x;
|
||||
motion_event.mouse_motion.y = pos.y;
|
||||
input->set_mouse_pos(pos);
|
||||
motion_event.mouse_motion.global_x = pos.x;
|
||||
motion_event.mouse_motion.global_y = pos.y;
|
||||
motion_event.mouse_motion.speed_x = input->get_mouse_speed().x;
|
||||
motion_event.mouse_motion.speed_y = input->get_mouse_speed().y;
|
||||
|
||||
motion_event.mouse_motion.relative_x = rel.x;
|
||||
motion_event.mouse_motion.relative_y = rel.y;
|
||||
|
||||
last_mouse_position = pos;
|
||||
|
||||
input->parse_input_event(motion_event);
|
||||
}
|
||||
|
||||
void HaikuDirectWindow::HandleMouseWheelChanged(BMessage* message) {
|
||||
float wheel_delta_y = 0;
|
||||
if (message->FindFloat("be:wheel_delta_y", &wheel_delta_y) != B_OK) {
|
||||
return;
|
||||
}
|
||||
|
||||
InputEvent mouse_event;
|
||||
mouse_event.ID = ++event_id;
|
||||
mouse_event.type = InputEvent::MOUSE_BUTTON;
|
||||
mouse_event.device = 0;
|
||||
|
||||
mouse_event.mouse_button.button_index = wheel_delta_y < 0 ? 4 : 5;
|
||||
mouse_event.mouse_button.mod = GetKeyModifierState(last_key_modifier_state);
|
||||
mouse_event.mouse_button.button_mask = last_button_mask;
|
||||
mouse_event.mouse_button.x = last_mouse_position.x;
|
||||
mouse_event.mouse_button.y = last_mouse_position.y;
|
||||
mouse_event.mouse_button.global_x = last_mouse_position.x;
|
||||
mouse_event.mouse_button.global_y = last_mouse_position.y;
|
||||
|
||||
mouse_event.mouse_button.pressed = true;
|
||||
input->parse_input_event(mouse_event);
|
||||
|
||||
mouse_event.ID = ++event_id;
|
||||
mouse_event.mouse_button.pressed = false;
|
||||
input->parse_input_event(mouse_event);
|
||||
}
|
||||
|
||||
void HaikuDirectWindow::HandleKeyboardEvent(BMessage* message) {
|
||||
int32 raw_char = 0;
|
||||
int32 key = 0;
|
||||
int32 modifiers = 0;
|
||||
|
||||
if (message->FindInt32("raw_char", &raw_char) != B_OK) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (message->FindInt32("key", &key) != B_OK) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (message->FindInt32("modifiers", &modifiers) != B_OK) {
|
||||
return;
|
||||
}
|
||||
|
||||
InputEvent event;
|
||||
event.ID = ++event_id;
|
||||
event.type = InputEvent::KEY;
|
||||
event.device = 0;
|
||||
event.key.mod = GetKeyModifierState(modifiers);
|
||||
event.key.pressed = (message->what == B_KEY_DOWN);
|
||||
event.key.scancode = KeyMappingHaiku::get_keysym(raw_char, key);
|
||||
event.key.echo = message->HasInt32("be:key_repeat");
|
||||
event.key.unicode = 0;
|
||||
|
||||
const char* bytes = NULL;
|
||||
if (message->FindString("bytes", &bytes) == B_OK) {
|
||||
event.key.unicode = BUnicodeChar::FromUTF8(&bytes);
|
||||
}
|
||||
|
||||
//make it consistent accross platforms.
|
||||
if (event.key.scancode==KEY_BACKTAB) {
|
||||
event.key.scancode=KEY_TAB;
|
||||
event.key.mod.shift=true;
|
||||
}
|
||||
|
||||
input->parse_input_event(event);
|
||||
}
|
||||
|
||||
void HaikuDirectWindow::HandleKeyboardModifierEvent(BMessage* message) {
|
||||
int32 old_modifiers = 0;
|
||||
int32 modifiers = 0;
|
||||
|
||||
if (message->FindInt32("be:old_modifiers", &old_modifiers) != B_OK) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (message->FindInt32("modifiers", &modifiers) != B_OK) {
|
||||
return;
|
||||
}
|
||||
|
||||
int32 key = old_modifiers ^ modifiers;
|
||||
|
||||
InputEvent event;
|
||||
event.ID = ++event_id;
|
||||
event.type = InputEvent::KEY;
|
||||
event.device = 0;
|
||||
event.key.mod = GetKeyModifierState(modifiers);
|
||||
event.key.pressed = ((modifiers & key) != 0);
|
||||
event.key.scancode = KeyMappingHaiku::get_modifier_keysym(key);
|
||||
event.key.echo = false;
|
||||
event.key.unicode = 0;
|
||||
|
||||
input->parse_input_event(event);
|
||||
}
|
||||
|
||||
void HaikuDirectWindow::HandleWindowResized(BMessage* message) {
|
||||
int32 width = 0;
|
||||
int32 height = 0;
|
||||
|
||||
if ((message->FindInt32("width", &width) != B_OK) || (message->FindInt32("height", &height) != B_OK)) {
|
||||
return;
|
||||
}
|
||||
|
||||
current_video_mode->width = width;
|
||||
current_video_mode->height = height;
|
||||
}
|
||||
|
||||
inline InputModifierState HaikuDirectWindow::GetKeyModifierState(uint32 p_state) {
|
||||
last_key_modifier_state = p_state;
|
||||
InputModifierState state;
|
||||
|
||||
state.shift = (p_state & B_SHIFT_KEY) != 0;
|
||||
state.control = (p_state & B_CONTROL_KEY) != 0;
|
||||
state.alt = (p_state & B_OPTION_KEY) != 0;
|
||||
state.meta = (p_state & B_COMMAND_KEY) != 0;
|
||||
|
||||
return state;
|
||||
}
|
||||
|
||||
inline int HaikuDirectWindow::GetMouseButtonState(uint32 p_state) {
|
||||
int state = 0;
|
||||
|
||||
if (p_state & B_PRIMARY_MOUSE_BUTTON) {
|
||||
state |= 1 << 0;
|
||||
}
|
||||
|
||||
if (p_state & B_SECONDARY_MOUSE_BUTTON) {
|
||||
state |= 1 << 1;
|
||||
}
|
||||
|
||||
if (p_state & B_TERTIARY_MOUSE_BUTTON) {
|
||||
state |= 1 << 2;
|
||||
}
|
||||
|
||||
last_button_mask = state;
|
||||
|
||||
return state;
|
||||
}
|
|
@ -0,0 +1,60 @@
|
|||
#ifndef HAIKU_DIRECT_WINDOW_H
|
||||
#define HAIKU_DIRECT_WINDOW_H
|
||||
|
||||
#include <kernel/image.h> // needed for image_id
|
||||
#include <DirectWindow.h>
|
||||
|
||||
#include "core/os/os.h"
|
||||
#include "main/input_default.h"
|
||||
|
||||
#include "haiku_gl_view.h"
|
||||
|
||||
#define REDRAW_MSG 'rdrw'
|
||||
#define LOCKGL_MSG 'glck'
|
||||
#define UNLOCKGL_MSG 'ulck'
|
||||
|
||||
class HaikuDirectWindow : public BDirectWindow
|
||||
{
|
||||
private:
|
||||
unsigned int event_id;
|
||||
Point2i last_mouse_position;
|
||||
bool last_mouse_pos_valid;
|
||||
uint32 last_buttons_state;
|
||||
uint32 last_key_modifier_state;
|
||||
int last_button_mask;
|
||||
OS::VideoMode* current_video_mode;
|
||||
|
||||
MainLoop* main_loop;
|
||||
InputDefault* input;
|
||||
HaikuGLView* view;
|
||||
BMessageRunner* update_runner;
|
||||
|
||||
void HandleMouseButton(BMessage* message);
|
||||
void HandleMouseMoved(BMessage* message);
|
||||
void HandleMouseWheelChanged(BMessage* message);
|
||||
void HandleWindowResized(BMessage* message);
|
||||
void HandleKeyboardEvent(BMessage* message);
|
||||
void HandleKeyboardModifierEvent(BMessage* message);
|
||||
inline InputModifierState GetKeyModifierState(uint32 p_state);
|
||||
inline int GetMouseButtonState(uint32 p_state);
|
||||
|
||||
public:
|
||||
HaikuDirectWindow(BRect p_frame);
|
||||
~HaikuDirectWindow();
|
||||
|
||||
void SetHaikuGLView(HaikuGLView* p_view);
|
||||
void StartMessageRunner();
|
||||
void StopMessageRunner();
|
||||
void SetInput(InputDefault* p_input);
|
||||
void SetMainLoop(MainLoop* p_main_loop);
|
||||
inline void SetVideoMode(OS::VideoMode* video_mode) { current_video_mode = video_mode; };
|
||||
virtual bool QuitRequested();
|
||||
virtual void DirectConnected(direct_buffer_info* info);
|
||||
virtual void MessageReceived(BMessage* message);
|
||||
virtual void DispatchMessage(BMessage* message, BHandler* handler);
|
||||
|
||||
inline Point2i GetLastMousePosition() { return last_mouse_position; };
|
||||
inline int GetLastButtonMask() { return last_button_mask; };
|
||||
};
|
||||
|
||||
#endif
|
|
@ -0,0 +1,18 @@
|
|||
#include "main/main.h"
|
||||
#include "haiku_gl_view.h"
|
||||
|
||||
HaikuGLView::HaikuGLView(BRect frame, uint32 type)
|
||||
: BGLView(frame, "GodotGLView", B_FOLLOW_ALL_SIDES, 0, type)
|
||||
{
|
||||
}
|
||||
|
||||
void HaikuGLView::AttachedToWindow(void) {
|
||||
LockGL();
|
||||
BGLView::AttachedToWindow();
|
||||
UnlockGL();
|
||||
MakeFocus();
|
||||
}
|
||||
|
||||
void HaikuGLView::Draw(BRect updateRect) {
|
||||
Main::force_redraw();
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
#ifndef HAIKU_GL_VIEW_H
|
||||
#define HAIKU_GL_VIEW_H
|
||||
|
||||
#include <kernel/image.h> // needed for image_id
|
||||
#include <GLView.h>
|
||||
|
||||
class HaikuGLView : public BGLView
|
||||
{
|
||||
public:
|
||||
HaikuGLView(BRect frame, uint32 type);
|
||||
virtual void AttachedToWindow(void);
|
||||
virtual void Draw(BRect updateRect);
|
||||
};
|
||||
|
||||
#endif
|
|
@ -0,0 +1,193 @@
|
|||
#include <InterfaceDefs.h>
|
||||
|
||||
#include "key_mapping_haiku.h"
|
||||
#include "os/keyboard.h"
|
||||
|
||||
struct _HaikuTranslatePair {
|
||||
unsigned int keysym;
|
||||
int32 keycode;
|
||||
};
|
||||
|
||||
static _HaikuTranslatePair _mod_to_keycode[] = {
|
||||
{ KEY_SHIFT, B_SHIFT_KEY },
|
||||
{ KEY_ALT, B_COMMAND_KEY },
|
||||
{ KEY_CONTROL, B_CONTROL_KEY },
|
||||
{ KEY_CAPSLOCK, B_CAPS_LOCK },
|
||||
{ KEY_SCROLLLOCK, B_SCROLL_LOCK },
|
||||
{ KEY_NUMLOCK, B_NUM_LOCK },
|
||||
{ KEY_SUPER_L, B_OPTION_KEY },
|
||||
{ KEY_MENU, B_MENU_KEY },
|
||||
{ KEY_SHIFT, B_LEFT_SHIFT_KEY },
|
||||
{ KEY_SHIFT, B_RIGHT_SHIFT_KEY },
|
||||
{ KEY_ALT, B_LEFT_COMMAND_KEY },
|
||||
{ KEY_ALT, B_RIGHT_COMMAND_KEY },
|
||||
{ KEY_CONTROL, B_LEFT_CONTROL_KEY },
|
||||
{ KEY_CONTROL, B_RIGHT_CONTROL_KEY },
|
||||
{ KEY_SUPER_L, B_LEFT_OPTION_KEY },
|
||||
{ KEY_SUPER_R, B_RIGHT_OPTION_KEY },
|
||||
{ KEY_UNKNOWN, 0 }
|
||||
};
|
||||
|
||||
static _HaikuTranslatePair _fn_to_keycode[] = {
|
||||
{ KEY_F1, B_F1_KEY },
|
||||
{ KEY_F2, B_F2_KEY },
|
||||
{ KEY_F3, B_F3_KEY },
|
||||
{ KEY_F4, B_F4_KEY },
|
||||
{ KEY_F5, B_F5_KEY },
|
||||
{ KEY_F6, B_F6_KEY },
|
||||
{ KEY_F7, B_F7_KEY },
|
||||
{ KEY_F8, B_F8_KEY },
|
||||
{ KEY_F9, B_F9_KEY },
|
||||
{ KEY_F10, B_F10_KEY },
|
||||
{ KEY_F11, B_F11_KEY },
|
||||
{ KEY_F12, B_F12_KEY },
|
||||
//{ KEY_F13, ? },
|
||||
//{ KEY_F14, ? },
|
||||
//{ KEY_F15, ? },
|
||||
//{ KEY_F16, ? },
|
||||
{ KEY_PRINT, B_PRINT_KEY },
|
||||
{ KEY_SCROLLLOCK, B_SCROLL_KEY },
|
||||
{ KEY_PAUSE, B_PAUSE_KEY },
|
||||
{ KEY_UNKNOWN, 0 }
|
||||
};
|
||||
|
||||
static _HaikuTranslatePair _hb_to_keycode[] = {
|
||||
{ KEY_BACKSPACE, B_BACKSPACE },
|
||||
{ KEY_TAB, B_TAB },
|
||||
{ KEY_RETURN, B_RETURN },
|
||||
{ KEY_CAPSLOCK, B_CAPS_LOCK },
|
||||
{ KEY_ESCAPE, B_ESCAPE },
|
||||
{ KEY_SPACE, B_SPACE },
|
||||
{ KEY_PAGEUP, B_PAGE_UP },
|
||||
{ KEY_PAGEDOWN, B_PAGE_DOWN },
|
||||
{ KEY_END, B_END },
|
||||
{ KEY_HOME, B_HOME },
|
||||
{ KEY_LEFT, B_LEFT_ARROW },
|
||||
{ KEY_UP, B_UP_ARROW },
|
||||
{ KEY_RIGHT, B_RIGHT_ARROW },
|
||||
{ KEY_DOWN, B_DOWN_ARROW },
|
||||
{ KEY_PRINT, B_PRINT_KEY },
|
||||
{ KEY_INSERT, B_INSERT },
|
||||
{ KEY_DELETE, B_DELETE },
|
||||
// { KEY_HELP, ??? },
|
||||
|
||||
{ KEY_0, (0x30) },
|
||||
{ KEY_1, (0x31) },
|
||||
{ KEY_2, (0x32) },
|
||||
{ KEY_3, (0x33) },
|
||||
{ KEY_4, (0x34) },
|
||||
{ KEY_5, (0x35) },
|
||||
{ KEY_6, (0x36) },
|
||||
{ KEY_7, (0x37) },
|
||||
{ KEY_8, (0x38) },
|
||||
{ KEY_9, (0x39) },
|
||||
{ KEY_A, (0x61) },
|
||||
{ KEY_B, (0x62) },
|
||||
{ KEY_C, (0x63) },
|
||||
{ KEY_D, (0x64) },
|
||||
{ KEY_E, (0x65) },
|
||||
{ KEY_F, (0x66) },
|
||||
{ KEY_G, (0x67) },
|
||||
{ KEY_H, (0x68) },
|
||||
{ KEY_I, (0x69) },
|
||||
{ KEY_J, (0x6A) },
|
||||
{ KEY_K, (0x6B) },
|
||||
{ KEY_L, (0x6C) },
|
||||
{ KEY_M, (0x6D) },
|
||||
{ KEY_N, (0x6E) },
|
||||
{ KEY_O, (0x6F) },
|
||||
{ KEY_P, (0x70) },
|
||||
{ KEY_Q, (0x71) },
|
||||
{ KEY_R, (0x72) },
|
||||
{ KEY_S, (0x73) },
|
||||
{ KEY_T, (0x74) },
|
||||
{ KEY_U, (0x75) },
|
||||
{ KEY_V, (0x76) },
|
||||
{ KEY_W, (0x77) },
|
||||
{ KEY_X, (0x78) },
|
||||
{ KEY_Y, (0x79) },
|
||||
{ KEY_Z, (0x7A) },
|
||||
|
||||
/*
|
||||
{ KEY_PLAY, VK_PLAY},// (0xFA)
|
||||
{ KEY_STANDBY,VK_SLEEP },//(0x5F)
|
||||
{ KEY_BACK,VK_BROWSER_BACK},// (0xA6)
|
||||
{ KEY_FORWARD,VK_BROWSER_FORWARD},// (0xA7)
|
||||
{ KEY_REFRESH,VK_BROWSER_REFRESH},// (0xA8)
|
||||
{ KEY_STOP,VK_BROWSER_STOP},// (0xA9)
|
||||
{ KEY_SEARCH,VK_BROWSER_SEARCH},// (0xAA)
|
||||
{ KEY_FAVORITES, VK_BROWSER_FAVORITES},// (0xAB)
|
||||
{ KEY_HOMEPAGE,VK_BROWSER_HOME},// (0xAC)
|
||||
{ KEY_VOLUMEMUTE,VK_VOLUME_MUTE},// (0xAD)
|
||||
{ KEY_VOLUMEDOWN,VK_VOLUME_DOWN},// (0xAE)
|
||||
{ KEY_VOLUMEUP,VK_VOLUME_UP},// (0xAF)
|
||||
{ KEY_MEDIANEXT,VK_MEDIA_NEXT_TRACK},// (0xB0)
|
||||
{ KEY_MEDIAPREVIOUS,VK_MEDIA_PREV_TRACK},// (0xB1)
|
||||
{ KEY_MEDIASTOP,VK_MEDIA_STOP},// (0xB2)
|
||||
{ KEY_LAUNCHMAIL, VK_LAUNCH_MAIL},// (0xB4)
|
||||
{ KEY_LAUNCHMEDIA,VK_LAUNCH_MEDIA_SELECT},// (0xB5)
|
||||
{ KEY_LAUNCH0,VK_LAUNCH_APP1},// (0xB6)
|
||||
{ KEY_LAUNCH1,VK_LAUNCH_APP2},// (0xB7)
|
||||
*/
|
||||
|
||||
{ KEY_SEMICOLON, 0x3B },
|
||||
{ KEY_EQUAL, 0x3D },
|
||||
{ KEY_COLON, 0x2C },
|
||||
{ KEY_MINUS, 0x2D },
|
||||
{ KEY_PERIOD, 0x2E },
|
||||
{ KEY_SLASH, 0x2F },
|
||||
{ KEY_KP_MULTIPLY, 0x2A },
|
||||
{ KEY_KP_ADD, 0x2B },
|
||||
|
||||
{ KEY_QUOTELEFT, 0x60 },
|
||||
{ KEY_BRACKETLEFT, 0x5B },
|
||||
{ KEY_BACKSLASH, 0x5C },
|
||||
{ KEY_BRACKETRIGHT, 0x5D },
|
||||
{ KEY_APOSTROPHE, 0x27 },
|
||||
|
||||
{ KEY_UNKNOWN, 0 }
|
||||
};
|
||||
|
||||
unsigned int KeyMappingHaiku::get_keysym(int32 raw_char, int32 key) {
|
||||
if (raw_char == B_INSERT && key == 0x64) { return KEY_KP_0; }
|
||||
if (raw_char == B_END && key == 0x58) { return KEY_KP_1; }
|
||||
if (raw_char == B_DOWN_ARROW && key == 0x59) { return KEY_KP_2; }
|
||||
if (raw_char == B_PAGE_DOWN && key == 0x5A) { return KEY_KP_3; }
|
||||
if (raw_char == B_LEFT_ARROW && key == 0x48) { return KEY_KP_4; }
|
||||
if (raw_char == 0x35 && key == 0x49) { return KEY_KP_5; }
|
||||
if (raw_char == B_RIGHT_ARROW && key == 0x4A) { return KEY_KP_6; }
|
||||
if (raw_char == B_HOME && key == 0x37) { return KEY_KP_7; }
|
||||
if (raw_char == B_UP_ARROW && key == 0x38) { return KEY_KP_8; }
|
||||
if (raw_char == B_PAGE_UP && key == 0x39) { return KEY_KP_9; }
|
||||
if (raw_char == 0x2F && key == 0x23) { return KEY_KP_DIVIDE; }
|
||||
if (raw_char == 0x2D && key == 0x25) { return KEY_KP_SUBSTRACT; }
|
||||
if (raw_char == B_DELETE && key == 0x65) { return KEY_KP_PERIOD; }
|
||||
|
||||
if (raw_char == 0x10) {
|
||||
for(int i = 0; _fn_to_keycode[i].keysym != KEY_UNKNOWN; i++) {
|
||||
if (_fn_to_keycode[i].keycode == key) {
|
||||
return _fn_to_keycode[i].keysym;
|
||||
}
|
||||
}
|
||||
|
||||
return KEY_UNKNOWN;
|
||||
}
|
||||
|
||||
for(int i = 0; _hb_to_keycode[i].keysym != KEY_UNKNOWN; i++) {
|
||||
if (_hb_to_keycode[i].keycode == raw_char) {
|
||||
return _hb_to_keycode[i].keysym;
|
||||
}
|
||||
}
|
||||
|
||||
return KEY_UNKNOWN;
|
||||
}
|
||||
|
||||
unsigned int KeyMappingHaiku::get_modifier_keysym(int32 key) {
|
||||
for(int i = 0; _mod_to_keycode[i].keysym != KEY_UNKNOWN; i++) {
|
||||
if ((_mod_to_keycode[i].keycode & key) != 0) {
|
||||
return _mod_to_keycode[i].keysym;
|
||||
}
|
||||
}
|
||||
|
||||
return KEY_UNKNOWN;
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
#ifndef KEY_MAPPING_HAIKU_H
|
||||
#define KEY_MAPPING_HAIKU_H
|
||||
|
||||
class KeyMappingHaiku
|
||||
{
|
||||
KeyMappingHaiku() {};
|
||||
|
||||
public:
|
||||
static unsigned int get_keysym(int32 raw_char, int32 key);
|
||||
static unsigned int get_modifier_keysym(int32 key);
|
||||
};
|
||||
|
||||
#endif
|
Binary file not shown.
After Width: | Height: | Size: 1.3 KiB |
|
@ -0,0 +1,320 @@
|
|||
#include <Screen.h>
|
||||
|
||||
#include "servers/visual/visual_server_raster.h"
|
||||
#include "servers/visual/visual_server_wrap_mt.h"
|
||||
#include "drivers/gles2/rasterizer_gles2.h"
|
||||
#include "servers/physics/physics_server_sw.h"
|
||||
//#include "servers/physics_2d/physics_2d_server_wrap_mt.h"
|
||||
#include "main/main.h"
|
||||
|
||||
#include "os_haiku.h"
|
||||
|
||||
|
||||
OS_Haiku::OS_Haiku() {
|
||||
#ifdef MEDIA_KIT_ENABLED
|
||||
AudioDriverManagerSW::add_driver(&driver_media_kit);
|
||||
#endif
|
||||
};
|
||||
|
||||
void OS_Haiku::run() {
|
||||
if (!main_loop) {
|
||||
return;
|
||||
}
|
||||
|
||||
main_loop->init();
|
||||
context_gl->release_current();
|
||||
|
||||
// TODO: clean up
|
||||
BMessenger* bms = new BMessenger(window);
|
||||
BMessage* msg = new BMessage();
|
||||
bms->SendMessage(LOCKGL_MSG, msg);
|
||||
|
||||
window->StartMessageRunner();
|
||||
app->Run();
|
||||
window->StopMessageRunner();
|
||||
|
||||
delete app;
|
||||
|
||||
delete bms;
|
||||
delete msg;
|
||||
main_loop->finish();
|
||||
}
|
||||
|
||||
String OS_Haiku::get_name() {
|
||||
return "Haiku";
|
||||
}
|
||||
|
||||
int OS_Haiku::get_video_driver_count() const {
|
||||
return 1;
|
||||
}
|
||||
|
||||
const char* OS_Haiku::get_video_driver_name(int p_driver) const {
|
||||
return "GLES2";
|
||||
}
|
||||
|
||||
OS::VideoMode OS_Haiku::get_default_video_mode() const {
|
||||
return OS::VideoMode(800, 600, false);
|
||||
}
|
||||
|
||||
void OS_Haiku::initialize(const VideoMode& p_desired, int p_video_driver, int p_audio_driver) {
|
||||
main_loop = NULL;
|
||||
current_video_mode = p_desired;
|
||||
|
||||
app = new HaikuApplication();
|
||||
|
||||
BRect frame;
|
||||
frame.Set(50, 50, 50 + current_video_mode.width - 1, 50 + current_video_mode.height - 1);
|
||||
|
||||
window = new HaikuDirectWindow(frame);
|
||||
window->SetVideoMode(¤t_video_mode);
|
||||
|
||||
if (current_video_mode.fullscreen) {
|
||||
window->SetFullScreen(true);
|
||||
}
|
||||
|
||||
if (!current_video_mode.resizable) {
|
||||
uint32 flags = window->Flags();
|
||||
flags |= B_NOT_RESIZABLE;
|
||||
window->SetFlags(flags);
|
||||
}
|
||||
|
||||
#if defined(OPENGL_ENABLED) || defined(LEGACYGL_ENABLED)
|
||||
context_gl = memnew(ContextGL_Haiku(window));
|
||||
context_gl->initialize();
|
||||
context_gl->make_current();
|
||||
|
||||
rasterizer = memnew(RasterizerGLES2);
|
||||
#endif
|
||||
|
||||
visual_server = memnew(VisualServerRaster(rasterizer));
|
||||
|
||||
ERR_FAIL_COND(!visual_server);
|
||||
|
||||
// TODO: enable multithreaded VS
|
||||
//if (get_render_thread_mode() != RENDER_THREAD_UNSAFE) {
|
||||
// visual_server = memnew(VisualServerWrapMT(visual_server, get_render_thread_mode() == RENDER_SEPARATE_THREAD));
|
||||
//}
|
||||
|
||||
input = memnew(InputDefault);
|
||||
window->SetInput(input);
|
||||
|
||||
window->Show();
|
||||
visual_server->init();
|
||||
|
||||
physics_server = memnew(PhysicsServerSW);
|
||||
physics_server->init();
|
||||
physics_2d_server = memnew(Physics2DServerSW);
|
||||
// TODO: enable multithreaded PS
|
||||
//physics_2d_server = Physics2DServerWrapMT::init_server<Physics2DServerSW>();
|
||||
physics_2d_server->init();
|
||||
|
||||
AudioDriverManagerSW::get_driver(p_audio_driver)->set_singleton();
|
||||
|
||||
if (AudioDriverManagerSW::get_driver(p_audio_driver)->init() != OK) {
|
||||
ERR_PRINT("Initializing audio failed.");
|
||||
}
|
||||
|
||||
sample_manager = memnew(SampleManagerMallocSW);
|
||||
audio_server = memnew(AudioServerSW(sample_manager));
|
||||
audio_server->init();
|
||||
|
||||
spatial_sound_server = memnew(SpatialSoundServerSW);
|
||||
spatial_sound_server->init();
|
||||
spatial_sound_2d_server = memnew(SpatialSound2DServerSW);
|
||||
spatial_sound_2d_server->init();
|
||||
}
|
||||
|
||||
void OS_Haiku::finalize() {
|
||||
if (main_loop) {
|
||||
memdelete(main_loop);
|
||||
}
|
||||
|
||||
main_loop = NULL;
|
||||
|
||||
spatial_sound_server->finish();
|
||||
memdelete(spatial_sound_server);
|
||||
|
||||
spatial_sound_2d_server->finish();
|
||||
memdelete(spatial_sound_2d_server);
|
||||
|
||||
audio_server->finish();
|
||||
memdelete(audio_server);
|
||||
memdelete(sample_manager);
|
||||
|
||||
visual_server->finish();
|
||||
memdelete(visual_server);
|
||||
memdelete(rasterizer);
|
||||
|
||||
physics_server->finish();
|
||||
memdelete(physics_server);
|
||||
|
||||
physics_2d_server->finish();
|
||||
memdelete(physics_2d_server);
|
||||
|
||||
memdelete(input);
|
||||
|
||||
#if defined(OPENGL_ENABLED) || defined(LEGACYGL_ENABLED)
|
||||
memdelete(context_gl);
|
||||
#endif
|
||||
}
|
||||
|
||||
void OS_Haiku::set_main_loop(MainLoop* p_main_loop) {
|
||||
main_loop = p_main_loop;
|
||||
input->set_main_loop(p_main_loop);
|
||||
window->SetMainLoop(p_main_loop);
|
||||
}
|
||||
|
||||
MainLoop* OS_Haiku::get_main_loop() const {
|
||||
return main_loop;
|
||||
}
|
||||
|
||||
void OS_Haiku::delete_main_loop() {
|
||||
if (main_loop) {
|
||||
memdelete(main_loop);
|
||||
}
|
||||
|
||||
main_loop = NULL;
|
||||
window->SetMainLoop(NULL);
|
||||
}
|
||||
|
||||
void OS_Haiku::release_rendering_thread() {
|
||||
context_gl->release_current();
|
||||
}
|
||||
|
||||
void OS_Haiku::make_rendering_thread() {
|
||||
context_gl->make_current();
|
||||
}
|
||||
|
||||
bool OS_Haiku::can_draw() const {
|
||||
// TODO: implement
|
||||
return true;
|
||||
}
|
||||
|
||||
void OS_Haiku::swap_buffers() {
|
||||
context_gl->swap_buffers();
|
||||
}
|
||||
|
||||
Point2 OS_Haiku::get_mouse_pos() const {
|
||||
return window->GetLastMousePosition();
|
||||
}
|
||||
|
||||
int OS_Haiku::get_mouse_button_state() const {
|
||||
return window->GetLastButtonMask();
|
||||
}
|
||||
|
||||
void OS_Haiku::set_cursor_shape(CursorShape p_shape) {
|
||||
//ERR_PRINT("set_cursor_shape() NOT IMPLEMENTED");
|
||||
}
|
||||
|
||||
int OS_Haiku::get_screen_count() const {
|
||||
// TODO: implement get_screen_count()
|
||||
return 1;
|
||||
}
|
||||
|
||||
int OS_Haiku::get_current_screen() const {
|
||||
// TODO: implement get_current_screen()
|
||||
return 0;
|
||||
}
|
||||
|
||||
void OS_Haiku::set_current_screen(int p_screen) {
|
||||
// TODO: implement set_current_screen()
|
||||
}
|
||||
|
||||
Point2 OS_Haiku::get_screen_position(int p_screen) const {
|
||||
// TODO: make this work with the p_screen parameter
|
||||
BScreen* screen = new BScreen(window);
|
||||
BRect frame = screen->Frame();
|
||||
delete screen;
|
||||
return Point2i(frame.left, frame.top);
|
||||
}
|
||||
|
||||
Size2 OS_Haiku::get_screen_size(int p_screen) const {
|
||||
// TODO: make this work with the p_screen parameter
|
||||
BScreen* screen = new BScreen(window);
|
||||
BRect frame = screen->Frame();
|
||||
delete screen;
|
||||
return Size2i(frame.IntegerWidth() + 1, frame.IntegerHeight() + 1);
|
||||
}
|
||||
|
||||
void OS_Haiku::set_window_title(const String& p_title) {
|
||||
window->SetTitle(p_title.utf8().get_data());
|
||||
}
|
||||
|
||||
Size2 OS_Haiku::get_window_size() const {
|
||||
BSize size = window->Size();
|
||||
return Size2i(size.IntegerWidth() + 1, size.IntegerHeight() + 1);
|
||||
}
|
||||
|
||||
void OS_Haiku::set_window_size(const Size2 p_size) {
|
||||
// TODO: why does it stop redrawing after this is called?
|
||||
window->ResizeTo(p_size.x, p_size.y);
|
||||
}
|
||||
|
||||
Point2 OS_Haiku::get_window_position() const {
|
||||
BPoint point(0, 0);
|
||||
window->ConvertToScreen(&point);
|
||||
return Point2i(point.x, point.y);
|
||||
}
|
||||
|
||||
void OS_Haiku::set_window_position(const Point2& p_position) {
|
||||
window->MoveTo(p_position.x, p_position.y);
|
||||
}
|
||||
|
||||
void OS_Haiku::set_window_fullscreen(bool p_enabled) {
|
||||
window->SetFullScreen(p_enabled);
|
||||
current_video_mode.fullscreen = p_enabled;
|
||||
visual_server->init();
|
||||
}
|
||||
|
||||
bool OS_Haiku::is_window_fullscreen() const {
|
||||
return current_video_mode.fullscreen;
|
||||
}
|
||||
|
||||
void OS_Haiku::set_window_resizable(bool p_enabled) {
|
||||
uint32 flags = window->Flags();
|
||||
|
||||
if (p_enabled) {
|
||||
flags &= ~(B_NOT_RESIZABLE);
|
||||
} else {
|
||||
flags |= B_NOT_RESIZABLE;
|
||||
}
|
||||
|
||||
window->SetFlags(flags);
|
||||
current_video_mode.resizable = p_enabled;
|
||||
}
|
||||
|
||||
bool OS_Haiku::is_window_resizable() const {
|
||||
return current_video_mode.resizable;
|
||||
}
|
||||
|
||||
void OS_Haiku::set_window_minimized(bool p_enabled) {
|
||||
window->Minimize(p_enabled);
|
||||
}
|
||||
|
||||
bool OS_Haiku::is_window_minimized() const {
|
||||
return window->IsMinimized();
|
||||
}
|
||||
|
||||
void OS_Haiku::set_window_maximized(bool p_enabled) {
|
||||
window->Minimize(!p_enabled);
|
||||
}
|
||||
|
||||
bool OS_Haiku::is_window_maximized() const {
|
||||
return !window->IsMinimized();
|
||||
}
|
||||
|
||||
void OS_Haiku::set_video_mode(const VideoMode& p_video_mode, int p_screen) {
|
||||
ERR_PRINT("set_video_mode() NOT IMPLEMENTED");
|
||||
}
|
||||
|
||||
OS::VideoMode OS_Haiku::get_video_mode(int p_screen) const {
|
||||
return current_video_mode;
|
||||
}
|
||||
|
||||
void OS_Haiku::get_fullscreen_mode_list(List<VideoMode> *p_list, int p_screen) const {
|
||||
ERR_PRINT("get_fullscreen_mode_list() NOT IMPLEMENTED");
|
||||
}
|
||||
|
||||
String OS_Haiku::get_executable_path() const {
|
||||
return OS::get_executable_path();
|
||||
}
|
|
@ -0,0 +1,99 @@
|
|||
#ifndef OS_HAIKU_H
|
||||
#define OS_HAIKU_H
|
||||
|
||||
#include "drivers/unix/os_unix.h"
|
||||
#include "servers/visual_server.h"
|
||||
#include "servers/visual/rasterizer.h"
|
||||
#include "servers/physics_server.h"
|
||||
#include "servers/physics_2d/physics_2d_server_sw.h"
|
||||
#include "servers/audio/audio_server_sw.h"
|
||||
#include "servers/audio/sample_manager_sw.h"
|
||||
#include "servers/spatial_sound/spatial_sound_server_sw.h"
|
||||
#include "servers/spatial_sound_2d/spatial_sound_2d_server_sw.h"
|
||||
#include "main/input_default.h"
|
||||
|
||||
#include "audio_driver_media_kit.h"
|
||||
#include "context_gl_haiku.h"
|
||||
#include "haiku_application.h"
|
||||
#include "haiku_direct_window.h"
|
||||
|
||||
|
||||
class OS_Haiku : public OS_Unix {
|
||||
private:
|
||||
HaikuApplication* app;
|
||||
HaikuDirectWindow* window;
|
||||
MainLoop* main_loop;
|
||||
InputDefault* input;
|
||||
Rasterizer* rasterizer;
|
||||
VisualServer* visual_server;
|
||||
VideoMode current_video_mode;
|
||||
PhysicsServer* physics_server;
|
||||
Physics2DServer* physics_2d_server;
|
||||
AudioServerSW* audio_server;
|
||||
SampleManagerMallocSW* sample_manager;
|
||||
SpatialSoundServerSW* spatial_sound_server;
|
||||
SpatialSound2DServerSW* spatial_sound_2d_server;
|
||||
|
||||
#ifdef MEDIA_KIT_ENABLED
|
||||
AudioDriverMediaKit driver_media_kit;
|
||||
#endif
|
||||
|
||||
#if defined(OPENGL_ENABLED) || defined(LEGACYGL_ENABLED)
|
||||
ContextGL_Haiku* context_gl;
|
||||
#endif
|
||||
|
||||
virtual void delete_main_loop();
|
||||
|
||||
protected:
|
||||
virtual int get_video_driver_count() const;
|
||||
virtual const char* get_video_driver_name(int p_driver) const;
|
||||
virtual VideoMode get_default_video_mode() const;
|
||||
|
||||
virtual void initialize(const VideoMode& p_desired, int p_video_driver, int p_audio_driver);
|
||||
virtual void finalize();
|
||||
|
||||
virtual void set_main_loop(MainLoop* p_main_loop);
|
||||
|
||||
public:
|
||||
OS_Haiku();
|
||||
void run();
|
||||
|
||||
virtual String get_name();
|
||||
|
||||
virtual MainLoop* get_main_loop() const;
|
||||
|
||||
virtual bool can_draw() const;
|
||||
virtual void release_rendering_thread();
|
||||
virtual void make_rendering_thread();
|
||||
virtual void swap_buffers();
|
||||
|
||||
virtual Point2 get_mouse_pos() const;
|
||||
virtual int get_mouse_button_state() const;
|
||||
virtual void set_cursor_shape(CursorShape p_shape);
|
||||
|
||||
virtual int get_screen_count() const;
|
||||
virtual int get_current_screen() const;
|
||||
virtual void set_current_screen(int p_screen);
|
||||
virtual Point2 get_screen_position(int p_screen=0) const;
|
||||
virtual Size2 get_screen_size(int p_screen=0) const;
|
||||
virtual void set_window_title(const String& p_title);
|
||||
virtual Size2 get_window_size() const;
|
||||
virtual void set_window_size(const Size2 p_size);
|
||||
virtual Point2 get_window_position() const;
|
||||
virtual void set_window_position(const Point2& p_position);
|
||||
virtual void set_window_fullscreen(bool p_enabled);
|
||||
virtual bool is_window_fullscreen() const;
|
||||
virtual void set_window_resizable(bool p_enabled);
|
||||
virtual bool is_window_resizable() const;
|
||||
virtual void set_window_minimized(bool p_enabled);
|
||||
virtual bool is_window_minimized() const;
|
||||
virtual void set_window_maximized(bool p_enabled);
|
||||
virtual bool is_window_maximized() const;
|
||||
|
||||
virtual void set_video_mode(const VideoMode& p_video_mode, int p_screen=0);
|
||||
virtual VideoMode get_video_mode(int p_screen=0) const;
|
||||
virtual void get_fullscreen_mode_list(List<VideoMode> *p_list, int p_screen=0) const;
|
||||
virtual String get_executable_path() const;
|
||||
};
|
||||
|
||||
#endif
|
|
@ -0,0 +1,6 @@
|
|||
#include <alloca.h>
|
||||
|
||||
// for ifaddrs.h needed in drivers/unix/ip_unix.cpp
|
||||
#define _BSD_SOURCE 1
|
||||
|
||||
#define GLES2_INCLUDE_H <GL/glew.h>
|
|
@ -157,6 +157,8 @@ public:
|
|||
Error shell_open(String p_uri);
|
||||
void push_input(const InputEvent& p_event);
|
||||
|
||||
String get_locale() const;
|
||||
|
||||
virtual void set_video_mode(const VideoMode& p_video_mode,int p_screen=0);
|
||||
virtual VideoMode get_video_mode(int p_screen=0) const;
|
||||
virtual void get_fullscreen_mode_list(List<VideoMode> *p_list,int p_screen=0) const;
|
||||
|
|
|
@ -1254,6 +1254,11 @@ Error OS_OSX::shell_open(String p_uri) {
|
|||
return OK;
|
||||
}
|
||||
|
||||
String OS_OSX::get_locale() const {
|
||||
NSString* preferredLang = [[NSLocale preferredLanguages] objectAtIndex:0];
|
||||
return [preferredLang UTF8String];
|
||||
}
|
||||
|
||||
void OS_OSX::swap_buffers() {
|
||||
|
||||
[context flushBuffer];
|
||||
|
|
|
@ -79,6 +79,13 @@ Error TCPServerWinsock::listen(uint16_t p_port,const List<String> *p_accepted_ho
|
|||
my_addr.sin_addr.s_addr = INADDR_ANY; // automatically fill with my IP TODO: use p_accepted_hosts
|
||||
memset(my_addr.sin_zero, '\0', sizeof my_addr.sin_zero);
|
||||
|
||||
int reuse=1;
|
||||
if(setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, (char *)&reuse, sizeof(reuse)) < 0) {
|
||||
|
||||
printf("REUSEADDR failed!");
|
||||
}
|
||||
|
||||
|
||||
if (bind(sockfd, (struct sockaddr *)&my_addr, sizeof my_addr) != SOCKET_ERROR) {
|
||||
|
||||
if (::listen(sockfd, SOMAXCONN) == SOCKET_ERROR) {
|
||||
|
|
|
@ -784,8 +784,6 @@ void OS_X11::set_window_size(const Size2 p_size) {
|
|||
void OS_X11::set_window_fullscreen(bool p_enabled) {
|
||||
set_wm_fullscreen(p_enabled);
|
||||
current_videomode.fullscreen = p_enabled;
|
||||
|
||||
visual_server->init();
|
||||
}
|
||||
|
||||
bool OS_X11::is_window_fullscreen() const {
|
||||
|
@ -891,8 +889,14 @@ void OS_X11::set_window_maximized(bool p_enabled) {
|
|||
xev.xclient.data.l[2] = wm_max_vert;
|
||||
|
||||
XSendEvent(x11_display, DefaultRootWindow(x11_display), False, SubstructureRedirectMask | SubstructureNotifyMask, &xev);
|
||||
|
||||
/* sorry this does not fix it, fails on multi monitor
|
||||
XWindowAttributes xwa;
|
||||
XGetWindowAttributes(x11_display,DefaultRootWindow(x11_display),&xwa);
|
||||
current_videomode.width = xwa.width;
|
||||
current_videomode.height = xwa.height;
|
||||
*/
|
||||
maximized = p_enabled;
|
||||
|
||||
}
|
||||
|
||||
bool OS_X11::is_window_maximized() const {
|
||||
|
@ -1201,7 +1205,6 @@ void OS_X11::process_xevents() {
|
|||
#ifdef NEW_WM_API
|
||||
if(current_videomode.fullscreen) {
|
||||
set_wm_fullscreen(true);
|
||||
visual_server->init();
|
||||
}
|
||||
#endif
|
||||
main_loop->notification(MainLoop::NOTIFICATION_WM_FOCUS_IN);
|
||||
|
@ -1218,7 +1221,6 @@ void OS_X11::process_xevents() {
|
|||
if(current_videomode.fullscreen) {
|
||||
set_wm_fullscreen(false);
|
||||
set_window_minimized(true);
|
||||
visual_server->init();
|
||||
}
|
||||
#endif
|
||||
main_loop->notification(MainLoop::NOTIFICATION_WM_FOCUS_OUT);
|
||||
|
|
|
@ -126,7 +126,7 @@ void Joint2D::_bind_methods() {
|
|||
|
||||
ADD_PROPERTY( PropertyInfo( Variant::NODE_PATH, "node_a"), _SCS("set_node_a"),_SCS("get_node_a") );
|
||||
ADD_PROPERTY( PropertyInfo( Variant::NODE_PATH, "node_b"), _SCS("set_node_b"),_SCS("get_node_b") );
|
||||
ADD_PROPERTY( PropertyInfo( Variant::REAL, "bias/bias",PROPERTY_HINT_RANGE,"0,0.9,0.01"), _SCS("set_bias"),_SCS("get_bias") );
|
||||
ADD_PROPERTY( PropertyInfo( Variant::REAL, "bias/bias",PROPERTY_HINT_RANGE,"0,0.9,0.001"), _SCS("set_bias"),_SCS("get_bias") );
|
||||
|
||||
}
|
||||
|
||||
|
@ -175,15 +175,37 @@ RID PinJoint2D::_configure_joint() {
|
|||
//add a collision exception between both
|
||||
Physics2DServer::get_singleton()->body_add_collision_exception(body_a->get_rid(),body_b->get_rid());
|
||||
}
|
||||
|
||||
return Physics2DServer::get_singleton()->pin_joint_create(get_global_transform().get_origin(),body_a->get_rid(),body_b?body_b->get_rid():RID());
|
||||
RID pj = Physics2DServer::get_singleton()->pin_joint_create(get_global_transform().get_origin(),body_a->get_rid(),body_b?body_b->get_rid():RID());
|
||||
Physics2DServer::get_singleton()->pin_joint_set_param(pj, Physics2DServer::PIN_JOINT_SOFTNESS, softness);
|
||||
return pj;
|
||||
|
||||
}
|
||||
|
||||
void PinJoint2D::set_softness(real_t p_softness) {
|
||||
|
||||
softness=p_softness;
|
||||
update();
|
||||
if (get_joint().is_valid())
|
||||
Physics2DServer::get_singleton()->pin_joint_set_param(get_joint(), Physics2DServer::PIN_JOINT_SOFTNESS, p_softness);
|
||||
|
||||
}
|
||||
|
||||
real_t PinJoint2D::get_softness() const {
|
||||
|
||||
return softness;
|
||||
}
|
||||
|
||||
void PinJoint2D::_bind_methods() {
|
||||
|
||||
ObjectTypeDB::bind_method(_MD("set_softness","softness"), &PinJoint2D::set_softness);
|
||||
ObjectTypeDB::bind_method(_MD("get_softness"), &PinJoint2D::get_softness);
|
||||
|
||||
ADD_PROPERTY( PropertyInfo( Variant::REAL, "softness", PROPERTY_HINT_EXP_RANGE,"0.00,16,0.01"), _SCS("set_softness"), _SCS("get_softness"));
|
||||
}
|
||||
|
||||
PinJoint2D::PinJoint2D() {
|
||||
|
||||
|
||||
softness = 0;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -72,13 +72,17 @@ class PinJoint2D : public Joint2D {
|
|||
|
||||
OBJ_TYPE(PinJoint2D,Joint2D);
|
||||
|
||||
real_t softness;
|
||||
|
||||
protected:
|
||||
|
||||
void _notification(int p_what);
|
||||
virtual RID _configure_joint();
|
||||
static void _bind_methods();
|
||||
public:
|
||||
|
||||
|
||||
void set_softness(real_t p_stiffness);
|
||||
real_t get_softness() const;
|
||||
|
||||
PinJoint2D();
|
||||
};
|
||||
|
|
|
@ -110,7 +110,10 @@ void ParallaxBackground::_update_scroll() {
|
|||
if (!l)
|
||||
continue;
|
||||
|
||||
l->set_base_offset_and_scale(ofs,scale);
|
||||
if (ignore_camera_zoom)
|
||||
l->set_base_offset_and_scale(ofs, 1.0);
|
||||
else
|
||||
l->set_base_offset_and_scale(ofs, scale);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -165,6 +168,18 @@ Point2 ParallaxBackground::get_limit_end() const {
|
|||
return limit_end;
|
||||
}
|
||||
|
||||
void ParallaxBackground::set_ignore_camera_zoom(bool ignore){
|
||||
|
||||
ignore_camera_zoom = ignore;
|
||||
|
||||
}
|
||||
|
||||
bool ParallaxBackground::is_ignore_camera_zoom(){
|
||||
|
||||
return ignore_camera_zoom;
|
||||
|
||||
}
|
||||
|
||||
void ParallaxBackground::_bind_methods() {
|
||||
|
||||
ObjectTypeDB::bind_method(_MD("_camera_moved"),&ParallaxBackground::_camera_moved);
|
||||
|
@ -178,6 +193,8 @@ void ParallaxBackground::_bind_methods() {
|
|||
ObjectTypeDB::bind_method(_MD("get_limit_begin"),&ParallaxBackground::get_limit_begin);
|
||||
ObjectTypeDB::bind_method(_MD("set_limit_end","ofs"),&ParallaxBackground::set_limit_end);
|
||||
ObjectTypeDB::bind_method(_MD("get_limit_end"),&ParallaxBackground::get_limit_end);
|
||||
ObjectTypeDB::bind_method(_MD("set_ignore_camera_zoom"), &ParallaxBackground::set_ignore_camera_zoom);
|
||||
ObjectTypeDB::bind_method(_MD("is_ignore_camera_zoom"), &ParallaxBackground::is_ignore_camera_zoom);
|
||||
|
||||
|
||||
ADD_PROPERTY( PropertyInfo(Variant::VECTOR2,"scroll/offset"),_SCS("set_scroll_offset"),_SCS("get_scroll_offset"));
|
||||
|
@ -185,6 +202,7 @@ void ParallaxBackground::_bind_methods() {
|
|||
ADD_PROPERTY( PropertyInfo(Variant::VECTOR2,"scroll/base_scale"),_SCS("set_scroll_base_scale"),_SCS("get_scroll_base_scale"));
|
||||
ADD_PROPERTY( PropertyInfo(Variant::VECTOR2,"scroll/limit_begin"),_SCS("set_limit_begin"),_SCS("get_limit_begin"));
|
||||
ADD_PROPERTY( PropertyInfo(Variant::VECTOR2,"scroll/limit_end"),_SCS("set_limit_end"),_SCS("get_limit_end"));
|
||||
ADD_PROPERTY( PropertyInfo(Variant::BOOL, "scroll/ignore_camera_zoom"), _SCS("set_ignore_camera_zoom"), _SCS("is_ignore_camera_zoom"));
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -44,6 +44,7 @@ class ParallaxBackground : public CanvasLayer {
|
|||
String group_name;
|
||||
Point2 limit_begin;
|
||||
Point2 limit_end;
|
||||
bool ignore_camera_zoom;
|
||||
|
||||
void _update_scroll();
|
||||
protected:
|
||||
|
@ -72,6 +73,9 @@ public:
|
|||
void set_limit_end(const Point2& p_ofs);
|
||||
Point2 get_limit_end() const;
|
||||
|
||||
void set_ignore_camera_zoom(bool ignore);
|
||||
bool is_ignore_camera_zoom();
|
||||
|
||||
ParallaxBackground();
|
||||
};
|
||||
|
||||
|
|
|
@ -53,6 +53,16 @@ uint32_t RayCast2D::get_layer_mask() const {
|
|||
return layer_mask;
|
||||
}
|
||||
|
||||
void RayCast2D::set_type_mask(uint32_t p_mask) {
|
||||
|
||||
type_mask=p_mask;
|
||||
}
|
||||
|
||||
uint32_t RayCast2D::get_type_mask() const {
|
||||
|
||||
return type_mask;
|
||||
}
|
||||
|
||||
bool RayCast2D::is_colliding() const{
|
||||
|
||||
return collided;
|
||||
|
@ -162,7 +172,7 @@ void RayCast2D::_notification(int p_what) {
|
|||
|
||||
Physics2DDirectSpaceState::RayResult rr;
|
||||
|
||||
if (dss->intersect_ray(gt.get_origin(),gt.xform(to),rr,exclude,layer_mask)) {
|
||||
if (dss->intersect_ray(gt.get_origin(),gt.xform(to),rr,exclude,layer_mask,type_mask)) {
|
||||
|
||||
collided=true;
|
||||
against=rr.collider_id;
|
||||
|
@ -241,9 +251,13 @@ void RayCast2D::_bind_methods() {
|
|||
ObjectTypeDB::bind_method(_MD("set_layer_mask","mask"),&RayCast2D::set_layer_mask);
|
||||
ObjectTypeDB::bind_method(_MD("get_layer_mask"),&RayCast2D::get_layer_mask);
|
||||
|
||||
ObjectTypeDB::bind_method(_MD("set_type_mask","mask"),&RayCast2D::set_type_mask);
|
||||
ObjectTypeDB::bind_method(_MD("get_type_mask"),&RayCast2D::get_type_mask);
|
||||
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL,"enabled"),_SCS("set_enabled"),_SCS("is_enabled"));
|
||||
ADD_PROPERTY(PropertyInfo(Variant::VECTOR2,"cast_to"),_SCS("set_cast_to"),_SCS("get_cast_to"));
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT,"layer_mask",PROPERTY_HINT_ALL_FLAGS),_SCS("set_layer_mask"),_SCS("get_layer_mask"));
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT,"type_mask",PROPERTY_HINT_FLAGS,"Static,Kinematic,Rigid,Character,Area"),_SCS("set_type_mask"),_SCS("get_type_mask"));
|
||||
}
|
||||
|
||||
RayCast2D::RayCast2D() {
|
||||
|
@ -253,5 +267,6 @@ RayCast2D::RayCast2D() {
|
|||
collided=false;
|
||||
against_shape=0;
|
||||
layer_mask=1;
|
||||
type_mask=Physics2DDirectSpaceState::TYPE_MASK_COLLISION;
|
||||
cast_to=Vector2(0,50);
|
||||
}
|
||||
|
|
|
@ -44,6 +44,7 @@ class RayCast2D : public Node2D {
|
|||
Vector2 collision_normal;
|
||||
Set<RID> exclude;
|
||||
uint32_t layer_mask;
|
||||
uint32_t type_mask;
|
||||
|
||||
|
||||
Vector2 cast_to;
|
||||
|
@ -62,6 +63,9 @@ public:
|
|||
void set_layer_mask(uint32_t p_mask);
|
||||
uint32_t get_layer_mask() const;
|
||||
|
||||
void set_type_mask(uint32_t p_mask);
|
||||
uint32_t get_type_mask() const;
|
||||
|
||||
bool is_colliding() const;
|
||||
Object *get_collider() const;
|
||||
int get_collider_shape() const;
|
||||
|
|
|
@ -81,7 +81,7 @@ float BakedLightSampler::get_param(Param p_param) const{
|
|||
|
||||
void BakedLightSampler::set_resolution(int p_resolution){
|
||||
|
||||
ERR_FAIL_COND(p_resolution<4 && p_resolution>32);
|
||||
ERR_FAIL_COND(p_resolution<4 || p_resolution>32);
|
||||
resolution=p_resolution;
|
||||
VS::get_singleton()->baked_light_sampler_set_resolution(base,resolution);
|
||||
}
|
||||
|
|
|
@ -126,7 +126,7 @@ void CollisionPolygon::_notification(int p_what) {
|
|||
|
||||
} break;
|
||||
case NOTIFICATION_LOCAL_TRANSFORM_CHANGED: {
|
||||
if (!can_update_body && shape_from>=0 && shape_from>=0) {
|
||||
if (!can_update_body && shape_from>=0 && shape_to>=0) {
|
||||
|
||||
CollisionObject *co = get_parent()->cast_to<CollisionObject>();
|
||||
if (co) {
|
||||
|
|
|
@ -2713,6 +2713,21 @@ void Control::warp_mouse(const Point2& p_to_pos) {
|
|||
get_viewport()->warp_mouse(get_global_transform().xform(p_to_pos));
|
||||
}
|
||||
|
||||
|
||||
bool Control::is_text_field() const {
|
||||
/*
|
||||
if (get_script_instance()) {
|
||||
Variant v=p_point;
|
||||
const Variant *p[2]={&v,&p_data};
|
||||
Variant::CallError ce;
|
||||
Variant ret = get_script_instance()->call("is_text_field",p,2,ce);
|
||||
if (ce.error==Variant::CallError::CALL_OK)
|
||||
return ret;
|
||||
}
|
||||
*/
|
||||
return false;
|
||||
}
|
||||
|
||||
void Control::_bind_methods() {
|
||||
|
||||
ObjectTypeDB::bind_method(_MD("_window_input_event"),&Control::_window_input_event);
|
||||
|
|
|
@ -382,6 +382,8 @@ public:
|
|||
|
||||
void warp_mouse(const Point2& p_to_pos);
|
||||
|
||||
virtual bool is_text_field() const;
|
||||
|
||||
Control();
|
||||
~Control();
|
||||
|
||||
|
|
|
@ -141,9 +141,6 @@ 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();
|
||||
}
|
||||
|
||||
|
@ -172,7 +169,6 @@ void GraphEdit::remove_child_notify(Node *p_child) {
|
|||
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();
|
||||
|
||||
|
@ -491,7 +487,8 @@ void GraphEdit::_top_layer_draw() {
|
|||
connections.erase(to_erase.front()->get());
|
||||
to_erase.pop_front();
|
||||
}
|
||||
//draw connections
|
||||
if (box_selecting)
|
||||
top_layer->draw_rect(box_selecting_rect,Color(0.7,0.7,1.0,0.3));
|
||||
}
|
||||
|
||||
void GraphEdit::_input_event(const InputEvent& p_ev) {
|
||||
|
@ -500,6 +497,187 @@ void GraphEdit::_input_event(const InputEvent& p_ev) {
|
|||
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 );
|
||||
}
|
||||
|
||||
if (p_ev.type==InputEvent::MOUSE_MOTION && dragging) {
|
||||
|
||||
just_selected=true;
|
||||
drag_accum+=Vector2(p_ev.mouse_motion.relative_x,p_ev.mouse_motion.relative_y);
|
||||
for(int i=get_child_count()-1;i>=0;i--) {
|
||||
GraphNode *gn=get_child(i)->cast_to<GraphNode>();
|
||||
if (gn && gn->is_selected())
|
||||
gn->set_offset(gn->get_drag_from()+drag_accum);
|
||||
}
|
||||
}
|
||||
|
||||
if (p_ev.type==InputEvent::MOUSE_MOTION && box_selecting) {
|
||||
box_selecting_to = get_local_mouse_pos();
|
||||
|
||||
box_selecting_rect = Rect2(MIN(box_selecting_from.x,box_selecting_to.x),
|
||||
MIN(box_selecting_from.y,box_selecting_to.y),
|
||||
ABS(box_selecting_from.x-box_selecting_to.x),
|
||||
ABS(box_selecting_from.y-box_selecting_to.y));
|
||||
|
||||
for(int i=get_child_count()-1;i>=0;i--) {
|
||||
|
||||
GraphNode *gn=get_child(i)->cast_to<GraphNode>();
|
||||
if (!gn)
|
||||
continue;
|
||||
|
||||
bool in_box = gn->get_rect().intersects(box_selecting_rect);
|
||||
|
||||
if (in_box)
|
||||
gn->set_selected(box_selection_mode_aditive);
|
||||
else
|
||||
gn->set_selected(previus_selected.find(gn)!=NULL);
|
||||
}
|
||||
|
||||
top_layer->update();
|
||||
}
|
||||
|
||||
if (p_ev.type==InputEvent::MOUSE_BUTTON) {
|
||||
|
||||
const InputEventMouseButton &b=p_ev.mouse_button;
|
||||
|
||||
if (b.button_index==BUTTON_RIGHT && b.pressed)
|
||||
{
|
||||
if (box_selecting) {
|
||||
box_selecting = false;
|
||||
for(int i=get_child_count()-1;i>=0;i--) {
|
||||
|
||||
GraphNode *gn=get_child(i)->cast_to<GraphNode>();
|
||||
if (!gn)
|
||||
continue;
|
||||
|
||||
gn->set_selected(previus_selected.find(gn)!=NULL);
|
||||
}
|
||||
top_layer->update();
|
||||
} else {
|
||||
emit_signal("popup_request", Vector2(b.global_x, b.global_y));
|
||||
}
|
||||
}
|
||||
|
||||
if (b.button_index==BUTTON_LEFT && !b.pressed && dragging) {
|
||||
if (!just_selected && drag_accum==Vector2() && Input::get_singleton()->is_key_pressed(KEY_CONTROL)) {
|
||||
//deselect current node
|
||||
for(int i=get_child_count()-1;i>=0;i--) {
|
||||
GraphNode *gn=get_child(i)->cast_to<GraphNode>();
|
||||
|
||||
if (gn && gn->get_rect().has_point(get_local_mouse_pos()))
|
||||
gn->set_selected(false);
|
||||
}
|
||||
}
|
||||
|
||||
if (drag_accum!=Vector2()) {
|
||||
|
||||
emit_signal("_begin_node_move");
|
||||
|
||||
for(int i=get_child_count()-1;i>=0;i--) {
|
||||
GraphNode *gn=get_child(i)->cast_to<GraphNode>();
|
||||
if (gn && gn->is_selected())
|
||||
gn->set_drag(false);
|
||||
}
|
||||
|
||||
emit_signal("_end_node_move");
|
||||
}
|
||||
|
||||
dragging = false;
|
||||
|
||||
top_layer->update();
|
||||
}
|
||||
|
||||
if (b.button_index==BUTTON_LEFT && b.pressed) {
|
||||
|
||||
GraphNode *gn;
|
||||
for(int i=get_child_count()-1;i>=0;i--) {
|
||||
|
||||
gn=get_child(i)->cast_to<GraphNode>();
|
||||
|
||||
if (gn && gn->get_rect().has_point(get_local_mouse_pos()))
|
||||
break;
|
||||
}
|
||||
|
||||
if (gn) {
|
||||
|
||||
if (_filter_input(Vector2(b.x,b.y)))
|
||||
return;
|
||||
|
||||
dragging = true;
|
||||
drag_accum = Vector2();
|
||||
just_selected = !gn->is_selected();
|
||||
if(!gn->is_selected() && !Input::get_singleton()->is_key_pressed(KEY_CONTROL)) {
|
||||
for (int i = 0; i < get_child_count(); i++) {
|
||||
GraphNode *o_gn = get_child(i)->cast_to<GraphNode>();
|
||||
if (o_gn)
|
||||
o_gn->set_selected(o_gn == gn);
|
||||
}
|
||||
}
|
||||
|
||||
gn->set_selected(true);
|
||||
for (int i = 0; i < get_child_count(); i++) {
|
||||
GraphNode *o_gn = get_child(i)->cast_to<GraphNode>();
|
||||
if (!o_gn)
|
||||
continue;
|
||||
if (o_gn->is_selected())
|
||||
o_gn->set_drag(true);
|
||||
}
|
||||
|
||||
} else {
|
||||
box_selecting = true;
|
||||
box_selecting_from = get_local_mouse_pos();
|
||||
if (b.mod.control) {
|
||||
box_selection_mode_aditive = true;
|
||||
previus_selected.clear();
|
||||
for(int i=get_child_count()-1;i>=0;i--) {
|
||||
|
||||
GraphNode *gn=get_child(i)->cast_to<GraphNode>();
|
||||
if (!gn || !gn->is_selected())
|
||||
continue;
|
||||
|
||||
previus_selected.push_back(gn);
|
||||
}
|
||||
} else if (b.mod.shift) {
|
||||
box_selection_mode_aditive = false;
|
||||
previus_selected.clear();
|
||||
for(int i=get_child_count()-1;i>=0;i--) {
|
||||
|
||||
GraphNode *gn=get_child(i)->cast_to<GraphNode>();
|
||||
if (!gn || !gn->is_selected())
|
||||
continue;
|
||||
|
||||
previus_selected.push_back(gn);
|
||||
}
|
||||
} else {
|
||||
box_selection_mode_aditive = true;
|
||||
previus_selected.clear();
|
||||
for(int i=get_child_count()-1;i>=0;i--) {
|
||||
|
||||
GraphNode *gn=get_child(i)->cast_to<GraphNode>();
|
||||
if (!gn)
|
||||
continue;
|
||||
|
||||
gn->set_selected(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (b.button_index==BUTTON_LEFT && !b.pressed && box_selecting) {
|
||||
box_selecting = false;
|
||||
previus_selected.clear();
|
||||
top_layer->update();
|
||||
}
|
||||
}
|
||||
|
||||
if (p_ev.type==InputEvent::KEY && p_ev.key.scancode==KEY_D && p_ev.key.pressed && p_ev.key.mod.command) {
|
||||
emit_signal("duplicate_nodes_request");
|
||||
accept_event();
|
||||
}
|
||||
|
||||
if (p_ev.type==InputEvent::KEY && p_ev.key.scancode==KEY_DELETE && p_ev.key.pressed) {
|
||||
emit_signal("delete_nodes_request");
|
||||
accept_event();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void GraphEdit::clear_connections() {
|
||||
|
@ -555,12 +733,18 @@ void GraphEdit::_bind_methods() {
|
|||
|
||||
ADD_SIGNAL(MethodInfo("connection_request",PropertyInfo(Variant::STRING,"from"),PropertyInfo(Variant::INT,"from_slot"),PropertyInfo(Variant::STRING,"to"),PropertyInfo(Variant::INT,"to_slot")));
|
||||
ADD_SIGNAL(MethodInfo("disconnection_request",PropertyInfo(Variant::STRING,"from"),PropertyInfo(Variant::INT,"from_slot"),PropertyInfo(Variant::STRING,"to"),PropertyInfo(Variant::INT,"to_slot")));
|
||||
|
||||
ADD_SIGNAL(MethodInfo("popup_request", PropertyInfo(Variant::VECTOR2,"p_position")));
|
||||
ADD_SIGNAL(MethodInfo("duplicate_nodes_request"));
|
||||
ADD_SIGNAL(MethodInfo("delete_nodes_request"));
|
||||
ADD_SIGNAL(MethodInfo("_begin_node_move"));
|
||||
ADD_SIGNAL(MethodInfo("_end_node_move"));
|
||||
}
|
||||
|
||||
|
||||
|
||||
GraphEdit::GraphEdit() {
|
||||
set_focus_mode(FOCUS_ALL);
|
||||
|
||||
top_layer=NULL;
|
||||
top_layer=memnew(GraphEditFilter(this));
|
||||
add_child(top_layer);
|
||||
|
@ -581,6 +765,9 @@ GraphEdit::GraphEdit() {
|
|||
connecting=false;
|
||||
right_disconnects=false;
|
||||
|
||||
box_selecting = false;
|
||||
dragging = false;
|
||||
|
||||
h_scroll->connect("value_changed", this,"_scroll_moved");
|
||||
v_scroll->connect("value_changed", this,"_scroll_moved");
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ class GraphEditFilter : public Control {
|
|||
|
||||
OBJ_TYPE(GraphEditFilter,Control);
|
||||
|
||||
friend class GraphEdit;
|
||||
friend class GraphEdit;
|
||||
GraphEdit *ge;
|
||||
virtual bool has_point(const Point2& p_point) const;
|
||||
|
||||
|
@ -49,7 +49,16 @@ private:
|
|||
String connecting_target_to;
|
||||
int connecting_target_index;
|
||||
|
||||
bool dragging;
|
||||
bool just_selected;
|
||||
Vector2 drag_accum;
|
||||
|
||||
bool box_selecting;
|
||||
bool box_selection_mode_aditive;
|
||||
Point2 box_selecting_from;
|
||||
Point2 box_selecting_to;
|
||||
Rect2 box_selecting_rect;
|
||||
List<GraphNode*> previus_selected;
|
||||
|
||||
bool right_disconnects;
|
||||
bool updating;
|
||||
|
@ -71,7 +80,7 @@ private:
|
|||
|
||||
Array _get_connection_list() const;
|
||||
|
||||
friend class GraphEditFilter;
|
||||
friend class GraphEditFilter;
|
||||
bool _filter_input(const Point2& p_point);
|
||||
protected:
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ bool GraphNode::_get(const StringName& p_name,Variant &r_ret) const{
|
|||
|
||||
|
||||
|
||||
if (!p_name.operator String().begins_with("slot/")) {
|
||||
if (!p_name.operator String().begins_with("slot/")) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -160,7 +160,7 @@ void GraphNode::_notification(int p_what) {
|
|||
|
||||
if (p_what==NOTIFICATION_DRAW) {
|
||||
|
||||
Ref<StyleBox> sb=get_stylebox("frame");
|
||||
Ref<StyleBox> sb=get_stylebox(selected ? "selectedframe" : "frame");
|
||||
Ref<Texture> port =get_icon("port");
|
||||
Ref<Texture> close =get_icon("close");
|
||||
int close_offset = get_constant("close_offset");
|
||||
|
@ -360,6 +360,29 @@ Vector2 GraphNode::get_offset() const {
|
|||
return offset;
|
||||
}
|
||||
|
||||
void GraphNode::set_selected(bool p_selected)
|
||||
{
|
||||
selected = p_selected;
|
||||
update();
|
||||
}
|
||||
|
||||
bool GraphNode::is_selected()
|
||||
{
|
||||
return selected;
|
||||
}
|
||||
|
||||
void GraphNode::set_drag(bool p_drag)
|
||||
{
|
||||
if (p_drag)
|
||||
drag_from=get_offset();
|
||||
else
|
||||
emit_signal("dragged",drag_from,get_offset()); //useful for undo/redo
|
||||
}
|
||||
|
||||
Vector2 GraphNode::get_drag_from()
|
||||
{
|
||||
return drag_from;
|
||||
}
|
||||
|
||||
|
||||
void GraphNode::set_show_close_button(bool p_enable){
|
||||
|
@ -379,7 +402,6 @@ void GraphNode::_connpos_update() {
|
|||
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;
|
||||
|
@ -503,31 +525,17 @@ Color GraphNode::get_connection_output_color(int p_idx) {
|
|||
|
||||
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) {
|
||||
if (p_ev.type==InputEvent::MOUSE_BUTTON) {
|
||||
get_parent_control()->grab_focus();
|
||||
if(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;
|
||||
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;
|
||||
}
|
||||
emit_signal("raise_request");
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -576,8 +584,6 @@ void GraphNode::_bind_methods() {
|
|||
}
|
||||
|
||||
GraphNode::GraphNode() {
|
||||
|
||||
dragging=false;
|
||||
show_close=false;
|
||||
connpos_dirty=true;
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ class GraphNode : public Container {
|
|||
Color color_right;
|
||||
|
||||
|
||||
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;
|
||||
|
@ -46,8 +46,7 @@ class GraphNode : public Container {
|
|||
void _resort();
|
||||
|
||||
Vector2 drag_from;
|
||||
Vector2 drag_accum;
|
||||
bool dragging;
|
||||
bool selected;
|
||||
protected:
|
||||
|
||||
void _input_event(const InputEvent& p_ev);
|
||||
|
@ -79,6 +78,12 @@ public:
|
|||
void set_offset(const Vector2& p_offset);
|
||||
Vector2 get_offset() const;
|
||||
|
||||
void set_selected(bool p_selected);
|
||||
bool is_selected();
|
||||
|
||||
void set_drag(bool p_drag);
|
||||
Vector2 get_drag_from();
|
||||
|
||||
void set_show_close_button(bool p_enable);
|
||||
bool is_close_button_visible() const;
|
||||
|
||||
|
|
|
@ -782,6 +782,10 @@ void LineEdit::select(int p_from, int p_to) {
|
|||
update();
|
||||
}
|
||||
|
||||
bool LineEdit::is_text_field() const {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void LineEdit::_bind_methods() {
|
||||
|
||||
|
|
|
@ -112,6 +112,8 @@ public:
|
|||
void select(int p_from=0, int p_to=-1);
|
||||
|
||||
virtual Size2 get_minimum_size() const;
|
||||
|
||||
virtual bool is_text_field() const;
|
||||
LineEdit();
|
||||
~LineEdit();
|
||||
|
||||
|
|
|
@ -323,8 +323,10 @@ void PopupMenu::_input_event(const InputEvent &p_event) {
|
|||
invalidated_click=false;
|
||||
break;
|
||||
}
|
||||
if (over<0 || items[over].separator || items[over].disabled)
|
||||
if (over<0 || items[over].separator || items[over].disabled) {
|
||||
hide();
|
||||
break; //non-activable
|
||||
}
|
||||
|
||||
if (items[over].submenu!="") {
|
||||
|
||||
|
@ -738,10 +740,18 @@ int PopupMenu::find_item_by_accelerator(uint32_t p_accel) const {
|
|||
|
||||
void PopupMenu::activate_item(int p_item) {
|
||||
|
||||
|
||||
ERR_FAIL_INDEX(p_item,items.size());
|
||||
ERR_FAIL_COND(items[p_item].separator);
|
||||
emit_signal("item_pressed",items[p_item].ID);
|
||||
|
||||
//hide all parent PopupMenue's
|
||||
Node *next = get_parent();
|
||||
PopupMenu *pop = next->cast_to<PopupMenu>();
|
||||
while (pop) {
|
||||
pop->hide();
|
||||
next = next->get_parent();
|
||||
pop = next->cast_to<PopupMenu>();
|
||||
}
|
||||
hide();
|
||||
|
||||
}
|
||||
|
|
|
@ -1503,10 +1503,10 @@ Error RichTextLabel::append_bbcode(const String& p_bbcode) {
|
|||
|
||||
void RichTextLabel::scroll_to_line(int p_line) {
|
||||
|
||||
p_line -= 1;
|
||||
ERR_FAIL_INDEX(p_line,lines.size());
|
||||
_validate_line_caches();
|
||||
vscroll->set_val(lines[p_line].height_accum_cache);
|
||||
|
||||
vscroll->set_val(lines[p_line].height_accum_cache-lines[p_line].height_cache);
|
||||
|
||||
}
|
||||
|
||||
|
@ -1569,27 +1569,23 @@ bool RichTextLabel::search(const String& p_string,bool p_from_selection) {
|
|||
it=_get_next_item(it);
|
||||
}
|
||||
|
||||
if (!it)
|
||||
line=lines.size()-1;
|
||||
}
|
||||
|
||||
scroll_to_line(line-2);
|
||||
if (line > 1) {
|
||||
line-=1;
|
||||
}
|
||||
|
||||
scroll_to_line(line);
|
||||
|
||||
return true;
|
||||
}
|
||||
} else if (it->type==ITEM_NEWLINE) {
|
||||
|
||||
line=static_cast<ItemNewline*>(it)->line;
|
||||
}
|
||||
|
||||
|
||||
it=_get_next_item(it);
|
||||
charidx=0;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
|
|
@ -64,6 +64,15 @@ Size2 Tabs::get_minimum_size() const {
|
|||
ms.width+=bms.width;
|
||||
ms.height=MAX(bms.height+tab_bg->get_minimum_size().height,ms.height);
|
||||
}
|
||||
|
||||
if (tabs[i].close_button.is_valid()) {
|
||||
Ref<Texture> cb=tabs[i].close_button;
|
||||
Size2 bms = cb->get_size()+get_stylebox("button")->get_minimum_size();
|
||||
bms.width+=get_constant("hseparation");
|
||||
|
||||
ms.width+=bms.width;
|
||||
ms.height=MAX(bms.height+tab_bg->get_minimum_size().height,ms.height);
|
||||
}
|
||||
}
|
||||
|
||||
return ms;
|
||||
|
@ -77,22 +86,48 @@ void Tabs::_input_event(const InputEvent& p_event) {
|
|||
|
||||
Point2 pos( p_event.mouse_motion.x, p_event.mouse_motion.y );
|
||||
|
||||
int hover=-1;
|
||||
int hover_buttons=-1;
|
||||
hover=-1;
|
||||
for(int i=0;i<tabs.size();i++) {
|
||||
|
||||
// test hovering tab to display close button if policy says so
|
||||
if (cb_displaypolicy == SHOW_HOVER) {
|
||||
int ofs=tabs[i].ofs_cache;
|
||||
int size = tabs[i].ofs_cache;
|
||||
if (pos.x >=tabs[i].ofs_cache && pos.x<tabs[i].ofs_cache+tabs[i].size_cache) {
|
||||
hover=i;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// test hovering right button and close button
|
||||
if (tabs[i].rb_rect.has_point(pos)) {
|
||||
hover=i;
|
||||
rb_hover=i;
|
||||
hover_buttons = i;
|
||||
break;
|
||||
}
|
||||
else if (tabs[i].cb_rect.has_point(pos)) {
|
||||
cb_hover=i;
|
||||
hover_buttons = i;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
if (hover!=rb_hover) {
|
||||
rb_hover=hover;
|
||||
update();
|
||||
if (hover_buttons == -1) { // no hover
|
||||
rb_hover= hover_buttons;
|
||||
cb_hover= hover_buttons;
|
||||
}
|
||||
update();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
if (rb_pressing && p_event.type==InputEvent::MOUSE_BUTTON &&
|
||||
!p_event.mouse_button.pressed &&
|
||||
p_event.mouse_button.button_index==BUTTON_LEFT) {
|
||||
|
@ -106,6 +141,20 @@ void Tabs::_input_event(const InputEvent& p_event) {
|
|||
update();
|
||||
}
|
||||
|
||||
if (cb_pressing && p_event.type==InputEvent::MOUSE_BUTTON &&
|
||||
!p_event.mouse_button.pressed &&
|
||||
p_event.mouse_button.button_index==BUTTON_LEFT) {
|
||||
|
||||
if (cb_hover!=-1) {
|
||||
//pressed
|
||||
emit_signal("tab_close",cb_hover);
|
||||
}
|
||||
|
||||
cb_pressing=false;
|
||||
update();
|
||||
}
|
||||
|
||||
|
||||
if (p_event.type==InputEvent::MOUSE_BUTTON &&
|
||||
p_event.mouse_button.pressed &&
|
||||
p_event.mouse_button.button_index==BUTTON_LEFT) {
|
||||
|
@ -122,6 +171,12 @@ void Tabs::_input_event(const InputEvent& p_event) {
|
|||
return;
|
||||
}
|
||||
|
||||
if (tabs[i].cb_rect.has_point(pos)) {
|
||||
cb_pressing=true;
|
||||
update();
|
||||
return;
|
||||
}
|
||||
|
||||
int ofs=tabs[i].ofs_cache;
|
||||
int size = tabs[i].ofs_cache;
|
||||
if (pos.x >=tabs[i].ofs_cache && pos.x<tabs[i].ofs_cache+tabs[i].size_cache) {
|
||||
|
@ -148,6 +203,8 @@ void Tabs::_notification(int p_what) {
|
|||
|
||||
case NOTIFICATION_MOUSE_EXIT: {
|
||||
rb_hover=-1;
|
||||
cb_hover=-1;
|
||||
hover=-1;
|
||||
update();
|
||||
} break;
|
||||
case NOTIFICATION_DRAW: {
|
||||
|
@ -186,7 +243,7 @@ void Tabs::_notification(int p_what) {
|
|||
|
||||
String s = tabs[i].text;
|
||||
int lsize=0;
|
||||
int slen=font->get_string_size(s).width;;
|
||||
int slen=font->get_string_size(s).width;
|
||||
lsize+=slen;
|
||||
|
||||
Ref<Texture> icon;
|
||||
|
@ -211,6 +268,56 @@ void Tabs::_notification(int p_what) {
|
|||
|
||||
}
|
||||
|
||||
// Close button
|
||||
switch (cb_displaypolicy) {
|
||||
case SHOW_ALWAYS: {
|
||||
if (tabs[i].close_button.is_valid()) {
|
||||
Ref<StyleBox> style = get_stylebox("button");
|
||||
Ref<Texture> rb=tabs[i].close_button;
|
||||
|
||||
lsize+=get_constant("hseparation");
|
||||
lsize+=style->get_margin(MARGIN_LEFT);
|
||||
lsize+=rb->get_width();
|
||||
lsize+=style->get_margin(MARGIN_RIGHT);
|
||||
|
||||
}
|
||||
} break;
|
||||
case SHOW_ACTIVE_ONLY: {
|
||||
if (i==current) {
|
||||
if (tabs[i].close_button.is_valid()) {
|
||||
Ref<StyleBox> style = get_stylebox("button");
|
||||
Ref<Texture> rb=tabs[i].close_button;
|
||||
|
||||
lsize+=get_constant("hseparation");
|
||||
lsize+=style->get_margin(MARGIN_LEFT);
|
||||
lsize+=rb->get_width();
|
||||
lsize+=style->get_margin(MARGIN_RIGHT);
|
||||
|
||||
}
|
||||
}
|
||||
} break;
|
||||
case SHOW_HOVER: {
|
||||
if (i==current || i==hover) {
|
||||
if (tabs[i].close_button.is_valid()) {
|
||||
Ref<StyleBox> style = get_stylebox("button");
|
||||
Ref<Texture> rb=tabs[i].close_button;
|
||||
|
||||
lsize+=get_constant("hseparation");
|
||||
lsize+=style->get_margin(MARGIN_LEFT);
|
||||
lsize+=rb->get_width();
|
||||
lsize+=style->get_margin(MARGIN_RIGHT);
|
||||
|
||||
}
|
||||
}
|
||||
} break;
|
||||
case SHOW_NEVER: // by default, never show close button
|
||||
default: {
|
||||
// do nothing
|
||||
} break;
|
||||
|
||||
}
|
||||
|
||||
|
||||
Ref<StyleBox> sb;
|
||||
int va;
|
||||
Color col;
|
||||
|
@ -273,6 +380,103 @@ void Tabs::_notification(int p_what) {
|
|||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// Close button
|
||||
switch (cb_displaypolicy) {
|
||||
case SHOW_ALWAYS: {
|
||||
if (tabs[i].close_button.is_valid()) {
|
||||
Ref<StyleBox> style = get_stylebox("button");
|
||||
Ref<Texture> cb=tabs[i].close_button;
|
||||
|
||||
w+=get_constant("hseparation");
|
||||
|
||||
Rect2 cb_rect;
|
||||
cb_rect.size=style->get_minimum_size()+cb->get_size();
|
||||
cb_rect.pos.x=w;
|
||||
cb_rect.pos.y=sb->get_margin(MARGIN_TOP)+((sb_rect.size.y-sb_ms.y)-(cb_rect.size.y))/2;
|
||||
|
||||
if (cb_hover==i) {
|
||||
if (cb_pressing)
|
||||
get_stylebox("button_pressed")->draw(ci,cb_rect);
|
||||
else
|
||||
style->draw(ci,cb_rect);
|
||||
}
|
||||
|
||||
w+=style->get_margin(MARGIN_LEFT);
|
||||
|
||||
cb->draw(ci,Point2i( w,cb_rect.pos.y+style->get_margin(MARGIN_TOP) ));
|
||||
w+=cb->get_width();
|
||||
w+=style->get_margin(MARGIN_RIGHT);
|
||||
tabs[i].cb_rect=cb_rect;
|
||||
}
|
||||
} break;
|
||||
case SHOW_ACTIVE_ONLY: {
|
||||
if (current==i) {
|
||||
if (tabs[i].close_button.is_valid()) {
|
||||
Ref<StyleBox> style = get_stylebox("button");
|
||||
Ref<Texture> cb=tabs[i].close_button;
|
||||
|
||||
w+=get_constant("hseparation");
|
||||
|
||||
Rect2 cb_rect;
|
||||
cb_rect.size=style->get_minimum_size()+cb->get_size();
|
||||
cb_rect.pos.x=w;
|
||||
cb_rect.pos.y=sb->get_margin(MARGIN_TOP)+((sb_rect.size.y-sb_ms.y)-(cb_rect.size.y))/2;
|
||||
|
||||
if (cb_hover==i) {
|
||||
if (cb_pressing)
|
||||
get_stylebox("button_pressed")->draw(ci,cb_rect);
|
||||
else
|
||||
style->draw(ci,cb_rect);
|
||||
}
|
||||
|
||||
w+=style->get_margin(MARGIN_LEFT);
|
||||
|
||||
cb->draw(ci,Point2i( w,cb_rect.pos.y+style->get_margin(MARGIN_TOP) ));
|
||||
w+=cb->get_width();
|
||||
w+=style->get_margin(MARGIN_RIGHT);
|
||||
tabs[i].cb_rect=cb_rect;
|
||||
}
|
||||
}
|
||||
} break;
|
||||
case SHOW_HOVER: {
|
||||
if (current==i || hover==i) {
|
||||
if (tabs[i].close_button.is_valid()) {
|
||||
Ref<StyleBox> style = get_stylebox("button");
|
||||
Ref<Texture> cb=tabs[i].close_button;
|
||||
|
||||
w+=get_constant("hseparation");
|
||||
|
||||
Rect2 cb_rect;
|
||||
cb_rect.size=style->get_minimum_size()+cb->get_size();
|
||||
cb_rect.pos.x=w;
|
||||
cb_rect.pos.y=sb->get_margin(MARGIN_TOP)+((sb_rect.size.y-sb_ms.y)-(cb_rect.size.y))/2;
|
||||
|
||||
if (cb_hover==i) {
|
||||
if (cb_pressing)
|
||||
get_stylebox("button_pressed")->draw(ci,cb_rect);
|
||||
else
|
||||
style->draw(ci,cb_rect);
|
||||
}
|
||||
|
||||
w+=style->get_margin(MARGIN_LEFT);
|
||||
|
||||
cb->draw(ci,Point2i( w,cb_rect.pos.y+style->get_margin(MARGIN_TOP) ));
|
||||
w+=cb->get_width();
|
||||
w+=style->get_margin(MARGIN_RIGHT);
|
||||
tabs[i].cb_rect=cb_rect;
|
||||
}
|
||||
}
|
||||
} break;
|
||||
case SHOW_NEVER:
|
||||
default: {
|
||||
// show nothing
|
||||
} break;
|
||||
|
||||
}
|
||||
|
||||
w+=sb->get_margin(MARGIN_RIGHT);
|
||||
|
||||
tabs[i].size_cache=w-tabs[i].ofs_cache;
|
||||
|
@ -358,11 +562,29 @@ Ref<Texture> Tabs::get_tab_right_button(int p_tab) const{
|
|||
|
||||
}
|
||||
|
||||
void Tabs::set_tab_close_button(int p_tab, const Ref<Texture>& p_close_button) {
|
||||
ERR_FAIL_INDEX(p_tab, tabs.size());
|
||||
tabs[p_tab].close_button=p_close_button;
|
||||
update();
|
||||
minimum_size_changed();
|
||||
}
|
||||
|
||||
|
||||
Ref<Texture> Tabs::get_tab_close_button(int p_tab) const{
|
||||
|
||||
ERR_FAIL_INDEX_V(p_tab,tabs.size(),Ref<Texture>());
|
||||
return tabs[p_tab].close_button;
|
||||
|
||||
}
|
||||
|
||||
void Tabs::add_tab(const String& p_str,const Ref<Texture>& p_icon) {
|
||||
|
||||
Tab t;
|
||||
t.text=p_str;
|
||||
t.icon=p_icon;
|
||||
|
||||
t.close_button = get_icon("Close","EditorIcons");
|
||||
|
||||
tabs.push_back(t);
|
||||
|
||||
update();
|
||||
|
@ -394,6 +616,11 @@ void Tabs::remove_tab(int p_idx) {
|
|||
|
||||
}
|
||||
|
||||
void Tabs::set_tab_close_display_policy(CloseButtonDisplayPolicy p_cb_displaypolicy) {
|
||||
cb_displaypolicy = p_cb_displaypolicy;
|
||||
}
|
||||
|
||||
|
||||
void Tabs::set_tab_align(TabAlign p_align) {
|
||||
|
||||
tab_align=p_align;
|
||||
|
@ -423,14 +650,22 @@ void Tabs::_bind_methods() {
|
|||
|
||||
ADD_SIGNAL(MethodInfo("tab_changed",PropertyInfo(Variant::INT,"tab")));
|
||||
ADD_SIGNAL(MethodInfo("right_button_pressed",PropertyInfo(Variant::INT,"tab")));
|
||||
ADD_SIGNAL(MethodInfo("tab_close",PropertyInfo(Variant::INT,"tab")));
|
||||
|
||||
|
||||
ADD_PROPERTY( PropertyInfo(Variant::INT, "current_tab", PROPERTY_HINT_RANGE,"-1,4096,1",PROPERTY_USAGE_EDITOR), _SCS("set_current_tab"), _SCS("get_current_tab") );
|
||||
|
||||
BIND_CONSTANT( ALIGN_LEFT );
|
||||
BIND_CONSTANT( ALIGN_CENTER );
|
||||
BIND_CONSTANT( ALIGN_RIGHT );
|
||||
|
||||
BIND_CONSTANT( SHOW_ACTIVE_ONLY );
|
||||
BIND_CONSTANT( SHOW_ALWAYS );
|
||||
BIND_CONSTANT( SHOW_HOVER );
|
||||
BIND_CONSTANT( SHOW_NEVER );
|
||||
}
|
||||
|
||||
|
||||
Tabs::Tabs() {
|
||||
|
||||
current=0;
|
||||
|
@ -438,4 +673,7 @@ Tabs::Tabs() {
|
|||
rb_hover=-1;
|
||||
rb_pressing=false;
|
||||
|
||||
cb_hover=-1;
|
||||
cb_pressing=false;
|
||||
cb_displaypolicy = SHOW_NEVER; // Default : no close button
|
||||
}
|
||||
|
|
|
@ -42,6 +42,14 @@ public:
|
|||
ALIGN_CENTER,
|
||||
ALIGN_RIGHT
|
||||
};
|
||||
|
||||
enum CloseButtonDisplayPolicy {
|
||||
|
||||
SHOW_ALWAYS,
|
||||
SHOW_ACTIVE_ONLY,
|
||||
SHOW_HOVER,
|
||||
SHOW_NEVER
|
||||
};
|
||||
private:
|
||||
|
||||
|
||||
|
@ -53,6 +61,8 @@ private:
|
|||
int size_cache;
|
||||
Ref<Texture> right_button;
|
||||
Rect2 rb_rect;
|
||||
Ref<Texture> close_button;
|
||||
Rect2 cb_rect;
|
||||
};
|
||||
|
||||
Vector<Tab> tabs;
|
||||
|
@ -63,6 +73,12 @@ private:
|
|||
int rb_hover;
|
||||
bool rb_pressing;
|
||||
|
||||
int cb_hover;
|
||||
bool cb_pressing;
|
||||
CloseButtonDisplayPolicy cb_displaypolicy;
|
||||
|
||||
int hover; // hovered tab
|
||||
|
||||
protected:
|
||||
|
||||
void _input_event(const InputEvent& p_event);
|
||||
|
@ -82,6 +98,10 @@ public:
|
|||
void set_tab_right_button(int p_tab,const Ref<Texture>& p_right_button);
|
||||
Ref<Texture> get_tab_right_button(int p_tab) const;
|
||||
|
||||
void set_tab_close_button(int p_tab, const Ref<Texture>& p_close_button);
|
||||
Ref<Texture> get_tab_close_button(int p_tab) const;
|
||||
void set_tab_close_display_policy(CloseButtonDisplayPolicy p_cb_displaypolicy);
|
||||
|
||||
void set_tab_align(TabAlign p_align);
|
||||
TabAlign get_tab_align() const;
|
||||
|
||||
|
|
|
@ -709,7 +709,7 @@ void TextEdit::_notification(int p_what) {
|
|||
if (in_region==-1 && !in_keyword && is_char && !prev_is_char) {
|
||||
|
||||
int to=j;
|
||||
while(_is_text_char(str[to]) && to<str.length())
|
||||
while(to<str.length() && _is_text_char(str[to]))
|
||||
to++;
|
||||
|
||||
uint32_t hash = String::hash(&str[j],to-j);
|
||||
|
@ -3568,7 +3568,10 @@ void TextEdit::set_show_line_numbers(bool p_show) {
|
|||
update();
|
||||
}
|
||||
|
||||
bool TextEdit::is_text_field() const {
|
||||
|
||||
return true;
|
||||
}
|
||||
void TextEdit::_bind_methods() {
|
||||
|
||||
|
||||
|
|
|
@ -393,6 +393,7 @@ public:
|
|||
|
||||
String get_text_for_completion();
|
||||
|
||||
virtual bool is_text_field() const;
|
||||
TextEdit();
|
||||
~TextEdit();
|
||||
};
|
||||
|
|
|
@ -80,9 +80,50 @@ Ref<Texture> TextureProgress::get_progress_texture() const{
|
|||
|
||||
}
|
||||
|
||||
Point2 TextureProgress::unit_val_to_uv(float val) {
|
||||
if (progress.is_null())
|
||||
return Point2();
|
||||
|
||||
if (val<0)
|
||||
val+=1;
|
||||
if (val>1)
|
||||
val-=1;
|
||||
|
||||
Point2 p=get_relative_center();
|
||||
|
||||
if (val<0.125)
|
||||
return Point2(p.x+(1-p.x)*val*8,0);
|
||||
if (val<0.25)
|
||||
return Point2(1,p.y*(val-0.125)*8);
|
||||
if (val<0.375)
|
||||
return Point2(1,p.y+(1-p.y)*(val-0.25)*8);
|
||||
if (val<0.5)
|
||||
return Point2(1-(1-p.x)*(val-0.375)*8,1);
|
||||
if (val<0.625)
|
||||
return Point2(p.x*(1-(val-0.5)*8),1);
|
||||
if (val<0.75)
|
||||
return Point2(0,1-((1-p.y)*(val-0.625)*8));
|
||||
if (val<0.875)
|
||||
return Point2(0,p.y-p.y*(val-0.75)*8);
|
||||
else
|
||||
return Point2(p.x*(val-0.875)*8,0);
|
||||
}
|
||||
|
||||
Point2 TextureProgress::get_relative_center()
|
||||
{
|
||||
if (progress.is_null())
|
||||
return Point2();
|
||||
Point2 p = progress->get_size()/2;
|
||||
p+=rad_center_off;
|
||||
p.x/=progress->get_width();
|
||||
p.y/=progress->get_height();
|
||||
p.x=CLAMP(p.x,0,1);
|
||||
p.y=CLAMP(p.y,0,1);
|
||||
return p;
|
||||
}
|
||||
|
||||
void TextureProgress::_notification(int p_what){
|
||||
|
||||
const float corners[12]={-0.125,-0.375,-0.625,-0.875,0.125,0.375,0.625,0.875,1.125,1.375,1.625,1.875};
|
||||
switch(p_what) {
|
||||
|
||||
case NOTIFICATION_DRAW: {
|
||||
|
@ -92,7 +133,69 @@ void TextureProgress::_notification(int p_what){
|
|||
draw_texture(under,Point2());
|
||||
if (progress.is_valid()) {
|
||||
Size2 s = progress->get_size();
|
||||
draw_texture_rect_region(progress,Rect2(Point2(),Size2(s.x*get_unit_value(),s.y)),Rect2(Point2(),Size2(s.x*get_unit_value(),s.y)));
|
||||
switch (mode) {
|
||||
case FILL_LEFT_TO_RIGHT: {
|
||||
Rect2 region=Rect2(Point2(),Size2(s.x*get_unit_value(),s.y));
|
||||
draw_texture_rect_region(progress,region,region);
|
||||
} break;
|
||||
case FILL_RIGHT_TO_LEFT: {
|
||||
Rect2 region=Rect2(Point2(s.x-s.x*get_unit_value(),0),Size2(s.x*get_unit_value(),s.y));
|
||||
draw_texture_rect_region(progress,region,region);
|
||||
} break;
|
||||
case FILL_TOP_TO_BOTTOM: {
|
||||
Rect2 region=Rect2(Point2(),Size2(s.x,s.y*get_unit_value()));
|
||||
draw_texture_rect_region(progress,region,region);
|
||||
} break;
|
||||
case FILL_BOTTOM_TO_TOP: {
|
||||
Rect2 region=Rect2(Point2(0,s.y-s.y*get_unit_value()),Size2(s.x,s.y*get_unit_value()));
|
||||
draw_texture_rect_region(progress,region,region);
|
||||
} break;
|
||||
case FILL_CLOCKWISE:
|
||||
case FILL_COUNTER_CLOCKWISE: {
|
||||
float val=get_unit_value()*rad_max_degrees/360;
|
||||
if (val==1) {
|
||||
Rect2 region=Rect2(Point2(),s);
|
||||
draw_texture_rect_region(progress,region,region);
|
||||
} else if (val!=0) {
|
||||
Array pts;
|
||||
float direction=mode==FILL_CLOCKWISE?1:-1;
|
||||
float start=rad_init_angle/360;
|
||||
float end=start+direction*val;
|
||||
pts.append(start);
|
||||
pts.append(end);
|
||||
float from=MIN(start,end);
|
||||
float to=MAX(start,end);
|
||||
for (int i=0;i<12;i++)
|
||||
if (corners[i]>from&&corners[i]<to)
|
||||
pts.append(corners[i]);
|
||||
pts.sort();
|
||||
Vector<Point2> uvs;
|
||||
Vector<Point2> points;
|
||||
uvs.push_back(get_relative_center());
|
||||
points.push_back(Point2(s.x*get_relative_center().x,s.y*get_relative_center().y));
|
||||
for (int i=0;i<pts.size();i++) {
|
||||
Point2 uv=unit_val_to_uv(pts[i]);
|
||||
if (uvs.find(uv)>=0)
|
||||
continue;
|
||||
uvs.push_back(uv);
|
||||
points.push_back(Point2(uv.x*s.x,uv.y*s.y));
|
||||
}
|
||||
draw_polygon(points,Vector<Color>(),uvs,progress);
|
||||
}
|
||||
if (get_tree()->is_editor_hint()) {
|
||||
Point2 p=progress->get_size();
|
||||
p.x*=get_relative_center().x;
|
||||
p.y*=get_relative_center().y;
|
||||
p=p.floor();
|
||||
draw_line(p-Point2(8,0),p+Point2(8,0),Color(0.9,0.5,0.5),2);
|
||||
draw_line(p-Point2(0,8),p+Point2(0,8),Color(0.9,0.5,0.5),2);
|
||||
}
|
||||
} break;
|
||||
default:
|
||||
draw_texture_rect_region(progress,Rect2(Point2(),Size2(s.x*get_unit_value(),s.y)),Rect2(Point2(),Size2(s.x*get_unit_value(),s.y)));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
if (over.is_valid())
|
||||
draw_texture(over,Point2());
|
||||
|
@ -101,6 +204,59 @@ void TextureProgress::_notification(int p_what){
|
|||
}
|
||||
}
|
||||
|
||||
void TextureProgress::set_fill_mode(int p_fill)
|
||||
{
|
||||
ERR_FAIL_INDEX(p_fill,6);
|
||||
mode=(FillMode)p_fill;
|
||||
update();
|
||||
}
|
||||
|
||||
int TextureProgress::get_fill_mode()
|
||||
{
|
||||
return mode;
|
||||
}
|
||||
|
||||
void TextureProgress::set_radial_initial_angle(float p_angle)
|
||||
{
|
||||
while(p_angle>360)
|
||||
p_angle-=360;
|
||||
while (p_angle<0)
|
||||
p_angle+=360;
|
||||
rad_init_angle=p_angle;
|
||||
update();
|
||||
}
|
||||
|
||||
float TextureProgress::get_radial_initial_angle()
|
||||
{
|
||||
return rad_init_angle;
|
||||
}
|
||||
|
||||
void TextureProgress::set_fill_degrees(float p_angle)
|
||||
{
|
||||
while(p_angle>360)
|
||||
p_angle-=360;
|
||||
while (p_angle<0)
|
||||
p_angle+=360;
|
||||
rad_max_degrees=p_angle;
|
||||
update();
|
||||
}
|
||||
|
||||
float TextureProgress::get_fill_degrees()
|
||||
{
|
||||
return rad_max_degrees;
|
||||
}
|
||||
|
||||
void TextureProgress::set_radial_center_offset(const Point2 &p_off)
|
||||
{
|
||||
rad_center_off=p_off;
|
||||
update();
|
||||
}
|
||||
|
||||
Point2 TextureProgress::get_radial_center_offset()
|
||||
{
|
||||
return rad_center_off;
|
||||
}
|
||||
|
||||
void TextureProgress::_bind_methods() {
|
||||
|
||||
ObjectTypeDB::bind_method(_MD("set_under_texture","tex"),&TextureProgress::set_under_texture);
|
||||
|
@ -112,13 +268,38 @@ void TextureProgress::_bind_methods() {
|
|||
ObjectTypeDB::bind_method(_MD("set_over_texture","tex"),&TextureProgress::set_over_texture);
|
||||
ObjectTypeDB::bind_method(_MD("get_over_texture"),&TextureProgress::get_over_texture);
|
||||
|
||||
ObjectTypeDB::bind_method(_MD("set_fill_mode","mode"),&TextureProgress::set_fill_mode);
|
||||
ObjectTypeDB::bind_method(_MD("get_fill_mode"), &TextureProgress::get_fill_mode);
|
||||
|
||||
ObjectTypeDB::bind_method(_MD("set_radial_initial_angle","mode"),&TextureProgress::set_radial_initial_angle);
|
||||
ObjectTypeDB::bind_method(_MD("get_radial_initial_angle"), &TextureProgress::get_radial_initial_angle);
|
||||
|
||||
ObjectTypeDB::bind_method(_MD("set_radial_center_offset","mode"),&TextureProgress::set_radial_center_offset);
|
||||
ObjectTypeDB::bind_method(_MD("get_radial_center_offset"), &TextureProgress::get_radial_center_offset);
|
||||
|
||||
ObjectTypeDB::bind_method(_MD("set_fill_degrees","mode"),&TextureProgress::set_fill_degrees);
|
||||
ObjectTypeDB::bind_method(_MD("get_fill_degrees"), &TextureProgress::get_fill_degrees);
|
||||
|
||||
ADD_PROPERTY( PropertyInfo(Variant::OBJECT,"texture/under",PROPERTY_HINT_RESOURCE_TYPE,"Texture"),_SCS("set_under_texture"),_SCS("get_under_texture"));
|
||||
ADD_PROPERTY( PropertyInfo(Variant::OBJECT,"texture/over",PROPERTY_HINT_RESOURCE_TYPE,"Texture"),_SCS("set_over_texture"),_SCS("get_over_texture"));
|
||||
ADD_PROPERTY( PropertyInfo(Variant::OBJECT,"texture/progress",PROPERTY_HINT_RESOURCE_TYPE,"Texture"),_SCS("set_progress_texture"),_SCS("get_progress_texture"));
|
||||
ADD_PROPERTYNZ( PropertyInfo(Variant::INT,"mode",PROPERTY_HINT_ENUM,"Left to Right,Right to Left,Top to Bottom,Bottom to Top,Clockwise,Counter Clockwise"),_SCS("set_fill_mode"),_SCS("get_fill_mode"));
|
||||
ADD_PROPERTYNZ( PropertyInfo(Variant::REAL,"radial_fill/initial_angle",PROPERTY_HINT_RANGE,"0.0,360.0,0.1,slider"),_SCS("set_radial_initial_angle"),_SCS("get_radial_initial_angle"));
|
||||
ADD_PROPERTYNZ( PropertyInfo(Variant::REAL,"radial_fill/fill_degrees",PROPERTY_HINT_RANGE,"0.0,360.0,0.1,slider"),_SCS("set_fill_degrees"),_SCS("get_fill_degrees"));
|
||||
ADD_PROPERTY( PropertyInfo(Variant::VECTOR2,"radial_fill/center_offset"),_SCS("set_radial_center_offset"),_SCS("get_radial_center_offset"));
|
||||
|
||||
BIND_CONSTANT( FILL_LEFT_TO_RIGHT );
|
||||
BIND_CONSTANT( FILL_RIGHT_TO_LEFT );
|
||||
BIND_CONSTANT( FILL_TOP_TO_BOTTOM );
|
||||
BIND_CONSTANT( FILL_BOTTOM_TO_TOP );
|
||||
BIND_CONSTANT( FILL_CLOCKWISE );
|
||||
BIND_CONSTANT( FILL_COUNTER_CLOCKWISE );
|
||||
|
||||
}
|
||||
|
||||
|
||||
TextureProgress::TextureProgress()
|
||||
{
|
||||
mode=FILL_LEFT_TO_RIGHT;
|
||||
rad_center_off=Point2();
|
||||
}
|
||||
|
|
|
@ -45,6 +45,27 @@ protected:
|
|||
void _notification(int p_what);
|
||||
public:
|
||||
|
||||
enum FillMode {
|
||||
FILL_LEFT_TO_RIGHT=0,
|
||||
FILL_RIGHT_TO_LEFT,
|
||||
FILL_TOP_TO_BOTTOM,
|
||||
FILL_BOTTOM_TO_TOP,
|
||||
FILL_CLOCKWISE,
|
||||
FILL_COUNTER_CLOCKWISE
|
||||
};
|
||||
|
||||
void set_fill_mode(int p_fill);
|
||||
int get_fill_mode();
|
||||
|
||||
void set_radial_initial_angle(float p_angle);
|
||||
float get_radial_initial_angle();
|
||||
|
||||
void set_fill_degrees(float p_angle);
|
||||
float get_fill_degrees();
|
||||
|
||||
void set_radial_center_offset(const Point2 &p_off);
|
||||
Point2 get_radial_center_offset();
|
||||
|
||||
void set_under_texture(const Ref<Texture>& p_texture);
|
||||
Ref<Texture> get_under_texture() const;
|
||||
|
||||
|
@ -57,6 +78,16 @@ public:
|
|||
Size2 get_minimum_size() const;
|
||||
|
||||
TextureProgress();
|
||||
|
||||
private:
|
||||
|
||||
FillMode mode;
|
||||
float rad_init_angle;
|
||||
float rad_max_degrees;
|
||||
Point2 rad_center_off;
|
||||
|
||||
Point2 unit_val_to_uv(float val);
|
||||
Point2 get_relative_center();
|
||||
};
|
||||
|
||||
#endif // TEXTURE_PROGRESS_H
|
||||
|
|
|
@ -121,7 +121,7 @@ void TreeItem::set_cell_mode( int p_column, TreeCellMode p_mode ) {
|
|||
c.val=0;
|
||||
c.checked=false;
|
||||
c.icon=Ref<Texture>();
|
||||
c.text="";
|
||||
c.text="";
|
||||
c.icon_max_w=0;
|
||||
_changed_notify(p_column);
|
||||
}
|
||||
|
@ -153,9 +153,9 @@ void TreeItem::set_text(int p_column,String p_text) {
|
|||
|
||||
ERR_FAIL_INDEX( p_column, cells.size() );
|
||||
cells[p_column].text=p_text;
|
||||
|
||||
|
||||
if (cells[p_column].mode==TreeItem::CELL_MODE_RANGE) {
|
||||
|
||||
|
||||
cells[p_column].min=0;
|
||||
cells[p_column].max=p_text.get_slice_count(",");
|
||||
cells[p_column].step=0;
|
||||
|
@ -225,7 +225,7 @@ void TreeItem::set_range(int p_column,double p_value) {
|
|||
p_value=cells[p_column].min;
|
||||
if (p_value>cells[p_column].max)
|
||||
p_value=cells[p_column].max;
|
||||
|
||||
|
||||
cells[p_column].val=p_value;
|
||||
_changed_notify(p_column);
|
||||
|
||||
|
@ -237,7 +237,7 @@ double TreeItem::get_range(int p_column) const {
|
|||
return cells[p_column].val;
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool TreeItem::is_range_exponential(int p_column) const {
|
||||
|
||||
ERR_FAIL_INDEX_V( p_column, cells.size(), false);
|
||||
|
@ -304,7 +304,7 @@ void TreeItem::set_collapsed(bool p_collapsed) {
|
|||
|
||||
if (tree->select_mode==Tree::SELECT_MULTI) {
|
||||
|
||||
tree->selected_item=this;
|
||||
tree->selected_item=this;
|
||||
emit_signal("cell_selected");
|
||||
} else {
|
||||
|
||||
|
@ -337,11 +337,11 @@ TreeItem *TreeItem::get_prev() {
|
|||
|
||||
if (!parent || parent->childs==this)
|
||||
return NULL;
|
||||
|
||||
|
||||
TreeItem *prev = parent->childs;
|
||||
while(prev && prev->next!=this)
|
||||
prev=prev->next;
|
||||
|
||||
|
||||
return prev;
|
||||
}
|
||||
|
||||
|
@ -636,14 +636,14 @@ void TreeItem::_bind_methods() {
|
|||
ObjectTypeDB::bind_method(_MD("get_range","column"),&TreeItem::get_range);
|
||||
ObjectTypeDB::bind_method(_MD("set_range_config","column","min","max","step","expr"),&TreeItem::set_range_config,DEFVAL(false));
|
||||
ObjectTypeDB::bind_method(_MD("get_range_config","column"),&TreeItem::_get_range_config);
|
||||
|
||||
|
||||
ObjectTypeDB::bind_method(_MD("set_metadata","column","meta"),&TreeItem::set_metadata);
|
||||
ObjectTypeDB::bind_method(_MD("get_metadata","column"),&TreeItem::get_metadata);
|
||||
|
||||
ObjectTypeDB::bind_method(_MD("set_custom_draw","column","object","callback"),&TreeItem::set_custom_draw);
|
||||
|
||||
ObjectTypeDB::bind_method(_MD("set_collapsed","enable"),&TreeItem::set_collapsed);
|
||||
ObjectTypeDB::bind_method(_MD("is_collapsed"),&TreeItem::is_collapsed);
|
||||
ObjectTypeDB::bind_method(_MD("is_collapsed"),&TreeItem::is_collapsed);
|
||||
|
||||
ObjectTypeDB::bind_method(_MD("get_next:TreeItem"),&TreeItem::get_next);
|
||||
ObjectTypeDB::bind_method(_MD("get_prev:TreeItem"),&TreeItem::get_prev);
|
||||
|
@ -654,17 +654,17 @@ void TreeItem::_bind_methods() {
|
|||
ObjectTypeDB::bind_method(_MD("get_prev_visible:TreeItem"),&TreeItem::get_prev_visible);
|
||||
|
||||
ObjectTypeDB::bind_method(_MD("remove_child:TreeItem","child"),&TreeItem::_remove_child);
|
||||
|
||||
|
||||
ObjectTypeDB::bind_method(_MD("set_selectable","column","selectable"),&TreeItem::set_selectable);
|
||||
ObjectTypeDB::bind_method(_MD("is_selectable","column"),&TreeItem::is_selectable);
|
||||
|
||||
ObjectTypeDB::bind_method(_MD("is_selected","column"),&TreeItem::is_selected);
|
||||
ObjectTypeDB::bind_method(_MD("select","column"),&TreeItem::select);
|
||||
ObjectTypeDB::bind_method(_MD("deselect","column"),&TreeItem::deselect);
|
||||
|
||||
|
||||
ObjectTypeDB::bind_method(_MD("set_editable","column","enabled"),&TreeItem::set_editable);
|
||||
ObjectTypeDB::bind_method(_MD("is_editable","column"),&TreeItem::is_editable);
|
||||
|
||||
|
||||
ObjectTypeDB::bind_method(_MD("set_custom_color","column","color"),&TreeItem::set_custom_color);
|
||||
ObjectTypeDB::bind_method(_MD("clear_custom_color","column"),&TreeItem::clear_custom_color);
|
||||
|
||||
|
@ -688,7 +688,7 @@ void TreeItem::_bind_methods() {
|
|||
BIND_CONSTANT( CELL_MODE_RANGE );
|
||||
BIND_CONSTANT( CELL_MODE_ICON );
|
||||
BIND_CONSTANT( CELL_MODE_CUSTOM );
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
@ -774,7 +774,7 @@ void Tree::update_cache() {
|
|||
cache.arrow =get_icon("arrow");
|
||||
cache.select_arrow =get_icon("select_arrow");
|
||||
cache.updown=get_icon("updown");
|
||||
|
||||
|
||||
cache.font_color=get_color("font_color");
|
||||
cache.font_color_selected=get_color("font_color_selected");
|
||||
cache.guide_color=get_color("guide_color");
|
||||
|
@ -802,10 +802,10 @@ int Tree::compute_item_height(TreeItem *p_item) const {
|
|||
|
||||
if (p_item==root && hide_root)
|
||||
return 0;
|
||||
|
||||
|
||||
int height=cache.font->get_height();
|
||||
|
||||
|
||||
|
||||
for (int i=0;i<columns.size();i++) {
|
||||
|
||||
|
||||
|
@ -819,23 +819,23 @@ int Tree::compute_item_height(TreeItem *p_item) const {
|
|||
}
|
||||
|
||||
switch(p_item->cells[i].mode) {
|
||||
|
||||
|
||||
case TreeItem::CELL_MODE_CHECK: {
|
||||
|
||||
|
||||
int check_icon_h = cache.checked->get_height();
|
||||
if (height<check_icon_h)
|
||||
height=check_icon_h;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
case TreeItem::CELL_MODE_STRING:
|
||||
case TreeItem::CELL_MODE_CUSTOM:
|
||||
case TreeItem::CELL_MODE_ICON: {
|
||||
|
||||
|
||||
Ref<Texture> icon = p_item->cells[i].icon;
|
||||
if (!icon.is_null()) {
|
||||
|
||||
|
||||
Size2i s = p_item->cells[i].get_icon_size();
|
||||
if (p_item->cells[i].icon_max_w>0 && s.width > p_item->cells[i].icon_max_w ) {
|
||||
s.height=s.height * p_item->cells[i].icon_max_w / s.width;
|
||||
|
@ -843,15 +843,15 @@ int Tree::compute_item_height(TreeItem *p_item) const {
|
|||
if (s.height > height )
|
||||
height=s.height;
|
||||
}
|
||||
|
||||
|
||||
} break;
|
||||
default: {}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
height += cache.vseparation;
|
||||
|
||||
|
||||
return height;
|
||||
|
||||
}
|
||||
|
@ -927,7 +927,7 @@ void Tree::draw_item_text(String p_text,const Ref<Texture>& p_icon,int p_icon_ma
|
|||
p_rect.size.x-=Math::floor(p_rect.size.y/2);
|
||||
|
||||
Ref<Font> font = cache.font;
|
||||
|
||||
|
||||
p_rect.pos.y+=Math::floor((p_rect.size.y-font->get_height())/2.0) +font->get_ascent();
|
||||
font->draw(ci,p_rect.pos,p_text,p_color,p_rect.size.x);
|
||||
}
|
||||
|
@ -950,13 +950,13 @@ int Tree::draw_item(const Point2i& p_pos,const Point2& p_draw_ofs, const Size2&
|
|||
|
||||
Point2i guide_from;
|
||||
|
||||
bool skip=(p_item==root && hide_root);
|
||||
bool skip=(p_item==root && hide_root);
|
||||
// printf("skip (%p == %p && %i) %i\n",p_item,root,hide_root,skip);
|
||||
|
||||
|
||||
if (!skip && (p_pos.y+label_h-cache.offset.y)>0) {
|
||||
|
||||
// printf("entering\n");
|
||||
// printf("entering\n");
|
||||
|
||||
int height=label_h;
|
||||
|
||||
|
@ -965,7 +965,7 @@ int Tree::draw_item(const Point2i& p_pos,const Point2& p_draw_ofs, const Size2&
|
|||
if (p_item->childs) { //has childs, draw the guide box
|
||||
|
||||
Ref<Texture> arrow;
|
||||
|
||||
|
||||
if (p_item->collapsed) {
|
||||
|
||||
arrow=cache.arrow_collapsed;
|
||||
|
@ -983,7 +983,7 @@ int Tree::draw_item(const Point2i& p_pos,const Point2& p_draw_ofs, const Size2&
|
|||
// if (p_item->get_parent()!=root || !hide_root)
|
||||
|
||||
Ref<Font> font = cache.font;
|
||||
|
||||
|
||||
int font_ascent=font->get_ascent();
|
||||
|
||||
int ofs = p_pos.x + cache.item_margin;
|
||||
|
@ -1066,7 +1066,7 @@ int Tree::draw_item(const Point2i& p_pos,const Point2& p_draw_ofs, const Size2&
|
|||
}
|
||||
|
||||
Color col=p_item->cells[i].custom_color?p_item->cells[i].color:get_color( p_item->cells[i].selected?"font_color_selected":"font_color");
|
||||
|
||||
|
||||
Point2i text_pos=item_rect.pos;
|
||||
text_pos.y+=Math::floor((item_rect.size.y-font->get_height())/2) + font_ascent;
|
||||
|
||||
|
@ -1104,7 +1104,7 @@ int Tree::draw_item(const Point2i& p_pos,const Point2& p_draw_ofs, const Size2&
|
|||
|
||||
} break;
|
||||
case TreeItem::CELL_MODE_RANGE: {
|
||||
|
||||
|
||||
if (p_item->cells[i].text!="") {
|
||||
|
||||
if (!p_item->cells[i].editable)
|
||||
|
@ -1128,7 +1128,7 @@ int Tree::draw_item(const Point2i& p_pos,const Point2& p_draw_ofs, const Size2&
|
|||
} else {
|
||||
|
||||
Ref<Texture> updown = cache.updown;
|
||||
|
||||
|
||||
String valtext = String::num( p_item->cells[i].val, Math::decimals( p_item->cells[i].step ) );
|
||||
font->draw( ci, text_pos, valtext, col, item_rect.size.x-updown->get_width());
|
||||
|
||||
|
@ -1185,7 +1185,7 @@ int Tree::draw_item(const Point2i& p_pos,const Point2& p_draw_ofs, const Size2&
|
|||
Rect2i ir=item_rect;
|
||||
ir.size.width-=downarrow->get_width();
|
||||
draw_item_rect(p_item->cells[i],ir,col);
|
||||
|
||||
|
||||
Point2i arrow_pos=item_rect.pos;
|
||||
arrow_pos.x+=item_rect.size.x-downarrow->get_width();
|
||||
arrow_pos.y+=Math::floor(((item_rect.size.y-downarrow->get_height()))/2.0);
|
||||
|
@ -1227,7 +1227,7 @@ int Tree::draw_item(const Point2i& p_pos,const Point2& p_draw_ofs, const Size2&
|
|||
children_pos.x+=cache.item_margin;
|
||||
htotal+=label_h;
|
||||
children_pos.y+=htotal;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -1272,12 +1272,12 @@ void Tree::select_single_item(TreeItem *p_selected,TreeItem *p_current,int p_col
|
|||
continue;
|
||||
|
||||
if (select_mode==SELECT_ROW) {
|
||||
|
||||
|
||||
|
||||
if (p_selected==p_current) {
|
||||
|
||||
|
||||
if (!c.selected) {
|
||||
|
||||
|
||||
c.selected=true;
|
||||
selected_item=p_selected;
|
||||
selected_col=0;
|
||||
|
@ -1286,26 +1286,26 @@ void Tree::select_single_item(TreeItem *p_selected,TreeItem *p_current,int p_col
|
|||
//if (p_col==i)
|
||||
// p_current->selected_signal.call(p_col);
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
|
||||
if (c.selected) {
|
||||
|
||||
c.selected=false;
|
||||
|
||||
c.selected=false;
|
||||
//p_current->deselected_signal.call(p_col);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
} else if (select_mode==SELECT_SINGLE || select_mode==SELECT_MULTI) {
|
||||
|
||||
|
||||
if (!r_in_range && &selected_cell==&c) {
|
||||
|
||||
|
||||
|
||||
if (!selected_cell.selected) {
|
||||
|
||||
|
||||
selected_cell.selected=true;
|
||||
|
||||
|
||||
selected_item=p_selected;
|
||||
selected_col=i;
|
||||
|
||||
|
@ -1321,7 +1321,7 @@ void Tree::select_single_item(TreeItem *p_selected,TreeItem *p_current,int p_col
|
|||
|
||||
}
|
||||
} else {
|
||||
|
||||
|
||||
|
||||
if (r_in_range && *r_in_range) {
|
||||
|
||||
|
@ -1372,7 +1372,7 @@ int Tree::propagate_mouse_event(const Point2i &p_pos,int x_ofs,int y_ofs,bool p_
|
|||
int item_h=compute_item_height( p_item )+cache.vseparation;
|
||||
|
||||
bool skip=(p_item==root && hide_root);
|
||||
|
||||
|
||||
if (!skip && p_pos.y<item_h) {
|
||||
// check event!
|
||||
|
||||
|
@ -1384,7 +1384,7 @@ int Tree::propagate_mouse_event(const Point2i &p_pos,int x_ofs,int y_ofs,bool p_
|
|||
|
||||
return -1; //handled!
|
||||
}
|
||||
|
||||
|
||||
int x=p_pos.x;
|
||||
/* find clicked column */
|
||||
int col=-1;
|
||||
|
@ -1403,7 +1403,7 @@ int Tree::propagate_mouse_event(const Point2i &p_pos,int x_ofs,int y_ofs,bool p_
|
|||
break;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
if (col==-1)
|
||||
return -1;
|
||||
|
@ -1487,8 +1487,8 @@ int Tree::propagate_mouse_event(const Point2i &p_pos,int x_ofs,int y_ofs,bool p_
|
|||
//}
|
||||
update();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1514,14 +1514,14 @@ int Tree::propagate_mouse_event(const Point2i &p_pos,int x_ofs,int y_ofs,bool p_
|
|||
|
||||
} break;
|
||||
case TreeItem::CELL_MODE_CHECK: {
|
||||
|
||||
|
||||
Ref<Texture> checked = cache.checked;
|
||||
bring_up_editor=false; //checkboxes are not edited with editor
|
||||
if (x>=0 && x<= checked->get_width()+cache.hseparation ) {
|
||||
|
||||
|
||||
|
||||
p_item->set_checked(col,!c.checked);
|
||||
item_edited(col,p_item);
|
||||
item_edited(col,p_item);
|
||||
click_handled=true;
|
||||
//p_item->edited_signal.call(col);
|
||||
}
|
||||
|
@ -1549,37 +1549,37 @@ int Tree::propagate_mouse_event(const Point2i &p_pos,int x_ofs,int y_ofs,bool p_
|
|||
//}
|
||||
bring_up_editor=false;
|
||||
} else {
|
||||
|
||||
|
||||
Ref<Texture> updown = cache.updown;
|
||||
|
||||
|
||||
|
||||
|
||||
if (x >= (col_width-item_h/2)) {
|
||||
|
||||
|
||||
/* touching the combo */
|
||||
bool up=p_pos.y < (item_h /2);
|
||||
|
||||
|
||||
if (p_button==BUTTON_LEFT) {
|
||||
p_item->set_range( col, c.val + (up?1.0:-1.0) * c.step );
|
||||
|
||||
item_edited(col,p_item);
|
||||
|
||||
item_edited(col,p_item);
|
||||
} else if (p_button==BUTTON_RIGHT) {
|
||||
|
||||
|
||||
p_item->set_range( col, (up?c.max:c.min) );
|
||||
item_edited(col,p_item);
|
||||
item_edited(col,p_item);
|
||||
} else if (p_button==BUTTON_WHEEL_UP) {
|
||||
|
||||
|
||||
p_item->set_range( col, c.val + c.step );
|
||||
item_edited(col,p_item);
|
||||
item_edited(col,p_item);
|
||||
} else if (p_button==BUTTON_WHEEL_DOWN) {
|
||||
|
||||
|
||||
p_item->set_range( col, c.val - c.step );
|
||||
item_edited(col,p_item);
|
||||
item_edited(col,p_item);
|
||||
}
|
||||
|
||||
//p_item->edited_signal.call(col);
|
||||
|
||||
//p_item->edited_signal.call(col);
|
||||
bring_up_editor=false;
|
||||
|
||||
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
editor_text=String::num( p_item->cells[col].val, Math::decimals( p_item->cells[col].step ) );
|
||||
|
@ -1587,7 +1587,7 @@ int Tree::propagate_mouse_event(const Point2i &p_pos,int x_ofs,int y_ofs,bool p_
|
|||
if (select_mode==SELECT_MULTI && get_tree()->get_last_event_id() == focus_in_id)
|
||||
bring_up_editor=false;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
click_handled=true;
|
||||
|
@ -1598,12 +1598,12 @@ int Tree::propagate_mouse_event(const Point2i &p_pos,int x_ofs,int y_ofs,bool p_
|
|||
} break;
|
||||
case TreeItem::CELL_MODE_CUSTOM: {
|
||||
edited_item=p_item;
|
||||
edited_col=col;
|
||||
edited_col=col;
|
||||
custom_popup_rect=Rect2i(get_global_pos() + Point2i(col_ofs,_get_title_button_height()+y_ofs+item_h-cache.offset.y), Size2(get_column_width(col),item_h));
|
||||
emit_signal("custom_popup_edited",((bool)(x >= (col_width-item_h/2))));
|
||||
|
||||
bring_up_editor=false;
|
||||
item_edited(col,p_item);
|
||||
item_edited(col,p_item);
|
||||
click_handled=true;
|
||||
return -1;
|
||||
} break;
|
||||
|
@ -1615,7 +1615,7 @@ int Tree::propagate_mouse_event(const Point2i &p_pos,int x_ofs,int y_ofs,bool p_
|
|||
|
||||
|
||||
|
||||
click_handled=true;
|
||||
click_handled=true;
|
||||
popup_edited_item=p_item;
|
||||
popup_edited_item_col=col;
|
||||
|
||||
|
@ -1627,14 +1627,14 @@ int Tree::propagate_mouse_event(const Point2i &p_pos,int x_ofs,int y_ofs,bool p_
|
|||
} else {
|
||||
|
||||
Point2i new_pos=p_pos;
|
||||
|
||||
|
||||
if (!skip) {
|
||||
x_ofs+=cache.item_margin;
|
||||
//new_pos.x-=cache.item_margin;
|
||||
y_ofs+=item_h;
|
||||
new_pos.y-=item_h;
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (!p_item->collapsed) { /* if not collapsed, check the childs */
|
||||
|
||||
|
@ -1697,7 +1697,7 @@ void Tree::text_editor_enter(String p_text) {
|
|||
default: { ERR_FAIL(); }
|
||||
}
|
||||
|
||||
item_edited(popup_edited_item_col,popup_edited_item);
|
||||
item_edited(popup_edited_item_col,popup_edited_item);
|
||||
update();
|
||||
|
||||
}
|
||||
|
@ -1725,19 +1725,19 @@ void Tree::popup_select(int p_option) {
|
|||
if (popup_edited_item_col<0 || popup_edited_item_col>columns.size())
|
||||
return;
|
||||
|
||||
|
||||
|
||||
popup_edited_item->cells[popup_edited_item_col].val=p_option;
|
||||
//popup_edited_item->edited_signal.call( popup_edited_item_col );
|
||||
update();
|
||||
item_edited(popup_edited_item_col,popup_edited_item);
|
||||
item_edited(popup_edited_item_col,popup_edited_item);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Tree::_input_event(InputEvent p_event) {
|
||||
|
||||
|
||||
switch (p_event.type) {
|
||||
|
||||
|
||||
case InputEvent::KEY: {
|
||||
|
||||
if (!p_event.key.pressed)
|
||||
|
@ -2091,12 +2091,12 @@ void Tree::_input_event(InputEvent p_event) {
|
|||
}
|
||||
} break;
|
||||
case InputEvent::MOUSE_BUTTON: {
|
||||
|
||||
|
||||
|
||||
|
||||
if (cache.font.is_null()) // avoid a strange case that may fuckup stuff
|
||||
update_cache();
|
||||
const InputEventMouseButton& b=p_event.mouse_button;
|
||||
const InputEventMouseButton& b=p_event.mouse_button;
|
||||
|
||||
|
||||
if (!b.pressed) {
|
||||
|
@ -2160,7 +2160,7 @@ void Tree::_input_event(InputEvent p_event) {
|
|||
switch(b.button_index) {
|
||||
case BUTTON_LEFT: {
|
||||
Ref<StyleBox> bg = cache.bg;
|
||||
|
||||
|
||||
Point2 pos = Point2(b.x,b.y) - bg->get_offset();
|
||||
cache.click_type=Cache::CLICK_NONE;
|
||||
if (show_column_titles) {
|
||||
|
@ -2222,18 +2222,18 @@ void Tree::_input_event(InputEvent p_event) {
|
|||
|
||||
|
||||
} break;
|
||||
case BUTTON_WHEEL_UP: {
|
||||
case BUTTON_WHEEL_UP: {
|
||||
v_scroll->set_val( v_scroll->get_val()-v_scroll->get_page()/8 );
|
||||
} break;
|
||||
case BUTTON_WHEEL_DOWN: {
|
||||
|
||||
|
||||
v_scroll->set_val( v_scroll->get_val()+v_scroll->get_page()/8 );
|
||||
} break;
|
||||
}
|
||||
|
||||
|
||||
} break;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -2331,10 +2331,10 @@ Size2 Tree::get_internal_min_size() const {
|
|||
if (root)
|
||||
size.height+=get_item_height(root);
|
||||
for (int i=0;i<columns.size();i++) {
|
||||
|
||||
|
||||
size.width+=columns[i].min_width;
|
||||
}
|
||||
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
|
@ -2353,39 +2353,39 @@ void Tree::update_scrollbars() {
|
|||
Size2 vmin = v_scroll->get_combined_minimum_size();
|
||||
|
||||
|
||||
|
||||
|
||||
v_scroll->set_begin( Point2(size.width - vmin.width , cache.bg->get_margin(MARGIN_TOP)) );
|
||||
v_scroll->set_end( Point2(size.width, size.height-cache.bg->get_margin(MARGIN_TOP)-cache.bg->get_margin(MARGIN_BOTTOM)) );
|
||||
|
||||
|
||||
h_scroll->set_begin( Point2( 0, size.height - hmin.height) );
|
||||
h_scroll->set_end( Point2(size.width-vmin.width, size.height) );
|
||||
|
||||
|
||||
|
||||
|
||||
Size2 min = get_internal_min_size();
|
||||
|
||||
|
||||
if (min.height < size.height - hmin.height) {
|
||||
|
||||
|
||||
v_scroll->hide();
|
||||
cache.offset.y=0;
|
||||
} else {
|
||||
|
||||
|
||||
v_scroll->show();
|
||||
v_scroll->set_max(min.height);
|
||||
v_scroll->set_page(size.height - hmin.height - tbh);
|
||||
cache.offset.y=v_scroll->get_val();
|
||||
}
|
||||
|
||||
|
||||
if (min.width < size.width - vmin.width) {
|
||||
|
||||
|
||||
h_scroll->hide();
|
||||
cache.offset.x=0;
|
||||
} else {
|
||||
|
||||
|
||||
h_scroll->show();
|
||||
h_scroll->set_max(min.width);
|
||||
h_scroll->set_page(size.width - vmin.width);
|
||||
cache.offset.x=h_scroll->get_val();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -2464,16 +2464,16 @@ void Tree::_notification(int p_what) {
|
|||
}
|
||||
|
||||
if (p_what==NOTIFICATION_DRAW) {
|
||||
|
||||
|
||||
update_cache();
|
||||
update_scrollbars();
|
||||
RID ci = get_canvas_item();
|
||||
|
||||
RID ci = get_canvas_item();
|
||||
|
||||
VisualServer::get_singleton()->canvas_item_set_clip(ci,true);
|
||||
|
||||
|
||||
Ref<StyleBox> bg = cache.bg;
|
||||
Ref<StyleBox> bg_focus = get_stylebox("bg_focus");
|
||||
|
||||
|
||||
Point2 draw_ofs;
|
||||
draw_ofs+=bg->get_offset();
|
||||
Size2 draw_size=get_size()-bg->get_minimum_size();
|
||||
|
@ -2491,7 +2491,7 @@ void Tree::_notification(int p_what) {
|
|||
draw_size.y-=tbh;
|
||||
|
||||
if (root) {
|
||||
|
||||
|
||||
|
||||
draw_item( Point2(),draw_ofs,draw_size,root);
|
||||
|
||||
|
@ -2502,10 +2502,10 @@ void Tree::_notification(int p_what) {
|
|||
// int size_y=exposed.size.height-bg->get_minimum_size().height;
|
||||
|
||||
for (int i=0;i<(columns.size()-1-1);i++) {
|
||||
|
||||
|
||||
ofs+=get_column_width(i);
|
||||
//get_painter()->draw_fill_rect( Point2(ofs+cache.hseparation/2, from_y), Size2( 1, size_y ),color( COLOR_TREE_GRID) );
|
||||
}
|
||||
}
|
||||
|
||||
if (show_column_titles) {
|
||||
|
||||
|
@ -2605,7 +2605,7 @@ TreeItem* Tree::get_last_item() {
|
|||
}
|
||||
|
||||
void Tree::item_edited(int p_column,TreeItem *p_item) {
|
||||
|
||||
|
||||
edited_item=p_item;
|
||||
edited_col=p_column;
|
||||
emit_signal("item_edited");
|
||||
|
@ -2613,14 +2613,14 @@ void Tree::item_edited(int p_column,TreeItem *p_item) {
|
|||
|
||||
void Tree::item_changed(int p_column,TreeItem *p_item) {
|
||||
|
||||
update();
|
||||
update();
|
||||
}
|
||||
|
||||
void Tree::item_selected(int p_column,TreeItem *p_item) {
|
||||
|
||||
|
||||
if (select_mode==SELECT_MULTI) {
|
||||
|
||||
|
||||
if (!p_item->cells[p_column].selectable)
|
||||
return;
|
||||
|
||||
|
@ -2636,16 +2636,16 @@ void Tree::item_selected(int p_column,TreeItem *p_item) {
|
|||
void Tree::item_deselected(int p_column,TreeItem *p_item) {
|
||||
|
||||
if (select_mode==SELECT_MULTI) {
|
||||
|
||||
|
||||
p_item->cells[p_column].selected=false;
|
||||
}
|
||||
}
|
||||
update();
|
||||
}
|
||||
|
||||
|
||||
void Tree::set_select_mode(SelectMode p_mode) {
|
||||
|
||||
select_mode=p_mode;
|
||||
select_mode=p_mode;
|
||||
}
|
||||
|
||||
void Tree::clear() {
|
||||
|
@ -2675,15 +2675,15 @@ void Tree::set_hide_root(bool p_enabled) {
|
|||
|
||||
|
||||
|
||||
hide_root=p_enabled;
|
||||
update();
|
||||
hide_root=p_enabled;
|
||||
update();
|
||||
}
|
||||
|
||||
void Tree::set_column_min_width(int p_column,int p_min_width) {
|
||||
|
||||
|
||||
ERR_FAIL_INDEX(p_column,columns.size());
|
||||
|
||||
|
||||
if (p_min_width<1)
|
||||
return;
|
||||
columns[p_column].min_width=p_min_width;
|
||||
|
@ -2693,8 +2693,8 @@ void Tree::set_column_min_width(int p_column,int p_min_width) {
|
|||
void Tree::set_column_expand(int p_column,bool p_expand) {
|
||||
|
||||
ERR_FAIL_INDEX(p_column,columns.size());
|
||||
|
||||
columns[p_column].expand=p_expand;
|
||||
|
||||
columns[p_column].expand=p_expand;
|
||||
update();
|
||||
}
|
||||
|
||||
|
@ -2709,78 +2709,78 @@ int Tree::get_selected_column() const {
|
|||
}
|
||||
|
||||
TreeItem *Tree::get_edited() const {
|
||||
|
||||
|
||||
return edited_item;
|
||||
}
|
||||
|
||||
int Tree::get_edited_column() const {
|
||||
|
||||
|
||||
return edited_col;
|
||||
}
|
||||
|
||||
TreeItem* Tree::get_next_selected( TreeItem* p_item) {
|
||||
|
||||
|
||||
//if (!p_item)
|
||||
// return NULL;
|
||||
if (!root)
|
||||
return NULL;
|
||||
|
||||
return NULL;
|
||||
|
||||
while(true) {
|
||||
|
||||
|
||||
|
||||
|
||||
if (!p_item) {
|
||||
p_item=root;
|
||||
} else {
|
||||
|
||||
|
||||
if (p_item->childs) {
|
||||
|
||||
|
||||
p_item=p_item->childs;
|
||||
|
||||
|
||||
} else if (p_item->next) {
|
||||
|
||||
p_item=p_item->next;
|
||||
|
||||
p_item=p_item->next;
|
||||
} else {
|
||||
|
||||
|
||||
while(!p_item->next) {
|
||||
|
||||
|
||||
p_item=p_item->parent;
|
||||
if (p_item==NULL)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
p_item=p_item->next;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
for (int i=0;i<columns.size();i++)
|
||||
if (p_item->cells[i].selected)
|
||||
return p_item;
|
||||
}
|
||||
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int Tree::get_column_width(int p_column) const {
|
||||
|
||||
|
||||
ERR_FAIL_INDEX_V(p_column,columns.size(),-1);
|
||||
|
||||
|
||||
|
||||
|
||||
if (!columns[p_column].expand)
|
||||
return columns[p_column].min_width;
|
||||
|
||||
|
||||
Ref<StyleBox> bg = cache.bg;
|
||||
|
||||
|
||||
int expand_area=get_size().width-(bg->get_margin(MARGIN_LEFT)+bg->get_margin(MARGIN_RIGHT));
|
||||
|
||||
|
||||
if (v_scroll->is_visible())
|
||||
expand_area-=v_scroll->get_combined_minimum_size().width;
|
||||
|
||||
|
||||
int expanding_columns=0;
|
||||
int expanding_total=0;
|
||||
|
||||
|
||||
for (int i=0;i<columns.size();i++) {
|
||||
|
||||
|
||||
if (!columns[i].expand) {
|
||||
expand_area-=columns[i].min_width;
|
||||
} else {
|
||||
|
@ -2791,30 +2791,30 @@ int Tree::get_column_width(int p_column) const {
|
|||
|
||||
if (expand_area<expanding_total)
|
||||
return columns[p_column].min_width;
|
||||
|
||||
|
||||
ERR_FAIL_COND_V(expanding_columns==0,-1); // shouldnt happen
|
||||
|
||||
|
||||
return expand_area * columns[p_column].min_width / expanding_total;
|
||||
}
|
||||
|
||||
void Tree::propagate_set_columns(TreeItem *p_item) {
|
||||
|
||||
|
||||
p_item->cells.resize( columns.size() );
|
||||
|
||||
|
||||
TreeItem *c = p_item->get_children();
|
||||
while(c) {
|
||||
|
||||
|
||||
propagate_set_columns(c);
|
||||
c=c->get_next();
|
||||
}
|
||||
}
|
||||
|
||||
void Tree::set_columns(int p_columns) {
|
||||
|
||||
|
||||
ERR_FAIL_COND(p_columns<1);
|
||||
ERR_FAIL_COND(blocked>0);
|
||||
columns.resize(p_columns);
|
||||
|
||||
|
||||
if (root)
|
||||
propagate_set_columns(root);
|
||||
if (selected_col>=p_columns)
|
||||
|
@ -2824,17 +2824,17 @@ void Tree::set_columns(int p_columns) {
|
|||
}
|
||||
|
||||
int Tree::get_columns() const {
|
||||
|
||||
|
||||
return columns.size();
|
||||
}
|
||||
|
||||
void Tree::_scroll_moved(float) {
|
||||
|
||||
|
||||
update();
|
||||
}
|
||||
|
||||
Rect2 Tree::get_custom_popup_rect() const {
|
||||
|
||||
|
||||
return custom_popup_rect;
|
||||
}
|
||||
|
||||
|
@ -3116,7 +3116,7 @@ bool Tree::can_cursor_exit_tree() const {
|
|||
|
||||
|
||||
void Tree::_bind_methods() {
|
||||
|
||||
|
||||
ObjectTypeDB::bind_method(_MD("_input_event"),&Tree::_input_event);
|
||||
ObjectTypeDB::bind_method(_MD("_popup_select"),&Tree::popup_select);
|
||||
ObjectTypeDB::bind_method(_MD("_text_editor_enter"),&Tree::text_editor_enter);
|
||||
|
@ -3140,7 +3140,7 @@ void Tree::_bind_methods() {
|
|||
|
||||
ObjectTypeDB::bind_method(_MD("set_columns","amount"),&Tree::set_columns);
|
||||
ObjectTypeDB::bind_method(_MD("get_columns"),&Tree::get_columns);
|
||||
|
||||
|
||||
ObjectTypeDB::bind_method(_MD("get_edited:TreeItem"),&Tree::get_edited);
|
||||
ObjectTypeDB::bind_method(_MD("get_edited_column"),&Tree::get_edited_column);
|
||||
ObjectTypeDB::bind_method(_MD("get_custom_popup_rect"),&Tree::get_custom_popup_rect);
|
||||
|
@ -3179,7 +3179,7 @@ Tree::Tree() {
|
|||
edited_item=NULL;
|
||||
selected_col=-1;
|
||||
edited_col=-1;
|
||||
|
||||
|
||||
hide_root=false;
|
||||
select_mode=SELECT_SINGLE;
|
||||
root=0;
|
||||
|
@ -3187,8 +3187,8 @@ Tree::Tree() {
|
|||
popup_edited_item=NULL;
|
||||
text_editor=NULL;
|
||||
set_focus_mode(FOCUS_ALL);
|
||||
|
||||
|
||||
|
||||
|
||||
popup_menu = memnew( PopupMenu );
|
||||
popup_menu->hide();
|
||||
add_child(popup_menu);
|
||||
|
@ -3204,7 +3204,7 @@ Tree::Tree() {
|
|||
|
||||
h_scroll = memnew( HScrollBar );
|
||||
v_scroll = memnew( VScrollBar );
|
||||
|
||||
|
||||
add_child(h_scroll);
|
||||
add_child(v_scroll);
|
||||
|
||||
|
@ -3250,6 +3250,6 @@ Tree::~Tree() {
|
|||
if (root) {
|
||||
memdelete( root );
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,74 @@
|
|||
#include "instance_placeholder.h"
|
||||
|
||||
#include "scene/resources/packed_scene.h"
|
||||
#include "io/resource_loader.h"
|
||||
|
||||
bool InstancePlaceholder::_set(const StringName& p_name, const Variant& p_value) {
|
||||
|
||||
PropSet ps;
|
||||
ps.name=p_name;
|
||||
ps.value=p_value;
|
||||
stored_values.push_back(ps);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool InstancePlaceholder::_get(const StringName& p_name,Variant &r_ret) const{
|
||||
|
||||
return false;
|
||||
}
|
||||
void InstancePlaceholder::_get_property_list( List<PropertyInfo> *p_list) const{
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
void InstancePlaceholder::set_path(const String& p_name) {
|
||||
|
||||
path=p_name;
|
||||
}
|
||||
|
||||
String InstancePlaceholder::get_path() const {
|
||||
|
||||
return path;
|
||||
}
|
||||
void InstancePlaceholder::replace_by_instance(const Ref<PackedScene> &p_custom_scene){
|
||||
|
||||
ERR_FAIL_COND(!is_inside_tree());
|
||||
|
||||
Node *base = get_parent();
|
||||
if (!base)
|
||||
return;
|
||||
|
||||
Ref<PackedScene> ps;
|
||||
if (p_custom_scene.is_valid())
|
||||
ps = p_custom_scene;
|
||||
else
|
||||
ps = ResourceLoader::load(path,"PackedScene");
|
||||
|
||||
if (!ps.is_valid())
|
||||
return;
|
||||
Node *scene = ps->instance();
|
||||
scene->set_name(get_name());
|
||||
int pos = get_position_in_parent();
|
||||
|
||||
for(List<PropSet>::Element *E=stored_values.front();E;E=E->next()) {
|
||||
scene->set(E->get().name,E->get().value);
|
||||
}
|
||||
|
||||
queue_delete();
|
||||
|
||||
base->remove_child(this);
|
||||
base->add_child(scene);
|
||||
base->move_child(scene,pos);
|
||||
|
||||
}
|
||||
|
||||
void InstancePlaceholder::_bind_methods() {
|
||||
|
||||
ObjectTypeDB::bind_method(_MD("replace_by_instance","custom_scene:PackedScene"),&InstancePlaceholder::replace_by_instance,DEFVAL(Variant()));
|
||||
}
|
||||
|
||||
InstancePlaceholder::InstancePlaceholder() {
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
#ifndef INSTANCE_PLACEHOLDER_H
|
||||
#define INSTANCE_PLACEHOLDER_H
|
||||
|
||||
#include "scene/main/node.h"
|
||||
|
||||
class PackedScene;
|
||||
|
||||
class InstancePlaceholder : public Node {
|
||||
|
||||
OBJ_TYPE(InstancePlaceholder,Node);
|
||||
|
||||
String path;
|
||||
struct PropSet {
|
||||
StringName name;
|
||||
Variant value;
|
||||
};
|
||||
|
||||
List<PropSet> stored_values;
|
||||
|
||||
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();
|
||||
|
||||
public:
|
||||
|
||||
void set_path(const String& p_name);
|
||||
String get_path() const;
|
||||
|
||||
void replace_by_instance(const Ref<PackedScene>& p_custom_scene=Ref<PackedScene>());
|
||||
|
||||
InstancePlaceholder();
|
||||
};
|
||||
|
||||
#endif // INSTANCE_PLACEHOLDER_H
|
|
@ -841,6 +841,20 @@ Node *Node::get_child(int p_index) const {
|
|||
return data.children[p_index];
|
||||
}
|
||||
|
||||
|
||||
Node *Node::_get_child_by_name(const StringName& p_name) const {
|
||||
|
||||
int cc=data.children.size();
|
||||
Node* const* cd=data.children.ptr();
|
||||
|
||||
for(int i=0;i<cc;i++){
|
||||
if (cd[i]->data.name==p_name)
|
||||
return cd[i];
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Node *Node::_get_node(const NodePath& p_path) const {
|
||||
|
||||
ERR_FAIL_COND_V( !data.inside_tree && p_path.is_absolute(), NULL );
|
||||
|
@ -906,8 +920,10 @@ Node *Node::_get_node(const NodePath& p_path) const {
|
|||
Node *Node::get_node(const NodePath& p_path) const {
|
||||
|
||||
Node *node = _get_node(p_path);
|
||||
ERR_EXPLAIN("Node not found: "+p_path);
|
||||
ERR_FAIL_COND_V(!node,NULL);
|
||||
if (!node) {
|
||||
ERR_EXPLAIN("Node not found: "+p_path);
|
||||
ERR_FAIL_COND_V(!node,NULL);
|
||||
}
|
||||
return node;
|
||||
}
|
||||
|
||||
|
@ -1036,6 +1052,7 @@ void Node::get_owned_by(Node *p_by,List<Node*> *p_owned) {
|
|||
|
||||
void Node::_set_owner_nocheck(Node* p_owner) {
|
||||
|
||||
ERR_FAIL_COND(data.owner);
|
||||
data.owner=p_owner;
|
||||
data.owner->data.owned.push_back( this );
|
||||
data.OW = data.owner->data.owned.back();
|
||||
|
@ -1332,7 +1349,29 @@ String Node::get_filename() const {
|
|||
return data.filename;
|
||||
}
|
||||
|
||||
void Node::set_editable_instance(Node* p_node,bool p_editable) {
|
||||
|
||||
ERR_FAIL_NULL(p_node);
|
||||
ERR_FAIL_COND(!is_a_parent_of(p_node));
|
||||
NodePath p = get_path_to(p_node);
|
||||
if (!p_editable)
|
||||
data.editable_instances.erase(p);
|
||||
else
|
||||
data.editable_instances[p]=true;
|
||||
|
||||
}
|
||||
|
||||
bool Node::is_editable_instance(Node *p_node) const {
|
||||
|
||||
if (!p_node)
|
||||
return false; //easier, null is never editable :)
|
||||
ERR_FAIL_COND_V(!is_a_parent_of(p_node),false);
|
||||
NodePath p = get_path_to(p_node);
|
||||
return data.editable_instances.has(p);
|
||||
}
|
||||
|
||||
|
||||
#if 0
|
||||
|
||||
void Node::generate_instance_state() {
|
||||
|
||||
|
@ -1383,13 +1422,36 @@ Dictionary Node::get_instance_state() const {
|
|||
return data.instance_state;
|
||||
}
|
||||
|
||||
Vector<StringName> Node::get_instance_groups() const {
|
||||
#endif
|
||||
|
||||
return data.instance_groups;
|
||||
void Node::set_scene_instance_state(const Ref<SceneState>& p_state) {
|
||||
|
||||
data.instance_state=p_state;
|
||||
}
|
||||
Vector<Node::Connection> Node::get_instance_connections() const{
|
||||
|
||||
return data.instance_connections;
|
||||
Ref<SceneState> Node::get_scene_instance_state() const{
|
||||
|
||||
return data.instance_state;
|
||||
}
|
||||
|
||||
void Node::set_scene_inherited_state(const Ref<SceneState>& p_state) {
|
||||
|
||||
data.inherited_state=p_state;
|
||||
}
|
||||
|
||||
Ref<SceneState> Node::get_scene_inherited_state() const{
|
||||
|
||||
return data.inherited_state;
|
||||
}
|
||||
|
||||
void Node::set_scene_instance_load_placeholder(bool p_enable) {
|
||||
|
||||
data.use_placeholder=p_enable;
|
||||
}
|
||||
|
||||
bool Node::get_scene_instance_load_placeholder() const{
|
||||
|
||||
return data.use_placeholder;
|
||||
}
|
||||
|
||||
int Node::get_position_in_parent() const {
|
||||
|
@ -1931,7 +1993,7 @@ void Node::_bind_methods() {
|
|||
ObjectTypeDB::bind_method(_MD("has_node","path"),&Node::has_node);
|
||||
ObjectTypeDB::bind_method(_MD("get_node:Node","path"),&Node::get_node);
|
||||
ObjectTypeDB::bind_method(_MD("get_parent:Parent"),&Node::get_parent);
|
||||
ObjectTypeDB::bind_method(_MD("find_node:Node","mask","recursive","owned"),&Node::get_node,DEFVAL(true),DEFVAL(true));
|
||||
ObjectTypeDB::bind_method(_MD("find_node:Node","mask","recursive","owned"),&Node::find_node,DEFVAL(true),DEFVAL(true));
|
||||
ObjectTypeDB::bind_method(_MD("has_node_and_resource","path"),&Node::has_node_and_resource);
|
||||
ObjectTypeDB::bind_method(_MD("get_node_and_resource","path"),&Node::_get_node_and_resource);
|
||||
|
||||
|
@ -2049,6 +2111,7 @@ Node::Node() {
|
|||
data.parent_owned=false;
|
||||
data.in_constructor=true;
|
||||
data.viewport=NULL;
|
||||
data.use_placeholder=false;
|
||||
}
|
||||
|
||||
Node::~Node() {
|
||||
|
@ -2065,3 +2128,4 @@ Node::~Node() {
|
|||
}
|
||||
|
||||
|
||||
////////////////////////////////
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
|
||||
|
||||
class Viewport;
|
||||
class SceneState;
|
||||
class Node : public Object {
|
||||
|
||||
OBJ_TYPE( Node, Object );
|
||||
|
@ -69,9 +70,10 @@ private:
|
|||
struct Data {
|
||||
|
||||
String filename;
|
||||
Dictionary instance_state;
|
||||
Vector<StringName> instance_groups;
|
||||
Vector<Connection> instance_connections;
|
||||
Ref<SceneState> instance_state;
|
||||
Ref<SceneState> inherited_state;
|
||||
|
||||
HashMap<NodePath,int> editable_instances;
|
||||
|
||||
Node *parent;
|
||||
Node *owner;
|
||||
|
@ -96,6 +98,7 @@ private:
|
|||
PauseMode pause_mode;
|
||||
Node *pause_owner;
|
||||
// variables used to properly sort the node when processing, ignored otherwise
|
||||
//should move all the stuff below to bits
|
||||
bool fixed_process;
|
||||
bool idle_process;
|
||||
|
||||
|
@ -105,6 +108,9 @@ private:
|
|||
|
||||
bool parent_owned;
|
||||
bool in_constructor;
|
||||
bool use_placeholder;
|
||||
|
||||
|
||||
} data;
|
||||
|
||||
|
||||
|
@ -112,6 +118,7 @@ private:
|
|||
|
||||
virtual bool _use_builtin_script() const { return true; }
|
||||
Node *_get_node(const NodePath& p_path) const;
|
||||
Node *_get_child_by_name(const StringName& p_name) const;
|
||||
|
||||
|
||||
|
||||
|
@ -151,7 +158,7 @@ protected:
|
|||
|
||||
static void _bind_methods();
|
||||
|
||||
friend class PackedScene;
|
||||
friend class SceneState;
|
||||
|
||||
void _add_child_nocheck(Node* p_child,const StringName& p_name);
|
||||
void _set_owner_nocheck(Node* p_owner);
|
||||
|
@ -208,7 +215,7 @@ public:
|
|||
|
||||
struct GroupInfo {
|
||||
|
||||
String name;
|
||||
StringName name;
|
||||
bool persistent;
|
||||
};
|
||||
|
||||
|
@ -229,7 +236,11 @@ public:
|
|||
|
||||
void set_filename(const String& p_filename);
|
||||
String get_filename() const;
|
||||
|
||||
|
||||
void set_editable_instance(Node* p_node,bool p_editable);
|
||||
bool is_editable_instance(Node* p_node) const;
|
||||
|
||||
|
||||
/* NOTIFICATIONS */
|
||||
|
||||
void propagate_notification(int p_notification);
|
||||
|
@ -261,10 +272,14 @@ public:
|
|||
//Node *clone_tree() const;
|
||||
|
||||
// used by editors, to save what has changed only
|
||||
void generate_instance_state();
|
||||
Dictionary get_instance_state() const;
|
||||
Vector<StringName> get_instance_groups() const;
|
||||
Vector<Connection> get_instance_connections() const;
|
||||
void set_scene_instance_state(const Ref<SceneState>& p_state);
|
||||
Ref<SceneState> get_scene_instance_state() const;
|
||||
|
||||
void set_scene_inherited_state(const Ref<SceneState>& p_state);
|
||||
Ref<SceneState> get_scene_inherited_state() const;
|
||||
|
||||
void set_scene_instance_load_placeholder(bool p_enable);
|
||||
bool get_scene_instance_load_placeholder() const;
|
||||
|
||||
static Vector<Variant> make_binds(VARIANT_ARG_LIST);
|
||||
|
||||
|
@ -307,6 +322,4 @@ public:
|
|||
typedef Set<Node*,Node::Comparator> NodeSet;
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
#include "resources/default_theme/default_theme.h"
|
||||
#include "object_type_db.h"
|
||||
#include "scene/main/canvas_layer.h"
|
||||
#include "scene/main/instance_placeholder.h"
|
||||
#include "scene/main/viewport.h"
|
||||
#include "scene/gui/control.h"
|
||||
#include "scene/gui/texture_progress.h"
|
||||
|
@ -216,7 +217,7 @@
|
|||
#include "scene/3d/collision_polygon.h"
|
||||
#endif
|
||||
|
||||
|
||||
#include "scene/resources/scene_format_text.h"
|
||||
|
||||
static ResourceFormatLoaderImage *resource_loader_image=NULL;
|
||||
static ResourceFormatLoaderWAV *resource_loader_wav=NULL;
|
||||
|
@ -229,6 +230,8 @@ static ResourceFormatLoaderBitMap *resource_loader_bitmap=NULL;
|
|||
static ResourceFormatLoaderTheme *resource_loader_theme=NULL;
|
||||
static ResourceFormatLoaderShader *resource_loader_shader=NULL;
|
||||
|
||||
static ResourceFormatSaverText *resource_saver_text=NULL;
|
||||
|
||||
//static SceneStringNames *string_names;
|
||||
|
||||
void register_scene_types() {
|
||||
|
@ -267,6 +270,7 @@ void register_scene_types() {
|
|||
ObjectTypeDB::register_type<Object>();
|
||||
|
||||
ObjectTypeDB::register_type<Node>();
|
||||
ObjectTypeDB::register_virtual_type<InstancePlaceholder>();
|
||||
|
||||
ObjectTypeDB::register_type<Viewport>();
|
||||
ObjectTypeDB::register_virtual_type<RenderTargetTexture>();
|
||||
|
@ -612,6 +616,9 @@ void register_scene_types() {
|
|||
OS::get_singleton()->yield(); //may take time to init
|
||||
|
||||
|
||||
resource_saver_text = memnew( ResourceFormatSaverText );
|
||||
ResourceSaver::add_resource_format_saver(resource_saver_text);
|
||||
|
||||
}
|
||||
|
||||
void unregister_scene_types() {
|
||||
|
@ -629,5 +636,9 @@ void unregister_scene_types() {
|
|||
|
||||
memdelete( resource_loader_theme );
|
||||
memdelete( resource_loader_shader );
|
||||
|
||||
if (resource_saver_text) {
|
||||
memdelete(resource_saver_text);
|
||||
}
|
||||
SceneStringNames::free();
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ static TexCacheMap *tex_cache;
|
|||
|
||||
template<class T>
|
||||
static Ref<StyleBoxTexture> make_stylebox(T p_src,float p_left, float p_top, float p_right, float p_botton,float p_margin_left=-1, float p_margin_top=-1, float p_margin_right=-1, float p_margin_botton=-1, bool p_draw_center=true) {
|
||||
|
||||
|
||||
Ref<ImageTexture> texture;
|
||||
|
||||
|
||||
|
@ -56,17 +56,17 @@ static Ref<StyleBoxTexture> make_stylebox(T p_src,float p_left, float p_top, flo
|
|||
style->set_default_margin( MARGIN_BOTTOM, p_margin_botton );
|
||||
style->set_default_margin( MARGIN_TOP, p_margin_top );
|
||||
style->set_draw_center(p_draw_center);
|
||||
|
||||
|
||||
return style;
|
||||
}
|
||||
|
||||
template<class T>
|
||||
static Ref<Texture> make_icon(T p_src) {
|
||||
|
||||
|
||||
|
||||
|
||||
Ref<ImageTexture> texture( memnew( ImageTexture ) );
|
||||
texture->create_from_image( Image(p_src),ImageTexture::FLAG_FILTER );
|
||||
|
||||
|
||||
return texture;
|
||||
}
|
||||
|
||||
|
@ -75,7 +75,7 @@ static Ref<Font> make_font(int p_height,int p_ascent, int p_valign, int p_charco
|
|||
|
||||
Ref<Font> font( memnew( Font ) );
|
||||
font->add_texture( p_texture );
|
||||
|
||||
|
||||
for (int i=0;i<p_charcount;i++) {
|
||||
|
||||
const int *c = &p_chars[i*8];
|
||||
|
@ -91,9 +91,9 @@ static Ref<Font> make_font(int p_height,int p_ascent, int p_valign, int p_charco
|
|||
|
||||
|
||||
font->add_char( chr, 0, frect, align,advance );
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
font->set_height( p_height );
|
||||
font->set_ascent( p_ascent );
|
||||
|
||||
|
@ -152,12 +152,12 @@ static Ref<Font> make_font2(int p_height,int p_ascent, int p_charcount, const in
|
|||
static Ref<StyleBox> make_empty_stylebox(float p_margin_left=-1, float p_margin_top=-1, float p_margin_right=-1, float p_margin_botton=-1) {
|
||||
|
||||
Ref<StyleBox> style( memnew( StyleBoxEmpty) );
|
||||
|
||||
|
||||
style->set_default_margin( MARGIN_LEFT, p_margin_left );
|
||||
style->set_default_margin( MARGIN_RIGHT, p_margin_right );
|
||||
style->set_default_margin( MARGIN_BOTTOM, p_margin_botton );
|
||||
style->set_default_margin( MARGIN_TOP, p_margin_top );
|
||||
|
||||
|
||||
return style;
|
||||
}
|
||||
|
||||
|
@ -299,49 +299,49 @@ void make_default_theme() {
|
|||
|
||||
t->set_constant("hseparation","MenuButton", 3 );
|
||||
|
||||
// CheckBox
|
||||
// CheckBox
|
||||
|
||||
Ref<StyleBox> cbx_empty = memnew( StyleBoxEmpty );
|
||||
cbx_empty->set_default_margin(MARGIN_LEFT,22);
|
||||
cbx_empty->set_default_margin(MARGIN_RIGHT,4);
|
||||
cbx_empty->set_default_margin(MARGIN_TOP,4);
|
||||
cbx_empty->set_default_margin(MARGIN_BOTTOM,5);
|
||||
Ref<StyleBox> cbx_focus = focus;
|
||||
cbx_focus->set_default_margin(MARGIN_LEFT,4);
|
||||
cbx_focus->set_default_margin(MARGIN_RIGHT,22);
|
||||
cbx_focus->set_default_margin(MARGIN_TOP,4);
|
||||
cbx_focus->set_default_margin(MARGIN_BOTTOM,5);
|
||||
Ref<StyleBox> cbx_empty = memnew( StyleBoxEmpty );
|
||||
cbx_empty->set_default_margin(MARGIN_LEFT,22);
|
||||
cbx_empty->set_default_margin(MARGIN_RIGHT,4);
|
||||
cbx_empty->set_default_margin(MARGIN_TOP,4);
|
||||
cbx_empty->set_default_margin(MARGIN_BOTTOM,5);
|
||||
Ref<StyleBox> cbx_focus = focus;
|
||||
cbx_focus->set_default_margin(MARGIN_LEFT,4);
|
||||
cbx_focus->set_default_margin(MARGIN_RIGHT,22);
|
||||
cbx_focus->set_default_margin(MARGIN_TOP,4);
|
||||
cbx_focus->set_default_margin(MARGIN_BOTTOM,5);
|
||||
|
||||
t->set_stylebox("normal","CheckBox", cbx_empty );
|
||||
t->set_stylebox("pressed","CheckBox", cbx_empty );
|
||||
t->set_stylebox("disabled","CheckBox", cbx_empty );
|
||||
t->set_stylebox("hover","CheckBox", cbx_empty );
|
||||
t->set_stylebox("focus","CheckBox", cbx_focus );
|
||||
t->set_stylebox("normal","CheckBox", cbx_empty );
|
||||
t->set_stylebox("pressed","CheckBox", cbx_empty );
|
||||
t->set_stylebox("disabled","CheckBox", cbx_empty );
|
||||
t->set_stylebox("hover","CheckBox", cbx_empty );
|
||||
t->set_stylebox("focus","CheckBox", cbx_focus );
|
||||
|
||||
t->set_icon("checked", "CheckBox", make_icon(checked_png));
|
||||
t->set_icon("unchecked", "CheckBox", make_icon(unchecked_png));
|
||||
t->set_icon("radio_checked", "CheckBox", make_icon(radio_checked_png));
|
||||
t->set_icon("radio_unchecked", "CheckBox", make_icon(radio_unchecked_png));
|
||||
t->set_icon("checked", "CheckBox", make_icon(checked_png));
|
||||
t->set_icon("unchecked", "CheckBox", make_icon(unchecked_png));
|
||||
t->set_icon("radio_checked", "CheckBox", make_icon(radio_checked_png));
|
||||
t->set_icon("radio_unchecked", "CheckBox", make_icon(radio_unchecked_png));
|
||||
|
||||
t->set_font("font","CheckBox", default_font );
|
||||
t->set_font("font","CheckBox", default_font );
|
||||
|
||||
t->set_color("font_color","CheckBox", control_font_color );
|
||||
t->set_color("font_color_pressed","CheckBox", control_font_color_pressed );
|
||||
t->set_color("font_color_hover","CheckBox", control_font_color_hover );
|
||||
t->set_color("font_color_disabled","CheckBox", control_font_color_disabled );
|
||||
t->set_color("font_color","CheckBox", control_font_color );
|
||||
t->set_color("font_color_pressed","CheckBox", control_font_color_pressed );
|
||||
t->set_color("font_color_hover","CheckBox", control_font_color_hover );
|
||||
t->set_color("font_color_disabled","CheckBox", control_font_color_disabled );
|
||||
|
||||
t->set_constant("hseparation","CheckBox",4);
|
||||
t->set_constant("check_vadjust","CheckBox",0);
|
||||
t->set_constant("hseparation","CheckBox",4);
|
||||
t->set_constant("check_vadjust","CheckBox",0);
|
||||
|
||||
|
||||
|
||||
// CheckButton
|
||||
|
||||
|
||||
Ref<StyleBox> cb_empty = memnew( StyleBoxEmpty );
|
||||
cb_empty->set_default_margin(MARGIN_LEFT,6);
|
||||
cb_empty->set_default_margin(MARGIN_RIGHT,70);
|
||||
cb_empty->set_default_margin(MARGIN_TOP,4);
|
||||
cb_empty->set_default_margin(MARGIN_BOTTOM,4);
|
||||
cb_empty->set_default_margin(MARGIN_BOTTOM,4);
|
||||
|
||||
t->set_stylebox("normal","CheckButton", cb_empty );
|
||||
t->set_stylebox("pressed","CheckButton", cb_empty );
|
||||
|
@ -365,7 +365,7 @@ void make_default_theme() {
|
|||
|
||||
|
||||
// Label
|
||||
|
||||
|
||||
t->set_font("font","Label", default_font );
|
||||
|
||||
t->set_color("font_color","Label", Color(1,1,1) );
|
||||
|
@ -556,10 +556,16 @@ void make_default_theme() {
|
|||
|
||||
// GraphNode
|
||||
|
||||
Ref<StyleBoxTexture> graphsb = make_stylebox(graph_node_png,6,24,6,5,16,24,16,5);
|
||||
Ref<StyleBoxTexture> graphsb = make_stylebox(graph_node_png,6,24,6,5,3,24,16,5);
|
||||
Ref<StyleBoxTexture> graphsbselected = make_stylebox(graph_node_selected_png,6,24,6,5,3,24,16,5);
|
||||
Ref<StyleBoxTexture> graphsbdefault = make_stylebox(graph_node_default_png,4,4,4,4,6,4,4,4);
|
||||
Ref<StyleBoxTexture> graphsbdeffocus = make_stylebox(graph_node_default_focus_png,4,4,4,4,6,4,4,4);
|
||||
//graphsb->set_expand_margin_size(MARGIN_LEFT,10);
|
||||
//graphsb->set_expand_margin_size(MARGIN_RIGHT,10);
|
||||
t->set_stylebox("frame","GraphNode", graphsb );
|
||||
t->set_stylebox("selectedframe","GraphNode", graphsbselected );
|
||||
t->set_stylebox("defaultframe", "GraphNode", graphsbdefault );
|
||||
t->set_stylebox("defaultfocus", "GraphNode", graphsbdeffocus );
|
||||
t->set_constant("separation","GraphNode", 1 );
|
||||
t->set_icon("port","GraphNode", make_icon( graph_port_png ) );
|
||||
t->set_icon("close","GraphNode", make_icon( graph_node_close_png ) );
|
||||
|
@ -713,7 +719,7 @@ void make_default_theme() {
|
|||
|
||||
|
||||
// FileDialog
|
||||
|
||||
|
||||
t->set_icon("folder","FileDialog",make_icon(icon_folder_png));
|
||||
t->set_color("files_disabled","FileDialog",Color(0,0,0,0.7));
|
||||
|
||||
|
@ -877,10 +883,10 @@ void make_default_theme() {
|
|||
|
||||
#endif
|
||||
void clear_default_theme() {
|
||||
|
||||
|
||||
Theme::set_default( Ref<Theme>() );
|
||||
Theme::set_default_icon( Ref< Texture >() );
|
||||
Theme::set_default_style( Ref< StyleBox >() );
|
||||
Theme::set_default_style( Ref< StyleBox >() );
|
||||
Theme::set_default_font( Ref< Font >() );
|
||||
|
||||
}
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 289 B |
Binary file not shown.
After Width: | Height: | Size: 408 B |
Binary file not shown.
After Width: | Height: | Size: 738 B |
|
@ -114,6 +114,21 @@ static const unsigned char graph_node_close_png[]={
|
|||
};
|
||||
|
||||
|
||||
static const unsigned char graph_node_default_png[]={
|
||||
0x89,0x50,0x4e,0x47,0xd,0xa,0x1a,0xa,0x0,0x0,0x0,0xd,0x49,0x48,0x44,0x52,0x0,0x0,0x0,0x10,0x0,0x0,0x0,0x10,0x8,0x6,0x0,0x0,0x0,0x1f,0xf3,0xff,0x61,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,0xdf,0x8,0x1a,0x17,0x2e,0xd,0x4c,0xb7,0x38,0x4,0x0,0x0,0x0,0x1d,0x69,0x54,0x58,0x74,0x43,0x6f,0x6d,0x6d,0x65,0x6e,0x74,0x0,0x0,0x0,0x0,0x0,0x43,0x72,0x65,0x61,0x74,0x65,0x64,0x20,0x77,0x69,0x74,0x68,0x20,0x47,0x49,0x4d,0x50,0x64,0x2e,0x65,0x7,0x0,0x0,0x0,0x85,0x49,0x44,0x41,0x54,0x38,0xcb,0xed,0x93,0x31,0xa,0x83,0x40,0x14,0x44,0xdf,0xba,0xa5,0x20,0x41,0x30,0x20,0x4,0xab,0x40,0x20,0x7,0xc9,0x69,0xec,0x72,0x4e,0x9b,0xa0,0x1e,0xc1,0x2a,0x42,0x10,0x82,0xbb,0xc5,0x77,0x6d,0x4c,0x11,0x48,0xe3,0xb7,0x49,0xe1,0x6b,0x6,0xa6,0x78,0xd5,0x8c,0x1,0x6e,0x80,0xe1,0x9b,0xb0,0xe4,0xaf,0xde,0x3,0x4f,0xa0,0x3,0x6,0x93,0x67,0xa7,0xc0,0xa,0x44,0x64,0x72,0x7e,0x6c,0x87,0xf7,0xab,0x4,0x1e,0x68,0x38,0x17,0x97,0x90,0xc4,0x87,0xa,0xb8,0xa2,0xe5,0x98,0xe6,0x1,0xb8,0x47,0x5a,0x81,0xb5,0x16,0xa0,0x56,0xb,0x3e,0xec,0x82,0x3f,0x10,0x4c,0x6a,0x81,0x88,0x78,0xc0,0x45,0xda,0x29,0x3b,0x3f,0x36,0x40,0xbf,0xf9,0x4c,0x66,0xeb,0x9d,0x67,0x5c,0x46,0x37,0x51,0xb6,0x55,0x6d,0xc2,0x0,0x0,0x0,0x0,0x49,0x45,0x4e,0x44,0xae,0x42,0x60,0x82
|
||||
};
|
||||
|
||||
|
||||
static const unsigned char graph_node_default_focus_png[]={
|
||||
0x89,0x50,0x4e,0x47,0xd,0xa,0x1a,0xa,0x0,0x0,0x0,0xd,0x49,0x48,0x44,0x52,0x0,0x0,0x0,0x10,0x0,0x0,0x0,0x10,0x8,0x6,0x0,0x0,0x0,0x1f,0xf3,0xff,0x61,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,0xdf,0x8,0x1b,0x1,0x9,0x1c,0x5c,0xd5,0x12,0x34,0x0,0x0,0x0,0x1d,0x69,0x54,0x58,0x74,0x43,0x6f,0x6d,0x6d,0x65,0x6e,0x74,0x0,0x0,0x0,0x0,0x0,0x43,0x72,0x65,0x61,0x74,0x65,0x64,0x20,0x77,0x69,0x74,0x68,0x20,0x47,0x49,0x4d,0x50,0x64,0x2e,0x65,0x7,0x0,0x0,0x0,0xfc,0x49,0x44,0x41,0x54,0x38,0xcb,0xbd,0x93,0x41,0x4a,0x4,0x41,0xc,0x45,0x7f,0xca,0x6a,0x14,0x42,0x2f,0xc4,0x85,0x7,0xf0,0x3c,0xde,0xa2,0xbc,0x41,0xd7,0xa2,0xa1,0x60,0xea,0x60,0xae,0x5c,0xea,0x19,0xdc,0xd7,0x42,0x97,0xe5,0xc,0x12,0xeb,0xbb,0x69,0xa5,0x84,0xe9,0x41,0x1d,0xf1,0x43,0x8,0x84,0xe4,0x2d,0x92,0x1f,0xc1,0x22,0x92,0x2,0xc0,0x2d,0x81,0x2e,0x7f,0xa8,0x75,0xb9,0x89,0x8,0x1,0x40,0x48,0x5e,0x76,0xcd,0xad,0x6b,0x74,0x7b,0xea,0x6,0xe0,0x75,0x9,0x13,0x11,0xca,0x34,0x4d,0xc4,0x37,0x35,0xc,0xc3,0xf3,0x38,0x8e,0xb7,0xf3,0x3c,0xdf,0x0,0xd8,0x1,0x30,0x90,0x4,0x49,0xe4,0x9c,0x11,0x42,0x40,0x29,0x65,0x15,0x50,0x4a,0xb9,0x8,0x21,0x30,0xe7,0x7c,0x47,0x52,0x49,0x9e,0x7c,0x2,0x62,0x8c,0x30,0x33,0xa8,0xea,0x2a,0x40,0x55,0xaf,0xcc,0x4c,0x62,0x8c,0x5b,0x92,0xe7,0x24,0x7,0xd7,0x2d,0x11,0xde,0x7b,0xd4,0x5a,0x57,0x1,0xb5,0xd6,0x47,0xef,0x3d,0x49,0x9e,0x1,0xf0,0x0,0x9c,0xc3,0xef,0xe5,0xf6,0x9d,0xea,0x5f,0x1,0x38,0x16,0xd0,0xfe,0x16,0x20,0x22,0x7,0x3d,0xd0,0x7b,0x41,0x44,0xb6,0x8b,0x2b,0x9b,0xeb,0x6e,0x8c,0x94,0x12,0xcc,0x6c,0x75,0xd8,0xcc,0xc6,0x94,0xd2,0x93,0xaa,0xde,0x2f,0x76,0x6e,0x3f,0xb2,0xb2,0x88,0xec,0x54,0xf5,0x61,0xb3,0xd9,0x5c,0x3,0x78,0x1,0x60,0xc7,0x3c,0x53,0x13,0x91,0x37,0xe9,0x9d,0xd8,0xe9,0xf4,0xc0,0xe2,0xbe,0xbc,0xf3,0x3b,0x49,0xa0,0x89,0xbf,0x71,0xc6,0xcd,0x1c,0x0,0x0,0x0,0x0,0x49,0x45,0x4e,0x44,0xae,0x42,0x60,0x82
|
||||
};
|
||||
|
||||
|
||||
static const unsigned char graph_node_selected_png[]={
|
||||
0x89,0x50,0x4e,0x47,0xd,0xa,0x1a,0xa,0x0,0x0,0x0,0xd,0x49,0x48,0x44,0x52,0x0,0x0,0x0,0x10,0x0,0x0,0x0,0x40,0x8,0x6,0x0,0x0,0x0,0x13,0x7d,0xf7,0x96,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,0xdf,0x7,0x12,0x1,0xc,0x6,0x23,0x98,0xc7,0x50,0x0,0x0,0x0,0x1d,0x69,0x54,0x58,0x74,0x43,0x6f,0x6d,0x6d,0x65,0x6e,0x74,0x0,0x0,0x0,0x0,0x0,0x43,0x72,0x65,0x61,0x74,0x65,0x64,0x20,0x77,0x69,0x74,0x68,0x20,0x47,0x49,0x4d,0x50,0x64,0x2e,0x65,0x7,0x0,0x0,0x2,0x46,0x49,0x44,0x41,0x54,0x58,0xc3,0xed,0x97,0xcd,0x6a,0x13,0x51,0x14,0xc7,0x7f,0xe7,0xce,0x34,0x49,0xd,0xa6,0xb1,0x2a,0xe2,0x7,0x74,0xa1,0x6e,0x4,0x85,0xe2,0x3,0xb8,0x72,0x21,0xba,0x16,0x5c,0xb9,0x16,0x4,0x7d,0x84,0x3e,0x82,0x82,0xe0,0xda,0x95,0x2f,0x60,0x71,0xe1,0xca,0x7,0xd0,0x82,0xa5,0x6e,0xd4,0x45,0xc1,0x8f,0x4a,0x6c,0x9a,0x46,0x62,0x66,0xa6,0x73,0xef,0x71,0xe1,0x4c,0x92,0x99,0x4c,0x93,0x36,0xdd,0xc9,0xfc,0x37,0x77,0x3e,0xee,0xfd,0xdd,0x73,0xfe,0xf7,0xc,0xcc,0x11,0x86,0x12,0xc0,0x0,0x5e,0x32,0xa,0x59,0x29,0xe0,0x0,0x9b,0x8c,0xca,0xc8,0x24,0x3,0x1c,0x3,0x16,0x81,0xd3,0x40,0x3,0x98,0xcb,0x1,0xf6,0x80,0x2e,0xd0,0x2,0xda,0xc0,0x1f,0xc0,0xa5,0xbb,0xd6,0x81,0x4b,0xb,0xc7,0x9b,0xf,0x6a,0xd5,0xda,0xad,0x4a,0xa5,0x7a,0x81,0x2,0x45,0x51,0xf8,0x35,0x8,0x83,0xd7,0xbb,0xbf,0x3b,0xcf,0x81,0xcf,0x40,0x4f,0x92,0x9d,0x96,0x16,0x9b,0x27,0x9f,0x5c,0x5c,0xba,0x7c,0xfb,0xfe,0xcb,0x3b,0x34,0x2b,0x27,0x8a,0xd6,0xd3,0x89,0x76,0x78,0x71,0xef,0x15,0x5f,0x36,0x3f,0xad,0xb6,0x3b,0xdb,0x8f,0x81,0x4d,0x1,0x6a,0xc0,0xf2,0xd9,0x33,0xe7,0xdf,0xac,0xbc,0x7d,0x54,0xdf,0x73,0x11,0x81,0xed,0x17,0x2,0x6a,0xde,0x3c,0x73,0xa6,0xc2,0xca,0x8d,0xa7,0xbd,0x1f,0x3f,0xbf,0xdd,0x4,0xd6,0xfc,0xc4,0x87,0xba,0xef,0xf9,0xf5,0x6e,0xb4,0xc3,0x24,0xf5,0xe3,0x1e,0x7d,0x7a,0xf8,0x9e,0x5f,0x4f,0xd2,0x96,0x14,0xe0,0x1,0x58,0xb5,0x39,0xdb,0x1d,0x82,0x19,0x5c,0xe7,0xe4,0xa5,0x0,0x4d,0x8f,0x44,0x71,0xa8,0x2a,0x22,0x92,0x81,0x4c,0x92,0x3f,0x7a,0xe3,0xd4,0xe2,0x54,0x41,0xc1,0x13,0xf,0xc5,0xe1,0x54,0x31,0x22,0x8,0xa6,0x10,0x96,0x1,0x58,0x1d,0x4e,0x88,0x35,0x1e,0x79,0x9e,0xd6,0xd0,0x94,0x8,0x54,0xb3,0x93,0x1c,0x8a,0x41,0x6,0x63,0xfa,0x6c,0x5f,0x40,0xe4,0xa2,0xcc,0x4b,0x23,0x32,0xd8,0x37,0x4e,0x52,0x99,0x1c,0x41,0x2e,0x4c,0x9b,0xdd,0x6c,0xec,0xbe,0x20,0x5,0xe5,0xb0,0xca,0x99,0x68,0x93,0x48,0x14,0x41,0x30,0x22,0x3,0x63,0x5,0x41,0x51,0x3c,0x31,0x93,0x8f,0x31,0xf3,0xed,0x6a,0xf6,0x5b,0xfe,0xe7,0x85,0x9b,0x0,0x98,0x52,0x34,0x7,0x2a,0xa4,0xb4,0x74,0x8b,0x4c,0x2d,0x2a,0xa6,0xb1,0x42,0x32,0x8c,0x1b,0x39,0x3c,0x7b,0x37,0xbd,0x90,0xec,0x51,0x52,0x88,0x5d,0x3c,0x36,0x21,0xd,0x39,0x4d,0x4d,0x72,0xc5,0x94,0x1,0xac,0xde,0x7d,0x3f,0xbb,0x89,0xf1,0x9e,0x65,0xf9,0xea,0xf5,0x3,0x2d,0x5a,0x5b,0x7f,0x57,0x1c,0xc1,0x6e,0xb7,0x73,0xe8,0x8,0xc,0x47,0x54,0x9,0x28,0x1,0x25,0xa0,0x4,0x94,0x80,0x12,0x50,0x2,0xfe,0x4b,0x80,0x14,0xf4,0x88,0x87,0x8e,0xc0,0xcd,0xb0,0xd6,0xa5,0x0,0x7,0x4,0xd6,0xda,0xb0,0xe0,0x27,0x6d,0x7c,0x55,0xc,0xd6,0xda,0x10,0x8,0x0,0x67,0x92,0x56,0x76,0x3b,0x8,0xfb,0x1b,0xad,0xf6,0x16,0x93,0x20,0x2e,0x86,0x56,0x7b,0x8b,0x20,0xec,0x6f,0x0,0xdb,0x80,0x4d,0x3b,0xd7,0x5,0xe0,0x5a,0xa3,0xde,0x7c,0x56,0xab,0xce,0x5f,0xf1,0x3c,0xaf,0xd0,0x5c,0x6b,0xad,0xb,0xc2,0xfe,0xc7,0x6e,0xaf,0xf3,0x10,0xf8,0x0,0xec,0xca,0x48,0xb,0xd7,0x0,0xce,0x1,0xa7,0x80,0xea,0x3e,0xcd,0x77,0x8,0xfc,0x2,0xbe,0x27,0x7d,0xb4,0x95,0x9c,0xa1,0x7e,0xda,0xf,0xee,0x93,0x85,0x26,0x29,0xc7,0x33,0x1a,0x3f,0xae,0xbf,0xf0,0x27,0xf6,0x42,0xf6,0xf5,0xfd,0xae,0x0,0x0,0x0,0x0,0x49,0x45,0x4e,0x44,0xae,0x42,0x60,0x82
|
||||
};
|
||||
|
||||
|
||||
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
|
||||
};
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -32,26 +32,27 @@
|
|||
#include "resource.h"
|
||||
#include "scene/main/node.h"
|
||||
|
||||
//changes:
|
||||
//1-make the InstanceState a reference inside the resource that can be shared
|
||||
//2-make the instance "editable" with a flag, save here and load here, no need for property
|
||||
//3-properly save modifications in sub-scene
|
||||
//4-add scene inheritance
|
||||
//5-chain of instance states in editor? (to check what was modified)
|
||||
//6-saving will be hell
|
||||
|
||||
class SceneState : public Reference {
|
||||
|
||||
class PackedScene : public Resource {
|
||||
|
||||
OBJ_TYPE( PackedScene, Resource );
|
||||
RES_BASE_EXTENSION("scn");
|
||||
OBJ_TYPE( SceneState, Reference );
|
||||
Vector<StringName> names;
|
||||
Vector<Variant> variants;
|
||||
Vector<NodePath> node_paths;
|
||||
Vector<NodePath> editable_instances;
|
||||
mutable HashMap<NodePath,int> node_path_cache;
|
||||
mutable Map<int,int> base_scene_node_remap;
|
||||
|
||||
//missing - instances
|
||||
//missing groups
|
||||
//missing - owner
|
||||
//missing - override names and values
|
||||
int base_scene_idx;
|
||||
|
||||
enum {
|
||||
FLAG_ID_IS_PATH=(1<<30),
|
||||
FLAG_INSTANCE_IS_PLACEHOLDER=(1<<30),
|
||||
FLAG_MASK=(1<<24)-1,
|
||||
NO_PARENT_SAVED=0x7FFFFFFF,
|
||||
TYPE_INSTANCED=0x7FFFFFFF,
|
||||
|
||||
};
|
||||
|
||||
struct NodeData {
|
||||
|
||||
|
@ -68,9 +69,15 @@ class PackedScene : public Resource {
|
|||
};
|
||||
|
||||
Vector<Property> properties;
|
||||
Vector<int> groups;
|
||||
Vector<int> groups;
|
||||
|
||||
};
|
||||
|
||||
struct PackState {
|
||||
Ref<SceneState> state;
|
||||
int node;
|
||||
PackState() { node=-1; }
|
||||
};
|
||||
|
||||
Vector<NodeData> nodes;
|
||||
|
||||
|
@ -86,16 +93,78 @@ class PackedScene : public Resource {
|
|||
|
||||
Vector<ConnectionData> connections;
|
||||
|
||||
Error _parse_node(Node *p_owner,Node *p_node,int p_parent_idx, Map<StringName,int> &name_map,HashMap<Variant,int,VariantHasher> &variant_map,Map<Node*,int> &node_map);
|
||||
Error _parse_connections(Node *p_owner,Node *p_node, Map<StringName,int> &name_map,HashMap<Variant,int,VariantHasher> &variant_map,Map<Node*,int> &node_map);
|
||||
|
||||
Error _parse_node(Node *p_owner,Node *p_node,int p_parent_idx, Map<StringName,int> &name_map,HashMap<Variant,int,VariantHasher> &variant_map,Map<Node*,int> &node_map,Map<Node*,int> &nodepath_map);
|
||||
Error _parse_connections(Node *p_owner,Node *p_node, Map<StringName,int> &name_map,HashMap<Variant,int,VariantHasher> &variant_map,Map<Node*,int> &node_map,Map<Node*,int> &nodepath_map);
|
||||
|
||||
String path;
|
||||
|
||||
_FORCE_INLINE_ Ref<SceneState> _get_base_scene_state() const;
|
||||
|
||||
static bool disable_placeholders;
|
||||
public:
|
||||
|
||||
static void set_disable_placeholders(bool p_disable);
|
||||
|
||||
int find_node_by_path(const NodePath& p_node) const;
|
||||
Variant get_property_value(int p_node,const StringName& p_property,bool &found) const;
|
||||
bool is_node_in_group(int p_node,const StringName& p_group) const;
|
||||
bool is_connection(int p_node,const StringName& p_signal,int p_to_node,const StringName& p_to_method) const;
|
||||
|
||||
|
||||
void set_bundled_scene(const Dictionary& p_dictionary);
|
||||
Dictionary get_bundled_scene() const;
|
||||
|
||||
Error pack(Node *p_scene);
|
||||
|
||||
void set_path(const String &p_path);
|
||||
String get_path() const;
|
||||
|
||||
void clear();
|
||||
|
||||
bool can_instance() const;
|
||||
Node *instance(bool p_gen_edit_state=false) const;
|
||||
|
||||
|
||||
//build-unbuild API
|
||||
|
||||
int get_node_count() const;
|
||||
StringName get_node_type(int p_idx) const;
|
||||
StringName get_node_name(int p_idx) const;
|
||||
NodePath get_node_path(int p_idx,bool p_for_parent=false) const;
|
||||
NodePath get_node_owner_path(int p_idx) const;
|
||||
Ref<PackedScene> get_node_instance(int p_idx) const;
|
||||
Vector<StringName> get_node_groups(int p_idx) const;
|
||||
|
||||
int get_node_property_count(int p_idx) const;
|
||||
StringName get_node_property_name(int p_idx,int p_prop) const;
|
||||
Variant get_node_property_value(int p_idx,int p_prop) const;
|
||||
|
||||
int get_connection_count() const;
|
||||
NodePath get_connection_source(int p_idx) const;
|
||||
StringName get_connection_signal(int p_idx) const;
|
||||
NodePath get_connection_target(int p_idx) const;
|
||||
StringName get_connection_method(int p_idx) const;
|
||||
int get_connection_flags(int p_idx) const;
|
||||
Array get_connection_binds(int p_idx) const;
|
||||
|
||||
Vector<NodePath> get_editable_instances() const;
|
||||
|
||||
SceneState();
|
||||
};
|
||||
|
||||
class PackedScene : public Resource {
|
||||
|
||||
OBJ_TYPE(PackedScene, Resource );
|
||||
RES_BASE_EXTENSION("scn");
|
||||
|
||||
Ref<SceneState> state;
|
||||
|
||||
void _set_bundled_scene(const Dictionary& p_scene);
|
||||
Dictionary _get_bundled_scene() const;
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
static void _bind_methods();
|
||||
public:
|
||||
|
||||
|
@ -107,7 +176,12 @@ public:
|
|||
bool can_instance() const;
|
||||
Node *instance(bool p_gen_edit_state=false) const;
|
||||
|
||||
virtual void set_path(const String& p_path,bool p_take_over=false);
|
||||
|
||||
Ref<SceneState> get_state();
|
||||
|
||||
PackedScene();
|
||||
|
||||
};
|
||||
|
||||
#endif // SCENE_PRELOADER_H
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue