Workbench: Remove old implementation

This commit is contained in:
Miguel Pozo 2023-09-04 17:42:04 +02:00
parent bf8d3c157a
commit 2aa7961e6f
74 changed files with 318 additions and 5681 deletions

View File

@ -238,7 +238,7 @@ class DATA_PT_motion_paths_display(MotionPathButtonsPanel_display, Panel):
class DATA_PT_custom_props_arm(ArmatureButtonsPanel, PropertyPanel, Panel):
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH', 'BLENDER_WORKBENCH_NEXT'}
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH'}
_context_path = "object.data"
_property_type = bpy.types.Armature

View File

@ -486,8 +486,7 @@ class BONE_PT_custom_props(BoneButtonsPanel, PropertyPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
_property_type = bpy.types.Bone, bpy.types.EditBone, bpy.types.PoseBone
@property

View File

@ -29,8 +29,7 @@ class CAMERA_PT_presets(PresetPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
class CAMERA_PT_safe_areas_presets(PresetPanel, Panel):
@ -42,8 +41,7 @@ class CAMERA_PT_safe_areas_presets(PresetPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
class DATA_PT_context_camera(CameraButtonsPanel, Panel):
@ -53,8 +51,7 @@ class DATA_PT_context_camera(CameraButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
def draw(self, context):
layout = self.layout
@ -76,8 +73,7 @@ class DATA_PT_lens(CameraButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
def draw(self, context):
layout = self.layout
@ -124,7 +120,7 @@ class DATA_PT_lens(CameraButtonsPanel, Panel):
col.prop(cam, "fisheye_polynomial_k3", text="K3")
col.prop(cam, "fisheye_polynomial_k4", text="K4")
elif engine in {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_EEVEE_NEXT', 'BLENDER_WORKBENCH', 'BLENDER_WORKBENCH_NEXT'}:
elif engine in {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_EEVEE_NEXT', 'BLENDER_WORKBENCH'}:
if cam.lens_unit == 'MILLIMETERS':
col.prop(cam, "lens")
elif cam.lens_unit == 'FOV':
@ -150,8 +146,7 @@ class DATA_PT_camera_stereoscopy(CameraButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
@classmethod
def poll(cls, context):
@ -204,8 +199,7 @@ class DATA_PT_camera(CameraButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
def draw_header_preset(self, _context):
CAMERA_PT_presets.draw_panel_header(self.layout)
@ -235,7 +229,7 @@ class DATA_PT_camera(CameraButtonsPanel, Panel):
class DATA_PT_camera_dof(CameraButtonsPanel, Panel):
bl_label = "Depth of Field"
bl_options = {'DEFAULT_CLOSED'}
COMPAT_ENGINES = {'BLENDER_EEVEE', 'BLENDER_EEVEE_NEXT', 'BLENDER_WORKBENCH', 'BLENDER_WORKBENCH_NEXT'}
COMPAT_ENGINES = {'BLENDER_EEVEE', 'BLENDER_EEVEE_NEXT', 'BLENDER_WORKBENCH'}
def draw_header(self, context):
cam = context.camera
@ -262,7 +256,7 @@ class DATA_PT_camera_dof(CameraButtonsPanel, Panel):
class DATA_PT_camera_dof_aperture(CameraButtonsPanel, Panel):
bl_label = "Aperture"
bl_parent_id = "DATA_PT_camera_dof"
COMPAT_ENGINES = {'BLENDER_EEVEE', 'BLENDER_EEVEE_NEXT', 'BLENDER_WORKBENCH', 'BLENDER_WORKBENCH_NEXT'}
COMPAT_ENGINES = {'BLENDER_EEVEE', 'BLENDER_EEVEE_NEXT', 'BLENDER_WORKBENCH'}
def draw(self, context):
layout = self.layout
@ -290,8 +284,7 @@ class DATA_PT_camera_background_image(CameraButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
def draw_header(self, context):
cam = context.camera
@ -402,8 +395,7 @@ class DATA_PT_camera_display(CameraButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
def draw(self, context):
layout = self.layout
@ -440,8 +432,7 @@ class DATA_PT_camera_display_composition_guides(CameraButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
def draw(self, context):
layout = self.layout
@ -472,8 +463,7 @@ class DATA_PT_camera_safe_areas(CameraButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
def draw_header(self, context):
cam = context.camera
@ -507,8 +497,7 @@ class DATA_PT_camera_safe_areas_center_cut(CameraButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
def draw_header(self, context):
cam = context.camera
@ -536,8 +525,7 @@ class DATA_PT_custom_props_camera(CameraButtonsPanel, PropertyPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
_context_path = "object.data"
_property_type = bpy.types.Camera

View File

@ -123,8 +123,7 @@ class DATA_PT_curve_texture_space(CurveButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
def draw(self, context):
layout = self.layout
@ -502,8 +501,7 @@ class DATA_PT_custom_props_curve(CurveButtonsPanel, PropertyPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
_context_path = "object.data"
_property_type = bpy.types.Curve

View File

@ -25,8 +25,7 @@ class DATA_PT_context_curves(DataButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
def draw(self, context):
layout = self.layout
@ -47,8 +46,7 @@ class DATA_PT_curves_surface(DataButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
def draw(self, context):
layout = self.layout
@ -135,8 +133,7 @@ class DATA_PT_CURVES_attributes(DataButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
def draw(self, context):
curves = context.curves
@ -165,8 +162,7 @@ class DATA_PT_custom_props_curves(DataButtonsPanel, PropertyPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
_context_path = "object.data"
_property_type = bpy.types.Curves if hasattr(bpy.types, "Curves") else None

View File

@ -71,8 +71,7 @@ class DATA_PT_custom_props_lattice(DataButtonsPanel, PropertyPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
_context_path = "object.data"
_property_type = bpy.types.Lattice

View File

@ -26,8 +26,7 @@ class DATA_PT_context_light(DataButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE_NEXT',
'BLENDER_EEVEE',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
def draw(self, context):
layout = self.layout
@ -53,7 +52,7 @@ class DATA_PT_preview(DataButtonsPanel, Panel):
class DATA_PT_light(DataButtonsPanel, Panel):
bl_label = "Light"
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_WORKBENCH', 'BLENDER_WORKBENCH_NEXT'}
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_WORKBENCH'}
def draw(self, context):
layout = self.layout
@ -244,8 +243,7 @@ class DATA_PT_spot(DataButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE_NEXT',
'BLENDER_EEVEE',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
@classmethod
def poll(cls, context):
@ -272,8 +270,7 @@ class DATA_PT_custom_props_light(DataButtonsPanel, PropertyPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE_NEXT',
'BLENDER_EEVEE',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
_context_path = "object.data"
_property_type = bpy.types.Light

View File

@ -163,7 +163,7 @@ class MeshButtonsPanel:
class DATA_PT_context_mesh(MeshButtonsPanel, Panel):
bl_label = ""
bl_options = {'HIDE_HEADER'}
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH', 'BLENDER_WORKBENCH_NEXT'}
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH'}
def draw(self, context):
layout = self.layout
@ -181,7 +181,7 @@ class DATA_PT_context_mesh(MeshButtonsPanel, Panel):
class DATA_PT_normals(MeshButtonsPanel, Panel):
bl_label = "Normals"
bl_options = {'DEFAULT_CLOSED'}
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH', 'BLENDER_WORKBENCH_NEXT'}
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH'}
def draw(self, context):
layout = self.layout
@ -203,7 +203,7 @@ class DATA_PT_normals(MeshButtonsPanel, Panel):
class DATA_PT_texture_space(MeshButtonsPanel, Panel):
bl_label = "Texture Space"
bl_options = {'DEFAULT_CLOSED'}
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH', 'BLENDER_WORKBENCH_NEXT'}
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH'}
def draw(self, context):
layout = self.layout
@ -223,7 +223,7 @@ class DATA_PT_texture_space(MeshButtonsPanel, Panel):
class DATA_PT_vertex_groups(MeshButtonsPanel, Panel):
bl_label = "Vertex Groups"
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH', 'BLENDER_WORKBENCH_NEXT'}
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH'}
@classmethod
def poll(cls, context):
@ -279,7 +279,7 @@ class DATA_PT_vertex_groups(MeshButtonsPanel, Panel):
class DATA_PT_shape_keys(MeshButtonsPanel, Panel):
bl_label = "Shape Keys"
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH', 'BLENDER_WORKBENCH_NEXT'}
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH'}
@classmethod
def poll(cls, context):
@ -376,7 +376,7 @@ class DATA_PT_shape_keys(MeshButtonsPanel, Panel):
class DATA_PT_uv_texture(MeshButtonsPanel, Panel):
bl_label = "UV Maps"
bl_options = {'DEFAULT_CLOSED'}
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH', 'BLENDER_WORKBENCH_NEXT'}
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH'}
def draw(self, context):
layout = self.layout
@ -396,7 +396,7 @@ class DATA_PT_uv_texture(MeshButtonsPanel, Panel):
class DATA_PT_remesh(MeshButtonsPanel, Panel):
bl_label = "Remesh"
bl_options = {'DEFAULT_CLOSED'}
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH', 'BLENDER_WORKBENCH_NEXT'}
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH'}
def draw(self, context):
layout = self.layout
@ -426,7 +426,7 @@ class DATA_PT_remesh(MeshButtonsPanel, Panel):
class DATA_PT_customdata(MeshButtonsPanel, Panel):
bl_label = "Geometry Data"
bl_options = {'DEFAULT_CLOSED'}
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH', 'BLENDER_WORKBENCH_NEXT'}
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH'}
def draw(self, context):
layout = self.layout
@ -446,7 +446,7 @@ class DATA_PT_customdata(MeshButtonsPanel, Panel):
class DATA_PT_custom_props_mesh(MeshButtonsPanel, PropertyPanel, Panel):
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH', 'BLENDER_WORKBENCH_NEXT'}
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH'}
_context_path = "object.data"
_property_type = bpy.types.Mesh
@ -495,7 +495,7 @@ class MESH_UL_attributes(UIList):
class DATA_PT_mesh_attributes(MeshButtonsPanel, Panel):
bl_label = "Attributes"
bl_options = {'DEFAULT_CLOSED'}
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH', 'BLENDER_WORKBENCH_NEXT'}
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH'}
def draw(self, context):
mesh = context.mesh
@ -620,7 +620,7 @@ class MESH_UL_color_attributes_selector(UIList, ColorAttributesListBase):
class DATA_PT_vertex_colors(DATA_PT_mesh_attributes, Panel):
bl_label = "Color Attributes"
bl_options = {'DEFAULT_CLOSED'}
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH', 'BLENDER_WORKBENCH_NEXT'}
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH'}
def draw(self, context):
mesh = context.mesh

View File

@ -63,8 +63,7 @@ class DATA_PT_mball_texture_space(DataButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
def draw(self, context):
layout = self.layout
@ -123,8 +122,7 @@ class DATA_PT_custom_props_metaball(DataButtonsPanel, PropertyPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
_context_path = "object.data"
_property_type = bpy.types.MetaBall

View File

@ -25,8 +25,7 @@ class DATA_PT_context_pointcloud(DataButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
def draw(self, context):
layout = self.layout
@ -109,8 +108,7 @@ class DATA_PT_pointcloud_attributes(DataButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
def draw(self, context):
pointcloud = context.pointcloud
@ -139,8 +137,7 @@ class DATA_PT_custom_props_pointcloud(DataButtonsPanel, PropertyPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
_context_path = "object.data"
_property_type = bpy.types.PointCloud if hasattr(bpy.types, "PointCloud") else None

View File

@ -25,8 +25,7 @@ class DATA_PT_context_speaker(DataButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
def draw(self, context):
layout = self.layout
@ -47,8 +46,7 @@ class DATA_PT_speaker(DataButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
def draw(self, context):
layout = self.layout
@ -74,8 +72,7 @@ class DATA_PT_distance(DataButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
def draw(self, context):
layout = self.layout
@ -103,8 +100,7 @@ class DATA_PT_cone(DataButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
def draw(self, context):
layout = self.layout
@ -130,8 +126,7 @@ class DATA_PT_custom_props_speaker(DataButtonsPanel, PropertyPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
_context_path = "object.data"
_property_type = bpy.types.Speaker

View File

@ -25,8 +25,7 @@ class DATA_PT_context_volume(DataButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
def draw(self, context):
layout = self.layout
@ -47,8 +46,7 @@ class DATA_PT_volume_file(DataButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
def draw(self, context):
layout = self.layout
@ -97,8 +95,7 @@ class DATA_PT_volume_grids(DataButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
def draw(self, context):
layout = self.layout
@ -115,8 +112,7 @@ class DATA_PT_volume_render(DataButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
def draw(self, context):
layout = self.layout
@ -152,8 +148,7 @@ class DATA_PT_volume_viewport_display(DataButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
def draw(self, context):
layout = self.layout
@ -181,8 +176,7 @@ class DATA_PT_volume_viewport_display_slicing(DataButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
def draw_header(self, context):
layout = self.layout
@ -212,8 +206,7 @@ class DATA_PT_custom_props_volume(DataButtonsPanel, PropertyPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
_context_path = "object.data"
_property_type = bpy.types.Volume

View File

@ -24,7 +24,7 @@ class RENDER_PT_freestyle(RenderFreestyleButtonsPanel, Panel):
bl_label = "Freestyle"
bl_options = {'DEFAULT_CLOSED'}
bl_order = 10
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH', 'BLENDER_WORKBENCH_NEXT'}
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH'}
def draw_header(self, context):
rd = context.scene.render
@ -82,7 +82,7 @@ class ViewLayerFreestyleEditorButtonsPanel(ViewLayerFreestyleButtonsPanel):
class ViewLayerFreestyleLineStyle(ViewLayerFreestyleEditorButtonsPanel):
# Freestyle Linestyle Panels
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH', 'BLENDER_WORKBENCH_NEXT'}
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH'}
@classmethod
def poll(cls, context):
@ -126,7 +126,7 @@ class RENDER_MT_lineset_context_menu(Menu):
class VIEWLAYER_PT_freestyle(ViewLayerFreestyleButtonsPanel, Panel):
bl_label = "Freestyle"
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH', 'BLENDER_WORKBENCH_NEXT'}
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH'}
def draw_header(self, context):
view_layer = context.view_layer
@ -156,7 +156,7 @@ class VIEWLAYER_PT_freestyle(ViewLayerFreestyleButtonsPanel, Panel):
class VIEWLAYER_PT_freestyle_edge_detection(ViewLayerFreestyleButtonsPanel, Panel):
bl_label = "Edge Detection"
bl_parent_id = "VIEWLAYER_PT_freestyle"
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH', 'BLENDER_WORKBENCH_NEXT'}
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH'}
def draw(self, context):
layout = self.layout
@ -186,7 +186,7 @@ class VIEWLAYER_PT_freestyle_edge_detection(ViewLayerFreestyleButtonsPanel, Pane
class VIEWLAYER_PT_freestyle_style_modules(ViewLayerFreestyleButtonsPanel, Panel):
bl_label = "Style Modules"
bl_parent_id = "VIEWLAYER_PT_freestyle"
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH', 'BLENDER_WORKBENCH_NEXT'}
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH'}
@classmethod
def poll(cls, context):
@ -222,7 +222,7 @@ class VIEWLAYER_PT_freestyle_style_modules(ViewLayerFreestyleButtonsPanel, Panel
class VIEWLAYER_PT_freestyle_lineset(ViewLayerFreestyleEditorButtonsPanel, Panel):
bl_label = "Freestyle Line Set"
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH', 'BLENDER_WORKBENCH_NEXT'}
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH'}
def draw_edge_type_buttons(self, box, lineset, edge_type):
# property names
@ -285,7 +285,7 @@ class VIEWLAYER_PT_freestyle_lineset(ViewLayerFreestyleEditorButtonsPanel, Panel
class VIEWLAYER_PT_freestyle_lineset_visibilty(ViewLayerFreestyleLineStyle, Panel):
bl_label = "Visibility"
bl_parent_id = "VIEWLAYER_PT_freestyle_lineset"
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH', 'BLENDER_WORKBENCH_NEXT'}
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH'}
def draw_header(self, context):
layout = self.layout
@ -319,7 +319,7 @@ class VIEWLAYER_PT_freestyle_lineset_visibilty(ViewLayerFreestyleLineStyle, Pane
class VIEWLAYER_PT_freestyle_lineset_edgetype(ViewLayerFreestyleLineStyle, Panel):
bl_label = "Edge Type"
bl_parent_id = "VIEWLAYER_PT_freestyle_lineset"
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH', 'BLENDER_WORKBENCH_NEXT'}
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH'}
def draw_header(self, context):
layout = self.layout
@ -369,7 +369,7 @@ class VIEWLAYER_PT_freestyle_lineset_edgetype(ViewLayerFreestyleLineStyle, Panel
class VIEWLAYER_PT_freestyle_lineset_facemarks(ViewLayerFreestyleLineStyle, Panel):
bl_label = "Face Marks"
bl_parent_id = "VIEWLAYER_PT_freestyle_lineset"
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH', 'BLENDER_WORKBENCH_NEXT'}
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH'}
bl_options = {'DEFAULT_CLOSED'}
def draw_header(self, context):
@ -398,7 +398,7 @@ class VIEWLAYER_PT_freestyle_lineset_facemarks(ViewLayerFreestyleLineStyle, Pane
class VIEWLAYER_PT_freestyle_lineset_collection(ViewLayerFreestyleLineStyle, Panel):
bl_label = "Collection"
bl_parent_id = "VIEWLAYER_PT_freestyle_lineset"
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH', 'BLENDER_WORKBENCH_NEXT'}
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH'}
bl_options = {'DEFAULT_CLOSED'}
def draw_header(self, context):
@ -1239,7 +1239,7 @@ class MaterialFreestyleButtonsPanel:
class MATERIAL_PT_freestyle_line(MaterialFreestyleButtonsPanel, Panel):
bl_label = "Freestyle Line"
bl_options = {'DEFAULT_CLOSED'}
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH', 'BLENDER_WORKBENCH_NEXT'}
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH'}
def draw(self, context):
layout = self.layout

View File

@ -68,8 +68,7 @@ class MATERIAL_PT_custom_props(MaterialButtonsPanel, PropertyPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
_context_path = "material"
_property_type = bpy.types.Material
@ -78,7 +77,7 @@ class EEVEE_MATERIAL_PT_context_material(MaterialButtonsPanel, Panel):
bl_label = ""
bl_context = "material"
bl_options = {'HIDE_HEADER'}
COMPAT_ENGINES = {'BLENDER_EEVEE', 'BLENDER_EEVEE_NEXT', 'BLENDER_WORKBENCH', 'BLENDER_WORKBENCH_NEXT'}
COMPAT_ENGINES = {'BLENDER_EEVEE', 'BLENDER_EEVEE_NEXT', 'BLENDER_WORKBENCH'}
@classmethod
def poll(cls, context):

View File

@ -231,7 +231,7 @@ class MATERIAL_PT_gpencil_preview(GPMaterialButtonsPanel, Panel):
class MATERIAL_PT_gpencil_custom_props(GPMaterialButtonsPanel, PropertyPanel, Panel):
COMPAT_ENGINES = {'BLENDER_EEVEE', 'BLENDER_WORKBENCH', 'BLENDER_WORKBENCH_NEXT'}
COMPAT_ENGINES = {'BLENDER_EEVEE', 'BLENDER_WORKBENCH'}
_context_path = "object.active_material"
_property_type = bpy.types.Material

View File

@ -370,7 +370,7 @@ class OBJECT_PT_motion_paths_display(MotionPathButtonsPanel_display, Panel):
class OBJECT_PT_visibility(ObjectButtonsPanel, Panel):
bl_label = "Visibility"
bl_options = {'DEFAULT_CLOSED'}
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH', 'BLENDER_WORKBENCH_NEXT'}
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH'}
@classmethod
def poll(cls, context):
@ -399,7 +399,7 @@ class OBJECT_PT_visibility(ObjectButtonsPanel, Panel):
class OBJECT_PT_custom_props(ObjectButtonsPanel, PropertyPanel, Panel):
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH', 'BLENDER_WORKBENCH_NEXT'}
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH'}
_context_path = "object"
_property_type = bpy.types.Object

View File

@ -49,8 +49,7 @@ class RENDER_PT_format(RenderOutputButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
_frame_rate_args_prev = None
_preset_class = None
@ -132,8 +131,7 @@ class RENDER_PT_frame_range(RenderOutputButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
def draw(self, context):
layout = self.layout
@ -156,8 +154,7 @@ class RENDER_PT_time_stretching(RenderOutputButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
def draw(self, context):
layout = self.layout
@ -178,8 +175,7 @@ class RENDER_PT_post_processing(RenderOutputButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
def draw(self, context):
layout = self.layout
@ -201,8 +197,7 @@ class RENDER_PT_stamp(RenderOutputButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
def draw(self, context):
layout = self.layout
@ -240,8 +235,7 @@ class RENDER_PT_stamp_note(RenderOutputButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
def draw_header(self, context):
rd = context.scene.render
@ -265,8 +259,7 @@ class RENDER_PT_stamp_burn(RenderOutputButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
def draw_header(self, context):
rd = context.scene.render
@ -294,8 +287,7 @@ class RENDER_PT_output(RenderOutputButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
def draw(self, context):
layout = self.layout
@ -328,8 +320,7 @@ class RENDER_PT_output_views(RenderOutputButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
@classmethod
def poll(cls, context):
@ -353,8 +344,7 @@ class RENDER_PT_output_color_management(RenderOutputButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
def draw(self, context):
scene = context.scene
@ -393,8 +383,7 @@ class RENDER_PT_encoding(RenderOutputButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
def draw_header_preset(self, _context):
RENDER_PT_ffmpeg_presets.draw_panel_header(self.layout)
@ -423,8 +412,7 @@ class RENDER_PT_encoding_video(RenderOutputButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
@classmethod
def poll(cls, context):
@ -504,8 +492,7 @@ class RENDER_PT_encoding_audio(RenderOutputButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
@classmethod
def poll(cls, context):
@ -551,8 +538,7 @@ class RENDER_PT_stereoscopy(RenderOutputButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
bl_options = {'DEFAULT_CLOSED'}
def draw_header(self, context):

View File

@ -59,8 +59,7 @@ class PARTICLE_MT_context_menu(Menu):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
def draw(self, context):
layout = self.layout
@ -103,8 +102,7 @@ class PARTICLE_PT_hair_dynamics_presets(PresetPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
class ParticleButtonsPanel:
@ -162,8 +160,7 @@ class PARTICLE_PT_context_particles(ParticleButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
@classmethod
def poll(cls, context):
@ -261,8 +258,7 @@ class PARTICLE_PT_emission(ParticleButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
@classmethod
def poll(cls, context):
@ -318,8 +314,7 @@ class PARTICLE_PT_emission_source(ParticleButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
def draw(self, context):
layout = self.layout
@ -360,8 +355,7 @@ class PARTICLE_PT_hair_dynamics(ParticleButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
@classmethod
def poll(cls, context):
@ -448,8 +442,7 @@ class PARTICLE_PT_hair_dynamics_collision(ParticleButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
@classmethod
def poll(cls, context):
@ -485,8 +478,7 @@ class PARTICLE_PT_hair_dynamics_structure(ParticleButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
@classmethod
def poll(cls, context):
@ -521,8 +513,7 @@ class PARTICLE_PT_hair_dynamics_volume(ParticleButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
@classmethod
def poll(cls, context):
@ -557,8 +548,7 @@ class PARTICLE_PT_cache(ParticleButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
@classmethod
def poll(cls, context):
@ -595,8 +585,7 @@ class PARTICLE_PT_velocity(ParticleButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
@classmethod
def poll(cls, context):
@ -649,8 +638,7 @@ class PARTICLE_PT_rotation(ParticleButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
@classmethod
def poll(cls, context):
@ -709,8 +697,7 @@ class PARTICLE_PT_rotation_angular_velocity(ParticleButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
def draw(self, context):
layout = self.layout
@ -739,8 +726,7 @@ class PARTICLE_PT_physics(ParticleButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
@classmethod
def poll(cls, context):
@ -797,8 +783,7 @@ class PARTICLE_PT_physics_fluid_advanced(ParticleButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
@classmethod
def poll(cls, context):
@ -847,8 +832,7 @@ class PARTICLE_PT_physics_fluid_springs(ParticleButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
@classmethod
def poll(cls, context):
@ -876,8 +860,7 @@ class PARTICLE_PT_physics_fluid_springs_viscoelastic(ParticleButtonsPanel, Panel
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
@classmethod
def poll(cls, context):
@ -917,8 +900,7 @@ class PARTICLE_PT_physics_fluid_springs_advanced(ParticleButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
@classmethod
def poll(cls, context):
@ -946,8 +928,7 @@ class PARTICLE_PT_physics_boids_movement(ParticleButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
@classmethod
def poll(cls, context):
@ -1004,8 +985,7 @@ class PARTICLE_PT_physics_boids_battle(ParticleButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
@classmethod
def poll(cls, context):
@ -1036,8 +1016,7 @@ class PARTICLE_PT_physics_boids_misc(ParticleButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
@classmethod
def poll(cls, context):
@ -1066,8 +1045,7 @@ class PARTICLE_PT_physics_relations(ParticleButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
@classmethod
def poll(cls, context):
@ -1126,8 +1104,7 @@ class PARTICLE_PT_physics_fluid_interaction(ParticleButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
@classmethod
def poll(cls, context):
@ -1172,8 +1149,7 @@ class PARTICLE_PT_physics_deflection(ParticleButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
@classmethod
def poll(cls, context):
@ -1203,8 +1179,7 @@ class PARTICLE_PT_physics_forces(ParticleButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
@classmethod
def poll(cls, context):
@ -1235,8 +1210,7 @@ class PARTICLE_PT_physics_integration(ParticleButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
@classmethod
def poll(cls, context):
@ -1274,8 +1248,7 @@ class PARTICLE_PT_boidbrain(ParticleButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
@classmethod
def poll(cls, context):
@ -1377,8 +1350,7 @@ class PARTICLE_PT_render(ParticleButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
@classmethod
def poll(cls, context):
@ -1429,8 +1401,7 @@ class PARTICLE_PT_render_extra(ParticleButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
@classmethod
def poll(cls, context):
@ -1458,8 +1429,7 @@ class PARTICLE_PT_render_path(ParticleButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
@classmethod
def poll(cls, context):
@ -1485,8 +1455,7 @@ class PARTICLE_PT_render_path_timing(ParticleButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
@classmethod
def poll(cls, context):
@ -1518,8 +1487,7 @@ class PARTICLE_PT_render_object(ParticleButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
@classmethod
def poll(cls, context):
@ -1548,8 +1516,7 @@ class PARTICLE_PT_render_collection(ParticleButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
@classmethod
def poll(cls, context):
@ -1583,8 +1550,7 @@ class PARTICLE_PT_render_collection_use_count(ParticleButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
@classmethod
def poll(cls, context):
@ -1636,8 +1602,7 @@ class PARTICLE_PT_draw(ParticleButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
@classmethod
def poll(cls, context):
@ -1700,8 +1665,7 @@ class PARTICLE_PT_children(ParticleButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
@classmethod
def poll(cls, context):
@ -1758,8 +1722,7 @@ class PARTICLE_PT_children_parting(ParticleButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
@classmethod
def poll(cls, context):
@ -1794,8 +1757,7 @@ class PARTICLE_PT_children_clumping(ParticleButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
@classmethod
def poll(cls, context):
@ -1835,8 +1797,7 @@ class PARTICLE_PT_children_clumping_noise(ParticleButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
def draw_header(self, context):
@ -1864,8 +1825,7 @@ class PARTICLE_PT_children_roughness(ParticleButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
@classmethod
def poll(cls, context):
@ -1910,8 +1870,7 @@ class PARTICLE_PT_children_kink(ParticleButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
@classmethod
def poll(cls, context):
@ -1965,8 +1924,7 @@ class PARTICLE_PT_field_weights(ParticleButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
@classmethod
def poll(cls, context):
@ -1991,8 +1949,7 @@ class PARTICLE_PT_force_fields(ParticleButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
def draw(self, context):
layout = self.layout
@ -2012,8 +1969,7 @@ class PARTICLE_PT_force_fields_type1(ParticleButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
def draw(self, context):
layout = self.layout
@ -2034,8 +1990,7 @@ class PARTICLE_PT_force_fields_type2(ParticleButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
def draw(self, context):
layout = self.layout
@ -2057,8 +2012,7 @@ class PARTICLE_PT_force_fields_type1_falloff(ParticleButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
def draw(self, context):
layout = self.layout
@ -2078,8 +2032,7 @@ class PARTICLE_PT_force_fields_type2_falloff(ParticleButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
def draw(self, context):
layout = self.layout
@ -2098,8 +2051,7 @@ class PARTICLE_PT_vertexgroups(ParticleButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
@classmethod
def poll(cls, context):
@ -2192,8 +2144,7 @@ class PARTICLE_PT_textures(ParticleButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
@classmethod
def poll(cls, context):
@ -2229,8 +2180,7 @@ class PARTICLE_PT_hair_shape(ParticleButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
@classmethod
def poll(cls, context):
@ -2262,8 +2212,7 @@ class PARTICLE_PT_custom_props(ParticleButtonsPanel, PropertyPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
_context_path = "particle_system.settings"
_property_type = bpy.types.ParticleSettings

View File

@ -41,8 +41,7 @@ class PHYSICS_PT_cloth(PhysicButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
def draw_header_preset(self, _context):
CLOTH_PT_presets.draw_panel_header(self.layout)
@ -71,8 +70,7 @@ class PHYSICS_PT_cloth_physical_properties(PhysicButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
def draw(self, context):
layout = self.layout
@ -100,8 +98,7 @@ class PHYSICS_PT_cloth_stiffness(PhysicButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
def draw(self, context):
layout = self.layout
@ -136,8 +133,7 @@ class PHYSICS_PT_cloth_damping(PhysicButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
def draw(self, context):
layout = self.layout
@ -172,8 +168,7 @@ class PHYSICS_PT_cloth_internal_springs(PhysicButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
def draw_header(self, context):
cloth = context.cloth.settings
@ -219,8 +214,7 @@ class PHYSICS_PT_cloth_pressure(PhysicButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
def draw_header(self, context):
cloth = context.cloth.settings
@ -268,8 +262,7 @@ class PHYSICS_PT_cloth_cache(PhysicButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
def draw(self, context):
md = context.cloth
@ -284,8 +277,7 @@ class PHYSICS_PT_cloth_shape(PhysicButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
def draw(self, context):
layout = self.layout
@ -339,8 +331,7 @@ class PHYSICS_PT_cloth_collision(PhysicButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
def draw(self, context):
layout = self.layout
@ -364,8 +355,7 @@ class PHYSICS_PT_cloth_object_collision(PhysicButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
def draw_header(self, context):
cloth = context.cloth.collision_settings
@ -405,8 +395,7 @@ class PHYSICS_PT_cloth_self_collision(PhysicButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
def draw_header(self, context):
cloth = context.cloth.collision_settings
@ -447,8 +436,7 @@ class PHYSICS_PT_cloth_property_weights(PhysicButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
def draw(self, context):
layout = self.layout
@ -506,8 +494,7 @@ class PHYSICS_PT_cloth_field_weights(PhysicButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
def draw(self, context):
cloth = context.cloth.settings

View File

@ -57,8 +57,7 @@ class PHYSICS_PT_add(PhysicButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
def draw(self, context):
layout = self.layout

View File

@ -89,8 +89,7 @@ class PHYSICS_PT_dynamic_paint(PhysicButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
@classmethod
def poll(cls, context):
@ -115,8 +114,7 @@ class PHYSICS_PT_dynamic_paint_settings(PhysicButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
@classmethod
def poll(cls, context):
@ -204,8 +202,7 @@ class PHYSICS_PT_dp_surface_canvas(PhysicButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
@classmethod
def poll(cls, context):
@ -272,8 +269,7 @@ class PHYSICS_PT_dp_surface_canvas_paint_dry(PhysicButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
@classmethod
def poll(cls, context):
@ -313,8 +309,7 @@ class PHYSICS_PT_dp_surface_canvas_paint_dissolve(PhysicButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
@classmethod
def poll(cls, context):
@ -355,8 +350,7 @@ class PHYSICS_PT_dp_canvas_output(PhysicButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
@classmethod
def poll(cls, context):
@ -436,8 +430,7 @@ class PHYSICS_PT_dp_canvas_output_paintmaps(PhysicButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
@classmethod
def poll(cls, context):
@ -471,8 +464,7 @@ class PHYSICS_PT_dp_canvas_output_wetmaps(PhysicButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
@classmethod
def poll(cls, context):
@ -506,8 +498,7 @@ class PHYSICS_PT_dp_canvas_initial_color(PhysicButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
@classmethod
def poll(cls, context):
@ -551,8 +542,7 @@ class PHYSICS_PT_dp_effects(PhysicButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
@classmethod
def poll(cls, context):
@ -573,8 +563,7 @@ class PHYSICS_PT_dp_effects_spread(PhysicButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
@classmethod
def poll(cls, context):
@ -613,8 +602,7 @@ class PHYSICS_PT_dp_effects_drip(PhysicButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
@classmethod
def poll(cls, context):
@ -654,8 +642,7 @@ class PHYSICS_PT_dp_effects_drip_weights(PhysicButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
@classmethod
def poll(cls, context):
@ -683,8 +670,7 @@ class PHYSICS_PT_dp_effects_shrink(PhysicButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
@classmethod
def poll(cls, context):
@ -718,8 +704,7 @@ class PHYSICS_PT_dp_cache(PhysicButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
@classmethod
def poll(cls, context):
@ -743,8 +728,7 @@ class PHYSICS_PT_dp_brush_source(PhysicButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
@classmethod
def poll(cls, context):
@ -811,8 +795,7 @@ class PHYSICS_PT_dp_brush_source_color_ramp(PhysicButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
@classmethod
def poll(cls, context):
@ -843,8 +826,7 @@ class PHYSICS_PT_dp_brush_velocity(PhysicButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
@classmethod
def poll(cls, context):
@ -879,8 +861,7 @@ class PHYSICS_PT_dp_brush_velocity_color_ramp(PhysicButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
@classmethod
def poll(cls, context):
@ -905,8 +886,7 @@ class PHYSICS_PT_dp_brush_velocity_smudge(PhysicButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
@classmethod
def poll(cls, context):
@ -938,8 +918,7 @@ class PHYSICS_PT_dp_brush_wave(PhysicButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
@classmethod
def poll(cls, context):

View File

@ -33,8 +33,7 @@ class PHYSICS_PT_field(PhysicButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
@classmethod
def poll(cls, context):
@ -60,8 +59,7 @@ class PHYSICS_PT_field_settings(PhysicButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
@classmethod
def poll(cls, context):
@ -152,8 +150,7 @@ class PHYSICS_PT_field_settings_kink(PhysicButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
@classmethod
def poll(cls, context):
@ -191,8 +188,7 @@ class PHYSICS_PT_field_settings_texture_select(PhysicButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
@classmethod
def poll(cls, context):
@ -218,8 +214,7 @@ class PHYSICS_PT_field_falloff(PhysicButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
@classmethod
def poll(cls, context):
@ -248,8 +243,7 @@ class PHYSICS_PT_field_falloff_angular(PhysicButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
@classmethod
def poll(cls, context):
@ -292,8 +286,7 @@ class PHYSICS_PT_field_falloff_radial(PhysicButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
@classmethod
def poll(cls, context):
@ -341,8 +334,7 @@ class PHYSICS_PT_collision(PhysicButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
@classmethod
def poll(cls, context):
@ -377,8 +369,7 @@ class PHYSICS_PT_collision_particle(PhysicButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
@classmethod
def poll(cls, context):
@ -428,8 +419,7 @@ class PHYSICS_PT_collision_softbody(PhysicButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
@classmethod
def poll(cls, context):

View File

@ -102,8 +102,7 @@ class PHYSICS_PT_fluid(PhysicButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
@classmethod
def poll(cls, context):
@ -131,8 +130,7 @@ class PHYSICS_PT_settings(PhysicButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
@classmethod
def poll(cls, context):
@ -299,8 +297,7 @@ class PHYSICS_PT_borders(PhysicButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
@classmethod
def poll(cls, context):
@ -337,8 +334,7 @@ class PHYSICS_PT_smoke(PhysicButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
@classmethod
def poll(cls, context):
@ -375,8 +371,7 @@ class PHYSICS_PT_smoke_dissolve(PhysicButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
@classmethod
def poll(cls, context):
@ -424,8 +419,7 @@ class PHYSICS_PT_fire(PhysicButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
@classmethod
def poll(cls, context):
@ -468,8 +462,7 @@ class PHYSICS_PT_liquid(PhysicButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
@classmethod
def poll(cls, context):
@ -536,8 +529,7 @@ class PHYSICS_PT_flow_source(PhysicButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
@classmethod
def poll(cls, context):
@ -582,8 +574,7 @@ class PHYSICS_PT_flow_initial_velocity(PhysicButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
@classmethod
def poll(cls, context):
@ -629,8 +620,7 @@ class PHYSICS_PT_flow_texture(PhysicButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
@classmethod
def poll(cls, context):
@ -685,8 +675,7 @@ class PHYSICS_PT_adaptive_domain(PhysicButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
@classmethod
def poll(cls, context):
@ -742,8 +731,7 @@ class PHYSICS_PT_noise(PhysicButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
@classmethod
def poll(cls, context):
@ -827,8 +815,7 @@ class PHYSICS_PT_mesh(PhysicButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
@classmethod
def poll(cls, context):
@ -927,8 +914,7 @@ class PHYSICS_PT_particles(PhysicButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
@classmethod
def poll(cls, context):
@ -1063,8 +1049,7 @@ class PHYSICS_PT_viscosity(PhysicButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
@classmethod
def poll(cls, context):
@ -1108,8 +1093,7 @@ class PHYSICS_PT_diffusion(PhysicButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
@classmethod
def poll(cls, context):
@ -1160,8 +1144,7 @@ class PHYSICS_PT_guide(PhysicButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
@classmethod
def poll(cls, context):
@ -1231,8 +1214,7 @@ class PHYSICS_PT_collections(PhysicButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
@classmethod
def poll(cls, context):
@ -1263,8 +1245,7 @@ class PHYSICS_PT_cache(PhysicButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
@classmethod
def poll(cls, context):
@ -1352,8 +1333,7 @@ class PHYSICS_PT_export(PhysicButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
@classmethod
def poll(cls, context):
@ -1402,8 +1382,7 @@ class PHYSICS_PT_field_weights(PhysicButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
@classmethod
def poll(cls, context):
@ -1596,8 +1575,7 @@ class PHYSICS_PT_fluid_domain_render(PhysicButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
@classmethod
def poll(cls, context):

View File

@ -25,8 +25,7 @@ class PHYSICS_PT_rigid_body(PHYSICS_PT_rigidbody_panel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
@classmethod
def poll(cls, context):
@ -65,8 +64,7 @@ class PHYSICS_PT_rigid_body_settings(PHYSICS_PT_rigidbody_panel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
@classmethod
def poll(cls, context):
@ -102,8 +100,7 @@ class PHYSICS_PT_rigid_body_collisions(PHYSICS_PT_rigidbody_panel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
@classmethod
def poll(cls, context):
@ -157,8 +154,7 @@ class PHYSICS_PT_rigid_body_collisions_surface(PHYSICS_PT_rigidbody_panel, Panel
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
@classmethod
def poll(cls, context):
@ -190,8 +186,7 @@ class PHYSICS_PT_rigid_body_collisions_sensitivity(PHYSICS_PT_rigidbody_panel, P
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
@classmethod
def poll(cls, context):
@ -232,8 +227,7 @@ class PHYSICS_PT_rigid_body_collisions_collections(PHYSICS_PT_rigidbody_panel, P
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
@classmethod
def poll(cls, context):
@ -259,8 +253,7 @@ class PHYSICS_PT_rigid_body_dynamics(PHYSICS_PT_rigidbody_panel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
@classmethod
def poll(cls, context):
@ -297,8 +290,7 @@ class PHYSICS_PT_rigid_body_dynamics_deactivation(PHYSICS_PT_rigidbody_panel, Pa
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
@classmethod
def poll(cls, context):

View File

@ -19,8 +19,7 @@ class PHYSICS_PT_rigid_body_constraint(PHYSICS_PT_rigidbody_constraint_panel, Pa
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
@classmethod
def poll(cls, context):
@ -44,8 +43,7 @@ class PHYSICS_PT_rigid_body_constraint_settings(PHYSICS_PT_rigidbody_constraint_
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
@classmethod
def poll(cls, context):
@ -80,8 +78,7 @@ class PHYSICS_PT_rigid_body_constraint_objects(PHYSICS_PT_rigidbody_constraint_p
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
@classmethod
def poll(cls, context):
@ -106,8 +103,7 @@ class PHYSICS_PT_rigid_body_constraint_override_iterations(PHYSICS_PT_rigidbody_
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
@classmethod
def poll(cls, context):
@ -137,8 +133,7 @@ class PHYSICS_PT_rigid_body_constraint_limits(PHYSICS_PT_rigidbody_constraint_pa
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
@classmethod
def poll(cls, context):
@ -159,8 +154,7 @@ class PHYSICS_PT_rigid_body_constraint_limits_linear(PHYSICS_PT_rigidbody_constr
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
@classmethod
def poll(cls, context):
@ -221,8 +215,7 @@ class PHYSICS_PT_rigid_body_constraint_limits_angular(PHYSICS_PT_rigidbody_const
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
@classmethod
def poll(cls, context):
@ -292,8 +285,7 @@ class PHYSICS_PT_rigid_body_constraint_motor(PHYSICS_PT_rigidbody_constraint_pan
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
@classmethod
def poll(cls, context):
@ -314,8 +306,7 @@ class PHYSICS_PT_rigid_body_constraint_motor_angular(PHYSICS_PT_rigidbody_constr
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
@classmethod
def poll(cls, context):
@ -355,8 +346,7 @@ class PHYSICS_PT_rigid_body_constraint_motor_linear(PHYSICS_PT_rigidbody_constra
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
@classmethod
def poll(cls, context):
@ -396,8 +386,7 @@ class PHYSICS_PT_rigid_body_constraint_springs(PHYSICS_PT_rigidbody_constraint_p
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
@classmethod
def poll(cls, context):
@ -425,8 +414,7 @@ class PHYSICS_PT_rigid_body_constraint_springs_angular(PHYSICS_PT_rigidbody_cons
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
@classmethod
def poll(cls, context):
@ -478,8 +466,7 @@ class PHYSICS_PT_rigid_body_constraint_springs_linear(PHYSICS_PT_rigidbody_const
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
@classmethod
def poll(cls, context):

View File

@ -34,8 +34,7 @@ class PHYSICS_PT_softbody(PhysicButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
def draw(self, context):
layout = self.layout
@ -55,8 +54,7 @@ class PHYSICS_PT_softbody_object(PhysicButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
def draw(self, context):
layout = self.layout
@ -88,8 +86,7 @@ class PHYSICS_PT_softbody_simulation(PhysicButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
def draw(self, context):
layout = self.layout
@ -111,8 +108,7 @@ class PHYSICS_PT_softbody_cache(PhysicButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
def draw(self, context):
md = context.soft_body
@ -127,8 +123,7 @@ class PHYSICS_PT_softbody_goal(PhysicButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
def draw_header(self, context):
softbody = context.soft_body.settings
@ -157,8 +152,7 @@ class PHYSICS_PT_softbody_goal_strengths(PhysicButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
def draw(self, context):
layout = self.layout
@ -188,8 +182,7 @@ class PHYSICS_PT_softbody_goal_settings(PhysicButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
def draw(self, context):
layout = self.layout
@ -216,8 +209,7 @@ class PHYSICS_PT_softbody_edge(PhysicButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
def draw_header(self, context):
softbody = context.soft_body.settings
@ -272,8 +264,7 @@ class PHYSICS_PT_softbody_edge_aerodynamics(PhysicButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
def draw(self, context):
layout = self.layout
@ -300,8 +291,7 @@ class PHYSICS_PT_softbody_edge_stiffness(PhysicButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
def draw_header(self, context):
softbody = context.soft_body.settings
@ -329,8 +319,7 @@ class PHYSICS_PT_softbody_collision(PhysicButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
def draw_header(self, context):
softbody = context.soft_body.settings
@ -369,8 +358,7 @@ class PHYSICS_PT_softbody_solver(PhysicButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
def draw(self, context):
layout = self.layout
@ -399,8 +387,7 @@ class PHYSICS_PT_softbody_solver_diagnostics(PhysicButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
def draw(self, context):
layout = self.layout
@ -423,8 +410,7 @@ class PHYSICS_PT_softbody_solver_helpers(PhysicButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
def draw(self, context):
layout = self.layout
@ -451,8 +437,7 @@ class PHYSICS_PT_softbody_field_weights(PhysicButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
def draw(self, context):
md = context.soft_body

View File

@ -54,8 +54,7 @@ class RENDER_PT_color_management(RenderButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
def draw(self, context):
@ -93,8 +92,7 @@ class RENDER_PT_color_management_display_settings(RenderButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
def draw(self, context):
layout = self.layout
@ -124,8 +122,7 @@ class RENDER_PT_color_management_curves(RenderButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
def draw_header(self, context):
@ -1002,7 +999,7 @@ class RENDER_PT_eevee_hair(RenderButtonsPanel, Panel):
class RENDER_PT_eevee_performance(RenderButtonsPanel, Panel):
bl_label = "Performance"
bl_options = {'DEFAULT_CLOSED'}
COMPAT_ENGINES = {'BLENDER_EEVEE', 'BLENDER_EEVEE_NEXT', 'BLENDER_WORKBENCH', 'BLENDER_WORKBENCH_NEXT'}
COMPAT_ENGINES = {'BLENDER_EEVEE', 'BLENDER_EEVEE_NEXT', 'BLENDER_WORKBENCH'}
@classmethod
def poll(cls, context):
@ -1027,8 +1024,7 @@ class RENDER_PT_gpencil(RenderButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
def draw(self, context):
layout = self.layout
@ -1044,7 +1040,7 @@ class RENDER_PT_gpencil(RenderButtonsPanel, Panel):
class RENDER_PT_opengl_sampling(RenderButtonsPanel, Panel):
bl_label = "Sampling"
COMPAT_ENGINES = {'BLENDER_WORKBENCH', 'BLENDER_WORKBENCH_NEXT'}
COMPAT_ENGINES = {'BLENDER_WORKBENCH'}
@classmethod
def poll(cls, context):
@ -1066,7 +1062,7 @@ class RENDER_PT_opengl_sampling(RenderButtonsPanel, Panel):
class RENDER_PT_opengl_film(RenderButtonsPanel, Panel):
bl_label = "Film"
bl_options = {'DEFAULT_CLOSED'}
COMPAT_ENGINES = {'BLENDER_WORKBENCH', 'BLENDER_WORKBENCH_NEXT'}
COMPAT_ENGINES = {'BLENDER_WORKBENCH'}
def draw(self, context):
layout = self.layout
@ -1079,7 +1075,7 @@ class RENDER_PT_opengl_film(RenderButtonsPanel, Panel):
class RENDER_PT_opengl_lighting(RenderButtonsPanel, Panel):
bl_label = "Lighting"
COMPAT_ENGINES = {'BLENDER_WORKBENCH', 'BLENDER_WORKBENCH_NEXT'}
COMPAT_ENGINES = {'BLENDER_WORKBENCH'}
@classmethod
def poll(cls, context):
@ -1091,7 +1087,7 @@ class RENDER_PT_opengl_lighting(RenderButtonsPanel, Panel):
class RENDER_PT_opengl_color(RenderButtonsPanel, Panel):
bl_label = "Color"
COMPAT_ENGINES = {'BLENDER_WORKBENCH', 'BLENDER_WORKBENCH_NEXT'}
COMPAT_ENGINES = {'BLENDER_WORKBENCH'}
@classmethod
def poll(cls, context):
@ -1103,7 +1099,7 @@ class RENDER_PT_opengl_color(RenderButtonsPanel, Panel):
class RENDER_PT_opengl_options(RenderButtonsPanel, Panel):
bl_label = "Options"
COMPAT_ENGINES = {'BLENDER_WORKBENCH', 'BLENDER_WORKBENCH_NEXT'}
COMPAT_ENGINES = {'BLENDER_WORKBENCH'}
@classmethod
def poll(cls, context):
@ -1120,8 +1116,7 @@ class RENDER_PT_simplify(RenderButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
def draw_header(self, context):
rd = context.scene.render
@ -1138,8 +1133,7 @@ class RENDER_PT_simplify_viewport(RenderButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
def draw(self, context):
layout = self.layout
@ -1172,8 +1166,7 @@ class RENDER_PT_simplify_render(RenderButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
def draw(self, context):
layout = self.layout
@ -1205,7 +1198,7 @@ class RENDER_PT_simplify_greasepencil(RenderButtonsPanel, Panel, GreasePencilSim
'BLENDER_CLAY',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH', 'BLENDER_WORKBENCH_NEXT',
'BLENDER_WORKBENCH',
}
bl_options = {'DEFAULT_CLOSED'}

View File

@ -74,8 +74,7 @@ class TEXTURE_PT_preview(TextureButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
@classmethod
def poll(cls, context):
@ -108,8 +107,7 @@ class TEXTURE_PT_context(TextureButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
def draw(self, context):
layout = self.layout
@ -152,8 +150,7 @@ class TEXTURE_PT_node(TextureButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
@classmethod
def poll(cls, context):
@ -186,8 +183,7 @@ class TEXTURE_PT_clouds(TextureTypePanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
def draw(self, context):
layout = self.layout
@ -223,8 +219,7 @@ class TEXTURE_PT_wood(TextureTypePanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
def draw(self, context):
layout = self.layout
@ -265,8 +260,7 @@ class TEXTURE_PT_marble(TextureTypePanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
def draw(self, context):
layout = self.layout
@ -304,8 +298,7 @@ class TEXTURE_PT_magic(TextureTypePanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
def draw(self, context):
layout = self.layout
@ -328,8 +321,7 @@ class TEXTURE_PT_blend(TextureTypePanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
def draw(self, context):
layout = self.layout
@ -355,8 +347,7 @@ class TEXTURE_PT_stucci(TextureTypePanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
def draw(self, context):
layout = self.layout
@ -391,8 +382,7 @@ class TEXTURE_PT_image(TextureTypePanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
def draw(self, _context):
# TODO: maybe expose the template_ID from the template image here.
@ -408,8 +398,7 @@ class TEXTURE_PT_image_settings(TextureTypePanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
def draw(self, context):
layout = self.layout
@ -568,8 +557,7 @@ class TEXTURE_PT_musgrave(TextureTypePanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
def draw(self, context):
layout = self.layout
@ -618,8 +606,7 @@ class TEXTURE_PT_voronoi(TextureTypePanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
def draw(self, context):
layout = self.layout
@ -656,8 +643,7 @@ class TEXTURE_PT_voronoi_feature_weights(TextureTypePanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
def draw(self, context):
layout = self.layout
@ -682,8 +668,7 @@ class TEXTURE_PT_distortednoise(TextureTypePanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
def draw(self, context):
layout = self.layout
@ -712,8 +697,7 @@ class TextureSlotPanel(TextureButtonsPanel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
@classmethod
def poll(cls, context):
@ -729,8 +713,7 @@ class TEXTURE_PT_mapping(TextureSlotPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
@classmethod
def poll(cls, context):
@ -802,8 +785,7 @@ class TEXTURE_PT_influence(TextureSlotPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
@classmethod
def poll(cls, context):
@ -889,8 +871,7 @@ class TEXTURE_PT_colors(TextureButtonsPanel, TextureColorsPoll, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
def draw(self, context):
layout = self.layout
@ -923,8 +904,7 @@ class TEXTURE_PT_colors_ramp(TextureButtonsPanel, TextureColorsPoll, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
def draw_header(self, context):
tex = context.texture
@ -949,8 +929,7 @@ class TEXTURE_PT_custom_props(TextureButtonsPanel, PropertyPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
_context_path = "texture"
_property_type = Texture

View File

@ -34,8 +34,7 @@ class VIEWLAYER_PT_layer(ViewLayerButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
def draw(self, context):
layout = self.layout
@ -53,7 +52,7 @@ class VIEWLAYER_PT_layer(ViewLayerButtonsPanel, Panel):
class VIEWLAYER_PT_layer_passes(ViewLayerButtonsPanel, Panel):
bl_label = "Passes"
COMPAT_ENGINES = {'BLENDER_EEVEE', 'BLENDER_EEVEE_NEXT', 'BLENDER_WORKBENCH_NEXT'}
COMPAT_ENGINES = {'BLENDER_EEVEE', 'BLENDER_EEVEE_NEXT'}
def draw(self, context):
pass
@ -79,11 +78,11 @@ class VIEWLAYER_PT_eevee_layer_passes_data(ViewLayerButtonsPanel, Panel):
col.prop(view_layer, "use_pass_normal")
class VIEWLAYER_PT_eevee_next_layer_passes_data(ViewLayerButtonsPanel, Panel):
class VIEWLAYER_PT_workbench_layer_passes_data(ViewLayerButtonsPanel, Panel):
bl_label = "Data"
bl_parent_id = "VIEWLAYER_PT_layer_passes"
COMPAT_ENGINES = {'BLENDER_WORKBENCH_NEXT'}
COMPAT_ENGINES = {'BLENDER_WORKBENCH'}
def draw(self, context):
layout = self.layout
@ -268,7 +267,7 @@ classes = (
VIEWLAYER_MT_lightgroup_sync,
VIEWLAYER_PT_layer,
VIEWLAYER_PT_layer_passes,
VIEWLAYER_PT_eevee_next_layer_passes_data,
VIEWLAYER_PT_workbench_layer_passes_data,
VIEWLAYER_PT_eevee_layer_passes_data,
VIEWLAYER_PT_eevee_layer_passes_light,
VIEWLAYER_PT_eevee_layer_passes_effects,

View File

@ -27,8 +27,7 @@ class WORLD_PT_context_world(WorldButtonsPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
@classmethod
def poll(cls, context):
@ -76,8 +75,7 @@ class WORLD_PT_custom_props(WorldButtonsPanel, PropertyPanel, Panel):
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
'BLENDER_WORKBENCH_NEXT'}
'BLENDER_WORKBENCH'}
_context_path = "world"
_property_type = bpy.types.World

View File

@ -724,7 +724,7 @@ class NODE_PT_texture_mapping(Panel):
bl_category = "Node"
bl_label = "Texture Mapping"
bl_options = {'DEFAULT_CLOSED'}
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH', 'BLENDER_WORKBENCH_NEXT'}
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH'}
@classmethod
def poll(cls, context):

View File

@ -2663,7 +2663,7 @@ class SEQUENCER_PT_annotation_onion(AnnotationOnionSkin, SequencerButtonsPanel_O
class SEQUENCER_PT_custom_props(SequencerButtonsPanel, PropertyPanel, Panel):
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH', 'BLENDER_WORKBENCH_NEXT'}
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH'}
_context_path = "active_sequence_strip"
_property_type = (bpy.types.Sequence,)
bl_category = "Strip"

View File

@ -1628,7 +1628,6 @@ IDTypeInfo IDType_ID_SCE = get_type_info();
const char *RE_engine_id_BLENDER_EEVEE = "BLENDER_EEVEE";
const char *RE_engine_id_BLENDER_EEVEE_NEXT = "BLENDER_EEVEE_NEXT";
const char *RE_engine_id_BLENDER_WORKBENCH = "BLENDER_WORKBENCH";
const char *RE_engine_id_BLENDER_WORKBENCH_NEXT = "BLENDER_WORKBENCH_NEXT";
const char *RE_engine_id_CYCLES = "CYCLES";
void free_avicodecdata(AviCodecData *acd)
@ -2821,8 +2820,7 @@ bool BKE_scene_uses_blender_eevee(const Scene *scene)
bool BKE_scene_uses_blender_workbench(const Scene *scene)
{
return STREQ(scene->r.engine, RE_engine_id_BLENDER_WORKBENCH) ||
STREQ(scene->r.engine, RE_engine_id_BLENDER_WORKBENCH_NEXT);
return STREQ(scene->r.engine, RE_engine_id_BLENDER_WORKBENCH);
}
bool BKE_scene_uses_cycles(const Scene *scene)

View File

@ -166,30 +166,17 @@ set(SRC
engines/eevee_next/eevee_view.cc
engines/eevee_next/eevee_volume.cc
engines/eevee_next/eevee_world.cc
engines/workbench/workbench_data.cc
engines/workbench/workbench_effect_antialiasing.cc
engines/workbench/workbench_effect_antialiasing_c.cc
engines/workbench/workbench_effect_cavity.cc
engines/workbench/workbench_effect_cavity_c.cc
engines/workbench/workbench_effect_dof.cc
engines/workbench/workbench_effect_dof_c.cc
engines/workbench/workbench_effect_outline.cc
engines/workbench/workbench_effect_outline_c.cc
engines/workbench/workbench_engine.cc
engines/workbench/workbench_engine_c.cc
engines/workbench/workbench_materials.cc
engines/workbench/workbench_materials_next.cc
engines/workbench/workbench_mesh_passes.cc
engines/workbench/workbench_opaque.cc
engines/workbench/workbench_render.cc
engines/workbench/workbench_resources.cc
engines/workbench/workbench_shader.cc
engines/workbench/workbench_shader_cache.cc
engines/workbench/workbench_shadow.cc
engines/workbench/workbench_shadow_c.cc
engines/workbench/workbench_state.cc
engines/workbench/workbench_transparent.cc
engines/workbench/workbench_volume.cc
engines/workbench/workbench_volume_next.cc
engines/external/external_engine.cc
engines/gpencil/gpencil_antialiasing.cc
@ -354,7 +341,6 @@ set(SRC
engines/workbench/workbench_defines.hh
engines/workbench/workbench_engine.h
engines/workbench/workbench_enums.hh
engines/workbench/workbench_private.h
engines/workbench/workbench_private.hh
engines/workbench/workbench_shader_shared.h
)
@ -598,10 +584,8 @@ set(GLSL_SRC
engines/workbench/shaders/workbench_cavity_lib.glsl
engines/workbench/shaders/workbench_common_lib.glsl
engines/workbench/shaders/workbench_composite_frag.glsl
engines/workbench/shaders/workbench_next_composite_frag.glsl
engines/workbench/shaders/workbench_curvature_lib.glsl
engines/workbench/shaders/workbench_effect_cavity_frag.glsl
engines/workbench/shaders/workbench_effect_dof_frag.glsl
engines/workbench/shaders/workbench_effect_outline_frag.glsl
engines/workbench/shaders/workbench_effect_smaa_frag.glsl
@ -611,7 +595,6 @@ set(GLSL_SRC
engines/workbench/shaders/workbench_image_lib.glsl
engines/workbench/shaders/workbench_matcap_lib.glsl
engines/workbench/shaders/workbench_material_lib.glsl
engines/workbench/shaders/workbench_merge_infront_frag.glsl
engines/workbench/shaders/workbench_next_merge_depth_frag.glsl
engines/workbench/shaders/workbench_overlay_depth_frag.glsl
engines/workbench/shaders/workbench_prepass_frag.glsl

View File

@ -9,45 +9,6 @@
/** \name Base Composite
* \{ */
GPU_SHADER_CREATE_INFO(workbench_composite)
.sampler(0, ImageType::FLOAT_2D, "normalBuffer")
.sampler(1, ImageType::FLOAT_2D, "materialBuffer")
.uniform_buf(WB_WORLD_SLOT, "WorldData", "world_data")
.push_constant(Type::BOOL, "forceShadowing")
.fragment_out(0, Type::VEC4, "fragColor")
.typedef_source("workbench_shader_shared.h")
.fragment_source("workbench_composite_frag.glsl")
.additional_info("draw_fullscreen", "draw_view");
/** \} */
/* -------------------------------------------------------------------- */
/** \name Lighting Type
* \{ */
GPU_SHADER_CREATE_INFO(workbench_composite_studio)
.define("WORKBENCH_LIGHTING_STUDIO")
.additional_info("workbench_composite")
.do_static_compilation(true);
GPU_SHADER_CREATE_INFO(workbench_composite_matcap)
.define("WORKBENCH_LIGHTING_MATCAP")
.sampler(2, ImageType::FLOAT_2D, "matcap_diffuse_tx")
.sampler(3, ImageType::FLOAT_2D, "matcap_specular_tx")
.additional_info("workbench_composite")
.do_static_compilation(true);
GPU_SHADER_CREATE_INFO(workbench_composite_flat)
.define("WORKBENCH_LIGHTING_FLAT")
.additional_info("workbench_composite")
.do_static_compilation(true);
/** \} */
/* -------------------------------------------------------------------- */
/** \name Workbench Next
* \{ */
GPU_SHADER_CREATE_INFO(workbench_next_composite)
.sampler(3, ImageType::FLOAT_2D, "normal_tx")
.sampler(4, ImageType::FLOAT_2D, "material_tx")
@ -78,11 +39,9 @@ GPU_SHADER_CREATE_INFO(workbench_next_resolve_curvature)
GPU_SHADER_CREATE_INFO(workbench_next_resolve_cavity)
.define("WORKBENCH_CAVITY")
/* TODO(@pragma37): GPU_SAMPLER_EXTEND_MODE_REPEAT is set in CavityEffect,
* it doesn't work here? */
.sampler(8, ImageType::FLOAT_2D, "jitter_tx")
.uniform_buf(5, "vec4", "cavity_samples[512]");
/* Variations */

View File

@ -4,17 +4,17 @@
#include "gpu_shader_create_info.hh"
GPU_SHADER_CREATE_INFO(workbench_merge_infront)
.fragment_out(0, Type::VEC4, "fragColor")
.sampler(0, ImageType::DEPTH_2D, "depthBuffer")
.fragment_source("workbench_merge_infront_frag.glsl")
GPU_SHADER_CREATE_INFO(workbench_next_merge_depth)
.sampler(0, ImageType::DEPTH_2D, "depth_tx")
.fragment_source("workbench_merge_depth_frag.glsl")
.additional_info("draw_fullscreen")
.depth_write(DepthWrite::ANY)
.do_static_compilation(true);
GPU_SHADER_CREATE_INFO(workbench_next_merge_depth)
GPU_SHADER_CREATE_INFO(workbench_overlay_depth)
.sampler(0, ImageType::DEPTH_2D, "depth_tx")
.fragment_source("workbench_next_merge_depth_frag.glsl")
.sampler(1, ImageType::UINT_2D, "stencil_tx")
.fragment_source("workbench_overlay_depth_frag.glsl")
.additional_info("draw_fullscreen")
.depth_write(DepthWrite::ANY)
.do_static_compilation(true);

View File

@ -1,38 +0,0 @@
/* SPDX-FileCopyrightText: 2023 Blender Authors
*
* SPDX-License-Identifier: GPL-2.0-or-later */
#include "gpu_shader_create_info.hh"
GPU_SHADER_CREATE_INFO(workbench_effect_cavity_common)
.fragment_out(0, Type::VEC4, "fragColor")
.sampler(0, ImageType::FLOAT_2D, "normalBuffer")
.uniform_buf(WB_WORLD_SLOT, "WorldData", "world_data")
.typedef_source("workbench_shader_shared.h")
.fragment_source("workbench_effect_cavity_frag.glsl")
.additional_info("draw_fullscreen")
.additional_info("draw_view");
GPU_SHADER_CREATE_INFO(workbench_effect_cavity)
.do_static_compilation(true)
.define("USE_CAVITY")
.uniform_buf(3, "vec4", "samples_coords[512]")
.sampler(1, ImageType::DEPTH_2D, "depthBuffer")
.sampler(2, ImageType::FLOAT_2D, "cavityJitter")
.additional_info("workbench_effect_cavity_common");
GPU_SHADER_CREATE_INFO(workbench_effect_curvature)
.do_static_compilation(true)
.define("USE_CURVATURE")
.sampler(1, ImageType::UINT_2D, "objectIdBuffer")
.additional_info("workbench_effect_cavity_common");
GPU_SHADER_CREATE_INFO(workbench_effect_cavity_curvature)
.do_static_compilation(true)
.define("USE_CAVITY")
.define("USE_CURVATURE")
.uniform_buf(3, "vec4", "samples_coords[512]")
.sampler(1, ImageType::DEPTH_2D, "depthBuffer")
.sampler(2, ImageType::FLOAT_2D, "cavityJitter")
.sampler(3, ImageType::UINT_2D, "objectIdBuffer")
.additional_info("workbench_effect_cavity_common");

View File

@ -1,13 +0,0 @@
/* SPDX-FileCopyrightText: 2023 Blender Authors
*
* SPDX-License-Identifier: GPL-2.0-or-later */
#include "gpu_shader_create_info.hh"
GPU_SHADER_CREATE_INFO(workbench_overlay_depth)
.sampler(0, ImageType::DEPTH_2D, "depth_tx")
.sampler(1, ImageType::UINT_2D, "stencil_tx")
.fragment_source("workbench_overlay_depth_frag.glsl")
.additional_info("draw_fullscreen")
.depth_write(DepthWrite::ANY)
.do_static_compilation(true);

View File

@ -5,33 +5,6 @@
#include "gpu_shader_create_info.hh"
#include "workbench_defines.hh"
/* -------------------------------------------------------------------- */
/** \name Object Type
* \{ */
GPU_SHADER_CREATE_INFO(workbench_mesh)
.vertex_in(0, Type::VEC3, "pos")
.vertex_in(1, Type::VEC3, "nor")
.vertex_in(2, Type::VEC4, "ac")
.vertex_in(3, Type::VEC2, "au")
.vertex_source("workbench_prepass_vert.glsl")
.additional_info("draw_mesh")
.additional_info("draw_resource_handle");
GPU_SHADER_CREATE_INFO(workbench_hair)
.sampler(0, ImageType::FLOAT_BUFFER, "ac", Frequency::BATCH)
.sampler(1, ImageType::FLOAT_BUFFER, "au", Frequency::BATCH)
.vertex_source("workbench_prepass_hair_vert.glsl")
.additional_info("draw_hair")
.additional_info("draw_resource_handle");
GPU_SHADER_CREATE_INFO(workbench_pointcloud)
.vertex_source("workbench_prepass_pointcloud_vert.glsl")
.additional_info("draw_pointcloud")
.additional_info("draw_resource_handle");
/** \} */
/* -------------------------------------------------------------------- */
/** \name Object Type
* \{ */
@ -61,28 +34,6 @@ GPU_SHADER_CREATE_INFO(workbench_next_pointcloud)
/** \} */
/* -------------------------------------------------------------------- */
/** \name Texture Type
* \{ */
GPU_SHADER_CREATE_INFO(workbench_texture_none).define("TEXTURE_NONE");
GPU_SHADER_CREATE_INFO(workbench_texture_single)
.sampler(2, ImageType::FLOAT_2D, "imageTexture", Frequency::BATCH)
.push_constant(Type::BOOL, "imagePremult")
.push_constant(Type::FLOAT, "imageTransparencyCutoff")
.define("WORKBENCH_COLOR_TEXTURE");
GPU_SHADER_CREATE_INFO(workbench_texture_tile)
.sampler(2, ImageType::FLOAT_2D_ARRAY, "imageTileArray", Frequency::BATCH)
.sampler(3, ImageType::FLOAT_1D_ARRAY, "imageTileData", Frequency::BATCH)
.push_constant(Type::BOOL, "imagePremult")
.push_constant(Type::FLOAT, "imageTransparencyCutoff")
.define("WORKBENCH_COLOR_TEXTURE")
.define("WORKBENCH_TEXTURE_IMAGE_ARRAY");
/** \} */
/* -------------------------------------------------------------------- */
/** \name Lighting Type (only for transparent)
* \{ */
@ -113,25 +64,6 @@ GPU_SHADER_INTERFACE_INFO(workbench_material_iface, "")
.flat(Type::FLOAT, "_roughness")
.flat(Type::FLOAT, "metallic");
GPU_SHADER_CREATE_INFO(workbench_material)
.uniform_buf(WB_WORLD_SLOT, "WorldData", "world_data")
.uniform_buf(WB_MATERIAL_SLOT, "vec4", "materials_data[4096]")
.push_constant(Type::INT, "materialIndex")
.push_constant(Type::BOOL, "useMatcap")
.vertex_out(workbench_material_iface);
GPU_SHADER_CREATE_INFO(workbench_next_prepass)
.define("WORKBENCH_NEXT")
.uniform_buf(WB_WORLD_SLOT, "WorldData", "world_data")
.vertex_out(workbench_material_iface)
.additional_info("draw_view");
/** \} */
/* -------------------------------------------------------------------- */
/** \name Material Interface
* \{ */
GPU_SHADER_CREATE_INFO(workbench_color_material)
.define("WORKBENCH_COLOR_MATERIAL")
.storage_buf(WB_MATERIAL_SLOT, Qualifier::READ, "vec4", "materials_data[]");
@ -150,6 +82,12 @@ GPU_SHADER_CREATE_INFO(workbench_color_texture)
GPU_SHADER_CREATE_INFO(workbench_color_vertex).define("WORKBENCH_COLOR_VERTEX");
GPU_SHADER_CREATE_INFO(workbench_next_prepass)
.define("WORKBENCH_NEXT")
.uniform_buf(WB_WORLD_SLOT, "WorldData", "world_data")
.vertex_out(workbench_material_iface)
.additional_info("draw_view");
/** \} */
/* -------------------------------------------------------------------- */
@ -175,52 +113,6 @@ GPU_SHADER_CREATE_INFO(workbench_opaque)
/** \} */
/* -------------------------------------------------------------------- */
/** \name Variations Declaration
* \{ */
#define WORKBENCH_FINAL_VARIATION(name, ...) \
GPU_SHADER_CREATE_INFO(name).additional_info(__VA_ARGS__).do_static_compilation(true);
#define WORKBENCH_CLIPPING_VARIATIONS(prefix, ...) \
WORKBENCH_FINAL_VARIATION(prefix##_clip, "drw_clipped", __VA_ARGS__) \
WORKBENCH_FINAL_VARIATION(prefix##_no_clip, __VA_ARGS__)
#define WORKBENCH_TEXTURE_VARIATIONS(prefix, ...) \
WORKBENCH_CLIPPING_VARIATIONS(prefix##_tex_none, "workbench_texture_none", __VA_ARGS__) \
WORKBENCH_CLIPPING_VARIATIONS(prefix##_tex_single, "workbench_texture_single", __VA_ARGS__) \
WORKBENCH_CLIPPING_VARIATIONS(prefix##_tex_tile, "workbench_texture_tile", __VA_ARGS__)
#define WORKBENCH_DATATYPE_VARIATIONS(prefix, ...) \
WORKBENCH_TEXTURE_VARIATIONS(prefix##_mesh, "workbench_mesh", __VA_ARGS__) \
WORKBENCH_TEXTURE_VARIATIONS(prefix##_hair, "workbench_hair", __VA_ARGS__) \
WORKBENCH_TEXTURE_VARIATIONS(prefix##_ptcloud, "workbench_pointcloud", __VA_ARGS__)
#define WORKBENCH_PIPELINE_VARIATIONS(prefix, ...) \
WORKBENCH_DATATYPE_VARIATIONS(prefix##_transp_studio, \
"workbench_transparent_accum", \
"workbench_lighting_studio", \
__VA_ARGS__) \
WORKBENCH_DATATYPE_VARIATIONS(prefix##_transp_matcap, \
"workbench_transparent_accum", \
"workbench_lighting_matcap", \
__VA_ARGS__) \
WORKBENCH_DATATYPE_VARIATIONS(prefix##_transp_flat, \
"workbench_transparent_accum", \
"workbench_lighting_flat", \
__VA_ARGS__) \
WORKBENCH_DATATYPE_VARIATIONS(prefix##_opaque, "workbench_opaque", __VA_ARGS__)
WORKBENCH_PIPELINE_VARIATIONS(workbench, "workbench_material");
#undef WORKBENCH_FINAL_VARIATION
#undef WORKBENCH_CLIPPING_VARIATIONS
#undef WORKBENCH_TEXTURE_VARIATIONS
#undef WORKBENCH_DATATYPE_VARIATIONS
#undef WORKBENCH_PIPELINE_VARIATIONS
/** \} */
/* -------------------------------------------------------------------- */
/** \name Variations Declaration
* \{ */

View File

@ -17,12 +17,6 @@ GPU_SHADER_INTERFACE_INFO(workbench_shadow_iface, "vData")
GPU_SHADER_INTERFACE_INFO(workbench_shadow_flat_iface, "vData_flat")
.flat(Type::VEC3, "light_direction_os"); /*Workbench Next*/
GPU_SHADER_CREATE_INFO(workbench_shadow_common)
.vertex_in(0, Type::VEC3, "pos")
.push_constant(Type::FLOAT, "lightDistance")
.push_constant(Type::VEC3, "lightDirection")
.additional_info("draw_mesh");
/* `workbench_shadow_vert.glsl` only used by geometry shader path.
* Vertex output iface not needed by non-geometry shader variants,
* as only gl_Position is returned. */
@ -33,7 +27,6 @@ GPU_SHADER_CREATE_INFO(workbench_shadow_common_geom)
GPU_SHADER_CREATE_INFO(workbench_next_shadow_common)
.vertex_in(0, Type::VEC3, "pos")
.define("WORKBENCH_NEXT")
.uniform_buf(1, "ShadowPassData", "pass_data")
.typedef_source("workbench_shader_shared.h")
.additional_info("draw_view")
@ -161,16 +154,6 @@ GPU_SHADER_CREATE_INFO(workbench_next_shadow_debug).additional_info("workbench_s
.additional_info(common, "workbench_shadow_no_manifold", __VA_ARGS__) \
.do_static_compilation(true);
WORKBENCH_SHADOW_VARIATIONS("workbench_shadow_common",
workbench_shadow,
,
"workbench_shadow_no_debug")
WORKBENCH_SHADOW_VARIATIONS("workbench_shadow_common",
workbench_shadow,
_debug,
"workbench_shadow_debug")
WORKBENCH_SHADOW_VARIATIONS("workbench_next_shadow_common",
workbench_next_shadow,
,

View File

@ -20,9 +20,6 @@ GPU_SHADER_CREATE_INFO(workbench_volume_common)
.vertex_source("workbench_volume_vert.glsl")
.fragment_source("workbench_volume_frag.glsl");
GPU_SHADER_CREATE_INFO(workbench_volume)
.additional_info("workbench_volume_common", "draw_object_infos");
GPU_SHADER_CREATE_INFO(workbench_next_volume)
.define("WORKBENCH_NEXT")
.sampler(6, ImageType::UINT_2D, "stencil_tx")
@ -46,12 +43,6 @@ GPU_SHADER_CREATE_INFO(workbench_volume_object_common)
.push_constant(Type::MAT4, "volumeObjectToTexture")
.additional_info("draw_resource_id_varying");
GPU_SHADER_CREATE_INFO(workbench_volume_smoke)
.additional_info("workbench_volume_smoke_common", "draw_mesh");
GPU_SHADER_CREATE_INFO(workbench_volume_object)
.additional_info("workbench_volume_object_common", "draw_volume");
GPU_SHADER_CREATE_INFO(workbench_next_volume_smoke)
.additional_info("workbench_volume_smoke_common", "draw_modelmat_new");
@ -125,12 +116,6 @@ GPU_SHADER_CREATE_INFO(workbench_volume_slice)
WORKBENCH_VOLUME_COBA_VARIATIONS(prefix##_cubic, "workbench_volume_cubic", __VA_ARGS__) \
WORKBENCH_VOLUME_COBA_VARIATIONS(prefix##_closest, "workbench_volume_closest", __VA_ARGS__)
#define WORKBENCH_VOLUME_SMOKE_VARIATIONS(prefix, ...) \
WORKBENCH_VOLUME_INTERP_VARIATIONS(prefix##_smoke, "workbench_volume_smoke", __VA_ARGS__) \
WORKBENCH_VOLUME_INTERP_VARIATIONS(prefix##_object, "workbench_volume_object", __VA_ARGS__)
WORKBENCH_VOLUME_SMOKE_VARIATIONS(workbench_volume, "workbench_volume")
#define WORKBENCH_NEXT_VOLUME_SMOKE_VARIATIONS(prefix, ...) \
WORKBENCH_VOLUME_INTERP_VARIATIONS(prefix##_smoke, "workbench_next_volume_smoke", __VA_ARGS__) \
WORKBENCH_VOLUME_INTERP_VARIATIONS(prefix##_object, "workbench_next_volume_object", __VA_ARGS__)

View File

@ -1,40 +0,0 @@
/* SPDX-FileCopyrightText: 2020-2023 Blender Authors
*
* SPDX-License-Identifier: GPL-2.0-or-later */
#pragma BLENDER_REQUIRE(common_view_lib.glsl)
#pragma BLENDER_REQUIRE(workbench_common_lib.glsl)
#pragma BLENDER_REQUIRE(workbench_matcap_lib.glsl)
#pragma BLENDER_REQUIRE(workbench_world_light_lib.glsl)
void main()
{
/* Normal and Incident vector are in view-space. Lighting is evaluated in view-space. */
vec3 I = get_view_vector_from_screen_uv(uvcoordsvar.st);
vec3 N = workbench_normal_decode(texture(normalBuffer, uvcoordsvar.st));
vec4 mat_data = texture(materialBuffer, uvcoordsvar.st);
vec3 base_color = mat_data.rgb;
float roughness, metallic;
workbench_float_pair_decode(mat_data.a, roughness, metallic);
#ifdef WORKBENCH_LIGHTING_MATCAP
/* When using matcaps, mat_data.a is the back-face sign. */
N = (mat_data.a > 0.0) ? N : -N;
fragColor.rgb = get_matcap_lighting(matcap_diffuse_tx, matcap_specular_tx, base_color, N, I);
#endif
#ifdef WORKBENCH_LIGHTING_STUDIO
fragColor.rgb = get_world_lighting(base_color, roughness, metallic, N, I);
#endif
#ifdef WORKBENCH_LIGHTING_FLAT
fragColor.rgb = base_color;
#endif
fragColor.rgb *= get_shadow(N, forceShadowing);
fragColor.a = 1.0;
}

View File

@ -1,26 +0,0 @@
/* SPDX-FileCopyrightText: 2020-2022 Blender Authors
*
* SPDX-License-Identifier: GPL-2.0-or-later */
#pragma BLENDER_REQUIRE(common_view_lib.glsl)
#pragma BLENDER_REQUIRE(workbench_common_lib.glsl)
#pragma BLENDER_REQUIRE(workbench_cavity_lib.glsl)
#pragma BLENDER_REQUIRE(workbench_curvature_lib.glsl)
void main()
{
float cavity = 0.0, edges = 0.0, curvature = 0.0;
#ifdef USE_CAVITY
cavity_compute(uvcoordsvar.xy, depthBuffer, normalBuffer, cavity, edges);
#endif
#ifdef USE_CURVATURE
curvature_compute(uvcoordsvar.xy, objectIdBuffer, normalBuffer, curvature);
#endif
float final_cavity_factor = clamp((1.0 - cavity) * (1.0 + edges) * (1.0 + curvature), 0.0, 4.0);
fragColor.rgb = vec3(final_cavity_factor);
fragColor.a = 1.0;
}

View File

@ -33,8 +33,6 @@ vec3 workbench_image_color(vec2 uvs)
#ifdef WORKBENCH_COLOR_TEXTURE
vec4 color;
# ifdef WORKBENCH_NEXT
vec3 co = vec3(uvs, 0.0);
if (isImageTile) {
if (node_tex_tile_lookup(co, imageTileArray, imageTileData)) {
@ -48,23 +46,6 @@ vec3 workbench_image_color(vec2 uvs)
color = texture(imageTexture, uvs);
}
# else // WORKBENCH_NEXT
# ifdef WORKBENCH_TEXTURE_IMAGE_ARRAY
vec3 co = vec3(uvs, 0.0);
if (node_tex_tile_lookup(co, imageTileArray, imageTileData)) {
color = texture(imageTileArray, co);
}
else {
color = vec4(1.0, 0.0, 1.0, 1.0);
}
# else
color = texture(imageTexture, uvs);
# endif
# endif // WORKBENCH_NEXT
/* Unpremultiply if stored multiplied, since straight alpha is expected by shaders. */
if (imagePremult && !(color.a == 0.0 || color.a == 1.0)) {
color.rgb /= color.a;

View File

@ -9,22 +9,12 @@ void workbench_material_data_get(int handle,
out float roughness,
out float metallic)
{
#ifndef WORKBENCH_NEXT
handle = (materialIndex != -1) ? materialIndex : handle;
vec4 data = materials_data[uint(handle) & 0xFFFu];
color = data.rgb;
if (materialIndex == 0) {
color = vertex_color;
}
#else
# ifdef WORKBENCH_COLOR_MATERIAL
#ifdef WORKBENCH_COLOR_MATERIAL
vec4 data = materials_data[handle];
# else
#else
vec4 data = vec4(0.0);
# endif
color = (data.r == -1) ? vertex_color : data.rgb;
#endif
color = (data.r == -1) ? vertex_color : data.rgb;
uint encoded_data = floatBitsToUint(data.w);
alpha = float((encoded_data >> 16u) & 0xFFu) * (1.0 / 255.0);

View File

@ -1,17 +0,0 @@
/* SPDX-FileCopyrightText: 2020-2023 Blender Authors
*
* SPDX-License-Identifier: GPL-2.0-or-later */
void main()
{
float depth = texture(depthBuffer, uvcoordsvar.xy).r;
/* Fix issues with Intel drivers (see #80023). */
fragColor = vec4(0.0);
/* Discard background pixels. */
if (depth == 1.0) {
discard;
}
/* Make this fragment occlude any fragment that will try to
* render over it in the normal passes. */
gl_FragDepth = 0.0;
}

View File

@ -6,8 +6,6 @@
#pragma BLENDER_REQUIRE(workbench_common_lib.glsl)
#pragma BLENDER_REQUIRE(workbench_image_lib.glsl)
#ifdef WORKBENCH_NEXT
void main()
{
out_object_id = uint(object_id);
@ -15,34 +13,12 @@ void main()
out_material = vec4(color_interp, workbench_float_pair_encode(_roughness, metallic));
# ifdef WORKBENCH_COLOR_TEXTURE
#ifdef WORKBENCH_COLOR_TEXTURE
out_material.rgb = workbench_image_color(uv_interp);
# endif
#endif
# ifdef WORKBENCH_LIGHTING_MATCAP
#ifdef WORKBENCH_LIGHTING_MATCAP
/* For matcaps, save front facing in alpha channel. */
out_material.a = float(gl_FrontFacing);
# endif
}
#else
void main()
{
out_normal = workbench_normal_encode(gl_FrontFacing, normal_interp);
out_material = vec4(color_interp, workbench_float_pair_encode(_roughness, metallic));
out_object_id = uint(object_id);
if (useMatcap) {
/* For matcaps, save front facing in alpha channel. */
out_material.a = float(gl_FrontFacing);
}
# ifdef WORKBENCH_COLOR_TEXTURE
out_material.rgb = workbench_image_color(uv_interp);
# endif
}
#endif
}

View File

@ -72,21 +72,12 @@ void main()
normal_interp = normalize(normal_world_to_view(nor));
#ifdef WORKBENCH_NEXT
workbench_material_data_get(int(drw_CustomID),
hair_get_customdata_vec3(ac),
color_interp,
alpha_interp,
_roughness,
metallic);
#else
workbench_material_data_get(resource_handle,
hair_get_customdata_vec3(ac),
color_interp,
alpha_interp,
_roughness,
metallic);
#endif
/* Hairs have lots of layer and can rapidly become the most prominent surface.
* So we lower their alpha artificially. */
@ -96,9 +87,7 @@ void main()
object_id = int(uint(resource_handle) & 0xFFFFu) + 1;
#ifdef WORKBENCH_NEXT
if (emitter_object_id != 0) {
object_id = int(uint(emitter_object_id) & 0xFFFFu) + 1;
}
#endif
}

View File

@ -22,13 +22,8 @@ void main()
uv_interp = vec2(0.0);
#ifdef WORKBENCH_NEXT
workbench_material_data_get(
int(drw_CustomID), vec3(1.0), color_interp, alpha_interp, _roughness, metallic);
#else
workbench_material_data_get(
resource_handle, vec3(1.0), color_interp, alpha_interp, _roughness, metallic);
#endif
object_id = int(uint(resource_handle) & 0xFFFFu) + 1;
}

View File

@ -20,11 +20,7 @@ void main()
normal_interp = normalize(normal_object_to_view(nor));
object_id = int(uint(resource_id) & 0xFFFFu) + 1;
#ifdef WORKBENCH_NEXT
workbench_material_data_get(
int(drw_CustomID), ac.rgb, color_interp, alpha_interp, _roughness, metallic);
#else
workbench_material_data_get(
resource_handle, ac.rgb, color_interp, alpha_interp, _roughness, metallic);
#endif
}

View File

@ -38,11 +38,8 @@ void main()
vec3 v12 = vData[2].pos - vData[1].pos;
vec3 n = cross(v12, v10);
#ifdef WORKBENCH_NEXT
float facing = dot(n, vData_flat[0].light_direction_os);
#else
float facing = dot(n, lightDirection);
#endif
bool backface = facing > 0.0;

View File

@ -33,7 +33,6 @@ vec4 get_pos(int v, bool backface)
vec3 extrude_offset(vec3 ls_P)
{
#ifdef WORKBENCH_NEXT
vec3 ws_P = point_object_to_world(ls_P);
float extrude_distance = 1e5f;
float L_dot_FP = dot(pass_data.light_direction_ws, pass_data.far_plane.xyz);
@ -43,9 +42,6 @@ vec3 extrude_offset(vec3 ls_P)
}
vec3 ls_light_direction = normal_world_to_object(vec3(pass_data.light_direction_ws));
return ls_light_direction * extrude_distance;
#else
return lightDirection * lightDistance;
#endif
}
void emit_cap(const bool front, bool reversed, int triangle_vertex_id)
@ -102,9 +98,7 @@ void main()
vec3 v10 = vData[0].pos - vData[1].pos;
vec3 v12 = vData[2].pos - vData[1].pos;
#ifdef WORKBENCH_NEXT
vec3 lightDirection = normal_world_to_object(vec3(pass_data.light_direction_ws));
#endif
vec3 n = cross(v12, v10);
float facing = dot(n, lightDirection);

View File

@ -46,12 +46,8 @@ void main()
}
#endif
#ifdef WORKBENCH_NEXT
vec2 facing = vec2(dot(n1, vData_flat[0].light_direction_os),
dot(n2, vData_flat[0].light_direction_os));
#else
vec2 facing = vec2(dot(n1, lightDirection), dot(n2, lightDirection));
#endif
/* WATCH: maybe unpredictable in some cases. */
bool is_manifold = any(notEqual(vData[0].pos, vData[3].pos));

View File

@ -8,7 +8,6 @@ void main()
{
vData.pos = pos;
vData.frontPosition = point_object_to_ndc(pos);
#ifdef WORKBENCH_NEXT
vData_flat.light_direction_os = normal_world_to_object(vec3(pass_data.light_direction_ws));
vec3 pos_ws = point_object_to_world(pos);
float extrude_distance = 1e5f;
@ -19,7 +18,4 @@ void main()
}
vData.backPosition = point_world_to_ndc(pos_ws +
pass_data.light_direction_ws * extrude_distance);
#else
vData.backPosition = point_object_to_ndc(pos + lightDirection * lightDistance);
#endif
}

View File

@ -64,7 +64,6 @@ void extrude_edge(bool invert, int output_vertex_id)
vec3 extrude_offset(vec3 ls_P)
{
#ifdef WORKBENCH_NEXT
vec3 ws_P = point_object_to_world(ls_P);
float extrude_distance = 1e5f;
float L_dot_FP = dot(pass_data.light_direction_ws, pass_data.far_plane.xyz);
@ -74,9 +73,6 @@ vec3 extrude_offset(vec3 ls_P)
}
vec3 ls_light_direction = normal_world_to_object(vec3(pass_data.light_direction_ws));
return ls_light_direction * extrude_distance;
#else
return lightDirection * lightDistance;
#endif
}
void main()
@ -133,9 +129,8 @@ void main()
}
#endif
#ifdef WORKBENCH_NEXT
vec3 lightDirection = normal_world_to_object(vec3(pass_data.light_direction_ws));
#endif
vec2 facing = vec2(dot(n1, lightDirection), dot(n2, lightDirection));
/* WATCH: maybe unpredictable in some cases. */

View File

@ -48,8 +48,6 @@ float calculate_transparent_weight(void)
return clamp(w, 1e-2, 3e2);
}
#ifdef WORKBENCH_NEXT
void main()
{
/* Normal and Incident vector are in view-space. Lighting is evaluated in view-space. */
@ -59,21 +57,21 @@ void main()
vec3 color = color_interp;
# ifdef WORKBENCH_COLOR_TEXTURE
#ifdef WORKBENCH_COLOR_TEXTURE
color = workbench_image_color(uv_interp);
# endif
#endif
# ifdef WORKBENCH_LIGHTING_MATCAP
#ifdef WORKBENCH_LIGHTING_MATCAP
vec3 shaded_color = get_matcap_lighting(matcap_tx, color, N, I);
# endif
#endif
# ifdef WORKBENCH_LIGHTING_STUDIO
#ifdef WORKBENCH_LIGHTING_STUDIO
vec3 shaded_color = get_world_lighting(color, _roughness, metallic, N, I);
# endif
#endif
# ifdef WORKBENCH_LIGHTING_FLAT
#ifdef WORKBENCH_LIGHTING_FLAT
vec3 shaded_color = color;
# endif
#endif
shaded_color *= get_shadow(N, forceShadowing);
@ -85,42 +83,3 @@ void main()
out_object_id = uint(object_id);
}
#else
void main()
{
/* Normal and Incident vector are in view-space. Lighting is evaluated in view-space. */
vec2 uv_viewport = gl_FragCoord.xy * world_data.viewport_size_inv;
vec3 I = get_view_vector_from_screen_uv(uv_viewport);
vec3 N = normalize(normal_interp);
vec3 color = color_interp;
# ifdef WORKBENCH_COLOR_TEXTURE
color = workbench_image_color(uv_interp);
# endif
# ifdef WORKBENCH_LIGHTING_MATCAP
vec3 shaded_color = get_matcap_lighting(matcap_diffuse_tx, matcap_specular_tx, color, N, I);
# endif
# ifdef WORKBENCH_LIGHTING_STUDIO
vec3 shaded_color = get_world_lighting(color, _roughness, metallic, N, I);
# endif
# ifdef WORKBENCH_LIGHTING_FLAT
vec3 shaded_color = color;
# endif
shaded_color *= get_shadow(N, forceShadowing);
/* Listing 4 */
float weight = calculate_transparent_weight() * alpha_interp;
out_transparent_accum = vec4(shaded_color * weight, alpha_interp);
out_revealage_accum = vec4(weight);
out_object_id = uint(object_id);
}
#endif

View File

@ -225,14 +225,13 @@ vec4 volume_integration(vec3 ray_ori, vec3 ray_dir, float ray_inc, float ray_max
void main()
{
#ifdef WORKBENCH_NEXT
uint stencil = texelFetch(stencil_tx, ivec2(gl_FragCoord.xy), 0).r;
if (stencil != 0) {
/* Don't draw on top of "in front" objects. */
discard;
return;
}
#endif
#ifdef VOLUME_SLICE
/* Manual depth test. TODO: remove. */
float depth = texelFetch(depthBuffer, ivec2(gl_FragCoord.xy), 0).r;

View File

@ -1,309 +0,0 @@
/* SPDX-FileCopyrightText: 2018 Blender Authors
*
* SPDX-License-Identifier: GPL-2.0-or-later */
/** \file
* \ingroup draw_engine
*/
#include "DRW_render.h"
#include "workbench_private.h"
#include "BLI_math_rotation.h"
#include "BLI_memblock.h"
#include "DNA_userdef_types.h"
#include "ED_screen.hh"
#include "ED_view3d.hh"
#include "UI_resources.hh"
#include "GPU_uniform_buffer.h"
/* -------------------------------------------------------------------- */
/** \name World Data
* \{ */
GPUUniformBuf *workbench_material_ubo_alloc(WORKBENCH_PrivateData *wpd)
{
GPUUniformBuf **ubo = static_cast<GPUUniformBuf **>(BLI_memblock_alloc(wpd->material_ubo));
if (*ubo == nullptr) {
*ubo = GPU_uniformbuf_create(sizeof(WORKBENCH_UBO_Material) * MAX_MATERIAL);
}
return *ubo;
}
static void workbench_ubo_free(void *elem)
{
GPUUniformBuf **ubo = static_cast<GPUUniformBuf **>(elem);
DRW_UBO_FREE_SAFE(*ubo);
}
static void workbench_view_layer_data_free(void *storage)
{
WORKBENCH_ViewLayerData *vldata = (WORKBENCH_ViewLayerData *)storage;
DRW_UBO_FREE_SAFE(vldata->dof_sample_ubo);
DRW_UBO_FREE_SAFE(vldata->world_ubo);
DRW_UBO_FREE_SAFE(vldata->cavity_sample_ubo);
DRW_TEXTURE_FREE_SAFE(vldata->cavity_jitter_tx);
BLI_memblock_destroy(vldata->material_ubo_data, nullptr);
BLI_memblock_destroy(vldata->material_ubo, workbench_ubo_free);
}
static WORKBENCH_ViewLayerData *workbench_view_layer_data_ensure_ex(ViewLayer *view_layer)
{
WORKBENCH_ViewLayerData **vldata = (WORKBENCH_ViewLayerData **)
DRW_view_layer_engine_data_ensure_ex(view_layer,
(DrawEngineType *)&workbench_view_layer_data_ensure_ex,
&workbench_view_layer_data_free);
if (*vldata == nullptr) {
*vldata = static_cast<WORKBENCH_ViewLayerData *>(
MEM_callocN(sizeof(**vldata), "WORKBENCH_ViewLayerData"));
size_t matbuf_size = sizeof(WORKBENCH_UBO_Material) * MAX_MATERIAL;
(*vldata)->material_ubo_data = BLI_memblock_create_ex(matbuf_size, matbuf_size * 2);
(*vldata)->material_ubo = BLI_memblock_create_ex(sizeof(void *), sizeof(void *) * 8);
(*vldata)->world_ubo = GPU_uniformbuf_create_ex(
sizeof(WORKBENCH_UBO_World), nullptr, "wb_World");
}
return *vldata;
}
/** \} */
static void workbench_studiolight_data_update(WORKBENCH_PrivateData *wpd, WORKBENCH_UBO_World *wd)
{
StudioLight *studiolight = wpd->studio_light;
float view_matrix[4][4], rot_matrix[4][4];
DRW_view_viewmat_get(nullptr, view_matrix, false);
if (USE_WORLD_ORIENTATION(wpd)) {
axis_angle_to_mat4_single(rot_matrix, 'Z', -wpd->shading.studiolight_rot_z);
mul_m4_m4m4(rot_matrix, view_matrix, rot_matrix);
swap_v3_v3(rot_matrix[2], rot_matrix[1]);
negate_v3(rot_matrix[2]);
}
else {
unit_m4(rot_matrix);
}
if (U.edit_studio_light) {
studiolight = BKE_studiolight_studio_edit_get();
}
/* Studio Lights. */
for (int i = 0; i < 4; i++) {
WORKBENCH_UBO_Light *light = &wd->lights[i];
SolidLight *sl = (studiolight) ? &studiolight->light[i] : nullptr;
if (sl && sl->flag) {
copy_v3_v3(light->light_direction, sl->vec);
mul_mat3_m4_v3(rot_matrix, light->light_direction);
/* We should pre-divide the power by PI but that makes the lights really dim. */
copy_v3_v3(light->specular_color, sl->spec);
copy_v3_v3(light->diffuse_color, sl->col);
light->wrapped = sl->smooth;
}
else {
copy_v3_fl3(light->light_direction, 1.0f, 0.0f, 0.0f);
copy_v3_fl(light->specular_color, 0.0f);
copy_v3_fl(light->diffuse_color, 0.0f);
light->wrapped = 0.0f;
}
}
if (studiolight) {
copy_v3_v3(wd->ambient_color, studiolight->light_ambient);
}
else {
copy_v3_fl(wd->ambient_color, 1.0f);
}
wd->use_specular = workbench_is_specular_highlight_enabled(wpd);
}
void workbench_private_data_alloc(WORKBENCH_StorageList *stl)
{
if (!stl->wpd) {
stl->wpd = static_cast<WORKBENCH_PrivateData *>(MEM_callocN(sizeof(*stl->wpd), __func__));
stl->wpd->taa_sample_len_previous = -1;
stl->wpd->view_updated = true;
}
}
void workbench_private_data_init(WORKBENCH_PrivateData *wpd)
{
const DRWContextState *draw_ctx = DRW_context_state_get();
RegionView3D *rv3d = draw_ctx->rv3d;
View3D *v3d = draw_ctx->v3d;
Scene *scene = draw_ctx->scene;
WORKBENCH_ViewLayerData *vldata = workbench_view_layer_data_ensure_ex(draw_ctx->view_layer);
wpd->is_playback = DRW_state_is_playback();
wpd->is_navigating = DRW_state_is_navigating();
wpd->ctx_mode = CTX_data_mode_enum_ex(
draw_ctx->object_edit, draw_ctx->obact, draw_ctx->object_mode);
wpd->preferences = &U;
wpd->scene = scene;
wpd->sh_cfg = draw_ctx->sh_cfg;
/* FIXME: This reproduce old behavior when workbench was separated in 2 engines.
* But this is a workaround for a missing update tagging. */
DRWState clip_state = RV3D_CLIPPING_ENABLED(v3d, rv3d) ? DRW_STATE_CLIP_PLANES : DRWState(0);
if (clip_state != wpd->clip_state) {
wpd->view_updated = true;
}
wpd->clip_state = clip_state;
wpd->vldata = vldata;
wpd->world_ubo = vldata->world_ubo;
wpd->taa_sample_len = workbench_antialiasing_sample_count_get(wpd);
wpd->volumes_do = false;
/* FIXME: This reproduce old behavior when workbench was separated in 2 engines.
* But this is a workaround for a missing update tagging. */
if ((rv3d != nullptr) && (rv3d->rflag & RV3D_GPULIGHT_UPDATE)) {
wpd->view_updated = true;
rv3d->rflag &= ~RV3D_GPULIGHT_UPDATE;
}
if (!v3d || (v3d->shading.type == OB_RENDER && BKE_scene_uses_blender_workbench(scene))) {
short shading_flag = scene->display.shading.flag;
if (XRAY_FLAG_ENABLED(&scene->display)) {
/* Disable shading options that aren't supported in transparency mode. */
shading_flag &= ~(V3D_SHADING_SHADOW | V3D_SHADING_CAVITY | V3D_SHADING_DEPTH_OF_FIELD);
}
/* FIXME: This reproduce old behavior when workbench was separated in 2 engines.
* But this is a workaround for a missing update tagging from operators. */
if ((XRAY_ENABLED(wpd) != XRAY_ENABLED(&scene->display)) ||
(shading_flag != wpd->shading.flag)) {
wpd->view_updated = true;
}
wpd->shading = scene->display.shading;
wpd->shading.flag = shading_flag;
if (XRAY_FLAG_ENABLED(&scene->display)) {
wpd->shading.xray_alpha = XRAY_ALPHA(&scene->display);
}
else {
wpd->shading.xray_alpha = 1.0f;
}
if (scene->r.alphamode == R_ALPHAPREMUL) {
copy_v4_fl(wpd->background_color, 0.0f);
}
else if (scene->world) {
World *wo = scene->world;
copy_v4_fl4(wpd->background_color, wo->horr, wo->horg, wo->horb, 1.0f);
}
else {
copy_v4_fl4(wpd->background_color, 0.0f, 0.0f, 0.0f, 1.0f);
}
}
else {
short shading_flag = v3d->shading.flag;
if (XRAY_ENABLED(v3d)) {
/* Disable shading options that aren't supported in transparency mode. */
shading_flag &= ~(V3D_SHADING_SHADOW | V3D_SHADING_CAVITY | V3D_SHADING_DEPTH_OF_FIELD);
}
/* FIXME: This reproduce old behavior when workbench was separated in 2 engines.
* But this is a workaround for a missing update tagging from operators. */
if (XRAY_ENABLED(v3d) != XRAY_ENABLED(wpd) || shading_flag != wpd->shading.flag) {
wpd->view_updated = true;
}
wpd->shading = v3d->shading;
wpd->shading.flag = shading_flag;
if (wpd->shading.type < OB_SOLID) {
wpd->shading.light = V3D_LIGHTING_FLAT;
wpd->shading.color_type = V3D_SHADING_OBJECT_COLOR;
wpd->shading.xray_alpha = 0.0f;
}
else if (XRAY_ENABLED(v3d)) {
wpd->shading.xray_alpha = XRAY_ALPHA(v3d);
}
else {
wpd->shading.xray_alpha = 1.0f;
}
/* No background. The overlays will draw the correct one. */
copy_v4_fl(wpd->background_color, 0.0f);
}
wpd->cull_state = CULL_BACKFACE_ENABLED(wpd) ? DRW_STATE_CULL_BACK : DRWState(0);
if (wpd->shading.light == V3D_LIGHTING_MATCAP) {
wpd->studio_light = BKE_studiolight_find(wpd->shading.matcap, STUDIOLIGHT_TYPE_MATCAP);
}
else {
wpd->studio_light = BKE_studiolight_find(wpd->shading.studio_light, STUDIOLIGHT_TYPE_STUDIO);
}
/* If matcaps are missing, use this as fallback. */
if (UNLIKELY(wpd->studio_light == nullptr)) {
wpd->studio_light = BKE_studiolight_find(wpd->shading.studio_light, STUDIOLIGHT_TYPE_STUDIO);
}
{
/* Material UBOs. */
wpd->material_ubo_data = vldata->material_ubo_data;
wpd->material_ubo = vldata->material_ubo;
wpd->material_chunk_count = 1;
wpd->material_chunk_curr = 0;
wpd->material_index = 1;
/* Create default material ubo. */
wpd->material_ubo_data_curr = static_cast<WORKBENCH_UBO_Material *>(
BLI_memblock_alloc(wpd->material_ubo_data));
wpd->material_ubo_curr = workbench_material_ubo_alloc(wpd);
/* Init default material used by vertex color & texture. */
workbench_material_ubo_data(
wpd, nullptr, nullptr, &wpd->material_ubo_data_curr[0], V3D_SHADING_MATERIAL_COLOR);
}
}
void workbench_update_world_ubo(WORKBENCH_PrivateData *wpd)
{
WORKBENCH_UBO_World wd;
copy_v2_v2(wd.viewport_size, DRW_viewport_size_get());
copy_v2_v2(wd.viewport_size_inv, DRW_viewport_invert_size_get());
copy_v3_v3(wd.object_outline_color, wpd->shading.object_outline_color);
wd.object_outline_color[3] = 1.0f;
wd.ui_scale = DRW_state_is_image_render() ? 1.0f : G_draw.block.size_pixel;
wd.matcap_orientation = (wpd->shading.flag & V3D_SHADING_MATCAP_FLIP_X) != 0;
workbench_studiolight_data_update(wpd, &wd);
workbench_shadow_data_update(wpd, &wd);
workbench_cavity_data_update(wpd, &wd);
GPU_uniformbuf_update(wpd->world_ubo, &wd);
}
void workbench_update_material_ubos(WORKBENCH_PrivateData * /*wpd*/)
{
const DRWContextState *draw_ctx = DRW_context_state_get();
WORKBENCH_ViewLayerData *vldata = workbench_view_layer_data_ensure_ex(draw_ctx->view_layer);
BLI_memblock_iter iter, iter_data;
BLI_memblock_iternew(vldata->material_ubo, &iter);
BLI_memblock_iternew(vldata->material_ubo_data, &iter_data);
WORKBENCH_UBO_Material *matchunk;
while ((matchunk = static_cast<WORKBENCH_UBO_Material *>(BLI_memblock_iterstep(&iter_data)))) {
GPUUniformBuf **ubo = static_cast<GPUUniformBuf **>(BLI_memblock_iterstep(&iter));
BLI_assert(*ubo != nullptr);
GPU_uniformbuf_update(*ubo, matchunk);
}
BLI_memblock_clear(vldata->material_ubo, workbench_ubo_free);
BLI_memblock_clear(vldata->material_ubo_data, nullptr);
}

View File

@ -1,504 +0,0 @@
/* SPDX-FileCopyrightText: 2020 Blender Authors
*
* SPDX-License-Identifier: GPL-2.0-or-later */
/** \file
* \ingroup draw_engine
*
* Anti-Aliasing:
*
* We use SMAA (Smart Morphological Anti-Aliasing) as a fast antialiasing solution.
*
* If the viewport stays static, the engine ask for multiple redraw and will progressively
* converge to a much more accurate image without aliasing.
* We call this one TAA (Temporal Anti-Aliasing).
*
* This is done using an accumulation buffer and a final pass that will output the final color
* to the scene buffer. We softly blend between SMAA and TAA to avoid really harsh transitions.
*/
#include "ED_screen.hh"
#include "BLI_jitter_2d.h"
#include "BLI_smaa_textures.h"
#include "workbench_private.h"
static struct {
bool init;
float jitter_5[5][2];
float jitter_8[8][2];
float jitter_11[11][2];
float jitter_16[16][2];
float jitter_32[32][2];
} e_data = {false};
static void workbench_taa_jitter_init_order(float (*table)[2], int num)
{
BLI_jitter_init(table, num);
/* find closest element to center */
int closest_index = 0;
float closest_squared_distance = 1.0f;
for (int index = 0; index < num; index++) {
const float squared_dist = square_f(table[index][0]) + square_f(table[index][1]);
if (squared_dist < closest_squared_distance) {
closest_squared_distance = squared_dist;
closest_index = index;
}
}
float closest_sample[2];
copy_v2_v2(closest_sample, table[closest_index]);
for (int index = 0; index < num; index++) {
/* move jitter table so that closest sample is in center */
sub_v2_v2(table[index], closest_sample);
for (int i = 0; i < 2; i++) {
/* Avoid samples outside range (wrap around). */
table[index][i] = fmodf(table[index][i] + 0.5f, 1.0f);
/* Recenter the distribution[-1..1]. */
table[index][i] = table[index][i] * 2.0f - 1.0f;
}
}
/* swap center sample to the start of the table */
if (closest_index != 0) {
swap_v2_v2(table[0], table[closest_index]);
}
/* Sort list based on farthest distance with previous. */
for (int i = 0; i < num - 2; i++) {
float f_squared_dist = 0.0;
int f_index = i;
for (int j = i + 1; j < num; j++) {
const float squared_dist = square_f(table[i][0] - table[j][0]) +
square_f(table[i][1] - table[j][1]);
if (squared_dist > f_squared_dist) {
f_squared_dist = squared_dist;
f_index = j;
}
}
swap_v2_v2(table[i + 1], table[f_index]);
}
}
static void workbench_taa_jitter_init()
{
if (e_data.init == false) {
e_data.init = true;
workbench_taa_jitter_init_order(e_data.jitter_5, 5);
workbench_taa_jitter_init_order(e_data.jitter_8, 8);
workbench_taa_jitter_init_order(e_data.jitter_11, 11);
workbench_taa_jitter_init_order(e_data.jitter_16, 16);
workbench_taa_jitter_init_order(e_data.jitter_32, 32);
}
}
int workbench_antialiasing_sample_count_get(WORKBENCH_PrivateData *wpd)
{
const DRWContextState *draw_ctx = DRW_context_state_get();
const Scene *scene = draw_ctx->scene;
if (wpd->is_navigating || wpd->is_playback) {
/* Only draw using SMAA or no AA when navigating. */
return min_ii(wpd->preferences->viewport_aa, 1);
}
if (DRW_state_is_image_render()) {
if (draw_ctx->v3d) {
return scene->display.viewport_aa;
}
return scene->display.render_aa;
}
return wpd->preferences->viewport_aa;
}
void workbench_antialiasing_view_updated(WORKBENCH_Data *vedata)
{
WORKBENCH_StorageList *stl = vedata->stl;
if (stl && stl->wpd) {
stl->wpd->view_updated = true;
}
}
/* This function checks if the overlay engine should need center in front depth's.
* When that is the case the in front depth are stored and restored. Otherwise it
* will be filled with the current sample data. */
static bool workbench_in_front_history_needed(WORKBENCH_Data *vedata)
{
WORKBENCH_StorageList *stl = vedata->stl;
const DRWContextState *draw_ctx = DRW_context_state_get();
const View3D *v3d = draw_ctx->v3d;
if (!v3d || (v3d->flag2 & V3D_HIDE_OVERLAYS)) {
return false;
}
if (stl->wpd->is_playback) {
return false;
}
return true;
}
void workbench_antialiasing_engine_init(WORKBENCH_Data *vedata)
{
WORKBENCH_FramebufferList *fbl = vedata->fbl;
WORKBENCH_TextureList *txl = vedata->txl;
WORKBENCH_PrivateData *wpd = vedata->stl->wpd;
DrawEngineType *owner = (DrawEngineType *)&workbench_antialiasing_engine_init;
wpd->view = nullptr;
/* Reset complete drawing when navigating or during viewport playback or when
* leaving one of those states. In case of multires modifier the navigation
* mesh differs from the viewport mesh, so we need to be sure to restart. */
if (wpd->taa_sample != 0) {
if (wpd->is_navigating || wpd->is_playback) {
wpd->taa_sample = 0;
wpd->reset_next_sample = true;
}
else if (wpd->reset_next_sample) {
wpd->taa_sample = 0;
wpd->reset_next_sample = false;
}
}
/* Reset the TAA when we have already draw a sample, but the sample count differs from previous
* time. This removes render artifacts when the viewport anti-aliasing in the user preferences is
* set to a lower value. */
if (wpd->taa_sample_len != wpd->taa_sample_len_previous) {
wpd->taa_sample = 0;
wpd->taa_sample_len_previous = wpd->taa_sample_len;
}
if (wpd->view_updated) {
wpd->taa_sample = 0;
wpd->view_updated = false;
}
if (wpd->taa_sample_len > 0 && wpd->valid_history == false) {
wpd->taa_sample = 0;
}
{
float persmat[4][4];
DRW_view_persmat_get(nullptr, persmat, false);
if (!equals_m4m4(persmat, wpd->last_mat)) {
copy_m4_m4(wpd->last_mat, persmat);
wpd->taa_sample = 0;
}
}
if (wpd->taa_sample_len > 0) {
workbench_taa_jitter_init();
eGPUTextureUsage usage = GPU_TEXTURE_USAGE_SHADER_READ | GPU_TEXTURE_USAGE_ATTACHMENT;
DRW_texture_ensure_fullscreen_2d_ex(
&txl->history_buffer_tx, GPU_RGBA16F, usage, DRW_TEX_FILTER);
DRW_texture_ensure_fullscreen_2d_ex(
&txl->depth_buffer_tx, GPU_DEPTH24_STENCIL8, usage, DRWTextureFlag(0));
const bool in_front_history = workbench_in_front_history_needed(vedata);
if (in_front_history) {
DRW_texture_ensure_fullscreen_2d_ex(
&txl->depth_buffer_in_front_tx, GPU_DEPTH24_STENCIL8, usage, DRWTextureFlag(0));
}
else {
DRW_TEXTURE_FREE_SAFE(txl->depth_buffer_in_front_tx);
}
wpd->smaa_edge_tx = DRW_texture_pool_query_fullscreen_ex(GPU_RG8, usage, owner);
wpd->smaa_weight_tx = DRW_texture_pool_query_fullscreen_ex(GPU_RGBA8, usage, owner);
GPU_framebuffer_ensure_config(&fbl->antialiasing_fb,
{
GPU_ATTACHMENT_TEXTURE(txl->depth_buffer_tx),
GPU_ATTACHMENT_TEXTURE(txl->history_buffer_tx),
});
if (in_front_history) {
GPU_framebuffer_ensure_config(&fbl->antialiasing_in_front_fb,
{
GPU_ATTACHMENT_TEXTURE(txl->depth_buffer_in_front_tx),
});
}
GPU_framebuffer_ensure_config(&fbl->smaa_edge_fb,
{
GPU_ATTACHMENT_NONE,
GPU_ATTACHMENT_TEXTURE(wpd->smaa_edge_tx),
});
GPU_framebuffer_ensure_config(&fbl->smaa_weight_fb,
{
GPU_ATTACHMENT_NONE,
GPU_ATTACHMENT_TEXTURE(wpd->smaa_weight_tx),
});
/* TODO: could be shared for all viewports. */
if (txl->smaa_search_tx == nullptr) {
txl->smaa_search_tx = GPU_texture_create_2d(
"smaa_search", SEARCHTEX_WIDTH, SEARCHTEX_HEIGHT, 1, GPU_R8, usage, nullptr);
GPU_texture_update(txl->smaa_search_tx, GPU_DATA_UBYTE, searchTexBytes);
txl->smaa_area_tx = GPU_texture_create_2d(
"smaa_area", AREATEX_WIDTH, AREATEX_HEIGHT, 1, GPU_RG8, usage, nullptr);
GPU_texture_update(txl->smaa_area_tx, GPU_DATA_UBYTE, areaTexBytes);
GPU_texture_filter_mode(txl->smaa_search_tx, true);
GPU_texture_filter_mode(txl->smaa_area_tx, true);
}
}
else {
/* Cleanup */
DRW_TEXTURE_FREE_SAFE(txl->history_buffer_tx);
DRW_TEXTURE_FREE_SAFE(txl->depth_buffer_tx);
DRW_TEXTURE_FREE_SAFE(txl->depth_buffer_in_front_tx);
DRW_TEXTURE_FREE_SAFE(txl->smaa_search_tx);
DRW_TEXTURE_FREE_SAFE(txl->smaa_area_tx);
}
}
static float filter_blackman_harris(float x, const float width)
{
if (x > width * 0.5f) {
return 0.0f;
}
x = 2.0f * M_PI * clamp_f((x / width + 0.5f), 0.0f, 1.0f);
return 0.35875f - 0.48829f * cosf(x) + 0.14128f * cosf(2.0f * x) - 0.01168f * cosf(3.0f * x);
}
/* Compute weights for the 3x3 neighborhood using a 1.5px filter. */
static void workbench_antialiasing_weights_get(const float offset[2],
float r_weights[9],
float *r_weight_sum)
{
/* NOTE: If filter width is bigger than 2.0f, then we need to sample more neighborhood. */
const float filter_width = 2.0f;
*r_weight_sum = 0.0f;
int i = 0;
for (int x = -1; x <= 1; x++) {
for (int y = -1; y <= 1; y++, i++) {
float sample_co[2] = {float(x), float(y)};
sub_v2_v2(sample_co, offset);
float r = len_v2(sample_co);
/* fclem: is radial distance ok here? */
float weight = filter_blackman_harris(r, filter_width);
*r_weight_sum += weight;
r_weights[i] = weight;
}
}
}
void workbench_antialiasing_cache_init(WORKBENCH_Data *vedata)
{
WORKBENCH_TextureList *txl = vedata->txl;
WORKBENCH_PrivateData *wpd = vedata->stl->wpd;
WORKBENCH_PassList *psl = vedata->psl;
DefaultTextureList *dtxl = DRW_viewport_texture_list_get();
DRWShadingGroup *grp = nullptr;
if (wpd->taa_sample_len == 0) {
return;
}
{
DRW_PASS_CREATE(psl->aa_accum_ps, DRW_STATE_WRITE_COLOR | DRW_STATE_BLEND_ADD_FULL);
DRW_PASS_INSTANCE_CREATE(psl->aa_accum_replace_ps, psl->aa_accum_ps, DRW_STATE_WRITE_COLOR);
GPUShader *shader = workbench_shader_antialiasing_accumulation_get();
grp = DRW_shgroup_create(shader, psl->aa_accum_ps);
DRW_shgroup_uniform_texture_ex(
grp, "colorBuffer", dtxl->color, GPUSamplerState::default_sampler());
DRW_shgroup_uniform_float(grp, "samplesWeights", wpd->taa_weights, 9);
DRW_shgroup_call_procedural_triangles(grp, nullptr, 1);
}
const float *size = DRW_viewport_size_get();
const float *sizeinv = DRW_viewport_invert_size_get();
const float metrics[4] = {sizeinv[0], sizeinv[1], size[0], size[1]};
{
/* Stage 1: Edge detection. */
DRW_PASS_CREATE(psl->aa_edge_ps, DRW_STATE_WRITE_COLOR);
GPUShader *sh = workbench_shader_antialiasing_get(0);
grp = DRW_shgroup_create(sh, psl->aa_edge_ps);
DRW_shgroup_uniform_texture(grp, "colorTex", txl->history_buffer_tx);
DRW_shgroup_uniform_vec4_copy(grp, "viewportMetrics", metrics);
DRW_shgroup_clear_framebuffer(grp, GPU_COLOR_BIT, 0, 0, 0, 0, 0.0f, 0x0);
DRW_shgroup_call_procedural_triangles(grp, nullptr, 1);
}
{
/* Stage 2: Blend Weight/Coord. */
DRW_PASS_CREATE(psl->aa_weight_ps, DRW_STATE_WRITE_COLOR);
GPUShader *sh = workbench_shader_antialiasing_get(1);
grp = DRW_shgroup_create(sh, psl->aa_weight_ps);
DRW_shgroup_uniform_texture(grp, "edgesTex", wpd->smaa_edge_tx);
DRW_shgroup_uniform_texture(grp, "areaTex", txl->smaa_area_tx);
DRW_shgroup_uniform_texture(grp, "searchTex", txl->smaa_search_tx);
DRW_shgroup_uniform_vec4_copy(grp, "viewportMetrics", metrics);
DRW_shgroup_clear_framebuffer(grp, GPU_COLOR_BIT, 0, 0, 0, 0, 0.0f, 0x0);
DRW_shgroup_call_procedural_triangles(grp, nullptr, 1);
}
{
/* Stage 3: Resolve. */
DRW_PASS_CREATE(psl->aa_resolve_ps, DRW_STATE_WRITE_COLOR);
GPUShader *sh = workbench_shader_antialiasing_get(2);
grp = DRW_shgroup_create(sh, psl->aa_resolve_ps);
DRW_shgroup_uniform_texture(grp, "blendTex", wpd->smaa_weight_tx);
DRW_shgroup_uniform_texture(grp, "colorTex", txl->history_buffer_tx);
DRW_shgroup_uniform_vec4_copy(grp, "viewportMetrics", metrics);
DRW_shgroup_uniform_float(grp, "mixFactor", &wpd->smaa_mix_factor, 1);
DRW_shgroup_uniform_float(grp, "taaAccumulatedWeight", &wpd->taa_weight_accum, 1);
DRW_shgroup_call_procedural_triangles(grp, nullptr, 1);
}
}
bool workbench_antialiasing_setup(WORKBENCH_Data *vedata)
{
WORKBENCH_PrivateData *wpd = vedata->stl->wpd;
if (wpd->taa_sample_len == 0) {
/* AA disabled. */
return true;
}
if (wpd->taa_sample >= wpd->taa_sample_len) {
/* TAA accumulation has finish. Just copy the result back */
return false;
}
const float *viewport_size = DRW_viewport_size_get();
const DRWView *default_view = DRW_view_default_get();
float *transform_offset;
switch (wpd->taa_sample_len) {
default:
case 5:
transform_offset = e_data.jitter_5[min_ii(wpd->taa_sample, 5)];
break;
case 8:
transform_offset = e_data.jitter_8[min_ii(wpd->taa_sample, 8)];
break;
case 11:
transform_offset = e_data.jitter_11[min_ii(wpd->taa_sample, 11)];
break;
case 16:
transform_offset = e_data.jitter_16[min_ii(wpd->taa_sample, 16)];
break;
case 32:
transform_offset = e_data.jitter_32[min_ii(wpd->taa_sample, 32)];
break;
}
workbench_antialiasing_weights_get(transform_offset, wpd->taa_weights, &wpd->taa_weights_sum);
/* construct new matrices from transform delta */
float winmat[4][4], viewmat[4][4], persmat[4][4];
DRW_view_winmat_get(default_view, winmat, false);
DRW_view_viewmat_get(default_view, viewmat, false);
DRW_view_persmat_get(default_view, persmat, false);
window_translate_m4(winmat,
persmat,
transform_offset[0] / viewport_size[0],
transform_offset[1] / viewport_size[1]);
if (wpd->view) {
/* When rendering just update the view. This avoids recomputing the culling. */
DRW_view_update_sub(wpd->view, viewmat, winmat);
}
else {
/* TAA is not making a big change to the matrices.
* Reuse the main view culling by creating a sub-view. */
wpd->view = DRW_view_create_sub(default_view, viewmat, winmat);
}
DRW_view_set_active(wpd->view);
return true;
}
void workbench_antialiasing_draw_pass(WORKBENCH_Data *vedata)
{
WORKBENCH_PrivateData *wpd = vedata->stl->wpd;
WORKBENCH_FramebufferList *fbl = vedata->fbl;
WORKBENCH_TextureList *txl = vedata->txl;
WORKBENCH_PassList *psl = vedata->psl;
DefaultFramebufferList *dfbl = DRW_viewport_framebuffer_list_get();
DefaultTextureList *dtxl = DRW_viewport_texture_list_get();
if (wpd->taa_sample_len == 0) {
/* AA disabled. */
/* Just set sample to 1 to avoid rendering indefinitely. */
wpd->taa_sample = 1;
wpd->valid_history = false;
return;
}
/**
* We always do SMAA on top of TAA accumulation, unless the number of samples of TAA is already
* high. This ensure a smoother transition.
* If TAA accumulation is finished, we only blit the result.
*/
const bool last_sample = wpd->taa_sample + 1 == wpd->taa_sample_len;
const bool taa_finished = wpd->taa_sample >= wpd->taa_sample_len;
if (wpd->taa_sample == 0) {
wpd->taa_weight_accum = wpd->taa_weights_sum;
wpd->valid_history = true;
GPU_framebuffer_bind(fbl->antialiasing_fb);
DRW_draw_pass(psl->aa_accum_replace_ps);
/* In playback mode, we are sure the next redraw will not use the same viewmatrix.
* In this case no need to save the depth buffer. */
if (!wpd->is_playback) {
GPU_texture_copy(txl->depth_buffer_tx, dtxl->depth);
}
if (workbench_in_front_history_needed(vedata)) {
GPU_texture_copy(txl->depth_buffer_in_front_tx, dtxl->depth_in_front);
}
}
else {
if (!taa_finished) {
/* Accumulate result to the TAA buffer. */
GPU_framebuffer_bind(fbl->antialiasing_fb);
DRW_draw_pass(psl->aa_accum_ps);
wpd->taa_weight_accum += wpd->taa_weights_sum;
}
/* Copy back the saved depth buffer for correct overlays. */
GPU_texture_copy(dtxl->depth, txl->depth_buffer_tx);
if (workbench_in_front_history_needed(vedata)) {
GPU_texture_copy(dtxl->depth_in_front, txl->depth_buffer_in_front_tx);
}
}
if (!DRW_state_is_image_render() || last_sample) {
/* After a certain point SMAA is no longer necessary. */
wpd->smaa_mix_factor = 1.0f - clamp_f(wpd->taa_sample / 4.0f, 0.0f, 1.0f);
if (wpd->smaa_mix_factor > 0.0f) {
GPU_framebuffer_bind(fbl->smaa_edge_fb);
DRW_draw_pass(psl->aa_edge_ps);
GPU_framebuffer_bind(fbl->smaa_weight_fb);
DRW_draw_pass(psl->aa_weight_ps);
}
GPU_framebuffer_bind(dfbl->default_fb);
DRW_draw_pass(psl->aa_resolve_ps);
}
if (!taa_finished) {
wpd->taa_sample++;
}
if (!DRW_state_is_image_render() && wpd->taa_sample < wpd->taa_sample_len) {
DRW_viewport_request_redraw();
}
}

View File

@ -1,169 +0,0 @@
/* SPDX-FileCopyrightText: 2020 Blender Authors
*
* SPDX-License-Identifier: GPL-2.0-or-later */
/** \file
* \ingroup draw_engine
*
* Cavity Effect:
*
* We use Screen Space Ambient Occlusion (SSAO) to enhance geometric details of the surfaces.
* We also use a Curvature effect computed only using the surface normals.
*
* This is done after the opaque pass. It only affects the opaque surfaces.
*/
#include "DRW_render.h"
#include "BLI_rand.h"
#include "../eevee_next/eevee_lut.hh" /* TODO: find somewhere to share blue noise Table. */
#include "workbench_engine.h"
#include "workbench_private.h"
#define JITTER_TEX_SIZE 64
#define CAVITY_MAX_SAMPLES 512
/* Using Hammersley distribution */
static float *create_disk_samples(int num_samples, int num_iterations)
{
BLI_assert(num_samples * num_iterations <= CAVITY_MAX_SAMPLES);
const int total_samples = num_samples * num_iterations;
const float num_samples_inv = 1.0f / num_samples;
/* vec4 to ensure memory alignment. */
float(*texels)[4] = static_cast<float(*)[4]>(
MEM_callocN(sizeof(float[4]) * CAVITY_MAX_SAMPLES, __func__));
for (int i = 0; i < total_samples; i++) {
float it_add = (i / num_samples) * 0.499f;
float r = fmodf((i + 0.5f + it_add) * num_samples_inv, 1.0f);
double dphi;
BLI_hammersley_1d(i, &dphi);
float phi = float(dphi) * 2.0f * M_PI + it_add;
texels[i][0] = cosf(phi);
texels[i][1] = sinf(phi);
/* This deliberately distribute more samples
* at the center of the disk (and thus the shadow). */
texels[i][2] = r;
}
return (float *)texels;
}
static GPUTexture *create_jitter_texture(int num_samples)
{
float jitter[64 * 64][4];
const float num_samples_inv = 1.0f / num_samples;
for (int x = 0; x < 64; x++) {
for (int y = 0; y < 64; y++) {
float phi = blender::eevee::lut::blue_noise[y][x][0] * 2.0f * M_PI;
/* This rotate the sample per pixels */
jitter[y * 64 + x][0] = cosf(phi);
jitter[y * 64 + x][1] = sinf(phi);
/* This offset the sample along its direction axis (reduce banding) */
float bn = blender::eevee::lut::blue_noise[y][x][1] - 0.5f;
CLAMP(bn, -0.499f, 0.499f); /* fix fireflies */
jitter[y * 64 + x][2] = bn * num_samples_inv;
jitter[y * 64 + x][3] = blender::eevee::lut::blue_noise[y][x][1];
}
}
return DRW_texture_create_2d(64, 64, GPU_RGBA16F, DRW_TEX_WRAP, &jitter[0][0]);
}
BLI_INLINE int workbench_cavity_total_sample_count(const WORKBENCH_PrivateData *wpd,
const Scene *scene)
{
return min_ii(max_ii(1, wpd->taa_sample_len) * scene->display.matcap_ssao_samples,
CAVITY_MAX_SAMPLES);
}
void workbench_cavity_data_update(WORKBENCH_PrivateData *wpd, WORKBENCH_UBO_World *wd)
{
View3DShading *shading = &wpd->shading;
const DRWContextState *draw_ctx = DRW_context_state_get();
Scene *scene = draw_ctx->scene;
if (CAVITY_ENABLED(wpd)) {
int cavity_sample_count_single_iteration = scene->display.matcap_ssao_samples;
int cavity_sample_count_total = workbench_cavity_total_sample_count(wpd, scene);
const int max_iter_count = cavity_sample_count_total / cavity_sample_count_single_iteration;
int sample = wpd->taa_sample % max_iter_count;
wd->cavity_sample_start = cavity_sample_count_single_iteration * sample;
wd->cavity_sample_end = cavity_sample_count_single_iteration * (sample + 1);
wd->cavity_sample_count_inv = 1.0f / (wd->cavity_sample_end - wd->cavity_sample_start);
wd->cavity_jitter_scale = 1.0f / 64.0f;
wd->cavity_valley_factor = shading->cavity_valley_factor;
wd->cavity_ridge_factor = shading->cavity_ridge_factor;
wd->cavity_attenuation = scene->display.matcap_ssao_attenuation;
wd->cavity_distance = scene->display.matcap_ssao_distance;
wd->curvature_ridge = 0.5f / max_ff(square_f(shading->curvature_ridge_factor), 1e-4f);
wd->curvature_valley = 0.7f / max_ff(square_f(shading->curvature_valley_factor), 1e-4f);
}
}
void workbench_cavity_samples_ubo_ensure(WORKBENCH_PrivateData *wpd)
{
const DRWContextState *draw_ctx = DRW_context_state_get();
Scene *scene = draw_ctx->scene;
int cavity_sample_count_single_iteration = scene->display.matcap_ssao_samples;
int cavity_sample_count = workbench_cavity_total_sample_count(wpd, scene);
const int max_iter_count = max_ii(1, cavity_sample_count / cavity_sample_count_single_iteration);
if (wpd->vldata->cavity_sample_count != cavity_sample_count) {
DRW_UBO_FREE_SAFE(wpd->vldata->cavity_sample_ubo);
DRW_TEXTURE_FREE_SAFE(wpd->vldata->cavity_jitter_tx);
}
if (wpd->vldata->cavity_sample_ubo == nullptr) {
float *samples = create_disk_samples(cavity_sample_count_single_iteration, max_iter_count);
wpd->vldata->cavity_jitter_tx = create_jitter_texture(cavity_sample_count);
/* NOTE: Uniform buffer needs to always be filled to be valid. */
wpd->vldata->cavity_sample_ubo = GPU_uniformbuf_create_ex(
sizeof(float[4]) * CAVITY_MAX_SAMPLES, samples, "wb_CavitySamples");
wpd->vldata->cavity_sample_count = cavity_sample_count;
MEM_freeN(samples);
}
}
void workbench_cavity_cache_init(WORKBENCH_Data *data)
{
WORKBENCH_PassList *psl = data->psl;
WORKBENCH_PrivateData *wpd = data->stl->wpd;
DefaultTextureList *dtxl = DRW_viewport_texture_list_get();
GPUShader *sh;
DRWShadingGroup *grp;
if (CAVITY_ENABLED(wpd)) {
workbench_cavity_samples_ubo_ensure(wpd);
int state = DRW_STATE_WRITE_COLOR | DRW_STATE_BLEND_MUL;
DRW_PASS_CREATE(psl->cavity_ps, DRWState(state));
sh = workbench_shader_cavity_get(SSAO_ENABLED(wpd), CURVATURE_ENABLED(wpd));
grp = DRW_shgroup_create(sh, psl->cavity_ps);
DRW_shgroup_uniform_texture(grp, "normalBuffer", wpd->normal_buffer_tx);
DRW_shgroup_uniform_block(grp, "world_data", wpd->world_ubo);
if (SSAO_ENABLED(wpd)) {
DRW_shgroup_uniform_block(grp, "samples_coords", wpd->vldata->cavity_sample_ubo);
DRW_shgroup_uniform_texture(grp, "depthBuffer", dtxl->depth);
DRW_shgroup_uniform_texture(grp, "cavityJitter", wpd->vldata->cavity_jitter_tx);
}
if (CURVATURE_ENABLED(wpd)) {
DRW_shgroup_uniform_texture(grp, "objectIdBuffer", wpd->object_id_tx);
}
DRW_shgroup_call_procedural_triangles(grp, nullptr, 1);
}
else {
psl->cavity_ps = nullptr;
}
}

View File

@ -1,406 +0,0 @@
/* SPDX-FileCopyrightText: 2016 Blender Authors
*
* SPDX-License-Identifier: GPL-2.0-or-later */
/** \file
* \ingroup draw_engine
*
* Depth of Field Effect:
*
* We use a gather approach by sampling a lowres version of the color buffer.
* The process can be summarized like this:
* - down-sample the color buffer using a COC (Circle of Confusion) aware down-sample algorithm.
* - do a gather pass using the COC computed in the previous pass.
* - do a median filter to reduce noise amount.
* - composite on top of main color buffer.
*
* This is done after all passes and affects every surfaces.
*/
#include "workbench_private.h"
#include "BKE_camera.h"
#include "DEG_depsgraph_query.h"
#include "DNA_camera_types.h"
/**
* Transform [-1..1] square to unit circle.
*/
static void square_to_circle(float x, float y, float *r, float *T)
{
if (x > -y) {
if (x > y) {
*r = x;
*T = M_PI_4 * (y / x);
}
else {
*r = y;
*T = M_PI_4 * (2 - (x / y));
}
}
else {
if (x < y) {
*r = -x;
*T = M_PI_4 * (4 + (y / x));
}
else {
*r = -y;
if (y != 0) {
*T = M_PI_4 * (6 - (x / y));
}
else {
*T = 0.0f;
}
}
}
}
#define SQUARE_UNSAFE(a) ((a) * (a))
#define KERNEL_RAD (3)
#define SAMP_LEN SQUARE_UNSAFE(KERNEL_RAD * 2 + 1)
static void workbench_dof_setup_samples(
GPUUniformBuf **ubo, float **data, float bokeh_sides, float bokeh_rotation, float bokeh_ratio)
{
if (*data == nullptr) {
*data = static_cast<float *>(
MEM_callocN(sizeof(float[4]) * SAMP_LEN, "workbench dof samples"));
}
if (*ubo == nullptr) {
*ubo = GPU_uniformbuf_create(sizeof(float[4]) * SAMP_LEN);
}
float *samp = *data;
for (int i = 0; i <= KERNEL_RAD; i++) {
for (int j = -KERNEL_RAD; j <= KERNEL_RAD; j++) {
for (int k = -KERNEL_RAD; k <= KERNEL_RAD; k++) {
if (abs(j) > i || abs(k) > i) {
continue;
}
if (abs(j) < i && abs(k) < i) {
continue;
}
float x = float(j) / KERNEL_RAD;
float y = float(k) / KERNEL_RAD;
float r, T;
square_to_circle(x, y, &r, &T);
samp[2] = r;
/* Bokeh shape parameterization. */
if (bokeh_sides > 1.0f) {
float denom = T - (2.0 * M_PI / bokeh_sides) *
floorf((bokeh_sides * T + M_PI) / (2.0 * M_PI));
r *= cosf(M_PI / bokeh_sides) / cosf(denom);
}
T += bokeh_rotation;
samp[0] = r * cosf(T) * bokeh_ratio;
samp[1] = r * sinf(T);
samp += 4;
}
}
}
GPU_uniformbuf_update(*ubo, *data);
}
void workbench_dof_engine_init(WORKBENCH_Data *vedata)
{
WORKBENCH_TextureList *txl = vedata->txl;
WORKBENCH_StorageList *stl = vedata->stl;
WORKBENCH_PrivateData *wpd = stl->wpd;
WORKBENCH_FramebufferList *fbl = vedata->fbl;
const DRWContextState *draw_ctx = DRW_context_state_get();
RegionView3D *rv3d = draw_ctx->rv3d;
View3D *v3d = draw_ctx->v3d;
Object *camera;
if (v3d && rv3d) {
camera = (rv3d->persp == RV3D_CAMOB) ? v3d->camera : nullptr;
}
else {
camera = wpd->cam_original_ob;
}
Camera *cam = static_cast<Camera *>(
camera != nullptr && camera->type == OB_CAMERA ? camera->data : nullptr);
if ((wpd->shading.flag & V3D_SHADING_DEPTH_OF_FIELD) == 0 || (cam == nullptr) ||
((cam->dof.flag & CAM_DOF_ENABLED) == 0))
{
wpd->dof_enabled = false;
/* Cleanup. */
DRW_TEXTURE_FREE_SAFE(txl->dof_source_tx);
DRW_TEXTURE_FREE_SAFE(txl->coc_halfres_tx);
return;
}
const float *full_size = DRW_viewport_size_get();
const int size[2] = {max_ii(1, int(full_size[0]) / 2), max_ii(1, int(full_size[1]) / 2)};
#if 0 /* TODO(fclem): finish COC min_max optimization. */
/* NOTE: We `ceil` here in order to not miss any edge texel if using a NPO2 texture. */
int shrink_h_size[2] = {ceilf(size[0] / 8.0f), size[1]};
int shrink_w_size[2] = {shrink_h_size[0], ceilf(size[1] / 8.0f)};
#endif
DRW_texture_ensure_2d(&txl->dof_source_tx,
size[0],
size[1],
GPU_RGBA16F,
DRWTextureFlag(DRW_TEX_FILTER | DRW_TEX_MIPMAP));
DRW_texture_ensure_2d(&txl->coc_halfres_tx,
size[0],
size[1],
GPU_RG8,
DRWTextureFlag(DRW_TEX_FILTER | DRW_TEX_MIPMAP));
wpd->dof_blur_tx = DRW_texture_pool_query_2d(
size[0], size[1], GPU_RGBA16F, &draw_engine_workbench);
#if 0 /* TODO(fclem): finish COC min_max optimization. */
wpd->coc_temp_tx = DRW_texture_pool_query_2d(
shrink_h_size[0], shrink_h_size[1], GPU_RG8, &draw_engine_workbench);
wpd->coc_tiles_tx[0] = DRW_texture_pool_query_2d(
shrink_w_size[0], shrink_w_size[1], GPU_RG8, &draw_engine_workbench);
wpd->coc_tiles_tx[1] = DRW_texture_pool_query_2d(
shrink_w_size[0], shrink_w_size[1], GPU_RG8, &draw_engine_workbench);
#endif
GPU_framebuffer_ensure_config(&fbl->dof_downsample_fb,
{
GPU_ATTACHMENT_NONE,
GPU_ATTACHMENT_TEXTURE(txl->dof_source_tx),
GPU_ATTACHMENT_TEXTURE(txl->coc_halfres_tx),
});
#if 0 /* TODO(fclem): finish COC min_max optimization. */
GPU_framebuffer_ensure_config(&fbl->dof_coc_tile_h_fb,
{
GPU_ATTACHMENT_NONE,
GPU_ATTACHMENT_TEXTURE(wpd->coc_temp_tx),
});
GPU_framebuffer_ensure_config(&fbl->dof_coc_tile_v_fb,
{
GPU_ATTACHMENT_NONE,
GPU_ATTACHMENT_TEXTURE(wpd->coc_tiles_tx[0]),
});
GPU_framebuffer_ensure_config(&fbl->dof_coc_dilate_fb,
{
GPU_ATTACHMENT_NONE,
GPU_ATTACHMENT_TEXTURE(wpd->coc_tiles_tx[1]),
});
#endif
GPU_framebuffer_ensure_config(&fbl->dof_blur1_fb,
{
GPU_ATTACHMENT_NONE,
GPU_ATTACHMENT_TEXTURE(wpd->dof_blur_tx),
});
GPU_framebuffer_ensure_config(&fbl->dof_blur2_fb,
{
GPU_ATTACHMENT_NONE,
GPU_ATTACHMENT_TEXTURE(txl->dof_source_tx),
});
{
/* Parameters */
float fstop = cam->dof.aperture_fstop;
float sensor = BKE_camera_sensor_size(cam->sensor_fit, cam->sensor_x, cam->sensor_y);
float focus_dist = BKE_camera_object_dof_distance(camera);
float focal_len = cam->lens;
/* TODO(fclem): de-duplicate with EEVEE. */
const float scale_camera = 0.001f;
/* We want radius here for the aperture number. */
float aperture = 0.5f * scale_camera * focal_len / fstop;
float focal_len_scaled = scale_camera * focal_len;
float sensor_scaled = scale_camera * sensor;
if (rv3d != nullptr) {
sensor_scaled *= rv3d->viewcamtexcofac[0];
}
wpd->dof_aperturesize = aperture * fabsf(focal_len_scaled / (focus_dist - focal_len_scaled));
wpd->dof_distance = -focus_dist;
wpd->dof_invsensorsize = full_size[0] / sensor_scaled;
wpd->dof_near_far[0] = -cam->clip_start;
wpd->dof_near_far[1] = -cam->clip_end;
float blades = cam->dof.aperture_blades;
float rotation = cam->dof.aperture_rotation;
float ratio = 1.0f / cam->dof.aperture_ratio;
if (wpd->vldata->dof_sample_ubo == nullptr || blades != wpd->dof_blades ||
rotation != wpd->dof_rotation || ratio != wpd->dof_ratio)
{
wpd->dof_blades = blades;
wpd->dof_rotation = rotation;
wpd->dof_ratio = ratio;
workbench_dof_setup_samples(
&wpd->vldata->dof_sample_ubo, &stl->dof_ubo_data, blades, rotation, ratio);
}
}
wpd->dof_enabled = true;
}
void workbench_dof_cache_init(WORKBENCH_Data *vedata)
{
WORKBENCH_PassList *psl = vedata->psl;
WORKBENCH_TextureList *txl = vedata->txl;
WORKBENCH_StorageList *stl = vedata->stl;
WORKBENCH_PrivateData *wpd = stl->wpd;
if (!wpd->dof_enabled) {
return;
}
GPUShader *prepare_sh, *downsample_sh, *blur1_sh, *blur2_sh, *resolve_sh;
workbench_shader_depth_of_field_get(
&prepare_sh, &downsample_sh, &blur1_sh, &blur2_sh, &resolve_sh);
DefaultTextureList *dtxl = DRW_viewport_texture_list_get();
{
psl->dof_down_ps = DRW_pass_create("DoF DownSample", DRW_STATE_WRITE_COLOR);
DRWShadingGroup *grp = DRW_shgroup_create(prepare_sh, psl->dof_down_ps);
DRW_shgroup_uniform_texture(grp, "sceneColorTex", dtxl->color);
DRW_shgroup_uniform_texture(grp, "sceneDepthTex", dtxl->depth);
DRW_shgroup_uniform_vec2(grp, "invertedViewportSize", DRW_viewport_invert_size_get(), 1);
DRW_shgroup_uniform_vec3(grp, "dofParams", &wpd->dof_aperturesize, 1);
DRW_shgroup_uniform_vec2(grp, "nearFar", wpd->dof_near_far, 1);
DRW_shgroup_call_procedural_triangles(grp, nullptr, 1);
}
{
psl->dof_down2_ps = DRW_pass_create("DoF DownSample", DRW_STATE_WRITE_COLOR);
DRWShadingGroup *grp = DRW_shgroup_create(downsample_sh, psl->dof_down2_ps);
DRW_shgroup_uniform_texture_ex(
grp, "sceneColorTex", txl->dof_source_tx, GPUSamplerState::default_sampler());
DRW_shgroup_uniform_texture(grp, "inputCocTex", txl->coc_halfres_tx);
DRW_shgroup_call_procedural_triangles(grp, nullptr, 1);
}
#if 0 /* TODO(fclem): finish COC min_max optimization */
{
psl->dof_flatten_h_ps = DRW_pass_create("DoF Flatten Coc H", DRW_STATE_WRITE_COLOR);
DRWShadingGroup *grp = DRW_shgroup_create(flatten_h_sh, psl->dof_flatten_h_ps);
DRW_shgroup_uniform_texture(grp, "inputCocTex", txl->coc_halfres_tx);
DRW_shgroup_call_procedural_triangles(grp, nullptr, 1);
}
{
psl->dof_flatten_v_ps = DRW_pass_create("DoF Flatten Coc V", DRW_STATE_WRITE_COLOR);
DRWShadingGroup *grp = DRW_shgroup_create(flatten_v_sh, psl->dof_flatten_v_ps);
DRW_shgroup_uniform_texture(grp, "inputCocTex", wpd->coc_temp_tx);
DRW_shgroup_call_procedural_triangles(grp, nullptr, 1);
}
{
psl->dof_dilate_h_ps = DRW_pass_create("DoF Dilate Coc H", DRW_STATE_WRITE_COLOR);
DRWShadingGroup *grp = DRW_shgroup_create(dilate_v_sh, psl->dof_dilate_v_ps);
DRW_shgroup_uniform_texture(grp, "inputCocTex", wpd->coc_tiles_tx[0]);
DRW_shgroup_call_procedural_triangles(grp, nullptr, 1);
}
{
psl->dof_dilate_v_ps = DRW_pass_create("DoF Dilate Coc V", DRW_STATE_WRITE_COLOR);
DRWShadingGroup *grp = DRW_shgroup_create(dilate_h_sh, psl->dof_dilate_h_ps);
DRW_shgroup_uniform_texture(grp, "inputCocTex", wpd->coc_tiles_tx[1]);
DRW_shgroup_call_procedural_triangles(grp, nullptr, 1);
}
#endif
{
psl->dof_blur1_ps = DRW_pass_create("DoF Blur 1", DRW_STATE_WRITE_COLOR);
/* We reuse the same noise texture. Ensure it is up to date. */
workbench_cavity_samples_ubo_ensure(wpd);
float offset = wpd->taa_sample / float(max_ii(1, wpd->taa_sample_len));
DRWShadingGroup *grp = DRW_shgroup_create(blur1_sh, psl->dof_blur1_ps);
DRW_shgroup_uniform_block(grp, "samples", wpd->vldata->dof_sample_ubo);
DRW_shgroup_uniform_texture(grp, "noiseTex", wpd->vldata->cavity_jitter_tx);
DRW_shgroup_uniform_texture(grp, "inputCocTex", txl->coc_halfres_tx);
DRW_shgroup_uniform_texture(grp, "halfResColorTex", txl->dof_source_tx);
DRW_shgroup_uniform_vec2(grp, "invertedViewportSize", DRW_viewport_invert_size_get(), 1);
DRW_shgroup_uniform_float_copy(grp, "noiseOffset", offset);
DRW_shgroup_call_procedural_triangles(grp, nullptr, 1);
}
{
psl->dof_blur2_ps = DRW_pass_create("DoF Blur 2", DRW_STATE_WRITE_COLOR);
DRWShadingGroup *grp = DRW_shgroup_create(blur2_sh, psl->dof_blur2_ps);
DRW_shgroup_uniform_texture(grp, "inputCocTex", txl->coc_halfres_tx);
DRW_shgroup_uniform_texture(grp, "blurTex", wpd->dof_blur_tx);
DRW_shgroup_uniform_vec2(grp, "invertedViewportSize", DRW_viewport_invert_size_get(), 1);
DRW_shgroup_call_procedural_triangles(grp, nullptr, 1);
}
{
psl->dof_resolve_ps = DRW_pass_create("DoF Resolve",
DRW_STATE_WRITE_COLOR | DRW_STATE_BLEND_CUSTOM);
DRWShadingGroup *grp = DRW_shgroup_create(resolve_sh, psl->dof_resolve_ps);
DRW_shgroup_uniform_texture(grp, "halfResColorTex", txl->dof_source_tx);
DRW_shgroup_uniform_texture(grp, "sceneDepthTex", dtxl->depth);
DRW_shgroup_uniform_vec2(grp, "invertedViewportSize", DRW_viewport_invert_size_get(), 1);
DRW_shgroup_uniform_vec3(grp, "dofParams", &wpd->dof_aperturesize, 1);
DRW_shgroup_uniform_vec2(grp, "nearFar", wpd->dof_near_far, 1);
DRW_shgroup_call_procedural_triangles(grp, nullptr, 1);
}
}
static void workbench_dof_downsample_level(void *user_data, int /*level*/)
{
WORKBENCH_PassList *psl = (WORKBENCH_PassList *)user_data;
DRW_draw_pass(psl->dof_down2_ps);
}
void workbench_dof_draw_pass(WORKBENCH_Data *vedata)
{
WORKBENCH_FramebufferList *fbl = vedata->fbl;
WORKBENCH_StorageList *stl = vedata->stl;
WORKBENCH_PassList *psl = vedata->psl;
WORKBENCH_PrivateData *wpd = stl->wpd;
DefaultFramebufferList *dfbl = DRW_viewport_framebuffer_list_get();
if (!wpd->dof_enabled) {
return;
}
DRW_stats_group_start("Depth Of Field");
GPU_framebuffer_bind(fbl->dof_downsample_fb);
DRW_draw_pass(psl->dof_down_ps);
GPU_framebuffer_recursive_downsample(
fbl->dof_downsample_fb, 2, workbench_dof_downsample_level, psl);
#if 0 /* TODO(fclem): finish COC min_max optimization */
GPU_framebuffer_bind(fbl->dof_coc_tile_h_fb);
DRW_draw_pass(psl->dof_flatten_h_ps);
GPU_framebuffer_bind(fbl->dof_coc_tile_v_fb);
DRW_draw_pass(psl->dof_flatten_v_ps);
GPU_framebuffer_bind(fbl->dof_coc_dilate_fb);
DRW_draw_pass(psl->dof_dilate_v_ps);
GPU_framebuffer_bind(fbl->dof_coc_tile_v_fb);
DRW_draw_pass(psl->dof_dilate_h_ps);
#endif
GPU_framebuffer_bind(fbl->dof_blur1_fb);
DRW_draw_pass(psl->dof_blur1_ps);
GPU_framebuffer_bind(fbl->dof_blur2_fb);
DRW_draw_pass(psl->dof_blur2_ps);
GPU_framebuffer_bind(dfbl->color_only_fb);
DRW_draw_pass(psl->dof_resolve_ps);
DRW_stats_group_end();
}

View File

@ -1,41 +0,0 @@
/* SPDX-FileCopyrightText: 2020 Blender Authors
*
* SPDX-License-Identifier: GPL-2.0-or-later */
/** \file
* \ingroup draw_engine
*
* Outline Effect:
*
* Simple effect that just samples an object id buffer to detect objects outlines.
*/
#include "DRW_render.h"
#include "workbench_engine.h"
#include "workbench_private.h"
void workbench_outline_cache_init(WORKBENCH_Data *data)
{
WORKBENCH_PassList *psl = data->psl;
WORKBENCH_PrivateData *wpd = data->stl->wpd;
DefaultTextureList *dtxl = DRW_viewport_texture_list_get();
GPUShader *sh;
DRWShadingGroup *grp;
if (OBJECT_OUTLINE_ENABLED(wpd)) {
int state = DRW_STATE_WRITE_COLOR | DRW_STATE_BLEND_ALPHA_PREMUL;
DRW_PASS_CREATE(psl->outline_ps, DRWState(state));
sh = workbench_shader_outline_get();
grp = DRW_shgroup_create(sh, psl->outline_ps);
DRW_shgroup_uniform_texture(grp, "objectIdBuffer", wpd->object_id_tx);
DRW_shgroup_uniform_texture(grp, "depthBuffer", dtxl->depth);
DRW_shgroup_uniform_block(grp, "world_data", wpd->world_ubo);
DRW_shgroup_call_procedural_triangles(grp, nullptr, 1);
}
else {
psl->outline_ps = nullptr;
}
}

View File

@ -855,7 +855,7 @@ DrawEngineType draw_engine_workbench_next = {
RenderEngineType DRW_engine_viewport_workbench_next_type = {
/*next*/ nullptr,
/*prev*/ nullptr,
/*idname*/ "BLENDER_WORKBENCH_NEXT",
/*idname*/ "BLENDER_WORKBENCH",
/*name*/ N_("Workbench"),
/*flag*/ RE_INTERNAL | RE_USE_STEREO_VIEWPORT | RE_USE_GPU_CONTEXT,
/*update*/ nullptr,

View File

@ -1,725 +0,0 @@
/* SPDX-FileCopyrightText: 2016 Blender Authors
*
* SPDX-License-Identifier: GPL-2.0-or-later */
/** \file
* \ingroup draw_engine
*
* Workbench Engine:
*
* Optimized engine to draw the working viewport with solid and transparent geometry.
*/
#include "DRW_render.h"
#include "BLI_alloca.h"
#include "BKE_editmesh.h"
#include "BKE_mesh_runtime.hh"
#include "BKE_modifier.h"
#include "BKE_object.h"
#include "BKE_paint.hh"
#include "BKE_particle.h"
#include "DNA_curves_types.h"
#include "DNA_fluid_types.h"
#include "DNA_image_types.h"
#include "DNA_mesh_types.h"
#include "DNA_modifier_types.h"
#include "DNA_node_types.h"
#include "DNA_pointcloud_types.h"
#include "ED_paint.hh"
#include "GPU_context.h"
#include "workbench_engine.h"
#include "workbench_private.h"
#define WORKBENCH_ENGINE "BLENDER_WORKBENCH"
void workbench_engine_init(void *ved)
{
BLI_assert_unreachable();
GPU_render_begin();
WORKBENCH_Data *vedata = static_cast<WORKBENCH_Data *>(ved);
WORKBENCH_StorageList *stl = vedata->stl;
WORKBENCH_TextureList *txl = vedata->txl;
workbench_private_data_alloc(stl);
WORKBENCH_PrivateData *wpd = stl->wpd;
workbench_private_data_init(wpd);
workbench_update_world_ubo(wpd);
if (txl->dummy_image_tx == nullptr) {
const float fpixel[4] = {1.0f, 0.0f, 1.0f, 1.0f};
txl->dummy_image_tx = DRW_texture_create_2d(1, 1, GPU_RGBA8, DRWTextureFlag(0), fpixel);
}
wpd->dummy_image_tx = txl->dummy_image_tx;
if (OBJECT_ID_PASS_ENABLED(wpd)) {
const eGPUTextureUsage usage = GPU_TEXTURE_USAGE_ATTACHMENT | GPU_TEXTURE_USAGE_SHADER_READ;
wpd->object_id_tx = DRW_texture_pool_query_fullscreen_ex(
GPU_R16UI, usage, &draw_engine_workbench);
}
else {
/* Don't free because it's a pool texture. */
wpd->object_id_tx = nullptr;
}
workbench_opaque_engine_init(vedata);
workbench_transparent_engine_init(vedata);
workbench_dof_engine_init(vedata);
workbench_antialiasing_engine_init(vedata);
workbench_volume_engine_init(vedata);
GPU_render_end();
}
void workbench_cache_init(void *ved)
{
WORKBENCH_Data *vedata = static_cast<WORKBENCH_Data *>(ved);
workbench_opaque_cache_init(vedata);
workbench_transparent_cache_init(vedata);
workbench_shadow_cache_init(vedata);
workbench_cavity_cache_init(vedata);
workbench_outline_cache_init(vedata);
workbench_dof_cache_init(vedata);
workbench_antialiasing_cache_init(vedata);
workbench_volume_cache_init(vedata);
}
/* TODO(fclem): DRW_cache_object_surface_material_get needs a refactor to allow passing nullptr
* instead of gpumat_array. Avoiding all this boilerplate code. */
static GPUBatch **workbench_object_surface_material_get(Object *ob)
{
const int materials_len = DRW_cache_object_material_count_get(ob);
GPUMaterial **gpumat_array = BLI_array_alloca(gpumat_array, materials_len);
memset(gpumat_array, 0, sizeof(*gpumat_array) * materials_len);
return DRW_cache_object_surface_material_get(ob, gpumat_array, materials_len);
}
static void workbench_cache_sculpt_populate(WORKBENCH_PrivateData *wpd,
Object *ob,
eV3DShadingColorType color_type)
{
const bool use_single_drawcall = !ELEM(color_type, V3D_SHADING_MATERIAL_COLOR);
if (use_single_drawcall) {
DRWShadingGroup *grp = workbench_material_setup(wpd, ob, ob->actcol, color_type, nullptr);
bool use_color = color_type == V3D_SHADING_VERTEX_COLOR;
bool use_uv = color_type == V3D_SHADING_TEXTURE_COLOR;
DRW_shgroup_call_sculpt(grp, ob, false, false, false, use_color, use_uv);
}
else {
const int materials_len = DRW_cache_object_material_count_get(ob);
DRWShadingGroup **shgrps = BLI_array_alloca(shgrps, materials_len);
for (int i = 0; i < materials_len; i++) {
shgrps[i] = workbench_material_setup(wpd, ob, i + 1, color_type, nullptr);
}
DRW_shgroup_call_sculpt_with_materials(shgrps, nullptr, materials_len, ob);
}
}
BLI_INLINE void workbench_object_drawcall(DRWShadingGroup *grp, GPUBatch *geom, Object *ob)
{
if (ob->type == OB_POINTCLOUD) {
/* Draw range to avoid drawcall batching messing up the instance attribute. */
DRW_shgroup_call_instance_range(grp, ob, geom, 0, 0);
}
else {
DRW_shgroup_call(grp, geom, ob);
}
}
static void workbench_cache_texpaint_populate(WORKBENCH_PrivateData *wpd, Object *ob)
{
const DRWContextState *draw_ctx = DRW_context_state_get();
const Scene *scene = draw_ctx->scene;
const ImagePaintSettings *imapaint = &scene->toolsettings->imapaint;
const bool use_single_drawcall = imapaint->mode == IMAGEPAINT_MODE_IMAGE;
if (use_single_drawcall) {
GPUBatch *geom = DRW_cache_mesh_surface_texpaint_single_get(ob);
if (geom) {
Image *ima = imapaint->canvas;
const GPUSamplerFiltering filtering = imapaint->interp == IMAGEPAINT_INTERP_LINEAR ?
GPU_SAMPLER_FILTERING_LINEAR :
GPU_SAMPLER_FILTERING_DEFAULT;
GPUSamplerState state = {
filtering, GPU_SAMPLER_EXTEND_MODE_REPEAT, GPU_SAMPLER_EXTEND_MODE_REPEAT};
DRWShadingGroup *grp = workbench_image_setup(wpd, ob, 0, ima, nullptr, state);
workbench_object_drawcall(grp, geom, ob);
}
}
else {
GPUBatch **geoms = DRW_cache_mesh_surface_texpaint_get(ob);
if (geoms) {
const int materials_len = DRW_cache_object_material_count_get(ob);
for (int i = 0; i < materials_len; i++) {
if (geoms[i] == nullptr) {
continue;
}
DRWShadingGroup *grp = workbench_image_setup(
wpd, ob, i + 1, nullptr, nullptr, GPUSamplerState::default_sampler());
workbench_object_drawcall(grp, geoms[i], ob);
}
}
}
}
static void workbench_cache_common_populate(WORKBENCH_PrivateData *wpd,
Object *ob,
eV3DShadingColorType color_type,
bool *r_transp)
{
const bool use_tex = ELEM(color_type, V3D_SHADING_TEXTURE_COLOR);
const bool use_vcol = ELEM(color_type, V3D_SHADING_VERTEX_COLOR);
const bool use_single_drawcall = !ELEM(
color_type, V3D_SHADING_MATERIAL_COLOR, V3D_SHADING_TEXTURE_COLOR);
if (use_single_drawcall) {
GPUBatch *geom;
if (use_vcol) {
if (ob->mode & OB_MODE_VERTEX_PAINT) {
geom = DRW_cache_mesh_surface_vertpaint_get(ob);
}
else {
geom = DRW_cache_mesh_surface_sculptcolors_get(ob);
}
}
else {
geom = DRW_cache_object_surface_get(ob);
}
if (geom) {
DRWShadingGroup *grp = workbench_material_setup(wpd, ob, 0, color_type, r_transp);
workbench_object_drawcall(grp, geom, ob);
}
}
else {
GPUBatch **geoms = (use_tex) ? DRW_cache_mesh_surface_texpaint_get(ob) :
workbench_object_surface_material_get(ob);
if (geoms) {
const int materials_len = DRW_cache_object_material_count_get(ob);
for (int i = 0; i < materials_len; i++) {
if (geoms[i] == nullptr) {
continue;
}
DRWShadingGroup *grp = workbench_material_setup(wpd, ob, i + 1, color_type, r_transp);
workbench_object_drawcall(grp, geoms[i], ob);
}
}
}
}
static void workbench_cache_hair_populate(WORKBENCH_PrivateData *wpd,
Object *ob,
ParticleSystem *psys,
ModifierData *md,
eV3DShadingColorType color_type,
bool use_texpaint_mode,
const int matnr)
{
const DRWContextState *draw_ctx = DRW_context_state_get();
const Scene *scene = draw_ctx->scene;
const ImagePaintSettings *imapaint = use_texpaint_mode ? &scene->toolsettings->imapaint :
nullptr;
Image *ima = (imapaint && imapaint->mode == IMAGEPAINT_MODE_IMAGE) ? imapaint->canvas : nullptr;
GPUSamplerState state = {imapaint && imapaint->interp == IMAGEPAINT_INTERP_LINEAR ?
GPU_SAMPLER_FILTERING_LINEAR :
GPU_SAMPLER_FILTERING_DEFAULT};
DRWShadingGroup *grp = (use_texpaint_mode) ?
workbench_image_hair_setup(wpd, ob, matnr, ima, nullptr, state) :
workbench_material_hair_setup(wpd, ob, matnr, color_type);
DRW_shgroup_hair_create_sub(ob, psys, md, grp, nullptr);
}
static const CustomData *workbench_mesh_get_loop_custom_data(const Mesh *mesh)
{
if (mesh->runtime->wrapper_type == ME_WRAPPER_TYPE_BMESH) {
BLI_assert(mesh->edit_mesh != nullptr);
BLI_assert(mesh->edit_mesh->bm != nullptr);
return &mesh->edit_mesh->bm->ldata;
}
return &mesh->loop_data;
}
static const CustomData *workbench_mesh_get_vert_custom_data(const Mesh *mesh)
{
if (mesh->runtime->wrapper_type == ME_WRAPPER_TYPE_BMESH) {
BLI_assert(mesh->edit_mesh != nullptr);
BLI_assert(mesh->edit_mesh->bm != nullptr);
return &mesh->edit_mesh->bm->vdata;
}
return &mesh->vert_data;
}
/**
* Decide what color-type to draw the object with.
* In some cases it can be overwritten by #workbench_material_setup().
*/
static eV3DShadingColorType workbench_color_type_get(WORKBENCH_PrivateData *wpd,
Object *ob,
bool *r_sculpt_pbvh,
bool *r_texpaint_mode,
bool *r_draw_shadow)
{
eV3DShadingColorType color_type = eV3DShadingColorType(wpd->shading.color_type);
const Mesh *me = static_cast<const Mesh *>((ob->type == OB_MESH) ? ob->data : nullptr);
const CustomData *ldata = (me == nullptr) ? nullptr : workbench_mesh_get_loop_custom_data(me);
const DRWContextState *draw_ctx = DRW_context_state_get();
const bool is_active = (ob == draw_ctx->obact);
const bool is_sculpt_pbvh = BKE_sculptsession_use_pbvh_draw(ob, draw_ctx->rv3d) &&
!DRW_state_is_image_render();
const bool is_render = DRW_state_is_image_render() && (draw_ctx->v3d == nullptr);
const bool is_texpaint_mode = is_active && (wpd->ctx_mode == CTX_MODE_PAINT_TEXTURE);
const bool is_vertpaint_mode = is_active && (wpd->ctx_mode == CTX_MODE_PAINT_VERTEX);
/* Needed for mesh cache validation, to prevent two copies of
* of vertex color arrays from being sent to the GPU (e.g.
* when switching from eevee to workbench).
*/
if (ob->sculpt && BKE_object_sculpt_pbvh_get(ob)) {
BKE_pbvh_is_drawing_set(BKE_object_sculpt_pbvh_get(ob), is_sculpt_pbvh);
}
bool has_color = false;
if (me) {
const CustomData *cd_vdata = workbench_mesh_get_vert_custom_data(me);
const CustomData *cd_ldata = workbench_mesh_get_loop_custom_data(me);
has_color = (CustomData_has_layer(cd_vdata, CD_PROP_COLOR) ||
CustomData_has_layer(cd_vdata, CD_PROP_BYTE_COLOR) ||
CustomData_has_layer(cd_ldata, CD_PROP_COLOR) ||
CustomData_has_layer(cd_ldata, CD_PROP_BYTE_COLOR));
}
if (color_type == V3D_SHADING_TEXTURE_COLOR) {
if (ob->dt < OB_TEXTURE) {
color_type = V3D_SHADING_MATERIAL_COLOR;
}
else if ((me == nullptr) || !CustomData_has_layer(ldata, CD_PROP_FLOAT2)) {
/* Disable color mode if data layer is unavailable. */
color_type = V3D_SHADING_MATERIAL_COLOR;
}
}
else if (color_type == V3D_SHADING_VERTEX_COLOR) {
if (!me) {
color_type = V3D_SHADING_OBJECT_COLOR;
}
else {
if (!has_color) {
color_type = V3D_SHADING_OBJECT_COLOR;
}
}
}
if (r_sculpt_pbvh) {
*r_sculpt_pbvh = is_sculpt_pbvh;
}
if (r_texpaint_mode) {
*r_texpaint_mode = false;
}
if (!is_sculpt_pbvh && !is_render) {
/* Force texture or vertex mode if object is in paint mode. */
if (is_texpaint_mode && me && CustomData_has_layer(ldata, CD_PROP_FLOAT2)) {
color_type = V3D_SHADING_TEXTURE_COLOR;
if (r_texpaint_mode) {
*r_texpaint_mode = true;
}
}
else if (is_vertpaint_mode && me && has_color) {
color_type = V3D_SHADING_VERTEX_COLOR;
}
}
if (is_sculpt_pbvh && color_type == V3D_SHADING_TEXTURE_COLOR &&
BKE_pbvh_type(BKE_object_sculpt_pbvh_get(ob)) != PBVH_FACES)
{
/* Force use of material color for sculpt. */
color_type = V3D_SHADING_MATERIAL_COLOR;
}
if (is_sculpt_pbvh) {
/* Bad call C is required to access the tool system that is context aware. Cast to non-const
* due to current API. */
bContext *C = (bContext *)DRW_context_state_get()->evil_C;
if (C != nullptr) {
color_type = ED_paint_shading_color_override(
C, &wpd->scene->toolsettings->paint_mode, ob, color_type);
}
}
if (r_draw_shadow) {
*r_draw_shadow = (ob->dtx & OB_DRAW_NO_SHADOW_CAST) == 0 && SHADOW_ENABLED(wpd);
/* Currently unsupported in sculpt mode. We could revert to the slow
* method in this case but I'm not sure if it's a good idea given that
* sculpted meshes are heavy to begin with. */
if (is_sculpt_pbvh) {
*r_draw_shadow = false;
}
if (is_active && DRW_object_use_hide_faces(ob)) {
*r_draw_shadow = false;
}
}
return color_type;
}
void workbench_cache_populate(void *ved, Object *ob)
{
WORKBENCH_Data *vedata = static_cast<WORKBENCH_Data *>(ved);
WORKBENCH_StorageList *stl = vedata->stl;
WORKBENCH_PrivateData *wpd = stl->wpd;
if (!DRW_object_is_renderable(ob)) {
return;
}
if (ob->type == OB_MESH && ob->modifiers.first != nullptr) {
bool use_texpaint_mode;
int color_type = workbench_color_type_get(wpd, ob, nullptr, &use_texpaint_mode, nullptr);
LISTBASE_FOREACH (ModifierData *, md, &ob->modifiers) {
if (md->type != eModifierType_ParticleSystem) {
continue;
}
ParticleSystem *psys = ((ParticleSystemModifierData *)md)->psys;
if (!DRW_object_is_visible_psys_in_active_context(ob, psys)) {
continue;
}
ParticleSettings *part = psys->part;
const int draw_as = (part->draw_as == PART_DRAW_REND) ? part->ren_as : part->draw_as;
if (draw_as == PART_DRAW_PATH) {
workbench_cache_hair_populate(
wpd, ob, psys, md, eV3DShadingColorType(color_type), use_texpaint_mode, part->omat);
}
}
}
if (!(ob->base_flag & BASE_FROM_DUPLI)) {
ModifierData *md = BKE_modifiers_findby_type(ob, eModifierType_Fluid);
if (md && BKE_modifier_is_enabled(wpd->scene, md, eModifierMode_Realtime)) {
FluidModifierData *fmd = (FluidModifierData *)md;
if (fmd->domain) {
workbench_volume_cache_populate(vedata, wpd->scene, ob, md, V3D_SHADING_SINGLE_COLOR);
if (fmd->domain->type == FLUID_DOMAIN_TYPE_GAS) {
return; /* Do not draw solid in this case. */
}
}
}
}
if (!(DRW_object_visibility_in_active_context(ob) & OB_VISIBLE_SELF)) {
return;
}
if ((ob->dt < OB_SOLID) && !DRW_state_is_scene_render()) {
return;
}
if (ob->type == OB_MESH) {
bool use_sculpt_pbvh, use_texpaint_mode, draw_shadow, has_transp_mat = false;
eV3DShadingColorType color_type = workbench_color_type_get(
wpd, ob, &use_sculpt_pbvh, &use_texpaint_mode, &draw_shadow);
if (use_sculpt_pbvh) {
workbench_cache_sculpt_populate(wpd, ob, color_type);
}
else if (use_texpaint_mode) {
workbench_cache_texpaint_populate(wpd, ob);
}
else {
workbench_cache_common_populate(wpd, ob, color_type, &has_transp_mat);
}
if (draw_shadow) {
workbench_shadow_cache_populate(vedata, ob, has_transp_mat);
}
}
else if (ob->type == OB_CURVES) {
int color_type = workbench_color_type_get(wpd, ob, nullptr, nullptr, nullptr);
DRWShadingGroup *grp = workbench_material_hair_setup(
wpd, ob, CURVES_MATERIAL_NR, eV3DShadingColorType(color_type));
DRW_shgroup_curves_create_sub(ob, grp, nullptr);
}
else if (ob->type == OB_POINTCLOUD) {
int color_type = workbench_color_type_get(wpd, ob, nullptr, nullptr, nullptr);
DRWShadingGroup *grp = workbench_material_ptcloud_setup(
wpd, ob, POINTCLOUD_MATERIAL_NR, eV3DShadingColorType(color_type));
DRW_shgroup_pointcloud_create_sub(ob, grp, nullptr);
}
else if (ob->type == OB_VOLUME) {
if (wpd->shading.type != OB_WIRE) {
int color_type = workbench_color_type_get(wpd, ob, nullptr, nullptr, nullptr);
workbench_volume_cache_populate(
vedata, wpd->scene, ob, nullptr, eV3DShadingColorType(color_type));
}
}
}
void workbench_cache_finish(void *ved)
{
WORKBENCH_Data *vedata = static_cast<WORKBENCH_Data *>(ved);
WORKBENCH_StorageList *stl = vedata->stl;
WORKBENCH_FramebufferList *fbl = vedata->fbl;
WORKBENCH_PrivateData *wpd = stl->wpd;
/* TODO(fclem): Only do this when really needed. */
{
/* HACK we allocate the in front depth here to avoid the overhead when if is not needed. */
DefaultFramebufferList *dfbl = DRW_viewport_framebuffer_list_get();
DefaultTextureList *dtxl = DRW_viewport_texture_list_get();
DRW_texture_ensure_fullscreen_2d(
&dtxl->depth_in_front, GPU_DEPTH24_STENCIL8, DRWTextureFlag(0));
GPU_framebuffer_ensure_config(&dfbl->in_front_fb,
{
GPU_ATTACHMENT_TEXTURE(dtxl->depth_in_front),
GPU_ATTACHMENT_TEXTURE(dtxl->color),
});
GPU_framebuffer_ensure_config(&fbl->opaque_infront_fb,
{
GPU_ATTACHMENT_TEXTURE(dtxl->depth_in_front),
GPU_ATTACHMENT_TEXTURE(wpd->material_buffer_tx),
GPU_ATTACHMENT_TEXTURE(wpd->normal_buffer_tx),
GPU_ATTACHMENT_TEXTURE(wpd->object_id_tx),
});
GPU_framebuffer_ensure_config(&fbl->transp_accum_infront_fb,
{
GPU_ATTACHMENT_TEXTURE(dtxl->depth_in_front),
GPU_ATTACHMENT_TEXTURE(wpd->accum_buffer_tx),
GPU_ATTACHMENT_TEXTURE(wpd->reveal_buffer_tx),
});
}
if (wpd->object_id_tx) {
GPU_framebuffer_ensure_config(&fbl->id_clear_fb,
{
GPU_ATTACHMENT_NONE,
GPU_ATTACHMENT_TEXTURE(wpd->object_id_tx),
});
}
else {
GPU_FRAMEBUFFER_FREE_SAFE(fbl->id_clear_fb);
}
workbench_update_material_ubos(wpd);
/* TODO: don't free reuse next redraw. */
for (int i = 0; i < 2; i++) {
for (int j = 0; j < 2; j++) {
for (int k = 0; k < WORKBENCH_DATATYPE_MAX; k++) {
if (wpd->prepass[i][j][k].material_hash) {
BLI_ghash_free(wpd->prepass[i][j][k].material_hash, nullptr, nullptr);
wpd->prepass[i][j][k].material_hash = nullptr;
}
}
}
}
}
void workbench_draw_sample(void *ved)
{
WORKBENCH_Data *vedata = static_cast<WORKBENCH_Data *>(ved);
WORKBENCH_FramebufferList *fbl = vedata->fbl;
WORKBENCH_PrivateData *wpd = vedata->stl->wpd;
WORKBENCH_PassList *psl = vedata->psl;
DefaultFramebufferList *dfbl = DRW_viewport_framebuffer_list_get();
const float clear_col[4] = {0.0f, 0.0f, 0.0f, 0.0f};
const float clear_col_with_alpha[4] = {0.0f, 0.0f, 0.0f, 1.0f};
const bool do_render = workbench_antialiasing_setup(vedata);
const bool xray_is_visible = wpd->shading.xray_alpha > 0.0f;
const bool do_transparent_infront_pass = !DRW_pass_is_empty(psl->transp_accum_infront_ps);
const bool do_transparent_pass = !DRW_pass_is_empty(psl->transp_accum_ps);
const bool do_opaque_infront_pass = !DRW_pass_is_empty(psl->opaque_infront_ps);
const bool do_opaque_pass = !DRW_pass_is_empty(psl->opaque_ps) || do_opaque_infront_pass;
if (dfbl->in_front_fb) {
GPU_framebuffer_bind(dfbl->in_front_fb);
GPU_framebuffer_clear_depth(dfbl->in_front_fb, 1.0f);
}
if (do_render) {
GPU_framebuffer_bind(dfbl->default_fb);
GPU_framebuffer_clear_color_depth_stencil(dfbl->default_fb, wpd->background_color, 1.0f, 0x00);
if (fbl->id_clear_fb) {
GPU_framebuffer_bind(fbl->id_clear_fb);
GPU_framebuffer_clear_color(fbl->id_clear_fb, clear_col);
}
if (do_opaque_pass) {
GPU_framebuffer_bind(fbl->opaque_fb);
DRW_draw_pass(psl->opaque_ps);
if (psl->shadow_ps[0]) {
DRW_draw_pass(psl->shadow_ps[0]);
DRW_draw_pass(psl->shadow_ps[1]);
}
if (do_opaque_infront_pass) {
GPU_framebuffer_bind(fbl->opaque_infront_fb);
DRW_draw_pass(psl->opaque_infront_ps);
GPU_framebuffer_bind(fbl->opaque_fb);
DRW_draw_pass(psl->merge_infront_ps);
}
GPU_framebuffer_bind(dfbl->default_fb);
DRW_draw_pass(psl->composite_ps);
if (psl->cavity_ps) {
GPU_framebuffer_bind(dfbl->color_only_fb);
DRW_draw_pass(psl->cavity_ps);
}
}
workbench_volume_draw_pass(vedata);
if (xray_is_visible) {
if (do_transparent_pass) {
GPU_framebuffer_bind(fbl->transp_accum_fb);
GPU_framebuffer_clear_color(fbl->transp_accum_fb, clear_col_with_alpha);
DRW_draw_pass(psl->transp_accum_ps);
GPU_framebuffer_bind(dfbl->color_only_fb);
DRW_draw_pass(psl->transp_resolve_ps);
}
if (do_transparent_infront_pass) {
GPU_framebuffer_bind(fbl->transp_accum_infront_fb);
GPU_framebuffer_clear_color(fbl->transp_accum_infront_fb, clear_col_with_alpha);
DRW_draw_pass(psl->transp_accum_infront_ps);
GPU_framebuffer_bind(dfbl->color_only_fb);
DRW_draw_pass(psl->transp_resolve_ps);
}
}
workbench_transparent_draw_depth_pass(vedata);
if (psl->outline_ps) {
GPU_framebuffer_bind(dfbl->color_only_fb);
DRW_draw_pass(psl->outline_ps);
}
workbench_dof_draw_pass(vedata);
}
workbench_antialiasing_draw_pass(vedata);
}
/* Viewport rendering. */
static void workbench_draw_scene(void *ved)
{
WORKBENCH_Data *vedata = static_cast<WORKBENCH_Data *>(ved);
WORKBENCH_PrivateData *wpd = vedata->stl->wpd;
if (DRW_state_is_viewport_image_render()) {
while (wpd->taa_sample < max_ii(1, wpd->taa_sample_len)) {
workbench_update_world_ubo(wpd);
workbench_draw_sample(vedata);
}
}
else {
workbench_draw_sample(vedata);
}
workbench_draw_finish(vedata);
}
void workbench_draw_finish(void * /*ved*/)
{
/* Reset default view. */
DRW_view_set_active(nullptr);
}
static void workbench_engine_free()
{
workbench_shader_free();
}
static void workbench_view_update(void *vedata)
{
WORKBENCH_Data *data = static_cast<WORKBENCH_Data *>(vedata);
workbench_antialiasing_view_updated(data);
}
static void workbench_id_update(void * /*vedata*/, ID *id)
{
if (GS(id->name) == ID_OB) {
WORKBENCH_ObjectData *oed = (WORKBENCH_ObjectData *)DRW_drawdata_get(id,
&draw_engine_workbench);
if (oed != nullptr && oed->dd.recalc != 0) {
oed->shadow_bbox_dirty = (oed->dd.recalc & ID_RECALC_ALL) != 0;
oed->dd.recalc = 0;
}
}
}
static const DrawEngineDataSize workbench_data_size = DRW_VIEWPORT_DATA_SIZE(WORKBENCH_Data);
DrawEngineType draw_engine_workbench = {
/*next*/ nullptr,
/*prev*/ nullptr,
/*idname*/ N_("Workbench"),
/*vedata_size*/ &workbench_data_size,
/*engine_init*/ &workbench_engine_init,
/*engine_free*/ &workbench_engine_free,
/*instance_free*/ nullptr,
/*cache_init*/ &workbench_cache_init,
/*cache_populate*/ &workbench_cache_populate,
/*cache_finish*/ &workbench_cache_finish,
/*draw_scene*/ &workbench_draw_scene,
/*view_update*/ &workbench_view_update,
/*id_update*/ &workbench_id_update,
/*render_to_image*/ &workbench_render,
/*store_metadata*/ nullptr,
};
RenderEngineType DRW_engine_viewport_workbench_type = {
/*next*/ nullptr,
/*prev*/ nullptr,
/*idname*/ WORKBENCH_ENGINE,
/*name*/ N_("Workbench"),
/*flag*/ RE_INTERNAL | RE_USE_STEREO_VIEWPORT | RE_USE_GPU_CONTEXT,
/*update*/ nullptr,
/*render*/ &DRW_render_to_image,
/*render_frame_finish*/ nullptr,
/*draw*/ nullptr,
/*bake*/ nullptr,
/*view_update*/ nullptr,
/*view_draw*/ nullptr,
/*update_script_node*/ nullptr,
/*update_render_passes*/ &workbench_render_update_passes,
/*draw_engine*/ &draw_engine_workbench,
/*rna_ext*/
{
/*data*/ nullptr,
/*srna*/ nullptr,
/*call*/ nullptr,
},
};
#undef WORKBENCH_ENGINE

View File

@ -1,304 +0,0 @@
/* SPDX-FileCopyrightText: 2018 Blender Authors
*
* SPDX-License-Identifier: GPL-2.0-or-later */
/** \file
* \ingroup draw_engine
*/
#include "workbench_private.h"
#include "BLI_memblock.h"
#include "BKE_image.h"
#include "BKE_node.hh"
#include "BLI_dynstr.h"
#include "BLI_hash.h"
#include "BLI_math_color.h"
#include "DNA_mesh_types.h"
#include "DNA_node_types.h"
#include "GPU_uniform_buffer.h"
#include "ED_uvedit.hh"
#define HSV_SATURATION 0.5
#define HSV_VALUE 0.8
void workbench_material_ubo_data(WORKBENCH_PrivateData *wpd,
Object *ob,
Material *mat,
WORKBENCH_UBO_Material *data,
eV3DShadingColorType color_type)
{
float metallic = 0.0f;
float roughness = 0.632455532f; /* sqrtf(0.4f); */
float alpha = wpd->shading.xray_alpha;
switch (color_type) {
case V3D_SHADING_SINGLE_COLOR:
copy_v3_v3(data->base_color, wpd->shading.single_color);
break;
case V3D_SHADING_RANDOM_COLOR: {
uint hash = BLI_ghashutil_strhash_p_murmur(ob->id.name);
if (ob->id.lib) {
hash = (hash * 13) ^ BLI_ghashutil_strhash_p_murmur(ob->id.lib->filepath);
}
float hue = BLI_hash_int_01(hash);
const float hsv[3] = {hue, HSV_SATURATION, HSV_VALUE};
hsv_to_rgb_v(hsv, data->base_color);
break;
}
case V3D_SHADING_OBJECT_COLOR:
case V3D_SHADING_VERTEX_COLOR:
alpha *= ob->color[3];
copy_v3_v3(data->base_color, ob->color);
break;
case V3D_SHADING_MATERIAL_COLOR:
case V3D_SHADING_TEXTURE_COLOR:
default:
if (mat) {
alpha *= mat->a;
copy_v3_v3(data->base_color, &mat->r);
metallic = mat->metallic;
roughness = sqrtf(mat->roughness); /* Remap to Disney roughness. */
}
else {
copy_v3_fl(data->base_color, 0.8f);
}
break;
}
uint32_t packed_metallic = unit_float_to_uchar_clamp(metallic);
uint32_t packed_roughness = unit_float_to_uchar_clamp(roughness);
uint32_t packed_alpha = unit_float_to_uchar_clamp(alpha);
data->packed_data = (packed_alpha << 16u) | (packed_roughness << 8u) | packed_metallic;
}
/* Return correct material or empty default material if slot is empty. */
BLI_INLINE Material *workbench_object_material_get(Object *ob, int mat_nr)
{
Material *ma = BKE_object_material_get_eval(ob, mat_nr);
if (ma == nullptr) {
ma = BKE_material_default_empty();
}
return ma;
}
BLI_INLINE void workbench_material_get_image(
Object *ob, int mat_nr, Image **r_image, ImageUser **r_iuser, GPUSamplerState *r_sampler)
{
const bNode *node;
*r_sampler = GPUSamplerState::default_sampler();
ED_object_get_active_image(ob, mat_nr, r_image, r_iuser, &node, nullptr);
if (node && *r_image) {
switch (node->type) {
case SH_NODE_TEX_IMAGE: {
const NodeTexImage *storage = static_cast<NodeTexImage *>(node->storage);
const bool use_filter = (storage->interpolation != SHD_INTERP_CLOSEST);
r_sampler->set_filtering_flag_from_test(GPU_SAMPLER_FILTERING_LINEAR, use_filter);
switch (storage->extension) {
case SHD_IMAGE_EXTENSION_EXTEND:
default:
r_sampler->extend_x = GPU_SAMPLER_EXTEND_MODE_EXTEND;
r_sampler->extend_yz = GPU_SAMPLER_EXTEND_MODE_EXTEND;
break;
case SHD_IMAGE_EXTENSION_REPEAT:
r_sampler->extend_x = GPU_SAMPLER_EXTEND_MODE_REPEAT;
r_sampler->extend_yz = GPU_SAMPLER_EXTEND_MODE_REPEAT;
break;
case SHD_IMAGE_EXTENSION_MIRROR:
r_sampler->extend_x = GPU_SAMPLER_EXTEND_MODE_MIRRORED_REPEAT;
r_sampler->extend_yz = GPU_SAMPLER_EXTEND_MODE_MIRRORED_REPEAT;
break;
case SHD_IMAGE_EXTENSION_CLIP:
r_sampler->extend_x = GPU_SAMPLER_EXTEND_MODE_CLAMP_TO_BORDER;
r_sampler->extend_yz = GPU_SAMPLER_EXTEND_MODE_CLAMP_TO_BORDER;
break;
}
break;
}
case SH_NODE_TEX_ENVIRONMENT: {
const NodeTexEnvironment *storage = static_cast<NodeTexEnvironment *>(node->storage);
const bool use_filter = (storage->interpolation != SHD_INTERP_CLOSEST);
r_sampler->set_filtering_flag_from_test(GPU_SAMPLER_FILTERING_LINEAR, use_filter);
break;
}
default:
BLI_assert_msg(0, "Node type not supported by workbench");
}
}
}
/* Return true if the current material ubo has changed and needs to be rebind. */
BLI_INLINE bool workbench_material_chunk_select(WORKBENCH_PrivateData *wpd,
uint32_t id,
uint32_t *r_mat_id)
{
bool resource_changed = false;
/* Divide in chunks of MAX_MATERIAL. */
uint32_t chunk = id >> 12u;
*r_mat_id = id & 0xFFFu;
/* We need to add a new chunk. */
while (chunk >= wpd->material_chunk_count) {
wpd->material_chunk_count++;
wpd->material_ubo_data_curr = static_cast<WORKBENCH_UBO_Material *>(
BLI_memblock_alloc(wpd->material_ubo_data));
wpd->material_ubo_curr = static_cast<GPUUniformBuf *>(workbench_material_ubo_alloc(wpd));
wpd->material_chunk_curr = chunk;
resource_changed = true;
}
/* We need to go back to a previous chunk. */
if (wpd->material_chunk_curr != chunk) {
wpd->material_ubo_data_curr = static_cast<WORKBENCH_UBO_Material *>(
BLI_memblock_elem_get(wpd->material_ubo_data, 0, chunk));
wpd->material_ubo_curr = static_cast<GPUUniformBuf *>(
BLI_memblock_elem_get(wpd->material_ubo, 0, chunk));
wpd->material_chunk_curr = chunk;
resource_changed = true;
}
return resource_changed;
}
DRWShadingGroup *workbench_material_setup_ex(WORKBENCH_PrivateData *wpd,
Object *ob,
int mat_nr,
eV3DShadingColorType color_type,
eWORKBENCH_DataType datatype,
bool *r_transp)
{
Image *ima = nullptr;
ImageUser *iuser = nullptr;
GPUSamplerState sampler;
const bool infront = (ob->dtx & OB_DRAW_IN_FRONT) != 0;
if (color_type == V3D_SHADING_TEXTURE_COLOR) {
workbench_material_get_image(ob, mat_nr, &ima, &iuser, &sampler);
if (ima == nullptr) {
/* Fallback to material color. */
color_type = V3D_SHADING_MATERIAL_COLOR;
}
}
switch (color_type) {
case V3D_SHADING_TEXTURE_COLOR: {
return workbench_image_setup_ex(wpd, ob, mat_nr, ima, iuser, sampler, datatype);
}
case V3D_SHADING_MATERIAL_COLOR: {
/* For now, we use the same ubo for material and object coloring but with different indices.
* This means they are mutually exclusive. */
BLI_assert(
ELEM(wpd->shading.color_type, V3D_SHADING_MATERIAL_COLOR, V3D_SHADING_TEXTURE_COLOR));
Material *ma = workbench_object_material_get(ob, mat_nr);
const bool transp = wpd->shading.xray_alpha < 1.0f || ma->a < 1.0f;
WORKBENCH_Prepass *prepass = &wpd->prepass[transp][infront][datatype];
if (r_transp && transp) {
*r_transp = true;
}
DRWShadingGroup **grp_mat = nullptr;
/* A hash-map stores material shgroups to pack all similar drawcalls together. */
if (BLI_ghash_ensure_p(prepass->material_hash, ma, (void ***)&grp_mat)) {
return *grp_mat;
}
uint32_t mat_id, id = wpd->material_index++;
workbench_material_chunk_select(wpd, id, &mat_id);
workbench_material_ubo_data(wpd, ob, ma, &wpd->material_ubo_data_curr[mat_id], color_type);
DRWShadingGroup *grp = prepass->common_shgrp;
*grp_mat = grp = DRW_shgroup_create_sub(grp);
DRW_shgroup_uniform_block(grp, "materials_data", wpd->material_ubo_curr);
DRW_shgroup_uniform_int_copy(grp, "materialIndex", mat_id);
return grp;
}
case V3D_SHADING_VERTEX_COLOR: {
const bool transp = wpd->shading.xray_alpha < 1.0f;
DRWShadingGroup *grp = wpd->prepass[transp][infront][datatype].vcol_shgrp;
return grp;
}
default: {
/* For now, we use the same ubo for material and object coloring but with different indices.
* This means they are mutually exclusive. */
BLI_assert(
!ELEM(wpd->shading.color_type, V3D_SHADING_MATERIAL_COLOR, V3D_SHADING_TEXTURE_COLOR));
uint32_t mat_id, id = DRW_object_resource_id_get(ob);
bool resource_changed = workbench_material_chunk_select(wpd, id, &mat_id);
workbench_material_ubo_data(
wpd, ob, nullptr, &wpd->material_ubo_data_curr[mat_id], color_type);
const bool transp = wpd->shading.xray_alpha < 1.0f || ob->color[3] < 1.0f;
DRWShadingGroup **grp = &wpd->prepass[transp][infront][datatype].common_shgrp;
if (resource_changed) {
*grp = DRW_shgroup_create_sub(*grp);
DRW_shgroup_uniform_block(*grp, "materials_data", wpd->material_ubo_curr);
}
if (r_transp && transp) {
*r_transp = true;
}
return *grp;
}
}
}
DRWShadingGroup *workbench_image_setup_ex(WORKBENCH_PrivateData *wpd,
Object *ob,
int mat_nr,
Image *ima,
ImageUser *iuser,
GPUSamplerState sampler,
eWORKBENCH_DataType datatype)
{
GPUTexture *tex = nullptr, *tex_tile_data = nullptr;
if (ima == nullptr) {
workbench_material_get_image(ob, mat_nr, &ima, &iuser, &sampler);
}
if (ima) {
if (ima->source == IMA_SRC_TILED) {
tex = BKE_image_get_gpu_tiles(ima, iuser, nullptr);
tex_tile_data = BKE_image_get_gpu_tilemap(ima, iuser, nullptr);
}
else {
tex = BKE_image_get_gpu_texture(ima, iuser, nullptr);
}
}
if (tex == nullptr) {
tex = wpd->dummy_image_tx;
}
const bool infront = (ob->dtx & OB_DRAW_IN_FRONT) != 0;
const bool transp = wpd->shading.xray_alpha < 1.0f;
WORKBENCH_Prepass *prepass = &wpd->prepass[transp][infront][datatype];
DRWShadingGroup **grp_tex = nullptr;
/* A hash-map stores image shgroups to pack all similar drawcalls together. */
if (BLI_ghash_ensure_p(prepass->material_hash, tex, (void ***)&grp_tex)) {
return *grp_tex;
}
DRWShadingGroup *grp = (tex_tile_data) ? prepass->image_tiled_shgrp : prepass->image_shgrp;
*grp_tex = grp = DRW_shgroup_create_sub(grp);
if (tex_tile_data) {
DRW_shgroup_uniform_texture_ex(grp, "imageTileArray", tex, sampler);
DRW_shgroup_uniform_texture(grp, "imageTileData", tex_tile_data);
}
else {
DRW_shgroup_uniform_texture_ex(grp, "imageTexture", tex, sampler);
}
DRW_shgroup_uniform_bool_copy(grp, "imagePremult", (ima && ima->alpha_mode == IMA_ALPHA_PREMUL));
DRW_shgroup_uniform_float_copy(grp, "imageTransparencyCutoff", 0.1f);
return grp;
}

View File

@ -1,157 +0,0 @@
/* SPDX-FileCopyrightText: 2020 Blender Authors
*
* SPDX-License-Identifier: GPL-2.0-or-later */
/** \file
* \ingroup draw_engine
*
* Opaque Pipeline:
*
* Use deferred shading to render opaque surfaces.
* This decouple the shading cost from scene complexity.
*
* The rendering is broken down in two passes:
* - the pre-pass where we render all the surfaces and output material data.
* - the composite pass where we compute the final aspect of the pixels.
*/
#include "DRW_render.h"
#include "workbench_engine.h"
#include "workbench_private.h"
void workbench_opaque_engine_init(WORKBENCH_Data *data)
{
WORKBENCH_FramebufferList *fbl = data->fbl;
WORKBENCH_PrivateData *wpd = data->stl->wpd;
DefaultTextureList *dtxl = DRW_viewport_texture_list_get();
DrawEngineType *owner = (DrawEngineType *)&workbench_opaque_engine_init;
/* Reused the same textures format for transparent pipeline to share the textures. */
const eGPUTextureFormat col_tex_format = GPU_RGBA16F;
const eGPUTextureFormat nor_tex_format = NORMAL_ENCODING_ENABLED() ? GPU_RG16F : GPU_RGBA16F;
const eGPUTextureUsage usage = GPU_TEXTURE_USAGE_ATTACHMENT | GPU_TEXTURE_USAGE_SHADER_READ;
wpd->material_buffer_tx = DRW_texture_pool_query_fullscreen_ex(col_tex_format, usage, owner);
wpd->normal_buffer_tx = DRW_texture_pool_query_fullscreen_ex(nor_tex_format, usage, owner);
GPU_framebuffer_ensure_config(&fbl->opaque_fb,
{
GPU_ATTACHMENT_TEXTURE(dtxl->depth),
GPU_ATTACHMENT_TEXTURE(wpd->material_buffer_tx),
GPU_ATTACHMENT_TEXTURE(wpd->normal_buffer_tx),
GPU_ATTACHMENT_TEXTURE(wpd->object_id_tx),
});
}
void workbench_opaque_cache_init(WORKBENCH_Data *vedata)
{
WORKBENCH_PassList *psl = vedata->psl;
WORKBENCH_PrivateData *wpd = vedata->stl->wpd;
DefaultTextureList *dtxl = DRW_viewport_texture_list_get();
GPUShader *sh;
DRWShadingGroup *grp;
const bool use_matcap = (wpd->shading.light == V3D_LIGHTING_MATCAP);
{
DRWState state = DRW_STATE_WRITE_COLOR | DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_LESS_EQUAL;
int opaque = 0;
for (int infront = 0; infront < 2; infront++) {
DRWPass *pass;
if (infront) {
DRW_PASS_CREATE(psl->opaque_infront_ps, state | wpd->cull_state | wpd->clip_state);
pass = psl->opaque_infront_ps;
}
else {
DRW_PASS_CREATE(psl->opaque_ps, state | wpd->cull_state | wpd->clip_state);
pass = psl->opaque_ps;
}
for (int data_i = 0; data_i < WORKBENCH_DATATYPE_MAX; data_i++) {
eWORKBENCH_DataType data = eWORKBENCH_DataType(data_i);
wpd->prepass[opaque][infront][data].material_hash = BLI_ghash_ptr_new(__func__);
sh = workbench_shader_opaque_get(wpd, data);
wpd->prepass[opaque][infront][data].common_shgrp = grp = DRW_shgroup_create(sh, pass);
DRW_shgroup_uniform_block(grp, "world_data", wpd->world_ubo);
DRW_shgroup_uniform_block(grp, "materials_data", wpd->material_ubo_curr);
DRW_shgroup_uniform_int_copy(grp, "materialIndex", -1);
DRW_shgroup_uniform_bool_copy(grp, "useMatcap", use_matcap);
wpd->prepass[opaque][infront][data].vcol_shgrp = grp = DRW_shgroup_create(sh, pass);
DRW_shgroup_uniform_block(grp, "world_data", wpd->world_ubo);
DRW_shgroup_uniform_block(grp, "materials_data", wpd->material_ubo_curr);
DRW_shgroup_uniform_int_copy(grp, "materialIndex", 0); /* Default material. (uses vcol) */
DRW_shgroup_uniform_bool_copy(grp, "useMatcap", use_matcap);
sh = workbench_shader_opaque_image_get(wpd, data, false);
wpd->prepass[opaque][infront][data].image_shgrp = grp = DRW_shgroup_create(sh, pass);
DRW_shgroup_uniform_block(grp, "world_data", wpd->world_ubo);
DRW_shgroup_uniform_block(grp, "materials_data", wpd->material_ubo_curr);
DRW_shgroup_uniform_int_copy(grp, "materialIndex", 0); /* Default material. */
DRW_shgroup_uniform_bool_copy(grp, "useMatcap", use_matcap);
sh = workbench_shader_opaque_image_get(wpd, data, true);
wpd->prepass[opaque][infront][data].image_tiled_shgrp = grp = DRW_shgroup_create(sh, pass);
DRW_shgroup_uniform_block(grp, "world_data", wpd->world_ubo);
DRW_shgroup_uniform_block(grp, "materials_data", wpd->material_ubo_curr);
DRW_shgroup_uniform_int_copy(grp, "materialIndex", 0); /* Default material. */
DRW_shgroup_uniform_bool_copy(grp, "useMatcap", use_matcap);
}
}
}
{
DRWState state = DRW_STATE_WRITE_COLOR | DRW_STATE_DEPTH_GREATER | DRW_STATE_STENCIL_EQUAL;
DRW_PASS_CREATE(psl->composite_ps, state);
sh = workbench_shader_composite_get(wpd);
grp = DRW_shgroup_create(sh, psl->composite_ps);
DRW_shgroup_uniform_block(grp, "world_data", wpd->world_ubo);
DRW_shgroup_uniform_texture(grp, "materialBuffer", wpd->material_buffer_tx);
DRW_shgroup_uniform_texture(grp, "normalBuffer", wpd->normal_buffer_tx);
DRW_shgroup_uniform_bool_copy(grp, "forceShadowing", false);
DRW_shgroup_stencil_mask(grp, 0x00);
if (STUDIOLIGHT_TYPE_MATCAP_ENABLED(wpd)) {
BKE_studiolight_ensure_flag(wpd->studio_light,
STUDIOLIGHT_MATCAP_DIFFUSE_GPUTEXTURE |
STUDIOLIGHT_MATCAP_SPECULAR_GPUTEXTURE);
GPUTexture *diff_tx = wpd->studio_light->matcap_diffuse.gputexture;
GPUTexture *spec_tx = wpd->studio_light->matcap_specular.gputexture;
const bool use_spec = workbench_is_specular_highlight_enabled(wpd);
spec_tx = (use_spec && spec_tx) ? spec_tx : diff_tx;
DRW_shgroup_uniform_texture(grp, "matcap_diffuse_tx", diff_tx);
DRW_shgroup_uniform_texture(grp, "matcap_specular_tx", spec_tx);
}
DRW_shgroup_call_procedural_triangles(grp, nullptr, 1);
if (SHADOW_ENABLED(wpd)) {
grp = DRW_shgroup_create_sub(grp);
DRW_shgroup_uniform_bool_copy(grp, "forceShadowing", true);
DRW_shgroup_state_disable(grp, DRW_STATE_STENCIL_EQUAL);
DRW_shgroup_state_enable(grp, DRW_STATE_STENCIL_NEQUAL);
DRW_shgroup_stencil_mask(grp, 0x00);
DRW_shgroup_call_procedural_triangles(grp, nullptr, 1);
}
}
{
DRWState state = DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_ALWAYS | DRW_STATE_WRITE_STENCIL |
DRW_STATE_STENCIL_ALWAYS;
DRW_PASS_CREATE(psl->merge_infront_ps, state);
sh = workbench_shader_merge_infront_get(wpd);
grp = DRW_shgroup_create(sh, psl->merge_infront_ps);
DRW_shgroup_uniform_texture_ref(grp, "depthBuffer", &dtxl->depth_in_front);
DRW_shgroup_stencil_mask(grp, 0x00);
DRW_shgroup_call_procedural_triangles(grp, nullptr, 1);
}
}

View File

@ -1,567 +0,0 @@
/* SPDX-FileCopyrightText: 2016 Blender Authors
*
* SPDX-License-Identifier: GPL-2.0-or-later */
/** \file
* \ingroup draw_engine
*/
#pragma once
#include "BKE_studiolight.h"
#include "DNA_image_types.h"
#include "DNA_userdef_types.h"
#include "DNA_view3d_types.h"
#include "DNA_world_types.h"
#include "DRW_render.h"
#include "workbench_engine.h"
#ifdef __cplusplus
extern "C" {
#endif
extern struct DrawEngineType draw_engine_workbench;
#define WORKBENCH_ENGINE "BLENDER_WORKBENCH"
#define MAX_MATERIAL (1 << 12)
#define DEBUG_SHADOW_VOLUME 0
#define STUDIOLIGHT_ENABLED(wpd) (wpd->shading.light == V3D_LIGHTING_STUDIO)
#define MATCAP_ENABLED(wpd) (wpd->shading.light == V3D_LIGHTING_MATCAP)
#define USE_WORLD_ORIENTATION(wpd) ((wpd->shading.flag & V3D_SHADING_WORLD_ORIENTATION) != 0)
#define STUDIOLIGHT_TYPE_WORLD_ENABLED(wpd) \
(STUDIOLIGHT_ENABLED(wpd) && (wpd->studio_light->flag & STUDIOLIGHT_TYPE_WORLD))
#define STUDIOLIGHT_TYPE_STUDIO_ENABLED(wpd) \
(STUDIOLIGHT_ENABLED(wpd) && (wpd->studio_light->flag & STUDIOLIGHT_TYPE_STUDIO))
#define STUDIOLIGHT_TYPE_MATCAP_ENABLED(wpd) \
(MATCAP_ENABLED(wpd) && (wpd->studio_light->flag & STUDIOLIGHT_TYPE_MATCAP))
#define SSAO_ENABLED(wpd) \
((wpd->shading.flag & V3D_SHADING_CAVITY) && \
((wpd->shading.cavity_type == V3D_SHADING_CAVITY_SSAO) || \
(wpd->shading.cavity_type == V3D_SHADING_CAVITY_BOTH)))
#define CURVATURE_ENABLED(wpd) \
((wpd->shading.flag & V3D_SHADING_CAVITY) && \
((wpd->shading.cavity_type == V3D_SHADING_CAVITY_CURVATURE) || \
(wpd->shading.cavity_type == V3D_SHADING_CAVITY_BOTH)))
#define CAVITY_ENABLED(wpd) (CURVATURE_ENABLED(wpd) || SSAO_ENABLED(wpd))
#define SHADOW_ENABLED(wpd) (wpd->shading.flag & V3D_SHADING_SHADOW)
#define CULL_BACKFACE_ENABLED(wpd) ((wpd->shading.flag & V3D_SHADING_BACKFACE_CULLING) != 0)
#define OBJECT_OUTLINE_ENABLED(wpd) (wpd->shading.flag & V3D_SHADING_OBJECT_OUTLINE)
#define OBJECT_ID_PASS_ENABLED(wpd) (OBJECT_OUTLINE_ENABLED(wpd) || CURVATURE_ENABLED(wpd))
#define NORMAL_ENCODING_ENABLED() (true)
struct Object;
struct RenderEngine;
struct RenderLayer;
struct rcti;
typedef enum eWORKBENCH_DataType {
WORKBENCH_DATATYPE_MESH = 0,
WORKBENCH_DATATYPE_HAIR,
WORKBENCH_DATATYPE_POINTCLOUD,
WORKBENCH_DATATYPE_MAX,
} eWORKBENCH_DataType;
/* Types of volume display interpolation. */
typedef enum eWORKBENCH_VolumeInterpType {
WORKBENCH_VOLUME_INTERP_LINEAR = 0,
WORKBENCH_VOLUME_INTERP_CUBIC,
WORKBENCH_VOLUME_INTERP_CLOSEST,
} eWORKBENCH_VolumeInterpType;
typedef struct WORKBENCH_FramebufferList {
struct GPUFrameBuffer *opaque_fb;
struct GPUFrameBuffer *opaque_infront_fb;
struct GPUFrameBuffer *transp_accum_fb;
struct GPUFrameBuffer *transp_accum_infront_fb;
struct GPUFrameBuffer *id_clear_fb;
struct GPUFrameBuffer *dof_downsample_fb;
struct GPUFrameBuffer *dof_coc_tile_h_fb;
struct GPUFrameBuffer *dof_coc_tile_v_fb;
struct GPUFrameBuffer *dof_coc_dilate_fb;
struct GPUFrameBuffer *dof_blur1_fb;
struct GPUFrameBuffer *dof_blur2_fb;
struct GPUFrameBuffer *antialiasing_fb;
struct GPUFrameBuffer *antialiasing_in_front_fb;
struct GPUFrameBuffer *smaa_edge_fb;
struct GPUFrameBuffer *smaa_weight_fb;
} WORKBENCH_FramebufferList;
typedef struct WORKBENCH_TextureList {
struct GPUTexture *dof_source_tx;
struct GPUTexture *coc_halfres_tx;
struct GPUTexture *history_buffer_tx;
struct GPUTexture *depth_buffer_tx;
struct GPUTexture *depth_buffer_in_front_tx;
struct GPUTexture *smaa_search_tx;
struct GPUTexture *smaa_area_tx;
struct GPUTexture *dummy_image_tx;
struct GPUTexture *dummy_volume_tx;
struct GPUTexture *dummy_shadow_tx;
struct GPUTexture *dummy_coba_tx;
} WORKBENCH_TextureList;
typedef struct WORKBENCH_StorageList {
struct WORKBENCH_PrivateData *wpd;
float *dof_ubo_data;
} WORKBENCH_StorageList;
typedef struct WORKBENCH_PassList {
struct DRWPass *opaque_ps;
struct DRWPass *opaque_infront_ps;
struct DRWPass *transp_resolve_ps;
struct DRWPass *transp_accum_ps;
struct DRWPass *transp_accum_infront_ps;
struct DRWPass *transp_depth_infront_ps;
struct DRWPass *transp_depth_ps;
struct DRWPass *shadow_ps[2];
struct DRWPass *merge_infront_ps;
struct DRWPass *cavity_ps;
struct DRWPass *outline_ps;
struct DRWPass *composite_ps;
struct DRWPass *dof_down_ps;
struct DRWPass *dof_down2_ps;
struct DRWPass *dof_flatten_v_ps;
struct DRWPass *dof_flatten_h_ps;
struct DRWPass *dof_dilate_h_ps;
struct DRWPass *dof_dilate_v_ps;
struct DRWPass *dof_blur1_ps;
struct DRWPass *dof_blur2_ps;
struct DRWPass *dof_resolve_ps;
struct DRWPass *volume_ps;
struct DRWPass *aa_accum_ps;
struct DRWPass *aa_accum_replace_ps;
struct DRWPass *aa_edge_ps;
struct DRWPass *aa_weight_ps;
struct DRWPass *aa_resolve_ps;
} WORKBENCH_PassList;
typedef struct WORKBENCH_Data {
void *engine_type;
WORKBENCH_FramebufferList *fbl;
WORKBENCH_TextureList *txl;
WORKBENCH_PassList *psl;
WORKBENCH_StorageList *stl;
} WORKBENCH_Data;
typedef struct WORKBENCH_UBO_Light {
float light_direction[4];
float specular_color[3], pad;
float diffuse_color[3], wrapped;
} WORKBENCH_UBO_Light;
typedef struct WORKBENCH_UBO_Material {
float base_color[3];
/* Packed data into a int. Decoded in the shader. */
uint32_t packed_data;
} WORKBENCH_UBO_Material;
typedef struct WORKBENCH_UBO_World {
float viewport_size[2], viewport_size_inv[2];
float object_outline_color[4];
float shadow_direction_vs[4];
float shadow_focus, shadow_shift, shadow_mul, shadow_add;
WORKBENCH_UBO_Light lights[4];
float ambient_color[4];
int cavity_sample_start;
int cavity_sample_end;
float cavity_sample_count_inv;
float cavity_jitter_scale;
float cavity_valley_factor;
float cavity_ridge_factor;
float cavity_attenuation;
float cavity_distance;
float curvature_ridge;
float curvature_valley;
float ui_scale;
float _pad0;
int matcap_orientation;
int use_specular; /* Bools are 32bit ints in GLSL. */
float xray_alpha; /* Workbench Next */
int _pad2;
/* Workbench Next data
* (Not used here, but needs to be kept in sync with workbench_shader_shared WorldData) */
float background_color[4];
} WORKBENCH_UBO_World;
BLI_STATIC_ASSERT_ALIGN(WORKBENCH_UBO_World, 16)
BLI_STATIC_ASSERT_ALIGN(WORKBENCH_UBO_Light, 16)
BLI_STATIC_ASSERT_ALIGN(WORKBENCH_UBO_Material, 16)
typedef struct WORKBENCH_Prepass {
/** Hash storing shading group for each Material or GPUTexture to reduce state changes. */
struct GHash *material_hash;
/** First common (non-vertex-color and non-image-colored) shading group to created subgroups. */
struct DRWShadingGroup *common_shgrp;
/** First Vertex Color shading group to created subgroups. */
struct DRWShadingGroup *vcol_shgrp;
/** First Image shading group to created subgroups. */
struct DRWShadingGroup *image_shgrp;
/** First UDIM (tiled image) shading group to created subgroups. */
struct DRWShadingGroup *image_tiled_shgrp;
} WORKBENCH_Prepass;
typedef struct WORKBENCH_PrivateData {
/** ViewLayerData for faster access. */
struct WORKBENCH_ViewLayerData *vldata;
/** Copy of draw_ctx->sh_cfg for faster access. */
eGPUShaderConfig sh_cfg;
/** Global clip and cull states. */
DRWState clip_state, cull_state;
/** Copy of scene->display.shading or v3d->shading for viewport. */
View3DShading shading;
/** Chosen studiolight or matcap. */
StudioLight *studio_light;
/** Copy of ctx_draw->scene for faster access. */
struct Scene *scene;
/** Shorthand version of U global for user preferences. */
const UserDef *preferences;
/** Copy of context mode for faster access. */
eContextObjectMode ctx_mode;
/** Shorthand for wpd->vldata->world_ubo. */
struct GPUUniformBuf *world_ubo;
/** Background color to clear the color buffer with. */
float background_color[4];
/* Shadow */
/** Previous shadow direction to test if shadow has changed. */
float shadow_cached_direction[3];
/** Current shadow direction in world space. */
float shadow_direction_ws[3];
/** Shadow precomputed matrices. */
float shadow_mat[4][4];
float shadow_inv[4][4];
/** Far plane of the view frustum. Used for shadow volume extrusion. */
float shadow_far_plane[4];
/** Min and max of shadow_near_corners. Speed up culling test. */
float shadow_near_min[3];
float shadow_near_max[3];
/** This is a parallelogram, so only 2 normal and distance to the edges. */
float shadow_near_sides[2][4];
/* Shadow shading groups. First array elem is for non-manifold geom and second for manifold. */
struct DRWShadingGroup *shadow_pass_grp[2];
struct DRWShadingGroup *shadow_fail_grp[2];
struct DRWShadingGroup *shadow_fail_caps_grp[2];
/** If the shadow has changed direction and ob bboxes needs to be updated. */
bool shadow_changed;
/* Temporal Anti-aliasing. */
/** Total number of samples to after which TAA stops accumulating samples. */
int taa_sample_len;
/** Total number of samples of the previous TAA. When changed TAA will be reset. */
int taa_sample_len_previous;
/** Current TAA sample index in [0..taa_sample_len[ range. */
int taa_sample;
/** Weight accumulated. */
float taa_weight_accum;
/** Samples weight for this iteration. */
float taa_weights[9];
/** Sum of taa_weights. */
float taa_weights_sum;
/** If the view has been updated and TAA needs to be reset. */
bool view_updated;
/** True if the history buffer contains relevant data and false if it could contain garbage. */
bool valid_history;
/** View */
struct DRWView *view;
/** Last projection matrix to see if view is still valid. */
float last_mat[4][4];
/* Smart Morphological Anti-Aliasing */
/** Temp buffers to store edges and weights. */
struct GPUTexture *smaa_edge_tx;
struct GPUTexture *smaa_weight_tx;
/** Weight of the smaa pass. */
float smaa_mix_factor;
/** Opaque pipeline buffers. */
struct GPUTexture *material_buffer_tx;
struct GPUTexture *composite_buffer_tx;
struct GPUTexture *normal_buffer_tx;
/** Transparent pipeline buffers. */
struct GPUTexture *accum_buffer_tx;
struct GPUTexture *reveal_buffer_tx;
/** Object IDs buffer for curvature & outline. */
struct GPUTexture *object_id_tx;
/** Pre-pass information for each draw types [transparent][infront][datatype]. */
WORKBENCH_Prepass prepass[2][2][WORKBENCH_DATATYPE_MAX];
/* Materials */
/** Copy of vldata->material_ubo for faster access. */
struct BLI_memblock *material_ubo;
/** Copy of vldata->material_ubo_data for faster access. */
struct BLI_memblock *material_ubo_data;
/** Current material chunk being filled by workbench_material_setup_ex(). */
WORKBENCH_UBO_Material *material_ubo_data_curr;
struct GPUUniformBuf *material_ubo_curr;
/** Copy of txl->dummy_image_tx for faster access. */
struct GPUTexture *dummy_image_tx;
/** Total number of used material chunk. */
int material_chunk_count;
/** Index of current material chunk. */
int material_chunk_curr;
/** Index of current material inside the material chunk. Only for material coloring mode. */
int material_index;
/* Depth of Field */
/** Depth of field temp buffers. */
struct GPUTexture *dof_blur_tx;
struct GPUTexture *coc_temp_tx;
struct GPUTexture *coc_tiles_tx[2];
/** Depth of field parameters. */
float dof_aperturesize;
float dof_distance;
float dof_invsensorsize;
float dof_near_far[2];
float dof_blades;
float dof_rotation;
float dof_ratio;
/* Camera override for rendering. */
struct Object *cam_original_ob;
/** True if any volume needs to be rendered. */
bool volumes_do;
/** Convenience boolean. */
bool dof_enabled;
bool is_playback;
bool is_navigating;
bool reset_next_sample;
} WORKBENCH_PrivateData; /* Transient data */
typedef struct WORKBENCH_ObjectData {
DrawData dd;
/* Shadow direction in local object space. */
float shadow_dir[3], shadow_depth;
/* Min, max in shadow space */
float shadow_min[3], shadow_max[3];
BoundBox shadow_bbox;
bool shadow_bbox_dirty;
} WORKBENCH_ObjectData;
typedef struct WORKBENCH_ViewLayerData {
/** Depth of field sample location array. */
struct GPUUniformBuf *dof_sample_ubo;
/** All constant data used for a render loop. */
struct GPUUniformBuf *world_ubo;
/** Cavity sample location array. */
struct GPUUniformBuf *cavity_sample_ubo;
/** Blue noise texture used to randomize the sampling of some effects. */
struct GPUTexture *cavity_jitter_tx;
/** Materials UBO's allocated in a memblock for easy bookkeeping. */
struct BLI_memblock *material_ubo;
struct BLI_memblock *material_ubo_data;
/** Number of samples for which cavity_sample_ubo is valid. */
int cavity_sample_count;
} WORKBENCH_ViewLayerData;
/* inline helper functions */
BLI_INLINE bool workbench_is_specular_highlight_enabled(WORKBENCH_PrivateData *wpd)
{
if (wpd->shading.flag & V3D_SHADING_SPECULAR_HIGHLIGHT) {
if (STUDIOLIGHT_ENABLED(wpd) || MATCAP_ENABLED(wpd)) {
return (wpd->studio_light->flag & STUDIOLIGHT_SPECULAR_HIGHLIGHT_PASS) != 0;
}
}
return false;
}
/* `workbench_opaque.cc` */
void workbench_opaque_engine_init(WORKBENCH_Data *data);
void workbench_opaque_cache_init(WORKBENCH_Data *data);
/* `workbench_transparent.cc` */
void workbench_transparent_engine_init(WORKBENCH_Data *data);
void workbench_transparent_cache_init(WORKBENCH_Data *data);
/**
* Redraw the transparent passes but with depth test
* to output correct outline IDs and depth.
*/
void workbench_transparent_draw_depth_pass(WORKBENCH_Data *data);
/* `workbench_shadow.cc` */
void workbench_shadow_data_update(WORKBENCH_PrivateData *wpd, WORKBENCH_UBO_World *wd);
void workbench_shadow_cache_init(WORKBENCH_Data *data);
void workbench_shadow_cache_populate(WORKBENCH_Data *data, Object *ob, bool has_transp_mat);
/* `workbench_shader.cc` */
GPUShader *workbench_shader_opaque_get(WORKBENCH_PrivateData *wpd, eWORKBENCH_DataType data);
GPUShader *workbench_shader_opaque_image_get(WORKBENCH_PrivateData *wpd,
eWORKBENCH_DataType data,
bool tiled);
GPUShader *workbench_shader_composite_get(WORKBENCH_PrivateData *wpd);
GPUShader *workbench_shader_merge_infront_get(WORKBENCH_PrivateData *wpd);
GPUShader *workbench_shader_transparent_get(WORKBENCH_PrivateData *wpd, eWORKBENCH_DataType data);
GPUShader *workbench_shader_transparent_image_get(WORKBENCH_PrivateData *wpd,
eWORKBENCH_DataType data,
bool tiled);
GPUShader *workbench_shader_transparent_resolve_get(WORKBENCH_PrivateData *wpd);
GPUShader *workbench_shader_shadow_pass_get(bool manifold);
GPUShader *workbench_shader_shadow_fail_get(bool manifold, bool cap);
GPUShader *workbench_shader_cavity_get(bool cavity, bool curvature);
GPUShader *workbench_shader_outline_get(void);
GPUShader *workbench_shader_antialiasing_accumulation_get(void);
GPUShader *workbench_shader_antialiasing_get(int stage);
GPUShader *workbench_shader_volume_get(bool slice,
bool coba,
eWORKBENCH_VolumeInterpType interp_type,
bool smoke);
void workbench_shader_depth_of_field_get(GPUShader **prepare_sh,
GPUShader **downsample_sh,
GPUShader **blur1_sh,
GPUShader **blur2_sh,
GPUShader **resolve_sh);
void workbench_shader_free(void);
/* `workbench_effect_antialiasing.cc` */
int workbench_antialiasing_sample_count_get(WORKBENCH_PrivateData *wpd);
void workbench_antialiasing_engine_init(WORKBENCH_Data *vedata);
void workbench_antialiasing_cache_init(WORKBENCH_Data *vedata);
void workbench_antialiasing_view_updated(WORKBENCH_Data *vedata);
/**
* Return true if render is not cached.
*/
bool workbench_antialiasing_setup(WORKBENCH_Data *vedata);
void workbench_antialiasing_draw_pass(WORKBENCH_Data *vedata);
/* `workbench_effect_cavity.cc` */
void workbench_cavity_data_update(WORKBENCH_PrivateData *wpd, WORKBENCH_UBO_World *wd);
void workbench_cavity_samples_ubo_ensure(WORKBENCH_PrivateData *wpd);
void workbench_cavity_cache_init(WORKBENCH_Data *data);
/* `workbench_effect_outline.cc` */
void workbench_outline_cache_init(WORKBENCH_Data *data);
/* `workbench_effect_dof.cc` */
void workbench_dof_engine_init(WORKBENCH_Data *vedata);
void workbench_dof_cache_init(WORKBENCH_Data *vedata);
void workbench_dof_draw_pass(WORKBENCH_Data *vedata);
/* `workbench_materials.cc` */
void workbench_material_ubo_data(WORKBENCH_PrivateData *wpd,
Object *ob,
Material *mat,
WORKBENCH_UBO_Material *data,
eV3DShadingColorType color_type);
DRWShadingGroup *workbench_material_setup_ex(WORKBENCH_PrivateData *wpd,
Object *ob,
int mat_nr,
eV3DShadingColorType color_type,
eWORKBENCH_DataType datatype,
bool *r_transp);
/**
* If `ima` is null, search appropriate image node but will fallback to purple texture otherwise.
*/
DRWShadingGroup *workbench_image_setup_ex(WORKBENCH_PrivateData *wpd,
Object *ob,
int mat_nr,
Image *ima,
ImageUser *iuser,
GPUSamplerState sampler,
eWORKBENCH_DataType datatype);
#define WORKBENCH_OBJECT_DATATYPE(ob) \
((ob->type == OB_POINTCLOUD) ? WORKBENCH_DATATYPE_POINTCLOUD : WORKBENCH_DATATYPE_MESH)
#define workbench_material_setup(wpd, ob, mat_nr, color_type, r_transp) \
workbench_material_setup_ex(wpd, ob, mat_nr, color_type, WORKBENCH_OBJECT_DATATYPE(ob), r_transp)
#define workbench_image_setup(wpd, ob, mat_nr, ima, iuser, interp) \
workbench_image_setup_ex(wpd, ob, mat_nr, ima, iuser, interp, WORKBENCH_OBJECT_DATATYPE(ob))
#define workbench_material_hair_setup(wpd, ob, mat_nr, color_type) \
workbench_material_setup_ex(wpd, ob, mat_nr, color_type, WORKBENCH_DATATYPE_HAIR, 0)
#define workbench_image_hair_setup(wpd, ob, mat_nr, ima, iuser, interp) \
workbench_image_setup_ex(wpd, ob, mat_nr, ima, iuser, interp, WORKBENCH_DATATYPE_HAIR)
#define workbench_material_ptcloud_setup(wpd, ob, mat_nr, color_type) \
workbench_material_setup_ex(wpd, ob, mat_nr, color_type, WORKBENCH_DATATYPE_POINTCLOUD, 0)
#define workbench_image_ptcloud_setup(wpd, ob, mat_nr, ima, iuser, interp) \
workbench_image_setup_ex(wpd, ob, mat_nr, ima, iuser, interp, WORKBENCH_DATATYPE_POINTCLOUD)
/* `workbench_data.cc` */
void workbench_private_data_alloc(WORKBENCH_StorageList *stl);
void workbench_private_data_init(WORKBENCH_PrivateData *wpd);
void workbench_update_world_ubo(WORKBENCH_PrivateData *wpd);
void workbench_update_material_ubos(WORKBENCH_PrivateData *wpd);
struct GPUUniformBuf *workbench_material_ubo_alloc(WORKBENCH_PrivateData *wpd);
/* `workbench_volume.cc` */
void workbench_volume_engine_init(WORKBENCH_Data *vedata);
void workbench_volume_cache_init(WORKBENCH_Data *vedata);
void workbench_volume_cache_populate(WORKBENCH_Data *vedata,
struct Scene *scene,
struct Object *ob,
struct ModifierData *md,
eV3DShadingColorType color_type);
void workbench_volume_draw_pass(WORKBENCH_Data *vedata);
/* `workbench_engine.cc` */
void workbench_engine_init(void *ved);
void workbench_cache_init(void *ved);
void workbench_cache_populate(void *ved, Object *ob);
void workbench_cache_finish(void *ved);
/**
* Used by viewport rendering & final rendering.
* Do one render loop iteration (i.e: One TAA sample).
*/
void workbench_draw_sample(void *ved);
void workbench_draw_finish(void *ved);
/* `workbench_render.cc` */
void workbench_render(void *ved,
struct RenderEngine *engine,
struct RenderLayer *render_layer,
const struct rcti *rect);
void workbench_render_update_passes(struct RenderEngine *engine,
struct Scene *scene,
struct ViewLayer *view_layer);
#ifdef __cplusplus
}
#endif

View File

@ -1,225 +0,0 @@
/* SPDX-FileCopyrightText: 2016 Blender Authors
*
* SPDX-License-Identifier: GPL-2.0-or-later */
/** \file
* \ingroup draw_engine
*
* Render functions for final render output.
*/
#include "BLI_rect.h"
#include "DNA_node_types.h"
#include "BKE_report.h"
#include "DRW_render.h"
#include "ED_view3d.hh"
#include "GPU_context.h"
#include "GPU_shader.h"
#include "DEG_depsgraph.h"
#include "DEG_depsgraph_query.h"
#include "IMB_imbuf_types.h"
#include "RE_pipeline.h"
#include "workbench_private.h"
static void workbench_render_cache(void *vedata,
Object *ob,
RenderEngine * /*engine*/,
Depsgraph * /*depsgraph*/)
{
workbench_cache_populate(vedata, ob);
}
static void workbench_render_matrices_init(RenderEngine *engine, Depsgraph *depsgraph)
{
/* TODO(sergey): Shall render hold pointer to an evaluated camera instead? */
Object *ob_camera_eval = DEG_get_evaluated_object(depsgraph, RE_GetCamera(engine->re));
/* Set the perspective, view and window matrix. */
float winmat[4][4], viewmat[4][4], viewinv[4][4];
RE_GetCameraWindow(engine->re, ob_camera_eval, winmat);
RE_GetCameraModelMatrix(engine->re, ob_camera_eval, viewinv);
invert_m4_m4(viewmat, viewinv);
DRWView *view = DRW_view_create(viewmat, winmat, nullptr, nullptr, nullptr);
DRW_view_default_set(view);
DRW_view_set_active(view);
}
static bool workbench_render_framebuffers_init()
{
/* For image render, allocate own buffers because we don't have a viewport. */
const float *viewport_size = DRW_viewport_size_get();
const int size[2] = {int(viewport_size[0]), int(viewport_size[1])};
DefaultTextureList *dtxl = DRW_viewport_texture_list_get();
/* When doing a multi view rendering the first view will allocate the buffers
* the other views will reuse these buffers */
if (dtxl->color == nullptr) {
eGPUTextureUsage usage = GPU_TEXTURE_USAGE_SHADER_READ | GPU_TEXTURE_USAGE_ATTACHMENT;
BLI_assert(dtxl->depth == nullptr);
dtxl->color = GPU_texture_create_2d(
"txl.color", UNPACK2(size), 1, GPU_RGBA16F, usage, nullptr);
dtxl->depth = GPU_texture_create_2d(
"txl.depth", UNPACK2(size), 1, GPU_DEPTH24_STENCIL8, usage, nullptr);
}
if (!(dtxl->depth && dtxl->color)) {
return false;
}
DefaultFramebufferList *dfbl = DRW_viewport_framebuffer_list_get();
GPU_framebuffer_ensure_config(
&dfbl->default_fb,
{GPU_ATTACHMENT_TEXTURE(dtxl->depth), GPU_ATTACHMENT_TEXTURE(dtxl->color)});
GPU_framebuffer_ensure_config(&dfbl->depth_only_fb,
{GPU_ATTACHMENT_TEXTURE(dtxl->depth), GPU_ATTACHMENT_NONE});
GPU_framebuffer_ensure_config(&dfbl->color_only_fb,
{GPU_ATTACHMENT_NONE, GPU_ATTACHMENT_TEXTURE(dtxl->color)});
bool ok = true;
ok = ok && GPU_framebuffer_check_valid(dfbl->default_fb, nullptr);
ok = ok && GPU_framebuffer_check_valid(dfbl->color_only_fb, nullptr);
ok = ok && GPU_framebuffer_check_valid(dfbl->depth_only_fb, nullptr);
return ok;
}
static void workbench_render_result_z(RenderLayer *rl, const char *viewname, const rcti *rect)
{
DefaultFramebufferList *dfbl = DRW_viewport_framebuffer_list_get();
const DRWContextState *draw_ctx = DRW_context_state_get();
ViewLayer *view_layer = draw_ctx->view_layer;
if ((view_layer->passflag & SCE_PASS_Z) != 0) {
RenderPass *rp = RE_pass_find_by_name(rl, RE_PASSNAME_Z, viewname);
float *rp_buffer_data = rp->ibuf->float_buffer.data;
GPU_framebuffer_bind(dfbl->default_fb);
GPU_framebuffer_read_depth(dfbl->default_fb,
rect->xmin,
rect->ymin,
BLI_rcti_size_x(rect),
BLI_rcti_size_y(rect),
GPU_DATA_FLOAT,
rp_buffer_data);
float winmat[4][4];
DRW_view_winmat_get(nullptr, winmat, false);
int pix_num = BLI_rcti_size_x(rect) * BLI_rcti_size_y(rect);
/* Convert GPU depth [0..1] to view Z [near..far] */
if (DRW_view_is_persp_get(nullptr)) {
for (int i = 0; i < pix_num; i++) {
if (rp_buffer_data[i] == 1.0f) {
rp_buffer_data[i] = 1e10f; /* Background */
}
else {
rp_buffer_data[i] = rp_buffer_data[i] * 2.0f - 1.0f;
rp_buffer_data[i] = winmat[3][2] / (rp_buffer_data[i] + winmat[2][2]);
}
}
}
else {
/* Keep in mind, near and far distance are negatives. */
float near = DRW_view_near_distance_get(nullptr);
float far = DRW_view_far_distance_get(nullptr);
float range = fabsf(far - near);
for (int i = 0; i < pix_num; i++) {
if (rp_buffer_data[i] == 1.0f) {
rp_buffer_data[i] = 1e10f; /* Background */
}
else {
rp_buffer_data[i] = rp_buffer_data[i] * range - near;
}
}
}
}
}
void workbench_render(void *ved, RenderEngine *engine, RenderLayer *render_layer, const rcti *rect)
{
WORKBENCH_Data *data = static_cast<WORKBENCH_Data *>(ved);
DefaultFramebufferList *dfbl = DRW_viewport_framebuffer_list_get();
const DRWContextState *draw_ctx = DRW_context_state_get();
Depsgraph *depsgraph = draw_ctx->depsgraph;
workbench_render_matrices_init(engine, depsgraph);
if (!workbench_render_framebuffers_init()) {
RE_engine_report(engine, RPT_ERROR, "Failed to allocate OpenGL buffers");
return;
}
workbench_private_data_alloc(data->stl);
data->stl->wpd->cam_original_ob = DEG_get_evaluated_object(depsgraph, RE_GetCamera(engine->re));
workbench_engine_init(data);
workbench_cache_init(data);
DRW_render_object_iter(data, engine, depsgraph, workbench_render_cache);
workbench_cache_finish(data);
DRW_render_instance_buffer_finish();
/* Also we weed to have a correct FBO bound for #DRW_curves_update */
GPU_framebuffer_bind(dfbl->default_fb);
DRW_curves_update();
GPU_framebuffer_bind(dfbl->default_fb);
GPU_framebuffer_clear_depth(dfbl->default_fb, 1.0f);
WORKBENCH_PrivateData *wpd = data->stl->wpd;
while (wpd->taa_sample < max_ii(1, wpd->taa_sample_len)) {
if (RE_engine_test_break(engine)) {
break;
}
workbench_update_world_ubo(wpd);
workbench_draw_sample(data);
}
workbench_draw_finish(data);
/* Perform render step between samples to allow
* flushing of freed GPUBackend resources. */
GPU_render_step();
/* Write render output. */
const char *viewname = RE_GetActiveRenderView(engine->re);
RenderPass *rp = RE_pass_find_by_name(render_layer, RE_PASSNAME_COMBINED, viewname);
GPU_framebuffer_bind(dfbl->default_fb);
GPU_framebuffer_read_color(dfbl->default_fb,
rect->xmin,
rect->ymin,
BLI_rcti_size_x(rect),
BLI_rcti_size_y(rect),
4,
0,
GPU_DATA_FLOAT,
rp->ibuf->float_buffer.data);
workbench_render_result_z(render_layer, viewname, rect);
}
void workbench_render_update_passes(RenderEngine *engine, Scene *scene, ViewLayer *view_layer)
{
RE_engine_register_pass(engine, scene, view_layer, RE_PASSNAME_COMBINED, 4, "RGBA", SOCK_RGBA);
if ((view_layer->passflag & SCE_PASS_Z) != 0) {
RE_engine_register_pass(engine, scene, view_layer, RE_PASSNAME_Z, 1, "Z", SOCK_FLOAT);
}
}

View File

@ -1,382 +0,0 @@
/* SPDX-FileCopyrightText: 2020 Blender Authors
*
* SPDX-License-Identifier: GPL-2.0-or-later */
/** \file
* \ingroup draw_engine
*/
#include "DRW_render.h"
#include <string>
#include "workbench_engine.h"
#include "workbench_private.h"
/* Maximum number of variations. */
#define MAX_LIGHTING 3
enum eWORKBENCH_TextureType {
TEXTURE_SH_NONE = 0,
TEXTURE_SH_SINGLE,
TEXTURE_SH_TILED,
TEXTURE_SH_MAX,
};
static struct {
GPUShader *opaque_prepass_sh_cache[GPU_SHADER_CFG_LEN][WORKBENCH_DATATYPE_MAX][TEXTURE_SH_MAX];
GPUShader *transp_prepass_sh_cache[GPU_SHADER_CFG_LEN][WORKBENCH_DATATYPE_MAX][MAX_LIGHTING]
[TEXTURE_SH_MAX];
GPUShader *opaque_composite_sh[MAX_LIGHTING];
GPUShader *oit_resolve_sh;
GPUShader *outline_sh;
GPUShader *merge_infront_sh;
GPUShader *shadow_depth_pass_sh[2];
GPUShader *shadow_depth_fail_sh[2][2];
GPUShader *cavity_sh[2][2];
GPUShader *dof_prepare_sh;
GPUShader *dof_downsample_sh;
GPUShader *dof_blur1_sh;
GPUShader *dof_blur2_sh;
GPUShader *dof_resolve_sh;
GPUShader *aa_accum_sh;
GPUShader *smaa_sh[3];
GPUShader *volume_sh[2][2][3][2];
} e_data = {{{{nullptr}}}};
/* -------------------------------------------------------------------- */
/** \name Conversions
* \{ */
static const char *workbench_lighting_mode_to_str(int light)
{
switch (light) {
default:
BLI_assert_msg(0, "Error: Unknown lighting mode.");
ATTR_FALLTHROUGH;
case V3D_LIGHTING_STUDIO:
return "_studio";
case V3D_LIGHTING_MATCAP:
return "_matcap";
case V3D_LIGHTING_FLAT:
return "_flat";
}
}
static const char *workbench_datatype_mode_to_str(eWORKBENCH_DataType datatype)
{
switch (datatype) {
default:
BLI_assert_msg(0, "Error: Unknown data mode.");
ATTR_FALLTHROUGH;
case WORKBENCH_DATATYPE_MESH:
return "_mesh";
case WORKBENCH_DATATYPE_HAIR:
return "_hair";
case WORKBENCH_DATATYPE_POINTCLOUD:
return "_ptcloud";
}
}
static const char *workbench_volume_interp_to_str(eWORKBENCH_VolumeInterpType interp_type)
{
switch (interp_type) {
default:
BLI_assert_msg(0, "Error: Unknown lighting mode.");
ATTR_FALLTHROUGH;
case WORKBENCH_VOLUME_INTERP_LINEAR:
return "_linear";
case WORKBENCH_VOLUME_INTERP_CUBIC:
return "_cubic";
case WORKBENCH_VOLUME_INTERP_CLOSEST:
return "_closest";
}
}
static const char *workbench_texture_type_to_str(eWORKBENCH_TextureType tex_type)
{
switch (tex_type) {
default:
BLI_assert_msg(0, "Error: Unknown texture mode.");
ATTR_FALLTHROUGH;
case TEXTURE_SH_NONE:
return "_tex_none";
case TEXTURE_SH_TILED:
return "_tex_tile";
case TEXTURE_SH_SINGLE:
return "_tex_single";
}
}
static eWORKBENCH_TextureType workbench_texture_type_get(bool textured, bool tiled)
{
return textured ? (tiled ? TEXTURE_SH_TILED : TEXTURE_SH_SINGLE) : TEXTURE_SH_NONE;
}
/** \} */
/* -------------------------------------------------------------------- */
/** \name Shader request
* \{ */
static GPUShader *workbench_shader_get_ex(WORKBENCH_PrivateData *wpd,
bool transp,
eWORKBENCH_DataType datatype,
bool textured,
bool tiled)
{
eWORKBENCH_TextureType tex_type = workbench_texture_type_get(textured, tiled);
int light = wpd->shading.light;
BLI_assert(light < MAX_LIGHTING);
GPUShader **shader =
(transp) ? &e_data.transp_prepass_sh_cache[wpd->sh_cfg][datatype][light][tex_type] :
&e_data.opaque_prepass_sh_cache[wpd->sh_cfg][datatype][tex_type];
if (*shader == nullptr) {
std::string create_info_name = "workbench";
create_info_name += (transp) ? "_transp" : "_opaque";
if (transp) {
create_info_name += workbench_lighting_mode_to_str(light);
}
create_info_name += workbench_datatype_mode_to_str(datatype);
create_info_name += workbench_texture_type_to_str(tex_type);
create_info_name += (wpd->sh_cfg == GPU_SHADER_CFG_CLIPPED) ? "_clip" : "_no_clip";
*shader = GPU_shader_create_from_info_name(create_info_name.c_str());
}
return *shader;
}
GPUShader *workbench_shader_opaque_get(WORKBENCH_PrivateData *wpd, eWORKBENCH_DataType datatype)
{
return workbench_shader_get_ex(wpd, false, datatype, false, false);
}
GPUShader *workbench_shader_opaque_image_get(WORKBENCH_PrivateData *wpd,
eWORKBENCH_DataType datatype,
bool tiled)
{
return workbench_shader_get_ex(wpd, false, datatype, true, tiled);
}
GPUShader *workbench_shader_transparent_get(WORKBENCH_PrivateData *wpd,
eWORKBENCH_DataType datatype)
{
return workbench_shader_get_ex(wpd, true, datatype, false, false);
}
GPUShader *workbench_shader_transparent_image_get(WORKBENCH_PrivateData *wpd,
eWORKBENCH_DataType datatype,
bool tiled)
{
return workbench_shader_get_ex(wpd, true, datatype, true, tiled);
}
GPUShader *workbench_shader_composite_get(WORKBENCH_PrivateData *wpd)
{
int light = wpd->shading.light;
GPUShader **shader = &e_data.opaque_composite_sh[light];
BLI_assert(light < MAX_LIGHTING);
if (*shader == nullptr) {
std::string create_info_name = "workbench_composite";
create_info_name += workbench_lighting_mode_to_str(light);
*shader = GPU_shader_create_from_info_name(create_info_name.c_str());
}
return *shader;
}
GPUShader *workbench_shader_merge_infront_get(WORKBENCH_PrivateData * /*wpd*/)
{
if (e_data.merge_infront_sh == nullptr) {
e_data.merge_infront_sh = GPU_shader_create_from_info_name("workbench_merge_infront");
}
return e_data.merge_infront_sh;
}
GPUShader *workbench_shader_transparent_resolve_get(WORKBENCH_PrivateData * /*wpd*/)
{
if (e_data.oit_resolve_sh == nullptr) {
e_data.oit_resolve_sh = GPU_shader_create_from_info_name("workbench_transparent_resolve");
}
return e_data.oit_resolve_sh;
}
static GPUShader *workbench_shader_shadow_pass_get_ex(bool depth_pass, bool manifold, bool cap)
{
GPUShader **shader = (depth_pass) ? &e_data.shadow_depth_pass_sh[manifold] :
&e_data.shadow_depth_fail_sh[manifold][cap];
if (*shader == nullptr) {
std::string create_info_name = "workbench_shadow";
create_info_name += (depth_pass) ? "_pass" : "_fail";
create_info_name += (manifold) ? "_manifold" : "_no_manifold";
create_info_name += (cap) ? "_caps" : "_no_caps";
#if DEBUG_SHADOW_VOLUME
create_info_name += "_debug";
#endif
*shader = GPU_shader_create_from_info_name(create_info_name.c_str());
}
return *shader;
}
GPUShader *workbench_shader_shadow_pass_get(bool manifold)
{
return workbench_shader_shadow_pass_get_ex(true, manifold, false);
}
GPUShader *workbench_shader_shadow_fail_get(bool manifold, bool cap)
{
return workbench_shader_shadow_pass_get_ex(false, manifold, cap);
}
GPUShader *workbench_shader_cavity_get(bool cavity, bool curvature)
{
BLI_assert(cavity || curvature);
GPUShader **shader = &e_data.cavity_sh[cavity][curvature];
if (*shader == nullptr) {
std::string create_info_name = "workbench_effect";
create_info_name += (cavity) ? "_cavity" : "";
create_info_name += (curvature) ? "_curvature" : "";
*shader = GPU_shader_create_from_info_name(create_info_name.c_str());
}
return *shader;
}
GPUShader *workbench_shader_outline_get()
{
if (e_data.outline_sh == nullptr) {
e_data.outline_sh = GPU_shader_create_from_info_name("workbench_effect_outline");
}
return e_data.outline_sh;
}
void workbench_shader_depth_of_field_get(GPUShader **prepare_sh,
GPUShader **downsample_sh,
GPUShader **blur1_sh,
GPUShader **blur2_sh,
GPUShader **resolve_sh)
{
if (e_data.dof_prepare_sh == nullptr) {
e_data.dof_prepare_sh = GPU_shader_create_from_info_name("workbench_effect_dof_prepare");
e_data.dof_downsample_sh = GPU_shader_create_from_info_name("workbench_effect_dof_downsample");
#if 0 /* TODO(fclem): finish COC min_max optimization */
e_data.dof_flatten_v_sh = GPU_shader_create_from_info_name("workbench_effect_dof_flatten_v");
e_data.dof_flatten_h_sh = GPU_shader_create_from_info_name("workbench_effect_dof_flatten_h");
e_data.dof_dilate_v_sh = GPU_shader_create_from_info_name("workbench_effect_dof_dilate_v");
e_data.dof_dilate_h_sh = GPU_shader_create_from_info_name("workbench_effect_dof_dilate_h");
#endif
e_data.dof_blur1_sh = GPU_shader_create_from_info_name("workbench_effect_dof_blur1");
e_data.dof_blur2_sh = GPU_shader_create_from_info_name("workbench_effect_dof_blur2");
e_data.dof_resolve_sh = GPU_shader_create_from_info_name("workbench_effect_dof_resolve");
}
*prepare_sh = e_data.dof_prepare_sh;
*downsample_sh = e_data.dof_downsample_sh;
*blur1_sh = e_data.dof_blur1_sh;
*blur2_sh = e_data.dof_blur2_sh;
*resolve_sh = e_data.dof_resolve_sh;
}
GPUShader *workbench_shader_antialiasing_accumulation_get()
{
if (e_data.aa_accum_sh == nullptr) {
e_data.aa_accum_sh = GPU_shader_create_from_info_name("workbench_taa");
}
return e_data.aa_accum_sh;
}
GPUShader *workbench_shader_antialiasing_get(int stage)
{
BLI_assert(stage < 3);
GPUShader **shader = &e_data.smaa_sh[stage];
if (*shader == nullptr) {
std::string create_info_name = "workbench_smaa_stage_";
create_info_name += std::to_string(stage);
*shader = GPU_shader_create_from_info_name(create_info_name.c_str());
}
return e_data.smaa_sh[stage];
}
GPUShader *workbench_shader_volume_get(bool slice,
bool coba,
eWORKBENCH_VolumeInterpType interp_type,
bool smoke)
{
GPUShader **shader = &e_data.volume_sh[slice][coba][interp_type][smoke];
if (*shader == nullptr) {
std::string create_info_name = "workbench_volume";
create_info_name += (smoke) ? "_smoke" : "_object";
create_info_name += workbench_volume_interp_to_str(interp_type);
create_info_name += (coba) ? "_coba" : "_no_coba";
create_info_name += (slice) ? "_slice" : "_no_slice";
*shader = GPU_shader_create_from_info_name(create_info_name.c_str());
}
return *shader;
}
/** \} */
/* -------------------------------------------------------------------- */
/** \name Cleanup
* \{ */
void workbench_shader_free()
{
for (int j = 0; j < sizeof(e_data.opaque_prepass_sh_cache) / sizeof(void *); j++) {
GPUShader **sh_array = &e_data.opaque_prepass_sh_cache[0][0][0];
DRW_SHADER_FREE_SAFE(sh_array[j]);
}
for (int j = 0; j < sizeof(e_data.transp_prepass_sh_cache) / sizeof(void *); j++) {
GPUShader **sh_array = &e_data.transp_prepass_sh_cache[0][0][0][0];
DRW_SHADER_FREE_SAFE(sh_array[j]);
}
for (int j = 0; j < ARRAY_SIZE(e_data.opaque_composite_sh); j++) {
GPUShader **sh_array = &e_data.opaque_composite_sh[0];
DRW_SHADER_FREE_SAFE(sh_array[j]);
}
for (int j = 0; j < ARRAY_SIZE(e_data.shadow_depth_pass_sh); j++) {
GPUShader **sh_array = &e_data.shadow_depth_pass_sh[0];
DRW_SHADER_FREE_SAFE(sh_array[j]);
}
for (int j = 0; j < sizeof(e_data.shadow_depth_fail_sh) / sizeof(void *); j++) {
GPUShader **sh_array = &e_data.shadow_depth_fail_sh[0][0];
DRW_SHADER_FREE_SAFE(sh_array[j]);
}
for (int j = 0; j < sizeof(e_data.cavity_sh) / sizeof(void *); j++) {
GPUShader **sh_array = &e_data.cavity_sh[0][0];
DRW_SHADER_FREE_SAFE(sh_array[j]);
}
for (int j = 0; j < ARRAY_SIZE(e_data.smaa_sh); j++) {
GPUShader **sh_array = &e_data.smaa_sh[0];
DRW_SHADER_FREE_SAFE(sh_array[j]);
}
for (int j = 0; j < sizeof(e_data.volume_sh) / sizeof(void *); j++) {
GPUShader **sh_array = &e_data.volume_sh[0][0][0][0];
DRW_SHADER_FREE_SAFE(sh_array[j]);
}
DRW_SHADER_FREE_SAFE(e_data.oit_resolve_sh);
DRW_SHADER_FREE_SAFE(e_data.outline_sh);
DRW_SHADER_FREE_SAFE(e_data.merge_infront_sh);
DRW_SHADER_FREE_SAFE(e_data.dof_prepare_sh);
DRW_SHADER_FREE_SAFE(e_data.dof_downsample_sh);
DRW_SHADER_FREE_SAFE(e_data.dof_blur1_sh);
DRW_SHADER_FREE_SAFE(e_data.dof_blur2_sh);
DRW_SHADER_FREE_SAFE(e_data.dof_resolve_sh);
DRW_SHADER_FREE_SAFE(e_data.aa_accum_sh);
}
/** \} */

View File

@ -1,359 +0,0 @@
/* SPDX-FileCopyrightText: 2020 Blender Authors
*
* SPDX-License-Identifier: GPL-2.0-or-later */
/** \file
* \ingroup draw_engine
*
* Shadow:
*
* Use stencil shadow buffer to cast a sharp shadow over opaque surfaces.
*
* After the main pre-pass we render shadow volumes using custom depth & stencil states to
* set the stencil of shadowed area to anything but 0.
*
* Then the shading pass will shade the areas with stencil not equal 0 differently.
*/
#include "DRW_render.h"
#include "BKE_object.h"
#include "workbench_engine.h"
#include "workbench_private.h"
static void compute_parallel_lines_nor_and_dist(const float v1[2],
const float v2[2],
const float v3[2],
float r_line[4])
{
sub_v2_v2v2(r_line, v2, v1);
/* Find orthogonal vector. */
SWAP(float, r_line[0], r_line[1]);
r_line[0] = -r_line[0];
/* Edge distances. */
r_line[2] = dot_v2v2(r_line, v1);
r_line[3] = dot_v2v2(r_line, v3);
/* Make sure r_line[2] is the minimum. */
if (r_line[2] > r_line[3]) {
SWAP(float, r_line[2], r_line[3]);
}
}
static void workbench_shadow_update(WORKBENCH_PrivateData *wpd)
{
wpd->shadow_changed = !compare_v3v3(
wpd->shadow_cached_direction, wpd->shadow_direction_ws, 1e-5f);
if (wpd->shadow_changed) {
const float up[3] = {0.0f, 0.0f, 1.0f};
unit_m4(wpd->shadow_mat);
/* TODO: fix singularity. */
copy_v3_v3(wpd->shadow_mat[2], wpd->shadow_direction_ws);
cross_v3_v3v3(wpd->shadow_mat[0], wpd->shadow_mat[2], up);
normalize_v3(wpd->shadow_mat[0]);
cross_v3_v3v3(wpd->shadow_mat[1], wpd->shadow_mat[2], wpd->shadow_mat[0]);
invert_m4_m4(wpd->shadow_inv, wpd->shadow_mat);
copy_v3_v3(wpd->shadow_cached_direction, wpd->shadow_direction_ws);
}
float planes[6][4];
DRW_culling_frustum_planes_get(nullptr, planes);
/* we only need the far plane. */
copy_v4_v4(wpd->shadow_far_plane, planes[2]);
BoundBox frustum_corners;
DRW_culling_frustum_corners_get(nullptr, &frustum_corners);
float shadow_near_corners[4][3];
mul_v3_mat3_m4v3(shadow_near_corners[0], wpd->shadow_inv, frustum_corners.vec[0]);
mul_v3_mat3_m4v3(shadow_near_corners[1], wpd->shadow_inv, frustum_corners.vec[3]);
mul_v3_mat3_m4v3(shadow_near_corners[2], wpd->shadow_inv, frustum_corners.vec[7]);
mul_v3_mat3_m4v3(shadow_near_corners[3], wpd->shadow_inv, frustum_corners.vec[4]);
INIT_MINMAX(wpd->shadow_near_min, wpd->shadow_near_max);
for (int i = 0; i < 4; i++) {
minmax_v3v3_v3(wpd->shadow_near_min, wpd->shadow_near_max, shadow_near_corners[i]);
}
compute_parallel_lines_nor_and_dist(shadow_near_corners[0],
shadow_near_corners[1],
shadow_near_corners[2],
wpd->shadow_near_sides[0]);
compute_parallel_lines_nor_and_dist(shadow_near_corners[1],
shadow_near_corners[2],
shadow_near_corners[0],
wpd->shadow_near_sides[1]);
}
void workbench_shadow_data_update(WORKBENCH_PrivateData *wpd, WORKBENCH_UBO_World *wd)
{
const DRWContextState *draw_ctx = DRW_context_state_get();
const Scene *scene = draw_ctx->scene;
float view_matrix[4][4];
DRW_view_viewmat_get(nullptr, view_matrix, false);
/* Turn the light in a way where it's more user friendly to control. */
copy_v3_v3(wpd->shadow_direction_ws, scene->display.light_direction);
SWAP(float, wpd->shadow_direction_ws[2], wpd->shadow_direction_ws[1]);
wpd->shadow_direction_ws[2] = -wpd->shadow_direction_ws[2];
wpd->shadow_direction_ws[0] = -wpd->shadow_direction_ws[0];
/* Shadow direction. */
mul_v3_mat3_m4v3(wd->shadow_direction_vs, view_matrix, wpd->shadow_direction_ws);
/* Clamp to avoid overshadowing and shading errors. */
float focus = clamp_f(scene->display.shadow_focus, 0.0001f, 0.99999f);
wd->shadow_shift = scene->display.shadow_shift;
wd->shadow_focus = 1.0f - focus * (1.0f - wd->shadow_shift);
if (SHADOW_ENABLED(wpd)) {
wd->shadow_mul = wpd->shading.shadow_intensity;
wd->shadow_add = 1.0f - wd->shadow_mul;
}
else {
wd->shadow_mul = 0.0f;
wd->shadow_add = 1.0f;
}
}
void workbench_shadow_cache_init(WORKBENCH_Data *data)
{
WORKBENCH_PassList *psl = data->psl;
WORKBENCH_PrivateData *wpd = data->stl->wpd;
GPUShader *sh;
DRWShadingGroup *grp;
if (SHADOW_ENABLED(wpd)) {
workbench_shadow_update(wpd);
#if DEBUG_SHADOW_VOLUME
DRWState depth_pass_state = DRW_STATE_DEPTH_LESS;
DRWState depth_fail_state = DRW_STATE_DEPTH_GREATER_EQUAL;
DRWState state = DRW_STATE_WRITE_COLOR | DRW_STATE_BLEND_ADD_FULL;
#else
DRWState depth_pass_state = DRW_STATE_WRITE_STENCIL_SHADOW_PASS;
DRWState depth_fail_state = DRW_STATE_WRITE_STENCIL_SHADOW_FAIL;
DRWState state = DRW_STATE_DEPTH_LESS | DRW_STATE_STENCIL_ALWAYS;
#endif
/* TODO(fclem): Merge into one pass with sub-passes. */
DRW_PASS_CREATE(psl->shadow_ps[0], state | depth_pass_state);
DRW_PASS_CREATE(psl->shadow_ps[1], state | depth_fail_state);
/* Stencil Shadow passes. */
for (int manifold = 0; manifold < 2; manifold++) {
sh = workbench_shader_shadow_pass_get(manifold);
wpd->shadow_pass_grp[manifold] = grp = DRW_shgroup_create(sh, psl->shadow_ps[0]);
DRW_shgroup_stencil_mask(grp, 0xFF); /* Needed once to set the stencil state for the pass. */
sh = workbench_shader_shadow_fail_get(manifold, false);
wpd->shadow_fail_grp[manifold] = grp = DRW_shgroup_create(sh, psl->shadow_ps[1]);
DRW_shgroup_stencil_mask(grp, 0xFF); /* Needed once to set the stencil state for the pass. */
sh = workbench_shader_shadow_fail_get(manifold, true);
wpd->shadow_fail_caps_grp[manifold] = grp = DRW_shgroup_create(sh, psl->shadow_ps[1]);
}
}
else {
psl->shadow_ps[0] = nullptr;
psl->shadow_ps[1] = nullptr;
}
}
static const BoundBox *workbench_shadow_object_shadow_bbox_get(WORKBENCH_PrivateData *wpd,
Object *ob,
WORKBENCH_ObjectData *oed)
{
if (oed->shadow_bbox_dirty || wpd->shadow_changed) {
float tmp_mat[4][4];
mul_m4_m4m4(tmp_mat, wpd->shadow_inv, ob->object_to_world);
/* Get AABB in shadow space. */
INIT_MINMAX(oed->shadow_min, oed->shadow_max);
/* From object space to shadow space */
const BoundBox *bbox = BKE_object_boundbox_get(ob);
for (int i = 0; i < 8; i++) {
float corner[3];
mul_v3_m4v3(corner, tmp_mat, bbox->vec[i]);
minmax_v3v3_v3(oed->shadow_min, oed->shadow_max, corner);
}
oed->shadow_depth = oed->shadow_max[2] - oed->shadow_min[2];
/* Extend towards infinity. */
oed->shadow_max[2] += 1e4f;
/* Get extended AABB in world space. */
BKE_boundbox_init_from_minmax(&oed->shadow_bbox, oed->shadow_min, oed->shadow_max);
for (int i = 0; i < 8; i++) {
mul_m4_v3(wpd->shadow_mat, oed->shadow_bbox.vec[i]);
}
oed->shadow_bbox_dirty = false;
}
return &oed->shadow_bbox;
}
static bool workbench_shadow_object_cast_visible_shadow(WORKBENCH_PrivateData *wpd,
Object *ob,
WORKBENCH_ObjectData *oed)
{
const BoundBox *shadow_bbox = workbench_shadow_object_shadow_bbox_get(wpd, ob, oed);
const DRWView *default_view = DRW_view_default_get();
return DRW_culling_box_test(default_view, shadow_bbox);
}
static float workbench_shadow_object_shadow_distance(WORKBENCH_PrivateData *wpd,
Object *ob,
WORKBENCH_ObjectData *oed)
{
const BoundBox *shadow_bbox = workbench_shadow_object_shadow_bbox_get(wpd, ob, oed);
const int corners[4] = {0, 3, 4, 7};
float dist = 1e4f, dist_isect;
for (int i = 0; i < 4; i++) {
if (isect_ray_plane_v3(shadow_bbox->vec[corners[i]],
wpd->shadow_cached_direction,
wpd->shadow_far_plane,
&dist_isect,
true))
{
if (dist_isect < dist) {
dist = dist_isect;
}
}
else {
/* All rays are parallels. If one fails, the other will too. */
break;
}
}
return max_ii(dist - oed->shadow_depth, 0);
}
static bool workbench_shadow_camera_in_object_shadow(WORKBENCH_PrivateData *wpd,
Object *ob,
WORKBENCH_ObjectData *oed)
{
/* Just to be sure the min, max are updated. */
workbench_shadow_object_shadow_bbox_get(wpd, ob, oed);
/* Test if near plane is in front of the shadow. */
if (oed->shadow_min[2] > wpd->shadow_near_max[2]) {
return false;
}
/* Separation Axis Theorem test */
/* Test bbox sides first (faster) */
if ((oed->shadow_min[0] > wpd->shadow_near_max[0]) ||
(oed->shadow_max[0] < wpd->shadow_near_min[0]) ||
(oed->shadow_min[1] > wpd->shadow_near_max[1]) ||
(oed->shadow_max[1] < wpd->shadow_near_min[1]))
{
return false;
}
/* Test projected near rectangle sides */
const float pts[4][2] = {
{oed->shadow_min[0], oed->shadow_min[1]},
{oed->shadow_min[0], oed->shadow_max[1]},
{oed->shadow_max[0], oed->shadow_min[1]},
{oed->shadow_max[0], oed->shadow_max[1]},
};
for (int i = 0; i < 2; i++) {
float min_dst = FLT_MAX, max_dst = -FLT_MAX;
for (int j = 0; j < 4; j++) {
float dst = dot_v2v2(wpd->shadow_near_sides[i], pts[j]);
/* Do min max */
if (min_dst > dst) {
min_dst = dst;
}
if (max_dst < dst) {
max_dst = dst;
}
}
if ((wpd->shadow_near_sides[i][2] > max_dst) || (wpd->shadow_near_sides[i][3] < min_dst)) {
return false;
}
}
/* No separation axis found. Both shape intersect. */
return true;
}
static void workbench_init_object_data(DrawData *dd)
{
WORKBENCH_ObjectData *data = (WORKBENCH_ObjectData *)dd;
data->shadow_bbox_dirty = true;
}
void workbench_shadow_cache_populate(WORKBENCH_Data *data, Object *ob, const bool has_transp_mat)
{
WORKBENCH_PrivateData *wpd = data->stl->wpd;
bool is_manifold;
GPUBatch *geom_shadow = DRW_cache_object_edge_detection_get(ob, &is_manifold);
if (geom_shadow == nullptr) {
return;
}
WORKBENCH_ObjectData *engine_object_data = (WORKBENCH_ObjectData *)DRW_drawdata_ensure(
&ob->id,
&draw_engine_workbench,
sizeof(WORKBENCH_ObjectData),
&workbench_init_object_data,
nullptr);
if (workbench_shadow_object_cast_visible_shadow(wpd, ob, engine_object_data)) {
mul_v3_mat3_m4v3(
engine_object_data->shadow_dir, ob->world_to_object, wpd->shadow_direction_ws);
DRWShadingGroup *grp;
bool use_shadow_pass_technique = !workbench_shadow_camera_in_object_shadow(
wpd, ob, engine_object_data);
/* Shadow pass technique needs object to be have all its surface opaque. */
if (has_transp_mat) {
use_shadow_pass_technique = false;
}
/* We cannot use Shadow Pass technique on non-manifold object (see #76168). */
if (use_shadow_pass_technique && !is_manifold && (wpd->cull_state != 0)) {
use_shadow_pass_technique = false;
}
if (use_shadow_pass_technique) {
grp = DRW_shgroup_create_sub(wpd->shadow_pass_grp[is_manifold]);
DRW_shgroup_uniform_vec3(grp, "lightDirection", engine_object_data->shadow_dir, 1);
DRW_shgroup_uniform_float_copy(grp, "lightDistance", 1e5f);
DRW_shgroup_call_no_cull(grp, geom_shadow, ob);
#if DEBUG_SHADOW_VOLUME
DRW_debug_bbox(&engine_object_data->shadow_bbox, blender::float4{1.0f, 0.0f, 0.0f, 1.0f});
#endif
}
else {
float extrude_distance = workbench_shadow_object_shadow_distance(
wpd, ob, engine_object_data);
/* TODO(fclem): only use caps if they are in the view frustum. */
const bool need_caps = true;
if (need_caps) {
grp = DRW_shgroup_create_sub(wpd->shadow_fail_caps_grp[is_manifold]);
DRW_shgroup_uniform_vec3(grp, "lightDirection", engine_object_data->shadow_dir, 1);
DRW_shgroup_uniform_float_copy(grp, "lightDistance", extrude_distance);
DRW_shgroup_call_no_cull(grp, DRW_cache_object_surface_get(ob), ob);
}
grp = DRW_shgroup_create_sub(wpd->shadow_fail_grp[is_manifold]);
DRW_shgroup_uniform_vec3(grp, "lightDirection", engine_object_data->shadow_dir, 1);
DRW_shgroup_uniform_float_copy(grp, "lightDistance", extrude_distance);
DRW_shgroup_call_no_cull(grp, geom_shadow, ob);
#if DEBUG_SHADOW_VOLUME
DRW_debug_bbox(&engine_object_data->shadow_bbox, blender::float4{0.0f, 1.0f, 0.0f, 1.0f});
#endif
}
}
}

View File

@ -1,163 +0,0 @@
/* SPDX-FileCopyrightText: 2020 Blender Authors
*
* SPDX-License-Identifier: GPL-2.0-or-later */
/** \file
* \ingroup draw_engine
*
* Transparent Pipeline:
*
* Use Weight Blended Order Independent Transparency to render transparent surfaces.
*
* The rendering is broken down in two passes:
* - the accumulation pass where we render all the surfaces and accumulate all the weights.
* - the resolve pass where we divide the accumulated information by the weights.
*
* An additional re-render of the transparent surfaces is sometime done in order to have their
* correct depth and object ids correctly written.
*/
#include "DRW_render.h"
#include "ED_view3d.hh"
#include "workbench_engine.h"
#include "workbench_private.h"
void workbench_transparent_engine_init(WORKBENCH_Data *data)
{
WORKBENCH_FramebufferList *fbl = data->fbl;
WORKBENCH_PrivateData *wpd = data->stl->wpd;
DefaultTextureList *dtxl = DRW_viewport_texture_list_get();
DrawEngineType *owner = (DrawEngineType *)&workbench_transparent_engine_init;
/* Reuse same format as opaque pipeline to reuse the textures. */
/* NOTE: Floating point texture is required for the reveal_tex as it is used for
* the alpha accumulation component (see accumulation shader for more explanation). */
const eGPUTextureFormat accum_tex_format = GPU_RGBA16F;
const eGPUTextureFormat reveal_tex_format = NORMAL_ENCODING_ENABLED() ? GPU_RG16F : GPU_RGBA32F;
eGPUTextureUsage usage = GPU_TEXTURE_USAGE_ATTACHMENT | GPU_TEXTURE_USAGE_SHADER_READ;
wpd->accum_buffer_tx = DRW_texture_pool_query_fullscreen_ex(accum_tex_format, usage, owner);
wpd->reveal_buffer_tx = DRW_texture_pool_query_fullscreen_ex(reveal_tex_format, usage, owner);
GPU_framebuffer_ensure_config(&fbl->transp_accum_fb,
{
GPU_ATTACHMENT_TEXTURE(dtxl->depth),
GPU_ATTACHMENT_TEXTURE(wpd->accum_buffer_tx),
GPU_ATTACHMENT_TEXTURE(wpd->reveal_buffer_tx),
});
}
static void workbench_transparent_lighting_uniforms(WORKBENCH_PrivateData *wpd,
DRWShadingGroup *grp)
{
DRW_shgroup_uniform_block(grp, "world_data", wpd->world_ubo);
DRW_shgroup_uniform_bool_copy(grp, "forceShadowing", false);
if (STUDIOLIGHT_TYPE_MATCAP_ENABLED(wpd)) {
BKE_studiolight_ensure_flag(wpd->studio_light,
STUDIOLIGHT_MATCAP_DIFFUSE_GPUTEXTURE |
STUDIOLIGHT_MATCAP_SPECULAR_GPUTEXTURE);
GPUTexture *diff_tx = wpd->studio_light->matcap_diffuse.gputexture;
GPUTexture *spec_tx = wpd->studio_light->matcap_specular.gputexture;
const bool use_spec = workbench_is_specular_highlight_enabled(wpd);
spec_tx = (use_spec && spec_tx) ? spec_tx : diff_tx;
DRW_shgroup_uniform_texture(grp, "matcap_diffuse_tx", diff_tx);
DRW_shgroup_uniform_texture(grp, "matcap_specular_tx", spec_tx);
}
}
void workbench_transparent_cache_init(WORKBENCH_Data *vedata)
{
WORKBENCH_PassList *psl = vedata->psl;
WORKBENCH_PrivateData *wpd = vedata->stl->wpd;
GPUShader *sh;
DRWShadingGroup *grp;
{
int transp = 1;
for (int infront = 0; infront < 2; infront++) {
DRWState state = DRW_STATE_WRITE_COLOR | DRW_STATE_DEPTH_LESS_EQUAL | DRW_STATE_BLEND_OIT |
wpd->cull_state | wpd->clip_state;
DRWPass *pass;
if (infront) {
psl->transp_accum_infront_ps = pass = DRW_pass_create("transp_accum_infront", state);
DRW_PASS_INSTANCE_CREATE(
psl->transp_depth_infront_ps, pass, state | DRW_STATE_WRITE_DEPTH);
}
else {
psl->transp_accum_ps = pass = DRW_pass_create("transp_accum", state);
DRW_PASS_INSTANCE_CREATE(psl->transp_depth_ps, pass, state | DRW_STATE_WRITE_DEPTH);
}
for (int data_i = 0; data_i < WORKBENCH_DATATYPE_MAX; data_i++) {
eWORKBENCH_DataType data = eWORKBENCH_DataType(data_i);
wpd->prepass[transp][infront][data].material_hash = BLI_ghash_ptr_new(__func__);
sh = workbench_shader_transparent_get(wpd, data);
wpd->prepass[transp][infront][data].common_shgrp = grp = DRW_shgroup_create(sh, pass);
DRW_shgroup_uniform_block(grp, "materials_data", wpd->material_ubo_curr);
DRW_shgroup_uniform_int_copy(grp, "materialIndex", -1);
workbench_transparent_lighting_uniforms(wpd, grp);
wpd->prepass[transp][infront][data].vcol_shgrp = grp = DRW_shgroup_create(sh, pass);
DRW_shgroup_uniform_block(grp, "materials_data", wpd->material_ubo_curr);
DRW_shgroup_uniform_int_copy(grp, "materialIndex", 0); /* Default material. (uses vcol) */
sh = workbench_shader_transparent_image_get(wpd, data, false);
wpd->prepass[transp][infront][data].image_shgrp = grp = DRW_shgroup_create(sh, pass);
DRW_shgroup_uniform_block(grp, "materials_data", wpd->material_ubo_curr);
DRW_shgroup_uniform_int_copy(grp, "materialIndex", 0); /* Default material. */
workbench_transparent_lighting_uniforms(wpd, grp);
sh = workbench_shader_transparent_image_get(wpd, data, true);
wpd->prepass[transp][infront][data].image_tiled_shgrp = grp = DRW_shgroup_create(sh, pass);
DRW_shgroup_uniform_block(grp, "materials_data", wpd->material_ubo_curr);
DRW_shgroup_uniform_int_copy(grp, "materialIndex", 0); /* Default material. */
workbench_transparent_lighting_uniforms(wpd, grp);
}
}
}
{
DRWState state = DRW_STATE_WRITE_COLOR | DRW_STATE_BLEND_ALPHA;
DRW_PASS_CREATE(psl->transp_resolve_ps, state);
sh = workbench_shader_transparent_resolve_get(wpd);
grp = DRW_shgroup_create(sh, psl->transp_resolve_ps);
DRW_shgroup_uniform_texture(grp, "transparentAccum", wpd->accum_buffer_tx);
DRW_shgroup_uniform_texture(grp, "transparentRevealage", wpd->reveal_buffer_tx);
DRW_shgroup_call_procedural_triangles(grp, nullptr, 1);
}
}
void workbench_transparent_draw_depth_pass(WORKBENCH_Data *data)
{
WORKBENCH_PrivateData *wpd = data->stl->wpd;
WORKBENCH_FramebufferList *fbl = data->fbl;
WORKBENCH_PassList *psl = data->psl;
const bool do_xray_depth_pass = !XRAY_FLAG_ENABLED(wpd) || XRAY_ALPHA(wpd) > 0.0f;
const bool do_transparent_depth_pass = psl->outline_ps || wpd->dof_enabled || do_xray_depth_pass;
if (do_transparent_depth_pass) {
if (!DRW_pass_is_empty(psl->transp_depth_ps)) {
GPU_framebuffer_bind(fbl->opaque_fb);
/* TODO(fclem): Disable writing to first two buffers. Unnecessary waste of bandwidth. */
DRW_draw_pass(psl->transp_depth_ps);
}
if (!DRW_pass_is_empty(psl->transp_depth_infront_ps)) {
GPU_framebuffer_bind(fbl->opaque_infront_fb);
/* TODO(fclem): Disable writing to first two buffers. Unnecessary waste of bandwidth. */
DRW_draw_pass(psl->transp_depth_infront_ps);
}
}
}

View File

@ -1,338 +0,0 @@
/* SPDX-FileCopyrightText: 2018 Blender Authors
*
* SPDX-License-Identifier: GPL-2.0-or-later */
/** \file
* \ingroup draw_engine
*/
#include "workbench_private.h"
#include "DNA_fluid_types.h"
#include "DNA_modifier_types.h"
#include "DNA_object_force_types.h"
#include "DNA_volume_types.h"
#include "BLI_dynstr.h"
#include "BLI_listbase.h"
#include "BLI_rand.h"
#include "BLI_string_utils.h"
#include "BKE_fluid.h"
#include "BKE_global.h"
#include "BKE_object.h"
#include "BKE_volume.h"
#include "BKE_volume_render.h"
void workbench_volume_engine_init(WORKBENCH_Data *vedata)
{
WORKBENCH_TextureList *txl = vedata->txl;
if (txl->dummy_volume_tx == nullptr) {
eGPUTextureUsage usage = GPU_TEXTURE_USAGE_SHADER_READ;
const float zero[4] = {0.0f, 0.0f, 0.0f, 0.0f};
const float one[4] = {1.0f, 1.0f, 1.0f, 1.0f};
txl->dummy_volume_tx = GPU_texture_create_3d(
"dummy_volume", 1, 1, 1, 1, GPU_RGBA8, usage, zero);
txl->dummy_shadow_tx = GPU_texture_create_3d(
"dummy_shadow", 1, 1, 1, 1, GPU_RGBA8, usage, one);
txl->dummy_coba_tx = GPU_texture_create_1d("dummy_coba", 1, 1, GPU_RGBA8, usage, zero);
}
}
void workbench_volume_cache_init(WORKBENCH_Data *vedata)
{
vedata->psl->volume_ps = DRW_pass_create(
"Volumes", DRW_STATE_WRITE_COLOR | DRW_STATE_BLEND_ALPHA_PREMUL | DRW_STATE_CULL_FRONT);
vedata->stl->wpd->volumes_do = false;
}
static void workbench_volume_modifier_cache_populate(WORKBENCH_Data *vedata,
Object *ob,
ModifierData *md)
{
FluidModifierData *fmd = (FluidModifierData *)md;
FluidDomainSettings *fds = fmd->domain;
WORKBENCH_PrivateData *wpd = vedata->stl->wpd;
WORKBENCH_TextureList *txl = vedata->txl;
DefaultTextureList *dtxl = DRW_viewport_texture_list_get();
DRWShadingGroup *grp = nullptr;
if (!fds->fluid) {
return;
}
wpd->volumes_do = true;
if (fds->use_coba) {
DRW_smoke_ensure_coba_field(fmd);
}
else if (fds->type == FLUID_DOMAIN_TYPE_GAS) {
DRW_smoke_ensure(fmd, fds->flags & FLUID_DOMAIN_USE_NOISE);
}
else {
return;
}
if ((!fds->use_coba && (fds->tex_density == nullptr && fds->tex_color == nullptr)) ||
(fds->use_coba && fds->tex_field == nullptr))
{
return;
}
const bool use_slice = (fds->axis_slice_method == AXIS_SLICE_SINGLE);
const bool show_phi = ELEM(fds->coba_field,
FLUID_DOMAIN_FIELD_PHI,
FLUID_DOMAIN_FIELD_PHI_IN,
FLUID_DOMAIN_FIELD_PHI_OUT,
FLUID_DOMAIN_FIELD_PHI_OBSTACLE);
const bool show_flags = (fds->coba_field == FLUID_DOMAIN_FIELD_FLAGS);
const bool show_pressure = (fds->coba_field == FLUID_DOMAIN_FIELD_PRESSURE);
eWORKBENCH_VolumeInterpType interp_type = WORKBENCH_VOLUME_INTERP_LINEAR;
switch ((FLUID_DisplayInterpolationMethod)fds->interp_method) {
case FLUID_DISPLAY_INTERP_LINEAR:
interp_type = WORKBENCH_VOLUME_INTERP_LINEAR;
break;
case FLUID_DISPLAY_INTERP_CUBIC:
interp_type = WORKBENCH_VOLUME_INTERP_CUBIC;
break;
case FLUID_DISPLAY_INTERP_CLOSEST:
interp_type = WORKBENCH_VOLUME_INTERP_CLOSEST;
break;
}
GPUShader *sh = workbench_shader_volume_get(use_slice, fds->use_coba, interp_type, true);
if (use_slice) {
float invviewmat[4][4];
DRW_view_viewmat_get(nullptr, invviewmat, true);
const int axis = (fds->slice_axis == SLICE_AXIS_AUTO) ?
axis_dominant_v3_single(invviewmat[2]) :
fds->slice_axis - 1;
float dim[3];
BKE_object_dimensions_get(ob, dim);
/* 0.05f to achieve somewhat the same opacity as the full view. */
float step_length = max_ff(1e-16f, dim[axis] * 0.05f);
grp = DRW_shgroup_create(sh, vedata->psl->volume_ps);
DRW_shgroup_uniform_block(grp, "world_data", wpd->world_ubo);
DRW_shgroup_uniform_float_copy(grp, "slicePosition", fds->slice_depth);
DRW_shgroup_uniform_int_copy(grp, "sliceAxis", axis);
DRW_shgroup_uniform_float_copy(grp, "stepLength", step_length);
DRW_shgroup_state_disable(grp, DRW_STATE_CULL_FRONT);
}
else {
double noise_ofs;
BLI_halton_1d(3, 0.0, wpd->taa_sample, &noise_ofs);
float dim[3], step_length, max_slice;
float slice_count[3] = {float(fds->res[0]), float(fds->res[1]), float(fds->res[2])};
mul_v3_fl(slice_count, max_ff(0.001f, fds->slice_per_voxel));
max_slice = max_fff(slice_count[0], slice_count[1], slice_count[2]);
BKE_object_dimensions_get(ob, dim);
invert_v3(slice_count);
mul_v3_v3(dim, slice_count);
step_length = len_v3(dim);
grp = DRW_shgroup_create(sh, vedata->psl->volume_ps);
DRW_shgroup_uniform_block(grp, "world_data", wpd->world_ubo);
DRW_shgroup_uniform_int_copy(grp, "samplesLen", max_slice);
DRW_shgroup_uniform_float_copy(grp, "stepLength", step_length);
DRW_shgroup_uniform_float_copy(grp, "noiseOfs", noise_ofs);
DRW_shgroup_state_enable(grp, DRW_STATE_CULL_FRONT);
}
if (fds->use_coba) {
if (show_flags) {
DRW_shgroup_uniform_texture(grp, "flagTexture", fds->tex_field);
}
else {
DRW_shgroup_uniform_texture(grp, "densityTexture", fds->tex_field);
}
if (!show_phi && !show_flags && !show_pressure) {
DRW_shgroup_uniform_texture(grp, "transferTexture", fds->tex_coba);
}
DRW_shgroup_uniform_float_copy(grp, "gridScale", fds->grid_scale);
DRW_shgroup_uniform_bool_copy(grp, "showPhi", show_phi);
DRW_shgroup_uniform_bool_copy(grp, "showFlags", show_flags);
DRW_shgroup_uniform_bool_copy(grp, "showPressure", show_pressure);
}
else {
static float white[3] = {1.0f, 1.0f, 1.0f};
bool use_constant_color = ((fds->active_fields & FLUID_DOMAIN_ACTIVE_COLORS) == 0 &&
(fds->active_fields & FLUID_DOMAIN_ACTIVE_COLOR_SET) != 0);
DRW_shgroup_uniform_texture(
grp, "densityTexture", (fds->tex_color) ? fds->tex_color : fds->tex_density);
DRW_shgroup_uniform_texture(grp, "shadowTexture", fds->tex_shadow);
DRW_shgroup_uniform_texture(
grp, "flameTexture", (fds->tex_flame) ? fds->tex_flame : txl->dummy_volume_tx);
DRW_shgroup_uniform_texture(
grp, "flameColorTexture", (fds->tex_flame) ? fds->tex_flame_coba : txl->dummy_coba_tx);
DRW_shgroup_uniform_vec3(
grp, "activeColor", (use_constant_color) ? fds->active_color : white, 1);
}
DRW_shgroup_uniform_texture_ref(grp, "depthBuffer", &dtxl->depth);
DRW_shgroup_uniform_float_copy(grp, "densityScale", 10.0f * fds->display_thickness);
if (use_slice) {
DRW_shgroup_call(grp, DRW_cache_quad_get(), ob);
}
else {
DRW_shgroup_call(grp, DRW_cache_cube_get(), ob);
}
}
static void workbench_volume_material_color(WORKBENCH_PrivateData *wpd,
Object *ob,
eV3DShadingColorType color_type,
float color[3])
{
Material *ma = BKE_object_material_get_eval(ob, VOLUME_MATERIAL_NR);
WORKBENCH_UBO_Material ubo_data;
workbench_material_ubo_data(wpd, ob, ma, &ubo_data, color_type);
copy_v3_v3(color, ubo_data.base_color);
}
static void workbench_volume_object_cache_populate(WORKBENCH_Data *vedata,
Object *ob,
eV3DShadingColorType color_type)
{
/* Create 3D textures. */
Volume *volume = static_cast<Volume *>(ob->data);
BKE_volume_load(volume, G.main);
const VolumeGrid *volume_grid = BKE_volume_grid_active_get_for_read(volume);
if (volume_grid == nullptr) {
return;
}
DRWVolumeGrid *grid = DRW_volume_batch_cache_get_grid(volume, volume_grid);
if (grid == nullptr) {
return;
}
WORKBENCH_PrivateData *wpd = vedata->stl->wpd;
WORKBENCH_TextureList *txl = vedata->txl;
DefaultTextureList *dtxl = DRW_viewport_texture_list_get();
DRWShadingGroup *grp = nullptr;
wpd->volumes_do = true;
const bool use_slice = (volume->display.axis_slice_method == AXIS_SLICE_SINGLE);
eWORKBENCH_VolumeInterpType interp_type = WORKBENCH_VOLUME_INTERP_LINEAR;
switch ((VolumeDisplayInterpMethod)volume->display.interpolation_method) {
case VOLUME_DISPLAY_INTERP_LINEAR:
interp_type = WORKBENCH_VOLUME_INTERP_LINEAR;
break;
case VOLUME_DISPLAY_INTERP_CUBIC:
interp_type = WORKBENCH_VOLUME_INTERP_CUBIC;
break;
case VOLUME_DISPLAY_INTERP_CLOSEST:
interp_type = WORKBENCH_VOLUME_INTERP_CLOSEST;
break;
}
/* Create shader. */
GPUShader *sh = workbench_shader_volume_get(use_slice, false, interp_type, false);
/* Compute color. */
float color[3];
workbench_volume_material_color(wpd, ob, color_type, color);
/* Combined texture to object, and object to world transform. */
float texture_to_world[4][4];
mul_m4_m4m4(texture_to_world, ob->object_to_world, grid->texture_to_object);
if (use_slice) {
float invviewmat[4][4];
DRW_view_viewmat_get(nullptr, invviewmat, true);
const int axis = (volume->display.slice_axis == SLICE_AXIS_AUTO) ?
axis_dominant_v3_single(invviewmat[2]) :
volume->display.slice_axis - 1;
float dim[3];
BKE_object_dimensions_get(ob, dim);
/* 0.05f to achieve somewhat the same opacity as the full view. */
float step_length = max_ff(1e-16f, dim[axis] * 0.05f);
const float slice_position = volume->display.slice_depth;
grp = DRW_shgroup_create(sh, vedata->psl->volume_ps);
DRW_shgroup_uniform_block(grp, "world_data", wpd->world_ubo);
DRW_shgroup_uniform_float_copy(grp, "slicePosition", slice_position);
DRW_shgroup_uniform_int_copy(grp, "sliceAxis", axis);
DRW_shgroup_uniform_float_copy(grp, "stepLength", step_length);
DRW_shgroup_state_disable(grp, DRW_STATE_CULL_FRONT);
}
else {
/* Compute world space dimensions for step size. */
float world_size[3];
mat4_to_size(world_size, texture_to_world);
abs_v3(world_size);
/* Compute step parameters. */
double noise_ofs;
BLI_halton_1d(3, 0.0, wpd->taa_sample, &noise_ofs);
float step_length, max_slice;
int resolution[3];
GPU_texture_get_mipmap_size(grid->texture, 0, resolution);
float slice_count[3] = {float(resolution[0]), float(resolution[1]), float(resolution[2])};
mul_v3_fl(slice_count, max_ff(0.001f, 5.0f));
max_slice = max_fff(slice_count[0], slice_count[1], slice_count[2]);
invert_v3(slice_count);
mul_v3_v3(slice_count, world_size);
step_length = len_v3(slice_count);
/* Set uniforms. */
grp = DRW_shgroup_create(sh, vedata->psl->volume_ps);
DRW_shgroup_uniform_block(grp, "world_data", wpd->world_ubo);
DRW_shgroup_uniform_int_copy(grp, "samplesLen", max_slice);
DRW_shgroup_uniform_float_copy(grp, "stepLength", step_length);
DRW_shgroup_uniform_float_copy(grp, "noiseOfs", noise_ofs);
DRW_shgroup_state_enable(grp, DRW_STATE_CULL_FRONT);
}
/* Compute density scale. */
const float density_scale = volume->display.density *
BKE_volume_density_scale(volume, ob->object_to_world);
DRW_shgroup_uniform_texture(grp, "densityTexture", grid->texture);
/* TODO: implement shadow texture, see manta_smoke_calc_transparency. */
DRW_shgroup_uniform_texture(grp, "shadowTexture", txl->dummy_shadow_tx);
DRW_shgroup_uniform_vec3_copy(grp, "activeColor", color);
DRW_shgroup_uniform_texture_ref(grp, "depthBuffer", &dtxl->depth);
DRW_shgroup_uniform_float_copy(grp, "densityScale", density_scale);
DRW_shgroup_uniform_mat4(grp, "volumeObjectToTexture", grid->object_to_texture);
DRW_shgroup_uniform_mat4(grp, "volumeTextureToObject", grid->texture_to_object);
DRW_shgroup_call(grp, DRW_cache_cube_get(), ob);
}
void workbench_volume_cache_populate(WORKBENCH_Data *vedata,
Scene * /*scene*/,
Object *ob,
ModifierData *md,
eV3DShadingColorType color_type)
{
if (md == nullptr) {
workbench_volume_object_cache_populate(vedata, ob, color_type);
}
else {
workbench_volume_modifier_cache_populate(vedata, ob, md);
}
}
void workbench_volume_draw_pass(WORKBENCH_Data *vedata)
{
WORKBENCH_PassList *psl = vedata->psl;
WORKBENCH_PrivateData *wpd = vedata->stl->wpd;
DefaultFramebufferList *dfbl = DRW_viewport_framebuffer_list_get();
if (wpd->volumes_do) {
GPU_framebuffer_bind(dfbl->color_only_fb);
DRW_draw_pass(psl->volume_ps);
}
}

View File

@ -680,12 +680,10 @@ set(SRC_SHADER_CREATE_INFOS
../draw/engines/overlay/shaders/infos/overlay_wireframe_info.hh
../draw/engines/select/shaders/infos/select_id_info.hh
../draw/engines/workbench/shaders/infos/workbench_composite_info.hh
../draw/engines/workbench/shaders/infos/workbench_depth_info.hh
../draw/engines/workbench/shaders/infos/workbench_effect_antialiasing_info.hh
../draw/engines/workbench/shaders/infos/workbench_effect_cavity_info.hh
../draw/engines/workbench/shaders/infos/workbench_effect_dof_info.hh
../draw/engines/workbench/shaders/infos/workbench_effect_outline_info.hh
../draw/engines/workbench/shaders/infos/workbench_merge_infront_info.hh
../draw/engines/workbench/shaders/infos/workbench_overlay_depth_info.hh
../draw/engines/workbench/shaders/infos/workbench_prepass_info.hh
../draw/engines/workbench/shaders/infos/workbench_shadow_info.hh
../draw/engines/workbench/shaders/infos/workbench_transparent_resolve_info.hh

View File

@ -2233,7 +2233,6 @@ enum {
/** #RenderData::engine (scene.cc) */
extern const char *RE_engine_id_BLENDER_EEVEE;
extern const char *RE_engine_id_BLENDER_WORKBENCH;
extern const char *RE_engine_id_BLENDER_WORKBENCH_NEXT;
extern const char *RE_engine_id_CYCLES;
/** \} */