summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2018-09-23 15:27:20 +0200
committerGitHub <noreply@github.com>2018-09-23 15:27:20 +0200
commit2c7908739a9508cdd725fdd3175477f4d048ea26 (patch)
treefaf33ee70bf2b7ab9d8bce33b3fd5993480330cf
parent3b510224293dd012278dcf6416835198fa9b67a2 (diff)
parentf483460e389727cd29fdd53e212037934a0bd767 (diff)
Merge pull request #22351 from DualMatrix/remove_obsolete
Removed obsoleted core/helper/value_evaluator.h and moved math_fieldwise to core/math/
-rw-r--r--core/helper/SCsub7
-rw-r--r--core/helper/value_evaluator.h46
-rw-r--r--core/math/math_fieldwise.cpp (renamed from core/helper/math_fieldwise.cpp)0
-rw-r--r--core/math/math_fieldwise.h (renamed from core/helper/math_fieldwise.h)0
-rw-r--r--editor/multi_node_edit.cpp2
-rw-r--r--editor/property_editor.cpp57
-rw-r--r--editor/property_editor.h21
-rw-r--r--scene/gui/tree.cpp40
-rw-r--r--scene/gui/tree.h5
9 files changed, 8 insertions, 170 deletions
diff --git a/core/helper/SCsub b/core/helper/SCsub
deleted file mode 100644
index 4efc902717..0000000000
--- a/core/helper/SCsub
+++ /dev/null
@@ -1,7 +0,0 @@
-#!/usr/bin/env python
-
-Import('env')
-
-env.add_source_files(env.core_sources, "*.cpp")
-
-Export('env')
diff --git a/core/helper/value_evaluator.h b/core/helper/value_evaluator.h
deleted file mode 100644
index 39177a7820..0000000000
--- a/core/helper/value_evaluator.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/*************************************************************************/
-/* value_evaluator.h */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* https://godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
-/* */
-/* Permission is hereby granted, free of charge, to any person obtaining */
-/* a copy of this software and associated documentation files (the */
-/* "Software"), to deal in the Software without restriction, including */
-/* without limitation the rights to use, copy, modify, merge, publish, */
-/* distribute, sublicense, and/or sell copies of the Software, and to */
-/* permit persons to whom the Software is furnished to do so, subject to */
-/* the following conditions: */
-/* */
-/* The above copyright notice and this permission notice shall be */
-/* included in all copies or substantial portions of the Software. */
-/* */
-/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
-/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
-/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
-/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
-/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
-/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
-/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
-/*************************************************************************/
-
-#ifndef VALUE_EVALUATOR_H
-#define VALUE_EVALUATOR_H
-
-#include "core/object.h"
-
-class ValueEvaluator : public Object {
-
- GDCLASS(ValueEvaluator, Object);
-
-public:
- virtual double eval(const String &p_text) {
- return p_text.to_double();
- }
-};
-
-#endif // VALUE_EVALUATOR_H
diff --git a/core/helper/math_fieldwise.cpp b/core/math/math_fieldwise.cpp
index 20b2341ab0..20b2341ab0 100644
--- a/core/helper/math_fieldwise.cpp
+++ b/core/math/math_fieldwise.cpp
diff --git a/core/helper/math_fieldwise.h b/core/math/math_fieldwise.h
index 0e7cc3ea4a..0e7cc3ea4a 100644
--- a/core/helper/math_fieldwise.h
+++ b/core/math/math_fieldwise.h
diff --git a/editor/multi_node_edit.cpp b/editor/multi_node_edit.cpp
index 173be01586..be4e752d55 100644
--- a/editor/multi_node_edit.cpp
+++ b/editor/multi_node_edit.cpp
@@ -30,7 +30,7 @@
#include "multi_node_edit.h"
-#include "core/helper/math_fieldwise.h"
+#include "core/math/math_fieldwise.h"
#include "editor_node.h"
bool MultiNodeEdit::_set(const StringName &p_name, const Variant &p_value) {
diff --git a/editor/property_editor.cpp b/editor/property_editor.cpp
index 508db2e03f..c611327a31 100644
--- a/editor/property_editor.cpp
+++ b/editor/property_editor.cpp
@@ -1991,60 +1991,3 @@ CustomPropertyEditor::CustomPropertyEditor() {
create_dialog = NULL;
property_select = NULL;
}
-
-/////////////////////////////
-
-double PropertyValueEvaluator::eval(const String &p_text) {
-
- // If range value contains a comma replace it with dot (issue #6028)
- const String &p_new_text = p_text.replace(",", ".");
-
- if (!obj || !script_language)
- return _default_eval(p_new_text);
-
- Ref<Script> script = Ref<Script>(script_language->create_script());
- script->set_source_code(_build_script(p_new_text));
- Error err = script->reload();
- if (err) {
- ERR_PRINTS("PropertyValueEvaluator: Error loading script for expression: " + p_new_text);
- return _default_eval(p_new_text);
- }
-
- Object dummy;
- ScriptInstance *script_instance = script->instance_create(&dummy);
- if (!script_instance)
- return _default_eval(p_new_text);
-
- Variant::CallError call_err;
- Variant arg = obj;
- const Variant *args[] = { &arg };
- double result = script_instance->call("eval", args, 1, call_err);
- if (call_err.error == Variant::CallError::CALL_OK) {
- return result;
- }
- ERR_PRINTS("PropertyValueEvaluator: Eval failed, error code: " + itos(call_err.error));
-
- return _default_eval(p_new_text);
-}
-
-void PropertyValueEvaluator::edit(Object *p_obj) {
- obj = p_obj;
-}
-
-String PropertyValueEvaluator::_build_script(const String &p_text) {
- String script_text = "tool\nextends Object\nfunc eval(s):\n\tself = s\n\treturn " + p_text.strip_edges() + "\n";
- return script_text;
-}
-
-PropertyValueEvaluator::PropertyValueEvaluator() {
- script_language = NULL;
-
- for (int i = 0; i < ScriptServer::get_language_count(); i++) {
- if (ScriptServer::get_language(i)->get_name() == "GDScript") {
- script_language = ScriptServer::get_language(i);
- }
- }
-}
-
-PropertyValueEvaluator::~PropertyValueEvaluator() {
-}
diff --git a/editor/property_editor.h b/editor/property_editor.h
index ee3a56d857..c74103df3d 100644
--- a/editor/property_editor.h
+++ b/editor/property_editor.h
@@ -171,30 +171,9 @@ public:
void set_read_only(bool p_read_only) { read_only = p_read_only; }
- void set_value_evaluator(PropertyValueEvaluator *p_evaluator) { evaluator = p_evaluator; }
-
bool edit(Object *p_owner, const String &p_name, Variant::Type p_type, const Variant &p_variant, int p_hint, String p_hint_text);
CustomPropertyEditor();
};
-class PropertyValueEvaluator : public ValueEvaluator {
- GDCLASS(PropertyValueEvaluator, ValueEvaluator);
-
- Object *obj;
- ScriptLanguage *script_language;
- String _build_script(const String &p_text);
-
- _FORCE_INLINE_ double _default_eval(const String &p_text) {
- return p_text.to_double();
- }
-
-public:
- void edit(Object *p_obj);
- double eval(const String &p_text);
-
- PropertyValueEvaluator();
- ~PropertyValueEvaluator();
-};
-
#endif
diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp
index 24b9083964..23e4c26695 100644
--- a/scene/gui/tree.cpp
+++ b/scene/gui/tree.cpp
@@ -159,7 +159,7 @@ void TreeItem::set_text(int p_column, String p_text) {
ERR_FAIL_INDEX(p_column, cells.size());
cells.write[p_column].text = p_text;
- if (cells[p_column].mode == TreeItem::CELL_MODE_RANGE || cells[p_column].mode == TreeItem::CELL_MODE_RANGE_EXPRESSION) {
+ if (cells[p_column].mode == TreeItem::CELL_MODE_RANGE) {
Vector<String> strings = p_text.split(",");
cells.write[p_column].min = INT_MAX;
@@ -791,7 +791,6 @@ void TreeItem::_bind_methods() {
BIND_ENUM_CONSTANT(CELL_MODE_STRING);
BIND_ENUM_CONSTANT(CELL_MODE_CHECK);
BIND_ENUM_CONSTANT(CELL_MODE_RANGE);
- BIND_ENUM_CONSTANT(CELL_MODE_RANGE_EXPRESSION);
BIND_ENUM_CONSTANT(CELL_MODE_ICON);
BIND_ENUM_CONSTANT(CELL_MODE_CUSTOM);
@@ -1245,9 +1244,7 @@ int Tree::draw_item(const Point2i &p_pos, const Point2 &p_draw_ofs, const Size2
//font->draw( ci, text_pos, p_item->cells[i].text, col,item_rect.size.x-check_w );
} break;
- case TreeItem::CELL_MODE_RANGE:
- case TreeItem::CELL_MODE_RANGE_EXPRESSION: {
-
+ case TreeItem::CELL_MODE_RANGE: {
if (p_item->cells[i].text != "") {
if (!p_item->cells[i].editable)
@@ -1821,9 +1818,7 @@ int Tree::propagate_mouse_event(const Point2i &p_pos, int x_ofs, int y_ofs, bool
//p_item->edited_signal.call(col);
} break;
- case TreeItem::CELL_MODE_RANGE:
- case TreeItem::CELL_MODE_RANGE_EXPRESSION: {
-
+ case TreeItem::CELL_MODE_RANGE: {
if (c.text != "") {
//if (x >= (get_column_width(col)-item_h/2)) {
@@ -2010,21 +2005,6 @@ void Tree::text_editor_enter(String p_text) {
//popup_edited_item->edited_signal.call( popup_edited_item_col );
} break;
- case TreeItem::CELL_MODE_RANGE_EXPRESSION: {
-
- if (evaluator)
- c.val = evaluator->eval(p_text);
- else
- c.val = p_text.to_double();
-
- if (c.step > 0)
- c.val = Math::stepify(c.val, c.step);
- if (c.val < c.min)
- c.val = c.min;
- else if (c.val > c.max)
- c.val = c.max;
-
- } break;
default: { ERR_FAIL(); }
}
@@ -2453,7 +2433,7 @@ void Tree::_gui_input(Ref<InputEvent> p_event) {
update();
}
- if (pressing_for_editor && popup_edited_item && (popup_edited_item->get_cell_mode(popup_edited_item_col) == TreeItem::CELL_MODE_RANGE || popup_edited_item->get_cell_mode(popup_edited_item_col) == TreeItem::CELL_MODE_RANGE_EXPRESSION)) {
+ if (pressing_for_editor && popup_edited_item && (popup_edited_item->get_cell_mode(popup_edited_item_col) == TreeItem::CELL_MODE_RANGE)) {
//range drag
if (!range_drag_enabled) {
@@ -2697,7 +2677,7 @@ bool Tree::edit_selected() {
item_edited(col, s);
return true;
- } else if ((c.mode == TreeItem::CELL_MODE_RANGE || c.mode == TreeItem::CELL_MODE_RANGE_EXPRESSION) && c.text != "") {
+ } else if (c.mode == TreeItem::CELL_MODE_RANGE && c.text != "") {
popup_menu->clear();
for (int i = 0; i < c.text.get_slice_count(","); i++) {
@@ -2713,7 +2693,7 @@ bool Tree::edit_selected() {
popup_edited_item_col = col;
return true;
- } else if (c.mode == TreeItem::CELL_MODE_STRING || c.mode == TreeItem::CELL_MODE_RANGE || c.mode == TreeItem::CELL_MODE_RANGE_EXPRESSION) {
+ } else if (c.mode == TreeItem::CELL_MODE_STRING || c.mode == TreeItem::CELL_MODE_RANGE) {
Vector2 ofs(0, (text_editor->get_size().height - rect.size.height) / 2);
Point2i textedpos = get_global_position() + rect.position - ofs;
@@ -2723,7 +2703,7 @@ bool Tree::edit_selected() {
text_editor->set_text(c.mode == TreeItem::CELL_MODE_STRING ? c.text : String::num(c.val, Math::step_decimals(c.step)));
text_editor->select_all();
- if (c.mode == TreeItem::CELL_MODE_RANGE || c.mode == TreeItem::CELL_MODE_RANGE_EXPRESSION) {
+ if (c.mode == TreeItem::CELL_MODE_RANGE) {
value_editor->set_position(textedpos + Point2i(0, text_editor->get_size().height));
value_editor->set_size(Size2(rect.size.width, 1));
@@ -3713,10 +3693,6 @@ bool Tree::is_folding_hidden() const {
return hide_folding;
}
-void Tree::set_value_evaluator(ValueEvaluator *p_evaluator) {
- evaluator = p_evaluator;
-}
-
void Tree::set_drop_mode_flags(int p_flags) {
if (drop_mode_flags == p_flags)
return;
@@ -3934,8 +3910,6 @@ Tree::Tree() {
hide_folding = false;
- evaluator = NULL;
-
drop_mode_flags = 0;
drop_mode_over = NULL;
drop_mode_section = 0;
diff --git a/scene/gui/tree.h b/scene/gui/tree.h
index 205cdbfb7e..551600109e 100644
--- a/scene/gui/tree.h
+++ b/scene/gui/tree.h
@@ -31,7 +31,6 @@
#ifndef TREE_H
#define TREE_H
-#include "core/helper/value_evaluator.h"
#include "scene/gui/control.h"
#include "scene/gui/line_edit.h"
#include "scene/gui/popup_menu.h"
@@ -504,8 +503,6 @@ private:
bool hide_folding;
- ValueEvaluator *evaluator;
-
int _count_selected_items(TreeItem *p_from) const;
void _go_left();
void _go_right();
@@ -601,8 +598,6 @@ public:
void set_allow_reselect(bool p_allow);
bool get_allow_reselect() const;
- void set_value_evaluator(ValueEvaluator *p_evaluator);
-
Tree();
~Tree();
};