PlugIn Examples

For any question about plugins!
Charlesw
Posts: 45
Joined: Mon Apr 10, 2017 3:54 pm

PlugIn Examples

Post by Charlesw »

I am familiar with coding but in no way an expert. I have the environments and compiler as needed and I am now ready to code plugins. I was simply wondering if there is a way for me to view the code behind buttons you already have compiled into CloudCompare such as changing the scalar fields and merging multiple clouds together. I would like to utilize this existing code to modify and develop it for a specific purpose. End goal here is to make a plugin which acts as a one click function to allow the user to perform a predetermined sequence of actions to their FBX and pointcloud files. Since the concept is nothing new and utilizes functions which are already built and installed into the program, I am curious to know if I need to redevelop these tools or if it is possible to see the source code of the already built-in processes/methods/ functions of CloudCompare.

I have reviewed the core library documentation and do intend to dig deeper into this as well. I was hoping to look at some of the code for the core of this program as it would help me start on a new plugin myself. I looked into other plugins people have developed, however as their intent is for extended applicability to cloud compare, I am not very familiar with the processes they call upon.

I also sifted through the documentation and repository on gitHub for CloudCompare. I am particularly looking for the source code to the "Merge multiple clouds" button in the toolbar of CloudCompare as this is a good first step for the Plugin I would like to create.
Charlesw
Posts: 45
Joined: Mon Apr 10, 2017 3:54 pm

Re: PlugIn Examples

Post by Charlesw »

On a separate - but not too distant note - I am new to the dll creation side of programming. I have qt creator installed, visual community (which i believe is unneeeded here since qt essentially takes its place) and Cmake. I am having trouble getting cmake to generate the file needed for qt. I do have the master repository for CC downloaded and am attempting to simply compile CC with the qDummyPlugin installed all as is from the latest update without modification just to get a handle on the process of going from a .cpp to a .dll)
daniel
Site Admin
Posts: 7711
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: PlugIn Examples

Post by daniel »

1) You can indeed use the code that exists in CloudCompare in a plugin. Or reimplement some classes to change slightly their behavior. But you'll have to explicitly import the files in your plugin project (see how this is done in CMake, with the qFacets plugin that imports the ccColorScale class).

But you'll have to import the class and all the other classes it depends on (so it might not be possible for all classes, as some of them may depend on too many others). Of course we can make some small modifications of the CloudCompare project classes if it's really necessary.

And all classes present in the libraries can be used directly (by default plugins depend on all the project libraries: CC_CORE, QCC_DB, QCC_IO, etc.).

2) Most of the functions accessible through the menu are listed in mainwindow.cpp and in the ccEntityAction class (in an heroic attempt by Andy to reduce the size of the first file ;).

For instance, the 'merge' method is implemented in MainWindow::doActionMerge (note that this tool is more performing 'concatenation' than actual merging).

To add menu entries / icons via a plugin, you just need to add an 'action', and then put the corresponding code in a dedicated 'slot' method (inside your plugin). But to add new widgets to the properties dialog of CC for instance is not possible for now.

3) I don't use Qt Creator personally. I know some people have used it successfully though...
Daniel, CloudCompare admin
Charlesw
Posts: 45
Joined: Mon Apr 10, 2017 3:54 pm

Re: PlugIn Examples

Post by Charlesw »

By preference I like to stick with visual studio/community. I was under the impression I needed to use qt. however I am now seeing that as long as I have the repository and tell cmake to use visual studio then visual studio is valid to compile the project.

I apologize for the simplicity of this next question:

How do I get CMake to configure properly?

Once I set the source and binary folder, hit configure, I get errors saying it is unable to find the necessary Cmake files

cmake policies active: CMP0020 CMP0043
The C compiler identification is unknown
The CXX compiler identification is unknown
CMake Error at CMakeLists.txt:7 (project):
No CMAKE_C_COMPILER could be found.



CMake Error at CMakeLists.txt:7 (project):
No CMAKE_CXX_COMPILER could be found.



Configuring incomplete, errors occurred!
See also "L:/CloudCompareTesting/build/CMakeFiles/CMakeOutput.log".
See also "L:/CloudCompareTesting/build/CMakeFiles/CMakeError.log".

I believe I am just incorrectly pathing CC files from gitHub. I currently have the entire master folder on an external harddrive and would like to just compile it as is. Is it possibly because I am missing some software?
Charlesw
Posts: 45
Joined: Mon Apr 10, 2017 3:54 pm

Re: PlugIn Examples

Post by Charlesw »

Update: I had to reinstall visual studio, something must have not downloaded properly the first time. Thank you for your help and cooperation Daniel. Should I come across further issues I will post again.

Hopefully I get into these plugins soon and can help to develop additional features for CC :)
daniel
Site Admin
Posts: 7711
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: PlugIn Examples

Post by daniel »

No problem, it's always good to have new (potential) contribitors ;)
Daniel, CloudCompare admin
Charlesw
Posts: 45
Joined: Mon Apr 10, 2017 3:54 pm

Re: PlugIn Examples

Post by Charlesw »

Good morning/ Afternoon,

I am attempting to compile the base CloudCompare project with no additional plugins. I've got CMake to generate the project files using Visual Studio 14 2015.

I am now trying to compile and build the project in visual studio.

I keep receiving the error:

Error Code: "LNK1112 - module machine type 'x64' conflicts with target machine type 'X86' "
Project: CC_CORE_LIB
File: Qt5Core.lib (Qt5Core.dll)

I am running on a 64 bit system which has all the libraries and sdks necessary (as far as I can tell).

I've tried changing the project properties to build for an x64 and have also tried changing the build properties for all of the build pieces, along with for individual pieces throwing the same error. None of this has worked. In fact doing so seems to multiply this error.

When building in default Win32 settings, i only get this error once, along with 4 additional errors which follow:

Severity Code Description Project File Line Suppression State
Error LNK1181 cannot open input file '..\libs\qCC_io\Release\QCC_IO_LIB.lib' ccViewer L:\CloudCompareTesting\build\ccViewer\LINK 1
Error LNK1181 cannot open input file '..\..\CC\Release\CC_CORE_LIB.lib' QCC_DB_LIB L:\CloudCompareTesting\build\libs\qCC_db\LINK 1
Error LNK1181 cannot open input file '..\qCC_db\Release\QCC_DB_LIB.lib' QCC_IO_LIB L:\CloudCompareTesting\build\libs\qCC_io\LINK 1
Error LNK1181 cannot open input file '..\libs\qCC_io\Release\QCC_IO_LIB.lib' CloudCompare L:\CloudCompareTesting\build\qCC\LINK 1


These 4 errors I am sure is simply a pathing issue I can fix from within the code, however I unsure what is causing error LNK1112

Any insight?
daniel
Site Admin
Posts: 7711
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: PlugIn Examples

Post by daniel »

You have to select right when setting up the CMake project the first time the right compiler. For Visual, you generally have the 32 bits and the 64 bits versions listed in CMake (they are different). So you'd better recreate the CMake project (use 'File > Delete cache') and make sure to select the right compiler.
Daniel, CloudCompare admin
daniel
Site Admin
Posts: 7711
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: PlugIn Examples

Post by daniel »

Oh, and be sure to use Qt 5 64 bits as well (but I guess it's ok?). If under Visual you don't have the 64 bits target when you open the project, then it's probably an issue with the version of the Visual compiler.
Daniel, CloudCompare admin
Charlesw
Posts: 45
Joined: Mon Apr 10, 2017 3:54 pm

Re: PlugIn Examples

Post by Charlesw »

Thank you for your cooperation thus far, you have been a tremendous help getting started with this.

I have slightly changed my approach at this point. I am coding directly in mainwindow.cpp as I was unable to find a way to utilize the methods and database defined within mainwindow.cpp from the plugin. This is actually easier and much more productive for my current initial purposes.

Brief question:

How do you delete entities from the DBTree? (automatically, without requiring user to manually to delete)

Such as:

User imports FBX - > multiple meshes are created - > user selects all the meshes and "merges" them - > user no longer wants the original FBX-Meshes to appear in the DBtree once the merge is successful (AKA: User ONLY wants to see the merged mesh). I see you have this functionality for the pointcouds as they were defined as ccHobjects and were simply added to the remove list, whereas the mesh is not cast as a ccHObject.

Is there any form of documentation on the dbtree or its functions or even main file in which it is developed so I can view its abilities.
Post Reply