Skip to content

Commit

Permalink
Merge commit '27442def49b1286e2ed373424cbb9188fc89c957' into maint/3.5.0
Browse files Browse the repository at this point in the history
; Conflicts:
;	radiant/ui/mainframe/PropertyNotebook.cpp
  • Loading branch information
Matthew Mott committed Nov 7, 2022
2 parents f73743f + 27442de commit eb5e763
Show file tree
Hide file tree
Showing 50 changed files with 1,113 additions and 608 deletions.
4 changes: 4 additions & 0 deletions include/inode.h
Expand Up @@ -259,6 +259,10 @@ class INode :

// Called during recursive transform changed, but only by INodes themselves
virtual void transformChangedLocal() = 0;

// Method invoked on every node whenever the filter system
// changes its state - nodes get a chance to react on that
virtual void onFiltersChanged() = 0;
};

/// Cast an INode to a particular interface
Expand Down
22 changes: 12 additions & 10 deletions install/user.xml
Expand Up @@ -121,16 +121,18 @@
<mainFrame>
<windowLayout value="1" />
<window xPosition="0" yPosition="0" width="800" height="580" state="4" />
<regular>
<pane name="vertical" position="650" />
<pane name="horizontal" position="500" />
<pane name="texcam" position="350" />
</regular>
<splitPane>
<pane name="horizontal" position="300" />
<pane name="vertical1" position="250" />
<pane name="vertical2" position="250" />
</splitPane>
<propertyPanel>
<lastShownPage value="EntityInspector"/>
<pages default="true">
<page controlName="EntityInspector"/>
<page controlName="AIEditingPanel"/>
<page controlName="MediaBrowser"/>
<page controlName="FavouritesBrowser"/>
<page controlName="Console"/>
<page controlName="ScriptPanel"/>
<page controlName="TextureBrowser"/>
</pages>
</propertyPanel>
</mainFrame>
<multiMonitor>
<startMonitorNum value="0" />
Expand Down
80 changes: 0 additions & 80 deletions libs/render/RenderableBox.h
Expand Up @@ -200,84 +200,4 @@ class RenderableBox :
}
};

class RenderableBoxSurface final :
public RenderableSurface
{
private:
const AABB& _bounds;
const Matrix4& _orientation;

std::vector<MeshVertex> _vertices;
std::vector<unsigned int> _indices;

public:
RenderableBoxSurface(const AABB& bounds, const Matrix4& orientation) :
_bounds(bounds),
_orientation(orientation)
{
static Vector3 Origin(0, 0, 0);

// Calculate the corner vertices of this bounding box
Vector3 max(Origin + _bounds.extents);
Vector3 min(Origin - _bounds.extents);

auto vertices = detail::getFillBoxVertices(min, max, { 1, 1, 1, 1 });

for (const auto& vertex : vertices)
{
_vertices.push_back(MeshVertex(
toVector3(vertex.vertex),
toVector3(vertex.normal),
Vector2(vertex.texcoord.x(), vertex.texcoord.y()),
Vector4(vertex.colour.x(), vertex.colour.y(), vertex.colour.z(), vertex.colour.w()),
toVector3(vertex.tangent),
toVector3(vertex.bitangent)
));
}

_indices = detail::generateTriangleBoxIndices();
}

bool isVisible() override
{
return !_indices.empty();
}

const std::vector<MeshVertex>& getVertices() override
{
return _vertices;
}

const std::vector<unsigned int>& getIndices() override
{
return _indices;
}

bool isOriented() override
{
return true;
}

const Matrix4& getObjectTransform() override
{
return _orientation;
}

const AABB& getObjectBounds() override
{
return _bounds;
}

bool isShadowCasting() override
{
return false;
}

private:
inline Vector3 toVector3(const Vector3f& vector)
{
return { vector.x(), vector.y(), vector.z() };
}
};

}
10 changes: 10 additions & 0 deletions libs/scene/BasicRootNode.h
Expand Up @@ -108,6 +108,16 @@ class BasicRootNode final :
{
return Node::getRenderSystem();
}

void onFiltersChanged() override
{
// Recursively notify the whole tree
foreachNode([](const INodePtr& node)
{
node->onFiltersChanged();
return true;
});
}
};

}
4 changes: 4 additions & 0 deletions libs/scene/Node.h
Expand Up @@ -194,6 +194,10 @@ class Node : public virtual INode, public std::enable_shared_from_this<Node>
virtual RenderSystemPtr getRenderSystem() const;
void setRenderSystem(const RenderSystemPtr& renderSystem) override;

// The default implementation doesn't react to this call
void onFiltersChanged() override
{}

protected:
// Set the "forced visible" flag, only to be used internally by subclasses
virtual void setForcedVisibility(bool forceVisible, bool includeChildren) override;
Expand Down
6 changes: 3 additions & 3 deletions libs/wxutil/dataview/ResourceTreeViewToolbar.cpp
Expand Up @@ -48,7 +48,7 @@ ResourceTreeViewToolbar::ResourceTreeViewToolbar(wxWindow* parent, ResourceTreeV
_filterEntry->SetMinSize(wxSize(100, -1));
_filterEntry->Bind(wxEVT_TEXT, &ResourceTreeViewToolbar::_onEntryText, this);
_filterEntry->Bind(wxEVT_CHAR, &ResourceTreeViewToolbar::_onEntryChar, this);
_filterEntry->Bind(wxEVT_KEY_DOWN, &ResourceTreeViewToolbar::_onEntryKeyDown, this);
_filterEntry->Bind(wxEVT_CHAR_HOOK, &ResourceTreeViewToolbar::_onEntryKey, this);
_filterEntry->SetToolTip(_("Enter search text to filter the tree,\nuse arrow keys to navigate"));

auto nextImg = wxutil::GetLocalBitmap("arrow_down.png");
Expand Down Expand Up @@ -164,9 +164,9 @@ void ResourceTreeViewToolbar::_onEntryChar(wxKeyEvent& ev)
}
}

void ResourceTreeViewToolbar::_onEntryKeyDown(wxKeyEvent& ev)
void ResourceTreeViewToolbar::_onEntryKey(wxKeyEvent& ev)
{
if (ev.GetKeyCode() == WXK_ESCAPE)
if (ev.GetKeyCode() == WXK_ESCAPE && !_filterEntry->GetValue().empty())
{
// Clear the search box on esc and focus the tree view
ClearFilter();
Expand Down
2 changes: 1 addition & 1 deletion libs/wxutil/dataview/ResourceTreeViewToolbar.h
Expand Up @@ -52,7 +52,7 @@ class ResourceTreeViewToolbar :
void JumpToPrevFilterMatch();

void _onEntryChar(wxKeyEvent& ev);
void _onEntryKeyDown(wxKeyEvent& ev);
void _onEntryKey(wxKeyEvent& ev);
void _onEntryText(wxCommandEvent& ev);
void _onFilterButtonToggled(wxCommandEvent& ev);
void _onTreeViewFilterTextCleared(wxCommandEvent& ev);
Expand Down
5 changes: 0 additions & 5 deletions radiant/RadiantApp.cpp
Expand Up @@ -14,7 +14,6 @@

#include <wx/wxprec.h>
#include <wx/event.h>
#include <wx/tooltip.h>
#include <wx/cmdline.h>
#include <wx/xrc/xmlres.h>
#include <sigc++/functors/mem_fun.h>
Expand Down Expand Up @@ -134,10 +133,6 @@ void RadiantApp::initWxWidgets()

// Register the local art provider
_bitmapArtProvider = std::make_unique<wxutil::LocalBitmapArtProvider>(_context.getBitmapsPath());

// Make tooltip boxes less annoying (#6128)
wxToolTip::SetDelay(2500);
wxToolTip::SetAutoPop(2000);
}

void RadiantApp::cleanupWxWidgets()
Expand Down
25 changes: 12 additions & 13 deletions radiant/camera/CamWnd.cpp
@@ -1,18 +1,18 @@
#include "CamWnd.h"

#include "igl.h"
#include "ibrush.h"
#include "iclipper.h"
#include "icolourscheme.h"
#include "ui/imainframe.h"
#include "itextstream.h"
#include "iorthoview.h"
#include "icameraview.h"
#include "ui/imainframe.h"

#include <functional>
#include <time.h>
#include <fmt/format.h>
#include <sigc++/retype_return.h>
#include <wx/sizer.h>

#include "util/ScopedBoolLock.h"
#include "iselectiontest.h"
#include "selectionlib.h"
#include "gamelib.h"
Expand All @@ -21,19 +21,14 @@
#include "render/RenderableCollectionWalker.h"
#include "wxutil/MouseButton.h"
#include "registry/adaptors.h"
#include "selection/OccludeSelector.h"
#include "selection/Device.h"
#include "selection/SelectionVolume.h"
#include "FloorHeightWalker.h"

#include "debugging/debugging.h"
#include "debugging/gl.h"
#include <wx/sizer.h>
#include "util/ScopedBoolLock.h"
#include "CameraSettings.h"
#include <functional>
#include <sigc++/retype_return.h>
#include "render/CamRenderer.h"
#include "util/ScopedBoolLock.h"

namespace ui
{
Expand Down Expand Up @@ -64,9 +59,10 @@ inline Vector2 windowvector_for_widget_centre(wxutil::GLWidget& widget)

// ---------- CamWnd Implementation --------------------------------------------------

CamWnd::CamWnd(wxWindow* parent) :
CamWnd::CamWnd(wxWindow* parent, CameraWndManager& owner) :
DockablePanel(parent),
MouseToolHandler(IMouseToolGroup::Type::CameraView),
_owner(owner),
_mainWxWidget(loadNamedPanel(this, "CamWndPanel")),
_id(++_maxId),
_view(true),
Expand Down Expand Up @@ -122,7 +118,7 @@ CamWnd::CamWnd(wxWindow* parent) :

_renderer.reset(new render::CamRenderer(_view, _shaders));

GlobalCamera().addCamWnd(_id, this);
_owner.addCamWnd(_id, this);
}

void CamWnd::onPanelActivated()
Expand Down Expand Up @@ -326,7 +322,7 @@ CamWnd::~CamWnd()
GlobalCameraManager().destroyCamera(_camera);

// Notify the camera manager about our destruction
GlobalCamera().removeCamWnd(_id);
_owner.removeCamWnd(_id);
}

SelectionTestPtr CamWnd::createSelectionTestForPoint(const Vector2& point)
Expand Down Expand Up @@ -1247,6 +1243,9 @@ void CamWnd::onGLMouseButtonPress(wxMouseEvent& ev)
// which will propagate any key events accordingly.
GlobalMainFrame().getWxTopLevelWindow()->SetFocus();

// Set this camwnd to active
_owner.setActiveCamWnd(_id);

// Pass the call to the actual handler
MouseToolHandler::onGLMouseButtonPress(ev);
}
Expand Down
31 changes: 17 additions & 14 deletions radiant/camera/CamWnd.h
@@ -1,47 +1,47 @@
#pragma once

#include <memory>
#include <sigc++/connection.h>

#include "iscenegraph.h"
#include "imousetool.h"
#include "icameraview.h"
#include "ui/ieventmanager.h"
#include "igl.h"
#include "irender.h"
#include "ui/ieventmanager.h"

#include "wxutil/DockablePanel.h"
#include "wxutil/GLWidget.h"
#include "wxutil/FreezePointer.h"
#include "wxutil/WindowPosition.h"
#include "wxutil/XmlResourceBasedWidget.h"
#include "wxutil/event/KeyEventFilter.h"
#include "wxutil/MouseToolHandler.h"
#include "wxutil/DeferredMotionDelta.h"

#include <wx/wxprec.h>
#include <wx/glcanvas.h>
#include <wx/timer.h>
#include <wx/stopwatch.h>
#include "render/View.h"

#include "Rectangle.h"
#include <memory>
#include "render/CamRenderer.h"
#include "render/RenderStatistics.h"
#include "render/View.h"
#include "util/Noncopyable.h"
#include <sigc++/connection.h>
#include "Rectangle.h"
#include "tools/CameraMouseToolEvent.h"
#include "render/RenderStatistics.h"
#include "render/CamRenderer.h"
#include "messages/TextureChanged.h"
#include "wxutil/DockablePanel.h"

constexpr int CAMWND_MINSIZE_X = 240;
constexpr int CAMWND_MINSIZE_Y = 200;

#define SPEED_MOVE 32
#define SPEED_TURN 22.5
constexpr double SPEED_MOVE = 32.0;
constexpr double SPEED_TURN = 22.5;

class SelectionTest;

namespace render { class CamRenderer; };

namespace ui
{
class CameraWndManager;

/// Main 3D view widget
class CamWnd :
Expand All @@ -53,6 +53,9 @@ class CamWnd :
private wxutil::XmlResourceBasedWidget,
protected wxutil::MouseToolHandler
{
private:
CameraWndManager& _owner;

// Overall panel including toolbar and GL widget
wxPanel* _mainWxWidget;

Expand Down Expand Up @@ -130,7 +133,7 @@ class CamWnd :
std::size_t _textureChangedHandler;

public:
CamWnd(wxWindow* parent);
CamWnd(wxWindow* parent, CameraWndManager& owner);
~CamWnd() override;

// The unique ID of this camwindow
Expand Down

0 comments on commit eb5e763

Please sign in to comment.