summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/class_db.cpp2
-rw-r--r--core/core_string_names.cpp2
-rw-r--r--core/io/resource_format_binary.cpp49
-rw-r--r--core/io/resource_format_binary.h2
-rw-r--r--core/io/resource_import.cpp6
-rw-r--r--core/io/resource_loader.cpp8
-rw-r--r--core/math/geometry.h28
-rw-r--r--core/object.cpp8
-rw-r--r--drivers/gles3/rasterizer_canvas_gles3.cpp8
-rw-r--r--drivers/gles3/rasterizer_scene_gles3.cpp6
-rw-r--r--modules/gdscript/gd_function.cpp2
-rw-r--r--modules/gdscript/gd_parser.cpp2
-rw-r--r--modules/gridmap/config.py3
-rw-r--r--modules/gridmap/grid_map.cpp535
-rw-r--r--modules/gridmap/grid_map.h22
-rw-r--r--modules/gridmap/grid_map_editor_plugin.cpp92
-rw-r--r--modules/gridmap/grid_map_editor_plugin.h9
-rw-r--r--prop_renames.txt524
-rw-r--r--scene/2d/canvas_item.cpp4
-rw-r--r--scene/2d/collision_object_2d.cpp2
-rw-r--r--scene/3d/collision_object.cpp1
-rw-r--r--scene/3d/gi_probe.cpp47
-rw-r--r--scene/gui/spin_box.cpp2
-rw-r--r--scene/resources/mesh.cpp4
-rw-r--r--scene/resources/packed_scene.cpp4
-rw-r--r--scene/resources/texture.cpp6
-rw-r--r--scene/resources/texture.h4
-rw-r--r--servers/physics_2d/space_2d_sw.cpp6
-rw-r--r--servers/visual_server.cpp2
-rw-r--r--tools/editor/editor_import_export.cpp266
-rw-r--r--tools/editor/editor_import_export.h378
-rw-r--r--tools/editor/multi_node_edit.cpp12
-rw-r--r--tools/editor/project_settings.cpp14
-rw-r--r--tools/editor/project_settings.h2
-rw-r--r--tools/editor/property_editor.cpp6
35 files changed, 612 insertions, 1456 deletions
diff --git a/core/class_db.cpp b/core/class_db.cpp
index 2eff8c07c7..76c2f0633a 100644
--- a/core/class_db.cpp
+++ b/core/class_db.cpp
@@ -1256,7 +1256,7 @@ void ClassDB::get_extensions_for_type(const StringName& p_class,List<String> *p_
while((K=resource_base_extensions.next(K))) {
StringName cmp = resource_base_extensions[*K];
- if (is_parent_class(cmp,p_class))
+ if (is_parent_class(p_class,cmp))
p_extensions->push_back(*K);
}
}
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/io/resource_format_binary.cpp b/core/io/resource_format_binary.cpp
index c75e476764..2c02dbcc9b 100644
--- a/core/io/resource_format_binary.cpp
+++ b/core/io/resource_format_binary.cpp
@@ -98,6 +98,27 @@ void ResourceInteractiveLoaderBinary::_advance_padding(uint32_t p_len) {
}
+
+StringName ResourceInteractiveLoaderBinary::_get_string() {
+
+ uint32_t id = f->get_32();
+ if (id&0x80000000) {
+ uint32_t len = id&0x7FFFFFFF;
+ if (len>str_buf.size()) {
+ str_buf.resize(len);
+ }
+ if (len==0)
+ return StringName();
+ f->get_buffer((uint8_t*)&str_buf[0],len);
+ String s;
+ s.parse_utf8(&str_buf[0]);
+ return s;
+ }
+
+ return string_map[id];
+
+}
+
Error ResourceInteractiveLoaderBinary::parse_variant(Variant& r_v) {
@@ -272,8 +293,8 @@ Error ResourceInteractiveLoaderBinary::parse_variant(Variant& r_v) {
Image::Format fmt=Image::Format(format&format_version_mask); //if format changes, we can add a compatibility bit on top
-
uint32_t datalen = f->get_32();
+ print_line("image format: "+String(Image::get_format_name(fmt))+" datalen "+itos(datalen));
PoolVector<uint8_t> imgdata;
imgdata.resize(datalen);
@@ -282,6 +303,14 @@ Error ResourceInteractiveLoaderBinary::parse_variant(Variant& r_v) {
_advance_padding(datalen);
w=PoolVector<uint8_t>::Write();
+#ifdef TOOLS_ENABLED
+//compatibility
+ int correct_size = Image::get_image_data_size(width,height,fmt,mipmaps?-1:0);
+ if (correct_size < datalen) {
+ WARN_PRINT("Image data was too large, shrinking for compatibility")
+ imgdata.resize(correct_size);
+ }
+#endif
r_v=Image(width,height,mipmaps,fmt,imgdata);
} else {
@@ -323,10 +352,10 @@ Error ResourceInteractiveLoaderBinary::parse_variant(Variant& r_v) {
for(int i=0;i<name_count;i++)
- names.push_back(string_map[f->get_32()]);
+ names.push_back(_get_string());
for(uint32_t i=0;i<subname_count;i++)
- subnames.push_back(string_map[f->get_32()]);
- property=string_map[f->get_32()];
+ subnames.push_back(_get_string());
+ property=_get_string();
NodePath np = NodePath(names,subnames,absolute,property);
//print_line("got path: "+String(np));
@@ -641,6 +670,8 @@ Error ResourceInteractiveLoaderBinary::poll(){
if (s<external_resources.size()) {
String path = external_resources[s].path;
+
+ print_line("load external res: "+path);
if (remaps.has(path)) {
path=remaps[path];
}
@@ -711,6 +742,8 @@ Error ResourceInteractiveLoaderBinary::poll(){
String t = get_unicode_string();
+// print_line("loading resource of type "+t+" path is "+path);
+
Object *obj = ClassDB::instance(t);
if (!obj) {
error=ERR_FILE_CORRUPT;
@@ -737,8 +770,8 @@ Error ResourceInteractiveLoaderBinary::poll(){
for(int i=0;i<pc;i++) {
- uint32_t name_idx = f->get_32();
- if (name_idx>=(uint32_t)string_map.size()) {
+ StringName name = _get_string();
+ if (name==StringName()) {
error=ERR_FILE_CORRUPT;
ERR_FAIL_V(ERR_FILE_CORRUPT);
}
@@ -749,7 +782,7 @@ Error ResourceInteractiveLoaderBinary::poll(){
if (error)
return error;
- res->set(string_map[name_idx],value);
+ res->set(name,value);
}
#ifdef TOOLS_ENABLED
res->set_edited(false);
@@ -2143,6 +2176,8 @@ void ResourceFormatSaverBinary::get_recognized_extensions(const RES& p_resource,
String base = p_resource->get_base_extension().to_lower();
p_extensions->push_back(base);
+ if (base!="res")
+ p_extensions->push_back("res");
}
diff --git a/core/io/resource_format_binary.h b/core/io/resource_format_binary.h
index 1dac51cc5c..1fab6144d5 100644
--- a/core/io/resource_format_binary.h
+++ b/core/io/resource_format_binary.h
@@ -54,6 +54,8 @@ class ResourceInteractiveLoaderBinary : public ResourceInteractiveLoader {
//Map<int,StringName> string_map;
Vector<StringName> string_map;
+ StringName _get_string();
+
struct ExtResoucre {
String path;
String type;
diff --git a/core/io/resource_import.cpp b/core/io/resource_import.cpp
index 556dff3125..892c2988dc 100644
--- a/core/io/resource_import.cpp
+++ b/core/io/resource_import.cpp
@@ -81,8 +81,10 @@ RES ResourceFormatImporter::load(const String &p_path,const String& p_original_p
RES res = ResourceLoader::load(pat.path,pat.type,false,r_error);
#ifdef TOOLS_ENABLED
- res->set_import_last_modified_time( res->get_last_modified_time() ); //pass this, if used
- res->set_import_path(pat.path);
+ if (res.is_valid()) {
+ res->set_import_last_modified_time( res->get_last_modified_time() ); //pass this, if used
+ res->set_import_path(pat.path);
+ }
#endif
return res;
diff --git a/core/io/resource_loader.cpp b/core/io/resource_loader.cpp
index 3199f05ff8..b6d28bccfa 100644
--- a/core/io/resource_loader.cpp
+++ b/core/io/resource_loader.cpp
@@ -61,6 +61,7 @@ bool ResourceFormatLoader::recognize_path(const String& p_path,const String& p_f
for (List<String>::Element *E=extensions.front();E;E=E->next()) {
+
if (E->get().nocasecmp_to(extension)==0)
return true;
}
@@ -191,12 +192,15 @@ RES ResourceLoader::load(const String &p_path, const String& p_type_hint, bool p
for (int i=0;i<loader_count;i++) {
- if (!loader[i]->recognize_path(local_path,p_type_hint))
+ if (!loader[i]->recognize_path(local_path,p_type_hint)) {
+ print_line("path not recognized");
continue;
+ }
found=true;
RES res = loader[i]->load(local_path,local_path,r_error);
- if (res.is_null())
+ if (res.is_null()) {
continue;
+ }
if (!p_no_cache)
res->set_path(local_path);
#ifdef TOOLS_ENABLED
diff --git a/core/math/geometry.h b/core/math/geometry.h
index 13cbbdce6f..1dd7df038d 100644
--- a/core/math/geometry.h
+++ b/core/math/geometry.h
@@ -109,6 +109,7 @@ public:
static void get_closest_points_between_segments(const Vector3& p1,const Vector3& p2,const Vector3& q1,const Vector3& q2,Vector3& c1, Vector3& c2)
{
+#if 0
//do the function 'd' as defined by pb. I think is is dot product of some sort
#define d_of(m,n,o,p) ( (m.x - n.x) * (o.x - p.x) + (m.y - n.y) * (o.y - p.y) + (m.z - n.z) * (o.z - p.z) )
@@ -123,6 +124,33 @@ public:
if (mub > 1) mub = 1;
c1 = p1.linear_interpolate(p2,mua);
c2 = q1.linear_interpolate(q2,mub);
+#endif
+
+ Vector3 u = p2 - p1;
+ Vector3 v = q2 - q1;
+ Vector3 w = p1 - q1;
+ float a = u.dot(u);
+ float b = u.dot(v);
+ float c = v.dot(v); // always >= 0
+ float d = u.dot(w);
+ float e = v.dot(w);
+ float D = a*c - b*b; // always >= 0
+ float sc, tc;
+
+ // compute the line parameters of the two closest points
+ if (D < CMP_EPSILON) { // the lines are almost parallel
+ sc = 0.0;
+ tc = (b>c ? d/b : e/c); // use the largest denominator
+ }
+ else {
+ sc = (b*e - c*d) / D;
+ tc = (a*e - b*d) / D;
+ }
+
+ c1 = w + sc * u;
+ c2 = w + tc * v;
+ // get the difference of the two closest points
+ //Vector dP = w + (sc * u) - (tc * v); // = L1(sc) - L2(tc)
}
static real_t get_closest_distance_between_segments( const Vector3& p_from_a,const Vector3& p_to_a, const Vector3& p_from_b,const Vector3& p_to_b) {
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/drivers/gles3/rasterizer_scene_gles3.cpp b/drivers/gles3/rasterizer_scene_gles3.cpp
index b504ef819f..a0d486661b 100644
--- a/drivers/gles3/rasterizer_scene_gles3.cpp
+++ b/drivers/gles3/rasterizer_scene_gles3.cpp
@@ -1386,6 +1386,7 @@ void RasterizerSceneGLES3::_render_geometry(RenderList::Element *e) {
int amount = MAX(multi_mesh->size,multi_mesh->visible_instances);
+
if (s->index_array_len>0) {
glDrawElementsInstanced(gl_primitive[s->primitive],s->index_array_len, (s->array_len>=(1<<16))?GL_UNSIGNED_INT:GL_UNSIGNED_SHORT,0,amount);
@@ -1746,6 +1747,7 @@ void RasterizerSceneGLES3::_render_list(RenderList::Element **p_elements,int p_e
RasterizerStorageGLES3::Material* prev_material=NULL;
RasterizerStorageGLES3::Geometry* prev_geometry=NULL;
+ RasterizerStorageGLES3::GeometryOwner* prev_owner=NULL;
VS::InstanceType prev_base_type = VS::INSTANCE_MAX;
int current_blend_mode=-1;
@@ -1765,6 +1767,7 @@ void RasterizerSceneGLES3::_render_list(RenderList::Element **p_elements,int p_e
RasterizerStorageGLES3::Material* material= e->material;
RID skeleton = e->instance->skeleton;
+
bool rebind=first;
int shading = (e->sort_key>>RenderList::SORT_KEY_SHADING_SHIFT)&RenderList::SORT_KEY_SHADING_MASK;
@@ -1934,7 +1937,7 @@ void RasterizerSceneGLES3::_render_list(RenderList::Element **p_elements,int p_e
}
- if (prev_base_type != e->instance->base_type || prev_geometry!=e->geometry) {
+ if (e->owner != prev_owner || prev_base_type != e->instance->base_type || prev_geometry!=e->geometry) {
_setup_geometry(e);
storage->info.render_surface_switch_count++;
@@ -1952,6 +1955,7 @@ void RasterizerSceneGLES3::_render_list(RenderList::Element **p_elements,int p_e
prev_material=material;
prev_base_type=e->instance->base_type;
prev_geometry=e->geometry;
+ prev_owner=e->owner;
prev_shading=shading;
prev_skeleton=skeleton;
first=false;
diff --git a/modules/gdscript/gd_function.cpp b/modules/gdscript/gd_function.cpp
index d7274b5b8e..31bac2748a 100644
--- a/modules/gdscript/gd_function.cpp
+++ b/modules/gdscript/gd_function.cpp
@@ -171,7 +171,7 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a
if (p_state) {
//use existing (supplied) state (yielded)
stack=(Variant*)p_state->stack.ptr();
- call_args=(Variant**)&p_state->stack[sizeof(Variant)*p_state->stack_size];
+ call_args=(Variant**)stack + sizeof(Variant)*p_state->stack_size;
line=p_state->line;
ip=p_state->ip;
alloca_size=p_state->stack.size();
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/modules/gridmap/config.py b/modules/gridmap/config.py
index 1ab13c4aeb..5698a37295 100644
--- a/modules/gridmap/config.py
+++ b/modules/gridmap/config.py
@@ -1,8 +1,7 @@
def can_build(platform):
- # FIXME: Disabled temporary for gles3 implementation
- return False
+ return True
def configure(env):
diff --git a/modules/gridmap/grid_map.cpp b/modules/gridmap/grid_map.cpp
index 1e6bd11154..d4fb174bfe 100644
--- a/modules/gridmap/grid_map.cpp
+++ b/modules/gridmap/grid_map.cpp
@@ -31,7 +31,7 @@
#include "scene/resources/surface_tool.h"
#include "message_queue.h"
#include "scene/3d/light.h"
-#include "scene/3d/baked_light_instance.h"
+
#include "io/marshalls.h"
#include "scene/scene_string_names.h"
#include "os/os.h"
@@ -41,25 +41,21 @@ bool GridMap::_set(const StringName& p_name, const Variant& p_value) {
String name=p_name;
- if (name=="theme/theme") {
+ if (name=="theme") {
set_theme(p_value);
- } else if (name=="cell/size") {
+ } else if (name=="cell_size") {
set_cell_size(p_value);
- } else if (name=="cell/octant_size") {
+ } else if (name=="cell_octant_size") {
set_octant_size(p_value);
- } else if (name=="cell/center_x") {
+ } else if (name=="cell_center_x") {
set_center_x(p_value);
- } else if (name=="cell/center_y") {
+ } else if (name=="cell_center_y") {
set_center_y(p_value);
- } else if (name=="cell/center_z") {
+ } else if (name=="cell_center_z") {
set_center_z(p_value);
- } else if (name=="cell/scale") {
+ } else if (name=="cell_scale") {
set_cell_scale(p_value);
- } else if (name=="lighting/bake") {
- set_use_baked_light(p_value);
- } else if (name=="theme/bake") {
- set_bake(p_value);
/* } else if (name=="cells") {
PoolVector<int> cells = p_value;
int amount=cells.size();
@@ -81,9 +77,6 @@ bool GridMap::_set(const StringName& p_name, const Variant& p_value) {
Dictionary d = p_value;
- Dictionary baked;
- if (d.has("baked"))
- baked=d["baked"];
if (d.has("cells")) {
PoolVector<int> cells = d["cells"];
@@ -101,33 +94,7 @@ bool GridMap::_set(const StringName& p_name, const Variant& p_value) {
}
}
- baked_lock=baked.size()!=0;
_recreate_octant_data();
- baked_lock=false;
- if (!baked.empty()) {
- List<Variant> kl;
- baked.get_key_list(&kl);
- for (List<Variant>::Element *E=kl.front();E;E=E->next()) {
-
- Plane ikv = E->get();
- Ref<Mesh> b=baked[ikv];
- ERR_CONTINUE(!b.is_valid());
- OctantKey ok;
- ok.x=ikv.normal.x;
- ok.y=ikv.normal.y;
- ok.z=ikv.normal.z;
- ok.area=ikv.d;
-
- ERR_CONTINUE(!octant_map.has(ok));
-
- Octant &g = *octant_map[ok];
-
- g.baked=b;
- g.bake_instance=VS::get_singleton()->instance_create();
- VS::get_singleton()->instance_set_base(g.bake_instance,g.baked->get_rid());
- VS::get_singleton()->instance_geometry_set_baked_light(g.bake_instance,baked_light_instance?baked_light_instance->get_baked_light_instance():RID());
- }
- }
} else if (name.begins_with("areas/")) {
@@ -161,24 +128,20 @@ bool GridMap::_get(const StringName& p_name,Variant &r_ret) const {
String name=p_name;
- if (name=="theme/theme") {
+ if (name=="theme") {
r_ret= get_theme();
- } else if (name=="cell/size") {
+ } else if (name=="cell_size") {
r_ret= get_cell_size();
- } else if (name=="cell/octant_size") {
+ } else if (name=="cell_octant_size") {
r_ret= get_octant_size();
- } else if (name=="cell/center_x") {
+ } else if (name=="cell_center_x") {
r_ret= get_center_x();
- } else if (name=="cell/center_y") {
+ } else if (name=="cell_center_y") {
r_ret= get_center_y();
- } else if (name=="cell/center_z") {
+ } else if (name=="cell_center_z") {
r_ret= get_center_z();
- } else if (name=="cell/scale") {
+ } else if (name=="cell_scale") {
r_ret= cell_scale;
- } else if (name=="lighting/bake") {
- r_ret=is_using_baked_light();
- } else if (name=="theme/bake") {
- r_ret= bake;
} else if (name=="data") {
Dictionary d;
@@ -197,23 +160,8 @@ bool GridMap::_get(const StringName& p_name,Variant &r_ret) const {
d["cells"]=cells;
- Dictionary baked;
- for(Map<OctantKey,Octant*>::Element *E=octant_map.front();E;E=E->next()) {
-
- Octant &g=*E->get();
-
- if (g.baked.is_valid()) {
-
- baked[Plane(E->key().x,E->key().y,E->key().z,E->key().area)]=g.baked;
- }
- }
-
- if (baked.size()) {
- d["baked"]=baked;
- }
-
r_ret= d;
} else if (name.begins_with("areas/")) {
int which = name.get_slicec('/',1).to_int();
@@ -237,15 +185,14 @@ bool GridMap::_get(const StringName& p_name,Variant &r_ret) const {
void GridMap::_get_property_list( List<PropertyInfo> *p_list) const {
- p_list->push_back( PropertyInfo( Variant::OBJECT, "theme/theme", PROPERTY_HINT_RESOURCE_TYPE, "MeshLibrary"));
- p_list->push_back( PropertyInfo( Variant::BOOL, "theme/bake"));
- p_list->push_back( PropertyInfo( Variant::BOOL, "lighting/bake"));
- p_list->push_back( PropertyInfo( Variant::REAL, "cell/size",PROPERTY_HINT_RANGE,"0.01,16384,0.01") );
- p_list->push_back( PropertyInfo( Variant::INT, "cell/octant_size",PROPERTY_HINT_RANGE,"1,1024,1") );
- p_list->push_back( PropertyInfo( Variant::BOOL, "cell/center_x") );
- p_list->push_back( PropertyInfo( Variant::BOOL, "cell/center_y") );
- p_list->push_back( PropertyInfo( Variant::BOOL, "cell/center_z") );
- p_list->push_back( PropertyInfo( Variant::REAL, "cell/scale") );
+ p_list->push_back( PropertyInfo( Variant::OBJECT, "theme", PROPERTY_HINT_RESOURCE_TYPE, "MeshLibrary"));
+ p_list->push_back( PropertyInfo( Variant::NIL, "Cell", PROPERTY_HINT_NONE,"cell_",PROPERTY_USAGE_GROUP));
+ p_list->push_back( PropertyInfo( Variant::REAL, "cell_size",PROPERTY_HINT_RANGE,"0.01,16384,0.01") );
+ p_list->push_back( PropertyInfo( Variant::INT, "cell_octant_size",PROPERTY_HINT_RANGE,"1,1024,1") );
+ p_list->push_back( PropertyInfo( Variant::BOOL, "cell_center_x") );
+ p_list->push_back( PropertyInfo( Variant::BOOL, "cell_center_y") );
+ p_list->push_back( PropertyInfo( Variant::BOOL, "cell_center_z") );
+ p_list->push_back( PropertyInfo( Variant::REAL, "cell_scale") );
p_list->push_back( PropertyInfo( Variant::DICTIONARY, "data", PROPERTY_HINT_NONE,"",PROPERTY_USAGE_STORAGE) );
@@ -380,17 +327,6 @@ void GridMap::set_cell_item(int p_x,int p_y,int p_z, int p_item,int p_rot){
g.items.erase(prev_item);
}
-
- if (g.items.empty() || !baked_lock) {
- //unbake just in case
- if (g.baked.is_valid()) {
- VS::get_singleton()->free(g.bake_instance);
- g.bake_instance=RID();
- g.baked=Ref<Mesh>();
- }
-
-
- }
if (g.items.empty()) {
PhysicsServer::get_singleton()->free(g.static_body);
@@ -454,24 +390,12 @@ void GridMap::set_cell_item(int p_x,int p_y,int p_z, int p_item,int p_rot){
ii.navmesh=theme->get_item_navmesh(p_item);
}
ii.multimesh = Ref<MultiMesh>( memnew( MultiMesh ) );
+ ii.multimesh->set_color_format(MultiMesh::COLOR_NONE);
+ ii.multimesh->set_transform_format(MultiMesh::TRANSFORM_3D);
ii.multimesh->set_mesh(ii.mesh);
ii.multimesh_instance = VS::get_singleton()->instance_create();
VS::get_singleton()->instance_set_base(ii.multimesh_instance,ii.multimesh->get_rid());
- VS::get_singleton()->instance_geometry_set_baked_light(ii.multimesh_instance,baked_light_instance?baked_light_instance->get_baked_light_instance():RID());
-
- if (!baked_lock) {
- //unbake just in case
- if (g.bake_instance.is_valid())
- VS::get_singleton()->free(g.bake_instance);
- g.baked=Ref<Mesh>();
- if (is_inside_world()) {
- VS::get_singleton()->instance_set_scenario(ii.multimesh_instance,get_world()->get_scenario());
- if (ok.area) {
- VS::get_singleton()->instance_set_room( ii.multimesh_instance,area_map[ok.area]->instance);
- }
- }
- }
g.items[p_item]=ii;
}
@@ -585,27 +509,14 @@ void GridMap::_octant_enter_world(const OctantKey &p_key) {
VS::get_singleton()->instance_set_room(g.collision_debug_instance,area_map[p_key.area]->instance);
}
}
- if (g.baked.is_valid()) {
+ for(Map<int,Octant::ItemInstances>::Element *E=g.items.front();E;E=E->next()) {
- Transform xf = get_global_transform();
- xf.translate(_octant_get_offset(p_key));
+ VS::get_singleton()->instance_set_scenario(E->get().multimesh_instance,get_world()->get_scenario());
+ VS::get_singleton()->instance_set_transform(E->get().multimesh_instance,get_global_transform());
+ //print_line("INSTANCEPOS: "+get_global_transform());
- VS::get_singleton()->instance_set_transform(g.bake_instance,xf);
- VS::get_singleton()->instance_set_scenario(g.bake_instance,get_world()->get_scenario());
if (area_map.has(p_key.area)) {
- VS::get_singleton()->instance_set_room(g.bake_instance,area_map[p_key.area]->instance);
-
- }
- } else {
- for(Map<int,Octant::ItemInstances>::Element *E=g.items.front();E;E=E->next()) {
-
- VS::get_singleton()->instance_set_scenario(E->get().multimesh_instance,get_world()->get_scenario());
- VS::get_singleton()->instance_set_transform(E->get().multimesh_instance,get_global_transform());
- //print_line("INSTANCEPOS: "+get_global_transform());
-
- if (area_map.has(p_key.area)) {
- VS::get_singleton()->instance_set_room(E->get().multimesh_instance,area_map[p_key.area]->instance);
- }
+ VS::get_singleton()->instance_set_room(E->get().multimesh_instance,area_map[p_key.area]->instance);
}
}
}
@@ -621,17 +532,10 @@ void GridMap::_octant_transform(const OctantKey &p_key) {
VS::get_singleton()->instance_set_transform(g.collision_debug_instance,get_global_transform());
}
- if (g.baked.is_valid()) {
-
- Transform xf = get_global_transform();
- xf.origin+=_octant_get_offset(p_key);
- VS::get_singleton()->instance_set_transform(g.bake_instance,xf);
- } else {
- for(Map<int,Octant::ItemInstances>::Element *E=g.items.front();E;E=E->next()) {
+ for(Map<int,Octant::ItemInstances>::Element *E=g.items.front();E;E=E->next()) {
- VS::get_singleton()->instance_set_transform(E->get().multimesh_instance,get_global_transform());
- //print_line("UPDATEPOS: "+get_global_transform());
- }
+ VS::get_singleton()->instance_set_transform(E->get().multimesh_instance,get_global_transform());
+ //print_line("UPDATEPOS: "+get_global_transform());
}
}
@@ -711,7 +615,7 @@ void GridMap::_octant_update(const OctantKey &p_key) {
ii.multimesh->set_instance_transform(idx,xform);
//ii.multimesh->set_instance_transform(idx,Transform() );
- ii.multimesh->set_instance_color(idx,Color(1,1,1,1));
+ //ii.multimesh->set_instance_color(idx,Color(1,1,1,1));
//print_line("MMINST: "+xform);
@@ -748,7 +652,7 @@ void GridMap::_octant_update(const OctantKey &p_key) {
idx++;
}
- ii.multimesh->set_aabb(aabb);
+ //ii.multimesh->set_aabb(aabb);
}
@@ -760,7 +664,7 @@ void GridMap::_octant_update(const OctantKey &p_key) {
arr.resize(VS::ARRAY_MAX);
arr[VS::ARRAY_VERTEX]=col_debug;
- VS::get_singleton()->mesh_add_surface(g.collision_debug,VS::PRIMITIVE_LINES,arr);
+ VS::get_singleton()->mesh_add_surface_from_arrays(g.collision_debug,VS::PRIMITIVE_LINES,arr);
SceneTree *st=SceneTree::get_singleton();
if (st) {
VS::get_singleton()->mesh_surface_set_material( g.collision_debug, 0,st->get_debug_collision_material()->get_rid() );
@@ -780,13 +684,6 @@ void GridMap::_octant_exit_world(const OctantKey &p_key) {
PhysicsServer::get_singleton()->body_set_space(g.static_body,RID());
- if (g.baked.is_valid()) {
-
- VS::get_singleton()->instance_set_room(g.bake_instance,RID());
- VS::get_singleton()->instance_set_scenario(g.bake_instance,RID());
-
- }
-
if (g.collision_debug_instance.is_valid()) {
VS::get_singleton()->instance_set_room(g.collision_debug_instance,RID());
@@ -802,194 +699,6 @@ void GridMap::_octant_exit_world(const OctantKey &p_key) {
}
-void GridMap::_octant_clear_baked(const OctantKey &p_key) {
-
-
- ERR_FAIL_COND(!octant_map.has(p_key));
- Octant&g = *octant_map[p_key];
-
- if (!g.baked.is_valid())
- return;
-
- VS::get_singleton()->free(g.bake_instance);
- g.bake_instance=RID();
- g.baked=Ref<Mesh>();
-
- if (is_inside_tree())
- _octant_enter_world(p_key);
- g.dirty=true;
- _queue_dirty_map();
-}
-
-void GridMap::_octant_bake(const OctantKey &p_key, const Ref<TriangleMesh>& p_tmesh,const Vector<BakeLight> &p_lights,List<Vector3> *p_prebake) {
-
-
- ERR_FAIL_COND(!octant_map.has(p_key));
- Octant&g = *octant_map[p_key];
-
- Ref<TriangleMesh> tm=p_tmesh;
- if (!p_prebake && is_inside_world())
- _octant_exit_world(p_key);
-
- Map< Ref<Material>, Ref<SurfaceTool> > surfaces;
- Vector3 ofs(cell_size*0.5*int(center_x),cell_size*0.5*int(center_y),cell_size*0.5*int(center_z));
- Vector3 octant_ofs=_octant_get_offset(p_key);
-
- for(Map<int,Octant::ItemInstances>::Element *E=g.items.front();E;E=E->next()) {
-
- Octant::ItemInstances &ii=E->get();
-
- if (ii.mesh.is_null())
- continue;
-
- for(Set<IndexKey>::Element *F=ii.cells.front();F;F=F->next()) {
-
- IndexKey ik=F->get();
- Map<IndexKey,Cell>::Element *C=cell_map.find(ik);
- ERR_CONTINUE(!C);
- Vector3 cellpos = Vector3(ik.x,ik.y,ik.z );
-
- Transform xform;
- xform.basis.set_orthogonal_index(C->get().rot);
- xform.set_origin( cellpos*cell_size+ofs);
- if (!p_prebake)
- xform.origin-=octant_ofs;
-
-
- for(int i=0;i<ii.mesh->get_surface_count();i++) {
-
- if (p_prebake) {
-
- if (ii.mesh->surface_get_primitive_type(i)!=Mesh::PRIMITIVE_TRIANGLES)
- continue;
- Array a = ii.mesh->surface_get_arrays(i);
- PoolVector<Vector3> av=a[VS::ARRAY_VERTEX];
- int avs = av.size();
- PoolVector<Vector3>::Read vr = av.read();
-
- PoolVector<int> ai=a[VS::ARRAY_INDEX];
- int ais=ai.size();
- if (ais) {
-
- PoolVector<int>::Read ir=ai.read();
- for(int j=0;j<ais;j++) {
-
- p_prebake->push_back(xform.xform(vr[ir[j]]));
- //print_line("V SET: "+xform.xform(vr[ir[j]]));
- }
-
- } else {
-
- for(int j=0;j<avs;j++) {
-
- p_prebake->push_back(xform.xform(vr[j]));
- }
- }
-
- } else {
-
- Ref<Material> m = ii.mesh->surface_get_material(i);
-
- Map< Ref<Material>, Ref<SurfaceTool> >::Element *S=surfaces.find(m);
-
- if (!S) {
-
- S=surfaces.insert(m,Ref<SurfaceTool>( memnew( SurfaceTool )));
- }
-
- Ref<SurfaceTool> st = S->get();
- List<SurfaceTool::Vertex>::Element *V=st->get_vertex_array().back();
- st->append_from(ii.mesh,i,xform);
- st->set_material(m);
-
-
- if (tm.is_valid()) {
-
- if (V)
- V=V->next();
- else
- V=st->get_vertex_array().front();
- int lc = p_lights.size();
- const BakeLight* bl = p_lights.ptr();
- float ofs = cell_size*0.02;
-
-
- for(;V;V=V->next()) {
-
- SurfaceTool::Vertex &v=V->get();
-
- Vector3 vertex = v.vertex + octant_ofs;
- //print_line("V GET: "+vertex);
- Vector3 normal = tm->get_area_normal( Rect3( Vector3(-ofs,-ofs,-ofs)+vertex,Vector3(ofs,ofs,ofs)*2.0));
- if (normal==Vector3()) {
- print_line("couldn't find for vertex: "+vertex);
- }
- ERR_CONTINUE( normal== Vector3());
-
- float max_l=1.0;
- float max_dist=1.0;
-
- if (lc) {
-
- for(int j=0;j<lc;j++) {
- const BakeLight &l=bl[j];
- switch(l.type) {
- case VS::LIGHT_DIRECTIONAL: {
-
- Vector3 ray_from=vertex + normal *ofs;
- Vector3 ray_to=l.dir*5000;
- Vector3 n;
- Vector3 p;
- if (tm->intersect_segment(ray_from,ray_to,p,n)) {
-
- float dist = 1.0-l.param[VS::LIGHT_PARAM_SHADOW_DARKENING];
- if (dist<=max_dist) {
- max_dist=dist;
- max_l=1.0-dist;
- }
- }
- } break;
- }
-
- }
- }
-
- v.color=Color(max_l,max_l,max_l,1.0);
-
- }
-
- st->add_to_format(VS::ARRAY_FORMAT_COLOR);
- if (m.is_valid()) {
- Ref<FixedSpatialMaterial> fm = m;
- if (fm.is_valid())
- fm->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_COLOR_ARRAY,true);
- }
- }
- }
- }
- }
- }
-
- if (p_prebake)
- return;
-
- g.baked = Ref<Mesh>( memnew( Mesh ));
-
- for(Map< Ref<Material>, Ref<SurfaceTool> >::Element *E=surfaces.front();E;E=E->next()) {
-
- Ref<SurfaceTool> st = E->get();
- st->commit(g.baked);
- }
-
- g.bake_instance = VS::get_singleton()->instance_create();
- VS::get_singleton()->instance_set_base(g.bake_instance,g.baked->get_rid());
-
- if (is_inside_world())
- _octant_enter_world(p_key);
-
- g.dirty=true;
- _queue_dirty_map();
-}
void GridMap::_notification(int p_what) {
@@ -1011,10 +720,6 @@ void GridMap::_notification(int p_what) {
last_transform=get_global_transform();
- if (use_baked_light) {
-
- _find_baked_light();
- }
} break;
case NOTIFICATION_TRANSFORM_CHANGED: {
@@ -1036,15 +741,6 @@ void GridMap::_notification(int p_what) {
_octant_exit_world(E->key());
}
- if (use_baked_light) {
-
- if (baked_light_instance) {
- baked_light_instance->disconnect(SceneStringNames::get_singleton()->baked_light_changed,this,SceneStringNames::get_singleton()->_baked_light_changed);
- baked_light_instance=NULL;
- }
- _baked_light_changed();
-
- }
//_queue_dirty_map(MAP_DIRTY_INSTANCES|MAP_DIRTY_TRANSFORMS);
//_update_dirty_map_callback();
@@ -1122,9 +818,6 @@ void GridMap::_clear_internal(bool p_keep_areas) {
VS::get_singleton()->free(F->get().multimesh_instance);
}
- //unbake just in case
- if (E->get()->bake_instance.is_valid())
- VS::get_singleton()->free(E->get()->bake_instance);
if (E->get()->collision_debug.is_valid())
VS::get_singleton()->free(E->get()->collision_debug);
@@ -1188,9 +881,6 @@ void GridMap::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_theme","theme:MeshLibrary"),&GridMap::set_theme);
ClassDB::bind_method(D_METHOD("get_theme:MeshLibrary"),&GridMap::get_theme);
- ClassDB::bind_method(D_METHOD("set_bake","enable"),&GridMap::set_bake);
- ClassDB::bind_method(D_METHOD("is_baking_enabled"),&GridMap::is_baking_enabled);
-
ClassDB::bind_method(D_METHOD("set_cell_size","size"),&GridMap::set_cell_size);
ClassDB::bind_method(D_METHOD("get_cell_size"),&GridMap::get_cell_size);
@@ -1226,20 +916,11 @@ void GridMap::_bind_methods() {
ClassDB::bind_method(D_METHOD("area_get_portal_disable_color","area"),&GridMap::area_get_portal_disable_color);
ClassDB::bind_method(D_METHOD("erase_area","area"),&GridMap::erase_area);
ClassDB::bind_method(D_METHOD("get_unused_area_id","area"),&GridMap::get_unused_area_id);
- ClassDB::bind_method(D_METHOD("bake_geometry"),&GridMap::bake_geometry);
-
- ClassDB::bind_method(D_METHOD("_baked_light_changed"),&GridMap::_baked_light_changed);
- ClassDB::bind_method(D_METHOD("set_use_baked_light","use"),&GridMap::set_use_baked_light);
- ClassDB::bind_method(D_METHOD("is_using_baked_light","use"),&GridMap::is_using_baked_light);
-
- ClassDB::bind_method(D_METHOD("_get_baked_light_meshes"),&GridMap::_get_baked_light_meshes);
-
-
-
- ClassDB::set_method_flags("GridMap","bake_geometry",METHOD_FLAGS_DEFAULT|METHOD_FLAG_EDITOR);
ClassDB::bind_method(D_METHOD("clear"),&GridMap::clear);
+ ClassDB::bind_method(D_METHOD("get_meshes"),&GridMap::get_meshes);
+
BIND_CONSTANT( INVALID_CELL_ITEM );
}
@@ -1622,23 +1303,6 @@ int GridMap::get_unused_area_id() const {
return area_map.back()->key()+1;
}
-
-void GridMap::set_bake(bool p_bake) {
-
- bake=p_bake;
- if (bake==false) {
- for(Map<OctantKey,Octant*>::Element *E=octant_map.front();E;E=E->next()) {
-
- _octant_clear_baked(E->key());
- }
- }
-}
-
-bool GridMap::is_baking_enabled() const {
-
- return bake;
-}
-
void GridMap::set_cell_scale(float p_scale) {
cell_scale=p_scale;
@@ -1652,100 +1316,8 @@ float GridMap::get_cell_scale() const{
-void GridMap::bake_geometry() {
-
- //used to compute vertex occlusion
- Ref<TriangleMesh> tmesh;
- Vector<BakeLight> lights;
-
- if (true) {
-
- List<Vector3> vertices;
-
- for(Map<OctantKey,Octant*>::Element *E=octant_map.front();E;E=E->next()) {
- _octant_bake(E->key(),tmesh,lights,&vertices);
-
- }
-
- PoolVector<Vector3> vv;
- vv.fill_with(vertices);
- //print_line("TOTAL VERTICES: "+itos(vv.size()));
- tmesh = Ref<TriangleMesh>( memnew( TriangleMesh ));
- tmesh->create(vv);
-
-
- for(int i=0;i<get_child_count();i++) {
-
- if (get_child(i)->cast_to<Light>()) {
- Light *l = get_child(i)->cast_to<Light>();
- BakeLight bl;
- for(int i=0;i<Light::PARAM_MAX;i++) {
- bl.param[i]=l->get_parameter(Light::Parameter(i));
- }
- Transform t=l->get_global_transform();
- bl.pos=t.origin;
- bl.dir=t.basis.get_axis(2);
- bl.type=l->get_light_type();
- lights.push_back(bl);
-
- }
- }
- }
-
- int idx=0;
- for(Map<OctantKey,Octant*>::Element *E=octant_map.front();E;E=E->next()) {
- if (E->get()->baked.is_valid())
- _octant_clear_baked(E->key());
-
- _octant_bake(E->key(),tmesh,lights);
- print_line("baking "+itos(idx)+"/"+itos(octant_map.size()));
- idx++;
- }
-
-}
-
-void GridMap::_baked_light_changed() {
-
- /*
- if (!baked_light_instance)
- VS::get_singleton()->instance_geometry_set_baked_light(get_instance(),RID());
- else
- VS::get_singleton()->instance_geometry_set_baked_light(get_instance(),baked_light_instance->get_baked_light_instance());
- */
- for(Map<OctantKey,Octant*>::Element *E=octant_map.front();E;E=E->next()) {
-
- for(Map<int,Octant::ItemInstances>::Element *F=E->get()->items.front();F;F=F->next()) {
-
- VS::get_singleton()->instance_geometry_set_baked_light(F->get().multimesh_instance,baked_light_instance?baked_light_instance->get_baked_light_instance():RID());
- }
-
- }
-
-}
-void GridMap::_find_baked_light() {
-
- Node *n=get_parent();
- while(n) {
-
- BakedLightInstance *bl=n->cast_to<BakedLightInstance>();
- if (bl) {
-
- baked_light_instance=bl;
- baked_light_instance->connect(SceneStringNames::get_singleton()->baked_light_changed,this,SceneStringNames::get_singleton()->_baked_light_changed);
- _baked_light_changed();
-
- return;
- }
-
- n=n->get_parent();
- }
-
- _baked_light_changed();
-}
-
-
-Array GridMap::_get_baked_light_meshes() {
+Array GridMap::get_meshes() {
if (theme.is_null())
return Array();
@@ -1783,31 +1355,6 @@ Array GridMap::_get_baked_light_meshes() {
return meshes;
}
-void GridMap::set_use_baked_light(bool p_use) {
-
- if (use_baked_light==p_use)
- return;
-
- use_baked_light=p_use;
-
- if (is_inside_world()) {
- if (!p_use) {
- if (baked_light_instance) {
- baked_light_instance->disconnect(SceneStringNames::get_singleton()->baked_light_changed,this,SceneStringNames::get_singleton()->_baked_light_changed);
- baked_light_instance=NULL;
- }
- _baked_light_changed();
- } else {
- _find_baked_light();
- }
- }
-
-}
-
-bool GridMap::is_using_baked_light() const{
-
- return use_baked_light;
-}
@@ -1825,12 +1372,8 @@ GridMap::GridMap() {
clip_floor=0;
clip_axis=Vector3::AXIS_Z;
clip_above=true;
- baked_lock=false;
- bake=false;
cell_scale=1.0;
- baked_light_instance=NULL;
- use_baked_light=false;
navigation = NULL;
set_notify_transform(true);
diff --git a/modules/gridmap/grid_map.h b/modules/gridmap/grid_map.h
index 04d140cdc6..5d4133383b 100644
--- a/modules/gridmap/grid_map.h
+++ b/modules/gridmap/grid_map.h
@@ -103,8 +103,6 @@ class GridMap : public Spatial {
Ref<NavigationMesh> navmesh;
};
- Ref<Mesh> baked;
- RID bake_instance;
RID collision_debug;
RID collision_debug_instance;
@@ -140,14 +138,12 @@ class GridMap : public Spatial {
float cell_size;
int octant_size;
bool center_x,center_y,center_z;
- bool bake;
float cell_scale;
Navigation *navigation;
bool clip;
bool clip_above;
int clip_floor;
- bool baked_lock;
Vector3::Axis clip_axis;
@@ -205,9 +201,7 @@ class GridMap : public Spatial {
void _octant_exit_world(const OctantKey &p_key);
void _octant_update(const OctantKey &p_key);
void _octant_transform(const OctantKey &p_key);
- void _octant_clear_baked(const OctantKey &p_key);
void _octant_clear_navmesh(const GridMap::OctantKey&);
- void _octant_bake(const OctantKey &p_key,const Ref<TriangleMesh>& p_tmesh=RES(),const Vector<BakeLight> &p_lights=Vector<BakeLight>(),List<Vector3> *r_prebake=NULL);
bool awaiting_update;
void _queue_dirty_map();
@@ -221,14 +215,6 @@ class GridMap : public Spatial {
void _clear_internal(bool p_keep_areas=false);
- BakedLightInstance *baked_light_instance;
- bool use_baked_light;
- void _find_baked_light();
- void _baked_light_changed();
-
-
- Array _get_baked_light_meshes();
-
protected:
bool _set(const StringName& p_name, const Variant& p_value);
@@ -285,13 +271,11 @@ public:
void set_cell_scale(float p_scale);
float get_cell_scale() const;
- void set_bake(bool p_bake);
- bool is_baking_enabled() const;
- void bake_geometry();
- void set_use_baked_light(bool p_use);
- bool is_using_baked_light() const;
+ Array get_meshes();
+
+
void clear();
GridMap();
diff --git a/modules/gridmap/grid_map_editor_plugin.cpp b/modules/gridmap/grid_map_editor_plugin.cpp
index d4c7cb7ca9..2630360058 100644
--- a/modules/gridmap/grid_map_editor_plugin.cpp
+++ b/modules/gridmap/grid_map_editor_plugin.cpp
@@ -249,7 +249,7 @@ void GridMapEditor::_update_cursor_transform() {
if (cursor_instance.is_valid()) {
VisualServer::get_singleton()->instance_set_transform(cursor_instance,cursor_transform);
- VisualServer::get_singleton()->instance_geometry_set_flag(cursor_instance,VS::INSTANCE_FLAG_VISIBLE,cursor_visible);
+ VisualServer::get_singleton()->instance_set_visible(cursor_instance,cursor_visible);
}
}
@@ -852,11 +852,11 @@ void GridMapEditor::edit(GridMap *p_gridmap) {
if (!node) {
set_process(false);
for(int i=0;i<3;i++) {
- VisualServer::get_singleton()->instance_geometry_set_flag(grid_instance[i],VS::INSTANCE_FLAG_VISIBLE,false);
+ VisualServer::get_singleton()->instance_set_visible(grid_instance[i],false);
}
- VisualServer::get_singleton()->instance_geometry_set_flag(cursor_instance, VS::INSTANCE_FLAG_VISIBLE,false);
+ VisualServer::get_singleton()->instance_set_visible(cursor_instance,false);
_clear_areas();
@@ -884,13 +884,11 @@ void GridMapEditor::edit(GridMap *p_gridmap) {
{
//update grids
- indicator_mat = VisualServer::get_singleton()->fixed_material_create();
- VisualServer::get_singleton()->material_set_flag( indicator_mat, VisualServer::MATERIAL_FLAG_UNSHADED, true );
- VisualServer::get_singleton()->material_set_flag( indicator_mat, VisualServer::MATERIAL_FLAG_ONTOP, false );
-
- VisualServer::get_singleton()->fixed_material_set_param(indicator_mat,VisualServer::FIXED_MATERIAL_PARAM_DIFFUSE,Color(0.8,0.5,0.1));
- VisualServer::get_singleton()->fixed_material_set_flag( indicator_mat, VisualServer::FIXED_MATERIAL_FLAG_USE_ALPHA, true );
- VisualServer::get_singleton()->fixed_material_set_flag( indicator_mat, VisualServer::FIXED_MATERIAL_FLAG_USE_COLOR_ARRAY, true );
+ indicator_mat.instance();
+ indicator_mat->set_flag(FixedSpatialMaterial::FLAG_UNSHADED,true);
+ indicator_mat->set_flag(FixedSpatialMaterial::FLAG_SRGB_VERTEX_COLOR,true);
+ indicator_mat->set_flag(FixedSpatialMaterial::FLAG_ALBEDO_FROM_VERTEX_COLOR,true);
+ indicator_mat->set_albedo(Color(0.8,0.5,0.1));
Vector<Vector3> grid_points[3];
@@ -937,8 +935,8 @@ void GridMapEditor::edit(GridMap *p_gridmap) {
d.resize(VS::ARRAY_MAX);
d[VS::ARRAY_VERTEX]=grid_points[i];
d[VS::ARRAY_COLOR]=grid_colors[i];
- VisualServer::get_singleton()->mesh_add_surface(grid[i],VisualServer::PRIMITIVE_LINES,d);
- VisualServer::get_singleton()->mesh_surface_set_material(grid[i],0,indicator_mat);
+ VisualServer::get_singleton()->mesh_add_surface_from_arrays(grid[i],VisualServer::PRIMITIVE_LINES,d);
+ VisualServer::get_singleton()->mesh_surface_set_material(grid[i],0,indicator_mat->get_rid());
}
@@ -976,7 +974,7 @@ void GridMapEditor::update_grid() {
for(int i=0;i<3;i++) {
- VisualServer::get_singleton()->instance_geometry_set_flag(grid_instance[i],VS::INSTANCE_FLAG_VISIBLE,i==edit_axis);
+ VisualServer::get_singleton()->instance_set_visible(grid_instance[i],i==edit_axis);
}
@@ -1103,7 +1101,7 @@ void GridMapEditor::_update_areas_display() {
if (!node) {
return;
}
-
+#if 0
_clear_areas();
List<int> areas;
node->get_area_list(&areas);
@@ -1118,6 +1116,8 @@ void GridMapEditor::_update_areas_display() {
color=Color(1,1,1,0.2);
else
color.set_hsv(Math::fmod(area*0.37,1),Math::fmod(area*0.75,1),1.0,0.2);
+
+
RID material = VisualServer::get_singleton()->fixed_material_create();
VisualServer::get_singleton()->fixed_material_set_param( material, VS::FIXED_MATERIAL_PARAM_DIFFUSE,color );
VisualServer::get_singleton()->fixed_material_set_param( material, VS::FIXED_MATERIAL_PARAM_EMISSION,0.5 );
@@ -1149,7 +1149,7 @@ void GridMapEditor::_update_areas_display() {
this->areas.push_back(ad);
}
-
+#endif
}
void GridMapEditor::_edit_mode_changed(int p_what) {
@@ -1295,7 +1295,7 @@ GridMapEditor::GridMapEditor(EditorNode *p_editor) {
hb->add_child(mode_list);
mode_list->connect("pressed", this, "_set_display_mode", varray(DISPLAY_LIST));
- EDITOR_DEF("editors/grid_map/preview_size",64)
+ EDITOR_DEF("editors/grid_map/preview_size",64);
display_mode = DISPLAY_THUMBNAIL;
selected_area=-1;
@@ -1387,52 +1387,36 @@ GridMapEditor::GridMapEditor(EditorNode *p_editor) {
Array d;
d.resize(VS::ARRAY_MAX);
- inner_mat = VisualServer::get_singleton()->fixed_material_create();
- VisualServer::get_singleton()->fixed_material_set_param(inner_mat,VS::FIXED_MATERIAL_PARAM_DIFFUSE,Color(0.7,0.7,1.0,0.3));
- VisualServer::get_singleton()->material_set_flag(inner_mat,VS::MATERIAL_FLAG_ONTOP,true);
- VisualServer::get_singleton()->material_set_flag(inner_mat,VS::MATERIAL_FLAG_UNSHADED,true);
- VisualServer::get_singleton()->fixed_material_set_flag( inner_mat, VisualServer::FIXED_MATERIAL_FLAG_USE_ALPHA, true );
+ inner_mat.instance();
+ inner_mat->set_albedo(Color(0.7,0.7,1.0,0.3));
+ inner_mat->set_flag(FixedSpatialMaterial::FLAG_ONTOP,true);
+ inner_mat->set_flag(FixedSpatialMaterial::FLAG_UNSHADED,true);
+ inner_mat->set_feature(FixedSpatialMaterial::FEATURE_TRANSPARENT,true);
d[VS::ARRAY_VERTEX]=triangles;
- VisualServer::get_singleton()->mesh_add_surface(selection_mesh,VS::PRIMITIVE_TRIANGLES,d);
- VisualServer::get_singleton()->mesh_surface_set_material(selection_mesh,0,inner_mat);
+ VisualServer::get_singleton()->mesh_add_surface_from_arrays(selection_mesh,VS::PRIMITIVE_TRIANGLES,d);
+ VisualServer::get_singleton()->mesh_surface_set_material(selection_mesh,0,inner_mat->get_rid());
- outer_mat = VisualServer::get_singleton()->fixed_material_create();
- VisualServer::get_singleton()->fixed_material_set_param(outer_mat,VS::FIXED_MATERIAL_PARAM_DIFFUSE,Color(0.7,0.7,1.0,0.8));
- VisualServer::get_singleton()->material_set_line_width(outer_mat,3.0);
- VisualServer::get_singleton()->material_set_flag(outer_mat,VS::MATERIAL_FLAG_ONTOP,true);
- VisualServer::get_singleton()->material_set_flag(outer_mat,VS::MATERIAL_FLAG_UNSHADED,true);
- VisualServer::get_singleton()->fixed_material_set_flag( outer_mat, VisualServer::FIXED_MATERIAL_FLAG_USE_ALPHA, true );
+ outer_mat.instance();
+ outer_mat->set_albedo(Color(0.7,0.7,1.0,0.3));
+ outer_mat->set_flag(FixedSpatialMaterial::FLAG_ONTOP,true);
+ outer_mat->set_flag(FixedSpatialMaterial::FLAG_UNSHADED,true);
+ outer_mat->set_line_width(3.0);
+ outer_mat->set_feature(FixedSpatialMaterial::FEATURE_TRANSPARENT,true);
d[VS::ARRAY_VERTEX]=lines;
- VisualServer::get_singleton()->mesh_add_surface(selection_mesh,VS::PRIMITIVE_LINES,d);
- VisualServer::get_singleton()->mesh_surface_set_material(selection_mesh,1,outer_mat);
-
-
- inner_mat_dup = VisualServer::get_singleton()->fixed_material_create();
- VisualServer::get_singleton()->fixed_material_set_param(inner_mat_dup,VS::FIXED_MATERIAL_PARAM_DIFFUSE,Color(1.0,0.7,0.7,0.3));
- VisualServer::get_singleton()->material_set_flag(inner_mat_dup,VS::MATERIAL_FLAG_ONTOP,true);
- VisualServer::get_singleton()->material_set_flag(inner_mat_dup,VS::MATERIAL_FLAG_UNSHADED,true);
- VisualServer::get_singleton()->fixed_material_set_flag( inner_mat_dup, VisualServer::FIXED_MATERIAL_FLAG_USE_ALPHA, true );
-
+ VisualServer::get_singleton()->mesh_add_surface_from_arrays(selection_mesh,VS::PRIMITIVE_LINES,d);
+ VisualServer::get_singleton()->mesh_surface_set_material(selection_mesh,1,outer_mat->get_rid());
d[VS::ARRAY_VERTEX]=triangles;
- VisualServer::get_singleton()->mesh_add_surface(duplicate_mesh,VS::PRIMITIVE_TRIANGLES,d);
- VisualServer::get_singleton()->mesh_surface_set_material(duplicate_mesh,0,inner_mat_dup);
-
- outer_mat_dup = VisualServer::get_singleton()->fixed_material_create();
- VisualServer::get_singleton()->fixed_material_set_param(outer_mat_dup,VS::FIXED_MATERIAL_PARAM_DIFFUSE,Color(1.0,0.7,0.7,0.8));
- VisualServer::get_singleton()->material_set_line_width(outer_mat_dup,3.0);
- VisualServer::get_singleton()->material_set_flag(outer_mat_dup,VS::MATERIAL_FLAG_ONTOP,true);
- VisualServer::get_singleton()->material_set_flag(outer_mat_dup,VS::MATERIAL_FLAG_UNSHADED,true);
- VisualServer::get_singleton()->fixed_material_set_flag( outer_mat_dup, VisualServer::FIXED_MATERIAL_FLAG_USE_ALPHA, true );
-
+ VisualServer::get_singleton()->mesh_add_surface_from_arrays(duplicate_mesh,VS::PRIMITIVE_TRIANGLES,d);
+ VisualServer::get_singleton()->mesh_surface_set_material(duplicate_mesh,0,inner_mat->get_rid());
d[VS::ARRAY_VERTEX]=lines;
- VisualServer::get_singleton()->mesh_add_surface(duplicate_mesh,VS::PRIMITIVE_LINES,d);
- VisualServer::get_singleton()->mesh_surface_set_material(duplicate_mesh,1,outer_mat_dup);
+ VisualServer::get_singleton()->mesh_add_surface_from_arrays(duplicate_mesh,VS::PRIMITIVE_LINES,d);
+ VisualServer::get_singleton()->mesh_surface_set_material(duplicate_mesh,1,outer_mat->get_rid());
}
@@ -1452,14 +1436,10 @@ GridMapEditor::~GridMapEditor() {
VisualServer::get_singleton()->free(grid[i]);
if (grid_instance[i].is_valid())
VisualServer::get_singleton()->free(grid_instance[i]);
- if (cursor_instance)
+ if (cursor_instance.is_valid())
VisualServer::get_singleton()->free(cursor_instance);
}
- VisualServer::get_singleton()->free(inner_mat);
- VisualServer::get_singleton()->free(outer_mat);
- VisualServer::get_singleton()->free(inner_mat_dup);
- VisualServer::get_singleton()->free(outer_mat_dup);
VisualServer::get_singleton()->free(selection_mesh);
if (selection_instance.is_valid())
diff --git a/modules/gridmap/grid_map_editor_plugin.h b/modules/gridmap/grid_map_editor_plugin.h
index 2c0ff99dc6..66ec5dc4bc 100644
--- a/modules/gridmap/grid_map_editor_plugin.h
+++ b/modules/gridmap/grid_map_editor_plugin.h
@@ -112,12 +112,9 @@ class GridMapEditor : public VBoxContainer {
RID duplicate_mesh;
RID duplicate_instance;
- RID indicator_mat;
-
- RID inner_mat;
- RID outer_mat;
- RID inner_mat_dup;
- RID outer_mat_dup;
+ Ref<FixedSpatialMaterial> indicator_mat;
+ Ref<FixedSpatialMaterial> inner_mat;
+ Ref<FixedSpatialMaterial> outer_mat;
bool updating;
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/scene/2d/canvas_item.cpp b/scene/2d/canvas_item.cpp
index 3574a39940..4f7acf7f97 100644
--- a/scene/2d/canvas_item.cpp
+++ b/scene/2d/canvas_item.cpp
@@ -747,12 +747,12 @@ float CanvasItem::draw_char(const Ref<Font>& p_font,const Point2& p_pos, const S
void CanvasItem::_notify_transform(CanvasItem *p_node) {
- if (p_node->xform_change.in_list() && p_node->global_invalid)
+ if (/*p_node->xform_change.in_list() &&*/ p_node->global_invalid)
return; //nothing to do
p_node->global_invalid=true;
- if (notify_transform && !p_node->xform_change.in_list()) {
+ if (p_node->notify_transform && !p_node->xform_change.in_list()) {
if (!p_node->block_transform_notify) {
if (p_node->is_inside_tree())
get_tree()->xform_change_list.add(&p_node->xform_change);
diff --git a/scene/2d/collision_object_2d.cpp b/scene/2d/collision_object_2d.cpp
index 7b935e0d59..f9e1cc0bd7 100644
--- a/scene/2d/collision_object_2d.cpp
+++ b/scene/2d/collision_object_2d.cpp
@@ -348,6 +348,8 @@ CollisionObject2D::CollisionObject2D(RID p_rid, bool p_area) {
rid=p_rid;
area=p_area;
pickable=true;
+ set_notify_transform(true);
+
if (p_area) {
Physics2DServer::get_singleton()->area_attach_object_instance_ID(rid,get_instance_ID());
diff --git a/scene/3d/collision_object.cpp b/scene/3d/collision_object.cpp
index 09fe7cd2fc..32e60f0d57 100644
--- a/scene/3d/collision_object.cpp
+++ b/scene/3d/collision_object.cpp
@@ -334,6 +334,7 @@ CollisionObject::CollisionObject(RID p_rid, bool p_area) {
area=p_area;
capture_input_on_drag=false;
ray_pickable=true;
+ set_notify_transform(true);
if (p_area) {
PhysicsServer::get_singleton()->area_attach_object_instance_ID(rid,get_instance_ID());
} else {
diff --git a/scene/3d/gi_probe.cpp b/scene/3d/gi_probe.cpp
index 4ce714818f..1d40202318 100644
--- a/scene/3d/gi_probe.cpp
+++ b/scene/3d/gi_probe.cpp
@@ -527,10 +527,16 @@ void GIProbe::_plot_face(int p_idx, int p_level,int p_x,int p_y,int p_z, const V
Vector3 c;
Vector3 inters;
Geometry::get_closest_points_between_segments(p_vtx[j],p_vtx[(j+1)%3],ray_from,ray_to,inters,c);
- float d=c.distance_to(intersection);
- if (j==0 || d<closest_dist) {
- closest_dist=d;
+ if (c==inters) {
+ closest_dist=0;
intersection=inters;
+
+ } else {
+ float d=c.distance_to(intersection);
+ if (j==0 || d<closest_dist) {
+ closest_dist=d;
+ intersection=inters;
+ }
}
}
}
@@ -856,6 +862,10 @@ Vector<Color> GIProbe::_get_bake_texture(Image &p_image,const Color& p_color) {
return ret;
}
+ if (p_image.is_compressed()) {
+ print_line("DECOMPRESSING!!!!");
+ p_image.decompress();
+ }
p_image.convert(Image::FORMAT_RGBA8);
p_image.resize(bake_texture_size,bake_texture_size,Image::INTERPOLATE_CUBIC);
@@ -892,13 +902,14 @@ GIProbe::Baker::MaterialCache GIProbe::_get_material_cache(Ref<Material> p_mater
if (mat.is_valid()) {
-
- Ref<ImageTexture> albedo_tex = mat->get_texture(FixedSpatialMaterial::TEXTURE_ALBEDO);
+ Ref<Texture> albedo_tex = mat->get_texture(FixedSpatialMaterial::TEXTURE_ALBEDO);
Image img_albedo;
if (albedo_tex.is_valid()) {
img_albedo = albedo_tex->get_data();
+ } else {
+
}
mc.albedo=_get_bake_texture(img_albedo,mat->get_albedo());
@@ -950,6 +961,7 @@ void GIProbe::_plot_mesh(const Transform& p_xform, Ref<Mesh>& p_mesh, Baker *p_b
src_material=p_materials[i];
} else {
src_material=p_mesh->surface_get_material(i);
+
}
Baker::MaterialCache material = _get_material_cache(src_material,p_baker);
@@ -1056,6 +1068,31 @@ void GIProbe::_find_meshes(Node *p_at_node,Baker *p_baker){
}
}
+ if (p_at_node->cast_to<Spatial>()) {
+
+ Spatial *s = p_at_node->cast_to<Spatial>();
+ Array meshes = p_at_node->call("get_meshes");
+ for(int i=0;i<meshes.size();i+=2) {
+
+ Transform mxf = meshes[i];
+ Ref<Mesh> mesh = meshes[i+1];
+ if (!mesh.is_valid())
+ continue;
+
+ Rect3 aabb = mesh->get_aabb();
+
+ Transform xf = get_global_transform().affine_inverse() * (s->get_global_transform() * mxf);
+
+ if (Rect3(-extents,extents*2).intersects(xf.xform(aabb))) {
+ Baker::PlotMesh pm;
+ pm.local_xform=xf;
+ pm.mesh=mesh;
+ p_baker->mesh_list.push_back(pm);
+
+ }
+ }
+ }
+
for(int i=0;i<p_at_node->get_child_count();i++) {
Node *child = p_at_node->get_child(i);
diff --git a/scene/gui/spin_box.cpp b/scene/gui/spin_box.cpp
index 2ad1f385db..f2c04d2f76 100644
--- a/scene/gui/spin_box.cpp
+++ b/scene/gui/spin_box.cpp
@@ -100,8 +100,6 @@ void SpinBox::_gui_input(const InputEvent& p_event) {
if (p_event.type==InputEvent::MOUSE_BUTTON && p_event.mouse_button.pressed) {
const InputEventMouseButton &mb=p_event.mouse_button;
- if (mb.doubleclick)
- return; //ignore doubleclick
bool up = mb.y < (get_size().height/2);
diff --git a/scene/resources/mesh.cpp b/scene/resources/mesh.cpp
index 03d516329a..9990a6e796 100644
--- a/scene/resources/mesh.cpp
+++ b/scene/resources/mesh.cpp
@@ -128,8 +128,8 @@ bool Mesh::_set(const StringName& p_name, const Variant& p_value) {
if (d.has("arrays")) {
//old format
- ERR_FAIL_COND_V(!d.has("blend_shape_arrays"),false);
- add_surface_from_arrays(PrimitiveType(int(d["primitive"])),d["arrays"],d["blend_shape_arrays"]);
+ ERR_FAIL_COND_V(!d.has("morph_arrays"),false);
+ add_surface_from_arrays(PrimitiveType(int(d["primitive"])),d["arrays"],d["morph_arrays"]);
} else if (d.has("array_data")) {
diff --git a/scene/resources/packed_scene.cpp b/scene/resources/packed_scene.cpp
index ce755d90db..17688c366a 100644
--- a/scene/resources/packed_scene.cpp
+++ b/scene/resources/packed_scene.cpp
@@ -177,6 +177,9 @@ Node *SceneState::instance(GenEditState p_edit_state) const {
node = obj->cast_to<Node>();
+ } else {
+ print_line("wtf class is disabled for: "+itos(n.type));
+ print_line("name: "+String(snames[n.type]));
}
@@ -196,6 +199,7 @@ Node *SceneState::instance(GenEditState p_edit_state) const {
ERR_FAIL_INDEX_V( nprops[j].name, sname_count, NULL );
ERR_FAIL_INDEX_V( nprops[j].value, prop_count, NULL );
+
if (snames[ nprops[j].name ]==CoreStringNames::get_singleton()->_script) {
//work around to avoid old script variables from disappearing, should be the proper fix to:
//https://github.com/godotengine/godot/issues/2958
diff --git a/scene/resources/texture.cpp b/scene/resources/texture.cpp
index 5e67a9e5b2..e3a856ad4f 100644
--- a/scene/resources/texture.cpp
+++ b/scene/resources/texture.cpp
@@ -754,6 +754,12 @@ bool StreamTexture::has_alpha() const {
return false;
}
+
+Image StreamTexture::get_data() const {
+
+ return VS::get_singleton()->texture_get_data(texture);
+}
+
void StreamTexture::set_flags(uint32_t p_flags){
}
diff --git a/scene/resources/texture.h b/scene/resources/texture.h
index f684aeb658..cae77ad5cf 100644
--- a/scene/resources/texture.h
+++ b/scene/resources/texture.h
@@ -76,7 +76,7 @@ public:
virtual void draw_rect_region(RID p_canvas_item,const Rect2& p_rect, const Rect2& p_src_rect,const Color& p_modulate=Color(1,1,1), bool p_transpose=false) const;
virtual bool get_rect_region(const Rect2& p_rect, const Rect2& p_src_rect,Rect2& r_rect,Rect2& r_src_rect) const;
-
+ virtual Image get_data() const { return Image(); }
Texture();
};
@@ -224,6 +224,8 @@ public:
virtual bool has_alpha() const;
virtual void set_flags(uint32_t p_flags);
+ virtual Image get_data() const;
+
StreamTexture();
~StreamTexture();
diff --git a/servers/physics_2d/space_2d_sw.cpp b/servers/physics_2d/space_2d_sw.cpp
index a48b6d3827..275137ae5a 100644
--- a/servers/physics_2d/space_2d_sw.cpp
+++ b/servers/physics_2d/space_2d_sw.cpp
@@ -622,6 +622,7 @@ bool Space2DSW::test_body_motion(Body2DSW *p_body, const Transform2D &p_from, co
Transform2D body_transform = p_from;
+
{
//STEP 1, FREE BODY IF STUCK
@@ -645,6 +646,7 @@ bool Space2DSW::test_body_motion(Body2DSW *p_body, const Transform2D &p_from, co
bool collided=false;
+
int amount = _cull_aabb_for_body(p_body,body_aabb);
for(int j=0;j<p_body->get_shape_count();j++) {
@@ -682,11 +684,13 @@ bool Space2DSW::test_body_motion(Body2DSW *p_body, const Transform2D &p_from, co
}
- if (!collided)
+ if (!collided) {
break;
+ }
Vector2 recover_motion;
+
for(int i=0;i<cbk.amount;i++) {
Vector2 a = sr[i*2+0];
diff --git a/servers/visual_server.cpp b/servers/visual_server.cpp
index 68767da4ce..dbf8fb442b 100644
--- a/servers/visual_server.cpp
+++ b/servers/visual_server.cpp
@@ -712,7 +712,7 @@ Error VisualServer::_surface_set_data(Array p_arrays,uint32_t p_format,uint32_t
} break;
case VS::ARRAY_BONES: {
- ERR_FAIL_COND_V( p_arrays[ai].get_type() != Variant::POOL_INT_ARRAY, ERR_INVALID_PARAMETER );
+ ERR_FAIL_COND_V( p_arrays[ai].get_type() != Variant::POOL_INT_ARRAY && p_arrays[ai].get_type() != Variant::POOL_REAL_ARRAY, ERR_INVALID_PARAMETER );
PoolVector<int> array = p_arrays[ai];
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/project_settings.cpp b/tools/editor/project_settings.cpp
index 99afe9f3a1..2acd347dc6 100644
--- a/tools/editor/project_settings.cpp
+++ b/tools/editor/project_settings.cpp
@@ -242,7 +242,7 @@ void ProjectSettings::_device_input_add() {
undo_redo->add_undo_method(this,"_settings_changed");
undo_redo->commit_action();
- _show_last_added(ie);
+ _show_last_added(ie, name);
}
@@ -279,12 +279,14 @@ void ProjectSettings::_press_a_key_confirm() {
undo_redo->add_undo_method(this,"_settings_changed");
undo_redo->commit_action();
- _show_last_added(ie);
+ _show_last_added(ie, name);
}
-void ProjectSettings::_show_last_added(const InputEvent& p_event) {
+void ProjectSettings::_show_last_added(const InputEvent& p_event, const String &p_name) {
TreeItem *r = input_editor->get_root();
+ String name = p_name;
+ name.erase(0,6);
if (!r)
return;
r=r->get_children();
@@ -292,6 +294,10 @@ void ProjectSettings::_show_last_added(const InputEvent& p_event) {
return;
bool found = false;
while(r){
+ if (r->get_text(0) != name) {
+ r=r->get_next();
+ continue;
+ }
TreeItem *child = r->get_children();
while(child){
Variant input = child->get_meta("__input");
@@ -377,7 +383,7 @@ void ProjectSettings::_add_item(int p_item){
} break;
case InputEvent::JOYPAD_BUTTON: {
- device_id->set_value(3);
+ device_id->set_value(0);
device_index_label->set_text(TTR("Joypad Button Index:"));
device_index->clear();
diff --git a/tools/editor/project_settings.h b/tools/editor/project_settings.h
index bb925a5fd9..96ac2e2c11 100644
--- a/tools/editor/project_settings.h
+++ b/tools/editor/project_settings.h
@@ -111,7 +111,7 @@ class ProjectSettings : public AcceptDialog {
void _action_button_pressed(Object* p_obj, int p_column,int p_id);
void _wait_for_key(const InputEvent& p_event);
void _press_a_key_confirm();
- void _show_last_added(const InputEvent& p_event);
+ void _show_last_added(const InputEvent& p_event, const String& p_name);
void _settings_prop_edited(const String& p_name);
void _settings_changed();
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)