Setting Fluid Obstacle Slip Type?

Hi All,

I am trying to add a fluid modifier to an object and set the slip type via python code.
For some reason I keep getting object has no attribute slip_type.

Here is the code I am using (on the default cube)…


import bpy

ob = bpy.data.objects.get("Cube")
if ob != None:
    mod_name = "rs_obstacle"
    md = ob.modifiers.new(mod_name, 'FLUID_SIMULATION')
    if md != None:
        s = md.settings
        print(dir(s))
        if s != None:
            s.type = 'OBSTACLE'
            s.slip_type = 'NOSLIP'

Why can’t I set the slip type? The API docs claims the attribute exists, but it doesn’t. Using 2.67b.

Maybe it is not being updated? It works when I tried it like this:

import bpy

ob = bpy.data.objects.get("Cube")
if ob != None:
    mod_name = "rs_obstacle"
    md = ob.modifiers.new(mod_name, 'FLUID_SIMULATION')
    if md != None:
        s = md.settings
        print(dir(s))
        if s != None:
            s.type = 'OBSTACLE'
            ob.modifiers[mod_name].settings.slip_type = 'NOSLIP'

Thanks for the info, the direct pathing method does work. Now I just have to guarantee the name stays the same.


import bpy

ob = bpy.data.objects.get("Cube")
if ob != None:
    mod_name = "rs_obstacle"
    md = ob.modifiers.new(mod_name, 'FLUID_SIMULATION')
    if md != None:
        # Names can be changed by new(), so fetch again.
        mod_name = md.name
        ob.modifiers[mod_name].settings.type = 'OBSTACLE'
        ob.modifiers[mod_name].settings.slip_type = 'NOSLIP'