diff options
Diffstat (limited to 'scene/3d')
-rw-r--r-- | scene/3d/portal.cpp | 2 | ||||
-rw-r--r-- | scene/3d/portal.h | 4 | ||||
-rw-r--r-- | scene/3d/room_instance.cpp | 2 | ||||
-rw-r--r-- | scene/3d/room_instance.h | 5 | ||||
-rw-r--r-- | scene/3d/spatial.cpp | 23 | ||||
-rw-r--r-- | scene/3d/spatial.h | 1 | ||||
-rw-r--r-- | scene/3d/visual_instance.cpp | 27 | ||||
-rw-r--r-- | scene/3d/visual_instance.h | 1 |
8 files changed, 29 insertions, 36 deletions
diff --git a/scene/3d/portal.cpp b/scene/3d/portal.cpp index d77dde1dd8..f79f7f6949 100644 --- a/scene/3d/portal.cpp +++ b/scene/3d/portal.cpp @@ -32,6 +32,7 @@ #include "scene/resources/surface_tool.h" #include "servers/visual_server.h" +#if 0 bool Portal::_set(const StringName &p_name, const Variant &p_value) { if (p_name == "shape") { @@ -226,3 +227,4 @@ Portal::~Portal() { VisualServer::get_singleton()->free(portal); } +#endif diff --git a/scene/3d/portal.h b/scene/3d/portal.h index 7c25e4904b..9cc5d280a1 100644 --- a/scene/3d/portal.h +++ b/scene/3d/portal.h @@ -39,7 +39,8 @@ If a portal is placed next (very close to) a similar, opposing portal, they automatically connect, otherwise, a portal connects to the parent room */ - +//this will be redone and replaced by area portals, left for reference since a new class with this name will have to exist and want to reuse the gizmos +#if 0 class Portal : public VisualInstance { GDCLASS(Portal, VisualInstance); @@ -85,3 +86,4 @@ public: }; #endif +#endif diff --git a/scene/3d/room_instance.cpp b/scene/3d/room_instance.cpp index 3e6a8d3c38..81ddf4a667 100644 --- a/scene/3d/room_instance.cpp +++ b/scene/3d/room_instance.cpp @@ -31,6 +31,7 @@ #include "servers/visual_server.h" +#if 0 #include "geometry.h" #include "project_settings.h" #include "scene/resources/surface_tool.h" @@ -158,3 +159,4 @@ Room::Room() { Room::~Room() { } +#endif diff --git a/scene/3d/room_instance.h b/scene/3d/room_instance.h index 4176da92e8..5b9886671f 100644 --- a/scene/3d/room_instance.h +++ b/scene/3d/room_instance.h @@ -44,6 +44,9 @@ */ +//this will be removed, left for reference +#if 0 + class Room : public VisualInstance { GDCLASS(Room, VisualInstance); @@ -77,5 +80,5 @@ public: Room(); ~Room(); }; - +#endif #endif // ROOM_INSTANCE_H diff --git a/scene/3d/spatial.cpp b/scene/3d/spatial.cpp index 9e85a8a5b1..2c1ef5c00b 100644 --- a/scene/3d/spatial.cpp +++ b/scene/3d/spatial.cpp @@ -185,8 +185,13 @@ void Spatial::_notification(int p_what) { get_tree()->call_group_flags(0, SceneStringNames::get_singleton()->_spatial_editor_group, SceneStringNames::get_singleton()->_request_gizmo, this); if (!data.gizmo_disabled) { - if (data.gizmo.is_valid()) + if (data.gizmo.is_valid()) { data.gizmo->create(); + if (data.gizmo->can_draw()) { + data.gizmo->redraw(); + } + data.gizmo->transform(); + } } } #endif @@ -449,7 +454,9 @@ void Spatial::set_gizmo(const Ref<SpatialGizmo> &p_gizmo) { if (data.gizmo.is_valid() && is_inside_world()) { data.gizmo->create(); - data.gizmo->redraw(); + if (data.gizmo->can_draw()) { + data.gizmo->redraw(); + } data.gizmo->transform(); } @@ -471,12 +478,16 @@ Ref<SpatialGizmo> Spatial::get_gizmo() const { void Spatial::_update_gizmo() { + if (!is_inside_world()) + return; data.gizmo_dirty = false; if (data.gizmo.is_valid()) { - if (is_visible_in_tree()) - data.gizmo->redraw(); - else - data.gizmo->clear(); + if (data.gizmo->can_draw()) { + if (is_visible_in_tree()) + data.gizmo->redraw(); + else + data.gizmo->clear(); + } } } diff --git a/scene/3d/spatial.h b/scene/3d/spatial.h index f22b19d3cc..3e647927ae 100644 --- a/scene/3d/spatial.h +++ b/scene/3d/spatial.h @@ -47,6 +47,7 @@ public: virtual void clear() = 0; virtual void redraw() = 0; virtual void free() = 0; + virtual bool can_draw() const = 0; SpatialGizmo(); }; diff --git a/scene/3d/visual_instance.cpp b/scene/3d/visual_instance.cpp index b9e4488998..1ca6ec42d9 100644 --- a/scene/3d/visual_instance.cpp +++ b/scene/3d/visual_instance.cpp @@ -29,7 +29,6 @@ /*************************************************************************/ #include "visual_instance.h" -#include "room_instance.h" #include "scene/scene_string_names.h" #include "servers/visual_server.h" #include "skeleton.h" @@ -54,29 +53,6 @@ void VisualInstance::_notification(int p_what) { case NOTIFICATION_ENTER_WORLD: { - // CHECK ROOM - Spatial *parent = get_parent_spatial(); - Room *room = NULL; - bool is_geom = Object::cast_to<GeometryInstance>(this); - - /* while(parent) { - - room = Object::cast_to<Room>(parent); - if (room) - break; - - if (is_geom && Object::cast_to<BakedLightSampler>(parent)) { - VS::get_singleton()->instance_geometry_set_baked_light_sampler(get_instance(),Object::cast_to<BakedLightSampler>(parent)->get_instance()); - break; - } - - parent=parent->get_parent_spatial(); - }*/ - - if (room) { - - VisualServer::get_singleton()->instance_set_room(instance, room->get_instance()); - } // CHECK SKELETON => moving skeleton attaching logic to MeshInstance /* Skeleton *skeleton=Object::cast_to<Skeleton>(get_parent()); @@ -96,7 +72,6 @@ void VisualInstance::_notification(int p_what) { case NOTIFICATION_EXIT_WORLD: { VisualServer::get_singleton()->instance_set_scenario(instance, RID()); - VisualServer::get_singleton()->instance_set_room(instance, RID()); VisualServer::get_singleton()->instance_attach_skeleton(instance, RID()); //VS::get_singleton()->instance_geometry_set_baked_light_sampler(instance, RID() ); @@ -303,7 +278,6 @@ void GeometryInstance::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "material_override", PROPERTY_HINT_RESOURCE_TYPE, "ShaderMaterial,SpatialMaterial"), "set_material_override", "get_material_override"); ADD_PROPERTY(PropertyInfo(Variant::INT, "cast_shadow", PROPERTY_HINT_ENUM, "Off,On,Double-Sided,Shadows Only"), "set_cast_shadows_setting", "get_cast_shadows_setting"); ADD_PROPERTY(PropertyInfo(Variant::REAL, "extra_cull_margin", PROPERTY_HINT_RANGE, "0,16384,0"), "set_extra_cull_margin", "get_extra_cull_margin"); - ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "visible_in_all_rooms"), "set_flag", "get_flag", FLAG_VISIBLE_IN_ALL_ROOMS); ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "use_in_baked_light"), "set_flag", "get_flag", FLAG_USE_BAKED_LIGHT); ADD_GROUP("LOD", "lod_"); @@ -314,7 +288,6 @@ void GeometryInstance::_bind_methods() { //ADD_SIGNAL( MethodInfo("visibility_changed")); - BIND_CONSTANT(FLAG_VISIBLE_IN_ALL_ROOMS); BIND_CONSTANT(FLAG_MAX); BIND_CONSTANT(SHADOW_CASTING_SETTING_OFF); diff --git a/scene/3d/visual_instance.h b/scene/3d/visual_instance.h index 694d0c2499..4751d109e6 100644 --- a/scene/3d/visual_instance.h +++ b/scene/3d/visual_instance.h @@ -84,7 +84,6 @@ class GeometryInstance : public VisualInstance { public: enum Flags { - FLAG_VISIBLE_IN_ALL_ROOMS = VS::INSTANCE_FLAG_VISIBLE_IN_ALL_ROOMS, FLAG_USE_BAKED_LIGHT = VS::INSTANCE_FLAG_USE_BAKED_LIGHT, FLAG_MAX = VS::INSTANCE_FLAG_MAX, }; |