[Bf-blender-cvs] [82466852fec] blender-v2.79-release: Fix T52531: Blender 2D stabilisation node issue when autoscale is selected

Sergey Sharybin noreply at git.blender.org
Sun Sep 10 21:52:27 CEST 2017


Commit: 82466852fec5f6df6239b88e6a4b63855c94e92a
Author: Sergey Sharybin
Date:   Mon Sep 4 16:40:55 2017 +0200
Branches: blender-v2.79-release
https://developer.blender.org/rB82466852fec5f6df6239b88e6a4b63855c94e92a

Fix T52531: Blender 2D stabilisation node issue when autoscale is selected

Threading conflict, should be safe for 2.79.

===================================================================

M	source/blender/compositor/operations/COM_MovieClipAttributeOperation.cpp
M	source/blender/compositor/operations/COM_MovieClipAttributeOperation.h

===================================================================

diff --git a/source/blender/compositor/operations/COM_MovieClipAttributeOperation.cpp b/source/blender/compositor/operations/COM_MovieClipAttributeOperation.cpp
index 41f7da7c49f..0c2da8415f8 100644
--- a/source/blender/compositor/operations/COM_MovieClipAttributeOperation.cpp
+++ b/source/blender/compositor/operations/COM_MovieClipAttributeOperation.cpp
@@ -28,55 +28,58 @@ extern "C" {
 MovieClipAttributeOperation::MovieClipAttributeOperation() : NodeOperation()
 {
 	this->addOutputSocket(COM_DT_VALUE);
-	this->m_valueSet = false;
 	this->m_framenumber = 0;
 	this->m_attribute = MCA_X;
 	this->m_invert = false;
 }
 
-void MovieClipAttributeOperation::executePixelSampled(float output[4],
-                                                      float /*x*/, float /*y*/,
-                                                      PixelSampler /*sampler*/)
+void MovieClipAttributeOperation::initExecution()
 {
-	/* TODO(sergey): This code isn't really thread-safe. */
-	if (!this->m_valueSet) {
-		float loc[2], scale, angle;
-		loc[0] = 0.0f;
-		loc[1] = 0.0f;
-		scale = 1.0f;
-		angle = 0.0f;
-		if (this->m_clip) {
-			int clip_framenr = BKE_movieclip_remap_scene_to_clip_frame(this->m_clip, this->m_framenumber);
-			BKE_tracking_stabilization_data_get(this->m_clip, clip_framenr, getWidth(), getHeight(), loc, &scale, &angle);
-		}
-		switch (this->m_attribute) {
-			case MCA_SCALE:
-				this->m_value = scale;
-				break;
-			case MCA_ANGLE:
-				this->m_value = angle;
-				break;
-			case MCA_X:
-				this->m_value = loc[0];
-				break;
-			case MCA_Y:
-				this->m_value = loc[1];
-				break;
+	float loc[2], scale, angle;
+	loc[0] = 0.0f;
+	loc[1] = 0.0f;
+	scale = 1.0f;
+	angle = 0.0f;
+	int clip_framenr = BKE_movieclip_remap_scene_to_clip_frame(
+	        this->m_clip, this->m_framenumber);
+	BKE_tracking_stabilization_data_get(this->m_clip,
+	                                    clip_framenr,
+	                                    getWidth(), getHeight(),
+	                                    loc, &scale, &angle);
+	switch (this->m_attribute) {
+		case MCA_SCALE:
+			this->m_value = scale;
+			break;
+		case MCA_ANGLE:
+			this->m_value = angle;
+			break;
+		case MCA_X:
+			this->m_value = loc[0];
+			break;
+		case MCA_Y:
+			this->m_value = loc[1];
+			break;
+	}
+	if (this->m_invert) {
+		if (this->m_attribute != MCA_SCALE) {
+			this->m_value = -this->m_value;
 		}
-		if (this->m_invert) {
-			if (this->m_attribute != MCA_SCALE) {
-				this->m_value = -this->m_value;
-			}
-			else {
-				this->m_value = 1.0f / this->m_value;
-			}
+		else {
+			this->m_value = 1.0f / this->m_value;
 		}
-		this->m_valueSet = true;
 	}
+}
+
+void MovieClipAttributeOperation::executePixelSampled(float output[4],
+                                                      float /*x*/, float /*y*/,
+                                                      PixelSampler /*sampler*/)
+{
 	output[0] = this->m_value;
 }
 
-void MovieClipAttributeOperation::determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2])
+void MovieClipAttributeOperation::determineResolution(
+        unsigned int resolution[2],
+        unsigned int preferredResolution[2])
 {
 	resolution[0] = preferredResolution[0];
 	resolution[1] = preferredResolution[1];
diff --git a/source/blender/compositor/operations/COM_MovieClipAttributeOperation.h b/source/blender/compositor/operations/COM_MovieClipAttributeOperation.h
index 731b9debaf0..659f54c1ca2 100644
--- a/source/blender/compositor/operations/COM_MovieClipAttributeOperation.h
+++ b/source/blender/compositor/operations/COM_MovieClipAttributeOperation.h
@@ -39,16 +39,18 @@ class MovieClipAttributeOperation : public NodeOperation {
 private:
 	MovieClip *m_clip;
 	float m_value;
-	bool m_valueSet;
 	int m_framenumber;
 	bool m_invert;
 	MovieClipAttribute m_attribute;
+
 public:
 	/**
 	 * Default constructor
 	 */
 	MovieClipAttributeOperation();
-	
+
+	void initExecution();
+
 	/**
 	 * the inner loop of this program
 	 */



More information about the Bf-blender-cvs mailing list