Hey David,
Glad to see your first experiments with PixInsight/PCL development
Your new ShadowsPctClipping parameter has several problems:
1. You have declared it as a single parameter, that is, your declaration (HistogramTransformationInstance.h #110) is:
double cp0;
This means that this is not a per-channel parameter. Compare it for example with (HistogramTransformationInstance.h #107):
double m[ 5 ];
which is the declaration that corresponds to the midtones balance parameter. There is an individual midtones balance for each supported channel (R, G, B, RGB/K, Alpha).
However, you declare your parameter as a child of a MetaTable (HistogramTransformationParameters.cpp #213):
ShadowsPctClipping::ShadowsPctClipping( MetaTable* T ) : MetaDouble( T )
with a corresponding declaration in HistogramTransformationParameters.h #141:
ShadowsPctClipping( MetaTable* );
and an instantiation of this parameter as a child of TheHistogramTransformationTableParameter (HistogramTransformationProcess.cpp #43):
new ShadowsPctClipping( TheHistogramTransformationTableParameter );
Here is part of the problem: your parameter should be either a child of TheHistogramTransformationProcess (which involves MetaProcess* instead of MetaTable*), or you should declare it as:
double cp0[ 5 ];
and manage it consequently, in case it is intended to be a per-channel parameter.
--
2. You have not provided a way for the core PixInsight application to communicate with your HueHistogramTransformation in order to read/write the new cp0 parameter. Just try the following to see how this works:
- Apply an instance of your HueHistogramTransformation to any image.
- Right click on the image and select LoadHistoryExplorer
- Click on the HueHistogramTransformation item on the History Explorer to generate a script
- You get an error because the core application is unable to lock the cp0 parameter.
You must add the following to the HistogramTransformationInstance::LockParameter member function:
if ( p == TheShadowsPctClippingParameter )
return cp0+tableRow;
if the cp0 parameter is a per-channel parameter (and hence it is declared as double[ 5 ]), or:
if ( p == TheShadowsPctClippingParameter )
return &cp0;
if it is a single parameter. In this way the core application will be able to read and write your parameter. This is indispensable for every public parameter of any process in PixInsight.
--
As a side note, if you declare a parameter as a child of a table, that is, when a parameter is a
table column, it doesn't appear on the property tree of Script Editor. This is because table parameters are aggregate objects that "hide" the names of their column (or child) parameters. However, you can see the names of all table columns as comments on automatically generated scripts. For example:
var p = new CurvesTransformation;
with ( p )
{
R = // x, y
[
[0.00000, 0.00000],
[1.00000, 1.00000]];
Rt = AkimaSubsplines;
// ...
In the above script, the x and y parameters are columns of R, which is a MetaTable (you can verify this in the source code of CurvesTransformation). You cannot see x and y on the JavaScript property tree, however, they are there
Hope this clarifies a little. Very good try anyway - looking forward to see it working!
P.S.: I think anybody with sufficient programming knowledge as to understand this stuff should be able also to read this in English, so I'll save the (huge!) effort of translating it into Spanish... do you agree?