Page 1 of 1

add a new command line

Posted: Fri Nov 05, 2021 1:46 pm
by Tyyrem
Hey Daniel !
I'm trying to automatize a method to filter colors on a cloud, I saw we can do it through a conversion rgb to sf, and then filter the sf. However, it seems that the command RGB_CONVERT_TO_SF has not been created yet.

I have basic programming skills, so maybe I would be able to add it if you gave me some indications, or an example of how you added the command SF_CONVERT_TO_RGB, I could copy it a little ;)

Thanks a lot !

Re: add a new command line

Posted: Sat Nov 06, 2021 8:12 am
by daniel
Ah, indeed it should be relatively easy to add.

The main 'command line' class is ccCommandLineCommands (.h/.cpp). You can for instance look at 'CommandSFConvertToRGB' and 'CommandConvertNormalsToSFs'.

The first one will help you see how colors are handled, and the second one will help you mimic a command line option that converts something (here, normals) to 3 scalar fields.

To simplify your work, I added an intermediary ccEntityAction::sfFromColor method that takes 5 booleans as input parameters: exportR, exportG, exportB, exportAlpha, and exportComposite (see the latest code on the master branch).

Hopefully the rest shouldn't be too hard.

Re: add a new command line

Posted: Sat Nov 06, 2021 8:14 am
by daniel
And once you'll have created your own 'CommandConvertRFBToSFs' sub-class or something equivalent, don't forget to 'register' it in the ccCommandLineParser::registerBuiltInCommands() method. That should be all.

Re: add a new command line

Posted: Sat Nov 06, 2021 5:09 pm
by Tyyrem
Ok thanks ! I'll try to do it then ;)