diff options
author | Juan Linietsky <reduzio@gmail.com> | 2014-10-12 02:13:22 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2014-10-12 02:13:22 -0300 |
commit | 948fd83cdded7fed77ae5213101c1a2ece580434 (patch) | |
tree | a6953095dc4feaac1485c04b35039b85f1a95534 /scene/3d/light.cpp | |
parent | 37354da5b0dc1dc8dcfd9d844e593935311f4f8f (diff) | |
download | redot-engine-948fd83cdded7fed77ae5213101c1a2ece580434.tar.gz |
Little Bits
-=-=-=-=-=-
-fix duplicate function bug when creating script callback in editor
-fix bug where hiding lights does not work
-fix 2D audio listener bug (romulox_x reported)
-fix exported properties with inheritance bug
-fix timer autostart (make it not work on editor)
-reactivate first camara found if viewport runs out of active camera
-option to hide gizmos in viewport
-changed skeleton gizmo because it sucks
-Make convex shapes using CollisionShape visible (use quickhull class)
-fix up menu when editing a mesh, to export collision, navmesh, convex, etc. from it.
-make a menu option to show SRGB in 3D editor views by default
-make option to edit default light direction in viewport settings
-make option to edit default ambient light in viewport settings
-make software conversion of linear->RGB if hardware support not found
Diffstat (limited to 'scene/3d/light.cpp')
-rw-r--r-- | scene/3d/light.cpp | 47 |
1 files changed, 46 insertions, 1 deletions
diff --git a/scene/3d/light.cpp b/scene/3d/light.cpp index 0d571b77cd..7713a262ef 100644 --- a/scene/3d/light.cpp +++ b/scene/3d/light.cpp @@ -429,10 +429,40 @@ void Light::approximate_opengl_attenuation(float p_constant, float p_linear, flo } + +void Light::_update_visibility() { + + if (!is_inside_scene()) + return; + + bool editor_ok=true; + if (editor_only) { + + if (!get_scene()->is_editor_hint()) { + editor_ok=false; + } else { + editor_ok = (get_scene()->get_edited_scene_root() && (this==get_scene()->get_edited_scene_root() || get_owner()==get_scene()->get_edited_scene_root())); + } + } + + + VS::get_singleton()->instance_light_set_enabled(get_instance(),is_visible() && enabled && editor_ok); + _change_notify("geometry/visible"); + +} + + +void Light::_notification(int p_what) { + + if (p_what==NOTIFICATION_ENTER_SCENE || p_what==NOTIFICATION_VISIBILITY_CHANGED) { + _update_visibility(); + } +} + void Light::set_enabled(bool p_enabled) { enabled=p_enabled; - VS::get_singleton()->instance_light_set_enabled(get_instance(),enabled); + _update_visibility(); } bool Light::is_enabled() const{ @@ -440,6 +470,17 @@ bool Light::is_enabled() const{ return enabled; } +void Light::set_editor_only(bool p_editor_only) { + + editor_only=p_editor_only; + _update_visibility(); +} + +bool Light::is_editor_only() const{ + + return editor_only; +} + void Light::_bind_methods() { @@ -457,9 +498,12 @@ void Light::_bind_methods() { ObjectTypeDB::bind_method(_MD("get_bake_mode"), &Light::get_bake_mode ); ObjectTypeDB::bind_method(_MD("set_enabled","enabled"), &Light::set_enabled ); ObjectTypeDB::bind_method(_MD("is_enabled"), &Light::is_enabled ); + ObjectTypeDB::bind_method(_MD("set_editor_only","editor_only"), &Light::set_editor_only ); + ObjectTypeDB::bind_method(_MD("is_editor_only"), &Light::is_editor_only ); ADD_PROPERTY( PropertyInfo( Variant::BOOL, "params/enabled"), _SCS("set_enabled"), _SCS("is_enabled")); + ADD_PROPERTY( PropertyInfo( Variant::BOOL, "params/editor_only"), _SCS("set_editor_only"), _SCS("is_editor_only")); ADD_PROPERTY( PropertyInfo( Variant::INT, "params/bake_mode",PROPERTY_HINT_ENUM,"Disabled,Indirect,Indirect+Shadows,Full"), _SCS("set_bake_mode"), _SCS("get_bake_mode")); ADD_PROPERTYI( PropertyInfo( Variant::REAL, "params/energy", PROPERTY_HINT_EXP_RANGE, "0,64,0.01"), _SCS("set_parameter"), _SCS("get_parameter"), PARAM_ENERGY ); /* @@ -531,6 +575,7 @@ Light::Light(VisualServer::LightType p_type) { set_project_shadows( false ); set_base(light); enabled=true; + editor_only=false; bake_mode=BAKE_MODE_DISABLED; } |