X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=synfig-core%2Ftrunk%2Fsrc%2Fmodules%2Fmod_noise%2Fvaluenode_random.cpp;h=a4436fd3209b493d7d512c1f260050b9441fca7a;hb=3ddc1c12f966668a0835427890c97645b77935fb;hp=04881898dbdf3e3263cc6c97464818447dee3001;hpb=756c0d29ac1742f231e6615f9a577e574e35a4af;p=synfig.git diff --git a/synfig-core/trunk/src/modules/mod_noise/valuenode_random.cpp b/synfig-core/trunk/src/modules/mod_noise/valuenode_random.cpp index 0488189..a4436fd 100644 --- a/synfig-core/trunk/src/modules/mod_noise/valuenode_random.cpp +++ b/synfig-core/trunk/src/modules/mod_noise/valuenode_random.cpp @@ -60,13 +60,16 @@ ValueNode_Random::ValueNode_Random(const ValueBase &value): set_link("radius",ValueNode_Const::create(Real(1))); set_link("seed",ValueNode_Const::create(random.get_seed())); set_link("speed",ValueNode_Const::create(Real(1))); - set_link("smooth",ValueNode_Const::create(int(Random::SMOOTH_CUBIC))); + set_link("smooth",ValueNode_Const::create(int(RandomNoise::SMOOTH_CUBIC))); switch(get_type()) { case ValueBase::TYPE_ANGLE: set_link("link",ValueNode_Const::create(value.get(Angle()))); break; + case ValueBase::TYPE_BOOL: + set_link("link",ValueNode_Const::create(value.get(bool()))); + break; case ValueBase::TYPE_COLOR: set_link("link",ValueNode_Const::create(value.get(Color()))); break; @@ -109,7 +112,7 @@ ValueNode_Random::~ValueNode_Random() ValueBase ValueNode_Random::operator()(Time t)const { - typedef const Random::SmoothType Smooth; + typedef const RandomNoise::SmoothType Smooth; Real radius = (*radius_)(t).get(Real()); int seed = (*seed_)(t).get(int()); @@ -124,6 +127,10 @@ ValueNode_Random::operator()(Time t)const return ((*link_)(t).get( Angle()) + Angle::deg(random(Smooth(smooth), 0, 0, 0, speed) * radius)); + case ValueBase::TYPE_BOOL: + return round_to_int((*link_)(t).get( bool()) + + random(Smooth(smooth), 0, 0, 0, speed) * radius) > 0; + case ValueBase::TYPE_COLOR: return (((*link_)(t).get( Color()) + Color(random(Smooth(smooth), 0, 0, 0, speed), @@ -258,6 +265,7 @@ ValueNode_Random::check_type(ValueBase::Type type) { return type==ValueBase::TYPE_ANGLE || + type==ValueBase::TYPE_BOOL || type==ValueBase::TYPE_COLOR || type==ValueBase::TYPE_INTEGER || type==ValueBase::TYPE_REAL ||