summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorAnton Yabchinskiy <arn@bestmx.ru>2014-12-09 17:51:14 +0300
committerAnton Yabchinskiy <arn@bestmx.ru>2014-12-09 17:51:14 +0300
commitff755f93eb86e3f7f6801918457ca77a3001671b (patch)
tree58d6def002b427db665a504f08d25eae335bd9d9 /tools
parentd45be7d9f43046365fcfbf97420f9eca636c51e7 (diff)
parentbe4e40e90a5a322f6a7cec4893854ef5b15db600 (diff)
Merge branch 'master' of http://github.com/okamstudio/godot
Diffstat (limited to 'tools')
-rw-r--r--tools/editor/animation_editor.cpp35
-rw-r--r--tools/editor/editor_node.cpp2
-rw-r--r--tools/editor/editor_settings.cpp1
-rw-r--r--tools/editor/plugins/polygon_2d_editor_plugin.cpp9
-rw-r--r--tools/editor/plugins/script_editor_plugin.cpp126
-rw-r--r--tools/editor/plugins/script_editor_plugin.h2
-rw-r--r--tools/editor/plugins/shader_editor_plugin.cpp5
-rw-r--r--tools/export/blender25/io_scene_dae/export_dae.py35
8 files changed, 163 insertions, 52 deletions
diff --git a/tools/editor/animation_editor.cpp b/tools/editor/animation_editor.cpp
index 0d4f5a7b74..95f9ee6509 100644
--- a/tools/editor/animation_editor.cpp
+++ b/tools/editor/animation_editor.cpp
@@ -2513,6 +2513,7 @@ void AnimationKeyEditor::_query_insert(const InsertData& p_id) {
if (insert_frame!=OS::get_singleton()->get_frames_drawn()) {
+ //clear insert list for the frame if frame changed
if (insert_confirm->is_visible())
return; //do nothing
insert_data.clear();
@@ -2520,19 +2521,29 @@ void AnimationKeyEditor::_query_insert(const InsertData& p_id) {
}
insert_frame=OS::get_singleton()->get_frames_drawn();
+ for (List<InsertData>::Element *E=insert_data.front();E;E=E->next()) {
+ //prevent insertion of multiple tracks
+ if (E->get().path==p_id.path)
+ return; //already inserted a track for this on this frame
+ }
+
insert_data.push_back(p_id);
if (p_id.track_idx==-1) {
- //potential new key, does not exist
- if (insert_data.size()==1)
- insert_confirm->set_text("Create NEW track for "+p_id.query+" and insert key?");
- else
- insert_confirm->set_text("Create "+itos(insert_data.size())+" NEW tracks and insert keys?");
-
- insert_confirm->get_ok()->set_text("Create");
- insert_confirm->popup_centered(Size2(300,100));
- insert_query=true;
-
+ if (bool(EDITOR_DEF("animation/confirm_insert_track",true))) {
+ //potential new key, does not exist
+ if (insert_data.size()==1)
+ insert_confirm->set_text("Create NEW track for "+p_id.query+" and insert key?");
+ else
+ insert_confirm->set_text("Create "+itos(insert_data.size())+" NEW tracks and insert keys?");
+
+ insert_confirm->get_ok()->set_text("Create");
+ insert_confirm->popup_centered(Size2(300,100));
+ insert_query=true;
+ } else {
+ call_deferred("_insert_delay");
+ insert_queue=true;
+ }
} else {
if (!insert_query && !insert_queue) {
@@ -3143,7 +3154,7 @@ AnimationKeyEditor::AnimationKeyEditor(UndoRedo *p_undo_redo, EditorHistory *p_h
//add_child(menu);
menu_track = memnew( MenuButton );
- menu_track->set_text("Tracks..");
+ menu_track->set_text("Tracks");
hb->add_child(menu_track);
menu_track->get_popup()->connect("item_pressed",this,"_menu_track");
@@ -3341,8 +3352,6 @@ AnimationKeyEditor::AnimationKeyEditor(UndoRedo *p_undo_redo, EditorHistory *p_h
add_child(insert_confirm);
insert_confirm->connect("confirmed",this,"_confirm_insert_list");
- EDITOR_DEF("animation_editor/confirm_insert_key",true);
-
click.click=ClickOver::CLICK_NONE;
diff --git a/tools/editor/editor_node.cpp b/tools/editor/editor_node.cpp
index 5e9cdf78a2..2927e7c870 100644
--- a/tools/editor/editor_node.cpp
+++ b/tools/editor/editor_node.cpp
@@ -2819,6 +2819,8 @@ void EditorNode::animation_editor_make_visible(bool p_visible) {
//pd_anim->hide();
animation_editor->hide();
// scene_root_parent->set_margin(MARGIN_TOP,0);
+ if (!animation_vb->get_parent_control())
+ return;
animation_vb->get_parent_control()->minimum_size_changed();
top_split->set_collapsed(true);
}
diff --git a/tools/editor/editor_settings.cpp b/tools/editor/editor_settings.cpp
index 8852293fe4..8b4d899437 100644
--- a/tools/editor/editor_settings.cpp
+++ b/tools/editor/editor_settings.cpp
@@ -440,6 +440,7 @@ void EditorSettings::_load_defaults() {
set("animation/autorename_animation_tracks",true);
+ set("animation/confirm_insert_track",true);
set("property_editor/texture_preview_width",48);
set("help/doc_path","");
diff --git a/tools/editor/plugins/polygon_2d_editor_plugin.cpp b/tools/editor/plugins/polygon_2d_editor_plugin.cpp
index 7dd8dd3035..27e539d50b 100644
--- a/tools/editor/plugins/polygon_2d_editor_plugin.cpp
+++ b/tools/editor/plugins/polygon_2d_editor_plugin.cpp
@@ -187,6 +187,8 @@ void Polygon2DEditor::_wip_close() {
bool Polygon2DEditor::forward_input_event(const InputEvent& p_event) {
+ if (node==NULL)
+ return false;
switch(p_event.type) {
@@ -701,11 +703,16 @@ void Polygon2DEditor::edit(Node *p_collision_polygon) {
node=p_collision_polygon->cast_to<Polygon2D>();
if (!canvas_item_editor->get_viewport_control()->is_connected("draw",this,"_canvas_draw"))
canvas_item_editor->get_viewport_control()->connect("draw",this,"_canvas_draw");
+ node->connect("exit_tree",this,"_node_removed",varray(),CONNECT_ONESHOT);
wip.clear();
wip_active=false;
edited_point=-1;
} else {
+
+ if (node)
+ node->disconnect("exit_tree",this,"_node_removed");
+
node=NULL;
if (canvas_item_editor->get_viewport_control()->is_connected("draw",this,"_canvas_draw"))
@@ -723,12 +730,14 @@ void Polygon2DEditor::_bind_methods() {
ObjectTypeDB::bind_method(_MD("_uv_draw"),&Polygon2DEditor::_uv_draw);
ObjectTypeDB::bind_method(_MD("_uv_input"),&Polygon2DEditor::_uv_input);
ObjectTypeDB::bind_method(_MD("_uv_scroll_changed"),&Polygon2DEditor::_uv_scroll_changed);
+ ObjectTypeDB::bind_method(_MD("_node_removed"),&Polygon2DEditor::_node_removed);
}
Polygon2DEditor::Polygon2DEditor(EditorNode *p_editor) {
+ node=NULL;
canvas_item_editor=NULL;
editor=p_editor;
undo_redo = editor->get_undo_redo();
diff --git a/tools/editor/plugins/script_editor_plugin.cpp b/tools/editor/plugins/script_editor_plugin.cpp
index c0d773309c..c5fb574c71 100644
--- a/tools/editor/plugins/script_editor_plugin.cpp
+++ b/tools/editor/plugins/script_editor_plugin.cpp
@@ -608,6 +608,16 @@ bool ScriptEditor::_test_script_times_on_disk() {
return all_ok;
}
+void ScriptEditor::swap_lines(TextEdit *tx, int line1, int line2)
+{
+ String tmp = tx->get_line(line1);
+ String tmp2 = tx->get_line(line2);
+ tx->set_line(line2, tmp);
+ tx->set_line(line1, tmp2);
+
+ tx->cursor_set_line(line2);
+}
+
void ScriptEditor::_menu_option(int p_option) {
@@ -690,18 +700,38 @@ void ScriptEditor::_menu_option(int p_option) {
if (scr.is_null())
return;
- int line_id = tx->cursor_get_line();
- int next_id = line_id - 1;
+ if (tx->is_selection_active())
+ {
+ int from_line = tx->get_selection_from_line();
+ int from_col = tx->get_selection_from_column();
+ int to_line = tx->get_selection_to_line();
+ int to_column = tx->get_selection_to_column();
+
+ for (int i = from_line; i <= to_line; i++)
+ {
+ int line_id = i;
+ int next_id = i - 1;
- if (line_id == 0 || next_id < 0)
- return;
+ if (line_id == 0 || next_id < 0)
+ return;
- String tmp = tx->get_line(line_id);
- String tmp2 = tx->get_line(next_id);
- tx->set_line(next_id, tmp);
- tx->set_line(line_id, tmp2);
+ swap_lines(tx, line_id, next_id);
+ }
+ int from_line_up = from_line > 0 ? from_line-1 : from_line;
+ int to_line_up = to_line > 0 ? to_line-1 : to_line;
+ tx->select(from_line_up, from_col, to_line_up, to_column);
+ }
+ else
+ {
+ int line_id = tx->cursor_get_line();
+ int next_id = line_id - 1;
+
+ if (line_id == 0 || next_id < 0)
+ return;
+
+ swap_lines(tx, line_id, next_id);
+ }
tx->update();
- tx->cursor_set_line(next_id);
} break;
case EDIT_MOVE_LINE_DOWN: {
@@ -711,18 +741,38 @@ void ScriptEditor::_menu_option(int p_option) {
if (scr.is_null())
return;
- int line_id = tx->cursor_get_line();
- int next_id = line_id + 1;
+ if (tx->is_selection_active())
+ {
+ int from_line = tx->get_selection_from_line();
+ int from_col = tx->get_selection_from_column();
+ int to_line = tx->get_selection_to_line();
+ int to_column = tx->get_selection_to_column();
- if (line_id == tx->get_line_count() || next_id > tx->get_line_count())
- return;
+ for (int i = to_line; i >= from_line; i--)
+ {
+ int line_id = i;
+ int next_id = i + 1;
+
+ if (line_id == tx->get_line_count()-1 || next_id > tx->get_line_count())
+ return;
- String tmp = tx->get_line(line_id);
- String tmp2 = tx->get_line(next_id);
- tx->set_line(next_id, tmp);
- tx->set_line(line_id, tmp2);
+ swap_lines(tx, line_id, next_id);
+ }
+ int from_line_down = from_line < tx->get_line_count() ? from_line+1 : from_line;
+ int to_line_down = to_line < tx->get_line_count() ? to_line+1 : to_line;
+ tx->select(from_line_down, from_col, to_line_down, to_column);
+ }
+ else
+ {
+ int line_id = tx->cursor_get_line();
+ int next_id = line_id + 1;
+
+ if (line_id == tx->get_line_count()-1 || next_id > tx->get_line_count())
+ return;
+
+ swap_lines(tx, line_id, next_id);
+ }
tx->update();
- tx->cursor_set_line(next_id);
} break;
case EDIT_INDENT_LEFT: {
@@ -740,19 +790,39 @@ void ScriptEditor::_menu_option(int p_option) {
for (int i = begin; i <= end; i++)
{
String line_text = tx->get_line(i);
- line_text = line_text.substr(1, line_text.length());
- tx->set_line(i, line_text);
+ // begins with tab
+ if (line_text.begins_with("\t"))
+ {
+ line_text = line_text.substr(1, line_text.length());
+ tx->set_line(i, line_text);
+ }
+ // begins with 4 spaces
+ else if (line_text.begins_with(" "))
+ {
+ line_text = line_text.substr(4, line_text.length());
+ tx->set_line(i, line_text);
+ }
}
}
else
{
begin = tx->cursor_get_line();
String line_text = tx->get_line(begin);
- line_text = line_text.substr(1, line_text.length());
- tx->set_line(begin, line_text);
+ // begins with tab
+ if (line_text.begins_with("\t"))
+ {
+ line_text = line_text.substr(1, line_text.length());
+ tx->set_line(begin, line_text);
+ }
+ // begins with 4 spaces
+ else if (line_text.begins_with(" "))
+ {
+ line_text = line_text.substr(4, line_text.length());
+ tx->set_line(begin, line_text);
+ }
}
tx->update();
- tx->deselect();
+ //tx->deselect();
} break;
case EDIT_INDENT_RIGHT: {
@@ -782,7 +852,7 @@ void ScriptEditor::_menu_option(int p_option) {
tx->set_line(begin, line_text);
}
tx->update();
- tx->deselect();
+ //tx->deselect();
} break;
case EDIT_CLONE_DOWN: {
@@ -837,7 +907,7 @@ void ScriptEditor::_menu_option(int p_option) {
tx->set_line(begin, line_text);
}
tx->update();
- tx->deselect();
+ //tx->deselect();
} break;
case EDIT_COMPLETE: {
@@ -1443,7 +1513,7 @@ void ScriptEditor::_add_callback(Object *p_obj, const String& p_function, const
int pos = script->get_language()->find_function(p_function,code);
if (pos==-1) {
//does not exist
-
+ ste->get_text_edit()->deselect();
pos=ste->get_text_edit()->get_line_count()+2;
String func = script->get_language()->make_function("",p_function,p_args);
//code=code+func;
@@ -1498,8 +1568,8 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) {
edit_menu->get_popup()->add_separator();
edit_menu->get_popup()->add_item("Select All",EDIT_SELECT_ALL,KEY_MASK_CMD|KEY_A);
edit_menu->get_popup()->add_separator();
- edit_menu->get_popup()->add_item("Move Line Up",EDIT_MOVE_LINE_UP,KEY_MASK_ALT|KEY_UP);
- edit_menu->get_popup()->add_item("Move Line Down",EDIT_MOVE_LINE_DOWN,KEY_MASK_ALT|KEY_DOWN);
+ edit_menu->get_popup()->add_item("Move Up",EDIT_MOVE_LINE_UP,KEY_MASK_ALT|KEY_UP);
+ edit_menu->get_popup()->add_item("Move Down",EDIT_MOVE_LINE_DOWN,KEY_MASK_ALT|KEY_DOWN);
edit_menu->get_popup()->add_item("Indent Left",EDIT_INDENT_LEFT,KEY_MASK_ALT|KEY_LEFT);
edit_menu->get_popup()->add_item("Indent Right",EDIT_INDENT_RIGHT,KEY_MASK_ALT|KEY_RIGHT);
edit_menu->get_popup()->add_item("Toggle Comment",EDIT_TOGGLE_COMMENT,KEY_MASK_CMD|KEY_SLASH);
diff --git a/tools/editor/plugins/script_editor_plugin.h b/tools/editor/plugins/script_editor_plugin.h
index 62508253e3..01942fab2a 100644
--- a/tools/editor/plugins/script_editor_plugin.h
+++ b/tools/editor/plugins/script_editor_plugin.h
@@ -218,7 +218,7 @@ public:
void get_breakpoints(List<String> *p_breakpoints);
-
+ void swap_lines(TextEdit *tx, int line1, int line2);
void save_external_data();
diff --git a/tools/editor/plugins/shader_editor_plugin.cpp b/tools/editor/plugins/shader_editor_plugin.cpp
index d9bf4b6fa5..a6172ee098 100644
--- a/tools/editor/plugins/shader_editor_plugin.cpp
+++ b/tools/editor/plugins/shader_editor_plugin.cpp
@@ -144,10 +144,13 @@ void ShaderTextEditor::_validate_script() {
Error err = ShaderLanguage::compile(code,type,NULL,NULL,&errortxt,&line,&col);
if (err!=OK) {
- String error_text="error("+itos(line)+","+itos(col)+"): "+errortxt;
+ String error_text="error("+itos(line+1)+","+itos(col)+"): "+errortxt;
set_error(error_text);
+ get_text_edit()->set_line_as_marked(line,true);
} else {
+ for(int i=0;i<get_text_edit()->get_line_count();i++)
+ get_text_edit()->set_line_as_marked(i,false);
set_error("");
}
diff --git a/tools/export/blender25/io_scene_dae/export_dae.py b/tools/export/blender25/io_scene_dae/export_dae.py
index 8b1d2e296a..4e1635429b 100644
--- a/tools/export/blender25/io_scene_dae/export_dae.py
+++ b/tools/export/blender25/io_scene_dae/export_dae.py
@@ -335,7 +335,7 @@ class DaeExporter:
return matid
- def export_mesh(self,node,armature=None,skeyindex=-1,skel_source=None):
+ def export_mesh(self,node,armature=None,skeyindex=-1,skel_source=None,custom_name=None):
mesh = node.data
@@ -372,9 +372,9 @@ class DaeExporter:
# self.export_node(node,il,shape.name)
node.data.update()
if (armature and k==0):
- md=self.export_mesh(node,armature,k,mid)
+ md=self.export_mesh(node,armature,k,mid,shape.name)
else:
- md=self.export_mesh(node,None,k)
+ md=self.export_mesh(node,None,k,None,shape.name)
node.data = p
node.data.update()
@@ -596,7 +596,10 @@ class DaeExporter:
meshid = self.new_id("mesh")
- self.writel(S_GEOM,1,'<geometry id="'+meshid+'" name="'+mesh.name+'">')
+ if (custom_name!=None):
+ self.writel(S_GEOM,1,'<geometry id="'+meshid+'" name="'+custom_name+'">')
+ else:
+ self.writel(S_GEOM,1,'<geometry id="'+meshid+'" name="'+mesh.name+'">')
self.writel(S_GEOM,2,'<mesh>')
@@ -1438,11 +1441,16 @@ class DaeExporter:
return tcn
def export_animations(self):
-
+ tmp_mat = [] # workaround by ndee
+ for s in self.skeletons: # workaround by ndee
+ tmp_bone_mat = [] # workaround by ndee
+ for bone in s.pose.bones: # workaround by ndee
+ tmp_bone_mat.append(Matrix(bone.matrix_basis)) # workaround by ndee
+ tmp_mat.append([Matrix(s.matrix_local),tmp_bone_mat]) # workaround by ndee -> stores skeleton and bone transformations
+
self.writel(S_ANIM,0,'<library_animations>')
-
if (self.config["use_anim_action_all"] and len(self.skeletons)):
cached_actions = {}
@@ -1473,13 +1481,18 @@ class DaeExporter:
bones.append(dp)
allowed_skeletons=[]
- for y in self.skeletons:
+ for i,y in enumerate(self.skeletons): # workaround by ndee
if (y.animation_data):
for z in y.pose.bones:
if (z.bone.name in bones):
if (not y in allowed_skeletons):
allowed_skeletons.append(y)
y.animation_data.action=x;
+
+ y.matrix_local = tmp_mat[i][0] # workaround by ndee -> resets the skeleton transformation.
+ for j,bone in enumerate(s.pose.bones): # workaround by ndee
+ bone.matrix_basis = Matrix() # workaround by ndee -> resets the bone transformations. Important if bones in follwing actions miss keyframes
+
print("allowed skeletons "+str(allowed_skeletons))
@@ -1498,16 +1511,20 @@ class DaeExporter:
self.writel(S_ANIM_CLIPS,0,'</library_animation_clips>')
- for s in self.skeletons:
+ for i,s in enumerate(self.skeletons): # workaround by ndee
if (s.animation_data==None):
continue
if s in cached_actions:
s.animation_data.action = bpy.data.actions[cached_actions[s]]
else:
s.animation_data.action = None
+ for j,bone in enumerate(s.pose.bones): # workaround by ndee
+ bone.matrix_basis = tmp_mat[i][1][j] # workaround by ndee -> resets the bone transformation to what they were before exporting.
else:
self.export_animation(self.scene.frame_start,self.scene.frame_end)
-
+
+
+
self.writel(S_ANIM,0,'</library_animations>')
def export(self):