redcode sc asset files bloodbath
Signed-off-by: carlitosan <82187351+carlitosan@users.noreply.github.com>
This commit is contained in:
@@ -59,7 +59,7 @@ namespace ScriptCanvasEditor
|
||||
}
|
||||
|
||||
auto assetElement = rootElement.GetSubElement(assetElementIndex);
|
||||
AZ::Data::Asset<ScriptCanvasAsset> scriptCanvasAsset;
|
||||
AZ::Data::Asset<Deprecated::ScriptCanvasAsset> scriptCanvasAsset;
|
||||
if (!assetElement.GetData(scriptCanvasAsset))
|
||||
{
|
||||
AZ_Error("Script Canvas", false, "Unable to find Script Canvas Asset on a Version %u Editor ScriptCanvas Component", rootElement.GetVersion());
|
||||
|
||||
@@ -42,8 +42,6 @@ namespace ScriptCanvas
|
||||
|
||||
namespace ScriptCanvasEditor
|
||||
{
|
||||
class ScriptCanvasAsset;
|
||||
|
||||
struct LoadTestGraphResult
|
||||
{
|
||||
AZStd::unique_ptr<AZ::Entity> m_entity;
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
#include <GraphCanvas/Editor/EditorTypes.h>
|
||||
#include <GraphCanvas/Types/EntitySaveData.h>
|
||||
|
||||
#include <Editor/Include/ScriptCanvas/Assets/ScriptCanvasAsset.h>
|
||||
#include <Editor/Include/ScriptCanvas/Bus/NodeIdPair.h>
|
||||
#include <ScriptCanvas/Core/ExecutionNotificationsBus.h>
|
||||
#include <ScriptCanvas/Variable/VariableCore.h>
|
||||
|
||||
+6
-39
@@ -11,67 +11,34 @@
|
||||
#include <AzCore/Component/EntityId.h>
|
||||
#include <AzCore/Asset/AssetCommon.h>
|
||||
#include <ScriptCanvas/Core/Core.h>
|
||||
|
||||
class ScriptCanvasAsset;
|
||||
|
||||
#include <AzCore/Asset/AssetCommon.h>
|
||||
|
||||
namespace ScriptCanvasEditor
|
||||
{
|
||||
namespace Deprecated
|
||||
{
|
||||
/* source file description
|
||||
ScriptCanvasAssetDescription()
|
||||
: ScriptCanvas::AssetDescription(
|
||||
"{FA10C3DA-0717-4B72-8944-CD67D13DFA2B}", // type
|
||||
"Script Canvas", // name
|
||||
"Script Canvas Graph Asset", // description
|
||||
"@projectroot@/scriptcanvas", // suggested save path
|
||||
".scriptcanvas", // fileExtention
|
||||
"Script Canvas", // group
|
||||
"Untitled-%i", // asset name pattern
|
||||
"Script Canvas Files (*.scriptcanvas)", // file filter
|
||||
"Script Canvas", // asset type display name
|
||||
"Script Canvas", // entity name
|
||||
"Icons/ScriptCanvas/Viewport/ScriptCanvas.png", // icon path
|
||||
AZ::Color(0.321f, 0.302f, 0.164f, 1.0f), // display color
|
||||
true // is editable type
|
||||
)
|
||||
{}
|
||||
|
||||
AssetDescription( AZ::Data::AssetType assetType,
|
||||
const char* name,
|
||||
const char* description,
|
||||
const char* suggestedSavePath,
|
||||
const char* fileExtension,
|
||||
const char* group,
|
||||
const char* assetNamePattern,
|
||||
const char* fileFilter,
|
||||
const char* assetTypeDisplayName,
|
||||
const char* entityName,
|
||||
const char* iconPath,
|
||||
AZ::Color displayColor,
|
||||
bool isEditableType)
|
||||
*/
|
||||
class ScriptCanvasAssetHolder
|
||||
{
|
||||
public:
|
||||
AZ_TYPE_INFO(ScriptCanvasAssetHolder, "{3E80CEE3-2932-4DC1-AADF-398FDDC6DEFE}");
|
||||
AZ_CLASS_ALLOCATOR(ScriptCanvasAssetHolder, AZ::SystemAllocator, 0);
|
||||
|
||||
ScriptCanvasAssetHolder() = default;
|
||||
static void Reflect(AZ::ReflectContext* context);
|
||||
|
||||
AZ::Data::Asset<ScriptCanvasAsset> m_scriptCanvasAsset;
|
||||
|
||||
ScriptCanvasAssetHolder() = default;
|
||||
};
|
||||
|
||||
// only is used as a pass-through to loading a guid / hint during versioning
|
||||
class ScriptCanvasAsset
|
||||
: public AZ::Data::AssetData
|
||||
{
|
||||
public:
|
||||
AZ_TYPE_INFO(ScriptCanvasAsset, "{3E80CEE3-2932-4DC1-AADF-398FDDC6DEFE}");
|
||||
AZ_TYPE_INFO(ScriptCanvasAsset, "{FA10C3DA-0717-4B72-8944-CD67D13DFA2B}");
|
||||
AZ_CLASS_ALLOCATOR(ScriptCanvasAsset, AZ::SystemAllocator, 0);
|
||||
|
||||
ScriptCanvasAsset() = default;
|
||||
static void Reflect(AZ::ReflectContext * context);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
+2
-15
@@ -21,14 +21,8 @@
|
||||
namespace ScriptCanvasEditor
|
||||
{
|
||||
/*! EditorScriptCanvasComponent
|
||||
The user facing Editor Component for interfacing with ScriptCanvas
|
||||
It connects to the AssetCatalogEventBus in order to remove the ScriptCanvasAssetHolder asset reference
|
||||
when the asset is removed from the file system. The reason the ScriptCanvasAssetHolder holder does not
|
||||
remove the asset reference itself is because the ScriptCanvasEditor MainWindow has a ScriptCanvasAssetHolder
|
||||
which it uses to maintain the asset data in memory. Therefore removing an open ScriptCanvasAsset from the file system
|
||||
will remove the reference from the EditorScriptCanvasComponent, but not the reference from the MainWindow allowing the
|
||||
ScriptCanvas graph to still be modified while open
|
||||
Finally per graph instance variables values are stored on the EditorScriptCanvasComponent and injected into the runtime ScriptCanvas component in BuildGameEntity
|
||||
The user facing Editor Component for interfacing with ScriptCanvas.
|
||||
Per graph instance variables values are stored here and injected into the runtime ScriptCanvas component in BuildGameEntity.
|
||||
*/
|
||||
class EditorScriptCanvasComponent
|
||||
: public AzToolsFramework::Components::EditorComponentBase
|
||||
@@ -88,13 +82,6 @@ namespace ScriptCanvasEditor
|
||||
AZ::Data::AssetId GetAssetId() const override;
|
||||
//=====================================================================
|
||||
|
||||
|
||||
|
||||
|
||||
//=====================================================================
|
||||
// EditorEntityContextNotificationBus
|
||||
|
||||
|
||||
protected:
|
||||
enum class SourceChangeDescription : AZ::u8
|
||||
{
|
||||
|
||||
@@ -434,8 +434,9 @@ namespace ScriptCanvasEditor
|
||||
m_scriptCanvasAssetModel = new ScriptCanvasAssetBrowserModel(this);
|
||||
|
||||
AzToolsFramework::AssetBrowser::AssetGroupFilter* scriptCanvasAssetFilter = new AzToolsFramework::AssetBrowser::AssetGroupFilter();
|
||||
// #sc_editor_asset_redux this may not be needed, may not be doing the right thing at all...
|
||||
scriptCanvasAssetFilter->SetAssetGroup(ScriptCanvasAsset::Description::GetGroup(azrtti_typeid<ScriptCanvas::SubgraphInterfaceAsset>()));
|
||||
// #sc_editor_asset_redux this may not be needed, may not be doing the right thing at all, verify that searching through
|
||||
// the subgraph interface assets is the correct thing to do
|
||||
scriptCanvasAssetFilter->SetAssetGroup(ScriptCanvas::SubgraphInterfaceAssetDescription().GetGroupImpl());
|
||||
scriptCanvasAssetFilter->SetFilterPropagation(AzToolsFramework::AssetBrowser::AssetBrowserEntryFilter::PropagateDirection::Down);
|
||||
|
||||
m_scriptCanvasAssetModel->setSourceModel(assetBrowserModel);
|
||||
@@ -1483,17 +1484,17 @@ namespace ScriptCanvasEditor
|
||||
|
||||
for (;;)
|
||||
{
|
||||
ScriptCanvasAssetDescription description;
|
||||
AZStd::string newAssetName = AZStd::string::format(description.GetAssetNamePatternImpl(), ++scriptCanvasEditorDefaultNewNameCount);
|
||||
AZStd::string newAssetName = AZStd::string::format(SourceDescription::GetAssetNamePattern()
|
||||
, ++scriptCanvasEditorDefaultNewNameCount);
|
||||
|
||||
AZStd::array<char, AZ::IO::MaxPathLength> assetRootArray;
|
||||
if (!AZ::IO::FileIOBase::GetInstance()->ResolvePath(description.GetSuggestedSavePathImpl()
|
||||
if (!AZ::IO::FileIOBase::GetInstance()->ResolvePath(SourceDescription::GetSuggestedSavePath()
|
||||
, assetRootArray.data(), assetRootArray.size()))
|
||||
{
|
||||
AZ_ErrorOnce("Script Canvas", false, "Unable to resolve @projectroot@ path");
|
||||
}
|
||||
|
||||
AzFramework::StringFunc::Path::Join(assetRootArray.data(), (newAssetName + description.GetExtensionImpl()).data(), assetPath);
|
||||
AzFramework::StringFunc::Path::Join(assetRootArray.data(), (newAssetName + SourceDescription::GetFileExtension()).data(), assetPath);
|
||||
AZ::Data::AssetInfo assetInfo;
|
||||
|
||||
if (!AssetHelpers::GetAssetInfo(assetPath, assetInfo))
|
||||
@@ -1621,7 +1622,6 @@ namespace ScriptCanvasEditor
|
||||
}
|
||||
|
||||
PrepareAssetForSave(inMemoryAssetId);
|
||||
ScriptCanvasAssetDescription assetDescription;
|
||||
|
||||
AZStd::string suggestedFilename;
|
||||
AZStd::string suggestedFileFilter;
|
||||
@@ -1630,16 +1630,16 @@ namespace ScriptCanvasEditor
|
||||
if (save == Save::InPlace)
|
||||
{
|
||||
isValidFileName = true;
|
||||
suggestedFileFilter = ScriptCanvasAssetDescription().GetExtensionImpl();
|
||||
suggestedFileFilter = SourceDescription::GetFileExtension();
|
||||
suggestedFilename = inMemoryAssetId.Path().c_str();
|
||||
}
|
||||
else
|
||||
{
|
||||
suggestedFileFilter = ScriptCanvasAssetDescription().GetExtensionImpl();
|
||||
suggestedFileFilter = SourceDescription::GetFileExtension();
|
||||
|
||||
if (inMemoryAssetId.Path().empty())
|
||||
{
|
||||
suggestedFilename = ScriptCanvasAssetDescription().GetSuggestedSavePathImpl();
|
||||
suggestedFilename = SourceDescription::GetSuggestedSavePath();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1661,9 +1661,9 @@ namespace ScriptCanvasEditor
|
||||
{
|
||||
AZStd::string filePath = selectedFile.toUtf8().data();
|
||||
|
||||
if (!AZ::StringFunc::EndsWith(filePath, assetDescription.GetExtensionImpl(), false))
|
||||
if (!AZ::StringFunc::EndsWith(filePath, SourceDescription::GetFileExtension(), false))
|
||||
{
|
||||
filePath += assetDescription.GetExtensionImpl();
|
||||
filePath += SourceDescription::GetFileExtension();
|
||||
}
|
||||
|
||||
AZStd::string fileName;
|
||||
@@ -1695,9 +1695,9 @@ namespace ScriptCanvasEditor
|
||||
AZStd::string internalStringFile = selectedFile.toUtf8().data();
|
||||
|
||||
|
||||
if (!AZ::StringFunc::EndsWith(internalStringFile, assetDescription.GetExtensionImpl(), false))
|
||||
if (!AZ::StringFunc::EndsWith(internalStringFile, SourceDescription::GetFileExtension(), false))
|
||||
{
|
||||
internalStringFile += assetDescription.GetExtensionImpl();
|
||||
internalStringFile += SourceDescription::GetFileExtension();
|
||||
}
|
||||
|
||||
if (!AssetHelpers::IsValidSourceFile(internalStringFile, GetActiveScriptCanvasId()))
|
||||
|
||||
Reference in New Issue
Block a user