How can I add new menu and button to access new my functions.

Feel free to ask any question here
Post Reply
Eiji Kurihara
Posts: 24
Joined: Mon Mar 14, 2016 1:35 am

How can I add new menu and button to access new my functions.

Post by Eiji Kurihara »

I am a bigginner of CloudCompare. However with the help of my colleague, I can install and build it under the window 10(32bit) environment.
I may support your CloudCompare in future. But in this stage, I am so unskillful to deal with your functions. So, making a new menu or a new
button on your display screen, I try to call to draw a point or a line. Since there is a cc_icon.rc under the ClooudCompare directory,
I try to change it. Then I cannot complile it. Commenting LANGUAGE LANG_JAPANESE, SUBLANG_DEFAULT by //, I could compile it.
But the changed menu or buttons are not appeared on the screen. Is there a way to display my own menu or a button on your screen?
Sincerely,
Eiji Kurihara
daniel
Site Admin
Posts: 7710
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: How can I add new menu and button to access new my functions.

Post by daniel »

First, to add or modify code to CloudCompare, you'll have to learn to work with Qt (http://doc.qt.io/qt-5/gettingstarted.html).

Then, to add a new function you have two choices:
  • add it as a plugin (this is the default choice). CloudCompare will take care of adding the menu entry and icon, and this way you can do anything you want without disturbing the main project code
  • otherwise you can directly modify the core. But if you want these modifications to be included in the official version we'll have to discuss about them first
To implement a new plugin, follow this document: https://github.com/cloudcompare/trunk/b ... IBUTING.md (section 'Designing a new qCC plugin').

And don't hesitate to ask questions on the forum of course.

Daniel

P.S.:
- to modify a graphical user component, you should edit the corresponding 'ui' file with QDesigner.
- the 'cc_icon.rc' file is for compiling with MinGW on Windows (and it just points on the main application icon)
Daniel, CloudCompare admin
Eiji Kurihara
Posts: 24
Joined: Mon Mar 14, 2016 1:35 am

Re: How can I add new menu and button to access new my functions.

Post by Eiji Kurihara »

Thank you for your reply. It seems I need a lot of time to be familiar with QT and CloudCompare.
Anyway I am glad to getting a reply. Sincerely.
Eiji Kurihara
Posts: 24
Joined: Mon Mar 14, 2016 1:35 am

Re: How can I add new menu and button to access new my functions.

Post by Eiji Kurihara »

I did my best to show icon.png on your Cloud Compare Display window. I found qDummyPlugin directory under the plugins directory, and changed qDummyPlugin to qMyPlugin, and build again. Since then, Double-Clicking CloudCompareProjects.sln, I find menu QMY_PLUGIN in both Solution Explorer and Resource View Window on the Microsoft Visual Stadio 2010. By making QMY_PLUGIN, QMY_PLUGIN.dll is constructed. However, making CloudCompare as a start-up project, and starting the program, I cannot find a plug-in icon = icon.png on the CloudCompare v2.6.3. beta[32 bits]-[3d View 1] screen window. How can I get a plug-in icon on the CloudCompare screen?
daniel
Site Admin
Posts: 7710
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: How can I add new menu and button to access new my functions.

Post by daniel »

Have you followed the ''Designing a new qCC plugin" section carefully? Be sure to rename everything (especially the Q_EXPORT_PLUGIN2 and Q_PLUGIN_METADATA macros in order to avoid any conflict with the other plugins).

Then:
  • check that when you compile the 'INSTALL' project, the plugin DLL is copied in the installation directory (you should see this at the end of the build process, in Visual 'output' console).
  • be sure to start CloudCompare from the installation directory (you should have already changed the command target in the 'Debugging' properties of the 'CloudCompare' project in Visual).
  • then when you start CloudCompare, look in the Console if there's an error regarding your plugin / DLL or on the contrary if everything's ok.
Then you should find the plugin in the 'Plugins' menu as well as in the Plugins toolbar.
Daniel, CloudCompare admin
Eiji Kurihara
Posts: 24
Joined: Mon Mar 14, 2016 1:35 am

Re: How can I add new menu and button to access new my functions.

Post by Eiji Kurihara »

I am still strugging to get sensitive plugin menu and the plugin icon.
I cannot see icon.png button in the CloudCompare screen window.
Q_EXPORT_PLUGIN2 is as follows in the qMyPlugin.cpp file.
#ifndef CC_QT5
//Don't forget to replace 'qMyPlugin' by your own plugin class name here also!
Q_EXPORT_PLUGIN2(qMyPlugin,qMyPlugin);
#endif
Q_PLUGIN_METADATA is as follows in the qMyPlugin.h file
#ifdef CC_QT5
//replace qMyPlugin by the plugin name (IID should be unique - let's hope your plugin name is unique ;)
Q_PLUGIN_METADATA(IID "cccorp.cloudcompare.plugin.qMyPlugin")
#endif

CMake3.5.0 is as follows
Where is the source code: C:/Users/kuri/Downloads/trunk-master/trunk-master
Where to build the binaries: C:/Users/kuri/Downloads/trunk-master/trunk-master/build
Name Value
CMAKE_BACKWARDS_COMPATIBILITY 2.4
CMAKE_BUILD_TYPES Debug;Release;MinSizeRel;RelWidthDebInfo
CMAKE_INSTALL_PREFIX            C:Program Files(x86)・CloudCompareProjects
Value On is the following Name
COMPILE_CC_CORE_LIB_SHARED, COMPILE_CC_CORE_LIB_EITH_QT, COMPILE_CC_CORE_LIB_WITH_TRIANGLE,
COMPILE_QMY_PLUGIN,INSTALL_SYSTEM_LIBS, OPTION_BUILD_CCVIEWER,USE_QT5

What is bad in order to display the plugin icon icon.png in the CloudCompare window?
If you want to know the values about CMake 3.5.0, I will inform you.

Sincerely,
Eiji Kurihara
Posts: 24
Joined: Mon Mar 14, 2016 1:35 am

Re: How can I add new menu and button to access new my functions.

Post by Eiji Kurihara »

After Building INSTALL project, I find this is not build. The message( contains Japanese) is follows:
1>------ ビルド開始: プロジェクト: INSTALL, 構成: Release Win32 ------
1>2016/03/22 18:32:50 にビルドを開始しました。
1>InitializeBuildStatus:
1> "Win32\Release\INSTALL\INSTALL.unsuccessfulbuild" のタッチ タスクを実行しています。
1>PostBuildEvent:
1> -- Install configuration: "Release"
1> CMake Error at CC/cmake_install.cmake:32 (file):
1> file cannot create directory: C:/Program Files
1> (x86)/CloudCompareProjects/CloudCompare. Maybe need administrative
1> privileges.
1> Call Stack (most recent call first):
1> cmake_install.cmake:32 (include)
1>
1>
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(113,5): error MSB3073: コマンド "setlocal
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(113,5): error MSB3073: "C:\Program Files (x86)\CMake\bin\cmake.exe" -DBUILD_TYPE=Release -P cmake_install.cmake
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(113,5): error MSB3073: if %errorlevel% neq 0 goto :cmEnd
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(113,5): error MSB3073: :cmEnd
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(113,5): error MSB3073: endlocal & call :cmErrorLevel %errorlevel% & goto :cmDone
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(113,5): error MSB3073: :cmErrorLevel
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(113,5): error MSB3073: exit /b %1
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(113,5): error MSB3073: :cmDone
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(113,5): error MSB3073: if %errorlevel% neq 0 goto :VCEnd
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(113,5): error MSB3073: :VCEnd" はコード 1 で終了しました。
1>
1>ビルドに失敗しました。(= fail to build)
Do you understand what is bad?
Sincerely,
daniel
Site Admin
Posts: 7710
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: How can I add new menu and button to access new my functions.

Post by daniel »

Maybe the simplest would be to send me the files of your plugin? (the whole folder). You can send it to me via email (cloudcompare [at] danielgm.net) or you can create a fork on github with your plugin (this way I'll be able to look at the code directly and make online comments).
Daniel, CloudCompare admin
daniel
Site Admin
Posts: 7710
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: How can I add new menu and button to access new my functions.

Post by daniel »

And for the other errors it's because you have left the default installation destination (in Program Files). However CMake has not the rights to write in this folder. You should change the CMAKE_INSTALL_PREFIX destination.
Daniel, CloudCompare admin
Eiji Kurihara
Posts: 24
Joined: Mon Mar 14, 2016 1:35 am

Re: How can I add new menu and button to access new my functions.

Post by Eiji Kurihara »

As I told you in your email, finally I got a sensitive plugin menu and plugin icon
in release and debug versions in my CloudCompare
Display windows. Next I try to draw lines in this windows.
Thank you very much for your help.

Sincerely,
Post Reply