Page 1 of 2
Own properties in plugin
Posted: Thu Jan 26, 2017 6:52 pm
by dm_red
Hello, how i can append own properties to object in my plugin?
With help m_app?
Re: Own properties in plugin
Posted: Thu Jan 26, 2017 7:49 pm
by daniel
Could you be more specific?
Re: Own properties in plugin
Posted: Fri Jan 27, 2017 7:18 am
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
Re: Own properties in plugin
Posted: Fri Jan 27, 2017 8:09 am
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).
Re: Own properties in plugin
Posted: Fri Jan 27, 2017 8:38 am
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.
Re: Own properties in plugin
Posted: Fri Jan 27, 2017 8:55 am
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?
Re: Own properties in plugin
Posted: Fri Jan 27, 2017 9:13 am
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.
Re: Own properties in plugin
Posted: Fri Jan 27, 2017 9:35 am
by daniel
Okay, to make things simpler, all objects meta-data are now displayed, whatever the object. The github repo has been updated.
Re: Own properties in plugin
Posted: Fri Jan 27, 2017 10:23 am
by dm_red
Daniel, thank you for your answers!
Re: Own properties in plugin
Posted: Fri Mar 24, 2017 7:50 am
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?