Wave height at will

(sam67) #1

hi, I’ve a question regarding the Blender 2.46 API. It’s about the Python command line to amend a modifier Wave Height value.
The Python scripting help on https://docs.blender.org/api/246PythonDoc/Modifier-module.html shows how to change a subsurf LEVELS value but I failed to do the same for Wave Height.

In fact I want to decrease my wave height along with the frame going.

Is a Blender guru passing by on his cloud ?

I scarcely forget the magic formula.


(Osares) #2

Couldn’t run 2.46 straight out of the box but this worked on 2.49b:

from Blender import *

ob = Object.Get('Cube')        # retrieve an object
mods = ob.modifiers            # get the object's modifiers
mod = mods.append(Modifier.Types.WAVE) # add a new subsurf modifier
mod[Modifier.Settings.HEIGHT] = 1.5     # set wave height

Window.RedrawAll() # View the change	

You have information of the available variables on the page you linked (under the headline Variables Details). Hope it helps (even though you probably solved it already!), always a bit of fun exploring older blender versions but i need to learn the 2.8 interface! not 2.4x :smiley:

If you ever venture into 2.79 this should work:

ob = bpy.data.objects['Cube']        # retrieve an object
mods = ob.modifiers            # get the object's modifiers
mod = mods.new('HelloWorld', 'WAVE') # add a new wave modifier
mod.height = 2

(sam67) #3

Yes, I ended up with this too but I want Something else.

This code :
Adds a new Wave THEN sets the height right after

What I want is easier yet I couldn’t find the command line:
I Don’t want to add a Wave since there are already Waves mod in the scene. 2 Waves.
I want to dynamically change the Height of one of the Waves mod.

for i=0 to 100

It seems far more complicared to do but I’m sure it’s feasible.

Thanks, you made the whole thing forward