Skip to content

Commit

Permalink
Merge remote-tracking branch 'greebo/master'
Browse files Browse the repository at this point in the history
Integrate various important changes including the portable map format and
select-by-filter functionality.
  • Loading branch information
Matthew Mott committed Apr 9, 2020
2 parents 543a3bc + eae81b8 commit ff1006e
Show file tree
Hide file tree
Showing 230 changed files with 7,306 additions and 3,192 deletions.
4 changes: 2 additions & 2 deletions PKGBUILD
@@ -1,14 +1,14 @@
# Maintainer: codereader <greebo[AT]angua[DOT]at>
pkgname=darkradiant
pkgver=2.7.0
pkgver=2.8.0
pkgrel=1
pkgdesc="Level Editor for Doom 3 (idTech4) and The Dark Mod"
arch=("x86_64")
url="https://www.darkradiant.net/"
license=("GPL")
depends=(wxgtk ftgl glew freealut libvorbis python libsigc++ pybind11)
makedepends=(git boost)
source=("$pkgname::git+https://github.com/codereader/DarkRadiant.git#tag=2.7.0")
source=("$pkgname::git+https://github.com/codereader/DarkRadiant.git#tag=2.8.0")
md5sums=("SKIP")

build() {
Expand Down
8 changes: 6 additions & 2 deletions configure.ac
@@ -1,4 +1,4 @@
AC_INIT([darkradiant], [2.7.0])
AC_INIT([darkradiant], [2.8.0])
AM_INIT_AUTOMAKE([subdir-objects])
AM_SILENT_RULES([yes])

Expand Down Expand Up @@ -215,7 +215,11 @@ then
AC_CHECK_PROGS([PYTHON_CONFIG], [python-config], [])
if test ! -z "$PYTHON_CONFIG"
then
PYTHON_LIBS=`$PYTHON_CONFIG --libs`
# Python 3.8 requires the --embed switch to produce working linker flags
PC_PYTHON_VERIFY_VERSION([>=], [3.8.0],
[PYTHON_LIBS=`$PYTHON_CONFIG --libs --embed`],
[PYTHON_LIBS=`$PYTHON_CONFIG --libs`])

PYTHON_CPPFLAGS=`$PYTHON_CONFIG --includes`
PYBIND11_CPPFLAGS=``

Expand Down
46 changes: 2 additions & 44 deletions include/icommandsystem.h
Expand Up @@ -202,50 +202,8 @@ typedef std::vector<Argument> ArgumentList;
*/
typedef std::function<void (const ArgumentList&)> Function;

// A command signature consists just of arguments, no return types
class Signature :
public std::vector<std::size_t>
{
public:
Signature()
{}

// Additional convenience constructors
Signature(std::size_t type1)
{
push_back(type1);
}

Signature(std::size_t type1, std::size_t type2)
{
push_back(type1);
push_back(type2);
}

Signature(std::size_t type1, std::size_t type2, std::size_t type3)
{
push_back(type1);
push_back(type2);
push_back(type3);
}

Signature(std::size_t type1, std::size_t type2, std::size_t type3, std::size_t type4)
{
push_back(type1);
push_back(type2);
push_back(type3);
push_back(type4);
}

Signature(std::size_t type1, std::size_t type2, std::size_t type3, std::size_t type4, std::size_t type5)
{
push_back(type1);
push_back(type2);
push_back(type3);
push_back(type4);
push_back(type5);
}
};
// A command signature consists just of arguments, return type is always void
typedef std::vector<std::size_t> Signature;

/**
* greebo: Auto-completion information returned by the CommandSystem
Expand Down
3 changes: 3 additions & 0 deletions include/ieventmanager.h
Expand Up @@ -170,6 +170,9 @@ class IEventManager :
virtual void enableEvent(const std::string& eventName) = 0;
virtual void disableEvent(const std::string& eventName) = 0;

// Renames the given command, keeping accelerator bindings intact
virtual void renameEvent(const std::string& oldEventName, const std::string& newEventName) = 0;

// Removes the given event and disconnects all accelerators from it
virtual void removeEvent(const std::string& eventName) = 0;

Expand Down
1 change: 1 addition & 0 deletions include/ifiletypes.h
Expand Up @@ -75,6 +75,7 @@ namespace filetype

// Some well-known file type constants
const char* const TYPE_MAP = "map";
const char* const TYPE_MAP_EXPORT = "mapexport";
const char* const TYPE_PREFAB = "prefab";
const char* const TYPE_REGION = "region";
const char* const TYPE_MODEL_EXPORT = "modelexport";
Expand Down
22 changes: 6 additions & 16 deletions include/ifilter.h
Expand Up @@ -70,17 +70,6 @@ class FilterRule
};
typedef std::vector<FilterRule> FilterRules;

/** Visitor interface for evaluating the available filters in the
* FilterSystem.
*/
struct IFilterVisitor
{
virtual ~IFilterVisitor() {}

// Visit function
virtual void visit(const std::string& filterName) = 0;
};

const char* const MODULE_FILTERSYSTEM = "FilterSystem";

// Forward declaration
Expand Down Expand Up @@ -113,13 +102,13 @@ class FilterSystem :
*/
virtual void updateSubgraph(const scene::INodePtr& root) = 0;

/** Visit the available filters, passing each filter's text
* name to the visitor.
/**
* Visit the available filters, passing each filter's text name to the visitor.
*
* @param visitor
* Visitor class implementing the IFilterVisitor interface.
* Function object called with the filter name as argument.
*/
virtual void forEachFilter(IFilterVisitor& visitor) = 0;
virtual void forEachFilter(const std::function<void(const std::string& name)>& func) = 0;

/** Set the state of the named filter.
*
Expand Down Expand Up @@ -217,7 +206,8 @@ class FilterSystem :
virtual bool setFilterRules(const std::string& filter, const FilterRules& ruleSet) = 0;
};

inline FilterSystem& GlobalFilterSystem() {
inline FilterSystem& GlobalFilterSystem()
{
// Cache the reference locally
static FilterSystem& _filterSystem(
*std::static_pointer_cast<FilterSystem>(
Expand Down
48 changes: 48 additions & 0 deletions include/ikeyvaluestore.h
@@ -0,0 +1,48 @@
#pragma once

#include <string>
#include <functional>

/**
* Interface for an object supporting storage of string-valued
* properties which can be accessed by a key.
* The key is treated case-sensitively.
* It's not possible to store empty strings in the store.
*/
class IKeyValueStore
{
public:
virtual ~IKeyValueStore() {}

/**
* Retrieves a property value from the store. This will return an empty string
* if the property doesn't exist.
*/
virtual std::string getProperty(const std::string& key) const = 0;

/**
* Store a value in the map root's property store. DarkRadiant will persist
* these values in the Info file when saving and restore them on loading.
* Other map formats without info file are free to use that information
* when exporting map data.
* Setting a key to an empty string is equivalent to removing it from the store.
*/
virtual void setProperty(const std::string& key, const std::string& value) = 0;

/**
* Removes a property from the value store, if it exists. This is equivalent
* to setting a property value to an empty string.
*/
virtual void removeProperty(const std::string& key) = 0;

/**
* Iterates over the property store, hitting the visitor with each value pair.
*/
virtual void foreachProperty(const std::function<void (const std::string&, const std::string&)>& visitor) const = 0;

/**
* Removes all properties from this store
*/
virtual void clearProperties() = 0;
};

30 changes: 21 additions & 9 deletions include/ilayer.h
Expand Up @@ -43,7 +43,7 @@ class Layered
/**
* Return the set of layers to which this object is assigned.
*/
virtual LayerList getLayers() const = 0;
virtual const LayerList& getLayers() const = 0;

/**
* greebo: This assigns the given node to the given set of layers. Any previous
Expand All @@ -53,10 +53,13 @@ class Layered
virtual void assignToLayers(const LayerList& newLayers) = 0;
};

class ILayerSystem :
public RegisterableModule
class ILayerManager
{
public:
typedef std::shared_ptr<ILayerManager> Ptr;

virtual ~ILayerManager() {}

/**
* greebo: Creates a new layer with the given name.
*
Expand Down Expand Up @@ -201,17 +204,26 @@ class ILayerSystem :
virtual sigc::signal<void> signal_nodeMembershipChanged() = 0;
};

class ILayerModule :
public RegisterableModule
{
public:
virtual ~ILayerModule() {}

virtual ILayerManager::Ptr createLayerManager() = 0;
};

} // namespace scene

const std::string MODULE_LAYERSYSTEM("LayerSystem");
const char* const MODULE_LAYERS("LayerModule");

inline scene::ILayerSystem& GlobalLayerSystem()
inline scene::ILayerModule& GlobalLayerModule()
{
// Cache the reference locally
static scene::ILayerSystem& _layerSystem(
*std::static_pointer_cast<scene::ILayerSystem>(
module::GlobalModuleRegistry().getModule(MODULE_LAYERSYSTEM)
static scene::ILayerModule& _layerModule(
*std::static_pointer_cast<scene::ILayerModule>(
module::GlobalModuleRegistry().getModule(MODULE_LAYERS)
)
);
return _layerSystem;
return _layerModule;
}
2 changes: 1 addition & 1 deletion include/ilightnode.h
Expand Up @@ -18,7 +18,7 @@ class ILightNode
/**
* greebo: Get the AABB of the Light "Diamond" representation.
*/
virtual AABB getSelectAABB() = 0;
virtual AABB getSelectAABB() const = 0;
};
typedef std::shared_ptr<ILightNode> ILightNodePtr;

Expand Down
33 changes: 30 additions & 3 deletions include/imap.h
Expand Up @@ -2,6 +2,7 @@

#include "imodule.h"
#include "inode.h"
#include "ikeyvaluestore.h"
#include <sigc++/signal.h>

// Registry setting for suppressing the map load progress dialog
Expand All @@ -17,6 +18,15 @@ class IMapFileChangeTracker;
// see ientity.h
class ITargetManager;

// see ilayer.h
class ILayerManager;

namespace selection
{
class ISelectionSetManager;
class ISelectionGroupManager;
}

namespace scene
{

Expand All @@ -25,7 +35,8 @@ namespace scene
* It also owns the namespace of the corresponding map.
*/
class IMapRootNode :
public virtual INode
public virtual INode,
public virtual IKeyValueStore
{
public:
virtual ~IMapRootNode() {}
Expand All @@ -35,6 +46,16 @@ class IMapRootNode :
*/
virtual const INamespacePtr& getNamespace() = 0;

/**
* Access the selection group manager of this hierarchy.
*/
virtual selection::ISelectionGroupManager& getSelectionGroupManager() = 0;

/**
* Gives access to the selectionset manager in this scene.
*/
virtual selection::ISelectionSetManager& getSelectionSetManager() = 0;

/**
* Returns the target manager keeping track of all
* the named targets in the map.
Expand All @@ -47,6 +68,11 @@ class IMapRootNode :
* up to date or not.
*/
virtual IMapFileChangeTracker& getUndoChangeTracker() = 0;

/**
* Provides methods to create and assign layers in this map.
*/
virtual ILayerManager& getLayerManager() = 0;
};
typedef std::shared_ptr<IMapRootNode> IMapRootNodePtr;

Expand Down Expand Up @@ -102,10 +128,11 @@ class IMap :
};
typedef std::shared_ptr<IMap> IMapPtr;

const std::string MODULE_MAP("Map");
const char* const MODULE_MAP("Map");

// Application-wide Accessor to the currently active map
inline IMap& GlobalMapModule() {
inline IMap& GlobalMapModule()
{
// Cache the reference locally
static IMap& _mapModule(
*std::static_pointer_cast<IMap>(
Expand Down

0 comments on commit ff1006e

Please sign in to comment.