summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/editor/animation_editor.cpp72
-rw-r--r--tools/editor/animation_editor.h2
-rw-r--r--tools/editor/icons/icon_reload_small.pngbin0 -> 447 bytes
-rw-r--r--tools/editor/plugins/animation_player_editor_plugin.cpp2
-rw-r--r--tools/editor/plugins/script_editor_plugin.cpp17
-rw-r--r--tools/editor/plugins/script_editor_plugin.h2
-rw-r--r--tools/editor/project_settings.cpp50
-rw-r--r--tools/editor/property_editor.cpp41
8 files changed, 143 insertions, 43 deletions
diff --git a/tools/editor/animation_editor.cpp b/tools/editor/animation_editor.cpp
index a247543830..dfb09e38fc 100644
--- a/tools/editor/animation_editor.cpp
+++ b/tools/editor/animation_editor.cpp
@@ -35,6 +35,7 @@
#include "scene/gui/separator.h"
#include "editor_node.h"
#include "tools/editor/plugins/animation_player_editor_plugin.h"
+#include "scene/main/viewport.h"
/* Missing to fix:
*Set
@@ -256,6 +257,28 @@ public:
//PopupDialog *ke_dialog;
+ void _fix_node_path(Variant &value) {
+
+
+ NodePath np=value;
+
+ if (np==NodePath())
+ return;
+
+ Node* root = EditorNode::get_singleton()->get_tree()->get_root();
+
+ Node* np_node = root->get_node(np);
+ ERR_FAIL_COND(!np_node);
+
+ Node* edited_node = root->get_node(base);
+ ERR_FAIL_COND(!edited_node);
+
+
+
+ value = edited_node->get_path_to(np_node);
+ }
+
+
void _update_obj(const Ref<Animation> &p_anim) {
if (setting)
return;
@@ -356,10 +379,18 @@ public:
case Animation::TYPE_VALUE: {
if (name=="value") {
+
+ Variant value = p_value;
+
+ if (value.get_type()==Variant::NODE_PATH) {
+
+ _fix_node_path(value);
+ }
+
setting=true;
undo_redo->create_action("Anim Change Value",true);
Variant prev = animation->track_get_key_value(track,key);
- undo_redo->add_do_method(animation.ptr(),"track_set_key_value",track,key,p_value);
+ undo_redo->add_do_method(animation.ptr(),"track_set_key_value",track,key,value);
undo_redo->add_undo_method(animation.ptr(),"track_set_key_value",track,key,prev);
undo_redo->add_do_method(this,"_update_obj",animation);
undo_redo->add_undo_method(this,"_update_obj",animation);
@@ -420,7 +451,14 @@ public:
}
if (what=="value") {
- args[idx]=p_value;
+
+ Variant value=p_value;
+ if (value.get_type()==Variant::NODE_PATH) {
+
+ _fix_node_path(value);
+ }
+
+ args[idx]=value;
d_new["args"]=args;
mergeable=true;
}
@@ -441,7 +479,7 @@ public:
} break;
}
- return false;
+
return false;
@@ -616,6 +654,7 @@ public:
float key_ofs;
PropertyInfo hint;
+ NodePath base;
void notify_change() {
@@ -1630,8 +1669,9 @@ void AnimationKeyEditor::_select_at_anim(const Ref<Animation>& p_anim,int p_trac
}
-PropertyInfo AnimationKeyEditor::_find_hint_for_track(int p_idx) {
+PropertyInfo AnimationKeyEditor::_find_hint_for_track(int p_idx,NodePath& r_base_path) {
+ r_base_path=NodePath();
ERR_FAIL_COND_V(!animation.is_valid(),PropertyInfo());
ERR_FAIL_INDEX_V(p_idx,animation->get_track_count(),PropertyInfo());
@@ -1640,9 +1680,6 @@ PropertyInfo AnimationKeyEditor::_find_hint_for_track(int p_idx) {
NodePath path = animation->track_get_path(p_idx);
- String property = path.get_property();
- if (property=="")
- return PropertyInfo();
if (!root->has_node_and_resource(path))
return PropertyInfo();
@@ -1650,6 +1687,15 @@ PropertyInfo AnimationKeyEditor::_find_hint_for_track(int p_idx) {
RES res;
Node *node = root->get_node_and_resource(path,res);
+
+ if (node) {
+ r_base_path=node->get_path();
+ }
+
+ String property = path.get_property();
+ if (property=="")
+ return PropertyInfo();
+
List<PropertyInfo> pinfo;
if (res.is_valid())
res->get_property_list(&pinfo);
@@ -1729,7 +1775,7 @@ bool AnimationKeyEditor::_edit_if_single_selection() {
key_edit->animation=animation;
key_edit->track=idx;
key_edit->key_ofs=animation->track_get_key_time(idx,key);
- key_edit->hint=_find_hint_for_track(idx);
+ key_edit->hint=_find_hint_for_track(idx,key_edit->base);
key_edit->notify_change();
curve_edit->set_transition(animation->track_get_key_transition(idx,key));
@@ -2187,7 +2233,8 @@ void AnimationKeyEditor::_track_editor_input_event(const InputEvent& p_input) {
newval=d;
} else if (tt==Animation::TYPE_VALUE) {
- PropertyInfo inf = _find_hint_for_track(idx);
+ NodePath np;
+ PropertyInfo inf = _find_hint_for_track(idx,np);
if (inf.type!=Variant::NIL) {
Variant::CallError err;
@@ -2975,6 +3022,7 @@ void AnimationKeyEditor::_clear_selection() {
key_edit->track=0;
key_edit->key_ofs=0;
key_edit->hint=PropertyInfo();
+ key_edit->base=NodePath();
key_edit->notify_change();
}
@@ -3269,9 +3317,10 @@ int AnimationKeyEditor::_confirm_insert(InsertData p_id,int p_last_track) {
{
//shitty hack
+ NodePath np;
animation->add_track(p_id.type);
animation->track_set_path(animation->get_track_count()-1,p_id.path);
- PropertyInfo h = _find_hint_for_track(animation->get_track_count()-1);
+ PropertyInfo h = _find_hint_for_track(animation->get_track_count()-1,np);
animation->remove_track(animation->get_track_count()-1); //hack
@@ -3645,6 +3694,9 @@ void AnimationKeyEditor::_add_call_track(const NodePath& p_base) {
NodePath path = root->get_path_to(from);
+ //print_line("root: "+String(root->get_path()));
+ //print_line("path: "+String(path));
+
undo_redo->create_action("Anim Add Call Track");
undo_redo->add_do_method(animation.ptr(),"add_track",Animation::TYPE_METHOD);
undo_redo->add_do_method(animation.ptr(),"track_set_path",animation->get_track_count(),path);
diff --git a/tools/editor/animation_editor.h b/tools/editor/animation_editor.h
index 5e81439fe6..cd22dc3106 100644
--- a/tools/editor/animation_editor.h
+++ b/tools/editor/animation_editor.h
@@ -302,7 +302,7 @@ class AnimationKeyEditor : public VBoxContainer {
void _select_at_anim(const Ref<Animation>& p_anim,int p_track,float p_pos);
void _curve_transition_changed(float p_what);
- PropertyInfo _find_hint_for_track(int p_idx);
+ PropertyInfo _find_hint_for_track(int p_idx, NodePath &r_base_path);
void _create_value_item(int p_type);
void _pane_drag(const Point2& p_delta);
diff --git a/tools/editor/icons/icon_reload_small.png b/tools/editor/icons/icon_reload_small.png
new file mode 100644
index 0000000000..957cdfcf4f
--- /dev/null
+++ b/tools/editor/icons/icon_reload_small.png
Binary files differ
diff --git a/tools/editor/plugins/animation_player_editor_plugin.cpp b/tools/editor/plugins/animation_player_editor_plugin.cpp
index 0e2977c5a1..32afd86970 100644
--- a/tools/editor/plugins/animation_player_editor_plugin.cpp
+++ b/tools/editor/plugins/animation_player_editor_plugin.cpp
@@ -1298,7 +1298,7 @@ AnimationPlayerEditor::AnimationPlayerEditor(EditorNode *p_editor) {
frame = memnew( SpinBox );
hb->add_child(frame);
- frame->set_custom_minimum_size(Size2(80,0));
+ frame->set_custom_minimum_size(Size2(60,0));
frame->set_stretch_ratio(2);
frame->set_tooltip("Animation position (in seconds).");
diff --git a/tools/editor/plugins/script_editor_plugin.cpp b/tools/editor/plugins/script_editor_plugin.cpp
index e6e90eb0db..5b1dd37a61 100644
--- a/tools/editor/plugins/script_editor_plugin.cpp
+++ b/tools/editor/plugins/script_editor_plugin.cpp
@@ -935,6 +935,9 @@ void ScriptEditor::_menu_option(int p_option) {
if (!_test_script_times_on_disk())
return;
+ save_all_scripts();
+
+#if 0
for(int i=0;i<tab_container->get_child_count();i++) {
ScriptTextEditor *ste = tab_container->get_child(i)->cast_to<ScriptTextEditor>();
@@ -951,7 +954,7 @@ void ScriptEditor::_menu_option(int p_option) {
editor->save_resource( script );
}
-
+#endif
} break;
case SEARCH_HELP: {
@@ -1938,9 +1941,7 @@ void ScriptEditor::edit(const Ref<Script>& p_script) {
}
}
-void ScriptEditor::save_external_data() {
-
- apply_scripts();
+void ScriptEditor::save_all_scripts() {
for(int i=0;i<tab_container->get_child_count();i++) {
@@ -1949,9 +1950,13 @@ void ScriptEditor::save_external_data() {
if (!ste)
continue;
+ if (ste->get_text_edit()->get_version()==ste->get_text_edit()->get_saved_version())
+ continue;
+
Ref<Script> script = ste->get_edited_script();
if (script->get_path()!="" && script->get_path().find("local://")==-1 &&script->get_path().find("::")==-1) {
//external script, save it
+ ste->apply_code();
editor->save_resource(script);
//ResourceSaver::save(script->get_path(),script);
}
@@ -2063,7 +2068,7 @@ void ScriptEditor::_editor_settings_changed() {
void ScriptEditor::_autosave_scripts() {
print_line("autosaving");
- save_external_data();
+ save_all_scripts();
}
void ScriptEditor::_tree_changed() {
@@ -2628,7 +2633,7 @@ void ScriptEditorPlugin::clear() {
void ScriptEditorPlugin::save_external_data() {
- script_editor->save_external_data();
+ script_editor->save_all_scripts();
}
void ScriptEditorPlugin::apply_changes() {
diff --git a/tools/editor/plugins/script_editor_plugin.h b/tools/editor/plugins/script_editor_plugin.h
index c52da41a43..5664b26580 100644
--- a/tools/editor/plugins/script_editor_plugin.h
+++ b/tools/editor/plugins/script_editor_plugin.h
@@ -295,7 +295,7 @@ public:
void swap_lines(TextEdit *tx, int line1, int line2);
- void save_external_data();
+ void save_all_scripts();
void set_window_layout(Ref<ConfigFile> p_layout);
void get_window_layout(Ref<ConfigFile> p_layout);
diff --git a/tools/editor/project_settings.cpp b/tools/editor/project_settings.cpp
index f889cc7748..873e397010 100644
--- a/tools/editor/project_settings.cpp
+++ b/tools/editor/project_settings.cpp
@@ -38,18 +38,18 @@
ProjectSettings *ProjectSettings::singleton=NULL;
static const char* _button_names[JOY_BUTTON_MAX]={
-"PS X, XBox A, NDS B",
-"PS Circle, XBox B, NDS A",
-"PS Square, XBox X, NDS Y",
-"PS Triangle, XBox Y, NDS X",
-"L, L1, Wii C",
+"PS X, XBox A, Nintendo B",
+"PS Circle, XBox B, Nintendo A",
+"PS Square, XBox X, Nintendo Y",
+"PS Triangle, XBox Y, Nintendo X",
+"L, L1",
"R, R1",
-"L2, Wii Z",
+"L2",
"R2",
"L3",
"R3",
-"Select, Wii -",
-"Start, Wii +",
+"Select, Nintendo -",
+"Start, Nintendo +",
"D-Pad Up",
"D-Pad Down",
"D-Pad Left",
@@ -299,10 +299,22 @@ void ProjectSettings::_add_item(int p_item){
device_id->set_val(0);
device_index_label->set_text("Joy Button Axis:");
device_index->clear();
- for(int i=0;i<24;i++) {
+ for(int i=0;i<JOY_AXIS_MAX*2;i++) {
+ String desc;
- device_index->add_item("Axis "+itos(i/2)+" "+(i&1?"+":"-"));
+ int ax=i/2;
+ if (ax==0 || ax==1)
+ desc=" (Left Stick)";
+ else if (ax==2 || ax==3)
+ desc=" (Right Stick)";
+ else if (ax==6)
+ desc=" (L2)";
+ else if (ax==7)
+ desc=" (R2)";
+
+
+ device_index->add_item("Axis "+itos(i/2)+" "+(i&1?"+":"-")+desc);
}
device_input->popup_centered(Size2(350,95));
@@ -315,7 +327,7 @@ void ProjectSettings::_add_item(int p_item){
for(int i=0;i<JOY_BUTTON_MAX;i++) {
- device_index->add_item(String(_button_names[i]));
+ device_index->add_item(itos(i)+": "+String(_button_names[i]));
}
device_input->popup_centered(Size2(350,95));
@@ -499,7 +511,18 @@ void ProjectSettings::_update_actions() {
} break;
case InputEvent::JOYSTICK_MOTION: {
- String str = "Device "+itos(ie.device)+", Axis "+itos(ie.joy_motion.axis)+" "+(ie.joy_motion.axis_value<0?"-.":"+.");
+ String desc;
+ int ax = ie.joy_motion.axis;
+
+ if (ax==0 || ax==1)
+ desc=" (Left Stick).";
+ else if (ax==2 || ax==3)
+ desc=" (Right Stick).";
+ else if (ax==6)
+ desc=" (L2).";
+ else if (ax==7)
+ desc=" (R2).";
+ String str = "Device "+itos(ie.device)+", Axis "+itos(ie.joy_motion.axis)+" "+(ie.joy_motion.axis_value<0?"-":"+")+desc;
action->set_text(0,str);
action->set_icon(0,get_icon("JoyAxis","EditorIcons"));
} break;
@@ -823,6 +846,7 @@ void ProjectSettings::_autoload_edited() {
String base="autoload/"+ti->get_text(0);
String path = Globals::get_singleton()->get(base);
+ int order = Globals::get_singleton()->get_order(base);
if (path.begins_with("*"))
path=path.substr(1,path.length());
@@ -833,6 +857,8 @@ void ProjectSettings::_autoload_edited() {
undo_redo->create_action("Toggle Autoload GlobalVar");
undo_redo->add_do_property(Globals::get_singleton(),base,path);
undo_redo->add_undo_property(Globals::get_singleton(),base,Globals::get_singleton()->get(base));
+ undo_redo->add_do_method(Globals::get_singleton(),"set_order",base,order); // keep order, as config order matters for these
+ undo_redo->add_undo_method(Globals::get_singleton(),"set_order",base,order);
undo_redo->add_do_method(this,"_update_autoload");
undo_redo->add_undo_method(this,"_update_autoload");
undo_redo->add_do_method(this,"_settings_changed");
diff --git a/tools/editor/property_editor.cpp b/tools/editor/property_editor.cpp
index 3dfc461bfe..efc821b874 100644
--- a/tools/editor/property_editor.cpp
+++ b/tools/editor/property_editor.cpp
@@ -714,7 +714,7 @@ bool CustomPropertyEditor::edit(Object* p_owner,const String& p_name,Variant::Ty
RES r = v;
if (r.is_valid() && r->get_path().is_resource_file() && r->get_import_metadata().is_valid()) {
menu->add_separator();
- menu->add_icon_item(get_icon("Reload","EditorIcons"),"Re-Import",OBJ_MENU_REIMPORT);
+ menu->add_icon_item(get_icon("ReloadSmall","EditorIcons"),"Re-Import",OBJ_MENU_REIMPORT);
}
/*if (r.is_valid() && r->get_path().is_resource_file()) {
menu->set_item_tooltip(1,r->get_path());
@@ -2127,11 +2127,13 @@ void PropertyEditor::_check_reload_status(const String&p_name, TreeItem* item) {
bool has_reload=false;
int found=-1;
+ bool is_disabled=false;
for(int i=0;i<item->get_button_count(1);i++) {
if (item->get_button_id(1,i)==3) {
found=i;
+ is_disabled=item->is_button_disabled(1,i);
break;
}
}
@@ -2149,7 +2151,7 @@ void PropertyEditor::_check_reload_status(const String&p_name, TreeItem* item) {
bool changed = _is_property_different(v,vorig,usage);
- if ((found!=-1)!=changed) {
+ //if ((found!=-1 && !is_disabled)!=changed) {
if (changed) {
@@ -2158,11 +2160,9 @@ void PropertyEditor::_check_reload_status(const String&p_name, TreeItem* item) {
}
- }
-
- }
-
+ //}
+ }
}
@@ -2176,10 +2176,20 @@ void PropertyEditor::_check_reload_status(const String&p_name, TreeItem* item) {
}
}
+ //print_line("found: "+itos(found)+" has reload: "+itos(has_reload)+" is_disabled "+itos(is_disabled));
if (found!=-1 && !has_reload) {
- item->erase_button(1,found);
+
+ if (!is_disabled) {
+ item->erase_button(1,found);
+ if (item->get_cell_mode(1)==TreeItem::CELL_MODE_RANGE && item->get_text(1)==String()) {
+ item->add_button(1,get_icon("ReloadEmpty","EditorIcons"),3,true);
+ }
+ }
} else if (found==-1 && has_reload) {
- item->add_button(1,get_icon("Reload","EditorIcons"),3);
+ item->add_button(1,get_icon("ReloadSmall","EditorIcons"),3);
+ } else if (found!=-1 && has_reload && is_disabled) {
+ item->erase_button(1,found);
+ item->add_button(1,get_icon("ReloadSmall","EditorIcons"),3);
}
}
@@ -2348,7 +2358,7 @@ void PropertyEditor::_refresh_item(TreeItem *p_item) {
if (!has_reload && found!=-1) {
p_item->erase_button(1,found);
} else if (has_reload && found==-1) {
- p_item->add_button(1,get_icon("Reload","EditorIcons"),3);
+ p_item->add_button(1,get_icon("ReloadSmall","EditorIcons"),3);
}
#endif
Dictionary d=p_item->get_metadata(0);
@@ -3092,7 +3102,9 @@ void PropertyEditor::update_tree() {
}
bool has_reload=false;
- if (_might_be_in_instance()) {
+
+ bool mbi = _might_be_in_instance();
+ if (mbi) {
Variant vorig;
Dictionary d=item->get_metadata(0);
@@ -3103,7 +3115,7 @@ void PropertyEditor::update_tree() {
if (_is_property_different(v,vorig,usage)) {
//print_line("FOR "+String(p.name)+" RELOAD WITH: "+String(v)+"("+Variant::get_type_name(v.get_type())+")=="+String(vorig)+"("+Variant::get_type_name(vorig.get_type())+")");
- item->add_button(1,get_icon("Reload","EditorIcons"),3);
+ item->add_button(1,get_icon("ReloadSmall","EditorIcons"),3);
has_reload=true;
}
}
@@ -3115,11 +3127,16 @@ void PropertyEditor::update_tree() {
Variant orig_value;
if (scr->get_property_default_value(p.name,orig_value)) {
if (orig_value!=obj->get(p.name)) {
- item->add_button(1,get_icon("Reload","EditorIcons"),3);
+ item->add_button(1,get_icon("ReloadSmall","EditorIcons"),3);
+ has_reload=true;
}
}
}
+ if (mbi && !has_reload && item->get_cell_mode(1)==TreeItem::CELL_MODE_RANGE && item->get_text(1)==String()) {
+ item->add_button(1,get_icon("ReloadEmpty","EditorIcons"),3,true);
+ }
+
}