[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [26797] trunk/blender/source/blender: BGE: rna update for Logic Bricks

Dalai Felinto dfelinto at gmail.com
Thu Feb 11 07:00:17 CET 2010


Revision: 26797
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=26797
Author:   dfelinto
Date:     2010-02-11 07:00:16 +0100 (Thu, 11 Feb 2010)

Log Message:
-----------
BGE: rna update for Logic Bricks

New Actuators done:
* EDIT_OBJECT
* SHAPE_ACTION

Actuators to be done:
* CONSTRAINT

Actuators done already:
* ALL THE OTHERS 16

+ some DNA padding

There is one Actuator left. This one is tricky because (as many others) the tooltip changes according to the actuator type value. Not sure how to solve this yet. I'll probably have to make different rna properties for the same values (it includes some enums this time). Not so animated to finish this one :/

Modified Paths:
--------------
    trunk/blender/source/blender/makesdna/DNA_actuator_types.h
    trunk/blender/source/blender/makesrna/intern/rna_actuator.c

Modified: trunk/blender/source/blender/makesdna/DNA_actuator_types.h
===================================================================
--- trunk/blender/source/blender/makesdna/DNA_actuator_types.h	2010-02-11 04:24:58 UTC (rev 26796)
+++ trunk/blender/source/blender/makesdna/DNA_actuator_types.h	2010-02-11 06:00:16 UTC (rev 26797)
@@ -50,7 +50,7 @@
 
 typedef struct bActionActuator {								
 	struct bAction *act;	/* Pointer to action */				
-	short	type, flag;		/* Playback type */					
+	short	type, flag;		/* Playback type */  // not in use
 	int	sta, end;		/* Start & End frames */			
 	char	name[32];		/* For property-driven playback */	
 	char	frameProp[32];	/* Set this property to the actions current frame */
@@ -58,7 +58,7 @@
 	short	priority;		/* Execution priority */
 	short	end_reset;	/* Ending the actuator (negative pulse) wont reset the the action to its starting frame */
 	short	strideaxis;		/* Displacement axis */
-	float	stridelength;	/* Displacement incurred by cycle */
+	float	stridelength;	/* Displacement incurred by cycle */ // not in use
 } bActionActuator;												
 
 typedef struct bSoundActuator {
@@ -158,31 +158,12 @@
 } bRandomActuator;
 
 typedef struct bMessageActuator {
-	/**
-	 * Send to all objects with this propertyname. Empty to broadcast.
-	 */
-	char toPropName[32];
-
-	/**
-	 * (Possible future use) pointer to a single destination object.
-	 */
-	struct Object *toObject;
-
-	/**
-	 * Message Subject to send.
-	 */
-	char subject[32];
-
-	/**
-	 * bodyType is either 'User defined text' or PropName
-	 */
-	short bodyType, pad1;
+	char toPropName[32];	/* Send to all objects with this propertyname. Empty to broadcast. */
+	struct Object *toObject;/* (Possible future use) pointer to a single destination object. */
+	char subject[32];		/* Message Subject to send. */
+	short bodyType, pad1;	/* bodyType is either 'User defined text' or PropName */
 	int pad2;
-
-	/**
-	 * Either User Defined Text or our PropName to send value of
-	 */
-	char body[32];
+	char body[32];			/* Either User Defined Text or our PropName to send value of */
 } bMessageActuator;
 
 typedef struct bGameActuator {
@@ -408,7 +389,6 @@
 #define ACT_EDOB_LOCAL_LINV		2
 #define ACT_EDOB_LOCAL_ANGV		4
 
-
 /* editObjectActuator->flag */
 #define ACT_TRACK_3D			1
 
@@ -416,6 +396,14 @@
 #define ACT_EDOB_REPLACE_MESH_NOGFX		2 /* use for replace mesh actuator */
 #define ACT_EDOB_REPLACE_MESH_PHYS		4
 
+/* editObjectActuator->dyn_operation */
+#define ACT_EDOB_RESTORE_DYN	0
+#define ACT_EDOB_SUSPEND_DYN	1
+#define ACT_EDOB_ENABLE_RB		2
+#define ACT_EDOB_DISABLE_RB		3
+#define ACT_EDOB_SET_MASS		4
+
+
 /* SceneActuator->type */
 #define ACT_SCENE_RESTART		0
 #define ACT_SCENE_SET			1

Modified: trunk/blender/source/blender/makesrna/intern/rna_actuator.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_actuator.c	2010-02-11 04:24:58 UTC (rev 26796)
+++ trunk/blender/source/blender/makesrna/intern/rna_actuator.c	2010-02-11 06:00:16 UTC (rev 26797)
@@ -61,8 +61,6 @@
 			return &RNA_RandomActuator;
 		case ACT_MESSAGE:
 			return &RNA_MessageActuator;
-//		case ACT_ACTION:
-//			return &RNA_ActionActuator;
 		case ACT_GAME:
 			return &RNA_GameActuator;
 		case ACT_VISIBILITY:
@@ -546,6 +544,14 @@
 	StructRNA *srna;
 	PropertyRNA *prop;
 
+	static EnumPropertyItem prop_type_items[] ={
+		{ACT_CONST_TYPE_LOC, "LOC", 0, "Location Constraint", ""},
+		{ACT_CONST_TYPE_DIST, "DIST", 0, "Distance Constraint", ""},
+		{ACT_CONST_TYPE_ORI, "ORI", 0, "Orientation Constraint", ""},
+		{ACT_CONST_TYPE_FH, "FH", 0, "Force Field Constraint", ""},
+		{0, NULL, 0, NULL, NULL}
+	};
+
 	srna= RNA_def_struct(brna, "ConstraintActuator", "Actuator");
 	RNA_def_struct_ui_text(srna, "Constraint Actuator", "Actuator to ..");
 	RNA_def_struct_sdna_from(srna, "bConstraintActuator", "data");
@@ -559,18 +565,108 @@
 	PropertyRNA *prop;
 
 	static EnumPropertyItem prop_type_items[] ={
-		{ACT_CONST_TYPE_LOC, "LOC", 0, "Location Constraint", ""},
-		{ACT_CONST_TYPE_DIST, "DIST", 0, "Distance Constraint", ""},
-		{ACT_CONST_TYPE_ORI, "ORI", 0, "Orientation Constraint", ""},
-		{ACT_CONST_TYPE_FH, "FH", 0, "Force Field Constraint", ""},
-		{0, NULL, 0, NULL, NULL}
-	};
+		{ACT_EDOB_ADD_OBJECT, "ADDOBJECT", 0, "Add Object", ""},
+		{ACT_EDOB_END_OBJECT, "ENDOBJECT", 0, "End Object", ""},
+		{ACT_EDOB_REPLACE_MESH, "REPLACEMESH", 0, "Replace Mesh", ""},
+		{ACT_EDOB_TRACK_TO, "TRACKTO", 0, "Track to", ""},
+		{ACT_EDOB_DYNAMICS, "DYNAMICS", 0, "Dynamics", ""},
+		{0, NULL, 0, NULL, NULL} };
 
+	static EnumPropertyItem prop_dyn_items[] ={
+		{ACT_EDOB_RESTORE_DYN, "RESTOREDYN", 0, "Restore Dynamics", ""},
+		{ACT_EDOB_SUSPEND_DYN, "SUSPENDDYN", 0, "Suspend Dynamics", ""},
+		{ACT_EDOB_ENABLE_RB, "ENABLERIGIDBOBY", 0, "Enable Rigid Body", ""},
+		{ACT_EDOB_DISABLE_RB, "DISABLERIGIDBOBY", 0, "Disable Rigid Body", ""},
+		{ACT_EDOB_SET_MASS, "SETMASS", 0, "Set Mass", ""},
+		{0, NULL, 0, NULL, NULL} };
+
 	srna= RNA_def_struct(brna, "EditObjectActuator", "Actuator");
-	RNA_def_struct_ui_text(srna, "Edit Object Actuator", "Actuator to handle real-time constraints");
+	RNA_def_struct_ui_text(srna, "Edit Object Actuator", "Actuator used to edit objects");
 	RNA_def_struct_sdna_from(srna, "bEditObjectActuator", "data");
 
-	//XXX
+	prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
+	RNA_def_property_enum_sdna(prop, NULL, "type");
+	RNA_def_property_enum_items(prop, prop_type_items);
+	RNA_def_property_ui_text(prop, "Edit Object", "The mode of the actuator");
+	RNA_def_property_update(prop, NC_LOGIC, NULL);
+
+	prop= RNA_def_property(srna, "dynamic_operation", PROP_ENUM, PROP_NONE);
+	RNA_def_property_enum_sdna(prop, NULL, "dyn_operation");
+	RNA_def_property_enum_items(prop, prop_dyn_items);
+	RNA_def_property_ui_text(prop, "Dynamic Operation", "");
+	RNA_def_property_update(prop, NC_LOGIC, NULL);
+
+	prop= RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
+	RNA_def_property_struct_type(prop, "Object");
+	RNA_def_property_pointer_sdna(prop, NULL, "ob");
+	RNA_def_property_flag(prop, PROP_EDITABLE);
+	RNA_def_property_ui_text(prop, "Object", "Add this Object and all its children (cant be on an visible layer)");
+	RNA_def_property_update(prop, NC_LOGIC, NULL);
+
+	prop= RNA_def_property(srna, "track_object", PROP_POINTER, PROP_NONE);
+	RNA_def_property_struct_type(prop, "Object");
+	RNA_def_property_pointer_sdna(prop, NULL, "ob");
+	RNA_def_property_flag(prop, PROP_EDITABLE);
+	RNA_def_property_ui_text(prop, "Object", "Track to this Object");
+	RNA_def_property_update(prop, NC_LOGIC, NULL);
+	
+	prop= RNA_def_property(srna, "mesh", PROP_POINTER, PROP_NONE);
+	RNA_def_property_struct_type(prop, "Mesh");
+	RNA_def_property_pointer_sdna(prop, NULL, "me");
+	RNA_def_property_flag(prop, PROP_EDITABLE);
+	RNA_def_property_ui_text(prop, "Mesh", "Replace the existing, when left blank 'Phys' will remake the existing physics mesh");
+	RNA_def_property_update(prop, NC_LOGIC, NULL);
+
+	prop= RNA_def_property(srna, "time", PROP_INT, PROP_NONE);
+	RNA_def_property_ui_range(prop, 0, 2000, 1, 1);
+	RNA_def_property_ui_text(prop, "Time", "Duration the new Object lives or the track takes");
+	RNA_def_property_update(prop, NC_LOGIC, NULL);
+
+	prop= RNA_def_property(srna, "mass", PROP_FLOAT, PROP_NONE);
+	RNA_def_property_ui_range(prop, 0, 10000, 1, 0.01);
+	RNA_def_property_ui_text(prop, "Mass", "The mass of the object");
+	RNA_def_property_update(prop, NC_LOGIC, NULL);
+
+	/* floats 3 Arrays*/
+	prop= RNA_def_property(srna, "linear_velocity", PROP_FLOAT, PROP_TRANSLATION);
+	RNA_def_property_float_sdna(prop, NULL, "linVelocity");
+	RNA_def_property_array(prop, 3);
+	RNA_def_property_ui_range(prop, -100.0, 100.0, 0.1, 0.01);
+	RNA_def_property_ui_text(prop, "Linear Velocity", "Velocity upon creation");
+	RNA_def_property_update(prop, NC_LOGIC, NULL);
+
+	prop= RNA_def_property(srna, "angular_velocity", PROP_FLOAT, PROP_TRANSLATION);
+	RNA_def_property_float_sdna(prop, NULL, "angVelocity");
+	RNA_def_property_array(prop, 3);
+	RNA_def_property_ui_range(prop, -10000.0, 10000.0, 1.0, 0.01);
+	RNA_def_property_ui_text(prop, "Angular Velocity", "Angular velocity upon creation");
+	RNA_def_property_update(prop, NC_LOGIC, NULL);
+
+	/* booleans */
+	prop= RNA_def_property(srna, "local_linear_velocity", PROP_BOOLEAN, PROP_NONE);
+	RNA_def_property_boolean_sdna(prop, NULL, "localflag", ACT_EDOB_LOCAL_LINV);
+	RNA_def_property_ui_text(prop, "L", "Apply the transformation locally");
+	RNA_def_property_update(prop, NC_LOGIC, NULL);
+
+	prop= RNA_def_property(srna, "local_angular_velocity", PROP_BOOLEAN, PROP_NONE);
+	RNA_def_property_boolean_sdna(prop, NULL, "localflag", ACT_EDOB_LOCAL_ANGV);
+	RNA_def_property_ui_text(prop, "L", "Apply the rotation locally");
+	RNA_def_property_update(prop, NC_LOGIC, NULL);
+
+	prop= RNA_def_property(srna, "replace_display_mesh", PROP_BOOLEAN, PROP_NONE);
+	RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_EDOB_REPLACE_MESH_NOGFX);
+	RNA_def_property_ui_text(prop, "Gfx", "Replace the display mesh");
+	RNA_def_property_update(prop, NC_LOGIC, NULL);
+
+	prop= RNA_def_property(srna, "replace_physics_mesh", PROP_BOOLEAN, PROP_NONE);
+	RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_EDOB_REPLACE_MESH_PHYS);
+	RNA_def_property_ui_text(prop, "Phys", "Replace the physics mesh (triangle bounds only - compound shapes not supported)");
+	RNA_def_property_update(prop, NC_LOGIC, NULL);
+
+	prop= RNA_def_property(srna, "enable_3d_tracking", PROP_BOOLEAN, PROP_NONE);
+	RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_TRACK_3D);
+	RNA_def_property_ui_text(prop, "3D", "Enable 3D tracking");
+	RNA_def_property_update(prop, NC_LOGIC, NULL);
 }
 
 static void rna_def_scene_actuator(BlenderRNA *brna)
@@ -846,7 +942,7 @@
 
 	prop= RNA_def_property(srna, "children", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_VISIBILITY_RECURSIVE);
-	RNA_def_property_ui_text(prop, "Children", "Sets all the children of this object to the same visibility/occlusion recursively");
+	RNA_def_property_ui_text(prop, "Children", "Set all the children of this object to the same visibility/occlusion recursively");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 }
 
@@ -953,12 +1049,79 @@
 static void rna_def_shape_action_actuator(BlenderRNA *brna)
 {
 	StructRNA *srna;
+	PropertyRNA *prop;
 

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list