Merge branch 'master' of https://github.com/okamstudio/godot into add_sprintf

Conflicts:
	.gitignore
This commit is contained in:
Bil Bas (Spooner) 2015-02-10 00:42:28 +00:00
commit 58d7678947
19 changed files with 535 additions and 141 deletions

1
.gitignore vendored
View File

@ -19,6 +19,7 @@ tools/editor/register_exporters.cpp
tools/editor/doc_data_compressed.h
tools/editor/editor_icons.cpp
-fpic
.fscache
log.txt
# Android specific

View File

@ -1,33 +0,0 @@
::res://::1412302385
WWT-01.png::ImageTexture::1412126473::
WWT-02.png::ImageTexture::1412126474::
WWT-03.png::ImageTexture::1412126474::
WWT-04.png::ImageTexture::1412126474::
WWT-05.png::ImageTexture::1412126474::
WWT-06.png::ImageTexture::1412126474::
WWT-07.png::ImageTexture::1412126474::
WWT-08.png::ImageTexture::1412126474::
WWT-09.png::ImageTexture::1412126474::
WWT-10.png::ImageTexture::1412126474::
WWT-11.png::ImageTexture::1412126475::
WWT-12.png::ImageTexture::1412126475::
WWT-13.png::ImageTexture::1412126475::
WWT-14.png::ImageTexture::1412126475::
WWT-15.png::ImageTexture::1412126475::
WWT-16.png::ImageTexture::1412126475::
WWT-17.png::ImageTexture::1412126475::
WWT-18.png::ImageTexture::1412126475::
WWT-19.png::ImageTexture::1412126476::
WWT-20.png::ImageTexture::1412126476::
WWT-21.png::ImageTexture::1412126476::
WWT-22.png::ImageTexture::1412126476::
WWT-23.png::ImageTexture::1412126476::
WWT-24.png::ImageTexture::1412126476::
WWT-25.png::ImageTexture::1412126476::
WWT-26.png::ImageTexture::1412126476::
map.scn::PackedScene::1412127344::
tiles.scn::PackedScene::1412126994::
tileset.res::TileSet::1412127001::
troll.gd::GDScript::1412302377::
troll.png::ImageTexture::1412302385::
troll.scn::PackedScene::1412302380::

View File

@ -1,4 +0,0 @@
::res://::1421147952
icon.png::ImageTexture::1420046079::
new_scene_poly_with_holes.scn::PackedScene::1421147952::
polygonpathfinder.gd::GDScript::1421146502::

File diff suppressed because one or more lines are too long

View File

@ -4038,8 +4038,16 @@ void RasterizerGLES2::render_target_set_size(RID p_render_target,int p_width,int
glGenTextures(1, &rt->color);
glBindTexture(GL_TEXTURE_2D, rt->color);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, rt->width, rt->height, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
if (rt->texture_ptr->flags&VS::TEXTURE_FLAG_FILTER) {
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
} else {
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
}
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, rt->color, 0);

View File

@ -50,11 +50,16 @@
#ifdef ANDROID_ENABLED
#include "platform/android/ifaddrs_android.h"
#else
#ifdef __FreeBSD__
#include <sys/types.h>
#endif
#include <ifaddrs.h>
#endif
#include <arpa/inet.h>
#include <sys/socket.h>
#ifdef __FreeBSD__
#include <netinet/in.h>
#endif
#endif
IP_Address IP_Unix::_resolve_hostname(const String& p_hostname) {

View File

@ -44,7 +44,9 @@
#include "stream_peer_tcp_posix.h"
#include "packet_peer_udp_posix.h"
#ifdef __FreeBSD__
#include <sys/param.h>
#endif
#include <stdarg.h>
#include <sys/time.h>
#include <sys/wait.h>
@ -305,7 +307,17 @@ Error OS_Unix::execute(const String& p_path, const List<String>& p_arguments,boo
args.push_back((char*)cs[i].get_data());// shitty C cast
args.push_back(0);
#ifdef __FreeBSD__
if(p_path.find("/")) {
// exec name contains path so use it
execv(p_path.utf8().get_data(),&args[0]);
}else{
// use program name and search through PATH to find it
execvp(getprogname(),&args[0]);
}
#else
execv(p_path.utf8().get_data(),&args[0]);
#endif
// still alive? something failed..
fprintf(stderr,"**ERROR** OS_Unix::execute - Could not create child process while executing: %s\n",p_path.utf8().get_data());
abort();
@ -421,6 +433,12 @@ String OS_Unix::get_executable_path() const {
return OS::get_executable_path();
}
return b;
#elif defined(__FreeBSD__)
char resolved_path[MAXPATHLEN];
realpath(OS::get_executable_path().utf8().get_data(), resolved_path);
return String(resolved_path);
#else
ERR_PRINT("Warning, don't know how to obtain executable path on this OS! Please override this function properly.");
return OS::get_executable_path();

View File

@ -84,13 +84,11 @@ static int frame_count = 0;
switch (frame_count) {
case 0: {
int backingWidth;
int backingHeight;
glGetRenderbufferParameterivOES(GL_RENDERBUFFER_OES, GL_RENDERBUFFER_WIDTH_OES, &backingWidth);
glGetRenderbufferParameterivOES(GL_RENDERBUFFER_OES, GL_RENDERBUFFER_HEIGHT_OES, &backingHeight);
iphone_main(backingWidth, backingHeight, gargc, gargv);
int backingWidth;
int backingHeight;
glGetRenderbufferParameterivOES(GL_RENDERBUFFER_OES, GL_RENDERBUFFER_WIDTH_OES, &backingWidth);
glGetRenderbufferParameterivOES(GL_RENDERBUFFER_OES, GL_RENDERBUFFER_HEIGHT_OES, &backingHeight);
OS::VideoMode vm;
vm.fullscreen = true;
@ -198,6 +196,13 @@ static int frame_count = 0;
//glView.autoresizesSubviews = YES;
//[glView setAutoresizingMask:UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleWidth];
int backingWidth;
int backingHeight;
glGetRenderbufferParameterivOES(GL_RENDERBUFFER_OES, GL_RENDERBUFFER_WIDTH_OES, &backingWidth);
glGetRenderbufferParameterivOES(GL_RENDERBUFFER_OES, GL_RENDERBUFFER_HEIGHT_OES, &backingHeight);
iphone_main(backingWidth, backingHeight, gargc, gargv);
view_controller = [[ViewController alloc] init];
view_controller.view = glView;
window.rootViewController = view_controller;

View File

@ -22,7 +22,7 @@ def get_opts():
return [
('ISIMPLATFORM', 'name of the iphone platform', 'iPhoneSimulator'),
('ISIMPATH', 'the path to iphone toolchain', '/Applications/Xcode.app/Contents/Developer/Platforms/${ISIMPLATFORM}.platform'),
('ISIMSDK', 'path to the iphone SDK', '$ISIMPATH/Developer/SDKs/${ISIMPLATFORM}7.1.sdk'),
('ISIMSDK', 'path to the iphone SDK', '$ISIMPATH/Developer/SDKs/${ISIMPLATFORM}.sdk'),
('game_center', 'Support for game center', 'yes'),
('store_kit', 'Support for in-app store', 'yes'),
('ios_gles22_override', 'Force GLES2.0 on iOS', 'yes'),

View File

@ -593,10 +593,11 @@ LRESULT OS_Windows::WndProc(HWND hWnd,UINT uMsg, WPARAM wParam, LPARAM lParam) {
ERR_BREAK(key_event_pos >= KEY_EVENT_BUFFER_SIZE);
// Make sure we don't include modifiers for the modifier key itself.
KeyEvent ke;
ke.mod_state.shift=shift_mem;
ke.mod_state.alt=alt_mem;
ke.mod_state.control=control_mem;
ke.mod_state.shift= (wParam != VK_SHIFT) ? shift_mem : false;
ke.mod_state.alt= (! (wParam == VK_MENU && (uMsg == WM_KEYDOWN || uMsg == WM_SYSKEYDOWN))) ? alt_mem : false;
ke.mod_state.control= (wParam != VK_CONTROL) ? control_mem : false;
ke.mod_state.meta=meta_mem;
ke.uMsg=uMsg;

View File

@ -70,24 +70,23 @@ def configure(env):
else:
env["bits"]="32"
env.Append(CPPPATH=['#platform/x11'])
if (env["use_llvm"]=="yes"):
env["CC"]="clang"
env["CXX"]="clang++"
env["LD"]="clang++"
if (env["use_sanitizer"]=="yes"):
env.Append(CXXFLAGS=['-fsanitize=address','-fno-omit-frame-pointer'])
env.Append(LINKFLAGS=['-fsanitize=address'])
env.extra_suffix=".llvms"
else:
env.extra_suffix=".llvm"
if 'clang++' not in env['CXX']:
env["CC"]="clang"
env["CXX"]="clang++"
env["LD"]="clang++"
env.Append(CPPFLAGS=['-DTYPED_METHOD_BIND'])
env.extra_suffix=".llvm"
if (env["colored"]=="yes"):
if sys.stdout.isatty():
env.Append(CXXFLAGS=["-fcolor-diagnostics"])
if (env["use_sanitizer"]=="yes"):
env.Append(CXXFLAGS=['-fsanitize=address','-fno-omit-frame-pointer'])
env.Append(LINKFLAGS=['-fsanitize=address'])
env.extra_suffix+="s"
#if (env["tools"]=="no"):
# #no tools suffix
@ -141,11 +140,6 @@ def configure(env):
env.Append(LINKFLAGS=['-m64','-L/usr/lib/i686-linux-gnu'])
if (env["CXX"]=="clang++"):
env.Append(CPPFLAGS=['-DTYPED_METHOD_BIND'])
env["CC"]="clang"
env["LD"]="clang++"
import methods
env.Append( BUILDERS = { 'GLSL120' : env.Builder(action = methods.build_legacygl_headers, suffix = 'glsl.h',src_suffix = '.glsl') } )

View File

@ -604,7 +604,7 @@ Vector3 Camera::project_position(const Point2& p_point) const {
Vector2 point;
point.x = (p_point.x/viewport_size.x) * 2.0 - 1.0;
point.y = (p_point.y/viewport_size.y) * 2.0 - 1.0;
point.y = (1.0-(p_point.y/viewport_size.y)) * 2.0 - 1.0;
point*=vp_size;
Vector3 p(point.x,point.y,-near);

View File

@ -935,21 +935,21 @@ float CubeMap::get_lossy_storage_quality() const {
bool CubeMap::_set(const StringName& p_name, const Variant& p_value) {
if (p_name=="side/left")
if (p_name=="side/left") {
set_side(SIDE_LEFT,p_value);
if (p_name=="side/right")
} else if (p_name=="side/right") {
set_side(SIDE_RIGHT,p_value);
if (p_name=="side/bottom")
} else if (p_name=="side/bottom") {
set_side(SIDE_BOTTOM,p_value);
if (p_name=="side/top")
} else if (p_name=="side/top") {
set_side(SIDE_TOP,p_value);
if (p_name=="side/front")
} else if (p_name=="side/front") {
set_side(SIDE_FRONT,p_value);
if (p_name=="side/back")
} else if (p_name=="side/back") {
set_side(SIDE_BACK,p_value);
else if (p_name=="flags")
} else if (p_name=="flags") {
set_flags(p_value);
else if (p_name=="storage") {
} else if (p_name=="storage") {
storage=Storage(p_value.operator int());
} else if (p_name=="lossy_quality") {
lossy_storage_quality=p_value;
@ -962,25 +962,25 @@ bool CubeMap::_set(const StringName& p_name, const Variant& p_value) {
bool CubeMap::_get(const StringName& p_name,Variant &r_ret) const {
if (p_name=="side/left")
if (p_name=="side/left") {
r_ret=get_side(SIDE_LEFT);
if (p_name=="side/right")
} else if (p_name=="side/right") {
r_ret=get_side(SIDE_RIGHT);
if (p_name=="side/bottom")
} else if (p_name=="side/bottom") {
r_ret=get_side(SIDE_BOTTOM);
if (p_name=="side/top")
} else if (p_name=="side/top") {
r_ret=get_side(SIDE_TOP);
if (p_name=="side/front")
} else if (p_name=="side/front") {
r_ret=get_side(SIDE_FRONT);
if (p_name=="side/back")
} else if (p_name=="side/back") {
r_ret=get_side(SIDE_BACK);
else if (p_name=="flags")
} else if (p_name=="flags") {
r_ret= flags;
else if (p_name=="storage")
} else if (p_name=="storage") {
r_ret= storage;
else if (p_name=="lossy_quality")
} else if (p_name=="lossy_quality") {
r_ret= lossy_storage_quality;
else
} else
return false;
return true;

View File

@ -1967,6 +1967,25 @@ void EditorNode::_menu_option_confirm(int p_option,bool p_confirmed) {
log->add_message("REDO: "+action);
} break;
case EDIT_REVERT: {
Node *scene = get_edited_scene();
if (!scene)
break;
if (unsaved_cache && !p_confirmed) {
confirmation->get_ok()->set_text("Revert");
confirmation->set_text("This action cannot be undone. Revert anyway?");
confirmation->popup_centered(Size2(300,70));
break;
}
Error err = load_scene(scene->get_filename());
} break;
#if 0
case NODE_EXTERNAL_INSTANCE: {
@ -3469,6 +3488,8 @@ EditorNode::EditorNode() {
p->add_separator();
p->add_item("Project Settings",RUN_SETTINGS);
p->add_separator();
p->add_item("Revert Scene",EDIT_REVERT);
p->add_separator();
p->add_item("Quit to Project List",RUN_PROJECT_MANAGER,KEY_MASK_SHIFT+KEY_MASK_CMD+KEY_Q);
p->add_item("Quit",FILE_QUIT,KEY_MASK_CMD+KEY_Q);
@ -3552,7 +3573,7 @@ EditorNode::EditorNode() {
play_button->set_icon(gui_base->get_icon("MainPlay","EditorIcons"));
play_button->set_focus_mode(Control::FOCUS_NONE);
play_button->connect("pressed", this,"_menu_option",make_binds(RUN_PLAY));
play_button->set_tooltip("Start the scene (F5).");
play_button->set_tooltip("Play the project (F5).");

View File

@ -127,6 +127,7 @@ class EditorNode : public Node {
FILE_EXTERNAL_OPEN_SCENE,
EDIT_UNDO,
EDIT_REDO,
EDIT_REVERT,
RESOURCE_NEW,
RESOURCE_LOAD,
RESOURCE_SAVE,

View File

@ -631,7 +631,10 @@ bool ScriptEditor::_test_script_times_on_disk() {
if (!all_ok)
disk_changed->call_deferred("popup_centered_ratio",0.5);
if (bool(EDITOR_DEF("text_editor/auto_reload_changed_scripts",false)))
script_editor->_reload_scripts();
else
disk_changed->call_deferred("popup_centered_ratio",0.5);
return all_ok;
}
@ -1806,6 +1809,7 @@ ScriptEditorPlugin::ScriptEditorPlugin(EditorNode *p_node) {
script_editor->hide();
EDITOR_DEF("text_editor/auto_reload_changed_scripts",false);
EDITOR_DEF("external_editor/use_external_editor",false);
EDITOR_DEF("external_editor/exec_path","");
EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::STRING,"external_editor/exec_path",PROPERTY_HINT_GLOBAL_FILE));

View File

@ -79,10 +79,22 @@ Node* SceneTreeDock::instance(const String& p_file) {
//accept->get_cancel()->hide();
accept->get_ok()->set_text("Ugh");
accept->set_text(String("Error loading scene from ")+p_file);
accept->popup_centered(Size2(300,70));;
accept->popup_centered(Size2(300,70));
return NULL;
}
// If the scene hasn't been saved yet a cyclical dependency cannot exist.
if (edited_scene->get_filename()!="") {
if (_cyclical_dependency_exists(edited_scene->get_filename(), instanced_scene)) {
accept->get_ok()->set_text("Ok");
accept->set_text(String("Cannot instance the scene '")+p_file+String("' because the current scene exists within one of its' nodes."));
accept->popup_centered(Size2(300,90));
return NULL;
}
}
instanced_scene->generate_instance_state();
instanced_scene->set_filename( Globals::get_singleton()->localize_path(p_file) );
@ -100,6 +112,25 @@ Node* SceneTreeDock::instance(const String& p_file) {
}
bool SceneTreeDock::_cyclical_dependency_exists(const String& p_target_scene_path, Node* p_desired_node) {
int childCount = p_desired_node->get_child_count();
if (p_desired_node->get_filename()==p_target_scene_path) {
return true;
}
for (int i=0;i<childCount;i++) {
Node* child=p_desired_node->get_child(i);
if(_cyclical_dependency_exists(p_target_scene_path,child)) {
return true;
}
}
return false;
}
static String _get_name_num_separator() {
switch(EditorSettings::get_singleton()->get("scenetree_editor/duplicate_node_name_num_separator").operator int()) {
case 0: return "";

View File

@ -102,6 +102,7 @@ class SceneTreeDock : public VBoxContainer {
void _load_request(const String& p_path);
void _script_open_request(const Ref<Script>& p_script);
bool _cyclical_dependency_exists(const String& p_target_scene_path, Node* p_desired_node);
void _node_selected();
void _node_renamed();

View File

@ -212,8 +212,8 @@ class DaeExporter:
imgid = self.new_id("image")
if (not os.path.isfile(imgpath)):
if img_tmp_path.endswith((".bmp",".rgb",".png",".jpeg",".jpg",".jp2",".tga",".cin",".dpx",".exr",".hdr",".tif")):
imgpath="images/"+os.path.basename(img_tmp_path)
if imgpath.endswith((".bmp",".rgb",".png",".jpeg",".jpg",".jp2",".tga",".cin",".dpx",".exr",".hdr",".tif")):
imgpath="images/"+os.path.basename(imgpath)
else:
imgpath="images/"+image.name+".png"