summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2015-05-25 01:46:45 -0300
committerJuan Linietsky <reduzio@gmail.com>2015-05-25 01:47:02 -0300
commitf36e7dcb405ead38c33d808f732fd7b4e23d19e5 (patch)
treec9c32ce63935fbb3670ae51b921d1a0d1992256f /core
parentf8f3362cab16ddfbc1d954ecadbccd4838200769 (diff)
downloadredot-engine-f36e7dcb405ead38c33d808f732fd7b4e23d19e5.tar.gz
improved animation editor
-same-value link keys -new layout -forward, backwards playback -integrated curve/property editor -auto increment sprite frame after insert -copy & paste animation resoucres
Diffstat (limited to 'core')
-rw-r--r--core/object.cpp33
-rw-r--r--core/object.h2
-rw-r--r--core/os/main_loop.cpp27
3 files changed, 56 insertions, 6 deletions
diff --git a/core/object.cpp b/core/object.cpp
index 1a51e79a9f..84786df8d4 100644
--- a/core/object.cpp
+++ b/core/object.cpp
@@ -995,12 +995,44 @@ Variant Object::get_meta(const String& p_name) const {
return metadata[p_name];
}
+
Array Object::_get_property_list_bind() const {
List<PropertyInfo> lpi;
get_property_list(&lpi);
return convert_property_list(&lpi);
}
+
+Array Object::_get_method_list_bind() const {
+
+ List<MethodInfo> ml;
+ get_method_list(&ml);
+ Array ret;
+
+ for(List<MethodInfo>::Element *E=ml.front();E;E=E->next()) {
+
+ Dictionary d;
+ d["name"]=E->get().name;
+ d["args"]=convert_property_list(&E->get().arguments);
+ Array da;
+ for(int i=0;i<E->get().default_arguments.size();i++)
+ da.push_back(E->get().default_arguments[i]);
+ d["default_args"]=da;
+ d["flags"]=E->get().flags;
+ d["id"]=E->get().id;
+ Dictionary r;
+ r["type"]=E->get().return_val.type;
+ r["hint"]=E->get().return_val.hint;
+ r["hint_string"]=E->get().return_val.hint_string;
+ d["return_type"]=r;
+ //va.push_back(d);
+ ret.push_back(d);
+ }
+
+ return ret;
+
+}
+
DVector<String> Object::_get_meta_list_bind() const {
DVector<String> _metaret;
@@ -1439,6 +1471,7 @@ void Object::_bind_methods() {
ObjectTypeDB::bind_method(_MD("set","property","value"),&Object::_set_bind);
ObjectTypeDB::bind_method(_MD("get","property"),&Object::_get_bind);
ObjectTypeDB::bind_method(_MD("get_property_list"),&Object::_get_property_list_bind);
+ ObjectTypeDB::bind_method(_MD("get_method_list"),&Object::_get_method_list_bind);
ObjectTypeDB::bind_method(_MD("notification","what"),&Object::notification,DEFVAL(false));
ObjectTypeDB::bind_method(_MD("get_instance_ID"),&Object::get_instance_ID);
diff --git a/core/object.h b/core/object.h
index fc64b91412..8d1f8ebc5a 100644
--- a/core/object.h
+++ b/core/object.h
@@ -54,6 +54,7 @@ enum PropertyHint {
PROPERTY_HINT_ENUM, ///< hint_text= "val1,val2,val3,etc"
PROPERTY_HINT_EXP_EASING, /// exponential easing funciton (Math::ease)
PROPERTY_HINT_LENGTH, ///< hint_text= "length" (as integer)
+ PROPERTY_HINT_SPRITE_FRAME,
PROPERTY_HINT_KEY_ACCEL, ///< hint_text= "length" (as integer)
PROPERTY_HINT_FLAGS, ///< hint_text= "flag1,flag2,etc" (as bit flags)
PROPERTY_HINT_ALL_FLAGS,
@@ -448,6 +449,7 @@ protected:
DVector<String> _get_meta_list_bind() const;
Array _get_property_list_bind() const;
+ Array _get_method_list_bind() const;
public: //should be protected, but bug in clang++
static void initialize_type();
diff --git a/core/os/main_loop.cpp b/core/os/main_loop.cpp
index 83d3155b03..b4c02ddbce 100644
--- a/core/os/main_loop.cpp
+++ b/core/os/main_loop.cpp
@@ -31,7 +31,20 @@
void MainLoop::_bind_methods() {
- ObjectTypeDB::bind_method("input_event",&MainLoop::input_event);
+ ObjectTypeDB::bind_method(_MD("input_event","ev"),&MainLoop::input_event);
+ ObjectTypeDB::bind_method(_MD("input_text","text"),&MainLoop::input_text);
+ ObjectTypeDB::bind_method(_MD("init"),&MainLoop::init);
+ ObjectTypeDB::bind_method(_MD("iteration","delta"),&MainLoop::iteration);
+ ObjectTypeDB::bind_method(_MD("idle","delta"),&MainLoop::idle);
+ ObjectTypeDB::bind_method(_MD("finish"),&MainLoop::finish);
+
+ BIND_VMETHOD( MethodInfo("_input_event",PropertyInfo(Variant::INPUT_EVENT,"ev")) );
+ BIND_VMETHOD( MethodInfo("_input_text",PropertyInfo(Variant::STRING,"text")) );
+ BIND_VMETHOD( MethodInfo("_initialize") );
+ BIND_VMETHOD( MethodInfo("_iteration",PropertyInfo(Variant::REAL,"delta")) );
+ BIND_VMETHOD( MethodInfo("_idle",PropertyInfo(Variant::REAL,"delta")) );
+ BIND_VMETHOD( MethodInfo("_finalize") );
+
BIND_CONSTANT(NOTIFICATION_WM_FOCUS_IN);
BIND_CONSTANT(NOTIFICATION_WM_FOCUS_OUT);
@@ -58,13 +71,15 @@ MainLoop::~MainLoop()
void MainLoop::input_text( const String& p_text ) {
+ if (get_script_instance())
+ get_script_instance()->call("_input_text",p_text);
}
void MainLoop::input_event( const InputEvent& p_event ) {
if (get_script_instance())
- get_script_instance()->call("input_event",p_event);
+ get_script_instance()->call("_input_event",p_event);
}
@@ -74,13 +89,13 @@ void MainLoop::init() {
set_script(init_script.get_ref_ptr());
if (get_script_instance())
- get_script_instance()->call("init");
+ get_script_instance()->call("_initialize");
}
bool MainLoop::iteration(float p_time) {
if (get_script_instance())
- return get_script_instance()->call("iteration",p_time);
+ return get_script_instance()->call("_iteration",p_time);
return false;
@@ -88,14 +103,14 @@ bool MainLoop::iteration(float p_time) {
bool MainLoop::idle(float p_time) {
if (get_script_instance())
- return get_script_instance()->call("idle",p_time);
+ return get_script_instance()->call("_idle",p_time);
return false;
}
void MainLoop::finish() {
if (get_script_instance()) {
- get_script_instance()->call("finish");
+ get_script_instance()->call("_finalize");
set_script(RefPtr()); //clear script
}