[LYN-3457] Removed the LensFlareEditor.
This commit is contained in:
@@ -36,7 +36,6 @@ void RegisterReflectedVarHandlers()
|
||||
EBUS_EVENT(AzToolsFramework::PropertyTypeRegistrationMessages::Bus, RegisterPropertyType, aznew LocalStringPropertyHandler());
|
||||
EBUS_EVENT(AzToolsFramework::PropertyTypeRegistrationMessages::Bus, RegisterPropertyType, aznew LightAnimationPropertyHandler());
|
||||
EBUS_EVENT(AzToolsFramework::PropertyTypeRegistrationMessages::Bus, RegisterPropertyType, aznew UserPopupWidgetHandler());
|
||||
EBUS_EVENT(AzToolsFramework::PropertyTypeRegistrationMessages::Bus, RegisterPropertyType, aznew LensFlareHandler());
|
||||
EBUS_EVENT(AzToolsFramework::PropertyTypeRegistrationMessages::Bus, RegisterPropertyType, aznew ColorCurveHandler());
|
||||
EBUS_EVENT(AzToolsFramework::PropertyTypeRegistrationMessages::Bus, RegisterPropertyType, aznew FloatCurveHandler());
|
||||
EBUS_EVENT(AzToolsFramework::PropertyTypeRegistrationMessages::Bus, RegisterPropertyType, aznew MotionPropertyWidgetHandler());
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
// Editor
|
||||
#include "GenericSelectItemDialog.h"
|
||||
#include "QtViewPaneManager.h"
|
||||
#include "LensFlareEditor/LensFlareEditor.h"
|
||||
|
||||
|
||||
UserPropertyEditor::UserPropertyEditor(QWidget *pParent /*= nullptr*/)
|
||||
@@ -147,79 +146,6 @@ bool UserPopupWidgetHandler::ReadValuesIntoGUI(size_t index, UserPropertyEditor*
|
||||
|
||||
#include <Controls/ReflectedPropertyControl/moc_PropertyMiscCtrl.cpp>
|
||||
|
||||
LensFlarePropertyWidget::LensFlarePropertyWidget(QWidget *pParent /*= nullptr*/)
|
||||
:QWidget(pParent)
|
||||
{
|
||||
m_valueEdit = new QLineEdit;
|
||||
|
||||
QToolButton *mainButton = new QToolButton;
|
||||
mainButton->setText("D");
|
||||
connect(mainButton, &QToolButton::clicked, this, &LensFlarePropertyWidget::OnEditClicked);
|
||||
connect(m_valueEdit, &QLineEdit::editingFinished, m_valueEdit, [this] () {emit ValueChanged(m_valueEdit->text());});
|
||||
|
||||
QHBoxLayout *mainLayout = new QHBoxLayout(this);
|
||||
mainLayout->addWidget(m_valueEdit, 1);
|
||||
mainLayout->addWidget(mainButton);
|
||||
mainLayout->setContentsMargins(1, 1, 1, 1);
|
||||
}
|
||||
|
||||
void LensFlarePropertyWidget::SetValue(const QString &value)
|
||||
{
|
||||
m_valueEdit->setText(value);
|
||||
}
|
||||
|
||||
QString LensFlarePropertyWidget::GetValue() const
|
||||
{
|
||||
return m_valueEdit->text();
|
||||
}
|
||||
|
||||
void LensFlarePropertyWidget::OnEditClicked()
|
||||
{
|
||||
const QtViewPane *lensFlarePane = GetIEditor()->OpenView(CLensFlareEditor::s_pLensFlareEditorClassName);
|
||||
if (!lensFlarePane)
|
||||
return;
|
||||
|
||||
CLensFlareEditor *editor = FindViewPane<CLensFlareEditor>(QtUtil::ToQString(CLensFlareEditor::s_pLensFlareEditorClassName));
|
||||
if (editor)
|
||||
QTimer::singleShot(0, editor, SLOT(OnUpdateTreeCtrl()));
|
||||
}
|
||||
|
||||
QWidget* LensFlareHandler::CreateGUI(QWidget *pParent)
|
||||
{
|
||||
LensFlarePropertyWidget* newCtrl = aznew LensFlarePropertyWidget(pParent);
|
||||
connect(newCtrl, &LensFlarePropertyWidget::ValueChanged, newCtrl, [newCtrl]()
|
||||
{
|
||||
EBUS_EVENT(AzToolsFramework::PropertyEditorGUIMessages::Bus, RequestWrite, newCtrl);
|
||||
});
|
||||
|
||||
return newCtrl;
|
||||
}
|
||||
|
||||
void LensFlareHandler::ConsumeAttribute(LensFlarePropertyWidget* GUI, AZ::u32 attrib, AzToolsFramework::PropertyAttributeReader* attrValue, const char* debugName)
|
||||
{
|
||||
Q_UNUSED(GUI); Q_UNUSED(attrib); Q_UNUSED(attrValue); Q_UNUSED(debugName);
|
||||
}
|
||||
|
||||
void LensFlareHandler::WriteGUIValuesIntoProperty(size_t index, LensFlarePropertyWidget* GUI, property_t& instance, AzToolsFramework::InstanceDataNode* node)
|
||||
{
|
||||
Q_UNUSED(index);
|
||||
Q_UNUSED(node);
|
||||
CReflectedVarGenericProperty val = instance;
|
||||
val.m_value = GUI->GetValue().toUtf8().data();
|
||||
instance = static_cast<property_t>(val);
|
||||
}
|
||||
|
||||
bool LensFlareHandler::ReadValuesIntoGUI(size_t index, LensFlarePropertyWidget* GUI, const property_t& instance, AzToolsFramework::InstanceDataNode* node)
|
||||
{
|
||||
Q_UNUSED(index);
|
||||
Q_UNUSED(node);
|
||||
CReflectedVarGenericProperty val = instance;
|
||||
GUI->SetValue(val.m_value.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
QWidget* FloatCurveHandler::CreateGUI(QWidget *pParent)
|
||||
{
|
||||
CSplineCtrl *cSpline = new CSplineCtrl(pParent);
|
||||
|
||||
@@ -70,39 +70,6 @@ public:
|
||||
|
||||
};
|
||||
|
||||
|
||||
class LensFlarePropertyWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
AZ_CLASS_ALLOCATOR(LensFlarePropertyWidget, AZ::SystemAllocator, 0);
|
||||
LensFlarePropertyWidget(QWidget *pParent = nullptr);
|
||||
|
||||
void SetValue(const QString &value);
|
||||
QString GetValue() const;
|
||||
|
||||
void OnEditClicked();
|
||||
|
||||
signals:
|
||||
void ValueChanged(const QString &value);
|
||||
|
||||
private:
|
||||
QLineEdit *m_valueEdit;
|
||||
};
|
||||
|
||||
class LensFlareHandler : public QObject, public AzToolsFramework::PropertyHandler < CReflectedVarGenericProperty, LensFlarePropertyWidget>
|
||||
{
|
||||
public:
|
||||
AZ_CLASS_ALLOCATOR(LensFlareHandler, AZ::SystemAllocator, 0);
|
||||
bool IsDefaultHandler() const override { return false; }
|
||||
QWidget* CreateGUI(QWidget *pParent) override;
|
||||
|
||||
AZ::u32 GetHandlerName(void) const override { return AZ_CRC("ePropertyFlare", 0x5ce803df); }
|
||||
void ConsumeAttribute(LensFlarePropertyWidget* GUI, AZ::u32 attrib, AzToolsFramework::PropertyAttributeReader* attrValue, const char* debugName) override;
|
||||
void WriteGUIValuesIntoProperty(size_t index, LensFlarePropertyWidget* GUI, property_t& instance, AzToolsFramework::InstanceDataNode* node) override;
|
||||
bool ReadValuesIntoGUI(size_t index, LensFlarePropertyWidget* GUI, const property_t& instance, AzToolsFramework::InstanceDataNode* node) override;
|
||||
};
|
||||
|
||||
class FloatCurveHandler : public QObject, public AzToolsFramework::PropertyHandler < CReflectedVarSpline, CSplineCtrl>
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -279,7 +279,6 @@ void ReflectedPropertyItem::SetVariable(IVariable *var)
|
||||
case ePropertyLocalString:
|
||||
case ePropertyLightAnimation:
|
||||
case ePropertyParticleName:
|
||||
case ePropertyFlare:
|
||||
m_reflectedVarAdapter = new ReflectedVarGenericPropertyAdapter(desc.m_type);
|
||||
break;
|
||||
case ePropertyTexture:
|
||||
|
||||
@@ -308,8 +308,6 @@ AZ::u32 CReflectedVarGenericProperty::handler()
|
||||
return AZ_CRC("ePropertyLightAnimation", 0x277097da);
|
||||
case ePropertyParticleName:
|
||||
return AZ_CRC("ePropertyParticleName", 0xf44c7133);
|
||||
case ePropertyFlare:
|
||||
return AZ_CRC("ePropertyFlare", 0x5ce803df);
|
||||
default:
|
||||
AZ_Assert(false, "No property handlers defined for the property type");
|
||||
return AZ_CRC("Default", 0xe35e00df);
|
||||
|
||||
@@ -52,7 +52,6 @@
|
||||
#include "ActionManager.h"
|
||||
#include "Include/IObjectManager.h"
|
||||
#include "Material/MaterialManager.h"
|
||||
#include "LensFlareEditor/LensFlareManager.h"
|
||||
#include "ErrorReportDialog.h"
|
||||
#include "SurfaceTypeValidator.h"
|
||||
#include "ShaderCache.h"
|
||||
@@ -360,8 +359,6 @@ void CCryEditDoc::Save(TDocMultiArchive& arrXmlAr)
|
||||
SerializeMissions(arrXmlAr, currentMissionName, false);
|
||||
//! Serialize material manager.
|
||||
GetIEditor()->GetMaterialManager()->Serialize((*arrXmlAr[DMAS_GENERAL]).root, (*arrXmlAr[DMAS_GENERAL]).bLoading);
|
||||
//! Serialize LensFlare manager.
|
||||
GetIEditor()->GetLensFlareManager()->Serialize((*arrXmlAr[DMAS_GENERAL]).root, (*arrXmlAr[DMAS_GENERAL]).bLoading);
|
||||
|
||||
SerializeShaderCache((*arrXmlAr[DMAS_GENERAL_NAMED_DATA]));
|
||||
SerializeNameSelection((*arrXmlAr[DMAS_GENERAL]));
|
||||
@@ -524,14 +521,6 @@ void CCryEditDoc::Load(TDocMultiArchive& arrXmlAr, const QString& szFilename)
|
||||
GetIEditor()->GetMaterialManager()->Serialize((*arrXmlAr[DMAS_GENERAL]).root, (*arrXmlAr[DMAS_GENERAL]).bLoading);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Load LensFlares.
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
{
|
||||
CAutoLogTime logtime("Load Flares");
|
||||
GetIEditor()->GetLensFlareManager()->Serialize((*arrXmlAr[DMAS_GENERAL]).root, (*arrXmlAr[DMAS_GENERAL]).bLoading);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Load View Settings
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,250 +0,0 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
// Original file Copyright Crytek GMBH or its affiliates, used under license.
|
||||
|
||||
#pragma once
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// Crytek Engine Source File.
|
||||
// Copyright (C), Crytek Studios, 2011.
|
||||
// -------------------------------------------------------------------------
|
||||
// File name: DatabaseFrameWnd.h
|
||||
// Created: 10/Dec/2012 by Jaesik.
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
#ifndef CRYINCLUDE_EDITOR_DATABASEFRAMEWND_H
|
||||
#define CRYINCLUDE_EDITOR_DATABASEFRAMEWND_H
|
||||
|
||||
#if !defined(Q_MOC_RUN)
|
||||
#include <AzToolsFramework/AssetBrowser/AssetSelectionModel.h>
|
||||
#include <AzQtComponents/Components/DockMainWindow.h>
|
||||
#include "Undo/IUndoManagerListener.h"
|
||||
#include "BaseLibrary.h"
|
||||
|
||||
#include <QMainWindow>
|
||||
#include <QAbstractItemModel>
|
||||
#include <QAbstractListModel>
|
||||
#include <QScopedPointer>
|
||||
#endif
|
||||
|
||||
class QComboBox;
|
||||
class QTreeView;
|
||||
class QMimeData;
|
||||
|
||||
class CBaseLibraryItem;
|
||||
class CBaseLibraryManager;
|
||||
|
||||
class LibraryListModel;
|
||||
class LibraryItemTreeModel;
|
||||
|
||||
namespace Ui {
|
||||
class DatabaseFrameWnd;
|
||||
}
|
||||
|
||||
class CDatabaseFrameWnd
|
||||
: public AzQtComponents::DockMainWindow
|
||||
, public IEditorNotifyListener
|
||||
, public IUndoManagerListener
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
CDatabaseFrameWnd(CBaseLibraryManager* pItemManager, QWidget* pParent = nullptr);
|
||||
virtual ~CDatabaseFrameWnd();
|
||||
|
||||
enum SortRecursionType
|
||||
{
|
||||
SORT_RECURSION_NONE = 1,
|
||||
SORT_RECURSION_ITEM = 2,
|
||||
SORT_RECURSION_FULL = 9999
|
||||
};
|
||||
|
||||
virtual void ReloadLibs();
|
||||
virtual void ReloadItems();
|
||||
virtual void SelectLibrary(const QString& library, bool bForceSelect = false);
|
||||
virtual void SelectLibrary(CBaseLibrary* pItem, bool bForceSelect = false);
|
||||
virtual void SelectItem(CBaseLibraryItem* item, bool bForceReload = false);
|
||||
|
||||
virtual CBaseLibrary* FindLibrary(const QString& libraryName);
|
||||
virtual CBaseLibrary* NewLibrary(const QString& libraryName);
|
||||
virtual void DeleteLibrary(CBaseLibrary* pLibrary);
|
||||
virtual void DeleteItem(CBaseLibraryItem* pItem);
|
||||
|
||||
virtual void ReleasePreviewControl(){}
|
||||
|
||||
virtual bool SetItemName(CBaseLibraryItem* item, const QString& groupName, const QString& itemName);
|
||||
|
||||
void DoesItemExist(const QString& itemName, bool& bOutExist) const;
|
||||
void DoesGroupExist(const QString& groupName, bool& bOutExist) const;
|
||||
|
||||
virtual void OnEditorNotifyEvent(EEditorNotifyEvent event) override;
|
||||
|
||||
void SignalNumUndoRedo(const unsigned int& numUndo, const unsigned int& numRedo) override;
|
||||
|
||||
QString GetSelectedLibraryName() const;
|
||||
|
||||
virtual const char* GetClassName() = 0;
|
||||
|
||||
protected:
|
||||
int GetComboBoxIndex(CBaseLibrary* pLibrary);
|
||||
|
||||
virtual void OnInitDialog() = 0;
|
||||
|
||||
void showEvent(QShowEvent* event) override;
|
||||
|
||||
void OnUndo();
|
||||
void OnRedo();
|
||||
|
||||
virtual void OnAddLibrary();
|
||||
virtual void OnRemoveLibrary();
|
||||
virtual void OnAddItem();
|
||||
virtual void OnRemoveItem();
|
||||
virtual void OnRenameItem();
|
||||
virtual void OnChangedLibrary();
|
||||
virtual void OnExportLibrary();
|
||||
virtual void OnSave();
|
||||
virtual void OnReloadLib();
|
||||
virtual void OnLoadLibrary();
|
||||
|
||||
void OnSelChangedItemTree(const QModelIndex& index);
|
||||
bool eventFilter(QObject* watched, QEvent* event);
|
||||
|
||||
virtual void OnCopy() = 0;
|
||||
virtual void OnPaste() = 0;
|
||||
virtual void OnCut();
|
||||
virtual void OnClone();
|
||||
|
||||
void InitTreeCtrl();
|
||||
|
||||
virtual AssetSelectionModel GetAssetSelectionModel() const = 0;
|
||||
|
||||
void LoadLibrary();
|
||||
|
||||
QString MakeValidName(const QString& candidateName, AZStd::function<void(const QString&, bool&)> cb) const;
|
||||
|
||||
virtual QTreeView* GetTreeCtrl() = 0;
|
||||
virtual const QTreeView* GetTreeCtrl() const = 0;
|
||||
|
||||
private:
|
||||
LibraryListModel* m_pLibraryListModel;
|
||||
QComboBox* m_pLibraryListComboBox;
|
||||
|
||||
bool m_bLibsLoaded;
|
||||
|
||||
protected:
|
||||
LibraryItemTreeModel* m_pLibraryItemTreeModel;
|
||||
|
||||
//! Selected library.
|
||||
_smart_ptr<CBaseLibrary> m_pLibrary;
|
||||
|
||||
//! Last selected Item. (kept here for compatibility reasons)
|
||||
// See comments on m_cpoSelectedLibraryItems for more details.
|
||||
_smart_ptr<CBaseLibraryItem> m_pCurrentItem;
|
||||
|
||||
// A set containing all the currently selected items
|
||||
// (it's disabled for MOST, but not ALL cases).
|
||||
// This should be the new standard way of storing selections as
|
||||
// opposed to the former mean, it allows us to store multiple selections.
|
||||
// The migration to this new style should be done according to the needs
|
||||
// for multiple selection.
|
||||
std::set<CBaseLibraryItem*> m_cpoSelectedLibraryItems;
|
||||
|
||||
//! Pointer to item manager.
|
||||
CBaseLibraryManager* m_pItemManager;
|
||||
SortRecursionType m_sortRecursionType;
|
||||
QString m_selectedGroup;
|
||||
|
||||
QScopedPointer<Ui::DatabaseFrameWnd> ui;
|
||||
|
||||
bool m_initialized;
|
||||
};
|
||||
|
||||
class LibraryListModel
|
||||
: public QAbstractListModel
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
LibraryListModel(CBaseLibraryManager* itemManager, QObject* pParent = nullptr);
|
||||
|
||||
int rowCount(const QModelIndex& parent = {}) const override;
|
||||
QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
|
||||
|
||||
void Reload();
|
||||
|
||||
void clear();
|
||||
|
||||
private:
|
||||
void LibraryModified(bool bModified);
|
||||
|
||||
CBaseLibraryManager* m_pItemManager;
|
||||
};
|
||||
|
||||
class LibraryItemTreeModel
|
||||
: public QAbstractItemModel
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
using Group = std::pair<QString, std::vector<CBaseLibraryItem*> >;
|
||||
|
||||
public:
|
||||
LibraryItemTreeModel(CDatabaseFrameWnd* pParent);
|
||||
|
||||
QModelIndex parent(const QModelIndex& index) const override;
|
||||
QModelIndex index(int row, int column, const QModelIndex& parent = {}) const override;
|
||||
QModelIndex index(CBaseLibraryItem* pItem) const;
|
||||
|
||||
int rowCount(const QModelIndex& parent) const override;
|
||||
int columnCount(const QModelIndex& parent) const override;
|
||||
|
||||
Qt::ItemFlags flags(const QModelIndex& index) const override;
|
||||
QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
|
||||
bool setData(const QModelIndex& index, const QVariant& value, int role = Qt::EditRole) override;
|
||||
|
||||
bool removeRows(int row, int count, const QModelIndex& parent = {}) override;
|
||||
|
||||
QStringList mimeTypes() const override;
|
||||
bool dropMimeData(const QMimeData* data, Qt::DropAction action, int row, int column, const QModelIndex& parent) override;
|
||||
QMimeData* mimeData(const QModelIndexList& indexes) const override;
|
||||
|
||||
Qt::DropActions supportedDragActions() const override;
|
||||
Qt::DropActions supportedDropActions() const override;
|
||||
|
||||
void Clear();
|
||||
|
||||
void Reload(CBaseLibrary* library);
|
||||
|
||||
void Add(CBaseLibraryItem* item);
|
||||
bool Remove(CBaseLibraryItem* item);
|
||||
|
||||
void Rename(CBaseLibraryItem* item, const QString& groupName, const QString& shortName);
|
||||
|
||||
std::vector<CBaseLibraryItem*> ChildItems(const QModelIndex& index) const;
|
||||
|
||||
QString GetFullName(const QModelIndex& index) const;
|
||||
|
||||
QModelIndex FindLibraryItemByFullName(const QString& fullName) const;
|
||||
bool DoesGroupExist(const QString& groupName) const;
|
||||
|
||||
signals:
|
||||
void itemRenamed(CBaseLibraryItem* item, const QString& prevFullName);
|
||||
|
||||
protected:
|
||||
void RenameItem(CBaseLibraryItem* item, const QString& fullName);
|
||||
QString MakeValidName(const Group& group, const QString& baseName) const;
|
||||
bool MoveItem(CBaseLibraryItem* item, const QModelIndex& parent);
|
||||
|
||||
CDatabaseFrameWnd* m_dialog;
|
||||
|
||||
std::map<QString, std::shared_ptr<Group> > m_groups;
|
||||
};
|
||||
|
||||
Q_DECLARE_METATYPE(CBaseLibrary*)
|
||||
|
||||
#endif // CRYINCLUDE_EDITOR_DATABASEFRAMEWND_H
|
||||
@@ -1,35 +0,0 @@
|
||||
<RCC>
|
||||
<qresource prefix="/DatabaseFrameWnd">
|
||||
<file alias="db_library_bar_00.png">res/db_library_bar_00.png</file>
|
||||
<file alias="db_library_bar_01.png">res/db_library_bar_01.png</file>
|
||||
<file alias="db_library_bar_02.png">res/db_library_bar_02.png</file>
|
||||
<file alias="db_library_bar_03.png">res/db_library_bar_03.png</file>
|
||||
<file alias="db_library_bar_04.png">res/db_library_bar_04.png</file>
|
||||
<file alias="db_library_bar_05.png">res/db_library_bar_05.png</file>
|
||||
<file alias="db_standart_00.png">res/db_standart_00.png</file>
|
||||
<file alias="db_standart_01.png">res/db_standart_01.png</file>
|
||||
<file alias="db_standart_02.png">res/db_standart_02.png</file>
|
||||
<file alias="db_standart_03.png">res/db_standart_03.png</file>
|
||||
<file alias="db_library_item_bar_00.png">res/db_library_item_bar_00.png</file>
|
||||
<file alias="db_library_item_bar_01.png">res/db_library_item_bar_01.png</file>
|
||||
<file alias="db_library_item_bar_02.png">res/db_library_item_bar_02.png</file>
|
||||
<file alias="db_library_item_bar_03.png">res/db_library_item_bar_03.png</file>
|
||||
<file alias="db_library_item_bar_04.png">res/db_library_item_bar_04.png</file>
|
||||
<file alias="db_library_item_bar_05.png">res/db_library_item_bar_05.png</file>
|
||||
<file alias="db_library_open.svg">res/db_library_open.svg</file>
|
||||
<file alias="db_library_save.svg">res/db_library_save.svg</file>
|
||||
<file alias="db_library_add.svg">res/db_library_add.svg</file>
|
||||
<file alias="db_library_delete.svg">res/db_library_delete.svg</file>
|
||||
<file alias="db_library_refresh.svg">res/db_library_refresh.svg</file>
|
||||
<file alias="db_library_undo.svg">res/db_library_undo.svg</file>
|
||||
<file alias="db_library_redo.svg">res/db_library_redo.svg</file>
|
||||
<file alias="db_library_copy.svg">res/db_library_copy.svg</file>
|
||||
<file alias="db_library_paste.svg">res/db_library_paste.svg</file>
|
||||
<file alias="db_library_additem.svg">res/db_library_additem.svg</file>
|
||||
<file alias="db_library_cloneitem.svg">res/db_library_cloneitem.svg</file>
|
||||
<file alias="db_library_removeitem.svg">res/db_library_removeitem.svg</file>
|
||||
<file alias="db_library_assignitem.svg">res/db_library_assignitem.svg</file>
|
||||
<file alias="db_library_getproperties.svg">res/db_library_getproperties.svg</file>
|
||||
<file alias="db_library_reload.svg">res/db_library_reload.svg</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
@@ -1,279 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>DatabaseFrameWnd</class>
|
||||
<widget class="QMainWindow" name="DatabaseFrameWnd">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>633</width>
|
||||
<height>42</height>
|
||||
</rect>
|
||||
</property>
|
||||
<widget class="QToolBar" name="m_toolBar">
|
||||
<property name="windowTitle">
|
||||
<string>Lens Flare Toolbar</string>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>32</width>
|
||||
<height>32</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="floatable">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<attribute name="toolBarArea">
|
||||
<enum>TopToolBarArea</enum>
|
||||
</attribute>
|
||||
<attribute name="toolBarBreak">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
<addaction name="actionDBLoadLib"/>
|
||||
<addaction name="actionDBSave"/>
|
||||
<addaction name="actionDBAddLib"/>
|
||||
<addaction name="actionDBDelLib"/>
|
||||
<addaction name="actionDBReloadLib"/>
|
||||
</widget>
|
||||
<widget class="QToolBar" name="m_toolBar2">
|
||||
<property name="windowTitle">
|
||||
<string>StandartToolBar</string>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>32</width>
|
||||
<height>32</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="floatable">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<attribute name="toolBarArea">
|
||||
<enum>TopToolBarArea</enum>
|
||||
</attribute>
|
||||
<attribute name="toolBarBreak">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
<addaction name="actionUndo"/>
|
||||
<addaction name="actionRedo"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionDBCopy"/>
|
||||
<addaction name="actionDBPaste"/>
|
||||
</widget>
|
||||
<widget class="QToolBar" name="m_toolBar3">
|
||||
<property name="windowTitle">
|
||||
<string>ItemToolBar</string>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>32</width>
|
||||
<height>32</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="floatable">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<attribute name="toolBarArea">
|
||||
<enum>TopToolBarArea</enum>
|
||||
</attribute>
|
||||
<attribute name="toolBarBreak">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
<addaction name="actionDBAdd"/>
|
||||
<addaction name="actionDBClone"/>
|
||||
<addaction name="actionDBRemove"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionDBAssignToSelection"/>
|
||||
<addaction name="actionDBGetFromSelection"/>
|
||||
<addaction name="actionDBReload"/>
|
||||
</widget>
|
||||
<action name="actionDBLoadLib">
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<normaloff>:/DatabaseFrameWnd/db_library_open.svg</normaloff>:/DatabaseFrameWnd/db_library_open.svg</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Load Library</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Load Library</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionDBSave">
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<normaloff>:/DatabaseFrameWnd/db_library_save.svg</normaloff>:/DatabaseFrameWnd/db_library_save.svg</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Save Modified Libraries</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Save Modified Libraries</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionDBAddLib">
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<normaloff>:/DatabaseFrameWnd/db_library_add.svg</normaloff>:/DatabaseFrameWnd/db_library_add.svg</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Add Library</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Add Library</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionDBDelLib">
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<normaloff>:/DatabaseFrameWnd/db_library_delete.svg</normaloff>:/DatabaseFrameWnd/db_library_delete.svg</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Remove Library</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Remove Library</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionDBReloadLib">
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<normaloff>:/DatabaseFrameWnd/db_library_refresh.svg</normaloff>:/DatabaseFrameWnd/db_library_refresh.svg</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Reload Library</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Reload Library</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionUndo">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<normaloff>:/DatabaseFrameWnd/db_library_undo.svg</normaloff>:/DatabaseFrameWnd/db_library_undo.svg</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Undo last operation</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Undo</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionRedo">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<normaloff>:/DatabaseFrameWnd/db_library_redo.svg</normaloff>:/DatabaseFrameWnd/db_library_redo.svg</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Redo last undo operation</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Redo</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionDBCopy">
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<normaloff>:/DatabaseFrameWnd/db_library_copy.svg</normaloff>:/DatabaseFrameWnd/db_library_copy.svg</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Copy Item</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Copy Item</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionDBPaste">
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<normaloff>:/DatabaseFrameWnd/db_library_paste.svg</normaloff>:/DatabaseFrameWnd/db_library_paste.svg</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Paste Item</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Paste Item</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionDBAdd">
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<normaloff>:/DatabaseFrameWnd/db_library_additem.svg</normaloff>:/DatabaseFrameWnd/db_library_additem.svg</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Add New Item</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Add New Item</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionDBClone">
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<normaloff>:/DatabaseFrameWnd/db_library_cloneitem.svg</normaloff>:/DatabaseFrameWnd/db_library_cloneitem.svg</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Clone Library Item</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Clone Library Item</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionDBRemove">
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<normaloff>:/DatabaseFrameWnd/db_library_removeitem.svg</normaloff>:/DatabaseFrameWnd/db_library_removeitem.svg</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Remove Item</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Remove Item</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionDBAssignToSelection">
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<normaloff>:/DatabaseFrameWnd/db_library_assignitem.svg</normaloff>:/DatabaseFrameWnd/db_library_assignitem.svg</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Assign Item to Selected Objects</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Assign Item to Selected Objects</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionDBGetFromSelection">
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<normaloff>:/DatabaseFrameWnd/db_library_getproperties.svg</normaloff>:/DatabaseFrameWnd/db_library_getproperties.svg</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Get Properties From Selection</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Get Properties From Selection</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionDBReload">
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<normaloff>:/DatabaseFrameWnd/db_library_reload.svg</normaloff>:/DatabaseFrameWnd/db_library_reload.svg</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Reload Item</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Reload Item</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
@@ -34,9 +34,6 @@
|
||||
#include "Objects/ObjectManager.h"
|
||||
|
||||
#include "Objects/EntityObject.h"
|
||||
#include "LensFlareEditor/LensFlareManager.h"
|
||||
#include "LensFlareEditor/LensFlareLibrary.h"
|
||||
#include "LensFlareEditor/LensFlareItem.h"
|
||||
|
||||
#include <AzFramework/Terrain/TerrainDataRequestBus.h>
|
||||
|
||||
@@ -210,7 +207,6 @@ bool CGameExporter::Export(unsigned int flags, [[maybe_unused]] EEndian eExportE
|
||||
|
||||
ExportLevelInfo(sLevelPath);
|
||||
|
||||
ExportLevelLensFlares(sLevelPath);
|
||||
ExportLevelResourceList(sLevelPath);
|
||||
ExportLevelUsedResourceList(sLevelPath);
|
||||
ExportLevelShaderCache(sLevelPath);
|
||||
@@ -554,67 +550,6 @@ void CGameExporter::ExportMaterials(XmlNodeRef& levelDataNode, const QString& pa
|
||||
m_numExportedMaterials = numMtls;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CGameExporter::ExportLevelLensFlares(const QString& path)
|
||||
{
|
||||
GetIEditor()->SetStatusText(QObject::tr("Exporting Lens Flares..."));
|
||||
std::vector<CBaseObject*> objects;
|
||||
GetIEditor()->GetObjectManager()->FindObjectsOfType(&CEntityObject::staticMetaObject, objects);
|
||||
std::set<QString> flareNameSet;
|
||||
for (int i = 0, iObjectSize(objects.size()); i < iObjectSize; ++i)
|
||||
{
|
||||
CEntityObject* pEntity = (CEntityObject*)objects[i];
|
||||
if (!pEntity->IsLight())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
QString flareName = pEntity->GetEntityPropertyString(CEntityObject::s_LensFlarePropertyName);
|
||||
if (flareName.isEmpty() || flareName == "@root")
|
||||
{
|
||||
continue;
|
||||
}
|
||||
flareNameSet.insert(flareName);
|
||||
}
|
||||
|
||||
XmlNodeRef pRootNode = GetIEditor()->GetSystem()->CreateXmlNode("LensFlareList");
|
||||
pRootNode->setAttr("Version", FLARE_EXPORT_FILE_VERSION);
|
||||
|
||||
CLensFlareManager* pLensManager = GetIEditor()->GetLensFlareManager();
|
||||
|
||||
if (CLensFlareLibrary* pLevelLib = (CLensFlareLibrary*)pLensManager->GetLevelLibrary())
|
||||
{
|
||||
for (int i = 0; i < pLevelLib->GetItemCount(); i++)
|
||||
{
|
||||
CLensFlareItem* pItem = (CLensFlareItem*)pLevelLib->GetItem(i);
|
||||
|
||||
if (flareNameSet.find(pItem->GetFullName()) == flareNameSet.end())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
CBaseLibraryItem::SerializeContext ctx(pItem->CreateXmlData(), false);
|
||||
pRootNode->addChild(ctx.node);
|
||||
pItem->Serialize(ctx);
|
||||
flareNameSet.erase(pItem->GetFullName());
|
||||
}
|
||||
}
|
||||
|
||||
std::set<QString>::iterator iFlareNameSet = flareNameSet.begin();
|
||||
for (; iFlareNameSet != flareNameSet.end(); ++iFlareNameSet)
|
||||
{
|
||||
QString flareName = *iFlareNameSet;
|
||||
XmlNodeRef pFlareNode = GetIEditor()->GetSystem()->CreateXmlNode("LensFlare");
|
||||
pFlareNode->setAttr("name", flareName.toUtf8().data());
|
||||
pRootNode->addChild(pFlareNode);
|
||||
}
|
||||
|
||||
CCryMemFile lensFlareNames;
|
||||
lensFlareNames.Write(pRootNode->getXMLData()->GetString(), pRootNode->getXMLData()->GetStringLength());
|
||||
|
||||
QString exportPathName = path + FLARE_EXPORT_FILE;
|
||||
m_levelPak.m_pakFile.UpdateFile(exportPathName.toUtf8().data(), lensFlareNames);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CGameExporter::ExportLevelResourceList(const QString& path)
|
||||
{
|
||||
|
||||
@@ -95,7 +95,6 @@ private:
|
||||
void ExportOcclusionMesh(const char* pszGamePath);
|
||||
void ExportMapInfo(XmlNodeRef& node);
|
||||
|
||||
void ExportLevelLensFlares(const QString& path);
|
||||
void ExportLevelResourceList(const QString& path);
|
||||
void ExportLevelUsedResourceList(const QString& path);
|
||||
void ExportLevelShaderCache(const QString& path);
|
||||
|
||||
@@ -50,7 +50,6 @@ class CMaterialManager;
|
||||
class CMusicManager;
|
||||
class CMaterail;
|
||||
struct IEditorParticleManager;
|
||||
class CLensFlareManager;
|
||||
class CEAXPresetManager;
|
||||
class CErrorReport;
|
||||
class CBaseLibraryItem;
|
||||
@@ -555,8 +554,6 @@ struct IEditor
|
||||
virtual IEditorPanelUtils* GetEditorPanelUtils() = 0;
|
||||
//! Get Music Manager.
|
||||
virtual CMusicManager* GetMusicManager() = 0;
|
||||
//! Get Lens Flare Manager.
|
||||
virtual CLensFlareManager* GetLensFlareManager() = 0;
|
||||
virtual float GetTerrainElevation(float x, float y) = 0;
|
||||
virtual Editor::EditorQtApplication* GetEditorQtApplication() = 0;
|
||||
virtual const QColor& GetColorByName(const QString& name) = 0;
|
||||
|
||||
@@ -60,7 +60,6 @@ AZ_POP_DISABLE_WARNING
|
||||
#include "ToolBox.h"
|
||||
#include "MainWindow.h"
|
||||
#include "Alembic/AlembicCompiler.h"
|
||||
#include "LensFlareEditor/LensFlareManager.h"
|
||||
#include "UIEnumsDatabase.h"
|
||||
#include "Util/Ruler.h"
|
||||
#include "RenderHelpers/AxisHelper.h"
|
||||
@@ -170,7 +169,6 @@ CEditorImpl::CEditorImpl()
|
||||
, m_pToolBoxManager(nullptr)
|
||||
, m_pMaterialManager(nullptr)
|
||||
, m_pMusicManager(nullptr)
|
||||
, m_pLensFlareManager(nullptr)
|
||||
, m_pErrorReport(nullptr)
|
||||
, m_pLasLoadedLevelErrorReport(nullptr)
|
||||
, m_pErrorsDlg(nullptr)
|
||||
@@ -230,7 +228,6 @@ CEditorImpl::CEditorImpl()
|
||||
m_pAnimationContext = new CAnimationContext;
|
||||
|
||||
m_pImageUtil = new CImageUtil_impl();
|
||||
m_pLensFlareManager = new CLensFlareManager;
|
||||
m_pResourceSelectorHost.reset(CreateResourceSelectorHost());
|
||||
m_pRuler = new CRuler;
|
||||
m_selectedRegion.min = Vec3(0, 0, 0);
|
||||
|
||||
@@ -42,7 +42,6 @@ class CUndoManager;
|
||||
class CGameEngine;
|
||||
class CExportManager;
|
||||
class CErrorsDlg;
|
||||
class CLensFlareManager;
|
||||
class CIconManager;
|
||||
class CBackgroundTaskManager;
|
||||
class CTrackViewSequenceManager;
|
||||
@@ -183,7 +182,6 @@ public:
|
||||
IDataBaseManager* GetDBItemManager(EDataBaseItemType itemType);
|
||||
CMaterialManager* GetMaterialManager() { return m_pMaterialManager; }
|
||||
CMusicManager* GetMusicManager() { return m_pMusicManager; };
|
||||
CLensFlareManager* GetLensFlareManager() { return m_pLensFlareManager; };
|
||||
|
||||
IBackgroundTaskManager* GetBackgroundTaskManager() override;
|
||||
IBackgroundScheduleManager* GetBackgroundScheduleManager() override;
|
||||
@@ -384,7 +382,6 @@ protected:
|
||||
CMaterialManager* m_pMaterialManager;
|
||||
CAlembicCompiler* m_pAlembicCompiler;
|
||||
CMusicManager* m_pMusicManager;
|
||||
CLensFlareManager* m_pLensFlareManager;
|
||||
CErrorReport* m_pErrorReport;
|
||||
//! Contains the error reports for the last loaded level.
|
||||
CErrorReport* m_pLasLoadedLevelErrorReport;
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
// Original file Copyright Crytek GMBH or its affiliates, used under license.
|
||||
|
||||
#ifndef CRYINCLUDE_EDITOR_LENSFLAREEDITOR_ILENSFLARELISTENER_H
|
||||
#define CRYINCLUDE_EDITOR_LENSFLAREEDITOR_ILENSFLARELISTENER_H
|
||||
#pragma once
|
||||
|
||||
class CLensFlareItem;
|
||||
class CLensFlareElement;
|
||||
|
||||
class ILensFlareChangeItemListener
|
||||
{
|
||||
public:
|
||||
virtual void OnLensFlareChangeItem(CLensFlareItem* pLensFlareItem) = 0;
|
||||
virtual void OnLensFlareDeleteItem(CLensFlareItem* pLensFlareItem) = 0;
|
||||
};
|
||||
|
||||
class ILensFlareChangeElementListener
|
||||
{
|
||||
public:
|
||||
virtual void OnLensFlareChangeElement(CLensFlareElement* pLensFlareElement) = 0;
|
||||
};
|
||||
#endif // CRYINCLUDE_EDITOR_LENSFLAREEDITOR_ILENSFLARELISTENER_H
|
||||
@@ -1,326 +0,0 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
// Original file Copyright Crytek GMBH or its affiliates, used under license.
|
||||
|
||||
#include "EditorDefs.h"
|
||||
|
||||
#include "LensFlareAtomicList.h"
|
||||
|
||||
// Qt
|
||||
#include <QScrollBar>
|
||||
#include <QMimeData>
|
||||
|
||||
// Editor
|
||||
#include "LensFlareUtil.h"
|
||||
#include "Util/Image.h"
|
||||
#include "Util/ImageUtil.h"
|
||||
|
||||
|
||||
struct QLensFlareAtomicListModel::Item
|
||||
{
|
||||
QString text;
|
||||
QSize size;
|
||||
QPixmap pixmap;
|
||||
EFlareType flareType;
|
||||
};
|
||||
|
||||
CLensFlareAtomicList::CLensFlareAtomicList(QWidget* parent)
|
||||
: CImageListCtrl(parent)
|
||||
, m_model(new QLensFlareAtomicListModel(this))
|
||||
{
|
||||
setDragEnabled(true);
|
||||
setDragDropMode(DragOnly);
|
||||
setModel(m_model.data());
|
||||
}
|
||||
|
||||
CLensFlareAtomicList::~CLensFlareAtomicList()
|
||||
{
|
||||
}
|
||||
|
||||
QModelIndex QLensFlareAtomicListModel::InsertItem(const FlareInfo& flareInfo)
|
||||
{
|
||||
Item* pPreviewItem = new Item;
|
||||
|
||||
if (flareInfo.imagename)
|
||||
{
|
||||
CImageEx* pImage = new CImageEx();
|
||||
if (CImageUtil::LoadImage(flareInfo.imagename, *pImage))
|
||||
{
|
||||
pImage->SwapRedAndBlue();
|
||||
pPreviewItem->size = QSize(pImage->GetWidth(), pImage->GetHeight());
|
||||
QImage img(reinterpret_cast<const uchar*>(pImage->GetData()), pImage->GetWidth(), pImage->GetHeight(), QImage::Format_RGB32);
|
||||
pPreviewItem->pixmap = QPixmap::fromImage(img.copy());
|
||||
}
|
||||
|
||||
delete pImage;
|
||||
}
|
||||
|
||||
if (pPreviewItem->pixmap.isNull())
|
||||
{
|
||||
pPreviewItem->pixmap = QPixmap(":/water.png");
|
||||
pPreviewItem->size = QSize(64, 64);
|
||||
}
|
||||
|
||||
pPreviewItem->text = flareInfo.name;
|
||||
pPreviewItem->flareType = flareInfo.type;
|
||||
|
||||
const int row = m_items.count();
|
||||
beginInsertRows(QModelIndex(), row, row);
|
||||
m_items.append(pPreviewItem);
|
||||
endInsertRows();
|
||||
|
||||
return index(row, 0);
|
||||
}
|
||||
|
||||
void QLensFlareAtomicListModel::Populate()
|
||||
{
|
||||
Clear();
|
||||
const FlareInfoArray::Props array = FlareInfoArray::Get();
|
||||
for (size_t i = 0; i < array.size; ++i)
|
||||
{
|
||||
const FlareInfo& flareInfo(array.p[i]);
|
||||
if (LensFlareUtil::IsElement(flareInfo.type))
|
||||
{
|
||||
InsertItem(flareInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CLensFlareAtomicList::FillAtomicItems()
|
||||
{
|
||||
if (m_model)
|
||||
{
|
||||
m_model->Populate();
|
||||
}
|
||||
}
|
||||
|
||||
void CLensFlareAtomicList::updateGeometries()
|
||||
{
|
||||
ClearItemGeometries();
|
||||
|
||||
if (!model())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const int rowCount = model()->rowCount();
|
||||
|
||||
const int nPageHorz = viewport()->width();
|
||||
const int nPageVert = viewport()->height();
|
||||
|
||||
if (nPageHorz == 0 || nPageVert == 0 || rowCount <= 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const QSize& borderSize = BorderSize();
|
||||
int x = borderSize.width();
|
||||
int y = borderSize.height();
|
||||
|
||||
QSize itemSize = ItemSize();
|
||||
const int nTextHeight = fontMetrics().height();
|
||||
const int xMax = nPageHorz - borderSize.width();
|
||||
int itemHeightMax = 0;
|
||||
|
||||
for (int row = 0; row < rowCount; ++row)
|
||||
{
|
||||
QModelIndex index = m_model->index(row, 0);
|
||||
itemSize = index.data(Qt::SizeHintRole).toSize();
|
||||
|
||||
if ((x + itemSize.width()) > xMax)
|
||||
{
|
||||
y += itemHeightMax + borderSize.height() + nTextHeight;
|
||||
x = borderSize.width();
|
||||
itemHeightMax = 0;
|
||||
}
|
||||
|
||||
if (itemSize.height() > itemHeightMax)
|
||||
{
|
||||
itemHeightMax = itemSize.height();
|
||||
}
|
||||
|
||||
SetItemGeometry(index, QRect(QPoint(x, y), itemSize));
|
||||
|
||||
x += itemSize.width() + borderSize.width();
|
||||
}
|
||||
|
||||
verticalScrollBar()->setPageStep(viewport()->height());
|
||||
verticalScrollBar()->setRange(0, (y + itemHeightMax - viewport()->height()));
|
||||
}
|
||||
|
||||
QLensFlareAtomicListModel::QLensFlareAtomicListModel(QObject* parent)
|
||||
: QAbstractListModel(parent)
|
||||
{
|
||||
}
|
||||
|
||||
QLensFlareAtomicListModel::~QLensFlareAtomicListModel()
|
||||
{
|
||||
}
|
||||
|
||||
void QLensFlareAtomicListModel::Clear()
|
||||
{
|
||||
qDeleteAll(m_items);
|
||||
m_items.clear();
|
||||
}
|
||||
|
||||
int QLensFlareAtomicListModel::rowCount(const QModelIndex& parent) const
|
||||
{
|
||||
if (parent.isValid())
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
return m_items.count();
|
||||
}
|
||||
|
||||
QVariant QLensFlareAtomicListModel::data(const QModelIndex& index, int role) const
|
||||
{
|
||||
Item* item;
|
||||
if (!index.isValid())
|
||||
{
|
||||
return QVariant();
|
||||
}
|
||||
else
|
||||
{
|
||||
item = ItemFromIndex(index);
|
||||
if (!item)
|
||||
{
|
||||
return QVariant();
|
||||
}
|
||||
}
|
||||
|
||||
switch (role)
|
||||
{
|
||||
case Qt::DisplayRole:
|
||||
case Qt::EditRole:
|
||||
return item->text;
|
||||
|
||||
case Qt::SizeHintRole:
|
||||
return item->size;
|
||||
|
||||
case Qt::DecorationRole:
|
||||
return item->pixmap;
|
||||
|
||||
case Qt::UserRole:
|
||||
return item->flareType;
|
||||
}
|
||||
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
bool QLensFlareAtomicListModel::setData(const QModelIndex& index, const QVariant& value, int role)
|
||||
{
|
||||
Item* item;
|
||||
if (index.isValid())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
item = ItemFromIndex(index);
|
||||
if (!item)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
switch (role)
|
||||
{
|
||||
case Qt::EditRole:
|
||||
item->text = value.toString();
|
||||
break;
|
||||
|
||||
case Qt::DecorationRole:
|
||||
item->pixmap = value.value<QPixmap>();
|
||||
break;
|
||||
|
||||
case Qt::SizeHintRole:
|
||||
item->size = value.toSize();
|
||||
break;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
||||
emit dataChanged(index, index, QVector<int>() << role);
|
||||
return false;
|
||||
}
|
||||
|
||||
Qt::ItemFlags QLensFlareAtomicListModel::flags(const QModelIndex& index) const
|
||||
{
|
||||
return QAbstractItemModel::flags(index) | Qt::ItemIsEditable | Qt::ItemIsDragEnabled;
|
||||
}
|
||||
|
||||
EFlareType QLensFlareAtomicListModel::FlareTypeFromIndex(QModelIndex index) const
|
||||
{
|
||||
Item* item;
|
||||
if (!index.isValid())
|
||||
{
|
||||
return eFT_Max;
|
||||
}
|
||||
else
|
||||
{
|
||||
item = ItemFromIndex(index);
|
||||
if (!item)
|
||||
{
|
||||
return eFT_Max;
|
||||
}
|
||||
}
|
||||
|
||||
return item->flareType;
|
||||
}
|
||||
|
||||
QLensFlareAtomicListModel::Item* QLensFlareAtomicListModel::ItemFromIndex(QModelIndex index) const
|
||||
{
|
||||
if (!index.isValid())
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return m_items.at(index.row());
|
||||
}
|
||||
|
||||
QStringList QLensFlareAtomicListModel::mimeTypes() const
|
||||
{
|
||||
return {
|
||||
QStringLiteral("application/x-o3de-flaretypes")
|
||||
};
|
||||
}
|
||||
|
||||
QMimeData* QLensFlareAtomicListModel::mimeData(const QModelIndexList& indexes) const
|
||||
{
|
||||
QMimeData* data = new QMimeData();
|
||||
|
||||
QByteArray encoded;
|
||||
QDataStream stream(&encoded, QIODevice::WriteOnly);
|
||||
|
||||
for (const QModelIndex& index : indexes)
|
||||
{
|
||||
stream << static_cast<int>(FlareTypeFromIndex(index));
|
||||
}
|
||||
|
||||
data->setData(QStringLiteral("application/x-o3de-flaretypes"), encoded);
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
bool QLensFlareAtomicListModel::dropMimeData([[maybe_unused]] const QMimeData* data, [[maybe_unused]] Qt::DropAction action, [[maybe_unused]] int row, [[maybe_unused]] int column, [[maybe_unused]] const QModelIndex& parent)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
Qt::DropActions QLensFlareAtomicListModel::supportedDragActions() const
|
||||
{
|
||||
return Qt::CopyAction;
|
||||
}
|
||||
|
||||
#include <LensFlareEditor/moc_LensFlareAtomicList.cpp>
|
||||
@@ -1,78 +0,0 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
// Original file Copyright Crytek GMBH or its affiliates, used under license.
|
||||
|
||||
#ifndef CRYINCLUDE_EDITOR_LENSFLAREEDITOR_LENSFLAREATOMICLIST_H
|
||||
#define CRYINCLUDE_EDITOR_LENSFLAREEDITOR_LENSFLAREATOMICLIST_H
|
||||
#pragma once
|
||||
|
||||
#if !defined(Q_MOC_RUN)
|
||||
#include "Controls/ImageListCtrl.h"
|
||||
#endif
|
||||
|
||||
#if !defined(Q_MOC_RUN)
|
||||
#include <QAbstractItemModel>
|
||||
#include <QScopedPointer>
|
||||
#endif
|
||||
|
||||
class CLensFlareEditor;
|
||||
class QLensFlareAtomicListModel;
|
||||
|
||||
class CLensFlareAtomicList
|
||||
: public CImageListCtrl
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
CLensFlareAtomicList(QWidget* parent = nullptr);
|
||||
virtual ~CLensFlareAtomicList();
|
||||
|
||||
void FillAtomicItems();
|
||||
|
||||
protected:
|
||||
void updateGeometries() override;
|
||||
|
||||
private:
|
||||
QScopedPointer<QLensFlareAtomicListModel> m_model;
|
||||
};
|
||||
|
||||
class QLensFlareAtomicListModel
|
||||
: public QAbstractListModel
|
||||
{
|
||||
struct Item;
|
||||
Q_OBJECT
|
||||
public:
|
||||
QLensFlareAtomicListModel(QObject* parent = nullptr);
|
||||
~QLensFlareAtomicListModel();
|
||||
|
||||
void Clear();
|
||||
void Populate();
|
||||
|
||||
int rowCount(const QModelIndex& parent = QModelIndex()) const override;
|
||||
QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
|
||||
bool setData(const QModelIndex& index, const QVariant& value, int role = Qt::EditRole) override;
|
||||
Qt::ItemFlags flags(const QModelIndex& index) const override;
|
||||
|
||||
QStringList mimeTypes() const override;
|
||||
QMimeData* mimeData(const QModelIndexList& indexes) const override;
|
||||
bool dropMimeData(const QMimeData* data, Qt::DropAction action, int row, int column, const QModelIndex& parent) override;
|
||||
Qt::DropActions supportedDragActions() const override;
|
||||
|
||||
EFlareType FlareTypeFromIndex(QModelIndex index) const;
|
||||
|
||||
protected:
|
||||
QModelIndex InsertItem(const FlareInfo& flareInfo);
|
||||
Item* ItemFromIndex(QModelIndex index) const;
|
||||
|
||||
private:
|
||||
QVector<Item*> m_items;
|
||||
};
|
||||
#endif // CRYINCLUDE_EDITOR_LENSFLAREEDITOR_LENSFLAREATOMICLIST_H
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,233 +0,0 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
// Original file Copyright Crytek GMBH or its affiliates, used under license.
|
||||
|
||||
#ifndef CRYINCLUDE_EDITOR_LENSFLAREEDITOR_LENSFLAREEDITOR_H
|
||||
#define CRYINCLUDE_EDITOR_LENSFLAREEDITOR_LENSFLAREEDITOR_H
|
||||
#pragma once
|
||||
|
||||
#if !defined(Q_MOC_RUN)
|
||||
#include "DatabaseFrameWnd.h"
|
||||
#include "LensFlareUtil.h"
|
||||
#include "ILensFlareListener.h"
|
||||
#include "LensFlareItemTree.h"
|
||||
#include "UserMessageDefines.h"
|
||||
#endif
|
||||
|
||||
#include <AzQtComponents/Components/DockMainWindow.h>
|
||||
|
||||
namespace AzQtComponents
|
||||
{
|
||||
class FancyDocking;
|
||||
}
|
||||
|
||||
class CLensFlareView;
|
||||
class CLensFlareElementTree;
|
||||
class CLensFlareAtomicList;
|
||||
class CLensFlareElementPropertyView;
|
||||
class CLensFlareItem;
|
||||
class CLensFlareLibrary;
|
||||
class ReflectedPropertyControl;
|
||||
class CLensFlareLightEntityTree;
|
||||
class CLensFlareReferenceTree;
|
||||
|
||||
class CLensFlareEditor
|
||||
: public CDatabaseFrameWnd
|
||||
, public ILensFlareChangeElementListener
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
static const GUID& GetClassID();
|
||||
static void RegisterViewClass();
|
||||
|
||||
CLensFlareEditor(QWidget* pParent = nullptr);
|
||||
~CLensFlareEditor();
|
||||
|
||||
QMenu* createPopupMenu() override;
|
||||
|
||||
// CDatabaseFrameWnd overrides...
|
||||
virtual void SelectItem(CBaseLibraryItem* item, bool bForceReload = false) override;
|
||||
|
||||
CLensFlareItem* GetSelectedLensFlareItem() const;
|
||||
bool GetSelectedLensFlareName(QString& outName) const;
|
||||
void UpdateLensFlareItem(CLensFlareItem* pLensFlareItem);
|
||||
void ResetElementTreeControl();
|
||||
|
||||
CLensFlareLibrary* GetCurrentLibrary() const
|
||||
{
|
||||
if (m_pLibrary == NULL)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
return (CLensFlareLibrary*)&(*m_pLibrary);
|
||||
}
|
||||
|
||||
bool IsExistTreeItem(const QString& name, bool bExclusiveSelectedItem = false);
|
||||
void RenameLensFlareItem(CLensFlareItem* pLensFlareItem, const QString& newGroupName, const QString& newShortName);
|
||||
|
||||
IOpticsElementBasePtr FindOptics(const QString& itemPath, const QString& opticsPath);
|
||||
|
||||
CLensFlareElementTree* GetLensFlareElementTree()
|
||||
{
|
||||
return m_pLensFlareElementTree;
|
||||
}
|
||||
|
||||
CLensFlareView* GetLensFlareView() const
|
||||
{
|
||||
return m_pLensFlareView;
|
||||
}
|
||||
|
||||
CLensFlareItemTree* GetLensFlareItemTree()
|
||||
{
|
||||
return m_LensFlareItemTree;
|
||||
}
|
||||
|
||||
void RemovePropertyItems();
|
||||
|
||||
ReflectedPropertyControl* GetPropertyCtrl()
|
||||
{
|
||||
return m_pWndProps;
|
||||
}
|
||||
|
||||
void UpdateLensOpticsNames(const QString& oldFullName, const QString& newFullName);
|
||||
void SelectItemInLensFlareElementTreeByName(const QString& name);
|
||||
void ReloadItems();
|
||||
|
||||
void RegisterLensFlareItemChangeListener(ILensFlareChangeItemListener* pListener);
|
||||
void UnregisterLensFlareItemChangeListener(ILensFlareChangeItemListener* pListener);
|
||||
|
||||
bool SelectItemByName(const QString& itemName);
|
||||
|
||||
static CLensFlareEditor* GetLensFlareEditor()
|
||||
{
|
||||
return s_pLensFlareEditor;
|
||||
}
|
||||
|
||||
bool GetFullSelectedFlareItemName(QString& outFullName) const
|
||||
{
|
||||
QModelIndexList selected = GetTreeCtrl()->selectionModel()->selectedIndexes();
|
||||
if (selected.isEmpty())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return GetFullLensFlareItemName(selected.first(), outFullName);
|
||||
}
|
||||
|
||||
void SelectLensFlareItem(const QString& fullItemName);
|
||||
|
||||
const char* GetClassName()
|
||||
{
|
||||
return s_pLensFlareEditorClassName;
|
||||
}
|
||||
|
||||
void Paste(XmlNodeRef node);
|
||||
void Paste(const QModelIndex& index, XmlNodeRef node);
|
||||
XmlNodeRef CreateXML(const char* type) const;
|
||||
|
||||
static const char* s_pLensFlareEditorClassName;
|
||||
|
||||
QTreeView* GetTreeCtrl() override
|
||||
{
|
||||
return m_LensFlareItemTree;
|
||||
}
|
||||
|
||||
const QTreeView* GetTreeCtrl() const override
|
||||
{
|
||||
return m_LensFlareItemTree;
|
||||
}
|
||||
|
||||
void AddNewItemByAtomicOptics(const QModelIndex& hSelectedItem, EFlareType flareType);
|
||||
|
||||
public slots:
|
||||
void OnUpdateTreeCtrl();
|
||||
|
||||
protected:
|
||||
static CLensFlareEditor* s_pLensFlareEditor;
|
||||
|
||||
void OnInitDialog() override;
|
||||
|
||||
void OnCopy();
|
||||
void OnPaste();
|
||||
void OnCut();
|
||||
|
||||
void UpdateClipboard(const char* type) const;
|
||||
bool GetClipboardDataList(std::vector<LensFlareUtil::SClipboardData>& outList, QString& outGroupName) const;
|
||||
void OnLensFlareChangeElement(CLensFlareElement* pLensFlareElement);
|
||||
|
||||
void OnAddLibrary();
|
||||
void OnAssignFlareToLightEntities();
|
||||
void OnSelectAssignedObjects();
|
||||
void OnGetFlareFromSelection();
|
||||
void OnRenameItem();
|
||||
void OnAddItem();
|
||||
void OnRemoveItem();
|
||||
void OnCopyNameToClipboard();
|
||||
void OnNotifyTreeRClick();
|
||||
|
||||
void OnTvnItemSelChanged(const QItemSelection& selected, const QItemSelection& deselected);
|
||||
void OnReloadLib();
|
||||
void ReleaseWindowsToBePutIntoPanels();
|
||||
void SelectLensFlareItem(const QModelIndex& hItem);
|
||||
void SelectLensFlareItem(const QModelIndex& hItem, const QModelIndex& hPrevItem);
|
||||
|
||||
void StartEditItem(const QModelIndex& hItem);
|
||||
bool GetFullLensFlareItemName(const QModelIndex& hItem, QString& outFullName) const;
|
||||
AssetSelectionModel GetAssetSelectionModel() const override;
|
||||
|
||||
CLensFlareItem* AddNewLensFlareItem(const QString& groupName, const QString& shortName);
|
||||
QModelIndex GetTreeLensFlareItem(CLensFlareItem* pItem) const;
|
||||
|
||||
void OnItemTreeDataRenamed(CBaseLibraryItem* pItem, const QString& prevFullName);
|
||||
|
||||
enum ESelectedItemStatus
|
||||
{
|
||||
eSIS_Unselected,
|
||||
eSIS_Group,
|
||||
eSIS_Flare
|
||||
};
|
||||
ESelectedItemStatus GetSelectedItemStatus() const;
|
||||
|
||||
void addDockWidget(Qt::DockWidgetArea area, QWidget* widget, const QString& title, bool closable = true);
|
||||
void OnUpdateProperties(IVariable* var);
|
||||
|
||||
private:
|
||||
|
||||
CLensFlareView* m_pLensFlareView;
|
||||
CLensFlareAtomicList* m_pLensFlareAtomicList;
|
||||
CLensFlareElementTree* m_pLensFlareElementTree;
|
||||
ReflectedPropertyControl* m_pWndProps;
|
||||
CLensFlareLightEntityTree* m_pLensFlareLightEntityTree;
|
||||
CLensFlareReferenceTree* m_pLensFlareReferenceTree;
|
||||
CLensFlareItemTree* m_LensFlareItemTree;
|
||||
|
||||
std::vector<ILensFlareChangeItemListener*> m_LensFlareChangeItemListenerList;
|
||||
AzQtComponents::FancyDocking* m_advancedDockManager = nullptr;
|
||||
};
|
||||
|
||||
class LensFlareItemTreeModel
|
||||
: public LibraryItemTreeModel
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
LensFlareItemTreeModel(CDatabaseFrameWnd* pParent);
|
||||
|
||||
Qt::ItemFlags flags(const QModelIndex& index) const override;
|
||||
|
||||
QStringList mimeTypes() const override;
|
||||
bool dropMimeData(const QMimeData* data, Qt::DropAction action, int row, int column, const QModelIndex& parent) override;
|
||||
Qt::DropActions supportedDragActions() const override;
|
||||
Qt::DropActions supportedDropActions() const override;
|
||||
};
|
||||
|
||||
#endif // CRYINCLUDE_EDITOR_LENSFLAREEDITOR_LENSFLAREEDITOR_H
|
||||
@@ -1,381 +0,0 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
// Original file Copyright Crytek GMBH or its affiliates, used under license.
|
||||
|
||||
#include "EditorDefs.h"
|
||||
|
||||
#include "LensFlareElement.h"
|
||||
|
||||
// Editor
|
||||
#include "LensFlareElementTree.h"
|
||||
#include "LensFlareUtil.h"
|
||||
#include "LensFlareItem.h"
|
||||
#include "LensFlareEditor.h"
|
||||
#include "LensFlareView.h"
|
||||
#include "LensFlareLibrary.h"
|
||||
|
||||
|
||||
CLensFlareElement::CLensFlareElement()
|
||||
: m_vars(NULL)
|
||||
, m_pOpticsElement(NULL)
|
||||
, m_pParent(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
CLensFlareElement::~CLensFlareElement()
|
||||
{
|
||||
}
|
||||
|
||||
void CLensFlareElement::OnInternalVariableChange(IVariable* pVar)
|
||||
{
|
||||
IOpticsElementBasePtr pOptics = GetOpticsElement();
|
||||
if (pOptics == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
IFuncVariable* pFuncVar = LensFlareUtil::GetFuncVariable(pOptics, pVar->GetUserData().toInt());
|
||||
if (pFuncVar == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
switch (pVar->GetType())
|
||||
{
|
||||
case IVariable::INT:
|
||||
{
|
||||
int var(0);
|
||||
pVar->Get(var);
|
||||
if (pFuncVar->paramType == e_COLOR)
|
||||
{
|
||||
ColorF color(pFuncVar->GetColorF());
|
||||
color.a = (float)var / 255.0f;
|
||||
pFuncVar->InvokeSetter((void*)&color);
|
||||
}
|
||||
else if (pFuncVar->paramType == e_INT)
|
||||
{
|
||||
if (LensFlareUtil::HaveParameterLowBoundary(pFuncVar->name.c_str()))
|
||||
{
|
||||
LensFlareUtil::BoundaryProcess(var);
|
||||
}
|
||||
pFuncVar->InvokeSetter((void*)&var);
|
||||
if (pFuncVar->GetInt() != var)
|
||||
{
|
||||
pVar->Set(pFuncVar->GetInt());
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case IVariable::BOOL:
|
||||
{
|
||||
if (pFuncVar->paramType == e_BOOL)
|
||||
{
|
||||
bool var;
|
||||
pVar->Get(var);
|
||||
pFuncVar->InvokeSetter((void*)&var);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case IVariable::FLOAT:
|
||||
{
|
||||
if (pFuncVar->paramType == e_FLOAT)
|
||||
{
|
||||
float var;
|
||||
pVar->Get(var);
|
||||
pFuncVar->InvokeSetter((void*)&var);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case IVariable::VECTOR2:
|
||||
{
|
||||
if (pFuncVar->paramType == e_VEC2)
|
||||
{
|
||||
Vec2 var;
|
||||
pVar->Get(var);
|
||||
pFuncVar->InvokeSetter((void*)&var);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case IVariable::VECTOR:
|
||||
{
|
||||
Vec3 var;
|
||||
pVar->Get(var);
|
||||
if (pFuncVar->paramType == e_COLOR)
|
||||
{
|
||||
ColorF color(pFuncVar->GetColorF());
|
||||
color.r = var.x;
|
||||
color.g = var.y;
|
||||
color.b = var.z;
|
||||
pFuncVar->InvokeSetter((void*)&color);
|
||||
}
|
||||
else if (pFuncVar->paramType == e_VEC3)
|
||||
{
|
||||
pFuncVar->InvokeSetter((void*)&var);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case IVariable::VECTOR4:
|
||||
{
|
||||
if (pFuncVar->paramType == e_VEC4)
|
||||
{
|
||||
Vec4 var;
|
||||
pVar->Get(var);
|
||||
pFuncVar->InvokeSetter((void*)&var);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case IVariable::STRING:
|
||||
{
|
||||
QString var;
|
||||
pVar->Get(var);
|
||||
if (pFuncVar->paramType == e_TEXTURE2D || pFuncVar->paramType == e_TEXTURE3D || pFuncVar->paramType == e_TEXTURE_CUBE)
|
||||
{
|
||||
var = var.trimmed();
|
||||
ITexture* pTexture = NULL;
|
||||
if (!var.isEmpty())
|
||||
{
|
||||
pTexture = GetIEditor()->GetRenderer()->EF_LoadTexture(var.toUtf8().data());
|
||||
}
|
||||
pFuncVar->InvokeSetter((void*)pTexture);
|
||||
if (pTexture)
|
||||
{
|
||||
pTexture->Release();
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
UpdateLights();
|
||||
}
|
||||
|
||||
bool CLensFlareElement::IsEnable()
|
||||
{
|
||||
IOpticsElementBasePtr pOptics = GetOpticsElement();
|
||||
if (pOptics == NULL)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return pOptics->IsEnabled();
|
||||
}
|
||||
|
||||
void CLensFlareElement::SetEnable(bool bEnable)
|
||||
{
|
||||
IOpticsElementBasePtr pOptics = GetOpticsElement();
|
||||
if (pOptics == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
pOptics->SetEnabled(bEnable);
|
||||
UpdateLights();
|
||||
}
|
||||
|
||||
EFlareType CLensFlareElement::GetOpticsType()
|
||||
{
|
||||
IOpticsElementBasePtr pOptics = GetOpticsElement();
|
||||
if (pOptics == NULL)
|
||||
{
|
||||
return eFT__Base__;
|
||||
}
|
||||
return pOptics->GetType();
|
||||
}
|
||||
|
||||
bool CLensFlareElement::GetShortName(QString& outName) const
|
||||
{
|
||||
QString fullName;
|
||||
if (!GetName(fullName))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
int nPos = fullName.lastIndexOf('.');
|
||||
if (nPos == -1)
|
||||
{
|
||||
outName = fullName;
|
||||
return true;
|
||||
}
|
||||
outName = fullName.right(fullName.length() - nPos - 1);
|
||||
return true;
|
||||
}
|
||||
|
||||
void CLensFlareElement::UpdateLights()
|
||||
{
|
||||
IOpticsElementBasePtr pOptics = GetOpticsElement();
|
||||
if (pOptics == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (GetLensFlareTree())
|
||||
{
|
||||
if (GetLensFlareTree()->GetLensFlareItem())
|
||||
{
|
||||
GetLensFlareTree()->GetLensFlareItem()->UpdateLights(pOptics);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CLensFlareElement::UpdateProperty(IOpticsElementBasePtr pOptics)
|
||||
{
|
||||
std::vector<IVariable::OnSetCallback*> funcs;
|
||||
|
||||
if (CLensFlareElementTree* lensFlareTree = GetLensFlareTree(); lensFlareTree)
|
||||
{
|
||||
auto callbackItr = m_callbackCache.find(lensFlareTree);
|
||||
if (callbackItr == m_callbackCache.end())
|
||||
{
|
||||
IVariable::OnSetCallback callback =
|
||||
AZStd::bind(&CLensFlareElementTree::OnInternalVariableChange, lensFlareTree, AZStd::placeholders::_1);
|
||||
|
||||
auto result = m_callbackCache.insert(AZStd::make_pair(lensFlareTree, callback));
|
||||
callbackItr = result.first;
|
||||
}
|
||||
|
||||
funcs.push_back(&(callbackItr->second));
|
||||
}
|
||||
|
||||
if (CLensFlareView* lensFlareView = GetLensFlareView(); lensFlareView)
|
||||
{
|
||||
auto callbackItr = m_callbackCache.find(lensFlareView);
|
||||
if (callbackItr == m_callbackCache.end())
|
||||
{
|
||||
IVariable::OnSetCallback callback =
|
||||
AZStd::bind(&CLensFlareView::OnInternalVariableChange, lensFlareView, AZStd::placeholders::_1);
|
||||
|
||||
auto result = m_callbackCache.insert(AZStd::make_pair(lensFlareView, callback));
|
||||
callbackItr = result.first;
|
||||
}
|
||||
|
||||
funcs.push_back(&(callbackItr->second));
|
||||
}
|
||||
|
||||
if (CLensFlareLibrary* lensFlareLibrary = GetLensFlareLibrary(); lensFlareLibrary)
|
||||
{
|
||||
auto callbackItr = m_callbackCache.find(lensFlareLibrary);
|
||||
if (callbackItr == m_callbackCache.end())
|
||||
{
|
||||
IVariable::OnSetCallback callback =
|
||||
AZStd::bind(&CLensFlareLibrary::OnInternalVariableChange, lensFlareLibrary, AZStd::placeholders::_1);
|
||||
|
||||
auto result = m_callbackCache.insert(AZStd::make_pair(lensFlareLibrary, callback));
|
||||
callbackItr = result.first;
|
||||
}
|
||||
|
||||
funcs.push_back(&(callbackItr->second));
|
||||
}
|
||||
|
||||
LensFlareUtil::SetVariablesTemplateFromOptics(pOptics, m_vars, funcs);
|
||||
}
|
||||
|
||||
CLensFlareElementTree* CLensFlareElement::GetLensFlareTree() const
|
||||
{
|
||||
CLensFlareEditor* pEditor = CLensFlareEditor::GetLensFlareEditor();
|
||||
if (pEditor == NULL)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
return pEditor->GetLensFlareElementTree();
|
||||
}
|
||||
|
||||
CLensFlareView* CLensFlareElement::GetLensFlareView() const
|
||||
{
|
||||
CLensFlareEditor* pEditor = CLensFlareEditor::GetLensFlareEditor();
|
||||
if (pEditor == NULL)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
return pEditor->GetLensFlareView();
|
||||
}
|
||||
|
||||
CLensFlareLibrary* CLensFlareElement::GetLensFlareLibrary() const
|
||||
{
|
||||
CLensFlareEditor* pEditor = CLensFlareEditor::GetLensFlareEditor();
|
||||
if (pEditor == NULL)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
return pEditor->GetCurrentLibrary();
|
||||
}
|
||||
|
||||
CLensFlareElement* CLensFlareElement::GetParent() const
|
||||
{
|
||||
return m_pParent;
|
||||
}
|
||||
|
||||
void CLensFlareElement::SetParent(CLensFlareElement* pParent)
|
||||
{
|
||||
m_pParent = pParent;
|
||||
}
|
||||
|
||||
int CLensFlareElement::GetChildCount() const
|
||||
{
|
||||
return m_children.size();
|
||||
}
|
||||
|
||||
CLensFlareElement* CLensFlareElement::GetChildAt(int nPos) const
|
||||
{
|
||||
if (nPos < 0 || nPos >= m_children.size())
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
return m_children[nPos];
|
||||
}
|
||||
|
||||
void CLensFlareElement::AddChild(CLensFlareElement* pElement)
|
||||
{
|
||||
pElement->SetParent(this);
|
||||
m_children.push_back(pElement);
|
||||
}
|
||||
|
||||
void CLensFlareElement::InsertChild(int nPos, CLensFlareElement* pElement)
|
||||
{
|
||||
pElement->SetParent(this);
|
||||
m_children.insert(std::begin(m_children) + nPos, pElement);
|
||||
}
|
||||
|
||||
void CLensFlareElement::RemoveChild(int nPos)
|
||||
{
|
||||
m_children.erase(std::begin(m_children) + nPos);
|
||||
}
|
||||
|
||||
void CLensFlareElement::SwapChildren(int nPos1, int nPos2)
|
||||
{
|
||||
std::swap(m_children[nPos1], m_children[nPos2]);
|
||||
}
|
||||
|
||||
void CLensFlareElement::RemoveAllChildren()
|
||||
{
|
||||
m_children.clear();
|
||||
}
|
||||
|
||||
int CLensFlareElement::GetChildIndex(const CLensFlareElement* pElement) const
|
||||
{
|
||||
auto it = std::find_if(
|
||||
std::begin(m_children),
|
||||
std::end(m_children),
|
||||
[=](const LensFlareElementPtr& pChild)
|
||||
{
|
||||
return pChild.get() == pElement;
|
||||
});
|
||||
|
||||
if (it != std::end(m_children))
|
||||
{
|
||||
return std::distance(std::begin(m_children), it);
|
||||
}
|
||||
else
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
int CLensFlareElement::GetRow() const
|
||||
{
|
||||
return m_pParent ? m_pParent->GetChildIndex(this) : 0;
|
||||
}
|
||||
@@ -1,106 +0,0 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
// Original file Copyright Crytek GMBH or its affiliates, used under license.
|
||||
|
||||
#ifndef CRYINCLUDE_EDITOR_LENSFLAREEDITOR_LENSFLAREELEMENT_H
|
||||
#define CRYINCLUDE_EDITOR_LENSFLAREEDITOR_LENSFLAREELEMENT_H
|
||||
#pragma once
|
||||
|
||||
#include "IFlares.h"
|
||||
|
||||
#include "Util/Variable.h"
|
||||
|
||||
class CLensFlareElementTree;
|
||||
class CLensFlareView;
|
||||
class CLensFlareLibrary;
|
||||
|
||||
class CLensFlareElement
|
||||
: public CRefCountBase
|
||||
{
|
||||
public:
|
||||
|
||||
typedef _smart_ptr<CLensFlareElement> LensFlareElementPtr;
|
||||
typedef std::vector<LensFlareElementPtr> LensFlareElementList;
|
||||
|
||||
CLensFlareElement();
|
||||
virtual ~CLensFlareElement();
|
||||
|
||||
CVarBlock* GetProperties() const
|
||||
{
|
||||
return m_vars;
|
||||
}
|
||||
|
||||
void OnInternalVariableChange(IVariable* pVar);
|
||||
|
||||
bool IsEnable();
|
||||
void SetEnable(bool bEnable);
|
||||
EFlareType GetOpticsType();
|
||||
|
||||
bool GetName(QString& outName) const
|
||||
{
|
||||
IOpticsElementBasePtr pOptics = GetOpticsElement();
|
||||
if (pOptics == NULL)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
outName = pOptics->GetName();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool GetShortName(QString& outName) const;
|
||||
IOpticsElementBasePtr GetOpticsElement() const
|
||||
{
|
||||
return m_pOpticsElement;
|
||||
}
|
||||
void SetOpticsElement(IOpticsElementBasePtr pOptics)
|
||||
{
|
||||
m_pOpticsElement = pOptics;
|
||||
UpdateProperty(m_pOpticsElement);
|
||||
}
|
||||
|
||||
CLensFlareElement* GetParent() const;
|
||||
void SetParent(CLensFlareElement* pParent);
|
||||
|
||||
int GetChildCount() const;
|
||||
CLensFlareElement* GetChildAt(int nPos) const;
|
||||
|
||||
void AddChild(CLensFlareElement* pElement);
|
||||
void InsertChild(int nPos, CLensFlareElement* pElement);
|
||||
|
||||
void RemoveChild(int nPos);
|
||||
void RemoveAllChildren();
|
||||
|
||||
void SwapChildren(int nPos1, int nPos2);
|
||||
|
||||
int GetChildIndex(const CLensFlareElement* pChild) const;
|
||||
int GetRow() const;
|
||||
|
||||
private:
|
||||
|
||||
void UpdateLights();
|
||||
void UpdateProperty(IOpticsElementBasePtr pOptics);
|
||||
|
||||
CLensFlareElementTree* GetLensFlareTree() const;
|
||||
CLensFlareView* GetLensFlareView() const;
|
||||
CLensFlareLibrary* GetLensFlareLibrary() const;
|
||||
|
||||
private:
|
||||
|
||||
IOpticsElementBasePtr m_pOpticsElement;
|
||||
CVarBlockPtr m_vars;
|
||||
|
||||
CLensFlareElement* m_pParent;
|
||||
LensFlareElementList m_children;
|
||||
|
||||
AZStd::map<void*, IVariable::OnSetCallback> m_callbackCache;
|
||||
};
|
||||
#endif // CRYINCLUDE_EDITOR_LENSFLAREEDITOR_LENSFLAREELEMENT_H
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,197 +0,0 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
// Original file Copyright Crytek GMBH or its affiliates, used under license.
|
||||
|
||||
#ifndef CRYINCLUDE_EDITOR_LENSFLAREEDITOR_LENSFLAREELEMENTTREE_H
|
||||
#define CRYINCLUDE_EDITOR_LENSFLAREEDITOR_LENSFLAREELEMENTTREE_H
|
||||
#pragma once
|
||||
|
||||
#if !defined(Q_MOC_RUN)
|
||||
#include "LensFlareElement.h"
|
||||
#include "LensFlareUtil.h"
|
||||
#include "ILensFlareListener.h"
|
||||
|
||||
#include <QAbstractItemModel>
|
||||
#include <QTreeView>
|
||||
#endif
|
||||
|
||||
class CLensFlareItem;
|
||||
class LensFlareElementTreeModel;
|
||||
class QMouseEvent;
|
||||
|
||||
class CLensFlareElementTree
|
||||
: public QTreeView
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
|
||||
CLensFlareElementTree(QWidget* pParent = nullptr);
|
||||
|
||||
void RegisterListener(ILensFlareChangeElementListener* pListener)
|
||||
{
|
||||
if (pListener)
|
||||
{
|
||||
m_LensFlaresElementListeners.push_back(pListener);
|
||||
}
|
||||
}
|
||||
|
||||
void UnregisterListener(ILensFlareChangeElementListener* pListener)
|
||||
{
|
||||
if (pListener == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
std::vector<ILensFlareChangeElementListener*>::iterator ii = m_LensFlaresElementListeners.begin();
|
||||
for (; ii != m_LensFlaresElementListeners.end(); )
|
||||
{
|
||||
if (*ii == pListener)
|
||||
{
|
||||
ii = m_LensFlaresElementListeners.erase(ii);
|
||||
}
|
||||
else
|
||||
{
|
||||
++ii;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CLensFlareElement::LensFlareElementPtr FindLensFlareElement(IOpticsElementBasePtr pElement) const;
|
||||
|
||||
void OnInternalVariableChange(IVariable* pVar);
|
||||
|
||||
CLensFlareElement* GetCurrentLensFlareElement() const;
|
||||
void UpdateProperty();
|
||||
void UpdateClipboard(const char* type, bool bPasteAtSameLevel);
|
||||
|
||||
void SelectTreeItemByName(const QString& name);
|
||||
|
||||
CLensFlareItem* GetLensFlareItem() const;
|
||||
void InvalidateLensFlareItem();
|
||||
|
||||
protected:
|
||||
void CallChangeListeners();
|
||||
|
||||
void OnDataChanged(const QModelIndex& index);
|
||||
void OnRowsInserted(const QModelIndex& index, int first, int last);
|
||||
void OnRowsRemoved(const QModelIndex& index, int first, int last);
|
||||
|
||||
void OnNotifyTreeRClick();
|
||||
void OnTvnSelchangedTree(const QItemSelection& selected, const QItemSelection& deselected);
|
||||
|
||||
XmlNodeRef CreateXML(const char* type) const;
|
||||
bool GetClipboardList(const char* type, std::vector<LensFlareUtil::SClipboardData>& outList) const;
|
||||
|
||||
//! Only the basic operations like following methods must have routine for undoing.
|
||||
void ElementChanged(CLensFlareElement* pPrevLensFlareElement);
|
||||
/////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void OnAddGroup();
|
||||
void OnCopy();
|
||||
void OnCut();
|
||||
void OnPaste();
|
||||
void OnClone();
|
||||
void OnRenameItem();
|
||||
void OnRemoveItem();
|
||||
void OnRemoveAll();
|
||||
void OnItemUp();
|
||||
void OnItemDown();
|
||||
void mousePressEvent(QMouseEvent* event);
|
||||
void keyPressEvent(QKeyEvent* event);
|
||||
|
||||
void Cut(bool bPasteAtSameLevel);
|
||||
|
||||
private:
|
||||
void SelectItem(const QModelIndex& index);
|
||||
|
||||
std::vector<ILensFlareChangeElementListener*> m_LensFlaresElementListeners;
|
||||
|
||||
QScopedPointer<LensFlareElementTreeModel> m_model;
|
||||
};
|
||||
|
||||
class LensFlareElementTreeModel
|
||||
: public QAbstractItemModel
|
||||
, public ILensFlareChangeItemListener
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
LensFlareElementTreeModel(QObject* pParent = nullptr);
|
||||
~LensFlareElementTreeModel();
|
||||
|
||||
int rowCount(const QModelIndex& parent = {}) const override;
|
||||
int columnCount(const QModelIndex& parent = {}) const override;
|
||||
|
||||
Qt::ItemFlags flags(const QModelIndex& index) const override;
|
||||
QVariant data(const QModelIndex& index, int role) const override;
|
||||
bool setData(const QModelIndex& index, const QVariant& value, int role = Qt::EditRole);
|
||||
|
||||
QModelIndex index(int row, int column, const QModelIndex& parent = {}) const override;
|
||||
QModelIndex parent(const QModelIndex& index) const override;
|
||||
|
||||
bool removeRows(int row, int count, const QModelIndex& parent = {}) override;
|
||||
|
||||
QStringList mimeTypes() const override;
|
||||
QMimeData* mimeData(const QModelIndexList& indexes) const override;
|
||||
bool dropMimeData(const QMimeData* data, Qt::DropAction action, int row, int column, const QModelIndex& parent) override;
|
||||
Qt::DropActions supportedDragActions() const override;
|
||||
Qt::DropActions supportedDropActions() const override;
|
||||
|
||||
CLensFlareElement* GetLensFlareElement(const QModelIndex& index) const;
|
||||
|
||||
QModelIndex GetTreeItemByName(const QString& name) const;
|
||||
|
||||
void Paste(const QModelIndex& index, XmlNodeRef xmlNode);
|
||||
void Cut(const QModelIndex& index, bool bPasteAtSameLevel);
|
||||
|
||||
CLensFlareItem* GetLensFlareItem() const
|
||||
{
|
||||
return m_pLensFlareItem;
|
||||
}
|
||||
|
||||
void InvalidateLensFlareItem();
|
||||
|
||||
void RemoveAllElements();
|
||||
bool AddElement(const QModelIndex& index, int row, EFlareType flareType);
|
||||
|
||||
bool MoveElement(CLensFlareElement* pElement, int row, const QModelIndex& parentIndex);
|
||||
|
||||
private:
|
||||
QModelIndex GetRootItem() const;
|
||||
IOpticsElementBasePtr GetOpticsElementByTreeItem(const QModelIndex& index) const;
|
||||
|
||||
void OnLensFlareChangeItem(CLensFlareItem* pLensFlareItem);
|
||||
void OnLensFlareDeleteItem(CLensFlareItem* pLensFlareItem);
|
||||
|
||||
void UpdateLensFlareItem(CLensFlareItem* pLensFlareItem);
|
||||
CLensFlareElement* UpdateLensFlareElementsRecusively(IOpticsElementBasePtr pOptics);
|
||||
CLensFlareElement* CreateElement(IOpticsElementBasePtr pOptics);
|
||||
void Reload();
|
||||
|
||||
void MakeValidElementName(const QString& seedName, QString& outValidName) const;
|
||||
bool IsExistElement(const QString& name) const;
|
||||
CLensFlareElement::LensFlareElementPtr InsertAtomicElement(int nIndex, EFlareType flareType, CLensFlareElement* pParentElement);
|
||||
CLensFlareElement::LensFlareElementPtr AddElement(IOpticsElementBasePtr pOptics, CLensFlareElement* pParentElement);
|
||||
CLensFlareElement* FindLensFlareElement(IOpticsElementBasePtr pOptics) const;
|
||||
|
||||
QModelIndex GetTreeItemByOpticsElement(const IOpticsElementBasePtr pOptics) const;
|
||||
void EnableElement(CLensFlareElement* pLensFlareElement, bool bEnable);
|
||||
void RenameElement(CLensFlareElement* pLensFlareElement, const QString& newName);
|
||||
void StoreUndo(const QString& undoDescription = "");
|
||||
|
||||
CLensFlareElement::LensFlareElementPtr m_pRootElement;
|
||||
CLensFlareItem* m_pLensFlareItem;
|
||||
};
|
||||
|
||||
Q_DECLARE_METATYPE(CLensFlareElement*)
|
||||
|
||||
#endif // CRYINCLUDE_EDITOR_LENSFLAREEDITOR_LENSFLAREELEMENTTREE_H
|
||||
@@ -1,203 +0,0 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
// Original file Copyright Crytek GMBH or its affiliates, used under license.
|
||||
|
||||
#include "EditorDefs.h"
|
||||
|
||||
#include "LensFlareItem.h"
|
||||
|
||||
// Editor
|
||||
#include "LensFlareUtil.h"
|
||||
#include "LensFlareEditor.h"
|
||||
#include "LensFlareUndo.h"
|
||||
#include "Objects/EntityObject.h"
|
||||
|
||||
|
||||
CLensFlareItem::CLensFlareItem()
|
||||
{
|
||||
m_pOptics = NULL;
|
||||
CreateOptics();
|
||||
}
|
||||
|
||||
CLensFlareItem::~CLensFlareItem()
|
||||
{
|
||||
}
|
||||
|
||||
void CLensFlareItem::Serialize(SerializeContext& ctx)
|
||||
{
|
||||
if (ctx.bLoading)
|
||||
{
|
||||
CreateOptics();
|
||||
LensFlareUtil::FillOpticsFromXML(m_pOptics, ctx.node);
|
||||
|
||||
for (int i = 0, iChildCount(ctx.node->getChildCount()); i < iChildCount; ++i)
|
||||
{
|
||||
AddChildOptics(m_pOptics, ctx.node->getChild(i));
|
||||
}
|
||||
|
||||
CBaseLibraryItem::Serialize(ctx);
|
||||
}
|
||||
else
|
||||
{
|
||||
CBaseLibraryItem::Serialize(ctx);
|
||||
}
|
||||
}
|
||||
|
||||
void CLensFlareItem::AddChildOptics(IOpticsElementBasePtr pParentOptics, const XmlNodeRef& pNode)
|
||||
{
|
||||
if (pNode == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (pNode->getTag() && strcmp(pNode->getTag(), "FlareItem"))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
IOpticsElementBasePtr pOptics = LensFlareUtil::CreateOptics(pNode);
|
||||
if (pOptics == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
pParentOptics->AddElement(pOptics);
|
||||
|
||||
for (int i = 0, iChildCount(pNode->getChildCount()); i < iChildCount; ++i)
|
||||
{
|
||||
AddChildOptics(pOptics, pNode->getChild(i));
|
||||
}
|
||||
}
|
||||
|
||||
void CLensFlareItem::CreateOptics()
|
||||
{
|
||||
m_pOptics = gEnv->pOpticsManager->Create(eFT_Root);
|
||||
}
|
||||
|
||||
XmlNodeRef CLensFlareItem::CreateXmlData() const
|
||||
{
|
||||
XmlNodeRef pRootNode = NULL;
|
||||
if (LensFlareUtil::CreateXmlData(m_pOptics, pRootNode))
|
||||
{
|
||||
pRootNode->setAttr("Name", m_pOptics->GetName().c_str());
|
||||
return pRootNode;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void CLensFlareItem::SetName(const QString& name)
|
||||
{
|
||||
QString newNameWithGroup;
|
||||
QString newFullName;
|
||||
LensFlareUtil::GetExpandedItemNames(this, LensFlareUtil::GetGroupNameFromName(name), LensFlareUtil::GetShortName(name), newNameWithGroup, newFullName);
|
||||
|
||||
if (CUndo::IsRecording())
|
||||
{
|
||||
CUndo::Record(new CUndoRenameLensFlareItem(GetFullName(), newFullName));
|
||||
}
|
||||
|
||||
CBaseLibraryItem::SetName(name);
|
||||
|
||||
if (m_pOptics)
|
||||
{
|
||||
m_pOptics->SetName(GetShortName().toUtf8().data());
|
||||
}
|
||||
}
|
||||
|
||||
void CLensFlareItem::UpdateLights(IOpticsElementBasePtr pSrcOptics)
|
||||
{
|
||||
QString srcFullOpticsName = GetFullName();
|
||||
bool bUpdateChildren = false;
|
||||
if (pSrcOptics == NULL)
|
||||
{
|
||||
if (m_pOptics == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
pSrcOptics = m_pOptics;
|
||||
bUpdateChildren = true;
|
||||
}
|
||||
|
||||
std::vector<CEntityObject*> lightEntities;
|
||||
LensFlareUtil::GetLightEntityObjects(lightEntities);
|
||||
|
||||
for (int i = 0, iLightSize(lightEntities.size()); i < iLightSize; ++i)
|
||||
{
|
||||
CEntityObject* pLightEntity = lightEntities[i];
|
||||
if (pLightEntity == NULL)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
IOpticsElementBasePtr pTargetOptics = pLightEntity->GetOpticsElement();
|
||||
if (pTargetOptics == NULL)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
QString targetFullOpticsName(pTargetOptics->GetName().c_str());
|
||||
if (srcFullOpticsName != targetFullOpticsName)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
QString srcOpticsName(pSrcOptics->GetName().c_str());
|
||||
IOpticsElementBasePtr pFoundOptics = NULL;
|
||||
if (LensFlareUtil::GetShortName(targetFullOpticsName) == srcOpticsName)
|
||||
{
|
||||
pFoundOptics = pTargetOptics;
|
||||
}
|
||||
else
|
||||
{
|
||||
pFoundOptics = LensFlareUtil::FindOptics(pTargetOptics, srcOpticsName);
|
||||
}
|
||||
|
||||
if (pFoundOptics == NULL)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (pFoundOptics->GetType() != pSrcOptics->GetType())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
LensFlareUtil::CopyOptics(pSrcOptics, pFoundOptics, bUpdateChildren);
|
||||
}
|
||||
}
|
||||
|
||||
void CLensFlareItem::ReplaceOptics(IOpticsElementBasePtr pNewData)
|
||||
{
|
||||
if (pNewData == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (pNewData->GetType() != eFT_Root)
|
||||
{
|
||||
return;
|
||||
}
|
||||
CreateOptics();
|
||||
LensFlareUtil::CopyOptics(pNewData, m_pOptics);
|
||||
m_pOptics->SetName(GetFullName().toUtf8().data());
|
||||
UpdateLights();
|
||||
|
||||
CLensFlareEditor* pLensFlareEditor = CLensFlareEditor::GetLensFlareEditor();
|
||||
if (pLensFlareEditor == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (this != pLensFlareEditor->GetSelectedLensFlareItem())
|
||||
{
|
||||
return;
|
||||
}
|
||||
pLensFlareEditor->UpdateLensFlareItem(this);
|
||||
pLensFlareEditor->RemovePropertyItems();
|
||||
}
|
||||
@@ -1,59 +0,0 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
// Original file Copyright Crytek GMBH or its affiliates, used under license.
|
||||
|
||||
#ifndef CRYINCLUDE_EDITOR_LENSFLAREEDITOR_LENSFLAREITEM_H
|
||||
#define CRYINCLUDE_EDITOR_LENSFLAREEDITOR_LENSFLAREITEM_H
|
||||
#pragma once
|
||||
|
||||
class IOpticsElementBase;
|
||||
class CEntityObject;
|
||||
|
||||
#include "BaseLibraryItem.h"
|
||||
#include "Include/IDataBaseItem.h"
|
||||
|
||||
class CLensFlareItem
|
||||
: public CBaseLibraryItem
|
||||
{
|
||||
public:
|
||||
|
||||
CLensFlareItem();
|
||||
~CLensFlareItem();
|
||||
|
||||
EDataBaseItemType GetType() const
|
||||
{
|
||||
return EDB_TYPE_FLARE;
|
||||
}
|
||||
|
||||
void SetName(const QString& name);
|
||||
void Serialize(SerializeContext& ctx);
|
||||
|
||||
void CreateOptics();
|
||||
|
||||
IOpticsElementBasePtr GetOptics() const
|
||||
{
|
||||
return m_pOptics;
|
||||
}
|
||||
|
||||
void ReplaceOptics(IOpticsElementBasePtr pNewData);
|
||||
|
||||
XmlNodeRef CreateXmlData() const;
|
||||
void UpdateLights(IOpticsElementBasePtr pSrcOptics = NULL);
|
||||
|
||||
private:
|
||||
|
||||
void GetLightEntityObjects(std::vector<CEntityObject*>& outEntityLights) const;
|
||||
static void AddChildOptics(IOpticsElementBasePtr pParentOptics, const XmlNodeRef& pNode);
|
||||
|
||||
IOpticsElementBasePtr m_pOptics;
|
||||
};
|
||||
#endif // CRYINCLUDE_EDITOR_LENSFLAREEDITOR_LENSFLAREITEM_H
|
||||
@@ -1,87 +0,0 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
// Original file Copyright Crytek GMBH or its affiliates, used under license.
|
||||
|
||||
#include "EditorDefs.h"
|
||||
|
||||
#include "LensFlareItemTree.h"
|
||||
|
||||
// Editor
|
||||
#include "LensFlareItem.h"
|
||||
#include "ViewManager.h"
|
||||
#include "Objects/EntityObject.h"
|
||||
|
||||
|
||||
CLensFlareItemTree::CLensFlareItemTree(QWidget* pParent)
|
||||
: QTreeView(pParent)
|
||||
{
|
||||
setHeaderHidden(true);
|
||||
setSelectionMode(QAbstractItemView::SingleSelection);
|
||||
setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
setDragEnabled(true);
|
||||
setAcceptDrops(true);
|
||||
setDropIndicatorShown(true);
|
||||
setDragDropMode(DragDrop);
|
||||
}
|
||||
|
||||
CLensFlareItemTree::~CLensFlareItemTree()
|
||||
{
|
||||
}
|
||||
|
||||
void CLensFlareItemTree::startDrag(Qt::DropActions supportedDropActions)
|
||||
{
|
||||
QTreeView::startDrag(supportedDropActions);
|
||||
}
|
||||
|
||||
void CLensFlareItemTree::mousePressEvent(QMouseEvent* event)
|
||||
{
|
||||
if (event->button() == Qt::LeftButton)
|
||||
{
|
||||
CUndo undo(tr("Changed lens flare item").toUtf8());
|
||||
QTreeView::mousePressEvent(event);
|
||||
}
|
||||
else
|
||||
{
|
||||
QTreeView::mousePressEvent(event);
|
||||
}
|
||||
}
|
||||
|
||||
void CLensFlareItemTree::AssignLensFlareToLightEntity(CViewport* pViewport) const
|
||||
{
|
||||
QModelIndexList selected = selectionModel()->selectedIndexes();
|
||||
if (selected.isEmpty())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
CLensFlareItem* pLensFlareItem = static_cast<CLensFlareItem*>(selected.first().data(Qt::UserRole).value<CBaseLibraryItem*>());
|
||||
|
||||
QPoint viewportPos = QCursor::pos();
|
||||
pViewport->ScreenToClient(viewportPos);
|
||||
HitContext hit;
|
||||
if (!pViewport->HitTest(viewportPos, hit))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (hit.object && qobject_cast<CEntityObject*>(hit.object))
|
||||
{
|
||||
CEntityObject* pEntity = (CEntityObject*)hit.object;
|
||||
if (pEntity->IsLight())
|
||||
{
|
||||
CUndo undo(tr("Assign a lens flare item to a light entity").toUtf8());
|
||||
pEntity->ApplyOptics(pLensFlareItem->GetFullName(), pLensFlareItem->GetOptics());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#include <LensFlareEditor/moc_LensFlareItemTree.cpp>
|
||||
@@ -1,45 +0,0 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
// Original file Copyright Crytek GMBH or its affiliates, used under license.
|
||||
|
||||
#ifndef CRYINCLUDE_EDITOR_LENSFLAREEDITOR_LENSFLAREITEMTREE_H
|
||||
#define CRYINCLUDE_EDITOR_LENSFLAREEDITOR_LENSFLAREITEMTREE_H
|
||||
#pragma once
|
||||
|
||||
#if !defined(Q_MOC_RUN)
|
||||
#include "LensFlareElement.h"
|
||||
#include "ILensFlareListener.h"
|
||||
|
||||
#include <QTreeView>
|
||||
#endif
|
||||
|
||||
class QMouseEvent;
|
||||
class CLensFlareItem;
|
||||
|
||||
class CLensFlareItemTree
|
||||
: public QTreeView
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
CLensFlareItemTree(QWidget* pParent = nullptr);
|
||||
~CLensFlareItemTree();
|
||||
|
||||
protected:
|
||||
void startDrag(Qt::DropActions supportedDropActions) override;
|
||||
void mousePressEvent(QMouseEvent* event) override;
|
||||
|
||||
private:
|
||||
|
||||
void AssignLensFlareToLightEntity(CViewport* pViewport) const;
|
||||
};
|
||||
#endif // CRYINCLUDE_EDITOR_LENSFLAREEDITOR_LENSFLAREITEMTREE_H
|
||||
@@ -1,100 +0,0 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
// Original file Copyright Crytek GMBH or its affiliates, used under license.
|
||||
|
||||
#include "EditorDefs.h"
|
||||
|
||||
#include "LensFlareLibrary.h"
|
||||
|
||||
// Editor
|
||||
#include "LensFlareItem.h"
|
||||
|
||||
|
||||
bool CLensFlareLibrary::Save()
|
||||
{
|
||||
return SaveLibrary("LensFlareLibrary");
|
||||
}
|
||||
|
||||
bool CLensFlareLibrary::Load(const QString& filename)
|
||||
{
|
||||
if (filename.isEmpty())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
SetFilename(filename);
|
||||
XmlNodeRef root = XmlHelpers::LoadXmlFromFile(filename.toUtf8().data());
|
||||
if (!root)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
Serialize(root, true);
|
||||
return true;
|
||||
}
|
||||
|
||||
void CLensFlareLibrary::Serialize(XmlNodeRef& root, bool bLoading)
|
||||
{
|
||||
if (bLoading)
|
||||
{
|
||||
RemoveAllItems();
|
||||
QString name = GetName();
|
||||
root->getAttr("Name", name);
|
||||
SetName(name);
|
||||
for (int i = 0; i < root->getChildCount(); i++)
|
||||
{
|
||||
XmlNodeRef itemNode = root->getChild(i);
|
||||
CLensFlareItem* pLensFlareItem = new CLensFlareItem;
|
||||
AddItem(pLensFlareItem);
|
||||
CBaseLibraryItem::SerializeContext ctx(itemNode, bLoading);
|
||||
pLensFlareItem->Serialize(ctx);
|
||||
}
|
||||
SetModified(false);
|
||||
m_bNewLibrary = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
root->setAttr("Name", GetName().toUtf8().data());
|
||||
|
||||
for (int i = 0; i < GetItemCount(); i++)
|
||||
{
|
||||
CLensFlareItem* pItem = (CLensFlareItem*)GetItem(i);
|
||||
if(pItem)
|
||||
{
|
||||
CBaseLibraryItem::SerializeContext ctx(pItem->CreateXmlData(), bLoading);
|
||||
root->addChild(ctx.node);
|
||||
pItem->Serialize(ctx);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
IOpticsElementBasePtr CLensFlareLibrary::GetOpticsOfItem(const char* szflareName)
|
||||
{
|
||||
IOpticsElementBasePtr pOptics = NULL;
|
||||
for (int i = 0; i < GetItemCount(); i++)
|
||||
{
|
||||
CLensFlareItem* pItem = (CLensFlareItem*)GetItem(i);
|
||||
|
||||
if (pItem->GetFullName() == szflareName)
|
||||
{
|
||||
pOptics = pItem->GetOptics();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return pOptics;
|
||||
}
|
||||
|
||||
|
||||
void CLensFlareLibrary::OnInternalVariableChange([[maybe_unused]] IVariable* pVar)
|
||||
{
|
||||
SetModified(true);
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
// Original file Copyright Crytek GMBH or its affiliates, used under license.
|
||||
|
||||
#ifndef CRYINCLUDE_EDITOR_LENSFLAREEDITOR_LENSFLARELIBRARY_H
|
||||
#define CRYINCLUDE_EDITOR_LENSFLAREEDITOR_LENSFLARELIBRARY_H
|
||||
#pragma once
|
||||
#include "BaseLibrary.h"
|
||||
|
||||
struct IVariable;
|
||||
|
||||
class CRYEDIT_API CLensFlareLibrary
|
||||
: public CBaseLibrary
|
||||
{
|
||||
public:
|
||||
CLensFlareLibrary(IBaseLibraryManager* pManager)
|
||||
: CBaseLibrary(pManager) {};
|
||||
virtual bool Save();
|
||||
virtual bool Load(const QString& filename);
|
||||
virtual void Serialize(XmlNodeRef& node, bool bLoading);
|
||||
|
||||
IOpticsElementBasePtr GetOpticsOfItem(const char* szflareName);
|
||||
|
||||
void OnInternalVariableChange(IVariable* pVar);
|
||||
};
|
||||
#endif // CRYINCLUDE_EDITOR_LENSFLAREEDITOR_LENSFLARELIBRARY_H
|
||||
@@ -1,225 +0,0 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
// Original file Copyright Crytek GMBH or its affiliates, used under license.
|
||||
|
||||
#include "EditorDefs.h"
|
||||
|
||||
#include "LensFlareLightEntityTree.h"
|
||||
|
||||
// Editor
|
||||
#include "Viewport.h"
|
||||
#include "Include/IObjectManager.h"
|
||||
#include "Objects/SelectionGroup.h"
|
||||
#include "LensFlareItem.h"
|
||||
#include "LensFlareEditor.h"
|
||||
|
||||
|
||||
CLensFlareLightEntityTree::CLensFlareLightEntityTree(QWidget* pParent)
|
||||
: QTreeView(pParent)
|
||||
, m_model(new LensFlareLightEntityModel)
|
||||
{
|
||||
setHeaderHidden(true);
|
||||
|
||||
setModel(m_model.data());
|
||||
|
||||
connect(this, &QTreeView::doubleClicked, this, &CLensFlareLightEntityTree::OnTvnItemDoubleClicked);
|
||||
}
|
||||
|
||||
CLensFlareLightEntityTree::~CLensFlareLightEntityTree()
|
||||
{
|
||||
}
|
||||
|
||||
void CLensFlareLightEntityTree::OnLensFlareChangeItem(CLensFlareItem* pLensFlareItem)
|
||||
{
|
||||
m_model->OnLensFlareChangeItem(pLensFlareItem);
|
||||
}
|
||||
|
||||
void CLensFlareLightEntityTree::OnLensFlareDeleteItem(CLensFlareItem* pLensFlareItem)
|
||||
{
|
||||
m_model->OnLensFlareDeleteItem(pLensFlareItem);
|
||||
}
|
||||
|
||||
void CLensFlareLightEntityTree::OnTvnItemDoubleClicked(const QModelIndex& index)
|
||||
{
|
||||
CEntityObject* pObject = index.data(Qt::UserRole).value<CEntityObject*>();
|
||||
|
||||
if (!qobject_cast<CEntityObject*>(pObject))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
CSelectionGroup* pSelection = GetIEditor()->GetObjectManager()->GetSelection();
|
||||
if (pSelection)
|
||||
{
|
||||
int iSelectionCount(pSelection->GetCount());
|
||||
if (iSelectionCount == 1)
|
||||
{
|
||||
if (pSelection->GetObject(0) == pObject)
|
||||
{
|
||||
CViewport* vp = GetIEditor()->GetActiveView();
|
||||
if (vp)
|
||||
{
|
||||
vp->CenterOnSelection();
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
GetIEditor()->GetObjectManager()->ClearSelection();
|
||||
GetIEditor()->GetObjectManager()->SelectObject(pObject);
|
||||
}
|
||||
|
||||
LensFlareLightEntityModel::LensFlareLightEntityModel(QObject* pParent)
|
||||
: QAbstractListModel(pParent)
|
||||
{
|
||||
CLensFlareEditor::GetLensFlareEditor()->RegisterLensFlareItemChangeListener(this);
|
||||
GetIEditor()->GetObjectManager()->AddObjectEventListener(this);
|
||||
}
|
||||
|
||||
LensFlareLightEntityModel::~LensFlareLightEntityModel()
|
||||
{
|
||||
CLensFlareEditor::GetLensFlareEditor()->UnregisterLensFlareItemChangeListener(this);
|
||||
GetIEditor()->GetObjectManager()->RemoveObjectEventListener(this);
|
||||
}
|
||||
|
||||
void LensFlareLightEntityModel::OnLensFlareChangeItem(CLensFlareItem* pLensFlareItem)
|
||||
{
|
||||
beginResetModel();
|
||||
|
||||
m_pLensFlareItem = pLensFlareItem;
|
||||
m_lightEntities.clear();
|
||||
|
||||
if (m_pLensFlareItem)
|
||||
{
|
||||
std::vector<CEntityObject*> lightEntities;
|
||||
LensFlareUtil::GetLightEntityObjects(lightEntities);
|
||||
|
||||
for (int i = 0, iEntitySize(lightEntities.size()); i < iEntitySize; ++i)
|
||||
{
|
||||
AddLightEntity(lightEntities[i]);
|
||||
}
|
||||
}
|
||||
|
||||
endResetModel();
|
||||
}
|
||||
|
||||
void LensFlareLightEntityModel::OnLensFlareDeleteItem([[maybe_unused]] CLensFlareItem* pLensFlareItem)
|
||||
{
|
||||
beginResetModel();
|
||||
|
||||
m_lightEntities.clear();
|
||||
m_pLensFlareItem = NULL;
|
||||
|
||||
endResetModel();
|
||||
}
|
||||
|
||||
void LensFlareLightEntityModel::OnObjectEvent(CBaseObject* pObject, int nEvent)
|
||||
{
|
||||
if (!qobject_cast<CEntityObject*>(pObject))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
switch (nEvent)
|
||||
{
|
||||
case CBaseObject::ON_RENAME:
|
||||
case CBaseObject::ON_DELETE:
|
||||
{
|
||||
auto it = std::find(std::begin(m_lightEntities), std::end(m_lightEntities), pObject);
|
||||
if (it == std::end(m_lightEntities))
|
||||
{
|
||||
return;
|
||||
}
|
||||
int row = std::distance(std::begin(m_lightEntities), it);
|
||||
if (nEvent == CBaseObject::ON_RENAME)
|
||||
{
|
||||
emit dataChanged(index(row, 0), index(row, 0));
|
||||
}
|
||||
else
|
||||
{
|
||||
beginRemoveRows({}, row, row);
|
||||
m_lightEntities.erase(it);
|
||||
endRemoveRows();
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case CBaseObject::ON_ADD:
|
||||
if (AddLightEntity((CEntityObject*)pObject))
|
||||
{
|
||||
int row = m_lightEntities.size() - 1;
|
||||
beginInsertRows({}, row, row);
|
||||
endInsertRows();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
bool LensFlareLightEntityModel::AddLightEntity(CEntityObject* pEntity)
|
||||
{
|
||||
if (pEntity == NULL || m_pLensFlareItem == NULL)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
QString lensFlareName = pEntity->GetEntityPropertyString(CEntityObject::s_LensFlarePropertyName);
|
||||
if (lensFlareName.isEmpty())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
QString fullName = m_pLensFlareItem->GetFullName();
|
||||
if (fullName.isEmpty())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (QString::compare(lensFlareName, fullName, Qt::CaseInsensitive))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
m_lightEntities.push_back(pEntity);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int LensFlareLightEntityModel::rowCount(const QModelIndex&) const
|
||||
{
|
||||
return m_lightEntities.size();
|
||||
}
|
||||
|
||||
QVariant LensFlareLightEntityModel::data(const QModelIndex& index, int role) const
|
||||
{
|
||||
const int row = index.row();
|
||||
|
||||
if (row < 0 || row >= m_lightEntities.size())
|
||||
{
|
||||
return {};
|
||||
}
|
||||
|
||||
auto pEntity = m_lightEntities[row];
|
||||
|
||||
switch (role)
|
||||
{
|
||||
case Qt::DisplayRole:
|
||||
return pEntity->GetName();
|
||||
|
||||
case Qt::UserRole:
|
||||
return QVariant::fromValue<CEntityObject*>(pEntity);
|
||||
}
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
#include <LensFlareEditor/moc_LensFlareLightEntityTree.cpp>
|
||||
@@ -1,75 +0,0 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
// Original file Copyright Crytek GMBH or its affiliates, used under license.
|
||||
|
||||
#ifndef CRYINCLUDE_EDITOR_LENSFLAREEDITOR_LENSFLARELIGHTENTITYTREE_H
|
||||
#define CRYINCLUDE_EDITOR_LENSFLAREEDITOR_LENSFLARELIGHTENTITYTREE_H
|
||||
#pragma once
|
||||
|
||||
#if !defined(Q_MOC_RUN)
|
||||
#include "ILensFlareListener.h"
|
||||
|
||||
#include <QScopedPointer>
|
||||
#include <QTreeWidget>
|
||||
#include "IObjectManager.h" // for IObjectManager::EventListener
|
||||
#include "Objects/EntityObject.h"
|
||||
#endif
|
||||
|
||||
class LensFlareLightEntityModel;
|
||||
|
||||
class CLensFlareLightEntityTree
|
||||
: public QTreeView
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
CLensFlareLightEntityTree(QWidget* pParent = nullptr);
|
||||
~CLensFlareLightEntityTree();
|
||||
|
||||
void OnLensFlareDeleteItem(CLensFlareItem* pLensFlareItem);
|
||||
void OnLensFlareChangeItem(CLensFlareItem* pLensFlareItem);
|
||||
|
||||
protected:
|
||||
void OnTvnItemDoubleClicked(const QModelIndex& index);
|
||||
|
||||
QScopedPointer<LensFlareLightEntityModel> m_model;
|
||||
};
|
||||
|
||||
class LensFlareLightEntityModel
|
||||
: public QAbstractListModel
|
||||
, public ILensFlareChangeItemListener
|
||||
, public IObjectManager::EventListener
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
LensFlareLightEntityModel(QObject* pParent = nullptr);
|
||||
~LensFlareLightEntityModel();
|
||||
|
||||
int rowCount(const QModelIndex& parent = {}) const override;
|
||||
QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
|
||||
|
||||
void OnLensFlareDeleteItem(CLensFlareItem* pLensFlareItem);
|
||||
void OnLensFlareChangeItem(CLensFlareItem* pLensFlareItem);
|
||||
|
||||
protected:
|
||||
void OnObjectEvent(CBaseObject* pObject, int nEvent) override;
|
||||
|
||||
bool AddLightEntity(CEntityObject* pEntity);
|
||||
|
||||
std::vector<CEntityObject*> m_lightEntities;
|
||||
_smart_ptr<CLensFlareItem> m_pLensFlareItem;
|
||||
};
|
||||
|
||||
Q_DECLARE_METATYPE(CEntityObject*)
|
||||
|
||||
#endif // CRYINCLUDE_EDITOR_LENSFLAREEDITOR_LENSFLARELIGHTENTITYTREE_H
|
||||
@@ -1,234 +0,0 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
// Original file Copyright Crytek GMBH or its affiliates, used under license.
|
||||
|
||||
#include "EditorDefs.h"
|
||||
|
||||
#include "LensFlareManager.h"
|
||||
|
||||
// AzCore
|
||||
#include <AzCore/XML/rapidxml.h>
|
||||
#include <AzCore/std/string/wildcard.h>
|
||||
|
||||
// Editor
|
||||
#include "LensFlareEditor.h"
|
||||
#include "LensFlareItem.h"
|
||||
#include "LensFlareLibrary.h"
|
||||
#include "LensFlareUtil.h"
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// CLensFlareManager implementation.
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
CLensFlareManager::CLensFlareManager()
|
||||
: CBaseLibraryManager()
|
||||
{
|
||||
m_bUniqNameMap = true;
|
||||
m_pLevelLibrary = (CBaseLibrary*)AddLibrary("Level", true);
|
||||
AzToolsFramework::AssetBrowser::AssetBrowserInteractionNotificationBus::Handler::BusConnect();
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
CLensFlareManager::~CLensFlareManager()
|
||||
{
|
||||
AzToolsFramework::AssetBrowser::AssetBrowserInteractionNotificationBus::Handler::BusDisconnect();
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CLensFlareManager::ClearAll()
|
||||
{
|
||||
CBaseLibraryManager::ClearAll();
|
||||
|
||||
m_pLevelLibrary = (CBaseLibrary*)AddLibrary("Level", true);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
CBaseLibraryItem* CLensFlareManager::MakeNewItem()
|
||||
{
|
||||
return new CLensFlareItem;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
CBaseLibrary* CLensFlareManager::MakeNewLibrary()
|
||||
{
|
||||
return new CLensFlareLibrary(this);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
QString CLensFlareManager::GetRootNodeName()
|
||||
{
|
||||
return "FlareLibs";
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
QString CLensFlareManager::GetLibsPath()
|
||||
{
|
||||
if (m_libsPath.isEmpty())
|
||||
{
|
||||
m_libsPath += FLARE_LIBS_PATH;
|
||||
}
|
||||
|
||||
return m_libsPath;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
bool CLensFlareManager::LoadFlareItemByName(const QString& fullItemName, IOpticsElementBasePtr pDestOptics)
|
||||
{
|
||||
if (pDestOptics == NULL)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
CLensFlareItem* pLensFlareItem = (CLensFlareItem*)LoadItemByName(fullItemName);
|
||||
if (pLensFlareItem == NULL)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
LensFlareUtil::CopyOptics(pLensFlareItem->GetOptics(), pDestOptics, true);
|
||||
return true;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CLensFlareManager::Modified()
|
||||
{
|
||||
CLensFlareEditor* pEditor = CLensFlareEditor::GetLensFlareEditor();
|
||||
if (pEditor == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (pEditor->GetCurrentLibrary())
|
||||
{
|
||||
pEditor->GetCurrentLibrary()->SetModified(true);
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
IDataBaseLibrary* CLensFlareManager::LoadLibrary(const QString& filename, [[maybe_unused]] bool bReload)
|
||||
{
|
||||
CLensFlareEditor* pEditor = CLensFlareEditor::GetLensFlareEditor();
|
||||
|
||||
QString fileNameWithGameFolder(filename);
|
||||
|
||||
fileNameWithGameFolder.replace('\\', '/');
|
||||
|
||||
int nGamePathLength = static_cast<int>(Path::GetEditingGameDataFolder().size());
|
||||
QString gamePathName;
|
||||
if (nGamePathLength < filename.length())
|
||||
{
|
||||
gamePathName = filename.left(nGamePathLength);
|
||||
}
|
||||
if (gamePathName != Path::GetEditingGameDataFolder().c_str())
|
||||
{
|
||||
fileNameWithGameFolder.insert(0, "/");
|
||||
fileNameWithGameFolder.insert(0, Path::GetEditingGameDataFolder().c_str());
|
||||
}
|
||||
|
||||
int nLibraryIndex(-1);
|
||||
bool bSameAsCurrentLibrary(false);
|
||||
|
||||
for (int i = 0; i < m_libs.size(); i++)
|
||||
{
|
||||
if (QString::compare(fileNameWithGameFolder, m_libs[i]->GetFilename(), Qt::CaseInsensitive) == 0)
|
||||
{
|
||||
IDataBaseLibrary* pExistingLib = m_libs[i];
|
||||
for (int j = 0; j < pExistingLib->GetItemCount(); j++)
|
||||
{
|
||||
UnregisterItem((CBaseLibraryItem*)pExistingLib->GetItem(j));
|
||||
}
|
||||
pExistingLib->RemoveAllItems();
|
||||
nLibraryIndex = i;
|
||||
if (pEditor)
|
||||
{
|
||||
bSameAsCurrentLibrary = pEditor->GetCurrentLibrary() == pExistingLib;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
TSmartPtr<CBaseLibrary> pLib = MakeNewLibrary();
|
||||
if (!pLib->Load(filename))
|
||||
{
|
||||
Error(QObject::tr("Failed to Load Item Library: %1").arg(filename).toUtf8().data());
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (nLibraryIndex != -1)
|
||||
{
|
||||
m_libs[nLibraryIndex] = pLib;
|
||||
if (bSameAsCurrentLibrary && pEditor)
|
||||
{
|
||||
pEditor->ResetElementTreeControl();
|
||||
pEditor->SelectLibrary(pLib, true);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_libs.push_back(pLib);
|
||||
}
|
||||
|
||||
pLib->SetFilename(filename);
|
||||
|
||||
return pLib;
|
||||
}
|
||||
|
||||
|
||||
bool CLensFlareManager::IsLensFlareLibraryXML(const char* fileSourceFilePath)
|
||||
{
|
||||
if ((!fileSourceFilePath) || (!AZStd::wildcard_match("*.xml", fileSourceFilePath)))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
using namespace AZ::IO;
|
||||
|
||||
bool isLensFlareLibrary = false;
|
||||
|
||||
// we are forced to read the asset to discover its type since "xml" was the chosen extension.
|
||||
SystemFile::SizeType fileSize = SystemFile::Length(fileSourceFilePath);
|
||||
if (fileSize > 0)
|
||||
{
|
||||
AZStd::vector<char> buffer(fileSize + 1);
|
||||
buffer[fileSize] = 0;
|
||||
if (!AZ::IO::SystemFile::Read(fileSourceFilePath, buffer.data(), fileSize))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
AZ::rapidxml::xml_document<char>* xmlDoc = azcreate(AZ::rapidxml::xml_document<char>, (), AZ::SystemAllocator, "LensFlareLibrary Temp XML Reader");
|
||||
if (xmlDoc->parse<AZ::rapidxml::parse_no_data_nodes>(buffer.data()))
|
||||
{
|
||||
AZ::rapidxml::xml_node<char>* xmlRootNode = xmlDoc->first_node();
|
||||
if (xmlRootNode)
|
||||
{
|
||||
if (azstricmp(xmlRootNode->name(), "LensFlareLibrary") == 0)
|
||||
{
|
||||
isLensFlareLibrary = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
azdestroy(xmlDoc, AZ::SystemAllocator, AZ::rapidxml::xml_document<char>);
|
||||
}
|
||||
|
||||
return isLensFlareLibrary;
|
||||
}
|
||||
|
||||
|
||||
AzToolsFramework::AssetBrowser::SourceFileDetails CLensFlareManager::GetSourceFileDetails(const char* fullSourceFileName)
|
||||
{
|
||||
if (IsLensFlareLibraryXML(fullSourceFileName))
|
||||
{
|
||||
return AzToolsFramework::AssetBrowser::SourceFileDetails("Icons/AssetBrowser/LensFlare_16.png");
|
||||
}
|
||||
return AzToolsFramework::AssetBrowser::SourceFileDetails();
|
||||
}
|
||||
@@ -1,64 +0,0 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
// Original file Copyright Crytek GMBH or its affiliates, used under license.
|
||||
|
||||
#ifndef CRYINCLUDE_EDITOR_LENSFLAREEDITOR_LENSFLAREMANAGER_H
|
||||
#define CRYINCLUDE_EDITOR_LENSFLAREEDITOR_LENSFLAREMANAGER_H
|
||||
#pragma once
|
||||
|
||||
#include "BaseLibraryManager.h"
|
||||
#include <AzToolsFramework/AssetBrowser/AssetBrowserBus.h>
|
||||
|
||||
class IOpticsElementBase;
|
||||
class CLensFlareEditor;
|
||||
|
||||
AZ_PUSH_DISABLE_DLL_EXPORT_BASECLASS_WARNING
|
||||
AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING
|
||||
class CRYEDIT_API CLensFlareManager
|
||||
: public CBaseLibraryManager
|
||||
, private AzToolsFramework::AssetBrowser::AssetBrowserInteractionNotificationBus::Handler
|
||||
|
||||
{
|
||||
AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
|
||||
AZ_POP_DISABLE_DLL_EXPORT_BASECLASS_WARNING
|
||||
public:
|
||||
CLensFlareManager();
|
||||
virtual ~CLensFlareManager();
|
||||
|
||||
void ClearAll();
|
||||
|
||||
virtual bool LoadFlareItemByName(const QString& fullItemName, IOpticsElementBasePtr pDestOptics);
|
||||
void Modified();
|
||||
//! Path to libraries in this manager.
|
||||
QString GetLibsPath();
|
||||
IDataBaseLibrary* LoadLibrary(const QString& filename, bool bReload = false);
|
||||
|
||||
static bool IsLensFlareLibraryXML(const char* fullFilePath);
|
||||
|
||||
private:
|
||||
CBaseLibraryItem* MakeNewItem();
|
||||
CBaseLibrary* MakeNewLibrary();
|
||||
|
||||
//! Root node where this library will be saved.
|
||||
QString GetRootNodeName();
|
||||
QString m_libsPath;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// AssetBrowser::AssetBrowserInteractionNotificationBus::Handler
|
||||
AzToolsFramework::AssetBrowser::SourceFileDetails GetSourceFileDetails(const char* fullSourceFileName) override;
|
||||
virtual AZ::s32 GetPriority() const override { return 1; } // get our priority in before others.
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif // CRYINCLUDE_EDITOR_LENSFLAREEDITOR_LENSFLAREMANAGER_H
|
||||
@@ -1,26 +0,0 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
// Original file Copyright Crytek GMBH or its affiliates, used under license.
|
||||
|
||||
#include "EditorDefs.h"
|
||||
#include "LensFlareReferenceTree.h"
|
||||
|
||||
BEGIN_MESSAGE_MAP (CLensFlareReferenceTree, CXTTreeCtrl)
|
||||
END_MESSAGE_MAP ()
|
||||
|
||||
CLensFlareReferenceTree::CLensFlareReferenceTree()
|
||||
{
|
||||
}
|
||||
|
||||
CLensFlareReferenceTree::~CLensFlareReferenceTree()
|
||||
{
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
// Original file Copyright Crytek GMBH or its affiliates, used under license.
|
||||
|
||||
#ifndef CRYINCLUDE_EDITOR_LENSFLAREEDITOR_LENSFLAREREFERENCETREE_H
|
||||
#define CRYINCLUDE_EDITOR_LENSFLAREEDITOR_LENSFLAREREFERENCETREE_H
|
||||
#pragma once
|
||||
|
||||
class CLensFlareReferenceTree
|
||||
: public CXTTreeCtrl
|
||||
{
|
||||
public:
|
||||
|
||||
CLensFlareReferenceTree();
|
||||
~CLensFlareReferenceTree();
|
||||
|
||||
private:
|
||||
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
#endif // CRYINCLUDE_EDITOR_LENSFLAREEDITOR_LENSFLAREREFERENCETREE_H
|
||||
@@ -1,239 +0,0 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
// Original file Copyright Crytek GMBH or its affiliates, used under license.
|
||||
|
||||
#include "EditorDefs.h"
|
||||
|
||||
#include "LensFlareUndo.h"
|
||||
|
||||
// Editor
|
||||
#include "LensFlareEditor.h"
|
||||
#include "LensFlareItem.h"
|
||||
#include "LensFlareManager.h"
|
||||
#include "LensFlareElementTree.h"
|
||||
|
||||
|
||||
void RestoreLensFlareItem(CLensFlareItem* pLensFlareItem, IOpticsElementBasePtr pOptics, const QString& flarePathName)
|
||||
{
|
||||
pLensFlareItem->ReplaceOptics(pOptics);
|
||||
|
||||
CLensFlareEditor* pEditor = CLensFlareEditor::GetLensFlareEditor();
|
||||
if (pEditor)
|
||||
{
|
||||
if (pOptics->GetType() == eFT_Root)
|
||||
{
|
||||
pEditor->RenameLensFlareItem(pLensFlareItem, pLensFlareItem->GetGroupName(), LensFlareUtil::GetShortName(flarePathName));
|
||||
pEditor->UpdateLensFlareItem(pLensFlareItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ActivateLensFlareItem(CLensFlareItem* pLensFlareItem, bool bRestoreSelectInfo, const QString& selectedFlareItemName)
|
||||
{
|
||||
CLensFlareEditor* pEditor = CLensFlareEditor::GetLensFlareEditor();
|
||||
if (pEditor == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (pLensFlareItem == pEditor->GetLensFlareElementTree()->GetLensFlareItem())
|
||||
{
|
||||
pEditor->UpdateLensFlareItem(pLensFlareItem);
|
||||
if (bRestoreSelectInfo)
|
||||
{
|
||||
pEditor->SelectItemInLensFlareElementTreeByName(selectedFlareItemName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CUndoLensFlareItem::CUndoLensFlareItem(CLensFlareItem* pLensFlareItem, const QString& undoDescription)
|
||||
{
|
||||
if (pLensFlareItem)
|
||||
{
|
||||
m_Undo.m_pOptics = LensFlareUtil::CreateOptics(pLensFlareItem->GetOptics());
|
||||
m_flarePathName = pLensFlareItem->GetFullName();
|
||||
m_Undo.m_bRestoreSelectInfo = false;
|
||||
CLensFlareEditor* pEditor = CLensFlareEditor::GetLensFlareEditor();
|
||||
if (pEditor)
|
||||
{
|
||||
m_Undo.m_bRestoreSelectInfo = pEditor->GetSelectedLensFlareName(m_Undo.m_selectedFlareItemName);
|
||||
}
|
||||
m_undoDescription = undoDescription;
|
||||
}
|
||||
}
|
||||
|
||||
CUndoLensFlareItem::~CUndoLensFlareItem()
|
||||
{
|
||||
}
|
||||
|
||||
void CUndoLensFlareItem::Undo(bool bUndo)
|
||||
{
|
||||
if (bUndo)
|
||||
{
|
||||
CLensFlareItem* pLensFlareItem = (CLensFlareItem*)GetIEditor()->GetLensFlareManager()->FindItemByName(m_flarePathName);
|
||||
CLensFlareEditor* pEditor = CLensFlareEditor::GetLensFlareEditor();
|
||||
if (pEditor && pLensFlareItem)
|
||||
{
|
||||
m_Redo.m_bRestoreSelectInfo = false;
|
||||
m_Redo.m_pOptics = LensFlareUtil::CreateOptics(pLensFlareItem->GetOptics());
|
||||
m_Redo.m_bRestoreSelectInfo = pEditor->GetSelectedLensFlareName(m_Redo.m_selectedFlareItemName);
|
||||
}
|
||||
}
|
||||
Restore(m_Undo);
|
||||
}
|
||||
|
||||
void CUndoLensFlareItem::Redo()
|
||||
{
|
||||
Restore(m_Redo);
|
||||
}
|
||||
|
||||
void CUndoLensFlareItem::Restore(const SData& data)
|
||||
{
|
||||
if (data.m_pOptics == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
CLensFlareItem* pLensFlareItem = (CLensFlareItem*)GetIEditor()->GetLensFlareManager()->FindItemByName(m_flarePathName);
|
||||
if (pLensFlareItem == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
RestoreLensFlareItem(pLensFlareItem, data.m_pOptics, m_flarePathName);
|
||||
ActivateLensFlareItem(pLensFlareItem, data.m_bRestoreSelectInfo, data.m_selectedFlareItemName);
|
||||
}
|
||||
|
||||
CUndoRenameLensFlareItem::CUndoRenameLensFlareItem(const QString& oldFullName, const QString& newFullName)
|
||||
{
|
||||
m_undo.m_oldFullItemName = oldFullName;
|
||||
m_undo.m_newFullItemName = newFullName;
|
||||
}
|
||||
|
||||
void CUndoRenameLensFlareItem::Undo(bool bUndo)
|
||||
{
|
||||
if (bUndo)
|
||||
{
|
||||
m_redo.m_oldFullItemName = m_undo.m_newFullItemName;
|
||||
m_redo.m_newFullItemName = m_undo.m_oldFullItemName;
|
||||
}
|
||||
|
||||
Rename(m_undo);
|
||||
}
|
||||
|
||||
void CUndoRenameLensFlareItem::Redo()
|
||||
{
|
||||
Rename(m_redo);
|
||||
}
|
||||
|
||||
void CUndoRenameLensFlareItem::Rename(const SUndoDataStruct& data)
|
||||
{
|
||||
CLensFlareEditor* pEditor = CLensFlareEditor::GetLensFlareEditor();
|
||||
if (pEditor == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
CLensFlareItem* pLensFlareItem = (CLensFlareItem*)GetIEditor()->GetLensFlareManager()->FindItemByName(data.m_newFullItemName);
|
||||
if (pLensFlareItem == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
int nDotPos = data.m_oldFullItemName.indexOf(".");
|
||||
if (nDotPos == -1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
QString shortName(LensFlareUtil::GetShortName(data.m_oldFullItemName));
|
||||
QString groupName(LensFlareUtil::GetGroupNameFromFullName(data.m_oldFullItemName));
|
||||
pEditor->RenameLensFlareItem(pLensFlareItem, groupName, shortName);
|
||||
if (pLensFlareItem->GetOptics())
|
||||
{
|
||||
pLensFlareItem->GetOptics()->SetName(shortName.toUtf8().data());
|
||||
LensFlareUtil::UpdateOpticsName(pLensFlareItem->GetOptics());
|
||||
}
|
||||
pEditor->UpdateLensFlareItem(pLensFlareItem);
|
||||
}
|
||||
|
||||
CUndoLensFlareElementSelection::CUndoLensFlareElementSelection(CLensFlareItem* pLensFlareItem, const QString& flareTreeItemFullName, const QString& undoDescription)
|
||||
{
|
||||
if (pLensFlareItem)
|
||||
{
|
||||
m_flarePathNameForUndo = pLensFlareItem->GetFullName();
|
||||
m_flareTreeItemFullNameForUndo = flareTreeItemFullName;
|
||||
m_undoDescription = undoDescription;
|
||||
}
|
||||
}
|
||||
|
||||
void CUndoLensFlareElementSelection::Undo(bool bUndo)
|
||||
{
|
||||
if (bUndo)
|
||||
{
|
||||
m_flarePathNameForRedo = m_flarePathNameForUndo;
|
||||
CLensFlareEditor* pEditor = CLensFlareEditor::GetLensFlareEditor();
|
||||
if (pEditor)
|
||||
{
|
||||
pEditor->GetSelectedLensFlareName(m_flareTreeItemFullNameForRedo);
|
||||
}
|
||||
}
|
||||
|
||||
CLensFlareItem* pLensFlareItem = (CLensFlareItem*)GetIEditor()->GetLensFlareManager()->FindItemByName(m_flarePathNameForUndo);
|
||||
if (pLensFlareItem == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
ActivateLensFlareItem(pLensFlareItem, true, m_flareTreeItemFullNameForUndo);
|
||||
}
|
||||
|
||||
void CUndoLensFlareElementSelection::Redo()
|
||||
{
|
||||
CLensFlareItem* pLensFlareItem = (CLensFlareItem*)GetIEditor()->GetLensFlareManager()->FindItemByName(m_flarePathNameForRedo);
|
||||
if (pLensFlareItem == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
ActivateLensFlareItem(pLensFlareItem, true, m_flareTreeItemFullNameForRedo);
|
||||
}
|
||||
|
||||
CUndoLensFlareItemSelectionChange::CUndoLensFlareItemSelectionChange(const QString& fullLensFlareItemName, const QString& undoDescription)
|
||||
{
|
||||
m_FullLensFlareItemNameForUndo = fullLensFlareItemName;
|
||||
m_undoDescription = undoDescription;
|
||||
}
|
||||
|
||||
void CUndoLensFlareItemSelectionChange::Undo(bool bUndo)
|
||||
{
|
||||
CLensFlareEditor* pEditor = CLensFlareEditor::GetLensFlareEditor();
|
||||
if (pEditor == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (bUndo)
|
||||
{
|
||||
QString currentFullName;
|
||||
pEditor->GetFullSelectedFlareItemName(currentFullName);
|
||||
m_FullLensFlareItemNameForRedo = currentFullName;
|
||||
}
|
||||
|
||||
pEditor->SelectLensFlareItem(m_FullLensFlareItemNameForUndo);
|
||||
}
|
||||
|
||||
void CUndoLensFlareItemSelectionChange::Redo()
|
||||
{
|
||||
CLensFlareEditor* pEditor = CLensFlareEditor::GetLensFlareEditor();
|
||||
if (pEditor == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
pEditor->SelectLensFlareItem(m_FullLensFlareItemNameForRedo);
|
||||
}
|
||||
@@ -1,143 +0,0 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
// Original file Copyright Crytek GMBH or its affiliates, used under license.
|
||||
|
||||
#ifndef CRYINCLUDE_EDITOR_LENSFLAREEDITOR_LENSFLAREUNDO_H
|
||||
#define CRYINCLUDE_EDITOR_LENSFLAREEDITOR_LENSFLAREUNDO_H
|
||||
#pragma once
|
||||
|
||||
#include "Undo/IUndoObject.h"
|
||||
|
||||
class CLensFlareItem;
|
||||
|
||||
class CUndoLensFlareItem
|
||||
: public IUndoObject
|
||||
{
|
||||
public:
|
||||
CUndoLensFlareItem(CLensFlareItem* pGroupItem, const QString& undoDescription = "Undo Lens Flare Tree");
|
||||
~CUndoLensFlareItem();
|
||||
|
||||
protected:
|
||||
int GetSize()
|
||||
{
|
||||
return sizeof(*this);
|
||||
}
|
||||
QString GetDescription() { return m_undoDescription; };
|
||||
void Undo(bool bUndo);
|
||||
void Redo();
|
||||
|
||||
private:
|
||||
|
||||
QString m_undoDescription;
|
||||
|
||||
struct SData
|
||||
{
|
||||
SData()
|
||||
{
|
||||
m_pOptics = NULL;
|
||||
}
|
||||
|
||||
QString m_selectedFlareItemName;
|
||||
bool m_bRestoreSelectInfo;
|
||||
IOpticsElementBasePtr m_pOptics;
|
||||
};
|
||||
|
||||
QString m_flarePathName;
|
||||
SData m_Undo;
|
||||
SData m_Redo;
|
||||
|
||||
void Restore(const SData& data);
|
||||
};
|
||||
|
||||
class CUndoRenameLensFlareItem
|
||||
: public IUndoObject
|
||||
{
|
||||
public:
|
||||
|
||||
CUndoRenameLensFlareItem(const QString& oldFullName, const QString& newFullName);
|
||||
|
||||
protected:
|
||||
|
||||
int GetSize()
|
||||
{
|
||||
return sizeof(*this);
|
||||
}
|
||||
QString GetDescription() { return m_undoDescription; };
|
||||
void Undo(bool bUndo);
|
||||
void Redo();
|
||||
|
||||
private:
|
||||
|
||||
QString m_undoDescription;
|
||||
|
||||
struct SUndoDataStruct
|
||||
{
|
||||
QString m_oldFullItemName;
|
||||
QString m_newFullItemName;
|
||||
};
|
||||
|
||||
void Rename(const SUndoDataStruct& data);
|
||||
|
||||
SUndoDataStruct m_undo;
|
||||
SUndoDataStruct m_redo;
|
||||
};
|
||||
|
||||
class CUndoLensFlareElementSelection
|
||||
: public IUndoObject
|
||||
{
|
||||
public:
|
||||
CUndoLensFlareElementSelection(CLensFlareItem* pLensFlareItem, const QString& flareTreeItemFullName, const QString& undoDescription = "Undo Lens Flare Element Tree");
|
||||
~CUndoLensFlareElementSelection(){}
|
||||
|
||||
protected:
|
||||
int GetSize()
|
||||
{
|
||||
return sizeof(*this);
|
||||
}
|
||||
QString GetDescription() { return m_undoDescription; };
|
||||
void Undo(bool bUndo);
|
||||
void Redo();
|
||||
|
||||
private:
|
||||
|
||||
QString m_undoDescription;
|
||||
|
||||
QString m_flarePathNameForUndo;
|
||||
QString m_flareTreeItemFullNameForUndo;
|
||||
|
||||
QString m_flarePathNameForRedo;
|
||||
QString m_flareTreeItemFullNameForRedo;
|
||||
};
|
||||
|
||||
class CUndoLensFlareItemSelectionChange
|
||||
: public IUndoObject
|
||||
{
|
||||
public:
|
||||
CUndoLensFlareItemSelectionChange(const QString& fullLensFlareItemName, const QString& undoDescription = "Undo Lens Flare element selection");
|
||||
~CUndoLensFlareItemSelectionChange(){}
|
||||
|
||||
protected:
|
||||
int GetSize()
|
||||
{
|
||||
return sizeof(*this);
|
||||
}
|
||||
QString GetDescription() { return m_undoDescription; };
|
||||
|
||||
void Undo(bool bUndo);
|
||||
void Redo();
|
||||
|
||||
private:
|
||||
QString m_undoDescription;
|
||||
QString m_FullLensFlareItemNameForUndo;
|
||||
QString m_FullLensFlareItemNameForRedo;
|
||||
};
|
||||
#endif // CRYINCLUDE_EDITOR_LENSFLAREEDITOR_LENSFLAREUNDO_H
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,363 +0,0 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
// Original file Copyright Crytek GMBH or its affiliates, used under license.
|
||||
|
||||
#ifndef CRYINCLUDE_EDITOR_LENSFLAREEDITOR_LENSFLAREUTIL_H
|
||||
#define CRYINCLUDE_EDITOR_LENSFLAREEDITOR_LENSFLAREUTIL_H
|
||||
#pragma once
|
||||
|
||||
#include <QTreeView>
|
||||
#include <QModelIndex>
|
||||
|
||||
#include "Util/Variable.h"
|
||||
|
||||
#include "IFlares.h"
|
||||
class CEntityObject;
|
||||
|
||||
class QTreeView;
|
||||
|
||||
#define LENSFLARE_ELEMENT_TREE "LensFlareElementTree"
|
||||
#define LENSFLARE_ITEM_TREE "LensFlareItemTree"
|
||||
#define FLARECLIPBOARDTYPE_COPY "Copy"
|
||||
#define FLARECLIPBOARDTYPE_CUT "Cut"
|
||||
|
||||
namespace LensFlareUtil
|
||||
{
|
||||
inline bool IsElement(EFlareType type)
|
||||
{
|
||||
return type != eFT__Base__ && type != eFT_Root && type != eFT_Group;
|
||||
}
|
||||
inline bool IsGroup(EFlareType type)
|
||||
{
|
||||
return type == eFT_Root || type == eFT_Group;
|
||||
}
|
||||
inline bool IsValidFlare(EFlareType type)
|
||||
{
|
||||
return type >= eFT__Base__ && type < eFT_Max;
|
||||
}
|
||||
|
||||
inline void AddVariable(CVariableBase& varArray, CVariableBase& var, const char* varName, const char* humanVarName, const char* description, char dataType = IVariable::DT_SIMPLE)
|
||||
{
|
||||
if (varName)
|
||||
{
|
||||
var.SetName(varName);
|
||||
}
|
||||
if (humanVarName)
|
||||
{
|
||||
var.SetHumanName(humanVarName);
|
||||
}
|
||||
if (description)
|
||||
{
|
||||
var.SetDescription(description);
|
||||
}
|
||||
var.SetDataType(dataType);
|
||||
varArray.AddVariable(&var);
|
||||
}
|
||||
|
||||
inline void AddVariable(CVarBlock* vars, CVariableBase& var, const char* varName, const char* humanVarName, const char* description, unsigned char dataType = IVariable::DT_SIMPLE)
|
||||
{
|
||||
if (varName)
|
||||
{
|
||||
var.SetName(varName);
|
||||
}
|
||||
if (humanVarName)
|
||||
{
|
||||
var.SetHumanName(humanVarName);
|
||||
}
|
||||
if (description)
|
||||
{
|
||||
var.SetDescription(description);
|
||||
}
|
||||
var.SetDataType(dataType);
|
||||
vars->AddVariable(&var);
|
||||
}
|
||||
|
||||
inline bool GetFlareType(const QString& typeName, EFlareType& outType)
|
||||
{
|
||||
FlareInfoArray::Props array = FlareInfoArray::Get();
|
||||
for (size_t i = 0; i < array.size; ++i)
|
||||
{
|
||||
if (typeName == array.p[i].name)
|
||||
{
|
||||
outType = array.p[i].type;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
inline bool GetFlareTypeName(QString& outTypeName, IOpticsElementBasePtr pOptics)
|
||||
{
|
||||
if (pOptics == NULL)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
const FlareInfoArray::Props array = FlareInfoArray::Get();
|
||||
for (size_t i = 0; i < array.size; ++i)
|
||||
{
|
||||
if (array.p[i].type == pOptics->GetType())
|
||||
{
|
||||
outTypeName = array.p[i].name;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
inline QString GetShortName(const QString& name)
|
||||
{
|
||||
int nPos = name.lastIndexOf('.');
|
||||
if (nPos == -1)
|
||||
{
|
||||
return name;
|
||||
}
|
||||
return name.right(name.length() - nPos - 1);
|
||||
}
|
||||
|
||||
inline QString GetGroupNameFromName(const QString& name)
|
||||
{
|
||||
int nPos = name.lastIndexOf('.');
|
||||
if (nPos == -1)
|
||||
{
|
||||
return name;
|
||||
}
|
||||
return name.left(nPos);
|
||||
}
|
||||
|
||||
inline QString GetGroupNameFromFullName(const QString& fullItemName)
|
||||
{
|
||||
int nLastDotPos = fullItemName.lastIndexOf('.');
|
||||
if (nLastDotPos == -1)
|
||||
{
|
||||
return fullItemName;
|
||||
}
|
||||
|
||||
QString name = GetGroupNameFromName(fullItemName);
|
||||
|
||||
int nFirstDotPos = name.indexOf('.');
|
||||
if (nFirstDotPos == -1)
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
return name.right(name.length() - nFirstDotPos - 1);
|
||||
}
|
||||
|
||||
inline bool HaveParameterLowBoundary(const QString& paramName)
|
||||
{
|
||||
if (!QString::compare(paramName, "Noiseseed", Qt::CaseInsensitive) || !QString::compare(paramName, "translation", Qt::CaseInsensitive) || !QString::compare(paramName, "position", Qt::CaseInsensitive) || !QString::compare(paramName, "rotation", Qt::CaseInsensitive))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
inline int MakeFuncKey(int nGroupIndex, int nVarIndex)
|
||||
{
|
||||
return (nGroupIndex << 16) | nVarIndex;
|
||||
}
|
||||
|
||||
template<class T>
|
||||
inline void BoundaryProcess(T& fValue)
|
||||
{
|
||||
if (fValue < 0)
|
||||
{
|
||||
fValue = 0;
|
||||
}
|
||||
}
|
||||
|
||||
inline void BoundaryProcess(Vec2& v)
|
||||
{
|
||||
if (v.x < 0)
|
||||
{
|
||||
v.x = 0;
|
||||
}
|
||||
if (v.y < 0)
|
||||
{
|
||||
v.y = 0;
|
||||
}
|
||||
}
|
||||
|
||||
inline void BoundaryProcess(Vec3& v)
|
||||
{
|
||||
if (v.x < 0)
|
||||
{
|
||||
v.x = 0;
|
||||
}
|
||||
if (v.y < 0)
|
||||
{
|
||||
v.y = 0;
|
||||
}
|
||||
if (v.z < 0)
|
||||
{
|
||||
v.z = 0;
|
||||
}
|
||||
}
|
||||
|
||||
inline void BoundaryProcess(Vec4& v)
|
||||
{
|
||||
if (v.x < 0)
|
||||
{
|
||||
v.x = 0;
|
||||
}
|
||||
if (v.y < 0)
|
||||
{
|
||||
v.y = 0;
|
||||
}
|
||||
if (v.z < 0)
|
||||
{
|
||||
v.z = 0;
|
||||
}
|
||||
if (v.w < 0)
|
||||
{
|
||||
v.w = 0;
|
||||
}
|
||||
}
|
||||
|
||||
inline bool ExtractVec4FromString(const string& buffer, Vec4& outVec4)
|
||||
{
|
||||
int nCount(0);
|
||||
string copiedBuffer(buffer);
|
||||
int commaPos(0);
|
||||
while (nCount < 4 || commaPos != -1)
|
||||
{
|
||||
commaPos = copiedBuffer.find(",");
|
||||
string strV;
|
||||
if (commaPos == -1)
|
||||
{
|
||||
strV = copiedBuffer;
|
||||
}
|
||||
else
|
||||
{
|
||||
strV = copiedBuffer.Left(commaPos);
|
||||
strV += ",";
|
||||
}
|
||||
copiedBuffer.replace(0, commaPos + 1, "");
|
||||
outVec4[nCount++] = (float)atof(strV.c_str());
|
||||
}
|
||||
return nCount == 4;
|
||||
}
|
||||
|
||||
void FillParams(XmlNodeRef& paramNode, IOpticsElementBase* pOptics);
|
||||
|
||||
inline bool FindGroup(const char* groupName, IOpticsElementBase* pOptics, int& nOutGroupIndex)
|
||||
{
|
||||
if (groupName == NULL)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
AZStd::vector<FuncVariableGroup> groupArray = pOptics->GetEditorParamGroups();
|
||||
for (int i = 0, iCount(groupArray.size()); i < iCount; ++i)
|
||||
{
|
||||
if (!_stricmp(groupArray[i].GetName(), groupName))
|
||||
{
|
||||
nOutGroupIndex = i;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
struct SClipboardData
|
||||
{
|
||||
SClipboardData(){}
|
||||
~SClipboardData(){}
|
||||
SClipboardData(const QString& from, const QString& lensFlareFullPath, const QString& lensOpticsPath)
|
||||
: m_From(from)
|
||||
, m_LensFlareFullPath(lensFlareFullPath)
|
||||
, m_LensOpticsPath(lensOpticsPath)
|
||||
{
|
||||
}
|
||||
|
||||
void FillXmlNode(XmlNodeRef node)
|
||||
{
|
||||
if (node == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
node->setAttr("From", m_From.toUtf8().data());
|
||||
node->setAttr("FlareFullPath", m_LensFlareFullPath.toUtf8().data());
|
||||
node->setAttr("OpticsPath", m_LensOpticsPath.toUtf8().data());
|
||||
}
|
||||
|
||||
void FillThisFromXmlNode(XmlNodeRef node)
|
||||
{
|
||||
if (node == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
node->getAttr("From", m_From);
|
||||
node->getAttr("FlareFullPath", m_LensFlareFullPath);
|
||||
node->getAttr("OpticsPath", m_LensOpticsPath);
|
||||
}
|
||||
|
||||
QString m_From;
|
||||
QString m_LensFlareFullPath;
|
||||
QString m_LensOpticsPath;
|
||||
};
|
||||
|
||||
struct SDragAndDropInfo
|
||||
{
|
||||
SDragAndDropInfo()
|
||||
{
|
||||
m_XMLContents = NULL;
|
||||
m_bDragging = false;
|
||||
}
|
||||
~SDragAndDropInfo()
|
||||
{
|
||||
Reset();
|
||||
}
|
||||
void Reset()
|
||||
{
|
||||
m_XMLContents = NULL;
|
||||
m_bDragging = false;
|
||||
}
|
||||
bool m_bDragging;
|
||||
XmlNodeRef m_XMLContents;
|
||||
};
|
||||
|
||||
inline SDragAndDropInfo& GetDragDropInfo()
|
||||
{
|
||||
static SDragAndDropInfo dragDropInfo;
|
||||
return dragDropInfo;
|
||||
}
|
||||
|
||||
int FindOpticsIndexUnderParentOptics(IOpticsElementBasePtr pOptics, IOpticsElementBasePtr pParentOptics);
|
||||
bool IsPointInWindow(const QWidget* pWindow, const QPoint& screenPos);
|
||||
QModelIndex GetTreeItemByHitTest(QTreeView& treeCtrl);
|
||||
QPoint GetDragCursorPos(QWidget* pWnd, const QPoint& point);
|
||||
void GetExpandedItemNames(CBaseLibraryItem* item, const QString& groupName, const QString& itemName, QString& outNameWithGroup, QString& outFullName);
|
||||
void GetSelectedLightEntities(std::vector<CEntityObject*>& outLightEntities);
|
||||
void GetLightEntityObjects(std::vector<CEntityObject*>& outEntityLights);
|
||||
IFuncVariable* GetFuncVariable(IOpticsElementBasePtr pOptics, int nFuncKey);
|
||||
QString ReplaceLastName(const QString& fullName, const QString& shortName);
|
||||
void UpdateOpticsName(IOpticsElementBasePtr pOptics);
|
||||
XmlNodeRef CreateXMLFromClipboardData(const QString& type, const QString& groupName, bool bPasteAtSameLevel, std::vector<SClipboardData>& dataList);
|
||||
void UpdateClipboard(const QString& type, const QString& groupName, bool bPasteAtSameLevel, std::vector<SClipboardData>& dataList);
|
||||
void ChangeOpticsRootName(IOpticsElementBasePtr pOptics, const QString& newRootName);
|
||||
void RemoveOptics(IOpticsElementBasePtr pOptics);
|
||||
IOpticsElementBasePtr FindOptics(IOpticsElementBasePtr pStartOptics, const QString& name);
|
||||
CEntityObject* GetSelectedLightEntity();
|
||||
IOpticsElementBasePtr GetSelectedLightOptics();
|
||||
IOpticsElementBasePtr CreateOptics(const XmlNodeRef& xmlNode);
|
||||
IOpticsElementBasePtr CreateOptics(IOpticsElementBasePtr pOptics, bool bForceTypeToGroup = false);
|
||||
bool FillOpticsFromXML(IOpticsElementBasePtr pOptics, const XmlNodeRef& xmlNode);
|
||||
bool CreateXmlData(IOpticsElementBasePtr pOptics, XmlNodeRef& pOutNode);
|
||||
void SetVariablesTemplateFromOptics(IOpticsElementBasePtr pOptics, CVarBlockPtr& pRootVar, std::vector<IVariable::OnSetCallback*>& funcs);
|
||||
void SetVariablesTemplateFromOptics(IOpticsElementBasePtr pOptics, CVarBlockPtr& pRootVar);
|
||||
void CopyOptics(IOpticsElementBasePtr pSrcOptics, IOpticsElementBasePtr pDestOptics, bool bReculsiveCopy = true);
|
||||
void OutputOpticsDebug(IOpticsElementBasePtr pOptics);
|
||||
};
|
||||
#endif // CRYINCLUDE_EDITOR_LENSFLAREEDITOR_LENSFLAREUTIL_H
|
||||
@@ -1,108 +0,0 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
// Original file Copyright Crytek GMBH or its affiliates, used under license.
|
||||
|
||||
#include "EditorDefs.h"
|
||||
|
||||
#include "LensFlareView.h"
|
||||
|
||||
// Editor
|
||||
#include "LensFlareItem.h"
|
||||
#include "LensFlareEditor.h"
|
||||
#include "Objects/EntityObject.h"
|
||||
#include "Material/MaterialManager.h"
|
||||
|
||||
|
||||
CLensFlareView::CLensFlareView(QWidget* parent, Qt::WindowFlags f)
|
||||
: CPreviewModelCtrl(parent, f)
|
||||
{
|
||||
InitDialog();
|
||||
}
|
||||
|
||||
CLensFlareView::~CLensFlareView()
|
||||
{
|
||||
CLensFlareEditor::GetLensFlareEditor()->UnregisterLensFlareItemChangeListener(this);
|
||||
}
|
||||
|
||||
void CLensFlareView::InitDialog()
|
||||
{
|
||||
CLensFlareEditor::GetLensFlareEditor()->RegisterLensFlareItemChangeListener(this);
|
||||
|
||||
SetClearColor(ColorF(0, 0, 0, 0));
|
||||
SetGrid(true);
|
||||
SetAxis(true);
|
||||
EnableUpdate(true);
|
||||
m_pLensFlareMaterial = GetIEditor()->GetMaterialManager()->LoadMaterial(CEntityObject::s_LensFlareMaterialName);
|
||||
m_InitCameraPos = m_camera.GetPosition();
|
||||
}
|
||||
|
||||
void CLensFlareView::RenderObject(_smart_ptr<IMaterial> pMaterial, [[maybe_unused]] SRenderingPassInfo& passInfo)
|
||||
{
|
||||
if (m_pLensFlareItem)
|
||||
{
|
||||
IOpticsElementBasePtr pOptics = m_pLensFlareItem->GetOptics();
|
||||
if (pOptics && m_pLensFlareMaterial)
|
||||
{
|
||||
_smart_ptr<IMaterial> pMaterial = m_pLensFlareMaterial->GetMatInfo();
|
||||
if (pMaterial)
|
||||
{
|
||||
m_pRenderer->ForceUpdateGlobalShaderParameters();
|
||||
m_pRenderer->SetViewport(1, 1, m_pRenderer->GetWidth(), m_pRenderer->GetHeight());
|
||||
SShaderItem& shaderItem = pMaterial->GetShaderItem();
|
||||
SLensFlareRenderParam param;
|
||||
param.pCamera = &m_camera;
|
||||
param.pShader = shaderItem.m_pShader;
|
||||
pOptics->Render(¶m, Vec3(0, 0, 0));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CLensFlareView::OnLensFlareChangeItem(CLensFlareItem* pLensFlareItem)
|
||||
{
|
||||
if (m_pLensFlareItem != pLensFlareItem)
|
||||
{
|
||||
m_pLensFlareItem = pLensFlareItem;
|
||||
Update(true);
|
||||
m_bHaveAnythingToRender = m_pLensFlareItem != NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void CLensFlareView::OnLensFlareDeleteItem(CLensFlareItem* pLensFlareItem)
|
||||
{
|
||||
if (m_pLensFlareItem == pLensFlareItem)
|
||||
{
|
||||
m_pLensFlareItem = NULL;
|
||||
Update();
|
||||
m_bHaveAnythingToRender = false;
|
||||
}
|
||||
}
|
||||
|
||||
void CLensFlareView::OnInternalVariableChange([[maybe_unused]] IVariable* pVar)
|
||||
{
|
||||
Update();
|
||||
}
|
||||
|
||||
void CLensFlareView::OnLensFlareChangeElement([[maybe_unused]] CLensFlareElement* pLensFlareElement)
|
||||
{
|
||||
Update();
|
||||
}
|
||||
|
||||
void CLensFlareView::OnEditorNotifyEvent(EEditorNotifyEvent event)
|
||||
{
|
||||
switch (event)
|
||||
{
|
||||
case eNotify_OnCloseScene:
|
||||
ReleaseObject();
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1,51 +0,0 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
// Original file Copyright Crytek GMBH or its affiliates, used under license.
|
||||
|
||||
#ifndef CRYINCLUDE_EDITOR_LENSFLAREEDITOR_LENSFLAREVIEW_H
|
||||
#define CRYINCLUDE_EDITOR_LENSFLAREEDITOR_LENSFLAREVIEW_H
|
||||
#pragma once
|
||||
|
||||
#include "ILensFlareListener.h"
|
||||
#include "Controls/PreviewModelCtrl.h"
|
||||
|
||||
class CLensFlareView
|
||||
: public CPreviewModelCtrl
|
||||
, public ILensFlareChangeItemListener
|
||||
, public ILensFlareChangeElementListener
|
||||
{
|
||||
public:
|
||||
explicit CLensFlareView(QWidget* parent = nullptr, Qt::WindowFlags f = Qt::WindowFlags());
|
||||
~CLensFlareView();
|
||||
|
||||
void OnInternalVariableChange(IVariable* pVar);
|
||||
void OnEditorNotifyEvent(EEditorNotifyEvent event);
|
||||
|
||||
protected:
|
||||
|
||||
void InitDialog();
|
||||
void ProcessKeys(){}
|
||||
void RenderObject(_smart_ptr<IMaterial> pMaterial, SRenderingPassInfo& passInfo);
|
||||
|
||||
void OnLensFlareChangeItem(CLensFlareItem* pLensFlareItem);
|
||||
void OnLensFlareDeleteItem(CLensFlareItem* pLensFlareItem);
|
||||
void OnLensFlareChangeElement(CLensFlareElement* pLensFlareElement);
|
||||
|
||||
private:
|
||||
|
||||
QPoint m_prevPoint;
|
||||
Vec3 m_InitCameraPos;
|
||||
|
||||
_smart_ptr<CMaterial> m_pLensFlareMaterial;
|
||||
_smart_ptr<CLensFlareItem> m_pLensFlareItem;
|
||||
};
|
||||
#endif // CRYINCLUDE_EDITOR_LENSFLAREEDITOR_LENSFLAREVIEW_H
|
||||
@@ -96,7 +96,6 @@ public:
|
||||
MOCK_METHOD0(GetIEditorMaterialManager, IEditorMaterialManager* ());
|
||||
MOCK_METHOD0(GetIconManager, IIconManager* ());
|
||||
MOCK_METHOD0(GetMusicManager, CMusicManager* ());
|
||||
MOCK_METHOD0(GetLensFlareManager, CLensFlareManager* ());
|
||||
MOCK_METHOD2(GetTerrainElevation, float(float , float ));
|
||||
MOCK_METHOD0(GetVegetationMap, class CVegetationMap* ());
|
||||
MOCK_METHOD0(GetEditorQtApplication, Editor::EditorQtApplication* ());
|
||||
|
||||
@@ -44,7 +44,6 @@ namespace LyViewPane
|
||||
static const char* const TerrainTool = "Terrain Tool";
|
||||
static const char* const TerrainTextureLayers = "Terrain Texture Layers";
|
||||
static const char* const ParticleEditor = "Particle Editor";
|
||||
static const char* const LensFlareEditor = "Lens Flare Editor";
|
||||
static const char* const TimeOfDayEditor = "Time Of Day";
|
||||
static const char* const AudioControlsEditor = "Audio Controls Editor";
|
||||
static const char* const SubstanceEditor = "Substance Editor";
|
||||
|
||||
@@ -91,7 +91,6 @@ AZ_POP_DISABLE_WARNING
|
||||
|
||||
#include "TrackView/TrackViewDialog.h"
|
||||
#include "ErrorReportDialog.h"
|
||||
#include "LensFlareEditor/LensFlareEditor.h"
|
||||
#include "TimeOfDayDialog.h"
|
||||
|
||||
#include "Dialogs/PythonScriptsDialog.h"
|
||||
@@ -1657,7 +1656,6 @@ void MainWindow::RegisterStdViewClasses()
|
||||
|
||||
if (!AZ::Interface<AzFramework::AtomActiveInterface>::Get())
|
||||
{
|
||||
CLensFlareEditor::RegisterViewClass();
|
||||
CTimeOfDayDialog::RegisterViewClass();
|
||||
}
|
||||
#ifdef ThumbnailDemo
|
||||
|
||||
@@ -29,18 +29,11 @@
|
||||
#include "Include/IObjectManager.h"
|
||||
#include "Objects/ObjectManager.h"
|
||||
#include "ViewManager.h"
|
||||
#include "LensFlareEditor/LensFlareManager.h"
|
||||
#include "LensFlareEditor/LensFlareUtil.h"
|
||||
#include "LensFlareEditor/LensFlareLibrary.h"
|
||||
#include "AnimationContext.h"
|
||||
#include "HitContext.h"
|
||||
#include "Objects/SelectionGroup.h"
|
||||
|
||||
|
||||
const char* CEntityObject::s_LensFlarePropertyName("flare_Flare");
|
||||
const char* CEntityObject::s_LensFlareMaterialName("EngineAssets/Materials/lens_optics");
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//! Undo Entity Link
|
||||
class CUndoEntityLink
|
||||
@@ -1985,14 +1978,7 @@ void CEntityObject::SetOpticsElement(IOpticsElementBase* pOptics)
|
||||
return;
|
||||
}
|
||||
pLight->SetLensOpticsElement(pOptics);
|
||||
if (GetEntityPropertyBool("bFlareEnable") && pOptics)
|
||||
{
|
||||
CBaseObject::SetMaterial(s_LensFlareMaterialName);
|
||||
}
|
||||
else
|
||||
{
|
||||
SetMaterial(NULL);
|
||||
}
|
||||
SetMaterial(NULL);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
@@ -2005,7 +1991,6 @@ void CEntityObject::ApplyOptics(const QString& opticsFullName, IOpticsElementBas
|
||||
{
|
||||
pLight->SetLensOpticsElement(NULL);
|
||||
}
|
||||
SetFlareName("");
|
||||
SetMaterial(NULL);
|
||||
}
|
||||
else
|
||||
@@ -2024,9 +2009,7 @@ void CEntityObject::ApplyOptics(const QString& opticsFullName, IOpticsElementBas
|
||||
}
|
||||
return;
|
||||
}
|
||||
LensFlareUtil::CopyOptics(pOptics, pNewOptics);
|
||||
}
|
||||
SetFlareName(opticsFullName);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2040,19 +2023,8 @@ void CEntityObject::SetOpticsName(const QString& opticsFullName)
|
||||
{
|
||||
pLight->SetLensOpticsElement(NULL);
|
||||
}
|
||||
SetFlareName("");
|
||||
SetMaterial(NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (GetOpticsElement())
|
||||
{
|
||||
if (gEnv->pOpticsManager->Rename(GetOpticsElement()->GetName(), opticsFullName.toUtf8().data()))
|
||||
{
|
||||
SetFlareName(opticsFullName);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
@@ -2080,27 +2052,6 @@ CDLight* CEntityObject::GetLightProperty() const
|
||||
return NULL;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
bool CEntityObject::GetValidFlareName(QString& outFlareName) const
|
||||
{
|
||||
IVariable* pFlareVar(m_pProperties->FindVariable(s_LensFlarePropertyName));
|
||||
if (!pFlareVar)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
QString flareName;
|
||||
pFlareVar->Get(flareName);
|
||||
if (flareName.isEmpty() || flareName == "@root")
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
outFlareName = flareName;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CEntityObject::PreInitLightProperty()
|
||||
{
|
||||
@@ -2108,42 +2059,6 @@ void CEntityObject::PreInitLightProperty()
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
QString flareFullName;
|
||||
if (GetValidFlareName(flareFullName))
|
||||
{
|
||||
bool bEnableOptics = GetEntityPropertyBool("bFlareEnable");
|
||||
if (bEnableOptics)
|
||||
{
|
||||
CLensFlareManager* pLensManager = GetIEditor()->GetLensFlareManager();
|
||||
CLensFlareLibrary* pLevelLib = (CLensFlareLibrary*)pLensManager->GetLevelLibrary();
|
||||
IOpticsElementBasePtr pLevelOptics = pLevelLib->GetOpticsOfItem(flareFullName.toUtf8().data());
|
||||
if (pLevelLib && pLevelOptics)
|
||||
{
|
||||
int nOpticsIndex(0);
|
||||
IOpticsElementBasePtr pNewOptics = GetOpticsElement();
|
||||
if (pNewOptics == NULL)
|
||||
{
|
||||
pNewOptics = gEnv->pOpticsManager->Create(eFT_Root);
|
||||
}
|
||||
|
||||
if (gEnv->pOpticsManager->AddOptics(pNewOptics, flareFullName.toUtf8().data(), nOpticsIndex))
|
||||
{
|
||||
LensFlareUtil::CopyOptics(pLevelOptics, pNewOptics);
|
||||
SetOpticsElement(pNewOptics);
|
||||
}
|
||||
else
|
||||
{
|
||||
CDLight* pLight = GetLightProperty();
|
||||
if (pLight)
|
||||
{
|
||||
pLight->SetLensOpticsElement(NULL);
|
||||
SetMaterial(NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
@@ -2153,26 +2068,6 @@ void CEntityObject::UpdateLightProperty()
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
QString flareName;
|
||||
if (GetValidFlareName(flareName))
|
||||
{
|
||||
IOpticsElementBasePtr pOptics = GetOpticsElement();
|
||||
if (pOptics == NULL)
|
||||
{
|
||||
pOptics = gEnv->pOpticsManager->Create(eFT_Root);
|
||||
}
|
||||
bool bEnableOptics = GetEntityPropertyBool("bFlareEnable");
|
||||
if (bEnableOptics && GetIEditor()->GetLensFlareManager()->LoadFlareItemByName(flareName, pOptics))
|
||||
{
|
||||
pOptics->SetName(flareName.toUtf8().data());
|
||||
SetOpticsElement(pOptics);
|
||||
}
|
||||
else
|
||||
{
|
||||
SetOpticsElement(NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -224,7 +224,6 @@ public:
|
||||
void SetOpticsElement(IOpticsElementBase* pOptics);
|
||||
void ApplyOptics(const QString& opticsFullName, IOpticsElementBasePtr pOptics);
|
||||
void SetOpticsName(const QString& opticsFullName);
|
||||
bool GetValidFlareName(QString& outFlareName) const;
|
||||
|
||||
void PreInitLightProperty();
|
||||
void UpdateLightProperty();
|
||||
@@ -236,9 +235,6 @@ public:
|
||||
|
||||
static void StoreUndoEntityLink(CSelectionGroup* pGroup);
|
||||
|
||||
static const char* s_LensFlarePropertyName;
|
||||
static const char* s_LensFlareMaterialName;
|
||||
|
||||
void RegisterListener(IEntityObjectListener* pListener);
|
||||
void UnregisterListener(IEntityObjectListener* pListener);
|
||||
|
||||
@@ -322,11 +318,6 @@ protected:
|
||||
void AdjustLightProperties(CVarBlockPtr& properties, const char* pSubBlock);
|
||||
IVariable* FindVariableInSubBlock(CVarBlockPtr& properties, IVariable* pSubBlockVar, const char* pVarName);
|
||||
|
||||
void SetFlareName(const QString& name)
|
||||
{
|
||||
SetEntityPropertyString(s_LensFlarePropertyName, name);
|
||||
}
|
||||
|
||||
unsigned int m_bLoadFailed : 1;
|
||||
unsigned int m_bCalcPhysics : 1;
|
||||
unsigned int m_bDisplayBBox : 1;
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
|
||||
#DatabaseFrameWnd QToolBar
|
||||
{
|
||||
border-bottom: 2px solid #111111;
|
||||
}
|
||||
|
||||
@@ -4,6 +4,5 @@
|
||||
<file alias="Assets/Editor/Style/EditorPreferencesDialog.qss">EditorPreferencesDialog.qss</file>
|
||||
<file alias="Assets/Editor/Style/LayoutConfigDialog.qss">LayoutConfigDialog.qss</file>
|
||||
<file alias="Assets/Editor/Style/GraphicsSettingsDialog.qss">GraphicsSettingsDialog.qss</file>
|
||||
<file alias="Assets/Editor/Style/LensFlareEditor.qss">LensFlareEditor.qss</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
||||
@@ -163,7 +163,7 @@ struct IVariable
|
||||
DT_LIGHT_ANIMATION, // Light Animation Node in the global Light Animation Set
|
||||
DT_PARTICLE_EFFECT,
|
||||
DT_GEOM_CACHE, // Geometry cache
|
||||
DT_FLARE,
|
||||
DT_DEPRECATED, // formerly DT_FLARE
|
||||
DT_AUDIO_TRIGGER,
|
||||
DT_AUDIO_SWITCH,
|
||||
DT_AUDIO_SWITCH_STATE,
|
||||
|
||||
@@ -58,7 +58,6 @@ namespace Prop
|
||||
{ IVariable::DT_USERITEMCB, "User", ePropertyUser, -1 },
|
||||
{ IVariable::DT_SEQUENCE_ID, "SequenceId", ePropertySequenceId, -1 },
|
||||
{ IVariable::DT_LIGHT_ANIMATION, "LightAnimation", ePropertyLightAnimation, -1 },
|
||||
{ IVariable::DT_FLARE, "Flare", ePropertyFlare, 7 },
|
||||
{ IVariable::DT_PARTICLE_EFFECT, "ParticleEffect", ePropertyParticleName, 3 },
|
||||
{ IVariable::DT_GEOM_CACHE, "Geometry Cache", ePropertyGeomCache, 5 },
|
||||
{ IVariable::DT_AUDIO_TRIGGER, "Audio Trigger", ePropertyAudioTrigger, 6 },
|
||||
|
||||
@@ -50,7 +50,7 @@ enum PropertyType
|
||||
ePropertyUser,
|
||||
ePropertySequenceId,
|
||||
ePropertyLightAnimation,
|
||||
ePropertyFlare,
|
||||
ePropertyDeprecated1, // formerly ePropertyFlare
|
||||
ePropertyParticleName,
|
||||
ePropertyGeomCache,
|
||||
ePropertyAudioTrigger,
|
||||
|
||||
@@ -13,6 +13,5 @@ set(FILES
|
||||
main.cpp
|
||||
Style/Editor.qss
|
||||
Style/resources.qrc
|
||||
Style/LensFlareEditor.qss
|
||||
EditorCryEdit.rc
|
||||
)
|
||||
|
||||
@@ -545,9 +545,6 @@ set(FILES
|
||||
Geometry/TriMesh.h
|
||||
AboutDialog.h
|
||||
AboutDialog.ui
|
||||
DatabaseFrameWnd.h
|
||||
DatabaseFrameWnd.ui
|
||||
DatabaseFrameWnd.qrc
|
||||
DocMultiArchive.h
|
||||
EditMode/DeepSelection.h
|
||||
FBXExporterDialog.h
|
||||
@@ -571,31 +568,6 @@ set(FILES
|
||||
WipFeaturesDlg.qrc
|
||||
LevelIndependentFileMan.cpp
|
||||
LevelIndependentFileMan.h
|
||||
LensFlareEditor/ILensFlareListener.h
|
||||
LensFlareEditor/LensFlareAtomicList.cpp
|
||||
LensFlareEditor/LensFlareAtomicList.h
|
||||
LensFlareEditor/LensFlareEditor.cpp
|
||||
LensFlareEditor/LensFlareEditor.h
|
||||
LensFlareEditor/LensFlareElement.cpp
|
||||
LensFlareEditor/LensFlareElement.h
|
||||
LensFlareEditor/LensFlareElementTree.cpp
|
||||
LensFlareEditor/LensFlareElementTree.h
|
||||
LensFlareEditor/LensFlareItem.cpp
|
||||
LensFlareEditor/LensFlareItem.h
|
||||
LensFlareEditor/LensFlareItemTree.cpp
|
||||
LensFlareEditor/LensFlareItemTree.h
|
||||
LensFlareEditor/LensFlareLibrary.cpp
|
||||
LensFlareEditor/LensFlareLibrary.h
|
||||
LensFlareEditor/LensFlareLightEntityTree.cpp
|
||||
LensFlareEditor/LensFlareLightEntityTree.h
|
||||
LensFlareEditor/LensFlareManager.cpp
|
||||
LensFlareEditor/LensFlareManager.h
|
||||
LensFlareEditor/LensFlareUndo.cpp
|
||||
LensFlareEditor/LensFlareUndo.h
|
||||
LensFlareEditor/LensFlareUtil.cpp
|
||||
LensFlareEditor/LensFlareUtil.h
|
||||
LensFlareEditor/LensFlareView.cpp
|
||||
LensFlareEditor/LensFlareView.h
|
||||
LogFileImpl.cpp
|
||||
LogFileImpl.h
|
||||
MatEditPreviewDlg.cpp
|
||||
@@ -706,7 +678,6 @@ set(FILES
|
||||
GraphicsSettingsDialog.cpp
|
||||
graphicssettingsdialog.ui
|
||||
AboutDialog.cpp
|
||||
DatabaseFrameWnd.cpp
|
||||
ErrorReportTableModel.h
|
||||
ErrorReportTableModel.cpp
|
||||
EditMode/DeepSelection.cpp
|
||||
|
||||
Reference in New Issue
Block a user