This commit is contained in:
Juan Linietsky 2015-06-06 11:09:41 -03:00
commit 14c4c1b568
77 changed files with 2414 additions and 215 deletions

View File

@ -1396,6 +1396,13 @@ Globals::Globals() {
va.push_back(joyb);
set("input/ui_accept",va);
va=Array();
key.key.scancode=KEY_SPACE;
va.push_back(key);
joyb.joy_button.button_index=JOY_BUTTON_3;
va.push_back(joyb);
set("input/ui_select",va);
va=Array();
key.key.scancode=KEY_ESCAPE;
va.push_back(key);

View File

@ -36,7 +36,7 @@
PacketPeer::PacketPeer() {
last_get_error=OK;
}
Error PacketPeer::get_packet_buffer(DVector<uint8_t> &r_buffer) const {
@ -108,10 +108,29 @@ Variant PacketPeer::_bnd_get_var() const {
return var;
};
Error PacketPeer::_put_packet(const DVector<uint8_t> &p_buffer) {
return put_packet_buffer(p_buffer);
}
DVector<uint8_t> PacketPeer::_get_packet() const {
DVector<uint8_t> raw;
last_get_error=get_packet_buffer(raw);
return raw;
}
Error PacketPeer::_get_packet_error() const {
return last_get_error;
}
void PacketPeer::_bind_methods() {
ObjectTypeDB::bind_method(_MD("get_var"),&PacketPeer::_bnd_get_var);
ObjectTypeDB::bind_method(_MD("put_var", "var:var"),&PacketPeer::put_var);
ObjectTypeDB::bind_method(_MD("get_packet:Error"),&PacketPeer::_get_packet);
ObjectTypeDB::bind_method(_MD("put_packet", "buffer"),&PacketPeer::_get_packet);
ObjectTypeDB::bind_method(_MD("get_packet_error:Error"),&PacketPeer::_get_packet_error);
ObjectTypeDB::bind_method(_MD("get_available_packet_count"),&PacketPeer::get_available_packet_count);
};

View File

@ -41,6 +41,14 @@ class PacketPeer : public Reference {
static void _bind_methods();
Error _put_packet(const DVector<uint8_t> &p_buffer);
DVector<uint8_t> _get_packet() const;
Error _get_packet_error() const;
mutable Error last_get_error;
public:
virtual int get_available_packet_count() const=0;

View File

@ -226,6 +226,29 @@ struct Rect2 {
return true;
}
inline float distance_to(const Vector2& p_point) const {
float dist = 1e20;
if (p_point.x < pos.x) {
dist=MIN(dist,pos.x-p_point.x);
}
if (p_point.y < pos.y) {
dist=MIN(dist,pos.y-p_point.y);
}
if (p_point.x >= (pos.x+size.x) ) {
dist=MIN(p_point.x-(pos.x+size.x),dist);
}
if (p_point.y >= (pos.y+size.y) ) {
dist=MIN(p_point.y-(pos.y+size.y),dist);
}
if (dist==1e20)
return 0;
else
return dist;
}
_FORCE_INLINE_ bool intersects_transformed(const Matrix32& p_xform, const Rect2& p_rect) const;
bool intersects_segment(const Point2& p_from, const Point2& p_to, Point2* r_pos=NULL, Point2* r_normal=NULL) const;

View File

@ -5214,7 +5214,7 @@ bool RasterizerGLES2::_setup_material(const Geometry *p_geometry,const Material
DEBUG_TEST_ERROR("Material arameters");
if (p_material->shader_cache->uses_time) {
material_shader.set_uniform(MaterialShaderGLES2::TIME,Math::fmod(last_time,300.0));
material_shader.set_uniform(MaterialShaderGLES2::TIME,Math::fmod(last_time,shader_time_rollback));
draw_next_frame=true;
}
//if uses TIME - draw_next_frame=true
@ -9219,7 +9219,7 @@ void RasterizerGLES2::_canvas_item_setup_shader_uniforms(CanvasItemMaterial *mat
}
if (shader->uses_time) {
canvas_shader.set_uniform(CanvasShaderGLES2::TIME,Math::fmod(last_time,300.0));
canvas_shader.set_uniform(CanvasShaderGLES2::TIME,Math::fmod(last_time,shader_time_rollback));
draw_next_frame=true;
}
//if uses TIME - draw_next_frame=true
@ -10814,6 +10814,8 @@ void RasterizerGLES2::init() {
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);// unbind
#endif
shader_time_rollback = GLOBAL_DEF("rasterizer/shader_time_rollback",300);
using_canvas_bg=false;
_update_framebuffer();
DEBUG_TEST_ERROR("Initializing");

View File

@ -1273,6 +1273,7 @@ class RasterizerGLES2 : public Rasterizer {
Environment *current_env;
VS::ScenarioDebugMode current_debug;
RID overdraw_material;
float shader_time_rollback;
mutable MaterialShaderGLES2 material_shader;

193
godot.creator.user.RG2068 Normal file
View File

@ -0,0 +1,193 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 3.3.0, 2015-06-01T19:30:41. -->
<qtcreator>
<data>
<variable>EnvironmentId</variable>
<value type="QByteArray">{6e68b27c-e98a-4fc6-8922-8c1a204b4713}</value>
</data>
<data>
<variable>ProjectExplorer.Project.ActiveTarget</variable>
<value type="int">0</value>
</data>
<data>
<variable>ProjectExplorer.Project.EditorSettings</variable>
<valuemap type="QVariantMap">
<value type="bool" key="EditorConfiguration.AutoIndent">true</value>
<value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value>
<value type="bool" key="EditorConfiguration.CamelCaseNavigation">true</value>
<valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0">
<value type="QString" key="language">Cpp</value>
<valuemap type="QVariantMap" key="value">
<value type="QByteArray" key="CurrentPreferences">CppGlobal</value>
</valuemap>
</valuemap>
<valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1">
<value type="QString" key="language">QmlJS</value>
<valuemap type="QVariantMap" key="value">
<value type="QByteArray" key="CurrentPreferences">QmlJSGlobal</value>
</valuemap>
</valuemap>
<value type="int" key="EditorConfiguration.CodeStyle.Count">2</value>
<value type="QByteArray" key="EditorConfiguration.Codec">UTF-8</value>
<value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value>
<value type="int" key="EditorConfiguration.IndentSize">4</value>
<value type="bool" key="EditorConfiguration.KeyboardTooltips">false</value>
<value type="int" key="EditorConfiguration.MarginColumn">80</value>
<value type="bool" key="EditorConfiguration.MouseHiding">true</value>
<value type="bool" key="EditorConfiguration.MouseNavigation">true</value>
<value type="int" key="EditorConfiguration.PaddingMode">1</value>
<value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value>
<value type="bool" key="EditorConfiguration.ShowMargin">false</value>
<value type="int" key="EditorConfiguration.SmartBackspaceBehavior">0</value>
<value type="bool" key="EditorConfiguration.SpacesForTabs">true</value>
<value type="int" key="EditorConfiguration.TabKeyBehavior">0</value>
<value type="int" key="EditorConfiguration.TabSize">8</value>
<value type="bool" key="EditorConfiguration.UseGlobal">true</value>
<value type="int" key="EditorConfiguration.Utf8BomBehavior">1</value>
<value type="bool" key="EditorConfiguration.addFinalNewLine">true</value>
<value type="bool" key="EditorConfiguration.cleanIndentation">true</value>
<value type="bool" key="EditorConfiguration.cleanWhitespace">true</value>
<value type="bool" key="EditorConfiguration.inEntireDocument">false</value>
</valuemap>
</data>
<data>
<variable>ProjectExplorer.Project.PluginSettings</variable>
<valuemap type="QVariantMap"/>
</data>
<data>
<variable>ProjectExplorer.Project.Target.0</variable>
<valuemap type="QVariantMap">
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{c3e3ea66-641c-4cd9-9de4-d23a3cd559d2}</value>
<value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
<value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
<value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">C:/Users/reduz/coding/godot</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<valuelist type="QVariantList" key="GenericProjectManager.GenericMakeStep.BuildTargets">
<value type="QString">all</value>
</valuelist>
<value type="bool" key="GenericProjectManager.GenericMakeStep.Clean">false</value>
<value type="QString" key="GenericProjectManager.GenericMakeStep.MakeArguments"></value>
<value type="QString" key="GenericProjectManager.GenericMakeStep.MakeCommand">c:\users\reduz\coding\godot\make.bat</value>
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">GenericProjectManager.GenericMakeStep</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<valuelist type="QVariantList" key="GenericProjectManager.GenericMakeStep.BuildTargets">
<value type="QString">clean</value>
</valuelist>
<value type="bool" key="GenericProjectManager.GenericMakeStep.Clean">true</value>
<value type="QString" key="GenericProjectManager.GenericMakeStep.MakeArguments"></value>
<value type="QString" key="GenericProjectManager.GenericMakeStep.MakeCommand"></value>
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">GenericProjectManager.GenericMakeStep</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Default</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Default</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">GenericProjectManager.GenericBuildConfiguration</value>
</valuemap>
<value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">1</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy locally</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value>
</valuemap>
<value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
<valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
<value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
<value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
<value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
<value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
<value type="int" key="Analyzer.Valgrind.LeakCheckOnFinish">1</value>
<value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
<valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
<value type="int" key="Analyzer.Valgrind.SelfModifyingCodeDetection">1</value>
<value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value>
<value type="bool" key="Analyzer.Valgrind.ShowReachable">false</value>
<value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
<value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
<valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
<value type="int">0</value>
<value type="int">1</value>
<value type="int">2</value>
<value type="int">3</value>
<value type="int">4</value>
<value type="int">5</value>
<value type="int">6</value>
<value type="int">7</value>
<value type="int">8</value>
<value type="int">9</value>
<value type="int">10</value>
<value type="int">11</value>
<value type="int">12</value>
<value type="int">13</value>
<value type="int">14</value>
</valuelist>
<value type="int" key="PE.EnvironmentAspect.Base">2</value>
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
<value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.Arguments"></value>
<value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.Executable"></value>
<value type="bool" key="ProjectExplorer.CustomExecutableRunConfiguration.UseTerminal">false</value>
<value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.WorkingDirectory">%{buildDir}</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Custom Executable</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.CustomExecutableRunConfiguration</value>
<value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
<value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
<value type="bool" key="RunConfiguration.UseMultiProcess">false</value>
<value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
</valuemap>
<value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
</valuemap>
</data>
<data>
<variable>ProjectExplorer.Project.TargetCount</variable>
<value type="int">1</value>
</data>
<data>
<variable>ProjectExplorer.Project.Updater.FileVersion</variable>
<value type="int">18</value>
</data>
<data>
<variable>Version</variable>
<value type="int">18</value>
</data>
</qtcreator>

View File

@ -352,8 +352,9 @@ static void clear_touches() {
// Generate IDs for a framebuffer object and a color renderbuffer
UIScreen* mainscr = [UIScreen mainScreen];
printf("******** screen size %i, %i\n", (int)mainscr.currentMode.size.width, (int)mainscr.currentMode.size.height);
if (mainscr.currentMode.size.width == 640 || mainscr.currentMode.size.width == 960) // modern iphone, can go to 640x960
self.contentScaleFactor = 2.0;
float minPointSize = MIN(mainscr.bounds.size.width, mainscr.bounds.size.height);
float minScreenSize = MIN(mainscr.currentMode.size.width, mainscr.currentMode.size.height);
self.contentScaleFactor = minScreenSize / minPointSize;
glGenFramebuffersOES(1, &viewFramebuffer);
glGenRenderbuffersOES(1, &viewRenderbuffer);

View File

@ -535,6 +535,39 @@ uint32_t Area2D::get_layer_mask() const {
return layer_mask;
}
void Area2D::set_collision_mask_bit(int p_bit, bool p_value) {
uint32_t mask = get_collision_mask();
if (p_value)
mask|=1<<p_bit;
else
mask&=~(1<<p_bit);
set_collision_mask(mask);
}
bool Area2D::get_collision_mask_bit(int p_bit) const{
return get_collision_mask()&(1<<p_bit);
}
void Area2D::set_layer_mask_bit(int p_bit, bool p_value) {
uint32_t mask = get_layer_mask();
if (p_value)
mask|=1<<p_bit;
else
mask&=~(1<<p_bit);
set_layer_mask(mask);
}
bool Area2D::get_layer_mask_bit(int p_bit) const{
return get_layer_mask()&(1<<p_bit);
}
void Area2D::_bind_methods() {
@ -571,6 +604,12 @@ void Area2D::_bind_methods() {
ObjectTypeDB::bind_method(_MD("set_layer_mask","layer_mask"),&Area2D::set_layer_mask);
ObjectTypeDB::bind_method(_MD("get_layer_mask"),&Area2D::get_layer_mask);
ObjectTypeDB::bind_method(_MD("set_collision_mask_bit","bit","value"),&Area2D::set_collision_mask_bit);
ObjectTypeDB::bind_method(_MD("get_collision_mask_bit","bit"),&Area2D::get_collision_mask_bit);
ObjectTypeDB::bind_method(_MD("set_layer_mask_bit","bit","value"),&Area2D::set_layer_mask_bit);
ObjectTypeDB::bind_method(_MD("get_layer_mask_bit","bit"),&Area2D::get_layer_mask_bit);
ObjectTypeDB::bind_method(_MD("set_enable_monitoring","enable"),&Area2D::set_enable_monitoring);
ObjectTypeDB::bind_method(_MD("is_monitoring_enabled"),&Area2D::is_monitoring_enabled);

View File

@ -159,6 +159,12 @@ public:
void set_layer_mask(uint32_t p_mask);
uint32_t get_layer_mask() const;
void set_collision_mask_bit(int p_bit, bool p_value);
bool get_collision_mask_bit(int p_bit) const;
void set_layer_mask_bit(int p_bit, bool p_value);
bool get_layer_mask_bit(int p_bit) const;
Array get_overlapping_bodies() const; //function for script
Array get_overlapping_areas() const; //function for script

View File

@ -85,6 +85,14 @@ void PhysicsBody2D::_bind_methods() {
ObjectTypeDB::bind_method(_MD("get_layer_mask"),&PhysicsBody2D::get_layer_mask);
ObjectTypeDB::bind_method(_MD("set_collision_mask","mask"),&PhysicsBody2D::set_collision_mask);
ObjectTypeDB::bind_method(_MD("get_collision_mask"),&PhysicsBody2D::get_collision_mask);
ObjectTypeDB::bind_method(_MD("set_collision_mask_bit","bit","value"),&PhysicsBody2D::set_collision_mask_bit);
ObjectTypeDB::bind_method(_MD("get_collision_mask_bit","bit"),&PhysicsBody2D::get_collision_mask_bit);
ObjectTypeDB::bind_method(_MD("set_layer_mask_bit","bit","value"),&PhysicsBody2D::set_layer_mask_bit);
ObjectTypeDB::bind_method(_MD("get_layer_mask_bit","bit"),&PhysicsBody2D::get_layer_mask_bit);
ObjectTypeDB::bind_method(_MD("_set_layers","mask"),&PhysicsBody2D::_set_layers);
ObjectTypeDB::bind_method(_MD("_get_layers"),&PhysicsBody2D::_get_layers);
ObjectTypeDB::bind_method(_MD("set_one_way_collision_direction","dir"),&PhysicsBody2D::set_one_way_collision_direction);
@ -122,6 +130,37 @@ uint32_t PhysicsBody2D::get_collision_mask() const {
return collision_mask;
}
void PhysicsBody2D::set_collision_mask_bit(int p_bit, bool p_value) {
uint32_t mask = get_collision_mask();
if (p_value)
mask|=1<<p_bit;
else
mask&=~(1<<p_bit);
set_collision_mask(mask);
}
bool PhysicsBody2D::get_collision_mask_bit(int p_bit) const{
return get_collision_mask()&(1<<p_bit);
}
void PhysicsBody2D::set_layer_mask_bit(int p_bit, bool p_value) {
uint32_t mask = get_layer_mask();
if (p_value)
mask|=1<<p_bit;
else
mask&=~(1<<p_bit);
set_layer_mask(mask);
}
bool PhysicsBody2D::get_layer_mask_bit(int p_bit) const{
return get_layer_mask()&(1<<p_bit);
}
PhysicsBody2D::PhysicsBody2D(Physics2DServer::BodyMode p_mode) : CollisionObject2D( Physics2DServer::get_singleton()->body_create(p_mode), false) {

View File

@ -61,6 +61,13 @@ public:
void set_collision_mask(uint32_t p_mask);
uint32_t get_collision_mask() const;
void set_collision_mask_bit(int p_bit, bool p_value);
bool get_collision_mask_bit(int p_bit) const;
void set_layer_mask_bit(int p_bit, bool p_value);
bool get_layer_mask_bit(int p_bit) const;
void add_collision_exception_with(Node* p_node); //must be physicsbody
void remove_collision_exception_with(Node* p_node);

View File

@ -626,10 +626,11 @@ void Spatial::rotate_z(float p_radians){
void Spatial::translate(const Vector3& p_offset){
Transform t =get_transform();
t.origin+=p_offset;
t.translate(p_offset);
set_transform(t);
}
void Spatial::scale(const Vector3& p_ratio){
Transform t =get_transform();

1048
scene/gui/item_list.cpp Normal file

File diff suppressed because it is too large Load Diff

132
scene/gui/item_list.h Normal file
View File

@ -0,0 +1,132 @@
#ifndef ITEMLIST_H
#define ITEMLIST_H
#include "scene/gui/control.h"
#include "scene/gui/scroll_bar.h"
class ItemList : public Control {
OBJ_TYPE( ItemList, Control );
public:
enum IconMode {
ICON_MODE_TOP,
ICON_MODE_LEFT
};
enum SelectMode {
SELECT_SINGLE,
SELECT_MULTI
};
private:
struct Item {
Ref<Texture> icon;
Ref<Texture> tag_icon;
String text;
bool selectable;
bool selected;
bool disabled;
Variant metadata;
String tooltip;
Rect2 rect_cache;
};
int current;
bool shape_changed;
Vector<Item> items;
Vector<int> separators;
SelectMode select_mode;
IconMode icon_mode;
VScrollBar *scroll_bar;
uint64_t search_time_msec;
String search_string;
int current_columns;
int fixed_column_width;
int max_text_lines;
int max_columns;
Size2 min_icon_size;
void _scroll_changed(double);
void _input_event(const InputEvent& p_event);
protected:
void _notification(int p_what);
static void _bind_methods();
public:
void add_item(const String& p_item,const Ref<Texture>& p_texture=Ref<Texture>(),bool p_selectable=true);
void add_icon_item(const Ref<Texture>& p_item,bool p_selectable=true);
void set_item_text(int p_idx,const String& p_text);
String get_item_text(int p_idx) const;
void set_item_icon(int p_idx,const Ref<Texture>& p_icon);
Ref<Texture> get_item_icon(int p_idx) const;
void set_item_selectable(int p_idx,bool p_selectable);
bool is_item_selectable(int p_idx) const;
void set_item_disabled(int p_idx,bool p_disabled);
bool is_item_disabled(int p_idx) const;
void set_item_metadata(int p_idx,const Variant& p_metadata);
Variant get_item_metadata(int p_idx) const;
void set_item_tag_icon(int p_idx,const Ref<Texture>& p_tag_icon);
Ref<Texture> get_item_tag_icon(int p_idx) const;
void set_item_tooltip(int p_idx,const String& p_tooltip);
String get_item_tooltip(int p_idx) const;
void select(int p_idx,bool p_single=true);
void unselect(int p_idx);
bool is_selected(int p_idx) const;
void set_current(int p_current);
int get_current() const;
int get_item_count() const;
void remove_item(int p_idx);
void clear();
void set_fixed_column_width(int p_size);
int get_fixed_column_width() const;
void set_max_text_lines(int p_amount);
int get_max_text_lines() const;
void set_max_columns(int p_amount);
int get_max_columns() const;
void set_select_mode(SelectMode p_mode);
SelectMode get_select_mode() const;
void set_icon_mode(IconMode p_mode);
IconMode get_icon_mode() const;
void set_min_icon_size(const Size2& p_size);
Size2 get_min_icon_size() const;
void ensure_current_is_visible();
virtual String get_tooltip(const Point2& p_pos) const;
ItemList();
~ItemList();
};
VARIANT_ENUM_CAST(ItemList::SelectMode);
VARIANT_ENUM_CAST(ItemList::IconMode);
#endif // ITEMLIST_H

View File

@ -66,6 +66,7 @@
#include "scene/gui/file_dialog.h"
#include "scene/gui/dialogs.h"
#include "scene/gui/tree.h"
#include "scene/gui/item_list.h"
#include "scene/gui/text_edit.h"
#include "scene/gui/texture_button.h"
#include "scene/gui/separator.h"
@ -327,7 +328,7 @@ void register_scene_types() {
ObjectTypeDB::register_type<HButtonArray>();
ObjectTypeDB::register_type<VButtonArray>();
ObjectTypeDB::register_type<TextureProgress>();
ObjectTypeDB::register_type<ItemList>();
#ifndef ADVANCED_GUI_DISABLED
@ -335,6 +336,7 @@ void register_scene_types() {
ObjectTypeDB::register_type<LineEdit>();
ObjectTypeDB::register_type<PopupMenu>();
ObjectTypeDB::register_type<Tree>();
ObjectTypeDB::register_type<TextEdit>();
ObjectTypeDB::register_virtual_type<TreeItem>();

View File

@ -574,7 +574,7 @@ void make_default_theme() {
// Tree
Ref<StyleBoxTexture> tree_selected = make_stylebox( selection_png,4,4,4,4,8,0,8,0);
Ref<StyleBoxTexture> tree_selected_oof = make_stylebox( selection_oof_png,4,4,4,4,8,0,8,0);
Ref<StyleBoxTexture> tree_selected_oof = make_stylebox( selection_oof_png,4,4,4,4,8,0,8,0);
t->set_stylebox("bg","Tree", make_stylebox( tree_bg_png,4,4,4,5) );
t->set_stylebox("bg_focus","Tree", focus );
@ -605,12 +605,31 @@ void make_default_theme() {
t->set_color("guide_color","Tree", Color(0,0,0,0.1) );
t->set_constant("hseparation","Tree",4);
t->set_constant("vseparation","Tree",2);
t->set_constant("vseparation","Tree",4);
t->set_constant("guide_width","Tree",2);
t->set_constant("item_margin","Tree",12);
t->set_constant("button_margin","Tree",4);
// ItemList
Ref<StyleBoxTexture> item_selected = make_stylebox( selection_png,4,4,4,4,8,2,8,2);
Ref<StyleBoxTexture> item_selected_oof = make_stylebox( selection_oof_png,4,4,4,4,8,2,8,2);
t->set_stylebox("bg","ItemList", make_stylebox( tree_bg_png,4,4,4,5) );
t->set_stylebox("bg_focus","ItemList", focus );
t->set_constant("hseparation","ItemList",4);
t->set_constant("vseparation","ItemList",2);
t->set_constant("icon_margin","ItemList",4);
t->set_constant("line_separation","ItemList",2);
t->set_font("font","ItemList", default_font );
t->set_color("font_color","ItemList", control_font_color_low );
t->set_color("font_color_selected","ItemList", control_font_color_pressed );
t->set_color("guide_color","ItemList", Color(0,0,0,0.1) );
t->set_stylebox("selected","ItemList", item_selected_oof );
t->set_stylebox("selected_focus","ItemList", item_selected );
t->set_stylebox("cursor","ItemList", focus );
t->set_stylebox("cursor_unfocused","ItemList", focus );
// TextEdit

View File

@ -43,6 +43,7 @@ void EditorDirDialog::_update_dir(TreeItem* p_item) {
da->list_dir_begin();
String p=da->get_next();
List<String> dirs;
bool ishidden;
bool show_hidden = EditorSettings::get_singleton()->get("file_dialog/show_hidden_files");
@ -52,16 +53,22 @@ void EditorDirDialog::_update_dir(TreeItem* p_item) {
if (show_hidden || !ishidden) {
if (da->current_is_dir() && !p.begins_with(".")) {
TreeItem *ti = tree->create_item(p_item);
ti->set_text(0,p);
ti->set_icon(0,get_icon("Folder","EditorIcons"));
ti->set_collapsed(true);
dirs.push_back(p);
}
}
p=da->get_next();
}
dirs.sort();
for(List<String>::Element *E=dirs.front();E;E=E->next()) {
TreeItem *ti = tree->create_item(p_item);
ti->set_text(0,E->get());
ti->set_icon(0,get_icon("Folder","EditorIcons"));
ti->set_collapsed(true);
}
memdelete(da);
updating=false;

View File

@ -4,8 +4,8 @@
#include "print_string.h"
#include "os/keyboard.h"
#include "editor_resource_preview.h"
#include "editor_settings.h"
#include "scene/gui/margin_container.h"
EditorFileDialog::GetIconFunc EditorFileDialog::get_icon_func=NULL;
EditorFileDialog::GetIconFunc EditorFileDialog::get_large_icon_func=NULL;
@ -19,6 +19,21 @@ VBoxContainer *EditorFileDialog::get_vbox() {
}
void EditorFileDialog::_notification(int p_what) {
if (p_what==NOTIFICATION_ENTER_TREE) {
mode_thumbnails->set_icon(get_icon("FileThumbnail","EditorIcons"));
mode_list->set_icon(get_icon("FileList","EditorIcons"));
dir_prev->set_icon(get_icon("ArrowLeft","EditorIcons"));
dir_next->set_icon(get_icon("ArrowRight","EditorIcons"));
dir_up->set_icon(get_icon("ArrowUp","EditorIcons"));
favorite->set_icon(get_icon("Favorites","EditorIcons"));
fav_up->set_icon(get_icon("MoveUp","EditorIcons"));
fav_down->set_icon(get_icon("MoveDown","EditorIcons"));
fav_rm->set_icon(get_icon("RemoveSmall","EditorIcons"));
}
if (p_what==NOTIFICATION_PROCESS) {
if (preview_waiting) {
@ -43,20 +58,19 @@ void EditorFileDialog::_notification(int p_what) {
void EditorFileDialog::set_enable_multiple_selection(bool p_enable) {
tree->set_select_mode(p_enable?Tree::SELECT_MULTI : Tree::SELECT_SINGLE);
item_list->set_select_mode(p_enable?ItemList::SELECT_MULTI:ItemList::SELECT_SINGLE);
};
Vector<String> EditorFileDialog::get_selected_files() const {
Vector<String> list;
TreeItem* item = tree->get_root();
while ( (item = tree->get_next_selected(item)) ) {
list.push_back(dir_access->get_current_dir().plus_file(item->get_text(0)));
};
for(int i=0;i<item_list->get_item_count();i++) {
if (item_list->is_selected(i))
list.push_back(item_list->get_item_text(i));
}
return list;
};
void EditorFileDialog::update_dir() {
@ -71,6 +85,9 @@ void EditorFileDialog::_dir_entered(String p_dir) {
file->set_text("");
invalidate();
update_dir();
_push_history();
}
void EditorFileDialog::_file_entered(const String& p_file) {
@ -80,6 +97,7 @@ void EditorFileDialog::_file_entered(const String& p_file) {
void EditorFileDialog::_save_confirm_pressed() {
String f=dir_access->get_current_dir().plus_file(file->get_text());
_save_to_recent();
emit_signal("file_selected",f);
hide();
}
@ -94,11 +112,56 @@ void EditorFileDialog::_post_popup() {
if (mode==MODE_SAVE_FILE)
file->grab_focus();
else
tree->grab_focus();
item_list->grab_focus();
if (is_visible() && get_current_file()!="")
_request_single_thumbnail(get_current_dir().plus_file(get_current_file()));
if (is_visible()) {
Ref<Texture> folder = get_icon("folder","FileDialog");
recent->clear();
bool res = access==ACCESS_RESOURCES;
Vector<String> recentd = EditorSettings::get_singleton()->get_recent_dirs();
for(int i=0;i<recentd.size();i++) {
bool cres = recentd[i].begins_with("res://");
if (cres!=res)
continue;
String name = recentd[i];
if (res && name=="res://") {
name="/";
} else {
name=name.get_file()+"/";
}
//print_line("file: "+name);
recent->add_item(name,folder);
recent->set_item_metadata( recent->get_item_count()-1,recentd[i]);
}
local_history.clear();
local_history_pos=-1;
_push_history();
_update_favorites();
}
}
void EditorFileDialog::_thumbnail_result(const String& p_path,const Ref<Texture>& p_preview, const Variant& p_udata) {
if (display_mode==DISPLAY_LIST || p_preview.is_null())
return;
for(int i=0;i<item_list->get_item_count();i++) {
Dictionary d = item_list->get_item_metadata(i);
String pname = d["path"];
if (pname==p_path) {
item_list->set_item_icon(i,p_preview);
item_list->set_item_tag_icon(i,Ref<Texture>());
}
}
}
void EditorFileDialog::_thumbnail_done(const String& p_path,const Ref<Texture>& p_preview, const Variant& p_udata) {
@ -108,8 +171,13 @@ void EditorFileDialog::_thumbnail_done(const String& p_path,const Ref<Texture>&
if (p_preview.is_valid() && get_current_path()==p_path) {
preview->set_texture(p_preview);
preview_vb->show();
if (display_mode==DISPLAY_THUMBNAILS) {
preview_vb->hide();
} else {
preview_vb->show();
}
} else {
preview_vb->hide();
@ -133,17 +201,17 @@ void EditorFileDialog::_action_pressed() {
if (mode==MODE_OPEN_FILES) {
TreeItem *ti=tree->get_next_selected(NULL);
String fbase=dir_access->get_current_dir();
DVector<String> files;
while(ti) {
files.push_back( fbase.plus_file(ti->get_text(0)) );
ti=tree->get_next_selected(ti);
for(int i=0;i<item_list->get_item_count();i++) {
if (item_list->is_selected(i))
files.push_back( fbase.plus_file(item_list->get_item_text(i) ));
}
if (files.size()) {
_save_to_recent();
emit_signal("files_selected",files);
hide();
}
@ -154,6 +222,7 @@ void EditorFileDialog::_action_pressed() {
String f=dir_access->get_current_dir().plus_file(file->get_text());
if (mode==MODE_OPEN_FILE && dir_access->file_exists(f)) {
_save_to_recent();
emit_signal("file_selected",f);
hide();
}
@ -169,6 +238,7 @@ void EditorFileDialog::_action_pressed() {
}
}*/
path=path.replace("\\","/");
_save_to_recent();
emit_signal("dir_selected",path);
hide();
}
@ -237,7 +307,7 @@ void EditorFileDialog::_action_pressed() {
confirm_save->popup_centered(Size2(200,80));
} else {
_save_to_recent();
emit_signal("file_selected",f);
hide();
}
@ -251,12 +321,13 @@ void EditorFileDialog::_cancel_pressed() {
hide();
}
void EditorFileDialog::_tree_selected() {
void EditorFileDialog::_item_selected(int p_item) {
TreeItem *ti=tree->get_selected();
if (!ti)
int current = p_item;
if (current<0 || current>=item_list->get_item_count())
return;
Dictionary d=ti->get_metadata(0);
Dictionary d=item_list->get_item_metadata(current);
if (!d["dir"]) {
@ -265,34 +336,105 @@ void EditorFileDialog::_tree_selected() {
}
}
void EditorFileDialog::_tree_dc_selected() {
void EditorFileDialog::_push_history() {
local_history.resize(local_history_pos+1);
String new_path = dir_access->get_current_dir();
if (local_history.size()==0 || new_path!=local_history[local_history_pos]) {
local_history.push_back(new_path);
local_history_pos++;
dir_prev->set_disabled(local_history_pos==0);
dir_next->set_disabled(true);
}
}
void EditorFileDialog::_item_dc_selected(int p_item) {
TreeItem *ti=tree->get_selected();
if (!ti)
int current = p_item;
if (current<0 || current>=item_list->get_item_count())
return;
Dictionary d=ti->get_metadata(0);
Dictionary d=item_list->get_item_metadata(current);
if (d["dir"]) {
print_line("change dir: "+String(d["name"]));
dir_access->change_dir(d["name"]);
if (mode==MODE_OPEN_FILE || mode==MODE_OPEN_FILES || mode==MODE_OPEN_DIR)
file->set_text("");
call_deferred("_update_file_list");
call_deferred("_update_dir");
_push_history();
} else {
_action_pressed();
}
}
void EditorFileDialog::update_file_list() {
tree->clear();
int thumbnail_size = EditorSettings::get_singleton()->get("file_dialog/thumbnail_size");
Ref<Texture> folder_thumbnail;
Ref<Texture> file_thumbnail;
item_list->clear();
if (display_mode==DISPLAY_THUMBNAILS) {
item_list->set_max_columns(0);
item_list->set_icon_mode(ItemList::ICON_MODE_TOP);
item_list->set_fixed_column_width(thumbnail_size*3/2);
item_list->set_max_text_lines(2);
item_list->set_min_icon_size(Size2(thumbnail_size,thumbnail_size));
if (!has_icon("ResizedFolder","EditorIcons")) {
Ref<ImageTexture> folder = get_icon("FolderBig","EditorIcons");
Image img = folder->get_data();
img.resize(thumbnail_size,thumbnail_size);
Ref<ImageTexture> resized_folder = Ref<ImageTexture>( memnew( ImageTexture));
resized_folder->create_from_image(img,0);
Theme::get_default()->set_icon("ResizedFolder","EditorIcons",resized_folder);
}
folder_thumbnail = get_icon("ResizedFolder","EditorIcons");
if (!has_icon("ResizedFile","EditorIcons")) {
Ref<ImageTexture> file = get_icon("FileBig","EditorIcons");
Image img = file->get_data();
img.resize(thumbnail_size,thumbnail_size);
Ref<ImageTexture> resized_file = Ref<ImageTexture>( memnew( ImageTexture));
resized_file->create_from_image(img,0);
Theme::get_default()->set_icon("ResizedFile","EditorIcons",resized_file);
}
file_thumbnail = get_icon("ResizedFile","EditorIcons");
preview_vb->hide();
} else {
item_list->set_icon_mode(ItemList::ICON_MODE_LEFT);
item_list->set_max_columns(1);
item_list->set_max_text_lines(1);
item_list->set_fixed_column_width(0);
item_list->set_min_icon_size(Size2());
if (preview->get_texture().is_valid())
preview_vb->show();
}
dir_access->list_dir_begin();
TreeItem *root = tree->create_item();
Ref<Texture> folder = get_icon("folder","FileDialog");
List<String> files;
List<String> dirs;
@ -320,13 +462,20 @@ void EditorFileDialog::update_file_list() {
while(!dirs.empty()) {
if (dirs.front()->get()!=".") {
TreeItem *ti=tree->create_item(root);
ti->set_text(0,dirs.front()->get()+"/");
ti->set_icon(0,folder);
item_list->add_item(dirs.front()->get()+"/");
if (display_mode==DISPLAY_THUMBNAILS) {
item_list->set_item_icon(item_list->get_item_count()-1,folder_thumbnail);
} else {
item_list->set_item_icon(item_list->get_item_count()-1,folder);
}
Dictionary d;
d["name"]=dirs.front()->get();
d["path"]=String();
d["dir"]=true;
ti->set_metadata(0,d);
item_list->set_item_metadata( item_list->get_item_count() -1, d);
}
dirs.pop_front();
@ -382,33 +531,71 @@ void EditorFileDialog::update_file_list() {
}
if (match) {
TreeItem *ti=tree->create_item(root);
ti->set_text(0,files.front()->get());
//TreeItem *ti=tree->create_item(root);
//ti->set_text(0,files.front()->get());
item_list->add_item(files.front()->get());
if (get_icon_func) {
Ref<Texture> icon = get_icon_func(base_dir.plus_file(files.front()->get()));
ti->set_icon(0,icon);
//ti->set_icon(0,icon);
if (display_mode==DISPLAY_THUMBNAILS) {
item_list->set_item_icon(item_list->get_item_count()-1,file_thumbnail);
item_list->set_item_tag_icon(item_list->get_item_count()-1,icon);
} else {
item_list->set_item_icon(item_list->get_item_count()-1,icon);
}
}
if (mode==MODE_OPEN_DIR) {
ti->set_custom_color(0,get_color("files_disabled"));
ti->set_selectable(0,false);
//disabled mode?
//ti->set_custom_color(0,get_color("files_disabled"));
//ti->set_selectable(0,false);
}
Dictionary d;
d["name"]=files.front()->get();
d["dir"]=false;
ti->set_metadata(0,d);
String fullpath = base_dir.plus_file(files.front()->get());
if (display_mode==DISPLAY_THUMBNAILS) {
EditorResourcePreview::get_singleton()->queue_resource_preview(fullpath,this,"_thumbnail_result",fullpath);
}
d["path"]=base_dir.plus_file(files.front()->get());
//ti->set_metadata(0,d);
item_list->set_item_metadata(item_list->get_item_count()-1,d);
if (file->get_text()==files.front()->get())
ti->select(0);
item_list->set_current(item_list->get_item_count()-1);
}
files.pop_front();
}
if (tree->get_root() && tree->get_root()->get_children())
tree->get_root()->get_children()->select(0);
if (favorites->get_current()>=0) {
favorites->unselect(favorites->get_current());
}
favorite->set_pressed(false);
fav_up->set_disabled(true);
fav_down->set_disabled(true);
for(int i=0;i<favorites->get_item_count();i++) {
if (favorites->get_item_metadata(i)==base_dir) {
favorites->select(i);
favorite->set_pressed(true);
if (i>0) {
fav_up->set_disabled(false);
}
if (i<favorites->get_item_count()-1) {
fav_down->set_disabled(false);
}
break;
}
}
// ??
//if (tree->get_root() && tree->get_root()->get_children())
// tree->get_root()->get_children()->select(0);
files.clear();
@ -485,6 +672,8 @@ void EditorFileDialog::set_current_dir(const String& p_dir) {
dir_access->change_dir(p_dir);
update_dir();
invalidate();
_push_history();
}
void EditorFileDialog::set_current_file(const String& p_file) {
@ -533,10 +722,9 @@ void EditorFileDialog::set_mode(Mode p_mode) {
}
if (mode==MODE_OPEN_FILES) {
tree->set_select_mode(Tree::SELECT_MULTI);
item_list->set_select_mode(ItemList::SELECT_MULTI);
} else {
tree->set_select_mode(Tree::SELECT_SINGLE);
item_list->set_select_mode(ItemList::SELECT_SINGLE);
}
}
@ -597,6 +785,8 @@ void EditorFileDialog::_make_dir_confirm() {
invalidate();
update_filters();
update_dir();
_push_history();
} else {
mkdirerr->popup_centered_minsize(Size2(250,50));
}
@ -617,6 +807,8 @@ void EditorFileDialog::_select_drive(int p_idx) {
file->set_text("");
invalidate();
update_dir();
_push_history();
}
@ -640,13 +832,214 @@ void EditorFileDialog::_update_drives() {
}
}
void EditorFileDialog::_favorite_selected(int p_idx) {
Vector<String> favorited = EditorSettings::get_singleton()->get_favorite_dirs();
ERR_FAIL_INDEX(p_idx,favorited.size());
dir_access->change_dir(favorited[p_idx]);
file->set_text("");
invalidate();
update_dir();
_push_history();
}
void EditorFileDialog::_favorite_move_up(){
int current = favorites->get_current();
if (current>0 && current<favorites->get_item_count()) {
Vector<String> favorited = EditorSettings::get_singleton()->get_favorite_dirs();
int a_idx=favorited.find(favorites->get_item_metadata(current-1));
int b_idx=favorited.find(favorites->get_item_metadata(current));
if (a_idx==-1 || b_idx==-1)
return;
SWAP(favorited[a_idx],favorited[b_idx]);
EditorSettings::get_singleton()->set_favorite_dirs(favorited);
_update_favorites();
update_file_list();
}
}
void EditorFileDialog::_favorite_move_down(){
int current = favorites->get_current();
if (current>=0 && current<favorites->get_item_count()-1) {
Vector<String> favorited = EditorSettings::get_singleton()->get_favorite_dirs();
int a_idx=favorited.find(favorites->get_item_metadata(current+1));
int b_idx=favorited.find(favorites->get_item_metadata(current));
if (a_idx==-1 || b_idx==-1)
return;
SWAP(favorited[a_idx],favorited[b_idx]);
EditorSettings::get_singleton()->set_favorite_dirs(favorited);
_update_favorites();
update_file_list();
}
}
void EditorFileDialog::_update_favorites() {
bool res = access==ACCESS_RESOURCES;
String current = get_current_dir();
Ref<Texture> star = get_icon("Favorites","EditorIcons");
favorites->clear();
favorite->set_pressed(false);
Vector<String> favorited = EditorSettings::get_singleton()->get_favorite_dirs();
for(int i=0;i<favorited.size();i++) {
bool cres = favorited[i].begins_with("res://");
if (cres!=res)
continue;
String name = favorited[i];
bool setthis = name==current;
if (res && name=="res://") {
name="/";
} else {
name=name.get_file()+"/";
}
//print_line("file: "+name);
favorites->add_item(name,star);
favorites->set_item_metadata( favorites->get_item_count()-1,favorited[i]);
if (setthis) {
favorite->set_pressed(true);
favorites->set_current(favorites->get_item_count()-1);
}
}
}
void EditorFileDialog::_favorite_toggled(bool p_toggle) {
bool res = access==ACCESS_RESOURCES;
String cd = get_current_dir();
Vector<String> favorited = EditorSettings::get_singleton()->get_favorite_dirs();
bool found = false;
for(int i=0;i<favorited.size();i++) {
bool cres = favorited[i].begins_with("res://");
if (cres!=res)
continue;
if (favorited[i]==cd) {
found=true;
break;
}
}
if (found) {
favorited.erase(cd);
favorite->set_pressed(false);
} else {
favorited.push_back(cd);
favorite->set_pressed(true);
}
EditorSettings::get_singleton()->set_favorite_dirs(favorited);
_update_favorites();
}
void EditorFileDialog::_recent_selected(int p_idx) {
Vector<String> recentd = EditorSettings::get_singleton()->get_recent_dirs();
ERR_FAIL_INDEX(p_idx,recentd.size());
dir_access->change_dir(recent->get_item_metadata(p_idx));
update_file_list();
update_dir();
_push_history();
}
void EditorFileDialog::_go_up() {
dir_access->change_dir("..");
update_file_list();
update_dir();
_push_history();
}
void EditorFileDialog::_go_back(){
if (local_history_pos<=0) {
return;
}
local_history_pos--;
dir_access->change_dir(local_history[local_history_pos]);
update_file_list();
update_dir();
dir_prev->set_disabled(local_history_pos==0);
dir_next->set_disabled(local_history_pos==local_history.size()-1);
}
void EditorFileDialog::_go_forward(){
if (local_history_pos==local_history.size()-1) {
return;
}
local_history_pos++;
dir_access->change_dir(local_history[local_history_pos]);
update_file_list();
update_dir();
dir_prev->set_disabled(local_history_pos==0);
dir_next->set_disabled(local_history_pos==local_history.size()-1);
}
bool EditorFileDialog::default_show_hidden_files=true;
void EditorFileDialog::set_display_mode(DisplayMode p_mode) {
if (display_mode==p_mode)
return;
if (p_mode==DISPLAY_THUMBNAILS) {
mode_list->set_pressed(false);
mode_thumbnails->set_pressed(true);
} else {
mode_thumbnails->set_pressed(false);
mode_list->set_pressed(true);
}
display_mode=p_mode;
invalidate();;
}
EditorFileDialog::DisplayMode EditorFileDialog::get_display_mode() const{
return display_mode;
}
void EditorFileDialog::_bind_methods() {
ObjectTypeDB::bind_method(_MD("_tree_selected"),&EditorFileDialog::_tree_selected);
ObjectTypeDB::bind_method(_MD("_tree_db_selected"),&EditorFileDialog::_tree_dc_selected);
ObjectTypeDB::bind_method(_MD("_item_selected"),&EditorFileDialog::_item_selected);
ObjectTypeDB::bind_method(_MD("_item_db_selected"),&EditorFileDialog::_item_dc_selected);
ObjectTypeDB::bind_method(_MD("_dir_entered"),&EditorFileDialog::_dir_entered);
ObjectTypeDB::bind_method(_MD("_file_entered"),&EditorFileDialog::_file_entered);
ObjectTypeDB::bind_method(_MD("_action_pressed"),&EditorFileDialog::_action_pressed);
@ -675,6 +1068,19 @@ void EditorFileDialog::_bind_methods() {
ObjectTypeDB::bind_method(_MD("_update_file_list"),&EditorFileDialog::update_file_list);
ObjectTypeDB::bind_method(_MD("_update_dir"),&EditorFileDialog::update_dir);
ObjectTypeDB::bind_method(_MD("_thumbnail_done"),&EditorFileDialog::_thumbnail_done);
ObjectTypeDB::bind_method(_MD("set_display_mode","mode"),&EditorFileDialog::set_display_mode);
ObjectTypeDB::bind_method(_MD("get_display_mode"),&EditorFileDialog::get_display_mode);
ObjectTypeDB::bind_method(_MD("_thumbnail_result"),&EditorFileDialog::_thumbnail_result);
ObjectTypeDB::bind_method(_MD("_recent_selected"),&EditorFileDialog::_recent_selected);
ObjectTypeDB::bind_method(_MD("_go_back"),&EditorFileDialog::_go_back);
ObjectTypeDB::bind_method(_MD("_go_forward"),&EditorFileDialog::_go_forward);
ObjectTypeDB::bind_method(_MD("_go_up"),&EditorFileDialog::_go_up);
ObjectTypeDB::bind_method(_MD("_favorite_toggled"),&EditorFileDialog::_favorite_toggled);
ObjectTypeDB::bind_method(_MD("_favorite_selected"),&EditorFileDialog::_favorite_selected);
ObjectTypeDB::bind_method(_MD("_favorite_move_up"),&EditorFileDialog::_favorite_move_up);
ObjectTypeDB::bind_method(_MD("_favorite_move_down"),&EditorFileDialog::_favorite_move_down);
ObjectTypeDB::bind_method(_MD("invalidate"),&EditorFileDialog::invalidate);
@ -707,9 +1113,36 @@ void EditorFileDialog::set_default_show_hidden_files(bool p_show) {
default_show_hidden_files=p_show;
}
void EditorFileDialog::_save_to_recent() {
String dir = get_current_dir();
Vector<String> recent = EditorSettings::get_singleton()->get_recent_dirs();
const int max=20;
int count=0;
bool res=dir.begins_with("res://");
for(int i=0;i<recent.size();i++) {
bool cres=recent[i].begins_with("res://");
if (recent[i]==dir || (res==cres && count>max)) {
recent.remove(i);
i--;
} else {
count++;
}
}
recent.insert(0,dir);
EditorSettings::get_singleton()->set_recent_dirs(recent);
}
EditorFileDialog::EditorFileDialog() {
show_hidden_files=true;
display_mode=DISPLAY_THUMBNAILS;
VBoxContainer *vbc = memnew( VBoxContainer );
add_child(vbc);
@ -718,11 +1151,39 @@ EditorFileDialog::EditorFileDialog() {
mode=MODE_SAVE_FILE;
set_title("Save a File");
dir = memnew(LineEdit);
HBoxContainer *pathhb = memnew( HBoxContainer );
dir_prev = memnew( ToolButton );
dir_next = memnew( ToolButton );
dir_up = memnew( ToolButton );
pathhb->add_child(dir_prev);
pathhb->add_child(dir_next);
pathhb->add_child(dir_up);
dir_prev->connect("pressed",this,"_go_back");
dir_next->connect("pressed",this,"_go_forward");
dir_up->connect("pressed",this,"_go_up");
dir = memnew(LineEdit);
pathhb->add_child(dir);
dir->set_h_size_flags(SIZE_EXPAND_FILL);
favorite = memnew( ToolButton );
favorite->set_toggle_mode(true);
favorite->connect("toggled",this,"_favorite_toggled");
pathhb->add_child(favorite);
mode_thumbnails = memnew( ToolButton );
mode_thumbnails->connect("pressed",this,"set_display_mode",varray(DISPLAY_THUMBNAILS));
mode_thumbnails->set_toggle_mode(true);
mode_thumbnails->set_pressed(true);
pathhb->add_child(mode_thumbnails);
mode_list = memnew( ToolButton );
mode_list->connect("pressed",this,"set_display_mode",varray(DISPLAY_LIST));
mode_list->set_toggle_mode(true);
pathhb->add_child(mode_list);
drives = memnew( OptionButton );
pathhb->add_child(drives);
drives->connect("item_selected",this,"_select_drive");
@ -732,18 +1193,49 @@ EditorFileDialog::EditorFileDialog() {
makedir->connect("pressed",this,"_make_dir");
pathhb->add_child(makedir);
vbc->add_margin_child("Path:",pathhb);
list_hb = memnew( HBoxContainer );
vbc->add_margin_child("Directories & Files:",list_hb,true);
tree = memnew(Tree);
tree->set_hide_root(true);
tree->set_h_size_flags(SIZE_EXPAND_FILL);
list_hb->add_child(tree);
vbc->add_margin_child("Path:",pathhb);
vbc->add_child(list_hb);
list_hb->set_v_size_flags(SIZE_EXPAND_FILL);
VBoxContainer *fav_vb = memnew( VBoxContainer );
list_hb->add_child(fav_vb);
HBoxContainer *fav_hb = memnew( HBoxContainer );
fav_vb->add_child(fav_hb);
fav_hb->add_child(memnew(Label("Favorites:")));
fav_hb->add_spacer();
fav_up = memnew( ToolButton );
fav_hb->add_child(fav_up);
fav_up->connect("pressed",this,"_favorite_move_up");
fav_down = memnew( ToolButton );
fav_hb->add_child(fav_down);
fav_down->connect("pressed",this,"_favorite_move_down");
fav_rm = memnew( ToolButton );
fav_hb->add_child(fav_rm);
fav_rm->hide(); // redundant
MarginContainer *fav_mv = memnew( MarginContainer );
fav_vb->add_child(fav_mv);
fav_mv->set_v_size_flags(SIZE_EXPAND_FILL);
favorites = memnew( ItemList );
fav_mv->add_child(favorites);
favorites->connect("item_selected",this,"_favorite_selected");
recent = memnew( ItemList );
fav_vb->add_margin_child("Recent:",recent,true);
recent->connect("item_selected",this,"_recent_selected");
VBoxContainer *item_vb = memnew( VBoxContainer );
list_hb->add_child(item_vb);
item_vb->set_h_size_flags(SIZE_EXPAND_FILL);
item_list = memnew( ItemList );
item_list->set_v_size_flags(SIZE_EXPAND_FILL);
item_vb->add_margin_child("Directories & Files:",item_list,true);
HBoxContainer* filter_hb = memnew( HBoxContainer );
vbc->add_child(filter_hb);
item_vb->add_child(filter_hb);
VBoxContainer *filter_vb = memnew( VBoxContainer );
filter_hb->add_child(filter_vb);
@ -775,8 +1267,8 @@ EditorFileDialog::EditorFileDialog() {
connect("confirmed", this,"_action_pressed");
//cancel->connect("pressed", this,"_cancel_pressed");
tree->connect("cell_selected", this,"_tree_selected",varray(),CONNECT_DEFERRED);
tree->connect("item_activated", this,"_tree_db_selected",varray());
item_list->connect("item_selected", this,"_item_selected",varray(),CONNECT_DEFERRED);
item_list->connect("item_activated", this,"_item_db_selected",varray());
dir->connect("text_entered", this,"_dir_entered");
file->connect("text_entered", this,"_file_entered");
filter->connect("item_selected", this,"_filter_selected");

View File

@ -32,14 +32,14 @@
#define EDITORFILEDIALOG_H
#include "scene/gui/dialogs.h"
#include "scene/gui/tree.h"
#include "scene/gui/item_list.h"
#include "scene/gui/line_edit.h"
#include "scene/gui/option_button.h"
#include "scene/gui/dialogs.h"
#include "os/dir_access.h"
#include "scene/gui/box_container.h"
#include "scene/gui/texture_frame.h"
#include "scene/gui/tool_button.h"
/**
@author Juan Linietsky <reduzio@gmail.com>
*/
@ -49,6 +49,12 @@ class EditorFileDialog : public ConfirmationDialog {
public:
enum DisplayMode {
DISPLAY_THUMBNAILS,
DISPLAY_LIST
};
enum Access {
ACCESS_RESOURCES,
ACCESS_USERDATA,
@ -82,8 +88,13 @@ private:
VBoxContainer *vbox;
Mode mode;
LineEdit *dir;
ToolButton *dir_prev;
ToolButton *dir_next;
ToolButton *dir_up;
OptionButton *drives;
Tree *tree;
ItemList *item_list;
TextureFrame *preview;
VBoxContainer *preview_vb;
HBoxContainer *list_hb;
@ -93,6 +104,22 @@ private:
OptionButton *filter;
DirAccess *dir_access;
ConfirmationDialog *confirm_save;
ToolButton *mode_thumbnails;
ToolButton *mode_list;
ToolButton *favorite;
ToolButton *fav_up;
ToolButton *fav_down;
ToolButton *fav_rm;
ItemList *favorites;
ItemList *recent;
Vector<String> local_history;
int local_history_pos;
void _push_history();
Vector<String> filters;
@ -101,6 +128,7 @@ private:
float preview_wheel_timeout;
static bool default_show_hidden_files;
bool show_hidden_files;
DisplayMode display_mode;
bool invalidated;
@ -108,10 +136,20 @@ private:
void update_file_list();
void update_filters();
void _tree_selected();
void _update_favorites();
void _favorite_toggled(bool p_toggle);
void _favorite_selected(int p_idx);
void _favorite_move_up();
void _favorite_move_down();
void _recent_selected(int p_idx);
void _item_selected(int p_item);
void _item_dc_selected(int p_item);
void _select_drive(int p_idx);
void _tree_dc_selected();
void _dir_entered(String p_dir);
void _file_entered(const String& p_file);
void _action_pressed();
@ -123,11 +161,16 @@ private:
void _update_drives();
void _go_up();
void _go_back();
void _go_forward();
virtual void _post_popup();
void _save_to_recent();
//callback funtion is callback(String p_path,Ref<Texture> preview,Variant udata) preview null if could not load
void _thumbnail_result(const String& p_path,const Ref<Texture>& p_preview, const Variant& p_udata);
void _thumbnail_done(const String& p_path,const Ref<Texture>& p_preview, const Variant& p_udata);
void _request_single_thumbnail(const String& p_path);
@ -151,6 +194,9 @@ public:
void set_current_file(const String& p_file);
void set_current_path(const String& p_path);
void set_display_mode(DisplayMode p_mode);
DisplayMode get_display_mode() const;
void set_mode(Mode p_mode);
Mode get_mode() const;
@ -194,5 +240,6 @@ public:
VARIANT_ENUM_CAST( EditorFileDialog::Mode );
VARIANT_ENUM_CAST( EditorFileDialog::Access );
VARIANT_ENUM_CAST( EditorFileDialog::DisplayMode );
#endif // EDITORFILEDIALOG_H

View File

@ -33,7 +33,7 @@
#include "os/file_access.h"
#include "editor_node.h"
#include "io/resource_saver.h"
#include "editor_settings.h"
EditorFileSystem *EditorFileSystem::singleton=NULL;
@ -357,7 +357,9 @@ void EditorFileSystem::_scan_scenes() {
String project=Globals::get_singleton()->get_resource_path();
FileAccess *f =FileAccess::open(project+"/.fscache",FileAccess::READ);
String fscache = EditorSettings::get_singleton()->get_project_settings_path().plus_file("file_cache");
FileAccess *f =FileAccess::open(fscache,FileAccess::READ);
if (f) {
//read the disk cache
@ -470,7 +472,9 @@ void EditorFileSystem::_scan_scenes() {
//save back the findings
f=FileAccess::open(project+"/.fscache",FileAccess::WRITE);
// String fscache = EditorSettings::get_singleton()->get_project_settings_path().plus_file("file_cache");
f=FileAccess::open(fscache,FileAccess::WRITE);
_save_type_cache_fs(scandir,f);
f->close();
memdelete(f);

View File

@ -33,7 +33,7 @@ void EditorResourcePreview::_thread_func(void *ud) {
void EditorResourcePreview::_preview_ready(const String& p_str,const Ref<Texture>& p_texture,ObjectID id,const StringName& p_func,const Variant& p_ud) {
print_line("preview is ready");
//print_line("preview is ready");
preview_mutex->lock();
Item item;
@ -52,7 +52,7 @@ void EditorResourcePreview::_preview_ready(const String& p_str,const Ref<Texture
Ref<Texture> EditorResourcePreview::_generate_preview(const QueueItem& p_item,const String& cache_base) {
String type = ResourceLoader::get_resource_type(p_item.path);
print_line("resource type is: "+type);
//print_line("resource type is: "+type);
if (type=="")
return Ref<Texture>(); //could not guess type
@ -68,7 +68,7 @@ Ref<Texture> EditorResourcePreview::_generate_preview(const QueueItem& p_item,co
}
if (generated.is_valid()) {
print_line("was generated");
//print_line("was generated");
int thumbnail_size = EditorSettings::get_singleton()->get("file_dialog/thumbnail_size");
//wow it generated a preview... save cache
ResourceSaver::save(cache_base+".png",generated);
@ -78,7 +78,7 @@ Ref<Texture> EditorResourcePreview::_generate_preview(const QueueItem& p_item,co
f->store_line(FileAccess::get_md5(p_item.path));
memdelete(f);
} else {
print_line("was not generated");
//print_line("was not generated");
}
@ -87,18 +87,18 @@ Ref<Texture> EditorResourcePreview::_generate_preview(const QueueItem& p_item,co
void EditorResourcePreview::_thread() {
print_line("begin thread");
//print_line("begin thread");
while(!exit) {
print_line("wait for semaphore");
//print_line("wait for semaphore");
preview_sem->wait();
preview_mutex->lock();
print_line("blue team go");
//print_line("blue team go");
if (queue.size()) {
print_line("pop from queue");
//print_line("pop from queue");
QueueItem item = queue.front()->get();
queue.pop_front();
@ -124,11 +124,11 @@ void EditorResourcePreview::_thread() {
//does not have it, try to load a cached thumbnail
String file = cache_base+".txt";
print_line("cachetxt at "+file);
//print_line("cachetxt at "+file);
FileAccess *f=FileAccess::open(file,FileAccess::READ);
if (!f) {
print_line("generate because not cached");
//print_line("generate because not cached");
//generate
texture=_generate_preview(item,cache_base);
@ -179,7 +179,7 @@ void EditorResourcePreview::_thread() {
}
print_line("notify of preview ready");
//print_line("notify of preview ready");
call_deferred("_preview_ready",item.path,texture,item.id,item.function,item.userdata);
}
@ -206,7 +206,7 @@ void EditorResourcePreview::queue_resource_preview(const String& p_path, Object*
}
print_line("send to thread");
//print_line("send to thread");
QueueItem item;
item.function=p_receiver_func;
item.id=p_receiver->get_instance_ID();

View File

@ -8,9 +8,9 @@
/* make previews for:
*packdscene
-wav
*wav
*image
-mesh
*mesh
-font
*script
*material

View File

@ -224,6 +224,28 @@ void EditorSettings::create() {
dir->change_dir("..");
}
if (dir->change_dir("config")!=OK) {
dir->make_dir("config");
} else {
dir->change_dir("..");
}
dir->change_dir("config");
String pcp=Globals::get_singleton()->get_resource_path();
if (pcp.ends_with("/"))
pcp=config_path.substr(0,pcp.size()-1);
pcp=pcp.get_file()+"-"+pcp.md5_text();
if (dir->change_dir(pcp)) {
dir->make_dir(pcp);
} else {
dir->change_dir("..");
}
dir->change_dir("..");
// path at least is validated, so validate config file
@ -244,6 +266,7 @@ void EditorSettings::create() {
}
singleton->config_file_path=config_file_path;
singleton->project_config_path=pcp;
singleton->settings_path=config_path+"/"+config_dir;
if (OS::get_singleton()->is_stdout_verbose()) {
@ -251,7 +274,7 @@ void EditorSettings::create() {
print_line("EditorSettings: Load OK!");
}
singleton->load_favorites();
singleton->scan_plugins();
return;
@ -648,6 +671,71 @@ void EditorSettings::set_plugin_enabled(const String& p_plugin, bool p_enabled)
}
void EditorSettings::set_favorite_dirs(const Vector<String>& p_favorites) {
favorite_dirs=p_favorites;
FileAccess *f = FileAccess::open(get_project_settings_path().plus_file("favorite_dirs"),FileAccess::WRITE);
if (f) {
for(int i=0;i<favorite_dirs.size();i++)
f->store_line(favorite_dirs[i]);
memdelete(f);
}
}
Vector<String> EditorSettings::get_favorite_dirs() const {
return favorite_dirs;
}
void EditorSettings::set_recent_dirs(const Vector<String>& p_recent) {
recent_dirs=p_recent;
FileAccess *f = FileAccess::open(get_project_settings_path().plus_file("recent_dirs"),FileAccess::WRITE);
if (f) {
for(int i=0;i<recent_dirs.size();i++)
f->store_line(recent_dirs[i]);
memdelete(f);
}
}
Vector<String> EditorSettings::get_recent_dirs() const {
return recent_dirs;
}
String EditorSettings::get_project_settings_path() const {
return get_settings_path().plus_file("config").plus_file(project_config_path);
}
void EditorSettings::load_favorites() {
FileAccess *f = FileAccess::open(get_project_settings_path().plus_file("favorite_dirs"),FileAccess::READ);
if (f) {
String line = f->get_line().strip_edges();
while(line!="") {
favorite_dirs.push_back(line);
line = f->get_line().strip_edges();
}
memdelete(f);
}
f = FileAccess::open(get_project_settings_path().plus_file("recent_dirs"),FileAccess::READ);
if (f) {
String line = f->get_line().strip_edges();
while(line!="") {
recent_dirs.push_back(line);
line = f->get_line().strip_edges();
}
memdelete(f);
}
}
void EditorSettings::_bind_methods() {

View File

@ -88,6 +88,11 @@ private:
void _load_defaults();
String project_config_path;
Vector<String> favorite_dirs;
Vector<String> recent_dirs;
protected:
static void _bind_methods();
@ -102,6 +107,7 @@ public:
static EditorSettings *get_singleton();
void erase(String p_var);
String get_settings_path() const;
String get_project_settings_path() const;
const Map<String,Plugin>& get_plugins() const { return plugins; }
@ -125,6 +131,14 @@ public:
void add_property_hint(const PropertyInfo& p_hint);
void set_favorite_dirs(const Vector<String>& p_favorite_dirs);
Vector<String> get_favorite_dirs() const;
void set_recent_dirs(const Vector<String>& p_recent_dirs);
Vector<String> get_recent_dirs() const;
void load_favorites();
EditorSettings();
~EditorSettings();

View File

@ -215,7 +215,7 @@ EditorSubScene::EditorSubScene() {
tree->set_v_size_flags(SIZE_EXPAND_FILL);
vb->add_margin_child("Import From Node:",tree)->set_v_size_flags(SIZE_EXPAND_FILL);
file_dialog = memnew( FileDialog );
file_dialog = memnew( EditorFileDialog );
List<String> extensions;
ResourceLoader::get_recognized_extensions_for_type("PackedScene",&extensions);
@ -224,7 +224,7 @@ EditorSubScene::EditorSubScene() {
file_dialog->add_filter("*."+E->get());
}
file_dialog->set_mode(FileDialog::MODE_OPEN_FILE);
file_dialog->set_mode(EditorFileDialog::MODE_OPEN_FILE);
add_child(file_dialog);
file_dialog->connect("file_selected",this,"_path_selected");

View File

@ -31,7 +31,7 @@
#include "scene/gui/dialogs.h"
#include "scene/gui/tree.h"
#include "scene/gui/file_dialog.h"
#include "tools/editor/editor_file_dialog.h"
class EditorSubScene : public ConfirmationDialog {
@ -42,7 +42,7 @@ class EditorSubScene : public ConfirmationDialog {
Tree *tree;
Node *scene;
FileDialog *file_dialog;
EditorFileDialog *file_dialog;
void _fill_tree(Node* p_node,TreeItem *p_parent);
void _reown(Node* p_node,List<Node*> *p_to_reown);

Binary file not shown.

After

Width:  |  Height:  |  Size: 243 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 244 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 263 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 252 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 259 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 275 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 375 B

After

Width:  |  Height:  |  Size: 412 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 986 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 260 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 296 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 341 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 398 B

After

Width:  |  Height:  |  Size: 519 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 297 B

View File

@ -28,7 +28,7 @@
/*************************************************************************/
#include "editor_font_import_plugin.h"
#include "scene/gui/dialogs.h"
#include "scene/gui/file_dialog.h"
#include "tools/editor/editor_file_dialog.h"
#include "tools/editor/editor_node.h"
#include "os/file_access.h"
#include "editor_atlas.h"
@ -379,8 +379,8 @@ class EditorFontImportDialog : public ConfirmationDialog {
OBJ_TYPE(EditorFontImportDialog, ConfirmationDialog);
LineEditFileChooser *source;
LineEditFileChooser *dest;
EditorLineEditFileChooser *source;
EditorLineEditFileChooser *dest;
SpinBox *font_size;
LineEdit *test_string;
ColorPickerButton *test_color;
@ -612,9 +612,9 @@ public:
hbc->add_child(vbr);
vbr->set_h_size_flags(SIZE_EXPAND_FILL);
source = memnew( LineEditFileChooser );
source->get_file_dialog()->set_access(FileDialog::ACCESS_FILESYSTEM);
source->get_file_dialog()->set_mode(FileDialog::MODE_OPEN_FILE);
source = memnew( EditorLineEditFileChooser );
source->get_file_dialog()->set_access(EditorFileDialog::ACCESS_FILESYSTEM);
source->get_file_dialog()->set_mode(EditorFileDialog::MODE_OPEN_FILE);
source->get_file_dialog()->add_filter("*.ttf;TrueType");
source->get_file_dialog()->add_filter("*.otf;OpenType");
source->get_line_edit()->connect("text_entered",this,"_src_changed");
@ -626,7 +626,7 @@ public:
font_size->set_max(256);
font_size->set_val(16);
font_size->connect("value_changed",this,"_font_size_changed");
dest = memnew( LineEditFileChooser );
dest = memnew( EditorLineEditFileChooser );
//
List<String> fl;
Ref<Font> font= memnew(Font);

View File

@ -1,6 +1,6 @@
#include "editor_mesh_import_plugin.h"
#include "scene/gui/file_dialog.h"
#include "tools/editor/editor_file_dialog.h"
#include "tools/editor/editor_dir_dialog.h"
#include "tools/editor/editor_node.h"
#include "tools/editor/property_editor.h"
@ -126,7 +126,7 @@ class EditorMeshImportDialog : public ConfirmationDialog {
LineEdit *import_path;
LineEdit *save_path;
FileDialog *file_select;
EditorFileDialog *file_select;
EditorDirDialog *save_select;
ConfirmationDialog *error_dialog;
PropertyEditor *option_editor;
@ -300,16 +300,16 @@ public:
save_choose->connect("pressed", this,"_browse_target");
file_select = memnew(FileDialog);
file_select->set_access(FileDialog::ACCESS_FILESYSTEM);
file_select = memnew(EditorFileDialog);
file_select->set_access(EditorFileDialog::ACCESS_FILESYSTEM);
add_child(file_select);
file_select->set_mode(FileDialog::MODE_OPEN_FILES);
file_select->set_mode(EditorFileDialog::MODE_OPEN_FILES);
file_select->connect("files_selected", this,"_choose_files");
file_select->add_filter("*.obj ; Wavefront OBJ");
save_select = memnew( EditorDirDialog );
add_child(save_select);
// save_select->set_mode(FileDialog::MODE_OPEN_DIR);
// save_select->set_mode(EditorFileDialog::MODE_OPEN_DIR);
save_select->connect("dir_selected", this,"_choose_save_dir");
get_ok()->connect("pressed", this,"_import");

View File

@ -27,7 +27,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "editor_sample_import_plugin.h"
#include "scene/gui/file_dialog.h"
#include "tools/editor/editor_file_dialog.h"
#include "tools/editor/editor_dir_dialog.h"
#include "tools/editor/editor_node.h"
#include "tools/editor/property_editor.h"
@ -171,7 +171,7 @@ class EditorSampleImportDialog : public ConfirmationDialog {
LineEdit *import_path;
LineEdit *save_path;
FileDialog *file_select;
EditorFileDialog *file_select;
EditorDirDialog *save_select;
ConfirmationDialog *error_dialog;
PropertyEditor *option_editor;
@ -363,16 +363,16 @@ public:
save_choose->connect("pressed", this,"_browse_target");
file_select = memnew(FileDialog);
file_select->set_access(FileDialog::ACCESS_FILESYSTEM);
file_select = memnew(EditorFileDialog);
file_select->set_access(EditorFileDialog::ACCESS_FILESYSTEM);
add_child(file_select);
file_select->set_mode(FileDialog::MODE_OPEN_FILES);
file_select->set_mode(EditorFileDialog::MODE_OPEN_FILES);
file_select->connect("files_selected", this,"_choose_files");
file_select->add_filter("*.wav ; MS Waveform");
save_select = memnew( EditorDirDialog );
add_child(save_select);
// save_select->set_mode(FileDialog::MODE_OPEN_DIR);
// save_select->set_mode(EditorFileDialog::MODE_OPEN_DIR);
save_select->connect("dir_selected", this,"_choose_save_dir");
get_ok()->connect("pressed", this,"_import");

View File

@ -162,8 +162,8 @@ class EditorSceneImportDialog : public ConfirmationDialog {
LineEdit *save_path;
LineEdit *script_path;
Tree *import_options;
FileDialog *file_select;
FileDialog *script_select;
EditorFileDialog *file_select;
EditorFileDialog *script_select;
EditorDirDialog *save_select;
OptionButton *texture_action;
@ -1079,19 +1079,19 @@ EditorSceneImportDialog::EditorSceneImportDialog(EditorNode *p_editor, EditorSce
vbc->set_v_size_flags(SIZE_EXPAND_FILL);
vbc->add_margin_child("Options:",import_options,true);
file_select = memnew(FileDialog);
file_select->set_access(FileDialog::ACCESS_FILESYSTEM);
file_select = memnew(EditorFileDialog);
file_select->set_access(EditorFileDialog::ACCESS_FILESYSTEM);
add_child(file_select);
file_select->set_mode(FileDialog::MODE_OPEN_FILE);
file_select->set_mode(EditorFileDialog::MODE_OPEN_FILE);
file_select->connect("file_selected", this,"_choose_file");
save_select = memnew(EditorDirDialog);
add_child(save_select);
//save_select->set_mode(FileDialog::MODE_SAVE_FILE);
//save_select->set_mode(EditorFileDialog::MODE_SAVE_FILE);
save_select->connect("dir_selected", this,"_choose_save_file");
get_ok()->connect("pressed", this,"_import");
@ -1140,7 +1140,7 @@ EditorSceneImportDialog::EditorSceneImportDialog(EditorNode *p_editor, EditorSce
script_choose->connect("pressed", this,"_browse_script");
script_select = memnew(FileDialog);
script_select = memnew(EditorFileDialog);
add_child(script_select);
for(int i=0;i<ScriptServer::get_language_count();i++) {
@ -1152,7 +1152,7 @@ EditorSceneImportDialog::EditorSceneImportDialog(EditorNode *p_editor, EditorSce
}
script_select->set_mode(FileDialog::MODE_OPEN_FILE);
script_select->set_mode(EditorFileDialog::MODE_OPEN_FILE);
script_select->connect("file_selected", this,"_choose_script");

View File

@ -248,8 +248,8 @@ class EditorTextureImportDialog : public ConfirmationDialog {
LineEdit *import_path;
LineEdit *save_path;
FileDialog *file_select;
FileDialog *save_file_select;
EditorFileDialog *file_select;
EditorFileDialog *save_file_select;
EditorDirDialog *save_select;
OptionButton *texture_action;
ConfirmationDialog *error_dialog;
@ -596,8 +596,8 @@ EditorTextureImportDialog::EditorTextureImportDialog(EditorTextureImportPlugin*
save_choose->connect("pressed", this,"_browse_target");
file_select = memnew(FileDialog);
file_select->set_access(FileDialog::ACCESS_FILESYSTEM);
file_select = memnew(EditorFileDialog);
file_select->set_access(EditorFileDialog::ACCESS_FILESYSTEM);
add_child(file_select);
if (!large)
file_select->set_mode(FileDialog::MODE_OPEN_FILES);
@ -606,10 +606,10 @@ EditorTextureImportDialog::EditorTextureImportDialog(EditorTextureImportPlugin*
file_select->connect("files_selected", this,"_choose_files");
file_select->connect("file_selected", this,"_choose_file");
save_file_select = memnew(FileDialog);
save_file_select->set_access(FileDialog::ACCESS_RESOURCES);
save_file_select = memnew(EditorFileDialog);
save_file_select->set_access(EditorFileDialog::ACCESS_RESOURCES);
add_child(save_file_select);
save_file_select->set_mode(FileDialog::MODE_SAVE_FILE);
save_file_select->set_mode(EditorFileDialog::MODE_SAVE_FILE);
save_file_select->clear_filters();
if (large)
save_file_select->add_filter("*.ltex;Large Texture");
@ -620,7 +620,7 @@ EditorTextureImportDialog::EditorTextureImportDialog(EditorTextureImportPlugin*
save_select = memnew( EditorDirDialog );
add_child(save_select);
// save_select->set_mode(FileDialog::MODE_OPEN_DIR);
// save_select->set_mode(EditorFileDialog::MODE_OPEN_DIR);
save_select->connect("dir_selected", this,"_choose_save_dir");
get_ok()->connect("pressed", this,"_import");

View File

@ -47,7 +47,7 @@ class EditorTranslationImportDialog : public ConfirmationDialog {
LineEdit *import_path;
LineEdit *save_path;
FileDialog *file_select;
EditorFileDialog *file_select;
CheckButton *ignore_first;
CheckButton *compress;
CheckButton *add_to_project;
@ -347,16 +347,16 @@ public:
add_to_project->set_text("Add to Project (engine.cfg)");
tcomp->add_child(add_to_project);
file_select = memnew(FileDialog);
file_select->set_access(FileDialog::ACCESS_FILESYSTEM);
file_select = memnew(EditorFileDialog);
file_select->set_access(EditorFileDialog::ACCESS_FILESYSTEM);
add_child(file_select);
file_select->set_mode(FileDialog::MODE_OPEN_FILE);
file_select->set_mode(EditorFileDialog::MODE_OPEN_FILE);
file_select->connect("file_selected", this,"_choose_file");
file_select->add_filter("*.csv ; Translation CSV");
save_select = memnew( EditorDirDialog );
add_child(save_select);
// save_select->set_mode(FileDialog::MODE_OPEN_DIR);
// save_select->set_mode(EditorFileDialog::MODE_OPEN_DIR);
save_select->connect("dir_selected", this,"_choose_save_dir");
get_ok()->connect("pressed", this,"_import");

View File

@ -98,7 +98,7 @@ void AnimationPlayerEditor::_notification(int p_what) {
duplicate_anim->set_icon( get_icon("Duplicate","EditorIcons") );
autoplay->set_icon( get_icon("AutoPlay","EditorIcons") );
load_anim->set_icon( get_icon("Folder","EditorIcons") );
remove_anim->set_icon( get_icon("Del","EditorIcons") );
remove_anim->set_icon( get_icon("Remove","EditorIcons") );
edit_anim->set_icon( get_icon("Edit","EditorIcons") );
blend_anim->set_icon( get_icon("Blend","EditorIcons") );
play->set_icon( get_icon("PlayStart","EditorIcons") );
@ -355,7 +355,7 @@ void AnimationPlayerEditor::_animation_rename() {
}
void AnimationPlayerEditor::_animation_load() {
ERR_FAIL_COND(!player);
file->set_mode( FileDialog::MODE_OPEN_FILE );
file->set_mode( EditorFileDialog::MODE_OPEN_FILE );
file->clear_filters();
List<String> extensions;
@ -1232,7 +1232,7 @@ AnimationPlayerEditor::AnimationPlayerEditor(EditorNode *p_editor) {
resource_edit_anim->hide();
file = memnew(FileDialog);
file = memnew(EditorFileDialog);
add_child(file);
name_dialog = memnew( ConfirmationDialog );

View File

@ -84,7 +84,7 @@ class AnimationPlayerEditor : public VBoxContainer {
Ref<Texture> autoplay_icon;
bool last_active;
FileDialog *file;
EditorFileDialog *file;
struct BlendEditor {

View File

@ -1193,7 +1193,7 @@ void AnimationTreeEditor::_add_menu_item(int p_item) {
} else if (p_item == MENU_IMPORT_ANIMATIONS) {
file_op = MENU_IMPORT_ANIMATIONS;
file_dialog->set_mode(FileDialog::MODE_OPEN_FILE);
file_dialog->set_mode(EditorFileDialog::MODE_OPEN_FILE);
file_dialog->popup_centered_ratio();
} else {
@ -1458,7 +1458,7 @@ AnimationTreeEditor::AnimationTreeEditor() {
edit_check->hide();;
edit_check->connect("pressed", this,"_edit_dialog_changed");
file_dialog = memnew( FileDialog );
file_dialog = memnew( EditorFileDialog );
file_dialog->set_enable_multiple_selection(true);
file_dialog->set_current_dir(Globals::get_singleton()->get_resource_path());
add_child(file_dialog);

View File

@ -79,7 +79,7 @@ class AnimationTreeEditor : public Control {
Button *edit_button;
Button *filter_button;
CheckButton *edit_check;
FileDialog* file_dialog;
EditorFileDialog* file_dialog;
int file_op;
void _popup_edit_dialog();

View File

@ -269,8 +269,8 @@ void MeshLibraryEditor::_bind_methods() {
MeshLibraryEditor::MeshLibraryEditor(EditorNode *p_editor) {
file = memnew( FileDialog );
file->set_mode(FileDialog::MODE_OPEN_FILE);
file = memnew( EditorFileDialog );
file->set_mode(EditorFileDialog::MODE_OPEN_FILE);
//not for now?
List<String> extensions;
ResourceLoader::get_recognized_extensions_for_type("PackedScene",&extensions);

View File

@ -42,7 +42,7 @@ class MeshLibraryEditor : public Control {
EditorNode *editor;
MenuButton *menu;
ConfirmationDialog *cd;
FileDialog *file;
EditorFileDialog *file;
int to_erase;
enum {

View File

@ -172,14 +172,14 @@ Particles2DEditorPlugin::Particles2DEditorPlugin(EditorNode *p_node) {
menu->get_popup()->add_item("Clear Emission Mask",MENU_CLEAR_EMISSION_MASK);
menu->set_text("Particles");
file = memnew(FileDialog);
file = memnew(EditorFileDialog);
add_child(file);
List<String> ext;
ImageLoader::get_recognized_extensions(&ext);
for(List<String>::Element *E=ext.front();E;E=E->next()) {
file->add_filter("*."+E->get()+"; "+E->get().to_upper());
}
file->set_mode(FileDialog::MODE_OPEN_FILE);
file->set_mode(EditorFileDialog::MODE_OPEN_FILE);
CanvasItemEditor::get_singleton()->add_control_to_menu_panel(menu);
epoints = memnew( SpinBox );
epoints->set_min(1);

View File

@ -48,7 +48,7 @@ class Particles2DEditorPlugin : public EditorPlugin {
};
FileDialog *file;
EditorFileDialog *file;
EditorNode *editor;
MenuButton *menu;

View File

@ -394,7 +394,7 @@ ParticlesEditor::ParticlesEditor() {
add_child(err_dialog);
emission_file_dialog = memnew( FileDialog );
emission_file_dialog = memnew( EditorFileDialog );
add_child(emission_file_dialog);
emission_file_dialog->connect("file_selected",this,"_resource_seleted");
emission_tree_dialog = memnew( SceneTreeDialog );
@ -410,7 +410,7 @@ ParticlesEditor::ParticlesEditor() {
emission_file_dialog->add_filter("*."+extensions[i]+" ; "+extensions[i].to_upper());
}
emission_file_dialog->set_mode(FileDialog::MODE_OPEN_FILE);
emission_file_dialog->set_mode(EditorFileDialog::MODE_OPEN_FILE);
//options->set_anchor(MARGIN_LEFT,Control::ANCHOR_END);
//options->set_anchor(MARGIN_RIGHT,Control::ANCHOR_END);

View File

@ -48,7 +48,7 @@ class ParticlesEditor : public Control {
Particles *node;
FileDialog *emission_file_dialog;
EditorFileDialog *emission_file_dialog;
SceneTreeDialog *emission_tree_dialog;
ConfirmationDialog *err_dialog;

View File

@ -102,7 +102,7 @@ void ResourcePreloaderEditor::_load_pressed() {
for(int i=0;i<extensions.size();i++)
file->add_filter("*."+extensions[i]);
file->set_mode(FileDialog::MODE_OPEN_FILE);
file->set_mode(EditorFileDialog::MODE_OPEN_FILE);
file->popup_centered_ratio();
@ -310,7 +310,7 @@ ResourcePreloaderEditor::ResourcePreloaderEditor() {
paste->set_text("Paste");
hbc->add_child(paste);
file = memnew( FileDialog );
file = memnew( EditorFileDialog );
add_child(file);

View File

@ -49,7 +49,7 @@ class ResourcePreloaderEditor : public PanelContainer {
bool loading_scene;
FileDialog *file;
EditorFileDialog *file;
AcceptDialog *dialog;

View File

@ -111,10 +111,10 @@ RichTextEditor::RichTextEditor() {
options->get_popup()->add_item("Clear",CLEAR);
options->get_popup()->connect("item_pressed", this,"_menu_option");
file_dialog = memnew( FileDialog );
file_dialog = memnew( EditorFileDialog );
add_child(file_dialog);
file_dialog->add_filter("*.txt");
file_dialog->set_mode(FileDialog::MODE_OPEN_FILE);
file_dialog->set_mode(EditorFileDialog::MODE_OPEN_FILE);
file_dialog->connect("file_selected",this,"_file_selected");
}

View File

@ -53,7 +53,7 @@ class RichTextEditor : public Control {
Panel *panel;
MenuButton *options;
RichTextLabel *node;
FileDialog *file_dialog;
EditorFileDialog *file_dialog;
void _file_selected(const String& p_path);
void _menu_option(int p_option);

View File

@ -350,13 +350,13 @@ SampleLibraryEditor::SampleLibraryEditor() {
_delete = memnew( Button );
file = memnew( FileDialog );
file = memnew( EditorFileDialog );
add_child(file);
List<String> extensions;
ResourceLoader::get_recognized_extensions_for_type("Sample",&extensions);
for(int i=0;i<extensions.size();i++)
file->add_filter("*."+extensions[i]);
file->set_mode(FileDialog::MODE_OPEN_FILES);
file->set_mode(EditorFileDialog::MODE_OPEN_FILES);
_delete->set_pos(Point2( 65, 5 ));
_delete->set_size( Size2(1,1 ) );

View File

@ -54,7 +54,7 @@ class SampleLibraryEditor : public Panel {
Button *_delete;
Tree *tree;
FileDialog *file;
EditorFileDialog *file;
ConfirmationDialog *dialog;

View File

@ -115,7 +115,7 @@ void SpriteFramesEditor::_load_pressed() {
for(int i=0;i<extensions.size();i++)
file->add_filter("*."+extensions[i]);
file->set_mode(FileDialog::MODE_OPEN_FILES);
file->set_mode(EditorFileDialog::MODE_OPEN_FILES);
file->popup_centered_ratio();
@ -435,7 +435,7 @@ SpriteFramesEditor::SpriteFramesEditor() {
_delete = memnew( Button );
hbc->add_child(_delete);
file = memnew( FileDialog );
file = memnew( EditorFileDialog );
add_child(file);

View File

@ -54,7 +54,7 @@ class SpriteFramesEditor : public PanelContainer {
int sel;
FileDialog *file;
EditorFileDialog *file;
AcceptDialog *dialog;

View File

@ -408,7 +408,7 @@ void ThemeEditor::_theme_menu_cbk(int p_option) {
if (p_option==POPUP_CREATE_TEMPLATE) {
file_dialog->set_mode(FileDialog::MODE_SAVE_FILE);
file_dialog->set_mode(EditorFileDialog::MODE_SAVE_FILE);
file_dialog->set_current_path("custom.theme");
file_dialog->popup_centered_ratio();
return;
@ -734,7 +734,7 @@ ThemeEditor::ThemeEditor() {
fd_button->set_text("Open File Dialog");
panel->add_child(fd_button);
test_file_dialog = memnew( FileDialog );
test_file_dialog = memnew( EditorFileDialog );
panel->add_child(test_file_dialog);
fd_button->connect("pressed", this,"_open_file_dialog");
@ -804,7 +804,7 @@ ThemeEditor::ThemeEditor() {
add_del_dialog->get_ok()->connect("pressed", this,"_dialog_cbk");
file_dialog = memnew( FileDialog );
file_dialog = memnew( EditorFileDialog );
file_dialog->add_filter("*.theme ; Theme File");
add_child(file_dialog);
file_dialog->connect("file_selected",this,"_save_template_cbk");

View File

@ -48,7 +48,7 @@ class ThemeEditor : public Control {
VBoxContainer *main_vb;
Ref<Theme> theme;
FileDialog *file_dialog;
EditorFileDialog *file_dialog;
double time_left;

View File

@ -563,7 +563,7 @@ void ProjectExportDialog::_update_group_list() {
TreeItem *ti = groups->create_item(r);
ti->set_text(0,E->get());
ti->add_button(0,get_icon("Del","EditorIcons"));
ti->add_button(0,get_icon("Remove","EditorIcons"));
if (E->get()==current) {
ti->select(0);
}
@ -1342,9 +1342,9 @@ ProjectExportDialog::ProjectExportDialog(EditorNode *p_editor) {
expopt="--,Export,Bundle";
file_export = memnew( FileDialog );
file_export = memnew( EditorFileDialog );
add_child(file_export);
file_export->set_access(FileDialog::ACCESS_FILESYSTEM);
file_export->set_access(EditorFileDialog::ACCESS_FILESYSTEM);
file_export->set_current_dir( EditorSettings::get_singleton()->get("global/default_project_export_path") );
file_export->set_title("Export Project");
@ -1361,8 +1361,8 @@ ProjectExportDialog::ProjectExportDialog(EditorNode *p_editor) {
file_export_password->set_editable(false);
file_export->get_vbox()->add_margin_child("Password:",file_export_password);
pck_export = memnew( FileDialog );
pck_export->set_access(FileDialog::ACCESS_FILESYSTEM);
pck_export = memnew( EditorFileDialog );
pck_export->set_access(EditorFileDialog::ACCESS_FILESYSTEM);
pck_export->set_current_dir( EditorSettings::get_singleton()->get("global/default_project_export_path") );
pck_export->set_title("Export Project PCK");
pck_export->connect("file_selected", this,"_export_action_pck");

View File

@ -33,7 +33,7 @@
#include "scene/gui/control.h"
#include "scene/gui/tree.h"
#include "scene/gui/label.h"
#include "scene/gui/file_dialog.h"
#include "tools/editor/editor_file_dialog.h"
#include "scene/gui/button.h"
#include "scene/gui/dialogs.h"
#include "scene/gui/tab_container.h"
@ -80,8 +80,8 @@ private:
Tree * tree;
FileDialog *pck_export;
FileDialog *file_export;
EditorFileDialog *pck_export;
EditorFileDialog *file_export;
CheckButton *file_export_check;
LineEdit *file_export_password;

View File

@ -415,7 +415,7 @@ void ProjectSettings::_update_actions() {
item->set_cell_mode(0,TreeItem::CELL_MODE_CHECK);
item->set_text(0,name);
item->add_button(0,get_icon("Add","EditorIcons"),1);
item->add_button(0,get_icon("Del","EditorIcons"),2);
item->add_button(0,get_icon("Remove","EditorIcons"),2);
item->set_custom_bg_color(0,get_color("prop_subsection","Editor"));
item->set_editable(0,true);
item->set_checked(0,pi.usage&PROPERTY_USAGE_CHECKED);
@ -483,7 +483,7 @@ void ProjectSettings::_update_actions() {
action->set_icon(0,get_icon("JoyAxis","EditorIcons"));
} break;
}
action->add_button(0,get_icon("Del","EditorIcons"),2);
action->add_button(0,get_icon("Remove","EditorIcons"),2);
action->set_metadata(0,i);
}
}
@ -1450,9 +1450,9 @@ ProjectSettings::ProjectSettings(EditorData *p_data) {
translation_list->set_v_size_flags(SIZE_EXPAND_FILL);
tmc->add_child(translation_list);
translation_file_open=memnew( FileDialog );
translation_file_open=memnew( EditorFileDialog );
add_child(translation_file_open);
translation_file_open->set_mode(FileDialog::MODE_OPEN_FILE);
translation_file_open->set_mode(EditorFileDialog::MODE_OPEN_FILE);
translation_file_open->connect("file_selected",this,"_translation_add");
}
@ -1477,9 +1477,9 @@ ProjectSettings::ProjectSettings(EditorData *p_data) {
tmc->add_child(translation_remap);
translation_remap->connect("button_pressed",this,"_translation_res_delete");
translation_res_file_open=memnew( FileDialog );
translation_res_file_open=memnew( EditorFileDialog );
add_child(translation_res_file_open);
translation_res_file_open->set_mode(FileDialog::MODE_OPEN_FILE);
translation_res_file_open->set_mode(EditorFileDialog::MODE_OPEN_FILE);
translation_res_file_open->connect("file_selected",this,"_translation_res_add");
thb = memnew( HBoxContainer);
@ -1507,9 +1507,9 @@ ProjectSettings::ProjectSettings(EditorData *p_data) {
translation_remap_options->connect("item_edited",this,"_translation_res_option_changed");
translation_remap_options->connect("button_pressed",this,"_translation_res_option_delete");
translation_res_option_file_open=memnew( FileDialog );
translation_res_option_file_open=memnew( EditorFileDialog );
add_child(translation_res_option_file_open);
translation_res_option_file_open->set_mode(FileDialog::MODE_OPEN_FILE);
translation_res_option_file_open->set_mode(EditorFileDialog::MODE_OPEN_FILE);
translation_res_option_file_open->connect("file_selected",this,"_translation_res_option_add");
}
@ -1548,9 +1548,9 @@ ProjectSettings::ProjectSettings(EditorData *p_data) {
autoload_list->set_v_size_flags(SIZE_EXPAND_FILL);
avb->add_margin_child("List:",autoload_list,true);
autoload_file_open=memnew( FileDialog );
autoload_file_open=memnew( EditorFileDialog );
add_child(autoload_file_open);
autoload_file_open->set_mode(FileDialog::MODE_OPEN_FILE);
autoload_file_open->set_mode(EditorFileDialog::MODE_OPEN_FILE);
autoload_file_open->connect("file_selected",this,"_autoload_file_callback");
autoload_list->set_columns(2);

View File

@ -67,19 +67,19 @@ class ProjectSettings : public AcceptDialog {
InputEvent last_wait_for_key;
FileDialog *translation_file_open;
EditorFileDialog *translation_file_open;
Tree *translation_list;
Button *translation_res_option_add_button;
FileDialog *translation_res_file_open;
FileDialog *translation_res_option_file_open;
EditorFileDialog *translation_res_file_open;
EditorFileDialog *translation_res_option_file_open;
Tree *translation_remap;
Tree *translation_remap_options;
Tree *autoload_list;
FileDialog *autoload_file_open;
EditorFileDialog *autoload_file_open;
LineEdit *autoload_add_name;
LineEdit *autoload_add_path;

View File

@ -83,7 +83,7 @@ void CustomPropertyEditor::_menu_option(int p_which) {
switch(p_which) {
case OBJ_MENU_LOAD: {
file->set_mode(FileDialog::MODE_OPEN_FILE);
file->set_mode(EditorFileDialog::MODE_OPEN_FILE);
List<String> extensions;
String type=(hint==PROPERTY_HINT_RESOURCE_TYPE)?hint_text:String();
@ -908,11 +908,11 @@ void CustomPropertyEditor::_action_pressed(int p_which) {
if (p_which==0) {
if (hint==PROPERTY_HINT_FILE)
file->set_access(FileDialog::ACCESS_RESOURCES);
file->set_access(EditorFileDialog::ACCESS_RESOURCES);
else
file->set_access(FileDialog::ACCESS_FILESYSTEM);
file->set_access(EditorFileDialog::ACCESS_FILESYSTEM);
file->set_mode(FileDialog::MODE_OPEN_FILE);
file->set_mode(EditorFileDialog::MODE_OPEN_FILE);
file->clear_filters();
file->clear_filters();
@ -946,10 +946,10 @@ void CustomPropertyEditor::_action_pressed(int p_which) {
if (p_which==0) {
if (hint==PROPERTY_HINT_DIR)
file->set_access(FileDialog::ACCESS_RESOURCES);
file->set_access(EditorFileDialog::ACCESS_RESOURCES);
else
file->set_access(FileDialog::ACCESS_FILESYSTEM);
file->set_mode(FileDialog::MODE_OPEN_DIR);
file->set_access(EditorFileDialog::ACCESS_FILESYSTEM);
file->set_mode(EditorFileDialog::MODE_OPEN_DIR);
file->clear_filters();
file->popup_centered_ratio();
} else {
@ -1001,8 +1001,8 @@ void CustomPropertyEditor::_action_pressed(int p_which) {
}
} else if (p_which==1) {
file->set_access(FileDialog::ACCESS_RESOURCES);
file->set_mode(FileDialog::MODE_OPEN_FILE);
file->set_access(EditorFileDialog::ACCESS_RESOURCES);
file->set_mode(EditorFileDialog::MODE_OPEN_FILE);
List<String> extensions;
String type=(hint==PROPERTY_HINT_RESOURCE_TYPE)?hint_text:String();
@ -1081,8 +1081,8 @@ void CustomPropertyEditor::_action_pressed(int p_which) {
} else if (p_which==1) {
file->set_access(FileDialog::ACCESS_RESOURCES);
file->set_mode(FileDialog::MODE_OPEN_FILE);
file->set_access(EditorFileDialog::ACCESS_RESOURCES);
file->set_mode(EditorFileDialog::MODE_OPEN_FILE);
List<String> extensions;
ImageLoader::get_recognized_extensions(&extensions);
@ -1612,7 +1612,7 @@ CustomPropertyEditor::CustomPropertyEditor() {
color_picker->connect("color_changed",this,"_color_changed");
set_as_toplevel(true);
file = memnew ( FileDialog );
file = memnew ( EditorFileDialog );
add_child(file);
file->hide();

View File

@ -32,7 +32,7 @@
#include "scene/gui/tree.h"
#include "scene/gui/button.h"
#include "scene/gui/label.h"
#include "scene/gui/file_dialog.h"
#include "tools/editor/editor_file_dialog.h"
#include "scene/gui/dialogs.h"
#include "scene/gui/color_picker.h"
#include "scene/gui/menu_button.h"
@ -75,7 +75,7 @@ class CustomPropertyEditor : public Popup {
PopupMenu *menu;
SceneTreeDialog *scene_tree;
FileDialog *file;
EditorFileDialog *file;
ConfirmationDialog *error;
String name;
Variant::Type type;

View File

@ -171,7 +171,7 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
if (!_validate_no_foreign())
break;
file->set_mode(FileDialog::MODE_OPEN_FILE);
file->set_mode(EditorFileDialog::MODE_OPEN_FILE);
List<String> extensions;
ResourceLoader::get_recognized_extensions_for_type("PackedScene",&extensions);
file->clear_filters();
@ -484,7 +484,7 @@ void SceneTreeDock::_notification(int p_what) {
"MoveDown",
"Duplicate",
"Reparent",
"Del",
"Remove",
};
for(int i=0;i<TOOL_BUTTON_MAX;i++)
@ -1355,7 +1355,7 @@ SceneTreeDock::SceneTreeDock(EditorNode *p_editor,Node *p_scene_root,EditorSelec
accept = memnew( AcceptDialog );
add_child(accept);
file = memnew( FileDialog );
file = memnew( EditorFileDialog );
add_child(file);
file->connect("file_selected",this,"instance");
set_process_unhandled_key_input(true);

View File

@ -87,7 +87,7 @@ class SceneTreeDock : public VBoxContainer {
ConfirmationDialog *delete_dialog;
ReparentDialog *reparent_dialog;
FileDialog *file;
EditorFileDialog *file;
EditorSubScene *import_subscene_dialog;

View File

@ -184,7 +184,7 @@ void ScriptCreateDialog::_built_in_pressed() {
void ScriptCreateDialog::_browse_path() {
file_browse->set_mode(FileDialog::MODE_SAVE_FILE);
file_browse->set_mode(EditorFileDialog::MODE_SAVE_FILE);
file_browse->clear_filters();
List<String> extensions;
@ -365,7 +365,7 @@ ScriptCreateDialog::ScriptCreateDialog() {
set_hide_on_ok(false);
set_title("Create Script for Node..");;
file_browse = memnew( FileDialog );
file_browse = memnew( EditorFileDialog );
file_browse->connect("file_selected",this,"_file_selected");
add_child(file_browse);
get_ok()->set_text("Create");

View File

@ -32,7 +32,7 @@
#include "scene/gui/dialogs.h"
#include "scene/gui/line_edit.h"
#include "scene/gui/option_button.h"
#include "scene/gui/file_dialog.h"
#include "tools/editor/editor_file_dialog.h"
#include "scene/gui/check_button.h"
class ScriptCreateDialog : public ConfirmationDialog {
@ -44,7 +44,7 @@ class ScriptCreateDialog : public ConfirmationDialog {
LineEdit *parent_name;
OptionButton *language_menu;
LineEdit *file_path;
FileDialog *file_browse;
EditorFileDialog *file_browse;
CheckButton *internal;
VBoxContainer *path_vb;
AcceptDialog *alert;