fix [#32490] Compsitor crashes on missing OpenEXR multilayer files
This commit is contained in:
@@ -137,6 +137,21 @@ void Node::addSetVectorOperation(ExecutionSystem *graph, InputSocket *inputsocke
|
|||||||
graph->addOperation(operation);
|
graph->addOperation(operation);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* when a node has no valid data (missing image or group pointer) */
|
||||||
|
void Node::convertToOperations_invalid(ExecutionSystem *graph, CompositorContext *context)
|
||||||
|
{
|
||||||
|
/* 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};
|
||||||
|
int index;
|
||||||
|
vector<OutputSocket *> &outputsockets = this->getOutputSockets();
|
||||||
|
for (index = 0; index < outputsockets.size(); index++) {
|
||||||
|
SetColorOperation *operation = new SetColorOperation();
|
||||||
|
this->getOutputSocket(index)->relinkConnections(operation->getOutputSocket());
|
||||||
|
operation->setChannels(warning_color);
|
||||||
|
graph->addOperation(operation);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bNodeSocket *Node::getEditorInputSocket(int editorNodeInputSocketIndex)
|
bNodeSocket *Node::getEditorInputSocket(int editorNodeInputSocketIndex)
|
||||||
{
|
{
|
||||||
bNodeSocket *bSock = (bNodeSocket *)this->getbNode()->inputs.first;
|
bNodeSocket *bSock = (bNodeSocket *)this->getbNode()->inputs.first;
|
||||||
|
@@ -99,6 +99,13 @@ public:
|
|||||||
*/
|
*/
|
||||||
void addSetVectorOperation(ExecutionSystem *graph, InputSocket *inputsocket, int editorNodeInputSocketIndex);
|
void addSetVectorOperation(ExecutionSystem *graph, InputSocket *inputsocket, int editorNodeInputSocketIndex);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* when a node has no valid data (missing image or a group nodes ID pointer is NULL)
|
||||||
|
* call this function from #convertToOperations, this way the node sockets are converted
|
||||||
|
* into valid outputs, without this the compositor system gets confused and crashes, see [#32490]
|
||||||
|
*/
|
||||||
|
void convertToOperations_invalid(ExecutionSystem *graph, CompositorContext *context);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new link between an outputSocket and inputSocket and registrates the link to the graph
|
* Creates a new link between an outputSocket and inputSocket and registrates the link to the graph
|
||||||
* @return the new created link
|
* @return the new created link
|
||||||
|
@@ -33,16 +33,7 @@ GroupNode::GroupNode(bNode *editorNode) : Node(editorNode)
|
|||||||
void GroupNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
|
void GroupNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
|
||||||
{
|
{
|
||||||
if (this->getbNode()->id == NULL) {
|
if (this->getbNode()->id == NULL) {
|
||||||
/* this is a really bad situation - bring on the pink! - so artists know this is bad */
|
convertToOperations_invalid(graph, context);
|
||||||
const float warning_color[4] = {1.0f, 0.0f, 1.0f, 1.0f};
|
|
||||||
int index;
|
|
||||||
vector<OutputSocket *> &outputsockets = this->getOutputSockets();
|
|
||||||
for (index = 0; index < outputsockets.size(); index++) {
|
|
||||||
SetColorOperation *operation = new SetColorOperation();
|
|
||||||
this->getOutputSocket(index)->relinkConnections(operation->getOutputSocket());
|
|
||||||
operation->setChannels(warning_color);
|
|
||||||
graph->addOperation(operation);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -72,12 +72,16 @@ void ImageNode::convertToOperations(ExecutionSystem *graph, CompositorContext *c
|
|||||||
|
|
||||||
/* force a load, we assume iuser index will be set OK anyway */
|
/* force a load, we assume iuser index will be set OK anyway */
|
||||||
if (image && image->type == IMA_TYPE_MULTILAYER) {
|
if (image && image->type == IMA_TYPE_MULTILAYER) {
|
||||||
|
bool is_multilayer_ok = false;
|
||||||
BKE_image_get_ibuf(image, imageuser);
|
BKE_image_get_ibuf(image, imageuser);
|
||||||
if (image->rr) {
|
if (image->rr) {
|
||||||
RenderLayer *rl = (RenderLayer *)BLI_findlink(&image->rr->layers, imageuser->layer);
|
RenderLayer *rl = (RenderLayer *)BLI_findlink(&image->rr->layers, imageuser->layer);
|
||||||
if (rl) {
|
if (rl) {
|
||||||
OutputSocket *socket;
|
OutputSocket *socket;
|
||||||
int index;
|
int index;
|
||||||
|
|
||||||
|
is_multilayer_ok = true;
|
||||||
|
|
||||||
for (index = 0; index < numberOfOutputs; index++) {
|
for (index = 0; index < numberOfOutputs; index++) {
|
||||||
socket = this->getOutputSocket(index);
|
socket = this->getOutputSocket(index);
|
||||||
if (socket->isConnected() || index == 0) {
|
if (socket->isConnected() || index == 0) {
|
||||||
@@ -114,6 +118,11 @@ void ImageNode::convertToOperations(ExecutionSystem *graph, CompositorContext *c
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* without this, multilayer that fail to load will crash blender [#32490] */
|
||||||
|
if (is_multilayer_ok == false) {
|
||||||
|
convertToOperations_invalid(graph, context);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (numberOfOutputs > 0) {
|
if (numberOfOutputs > 0) {
|
||||||
|
@@ -31,6 +31,9 @@
|
|||||||
*/
|
*/
|
||||||
class CompositorOperation : public NodeOperation {
|
class CompositorOperation : public NodeOperation {
|
||||||
private:
|
private:
|
||||||
|
/**
|
||||||
|
* @brief Scene name, used for getting the render output, includes 'SC' prefix.
|
||||||
|
*/
|
||||||
char m_sceneName[MAX_ID_NAME];
|
char m_sceneName[MAX_ID_NAME];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user