Plugin not recognized after ccPointCloud.addPoint()

For any question about plugins!
Post Reply
mbs
Posts: 6
Joined: Mon Aug 17, 2020 12:39 pm

Plugin not recognized after ccPointCloud.addPoint()

Post by mbs »

When I run the following code in my plugin, CC displays the action in the Plugins menu:

Code: Select all

pluginAction = new QAction("My Plugin", this);
pluginAction ->setIcon(getIcon());

// Connect signal for dialog action
connect(pluginAction , &QAction::triggered, this, [this]() {

    ccPointCloud cloud;
    cloud.reserve(1);
    CCVector3d vec(0.0, 0.0, 0.0);
    const CCVector3 pt = CCVector3::fromArray(vec.u);
    // cloud.addPoint(pt);
}
When I uncomment the last line (

Code: Select all

cloud.addPoint
), CC doesn't display the plugin and the console says "MY_PLUGIN.dll does not appear to be a valid plugin." I've tried other ways of defining the point, but that hasn't helped. Am I missing a dependency?

Thanks,
Matt
daniel
Site Admin
Posts: 7717
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: Plugin not recognized after ccPointCloud.addPoint()

Post by daniel »

It looks indeed like a dependency issue... but since here it should be the dependency to qCC_db which is part of CC, that's a bit weird ;).

Are you using the INSTALL feature to copy all the files together?
Daniel, CloudCompare admin
mbs
Posts: 6
Joined: Mon Aug 17, 2020 12:39 pm

Re: Plugin not recognized after ccPointCloud.addPoint()

Post by mbs »

No, I generated a VS2017 project with CMake. After building the project, VS executes a post-build step that copies the DLL to CloudCompare's plugins directory.

Should I use the INSTALL feature? How does it work?

Many thanks,
Matt
mbs
Posts: 6
Joined: Mon Aug 17, 2020 12:39 pm

Re: Plugin not recognized after ccPointCloud.addPoint()

Post by mbs »

Here's an interesting point. I've looked through other plugins, and many of them create point clouds with:

Code: Select all

ccPointCloud* cloud = new ccPointCloud();
But when I use that to create a point cloud, CloudCompare doesn't accept my plugin.
daniel
Site Admin
Posts: 7717
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: Plugin not recognized after ccPointCloud.addPoint()

Post by daniel »

The INSTALL feature is indeed the 'INSTALL' project that's part of the Visual Studio solution.

And indeed, that may be because of that allocation? Have you tried with a dynamic allocation?
Daniel, CloudCompare admin
mbs
Posts: 6
Joined: Mon Aug 17, 2020 12:39 pm

Re: Plugin not recognized after ccPointCloud.addPoint()

Post by mbs »

Yes, I stopped using dynamic allocation. Currently, I'm using the following code:

Code: Select all

ccPointCloud cloud;
cloud.reserve(1);
CCVector3d vec(0.0, 0.0, 0.0);
const CCVector3 pt = CCVector3::fromArray(vec.u);
// cloud.addPoint(pt);
When I uncomment the last line, CloudCompare stops recognizing the plugin. Is it possible that there's something wrong with ccPointCloud's zero-arg constructor?

I'll try using the INSTALL feature. Thank you.

Matt
mbs
Posts: 6
Joined: Mon Aug 17, 2020 12:39 pm

Re: Plugin not recognized after ccPointCloud.addPoint()

Post by mbs »

After using "Run as Administrator", I built the INSTALL project in Visual Studio. This installed my DLL in the plugins directory.

But CloudCompare still won't recognize my plugin because of the addPoint issue.

Thanks,
Matt
mbs
Posts: 6
Joined: Mon Aug 17, 2020 12:39 pm

Re: Plugin not recognized after ccPointCloud.addPoint()

Post by mbs »

I figured out the problem. I didn't set CMAKE_INSTALL_PREFIX correctly, so building the INSTALL target didn't update the plugin in the right directory. After I set CMAKE_INSTALL_PREFIX to the right value, my code started working properly.

It's important to remember that the INSTALL target will only work if Visual Studio is run with administrative privileges. Otherwise, building the INSTALL target will give a bizarre error.

Sorry for the bother,
Matt
daniel
Site Admin
Posts: 7717
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: Plugin not recognized after ccPointCloud.addPoint()

Post by daniel »

Oh, the issue is actually that the default Install prefix is "Program Files" which is write protected on modern Windows systems...

I think there's a note about that in the BUILD.md file:
set the Where to build the binaries field to ... almost anywhere you want apart from the same folder as above or the Program Files folder (on Windows). (for instance: C:\CloudCompare\build)
Daniel, CloudCompare admin
Post Reply