[Bf-python] Noise Module Proposal

Campbell Barton ideasman42 at gmail.com
Fri Nov 25 05:12:59 CET 2011


On Fri, Nov 25, 2011 at 2:56 PM, Campbell Barton <ideasman42 at gmail.com> wrote:
> On Fri, Nov 25, 2011 at 2:42 PM, Andrew Hale <trumanblending at gmail.com> wrote:
>> Hello,
>>
>> It seems that the current noise module has become rather outdated with
>> respect to the current API. As such I propose to update it to bring it into
>> line with rest of the API. The changes I propose are listed below;
>>
>> Move the module so it becomes a submodule of mathutils, i.e.
>> mathutils.noise. This will make the module more visible and more useful as
>> we can return mathutils types like Vectors.
>> Change input arguments from (x, y, z) tuples to Vector objects.
>> Change function outputs from (x, y, z) tuples to Vector objects.
>> Fix noise.random_unit_vector(), current the y and z components are
>> correlated (bad).
>> Add noise.random_vector() to produce a random vector (non-unit length)
>> Add other functions (Feel free to reply with ideas)
>>
>> I have discussed this with ideasman_42 on IRC and he seemed in agreement. If
>> you have any thoughts please reply.
>>
>> Thanks,
>>
>> Andrew
>
> +1,
>
> - we could keep the 'noise' module available to be imported directly
> for a release but deprecate it (even print some warning on importing).
>
> - probably nice to keep 'noise' being available from the driver
> namespace even when its moved to mathutils.noise
>

Thinking about this further, noise is available from driver namespace,
which makes doing things like...

noise.somefunc(Vector((a,b,c)))
... cumbersome.

So noise funcs could use the C utility function mathutils_array_parse(...)

This way noise.somefunc(a, b, c) can be supported too.

-- 
- Campbell



More information about the Bf-python mailing list