diff options
-rw-r--r-- | core/core_string_names.cpp | 2 | ||||
-rw-r--r-- | core/object.cpp | 8 | ||||
-rw-r--r-- | drivers/gles3/rasterizer_canvas_gles3.cpp | 8 | ||||
-rw-r--r-- | modules/gdscript/gd_parser.cpp | 2 | ||||
-rw-r--r-- | prop_renames.txt | 524 | ||||
-rw-r--r-- | tools/editor/editor_import_export.cpp | 266 | ||||
-rw-r--r-- | tools/editor/editor_import_export.h | 378 | ||||
-rw-r--r-- | tools/editor/multi_node_edit.cpp | 12 | ||||
-rw-r--r-- | tools/editor/property_editor.cpp | 6 |
9 files changed, 362 insertions, 844 deletions
diff --git a/core/core_string_names.cpp b/core/core_string_names.cpp index a173f98602..f8c6f47797 100644 --- a/core/core_string_names.cpp +++ b/core/core_string_names.cpp @@ -35,7 +35,7 @@ CoreStringNames::CoreStringNames() { _free=StaticCString::create("free"); changed=StaticCString::create("changed"); _meta=StaticCString::create("__meta__"); - _script=StaticCString::create("script/script"); + _script=StaticCString::create("script"); script_changed=StaticCString::create("script_changed"); ___pdcdata=StaticCString::create("___pdcdata"); __getvar=StaticCString::create("__getvar"); diff --git a/core/object.cpp b/core/object.cpp index 730b4209fe..79905a6be6 100644 --- a/core/object.cpp +++ b/core/object.cpp @@ -383,7 +383,7 @@ void Object::set(const String& p_name, const Variant& p_value) { if (p_name=="__meta__") { metadata=p_value; - } else if (p_name=="script/script") { + } else if (p_name=="script") { set_script(p_value); } else if (script_instance) { script_instance->set(p_name,p_value); @@ -516,7 +516,7 @@ Variant Object::get(const String& p_name) const { if (p_name=="__meta__") return metadata; - else if (p_name=="script/script") + else if (p_name=="script") return script; if (script_instance) { @@ -539,7 +539,7 @@ void Object::get_property_list(List<PropertyInfo> *p_list,bool p_reversed) const if (!is_class("Script")) // can still be set, but this is for userfriendlyness - p_list->push_back( PropertyInfo( Variant::OBJECT, "script/script", PROPERTY_HINT_RESOURCE_TYPE, "Script",PROPERTY_USAGE_DEFAULT|PROPERTY_USAGE_STORE_IF_NONZERO)); + p_list->push_back( PropertyInfo( Variant::OBJECT, "script", PROPERTY_HINT_RESOURCE_TYPE, "Script",PROPERTY_USAGE_DEFAULT|PROPERTY_USAGE_STORE_IF_NONZERO)); if (!metadata.empty()) p_list->push_back( PropertyInfo( Variant::DICTIONARY, "__meta__", PROPERTY_HINT_NONE,"",PROPERTY_USAGE_NOEDITOR|PROPERTY_USAGE_STORE_IF_NONZERO)); if (script_instance && !p_reversed) { @@ -1041,7 +1041,7 @@ void Object::set_script(const RefPtr& p_script) { } - _change_notify("script/script"); + _change_notify("script"); emit_signal(CoreStringNames::get_singleton()->script_changed); } diff --git a/drivers/gles3/rasterizer_canvas_gles3.cpp b/drivers/gles3/rasterizer_canvas_gles3.cpp index 2923dfff9f..5980a645fa 100644 --- a/drivers/gles3/rasterizer_canvas_gles3.cpp +++ b/drivers/gles3/rasterizer_canvas_gles3.cpp @@ -382,7 +382,7 @@ void RasterizerCanvasGLES3::_draw_gui_primitive(int p_points, const Vector2 *p_v } - float b[(2+2+4)]; + float b[(2+2+4)*4]; for(int i=0;i<p_points;i++) { @@ -646,7 +646,7 @@ void RasterizerCanvasGLES3::_canvas_item_render_commands(Item *p_item,Item *curr state.canvas_shader.set_uniform(CanvasShaderGLES3::COLOR_TEXPIXEL_SIZE,texpixel_size); } - _draw_polygon(polygon->count,polygon->indices.ptr(),polygon->points.ptr(),polygon->uvs.ptr(),polygon->colors.ptr(),polygon->texture,polygon->colors.size()==1); + //_draw_polygon(polygon->count,polygon->indices.ptr(),polygon->points.ptr(),polygon->uvs.ptr(),polygon->colors.ptr(),polygon->texture,polygon->colors.size()==1); } break; case Item::Command::TYPE_CIRCLE: { @@ -666,7 +666,7 @@ void RasterizerCanvasGLES3::_canvas_item_render_commands(Item *p_item,Item *curr indices[i*3+1]=(i+1)%numpoints; indices[i*3+2]=numpoints; } - _draw_polygon(numpoints*3,indices,points,NULL,&circle->color,RID(),true); + //_draw_polygon(numpoints*3,indices,points,NULL,&circle->color,RID(),true); //canvas_draw_circle(circle->indices.size(),circle->indices.ptr(),circle->points.ptr(),circle->uvs.ptr(),circle->colors.ptr(),circle->texture,circle->colors.size()==1); } break; case Item::Command::TYPE_TRANSFORM: { @@ -1459,7 +1459,7 @@ void RasterizerCanvasGLES3::initialize() { glGenBuffers(1,&data.primitive_quad_buffer); glBindBuffer(GL_ARRAY_BUFFER,data.primitive_quad_buffer); - glBufferData(GL_ARRAY_BUFFER,sizeof(float)*2+sizeof(float)*2+sizeof(float)*4,NULL,GL_DYNAMIC_DRAW); //allocate max size + glBufferData(GL_ARRAY_BUFFER,(2+2+4)*4*sizeof(float),NULL,GL_DYNAMIC_DRAW); //allocate max size glBindBuffer(GL_ARRAY_BUFFER,0); diff --git a/modules/gdscript/gd_parser.cpp b/modules/gdscript/gd_parser.cpp index c1c1f5d5a9..1bda8f0cd3 100644 --- a/modules/gdscript/gd_parser.cpp +++ b/modules/gdscript/gd_parser.cpp @@ -2587,6 +2587,8 @@ void GDParser::_parse_block(BlockNode *p_block,bool p_static) { constants.push_back(c->value); constant=true; } + } else { + constant=false; } } diff --git a/prop_renames.txt b/prop_renames.txt deleted file mode 100644 index e2156f2368..0000000000 --- a/prop_renames.txt +++ /dev/null @@ -1,524 +0,0 @@ -[Object] -script/script = script - -[Node] -pause/pause_mode = pause_mode - -[Control] - -anchor/left = anchor_left -anchor/right = anchor_right -anchor/bottom = anchor_bottom -anchor/top = anchor_top - -focus_neighbour/left=focus_neighbour_left -focus_neighbour/right=focus_neighbour_right -focus_neighbour/bottom=focus_neighbour_bottom -focus_neighbour/top=focus_neighbour_top -focus/ignore_mouse = focus_ignore_mouse -focus/stop_mouse = focus_stop_mouse - -size_flags/horizontal = size_flags_horizontal -size_flags/vertical = size_flags_vertical -size_flags/stretch_ratio = size_flags_stretch_ratio -theme/theme = theme - -[CanvasItem] - -visibility/visible = visible -visibility/behind_parent = show_behind_parent -visibility/on_top = show_on_top -visibility/light_mask = light_mask -material/material = material -material/use_parent = use_parent_material - - -[Resource] - -resource/path = resource_path -resource/name = resource_name - - -[Area2D] - -collision/layers = collision_layers -collision/mask = collision_mask - -[Camera2D] - -limit/left = limit_left -limit/right = limit_right -limit/bottom = limit_bottom -limit/top = limit_top -limit/smoothed = limit_smoothed - -draw_margin/h_enabled = draw_margin_h_enabled -draw_margin/v_enabled = draw_margin_v_enabled - -smoothing/enable = smoothing_enabled -smoothing/speed = smoothing_speed - -drag_margin/left = drag_margin_left -drag_margin/top = drag_margin_top -drag_margin/right = drag_margin_right -drag_margin/bottom = drag_margin_bottom - -[CollisionObject2D] - -input/pickable = input_pickable - -[Joint2D] - -bias/bias = bias -collision/exclude_nodes = disable_collision - -[Light2D] - -range/height = range_height -range/z_min = range_z_min -range/z_max = range_z_max -range/layer_max = range_layer_max -range/item_cull_mask = range_item_cull_max - -shadow/enabled = shadow_enabled -shadow/color = shadow_color -shadow/buffer_size = shadow_buffer_size -shadow/gradient_length = shadow_gradient_length -shadow/filter = shadow_filter -shadow/item_cull_mask = shadow_item_cull_mask - -[Node2D] - -transform/pos = position -transform/rot = rotation -transform/scale = scale -z/z = z -z/relative = z_as_relative - -[ParallaxBackground] - -scroll/offset = scroll_offset -scroll/base_offset = scroll_base_offset -scroll/base_scale = scroll_base_scale -scroll/limit_begin = scroll_limit_begin -scroll/limit_end = scroll_limit_end -scroll/ignore_camera_zoom = scroll_ignore_camera_zoom - -[ParallaxLayer] - -motion/scale = motion_scale -motion/offset = motion_offset -motion/mirroring = motion_mirroring - -[PhysicsBody2D] - -collision/layers = collision_layer -collision/mask = collision_mask - -[Polygon2D] - -texture/texture = texture -texture/offset = texture_offset -texture/rotation = texture_rotation -texture/scale = texture_scale - -invert/enable = invert_enable -invert/border = invert_border - -[SamplePlayer2D] - -config/polyphony = polyphony -config/samples = samples -config/pitch_random = random_pitch - -[SoundPlayer2D] - -params/volume_db = volume_db -params/pitch_scale = pitch_scale -params/attenuation/min_distance = attenuation_min_distance -params/attenuation/max_distance = attenuation_max_distance -params/attenuation/distance_exp = attenuation_distance_exp - -[TileMap] - -cell/size = cell_size -cell/quadrant_size = cell_quadrant_size -cell/half_offset = cell_half_offset -cell/tile_origin = cell_tile_origin -cell/y_sort = cell_y_sort - -collision/use_kinematic = collision_use_kinematic -collision/friction = collision_friction -collision/bounce = collision_bounce -collision/layers = collision_layers -collision/mask = collision_mask - -occluder/light_mask = occluder_light_mask - -[VisibilityEnabler2D] - -enabler/pause_animations = pause_animations -enabler/freeze_bodies = freeze_bodies -enabler/pause_particles = pause_particles -enabler/pause_animated_sprites = pause_animated_sprites -enabler/process_parent = process_parent -enabler/fixed_process_parent = fixed_process_parent - - -[YSort] - -sort/enabled = sort_enabled - - -[Area] - -collision/layers = collision_layers -collision/mask = collision_mask - - -[CollisionObject] - -input/ray_pickable = input_ray_pickable -input/capture_on_drag = input_capture_on_drag - -[Light] - -light/color = light_color -light/energy = light_energy -light/negative = light_negative -light/specular = light_specular -light/cull_mask = light_cull_mask - -shadow/enabled = shadow_enabled -shadow/color = shadow_color -shadow/bias = shadow_bias -shadow/max_distance = shadow_max_distance -editor/editor_only = editor_only - -[DirectionalLight] - -directional_shadow/mode = directional_shadow_mode -directional_shadow/split_1 = directional_shadow_split_1 -directional_shadow/split_2 = directional_shadow_split_2 -directional_shadow/split_3 = directional_shadow_split_3 -directional_shadow/blend_splits = directional_shadow_blend_splits -directional_shadow/normal_bias = directional_shadow_normal_bias -directional_shadow/bias_split_scale = directional_shadow_bias_split_scale - -[OmniLight] - -omni/range = omni_range -omni/attenuation = omni_attenuation -omni/shadow_mode = omni_shadow_mode -omni/shadow_detail = omni_shadow_detail - -[SpotLight] - -spot/range = spot_range -spot/attenuation = spot_attenuation -spot/angle = spot_angle -spot/spot_attenuation = spot_angle_attenuation - -[MeshInstance] - -mesh/mesh = mesh -mesh/skeleton = skeleton - - -[PhysicsBody] - -collision/layers = collision_layer -collision/mask = collision_mask - -[Quad] - -quad/axis = axis -quad/size = size -quad/offset = offset -quad/centered = centered - -[Spatial] - -transform/local = transform -transform/transiation = translation -transform/rotation = rotation -transform/scale = scale -visibility/visible = visible - -[SpatialPlayer] - -params/volume_db = volume_db -params/pitch_scale = pitch_scale -params/attenuation/min_distance = attenuation_min_distance -params/attenuation/max_distance = attenuation_max_distance -params/attenuation/distance_exp = attenuation_distance_exp -params/emission_cone/degrees = emission_cone_degrees -params/emission_cone/attenuation_db = emission_cone_attenuation_db - -[SpatialSamplePlayer] - -config/polyphony = polyphony -config/samples = samples - -[Sprite3D] - -flags/transparent = transparent -flags/shaded = shaded -flags/alpha_cut = alpha_cut - -[VehicleWheel] - -type/traction = use_as_traction -type/steering = use_as_steering - -wheel/radius = wheel_radius -wheel/rest_length = wheel_rest_length -wheel/friction_slip = wheel_friction_sleep - -suspension/travel = suspension_travel -suspension/stiffness = suspension_stiffness -suspension/max_force = suspension_max_force -damping/compression = damping_compression -damping/relaxation = damping_relaxation - -[VehicleBody] - -motion/engine_force = engine_force -motion/breake = breake -motion/steering = steering -body/mass = mass -body/friction = friction - -[VisibilityEnabler] - -enabler/pause_animations = pause_animations -enabler/freeze_bodies = freeze_bodies - -[GeometryInstance] - -geometry/material_override = material_override -geometry/cast_shadow = cast_shadow -geometry/extra_cull_margin = extra_cull_margin -geometry/billboard = use_as_billboard -geometry/billboard_y = use_as_y_billboard -geometry/depth_scale = use_depth_scale -geometry/visible_in_all_rooms = visible_in_all_rooms -geometry/use_baked_light = use_in_baked_light - - - -[AnimationPlayer] - -playback/process_mode = playback_process_mode -playback/default_blend_time = playback_default_blend_time -root/root = root_node - -[AnimationTreePlayer] - -playback/process_mode = playback_process_mode - -[EventPlayer] - -stream/stream = stream -stream/play = play -stream/loop = loop -stream/volume_db = volume_db -stream/pitch_scale = pitch_scale -stream/tempo_scale = tempo_scale -stream/autoplay = autoplay -stream/paused = paused - -[StreamPlayer] - -stream/stream = stream -stream/play = play -stream/loop = loop -stream/volume_db = volume_db -stream/autoplay = autoplay -stream/paused = paused -stream/loop_restart_time = loop_restart_time -stream/buffering_ms = buffering_ms - -[SpatialStreamPlayer] - -stream/stream = stream -stream/play = play -stream/loop = loop -stream/volume_db = volume_db -stream/autoplay = autoplay -stream/paused = paused -stream/loop_restart_time = loop_restart_time -stream/buffering_ms = buffering_ms - -[WindowDialog] - -window/title = window_title - -[AcceptDialog] - -dialog/text = dialog_text -dialog/hide_on_ok = dialog_hide_on_ok - -[LineEdit] - -placeholder/text = placeholder_text -placeholder/alpha = placeholder_alpha -caret/caret_blink = caret_blink -caret/caret_blink_speed = caret_blink_speed - -[Patch9Frame] - -patch_margin/left = patch_margin_left -patch_margin/right = patch_margin_right -patch_margin/top = patch_margin_top -patch_margin/bottom = patch_margin_bottom - - -[Popup] - -popup/exclusive = popup_exclusive - -[ProgressBar] - -percent/visible = percent_visible - -[Range] - -range/min = min_value -range/max = max_value -range/step = step -range/page = page -range/value = value -range/exp_edit = exp_edit -range/rounded = rounded - - -[RigidBody2D] - -velocity/linear = linear_velocity -velocity/angular = angular_velocity -damp_override_linear = linear_damp -damp_override_angular = angular_damp - - -[RigidBody] - -velocity/linear = linear_velocity -velocity/angular = angular_velocity -damp_override_linear = linear_damp -damp_override_angular = angular_damp - -[Tween] - -playback/process_mode = playback_process_mode - -[RichTextLabel] - -bbcode/enabled = bbcode_enabled -bbcode/bbcode = bbcode_text - -[ScrollContainer] - -scroll/horizontal = scroll_horizontal -scroll/vertical = scroll_vertical - -[SplitContainer] - -split/offset = split_offset -split/collapsed = collapsed -split/dragger_visibility = dragger_visibility - -[TextEdit] - -caret/block_caret = caret_block_mode -caret/caret_blink = caret_blink -caret/caret_blink_speed = caret_blink_speed - -[TextureButton] - -textures/normal = texture_normal -textures/pressed = texture_pressed -textures/hover = texture_hover -textures/disabled = texture_disabled -textures/focused = texture_focused -textures/click_mask = texture_click_mask -params/scale = texture_scale -params/modulate = self_modulate - -[TextureProgress] - -texture/under = texture_under -texture/over = texture_over -texture/progress = texture_progress -mode = fill_mode -radial_fill/initial_angle = radial_initial_angle -radial_fill/fill_degrees = radial_fill_degrees -radial_fill/center_offset = radial_center_offset - -[VideoPlayer] - -stream/audio_track = audio_track -stream/stream = stream -stream/volume_db = volume_db -stream/autoplay = stream_autoplay -stream/paused = stream_paused - -[DynamicFont] - -font/size = size -extra_spacing/top = extra_spacing_top -extra_spacing/bottom = extra_spacing_bottom -extra_spacing/char = extra_spacing_char -extra_spacing/space = extra_spacing_space -font/use_mipmaps = use_mipmaps -font/use_filter = use_filter -font/font=font_data - -[StyleBox] - -content_margin/left = content_margin_left -content_margin/right = content_margin_right -content_margin/bottom = content_margin_bottom -content_margin/top = content_margin_top - - -[StyleBoxTexture] - -margin/left = margin_left -margin/top = margin_top -margin/bottom = margin_bottom -margin/right = margin_right - -expand_margin/left = expand_margin_left -expand_margin/top = expand_margin_top -expand_margin/bottom = expand_margin_bottom -expand_margin/right = expand_margin_right - -modulate/color = modulate_color - - -[AnimatedSprite] - -modulate = self_modulate - -[Sprite] - -modulate = self_modulate - -[Patch9Frame] - -modulate = self_modulate - -[TextureRect] - -modulate = self_modulate - - - - - - - - - - diff --git a/tools/editor/editor_import_export.cpp b/tools/editor/editor_import_export.cpp index 320c45776d..5d55de91bd 100644 --- a/tools/editor/editor_import_export.cpp +++ b/tools/editor/editor_import_export.cpp @@ -27,6 +27,272 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ #include "editor_import_export.h" +#include "version.h" +#include "script_language.h" +#include "globals.h" +#include "os/file_access.h" +#include "os/dir_access.h" +#include "tools/editor/editor_file_system.h" +#include "io/resource_loader.h" +#include "editor_node.h" +#include "editor_settings.h" +#include "io/config_file.h" +#include "io/resource_saver.h" +#include "io/md5.h" +#include "tools/editor/plugins/script_editor_plugin.h" +#include "io/zip_io.h" + + + + +bool EditorExportPreset::_set(const StringName& p_name, const Variant& p_value) { + + if (values.has(p_name)) { + values[p_name]=p_value; + return true; + } + + return false; +} + +bool EditorExportPreset::_get(const StringName& p_name,Variant &r_ret) const{ + + if (values.has(p_name)) { + r_ret=values[p_name]; + return true; + } + + return false; +} +void EditorExportPreset::_get_property_list( List<PropertyInfo> *p_list) const{ + + for (const List<PropertyInfo>::Element *E=properties.front();E;E=E->next()) { + + p_list->push_back(E->get()); + } +} + +Vector<StringName> EditorExportPreset::get_files_to_export() const { + + return Vector<StringName>(); +} + + +EditorExportPreset::EditorExportPreset() { + + +} + + +/////////////////////////////////// + +void EditorExportPlatform::gen_debug_flags(Vector<String> &r_flags, int p_flags) { + + String host = EditorSettings::get_singleton()->get("network/debug_host"); + + if (p_flags&DEBUG_FLAG_REMOTE_DEBUG_LOCALHOST) + host="localhost"; + + if (p_flags&DEBUG_FLAG_DUMB_CLIENT) { + int port = EditorSettings::get_singleton()->get("filesystem/file_server/port"); + String passwd = EditorSettings::get_singleton()->get("filesystem/file_server/password"); + r_flags.push_back("-rfs"); + r_flags.push_back(host+":"+itos(port)); + if (passwd!="") { + r_flags.push_back("-rfs_pass"); + r_flags.push_back(passwd); + } + } + + if (p_flags&DEBUG_FLAG_REMOTE_DEBUG) { + + r_flags.push_back("-rdebug"); + + r_flags.push_back(host+":"+String::num(GLOBAL_DEF("network/debug/remote_port", 6007))); + + List<String> breakpoints; + ScriptEditor::get_singleton()->get_breakpoints(&breakpoints); + + + if (breakpoints.size()) { + + r_flags.push_back("-bp"); + String bpoints; + for(const List<String>::Element *E=breakpoints.front();E;E=E->next()) { + + bpoints+=E->get().replace(" ","%20"); + if (E->next()) + bpoints+=","; + } + + r_flags.push_back(bpoints); + } + + } + + if (p_flags&DEBUG_FLAG_VIEW_COLLISONS) { + + r_flags.push_back("-debugcol"); + } + + if (p_flags&DEBUG_FLAG_VIEW_NAVIGATION) { + + r_flags.push_back("-debugnav"); + } +} + +Error EditorExportPlatform::_save_pack_file(void *p_userdata,const String& p_path, const Vector<uint8_t>& p_data,int p_file,int p_total) { + + +} + +Error EditorExportPlatform::_save_zip_file(void *p_userdata,const String& p_path, const Vector<uint8_t>& p_data,int p_file,int p_total) { + + + String path=p_path.replace_first("res://",""); + + ZipData *zd = (ZipData*)p_userdata; + + zipFile zip=(zipFile)zd->zip; + + zipOpenNewFileInZip(zip, + path.utf8().get_data(), + NULL, + NULL, + 0, + NULL, + 0, + NULL, + Z_DEFLATED, + Z_DEFAULT_COMPRESSION); + + zipWriteInFileInZip(zip,p_data.ptr(),p_data.size()); + zipCloseFileInZip(zip); + + zd->ep->step(TTR("Storing File:")+" "+p_path,2+p_file*100/p_total,false); + zd->count++; + return OK; +} + +String EditorExportPlatform::find_export_template(String template_file_name, String *err) const { + + String user_file = EditorSettings::get_singleton()->get_settings_path() + +"/templates/"+template_file_name; + String system_file=OS::get_singleton()->get_installed_templates_path(); + bool has_system_path=(system_file!=""); + system_file+=template_file_name; + + // Prefer user file + if (FileAccess::exists(user_file)) { + return user_file; + } + + // Now check system file + if (has_system_path) { + if (FileAccess::exists(system_file)) { + return system_file; + } + } + + // Not found + if (err) { + *err+="No export template found at \""+user_file+"\""; + if (has_system_path) + *err+="\n or \""+system_file+"\"."; + else + *err+="."; + } + return ""; +} + + +Error EditorExportPlatform::export_project_files(const Ref<EditorExportPreset>& p_preset,EditorExportSaveFunction p_func, void* p_udata) { + + return OK; +} + +Error EditorExportPlatform::save_pack(const Ref<EditorExportPreset>& p_preset,FileAccess *p_where) { + + return OK; +} + +Error EditorExportPlatform::save_zip(const Ref<EditorExportPreset>& p_preset,const String& p_path) { + + return OK; +} + +EditorExportPlatform::EditorExportPlatform() { + + +} + + +//// + +void EditorExport::add_export_platform(const Ref<EditorExportPlatform>& p_platform) { + + export_platforms.push_back(p_platform); +} + +int EditorExport::get_export_platform_count() { + + return export_platforms.size(); +} + +Ref<EditorExportPlatform> EditorExport::get_export_platform(int p_idx) { + + ERR_FAIL_INDEX_V(p_idx,export_platforms.size(),Ref<EditorExportPlatform>()); + + return export_platforms[p_idx]; +} + + +void EditorExport::add_export_preset(const Ref<EditorExportPreset>& p_preset,int p_at_pos) { + + if (p_at_pos<0) + export_presets.push_back(p_preset); + else + export_presets.insert(p_at_pos,p_preset); + + +} + +int EditorExport::get_export_preset_count() const { + + return export_presets.size(); +} + +Ref<EditorExportPreset> EditorExport::get_export_preset(int p_idx) { + + ERR_FAIL_INDEX_V( p_idx, export_presets.size(),Ref<EditorExportPreset>() ); + return export_presets[p_idx]; +} + +void EditorExport::remove_export_preset(int p_idx) { + + export_presets.remove(p_idx); +} + +void EditorExport::load_config() { + + +} + +void EditorExport::save_config() { + +} + +EditorExport::EditorExport() { + + +} + +EditorExport::~EditorExport() { + + +} + +//////// #if 0 #include "version.h" diff --git a/tools/editor/editor_import_export.h b/tools/editor/editor_import_export.h index 2654a4ea33..364ac612a8 100644 --- a/tools/editor/editor_import_export.h +++ b/tools/editor/editor_import_export.h @@ -29,64 +29,54 @@ #ifndef EDITOR_IMPORT_EXPORT_H #define EDITOR_IMPORT_EXPORT_H -#if 0 + #include "resource.h" #include "scene/main/node.h" #include "scene/resources/texture.h" - -class EditorExportPlatform; +class EditorProgress; class FileAccess; -struct EditorProgress; - -class EditorImportPlugin : public Reference { - - GDCLASS( EditorImportPlugin, Reference); - -protected: - - static void _bind_methods(); - - String _validate_source_path(const String& p_path); - String _expand_source_path(const String& p_path); +class EditorExportPreset : public Reference { + GDCLASS( EditorExportPreset,Reference ) public: + enum ExportFilter { + EXPORT_RESOURCES, + EXPORT_SELECTED, + EXPORT_ALL, + }; +private: - static String validate_source_path(const String& p_path); - static String expand_source_path(const String& p_path); - - virtual String get_name() const; - virtual String get_visible_name() const; - virtual void import_dialog(const String& p_from=""); - virtual Error import(const String& p_path, const Ref<ResourceImportMetadata>& p_from); - virtual void import_from_drop(const Vector<String>& p_drop,const String& p_dest_path); - virtual void reimport_multiple_files(const Vector<String>& p_list); - virtual bool can_reimport_multiple_files() const; - virtual Vector<uint8_t> custom_export(const String& p_path,const Ref<EditorExportPlatform> &p_platform); - - EditorImportPlugin(); -}; + ExportFilter export_filter; + String exporter; + Set<String> selected_files; + bool debug; -class EditorExportPlugin : public Reference { +friend class EditorExport; - GDCLASS( EditorExportPlugin, Reference); + List<PropertyInfo> properties; + Map<StringName,Variant> values; protected: - static void _bind_methods(); + bool _set(const StringName& p_name, const Variant& p_value); + bool _get(const StringName& p_name,Variant &r_ret) const; + void _get_property_list( List<PropertyInfo> *p_list) const; public: - virtual Vector<uint8_t> custom_export(String& p_path,const Ref<EditorExportPlatform> &p_platform); + Vector<StringName> get_files_to_export() const; + - EditorExportPlugin(); + EditorExportPreset(); }; + class EditorExportPlatform : public Reference { - GDCLASS( EditorExportPlatform,Reference ); + GDCLASS( EditorExportPlatform,Reference ) public: @@ -94,36 +84,18 @@ public: private: - bool debugging_enabled; - -protected: - - bool _set(const StringName& p_name, const Variant& p_value); - bool _get(const StringName& p_name,Variant &r_ret) const; - void _get_property_list( List<PropertyInfo> *p_list) const; + struct SavedData { - Vector<uint8_t> get_exported_file_default(String& p_fname) const; - virtual Vector<uint8_t> get_exported_file(String& p_fname) const; - virtual Vector<StringName> get_dependencies(bool p_bundles) const; - virtual String find_export_template(String template_file_name, String *err=NULL) const; - virtual bool exists_export_template(String template_file_name, String *err=NULL) const; - - struct TempData { - - uint64_t pos; + String path; uint64_t ofs; uint64_t size; }; struct PackData { - FileAccess *ftmp; FileAccess *f; - Vector<TempData> file_ofs; + Vector<SavedData> file_ofs; EditorProgress *ep; - int count; - int alignment; - }; struct ZipData { @@ -134,292 +106,94 @@ protected: }; - void gen_export_flags(Vector<String> &r_flags, int p_flags); - static Error save_pack_file(void *p_userdata,const String& p_path, const Vector<uint8_t>& p_data,int p_file,int p_total); - static Error save_zip_file(void *p_userdata,const String& p_path, const Vector<uint8_t>& p_data,int p_file,int p_total); + void gen_debug_flags(Vector<String> &r_flags, int p_flags); + static Error _save_pack_file(void *p_userdata,const String& p_path, const Vector<uint8_t>& p_data,int p_file,int p_total); + static Error _save_zip_file(void *p_userdata,const String& p_path, const Vector<uint8_t>& p_data,int p_file,int p_total); -public: - enum ImageCompression { +protected: - IMAGE_COMPRESSION_NONE, - IMAGE_COMPRESSION_INDEXED, // used for older hardware - IMAGE_COMPRESSION_BC, // directx compression format - IMAGE_COMPRESSION_PVRTC, // powervr compression format - IMAGE_COMPRESSION_PVRTC_SQUARE, // powervr compression format, square (ios) - IMAGE_COMPRESSION_ETC1, // ericsson compression format (alpha is uncompressed) - IMAGE_COMPRESSION_ETC2, // ericsson new compression format (can handle alpha) - }; + virtual void get_preset_features(const Ref<EditorExportPreset>& p_preset,List<String*> r_features)=0; + String find_export_template(String template_file_name, String *err=NULL) const; - enum ExportFlags { - EXPORT_DUMB_CLIENT=1, - EXPORT_REMOTE_DEBUG=2, - EXPORT_REMOTE_DEBUG_LOCALHOST=4, - EXPORT_VIEW_COLLISONS=8, - EXPORT_VIEW_NAVIGATION=16, - }; +public: - bool is_debugging_enabled() const; - void set_debugging_enabled( bool p_enabled ); - Error export_project_files(EditorExportSaveFunction p_func, void* p_udata,bool p_make_bundles); + struct ExportOption { + PropertyInfo option; + Variant default_value; - Error save_pack(FileAccess *p_where, bool p_make_bundles=false, int p_alignment = 1); - Error save_zip(const String& p_path, bool p_make_bundles=false); + ExportOption(const PropertyInfo& p_info,const Variant& p_default) { option=p_info; default_value=p_default; } + ExportOption() {} + }; + virtual void get_export_options(ExportOption *r_options)=0; + virtual Ref<EditorExportPreset> create_preset()=0; virtual String get_name() const =0; - virtual ImageCompression get_image_compression() const=0; virtual Ref<Texture> get_logo() const =0; - virtual bool poll_devices() { return false; } - virtual int get_device_count() const { return 0; } - virtual String get_device_name(int p_device) const { return ""; } - virtual String get_device_info(int p_device) const { return ""; } - virtual Error run(int p_device,int p_flags) { return OK; } - - virtual bool can_export(String *r_error=NULL) const=0; - - - virtual bool requires_password(bool p_debug) const { return false; } - virtual String get_binary_extension() const=0; - virtual Error export_project(const String& p_path,bool p_debug,int p_flags=0)=0; - EditorExportPlatform(); -}; + Error export_project_files(const Ref<EditorExportPreset>& p_preset,EditorExportSaveFunction p_func, void* p_udata); -class EditorExportPlatformPC : public EditorExportPlatform { + Error save_pack(const Ref<EditorExportPreset>& p_preset,FileAccess *p_where); + Error save_zip(const Ref<EditorExportPreset>& p_preset,const String& p_path); - GDCLASS( EditorExportPlatformPC,EditorExportPlatform ); -public: + virtual bool poll_devices() { return false; } + virtual int get_device_count() const { return 0; } + virtual String get_device_name(int p_device) const { return ""; } + virtual String get_device_info(int p_device) const { return ""; } - enum ExportMode { - EXPORT_EXE, - EXPORT_PACK, - EXPORT_ZIP + enum DebugFlags { + DEBUG_FLAG_DUMB_CLIENT=1, + DEBUG_FLAG_REMOTE_DEBUG=2, + DEBUG_FLAG_REMOTE_DEBUG_LOCALHOST=4, + DEBUG_FLAG_VIEW_COLLISONS=8, + DEBUG_FLAG_VIEW_NAVIGATION=16, }; + virtual Error run(int p_device,int p_debug_flags) { return OK; } -private: - - - String binary_extension; - String platform; - - String custom_release_binary; - String custom_debug_binary; - String release_binary32; - String debug_binary32; - String release_binary64; - String debug_binary64; - String name; - bool use64; - - Ref<Texture> logo; - - ExportMode export_mode; - bool bundle; -protected: - - bool _set(const StringName& p_name, const Variant& p_value); - bool _get(const StringName& p_name,Variant &r_ret) const; - void _get_property_list( List<PropertyInfo> *p_list) const; - -public: - - virtual String get_name() const { return name; } - virtual Ref<Texture> get_logo() const { return logo; } - virtual ImageCompression get_image_compression() const { return IMAGE_COMPRESSION_BC; } - - virtual String get_binary_extension() const { return binary_extension; } - virtual Error export_project(const String& p_path, bool p_debug, int p_flags=0); - virtual void set_release_binary32(const String& p_binary) { release_binary32=p_binary; } - virtual void set_debug_binary32(const String& p_binary) { debug_binary32=p_binary; } - virtual void set_release_binary64(const String& p_binary) { release_binary64=p_binary; } - virtual void set_debug_binary64(const String& p_binary) { debug_binary64=p_binary; } - virtual void set_name(const String& p_name) { name=p_name; } - virtual void set_logo(const Ref<Texture>& p_logo) { logo=p_logo; } - - virtual bool can_export(String *r_error=NULL) const; + virtual bool can_export(String *r_error=NULL) const=0; - void set_binary_extension(const String& p_extension); + virtual String get_binary_extension() const=0; + virtual Error export_project(const Ref<EditorExportPreset>& p_preset,const String& p_path,int p_flags=0)=0; - EditorExportPlatformPC(); + EditorExportPlatform(); }; -class EditorImportExport : public Node { - GDCLASS(EditorImportExport,Node); -public: +class EditorExport : public Node { + GDCLASS(EditorExport,Node); - enum FileAction { + Vector<Ref<EditorExportPlatform> > export_platforms; + Vector<Ref<EditorExportPreset> > export_presets; - ACTION_NONE, - ACTION_COPY, - ACTION_BUNDLE - }; - - enum ExportFilter { - EXPORT_SELECTED, - EXPORT_RESOURCES, - EXPORT_ALL, - - }; - - enum ImageAction { - IMAGE_ACTION_NONE, - IMAGE_ACTION_COMPRESS_DISK, - IMAGE_ACTION_COMPRESS_RAM, - IMAGE_ACTION_KEEP //for group - - }; - - enum ScriptAction { - SCRIPT_ACTION_NONE, - SCRIPT_ACTION_COMPILE, - SCRIPT_ACTION_ENCRYPT - }; - - enum SampleAction { - - SAMPLE_ACTION_NONE, - SAMPLE_ACTION_COMPRESS_RAM, - }; + static EditorExport *singleton; protected: - struct ImageGroup { - - ImageAction action; - bool make_atlas; - float lossy_quality; - float shrink; - }; - - Vector<Ref<EditorExportPlugin> > export_plugins; - Vector<Ref<EditorImportPlugin> > plugins; - Map<String,int> by_idx; - ImageAction image_action; - float image_action_compress_quality; - float image_shrink; - Set<String> image_formats; - - ExportFilter export_filter; - String export_custom_filter, export_custom_filter_exclude; - Map<StringName,FileAction> files; - Map<StringName,Ref<EditorExportPlatform> > exporters; - Map<StringName,ImageGroup> image_groups; - Map<StringName,StringName> image_group_files; - Vector<String> diff_packs; - - ScriptAction script_action; - String script_key; - - SampleAction sample_action; - int sample_action_max_hz; - bool sample_action_trim; - - bool convert_text_scenes; - - static EditorImportExport* singleton; - - PoolVector<String> _get_export_file_list(); - PoolVector<String> _get_export_platforms(); static void _bind_methods(); public: - static EditorImportExport* get_singleton() { return singleton; } - - void add_import_plugin(const Ref<EditorImportPlugin>& p_plugin); - void remove_import_plugin(const Ref<EditorImportPlugin>& p_plugin); - int get_import_plugin_count() const; - Ref<EditorImportPlugin> get_import_plugin(int p_idx) const; - Ref<EditorImportPlugin> get_import_plugin_by_name(const String& p_string) const; - - void add_export_plugin(const Ref<EditorExportPlugin>& p_plugin); - void remove_export_plugin(const Ref<EditorExportPlugin>& p_plugin); - int get_export_plugin_count() const; - Ref<EditorExportPlugin> get_export_plugin(int p_idx) const; - - bool poll_export_platforms(); - - void set_export_file_action(const StringName& p_export_file, FileAction p_action); - FileAction get_export_file_action(const StringName& p_export_file) const; - void get_export_file_list(List<StringName> *p_export_files); + void add_export_platform(const Ref<EditorExportPlatform>& p_platform); + int get_export_platform_count(); + Ref<EditorExportPlatform> get_export_platform(int p_idx); - void add_export_platform(const Ref<EditorExportPlatform>& p_export); - Ref<EditorExportPlatform> get_export_platform(const StringName& p_platform); - void get_export_platforms(List<StringName> *r_platforms); - void set_export_filter(ExportFilter p_enable); - ExportFilter get_export_filter() const; - - void set_export_custom_filter(const String& p_custom_filter); - void set_export_custom_filter_exclude(const String& p_custom_filter); - String get_export_custom_filter() const; - String get_export_custom_filter_exclude() const; - - void set_export_image_action(ImageAction p_action); - ImageAction get_export_image_action() const; - - void set_export_image_shrink(float p_shrink); - float get_export_image_shrink() const; - - void set_export_image_quality(float p_quality); - float get_export_image_quality() const; - - Vector<String>& get_diff_packs() { return diff_packs; } - - void image_export_group_create(const StringName& p_name); - void image_export_group_remove(const StringName& p_name); - bool image_export_has_group(const StringName& p_name) const; - void image_export_get_groups(List<StringName> *r_name) const; - void image_export_group_set_image_action(const StringName& p_export_group,ImageAction p_action); - ImageAction image_export_group_get_image_action(const StringName& p_export_group) const; - void image_export_group_set_make_atlas(const StringName& p_export_group,bool p_make); - bool image_export_group_get_make_atlas(const StringName& p_export_group) const; - void image_export_group_set_shrink(const StringName& p_export_group,float p_amount); - float image_export_group_get_shrink(const StringName& p_export_group) const; - void image_export_group_set_lossy_quality(const StringName& p_export_group,float p_quality); - float image_export_group_get_lossy_quality(const StringName& p_export_group) const; - - void image_add_to_export_group(const StringName& p_image,const StringName& p_export_group); - StringName image_get_export_group(const StringName& p_image) const; - void image_export_get_images_in_group(const StringName& p_group, List<StringName> *r_images) const; - - Set<String>& get_image_formats() { return image_formats; } - - void script_set_action(ScriptAction p_action); - ScriptAction script_get_action() const; - - void script_set_encryption_key(const String& p_key); - String script_get_encryption_key() const; - - void sample_set_action(SampleAction p_action); - SampleAction sample_get_action() const; - - void sample_set_max_hz(int p_hz); - int sample_get_max_hz() const; - - void sample_set_trim(bool p_trim); - bool sample_get_trim() const; - - void set_convert_text_scenes(bool p_convert); - bool get_convert_text_scenes() const; + void add_export_preset(const Ref<EditorExportPreset>& p_preset,int p_at_pos=-1); + int get_export_preset_count() const; + Ref<EditorExportPreset> get_export_preset(int p_idx); + void remove_export_preset(int p_idx); void load_config(); void save_config(); - EditorImportExport(); - ~EditorImportExport(); + EditorExport(); + ~EditorExport(); }; -VARIANT_ENUM_CAST(EditorImportExport::FileAction); -VARIANT_ENUM_CAST(EditorImportExport::ExportFilter); -VARIANT_ENUM_CAST(EditorImportExport::ImageAction); -VARIANT_ENUM_CAST(EditorImportExport::ScriptAction); -VARIANT_ENUM_CAST(EditorImportExport::SampleAction); -#endif + #endif // EDITOR_IMPORT_EXPORT_H diff --git a/tools/editor/multi_node_edit.cpp b/tools/editor/multi_node_edit.cpp index 97a996fe48..27bb6d66fc 100644 --- a/tools/editor/multi_node_edit.cpp +++ b/tools/editor/multi_node_edit.cpp @@ -38,8 +38,8 @@ bool MultiNodeEdit::_set(const StringName& p_name, const Variant& p_value){ String name = p_name; - if (name=="scripts/script") { // script/script set is intercepted at object level (check Variant Object::get() ) ,so use a different name - name="script/script"; + if (name=="scripts") { // script set is intercepted at object level (check Variant Object::get() ) ,so use a different name + name="script"; } UndoRedo *ur=EditorNode::get_singleton()->get_undo_redo(); @@ -80,8 +80,8 @@ bool MultiNodeEdit::_get(const StringName& p_name,Variant &r_ret) const { return false; String name=p_name; - if (name=="scripts/script") { // script/script set is intercepted at object level (check Variant Object::get() ) ,so use a different name - name="script/script"; + if (name=="scripts") { // script set is intercepted at object level (check Variant Object::get() ) ,so use a different name + name="script"; } for (const List<NodePath>::Element *E=nodes.front();E;E=E->next()) { @@ -129,7 +129,7 @@ void MultiNodeEdit::_get_property_list( List<PropertyInfo> *p_list) const{ for(List<PropertyInfo>::Element *F=plist.front();F;F=F->next()) { - if (F->get().name=="script/script") + if (F->get().name=="script") continue; //added later manually, since this is intercepted before being set (check Variant Object::get() ) if (!usage.has(F->get().name)) { PLData pld; @@ -152,7 +152,7 @@ void MultiNodeEdit::_get_property_list( List<PropertyInfo> *p_list) const{ } } - p_list->push_back(PropertyInfo(Variant::OBJECT,"scripts/script",PROPERTY_HINT_RESOURCE_TYPE,"Script")); + p_list->push_back(PropertyInfo(Variant::OBJECT,"scripts",PROPERTY_HINT_RESOURCE_TYPE,"Script")); } diff --git a/tools/editor/property_editor.cpp b/tools/editor/property_editor.cpp index 9a5fff3fb4..b1528460ea 100644 --- a/tools/editor/property_editor.cpp +++ b/tools/editor/property_editor.cpp @@ -889,7 +889,7 @@ bool CustomPropertyEditor::edit(Object* p_owner,const String& p_name,Variant::Ty menu->clear(); menu->set_size(Size2(1,1)); - if (p_name=="script/script" && hint_text=="Script" && owner->cast_to<Node>()) { + if (p_name=="script" && hint_text=="Script" && owner->cast_to<Node>()) { menu->add_icon_item(get_icon("Script","EditorIcons"),TTR("New Script"),OBJ_MENU_NEW_SCRIPT); menu->add_separator(); } else if (hint_text!="") { @@ -3141,7 +3141,7 @@ void PropertyEditor::update_tree() { continue; - if (hide_script && p.name=="script/script") + if (hide_script && p.name=="script") continue; String basename=p.name; @@ -4780,7 +4780,7 @@ void SectionedPropertyEditor::update_category_list() { else if ( !(pi.usage&PROPERTY_USAGE_EDITOR) ) continue; - if (pi.name.find(":")!=-1 || pi.name=="script/script" || pi.name=="resource_name" || pi.name=="resource_path") + if (pi.name.find(":")!=-1 || pi.name=="script" || pi.name=="resource_name" || pi.name=="resource_path") continue; int sp = pi.name.find("/"); if (sp==-1) |