Page 1 of 1
Need advice for plugin developpement
Posted: Mon Nov 26, 2018 2:30 pm
by fblue
Hi Daniel,
I'm developping the interface of our plugin, and I don't know if it is realizable. It'll be helpful if you can give me some advices.
Goal:
We use the parameters in the plugin to apply a processing. After that, not only the cloud point results are stored in a group created in DB Tree, but also a new object A(non-cloud) will be stored in the same group. The new object A stores all the parameters used and details of the processing as metadata. These parameters can be seen by the property window of this object. When the object A is double clicked (or right click to select a plugin in the list), our own plugin will be appeard with the same parameters of the object. So the processing can be restored and continue with new parameters.
Can I realize this object A from my plugin without modifying the core component of CC?
Can I customize the properties window (show or hide some properties), or disable the whole properties window?
Thanks
Re: Need advice for plugin developpement
Posted: Tue Nov 27, 2018 10:09 pm
by daniel
Well, you could create a very simple object (such as a 'Group' - a ccHObject in effect) and store the parameters as metadata indeed. With the latest version, this object will appear as a simple 'leaf' and not a group (as long as it's empty). It can also be saved in BIN files, etc.
Another option is to create your own object (ccCustomObject). It's a little bit more complex, but you can really create your own object.
And of course a third option is to save the parameters of your plugin directly on the cloud (if it makes any sense ;).
In any case, you don't need to change the core of CloudCompare.
But you can't personalize the properties window. Nor disable it from a plugin. And you can manually start your plugin once with your parameters object selected, but you can't start it by double clicking on it.
Re: Need advice for plugin developpement
Posted: Thu Nov 29, 2018 4:57 pm
by fblue
Thanks Daniel.
I just tried to write the meta data into my generated group object (see the images). No problem to add metadata in the group, but after have saved into a bin file, I found the meta data lost when I load the bin file. But the meta datas added to the point cloud and sub-group are still there. Have I done something wrong?
- Capture.PNG (39.58 KiB) Viewed 3892 times
Re: Need advice for plugin developpement
Posted: Thu Nov 29, 2018 7:13 pm
by daniel
That's odd, because meta-data elements are hosted by the ccObject class (and saved/loaded by this class) and the ccHObject class inherits by the ccObject). I need to test this on my side.
Re: Need advice for plugin developpement
Posted: Thu Nov 29, 2018 7:17 pm
by daniel
Sorry I didn't look at the picture.
Have you really saved the first group in the BIN file? It should be restored when you load the file (here the first group on the right is actually the group automatically created by CC to store the entities).
Re: Need advice for plugin developpement
Posted: Thu Nov 29, 2018 8:39 pm
by fblue
A little confused about the first group, which one?
For the example in the picture:
At first I open a cloud named 'small2-Cloud' (not seen in the picture) and CC creates the first group, then my plugin does some processing. When it finished, it creates a new group 'small2-Cloud.clone' (as the left side in the picture) just below the first group. It's a ccHObject and it contains 3 children as in the picture. I used ccHObject->setMetadata() to add elements to each object. Then I select only the new group and use the 'Save' button to save it to a bin file.
The result: Only the meta-data of the parent group is lost, the meta-datas of the 3 children in the group are restored in bin file.
Re: Need advice for plugin developpement
Posted: Thu Nov 29, 2018 9:00 pm
by daniel
What I mean is that the "small2.bin (C:/Users/liang/Desktop)" group on the right (once you reload the data) is not the group created by your plugin. This is why it has no meta-data. I just don't know why this group disappears in your process...
Can you make another test? Can you move your group ("small2 - Cloud.clone [Result n=2, d=0]") under another group (you can create one by left clicking anywhere in an empty area of the DB tree view). Then select this other group and save it as a BIN file. When you reload the BIN file, do you get your original group back?
Re: Need advice for plugin developpement
Posted: Fri Nov 30, 2018 8:49 am
by fblue
If I understand it correctly, make the group "small2 - Cloud.clone [Result n=2, d=0]" as a sub-group of another one and save the new group as bin file. In this case no problem! (Please see the picture).
- Capture1.PNG (29.23 KiB) Viewed 3851 times
Re: Need advice for plugin developpement
Posted: Fri Nov 30, 2018 10:04 am
by daniel
Then it means that CC discards the first group when it saves it to a BIN file in your case... I need to find why.