Page 1 of 1
Plugin not recognized after ccPointCloud.addPoint()
Posted: Thu Sep 03, 2020 4:41 pm
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 (
), 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
Re: Plugin not recognized after ccPointCloud.addPoint()
Posted: Thu Sep 03, 2020 4:44 pm
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?
Re: Plugin not recognized after ccPointCloud.addPoint()
Posted: Thu Sep 03, 2020 4:57 pm
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
Re: Plugin not recognized after ccPointCloud.addPoint()
Posted: Thu Sep 03, 2020 5:09 pm
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.
Re: Plugin not recognized after ccPointCloud.addPoint()
Posted: Thu Sep 03, 2020 5:25 pm
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?
Re: Plugin not recognized after ccPointCloud.addPoint()
Posted: Thu Sep 03, 2020 5:29 pm
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
Re: Plugin not recognized after ccPointCloud.addPoint()
Posted: Thu Sep 03, 2020 7:12 pm
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
Re: Plugin not recognized after ccPointCloud.addPoint()
Posted: Thu Sep 10, 2020 12:03 am
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
Re: Plugin not recognized after ccPointCloud.addPoint()
Posted: Thu Sep 10, 2020 11:52 am
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)