diff options
Diffstat (limited to 'tools')
21 files changed, 801 insertions, 175 deletions
diff --git a/tools/editor/animation_editor.cpp b/tools/editor/animation_editor.cpp index 759d33dea8..f256e351ae 100644 --- a/tools/editor/animation_editor.cpp +++ b/tools/editor/animation_editor.cpp @@ -179,12 +179,12 @@ private: bool sg = val < 0; val = Math::absf(val); - val = Math::log(val)/Math::log(2); + val = Math::log(val)/Math::log((float)2.0); //logspace val+=rel*0.05; // - val = Math::pow(2,val); + val = Math::pow((float)2.0,val); if (sg) val=-val; @@ -1055,9 +1055,9 @@ float AnimationKeyEditor::_get_zoom_scale() const { float zv = zoom->get_value(); if (zv<1) { zv = 1.0-zv; - return Math::pow(1.0+zv,8.0)*100; + return Math::pow(1.0f+zv,8.0f)*100; } else { - return 1.0/Math::pow(zv,8.0)*100; + return 1.0/Math::pow(zv,8.0f)*100; } } @@ -1487,8 +1487,8 @@ void AnimationKeyEditor::_track_editor_draw() { //draw the keys; int tt = animation->track_get_type(idx); - float key_vofs = Math::floor((h - type_icon[tt]->get_height())/2); - float key_hofs = -Math::floor(type_icon[tt]->get_height()/2); + float key_vofs = Math::floor((float)(h - type_icon[tt]->get_height())/2); + float key_hofs = -Math::floor((float)type_icon[tt]->get_height()/2); int kc=animation->track_get_key_count(idx); bool first=true; @@ -1592,8 +1592,8 @@ void AnimationKeyEditor::_track_editor_draw() { continue; int y = h+i*h+sep; - float key_vofs = Math::floor((h - type_selected->get_height())/2); - float key_hofs = -Math::floor(type_selected->get_height()/2); + float key_vofs = Math::floor((float)(h - type_selected->get_height())/2); + float key_hofs = -Math::floor((float)type_selected->get_height()/2); float time = animation->track_get_key_time(idx,E->key().key); float diff = time-from_t; diff --git a/tools/editor/editor_audio_buses.cpp b/tools/editor/editor_audio_buses.cpp new file mode 100644 index 0000000000..d570abcc82 --- /dev/null +++ b/tools/editor/editor_audio_buses.cpp @@ -0,0 +1,619 @@ +#include "editor_audio_buses.h" +#include "editor_node.h" +#include "servers/audio_server.h" + + +void EditorAudioBus::_notification(int p_what) { + + if (p_what==NOTIFICATION_READY) { + + vu_l->set_under_texture(get_icon("BusVuEmpty","EditorIcons")); + vu_l->set_progress_texture(get_icon("BusVuFull","EditorIcons")); + vu_r->set_under_texture(get_icon("BusVuEmpty","EditorIcons")); + vu_r->set_progress_texture(get_icon("BusVuFull","EditorIcons")); + scale->set_texture( get_icon("BusVuDb","EditorIcons")); + + disabled_vu = get_icon("BusVuFrozen","EditorIcons"); + + prev_active=true; + update_bus(); + set_process(true); + } + + if (p_what==NOTIFICATION_DRAW) { + + if (has_focus()) { + draw_style_box(get_stylebox("focus","Button"),Rect2(Vector2(),get_size())); + } + } + + if (p_what==NOTIFICATION_PROCESS) { + + float real_peak[2]={-100,-100}; + bool activity_found=false; + + int cc; + switch(AudioServer::get_singleton()->get_speaker_mode()) { + case AudioServer::SPEAKER_MODE_STEREO: cc = 1; break; + case AudioServer::SPEAKER_SURROUND_51: cc = 4; break; + case AudioServer::SPEAKER_SURROUND_71: cc = 5; break; + } + + for(int i=0;i<cc;i++) { + if (AudioServer::get_singleton()->is_bus_channel_active(get_index(),i)) { + activity_found=true; + real_peak[0]=MAX(real_peak[0],AudioServer::get_singleton()->get_bus_peak_volume_left_db(get_index(),i)); + real_peak[1]=MAX(real_peak[1],AudioServer::get_singleton()->get_bus_peak_volume_right_db(get_index(),i)); + } + } + + + if (real_peak[0]>peak_l) { + peak_l = real_peak[0]; + } else { + peak_l-=get_process_delta_time()*60.0; + } + + if (real_peak[1]>peak_r) { + peak_r = real_peak[1]; + } else { + peak_r-=get_process_delta_time()*60.0; + + } + + vu_l->set_value(peak_l); + vu_r->set_value(peak_r); + + if (activity_found!=prev_active) { + if (activity_found) { + vu_l->set_over_texture(Ref<Texture>()); + vu_r->set_over_texture(Ref<Texture>()); + } else { + vu_l->set_over_texture(disabled_vu); + vu_r->set_over_texture(disabled_vu); + + } + + prev_active=activity_found; + } + + } + + if (p_what==NOTIFICATION_VISIBILITY_CHANGED) { + + peak_l=-100; + peak_r=-100; + prev_active=true; + + set_process(is_visible_in_tree()); + } + +} + +void EditorAudioBus::update_send() { + + send->clear(); + if (get_index()==0) { + send->set_disabled(true); + send->set_text("Speakers"); + } else { + send->set_disabled(false); + StringName current_send = AudioServer::get_singleton()->get_bus_send(get_index()); + int current_send_index=0; //by default to master + + for(int i=0;i<get_index();i++) { + StringName send_name = AudioServer::get_singleton()->get_bus_name(i); + send->add_item(send_name); + if (send_name==current_send) { + current_send_index=i; + } + } + + send->select(current_send_index); + } +} + +void EditorAudioBus::update_bus() { + + if (updating_bus) + return; + + updating_bus=true; + + int index = get_index(); + + slider->set_value(AudioServer::get_singleton()->get_bus_volume_db(index)); + track_name->set_text(AudioServer::get_singleton()->get_bus_name(index)); + if (get_index()==0) + track_name->set_editable(false); + + solo->set_pressed( AudioServer::get_singleton()->is_bus_solo(index)); + mute->set_pressed( AudioServer::get_singleton()->is_bus_mute(index)); + bypass->set_pressed( AudioServer::get_singleton()->is_bus_bypassing_effects(index)); + // effects.. + effects->clear(); + + TreeItem *root = effects->create_item(); + for(int i=0;i<AudioServer::get_singleton()->get_bus_effect_count(index);i++) { + + Ref<AudioEffect> afx = AudioServer::get_singleton()->get_bus_effect(index,i); + + TreeItem *fx = effects->create_item(root); + fx->set_cell_mode(0,TreeItem::CELL_MODE_CHECK); + fx->set_editable(0,true); + fx->set_checked(0,AudioServer::get_singleton()->is_bus_effect_enabled(index,i)); + fx->set_text(0,afx->get_name()); + fx->set_metadata(0,i); + + } + + TreeItem *add = effects->create_item(root); + add->set_cell_mode(0,TreeItem::CELL_MODE_CUSTOM); + add->set_editable(0,true); + add->set_selectable(0,false); + add->set_text(0,"Add Effect"); + + update_send(); + + updating_bus=false; + +} + + +void EditorAudioBus::_name_changed(const String& p_new_name) { + + if (p_new_name==AudioServer::get_singleton()->get_bus_name(get_index())) + return; + + String attempt=p_new_name; + int attempts=1; + + while(true) { + + bool name_free=true; + for(int i=0;i<AudioServer::get_singleton()->get_bus_count();i++) { + + if (AudioServer::get_singleton()->get_bus_name(i)==attempt) { + name_free=false; + break; + } + } + + if (name_free) { + break; + } + + attempts++; + attempt=p_new_name+" "+itos(attempts); + } + updating_bus=true; + + UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo(); + + StringName current = AudioServer::get_singleton()->get_bus_name(get_index()); + ur->create_action("Rename Audio Bus"); + ur->add_do_method(AudioServer::get_singleton(),"set_bus_name",get_index(),attempt); + ur->add_undo_method(AudioServer::get_singleton(),"set_bus_name",get_index(),current); + + for(int i=0;i<AudioServer::get_singleton()->get_bus_count();i++) { + if (AudioServer::get_singleton()->get_bus_send(i)==current) { + ur->add_do_method(AudioServer::get_singleton(),"set_bus_send",i,attempt); + ur->add_undo_method(AudioServer::get_singleton(),"set_bus_send",i,current); + } + } + + ur->add_do_method(buses,"_update_bus",get_index()); + ur->add_undo_method(buses,"_update_bus",get_index()); + + + ur->add_do_method(buses,"_update_sends"); + ur->add_undo_method(buses,"_update_sends"); + ur->commit_action(); + + updating_bus=false; + +} + +void EditorAudioBus::_volume_db_changed(float p_db){ + + if (updating_bus) + return; + + updating_bus=true; + + print_line("new volume: "+rtos(p_db)); + UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo(); + ur->create_action("Change Audio Bus Volume",UndoRedo::MERGE_ENDS); + ur->add_do_method(AudioServer::get_singleton(),"set_bus_volume_db",get_index(),p_db); + ur->add_undo_method(AudioServer::get_singleton(),"set_bus_volume_db",get_index(),AudioServer::get_singleton()->get_bus_volume_db(get_index())); + ur->add_do_method(buses,"_update_bus",get_index()); + ur->add_undo_method(buses,"_update_bus",get_index()); + ur->commit_action(); + + updating_bus=false; + +} +void EditorAudioBus::_solo_toggled(){ + + updating_bus=true; + + UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo(); + ur->create_action("Toggle Audio Bus Solo"); + ur->add_do_method(AudioServer::get_singleton(),"set_bus_solo",get_index(),solo->is_pressed()); + ur->add_undo_method(AudioServer::get_singleton(),"set_bus_solo",get_index(),AudioServer::get_singleton()->is_bus_solo(get_index())); + ur->add_do_method(buses,"_update_bus",get_index()); + ur->add_undo_method(buses,"_update_bus",get_index()); + ur->commit_action(); + + updating_bus=false; + +} +void EditorAudioBus::_mute_toggled(){ + + updating_bus=true; + + UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo(); + ur->create_action("Toggle Audio Bus Mute"); + ur->add_do_method(AudioServer::get_singleton(),"set_bus_mute",get_index(),mute->is_pressed()); + ur->add_undo_method(AudioServer::get_singleton(),"set_bus_mute",get_index(),AudioServer::get_singleton()->is_bus_mute(get_index())); + ur->add_do_method(buses,"_update_bus",get_index()); + ur->add_undo_method(buses,"_update_bus",get_index()); + ur->commit_action(); + + updating_bus=false; + +} +void EditorAudioBus::_bypass_toggled(){ + + updating_bus=true; + + UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo(); + ur->create_action("Toggle Audio Bus Bypass Effects"); + ur->add_do_method(AudioServer::get_singleton(),"set_bus_bypass_effects",get_index(),bypass->is_pressed()); + ur->add_undo_method(AudioServer::get_singleton(),"set_bus_bypass_effects",get_index(),AudioServer::get_singleton()->is_bus_bypassing_effects(get_index())); + ur->add_do_method(buses,"_update_bus",get_index()); + ur->add_undo_method(buses,"_update_bus",get_index()); + ur->commit_action(); + + updating_bus=false; + + +} + +void EditorAudioBus::_send_selected(int p_which) { + + updating_bus=true; + + UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo(); + ur->create_action("Select Audio Bus Send"); + ur->add_do_method(AudioServer::get_singleton(),"set_bus_send",get_index(),send->get_item_text(p_which)); + ur->add_undo_method(AudioServer::get_singleton(),"set_bus_send",get_index(),AudioServer::get_singleton()->get_bus_send(get_index())); + ur->add_do_method(buses,"_update_bus",get_index()); + ur->add_undo_method(buses,"_update_bus",get_index()); + ur->commit_action(); + + updating_bus=false; +} + +void EditorAudioBus::_effect_selected() { + + TreeItem *effect = effects->get_selected(); + if (!effect) + return; + updating_bus=true; + + if (effect->get_metadata(0)!=Variant()) { + + int index = effect->get_metadata(0); + Ref<AudioEffect> effect = AudioServer::get_singleton()->get_bus_effect(get_index(),index); + if (effect.is_valid()) { + EditorNode::get_singleton()->push_item(effect.ptr()); + } + } + + updating_bus=false; + +} + +void EditorAudioBus::_effect_edited() { + + if (updating_bus) + return; + + TreeItem *effect = effects->get_edited(); + if (!effect) + return; + + if (effect->get_metadata(0)==Variant()) { + Rect2 area = effects->get_item_rect(effect); + + effect_options->set_pos(effects->get_global_pos()+area.pos+Vector2(0,area.size.y)); + effect_options->popup(); + //add effect + } else { + int index = effect->get_metadata(0); + updating_bus=true; + + UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo(); + ur->create_action("Select Audio Bus Send"); + ur->add_do_method(AudioServer::get_singleton(),"set_bus_effect_enabled",get_index(),index,effect->is_checked(0)); + ur->add_undo_method(AudioServer::get_singleton(),"set_bus_effect_enabled",get_index(),index,AudioServer::get_singleton()->is_bus_effect_enabled(get_index(),index)); + ur->add_do_method(buses,"_update_bus",get_index()); + ur->add_undo_method(buses,"_update_bus",get_index()); + ur->commit_action(); + + updating_bus=false; + + } + +} + +void EditorAudioBus::_effect_add(int p_which) { + + if (updating_bus) + return; + + StringName name = effect_options->get_item_metadata(p_which); + + Object *fx = ClassDB::instance(name); + ERR_FAIL_COND(!fx); + AudioEffect *afx = fx->cast_to<AudioEffect>(); + ERR_FAIL_COND(!afx); + Ref<AudioEffect> afxr = Ref<AudioEffect>(afx); + + afxr->set_name(effect_options->get_item_text(p_which)); + + UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo(); + ur->create_action("Add Audio Bus Effect"); + ur->add_do_method(AudioServer::get_singleton(),"add_bus_effect",get_index(),afxr,-1); + ur->add_undo_method(AudioServer::get_singleton(),"remove_bus_effect",get_index(),AudioServer::get_singleton()->get_bus_effect_count(get_index())); + ur->add_do_method(buses,"_update_bus",get_index()); + ur->add_undo_method(buses,"_update_bus",get_index()); + ur->commit_action(); +} + +void EditorAudioBus::_bind_methods() { + + ClassDB::bind_method("update_bus",&EditorAudioBus::update_bus); + ClassDB::bind_method("update_send",&EditorAudioBus::update_send); + ClassDB::bind_method("_name_changed",&EditorAudioBus::_name_changed); + ClassDB::bind_method("_volume_db_changed",&EditorAudioBus::_volume_db_changed); + ClassDB::bind_method("_solo_toggled",&EditorAudioBus::_solo_toggled); + ClassDB::bind_method("_mute_toggled",&EditorAudioBus::_mute_toggled); + ClassDB::bind_method("_bypass_toggled",&EditorAudioBus::_bypass_toggled); + ClassDB::bind_method("_name_focus_exit",&EditorAudioBus::_name_focus_exit); + ClassDB::bind_method("_send_selected",&EditorAudioBus::_send_selected); + ClassDB::bind_method("_effect_edited",&EditorAudioBus::_effect_edited); + ClassDB::bind_method("_effect_selected",&EditorAudioBus::_effect_selected); + ClassDB::bind_method("_effect_add",&EditorAudioBus::_effect_add); +} + +EditorAudioBus::EditorAudioBus(EditorAudioBuses *p_buses) { + + buses=p_buses; + updating_bus=false; + + VBoxContainer *vb = memnew( VBoxContainer ); + add_child(vb); + + set_v_size_flags(SIZE_EXPAND_FILL); + + track_name = memnew( LineEdit ); + vb->add_child(track_name); + track_name->connect("text_entered",this,"_name_changed"); + track_name->connect("focus_exited",this,"_name_focus_exit"); + + HBoxContainer *hbc = memnew( HBoxContainer); + vb->add_child(hbc); + hbc->add_spacer(); + solo = memnew( ToolButton ); + solo->set_text("S"); + solo->set_toggle_mode(true); + solo->set_modulate(Color(0.8,1.2,0.8)); + solo->set_focus_mode(FOCUS_NONE); + solo->connect("pressed",this,"_solo_toggled"); + hbc->add_child(solo); + mute = memnew( ToolButton ); + mute->set_text("M"); + mute->set_toggle_mode(true); + mute->set_modulate(Color(1.2,0.8,0.8)); + mute->set_focus_mode(FOCUS_NONE); + mute->connect("pressed",this,"_mute_toggled"); + hbc->add_child(mute); + bypass = memnew( ToolButton ); + bypass->set_text("B"); + bypass->set_toggle_mode(true); + bypass->set_modulate(Color(1.1,1.1,0.8)); + bypass->set_focus_mode(FOCUS_NONE); + bypass->connect("pressed",this,"_bypass_toggled"); + hbc->add_child(bypass); + hbc->add_spacer(); + + HBoxContainer *hb = memnew( HBoxContainer ); + vb->add_child(hb); + slider = memnew( VSlider ); + slider->set_min(-80); + slider->set_max(24); + slider->set_step(0.1); + + slider->connect("value_changed",this,"_volume_db_changed"); + hb->add_child(slider); + vu_l = memnew( TextureProgress ); + vu_l->set_fill_mode(TextureProgress::FILL_BOTTOM_TO_TOP); + hb->add_child(vu_l); + vu_l->set_min(-80); + vu_l->set_max(24); + vu_l->set_step(0.1); + + vu_r = memnew( TextureProgress ); + vu_r->set_fill_mode(TextureProgress::FILL_BOTTOM_TO_TOP); + hb->add_child(vu_r); + vu_r->set_min(-80); + vu_r->set_max(24); + vu_r->set_step(0.1); + + scale = memnew( TextureRect ); + hb->add_child(scale); + + add_child(hb); + + effects = memnew( Tree ); + effects->set_hide_root(true); + effects->set_custom_minimum_size(Size2(0,90)*EDSCALE); + effects->set_hide_folding(true); + vb->add_child(effects); + effects->connect("item_edited",this,"_effect_edited"); + effects->connect("cell_selected",this,"_effect_selected"); + effects->set_edit_checkbox_cell_only_when_checkbox_is_pressed(true); + + + send = memnew( OptionButton ); + send->set_clip_text(true); + send->connect("item_selected",this,"_send_selected"); + vb->add_child(send); + + set_focus_mode(FOCUS_CLICK); + + effect_options = memnew( PopupMenu ); + effect_options->connect("index_pressed",this,"_effect_add"); + add_child(effect_options); + List<StringName> effects; + ClassDB::get_inheriters_from_class("AudioEffect",&effects); + effects.sort_custom<StringName::AlphCompare>(); + for (List<StringName>::Element *E=effects.front();E;E=E->next()) { + if (!ClassDB::can_instance(E->get())) + continue; + + Ref<Texture> icon; + if (has_icon(E->get(),"EditorIcons")) { + icon = get_icon(E->get(),"EditorIcons"); + } + String name = E->get().operator String().replace("AudioEffect",""); + effect_options->add_item(name); + effect_options->set_item_metadata(effect_options->get_item_count()-1,E->get()); + effect_options->set_item_icon(effect_options->get_item_count()-1,icon); + } + + +} + + +void EditorAudioBuses::_update_buses() { + + while(bus_hb->get_child_count()>0) { + memdelete(bus_hb->get_child(0)); + } + + for(int i=0;i<AudioServer::get_singleton()->get_bus_count();i++) { + + EditorAudioBus *audio_bus = memnew( EditorAudioBus(this) ); + if (i==0) { + audio_bus->set_self_modulate(Color(1,0.9,0.9)); + } + bus_hb->add_child(audio_bus); + + } +} + +void EditorAudioBuses::register_editor() { + + EditorAudioBuses * audio_buses = memnew( EditorAudioBuses ); + EditorNode::get_singleton()->add_bottom_panel_item("Audio",audio_buses); +} + +void EditorAudioBuses::_notification(int p_what) { + + if (p_what==NOTIFICATION_READY) { + _update_buses(); + } +} + + +void EditorAudioBuses::_add_bus() { + + UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo(); + + //need to simulate new name, so we can undi :( + ur->create_action("Add Audio Bus"); + ur->add_do_method(AudioServer::get_singleton(),"set_bus_count",AudioServer::get_singleton()->get_bus_count()+1); + ur->add_undo_method(AudioServer::get_singleton(),"set_bus_count",AudioServer::get_singleton()->get_bus_count()); + ur->add_do_method(this,"_update_buses"); + ur->add_undo_method(this,"_update_buses"); + ur->commit_action(); + +} + +void EditorAudioBuses::_update_bus(int p_index) { + + if (p_index>=bus_hb->get_child_count()) + return; + + bus_hb->get_child(p_index)->call("update_bus"); +} + +void EditorAudioBuses::_update_sends() { + + for(int i=0;i<bus_hb->get_child_count();i++) { + bus_hb->get_child(i)->call("update_send"); + } +} + +void EditorAudioBuses::_bind_methods() { + + ClassDB::bind_method("_add_bus",&EditorAudioBuses::_add_bus); + ClassDB::bind_method("_update_buses",&EditorAudioBuses::_update_buses); + ClassDB::bind_method("_update_bus",&EditorAudioBuses::_update_bus); + ClassDB::bind_method("_update_sends",&EditorAudioBuses::_update_sends); +} + +EditorAudioBuses::EditorAudioBuses() +{ + + top_hb = memnew( HBoxContainer ); + add_child(top_hb); + + add = memnew( Button ); + top_hb->add_child(add);; + add->set_text(TTR("Add")); + + add->connect("pressed",this,"_add_bus"); + + Ref<ButtonGroup> bg; + bg.instance(); + + buses = memnew( ToolButton ); + top_hb->add_child(buses); + buses->set_text(TTR("Buses")); + buses->set_button_group(bg); + buses->set_toggle_mode(true); + buses->set_pressed(true); + + groups = memnew( ToolButton ); + top_hb->add_child(groups); + groups->set_text(TTR("Groups")); + groups->set_button_group(bg); + groups->set_toggle_mode(true); + + bus_scroll = memnew( ScrollContainer ); + bus_scroll->set_v_size_flags(SIZE_EXPAND_FILL); + bus_scroll->set_enable_h_scroll(true); + bus_scroll->set_enable_v_scroll(false); + add_child(bus_scroll); + bus_hb = memnew( HBoxContainer ); + bus_scroll->add_child(bus_hb); + + group_scroll = memnew( ScrollContainer ); + group_scroll->set_v_size_flags(SIZE_EXPAND_FILL); + group_scroll->set_enable_h_scroll(true); + group_scroll->set_enable_v_scroll(false); + add_child(group_scroll); + group_hb = memnew( HBoxContainer ); + group_scroll->add_child(group_hb); + + group_scroll->hide(); + + + set_v_size_flags(SIZE_EXPAND_FILL); + + +} diff --git a/tools/editor/editor_audio_buses.h b/tools/editor/editor_audio_buses.h new file mode 100644 index 0000000000..8787101393 --- /dev/null +++ b/tools/editor/editor_audio_buses.h @@ -0,0 +1,106 @@ +#ifndef EDITORAUDIOBUSES_H +#define EDITORAUDIOBUSES_H + + +#include "scene/gui/box_container.h" +#include "scene/gui/button.h" +#include "scene/gui/tool_button.h" +#include "scene/gui/scroll_container.h" +#include "scene/gui/panel_container.h" +#include "scene/gui/slider.h" +#include "scene/gui/texture_progress.h" +#include "scene/gui/texture_rect.h" +#include "scene/gui/line_edit.h" +#include "scene/gui/tree.h" +#include "scene/gui/option_button.h" + +class EditorAudioBuses; + +class EditorAudioBus : public PanelContainer { + + GDCLASS( EditorAudioBus, PanelContainer ) + + bool prev_active; + float peak_l; + float peak_r; + + Ref<Texture> disabled_vu; + LineEdit *track_name; + VSlider *slider; + TextureProgress *vu_l; + TextureProgress *vu_r; + TextureRect *scale; + OptionButton *send; + + PopupMenu *effect_options; + + Button *solo; + Button *mute; + Button *bypass; + + Tree *effects; + + bool updating_bus; + + void _name_changed(const String& p_new_name); + void _name_focus_exit() { _name_changed(track_name->get_text()); } + void _volume_db_changed(float p_db); + void _solo_toggled(); + void _mute_toggled(); + void _bypass_toggled(); + void _send_selected(int p_which); + void _effect_edited(); + void _effect_add(int p_which); + void _effect_selected(); + +friend class EditorAudioBuses; + + EditorAudioBuses *buses; + +protected: + + static void _bind_methods(); + void _notification(int p_what); +public: + + void update_bus(); + void update_send(); + + EditorAudioBus(EditorAudioBuses *p_buses=NULL); +}; + + +class EditorAudioBuses : public VBoxContainer { + + GDCLASS(EditorAudioBuses,VBoxContainer) + + HBoxContainer *top_hb; + + Button *add; + ToolButton *buses; + ToolButton *groups; + ScrollContainer *bus_scroll; + HBoxContainer *bus_hb; + ScrollContainer *group_scroll; + HBoxContainer *group_hb; + + void _add_bus(); + void _update_buses(); + void _update_bus(int p_index); + void _update_sends(); + + +protected: + + static void _bind_methods(); + void _notification(int p_what); +public: + + + + static void register_editor(); + + EditorAudioBuses(); +}; + +#endif // EDITORAUDIOBUSES_H diff --git a/tools/editor/editor_node.cpp b/tools/editor/editor_node.cpp index 0c8d786f03..9adb82a3b4 100644 --- a/tools/editor/editor_node.cpp +++ b/tools/editor/editor_node.cpp @@ -115,6 +115,7 @@ #include "plugins/editor_preview_plugins.h" #include "editor_initialize_ssl.h" +#include "editor_audio_buses.h" #include "script_editor_debugger.h" EditorNode *EditorNode::singleton=NULL; @@ -189,6 +190,9 @@ void EditorNode::_unhandled_input(const InputEvent& p_event) { next_tab = next_tab >= 0 ? next_tab : editor_data.get_edited_scene_count() - 1; _scene_tab_changed(next_tab); } + if (ED_IS_SHORTCUT("editor/filter_files", p_event)) { + filesystem_dock->focus_on_filter(); + } switch(p_event.key.scancode) { @@ -1934,7 +1938,7 @@ void EditorNode::_run(bool p_current,const String& p_custom) { List<String> breakpoints; editor_data.get_editor_breakpoints(&breakpoints); - + args = GlobalConfig::get_singleton()->get("editor/main_run_args"); Error error = editor_run.run(run_filename,args,breakpoints,current_filename); @@ -2075,14 +2079,6 @@ void EditorNode::_menu_option_confirm(int p_option,bool p_confirmed) { quick_open->set_title(TTR("Quick Open Script..")); } break; - case FILE_QUICK_OPEN_FILE: { - - - //quick_open->popup("Resource", false, true); - //quick_open->set_title("Quick Search File.."); - scenes_dock->focus_on_filter(); - - } break; case FILE_RUN_SCRIPT: { file_script->popup_centered_ratio(); @@ -2807,10 +2803,10 @@ void EditorNode::_menu_option_confirm(int p_option,bool p_confirmed) { update_menu->get_popup()->set_item_checked(1,true); OS::get_singleton()->set_low_processor_usage_mode(true); } break; - case SETTINGS_UPDATE_SPINNER_HIDE: { + case SETTINGS_UPDATE_SPINNER_HIDE: { update_menu->set_icon(gui_base->get_icon("Collapse","EditorIcons")); - update_menu->get_popup()->toggle_item_checked(3); - } break; + update_menu->get_popup()->toggle_item_checked(3); + } break; case SETTINGS_PREFERENCES: { settings_config_dialog->popup_edit_settings(); @@ -2935,16 +2931,7 @@ void EditorNode::_menu_option_confirm(int p_option,bool p_confirmed) { default: { - if (p_option>=TOOL_MENU_BASE) { - int idx = p_option - TOOL_MENU_BASE; - - if (tool_menu_items[idx].submenu != "") - break; - - Object *handler = ObjectDB::get_instance(tool_menu_items[idx].handler); - ERR_FAIL_COND(!handler); - handler->call(tool_menu_items[idx].callback, tool_menu_items[idx].ud); - } else if (p_option>=OBJECT_METHOD_BASE) { + if (p_option>=OBJECT_METHOD_BASE) { ERR_FAIL_COND(!current); @@ -3861,9 +3848,9 @@ void EditorNode::request_instance_scenes(const Vector<String>& p_files) { scene_tree_dock->instance_scenes(p_files); } -FileSystemDock *EditorNode::get_scenes_dock() { +FileSystemDock *EditorNode::get_filesystem_dock() { - return scenes_dock; + return filesystem_dock; } SceneTreeDock *EditorNode::get_scene_tree_dock() { @@ -5187,7 +5174,7 @@ Variant EditorNode::drag_files_and_dirs(const Vector<String>& p_files, Control * void EditorNode::_dropped_files(const Vector<String>& p_files,int p_screen) { - String cur_path = scenes_dock->get_current_path(); + String cur_path = filesystem_dock->get_current_path(); for(int i=0;i<EditorImportExport::get_singleton()->get_import_plugin_count();i++) { EditorImportExport::get_singleton()->get_import_plugin(i)->import_from_drop(p_files,cur_path); } @@ -5279,100 +5266,6 @@ void EditorNode::add_plugin_init_callback(EditorPluginInitializeCallback p_callb EditorPluginInitializeCallback EditorNode::plugin_init_callbacks[EditorNode::MAX_INIT_CALLBACKS]; -void EditorNode::_tool_menu_insert_item(const ToolMenuItem& p_item) { - - int idx = tool_menu_items.size(); - - String cat; - if (p_item.name.find("/") >= 0) { - cat = p_item.name.get_slice("/", 0); - } else { - idx = 0; - cat = ""; - } - - for (int i = tool_menu_items.size() - 1; i >= 0; i--) { - String name = tool_menu_items[i].name; - - if (name.begins_with(cat) && (cat != "" || name.find("/") < 0)) { - idx = i + 1; - break; - } - } - - tool_menu_items.insert(idx, p_item); -} - -void EditorNode::_rebuild_tool_menu() const { - - if (_initializing_tool_menu) - return; - - PopupMenu *menu = tool_menu->get_popup(); - menu->clear(); - - for (int i = 0; i < tool_menu_items.size(); i++) { - menu->add_item(tool_menu_items[i].name.get_slice("/", 1), TOOL_MENU_BASE + i); - - if (tool_menu_items[i].submenu != "") - menu->set_item_submenu(i, tool_menu_items[i].submenu); - } -} - -void EditorNode::add_tool_menu_item(const String& p_name, Object *p_handler, const String& p_callback, const Variant& p_ud) { - - ERR_FAIL_COND(!p_handler); - - ToolMenuItem tmi; - tmi.name = p_name; - tmi.submenu = ""; - tmi.ud = p_ud; - tmi.handler = p_handler->get_instance_ID(); - tmi.callback = p_callback; - _tool_menu_insert_item(tmi); - - _rebuild_tool_menu(); -} - -void EditorNode::add_tool_submenu_item(const String& p_name, PopupMenu *p_submenu) { - - ERR_FAIL_COND(!p_submenu); - ERR_FAIL_COND(p_submenu->get_parent() != NULL); - - ToolMenuItem tmi; - tmi.name = p_name; - tmi.submenu = p_submenu->get_name(); - tmi.ud = Variant(); - tmi.handler = -1; - tmi.callback = ""; - _tool_menu_insert_item(tmi); - - tool_menu->get_popup()->add_child(p_submenu); - - _rebuild_tool_menu(); -} - -void EditorNode::remove_tool_menu_item(const String& p_name) { - - for (int i = 0; i < tool_menu_items.size(); i++) { - if (tool_menu_items[i].name == p_name) { - String submenu = tool_menu_items[i].submenu; - - if (submenu != "") { - Node *n = tool_menu->get_popup()->get_node(submenu); - - if (n) { - tool_menu->get_popup()->remove_child(n); - memdelete(n); - } - } - - tool_menu_items.remove(i); - } - } - - _rebuild_tool_menu(); -} int EditorNode::build_callback_count=0; @@ -5516,8 +5409,6 @@ EditorNode::EditorNode() { docks_visible = true; - _initializing_tool_menu = true; - FileAccess::set_backup_save(true); PathRemap::get_singleton()->clear_remaps(); //editor uses no remaps @@ -5860,6 +5751,7 @@ EditorNode::EditorNode() { ED_SHORTCUT("editor/next_tab", TTR("Next tab"), KEY_MASK_CMD+KEY_TAB); ED_SHORTCUT("editor/prev_tab", TTR("Previous tab"), KEY_MASK_CMD+KEY_MASK_SHIFT+KEY_TAB); + ED_SHORTCUT("editor/filter_files", TTR("Filter Files.."), KEY_MASK_ALT+KEY_MASK_CMD+KEY_P); file_menu->set_tooltip(TTR("Operations with scene files.")); @@ -5879,7 +5771,6 @@ EditorNode::EditorNode() { p->add_separator(); p->add_shortcut(ED_SHORTCUT("editor/quick_open_scene",TTR("Quick Open Scene.."),KEY_MASK_SHIFT+KEY_MASK_CMD+KEY_O),FILE_QUICK_OPEN_SCENE); p->add_shortcut(ED_SHORTCUT("editor/quick_open_script",TTR("Quick Open Script.."),KEY_MASK_ALT+KEY_MASK_CMD+KEY_O),FILE_QUICK_OPEN_SCRIPT); - p->add_shortcut(ED_SHORTCUT("editor/quick_filter_files",TTR("Quick Filter Files.."),KEY_MASK_ALT+KEY_MASK_CMD+KEY_P),FILE_QUICK_OPEN_FILE); p->add_separator(); PopupMenu *pm_export = memnew(PopupMenu ); @@ -5977,9 +5868,10 @@ EditorNode::EditorNode() { //tool_menu->set_icon(gui_base->get_icon("Save","EditorIcons")); left_menu_hb->add_child( tool_menu ); - tool_menu->get_popup()->connect("id_pressed", this, "_menu_option"); - add_tool_menu_item(TTR("Orphan Resource Explorer"), this, "_menu_option", TOOLS_ORPHAN_RESOURCES); + p=tool_menu->get_popup(); + p->connect("id_pressed",this,"_menu_option"); + p->add_item(TTR("Orphan Resource Explorer"),TOOLS_ORPHAN_RESOURCES); export_button = memnew( ToolButton ); export_button->set_tooltip(TTR("Export the project to many platforms.")); @@ -6376,21 +6268,21 @@ EditorNode::EditorNode() { dock_slot[DOCK_SLOT_RIGHT_BL]->add_child(node_dock); } - scenes_dock = memnew( FileSystemDock(this) ); - scenes_dock->set_name(TTR("FileSystem")); - scenes_dock->set_display_mode(int(EditorSettings::get_singleton()->get("docks/filesystem/display_mode"))); + filesystem_dock = memnew( FileSystemDock(this) ); + filesystem_dock->set_name(TTR("FileSystem")); + filesystem_dock->set_display_mode(int(EditorSettings::get_singleton()->get("docks/filesystem/display_mode"))); if (use_single_dock_column) { - dock_slot[DOCK_SLOT_RIGHT_BL]->add_child(scenes_dock); + dock_slot[DOCK_SLOT_RIGHT_BL]->add_child(filesystem_dock); left_r_vsplit->hide(); dock_slot[DOCK_SLOT_LEFT_UR]->hide(); dock_slot[DOCK_SLOT_LEFT_BR]->hide(); } else { - dock_slot[DOCK_SLOT_LEFT_UR]->add_child(scenes_dock); + dock_slot[DOCK_SLOT_LEFT_UR]->add_child(filesystem_dock); } - //prop_pallete->add_child(scenes_dock); - scenes_dock->connect("open",this,"open_request"); - scenes_dock->connect("instance",this,"_instance_request"); + //prop_pallete->add_child(filesystem_dock); + filesystem_dock->connect("open",this,"open_request"); + filesystem_dock->connect("instance",this,"_instance_request"); const String docks_section = "docks"; @@ -6663,6 +6555,9 @@ EditorNode::EditorNode() { add_editor_plugin( memnew( SpatialEditorPlugin(this) ) ); add_editor_plugin( memnew( ScriptEditorPlugin(this) ) ); + + EditorAudioBuses::register_editor(); + ScriptTextEditor::register_editor(); //register one for text scripts if (StreamPeerSSL::is_available()) { @@ -6860,8 +6755,7 @@ EditorNode::EditorNode() { _initializing_addons=false; } - _initializing_tool_menu = false; - _rebuild_tool_menu(); + _load_docks(); diff --git a/tools/editor/editor_node.h b/tools/editor/editor_node.h index 2baa9091ff..fbba7ae7a9 100644 --- a/tools/editor/editor_node.h +++ b/tools/editor/editor_node.h @@ -139,7 +139,6 @@ private: FILE_OPEN_OLD_SCENE, FILE_QUICK_OPEN_SCENE, FILE_QUICK_OPEN_SCRIPT, - FILE_QUICK_OPEN_FILE, FILE_RUN_SCRIPT, FILE_OPEN_PREV, FILE_CLOSE, @@ -280,7 +279,7 @@ private: PropertyEditor *property_editor; NodeDock *node_dock; VBoxContainer *prop_editor_vb; - FileSystemDock *scenes_dock; + FileSystemDock *filesystem_dock; EditorRunNative *run_native; HBoxContainer *search_bar; @@ -706,7 +705,7 @@ public: void request_instance_scene(const String &p_path); void request_instance_scenes(const Vector<String>& p_files); - FileSystemDock *get_scenes_dock(); + FileSystemDock *get_filesystem_dock(); SceneTreeDock *get_scene_tree_dock(); static UndoRedo* get_undo_redo() { return &singleton->editor_data.get_undo_redo(); } diff --git a/tools/editor/editor_plugin.cpp b/tools/editor/editor_plugin.cpp index 69be7f8a4d..2f59b0bd07 100644 --- a/tools/editor/editor_plugin.cpp +++ b/tools/editor/editor_plugin.cpp @@ -136,7 +136,7 @@ void EditorPlugin::add_control_to_container(CustomControlContainer p_location,Co void EditorPlugin::add_tool_menu_item(const String& p_name, Object *p_handler, const String& p_callback, const Variant& p_ud) { - EditorNode::get_singleton()->add_tool_menu_item(p_name, p_handler, p_callback, p_ud); + //EditorNode::get_singleton()->add_tool_menu_item(p_name, p_handler, p_callback, p_ud); } void EditorPlugin::add_tool_submenu_item(const String& p_name, Object *p_submenu) { @@ -144,12 +144,12 @@ void EditorPlugin::add_tool_submenu_item(const String& p_name, Object *p_submenu ERR_FAIL_NULL(p_submenu); PopupMenu *submenu = p_submenu->cast_to<PopupMenu>(); ERR_FAIL_NULL(submenu); - EditorNode::get_singleton()->add_tool_submenu_item(p_name, submenu); + //EditorNode::get_singleton()->add_tool_submenu_item(p_name, submenu); } void EditorPlugin::remove_tool_menu_item(const String& p_name) { - EditorNode::get_singleton()->remove_tool_menu_item(p_name); + //EditorNode::get_singleton()->remove_tool_menu_item(p_name); } Ref<SpatialEditorGizmo> EditorPlugin::create_spatial_gizmo(Spatial* p_spatial) { @@ -371,9 +371,9 @@ void EditorPlugin::_bind_methods() { ClassDB::bind_method(_MD("add_control_to_dock","slot","control:Control"),&EditorPlugin::add_control_to_dock); ClassDB::bind_method(_MD("remove_control_from_docks","control:Control"),&EditorPlugin::remove_control_from_docks); ClassDB::bind_method(_MD("remove_control_from_bottom_panel","control:Control"),&EditorPlugin::remove_control_from_bottom_panel); - ClassDB::bind_method(_MD("add_tool_menu_item", "name", "handler", "callback", "ud"),&EditorPlugin::add_tool_menu_item,DEFVAL(Variant())); + //ClassDB::bind_method(_MD("add_tool_menu_item", "name", "handler", "callback", "ud"),&EditorPlugin::add_tool_menu_item,DEFVAL(Variant())); ClassDB::bind_method(_MD("add_tool_submenu_item", "name", "submenu:PopupMenu"),&EditorPlugin::add_tool_submenu_item); - ClassDB::bind_method(_MD("remove_tool_menu_item", "name"),&EditorPlugin::remove_tool_menu_item); + //ClassDB::bind_method(_MD("remove_tool_menu_item", "name"),&EditorPlugin::remove_tool_menu_item); ClassDB::bind_method(_MD("add_custom_type","type","base","script:Script","icon:Texture"),&EditorPlugin::add_custom_type); ClassDB::bind_method(_MD("remove_custom_type","type"),&EditorPlugin::remove_custom_type); ClassDB::bind_method(_MD("get_editor_viewport:Control"), &EditorPlugin::get_editor_viewport); diff --git a/tools/editor/filesystem_dock.cpp b/tools/editor/filesystem_dock.cpp index b85bd6dfdb..26a118521b 100644 --- a/tools/editor/filesystem_dock.cpp +++ b/tools/editor/filesystem_dock.cpp @@ -170,7 +170,7 @@ void FileSystemDock::_notification(int p_what) { _update_tree(); //maybe it finished already if (EditorFileSystem::get_singleton()->is_scanning()) { - _set_scannig_mode(); + _set_scanning_mode(); } } break; @@ -662,7 +662,7 @@ void FileSystemDock::_fs_changed() { set_process(false); } -void FileSystemDock::_set_scannig_mode() { +void FileSystemDock::_set_scanning_mode() { split_box->hide(); button_hist_prev->set_disabled(true); @@ -1174,7 +1174,7 @@ void FileSystemDock::_search_changed(const String& p_text) { void FileSystemDock::_rescan() { - _set_scannig_mode(); + _set_scanning_mode(); EditorFileSystem::get_singleton()->scan(); } @@ -1186,6 +1186,14 @@ void FileSystemDock::fix_dependencies(const String& p_for_file) { void FileSystemDock::focus_on_filter() { + if (!search_box->is_visible_in_tree()) { + // Tree mode, switch to files list with search box + tree->hide(); + file_list_vb->show(); + button_favorite->hide(); + } + + search_box->grab_focus(); } void FileSystemDock::set_display_mode(int p_mode) { diff --git a/tools/editor/filesystem_dock.h b/tools/editor/filesystem_dock.h index ccd43847d6..382fcf198d 100644 --- a/tools/editor/filesystem_dock.h +++ b/tools/editor/filesystem_dock.h @@ -153,7 +153,7 @@ private: void _dir_selected(); void _update_tree(); void _rescan(); - void _set_scannig_mode(); + void _set_scanning_mode(); void _favorites_pressed(); diff --git a/tools/editor/icons/icon_audio_effect_amplify.png b/tools/editor/icons/icon_audio_effect_amplify.png Binary files differnew file mode 100644 index 0000000000..9af3227d40 --- /dev/null +++ b/tools/editor/icons/icon_audio_effect_amplify.png diff --git a/tools/editor/icons/icon_bus_vu_db.png b/tools/editor/icons/icon_bus_vu_db.png Binary files differnew file mode 100644 index 0000000000..52507cae52 --- /dev/null +++ b/tools/editor/icons/icon_bus_vu_db.png diff --git a/tools/editor/icons/icon_bus_vu_empty.png b/tools/editor/icons/icon_bus_vu_empty.png Binary files differnew file mode 100644 index 0000000000..6fc3143a55 --- /dev/null +++ b/tools/editor/icons/icon_bus_vu_empty.png diff --git a/tools/editor/icons/icon_bus_vu_frozen.png b/tools/editor/icons/icon_bus_vu_frozen.png Binary files differnew file mode 100644 index 0000000000..cf128afa91 --- /dev/null +++ b/tools/editor/icons/icon_bus_vu_frozen.png diff --git a/tools/editor/icons/icon_bus_vu_full.png b/tools/editor/icons/icon_bus_vu_full.png Binary files differnew file mode 100644 index 0000000000..9e3d7a93e3 --- /dev/null +++ b/tools/editor/icons/icon_bus_vu_full.png diff --git a/tools/editor/icons/icon_vu_db.png b/tools/editor/icons/icon_vu_db.png Binary files differnew file mode 100644 index 0000000000..405a929e2a --- /dev/null +++ b/tools/editor/icons/icon_vu_db.png diff --git a/tools/editor/io_plugins/editor_font_import_plugin.cpp b/tools/editor/io_plugins/editor_font_import_plugin.cpp index ada6000d82..0deb5cbbfa 100644 --- a/tools/editor/io_plugins/editor_font_import_plugin.cpp +++ b/tools/editor/io_plugins/editor_font_import_plugin.cpp @@ -1473,7 +1473,7 @@ Ref<BitmapFont> EditorFontImportPlugin::generate_font(const Ref<ResourceImportMe sum+=w2[ofs_l]; } - wa[ofs]=Math::pow(float(sum/(r*2+1))/255.0,tr)*255.0; + wa[ofs]=Math::pow(float(sum/(r*2+1))/255.0f,tr)*255.0f; } } diff --git a/tools/editor/io_plugins/editor_sample_import_plugin.cpp b/tools/editor/io_plugins/editor_sample_import_plugin.cpp index ca873cab72..631291ec1b 100644 --- a/tools/editor/io_plugins/editor_sample_import_plugin.cpp +++ b/tools/editor/io_plugins/editor_sample_import_plugin.cpp @@ -541,7 +541,7 @@ Error EditorSampleImportPlugin::import(const String& p_path, const Ref<ResourceI int first=0; int last=(len*chans)-1; bool found=false; - float limit = Math::db2linear(-30); + float limit = Math::db2linear((float)-30); for(int i=0;i<data.size();i++) { float amp = Math::abs(data[i]); diff --git a/tools/editor/plugins/multimesh_editor_plugin.cpp b/tools/editor/plugins/multimesh_editor_plugin.cpp index 80765be6c0..6259ddf473 100644 --- a/tools/editor/plugins/multimesh_editor_plugin.cpp +++ b/tools/editor/plugins/multimesh_editor_plugin.cpp @@ -216,7 +216,7 @@ void MultiMeshEditor::_populate() { for(int i=0;i<instance_count;i++) { - float areapos = Math::random(0,area_accum); + float areapos = Math::random(0.0f,area_accum); Map<float,int>::Element *E = triangle_area_map.find_closest(areapos); ERR_FAIL_COND(!E) diff --git a/tools/editor/plugins/spatial_editor_plugin.cpp b/tools/editor/plugins/spatial_editor_plugin.cpp index 4b67df3a98..9f8367ff1d 100644 --- a/tools/editor/plugins/spatial_editor_plugin.cpp +++ b/tools/editor/plugins/spatial_editor_plugin.cpp @@ -3437,7 +3437,7 @@ void SpatialEditor::_instance_scene() { #if 0 EditorNode *en = get_scene()->get_root_node()->cast_to<EditorNode>(); ERR_FAIL_COND(!en); - String path = en->get_scenes_dock()->get_selected_path(); + String path = en->get_filesystem_dock()->get_selected_path(); if (path=="") { set_message(TTR("No scene selected to instance!")); return; diff --git a/tools/editor/property_editor.cpp b/tools/editor/property_editor.cpp index 5326671f41..ab850ba1a7 100644 --- a/tools/editor/property_editor.cpp +++ b/tools/editor/property_editor.cpp @@ -1503,12 +1503,12 @@ void CustomPropertyEditor::_drag_easing(const InputEvent& p_ev) { bool sg = val < 0; val = Math::absf(val); - val = Math::log(val)/Math::log(2); + val = Math::log(val)/Math::log((float)2.0); //logspace val+=rel*0.05; // - val = Math::pow(2,val); + val = Math::pow(2.0f,val); if (sg) val=-val; diff --git a/tools/editor/script_editor_debugger.cpp b/tools/editor/script_editor_debugger.cpp index 42ab234d4b..d5cca06820 100644 --- a/tools/editor/script_editor_debugger.cpp +++ b/tools/editor/script_editor_debugger.cpp @@ -826,7 +826,7 @@ void ScriptEditorDebugger::_performance_draw() { Ref<StyleBox> graph_sb = get_stylebox("normal","TextEdit"); Ref<Font> graph_font = get_font("font","TextEdit"); - int cols = Math::ceil(Math::sqrt(which.size())); + int cols = Math::ceil(Math::sqrt((float)which.size())); int rows = (which.size()+1)/cols; if (which.size()==1) rows=1; diff --git a/tools/editor/spatial_editor_gizmos.cpp b/tools/editor/spatial_editor_gizmos.cpp index adbac4b12b..c670245282 100644 --- a/tools/editor/spatial_editor_gizmos.cpp +++ b/tools/editor/spatial_editor_gizmos.cpp @@ -839,8 +839,8 @@ void LightSpatialGizmo::redraw() { for(int i=0;i<=360;i++) { - float ra=Math::deg2rad(i); - float rb=Math::deg2rad(i+1); + float ra=Math::deg2rad((float)i); + float rb=Math::deg2rad((float)i+1); Point2 a = Vector2(Math::sin(ra),Math::cos(ra))*r; Point2 b = Vector2(Math::sin(rb),Math::cos(rb))*r; @@ -881,8 +881,8 @@ void LightSpatialGizmo::redraw() { for(int i=0;i<360;i++) { - float ra=Math::deg2rad(i); - float rb=Math::deg2rad(i+1); + float ra=Math::deg2rad((float)i); + float rb=Math::deg2rad((float)i+1); Point2 a = Vector2(Math::sin(ra),Math::cos(ra))*w; Point2 b = Vector2(Math::sin(rb),Math::cos(rb))*w; @@ -1519,8 +1519,8 @@ void VehicleWheelSpatialGizmo::redraw() { const int skip=10; for(int i=0;i<=360;i+=skip) { - float ra=Math::deg2rad(i); - float rb=Math::deg2rad(i+skip); + float ra=Math::deg2rad((float)i); + float rb=Math::deg2rad((float)i+skip); Point2 a = Vector2(Math::sin(ra),Math::cos(ra))*r; Point2 b = Vector2(Math::sin(rb),Math::cos(rb))*r; @@ -1826,8 +1826,8 @@ void CollisionShapeSpatialGizmo::redraw(){ for(int i=0;i<=360;i++) { - float ra=Math::deg2rad(i); - float rb=Math::deg2rad(i+1); + float ra=Math::deg2rad((float)i); + float rb=Math::deg2rad((float)i+1); Point2 a = Vector2(Math::sin(ra),Math::cos(ra))*r; Point2 b = Vector2(Math::sin(rb),Math::cos(rb))*r; @@ -1907,8 +1907,8 @@ void CollisionShapeSpatialGizmo::redraw(){ Vector3 d(0,0,height*0.5); for(int i=0;i<360;i++) { - float ra=Math::deg2rad(i); - float rb=Math::deg2rad(i+1); + float ra=Math::deg2rad((float)i); + float rb=Math::deg2rad((float)i+1); Point2 a = Vector2(Math::sin(ra),Math::cos(ra))*radius; Point2 b = Vector2(Math::sin(rb),Math::cos(rb))*radius; @@ -2844,8 +2844,8 @@ void ConeTwistJointSpatialGizmo::redraw() { //swing for(int i=0;i<360;i+=10) { - float ra=Math::deg2rad(i); - float rb=Math::deg2rad(i+10); + float ra=Math::deg2rad((float)i); + float rb=Math::deg2rad((float)i+10); Point2 a = Vector2(Math::sin(ra),Math::cos(ra))*w; Point2 b = Vector2(Math::sin(rb),Math::cos(rb))*w; @@ -2876,8 +2876,8 @@ void ConeTwistJointSpatialGizmo::redraw() { for(int i=0;i<int(ts);i+=5) { - float ra=Math::deg2rad(i); - float rb=Math::deg2rad(i+5); + float ra=Math::deg2rad((float)i); + float rb=Math::deg2rad((float)i+5); float c = i/720.0; float cn = (i+5)/720.0; Point2 a = Vector2(Math::sin(ra),Math::cos(ra))*w*c; |