diff options
28 files changed, 71 insertions, 1379 deletions
diff --git a/doc/classes/LineEdit.xml b/doc/classes/LineEdit.xml index 9a03d4e0c1..4434a7b7e2 100644 --- a/doc/classes/LineEdit.xml +++ b/doc/classes/LineEdit.xml @@ -27,6 +27,13 @@ Erases the [LineEdit] text. </description> </method> + <method name="deselect"> + <return type="void"> + </return> + <description> + Clears the current selection. + </description> + </method> <method name="get_cursor_position" qualifiers="const"> <return type="int"> </return> diff --git a/drivers/gles3/rasterizer_gles3.cpp b/drivers/gles3/rasterizer_gles3.cpp index cd0adbd0d1..6b827002f8 100644 --- a/drivers/gles3/rasterizer_gles3.cpp +++ b/drivers/gles3/rasterizer_gles3.cpp @@ -354,47 +354,10 @@ void RasterizerGLES3::blit_render_target_to_screen(RID p_render_target, const Re void RasterizerGLES3::end_frame(bool p_swap_buffers) { -#if 0 - canvas->canvas_begin(); - glActiveTexture(GL_TEXTURE0); - glBindTexture(GL_TEXTURE_2D,storage->resources.white_tex); - glDisable(GL_BLEND); - glDisable(GL_DEPTH_TEST); - glDisable(GL_CULL_FACE); - - - float vtx[8]={0,0, - 0,1, - 1,1, - 1,0 - }; - - glBindBuffer(GL_ARRAY_BUFFER,0); - glBindBuffer(GL_ELEMENT_ARRAY_BUFFER,0); - - glEnableVertexAttribArray(VS::ARRAY_VERTEX); - glVertexAttribPointer( VS::ARRAY_VERTEX, 2 ,GL_FLOAT, false, 0, vtx ); - - - //glBindBuffer(GL_ARRAY_BUFFER,canvas->data.canvas_quad_vertices); - //glEnableVertexAttribArray(VS::ARRAY_VERTEX); - //glVertexAttribPointer( VS::ARRAY_VERTEX, 2 ,GL_FLOAT, false, 0, 0 ); - - glBindVertexArray(canvas->data.canvas_quad_array); - - canvas->draw_generic_textured_rect(Rect2(0,0,15,15),Rect2(0,0,1,1)); -#endif if (p_swap_buffers) OS::get_singleton()->swap_buffers(); else glFinish(); - - /* print_line("objects: "+itos(storage->info.render_object_count)); - print_line("material chages: "+itos(storage->info.render_material_switch_count)); - print_line("surface changes: "+itos(storage->info.render_surface_switch_count)); - print_line("shader changes: "+itos(storage->info.render_shader_rebind_count)); - print_line("vertices: "+itos(storage->info.render_vertices_count)); -*/ } void RasterizerGLES3::finalize() { diff --git a/drivers/gles3/rasterizer_scene_gles3.cpp b/drivers/gles3/rasterizer_scene_gles3.cpp index 29ab531177..b777f9343a 100644 --- a/drivers/gles3/rasterizer_scene_gles3.cpp +++ b/drivers/gles3/rasterizer_scene_gles3.cpp @@ -2786,12 +2786,6 @@ void RasterizerSceneGLES3::_setup_lights(RID *p_light_cull_result, int p_light_c copymem(&state.omni_array_tmp[li->light_index * state.ubo_light_size], &ubo_data, state.ubo_light_size); state.omni_light_count++; -#if 0 - if (li->light_ptr->shadow_enabled) { - li->shadow_projection[0] = Transform(camera_transform_inverse * li->transform).inverse(); - lights_use_shadow=true; - } -#endif } break; case VS::LIGHT_SPOT: { diff --git a/drivers/gles3/shader_gles3.cpp b/drivers/gles3/shader_gles3.cpp index 9e234f5005..20b2bc0a28 100644 --- a/drivers/gles3/shader_gles3.cpp +++ b/drivers/gles3/shader_gles3.cpp @@ -279,21 +279,6 @@ ShaderGLES3::Version *ShaderGLES3::get_current_version() { strings.push_back("precision highp sampler2DArray;\n"); #endif -#if 0 - if (cc) { - - String _code_string = "#define VERTEX_SHADER_CODE "+cc->vertex+"\n"; - String _code_globals = "#define VERTEX_SHADER_GLOBALS "+cc->vertex_globals+"\n"; - - code_string=_code_string.ascii(); - code_globals=_code_globals.ascii(); - DEBUG_PRINT( code_globals.get_data() ); - DEBUG_PRINT( code_string.get_data() ); - strings.push_back(code_globals); - strings.push_back(code_string); - } -#endif - strings.push_back(vertex_code0.get_data()); if (cc) { @@ -382,21 +367,6 @@ ShaderGLES3::Version *ShaderGLES3::get_current_version() { strings.push_back("precision highp sampler2DArray;\n"); #endif -#if 0 - if (cc) { - - String _code_string = "#define FRAGMENT_SHADER_CODE "+cc->fragment+"\n"; - String _code_globals = "#define FRAGMENT_SHADER_GLOBALS "+cc->fragment_globals+"\n"; - - code_string=_code_string.ascii(); - code_globals=_code_globals.ascii(); - DEBUG_PRINT( code_globals.get_data() ); - DEBUG_PRINT( code_string.get_data() ); - strings.push_back(code_globals); - strings.push_back(code_string); - } -#endif - strings.push_back(fragment_code0.get_data()); if (cc) { material_string = cc->uniforms.ascii(); diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index cb8407386d..0eb8ea6e46 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -444,15 +444,7 @@ void EditorNode::_fs_changed() { continue; if (E->get()->get_import_path() != String()) { -//this is an imported resource, will be reloaded if reimported via the _resources_reimported() callback -//imported resource -#if 0 - uint64_t mt = FileAccess::get_modified_time(E->get()->get_import_path()); - - if (mt != E->get()->get_import_last_modified_time()) { - changed.push_back(E->get()); - } -#endif + //this is an imported resource, will be reloaded if reimported via the _resources_reimported() callback continue; } diff --git a/editor/export_template_manager.cpp b/editor/export_template_manager.cpp index cdb7256329..3eaa6e44fd 100644 --- a/editor/export_template_manager.cpp +++ b/editor/export_template_manager.cpp @@ -176,7 +176,7 @@ void ExportTemplateManager::_uninstall_template_confirm() { _update_template_list(); } -void ExportTemplateManager::_install_from_file(const String &p_file) { +void ExportTemplateManager::_install_from_file(const String &p_file, bool p_use_progress) { FileAccess *fa = NULL; zlib_filefunc_def io = zipio_create_io_from_file(&fa); @@ -259,7 +259,10 @@ void ExportTemplateManager::_install_from_file(const String &p_file) { ret = unzGoToFirstFile(pkg); - EditorProgress p("ltask", TTR("Extracting Export Templates"), fc); + EditorProgress *p = NULL; + if (p_use_progress) { + p = memnew(EditorProgress("ltask", TTR("Extracting Export Templates"), fc)); + } fc = 0; @@ -288,8 +291,9 @@ void ExportTemplateManager::_install_from_file(const String &p_file) { */ file = file.get_file(); - - p.step(TTR("Importing:") + " " + file, fc); + if (p) { + p->step(TTR("Importing:") + " " + file, fc); + } FileAccess *f = FileAccess::open(template_path.plus_file(file), FileAccess::WRITE); @@ -302,6 +306,10 @@ void ExportTemplateManager::_install_from_file(const String &p_file) { fc++; } + if (p) { + memdelete(p); + } + unzClose(pkg); _update_template_list(); @@ -405,7 +413,7 @@ void ExportTemplateManager::_http_download_templates_completed(int p_status, int memdelete(f); template_list_state->set_text(TTR("Download Complete.")); template_downloader->hide(); - _install_from_file(path); + _install_from_file(path, false); } } } break; diff --git a/editor/export_template_manager.h b/editor/export_template_manager.h index 644c6b466b..36093da66a 100644 --- a/editor/export_template_manager.h +++ b/editor/export_template_manager.h @@ -69,7 +69,7 @@ class ExportTemplateManager : public ConfirmationDialog { void _uninstall_template_confirm(); virtual void ok_pressed(); - void _install_from_file(const String &p_file); + void _install_from_file(const String &p_file, bool p_use_progress = true); void _http_download_mirror_completed(int p_status, int p_code, const PoolStringArray &headers, const PoolByteArray &p_data); void _http_download_templates_completed(int p_status, int p_code, const PoolStringArray &headers, const PoolByteArray &p_data); diff --git a/editor/import/resource_importer_scene.cpp b/editor/import/resource_importer_scene.cpp index ed7c6dba79..b6e4729352 100644 --- a/editor/import/resource_importer_scene.cpp +++ b/editor/import/resource_importer_scene.cpp @@ -515,127 +515,7 @@ Node *ResourceImporterScene::_fix_node(Node *p_node, Node *p_root, Map<Ref<Array s->set_transform(Transform()); p_node = bv; -#if 0 - } else if (_teststr(name, "room") && Object::cast_to<MeshInstance>(p_node)) { - if (isroot) - return p_node; - - MeshInstance *mi = Object::cast_to<MeshInstance>(p_node); - PoolVector<Face3> faces = mi->get_faces(VisualInstance::FACES_SOLID); - - BSP_Tree bsptree(faces); - - Ref<RoomBounds> area = memnew(RoomBounds); - //area->set_bounds(faces); - //area->set_geometry_hint(faces); - - Room *room = memnew(Room); - room->set_name(_fixstr(name, "room")); - room->set_transform(mi->get_transform()); - room->set_room(area); - - p_node->replace_by(room); - memdelete(p_node); - p_node = room; - - } else if (_teststr(name, "room")) { - - if (isroot) - return p_node; - - Spatial *dummy = Object::cast_to<Spatial>(p_node); - ERR_FAIL_COND_V(!dummy, NULL); - - Room *room = memnew(Room); - room->set_name(_fixstr(name, "room")); - room->set_transform(dummy->get_transform()); - - p_node->replace_by(room); - memdelete(p_node); - p_node = room; - - //room->compute_room_from_subtree(); - - } else if (_teststr(name, "portal") && Object::cast_to<MeshInstance>(p_node)) { - - if (isroot) - return p_node; - - MeshInstance *mi = Object::cast_to<MeshInstance>(p_node); - PoolVector<Face3> faces = mi->get_faces(VisualInstance::FACES_SOLID); - - ERR_FAIL_COND_V(faces.size() == 0, NULL); - //step 1 compute the plane - Set<Vector3> points; - Plane plane; - - Vector3 center; - - for (int i = 0; i < faces.size(); i++) { - - Face3 f = faces.get(i); - Plane p = f.get_plane(); - plane.normal += p.normal; - plane.d += p.d; - - for (int i = 0; i < 3; i++) { - - Vector3 v = f.vertex[i].snapped(Vector3(0.01, 0.01, 0.01)); - if (!points.has(v)) { - points.insert(v); - center += v; - } - } - } - - plane.normal.normalize(); - plane.d /= faces.size(); - center /= points.size(); - - //step 2, create points - - Transform t; - t.basis.from_z(plane.normal); - t.basis.transpose(); - t.origin = center; - - Vector<Point2> portal_points; - - for (Set<Vector3>::Element *E = points.front(); E; E = E->next()) { - - Vector3 local = t.xform_inv(E->get()); - portal_points.push_back(Point2(local.x, local.y)); - } - // step 3 bubbly sort points - - int swaps = 0; - - do { - swaps = 0; - - for (int i = 0; i < portal_points.size() - 1; i++) { - - float a = portal_points[i].angle(); - float b = portal_points[i + 1].angle(); - - if (a > b) { - SWAP(portal_points[i], portal_points[i + 1]); - swaps++; - } - } - - } while (swaps); - - Portal *portal = memnew(Portal); - - portal->set_shape(portal_points); - portal->set_transform(mi->get_transform() * t); - - p_node->replace_by(portal); - memdelete(p_node); - p_node = portal; -#endif } else if (Object::cast_to<MeshInstance>(p_node)) { //last attempt, maybe collision inside the mesh data @@ -969,15 +849,15 @@ void ResourceImporterScene::_find_meshes(Node *p_node, Map<Ref<ArrayMesh>, Trans if (mesh.is_valid() && !meshes.has(mesh)) { Spatial *s = mi; - while (s->get_parent_spatial()) { + Transform transform; + while (s) { + transform = transform * s->get_transform(); s = s->get_parent_spatial(); } - if (s == mi) { - meshes[mesh] = s->get_transform(); - } else { - meshes[mesh] = s->get_transform() * mi->get_relative_transform(s); - } + meshes[mesh] = transform; + + print_line("mesh transform: " + meshes[mesh]); } } for (int i = 0; i < p_node->get_child_count(); i++) { @@ -1157,6 +1037,7 @@ void ResourceImporterScene::get_import_options(List<ImportOption> *r_options, in bool scenes_out = p_preset == PRESET_MULTIPLE_SCENES || p_preset == PRESET_MULTIPLE_SCENES_AND_MATERIALS; bool animations_out = p_preset == PRESET_SEPARATE_ANIMATIONS || p_preset == PRESET_SEPARATE_MESHES_AND_ANIMATIONS || p_preset == PRESET_SEPARATE_MATERIALS_AND_ANIMATIONS || p_preset == PRESET_SEPARATE_MESHES_MATERIALS_AND_ANIMATIONS; + r_options->push_back(ImportOption(PropertyInfo(Variant::REAL, "nodes/root_scale", PROPERTY_HINT_RANGE, "0.001,1000,0.001"), 1.0)); r_options->push_back(ImportOption(PropertyInfo(Variant::STRING, "nodes/custom_script", PROPERTY_HINT_FILE, script_ext_hint), "")); r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "nodes/storage", PROPERTY_HINT_ENUM, "Single Scene,Instanced Sub-Scenes"), scenes_out ? 1 : 0)); r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "materials/location", PROPERTY_HINT_ENUM, "Node,Mesh"), (meshes_out || materials_out) ? 1 : 0)); @@ -1329,6 +1210,11 @@ Error ResourceImporterScene::import(const String &p_source_file, const String &p } } + if (Object::cast_to<Spatial>(scene)) { + float root_scale = p_options["nodes/root_scale"]; + Object::cast_to<Spatial>(scene)->scale(Vector3(root_scale, root_scale, root_scale)); + } + scene->set_name(p_options["nodes/root_name"]); err = OK; diff --git a/editor/plugins/tile_set_editor_plugin.cpp b/editor/plugins/tile_set_editor_plugin.cpp index ae726b69ef..5eb3435e24 100644 --- a/editor/plugins/tile_set_editor_plugin.cpp +++ b/editor/plugins/tile_set_editor_plugin.cpp @@ -1435,13 +1435,13 @@ bool AutotileEditorHelper::_get(const StringName &p_name, Variant &r_ret) const return false; String name = p_name.operator String(); + bool v = false; if (name == "bitmask_mode") { - r_ret = tile_set->get(String::num(autotile_editor->get_current_tile(), 0) + "/autotile/bitmask_mode"); + r_ret = tile_set->get(String::num(autotile_editor->get_current_tile(), 0) + "/autotile/bitmask_mode", &v); } else if (name.left(7) == "layout/") { - bool v; r_ret = tile_set->get(String::num(autotile_editor->get_current_tile(), 0) + "/autotile" + name.right(6), &v); - return v; } + return v; } void AutotileEditorHelper::_get_property_list(List<PropertyInfo> *p_list) const { diff --git a/editor/spatial_editor_gizmos.cpp b/editor/spatial_editor_gizmos.cpp index f0e8d438fa..5359f9894c 100644 --- a/editor/spatial_editor_gizmos.cpp +++ b/editor/spatial_editor_gizmos.cpp @@ -1529,6 +1529,8 @@ SkeletonSpatialGizmo::SkeletonSpatialGizmo(Skeleton *p_skel) { skel = p_skel; set_spatial_node(p_skel); } + +// FIXME: Kept as reference for reimplementation in 3.1+ #if 0 void RoomSpatialGizmo::redraw() { diff --git a/modules/gdscript/gdscript_function.cpp b/modules/gdscript/gdscript_function.cpp index ee23f0ea0f..d6352f1e6e 100644 --- a/modules/gdscript/gdscript_function.cpp +++ b/modules/gdscript/gdscript_function.cpp @@ -1257,6 +1257,8 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a exit_ok = true; OPCODE_BREAK; } + +// Enable for debugging #if 0 default: { diff --git a/modules/visual_script/visual_script_flow_control.cpp b/modules/visual_script/visual_script_flow_control.cpp index a38266acc0..147761783a 100644 --- a/modules/visual_script/visual_script_flow_control.cpp +++ b/modules/visual_script/visual_script_flow_control.cpp @@ -731,921 +731,6 @@ void VisualScriptSwitch::_bind_methods() { VisualScriptSwitch::VisualScriptSwitch() { } - ////////////////////////////////////////// - ////////////////EVENT ACTION FILTER/////////// - ////////////////////////////////////////// - -#if 0 -int VisualScriptInputFilter::get_output_sequence_port_count() const { - - return filters.size(); -} - -bool VisualScriptInputFilter::has_input_sequence_port() const { - - return true; -} - -int VisualScriptInputFilter::get_input_value_port_count() const { - - return 1; -} -int VisualScriptInputFilter::get_output_value_port_count() const { - - return 1; -} - -String VisualScriptInputFilter::get_output_sequence_port_text(int p_port) const { - - String text; - - switch (filters[p_port].type) { - case Ref<InputEvent>::NONE: { - text = "None"; - } break; - case Ref<InputEvent>::KEY: { - - InputEventKey k = filters[p_port].key; - - if (k->get_scancode() == 0 && k.unicode == 0) { - text = "No Key"; - } else { - if (k->get_scancode() != 0) { - text = "KeyCode: " + keycode_get_string(k->get_scancode()); - } else if (k.unicode != 0) { - text = "Uniode: " + String::chr(k.unicode); - } - - if (k->is_pressed()) - text += ", Pressed"; - else - text += ", Released"; - - if (k.echo) - text += ", Echo"; - if (k->get_alt()) - text = "Alt+" + text; - if (k->get_shift()) - text = "Shift+" + text; - if (k->get_control()) - text = "Ctrl+" + text; - if (k->get_metakey()) - text = "Meta+" + text; - } - - } break; - case Ref<InputEvent>::MOUSE_MOTION: { - InputEventMouseMotion mm = filters[p_port].mouse_motion; - text = "Mouse Motion"; - - String b = "Left,Right,Middle,WheelUp,WheelDown,WheelLeft,WheelRight"; - - for (int i = 0; i < 7; i++) { - if (mm->get_button_mask() & (1 << i)) { - text = b.get_slice(",", i) + "+" + text; - } - } - if (mm->get_alt()) - text = "Alt+" + text; - if (mm->get_shift()) - text = "Shift+" + text; - if (mm->get_control()) - text = "Ctrl+" + text; - if (mm->get_metakey()) - text = "Meta+" + text; - } break; - case Ref<InputEvent>::MOUSE_BUTTON: { - - InputEventMouseButton mb = filters[p_port].mouse_button; - - String b = "Any,Left,Right,Middle,WheelUp,WheelDown,WheelLeft,WheelRight"; - - text = b.get_slice(",", mb->get_button_index()) + " Mouse Button"; - - if (mb->is_pressed()) - text += ", Pressed"; - else - text += ", Released"; - - if (mb.doubleclick) - text += ", DblClick"; - if (mb->get_alt()) - text = "Alt+" + text; - if (mb->get_shift()) - text = "Shift+" + text; - if (mb->get_control()) - text = "Ctrl+" + text; - if (mb->get_metakey()) - text = "Meta+" + text; - - } break; - case Ref<InputEvent>::JOYPAD_MOTION: { - - InputEventJoypadMotion jm = filters[p_port].joy_motion; - - text = "JoyMotion Axis " + itos(jm.axis >> 1); - if (jm.axis & 1) - text += " > " + rtos(jm.axis_value); - else - text += " < " + rtos(-jm.axis_value); - - } break; - case Ref<InputEvent>::JOYPAD_BUTTON: { - InputEventJoypadButton jb = filters[p_port].joy_button; - - text = "JoyButton " + itos(jb->get_button_index()); - if (jb->is_pressed()) - text += ", Pressed"; - else - text += ", Released"; - } break; - case Ref<InputEvent>::SCREEN_TOUCH: { - InputEventScreenTouch sd = filters[p_port].screen_touch; - - text = "Touch Finger " + itos(sd.index); - if (sd->is_pressed()) - text += ", Pressed"; - else - text += ", Released"; - } break; - case Ref<InputEvent>::SCREEN_DRAG: { - InputEventScreenDrag sd = filters[p_port].screen_drag; - text = "Drag Finger " + itos(sd.index); - } break; - case Ref<InputEvent>::ACTION: { - - List<PropertyInfo> pinfo; - ProjectSettings::get_singleton()->get_property_list(&pinfo); - int index = 1; - - text = "No Action"; - for (List<PropertyInfo>::Element *E = pinfo.front(); E; E = E->next()) { - const PropertyInfo &pi = E->get(); - - if (!pi.name.begins_with("input/")) - continue; - - if (filters[p_port].action.action == index) { - text = "Action " + pi.name.substr(pi.name.find("/") + 1, pi.name.length()); - break; - } - index++; - } - - if (filters[p_port].action->is_pressed()) - text += ", Pressed"; - else - text += ", Released"; - - } break; - } - - return text + " - " + itos(p_port); -} - -PropertyInfo VisualScriptInputFilter::get_input_value_port_info(int p_idx) const { - - return PropertyInfo(Variant::INPUT_EVENT, "event"); -} - -PropertyInfo VisualScriptInputFilter::get_output_value_port_info(int p_idx) const { - - return PropertyInfo(Variant::INPUT_EVENT, ""); -} - -String VisualScriptInputFilter::get_caption() const { - - return "InputFilter"; -} - -String VisualScriptInputFilter::get_text() const { - - return ""; -} - -bool VisualScriptInputFilter::_set(const StringName &p_name, const Variant &p_value) { - - if (p_name == "filter_count") { - filters.resize(p_value); - _change_notify(); - ports_changed_notify(); - return true; - } - - if (String(p_name).begins_with("filter_")) { - - int idx = String(p_name).replace_first("filters_", "").get_slice("/", 0).to_int(); - - ERR_FAIL_INDEX_V(idx, filters.size(), false); - - String what = String(p_name).get_slice("/", 1); - - if (what == "type") { - filters[idx] = Ref<InputEvent>(); - filters[idx].type = Ref<InputEvent>::Type(int(p_value)); - if (filters[idx].type == Ref<InputEvent>::JOYPAD_MOTION) { - filters[idx].joy_motion.axis_value = 0.5; //for threshold - } else if (filters[idx].type == Ref<InputEvent>::KEY) { - filters[idx]->is_pressed() = true; //put these as true to make it more user friendly - } else if (filters[idx].type == Ref<InputEvent>::MOUSE_BUTTON) { - filters[idx]->is_pressed() = true; - } else if (filters[idx].type == Ref<InputEvent>::JOYPAD_BUTTON) { - filters[idx].joy_button->is_pressed() = true; - } else if (filters[idx].type == Ref<InputEvent>::SCREEN_TOUCH) { - filters[idx].screen_touch->is_pressed() = true; - } else if (filters[idx].type == Ref<InputEvent>::ACTION) { - filters[idx].action->is_pressed() = true; - } - _change_notify(); - ports_changed_notify(); - - return true; - } - if (what == "device") { - filters[idx].device = p_value; - ports_changed_notify(); - return true; - } - - switch (filters[idx].type) { - - case Ref<InputEvent>::KEY: { - - if (what == "scancode") { - String sc = p_value; - if (sc == String()) { - filters[idx]->get_scancode() = 0; - } else { - filters[idx]->get_scancode() = find_keycode(p_value); - } - - } else if (what == "unicode") { - - String uc = p_value; - - if (uc == String()) { - filters[idx].key.unicode = 0; - } else { - filters[idx].key.unicode = uc[0]; - } - - } else if (what == "pressed") { - - filters[idx]->is_pressed() = p_value; - } else if (what == "echo") { - - filters[idx]->is_echo() = p_value; - - } else if (what == "mod_alt") { - filters[idx]->get_alt() = p_value; - - } else if (what == "mod_shift") { - filters[idx]->get_shift() = p_value; - - } else if (what == "mod_ctrl") { - filters[idx]->get_control() = p_value; - - } else if (what == "mod_meta") { - filters[idx]->get_metakey() = p_value; - } else { - return false; - } - ports_changed_notify(); - - return true; - } break; - case Ref<InputEvent>::MOUSE_MOTION: { - - if (what == "button_mask") { - filters[idx]->get_button_mask() = p_value; - - } else if (what == "mod_alt") { - filters[idx].mouse_motion->get_alt() = p_value; - - } else if (what == "mod_shift") { - filters[idx].mouse_motion->get_shift() = p_value; - - } else if (what == "mod_ctrl") { - filters[idx].mouse_motion->get_control() = p_value; - - } else if (what == "mod_meta") { - filters[idx].mouse_motion->get_metakey() = p_value; - } else { - return false; - } - - ports_changed_notify(); - return true; - - } break; - case Ref<InputEvent>::MOUSE_BUTTON: { - - if (what == "button_index") { - filters[idx]->get_button_index() = p_value; - } else if (what == "pressed") { - filters[idx]->is_pressed() = p_value; - } else if (what == "doubleclicked") { - filters[idx].mouse_button.doubleclick = p_value; - - } else if (what == "mod_alt") { - filters[idx].mouse_button->get_alt() = p_value; - - } else if (what == "mod_shift") { - filters[idx].mouse_button->get_shift() = p_value; - - } else if (what == "mod_ctrl") { - filters[idx].mouse_button->get_control() = p_value; - - } else if (what == "mod_meta") { - filters[idx].mouse_button->get_metakey() = p_value; - } else { - return false; - } - ports_changed_notify(); - return true; - - } break; - case Ref<InputEvent>::JOYPAD_MOTION: { - - if (what == "axis") { - filters[idx].joy_motion.axis = int(p_value) << 1 | filters[idx].joy_motion.axis; - } else if (what == "mode") { - filters[idx].joy_motion.axis |= int(p_value); - } else if (what == "threshold") { - filters[idx].joy_motion.axis_value = p_value; - } else { - return false; - } - ports_changed_notify(); - return true; - - } break; - case Ref<InputEvent>::JOYPAD_BUTTON: { - - if (what == "button_index") { - filters[idx].joy_button->get_button_index() = p_value; - } else if (what == "pressed") { - filters[idx].joy_button->is_pressed() = p_value; - } else { - return false; - } - ports_changed_notify(); - return true; - - } break; - case Ref<InputEvent>::SCREEN_TOUCH: { - - if (what == "finger_index") { - filters[idx].screen_touch.index = p_value; - } else if (what == "pressed") { - filters[idx].screen_touch->is_pressed() = p_value; - } else { - return false; - } - ports_changed_notify(); - return true; - } break; - case Ref<InputEvent>::SCREEN_DRAG: { - if (what == "finger_index") { - filters[idx].screen_drag.index = p_value; - } else { - return false; - } - ports_changed_notify(); - return true; - } break; - case Ref<InputEvent>::ACTION: { - - if (what == "action_name") { - - List<PropertyInfo> pinfo; - ProjectSettings::get_singleton()->get_property_list(&pinfo); - int index = 1; - - for (List<PropertyInfo>::Element *E = pinfo.front(); E; E = E->next()) { - const PropertyInfo &pi = E->get(); - - if (!pi.name.begins_with("input/")) - continue; - - String name = pi.name.substr(pi.name.find("/") + 1, pi.name.length()); - if (name == String(p_value)) { - - filters[idx].action.action = index; - ports_changed_notify(); - return true; - } - - index++; - } - - filters[idx].action.action = 0; - ports_changed_notify(); - - return false; - - } else if (what == "pressed") { - - filters[idx].action->is_pressed() = p_value; - ports_changed_notify(); - return true; - } - - } break; - } - } - return false; -} - -bool VisualScriptInputFilter::_get(const StringName &p_name, Variant &r_ret) const { - - if (p_name == "filter_count") { - r_ret = filters.size(); - return true; - } - - if (String(p_name).begins_with("filter_")) { - - int idx = String(p_name).replace_first("filters_", "").get_slice("/", 0).to_int(); - - ERR_FAIL_INDEX_V(idx, filters.size(), false); - - String what = String(p_name).get_slice("/", 1); - - if (what == "type") { - r_ret = filters[idx].type; - return true; - } - if (what == "device") { - r_ret = filters[idx].device; - return true; - } - - switch (filters[idx].type) { - - case Ref<InputEvent>::KEY: { - - if (what == "scancode") { - if (filters[idx]->get_scancode() == 0) - r_ret = String(); - else { - - r_ret = keycode_get_string(filters[idx]->get_scancode()); - } - - } else if (what == "unicode") { - - if (filters[idx].key.unicode == 0) { - r_ret = String(); - } else { - CharType str[2] = { (CharType)filters[idx].key.unicode, 0 }; - r_ret = String(str); - } - - } else if (what == "pressed") { - - r_ret = filters[idx]->is_pressed(); - } else if (what == "echo") { - - r_ret = filters[idx]->is_echo(); - - } else if (what == "mod_alt") { - r_ret = filters[idx]->get_alt(); - - } else if (what == "mod_shift") { - r_ret = filters[idx]->get_shift(); - - } else if (what == "mod_ctrl") { - r_ret = filters[idx]->get_control(); - - } else if (what == "mod_meta") { - r_ret = filters[idx]->get_metakey(); - } else { - return false; - } - - return true; - } break; - case Ref<InputEvent>::MOUSE_MOTION: { - - if (what == "button_mask") { - r_ret = filters[idx]->get_button_mask(); - - } else if (what == "mod_alt") { - r_ret = filters[idx].mouse_motion->get_alt(); - - } else if (what == "mod_shift") { - r_ret = filters[idx].mouse_motion->get_shift(); - - } else if (what == "mod_ctrl") { - r_ret = filters[idx].mouse_motion->get_control(); - - } else if (what == "mod_meta") { - r_ret = filters[idx].mouse_motion->get_metakey(); - } else { - return false; - } - - return true; - - } break; - case Ref<InputEvent>::MOUSE_BUTTON: { - - if (what == "button_index") { - r_ret = filters[idx]->get_button_index(); - } else if (what == "pressed") { - r_ret = filters[idx]->is_pressed(); - } else if (what == "doubleclicked") { - r_ret = filters[idx].mouse_button.doubleclick; - - } else if (what == "mod_alt") { - r_ret = filters[idx].mouse_button->get_alt(); - - } else if (what == "mod_shift") { - r_ret = filters[idx].mouse_button->get_shift(); - - } else if (what == "mod_ctrl") { - r_ret = filters[idx].mouse_button->get_control(); - - } else if (what == "mod_meta") { - r_ret = filters[idx].mouse_button->get_metakey(); - } else { - return false; - } - return true; - - } break; - case Ref<InputEvent>::JOYPAD_MOTION: { - - if (what == "axis_index") { - r_ret = filters[idx].joy_motion.axis >> 1; - } else if (what == "mode") { - r_ret = filters[idx].joy_motion.axis & 1; - } else if (what == "threshold") { - r_ret = filters[idx].joy_motion.axis_value; - } else { - return false; - } - return true; - - } break; - case Ref<InputEvent>::JOYPAD_BUTTON: { - - if (what == "button_index") { - r_ret = filters[idx].joy_button->get_button_index(); - } else if (what == "pressed") { - r_ret = filters[idx].joy_button->is_pressed(); - } else { - return false; - } - return true; - - } break; - case Ref<InputEvent>::SCREEN_TOUCH: { - - if (what == "finger_index") { - r_ret = filters[idx].screen_touch.index; - } else if (what == "pressed") { - r_ret = filters[idx].screen_touch->is_pressed(); - } else { - return false; - } - return true; - } break; - case Ref<InputEvent>::SCREEN_DRAG: { - if (what == "finger_index") { - r_ret = filters[idx].screen_drag.index; - } else { - return false; - } - return true; - } break; - case Ref<InputEvent>::ACTION: { - - if (what == "action_name") { - - List<PropertyInfo> pinfo; - ProjectSettings::get_singleton()->get_property_list(&pinfo); - int index = 1; - - for (List<PropertyInfo>::Element *E = pinfo.front(); E; E = E->next()) { - const PropertyInfo &pi = E->get(); - - if (!pi.name.begins_with("input/")) - continue; - - if (filters[idx].action.action == index) { - r_ret = pi.name.substr(pi.name.find("/") + 1, pi.name.length()); - return true; - } - index++; - } - - r_ret = "None"; //no index - return false; - - } else if (what == "pressed") { - - r_ret = filters[idx].action->is_pressed(); - return true; - } - - } break; - } - } - return false; -} - -static const char *event_type_names[Ref<InputEvent>::TYPE_MAX] = { - "None", - "Key", - "MouseMotion", - "MouseButton", - "JoypadMotion", - "JoypadButton", - "ScreenTouch", - "ScreenDrag", - "Action" -}; - -void VisualScriptInputFilter::_get_property_list(List<PropertyInfo> *p_list) const { - - p_list->push_back(PropertyInfo(Variant::INT, "filter_count", PROPERTY_HINT_RANGE, "0,64")); - - String et; - for (int i = 0; i < Ref<InputEvent>::TYPE_MAX; i++) { - if (i > 0) - et += ","; - - et += event_type_names[i]; - } - - String kc; - String actions; - - for (int i = 0; i < filters.size(); i++) { - - String base = "filter_" + itos(i) + "/"; - p_list->push_back(PropertyInfo(Variant::INT, base + "type", PROPERTY_HINT_ENUM, et)); - p_list->push_back(PropertyInfo(Variant::INT, base + "device")); - switch (filters[i].type) { - - case Ref<InputEvent>::NONE: { - - } break; - case Ref<InputEvent>::KEY: { - if (kc == String()) { - int kcc = keycode_get_count(); - kc = "None"; - for (int i = 0; i < kcc; i++) { - kc += ","; - kc += String(keycode_get_name_by_index(i)); - } - } - p_list->push_back(PropertyInfo(Variant::STRING, base + "scancode", PROPERTY_HINT_ENUM, kc)); - p_list->push_back(PropertyInfo(Variant::STRING, base + "unicode")); - p_list->push_back(PropertyInfo(Variant::BOOL, base + "pressed")); - p_list->push_back(PropertyInfo(Variant::BOOL, base + "echo")); - p_list->push_back(PropertyInfo(Variant::BOOL, base + "mod_alt")); - p_list->push_back(PropertyInfo(Variant::BOOL, base + "mod_shift")); - p_list->push_back(PropertyInfo(Variant::BOOL, base + "mod_ctrl")); - p_list->push_back(PropertyInfo(Variant::BOOL, base + "mod_meta")); - - } break; - case Ref<InputEvent>::MOUSE_MOTION: { - p_list->push_back(PropertyInfo(Variant::INT, base + "button_mask", PROPERTY_HINT_FLAGS, "Left,Right,Middle,WheelUp,WheelDown,WheelLeft,WheelRight")); - p_list->push_back(PropertyInfo(Variant::BOOL, base + "mod_alt")); - p_list->push_back(PropertyInfo(Variant::BOOL, base + "mod_shift")); - p_list->push_back(PropertyInfo(Variant::BOOL, base + "mod_ctrl")); - p_list->push_back(PropertyInfo(Variant::BOOL, base + "mod_meta")); - - } break; - case Ref<InputEvent>::MOUSE_BUTTON: { - p_list->push_back(PropertyInfo(Variant::INT, base + "button_index", PROPERTY_HINT_ENUM, "Any,Left,Right,Middle,WheelUp,WheelDown,WheelLeft,WheelRight")); - p_list->push_back(PropertyInfo(Variant::BOOL, base + "pressed")); - p_list->push_back(PropertyInfo(Variant::BOOL, base + "doubleclicked")); - p_list->push_back(PropertyInfo(Variant::BOOL, base + "mod_alt")); - p_list->push_back(PropertyInfo(Variant::BOOL, base + "mod_shift")); - p_list->push_back(PropertyInfo(Variant::BOOL, base + "mod_ctrl")); - p_list->push_back(PropertyInfo(Variant::BOOL, base + "mod_meta")); - - } break; - case Ref<InputEvent>::JOYPAD_MOTION: { - - p_list->push_back(PropertyInfo(Variant::INT, base + "axis_index")); - p_list->push_back(PropertyInfo(Variant::INT, base + "mode", PROPERTY_HINT_ENUM, "Min,Max")); - p_list->push_back(PropertyInfo(Variant::REAL, base + "threshold", PROPERTY_HINT_RANGE, "0,1,0.01")); - } break; - case Ref<InputEvent>::JOYPAD_BUTTON: { - p_list->push_back(PropertyInfo(Variant::INT, base + "button_index")); - p_list->push_back(PropertyInfo(Variant::BOOL, base + "pressed")); - - } break; - case Ref<InputEvent>::SCREEN_TOUCH: { - p_list->push_back(PropertyInfo(Variant::INT, base + "finger_index")); - p_list->push_back(PropertyInfo(Variant::BOOL, base + "pressed")); - - } break; - case Ref<InputEvent>::SCREEN_DRAG: { - p_list->push_back(PropertyInfo(Variant::INT, base + "finger_index")); - } break; - case Ref<InputEvent>::ACTION: { - - if (actions == String()) { - - actions = "None"; - - List<PropertyInfo> pinfo; - ProjectSettings::get_singleton()->get_property_list(&pinfo); - Vector<String> al; - - for (List<PropertyInfo>::Element *E = pinfo.front(); E; E = E->next()) { - const PropertyInfo &pi = E->get(); - - if (!pi.name.begins_with("input/")) - continue; - - String name = pi.name.substr(pi.name.find("/") + 1, pi.name.length()); - - al.push_back(name); - } - - for (int i = 0; i < al.size(); i++) { - actions += ","; - actions += al[i]; - } - } - - p_list->push_back(PropertyInfo(Variant::STRING, base + "action_name", PROPERTY_HINT_ENUM, actions)); - p_list->push_back(PropertyInfo(Variant::BOOL, base + "pressed")); - - } break; - } - } -} - -class VisualScriptNodeInstanceInputFilter : public VisualScriptNodeInstance { -public: - VisualScriptInstance *instance; - Vector<Ref<InputEvent>> filters; - - //virtual int get_working_memory_size() const { return 0; } - //virtual bool is_output_port_unsequenced(int p_idx) const { return false; } - //virtual bool get_output_port_unsequenced(int p_idx,Variant* r_value,Variant* p_working_mem,String &r_error) const { return false; } - - virtual int step(const Variant **p_inputs, Variant **p_outputs, StartMode p_start_mode, Variant *p_working_mem, Variant::CallError &r_error, String &r_error_str) { - - if (p_inputs[0]->get_type() != Variant::INPUT_EVENT) { - r_error_str = "Input value not of type event"; - r_error.error = Variant::CallError::CALL_ERROR_INVALID_METHOD; - return 0; - } - - Ref<InputEvent> event = *p_inputs[0]; - - for (int i = 0; i < filters.size(); i++) { - - const Ref<InputEvent> &ie = filters[i]; - if (ie.type != event.type) - continue; - - bool match = false; - - switch (ie.type) { - - case Ref<InputEvent>::NONE: { - - match = true; - } break; - case Ref<InputEvent>::KEY: { - - InputEventKey k = ie.key; - InputEventKey k2 = event.key; - - if (k->get_scancode() == 0 && k.unicode == 0 && k2->get_scancode() == 0 && k2.unicode == 0) { - match = true; - - } else { - - if ((k->get_scancode() != 0 && k->get_scancode() == k2->get_scancode()) || (k.unicode != 0 && k.unicode == k2.unicode)) { - //key valid - - if ( - k->is_pressed() == k2->is_pressed() && - k.echo == k2.echo && - k.mod == k2.mod) { - match = true; - } - } - } - - } break; - case Ref<InputEvent>::MOUSE_MOTION: { - InputEventMouseMotion mm = ie.mouse_motion; - InputEventMouseMotion mm2 = event.mouse_motion; - - if (mm->get_button_mask() == mm2->get_button_mask() && - mm.mod == mm2.mod) { - match = true; - } - - } break; - case Ref<InputEvent>::MOUSE_BUTTON: { - - InputEventMouseButton mb = ie.mouse_button; - InputEventMouseButton mb2 = event.mouse_button; - - if (mb->get_button_index() == mb2->get_button_index() && - mb->is_pressed() == mb2->is_pressed() && - mb.doubleclick == mb2.doubleclick && - mb.mod == mb2.mod) { - match = true; - } - - } break; - case Ref<InputEvent>::JOYPAD_MOTION: { - - InputEventJoypadMotion jm = ie.joy_motion; - InputEventJoypadMotion jm2 = event.joy_motion; - - int axis = jm.axis >> 1; - - if (axis == jm2.axis) { - - if (jm.axis & 1) { - //greater - if (jm2.axis_value > jm.axis_value) { - match = true; - } - } else { - //less - if (jm2.axis_value < -jm.axis_value) { - match = true; - } - } - } - - } break; - case Ref<InputEvent>::JOYPAD_BUTTON: { - InputEventJoypadButton jb = ie.joy_button; - InputEventJoypadButton jb2 = event.joy_button; - - if (jb->get_button_index() == jb2->get_button_index() && - jb->is_pressed() == jb2->is_pressed()) { - match = true; - } - } break; - case Ref<InputEvent>::SCREEN_TOUCH: { - InputEventScreenTouch st = ie.screen_touch; - InputEventScreenTouch st2 = event.screen_touch; - - if (st.index == st2.index && - st->is_pressed() == st2->is_pressed()) { - match = true; - } - - } break; - case Ref<InputEvent>::SCREEN_DRAG: { - InputEventScreenDrag sd = ie.screen_drag; - InputEventScreenDrag sd2 = event.screen_drag; - - if (sd.index == sd2.index) { - match = true; - } - } break; - case Ref<InputEvent>::ACTION: { - - InputEventAction ia = ie.action; - InputEventAction ia2 = event.action; - - if (ia.action == ia2.action && - ia->is_pressed() == ia2->is_pressed()) { - match = true; - } - } break; - } - - *p_outputs[0] = event; - - if (match) - return i; //go through match output - } - - return STEP_NO_ADVANCE_BIT; //none found, don't advance - } -}; - -VisualScriptNodeInstance *VisualScriptInputFilter::instance(VisualScriptInstance *p_instance) { - - VisualScriptNodeInstanceInputFilter *instance = memnew(VisualScriptNodeInstanceInputFilter); - instance->instance = p_instance; - instance->filters = filters; - return instance; -} - -VisualScriptInputFilter::VisualScriptInputFilter() { -} -#endif ////////////////////////////////////////// ////////////////TYPE CAST/////////// ////////////////////////////////////////// diff --git a/modules/visual_script/visual_script_flow_control.h b/modules/visual_script/visual_script_flow_control.h index 380eb76c45..4766bbef6b 100644 --- a/modules/visual_script/visual_script_flow_control.h +++ b/modules/visual_script/visual_script_flow_control.h @@ -228,40 +228,6 @@ public: VisualScriptSwitch(); }; -#if 0 -class VisualScriptInputFilter : public VisualScriptNode { - - GDCLASS(VisualScriptInputFilter, VisualScriptNode) - - Vector<Ref<InputEvent>> filters; - -protected: - bool _set(const StringName &p_name, const Variant &p_value); - bool _get(const StringName &p_name, Variant &r_ret) const; - void _get_property_list(List<PropertyInfo> *p_list) const; - -public: - virtual int get_output_sequence_port_count() const; - virtual bool has_input_sequence_port() const; - - virtual String get_output_sequence_port_text(int p_port) const; - - virtual int get_input_value_port_count() const; - virtual int get_output_value_port_count() const; - - virtual PropertyInfo get_input_value_port_info(int p_idx) const; - virtual PropertyInfo get_output_value_port_info(int p_idx) const; - - virtual String get_caption() const; - virtual String get_text() const; - virtual String get_category() const { return "flow_control"; } - - virtual VisualScriptNodeInstance *instance(VisualScriptInstance *p_instance); - - VisualScriptInputFilter(); -}; -#endif - class VisualScriptTypeCast : public VisualScriptNode { GDCLASS(VisualScriptTypeCast, VisualScriptNode) diff --git a/platform/android/java_glue.cpp b/platform/android/java_glue.cpp index 40dfe6d909..c4d0cf5181 100644 --- a/platform/android/java_glue.cpp +++ b/platform/android/java_glue.cpp @@ -936,13 +936,7 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_setup(JNIEnv *env, jo } __android_log_print(ANDROID_LOG_INFO, "godot", "CMDLINE LEN %i - APK EXPANSION %i\n", cmdlen, int(use_apk_expansion)); -#if 0 - char *args[]={"-test","render",NULL}; - __android_log_print(ANDROID_LOG_INFO,"godot","pre asdasd setup..."); - Error err = Main::setup("apk",2,args,false); -#else Error err = Main::setup("apk", cmdlen, (char **)cmdline, false); -#endif if (cmdline) { free(cmdline); } diff --git a/scene/3d/baked_lightmap.cpp b/scene/3d/baked_lightmap.cpp index 99d14e7f74..7afac94e71 100644 --- a/scene/3d/baked_lightmap.cpp +++ b/scene/3d/baked_lightmap.cpp @@ -298,7 +298,7 @@ BakedLightmap::BakeError BakedLightmap::bake(Node *p_from_node, bool p_create_vi Ref<BakedLightmapData> new_light_data; new_light_data.instance(); - static const int subdiv_value[SUBDIV_MAX] = { 8, 9, 10, 11, 12, 13 }; + static const int subdiv_value[SUBDIV_MAX] = { 8, 9, 10, 11 }; VoxelLightBaker baker; @@ -678,7 +678,7 @@ void BakedLightmap::_bind_methods() { ClassDB::bind_method(D_METHOD("debug_bake"), &BakedLightmap::_debug_bake); ClassDB::set_method_flags(get_class_static(), _scs_create("debug_bake"), METHOD_FLAGS_DEFAULT | METHOD_FLAG_EDITOR); - ADD_PROPERTY(PropertyInfo(Variant::INT, "bake_subdiv", PROPERTY_HINT_ENUM, "128,256,512,1024,2048,4096"), "set_bake_subdiv", "get_bake_subdiv"); + ADD_PROPERTY(PropertyInfo(Variant::INT, "bake_subdiv", PROPERTY_HINT_ENUM, "128,256,512,1024"), "set_bake_subdiv", "get_bake_subdiv"); ADD_PROPERTY(PropertyInfo(Variant::INT, "capture_subdiv", PROPERTY_HINT_ENUM, "128,256,512"), "set_capture_subdiv", "get_capture_subdiv"); ADD_PROPERTY(PropertyInfo(Variant::INT, "bake_quality", PROPERTY_HINT_ENUM, "Low,Medium,High"), "set_bake_quality", "get_bake_quality"); ADD_PROPERTY(PropertyInfo(Variant::INT, "bake_mode", PROPERTY_HINT_ENUM, "ConeTrace,RayTrace"), "set_bake_mode", "get_bake_mode"); @@ -693,8 +693,6 @@ void BakedLightmap::_bind_methods() { BIND_ENUM_CONSTANT(SUBDIV_256); BIND_ENUM_CONSTANT(SUBDIV_512); BIND_ENUM_CONSTANT(SUBDIV_1024); - BIND_ENUM_CONSTANT(SUBDIV_2048); - BIND_ENUM_CONSTANT(SUBDIV_4096); BIND_ENUM_CONSTANT(SUBDIV_MAX); BIND_ENUM_CONSTANT(BAKE_QUALITY_LOW); diff --git a/scene/3d/baked_lightmap.h b/scene/3d/baked_lightmap.h index 5595ec1e61..f63749a0b4 100644 --- a/scene/3d/baked_lightmap.h +++ b/scene/3d/baked_lightmap.h @@ -64,8 +64,6 @@ public: SUBDIV_256, SUBDIV_512, SUBDIV_1024, - SUBDIV_2048, - SUBDIV_4096, SUBDIV_MAX }; diff --git a/scene/3d/portal.h b/scene/3d/portal.h index 4ea208a718..a3a7956286 100644 --- a/scene/3d/portal.h +++ b/scene/3d/portal.h @@ -39,7 +39,8 @@ If a portal is placed next (very close to) a similar, opposing portal, they automatically connect, otherwise, a portal connects to the parent room */ -//this will be redone and replaced by area portals, left for reference since a new class with this name will have to exist and want to reuse the gizmos +// FIXME: This will be redone and replaced by area portals, left for reference +// since a new class with this name will have to exist and want to reuse the gizmos #if 0 class Portal : public VisualInstance { diff --git a/scene/3d/room_instance.h b/scene/3d/room_instance.h index 3069ea2eba..2b2f80a0c6 100644 --- a/scene/3d/room_instance.h +++ b/scene/3d/room_instance.h @@ -44,7 +44,7 @@ */ -//this will be removed, left for reference +// FIXME: this will be removed, left for reference #if 0 class Room : public VisualInstance { diff --git a/scene/3d/voxel_light_baker.cpp b/scene/3d/voxel_light_baker.cpp index 032bccf1d3..39ff6fa35e 100644 --- a/scene/3d/voxel_light_baker.cpp +++ b/scene/3d/voxel_light_baker.cpp @@ -897,17 +897,7 @@ void VoxelLightBaker::plot_light_omni(const Vector3 &p_pos, const Color &p_color float dt = CLAMP((d + distance_adv) / local_radius, 0, 1); att *= powf(1.0 - dt, p_attenutation); } -#if 0 - if (light_cache.type == VS::LIGHT_SPOT) { - - float angle = Math::rad2deg(acos(light_axis.dot(spot_axis))); - if (angle > light_cache.spot_angle) - continue; - float d = CLAMP(angle / light_cache.spot_angle, 1, 0); - att *= powf(1.0 - d, light_cache.spot_attenuation); - } -#endif clip_planes = 0; for (int c = 0; c < 3; c++) { @@ -1041,17 +1031,7 @@ void VoxelLightBaker::plot_light_spot(const Vector3 &p_pos, const Vector3 &p_axi float dt = CLAMP((d + distance_adv) / local_radius, 0, 1); att *= powf(1.0 - dt, p_attenutation); } -#if 0 - if (light_cache.type == VS::LIGHT_SPOT) { - - float angle = Math::rad2deg(acos(light_axis.dot(spot_axis))); - if (angle > light_cache.spot_angle) - continue; - float d = CLAMP(angle / light_cache.spot_angle, 1, 0); - att *= powf(1.0 - d, light_cache.spot_attenuation); - } -#endif clip_planes = 0; for (int c = 0; c < 3; c++) { @@ -2016,6 +1996,7 @@ Error VoxelLightBaker::make_lightmap(const Transform &p_xform, Ref<Mesh> &p_mesh } } +// Enable for debugging #if 0 { PoolVector<uint8_t> img; diff --git a/scene/gui/line_edit.cpp b/scene/gui/line_edit.cpp index 85ae6d6241..cebbb2193d 100644 --- a/scene/gui/line_edit.cpp +++ b/scene/gui/line_edit.cpp @@ -85,7 +85,7 @@ void LineEdit::_gui_input(Ref<InputEvent> p_event) { if ((cursor_pos < selection.begin) || (cursor_pos > selection.end) || !selection.enabled) { - selection_clear(); + deselect(); selection.cursor_start = cursor_pos; selection.creating = true; } else if (selection.enabled) { @@ -99,7 +99,7 @@ void LineEdit::_gui_input(Ref<InputEvent> p_event) { } else { if ((!selection.creating) && (!selection.doubleclick)) { - selection_clear(); + deselect(); } selection.creating = false; selection.doubleclick = false; @@ -175,7 +175,7 @@ void LineEdit::_gui_input(Ref<InputEvent> p_event) { if (editable) { - selection_clear(); + deselect(); text = text.substr(cursor_pos, text.length() - cursor_pos); Ref<Font> font = get_font("font"); @@ -204,7 +204,7 @@ void LineEdit::_gui_input(Ref<InputEvent> p_event) { if (editable) { - selection_clear(); + deselect(); text = text.substr(0, cursor_pos); _text_changed(); } @@ -827,7 +827,7 @@ void LineEdit::shift_selection_check_pre(bool p_shift) { selection.cursor_start = cursor_pos; } if (!p_shift) - selection_clear(); + deselect(); } void LineEdit::shift_selection_check_post(bool p_shift) { @@ -880,13 +880,6 @@ void LineEdit::set_cursor_at_pixel_pos(int p_x) { } set_cursor_position(ofs); - - /* - int new_cursor_pos=p_x; - int charwidth=draw_area->get_font_char_width(' ',0); - new_cursor_pos=( ( (new_cursor_pos-2)+ (charwidth/2) ) /charwidth ); - if (new_cursor_pos>(int)text.length()) new_cursor_pos=text.length(); - set_cursor_position(window_pos+new_cursor_pos); */ } bool LineEdit::cursor_get_blink_enabled() const { @@ -941,11 +934,6 @@ void LineEdit::delete_char() { set_cursor_position(get_cursor_position() - 1); - if (cursor_pos == window_pos) { - - //set_window_pos(cursor_pos-get_window_length()); - } - _text_changed(); } @@ -1143,7 +1131,7 @@ Size2 LineEdit::get_minimum_size() const { /* selection */ -void LineEdit::selection_clear() { +void LineEdit::deselect() { selection.begin = 0; selection.end = 0; @@ -1159,7 +1147,7 @@ void LineEdit::selection_delete() { if (selection.enabled) delete_text(selection.begin, selection.end); - selection_clear(); + deselect(); } void LineEdit::set_max_length(int p_max_length) { @@ -1224,7 +1212,7 @@ bool LineEdit::is_secret() const { void LineEdit::select(int p_from, int p_to) { if (p_from == 0 && p_to == 0) { - selection_clear(); + deselect(); return; } @@ -1383,7 +1371,9 @@ void LineEdit::_bind_methods() { ClassDB::bind_method(D_METHOD("_gui_input"), &LineEdit::_gui_input); ClassDB::bind_method(D_METHOD("clear"), &LineEdit::clear); + ClassDB::bind_method(D_METHOD("select", "from", "to"), &LineEdit::select, DEFVAL(0), DEFVAL(-1)); ClassDB::bind_method(D_METHOD("select_all"), &LineEdit::select_all); + ClassDB::bind_method(D_METHOD("deselect"), &LineEdit::deselect); ClassDB::bind_method(D_METHOD("set_text", "text"), &LineEdit::set_text); ClassDB::bind_method(D_METHOD("get_text"), &LineEdit::get_text); ClassDB::bind_method(D_METHOD("set_placeholder", "text"), &LineEdit::set_placeholder); @@ -1405,7 +1395,6 @@ void LineEdit::_bind_methods() { ClassDB::bind_method(D_METHOD("is_editable"), &LineEdit::is_editable); ClassDB::bind_method(D_METHOD("set_secret", "enabled"), &LineEdit::set_secret); ClassDB::bind_method(D_METHOD("is_secret"), &LineEdit::is_secret); - ClassDB::bind_method(D_METHOD("select", "from", "to"), &LineEdit::select, DEFVAL(0), DEFVAL(-1)); ClassDB::bind_method(D_METHOD("menu_option", "option"), &LineEdit::menu_option); ClassDB::bind_method(D_METHOD("get_menu"), &LineEdit::get_menu); ClassDB::bind_method(D_METHOD("set_context_menu_enabled", "enable"), &LineEdit::set_context_menu_enabled); @@ -1457,7 +1446,7 @@ LineEdit::LineEdit() { pass = false; placeholder_alpha = 0.6; - selection_clear(); + deselect(); set_focus_mode(FOCUS_ALL); editable = true; set_default_cursor_shape(CURSOR_IBEAM); diff --git a/scene/gui/line_edit.h b/scene/gui/line_edit.h index c3a299c2f5..5ca4ca15df 100644 --- a/scene/gui/line_edit.h +++ b/scene/gui/line_edit.h @@ -119,7 +119,6 @@ private: void shift_selection_check_pre(bool); void shift_selection_check_post(bool); - void selection_clear(); void selection_fill_at_cursor(); void selection_delete(); void set_window_pos(int p_pos); @@ -155,7 +154,9 @@ public: bool is_context_menu_enabled(); PopupMenu *get_menu() const; + void select(int p_from = 0, int p_to = -1); void select_all(); + void deselect(); void delete_char(); void delete_text(int p_from_column, int p_to_column); @@ -190,8 +191,6 @@ public: void set_secret(bool p_secret); bool is_secret() const; - void select(int p_from = 0, int p_to = -1); - virtual Size2 get_minimum_size() const; void set_expand_to_text_length(bool p_enabled); diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index 83aee5ca30..07f1bdf8e5 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -4084,7 +4084,7 @@ void TextEdit::cut() { backspace_at_cursor(); update(); cursor_set_line(cursor.line + 1); - cut_copy_line = true; + cut_copy_line = clipboard; } else { @@ -4098,7 +4098,7 @@ void TextEdit::cut() { selection.active = false; selection.selecting_mode = Selection::MODE_NONE; update(); - cut_copy_line = false; + cut_copy_line = ""; } } @@ -4107,11 +4107,11 @@ void TextEdit::copy() { if (!selection.active) { String clipboard = _base_get_text(cursor.line, 0, cursor.line, text[cursor.line].length()); OS::get_singleton()->set_clipboard(clipboard); - cut_copy_line = true; + cut_copy_line = clipboard; } else { String clipboard = _base_get_text(selection.from_line, selection.from_column, selection.to_line, selection.to_column); OS::get_singleton()->set_clipboard(clipboard); - cut_copy_line = false; + cut_copy_line = ""; } } @@ -4127,7 +4127,7 @@ void TextEdit::paste() { cursor_set_line(selection.from_line); cursor_set_column(selection.from_column); - } else if (cut_copy_line) { + } else if (!cut_copy_line.empty() && cut_copy_line == clipboard) { cursor_set_column(0); String ins = "\n"; diff --git a/scene/gui/text_edit.h b/scene/gui/text_edit.h index edef28cc25..836d5c7388 100644 --- a/scene/gui/text_edit.h +++ b/scene/gui/text_edit.h @@ -270,7 +270,7 @@ class TextEdit : public Control { bool brace_matching_enabled; bool highlight_current_line; bool auto_indent; - bool cut_copy_line; + String cut_copy_line; bool insert_mode; bool select_identifiers_enabled; diff --git a/scene/resources/mesh.cpp b/scene/resources/mesh.cpp index bb33962be6..bf5f7bf039 100644 --- a/scene/resources/mesh.cpp +++ b/scene/resources/mesh.cpp @@ -1111,13 +1111,14 @@ Error ArrayMesh::lightmap_unwrap(const Transform &p_base_transform, float p_texe for (int j = 0; j < vc; j++) { Vector3 v = p_base_transform.xform(r[j]); + Vector3 n = p_base_transform.basis.xform(rn[j]).normalized(); vertices[(j + vertex_ofs) * 3 + 0] = v.x; vertices[(j + vertex_ofs) * 3 + 1] = v.y; vertices[(j + vertex_ofs) * 3 + 2] = v.z; - normals[(j + vertex_ofs) * 3 + 0] = rn[j].x; - normals[(j + vertex_ofs) * 3 + 1] = rn[j].y; - normals[(j + vertex_ofs) * 3 + 2] = rn[j].z; + normals[(j + vertex_ofs) * 3 + 0] = n.x; + normals[(j + vertex_ofs) * 3 + 1] = n.y; + normals[(j + vertex_ofs) * 3 + 2] = n.z; uv_index[j + vertex_ofs] = Pair<int, int>(i, j); } diff --git a/scene/resources/room.h b/scene/resources/room.h index aadee858c2..0e021cfcf7 100644 --- a/scene/resources/room.h +++ b/scene/resources/room.h @@ -36,7 +36,7 @@ @author Juan Linietsky <reduzio@gmail.com> */ -//left for reference but will be removed when portals are reimplemented using Area +// FIXME: left for reference but will be removed when portals are reimplemented using Area #if 0 class RoomBounds : public Resource { diff --git a/servers/visual/shader_language.cpp b/servers/visual/shader_language.cpp index 47e6190cea..834505df9a 100644 --- a/servers/visual/shader_language.cpp +++ b/servers/visual/shader_language.cpp @@ -1897,62 +1897,6 @@ bool ShaderLanguage::_validate_function_call(BlockNode *p_block, OperatorNode *p return false; } -#if 0 - if (found_builtin) { - - if (p_func->op==OP_CONSTRUCT && all_const) { - - - Vector<float> cdata; - for(int i=0;i<argcount;i++) { - - Variant v = static_cast<ConstantNode*>(p_func->arguments[i+1])->value; - switch(v.get_type()) { - - case Variant::REAL: cdata.push_back(v); break; - case Variant::INT: cdata.push_back(v); break; - case Variant::VECTOR2: { Vector2 v2=v; cdata.push_back(v2.x); cdata.push_back(v2.y); } break; - case Variant::VECTOR3: { Vector3 v3=v; cdata.push_back(v3.x); cdata.push_back(v3.y); cdata.push_back(v3.z);} break; - case Variant::PLANE: { Plane v4=v; cdata.push_back(v4.normal.x); cdata.push_back(v4.normal.y); cdata.push_back(v4.normal.z); cdata.push_back(v4.d); } break; - default: ERR_FAIL_V(NULL); - - } - - } - - ConstantNode *cn = parser.create_node<ConstantNode>(p_func->parent); - Variant data; - switch(p_func->return_cache) { - case TYPE_FLOAT: data = cdata[0]; break; - case TYPE_VEC2: - if (cdata.size()==1) - data = Vector2(cdata[0],cdata[0]); - else - data = Vector2(cdata[0],cdata[1]); - - break; - case TYPE_VEC3: - if (cdata.size()==1) - data = Vector3(cdata[0],cdata[0],cdata[0]); - else - data = Vector3(cdata[0],cdata[1],cdata[2]); - break; - case TYPE_VEC4: - if (cdata.size()==1) - data = Plane(cdata[0],cdata[0],cdata[0],cdata[0]); - else - data = Plane(cdata[0],cdata[1],cdata[2],cdata[3]); - break; - } - - cn->datatype=p_func->return_cache; - cn->value=data; - return cn; - - } - return p_func; - } -#endif // try existing functions.. StringName exclude_function; diff --git a/servers/visual/visual_server_canvas.cpp b/servers/visual/visual_server_canvas.cpp index 0fed9cc961..532546c5fa 100644 --- a/servers/visual/visual_server_canvas.cpp +++ b/servers/visual/visual_server_canvas.cpp @@ -499,7 +499,6 @@ void VisualServerCanvas::canvas_item_add_multiline(RID p_item, const Vector<Poin pline->antialiased = false; //todo pline->multiline = true; - // if (p_width <= 1) { pline->lines = p_points; pline->line_colors = p_colors; if (pline->line_colors.size() == 0) { @@ -507,66 +506,7 @@ void VisualServerCanvas::canvas_item_add_multiline(RID p_item, const Vector<Poin } else if (pline->line_colors.size() > 1 && pline->line_colors.size() != pline->lines.size()) { pline->line_colors.resize(1); } -#if 0 -//width not yet - } else { - //make a trianglestrip for drawing the line... - Vector2 prev_t; - pline->triangles.resize(p_points.size() * 2); - if (p_antialiased) { - pline->lines.resize(p_points.size() * 2); - } - if (p_colors.size() == 0) { - pline->triangle_colors.push_back(Color(1, 1, 1, 1)); - if (p_antialiased) { - pline->line_colors.push_back(Color(1, 1, 1, 1)); - } - } - if (p_colors.size() == 1) { - pline->triangle_colors = p_colors; - pline->line_colors = p_colors; - } else { - pline->triangle_colors.resize(pline->triangles.size()); - pline->line_colors.resize(pline->lines.size()); - } - - for (int i = 0; i < p_points.size(); i++) { - - Vector2 t; - if (i == p_points.size() - 1) { - t = prev_t; - } else { - t = (p_points[i + 1] - p_points[i]).normalized().tangent(); - if (i == 0) { - prev_t = t; - } - } - - Vector2 tangent = ((t + prev_t).normalized()) * p_width * 0.5; - - if (p_antialiased) { - pline->lines[i] = p_points[i] + tangent; - pline->lines[p_points.size() * 2 - i - 1] = p_points[i] - tangent; - if (pline->line_colors.size() > 1) { - pline->line_colors[i] = p_colors[i]; - pline->line_colors[p_points.size() * 2 - i - 1] = p_colors[i]; - } - } - - pline->triangles[i * 2 + 0] = p_points[i] + tangent; - pline->triangles[i * 2 + 1] = p_points[i] - tangent; - - if (pline->triangle_colors.size() > 1) { - - pline->triangle_colors[i * 2 + 0] = p_colors[i]; - pline->triangle_colors[i * 2 + 1] = p_colors[i]; - } - - prev_t = t; - } - } -#endif canvas_item->rect_dirty = true; canvas_item->commands.push_back(pline); } diff --git a/servers/visual/visual_server_scene.h b/servers/visual/visual_server_scene.h index 4b0c4af09d..689e06de93 100644 --- a/servers/visual/visual_server_scene.h +++ b/servers/visual/visual_server_scene.h @@ -69,34 +69,6 @@ public: Portal() { enabled=true; disable_distance=50; disable_color=Color(); connect_range=0.8; } }; - - struct BakedLight { - - Rasterizer::BakedLightData data; - PoolVector<int> sampler; - AABB octree_aabb; - Size2i octree_tex_size; - Size2i light_tex_size; - - }; - - struct BakedLightSampler { - - float params[BAKED_LIGHT_SAMPLER_MAX]; - int resolution; - Vector<Vector3> dp_cache; - - BakedLightSampler() { - params[BAKED_LIGHT_SAMPLER_STRENGTH]=1.0; - params[BAKED_LIGHT_SAMPLER_ATTENUATION]=1.0; - params[BAKED_LIGHT_SAMPLER_RADIUS]=1.0; - params[BAKED_LIGHT_SAMPLER_DETAIL_RATIO]=0.1; - resolution=16; - } - }; - - void _update_baked_light_sampler_dp_cache(BakedLightSampler * blsamp); - #endif /* CAMERA API */ |