Enable mist from Python?

Is it possible to turn on the world mist feature from a python script? I know there is the setMist function in the world object, but simply setting these parameters does not enable mist when rendering the scene. I would prefer to be able to do this from a script and not have to manually turn it on in Blender.

You know, you guys are really unhelpful. I ask a good question and nobody even bothers to view it. I’m tired of this worthless forum. I’m not posting anymore questions, and others shouldn’t either if they care about getting a response.

So you waited less than a day and no response. Big deal. I’ve waited a week or more sometimes. But look at the bright side, now that you’ve left this so called worthless forum you’ll have more time to work on your anger problem. lol.


dude give people a chance this is a world wide forum and we all have real lives, when one of the python wiz’s reads it i’m sure they will answer you.

im have no idea about python, so unfortunately i cant help you.

Oh, what do we have here?


They don’t answer my actual question, but the little sh1ts come lightning fast when something bad is said about them. Good job, hypocrites, you are quite good at protecting your image, but in reality you don’t know sh1t about anything.

Are we talking scripting in 2.54 or 2.49c?

In 2.54 use

import bpy

for world in bpy.data.worlds:
    world.mist_settings.use_mist = True
    world.mist_settings.intensity = 0.6

By default intensity seems to be 0 so you would not see the effect. From the functions you quote in your post you are using 2.49c so the above script will not work. Maybe you need to turn up the intensity there though too? I’ve given up on the 2.49c api since the new one is soooooo much better so I can’t answer your question for that API.

I was going to ignore this thread because of the impending flame war, but have decided to try and answer the question in order to head off another trashed thread. Please be patient. Blender users are global in scope so you should wait at least a day so all time zones are covered. Even then the people with the time and knowledge to answer might not have seen your thread.

This is a helpful and friendly community. Hope you enjoy spending time here and using Blender. :slight_smile:

I suggest you adjust your attitude. Sometimes answers don’t come quickly. No one here is being paid to help you, so don’t you think it’s rather petty to berate people over what you view the ideal service to be?
Also, in all likelihood people did view your thread. There is a bug in the view counter system that causes all pageviews to be displayed as (# of replies)+1 for some reason. It is not that no one looked at your thread, it’s just that no one knew the answer. Please be more patient.


It’s in 2.49. I already found the solution since I had to go out on my own instead of getting help from people that already did this stuff and would have only taken them 1 minute to answer. Inconsiderate ingrates.

w = Blender.World.New('W')
w.mistype = 2
w.setMist([0.5, 0, 20, 5])
w.mode = 1

Banned for two weeks.

Can’t fault that. Lock thread?