当使用cloudcompare开发新的插件功能时,同样需要像vs一样进行插件代码的逐行调试,以加快插件开发的进度。

1.创建插件文件夹

首先使用cmake+vs完成cloudcompare的插件安装,具体步骤如下:在cloudcompare源代码中的core模块中创建了qStar文件夹。

2.新建相关文件

在qStar文件夹中建立以下文件和文件夹

(1)images文件夹下存放了插件的图标。

(2)CMakeLists用于配置cmake编译插件的功能设置。文件的内容如下:(注:若要建立新的插件,需要将qStar全部替换为新的插件名。)

cmake_minimum_required( VERSION 3.0 )option( PLUGIN_STANDARD_qStar  "Check to install example plugin" ON )if ( PLUGIN_STANDARD_qStar )# Name the pluginproject( qStar)include( ../../../CMakePluginTpl.cmake )endif()

(3)info.json用于描述插件的基本信息。内容如下:(注:若要建立新的插件,需要将qStar全部替换为新的插件名。)

{"type": "Standard","core": true,"name": "qStar","icon": ":/CC/plugin/qStar/images/qStar.png","description": "This is a description of the  qStar.","authors": [{"name": "beidoustars","email": "beidou_stars@163.com"}],"maintainers": [{"name": "beidoustars","email": ""},{"name": ""}],"references": [{"text": "","url": ""},{"text": "","url": ""},{"text": ""}]
}

(4)qStar.cpp插件的具体实现,其中的doAction函数就是用于添加和实现插件具体功能的函数。内容如下:注:若要建立新的插件,需要将qStar全部替换为新的插件名。)

//##########################################################################
//#                                                                        #
//#                CLOUDCOMPARE PLUGIN: ExamplePlugin                      #
//#                                                                        #
//#  This program is free software; you can redistribute it and/or modify  #
//#  it under the terms of the GNU General Public License as published by  #
//#  the Free Software Foundation; version 2 of the License.               #
//#                                                                        #
//#  This program is distributed in the hope that it will be useful,       #
//#  but WITHOUT ANY WARRANTY; without even the implied warranty of        #
//#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         #
//#  GNU General Public License for more details.                          #
//#                                                                        #
//#                             COPYRIGHT: XXX                             #
//#                                                                        #
//##########################################################################// First:
//  Replace all occurrences of 'ExamplePlugin' by your own plugin class name in this file.
//  This includes the resource path to info.json in the constructor.// Second:
//  Open ExamplePlugin.qrc, change the "prefix" and the icon filename for your plugin.
//  Change the name of the file to <yourPluginName>.qrc// Third:
//  Open the info.json file and fill in the information about the plugin.
//   "type" should be one of: "Standard", "GL", or "I/O" (required)
//   "name" is the name of the plugin (required)
//   "icon" is the Qt resource path to the plugin's icon (from the .qrc file)
//   "description" is used as a tootip if the plugin has actions and is displayed in the plugin dialog
//   "authors", "maintainers", and "references" show up in the plugin dialog as well#include <QtGui>#include "qStar.h"// Default constructor:
//  - pass the Qt resource path to the info.json file (from <yourPluginName>.qrc file)
//  - constructor should mainly be used to initialize actions and other members
qStar::qStar( QObject *parent ): QObject( parent ), ccStdPluginInterface( ":/CC/plugin/qStar/info.json" ), m_action( nullptr )
{
}// This method should enable or disable your plugin actions
// depending on the currently selected entities ('selectedEntities').
void qStar::onNewSelection( const ccHObject::Container &selectedEntities )
{if ( m_action == nullptr ){return;}// If you need to check for a specific type of object, you can use the methods// in ccHObjectCaster.h or loop and check the objects' classIDs like this://// for ( ccHObject *object : selectedEntities )//  {//     if ( object->getClassID() == CC_TYPES::VIEWPORT_2D_OBJECT )//      {//         // ... do something with the viewports//        }// }// For example - only enable our action if something is selected.m_action->setEnabled( !selectedEntities.empty() );
}// This method returns all the 'actions' your plugin can perform.
// getActions() will be called only once, when plugin is loaded.
QList<QAction *> qStar::getActions()
{// default action (if it has not been already created, this is the moment to do it)if ( !m_action ){// Here we use the default plugin name, description, and icon,// but each action should have its own.m_action = new QAction( getName(), this );m_action->setToolTip( getDescription() );m_action->setIcon( getIcon() );// Connect appropriate signalconnect( m_action, &QAction::triggered, this, &qStar::doAction );}return { m_action };
}// This is an example of an action's method called when the corresponding action
// is triggered (i.e. the corresponding icon or menu entry is clicked in CC's
// main interface). You can access most of CC's components (database,
// 3D views, console, etc.) via the 'm_app' variable (see the ccMainAppInterface
// class in ccMainAppInterface.h).
void qStar::doAction()
{   if ( m_app == nullptr ){// m_app should have already been initialized by CC when plugin is loadedQ_ASSERT( false );return;}/*** HERE STARTS THE ACTION ***/// Put your code here// --> you may want to start by asking for parameters (with a custom dialog, etc.)// This is how you can output messagesccLog::LogMessage("hello", 1);// Display a standard message in the consolem_app->dispToConsole( "[qStar] Hello world!", ccMainAppInterface::STD_CONSOLE_MESSAGE );// Display a warning message in the consolem_app->dispToConsole( "[qStar] Warning: example plugin shouldn't be used as is", ccMainAppInterface::WRN_CONSOLE_MESSAGE );// Display an error message in the console AND pop-up an error boxm_app->dispToConsole( "Example plugin shouldn't be used - it doesn't do anything!", ccMainAppInterface::ERR_CONSOLE_MESSAGE );/*** HERE ENDS THE ACTION ***/
}

(5)qStar.h插件头文件。(注:若要建立新的插件,需要将qStar全部替换为新的插件名。)

#ifndef Q_STAR_PLUGIN_HEADER
#define Q_STAR_PLUGIN_HEADER//##########################################################################
//#                                                                        #
//#                CLOUDCOMPARE PLUGIN: ExamplePlugin                      #
//#                                                                        #
//#  This program is free software; you can redistribute it and/or modify  #
//#  it under the terms of the GNU General Public License as published by  #
//#  the Free Software Foundation; version 2 of the License.               #
//#                                                                        #
//#  This program is distributed in the hope that it will be useful,       #
//#  but WITHOUT ANY WARRANTY; without even the implied warranty of        #
//#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         #
//#  GNU General Public License for more details.                          #
//#                                                                        #
//#                             COPYRIGHT: XXX                             #
//#                                                                        #
//###########################################################################include "ccStdPluginInterface.h"//! Example qCC plugin
/** Replace 'ExamplePlugin' by your own plugin class name throughout and thencheck 'ExamplePlugin.cpp' for more directions.Each plugin requires an info.json file to provide information about itself -the name, authors, maintainers, icon, etc..The one method you are required to implement is 'getActions'. This shouldreturn all actions (QAction objects) for the plugin. CloudCompare willautomatically add these with their icons in the plugin toolbar and to theplugin menu. If your plugin returns several actions, CC will create adedicated toolbar and a    sub-menu for your plugin. You are responsible forconnecting these actions to    methods in your plugin.Use the ccStdPluginInterface::m_app variable for access to most of the CCcomponents (database, 3D views, console, etc.) - see the ccMainAppInterfaceclass in ccMainAppInterface.h.
**/
class qStar : public QObject, public ccStdPluginInterface
{Q_OBJECTQ_INTERFACES(ccStdPluginInterface)// Replace "Example" by your plugin name (IID should be unique - let's hope your plugin name is unique ;)// The info.json file provides information about the plugin to the loading system and// it is displayed in the plugin information dialog.Q_PLUGIN_METADATA(IID "cccorp.cloudcompare.plugin.qStar" FILE "info.json")public:explicit qStar( QObject *parent = nullptr );~qStar() override = default;// inherited from ccStdPluginInterfacevoid onNewSelection( const ccHObject::Container &selectedEntities ) override;QList<QAction *> getActions() override;private:/*** ADD YOUR CUSTOM ACTIONS HERE ***/void doAction();//! Default action/** You can add as many actions as you want in a plugin.Each action will correspond to an icon in the dedicatedtoolbar and an entry in the plugin menu.**/QAction* m_action;
};#endif

(6)qStar.qrc用于文件的相关路径配置,内容如下:(注:若要建立新的插件,需要将qStar全部替换为新的插件名。)

<RCC><qresource prefix="/CC/plugin/qStar"><file>images/qStar.png</file><file>info.json</file></qresource>
</RCC>

3.cmake编译

qStar文件夹创建完成后,采用cmake 编译生成CloudCompareProjects.sln,然后采用vs生成解决方案(具体步骤可参考我的另外一篇博客:cloudcompare插件编译)。注意vs生成解决方案时要选择Debug模式。

4.插件调试

完成上一步操作后,在prefix文件夹(该文件夹为vs的INSTALL生成目录,是在cmake编译时设置的)中生成了CloudCompare_debug文件夹,将CloudCompare_debug中的CC_CORE_LIBd.dll,

QCC_DB_LIBd.dll,QCC_IO_LIBd.dll拷贝到CloudCompare-2.11.3-build\qCC\Debug路径下。在该路径下建立plugins文件夹,并把CloudCompare-2.11.3-build\plugins\core\Standard\qStar\Debug中的qStard.dll复制到Debug中新建的plugins文件夹。
再次打开CloudCompareProjects.sln,将cloudcompare设置为启动项。
最后回到CloudCompare-2.11.3-build\qCC\Debug文件夹中,如下图所示:

在CloudCompareProjects.sln中的qStar模块的源文件中添加断点,点击调试运行即可。一旦开始调试就会启动cloudcompare,然后加载点云文件,点击插件的图标,就可运行至断点处暂停。

至此就可以进行单步调试,但每次修改代码后,需要重新点击生成,并将生成的qStard.dll进行相应的替换,否则修改的代码无法生效。

CloudCompare 插件调试相关推荐

  1. Discuz 开启开发者模式并且开始默认安装未上架插件调试的模式-并且关掉应用中心-一颗优雅草科技伊凡

    Discuz 开启开发者模式并且开始默认安装未上架插件调试的模式-一颗优雅草科技伊凡 由于很多开发者需要尝试开发插件和模板,开发之前需要将论坛调整为开发者模式,正式运营论坛慎重,"修改会让你 ...

  2. 关于CRM插件调试方面事

    其实在开发CRM插件时候很多时候需要进行调试,这个方面有很多个工具,怎么使用也有相关的文档最全的可能是这个 http://www.cnblogs.com/StoneGarden/archive/201 ...

  3. debug idea js_IntelliJ IDEA 配置chrome插件调试js代码 - 狂奔的熊二 - 博客园

    调试js代码,每次都在要在代码中写debugger,或者在chrome中打断点,而且chrome的断点信息不人性化.偶然发现idea竟然有这个功能,简直神器啊.研究了半天终于搞定了,哈哈,开心.下面是 ...

  4. 【转】Dynamics CRM 365零基础入门学习(四)Dynamics 使用profiler插件调试流程

    今天我们介绍一种在dynamics开发中经常会用到的调试操作,其中一种调试方式即是profile调试.以下是我在项目开发中记录的调试流程,可供参考使用. 1.打开插件注册工具,会看到install P ...

  5. IntelliJ IDEA 配置chrome插件调试js代码

    调试js代码,每次都在要在代码中写debugger,或者在chrome中打断点,而且chrome的断点信息不人性化.偶然发现idea竟然有这个功能,简直神器啊.研究了半天终于搞定了,哈哈,开心.下面是 ...

  6. 取代浏览器插件调试,VS Code 整合 JS 调试工具

    整理 | 孙胜 最近,Microsoft Edge 官博宣布,JavaScript 调试现已内置到 Visual Studio Code 代码中,因此不需再次使用浏览器调试. 调试.js程序,无需安装 ...

  7. 谷歌插件学习必备准备知识代码提示插件调试

    插件开发:全面支持ES6+以上代码,无需编译,原生运行,打包时切忌开启转换ES5语法,原生支持async,await,js本身基因就是协程 插件开发入门课: 基础课:目前没有发现高级课,可能需要我们自 ...

  8. Chrome插件-浏览器插件开发-插件安装-插件调试-概述

    文章目录 1.简述 2.弹出界面 3.背景界面 4.插件安装 5.调试 6.打包 7.作者答疑   现今浏览器可以实现大部分数据信息的展示,提供给读者进行浏览,开发浏览器插件,可以有效实现对获取的数据 ...

  9. 虚幻浏览器插件 调试网页

    开发过程中需要检测js页面的执行情况.需要使用Js调试功能.插件自身提供了Js调试功能,但没有调试界面,需要借助Chrome的调试界面.操作步骤如下: 1. 检查端口 为调试功能分配一个合理的端口如: ...

最新文章

  1. Python的神奇功能——函数装饰器MetaClass
  2. 代码坏味道之非必要的
  3. 【C 语言】文件操作 ( 按照单个字符的方式读写文件 | fgetc 函数 | fputc 函数 )
  4. 对require四种引入方式的认识
  5. HTML(六)------ CSS
  6. Linux下静态IP地址的设置及TFTP服务的搭建
  7. C#LeetCode刷题之#441-排列硬币(Arranging Coins)
  8. Linux浏览器libgtk-3,终于把WebKit(基于GTK)移植到ARM上
  9. Centos7安装32位库用来安装32位软件程序
  10. 6-Hadoop之旅-Hive(二)
  11. AIML相关内容学习整理
  12. mysql5.7手册官方下载_MySQL官方手册5.7 PDF 下载
  13. 终极解决maya渲染层丢材质,变线框等问题
  14. MTK6577+Android环境变量
  15. html游戏加载不出图片吗,uc浏览器加载不出图片怎么办?uc浏览器加载不出图片的解决方法...
  16. 【Books系列】之第二本书:大冰《我不》读书笔记和读后感
  17. 关于最新版mumu模拟器(2.2.16)安装xposed框架
  18. 月末复盘,正视稀缺状态
  19. 成为一个CTO需要具备什么条件?
  20. 转专业考试c语言,关于转专业申请书汇编五篇

热门文章

  1. 迅播Gvod最新版本去广告补丁,不留任何广告
  2. 重装Windows,只用53款全免费软件:下 (xbeta译)
  3. 《逃出生天》:华语影视特效新视角 续
  4. CC2640R2F ble蓝牙 I2C解析
  5. cmd命令卸载ie9、10、11
  6. 设计师学python有意义吗-如果你有设计师朋友,请对他好一些...
  7. scrapy之feeds
  8. 20230121英语学习
  9. fix feeds/telephony/net/freeswitch/Makefile
  10. 金蝶EAS设置ctx控制单元