Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enabled template resolution for the tmxrasterizer application. #3977

Merged
merged 5 commits into from
Jun 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
* tmxrasterizer: Added --frames and --frame-duration arguments to export animated maps as multiple images (#3868)
* tmxrasterizer: Fixed --hide/show-layer to work on group layers (#3899)
* tmxviewer: Added support for viewing JSON maps (#3866)
* tmxrasterizer/viewer: Fixed loading of XML object templates (with Christian Schaadt, #3977)
* AutoMapping: Ignore empty outputs per-rule (#3523)
* Automapping: Added per-input-layer properties for ignoring flip flags (#3803)
* AutoMapping: Always apply output sets with empty index
Expand Down
2 changes: 2 additions & 0 deletions src/libtiled/libtiled.qbs
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,8 @@ DynamicLibrary {
"tilesetformat.h",
"tilesetmanager.cpp",
"tilesetmanager.h",
"tmxmapformat.cpp",
"tmxmapformat.h",
"varianttomapconverter.cpp",
"varianttomapconverter.h",
"wangset.cpp",
Expand Down
31 changes: 19 additions & 12 deletions src/tiled/tmxmapformat.cpp → src/libtiled/tmxmapformat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,35 @@
* tmxmapformat.cpp
* Copyright 2008-2015, Thorbjørn Lindeijer <[email protected]>
*
* This file is part of Tiled.
* This file is part of libtiled.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation; either version 2 of the License, or (at your option)
* any later version.
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
* EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

#include "tmxmapformat.h"

#include "map.h"
#include "mapreader.h"
#include "mapwriter.h"
#include "tilesetmanager.h"

#include <QBuffer>
#include <QDir>
Expand Down
38 changes: 23 additions & 15 deletions src/tiled/tmxmapformat.h → src/libtiled/tmxmapformat.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,35 @@
* tmxmapformat.h
* Copyright 2008-2015, Thorbjørn Lindeijer <[email protected]>
*
* This file is part of Tiled.
* This file is part of libtiled.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation; either version 2 of the License, or (at your option)
* any later version.
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
* EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

#pragma once

#include "mapformat.h"
#include "objecttemplateformat.h"
#include "tilededitor_global.h"
#include "tiled_global.h"
#include "tilesetformat.h"

namespace Tiled {
Expand All @@ -33,7 +41,7 @@ class MapObject;
/**
* A reader and writer for Tiled's .tmx map format.
*/
class TILED_EDITOR_EXPORT TmxMapFormat : public MapFormat
class TILEDSHARED_EXPORT TmxMapFormat : public MapFormat
{
Q_OBJECT
Q_INTERFACES(Tiled::MapFormat)
Expand Down Expand Up @@ -77,7 +85,7 @@ class TILED_EDITOR_EXPORT TmxMapFormat : public MapFormat
/**
* A reader and writer for Tiled's .tsx tileset format.
*/
class TILED_EDITOR_EXPORT TsxTilesetFormat : public TilesetFormat
class TILEDSHARED_EXPORT TsxTilesetFormat : public TilesetFormat
{
Q_OBJECT
Q_INTERFACES(Tiled::TilesetFormat)
Expand All @@ -104,7 +112,7 @@ class TILED_EDITOR_EXPORT TsxTilesetFormat : public TilesetFormat
/**
* A reader and writer for Tiled's .tx template format.
*/
class TILED_EDITOR_EXPORT XmlObjectTemplateFormat : public ObjectTemplateFormat
class TILEDSHARED_EXPORT XmlObjectTemplateFormat : public ObjectTemplateFormat
{
Q_OBJECT
Q_INTERFACES(Tiled::ObjectTemplateFormat)
Expand Down
2 changes: 0 additions & 2 deletions src/tiled/libtilededitor.qbs
Original file line number Diff line number Diff line change
Expand Up @@ -541,8 +541,6 @@ DynamicLibrary {
"tilestampmodel.h",
"tilestampsdock.cpp",
"tilestampsdock.h",
"tmxmapformat.cpp",
"tmxmapformat.h",
"toolmanager.cpp",
"toolmanager.h",
"transformmapobjects.cpp",
Expand Down
5 changes: 5 additions & 0 deletions src/tmxrasterizer/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

#include "pluginmanager.h"
#include "tmxrasterizer.h"
#include "tmxmapformat.h"

#include <QCommandLineParser>
#include <QDebug>
Expand All @@ -53,6 +54,10 @@ int main(int argc, char *argv[])

PluginManager::instance()->loadPlugins();

// Necessary to enable loading of object templates in XML format
XmlObjectTemplateFormat xmlObjectTemplateFormat;
PluginManager::addObject(&xmlObjectTemplateFormat);
bjorn marked this conversation as resolved.
Show resolved Hide resolved

QCommandLineParser parser;
parser.setApplicationDescription(QCoreApplication::translate("main", "Renders a Tiled map or world to an image."));
parser.addHelpOption();
Expand Down
5 changes: 5 additions & 0 deletions src/tmxviewer/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@

#include "pluginmanager.h"
#include "tiled.h"
#include "tmxmapformat.h"

#include <QApplication>
#include <QCommandLineParser>
Expand Down Expand Up @@ -60,6 +61,10 @@ int main(int argc, char *argv[])

Tiled::PluginManager::instance()->loadPlugins();

// Necessary to enable loading of object templates in XML format
Tiled::XmlObjectTemplateFormat xmlObjectTemplateFormat;
Tiled::PluginManager::addObject(&xmlObjectTemplateFormat);

QCommandLineParser parser;
parser.setApplicationDescription(QCoreApplication::translate("main", "Displays a Tiled map."));
parser.addHelpOption();
Expand Down