46#include "RNA_prototypes.hh"
56 Scene &sequencer_scene,
71 &sequencer_scene.
id, RNA_SequencerCompositorModifierProperties, &cmd);
84 ImBuf *mask_buffer_ =
nullptr;
90 bool owns_mask_ =
false;
100 mod_context_(mod_context),
101 modifier_data_(modifier_data),
104 timeline_frame_(mod_context.timeline_frame),
105 viewer_compute_context_(
bke::
compositor::compute_viewer_compute_context(
109 &mod_context.
render_data.
scene->
id, RNA_SequencerCompositorModifierData, modifier_data);
116 this->mask_buffer_ =
nullptr;
118 if (this->owns_mask_) {
120 this->owns_mask_ =
false;
126 return viewer_compute_context_;
148 modifier_data_->node_group);
151 NodeGroupOperation node_group_operation(*
this, node_group, compute_context);
154 node_group.ensure_topology_cache();
167 const ResultType result_type = valid_socket_type ?
171 Result *input_result =
new Result(this->
create_result(result_type, ResultPrecision::Full));
172 if (input_socket == interface_inputs[0]) {
178 input_result->allocate_invalid();
181 else if (is_mask_used && input_socket == interface_inputs[1]) {
186 input_result->set_type(this->mask_.
type());
187 input_result->set_precision(this->mask_.
precision());
188 input_result->share_data(this->mask_);
192 input_result->allocate_invalid();
196 input_result->allocate_invalid();
199 else if (valid_socket_type) {
205 input_result->allocate_invalid();
208 node_group_operation.map_input_to_result(input_socket->identifier, input_result);
209 inputs.
append(std::unique_ptr<Result>(input_result));
214 node_group_operation.evaluate();
216 this->
write_outputs(node_group, node_group_operation, *this->image_buffer_);
227 &context.render_state,
231 if (this->mask_buffer_ !=
nullptr) {
233 this->owns_mask_ =
true;
239 frame_index = smd.
mask_id->
sfra + timeline_frame - context.strip.start;
242 frame_index = timeline_frame;
251 context.render_data.scene->sequencer_colorspace_settings.name);
253 const int width = context.render_data.rectx;
254 const int height = context.render_data.recty;
266 this->owns_mask_ =
false;
288 CompositorCache &com_cache = context.render_data.scene->ed->runtime->ensure_compositor_cache();
294 if (com_mod_context.
use_gpu()) {
334 "SequencerCompositorModifierData",
#define CTX_N_(context, msgid)
#define BLT_I18NCONTEXT_ID_SEQUENCE
#define PRF_scope_with_name(ui_name, category)
void append(const T &value)
const DataBlockComputeContext & for_data_block(const ComputeContext *parent, const uint32_t orig_session_uid, const ID *id=nullptr)
StaticCacheManager & cache_manager()
Result create_result(ResultType type, ResultPrecision precision)
bke::ComputeContextCache & compute_context_cache() const
void share_data(const Result &source)
bool is_allocated() const
static ResultType type(gpu::TextureFormat format)
static ResultPrecision precision(gpu::TextureFormat format)
void set_type(ResultType type)
void recreate_if_needed(bool gpu, compositor::ResultPrecision precision, const gpu::GPUSecondaryContextData &gpu_context)
compositor::StaticCacheManager & get_cache_manager()
const RenderData & render_data_
bool use_gpu() const override
void write_outputs(const bNodeTree &node_group, compositor::NodeGroupOperation &node_group_operation, ImBuf &output_image)
const Scene & get_scene() const override
void set_gpu_supported(const bool supported)
float2 get_result_translation() const
void write_viewer_impl(const compositor::Result &result, ImBuf &image)
CompositorContext(compositor::StaticCacheManager &cache_manager, bke::ComputeContextCache &compute_context_cache, const RenderData &render_data, const Strip &strip)
void create_result_from_input(compositor::Result &result, ImBuf &input)
void set_output_refcount(const bNodeTree &node_group, compositor::NodeGroupOperation &node_group_operation)
compositor::ResultPrecision get_precision() const override
compositor::Domain get_compositing_domain() const override
void render_mask_input(const ModifierApplyContext &context, int timeline_frame)
const ComputeContext * viewer_compute_context() const override
CompositorModifierContext(const ModifierApplyContext &mod_context, compositor::StaticCacheManager &cache_manager, bke::ComputeContextCache &compute_context_cache, SequencerCompositorModifierData *modifier_data)
void write_viewer(compositor::Result &viewer_result) override
std::unique_ptr< IDProperty, IDPropertyDeleter > create_group(StringRef prop_name, eIDPropertyFlag flags={})
Allocate a new IDProperty of type IDP_GROUP.
ResultType get_node_interface_socket_result_type(const bNodeTreeInterfaceSocket &socket)
void draw_compositor_nodes_modifier_ui(const bContext &C, PointerRNA *modifier_ptr, ui::Layout &layout)
StripModifierTypeInfo seqModifierType_Compositor
static void compositor_modifier_panel_draw(const bContext *C, Panel *panel)
SeqResult seq_render_strip(const RenderData *context, SeqRenderState *state, Strip *strip, float timeline_frame)
void compositor_modifier_nodes_update_interface(Main &bmain, Scene &sequencer_scene, SequencerCompositorModifierData &cmd)
static void compositor_modifier_register(ARegionType *region_type)
void set_input_result_from_rna(PointerRNA &inputs_ptr, const bNodeTreeInterfaceSocket &socket, const eNodeSocketDatatype socket_type, compositor::Result &result)
static void compositor_modifier_apply(ModifierApplyContext &context, StripModifierData *strip_modifier_data)
void render_end_gpu(const RenderData &rd, GpuContextState state)
static void compositor_modifier_init_data(StripModifierData *strip_modifier_data)
GpuContextState render_begin_gpu(const RenderData &rd)
static PointerRNA * modifier_panel_get_property_pointers(Panel *panel)
PanelType * modifier_panel_register(ARegionType *region_type, const eStripModifierType type, PanelDrawFn draw)
void panel_context_pointer_set(Panel *panel, const char *name, PointerRNA *ptr)
PointerRNA * panel_custom_data_get(const Panel *panel)
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
@ STRIP_MASK_TIME_ABSOLUTE
@ STRIP_MASK_TIME_RELATIVE
bool RNA_struct_is_a(const StructRNA *type, const StructRNA *srna)
void IMB_freeImBuf(ImBuf *ibuf)
VecBase< int32_t, 2 > int2
void DEG_id_tag_update(ID *id, unsigned int flags)
T * DEG_get_evaluated(const Depsgraph *depsgraph, T *id)
PointerRNA RNA_pointer_create_discrete(ID *id, StructRNA *type, void *data)
PointerRNA RNA_pointer_get(PointerRNA *ptr, const char *name)
void RNA_ensure_and_sync_system_properties(Main &bmain, PointerRNA &ptr, IDProperty &idprops)
@ ID_RECALC_SEQUENCER_STRIPS
@ eSeqModifierType_Compositor
bool IMB_colormanagement_space_name_is_srgb(const char *name)
StripModifierData modifier
struct bNodeTree * node_group
struct Strip * mask_strip
eModMaskInput mask_input_type
struct IDProperty * system_properties
bke::bNodeTreeType * typeinfo
bool(*) valid_socket_type(bNodeTreeType *ntreetype, bNodeSocketType *socket_type)
const RenderData & render_data
const float3x3 transform_comp_result