diff options
| author | Juan Linietsky <reduzio@gmail.com> | 2017-08-26 00:40:45 -0300 |
|---|---|---|
| committer | Juan Linietsky <reduzio@gmail.com> | 2017-08-26 00:47:28 -0300 |
| commit | 1894157c9fab05984428d83a743b0fe1d720c80c (patch) | |
| tree | 817530eb75258c3dc6c73d4eb276af7b61761b06 /scene | |
| parent | d9e94fa0c308f8f157e71fb03bab5834308b56ee (diff) | |
| download | redot-engine-1894157c9fab05984428d83a743b0fe1d720c80c.tar.gz | |
-Massive clean up to gizmos
-Make sure handles are always visible (on top)
-Fixed instanced scene selection (should work properly now)
-Added interpolated camera
-Customizable gizmo colors in editor settings
Diffstat (limited to 'scene')
| -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 | ||||
| -rw-r--r-- | scene/main/viewport.cpp | 2 | ||||
| -rw-r--r-- | scene/register_scene_types.cpp | 7 | ||||
| -rw-r--r-- | scene/resources/room.cpp | 3 | ||||
| -rw-r--r-- | scene/resources/room.h | 4 |
12 files changed, 39 insertions, 42 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, }; diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp index 0661b10184..b4eabaa540 100644 --- a/scene/main/viewport.cpp +++ b/scene/main/viewport.cpp @@ -395,7 +395,7 @@ void Viewport::_notification(int p_what) { contact_3d_debug_instance = VisualServer::get_singleton()->instance_create(); VisualServer::get_singleton()->instance_set_base(contact_3d_debug_instance, contact_3d_debug_multimesh); VisualServer::get_singleton()->instance_set_scenario(contact_3d_debug_instance, find_world()->get_scenario()); - VisualServer::get_singleton()->instance_geometry_set_flag(contact_3d_debug_instance, VS::INSTANCE_FLAG_VISIBLE_IN_ALL_ROOMS, true); + //VisualServer::get_singleton()->instance_geometry_set_flag(contact_3d_debug_instance, VS::INSTANCE_FLAG_VISIBLE_IN_ALL_ROOMS, true); } VS::get_singleton()->viewport_set_active(viewport, true); diff --git a/scene/register_scene_types.cpp b/scene/register_scene_types.cpp index 3e6d80d314..7d9e262b3f 100644 --- a/scene/register_scene_types.cpp +++ b/scene/register_scene_types.cpp @@ -167,7 +167,7 @@ #include "scene/3d/audio_stream_player_3d.h" #include "scene/resources/material.h" #include "scene/resources/mesh.h" -#include "scene/resources/room.h" + #include "scene/resources/sky_box.h" #include "scene/resources/texture.h" @@ -424,7 +424,7 @@ void register_scene_types() { ClassDB::register_class<GIProbe>(); ClassDB::register_class<GIProbeData>(); ClassDB::register_class<AnimationTreePlayer>(); - ClassDB::register_class<Portal>(); + //ClassDB::register_class<Portal>(); ClassDB::register_class<Particles>(); ClassDB::register_class<Position3D>(); ClassDB::register_class<NavigationMeshInstance>(); @@ -446,7 +446,7 @@ void register_scene_types() { ClassDB::register_class<CollisionPolygon>(); ClassDB::register_class<RayCast>(); ClassDB::register_class<MultiMeshInstance>(); - ClassDB::register_class<Room>(); + ClassDB::register_class<Curve3D>(); ClassDB::register_class<Path>(); ClassDB::register_class<PathFollow>(); @@ -546,7 +546,6 @@ void register_scene_types() { ParticlesMaterial::init_shaders(); //ClassDB::register_type<ShaderMaterial>(); - ClassDB::register_class<RoomBounds>(); ClassDB::register_class<MultiMesh>(); ClassDB::register_class<MeshLibrary>(); diff --git a/scene/resources/room.cpp b/scene/resources/room.cpp index c89b7c72c7..de238ebcc0 100644 --- a/scene/resources/room.cpp +++ b/scene/resources/room.cpp @@ -30,7 +30,7 @@ #include "room.h" #include "servers/visual_server.h" - +#if 0 RID RoomBounds::get_rid() const { return area; @@ -64,3 +64,4 @@ RoomBounds::~RoomBounds() { VisualServer::get_singleton()->free(area); } +#endif diff --git a/scene/resources/room.h b/scene/resources/room.h index ba5c0eee1c..4b8c837458 100644 --- a/scene/resources/room.h +++ b/scene/resources/room.h @@ -36,6 +36,9 @@ @author Juan Linietsky <reduzio@gmail.com> */ +//left for reference but will be removed when portals are reimplemented using Area +#if 0 + class RoomBounds : public Resource { GDCLASS(RoomBounds, Resource); @@ -57,4 +60,5 @@ public: ~RoomBounds(); }; +#endif #endif // ROOM_H |
