summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorAnton Yabchinskiy <arn@bestmx.ru>2015-01-10 22:29:17 +0300
committerAnton Yabchinskiy <arn@bestmx.ru>2015-01-10 22:29:17 +0300
commitb6c5cb1064eab63788060dc918d7fec53e57a532 (patch)
tree83f8345dd6ee0bc432ec21fc979c628edd808e5e /tools
parenta7875c586af74302584544d777b189f4cb85c393 (diff)
parentf97582b5e9f069176a4c9226c39a880f786dae67 (diff)
Merge branch 'master' of github.com:okamstudio/godot
Diffstat (limited to 'tools')
-rw-r--r--tools/SCsub6
-rw-r--r--tools/editor/editor_node.cpp28
-rw-r--r--tools/editor/editor_node.h2
-rw-r--r--tools/editor/icons/icon_graph_comment.pngbin0 -> 310 bytes
-rw-r--r--tools/editor/icons/icon_graph_cube_uniform.pngbin0 -> 652 bytes
-rw-r--r--tools/editor/icons/icon_graph_input.pngbin0 -> 585 bytes
-rw-r--r--tools/editor/icons/icon_graph_rgb.pngbin0 -> 174 bytes
-rw-r--r--tools/editor/icons/icon_graph_rgb_op.pngbin0 -> 280 bytes
-rw-r--r--tools/editor/icons/icon_graph_rgb_uniform.pngbin0 -> 419 bytes
-rw-r--r--tools/editor/icons/icon_graph_scalar.pngbin0 -> 328 bytes
-rw-r--r--tools/editor/icons/icon_graph_scalar_interp.pngbin0 -> 352 bytes
-rw-r--r--tools/editor/icons/icon_graph_scalar_op.pngbin0 -> 238 bytes
-rw-r--r--tools/editor/icons/icon_graph_scalar_uniform.pngbin0 -> 392 bytes
-rw-r--r--tools/editor/icons/icon_graph_scalars_to_vec.pngbin0 -> 300 bytes
-rw-r--r--tools/editor/icons/icon_graph_texscreen.pngbin0 -> 578 bytes
-rw-r--r--tools/editor/icons/icon_graph_texture_uniform.pngbin0 -> 358 bytes
-rw-r--r--tools/editor/icons/icon_graph_time.pngbin0 -> 678 bytes
-rw-r--r--tools/editor/icons/icon_graph_vec_dp.pngbin0 -> 279 bytes
-rw-r--r--tools/editor/icons/icon_graph_vec_interp.pngbin0 -> 332 bytes
-rw-r--r--tools/editor/icons/icon_graph_vec_length.pngbin0 -> 303 bytes
-rw-r--r--tools/editor/icons/icon_graph_vec_op.pngbin0 -> 256 bytes
-rw-r--r--tools/editor/icons/icon_graph_vec_scalar_op.pngbin0 -> 267 bytes
-rw-r--r--tools/editor/icons/icon_graph_vec_to_scalars.pngbin0 -> 306 bytes
-rw-r--r--tools/editor/icons/icon_graph_vecs_to_xform.pngbin0 -> 288 bytes
-rw-r--r--tools/editor/icons/icon_graph_vector.pngbin0 -> 480 bytes
-rw-r--r--tools/editor/icons/icon_graph_vector_uniform.pngbin0 -> 531 bytes
-rw-r--r--tools/editor/icons/icon_graph_xform.pngbin0 -> 262 bytes
-rw-r--r--tools/editor/icons/icon_graph_xform_mult.pngbin0 -> 311 bytes
-rw-r--r--tools/editor/icons/icon_graph_xform_scalar_func.pngbin0 -> 378 bytes
-rw-r--r--tools/editor/icons/icon_graph_xform_to_vecs.pngbin0 -> 272 bytes
-rw-r--r--tools/editor/icons/icon_graph_xform_uniform.pngbin0 -> 346 bytes
-rw-r--r--tools/editor/icons/icon_graph_xform_vec_func.pngbin0 -> 389 bytes
-rw-r--r--tools/editor/icons/icon_graph_xform_vec_imult.pngbin0 -> 430 bytes
-rw-r--r--tools/editor/icons/icon_graph_xform_vec_mult.pngbin0 -> 422 bytes
-rw-r--r--tools/editor/plugins/canvas_item_editor_plugin.cpp2
-rw-r--r--tools/editor/plugins/script_editor_plugin.cpp2
-rw-r--r--tools/editor/plugins/shader_graph_editor_plugin.cpp217
-rw-r--r--tools/editor/plugins/shader_graph_editor_plugin.h5
-rw-r--r--tools/editor/plugins/spatial_editor_plugin.cpp12
-rw-r--r--tools/editor/project_manager.cpp4
-rw-r--r--tools/editor/script_editor_debugger.cpp2
-rw-r--r--tools/export/blender25/godot_export_manager.py439
-rw-r--r--tools/export/blender25/io_scene_dae/export_dae.py71
43 files changed, 683 insertions, 107 deletions
diff --git a/tools/SCsub b/tools/SCsub
index 4d8b05fe79..ce7df2c35b 100644
--- a/tools/SCsub
+++ b/tools/SCsub
@@ -13,11 +13,9 @@ if (env["tools"]!="no"):
SConscript('freetype/SCsub');
SConscript('doc/SCsub')
SConscript('pck/SCsub')
-
+ lib = env.Library("tool",env.tool_sources)
-lib = env.Library("tool",env.tool_sources)
-
-env.Prepend(LIBS=[lib])
+ env.Prepend(LIBS=[lib])
diff --git a/tools/editor/editor_node.cpp b/tools/editor/editor_node.cpp
index 5843a7cb28..52c75c6d7e 100644
--- a/tools/editor/editor_node.cpp
+++ b/tools/editor/editor_node.cpp
@@ -978,6 +978,15 @@ void EditorNode::_dialog_action(String p_file) {
}
} break;
+
+ case FILE_SAVE_AND_RUN: {
+ if (file->get_mode()==FileDialog::MODE_SAVE_FILE) {
+
+ _save_scene(p_file);
+ _run(false);
+ }
+ } break;
+
case FILE_EXPORT_MESH_LIBRARY: {
Ref<MeshLibrary> ml;
@@ -1391,13 +1400,10 @@ void EditorNode::_run(bool p_current,const String& p_custom) {
}
if (scene->get_filename()=="") {
-
-
current_option=-1;
//accept->get_cancel()->hide();
- accept->get_ok()->set_text("I see..");
- accept->set_text("Scene has never been saved. Save before running!");
- accept->popup_centered(Size2(300,70));;
+ /**/
+ _menu_option_confirm(FILE_SAVE_BEFORE_RUN, false);
return;
}
@@ -1664,6 +1670,18 @@ void EditorNode::_menu_option_confirm(int p_option,bool p_confirmed) {
} break;
+ case FILE_SAVE_BEFORE_RUN: {
+ if (!p_confirmed) {
+ accept->get_ok()->set_text("Yes");
+ accept->set_text("This scene has never been saved. Save before running?");
+ accept->popup_centered(Size2(300, 70));
+ break;
+ }
+
+ _menu_option(FILE_SAVE_AS_SCENE);
+ _menu_option_confirm(FILE_SAVE_AND_RUN, true);
+ } break;
+
case FILE_DUMP_STRINGS: {
Node *scene = edited_scene;
diff --git a/tools/editor/editor_node.h b/tools/editor/editor_node.h
index 381993646e..7560c2b149 100644
--- a/tools/editor/editor_node.h
+++ b/tools/editor/editor_node.h
@@ -108,6 +108,8 @@ class EditorNode : public Node {
FILE_OPEN_SCENE,
FILE_SAVE_SCENE,
FILE_SAVE_AS_SCENE,
+ FILE_SAVE_BEFORE_RUN,
+ FILE_SAVE_AND_RUN,
FILE_IMPORT_SUBSCENE,
FILE_EXPORT_PROJECT,
FILE_EXPORT_MESH_LIBRARY,
diff --git a/tools/editor/icons/icon_graph_comment.png b/tools/editor/icons/icon_graph_comment.png
new file mode 100644
index 0000000000..bf7889c510
--- /dev/null
+++ b/tools/editor/icons/icon_graph_comment.png
Binary files differ
diff --git a/tools/editor/icons/icon_graph_cube_uniform.png b/tools/editor/icons/icon_graph_cube_uniform.png
new file mode 100644
index 0000000000..d1b92b4943
--- /dev/null
+++ b/tools/editor/icons/icon_graph_cube_uniform.png
Binary files differ
diff --git a/tools/editor/icons/icon_graph_input.png b/tools/editor/icons/icon_graph_input.png
new file mode 100644
index 0000000000..a396bc2350
--- /dev/null
+++ b/tools/editor/icons/icon_graph_input.png
Binary files differ
diff --git a/tools/editor/icons/icon_graph_rgb.png b/tools/editor/icons/icon_graph_rgb.png
new file mode 100644
index 0000000000..abffaedd34
--- /dev/null
+++ b/tools/editor/icons/icon_graph_rgb.png
Binary files differ
diff --git a/tools/editor/icons/icon_graph_rgb_op.png b/tools/editor/icons/icon_graph_rgb_op.png
new file mode 100644
index 0000000000..642fc838c2
--- /dev/null
+++ b/tools/editor/icons/icon_graph_rgb_op.png
Binary files differ
diff --git a/tools/editor/icons/icon_graph_rgb_uniform.png b/tools/editor/icons/icon_graph_rgb_uniform.png
new file mode 100644
index 0000000000..92c79997ef
--- /dev/null
+++ b/tools/editor/icons/icon_graph_rgb_uniform.png
Binary files differ
diff --git a/tools/editor/icons/icon_graph_scalar.png b/tools/editor/icons/icon_graph_scalar.png
new file mode 100644
index 0000000000..028d0e9ea4
--- /dev/null
+++ b/tools/editor/icons/icon_graph_scalar.png
Binary files differ
diff --git a/tools/editor/icons/icon_graph_scalar_interp.png b/tools/editor/icons/icon_graph_scalar_interp.png
new file mode 100644
index 0000000000..4f178a27c4
--- /dev/null
+++ b/tools/editor/icons/icon_graph_scalar_interp.png
Binary files differ
diff --git a/tools/editor/icons/icon_graph_scalar_op.png b/tools/editor/icons/icon_graph_scalar_op.png
new file mode 100644
index 0000000000..0fc4cae94c
--- /dev/null
+++ b/tools/editor/icons/icon_graph_scalar_op.png
Binary files differ
diff --git a/tools/editor/icons/icon_graph_scalar_uniform.png b/tools/editor/icons/icon_graph_scalar_uniform.png
new file mode 100644
index 0000000000..fc6590a8cf
--- /dev/null
+++ b/tools/editor/icons/icon_graph_scalar_uniform.png
Binary files differ
diff --git a/tools/editor/icons/icon_graph_scalars_to_vec.png b/tools/editor/icons/icon_graph_scalars_to_vec.png
new file mode 100644
index 0000000000..7ca39a2f56
--- /dev/null
+++ b/tools/editor/icons/icon_graph_scalars_to_vec.png
Binary files differ
diff --git a/tools/editor/icons/icon_graph_texscreen.png b/tools/editor/icons/icon_graph_texscreen.png
new file mode 100644
index 0000000000..e183a8fa56
--- /dev/null
+++ b/tools/editor/icons/icon_graph_texscreen.png
Binary files differ
diff --git a/tools/editor/icons/icon_graph_texture_uniform.png b/tools/editor/icons/icon_graph_texture_uniform.png
new file mode 100644
index 0000000000..7517ac1d92
--- /dev/null
+++ b/tools/editor/icons/icon_graph_texture_uniform.png
Binary files differ
diff --git a/tools/editor/icons/icon_graph_time.png b/tools/editor/icons/icon_graph_time.png
new file mode 100644
index 0000000000..b61e45589f
--- /dev/null
+++ b/tools/editor/icons/icon_graph_time.png
Binary files differ
diff --git a/tools/editor/icons/icon_graph_vec_dp.png b/tools/editor/icons/icon_graph_vec_dp.png
new file mode 100644
index 0000000000..059c3025e7
--- /dev/null
+++ b/tools/editor/icons/icon_graph_vec_dp.png
Binary files differ
diff --git a/tools/editor/icons/icon_graph_vec_interp.png b/tools/editor/icons/icon_graph_vec_interp.png
new file mode 100644
index 0000000000..daf7a00203
--- /dev/null
+++ b/tools/editor/icons/icon_graph_vec_interp.png
Binary files differ
diff --git a/tools/editor/icons/icon_graph_vec_length.png b/tools/editor/icons/icon_graph_vec_length.png
new file mode 100644
index 0000000000..60ade8c90a
--- /dev/null
+++ b/tools/editor/icons/icon_graph_vec_length.png
Binary files differ
diff --git a/tools/editor/icons/icon_graph_vec_op.png b/tools/editor/icons/icon_graph_vec_op.png
new file mode 100644
index 0000000000..f2a7a51123
--- /dev/null
+++ b/tools/editor/icons/icon_graph_vec_op.png
Binary files differ
diff --git a/tools/editor/icons/icon_graph_vec_scalar_op.png b/tools/editor/icons/icon_graph_vec_scalar_op.png
new file mode 100644
index 0000000000..f0f4e7a196
--- /dev/null
+++ b/tools/editor/icons/icon_graph_vec_scalar_op.png
Binary files differ
diff --git a/tools/editor/icons/icon_graph_vec_to_scalars.png b/tools/editor/icons/icon_graph_vec_to_scalars.png
new file mode 100644
index 0000000000..a677a7cc53
--- /dev/null
+++ b/tools/editor/icons/icon_graph_vec_to_scalars.png
Binary files differ
diff --git a/tools/editor/icons/icon_graph_vecs_to_xform.png b/tools/editor/icons/icon_graph_vecs_to_xform.png
new file mode 100644
index 0000000000..51216c93eb
--- /dev/null
+++ b/tools/editor/icons/icon_graph_vecs_to_xform.png
Binary files differ
diff --git a/tools/editor/icons/icon_graph_vector.png b/tools/editor/icons/icon_graph_vector.png
new file mode 100644
index 0000000000..9dfe47d757
--- /dev/null
+++ b/tools/editor/icons/icon_graph_vector.png
Binary files differ
diff --git a/tools/editor/icons/icon_graph_vector_uniform.png b/tools/editor/icons/icon_graph_vector_uniform.png
new file mode 100644
index 0000000000..611539fca7
--- /dev/null
+++ b/tools/editor/icons/icon_graph_vector_uniform.png
Binary files differ
diff --git a/tools/editor/icons/icon_graph_xform.png b/tools/editor/icons/icon_graph_xform.png
new file mode 100644
index 0000000000..22df472be4
--- /dev/null
+++ b/tools/editor/icons/icon_graph_xform.png
Binary files differ
diff --git a/tools/editor/icons/icon_graph_xform_mult.png b/tools/editor/icons/icon_graph_xform_mult.png
new file mode 100644
index 0000000000..5d0ce7982d
--- /dev/null
+++ b/tools/editor/icons/icon_graph_xform_mult.png
Binary files differ
diff --git a/tools/editor/icons/icon_graph_xform_scalar_func.png b/tools/editor/icons/icon_graph_xform_scalar_func.png
new file mode 100644
index 0000000000..e53f08a564
--- /dev/null
+++ b/tools/editor/icons/icon_graph_xform_scalar_func.png
Binary files differ
diff --git a/tools/editor/icons/icon_graph_xform_to_vecs.png b/tools/editor/icons/icon_graph_xform_to_vecs.png
new file mode 100644
index 0000000000..847261f726
--- /dev/null
+++ b/tools/editor/icons/icon_graph_xform_to_vecs.png
Binary files differ
diff --git a/tools/editor/icons/icon_graph_xform_uniform.png b/tools/editor/icons/icon_graph_xform_uniform.png
new file mode 100644
index 0000000000..94c9759b25
--- /dev/null
+++ b/tools/editor/icons/icon_graph_xform_uniform.png
Binary files differ
diff --git a/tools/editor/icons/icon_graph_xform_vec_func.png b/tools/editor/icons/icon_graph_xform_vec_func.png
new file mode 100644
index 0000000000..f3ba528896
--- /dev/null
+++ b/tools/editor/icons/icon_graph_xform_vec_func.png
Binary files differ
diff --git a/tools/editor/icons/icon_graph_xform_vec_imult.png b/tools/editor/icons/icon_graph_xform_vec_imult.png
new file mode 100644
index 0000000000..7e7330cb8c
--- /dev/null
+++ b/tools/editor/icons/icon_graph_xform_vec_imult.png
Binary files differ
diff --git a/tools/editor/icons/icon_graph_xform_vec_mult.png b/tools/editor/icons/icon_graph_xform_vec_mult.png
new file mode 100644
index 0000000000..f80a28c80d
--- /dev/null
+++ b/tools/editor/icons/icon_graph_xform_vec_mult.png
Binary files differ
diff --git a/tools/editor/plugins/canvas_item_editor_plugin.cpp b/tools/editor/plugins/canvas_item_editor_plugin.cpp
index 482340ca00..43ebebeb22 100644
--- a/tools/editor/plugins/canvas_item_editor_plugin.cpp
+++ b/tools/editor/plugins/canvas_item_editor_plugin.cpp
@@ -2888,7 +2888,7 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) {
p->add_separator();
p->add_item("Copy Pose",ANIM_COPY_POSE);
p->add_item("Paste Pose",ANIM_PASTE_POSE);
- p->add_item("Clear Pose",ANIM_CLEAR_POSE,KEY_MASK_ALT|KEY_K);
+ p->add_item("Clear Pose",ANIM_CLEAR_POSE,KEY_MASK_SHIFT|KEY_K);
value_dialog = memnew( AcceptDialog );
value_dialog->set_title("Set a Value");
diff --git a/tools/editor/plugins/script_editor_plugin.cpp b/tools/editor/plugins/script_editor_plugin.cpp
index 439d8273c7..55957887dc 100644
--- a/tools/editor/plugins/script_editor_plugin.cpp
+++ b/tools/editor/plugins/script_editor_plugin.cpp
@@ -1578,7 +1578,7 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) {
menu_hb->add_child(file_menu);
file_menu->set_text("File");
file_menu->get_popup()->add_item("Open",FILE_OPEN);
- file_menu->get_popup()->add_item("Save",FILE_SAVE,KEY_MASK_ALT|KEY_S);
+ file_menu->get_popup()->add_item("Save",FILE_SAVE,KEY_MASK_ALT|KEY_MASK_CMD|KEY_S);
file_menu->get_popup()->add_item("Save As..",FILE_SAVE_AS);
file_menu->get_popup()->add_item("Save All",FILE_SAVE_ALL,KEY_MASK_CMD|KEY_MASK_SHIFT|KEY_S);
file_menu->get_popup()->connect("item_pressed", this,"_menu_option");
diff --git a/tools/editor/plugins/shader_graph_editor_plugin.cpp b/tools/editor/plugins/shader_graph_editor_plugin.cpp
index 710f11e726..0a206c4a45 100644
--- a/tools/editor/plugins/shader_graph_editor_plugin.cpp
+++ b/tools/editor/plugins/shader_graph_editor_plugin.cpp
@@ -200,7 +200,7 @@ void ShaderGraphView::_vec_input_changed(double p_value, int p_id,Array p_arr){
}
void ShaderGraphView::_xform_input_changed(int p_id, Node *p_button){
- print_line("XFIC");
+
ToolButton *tb = p_button->cast_to<ToolButton>();
ped_popup->set_pos(tb->get_global_pos()+Vector2(0,tb->get_size().height));
ped_popup->set_size(tb->get_size());
@@ -385,6 +385,41 @@ void ShaderGraphView::_connection_request(const String& p_from, int p_from_slot,
}
+void ShaderGraphView::_disconnection_request(const String& p_from, int p_from_slot,const String& p_to,int p_to_slot) {
+
+ UndoRedo *ur=EditorNode::get_singleton()->get_undo_redo();
+
+ int from_idx=-1;
+ int to_idx=-1;
+ for (Map<int,GraphNode*>::Element *E=node_map.front();E;E=E->next()) {
+
+ if (p_from==E->get()->get_name())
+ from_idx=E->key();
+ if (p_to==E->get()->get_name())
+ to_idx=E->key();
+ }
+
+ ERR_FAIL_COND(from_idx==-1);
+ ERR_FAIL_COND(to_idx==-1);
+
+ if (!graph->is_node_connected(type,from_idx,p_from_slot,to_idx,p_to_slot))
+ return; //nothing to disconnect
+
+ ur->create_action("Disconnect Graph Nodes");
+
+ List<ShaderGraph::Connection> conns;
+
+ graph->get_node_connections(type,&conns);
+ //disconnect/reconnect dependencies
+ ur->add_do_method(graph.ptr(),"disconnect_node",type,from_idx,p_from_slot,to_idx,p_to_slot);
+ ur->add_undo_method(graph.ptr(),"connect_node",type,from_idx,p_from_slot,to_idx,p_to_slot);
+ ur->add_do_method(this,"_update_graph");
+ ur->add_undo_method(this,"_update_graph");
+ ur->commit_action();
+
+
+}
+
void ShaderGraphView::_node_removed(int p_id) {
UndoRedo *ur=EditorNode::get_singleton()->get_undo_redo();
@@ -410,7 +445,7 @@ void ShaderGraphView::_node_removed(int p_id) {
void ShaderGraphView::_node_moved(const Vector2& p_from, const Vector2& p_to,int p_id) {
- print_line("moved from "+p_from+" to "+p_to);
+
ERR_FAIL_COND(!node_map.has(p_id));
UndoRedo *ur=EditorNode::get_singleton()->get_undo_redo();
ur->create_action("Move Shader Graph Node");
@@ -433,8 +468,8 @@ void ShaderGraphView::_create_node(int p_id) {
GraphNode *gn = memnew( GraphNode );
gn->set_show_close_button(true);
Color typecol[4]={
- Color(0.2,1,0.2),
- Color(0.7,0.1,1),
+ Color(0.9,0.4,1),
+ Color(0.8,1,0.2),
Color(1,0.2,0.2),
Color(0,1,1)
};
@@ -710,14 +745,9 @@ void ShaderGraphView::_create_node(int p_id) {
} break; // mat4 x mat4
- case ShaderGraph::NODE_XFORM_VEC_MULT:
- case ShaderGraph::NODE_XFORM_VEC_INV_MULT: {
-
- if (graph->node_get_type(type,p_id)==ShaderGraph::NODE_XFORM_VEC_INV_MULT)
- gn->set_title("XFVecMult");
- else
- gn->set_title("XFVecInvMult");
+ case ShaderGraph::NODE_XFORM_VEC_MULT: {
+ gn->set_title("XFVecMult");
Button *button = memnew( Button("RotOnly"));
button->set_toggle_mode(true);
@@ -739,6 +769,32 @@ void ShaderGraphView::_create_node(int p_id) {
gn->set_slot(1,true,ShaderGraph::SLOT_TYPE_XFORM,typecol[ShaderGraph::SLOT_TYPE_XFORM],true,ShaderGraph::SLOT_TYPE_VEC,typecol[ShaderGraph::SLOT_TYPE_VEC]);
gn->set_slot(2,true,ShaderGraph::SLOT_TYPE_VEC,typecol[ShaderGraph::SLOT_TYPE_VEC],false,0,Color());
+ } break;
+ case ShaderGraph::NODE_XFORM_VEC_INV_MULT: {
+
+ gn->set_title("XFVecInvMult");
+
+
+ Button *button = memnew( Button("RotOnly"));
+ button->set_toggle_mode(true);
+ button->set_pressed(graph->xform_vec_mult_node_get_no_translation(type,p_id));
+ button->connect("toggled",this,"_xform_inv_rev_changed",varray(p_id));
+
+ gn->add_child(button);
+
+ gn->add_child( memnew(Label("vec")));
+ HBoxContainer *hbc = memnew( HBoxContainer );
+ hbc->add_constant_override("separation",0);
+ hbc->add_child( memnew(Label("xf")));
+ hbc->add_spacer();
+ Label *l = memnew(Label("out"));
+ l->set_align(Label::ALIGN_RIGHT);
+ hbc->add_child( l);
+ gn->add_child(hbc);
+
+ gn->set_slot(1,true,ShaderGraph::SLOT_TYPE_VEC,typecol[ShaderGraph::SLOT_TYPE_VEC],false,0,Color());
+ gn->set_slot(2,true,ShaderGraph::SLOT_TYPE_XFORM,typecol[ShaderGraph::SLOT_TYPE_XFORM],true,ShaderGraph::SLOT_TYPE_VEC,typecol[ShaderGraph::SLOT_TYPE_VEC]);
+
} break; // mat4 x vec3 inverse mult (with no-translation option)
case ShaderGraph::NODE_SCALAR_FUNC: {
@@ -967,7 +1023,7 @@ void ShaderGraphView::_create_node(int p_id) {
gn->set_slot(0,true,ShaderGraph::SLOT_TYPE_VEC,typecol[ShaderGraph::SLOT_TYPE_VEC],true,ShaderGraph::SLOT_TYPE_VEC,typecol[ShaderGraph::SLOT_TYPE_VEC]);
gn->set_slot(1,true,ShaderGraph::SLOT_TYPE_VEC,typecol[ShaderGraph::SLOT_TYPE_VEC],false,0,Color());
- gn->set_slot(2,true,ShaderGraph::SLOT_TYPE_VEC,typecol[ShaderGraph::SLOT_TYPE_VEC],false,0,Color());
+ gn->set_slot(2,true,ShaderGraph::SLOT_TYPE_SCALAR,typecol[ShaderGraph::SLOT_TYPE_SCALAR],false,0,Color());
} break; // vec3 interpolation (with optional curve)
case ShaderGraph::NODE_SCALAR_INPUT: {
@@ -1157,7 +1213,7 @@ void ShaderGraphView::_create_node(int p_id) {
graph_edit->add_child(gn);
node_map[p_id]=gn;
gn->set_offset(graph->node_get_pos(type,p_id));
- print_line("NODE "+itos(p_id)+" OFS "+gn->get_offset());
+
}
@@ -1180,7 +1236,7 @@ void ShaderGraphView::_update_graph() {
List<int> nl;
graph->get_node_list(type,&nl);
- print_line("graph nodes: "+itos(nl.size()));
+
for(List<int>::Element *E=nl.front();E;E=E->next()) {
_create_node(E->get());
@@ -1199,11 +1255,29 @@ void ShaderGraphView::_update_graph() {
}
+void ShaderGraphView::_sg_updated() {
+
+ if (!graph.is_valid())
+ return;
+ switch(graph->get_graph_error(type)) {
+ case ShaderGraph::GRAPH_OK: status->set_text(""); break;
+ case ShaderGraph::GRAPH_ERROR_CYCLIC: status->set_text("Error: Cyclic Connection Link"); break;
+ case ShaderGraph::GRAPH_ERROR_MISSING_CONNECTIONS: status->set_text("Error: Missing Input Connections"); break;
+ }
+}
+
void ShaderGraphView::set_graph(Ref<ShaderGraph> p_graph){
- print_line("GRAPH EDIT: "+itos(p_graph.is_valid()));
+
+ if (graph.is_valid()) {
+ graph->disconnect("updated",this,"_sg_updated");
+ }
graph=p_graph;
+ if (graph.is_valid()) {
+ graph->connect("updated",this,"_sg_updated");
+ }
_update_graph();
+ _sg_updated();
}
@@ -1262,6 +1336,7 @@ void ShaderGraphView::_bind_methods() {
ObjectTypeDB::bind_method("_move_node",&ShaderGraphView::_move_node);
ObjectTypeDB::bind_method("_node_removed",&ShaderGraphView::_node_removed);
ObjectTypeDB::bind_method("_connection_request",&ShaderGraphView::_connection_request);
+ ObjectTypeDB::bind_method("_disconnection_request",&ShaderGraphView::_disconnection_request);
ObjectTypeDB::bind_method("_scalar_const_changed",&ShaderGraphView::_scalar_const_changed);
ObjectTypeDB::bind_method("_vec_const_changed",&ShaderGraphView::_vec_const_changed);
@@ -1286,6 +1361,7 @@ void ShaderGraphView::_bind_methods() {
ObjectTypeDB::bind_method("_cube_edited",&ShaderGraphView::_cube_edited);
ObjectTypeDB::bind_method("_comment_edited",&ShaderGraphView::_comment_edited);
+ ObjectTypeDB::bind_method("_sg_updated",&ShaderGraphView::_sg_updated);
}
ShaderGraphView::ShaderGraphView(ShaderGraph::ShaderType p_type) {
@@ -1295,8 +1371,15 @@ ShaderGraphView::ShaderGraphView(ShaderGraph::ShaderType p_type) {
block_update=false;
ped_popup = memnew( CustomPropertyEditor );
graph_edit->add_child(ped_popup);
-
-
+ status = memnew( Label );
+ graph_edit->get_top_layer()->add_child(status);
+ status->set_pos(Vector2(5,5));
+ status->add_color_override("font_color_shadow",Color(0,0,0));
+ status->add_color_override("font_color",Color(1,0.4,0.3));
+ status->add_constant_override("shadow_as_outline",1);
+ status->add_constant_override("shadow_offset_x",2);
+ status->add_constant_override("shadow_offset_y",2);
+ status->set_text("");
}
@@ -1318,6 +1401,22 @@ void ShaderGraphEditor::_add_node(int p_type) {
void ShaderGraphEditor::_notification(int p_what) {
if (p_what==NOTIFICATION_ENTER_TREE) {
+
+ for(int i=0;i<ShaderGraph::NODE_TYPE_MAX;i++) {
+
+ if (i==ShaderGraph::NODE_OUTPUT)
+ continue;
+ String nn = node_names[i];
+ String ic = nn.get_slice(":",0);
+ String v = nn.get_slice(":",1);
+ bool addsep=false;
+ if (nn.ends_with(":")) {
+ addsep=true;
+ }
+ menu->get_popup()->add_icon_item(get_icon(ic,"EditorIcons"),v,i);
+ if (addsep)
+ menu->get_popup()->add_separator();
+ }
menu->get_popup()->connect("item_pressed",this,"_add_node");
@@ -1332,38 +1431,38 @@ void ShaderGraphEditor::_bind_methods() {
const char* ShaderGraphEditor::node_names[ShaderGraph::NODE_TYPE_MAX]={
- "Input", // all inputs (shader type dependent)
- "Scalar Constant", //scalar constant
- "Vector Constant", //vec3 constant
- "RGB Constant", //rgb constant (shows a color picker instead)
- "XForm Constant", // 4x4 matrix constant
- "Time:", // time in seconds
- "Screen Sample", // screen texture sampler (takes uv) (only usable in fragment shader)
- "Scalar Operator", // scalar vs scalar op (mul", add", div", etc)
- "Vector Operator", // vec3 vs vec3 op (mul",ad",div",crossprod",etc)
- "Scalar+Vector Operator", // vec3 vs scalar op (mul", add", div", etc)
- "RGB Operator:", // vec3 vs vec3 rgb op (with scalar amount)", like brighten", darken", burn", dodge", multiply", etc.
- "XForm Multiply", // mat4 x mat4
- "XForm+Vector Multiply", // mat4 x vec3 mult (with no-translation option)
- "XForm+Vector InvMultiply:", // mat4 x vec3 inverse mult (with no-translation option)
- "Scalar Function", // scalar function (sin", cos", etc)
- "Vector Function", // vector function (normalize", negate", reciprocal", rgb2hsv", hsv2rgb", etc", etc)
- "Vector Length", // vec3 length
- "Dot Product:", // vec3 . vec3 (dot product -> scalar output)
- "Vector -> Scalars", // 1 vec3 input", 3 scalar outputs
- "Scalars -> Vector", // 3 scalar input", 1 vec3 output
- "XForm -> Vectors", // 3 vec input", 1 xform output
- "Vectors -> XForm:", // 3 vec input", 1 xform output
- "Scalar Interpolate", // scalar interpolation (with optional curve)
- "Vector Interpolate:", // vec3 interpolation (with optional curve)
- "Scalar Uniform", // scalar uniform (assignable in material)
- "Vector Uniform", // vec3 uniform (assignable in material)
- "RGB Uniform", // color uniform (assignable in material)
- "XForm Uniform", // mat4 uniform (assignable in material)
- "Texture Uniform", // texture input (assignable in material)
- "CubeMap Uniform:", // cubemap input (assignable in material)
+ "GraphInput:Input", // all inputs (shader type dependent)
+ "GraphScalar:Scalar Constant", //scalar constant
+ "GraphVector:Vector Constant", //vec3 constant
+ "GraphRgb:RGB Constant", //rgb constant (shows a color picker instead)
+ "GraphXform:XForm Constant", // 4x4 matrix constant
+ "GraphTime:Time:", // time in seconds
+ "GraphTexscreen:Screen Sample", // screen texture sampler (takes uv) (only usable in fragment shader)
+ "GraphScalarOp:Scalar Operator", // scalar vs scalar op (mul", add", div", etc)
+ "GraphVecOp:Vector Operator", // vec3 vs vec3 op (mul",ad",div",crossprod",etc)
+ "GraphVecScalarOp:Scalar+Vector Operator", // vec3 vs scalar op (mul", add", div", etc)
+ "GraphRgbOp:RGB Operator:", // vec3 vs vec3 rgb op (with scalar amount)", like brighten", darken", burn", dodge", multiply", etc.
+ "GraphXformMult:XForm Multiply", // mat4 x mat4
+ "GraphXformVecMult:XForm+Vector Multiply", // mat4 x vec3 mult (with no-translation option)
+ "GraphXformVecImult:Form+Vector InvMultiply:", // mat4 x vec3 inverse mult (with no-translation option)
+ "GraphXformScalarFunc:Scalar Function", // scalar function (sin", cos", etc)
+ "GraphXformVecFunc:Vector Function", // vector function (normalize", negate", reciprocal", rgb2hsv", hsv2rgb", etc", etc)
+ "GraphVecLength:Vector Length", // vec3 length
+ "GraphVecDp:Dot Product:", // vec3 . vec3 (dot product -> scalar output)
+ "GraphVecToScalars:Vector -> Scalars", // 1 vec3 input", 3 scalar outputs
+ "GraphScalarsToVec:Scalars -> Vector", // 3 scalar input", 1 vec3 output
+ "GraphXformToVecs:XForm -> Vectors", // 3 vec input", 1 xform output
+ "GraphVecsToXform:Vectors -> XForm:", // 3 vec input", 1 xform output
+ "GraphScalarInterp:Scalar Interpolate", // scalar interpolation (with optional curve)
+ "GraphVecInterp:Vector Interpolate:", // vec3 interpolation (with optional curve)
+ "GraphScalarUniform:Scalar Uniform", // scalar uniform (assignable in material)
+ "GraphVectorUniform:Vector Uniform", // vec3 uniform (assignable in material)
+ "GraphRgbUniform:RGB Uniform", // color uniform (assignable in material)
+ "GraphXformUniform:XForm Uniform", // mat4 uniform (assignable in material)
+ "GraphTextureUniform:Texture Uniform", // texture input (assignable in material)
+ "GraphCubeUniform:CubeMap Uniform:", // cubemap input (assignable in material)
"Output", // output (shader type dependent)
- "Comment", // comment
+ "GraphComment:Comment", // comment
};
@@ -1371,23 +1470,10 @@ ShaderGraphEditor::ShaderGraphEditor() {
HBoxContainer *hbc = memnew( HBoxContainer );
menu = memnew( MenuButton );
- menu->set_text("Add..");
+ menu->set_text("Add Node..");
hbc->add_child(menu);
add_child(hbc);
- for(int i=0;i<ShaderGraph::NODE_TYPE_MAX;i++) {
-
- if (i==ShaderGraph::NODE_OUTPUT)
- continue;
- String v = node_names[i];
- bool addsep=false;
- if (v.ends_with(":")) {
- addsep=true;
- v=v.substr(0,v.length()-1);
- }
- menu->get_popup()->add_item(v,i);
- if (addsep)
- menu->get_popup()->add_separator();
- }
+
tabs = memnew(TabContainer);
tabs->set_v_size_flags(SIZE_EXPAND_FILL);
@@ -1404,8 +1490,13 @@ ShaderGraphEditor::ShaderGraphEditor() {
graph_edits[i]->get_graph_edit()->set_name(sname[i]);
tabs->add_child(graph_edits[i]->get_graph_edit());
graph_edits[i]->get_graph_edit()->connect("connection_request",graph_edits[i],"_connection_request");
+ graph_edits[i]->get_graph_edit()->connect("disconnection_request",graph_edits[i],"_disconnection_request");
+ graph_edits[i]->get_graph_edit()->set_right_disconnects(true);
+
}
+ tabs->set_current_tab(1);
+
set_custom_minimum_size(Size2(100,300));
}
diff --git a/tools/editor/plugins/shader_graph_editor_plugin.h b/tools/editor/plugins/shader_graph_editor_plugin.h
index 26dbd1ac6e..bd983c59be 100644
--- a/tools/editor/plugins/shader_graph_editor_plugin.h
+++ b/tools/editor/plugins/shader_graph_editor_plugin.h
@@ -54,6 +54,7 @@ class ShaderGraphView : public Node {
CustomPropertyEditor *ped_popup;
bool block_update;
+ Label *status;
GraphEdit *graph_edit;
Ref<ShaderGraph> graph;
int edited_id;
@@ -66,6 +67,8 @@ class ShaderGraphView : public Node {
void _connection_request(const String& p_from, int p_from_slot,const String& p_to,int p_to_slot);
+ void _disconnection_request(const String& p_from, int p_from_slot,const String& p_to,int p_to_slot);
+
void _node_removed(int p_id);
void _node_moved(const Vector2& p_from, const Vector2& p_to,int p_id);
void _move_node(int p_id,const Vector2& p_to);
@@ -93,7 +96,7 @@ class ShaderGraphView : public Node {
void _variant_edited();
void _comment_edited(int p_id,Node* p_button);
-
+ void _sg_updated();
Map<int,GraphNode*> node_map;
protected:
void _notification(int p_what);
diff --git a/tools/editor/plugins/spatial_editor_plugin.cpp b/tools/editor/plugins/spatial_editor_plugin.cpp
index 0960a961ec..87bd8105af 100644
--- a/tools/editor/plugins/spatial_editor_plugin.cpp
+++ b/tools/editor/plugins/spatial_editor_plugin.cpp
@@ -3650,12 +3650,12 @@ SpatialEditor::SpatialEditor(EditorNode *p_editor) {
p->add_check_item("Use Default sRGB",MENU_VIEW_USE_DEFAULT_SRGB);
p->add_separator();
- p->add_check_item("1 Viewport",MENU_VIEW_USE_1_VIEWPORT,KEY_MASK_ALT+KEY_1);
- p->add_check_item("2 Viewports",MENU_VIEW_USE_2_VIEWPORTS,KEY_MASK_ALT+KEY_2);
- p->add_check_item("2 Viewports (Alt)",MENU_VIEW_USE_2_VIEWPORTS_ALT,KEY_MASK_SHIFT+KEY_MASK_ALT+KEY_2);
- p->add_check_item("3 Viewports",MENU_VIEW_USE_3_VIEWPORTS,KEY_MASK_ALT+KEY_3);
- p->add_check_item("3 Viewports (Alt)",MENU_VIEW_USE_3_VIEWPORTS_ALT,KEY_MASK_SHIFT+KEY_MASK_ALT+KEY_3);
- p->add_check_item("4 Viewports",MENU_VIEW_USE_4_VIEWPORTS,KEY_MASK_ALT+KEY_4);
+ p->add_check_item("1 Viewport",MENU_VIEW_USE_1_VIEWPORT,KEY_MASK_CMD+KEY_1);
+ p->add_check_item("2 Viewports",MENU_VIEW_USE_2_VIEWPORTS,KEY_MASK_CMD+KEY_2);
+ p->add_check_item("2 Viewports (Alt)",MENU_VIEW_USE_2_VIEWPORTS_ALT,KEY_MASK_SHIFT+KEY_MASK_CMD+KEY_2);
+ p->add_check_item("3 Viewports",MENU_VIEW_USE_3_VIEWPORTS,KEY_MASK_CMD+KEY_3);
+ p->add_check_item("3 Viewports (Alt)",MENU_VIEW_USE_3_VIEWPORTS_ALT,KEY_MASK_SHIFT+KEY_MASK_CMD+KEY_3);
+ p->add_check_item("4 Viewports",MENU_VIEW_USE_4_VIEWPORTS,KEY_MASK_CMD+KEY_4);
p->add_separator();
p->add_check_item("Display Normal",MENU_VIEW_DISPLAY_NORMAL);
diff --git a/tools/editor/project_manager.cpp b/tools/editor/project_manager.cpp
index cf94758ad6..0af4a23547 100644
--- a/tools/editor/project_manager.cpp
+++ b/tools/editor/project_manager.cpp
@@ -65,7 +65,7 @@ class NewProjectDialog : public ConfirmationDialog {
error->set_text("");
get_ok()->set_disabled(true);
DirAccess *d = DirAccess::create(DirAccess::ACCESS_FILESYSTEM);
- if (d->change_dir(project_path->get_text())!=OK) {
+ if (project_path->get_text() != "" && d->change_dir(project_path->get_text())!=OK) {
error->set_text("Invalid Path for Project, Path Must Exist!");
memdelete(d);
return false;
@@ -82,7 +82,7 @@ class NewProjectDialog : public ConfirmationDialog {
} else {
- if (!d->file_exists("engine.cfg")) {
+ if (project_path->get_text() != "" && !d->file_exists("engine.cfg")) {
error->set_text("Invalid Project Path (engine.cfg must exist).");
memdelete(d);
diff --git a/tools/editor/script_editor_debugger.cpp b/tools/editor/script_editor_debugger.cpp
index 024377ad18..5043c5cdcd 100644
--- a/tools/editor/script_editor_debugger.cpp
+++ b/tools/editor/script_editor_debugger.cpp
@@ -478,8 +478,6 @@ void ScriptEditorDebugger::_notification(int p_what) {
if (!connection->is_connected()) {
stop();
editor->notify_child_process_exited(); //somehow, exited
- msgdialog->set_text("Process being debugged exited.");
- msgdialog->popup_centered(Size2(250,100));
break;
};
diff --git a/tools/export/blender25/godot_export_manager.py b/tools/export/blender25/godot_export_manager.py
new file mode 100644
index 0000000000..a5df60e47d
--- /dev/null
+++ b/tools/export/blender25/godot_export_manager.py
@@ -0,0 +1,439 @@
+# ##### BEGIN GPL LICENSE BLOCK #####
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+# Script copyright (c) Andreas Esau
+
+bl_info = {
+ "name": "Godot Export Manager",
+ "author": "Andreas Esau",
+ "version": (1, 0),
+ "blender": (2, 7, 0),
+ "location": "Scene Properties > Godot Export Manager",
+ "description": "Godot Export Manager uses the Better Collada Exporter to manage Export Groups and automatically export the objects groups to Collada Files.",
+ "warning": "",
+ "wiki_url": ("http://www.godotengine.org"),
+ "tracker_url": "",
+ "category": "Import-Export"}
+
+import bpy
+from bpy.props import StringProperty, BoolProperty, EnumProperty, FloatProperty, FloatVectorProperty, IntProperty, CollectionProperty, PointerProperty
+import os
+from bpy.app.handlers import persistent
+from mathutils import Vector, Matrix
+
+class godot_export_manager(bpy.types.Panel):
+ bl_label = "Godot Export Manager"
+ bl_space_type = 'PROPERTIES'
+ bl_region_type = 'WINDOW'
+ bl_context = "scene"
+
+ bpy.types.Scene.godot_export_on_save = BoolProperty(default=False)
+
+ ### draw function for all ui elements
+ def draw(self, context):
+ layout = self.layout
+ split = self.layout.split()
+ scene = bpy.data.scenes[0]
+ ob = context.object
+ scene = context.scene
+
+ row = layout.row()
+ col = row.column()
+ col.prop(scene,"godot_export_on_save",text="Export Groups on save")
+
+ row = layout.row()
+ col = row.column(align=True)
+ op = col.operator("scene.godot_add_objects_to_group",text="Add selected objects to Group",icon="COPYDOWN")
+
+ op = col.operator("scene.godot_delete_objects_from_group",text="Delete selected objects from Group",icon="PASTEDOWN")
+
+
+
+ row = layout.row()
+ col = row.column()
+ col.label(text="Export Groups:")
+
+
+ row = layout.row()
+ col = row.column()
+
+ col.template_list("UI_List_Godot","dummy",scene, "godot_export_groups", scene, "godot_export_groups_index",rows=1,maxrows=10,type='DEFAULT')
+
+ col = row.column(align=True)
+ col.operator("scene.godot_add_export_group",text="",icon="ZOOMIN")
+ col.operator("scene.godot_delete_export_group",text="",icon="ZOOMOUT")
+ col.operator("scene.godot_export_all_groups",text="",icon="EXPORT")
+
+ if len(scene.godot_export_groups) > 0:
+ row = layout.row()
+ col = row.column()
+ group = scene.godot_export_groups[scene.godot_export_groups_index]
+ col.prop(group,"name",text="Group Name")
+ col.prop(group,"export_name",text="Export Name")
+ col.prop(group,"export_path",text="Export Filepath")
+
+ row = layout.row()
+ col = row.column()
+ row = layout.row()
+ col = row.column()
+ col.label(text="Export Settings:")
+
+ col = col.row(align=True)
+ col.prop(group,"apply_loc",toggle=True,icon="MAN_TRANS")
+ col.prop(group,"apply_rot",toggle=True,icon="MAN_ROT")
+ col.prop(group,"apply_scale",toggle=True,icon="MAN_SCALE")
+
+ row = layout.row()
+ col = row.column()
+
+ col.prop(group,"use_mesh_modifiers")
+ col.prop(group,"use_tangent_arrays")
+ col.prop(group,"use_triangles")
+ col.prop(group,"use_copy_images")
+ col.prop(group,"use_active_layers")
+ col.prop(group,"use_exclude_ctrl_bones")
+ col.prop(group,"use_anim")
+ col.prop(group,"use_anim_action_all")
+ col.prop(group,"use_anim_skip_noexp")
+ col.prop(group,"use_anim_optimize")
+ col.prop(group,"anim_optimize_precision")
+ col.prop(group,"use_metadata")
+
+### Custom template_list look
+class UI_List_Godot(bpy.types.UIList):
+ def draw_item(self, context, layout, data, item, icon, active_data, active_propname, index):
+ ob = data
+ slot = item
+ col = layout.row(align=True)
+
+ col.label(text=item.name,icon="GROUP")
+ col.prop(item,"active",text="")
+
+ op = col.operator("scene.godot_select_group_objects",text="",emboss=False,icon="RESTRICT_SELECT_OFF")
+ op.idx = index
+ op = col.operator("scene.godot_export_group",text="",emboss=False,icon="EXPORT")
+ op.idx = index
+
+class add_objects_to_group(bpy.types.Operator):
+ bl_idname = "scene.godot_add_objects_to_group"
+ bl_label = "Add Objects to Group"
+ bl_description = "Adds the selected Objects to the active group below."
+
+ def execute(self,context):
+ scene = context.scene
+
+ objects_str = ""
+ if len(scene.godot_export_groups) > 0:
+ for i,object in enumerate(context.selected_objects):
+ if object.name not in scene.godot_export_groups[scene.godot_export_groups_index].nodes:
+ node = scene.godot_export_groups[scene.godot_export_groups_index].nodes.add()
+ node.name = object.name
+ if i == 0:
+ objects_str += object.name
+ else:
+ objects_str += ", "+object.name
+
+
+ self.report({'INFO'}, objects_str + " added to group." )
+ bpy.ops.ed.undo_push(message="Objects added to group")
+ else:
+ self.report({'WARNING'}, "Create a group first." )
+ return{'FINISHED'}
+
+class del_objects_from_group(bpy.types.Operator):
+ bl_idname = "scene.godot_delete_objects_from_group"
+ bl_label = "Delete Objects from Group"
+ bl_description = "Delets the selected Objects from the active group below."
+
+ def execute(self,context):
+ scene = context.scene
+
+ if len(scene.godot_export_groups) > 0:
+
+ selected_objects = []
+ for object in context.selected_objects:
+ selected_objects.append(object.name)
+
+ objects_str = ""
+ j = 0
+ for i,node in enumerate(scene.godot_export_groups[scene.godot_export_groups_index].nodes):
+ if node.name in selected_objects:
+ scene.godot_export_groups[scene.godot_export_groups_index].nodes.remove(i)
+
+
+ if j == 0:
+ objects_str += object.name
+ else:
+ objects_str += ", "+object.name
+ j+=1
+
+
+ self.report({'INFO'}, objects_str + " deleted from group." )
+ bpy.ops.ed.undo_push(message="Objects deleted from group")
+ else:
+ self.report({'WARNING'}, "There is no group to delete from." )
+ return{'FINISHED'}
+
+class select_group_objects(bpy.types.Operator):
+ bl_idname = "scene.godot_select_group_objects"
+ bl_label = "Select Group Objects"
+ bl_description = "Will select all group Objects in the scene."
+
+ idx = IntProperty()
+
+ def execute(self,context):
+ scene = context.scene
+ for object in context.scene.objects:
+ object.select = False
+ for node in scene.godot_export_groups[self.idx].nodes:
+ if node.name in bpy.data.objects:
+ bpy.data.objects[node.name].select = True
+ context.scene.objects.active = bpy.data.objects[node.name]
+ return{'FINISHED'}
+
+class export_groups_autosave(bpy.types.Operator):
+ bl_idname = "scene.godot_export_groups_autosave"
+ bl_label = "Export All Groups"
+ bl_description = "Exports all groups to Collada."
+
+ def execute(self,context):
+ scene = context.scene
+ if scene.godot_export_on_save:
+ for i in range(len(scene.godot_export_groups)):
+ if scene.godot_export_groups[i].active:
+ bpy.ops.scene.godot_export_group(idx=i)
+ self.report({'INFO'}, "All Groups exported." )
+ bpy.ops.ed.undo_push(message="Export all Groups")
+ return{'FINISHED'}
+
+class export_all_groups(bpy.types.Operator):
+ bl_idname = "scene.godot_export_all_groups"
+ bl_label = "Export All Groups"
+ bl_description = "Exports all groups to Collada."
+
+ def execute(self,context):
+ scene = context.scene
+ for i in range(len(scene.godot_export_groups)):
+ if scene.godot_export_groups[i].active:
+ bpy.ops.scene.godot_export_group(idx=i)
+ self.report({'INFO'}, "All Groups exported." )
+ bpy.ops.ed.undo_push(message="Export all Groups")
+ return{'FINISHED'}
+
+
+class export_group(bpy.types.Operator):
+ bl_idname = "scene.godot_export_group"
+ bl_label = "Export Group"
+ bl_description = "Exports the active group to destination folder as Collada file."
+
+ idx = IntProperty(default=0)
+
+ def copy_object_recursive(self,ob,parent,single_user = True):
+ new_ob = bpy.data.objects[ob.name].copy()
+ if single_user or ob.type=="ARMATURE":
+ new_mesh_data = new_ob.data.copy()
+ new_ob.data = new_mesh_data
+ bpy.context.scene.objects.link(new_ob)
+
+ if ob != parent:
+ new_ob.parent = parent
+ else:
+ new_ob.parent = None
+
+ for child in ob.children:
+ self.copy_object_recursive(child,new_ob,single_user)
+ new_ob.select = True
+ return new_ob
+
+ def delete_object(self,ob):
+ if ob != None:
+ for child in ob.children:
+ self.delete_object(child)
+ bpy.context.scene.objects.unlink(ob)
+ bpy.data.objects.remove(ob)
+
+ def convert_group_to_node(self,group):
+ if group.dupli_group != None:
+ for object in group.dupli_group.objects:
+ if object.parent == None:
+ object = self.copy_object_recursive(object,object,True)
+ matrix = Matrix(object.matrix_local)
+ object.matrix_local = Matrix()
+ object.matrix_local *= group.matrix_local
+ object.matrix_local *= matrix
+
+ self.delete_object(group)
+
+ def execute(self,context):
+ scene = context.scene
+ group = context.scene.godot_export_groups
+
+ path = group[self.idx].export_path
+ if (path.find("//")==0 or path.find("\\\\")==0):
+ #if relative, convert to absolute
+ path = bpy.path.abspath(path)
+ path = path.replace("\\","/")
+
+ ### if path exists and group export name is set the group will be exported
+ if os.path.exists(path) and group[self.idx].export_name != "":
+
+ context.scene.layers = [True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True]
+
+
+ if group[self.idx].export_name.endswith(".dae"):
+ path = os.path.join(path,group[self.idx].export_name)
+ else:
+ path = os.path.join(path,group[self.idx].export_name+".dae")
+
+ hide_select = []
+ for object in context.scene.objects:
+ hide_select.append(object.hide_select)
+ object.hide_select = False
+ object.select = False
+ context.scene.objects.active = None
+
+ for i,object in enumerate(group[self.idx].nodes):
+
+ if object.name in bpy.data.objects:
+ if bpy.data.objects[object.name].type == "EMPTY":
+ self.convert_group_to_node(bpy.data.objects[object.name])
+ else:
+ bpy.data.objects[object.name].select = True
+
+ else: # if object is not in the scene anymore it will be removed from the group
+ group[self.idx].nodes.remove(i)
+ bpy.ops.object.transform_apply(location=group[self.idx].apply_loc, rotation=group[self.idx].apply_rot, scale=group[self.idx].apply_scale)
+ bpy.ops.export_scene.dae(check_existing=True, filepath=path, filter_glob="*.dae", object_types=group[self.idx].object_types, use_export_selected=group[self.idx].use_export_selected, use_mesh_modifiers=group[self.idx].use_mesh_modifiers, use_tangent_arrays=group[self.idx].use_tangent_arrays, use_triangles=group[self.idx].use_triangles, use_copy_images=group[self.idx].use_copy_images, use_active_layers=group[self.idx].use_active_layers, use_exclude_ctrl_bones=group[self.idx].use_exclude_ctrl_bones, use_anim=group[self.idx].use_anim, use_anim_action_all=group[self.idx].use_anim_action_all, use_anim_skip_noexp=group[self.idx].use_anim_skip_noexp, use_anim_optimize=group[self.idx].use_anim_optimize, anim_optimize_precision=group[self.idx].anim_optimize_precision, use_metadata=group[self.idx].use_metadata)
+
+
+ self.report({'INFO'}, '"'+group[self.idx].name+'"' + " Group exported." )
+ msg = "Export Group "+group[self.idx].name
+ bpy.ops.ed.undo_push(message="")
+ bpy.ops.ed.undo()
+ bpy.ops.ed.undo_push(message=msg)
+ else:
+ self.report({'INFO'}, "Define Export Name and Export Path." )
+ return{'FINISHED'}
+
+class add_export_group(bpy.types.Operator):
+ bl_idname = "scene.godot_add_export_group"
+ bl_label = "Adds a new export Group"
+ bl_description = "Creates a new Export Group with the selected Objects assigned to it."
+
+ def execute(self,context):
+ scene = context.scene
+
+ item = scene.godot_export_groups.add()
+ item.name = "New Group"
+ for object in context.selected_objects:
+ node = item.nodes.add()
+ node.name = object.name
+ scene.godot_export_groups_index = len(scene.godot_export_groups)-1
+ bpy.ops.ed.undo_push(message="Create New Export Group")
+ return{'FINISHED'}
+
+class del_export_group(bpy.types.Operator):
+ bl_idname = "scene.godot_delete_export_group"
+ bl_label = "Delets the selected export Group"
+ bl_description = "Delets the active Export Group."
+
+ def invoke(self, context, event):
+ wm = context.window_manager
+ return wm.invoke_confirm(self,event)
+
+ def execute(self,context):
+ scene = context.scene
+
+ scene.godot_export_groups.remove(scene.godot_export_groups_index)
+ if scene.godot_export_groups_index > 0:
+ scene.godot_export_groups_index -= 1
+ bpy.ops.ed.undo_push(message="Delete Export Group")
+ return{'FINISHED'}
+
+class godot_node_list(bpy.types.PropertyGroup):
+ name = StringProperty()
+
+class godot_export_groups(bpy.types.PropertyGroup):
+ name = StringProperty(name="Group Name")
+ export_name = StringProperty(name="scene_name")
+ nodes = CollectionProperty(type=godot_node_list)
+ export_path = StringProperty(subtype="DIR_PATH")
+ active = BoolProperty(default=True,description="Export Group")
+
+ object_types = EnumProperty(name="Object Types",options={'ENUM_FLAG'},items=(('EMPTY', "Empty", ""),('CAMERA', "Camera", ""),('LAMP', "Lamp", ""),('ARMATURE', "Armature", ""),('MESH', "Mesh", ""),('CURVE', "Curve", ""),),default={'EMPTY', 'CAMERA', 'LAMP', 'ARMATURE', 'MESH','CURVE'})
+
+ apply_scale = BoolProperty(name="Apply Scale",description="Apply Scale before export.",default=False)
+ apply_rot = BoolProperty(name="Apply Rotation",description="Apply Rotation before export.",default=False)
+ apply_loc = BoolProperty(name="Apply Location",description="Apply Location before export.",default=False)
+
+ use_export_selected = BoolProperty(name="Selected Objects",description="Export only selected objects (and visible in active layers if that applies).",default=True)
+ use_mesh_modifiers = BoolProperty(name="Apply Modifiers",description="Apply modifiers to mesh objects (on a copy!).",default=True)
+ use_tangent_arrays = BoolProperty(name="Tangent Arrays",description="Export Tangent and Binormal arrays (for normalmapping).",default=False)
+ use_triangles = BoolProperty(name="Triangulate",description="Export Triangles instead of Polygons.",default=False)
+
+ use_copy_images = BoolProperty(name="Copy Images",description="Copy Images (create images/ subfolder)",default=False)
+ use_active_layers = BoolProperty(name="Active Layers",description="Export only objects on the active layers.",default=True)
+ use_exclude_ctrl_bones = BoolProperty(name="Exclude Control Bones",description="Exclude skeleton bones with names that begin with 'ctrl'.",default=True)
+ use_anim = BoolProperty(name="Export Animation",description="Export keyframe animation",default=False)
+ use_anim_action_all = BoolProperty(name="All Actions",description=("Export all actions for the first armature found in separate DAE files"),default=False)
+ use_anim_skip_noexp = BoolProperty(name="Skip (-noexp) Actions",description="Skip exporting of actions whose name end in (-noexp). Useful to skip control animations.",default=True)
+ use_anim_optimize = BoolProperty(name="Optimize Keyframes",description="Remove double keyframes",default=True)
+
+ anim_optimize_precision = FloatProperty(name="Precision",description=("Tolerence for comparing double keyframes (higher for greater accuracy)"),min=1, max=16,soft_min=1, soft_max=16,default=6.0)
+
+ use_metadata = BoolProperty(name="Use Metadata",default=True,options={'HIDDEN'})
+
+def register():
+ bpy.utils.register_class(godot_export_manager)
+ bpy.utils.register_class(godot_node_list)
+ bpy.utils.register_class(godot_export_groups)
+ bpy.utils.register_class(add_export_group)
+ bpy.utils.register_class(del_export_group)
+ bpy.utils.register_class(export_all_groups)
+ bpy.utils.register_class(export_groups_autosave)
+ bpy.utils.register_class(export_group)
+ bpy.utils.register_class(add_objects_to_group)
+ bpy.utils.register_class(del_objects_from_group)
+ bpy.utils.register_class(select_group_objects)
+ bpy.utils.register_class(UI_List_Godot)
+
+ bpy.types.Scene.godot_export_groups = CollectionProperty(type=godot_export_groups)
+ bpy.types.Scene.godot_export_groups_index = IntProperty(default=0,min=0)
+
+def unregister():
+ bpy.utils.unregister_class(godot_export_manager)
+ bpy.utils.unregister_class(godot_node_list)
+ bpy.utils.unregister_class(godot_export_groups)
+ bpy.utils.unregister_class(export_groups_autosave)
+ bpy.utils.unregister_class(add_export_group)
+ bpy.utils.unregister_class(del_export_group)
+ bpy.utils.unregister_class(export_all_groups)
+ bpy.utils.unregister_class(export_group)
+ bpy.utils.unregister_class(add_objects_to_group)
+ bpy.utils.unregister_class(del_objects_from_group)
+ bpy.utils.unlregister_class(select_group_objects)
+ bpy.utils.unregister_class(UI_List_Godot)
+
+@persistent
+def auto_export(dummy):
+ bpy.ops.scene.godot_export_groups_autosave()
+
+bpy.app.handlers.save_post.append(auto_export)
+
+if __name__ == "__main__":
+ register()
diff --git a/tools/export/blender25/io_scene_dae/export_dae.py b/tools/export/blender25/io_scene_dae/export_dae.py
index 4e1635429b..8161f05bf8 100644
--- a/tools/export/blender25/io_scene_dae/export_dae.py
+++ b/tools/export/blender25/io_scene_dae/export_dae.py
@@ -162,37 +162,61 @@ class DaeExporter:
def export_image(self,image):
-
if (image in self.image_cache):
return self.image_cache[image]
-
+
imgpath = image.filepath
if (imgpath.find("//")==0 or imgpath.find("\\\\")==0):
#if relative, convert to absolute
imgpath = bpy.path.abspath(imgpath)
#path is absolute, now do something!
-
+
if (self.config["use_copy_images"]):
#copy image
basedir = os.path.dirname(self.path)+"/images"
if (not os.path.isdir(basedir)):
os.makedirs(basedir)
- dstfile=basedir+"/"+os.path.basename(imgpath)
- if (not os.path.isfile(dstfile)):
- shutil.copy(imgpath,dstfile)
- imgpath="images/"+os.path.basename(imgpath)
+
+ if os.path.isfile(imgpath):
+ dstfile=basedir+"/"+os.path.basename(imgpath)
+
+ if (not os.path.isfile(dstfile)):
+ shutil.copy(imgpath,dstfile)
+ imgpath="images/"+os.path.basename(imgpath)
+ else:
+ ### if file is not found save it as png file in the destination folder
+ img_tmp_path = image.filepath
+ if img_tmp_path.endswith((".bmp",".rgb",".png",".jpeg",".jpg",".jp2",".tga",".cin",".dpx",".exr",".hdr",".tif")):
+ image.filepath = basedir+"/"+os.path.basename(img_tmp_path)
+ else:
+ image.filepath = basedir+"/"+image.name+".png"
+
+ dstfile=basedir+"/"+os.path.basename(image.filepath)
+
+ if (not os.path.isfile(dstfile)):
+
+ image.save()
+ imgpath="images/"+os.path.basename(image.filepath)
+ image.filepath = img_tmp_path
else:
#export relative, always, no one wants absolute paths.
try:
imgpath = os.path.relpath(imgpath,os.path.dirname(self.path)).replace("\\","/") # export unix compatible always
+
except:
pass #fails sometimes, not sure why
-
-
+
imgid = self.new_id("image")
+
+ if (not os.path.isfile(imgpath)):
+ if img_tmp_path.endswith((".bmp",".rgb",".png",".jpeg",".jpg",".jp2",".tga",".cin",".dpx",".exr",".hdr",".tif")):
+ imgpath="images/"+os.path.basename(img_tmp_path)
+ else:
+ imgpath="images/"+image.name+".png"
+
self.writel(S_IMGS,1,'<image id="'+imgid+'" name="'+image.name+'">')
self.writel(S_IMGS,2,'<init_from>'+imgpath+'</init_from>"/>')
self.writel(S_IMGS,1,'</image>')
@@ -1176,6 +1200,7 @@ class DaeExporter:
def export_node(self,node,il):
if (not node in self.valid_nodes):
return
+ prev_node = bpy.context.scene.objects.active
bpy.context.scene.objects.active = node
self.writel(S_NODES,il,'<node id="'+self.validate_id(node.name)+'" name="'+node.name+'" type="NODE">')
@@ -1199,6 +1224,7 @@ class DaeExporter:
il-=1
self.writel(S_NODES,il,'</node>')
+ bpy.context.scene.objects.active = prev_node #make previous node active again
def is_node_valid(self,node):
if (not node.type in self.config["object_types"]):
@@ -1441,12 +1467,13 @@ 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
+ tmp_mat = []
+ for s in self.skeletons:
+ tmp_bone_mat = []
+ for bone in s.pose.bones:
+ tmp_bone_mat.append(Matrix(bone.matrix_basis))
+ bone.matrix_basis = Matrix()
+ tmp_mat.append([Matrix(s.matrix_local),tmp_bone_mat])
self.writel(S_ANIM,0,'<library_animations>')
@@ -1481,7 +1508,7 @@ class DaeExporter:
bones.append(dp)
allowed_skeletons=[]
- for i,y in enumerate(self.skeletons): # workaround by ndee
+ for i,y in enumerate(self.skeletons):
if (y.animation_data):
for z in y.pose.bones:
if (z.bone.name in bones):
@@ -1489,9 +1516,9 @@ class DaeExporter:
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
+ y.matrix_local = tmp_mat[i][0]
+ for j,bone in enumerate(s.pose.bones):
+ bone.matrix_basis = Matrix()
print("allowed skeletons "+str(allowed_skeletons))
@@ -1511,15 +1538,15 @@ class DaeExporter:
self.writel(S_ANIM_CLIPS,0,'</library_animation_clips>')
- for i,s in enumerate(self.skeletons): # workaround by ndee
+ for i,s in enumerate(self.skeletons):
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.
+ for j,bone in enumerate(s.pose.bones):
+ bone.matrix_basis = tmp_mat[i][1][j]
else:
self.export_animation(self.scene.frame_start,self.scene.frame_end)