Skip to content

Commit

Permalink
Merge remote-tracking branch 'remotes/orbweaver/master'
Browse files Browse the repository at this point in the history
# Conflicts:
#	radiantcore/selection/RadiantSelectionSystem.cpp
  • Loading branch information
codereader committed Feb 12, 2021
2 parents 39250cb + 2e35762 commit f2ac15d
Show file tree
Hide file tree
Showing 61 changed files with 3,458 additions and 1,048 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Expand Up @@ -7,6 +7,7 @@ cmake_install.cmake
/install_manifest.txt
/radiant/darkradiant
/install/darkradiant.desktop
/test/drtest
*.o
*.lo
*.so
Expand Down Expand Up @@ -37,6 +38,9 @@ DarkRadiant.sdf
gtkrc
testsuite.ilk

# VS Code
.vscode

# VS 2012
/winbuild
/tools\msvc2012/ipch
Expand Down
10 changes: 10 additions & 0 deletions debian/changelog
@@ -1,3 +1,13 @@
darkradiant (2.11.0~focal2) focal; urgency=medium

* New favourites system for assets like entities, textures and sound shaders.
* Improved text search in resource browsers.
* Ability to list model definitions in model chooser.
* Initial GUI improvements to game connection plugin.
* Various bug fixes.

-- Matthew Mott <orbweaver3d@gmail.com> Fri, 29 Jan 2021 20:36:34 +0000

darkradiant (2.10.0~focal1) focal; urgency=medium

* New major release on all platforms.
Expand Down
4 changes: 2 additions & 2 deletions debian/control
Expand Up @@ -2,8 +2,8 @@ Source: darkradiant
Section: editors
Priority: optional
Maintainer: Matthew Mott <orbweaver3d@gmail.com>
Build-Depends: debhelper (>= 10), cmake (>= 3.12), pkg-config, libxml2-dev, libglew-dev, python-dev, libvorbis-dev, libopenal-dev, libalut-dev, libjpeg-dev, libftgl-dev, libwxbase3.0-dev, libwxgtk3.0-gtk3-dev, libsigc++-2.0-dev
Standards-Version: 4.1.5
Build-Depends: debhelper (>= 10), cmake (>= 3.12), pkg-config, libxml2-dev, libglew-dev, python-dev, libvorbis-dev, libopenal-dev, libalut-dev, libjpeg-dev, libftgl-dev, libwxbase3.0-dev, libwxgtk3.0-gtk3-dev, libsigc++-2.0-dev, libglib2.0-dev
Standards-Version: 4.2.1

Package: darkradiant
Architecture: any
Expand Down
24 changes: 8 additions & 16 deletions include/ieclass.h
Expand Up @@ -200,9 +200,10 @@ typedef std::shared_ptr<IEntityClass> IEntityClassPtr;
typedef std::shared_ptr<const IEntityClass> IEntityClassConstPtr;

/**
* Entity class interface. An entity class represents a single type
* of entity that can be created by the EntityCreator. Entity classes are parsed
* from .DEF files during startup.
* \brief Entity class interface.
*
* An entity class represents a single type of entity that can be created by
* the EntityCreator. Entity classes are parsed from .DEF files during startup.
*
* Entity class attribute names are compared case-insensitively, as in the
* Entity class.
Expand All @@ -228,9 +229,7 @@ class IEntityClass

/* ENTITY CLASS SIZE */

/**
* Query whether this entity has a fixed size.
*/
/// Query whether this entity has a fixed size.
virtual bool isFixedSize() const = 0;

/**
Expand All @@ -251,16 +250,10 @@ class IEntityClass
// Overrides the colour defined in the .def files
virtual void setColour(const Vector3& colour) = 0;

/**
* Get the named Shader used for rendering this entity class in
* wireframe mode.
*/
/// Get the shader used for rendering this entity class in wireframe mode.
virtual const std::string& getWireShader() const = 0;

/**
* Get the Shader used for rendering this entity class in
* filled mode.
*/
/// Get the shader used for rendering this entity class in filled mode.
virtual const std::string& getFillShader() const = 0;


Expand Down Expand Up @@ -303,8 +296,7 @@ class IEntityClass
*/
virtual const std::string& getModelPath() const = 0;

/** Get the model skin, or the empty string if there is no skin.
*/
/// Get the model skin, or the empty string if there is no skin.
virtual const std::string& getSkin() const = 0;

/**
Expand Down
109 changes: 86 additions & 23 deletions include/ientity.h
Expand Up @@ -5,8 +5,12 @@
#include "imodule.h"
#include "irender.h"
#include "inameobserver.h"
#include "iscenegraph.h"
#include "itransformnode.h"
#include <functional>

#include "string/predicate.h"

class IEntityClass;
typedef std::shared_ptr<IEntityClass> IEntityClassPtr;
typedef std::shared_ptr<const IEntityClass> IEntityClassConstPtr;
Expand Down Expand Up @@ -104,9 +108,6 @@ class Entity
{ }
};

// Function typedef to visit keyvalues
typedef std::function<void(const std::string& key, const std::string& value)> KeyValueVisitFunctor;

// Function typedef to visit actual EntityKeyValue objects, not just the string values
typedef std::function<void(const std::string& key, EntityKeyValue& value)> EntityKeyValueVisitFunctor;

Expand All @@ -117,11 +118,25 @@ class Entity
*/
virtual IEntityClassPtr getEntityClass() const = 0;

/// Functor to receive keys and values as strings
using KeyValueVisitFunc = std::function<
void(const std::string&, const std::string&)
>;

/**
* Enumerate key values on this entity using a function object taking
* key and value as string arguments.
* \brief Enumerate all keys and values on this entity, optionally including
* inherited spawnargs.
*
* \param func
* Functor to receive each key and its associated value.
*
* \param includeInherited
* true if the functor should be invoked for each inherited spawnarg (from
* the entity class), false if only explicit spawnargs on this particular
* entity should be visited.
*/
virtual void forEachKeyValue(const KeyValueVisitFunctor& visitor) const = 0;
virtual void forEachKeyValue(KeyValueVisitFunc func,
bool includeInherited = false) const = 0;

// Similar to above, visiting the EntityKeyValue objects itself, not just the string value.
virtual void forEachEntityKeyValue(const EntityKeyValueVisitFunctor& visitor) = 0;
Expand Down Expand Up @@ -158,12 +173,12 @@ class Entity
virtual bool isInherited(const std::string& key) const = 0;

/**
* Return the list of Key/Value pairs matching the given prefix, case ignored.
* \brief Return the list of keyvalues matching the given prefix.
*
* This method performs a search for all spawnargs whose key
* matches the given prefix, with a suffix consisting of zero or more
* arbitrary characters. For example, if "target" were specified as the
* prefix, the list would include "target", "target0", "target127" etc.
* This method performs a search for all spawnargs whose key matches the
* given prefix, with a suffix consisting of zero or more arbitrary
* characters. For example, if "target" were specified as the prefix, the
* list would include "target", "target0", "target127" etc.
*
* This operation may not have high performance, due to the need to scan
* for matching names, therefore should not be used in performance-critical
Expand All @@ -173,10 +188,20 @@ class Entity
* The prefix to search for, interpreted case-insensitively.
*
* @return
* A list of KeyValue pairs matching the provided prefix. This
* list will be empty if there were no matches.
* A list of KeyValue pairs matching the provided prefix. This list will be
* empty if there were no matches.
*/
virtual KeyValuePairs getKeyValuePairs(const std::string& prefix) const = 0;
KeyValuePairs getKeyValuePairs(const std::string& prefix) const
{
KeyValuePairs list;

forEachKeyValue([&](const std::string& k, const std::string& v) {
if (string::istarts_with(k, prefix))
list.push_back(std::make_pair(k, v));
});

return list;
}

/** greebo: Returns true if the entity is a model. For Doom3, this is
* usually true when the classname == "func_static" and
Expand Down Expand Up @@ -205,16 +230,54 @@ class Entity
virtual void detachObserver(Observer* observer) = 0;

/**
* Returns true if this entity is of type or inherits from the
* Returns true if this entity is of type or inherits from the
* given entity class name. className is treated case-sensitively.
*/
virtual bool isOfType(const std::string& className) = 0;

/* ENTITY ATTACHMENTS */

/// Details of an attached entity
struct Attachment
{
/// Entity class of the attached entity
std::string eclass;

/// Vector offset where the attached entity should appear
Vector3 offset;

/// Optional model joint to use as origin
std::string joint;
};

/// A functor which can receive Attachment objects
using AttachmentFunc = std::function<void(const Attachment&)>;

/**
* \brief Iterate over attached entities, if any.
*
* Each entity can define one or more attached entities, which should
* appear at specific offsets relative to the parent entity. Such attached
* entities are for visualisation only, and should not be saved into the
* map as genuine map entities.
*
* \param func
* Functor to receive attachment information.
*/
virtual void forEachAttachment(AttachmentFunc func) const = 0;
};

/// Interface for a INode subclass that contains an Entity
class IEntityNode :
public IRenderEntity,
public virtual scene::INode
/**
* \brief Interface for a node which represents an entity.
*
* As well as providing access to the entity data with getEntity(), every
* IEntityNode can clone itself and apply a transformation matrix to its
* children (which might be brushes, patches or other entities).
*/
class IEntityNode : public IRenderEntity,
public virtual scene::INode,
public scene::Cloneable,
public IMatrixTransform
{
public:
virtual ~IEntityNode() {}
Expand Down Expand Up @@ -275,13 +338,13 @@ class ITargetableObject
typedef std::shared_ptr<ITargetableObject> ITargetableObjectPtr;

/**
* greebo: The TargetManager keeps track of all ITargetableObjects
* in the current scene/map. A TargetManager instance is owned
* greebo: The TargetManager keeps track of all ITargetableObjects
* in the current scene/map. A TargetManager instance is owned
* by the RootNode. TargetManager instances can be acquired through
* the EntityCreator interface.
*
* Clients acquire a named ITargetableObjectPtr by calling getTarget(). This
* always succeeds - if the named ITargetableObject is not found,
* always succeeds - if the named ITargetableObject is not found,
* a new, empty one is created.
*
* ITargetableObject object (can be empty)
Expand Down Expand Up @@ -363,7 +426,7 @@ class IEntitySettings

virtual bool getFreeObjectRotation() const = 0;
virtual void setFreeObjectRotation(bool value) = 0;

virtual bool getShowEntityAngles() const = 0;
virtual void setShowEntityAngles(bool value) = 0;

Expand Down
30 changes: 19 additions & 11 deletions include/inode.h
Expand Up @@ -78,10 +78,12 @@ class NodeVisitor
virtual void post(const INodePtr& node) {}
};

/**
* greebo: Abstract definition of a Node, a basic element
* of the scenegraph. All nodes share a certain set of
* functionality, like Layer functionality or being a Renderable.
/**
* \brief Main interface for a Node, a basic element of the scenegraph.
*
* All nodes share a certain set of functionality, such as being placed in
* layers, being able to render themselves, and being able to hold and
* transform a list of child nodes.
*/
class INode :
public Layered,
Expand Down Expand Up @@ -116,7 +118,7 @@ class INode :
* Set the scenegraph this node is belonging to. This is usually
* set by the scenegraph itself during insertion.
*/
virtual void setSceneGraph(const GraphPtr& sceneGraph) = 0;
virtual void setSceneGraph(const GraphPtr& sceneGraph) = 0;

/** greebo: Returns true, if the node is the root element
* of the scenegraph.
Expand Down Expand Up @@ -166,7 +168,7 @@ class INode :
virtual bool hasChildNodes() const = 0;

/**
* greebo: Traverses this node and all child nodes (recursively)
* greebo: Traverses this node and all child nodes (recursively)
* using the given visitor.
*
* Note: replaces the legacy Node_traverseSubgraph() method.
Expand All @@ -187,11 +189,11 @@ class INode :

/**
* Call the given functor for each child node, depth first
* This is a simpler alternative to the usual traverse() method
* This is a simpler alternative to the usual traverse() method
* which provides pre() and post() methods and more control about
* which nodes to traverse and. This forEachNode() routine simply
* which nodes to traverse and. This forEachNode() routine simply
* hits every child node including their children.
*
*
* @returns: true if the functor returned false on any of the
* visited nodes. The return type is used to pass the stop signal
* up the stack during traversal.
Expand Down Expand Up @@ -236,15 +238,21 @@ class INode :
// Returns the bounds in world coordinates
virtual const AABB& worldAABB() const = 0;

// Returns the transformation from local to world coordinates
/**
* \brief Return the transformation from local to world coordinates
*
* This represents the final transformation from this node's own coordinate
* space into world space, including any transformations inherited from
* parent nodes.
*/
virtual const Matrix4& localToWorld() const = 0;

// Undo/Redo events - some nodes need to do extra legwork after undo or redo
// This is called by the TraversableNodeSet after a undo/redo operation
// not by the UndoSystem itself, at least not yet.
virtual void onPostUndo() {}
virtual void onPostRedo() {}

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

0 comments on commit f2ac15d

Please sign in to comment.