feat: hide non-texture OFX params from node graph + host coordinate standardization

Hide non-texture OFX params from node graph
  --------------------------------------------
  OFX plugins like ColorCorrect expose dozens of scalar parameters as
  node inputs, making nodes extremely tall and pushing Source/Mask far
  down. Previously attempted via kInputFlagHidden, but that also hid
  them from the parameter panel.

  Fix: move the filter to NodeViewItem::IsInputValid() instead.
  For OFX plugin nodes (getPluginInstance() != nullptr), only
  kTexture inputs are rendered as ports. Scalar parameters remain
  fully visible in the parameter panel.

  Files: app/widget/nodeview/nodeviewitem.cpp
         app/node/plugins/Plugin.cpp

  Standardize OFX host coordinate system
  --------------------------------------
  Olive's OFX host had partial and inconsistent coordinate handling.

  1. Fix Project coordinate methods
     - getProjectSize() / getProjectExtent() / getProjectOffset()
       now multiply X by pixel_aspect_ratio(), returning canonical
       coordinates per the OFX spec.

  2. Fix Clip default RoD
     - OliveClipInstance::getRegionOfDefinition() default now returns
       {0, 0, width*PAR, height} instead of raw pixel coords.

  3. Add parameter coordinate system conversion
     - DoubleInstance / Double2DInstance / Double3DInstance now check
       _descriptor.getDefaultCoordinateSystem().
     - For kOfxParamCoordinatesNormalised:
         get: internal pixel value -> normalised (divide by extent)
         set: normalised plugin value -> pixel (multiply by extent)
     - DefaultValueForParam() also converts normalised defaults to
       canonical before storing in Node, keeping Olive internal/UI
       values consistently in pixel space.

  Files: app/pluginSupport/OlivePluginInstance.cpp
         app/pluginSupport/OliveClip.cpp
         app/pluginSupport/paraminstance.h
         app/node/plugins/Plugin.cpp
This commit is contained in:
2026-05-14 21:54:18 +08:00
parent e012f16083
commit 4aa4d59770
5 changed files with 171 additions and 18 deletions
+35 -1
View File
@@ -21,6 +21,7 @@
#include "render/rendermanager.h"
#include "render/job/pluginjob.h"
#include "pluginSupport/OlivePluginInstance.h"
#include "common/Current.h"
#include <algorithm>
#include <cstring>
@@ -34,6 +35,24 @@
namespace {
QHash<QString, QHash<QString, QVariant>> g_plugin_param_defaults;
static bool IsNormalisedCoordSystem(const OFX::Host::Param::Base *param)
{
return param->getDefaultCoordinateSystem() ==
kOfxParamCoordinatesNormalised;
}
static void GetProjectExtent(double &xSize, double &ySize)
{
auto &vp = Current::getInstance().currentVideoParams();
xSize = vp.width() * vp.pixel_aspect_ratio().toDouble();
ySize = vp.height();
}
static double ToCanonical(double normalised, double extent)
{
return extent > 0 ? normalised * extent : normalised;
}
QVariant DefaultValueForParam(const OFX::Host::Param::Base *param)
{
if (!param) {
@@ -50,7 +69,13 @@ QVariant DefaultValueForParam(const OFX::Host::Param::Base *param)
return props.getIntProperty(kOfxParamPropDefault) != 0;
}
if (ofxType == kOfxParamTypeDouble) {
return props.getDoubleProperty(kOfxParamPropDefault);
double val = props.getDoubleProperty(kOfxParamPropDefault);
if (IsNormalisedCoordSystem(param)) {
double xSize, ySize;
GetProjectExtent(xSize, ySize);
val = ToCanonical(val, xSize);
}
return val;
}
if (ofxType == kOfxParamTypeString ||
ofxType == kOfxParamTypeStrChoice ||
@@ -81,6 +106,15 @@ QVariant DefaultValueForParam(const OFX::Host::Param::Base *param)
if (is_double) {
double values[3] = {0.0, 0.0, 0.0};
props.getDoublePropertyN(kOfxParamPropDefault, values, count);
if (IsNormalisedCoordSystem(param)) {
double xSize, ySize;
GetProjectExtent(xSize, ySize);
values[0] = ToCanonical(values[0], xSize);
values[1] = ToCanonical(values[1], ySize);
if (count == 3) {
values[2] = ToCanonical(values[2], xSize);
}
}
if (count == 2) {
return QVector2D(values[0], values[1]);
}