diff --git a/binaries/data/tools/atlas/lists.xml b/binaries/data/tools/atlas/lists.xml index 534a56487c7..a46f7821f95 100644 --- a/binaries/data/tools/atlas/lists.xml +++ b/binaries/data/tools/atlas/lists.xml @@ -24,6 +24,10 @@ props_fancy + + baseTex + + idle walk diff --git a/source/tools/atlas/AtlasUI/ActorEditor/ActorEditorListCtrl.cpp b/source/tools/atlas/AtlasUI/ActorEditor/ActorEditorListCtrl.cpp index 21d5d89652c..a1d97dcddb8 100644 --- a/source/tools/atlas/AtlasUI/ActorEditor/ActorEditorListCtrl.cpp +++ b/source/tools/atlas/AtlasUI/ActorEditor/ActorEditorListCtrl.cpp @@ -20,6 +20,7 @@ #include "ActorEditorListCtrl.h" #include "AnimListEditor.h" +#include "TexListEditor.h" #include "PropListEditor.h" #include "AtlasObject/AtlasObject.h" @@ -48,8 +49,8 @@ ActorEditorListCtrl::ActorEditorListCtrl(wxWindow* parent) AddColumnType(_("Variant"), 90, "@name", new FieldEditCtrl_Text()); AddColumnType(_("Ratio"), 50, "@frequency", new FieldEditCtrl_Text()); AddColumnType(_("Model"), 140, "mesh", new FieldEditCtrl_File(_T("art/meshes/"), _("Mesh files (*.pmd, *.dae)|*.pmd;*.dae|All files (*.*)|*.*"))); - AddColumnType(_("Texture"), 140, "texture", new FieldEditCtrl_File(_T("art/textures/skins/"), _("All files (*.*)|*.*"))); // could be dds, or tga, or png, or bmp, etc, so just allow * - AddColumnType(_("Animations"), 250, "animations", new FieldEditCtrl_Dialog(&AnimListEditor::Create)); + AddColumnType(_("Textures"), 250, "textures", new FieldEditCtrl_Dialog(&TexListEditor::Create)); + AddColumnType(_("Animations"), 250, "animations", new FieldEditCtrl_Dialog(&AnimListEditor::Create)); AddColumnType(_("Props"), 220, "props", new FieldEditCtrl_Dialog(&PropListEditor::Create)); AddColumnType(_("Colour"), 80, "colour", new FieldEditCtrl_Colour()); } @@ -108,7 +109,7 @@ wxListItemAttr* ActorEditorListCtrl::OnGetItemAttr(long item) const if (row["mesh"].hasContent()) return const_cast(&m_ListItemAttr_Model[item%2]); - else if (row["texture"].hasContent()) + else if (row["textures"].hasContent()) return const_cast(&m_ListItemAttr_Texture[item%2]); else if (row["animations"].hasContent()) return const_cast(&m_ListItemAttr_Anim[item%2]); diff --git a/source/tools/atlas/AtlasUI/ActorEditor/TexListEditor.cpp b/source/tools/atlas/AtlasUI/ActorEditor/TexListEditor.cpp new file mode 100644 index 00000000000..de2462aeb52 --- /dev/null +++ b/source/tools/atlas/AtlasUI/ActorEditor/TexListEditor.cpp @@ -0,0 +1,83 @@ +/* Copyright (C) 2009 Wildfire Games. + * This file is part of 0 A.D. + * + * 0 A.D. 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. + * + * 0 A.D. 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. + * + * You should have received a copy of the GNU General Public License + * along with 0 A.D. If not, see . + */ + +#include "precompiled.h" + +#include "TexListEditor.h" + +#include "EditableListCtrl/FieldEditCtrl.h" +#include "AtlasObject/AtlasObject.h" + +////////////////////////////////////////////////////////////////////////// + +TexListEditor::TexListEditor(wxWindow* parent) + : AtlasDialog(parent, _("Texture editor"), wxSize(480, 280)) +{ + m_MainListBox = new TexListEditorListCtrl(m_MainPanel); + + wxBoxSizer* sizer = new wxBoxSizer(wxVERTICAL); + sizer->Add(m_MainListBox, + wxSizerFlags().Proportion(1).Expand().Border(wxALL, 5)); + + m_MainPanel->SetSizer(sizer); +} + +void TexListEditor::ThawData(AtObj& in) +{ + m_MainListBox->ThawData(in); +} + +AtObj TexListEditor::FreezeData() +{ + return m_MainListBox->FreezeData(); +} + +void TexListEditor::ImportData(AtObj& in) +{ + m_MainListBox->ImportData(in); +} + +AtObj TexListEditor::ExportData() +{ + return m_MainListBox->ExportData(); +} + +////////////////////////////////////////////////////////////////////////// + +TexListEditorListCtrl::TexListEditorListCtrl(wxWindow* parent) +: DraggableListCtrl(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, + wxLC_REPORT | wxLC_HRULES | wxLC_VRULES | wxLC_SINGLE_SEL) +{ + AddColumnType(_("Tex name"), 100, "@name", new FieldEditCtrl_List("textures")); + AddColumnType(_("File"), 200, "@file", new FieldEditCtrl_File(_T("art/textures/skins/"), _("All files (*.*)|*.*"))); // could be dds, or tga, or png, or bmp, etc, so just allow * +} + +void TexListEditorListCtrl::DoImport(AtObj& in) +{ + for (AtIter prop = in["texture"]; prop.defined(); ++prop) + AddRow(prop); + + UpdateDisplay(); +} + +AtObj TexListEditorListCtrl::DoExport() +{ + AtObj out; + for (size_t i = 0; i < m_ListData.size(); ++i) + out.add("texture", m_ListData[i]); + return out; +} diff --git a/source/tools/atlas/AtlasUI/ActorEditor/TexListEditor.h b/source/tools/atlas/AtlasUI/ActorEditor/TexListEditor.h new file mode 100644 index 00000000000..c4f42344d37 --- /dev/null +++ b/source/tools/atlas/AtlasUI/ActorEditor/TexListEditor.h @@ -0,0 +1,56 @@ +/* Copyright (C) 2009 Wildfire Games. + * This file is part of 0 A.D. + * + * 0 A.D. 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. + * + * 0 A.D. 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. + * + * You should have received a copy of the GNU General Public License + * along with 0 A.D. If not, see . + */ + +#include "Windows/AtlasDialog.h" + +#include "DraggableListCtrl/DraggableListCtrl.h" + +class TexListEditorListCtrl; + +////////////////////////////////////////////////////////////////////////// + +class TexListEditor : public AtlasDialog +{ +public: + TexListEditor(wxWindow* parent); + static AtlasDialog* Create(wxWindow* parent) { return new TexListEditor(parent); } + +protected: + AtObj FreezeData(); + void ThawData(AtObj& in); + + AtObj ExportData(); + void ImportData(AtObj& in); + +private: + TexListEditorListCtrl* m_MainListBox; +}; + +////////////////////////////////////////////////////////////////////////// + +class TexListEditorListCtrl : public DraggableListCtrl +{ + friend class TexListEditor; + +public: + TexListEditorListCtrl(wxWindow* parent); + + void OnUpdate(wxCommandEvent& event); + + void DoImport(AtObj& in); + AtObj DoExport(); +};