summaryrefslogtreecommitdiff
path: root/tools/editor/property_selector.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tools/editor/property_selector.cpp')
-rw-r--r--tools/editor/property_selector.cpp64
1 files changed, 46 insertions, 18 deletions
diff --git a/tools/editor/property_selector.cpp b/tools/editor/property_selector.cpp
index 20b72240d9..3eeec1634d 100644
--- a/tools/editor/property_selector.cpp
+++ b/tools/editor/property_selector.cpp
@@ -1,6 +1,34 @@
+/*************************************************************************/
+/* property_selector.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 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 "property_selector.h"
-#include "editor_scale.h"
+#include "editor_scale.h"
#include "os/keyboard.h"
void PropertySelector::_text_changed(const String& p_newtext) {
@@ -18,7 +46,7 @@ void PropertySelector::_sbox_input(const InputEvent& p_ie) {
case KEY_PAGEUP:
case KEY_PAGEDOWN: {
- search_options->call("_input_event", p_ie);
+ search_options->call("_gui_input", p_ie);
search_box->accept_event();
TreeItem *root = search_options->get_root();
@@ -87,8 +115,8 @@ void PropertySelector::_update_search() {
StringName base=base_type;
while(base) {
props.push_back(PropertyInfo(Variant::NIL,base,PROPERTY_HINT_NONE,"",PROPERTY_USAGE_CATEGORY));
- ObjectTypeDB::get_property_list(base,&props,true);
- base=ObjectTypeDB::type_inherits_from(base);
+ ClassDB::get_property_list(base,&props,true);
+ base=ClassDB::get_parent_class(base);
}
}
@@ -194,8 +222,8 @@ void PropertySelector::_update_search() {
StringName base=base_type;
while(base) {
methods.push_back(MethodInfo("*"+String(base)));
- ObjectTypeDB::get_method_list(base,&methods,true);
- base=ObjectTypeDB::type_inherits_from(base);
+ ClassDB::get_method_list(base,&methods,true);
+ base=ClassDB::get_parent_class(base);
}
}
@@ -321,8 +349,8 @@ void PropertySelector::_item_selected() {
case InputEvent::KEY: class_type="InputEventKey"; break;
case InputEvent::MOUSE_MOTION: class_type="InputEventMouseMotion"; break;
case InputEvent::MOUSE_BUTTON: class_type="InputEventMouseButton"; break;
- case InputEvent::JOYSTICK_MOTION: class_type="InputEventJoystickMotion"; break;
- case InputEvent::JOYSTICK_BUTTON: class_type="InputEventJoystickButton"; break;
+ case InputEvent::JOYPAD_MOTION: class_type="InputEventJoypadMotion"; break;
+ case InputEvent::JOYPAD_BUTTON: class_type="InputEventJoypadButton"; break;
case InputEvent::SCREEN_TOUCH: class_type="InputEventScreenTouch"; break;
case InputEvent::SCREEN_DRAG: class_type="InputEventScreenDrag"; break;
case InputEvent::ACTION: class_type="InputEventAction"; break;
@@ -358,14 +386,14 @@ void PropertySelector::_item_selected() {
}
}
- at_class=ObjectTypeDB::type_inherits_from(at_class);
+ at_class=ClassDB::get_parent_class(at_class);
}
if (text==String()) {
StringName setter;
StringName type;
- if (ObjectTypeDB::get_setter_and_type_for_property(class_type,name,type,setter)) {
+ if (ClassDB::get_setter_and_type_for_property(class_type,name,type,setter)) {
Map<String,DocData::ClassDoc>::Element *E=dd->class_list.find(type);
if (E) {
for(int i=0;i<E->get().methods.size();i++) {
@@ -395,7 +423,7 @@ void PropertySelector::_item_selected() {
}
}
- at_class=ObjectTypeDB::type_inherits_from(at_class);
+ at_class=ClassDB::get_parent_class(at_class);
}
}
@@ -470,7 +498,7 @@ void PropertySelector::select_method_from_basic_type(Variant::Type p_type, const
void PropertySelector::select_method_from_instance(Object* p_instance, const String &p_current){
- base_type=p_instance->get_type();
+ base_type=p_instance->get_class();
selected=p_current;
type=Variant::NIL;
script=0;
@@ -559,10 +587,10 @@ void PropertySelector::select_property_from_instance(Object* p_instance, const S
void PropertySelector::_bind_methods() {
- ObjectTypeDB::bind_method(_MD("_text_changed"),&PropertySelector::_text_changed);
- ObjectTypeDB::bind_method(_MD("_confirmed"),&PropertySelector::_confirmed);
- ObjectTypeDB::bind_method(_MD("_sbox_input"),&PropertySelector::_sbox_input);
- ObjectTypeDB::bind_method(_MD("_item_selected"),&PropertySelector::_item_selected);
+ ClassDB::bind_method(_MD("_text_changed"),&PropertySelector::_text_changed);
+ ClassDB::bind_method(_MD("_confirmed"),&PropertySelector::_confirmed);
+ ClassDB::bind_method(_MD("_sbox_input"),&PropertySelector::_sbox_input);
+ ClassDB::bind_method(_MD("_item_selected"),&PropertySelector::_item_selected);
ADD_SIGNAL(MethodInfo("selected",PropertyInfo(Variant::STRING,"name")));
@@ -574,11 +602,11 @@ PropertySelector::PropertySelector() {
VBoxContainer *vbc = memnew( VBoxContainer );
add_child(vbc);
- set_child_rect(vbc);
+ //set_child_rect(vbc);
search_box = memnew( LineEdit );
vbc->add_margin_child(TTR("Search:"),search_box);
search_box->connect("text_changed",this,"_text_changed");
- search_box->connect("input_event",this,"_sbox_input");
+ search_box->connect("gui_input",this,"_sbox_input");
search_options = memnew( Tree );
vbc->add_margin_child(TTR("Matches:"),search_options,true);
get_ok()->set_text(TTR("Open"));