Own properties in plugin

Feel free to ask any question here
dm_red
Posts: 10
Joined: Thu Jan 26, 2017 6:48 pm

Own properties in plugin

Post by dm_red »

Hello, how i can append own properties to object in my plugin?
With help m_app?
daniel
Site Admin
Posts: 7717
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: Own properties in plugin

Post by daniel »

Could you be more specific?
Daniel, CloudCompare admin
dm_red
Posts: 10
Joined: Thu Jan 26, 2017 6:48 pm

Re: Own properties in plugin

Post by dm_red »

daniel wrote:Could you be more specific?
I try to add object to database in my plugin, for example

Code: Select all

ccHObject *group = new ccHObject("GroupName");
m_app->addToDB(group);
m_app->refreshAll();
In CloudCompare i see empty group with properties:

-Name GroupName
-Show name
-Info Object ID:...
-Current Display 3D View 1

My question is:
How can i create object of db with its own properties, for example

-Filename filename.txt
-Dir /usr/lib
-Special_field special_information
daniel
Site Admin
Posts: 7717
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: Own properties in plugin

Post by daniel »

Hum, I don't think it's possible right now as everything is managed in ccPropertiesTreeDelegate which is a component of the CloudCompare project (and it's not aware of the plugins).

The only thing you can do is add these pieces of information as 'meta-data' (in which case they will appear at the end of the properties list, with one row per meta-data).
Daniel, CloudCompare admin
dm_red
Posts: 10
Joined: Thu Jan 26, 2017 6:48 pm

Re: Own properties in plugin

Post by dm_red »

daniel wrote:Hum, I don't think it's possible right now as everything is managed in ccPropertiesTreeDelegate which is a component of the CloudCompare project (and it's not aware of the plugins).

The only thing you can do is add these pieces of information as 'meta-data' (in which case they will appear at the end of the properties list, with one row per meta-data).
Daniel, thank you for your answer.
Must i use setMetaData(QString key, QVariant data)?
For example:

Code: Select all

ccHObject *group = new ccHObject("GroupName");
group->setMetaData("Filename", "text.txt" );
m_app->addToDB(group);
m_app->refreshAll();
But this method does not append new field to properties of CC object.
daniel
Site Admin
Posts: 7717
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: Own properties in plugin

Post by daniel »

Ah! It's because it's only displayed for point clouds, meshes, facets, polylines and sensors for now ;)

I can extend it to groups if you wish?
Daniel, CloudCompare admin
dm_red
Posts: 10
Joined: Thu Jan 26, 2017 6:48 pm

Re: Own properties in plugin

Post by dm_red »

daniel wrote:Ah! It's because it's only displayed for point clouds, meshes, facets, polylines and sensors for now ;)

I can extend it to groups if you wish?
It would be great to extend it with custom Object(ccCustomHObject). So there won't be fields required by object type(like width, height etc in image) , only from setmetadata.
daniel
Site Admin
Posts: 7717
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: Own properties in plugin

Post by daniel »

Okay, to make things simpler, all objects meta-data are now displayed, whatever the object. The github repo has been updated.
Daniel, CloudCompare admin
dm_red
Posts: 10
Joined: Thu Jan 26, 2017 6:48 pm

Re: Own properties in plugin

Post by dm_red »

Daniel, thank you for your answers!
roadliu
Posts: 1
Joined: Fri Jul 03, 2015 1:34 am

Re: Own properties in plugin

Post by roadliu »

Is it possible now to show metadata of a ccCustomHObject?
I found a workaround like this,

CC_CLASS_ENUM ccTestObj::getClassID() const
{
auto id = ccHObject::getClassID();
id |= CC_TYPES::SENSOR;
return id;
}

but my ccTestObj is not a SENSOR, so is there any other way to do that?
Post Reply