Commit 0ed0a6bb authored by Christian Schulte zu Berge's avatar Christian Schulte zu Berge Committed by Artur Grunau
Browse files

Lua scripting: add a wrapper for FloatProperty

To make it possible to access GlImageResampler's p_resampleScale
property from Lua, FloatProperty and the classes it depends on have been
wrapped using SWIG.

References #1
parent 818c79cc
......@@ -5,6 +5,7 @@
%{
#include "core/properties/genericproperty.h"
#include "core/properties/numericproperty.h"
#include "core/properties/floatingpointproperty.h"
#include "core/properties/datanameproperty.h"
#include "core/properties/transferfunctionproperty.h"
#include "core/pipeline/abstractprocessor.h"
......@@ -71,7 +72,7 @@ namespace campvis {
};
template<typename T>
class NumericProperty {
class NumericProperty : public GenericProperty<T> {
public:
NumericProperty(
const std::string& name,
......@@ -85,9 +86,44 @@ namespace campvis {
virtual ~NumericProperty();
};
%template(Ivec2GenericProperty) GenericProperty< tgt::Vector2<int> >;
%template(IVec2Property) NumericProperty< tgt::Vector2<int> >;
typedef NumericProperty< tgt::Vector2<int> > IVec2Property;
template<typename T>
struct FloatingPointPropertyTraits {};
template<>
struct FloatingPointPropertyTraits<float> {
typedef int DecimalsType;
};
%template() FloatingPointPropertyTraits<float>;
template<typename T>
class FloatingPointProperty : public NumericProperty<T> {
public:
typedef typename FloatingPointPropertyTraits<T>::DecimalsType DecimalsType;
FloatingPointProperty(
const std::string& name,
const std::string& title,
const T& value,
const T& minValue,
const T& maxValue,
const T& stepValue = T(0.01f),
const DecimalsType& decimals = DecimalsType(3),
int invalidationLevel = AbstractProcessor::INVALID_RESULT);
virtual ~FloatingPointProperty();
};
%template(FloatGenericProperty) GenericProperty<float>;
%template(FloatNumericProperty) NumericProperty<float>;
%template(FloatProperty) FloatingPointProperty<float>;
typedef FloatingPointProperty< float > FloatProperty;
/* AbstractProcessor */
class AbstractProcessor {
......
......@@ -17,6 +17,7 @@ namespace campvis {
%immutable;
campvis::DataNameProperty p_inputImage;
campvis::DataNameProperty p_outputImage;
campvis::FloatProperty p_resampleScale;
%mutable;
};
}
......@@ -42,6 +42,8 @@ function pipeline:init()
dvrTF:addGeometry(geometry2)
self.ve:getProperty("TransferFunction"):replaceTF(dvrTF)
self.resampler.p_resampleScale:setValue(1.25)
end
function pipeline:deinit()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment