From e6f95ff2915a587a27817490e53a9ca6cd971179 Mon Sep 17 00:00:00 2001 From: theadib Date: Tue, 29 Dec 2020 17:25:30 +0100 Subject: [PATCH] new option in command to specify name caption in CC treeview --- CHANGELOG | 3 +++ README.md | 1 + include/JsonRPCPlugin.h | 2 +- src/JsonRPCPlugin.cpp | 7 +++++++ test/client_open2.py | 2 +- 5 files changed, 13 insertions(+), 2 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 2c0002a..a027be8 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,8 @@ gJsonRPCPlugin versions +2020-12-29 1.1 +add option in command to specify name caption in CC treeview + 2020-12-29 1.0 add command to get version information diff --git a/README.md b/README.md index 2a6aebb..411bdd6 100644 --- a/README.md +++ b/README.md @@ -86,6 +86,7 @@ interface filter: string, optional, filter identificator, if not given then CloudCompare identifies fileformat based on extension silent: bool, optional, if true, then filterdialog is suppressed transformation: list of float (16values), optional, after import this transformation matrix is applied to the object, + name: specify name in CC object treeview - clear - clear all objects - version - return version number of plugin ``` diff --git a/include/JsonRPCPlugin.h b/include/JsonRPCPlugin.h index 6d0c473..b167b49 100644 --- a/include/JsonRPCPlugin.h +++ b/include/JsonRPCPlugin.h @@ -42,7 +42,7 @@ public slots: private: //! Default action QAction* m_action{nullptr}; - const QString version{"1.0"}; + const QString version{"1.1"}; protected: /// server that emit the execute signals JsonRPCServer rpc_server; diff --git a/src/JsonRPCPlugin.cpp b/src/JsonRPCPlugin.cpp index a3e3344..7124705 100644 --- a/src/JsonRPCPlugin.cpp +++ b/src/JsonRPCPlugin.cpp @@ -145,6 +145,13 @@ JsonRPCResult JsonRPCPlugin::execute(QString method, QMap par } } + // the object name in CC treeview + QString objname = params["name"].toString().trimmed(); + if(!objname.isEmpty()) + { + newGroup->setName(objname); + } + m_app->addToDB(newGroup); need_redraw = true; result = JsonRPCResult::success(0); diff --git a/test/client_open2.py b/test/client_open2.py index 212dbf3..135f525 100755 --- a/test/client_open2.py +++ b/test/client_open2.py @@ -6,7 +6,7 @@ import websockets async def hello(): uri = "ws://localhost:6001" async with websockets.connect(uri) as websocket: - await websocket.send('{"jsonrpc": "2.0", "method": "open", "params": {"filename": "/home/adib/Dokumente/teapot.ply", "filter":"PLY mesh (*.ply)", "silent":true}, "id": 4}') + await websocket.send('{"jsonrpc": "2.0", "method": "open", "params": {"filename": "/home/adib/Dokumente/teapot.ply", "filter":"PLY mesh (*.ply)", "silent":true, "name":"testpod"}, "id": 4}') result = await websocket.recv() print("result: ", result)