summaryrefslogtreecommitdiffstats
path: root/src/Runtime/Source/state
diff options
context:
space:
mode:
Diffstat (limited to 'src/Runtime/Source/state')
-rw-r--r--src/Runtime/Source/state/Qt3DSState.h108
-rw-r--r--src/Runtime/Source/state/Qt3DSStateApplication.h48
-rw-r--r--src/Runtime/Source/state/Qt3DSStateConfig.h43
-rw-r--r--src/Runtime/Source/state/Qt3DSStateEngine.h103
-rw-r--r--src/Runtime/Source/state/Qt3DSStateInputStreamFactory.cpp231
-rw-r--r--src/Runtime/Source/state/Qt3DSStateInputStreamFactory.h71
-rw-r--r--src/Runtime/Source/state/Qt3DSStateScriptContext.h128
-rw-r--r--src/Runtime/Source/state/Qt3DSStateTypes.h97
-rw-r--r--src/Runtime/Source/state/Qt3DSStateVisualBindingContextCommands.h348
9 files changed, 681 insertions, 496 deletions
diff --git a/src/Runtime/Source/state/Qt3DSState.h b/src/Runtime/Source/state/Qt3DSState.h
new file mode 100644
index 00000000..b5686c25
--- /dev/null
+++ b/src/Runtime/Source/state/Qt3DSState.h
@@ -0,0 +1,108 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 NVIDIA Corporation.
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt 3D Studio.
+**
+** $QT_BEGIN_LICENSE:GPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 or (at your option) any later version
+** approved by the KDE Free Qt Foundation. The licenses are as published by
+** the Free Software Foundation and appearing in the file LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#pragma once
+#ifndef QT3DS_STATE_H
+#define QT3DS_STATE_H
+
+namespace qt3ds {
+class NVAllocatorCallback;
+class NVFoundationBase;
+namespace foundation {
+ class CRegisteredString;
+ class IStringTable;
+ class IOutStream;
+ class IInStream;
+ class IDOMFactory;
+ struct SDOMAttribute;
+ struct SDOMElement;
+ struct SNamespacePairNode;
+ class SocketStream;
+}
+
+namespace intrinsics {
+}
+}
+
+namespace qt3ds {
+namespace state {
+
+ using namespace qt3ds;
+ using namespace qt3ds::foundation;
+ using namespace qt3ds::intrinsics;
+ using qt3ds::foundation::CRegisteredString;
+ using qt3ds::foundation::IStringTable;
+ class IStateContext;
+ class IStateInterpreter;
+ class IStateLogger;
+ class IExecutionContext;
+ class IScriptContext;
+ struct SSCXML;
+ struct SState;
+ struct STransition;
+ struct SParallel;
+ struct SFinal;
+ struct SHistory;
+ struct SOnEntry;
+ struct SOnExit;
+ struct SSend;
+ struct SRaise;
+ struct SIf;
+ struct SElseIf;
+ struct SElse;
+ struct SLog;
+ struct SAssign;
+ struct SScript;
+ struct SDataModel;
+ struct SData;
+ struct SStateNode;
+ struct SCancel;
+
+ namespace editor {
+ class IEditor;
+ class IEditorObject;
+ }
+
+ namespace debugger {
+ class IDebugOutStream;
+ struct STransitionId;
+ class IStateMachineListener;
+ class IStateMachineDebugInterface;
+ class IDebugger;
+ struct SDebugPropertyDeclaration;
+ class IDebuggedInterpreter;
+ class IDebuggerMasterListener;
+ class IDebuggedInterpreter;
+ struct SMicrostep;
+ class IScriptStateListener;
+ }
+}
+}
+
+#endif
diff --git a/src/Runtime/Source/state/Qt3DSStateApplication.h b/src/Runtime/Source/state/Qt3DSStateApplication.h
deleted file mode 100644
index ca8f44d5..00000000
--- a/src/Runtime/Source/state/Qt3DSStateApplication.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 NVIDIA Corporation.
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of Qt 3D Studio.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#pragma once
-
-#include "foundation/Qt3DSRefCounted.h"
-#include "Qt3DSTypes.h"
-
-namespace qt3ds {
-namespace state {
-
- class INDDStateApplication : public qt3ds::foundation::NVRefCounted
- {
- public:
- virtual ~INDDStateApplication() {}
-
- virtual double GetMillisecondsSinceLastFrame() = 0;
- virtual Q3DStudio::INT32 GetFrameCount() = 0;
- };
-}
-}
diff --git a/src/Runtime/Source/state/Qt3DSStateConfig.h b/src/Runtime/Source/state/Qt3DSStateConfig.h
deleted file mode 100644
index 0252d1f7..00000000
--- a/src/Runtime/Source/state/Qt3DSStateConfig.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 NVIDIA Corporation.
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of Qt 3D Studio.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#pragma once
-
-#ifdef _WIN32
-#if defined QT3DS_STATE_EXPORTS
-#define QT3DS_STATE_API __declspec(dllexport)
-#elif defined QT3DS_STATE_NO_EXPORTS
-#define QT3DS_STATE_API
-#else
-#define QT3DS_STATE_API __declspec(dllimport)
-#endif
-#else
-#define QT3DS_STATE_API
-#endif
diff --git a/src/Runtime/Source/state/Qt3DSStateEngine.h b/src/Runtime/Source/state/Qt3DSStateEngine.h
deleted file mode 100644
index 464fd3a5..00000000
--- a/src/Runtime/Source/state/Qt3DSStateEngine.h
+++ /dev/null
@@ -1,103 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 NVIDIA Corporation.
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of Qt 3D Studio.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#pragma once
-
-#include "foundation/Qt3DSRefCounted.h"
-
-#include "Qt3DSStateConfig.h"
-
-namespace qt3ds {
-
-class NVFoundation;
-
-namespace foundation {
- class IStringTable;
-}
-}
-
-namespace Q3DStudio {
-class ITimeProvider;
-}
-
-namespace qt3ds {
-namespace state {
-
- class IInputStreamFactory;
-
- class INDDStateEngine
- {
- public:
- enum EStateEvent {
- STATE_EVENT_UNKNOWN = 0,
- STATE_EVENT_STATE_ENTER,
- STATE_EVENT_STATE_EXIT,
- STATE_EVENT_TRANSITION,
- };
- class IStateEventHandler
- {
- public:
- virtual ~IStateEventHandler() {}
- virtual void OnEvent() = 0;
- };
- class IStateEventHandlerConnection : public qt3ds::foundation::NVRefCounted
- {
- protected:
- virtual ~IStateEventHandlerConnection() {}
- public:
- };
-
- typedef qt3ds::foundation::NVScopedRefCounted<IStateEventHandlerConnection>
- TStateEventHandlerConnectionPtr;
-
- public:
- virtual ~INDDStateEngine() {}
-
- virtual bool Load(const char *inApplicationPath) = 0;
- virtual bool Step() = 0;
- virtual TStateEventHandlerConnectionPtr
- RegisterEventHandler(EStateEvent inEvent, const char *inEventId,
- IStateEventHandler &inHandler) = 0;
- virtual void FireEvent(const char *inEventName, unsigned long long inDelay,
- const char *inCancelId, bool inIsExternal = true) = 0;
- virtual void FireEvent(const char *inEventName, bool inIsExternal = true) = 0;
- virtual void CancelEvent(const char *inCancelId) = 0;
-
- QT3DS_STATE_API static INDDStateEngine *
- Create(qt3ds::foundation::NVScopedRefCounted<qt3ds::NVFoundation> inFoundation,
- qt3ds::foundation::NVScopedRefCounted<qt3ds::foundation::IStringTable> inStringTable,
- qt3ds::foundation::NVScopedRefCounted<qt3ds::state::IInputStreamFactory>
- inInputStreamFactory,
- Q3DStudio::ITimeProvider &inTimeProvider);
-
- QT3DS_STATE_API static INDDStateEngine *Create();
- };
-}
-}
diff --git a/src/Runtime/Source/state/Qt3DSStateInputStreamFactory.cpp b/src/Runtime/Source/state/Qt3DSStateInputStreamFactory.cpp
deleted file mode 100644
index 2fd3dffa..00000000
--- a/src/Runtime/Source/state/Qt3DSStateInputStreamFactory.cpp
+++ /dev/null
@@ -1,231 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2008-2012 NVIDIA Corporation.
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of Qt 3D Studio.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#include "Qt3DSStateInputStreamFactory.h"
-
-#include "stdio.h"
-
-#include "foundation/Qt3DSLogging.h"
-#include "foundation/Qt3DSFoundation.h"
-#include "foundation/Qt3DSAllocatorCallback.h"
-#include "foundation/Qt3DSBroadcastingAllocator.h"
-#include "foundation/Qt3DSAtomic.h"
-#include "EASTL/string.h"
-#include "EASTL/vector.h"
-#include "foundation/Qt3DSContainers.h"
-#include "foundation/FileTools.h"
-#include "foundation/Qt3DSMutex.h"
-#include <QFile>
-
-using namespace qt3ds::state;
-using qt3ds::foundation::CFileTools;
-
-namespace {
-
-using qt3ds::foundation::atomicIncrement;
-using qt3ds::foundation::atomicDecrement;
-using qt3ds::QT3DSI32;
-
-struct SInputStream : public IRefCountedInputStream
-{
- qt3ds::NVFoundationBase &m_Foundation;
- eastl::string m_Path;
- QFile m_File;
- volatile qt3ds::QT3DSI32 mRefCount;
-
- SInputStream(qt3ds::NVFoundationBase &inFoundation, const eastl::string &inPath)
- : m_Foundation(inFoundation)
- , m_Path(inPath)
- , m_File(inPath.c_str())
- , mRefCount(0)
- {
- m_File.open(QIODevice::ReadOnly);
- }
- virtual ~SInputStream()
- {
- }
-
- QT3DS_IMPLEMENT_REF_COUNT_ADDREF_RELEASE(m_Foundation.getAllocator())
-
- qt3ds::QT3DSU32 Read(qt3ds::foundation::NVDataRef<qt3ds::QT3DSU8> data) override
- {
- return m_File.read((char *)data.begin(), data.size());
- }
-
- bool Write(qt3ds::foundation::NVConstDataRef<qt3ds::QT3DSU8> /*data*/) override
- {
- QT3DS_ASSERT(false);
- return false;
- }
-
- void SetPosition(qt3ds::QT3DSI64 inOffset, qt3ds::foundation::SeekPosition::Enum inEnum) override
- {
- if (inOffset > QT3DS_MAX_I32 || inOffset < QT3DS_MIN_I32) {
- qCCritical(qt3ds::INVALID_OPERATION, "Attempt to seek further than platform allows");
- QT3DS_ASSERT(false);
- return;
- } else {
- CFileTools::SetStreamPosition(m_File, inOffset, inEnum);
- }
- }
- qt3ds::QT3DSI64 GetPosition() const override
- {
- return m_File.pos();
- }
-
- static SInputStream *OpenFile(const char8_t *inPath, qt3ds::NVFoundationBase &inFoundation)
- {
- eastl::string finalPath = CFileTools::GetFileOrAssetPath(inPath);
- QFile tmp(finalPath.c_str());
- if (tmp.exists())
- return QT3DS_NEW(inFoundation.getAllocator(), SInputStream)(inFoundation, finalPath);
- return NULL;
- }
-};
-
-typedef eastl::basic_string<char8_t, qt3ds::foundation::ForwardingAllocator> TStrType;
-struct SFactory : public IInputStreamFactory
-{
- qt3ds::NVFoundationBase &m_Foundation;
- volatile qt3ds::QT3DSI32 mRefCount;
- TStrType m_SearchString;
- qt3ds::foundation::nvvector<TStrType> m_SearchPaths;
- TStrType m_TempAddSearch;
-
- qt3ds::foundation::Mutex m_Mutex;
- typedef qt3ds::foundation::Mutex::ScopedLock TScopedLock;
-
- SFactory(qt3ds::NVFoundationBase &inFoundation)
- : m_Foundation(inFoundation)
- , mRefCount(0)
- , m_SearchString(qt3ds::foundation::ForwardingAllocator(inFoundation.getAllocator(),
- "SFactory::m_SearchString"))
- , m_SearchPaths(inFoundation.getAllocator(), "SFactory::m_SearchPaths")
- , m_TempAddSearch(qt3ds::foundation::ForwardingAllocator(inFoundation.getAllocator(),
- "SFactory::m_TempAddSearch"))
- , m_Mutex(inFoundation.getAllocator())
- {
- }
-
- QT3DS_IMPLEMENT_REF_COUNT_ADDREF_RELEASE(m_Foundation.getAllocator())
-
- void AddSearchDirectory(const char8_t *inDirectory) override
- {
- TScopedLock __factoryLocker(m_Mutex);
- if (inDirectory && *inDirectory) {
- bool foundPath = false;
- m_TempAddSearch.assign(inDirectory);
- qt3ds::foundation::CFileTools::NormalizePath(m_TempAddSearch);
- for (qt3ds::QT3DSU32 idx = 0, end = m_SearchPaths.size(); idx < end && foundPath == false;
- ++idx) {
- foundPath = m_SearchPaths[idx].compare(m_TempAddSearch.c_str()) == 0;
- }
- if (!foundPath) {
- qCInfo(qt3ds::TRACE_INFO, "Adding search path: %s", inDirectory);
- m_SearchPaths.push_back(m_TempAddSearch);
- }
- }
- }
- void AttemptCFileOpen()
- {
- qCInfo(qt3ds::TRACE_INFO, "attempting C file api for %s", m_SearchString.c_str());
- FILE *theTest = fopen(m_SearchString.c_str(), "rb");
- if (theTest) {
- qCInfo(qt3ds::TRACE_INFO, "C file api succeeded for %s", m_SearchString.c_str());
- fclose(theTest);
- } else {
- qCInfo(qt3ds::TRACE_INFO, "C file api failed for %s", m_SearchString.c_str());
- }
- }
-
- // Remove the ./ from the relative path as this allows APK lookup to succeed
- static void CheckRelative(TStrType &ioStr)
- {
- if (ioStr.find("./") == 0)
- ioStr.erase(ioStr.begin(), ioStr.begin() + 2);
- }
-
- IRefCountedInputStream *GetStreamForFile(const char8_t *inFilename, bool inQuiet) override
- {
- TScopedLock __factoryLocker(m_Mutex);
- SInputStream *theFile = NULL;
- for (qt3ds::QT3DSU32 idx = 0, end = m_SearchPaths.size() + 1; theFile == NULL && idx < end;
- ++idx) {
- if (idx) {
- qt3ds::foundation::CFileTools::CombineBaseAndRelative(m_SearchPaths[idx - 1].c_str(),
- inFilename, m_SearchString);
- } else {
- m_SearchString.assign(inFilename);
- }
- qt3ds::foundation::CFileTools::ToPlatformPath(m_SearchString);
- CheckRelative(m_SearchString);
- theFile = SInputStream::OpenFile(m_SearchString.c_str(), m_Foundation);
- }
- if (theFile) {
- qCInfo(qt3ds::TRACE_INFO, "file %s resolved to: %s", inFilename, m_SearchString.c_str());
- } else {
- if (inQuiet == false) {
- // Print extensive debugging information.
- qCWarning(qt3ds::WARNING, "Failed to find file: %s", inFilename);
- qCWarning(qt3ds::WARNING, "Searched paths: %s", inFilename);
- m_SearchString.assign(inFilename);
- qt3ds::foundation::CFileTools::ToPlatformPath(m_SearchString);
- qCWarning(qt3ds::WARNING, "%s", m_SearchString.c_str());
- for (qt3ds::QT3DSU32 idx = 0, end = m_SearchPaths.size(); idx < end; ++idx) {
- qt3ds::foundation::CFileTools::CombineBaseAndRelative(m_SearchPaths[idx].c_str(),
- inFilename, m_SearchString);
- qt3ds::foundation::CFileTools::ToPlatformPath(m_SearchString);
- CheckRelative(m_SearchString);
- if (m_SearchString.compare(inFilename) != 0)
- qCWarning(qt3ds::WARNING, "%s", m_SearchString.c_str());
- }
- }
- }
- return theFile;
- }
-
- bool GetPathForFile(const char8_t *inFilename, eastl::string &outFile,
- bool inQuiet = false) override
- {
- qt3ds::foundation::NVScopedRefCounted<IRefCountedInputStream> theStream =
- GetStreamForFile(inFilename, inQuiet);
- if (theStream) {
- SInputStream *theRealStream = static_cast<SInputStream *>(theStream.mPtr);
- outFile = theRealStream->m_Path;
- return true;
- }
- return false;
- }
-};
-}
-
-IInputStreamFactory &IInputStreamFactory::Create(qt3ds::NVFoundationBase &inFoundation)
-{
- return *QT3DS_NEW(inFoundation.getAllocator(), SFactory)(inFoundation);
-}
diff --git a/src/Runtime/Source/state/Qt3DSStateInputStreamFactory.h b/src/Runtime/Source/state/Qt3DSStateInputStreamFactory.h
deleted file mode 100644
index a4e387ab..00000000
--- a/src/Runtime/Source/state/Qt3DSStateInputStreamFactory.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 NVIDIA Corporation.
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of Qt 3D Studio.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#pragma once
-
-#include "foundation/IOStreams.h"
-#include "foundation/Qt3DSRefCounted.h"
-#include "EASTL/string.h"
-
-#include "Qt3DSStateConfig.h"
-
-namespace qt3ds {
-namespace state {
-
- class IRefCountedInputStream : public qt3ds::foundation::ISeekableIOStream,
- public qt3ds::foundation::NVRefCounted
- {
- protected:
- virtual ~IRefCountedInputStream() {}
- };
-
- // This class is threadsafe.
- class IInputStreamFactory : public qt3ds::foundation::NVRefCounted
- {
- protected:
- virtual ~IInputStreamFactory() {}
- public:
- // These directories must have a '/' on them
- virtual void AddSearchDirectory(const char8_t *inDirectory) = 0;
- virtual IRefCountedInputStream *GetStreamForFile(const char8_t *inFilename,
- bool inQuiet = false) = 0;
- // Return a path for this file. Returns true if GetStreamForFile would return a valid
- // stream.
- // else returns false
- virtual bool GetPathForFile(const char8_t *inFilename, eastl::string &outFile,
- bool inQuiet = false) = 0;
-
- // Create an input stream factory using this foundation and an platform-optional app
- // directory
- // on android the app directory has no effect; use use the assets bundled with the APK file.
- QT3DS_STATE_API static IInputStreamFactory &Create(qt3ds::NVFoundationBase &inFoundation);
- };
-}
-}
diff --git a/src/Runtime/Source/state/Qt3DSStateScriptContext.h b/src/Runtime/Source/state/Qt3DSStateScriptContext.h
new file mode 100644
index 00000000..110770a1
--- /dev/null
+++ b/src/Runtime/Source/state/Qt3DSStateScriptContext.h
@@ -0,0 +1,128 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 NVIDIA Corporation.
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt 3D Studio.
+**
+** $QT_BEGIN_LICENSE:GPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 or (at your option) any later version
+** approved by the KDE Free Qt Foundation. The licenses are as published by
+** the Free Software Foundation and appearing in the file LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#ifndef QT3DS_STATE_SCRIPT_CONTEXT_H
+#define QT3DS_STATE_SCRIPT_CONTEXT_H
+#pragma once
+#include "Qt3DSState.h"
+#include "Qt3DSStateTypes.h"
+#include "foundation/Qt3DSRefCounted.h"
+#include "foundation/Qt3DSOption.h"
+#include "foundation/StringTable.h"
+
+namespace qt3ds {
+namespace state {
+
+ class IScriptEvent : public IEvent
+ {
+ public:
+ // returns true on success, false if error.execution should be signaled.
+ virtual bool SetParam(CRegisteredString inName, const char8_t *inExpression) = 0;
+ // Sets the expression as a string
+ virtual bool SetParamStr(CRegisteredString inName, const char8_t *inStr) = 0;
+ virtual bool SetDataExpr(const char8_t *inExpression) = 0;
+ virtual bool SetDataStr(const char8_t *inStr) = 0;
+ };
+
+ struct SScriptExecutionResult
+ {
+ const char8_t *m_Result;
+ const char8_t *m_Error;
+ SScriptExecutionResult(const char8_t *inData, const char8_t *inError)
+ : m_Result(inData)
+ , m_Error(inError)
+ {
+ }
+ SScriptExecutionResult()
+ : m_Result("")
+ , m_Error("")
+ {
+ }
+ bool Valid() const { return m_Error == NULL || *m_Error == 0; }
+ const char8_t *Result() const
+ {
+ QT3DS_ASSERT(Valid());
+ return m_Result;
+ }
+ const char8_t *Error() const
+ {
+ QT3DS_ASSERT(!Valid());
+ return m_Error;
+ }
+ };
+
+ class IScriptContext : public NVRefCounted
+ {
+ protected:
+ virtual ~IScriptContext() {}
+ public:
+ // Should functions returning options return othing
+ virtual Option<bool> ExecuteCondition(const char8_t *inCond) = 0;
+ // Used for logging.
+ // Error and result are good until next call into the script context.
+ virtual SScriptExecutionResult ExecuteExpressionToString(const char8_t *inExpr) = 0;
+
+ // If return value is false, error is signaled with GetErrorInfo.
+ virtual bool Assign(const char8_t *inVariable, const char8_t *inExpr) = 0;
+ // Assign a string to this variable location.
+ virtual void AssignStr(const char8_t *inVariable, const char8_t *inStr) = 0;
+
+ // If return value is false, error is signaled via GetErrorInfo.
+ // The actual pointer and content used for inscript is expected to not change during
+ // execution of the system.
+ // it is legal for contexts to cache information based off the script pointer value.
+ virtual bool ExecuteScript(const char8_t *inScript) = 0;
+ // Always return 1 result
+ virtual int ExecuteStr(const char8_t *inScript, bool withRet) = 0;
+
+ // Return true on success, false on failure, and Empty on error.
+ virtual Option<bool> BeginForeach(const char8_t *inArray, const char8_t *inItem,
+ const char8_t *inIdxVar = "") = 0;
+ virtual Option<bool> NextForeach(const char8_t *inItem, const char8_t *inIdxVar = "") = 0;
+ virtual void CancelForeach() = 0;
+
+ virtual void SetCurrentEvent(TEventPtr inEvent) = 0;
+ virtual void ClearCurrentEvent() = 0;
+ // Create an event we can attach extra data do.
+ virtual IScriptEvent *CreateScriptEvent(CRegisteredString inName) = 0;
+
+ virtual const char8_t *GetErrorInfo() = 0;
+
+ virtual void SetInterpreter(IStateInterpreter &inInterpreter) = 0;
+
+ virtual CRegisteredString GetContextType() { return CRegisteredString(); }
+
+ // Dumps a differential state from the last time someone asked. This is a debug interface;
+ // not meant to be used
+ // by multiple listeners concurrently.
+ virtual void DumpState(debugger::IScriptStateListener &inListener) = 0;
+ };
+}
+}
+#endif
diff --git a/src/Runtime/Source/state/Qt3DSStateTypes.h b/src/Runtime/Source/state/Qt3DSStateTypes.h
new file mode 100644
index 00000000..26aee0e0
--- /dev/null
+++ b/src/Runtime/Source/state/Qt3DSStateTypes.h
@@ -0,0 +1,97 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 NVIDIA Corporation.
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt 3D Studio.
+**
+** $QT_BEGIN_LICENSE:GPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 or (at your option) any later version
+** approved by the KDE Free Qt Foundation. The licenses are as published by
+** the Free Software Foundation and appearing in the file LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#pragma once
+#ifndef QT3DS_STATE_TYPES_H
+#define QT3DS_STATE_TYPES_H
+#include "Qt3DSState.h"
+#include "foundation/StringTable.h"
+#include "foundation/Qt3DSInvasiveLinkedList.h"
+#include "foundation/Qt3DSFlags.h"
+#include "foundation/Qt3DSDataRef.h"
+#include "foundation/Qt3DSContainers.h"
+#include "foundation/StringTable.h"
+#include "foundation/TaggedPointer.h"
+#include "foundation/Qt3DSVec2.h"
+#include "foundation/Qt3DSVec3.h"
+#include "foundation/Qt3DSAtomic.h"
+#include "foundation/Utils.h"
+
+namespace qt3ds {
+namespace state {
+ // Events, because they created both inside and outside
+ // the state system by various parties.
+ class IEvent : public NVRefCounted
+ {
+ protected:
+ virtual ~IEvent() {}
+ public:
+ virtual CRegisteredString GetName() const = 0;
+ // Optional type string for rtti. No string means this is an opaque event
+ // that cannot be safely cast to any specific event type.
+ virtual CRegisteredString GetEventType() const { return CRegisteredString(); }
+ };
+
+ typedef NVScopedRefCounted<IEvent> TEventPtr;
+
+ DEFINE_INVASIVE_SINGLE_LIST(Data);
+
+ struct SDataModel
+ {
+ CRegisteredString m_Id;
+ const char8_t *m_Source;
+ const char8_t *m_Expression;
+ TDataList m_Data;
+
+ SDataModel()
+ : m_Source(nullptr)
+ , m_Expression(nullptr)
+ {
+ }
+ };
+
+ struct SData
+ {
+ CRegisteredString m_Id;
+ const char8_t *m_Source;
+ const char8_t *m_Expression;
+ SData *m_NextSibling;
+ SData()
+ : m_Source(nullptr)
+ , m_Expression(nullptr)
+ , m_NextSibling(nullptr)
+ {
+ }
+ };
+
+ IMPLEMENT_INVASIVE_SINGLE_LIST(Data, m_NextSibling);
+}
+}
+
+#endif
diff --git a/src/Runtime/Source/state/Qt3DSStateVisualBindingContextCommands.h b/src/Runtime/Source/state/Qt3DSStateVisualBindingContextCommands.h
new file mode 100644
index 00000000..4d08f695
--- /dev/null
+++ b/src/Runtime/Source/state/Qt3DSStateVisualBindingContextCommands.h
@@ -0,0 +1,348 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 NVIDIA Corporation.
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt 3D Studio.
+**
+** $QT_BEGIN_LICENSE:GPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 or (at your option) any later version
+** approved by the KDE Free Qt Foundation. The licenses are as published by
+** the Free Software Foundation and appearing in the file LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#pragma once
+#ifndef QT3DS_STATE_VISUAL_BINDING_CONTEXT_COMMANDS_H
+#define QT3DS_STATE_VISUAL_BINDING_CONTEXT_COMMANDS_H
+#include "Qt3DSState.h"
+#include "foundation/StringTable.h"
+
+namespace qt3ds {
+namespace state {
+
+ struct VisualStateCommandTypes
+ {
+ enum Enum {
+ NoVisualStateCommand = 0,
+ GotoSlide,
+ CallFunction,
+ SetAttribute,
+ GotoSlideRelative,
+ FireEvent,
+ PresentationAttribute,
+ PlaySound,
+ };
+ };
+
+ struct SlidePlaybackModes
+ {
+ enum Enum {
+ StopAtEnd = 0,
+ Looping,
+ PingPong,
+ Ping,
+ PlaythroughTo,
+ };
+ };
+
+ struct SGotoSlideData
+ {
+ Option<SlidePlaybackModes::Enum> m_Mode;
+ Option<CRegisteredString> m_PlaythroughTo;
+ Option<QT3DSU32> m_StartTime;
+ QT3DSF32 m_Rate;
+ bool m_Reverse;
+ Option<bool> m_Paused;
+ SGotoSlideData()
+ : m_Rate(1.0f)
+ , m_Reverse(false)
+ {
+ }
+ };
+
+ // All the element references in this file need to be absolute, meaning they
+ // must begin with a presentationid:. The is because the state machine exists at the
+ // application level where all presentations are pretty much equal and must be referenced
+ // by id.
+
+ // Go to a particular slide.
+
+ /*
+ a. If the slide attribute references a slide name not present on the time context an error must
+ be logged each time the executable would have been run, and the executable ignored.
+ b. If the time context is already on the slide referenced, no change is made to the time
+ context.
+ The slide does not restart. */
+ struct SGotoSlide
+ {
+ CRegisteredString m_Component;
+ CRegisteredString m_Slide;
+ SGotoSlideData m_GotoSlideData;
+ SGotoSlide(CRegisteredString cmd = CRegisteredString(),
+ CRegisteredString slide = CRegisteredString())
+ : m_Component(cmd)
+ , m_Slide(slide)
+ {
+ }
+ bool operator==(const SGotoSlide &inOther) const
+ {
+ return m_Component == inOther.m_Component && m_Slide == inOther.m_Slide;
+ }
+ template <typename TRemapper>
+ void Remap(TRemapper &inRemapper)
+ {
+ inRemapper.Remap(m_Component);
+ inRemapper.Remap(m_Slide);
+ }
+ };
+
+ /*
+ 1. A <call.../> executable must have a element="..." attribute that references a behavior
+ element in one of the presentation assets for the application.
+ a. If the element attribute is missing, or references an element that cannot be found,
+ an error must be logged each time the executable would have been run, and the executable
+ ignored.
+ b. If the element attribute references an element that is not a behavior then an error
+ must be logged each time the executable would have been run, and the executable ignored.
+ 2. A <call.../> executable must have a handler="..." attribute that references a function value
+ in the table associated with the behavior element.
+ a. If the handler attribute is missing, or references a value that is not a function
+ value, an error must be logged each time the executable would have been run, and the executable
+ ignored.
+ 3. A <call.../> executable may have an args="..." attribute that specifies an expression to
+ evaluate.
+ a. If the result of evaluating this expression is a single value, it is passed as the
+ first argument to the behavior's function.
+ b. If the result of evaluating this expression is a table, it is treated as a list that
+ is unpack'd, the numeric properties sent as arguments in order.
+ c. If the result of evaluating this expression is an error, an error message must be
+ logged and the executable ignored.
+ The function is not invoked with no parameters.
+ */
+ struct SCallFunction
+ {
+ CRegisteredString m_Behavior;
+ CRegisteredString m_Handler;
+ CRegisteredString m_Arguments;
+ SCallFunction(CRegisteredString behavior = CRegisteredString(),
+ CRegisteredString hdler = CRegisteredString(),
+ CRegisteredString args = CRegisteredString())
+ : m_Behavior(behavior)
+ , m_Handler(hdler)
+ , m_Arguments(args)
+ {
+ }
+ bool operator==(const SCallFunction &inOther) const
+ {
+ return m_Behavior == inOther.m_Behavior && m_Handler == inOther.m_Handler
+ && m_Arguments == inOther.m_Arguments;
+ }
+ template <typename TRemapper>
+ void Remap(TRemapper &inRemapper)
+ {
+ inRemapper.Remap(m_Behavior);
+ inRemapper.Remap(m_Handler);
+ inRemapper.Remap(m_Arguments);
+ }
+ };
+
+ /*
+ 1. A <set-attribute.../> executable must have an element="..." attribute that references an
+ element in one of the presentation assets for the application.
+ a. If the element attribute is missing, or references an element that cannot be found,
+ an error must be logged each time the executable would have been run, and the executable
+ ignored.
+ 2. A <set-attribute.../> executable must have an attribute="..." attribute that references an
+ attribute on the referenced element.
+ a. If the attribute attribute is missing, or references an attribute not present on the
+ element, an error must be logged each time the executable would have been run, and the
+ executable ignored.
+ 3. A <set-attribute.../> executable must have an value="..." attribute that describes the value
+ to set.
+ a. The contents of this attribute are evaluated as an expression and the result used
+ to set the attribute.
+ i. If the result of evaluating this expression does not match the type of the
+ attribute on the element then an error must be logged and the executable ignored.
+ 4. If a single visual state has both <goto-slide/> and <set-attribute/> executables, and the
+ slide change affects the same attribute as the set-attribute executable, then the set-attribute
+ executable must take effect (be applied after the slide change occurs).
+ In the future we may wish to have the order of this interaction controllable by the
+ ordering of the executables.
+ */
+ struct SSetAttribute
+ {
+ CRegisteredString m_Element;
+ CRegisteredString m_Attribute;
+ CRegisteredString m_Value;
+ SSetAttribute(CRegisteredString elem = CRegisteredString(),
+ CRegisteredString att = CRegisteredString(),
+ CRegisteredString val = CRegisteredString())
+ : m_Element(elem)
+ , m_Attribute(att)
+ , m_Value(val)
+ {
+ }
+ bool operator==(const SSetAttribute &inOther) const
+ {
+ return m_Element == inOther.m_Element && m_Attribute == inOther.m_Attribute
+ && m_Value == inOther.m_Value;
+ }
+
+ template <typename TRemapper>
+ void Remap(TRemapper &inRemapper)
+ {
+ inRemapper.Remap(m_Element);
+ inRemapper.Remap(m_Attribute);
+ inRemapper.Remap(m_Value);
+ }
+ };
+
+ /*
+ 4. A rel="..." attribute must have either the value next or prev.
+ a. If the rel attribute has a different value an error must be logged each time the
+ executable would have been run, and the executable ignored.
+ b. A value of next causes the time context to go to the next slide.
+ i. If the time context is at the last slide, and there is no wrap attribute, or
+ the wrap attribute does not have a value of true, then no change occurs to the time context.
+ The slide does not restart.
+ ii. If the time context is at the last slide and there exists a wrap attribute
+ with a value of true then the time context is taken to the first slide.
+ c. A value of prev causes the time context to go to the previous slide.
+ i. If the time context is at the first slide, and there is no wrap attribute, or
+ the wrap attribute does not have a value of true, then no change occurs to the time context.
+ The slide does not restart.
+ ii. If the time context is at the last first and there exists a wrap attribute
+ with a value of true then the time context is taken to the last slide.
+ */
+ struct SGotoSlideRelative
+ {
+ CRegisteredString m_Component;
+ enum Enum {
+ Next = 0,
+ Previous,
+ Error,
+ };
+ Enum m_Direction;
+ bool m_Wrap;
+ SGotoSlideData m_GotoSlideData;
+ SGotoSlideRelative(CRegisteredString comp = CRegisteredString(), Enum dir = Next,
+ bool wrap = false)
+ : m_Component(comp)
+ , m_Direction(dir)
+ , m_Wrap(wrap)
+ {
+ }
+ bool operator==(const SGotoSlideRelative &inOther) const
+ {
+ return m_Component == inOther.m_Component && m_Direction == inOther.m_Direction
+ && m_Wrap == inOther.m_Wrap;
+ }
+ template <typename TRemapper>
+ void Remap(TRemapper &inRemapper)
+ {
+ inRemapper.Remap(m_Component);
+ }
+ };
+
+ /*
+ 1. A <fire-event.../> executable must have an element="..." attribute that references an element
+ in one of the presentation assets for the application.
+ a. If the element attribute is missing, or references an element that cannot be found,
+ an error must be logged each time the executable would have been run, and the executable
+ ignored.
+ 2. A <fire-event.../> executable must have an event="..." attribute that describes the event
+ name to fire.
+ a. If the event attribute is missing an error must be logged each time the executable
+ would have been run, and the executable ignored.
+ */
+ struct SFireEvent
+ {
+ CRegisteredString m_Element;
+ CRegisteredString m_Event;
+ SFireEvent(CRegisteredString elem, CRegisteredString evt)
+ : m_Element(elem)
+ , m_Event(evt)
+ {
+ }
+ SFireEvent() {}
+ bool operator==(const SFireEvent &inOther) const
+ {
+ return m_Element == inOther.m_Element && m_Event == inOther.m_Event;
+ }
+
+ template <typename TRemapper>
+ void Remap(TRemapper &inRemapper)
+ {
+ inRemapper.Remap(m_Element);
+ inRemapper.Remap(m_Event);
+ }
+ };
+
+ struct SPresentationAttribute
+ {
+ CRegisteredString m_Presentation;
+ CRegisteredString m_Attribute;
+ CRegisteredString m_Value;
+ SPresentationAttribute(CRegisteredString pres, CRegisteredString att, CRegisteredString val)
+ : m_Presentation(pres)
+ , m_Attribute(att)
+ , m_Value(val)
+ {
+ }
+ SPresentationAttribute() {}
+ bool operator==(const SPresentationAttribute &inOther) const
+ {
+ return m_Presentation == inOther.m_Presentation && m_Attribute == inOther.m_Attribute
+ && m_Value == inOther.m_Value;
+ }
+
+ template <typename TRemapper>
+ void Remap(TRemapper &inRemapper)
+ {
+ inRemapper.Remap(m_Presentation);
+ inRemapper.Remap(m_Attribute);
+ inRemapper.Remap(m_Value);
+ }
+ };
+
+ struct SPlaySound
+ {
+ CRegisteredString m_SoundFilePath;
+ SPlaySound(CRegisteredString inSoundFilePath)
+ : m_SoundFilePath(inSoundFilePath)
+ {
+ }
+ SPlaySound() {}
+ bool operator==(const SPlaySound &inOther) const
+ {
+ return m_SoundFilePath == inOther.m_SoundFilePath;
+ }
+
+ template <typename TRemapper>
+ void Remap(TRemapper &inRemapper)
+ {
+ inRemapper.Remap(m_SoundFilePath);
+ }
+ };
+
+ // defined in UICStateVisualBindingContextValues.h
+ struct SVisualStateCommand;
+}
+}
+#endif