summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/object.cpp69
-rw-r--r--scene/2d/canvas_modulate.cpp13
-rw-r--r--scene/2d/light_2d.cpp17
-rw-r--r--scene/2d/light_2d.h1
-rw-r--r--scene/2d/light_occluder_2d.cpp5
-rw-r--r--servers/visual/visual_server_raster.cpp2
6 files changed, 88 insertions, 19 deletions
diff --git a/core/object.cpp b/core/object.cpp
index 701120a836..ad9fdf73b9 100644
--- a/core/object.cpp
+++ b/core/object.cpp
@@ -1011,6 +1011,27 @@ Array Object::_get_property_list_bind() const {
return convert_property_list(&lpi);
}
+
+static Dictionary _get_dict_from_method(const MethodInfo &mi) {
+
+ Dictionary d;
+ d["name"]=mi.name;
+ d["args"]=convert_property_list(&mi.arguments);
+ Array da;
+ for(int i=0;i<mi.default_arguments.size();i++)
+ da.push_back(mi.default_arguments[i]);
+ d["default_args"]=da;
+ d["flags"]=mi.flags;
+ d["id"]=mi.id;
+ Dictionary r;
+ r["type"]=mi.return_val.type;
+ r["hint"]=mi.return_val.hint;
+ r["hint_string"]=mi.return_val.hint_string;
+ d["return_type"]=r;
+ return d;
+
+}
+
Array Object::_get_method_list_bind() const {
List<MethodInfo> ml;
@@ -1019,20 +1040,7 @@ Array Object::_get_method_list_bind() const {
for(List<MethodInfo>::Element *E=ml.front();E;E=E->next()) {
- Dictionary d;
- d["name"]=E->get().name;
- d["args"]=convert_property_list(&E->get().arguments);
- Array da;
- for(int i=0;i<E->get().default_arguments.size();i++)
- da.push_back(E->get().default_arguments[i]);
- d["default_args"]=da;
- d["flags"]=E->get().flags;
- d["id"]=E->get().id;
- Dictionary r;
- r["type"]=E->get().return_val.type;
- r["hint"]=E->get().return_val.hint;
- r["hint_string"]=E->get().return_val.hint_string;
- d["return_type"]=r;
+ Dictionary d = _get_dict_from_method(E->get());
//va.push_back(d);
ret.push_back(d);
}
@@ -1299,11 +1307,39 @@ void Object::_emit_signal(const StringName& p_name,const Array& p_pargs){
#endif
Array Object::_get_signal_list() const{
- return Array();
+ List<MethodInfo> signal_list;
+ get_signal_list(&signal_list);
+
+ Array ret;
+ for (List<MethodInfo>::Element *E=signal_list.front();E;E=E->next()) {
+
+ ret.push_back(_get_dict_from_method(E->get()));
+ }
+
+ return ret;
}
Array Object::_get_signal_connection_list(const String& p_signal) const{
- return Array();
+ List<Connection> conns;
+ get_all_signal_connections(&conns);
+
+ Array ret;
+
+ for (List<Connection>::Element *E=conns.front();E;E=E->next()) {
+
+ Connection &c=E->get();
+ Dictionary rc;
+ rc["signal"]=c.signal;
+ rc["method"]=c.method;
+ rc["source"]=c.source;
+ rc["target"]=c.target;
+ rc["binds"]=c.binds;
+ rc["flags"]=c.flags;
+ ret.push_back(rc);
+ }
+
+ return ret;
+
}
@@ -1618,6 +1654,7 @@ void Object::_bind_methods() {
ObjectTypeDB::bind_method(_MD("has_method","method"),&Object::has_method);
ObjectTypeDB::bind_method(_MD("get_signal_list"),&Object::_get_signal_list);
+ ObjectTypeDB::bind_method(_MD("get_signal_connection_list","signal"),&Object::_get_signal_connection_list);
ObjectTypeDB::bind_method(_MD("connect","signal","target:Object","method","binds","flags"),&Object::connect,DEFVAL(Array()),DEFVAL(0));
ObjectTypeDB::bind_method(_MD("disconnect","signal","target:Object","method"),&Object::disconnect);
diff --git a/scene/2d/canvas_modulate.cpp b/scene/2d/canvas_modulate.cpp
index 82dd8012a5..77203a7110 100644
--- a/scene/2d/canvas_modulate.cpp
+++ b/scene/2d/canvas_modulate.cpp
@@ -5,10 +5,19 @@ void CanvasModulate::_notification(int p_what) {
if (p_what==NOTIFICATION_ENTER_CANVAS) {
- VS::get_singleton()->canvas_set_modulate(get_canvas(),color);
+ if (is_visible())
+ VS::get_singleton()->canvas_set_modulate(get_canvas(),color);
} else if (p_what==NOTIFICATION_EXIT_CANVAS) {
- VS::get_singleton()->canvas_set_modulate(get_canvas(),Color(1,1,1,1));
+ if (is_visible())
+ VS::get_singleton()->canvas_set_modulate(get_canvas(),Color(1,1,1,1));
+ } else if (p_what==NOTIFICATION_VISIBILITY_CHANGED) {
+
+ if (is_visible()) {
+ VS::get_singleton()->canvas_set_modulate(get_canvas(),color);
+ } else {
+ VS::get_singleton()->canvas_set_modulate(get_canvas(),Color(1,1,1,1));
+ }
}
}
diff --git a/scene/2d/light_2d.cpp b/scene/2d/light_2d.cpp
index a2112c7d37..9715afeaa4 100644
--- a/scene/2d/light_2d.cpp
+++ b/scene/2d/light_2d.cpp
@@ -34,10 +34,19 @@ Rect2 Light2D::get_item_rect() const {
}
+void Light2D::_update_light_visibility() {
+
+ if (!is_inside_tree())
+ return;
+
+ VS::get_singleton()->canvas_light_set_enabled(canvas_light,enabled && is_visible());
+}
+
void Light2D::set_enabled( bool p_enabled) {
- VS::get_singleton()->canvas_light_set_enabled(canvas_light,p_enabled);
+
enabled=p_enabled;
+ _update_light_visibility();
}
bool Light2D::is_enabled() const {
@@ -253,16 +262,22 @@ void Light2D::_notification(int p_what) {
if (p_what==NOTIFICATION_ENTER_TREE) {
VS::get_singleton()->canvas_light_attach_to_canvas( canvas_light, get_canvas() );
+ _update_light_visibility();
}
if (p_what==NOTIFICATION_TRANSFORM_CHANGED) {
VS::get_singleton()->canvas_light_set_transform( canvas_light, get_global_transform());
}
+ if (p_what==NOTIFICATION_VISIBILITY_CHANGED) {
+
+ _update_light_visibility();
+ }
if (p_what==NOTIFICATION_EXIT_TREE) {
VS::get_singleton()->canvas_light_attach_to_canvas( canvas_light, RID() );
+ _update_light_visibility();
}
}
diff --git a/scene/2d/light_2d.h b/scene/2d/light_2d.h
index 0828d9ac33..ca437769e7 100644
--- a/scene/2d/light_2d.h
+++ b/scene/2d/light_2d.h
@@ -35,6 +35,7 @@ private:
Ref<Texture> texture;
Vector2 texture_offset;
+ void _update_light_visibility();
protected:
void _notification(int p_what);
diff --git a/scene/2d/light_occluder_2d.cpp b/scene/2d/light_occluder_2d.cpp
index 6ebd499f71..d98bed0ea3 100644
--- a/scene/2d/light_occluder_2d.cpp
+++ b/scene/2d/light_occluder_2d.cpp
@@ -93,12 +93,17 @@ void LightOccluder2D::_notification(int p_what) {
VS::get_singleton()->canvas_light_occluder_attach_to_canvas(occluder,get_canvas());
VS::get_singleton()->canvas_light_occluder_set_transform(occluder,get_global_transform());
+ VS::get_singleton()->canvas_light_occluder_set_enabled(occluder,is_visible());
}
if (p_what==NOTIFICATION_TRANSFORM_CHANGED) {
VS::get_singleton()->canvas_light_occluder_set_transform(occluder,get_global_transform());
}
+ if (p_what==NOTIFICATION_VISIBILITY_CHANGED) {
+
+ VS::get_singleton()->canvas_light_occluder_set_enabled(occluder,is_visible());
+ }
if (p_what==NOTIFICATION_DRAW) {
diff --git a/servers/visual/visual_server_raster.cpp b/servers/visual/visual_server_raster.cpp
index 889593d686..3675194325 100644
--- a/servers/visual/visual_server_raster.cpp
+++ b/servers/visual/visual_server_raster.cpp
@@ -7182,6 +7182,8 @@ void VisualServerRaster::_draw_viewport(Viewport *p_viewport,int p_ofs_x, int p_
for(Set<Rasterizer::CanvasLightOccluderInstance*>::Element *F=E->get().canvas->occluders.front();F;F=F->next()) {
+ if (!F->get()->enabled)
+ continue;
F->get()->xform_cache = xf * F->get()->xform;
if (shadow_rect.intersects_transformed(F->get()->xform_cache,F->get()->aabb_cache)) {