This commit is contained in:
Juan Linietsky 2015-05-21 15:02:49 -03:00
commit bb5d46bb11
95 changed files with 3157 additions and 102 deletions

16
.gitignore vendored
View file

@ -265,3 +265,19 @@ Desktop.ini
$RECYCLE.BIN/
logo.h
*.autosave
# https://github.com/github/gitignore/blob/master/Global/Tags.gitignore
# Ignore tags created by etags, ctags, gtags (GNU global) and cscope
TAGS
!TAGS/
tags
!tags/
gtags.files
GTAGS
GRTAGS
GPATH
cscope.files
cscope.out
cscope.in.out
cscope.po.out
godot.creator.user.wd3476

2432
Doxyfile Normal file

File diff suppressed because it is too large Load diff

View file

@ -5,7 +5,7 @@
#include "io/base64.h"
#include "core/globals.h"
#include "io/file_access_encrypted.h"
#include "os/keyboard.h"
_ResourceLoader *_ResourceLoader::singleton=NULL;
Ref<ResourceInteractiveLoader> _ResourceLoader::load_interactive(const String& p_path,const String& p_type_hint) {
@ -694,6 +694,20 @@ String _OS::get_custom_level() const {
return OS::get_singleton()->get_custom_level();
}
String _OS::get_scancode_string(uint32_t p_code) const {
return keycode_get_string(p_code);
}
bool _OS::is_scancode_unicode(uint32_t p_unicode) const {
return keycode_has_unicode(p_unicode);
}
int _OS::find_scancode_from_string(const String& p_code) const {
return find_keycode(p_code);
}
_OS *_OS::singleton=NULL;
void _OS::_bind_methods() {
@ -810,6 +824,9 @@ void _OS::_bind_methods() {
ObjectTypeDB::bind_method(_MD("native_video_stop"),&_OS::native_video_stop);
ObjectTypeDB::bind_method(_MD("native_video_pause"),&_OS::native_video_pause);
ObjectTypeDB::bind_method(_MD("get_scancode_string","code"),&_OS::get_scancode_string);
ObjectTypeDB::bind_method(_MD("is_scancode_unicode","code"),&_OS::is_scancode_unicode);
ObjectTypeDB::bind_method(_MD("find_scancode_from_string","string"),&_OS::find_scancode_from_string);
ObjectTypeDB::bind_method(_MD("set_use_file_access_save_and_swap","enabled"),&_OS::set_use_file_access_save_and_swap);
@ -1740,7 +1757,9 @@ _Mutex::~_Mutex(){
void _Thread::_start_func(void *ud) {
_Thread *t=(_Thread*)ud;
Ref<_Thread>* tud=(Ref<_Thread>*)ud;
Ref<_Thread> t=*tud;
memdelete(tud);
Variant::CallError ce;
const Variant* arg[1]={&t->userdata};
t->ret=t->target_instance->call(t->target_method,arg,1,ce);
@ -1787,9 +1806,11 @@ Error _Thread::start(Object *p_instance,const StringName& p_method,const Variant
userdata=p_userdata;
active=true;
Ref<_Thread> *ud = memnew( Ref<_Thread>(this) );
Thread::Settings s;
s.priority=(Thread::Priority)p_priority;
thread = Thread::create(_start_func,this,s);
thread = Thread::create(_start_func,ud,s);
if (!thread) {
active=false;
target_method=StringName();
@ -1850,5 +1871,8 @@ _Thread::_Thread() {
_Thread::~_Thread() {
if (active) {
ERR_EXPLAIN("Reference to a Thread object object was lost while the thread is still running..");
}
ERR_FAIL_COND(active==true);
}

View file

@ -178,6 +178,11 @@ public:
String get_unique_ID() const;
String get_scancode_string(uint32_t p_code) const;
bool is_scancode_unicode(uint32_t p_unicode) const;
int find_scancode_from_string(const String& p_code) const;
/*
struct Date {

View file

@ -42,7 +42,7 @@ void InputMap::_bind_methods() {
ObjectTypeDB::bind_method(_MD("action_add_event","action","event"),&InputMap::action_add_event);
ObjectTypeDB::bind_method(_MD("action_has_event","action","event"),&InputMap::action_has_event);
ObjectTypeDB::bind_method(_MD("action_erase_event","action","event"),&InputMap::action_erase_event);
ObjectTypeDB::bind_method(_MD("get_action_list","action"),&InputMap::get_action_list);
ObjectTypeDB::bind_method(_MD("get_action_list","action"),&InputMap::_get_action_list);
ObjectTypeDB::bind_method(_MD("event_is_action","event","action"),&InputMap::event_is_action);
ObjectTypeDB::bind_method(_MD("load_from_globals"),&InputMap::load_from_globals);
@ -162,6 +162,22 @@ void InputMap::action_erase_event(const StringName& p_action,const InputEvent& p
}
Array InputMap::_get_action_list(const StringName& p_action) {
Array ret;
const List<InputEvent> *al = get_action_list(p_action);
if (al) {
for(const List<InputEvent>::Element *E=al->front();E;E=E->next()) {
ret.push_back(E->get());;
}
}
return ret;
}
const List<InputEvent> *InputMap::get_action_list(const StringName& p_action) {
const Map<StringName, Action>::Element *E=input_map.find(p_action);
@ -176,7 +192,7 @@ bool InputMap::event_is_action(const InputEvent& p_event, const StringName& p_ac
Map<StringName,Action >::Element *E=input_map.find(p_action);
if(!E) {
ERR_EXPLAIN("Request for unexisting InputMap action: "+String(p_action));
ERR_EXPLAIN("Request for nonexistent InputMap action: "+String(p_action));
ERR_FAIL_COND_V(!E,false);
}

View file

@ -46,6 +46,8 @@ class InputMap : public Object {
List<InputEvent>::Element *_find_event(List<InputEvent> &p_list,const InputEvent& p_event) const;
Array _get_action_list(const StringName& p_action);
protected:
static void _bind_methods();

View file

@ -357,6 +357,7 @@ if (res!=-1 && res < min_pos) {\
} break;
case MIN_OPEN: {
int level=1;
end++;
while(end<close_pos) {
if (str[end]=='[')
@ -373,6 +374,7 @@ if (res!=-1 && res < min_pos) {\
} break;
case MIN_CURLY_OPEN: {
int level=1;
end++;
while(end<close_pos) {
if (str[end]=='{')

View file

@ -861,7 +861,7 @@ void ResourceInteractiveLoaderBinary::open(FileAccess *p_f) {
print_bl("minor: "+itos(ver_minor));
print_bl("format: "+itos(ver_format));
if (ver_format<FORMAT_VERSION || ver_major>VERSION_MAJOR || (ver_major==VERSION_MAJOR && ver_minor>VERSION_MINOR)) {
if (ver_format<FORMAT_VERSION || ver_major>VERSION_MAJOR) {
f->close();
ERR_EXPLAIN("File Format '"+itos(FORMAT_VERSION)+"."+itos(ver_major)+"."+itos(ver_minor)+"' is too new! Please upgrade to a a new engine version: "+local_path);
@ -968,7 +968,7 @@ String ResourceInteractiveLoaderBinary::recognize(FileAccess *p_f) {
uint32_t ver_minor=f->get_32();
uint32_t ver_format=f->get_32();
if (ver_format<FORMAT_VERSION || ver_major>VERSION_MAJOR || (ver_major==VERSION_MAJOR && ver_minor>VERSION_MINOR)) {
if (ver_format<FORMAT_VERSION || ver_major>VERSION_MAJOR) {
f->close();
return "";

View file

@ -1374,7 +1374,7 @@ Error ResourceInteractiveLoaderXML::poll() {
if (res.is_null()) {
if (ResourceLoader::get_abort_on_missing_resources()) {
ERR_EXPLAIN(local_path+":"+itos(get_current_line())+": editor exported unexisting resource at: "+path);
ERR_EXPLAIN(local_path+":"+itos(get_current_line())+": editor exported nonexistent resource at: "+path);
ERR_FAIL_V(error);
} else {
ResourceLoader::notify_load_error("Resource Not Found: "+path);
@ -1433,7 +1433,7 @@ Error ResourceInteractiveLoaderXML::poll() {
if (res.is_null()) {
if (ResourceLoader::get_abort_on_missing_resources()) {
ERR_EXPLAIN(local_path+":"+itos(get_current_line())+": <ext_resource> referenced unexisting resource at: "+path);
ERR_EXPLAIN(local_path+":"+itos(get_current_line())+": <ext_resource> referenced nonexistent resource at: "+path);
ERR_FAIL_V(error);
} else {
ResourceLoader::notify_load_error("Resource Not Found: "+path);
@ -1671,7 +1671,7 @@ void ResourceInteractiveLoaderXML::open(FileAccess *p_f) {
int major = version.get_slice(".",0).to_int();
int minor = version.get_slice(".",1).to_int();
if (major>VERSION_MAJOR || (major==VERSION_MAJOR && minor>VERSION_MINOR)) {
if (major>VERSION_MAJOR) {
error=ERR_FILE_UNRECOGNIZED;
ResourceLoader::notify_load_error(local_path+": File Format '"+version+"' is too new. Please upgrade to a newer engine version.");

View file

@ -298,7 +298,7 @@ MethodBind* create_native_method_bind( Variant (T::*p_method)(const Variant**,in
// tale of an amazing hack.. //
// if you declare an unexisting class..
// if you declare an nonexistent class..
class __UnexistingClass;

View file

@ -1319,7 +1319,7 @@ Error Object::connect(const StringName& p_signal, Object *p_to_object, const Str
if (!s) {
bool signal_is_valid = ObjectTypeDB::has_signal(get_type_name(),p_signal);
if (!signal_is_valid) {
ERR_EXPLAIN("Attempt to connect to unexisting signal: "+p_signal);
ERR_EXPLAIN("Attempt to connect to nonexistent signal: "+p_signal);
ERR_FAIL_COND_V(!signal_is_valid,ERR_INVALID_PARAMETER);
}
signal_map[p_signal]=Signal();
@ -1356,7 +1356,7 @@ bool Object::is_connected(const StringName& p_signal, Object *p_to_object, const
bool signal_is_valid = ObjectTypeDB::has_signal(get_type_name(),p_signal);
if (signal_is_valid)
return false;
ERR_EXPLAIN("Unexisting signal: "+p_signal);
ERR_EXPLAIN("Nonexistent signal: "+p_signal);
ERR_FAIL_COND_V(!s,false);
}
@ -1373,7 +1373,7 @@ void Object::disconnect(const StringName& p_signal, Object *p_to_object, const S
ERR_FAIL_NULL(p_to_object);
Signal *s = signal_map.getptr(p_signal);
if (!s) {
ERR_EXPLAIN("Unexisting signal: "+p_signal);
ERR_EXPLAIN("Nonexistent signal: "+p_signal);
ERR_FAIL_COND(!s);
}
if (s->lock>0) {
@ -1384,7 +1384,7 @@ void Object::disconnect(const StringName& p_signal, Object *p_to_object, const S
Signal::Target target(p_to_object->get_instance_ID(),p_to_method);
if (!s->slot_map.has(target)) {
ERR_EXPLAIN("Disconnecting unexisting signal '"+p_signal+"', slot: "+itos(target._id)+":"+target.method);
ERR_EXPLAIN("Disconnecting nonexistent signal '"+p_signal+"', slot: "+itos(target._id)+":"+target.method);
ERR_FAIL();
}
int prev = p_to_object->connections.size();

View file

@ -56,6 +56,17 @@ String DirAccess::_get_root_string() const {
return "";
}
int DirAccess::get_current_drive() {
String path = get_current_dir().to_lower();
for(int i=0;i<get_drive_count();i++) {
String d = get_drive(i).to_lower();
if (path.begins_with(d))
return i;
}
return 0;
}
static Error _erase_recursive(DirAccess *da) {

View file

@ -84,6 +84,7 @@ public:
virtual int get_drive_count()=0;
virtual String get_drive(int p_drive)=0;
virtual int get_current_drive();
virtual Error change_dir(String p_dir)=0; ///< can be relative or absolute, return false on success
virtual String get_current_dir()=0; ///< return current dir location

View file

@ -234,11 +234,17 @@ void UndoRedo::_process_operation_list(List<Operation>::Element *E) {
ERR_FAIL_COND(!obj);
}
switch(op.type) {
case Operation::TYPE_METHOD: {
obj->call(op.name,VARIANT_ARGS_FROM_ARRAY(op.args));
obj->call(op.name,VARIANT_ARGS_FROM_ARRAY(op.args));
#ifdef TOOLS_ENABLED
Resource* res = obj->cast_to<Resource>();
if (res)
res->set_edited(true);
#endif
} break;
case Operation::TYPE_PROPERTY: {

View file

@ -3388,7 +3388,15 @@ Variant Variant::iter_get(const Variant& r_iter,bool &r_valid) const {
void Variant::interpolate(const Variant& a, const Variant& b, float c,Variant &r_dst) {
if (a.type!=b.type) {
r_dst=a;
if (a.is_num() && b.is_num()) {
//not as efficient but..
real_t va=a;
real_t vb=b;
r_dst=(1.0-c) * va + vb * c;
} else {
r_dst=a;
}
return;
}

View file

@ -4,6 +4,13 @@ name="Kinematic Collision"
main_scene="res://colworld.scn"
icon="res://icon.png"
[display]
width=800
height=600
stretch_mode="2d"
stretch_aspect="keep"
[input]
move_up=[key(Up)]

View file

@ -6,6 +6,9 @@ main_scene="res://light_shadows.scn"
[display]
stretch_mode="2d"
width=800
height=600
stretch_aspect="keep"
[rasterizer]

BIN
demos/2d/lookat/arrow.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

View file

@ -0,0 +1,4 @@
[application]
name="Look At Pointer"
main_scene="res://lookat.scn"

43
demos/2d/lookat/lookat.gd Normal file
View file

@ -0,0 +1,43 @@
extends Sprite
# member variables here, example:
# var a=2
# var b="textvar"
const MODE_DIRECT=0
const MODE_CONSTANT=1
const MODE_SMOOTH=2
const ROTATION_SPEED = 1
const SMOOTH_SPEED = 2.0
export(int,"Direct","Constant","Smooth") var mode=MODE_DIRECT
func _process(delta):
var mpos = get_viewport().get_mouse_pos()
if (mode==MODE_DIRECT):
look_at(mpos)
elif (mode==MODE_CONSTANT):
var ang = get_angle_to(mpos)
var s = sign(ang)
ang=abs(ang)
rotate( min(ang,ROTATION_SPEED*delta)*s )
elif (mode==MODE_SMOOTH):
var ang = get_angle_to(mpos)
rotate( ang*delta*SMOOTH_SPEED )
func _ready():
# Initialization here
set_process(true)
pass

BIN
demos/2d/lookat/lookat.scn Normal file

Binary file not shown.

BIN
demos/2d/motion/car.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2 KiB

View file

@ -0,0 +1,4 @@
[application]
name="Motion Test"
main_scene="res://motion.scn"

38
demos/2d/motion/motion.gd Normal file
View file

@ -0,0 +1,38 @@
extends Sprite
export var use_idle=true
# member variables here, example:
# var a=2
# var b="textvar"
const BEGIN = -113
const END = 907
const TIME = 5.0 # seconds
const SPEED = (END-BEGIN)/TIME
func _process(delta):
var ofs = get_pos()
ofs.x+=delta*SPEED
if (ofs.x>END):
ofs.x=BEGIN
set_pos(ofs)
func _fixed_process(delta):
var ofs = get_pos()
ofs.x+=delta*SPEED
if (ofs.x>END):
ofs.x=BEGIN
set_pos(ofs)
func _ready():
# Initialization here
if (use_idle):
set_process(true)
else:
set_fixed_process(true)
pass

BIN
demos/2d/motion/motion.scn Normal file

Binary file not shown.

View file

@ -2,3 +2,10 @@
name="Navigation Polygon (2D)"
main_scene="res://navigation.scn"
[display]
width=800
height=600
stretch_mode="2d"
stretch_aspect="keep"

View file

@ -2,3 +2,10 @@
name="2D Normal Mapping"
main_scene="res://normalmap.scn"
[display]
stretch_mode="2d"
width=800
height=600
stretch_aspect="ignore"

View file

@ -3,3 +3,9 @@
name="Screen-Space Shaders"
main_scene="res://screen_shaders.scn"
[display]
width=780
height=600
stretch_mode="2d"
stretch_aspect="keep"

Binary file not shown.

View file

@ -2,3 +2,10 @@
name="Glass Bubbles (Texscreen)"
main_scene="res://bubbles.scn"
[display]
width=800
height=600
stretch_mode="2d"
stretch_aspect="keep"

View file

@ -46,9 +46,8 @@ func _fixed_process(delta):
vel.x=hvel.x;
vel.z=hvel.z
var motion = vel*delta
motion=move(vel*delta)
var motion = move(vel*delta)
var on_floor = false
var original_vel = vel

Binary file not shown.

View file

@ -0,0 +1,49 @@
# Note for the reader:
#
# This demo conveniently uses the same names for actions and for the container nodes
# that hold each remapping button. This allow to get back to the button based simply
# on the name of the corresponding action, but it might not be so simple in your project.
#
# A better approach for large-scale input remapping might be to do the connections between
# buttons and wait_for_input through the code, passing as arguments both the name of the
# action and the node, e.g.:
# button.connect("pressed", self, "wait_for_input", [ button, action ])
extends Control
var player_actions = [ "move_up", "move_down", "move_left", "move_right", "jump" ]
var action # To register the action the UI is currently handling
var button # Button node corresponding to the above action
func wait_for_input(action_bind):
action = action_bind
# See note at the beginning of the script
button = get_node("bindings").get_node(action).get_node("Button")
get_node("contextual_help").set_text("Press a key to assign to the '" + action + "' action.")
set_process_input(true)
func _input(event):
# Handle the first pressed key
if (event.type == InputEvent.KEY):
# Register the event as handled and stop polling
get_tree().set_input_as_handled()
set_process_input(false)
# Reinitialise the contextual help label
get_node("contextual_help").set_text("Click a key binding to reassign it, or press the Cancel action.")
if (not event.is_action("ui_cancel")):
# Display the string corresponding to the pressed key
button.set_text(OS.get_scancode_string(event.scancode))
# Start by removing previously key binding(s)
for old_event in InputMap.get_action_list(action):
InputMap.action_erase_event(action, old_event)
# Add the new key binding
InputMap.action_add_event(action, event)
func _ready():
# Initialise each button with the default key binding from InputMap
var input_event
for action in player_actions:
# We assume that the key binding that we want is the first one (0), if there are several
input_event = InputMap.get_action_list(action)[0]
# See note at the beginning of the script
get_node("bindings").get_node(action).get_node("Button").set_text(OS.get_scancode_string(input_event.scancode))

Binary file not shown.

View file

@ -0,0 +1,18 @@
[application]
name="Input Mapping GUI"
main_scene="res://controls.scn"
icon="icon.png"
[display]
width=640
height=480
[input]
move_up=[key(Up)]
move_down=[key(Down)]
move_left=[key(Left)]
move_right=[key(Right)]
jump=[key(Space)]

View file

@ -0,0 +1,20 @@
extends Panel
# member variables here, example:
# var a=2
# var b="textvar"
func _ready():
# Initialization here
pass
func _on_back_pressed():
var s = load("res://main.scn")
var si = s.instance()
get_parent().add_child(si)
queue_free()
pass # replace with function body

Binary file not shown.

View file

@ -0,0 +1,9 @@
[application]
name="Translation Demo"
main_scene="res://main.scn"
[locale]
translations=["res://translations/text.en.xl", "res://translations/text.es.xl", "res://translations/text.ja.xl"]
translation_remaps={"res://flag_uk.png":["res://flag_spain.png:es", "res://flag_japan.png:ja"]}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

View file

@ -0,0 +1,42 @@
extends Panel
# member variables here, example:
# var a=2
# var b="textvar"
func _ready():
# Initialization here
pass
func _goto_scene():
var s = load("res://controls.scn")
var si = s.instance()
get_parent().add_child(si)
queue_free()
pass
func _on_system_pressed():
#will autodetect based on system, then fall back
#to english if not found
_goto_scene()
#NOTE: Changling locale will not change the text in the controls,
# The scene must be reloaded for changes to take effect.
func _on_english_pressed():
TranslationServer.set_locale("en")
_goto_scene()
func _on_spanish_pressed():
TranslationServer.set_locale("es")
_goto_scene()
func _on_japanese_pressed():
TranslationServer.set_locale("ja")
_goto_scene()

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -0,0 +1,3 @@
,en,es,ja
KEY_HELLO,Hello!,Hola!,こんにちは
KEY_PUSH,Push Me!,Aprétame!,私をプッシュ
1 en es ja
2 KEY_HELLO Hello! Hola! こんにちは
3 KEY_PUSH Push Me! Aprétame! 私をプッシュ

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -0,0 +1,4 @@
[application]
name="Scene Changer"
main_scene="res://scene_a.scn"

View file

@ -0,0 +1,17 @@
extends Panel
# member variables here, example:
# var a=2
# var b="textvar"
func _ready():
# Initalization here
pass
func _on_goto_scene_pressed():
get_tree().change_scene("res://scene_b.scn")
pass # replace with function body

Binary file not shown.

View file

@ -0,0 +1,17 @@
extends Panel
# member variables here, example:
# var a=2
# var b="textvar"
func _ready():
# Initalization here
pass
func _on_goto_scene_pressed():
get_tree().change_scene("res://scene_a.scn")
pass # replace with function body

Binary file not shown.

View file

@ -9655,7 +9655,7 @@
</signals>
<constants>
<constant name="MODE_OPEN_FILE" value="0">
Editor will not allow to select unexisting files.
Editor will not allow to select nonexistent files.
</constant>
<constant name="MODE_OPEN_FILES" value="1">
</constant>

View file

@ -15,7 +15,7 @@
********************************************************************/
/**\mainpage
/**\file
*
* \section intro Introduction
*

BIN
logo_small.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2 KiB

View file

@ -1248,7 +1248,8 @@ bool Main::start() {
ERR_EXPLAIN("Failed loading scene: "+local_game_path);
ERR_FAIL_COND_V(!scene,false)
sml->get_root()->add_child(scene);
//sml->get_root()->add_child(scene);
sml->add_current_scene(scene);
String iconpath = GLOBAL_DEF("application/icon","Variant()""");
if (iconpath!="") {

View file

@ -140,7 +140,7 @@ String GDFunction::_get_call_error(const Variant::CallError& p_err, const String
} else if (p_err.error==Variant::CallError::CALL_ERROR_TOO_FEW_ARGUMENTS) {
err_text="Invalid call to "+p_where+". Expected "+itos(p_err.argument)+" arguments.";
} else if (p_err.error==Variant::CallError::CALL_ERROR_INVALID_METHOD) {
err_text="Invalid call. Unexisting "+p_where+".";
err_text="Invalid call. Nonexistent "+p_where+".";
} else if (p_err.error==Variant::CallError::CALL_ERROR_INSTANCE_IS_NULL) {
err_text="Attempt to call "+p_where+" on a null instance.";
} else {
@ -335,17 +335,30 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a
GET_VARIANT_PTR(b,3);
GET_VARIANT_PTR(dst,4);
#ifdef DEBUG_ENABLED
Variant ret;
Variant::evaluate(op,*a,*b,ret,valid);
#else
Variant::evaluate(op,*a,*b,*dst,valid);
#endif
if (!valid) {
if (dst->get_type()==Variant::STRING) {
#ifdef DEBUG_ENABLED
if (ret.get_type()==Variant::STRING) {
//return a string when invalid with the error
err_text=*dst;
err_text=ret;
err_text += " in operator '"+Variant::get_operator_name(op)+"'.";
} else {
err_text="Invalid operands '"+Variant::get_type_name(a->get_type())+"' and '"+Variant::get_type_name(b->get_type())+"' in operator '"+Variant::get_operator_name(op)+"'.";
}
#endif
break;
}
#ifdef DEBUG_ENABLED
*dst=ret;
#endif
ip+=5;
@ -457,8 +470,13 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a
GET_VARIANT_PTR(dst,3);
bool valid;
#ifdef DEBUG_ENABLED
//allow better error message in cases where src and dst are the same stack position
Variant ret = src->get(*index,&valid);
#else
*dst = src->get(*index,&valid);
#endif
if (!valid) {
String v = index->operator String();
if (v!="") {
@ -469,6 +487,9 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a
err_text="Invalid get index "+v+" (on base: '"+_get_var_type(src)+"').";
break;
}
#ifdef DEBUG_ENABLED
*dst=ret;
#endif
ip+=4;
} continue;
case OPCODE_SET_NAMED: {
@ -508,7 +529,13 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a
const StringName *index = &_global_names_ptr[indexname];
bool valid;
#ifdef DEBUG_ENABLED
//allow better error message in cases where src and dst are the same stack position
Variant ret = src->get_named(*index,&valid);
#else
*dst = src->get_named(*index,&valid);
#endif
if (!valid) {
if (src->has_method(*index)) {
@ -518,7 +545,9 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a
}
break;
}
#ifdef DEBUG_ENABLED
*dst=ret;
#endif
ip+=4;
} continue;
case OPCODE_ASSIGN: {

View file

@ -747,7 +747,8 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
//}
} break;
case MotionEvent.ACTION_POINTER_UP: {
int pointer_idx = event.getActionIndex();
final int indexPointUp = event.getAction() >> MotionEvent.ACTION_POINTER_INDEX_SHIFT;
final int pointer_idx = event.getPointerId(indexPointUp);
GodotLib.touch(4,pointer_idx,evcount,arr);
//System.out.printf("%d - s.up at: %f,%f\n",pointer_idx, event.getX(pointer_idx),event.getY(pointer_idx));
} break;

View file

@ -437,6 +437,7 @@ public:
}
int ac = E->get().argtypes.size();
if (ac<p_argcount) {
@ -455,7 +456,6 @@ public:
}
for(int i=0;i<p_argcount;i++) {
if (!Variant::can_convert(p_args[i]->get_type(),E->get().argtypes[i])) {
@ -476,6 +476,10 @@ public:
JNIEnv *env = ThreadAndroid::get_env();
int res = env->PushLocalFrame(16);
ERR_FAIL_COND_V(res!=0,Variant());
//print_line("argcount "+String::num(p_argcount));
List<jobject> to_erase;
for(int i=0;i<p_argcount;i++) {
@ -568,6 +572,7 @@ public:
print_line("failure..");
env->PopLocalFrame(NULL);
ERR_FAIL_V(Variant());
} break;
}
@ -576,6 +581,8 @@ public:
env->DeleteLocalRef(to_erase.front()->get());
to_erase.pop_front();
}
env->PopLocalFrame(NULL);
//print_line("success");
return ret;
@ -1613,11 +1620,15 @@ JNIEXPORT void JNICALL Java_com_android_godot_GodotLib_method(JNIEnv * env, jobj
JNIEXPORT void JNICALL Java_com_android_godot_GodotLib_callobject(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 res = env->PushLocalFrame(16);
ERR_FAIL_COND(res!=0);
String str_method = env->GetStringUTFChars( method, NULL );
int count = env->GetArrayLength(params);
Variant* vlist = (Variant*)alloca(sizeof(Variant) * count);
Variant** vptr = (Variant**)alloca(sizeof(Variant*) * count);
@ -1637,15 +1648,22 @@ JNIEXPORT void JNICALL Java_com_android_godot_GodotLib_callobject(JNIEnv * env,
Variant::CallError err;
obj->call(str_method, (const Variant**)vptr, count, err);
// something
env->PopLocalFrame(NULL);
};
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 res = env->PushLocalFrame(16);
ERR_FAIL_COND(res!=0);
String str_method = env->GetStringUTFChars( method, NULL );
int count = env->GetArrayLength(params);
Variant args[VARIANT_ARG_MAX];
@ -1666,6 +1684,8 @@ JNIEXPORT void JNICALL Java_com_android_godot_GodotLib_calldeferred(JNIEnv * env
obj->call_deferred(str_method, args[0],args[1],args[2],args[3],args[4]);
// something
env->PopLocalFrame(NULL);
};
//Main::cleanup();

View file

@ -135,7 +135,12 @@ int widechar_main(int argc, wchar_t** argv) {
argv_utf8[i] = wc_to_utf8(argv[i]);
}
Main::setup(argv_utf8[0], argc - 1, &argv_utf8[1]);
Error err = Main::setup(argv_utf8[0], argc - 1, &argv_utf8[1]);
if (err!=OK)
return 255;
if (Main::start())
os.run();
Main::cleanup();

View file

@ -288,6 +288,7 @@ void CanvasItem::show() {
if (is_visible()) {
_propagate_visibility_changed(true);
}
_change_notify("visibility/visible");
}
@ -305,6 +306,7 @@ void CanvasItem::hide() {
if (propagate)
_propagate_visibility_changed(false);
_change_notify("visibility/visible");
}

View file

@ -346,6 +346,17 @@ Matrix32 Node2D::get_relative_transform(const Node *p_parent) const {
return parent_2d->get_relative_transform(p_parent) * get_transform();
}
void Node2D::look_at(const Vector2& p_pos) {
rotate(get_angle_to(p_pos));
}
float Node2D::get_angle_to(const Vector2& p_pos) const {
return (get_global_transform().affine_inverse().xform(p_pos)).atan2();
}
void Node2D::_bind_methods() {
@ -374,6 +385,9 @@ void Node2D::_bind_methods() {
ObjectTypeDB::bind_method(_MD("set_transform","xform"),&Node2D::set_transform);
ObjectTypeDB::bind_method(_MD("set_global_transform","xform"),&Node2D::set_global_transform);
ObjectTypeDB::bind_method(_MD("look_at","point"),&Node2D::look_at);
ObjectTypeDB::bind_method(_MD("get_angle_to","point"),&Node2D::get_angle_to);
ObjectTypeDB::bind_method(_MD("set_z","z"),&Node2D::set_z);
ObjectTypeDB::bind_method(_MD("get_z"),&Node2D::get_z);

View file

@ -93,6 +93,9 @@ public:
void set_z(int p_z);
int get_z() const;
void look_at(const Vector2& p_pos);
float get_angle_to(const Vector2& p_pos) const;
void set_z_as_relative(bool p_enabled);
bool is_z_relative() const;

View file

@ -295,7 +295,7 @@ void AnimationPlayer::_generate_node_caches(AnimationData* p_anim) {
p_anim->node_cache[i]->bone_idx=p_anim->node_cache[i]->skeleton->find_bone(bone_name);
if (p_anim->node_cache[i]->bone_idx<0) {
// broken track (unexisting bone)
// broken track (nonexistent bone)
p_anim->node_cache[i]->skeleton=NULL;
p_anim->node_cache[i]->spatial=NULL;
printf("bone is %ls\n", String(bone_name).c_str());

View file

@ -608,18 +608,12 @@ void FileDialog::_update_drives() {
drives->clear();
drives->show();
int current=-1;
String abspath = dir_access->get_current_dir();
for(int i=0;i<dir_access->get_drive_count();i++) {
String d = dir_access->get_drive(i);
if (abspath.begins_with(d))
current=i;
String d = dir_access->get_drive(i);
drives->add_item(dir_access->get_drive(i));
}
if (current!=-1)
drives->select(current);
drives->select(dir_access->get_current_drive());
}
}

View file

@ -378,7 +378,11 @@ void Label::regenerate_word_cache() {
if (uppercase)
current=String::char_uppercase(current);
bool not_latin = current>=33 && (current < 65||current >90) && (current<97||current>122) && (current<48||current>57);
// ranges taken from http://www.unicodemap.org/
// if your language is not well supported, consider helping improve
// the unicode support in Godot.
bool separatable = (current>=0x2E08 && current<=0xFAFF) || (current>=0xFE30 && current<=0xFE4F);
//current>=33 && (current < 65||current >90) && (current<97||current>122) && (current<48||current>57);
bool insert_newline=false;
int char_width;
@ -433,8 +437,8 @@ void Label::regenerate_word_cache() {
}
if ((autowrap && (line_width >= width) && ((last && last->char_pos >= 0) || not_latin)) || insert_newline) {
if (not_latin) {
if ((autowrap && (line_width >= width) && ((last && last->char_pos >= 0) || separatable)) || insert_newline) {
if (separatable) {
if (current_word_size>0) {
WordCache *wc = memnew( WordCache );
if (word_cache) {

View file

@ -1673,6 +1673,8 @@ void RichTextLabel::_bind_methods() {
ObjectTypeDB::bind_method(_MD("set_scroll_follow","follow"),&RichTextLabel::set_scroll_follow);
ObjectTypeDB::bind_method(_MD("is_scroll_following"),&RichTextLabel::is_scroll_following);
ObjectTypeDB::bind_method(_MD("get_v_scroll"),&RichTextLabel::get_v_scroll);
ObjectTypeDB::bind_method(_MD("set_tab_size","spaces"),&RichTextLabel::set_tab_size);
ObjectTypeDB::bind_method(_MD("get_tab_size"),&RichTextLabel::get_tab_size);

View file

@ -1893,7 +1893,7 @@ void TextEdit::_input_event(const InputEvent& p_input_event) {
selection.from_line=0;
selection.from_column=0;
selection.to_line=text.size()-1;
selection.to_column=text[selection.to_line].size();
selection.to_column=text[selection.to_line].length();
selection.selecting_mode=Selection::MODE_NONE;
update();
@ -2778,6 +2778,11 @@ void TextEdit::copy() {
if (!selection.active)
return;
print_line("from line: "+itos(selection.from_line));
print_line("from column: "+itos(selection.from_column));
print_line("to line: "+itos(selection.to_line));
print_line("to column: "+itos(selection.to_column));
String clipboard = _base_get_text(selection.from_line,selection.from_column,selection.to_line,selection.to_column);
OS::get_singleton()->set_clipboard(clipboard);
@ -2809,7 +2814,7 @@ void TextEdit::select_all() {
selection.from_line=0;
selection.from_column=0;
selection.to_line=text.size()-1;
selection.to_column=text[selection.to_line].size();
selection.to_column=text[selection.to_line].length();
selection.selecting_mode=Selection::MODE_NONE;
update();

View file

@ -146,9 +146,13 @@ RES ResourceFormatLoaderWAV::load(const String &p_path,const String& p_original_
}
int frames=chunksize;
frames/=format_channels;
frames/=(format_bits>>3);
print_line("chunksize: "+itos(chunksize));
print_line("channels: "+itos(format_channels));
print_line("bits: "+itos(format_bits));
sample->create(
(format_bits==8) ? Sample::FORMAT_PCM8 : Sample::FORMAT_PCM16,
@ -156,8 +160,14 @@ RES ResourceFormatLoaderWAV::load(const String &p_path,const String& p_original_
frames );
sample->set_mix_rate( format_freq );
int len=frames;
if (format_channels==2)
len*=2;
if (format_bits>8)
len*=2;
DVector<uint8_t> data;
data.resize(chunksize);
data.resize(len);
DVector<uint8_t>::Write dataw = data.write();
void * data_ptr = dataw.ptr();

View file

@ -41,7 +41,7 @@
#include "scene/scene_string_names.h"
#include "io/resource_loader.h"
#include "viewport.h"
#include "scene/resources/packed_scene.h"
void SceneTree::tree_changed() {
@ -51,6 +51,9 @@ void SceneTree::tree_changed() {
void SceneTree::node_removed(Node *p_node) {
if (current_scene==p_node) {
current_scene=NULL;
}
emit_signal(node_removed_name,p_node);
if (call_lock>0)
call_skip.insert(p_node);
@ -984,6 +987,63 @@ Node *SceneTree::get_edited_scene_root() const {
}
#endif
void SceneTree::set_current_scene(Node* p_scene) {
ERR_FAIL_COND(p_scene && p_scene->get_parent()!=root);
current_scene=p_scene;
}
Node* SceneTree::get_current_scene() const{
return current_scene;
}
void SceneTree::_change_scene(Node* p_to) {
if (current_scene) {
memdelete( current_scene );
current_scene=NULL;
}
if (p_to) {
current_scene=p_to;
root->add_child(p_to);
}
}
Error SceneTree::change_scene(const String& p_path){
Ref<PackedScene> new_scene = ResourceLoader::load(p_path);
if (new_scene.is_null())
return ERR_CANT_OPEN;
return change_scene_to(new_scene);
}
Error SceneTree::change_scene_to(const Ref<PackedScene>& p_scene){
Node *new_scene=NULL;
if (p_scene.is_valid()) {
new_scene = p_scene->instance();
ERR_FAIL_COND_V(!new_scene,ERR_CANT_CREATE);
}
call_deferred("_change_scene",new_scene);
return OK;
}
Error SceneTree::reload_current_scene() {
ERR_FAIL_COND_V(!current_scene,ERR_UNCONFIGURED);
String fname = current_scene->get_filename();
return change_scene(fname);
}
void SceneTree::add_current_scene(Node * p_current) {
current_scene=p_current;
root->add_child(p_current);
}
void SceneTree::_bind_methods() {
@ -1016,10 +1076,11 @@ void SceneTree::_bind_methods() {
ObjectTypeDB::bind_method(_MD("set_screen_stretch","mode","aspect","minsize"),&SceneTree::set_screen_stretch);
ObjectTypeDB::bind_method(_MD("queue_delete","obj"),&SceneTree::queue_delete);
MethodInfo mi;
mi.name="call_group";
mi.arguments.push_back( PropertyInfo( Variant::INT, "flags"));
@ -1033,6 +1094,16 @@ void SceneTree::_bind_methods() {
ObjectTypeDB::bind_native_method(METHOD_FLAGS_DEFAULT,"call_group",&SceneTree::_call_group,mi,defargs);
ObjectTypeDB::bind_method(_MD("set_current_scene","child_node:Node"),&SceneTree::set_current_scene);
ObjectTypeDB::bind_method(_MD("get_current_scene:Node"),&SceneTree::get_current_scene);
ObjectTypeDB::bind_method(_MD("change_scene","path"),&SceneTree::change_scene);
ObjectTypeDB::bind_method(_MD("change_scene_to","packed_scene:PackedScene"),&SceneTree::change_scene_to);
ObjectTypeDB::bind_method(_MD("reload_current_scene"),&SceneTree::reload_current_scene);
ObjectTypeDB::bind_method(_MD("_change_scene"),&SceneTree::_change_scene);
ADD_SIGNAL( MethodInfo("tree_changed") );
ADD_SIGNAL( MethodInfo("node_removed",PropertyInfo( Variant::OBJECT, "node") ) );
ADD_SIGNAL( MethodInfo("screen_resized") );
@ -1077,6 +1148,7 @@ SceneTree::SceneTree() {
//root->set_world_2d( Ref<World2D>( memnew( World2D )));
root->set_as_audio_listener(true);
root->set_as_audio_listener_2d(true);
current_scene=NULL;
stretch_mode=STRETCH_MODE_DISABLED;
stretch_aspect=STRETCH_ASPECT_IGNORE;

View file

@ -42,7 +42,7 @@
class SceneTree;
class PackedScene;
class Node;
class Viewport;
@ -136,7 +136,9 @@ private:
Array _get_nodes_in_group(const StringName& p_group);
Node *current_scene;
void _change_scene(Node* p_to);
//void _call_group(uint32_t p_call_flags,const StringName& p_group,const StringName& p_function,const Variant& p_arg1,const Variant& p_arg2);
friend class Node;
@ -234,6 +236,17 @@ public:
Node *get_edited_scene_root() const;
#endif
void set_current_scene(Node* p_scene);
Node* get_current_scene() const;
Error change_scene(const String& p_path);
Error change_scene_to(const Ref<PackedScene>& p_scene);
Error reload_current_scene();
//used by Main::start, don't use otherwise
void add_current_scene(Node * p_current);
SceneTree();
~SceneTree();

View file

@ -1177,6 +1177,11 @@ void Viewport::_vp_unhandled_input(const InputEvent& p_ev) {
}
Vector2 Viewport::get_mouse_pos() const {
return (get_final_transform().affine_inverse() * _get_input_pre_xform()).xform(Input::get_singleton()->get_mouse_pos());
}
void Viewport::warp_mouse(const Vector2& p_pos) {
Vector2 gpos = (get_final_transform().affine_inverse() * _get_input_pre_xform()).affine_inverse().xform(p_pos);
@ -1377,6 +1382,7 @@ void Viewport::_bind_methods() {
ObjectTypeDB::bind_method(_MD("is_audio_listener_2d","enable"), &Viewport::is_audio_listener_2d);
ObjectTypeDB::bind_method(_MD("set_render_target_to_screen_rect"), &Viewport::set_render_target_to_screen_rect);
ObjectTypeDB::bind_method(_MD("get_mouse_pos"), &Viewport::get_mouse_pos);
ObjectTypeDB::bind_method(_MD("warp_mouse","to_pos"), &Viewport::warp_mouse);
ADD_PROPERTY( PropertyInfo(Variant::RECT2,"rect"), _SCS("set_rect"), _SCS("get_rect") );

View file

@ -252,6 +252,7 @@ public:
void set_render_target_to_screen_rect(const Rect2& p_rect);
Rect2 get_render_target_to_screen_rect() const;
Vector2 get_mouse_pos() const;
void warp_mouse(const Vector2& p_pos);
void set_physics_object_picking(bool p_enable);

View file

@ -1301,7 +1301,7 @@ const ShaderGraph::InOutParamInfo ShaderGraph::inout_param_info[]={
{MODE_MATERIAL,SHADER_TYPE_FRAGMENT,"Diffuse","DIFFUSE_OUT","",SLOT_TYPE_VEC,SLOT_OUT},
{MODE_MATERIAL,SHADER_TYPE_FRAGMENT,"DiffuseAlpha","ALPHA_OUT","",SLOT_TYPE_SCALAR,SLOT_OUT},
{MODE_MATERIAL,SHADER_TYPE_FRAGMENT,"Specular","SPECULAR","",SLOT_TYPE_VEC,SLOT_OUT},
{MODE_MATERIAL,SHADER_TYPE_FRAGMENT,"SpecularExp","SPECULAR","",SLOT_TYPE_SCALAR,SLOT_OUT},
{MODE_MATERIAL,SHADER_TYPE_FRAGMENT,"SpecularExp","SPEC_EXP","",SLOT_TYPE_SCALAR,SLOT_OUT},
{MODE_MATERIAL,SHADER_TYPE_FRAGMENT,"Emission","EMISSION","",SLOT_TYPE_VEC,SLOT_OUT},
{MODE_MATERIAL,SHADER_TYPE_FRAGMENT,"Glow","GLOW","",SLOT_TYPE_SCALAR,SLOT_OUT},
{MODE_MATERIAL,SHADER_TYPE_FRAGMENT,"ShadeParam","SHADE_PARAM","",SLOT_TYPE_SCALAR,SLOT_OUT},

View file

@ -135,6 +135,7 @@ void SampleManagerMallocSW::sample_set_data(RID p_sample, const DVector<uint8_t>
ERR_EXPLAIN("Sample buffer size does not match sample size.");
print_line("len bytes: "+itos(s->length_bytes)+" bufsize: "+itos(buff_size));
ERR_FAIL_COND(s->length_bytes!=buff_size);
DVector<uint8_t>::Read buffer_r=p_buffer.read();
const uint8_t *src = buffer_r.ptr();

View file

@ -257,6 +257,8 @@ void BodySW::set_state(PhysicsServer::BodyState p_state, const Variant& p_varian
Transform t = p_variant;
t.orthonormalize();
new_transform=get_transform(); //used as old to compute motion
if (new_transform==t)
break;
_set_transform(t);
_set_inv_transform(get_transform().inverse());

View file

@ -201,7 +201,7 @@ public:
_FORCE_INLINE_ bool is_active() const { return active; }
_FORCE_INLINE_ void wakeup() {
if ((get_space() && active) || mode==PhysicsServer::BODY_MODE_STATIC || mode==PhysicsServer::BODY_MODE_KINEMATIC)
if ((!get_space()) || mode==PhysicsServer::BODY_MODE_STATIC || mode==PhysicsServer::BODY_MODE_KINEMATIC)
return;
set_active(true);
}

View file

@ -275,6 +275,8 @@ void Body2DSW::set_state(Physics2DServer::BodyState p_state, const Variant& p_va
Matrix32 t = p_variant;
t.orthonormalize();
new_transform=get_transform(); //used as old to compute motion
if (t==new_transform)
break;
_set_transform(t);
_set_inv_transform(get_transform().inverse());

View file

@ -203,7 +203,7 @@ public:
_FORCE_INLINE_ bool is_active() const { return active; }
_FORCE_INLINE_ void wakeup() {
if ((get_space() && active) || mode==Physics2DServer::BODY_MODE_STATIC || mode==Physics2DServer::BODY_MODE_KINEMATIC)
if ((!get_space()) || mode==Physics2DServer::BODY_MODE_STATIC || mode==Physics2DServer::BODY_MODE_KINEMATIC)
return;
set_active(true);
}

View file

@ -1714,7 +1714,7 @@ Error ShaderLanguage::parse_expression(Parser& parser,Node *p_parent,Node **r_ex
if (!existing) {
parser.set_error("Unexisting identifier in expression: "+identifier);
parser.set_error("Nonexistent identifier in expression: "+identifier);
return ERR_PARSE_ERROR;
}

View file

@ -3140,7 +3140,7 @@
<constant name="MODE_OPEN_DIR" value="1">
</constant>
<constant name="MODE_OPEN_FILE" value="0">
Editor will not allow to select unexisting files.
Editor will not allow to select nonexistent files.
</constant>
<constant name="MODE_SAVE_FILE" value="2">
Editor will warn when a file exists.

View file

@ -353,7 +353,7 @@ void EditorHelp::_search(const String&) {
String stext=search->get_text();
bool keep = prev_search==stext && class_list->get_selected() && prev_search_page==class_list->get_selected()->get_text(0);
class_desc->search(stext);
class_desc->search(stext, keep);
prev_search=stext;
if (class_list->get_selected())

View file

@ -219,7 +219,7 @@ EditorLog::EditorLog() {
log->set_selection_enabled(true);
log->set_focus_mode(FOCUS_CLICK);
pc->add_child(log);
add_message(VERSION_FULL_NAME" (c) 2008-2014 Juan Linietsky, Ariel Manzur.");
add_message(VERSION_FULL_NAME" (c) 2008-2015 Juan Linietsky, Ariel Manzur.");
//log->add_text("Initialization Complete.\n"); //because it looks cool.
add_style_override("panel",get_stylebox("panelf","Panel"));

View file

@ -610,7 +610,42 @@ static Error _fix_imported_scene_paths(Node* node, Node* root, String save_path)
};
bool EditorNode::_find_and_save_edited_subresources(Object *obj,Set<RES>& processed,int32_t flags) {
bool EditorNode::_find_and_save_resource(RES res,Map<RES,bool>& processed,int32_t flags) {
if (res.is_null())
return false;
if (processed.has(res)) {
return processed[res];
}
bool changed = res->is_edited();
res->set_edited(false);
bool subchanged = _find_and_save_edited_subresources(res.ptr(),processed,flags);
// print_line("checking if edited: "+res->get_type()+" :: "+res->get_name()+" :: "+res->get_path()+" :: "+itos(changed)+" :: SR "+itos(subchanged));
if (res->get_path().is_resource_file()) {
if (changed || subchanged) {
//save
print_line("Also saving modified external resource: "+res->get_path());
Error err = ResourceSaver::save(res->get_path(),res,flags);
}
processed[res]=false; //because it's a file
return false;
} else {
processed[res]=changed;
return changed;
}
}
bool EditorNode::_find_and_save_edited_subresources(Object *obj,Map<RES,bool>& processed,int32_t flags) {
bool ret_changed=false;
List<PropertyInfo> pi;
@ -620,57 +655,45 @@ bool EditorNode::_find_and_save_edited_subresources(Object *obj,Set<RES>& proces
if (!(E->get().usage&PROPERTY_USAGE_STORAGE))
continue;
switch(E->get().type) {
case Variant::OBJECT: {
RES res = obj->get(E->get().name);
if (res.is_null() || processed.has(res))
break;
processed.insert(res);
bool changed = res->is_edited();
res->set_edited(false);
bool subchanged = _find_and_save_edited_subresources(res.ptr(),processed,flags);
if (res->get_path().is_resource_file()) {
if (changed || subchanged) {
//save
print_line("Also saving modified external resource: "+res->get_path());
Error err = ResourceSaver::save(res->get_path(),res,flags);
}
} else {
if (_find_and_save_resource(res,processed,flags))
ret_changed=true;
}
} break;
case Variant::ARRAY: {
/*Array varray=p_variant;
Array varray= obj->get(E->get().name);
int len=varray.size();
for(int i=0;i<len;i++) {
Variant v=varray.get(i);
_find_resources(v);
}*/
RES res=v;
if (_find_and_save_resource(res,processed,flags))
ret_changed=true;
//_find_resources(v);
}
} break;
case Variant::DICTIONARY: {
/*
Dictionary d=p_variant;
Dictionary d=obj->get(E->get().name);;
List<Variant> keys;
d.get_key_list(&keys);
for(List<Variant>::Element *E=keys.front();E;E=E->next()) {
Variant v = d[E->get()];
_find_resources(v);
} */
RES res=v;
if (_find_and_save_resource(res,processed,flags))
ret_changed=true;
}
} break;
default: {}
}
@ -681,7 +704,7 @@ bool EditorNode::_find_and_save_edited_subresources(Object *obj,Set<RES>& proces
}
void EditorNode::_save_edited_subresources(Node* scene,Set<RES>& processed,int32_t flags) {
void EditorNode::_save_edited_subresources(Node* scene,Map<RES,bool>& processed,int32_t flags) {
_find_and_save_edited_subresources(scene,processed,flags);
@ -741,7 +764,7 @@ void EditorNode::_save_scene(String p_file) {
err = ResourceSaver::save(p_file,sdata,flg);
Set<RES> processed;
Map<RES,bool> processed;
_save_edited_subresources(scene,processed,flg);
editor_data.save_editor_external_data();
if (err==OK) {
@ -2122,7 +2145,7 @@ void EditorNode::_menu_option_confirm(int p_option,bool p_confirmed) {
}
editor_data.get_undo_redo().clear_history();
if (editor_plugin_screen) { //reload editor plugin
if (editor_plugin_over) { //reload editor plugin
editor_plugin_over->edit(NULL);
editor_plugin_over->edit(current);
}
@ -2518,7 +2541,7 @@ Error EditorNode::save_translatable_strings(const String& p_to_file) {
OS::Time time = OS::get_singleton()->get_time();
f->store_line("# Translation Strings Dump.");
f->store_line("# Created By.");
f->store_line("# \t"VERSION_FULL_NAME" (c) 2008-2014 Juan Linietsky, Ariel Manzur.");
f->store_line("# \t"VERSION_FULL_NAME" (c) 2008-2015 Juan Linietsky, Ariel Manzur.");
f->store_line("# From Scene: ");
f->store_line("# \t"+get_edited_scene()->get_filename());
f->store_line("");
@ -2633,7 +2656,7 @@ Error EditorNode::save_optimized_copy(const String& p_scene,const String& p_pres
}
}
ERR_EXPLAIN("Preset '"+p_preset+"' references unexisting saver: "+type);
ERR_EXPLAIN("Preset '"+p_preset+"' references nonexistent saver: "+type);
ERR_FAIL_COND_V(saver.is_null(),ERR_INVALID_DATA);
List<Variant> keys;
@ -3984,7 +4007,7 @@ EditorNode::EditorNode() {
about->get_ok()->set_text("Thanks!");
about->set_hide_on_ok(true);
Label *about_text = memnew( Label );
about_text->set_text(VERSION_FULL_NAME"\n(c) 2008-2014 Juan Linietsky, Ariel Manzur.\n");
about_text->set_text(VERSION_FULL_NAME"\n(c) 2008-2015 Juan Linietsky, Ariel Manzur.\n");
about_text->set_pos(Point2(gui_base->get_icon("Logo","EditorIcons")->get_size().width+30,20));
gui_base->add_child(about);
about->add_child(about_text);

View file

@ -390,8 +390,9 @@ class EditorNode : public Node {
void _cleanup_scene();
bool _find_and_save_edited_subresources(Object *obj,Set<RES>& processed,int32_t flags);
void _save_edited_subresources(Node* scene,Set<RES>& processed,int32_t flags);
bool _find_and_save_resource(RES p_res,Map<RES,bool>& processed,int32_t flags);
bool _find_and_save_edited_subresources(Object *obj,Map<RES,bool>& processed,int32_t flags);
void _save_edited_subresources(Node* scene,Map<RES,bool>& processed,int32_t flags);
struct ExportDefer {

View file

@ -264,6 +264,7 @@ void EditorSettings::create() {
singleton = Ref<EditorSettings>( memnew( EditorSettings ) );
singleton->config_file_path=config_file_path;
singleton->settings_path=config_path+"/"+config_dir;
singleton->_load_defaults();
singleton->scan_plugins();

View file

@ -610,6 +610,7 @@ Error EditorSampleImportPlugin::import(const String& p_path, const Ref<ResourceI
dst_format=Sample::FORMAT_IMA_ADPCM;
_compress_ima_adpcm(data,dst_data);
print_line("compressing ima-adpcm, resulting buffersize is "+itos(dst_data.size())+" from "+itos(data.size()));
} else {
@ -755,10 +756,10 @@ void EditorSampleImportPlugin::_compress_ima_adpcm(const Vector<float>& p_data,D
prev+=vpdiff ;
if (prev > 32767) {
printf("%i,xms %i, prev %i,diff %i, vpdiff %i, clip up %i\n",i,xm_sample,prev,diff,vpdiff,prev);
//printf("%i,xms %i, prev %i,diff %i, vpdiff %i, clip up %i\n",i,xm_sample,prev,diff,vpdiff,prev);
prev=32767;
} else if (prev < -32768) {
printf("%i,xms %i, prev %i,diff %i, vpdiff %i, clip down %i\n",i,xm_sample,prev,diff,vpdiff,prev);
//printf("%i,xms %i, prev %i,diff %i, vpdiff %i, clip down %i\n",i,xm_sample,prev,diff,vpdiff,prev);
prev = -32768 ;
}

View file

@ -2638,8 +2638,11 @@ void EditorSceneImportPlugin::_filter_tracks(Node *scene, const String& p_text)
for(Set<String>::Element *F=keep_local.front();F;F=F->next()) {
keep.insert(F->get());
}
print_line("FILTERING ANIM: "+String(E->get()));
_filter_anim_tracks(anim->get_animation(name),keep);
} else {
print_line("NOT FILTERING ANIM: "+String(E->get()));
}
}

View file

@ -706,25 +706,31 @@ void ScriptEditor::_menu_option(int p_option) {
} break;
case EDIT_UNDO: {
current->get_text_edit()->undo();
current->get_text_edit()->call_deferred("grab_focus");
} break;
case EDIT_REDO: {
current->get_text_edit()->redo();
current->get_text_edit()->call_deferred("grab_focus");
} break;
case EDIT_CUT: {
current->get_text_edit()->cut();
current->get_text_edit()->call_deferred("grab_focus");
} break;
case EDIT_COPY: {
current->get_text_edit()->copy();
current->get_text_edit()->call_deferred("grab_focus");
} break;
case EDIT_PASTE: {
current->get_text_edit()->paste();
current->get_text_edit()->call_deferred("grab_focus");
} break;
case EDIT_SELECT_ALL: {
current->get_text_edit()->select_all();
current->get_text_edit()->call_deferred("grab_focus");
} break;
case EDIT_MOVE_LINE_UP: {

View file

@ -479,6 +479,11 @@ Error ProjectExportDialog::export_platform(const String& p_platform, const Strin
if (err!=OK) {
error->set_text("Error exporting project!");
error->popup_centered_minsize();
ERR_PRINT("Exporting failed!");
if (p_quit_after) {
OS::get_singleton()->set_exit_code(255);
get_tree()->quit();
}
return ERR_CANT_CREATE;
} else {
if (p_quit_after) {
@ -1648,7 +1653,7 @@ Error ProjectExport::export_project(const String& p_preset) {
if (saver.is_null()) {
memdelete(d);
ERR_EXPLAIN("Preset '"+preset+"' references unexisting saver: "+type);
ERR_EXPLAIN("Preset '"+preset+"' references nonexistent saver: "+type);
ERR_FAIL_COND_V(saver.is_null(),ERR_INVALID_DATA);
}

View file

@ -916,8 +916,8 @@ void ProjectSettings::_translation_res_option_changed() {
ERR_FAIL_COND(!remaps.has(key));
StringArray r = remaps[key];
ERR_FAIL_INDEX(idx,remaps.size());
StringArray r = remaps[key];
ERR_FAIL_INDEX(idx,r.size());
r.set(idx,path+":"+langs[which]);
remaps[key]=r;
@ -1095,6 +1095,7 @@ void ProjectSettings::_update_translations() {
t2->set_editable(1,true);
t2->set_metadata(1,path);
int idx = langs.find(locale);
print_line("find "+locale+" at "+itos(idx));
if (idx<0)
idx=0;

View file

@ -2,6 +2,6 @@ short_name="godot"
name="Godot Engine"
major=1
minor=1
status="rc2"
status="rc3"