Page MenuHome

'use_freestyle' reports freestyle is off during viewport render
Closed, InvalidPublic

Description

System Information
Windows 10 64-bit, Graphics cards: GTX 570, GT 610 (display).

Blender Version
Broken: 7b29e91 (latest Windows 64-bit build)
Worked: -

Short description of error

I am trying to test if freestyle is on or off from a frame_change_post handler so my code is not run when rendering in the viewport in Blender Render while Freestyle is enabled (related to my add-on mentiond here: T53801)

When use_freestyle is printed from a frame_change_post handler it will print the correct value (ie. use_freestyle will return True) if the viewport isn't set to 'Rendered' mode. When changing to 'Rendered' viewport shading mode the frame handler will trigger (though I don't know why it is triggering) and report that freestyle is not running (ie. use_freestyle will return False).

This only happens when 'Blender Render' is the render engine. This doesn't happen in Cycles (nor is the frame handler even triggered when changing to 'Rendered' shading) and doesn't happen when there are no objects in the scene.

Exact steps for others to reproduce the error

  1. Open the attached file.
  2. Run the script in the attached file in the text editor.
  3. Change frame and look in the System Console. "Using freestyle!" will be printed.
  4. Change to 'Rendered' viewport shading mode.
  5. "Not Using freestyle!" will have been printed (even though the frame hasn't changed).
  6. Change frames and both 'using' and 'not using' messages will be displayed.

Details

Type
Bug

Event Timeline

Brecht Van Lommel (brecht) claimed this task.

Freestyle creates a new scene to render lines, which is not the same as the existing scene. In general Blender can have multiple scenes active at the same time.

From what I can tell, the main issue in your script is that it sets the frame from the frame change handler. If you explicitly prevent that, then I don't think you need to track if the scene is rendering or using freestyle.