[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [34576] trunk/blender/source/blender: Logic UI: Servo Control (Motion/ObjectActuator) default options + camera actuator tweak

Dalai Felinto dfelinto at gmail.com
Mon Jan 31 08:52:46 CET 2011


Revision: 34576
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=34576
Author:   dfelinto
Date:     2011-01-31 07:52:45 +0000 (Mon, 31 Jan 2011)
Log Message:
-----------
Logic UI: Servo Control (Motion/ObjectActuator) default options + camera actuator tweak
In 2.49 we had this implemented in the logic_windows.c. I think I skipped this when porting the new UI. I probably didn't know how to do it back then or was waiting for something. Anyhoo, it's all good now.

For the records, the Logic Bricks that I haven't gone over to make sure everything is 100% are:
Filter 2D, Constraints and Animation (action, shapekey, fcurve)

I'm going over them this week, so the Logic Bricks are close to receive a "revisited review check-up" ISO 9000 :)

Modified Paths:
--------------
    trunk/blender/source/blender/editors/space_logic/logic_window.c
    trunk/blender/source/blender/makesrna/intern/rna_actuator.c

Modified: trunk/blender/source/blender/editors/space_logic/logic_window.c
===================================================================
--- trunk/blender/source/blender/editors/space_logic/logic_window.c	2011-01-30 23:41:58 UTC (rev 34575)
+++ trunk/blender/source/blender/editors/space_logic/logic_window.c	2011-01-31 07:52:45 UTC (rev 34576)
@@ -3753,7 +3753,7 @@
 	uiItemR(row, ptr, "height", 0, NULL, ICON_NULL);
 	uiItemR(row, ptr, "axis", 0, NULL, ICON_NULL);
 
-	row = uiLayoutRow(layout, 0);
+	row = uiLayoutRow(layout, 1);
 	uiItemR(row, ptr, "min", 0, NULL, ICON_NULL);
 	uiItemR(row, ptr, "max", 0, NULL, ICON_NULL);
 }

Modified: trunk/blender/source/blender/makesrna/intern/rna_actuator.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_actuator.c	2011-01-30 23:41:58 UTC (rev 34575)
+++ trunk/blender/source/blender/makesrna/intern/rna_actuator.c	2011-01-31 07:52:45 UTC (rev 34576)
@@ -284,7 +284,6 @@
 
 	*fp = value;
 }
-
 /* ConstraintActuator uses the same property for Material and Property.
    Therefore we need to clear the property when "use_material_detect" mode changes */
 static void rna_Actuator_constraint_detect_material_set(struct PointerRNA *ptr, int value)
@@ -324,6 +323,33 @@
 		ia->flag &= ~ACT_IPOFORCE;
 }
 
+
+static void rna_ObjectActuator_type_set(struct PointerRNA *ptr, int value)
+{
+	bActuator *act= (bActuator *)ptr->data;
+	bObjectActuator *oa = act->data;
+	if (value != oa->type)
+	{
+		oa->type = value;
+		switch (oa->type) {
+		case ACT_OBJECT_NORMAL:
+			memset(oa, 0, sizeof(bObjectActuator));
+			oa->flag = ACT_FORCE_LOCAL|ACT_TORQUE_LOCAL|ACT_DLOC_LOCAL|ACT_DROT_LOCAL;
+			oa->type = ACT_OBJECT_NORMAL;
+			break;
+
+		case ACT_OBJECT_SERVO:
+			memset(oa, 0, sizeof(bObjectActuator));
+			oa->flag = ACT_LIN_VEL_LOCAL;
+			oa->type = ACT_OBJECT_SERVO;
+			oa->forcerot[0] = 30.0f;
+			oa->forcerot[1] = 0.5f;
+			oa->forcerot[2] = 0.0f;
+			break;
+		}
+	}
+}
+
 static void rna_ObjectActuator_integralcoefficient_set(struct PointerRNA *ptr, float value)
 {
 	bActuator *act = (bActuator*)ptr->data;
@@ -591,6 +617,7 @@
 	prop= RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "type");
 	RNA_def_property_enum_items(prop, prop_type_items);
+	RNA_def_property_enum_funcs(prop, NULL, "rna_ObjectActuator_type_set", NULL);
 	RNA_def_property_ui_text(prop, "Motion Type", "Specify the motion system");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 	




More information about the Bf-blender-cvs mailing list