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

Dalai Felinto dfelinto at gmail.com
Tue Feb 9 22:18:50 CET 2010


Revision: 26752
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=26752
Author:   dfelinto
Date:     2010-02-09 22:18:50 +0100 (Tue, 09 Feb 2010)

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

New Actuators done:
* OBJECT (aka MOTION)
* SOUND
* PROPERTY
* CONSTRAINT
* EDIT_OBJECT
* ACTION
* STATE
* ARMATURE

Actuators to be done:
* CONSTRAINT
* EDIT_OBJECT
* SHAPE_ACTION

Actuators done already:
* IPO
* CAMERA
* SCENE
* RANDOM
* MESSAGE
* GAME
* VISIBILITY
* TWODFILTER
* PARENT

once again: feedback is appreciated.
+ some typos
+ some DNA padding

Thanks for Mitchell Stokes (Moguri) for his patch on that. It saved me some time on the ENUMs and some actuator descriptions :)

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

Modified: trunk/blender/source/blender/editors/space_logic/logic_window.c
===================================================================
--- trunk/blender/source/blender/editors/space_logic/logic_window.c	2010-02-09 21:05:59 UTC (rev 26751)
+++ trunk/blender/source/blender/editors/space_logic/logic_window.c	2010-02-09 21:18:50 UTC (rev 26752)
@@ -2156,11 +2156,11 @@
 					if(sa->flag & ACT_SND_3D_SOUND)
 					{
 						uiDefButF(block, NUM, 0, "Minimum Gain: ", xco+10, yco-110, wval, 19, &sa->sound3D.min_gain, 0.0, 1.0, 0.0, 0.0, "The minimum gain of the sound, no matter how far it is away.");
-						uiDefButF(block, NUM, 0, "Maximum Gain: ", xco+10, yco-132, wval, 19, &sa->sound3D.max_gain, 0.0, 1.0, 0.0, 0.0, "The maximum gain of the sound, no matter how near it is..");
+						uiDefButF(block, NUM, 0, "Maximum Gain: ", xco+10, yco-132, wval, 19, &sa->sound3D.max_gain, 0.0, 1.0, 0.0, 0.0, "The maximum gain of the sound, no matter how near it is.");
 						uiDefButF(block, NUM, 0, "Reference Distance: ", xco+10, yco-154, wval, 19, &sa->sound3D.reference_distance, 0.0, FLT_MAX, 0.0, 0.0, "The reference distance is the distance where the sound has a gain of 1.0.");
 						uiDefButF(block, NUM, 0, "Maximum Distance: ", xco+10, yco-176, wval, 19, &sa->sound3D.max_distance, 0.0, FLT_MAX, 0.0, 0.0, "The maximum distance at which you can hear the sound.");
 						uiDefButF(block, NUM, 0, "Rolloff: ", xco+wval+10, yco-110, wval, 19, &sa->sound3D.rolloff_factor, 0.0, 5.0, 0.0, 0.0, "The rolloff factor defines the influence factor on volume depending on distance.");
-						uiDefButF(block, NUM, 0, "Cone Outer Gain: ", xco+wval+10, yco-132, wval, 19, &sa->sound3D.cone_outer_gain, 0.0, 1.0, 0.0, 0.0, "The gain outside the outer cone. The gain in the outer cone will be interpolated between this value und the normal gain in the inner cone.");
+						uiDefButF(block, NUM, 0, "Cone Outer Gain: ", xco+wval+10, yco-132, wval, 19, &sa->sound3D.cone_outer_gain, 0.0, 1.0, 0.0, 0.0, "The gain outside the outer cone. The gain in the outer cone will be interpolated between this value and the normal gain in the inner cone.");
 						uiDefButF(block, NUM, 0, "Cone Outer Angle: ", xco+wval+10, yco-154, wval, 19, &sa->sound3D.cone_outer_angle, 0.0, 360.0, 0.0, 0.0, "The angle of the outer cone.");
 						uiDefButF(block, NUM, 0, "Cone Inner Angle: ", xco+wval+10, yco-176, wval, 19, &sa->sound3D.cone_inner_angle, 0.0, 360.0, 0.0, 0.0, "The angle of the inner cone.");
 					}
@@ -2882,7 +2882,7 @@
 				but = uiDefBut(block, TEX, 1, "Cons: ",
 						(xco+5)+(width-10)/2, (yco-44), (width-10)/2, 19,
 						armAct->constraint, 0, 31, 0, 0,
-						"Name of the constraint you want to controle");
+						"Name of the constraint you want to control");
 				uiButSetFunc(but, check_armature_actuator, but, armAct);
 				uiBlockEndAlign(block);
 				ysize = 48;

Modified: trunk/blender/source/blender/makesdna/DNA_actuator_types.h
===================================================================
--- trunk/blender/source/blender/makesdna/DNA_actuator_types.h	2010-02-09 21:05:59 UTC (rev 26751)
+++ trunk/blender/source/blender/makesdna/DNA_actuator_types.h	2010-02-09 21:18:50 UTC (rev 26752)
@@ -63,13 +63,13 @@
 
 typedef struct bSoundActuator {
 	short flag, sndnr;
-	int sta, end;
-	short pad1[2];
+	int pad1, pad2;
+	short pad3[2];
 	float volume, pitch;
 	struct bSound *sound;
 	struct Sound3D sound3D;
-	short type, makecopy;
-	short copymade, pad2[1];
+	short type, pad4;
+	short pad5, pad6[1];
 } bSoundActuator;
 
 typedef struct bEditObjectActuator {
@@ -93,16 +93,16 @@
 } bSceneActuator;
 
 typedef struct bPropertyActuator {
-	int flag, type;
+	int pad, type;
 	char name[32], value[32];
-	struct Object *ob;
+	struct Object *ob; // not in use anymore
 } bPropertyActuator;
 
 typedef struct bObjectActuator {
 	short flag, type, otype;
 	short damping;
 	float forceloc[3], forcerot[3];
-	float loc[3], rot[3];
+	float pad[3], pad1[3];
 	float dloc[3], drot[3];
 	float linearvelocity[3], angularvelocity[3];
 	struct Object *reference;
@@ -503,6 +503,12 @@
 /* update this define if more type are addedd */
 #define ACT_ARM_MAXTYPE		4
 
+/* stateactuator->type */
+#define ACT_STATE_SET		0
+#define ACT_STATE_ADD		1
+#define ACT_STATE_REMOVE	2
+#define ACT_STATE_CHANGE	3
+
 #endif
 
 

Modified: trunk/blender/source/blender/makesrna/intern/rna_actuator.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_actuator.c	2010-02-09 21:05:59 UTC (rev 26751)
+++ trunk/blender/source/blender/makesrna/intern/rna_actuator.c	2010-02-09 21:18:50 UTC (rev 26752)
@@ -30,7 +30,7 @@
 #include "rna_internal.h"
 
 #include "DNA_actuator_types.h"
-#include "DNA_scene_types.h" // for MAXFRAMEF
+#include "DNA_scene_types.h" // for MAXFRAME
 
 #include "WM_types.h"
 
@@ -61,8 +61,8 @@
 			return &RNA_RandomActuator;
 		case ACT_MESSAGE:
 			return &RNA_MessageActuator;
-		case ACT_ACTION:
-			return &RNA_ActionActuator;
+//		case ACT_ACTION:
+//			return &RNA_ActionActuator;
 		case ACT_GAME:
 			return &RNA_GameActuator;
 		case ACT_VISIBILITY:
@@ -111,7 +111,7 @@
 		{0, NULL, 0, NULL, NULL}};
 
 	srna= RNA_def_struct(brna, "Actuator", NULL);
-	RNA_def_struct_ui_text(srna, "Actuator", "Game engine logic brick to apply actions in the game engine.");
+	RNA_def_struct_ui_text(srna, "Actuator", "Actuator to apply actions in the game engine.");
 	RNA_def_struct_sdna(srna, "bActuator");
 	RNA_def_struct_refine_func(srna, "rna_Actuator_refine");
 
@@ -129,12 +129,169 @@
 static void rna_def_object_actuator(BlenderRNA *brna)
 {
 	StructRNA *srna;
+	PropertyRNA* prop;
 
+	static EnumPropertyItem prop_type_items[] ={
+		{ACT_OBJECT_NORMAL, "OBJECT_NORMAL", 0, "Simple motion", ""},
+		{ACT_OBJECT_SERVO, "OBJECT_SERVO", 0, "Servo Control", ""},
+		{0, NULL, 0, NULL, NULL}};
+
 	srna= RNA_def_struct(brna, "ObjectActuator", "Actuator");
-	RNA_def_struct_ui_text(srna, "Object Actuator", "Actuator to control the object movement.");
+	RNA_def_struct_ui_text(srna, "Motion Actuator", "Actuator to control the object movement.");
 	RNA_def_struct_sdna_from(srna, "bObjectActuator", "data");
+
+
+	prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
+	RNA_def_property_enum_items(prop, prop_type_items);
+	RNA_def_property_ui_text(prop, "Motion Type", "Specify the motion system");
+	RNA_def_property_update(prop, NC_LOGIC, NULL);
+	// XXX otype = type
 	
-	//XXX
+	prop= RNA_def_property(srna, "reference_object", PROP_POINTER, PROP_NONE);
+	RNA_def_property_struct_type(prop, "Object");
+	RNA_def_property_pointer_sdna(prop, NULL, "reference");
+	RNA_def_property_flag(prop, PROP_EDITABLE);
+	RNA_def_property_ui_text(prop, "Reference Object", "Reference object for velocity calculation, leave empty for world reference");
+	RNA_def_property_update(prop, NC_LOGIC, NULL);
+	
+	prop= RNA_def_property(srna, "damping", PROP_INT, PROP_NONE);
+	RNA_def_property_ui_range(prop, 0, 1000, 1, 1);
+	RNA_def_property_ui_text(prop, "Damping", "Number of frames to reach the target velocity");
+	RNA_def_property_update(prop, NC_LOGIC, NULL);
+
+	prop= RNA_def_property(srna, "proportional_coefficient", PROP_FLOAT, PROP_NONE);
+	RNA_def_property_float_sdna(prop, NULL, "forcerot[0]");
+	RNA_def_property_ui_range(prop, 0.0, 200.0, 1.0, 0.1);
+	RNA_def_property_ui_text(prop, "Proportional Coefficient", "Typical value is 60x integral coefficient");
+	RNA_def_property_update(prop, NC_LOGIC, NULL);
+
+	prop= RNA_def_property(srna, "integral_coefficient", PROP_FLOAT, PROP_NONE);
+	RNA_def_property_float_sdna(prop, NULL, "forcerot[1]");
+	RNA_def_property_ui_range(prop, 0.0, 3.0, 0.1, 0.01);
+	RNA_def_property_ui_text(prop, "Integral Coefficient", "Low value (0.01) for slow response, high value (0.5) for fast response");
+	RNA_def_property_update(prop, NC_LOGIC, NULL);
+
+	prop= RNA_def_property(srna, "derivate_coefficient", PROP_FLOAT, PROP_NONE);
+	RNA_def_property_float_sdna(prop, NULL, "forcerot[2]");
+	RNA_def_property_ui_range(prop, -100.0, 100.0, 1.0, 0.1);
+	RNA_def_property_ui_text(prop, "Derivate Coefficient", "Not required, high values can cause instability");
+	RNA_def_property_update(prop, NC_LOGIC, NULL);
+
+	/* XXX We need one of those special get/set functions here:
+	int offset
+	if (flag & ACT_SERVO_LIMIT_X):
+		offset = 0
+	elif (flag & ACT_SERVO_LIMIT_Y):
+		offset = 1
+	elif (flag & ACT_SERVO_LIMIT_Z):
+		offset = 2
+	
+	prop= RNA_def_property(srna, "force_max", PROP_FLOAT, PROP_NONE);
+	RNA_def_property_float_sdna(prop, NULL, "dloc[offset]");
+	RNA_def_property_ui_range(prop, -100.0, 100.0, 1.0, 0.1);
+	RNA_def_property_ui_text(prop, "Max", "Set the upper limit for force");
+	RNA_def_property_update(prop, NC_LOGIC, NULL);
+
+	prop= RNA_def_property(srna, "force_max", PROP_FLOAT, PROP_NONE);
+	RNA_def_property_float_sdna(prop, NULL, "drot[offset]");
+	RNA_def_property_ui_range(prop, -100.0, 100.0, 1.0, 0.1);
+	RNA_def_property_ui_text(prop, "Max", "Set the upper limit for force");
+	RNA_def_property_update(prop, NC_LOGIC, NULL);
+	*/
+	
+	/* floats 3 Arrays*/
+	prop= RNA_def_property(srna, "loc", PROP_FLOAT, PROP_TRANSLATION);
+	RNA_def_property_float_sdna(prop, NULL, "dloc");
+	RNA_def_property_array(prop, 3);
+	RNA_def_property_ui_range(prop, -10000.0, 10000.0, 0.1, 0.001);
+	RNA_def_property_ui_text(prop, "Loc", "Sets the location");
+	RNA_def_property_update(prop, NC_LOGIC, NULL);
+
+	prop= RNA_def_property(srna, "rot", PROP_FLOAT, PROP_TRANSLATION);
+	RNA_def_property_float_sdna(prop, NULL, "drot");
+	RNA_def_property_array(prop, 3);
+	RNA_def_property_ui_range(prop, -10000.0, 10000.0, 0.1, 0.001);
+	RNA_def_property_ui_text(prop, "Rot", "Sets the rotation");
+	RNA_def_property_update(prop, NC_LOGIC, NULL);
+
+	prop= RNA_def_property(srna, "force", PROP_FLOAT, PROP_TRANSLATION);
+	RNA_def_property_float_sdna(prop, NULL, "forceloc");
+	RNA_def_property_array(prop, 3);
+	RNA_def_property_ui_range(prop, -10000.0, 10000.0, 0.1, 0.001);
+	RNA_def_property_ui_text(prop, "Force", "Sets the force");
+	RNA_def_property_update(prop, NC_LOGIC, NULL);
+
+	prop= RNA_def_property(srna, "torque", PROP_FLOAT, PROP_TRANSLATION);
+	RNA_def_property_float_sdna(prop, NULL, "forcerot");
+	RNA_def_property_array(prop, 3);
+	RNA_def_property_ui_range(prop, -10000.0, 10000.0, 0.1, 0.001);
+	RNA_def_property_ui_text(prop, "Torque", "Sets the torque");
+	RNA_def_property_update(prop, NC_LOGIC, NULL);
+

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list