Realtime Compositor: Extend option to enable compositor
This patch turns the checkbox option to enable the viewport compositor into a 3-option enum that allows: - Disabled. - Enabled. - Enabled only in camera view. See T102353. Differential Revision: https://developer.blender.org/D16509 Reviewed By: Clement Foucault
This commit is contained in:
parent
80249ce6e4
commit
11275b7363
Notes:
blender-bot
2023-12-06 11:02:31 +01:00
Referenced by issue #115605, Quick favorites item could not be deleted
|
@ -6211,8 +6211,8 @@ class VIEW3D_PT_shading_compositor(Panel):
|
|||
def draw(self, context):
|
||||
shading = context.space_data.shading
|
||||
|
||||
layout = self.layout
|
||||
layout.prop(shading, "use_compositor")
|
||||
row = self.layout.row()
|
||||
row.prop(shading, "use_compositor", expand=True)
|
||||
|
||||
|
||||
class VIEW3D_PT_gizmo_display(Panel):
|
||||
|
|
|
@ -45,6 +45,7 @@
|
|||
#include "DNA_mesh_types.h"
|
||||
#include "DNA_meshdata_types.h"
|
||||
#include "DNA_userdef_types.h"
|
||||
#include "DNA_view3d_types.h"
|
||||
#include "DNA_world_types.h"
|
||||
|
||||
#include "ED_gpencil.h"
|
||||
|
@ -1247,7 +1248,7 @@ static bool is_compositor_enabled(void)
|
|||
return false;
|
||||
}
|
||||
|
||||
if (!(DST.draw_ctx.v3d->shading.flag & V3D_SHADING_COMPOSITOR)) {
|
||||
if (DST.draw_ctx.v3d->shading.use_compositor == V3D_SHADING_USE_COMPOSITOR_DISABLED) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1263,6 +1264,11 @@ static bool is_compositor_enabled(void)
|
|||
return false;
|
||||
}
|
||||
|
||||
if (DST.draw_ctx.v3d->shading.use_compositor == V3D_SHADING_USE_COMPOSITOR_CAMERA &&
|
||||
DST.draw_ctx.rv3d->persp != RV3D_CAMOB) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -147,7 +147,11 @@ typedef struct View3DShading {
|
|||
char background_type;
|
||||
char cavity_type;
|
||||
char wire_color_type;
|
||||
char _pad[2];
|
||||
|
||||
/** When to preview the compositor output in the viewport. View3DShadingUseCompositor. */
|
||||
char use_compositor;
|
||||
|
||||
char _pad;
|
||||
|
||||
/** FILE_MAXFILE. */
|
||||
char studio_light[256];
|
||||
|
@ -491,7 +495,6 @@ enum {
|
|||
V3D_SHADING_SCENE_LIGHTS_RENDER = (1 << 12),
|
||||
V3D_SHADING_SCENE_WORLD_RENDER = (1 << 13),
|
||||
V3D_SHADING_STUDIOLIGHT_VIEW_ROTATION = (1 << 14),
|
||||
V3D_SHADING_COMPOSITOR = (1 << 15),
|
||||
};
|
||||
|
||||
/** #View3D.debug_flag */
|
||||
|
@ -516,6 +519,15 @@ enum {
|
|||
V3D_SHADING_CAVITY_BOTH = 2,
|
||||
};
|
||||
|
||||
/** #View3DShading.use_compositor */
|
||||
typedef enum View3DShadingUseCompositor {
|
||||
V3D_SHADING_USE_COMPOSITOR_DISABLED = 0,
|
||||
/** The compositor is enabled only in camera view. */
|
||||
V3D_SHADING_USE_COMPOSITOR_CAMERA = 1,
|
||||
/** The compositor is always enabled regardless of the view. */
|
||||
V3D_SHADING_USE_COMPOSITOR_ALWAYS = 2,
|
||||
} View3DShadingUseCompositor;
|
||||
|
||||
/** #View3DOverlay.flag */
|
||||
enum {
|
||||
V3D_OVERLAY_FACE_ORIENTATION = (1 << 0),
|
||||
|
|
|
@ -3959,6 +3959,25 @@ static void rna_def_space_view3d_shading(BlenderRNA *brna)
|
|||
{0, NULL, 0, NULL, NULL},
|
||||
};
|
||||
|
||||
static const EnumPropertyItem use_compositor_items[] = {
|
||||
{V3D_SHADING_USE_COMPOSITOR_DISABLED,
|
||||
"DISABLED",
|
||||
0,
|
||||
"Disabled",
|
||||
"The compositor is disabled"},
|
||||
{V3D_SHADING_USE_COMPOSITOR_CAMERA,
|
||||
"CAMERA",
|
||||
0,
|
||||
"Camera",
|
||||
"The compositor is enabled only in camera view"},
|
||||
{V3D_SHADING_USE_COMPOSITOR_ALWAYS,
|
||||
"ALWAYS",
|
||||
0,
|
||||
"Always",
|
||||
"The compositor is always enabled regardless of the view"},
|
||||
{0, NULL, 0, NULL, NULL},
|
||||
};
|
||||
|
||||
/* Note these settings are used for both 3D viewport and the OpenGL render
|
||||
* engine in the scene, so can't assume to always be part of a screen. */
|
||||
srna = RNA_def_struct(brna, "View3DShading", NULL);
|
||||
|
@ -4245,12 +4264,12 @@ static void rna_def_space_view3d_shading(BlenderRNA *brna)
|
|||
RNA_def_property_flag(prop, PROP_HIDDEN);
|
||||
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
|
||||
|
||||
prop = RNA_def_property(srna, "use_compositor", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "flag", V3D_SHADING_COMPOSITOR);
|
||||
prop = RNA_def_property(srna, "use_compositor", PROP_ENUM, PROP_NONE);
|
||||
RNA_def_property_enum_sdna(prop, NULL, "use_compositor");
|
||||
RNA_def_property_enum_items(prop, use_compositor_items);
|
||||
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
|
||||
RNA_def_property_boolean_default(prop, false);
|
||||
RNA_def_property_ui_text(
|
||||
prop, "Compositor", "Preview the compositor output inside the viewport");
|
||||
prop, "Compositor", "When to preview the compositor output inside the viewport");
|
||||
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D | NS_VIEW3D_SHADING, NULL);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue