← Back to team overview

openshot.code team mailing list archive

[Branch ~openshot.code/openshot/main] Rev 554: Fixed a bug with all colors being passed into Blender animations. The colors were always a bit "...

 

------------------------------------------------------------
revno: 554
committer: Jonathan Thomas <Jonathan.Oomph@xxxxxxxxx>
branch nick: openshot
timestamp: Sun 2011-09-04 20:48:33 -0500
message:
  Fixed a bug with all colors being passed into Blender animations.  The colors were always a bit "off", and I figured out they need to be gamma corrected before passing them to Blender.  The colors look much better now.
modified:
  openshot/windows/BlenderGenerator.py


--
lp:openshot
https://code.launchpad.net/~openshot.code/openshot/main

Your team OpenShot Code is subscribed to branch lp:openshot.
To unsubscribe from this branch go to https://code.launchpad.net/~openshot.code/openshot/main/+edit-subscription
=== modified file 'openshot/windows/BlenderGenerator.py'
--- openshot/windows/BlenderGenerator.py	2011-08-31 21:11:19 +0000
+++ openshot/windows/BlenderGenerator.py	2011-09-05 01:48:33 +0000
@@ -19,6 +19,7 @@
 import os, time, uuid, shutil
 import gobject, threading, subprocess, re
 import gtk
+import math
 import subprocess
 from windows.SimpleGtkBuilderApp import SimpleGtkBuilderApp
 from windows import preferences, TreeBlender
@@ -283,9 +284,13 @@
 					colorButton.set_color(default_color)	
 					color = colorButton.get_color()
 					
+					# adjust gamma values for Blender
+					r = math.pow(color.red_float, 2.2)
+					g = math.pow(color.green_float, 2.2)
+					b = math.pow(color.blue_float, 2.2)
+					
 					# add value to dictionary
-					#self.params[param.name] = [color.red/255, color.green/255, color.blue/255]
-					self.params[param.name] = [color.red_float, color.green_float, color.blue_float]
+					self.params[param.name] = [r, g, b]
 
 					# connect signal
 					colorButton.connect("color-set", self.effect_color_changed, real_effect, param)
@@ -348,9 +353,13 @@
 		# Get color from color picker
 		color = widget.get_color()
 		
-		# Update the param of the selected effect
-		#self.params[param.name] = [color.red/255, color.green/255, color.blue/255]
-		self.params[param.name] = [color.red_float, color.green_float, color.blue_float]
+		# adjust gamma values for Blender
+		r = math.pow(color.red_float, 2.2)
+		g = math.pow(color.green_float, 2.2)
+		b = math.pow(color.blue_float, 2.2)
+		
+		# add value to dictionary
+		self.params[param.name] = [r, g, b]
 		
 		
 	def html_color(self, color):