-fixed export templates not loading/exporting on Windows

-fixed TouchScreenButton with stretch2d
-fixed(?) OSX crash on startup (test!!)
-compilation fixes on windows
-CollisionPolygon editor works again
-find buttons en find dialog
-TileMap editor cleanup (removed "error", made nicer)
-viewport flicker fixed
-make .scn default extension for saving scenes
-export the rest of the network classes to gdscript
This commit is contained in:
Juan Linietsky 2014-02-13 18:03:28 -03:00
parent 1adc330b68
commit 58cda02a38
54 changed files with 1454 additions and 1122 deletions

View File

@ -243,7 +243,7 @@ FileAccessNetworkClient::FileAccessNetworkClient() {
quit=false; quit=false;
singleton=this; singleton=this;
last_id=0; last_id=0;
client = Ref<StreamPeerTCP>( StreamPeerTCP::create() ); client = Ref<StreamPeerTCP>( StreamPeerTCP::create_ref() );
sem=Semaphore::create(); sem=Semaphore::create();
lockcount=0; lockcount=0;
} }

View File

@ -44,7 +44,7 @@ Error PackedData::add_pack(const String& p_path) {
return ERR_FILE_UNRECOGNIZED; return ERR_FILE_UNRECOGNIZED;
}; };
void PackedData::add_path(const String& pkg_path, const String& path, uint64_t ofs, uint64_t size, PackSource* p_src) { void PackedData::add_path(const String& pkg_path, const String& path, uint64_t ofs, uint64_t size,const uint8_t* p_md5, PackSource* p_src) {
bool exists = files.has(path); bool exists = files.has(path);
@ -52,6 +52,8 @@ void PackedData::add_path(const String& pkg_path, const String& path, uint64_t o
pf.pack=pkg_path; pf.pack=pkg_path;
pf.offset=ofs; pf.offset=ofs;
pf.size=size; pf.size=size;
for(int i=0;i<16;i++)
pf.md5[i]=p_md5[i];
pf.src = p_src; pf.src = p_src;
files[path]=pf; files[path]=pf;
@ -163,8 +165,10 @@ bool PackedSourcePCK::try_open_pack(const String& p_path) {
uint64_t ofs = f->get_64(); uint64_t ofs = f->get_64();
uint64_t size = f->get_64(); uint64_t size = f->get_64();
uint8_t md5[16];
f->get_buffer(md5,16);
PackedData::get_singleton()->add_path(p_path, path, ofs, size, this); PackedData::get_singleton()->add_path(p_path, path, ofs, size, md5,this);
}; };
return true; return true;

View File

@ -46,8 +46,9 @@ public:
struct PackedFile { struct PackedFile {
String pack; String pack;
uint64_t offset; uint64_t offset; //if offset is ZERO, the file was ERASED
uint64_t size; uint64_t size;
uint8_t md5[16];
PackSource* src; PackSource* src;
}; };
@ -72,7 +73,7 @@ private:
public: public:
void add_pack_source(PackSource* p_source); void add_pack_source(PackSource* p_source);
void add_path(const String& pkg_path, const String& path, uint64_t ofs, uint64_t size, PackSource* p_src); // for PackSource void add_path(const String& pkg_path, const String& path, uint64_t ofs, uint64_t size,const uint8_t* p_md5, PackSource* p_src); // for PackSource
void set_disabled(bool p_disabled) { disabled=p_disabled; } void set_disabled(bool p_disabled) { disabled=p_disabled; }
_FORCE_INLINE_ bool is_disabled() const { return disabled; } _FORCE_INLINE_ bool is_disabled() const { return disabled; }
@ -150,11 +151,13 @@ public:
FileAccess *PackedData::try_open_path(const String& p_path) { FileAccess *PackedData::try_open_path(const String& p_path) {
if (files.has(p_path)) { Map<String,PackedFile>::Element *E=files.find(p_path);
return files[p_path].src->get_file(p_path, &files[p_path]); if (!E)
} return NULL; //not found
if (E->get().offset==0)
return NULL; //was erased
return NULL; return E->get().src->get_file(p_path, &E->get());
} }
bool PackedData::has_path(const String& p_path) { bool PackedData::has_path(const String& p_path) {

View File

@ -197,7 +197,8 @@ bool ZipArchive::try_open_pack(const String& p_name) {
String fname = String("res://") + filename_inzip; String fname = String("res://") + filename_inzip;
files[fname] = f; files[fname] = f;
PackedData::get_singleton()->add_path(p_name, fname, 0, 0, this); uint8_t md5[16]={0,0,0,0,0,0,0,0 , 0,0,0,0,0,0,0,0};
PackedData::get_singleton()->add_path(p_name, fname, 0, 0, md5, this);
if ((i+1)<gi.number_entry) { if ((i+1)<gi.number_entry) {
unzGoToNextFile(zfile); unzGoToNextFile(zfile);

View File

@ -620,7 +620,7 @@ void HTTPClient::_bind_methods() {
HTTPClient::HTTPClient(){ HTTPClient::HTTPClient(){
tcp_connection = StreamPeerTCP::create(); tcp_connection = StreamPeerTCP::create_ref();
resolving = IP::RESOLVER_INVALID_ID; resolving = IP::RESOLVER_INVALID_ID;
status=STATUS_DISCONNECTED; status=STATUS_DISCONNECTED;
conn_port=80; conn_port=80;

View File

@ -68,6 +68,8 @@ void fill_zlib_filefunc64_32_def_from_filefunc32(zlib_filefunc64_32_def* p_filef
p_filefunc64_32->zfile_func64.opaque = p_filefunc32->opaque; p_filefunc64_32->zfile_func64.opaque = p_filefunc32->opaque;
p_filefunc64_32->zseek32_file = p_filefunc32->zseek_file; p_filefunc64_32->zseek32_file = p_filefunc32->zseek_file;
p_filefunc64_32->ztell32_file = p_filefunc32->ztell_file; p_filefunc64_32->ztell32_file = p_filefunc32->ztell_file;
p_filefunc64_32->zfile_func64.alloc_mem = p_filefunc32->alloc_mem;
p_filefunc64_32->zfile_func64.free_mem = p_filefunc32->free_mem;
} }
/* /*

View File

@ -144,6 +144,8 @@ typedef struct zlib_filefunc_def_s
close_file_func zclose_file; close_file_func zclose_file;
testerror_file_func zerror_file; testerror_file_func zerror_file;
voidpf opaque; voidpf opaque;
alloc_func alloc_mem;
free_func free_mem;
} zlib_filefunc_def; } zlib_filefunc_def;
typedef ZPOS64_T (ZCALLBACK *tell64_file_func) OF((voidpf opaque, voidpf stream)); typedef ZPOS64_T (ZCALLBACK *tell64_file_func) OF((voidpf opaque, voidpf stream));
@ -160,6 +162,9 @@ typedef struct zlib_filefunc64_def_s
close_file_func zclose_file; close_file_func zclose_file;
testerror_file_func zerror_file; testerror_file_func zerror_file;
voidpf opaque; voidpf opaque;
alloc_func alloc_mem;
free_func free_mem;
} zlib_filefunc64_def; } zlib_filefunc64_def;
void fill_fopen64_filefunc OF((zlib_filefunc64_def* pzlib_filefunc_def)); void fill_fopen64_filefunc OF((zlib_filefunc64_def* pzlib_filefunc_def));

View File

@ -26,31 +26,38 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/ /*************************************************************************/
#include "stream_peer_tcp.h" #include "stream_peer_tcp.h"
StreamPeerTCP* (*StreamPeerTCP::_create)()=NULL; StreamPeerTCP* (*StreamPeerTCP::_create)()=NULL;
void StreamPeerTCP::_bind_methods() { void StreamPeerTCP::_bind_methods() {
ObjectTypeDB::bind_method(_MD("connect","host","ip"),&StreamPeerTCP::connect); ObjectTypeDB::bind_method(_MD("connect","host","ip"),&StreamPeerTCP::connect);
ObjectTypeDB::bind_method(_MD("is_connected"),&StreamPeerTCP::is_connected); ObjectTypeDB::bind_method(_MD("is_connected"),&StreamPeerTCP::is_connected);
ObjectTypeDB::bind_method(_MD("get_connected_host"),&StreamPeerTCP::get_connected_host); ObjectTypeDB::bind_method(_MD("get_connected_host"),&StreamPeerTCP::get_connected_host);
ObjectTypeDB::bind_method(_MD("get_connected_port"),&StreamPeerTCP::get_connected_port); ObjectTypeDB::bind_method(_MD("get_connected_port"),&StreamPeerTCP::get_connected_port);
ObjectTypeDB::bind_method(_MD("disconnect"),&StreamPeerTCP::disconnect); ObjectTypeDB::bind_method(_MD("disconnect"),&StreamPeerTCP::disconnect);
} }
Ref<StreamPeerTCP> StreamPeerTCP::create() { Ref<StreamPeerTCP> StreamPeerTCP::create_ref() {
if (!_create) if (!_create)
return Ref<StreamPeerTCP>(); return Ref<StreamPeerTCP>();
return Ref<StreamPeerTCP>(_create()); return Ref<StreamPeerTCP>(_create());
} }
StreamPeerTCP::StreamPeerTCP() { StreamPeerTCP* StreamPeerTCP::create() {
} if (!_create)
return NULL;
StreamPeerTCP::~StreamPeerTCP() { return _create();
}
};
StreamPeerTCP::StreamPeerTCP() {
}
StreamPeerTCP::~StreamPeerTCP() {
};

View File

@ -26,50 +26,51 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/ /*************************************************************************/
#ifndef STREAM_PEER_TCP_H #ifndef STREAM_PEER_TCP_H
#define STREAM_PEER_TCP_H #define STREAM_PEER_TCP_H
#include "stream_peer.h" #include "stream_peer.h"
#include "ip_address.h" #include "ip_address.h"
class StreamPeerTCP : public StreamPeer { class StreamPeerTCP : public StreamPeer {
OBJ_TYPE( StreamPeerTCP, StreamPeer ); OBJ_TYPE( StreamPeerTCP, StreamPeer );
OBJ_CATEGORY("Networking"); OBJ_CATEGORY("Networking");
public: public:
enum Status { enum Status {
STATUS_NONE, STATUS_NONE,
STATUS_CONNECTING, STATUS_CONNECTING,
STATUS_CONNECTED, STATUS_CONNECTED,
STATUS_ERROR, STATUS_ERROR,
}; };
protected: protected:
static StreamPeerTCP* (*_create)(); static StreamPeerTCP* (*_create)();
static void _bind_methods(); static void _bind_methods();
public: public:
virtual Error connect(const IP_Address& p_host, uint16_t p_port)=0; virtual Error connect(const IP_Address& p_host, uint16_t p_port)=0;
//read/write from streampeer //read/write from streampeer
virtual bool is_connected() const=0; virtual bool is_connected() const=0;
virtual Status get_status() const=0; virtual Status get_status() const=0;
virtual void disconnect()=0; virtual void disconnect()=0;
virtual IP_Address get_connected_host() const=0; virtual IP_Address get_connected_host() const=0;
virtual uint16_t get_connected_port() const=0; virtual uint16_t get_connected_port() const=0;
virtual void set_nodelay(bool p_enabled)=0; virtual void set_nodelay(bool p_enabled)=0;
static Ref<StreamPeerTCP> create(); static Ref<StreamPeerTCP> create_ref();
static StreamPeerTCP* create();
StreamPeerTCP();
~StreamPeerTCP(); StreamPeerTCP();
}; ~StreamPeerTCP();
};
#endif
#endif

View File

@ -30,13 +30,20 @@
TCP_Server* (*TCP_Server::_create)()=NULL; TCP_Server* (*TCP_Server::_create)()=NULL;
Ref<TCP_Server> TCP_Server::create() { Ref<TCP_Server> TCP_Server::create_ref() {
if (!_create) if (!_create)
return NULL; return NULL;
return Ref<TCP_Server>(_create()); return Ref<TCP_Server>(_create());
} }
TCP_Server* TCP_Server::create() {
if (!_create)
return NULL;
return _create();
}
Error TCP_Server::_listen(uint16_t p_port,DVector<String> p_accepted_hosts) { Error TCP_Server::_listen(uint16_t p_port,DVector<String> p_accepted_hosts) {
List<String> hosts; List<String> hosts;

View File

@ -51,7 +51,8 @@ public:
virtual void stop()=0; //stop listening virtual void stop()=0; //stop listening
static Ref<TCP_Server> create(); static Ref<TCP_Server> create_ref();
static TCP_Server* create();
TCP_Server(); TCP_Server();
}; };

View File

@ -1588,8 +1588,8 @@ extern int ZEXPORT unzOpenCurrentFile3 (unzFile file, int* method,
} }
else if ((s->cur_file_info.compression_method==Z_DEFLATED) && (!raw)) else if ((s->cur_file_info.compression_method==Z_DEFLATED) && (!raw))
{ {
pfile_in_zip_read_info->stream.zalloc = (alloc_func)0; pfile_in_zip_read_info->stream.zalloc = s->z_filefunc.zfile_func64.alloc_mem;
pfile_in_zip_read_info->stream.zfree = (free_func)0; pfile_in_zip_read_info->stream.zfree = s->z_filefunc.zfile_func64.free_mem;
pfile_in_zip_read_info->stream.opaque = (voidpf)0; pfile_in_zip_read_info->stream.opaque = (voidpf)0;
pfile_in_zip_read_info->stream.next_in = 0; pfile_in_zip_read_info->stream.next_in = 0;
pfile_in_zip_read_info->stream.avail_in = 0; pfile_in_zip_read_info->stream.avail_in = 0;
@ -1599,6 +1599,7 @@ extern int ZEXPORT unzOpenCurrentFile3 (unzFile file, int* method,
pfile_in_zip_read_info->stream_initialised=Z_DEFLATED; pfile_in_zip_read_info->stream_initialised=Z_DEFLATED;
else else
{ {
printf("NO OPEN ZLIB %i\n",err);
TRYFREE(pfile_in_zip_read_info); TRYFREE(pfile_in_zip_read_info);
return err; return err;
} }

View File

@ -1210,8 +1210,9 @@ extern int ZEXPORT zipOpenNewFileInZip4_64 (zipFile file, const char* filename,
{ {
if(zi->ci.method == Z_DEFLATED) if(zi->ci.method == Z_DEFLATED)
{ {
zi->ci.stream.zalloc = (alloc_func)0; zi->ci.stream.zalloc = zi->z_filefunc.zfile_func64.alloc_mem;
zi->ci.stream.zfree = (free_func)0; zi->ci.stream.zfree = zi->z_filefunc.zfile_func64.free_mem;
zi->ci.stream.opaque = (voidpf)0; zi->ci.stream.opaque = (voidpf)0;
if (windowBits>0) if (windowBits>0)

View File

@ -32,6 +32,7 @@
#include "io/zip.h" #include "io/zip.h"
#include "io/unzip.h" #include "io/unzip.h"
#include "os/file_access.h" #include "os/file_access.h"
//#include "copymem.h"
static void* zipio_open(void* data, const char* p_fname, int mode) { static void* zipio_open(void* data, const char* p_fname, int mode) {
@ -110,6 +111,21 @@ static int zipio_testerror(voidpf opaque, voidpf stream) {
}; };
static voidpf zipio_alloc(voidpf opaque, uInt items, uInt size) {
voidpf ptr =memalloc(items*size);
zeromem(ptr,items*size);
return ptr;
}
static void zipio_free(voidpf opaque, voidpf address) {
memfree(address);
}
static zlib_filefunc_def zipio_create_io_from_file(FileAccess **p_file) { static zlib_filefunc_def zipio_create_io_from_file(FileAccess **p_file) {
zlib_filefunc_def io; zlib_filefunc_def io;
@ -121,6 +137,8 @@ static zlib_filefunc_def zipio_create_io_from_file(FileAccess **p_file) {
io.zseek_file = zipio_seek; io.zseek_file = zipio_seek;
io.zclose_file = zipio_close; io.zclose_file = zipio_close;
io.zerror_file = zipio_testerror; io.zerror_file = zipio_testerror;
io.alloc_mem=zipio_alloc;
io.free_mem=zipio_free;
return io; return io;
} }

View File

@ -205,6 +205,23 @@ public:
//nothing //nothing
} }
template<class T>
static Object* _create_ptr_func() {
return T::create();
}
template<class T>
static void register_create_type() {
GLOBAL_LOCK_FUNCTION;
T::initialize_type();
TypeInfo *t=types.getptr(T::get_type_static());
ERR_FAIL_COND(!t);
t->creation_func=&_create_ptr_func<T>;
T::register_custom_data_to_otdb();
}
static void get_type_list( List<String> *p_types); static void get_type_list( List<String> *p_types);
static void get_inheriters_from( const String& p_type,List<String> *p_types); static void get_inheriters_from( const String& p_type,List<String> *p_types);
static String type_inherits_from(const String& p_type); static String type_inherits_from(const String& p_type);

View File

@ -55,7 +55,7 @@ public:
static Input *get_singleton(); static Input *get_singleton();
virtual bool is_key_pressed(int p_scancode)=0; virtual bool is_key_pressed(int p_scancode)=0;
virtual bool is_mouse_button_pressed(int p_button)=0; virtual bool is_mouse_button_pressed(int p_button)=0;
virtual bool is_joy_button_pressed(int p_device, int p_button)=0; virtual bool is_joy_button_pressed(int p_device, int p_button)=0;
virtual bool is_action_pressed(const StringName& p_action)=0; virtual bool is_action_pressed(const StringName& p_action)=0;

View File

@ -425,8 +425,25 @@ int OS::get_processor_count() const {
return 1; return 1;
} }
void OS::set_mouse_mode(MouseMode p_mode) { Error OS::native_video_play(String p_path) {
return FAILED;
};
bool OS::native_video_is_playing() {
return false;
};
void OS::native_video_pause() {
};
void OS::native_video_stop() {
};
void OS::set_mouse_mode(MouseMode p_mode) {
} }

View File

@ -315,6 +315,10 @@ public:
virtual String get_unique_ID() const; virtual String get_unique_ID() const;
virtual Error native_video_play(String p_path);
virtual bool native_video_is_playing();
virtual void native_video_pause();
virtual void native_video_stop();
virtual Error dialog_show(String p_title, String p_description, Vector<String> p_buttons, Object* p_obj, String p_callback); virtual Error dialog_show(String p_title, String p_description, Vector<String> p_buttons, Object* p_obj, String p_callback);
virtual Error dialog_input_text(String p_title, String p_description, String p_partial, Object* p_obj, String p_callback); virtual Error dialog_input_text(String p_title, String p_description, String p_partial, Object* p_obj, String p_callback);

View File

@ -106,10 +106,6 @@ void register_core_types() {
object_format_loader_xml = memnew( ObjectFormatLoaderInstancerXML ); object_format_loader_xml = memnew( ObjectFormatLoaderInstancerXML );
ObjectLoader::add_object_format_loader_instancer( object_format_loader_xml ); ObjectLoader::add_object_format_loader_instancer( object_format_loader_xml );
#endif #endif
resource_saver_xml = memnew( ResourceFormatSaverXML );
ResourceSaver::add_resource_format_saver(resource_saver_xml);
resource_loader_xml = memnew( ResourceFormatLoaderXML );
ResourceLoader::add_resource_format_loader(resource_loader_xml);
#endif #endif
#ifdef OLD_SCENE_FORMAT_ENABLED #ifdef OLD_SCENE_FORMAT_ENABLED
object_format_saver_binary = memnew( ObjectFormatSaverInstancerBinary ); object_format_saver_binary = memnew( ObjectFormatSaverInstancerBinary );
@ -128,6 +124,10 @@ void register_core_types() {
resource_loader_binary = memnew( ResourceFormatLoaderBinary ); resource_loader_binary = memnew( ResourceFormatLoaderBinary );
ResourceLoader::add_resource_format_loader(resource_loader_binary); ResourceLoader::add_resource_format_loader(resource_loader_binary);
resource_saver_xml = memnew( ResourceFormatSaverXML );
ResourceSaver::add_resource_format_saver(resource_saver_xml);
resource_loader_xml = memnew( ResourceFormatLoaderXML );
ResourceLoader::add_resource_format_loader(resource_loader_xml);
ObjectTypeDB::register_type<Object>(); ObjectTypeDB::register_type<Object>();
@ -136,8 +136,8 @@ void register_core_types() {
ObjectTypeDB::register_type<ResourceImportMetadata>(); ObjectTypeDB::register_type<ResourceImportMetadata>();
ObjectTypeDB::register_type<Resource>(); ObjectTypeDB::register_type<Resource>();
ObjectTypeDB::register_virtual_type<StreamPeer>(); ObjectTypeDB::register_virtual_type<StreamPeer>();
ObjectTypeDB::register_virtual_type<StreamPeerTCP>(); ObjectTypeDB::register_create_type<StreamPeerTCP>();
ObjectTypeDB::register_virtual_type<TCP_Server>(); ObjectTypeDB::register_create_type<TCP_Server>();
ObjectTypeDB::register_virtual_type<IP>(); ObjectTypeDB::register_virtual_type<IP>();
ObjectTypeDB::register_virtual_type<PacketPeer>(); ObjectTypeDB::register_virtual_type<PacketPeer>();
ObjectTypeDB::register_type<PacketPeerStream>(); ObjectTypeDB::register_type<PacketPeerStream>();

View File

@ -148,7 +148,7 @@ static inline int atomic_decrement( volatile int *pw) {
/* PowerPC32/64 GCC */ /* PowerPC32/64 GCC */
#elif defined( __GNUC__ ) && ( defined( __powerpc__ ) || defined( __ppc__ ) ) #elif ( defined( __GNUC__ ) ) && ( defined( __powerpc__ ) || defined( __ppc__ ) )
#define REFCOUNT_T int #define REFCOUNT_T int
#define REFCOUNT_GET_T int const volatile& #define REFCOUNT_GET_T int const volatile&
@ -257,14 +257,14 @@ inline int atomic_decrement(volatile int* v)
/* CW PPC */ /* CW PPC */
#elif defined( __MWERKS__ ) && defined( __POWERPC__ ) #elif ( defined( __MWERKS__ ) ) && defined( __POWERPC__ )
inline long atomic_conditional_increment( register long * pw ) inline long atomic_conditional_increment( register long * pw )
{ {
register int a; register int a;
asm asm
{ {
loop: loop:
lwarx a, 0, pw lwarx a, 0, pw

View File

@ -415,7 +415,7 @@ void ScriptDebuggerRemote::set_request_scene_tree_message_func(RequestSceneTreeM
ScriptDebuggerRemote::ScriptDebuggerRemote() { ScriptDebuggerRemote::ScriptDebuggerRemote() {
tcp_client = StreamPeerTCP::create(); tcp_client = StreamPeerTCP::create_ref();
packet_peer_stream = Ref<PacketPeerStream>( memnew(PacketPeerStream) ); packet_peer_stream = Ref<PacketPeerStream>( memnew(PacketPeerStream) );
packet_peer_stream->set_stream_peer(tcp_client); packet_peer_stream->set_stream_peer(tcp_client);
mutex = Mutex::create(); mutex = Mutex::create();

View File

@ -7151,7 +7151,8 @@ void RasterizerGLES2::_update_framebuffer() {
glDeleteTextures(1,&framebuffer.sample_color); glDeleteTextures(1,&framebuffer.sample_color);
glDeleteFramebuffers(1,&framebuffer.sample_fbo); glDeleteFramebuffers(1,&framebuffer.sample_fbo);
framebuffer.luminance.clear();
framebuffer.blur_size=0;
framebuffer.fbo=0; framebuffer.fbo=0;
} }

View File

@ -7,7 +7,7 @@
static _FORCE_INLINE_ uint16_t le_short(uint16_t s) static _FORCE_INLINE_ uint16_t le_short(uint16_t s)
{ {
uint16_t ret=s; uint16_t ret=s;
#ifdef BIG_ENDIAN_ENABLED #if 0 //def BIG_ENDIAN_ENABLED
ret = s>>8; ret = s>>8;
ret += s<<8; ret += s<<8;
#endif #endif

View File

@ -47,7 +47,7 @@
/** Convert little endian */ /** Convert little endian */
static SPEEX_INLINE spx_int32_t le_int(spx_int32_t i) static SPEEX_INLINE spx_int32_t le_int(spx_int32_t i)
{ {
#if !defined(__LITTLE_ENDIAN__) && ( defined(WORDS_BIGENDIAN) || defined(__BIG_ENDIAN__) || defined(BIG_ENDIAN_ENABLED) ) #if !defined(__LITTLE_ENDIAN__) && ( defined(WORDS_BIGENDIAN) || defined(__BIG_ENDIAN__) /* || defined(BIG_ENDIAN_ENABLED) */ )
spx_uint32_t ui, ret; spx_uint32_t ui, ret;
ui = i; ui = i;
ret = ui>>24; ret = ui>>24;

View File

@ -56,7 +56,8 @@ Thread* ThreadPosix::create_func_posix(ThreadCreateCallback p_callback,void *p_u
tr->callback=p_callback; tr->callback=p_callback;
tr->user=p_user; tr->user=p_user;
pthread_attr_init(&tr->pthread_attr); pthread_attr_init(&tr->pthread_attr);
pthread_attr_setdetachstate(&tr->pthread_attr, PTHREAD_CREATE_JOINABLE); pthread_attr_setdetachstate(&tr->pthread_attr, PTHREAD_CREATE_JOINABLE);
pthread_attr_setstacksize(&tr->pthread_attr, 256 * 1024);
pthread_create(&tr->pthread, &tr->pthread_attr, thread_callback, tr); pthread_create(&tr->pthread, &tr->pthread_attr, thread_callback, tr);

View File

@ -59,5 +59,6 @@ public class GodotLib {
public static native void method(String p_sname,String p_name,String p_ret,String[] p_params); public static native void method(String p_sname,String p_name,String p_ret,String[] p_params);
public static native String getGlobal(String p_key); public static native String getGlobal(String p_key);
public static native void callobject(int p_ID, String p_method, Object[] p_params); public static native void callobject(int p_ID, String p_method, Object[] p_params);
public static native void calldeferred(int p_ID, String p_method, Object[] p_params);
} }

View File

@ -1146,6 +1146,26 @@ JNIEXPORT void JNICALL Java_com_android_godot_GodotLib_callobject(JNIEnv * env,
// something // something
}; };
JNIEXPORT void JNICALL Java_com_android_godot_GodotLib_calldeferred(JNIEnv * env, jobject p_obj, jint ID, jstring method, jobjectArray params) {
String str_method = env->GetStringUTFChars( method, NULL );
Object* obj = ObjectDB::get_instance(ID);
ERR_FAIL_COND(!obj);
int count = env->GetArrayLength(params);
Variant args[VARIANT_ARG_MAX];
for (int i=0; i<MIN(count,VARIANT_ARG_MAX); i++) {
jobject obj = env->GetObjectArrayElement(params, i);
args[i] = _jobject_to_variant(env, obj);
};
obj->call_deferred(str_method, args[0],args[1],args[2],args[3],args[4]);
// something
};
//Main::cleanup(); //Main::cleanup();

View File

@ -51,6 +51,7 @@ extern "C" {
JNIEXPORT void JNICALL Java_com_android_godot_GodotLib_method(JNIEnv * env, jobject obj, jstring sname, jstring name, jstring ret, jobjectArray args); JNIEXPORT void JNICALL Java_com_android_godot_GodotLib_method(JNIEnv * env, jobject obj, jstring sname, jstring name, jstring ret, jobjectArray args);
JNIEXPORT jstring JNICALL Java_com_android_godot_GodotLib_getGlobal(JNIEnv * env, jobject obj, jstring path); JNIEXPORT jstring JNICALL Java_com_android_godot_GodotLib_getGlobal(JNIEnv * env, jobject obj, jstring path);
JNIEXPORT void JNICALL Java_com_android_godot_GodotLib_callobject(JNIEnv * env, jobject obj, jint ID, jstring method, jobjectArray params); JNIEXPORT void JNICALL Java_com_android_godot_GodotLib_callobject(JNIEnv * env, jobject obj, jint ID, jstring method, jobjectArray params);
JNIEXPORT void JNICALL Java_com_android_godot_GodotLib_calldeferred(JNIEnv * env, jobject obj, jint ID, jstring method, jobjectArray params);
}; };

View File

@ -165,7 +165,7 @@ static int frame_count = 0;
printf("**************** app delegate init\n"); printf("**************** app delegate init\n");
CGRect rect = [[UIScreen mainScreen] bounds]; CGRect rect = [[UIScreen mainScreen] bounds];
application.statusBarHidden = YES; [application setStatusBarHidden:YES animation:NO];
// disable idle timer // disable idle timer
application.idleTimerDisabled = YES; application.idleTimerDisabled = YES;

View File

@ -60,8 +60,6 @@ class EditorExportPlatformJavaScript : public EditorExportPlatform {
Ref<ImageTexture> logo; Ref<ImageTexture> logo;
static Error save_pack_file_js(void *p_userdata,const String& p_path, const Vector<uint8_t>& p_data,int p_file,int p_total);
protected: protected:
bool _set(const StringName& p_name, const Variant& p_value); bool _set(const StringName& p_name, const Variant& p_value);
@ -103,8 +101,6 @@ bool EditorExportPlatformJavaScript::_set(const StringName& p_name, const Varian
show_run=p_value; show_run=p_value;
else if (n=="options/memory_size") else if (n=="options/memory_size")
max_memory=p_value; max_memory=p_value;
else if (n=="options/pack_mode")
pack_mode=PackMode(int(p_value));
else else
return false; return false;
@ -123,8 +119,6 @@ bool EditorExportPlatformJavaScript::_get(const StringName& p_name,Variant &r_re
r_ret=show_run; r_ret=show_run;
else if (n=="options/memory_size") else if (n=="options/memory_size")
r_ret=max_memory; r_ret=max_memory;
else if (n=="options/pack_mode")
r_ret=pack_mode;
else else
return false; return false;
@ -134,7 +128,6 @@ void EditorExportPlatformJavaScript::_get_property_list( List<PropertyInfo> *p_l
p_list->push_back( PropertyInfo( Variant::STRING, "custom_package/debug", PROPERTY_HINT_FILE,"zip")); p_list->push_back( PropertyInfo( Variant::STRING, "custom_package/debug", PROPERTY_HINT_FILE,"zip"));
p_list->push_back( PropertyInfo( Variant::STRING, "custom_package/release", PROPERTY_HINT_FILE,"zip")); p_list->push_back( PropertyInfo( Variant::STRING, "custom_package/release", PROPERTY_HINT_FILE,"zip"));
p_list->push_back( PropertyInfo( Variant::INT, "options/pack_mode",PROPERTY_HINT_ENUM,"Single File, Multiple Files"));
p_list->push_back( PropertyInfo( Variant::INT, "options/memory_size",PROPERTY_HINT_ENUM,"32mb,64mb,128mb,256mb,512mb,1024mb")); p_list->push_back( PropertyInfo( Variant::INT, "options/memory_size",PROPERTY_HINT_ENUM,"32mb,64mb,128mb,256mb,512mb,1024mb"));
p_list->push_back( PropertyInfo( Variant::BOOL, "browser/enable_run")); p_list->push_back( PropertyInfo( Variant::BOOL, "browser/enable_run"));
@ -143,32 +136,6 @@ void EditorExportPlatformJavaScript::_get_property_list( List<PropertyInfo> *p_l
} }
static const char* files_pre=""\
"var Module;\n"\
"if (typeof Module === 'undefined') Module = eval('(function() { try { return Module || {} } catch(e) { return {} } })()');\n"\
"if (!Module.expectedDataFileDownloads) {\n"\
" Module.expectedDataFileDownloads = 0;\n"\
" Module.finishedDataFileDownloads = 0;\n"\
"}\n"\
"Module.expectedDataFileDownloads++;\n"\
"(function() {\n"\
"\n"\
" function runWithFS() {\n"\
"function assert(check, msg) {\n"\
" if (!check) throw msg + new Error().stack;\n"\
"} \n";
static const char* files_post=""\
"}\n"\
"if (Module['calledRun']) {\n"\
" runWithFS();\n"\
"} else {\n"\
" if (!Module['preRun']) Module['preRun'] = [];\n"\
" Module[\"preRun\"].push(runWithFS); // FS is not initialized yet, wait for it\n"\
"}\n"\
"})();";
static void _fix_html(Vector<uint8_t>& html,const String& name,int max_memory) { static void _fix_html(Vector<uint8_t>& html,const String& name,int max_memory) {
@ -178,7 +145,7 @@ static void _fix_html(Vector<uint8_t>& html,const String& name,int max_memory) {
Vector<String> lines=str.split("\n"); Vector<String> lines=str.split("\n");
for(int i=0;i<lines.size();i++) { for(int i=0;i<lines.size();i++) {
if (lines[i].find("godot.js")!=-1) { if (lines[i].find("godot.js")!=-1) {
strnew+="<script type=\"text/javascript\" src=\""+name+"_files.js\"></script>\n"; strnew+="<script type=\"text/javascript\" src=\""+name+"_filesystem.js\"></script>\n";
strnew+="<script async type=\"text/javascript\" src=\""+name+".js\"></script>\n"; strnew+="<script async type=\"text/javascript\" src=\""+name+".js\"></script>\n";
} else if (lines[i].find("var Module")!=-1) { } else if (lines[i].find("var Module")!=-1) {
strnew+=lines[i]; strnew+=lines[i];
@ -195,6 +162,27 @@ static void _fix_html(Vector<uint8_t>& html,const String& name,int max_memory) {
} }
} }
static void _fix_files(Vector<uint8_t>& html,uint64_t p_data_size) {
String str;
String strnew;
str.parse_utf8((const char*)html.ptr(),html.size());
Vector<String> lines=str.split("\n");
for(int i=0;i<lines.size();i++) {
if (lines[i].find("$DPLEN")!=-1) {
strnew+=lines[i].replace("$DPLEN",itos(p_data_size));
} else {
strnew+=lines[i]+"\n";
}
}
CharString cs = strnew.utf8();
html.resize(cs.size());
for(int i=9;i<cs.size();i++) {
html[i]=cs[i];
}
}
struct JSExportData { struct JSExportData {
@ -204,56 +192,6 @@ struct JSExportData {
}; };
static void store_file_buffer(FileAccess*f,const String& p_path,const Vector<uint8_t>& p_data) {
String pre = "Module['FS_createDataFile']('/', '"+p_path.replace("res://","")+"',[";
CharString cs = pre.utf8();
f->store_buffer((const uint8_t*)cs.ptr(),cs.length());
for(int i=0;i<p_data.size();i++) {
uint8_t c=',';
if (i>0)
f->store_buffer(&c,1);
uint8_t str[4];
uint8_t d = p_data[i];
if (d<10) {
str[0]='0'+d;
str[1]=0;
f->store_buffer(str,1);
} else if (d<100) {
str[0]='0'+d/10;
str[1]='0'+d%10;
str[2]=0;
f->store_buffer(str,2);
} else {
str[0]='0'+d/100;
str[1]='0'+(d/10)%10;
str[2]='0'+d%10;
str[3]=0;
f->store_buffer(str,3);
}
}
String post = "],true,true);\n";
cs = post.utf8();
f->store_buffer((const uint8_t*)cs.ptr(),cs.length());
}
Error EditorExportPlatformJavaScript::save_pack_file_js(void *p_userdata,const String& p_path, const Vector<uint8_t>& p_data,int p_file,int p_total) {
JSExportData *ed=(JSExportData*)p_userdata;
FileAccess *f=(FileAccess *)p_userdata;
store_file_buffer(ed->f,p_path,p_data);
ed->ep->step("File: "+p_path,3+p_file*100/p_total);
return OK;
}
Error EditorExportPlatformJavaScript::export_project(const String& p_path,bool p_debug,const String& p_password) { Error EditorExportPlatformJavaScript::export_project(const String& p_path,bool p_debug,const String& p_password) {
@ -279,6 +217,20 @@ Error EditorExportPlatformJavaScript::export_project(const String& p_path,bool p
ep.step("Exporting to HTML5",0); ep.step("Exporting to HTML5",0);
ep.step("Finding Files..",1);
FileAccess *f=FileAccess::open(p_path.get_base_dir()+"/data.pck",FileAccess::WRITE);
if (!f) {
EditorNode::add_io_error("Could not create file for writing:\n"+p_path.basename()+"_files.js");
return ERR_FILE_CANT_WRITE;
}
Error err = save_pack(f);
size_t len = f->get_len();
memdelete(f);
if (err)
return err;
unzFile pkg = unzOpen2(src_template.utf8().get_data(), &io); unzFile pkg = unzOpen2(src_template.utf8().get_data(), &io);
if (!pkg) { if (!pkg) {
@ -314,6 +266,11 @@ Error EditorExportPlatformJavaScript::export_project(const String& p_path,bool p
_fix_html(data,p_path.get_file().basename(),1<<(max_memory+5)); _fix_html(data,p_path.get_file().basename(),1<<(max_memory+5));
file=p_path.get_file(); file=p_path.get_file();
} }
if (file=="filesystem.js") {
_fix_files(data,len);
file=p_path.get_file().basename()+"_filesystem.js";
}
if (file=="godot.js") { if (file=="godot.js") {
//_fix_godot(data); //_fix_godot(data);
@ -335,49 +292,6 @@ Error EditorExportPlatformJavaScript::export_project(const String& p_path,bool p
} }
ep.step("Finding Files..",1);
Vector<String> remaps;
FileAccess *f=FileAccess::open(p_path.basename()+"_files.js",FileAccess::WRITE);
if (!f) {
EditorNode::add_io_error("Could not create file for writing:\n"+p_path.basename()+"_files.js");
return ERR_FILE_CANT_WRITE;
}
f->store_buffer((const uint8_t*)files_pre,strlen(files_pre));
if (pack_mode==PACK_SINGLE_FILE) {
String ftmp = EditorSettings::get_singleton()->get_settings_path()+"/tmp/webpack.pck";
FileAccess *f2 = FileAccess::open(ftmp,FileAccess::WRITE);
if (!f2) {
memdelete(f);
return ERR_CANT_CREATE;
}
Error err = save_pack(f2,false);
memdelete(f2);
if (err) {
memdelete(f);
return ERR_CANT_CREATE;
}
Vector<uint8_t> data = FileAccess::get_file_as_array(ftmp);
store_file_buffer(f,"data.pck",data);
} else {
JSExportData ed;
ed.ep=&ep;
ed.f=f;
Error err =export_project_files(save_pack_file_js,&ed,false);
if (err)
return err;
}
f->store_buffer((const uint8_t*)files_post,strlen(files_post));
memdelete(f);
return OK; return OK;

View File

@ -511,7 +511,7 @@ void OS_JavaScript::process_accelerometer(const Vector3& p_accelerometer) {
bool OS_JavaScript::has_touchscreen_ui_hint() const { bool OS_JavaScript::has_touchscreen_ui_hint() const {
return true; return false; //???
} }
void OS_JavaScript::main_loop_request_quit() { void OS_JavaScript::main_loop_request_quit() {

View File

@ -1277,6 +1277,7 @@ OS_OSX* OS_OSX::singleton=NULL;
OS_OSX::OS_OSX() { OS_OSX::OS_OSX() {
main_loop=NULL;
singleton=this; singleton=this;
autoreleasePool = [[NSAutoreleasePool alloc] init]; autoreleasePool = [[NSAutoreleasePool alloc] init];

View File

@ -1534,7 +1534,9 @@ void OS_Windows::set_icon(const Image& p_icon) {
/* Create temporary bitmap buffer */ /* Create temporary bitmap buffer */
int icon_len = 40 + h * w * 4; int icon_len = 40 + h * w * 4;
BYTE *icon_bmp = (BYTE*)alloca(icon_len); Vector<BYTE> v;
v.resize(icon_len);
BYTE *icon_bmp = &v[0];
encode_uint32(40,&icon_bmp[0]); encode_uint32(40,&icon_bmp[0]);
encode_uint32(w,&icon_bmp[4]); encode_uint32(w,&icon_bmp[4]);
@ -1582,7 +1584,11 @@ bool OS_Windows::has_environment(const String& p_var) const {
String OS_Windows::get_environment(const String& p_var) const { String OS_Windows::get_environment(const String& p_var) const {
return getenv(p_var.utf8().get_data()); char* val = getenv(p_var.utf8().get_data());
if (val)
return val;
return "";
}; };
String OS_Windows::get_stdin_string(bool p_block) { String OS_Windows::get_stdin_string(bool p_block) {

View File

@ -1232,7 +1232,7 @@ void OS_X11::set_icon(const Image& p_icon) {
DVector<uint8_t>::Read r = img.get_data().read(); DVector<uint8_t>::Read r = img.get_data().read();
uint32_t *wr=(uint32_t*)&pd[2]; long *wr=(long*)&pd[2];
for(int i=0;i<w*h;i++) { for(int i=0;i<w*h;i++) {

View File

@ -880,6 +880,26 @@ float Particles2D::get_explosiveness() const{
return explosiveness; return explosiveness;
} }
void Particles2D::set_flip_h(bool p_flip) {
flip_h=p_flip;
}
bool Particles2D::is_flipped_h() const{
return flip_h;
}
void Particles2D::set_flip_v(bool p_flip){
flip_v=p_flip;
}
bool Particles2D::is_flipped_v() const{
return flip_v;
}
void Particles2D::set_emission_points(const DVector<Vector2>& p_points) { void Particles2D::set_emission_points(const DVector<Vector2>& p_points) {
emission_points=p_points; emission_points=p_points;
@ -922,6 +942,12 @@ void Particles2D::_bind_methods() {
ObjectTypeDB::bind_method(_MD("set_emissor_offset","offset"),&Particles2D::set_emissor_offset); ObjectTypeDB::bind_method(_MD("set_emissor_offset","offset"),&Particles2D::set_emissor_offset);
ObjectTypeDB::bind_method(_MD("get_emissor_offset"),&Particles2D::get_emissor_offset); ObjectTypeDB::bind_method(_MD("get_emissor_offset"),&Particles2D::get_emissor_offset);
ObjectTypeDB::bind_method(_MD("set_flip_h","enable"),&Particles2D::set_flip_h);
ObjectTypeDB::bind_method(_MD("is_flipped_h"),&Particles2D::is_flipped_h);
ObjectTypeDB::bind_method(_MD("set_flip_v","enable"),&Particles2D::set_flip_v);
ObjectTypeDB::bind_method(_MD("is_flipped_v"),&Particles2D::is_flipped_v);
ObjectTypeDB::bind_method(_MD("set_emission_half_extents","extents"),&Particles2D::set_emission_half_extents); ObjectTypeDB::bind_method(_MD("set_emission_half_extents","extents"),&Particles2D::set_emission_half_extents);
ObjectTypeDB::bind_method(_MD("get_emission_half_extents"),&Particles2D::get_emission_half_extents); ObjectTypeDB::bind_method(_MD("get_emission_half_extents"),&Particles2D::get_emission_half_extents);
@ -958,6 +984,8 @@ void Particles2D::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::VECTOR2,"config/half_extents"),_SCS("set_emission_half_extents"),_SCS("get_emission_half_extents")); ADD_PROPERTY(PropertyInfo(Variant::VECTOR2,"config/half_extents"),_SCS("set_emission_half_extents"),_SCS("get_emission_half_extents"));
ADD_PROPERTY(PropertyInfo(Variant::BOOL,"config/local_space"),_SCS("set_use_local_space"),_SCS("is_using_local_space")); ADD_PROPERTY(PropertyInfo(Variant::BOOL,"config/local_space"),_SCS("set_use_local_space"),_SCS("is_using_local_space"));
ADD_PROPERTY(PropertyInfo(Variant::REAL,"config/explosiveness",PROPERTY_HINT_RANGE,"0,1,0.01"),_SCS("set_explosiveness"),_SCS("get_explosiveness")); ADD_PROPERTY(PropertyInfo(Variant::REAL,"config/explosiveness",PROPERTY_HINT_RANGE,"0,1,0.01"),_SCS("set_explosiveness"),_SCS("get_explosiveness"));
ADD_PROPERTY(PropertyInfo(Variant::BOOL,"config/flip_h"),_SCS("set_flip_h"),_SCS("is_flipped_h"));
ADD_PROPERTY(PropertyInfo(Variant::BOOL,"config/flip_v"),_SCS("set_flip_v"),_SCS("is_flipped_v"));
ADD_PROPERTY(PropertyInfo(Variant::OBJECT,"config/texture",PROPERTY_HINT_RESOURCE_TYPE,"Texture"),_SCS("set_texture"),_SCS("get_texture")); ADD_PROPERTY(PropertyInfo(Variant::OBJECT,"config/texture",PROPERTY_HINT_RESOURCE_TYPE,"Texture"),_SCS("set_texture"),_SCS("get_texture"));
@ -1039,6 +1067,10 @@ Particles2D::Particles2D() {
set_color_phase_color(2,Color(0,0,0)); set_color_phase_color(2,Color(0,0,0));
set_color_phase_color(3,Color(0,0,0)); set_color_phase_color(3,Color(0,0,0));
flip_h=false;
flip_v=false;
emit_timeout = 0; emit_timeout = 0;
time_to_live = 0; time_to_live = 0;
explosiveness=1.0; explosiveness=1.0;

View File

@ -143,6 +143,8 @@ private:
float emit_timeout; float emit_timeout;
float time_to_live; float time_to_live;
float time_scale; float time_scale;
bool flip_h;
bool flip_v;
Point2 emissor_offset; Point2 emissor_offset;
Vector2 initial_velocity; Vector2 initial_velocity;
Vector2 extents; Vector2 extents;
@ -197,6 +199,12 @@ public:
void set_explosiveness(float p_value); void set_explosiveness(float p_value);
float get_explosiveness() const; float get_explosiveness() const;
void set_flip_h(bool p_flip);
bool is_flipped_h() const;
void set_flip_v(bool p_flip);
bool is_flipped_v() const;
void set_color_phases(int p_phases); void set_color_phases(int p_phases);
int get_color_phases() const; int get_color_phases() const;

View File

@ -155,7 +155,7 @@ void TouchScreenButton::_input(const InputEvent& p_event) {
if (finger_pressed==-1 || p_event.screen_touch.index==finger_pressed) { if (finger_pressed==-1 || p_event.screen_touch.index==finger_pressed) {
Point2 coord = (get_viewport_transform() * get_global_transform()).affine_inverse().xform(Point2(p_event.screen_touch.x,p_event.screen_touch.y)); Point2 coord = (get_global_transform()).affine_inverse().xform(Point2(p_event.screen_touch.x,p_event.screen_touch.y));
bool touched=false; bool touched=false;
if (bitmask.is_valid()) { if (bitmask.is_valid()) {
@ -231,7 +231,7 @@ void TouchScreenButton::_input(const InputEvent& p_event) {
if (finger_pressed!=-1) if (finger_pressed!=-1)
return; //already fingering return; //already fingering
Point2 coord = (get_viewport_transform() * get_global_transform()).affine_inverse().xform(Point2(p_event.screen_touch.x,p_event.screen_touch.y)); Point2 coord = (get_global_transform()).affine_inverse().xform(Point2(p_event.screen_touch.x,p_event.screen_touch.y));
bool touched=false; bool touched=false;
if (bitmask.is_valid()) { if (bitmask.is_valid()) {

View File

@ -240,6 +240,9 @@ void AnimationPlayer::_generate_node_caches(AnimationData* p_anim) {
p_anim->node_cache[i]=NULL; p_anim->node_cache[i]=NULL;
RES resource; RES resource;
Node *child = parent->get_node_and_resource(a->track_get_path(i),resource); Node *child = parent->get_node_and_resource(a->track_get_path(i),resource);
if (!child) {
ERR_EXPLAIN("On Animation: '"+p_anim->name+"', couldn't resolve track: '"+String(a->track_get_path(i))+"'");
}
ERR_CONTINUE(!child); // couldn't find the child node ERR_CONTINUE(!child); // couldn't find the child node
uint32_t id=resource.is_valid()?resource->get_instance_ID():child->get_instance_ID(); uint32_t id=resource.is_valid()?resource->get_instance_ID():child->get_instance_ID();
int bone_idx=-1; int bone_idx=-1;

View File

@ -519,6 +519,8 @@ void FileDialog::_make_dir_confirm() {
void FileDialog::_make_dir() { void FileDialog::_make_dir() {
makedialog->popup_centered_minsize(Size2(250,80)); makedialog->popup_centered_minsize(Size2(250,80));
makedirname->grab_focus();
} }
void FileDialog::_select_drive(int p_idx) { void FileDialog::_select_drive(int p_idx) {

View File

@ -573,11 +573,11 @@ void AtlasTexture::draw_rect_region(RID p_canvas_item,const Rect2& p_rect, const
return; return;
Rect2 src=p_src_rect; Rect2 src=p_src_rect;
src.pos+=rc.pos-margin.pos; src.pos+=(rc.pos-margin.pos);
Rect2 src_c = rc.clip(src); Rect2 src_c = rc.clip(src);
if (src_c.size==Size2()) if (src_c.size==Size2())
return; return;
Vector2 ofs = src_c.pos-rc.pos + margin.pos; Vector2 ofs = (src_c.pos-src.pos);
Vector2 scale = p_rect.size / p_src_rect.size; Vector2 scale = p_rect.size / p_src_rect.size;
@ -952,7 +952,7 @@ void CubeMap::_bind_methods() {
BIND_CONSTANT( SIDE_BACK ); BIND_CONSTANT( SIDE_BACK );
BIND_CONSTANT( FLAG_MIPMAPS ); BIND_CONSTANT( FLAG_MIPMAPS );
BIND_CONSTANT( FLAG_REPEAT ); BIND_CONSTANT( FLAG_REPEAT );
BIND_CONSTANT( FLAG_FILTER ); BIND_CONSTANT( FLAG_FILTER );
BIND_CONSTANT( FLAGS_DEFAULT ); BIND_CONSTANT( FLAGS_DEFAULT );

View File

@ -83,7 +83,7 @@ void FindReplaceDialog::popup_search() {
replace_label->hide(); replace_label->hide();
replace_vb->hide(); replace_vb->hide();
skip->hide(); skip->hide();
popup_centered(Point2(300,160)); popup_centered(Point2(300,190));
get_ok()->set_text("Find"); get_ok()->set_text("Find");
search_text->grab_focus(); search_text->grab_focus();
if (text_edit->is_selection_active() && ( text_edit->get_selection_from_line() == text_edit->get_selection_to_line())) { if (text_edit->is_selection_active() && ( text_edit->get_selection_from_line() == text_edit->get_selection_to_line())) {
@ -105,7 +105,7 @@ void FindReplaceDialog::popup_replace() {
replace_mc->show(); replace_mc->show();
replace_label->show(); replace_label->show();
replace_vb->show(); replace_vb->show();
popup_centered(Point2(300,250)); popup_centered(Point2(300,300));
search_text->grab_focus(); search_text->grab_focus();
search_text->select_all(); search_text->select_all();
error_label->set_text(""); error_label->set_text("");

View File

@ -692,6 +692,11 @@ static const unsigned char icon_h_separator_png[]={
}; };
static const unsigned char icon_mirror_y_png[]={
0x89,0x50,0x4e,0x47,0xd,0xa,0x1a,0xa,0x0,0x0,0x0,0xd,0x49,0x48,0x44,0x52,0x0,0x0,0x0,0x10,0x0,0x0,0x0,0x10,0x8,0x6,0x0,0x0,0x0,0x1f,0xf3,0xff,0x61,0x0,0x0,0x0,0x6,0x62,0x4b,0x47,0x44,0x0,0xff,0x0,0xff,0x0,0xff,0xa0,0xbd,0xa7,0x93,0x0,0x0,0x0,0x9,0x70,0x48,0x59,0x73,0x0,0x0,0xb,0x13,0x0,0x0,0xb,0x13,0x1,0x0,0x9a,0x9c,0x18,0x0,0x0,0x0,0x7,0x74,0x49,0x4d,0x45,0x7,0xde,0x2,0xd,0x11,0x2f,0xe,0x84,0xa,0x80,0x6f,0x0,0x0,0x0,0x81,0x49,0x44,0x41,0x54,0x38,0xcb,0x63,0x60,0xa0,0x25,0x78,0x78,0xfb,0xf9,0x85,0x87,0xb7,0x9f,0x5f,0xc0,0xa7,0x86,0x11,0x8f,0xe6,0x8b,0xc,0xc,0xc,0xba,0x50,0xee,0x65,0x79,0x55,0x49,0x7d,0x6c,0xea,0x98,0x70,0xd9,0xc,0xd5,0xcc,0x8,0xc5,0xba,0xb8,0x5c,0xc2,0x84,0xc3,0x1,0xdb,0x19,0x18,0x18,0xaa,0x90,0xf8,0x55,0x50,0x31,0x92,0xc3,0xe0,0xff,0xc3,0xdb,0xcf,0xff,0xe3,0x53,0xc3,0x44,0x69,0x40,0x8f,0x1a,0xc0,0xc0,0xc0,0x82,0x23,0xf4,0xdb,0x19,0x18,0x18,0x3e,0x22,0xf1,0x2b,0x18,0x18,0x18,0xf8,0xe5,0x55,0x25,0x2b,0x89,0x4a,0x89,0xd0,0x44,0xa3,0x87,0x24,0xff,0x9f,0x81,0x81,0xe1,0x92,0xbc,0xaa,0xa4,0x1,0xd5,0x93,0x32,0xc5,0x99,0x89,0x62,0x0,0x0,0x9f,0x96,0x36,0xe5,0xef,0x9c,0x9,0x7d,0x0,0x0,0x0,0x0,0x49,0x45,0x4e,0x44,0xae,0x42,0x60,0x82
};
static const unsigned char icon_key_xform_png[]={ static const unsigned char icon_key_xform_png[]={
0x89,0x50,0x4e,0x47,0xd,0xa,0x1a,0xa,0x0,0x0,0x0,0xd,0x49,0x48,0x44,0x52,0x0,0x0,0x0,0x8,0x0,0x0,0x0,0x8,0x8,0x6,0x0,0x0,0x0,0xc4,0xf,0xbe,0x8b,0x0,0x0,0x0,0x6,0x62,0x4b,0x47,0x44,0x0,0xff,0x0,0xff,0x0,0xff,0xa0,0xbd,0xa7,0x93,0x0,0x0,0x0,0x9,0x70,0x48,0x59,0x73,0x0,0x0,0xb,0x13,0x0,0x0,0xb,0x13,0x1,0x0,0x9a,0x9c,0x18,0x0,0x0,0x0,0x7,0x74,0x49,0x4d,0x45,0x7,0xdd,0x9,0x1c,0x14,0x1a,0x34,0xff,0x1d,0x2a,0xc5,0x0,0x0,0x0,0x96,0x49,0x44,0x41,0x54,0x18,0xd3,0x63,0x64,0x60,0x60,0x60,0x90,0xe4,0x64,0x67,0x38,0xba,0x64,0xae,0xcc,0x8f,0xd7,0x2f,0xc3,0x19,0x18,0x18,0x18,0x38,0x44,0xc5,0x57,0xfa,0x25,0x67,0x3c,0xb9,0xf2,0xe1,0xb,0x3,0xa3,0x24,0x27,0x3b,0xc3,0xbe,0x89,0x1d,0x79,0x2f,0x76,0xac,0x9d,0xc8,0x80,0x4,0x24,0x3c,0x82,0xf3,0x13,0xaa,0x1a,0x26,0x31,0xde,0x5b,0xbb,0x44,0xe6,0xe1,0xd2,0x19,0x8f,0x19,0xb0,0x0,0xf9,0xe8,0xc,0x59,0x26,0x98,0xb1,0xd8,0xc0,0x8f,0xd7,0x2f,0xc3,0x99,0x18,0x8,0x0,0x26,0xe,0x51,0xf1,0x95,0xb8,0x24,0x39,0x44,0xc5,0x57,0x32,0x79,0x25,0xa6,0x3d,0x91,0xf0,0x8,0xce,0x47,0x97,0x94,0xf0,0x8,0xce,0xf,0x4b,0xcf,0x7a,0xc2,0xc8,0xc0,0xc0,0xc0,0xa0,0x2f,0xc8,0xcb,0xb0,0x7e,0xce,0x74,0x14,0x6f,0x86,0xa6,0x65,0x3e,0x79,0xfd,0xe3,0x37,0x3,0x0,0x1f,0xf5,0x33,0x27,0xce,0x5,0x6d,0x6f,0x0,0x0,0x0,0x0,0x49,0x45,0x4e,0x44,0xae,0x42,0x60,0x82 0x89,0x50,0x4e,0x47,0xd,0xa,0x1a,0xa,0x0,0x0,0x0,0xd,0x49,0x48,0x44,0x52,0x0,0x0,0x0,0x8,0x0,0x0,0x0,0x8,0x8,0x6,0x0,0x0,0x0,0xc4,0xf,0xbe,0x8b,0x0,0x0,0x0,0x6,0x62,0x4b,0x47,0x44,0x0,0xff,0x0,0xff,0x0,0xff,0xa0,0xbd,0xa7,0x93,0x0,0x0,0x0,0x9,0x70,0x48,0x59,0x73,0x0,0x0,0xb,0x13,0x0,0x0,0xb,0x13,0x1,0x0,0x9a,0x9c,0x18,0x0,0x0,0x0,0x7,0x74,0x49,0x4d,0x45,0x7,0xdd,0x9,0x1c,0x14,0x1a,0x34,0xff,0x1d,0x2a,0xc5,0x0,0x0,0x0,0x96,0x49,0x44,0x41,0x54,0x18,0xd3,0x63,0x64,0x60,0x60,0x60,0x90,0xe4,0x64,0x67,0x38,0xba,0x64,0xae,0xcc,0x8f,0xd7,0x2f,0xc3,0x19,0x18,0x18,0x18,0x38,0x44,0xc5,0x57,0xfa,0x25,0x67,0x3c,0xb9,0xf2,0xe1,0xb,0x3,0xa3,0x24,0x27,0x3b,0xc3,0xbe,0x89,0x1d,0x79,0x2f,0x76,0xac,0x9d,0xc8,0x80,0x4,0x24,0x3c,0x82,0xf3,0x13,0xaa,0x1a,0x26,0x31,0xde,0x5b,0xbb,0x44,0xe6,0xe1,0xd2,0x19,0x8f,0x19,0xb0,0x0,0xf9,0xe8,0xc,0x59,0x26,0x98,0xb1,0xd8,0xc0,0x8f,0xd7,0x2f,0xc3,0x99,0x18,0x8,0x0,0x26,0xe,0x51,0xf1,0x95,0xb8,0x24,0x39,0x44,0xc5,0x57,0x32,0x79,0x25,0xa6,0x3d,0x91,0xf0,0x8,0xce,0x47,0x97,0x94,0xf0,0x8,0xce,0xf,0x4b,0xcf,0x7a,0xc2,0xc8,0xc0,0xc0,0xc0,0xa0,0x2f,0xc8,0xcb,0xb0,0x7e,0xce,0x74,0x14,0x6f,0x86,0xa6,0x65,0x3e,0x79,0xfd,0xe3,0x37,0x3,0x0,0x1f,0xf5,0x33,0x27,0xce,0x5,0x6d,0x6f,0x0,0x0,0x0,0x0,0x49,0x45,0x4e,0x44,0xae,0x42,0x60,0x82
}; };
@ -1492,6 +1497,11 @@ static const unsigned char icon_back_no_png[]={
}; };
static const unsigned char icon_mirror_x_png[]={
0x89,0x50,0x4e,0x47,0xd,0xa,0x1a,0xa,0x0,0x0,0x0,0xd,0x49,0x48,0x44,0x52,0x0,0x0,0x0,0x10,0x0,0x0,0x0,0x10,0x8,0x6,0x0,0x0,0x0,0x1f,0xf3,0xff,0x61,0x0,0x0,0x0,0x6,0x62,0x4b,0x47,0x44,0x0,0xff,0x0,0xff,0x0,0xff,0xa0,0xbd,0xa7,0x93,0x0,0x0,0x0,0x9,0x70,0x48,0x59,0x73,0x0,0x0,0xb,0x13,0x0,0x0,0xb,0x13,0x1,0x0,0x9a,0x9c,0x18,0x0,0x0,0x0,0x7,0x74,0x49,0x4d,0x45,0x7,0xde,0x2,0xd,0x11,0x2e,0x3b,0xcb,0xa2,0x75,0xd,0x0,0x0,0x0,0x73,0x49,0x44,0x41,0x54,0x38,0xcb,0xed,0x92,0x31,0xe,0x80,0x30,0xc,0x3,0xf,0x3e,0xd0,0x99,0x89,0xa9,0x2b,0xe5,0x79,0xfc,0x80,0xef,0xb5,0x5d,0x33,0x65,0xca,0xcc,0x7,0x80,0xa5,0x48,0x48,0x48,0x15,0x43,0xc7,0x7a,0x8c,0x1d,0xd9,0x8e,0x2,0x1d,0x6d,0xa1,0x62,0x51,0xc5,0xf6,0xa,0xbf,0xab,0x58,0x7c,0xcf,0xc6,0x17,0x99,0x80,0x5,0x38,0x2a,0x1e,0x7,0xb0,0x14,0x2d,0x0,0xc3,0xe3,0x5c,0x96,0x87,0x9f,0x61,0x2f,0x20,0xcf,0x7e,0x5a,0xc7,0x96,0xfd,0x93,0x8a,0x9d,0x2a,0xb6,0x55,0x34,0x5b,0xd1,0xa4,0xcf,0xd,0x66,0x3f,0x5,0x20,0x3,0xae,0xe2,0xe3,0x4a,0xf4,0xd0,0x5f,0xae,0x21,0x6e,0x17,0xf,0x33,0xa2,0x3a,0x35,0x7,0x62,0x0,0x0,0x0,0x0,0x49,0x45,0x4e,0x44,0xae,0x42,0x60,0x82
};
static const unsigned char icon_iapi_png[]={ static const unsigned char icon_iapi_png[]={
0x89,0x50,0x4e,0x47,0xd,0xa,0x1a,0xa,0x0,0x0,0x0,0xd,0x49,0x48,0x44,0x52,0x0,0x0,0x0,0x10,0x0,0x0,0x0,0x10,0x8,0x6,0x0,0x0,0x0,0x1f,0xf3,0xff,0x61,0x0,0x0,0x0,0x1,0x73,0x52,0x47,0x42,0x0,0xae,0xce,0x1c,0xe9,0x0,0x0,0x0,0x6,0x62,0x4b,0x47,0x44,0x0,0x0,0x0,0x0,0x0,0x0,0xf9,0x43,0xbb,0x7f,0x0,0x0,0x0,0x9,0x70,0x48,0x59,0x73,0x0,0x0,0xb,0x13,0x0,0x0,0xb,0x13,0x1,0x0,0x9a,0x9c,0x18,0x0,0x0,0x0,0x7,0x74,0x49,0x4d,0x45,0x7,0xda,0x2,0x11,0x5,0x3,0xa,0x20,0x27,0x8e,0x45,0x0,0x0,0x0,0x95,0x49,0x44,0x41,0x54,0x38,0xcb,0x63,0xfc,0xcf,0xf0,0x9f,0x1,0x1b,0x50,0x77,0x64,0xc7,0x2e,0xc1,0xc0,0xc0,0x70,0x73,0xff,0x4f,0x46,0x18,0x9b,0x5,0x97,0xe6,0xf5,0x5c,0x31,0x18,0xe2,0x81,0xdf,0x96,0x60,0x88,0x31,0x91,0xa2,0x59,0x35,0xfb,0x3c,0x86,0x38,0xb,0x36,0x67,0x63,0xb3,0x9,0x9b,0x66,0xac,0x5e,0x50,0x9d,0xd2,0x80,0xa1,0xe8,0x76,0x4e,0x3,0xae,0xe0,0xc0,0xf4,0x2,0xa9,0x80,0xbe,0x6,0xdc,0x9e,0x6a,0x88,0x12,0x85,0x24,0x19,0x80,0x4d,0x33,0x3,0x3,0x3,0x3,0x23,0x72,0x42,0x22,0x36,0xf1,0xe0,0x34,0x80,0xe2,0x30,0x60,0x64,0x60,0xfc,0x8f,0x8b,0x8d,0x4b,0xe,0x6b,0x18,0x30,0x32,0x30,0xfe,0xff,0xcf,0xf0,0x9f,0x11,0x59,0x21,0x3a,0x9f,0x60,0x20,0xa2,0x2b,0xc6,0xa6,0x19,0xaf,0x1,0xff,0x19,0xfe,0x33,0xa2,0xf3,0xd1,0xc5,0xa8,0x92,0x90,0x0,0x1,0x55,0x3c,0x7c,0x48,0xb8,0xea,0x5c,0x0,0x0,0x0,0x0,0x49,0x45,0x4e,0x44,0xae,0x42,0x60,0x82 0x89,0x50,0x4e,0x47,0xd,0xa,0x1a,0xa,0x0,0x0,0x0,0xd,0x49,0x48,0x44,0x52,0x0,0x0,0x0,0x10,0x0,0x0,0x0,0x10,0x8,0x6,0x0,0x0,0x0,0x1f,0xf3,0xff,0x61,0x0,0x0,0x0,0x1,0x73,0x52,0x47,0x42,0x0,0xae,0xce,0x1c,0xe9,0x0,0x0,0x0,0x6,0x62,0x4b,0x47,0x44,0x0,0x0,0x0,0x0,0x0,0x0,0xf9,0x43,0xbb,0x7f,0x0,0x0,0x0,0x9,0x70,0x48,0x59,0x73,0x0,0x0,0xb,0x13,0x0,0x0,0xb,0x13,0x1,0x0,0x9a,0x9c,0x18,0x0,0x0,0x0,0x7,0x74,0x49,0x4d,0x45,0x7,0xda,0x2,0x11,0x5,0x3,0xa,0x20,0x27,0x8e,0x45,0x0,0x0,0x0,0x95,0x49,0x44,0x41,0x54,0x38,0xcb,0x63,0xfc,0xcf,0xf0,0x9f,0x1,0x1b,0x50,0x77,0x64,0xc7,0x2e,0xc1,0xc0,0xc0,0x70,0x73,0xff,0x4f,0x46,0x18,0x9b,0x5,0x97,0xe6,0xf5,0x5c,0x31,0x18,0xe2,0x81,0xdf,0x96,0x60,0x88,0x31,0x91,0xa2,0x59,0x35,0xfb,0x3c,0x86,0x38,0xb,0x36,0x67,0x63,0xb3,0x9,0x9b,0x66,0xac,0x5e,0x50,0x9d,0xd2,0x80,0xa1,0xe8,0x76,0x4e,0x3,0xae,0xe0,0xc0,0xf4,0x2,0xa9,0x80,0xbe,0x6,0xdc,0x9e,0x6a,0x88,0x12,0x85,0x24,0x19,0x80,0x4d,0x33,0x3,0x3,0x3,0x3,0x23,0x72,0x42,0x22,0x36,0xf1,0xe0,0x34,0x80,0xe2,0x30,0x60,0x64,0x60,0xfc,0x8f,0x8b,0x8d,0x4b,0xe,0x6b,0x18,0x30,0x32,0x30,0xfe,0xff,0xcf,0xf0,0x9f,0x11,0x59,0x21,0x3a,0x9f,0x60,0x20,0xa2,0x2b,0xc6,0xa6,0x19,0xaf,0x1,0xff,0x19,0xfe,0x33,0xa2,0xf3,0xd1,0xc5,0xa8,0x92,0x90,0x0,0x1,0x55,0x3c,0x7c,0x48,0xb8,0xea,0x5c,0x0,0x0,0x0,0x0,0x49,0x45,0x4e,0x44,0xae,0x42,0x60,0x82
}; };
@ -1998,6 +2008,7 @@ void editor_register_icons(Ref<Theme> p_theme) {
p_theme->set_icon("GridMap","EditorIcons",make_icon(icon_grid_map_png)); p_theme->set_icon("GridMap","EditorIcons",make_icon(icon_grid_map_png));
p_theme->set_icon("TrackValue","EditorIcons",make_icon(icon_track_value_png)); p_theme->set_icon("TrackValue","EditorIcons",make_icon(icon_track_value_png));
p_theme->set_icon("HSeparator","EditorIcons",make_icon(icon_h_separator_png)); p_theme->set_icon("HSeparator","EditorIcons",make_icon(icon_h_separator_png));
p_theme->set_icon("MirrorY","EditorIcons",make_icon(icon_mirror_y_png));
p_theme->set_icon("KeyXform","EditorIcons",make_icon(icon_key_xform_png)); p_theme->set_icon("KeyXform","EditorIcons",make_icon(icon_key_xform_png));
p_theme->set_icon("ConfirmationDialog","EditorIcons",make_icon(icon_confirmation_dialog_png)); p_theme->set_icon("ConfirmationDialog","EditorIcons",make_icon(icon_confirmation_dialog_png));
p_theme->set_icon("CharacterBody","EditorIcons",make_icon(icon_character_body_png)); p_theme->set_icon("CharacterBody","EditorIcons",make_icon(icon_character_body_png));
@ -2158,6 +2169,7 @@ void editor_register_icons(Ref<Theme> p_theme) {
p_theme->set_icon("Path2D","EditorIcons",make_icon(icon_path_2d_png)); p_theme->set_icon("Path2D","EditorIcons",make_icon(icon_path_2d_png));
p_theme->set_icon("CylinderShape","EditorIcons",make_icon(icon_cylinder_shape_png)); p_theme->set_icon("CylinderShape","EditorIcons",make_icon(icon_cylinder_shape_png));
p_theme->set_icon("BackNo","EditorIcons",make_icon(icon_back_no_png)); p_theme->set_icon("BackNo","EditorIcons",make_icon(icon_back_no_png));
p_theme->set_icon("MirrorX","EditorIcons",make_icon(icon_mirror_x_png));
p_theme->set_icon("Iapi","EditorIcons",make_icon(icon_iapi_png)); p_theme->set_icon("Iapi","EditorIcons",make_icon(icon_iapi_png));
p_theme->set_icon("Forward","EditorIcons",make_icon(icon_forward_png)); p_theme->set_icon("Forward","EditorIcons",make_icon(icon_forward_png));
p_theme->set_icon("Remove","EditorIcons",make_icon(icon_remove_png)); p_theme->set_icon("Remove","EditorIcons",make_icon(icon_remove_png));

View File

@ -471,6 +471,18 @@ Error EditorExportPlatform::export_project_files(EditorExportSaveFunction p_func
EditorImportExport::get_singleton()->image_export_get_images_in_group(E->get(),&atlas_images); EditorImportExport::get_singleton()->image_export_get_images_in_group(E->get(),&atlas_images);
atlas_images.sort_custom<StringName::AlphCompare>(); atlas_images.sort_custom<StringName::AlphCompare>();
for (List<StringName>::Element *F=atlas_images.front();F;) {
List<StringName>::Element *N=F->next();
if (!FileAccess::exists(F->get())) {
atlas_images.erase(F);
}
F=N;
}
if (atlas_images.size()<=1) if (atlas_images.size()<=1)
continue; continue;
@ -814,6 +826,13 @@ Error EditorExportPlatform::save_pack_file(void *p_userdata,const String& p_path
pd->file_ofs.push_back(td); pd->file_ofs.push_back(td);
pd->f->store_64(0); //ofs pd->f->store_64(0); //ofs
pd->f->store_64(0); //size pd->f->store_64(0); //size
{
MD5_CTX ctx;
MD5Init(&ctx);
MD5Update(&ctx,(unsigned char*)p_data.ptr(),p_data.size());
MD5Final(&ctx);
pd->f->store_buffer(ctx.digest,16);
}
pd->ep->step("Storing File: "+p_path,2+p_file*100/p_total); pd->ep->step("Storing File: "+p_path,2+p_file*100/p_total);
pd->count++; pd->count++;
pd->ftmp->store_buffer(p_data.ptr(),p_data.size()); pd->ftmp->store_buffer(p_data.ptr(),p_data.size());

View File

@ -235,6 +235,7 @@ protected:
Map<StringName,Ref<EditorExportPlatform> > exporters; Map<StringName,Ref<EditorExportPlatform> > exporters;
Map<StringName,ImageGroup> image_groups; Map<StringName,ImageGroup> image_groups;
Map<StringName,StringName> image_group_files; Map<StringName,StringName> image_group_files;
Vector<String> diff_packs;
static EditorImportExport* singleton; static EditorImportExport* singleton;
@ -270,6 +271,8 @@ public:
void set_export_image_quality(float p_quality); void set_export_image_quality(float p_quality);
float get_export_image_quality() const; 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_create(const StringName& p_name);
void image_export_group_remove(const StringName& p_name); void image_export_group_remove(const StringName& p_name);
bool image_export_has_group(const StringName& p_name) const; bool image_export_has_group(const StringName& p_name) const;

View File

@ -1111,10 +1111,20 @@ void EditorNode::_dialog_action(String p_file) {
} }
int ret = unzGoToFirstFile(pkg); int ret = unzGoToFirstFile(pkg);
int fc=0; //coun them
EditorProgress p("ltask","Loading Export Templates",1); while(ret==UNZ_OK) {
fc++;
ret = unzGoToNextFile(pkg);
}
ret = unzGoToFirstFile(pkg);
EditorProgress p("ltask","Loading Export Templates",fc);
print_line("BEGIN IMPORT"); print_line("BEGIN IMPORT");
fc=0;
while(ret==UNZ_OK) { while(ret==UNZ_OK) {
@ -1123,19 +1133,25 @@ void EditorNode::_dialog_action(String p_file) {
char fname[16384]; char fname[16384];
ret = unzGetCurrentFileInfo(pkg,&info,fname,16384,NULL,0,NULL,0); ret = unzGetCurrentFileInfo(pkg,&info,fname,16384,NULL,0,NULL,0);
String file=fname; String file=fname;
Vector<uint8_t> data; Vector<uint8_t> data;
data.resize(info.uncompressed_size); data.resize(info.uncompressed_size);
//read //read
unzOpenCurrentFile(pkg); ret = unzOpenCurrentFile(pkg);
unzReadCurrentFile(pkg,data.ptr(),data.size()); ret = unzReadCurrentFile(pkg,data.ptr(),data.size());
unzCloseCurrentFile(pkg); unzCloseCurrentFile(pkg);
print_line(fname);
//for(int i=0;i<512;i++) {
// print_line(itos(data[i]));
//}
file=file.get_file(); file=file.get_file();
p.step("Importing: "+file,0); p.step("Importing: "+file,fc);
print_line("IMPORT "+file); print_line("IMPORT "+file);
FileAccess *f = FileAccess::open(EditorSettings::get_singleton()->get_settings_path()+"/templates/"+file,FileAccess::WRITE); FileAccess *f = FileAccess::open(EditorSettings::get_singleton()->get_settings_path()+"/templates/"+file,FileAccess::WRITE);
@ -1146,6 +1162,7 @@ void EditorNode::_dialog_action(String p_file) {
memdelete(f); memdelete(f);
ret = unzGoToNextFile(pkg); ret = unzGoToNextFile(pkg);
fc++;
} }
unzClose(pkg); unzClose(pkg);

View File

@ -310,7 +310,7 @@ void EditorFileServer::stop(){
EditorFileServer::EditorFileServer() { EditorFileServer::EditorFileServer() {
server = TCP_Server::create(); server = TCP_Server::create_ref();
thread=Thread::create(_thread_start,this); thread=Thread::create(_thread_start,this);
wait_mutex = Mutex::create(); wait_mutex = Mutex::create();
quit=false; quit=false;

Binary file not shown.

After

Width:  |  Height:  |  Size: 230 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 244 B

View File

@ -109,6 +109,7 @@ void CollisionPolygonEditor::_wip_close() {
bool CollisionPolygonEditor::forward_input_event(const InputEvent& p_event) { bool CollisionPolygonEditor::forward_input_event(const InputEvent& p_event) {
switch(p_event.type) { switch(p_event.type) {
case InputEvent::MOUSE_BUTTON: { case InputEvent::MOUSE_BUTTON: {
@ -140,11 +141,12 @@ bool CollisionPolygonEditor::forward_input_event(const InputEvent& p_event) {
wip.push_back( snap_point(cpoint) ); wip.push_back( snap_point(cpoint) );
wip_active=true; wip_active=true;
edited_point_pos=snap_point(cpoint); edited_point_pos=snap_point(cpoint);
canvas_item_editor->update(); canvas_item_editor->get_viewport_control()->update();
edited_point=1; edited_point=1;
return true; return true;
} else { } else {
if (wip.size()>1 && xform.xform(wip[0]).distance_to(gpoint)<grab_treshold) { if (wip.size()>1 && xform.xform(wip[0]).distance_to(gpoint)<grab_treshold) {
//wip closed //wip closed
_wip_close(); _wip_close();
@ -154,7 +156,7 @@ bool CollisionPolygonEditor::forward_input_event(const InputEvent& p_event) {
wip.push_back( snap_point(cpoint) ); wip.push_back( snap_point(cpoint) );
edited_point=wip.size(); edited_point=wip.size();
canvas_item_editor->update(); canvas_item_editor->get_viewport_control()->update();
return true; return true;
//add wip point //add wip point
@ -218,7 +220,7 @@ bool CollisionPolygonEditor::forward_input_event(const InputEvent& p_event) {
edited_point=closest_idx+1; edited_point=closest_idx+1;
edited_point_pos=snap_point(xform.affine_inverse().xform(closest_pos)); edited_point_pos=snap_point(xform.affine_inverse().xform(closest_pos));
node->set_polygon(poly); node->set_polygon(poly);
canvas_item_editor->update(); canvas_item_editor->get_viewport_control()->update();
return true; return true;
} }
} else { } else {
@ -246,7 +248,7 @@ bool CollisionPolygonEditor::forward_input_event(const InputEvent& p_event) {
pre_move_edit=poly; pre_move_edit=poly;
edited_point=closest_idx; edited_point=closest_idx;
edited_point_pos=xform.affine_inverse().xform(closest_pos); edited_point_pos=xform.affine_inverse().xform(closest_pos);
canvas_item_editor->update(); canvas_item_editor->get_viewport_control()->update();
return true; return true;
} }
} }
@ -323,7 +325,7 @@ bool CollisionPolygonEditor::forward_input_event(const InputEvent& p_event) {
Vector2 gpoint = Point2(mm.x,mm.y); Vector2 gpoint = Point2(mm.x,mm.y);
edited_point_pos = snap_point(xform.affine_inverse().xform(gpoint)); edited_point_pos = snap_point(xform.affine_inverse().xform(gpoint));
canvas_item_editor->update(); canvas_item_editor->get_viewport_control()->update();
} }
@ -337,6 +339,7 @@ void CollisionPolygonEditor::_canvas_draw() {
if (!node) if (!node)
return; return;
Control *vpc = canvas_item_editor->get_viewport_control();
Vector<Vector2> poly; Vector<Vector2> poly;
@ -365,8 +368,8 @@ void CollisionPolygonEditor::_canvas_draw() {
Vector2 next_point = xform.xform(p2); Vector2 next_point = xform.xform(p2);
Color col=Color(1,0.3,0.1,0.8); Color col=Color(1,0.3,0.1,0.8);
canvas_item_editor->draw_line(point,next_point,col,2); vpc->draw_line(point,next_point,col,2);
canvas_item_editor->draw_texture(handle,point-handle->get_size()*0.5); vpc->draw_texture(handle,point-handle->get_size()*0.5);
} }
} }
@ -381,8 +384,8 @@ void CollisionPolygonEditor::edit(Node *p_collision_polygon) {
if (p_collision_polygon) { if (p_collision_polygon) {
node=p_collision_polygon->cast_to<CollisionPolygon2D>(); node=p_collision_polygon->cast_to<CollisionPolygon2D>();
if (!canvas_item_editor->is_connected("draw",this,"_canvas_draw")) if (!canvas_item_editor->get_viewport_control()->is_connected("draw",this,"_canvas_draw"))
canvas_item_editor->connect("draw",this,"_canvas_draw"); canvas_item_editor->get_viewport_control()->connect("draw",this,"_canvas_draw");
wip.clear(); wip.clear();
wip_active=false; wip_active=false;
edited_point=-1; edited_point=-1;
@ -390,8 +393,8 @@ void CollisionPolygonEditor::edit(Node *p_collision_polygon) {
} else { } else {
node=NULL; node=NULL;
if (canvas_item_editor->is_connected("draw",this,"_canvas_draw")) if (canvas_item_editor->get_viewport_control()->is_connected("draw",this,"_canvas_draw"))
canvas_item_editor->disconnect("draw",this,"_canvas_draw"); canvas_item_editor->get_viewport_control()->disconnect("draw",this,"_canvas_draw");
} }

View File

@ -608,7 +608,7 @@ TileMapEditor::TileMapEditor(EditorNode *p_editor) {
theme_panel = memnew( Panel ); theme_panel = memnew( Panel );
theme_panel->set_anchor(MARGIN_BOTTOM,ANCHOR_END); theme_panel->set_anchor(MARGIN_BOTTOM,ANCHOR_END);
theme_panel->set_begin( Point2(0,20)); theme_panel->set_begin( Point2(0,26));
theme_panel->set_end( Point2(100,0) ); theme_panel->set_end( Point2(100,0) );
p_editor->get_viewport()->add_child(theme_panel); p_editor->get_viewport()->add_child(theme_panel);
theme_panel->hide(); theme_panel->hide();

View File

@ -310,6 +310,7 @@ void ProjectExportDialog::_notification(int p_what) {
void ProjectExportDialog::_validate_platform() { void ProjectExportDialog::_validate_platform() {
get_ok()->set_disabled(true); get_ok()->set_disabled(true);
button_export->set_disabled(true);
TreeItem *selected = platforms->get_selected(); TreeItem *selected = platforms->get_selected();
plat_errors->hide(); plat_errors->hide();
if (!selected) { if (!selected) {
@ -351,6 +352,7 @@ void ProjectExportDialog::_validate_platform() {
} }
get_ok()->set_disabled(false); get_ok()->set_disabled(false);
button_export->set_disabled(false);
} }
@ -385,6 +387,35 @@ void ProjectExportDialog::_export_action(const String& p_file) {
} }
void ProjectExportDialog::_export_action_pck(const String& p_file) {
TreeItem *selected = platforms->get_selected();
if (!selected)
return;
Ref<EditorExportPlatform> exporter = EditorImportExport::get_singleton()->get_export_platform(selected->get_metadata(0));
if (exporter.is_null()) {
ERR_PRINT("Invalid platform for export of PCK");
return;
}
FileAccess *f = FileAccess::open(p_file,FileAccess::WRITE);
if (!f) {
error->set_text("Error exporting project PCK! Can't write");
error->popup_centered(Size2(300,70));;
}
ERR_FAIL_COND(!f);
Error err = exporter->save_pack(f,false);
memdelete(f);
if (err!=OK) {
error->set_text("Error exporting project!");
error->popup_centered(Size2(300,70));;
return;
}
}
Error ProjectExportDialog::export_platform(const String& p_platform, const String& p_path, bool p_debug,const String& p_password, bool p_quit_after) { Error ProjectExportDialog::export_platform(const String& p_platform, const String& p_path, bool p_debug,const String& p_password, bool p_quit_after) {
Ref<EditorExportPlatform> exporter = EditorImportExport::get_singleton()->get_export_platform(p_platform); Ref<EditorExportPlatform> exporter = EditorImportExport::get_singleton()->get_export_platform(p_platform);
@ -408,6 +439,12 @@ Error ProjectExportDialog::export_platform(const String& p_platform, const Strin
} }
void ProjectExportDialog::ok_pressed() { void ProjectExportDialog::ok_pressed() {
//export pck
pck_export->popup_centered_ratio();
}
void ProjectExportDialog::custom_action(const String&) {
//real export
TreeItem *selected = platforms->get_selected(); TreeItem *selected = platforms->get_selected();
if (!selected) if (!selected)
@ -909,6 +946,7 @@ void ProjectExportDialog::_bind_methods() {
ObjectTypeDB::bind_method(_MD("_export_mode_changed"),&ProjectExportDialog::_export_mode_changed); ObjectTypeDB::bind_method(_MD("_export_mode_changed"),&ProjectExportDialog::_export_mode_changed);
ObjectTypeDB::bind_method(_MD("_filters_edited"),&ProjectExportDialog::_filters_edited); ObjectTypeDB::bind_method(_MD("_filters_edited"),&ProjectExportDialog::_filters_edited);
ObjectTypeDB::bind_method(_MD("_export_action"),&ProjectExportDialog::_export_action); ObjectTypeDB::bind_method(_MD("_export_action"),&ProjectExportDialog::_export_action);
ObjectTypeDB::bind_method(_MD("_export_action_pck"),&ProjectExportDialog::_export_action_pck);
ObjectTypeDB::bind_method(_MD("_quality_edited"),&ProjectExportDialog::_quality_edited); ObjectTypeDB::bind_method(_MD("_quality_edited"),&ProjectExportDialog::_quality_edited);
ObjectTypeDB::bind_method(_MD("_image_export_edited"),&ProjectExportDialog::_image_export_edited); ObjectTypeDB::bind_method(_MD("_image_export_edited"),&ProjectExportDialog::_image_export_edited);
ObjectTypeDB::bind_method(_MD("_format_toggled"),&ProjectExportDialog::_format_toggled); ObjectTypeDB::bind_method(_MD("_format_toggled"),&ProjectExportDialog::_format_toggled);
@ -1201,7 +1239,7 @@ ProjectExportDialog::ProjectExportDialog(EditorNode *p_editor) {
add_child(confirm); add_child(confirm);
confirm->connect("confirmed",this,"_confirmed"); confirm->connect("confirmed",this,"_confirmed");
get_ok()->set_text("Export.."); get_ok()->set_text("Export PCK");
expopt="--,Export,Bundle"; expopt="--,Export,Bundle";
@ -1224,6 +1262,14 @@ ProjectExportDialog::ProjectExportDialog(EditorNode *p_editor) {
file_export_password->set_editable(false); file_export_password->set_editable(false);
file_export->get_vbox()->add_margin_child("Password:",file_export_password); file_export->get_vbox()->add_margin_child("Password:",file_export_password);
pck_export = memnew( FileDialog );
pck_export->set_access(FileDialog::ACCESS_FILESYSTEM);
pck_export->set_title("Export Project PCK");
pck_export->connect("file_selected", this,"_export_action_pck");
pck_export->add_filter("*.pck ; Data Pack");
add_child(pck_export);
button_export = add_button("Export..",!OS::get_singleton()->get_swap_ok_cancel(),"export_pck");
} }

View File

@ -80,10 +80,12 @@ private:
Tree * tree; Tree * tree;
FileDialog *pck_export;
FileDialog *file_export; FileDialog *file_export;
CheckButton *file_export_check; CheckButton *file_export_check;
LineEdit *file_export_password; LineEdit *file_export_password;
Button *button_export;
String _delete_attempt; String _delete_attempt;
bool updating; bool updating;
@ -162,7 +164,9 @@ private:
void _group_del(Object *item,int p_column, int p_button); void _group_del(Object *item,int p_column, int p_button);
void _export_action(const String& p_file); void _export_action(const String& p_file);
void _export_action_pck(const String& p_file);
void ok_pressed(); void ok_pressed();
void custom_action(const String&);
void _save_export_cfg(); void _save_export_cfg();
void _format_toggled(); void _format_toggled();

File diff suppressed because it is too large Load Diff

149
tools/html_fs/filesystem.js Normal file
View File

@ -0,0 +1,149 @@
var Module;
if (typeof Module === 'undefined') Module = eval('(function() { try { return Module || {} } catch(e) { return {} } })()');
if (!Module.expectedDataFileDownloads) {
Module.expectedDataFileDownloads = 0;
Module.finishedDataFileDownloads = 0;
}
Module.expectedDataFileDownloads++;
(function() {
function fetchRemotePackage(packageName, callback, errback) {
var xhr = new XMLHttpRequest();
xhr.open('GET', packageName, true);
xhr.responseType = 'arraybuffer';
xhr.onprogress = function(event) {
var url = packageName;
if (event.loaded && event.total) {
if (!xhr.addedTotal) {
xhr.addedTotal = true;
if (!Module.dataFileDownloads) Module.dataFileDownloads = {};
Module.dataFileDownloads[url] = {
loaded: event.loaded,
total: event.total
};
} else {
Module.dataFileDownloads[url].loaded = event.loaded;
}
var total = 0;
var loaded = 0;
var num = 0;
for (var download in Module.dataFileDownloads) {
var data = Module.dataFileDownloads[download];
total += data.total;
loaded += data.loaded;
num++;
}
total = Math.ceil(total * Module.expectedDataFileDownloads/num);
if (Module['setStatus']) Module['setStatus']('Downloading data... (' + loaded + '/' + total + ')');
} else if (!Module.dataFileDownloads) {
if (Module['setStatus']) Module['setStatus']('Downloading data...');
}
};
xhr.onload = function(event) {
var packageData = xhr.response;
callback(packageData);
};
xhr.send(null);
};
function handleError(error) {
console.error('package error:', error);
};
var fetched = null, fetchedCallback = null;
fetchRemotePackage('data.pck', function(data) {
if (fetchedCallback) {
fetchedCallback(data);
fetchedCallback = null;
} else {
fetched = data;
}
}, handleError);
function runWithFS() {
function assert(check, msg) {
if (!check) throw msg + new Error().stack;
}
function DataRequest(start, end, crunched, audio) {
this.start = start;
this.end = end;
this.crunched = crunched;
this.audio = audio;
}
DataRequest.prototype = {
requests: {},
open: function(mode, name) {
this.name = name;
this.requests[name] = this;
Module['addRunDependency']('fp ' + this.name);
},
send: function() {},
onload: function() {
var byteArray = this.byteArray.subarray(this.start, this.end);
this.finish(byteArray);
},
finish: function(byteArray) {
var that = this;
Module['FS_createPreloadedFile'](this.name, null, byteArray, true, true, function() {
Module['removeRunDependency']('fp ' + that.name);
}, function() {
if (that.audio) {
Module['removeRunDependency']('fp ' + that.name); // workaround for chromium bug 124926 (still no audio with this, but at least we don't hang)
} else {
Module.printErr('Preloading file ' + that.name + ' failed');
}
}, false, true); // canOwn this data in the filesystem, it is a slide into the heap that will never change
this.requests[this.name] = null;
},
};
new DataRequest(0, $DPLEN, 0, 0).open('GET', '/data.pck');
var PACKAGE_PATH;
if (typeof window === 'object') {
PACKAGE_PATH = window['encodeURIComponent'](window.location.pathname.toString().substring(0, window.location.pathname.toString().lastIndexOf('/')) + '/');
} else {
// worker
PACKAGE_PATH = encodeURIComponent(location.pathname.toString().substring(0, location.pathname.toString().lastIndexOf('/')) + '/');
}
var PACKAGE_NAME = 'data.pck';
var REMOTE_PACKAGE_NAME = 'data.pck';
var PACKAGE_UUID = 'b39761ce-0348-4959-9b16-302ed8e1592e';
function processPackageData(arrayBuffer) {
Module.finishedDataFileDownloads++;
assert(arrayBuffer, 'Loading data file failed.');
var byteArray = new Uint8Array(arrayBuffer);
var curr;
// Reuse the bytearray from the XHR as the source for file reads.
DataRequest.prototype.byteArray = byteArray;
DataRequest.prototype.requests["/data.pck"].onload();
Module['removeRunDependency']('datafile_datapack');
};
Module['addRunDependency']('datafile_datapack');
if (!Module.preloadResults) Module.preloadResults = {};
Module.preloadResults[PACKAGE_NAME] = {fromCache: false};
if (fetched) {
processPackageData(fetched);
fetched = null;
} else {
fetchedCallback = processPackageData;
}
}
if (Module['calledRun']) {
runWithFS();
} else {
if (!Module['preRun']) Module['preRun'] = [];
Module["preRun"].push(runWithFS); // FS is not initialized yet, wait for it
}
})();