0
$\begingroup$

I've found the following script from this question

    area = next(area for area in bpy.context.screen.areas if area.type == 'VIEW_3D')
    space = next(space for space in area.spaces if space.type == 'VIEW_3D')
    space.viewport_shade = 'RENDERED'  # set the viewport shading

I'm looking to use it in a Blend file that I have designed for colleagues of mine who are not proficient in 3d to load up and render a logo design that they have saved as a texture.

Currently I've got a panel with a bunch of colour options for them to adjust set in the Tool Shelf of the 3D window, there's also a nice big Render button.

The above code is now set into that script and means that when my colleagues open the file it automatically starts Cycles so that they can see the design, see below:

Screen Layout

However I want it to default to Material, to avoid any problems with GPU crashes, and then have a couple of buttons in the panel to jump between the 2 options.

I'm guessing it's going to require some if statements but I've never done this in Python before, I'm a PHP programmer normally so understand the concept.

Any help would be gratefully appreciated.

$\endgroup$
  • $\begingroup$ The scene looks like it could be handled just fine by EEVEE (Blender 2.8). Have you checked already? $\endgroup$ – John Dvorak Jan 9 at 15:01
  • $\begingroup$ It will work in EEVEE but for now I want to stick to the Official Build. $\endgroup$ – Tom Jelfs Jan 9 at 15:10
  • $\begingroup$ The beta build is as official as the stable release ;-) $\endgroup$ – John Dvorak Jan 9 at 15:17
  • $\begingroup$ Yes I know that, but you know what I mean. Plus this scripting didn't play nice when I just tried it in Beta. $\endgroup$ – Tom Jelfs Jan 9 at 15:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.