Ticket #1022: Atlas-ActorViewer-PlayerColour(1022).patch

File Atlas-ActorViewer-PlayerColour(1022).patch, 3.2 KB (added by Mitchell K, 12 years ago)
  • source/tools/atlas/AtlasUI/ScenarioEditor/Sections/Object/Object.cpp

     
    9797
    9898struct ObjectSidebarImpl
    9999{
    100     ObjectSidebarImpl() :
     100    ObjectSidebarImpl(ScenarioEditor& scenarioEditor) :
    101101        m_ObjectListBox(NULL), m_ActorViewerActive(false),
    102         m_ActorViewerEntity(_T("actor|structures/fndn_1x1.xml")), m_ActorViewerAnimation(_T("idle")), m_ActorViewerSpeed(0.f)
     102        m_ActorViewerEntity(_T("actor|structures/fndn_1x1.xml")),
     103        m_ActorViewerAnimation(_T("idle")), m_ActorViewerSpeed(0.f),
     104        m_ObjectSettings(scenarioEditor.GetObjectSettings())
    103105    {
    104106    }
    105107
     
    111113    wxString m_ActorViewerEntity;
    112114    wxString m_ActorViewerAnimation;
    113115    float m_ActorViewerSpeed;
     116    ObjectSettings& m_ObjectSettings;
    114117
    115118    void ActorViewerPostToGame()
    116119    {
    117         POST_MESSAGE(SetActorViewer, ((std::wstring)m_ActorViewerEntity.wc_str(), (std::wstring)m_ActorViewerAnimation.wc_str(), m_ActorViewerSpeed, false));
     120        POST_MESSAGE(SetActorViewer, ((std::wstring)m_ActorViewerEntity.wc_str(), (std::wstring)m_ActorViewerAnimation.wc_str(), m_ObjectSettings.GetPlayerID(), m_ActorViewerSpeed, false));
    118121    }
    119122};
    120123
     
    124127    wxWindow* bottomBarContainer
    125128)
    126129    : Sidebar(scenarioEditor, sidebarContainer, bottomBarContainer),
    127       p(new ObjectSidebarImpl())
     130      p(new ObjectSidebarImpl(scenarioEditor))
    128131{
    129132    wxBoxSizer* sizer = new wxBoxSizer(wxHORIZONTAL);
    130133    sizer->Add(new wxStaticText(this, wxID_ANY, _("Filter")), wxSizerFlags().Align(wxALIGN_CENTER));
  • source/tools/atlas/GameInterface/Messages.h

     
    340340MESSAGE(SetActorViewer,
    341341        ((std::wstring, id))
    342342        ((std::wstring, animation))
     343        ((int, playerId))
    343344        ((float, speed))
    344345        ((bool, flushcache)) // true => unload all actor files before starting the preview (because we don't have proper hotloading yet)
    345346        );
  • source/tools/atlas/GameInterface/Handlers/GraphicsSetupHandlers.cpp

     
    3434#include "ps/GameSetup/Config.h"
    3535#include "ps/GameSetup/GameSetup.h"
    3636#include "renderer/Renderer.h"
     37#include "simulation2/components/ICmpOwnership.h"
     38#include "simulation2/Simulation2.h"
    3739
    3840namespace AtlasMessage {
    3941
     
    154156    }
    155157    AtlasView::GetView_Actor()->SetSpeedMultiplier(msg->speed);
    156158    AtlasView::GetView_Actor()->GetActorViewer().SetActor(*msg->id, *msg->animation);
     159   
     160    AtlasViewActor* view = AtlasView::GetView_Actor();
     161    CmpPtr<ICmpOwnership> cmpOwnership(*view->GetSimulation2(), view->GetActorViewer().GetEntity());
     162    if (cmpOwnership)
     163        cmpOwnership->SetOwner(msg->playerId);
    157164}
    158165
    159166//////////////////////////////////////////////////////////////////////////