diff options
Diffstat (limited to 'indra/newview/llscripteditorws.h')
| -rw-r--r-- | indra/newview/llscripteditorws.h | 64 |
1 files changed, 28 insertions, 36 deletions
diff --git a/indra/newview/llscripteditorws.h b/indra/newview/llscripteditorws.h index 69c7e1a8e1..ded83e6369 100644 --- a/indra/newview/llscripteditorws.h +++ b/indra/newview/llscripteditorws.h @@ -27,6 +27,7 @@ #pragma once #include "lljsonrpcws.h" +#include "llpublishedobjectmgr.h" #include "llsd.h" #include "lluuid.h" #include "llhandle.h" @@ -38,6 +39,7 @@ #include <map> #include <set> #include <atomic> +#include <functional> // Forward declarations class LLLiveLSLEditor; @@ -45,7 +47,6 @@ class LLScriptEdContainer; class LLScriptEditorWSServer; class LLChat; class LLPanel; -class LLPublishedPrimListener; class LLViewerObject; class LLInventoryItem; @@ -87,6 +88,7 @@ public: void onClose() override; void sendDisconnect(DisconnectReason reason = DisconnectReason::NORMAL, const std::string& message = "Goodbye"); + bool hasFeature(const std::string& feature) const; private: using string_set_t = std::set<std::string>; @@ -205,9 +207,11 @@ public: bool publishObject(const LLUUID& object_id); void unpublishObject(const LLUUID& object_id, const std::string& reason = ""); bool isObjectPublished(const LLUUID& object_id) const; + + // *TODO*: These should be moved to LLPublishedObjectMgr at some point. void onPrimInventoryReady(const LLUUID& object_id, const LLUUID& prim_id); void onPrimInventoryChanged(const LLUUID& object_id, const LLUUID& prim_id); - void onObjectPropertyChanged(const LLUUID& prim_id, const std::string& name, const std::string& desc); + void onObjectPropertyChanged(const LLUUID& prim_id, const std::string& name, const std::string& desc, S16 inventory_serial = -1); void onLinksetChildAdded(const LLUUID& root_id, LLViewerObject* child); void onLinksetChildRemoved(const LLUUID& root_id, const LLUUID& child_id); @@ -242,7 +246,10 @@ protected: LLSD handleObjectScriptReset(U32 connection_id, const LLSD& params); LLSD handleObjectModify(U32 connection_id, const LLSD& params); LLSD handleObjectItemModify(U32 connection_id, const LLSD& params); - LLSD buildPublishedObjectLLSD(LLViewerObject* root) const; + LLSD handleCommandExecute(U32 connection_id, const LLSD& params); + LLSD handleSaveBackToObjectContents(U32 connection_id, const LLSD& params); + LLSD handleCommandList(); + void sendCommandExecute(U32 connection_id, const std::string& command, const LLSD& params); struct ValidatedItem { @@ -255,10 +262,8 @@ protected: // --- Object Content Publishing (helpers) --- static std::string getPrimName(LLViewerObject* obj); - LLSD buildPrimInventoryLLSD(LLViewerObject* object) const; void notifyConnection(U32 connection_id, const std::string& method, const LLSD& params) const; void notifyAll(const std::string& method, const LLSD& params) const; - void cleanupPrimListeners(const LLUUID& object_id); void buildAndSendPublish(const LLUUID& object_id); void scheduleLinksetFlush(const LLUUID& root_id, F32 delay); void cancelLinksetFlushTimer(const LLUUID& root_id); @@ -303,32 +308,6 @@ private: }; using subscriptions_t = std::unordered_map<std::string, EditorSubscription>; - struct PublishedPrimInfo - { - LLUUID mPrimID; - std::string mPrimName; - S32 mLinkNumber; // 1=root, >=2=child - S16 mInventorySerial; // last-seen serial for change detection (Phase 4) - }; - - struct PublishedObjectInfo - { - LLUUID mObjectID; // root prim UUID - LLUUID mOwnerID; - std::string mObjectName; - std::string mObjectDescription; - std::string mRegionName; - std::vector<PublishedPrimInfo> mPrims; // root + all children - std::vector<std::unique_ptr<LLPublishedPrimListener>> mListeners; - }; - - struct PendingPublish - { - LLUUID mObjectID; - std::set<LLUUID> mPendingPrims; // prims whose inventory we're still waiting for - std::vector<std::unique_ptr<LLPublishedPrimListener>> mListeners; // listeners for pending prims - }; - SubscriptionError updateScriptSubscription(const std::string &script_id, U32 connection_id); void unsubscribeConnection(U32 connection_id); @@ -340,11 +319,24 @@ private: std::unordered_map<U32, S32> mConnectionSubscriptionCounts; std::map<U32, LLScriptEditorWSConnection::wptr_t> mActiveConnections; - std::map<LLUUID, PublishedObjectInfo> mPublishedObjects; // keyed by root object_id - std::map<LLUUID, PendingPublish> mPendingPublishes; // keyed by root object_id - std::map<LLUUID, std::string> mPendingItemCreates; // prim_id -> pump name awaiting inventory update - std::map<LLUUID, std::set<LLUUID>> mNewChildPrims; // root_id → children awaiting first inventory response - std::map<LLUUID, std::weak_ptr<LLEventTimer>> mLinksetFlushTimers; // root_id → pending coalesce timer + mutable LLPublishedObjectMgr mPublishedObjectManager; + + struct WSCommandInfo + { + std::string command; + std::string description; + }; + enum WSCommandError + { + UnknownCommand = 1, + InvalidParams = 2, + NotPermitted = 3, + ExecutionError = 4, + }; + using WSCommandHandler = std::function<LLSD(U32 connection_id, const LLSD& params)>; + std::unordered_map<std::string, std::pair<WSCommandInfo, WSCommandHandler>> mCommandRegistry; + + void registerCommand(const WSCommandInfo& info, WSCommandHandler handler); boost::signals2::connection mLanguageChangeSignal; LLUUID mLastSyntaxId; |
