* added filter api to create new filters from within plugins

* TTimo, please have a look at the mainframe.cpp part


git-svn-id: svn://svn.icculus.org/gtkradiant/GtkRadiant/branches/ZeroRadiant@208 8a3a26a2-13c4-0310-b231-cf6edde360e5
This commit is contained in:
mattn 2008-03-16 09:42:56 +00:00
parent ed9b7a9265
commit eaa3e3169f
5 changed files with 36 additions and 8 deletions

View file

@ -30,6 +30,10 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "stdafx.h" #include "stdafx.h"
// type 1 = texture filter (name)
// type 3 = entity filter (name)
// type 2 = QER_* shader flags
// type 4 = entity classes
bfilter_t *FilterAdd(bfilter_t *pFilter, int type, int bmask, char *str, int exclude) bfilter_t *FilterAdd(bfilter_t *pFilter, int type, int bmask, char *str, int exclude)
{ {
bfilter_t *pNew = new bfilter_t; bfilter_t *pNew = new bfilter_t;
@ -44,6 +48,21 @@ bfilter_t *FilterAdd(bfilter_t *pFilter, int type, int bmask, char *str, int exc
return pNew; return pNew;
} }
bfilter_t *FilterCreate (int type, int bmask, char *str, int exclude)
{
g_qeglobals.d_savedinfo.filters = FilterAdd(g_qeglobals.d_savedinfo.filters, type, bmask, str, exclude);
Syn_Printf("Added filter %s (type: %i, bmask: %i, exclude: %i)\n", str, type, bmask, exclude);
return g_qeglobals.d_savedinfo.filters;
}
extern void PerformFiltering();
void FiltersActivate (void)
{
PerformFiltering();
Sys_UpdateWindows(W_XY|W_CAMERA);
}
// removes the filter list at *pFilter, returns NULL pointer // removes the filter list at *pFilter, returns NULL pointer
bfilter_t *FilterListDelete(bfilter_t *pFilter) bfilter_t *FilterListDelete(bfilter_t *pFilter)
{ {

View file

@ -22,6 +22,8 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#ifndef _FILTERS_H_ #ifndef _FILTERS_H_
#define _FILTERS_H_ #define _FILTERS_H_
void FiltersActivate(void);
bfilter_t *FilterCreate(int type, int bmask, char *str, int exclude);
bfilter_t *FilterAdd(bfilter_t *pFilter, int type, int bmask, char *str, int exclude); bfilter_t *FilterAdd(bfilter_t *pFilter, int type, int bmask, char *str, int exclude);
bfilter_t *FilterListDelete(bfilter_t *pFilter); bfilter_t *FilterListDelete(bfilter_t *pFilter);
bfilter_t *FilterUpdate(bfilter_t *pFilter); bfilter_t *FilterUpdate(bfilter_t *pFilter);

View file

@ -7474,10 +7474,14 @@ void PerformFiltering ()
{ {
brush_t *brush; brush_t *brush;
// mattn - this should be removed - otherwise the filters from the
// plugins are wiped away with each update
#if 1
// spog - deletes old filters list and creates new one when // spog - deletes old filters list and creates new one when
// g_qeglobals.d_savedinfo.exclude is updated // g_qeglobals.d_savedinfo.exclude is updated
g_qeglobals.d_savedinfo.filters = FilterListDelete(g_qeglobals.d_savedinfo.filters); g_qeglobals.d_savedinfo.filters = FilterListDelete(g_qeglobals.d_savedinfo.filters);
g_qeglobals.d_savedinfo.filters = FilterUpdate(g_qeglobals.d_savedinfo.filters); g_qeglobals.d_savedinfo.filters = FilterUpdate(g_qeglobals.d_savedinfo.filters);
#endif
for ( brush = active_brushes.next; brush != &active_brushes; brush = brush->next ) for ( brush = active_brushes.next; brush != &active_brushes; brush = brush->next )
brush->bFiltered = FilterBrush( brush ); brush->bFiltered = FilterBrush( brush );

View file

@ -43,6 +43,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "pluginmanager.h" #include "pluginmanager.h"
#include "plugin.h" #include "plugin.h"
#include "missing.h" #include "missing.h"
#include "filters.h"
#include "version.h" #include "version.h"
@ -2228,6 +2229,8 @@ bool CSynapseClientRadiant::RequestAPI(APIDescriptor_t *pAPI)
pTable->m_pfnGetFileTypeRegistry = &GetFileTypeRegistry; pTable->m_pfnGetFileTypeRegistry = &GetFileTypeRegistry;
pTable->m_pfnReadProjectKey = &QERApp_ReadProjectKey; pTable->m_pfnReadProjectKey = &QERApp_ReadProjectKey;
pTable->m_pfnGetMapName = &QERApp_GetMapName; pTable->m_pfnGetMapName = &QERApp_GetMapName;
pTable->m_pfnFilterAdd = &FilterCreate;
pTable->m_pfnFiltersActivate = &FiltersActivate;
return true; return true;
} }