diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-07-26 17:29:38 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-07-26 17:29:38 +0400 |
commit | 733edf86284d83dd0a70da59228b0c0d39c8cbfa (patch) | |
tree | d4f6bba86fc3d9d03f26edc08627d5c844f96ab3 /source/blender/compositor | |
parent | 2b8fdedaf3e67115aef18bce9be3c2a35399e0f7 (diff) |
option to use manual size input for scene
Diffstat (limited to 'source/blender/compositor')
-rw-r--r-- | source/blender/compositor/nodes/COM_MaskNode.cpp | 15 | ||||
-rw-r--r-- | source/blender/compositor/operations/COM_MaskOperation.cpp | 9 | ||||
-rw-r--r-- | source/blender/compositor/operations/COM_MaskOperation.h | 22 |
3 files changed, 35 insertions, 11 deletions
diff --git a/source/blender/compositor/nodes/COM_MaskNode.cpp b/source/blender/compositor/nodes/COM_MaskNode.cpp index b6300300f6f..2620f84cfae 100644 --- a/source/blender/compositor/nodes/COM_MaskNode.cpp +++ b/source/blender/compositor/nodes/COM_MaskNode.cpp @@ -46,8 +46,19 @@ void MaskNode::convertToOperations(ExecutionSystem *graph, CompositorContext *co // always connect the output image MaskOperation *operation = new MaskOperation(); operation->setbNode(editorNode); - operation->setMaskWidth(data->xsch * data->size / 100.0f); - operation->setMaskHeight(data->ysch * data->size / 100.0f); + + if (editorNode->custom1 & CMP_NODEFLAG_MASK_FIXED) { + operation->setMaskWidth(editorNode->custom3); + operation->setMaskHeight(editorNode->custom4); + } + else if (editorNode->custom1 & CMP_NODEFLAG_MASK_FIXED_SCENE) { + operation->setMaskWidth(editorNode->custom3 * (data->size / 100.0f)); + operation->setMaskHeight(editorNode->custom4 * (data->size / 100.0f)); + } + else { + operation->setMaskWidth(data->xsch * data->size / 100.0f); + operation->setMaskHeight(data->ysch * data->size / 100.0f); + } if (outputMask->isConnected()) { outputMask->relinkConnections(operation->getOutputSocket()); diff --git a/source/blender/compositor/operations/COM_MaskOperation.cpp b/source/blender/compositor/operations/COM_MaskOperation.cpp index c648f3e6f08..5e68142bda3 100644 --- a/source/blender/compositor/operations/COM_MaskOperation.cpp +++ b/source/blender/compositor/operations/COM_MaskOperation.cpp @@ -145,12 +145,11 @@ void MaskOperation::initExecution() { if (this->m_mask) { if (this->m_rasterMaskHandle == NULL) { - const int width = this->getWidth(); - const int height = this->getHeight(); - this->m_rasterMaskHandle = BKE_maskrasterize_handle_new(); - BKE_maskrasterize_handle_init(this->m_rasterMaskHandle, this->m_mask, width, height, TRUE, this->m_do_smooth, this->m_do_feather); + BKE_maskrasterize_handle_init(this->m_rasterMaskHandle, this->m_mask, + this->m_maskWidth, this->m_maskHeight, + TRUE, this->m_do_smooth, this->m_do_feather); } } } @@ -183,8 +182,8 @@ void MaskOperation::determineResolution(unsigned int resolution[], unsigned int void MaskOperation::executePixel(float *color, float x, float y, PixelSampler sampler) { - const float xy[2] = {x / (float)this->m_maskWidth, y / (float)this->m_maskHeight}; if (this->m_rasterMaskHandle) { + const float xy[2] = {x * this->m_maskWidthInv, y * this->m_maskHeightInv}; color[0] = BKE_maskrasterize_handle_sample(this->m_rasterMaskHandle, xy); } else { diff --git a/source/blender/compositor/operations/COM_MaskOperation.h b/source/blender/compositor/operations/COM_MaskOperation.h index f367298b3d6..59c84bdbb7b 100644 --- a/source/blender/compositor/operations/COM_MaskOperation.h +++ b/source/blender/compositor/operations/COM_MaskOperation.h @@ -46,8 +46,14 @@ extern "C" { class MaskOperation : public NodeOperation { protected: Mask *m_mask; - int m_maskWidth; - int m_maskHeight; + + /* note, these are used more like aspect, + * but they _do_ impact on mask detail */ + int m_maskWidth; + int m_maskHeight; + float m_maskWidthInv; /* 1 / m_maskWidth */ + float m_maskHeightInv; /* 1 / m_maskHeight */ + int m_framenumber; bool m_do_smooth; bool m_do_feather; @@ -74,8 +80,16 @@ public: void setMask(Mask *mask) { this->m_mask = mask; } - void setMaskWidth(int width) { this->m_maskWidth = width; } - void setMaskHeight(int height) { this->m_maskHeight = height; } + void setMaskWidth(int width) + { + this->m_maskWidth = width; + this->m_maskWidthInv = 1.0f / (float)width; + } + void setMaskHeight(int height) + { + this->m_maskHeight = height; + this->m_maskHeightInv = 1.0f / (float)height; + } void setFramenumber(int framenumber) { this->m_framenumber = framenumber; } void setSmooth(bool smooth) { this->m_do_smooth = smooth; } void setFeather(bool feather) { this->m_do_feather = feather; } |