F12 offline Freestyle rendering support in Eevee
This patch adds F12 offline Freestyle rendering support to Eevee. Most functionalities are identical with those found in Cycles. The only major difference is that the per-view layer "use Freestyle" toggle option is currently placed in the "Passes" panel of the "View Layers" properties window instead of a "Layer" panel as in Cycles. Since Freestyle is a post-processed overlay and not a pass, the present option location is a compromise. To describe this fact, the per-layer "use Freestyle" option is in a subsection labeled as "Layer". Reviewers: fclem, brecht, campbellbarton Reviewed By: fclem, brecht Subscribers: dfelinto Differential Revision: https://developer.blender.org/D3084
This commit is contained in:
parent
e24906759f
commit
8a7c0abc2d
Notes:
blender-bot
2023-02-13 12:00:33 +01:00
Referenced by commit 24f759ba5a
, Revert "F12 offline Freestyle rendering support in Eevee"
|
@ -39,7 +39,7 @@ class RenderFreestyleButtonsPanel:
|
|||
class RENDER_PT_freestyle(RenderFreestyleButtonsPanel, Panel):
|
||||
bl_label = "Freestyle"
|
||||
bl_options = {'DEFAULT_CLOSED'}
|
||||
COMPAT_ENGINES = {'BLENDER_RENDER'}
|
||||
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE'}
|
||||
|
||||
def draw_header(self, context):
|
||||
rd = context.scene.render
|
||||
|
@ -111,7 +111,7 @@ class RENDER_MT_lineset_specials(Menu):
|
|||
|
||||
class VIEWLAYER_PT_freestyle(ViewLayerFreestyleButtonsPanel, Panel):
|
||||
bl_label = "Freestyle"
|
||||
COMPAT_ENGINES = {'BLENDER_RENDER'}
|
||||
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE'}
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
@ -167,7 +167,7 @@ class VIEWLAYER_PT_freestyle(ViewLayerFreestyleButtonsPanel, Panel):
|
|||
|
||||
class VIEWLAYER_PT_freestyle_lineset(ViewLayerFreestyleEditorButtonsPanel, Panel):
|
||||
bl_label = "Freestyle Line Set"
|
||||
COMPAT_ENGINES = {'BLENDER_RENDER'}
|
||||
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE'}
|
||||
|
||||
def draw_edge_type_buttons(self, box, lineset, edge_type):
|
||||
# property names
|
||||
|
@ -262,7 +262,7 @@ class VIEWLAYER_PT_freestyle_lineset(ViewLayerFreestyleEditorButtonsPanel, Panel
|
|||
class VIEWLAYER_PT_freestyle_linestyle(ViewLayerFreestyleEditorButtonsPanel, Panel):
|
||||
bl_label = "Freestyle Line Style"
|
||||
bl_options = {'DEFAULT_CLOSED'}
|
||||
COMPAT_ENGINES = {'BLENDER_RENDER'}
|
||||
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE'}
|
||||
|
||||
def draw_modifier_box_header(self, box, modifier):
|
||||
row = box.row()
|
||||
|
@ -819,7 +819,7 @@ class MaterialFreestyleButtonsPanel:
|
|||
class MATERIAL_PT_freestyle_line(MaterialFreestyleButtonsPanel, Panel):
|
||||
bl_label = "Freestyle Line"
|
||||
bl_options = {'DEFAULT_CLOSED'}
|
||||
COMPAT_ENGINES = {'BLENDER_RENDER'}
|
||||
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE'}
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
|
|
@ -457,6 +457,7 @@ class VIEWLAYER_PT_eevee_layer_passes(ViewLayerButtonsPanel, Panel):
|
|||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
with_freestyle = bpy.app.build_options.freestyle
|
||||
|
||||
scene = context.scene
|
||||
rd = scene.render
|
||||
|
@ -477,6 +478,12 @@ class VIEWLAYER_PT_eevee_layer_passes(ViewLayerButtonsPanel, Panel):
|
|||
row = col.row(align=True)
|
||||
row.prop(view_layer, "use_pass_subsurface_direct", text="Direct", toggle=True)
|
||||
row.prop(view_layer, "use_pass_subsurface_color", text="Color", toggle=True)
|
||||
if with_freestyle:
|
||||
col.separator()
|
||||
col.label(text="Layer:")
|
||||
row = col.row()
|
||||
row.prop(view_layer, "use_freestyle", "Use Freestyle")
|
||||
row.active = rd.use_freestyle
|
||||
|
||||
|
||||
classes = (
|
||||
|
|
|
@ -53,6 +53,7 @@ extern "C" {
|
|||
#include "BKE_node.h"
|
||||
#include "BKE_object.h"
|
||||
#include "BKE_scene.h"
|
||||
#include "BKE_world.h"
|
||||
|
||||
#include "BLI_ghash.h"
|
||||
#include "BLI_listbase.h"
|
||||
|
@ -91,6 +92,7 @@ BlenderStrokeRenderer::BlenderStrokeRenderer(Render *re, int render_count) : Str
|
|||
freestyle_scene->r.cfra = old_scene->r.cfra;
|
||||
freestyle_scene->r.mode = old_scene->r.mode &
|
||||
~(R_EDGE_FRS | R_SHADOW | R_SSS | R_PANORAMA | R_ENVMAP | R_MBLUR | R_BORDER);
|
||||
freestyle_scene->r.alphamode = R_ALPHAPREMUL;
|
||||
freestyle_scene->r.xsch = re->rectx; // old_scene->r.xsch
|
||||
freestyle_scene->r.ysch = re->recty; // old_scene->r.ysch
|
||||
freestyle_scene->r.xasp = 1.0f; // old_scene->r.xasp;
|
||||
|
@ -167,6 +169,13 @@ BlenderStrokeRenderer::BlenderStrokeRenderer(Render *re, int render_count) : Str
|
|||
|
||||
freestyle_scene->camera = object_camera;
|
||||
|
||||
// World
|
||||
World *world = BKE_world_add(freestyle_bmain, "FRSWorld");
|
||||
DEG_graph_id_tag_update(freestyle_bmain, freestyle_depsgraph, &world->id, 0);
|
||||
world->horr = world->horg = world->horb = 0.0f;
|
||||
world->zenr = world->zeng = world->zenb = 0.0f;
|
||||
freestyle_scene->world = world;
|
||||
|
||||
// Reset serial mesh ID (used for BlenderStrokeRenderer::NewMesh())
|
||||
_mesh_id = 0xffffffff;
|
||||
|
||||
|
|
Loading…
Reference in New Issue