Cleanup: convert camelCase naming to snake_case in Compositor
To convert old code to the current convention and use a single code style.
This commit is contained in:
@@ -74,8 +74,8 @@ extern "C" {
|
||||
*
|
||||
* during the preparation of the execution All ReadBufferOperation will receive an offset.
|
||||
* This offset is used during execution as an optimization trick
|
||||
* Next all operations will be initialized for execution \see NodeOperation.initExecution
|
||||
* Next all ExecutionGroup's will be initialized for execution \see ExecutionGroup.initExecution
|
||||
* Next all operations will be initialized for execution \see NodeOperation.init_execution
|
||||
* Next all ExecutionGroup's will be initialized for execution \see ExecutionGroup.init_execution
|
||||
* this all is controlled from \see ExecutionSystem.execute
|
||||
*
|
||||
* \section priority Render priority
|
||||
@@ -92,7 +92,7 @@ extern "C" {
|
||||
* When match the ExecutionGroup will be executed (this happens in serial)
|
||||
*
|
||||
* \see ExecutionSystem.execute control of the Render priority
|
||||
* \see NodeOperation.getRenderPriority receive the render priority
|
||||
* \see NodeOperation.get_render_priority receive the render priority
|
||||
* \see ExecutionGroup.execute the main loop to execute a whole ExecutionGroup
|
||||
*
|
||||
* \section order Chunk order
|
||||
@@ -121,7 +121,7 @@ extern "C" {
|
||||
* Chunk is finished.
|
||||
*
|
||||
* \see ExecutionGroup.execute
|
||||
* \see ViewerOperation.getChunkOrder
|
||||
* \see ViewerOperation.get_chunk_order
|
||||
* \see ChunkOrdering
|
||||
*
|
||||
* \section interest Area of interest
|
||||
@@ -152,13 +152,13 @@ extern "C" {
|
||||
*
|
||||
* In the above example ExecutionGroup B has an outputoperation (ViewerOperation)
|
||||
* and is being executed.
|
||||
* The first chunk is evaluated [@ref ExecutionGroup.scheduleChunkWhenPossible],
|
||||
* The first chunk is evaluated [@ref ExecutionGroup.schedule_chunk_when_possible],
|
||||
* but not all input chunks are available.
|
||||
* The relevant ExecutionGroup (that can calculate the missing chunks; ExecutionGroup A)
|
||||
* is asked to calculate the area ExecutionGroup B is missing.
|
||||
* [@ref ExecutionGroup.scheduleAreaWhenPossible]
|
||||
* [@ref ExecutionGroup.schedule_area_when_possible]
|
||||
* ExecutionGroup B checks what chunks the area spans, and tries to schedule these chunks.
|
||||
* If all input data is available these chunks are scheduled [@ref ExecutionGroup.scheduleChunk]
|
||||
* If all input data is available these chunks are scheduled [@ref ExecutionGroup.schedule_chunk]
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
@@ -171,18 +171,18 @@ extern "C" {
|
||||
* O------------------------------->O |
|
||||
* . O |
|
||||
* . O-------\ |
|
||||
* . . | ExecutionGroup.scheduleChunkWhenPossible
|
||||
* . . | ExecutionGroup.schedule_chunk_when_possible
|
||||
* . . O----/ (*) |
|
||||
* . . O |
|
||||
* . . O |
|
||||
* . . O ExecutionGroup.scheduleAreaWhenPossible|
|
||||
* . . O ExecutionGroup.schedule_area_when_possible|
|
||||
* . . O---------------------------------------->O
|
||||
* . . . O----------\ ExecutionGroup.scheduleChunkWhenPossible
|
||||
* . . . O----------\ ExecutionGroup.schedule_chunk_when_possible
|
||||
* . . . . | (*)
|
||||
* . . . . O-------/
|
||||
* . . . . O
|
||||
* . . . . O
|
||||
* . . . . O-------\ ExecutionGroup.scheduleChunk
|
||||
* . . . . O-------\ ExecutionGroup.schedule_chunk
|
||||
* . . . . . |
|
||||
* . . . . . O----/
|
||||
* . . . . O<=O
|
||||
@@ -198,7 +198,7 @@ extern "C" {
|
||||
* This happens until all chunks of (ExecutionGroup B) are finished executing or the user break's the process.
|
||||
*
|
||||
* NodeOperation like the ScaleOperation can influence the area of interest by reimplementing the
|
||||
* [@ref NodeOperation.determineAreaOfInterest] method
|
||||
* [@ref NodeOperation.determine_area_of_interest] method
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
@@ -221,13 +221,13 @@ extern "C" {
|
||||
*
|
||||
* \see ExecutionGroup.execute Execute a complete ExecutionGroup.
|
||||
* Halts until finished or breaked by user
|
||||
* \see ExecutionGroup.scheduleChunkWhenPossible Tries to schedule a single chunk,
|
||||
* \see ExecutionGroup.schedule_chunk_when_possible Tries to schedule a single chunk,
|
||||
* checks if all input data is available. Can trigger dependent chunks to be calculated
|
||||
* \see ExecutionGroup.scheduleAreaWhenPossible
|
||||
* \see ExecutionGroup.schedule_area_when_possible
|
||||
* Tries to schedule an area. This can be multiple chunks
|
||||
* (is called from [@ref ExecutionGroup.scheduleChunkWhenPossible])
|
||||
* \see ExecutionGroup.scheduleChunk Schedule a chunk on the WorkScheduler
|
||||
* \see NodeOperation.determineDependingAreaOfInterest Influence the area of interest of a chunk.
|
||||
* (is called from [@ref ExecutionGroup.schedule_chunk_when_possible])
|
||||
* \see ExecutionGroup.schedule_chunk Schedule a chunk on the WorkScheduler
|
||||
* \see NodeOperation.determine_depending_area_of_interest Influence the area of interest of a chunk.
|
||||
* \see WriteBufferOperation Operation to write to a MemoryProxy/MemoryBuffer
|
||||
* \see ReadBufferOperation Operation to read from a MemoryProxy/MemoryBuffer
|
||||
* \see MemoryProxy proxy for information about memory image
|
||||
@@ -283,16 +283,16 @@ extern "C" {
|
||||
* The OutputOperation of the ExecutionGroup is called to execute the area of the outputbuffer.
|
||||
*
|
||||
* \see ExecutionGroup
|
||||
* \see NodeOperation.executeRegion executes a single chunk of a NodeOperation
|
||||
* \see NodeOperation.execute_region executes a single chunk of a NodeOperation
|
||||
* \see CPUDevice.execute
|
||||
*
|
||||
* \subsection GPUDevice OpenCLDevice
|
||||
*
|
||||
* To be completed!
|
||||
* \see NodeOperation.executeOpenCLRegion
|
||||
* \see NodeOperation.execute_opencl_region
|
||||
* \see OpenCLDevice.execute
|
||||
*
|
||||
* \section executePixel executing a pixel
|
||||
* \section execute_pixel executing a pixel
|
||||
* Finally the last step, the node functionality :)
|
||||
*/
|
||||
|
||||
@@ -312,10 +312,10 @@ extern "C" {
|
||||
* (true) or editing (false).
|
||||
* based on this setting the system will work differently:
|
||||
* - during rendering only Composite & the File output node will be calculated
|
||||
* \see NodeOperation.isOutputProgram(int rendering) of the specific operations
|
||||
* \see NodeOperation.is_output_program(int rendering) of the specific operations
|
||||
*
|
||||
* - during editing all output nodes will be calculated
|
||||
* \see NodeOperation.isOutputProgram(int rendering) of the specific operations
|
||||
* \see NodeOperation.is_output_program(int rendering) of the specific operations
|
||||
*
|
||||
* - another quality setting can be used bNodeTree.
|
||||
* The quality is determined by the bNodeTree fields.
|
||||
@@ -326,10 +326,10 @@ extern "C" {
|
||||
* - output nodes can have different priorities in the WorkScheduler.
|
||||
* This is implemented in the COM_execute function.
|
||||
*
|
||||
* \param viewSettings:
|
||||
* \param view_settings:
|
||||
* reference to view settings used for color management
|
||||
*
|
||||
* \param displaySettings:
|
||||
* \param display_settings:
|
||||
* reference to display settings used for color management
|
||||
*
|
||||
* OCIO_TODO: this options only used in rare cases, namely in output file node,
|
||||
@@ -343,13 +343,13 @@ void COM_execute(RenderData *render_data,
|
||||
Scene *scene,
|
||||
bNodeTree *node_tree,
|
||||
int rendering,
|
||||
const ColorManagedViewSettings *viewSettings,
|
||||
const ColorManagedDisplaySettings *displaySettings,
|
||||
const char *viewName);
|
||||
const ColorManagedViewSettings *view_settings,
|
||||
const ColorManagedDisplaySettings *display_settings,
|
||||
const char *view_name);
|
||||
|
||||
/**
|
||||
* \brief Deinitialize the compositor caches and allocated memory.
|
||||
* Use COM_clearCaches to only free the caches.
|
||||
* Use COM_clear_caches to only free the caches.
|
||||
*/
|
||||
void COM_deinitialize(void);
|
||||
|
||||
@@ -357,7 +357,7 @@ void COM_deinitialize(void);
|
||||
* \brief Clear all compositor caches. (Compositor system will still remain available).
|
||||
* To deinitialize the compositor use the COM_deinitialize method.
|
||||
*/
|
||||
// void COM_clearCaches(void); // NOT YET WRITTEN
|
||||
// void COM_clear_caches(void); // NOT YET WRITTEN
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ BufferOperation::BufferOperation(MemoryBuffer *buffer, DataType data_type)
|
||||
buffer_ = buffer;
|
||||
inflated_buffer_ = nullptr;
|
||||
set_canvas(buffer->get_rect());
|
||||
addOutputSocket(data_type);
|
||||
add_output_socket(data_type);
|
||||
flags.is_constant_operation = buffer_->is_a_single_elem();
|
||||
flags.is_fullframe_operation = false;
|
||||
}
|
||||
@@ -33,39 +33,42 @@ BufferOperation::BufferOperation(MemoryBuffer *buffer, DataType data_type)
|
||||
const float *BufferOperation::get_constant_elem()
|
||||
{
|
||||
BLI_assert(buffer_->is_a_single_elem());
|
||||
return buffer_->getBuffer();
|
||||
return buffer_->get_buffer();
|
||||
}
|
||||
|
||||
void BufferOperation::initExecution()
|
||||
void BufferOperation::init_execution()
|
||||
{
|
||||
if (buffer_->is_a_single_elem()) {
|
||||
initMutex();
|
||||
init_mutex();
|
||||
}
|
||||
}
|
||||
|
||||
void *BufferOperation::initializeTileData(rcti * /*rect*/)
|
||||
void *BufferOperation::initialize_tile_data(rcti * /*rect*/)
|
||||
{
|
||||
if (buffer_->is_a_single_elem() == false) {
|
||||
return buffer_;
|
||||
}
|
||||
|
||||
lockMutex();
|
||||
lock_mutex();
|
||||
if (!inflated_buffer_) {
|
||||
inflated_buffer_ = buffer_->inflate();
|
||||
}
|
||||
unlockMutex();
|
||||
unlock_mutex();
|
||||
return inflated_buffer_;
|
||||
}
|
||||
|
||||
void BufferOperation::deinitExecution()
|
||||
void BufferOperation::deinit_execution()
|
||||
{
|
||||
if (buffer_->is_a_single_elem()) {
|
||||
deinitMutex();
|
||||
deinit_mutex();
|
||||
}
|
||||
delete inflated_buffer_;
|
||||
}
|
||||
|
||||
void BufferOperation::executePixelSampled(float output[4], float x, float y, PixelSampler sampler)
|
||||
void BufferOperation::execute_pixel_sampled(float output[4],
|
||||
float x,
|
||||
float y,
|
||||
PixelSampler sampler)
|
||||
{
|
||||
switch (sampler) {
|
||||
case PixelSampler::Nearest:
|
||||
@@ -73,16 +76,16 @@ void BufferOperation::executePixelSampled(float output[4], float x, float y, Pix
|
||||
break;
|
||||
case PixelSampler::Bilinear:
|
||||
default:
|
||||
buffer_->readBilinear(output, x, y);
|
||||
buffer_->read_bilinear(output, x, y);
|
||||
break;
|
||||
case PixelSampler::Bicubic:
|
||||
/* No bicubic. Same implementation as ReadBufferOperation. */
|
||||
buffer_->readBilinear(output, x, y);
|
||||
buffer_->read_bilinear(output, x, y);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void BufferOperation::executePixelFiltered(
|
||||
void BufferOperation::execute_pixel_filtered(
|
||||
float output[4], float x, float y, float dx[2], float dy[2])
|
||||
{
|
||||
const float uv[2] = {x, y};
|
||||
|
||||
@@ -31,11 +31,12 @@ class BufferOperation : public ConstantOperation {
|
||||
BufferOperation(MemoryBuffer *buffer, DataType data_type);
|
||||
|
||||
const float *get_constant_elem() override;
|
||||
void *initializeTileData(rcti *rect) override;
|
||||
void initExecution() override;
|
||||
void deinitExecution() override;
|
||||
void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override;
|
||||
void executePixelFiltered(float output[4], float x, float y, float dx[2], float dy[2]) override;
|
||||
void *initialize_tile_data(rcti *rect) override;
|
||||
void init_execution() override;
|
||||
void deinit_execution() override;
|
||||
void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override;
|
||||
void execute_pixel_filtered(
|
||||
float output[4], float x, float y, float dx[2], float dy[2]) override;
|
||||
};
|
||||
|
||||
} // namespace blender::compositor
|
||||
|
||||
@@ -31,11 +31,11 @@ void CPUDevice::execute(WorkPackage *work_package)
|
||||
{
|
||||
switch (work_package->type) {
|
||||
case eWorkPackageType::Tile: {
|
||||
const unsigned int chunkNumber = work_package->chunk_number;
|
||||
ExecutionGroup *executionGroup = work_package->execution_group;
|
||||
const unsigned int chunk_number = work_package->chunk_number;
|
||||
ExecutionGroup *execution_group = work_package->execution_group;
|
||||
|
||||
executionGroup->getOutputOperation()->executeRegion(&work_package->rect, chunkNumber);
|
||||
executionGroup->finalizeChunkExecution(chunkNumber, nullptr);
|
||||
execution_group->get_output_operation()->execute_region(&work_package->rect, chunk_number);
|
||||
execution_group->finalize_chunk_execution(chunk_number, nullptr);
|
||||
break;
|
||||
}
|
||||
case eWorkPackageType::CustomFunction: {
|
||||
|
||||
@@ -26,13 +26,13 @@ CompositorContext::CompositorContext()
|
||||
rd_ = nullptr;
|
||||
quality_ = eCompositorQuality::High;
|
||||
hasActiveOpenCLDevices_ = false;
|
||||
fastCalculation_ = false;
|
||||
viewSettings_ = nullptr;
|
||||
displaySettings_ = nullptr;
|
||||
fast_calculation_ = false;
|
||||
view_settings_ = nullptr;
|
||||
display_settings_ = nullptr;
|
||||
bnodetree_ = nullptr;
|
||||
}
|
||||
|
||||
int CompositorContext::getFramenumber() const
|
||||
int CompositorContext::get_framenumber() const
|
||||
{
|
||||
BLI_assert(rd_);
|
||||
return rd_->cfra;
|
||||
@@ -40,8 +40,8 @@ int CompositorContext::getFramenumber() const
|
||||
|
||||
Size2f CompositorContext::get_render_size() const
|
||||
{
|
||||
return {getRenderData()->xsch * getRenderPercentageAsFactor(),
|
||||
getRenderData()->ysch * getRenderPercentageAsFactor()};
|
||||
return {get_render_data()->xsch * get_render_percentage_as_factor(),
|
||||
get_render_data()->ysch * get_render_percentage_as_factor()};
|
||||
}
|
||||
|
||||
eExecutionModel CompositorContext::get_execution_model() const
|
||||
|
||||
@@ -77,16 +77,16 @@ class CompositorContext {
|
||||
/**
|
||||
* \brief Skip slow nodes
|
||||
*/
|
||||
bool fastCalculation_;
|
||||
bool fast_calculation_;
|
||||
|
||||
/* \brief color management settings */
|
||||
const ColorManagedViewSettings *viewSettings_;
|
||||
const ColorManagedDisplaySettings *displaySettings_;
|
||||
const ColorManagedViewSettings *view_settings_;
|
||||
const ColorManagedDisplaySettings *display_settings_;
|
||||
|
||||
/**
|
||||
* \brief active rendering view name
|
||||
*/
|
||||
const char *viewName_;
|
||||
const char *view_name_;
|
||||
|
||||
public:
|
||||
/**
|
||||
@@ -97,7 +97,7 @@ class CompositorContext {
|
||||
/**
|
||||
* \brief set the rendering field of the context
|
||||
*/
|
||||
void setRendering(bool rendering)
|
||||
void set_rendering(bool rendering)
|
||||
{
|
||||
rendering_ = rendering;
|
||||
}
|
||||
@@ -105,7 +105,7 @@ class CompositorContext {
|
||||
/**
|
||||
* \brief get the rendering field of the context
|
||||
*/
|
||||
bool isRendering() const
|
||||
bool is_rendering() const
|
||||
{
|
||||
return rendering_;
|
||||
}
|
||||
@@ -113,7 +113,7 @@ class CompositorContext {
|
||||
/**
|
||||
* \brief set the scene of the context
|
||||
*/
|
||||
void setRenderData(RenderData *rd)
|
||||
void set_render_data(RenderData *rd)
|
||||
{
|
||||
rd_ = rd;
|
||||
}
|
||||
@@ -121,7 +121,7 @@ class CompositorContext {
|
||||
/**
|
||||
* \brief set the bnodetree of the context
|
||||
*/
|
||||
void setbNodeTree(bNodeTree *bnodetree)
|
||||
void set_bnodetree(bNodeTree *bnodetree)
|
||||
{
|
||||
bnodetree_ = bnodetree;
|
||||
}
|
||||
@@ -129,7 +129,7 @@ class CompositorContext {
|
||||
/**
|
||||
* \brief get the bnodetree of the context
|
||||
*/
|
||||
const bNodeTree *getbNodeTree() const
|
||||
const bNodeTree *get_bnodetree() const
|
||||
{
|
||||
return bnodetree_;
|
||||
}
|
||||
@@ -137,16 +137,16 @@ class CompositorContext {
|
||||
/**
|
||||
* \brief get the scene of the context
|
||||
*/
|
||||
const RenderData *getRenderData() const
|
||||
const RenderData *get_render_data() const
|
||||
{
|
||||
return rd_;
|
||||
}
|
||||
|
||||
void setScene(Scene *scene)
|
||||
void set_scene(Scene *scene)
|
||||
{
|
||||
scene_ = scene;
|
||||
}
|
||||
Scene *getScene() const
|
||||
Scene *get_scene() const
|
||||
{
|
||||
return scene_;
|
||||
}
|
||||
@@ -154,7 +154,7 @@ class CompositorContext {
|
||||
/**
|
||||
* \brief set the preview image hash table
|
||||
*/
|
||||
void setPreviewHash(bNodeInstanceHash *previews)
|
||||
void set_preview_hash(bNodeInstanceHash *previews)
|
||||
{
|
||||
previews_ = previews;
|
||||
}
|
||||
@@ -162,7 +162,7 @@ class CompositorContext {
|
||||
/**
|
||||
* \brief get the preview image hash table
|
||||
*/
|
||||
bNodeInstanceHash *getPreviewHash() const
|
||||
bNodeInstanceHash *get_preview_hash() const
|
||||
{
|
||||
return previews_;
|
||||
}
|
||||
@@ -170,39 +170,39 @@ class CompositorContext {
|
||||
/**
|
||||
* \brief set view settings of color management
|
||||
*/
|
||||
void setViewSettings(const ColorManagedViewSettings *viewSettings)
|
||||
void set_view_settings(const ColorManagedViewSettings *view_settings)
|
||||
{
|
||||
viewSettings_ = viewSettings;
|
||||
view_settings_ = view_settings;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief get view settings of color management
|
||||
*/
|
||||
const ColorManagedViewSettings *getViewSettings() const
|
||||
const ColorManagedViewSettings *get_view_settings() const
|
||||
{
|
||||
return viewSettings_;
|
||||
return view_settings_;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief set display settings of color management
|
||||
*/
|
||||
void setDisplaySettings(const ColorManagedDisplaySettings *displaySettings)
|
||||
void set_display_settings(const ColorManagedDisplaySettings *display_settings)
|
||||
{
|
||||
displaySettings_ = displaySettings;
|
||||
display_settings_ = display_settings;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief get display settings of color management
|
||||
*/
|
||||
const ColorManagedDisplaySettings *getDisplaySettings() const
|
||||
const ColorManagedDisplaySettings *get_display_settings() const
|
||||
{
|
||||
return displaySettings_;
|
||||
return display_settings_;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief set the quality
|
||||
*/
|
||||
void setQuality(eCompositorQuality quality)
|
||||
void set_quality(eCompositorQuality quality)
|
||||
{
|
||||
quality_ = quality;
|
||||
}
|
||||
@@ -210,7 +210,7 @@ class CompositorContext {
|
||||
/**
|
||||
* \brief get the quality
|
||||
*/
|
||||
eCompositorQuality getQuality() const
|
||||
eCompositorQuality get_quality() const
|
||||
{
|
||||
return quality_;
|
||||
}
|
||||
@@ -218,18 +218,18 @@ class CompositorContext {
|
||||
/**
|
||||
* \brief get the current frame-number of the scene in this context
|
||||
*/
|
||||
int getFramenumber() const;
|
||||
int get_framenumber() const;
|
||||
|
||||
/**
|
||||
* \brief has this system active openclDevices?
|
||||
* \brief has this system active opencl_devices?
|
||||
*/
|
||||
bool getHasActiveOpenCLDevices() const
|
||||
bool get_has_active_opencl_devices() const
|
||||
{
|
||||
return hasActiveOpenCLDevices_;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief set has this system active openclDevices?
|
||||
* \brief set has this system active opencl_devices?
|
||||
*/
|
||||
void setHasActiveOpenCLDevices(bool hasAvtiveOpenCLDevices)
|
||||
{
|
||||
@@ -239,48 +239,48 @@ class CompositorContext {
|
||||
/** Whether it has a view with a specific name and not the default one. */
|
||||
bool has_explicit_view() const
|
||||
{
|
||||
return viewName_ && viewName_[0] != '\0';
|
||||
return view_name_ && view_name_[0] != '\0';
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief get the active rendering view
|
||||
*/
|
||||
const char *getViewName() const
|
||||
const char *get_view_name() const
|
||||
{
|
||||
return viewName_;
|
||||
return view_name_;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief set the active rendering view
|
||||
*/
|
||||
void setViewName(const char *viewName)
|
||||
void set_view_name(const char *view_name)
|
||||
{
|
||||
viewName_ = viewName;
|
||||
view_name_ = view_name;
|
||||
}
|
||||
|
||||
int getChunksize() const
|
||||
int get_chunksize() const
|
||||
{
|
||||
return this->getbNodeTree()->chunksize;
|
||||
return this->get_bnodetree()->chunksize;
|
||||
}
|
||||
|
||||
void setFastCalculation(bool fastCalculation)
|
||||
void set_fast_calculation(bool fast_calculation)
|
||||
{
|
||||
fastCalculation_ = fastCalculation;
|
||||
fast_calculation_ = fast_calculation;
|
||||
}
|
||||
bool isFastCalculation() const
|
||||
bool is_fast_calculation() const
|
||||
{
|
||||
return fastCalculation_;
|
||||
return fast_calculation_;
|
||||
}
|
||||
bool isGroupnodeBufferEnabled() const
|
||||
bool is_groupnode_buffer_enabled() const
|
||||
{
|
||||
return (this->getbNodeTree()->flag & NTREE_COM_GROUPNODE_BUFFER) != 0;
|
||||
return (this->get_bnodetree()->flag & NTREE_COM_GROUPNODE_BUFFER) != 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Get the render percentage as a factor.
|
||||
* The compositor uses a factor i.o. a percentage.
|
||||
*/
|
||||
float getRenderPercentageAsFactor() const
|
||||
float get_render_percentage_as_factor() const
|
||||
{
|
||||
return rd_->size * 0.01f;
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ ConstantFolder::ConstantFolder(NodeOperationBuilder &operations_builder)
|
||||
static bool is_constant_foldable(NodeOperation *operation)
|
||||
{
|
||||
if (operation->get_flags().can_be_constant && !operation->get_flags().is_constant_operation) {
|
||||
for (int i = 0; i < operation->getNumberOfInputSockets(); i++) {
|
||||
for (int i = 0; i < operation->get_number_of_input_sockets(); i++) {
|
||||
NodeOperation *input = operation->get_input_operation(i);
|
||||
if (!input->get_flags().is_constant_operation ||
|
||||
!static_cast<ConstantOperation *>(input)->can_get_constant_elem()) {
|
||||
@@ -72,17 +72,17 @@ static ConstantOperation *create_constant_operation(DataType data_type, const fl
|
||||
switch (data_type) {
|
||||
case DataType::Color: {
|
||||
SetColorOperation *color_op = new SetColorOperation();
|
||||
color_op->setChannels(constant_elem);
|
||||
color_op->set_channels(constant_elem);
|
||||
return color_op;
|
||||
}
|
||||
case DataType::Vector: {
|
||||
SetVectorOperation *vector_op = new SetVectorOperation();
|
||||
vector_op->setVector(constant_elem);
|
||||
vector_op->set_vector(constant_elem);
|
||||
return vector_op;
|
||||
}
|
||||
case DataType::Value: {
|
||||
SetValueOperation *value_op = new SetValueOperation();
|
||||
value_op->setValue(*constant_elem);
|
||||
value_op->set_value(*constant_elem);
|
||||
return value_op;
|
||||
}
|
||||
default: {
|
||||
@@ -94,7 +94,7 @@ static ConstantOperation *create_constant_operation(DataType data_type, const fl
|
||||
|
||||
ConstantOperation *ConstantFolder::fold_operation(NodeOperation *operation)
|
||||
{
|
||||
const DataType data_type = operation->getOutputSocket()->getDataType();
|
||||
const DataType data_type = operation->get_output_socket()->get_data_type();
|
||||
MemoryBuffer fold_buf(data_type, first_elem_area_);
|
||||
Vector<MemoryBuffer *> input_bufs = get_constant_input_buffers(operation);
|
||||
operation->init_data();
|
||||
@@ -102,7 +102,8 @@ ConstantOperation *ConstantFolder::fold_operation(NodeOperation *operation)
|
||||
|
||||
MemoryBuffer *constant_buf = create_constant_buffer(data_type);
|
||||
constant_buf->copy_from(&fold_buf, first_elem_area_);
|
||||
ConstantOperation *constant_op = create_constant_operation(data_type, constant_buf->getBuffer());
|
||||
ConstantOperation *constant_op = create_constant_operation(data_type,
|
||||
constant_buf->get_buffer());
|
||||
operations_builder_.replace_operation_with_constant(operation, constant_op);
|
||||
constant_buffers_.add_new(constant_op, constant_buf);
|
||||
return constant_op;
|
||||
@@ -117,14 +118,15 @@ MemoryBuffer *ConstantFolder::create_constant_buffer(const DataType data_type)
|
||||
|
||||
Vector<MemoryBuffer *> ConstantFolder::get_constant_input_buffers(NodeOperation *operation)
|
||||
{
|
||||
const int num_inputs = operation->getNumberOfInputSockets();
|
||||
const int num_inputs = operation->get_number_of_input_sockets();
|
||||
Vector<MemoryBuffer *> inputs_bufs(num_inputs);
|
||||
for (int i = 0; i < num_inputs; i++) {
|
||||
BLI_assert(operation->get_input_operation(i)->get_flags().is_constant_operation);
|
||||
ConstantOperation *constant_op = static_cast<ConstantOperation *>(
|
||||
operation->get_input_operation(i));
|
||||
MemoryBuffer *constant_buf = constant_buffers_.lookup_or_add_cb(constant_op, [=] {
|
||||
MemoryBuffer *buf = create_constant_buffer(constant_op->getOutputSocket()->getDataType());
|
||||
MemoryBuffer *buf = create_constant_buffer(
|
||||
constant_op->get_output_socket()->get_data_type());
|
||||
constant_op->render(buf, {first_elem_area_}, {});
|
||||
return buf;
|
||||
});
|
||||
@@ -186,8 +188,8 @@ void ConstantFolder::get_operation_output_operations(NodeOperation *operation,
|
||||
{
|
||||
const Vector<Link> &links = operations_builder_.get_links();
|
||||
for (const Link &link : links) {
|
||||
if (&link.from()->getOperation() == operation) {
|
||||
r_outputs.append(&link.to()->getOperation());
|
||||
if (&link.from()->get_operation() == operation) {
|
||||
r_outputs.append(&link.to()->get_operation());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -433,8 +433,8 @@ Node *COM_convert_bnode(bNode *b_node)
|
||||
/* TODO(jbakker): make this an std::optional<NodeOperation>. */
|
||||
NodeOperation *COM_convert_data_type(const NodeOperationOutput &from, const NodeOperationInput &to)
|
||||
{
|
||||
const DataType src_data_type = from.getDataType();
|
||||
const DataType dst_data_type = to.getDataType();
|
||||
const DataType src_data_type = from.get_data_type();
|
||||
const DataType dst_data_type = to.get_data_type();
|
||||
|
||||
if (src_data_type == DataType::Value && dst_data_type == DataType::Color) {
|
||||
return new ConvertValueToColorOperation();
|
||||
@@ -459,24 +459,24 @@ NodeOperation *COM_convert_data_type(const NodeOperationOutput &from, const Node
|
||||
}
|
||||
|
||||
void COM_convert_canvas(NodeOperationBuilder &builder,
|
||||
NodeOperationOutput *fromSocket,
|
||||
NodeOperationInput *toSocket)
|
||||
NodeOperationOutput *from_socket,
|
||||
NodeOperationInput *to_socket)
|
||||
{
|
||||
/* Data type conversions are executed before resolutions to ensure convert operations have
|
||||
* resolution. This method have to ensure same datatypes are linked for new operations. */
|
||||
BLI_assert(fromSocket->getDataType() == toSocket->getDataType());
|
||||
BLI_assert(from_socket->get_data_type() == to_socket->get_data_type());
|
||||
|
||||
ResizeMode mode = toSocket->getResizeMode();
|
||||
ResizeMode mode = to_socket->get_resize_mode();
|
||||
BLI_assert(mode != ResizeMode::None);
|
||||
|
||||
NodeOperation *toOperation = &toSocket->getOperation();
|
||||
const float toWidth = toOperation->getWidth();
|
||||
const float toHeight = toOperation->getHeight();
|
||||
NodeOperation *fromOperation = &fromSocket->getOperation();
|
||||
const float fromWidth = fromOperation->getWidth();
|
||||
const float fromHeight = fromOperation->getHeight();
|
||||
bool doCenter = false;
|
||||
bool doScale = false;
|
||||
NodeOperation *to_operation = &to_socket->get_operation();
|
||||
const float to_width = to_operation->get_width();
|
||||
const float to_height = to_operation->get_height();
|
||||
NodeOperation *from_operation = &from_socket->get_operation();
|
||||
const float from_width = from_operation->get_width();
|
||||
const float from_height = from_operation->get_height();
|
||||
bool do_center = false;
|
||||
bool do_scale = false;
|
||||
float scaleX = 0;
|
||||
float scaleY = 0;
|
||||
|
||||
@@ -485,23 +485,23 @@ void COM_convert_canvas(NodeOperationBuilder &builder,
|
||||
case ResizeMode::Align:
|
||||
break;
|
||||
case ResizeMode::Center:
|
||||
doCenter = true;
|
||||
do_center = true;
|
||||
break;
|
||||
case ResizeMode::FitWidth:
|
||||
doCenter = true;
|
||||
doScale = true;
|
||||
scaleX = scaleY = toWidth / fromWidth;
|
||||
do_center = true;
|
||||
do_scale = true;
|
||||
scaleX = scaleY = to_width / from_width;
|
||||
break;
|
||||
case ResizeMode::FitHeight:
|
||||
doCenter = true;
|
||||
doScale = true;
|
||||
scaleX = scaleY = toHeight / fromHeight;
|
||||
do_center = true;
|
||||
do_scale = true;
|
||||
scaleX = scaleY = to_height / from_height;
|
||||
break;
|
||||
case ResizeMode::FitAny:
|
||||
doCenter = true;
|
||||
doScale = true;
|
||||
scaleX = toWidth / fromWidth;
|
||||
scaleY = toHeight / fromHeight;
|
||||
do_center = true;
|
||||
do_scale = true;
|
||||
scaleX = to_width / from_width;
|
||||
scaleY = to_height / from_height;
|
||||
if (scaleX < scaleY) {
|
||||
scaleX = scaleY;
|
||||
}
|
||||
@@ -510,81 +510,82 @@ void COM_convert_canvas(NodeOperationBuilder &builder,
|
||||
}
|
||||
break;
|
||||
case ResizeMode::Stretch:
|
||||
doCenter = true;
|
||||
doScale = true;
|
||||
scaleX = toWidth / fromWidth;
|
||||
scaleY = toHeight / fromHeight;
|
||||
do_center = true;
|
||||
do_scale = true;
|
||||
scaleX = to_width / from_width;
|
||||
scaleY = to_height / from_height;
|
||||
break;
|
||||
}
|
||||
|
||||
float addX = doCenter ? (toWidth - fromWidth) / 2.0f : 0.0f;
|
||||
float addY = doCenter ? (toHeight - fromHeight) / 2.0f : 0.0f;
|
||||
float addX = do_center ? (to_width - from_width) / 2.0f : 0.0f;
|
||||
float addY = do_center ? (to_height - from_height) / 2.0f : 0.0f;
|
||||
NodeOperation *first = nullptr;
|
||||
ScaleOperation *scaleOperation = nullptr;
|
||||
if (doScale) {
|
||||
scaleOperation = new ScaleRelativeOperation(fromSocket->getDataType());
|
||||
scaleOperation->getInputSocket(1)->setResizeMode(ResizeMode::None);
|
||||
scaleOperation->getInputSocket(2)->setResizeMode(ResizeMode::None);
|
||||
first = scaleOperation;
|
||||
ScaleOperation *scale_operation = nullptr;
|
||||
if (do_scale) {
|
||||
scale_operation = new ScaleRelativeOperation(from_socket->get_data_type());
|
||||
scale_operation->get_input_socket(1)->set_resize_mode(ResizeMode::None);
|
||||
scale_operation->get_input_socket(2)->set_resize_mode(ResizeMode::None);
|
||||
first = scale_operation;
|
||||
SetValueOperation *sxop = new SetValueOperation();
|
||||
sxop->setValue(scaleX);
|
||||
builder.addLink(sxop->getOutputSocket(), scaleOperation->getInputSocket(1));
|
||||
sxop->set_value(scaleX);
|
||||
builder.add_link(sxop->get_output_socket(), scale_operation->get_input_socket(1));
|
||||
SetValueOperation *syop = new SetValueOperation();
|
||||
syop->setValue(scaleY);
|
||||
builder.addLink(syop->getOutputSocket(), scaleOperation->getInputSocket(2));
|
||||
builder.addOperation(sxop);
|
||||
builder.addOperation(syop);
|
||||
syop->set_value(scaleY);
|
||||
builder.add_link(syop->get_output_socket(), scale_operation->get_input_socket(2));
|
||||
builder.add_operation(sxop);
|
||||
builder.add_operation(syop);
|
||||
|
||||
rcti scale_canvas = fromOperation->get_canvas();
|
||||
rcti scale_canvas = from_operation->get_canvas();
|
||||
if (builder.context().get_execution_model() == eExecutionModel::FullFrame) {
|
||||
ScaleOperation::scale_area(scale_canvas, scaleX, scaleY);
|
||||
scale_canvas.xmax = scale_canvas.xmin + toOperation->getWidth();
|
||||
scale_canvas.ymax = scale_canvas.ymin + toOperation->getHeight();
|
||||
scale_canvas.xmax = scale_canvas.xmin + to_operation->get_width();
|
||||
scale_canvas.ymax = scale_canvas.ymin + to_operation->get_height();
|
||||
addX = 0;
|
||||
addY = 0;
|
||||
}
|
||||
scaleOperation->set_canvas(scale_canvas);
|
||||
scale_operation->set_canvas(scale_canvas);
|
||||
sxop->set_canvas(scale_canvas);
|
||||
syop->set_canvas(scale_canvas);
|
||||
builder.addOperation(scaleOperation);
|
||||
builder.add_operation(scale_operation);
|
||||
}
|
||||
|
||||
TranslateOperation *translateOperation = new TranslateOperation(toSocket->getDataType());
|
||||
translateOperation->getInputSocket(1)->setResizeMode(ResizeMode::None);
|
||||
translateOperation->getInputSocket(2)->setResizeMode(ResizeMode::None);
|
||||
TranslateOperation *translate_operation = new TranslateOperation(to_socket->get_data_type());
|
||||
translate_operation->get_input_socket(1)->set_resize_mode(ResizeMode::None);
|
||||
translate_operation->get_input_socket(2)->set_resize_mode(ResizeMode::None);
|
||||
if (!first) {
|
||||
first = translateOperation;
|
||||
first = translate_operation;
|
||||
}
|
||||
SetValueOperation *xop = new SetValueOperation();
|
||||
xop->setValue(addX);
|
||||
builder.addLink(xop->getOutputSocket(), translateOperation->getInputSocket(1));
|
||||
xop->set_value(addX);
|
||||
builder.add_link(xop->get_output_socket(), translate_operation->get_input_socket(1));
|
||||
SetValueOperation *yop = new SetValueOperation();
|
||||
yop->setValue(addY);
|
||||
builder.addLink(yop->getOutputSocket(), translateOperation->getInputSocket(2));
|
||||
builder.addOperation(xop);
|
||||
builder.addOperation(yop);
|
||||
yop->set_value(addY);
|
||||
builder.add_link(yop->get_output_socket(), translate_operation->get_input_socket(2));
|
||||
builder.add_operation(xop);
|
||||
builder.add_operation(yop);
|
||||
|
||||
rcti translate_canvas = toOperation->get_canvas();
|
||||
rcti translate_canvas = to_operation->get_canvas();
|
||||
if (mode == ResizeMode::Align) {
|
||||
translate_canvas.xmax = translate_canvas.xmin + fromWidth;
|
||||
translate_canvas.ymax = translate_canvas.ymin + fromHeight;
|
||||
translate_canvas.xmax = translate_canvas.xmin + from_width;
|
||||
translate_canvas.ymax = translate_canvas.ymin + from_height;
|
||||
}
|
||||
translateOperation->set_canvas(translate_canvas);
|
||||
translate_operation->set_canvas(translate_canvas);
|
||||
xop->set_canvas(translate_canvas);
|
||||
yop->set_canvas(translate_canvas);
|
||||
builder.addOperation(translateOperation);
|
||||
builder.add_operation(translate_operation);
|
||||
|
||||
if (doScale) {
|
||||
translateOperation->getInputSocket(0)->setResizeMode(ResizeMode::None);
|
||||
builder.addLink(scaleOperation->getOutputSocket(), translateOperation->getInputSocket(0));
|
||||
if (do_scale) {
|
||||
translate_operation->get_input_socket(0)->set_resize_mode(ResizeMode::None);
|
||||
builder.add_link(scale_operation->get_output_socket(),
|
||||
translate_operation->get_input_socket(0));
|
||||
}
|
||||
|
||||
/* remove previous link and replace */
|
||||
builder.removeInputLink(toSocket);
|
||||
first->getInputSocket(0)->setResizeMode(ResizeMode::None);
|
||||
toSocket->setResizeMode(ResizeMode::None);
|
||||
builder.addLink(fromSocket, first->getInputSocket(0));
|
||||
builder.addLink(translateOperation->getOutputSocket(), toSocket);
|
||||
builder.remove_input_link(to_socket);
|
||||
first->get_input_socket(0)->set_resize_mode(ResizeMode::None);
|
||||
to_socket->set_resize_mode(ResizeMode::None);
|
||||
builder.add_link(from_socket, first->get_input_socket(0));
|
||||
builder.add_link(translate_operation->get_output_socket(), to_socket);
|
||||
}
|
||||
|
||||
} // namespace blender::compositor
|
||||
|
||||
@@ -65,7 +65,7 @@ NodeOperation *COM_convert_data_type(const NodeOperationOutput &from,
|
||||
* \see InputSocketResizeMode for the possible conversions.
|
||||
*/
|
||||
void COM_convert_canvas(NodeOperationBuilder &builder,
|
||||
NodeOperationOutput *fromSocket,
|
||||
NodeOperationInput *toSocket);
|
||||
NodeOperationOutput *from_socket,
|
||||
NodeOperationInput *to_socket);
|
||||
|
||||
} // namespace blender::compositor
|
||||
|
||||
@@ -80,14 +80,14 @@ int DebugInfo::graphviz_operation(const ExecutionSystem *system,
|
||||
std::string fillcolor = "gainsboro";
|
||||
if (operation->get_flags().is_viewer_operation) {
|
||||
const ViewerOperation *viewer = (const ViewerOperation *)operation;
|
||||
if (viewer->isActiveViewerOutput()) {
|
||||
if (viewer->is_active_viewer_output()) {
|
||||
fillcolor = "lightskyblue1";
|
||||
}
|
||||
else {
|
||||
fillcolor = "lightskyblue3";
|
||||
}
|
||||
}
|
||||
else if (operation->isOutputOperation(system->getContext().isRendering())) {
|
||||
else if (operation->is_output_operation(system->get_context().is_rendering())) {
|
||||
fillcolor = "dodgerblue1";
|
||||
}
|
||||
else if (operation->get_flags().is_set_operation) {
|
||||
@@ -112,16 +112,16 @@ int DebugInfo::graphviz_operation(const ExecutionSystem *system,
|
||||
" [fillcolor=%s,style=filled,shape=record,label=\"{",
|
||||
fillcolor.c_str());
|
||||
|
||||
int totinputs = operation->getNumberOfInputSockets();
|
||||
int totinputs = operation->get_number_of_input_sockets();
|
||||
if (totinputs != 0) {
|
||||
len += snprintf(str + len, maxlen > len ? maxlen - len : 0, "{");
|
||||
for (int k = 0; k < totinputs; k++) {
|
||||
NodeOperationInput *socket = operation->getInputSocket(k);
|
||||
NodeOperationInput *socket = operation->get_input_socket(k);
|
||||
if (k != 0) {
|
||||
len += snprintf(str + len, maxlen > len ? maxlen - len : 0, "|");
|
||||
}
|
||||
len += snprintf(str + len, maxlen > len ? maxlen - len : 0, "<IN_%p>", socket);
|
||||
switch (socket->getDataType()) {
|
||||
switch (socket->get_data_type()) {
|
||||
case DataType::Value:
|
||||
len += snprintf(str + len, maxlen > len ? maxlen - len : 0, "Value");
|
||||
break;
|
||||
@@ -156,20 +156,20 @@ int DebugInfo::graphviz_operation(const ExecutionSystem *system,
|
||||
operation->get_id(),
|
||||
operation->get_canvas().xmin,
|
||||
operation->get_canvas().ymin,
|
||||
operation->getWidth(),
|
||||
operation->getHeight());
|
||||
operation->get_width(),
|
||||
operation->get_height());
|
||||
|
||||
int totoutputs = operation->getNumberOfOutputSockets();
|
||||
int totoutputs = operation->get_number_of_output_sockets();
|
||||
if (totoutputs != 0) {
|
||||
len += snprintf(str + len, maxlen > len ? maxlen - len : 0, "|");
|
||||
len += snprintf(str + len, maxlen > len ? maxlen - len : 0, "{");
|
||||
for (int k = 0; k < totoutputs; k++) {
|
||||
NodeOperationOutput *socket = operation->getOutputSocket(k);
|
||||
NodeOperationOutput *socket = operation->get_output_socket(k);
|
||||
if (k != 0) {
|
||||
len += snprintf(str + len, maxlen > len ? maxlen - len : 0, "|");
|
||||
}
|
||||
len += snprintf(str + len, maxlen > len ? maxlen - len : 0, "<OUT_%p>", socket);
|
||||
switch (socket->getDataType()) {
|
||||
switch (socket->get_data_type()) {
|
||||
case DataType::Value: {
|
||||
ConstantOperation *constant = operation->get_flags().is_constant_operation ?
|
||||
static_cast<ConstantOperation *>(operation) :
|
||||
@@ -346,7 +346,7 @@ bool DebugInfo::graphviz_system(const ExecutionSystem *system, char *str, int ma
|
||||
for (NodeOperation *operation : system->operations_) {
|
||||
if (operation->get_flags().is_read_buffer_operation) {
|
||||
ReadBufferOperation *read = (ReadBufferOperation *)operation;
|
||||
WriteBufferOperation *write = read->getMemoryProxy()->getWriteBufferOperation();
|
||||
WriteBufferOperation *write = read->get_memory_proxy()->get_write_buffer_operation();
|
||||
std::vector<std::string> &read_groups = op_groups[read];
|
||||
std::vector<std::string> &write_groups = op_groups[write];
|
||||
|
||||
@@ -366,14 +366,14 @@ bool DebugInfo::graphviz_system(const ExecutionSystem *system, char *str, int ma
|
||||
|
||||
for (NodeOperation *op : system->operations_) {
|
||||
for (NodeOperationInput &to : op->inputs_) {
|
||||
NodeOperationOutput *from = to.getLink();
|
||||
NodeOperationOutput *from = to.get_link();
|
||||
|
||||
if (!from) {
|
||||
continue;
|
||||
}
|
||||
|
||||
std::string color;
|
||||
switch (from->getDataType()) {
|
||||
switch (from->get_data_type()) {
|
||||
case DataType::Value:
|
||||
color = "gray";
|
||||
break;
|
||||
@@ -385,8 +385,8 @@ bool DebugInfo::graphviz_system(const ExecutionSystem *system, char *str, int ma
|
||||
break;
|
||||
}
|
||||
|
||||
NodeOperation *to_op = &to.getOperation();
|
||||
NodeOperation *from_op = &from->getOperation();
|
||||
NodeOperation *to_op = &to.get_operation();
|
||||
NodeOperation *from_op = &from->get_operation();
|
||||
std::vector<std::string> &from_groups = op_groups[from_op];
|
||||
std::vector<std::string> &to_groups = op_groups[to_op];
|
||||
|
||||
@@ -416,7 +416,7 @@ bool DebugInfo::graphviz_system(const ExecutionSystem *system, char *str, int ma
|
||||
}
|
||||
}
|
||||
|
||||
const bool has_execution_groups = system->getContext().get_execution_model() ==
|
||||
const bool has_execution_groups = system->get_context().get_execution_model() ==
|
||||
eExecutionModel::Tiled &&
|
||||
system->groups_.size() > 0;
|
||||
len += graphviz_legend(str + len, maxlen > len ? maxlen - len : 0, has_execution_groups);
|
||||
@@ -460,8 +460,8 @@ static std::string get_operations_export_dir()
|
||||
|
||||
void DebugInfo::export_operation(const NodeOperation *op, MemoryBuffer *render)
|
||||
{
|
||||
const int width = render->getWidth();
|
||||
const int height = render->getHeight();
|
||||
const int width = render->get_width();
|
||||
const int height = render->get_height();
|
||||
const int num_channels = render->get_num_channels();
|
||||
|
||||
ImBuf *ibuf = IMB_allocImBuf(width, height, 8 * num_channels, IB_rectfloat);
|
||||
|
||||
@@ -89,7 +89,7 @@ class DebugInfo {
|
||||
static void node_added(const Node *node)
|
||||
{
|
||||
if (COM_EXPORT_GRAPHVIZ) {
|
||||
node_names_[node] = std::string(node->getbNode() ? node->getbNode()->name : "");
|
||||
node_names_[node] = std::string(node->get_bnode() ? node->get_bnode()->name : "");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -64,22 +64,22 @@ ExecutionGroup::ExecutionGroup(int id)
|
||||
y_chunks_len_ = 0;
|
||||
chunks_len_ = 0;
|
||||
chunks_finished_ = 0;
|
||||
BLI_rcti_init(&viewerBorder_, 0, 0, 0, 0);
|
||||
executionStartTime_ = 0;
|
||||
BLI_rcti_init(&viewer_border_, 0, 0, 0, 0);
|
||||
execution_start_time_ = 0;
|
||||
}
|
||||
|
||||
std::ostream &operator<<(std::ostream &os, const ExecutionGroup &execution_group)
|
||||
{
|
||||
os << "ExecutionGroup(id=" << execution_group.get_id();
|
||||
os << ",flags={" << execution_group.get_flags() << "}";
|
||||
os << ",operation=" << *execution_group.getOutputOperation() << "";
|
||||
os << ",operation=" << *execution_group.get_output_operation() << "";
|
||||
os << ")";
|
||||
return os;
|
||||
}
|
||||
|
||||
eCompositorPriority ExecutionGroup::getRenderPriority()
|
||||
eCompositorPriority ExecutionGroup::get_render_priority()
|
||||
{
|
||||
return this->getOutputOperation()->getRenderPriority();
|
||||
return this->get_output_operation()->get_render_priority();
|
||||
}
|
||||
|
||||
bool ExecutionGroup::can_contain(NodeOperation &operation)
|
||||
@@ -111,7 +111,7 @@ bool ExecutionGroup::can_contain(NodeOperation &operation)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ExecutionGroup::addOperation(NodeOperation *operation)
|
||||
bool ExecutionGroup::add_operation(NodeOperation *operation)
|
||||
{
|
||||
if (!can_contain(*operation)) {
|
||||
return false;
|
||||
@@ -130,7 +130,7 @@ bool ExecutionGroup::addOperation(NodeOperation *operation)
|
||||
return true;
|
||||
}
|
||||
|
||||
NodeOperation *ExecutionGroup::getOutputOperation() const
|
||||
NodeOperation *ExecutionGroup::get_output_operation() const
|
||||
{
|
||||
return this
|
||||
->operations_[0]; /* the first operation of the group is always the output operation. */
|
||||
@@ -146,7 +146,7 @@ void ExecutionGroup::init_work_packages()
|
||||
work_packages_[index].state = eWorkPackageState::NotScheduled;
|
||||
work_packages_[index].execution_group = this;
|
||||
work_packages_[index].chunk_number = index;
|
||||
determineChunkRect(&work_packages_[index].rect, index);
|
||||
determine_chunk_rect(&work_packages_[index].rect, index);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -156,23 +156,23 @@ void ExecutionGroup::init_read_buffer_operations()
|
||||
unsigned int max_offset = 0;
|
||||
for (NodeOperation *operation : operations_) {
|
||||
if (operation->get_flags().is_read_buffer_operation) {
|
||||
ReadBufferOperation *readOperation = static_cast<ReadBufferOperation *>(operation);
|
||||
read_operations_.append(readOperation);
|
||||
max_offset = MAX2(max_offset, readOperation->getOffset());
|
||||
ReadBufferOperation *read_operation = static_cast<ReadBufferOperation *>(operation);
|
||||
read_operations_.append(read_operation);
|
||||
max_offset = MAX2(max_offset, read_operation->get_offset());
|
||||
}
|
||||
}
|
||||
max_offset++;
|
||||
max_read_buffer_offset_ = max_offset;
|
||||
}
|
||||
|
||||
void ExecutionGroup::initExecution()
|
||||
void ExecutionGroup::init_execution()
|
||||
{
|
||||
init_number_of_chunks();
|
||||
init_work_packages();
|
||||
init_read_buffer_operations();
|
||||
}
|
||||
|
||||
void ExecutionGroup::deinitExecution()
|
||||
void ExecutionGroup::deinit_execution()
|
||||
{
|
||||
work_packages_.clear();
|
||||
chunks_len_ = 0;
|
||||
@@ -182,13 +182,13 @@ void ExecutionGroup::deinitExecution()
|
||||
bTree_ = nullptr;
|
||||
}
|
||||
|
||||
void ExecutionGroup::determineResolution(unsigned int resolution[2])
|
||||
void ExecutionGroup::determine_resolution(unsigned int resolution[2])
|
||||
{
|
||||
NodeOperation *operation = this->getOutputOperation();
|
||||
resolution[0] = operation->getWidth();
|
||||
resolution[1] = operation->getHeight();
|
||||
this->setResolution(resolution);
|
||||
BLI_rcti_init(&viewerBorder_, 0, width_, 0, height_);
|
||||
NodeOperation *operation = this->get_output_operation();
|
||||
resolution[0] = operation->get_width();
|
||||
resolution[1] = operation->get_height();
|
||||
this->set_resolution(resolution);
|
||||
BLI_rcti_init(&viewer_border_, 0, width_, 0, height_);
|
||||
}
|
||||
|
||||
void ExecutionGroup::init_number_of_chunks()
|
||||
@@ -199,11 +199,11 @@ void ExecutionGroup::init_number_of_chunks()
|
||||
chunks_len_ = 1;
|
||||
}
|
||||
else {
|
||||
const float chunkSizef = chunkSize_;
|
||||
const int border_width = BLI_rcti_size_x(&viewerBorder_);
|
||||
const int border_height = BLI_rcti_size_y(&viewerBorder_);
|
||||
x_chunks_len_ = ceil(border_width / chunkSizef);
|
||||
y_chunks_len_ = ceil(border_height / chunkSizef);
|
||||
const float chunk_sizef = chunk_size_;
|
||||
const int border_width = BLI_rcti_size_x(&viewer_border_);
|
||||
const int border_height = BLI_rcti_size_y(&viewer_border_);
|
||||
x_chunks_len_ = ceil(border_width / chunk_sizef);
|
||||
y_chunks_len_ = ceil(border_height / chunk_sizef);
|
||||
chunks_len_ = x_chunks_len_ * y_chunks_len_;
|
||||
}
|
||||
}
|
||||
@@ -215,7 +215,7 @@ blender::Array<unsigned int> ExecutionGroup::get_execution_order() const
|
||||
chunk_order[chunk_index] = chunk_index;
|
||||
}
|
||||
|
||||
NodeOperation *operation = this->getOutputOperation();
|
||||
NodeOperation *operation = this->get_output_operation();
|
||||
float centerX = 0.5f;
|
||||
float centerY = 0.5f;
|
||||
ChunkOrdering order_type = ChunkOrdering::Default;
|
||||
@@ -224,11 +224,11 @@ blender::Array<unsigned int> ExecutionGroup::get_execution_order() const
|
||||
ViewerOperation *viewer = (ViewerOperation *)operation;
|
||||
centerX = viewer->getCenterX();
|
||||
centerY = viewer->getCenterY();
|
||||
order_type = viewer->getChunkOrder();
|
||||
order_type = viewer->get_chunk_order();
|
||||
}
|
||||
|
||||
const int border_width = BLI_rcti_size_x(&viewerBorder_);
|
||||
const int border_height = BLI_rcti_size_y(&viewerBorder_);
|
||||
const int border_width = BLI_rcti_size_x(&viewer_border_);
|
||||
const int border_height = BLI_rcti_size_y(&viewer_border_);
|
||||
int index;
|
||||
switch (order_type) {
|
||||
case ChunkOrdering::Random: {
|
||||
@@ -245,8 +245,8 @@ blender::Array<unsigned int> ExecutionGroup::get_execution_order() const
|
||||
for (index = 0; index < chunks_len_; index++) {
|
||||
const WorkPackage &work_package = work_packages_[index];
|
||||
chunk_orders[index].index = index;
|
||||
chunk_orders[index].x = work_package.rect.xmin - viewerBorder_.xmin;
|
||||
chunk_orders[index].y = work_package.rect.ymin - viewerBorder_.ymin;
|
||||
chunk_orders[index].x = work_package.rect.xmin - viewer_border_.xmin;
|
||||
chunk_orders[index].y = work_package.rect.ymin - viewer_border_.ymin;
|
||||
chunk_orders[index].update_distance(&hotspot, 1);
|
||||
}
|
||||
|
||||
@@ -282,8 +282,8 @@ blender::Array<unsigned int> ExecutionGroup::get_execution_order() const
|
||||
for (index = 0; index < chunks_len_; index++) {
|
||||
const WorkPackage &work_package = work_packages_[index];
|
||||
chunk_orders[index].index = index;
|
||||
chunk_orders[index].x = work_package.rect.xmin - viewerBorder_.xmin;
|
||||
chunk_orders[index].y = work_package.rect.ymin - viewerBorder_.ymin;
|
||||
chunk_orders[index].x = work_package.rect.xmin - viewer_border_.xmin;
|
||||
chunk_orders[index].y = work_package.rect.ymin - viewer_border_.ymin;
|
||||
chunk_orders[index].update_distance(hotspots, 9);
|
||||
}
|
||||
|
||||
@@ -308,8 +308,8 @@ blender::Array<unsigned int> ExecutionGroup::get_execution_order() const
|
||||
*/
|
||||
void ExecutionGroup::execute(ExecutionSystem *graph)
|
||||
{
|
||||
const CompositorContext &context = graph->getContext();
|
||||
const bNodeTree *bTree = context.getbNodeTree();
|
||||
const CompositorContext &context = graph->get_context();
|
||||
const bNodeTree *bTree = context.get_bnodetree();
|
||||
if (width_ == 0 || height_ == 0) {
|
||||
return;
|
||||
} /** \note Break out... no pixels to calculate. */
|
||||
@@ -321,7 +321,7 @@ void ExecutionGroup::execute(ExecutionSystem *graph)
|
||||
} /** \note Early break out. */
|
||||
unsigned int chunk_index;
|
||||
|
||||
executionStartTime_ = PIL_check_seconds_timer();
|
||||
execution_start_time_ = PIL_check_seconds_timer();
|
||||
|
||||
chunks_finished_ = 0;
|
||||
bTree_ = bTree;
|
||||
@@ -333,26 +333,26 @@ void ExecutionGroup::execute(ExecutionSystem *graph)
|
||||
|
||||
bool breaked = false;
|
||||
bool finished = false;
|
||||
unsigned int startIndex = 0;
|
||||
const int maxNumberEvaluated = BLI_system_thread_count() * 2;
|
||||
unsigned int start_index = 0;
|
||||
const int max_number_evaluated = BLI_system_thread_count() * 2;
|
||||
|
||||
while (!finished && !breaked) {
|
||||
bool startEvaluated = false;
|
||||
bool start_evaluated = false;
|
||||
finished = true;
|
||||
int numberEvaluated = 0;
|
||||
int number_evaluated = 0;
|
||||
|
||||
for (int index = startIndex; index < chunks_len_ && numberEvaluated < maxNumberEvaluated;
|
||||
for (int index = start_index; index < chunks_len_ && number_evaluated < max_number_evaluated;
|
||||
index++) {
|
||||
chunk_index = chunk_order[index];
|
||||
int yChunk = chunk_index / x_chunks_len_;
|
||||
int xChunk = chunk_index - (yChunk * x_chunks_len_);
|
||||
int y_chunk = chunk_index / x_chunks_len_;
|
||||
int x_chunk = chunk_index - (y_chunk * x_chunks_len_);
|
||||
const WorkPackage &work_package = work_packages_[chunk_index];
|
||||
switch (work_package.state) {
|
||||
case eWorkPackageState::NotScheduled: {
|
||||
scheduleChunkWhenPossible(graph, xChunk, yChunk);
|
||||
schedule_chunk_when_possible(graph, x_chunk, y_chunk);
|
||||
finished = false;
|
||||
startEvaluated = true;
|
||||
numberEvaluated++;
|
||||
start_evaluated = true;
|
||||
number_evaluated++;
|
||||
|
||||
if (bTree->update_draw) {
|
||||
bTree->update_draw(bTree->udh);
|
||||
@@ -361,13 +361,13 @@ void ExecutionGroup::execute(ExecutionSystem *graph)
|
||||
}
|
||||
case eWorkPackageState::Scheduled: {
|
||||
finished = false;
|
||||
startEvaluated = true;
|
||||
numberEvaluated++;
|
||||
start_evaluated = true;
|
||||
number_evaluated++;
|
||||
break;
|
||||
}
|
||||
case eWorkPackageState::Executed: {
|
||||
if (!startEvaluated) {
|
||||
startIndex = index + 1;
|
||||
if (!start_evaluated) {
|
||||
start_index = index + 1;
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -383,51 +383,51 @@ void ExecutionGroup::execute(ExecutionSystem *graph)
|
||||
DebugInfo::graphviz(graph);
|
||||
}
|
||||
|
||||
MemoryBuffer **ExecutionGroup::getInputBuffersOpenCL(int chunkNumber)
|
||||
MemoryBuffer **ExecutionGroup::get_input_buffers_opencl(int chunk_number)
|
||||
{
|
||||
WorkPackage &work_package = work_packages_[chunkNumber];
|
||||
WorkPackage &work_package = work_packages_[chunk_number];
|
||||
|
||||
MemoryBuffer **memoryBuffers = (MemoryBuffer **)MEM_callocN(
|
||||
MemoryBuffer **memory_buffers = (MemoryBuffer **)MEM_callocN(
|
||||
sizeof(MemoryBuffer *) * max_read_buffer_offset_, __func__);
|
||||
rcti output;
|
||||
for (ReadBufferOperation *readOperation : read_operations_) {
|
||||
MemoryProxy *memoryProxy = readOperation->getMemoryProxy();
|
||||
this->determineDependingAreaOfInterest(&work_package.rect, readOperation, &output);
|
||||
MemoryBuffer *memoryBuffer = memoryProxy->getExecutor()->constructConsolidatedMemoryBuffer(
|
||||
*memoryProxy, output);
|
||||
memoryBuffers[readOperation->getOffset()] = memoryBuffer;
|
||||
for (ReadBufferOperation *read_operation : read_operations_) {
|
||||
MemoryProxy *memory_proxy = read_operation->get_memory_proxy();
|
||||
this->determine_depending_area_of_interest(&work_package.rect, read_operation, &output);
|
||||
MemoryBuffer *memory_buffer =
|
||||
memory_proxy->get_executor()->construct_consolidated_memory_buffer(*memory_proxy, output);
|
||||
memory_buffers[read_operation->get_offset()] = memory_buffer;
|
||||
}
|
||||
return memoryBuffers;
|
||||
return memory_buffers;
|
||||
}
|
||||
|
||||
MemoryBuffer *ExecutionGroup::constructConsolidatedMemoryBuffer(MemoryProxy &memoryProxy,
|
||||
rcti &rect)
|
||||
MemoryBuffer *ExecutionGroup::construct_consolidated_memory_buffer(MemoryProxy &memory_proxy,
|
||||
rcti &rect)
|
||||
{
|
||||
MemoryBuffer *imageBuffer = memoryProxy.getBuffer();
|
||||
MemoryBuffer *result = new MemoryBuffer(&memoryProxy, rect, MemoryBufferState::Temporary);
|
||||
result->fill_from(*imageBuffer);
|
||||
MemoryBuffer *image_buffer = memory_proxy.get_buffer();
|
||||
MemoryBuffer *result = new MemoryBuffer(&memory_proxy, rect, MemoryBufferState::Temporary);
|
||||
result->fill_from(*image_buffer);
|
||||
return result;
|
||||
}
|
||||
|
||||
void ExecutionGroup::finalizeChunkExecution(int chunkNumber, MemoryBuffer **memoryBuffers)
|
||||
void ExecutionGroup::finalize_chunk_execution(int chunk_number, MemoryBuffer **memory_buffers)
|
||||
{
|
||||
WorkPackage &work_package = work_packages_[chunkNumber];
|
||||
WorkPackage &work_package = work_packages_[chunk_number];
|
||||
if (work_package.state == eWorkPackageState::Scheduled) {
|
||||
work_package.state = eWorkPackageState::Executed;
|
||||
}
|
||||
|
||||
atomic_add_and_fetch_u(&chunks_finished_, 1);
|
||||
if (memoryBuffers) {
|
||||
if (memory_buffers) {
|
||||
for (unsigned int index = 0; index < max_read_buffer_offset_; index++) {
|
||||
MemoryBuffer *buffer = memoryBuffers[index];
|
||||
MemoryBuffer *buffer = memory_buffers[index];
|
||||
if (buffer) {
|
||||
if (buffer->isTemporarily()) {
|
||||
memoryBuffers[index] = nullptr;
|
||||
if (buffer->is_temporarily()) {
|
||||
memory_buffers[index] = nullptr;
|
||||
delete buffer;
|
||||
}
|
||||
}
|
||||
}
|
||||
MEM_freeN(memoryBuffers);
|
||||
MEM_freeN(memory_buffers);
|
||||
}
|
||||
if (bTree_) {
|
||||
/* Status report is only performed for top level Execution Groups. */
|
||||
@@ -442,67 +442,67 @@ void ExecutionGroup::finalizeChunkExecution(int chunkNumber, MemoryBuffer **memo
|
||||
}
|
||||
}
|
||||
|
||||
inline void ExecutionGroup::determineChunkRect(rcti *r_rect,
|
||||
const unsigned int xChunk,
|
||||
const unsigned int yChunk) const
|
||||
inline void ExecutionGroup::determine_chunk_rect(rcti *r_rect,
|
||||
const unsigned int x_chunk,
|
||||
const unsigned int y_chunk) const
|
||||
{
|
||||
const int border_width = BLI_rcti_size_x(&viewerBorder_);
|
||||
const int border_height = BLI_rcti_size_y(&viewerBorder_);
|
||||
const int border_width = BLI_rcti_size_x(&viewer_border_);
|
||||
const int border_height = BLI_rcti_size_y(&viewer_border_);
|
||||
|
||||
if (flags_.single_threaded) {
|
||||
BLI_rcti_init(r_rect, viewerBorder_.xmin, border_width, viewerBorder_.ymin, border_height);
|
||||
BLI_rcti_init(r_rect, viewer_border_.xmin, border_width, viewer_border_.ymin, border_height);
|
||||
}
|
||||
else {
|
||||
const unsigned int minx = xChunk * chunkSize_ + viewerBorder_.xmin;
|
||||
const unsigned int miny = yChunk * chunkSize_ + viewerBorder_.ymin;
|
||||
const unsigned int width = MIN2((unsigned int)viewerBorder_.xmax, width_);
|
||||
const unsigned int height = MIN2((unsigned int)viewerBorder_.ymax, height_);
|
||||
const unsigned int minx = x_chunk * chunk_size_ + viewer_border_.xmin;
|
||||
const unsigned int miny = y_chunk * chunk_size_ + viewer_border_.ymin;
|
||||
const unsigned int width = MIN2((unsigned int)viewer_border_.xmax, width_);
|
||||
const unsigned int height = MIN2((unsigned int)viewer_border_.ymax, height_);
|
||||
BLI_rcti_init(r_rect,
|
||||
MIN2(minx, width_),
|
||||
MIN2(minx + chunkSize_, width),
|
||||
MIN2(minx + chunk_size_, width),
|
||||
MIN2(miny, height_),
|
||||
MIN2(miny + chunkSize_, height));
|
||||
MIN2(miny + chunk_size_, height));
|
||||
}
|
||||
}
|
||||
|
||||
void ExecutionGroup::determineChunkRect(rcti *r_rect, const unsigned int chunkNumber) const
|
||||
void ExecutionGroup::determine_chunk_rect(rcti *r_rect, const unsigned int chunk_number) const
|
||||
{
|
||||
const unsigned int yChunk = chunkNumber / x_chunks_len_;
|
||||
const unsigned int xChunk = chunkNumber - (yChunk * x_chunks_len_);
|
||||
determineChunkRect(r_rect, xChunk, yChunk);
|
||||
const unsigned int y_chunk = chunk_number / x_chunks_len_;
|
||||
const unsigned int x_chunk = chunk_number - (y_chunk * x_chunks_len_);
|
||||
determine_chunk_rect(r_rect, x_chunk, y_chunk);
|
||||
}
|
||||
|
||||
MemoryBuffer *ExecutionGroup::allocateOutputBuffer(rcti &rect)
|
||||
MemoryBuffer *ExecutionGroup::allocate_output_buffer(rcti &rect)
|
||||
{
|
||||
/* We assume that this method is only called from complex execution groups. */
|
||||
NodeOperation *operation = this->getOutputOperation();
|
||||
NodeOperation *operation = this->get_output_operation();
|
||||
if (operation->get_flags().is_write_buffer_operation) {
|
||||
WriteBufferOperation *writeOperation = (WriteBufferOperation *)operation;
|
||||
WriteBufferOperation *write_operation = (WriteBufferOperation *)operation;
|
||||
MemoryBuffer *buffer = new MemoryBuffer(
|
||||
writeOperation->getMemoryProxy(), rect, MemoryBufferState::Temporary);
|
||||
write_operation->get_memory_proxy(), rect, MemoryBufferState::Temporary);
|
||||
return buffer;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool ExecutionGroup::scheduleAreaWhenPossible(ExecutionSystem *graph, rcti *area)
|
||||
bool ExecutionGroup::schedule_area_when_possible(ExecutionSystem *graph, rcti *area)
|
||||
{
|
||||
if (flags_.single_threaded) {
|
||||
return scheduleChunkWhenPossible(graph, 0, 0);
|
||||
return schedule_chunk_when_possible(graph, 0, 0);
|
||||
}
|
||||
/* Find all chunks inside the rect
|
||||
* determine `minxchunk`, `minychunk`, `maxxchunk`, `maxychunk`
|
||||
* where x and y are chunk-numbers. */
|
||||
|
||||
int indexx, indexy;
|
||||
int minx = max_ii(area->xmin - viewerBorder_.xmin, 0);
|
||||
int maxx = min_ii(area->xmax - viewerBorder_.xmin, viewerBorder_.xmax - viewerBorder_.xmin);
|
||||
int miny = max_ii(area->ymin - viewerBorder_.ymin, 0);
|
||||
int maxy = min_ii(area->ymax - viewerBorder_.ymin, viewerBorder_.ymax - viewerBorder_.ymin);
|
||||
int minxchunk = minx / (int)chunkSize_;
|
||||
int maxxchunk = (maxx + (int)chunkSize_ - 1) / (int)chunkSize_;
|
||||
int minychunk = miny / (int)chunkSize_;
|
||||
int maxychunk = (maxy + (int)chunkSize_ - 1) / (int)chunkSize_;
|
||||
int minx = max_ii(area->xmin - viewer_border_.xmin, 0);
|
||||
int maxx = min_ii(area->xmax - viewer_border_.xmin, viewer_border_.xmax - viewer_border_.xmin);
|
||||
int miny = max_ii(area->ymin - viewer_border_.ymin, 0);
|
||||
int maxy = min_ii(area->ymax - viewer_border_.ymin, viewer_border_.ymax - viewer_border_.ymin);
|
||||
int minxchunk = minx / (int)chunk_size_;
|
||||
int maxxchunk = (maxx + (int)chunk_size_ - 1) / (int)chunk_size_;
|
||||
int minychunk = miny / (int)chunk_size_;
|
||||
int maxychunk = (maxy + (int)chunk_size_ - 1) / (int)chunk_size_;
|
||||
minxchunk = max_ii(minxchunk, 0);
|
||||
minychunk = max_ii(minychunk, 0);
|
||||
maxxchunk = min_ii(maxxchunk, (int)x_chunks_len_);
|
||||
@@ -511,7 +511,7 @@ bool ExecutionGroup::scheduleAreaWhenPossible(ExecutionSystem *graph, rcti *area
|
||||
bool result = true;
|
||||
for (indexx = minxchunk; indexx < maxxchunk; indexx++) {
|
||||
for (indexy = minychunk; indexy < maxychunk; indexy++) {
|
||||
if (!scheduleChunkWhenPossible(graph, indexx, indexy)) {
|
||||
if (!schedule_chunk_when_possible(graph, indexx, indexy)) {
|
||||
result = false;
|
||||
}
|
||||
}
|
||||
@@ -520,9 +520,9 @@ bool ExecutionGroup::scheduleAreaWhenPossible(ExecutionSystem *graph, rcti *area
|
||||
return result;
|
||||
}
|
||||
|
||||
bool ExecutionGroup::scheduleChunk(unsigned int chunkNumber)
|
||||
bool ExecutionGroup::schedule_chunk(unsigned int chunk_number)
|
||||
{
|
||||
WorkPackage &work_package = work_packages_[chunkNumber];
|
||||
WorkPackage &work_package = work_packages_[chunk_number];
|
||||
if (work_package.state == eWorkPackageState::NotScheduled) {
|
||||
work_package.state = eWorkPackageState::Scheduled;
|
||||
WorkScheduler::schedule(&work_package);
|
||||
@@ -531,9 +531,9 @@ bool ExecutionGroup::scheduleChunk(unsigned int chunkNumber)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ExecutionGroup::scheduleChunkWhenPossible(ExecutionSystem *graph,
|
||||
const int chunk_x,
|
||||
const int chunk_y)
|
||||
bool ExecutionGroup::schedule_chunk_when_possible(ExecutionSystem *graph,
|
||||
const int chunk_x,
|
||||
const int chunk_y)
|
||||
{
|
||||
if (chunk_x < 0 || chunk_x >= (int)x_chunks_len_) {
|
||||
return true;
|
||||
@@ -557,42 +557,43 @@ bool ExecutionGroup::scheduleChunkWhenPossible(ExecutionSystem *graph,
|
||||
|
||||
for (ReadBufferOperation *read_operation : read_operations_) {
|
||||
BLI_rcti_init(&area, 0, 0, 0, 0);
|
||||
MemoryProxy *memory_proxy = read_operation->getMemoryProxy();
|
||||
determineDependingAreaOfInterest(&work_package.rect, read_operation, &area);
|
||||
ExecutionGroup *group = memory_proxy->getExecutor();
|
||||
MemoryProxy *memory_proxy = read_operation->get_memory_proxy();
|
||||
determine_depending_area_of_interest(&work_package.rect, read_operation, &area);
|
||||
ExecutionGroup *group = memory_proxy->get_executor();
|
||||
|
||||
if (!group->scheduleAreaWhenPossible(graph, &area)) {
|
||||
if (!group->schedule_area_when_possible(graph, &area)) {
|
||||
can_be_executed = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (can_be_executed) {
|
||||
scheduleChunk(chunk_index);
|
||||
schedule_chunk(chunk_index);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void ExecutionGroup::determineDependingAreaOfInterest(rcti *input,
|
||||
ReadBufferOperation *readOperation,
|
||||
rcti *output)
|
||||
void ExecutionGroup::determine_depending_area_of_interest(rcti *input,
|
||||
ReadBufferOperation *read_operation,
|
||||
rcti *output)
|
||||
{
|
||||
this->getOutputOperation()->determineDependingAreaOfInterest(input, readOperation, output);
|
||||
this->get_output_operation()->determine_depending_area_of_interest(
|
||||
input, read_operation, output);
|
||||
}
|
||||
|
||||
void ExecutionGroup::setViewerBorder(float xmin, float xmax, float ymin, float ymax)
|
||||
void ExecutionGroup::set_viewer_border(float xmin, float xmax, float ymin, float ymax)
|
||||
{
|
||||
const NodeOperation &operation = *this->getOutputOperation();
|
||||
const NodeOperation &operation = *this->get_output_operation();
|
||||
if (operation.get_flags().use_viewer_border) {
|
||||
BLI_rcti_init(&viewerBorder_, xmin * width_, xmax * width_, ymin * height_, ymax * height_);
|
||||
BLI_rcti_init(&viewer_border_, xmin * width_, xmax * width_, ymin * height_, ymax * height_);
|
||||
}
|
||||
}
|
||||
|
||||
void ExecutionGroup::setRenderBorder(float xmin, float xmax, float ymin, float ymax)
|
||||
void ExecutionGroup::set_render_border(float xmin, float xmax, float ymin, float ymax)
|
||||
{
|
||||
const NodeOperation &operation = *this->getOutputOperation();
|
||||
if (operation.isOutputOperation(true) && operation.get_flags().use_render_border) {
|
||||
BLI_rcti_init(&viewerBorder_, xmin * width_, xmax * width_, ymin * height_, ymax * height_);
|
||||
const NodeOperation &operation = *this->get_output_operation();
|
||||
if (operation.is_output_operation(true) && operation.get_flags().use_render_border) {
|
||||
BLI_rcti_init(&viewer_border_, xmin * width_, xmax * width_, ymin * height_, ymax * height_);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -109,7 +109,7 @@ class ExecutionGroup {
|
||||
* \brief size of a single chunk, being Width or of height
|
||||
* a chunk is always a square, except at the edges of the MemoryBuffer
|
||||
*/
|
||||
unsigned int chunkSize_;
|
||||
unsigned int chunk_size_;
|
||||
|
||||
/**
|
||||
* \brief number of chunks in the x-axis
|
||||
@@ -158,12 +158,12 @@ class ExecutionGroup {
|
||||
* \brief denotes boundary for border compositing
|
||||
* \note measured in pixel space
|
||||
*/
|
||||
rcti viewerBorder_;
|
||||
rcti viewer_border_;
|
||||
|
||||
/**
|
||||
* \brief start time of execution
|
||||
*/
|
||||
double executionStartTime_;
|
||||
double execution_start_time_;
|
||||
|
||||
// methods
|
||||
/**
|
||||
@@ -175,13 +175,14 @@ class ExecutionGroup {
|
||||
/**
|
||||
* \brief Determine the rect (minx, maxx, miny, maxy) of a chunk at a position.
|
||||
*/
|
||||
void determineChunkRect(rcti *r_rect,
|
||||
const unsigned int xChunk,
|
||||
const unsigned int yChunk) const;
|
||||
void determine_chunk_rect(rcti *r_rect,
|
||||
const unsigned int x_chunk,
|
||||
const unsigned int y_chunk) const;
|
||||
|
||||
/**
|
||||
* \brief determine the number of chunks, based on the chunkSize, width and height.
|
||||
* \note The result are stored in the fields numberOfChunks, numberOfXChunks, numberOfYChunks
|
||||
* \brief determine the number of chunks, based on the chunk_size, width and height.
|
||||
* \note The result are stored in the fields number_of_chunks, number_of_xchunks,
|
||||
* number_of_ychunks
|
||||
*/
|
||||
void init_number_of_chunks();
|
||||
|
||||
@@ -190,13 +191,13 @@ class ExecutionGroup {
|
||||
* \note scheduling succeeds when all input requirements are met and the chunks hasn't been
|
||||
* scheduled yet.
|
||||
* \param graph:
|
||||
* \param xChunk:
|
||||
* \param yChunk:
|
||||
* \param x_chunk:
|
||||
* \param y_chunk:
|
||||
* \return [true:false]
|
||||
* true: package(s) are scheduled
|
||||
* false: scheduling is deferred (depending workpackages are scheduled)
|
||||
*/
|
||||
bool scheduleChunkWhenPossible(ExecutionSystem *graph, const int chunk_x, const int chunk_y);
|
||||
bool schedule_chunk_when_possible(ExecutionSystem *graph, const int chunk_x, const int chunk_y);
|
||||
|
||||
/**
|
||||
* \brief try to schedule a specific area.
|
||||
@@ -208,24 +209,24 @@ class ExecutionGroup {
|
||||
* true: package(s) are scheduled
|
||||
* false: scheduling is deferred (depending workpackages are scheduled)
|
||||
*/
|
||||
bool scheduleAreaWhenPossible(ExecutionSystem *graph, rcti *area);
|
||||
bool schedule_area_when_possible(ExecutionSystem *graph, rcti *area);
|
||||
|
||||
/**
|
||||
* \brief add a chunk to the WorkScheduler.
|
||||
* \param chunknumber:
|
||||
*/
|
||||
bool scheduleChunk(unsigned int chunkNumber);
|
||||
bool schedule_chunk(unsigned int chunk_number);
|
||||
|
||||
/**
|
||||
* \brief determine the area of interest of a certain input area
|
||||
* \note This method only evaluates a single ReadBufferOperation
|
||||
* \param input: the input area
|
||||
* \param readOperation: The ReadBufferOperation where the area needs to be evaluated
|
||||
* \param read_operation: The ReadBufferOperation where the area needs to be evaluated
|
||||
* \param output: the area needed of the ReadBufferOperation. Result
|
||||
*/
|
||||
void determineDependingAreaOfInterest(rcti *input,
|
||||
ReadBufferOperation *readOperation,
|
||||
rcti *output);
|
||||
void determine_depending_area_of_interest(rcti *input,
|
||||
ReadBufferOperation *read_operation,
|
||||
rcti *output);
|
||||
|
||||
/**
|
||||
* Return the execution order of the user visible chunks.
|
||||
@@ -258,13 +259,13 @@ class ExecutionGroup {
|
||||
* \param operation:
|
||||
* \return True if the operation was successfully added
|
||||
*/
|
||||
bool addOperation(NodeOperation *operation);
|
||||
bool add_operation(NodeOperation *operation);
|
||||
|
||||
/**
|
||||
* \brief set whether this ExecutionGroup is an output
|
||||
* \param isOutput:
|
||||
* \param is_output:
|
||||
*/
|
||||
void setOutputExecutionGroup(bool is_output)
|
||||
void set_output_execution_group(bool is_output)
|
||||
{
|
||||
flags_.is_output = is_output;
|
||||
}
|
||||
@@ -273,13 +274,13 @@ class ExecutionGroup {
|
||||
* \brief determine the resolution of this ExecutionGroup
|
||||
* \param resolution:
|
||||
*/
|
||||
void determineResolution(unsigned int resolution[2]);
|
||||
void determine_resolution(unsigned int resolution[2]);
|
||||
|
||||
/**
|
||||
* \brief set the resolution of this executiongroup
|
||||
* \param resolution:
|
||||
*/
|
||||
void setResolution(unsigned int resolution[2])
|
||||
void set_resolution(unsigned int resolution[2])
|
||||
{
|
||||
width_ = resolution[0];
|
||||
height_ = resolution[1];
|
||||
@@ -288,7 +289,7 @@ class ExecutionGroup {
|
||||
/**
|
||||
* \brief get the width of this execution group
|
||||
*/
|
||||
unsigned int getWidth() const
|
||||
unsigned int get_width() const
|
||||
{
|
||||
return width_;
|
||||
}
|
||||
@@ -296,7 +297,7 @@ class ExecutionGroup {
|
||||
/**
|
||||
* \brief get the height of this execution group
|
||||
*/
|
||||
unsigned int getHeight() const
|
||||
unsigned int get_height() const
|
||||
{
|
||||
return height_;
|
||||
}
|
||||
@@ -305,24 +306,24 @@ class ExecutionGroup {
|
||||
* \brief get the output operation of this ExecutionGroup
|
||||
* \return NodeOperation *output operation
|
||||
*/
|
||||
NodeOperation *getOutputOperation() const;
|
||||
NodeOperation *get_output_operation() const;
|
||||
|
||||
/**
|
||||
* \brief compose multiple chunks into a single chunk
|
||||
* \return Memorybuffer *consolidated chunk
|
||||
*/
|
||||
MemoryBuffer *constructConsolidatedMemoryBuffer(MemoryProxy &memoryProxy, rcti &rect);
|
||||
MemoryBuffer *construct_consolidated_memory_buffer(MemoryProxy &memory_proxy, rcti &rect);
|
||||
|
||||
/**
|
||||
* \brief initExecution is called just before the execution of the whole graph will be done.
|
||||
* \note The implementation will calculate the chunkSize of this execution group.
|
||||
* \brief init_execution is called just before the execution of the whole graph will be done.
|
||||
* \note The implementation will calculate the chunk_size of this execution group.
|
||||
*/
|
||||
void initExecution();
|
||||
void init_execution();
|
||||
|
||||
/**
|
||||
* \brief get all inputbuffers needed to calculate an chunk
|
||||
* \note all inputbuffers must be executed
|
||||
* \param chunkNumber: the chunk to be calculated
|
||||
* \param chunk_number: the chunk to be calculated
|
||||
* \return (MemoryBuffer **) the inputbuffers
|
||||
*/
|
||||
MemoryBuffer **getInputBuffersCPU();
|
||||
@@ -330,31 +331,31 @@ class ExecutionGroup {
|
||||
/**
|
||||
* \brief get all inputbuffers needed to calculate an chunk
|
||||
* \note all inputbuffers must be executed
|
||||
* \param chunkNumber: the chunk to be calculated
|
||||
* \param chunk_number: the chunk to be calculated
|
||||
* \return (MemoryBuffer **) the inputbuffers
|
||||
*/
|
||||
MemoryBuffer **getInputBuffersOpenCL(int chunkNumber);
|
||||
MemoryBuffer **get_input_buffers_opencl(int chunk_number);
|
||||
|
||||
/**
|
||||
* \brief allocate the outputbuffer of a chunk
|
||||
* \param chunkNumber: the number of the chunk in the ExecutionGroup
|
||||
* \param chunk_number: the number of the chunk in the ExecutionGroup
|
||||
* \param rect: the rect of that chunk
|
||||
* \see determineChunkRect
|
||||
* \see determine_chunk_rect
|
||||
*/
|
||||
MemoryBuffer *allocateOutputBuffer(rcti &rect);
|
||||
MemoryBuffer *allocate_output_buffer(rcti &rect);
|
||||
|
||||
/**
|
||||
* \brief after a chunk is executed the needed resources can be freed or unlocked.
|
||||
* \param chunknumber:
|
||||
* \param memorybuffers:
|
||||
*/
|
||||
void finalizeChunkExecution(int chunkNumber, MemoryBuffer **memoryBuffers);
|
||||
void finalize_chunk_execution(int chunk_number, MemoryBuffer **memory_buffers);
|
||||
|
||||
/**
|
||||
* \brief deinitExecution is called just after execution the whole graph.
|
||||
* \brief deinit_execution is called just after execution the whole graph.
|
||||
* \note It will release all needed resources
|
||||
*/
|
||||
void deinitExecution();
|
||||
void deinit_execution();
|
||||
|
||||
/**
|
||||
* \brief schedule an ExecutionGroup
|
||||
@@ -377,26 +378,26 @@ class ExecutionGroup {
|
||||
/**
|
||||
* \brief Determine the rect (minx, maxx, miny, maxy) of a chunk.
|
||||
*/
|
||||
void determineChunkRect(rcti *r_rect, const unsigned int chunkNumber) const;
|
||||
void determine_chunk_rect(rcti *r_rect, const unsigned int chunk_number) const;
|
||||
|
||||
void setChunksize(int chunksize)
|
||||
void set_chunksize(int chunksize)
|
||||
{
|
||||
chunkSize_ = chunksize;
|
||||
chunk_size_ = chunksize;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief get the Render priority of this ExecutionGroup
|
||||
* \see ExecutionSystem.execute
|
||||
*/
|
||||
eCompositorPriority getRenderPriority();
|
||||
eCompositorPriority get_render_priority();
|
||||
|
||||
/**
|
||||
* \brief set border for viewer operation
|
||||
* \note all the coordinates are assumed to be in normalized space
|
||||
*/
|
||||
void setViewerBorder(float xmin, float xmax, float ymin, float ymax);
|
||||
void set_viewer_border(float xmin, float xmax, float ymin, float ymax);
|
||||
|
||||
void setRenderBorder(float xmin, float xmax, float ymin, float ymax);
|
||||
void set_render_border(float xmin, float xmax, float ymin, float ymax);
|
||||
|
||||
/* allow the DebugInfo class to look at internals */
|
||||
friend class DebugInfo;
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace blender::compositor {
|
||||
ExecutionModel::ExecutionModel(CompositorContext &context, Span<NodeOperation *> operations)
|
||||
: context_(context), operations_(operations)
|
||||
{
|
||||
const bNodeTree *node_tree = context_.getbNodeTree();
|
||||
const bNodeTree *node_tree = context_.get_bnodetree();
|
||||
|
||||
const rctf *viewer_border = &node_tree->viewer_border;
|
||||
border_.use_viewer_border = (node_tree->flag & NTREE_VIEWER_BORDER) &&
|
||||
@@ -32,10 +32,10 @@ ExecutionModel::ExecutionModel(CompositorContext &context, Span<NodeOperation *>
|
||||
viewer_border->ymin < viewer_border->ymax;
|
||||
border_.viewer_border = viewer_border;
|
||||
|
||||
const RenderData *rd = context_.getRenderData();
|
||||
const RenderData *rd = context_.get_render_data();
|
||||
/* Case when cropping to render border happens is handled in
|
||||
* compositor output and render layer nodes. */
|
||||
border_.use_render_border = context.isRendering() && (rd->mode & R_BORDER) &&
|
||||
border_.use_render_border = context.is_rendering() && (rd->mode & R_BORDER) &&
|
||||
!(rd->mode & R_CROP);
|
||||
border_.render_border = &rd->border;
|
||||
}
|
||||
|
||||
@@ -38,37 +38,37 @@ ExecutionSystem::ExecutionSystem(RenderData *rd,
|
||||
bNodeTree *editingtree,
|
||||
bool rendering,
|
||||
bool fastcalculation,
|
||||
const ColorManagedViewSettings *viewSettings,
|
||||
const ColorManagedDisplaySettings *displaySettings,
|
||||
const char *viewName)
|
||||
const ColorManagedViewSettings *view_settings,
|
||||
const ColorManagedDisplaySettings *display_settings,
|
||||
const char *view_name)
|
||||
{
|
||||
num_work_threads_ = WorkScheduler::get_num_cpu_threads();
|
||||
context_.setViewName(viewName);
|
||||
context_.setScene(scene);
|
||||
context_.setbNodeTree(editingtree);
|
||||
context_.setPreviewHash(editingtree->previews);
|
||||
context_.setFastCalculation(fastcalculation);
|
||||
context_.set_view_name(view_name);
|
||||
context_.set_scene(scene);
|
||||
context_.set_bnodetree(editingtree);
|
||||
context_.set_preview_hash(editingtree->previews);
|
||||
context_.set_fast_calculation(fastcalculation);
|
||||
/* initialize the CompositorContext */
|
||||
if (rendering) {
|
||||
context_.setQuality((eCompositorQuality)editingtree->render_quality);
|
||||
context_.set_quality((eCompositorQuality)editingtree->render_quality);
|
||||
}
|
||||
else {
|
||||
context_.setQuality((eCompositorQuality)editingtree->edit_quality);
|
||||
context_.set_quality((eCompositorQuality)editingtree->edit_quality);
|
||||
}
|
||||
context_.setRendering(rendering);
|
||||
context_.set_rendering(rendering);
|
||||
context_.setHasActiveOpenCLDevices(WorkScheduler::has_gpu_devices() &&
|
||||
(editingtree->flag & NTREE_COM_OPENCL));
|
||||
|
||||
context_.setRenderData(rd);
|
||||
context_.setViewSettings(viewSettings);
|
||||
context_.setDisplaySettings(displaySettings);
|
||||
context_.set_render_data(rd);
|
||||
context_.set_view_settings(view_settings);
|
||||
context_.set_display_settings(display_settings);
|
||||
|
||||
BLI_mutex_init(&work_mutex_);
|
||||
BLI_condition_init(&work_finished_cond_);
|
||||
|
||||
{
|
||||
NodeOperationBuilder builder(&context_, editingtree, this);
|
||||
builder.convertToOperations(this);
|
||||
builder.convert_to_operations(this);
|
||||
}
|
||||
|
||||
switch (context_.get_execution_model()) {
|
||||
@@ -184,7 +184,7 @@ void ExecutionSystem::execute_work(const rcti &work_rect,
|
||||
|
||||
bool ExecutionSystem::is_breaked() const
|
||||
{
|
||||
const bNodeTree *btree = context_.getbNodeTree();
|
||||
const bNodeTree *btree = context_.get_bnodetree();
|
||||
return btree->test_break(btree->tbh);
|
||||
}
|
||||
|
||||
|
||||
@@ -64,8 +64,8 @@ namespace blender::compositor {
|
||||
* based on settings; like MixNode. based on the selected Mixtype a different operation will be
|
||||
* used. for more information see the page about creating new Nodes. [@subpage newnode]
|
||||
*
|
||||
* \see ExecutionSystem.convertToOperations
|
||||
* \see Node.convertToOperations
|
||||
* \see ExecutionSystem.convert_to_operations
|
||||
* \see Node.convert_to_operations
|
||||
* \see NodeOperation base class for all operations in the system
|
||||
*
|
||||
* \section EM_Step3 Step3: add additional conversions to the operation system
|
||||
@@ -89,7 +89,7 @@ namespace blender::compositor {
|
||||
* Bottom left of the images are aligned.
|
||||
*
|
||||
* \see COM_convert_data_type Datatype conversions
|
||||
* \see Converter.convertResolution Image size conversions
|
||||
* \see Converter.convert_resolution Image size conversions
|
||||
*
|
||||
* \section EM_Step4 Step4: group operations in executions groups
|
||||
* ExecutionGroup are groups of operations that are calculated as being one bigger operation.
|
||||
@@ -112,9 +112,9 @@ namespace blender::compositor {
|
||||
* |cFAA | |cFAA | |cFAA | |cFAA |
|
||||
* +------+ +------+ +-------+ +-------+
|
||||
* </pre>
|
||||
* \see ExecutionSystem.groupOperations method doing this step
|
||||
* \see ExecutionSystem.addReadWriteBufferOperations
|
||||
* \see NodeOperation.isComplex
|
||||
* \see ExecutionSystem.group_operations method doing this step
|
||||
* \see ExecutionSystem.add_read_write_buffer_operations
|
||||
* \see NodeOperation.is_complex
|
||||
* \see ExecutionGroup class representing the ExecutionGroup
|
||||
*/
|
||||
|
||||
@@ -175,9 +175,9 @@ class ExecutionSystem {
|
||||
bNodeTree *editingtree,
|
||||
bool rendering,
|
||||
bool fastcalculation,
|
||||
const ColorManagedViewSettings *viewSettings,
|
||||
const ColorManagedDisplaySettings *displaySettings,
|
||||
const char *viewName);
|
||||
const ColorManagedViewSettings *view_settings,
|
||||
const ColorManagedDisplaySettings *display_settings,
|
||||
const char *view_name);
|
||||
|
||||
/**
|
||||
* Destructor
|
||||
@@ -198,7 +198,7 @@ class ExecutionSystem {
|
||||
/**
|
||||
* \brief get the reference to the compositor context
|
||||
*/
|
||||
const CompositorContext &getContext() const
|
||||
const CompositorContext &get_context() const
|
||||
{
|
||||
return context_;
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ FullFrameExecutionModel::FullFrameExecutionModel(CompositorContext &context,
|
||||
num_operations_finished_(0)
|
||||
{
|
||||
priorities_.append(eCompositorPriority::High);
|
||||
if (!context.isFastCalculation()) {
|
||||
if (!context.is_fast_calculation()) {
|
||||
priorities_.append(eCompositorPriority::Medium);
|
||||
priorities_.append(eCompositorPriority::Low);
|
||||
}
|
||||
@@ -46,7 +46,7 @@ FullFrameExecutionModel::FullFrameExecutionModel(CompositorContext &context,
|
||||
|
||||
void FullFrameExecutionModel::execute(ExecutionSystem &exec_system)
|
||||
{
|
||||
const bNodeTree *node_tree = this->context_.getbNodeTree();
|
||||
const bNodeTree *node_tree = this->context_.get_bnodetree();
|
||||
node_tree->stats_draw(node_tree->sdh, TIP_("Compositing | Initializing execution"));
|
||||
|
||||
DebugInfo::graphviz(&exec_system, "compositor_prior_rendering");
|
||||
@@ -57,14 +57,14 @@ void FullFrameExecutionModel::execute(ExecutionSystem &exec_system)
|
||||
|
||||
void FullFrameExecutionModel::determine_areas_to_render_and_reads()
|
||||
{
|
||||
const bool is_rendering = context_.isRendering();
|
||||
const bNodeTree *node_tree = context_.getbNodeTree();
|
||||
const bool is_rendering = context_.is_rendering();
|
||||
const bNodeTree *node_tree = context_.get_bnodetree();
|
||||
|
||||
rcti area;
|
||||
for (eCompositorPriority priority : priorities_) {
|
||||
for (NodeOperation *op : operations_) {
|
||||
op->setbNodeTree(node_tree);
|
||||
if (op->isOutputOperation(is_rendering) && op->getRenderPriority() == priority) {
|
||||
op->set_bnodetree(node_tree);
|
||||
if (op->is_output_operation(is_rendering) && op->get_render_priority() == priority) {
|
||||
get_output_render_area(op, area);
|
||||
determine_areas_to_render(op, area);
|
||||
determine_reads(op);
|
||||
@@ -81,7 +81,7 @@ Vector<MemoryBuffer *> FullFrameExecutionModel::get_input_buffers(NodeOperation
|
||||
const int output_x,
|
||||
const int output_y)
|
||||
{
|
||||
const int num_inputs = op->getNumberOfInputSockets();
|
||||
const int num_inputs = op->get_number_of_input_sockets();
|
||||
Vector<MemoryBuffer *> inputs_buffers(num_inputs);
|
||||
for (int i = 0; i < num_inputs; i++) {
|
||||
NodeOperation *input = op->get_input_operation(i);
|
||||
@@ -92,7 +92,7 @@ Vector<MemoryBuffer *> FullFrameExecutionModel::get_input_buffers(NodeOperation
|
||||
rcti rect = buf->get_rect();
|
||||
BLI_rcti_translate(&rect, offset_x, offset_y);
|
||||
inputs_buffers[i] = new MemoryBuffer(
|
||||
buf->getBuffer(), buf->get_num_channels(), rect, buf->is_a_single_elem());
|
||||
buf->get_buffer(), buf->get_num_channels(), rect, buf->is_a_single_elem());
|
||||
}
|
||||
return inputs_buffers;
|
||||
}
|
||||
@@ -102,9 +102,10 @@ MemoryBuffer *FullFrameExecutionModel::create_operation_buffer(NodeOperation *op
|
||||
const int output_y)
|
||||
{
|
||||
rcti rect;
|
||||
BLI_rcti_init(&rect, output_x, output_x + op->getWidth(), output_y, output_y + op->getHeight());
|
||||
BLI_rcti_init(
|
||||
&rect, output_x, output_x + op->get_width(), output_y, output_y + op->get_height());
|
||||
|
||||
const DataType data_type = op->getOutputSocket(0)->getDataType();
|
||||
const DataType data_type = op->get_output_socket(0)->get_data_type();
|
||||
const bool is_a_single_elem = op->get_flags().is_constant_operation;
|
||||
return new MemoryBuffer(data_type, rect, is_a_single_elem);
|
||||
}
|
||||
@@ -115,9 +116,9 @@ void FullFrameExecutionModel::render_operation(NodeOperation *op)
|
||||
constexpr int output_x = 0;
|
||||
constexpr int output_y = 0;
|
||||
|
||||
const bool has_outputs = op->getNumberOfOutputSockets() > 0;
|
||||
const bool has_outputs = op->get_number_of_output_sockets() > 0;
|
||||
MemoryBuffer *op_buf = has_outputs ? create_operation_buffer(op, output_x, output_y) : nullptr;
|
||||
if (op->getWidth() > 0 && op->getHeight() > 0) {
|
||||
if (op->get_width() > 0 && op->get_height() > 0) {
|
||||
Vector<MemoryBuffer *> input_bufs = get_input_buffers(op, output_x, output_y);
|
||||
const int op_offset_x = output_x - op->get_canvas().xmin;
|
||||
const int op_offset_y = output_y - op->get_canvas().ymin;
|
||||
@@ -141,19 +142,19 @@ void FullFrameExecutionModel::render_operation(NodeOperation *op)
|
||||
*/
|
||||
void FullFrameExecutionModel::render_operations()
|
||||
{
|
||||
const bool is_rendering = context_.isRendering();
|
||||
const bool is_rendering = context_.is_rendering();
|
||||
|
||||
WorkScheduler::start(this->context_);
|
||||
for (eCompositorPriority priority : priorities_) {
|
||||
for (NodeOperation *op : operations_) {
|
||||
const bool has_size = op->getWidth() > 0 && op->getHeight() > 0;
|
||||
const bool is_priority_output = op->isOutputOperation(is_rendering) &&
|
||||
op->getRenderPriority() == priority;
|
||||
const bool has_size = op->get_width() > 0 && op->get_height() > 0;
|
||||
const bool is_priority_output = op->is_output_operation(is_rendering) &&
|
||||
op->get_render_priority() == priority;
|
||||
if (is_priority_output && has_size) {
|
||||
render_output_dependencies(op);
|
||||
render_operation(op);
|
||||
}
|
||||
else if (is_priority_output && !has_size && op->isActiveViewerOutput()) {
|
||||
else if (is_priority_output && !has_size && op->is_active_viewer_output()) {
|
||||
static_cast<ViewerOperation *>(op)->clear_display_buffer();
|
||||
}
|
||||
}
|
||||
@@ -175,7 +176,7 @@ static Vector<NodeOperation *> get_operation_dependencies(NodeOperation *operati
|
||||
Vector<NodeOperation *> outputs(next_outputs);
|
||||
next_outputs.clear();
|
||||
for (NodeOperation *output : outputs) {
|
||||
for (int i = 0; i < output->getNumberOfInputSockets(); i++) {
|
||||
for (int i = 0; i < output->get_number_of_input_sockets(); i++) {
|
||||
next_outputs.append(output->get_input_operation(i));
|
||||
}
|
||||
}
|
||||
@@ -190,7 +191,7 @@ static Vector<NodeOperation *> get_operation_dependencies(NodeOperation *operati
|
||||
|
||||
void FullFrameExecutionModel::render_output_dependencies(NodeOperation *output_op)
|
||||
{
|
||||
BLI_assert(output_op->isOutputOperation(context_.isRendering()));
|
||||
BLI_assert(output_op->is_output_operation(context_.is_rendering()));
|
||||
Vector<NodeOperation *> dependencies = get_operation_dependencies(output_op);
|
||||
for (NodeOperation *op : dependencies) {
|
||||
if (!active_buffers_.is_operation_rendered(op)) {
|
||||
@@ -205,7 +206,7 @@ void FullFrameExecutionModel::render_output_dependencies(NodeOperation *output_o
|
||||
void FullFrameExecutionModel::determine_areas_to_render(NodeOperation *output_op,
|
||||
const rcti &output_area)
|
||||
{
|
||||
BLI_assert(output_op->isOutputOperation(context_.isRendering()));
|
||||
BLI_assert(output_op->is_output_operation(context_.is_rendering()));
|
||||
|
||||
Vector<std::pair<NodeOperation *, const rcti>> stack;
|
||||
stack.append({output_op, output_area});
|
||||
@@ -220,7 +221,7 @@ void FullFrameExecutionModel::determine_areas_to_render(NodeOperation *output_op
|
||||
|
||||
active_buffers_.register_area(operation, render_area);
|
||||
|
||||
const int num_inputs = operation->getNumberOfInputSockets();
|
||||
const int num_inputs = operation->get_number_of_input_sockets();
|
||||
for (int i = 0; i < num_inputs; i++) {
|
||||
NodeOperation *input_op = operation->get_input_operation(i);
|
||||
rcti input_area;
|
||||
@@ -240,13 +241,13 @@ void FullFrameExecutionModel::determine_areas_to_render(NodeOperation *output_op
|
||||
*/
|
||||
void FullFrameExecutionModel::determine_reads(NodeOperation *output_op)
|
||||
{
|
||||
BLI_assert(output_op->isOutputOperation(context_.isRendering()));
|
||||
BLI_assert(output_op->is_output_operation(context_.is_rendering()));
|
||||
|
||||
Vector<NodeOperation *> stack;
|
||||
stack.append(output_op);
|
||||
while (stack.size() > 0) {
|
||||
NodeOperation *operation = stack.pop_last();
|
||||
const int num_inputs = operation->getNumberOfInputSockets();
|
||||
const int num_inputs = operation->get_number_of_input_sockets();
|
||||
for (int i = 0; i < num_inputs; i++) {
|
||||
NodeOperation *input_op = operation->get_input_operation(i);
|
||||
if (!active_buffers_.has_registered_reads(input_op)) {
|
||||
@@ -263,7 +264,7 @@ void FullFrameExecutionModel::determine_reads(NodeOperation *output_op)
|
||||
*/
|
||||
void FullFrameExecutionModel::get_output_render_area(NodeOperation *output_op, rcti &r_area)
|
||||
{
|
||||
BLI_assert(output_op->isOutputOperation(context_.isRendering()));
|
||||
BLI_assert(output_op->is_output_operation(context_.is_rendering()));
|
||||
|
||||
/* By default return operation bounds (no border). */
|
||||
rcti canvas = output_op->get_canvas();
|
||||
@@ -278,8 +279,8 @@ void FullFrameExecutionModel::get_output_render_area(NodeOperation *output_op, r
|
||||
const rctf *norm_border = has_viewer_border ? border_.viewer_border : border_.render_border;
|
||||
|
||||
/* Return de-normalized border within canvas. */
|
||||
const int w = output_op->getWidth();
|
||||
const int h = output_op->getHeight();
|
||||
const int w = output_op->get_width();
|
||||
const int h = output_op->get_height();
|
||||
r_area.xmin = canvas.xmin + norm_border->xmin * w;
|
||||
r_area.xmax = canvas.xmin + norm_border->xmax * w;
|
||||
r_area.ymin = canvas.ymin + norm_border->ymin * h;
|
||||
@@ -290,7 +291,7 @@ void FullFrameExecutionModel::get_output_render_area(NodeOperation *output_op, r
|
||||
void FullFrameExecutionModel::operation_finished(NodeOperation *operation)
|
||||
{
|
||||
/* Report inputs reads so that buffers may be freed/reused. */
|
||||
const int num_inputs = operation->getNumberOfInputSockets();
|
||||
const int num_inputs = operation->get_number_of_input_sockets();
|
||||
for (int i = 0; i < num_inputs; i++) {
|
||||
active_buffers_.read_finished(operation->get_input_operation(i));
|
||||
}
|
||||
@@ -301,7 +302,7 @@ void FullFrameExecutionModel::operation_finished(NodeOperation *operation)
|
||||
|
||||
void FullFrameExecutionModel::update_progress_bar()
|
||||
{
|
||||
const bNodeTree *tree = context_.getbNodeTree();
|
||||
const bNodeTree *tree = context_.get_bnodetree();
|
||||
if (tree) {
|
||||
const float progress = num_operations_finished_ / static_cast<float>(operations_.size());
|
||||
tree->progress(tree->prh, progress);
|
||||
|
||||
@@ -44,32 +44,32 @@ static rcti create_rect(const int width, const int height)
|
||||
return rect;
|
||||
}
|
||||
|
||||
MemoryBuffer::MemoryBuffer(MemoryProxy *memoryProxy, const rcti &rect, MemoryBufferState state)
|
||||
MemoryBuffer::MemoryBuffer(MemoryProxy *memory_proxy, const rcti &rect, MemoryBufferState state)
|
||||
{
|
||||
rect_ = rect;
|
||||
is_a_single_elem_ = false;
|
||||
memoryProxy_ = memoryProxy;
|
||||
num_channels_ = COM_data_type_num_channels(memoryProxy->getDataType());
|
||||
memory_proxy_ = memory_proxy;
|
||||
num_channels_ = COM_data_type_num_channels(memory_proxy->get_data_type());
|
||||
buffer_ = (float *)MEM_mallocN_aligned(
|
||||
sizeof(float) * buffer_len() * num_channels_, 16, "COM_MemoryBuffer");
|
||||
owns_data_ = true;
|
||||
state_ = state;
|
||||
datatype_ = memoryProxy->getDataType();
|
||||
datatype_ = memory_proxy->get_data_type();
|
||||
|
||||
set_strides();
|
||||
}
|
||||
|
||||
MemoryBuffer::MemoryBuffer(DataType dataType, const rcti &rect, bool is_a_single_elem)
|
||||
MemoryBuffer::MemoryBuffer(DataType data_type, const rcti &rect, bool is_a_single_elem)
|
||||
{
|
||||
rect_ = rect;
|
||||
is_a_single_elem_ = is_a_single_elem;
|
||||
memoryProxy_ = nullptr;
|
||||
num_channels_ = COM_data_type_num_channels(dataType);
|
||||
memory_proxy_ = nullptr;
|
||||
num_channels_ = COM_data_type_num_channels(data_type);
|
||||
buffer_ = (float *)MEM_mallocN_aligned(
|
||||
sizeof(float) * buffer_len() * num_channels_, 16, "COM_MemoryBuffer");
|
||||
owns_data_ = true;
|
||||
state_ = MemoryBufferState::Temporary;
|
||||
datatype_ = dataType;
|
||||
datatype_ = data_type;
|
||||
|
||||
set_strides();
|
||||
}
|
||||
@@ -95,7 +95,7 @@ MemoryBuffer::MemoryBuffer(float *buffer,
|
||||
{
|
||||
rect_ = rect;
|
||||
is_a_single_elem_ = is_a_single_elem;
|
||||
memoryProxy_ = nullptr;
|
||||
memory_proxy_ = nullptr;
|
||||
num_channels_ = num_channels;
|
||||
datatype_ = COM_num_channels_data_type(num_channels);
|
||||
buffer_ = buffer;
|
||||
@@ -107,7 +107,7 @@ MemoryBuffer::MemoryBuffer(float *buffer,
|
||||
|
||||
MemoryBuffer::MemoryBuffer(const MemoryBuffer &src) : MemoryBuffer(src.datatype_, src.rect_, false)
|
||||
{
|
||||
memoryProxy_ = src.memoryProxy_;
|
||||
memory_proxy_ = src.memory_proxy_;
|
||||
/* src may be single elem buffer */
|
||||
fill_from(src);
|
||||
}
|
||||
@@ -120,7 +120,7 @@ void MemoryBuffer::set_strides()
|
||||
}
|
||||
else {
|
||||
this->elem_stride = num_channels_;
|
||||
this->row_stride = getWidth() * num_channels_;
|
||||
this->row_stride = get_width() * num_channels_;
|
||||
}
|
||||
to_positive_x_stride_ = rect_.xmin < 0 ? -rect_.xmin + 1 : (rect_.xmin == 0 ? 1 : 0);
|
||||
to_positive_y_stride_ = rect_.ymin < 0 ? -rect_.ymin + 1 : (rect_.ymin == 0 ? 1 : 0);
|
||||
@@ -140,7 +140,7 @@ BuffersIterator<float> MemoryBuffer::iterate_with(Span<MemoryBuffer *> inputs, c
|
||||
{
|
||||
BuffersIteratorBuilder<float> builder(buffer_, rect_, area, elem_stride);
|
||||
for (MemoryBuffer *input : inputs) {
|
||||
builder.add_input(input->getBuffer(), input->get_rect(), input->elem_stride);
|
||||
builder.add_input(input->get_buffer(), input->get_rect(), input->elem_stride);
|
||||
}
|
||||
return builder.build();
|
||||
}
|
||||
@@ -248,7 +248,7 @@ void MemoryBuffer::copy_from(const MemoryBuffer *src,
|
||||
void MemoryBuffer::copy_from(const uchar *src, const rcti &area)
|
||||
{
|
||||
const int elem_stride = this->get_num_channels();
|
||||
const int row_stride = elem_stride * getWidth();
|
||||
const int row_stride = elem_stride * get_width();
|
||||
copy_from(src, area, 0, this->get_num_channels(), elem_stride, row_stride, 0);
|
||||
}
|
||||
|
||||
@@ -307,7 +307,7 @@ static void colorspace_to_scene_linear(MemoryBuffer *buf, const rcti &area, Colo
|
||||
const int height = BLI_rcti_size_y(&area);
|
||||
float *out = buf->get_elem(area.xmin, area.ymin);
|
||||
/* If area allows continuous memory do conversion in one step. Otherwise per row. */
|
||||
if (buf->getWidth() == width) {
|
||||
if (buf->get_width() == width) {
|
||||
IMB_colormanagement_colorspace_to_scene_linear(
|
||||
out, width, height, buf->get_num_channels(), colorspace, false);
|
||||
}
|
||||
@@ -404,7 +404,7 @@ void MemoryBuffer::fill_from(const MemoryBuffer &src)
|
||||
copy_from(&src, overlap);
|
||||
}
|
||||
|
||||
void MemoryBuffer::writePixel(int x, int y, const float color[4])
|
||||
void MemoryBuffer::write_pixel(int x, int y, const float color[4])
|
||||
{
|
||||
if (x >= rect_.xmin && x < rect_.xmax && y >= rect_.ymin && y < rect_.ymax) {
|
||||
const int offset = get_coords_offset(x, y);
|
||||
@@ -412,7 +412,7 @@ void MemoryBuffer::writePixel(int x, int y, const float color[4])
|
||||
}
|
||||
}
|
||||
|
||||
void MemoryBuffer::addPixel(int x, int y, const float color[4])
|
||||
void MemoryBuffer::add_pixel(int x, int y, const float color[4])
|
||||
{
|
||||
if (x >= rect_.xmin && x < rect_.xmax && y >= rect_.ymin && y < rect_.ymax) {
|
||||
const int offset = get_coords_offset(x, y);
|
||||
@@ -437,7 +437,7 @@ void MemoryBuffer::read_elem_filtered(
|
||||
|
||||
const float deriv[2][2] = {{dx[0], dx[1]}, {dy[0], dy[1]}};
|
||||
|
||||
float inv_width = 1.0f / (float)this->getWidth(), inv_height = 1.0f / (float)this->getHeight();
|
||||
float inv_width = 1.0f / (float)this->get_width(), inv_height = 1.0f / (float)this->get_height();
|
||||
/* TODO(sergey): Render pipeline uses normalized coordinates and derivatives,
|
||||
* but compositor uses pixel space. For now let's just divide the values and
|
||||
* switch compositor to normalized space for EWA later.
|
||||
@@ -446,8 +446,8 @@ void MemoryBuffer::read_elem_filtered(
|
||||
float du_normal[2] = {deriv[0][0] * inv_width, deriv[0][1] * inv_height};
|
||||
float dv_normal[2] = {deriv[1][0] * inv_width, deriv[1][1] * inv_height};
|
||||
|
||||
BLI_ewa_filter(this->getWidth(),
|
||||
this->getHeight(),
|
||||
BLI_ewa_filter(this->get_width(),
|
||||
this->get_height(),
|
||||
false,
|
||||
true,
|
||||
uv_normal,
|
||||
@@ -473,7 +473,8 @@ void MemoryBuffer::readEWA(float *result, const float uv[2], const float derivat
|
||||
}
|
||||
else {
|
||||
BLI_assert(datatype_ == DataType::Color);
|
||||
float inv_width = 1.0f / (float)this->getWidth(), inv_height = 1.0f / (float)this->getHeight();
|
||||
float inv_width = 1.0f / (float)this->get_width(),
|
||||
inv_height = 1.0f / (float)this->get_height();
|
||||
/* TODO(sergey): Render pipeline uses normalized coordinates and derivatives,
|
||||
* but compositor uses pixel space. For now let's just divide the values and
|
||||
* switch compositor to normalized space for EWA later.
|
||||
@@ -482,8 +483,8 @@ void MemoryBuffer::readEWA(float *result, const float uv[2], const float derivat
|
||||
float du_normal[2] = {derivatives[0][0] * inv_width, derivatives[0][1] * inv_height};
|
||||
float dv_normal[2] = {derivatives[1][0] * inv_width, derivatives[1][1] * inv_height};
|
||||
|
||||
BLI_ewa_filter(this->getWidth(),
|
||||
this->getHeight(),
|
||||
BLI_ewa_filter(this->get_width(),
|
||||
this->get_height(),
|
||||
false,
|
||||
true,
|
||||
uv_normal,
|
||||
|
||||
@@ -77,7 +77,7 @@ class MemoryBuffer {
|
||||
/**
|
||||
* \brief proxy of the memory (same for all chunks in the same buffer)
|
||||
*/
|
||||
MemoryProxy *memoryProxy_;
|
||||
MemoryProxy *memory_proxy_;
|
||||
|
||||
/**
|
||||
* \brief the type of buffer DataType::Value, DataType::Vector, DataType::Color
|
||||
@@ -125,12 +125,12 @@ class MemoryBuffer {
|
||||
/**
|
||||
* \brief construct new temporarily MemoryBuffer for an area
|
||||
*/
|
||||
MemoryBuffer(MemoryProxy *memoryProxy, const rcti &rect, MemoryBufferState state);
|
||||
MemoryBuffer(MemoryProxy *memory_proxy, const rcti &rect, MemoryBufferState state);
|
||||
|
||||
/**
|
||||
* \brief construct new temporarily MemoryBuffer for an area
|
||||
*/
|
||||
MemoryBuffer(DataType datatype, const rcti &rect, bool is_a_single_elem = false);
|
||||
MemoryBuffer(DataType data_type, const rcti &rect, bool is_a_single_elem = false);
|
||||
|
||||
MemoryBuffer(
|
||||
float *buffer, int num_channels, int width, int height, bool is_a_single_elem = false);
|
||||
@@ -159,14 +159,14 @@ class MemoryBuffer {
|
||||
float &operator[](int index)
|
||||
{
|
||||
BLI_assert(is_a_single_elem_ ? index < num_channels_ :
|
||||
index < get_coords_offset(getWidth(), getHeight()));
|
||||
index < get_coords_offset(get_width(), get_height()));
|
||||
return buffer_[index];
|
||||
}
|
||||
|
||||
const float &operator[](int index) const
|
||||
{
|
||||
BLI_assert(is_a_single_elem_ ? index < num_channels_ :
|
||||
index < get_coords_offset(getWidth(), getHeight()));
|
||||
index < get_coords_offset(get_width(), get_height()));
|
||||
return buffer_[index];
|
||||
}
|
||||
|
||||
@@ -231,7 +231,7 @@ class MemoryBuffer {
|
||||
}
|
||||
|
||||
/* Do sampling at borders to smooth edges. */
|
||||
const float last_x = getWidth() - 1.0f;
|
||||
const float last_x = get_width() - 1.0f;
|
||||
const float rel_x = get_relative_x(x);
|
||||
float single_x = 0.0f;
|
||||
if (rel_x < 0.0f) {
|
||||
@@ -241,7 +241,7 @@ class MemoryBuffer {
|
||||
single_x = rel_x - last_x;
|
||||
}
|
||||
|
||||
const float last_y = getHeight() - 1.0f;
|
||||
const float last_y = get_height() - 1.0f;
|
||||
const float rel_y = get_relative_y(y);
|
||||
float single_y = 0.0f;
|
||||
if (rel_y < 0.0f) {
|
||||
@@ -257,8 +257,8 @@ class MemoryBuffer {
|
||||
|
||||
BLI_bilinear_interpolation_fl(buffer_,
|
||||
out,
|
||||
getWidth(),
|
||||
getHeight(),
|
||||
get_width(),
|
||||
get_height(),
|
||||
num_channels_,
|
||||
get_relative_x(x),
|
||||
get_relative_y(y));
|
||||
@@ -305,7 +305,7 @@ class MemoryBuffer {
|
||||
const float *get_row_end(int y) const
|
||||
{
|
||||
BLI_assert(has_y(y));
|
||||
return buffer_ + (is_a_single_elem() ? num_channels_ : get_coords_offset(getWidth(), y));
|
||||
return buffer_ + (is_a_single_elem() ? num_channels_ : get_coords_offset(get_width(), y));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -314,7 +314,7 @@ class MemoryBuffer {
|
||||
*/
|
||||
int get_memory_width() const
|
||||
{
|
||||
return is_a_single_elem() ? 1 : getWidth();
|
||||
return is_a_single_elem() ? 1 : get_width();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -323,7 +323,7 @@ class MemoryBuffer {
|
||||
*/
|
||||
int get_memory_height() const
|
||||
{
|
||||
return is_a_single_elem() ? 1 : getHeight();
|
||||
return is_a_single_elem() ? 1 : get_height();
|
||||
}
|
||||
|
||||
uint8_t get_num_channels() const
|
||||
@@ -351,12 +351,12 @@ class MemoryBuffer {
|
||||
|
||||
BufferArea<float> get_buffer_area(const rcti &area)
|
||||
{
|
||||
return BufferArea<float>(buffer_, getWidth(), area, elem_stride);
|
||||
return BufferArea<float>(buffer_, get_width(), area, elem_stride);
|
||||
}
|
||||
|
||||
BufferArea<const float> get_buffer_area(const rcti &area) const
|
||||
{
|
||||
return BufferArea<const float>(buffer_, getWidth(), area, elem_stride);
|
||||
return BufferArea<const float>(buffer_, get_width(), area, elem_stride);
|
||||
}
|
||||
|
||||
BuffersIterator<float> iterate_with(Span<MemoryBuffer *> inputs);
|
||||
@@ -366,7 +366,7 @@ class MemoryBuffer {
|
||||
* \brief get the data of this MemoryBuffer
|
||||
* \note buffer should already be available in memory
|
||||
*/
|
||||
float *getBuffer()
|
||||
float *get_buffer()
|
||||
{
|
||||
return buffer_;
|
||||
}
|
||||
@@ -381,8 +381,8 @@ class MemoryBuffer {
|
||||
|
||||
inline void wrap_pixel(int &x, int &y, MemoryBufferExtend extend_x, MemoryBufferExtend extend_y)
|
||||
{
|
||||
const int w = getWidth();
|
||||
const int h = getHeight();
|
||||
const int w = get_width();
|
||||
const int h = get_height();
|
||||
x = x - rect_.xmin;
|
||||
y = y - rect_.ymin;
|
||||
|
||||
@@ -433,8 +433,8 @@ class MemoryBuffer {
|
||||
MemoryBufferExtend extend_x,
|
||||
MemoryBufferExtend extend_y) const
|
||||
{
|
||||
const float w = (float)getWidth();
|
||||
const float h = (float)getHeight();
|
||||
const float w = (float)get_width();
|
||||
const float h = (float)get_height();
|
||||
x = x - rect_.xmin;
|
||||
y = y - rect_.ymin;
|
||||
|
||||
@@ -505,11 +505,11 @@ class MemoryBuffer {
|
||||
}
|
||||
|
||||
/* TODO(manzanilla): to be removed with tiled implementation. */
|
||||
inline void readNoCheck(float *result,
|
||||
int x,
|
||||
int y,
|
||||
MemoryBufferExtend extend_x = MemoryBufferExtend::Clip,
|
||||
MemoryBufferExtend extend_y = MemoryBufferExtend::Clip)
|
||||
inline void read_no_check(float *result,
|
||||
int x,
|
||||
int y,
|
||||
MemoryBufferExtend extend_x = MemoryBufferExtend::Clip,
|
||||
MemoryBufferExtend extend_y = MemoryBufferExtend::Clip)
|
||||
{
|
||||
int u = x;
|
||||
int v = y;
|
||||
@@ -525,19 +525,19 @@ class MemoryBuffer {
|
||||
memcpy(result, buffer, sizeof(float) * num_channels_);
|
||||
}
|
||||
|
||||
void writePixel(int x, int y, const float color[4]);
|
||||
void addPixel(int x, int y, const float color[4]);
|
||||
inline void readBilinear(float *result,
|
||||
float x,
|
||||
float y,
|
||||
MemoryBufferExtend extend_x = MemoryBufferExtend::Clip,
|
||||
MemoryBufferExtend extend_y = MemoryBufferExtend::Clip) const
|
||||
void write_pixel(int x, int y, const float color[4]);
|
||||
void add_pixel(int x, int y, const float color[4]);
|
||||
inline void read_bilinear(float *result,
|
||||
float x,
|
||||
float y,
|
||||
MemoryBufferExtend extend_x = MemoryBufferExtend::Clip,
|
||||
MemoryBufferExtend extend_y = MemoryBufferExtend::Clip) const
|
||||
{
|
||||
float u = x;
|
||||
float v = y;
|
||||
this->wrap_pixel(u, v, extend_x, extend_y);
|
||||
if ((extend_x != MemoryBufferExtend::Repeat && (u < 0.0f || u >= getWidth())) ||
|
||||
(extend_y != MemoryBufferExtend::Repeat && (v < 0.0f || v >= getHeight()))) {
|
||||
if ((extend_x != MemoryBufferExtend::Repeat && (u < 0.0f || u >= get_width())) ||
|
||||
(extend_y != MemoryBufferExtend::Repeat && (v < 0.0f || v >= get_height()))) {
|
||||
copy_vn_fl(result, num_channels_, 0.0f);
|
||||
return;
|
||||
}
|
||||
@@ -547,8 +547,8 @@ class MemoryBuffer {
|
||||
else {
|
||||
BLI_bilinear_interpolation_wrap_fl(buffer_,
|
||||
result,
|
||||
getWidth(),
|
||||
getHeight(),
|
||||
get_width(),
|
||||
get_height(),
|
||||
num_channels_,
|
||||
u,
|
||||
v,
|
||||
@@ -562,7 +562,7 @@ class MemoryBuffer {
|
||||
/**
|
||||
* \brief is this MemoryBuffer a temporarily buffer (based on an area, not on a chunk)
|
||||
*/
|
||||
inline bool isTemporarily() const
|
||||
inline bool is_temporarily() const
|
||||
{
|
||||
return state_ == MemoryBufferState::Temporary;
|
||||
}
|
||||
@@ -617,8 +617,8 @@ class MemoryBuffer {
|
||||
void fill(const rcti &area, const float *value);
|
||||
void fill(const rcti &area, int channel_offset, const float *value, int value_size);
|
||||
/**
|
||||
* \brief add the content from otherBuffer to this MemoryBuffer
|
||||
* \param otherBuffer: source buffer
|
||||
* \brief add the content from other_buffer to this MemoryBuffer
|
||||
* \param other_buffer: source buffer
|
||||
*
|
||||
* \note take care when running this on a new buffer since it won't fill in
|
||||
* uninitialized values in areas where the buffers don't overlap.
|
||||
@@ -636,7 +636,7 @@ class MemoryBuffer {
|
||||
/**
|
||||
* \brief get the width of this MemoryBuffer
|
||||
*/
|
||||
const int getWidth() const
|
||||
const int get_width() const
|
||||
{
|
||||
return BLI_rcti_size_x(&rect_);
|
||||
}
|
||||
@@ -644,7 +644,7 @@ class MemoryBuffer {
|
||||
/**
|
||||
* \brief get the height of this MemoryBuffer
|
||||
*/
|
||||
const int getHeight() const
|
||||
const int get_height() const
|
||||
{
|
||||
return BLI_rcti_size_y(&rect_);
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace blender::compositor {
|
||||
|
||||
MemoryProxy::MemoryProxy(DataType datatype)
|
||||
{
|
||||
writeBufferOperation_ = nullptr;
|
||||
write_buffer_operation_ = nullptr;
|
||||
executor_ = nullptr;
|
||||
datatype_ = datatype;
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ class MemoryProxy {
|
||||
/**
|
||||
* \brief reference to the output operation of the executiongroup
|
||||
*/
|
||||
WriteBufferOperation *writeBufferOperation_;
|
||||
WriteBufferOperation *write_buffer_operation_;
|
||||
|
||||
/**
|
||||
* \brief reference to the executor. the Execution group that can fill a chunk
|
||||
@@ -66,7 +66,7 @@ class MemoryProxy {
|
||||
* \brief set the ExecutionGroup that can be scheduled to calculate a certain chunk.
|
||||
* \param group: the ExecutionGroup to set
|
||||
*/
|
||||
void setExecutor(ExecutionGroup *executor)
|
||||
void set_executor(ExecutionGroup *executor)
|
||||
{
|
||||
executor_ = executor;
|
||||
}
|
||||
@@ -74,7 +74,7 @@ class MemoryProxy {
|
||||
/**
|
||||
* \brief get the ExecutionGroup that can be scheduled to calculate a certain chunk.
|
||||
*/
|
||||
ExecutionGroup *getExecutor() const
|
||||
ExecutionGroup *get_executor() const
|
||||
{
|
||||
return executor_;
|
||||
}
|
||||
@@ -83,18 +83,18 @@ class MemoryProxy {
|
||||
* \brief set the WriteBufferOperation that is responsible for writing to this MemoryProxy
|
||||
* \param operation:
|
||||
*/
|
||||
void setWriteBufferOperation(WriteBufferOperation *operation)
|
||||
void set_write_buffer_operation(WriteBufferOperation *operation)
|
||||
{
|
||||
writeBufferOperation_ = operation;
|
||||
write_buffer_operation_ = operation;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief get the WriteBufferOperation that is responsible for writing to this MemoryProxy
|
||||
* \return WriteBufferOperation
|
||||
*/
|
||||
WriteBufferOperation *getWriteBufferOperation() const
|
||||
WriteBufferOperation *get_write_buffer_operation() const
|
||||
{
|
||||
return writeBufferOperation_;
|
||||
return write_buffer_operation_;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -110,12 +110,12 @@ class MemoryProxy {
|
||||
/**
|
||||
* \brief get the allocated memory
|
||||
*/
|
||||
inline MemoryBuffer *getBuffer()
|
||||
inline MemoryBuffer *get_buffer()
|
||||
{
|
||||
return buffer_;
|
||||
}
|
||||
|
||||
inline DataType getDataType()
|
||||
inline DataType get_data_type()
|
||||
{
|
||||
return datatype_;
|
||||
}
|
||||
|
||||
@@ -29,9 +29,9 @@ void MetaData::add(const blender::StringRef key, const blender::StringRef value)
|
||||
entries_.add(key, value);
|
||||
}
|
||||
|
||||
void MetaData::addCryptomatteEntry(const blender::StringRef layer_name,
|
||||
const blender::StringRefNull key,
|
||||
const blender::StringRef value)
|
||||
void MetaData::add_cryptomatte_entry(const blender::StringRef layer_name,
|
||||
const blender::StringRefNull key,
|
||||
const blender::StringRef value)
|
||||
{
|
||||
add(blender::bke::cryptomatte::BKE_cryptomatte_meta_data_key(layer_name, key), value);
|
||||
}
|
||||
@@ -40,7 +40,7 @@ void MetaData::addCryptomatteEntry(const blender::StringRef layer_name,
|
||||
*
|
||||
* When a conversion happens it will also add the cryptomatte name key with the given
|
||||
* `layer_name`. */
|
||||
void MetaData::replaceHashNeutralCryptomatteKeys(const blender::StringRef layer_name)
|
||||
void MetaData::replace_hash_neutral_cryptomatte_keys(const blender::StringRef layer_name)
|
||||
{
|
||||
std::string cryptomatte_hash = entries_.pop_default(META_DATA_KEY_CRYPTOMATTE_HASH, "");
|
||||
std::string cryptomatte_conversion = entries_.pop_default(META_DATA_KEY_CRYPTOMATTE_CONVERSION,
|
||||
@@ -49,27 +49,28 @@ void MetaData::replaceHashNeutralCryptomatteKeys(const blender::StringRef layer_
|
||||
|
||||
if (cryptomatte_hash.length() || cryptomatte_conversion.length() ||
|
||||
cryptomatte_manifest.length()) {
|
||||
addCryptomatteEntry(layer_name, "name", layer_name);
|
||||
add_cryptomatte_entry(layer_name, "name", layer_name);
|
||||
}
|
||||
if (cryptomatte_hash.length()) {
|
||||
addCryptomatteEntry(layer_name, "hash", cryptomatte_hash);
|
||||
add_cryptomatte_entry(layer_name, "hash", cryptomatte_hash);
|
||||
}
|
||||
if (cryptomatte_conversion.length()) {
|
||||
addCryptomatteEntry(layer_name, "conversion", cryptomatte_conversion);
|
||||
add_cryptomatte_entry(layer_name, "conversion", cryptomatte_conversion);
|
||||
}
|
||||
if (cryptomatte_manifest.length()) {
|
||||
addCryptomatteEntry(layer_name, "manifest", cryptomatte_manifest);
|
||||
add_cryptomatte_entry(layer_name, "manifest", cryptomatte_manifest);
|
||||
}
|
||||
}
|
||||
|
||||
void MetaData::addToRenderResult(RenderResult *render_result) const
|
||||
void MetaData::add_to_render_result(RenderResult *render_result) const
|
||||
{
|
||||
for (Map<std::string, std::string>::Item entry : entries_.items()) {
|
||||
BKE_render_result_stamp_data(render_result, entry.key.c_str(), entry.value.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
void MetaDataExtractCallbackData::addMetaData(blender::StringRef key, blender::StringRefNull value)
|
||||
void MetaDataExtractCallbackData::add_meta_data(blender::StringRef key,
|
||||
blender::StringRefNull value)
|
||||
{
|
||||
if (!meta_data) {
|
||||
meta_data = std::make_unique<MetaData>();
|
||||
@@ -77,7 +78,7 @@ void MetaDataExtractCallbackData::addMetaData(blender::StringRef key, blender::S
|
||||
meta_data->add(key, value);
|
||||
}
|
||||
|
||||
void MetaDataExtractCallbackData::setCryptomatteKeys(blender::StringRef cryptomatte_layer_name)
|
||||
void MetaDataExtractCallbackData::set_cryptomatte_keys(blender::StringRef cryptomatte_layer_name)
|
||||
{
|
||||
manifest_key = blender::bke::cryptomatte::BKE_cryptomatte_meta_data_key(cryptomatte_layer_name,
|
||||
"manifest");
|
||||
@@ -95,13 +96,13 @@ void MetaDataExtractCallbackData::extract_cryptomatte_meta_data(void *_data,
|
||||
MetaDataExtractCallbackData *data = static_cast<MetaDataExtractCallbackData *>(_data);
|
||||
blender::StringRefNull key(propname);
|
||||
if (key == data->hash_key) {
|
||||
data->addMetaData(META_DATA_KEY_CRYPTOMATTE_HASH, propvalue);
|
||||
data->add_meta_data(META_DATA_KEY_CRYPTOMATTE_HASH, propvalue);
|
||||
}
|
||||
else if (key == data->conversion_key) {
|
||||
data->addMetaData(META_DATA_KEY_CRYPTOMATTE_CONVERSION, propvalue);
|
||||
data->add_meta_data(META_DATA_KEY_CRYPTOMATTE_CONVERSION, propvalue);
|
||||
}
|
||||
else if (key == data->manifest_key) {
|
||||
data->addMetaData(META_DATA_KEY_CRYPTOMATTE_MANIFEST, propvalue);
|
||||
data->add_meta_data(META_DATA_KEY_CRYPTOMATTE_MANIFEST, propvalue);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -44,14 +44,14 @@ constexpr blender::StringRef META_DATA_KEY_CRYPTOMATTE_NAME("cryptomatte/{hash}/
|
||||
class MetaData {
|
||||
private:
|
||||
Map<std::string, std::string> entries_;
|
||||
void addCryptomatteEntry(const blender::StringRef layer_name,
|
||||
const blender::StringRefNull key,
|
||||
const blender::StringRef value);
|
||||
void add_cryptomatte_entry(const blender::StringRef layer_name,
|
||||
const blender::StringRefNull key,
|
||||
const blender::StringRef value);
|
||||
|
||||
public:
|
||||
void add(const blender::StringRef key, const blender::StringRef value);
|
||||
void replaceHashNeutralCryptomatteKeys(const blender::StringRef layer_name);
|
||||
void addToRenderResult(RenderResult *render_result) const;
|
||||
void replace_hash_neutral_cryptomatte_keys(const blender::StringRef layer_name);
|
||||
void add_to_render_result(RenderResult *render_result) const;
|
||||
#ifdef WITH_CXX_GUARDEDALLOC
|
||||
MEM_CXX_CLASS_ALLOC_FUNCS("COM:MetaData")
|
||||
#endif
|
||||
@@ -63,8 +63,8 @@ struct MetaDataExtractCallbackData {
|
||||
std::string conversion_key;
|
||||
std::string manifest_key;
|
||||
|
||||
void addMetaData(blender::StringRef key, blender::StringRefNull value);
|
||||
void setCryptomatteKeys(blender::StringRef cryptomatte_layer_name);
|
||||
void add_meta_data(blender::StringRef key, blender::StringRefNull value);
|
||||
void set_cryptomatte_keys(blender::StringRef cryptomatte_layer_name);
|
||||
/* C type callback function (StampCallback). */
|
||||
static void extract_cryptomatte_meta_data(void *_data,
|
||||
const char *propname,
|
||||
|
||||
@@ -28,14 +28,14 @@ namespace blender::compositor {
|
||||
**** Node ****
|
||||
**************/
|
||||
|
||||
Node::Node(bNode *editorNode, bool create_sockets)
|
||||
: editorNodeTree_(nullptr),
|
||||
editorNode_(editorNode),
|
||||
inActiveGroup_(false),
|
||||
instanceKey_(NODE_INSTANCE_KEY_NONE)
|
||||
Node::Node(bNode *editor_node, bool create_sockets)
|
||||
: editor_node_tree_(nullptr),
|
||||
editor_node_(editor_node),
|
||||
in_active_group_(false),
|
||||
instance_key_(NODE_INSTANCE_KEY_NONE)
|
||||
{
|
||||
if (create_sockets) {
|
||||
bNodeSocket *input = (bNodeSocket *)editorNode->inputs.first;
|
||||
bNodeSocket *input = (bNodeSocket *)editor_node->inputs.first;
|
||||
while (input != nullptr) {
|
||||
DataType dt = DataType::Value;
|
||||
if (input->type == SOCK_RGBA) {
|
||||
@@ -45,10 +45,10 @@ Node::Node(bNode *editorNode, bool create_sockets)
|
||||
dt = DataType::Vector;
|
||||
}
|
||||
|
||||
this->addInputSocket(dt, input);
|
||||
this->add_input_socket(dt, input);
|
||||
input = input->next;
|
||||
}
|
||||
bNodeSocket *output = (bNodeSocket *)editorNode->outputs.first;
|
||||
bNodeSocket *output = (bNodeSocket *)editor_node->outputs.first;
|
||||
while (output != nullptr) {
|
||||
DataType dt = DataType::Value;
|
||||
if (output->type == SOCK_RGBA) {
|
||||
@@ -58,7 +58,7 @@ Node::Node(bNode *editorNode, bool create_sockets)
|
||||
dt = DataType::Vector;
|
||||
}
|
||||
|
||||
this->addOutputSocket(dt, output);
|
||||
this->add_output_socket(dt, output);
|
||||
output = output->next;
|
||||
}
|
||||
}
|
||||
@@ -74,43 +74,43 @@ Node::~Node()
|
||||
}
|
||||
}
|
||||
|
||||
void Node::addInputSocket(DataType datatype)
|
||||
void Node::add_input_socket(DataType datatype)
|
||||
{
|
||||
this->addInputSocket(datatype, nullptr);
|
||||
this->add_input_socket(datatype, nullptr);
|
||||
}
|
||||
|
||||
void Node::addInputSocket(DataType datatype, bNodeSocket *bSocket)
|
||||
void Node::add_input_socket(DataType datatype, bNodeSocket *bSocket)
|
||||
{
|
||||
NodeInput *socket = new NodeInput(this, bSocket, datatype);
|
||||
this->inputs.append(socket);
|
||||
}
|
||||
|
||||
void Node::addOutputSocket(DataType datatype)
|
||||
void Node::add_output_socket(DataType datatype)
|
||||
{
|
||||
this->addOutputSocket(datatype, nullptr);
|
||||
this->add_output_socket(datatype, nullptr);
|
||||
}
|
||||
void Node::addOutputSocket(DataType datatype, bNodeSocket *bSocket)
|
||||
void Node::add_output_socket(DataType datatype, bNodeSocket *bSocket)
|
||||
{
|
||||
NodeOutput *socket = new NodeOutput(this, bSocket, datatype);
|
||||
outputs.append(socket);
|
||||
}
|
||||
|
||||
NodeOutput *Node::getOutputSocket(unsigned int index) const
|
||||
NodeOutput *Node::get_output_socket(unsigned int index) const
|
||||
{
|
||||
return outputs[index];
|
||||
}
|
||||
|
||||
NodeInput *Node::getInputSocket(unsigned int index) const
|
||||
NodeInput *Node::get_input_socket(unsigned int index) const
|
||||
{
|
||||
return inputs[index];
|
||||
}
|
||||
|
||||
bNodeSocket *Node::getEditorInputSocket(int editorNodeInputSocketIndex)
|
||||
bNodeSocket *Node::get_editor_input_socket(int editor_node_input_socket_index)
|
||||
{
|
||||
bNodeSocket *bSock = (bNodeSocket *)this->getbNode()->inputs.first;
|
||||
bNodeSocket *bSock = (bNodeSocket *)this->get_bnode()->inputs.first;
|
||||
int index = 0;
|
||||
while (bSock != nullptr) {
|
||||
if (index == editorNodeInputSocketIndex) {
|
||||
if (index == editor_node_input_socket_index) {
|
||||
return bSock;
|
||||
}
|
||||
index++;
|
||||
@@ -118,12 +118,12 @@ bNodeSocket *Node::getEditorInputSocket(int editorNodeInputSocketIndex)
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
bNodeSocket *Node::getEditorOutputSocket(int editorNodeOutputSocketIndex)
|
||||
bNodeSocket *Node::get_editor_output_socket(int editor_node_output_socket_index)
|
||||
{
|
||||
bNodeSocket *bSock = (bNodeSocket *)this->getbNode()->outputs.first;
|
||||
bNodeSocket *bSock = (bNodeSocket *)this->get_bnode()->outputs.first;
|
||||
int index = 0;
|
||||
while (bSock != nullptr) {
|
||||
if (index == editorNodeOutputSocketIndex) {
|
||||
if (index == editor_node_output_socket_index) {
|
||||
return bSock;
|
||||
}
|
||||
index++;
|
||||
@@ -137,33 +137,33 @@ bNodeSocket *Node::getEditorOutputSocket(int editorNodeOutputSocketIndex)
|
||||
*******************/
|
||||
|
||||
NodeInput::NodeInput(Node *node, bNodeSocket *b_socket, DataType datatype)
|
||||
: node_(node), editorSocket_(b_socket), datatype_(datatype), link_(nullptr)
|
||||
: node_(node), editor_socket_(b_socket), datatype_(datatype), link_(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
void NodeInput::setLink(NodeOutput *link)
|
||||
void NodeInput::set_link(NodeOutput *link)
|
||||
{
|
||||
link_ = link;
|
||||
}
|
||||
|
||||
float NodeInput::getEditorValueFloat() const
|
||||
float NodeInput::get_editor_value_float() const
|
||||
{
|
||||
PointerRNA ptr;
|
||||
RNA_pointer_create((ID *)getNode()->getbNodeTree(), &RNA_NodeSocket, getbNodeSocket(), &ptr);
|
||||
RNA_pointer_create((ID *)get_node()->get_bnodetree(), &RNA_NodeSocket, get_bnode_socket(), &ptr);
|
||||
return RNA_float_get(&ptr, "default_value");
|
||||
}
|
||||
|
||||
void NodeInput::getEditorValueColor(float *value) const
|
||||
void NodeInput::get_editor_value_color(float *value) const
|
||||
{
|
||||
PointerRNA ptr;
|
||||
RNA_pointer_create((ID *)getNode()->getbNodeTree(), &RNA_NodeSocket, getbNodeSocket(), &ptr);
|
||||
RNA_pointer_create((ID *)get_node()->get_bnodetree(), &RNA_NodeSocket, get_bnode_socket(), &ptr);
|
||||
return RNA_float_get_array(&ptr, "default_value", value);
|
||||
}
|
||||
|
||||
void NodeInput::getEditorValueVector(float *value) const
|
||||
void NodeInput::get_editor_value_vector(float *value) const
|
||||
{
|
||||
PointerRNA ptr;
|
||||
RNA_pointer_create((ID *)getNode()->getbNodeTree(), &RNA_NodeSocket, getbNodeSocket(), &ptr);
|
||||
RNA_pointer_create((ID *)get_node()->get_bnodetree(), &RNA_NodeSocket, get_bnode_socket(), &ptr);
|
||||
return RNA_float_get_array(&ptr, "default_value", value);
|
||||
}
|
||||
|
||||
@@ -172,28 +172,28 @@ void NodeInput::getEditorValueVector(float *value) const
|
||||
********************/
|
||||
|
||||
NodeOutput::NodeOutput(Node *node, bNodeSocket *b_socket, DataType datatype)
|
||||
: node_(node), editorSocket_(b_socket), datatype_(datatype)
|
||||
: node_(node), editor_socket_(b_socket), datatype_(datatype)
|
||||
{
|
||||
}
|
||||
|
||||
float NodeOutput::getEditorValueFloat()
|
||||
float NodeOutput::get_editor_value_float()
|
||||
{
|
||||
PointerRNA ptr;
|
||||
RNA_pointer_create((ID *)getNode()->getbNodeTree(), &RNA_NodeSocket, getbNodeSocket(), &ptr);
|
||||
RNA_pointer_create((ID *)get_node()->get_bnodetree(), &RNA_NodeSocket, get_bnode_socket(), &ptr);
|
||||
return RNA_float_get(&ptr, "default_value");
|
||||
}
|
||||
|
||||
void NodeOutput::getEditorValueColor(float *value)
|
||||
void NodeOutput::get_editor_value_color(float *value)
|
||||
{
|
||||
PointerRNA ptr;
|
||||
RNA_pointer_create((ID *)getNode()->getbNodeTree(), &RNA_NodeSocket, getbNodeSocket(), &ptr);
|
||||
RNA_pointer_create((ID *)get_node()->get_bnodetree(), &RNA_NodeSocket, get_bnode_socket(), &ptr);
|
||||
return RNA_float_get_array(&ptr, "default_value", value);
|
||||
}
|
||||
|
||||
void NodeOutput::getEditorValueVector(float *value)
|
||||
void NodeOutput::get_editor_value_vector(float *value)
|
||||
{
|
||||
PointerRNA ptr;
|
||||
RNA_pointer_create((ID *)getNode()->getbNodeTree(), &RNA_NodeSocket, getbNodeSocket(), &ptr);
|
||||
RNA_pointer_create((ID *)get_node()->get_bnodetree(), &RNA_NodeSocket, get_bnode_socket(), &ptr);
|
||||
return RNA_float_get_array(&ptr, "default_value", value);
|
||||
}
|
||||
|
||||
|
||||
@@ -41,22 +41,22 @@ class Node {
|
||||
/**
|
||||
* \brief stores the reference to the SDNA bNode struct
|
||||
*/
|
||||
bNodeTree *editorNodeTree_;
|
||||
bNodeTree *editor_node_tree_;
|
||||
|
||||
/**
|
||||
* \brief stores the reference to the SDNA bNode struct
|
||||
*/
|
||||
bNode *editorNode_;
|
||||
bNode *editor_node_;
|
||||
|
||||
/**
|
||||
* \brief Is this node part of the active group
|
||||
*/
|
||||
bool inActiveGroup_;
|
||||
bool in_active_group_;
|
||||
|
||||
/**
|
||||
* \brief Instance key to identify the node in an instance hash table
|
||||
*/
|
||||
bNodeInstanceKey instanceKey_;
|
||||
bNodeInstanceKey instance_key_;
|
||||
|
||||
protected:
|
||||
/**
|
||||
@@ -70,23 +70,23 @@ class Node {
|
||||
Vector<NodeOutput *> outputs;
|
||||
|
||||
public:
|
||||
Node(bNode *editorNode, bool create_sockets = true);
|
||||
Node(bNode *editor_node, bool create_sockets = true);
|
||||
virtual ~Node();
|
||||
|
||||
/**
|
||||
* \brief get the reference to the SDNA bNode struct
|
||||
*/
|
||||
bNode *getbNode() const
|
||||
bNode *get_bnode() const
|
||||
{
|
||||
return editorNode_;
|
||||
return editor_node_;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief get the reference to the SDNA bNodeTree struct
|
||||
*/
|
||||
bNodeTree *getbNodeTree() const
|
||||
bNodeTree *get_bnodetree() const
|
||||
{
|
||||
return editorNodeTree_;
|
||||
return editor_node_tree_;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -95,24 +95,24 @@ class Node {
|
||||
* node for highlight during execution.
|
||||
* \param bNode:
|
||||
*/
|
||||
void setbNode(bNode *node)
|
||||
void set_bnode(bNode *node)
|
||||
{
|
||||
editorNode_ = node;
|
||||
editor_node_ = node;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief set the reference to the bNodeTree
|
||||
* \param bNodeTree:
|
||||
*/
|
||||
void setbNodeTree(bNodeTree *nodetree)
|
||||
void set_bnodetree(bNodeTree *nodetree)
|
||||
{
|
||||
editorNodeTree_ = nodetree;
|
||||
editor_node_tree_ = nodetree;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief get access to the vector of input sockets
|
||||
*/
|
||||
const Vector<NodeInput *> &getInputSockets() const
|
||||
const Vector<NodeInput *> &get_input_sockets() const
|
||||
{
|
||||
return this->inputs;
|
||||
}
|
||||
@@ -120,7 +120,7 @@ class Node {
|
||||
/**
|
||||
* \brief get access to the vector of input sockets
|
||||
*/
|
||||
const Vector<NodeOutput *> &getOutputSockets() const
|
||||
const Vector<NodeOutput *> &get_output_sockets() const
|
||||
{
|
||||
return this->outputs;
|
||||
}
|
||||
@@ -130,22 +130,22 @@ class Node {
|
||||
* \param index:
|
||||
* the index of the needed outputsocket
|
||||
*/
|
||||
NodeOutput *getOutputSocket(const unsigned int index = 0) const;
|
||||
NodeOutput *get_output_socket(const unsigned int index = 0) const;
|
||||
|
||||
/**
|
||||
* get the reference to a certain inputsocket
|
||||
* \param index:
|
||||
* the index of the needed inputsocket
|
||||
*/
|
||||
NodeInput *getInputSocket(const unsigned int index) const;
|
||||
NodeInput *get_input_socket(const unsigned int index) const;
|
||||
|
||||
/**
|
||||
* \brief Is this node in the active group (the group that is being edited)
|
||||
* \param isInActiveGroup:
|
||||
* \param is_in_active_group:
|
||||
*/
|
||||
void setIsInActiveGroup(bool value)
|
||||
void set_is_in_active_group(bool value)
|
||||
{
|
||||
inActiveGroup_ = value;
|
||||
in_active_group_ = value;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -154,9 +154,9 @@ class Node {
|
||||
* the active group will be the main tree (all nodes that are not part of a group will be active)
|
||||
* \return bool [false:true]
|
||||
*/
|
||||
inline bool isInActiveGroup() const
|
||||
inline bool is_in_active_group() const
|
||||
{
|
||||
return inActiveGroup_;
|
||||
return in_active_group_;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -167,16 +167,16 @@ class Node {
|
||||
* \param system: the ExecutionSystem where the operations need to be added
|
||||
* \param context: reference to the CompositorContext
|
||||
*/
|
||||
virtual void convertToOperations(NodeConverter &converter,
|
||||
const CompositorContext &context) const = 0;
|
||||
virtual void convert_to_operations(NodeConverter &converter,
|
||||
const CompositorContext &context) const = 0;
|
||||
|
||||
void setInstanceKey(bNodeInstanceKey instance_key)
|
||||
void set_instance_key(bNodeInstanceKey instance_key)
|
||||
{
|
||||
instanceKey_ = instance_key;
|
||||
instance_key_ = instance_key;
|
||||
}
|
||||
bNodeInstanceKey getInstanceKey() const
|
||||
bNodeInstanceKey get_instance_key() const
|
||||
{
|
||||
return instanceKey_;
|
||||
return instance_key_;
|
||||
}
|
||||
|
||||
protected:
|
||||
@@ -185,19 +185,19 @@ class Node {
|
||||
* \note may only be called in an constructor
|
||||
* \param socket: the NodeInput to add
|
||||
*/
|
||||
void addInputSocket(DataType datatype);
|
||||
void addInputSocket(DataType datatype, bNodeSocket *socket);
|
||||
void add_input_socket(DataType datatype);
|
||||
void add_input_socket(DataType datatype, bNodeSocket *socket);
|
||||
|
||||
/**
|
||||
* \brief add an NodeOutput to the collection of output-sockets
|
||||
* \note may only be called in an constructor
|
||||
* \param socket: the NodeOutput to add
|
||||
*/
|
||||
void addOutputSocket(DataType datatype);
|
||||
void addOutputSocket(DataType datatype, bNodeSocket *socket);
|
||||
void add_output_socket(DataType datatype);
|
||||
void add_output_socket(DataType datatype, bNodeSocket *socket);
|
||||
|
||||
bNodeSocket *getEditorInputSocket(int editorNodeInputSocketIndex);
|
||||
bNodeSocket *getEditorOutputSocket(int editorNodeOutputSocketIndex);
|
||||
bNodeSocket *get_editor_input_socket(int editor_node_input_socket_index);
|
||||
bNodeSocket *get_editor_output_socket(int editor_node_output_socket_index);
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -207,7 +207,7 @@ class Node {
|
||||
class NodeInput {
|
||||
private:
|
||||
Node *node_;
|
||||
bNodeSocket *editorSocket_;
|
||||
bNodeSocket *editor_socket_;
|
||||
|
||||
DataType datatype_;
|
||||
|
||||
@@ -220,32 +220,32 @@ class NodeInput {
|
||||
public:
|
||||
NodeInput(Node *node, bNodeSocket *b_socket, DataType datatype);
|
||||
|
||||
Node *getNode() const
|
||||
Node *get_node() const
|
||||
{
|
||||
return node_;
|
||||
}
|
||||
DataType getDataType() const
|
||||
DataType get_data_type() const
|
||||
{
|
||||
return datatype_;
|
||||
}
|
||||
bNodeSocket *getbNodeSocket() const
|
||||
bNodeSocket *get_bnode_socket() const
|
||||
{
|
||||
return editorSocket_;
|
||||
return editor_socket_;
|
||||
}
|
||||
|
||||
void setLink(NodeOutput *link);
|
||||
bool isLinked() const
|
||||
void set_link(NodeOutput *link);
|
||||
bool is_linked() const
|
||||
{
|
||||
return link_;
|
||||
}
|
||||
NodeOutput *getLink()
|
||||
NodeOutput *get_link()
|
||||
{
|
||||
return link_;
|
||||
}
|
||||
|
||||
float getEditorValueFloat() const;
|
||||
void getEditorValueColor(float *value) const;
|
||||
void getEditorValueVector(float *value) const;
|
||||
float get_editor_value_float() const;
|
||||
void get_editor_value_color(float *value) const;
|
||||
void get_editor_value_vector(float *value) const;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -255,29 +255,29 @@ class NodeInput {
|
||||
class NodeOutput {
|
||||
private:
|
||||
Node *node_;
|
||||
bNodeSocket *editorSocket_;
|
||||
bNodeSocket *editor_socket_;
|
||||
|
||||
DataType datatype_;
|
||||
|
||||
public:
|
||||
NodeOutput(Node *node, bNodeSocket *b_socket, DataType datatype);
|
||||
|
||||
Node *getNode() const
|
||||
Node *get_node() const
|
||||
{
|
||||
return node_;
|
||||
}
|
||||
DataType getDataType() const
|
||||
DataType get_data_type() const
|
||||
{
|
||||
return datatype_;
|
||||
}
|
||||
bNodeSocket *getbNodeSocket() const
|
||||
bNodeSocket *get_bnode_socket() const
|
||||
{
|
||||
return editorSocket_;
|
||||
return editor_socket_;
|
||||
}
|
||||
|
||||
float getEditorValueFloat();
|
||||
void getEditorValueColor(float *value);
|
||||
void getEditorValueVector(float *value);
|
||||
float get_editor_value_float();
|
||||
void get_editor_value_color(float *value);
|
||||
void get_editor_value_vector(float *value);
|
||||
};
|
||||
|
||||
} // namespace blender::compositor
|
||||
|
||||
@@ -33,127 +33,128 @@ NodeConverter::NodeConverter(NodeOperationBuilder *builder) : builder_(builder)
|
||||
{
|
||||
}
|
||||
|
||||
void NodeConverter::addOperation(NodeOperation *operation)
|
||||
void NodeConverter::add_operation(NodeOperation *operation)
|
||||
{
|
||||
builder_->addOperation(operation);
|
||||
builder_->add_operation(operation);
|
||||
}
|
||||
|
||||
void NodeConverter::mapInputSocket(NodeInput *node_socket, NodeOperationInput *operation_socket)
|
||||
void NodeConverter::map_input_socket(NodeInput *node_socket, NodeOperationInput *operation_socket)
|
||||
{
|
||||
builder_->mapInputSocket(node_socket, operation_socket);
|
||||
builder_->map_input_socket(node_socket, operation_socket);
|
||||
}
|
||||
|
||||
void NodeConverter::mapOutputSocket(NodeOutput *node_socket, NodeOperationOutput *operation_socket)
|
||||
void NodeConverter::map_output_socket(NodeOutput *node_socket,
|
||||
NodeOperationOutput *operation_socket)
|
||||
{
|
||||
builder_->mapOutputSocket(node_socket, operation_socket);
|
||||
builder_->map_output_socket(node_socket, operation_socket);
|
||||
}
|
||||
|
||||
void NodeConverter::addLink(NodeOperationOutput *from, NodeOperationInput *to)
|
||||
void NodeConverter::add_link(NodeOperationOutput *from, NodeOperationInput *to)
|
||||
{
|
||||
builder_->addLink(from, to);
|
||||
builder_->add_link(from, to);
|
||||
}
|
||||
|
||||
void NodeConverter::addPreview(NodeOperationOutput *output)
|
||||
void NodeConverter::add_preview(NodeOperationOutput *output)
|
||||
{
|
||||
builder_->addPreview(output);
|
||||
builder_->add_preview(output);
|
||||
}
|
||||
|
||||
void NodeConverter::addNodeInputPreview(NodeInput *input)
|
||||
void NodeConverter::add_node_input_preview(NodeInput *input)
|
||||
{
|
||||
builder_->addNodeInputPreview(input);
|
||||
builder_->add_node_input_preview(input);
|
||||
}
|
||||
|
||||
NodeOperation *NodeConverter::setInvalidOutput(NodeOutput *output)
|
||||
NodeOperation *NodeConverter::set_invalid_output(NodeOutput *output)
|
||||
{
|
||||
/* this is a really bad situation - bring on the pink! - so artists know this is bad */
|
||||
const float warning_color[4] = {1.0f, 0.0f, 1.0f, 1.0f};
|
||||
|
||||
SetColorOperation *operation = new SetColorOperation();
|
||||
operation->setChannels(warning_color);
|
||||
operation->set_channels(warning_color);
|
||||
|
||||
builder_->addOperation(operation);
|
||||
builder_->mapOutputSocket(output, operation->getOutputSocket());
|
||||
builder_->add_operation(operation);
|
||||
builder_->map_output_socket(output, operation->get_output_socket());
|
||||
|
||||
return operation;
|
||||
}
|
||||
|
||||
NodeOperationOutput *NodeConverter::addInputProxy(NodeInput *input, bool use_conversion)
|
||||
NodeOperationOutput *NodeConverter::add_input_proxy(NodeInput *input, bool use_conversion)
|
||||
{
|
||||
SocketProxyOperation *proxy = new SocketProxyOperation(input->getDataType(), use_conversion);
|
||||
builder_->addOperation(proxy);
|
||||
SocketProxyOperation *proxy = new SocketProxyOperation(input->get_data_type(), use_conversion);
|
||||
builder_->add_operation(proxy);
|
||||
|
||||
builder_->mapInputSocket(input, proxy->getInputSocket(0));
|
||||
builder_->map_input_socket(input, proxy->get_input_socket(0));
|
||||
|
||||
return proxy->getOutputSocket();
|
||||
return proxy->get_output_socket();
|
||||
}
|
||||
|
||||
NodeOperationInput *NodeConverter::addOutputProxy(NodeOutput *output, bool use_conversion)
|
||||
NodeOperationInput *NodeConverter::add_output_proxy(NodeOutput *output, bool use_conversion)
|
||||
{
|
||||
SocketProxyOperation *proxy = new SocketProxyOperation(output->getDataType(), use_conversion);
|
||||
builder_->addOperation(proxy);
|
||||
SocketProxyOperation *proxy = new SocketProxyOperation(output->get_data_type(), use_conversion);
|
||||
builder_->add_operation(proxy);
|
||||
|
||||
builder_->mapOutputSocket(output, proxy->getOutputSocket());
|
||||
builder_->map_output_socket(output, proxy->get_output_socket());
|
||||
|
||||
return proxy->getInputSocket(0);
|
||||
return proxy->get_input_socket(0);
|
||||
}
|
||||
|
||||
void NodeConverter::addInputValue(NodeOperationInput *input, float value)
|
||||
void NodeConverter::add_input_value(NodeOperationInput *input, float value)
|
||||
{
|
||||
SetValueOperation *operation = new SetValueOperation();
|
||||
operation->setValue(value);
|
||||
operation->set_value(value);
|
||||
|
||||
builder_->addOperation(operation);
|
||||
builder_->addLink(operation->getOutputSocket(), input);
|
||||
builder_->add_operation(operation);
|
||||
builder_->add_link(operation->get_output_socket(), input);
|
||||
}
|
||||
|
||||
void NodeConverter::addInputColor(NodeOperationInput *input, const float value[4])
|
||||
void NodeConverter::add_input_color(NodeOperationInput *input, const float value[4])
|
||||
{
|
||||
SetColorOperation *operation = new SetColorOperation();
|
||||
operation->setChannels(value);
|
||||
operation->set_channels(value);
|
||||
|
||||
builder_->addOperation(operation);
|
||||
builder_->addLink(operation->getOutputSocket(), input);
|
||||
builder_->add_operation(operation);
|
||||
builder_->add_link(operation->get_output_socket(), input);
|
||||
}
|
||||
|
||||
void NodeConverter::addInputVector(NodeOperationInput *input, const float value[3])
|
||||
void NodeConverter::add_input_vector(NodeOperationInput *input, const float value[3])
|
||||
{
|
||||
SetVectorOperation *operation = new SetVectorOperation();
|
||||
operation->setVector(value);
|
||||
operation->set_vector(value);
|
||||
|
||||
builder_->addOperation(operation);
|
||||
builder_->addLink(operation->getOutputSocket(), input);
|
||||
builder_->add_operation(operation);
|
||||
builder_->add_link(operation->get_output_socket(), input);
|
||||
}
|
||||
|
||||
void NodeConverter::addOutputValue(NodeOutput *output, float value)
|
||||
void NodeConverter::add_output_value(NodeOutput *output, float value)
|
||||
{
|
||||
SetValueOperation *operation = new SetValueOperation();
|
||||
operation->setValue(value);
|
||||
operation->set_value(value);
|
||||
|
||||
builder_->addOperation(operation);
|
||||
builder_->mapOutputSocket(output, operation->getOutputSocket());
|
||||
builder_->add_operation(operation);
|
||||
builder_->map_output_socket(output, operation->get_output_socket());
|
||||
}
|
||||
|
||||
void NodeConverter::addOutputColor(NodeOutput *output, const float value[4])
|
||||
void NodeConverter::add_output_color(NodeOutput *output, const float value[4])
|
||||
{
|
||||
SetColorOperation *operation = new SetColorOperation();
|
||||
operation->setChannels(value);
|
||||
operation->set_channels(value);
|
||||
|
||||
builder_->addOperation(operation);
|
||||
builder_->mapOutputSocket(output, operation->getOutputSocket());
|
||||
builder_->add_operation(operation);
|
||||
builder_->map_output_socket(output, operation->get_output_socket());
|
||||
}
|
||||
|
||||
void NodeConverter::addOutputVector(NodeOutput *output, const float value[3])
|
||||
void NodeConverter::add_output_vector(NodeOutput *output, const float value[3])
|
||||
{
|
||||
SetVectorOperation *operation = new SetVectorOperation();
|
||||
operation->setVector(value);
|
||||
operation->set_vector(value);
|
||||
|
||||
builder_->addOperation(operation);
|
||||
builder_->mapOutputSocket(output, operation->getOutputSocket());
|
||||
builder_->add_operation(operation);
|
||||
builder_->map_output_socket(output, operation->get_output_socket());
|
||||
}
|
||||
|
||||
void NodeConverter::registerViewer(ViewerOperation *viewer)
|
||||
void NodeConverter::register_viewer(ViewerOperation *viewer)
|
||||
{
|
||||
builder_->registerViewer(viewer);
|
||||
builder_->register_viewer(viewer);
|
||||
}
|
||||
|
||||
ViewerOperation *NodeConverter::active_viewer() const
|
||||
|
||||
@@ -36,7 +36,7 @@ class ViewerOperation;
|
||||
|
||||
/**
|
||||
* Interface type for converting a \a Node into \a NodeOperation.
|
||||
* This is passed to \a Node::convertToOperation methods and allows them
|
||||
* This is passed to \a Node::convert_to_operation methods and allows them
|
||||
* to register any number of operations, create links between them,
|
||||
* and map original node sockets to their inputs or outputs.
|
||||
*/
|
||||
@@ -48,7 +48,7 @@ class NodeConverter {
|
||||
* Insert a new operation into the operations graph.
|
||||
* The operation must be created by the node.
|
||||
*/
|
||||
void addOperation(NodeOperation *operation);
|
||||
void add_operation(NodeOperation *operation);
|
||||
|
||||
/**
|
||||
* Map input socket of the node to an operation socket.
|
||||
@@ -57,7 +57,7 @@ class NodeConverter {
|
||||
*
|
||||
* \note A \a Node input can be mapped to multiple \a NodeOperation inputs.
|
||||
*/
|
||||
void mapInputSocket(NodeInput *node_socket, NodeOperationInput *operation_socket);
|
||||
void map_input_socket(NodeInput *node_socket, NodeOperationInput *operation_socket);
|
||||
/**
|
||||
* Map output socket of the node to an operation socket.
|
||||
* Links between nodes will then generate equivalent links between
|
||||
@@ -66,51 +66,51 @@ class NodeConverter {
|
||||
* \note A \a Node output can only be mapped to one \a NodeOperation output.
|
||||
* Any existing operation output mapping will be replaced.
|
||||
*/
|
||||
void mapOutputSocket(NodeOutput *node_socket, NodeOperationOutput *operation_socket);
|
||||
void map_output_socket(NodeOutput *node_socket, NodeOperationOutput *operation_socket);
|
||||
|
||||
/**
|
||||
* Create a proxy operation for a node input.
|
||||
* This operation will be removed later and replaced
|
||||
* by direct links between the connected operations.
|
||||
*/
|
||||
NodeOperationOutput *addInputProxy(NodeInput *input, bool use_conversion);
|
||||
NodeOperationOutput *add_input_proxy(NodeInput *input, bool use_conversion);
|
||||
/**
|
||||
* Create a proxy operation for a node output.
|
||||
* This operation will be removed later and replaced
|
||||
* by direct links between the connected operations.
|
||||
*/
|
||||
NodeOperationInput *addOutputProxy(NodeOutput *output, bool use_conversion);
|
||||
NodeOperationInput *add_output_proxy(NodeOutput *output, bool use_conversion);
|
||||
|
||||
/** Define a constant input value. */
|
||||
void addInputValue(NodeOperationInput *input, float value);
|
||||
void add_input_value(NodeOperationInput *input, float value);
|
||||
/** Define a constant input color. */
|
||||
void addInputColor(NodeOperationInput *input, const float value[4]);
|
||||
void add_input_color(NodeOperationInput *input, const float value[4]);
|
||||
/** Define a constant input vector. */
|
||||
void addInputVector(NodeOperationInput *input, const float value[3]);
|
||||
void add_input_vector(NodeOperationInput *input, const float value[3]);
|
||||
|
||||
/** Define a constant output value. */
|
||||
void addOutputValue(NodeOutput *output, float value);
|
||||
void add_output_value(NodeOutput *output, float value);
|
||||
/** Define a constant output color. */
|
||||
void addOutputColor(NodeOutput *output, const float value[4]);
|
||||
void add_output_color(NodeOutput *output, const float value[4]);
|
||||
/** Define a constant output vector. */
|
||||
void addOutputVector(NodeOutput *output, const float value[3]);
|
||||
void add_output_vector(NodeOutput *output, const float value[3]);
|
||||
|
||||
/** Add an explicit link between two operations. */
|
||||
void addLink(NodeOperationOutput *from, NodeOperationInput *to);
|
||||
void add_link(NodeOperationOutput *from, NodeOperationInput *to);
|
||||
|
||||
/** Add a preview operation for a operation output. */
|
||||
void addPreview(NodeOperationOutput *output);
|
||||
void add_preview(NodeOperationOutput *output);
|
||||
/** Add a preview operation for a node input. */
|
||||
void addNodeInputPreview(NodeInput *input);
|
||||
void add_node_input_preview(NodeInput *input);
|
||||
|
||||
/**
|
||||
* When a node has no valid data
|
||||
* \note missing image / group pointer, or missing renderlayer from EXR
|
||||
*/
|
||||
NodeOperation *setInvalidOutput(NodeOutput *output);
|
||||
NodeOperation *set_invalid_output(NodeOutput *output);
|
||||
|
||||
/** Define a viewer operation as the active output, if possible */
|
||||
void registerViewer(ViewerOperation *viewer);
|
||||
void register_viewer(ViewerOperation *viewer);
|
||||
/** The currently active viewer output operation */
|
||||
ViewerOperation *active_viewer() const;
|
||||
|
||||
|
||||
@@ -71,21 +71,21 @@ void NodeGraph::add_node(Node *node,
|
||||
bNodeInstanceKey key,
|
||||
bool is_active_group)
|
||||
{
|
||||
node->setbNodeTree(b_ntree);
|
||||
node->setInstanceKey(key);
|
||||
node->setIsInActiveGroup(is_active_group);
|
||||
node->set_bnodetree(b_ntree);
|
||||
node->set_instance_key(key);
|
||||
node->set_is_in_active_group(is_active_group);
|
||||
|
||||
nodes_.append(node);
|
||||
|
||||
DebugInfo::node_added(node);
|
||||
}
|
||||
|
||||
void NodeGraph::add_link(NodeOutput *fromSocket, NodeInput *toSocket)
|
||||
void NodeGraph::add_link(NodeOutput *from_socket, NodeInput *to_socket)
|
||||
{
|
||||
links_.append(Link(fromSocket, toSocket));
|
||||
links_.append(Link(from_socket, to_socket));
|
||||
|
||||
/* register with the input */
|
||||
toSocket->setLink(fromSocket);
|
||||
to_socket->set_link(from_socket);
|
||||
}
|
||||
|
||||
void NodeGraph::add_bNodeTree(const CompositorContext &context,
|
||||
@@ -93,7 +93,7 @@ void NodeGraph::add_bNodeTree(const CompositorContext &context,
|
||||
bNodeTree *tree,
|
||||
bNodeInstanceKey parent_key)
|
||||
{
|
||||
const bNodeTree *basetree = context.getbNodeTree();
|
||||
const bNodeTree *basetree = context.get_bnodetree();
|
||||
|
||||
/* Update viewers in the active edit-tree as well the base tree (for backdrop). */
|
||||
bool is_active_group = (parent_key.value == basetree->active_viewer_key.value);
|
||||
@@ -124,7 +124,7 @@ void NodeGraph::add_bNode(const CompositorContext &context,
|
||||
}
|
||||
|
||||
/* replace slow nodes with proxies for fast execution */
|
||||
if (context.isFastCalculation() && !COM_bnode_is_fast_node(*b_node)) {
|
||||
if (context.is_fast_calculation() && !COM_bnode_is_fast_node(*b_node)) {
|
||||
add_proxies_skip(b_ntree, b_node, key, is_active_group);
|
||||
return;
|
||||
}
|
||||
@@ -149,8 +149,8 @@ NodeOutput *NodeGraph::find_output(const NodeRange &node_range, bNodeSocket *b_s
|
||||
{
|
||||
for (Vector<Node *>::iterator it = node_range.first; it != node_range.second; ++it) {
|
||||
Node *node = *it;
|
||||
for (NodeOutput *output : node->getOutputSockets()) {
|
||||
if (output->getbNodeSocket() == b_socket) {
|
||||
for (NodeOutput *output : node->get_output_sockets()) {
|
||||
if (output->get_bnode_socket() == b_socket) {
|
||||
return output;
|
||||
}
|
||||
}
|
||||
@@ -180,8 +180,8 @@ void NodeGraph::add_bNodeLink(const NodeRange &node_range, bNodeLink *b_nodelink
|
||||
|
||||
for (Vector<Node *>::iterator it = node_range.first; it != node_range.second; ++it) {
|
||||
Node *node = *it;
|
||||
for (NodeInput *input : node->getInputSockets()) {
|
||||
if (input->getbNodeSocket() == b_nodelink->tosock && !input->isLinked()) {
|
||||
for (NodeInput *input : node->get_input_sockets()) {
|
||||
if (input->get_bnode_socket() == b_nodelink->tosock && !input->is_linked()) {
|
||||
add_link(output, input);
|
||||
}
|
||||
}
|
||||
@@ -258,7 +258,7 @@ void NodeGraph::add_proxies_group_outputs(const CompositorContext &context,
|
||||
b_sock_io = b_sock_io->next) {
|
||||
bNodeSocket *b_sock_group = find_b_node_output(b_node, b_sock_io->identifier);
|
||||
if (b_sock_group) {
|
||||
if (context.isGroupnodeBufferEnabled() &&
|
||||
if (context.is_groupnode_buffer_enabled() &&
|
||||
context.get_execution_model() == eExecutionModel::Tiled) {
|
||||
SocketBufferNode *buffer = new SocketBufferNode(b_node_io, b_sock_io, b_sock_group);
|
||||
add_node(buffer, b_group_tree, key, is_active_group);
|
||||
@@ -279,7 +279,7 @@ void NodeGraph::add_proxies_group(const CompositorContext &context,
|
||||
|
||||
/* missing node group datablock can happen with library linking */
|
||||
if (!b_group_tree) {
|
||||
/* This error case its handled in convertToOperations()
|
||||
/* This error case its handled in convert_to_operations()
|
||||
* so we don't get un-converted sockets. */
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@ class NodeGraph {
|
||||
static bNodeSocket *find_b_node_output(bNode *b_node, const char *identifier);
|
||||
|
||||
void add_node(Node *node, bNodeTree *b_ntree, bNodeInstanceKey key, bool is_active_group);
|
||||
void add_link(NodeOutput *fromSocket, NodeInput *toSocket);
|
||||
void add_link(NodeOutput *from_socket, NodeInput *to_socket);
|
||||
|
||||
void add_bNodeTree(const CompositorContext &context,
|
||||
int nodes_start,
|
||||
|
||||
@@ -40,7 +40,7 @@ NodeOperation::NodeOperation()
|
||||
/** Get constant value when operation is constant, otherwise return default_value. */
|
||||
float NodeOperation::get_constant_value_default(float default_value)
|
||||
{
|
||||
BLI_assert(outputs_.size() > 0 && getOutputSocket()->getDataType() == DataType::Value);
|
||||
BLI_assert(outputs_.size() > 0 && get_output_socket()->get_data_type() == DataType::Value);
|
||||
return *get_constant_elem_default(&default_value);
|
||||
}
|
||||
|
||||
@@ -74,23 +74,23 @@ std::optional<NodeOperationHash> NodeOperation::generate_hash()
|
||||
hash_params(canvas_.ymin, canvas_.ymax);
|
||||
if (outputs_.size() > 0) {
|
||||
BLI_assert(outputs_.size() == 1);
|
||||
hash_param(this->getOutputSocket()->getDataType());
|
||||
hash_param(this->get_output_socket()->get_data_type());
|
||||
}
|
||||
NodeOperationHash hash;
|
||||
hash.params_hash_ = params_hash_;
|
||||
|
||||
hash.parents_hash_ = 0;
|
||||
for (NodeOperationInput &socket : inputs_) {
|
||||
if (!socket.isConnected()) {
|
||||
if (!socket.is_connected()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
NodeOperation &input = socket.getLink()->getOperation();
|
||||
NodeOperation &input = socket.get_link()->get_operation();
|
||||
const bool is_constant = input.get_flags().is_constant_operation;
|
||||
combine_hashes(hash.parents_hash_, get_default_hash(is_constant));
|
||||
if (is_constant) {
|
||||
const float *elem = ((ConstantOperation *)&input)->get_constant_elem();
|
||||
const int num_channels = COM_data_type_num_channels(socket.getDataType());
|
||||
const int num_channels = COM_data_type_num_channels(socket.get_data_type());
|
||||
for (const int i : IndexRange(num_channels)) {
|
||||
combine_hashes(hash.parents_hash_, get_default_hash(elem[i]));
|
||||
}
|
||||
@@ -106,22 +106,22 @@ std::optional<NodeOperationHash> NodeOperation::generate_hash()
|
||||
return hash;
|
||||
}
|
||||
|
||||
NodeOperationOutput *NodeOperation::getOutputSocket(unsigned int index)
|
||||
NodeOperationOutput *NodeOperation::get_output_socket(unsigned int index)
|
||||
{
|
||||
return &outputs_[index];
|
||||
}
|
||||
|
||||
NodeOperationInput *NodeOperation::getInputSocket(unsigned int index)
|
||||
NodeOperationInput *NodeOperation::get_input_socket(unsigned int index)
|
||||
{
|
||||
return &inputs_[index];
|
||||
}
|
||||
|
||||
void NodeOperation::addInputSocket(DataType datatype, ResizeMode resize_mode)
|
||||
void NodeOperation::add_input_socket(DataType datatype, ResizeMode resize_mode)
|
||||
{
|
||||
inputs_.append(NodeOperationInput(this, datatype, resize_mode));
|
||||
}
|
||||
|
||||
void NodeOperation::addOutputSocket(DataType datatype)
|
||||
void NodeOperation::add_output_socket(DataType datatype)
|
||||
{
|
||||
outputs_.append(NodeOperationOutput(this, datatype));
|
||||
}
|
||||
@@ -157,7 +157,7 @@ void NodeOperation::determine_canvas(const rcti &preferred_area, rcti &r_area)
|
||||
continue;
|
||||
}
|
||||
NodeOperationInput &input = inputs_[index];
|
||||
if (input.isConnected()) {
|
||||
if (input.is_connected()) {
|
||||
input.determine_canvas(local_preferred_area, unused_area);
|
||||
}
|
||||
}
|
||||
@@ -172,32 +172,32 @@ void NodeOperation::init_data()
|
||||
{
|
||||
/* Pass. */
|
||||
}
|
||||
void NodeOperation::initExecution()
|
||||
void NodeOperation::init_execution()
|
||||
{
|
||||
/* pass */
|
||||
}
|
||||
|
||||
void NodeOperation::initMutex()
|
||||
void NodeOperation::init_mutex()
|
||||
{
|
||||
BLI_mutex_init(&mutex_);
|
||||
}
|
||||
|
||||
void NodeOperation::lockMutex()
|
||||
void NodeOperation::lock_mutex()
|
||||
{
|
||||
BLI_mutex_lock(&mutex_);
|
||||
}
|
||||
|
||||
void NodeOperation::unlockMutex()
|
||||
void NodeOperation::unlock_mutex()
|
||||
{
|
||||
BLI_mutex_unlock(&mutex_);
|
||||
}
|
||||
|
||||
void NodeOperation::deinitMutex()
|
||||
void NodeOperation::deinit_mutex()
|
||||
{
|
||||
BLI_mutex_end(&mutex_);
|
||||
}
|
||||
|
||||
void NodeOperation::deinitExecution()
|
||||
void NodeOperation::deinit_execution()
|
||||
{
|
||||
/* pass */
|
||||
}
|
||||
@@ -223,48 +223,48 @@ void NodeOperation::unset_canvas()
|
||||
flags.is_canvas_set = false;
|
||||
}
|
||||
|
||||
SocketReader *NodeOperation::getInputSocketReader(unsigned int inputSocketIndex)
|
||||
SocketReader *NodeOperation::get_input_socket_reader(unsigned int index)
|
||||
{
|
||||
return this->getInputSocket(inputSocketIndex)->getReader();
|
||||
return this->get_input_socket(index)->get_reader();
|
||||
}
|
||||
|
||||
NodeOperation *NodeOperation::getInputOperation(unsigned int inputSocketIndex)
|
||||
NodeOperation *NodeOperation::get_input_operation(int index)
|
||||
{
|
||||
NodeOperationInput *input = getInputSocket(inputSocketIndex);
|
||||
if (input && input->isConnected()) {
|
||||
return &input->getLink()->getOperation();
|
||||
NodeOperationInput *input = get_input_socket(index);
|
||||
if (input && input->is_connected()) {
|
||||
return &input->get_link()->get_operation();
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool NodeOperation::determineDependingAreaOfInterest(rcti *input,
|
||||
ReadBufferOperation *readOperation,
|
||||
rcti *output)
|
||||
bool NodeOperation::determine_depending_area_of_interest(rcti *input,
|
||||
ReadBufferOperation *read_operation,
|
||||
rcti *output)
|
||||
{
|
||||
if (inputs_.size() == 0) {
|
||||
BLI_rcti_init(output, input->xmin, input->xmax, input->ymin, input->ymax);
|
||||
return false;
|
||||
}
|
||||
|
||||
rcti tempOutput;
|
||||
rcti temp_output;
|
||||
bool first = true;
|
||||
for (int i = 0; i < getNumberOfInputSockets(); i++) {
|
||||
NodeOperation *inputOperation = this->getInputOperation(i);
|
||||
if (inputOperation &&
|
||||
inputOperation->determineDependingAreaOfInterest(input, readOperation, &tempOutput)) {
|
||||
for (int i = 0; i < get_number_of_input_sockets(); i++) {
|
||||
NodeOperation *input_operation = this->get_input_operation(i);
|
||||
if (input_operation && input_operation->determine_depending_area_of_interest(
|
||||
input, read_operation, &temp_output)) {
|
||||
if (first) {
|
||||
output->xmin = tempOutput.xmin;
|
||||
output->ymin = tempOutput.ymin;
|
||||
output->xmax = tempOutput.xmax;
|
||||
output->ymax = tempOutput.ymax;
|
||||
output->xmin = temp_output.xmin;
|
||||
output->ymin = temp_output.ymin;
|
||||
output->xmax = temp_output.xmax;
|
||||
output->ymax = temp_output.ymax;
|
||||
first = false;
|
||||
}
|
||||
else {
|
||||
output->xmin = MIN2(output->xmin, tempOutput.xmin);
|
||||
output->ymin = MIN2(output->ymin, tempOutput.ymin);
|
||||
output->xmax = MAX2(output->xmax, tempOutput.xmax);
|
||||
output->ymax = MAX2(output->ymax, tempOutput.ymax);
|
||||
output->xmin = MIN2(output->xmin, temp_output.xmin);
|
||||
output->ymin = MIN2(output->ymin, temp_output.ymin);
|
||||
output->xmax = MAX2(output->xmax, temp_output.xmax);
|
||||
output->ymax = MAX2(output->ymax, temp_output.ymax);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -297,7 +297,7 @@ void NodeOperation::get_area_of_interest(const int input_idx,
|
||||
else {
|
||||
/* Non full-frame operations never implement this method. To ensure correctness assume
|
||||
* whole area is used. */
|
||||
NodeOperation *input_op = getInputOperation(input_idx);
|
||||
NodeOperation *input_op = get_input_operation(input_idx);
|
||||
r_input_area = input_op->get_canvas();
|
||||
}
|
||||
}
|
||||
@@ -306,8 +306,8 @@ void NodeOperation::get_area_of_interest(NodeOperation *input_op,
|
||||
const rcti &output_area,
|
||||
rcti &r_input_area)
|
||||
{
|
||||
for (int i = 0; i < getNumberOfInputSockets(); i++) {
|
||||
if (input_op == getInputOperation(i)) {
|
||||
for (int i = 0; i < get_number_of_input_sockets(); i++) {
|
||||
if (input_op == get_input_operation(i)) {
|
||||
get_area_of_interest(i, output_area, r_input_area);
|
||||
return;
|
||||
}
|
||||
@@ -340,11 +340,11 @@ void NodeOperation::render_full_frame(MemoryBuffer *output_buf,
|
||||
Span<rcti> areas,
|
||||
Span<MemoryBuffer *> inputs_bufs)
|
||||
{
|
||||
initExecution();
|
||||
init_execution();
|
||||
for (const rcti &area : areas) {
|
||||
update_memory_buffer(output_buf, area, inputs_bufs);
|
||||
}
|
||||
deinitExecution();
|
||||
deinit_execution();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -356,18 +356,18 @@ void NodeOperation::render_full_frame_fallback(MemoryBuffer *output_buf,
|
||||
{
|
||||
Vector<NodeOperationOutput *> orig_input_links = replace_inputs_with_buffers(inputs_bufs);
|
||||
|
||||
initExecution();
|
||||
const bool is_output_operation = getNumberOfOutputSockets() == 0;
|
||||
init_execution();
|
||||
const bool is_output_operation = get_number_of_output_sockets() == 0;
|
||||
if (!is_output_operation && output_buf->is_a_single_elem()) {
|
||||
float *output_elem = output_buf->get_elem(0, 0);
|
||||
readSampled(output_elem, 0, 0, PixelSampler::Nearest);
|
||||
read_sampled(output_elem, 0, 0, PixelSampler::Nearest);
|
||||
}
|
||||
else {
|
||||
for (const rcti &rect : areas) {
|
||||
exec_system_->execute_work(rect, [=](const rcti &split_rect) {
|
||||
rcti tile_rect = split_rect;
|
||||
if (is_output_operation) {
|
||||
executeRegion(&tile_rect, 0);
|
||||
execute_region(&tile_rect, 0);
|
||||
}
|
||||
else {
|
||||
render_tile(output_buf, &tile_rect);
|
||||
@@ -375,7 +375,7 @@ void NodeOperation::render_full_frame_fallback(MemoryBuffer *output_buf,
|
||||
});
|
||||
}
|
||||
}
|
||||
deinitExecution();
|
||||
deinit_execution();
|
||||
|
||||
remove_buffers_and_restore_original_inputs(orig_input_links);
|
||||
}
|
||||
@@ -383,7 +383,7 @@ void NodeOperation::render_full_frame_fallback(MemoryBuffer *output_buf,
|
||||
void NodeOperation::render_tile(MemoryBuffer *output_buf, rcti *tile_rect)
|
||||
{
|
||||
const bool is_complex = get_flags().complex;
|
||||
void *tile_data = is_complex ? initializeTileData(tile_rect) : nullptr;
|
||||
void *tile_data = is_complex ? initialize_tile_data(tile_rect) : nullptr;
|
||||
const int elem_stride = output_buf->elem_stride;
|
||||
for (int y = tile_rect->ymin; y < tile_rect->ymax; y++) {
|
||||
float *output_elem = output_buf->get_elem(tile_rect->xmin, y);
|
||||
@@ -395,13 +395,13 @@ void NodeOperation::render_tile(MemoryBuffer *output_buf, rcti *tile_rect)
|
||||
}
|
||||
else {
|
||||
for (int x = tile_rect->xmin; x < tile_rect->xmax; x++) {
|
||||
readSampled(output_elem, x, y, PixelSampler::Nearest);
|
||||
read_sampled(output_elem, x, y, PixelSampler::Nearest);
|
||||
output_elem += elem_stride;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (tile_data) {
|
||||
deinitializeTileData(tile_rect, tile_data);
|
||||
deinitialize_tile_data(tile_rect, tile_data);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -411,14 +411,15 @@ void NodeOperation::render_tile(MemoryBuffer *output_buf, rcti *tile_rect)
|
||||
Vector<NodeOperationOutput *> NodeOperation::replace_inputs_with_buffers(
|
||||
Span<MemoryBuffer *> inputs_bufs)
|
||||
{
|
||||
BLI_assert(inputs_bufs.size() == getNumberOfInputSockets());
|
||||
BLI_assert(inputs_bufs.size() == get_number_of_input_sockets());
|
||||
Vector<NodeOperationOutput *> orig_links(inputs_bufs.size());
|
||||
for (int i = 0; i < inputs_bufs.size(); i++) {
|
||||
NodeOperationInput *input_socket = getInputSocket(i);
|
||||
BufferOperation *buffer_op = new BufferOperation(inputs_bufs[i], input_socket->getDataType());
|
||||
orig_links[i] = input_socket->getLink();
|
||||
input_socket->setLink(buffer_op->getOutputSocket());
|
||||
buffer_op->initExecution();
|
||||
NodeOperationInput *input_socket = get_input_socket(i);
|
||||
BufferOperation *buffer_op = new BufferOperation(inputs_bufs[i],
|
||||
input_socket->get_data_type());
|
||||
orig_links[i] = input_socket->get_link();
|
||||
input_socket->set_link(buffer_op->get_output_socket());
|
||||
buffer_op->init_execution();
|
||||
}
|
||||
return orig_links;
|
||||
}
|
||||
@@ -426,14 +427,14 @@ Vector<NodeOperationOutput *> NodeOperation::replace_inputs_with_buffers(
|
||||
void NodeOperation::remove_buffers_and_restore_original_inputs(
|
||||
Span<NodeOperationOutput *> original_inputs_links)
|
||||
{
|
||||
BLI_assert(original_inputs_links.size() == getNumberOfInputSockets());
|
||||
BLI_assert(original_inputs_links.size() == get_number_of_input_sockets());
|
||||
for (int i = 0; i < original_inputs_links.size(); i++) {
|
||||
NodeOperation *buffer_op = get_input_operation(i);
|
||||
BLI_assert(buffer_op != nullptr);
|
||||
BLI_assert(typeid(*buffer_op) == typeid(BufferOperation));
|
||||
buffer_op->deinitExecution();
|
||||
NodeOperationInput *input_socket = getInputSocket(i);
|
||||
input_socket->setLink(original_inputs_links[i]);
|
||||
buffer_op->deinit_execution();
|
||||
NodeOperationInput *input_socket = get_input_socket(i);
|
||||
input_socket->set_link(original_inputs_links[i]);
|
||||
delete buffer_op;
|
||||
}
|
||||
}
|
||||
@@ -444,15 +445,17 @@ void NodeOperation::remove_buffers_and_restore_original_inputs(
|
||||
**** OpInput ****
|
||||
*****************/
|
||||
|
||||
NodeOperationInput::NodeOperationInput(NodeOperation *op, DataType datatype, ResizeMode resizeMode)
|
||||
: operation_(op), datatype_(datatype), resizeMode_(resizeMode), link_(nullptr)
|
||||
NodeOperationInput::NodeOperationInput(NodeOperation *op,
|
||||
DataType datatype,
|
||||
ResizeMode resize_mode)
|
||||
: operation_(op), datatype_(datatype), resize_mode_(resize_mode), link_(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
SocketReader *NodeOperationInput::getReader()
|
||||
SocketReader *NodeOperationInput::get_reader()
|
||||
{
|
||||
if (isConnected()) {
|
||||
return &link_->getOperation();
|
||||
if (is_connected()) {
|
||||
return &link_->get_operation();
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
@@ -481,7 +484,7 @@ NodeOperationOutput::NodeOperationOutput(NodeOperation *op, DataType datatype)
|
||||
|
||||
void NodeOperationOutput::determine_canvas(const rcti &preferred_area, rcti &r_area)
|
||||
{
|
||||
NodeOperation &operation = getOperation();
|
||||
NodeOperation &operation = get_operation();
|
||||
if (operation.get_flags().is_canvas_set) {
|
||||
r_area = operation.get_canvas();
|
||||
}
|
||||
@@ -558,9 +561,9 @@ std::ostream &operator<<(std::ostream &os, const NodeOperation &node_operation)
|
||||
os << ",flags={" << flags << "}";
|
||||
if (flags.is_read_buffer_operation) {
|
||||
const ReadBufferOperation *read_operation = (const ReadBufferOperation *)&node_operation;
|
||||
const MemoryProxy *proxy = read_operation->getMemoryProxy();
|
||||
const MemoryProxy *proxy = read_operation->get_memory_proxy();
|
||||
if (proxy) {
|
||||
const WriteBufferOperation *write_operation = proxy->getWriteBufferOperation();
|
||||
const WriteBufferOperation *write_operation = proxy->get_write_buffer_operation();
|
||||
if (write_operation) {
|
||||
os << ",write=" << (NodeOperation &)*write_operation;
|
||||
}
|
||||
|
||||
@@ -91,7 +91,7 @@ class NodeOperationInput {
|
||||
DataType datatype_;
|
||||
|
||||
/** Resize mode of this socket */
|
||||
ResizeMode resizeMode_;
|
||||
ResizeMode resize_mode_;
|
||||
|
||||
/** Connected output */
|
||||
NodeOperationOutput *link_;
|
||||
@@ -99,40 +99,40 @@ class NodeOperationInput {
|
||||
public:
|
||||
NodeOperationInput(NodeOperation *op,
|
||||
DataType datatype,
|
||||
ResizeMode resizeMode = ResizeMode::Center);
|
||||
ResizeMode resize_mode = ResizeMode::Center);
|
||||
|
||||
NodeOperation &getOperation() const
|
||||
NodeOperation &get_operation() const
|
||||
{
|
||||
return *operation_;
|
||||
}
|
||||
DataType getDataType() const
|
||||
DataType get_data_type() const
|
||||
{
|
||||
return datatype_;
|
||||
}
|
||||
|
||||
void setLink(NodeOperationOutput *link)
|
||||
void set_link(NodeOperationOutput *link)
|
||||
{
|
||||
link_ = link;
|
||||
}
|
||||
NodeOperationOutput *getLink() const
|
||||
NodeOperationOutput *get_link() const
|
||||
{
|
||||
return link_;
|
||||
}
|
||||
bool isConnected() const
|
||||
bool is_connected() const
|
||||
{
|
||||
return link_;
|
||||
}
|
||||
|
||||
void setResizeMode(ResizeMode resizeMode)
|
||||
void set_resize_mode(ResizeMode resize_mode)
|
||||
{
|
||||
resizeMode_ = resizeMode;
|
||||
resize_mode_ = resize_mode;
|
||||
}
|
||||
ResizeMode getResizeMode() const
|
||||
ResizeMode get_resize_mode() const
|
||||
{
|
||||
return resizeMode_;
|
||||
return resize_mode_;
|
||||
}
|
||||
|
||||
SocketReader *getReader();
|
||||
SocketReader *get_reader();
|
||||
|
||||
bool determine_canvas(const rcti &preferred_area, rcti &r_area);
|
||||
|
||||
@@ -153,11 +153,11 @@ class NodeOperationOutput {
|
||||
public:
|
||||
NodeOperationOutput(NodeOperation *op, DataType datatype);
|
||||
|
||||
NodeOperation &getOperation() const
|
||||
NodeOperation &get_operation() const
|
||||
{
|
||||
return *operation_;
|
||||
}
|
||||
DataType getDataType() const
|
||||
DataType get_data_type() const
|
||||
{
|
||||
return datatype_;
|
||||
}
|
||||
@@ -334,9 +334,9 @@ class NodeOperation {
|
||||
* \note only use when you really know what you are doing.
|
||||
* this mutex is used to share data among chunks in the same operation
|
||||
* \see TonemapOperation for an example of usage
|
||||
* \see NodeOperation.initMutex initializes this mutex
|
||||
* \see NodeOperation.deinitMutex deinitializes this mutex
|
||||
* \see NodeOperation.getMutex retrieve a pointer to this mutex.
|
||||
* \see NodeOperation.init_mutex initializes this mutex
|
||||
* \see NodeOperation.deinit_mutex deinitializes this mutex
|
||||
* \see NodeOperation.get_mutex retrieve a pointer to this mutex.
|
||||
*/
|
||||
ThreadMutex mutex_;
|
||||
|
||||
@@ -395,28 +395,23 @@ class NodeOperation {
|
||||
|
||||
std::optional<NodeOperationHash> generate_hash();
|
||||
|
||||
unsigned int getNumberOfInputSockets() const
|
||||
unsigned int get_number_of_input_sockets() const
|
||||
{
|
||||
return inputs_.size();
|
||||
}
|
||||
unsigned int getNumberOfOutputSockets() const
|
||||
unsigned int get_number_of_output_sockets() const
|
||||
{
|
||||
return outputs_.size();
|
||||
}
|
||||
NodeOperationOutput *getOutputSocket(unsigned int index = 0);
|
||||
NodeOperationInput *getInputSocket(unsigned int index);
|
||||
NodeOperationOutput *get_output_socket(unsigned int index = 0);
|
||||
NodeOperationInput *get_input_socket(unsigned int index);
|
||||
|
||||
NodeOperation *get_input_operation(int index)
|
||||
{
|
||||
/* TODO: Rename protected getInputOperation to get_input_operation and make it public replacing
|
||||
* this method. */
|
||||
return getInputOperation(index);
|
||||
}
|
||||
NodeOperation *get_input_operation(int index);
|
||||
|
||||
virtual void determine_canvas(const rcti &preferred_area, rcti &r_area);
|
||||
|
||||
/**
|
||||
* \brief isOutputOperation determines whether this operation is an output of the
|
||||
* \brief is_output_operation determines whether this operation is an output of the
|
||||
* ExecutionSystem during rendering or editing.
|
||||
*
|
||||
* Default behavior if not overridden, this operation will not be evaluated as being an output
|
||||
@@ -430,7 +425,7 @@ class NodeOperation {
|
||||
*
|
||||
* \return bool the result of this method
|
||||
*/
|
||||
virtual bool isOutputOperation(bool /*rendering*/) const
|
||||
virtual bool is_output_operation(bool /*rendering*/) const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -440,7 +435,7 @@ class NodeOperation {
|
||||
execution_model_ = model;
|
||||
}
|
||||
|
||||
void setbNodeTree(const bNodeTree *tree)
|
||||
void set_bnodetree(const bNodeTree *tree)
|
||||
{
|
||||
btree_ = tree;
|
||||
}
|
||||
@@ -452,20 +447,20 @@ class NodeOperation {
|
||||
|
||||
/**
|
||||
* Initializes operation data needed after operations are linked and resolutions determined. For
|
||||
* rendering heap memory data use initExecution().
|
||||
* rendering heap memory data use init_execution().
|
||||
*/
|
||||
virtual void init_data();
|
||||
|
||||
virtual void initExecution();
|
||||
virtual void init_execution();
|
||||
|
||||
/**
|
||||
* \brief when a chunk is executed by a CPUDevice, this method is called
|
||||
* \ingroup execution
|
||||
* \param rect: the rectangle of the chunk (location and size)
|
||||
* \param chunkNumber: the chunkNumber to be calculated
|
||||
* \param memoryBuffers: all input MemoryBuffer's needed
|
||||
* \param chunk_number: the chunk_number to be calculated
|
||||
* \param memory_buffers: all input MemoryBuffer's needed
|
||||
*/
|
||||
virtual void executeRegion(rcti * /*rect*/, unsigned int /*chunkNumber*/)
|
||||
virtual void execute_region(rcti * /*rect*/, unsigned int /*chunk_number*/)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -477,15 +472,15 @@ class NodeOperation {
|
||||
* \param program: the OpenCL program containing all compositor kernels
|
||||
* \param queue: the OpenCL command queue of the device the chunk is executed on
|
||||
* \param rect: the rectangle of the chunk (location and size)
|
||||
* \param chunkNumber: the chunkNumber to be calculated
|
||||
* \param memoryBuffers: all input MemoryBuffer's needed
|
||||
* \param outputBuffer: the outputbuffer to write to
|
||||
* \param chunk_number: the chunk_number to be calculated
|
||||
* \param memory_buffers: all input MemoryBuffer's needed
|
||||
* \param output_buffer: the outputbuffer to write to
|
||||
*/
|
||||
virtual void executeOpenCLRegion(OpenCLDevice * /*device*/,
|
||||
rcti * /*rect*/,
|
||||
unsigned int /*chunkNumber*/,
|
||||
MemoryBuffer ** /*memoryBuffers*/,
|
||||
MemoryBuffer * /*outputBuffer*/)
|
||||
virtual void execute_opencl_region(OpenCLDevice * /*device*/,
|
||||
rcti * /*rect*/,
|
||||
unsigned int /*chunk_number*/,
|
||||
MemoryBuffer ** /*memory_buffers*/,
|
||||
MemoryBuffer * /*output_buffer*/)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -496,23 +491,23 @@ class NodeOperation {
|
||||
* \param context: the OpenCL context
|
||||
* \param program: the OpenCL program containing all compositor kernels
|
||||
* \param queue: the OpenCL command queue of the device the chunk is executed on
|
||||
* \param outputMemoryBuffer: the allocated memory buffer in main CPU memory
|
||||
* \param clOutputBuffer: the allocated memory buffer in OpenCLDevice memory
|
||||
* \param inputMemoryBuffers: all input MemoryBuffer's needed
|
||||
* \param clMemToCleanUp: all created cl_mem references must be added to this list.
|
||||
* \param output_memory_buffer: the allocated memory buffer in main CPU memory
|
||||
* \param cl_output_buffer: the allocated memory buffer in OpenCLDevice memory
|
||||
* \param input_memory_buffers: all input MemoryBuffer's needed
|
||||
* \param cl_mem_to_clean_up: all created cl_mem references must be added to this list.
|
||||
* Framework will clean this after execution
|
||||
* \param clKernelsToCleanUp: all created cl_kernel references must be added to this list.
|
||||
* \param cl_kernels_to_clean_up: all created cl_kernel references must be added to this list.
|
||||
* Framework will clean this after execution
|
||||
*/
|
||||
virtual void executeOpenCL(OpenCLDevice * /*device*/,
|
||||
MemoryBuffer * /*outputMemoryBuffer*/,
|
||||
cl_mem /*clOutputBuffer*/,
|
||||
MemoryBuffer ** /*inputMemoryBuffers*/,
|
||||
std::list<cl_mem> * /*clMemToCleanUp*/,
|
||||
std::list<cl_kernel> * /*clKernelsToCleanUp*/)
|
||||
virtual void execute_opencl(OpenCLDevice * /*device*/,
|
||||
MemoryBuffer * /*output_memory_buffer*/,
|
||||
cl_mem /*cl_output_buffer*/,
|
||||
MemoryBuffer ** /*input_memory_buffers*/,
|
||||
std::list<cl_mem> * /*cl_mem_to_clean_up*/,
|
||||
std::list<cl_kernel> * /*cl_kernels_to_clean_up*/)
|
||||
{
|
||||
}
|
||||
virtual void deinitExecution();
|
||||
virtual void deinit_execution();
|
||||
|
||||
void set_canvas(const rcti &canvas_area);
|
||||
const rcti &get_canvas() const;
|
||||
@@ -525,14 +520,14 @@ class NodeOperation {
|
||||
* \return [true:false]
|
||||
* \see BaseViewerOperation
|
||||
*/
|
||||
virtual bool isActiveViewerOutput() const
|
||||
virtual bool is_active_viewer_output() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
virtual bool determineDependingAreaOfInterest(rcti *input,
|
||||
ReadBufferOperation *readOperation,
|
||||
rcti *output);
|
||||
virtual bool determine_depending_area_of_interest(rcti *input,
|
||||
ReadBufferOperation *read_operation,
|
||||
rcti *output);
|
||||
|
||||
/**
|
||||
* \brief set the index of the input socket that will determine the canvas of this
|
||||
@@ -554,58 +549,58 @@ class NodeOperation {
|
||||
* \note only applicable for output operations like ViewerOperation
|
||||
* \return eCompositorPriority
|
||||
*/
|
||||
virtual eCompositorPriority getRenderPriority() const
|
||||
virtual eCompositorPriority get_render_priority() const
|
||||
{
|
||||
return eCompositorPriority::Low;
|
||||
}
|
||||
|
||||
inline bool isBraked() const
|
||||
inline bool is_braked() const
|
||||
{
|
||||
return btree_->test_break(btree_->tbh);
|
||||
}
|
||||
|
||||
inline void updateDraw()
|
||||
inline void update_draw()
|
||||
{
|
||||
if (btree_->update_draw) {
|
||||
btree_->update_draw(btree_->udh);
|
||||
}
|
||||
}
|
||||
|
||||
unsigned int getWidth() const
|
||||
unsigned int get_width() const
|
||||
{
|
||||
return BLI_rcti_size_x(&get_canvas());
|
||||
}
|
||||
|
||||
unsigned int getHeight() const
|
||||
unsigned int get_height() const
|
||||
{
|
||||
return BLI_rcti_size_y(&get_canvas());
|
||||
}
|
||||
|
||||
inline void readSampled(float result[4], float x, float y, PixelSampler sampler)
|
||||
inline void read_sampled(float result[4], float x, float y, PixelSampler sampler)
|
||||
{
|
||||
executePixelSampled(result, x, y, sampler);
|
||||
execute_pixel_sampled(result, x, y, sampler);
|
||||
}
|
||||
|
||||
inline void readFiltered(float result[4], float x, float y, float dx[2], float dy[2])
|
||||
inline void read_filtered(float result[4], float x, float y, float dx[2], float dy[2])
|
||||
{
|
||||
executePixelFiltered(result, x, y, dx, dy);
|
||||
execute_pixel_filtered(result, x, y, dx, dy);
|
||||
}
|
||||
|
||||
inline void read(float result[4], int x, int y, void *chunkData)
|
||||
inline void read(float result[4], int x, int y, void *chunk_data)
|
||||
{
|
||||
executePixel(result, x, y, chunkData);
|
||||
execute_pixel(result, x, y, chunk_data);
|
||||
}
|
||||
|
||||
virtual void *initializeTileData(rcti * /*rect*/)
|
||||
virtual void *initialize_tile_data(rcti * /*rect*/)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
virtual void deinitializeTileData(rcti * /*rect*/, void * /*data*/)
|
||||
virtual void deinitialize_tile_data(rcti * /*rect*/, void * /*data*/)
|
||||
{
|
||||
}
|
||||
|
||||
virtual MemoryBuffer *getInputMemoryBuffer(MemoryBuffer ** /*memoryBuffers*/)
|
||||
virtual MemoryBuffer *get_input_memory_buffer(MemoryBuffer ** /*memory_buffers*/)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@@ -614,7 +609,7 @@ class NodeOperation {
|
||||
* Return the meta data associated with this branch.
|
||||
*
|
||||
* The return parameter holds an instance or is an nullptr. */
|
||||
virtual std::unique_ptr<MetaData> getMetaData()
|
||||
virtual std::unique_ptr<MetaData> get_meta_data()
|
||||
{
|
||||
return std::unique_ptr<MetaData>();
|
||||
}
|
||||
@@ -672,28 +667,27 @@ class NodeOperation {
|
||||
combine_hashes(params_hash_, get_default_hash_3(param1, param2, param3));
|
||||
}
|
||||
|
||||
void addInputSocket(DataType datatype, ResizeMode resize_mode = ResizeMode::Center);
|
||||
void addOutputSocket(DataType datatype);
|
||||
void add_input_socket(DataType datatype, ResizeMode resize_mode = ResizeMode::Center);
|
||||
void add_output_socket(DataType datatype);
|
||||
|
||||
/* TODO(manzanilla): to be removed with tiled implementation. */
|
||||
void setWidth(unsigned int width)
|
||||
void set_width(unsigned int width)
|
||||
{
|
||||
canvas_.xmax = canvas_.xmin + width;
|
||||
this->flags.is_canvas_set = true;
|
||||
}
|
||||
void setHeight(unsigned int height)
|
||||
void set_height(unsigned int height)
|
||||
{
|
||||
canvas_.ymax = canvas_.ymin + height;
|
||||
this->flags.is_canvas_set = true;
|
||||
}
|
||||
|
||||
SocketReader *getInputSocketReader(unsigned int inputSocketindex);
|
||||
NodeOperation *getInputOperation(unsigned int inputSocketindex);
|
||||
SocketReader *get_input_socket_reader(unsigned int index);
|
||||
|
||||
void deinitMutex();
|
||||
void initMutex();
|
||||
void lockMutex();
|
||||
void unlockMutex();
|
||||
void deinit_mutex();
|
||||
void init_mutex();
|
||||
void lock_mutex();
|
||||
void unlock_mutex();
|
||||
|
||||
/**
|
||||
* \brief set whether this operation is complex
|
||||
@@ -701,7 +695,7 @@ class NodeOperation {
|
||||
* Complex operations are typically doing many reads to calculate the output of a single pixel.
|
||||
* Mostly Filter types (Blurs, Convolution, Defocus etc) need this to be set to true.
|
||||
*/
|
||||
void setComplex(bool complex)
|
||||
void set_complex(bool complex)
|
||||
{
|
||||
this->flags.complex = complex;
|
||||
}
|
||||
@@ -712,12 +706,12 @@ class NodeOperation {
|
||||
* \param result: is a float[4] array to store the result
|
||||
* \param x: the x-coordinate of the pixel to calculate in image space
|
||||
* \param y: the y-coordinate of the pixel to calculate in image space
|
||||
* \param inputBuffers: chunks that can be read by their ReadBufferOperation.
|
||||
* \param input_buffers: chunks that can be read by their ReadBufferOperation.
|
||||
*/
|
||||
virtual void executePixelSampled(float /*output*/[4],
|
||||
float /*x*/,
|
||||
float /*y*/,
|
||||
PixelSampler /*sampler*/)
|
||||
virtual void execute_pixel_sampled(float /*output*/[4],
|
||||
float /*x*/,
|
||||
float /*y*/,
|
||||
PixelSampler /*sampler*/)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -727,12 +721,12 @@ class NodeOperation {
|
||||
* \param result: is a float[4] array to store the result
|
||||
* \param x: the x-coordinate of the pixel to calculate in image space
|
||||
* \param y: the y-coordinate of the pixel to calculate in image space
|
||||
* \param inputBuffers: chunks that can be read by their ReadBufferOperation.
|
||||
* \param chunkData: chunk specific data a during execution time.
|
||||
* \param input_buffers: chunks that can be read by their ReadBufferOperation.
|
||||
* \param chunk_data: chunk specific data a during execution time.
|
||||
*/
|
||||
virtual void executePixel(float output[4], int x, int y, void * /*chunkData*/)
|
||||
virtual void execute_pixel(float output[4], int x, int y, void * /*chunk_data*/)
|
||||
{
|
||||
executePixelSampled(output, x, y, PixelSampler::Nearest);
|
||||
execute_pixel_sampled(output, x, y, PixelSampler::Nearest);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -743,9 +737,9 @@ class NodeOperation {
|
||||
* \param y: the y-coordinate of the pixel to calculate in image space
|
||||
* \param dx:
|
||||
* \param dy:
|
||||
* \param inputBuffers: chunks that can be read by their ReadBufferOperation.
|
||||
* \param input_buffers: chunks that can be read by their ReadBufferOperation.
|
||||
*/
|
||||
virtual void executePixelFiltered(
|
||||
virtual void execute_pixel_filtered(
|
||||
float /*output*/[4], float /*x*/, float /*y*/, float /*dx*/[2], float /*dy*/[2])
|
||||
{
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ NodeOperationBuilder::NodeOperationBuilder(const CompositorContext *context,
|
||||
graph_.from_bNodeTree(*context, b_nodetree);
|
||||
}
|
||||
|
||||
void NodeOperationBuilder::convertToOperations(ExecutionSystem *system)
|
||||
void NodeOperationBuilder::convert_to_operations(ExecutionSystem *system)
|
||||
{
|
||||
/* interface handle for nodes */
|
||||
NodeConverter converter(this);
|
||||
@@ -54,7 +54,7 @@ void NodeOperationBuilder::convertToOperations(ExecutionSystem *system)
|
||||
current_node_ = node;
|
||||
|
||||
DebugInfo::node_to_operations(node);
|
||||
node->convertToOperations(converter, *context_);
|
||||
node->convert_to_operations(converter, *context_);
|
||||
}
|
||||
|
||||
current_node_ = nullptr;
|
||||
@@ -86,7 +86,7 @@ void NodeOperationBuilder::convertToOperations(ExecutionSystem *system)
|
||||
}
|
||||
|
||||
for (NodeOperationInput *op_to : op_to_list) {
|
||||
addLink(op_from, op_to);
|
||||
add_link(op_from, op_to);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -130,12 +130,12 @@ void NodeOperationBuilder::convertToOperations(ExecutionSystem *system)
|
||||
system->set_operations(operations_, groups_);
|
||||
}
|
||||
|
||||
void NodeOperationBuilder::addOperation(NodeOperation *operation)
|
||||
void NodeOperationBuilder::add_operation(NodeOperation *operation)
|
||||
{
|
||||
operation->set_id(operations_.size());
|
||||
operations_.append(operation);
|
||||
if (current_node_) {
|
||||
operation->set_name(current_node_->getbNode()->name);
|
||||
operation->set_name(current_node_->get_bnode()->name);
|
||||
}
|
||||
operation->set_execution_model(context_->get_execution_model());
|
||||
operation->set_execution_system(exec_system_);
|
||||
@@ -144,9 +144,9 @@ void NodeOperationBuilder::addOperation(NodeOperation *operation)
|
||||
void NodeOperationBuilder::replace_operation_with_constant(NodeOperation *operation,
|
||||
ConstantOperation *constant_operation)
|
||||
{
|
||||
BLI_assert(constant_operation->getNumberOfInputSockets() == 0);
|
||||
BLI_assert(constant_operation->get_number_of_input_sockets() == 0);
|
||||
unlink_inputs_and_relink_outputs(operation, constant_operation);
|
||||
addOperation(constant_operation);
|
||||
add_operation(constant_operation);
|
||||
}
|
||||
|
||||
void NodeOperationBuilder::unlink_inputs_and_relink_outputs(NodeOperation *unlinked_op,
|
||||
@@ -155,61 +155,61 @@ void NodeOperationBuilder::unlink_inputs_and_relink_outputs(NodeOperation *unlin
|
||||
int i = 0;
|
||||
while (i < links_.size()) {
|
||||
Link &link = links_[i];
|
||||
if (&link.to()->getOperation() == unlinked_op) {
|
||||
link.to()->setLink(nullptr);
|
||||
if (&link.to()->get_operation() == unlinked_op) {
|
||||
link.to()->set_link(nullptr);
|
||||
links_.remove(i);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (&link.from()->getOperation() == unlinked_op) {
|
||||
link.to()->setLink(linked_op->getOutputSocket());
|
||||
links_[i] = Link(linked_op->getOutputSocket(), link.to());
|
||||
if (&link.from()->get_operation() == unlinked_op) {
|
||||
link.to()->set_link(linked_op->get_output_socket());
|
||||
links_[i] = Link(linked_op->get_output_socket(), link.to());
|
||||
}
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
void NodeOperationBuilder::mapInputSocket(NodeInput *node_socket,
|
||||
NodeOperationInput *operation_socket)
|
||||
void NodeOperationBuilder::map_input_socket(NodeInput *node_socket,
|
||||
NodeOperationInput *operation_socket)
|
||||
{
|
||||
BLI_assert(current_node_);
|
||||
BLI_assert(node_socket->getNode() == current_node_);
|
||||
BLI_assert(node_socket->get_node() == current_node_);
|
||||
|
||||
/* NOTE: this maps operation sockets to node sockets.
|
||||
* for resolving links the map will be inverted first in convertToOperations,
|
||||
* for resolving links the map will be inverted first in convert_to_operations,
|
||||
* to get a list of links for each node input socket.
|
||||
*/
|
||||
input_map_.add_new(operation_socket, node_socket);
|
||||
}
|
||||
|
||||
void NodeOperationBuilder::mapOutputSocket(NodeOutput *node_socket,
|
||||
NodeOperationOutput *operation_socket)
|
||||
void NodeOperationBuilder::map_output_socket(NodeOutput *node_socket,
|
||||
NodeOperationOutput *operation_socket)
|
||||
{
|
||||
BLI_assert(current_node_);
|
||||
BLI_assert(node_socket->getNode() == current_node_);
|
||||
BLI_assert(node_socket->get_node() == current_node_);
|
||||
|
||||
output_map_.add_new(node_socket, operation_socket);
|
||||
}
|
||||
|
||||
void NodeOperationBuilder::addLink(NodeOperationOutput *from, NodeOperationInput *to)
|
||||
void NodeOperationBuilder::add_link(NodeOperationOutput *from, NodeOperationInput *to)
|
||||
{
|
||||
if (to->isConnected()) {
|
||||
if (to->is_connected()) {
|
||||
return;
|
||||
}
|
||||
|
||||
links_.append(Link(from, to));
|
||||
|
||||
/* register with the input */
|
||||
to->setLink(from);
|
||||
to->set_link(from);
|
||||
}
|
||||
|
||||
void NodeOperationBuilder::removeInputLink(NodeOperationInput *to)
|
||||
void NodeOperationBuilder::remove_input_link(NodeOperationInput *to)
|
||||
{
|
||||
int index = 0;
|
||||
for (Link &link : links_) {
|
||||
if (link.to() == to) {
|
||||
/* unregister with the input */
|
||||
to->setLink(nullptr);
|
||||
to->set_link(nullptr);
|
||||
|
||||
links_.remove(index);
|
||||
return;
|
||||
@@ -222,67 +222,67 @@ PreviewOperation *NodeOperationBuilder::make_preview_operation() const
|
||||
{
|
||||
BLI_assert(current_node_);
|
||||
|
||||
if (!(current_node_->getbNode()->flag & NODE_PREVIEW)) {
|
||||
if (!(current_node_->get_bnode()->flag & NODE_PREVIEW)) {
|
||||
return nullptr;
|
||||
}
|
||||
/* previews only in the active group */
|
||||
if (!current_node_->isInActiveGroup()) {
|
||||
if (!current_node_->is_in_active_group()) {
|
||||
return nullptr;
|
||||
}
|
||||
/* do not calculate previews of hidden nodes */
|
||||
if (current_node_->getbNode()->flag & NODE_HIDDEN) {
|
||||
if (current_node_->get_bnode()->flag & NODE_HIDDEN) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bNodeInstanceHash *previews = context_->getPreviewHash();
|
||||
bNodeInstanceHash *previews = context_->get_preview_hash();
|
||||
if (previews) {
|
||||
PreviewOperation *operation = new PreviewOperation(context_->getViewSettings(),
|
||||
context_->getDisplaySettings(),
|
||||
current_node_->getbNode()->preview_xsize,
|
||||
current_node_->getbNode()->preview_ysize);
|
||||
operation->setbNodeTree(context_->getbNodeTree());
|
||||
operation->verifyPreview(previews, current_node_->getInstanceKey());
|
||||
PreviewOperation *operation = new PreviewOperation(context_->get_view_settings(),
|
||||
context_->get_display_settings(),
|
||||
current_node_->get_bnode()->preview_xsize,
|
||||
current_node_->get_bnode()->preview_ysize);
|
||||
operation->set_bnodetree(context_->get_bnodetree());
|
||||
operation->verify_preview(previews, current_node_->get_instance_key());
|
||||
return operation;
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void NodeOperationBuilder::addPreview(NodeOperationOutput *output)
|
||||
void NodeOperationBuilder::add_preview(NodeOperationOutput *output)
|
||||
{
|
||||
PreviewOperation *operation = make_preview_operation();
|
||||
if (operation) {
|
||||
addOperation(operation);
|
||||
add_operation(operation);
|
||||
|
||||
addLink(output, operation->getInputSocket(0));
|
||||
add_link(output, operation->get_input_socket(0));
|
||||
}
|
||||
}
|
||||
|
||||
void NodeOperationBuilder::addNodeInputPreview(NodeInput *input)
|
||||
void NodeOperationBuilder::add_node_input_preview(NodeInput *input)
|
||||
{
|
||||
PreviewOperation *operation = make_preview_operation();
|
||||
if (operation) {
|
||||
addOperation(operation);
|
||||
add_operation(operation);
|
||||
|
||||
mapInputSocket(input, operation->getInputSocket(0));
|
||||
map_input_socket(input, operation->get_input_socket(0));
|
||||
}
|
||||
}
|
||||
|
||||
void NodeOperationBuilder::registerViewer(ViewerOperation *viewer)
|
||||
void NodeOperationBuilder::register_viewer(ViewerOperation *viewer)
|
||||
{
|
||||
if (active_viewer_) {
|
||||
if (current_node_->isInActiveGroup()) {
|
||||
if (current_node_->is_in_active_group()) {
|
||||
/* deactivate previous viewer */
|
||||
active_viewer_->setActive(false);
|
||||
active_viewer_->set_active(false);
|
||||
|
||||
active_viewer_ = viewer;
|
||||
viewer->setActive(true);
|
||||
viewer->set_active(true);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (current_node_->getbNodeTree() == context_->getbNodeTree()) {
|
||||
if (current_node_->get_bnodetree() == context_->get_bnodetree()) {
|
||||
active_viewer_ = viewer;
|
||||
viewer->setActive(true);
|
||||
viewer->set_active(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -296,25 +296,25 @@ void NodeOperationBuilder::add_datatype_conversions()
|
||||
Vector<Link> convert_links;
|
||||
for (const Link &link : links_) {
|
||||
/* proxy operations can skip data type conversion */
|
||||
NodeOperation *from_op = &link.from()->getOperation();
|
||||
NodeOperation *to_op = &link.to()->getOperation();
|
||||
NodeOperation *from_op = &link.from()->get_operation();
|
||||
NodeOperation *to_op = &link.to()->get_operation();
|
||||
if (!(from_op->get_flags().use_datatype_conversion ||
|
||||
to_op->get_flags().use_datatype_conversion)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (link.from()->getDataType() != link.to()->getDataType()) {
|
||||
if (link.from()->get_data_type() != link.to()->get_data_type()) {
|
||||
convert_links.append(link);
|
||||
}
|
||||
}
|
||||
for (const Link &link : convert_links) {
|
||||
NodeOperation *converter = COM_convert_data_type(*link.from(), *link.to());
|
||||
if (converter) {
|
||||
addOperation(converter);
|
||||
add_operation(converter);
|
||||
|
||||
removeInputLink(link.to());
|
||||
addLink(link.from(), converter->getInputSocket(0));
|
||||
addLink(converter->getOutputSocket(0), link.to());
|
||||
remove_input_link(link.to());
|
||||
add_link(link.from(), converter->get_input_socket(0));
|
||||
add_link(converter->get_output_socket(0), link.to());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -326,9 +326,9 @@ void NodeOperationBuilder::add_operation_input_constants()
|
||||
*/
|
||||
Vector<NodeOperationInput *> pending_inputs;
|
||||
for (NodeOperation *op : operations_) {
|
||||
for (int k = 0; k < op->getNumberOfInputSockets(); ++k) {
|
||||
NodeOperationInput *input = op->getInputSocket(k);
|
||||
if (!input->isConnected()) {
|
||||
for (int k = 0; k < op->get_number_of_input_sockets(); ++k) {
|
||||
NodeOperationInput *input = op->get_input_socket(k);
|
||||
if (!input->is_connected()) {
|
||||
pending_inputs.append(input);
|
||||
}
|
||||
}
|
||||
@@ -341,50 +341,50 @@ void NodeOperationBuilder::add_operation_input_constants()
|
||||
void NodeOperationBuilder::add_input_constant_value(NodeOperationInput *input,
|
||||
const NodeInput *node_input)
|
||||
{
|
||||
switch (input->getDataType()) {
|
||||
switch (input->get_data_type()) {
|
||||
case DataType::Value: {
|
||||
float value;
|
||||
if (node_input && node_input->getbNodeSocket()) {
|
||||
value = node_input->getEditorValueFloat();
|
||||
if (node_input && node_input->get_bnode_socket()) {
|
||||
value = node_input->get_editor_value_float();
|
||||
}
|
||||
else {
|
||||
value = 0.0f;
|
||||
}
|
||||
|
||||
SetValueOperation *op = new SetValueOperation();
|
||||
op->setValue(value);
|
||||
addOperation(op);
|
||||
addLink(op->getOutputSocket(), input);
|
||||
op->set_value(value);
|
||||
add_operation(op);
|
||||
add_link(op->get_output_socket(), input);
|
||||
break;
|
||||
}
|
||||
case DataType::Color: {
|
||||
float value[4];
|
||||
if (node_input && node_input->getbNodeSocket()) {
|
||||
node_input->getEditorValueColor(value);
|
||||
if (node_input && node_input->get_bnode_socket()) {
|
||||
node_input->get_editor_value_color(value);
|
||||
}
|
||||
else {
|
||||
zero_v4(value);
|
||||
}
|
||||
|
||||
SetColorOperation *op = new SetColorOperation();
|
||||
op->setChannels(value);
|
||||
addOperation(op);
|
||||
addLink(op->getOutputSocket(), input);
|
||||
op->set_channels(value);
|
||||
add_operation(op);
|
||||
add_link(op->get_output_socket(), input);
|
||||
break;
|
||||
}
|
||||
case DataType::Vector: {
|
||||
float value[3];
|
||||
if (node_input && node_input->getbNodeSocket()) {
|
||||
node_input->getEditorValueVector(value);
|
||||
if (node_input && node_input->get_bnode_socket()) {
|
||||
node_input->get_editor_value_vector(value);
|
||||
}
|
||||
else {
|
||||
zero_v3(value);
|
||||
}
|
||||
|
||||
SetVectorOperation *op = new SetVectorOperation();
|
||||
op->setVector(value);
|
||||
addOperation(op);
|
||||
addLink(op->getOutputSocket(), input);
|
||||
op->set_vector(value);
|
||||
add_operation(op);
|
||||
add_link(op->get_output_socket(), input);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -395,8 +395,8 @@ void NodeOperationBuilder::resolve_proxies()
|
||||
Vector<Link> proxy_links;
|
||||
for (const Link &link : links_) {
|
||||
/* don't replace links from proxy to proxy, since we may need them for replacing others! */
|
||||
if (link.from()->getOperation().get_flags().is_proxy_operation &&
|
||||
!link.to()->getOperation().get_flags().is_proxy_operation) {
|
||||
if (link.from()->get_operation().get_flags().is_proxy_operation &&
|
||||
!link.to()->get_operation().get_flags().is_proxy_operation) {
|
||||
proxy_links.append(link);
|
||||
}
|
||||
}
|
||||
@@ -406,15 +406,15 @@ void NodeOperationBuilder::resolve_proxies()
|
||||
NodeOperationOutput *from = link.from();
|
||||
do {
|
||||
/* walk upstream bypassing the proxy operation */
|
||||
from = from->getOperation().getInputSocket(0)->getLink();
|
||||
} while (from && from->getOperation().get_flags().is_proxy_operation);
|
||||
from = from->get_operation().get_input_socket(0)->get_link();
|
||||
} while (from && from->get_operation().get_flags().is_proxy_operation);
|
||||
|
||||
removeInputLink(to);
|
||||
remove_input_link(to);
|
||||
/* we may not have a final proxy input link,
|
||||
* in that case it just gets dropped
|
||||
*/
|
||||
if (from) {
|
||||
addLink(from, to);
|
||||
add_link(from, to);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -424,7 +424,8 @@ void NodeOperationBuilder::determine_canvases()
|
||||
/* Determine all canvas areas of the operations. */
|
||||
const rcti &preferred_area = COM_AREA_NONE;
|
||||
for (NodeOperation *op : operations_) {
|
||||
if (op->isOutputOperation(context_->isRendering()) && !op->get_flags().is_preview_operation) {
|
||||
if (op->is_output_operation(context_->is_rendering()) &&
|
||||
!op->get_flags().is_preview_operation) {
|
||||
rcti canvas = COM_AREA_NONE;
|
||||
op->determine_canvas(preferred_area, canvas);
|
||||
op->set_canvas(canvas);
|
||||
@@ -432,7 +433,8 @@ void NodeOperationBuilder::determine_canvases()
|
||||
}
|
||||
|
||||
for (NodeOperation *op : operations_) {
|
||||
if (op->isOutputOperation(context_->isRendering()) && op->get_flags().is_preview_operation) {
|
||||
if (op->is_output_operation(context_->is_rendering()) &&
|
||||
op->get_flags().is_preview_operation) {
|
||||
rcti canvas = COM_AREA_NONE;
|
||||
op->determine_canvas(preferred_area, canvas);
|
||||
op->set_canvas(canvas);
|
||||
@@ -443,12 +445,12 @@ void NodeOperationBuilder::determine_canvases()
|
||||
{
|
||||
Vector<Link> convert_links;
|
||||
for (const Link &link : links_) {
|
||||
if (link.to()->getResizeMode() != ResizeMode::None) {
|
||||
const rcti &from_canvas = link.from()->getOperation().get_canvas();
|
||||
const rcti &to_canvas = link.to()->getOperation().get_canvas();
|
||||
if (link.to()->get_resize_mode() != ResizeMode::None) {
|
||||
const rcti &from_canvas = link.from()->get_operation().get_canvas();
|
||||
const rcti &to_canvas = link.to()->get_operation().get_canvas();
|
||||
|
||||
bool needs_conversion;
|
||||
if (link.to()->getResizeMode() == ResizeMode::Align) {
|
||||
if (link.to()->get_resize_mode() == ResizeMode::Align) {
|
||||
needs_conversion = from_canvas.xmin != to_canvas.xmin ||
|
||||
from_canvas.ymin != to_canvas.ymin;
|
||||
}
|
||||
@@ -528,7 +530,7 @@ WriteBufferOperation *NodeOperationBuilder::find_attached_write_buffer_operation
|
||||
{
|
||||
for (const Link &link : links_) {
|
||||
if (link.from() == output) {
|
||||
NodeOperation &op = link.to()->getOperation();
|
||||
NodeOperation &op = link.to()->get_operation();
|
||||
if (op.get_flags().is_write_buffer_operation) {
|
||||
return (WriteBufferOperation *)(&op);
|
||||
}
|
||||
@@ -540,39 +542,39 @@ WriteBufferOperation *NodeOperationBuilder::find_attached_write_buffer_operation
|
||||
void NodeOperationBuilder::add_input_buffers(NodeOperation * /*operation*/,
|
||||
NodeOperationInput *input)
|
||||
{
|
||||
if (!input->isConnected()) {
|
||||
if (!input->is_connected()) {
|
||||
return;
|
||||
}
|
||||
|
||||
NodeOperationOutput *output = input->getLink();
|
||||
if (output->getOperation().get_flags().is_read_buffer_operation) {
|
||||
NodeOperationOutput *output = input->get_link();
|
||||
if (output->get_operation().get_flags().is_read_buffer_operation) {
|
||||
/* input is already buffered, no need to add another */
|
||||
return;
|
||||
}
|
||||
|
||||
/* this link will be replaced below */
|
||||
removeInputLink(input);
|
||||
remove_input_link(input);
|
||||
|
||||
/* check of other end already has write operation, otherwise add a new one */
|
||||
WriteBufferOperation *writeoperation = find_attached_write_buffer_operation(output);
|
||||
if (!writeoperation) {
|
||||
writeoperation = new WriteBufferOperation(output->getDataType());
|
||||
writeoperation->setbNodeTree(context_->getbNodeTree());
|
||||
addOperation(writeoperation);
|
||||
writeoperation = new WriteBufferOperation(output->get_data_type());
|
||||
writeoperation->set_bnodetree(context_->get_bnodetree());
|
||||
add_operation(writeoperation);
|
||||
|
||||
addLink(output, writeoperation->getInputSocket(0));
|
||||
add_link(output, writeoperation->get_input_socket(0));
|
||||
|
||||
writeoperation->readResolutionFromInputSocket();
|
||||
writeoperation->read_resolution_from_input_socket();
|
||||
}
|
||||
|
||||
/* add readbuffer op for the input */
|
||||
ReadBufferOperation *readoperation = new ReadBufferOperation(output->getDataType());
|
||||
readoperation->setMemoryProxy(writeoperation->getMemoryProxy());
|
||||
this->addOperation(readoperation);
|
||||
ReadBufferOperation *readoperation = new ReadBufferOperation(output->get_data_type());
|
||||
readoperation->set_memory_proxy(writeoperation->get_memory_proxy());
|
||||
this->add_operation(readoperation);
|
||||
|
||||
addLink(readoperation->getOutputSocket(), input);
|
||||
add_link(readoperation->get_output_socket(), input);
|
||||
|
||||
readoperation->readResolutionFromWriteBuffer();
|
||||
readoperation->read_resolution_from_write_buffer();
|
||||
}
|
||||
|
||||
void NodeOperationBuilder::add_output_buffers(NodeOperation *operation,
|
||||
@@ -584,44 +586,44 @@ void NodeOperationBuilder::add_output_buffers(NodeOperation *operation,
|
||||
return;
|
||||
}
|
||||
|
||||
WriteBufferOperation *writeOperation = nullptr;
|
||||
WriteBufferOperation *write_operation = nullptr;
|
||||
for (NodeOperationInput *target : targets) {
|
||||
/* try to find existing write buffer operation */
|
||||
if (target->getOperation().get_flags().is_write_buffer_operation) {
|
||||
BLI_assert(writeOperation == nullptr); /* there should only be one write op connected */
|
||||
writeOperation = (WriteBufferOperation *)(&target->getOperation());
|
||||
if (target->get_operation().get_flags().is_write_buffer_operation) {
|
||||
BLI_assert(write_operation == nullptr); /* there should only be one write op connected */
|
||||
write_operation = (WriteBufferOperation *)(&target->get_operation());
|
||||
}
|
||||
else {
|
||||
/* remove all links to other nodes */
|
||||
removeInputLink(target);
|
||||
remove_input_link(target);
|
||||
}
|
||||
}
|
||||
|
||||
/* if no write buffer operation exists yet, create a new one */
|
||||
if (!writeOperation) {
|
||||
writeOperation = new WriteBufferOperation(operation->getOutputSocket()->getDataType());
|
||||
writeOperation->setbNodeTree(context_->getbNodeTree());
|
||||
addOperation(writeOperation);
|
||||
if (!write_operation) {
|
||||
write_operation = new WriteBufferOperation(operation->get_output_socket()->get_data_type());
|
||||
write_operation->set_bnodetree(context_->get_bnodetree());
|
||||
add_operation(write_operation);
|
||||
|
||||
addLink(output, writeOperation->getInputSocket(0));
|
||||
add_link(output, write_operation->get_input_socket(0));
|
||||
}
|
||||
|
||||
writeOperation->readResolutionFromInputSocket();
|
||||
write_operation->read_resolution_from_input_socket();
|
||||
|
||||
/* add readbuffer op for every former connected input */
|
||||
for (NodeOperationInput *target : targets) {
|
||||
if (&target->getOperation() == writeOperation) {
|
||||
if (&target->get_operation() == write_operation) {
|
||||
continue; /* skip existing write op links */
|
||||
}
|
||||
|
||||
ReadBufferOperation *readoperation = new ReadBufferOperation(
|
||||
operation->getOutputSocket()->getDataType());
|
||||
readoperation->setMemoryProxy(writeOperation->getMemoryProxy());
|
||||
addOperation(readoperation);
|
||||
operation->get_output_socket()->get_data_type());
|
||||
readoperation->set_memory_proxy(write_operation->get_memory_proxy());
|
||||
add_operation(readoperation);
|
||||
|
||||
addLink(readoperation->getOutputSocket(), target);
|
||||
add_link(readoperation->get_output_socket(), target);
|
||||
|
||||
readoperation->readResolutionFromWriteBuffer();
|
||||
readoperation->read_resolution_from_write_buffer();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -640,12 +642,12 @@ void NodeOperationBuilder::add_complex_operation_buffers()
|
||||
for (NodeOperation *op : complex_ops) {
|
||||
DebugInfo::operation_read_write_buffer(op);
|
||||
|
||||
for (int index = 0; index < op->getNumberOfInputSockets(); index++) {
|
||||
add_input_buffers(op, op->getInputSocket(index));
|
||||
for (int index = 0; index < op->get_number_of_input_sockets(); index++) {
|
||||
add_input_buffers(op, op->get_input_socket(index));
|
||||
}
|
||||
|
||||
for (int index = 0; index < op->getNumberOfOutputSockets(); index++) {
|
||||
add_output_buffers(op, op->getOutputSocket(index));
|
||||
for (int index = 0; index < op->get_number_of_output_sockets(); index++) {
|
||||
add_output_buffers(op, op->get_output_socket(index));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -659,18 +661,18 @@ static void find_reachable_operations_recursive(Tags &reachable, NodeOperation *
|
||||
}
|
||||
reachable.insert(op);
|
||||
|
||||
for (int i = 0; i < op->getNumberOfInputSockets(); i++) {
|
||||
NodeOperationInput *input = op->getInputSocket(i);
|
||||
if (input->isConnected()) {
|
||||
find_reachable_operations_recursive(reachable, &input->getLink()->getOperation());
|
||||
for (int i = 0; i < op->get_number_of_input_sockets(); i++) {
|
||||
NodeOperationInput *input = op->get_input_socket(i);
|
||||
if (input->is_connected()) {
|
||||
find_reachable_operations_recursive(reachable, &input->get_link()->get_operation());
|
||||
}
|
||||
}
|
||||
|
||||
/* associated write-buffer operations are executed as well */
|
||||
if (op->get_flags().is_read_buffer_operation) {
|
||||
ReadBufferOperation *read_op = (ReadBufferOperation *)op;
|
||||
MemoryProxy *memproxy = read_op->getMemoryProxy();
|
||||
find_reachable_operations_recursive(reachable, memproxy->getWriteBufferOperation());
|
||||
MemoryProxy *memproxy = read_op->get_memory_proxy();
|
||||
find_reachable_operations_recursive(reachable, memproxy->get_write_buffer_operation());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -679,7 +681,7 @@ void NodeOperationBuilder::prune_operations()
|
||||
Tags reachable;
|
||||
for (NodeOperation *op : operations_) {
|
||||
/* output operations are primary executed operations */
|
||||
if (op->isOutputOperation(context_->isRendering())) {
|
||||
if (op->is_output_operation(context_->is_rendering())) {
|
||||
find_reachable_operations_recursive(reachable, op);
|
||||
}
|
||||
}
|
||||
@@ -708,10 +710,10 @@ static void sort_operations_recursive(Vector<NodeOperation *> &sorted,
|
||||
}
|
||||
visited.insert(op);
|
||||
|
||||
for (int i = 0; i < op->getNumberOfInputSockets(); i++) {
|
||||
NodeOperationInput *input = op->getInputSocket(i);
|
||||
if (input->isConnected()) {
|
||||
sort_operations_recursive(sorted, visited, &input->getLink()->getOperation());
|
||||
for (int i = 0; i < op->get_number_of_input_sockets(); i++) {
|
||||
NodeOperationInput *input = op->get_input_socket(i);
|
||||
if (input->is_connected()) {
|
||||
sort_operations_recursive(sorted, visited, &input->get_link()->get_operation());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -738,15 +740,15 @@ static void add_group_operations_recursive(Tags &visited, NodeOperation *op, Exe
|
||||
}
|
||||
visited.insert(op);
|
||||
|
||||
if (!group->addOperation(op)) {
|
||||
if (!group->add_operation(op)) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* add all eligible input ops to the group */
|
||||
for (int i = 0; i < op->getNumberOfInputSockets(); i++) {
|
||||
NodeOperationInput *input = op->getInputSocket(i);
|
||||
if (input->isConnected()) {
|
||||
add_group_operations_recursive(visited, &input->getLink()->getOperation(), group);
|
||||
for (int i = 0; i < op->get_number_of_input_sockets(); i++) {
|
||||
NodeOperationInput *input = op->get_input_socket(i);
|
||||
if (input->is_connected()) {
|
||||
add_group_operations_recursive(visited, &input->get_link()->get_operation(), group);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -765,19 +767,19 @@ ExecutionGroup *NodeOperationBuilder::make_group(NodeOperation *op)
|
||||
void NodeOperationBuilder::group_operations()
|
||||
{
|
||||
for (NodeOperation *op : operations_) {
|
||||
if (op->isOutputOperation(context_->isRendering())) {
|
||||
if (op->is_output_operation(context_->is_rendering())) {
|
||||
ExecutionGroup *group = make_group(op);
|
||||
group->setOutputExecutionGroup(true);
|
||||
group->set_output_execution_group(true);
|
||||
}
|
||||
|
||||
/* add new groups for associated memory proxies where needed */
|
||||
if (op->get_flags().is_read_buffer_operation) {
|
||||
ReadBufferOperation *read_op = (ReadBufferOperation *)op;
|
||||
MemoryProxy *memproxy = read_op->getMemoryProxy();
|
||||
MemoryProxy *memproxy = read_op->get_memory_proxy();
|
||||
|
||||
if (memproxy->getExecutor() == nullptr) {
|
||||
ExecutionGroup *group = make_group(memproxy->getWriteBufferOperation());
|
||||
memproxy->setExecutor(group);
|
||||
if (memproxy->get_executor() == nullptr) {
|
||||
ExecutionGroup *group = make_group(memproxy->get_write_buffer_operation());
|
||||
memproxy->set_executor(group);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -804,15 +806,15 @@ std::ostream &operator<<(std::ostream &os, const NodeOperationBuilder &builder)
|
||||
|
||||
os << "\n";
|
||||
for (const NodeOperationBuilder::Link &link : builder.get_links()) {
|
||||
os << " op" << link.from()->getOperation().get_id() << " -> op"
|
||||
<< link.to()->getOperation().get_id() << ";\n";
|
||||
os << " op" << link.from()->get_operation().get_id() << " -> op"
|
||||
<< link.to()->get_operation().get_id() << ";\n";
|
||||
}
|
||||
for (const NodeOperation *operation : builder.get_operations()) {
|
||||
if (operation->get_flags().is_read_buffer_operation) {
|
||||
const ReadBufferOperation &read_operation = static_cast<const ReadBufferOperation &>(
|
||||
*operation);
|
||||
const WriteBufferOperation &write_operation =
|
||||
*read_operation.getMemoryProxy()->getWriteBufferOperation();
|
||||
*read_operation.get_memory_proxy()->get_write_buffer_operation();
|
||||
os << " op" << write_operation.get_id() << " -> op" << read_operation.get_id() << ";\n";
|
||||
}
|
||||
}
|
||||
@@ -824,7 +826,7 @@ std::ostream &operator<<(std::ostream &os, const NodeOperationBuilder &builder)
|
||||
|
||||
std::ostream &operator<<(std::ostream &os, const NodeOperationBuilder::Link &link)
|
||||
{
|
||||
os << link.from()->getOperation().get_id() << " -> " << link.to()->getOperation().get_id();
|
||||
os << link.from()->get_operation().get_id() << " -> " << link.to()->get_operation().get_id();
|
||||
return os;
|
||||
}
|
||||
|
||||
|
||||
@@ -96,27 +96,27 @@ class NodeOperationBuilder {
|
||||
return *context_;
|
||||
}
|
||||
|
||||
void convertToOperations(ExecutionSystem *system);
|
||||
void convert_to_operations(ExecutionSystem *system);
|
||||
|
||||
void addOperation(NodeOperation *operation);
|
||||
void add_operation(NodeOperation *operation);
|
||||
void replace_operation_with_constant(NodeOperation *operation,
|
||||
ConstantOperation *constant_operation);
|
||||
|
||||
/** Map input socket of the current node to an operation socket */
|
||||
void mapInputSocket(NodeInput *node_socket, NodeOperationInput *operation_socket);
|
||||
void map_input_socket(NodeInput *node_socket, NodeOperationInput *operation_socket);
|
||||
/** Map output socket of the current node to an operation socket */
|
||||
void mapOutputSocket(NodeOutput *node_socket, NodeOperationOutput *operation_socket);
|
||||
void map_output_socket(NodeOutput *node_socket, NodeOperationOutput *operation_socket);
|
||||
|
||||
void addLink(NodeOperationOutput *from, NodeOperationInput *to);
|
||||
void removeInputLink(NodeOperationInput *to);
|
||||
void add_link(NodeOperationOutput *from, NodeOperationInput *to);
|
||||
void remove_input_link(NodeOperationInput *to);
|
||||
|
||||
/** Add a preview operation for a operation output */
|
||||
void addPreview(NodeOperationOutput *output);
|
||||
void add_preview(NodeOperationOutput *output);
|
||||
/** Add a preview operation for a node input */
|
||||
void addNodeInputPreview(NodeInput *input);
|
||||
void add_node_input_preview(NodeInput *input);
|
||||
|
||||
/** Define a viewer operation as the active output, if possible */
|
||||
void registerViewer(ViewerOperation *viewer);
|
||||
void register_viewer(ViewerOperation *viewer);
|
||||
/** The currently active viewer output operation */
|
||||
ViewerOperation *active_viewer() const
|
||||
{
|
||||
|
||||
@@ -40,13 +40,13 @@ const cl_image_format IMAGE_FORMAT_VALUE = {
|
||||
OpenCLDevice::OpenCLDevice(cl_context context,
|
||||
cl_device_id device,
|
||||
cl_program program,
|
||||
cl_int vendorId)
|
||||
cl_int vendor_id)
|
||||
{
|
||||
device_ = device;
|
||||
context_ = context;
|
||||
program_ = program;
|
||||
queue_ = nullptr;
|
||||
vendorID_ = vendorId;
|
||||
vendor_id_ = vendor_id;
|
||||
|
||||
cl_int error;
|
||||
queue_ = clCreateCommandQueue(context_, device_, 0, &error);
|
||||
@@ -57,7 +57,7 @@ OpenCLDevice::OpenCLDevice(OpenCLDevice &&other) noexcept
|
||||
device_(other.device_),
|
||||
program_(other.program_),
|
||||
queue_(other.queue_),
|
||||
vendorID_(other.vendorID_)
|
||||
vendor_id_(other.vendor_id_)
|
||||
{
|
||||
other.queue_ = nullptr;
|
||||
}
|
||||
@@ -71,37 +71,38 @@ OpenCLDevice::~OpenCLDevice()
|
||||
|
||||
void OpenCLDevice::execute(WorkPackage *work_package)
|
||||
{
|
||||
const unsigned int chunkNumber = work_package->chunk_number;
|
||||
ExecutionGroup *executionGroup = work_package->execution_group;
|
||||
const unsigned int chunk_number = work_package->chunk_number;
|
||||
ExecutionGroup *execution_group = work_package->execution_group;
|
||||
|
||||
MemoryBuffer **inputBuffers = executionGroup->getInputBuffersOpenCL(chunkNumber);
|
||||
MemoryBuffer *outputBuffer = executionGroup->allocateOutputBuffer(work_package->rect);
|
||||
MemoryBuffer **input_buffers = execution_group->get_input_buffers_opencl(chunk_number);
|
||||
MemoryBuffer *output_buffer = execution_group->allocate_output_buffer(work_package->rect);
|
||||
|
||||
executionGroup->getOutputOperation()->executeOpenCLRegion(
|
||||
this, &work_package->rect, chunkNumber, inputBuffers, outputBuffer);
|
||||
execution_group->get_output_operation()->execute_opencl_region(
|
||||
this, &work_package->rect, chunk_number, input_buffers, output_buffer);
|
||||
|
||||
delete outputBuffer;
|
||||
delete output_buffer;
|
||||
|
||||
executionGroup->finalizeChunkExecution(chunkNumber, inputBuffers);
|
||||
execution_group->finalize_chunk_execution(chunk_number, input_buffers);
|
||||
}
|
||||
cl_mem OpenCLDevice::COM_clAttachMemoryBufferToKernelParameter(cl_kernel kernel,
|
||||
int parameterIndex,
|
||||
int offsetIndex,
|
||||
std::list<cl_mem> *cleanup,
|
||||
MemoryBuffer **inputMemoryBuffers,
|
||||
SocketReader *reader)
|
||||
cl_mem OpenCLDevice::COM_cl_attach_memory_buffer_to_kernel_parameter(
|
||||
cl_kernel kernel,
|
||||
int parameter_index,
|
||||
int offset_index,
|
||||
std::list<cl_mem> *cleanup,
|
||||
MemoryBuffer **input_memory_buffers,
|
||||
SocketReader *reader)
|
||||
{
|
||||
return COM_clAttachMemoryBufferToKernelParameter(kernel,
|
||||
parameterIndex,
|
||||
offsetIndex,
|
||||
cleanup,
|
||||
inputMemoryBuffers,
|
||||
(ReadBufferOperation *)reader);
|
||||
return COM_cl_attach_memory_buffer_to_kernel_parameter(kernel,
|
||||
parameter_index,
|
||||
offset_index,
|
||||
cleanup,
|
||||
input_memory_buffers,
|
||||
(ReadBufferOperation *)reader);
|
||||
}
|
||||
|
||||
const cl_image_format *OpenCLDevice::determineImageFormat(MemoryBuffer *memoryBuffer)
|
||||
const cl_image_format *OpenCLDevice::determine_image_format(MemoryBuffer *memory_buffer)
|
||||
{
|
||||
switch (memoryBuffer->get_num_channels()) {
|
||||
switch (memory_buffer->get_num_channels()) {
|
||||
case 1:
|
||||
return &IMAGE_FORMAT_VALUE;
|
||||
break;
|
||||
@@ -118,92 +119,91 @@ const cl_image_format *OpenCLDevice::determineImageFormat(MemoryBuffer *memoryBu
|
||||
return &IMAGE_FORMAT_COLOR;
|
||||
}
|
||||
|
||||
cl_mem OpenCLDevice::COM_clAttachMemoryBufferToKernelParameter(cl_kernel kernel,
|
||||
int parameterIndex,
|
||||
int offsetIndex,
|
||||
std::list<cl_mem> *cleanup,
|
||||
MemoryBuffer **inputMemoryBuffers,
|
||||
ReadBufferOperation *reader)
|
||||
cl_mem OpenCLDevice::COM_cl_attach_memory_buffer_to_kernel_parameter(
|
||||
cl_kernel kernel,
|
||||
int parameter_index,
|
||||
int offset_index,
|
||||
std::list<cl_mem> *cleanup,
|
||||
MemoryBuffer **input_memory_buffers,
|
||||
ReadBufferOperation *reader)
|
||||
{
|
||||
cl_int error;
|
||||
|
||||
MemoryBuffer *result = reader->getInputMemoryBuffer(inputMemoryBuffers);
|
||||
MemoryBuffer *result = reader->get_input_memory_buffer(input_memory_buffers);
|
||||
|
||||
const cl_image_format *imageFormat = determineImageFormat(result);
|
||||
const cl_image_format *image_format = determine_image_format(result);
|
||||
|
||||
cl_mem clBuffer = clCreateImage2D(context_,
|
||||
CL_MEM_READ_ONLY | CL_MEM_COPY_HOST_PTR,
|
||||
imageFormat,
|
||||
result->getWidth(),
|
||||
result->getHeight(),
|
||||
0,
|
||||
result->getBuffer(),
|
||||
&error);
|
||||
cl_mem cl_buffer = clCreateImage2D(context_,
|
||||
CL_MEM_READ_ONLY | CL_MEM_COPY_HOST_PTR,
|
||||
image_format,
|
||||
result->get_width(),
|
||||
result->get_height(),
|
||||
0,
|
||||
result->get_buffer(),
|
||||
&error);
|
||||
|
||||
if (error != CL_SUCCESS) {
|
||||
printf("CLERROR[%d]: %s\n", error, clewErrorString(error));
|
||||
}
|
||||
if (error == CL_SUCCESS) {
|
||||
cleanup->push_back(clBuffer);
|
||||
cleanup->push_back(cl_buffer);
|
||||
}
|
||||
|
||||
error = clSetKernelArg(kernel, parameterIndex, sizeof(cl_mem), &clBuffer);
|
||||
error = clSetKernelArg(kernel, parameter_index, sizeof(cl_mem), &cl_buffer);
|
||||
if (error != CL_SUCCESS) {
|
||||
printf("CLERROR[%d]: %s\n", error, clewErrorString(error));
|
||||
}
|
||||
|
||||
COM_clAttachMemoryBufferOffsetToKernelParameter(kernel, offsetIndex, result);
|
||||
return clBuffer;
|
||||
COM_cl_attach_memory_buffer_offset_to_kernel_parameter(kernel, offset_index, result);
|
||||
return cl_buffer;
|
||||
}
|
||||
|
||||
void OpenCLDevice::COM_clAttachMemoryBufferOffsetToKernelParameter(cl_kernel kernel,
|
||||
int offsetIndex,
|
||||
MemoryBuffer *memoryBuffer)
|
||||
void OpenCLDevice::COM_cl_attach_memory_buffer_offset_to_kernel_parameter(
|
||||
cl_kernel kernel, int offset_index, MemoryBuffer *memory_buffer)
|
||||
{
|
||||
if (offsetIndex != -1) {
|
||||
if (offset_index != -1) {
|
||||
cl_int error;
|
||||
const rcti &rect = memoryBuffer->get_rect();
|
||||
const rcti &rect = memory_buffer->get_rect();
|
||||
cl_int2 offset = {{rect.xmin, rect.ymin}};
|
||||
|
||||
error = clSetKernelArg(kernel, offsetIndex, sizeof(cl_int2), &offset);
|
||||
error = clSetKernelArg(kernel, offset_index, sizeof(cl_int2), &offset);
|
||||
if (error != CL_SUCCESS) {
|
||||
printf("CLERROR[%d]: %s\n", error, clewErrorString(error));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void OpenCLDevice::COM_clAttachSizeToKernelParameter(cl_kernel kernel,
|
||||
int offsetIndex,
|
||||
NodeOperation *operation)
|
||||
void OpenCLDevice::COM_cl_attach_size_to_kernel_parameter(cl_kernel kernel,
|
||||
int offset_index,
|
||||
NodeOperation *operation)
|
||||
{
|
||||
if (offsetIndex != -1) {
|
||||
if (offset_index != -1) {
|
||||
cl_int error;
|
||||
cl_int2 offset = {{(cl_int)operation->getWidth(), (cl_int)operation->getHeight()}};
|
||||
cl_int2 offset = {{(cl_int)operation->get_width(), (cl_int)operation->get_height()}};
|
||||
|
||||
error = clSetKernelArg(kernel, offsetIndex, sizeof(cl_int2), &offset);
|
||||
error = clSetKernelArg(kernel, offset_index, sizeof(cl_int2), &offset);
|
||||
if (error != CL_SUCCESS) {
|
||||
printf("CLERROR[%d]: %s\n", error, clewErrorString(error));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void OpenCLDevice::COM_clAttachOutputMemoryBufferToKernelParameter(cl_kernel kernel,
|
||||
int parameterIndex,
|
||||
cl_mem clOutputMemoryBuffer)
|
||||
void OpenCLDevice::COM_cl_attach_output_memory_buffer_to_kernel_parameter(
|
||||
cl_kernel kernel, int parameter_index, cl_mem cl_output_memory_buffer)
|
||||
{
|
||||
cl_int error;
|
||||
error = clSetKernelArg(kernel, parameterIndex, sizeof(cl_mem), &clOutputMemoryBuffer);
|
||||
error = clSetKernelArg(kernel, parameter_index, sizeof(cl_mem), &cl_output_memory_buffer);
|
||||
if (error != CL_SUCCESS) {
|
||||
printf("CLERROR[%d]: %s\n", error, clewErrorString(error));
|
||||
}
|
||||
}
|
||||
|
||||
void OpenCLDevice::COM_clEnqueueRange(cl_kernel kernel, MemoryBuffer *outputMemoryBuffer)
|
||||
void OpenCLDevice::COM_cl_enqueue_range(cl_kernel kernel, MemoryBuffer *output_memory_buffer)
|
||||
{
|
||||
cl_int error;
|
||||
const size_t size[] = {
|
||||
(size_t)outputMemoryBuffer->getWidth(),
|
||||
(size_t)outputMemoryBuffer->getHeight(),
|
||||
(size_t)output_memory_buffer->get_width(),
|
||||
(size_t)output_memory_buffer->get_height(),
|
||||
};
|
||||
|
||||
error = clEnqueueNDRangeKernel(queue_, kernel, 2, nullptr, size, nullptr, 0, nullptr, nullptr);
|
||||
@@ -212,44 +212,44 @@ void OpenCLDevice::COM_clEnqueueRange(cl_kernel kernel, MemoryBuffer *outputMemo
|
||||
}
|
||||
}
|
||||
|
||||
void OpenCLDevice::COM_clEnqueueRange(cl_kernel kernel,
|
||||
MemoryBuffer *outputMemoryBuffer,
|
||||
int offsetIndex,
|
||||
NodeOperation *operation)
|
||||
void OpenCLDevice::COM_cl_enqueue_range(cl_kernel kernel,
|
||||
MemoryBuffer *output_memory_buffer,
|
||||
int offset_index,
|
||||
NodeOperation *operation)
|
||||
{
|
||||
cl_int error;
|
||||
const int width = outputMemoryBuffer->getWidth();
|
||||
const int height = outputMemoryBuffer->getHeight();
|
||||
const int width = output_memory_buffer->get_width();
|
||||
const int height = output_memory_buffer->get_height();
|
||||
int offsetx;
|
||||
int offsety;
|
||||
int localSize = 1024;
|
||||
int local_size = 1024;
|
||||
size_t size[2];
|
||||
cl_int2 offset;
|
||||
|
||||
if (vendorID_ == NVIDIA) {
|
||||
localSize = 32;
|
||||
if (vendor_id_ == NVIDIA) {
|
||||
local_size = 32;
|
||||
}
|
||||
|
||||
bool breaked = false;
|
||||
for (offsety = 0; offsety < height && (!breaked); offsety += localSize) {
|
||||
for (offsety = 0; offsety < height && (!breaked); offsety += local_size) {
|
||||
offset.s[1] = offsety;
|
||||
if (offsety + localSize < height) {
|
||||
size[1] = localSize;
|
||||
if (offsety + local_size < height) {
|
||||
size[1] = local_size;
|
||||
}
|
||||
else {
|
||||
size[1] = height - offsety;
|
||||
}
|
||||
|
||||
for (offsetx = 0; offsetx < width && (!breaked); offsetx += localSize) {
|
||||
if (offsetx + localSize < width) {
|
||||
size[0] = localSize;
|
||||
for (offsetx = 0; offsetx < width && (!breaked); offsetx += local_size) {
|
||||
if (offsetx + local_size < width) {
|
||||
size[0] = local_size;
|
||||
}
|
||||
else {
|
||||
size[0] = width - offsetx;
|
||||
}
|
||||
offset.s[0] = offsetx;
|
||||
|
||||
error = clSetKernelArg(kernel, offsetIndex, sizeof(cl_int2), &offset);
|
||||
error = clSetKernelArg(kernel, offset_index, sizeof(cl_int2), &offset);
|
||||
if (error != CL_SUCCESS) {
|
||||
printf("CLERROR[%d]: %s\n", error, clewErrorString(error));
|
||||
}
|
||||
@@ -259,15 +259,15 @@ void OpenCLDevice::COM_clEnqueueRange(cl_kernel kernel,
|
||||
printf("CLERROR[%d]: %s\n", error, clewErrorString(error));
|
||||
}
|
||||
clFlush(queue_);
|
||||
if (operation->isBraked()) {
|
||||
if (operation->is_braked()) {
|
||||
breaked = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
cl_kernel OpenCLDevice::COM_clCreateKernel(const char *kernelname,
|
||||
std::list<cl_kernel> *clKernelsToCleanUp)
|
||||
cl_kernel OpenCLDevice::COM_cl_create_kernel(const char *kernelname,
|
||||
std::list<cl_kernel> *cl_kernels_to_clean_up)
|
||||
{
|
||||
cl_int error;
|
||||
cl_kernel kernel = clCreateKernel(program_, kernelname, &error);
|
||||
@@ -275,8 +275,8 @@ cl_kernel OpenCLDevice::COM_clCreateKernel(const char *kernelname,
|
||||
printf("CLERROR[%d]: %s\n", error, clewErrorString(error));
|
||||
}
|
||||
else {
|
||||
if (clKernelsToCleanUp) {
|
||||
clKernelsToCleanUp->push_back(kernel);
|
||||
if (cl_kernels_to_clean_up) {
|
||||
cl_kernels_to_clean_up->push_back(kernel);
|
||||
}
|
||||
}
|
||||
return kernel;
|
||||
|
||||
@@ -63,7 +63,7 @@ class OpenCLDevice : public Device {
|
||||
/**
|
||||
* \brief opencl vendor ID
|
||||
*/
|
||||
cl_int vendorID_;
|
||||
cl_int vendor_id_;
|
||||
|
||||
public:
|
||||
/**
|
||||
@@ -73,7 +73,7 @@ class OpenCLDevice : public Device {
|
||||
* \param program:
|
||||
* \param vendorID:
|
||||
*/
|
||||
OpenCLDevice(cl_context context, cl_device_id device, cl_program program, cl_int vendorId);
|
||||
OpenCLDevice(cl_context context, cl_device_id device, cl_program program, cl_int vendor_id);
|
||||
|
||||
OpenCLDevice(OpenCLDevice &&other) noexcept;
|
||||
|
||||
@@ -89,45 +89,46 @@ class OpenCLDevice : public Device {
|
||||
* \brief determine an image format
|
||||
* \param memorybuffer:
|
||||
*/
|
||||
static const cl_image_format *determineImageFormat(MemoryBuffer *memoryBuffer);
|
||||
static const cl_image_format *determine_image_format(MemoryBuffer *memory_buffer);
|
||||
|
||||
cl_context getContext()
|
||||
cl_context get_context()
|
||||
{
|
||||
return context_;
|
||||
}
|
||||
|
||||
cl_command_queue getQueue()
|
||||
cl_command_queue get_queue()
|
||||
{
|
||||
return queue_;
|
||||
}
|
||||
|
||||
cl_mem COM_clAttachMemoryBufferToKernelParameter(cl_kernel kernel,
|
||||
int parameterIndex,
|
||||
int offsetIndex,
|
||||
std::list<cl_mem> *cleanup,
|
||||
MemoryBuffer **inputMemoryBuffers,
|
||||
SocketReader *reader);
|
||||
cl_mem COM_clAttachMemoryBufferToKernelParameter(cl_kernel kernel,
|
||||
int parameterIndex,
|
||||
int offsetIndex,
|
||||
std::list<cl_mem> *cleanup,
|
||||
MemoryBuffer **inputMemoryBuffers,
|
||||
ReadBufferOperation *reader);
|
||||
void COM_clAttachMemoryBufferOffsetToKernelParameter(cl_kernel kernel,
|
||||
int offsetIndex,
|
||||
MemoryBuffer *memoryBuffers);
|
||||
void COM_clAttachOutputMemoryBufferToKernelParameter(cl_kernel kernel,
|
||||
int parameterIndex,
|
||||
cl_mem clOutputMemoryBuffer);
|
||||
void COM_clAttachSizeToKernelParameter(cl_kernel kernel,
|
||||
int offsetIndex,
|
||||
NodeOperation *operation);
|
||||
void COM_clEnqueueRange(cl_kernel kernel, MemoryBuffer *outputMemoryBuffer);
|
||||
void COM_clEnqueueRange(cl_kernel kernel,
|
||||
MemoryBuffer *outputMemoryBuffer,
|
||||
int offsetIndex,
|
||||
NodeOperation *operation);
|
||||
cl_kernel COM_clCreateKernel(const char *kernelname, std::list<cl_kernel> *clKernelsToCleanUp);
|
||||
cl_mem COM_cl_attach_memory_buffer_to_kernel_parameter(cl_kernel kernel,
|
||||
int parameter_index,
|
||||
int offset_index,
|
||||
std::list<cl_mem> *cleanup,
|
||||
MemoryBuffer **input_memory_buffers,
|
||||
SocketReader *reader);
|
||||
cl_mem COM_cl_attach_memory_buffer_to_kernel_parameter(cl_kernel kernel,
|
||||
int parameter_index,
|
||||
int offset_index,
|
||||
std::list<cl_mem> *cleanup,
|
||||
MemoryBuffer **input_memory_buffers,
|
||||
ReadBufferOperation *reader);
|
||||
void COM_cl_attach_memory_buffer_offset_to_kernel_parameter(cl_kernel kernel,
|
||||
int offset_index,
|
||||
MemoryBuffer *memory_buffers);
|
||||
void COM_cl_attach_output_memory_buffer_to_kernel_parameter(cl_kernel kernel,
|
||||
int parameter_index,
|
||||
cl_mem cl_output_memory_buffer);
|
||||
void COM_cl_attach_size_to_kernel_parameter(cl_kernel kernel,
|
||||
int offset_index,
|
||||
NodeOperation *operation);
|
||||
void COM_cl_enqueue_range(cl_kernel kernel, MemoryBuffer *output_memory_buffer);
|
||||
void COM_cl_enqueue_range(cl_kernel kernel,
|
||||
MemoryBuffer *output_memory_buffer,
|
||||
int offset_index,
|
||||
NodeOperation *operation);
|
||||
cl_kernel COM_cl_create_kernel(const char *kernelname,
|
||||
std::list<cl_kernel> *cl_kernels_to_clean_up);
|
||||
};
|
||||
|
||||
} // namespace blender::compositor
|
||||
|
||||
@@ -22,42 +22,42 @@ namespace blender::compositor {
|
||||
|
||||
SingleThreadedOperation::SingleThreadedOperation()
|
||||
{
|
||||
cachedInstance_ = nullptr;
|
||||
cached_instance_ = nullptr;
|
||||
flags.complex = true;
|
||||
flags.single_threaded = true;
|
||||
}
|
||||
|
||||
void SingleThreadedOperation::initExecution()
|
||||
void SingleThreadedOperation::init_execution()
|
||||
{
|
||||
initMutex();
|
||||
init_mutex();
|
||||
}
|
||||
|
||||
void SingleThreadedOperation::executePixel(float output[4], int x, int y, void * /*data*/)
|
||||
void SingleThreadedOperation::execute_pixel(float output[4], int x, int y, void * /*data*/)
|
||||
{
|
||||
cachedInstance_->readNoCheck(output, x, y);
|
||||
cached_instance_->read_no_check(output, x, y);
|
||||
}
|
||||
|
||||
void SingleThreadedOperation::deinitExecution()
|
||||
void SingleThreadedOperation::deinit_execution()
|
||||
{
|
||||
deinitMutex();
|
||||
if (cachedInstance_) {
|
||||
delete cachedInstance_;
|
||||
cachedInstance_ = nullptr;
|
||||
deinit_mutex();
|
||||
if (cached_instance_) {
|
||||
delete cached_instance_;
|
||||
cached_instance_ = nullptr;
|
||||
}
|
||||
}
|
||||
void *SingleThreadedOperation::initializeTileData(rcti *rect)
|
||||
void *SingleThreadedOperation::initialize_tile_data(rcti *rect)
|
||||
{
|
||||
if (cachedInstance_) {
|
||||
return cachedInstance_;
|
||||
if (cached_instance_) {
|
||||
return cached_instance_;
|
||||
}
|
||||
|
||||
lockMutex();
|
||||
if (cachedInstance_ == nullptr) {
|
||||
lock_mutex();
|
||||
if (cached_instance_ == nullptr) {
|
||||
//
|
||||
cachedInstance_ = createMemoryBuffer(rect);
|
||||
cached_instance_ = create_memory_buffer(rect);
|
||||
}
|
||||
unlockMutex();
|
||||
return cachedInstance_;
|
||||
unlock_mutex();
|
||||
return cached_instance_;
|
||||
}
|
||||
|
||||
} // namespace blender::compositor
|
||||
|
||||
@@ -24,12 +24,12 @@ namespace blender::compositor {
|
||||
|
||||
class SingleThreadedOperation : public NodeOperation {
|
||||
private:
|
||||
MemoryBuffer *cachedInstance_;
|
||||
MemoryBuffer *cached_instance_;
|
||||
|
||||
protected:
|
||||
inline bool isCached()
|
||||
inline bool is_cached()
|
||||
{
|
||||
return cachedInstance_ != nullptr;
|
||||
return cached_instance_ != nullptr;
|
||||
}
|
||||
|
||||
public:
|
||||
@@ -38,21 +38,21 @@ class SingleThreadedOperation : public NodeOperation {
|
||||
/**
|
||||
* The inner loop of this operation.
|
||||
*/
|
||||
void executePixel(float output[4], int x, int y, void *data) override;
|
||||
void execute_pixel(float output[4], int x, int y, void *data) override;
|
||||
|
||||
/**
|
||||
* Initialize the execution
|
||||
*/
|
||||
void initExecution() override;
|
||||
void init_execution() override;
|
||||
|
||||
/**
|
||||
* Deinitialize the execution
|
||||
*/
|
||||
void deinitExecution() override;
|
||||
void deinit_execution() override;
|
||||
|
||||
void *initializeTileData(rcti *rect) override;
|
||||
void *initialize_tile_data(rcti *rect) override;
|
||||
|
||||
virtual MemoryBuffer *createMemoryBuffer(rcti *rect) = 0;
|
||||
virtual MemoryBuffer *create_memory_buffer(rcti *rect) = 0;
|
||||
};
|
||||
|
||||
} // namespace blender::compositor
|
||||
|
||||
@@ -35,24 +35,24 @@ TiledExecutionModel::TiledExecutionModel(CompositorContext &context,
|
||||
Span<ExecutionGroup *> groups)
|
||||
: ExecutionModel(context, operations), groups_(groups)
|
||||
{
|
||||
const bNodeTree *node_tree = context.getbNodeTree();
|
||||
const bNodeTree *node_tree = context.get_bnodetree();
|
||||
node_tree->stats_draw(node_tree->sdh, TIP_("Compositing | Determining resolution"));
|
||||
|
||||
unsigned int resolution[2];
|
||||
for (ExecutionGroup *group : groups_) {
|
||||
resolution[0] = 0;
|
||||
resolution[1] = 0;
|
||||
group->determineResolution(resolution);
|
||||
group->determine_resolution(resolution);
|
||||
|
||||
if (border_.use_render_border) {
|
||||
const rctf *render_border = border_.render_border;
|
||||
group->setRenderBorder(
|
||||
group->set_render_border(
|
||||
render_border->xmin, render_border->xmax, render_border->ymin, render_border->ymax);
|
||||
}
|
||||
|
||||
if (border_.use_viewer_border) {
|
||||
const rctf *viewer_border = border_.viewer_border;
|
||||
group->setViewerBorder(
|
||||
group->set_viewer_border(
|
||||
viewer_border->xmin, viewer_border->xmax, viewer_border->ymin, viewer_border->ymax);
|
||||
}
|
||||
}
|
||||
@@ -63,8 +63,8 @@ static void update_read_buffer_offset(Span<NodeOperation *> operations)
|
||||
unsigned int order = 0;
|
||||
for (NodeOperation *operation : operations) {
|
||||
if (operation->get_flags().is_read_buffer_operation) {
|
||||
ReadBufferOperation *readOperation = (ReadBufferOperation *)operation;
|
||||
readOperation->setOffset(order);
|
||||
ReadBufferOperation *read_operation = (ReadBufferOperation *)operation;
|
||||
read_operation->set_offset(order);
|
||||
order++;
|
||||
}
|
||||
}
|
||||
@@ -75,8 +75,8 @@ static void init_write_operations_for_execution(Span<NodeOperation *> operations
|
||||
{
|
||||
for (NodeOperation *operation : operations) {
|
||||
if (operation->get_flags().is_write_buffer_operation) {
|
||||
operation->setbNodeTree(bTree);
|
||||
operation->initExecution();
|
||||
operation->set_bnodetree(bTree);
|
||||
operation->init_execution();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -85,8 +85,8 @@ static void link_write_buffers(Span<NodeOperation *> operations)
|
||||
{
|
||||
for (NodeOperation *operation : operations) {
|
||||
if (operation->get_flags().is_read_buffer_operation) {
|
||||
ReadBufferOperation *readOperation = static_cast<ReadBufferOperation *>(operation);
|
||||
readOperation->updateMemoryBuffer();
|
||||
ReadBufferOperation *read_operation = static_cast<ReadBufferOperation *>(operation);
|
||||
read_operation->update_memory_buffer();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -96,8 +96,8 @@ static void init_non_write_operations_for_execution(Span<NodeOperation *> operat
|
||||
{
|
||||
for (NodeOperation *operation : operations) {
|
||||
if (!operation->get_flags().is_write_buffer_operation) {
|
||||
operation->setbNodeTree(bTree);
|
||||
operation->initExecution();
|
||||
operation->set_bnodetree(bTree);
|
||||
operation->init_execution();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -106,27 +106,27 @@ static void init_execution_groups_for_execution(Span<ExecutionGroup *> groups,
|
||||
const int chunk_size)
|
||||
{
|
||||
for (ExecutionGroup *execution_group : groups) {
|
||||
execution_group->setChunksize(chunk_size);
|
||||
execution_group->initExecution();
|
||||
execution_group->set_chunksize(chunk_size);
|
||||
execution_group->init_execution();
|
||||
}
|
||||
}
|
||||
|
||||
void TiledExecutionModel::execute(ExecutionSystem &exec_system)
|
||||
{
|
||||
const bNodeTree *editingtree = this->context_.getbNodeTree();
|
||||
const bNodeTree *editingtree = this->context_.get_bnodetree();
|
||||
|
||||
editingtree->stats_draw(editingtree->sdh, TIP_("Compositing | Initializing execution"));
|
||||
|
||||
update_read_buffer_offset(operations_);
|
||||
|
||||
init_write_operations_for_execution(operations_, context_.getbNodeTree());
|
||||
init_write_operations_for_execution(operations_, context_.get_bnodetree());
|
||||
link_write_buffers(operations_);
|
||||
init_non_write_operations_for_execution(operations_, context_.getbNodeTree());
|
||||
init_execution_groups_for_execution(groups_, context_.getChunksize());
|
||||
init_non_write_operations_for_execution(operations_, context_.get_bnodetree());
|
||||
init_execution_groups_for_execution(groups_, context_.get_chunksize());
|
||||
|
||||
WorkScheduler::start(context_);
|
||||
execute_groups(eCompositorPriority::High, exec_system);
|
||||
if (!context_.isFastCalculation()) {
|
||||
if (!context_.is_fast_calculation()) {
|
||||
execute_groups(eCompositorPriority::Medium, exec_system);
|
||||
execute_groups(eCompositorPriority::Low, exec_system);
|
||||
}
|
||||
@@ -136,11 +136,11 @@ void TiledExecutionModel::execute(ExecutionSystem &exec_system)
|
||||
editingtree->stats_draw(editingtree->sdh, TIP_("Compositing | De-initializing execution"));
|
||||
|
||||
for (NodeOperation *operation : operations_) {
|
||||
operation->deinitExecution();
|
||||
operation->deinit_execution();
|
||||
}
|
||||
|
||||
for (ExecutionGroup *execution_group : groups_) {
|
||||
execution_group->deinitExecution();
|
||||
execution_group->deinit_execution();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -149,7 +149,7 @@ void TiledExecutionModel::execute_groups(eCompositorPriority priority,
|
||||
{
|
||||
for (ExecutionGroup *execution_group : groups_) {
|
||||
if (execution_group->get_flags().is_output &&
|
||||
execution_group->getRenderPriority() == priority) {
|
||||
execution_group->get_render_priority() == priority) {
|
||||
execution_group->execute(&exec_system);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ struct WorkPackage {
|
||||
eWorkPackageState state = eWorkPackageState::NotScheduled;
|
||||
|
||||
/**
|
||||
* \brief executionGroup with the operations-setup to be evaluated
|
||||
* \brief execution_group with the operations-setup to be evaluated
|
||||
*/
|
||||
ExecutionGroup *execution_group;
|
||||
|
||||
|
||||
@@ -104,10 +104,10 @@ static struct {
|
||||
/** \name OpenCL Scheduling
|
||||
* \{ */
|
||||
|
||||
static void CL_CALLBACK clContextError(const char *errinfo,
|
||||
const void * /*private_info*/,
|
||||
size_t /*cb*/,
|
||||
void * /*user_data*/)
|
||||
static void CL_CALLBACK cl_context_error(const char *errinfo,
|
||||
const void * /*private_info*/,
|
||||
size_t /*cb*/,
|
||||
void * /*user_data*/)
|
||||
{
|
||||
printf("OPENCL error: %s\n", errinfo);
|
||||
}
|
||||
@@ -126,7 +126,7 @@ static void *thread_execute_gpu(void *data)
|
||||
|
||||
static void opencl_start(const CompositorContext &context)
|
||||
{
|
||||
if (context.getHasActiveOpenCLDevices()) {
|
||||
if (context.get_has_active_opencl_devices()) {
|
||||
g_work_scheduler.opencl.queue = BLI_thread_queue_init();
|
||||
BLI_threadpool_init(&g_work_scheduler.opencl.threads,
|
||||
thread_execute_gpu,
|
||||
@@ -186,35 +186,35 @@ static void opencl_initialize(const bool use_opencl)
|
||||
}
|
||||
|
||||
if (clCreateContextFromType) {
|
||||
cl_uint numberOfPlatforms = 0;
|
||||
cl_uint number_of_platforms = 0;
|
||||
cl_int error;
|
||||
error = clGetPlatformIDs(0, nullptr, &numberOfPlatforms);
|
||||
error = clGetPlatformIDs(0, nullptr, &number_of_platforms);
|
||||
if (error == -1001) {
|
||||
} /* GPU not supported */
|
||||
else if (error != CL_SUCCESS) {
|
||||
printf("CLERROR[%d]: %s\n", error, clewErrorString(error));
|
||||
}
|
||||
if (G.f & G_DEBUG) {
|
||||
printf("%u number of platforms\n", numberOfPlatforms);
|
||||
printf("%u number of platforms\n", number_of_platforms);
|
||||
}
|
||||
cl_platform_id *platforms = (cl_platform_id *)MEM_mallocN(
|
||||
sizeof(cl_platform_id) * numberOfPlatforms, __func__);
|
||||
error = clGetPlatformIDs(numberOfPlatforms, platforms, nullptr);
|
||||
unsigned int indexPlatform;
|
||||
for (indexPlatform = 0; indexPlatform < numberOfPlatforms; indexPlatform++) {
|
||||
cl_platform_id platform = platforms[indexPlatform];
|
||||
cl_uint numberOfDevices = 0;
|
||||
clGetDeviceIDs(platform, CL_DEVICE_TYPE_GPU, 0, nullptr, &numberOfDevices);
|
||||
if (numberOfDevices <= 0) {
|
||||
sizeof(cl_platform_id) * number_of_platforms, __func__);
|
||||
error = clGetPlatformIDs(number_of_platforms, platforms, nullptr);
|
||||
unsigned int index_platform;
|
||||
for (index_platform = 0; index_platform < number_of_platforms; index_platform++) {
|
||||
cl_platform_id platform = platforms[index_platform];
|
||||
cl_uint number_of_devices = 0;
|
||||
clGetDeviceIDs(platform, CL_DEVICE_TYPE_GPU, 0, nullptr, &number_of_devices);
|
||||
if (number_of_devices <= 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
cl_device_id *cldevices = (cl_device_id *)MEM_mallocN(
|
||||
sizeof(cl_device_id) * numberOfDevices, __func__);
|
||||
clGetDeviceIDs(platform, CL_DEVICE_TYPE_GPU, numberOfDevices, cldevices, nullptr);
|
||||
sizeof(cl_device_id) * number_of_devices, __func__);
|
||||
clGetDeviceIDs(platform, CL_DEVICE_TYPE_GPU, number_of_devices, cldevices, nullptr);
|
||||
|
||||
g_work_scheduler.opencl.context = clCreateContext(
|
||||
nullptr, numberOfDevices, cldevices, clContextError, nullptr, &error);
|
||||
nullptr, number_of_devices, cldevices, cl_context_error, nullptr, &error);
|
||||
if (error != CL_SUCCESS) {
|
||||
printf("CLERROR[%d]: %s\n", error, clewErrorString(error));
|
||||
}
|
||||
@@ -222,7 +222,7 @@ static void opencl_initialize(const bool use_opencl)
|
||||
g_work_scheduler.opencl.program = clCreateProgramWithSource(
|
||||
g_work_scheduler.opencl.context, 1, cl_str, nullptr, &error);
|
||||
error = clBuildProgram(g_work_scheduler.opencl.program,
|
||||
numberOfDevices,
|
||||
number_of_devices,
|
||||
cldevices,
|
||||
nullptr,
|
||||
nullptr,
|
||||
@@ -255,9 +255,9 @@ static void opencl_initialize(const bool use_opencl)
|
||||
MEM_freeN(build_log);
|
||||
}
|
||||
else {
|
||||
unsigned int indexDevices;
|
||||
for (indexDevices = 0; indexDevices < numberOfDevices; indexDevices++) {
|
||||
cl_device_id device = cldevices[indexDevices];
|
||||
unsigned int index_devices;
|
||||
for (index_devices = 0; index_devices < number_of_devices; index_devices++) {
|
||||
cl_device_id device = cldevices[index_devices];
|
||||
cl_int vendorID = 0;
|
||||
cl_int error2 = clGetDeviceInfo(
|
||||
device, CL_DEVICE_VENDOR_ID, sizeof(cl_int), &vendorID, nullptr);
|
||||
|
||||
@@ -81,7 +81,7 @@ struct WorkScheduler {
|
||||
* \brief Are there OpenCL capable GPU devices initialized?
|
||||
* the result of this method is stored in the CompositorContext
|
||||
* A node can generate a different operation tree when OpenCLDevices exists.
|
||||
* \see CompositorContext.getHasActiveOpenCLDevices
|
||||
* \see CompositorContext.get_has_active_opencl_devices
|
||||
*/
|
||||
static bool has_gpu_devices();
|
||||
|
||||
|
||||
@@ -64,9 +64,9 @@ void COM_execute(RenderData *render_data,
|
||||
Scene *scene,
|
||||
bNodeTree *node_tree,
|
||||
int rendering,
|
||||
const ColorManagedViewSettings *viewSettings,
|
||||
const ColorManagedDisplaySettings *displaySettings,
|
||||
const char *viewName)
|
||||
const ColorManagedViewSettings *view_settings,
|
||||
const ColorManagedDisplaySettings *display_settings,
|
||||
const char *view_name)
|
||||
{
|
||||
/* Initialize mutex, TODO: this mutex init is actually not thread safe and
|
||||
* should be done somewhere as part of blender startup, all the other
|
||||
@@ -95,8 +95,14 @@ void COM_execute(RenderData *render_data,
|
||||
/* Execute. */
|
||||
const bool twopass = (node_tree->flag & NTREE_TWO_PASS) && !rendering;
|
||||
if (twopass) {
|
||||
blender::compositor::ExecutionSystem fast_pass(
|
||||
render_data, scene, node_tree, rendering, true, viewSettings, displaySettings, viewName);
|
||||
blender::compositor::ExecutionSystem fast_pass(render_data,
|
||||
scene,
|
||||
node_tree,
|
||||
rendering,
|
||||
true,
|
||||
view_settings,
|
||||
display_settings,
|
||||
view_name);
|
||||
fast_pass.execute();
|
||||
|
||||
if (node_tree->test_break(node_tree->tbh)) {
|
||||
@@ -106,7 +112,7 @@ void COM_execute(RenderData *render_data,
|
||||
}
|
||||
|
||||
blender::compositor::ExecutionSystem system(
|
||||
render_data, scene, node_tree, rendering, false, viewSettings, displaySettings, viewName);
|
||||
render_data, scene, node_tree, rendering, false, view_settings, display_settings, view_name);
|
||||
system.execute();
|
||||
|
||||
BLI_mutex_unlock(&g_compositor.mutex);
|
||||
|
||||
@@ -24,43 +24,43 @@
|
||||
|
||||
namespace blender::compositor {
|
||||
|
||||
void AlphaOverNode::convertToOperations(NodeConverter &converter,
|
||||
const CompositorContext & /*context*/) const
|
||||
void AlphaOverNode::convert_to_operations(NodeConverter &converter,
|
||||
const CompositorContext & /*context*/) const
|
||||
{
|
||||
NodeInput *color1Socket = this->getInputSocket(1);
|
||||
NodeInput *color2Socket = this->getInputSocket(2);
|
||||
bNode *editorNode = this->getbNode();
|
||||
NodeInput *color1Socket = this->get_input_socket(1);
|
||||
NodeInput *color2Socket = this->get_input_socket(2);
|
||||
bNode *editor_node = this->get_bnode();
|
||||
|
||||
MixBaseOperation *convertProg;
|
||||
NodeTwoFloats *ntf = (NodeTwoFloats *)editorNode->storage;
|
||||
MixBaseOperation *convert_prog;
|
||||
NodeTwoFloats *ntf = (NodeTwoFloats *)editor_node->storage;
|
||||
if (ntf->x != 0.0f) {
|
||||
AlphaOverMixedOperation *mixOperation = new AlphaOverMixedOperation();
|
||||
mixOperation->setX(ntf->x);
|
||||
convertProg = mixOperation;
|
||||
AlphaOverMixedOperation *mix_operation = new AlphaOverMixedOperation();
|
||||
mix_operation->setX(ntf->x);
|
||||
convert_prog = mix_operation;
|
||||
}
|
||||
else if (editorNode->custom1) {
|
||||
convertProg = new AlphaOverKeyOperation();
|
||||
else if (editor_node->custom1) {
|
||||
convert_prog = new AlphaOverKeyOperation();
|
||||
}
|
||||
else {
|
||||
convertProg = new AlphaOverPremultiplyOperation();
|
||||
convert_prog = new AlphaOverPremultiplyOperation();
|
||||
}
|
||||
|
||||
convertProg->setUseValueAlphaMultiply(false);
|
||||
if (color1Socket->isLinked()) {
|
||||
convertProg->set_canvas_input_index(1);
|
||||
convert_prog->set_use_value_alpha_multiply(false);
|
||||
if (color1Socket->is_linked()) {
|
||||
convert_prog->set_canvas_input_index(1);
|
||||
}
|
||||
else if (color2Socket->isLinked()) {
|
||||
convertProg->set_canvas_input_index(2);
|
||||
else if (color2Socket->is_linked()) {
|
||||
convert_prog->set_canvas_input_index(2);
|
||||
}
|
||||
else {
|
||||
convertProg->set_canvas_input_index(0);
|
||||
convert_prog->set_canvas_input_index(0);
|
||||
}
|
||||
|
||||
converter.addOperation(convertProg);
|
||||
converter.mapInputSocket(getInputSocket(0), convertProg->getInputSocket(0));
|
||||
converter.mapInputSocket(getInputSocket(1), convertProg->getInputSocket(1));
|
||||
converter.mapInputSocket(getInputSocket(2), convertProg->getInputSocket(2));
|
||||
converter.mapOutputSocket(getOutputSocket(0), convertProg->getOutputSocket(0));
|
||||
converter.add_operation(convert_prog);
|
||||
converter.map_input_socket(get_input_socket(0), convert_prog->get_input_socket(0));
|
||||
converter.map_input_socket(get_input_socket(1), convert_prog->get_input_socket(1));
|
||||
converter.map_input_socket(get_input_socket(2), convert_prog->get_input_socket(2));
|
||||
converter.map_output_socket(get_output_socket(0), convert_prog->get_output_socket(0));
|
||||
}
|
||||
|
||||
} // namespace blender::compositor
|
||||
|
||||
@@ -28,11 +28,11 @@ namespace blender::compositor {
|
||||
*/
|
||||
class AlphaOverNode : public Node {
|
||||
public:
|
||||
AlphaOverNode(bNode *editorNode) : Node(editorNode)
|
||||
AlphaOverNode(bNode *editor_node) : Node(editor_node)
|
||||
{
|
||||
}
|
||||
void convertToOperations(NodeConverter &converter,
|
||||
const CompositorContext &context) const override;
|
||||
void convert_to_operations(NodeConverter &converter,
|
||||
const CompositorContext &context) const override;
|
||||
};
|
||||
|
||||
} // namespace blender::compositor
|
||||
|
||||
@@ -23,37 +23,37 @@
|
||||
|
||||
namespace blender::compositor {
|
||||
|
||||
void AntiAliasingNode::convertToOperations(NodeConverter &converter,
|
||||
const CompositorContext & /*context*/) const
|
||||
void AntiAliasingNode::convert_to_operations(NodeConverter &converter,
|
||||
const CompositorContext & /*context*/) const
|
||||
{
|
||||
bNode *node = this->getbNode();
|
||||
bNode *node = this->get_bnode();
|
||||
NodeAntiAliasingData *data = (NodeAntiAliasingData *)node->storage;
|
||||
|
||||
/* Edge Detection (First Pass) */
|
||||
SMAAEdgeDetectionOperation *operation1 = nullptr;
|
||||
|
||||
operation1 = new SMAAEdgeDetectionOperation();
|
||||
operation1->setThreshold(data->threshold);
|
||||
operation1->setLocalContrastAdaptationFactor(data->contrast_limit);
|
||||
converter.addOperation(operation1);
|
||||
operation1->set_threshold(data->threshold);
|
||||
operation1->set_local_contrast_adaptation_factor(data->contrast_limit);
|
||||
converter.add_operation(operation1);
|
||||
|
||||
converter.mapInputSocket(getInputSocket(0), operation1->getInputSocket(0));
|
||||
converter.map_input_socket(get_input_socket(0), operation1->get_input_socket(0));
|
||||
|
||||
/* Blending Weight Calculation Pixel Shader (Second Pass) */
|
||||
SMAABlendingWeightCalculationOperation *operation2 =
|
||||
new SMAABlendingWeightCalculationOperation();
|
||||
operation2->setCornerRounding(data->corner_rounding);
|
||||
converter.addOperation(operation2);
|
||||
operation2->set_corner_rounding(data->corner_rounding);
|
||||
converter.add_operation(operation2);
|
||||
|
||||
converter.addLink(operation1->getOutputSocket(), operation2->getInputSocket(0));
|
||||
converter.add_link(operation1->get_output_socket(), operation2->get_input_socket(0));
|
||||
|
||||
/* Neighborhood Blending Pixel Shader (Third Pass) */
|
||||
SMAANeighborhoodBlendingOperation *operation3 = new SMAANeighborhoodBlendingOperation();
|
||||
converter.addOperation(operation3);
|
||||
converter.add_operation(operation3);
|
||||
|
||||
converter.mapInputSocket(getInputSocket(0), operation3->getInputSocket(0));
|
||||
converter.addLink(operation2->getOutputSocket(), operation3->getInputSocket(1));
|
||||
converter.mapOutputSocket(getOutputSocket(0), operation3->getOutputSocket());
|
||||
converter.map_input_socket(get_input_socket(0), operation3->get_input_socket(0));
|
||||
converter.add_link(operation2->get_output_socket(), operation3->get_input_socket(1));
|
||||
converter.map_output_socket(get_output_socket(0), operation3->get_output_socket());
|
||||
}
|
||||
|
||||
} // namespace blender::compositor
|
||||
|
||||
@@ -30,11 +30,11 @@ namespace blender::compositor {
|
||||
*/
|
||||
class AntiAliasingNode : public Node {
|
||||
public:
|
||||
AntiAliasingNode(bNode *editorNode) : Node(editorNode)
|
||||
AntiAliasingNode(bNode *editor_node) : Node(editor_node)
|
||||
{
|
||||
}
|
||||
void convertToOperations(NodeConverter &converter,
|
||||
const CompositorContext &context) const override;
|
||||
void convert_to_operations(NodeConverter &converter,
|
||||
const CompositorContext &context) const override;
|
||||
};
|
||||
|
||||
} // namespace blender::compositor
|
||||
|
||||
@@ -21,23 +21,23 @@
|
||||
|
||||
namespace blender::compositor {
|
||||
|
||||
BilateralBlurNode::BilateralBlurNode(bNode *editorNode) : Node(editorNode)
|
||||
BilateralBlurNode::BilateralBlurNode(bNode *editor_node) : Node(editor_node)
|
||||
{
|
||||
/* pass */
|
||||
}
|
||||
|
||||
void BilateralBlurNode::convertToOperations(NodeConverter &converter,
|
||||
const CompositorContext &context) const
|
||||
void BilateralBlurNode::convert_to_operations(NodeConverter &converter,
|
||||
const CompositorContext &context) const
|
||||
{
|
||||
NodeBilateralBlurData *data = (NodeBilateralBlurData *)this->getbNode()->storage;
|
||||
NodeBilateralBlurData *data = (NodeBilateralBlurData *)this->get_bnode()->storage;
|
||||
BilateralBlurOperation *operation = new BilateralBlurOperation();
|
||||
operation->setQuality(context.getQuality());
|
||||
operation->setData(data);
|
||||
operation->set_quality(context.get_quality());
|
||||
operation->set_data(data);
|
||||
|
||||
converter.addOperation(operation);
|
||||
converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0));
|
||||
converter.mapInputSocket(getInputSocket(1), operation->getInputSocket(1));
|
||||
converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket(0));
|
||||
converter.add_operation(operation);
|
||||
converter.map_input_socket(get_input_socket(0), operation->get_input_socket(0));
|
||||
converter.map_input_socket(get_input_socket(1), operation->get_input_socket(1));
|
||||
converter.map_output_socket(get_output_socket(0), operation->get_output_socket(0));
|
||||
}
|
||||
|
||||
} // namespace blender::compositor
|
||||
|
||||
@@ -28,9 +28,9 @@ namespace blender::compositor {
|
||||
*/
|
||||
class BilateralBlurNode : public Node {
|
||||
public:
|
||||
BilateralBlurNode(bNode *editorNode);
|
||||
void convertToOperations(NodeConverter &converter,
|
||||
const CompositorContext &context) const override;
|
||||
BilateralBlurNode(bNode *editor_node);
|
||||
void convert_to_operations(NodeConverter &converter,
|
||||
const CompositorContext &context) const override;
|
||||
};
|
||||
|
||||
} // namespace blender::compositor
|
||||
|
||||
@@ -29,103 +29,103 @@
|
||||
|
||||
namespace blender::compositor {
|
||||
|
||||
BlurNode::BlurNode(bNode *editorNode) : Node(editorNode)
|
||||
BlurNode::BlurNode(bNode *editor_node) : Node(editor_node)
|
||||
{
|
||||
/* pass */
|
||||
}
|
||||
|
||||
void BlurNode::convertToOperations(NodeConverter &converter,
|
||||
const CompositorContext &context) const
|
||||
void BlurNode::convert_to_operations(NodeConverter &converter,
|
||||
const CompositorContext &context) const
|
||||
{
|
||||
bNode *editorNode = this->getbNode();
|
||||
NodeBlurData *data = (NodeBlurData *)editorNode->storage;
|
||||
NodeInput *inputSizeSocket = this->getInputSocket(1);
|
||||
bool connectedSizeSocket = inputSizeSocket->isLinked();
|
||||
bNode *editor_node = this->get_bnode();
|
||||
NodeBlurData *data = (NodeBlurData *)editor_node->storage;
|
||||
NodeInput *input_size_socket = this->get_input_socket(1);
|
||||
bool connected_size_socket = input_size_socket->is_linked();
|
||||
|
||||
const float size = this->getInputSocket(1)->getEditorValueFloat();
|
||||
const bool extend_bounds = (editorNode->custom1 & CMP_NODEFLAG_BLUR_EXTEND_BOUNDS) != 0;
|
||||
const float size = this->get_input_socket(1)->get_editor_value_float();
|
||||
const bool extend_bounds = (editor_node->custom1 & CMP_NODEFLAG_BLUR_EXTEND_BOUNDS) != 0;
|
||||
|
||||
eCompositorQuality quality = context.getQuality();
|
||||
eCompositorQuality quality = context.get_quality();
|
||||
NodeOperation *input_operation = nullptr, *output_operation = nullptr;
|
||||
|
||||
if (data->filtertype == R_FILTER_FAST_GAUSS) {
|
||||
FastGaussianBlurOperation *operationfgb = new FastGaussianBlurOperation();
|
||||
operationfgb->setData(data);
|
||||
operationfgb->setExtendBounds(extend_bounds);
|
||||
converter.addOperation(operationfgb);
|
||||
operationfgb->set_data(data);
|
||||
operationfgb->set_extend_bounds(extend_bounds);
|
||||
converter.add_operation(operationfgb);
|
||||
|
||||
converter.mapInputSocket(getInputSocket(1), operationfgb->getInputSocket(1));
|
||||
converter.map_input_socket(get_input_socket(1), operationfgb->get_input_socket(1));
|
||||
|
||||
input_operation = operationfgb;
|
||||
output_operation = operationfgb;
|
||||
}
|
||||
else if (editorNode->custom1 & CMP_NODEFLAG_BLUR_VARIABLE_SIZE) {
|
||||
else if (editor_node->custom1 & CMP_NODEFLAG_BLUR_VARIABLE_SIZE) {
|
||||
MathAddOperation *clamp = new MathAddOperation();
|
||||
SetValueOperation *zero = new SetValueOperation();
|
||||
zero->setValue(0.0f);
|
||||
clamp->setUseClamp(true);
|
||||
zero->set_value(0.0f);
|
||||
clamp->set_use_clamp(true);
|
||||
|
||||
converter.addOperation(clamp);
|
||||
converter.addOperation(zero);
|
||||
converter.mapInputSocket(getInputSocket(1), clamp->getInputSocket(0));
|
||||
converter.addLink(zero->getOutputSocket(), clamp->getInputSocket(1));
|
||||
converter.add_operation(clamp);
|
||||
converter.add_operation(zero);
|
||||
converter.map_input_socket(get_input_socket(1), clamp->get_input_socket(0));
|
||||
converter.add_link(zero->get_output_socket(), clamp->get_input_socket(1));
|
||||
|
||||
GaussianAlphaXBlurOperation *operationx = new GaussianAlphaXBlurOperation();
|
||||
operationx->setData(data);
|
||||
operationx->setQuality(quality);
|
||||
operationx->setSize(1.0f);
|
||||
operationx->setFalloff(PROP_SMOOTH);
|
||||
operationx->setSubtract(false);
|
||||
operationx->setExtendBounds(extend_bounds);
|
||||
operationx->set_data(data);
|
||||
operationx->set_quality(quality);
|
||||
operationx->set_size(1.0f);
|
||||
operationx->set_falloff(PROP_SMOOTH);
|
||||
operationx->set_subtract(false);
|
||||
operationx->set_extend_bounds(extend_bounds);
|
||||
|
||||
converter.addOperation(operationx);
|
||||
converter.addLink(clamp->getOutputSocket(), operationx->getInputSocket(0));
|
||||
converter.add_operation(operationx);
|
||||
converter.add_link(clamp->get_output_socket(), operationx->get_input_socket(0));
|
||||
|
||||
GaussianAlphaYBlurOperation *operationy = new GaussianAlphaYBlurOperation();
|
||||
operationy->setData(data);
|
||||
operationy->setQuality(quality);
|
||||
operationy->setSize(1.0f);
|
||||
operationy->setFalloff(PROP_SMOOTH);
|
||||
operationy->setSubtract(false);
|
||||
operationy->setExtendBounds(extend_bounds);
|
||||
operationy->set_data(data);
|
||||
operationy->set_quality(quality);
|
||||
operationy->set_size(1.0f);
|
||||
operationy->set_falloff(PROP_SMOOTH);
|
||||
operationy->set_subtract(false);
|
||||
operationy->set_extend_bounds(extend_bounds);
|
||||
|
||||
converter.addOperation(operationy);
|
||||
converter.addLink(operationx->getOutputSocket(), operationy->getInputSocket(0));
|
||||
converter.add_operation(operationy);
|
||||
converter.add_link(operationx->get_output_socket(), operationy->get_input_socket(0));
|
||||
|
||||
GaussianBlurReferenceOperation *operation = new GaussianBlurReferenceOperation();
|
||||
operation->setData(data);
|
||||
operation->setQuality(quality);
|
||||
operation->setExtendBounds(extend_bounds);
|
||||
operation->set_data(data);
|
||||
operation->set_quality(quality);
|
||||
operation->set_extend_bounds(extend_bounds);
|
||||
|
||||
converter.addOperation(operation);
|
||||
converter.addLink(operationy->getOutputSocket(), operation->getInputSocket(1));
|
||||
converter.add_operation(operation);
|
||||
converter.add_link(operationy->get_output_socket(), operation->get_input_socket(1));
|
||||
|
||||
output_operation = operation;
|
||||
input_operation = operation;
|
||||
}
|
||||
else if (!data->bokeh) {
|
||||
GaussianXBlurOperation *operationx = new GaussianXBlurOperation();
|
||||
operationx->setData(data);
|
||||
operationx->setQuality(quality);
|
||||
operationx->checkOpenCL();
|
||||
operationx->setExtendBounds(extend_bounds);
|
||||
operationx->set_data(data);
|
||||
operationx->set_quality(quality);
|
||||
operationx->check_opencl();
|
||||
operationx->set_extend_bounds(extend_bounds);
|
||||
|
||||
converter.addOperation(operationx);
|
||||
converter.mapInputSocket(getInputSocket(1), operationx->getInputSocket(1));
|
||||
converter.add_operation(operationx);
|
||||
converter.map_input_socket(get_input_socket(1), operationx->get_input_socket(1));
|
||||
|
||||
GaussianYBlurOperation *operationy = new GaussianYBlurOperation();
|
||||
operationy->setData(data);
|
||||
operationy->setQuality(quality);
|
||||
operationy->checkOpenCL();
|
||||
operationy->setExtendBounds(extend_bounds);
|
||||
operationy->set_data(data);
|
||||
operationy->set_quality(quality);
|
||||
operationy->check_opencl();
|
||||
operationy->set_extend_bounds(extend_bounds);
|
||||
|
||||
converter.addOperation(operationy);
|
||||
converter.mapInputSocket(getInputSocket(1), operationy->getInputSocket(1));
|
||||
converter.addLink(operationx->getOutputSocket(), operationy->getInputSocket(0));
|
||||
converter.add_operation(operationy);
|
||||
converter.map_input_socket(get_input_socket(1), operationy->get_input_socket(1));
|
||||
converter.add_link(operationx->get_output_socket(), operationy->get_input_socket(0));
|
||||
|
||||
if (!connectedSizeSocket) {
|
||||
operationx->setSize(size);
|
||||
operationy->setSize(size);
|
||||
if (!connected_size_socket) {
|
||||
operationx->set_size(size);
|
||||
operationy->set_size(size);
|
||||
}
|
||||
|
||||
input_operation = operationx;
|
||||
@@ -133,15 +133,15 @@ void BlurNode::convertToOperations(NodeConverter &converter,
|
||||
}
|
||||
else {
|
||||
GaussianBokehBlurOperation *operation = new GaussianBokehBlurOperation();
|
||||
operation->setData(data);
|
||||
operation->setQuality(quality);
|
||||
operation->setExtendBounds(extend_bounds);
|
||||
operation->set_data(data);
|
||||
operation->set_quality(quality);
|
||||
operation->set_extend_bounds(extend_bounds);
|
||||
|
||||
converter.addOperation(operation);
|
||||
converter.mapInputSocket(getInputSocket(1), operation->getInputSocket(1));
|
||||
converter.add_operation(operation);
|
||||
converter.map_input_socket(get_input_socket(1), operation->get_input_socket(1));
|
||||
|
||||
if (!connectedSizeSocket) {
|
||||
operation->setSize(size);
|
||||
if (!connected_size_socket) {
|
||||
operation->set_size(size);
|
||||
}
|
||||
|
||||
input_operation = operation;
|
||||
@@ -151,21 +151,21 @@ void BlurNode::convertToOperations(NodeConverter &converter,
|
||||
if (data->gamma) {
|
||||
GammaCorrectOperation *correct = new GammaCorrectOperation();
|
||||
GammaUncorrectOperation *inverse = new GammaUncorrectOperation();
|
||||
converter.addOperation(correct);
|
||||
converter.addOperation(inverse);
|
||||
converter.add_operation(correct);
|
||||
converter.add_operation(inverse);
|
||||
|
||||
converter.mapInputSocket(getInputSocket(0), correct->getInputSocket(0));
|
||||
converter.addLink(correct->getOutputSocket(), input_operation->getInputSocket(0));
|
||||
converter.addLink(output_operation->getOutputSocket(), inverse->getInputSocket(0));
|
||||
converter.mapOutputSocket(getOutputSocket(), inverse->getOutputSocket());
|
||||
converter.map_input_socket(get_input_socket(0), correct->get_input_socket(0));
|
||||
converter.add_link(correct->get_output_socket(), input_operation->get_input_socket(0));
|
||||
converter.add_link(output_operation->get_output_socket(), inverse->get_input_socket(0));
|
||||
converter.map_output_socket(get_output_socket(), inverse->get_output_socket());
|
||||
|
||||
converter.addPreview(inverse->getOutputSocket());
|
||||
converter.add_preview(inverse->get_output_socket());
|
||||
}
|
||||
else {
|
||||
converter.mapInputSocket(getInputSocket(0), input_operation->getInputSocket(0));
|
||||
converter.mapOutputSocket(getOutputSocket(), output_operation->getOutputSocket());
|
||||
converter.map_input_socket(get_input_socket(0), input_operation->get_input_socket(0));
|
||||
converter.map_output_socket(get_output_socket(), output_operation->get_output_socket());
|
||||
|
||||
converter.addPreview(output_operation->getOutputSocket());
|
||||
converter.add_preview(output_operation->get_output_socket());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -28,9 +28,9 @@ namespace blender::compositor {
|
||||
*/
|
||||
class BlurNode : public Node {
|
||||
public:
|
||||
BlurNode(bNode *editorNode);
|
||||
void convertToOperations(NodeConverter &converter,
|
||||
const CompositorContext &context) const override;
|
||||
BlurNode(bNode *editor_node);
|
||||
void convert_to_operations(NodeConverter &converter,
|
||||
const CompositorContext &context) const override;
|
||||
};
|
||||
|
||||
} // namespace blender::compositor
|
||||
|
||||
@@ -22,52 +22,52 @@
|
||||
|
||||
namespace blender::compositor {
|
||||
|
||||
BokehBlurNode::BokehBlurNode(bNode *editorNode) : Node(editorNode)
|
||||
BokehBlurNode::BokehBlurNode(bNode *editor_node) : Node(editor_node)
|
||||
{
|
||||
/* pass */
|
||||
}
|
||||
|
||||
void BokehBlurNode::convertToOperations(NodeConverter &converter,
|
||||
const CompositorContext &context) const
|
||||
void BokehBlurNode::convert_to_operations(NodeConverter &converter,
|
||||
const CompositorContext &context) const
|
||||
{
|
||||
bNode *b_node = this->getbNode();
|
||||
bNode *b_node = this->get_bnode();
|
||||
|
||||
NodeInput *inputSizeSocket = this->getInputSocket(2);
|
||||
NodeInput *input_size_socket = this->get_input_socket(2);
|
||||
|
||||
bool connectedSizeSocket = inputSizeSocket->isLinked();
|
||||
bool connected_size_socket = input_size_socket->is_linked();
|
||||
const bool extend_bounds = (b_node->custom1 & CMP_NODEFLAG_BLUR_EXTEND_BOUNDS) != 0;
|
||||
|
||||
if ((b_node->custom1 & CMP_NODEFLAG_BLUR_VARIABLE_SIZE) && connectedSizeSocket) {
|
||||
if ((b_node->custom1 & CMP_NODEFLAG_BLUR_VARIABLE_SIZE) && connected_size_socket) {
|
||||
VariableSizeBokehBlurOperation *operation = new VariableSizeBokehBlurOperation();
|
||||
operation->setQuality(context.getQuality());
|
||||
operation->setThreshold(0.0f);
|
||||
operation->setMaxBlur(b_node->custom4);
|
||||
operation->setDoScaleSize(true);
|
||||
operation->set_quality(context.get_quality());
|
||||
operation->set_threshold(0.0f);
|
||||
operation->set_max_blur(b_node->custom4);
|
||||
operation->set_do_scale_size(true);
|
||||
|
||||
converter.addOperation(operation);
|
||||
converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0));
|
||||
converter.mapInputSocket(getInputSocket(1), operation->getInputSocket(1));
|
||||
converter.mapInputSocket(getInputSocket(2), operation->getInputSocket(2));
|
||||
converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket());
|
||||
converter.add_operation(operation);
|
||||
converter.map_input_socket(get_input_socket(0), operation->get_input_socket(0));
|
||||
converter.map_input_socket(get_input_socket(1), operation->get_input_socket(1));
|
||||
converter.map_input_socket(get_input_socket(2), operation->get_input_socket(2));
|
||||
converter.map_output_socket(get_output_socket(0), operation->get_output_socket());
|
||||
}
|
||||
else {
|
||||
BokehBlurOperation *operation = new BokehBlurOperation();
|
||||
operation->setQuality(context.getQuality());
|
||||
operation->setExtendBounds(extend_bounds);
|
||||
operation->set_quality(context.get_quality());
|
||||
operation->set_extend_bounds(extend_bounds);
|
||||
|
||||
converter.addOperation(operation);
|
||||
converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0));
|
||||
converter.mapInputSocket(getInputSocket(1), operation->getInputSocket(1));
|
||||
converter.add_operation(operation);
|
||||
converter.map_input_socket(get_input_socket(0), operation->get_input_socket(0));
|
||||
converter.map_input_socket(get_input_socket(1), operation->get_input_socket(1));
|
||||
|
||||
/* NOTE: on the bokeh blur operation the sockets are switched.
|
||||
* for this reason the next two lines are correct. Fix for T43771. */
|
||||
converter.mapInputSocket(getInputSocket(2), operation->getInputSocket(3));
|
||||
converter.mapInputSocket(getInputSocket(3), operation->getInputSocket(2));
|
||||
converter.map_input_socket(get_input_socket(2), operation->get_input_socket(3));
|
||||
converter.map_input_socket(get_input_socket(3), operation->get_input_socket(2));
|
||||
|
||||
converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket());
|
||||
converter.map_output_socket(get_output_socket(0), operation->get_output_socket());
|
||||
|
||||
if (!connectedSizeSocket) {
|
||||
operation->setSize(this->getInputSocket(2)->getEditorValueFloat());
|
||||
if (!connected_size_socket) {
|
||||
operation->set_size(this->get_input_socket(2)->get_editor_value_float());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,9 +28,9 @@ namespace blender::compositor {
|
||||
*/
|
||||
class BokehBlurNode : public Node {
|
||||
public:
|
||||
BokehBlurNode(bNode *editorNode);
|
||||
void convertToOperations(NodeConverter &converter,
|
||||
const CompositorContext &context) const override;
|
||||
BokehBlurNode(bNode *editor_node);
|
||||
void convert_to_operations(NodeConverter &converter,
|
||||
const CompositorContext &context) const override;
|
||||
};
|
||||
|
||||
} // namespace blender::compositor
|
||||
|
||||
@@ -21,21 +21,21 @@
|
||||
|
||||
namespace blender::compositor {
|
||||
|
||||
BokehImageNode::BokehImageNode(bNode *editorNode) : Node(editorNode)
|
||||
BokehImageNode::BokehImageNode(bNode *editor_node) : Node(editor_node)
|
||||
{
|
||||
/* pass */
|
||||
}
|
||||
|
||||
void BokehImageNode::convertToOperations(NodeConverter &converter,
|
||||
const CompositorContext & /*context*/) const
|
||||
void BokehImageNode::convert_to_operations(NodeConverter &converter,
|
||||
const CompositorContext & /*context*/) const
|
||||
{
|
||||
BokehImageOperation *operation = new BokehImageOperation();
|
||||
operation->setData((NodeBokehImage *)this->getbNode()->storage);
|
||||
operation->set_data((NodeBokehImage *)this->get_bnode()->storage);
|
||||
|
||||
converter.addOperation(operation);
|
||||
converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket(0));
|
||||
converter.add_operation(operation);
|
||||
converter.map_output_socket(get_output_socket(0), operation->get_output_socket(0));
|
||||
|
||||
converter.addPreview(operation->getOutputSocket(0));
|
||||
converter.add_preview(operation->get_output_socket(0));
|
||||
}
|
||||
|
||||
} // namespace blender::compositor
|
||||
|
||||
@@ -28,9 +28,9 @@ namespace blender::compositor {
|
||||
*/
|
||||
class BokehImageNode : public Node {
|
||||
public:
|
||||
BokehImageNode(bNode *editorNode);
|
||||
void convertToOperations(NodeConverter &converter,
|
||||
const CompositorContext &context) const override;
|
||||
BokehImageNode(bNode *editor_node);
|
||||
void convert_to_operations(NodeConverter &converter,
|
||||
const CompositorContext &context) const override;
|
||||
};
|
||||
|
||||
} // namespace blender::compositor
|
||||
|
||||
@@ -24,52 +24,53 @@
|
||||
|
||||
namespace blender::compositor {
|
||||
|
||||
BoxMaskNode::BoxMaskNode(bNode *editorNode) : Node(editorNode)
|
||||
BoxMaskNode::BoxMaskNode(bNode *editor_node) : Node(editor_node)
|
||||
{
|
||||
/* pass */
|
||||
}
|
||||
|
||||
void BoxMaskNode::convertToOperations(NodeConverter &converter,
|
||||
const CompositorContext &context) const
|
||||
void BoxMaskNode::convert_to_operations(NodeConverter &converter,
|
||||
const CompositorContext &context) const
|
||||
{
|
||||
NodeInput *inputSocket = this->getInputSocket(0);
|
||||
NodeOutput *outputSocket = this->getOutputSocket(0);
|
||||
NodeInput *input_socket = this->get_input_socket(0);
|
||||
NodeOutput *output_socket = this->get_output_socket(0);
|
||||
|
||||
BoxMaskOperation *operation;
|
||||
operation = new BoxMaskOperation();
|
||||
operation->setData((NodeBoxMask *)this->getbNode()->storage);
|
||||
operation->setMaskType(this->getbNode()->custom1);
|
||||
converter.addOperation(operation);
|
||||
operation->set_data((NodeBoxMask *)this->get_bnode()->storage);
|
||||
operation->set_mask_type(this->get_bnode()->custom1);
|
||||
converter.add_operation(operation);
|
||||
|
||||
if (inputSocket->isLinked()) {
|
||||
converter.mapInputSocket(inputSocket, operation->getInputSocket(0));
|
||||
converter.mapOutputSocket(outputSocket, operation->getOutputSocket());
|
||||
if (input_socket->is_linked()) {
|
||||
converter.map_input_socket(input_socket, operation->get_input_socket(0));
|
||||
converter.map_output_socket(output_socket, operation->get_output_socket());
|
||||
}
|
||||
else {
|
||||
/* Value operation to produce original transparent image */
|
||||
SetValueOperation *valueOperation = new SetValueOperation();
|
||||
valueOperation->setValue(0.0f);
|
||||
converter.addOperation(valueOperation);
|
||||
SetValueOperation *value_operation = new SetValueOperation();
|
||||
value_operation->set_value(0.0f);
|
||||
converter.add_operation(value_operation);
|
||||
|
||||
/* Scale that image up to render resolution */
|
||||
const RenderData *rd = context.getRenderData();
|
||||
const float render_size_factor = context.getRenderPercentageAsFactor();
|
||||
ScaleFixedSizeOperation *scaleOperation = new ScaleFixedSizeOperation();
|
||||
const RenderData *rd = context.get_render_data();
|
||||
const float render_size_factor = context.get_render_percentage_as_factor();
|
||||
ScaleFixedSizeOperation *scale_operation = new ScaleFixedSizeOperation();
|
||||
|
||||
scaleOperation->setIsAspect(false);
|
||||
scaleOperation->setIsCrop(false);
|
||||
scaleOperation->setOffset(0.0f, 0.0f);
|
||||
scaleOperation->setNewWidth(rd->xsch * render_size_factor);
|
||||
scaleOperation->setNewHeight(rd->ysch * render_size_factor);
|
||||
scaleOperation->getInputSocket(0)->setResizeMode(ResizeMode::Align);
|
||||
converter.addOperation(scaleOperation);
|
||||
scale_operation->set_is_aspect(false);
|
||||
scale_operation->set_is_crop(false);
|
||||
scale_operation->set_offset(0.0f, 0.0f);
|
||||
scale_operation->set_new_width(rd->xsch * render_size_factor);
|
||||
scale_operation->set_new_height(rd->ysch * render_size_factor);
|
||||
scale_operation->get_input_socket(0)->set_resize_mode(ResizeMode::Align);
|
||||
converter.add_operation(scale_operation);
|
||||
|
||||
converter.addLink(valueOperation->getOutputSocket(0), scaleOperation->getInputSocket(0));
|
||||
converter.addLink(scaleOperation->getOutputSocket(0), operation->getInputSocket(0));
|
||||
converter.mapOutputSocket(outputSocket, operation->getOutputSocket(0));
|
||||
converter.add_link(value_operation->get_output_socket(0),
|
||||
scale_operation->get_input_socket(0));
|
||||
converter.add_link(scale_operation->get_output_socket(0), operation->get_input_socket(0));
|
||||
converter.map_output_socket(output_socket, operation->get_output_socket(0));
|
||||
}
|
||||
|
||||
converter.mapInputSocket(getInputSocket(1), operation->getInputSocket(1));
|
||||
converter.map_input_socket(get_input_socket(1), operation->get_input_socket(1));
|
||||
}
|
||||
|
||||
} // namespace blender::compositor
|
||||
|
||||
@@ -28,9 +28,9 @@ namespace blender::compositor {
|
||||
*/
|
||||
class BoxMaskNode : public Node {
|
||||
public:
|
||||
BoxMaskNode(bNode *editorNode);
|
||||
void convertToOperations(NodeConverter &converter,
|
||||
const CompositorContext &context) const override;
|
||||
BoxMaskNode(bNode *editor_node);
|
||||
void convert_to_operations(NodeConverter &converter,
|
||||
const CompositorContext &context) const override;
|
||||
};
|
||||
|
||||
} // namespace blender::compositor
|
||||
|
||||
@@ -21,23 +21,23 @@
|
||||
|
||||
namespace blender::compositor {
|
||||
|
||||
BrightnessNode::BrightnessNode(bNode *editorNode) : Node(editorNode)
|
||||
BrightnessNode::BrightnessNode(bNode *editor_node) : Node(editor_node)
|
||||
{
|
||||
/* pass */
|
||||
}
|
||||
|
||||
void BrightnessNode::convertToOperations(NodeConverter &converter,
|
||||
const CompositorContext & /*context*/) const
|
||||
void BrightnessNode::convert_to_operations(NodeConverter &converter,
|
||||
const CompositorContext & /*context*/) const
|
||||
{
|
||||
bNode *bnode = this->getbNode();
|
||||
bNode *bnode = this->get_bnode();
|
||||
BrightnessOperation *operation = new BrightnessOperation();
|
||||
operation->setUsePremultiply((bnode->custom1 & 1) != 0);
|
||||
converter.addOperation(operation);
|
||||
operation->set_use_premultiply((bnode->custom1 & 1) != 0);
|
||||
converter.add_operation(operation);
|
||||
|
||||
converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0));
|
||||
converter.mapInputSocket(getInputSocket(1), operation->getInputSocket(1));
|
||||
converter.mapInputSocket(getInputSocket(2), operation->getInputSocket(2));
|
||||
converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket(0));
|
||||
converter.map_input_socket(get_input_socket(0), operation->get_input_socket(0));
|
||||
converter.map_input_socket(get_input_socket(1), operation->get_input_socket(1));
|
||||
converter.map_input_socket(get_input_socket(2), operation->get_input_socket(2));
|
||||
converter.map_output_socket(get_output_socket(0), operation->get_output_socket(0));
|
||||
}
|
||||
|
||||
} // namespace blender::compositor
|
||||
|
||||
@@ -28,9 +28,9 @@ namespace blender::compositor {
|
||||
*/
|
||||
class BrightnessNode : public Node {
|
||||
public:
|
||||
BrightnessNode(bNode *editorNode);
|
||||
void convertToOperations(NodeConverter &converter,
|
||||
const CompositorContext &context) const override;
|
||||
BrightnessNode(bNode *editor_node);
|
||||
void convert_to_operations(NodeConverter &converter,
|
||||
const CompositorContext &context) const override;
|
||||
};
|
||||
|
||||
} // namespace blender::compositor
|
||||
|
||||
@@ -23,19 +23,19 @@
|
||||
|
||||
namespace blender::compositor {
|
||||
|
||||
ChannelMatteNode::ChannelMatteNode(bNode *editorNode) : Node(editorNode)
|
||||
ChannelMatteNode::ChannelMatteNode(bNode *editor_node) : Node(editor_node)
|
||||
{
|
||||
/* pass */
|
||||
}
|
||||
|
||||
void ChannelMatteNode::convertToOperations(NodeConverter &converter,
|
||||
const CompositorContext & /*context*/) const
|
||||
void ChannelMatteNode::convert_to_operations(NodeConverter &converter,
|
||||
const CompositorContext & /*context*/) const
|
||||
{
|
||||
bNode *node = this->getbNode();
|
||||
bNode *node = this->get_bnode();
|
||||
|
||||
NodeInput *inputSocketImage = this->getInputSocket(0);
|
||||
NodeOutput *outputSocketImage = this->getOutputSocket(0);
|
||||
NodeOutput *outputSocketMatte = this->getOutputSocket(1);
|
||||
NodeInput *input_socket_image = this->get_input_socket(0);
|
||||
NodeOutput *output_socket_image = this->get_output_socket(0);
|
||||
NodeOutput *output_socket_matte = this->get_output_socket(1);
|
||||
|
||||
NodeOperation *convert = nullptr, *inv_convert = nullptr;
|
||||
/* colorspace */
|
||||
@@ -52,9 +52,9 @@ void ChannelMatteNode::convertToOperations(NodeConverter &converter,
|
||||
break;
|
||||
case CMP_NODE_CHANNEL_MATTE_CS_YCC: /* YCC */
|
||||
convert = new ConvertRGBToYCCOperation();
|
||||
((ConvertRGBToYCCOperation *)convert)->setMode(BLI_YCC_ITU_BT709);
|
||||
((ConvertRGBToYCCOperation *)convert)->set_mode(BLI_YCC_ITU_BT709);
|
||||
inv_convert = new ConvertYCCToRGBOperation();
|
||||
((ConvertYCCToRGBOperation *)inv_convert)->setMode(BLI_YCC_ITU_BT709);
|
||||
((ConvertYCCToRGBOperation *)inv_convert)->set_mode(BLI_YCC_ITU_BT709);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@@ -62,36 +62,36 @@ void ChannelMatteNode::convertToOperations(NodeConverter &converter,
|
||||
|
||||
ChannelMatteOperation *operation = new ChannelMatteOperation();
|
||||
/* pass the ui properties to the operation */
|
||||
operation->setSettings((NodeChroma *)node->storage, node->custom2);
|
||||
converter.addOperation(operation);
|
||||
operation->set_settings((NodeChroma *)node->storage, node->custom2);
|
||||
converter.add_operation(operation);
|
||||
|
||||
SetAlphaMultiplyOperation *operationAlpha = new SetAlphaMultiplyOperation();
|
||||
converter.addOperation(operationAlpha);
|
||||
SetAlphaMultiplyOperation *operation_alpha = new SetAlphaMultiplyOperation();
|
||||
converter.add_operation(operation_alpha);
|
||||
|
||||
if (convert != nullptr) {
|
||||
converter.addOperation(convert);
|
||||
converter.add_operation(convert);
|
||||
|
||||
converter.mapInputSocket(inputSocketImage, convert->getInputSocket(0));
|
||||
converter.addLink(convert->getOutputSocket(), operation->getInputSocket(0));
|
||||
converter.addLink(convert->getOutputSocket(), operationAlpha->getInputSocket(0));
|
||||
converter.map_input_socket(input_socket_image, convert->get_input_socket(0));
|
||||
converter.add_link(convert->get_output_socket(), operation->get_input_socket(0));
|
||||
converter.add_link(convert->get_output_socket(), operation_alpha->get_input_socket(0));
|
||||
}
|
||||
else {
|
||||
converter.mapInputSocket(inputSocketImage, operation->getInputSocket(0));
|
||||
converter.mapInputSocket(inputSocketImage, operationAlpha->getInputSocket(0));
|
||||
converter.map_input_socket(input_socket_image, operation->get_input_socket(0));
|
||||
converter.map_input_socket(input_socket_image, operation_alpha->get_input_socket(0));
|
||||
}
|
||||
|
||||
converter.mapOutputSocket(outputSocketMatte, operation->getOutputSocket(0));
|
||||
converter.addLink(operation->getOutputSocket(), operationAlpha->getInputSocket(1));
|
||||
converter.map_output_socket(output_socket_matte, operation->get_output_socket(0));
|
||||
converter.add_link(operation->get_output_socket(), operation_alpha->get_input_socket(1));
|
||||
|
||||
if (inv_convert != nullptr) {
|
||||
converter.addOperation(inv_convert);
|
||||
converter.addLink(operationAlpha->getOutputSocket(0), inv_convert->getInputSocket(0));
|
||||
converter.mapOutputSocket(outputSocketImage, inv_convert->getOutputSocket());
|
||||
converter.addPreview(inv_convert->getOutputSocket());
|
||||
converter.add_operation(inv_convert);
|
||||
converter.add_link(operation_alpha->get_output_socket(0), inv_convert->get_input_socket(0));
|
||||
converter.map_output_socket(output_socket_image, inv_convert->get_output_socket());
|
||||
converter.add_preview(inv_convert->get_output_socket());
|
||||
}
|
||||
else {
|
||||
converter.mapOutputSocket(outputSocketImage, operationAlpha->getOutputSocket());
|
||||
converter.addPreview(operationAlpha->getOutputSocket());
|
||||
converter.map_output_socket(output_socket_image, operation_alpha->get_output_socket());
|
||||
converter.add_preview(operation_alpha->get_output_socket());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -28,9 +28,9 @@ namespace blender::compositor {
|
||||
*/
|
||||
class ChannelMatteNode : public Node {
|
||||
public:
|
||||
ChannelMatteNode(bNode *editorNode);
|
||||
void convertToOperations(NodeConverter &converter,
|
||||
const CompositorContext &context) const override;
|
||||
ChannelMatteNode(bNode *editor_node);
|
||||
void convert_to_operations(NodeConverter &converter,
|
||||
const CompositorContext &context) const override;
|
||||
};
|
||||
|
||||
} // namespace blender::compositor
|
||||
|
||||
@@ -23,46 +23,46 @@
|
||||
|
||||
namespace blender::compositor {
|
||||
|
||||
ChromaMatteNode::ChromaMatteNode(bNode *editorNode) : Node(editorNode)
|
||||
ChromaMatteNode::ChromaMatteNode(bNode *editor_node) : Node(editor_node)
|
||||
{
|
||||
/* pass */
|
||||
}
|
||||
|
||||
void ChromaMatteNode::convertToOperations(NodeConverter &converter,
|
||||
const CompositorContext & /*context*/) const
|
||||
void ChromaMatteNode::convert_to_operations(NodeConverter &converter,
|
||||
const CompositorContext & /*context*/) const
|
||||
{
|
||||
bNode *editorsnode = getbNode();
|
||||
bNode *editorsnode = get_bnode();
|
||||
|
||||
NodeInput *inputSocketImage = this->getInputSocket(0);
|
||||
NodeInput *inputSocketKey = this->getInputSocket(1);
|
||||
NodeOutput *outputSocketImage = this->getOutputSocket(0);
|
||||
NodeOutput *outputSocketMatte = this->getOutputSocket(1);
|
||||
NodeInput *input_socket_image = this->get_input_socket(0);
|
||||
NodeInput *input_socket_key = this->get_input_socket(1);
|
||||
NodeOutput *output_socket_image = this->get_output_socket(0);
|
||||
NodeOutput *output_socket_matte = this->get_output_socket(1);
|
||||
|
||||
ConvertRGBToYCCOperation *operationRGBToYCC_Image = new ConvertRGBToYCCOperation();
|
||||
ConvertRGBToYCCOperation *operationRGBToYCC_Key = new ConvertRGBToYCCOperation();
|
||||
operationRGBToYCC_Image->setMode(BLI_YCC_ITU_BT709);
|
||||
operationRGBToYCC_Key->setMode(BLI_YCC_ITU_BT709);
|
||||
converter.addOperation(operationRGBToYCC_Image);
|
||||
converter.addOperation(operationRGBToYCC_Key);
|
||||
operationRGBToYCC_Image->set_mode(BLI_YCC_ITU_BT709);
|
||||
operationRGBToYCC_Key->set_mode(BLI_YCC_ITU_BT709);
|
||||
converter.add_operation(operationRGBToYCC_Image);
|
||||
converter.add_operation(operationRGBToYCC_Key);
|
||||
|
||||
ChromaMatteOperation *operation = new ChromaMatteOperation();
|
||||
operation->setSettings((NodeChroma *)editorsnode->storage);
|
||||
converter.addOperation(operation);
|
||||
operation->set_settings((NodeChroma *)editorsnode->storage);
|
||||
converter.add_operation(operation);
|
||||
|
||||
SetAlphaMultiplyOperation *operationAlpha = new SetAlphaMultiplyOperation();
|
||||
converter.addOperation(operationAlpha);
|
||||
SetAlphaMultiplyOperation *operation_alpha = new SetAlphaMultiplyOperation();
|
||||
converter.add_operation(operation_alpha);
|
||||
|
||||
converter.mapInputSocket(inputSocketImage, operationRGBToYCC_Image->getInputSocket(0));
|
||||
converter.mapInputSocket(inputSocketKey, operationRGBToYCC_Key->getInputSocket(0));
|
||||
converter.addLink(operationRGBToYCC_Image->getOutputSocket(), operation->getInputSocket(0));
|
||||
converter.addLink(operationRGBToYCC_Key->getOutputSocket(), operation->getInputSocket(1));
|
||||
converter.mapOutputSocket(outputSocketMatte, operation->getOutputSocket());
|
||||
converter.map_input_socket(input_socket_image, operationRGBToYCC_Image->get_input_socket(0));
|
||||
converter.map_input_socket(input_socket_key, operationRGBToYCC_Key->get_input_socket(0));
|
||||
converter.add_link(operationRGBToYCC_Image->get_output_socket(), operation->get_input_socket(0));
|
||||
converter.add_link(operationRGBToYCC_Key->get_output_socket(), operation->get_input_socket(1));
|
||||
converter.map_output_socket(output_socket_matte, operation->get_output_socket());
|
||||
|
||||
converter.mapInputSocket(inputSocketImage, operationAlpha->getInputSocket(0));
|
||||
converter.addLink(operation->getOutputSocket(), operationAlpha->getInputSocket(1));
|
||||
converter.mapOutputSocket(outputSocketImage, operationAlpha->getOutputSocket());
|
||||
converter.map_input_socket(input_socket_image, operation_alpha->get_input_socket(0));
|
||||
converter.add_link(operation->get_output_socket(), operation_alpha->get_input_socket(1));
|
||||
converter.map_output_socket(output_socket_image, operation_alpha->get_output_socket());
|
||||
|
||||
converter.addPreview(operationAlpha->getOutputSocket());
|
||||
converter.add_preview(operation_alpha->get_output_socket());
|
||||
}
|
||||
|
||||
} // namespace blender::compositor
|
||||
|
||||
@@ -28,9 +28,9 @@ namespace blender::compositor {
|
||||
*/
|
||||
class ChromaMatteNode : public Node {
|
||||
public:
|
||||
ChromaMatteNode(bNode *editorNode);
|
||||
void convertToOperations(NodeConverter &converter,
|
||||
const CompositorContext &context) const override;
|
||||
ChromaMatteNode(bNode *editor_node);
|
||||
void convert_to_operations(NodeConverter &converter,
|
||||
const CompositorContext &context) const override;
|
||||
};
|
||||
|
||||
} // namespace blender::compositor
|
||||
|
||||
@@ -22,20 +22,20 @@
|
||||
|
||||
namespace blender::compositor {
|
||||
|
||||
ColorBalanceNode::ColorBalanceNode(bNode *editorNode) : Node(editorNode)
|
||||
ColorBalanceNode::ColorBalanceNode(bNode *editor_node) : Node(editor_node)
|
||||
{
|
||||
/* pass */
|
||||
}
|
||||
|
||||
void ColorBalanceNode::convertToOperations(NodeConverter &converter,
|
||||
const CompositorContext & /*context*/) const
|
||||
void ColorBalanceNode::convert_to_operations(NodeConverter &converter,
|
||||
const CompositorContext & /*context*/) const
|
||||
{
|
||||
bNode *node = this->getbNode();
|
||||
bNode *node = this->get_bnode();
|
||||
NodeColorBalance *n = (NodeColorBalance *)node->storage;
|
||||
|
||||
NodeInput *inputSocket = this->getInputSocket(0);
|
||||
NodeInput *inputImageSocket = this->getInputSocket(1);
|
||||
NodeOutput *outputSocket = this->getOutputSocket(0);
|
||||
NodeInput *input_socket = this->get_input_socket(0);
|
||||
NodeInput *input_image_socket = this->get_input_socket(1);
|
||||
NodeOutput *output_socket = this->get_output_socket(0);
|
||||
|
||||
NodeOperation *operation;
|
||||
if (node->custom1 == 0) {
|
||||
@@ -47,9 +47,9 @@ void ColorBalanceNode::convertToOperations(NodeConverter &converter,
|
||||
gamma_inv[c] = (n->gamma[c] != 0.0f) ? 1.0f / n->gamma[c] : 1000000.0f;
|
||||
}
|
||||
|
||||
operationLGG->setGain(n->gain);
|
||||
operationLGG->setLift(lift_lgg);
|
||||
operationLGG->setGammaInv(gamma_inv);
|
||||
operationLGG->set_gain(n->gain);
|
||||
operationLGG->set_lift(lift_lgg);
|
||||
operationLGG->set_gamma_inv(gamma_inv);
|
||||
operation = operationLGG;
|
||||
}
|
||||
else {
|
||||
@@ -59,16 +59,16 @@ void ColorBalanceNode::convertToOperations(NodeConverter &converter,
|
||||
copy_v3_fl(offset, n->offset_basis);
|
||||
add_v3_v3(offset, n->offset);
|
||||
|
||||
operationCDL->setOffset(offset);
|
||||
operationCDL->setPower(n->power);
|
||||
operationCDL->setSlope(n->slope);
|
||||
operationCDL->set_offset(offset);
|
||||
operationCDL->set_power(n->power);
|
||||
operationCDL->set_slope(n->slope);
|
||||
operation = operationCDL;
|
||||
}
|
||||
converter.addOperation(operation);
|
||||
converter.add_operation(operation);
|
||||
|
||||
converter.mapInputSocket(inputSocket, operation->getInputSocket(0));
|
||||
converter.mapInputSocket(inputImageSocket, operation->getInputSocket(1));
|
||||
converter.mapOutputSocket(outputSocket, operation->getOutputSocket(0));
|
||||
converter.map_input_socket(input_socket, operation->get_input_socket(0));
|
||||
converter.map_input_socket(input_image_socket, operation->get_input_socket(1));
|
||||
converter.map_output_socket(output_socket, operation->get_output_socket(0));
|
||||
}
|
||||
|
||||
} // namespace blender::compositor
|
||||
|
||||
@@ -28,9 +28,9 @@ namespace blender::compositor {
|
||||
*/
|
||||
class ColorBalanceNode : public Node {
|
||||
public:
|
||||
ColorBalanceNode(bNode *editorNode);
|
||||
void convertToOperations(NodeConverter &converter,
|
||||
const CompositorContext &context) const override;
|
||||
ColorBalanceNode(bNode *editor_node);
|
||||
void convert_to_operations(NodeConverter &converter,
|
||||
const CompositorContext &context) const override;
|
||||
};
|
||||
|
||||
} // namespace blender::compositor
|
||||
|
||||
@@ -21,26 +21,26 @@
|
||||
|
||||
namespace blender::compositor {
|
||||
|
||||
ColorCorrectionNode::ColorCorrectionNode(bNode *editorNode) : Node(editorNode)
|
||||
ColorCorrectionNode::ColorCorrectionNode(bNode *editor_node) : Node(editor_node)
|
||||
{
|
||||
/* pass */
|
||||
}
|
||||
|
||||
void ColorCorrectionNode::convertToOperations(NodeConverter &converter,
|
||||
const CompositorContext & /*context*/) const
|
||||
void ColorCorrectionNode::convert_to_operations(NodeConverter &converter,
|
||||
const CompositorContext & /*context*/) const
|
||||
{
|
||||
bNode *editorNode = getbNode();
|
||||
bNode *editor_node = get_bnode();
|
||||
|
||||
ColorCorrectionOperation *operation = new ColorCorrectionOperation();
|
||||
operation->setData((NodeColorCorrection *)editorNode->storage);
|
||||
operation->setRedChannelEnabled((editorNode->custom1 & 1) != 0);
|
||||
operation->setGreenChannelEnabled((editorNode->custom1 & 2) != 0);
|
||||
operation->setBlueChannelEnabled((editorNode->custom1 & 4) != 0);
|
||||
converter.addOperation(operation);
|
||||
operation->set_data((NodeColorCorrection *)editor_node->storage);
|
||||
operation->set_red_channel_enabled((editor_node->custom1 & 1) != 0);
|
||||
operation->set_green_channel_enabled((editor_node->custom1 & 2) != 0);
|
||||
operation->set_blue_channel_enabled((editor_node->custom1 & 4) != 0);
|
||||
converter.add_operation(operation);
|
||||
|
||||
converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0));
|
||||
converter.mapInputSocket(getInputSocket(1), operation->getInputSocket(1));
|
||||
converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket(0));
|
||||
converter.map_input_socket(get_input_socket(0), operation->get_input_socket(0));
|
||||
converter.map_input_socket(get_input_socket(1), operation->get_input_socket(1));
|
||||
converter.map_output_socket(get_output_socket(0), operation->get_output_socket(0));
|
||||
}
|
||||
|
||||
} // namespace blender::compositor
|
||||
|
||||
@@ -28,9 +28,9 @@ namespace blender::compositor {
|
||||
*/
|
||||
class ColorCorrectionNode : public Node {
|
||||
public:
|
||||
ColorCorrectionNode(bNode *editorNode);
|
||||
void convertToOperations(NodeConverter &converter,
|
||||
const CompositorContext &context) const override;
|
||||
ColorCorrectionNode(bNode *editor_node);
|
||||
void convert_to_operations(NodeConverter &converter,
|
||||
const CompositorContext &context) const override;
|
||||
};
|
||||
|
||||
} // namespace blender::compositor
|
||||
|
||||
@@ -21,39 +21,39 @@
|
||||
|
||||
namespace blender::compositor {
|
||||
|
||||
ColorCurveNode::ColorCurveNode(bNode *editorNode) : Node(editorNode)
|
||||
ColorCurveNode::ColorCurveNode(bNode *editor_node) : Node(editor_node)
|
||||
{
|
||||
/* pass */
|
||||
}
|
||||
|
||||
void ColorCurveNode::convertToOperations(NodeConverter &converter,
|
||||
const CompositorContext & /*context*/) const
|
||||
void ColorCurveNode::convert_to_operations(NodeConverter &converter,
|
||||
const CompositorContext & /*context*/) const
|
||||
{
|
||||
if (this->getInputSocket(2)->isLinked() || this->getInputSocket(3)->isLinked()) {
|
||||
if (this->get_input_socket(2)->is_linked() || this->get_input_socket(3)->is_linked()) {
|
||||
ColorCurveOperation *operation = new ColorCurveOperation();
|
||||
operation->setCurveMapping((CurveMapping *)this->getbNode()->storage);
|
||||
converter.addOperation(operation);
|
||||
operation->set_curve_mapping((CurveMapping *)this->get_bnode()->storage);
|
||||
converter.add_operation(operation);
|
||||
|
||||
converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0));
|
||||
converter.mapInputSocket(getInputSocket(1), operation->getInputSocket(1));
|
||||
converter.mapInputSocket(getInputSocket(2), operation->getInputSocket(2));
|
||||
converter.mapInputSocket(getInputSocket(3), operation->getInputSocket(3));
|
||||
converter.map_input_socket(get_input_socket(0), operation->get_input_socket(0));
|
||||
converter.map_input_socket(get_input_socket(1), operation->get_input_socket(1));
|
||||
converter.map_input_socket(get_input_socket(2), operation->get_input_socket(2));
|
||||
converter.map_input_socket(get_input_socket(3), operation->get_input_socket(3));
|
||||
|
||||
converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket());
|
||||
converter.map_output_socket(get_output_socket(0), operation->get_output_socket());
|
||||
}
|
||||
else {
|
||||
ConstantLevelColorCurveOperation *operation = new ConstantLevelColorCurveOperation();
|
||||
float col[4];
|
||||
this->getInputSocket(2)->getEditorValueColor(col);
|
||||
operation->setBlackLevel(col);
|
||||
this->getInputSocket(3)->getEditorValueColor(col);
|
||||
operation->setWhiteLevel(col);
|
||||
operation->setCurveMapping((CurveMapping *)this->getbNode()->storage);
|
||||
converter.addOperation(operation);
|
||||
this->get_input_socket(2)->get_editor_value_color(col);
|
||||
operation->set_black_level(col);
|
||||
this->get_input_socket(3)->get_editor_value_color(col);
|
||||
operation->set_white_level(col);
|
||||
operation->set_curve_mapping((CurveMapping *)this->get_bnode()->storage);
|
||||
converter.add_operation(operation);
|
||||
|
||||
converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0));
|
||||
converter.mapInputSocket(getInputSocket(1), operation->getInputSocket(1));
|
||||
converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket());
|
||||
converter.map_input_socket(get_input_socket(0), operation->get_input_socket(0));
|
||||
converter.map_input_socket(get_input_socket(1), operation->get_input_socket(1));
|
||||
converter.map_output_socket(get_output_socket(0), operation->get_output_socket());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -28,9 +28,9 @@ namespace blender::compositor {
|
||||
*/
|
||||
class ColorCurveNode : public Node {
|
||||
public:
|
||||
ColorCurveNode(bNode *editorNode);
|
||||
void convertToOperations(NodeConverter &converter,
|
||||
const CompositorContext &context) const override;
|
||||
ColorCurveNode(bNode *editor_node);
|
||||
void convert_to_operations(NodeConverter &converter,
|
||||
const CompositorContext &context) const override;
|
||||
};
|
||||
|
||||
} // namespace blender::compositor
|
||||
|
||||
@@ -21,20 +21,20 @@
|
||||
|
||||
namespace blender::compositor {
|
||||
|
||||
ExposureNode::ExposureNode(bNode *editorNode) : Node(editorNode)
|
||||
ExposureNode::ExposureNode(bNode *editor_node) : Node(editor_node)
|
||||
{
|
||||
/* pass */
|
||||
}
|
||||
|
||||
void ExposureNode::convertToOperations(NodeConverter &converter,
|
||||
const CompositorContext & /*context*/) const
|
||||
void ExposureNode::convert_to_operations(NodeConverter &converter,
|
||||
const CompositorContext & /*context*/) const
|
||||
{
|
||||
ExposureOperation *operation = new ExposureOperation();
|
||||
converter.addOperation(operation);
|
||||
converter.add_operation(operation);
|
||||
|
||||
converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0));
|
||||
converter.mapInputSocket(getInputSocket(1), operation->getInputSocket(1));
|
||||
converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket(0));
|
||||
converter.map_input_socket(get_input_socket(0), operation->get_input_socket(0));
|
||||
converter.map_input_socket(get_input_socket(1), operation->get_input_socket(1));
|
||||
converter.map_output_socket(get_output_socket(0), operation->get_output_socket(0));
|
||||
}
|
||||
|
||||
} // namespace blender::compositor
|
||||
|
||||
@@ -28,9 +28,9 @@ namespace blender::compositor {
|
||||
*/
|
||||
class ExposureNode : public Node {
|
||||
public:
|
||||
ExposureNode(bNode *editorNode);
|
||||
void convertToOperations(NodeConverter &converter,
|
||||
const CompositorContext &context) const override;
|
||||
ExposureNode(bNode *editor_node);
|
||||
void convert_to_operations(NodeConverter &converter,
|
||||
const CompositorContext &context) const override;
|
||||
};
|
||||
|
||||
} // namespace blender::compositor
|
||||
|
||||
@@ -23,44 +23,44 @@
|
||||
|
||||
namespace blender::compositor {
|
||||
|
||||
ColorMatteNode::ColorMatteNode(bNode *editorNode) : Node(editorNode)
|
||||
ColorMatteNode::ColorMatteNode(bNode *editor_node) : Node(editor_node)
|
||||
{
|
||||
/* pass */
|
||||
}
|
||||
|
||||
void ColorMatteNode::convertToOperations(NodeConverter &converter,
|
||||
const CompositorContext & /*context*/) const
|
||||
void ColorMatteNode::convert_to_operations(NodeConverter &converter,
|
||||
const CompositorContext & /*context*/) const
|
||||
{
|
||||
bNode *editorsnode = getbNode();
|
||||
bNode *editorsnode = get_bnode();
|
||||
|
||||
NodeInput *inputSocketImage = this->getInputSocket(0);
|
||||
NodeInput *inputSocketKey = this->getInputSocket(1);
|
||||
NodeOutput *outputSocketImage = this->getOutputSocket(0);
|
||||
NodeOutput *outputSocketMatte = this->getOutputSocket(1);
|
||||
NodeInput *input_socket_image = this->get_input_socket(0);
|
||||
NodeInput *input_socket_key = this->get_input_socket(1);
|
||||
NodeOutput *output_socket_image = this->get_output_socket(0);
|
||||
NodeOutput *output_socket_matte = this->get_output_socket(1);
|
||||
|
||||
ConvertRGBToHSVOperation *operationRGBToHSV_Image = new ConvertRGBToHSVOperation();
|
||||
ConvertRGBToHSVOperation *operationRGBToHSV_Key = new ConvertRGBToHSVOperation();
|
||||
converter.addOperation(operationRGBToHSV_Image);
|
||||
converter.addOperation(operationRGBToHSV_Key);
|
||||
converter.add_operation(operationRGBToHSV_Image);
|
||||
converter.add_operation(operationRGBToHSV_Key);
|
||||
|
||||
ColorMatteOperation *operation = new ColorMatteOperation();
|
||||
operation->setSettings((NodeChroma *)editorsnode->storage);
|
||||
converter.addOperation(operation);
|
||||
operation->set_settings((NodeChroma *)editorsnode->storage);
|
||||
converter.add_operation(operation);
|
||||
|
||||
SetAlphaMultiplyOperation *operationAlpha = new SetAlphaMultiplyOperation();
|
||||
converter.addOperation(operationAlpha);
|
||||
SetAlphaMultiplyOperation *operation_alpha = new SetAlphaMultiplyOperation();
|
||||
converter.add_operation(operation_alpha);
|
||||
|
||||
converter.mapInputSocket(inputSocketImage, operationRGBToHSV_Image->getInputSocket(0));
|
||||
converter.mapInputSocket(inputSocketKey, operationRGBToHSV_Key->getInputSocket(0));
|
||||
converter.addLink(operationRGBToHSV_Image->getOutputSocket(), operation->getInputSocket(0));
|
||||
converter.addLink(operationRGBToHSV_Key->getOutputSocket(), operation->getInputSocket(1));
|
||||
converter.mapOutputSocket(outputSocketMatte, operation->getOutputSocket(0));
|
||||
converter.map_input_socket(input_socket_image, operationRGBToHSV_Image->get_input_socket(0));
|
||||
converter.map_input_socket(input_socket_key, operationRGBToHSV_Key->get_input_socket(0));
|
||||
converter.add_link(operationRGBToHSV_Image->get_output_socket(), operation->get_input_socket(0));
|
||||
converter.add_link(operationRGBToHSV_Key->get_output_socket(), operation->get_input_socket(1));
|
||||
converter.map_output_socket(output_socket_matte, operation->get_output_socket(0));
|
||||
|
||||
converter.mapInputSocket(inputSocketImage, operationAlpha->getInputSocket(0));
|
||||
converter.addLink(operation->getOutputSocket(), operationAlpha->getInputSocket(1));
|
||||
converter.mapOutputSocket(outputSocketImage, operationAlpha->getOutputSocket());
|
||||
converter.map_input_socket(input_socket_image, operation_alpha->get_input_socket(0));
|
||||
converter.add_link(operation->get_output_socket(), operation_alpha->get_input_socket(1));
|
||||
converter.map_output_socket(output_socket_image, operation_alpha->get_output_socket());
|
||||
|
||||
converter.addPreview(operationAlpha->getOutputSocket());
|
||||
converter.add_preview(operation_alpha->get_output_socket());
|
||||
}
|
||||
|
||||
} // namespace blender::compositor
|
||||
|
||||
@@ -28,9 +28,9 @@ namespace blender::compositor {
|
||||
*/
|
||||
class ColorMatteNode : public Node {
|
||||
public:
|
||||
ColorMatteNode(bNode *editorNode);
|
||||
void convertToOperations(NodeConverter &converter,
|
||||
const CompositorContext &context) const override;
|
||||
ColorMatteNode(bNode *editor_node);
|
||||
void convert_to_operations(NodeConverter &converter,
|
||||
const CompositorContext &context) const override;
|
||||
};
|
||||
|
||||
} // namespace blender::compositor
|
||||
|
||||
@@ -21,22 +21,22 @@
|
||||
|
||||
namespace blender::compositor {
|
||||
|
||||
ColorNode::ColorNode(bNode *editorNode) : Node(editorNode)
|
||||
ColorNode::ColorNode(bNode *editor_node) : Node(editor_node)
|
||||
{
|
||||
/* pass */
|
||||
}
|
||||
|
||||
void ColorNode::convertToOperations(NodeConverter &converter,
|
||||
const CompositorContext & /*context*/) const
|
||||
void ColorNode::convert_to_operations(NodeConverter &converter,
|
||||
const CompositorContext & /*context*/) const
|
||||
{
|
||||
SetColorOperation *operation = new SetColorOperation();
|
||||
NodeOutput *output = this->getOutputSocket(0);
|
||||
NodeOutput *output = this->get_output_socket(0);
|
||||
float col[4];
|
||||
output->getEditorValueColor(col);
|
||||
operation->setChannels(col);
|
||||
converter.addOperation(operation);
|
||||
output->get_editor_value_color(col);
|
||||
operation->set_channels(col);
|
||||
converter.add_operation(operation);
|
||||
|
||||
converter.mapOutputSocket(output, operation->getOutputSocket());
|
||||
converter.map_output_socket(output, operation->get_output_socket());
|
||||
}
|
||||
|
||||
} // namespace blender::compositor
|
||||
|
||||
@@ -28,9 +28,9 @@ namespace blender::compositor {
|
||||
*/
|
||||
class ColorNode : public Node {
|
||||
public:
|
||||
ColorNode(bNode *editorNode);
|
||||
void convertToOperations(NodeConverter &converter,
|
||||
const CompositorContext &context) const override;
|
||||
ColorNode(bNode *editor_node);
|
||||
void convert_to_operations(NodeConverter &converter,
|
||||
const CompositorContext &context) const override;
|
||||
};
|
||||
|
||||
} // namespace blender::compositor
|
||||
|
||||
@@ -22,32 +22,32 @@
|
||||
|
||||
namespace blender::compositor {
|
||||
|
||||
ColorRampNode::ColorRampNode(bNode *editorNode) : Node(editorNode)
|
||||
ColorRampNode::ColorRampNode(bNode *editor_node) : Node(editor_node)
|
||||
{
|
||||
/* pass */
|
||||
}
|
||||
|
||||
void ColorRampNode::convertToOperations(NodeConverter &converter,
|
||||
const CompositorContext & /*context*/) const
|
||||
void ColorRampNode::convert_to_operations(NodeConverter &converter,
|
||||
const CompositorContext & /*context*/) const
|
||||
{
|
||||
NodeInput *inputSocket = this->getInputSocket(0);
|
||||
NodeOutput *outputSocket = this->getOutputSocket(0);
|
||||
NodeOutput *outputSocketAlpha = this->getOutputSocket(1);
|
||||
bNode *editorNode = this->getbNode();
|
||||
NodeInput *input_socket = this->get_input_socket(0);
|
||||
NodeOutput *output_socket = this->get_output_socket(0);
|
||||
NodeOutput *output_socket_alpha = this->get_output_socket(1);
|
||||
bNode *editor_node = this->get_bnode();
|
||||
|
||||
ColorRampOperation *operation = new ColorRampOperation();
|
||||
operation->setColorBand((ColorBand *)editorNode->storage);
|
||||
converter.addOperation(operation);
|
||||
operation->set_color_band((ColorBand *)editor_node->storage);
|
||||
converter.add_operation(operation);
|
||||
|
||||
converter.mapInputSocket(inputSocket, operation->getInputSocket(0));
|
||||
converter.mapOutputSocket(outputSocket, operation->getOutputSocket(0));
|
||||
converter.map_input_socket(input_socket, operation->get_input_socket(0));
|
||||
converter.map_output_socket(output_socket, operation->get_output_socket(0));
|
||||
|
||||
SeparateChannelOperation *operation2 = new SeparateChannelOperation();
|
||||
operation2->setChannel(3);
|
||||
converter.addOperation(operation2);
|
||||
operation2->set_channel(3);
|
||||
converter.add_operation(operation2);
|
||||
|
||||
converter.addLink(operation->getOutputSocket(), operation2->getInputSocket(0));
|
||||
converter.mapOutputSocket(outputSocketAlpha, operation2->getOutputSocket());
|
||||
converter.add_link(operation->get_output_socket(), operation2->get_input_socket(0));
|
||||
converter.map_output_socket(output_socket_alpha, operation2->get_output_socket());
|
||||
}
|
||||
|
||||
} // namespace blender::compositor
|
||||
|
||||
@@ -28,9 +28,9 @@ namespace blender::compositor {
|
||||
*/
|
||||
class ColorRampNode : public Node {
|
||||
public:
|
||||
ColorRampNode(bNode *editorNode);
|
||||
void convertToOperations(NodeConverter &converter,
|
||||
const CompositorContext &context) const override;
|
||||
ColorRampNode(bNode *editor_node);
|
||||
void convert_to_operations(NodeConverter &converter,
|
||||
const CompositorContext &context) const override;
|
||||
};
|
||||
|
||||
} // namespace blender::compositor
|
||||
|
||||
@@ -21,30 +21,30 @@
|
||||
|
||||
namespace blender::compositor {
|
||||
|
||||
ColorSpillNode::ColorSpillNode(bNode *editorNode) : Node(editorNode)
|
||||
ColorSpillNode::ColorSpillNode(bNode *editor_node) : Node(editor_node)
|
||||
{
|
||||
/* pass */
|
||||
}
|
||||
|
||||
void ColorSpillNode::convertToOperations(NodeConverter &converter,
|
||||
const CompositorContext & /*context*/) const
|
||||
void ColorSpillNode::convert_to_operations(NodeConverter &converter,
|
||||
const CompositorContext & /*context*/) const
|
||||
{
|
||||
bNode *editorsnode = getbNode();
|
||||
bNode *editorsnode = get_bnode();
|
||||
|
||||
NodeInput *inputSocketImage = this->getInputSocket(0);
|
||||
NodeInput *inputSocketFac = this->getInputSocket(1);
|
||||
NodeOutput *outputSocketImage = this->getOutputSocket(0);
|
||||
NodeInput *input_socket_image = this->get_input_socket(0);
|
||||
NodeInput *input_socket_fac = this->get_input_socket(1);
|
||||
NodeOutput *output_socket_image = this->get_output_socket(0);
|
||||
|
||||
ColorSpillOperation *operation;
|
||||
operation = new ColorSpillOperation();
|
||||
operation->setSettings((NodeColorspill *)editorsnode->storage);
|
||||
operation->setSpillChannel(editorsnode->custom1 - 1); /* Channel for spilling */
|
||||
operation->setSpillMethod(editorsnode->custom2); /* Channel method */
|
||||
converter.addOperation(operation);
|
||||
operation->set_settings((NodeColorspill *)editorsnode->storage);
|
||||
operation->set_spill_channel(editorsnode->custom1 - 1); /* Channel for spilling */
|
||||
operation->set_spill_method(editorsnode->custom2); /* Channel method */
|
||||
converter.add_operation(operation);
|
||||
|
||||
converter.mapInputSocket(inputSocketImage, operation->getInputSocket(0));
|
||||
converter.mapInputSocket(inputSocketFac, operation->getInputSocket(1));
|
||||
converter.mapOutputSocket(outputSocketImage, operation->getOutputSocket());
|
||||
converter.map_input_socket(input_socket_image, operation->get_input_socket(0));
|
||||
converter.map_input_socket(input_socket_fac, operation->get_input_socket(1));
|
||||
converter.map_output_socket(output_socket_image, operation->get_output_socket());
|
||||
}
|
||||
|
||||
} // namespace blender::compositor
|
||||
|
||||
@@ -28,9 +28,9 @@ namespace blender::compositor {
|
||||
*/
|
||||
class ColorSpillNode : public Node {
|
||||
public:
|
||||
ColorSpillNode(bNode *editorNode);
|
||||
void convertToOperations(NodeConverter &converter,
|
||||
const CompositorContext &context) const override;
|
||||
ColorSpillNode(bNode *editor_node);
|
||||
void convert_to_operations(NodeConverter &converter,
|
||||
const CompositorContext &context) const override;
|
||||
};
|
||||
|
||||
} // namespace blender::compositor
|
||||
|
||||
@@ -22,22 +22,22 @@
|
||||
|
||||
namespace blender::compositor {
|
||||
|
||||
ColorToBWNode::ColorToBWNode(bNode *editorNode) : Node(editorNode)
|
||||
ColorToBWNode::ColorToBWNode(bNode *editor_node) : Node(editor_node)
|
||||
{
|
||||
/* pass */
|
||||
}
|
||||
|
||||
void ColorToBWNode::convertToOperations(NodeConverter &converter,
|
||||
const CompositorContext & /*context*/) const
|
||||
void ColorToBWNode::convert_to_operations(NodeConverter &converter,
|
||||
const CompositorContext & /*context*/) const
|
||||
{
|
||||
NodeInput *colorSocket = this->getInputSocket(0);
|
||||
NodeOutput *valueSocket = this->getOutputSocket(0);
|
||||
NodeInput *color_socket = this->get_input_socket(0);
|
||||
NodeOutput *value_socket = this->get_output_socket(0);
|
||||
|
||||
ConvertColorToBWOperation *convertProg = new ConvertColorToBWOperation();
|
||||
converter.addOperation(convertProg);
|
||||
ConvertColorToBWOperation *convert_prog = new ConvertColorToBWOperation();
|
||||
converter.add_operation(convert_prog);
|
||||
|
||||
converter.mapInputSocket(colorSocket, convertProg->getInputSocket(0));
|
||||
converter.mapOutputSocket(valueSocket, convertProg->getOutputSocket(0));
|
||||
converter.map_input_socket(color_socket, convert_prog->get_input_socket(0));
|
||||
converter.map_output_socket(value_socket, convert_prog->get_output_socket(0));
|
||||
}
|
||||
|
||||
} // namespace blender::compositor
|
||||
|
||||
@@ -29,9 +29,9 @@ namespace blender::compositor {
|
||||
*/
|
||||
class ColorToBWNode : public Node {
|
||||
public:
|
||||
ColorToBWNode(bNode *editorNode);
|
||||
void convertToOperations(NodeConverter &converter,
|
||||
const CompositorContext &context) const override;
|
||||
ColorToBWNode(bNode *editor_node);
|
||||
void convert_to_operations(NodeConverter &converter,
|
||||
const CompositorContext &context) const override;
|
||||
};
|
||||
|
||||
} // namespace blender::compositor
|
||||
|
||||
@@ -22,70 +22,70 @@
|
||||
|
||||
namespace blender::compositor {
|
||||
|
||||
CombineColorNode::CombineColorNode(bNode *editorNode) : Node(editorNode)
|
||||
CombineColorNode::CombineColorNode(bNode *editor_node) : Node(editor_node)
|
||||
{
|
||||
}
|
||||
|
||||
void CombineColorNode::convertToOperations(NodeConverter &converter,
|
||||
const CompositorContext &context) const
|
||||
void CombineColorNode::convert_to_operations(NodeConverter &converter,
|
||||
const CompositorContext &context) const
|
||||
{
|
||||
NodeInput *inputRSocket = this->getInputSocket(0);
|
||||
NodeInput *inputGSocket = this->getInputSocket(1);
|
||||
NodeInput *inputBSocket = this->getInputSocket(2);
|
||||
NodeInput *inputASocket = this->getInputSocket(3);
|
||||
NodeOutput *outputSocket = this->getOutputSocket(0);
|
||||
NodeInput *input_rsocket = this->get_input_socket(0);
|
||||
NodeInput *input_gsocket = this->get_input_socket(1);
|
||||
NodeInput *input_bsocket = this->get_input_socket(2);
|
||||
NodeInput *input_asocket = this->get_input_socket(3);
|
||||
NodeOutput *output_socket = this->get_output_socket(0);
|
||||
|
||||
CombineChannelsOperation *operation = new CombineChannelsOperation();
|
||||
if (inputRSocket->isLinked()) {
|
||||
if (input_rsocket->is_linked()) {
|
||||
operation->set_canvas_input_index(0);
|
||||
}
|
||||
else if (inputGSocket->isLinked()) {
|
||||
else if (input_gsocket->is_linked()) {
|
||||
operation->set_canvas_input_index(1);
|
||||
}
|
||||
else if (inputBSocket->isLinked()) {
|
||||
else if (input_bsocket->is_linked()) {
|
||||
operation->set_canvas_input_index(2);
|
||||
}
|
||||
else {
|
||||
operation->set_canvas_input_index(3);
|
||||
}
|
||||
converter.addOperation(operation);
|
||||
converter.add_operation(operation);
|
||||
|
||||
converter.mapInputSocket(inputRSocket, operation->getInputSocket(0));
|
||||
converter.mapInputSocket(inputGSocket, operation->getInputSocket(1));
|
||||
converter.mapInputSocket(inputBSocket, operation->getInputSocket(2));
|
||||
converter.mapInputSocket(inputASocket, operation->getInputSocket(3));
|
||||
converter.map_input_socket(input_rsocket, operation->get_input_socket(0));
|
||||
converter.map_input_socket(input_gsocket, operation->get_input_socket(1));
|
||||
converter.map_input_socket(input_bsocket, operation->get_input_socket(2));
|
||||
converter.map_input_socket(input_asocket, operation->get_input_socket(3));
|
||||
|
||||
NodeOperation *color_conv = getColorConverter(context);
|
||||
NodeOperation *color_conv = get_color_converter(context);
|
||||
if (color_conv) {
|
||||
converter.addOperation(color_conv);
|
||||
converter.add_operation(color_conv);
|
||||
|
||||
converter.addLink(operation->getOutputSocket(), color_conv->getInputSocket(0));
|
||||
converter.mapOutputSocket(outputSocket, color_conv->getOutputSocket());
|
||||
converter.add_link(operation->get_output_socket(), color_conv->get_input_socket(0));
|
||||
converter.map_output_socket(output_socket, color_conv->get_output_socket());
|
||||
}
|
||||
else {
|
||||
converter.mapOutputSocket(outputSocket, operation->getOutputSocket());
|
||||
converter.map_output_socket(output_socket, operation->get_output_socket());
|
||||
}
|
||||
}
|
||||
|
||||
NodeOperation *CombineRGBANode::getColorConverter(const CompositorContext & /*context*/) const
|
||||
NodeOperation *CombineRGBANode::get_color_converter(const CompositorContext & /*context*/) const
|
||||
{
|
||||
return nullptr; /* no conversion needed */
|
||||
}
|
||||
|
||||
NodeOperation *CombineHSVANode::getColorConverter(const CompositorContext & /*context*/) const
|
||||
NodeOperation *CombineHSVANode::get_color_converter(const CompositorContext & /*context*/) const
|
||||
{
|
||||
return new ConvertHSVToRGBOperation();
|
||||
}
|
||||
|
||||
NodeOperation *CombineYCCANode::getColorConverter(const CompositorContext & /*context*/) const
|
||||
NodeOperation *CombineYCCANode::get_color_converter(const CompositorContext & /*context*/) const
|
||||
{
|
||||
ConvertYCCToRGBOperation *operation = new ConvertYCCToRGBOperation();
|
||||
bNode *editorNode = this->getbNode();
|
||||
operation->setMode(editorNode->custom1);
|
||||
bNode *editor_node = this->get_bnode();
|
||||
operation->set_mode(editor_node->custom1);
|
||||
return operation;
|
||||
}
|
||||
|
||||
NodeOperation *CombineYUVANode::getColorConverter(const CompositorContext & /*context*/) const
|
||||
NodeOperation *CombineYUVANode::get_color_converter(const CompositorContext & /*context*/) const
|
||||
{
|
||||
return new ConvertYUVToRGBOperation();
|
||||
}
|
||||
|
||||
@@ -24,48 +24,48 @@ namespace blender::compositor {
|
||||
|
||||
class CombineColorNode : public Node {
|
||||
public:
|
||||
CombineColorNode(bNode *editorNode);
|
||||
void convertToOperations(NodeConverter &converter,
|
||||
const CompositorContext &context) const override;
|
||||
CombineColorNode(bNode *editor_node);
|
||||
void convert_to_operations(NodeConverter &converter,
|
||||
const CompositorContext &context) const override;
|
||||
|
||||
protected:
|
||||
virtual NodeOperation *getColorConverter(const CompositorContext &context) const = 0;
|
||||
virtual NodeOperation *get_color_converter(const CompositorContext &context) const = 0;
|
||||
};
|
||||
|
||||
class CombineRGBANode : public CombineColorNode {
|
||||
public:
|
||||
CombineRGBANode(bNode *editorNode) : CombineColorNode(editorNode)
|
||||
CombineRGBANode(bNode *editor_node) : CombineColorNode(editor_node)
|
||||
{
|
||||
}
|
||||
|
||||
NodeOperation *getColorConverter(const CompositorContext &context) const override;
|
||||
NodeOperation *get_color_converter(const CompositorContext &context) const override;
|
||||
};
|
||||
|
||||
class CombineHSVANode : public CombineColorNode {
|
||||
public:
|
||||
CombineHSVANode(bNode *editorNode) : CombineColorNode(editorNode)
|
||||
CombineHSVANode(bNode *editor_node) : CombineColorNode(editor_node)
|
||||
{
|
||||
}
|
||||
|
||||
NodeOperation *getColorConverter(const CompositorContext &context) const override;
|
||||
NodeOperation *get_color_converter(const CompositorContext &context) const override;
|
||||
};
|
||||
|
||||
class CombineYCCANode : public CombineColorNode {
|
||||
public:
|
||||
CombineYCCANode(bNode *editorNode) : CombineColorNode(editorNode)
|
||||
CombineYCCANode(bNode *editor_node) : CombineColorNode(editor_node)
|
||||
{
|
||||
}
|
||||
|
||||
NodeOperation *getColorConverter(const CompositorContext &context) const override;
|
||||
NodeOperation *get_color_converter(const CompositorContext &context) const override;
|
||||
};
|
||||
|
||||
class CombineYUVANode : public CombineColorNode {
|
||||
public:
|
||||
CombineYUVANode(bNode *editorNode) : CombineColorNode(editorNode)
|
||||
CombineYUVANode(bNode *editor_node) : CombineColorNode(editor_node)
|
||||
{
|
||||
}
|
||||
|
||||
NodeOperation *getColorConverter(const CompositorContext &context) const override;
|
||||
NodeOperation *get_color_converter(const CompositorContext &context) const override;
|
||||
};
|
||||
|
||||
} // namespace blender::compositor
|
||||
|
||||
@@ -21,44 +21,44 @@
|
||||
|
||||
namespace blender::compositor {
|
||||
|
||||
CompositorNode::CompositorNode(bNode *editorNode) : Node(editorNode)
|
||||
CompositorNode::CompositorNode(bNode *editor_node) : Node(editor_node)
|
||||
{
|
||||
/* pass */
|
||||
}
|
||||
|
||||
void CompositorNode::convertToOperations(NodeConverter &converter,
|
||||
const CompositorContext &context) const
|
||||
void CompositorNode::convert_to_operations(NodeConverter &converter,
|
||||
const CompositorContext &context) const
|
||||
{
|
||||
bNode *editorNode = this->getbNode();
|
||||
bool is_active = (editorNode->flag & NODE_DO_OUTPUT_RECALC) || context.isRendering();
|
||||
bool ignore_alpha = (editorNode->custom2 & CMP_NODE_OUTPUT_IGNORE_ALPHA) != 0;
|
||||
bNode *editor_node = this->get_bnode();
|
||||
bool is_active = (editor_node->flag & NODE_DO_OUTPUT_RECALC) || context.is_rendering();
|
||||
bool ignore_alpha = (editor_node->custom2 & CMP_NODE_OUTPUT_IGNORE_ALPHA) != 0;
|
||||
|
||||
NodeInput *imageSocket = this->getInputSocket(0);
|
||||
NodeInput *alphaSocket = this->getInputSocket(1);
|
||||
NodeInput *depthSocket = this->getInputSocket(2);
|
||||
NodeInput *image_socket = this->get_input_socket(0);
|
||||
NodeInput *alpha_socket = this->get_input_socket(1);
|
||||
NodeInput *depth_socket = this->get_input_socket(2);
|
||||
|
||||
CompositorOperation *compositorOperation = new CompositorOperation();
|
||||
compositorOperation->setScene(context.getScene());
|
||||
compositorOperation->setSceneName(context.getScene()->id.name);
|
||||
compositorOperation->setRenderData(context.getRenderData());
|
||||
compositorOperation->setViewName(context.getViewName());
|
||||
compositorOperation->setbNodeTree(context.getbNodeTree());
|
||||
CompositorOperation *compositor_operation = new CompositorOperation();
|
||||
compositor_operation->set_scene(context.get_scene());
|
||||
compositor_operation->set_scene_name(context.get_scene()->id.name);
|
||||
compositor_operation->set_render_data(context.get_render_data());
|
||||
compositor_operation->set_view_name(context.get_view_name());
|
||||
compositor_operation->set_bnodetree(context.get_bnodetree());
|
||||
/* alpha socket gives either 1 or a custom alpha value if "use alpha" is enabled */
|
||||
compositorOperation->setUseAlphaInput(ignore_alpha || alphaSocket->isLinked());
|
||||
compositorOperation->setActive(is_active);
|
||||
compositor_operation->set_use_alpha_input(ignore_alpha || alpha_socket->is_linked());
|
||||
compositor_operation->set_active(is_active);
|
||||
|
||||
converter.addOperation(compositorOperation);
|
||||
converter.mapInputSocket(imageSocket, compositorOperation->getInputSocket(0));
|
||||
converter.add_operation(compositor_operation);
|
||||
converter.map_input_socket(image_socket, compositor_operation->get_input_socket(0));
|
||||
/* only use alpha link if "use alpha" is enabled */
|
||||
if (ignore_alpha) {
|
||||
converter.addInputValue(compositorOperation->getInputSocket(1), 1.0f);
|
||||
converter.add_input_value(compositor_operation->get_input_socket(1), 1.0f);
|
||||
}
|
||||
else {
|
||||
converter.mapInputSocket(alphaSocket, compositorOperation->getInputSocket(1));
|
||||
converter.map_input_socket(alpha_socket, compositor_operation->get_input_socket(1));
|
||||
}
|
||||
converter.mapInputSocket(depthSocket, compositorOperation->getInputSocket(2));
|
||||
converter.map_input_socket(depth_socket, compositor_operation->get_input_socket(2));
|
||||
|
||||
converter.addNodeInputPreview(imageSocket);
|
||||
converter.add_node_input_preview(image_socket);
|
||||
}
|
||||
|
||||
} // namespace blender::compositor
|
||||
|
||||
@@ -29,9 +29,9 @@ namespace blender::compositor {
|
||||
*/
|
||||
class CompositorNode : public Node {
|
||||
public:
|
||||
CompositorNode(bNode *editorNode);
|
||||
void convertToOperations(NodeConverter &converter,
|
||||
const CompositorContext &context) const override;
|
||||
CompositorNode(bNode *editor_node);
|
||||
void convert_to_operations(NodeConverter &converter,
|
||||
const CompositorContext &context) const override;
|
||||
};
|
||||
|
||||
} // namespace blender::compositor
|
||||
|
||||
@@ -21,11 +21,11 @@
|
||||
|
||||
namespace blender::compositor {
|
||||
|
||||
void ConvertAlphaNode::convertToOperations(NodeConverter &converter,
|
||||
const CompositorContext & /*context*/) const
|
||||
void ConvertAlphaNode::convert_to_operations(NodeConverter &converter,
|
||||
const CompositorContext & /*context*/) const
|
||||
{
|
||||
NodeOperation *operation = nullptr;
|
||||
bNode *node = this->getbNode();
|
||||
bNode *node = this->get_bnode();
|
||||
|
||||
/* value hardcoded in rna_nodetree.c */
|
||||
if (node->custom1 == 1) {
|
||||
@@ -35,10 +35,10 @@ void ConvertAlphaNode::convertToOperations(NodeConverter &converter,
|
||||
operation = new ConvertStraightToPremulOperation();
|
||||
}
|
||||
|
||||
converter.addOperation(operation);
|
||||
converter.add_operation(operation);
|
||||
|
||||
converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0));
|
||||
converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket());
|
||||
converter.map_input_socket(get_input_socket(0), operation->get_input_socket(0));
|
||||
converter.map_output_socket(get_output_socket(0), operation->get_output_socket());
|
||||
}
|
||||
|
||||
} // namespace blender::compositor
|
||||
|
||||
@@ -28,11 +28,11 @@ namespace blender::compositor {
|
||||
*/
|
||||
class ConvertAlphaNode : public Node {
|
||||
public:
|
||||
ConvertAlphaNode(bNode *editorNode) : Node(editorNode)
|
||||
ConvertAlphaNode(bNode *editor_node) : Node(editor_node)
|
||||
{
|
||||
}
|
||||
void convertToOperations(NodeConverter &converter,
|
||||
const CompositorContext &context) const override;
|
||||
void convert_to_operations(NodeConverter &converter,
|
||||
const CompositorContext &context) const override;
|
||||
};
|
||||
|
||||
} // namespace blender::compositor
|
||||
|
||||
@@ -21,14 +21,14 @@
|
||||
|
||||
namespace blender::compositor {
|
||||
|
||||
CornerPinNode::CornerPinNode(bNode *editorNode) : Node(editorNode)
|
||||
CornerPinNode::CornerPinNode(bNode *editor_node) : Node(editor_node)
|
||||
{
|
||||
}
|
||||
|
||||
void CornerPinNode::convertToOperations(NodeConverter &converter,
|
||||
const CompositorContext & /*context*/) const
|
||||
void CornerPinNode::convert_to_operations(NodeConverter &converter,
|
||||
const CompositorContext & /*context*/) const
|
||||
{
|
||||
NodeInput *input_image = this->getInputSocket(0);
|
||||
NodeInput *input_image = this->get_input_socket(0);
|
||||
/* NOTE: socket order differs between UI node and operations:
|
||||
* bNode uses intuitive order following top-down layout:
|
||||
* upper-left, upper-right, lower-left, lower-right
|
||||
@@ -37,22 +37,22 @@ void CornerPinNode::convertToOperations(NodeConverter &converter,
|
||||
*/
|
||||
const int node_corner_index[4] = {3, 4, 2, 1};
|
||||
|
||||
NodeOutput *output_warped_image = this->getOutputSocket(0);
|
||||
NodeOutput *output_plane = this->getOutputSocket(1);
|
||||
NodeOutput *output_warped_image = this->get_output_socket(0);
|
||||
NodeOutput *output_plane = this->get_output_socket(1);
|
||||
|
||||
PlaneCornerPinWarpImageOperation *warp_image_operation = new PlaneCornerPinWarpImageOperation();
|
||||
converter.addOperation(warp_image_operation);
|
||||
converter.add_operation(warp_image_operation);
|
||||
PlaneCornerPinMaskOperation *plane_mask_operation = new PlaneCornerPinMaskOperation();
|
||||
converter.addOperation(plane_mask_operation);
|
||||
converter.add_operation(plane_mask_operation);
|
||||
|
||||
converter.mapInputSocket(input_image, warp_image_operation->getInputSocket(0));
|
||||
converter.map_input_socket(input_image, warp_image_operation->get_input_socket(0));
|
||||
for (int i = 0; i < 4; i++) {
|
||||
NodeInput *corner_input = getInputSocket(node_corner_index[i]);
|
||||
converter.mapInputSocket(corner_input, warp_image_operation->getInputSocket(i + 1));
|
||||
converter.mapInputSocket(corner_input, plane_mask_operation->getInputSocket(i));
|
||||
NodeInput *corner_input = get_input_socket(node_corner_index[i]);
|
||||
converter.map_input_socket(corner_input, warp_image_operation->get_input_socket(i + 1));
|
||||
converter.map_input_socket(corner_input, plane_mask_operation->get_input_socket(i));
|
||||
}
|
||||
converter.mapOutputSocket(output_warped_image, warp_image_operation->getOutputSocket());
|
||||
converter.mapOutputSocket(output_plane, plane_mask_operation->getOutputSocket());
|
||||
converter.map_output_socket(output_warped_image, warp_image_operation->get_output_socket());
|
||||
converter.map_output_socket(output_plane, plane_mask_operation->get_output_socket());
|
||||
}
|
||||
|
||||
} // namespace blender::compositor
|
||||
|
||||
@@ -29,9 +29,9 @@ namespace blender::compositor {
|
||||
*/
|
||||
class CornerPinNode : public Node {
|
||||
public:
|
||||
CornerPinNode(bNode *editorNode);
|
||||
void convertToOperations(NodeConverter &converter,
|
||||
const CompositorContext &context) const override;
|
||||
CornerPinNode(bNode *editor_node);
|
||||
void convert_to_operations(NodeConverter &converter,
|
||||
const CompositorContext &context) const override;
|
||||
};
|
||||
|
||||
} // namespace blender::compositor
|
||||
|
||||
@@ -21,31 +21,31 @@
|
||||
|
||||
namespace blender::compositor {
|
||||
|
||||
CropNode::CropNode(bNode *editorNode) : Node(editorNode)
|
||||
CropNode::CropNode(bNode *editor_node) : Node(editor_node)
|
||||
{
|
||||
/* pass */
|
||||
}
|
||||
|
||||
void CropNode::convertToOperations(NodeConverter &converter,
|
||||
const CompositorContext & /*context*/) const
|
||||
void CropNode::convert_to_operations(NodeConverter &converter,
|
||||
const CompositorContext & /*context*/) const
|
||||
{
|
||||
bNode *node = getbNode();
|
||||
NodeTwoXYs *cropSettings = (NodeTwoXYs *)node->storage;
|
||||
bNode *node = get_bnode();
|
||||
NodeTwoXYs *crop_settings = (NodeTwoXYs *)node->storage;
|
||||
bool relative = (bool)node->custom2;
|
||||
bool cropImage = (bool)node->custom1;
|
||||
bool crop_image = (bool)node->custom1;
|
||||
CropBaseOperation *operation;
|
||||
if (cropImage) {
|
||||
if (crop_image) {
|
||||
operation = new CropImageOperation();
|
||||
}
|
||||
else {
|
||||
operation = new CropOperation();
|
||||
}
|
||||
operation->setCropSettings(cropSettings);
|
||||
operation->setRelative(relative);
|
||||
converter.addOperation(operation);
|
||||
operation->set_crop_settings(crop_settings);
|
||||
operation->set_relative(relative);
|
||||
converter.add_operation(operation);
|
||||
|
||||
converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0));
|
||||
converter.mapOutputSocket(getOutputSocket(), operation->getOutputSocket());
|
||||
converter.map_input_socket(get_input_socket(0), operation->get_input_socket(0));
|
||||
converter.map_output_socket(get_output_socket(), operation->get_output_socket());
|
||||
}
|
||||
|
||||
} // namespace blender::compositor
|
||||
|
||||
@@ -28,9 +28,9 @@ namespace blender::compositor {
|
||||
*/
|
||||
class CropNode : public Node {
|
||||
public:
|
||||
CropNode(bNode *editorNode);
|
||||
void convertToOperations(NodeConverter &converter,
|
||||
const CompositorContext &context) const override;
|
||||
CropNode(bNode *editor_node);
|
||||
void convert_to_operations(NodeConverter &converter,
|
||||
const CompositorContext &context) const override;
|
||||
};
|
||||
|
||||
} // namespace blender::compositor
|
||||
|
||||
@@ -30,41 +30,41 @@ namespace blender::compositor {
|
||||
/** \name Cryptomatte Base
|
||||
* \{ */
|
||||
|
||||
void CryptomatteBaseNode::convertToOperations(NodeConverter &converter,
|
||||
const CompositorContext &context) const
|
||||
void CryptomatteBaseNode::convert_to_operations(NodeConverter &converter,
|
||||
const CompositorContext &context) const
|
||||
{
|
||||
NodeOutput *output_image_socket = this->getOutputSocket(0);
|
||||
NodeOutput *output_image_socket = this->get_output_socket(0);
|
||||
|
||||
bNode *node = this->getbNode();
|
||||
bNode *node = this->get_bnode();
|
||||
NodeCryptomatte *cryptomatte_settings = static_cast<NodeCryptomatte *>(node->storage);
|
||||
|
||||
CryptomatteOperation *cryptomatte_operation = create_cryptomatte_operation(
|
||||
converter, context, *node, cryptomatte_settings);
|
||||
converter.addOperation(cryptomatte_operation);
|
||||
converter.add_operation(cryptomatte_operation);
|
||||
|
||||
NodeOutput *output_matte_socket = this->getOutputSocket(1);
|
||||
NodeOutput *output_matte_socket = this->get_output_socket(1);
|
||||
SeparateChannelOperation *extract_mask_operation = new SeparateChannelOperation;
|
||||
extract_mask_operation->setChannel(3);
|
||||
converter.addOperation(extract_mask_operation);
|
||||
converter.addLink(cryptomatte_operation->getOutputSocket(0),
|
||||
extract_mask_operation->getInputSocket(0));
|
||||
converter.mapOutputSocket(output_matte_socket, extract_mask_operation->getOutputSocket(0));
|
||||
extract_mask_operation->set_channel(3);
|
||||
converter.add_operation(extract_mask_operation);
|
||||
converter.add_link(cryptomatte_operation->get_output_socket(0),
|
||||
extract_mask_operation->get_input_socket(0));
|
||||
converter.map_output_socket(output_matte_socket, extract_mask_operation->get_output_socket(0));
|
||||
|
||||
NodeInput *input_image_socket = this->getInputSocket(0);
|
||||
NodeInput *input_image_socket = this->get_input_socket(0);
|
||||
SetAlphaMultiplyOperation *apply_mask_operation = new SetAlphaMultiplyOperation();
|
||||
converter.mapInputSocket(input_image_socket, apply_mask_operation->getInputSocket(0));
|
||||
converter.addOperation(apply_mask_operation);
|
||||
converter.addLink(extract_mask_operation->getOutputSocket(0),
|
||||
apply_mask_operation->getInputSocket(1));
|
||||
converter.mapOutputSocket(output_image_socket, apply_mask_operation->getOutputSocket(0));
|
||||
converter.map_input_socket(input_image_socket, apply_mask_operation->get_input_socket(0));
|
||||
converter.add_operation(apply_mask_operation);
|
||||
converter.add_link(extract_mask_operation->get_output_socket(0),
|
||||
apply_mask_operation->get_input_socket(1));
|
||||
converter.map_output_socket(output_image_socket, apply_mask_operation->get_output_socket(0));
|
||||
|
||||
NodeOutput *output_pick_socket = this->getOutputSocket(2);
|
||||
NodeOutput *output_pick_socket = this->get_output_socket(2);
|
||||
SetAlphaMultiplyOperation *extract_pick_operation = new SetAlphaMultiplyOperation();
|
||||
converter.addOperation(extract_pick_operation);
|
||||
converter.addInputValue(extract_pick_operation->getInputSocket(1), 1.0f);
|
||||
converter.addLink(cryptomatte_operation->getOutputSocket(0),
|
||||
extract_pick_operation->getInputSocket(0));
|
||||
converter.mapOutputSocket(output_pick_socket, extract_pick_operation->getOutputSocket(0));
|
||||
converter.add_operation(extract_pick_operation);
|
||||
converter.add_input_value(extract_pick_operation->get_input_socket(1), 1.0f);
|
||||
converter.add_link(cryptomatte_operation->get_output_socket(0),
|
||||
extract_pick_operation->get_input_socket(0));
|
||||
converter.map_output_socket(output_pick_socket, extract_pick_operation->get_output_socket(0));
|
||||
}
|
||||
|
||||
/** \} */
|
||||
@@ -76,7 +76,7 @@ void CryptomatteBaseNode::convertToOperations(NodeConverter &converter,
|
||||
static std::string prefix_from_node(const CompositorContext &context, const bNode &node)
|
||||
{
|
||||
char prefix[MAX_NAME];
|
||||
ntreeCompositCryptomatteLayerPrefix(context.getScene(), &node, prefix, sizeof(prefix));
|
||||
ntreeCompositCryptomatteLayerPrefix(context.get_scene(), &node, prefix, sizeof(prefix));
|
||||
return std::string(prefix, BLI_strnlen(prefix, sizeof(prefix)));
|
||||
}
|
||||
|
||||
@@ -120,7 +120,7 @@ void CryptomatteNode::input_operations_from_render_source(
|
||||
RenderLayer *render_layer = RE_GetRenderLayer(render_result, view_layer->name);
|
||||
if (render_layer) {
|
||||
LISTBASE_FOREACH (RenderPass *, render_pass, &render_layer->passes) {
|
||||
if (context.has_explicit_view() && !STREQ(render_pass->view, context.getViewName())) {
|
||||
if (context.has_explicit_view() && !STREQ(render_pass->view, context.get_view_name())) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -128,10 +128,10 @@ void CryptomatteNode::input_operations_from_render_source(
|
||||
if (blender::StringRef(combined_name).startswith(prefix)) {
|
||||
RenderLayersProg *op = new RenderLayersProg(
|
||||
render_pass->name, DataType::Color, render_pass->channels);
|
||||
op->setScene(scene);
|
||||
op->setLayerId(view_layer_id);
|
||||
op->setRenderData(context.getRenderData());
|
||||
op->setViewName(context.getViewName());
|
||||
op->set_scene(scene);
|
||||
op->set_layer_id(view_layer_id);
|
||||
op->set_render_data(context.get_render_data());
|
||||
op->set_view_name(context.get_view_name());
|
||||
r_input_operations.append(op);
|
||||
}
|
||||
}
|
||||
@@ -157,7 +157,7 @@ void CryptomatteNode::input_operations_from_image_source(
|
||||
}
|
||||
|
||||
ImageUser *iuser = &cryptomatte_settings->iuser;
|
||||
BKE_image_user_frame_calc(image, iuser, context.getFramenumber());
|
||||
BKE_image_user_frame_calc(image, iuser, context.get_framenumber());
|
||||
ImBuf *ibuf = BKE_image_acquire_ibuf(image, iuser, nullptr);
|
||||
|
||||
if (image->rr) {
|
||||
@@ -167,7 +167,7 @@ void CryptomatteNode::input_operations_from_image_source(
|
||||
/* Heuristic to match image name with scene names, check if the view name exists in the
|
||||
* image. */
|
||||
view = BLI_findstringindex(
|
||||
&image->rr->views, context.getViewName(), offsetof(RenderView, name));
|
||||
&image->rr->views, context.get_view_name(), offsetof(RenderView, name));
|
||||
if (view == -1) {
|
||||
view = 0;
|
||||
}
|
||||
@@ -189,10 +189,10 @@ void CryptomatteNode::input_operations_from_image_source(
|
||||
if (blender::StringRef(combined_name).startswith(prefix)) {
|
||||
MultilayerColorOperation *op = new MultilayerColorOperation(
|
||||
render_layer, render_pass, view);
|
||||
op->setImage(image);
|
||||
op->setImageUser(iuser);
|
||||
op->set_image(image);
|
||||
op->set_image_user(iuser);
|
||||
iuser->layer = layer_index;
|
||||
op->setFramenumber(context.getFramenumber());
|
||||
op->set_framenumber(context.get_framenumber());
|
||||
r_input_operations.append(op);
|
||||
}
|
||||
}
|
||||
@@ -217,10 +217,10 @@ Vector<NodeOperation *> CryptomatteNode::create_input_operations(const Composito
|
||||
|
||||
if (input_operations.is_empty()) {
|
||||
SetColorOperation *op = new SetColorOperation();
|
||||
op->setChannel1(0.0f);
|
||||
op->setChannel2(1.0f);
|
||||
op->setChannel3(0.0f);
|
||||
op->setChannel4(0.0f);
|
||||
op->set_channel1(0.0f);
|
||||
op->set_channel2(1.0f);
|
||||
op->set_channel3(0.0f);
|
||||
op->set_channel4(0.0f);
|
||||
input_operations.append(op);
|
||||
}
|
||||
return input_operations;
|
||||
@@ -234,11 +234,11 @@ CryptomatteOperation *CryptomatteNode::create_cryptomatte_operation(
|
||||
Vector<NodeOperation *> input_operations = create_input_operations(context, node);
|
||||
CryptomatteOperation *operation = new CryptomatteOperation(input_operations.size());
|
||||
LISTBASE_FOREACH (CryptomatteEntry *, cryptomatte_entry, &cryptomatte_settings->entries) {
|
||||
operation->addObjectIndex(cryptomatte_entry->encoded_hash);
|
||||
operation->add_object_index(cryptomatte_entry->encoded_hash);
|
||||
}
|
||||
for (int i = 0; i < input_operations.size(); ++i) {
|
||||
converter.addOperation(input_operations[i]);
|
||||
converter.addLink(input_operations[i]->getOutputSocket(), operation->getInputSocket(i));
|
||||
converter.add_operation(input_operations[i]);
|
||||
converter.add_link(input_operations[i]->get_output_socket(), operation->get_input_socket(i));
|
||||
}
|
||||
return operation;
|
||||
}
|
||||
@@ -259,12 +259,12 @@ CryptomatteOperation *CryptomatteLegacyNode::create_cryptomatte_operation(
|
||||
CryptomatteOperation *operation = new CryptomatteOperation(num_inputs);
|
||||
if (cryptomatte_settings) {
|
||||
LISTBASE_FOREACH (CryptomatteEntry *, cryptomatte_entry, &cryptomatte_settings->entries) {
|
||||
operation->addObjectIndex(cryptomatte_entry->encoded_hash);
|
||||
operation->add_object_index(cryptomatte_entry->encoded_hash);
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < num_inputs; i++) {
|
||||
converter.mapInputSocket(this->getInputSocket(i + 1), operation->getInputSocket(i));
|
||||
converter.map_input_socket(this->get_input_socket(i + 1), operation->get_input_socket(i));
|
||||
}
|
||||
|
||||
return operation;
|
||||
|
||||
@@ -38,8 +38,8 @@ class CryptomatteBaseNode : public Node {
|
||||
}
|
||||
|
||||
public:
|
||||
void convertToOperations(NodeConverter &converter,
|
||||
const CompositorContext &context) const override;
|
||||
void convert_to_operations(NodeConverter &converter,
|
||||
const CompositorContext &context) const override;
|
||||
|
||||
protected:
|
||||
virtual CryptomatteOperation *create_cryptomatte_operation(
|
||||
|
||||
@@ -26,58 +26,58 @@
|
||||
|
||||
namespace blender::compositor {
|
||||
|
||||
DefocusNode::DefocusNode(bNode *editorNode) : Node(editorNode)
|
||||
DefocusNode::DefocusNode(bNode *editor_node) : Node(editor_node)
|
||||
{
|
||||
/* pass */
|
||||
}
|
||||
|
||||
void DefocusNode::convertToOperations(NodeConverter &converter,
|
||||
const CompositorContext &context) const
|
||||
void DefocusNode::convert_to_operations(NodeConverter &converter,
|
||||
const CompositorContext &context) const
|
||||
{
|
||||
bNode *node = this->getbNode();
|
||||
bNode *node = this->get_bnode();
|
||||
NodeDefocus *data = (NodeDefocus *)node->storage;
|
||||
Scene *scene = node->id ? (Scene *)node->id : context.getScene();
|
||||
Scene *scene = node->id ? (Scene *)node->id : context.get_scene();
|
||||
Object *camob = scene ? scene->camera : nullptr;
|
||||
|
||||
NodeOperation *radiusOperation;
|
||||
NodeOperation *radius_operation;
|
||||
if (data->no_zbuf) {
|
||||
MathMultiplyOperation *multiply = new MathMultiplyOperation();
|
||||
SetValueOperation *multiplier = new SetValueOperation();
|
||||
multiplier->setValue(data->scale);
|
||||
SetValueOperation *maxRadius = new SetValueOperation();
|
||||
maxRadius->setValue(data->maxblur);
|
||||
multiplier->set_value(data->scale);
|
||||
SetValueOperation *max_radius = new SetValueOperation();
|
||||
max_radius->set_value(data->maxblur);
|
||||
MathMinimumOperation *minimize = new MathMinimumOperation();
|
||||
|
||||
converter.addOperation(multiply);
|
||||
converter.addOperation(multiplier);
|
||||
converter.addOperation(maxRadius);
|
||||
converter.addOperation(minimize);
|
||||
converter.add_operation(multiply);
|
||||
converter.add_operation(multiplier);
|
||||
converter.add_operation(max_radius);
|
||||
converter.add_operation(minimize);
|
||||
|
||||
converter.mapInputSocket(getInputSocket(1), multiply->getInputSocket(0));
|
||||
converter.addLink(multiplier->getOutputSocket(), multiply->getInputSocket(1));
|
||||
converter.addLink(multiply->getOutputSocket(), minimize->getInputSocket(0));
|
||||
converter.addLink(maxRadius->getOutputSocket(), minimize->getInputSocket(1));
|
||||
converter.map_input_socket(get_input_socket(1), multiply->get_input_socket(0));
|
||||
converter.add_link(multiplier->get_output_socket(), multiply->get_input_socket(1));
|
||||
converter.add_link(multiply->get_output_socket(), minimize->get_input_socket(0));
|
||||
converter.add_link(max_radius->get_output_socket(), minimize->get_input_socket(1));
|
||||
|
||||
radiusOperation = minimize;
|
||||
radius_operation = minimize;
|
||||
}
|
||||
else {
|
||||
ConvertDepthToRadiusOperation *radius_op = new ConvertDepthToRadiusOperation();
|
||||
radius_op->setCameraObject(camob);
|
||||
radius_op->setfStop(data->fstop);
|
||||
radius_op->setMaxRadius(data->maxblur);
|
||||
converter.addOperation(radius_op);
|
||||
radius_op->set_camera_object(camob);
|
||||
radius_op->setf_stop(data->fstop);
|
||||
radius_op->set_max_radius(data->maxblur);
|
||||
converter.add_operation(radius_op);
|
||||
|
||||
converter.mapInputSocket(getInputSocket(1), radius_op->getInputSocket(0));
|
||||
converter.map_input_socket(get_input_socket(1), radius_op->get_input_socket(0));
|
||||
|
||||
FastGaussianBlurValueOperation *blur = new FastGaussianBlurValueOperation();
|
||||
/* maintain close pixels so far Z values don't bleed into the foreground */
|
||||
blur->setOverlay(FAST_GAUSS_OVERLAY_MIN);
|
||||
converter.addOperation(blur);
|
||||
blur->set_overlay(FAST_GAUSS_OVERLAY_MIN);
|
||||
converter.add_operation(blur);
|
||||
|
||||
converter.addLink(radius_op->getOutputSocket(0), blur->getInputSocket(0));
|
||||
radius_op->setPostBlur(blur);
|
||||
converter.add_link(radius_op->get_output_socket(0), blur->get_input_socket(0));
|
||||
radius_op->set_post_blur(blur);
|
||||
|
||||
radiusOperation = blur;
|
||||
radius_operation = blur;
|
||||
}
|
||||
|
||||
NodeBokehImage *bokehdata = new NodeBokehImage();
|
||||
@@ -92,49 +92,49 @@ void DefocusNode::convertToOperations(NodeConverter &converter,
|
||||
bokehdata->lensshift = 0.0f;
|
||||
|
||||
BokehImageOperation *bokeh = new BokehImageOperation();
|
||||
bokeh->setData(bokehdata);
|
||||
bokeh->deleteDataOnFinish();
|
||||
converter.addOperation(bokeh);
|
||||
bokeh->set_data(bokehdata);
|
||||
bokeh->delete_data_on_finish();
|
||||
converter.add_operation(bokeh);
|
||||
|
||||
#ifdef COM_DEFOCUS_SEARCH
|
||||
InverseSearchRadiusOperation *search = new InverseSearchRadiusOperation();
|
||||
search->setMaxBlur(data->maxblur);
|
||||
converter.addOperation(search);
|
||||
search->set_max_blur(data->maxblur);
|
||||
converter.add_operation(search);
|
||||
|
||||
converter.addLink(radiusOperation->getOutputSocket(0), search->getInputSocket(0));
|
||||
converter.add_link(radius_operation->get_output_socket(0), search->get_input_socket(0));
|
||||
#endif
|
||||
|
||||
VariableSizeBokehBlurOperation *operation = new VariableSizeBokehBlurOperation();
|
||||
if (data->preview) {
|
||||
operation->setQuality(eCompositorQuality::Low);
|
||||
operation->set_quality(eCompositorQuality::Low);
|
||||
}
|
||||
else {
|
||||
operation->setQuality(context.getQuality());
|
||||
operation->set_quality(context.get_quality());
|
||||
}
|
||||
operation->setMaxBlur(data->maxblur);
|
||||
operation->setThreshold(data->bthresh);
|
||||
converter.addOperation(operation);
|
||||
operation->set_max_blur(data->maxblur);
|
||||
operation->set_threshold(data->bthresh);
|
||||
converter.add_operation(operation);
|
||||
|
||||
converter.addLink(bokeh->getOutputSocket(), operation->getInputSocket(1));
|
||||
converter.addLink(radiusOperation->getOutputSocket(), operation->getInputSocket(2));
|
||||
converter.add_link(bokeh->get_output_socket(), operation->get_input_socket(1));
|
||||
converter.add_link(radius_operation->get_output_socket(), operation->get_input_socket(2));
|
||||
#ifdef COM_DEFOCUS_SEARCH
|
||||
converter.addLink(search->getOutputSocket(), operation->getInputSocket(3));
|
||||
converter.add_link(search->get_output_socket(), operation->get_input_socket(3));
|
||||
#endif
|
||||
|
||||
if (data->gamco) {
|
||||
GammaCorrectOperation *correct = new GammaCorrectOperation();
|
||||
converter.addOperation(correct);
|
||||
converter.add_operation(correct);
|
||||
GammaUncorrectOperation *inverse = new GammaUncorrectOperation();
|
||||
converter.addOperation(inverse);
|
||||
converter.add_operation(inverse);
|
||||
|
||||
converter.mapInputSocket(getInputSocket(0), correct->getInputSocket(0));
|
||||
converter.addLink(correct->getOutputSocket(), operation->getInputSocket(0));
|
||||
converter.addLink(operation->getOutputSocket(), inverse->getInputSocket(0));
|
||||
converter.mapOutputSocket(getOutputSocket(), inverse->getOutputSocket());
|
||||
converter.map_input_socket(get_input_socket(0), correct->get_input_socket(0));
|
||||
converter.add_link(correct->get_output_socket(), operation->get_input_socket(0));
|
||||
converter.add_link(operation->get_output_socket(), inverse->get_input_socket(0));
|
||||
converter.map_output_socket(get_output_socket(), inverse->get_output_socket());
|
||||
}
|
||||
else {
|
||||
converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0));
|
||||
converter.mapOutputSocket(getOutputSocket(), operation->getOutputSocket());
|
||||
converter.map_input_socket(get_input_socket(0), operation->get_input_socket(0));
|
||||
converter.map_output_socket(get_output_socket(), operation->get_output_socket());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -28,9 +28,9 @@ namespace blender::compositor {
|
||||
*/
|
||||
class DefocusNode : public Node {
|
||||
public:
|
||||
DefocusNode(bNode *editorNode);
|
||||
void convertToOperations(NodeConverter &converter,
|
||||
const CompositorContext &context) const override;
|
||||
DefocusNode(bNode *editor_node);
|
||||
void convert_to_operations(NodeConverter &converter,
|
||||
const CompositorContext &context) const override;
|
||||
};
|
||||
|
||||
} // namespace blender::compositor
|
||||
|
||||
@@ -20,51 +20,51 @@
|
||||
|
||||
namespace blender::compositor {
|
||||
|
||||
DenoiseNode::DenoiseNode(bNode *editorNode) : Node(editorNode)
|
||||
DenoiseNode::DenoiseNode(bNode *editor_node) : Node(editor_node)
|
||||
{
|
||||
/* pass */
|
||||
}
|
||||
|
||||
void DenoiseNode::convertToOperations(NodeConverter &converter,
|
||||
const CompositorContext & /*context*/) const
|
||||
void DenoiseNode::convert_to_operations(NodeConverter &converter,
|
||||
const CompositorContext & /*context*/) const
|
||||
{
|
||||
if (!COM_is_denoise_supported()) {
|
||||
converter.mapOutputSocket(getOutputSocket(0),
|
||||
converter.addInputProxy(getInputSocket(0), false));
|
||||
converter.map_output_socket(get_output_socket(0),
|
||||
converter.add_input_proxy(get_input_socket(0), false));
|
||||
return;
|
||||
}
|
||||
|
||||
bNode *node = this->getbNode();
|
||||
bNode *node = this->get_bnode();
|
||||
NodeDenoise *denoise = (NodeDenoise *)node->storage;
|
||||
|
||||
DenoiseOperation *operation = new DenoiseOperation();
|
||||
converter.addOperation(operation);
|
||||
operation->setDenoiseSettings(denoise);
|
||||
converter.add_operation(operation);
|
||||
operation->set_denoise_settings(denoise);
|
||||
|
||||
converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0));
|
||||
converter.map_input_socket(get_input_socket(0), operation->get_input_socket(0));
|
||||
if (denoise && denoise->prefilter == CMP_NODE_DENOISE_PREFILTER_ACCURATE) {
|
||||
{
|
||||
DenoisePrefilterOperation *normal_prefilter = new DenoisePrefilterOperation(
|
||||
DataType::Vector);
|
||||
normal_prefilter->set_image_name("normal");
|
||||
converter.addOperation(normal_prefilter);
|
||||
converter.mapInputSocket(getInputSocket(1), normal_prefilter->getInputSocket(0));
|
||||
converter.addLink(normal_prefilter->getOutputSocket(), operation->getInputSocket(1));
|
||||
converter.add_operation(normal_prefilter);
|
||||
converter.map_input_socket(get_input_socket(1), normal_prefilter->get_input_socket(0));
|
||||
converter.add_link(normal_prefilter->get_output_socket(), operation->get_input_socket(1));
|
||||
}
|
||||
{
|
||||
DenoisePrefilterOperation *albedo_prefilter = new DenoisePrefilterOperation(DataType::Color);
|
||||
albedo_prefilter->set_image_name("albedo");
|
||||
converter.addOperation(albedo_prefilter);
|
||||
converter.mapInputSocket(getInputSocket(2), albedo_prefilter->getInputSocket(0));
|
||||
converter.addLink(albedo_prefilter->getOutputSocket(), operation->getInputSocket(2));
|
||||
converter.add_operation(albedo_prefilter);
|
||||
converter.map_input_socket(get_input_socket(2), albedo_prefilter->get_input_socket(0));
|
||||
converter.add_link(albedo_prefilter->get_output_socket(), operation->get_input_socket(2));
|
||||
}
|
||||
}
|
||||
else {
|
||||
converter.mapInputSocket(getInputSocket(1), operation->getInputSocket(1));
|
||||
converter.mapInputSocket(getInputSocket(2), operation->getInputSocket(2));
|
||||
converter.map_input_socket(get_input_socket(1), operation->get_input_socket(1));
|
||||
converter.map_input_socket(get_input_socket(2), operation->get_input_socket(2));
|
||||
}
|
||||
|
||||
converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket(0));
|
||||
converter.map_output_socket(get_output_socket(0), operation->get_output_socket(0));
|
||||
}
|
||||
|
||||
} // namespace blender::compositor
|
||||
|
||||
@@ -28,9 +28,9 @@ namespace blender::compositor {
|
||||
*/
|
||||
class DenoiseNode : public Node {
|
||||
public:
|
||||
DenoiseNode(bNode *editorNode);
|
||||
void convertToOperations(NodeConverter &converter,
|
||||
const CompositorContext &context) const override;
|
||||
DenoiseNode(bNode *editor_node);
|
||||
void convert_to_operations(NodeConverter &converter,
|
||||
const CompositorContext &context) const override;
|
||||
};
|
||||
|
||||
} // namespace blender::compositor
|
||||
|
||||
@@ -21,29 +21,29 @@
|
||||
|
||||
namespace blender::compositor {
|
||||
|
||||
DespeckleNode::DespeckleNode(bNode *editorNode) : Node(editorNode)
|
||||
DespeckleNode::DespeckleNode(bNode *editor_node) : Node(editor_node)
|
||||
{
|
||||
/* pass */
|
||||
}
|
||||
|
||||
void DespeckleNode::convertToOperations(NodeConverter &converter,
|
||||
const CompositorContext & /*context*/) const
|
||||
void DespeckleNode::convert_to_operations(NodeConverter &converter,
|
||||
const CompositorContext & /*context*/) const
|
||||
{
|
||||
bNode *editorNode = this->getbNode();
|
||||
NodeInput *inputSocket = this->getInputSocket(0);
|
||||
NodeInput *inputImageSocket = this->getInputSocket(1);
|
||||
NodeOutput *outputSocket = this->getOutputSocket(0);
|
||||
bNode *editor_node = this->get_bnode();
|
||||
NodeInput *input_socket = this->get_input_socket(0);
|
||||
NodeInput *input_image_socket = this->get_input_socket(1);
|
||||
NodeOutput *output_socket = this->get_output_socket(0);
|
||||
|
||||
DespeckleOperation *operation = new DespeckleOperation();
|
||||
operation->setThreshold(editorNode->custom3);
|
||||
operation->setThresholdNeighbor(editorNode->custom4);
|
||||
converter.addOperation(operation);
|
||||
operation->set_threshold(editor_node->custom3);
|
||||
operation->set_threshold_neighbor(editor_node->custom4);
|
||||
converter.add_operation(operation);
|
||||
|
||||
converter.mapInputSocket(inputImageSocket, operation->getInputSocket(0));
|
||||
converter.mapInputSocket(inputSocket, operation->getInputSocket(1));
|
||||
converter.mapOutputSocket(outputSocket, operation->getOutputSocket());
|
||||
converter.map_input_socket(input_image_socket, operation->get_input_socket(0));
|
||||
converter.map_input_socket(input_socket, operation->get_input_socket(1));
|
||||
converter.map_output_socket(output_socket, operation->get_output_socket());
|
||||
|
||||
converter.addPreview(operation->getOutputSocket(0));
|
||||
converter.add_preview(operation->get_output_socket(0));
|
||||
}
|
||||
|
||||
} // namespace blender::compositor
|
||||
|
||||
@@ -28,9 +28,9 @@ namespace blender::compositor {
|
||||
*/
|
||||
class DespeckleNode : public Node {
|
||||
public:
|
||||
DespeckleNode(bNode *editorNode);
|
||||
void convertToOperations(NodeConverter &converter,
|
||||
const CompositorContext &context) const override;
|
||||
DespeckleNode(bNode *editor_node);
|
||||
void convert_to_operations(NodeConverter &converter,
|
||||
const CompositorContext &context) const override;
|
||||
};
|
||||
|
||||
} // namespace blender::compositor
|
||||
|
||||
@@ -22,36 +22,36 @@
|
||||
|
||||
namespace blender::compositor {
|
||||
|
||||
DifferenceMatteNode::DifferenceMatteNode(bNode *editorNode) : Node(editorNode)
|
||||
DifferenceMatteNode::DifferenceMatteNode(bNode *editor_node) : Node(editor_node)
|
||||
{
|
||||
/* pass */
|
||||
}
|
||||
|
||||
void DifferenceMatteNode::convertToOperations(NodeConverter &converter,
|
||||
const CompositorContext & /*context*/) const
|
||||
void DifferenceMatteNode::convert_to_operations(NodeConverter &converter,
|
||||
const CompositorContext & /*context*/) const
|
||||
{
|
||||
NodeInput *inputSocket = this->getInputSocket(0);
|
||||
NodeInput *inputSocket2 = this->getInputSocket(1);
|
||||
NodeOutput *outputSocketImage = this->getOutputSocket(0);
|
||||
NodeOutput *outputSocketMatte = this->getOutputSocket(1);
|
||||
bNode *editorNode = this->getbNode();
|
||||
NodeInput *input_socket = this->get_input_socket(0);
|
||||
NodeInput *input_socket2 = this->get_input_socket(1);
|
||||
NodeOutput *output_socket_image = this->get_output_socket(0);
|
||||
NodeOutput *output_socket_matte = this->get_output_socket(1);
|
||||
bNode *editor_node = this->get_bnode();
|
||||
|
||||
DifferenceMatteOperation *operationSet = new DifferenceMatteOperation();
|
||||
operationSet->setSettings((NodeChroma *)editorNode->storage);
|
||||
converter.addOperation(operationSet);
|
||||
DifferenceMatteOperation *operation_set = new DifferenceMatteOperation();
|
||||
operation_set->set_settings((NodeChroma *)editor_node->storage);
|
||||
converter.add_operation(operation_set);
|
||||
|
||||
converter.mapInputSocket(inputSocket, operationSet->getInputSocket(0));
|
||||
converter.mapInputSocket(inputSocket2, operationSet->getInputSocket(1));
|
||||
converter.mapOutputSocket(outputSocketMatte, operationSet->getOutputSocket(0));
|
||||
converter.map_input_socket(input_socket, operation_set->get_input_socket(0));
|
||||
converter.map_input_socket(input_socket2, operation_set->get_input_socket(1));
|
||||
converter.map_output_socket(output_socket_matte, operation_set->get_output_socket(0));
|
||||
|
||||
SetAlphaMultiplyOperation *operation = new SetAlphaMultiplyOperation();
|
||||
converter.addOperation(operation);
|
||||
converter.add_operation(operation);
|
||||
|
||||
converter.mapInputSocket(inputSocket, operation->getInputSocket(0));
|
||||
converter.addLink(operationSet->getOutputSocket(), operation->getInputSocket(1));
|
||||
converter.mapOutputSocket(outputSocketImage, operation->getOutputSocket());
|
||||
converter.map_input_socket(input_socket, operation->get_input_socket(0));
|
||||
converter.add_link(operation_set->get_output_socket(), operation->get_input_socket(1));
|
||||
converter.map_output_socket(output_socket_image, operation->get_output_socket());
|
||||
|
||||
converter.addPreview(operation->getOutputSocket());
|
||||
converter.add_preview(operation->get_output_socket());
|
||||
}
|
||||
|
||||
} // namespace blender::compositor
|
||||
|
||||
@@ -28,9 +28,9 @@ namespace blender::compositor {
|
||||
*/
|
||||
class DifferenceMatteNode : public Node {
|
||||
public:
|
||||
DifferenceMatteNode(bNode *editorNode);
|
||||
void convertToOperations(NodeConverter &converter,
|
||||
const CompositorContext &context) const override;
|
||||
DifferenceMatteNode(bNode *editor_node);
|
||||
void convert_to_operations(NodeConverter &converter,
|
||||
const CompositorContext &context) const override;
|
||||
};
|
||||
|
||||
} // namespace blender::compositor
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user