[Bf-codereview] Separate Combine YCbCr nodes + fix for YUV (issue 5532062)

dfelinto at gmail.com dfelinto at gmail.com
Tue Jan 10 19:21:57 CET 2012


Reviewers: bf-codereview_blender.org,

Description:
YUV was missing in COM_Converter.cpp

Sep/Comb YCC could even inherit each other (given the setMode function
is the same). But I think it's fine to duplicate that. Thoughts?

Also, I'm not using m_privateprops C++ like naming. As we are not doing
this in the other nodes.

Please review this at http://codereview.appspot.com/5532062/

Affected files:
   source/blender/blenloader/intern/readfile.c
   source/blender/makesdna/DNA_actuator_types.h
   source/blender/makesrna/intern/rna_actuator.c
   source/gameengine/Converter/KX_ConvertActuators.cpp
   source/gameengine/Ketsji/KX_CameraActuator.cpp
   source/gameengine/Ketsji/KX_CameraActuator.h


Index: source/gameengine/Converter/KX_ConvertActuators.cpp
===================================================================
--- source/gameengine/Converter/KX_ConvertActuators.cpp	(revision 43253)
+++ source/gameengine/Converter/KX_ConvertActuators.cpp	(working copy)
@@ -300,7 +300,7 @@
  						camact->height,
  						camact->min,
  						camact->max,
-						camact->axis=='x',
+						camact->axis,
  						camact->damping);
  					baseact = tmpcamact;
  				}
Index: source/gameengine/Ketsji/KX_CameraActuator.cpp
===================================================================
--- source/gameengine/Ketsji/KX_CameraActuator.cpp	(revision 43253)
+++ source/gameengine/Ketsji/KX_CameraActuator.cpp	(working copy)
@@ -53,7 +53,7 @@
  	float hght,
  	float minhght,
  	float maxhght,
-	bool  xytog,
+	short axis,
  	float damping
  ):
  	SCA_IActuator(gameobj, KX_ACT_CAMERA),
@@ -61,7 +61,7 @@
  	m_height (hght),
  	m_minHeight (minhght),
  	m_maxHeight (maxhght),
-	m_x (xytog),
+	m_axis(axis),
  	m_damping (damping)
  {
  	if (m_ob)
@@ -264,23 +264,50 @@


  	/* C4: camera behind actor   */
-	if (m_x) {
-		fp1[0] = actormat[0][0];
-		fp1[1] = actormat[1][0];
-		fp1[2] = actormat[2][0];
+	switch (m_axis) {
+		case 0:
+			/* X */
+			fp1[0] = actormat[0][0];
+			fp1[1] = actormat[1][0];
+			fp1[2] = actormat[2][0];

-		fp2[0] = frommat[0][0];
-		fp2[1] = frommat[1][0];
-		fp2[2] = frommat[2][0];
-	}
-	else {
-		fp1[0] = actormat[0][1];
-		fp1[1] = actormat[1][1];
-		fp1[2] = actormat[2][1];
+			fp2[0] = frommat[0][0];
+			fp2[1] = frommat[1][0];
+			fp2[2] = frommat[2][0];
+			break;
+		case 1:
+			/* Y */
+			fp1[0] = actormat[0][1];
+			fp1[1] = actormat[1][1];
+			fp1[2] = actormat[2][1];

-		fp2[0] = frommat[0][1];
-		fp2[1] = frommat[1][1];
-		fp2[2] = frommat[2][1];
+			fp2[0] = frommat[0][1];
+			fp2[1] = frommat[1][1];
+			fp2[2] = frommat[2][1];
+			break;
+		case 2:
+			/* -X */
+			fp1[0] = -actormat[0][0];
+			fp1[1] = -actormat[1][0];
+			fp1[2] = -actormat[2][0];
+
+			fp2[0] = frommat[0][0];
+			fp2[1] = frommat[1][0];
+			fp2[2] = frommat[2][0];
+			break;
+		case 3:
+			/* -Y */
+			fp1[0] = -actormat[0][1];
+			fp1[1] = -actormat[1][1];
+			fp1[2] = -actormat[2][1];
+
+			fp2[0] = frommat[0][1];
+			fp2[1] = frommat[1][1];
+			fp2[2] = frommat[2][1];
+			break;
+		default:
+			assert(0);
+			break;
  	}
  	
  	inp= fp1[0]*fp2[0] + fp1[1]*fp2[1] + fp1[2]*fp2[2];
@@ -389,7 +416,7 @@
  	 
KX_PYATTRIBUTE_FLOAT_RW("min",-FLT_MAX,FLT_MAX,KX_CameraActuator,m_minHeight),
  	 
KX_PYATTRIBUTE_FLOAT_RW("max",-FLT_MAX,FLT_MAX,KX_CameraActuator,m_maxHeight),
  	 
KX_PYATTRIBUTE_FLOAT_RW("height",-FLT_MAX,FLT_MAX,KX_CameraActuator,m_height),
-	KX_PYATTRIBUTE_BOOL_RW("useXY",KX_CameraActuator,m_x),
+	KX_PYATTRIBUTE_SHORT_RW("axis", 0, 3, true, KX_CameraActuator,m_axis),
  	KX_PYATTRIBUTE_RW_FUNCTION("object", KX_CameraActuator,  
pyattr_get_object,	pyattr_set_object),
  	KX_PYATTRIBUTE_FLOAT_RW("damping",0.f,10.f,KX_CameraActuator,m_damping),
  	{NULL}
Index: source/gameengine/Ketsji/KX_CameraActuator.h
===================================================================
--- source/gameengine/Ketsji/KX_CameraActuator.h	(revision 43253)
+++ source/gameengine/Ketsji/KX_CameraActuator.h	(working copy)
@@ -70,8 +70,8 @@
  	/** max (float), */
  	float m_maxHeight;
  	
-	/** xy toggle (pick one): true == x, false == y */
-	bool m_x;
+	/** axis the camera tries to get behind: x/y/-x/-y */
+	short m_axis;
  	
  	/** damping (float), */
  	float m_damping;
@@ -97,7 +97,7 @@
  		float hght,
  		float minhght,
  		float maxhght,
-		bool xytog,
+		short axis,
  		float damping
  	);

Index: source/blender/makesdna/DNA_actuator_types.h
===================================================================
--- source/blender/makesdna/DNA_actuator_types.h	(revision 43253)
+++ source/blender/makesdna/DNA_actuator_types.h	(working copy)
@@ -521,8 +521,10 @@
  #define ACT_STATE_CHANGE	3

  /* cameraactuator->axis */
-#define ACT_CAMERA_X		(float)'x'
-#define ACT_CAMERA_Y		(float)'y'
+#define ACT_CAMERA_X		0
+#define ACT_CAMERA_Y		1
+#define ACT_CAMERA_NEG_X	2
+#define ACT_CAMERA_NEG_Y	3

  /* steeringactuator->type */
  #define ACT_STEERING_SEEK   0
Index: source/blender/makesrna/intern/rna_actuator.c
===================================================================
--- source/blender/makesrna/intern/rna_actuator.c	(revision 43253)
+++ source/blender/makesrna/intern/rna_actuator.c	(working copy)
@@ -869,6 +869,8 @@
  	static EnumPropertyItem prop_axis_items[] ={
  		{ACT_CAMERA_X, "X", 0, "X", "Camera tries to get behind the X axis"},
  		{ACT_CAMERA_Y, "Y", 0, "Y", "Camera tries to get behind the Y axis"},
+		{ACT_CAMERA_NEG_X, "NEG_X", 0, "-X", "Camera tries to get behind the -X  
axis"},
+		{ACT_CAMERA_NEG_Y, "NEG_Y", 0, "-Y", "Camera tries to get behind the -Y  
axis"},
  		{0, NULL, 0, NULL, NULL}};
  	
  	srna= RNA_def_struct(brna, "CameraActuator", "Actuator");
@@ -905,7 +907,7 @@
  	RNA_def_property_ui_text(prop, "Damping", "Strength of the constraint  
that drives the camera behind the target");
  	RNA_def_property_update(prop, NC_LOGIC, NULL);

-	/* x/y */
+	/* x/y/-x/-y */
  	prop= RNA_def_property(srna, "axis", PROP_ENUM, PROP_NONE);
  	RNA_def_property_enum_sdna(prop, NULL, "axis");
  	RNA_def_property_enum_items(prop, prop_axis_items);
Index: source/blender/blenloader/intern/readfile.c
===================================================================
--- source/blender/blenloader/intern/readfile.c	(revision 43253)
+++ source/blender/blenloader/intern/readfile.c	(working copy)
@@ -12941,7 +12941,23 @@

  	/* put compatibility code here until next subversion bump */
  	{
-		
+		{
+			/* convert Camera Actuator values to defines */
+			Object *ob;
+			bActuator *act;
+			for(ob = main->object.first; ob; ob= ob->id.next) {
+				for(act= ob->actuators.first; act; act= act->next) {
+					if (act->type == ACT_CAMERA) {
+						bCameraActuator *ba= act->data;
+
+						if(ba->axis==(float) 'x') ba->axis=ACT_CAMERA_X;
+						else if (ba->axis==(float)'y') ba->axis=ACT_CAMERA_Y;
+						/* don't do an if/else to avoid imediate subversion bump*/
+//					ba->axis=((ba->axis == (float) 'x')?ACT_CAMERA_X:ACT_CAMERA_Y);
+					}
+				}
+			}
+		}
  	}

  	/* WATCH IT!!!: pointers from libdata have not been converted yet here! */




More information about the Bf-codereview mailing list