From 1a2cb755e2d8b9d59178f36702f6dff7235b9088 Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Tue, 2 Sep 2014 23:13:40 -0300 Subject: 3D Physics and Other Stuff -=-=-=-=-=-=-=-=-=-=-=-=-= -New Vehicle (Based on Bullet's RaycastVehicle) - Vehiclebody/VehicleWheel. Demo will come soon, old vehicle (CarBody) will go away soon too. -A lot of fixes to the 3D physics engine -Added KinematicBody with demo -Fixed the space query API for 2D (demo will come soon). 3D is WIP. -Fixed long-standing bug with body_enter/body_exit for Area and Area2D -Performance variables now includes physics (active bodies, collision pairs and islands) -Ability to see what's inside of instanced scenes! -Fixed Blend Shapes (no bs+skeleton yet) -Added an Android JavaClassWrapper singleton for using Android native classes directly from GDScript. This is very Alpha! --- tools/editor/icons/icon_instance_options.png | Bin 0 -> 523 bytes tools/editor/io_plugins/editor_import_collada.cpp | 9 ++- tools/editor/plugins/baked_light_baker.cpp | 2 +- tools/editor/property_editor.cpp | 18 +++++ tools/editor/scene_tree_dock.cpp | 49 +++++++++++- tools/editor/scene_tree_dock.h | 1 + tools/editor/scene_tree_editor.cpp | 87 ++++++++++++++++++++-- tools/editor/scene_tree_editor.h | 11 +++ tools/editor/spatial_editor_gizmos.cpp | 69 +++++++++++++++++ tools/editor/spatial_editor_gizmos.h | 15 ++++ 10 files changed, 251 insertions(+), 10 deletions(-) create mode 100644 tools/editor/icons/icon_instance_options.png (limited to 'tools/editor') diff --git a/tools/editor/icons/icon_instance_options.png b/tools/editor/icons/icon_instance_options.png new file mode 100644 index 0000000000..2d3e98b2ea Binary files /dev/null and b/tools/editor/icons/icon_instance_options.png differ diff --git a/tools/editor/io_plugins/editor_import_collada.cpp b/tools/editor/io_plugins/editor_import_collada.cpp index 15a671d623..2dce3fa8f5 100644 --- a/tools/editor/io_plugins/editor_import_collada.cpp +++ b/tools/editor/io_plugins/editor_import_collada.cpp @@ -564,6 +564,7 @@ Error ColladaImport::_create_mesh_surfaces(Ref& p_mesh,const Maptargets.has("MORPH_TARGET"), ERR_INVALID_DATA ); String mt = p_morph_data->targets["MORPH_TARGET"]; @@ -1478,8 +1479,11 @@ Error ColladaImport::_create_resources(Collada::Node *p_node) { Transform apply_xform; Vector bone_remap; + print_line("mesh: "+String(mi->get_name())); + if (ng->controller) { + print_line("has controller"); if (collada.state.skin_controller_data_map.has(ng->source)) { @@ -1528,9 +1532,12 @@ Error ColladaImport::_create_resources(Collada::Node *p_node) { bone_remap[i]=bone_remap_map[str]; } } else if (collada.state.morph_controller_data_map.has(ng->source)) { + print_line("is morph "+ng->source); //it's a morph!! - morph = &collada.state.morph_controller_data_map[meshid]; + morph = &collada.state.morph_controller_data_map[ng->source]; meshid=morph->mesh; + printf("KKmorph: %p\n",morph); + print_line("morph mshid: "+meshid); } else { ERR_EXPLAIN("Controller Instance Source '"+ng->source+"' is neither skin or morph!"); ERR_FAIL_V( ERR_INVALID_DATA ); diff --git a/tools/editor/plugins/baked_light_baker.cpp b/tools/editor/plugins/baked_light_baker.cpp index 1574ce81d7..dea83e0ff8 100644 --- a/tools/editor/plugins/baked_light_baker.cpp +++ b/tools/editor/plugins/baked_light_baker.cpp @@ -338,7 +338,7 @@ void BakedLightBaker::_fix_lights() { } if (dl.type==VS::LIGHT_OMNI) { - dl.area=4.0*Math_PI*pow(dl.radius,2.0); + dl.area=4.0*Math_PI*pow(dl.radius,2.0f); dl.constant=1.0/3.5; } else { diff --git a/tools/editor/property_editor.cpp b/tools/editor/property_editor.cpp index 4ac2ff0594..645d967a4b 100644 --- a/tools/editor/property_editor.cpp +++ b/tools/editor/property_editor.cpp @@ -38,6 +38,7 @@ #include "scene/scene_string_names.h" #include "editor_settings.h" #include "editor_import_export.h" +#include "editor_node.h" void CustomPropertyEditor::_notification(int p_what) { @@ -1619,6 +1620,7 @@ CustomPropertyEditor::CustomPropertyEditor() { scene_tree = memnew( SceneTreeDialog ); add_child(scene_tree); scene_tree->connect("selected", this,"_node_path_selected"); + scene_tree->get_tree()->set_show_enabled_subscene(true); texture_preview = memnew( TextureFrame ); add_child( texture_preview); @@ -2037,6 +2039,17 @@ void PropertyEditor::update_tree() { List plist; obj->get_property_list(&plist,true); + bool draw_red=false; + + { + Node *nod = obj->cast_to(); + Node *es = EditorNode::get_singleton()->get_edited_scene(); + if (nod && es!=nod && nod->get_owner()!=es) { + draw_red=true; + } + } + + Color sscolor=get_color("prop_subsection","Editor"); TreeItem * current_category=NULL; @@ -2141,11 +2154,16 @@ void PropertyEditor::update_tree() { item->set_metadata( 0, d ); item->set_metadata( 1, p.name ); + + if (draw_red) + item->set_custom_color(0,Color(0.8,0.4,0.20)); + if (p.name==selected_property) { item->select(1); } + //printf("property %s type %i\n",p.name.ascii().get_data(),p.type); switch( p.type ) { diff --git a/tools/editor/scene_tree_dock.cpp b/tools/editor/scene_tree_dock.cpp index c4c3a10f74..e7f4beb46e 100644 --- a/tools/editor/scene_tree_dock.cpp +++ b/tools/editor/scene_tree_dock.cpp @@ -108,6 +108,9 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) { case TOOL_NEW: { + + if (!_validate_no_foreign()) + break; create_dialog->popup_centered_ratio(); } break; case TOOL_INSTANCE: { @@ -124,6 +127,9 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) { break; } + if (!_validate_no_foreign()) + break; + file->set_mode(FileDialog::MODE_OPEN_FILE); List extensions; ResourceLoader::get_recognized_extensions_for_type("PackedScene",&extensions); @@ -147,6 +153,8 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) { if (!current) break; + if (!_validate_no_foreign()) + break; connect_dialog->popup_centered_ratio(); connect_dialog->set_node(current); @@ -156,6 +164,8 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) { Node *current = scene_tree->get_selected(); if (!current) break; + if (!_validate_no_foreign()) + break; groups_editor->set_current(current); groups_editor->popup_centered_ratio(); } break; @@ -165,6 +175,9 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) { if (!selected) break; + if (!_validate_no_foreign()) + break; + Ref