summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2015-04-18 16:18:59 -0300
committerJuan Linietsky <reduzio@gmail.com>2015-04-18 16:18:59 -0300
commit170a9349d2f1b07d4562ac0992a0da59b9a28088 (patch)
tree73a20a151c5f79d96cad84e9b644f74a1f29a2b1
parent4661a6e126f03efcb7b41196d2fca9c9564123c6 (diff)
parentbedb4f1ab2bb9a41ea046b258f70d15f310fb114 (diff)
Merge branch 'master' of https://github.com/okamstudio/godot
-rw-r--r--modules/gdscript/gd_editor.cpp2
-rw-r--r--servers/physics/body_sw.h2
-rw-r--r--servers/physics_2d/body_2d_sw.cpp37
-rw-r--r--servers/physics_2d/body_2d_sw.h7
-rw-r--r--tools/editor/plugins/multimesh_editor_plugin.cpp17
-rw-r--r--tools/editor/plugins/multimesh_editor_plugin.h4
-rw-r--r--tools/editor/plugins/rich_text_editor_plugin.cpp14
-rw-r--r--tools/editor/plugins/rich_text_editor_plugin.h4
8 files changed, 47 insertions, 40 deletions
diff --git a/modules/gdscript/gd_editor.cpp b/modules/gdscript/gd_editor.cpp
index 9d4e62daef..f59dbd91d3 100644
--- a/modules/gdscript/gd_editor.cpp
+++ b/modules/gdscript/gd_editor.cpp
@@ -33,7 +33,7 @@
void GDScriptLanguage::get_comment_delimiters(List<String> *p_delimiters) const {
p_delimiters->push_back("#");
- p_delimiters->push_back("\"\"\"");
+ p_delimiters->push_back("\"\"\" \"\"\"");
}
void GDScriptLanguage::get_string_delimiters(List<String> *p_delimiters) const {
diff --git a/servers/physics/body_sw.h b/servers/physics/body_sw.h
index f39a1dcdb8..63dd3e6762 100644
--- a/servers/physics/body_sw.h
+++ b/servers/physics/body_sw.h
@@ -85,7 +85,7 @@ class BodySW : public CollisionObjectSW {
AreaSW *area;
_FORCE_INLINE_ bool operator==(const AreaCMP& p_cmp) const { return area->get_self() == p_cmp.area->get_self();}
- _FORCE_INLINE_ bool operator<(const AreaCMP a) const { return area->get_priority() < a.area->get_priority();}
+ _FORCE_INLINE_ bool operator<(const AreaCMP& p_cmp) const { return area->get_priority() < p_cmp.area->get_priority();}
_FORCE_INLINE_ AreaCMP() {}
_FORCE_INLINE_ AreaCMP(AreaSW *p_area) { area=p_area;}
};
diff --git a/servers/physics_2d/body_2d_sw.cpp b/servers/physics_2d/body_2d_sw.cpp
index fe45a3e640..98dabb4d3c 100644
--- a/servers/physics_2d/body_2d_sw.cpp
+++ b/servers/physics_2d/body_2d_sw.cpp
@@ -379,13 +379,12 @@ void Body2DSW::_compute_area_gravity(const Area2DSW *p_area) {
if (p_area->is_gravity_point()) {
- gravity = (p_area->get_transform().xform(p_area->get_gravity_vector()) - get_transform().get_origin()).normalized() * p_area->get_gravity();
+ gravity += (p_area->get_transform().xform(p_area->get_gravity_vector()) - get_transform().get_origin()).normalized() * p_area->get_gravity();
} else {
- gravity = p_area->get_gravity_vector() * p_area->get_gravity();
+ gravity += p_area->get_gravity_vector() * p_area->get_gravity();
}
- gravity*=gravity_scale;
}
void Body2DSW::integrate_forces(real_t p_step) {
@@ -393,32 +392,39 @@ void Body2DSW::integrate_forces(real_t p_step) {
if (mode==Physics2DServer::BODY_MODE_STATIC)
return;
- Area2DSW *current_area = get_space()->get_default_area();
- ERR_FAIL_COND(!current_area);
+ Area2DSW *def_area = get_space()->get_default_area();
+ Area2DSW *damp_area = def_area;
+ ERR_FAIL_COND(!def_area);
- int prio = current_area->get_priority();
int ac = areas.size();
+ bool replace = false;
+ gravity=Vector2(0,0);
if (ac) {
+ areas.sort();
const AreaCMP *aa = &areas[0];
- for(int i=0;i<ac;i++) {
- if (aa[i].area->get_priority() > prio) {
- current_area=aa[i].area;
- prio=current_area->get_priority();
+ damp_area = aa[ac-1].area;
+ for(int i=ac-1;i>=0;i--) {
+ _compute_area_gravity(aa[i].area);
+ if (aa[i].area->get_space_override_mode() == Physics2DServer::AREA_SPACE_OVERRIDE_REPLACE) {
+ replace = true;
+ break;
}
}
}
-
- _compute_area_gravity(current_area);
+ if( !replace ) {
+ _compute_area_gravity(def_area);
+ }
+ gravity*=gravity_scale;
if (angular_damp>=0)
area_angular_damp=angular_damp;
else
- area_angular_damp=current_area->get_angular_damp();
+ area_angular_damp=damp_area->get_angular_damp();
if (linear_damp>=0)
area_linear_damp=linear_damp;
else
- area_linear_damp=current_area->get_linear_damp();
+ area_linear_damp=damp_area->get_linear_damp();
Vector2 motion;
bool do_motion=false;
@@ -482,7 +488,8 @@ void Body2DSW::integrate_forces(real_t p_step) {
_update_shapes_with_motion(motion);
}
- current_area=NULL; // clear the area, so it is set in the next frame
+ damp_area=NULL; // clear the area, so it is set in the next frame
+ def_area=NULL; // clear the area, so it is set in the next frame
contact_count=0;
}
diff --git a/servers/physics_2d/body_2d_sw.h b/servers/physics_2d/body_2d_sw.h
index a6fc6fc97f..3b07401dd7 100644
--- a/servers/physics_2d/body_2d_sw.h
+++ b/servers/physics_2d/body_2d_sw.h
@@ -91,13 +91,14 @@ class Body2DSW : public CollisionObject2DSW {
struct AreaCMP {
Area2DSW *area;
- _FORCE_INLINE_ bool operator<(const AreaCMP& p_cmp) const { return area->get_self() < p_cmp.area->get_self() ; }
+ _FORCE_INLINE_ bool operator==(const AreaCMP& p_cmp) const { return area->get_self() == p_cmp.area->get_self();}
+ _FORCE_INLINE_ bool operator<(const AreaCMP& p_cmp) const { return area->get_priority() < p_cmp.area->get_priority();}
_FORCE_INLINE_ AreaCMP() {}
_FORCE_INLINE_ AreaCMP(Area2DSW *p_area) { area=p_area;}
};
- VSet<AreaCMP> areas;
+ Vector<AreaCMP> areas;
struct Contact {
@@ -140,7 +141,7 @@ public:
void set_force_integration_callback(ObjectID p_id, const StringName& p_method, const Variant &p_udata=Variant());
- _FORCE_INLINE_ void add_area(Area2DSW *p_area) { areas.insert(AreaCMP(p_area)); }
+ _FORCE_INLINE_ void add_area(Area2DSW *p_area) { areas.ordered_insert(AreaCMP(p_area)); }
_FORCE_INLINE_ void remove_area(Area2DSW *p_area) { areas.erase(AreaCMP(p_area)); }
_FORCE_INLINE_ void set_max_contacts_reported(int p_size) { contacts.resize(p_size); contact_count=0; if (mode==Physics2DServer::BODY_MODE_KINEMATIC && p_size) set_active(true);}
diff --git a/tools/editor/plugins/multimesh_editor_plugin.cpp b/tools/editor/plugins/multimesh_editor_plugin.cpp
index d5211a0515..d858f3b896 100644
--- a/tools/editor/plugins/multimesh_editor_plugin.cpp
+++ b/tools/editor/plugins/multimesh_editor_plugin.cpp
@@ -29,8 +29,7 @@
#include "multimesh_editor_plugin.h"
#include "scene/gui/box_container.h"
#include "scene/3d/mesh_instance.h"
-
-
+#include "spatial_editor_plugin.h"
void MultiMeshEditor::_node_removed(Node *p_node) {
@@ -299,7 +298,7 @@ void MultiMeshEditor::_menu_option(int p_option) {
void MultiMeshEditor::edit(MultiMeshInstance *p_multimesh) {
- node=p_multimesh;
+ node=p_multimesh;
}
@@ -326,7 +325,8 @@ MultiMeshEditor::MultiMeshEditor() {
options = memnew( MenuButton );
- add_child(options);
+ //add_child(options);
+ SpatialEditor::get_singleton()->add_control_to_menu_panel(options);
options->set_area_as_parent_rect();
options->set_text("MultiMesh");
@@ -341,7 +341,6 @@ MultiMeshEditor::MultiMeshEditor() {
populate_dialog->add_child(vbc);
populate_dialog->set_child_rect(vbc);
-
HBoxContainer *hbc = memnew( HBoxContainer );
surface_source = memnew( LineEdit );
@@ -435,10 +434,10 @@ bool MultiMeshEditorPlugin::handles(Object *p_object) const {
void MultiMeshEditorPlugin::make_visible(bool p_visible) {
if (p_visible) {
- multimesh_editor->show();
+ multimesh_editor->options->show();
} else {
- multimesh_editor->hide();
+ multimesh_editor->options->hide();
multimesh_editor->edit(NULL);
}
@@ -457,9 +456,7 @@ MultiMeshEditorPlugin::MultiMeshEditorPlugin(EditorNode *p_node) {
multimesh_editor->set_margin(MARGIN_TOP,0);
multimesh_editor->set_margin(MARGIN_BOTTOM,10);
-
-
- multimesh_editor->hide();
+ multimesh_editor->options->hide();
}
diff --git a/tools/editor/plugins/multimesh_editor_plugin.h b/tools/editor/plugins/multimesh_editor_plugin.h
index 4bd902874d..4f0c0d008b 100644
--- a/tools/editor/plugins/multimesh_editor_plugin.h
+++ b/tools/editor/plugins/multimesh_editor_plugin.h
@@ -42,14 +42,14 @@ class MultiMeshEditor : public Control {
OBJ_TYPE(MultiMeshEditor, Control );
+ friend class MultiMeshEditorPlugin;
AcceptDialog *err_dialog;
-
+ MenuButton * options;
MultiMeshInstance *_last_pp_node;
bool browsing_source;
Panel *panel;
- MenuButton * options;
MultiMeshInstance *node;
LineEdit *surface_source;
diff --git a/tools/editor/plugins/rich_text_editor_plugin.cpp b/tools/editor/plugins/rich_text_editor_plugin.cpp
index abc9408019..91eb0a7880 100644
--- a/tools/editor/plugins/rich_text_editor_plugin.cpp
+++ b/tools/editor/plugins/rich_text_editor_plugin.cpp
@@ -28,6 +28,8 @@
/*************************************************************************/
#include "rich_text_editor_plugin.h"
#include "os/file_access.h"
+#include "canvas_item_editor_plugin.h"
+
void RichTextEditor::_notification(int p_what) {
switch(p_what) {
@@ -100,7 +102,8 @@ void RichTextEditor::edit(Node *p_rich_text) {
RichTextEditor::RichTextEditor() {
options = memnew( MenuButton );
- add_child(options);
+ //add_child(options);
+ CanvasItemEditor::get_singleton()->add_control_to_menu_panel(options);
options->set_area_as_parent_rect();
options->set_text("RichText");
@@ -129,10 +132,10 @@ bool RichTextEditorPlugin::handles(Object *p_object) const {
void RichTextEditorPlugin::make_visible(bool p_visible) {
if (p_visible) {
- rich_text_editor->show();
+ rich_text_editor->options->show();
} else {
- rich_text_editor->hide();
+ rich_text_editor->options->hide();
rich_text_editor->edit(NULL);
}
@@ -149,10 +152,7 @@ RichTextEditorPlugin::RichTextEditorPlugin(EditorNode *p_node) {
rich_text_editor->set_margin(MARGIN_TOP,0);
rich_text_editor->set_margin(MARGIN_BOTTOM,10);
-
- rich_text_editor->hide();
-
-
+ rich_text_editor->options->hide();
}
diff --git a/tools/editor/plugins/rich_text_editor_plugin.h b/tools/editor/plugins/rich_text_editor_plugin.h
index 8919518691..653d756d8f 100644
--- a/tools/editor/plugins/rich_text_editor_plugin.h
+++ b/tools/editor/plugins/rich_text_editor_plugin.h
@@ -42,6 +42,8 @@ class RichTextEditor : public Control {
OBJ_TYPE(RichTextEditor, Control );
+ friend class RichTextEditorPlugin;
+
enum {
PARSE_BBCODE,
@@ -49,8 +51,8 @@ class RichTextEditor : public Control {
};
Panel *panel;
+ MenuButton *options;
RichTextLabel *node;
- MenuButton *options;
FileDialog *file_dialog;
void _file_selected(const String& p_path);