Revision: 26634
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=26634
Author:   dfelinto
Date:     2010-02-06 00:50:33 +0100 (Sat, 06 Feb 2010)

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

Sensor and Controllers: small fixes and suggestion (comments) for future 
improvement - mainly to replace text properties to material, text or object 
datablocks.

Actuators done:
* IPO
* CAMERA

Actuators to be done:
All the others (their structure is in the file)

Adding NC_LOGIC

** If someone want to help on that:
Files used for actuator RNA:
- logic_window.c
- DNA_actuator_types.h

*** my first big RNA operation. critics/suggestions are welcome

**** padded some DNA variables that were not been used.

Modified Paths:
--------------
    trunk/blender/source/blender/makesdna/DNA_actuator_types.h
    trunk/blender/source/blender/makesdna/DNA_sensor_types.h
    trunk/blender/source/blender/makesrna/intern/rna_actuator.c
    trunk/blender/source/blender/makesrna/intern/rna_controller.c
    trunk/blender/source/blender/makesrna/intern/rna_sensor.c
    trunk/blender/source/blender/windowmanager/WM_types.h

Modified: trunk/blender/source/blender/makesdna/DNA_actuator_types.h
===================================================================
--- trunk/blender/source/blender/makesdna/DNA_actuator_types.h  2010-02-05 
22:03:19 UTC (rev 26633)
+++ trunk/blender/source/blender/makesdna/DNA_actuator_types.h  2010-02-05 
23:50:33 UTC (rev 26634)
@@ -114,16 +114,16 @@
        char name[32];
        char frameProp[32];     /* Set this property to the actions current 
frame */
        
-       short pad1, cur, butsta, butend;
+       short pad1, pad2, pad3, pad4;
        
 } bIpoActuator;
 
 typedef struct bCameraActuator {
        struct Object *ob;
        float height, min, max;
-       float fac;
-       short flag, axis;
-       float visifac;
+       float pad;
+       short pad1, axis;
+       float pad2;
 } bCameraActuator ;
 
 typedef struct bConstraintActuator {

Modified: trunk/blender/source/blender/makesdna/DNA_sensor_types.h
===================================================================
--- trunk/blender/source/blender/makesdna/DNA_sensor_types.h    2010-02-05 
22:03:19 UTC (rev 26633)
+++ trunk/blender/source/blender/makesdna/DNA_sensor_types.h    2010-02-05 
23:50:33 UTC (rev 26634)
@@ -98,6 +98,7 @@
 typedef struct bCollisionSensor {
        char name[32];          /* property name */
        char materialName[32];  /* material      */
+       // struct Material *ma; // XXX remove materialName
        short damptimer, damp;
        short mode;             /* flag to choose material or property */
        short pad2;
@@ -121,6 +122,7 @@
        float range;
        char propname[32];
        char matname[32];
+       //struct Material *ma; // XXX remove materialName
        short mode;
        short pad1;
        int axisflag;

Modified: trunk/blender/source/blender/makesrna/intern/rna_actuator.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_actuator.c 2010-02-05 
22:03:19 UTC (rev 26633)
+++ trunk/blender/source/blender/makesrna/intern/rna_actuator.c 2010-02-05 
23:50:33 UTC (rev 26634)
@@ -30,18 +30,67 @@
 #include "rna_internal.h"
 
 #include "DNA_actuator_types.h"
+#include "DNA_scene_types.h" // for MAXFRAMEF
 
+#include "WM_types.h"
+
 #ifdef RNA_RUNTIME
 
+static StructRNA* rna_Actuator_refine(struct PointerRNA *ptr)
+{
+       bActuator *actuator= (bActuator*)ptr->data;
+
+       switch(actuator->type) {
+               case ACT_OBJECT:
+                       return &RNA_ObjectActuator;
+               case ACT_IPO:
+                       return &RNA_IpoActuator;
+               case ACT_CAMERA:
+                       return &RNA_CameraActuator;
+               case ACT_SOUND:
+                       return &RNA_SoundActuator;
+               case ACT_PROPERTY:
+                       return &RNA_PropertyActuator;
+               case ACT_CONSTRAINT:
+                       return &RNA_ConstraintActuator;
+               case ACT_EDIT_OBJECT:
+                       return &RNA_EditObjectActuator;
+               case ACT_SCENE:
+                       return &RNA_SceneActuator;
+               case ACT_RANDOM:
+                       return &RNA_RandomActuator;
+               case ACT_MESSAGE:
+                       return &RNA_MessageActuator;
+               case ACT_ACTION:
+                       return &RNA_ActionActuator;
+               case ACT_GAME:
+                       return &RNA_GameActuator;
+               case ACT_VISIBILITY:
+                       return &RNA_VisibilityActuator;
+               case ACT_2DFILTER:
+                       return &RNA_TwoDFilterActuator;
+               case ACT_PARENT:
+                       return &RNA_ParentActuator;
+               case ACT_SHAPEACTION:
+                       return &RNA_ShapeActionActuator;
+               case ACT_STATE:
+                       return &RNA_StateActuator;
+               case ACT_ARMATURE:
+                       return &RNA_ArmatureActuator;
+               default:
+                       return &RNA_Actuator;
+       }
+}
+
 #else
 
-void RNA_def_actuator(BlenderRNA *brna)
+void rna_def_actuator(BlenderRNA *brna)
 {
        StructRNA *srna;
        PropertyRNA *prop;
 
        static EnumPropertyItem actuator_type_items[] ={
-               {ACT_OBJECT, "OBJECT", 0, "Object", ""},
+               {ACT_OBJECT, "OBJECT", 0, "Motion", ""},
                {ACT_IPO, "IPO", 0, "IPO", ""},
                {ACT_CAMERA, "CAMERA", 0, "Camera", ""},
                {ACT_SOUND, "SOUND", 0, "Sound", ""},
@@ -51,7 +100,7 @@
                {ACT_SCENE, "SCENE", 0, "Scene", ""},
                {ACT_RANDOM, "RANDOM", 0, "Random", ""},
                {ACT_MESSAGE, "MESSAGE", 0, "Message", ""},
-                {ACT_ACTION, "ACTION", 0, "Action", ""},
+               {ACT_ACTION, "ACTION", 0, "Action", ""},
                {ACT_GAME, "GAME", 0, "Game", ""},
                {ACT_VISIBILITY, "VISIBILITY", 0, "Visibility", ""},
                {ACT_2DFILTER, "FILTER_2D", 0, "2D Filter", ""},
@@ -63,8 +112,8 @@
 
        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_sdna(srna, "bActuator");
+       RNA_def_struct_refine_func(srna, "rna_Actuator_refine");
 
        prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
        RNA_def_property_ui_text(prop, "Name", "");
@@ -77,5 +126,306 @@
 
 }
 
+static void rna_def_object_actuator(BlenderRNA *brna)
+{
+       StructRNA *srna;
+       srna= RNA_def_struct(brna, "ObjectActuator", "Actuator");
+       RNA_def_struct_ui_text(srna, "Object Actuator", "Actuator to control 
the object movement.");
+       RNA_def_struct_sdna_from(srna, "bObjectActuator", "data");
+       
+       //XXX
+}
+
+static void rna_def_ipo_actuator(BlenderRNA *brna)
+{
+       StructRNA *srna;
+       PropertyRNA *prop;
+
+       static EnumPropertyItem prop_type_items[] ={
+               {ACT_IPO_PLAY, "PLAY", 0, "Play", ""},
+               {ACT_IPO_PINGPONG, "PINGPONG", 0, "Ping Pong", ""},
+               {ACT_IPO_FLIPPER, "FLIPPER", 0, "Flipper", ""},
+               {ACT_IPO_LOOP_STOP, "STOP", 0, "Loop Stop", ""},
+               {ACT_IPO_LOOP_END, "END", 0, "Loop End", ""},
+//             {ACT_IPO_KEY2KEY, "IPOCHILD", 0, "Key to Key", ""},
+               {ACT_IPO_FROM_PROP, "PROP", 0, "Property", ""},
+               {0, NULL, 0, NULL, NULL}};
+       
+       srna= RNA_def_struct(brna, "IpoActuator", "Actuator");
+       RNA_def_struct_ui_text(srna, "Ipo Actuator", "Actuator to animate the 
object.");
+       RNA_def_struct_sdna_from(srna, "bIpoActuator", "data");
+
+       prop= RNA_def_property(srna, "play_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, "Ipo Type", "Specify the way you want to 
play the animation.");
+       RNA_def_property_update(prop, NC_LOGIC, NULL);
+       
+       prop= RNA_def_property(srna, "start_frame", PROP_INT, PROP_NONE);
+       RNA_def_property_int_sdna(prop, NULL, "sta");
+       RNA_def_property_ui_range(prop, 1, MAXFRAMEF, 1, 1);
+       RNA_def_property_ui_text(prop, "Start Frame", "");
+       RNA_def_property_update(prop, NC_SCENE, NULL);
+
+       prop= RNA_def_property(srna, "end_frame", PROP_INT, PROP_NONE);
+       RNA_def_property_int_sdna(prop, NULL, "end");
+       RNA_def_property_ui_range(prop, 1, MAXFRAMEF, 1, 1);
+       RNA_def_property_ui_text(prop, "End Frame", "");
+       RNA_def_property_update(prop, NC_LOGIC, NULL);
+       
+       prop= RNA_def_property(srna, "prop", PROP_STRING, PROP_NONE);
+       RNA_def_property_string_sdna(prop, NULL, "name");
+       RNA_def_property_ui_text(prop, "Prop", "Use this property to define the 
Ipo position.");
+       RNA_def_property_update(prop, NC_LOGIC, NULL);
+
+       prop= RNA_def_property(srna, "frame_prop", PROP_STRING, PROP_NONE);
+       RNA_def_property_string_sdna(prop, NULL, "frameProp");
+       RNA_def_property_ui_text(prop, "FrameProp", "Assign the action's 
current frame number to this property");
+
+       /* booleans */
+       prop= RNA_def_property(srna, "ipo_force", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_IPOFORCE);
+       RNA_def_property_ui_text(prop, "Force", "Apply Ipo as a global or local 
force depending on the local option (dynamic objects only)");
+       RNA_def_property_update(prop, NC_LOGIC, NULL);
+       //logic_window::change_ipo_actuator
+       
+       prop= RNA_def_property(srna, "ipo_local", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_IPOLOCAL);
+       RNA_def_property_ui_text(prop, "L", "Let the ipo acts in local 
coordinates, used in Force and Add mode.");
+       RNA_def_property_update(prop, NC_LOGIC, NULL);
+
+       prop= RNA_def_property(srna, "ipo_child", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_IPOCHILD);
+       RNA_def_property_ui_text(prop, "Child", "Update IPO on all children 
Objects as well");
+       RNA_def_property_update(prop, NC_LOGIC, NULL);
+       
+       prop= RNA_def_property(srna, "ipo_add", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_IPOADD);
+       RNA_def_property_ui_text(prop, "Add", "Ipo is added to the current 
loc/rot/scale in global or local coordinate according to Local flag");
+       RNA_def_property_update(prop, NC_LOGIC, NULL);
+       //logic_window::change_ipo_actuator
+}
+
+static void rna_def_camera_actuator(BlenderRNA *brna)
+{
+       StructRNA *srna;
+       PropertyRNA *prop;
+
+       static EnumPropertyItem prop_axis_items[] ={
+               {(float)'x', "X", 0, "X", "Camera tries to get behind the X 
axis"},
+               {(float)'y', "Y", 0, "Y", "Camera tries to get behind the Y 
axis"},
+               {0, NULL, 0, NULL, NULL}};
+       
+       srna= RNA_def_struct(brna, "CameraActuator", "Actuator");
+       RNA_def_struct_ui_text(srna, "Camera Actuator", "Actuator to ...");
+       RNA_def_struct_sdna_from(srna, "bCameraActuator", "data");
+
+       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, "Camera Object", "Look at this Object");
+       RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
+
+       /* floats */
+       prop= RNA_def_property(srna, "height", PROP_FLOAT, PROP_NONE);
+       RNA_def_property_ui_range(prop, 0.0, 20.0, 0.1, 0.1);
+       RNA_def_property_ui_text(prop, "Height", "");
+       RNA_def_property_update(prop, NC_LOGIC, NULL);
+
+       prop= RNA_def_property(srna, "min", PROP_FLOAT, PROP_NONE);
+       RNA_def_property_ui_range(prop, 0.0, 20.0, 0.1, 0.1);
+       RNA_def_property_ui_text(prop, "Min", "");
+       RNA_def_property_update(prop, NC_LOGIC, NULL);
+
+       prop= RNA_def_property(srna, "max", PROP_FLOAT, PROP_NONE);
+       RNA_def_property_ui_range(prop, 0.0, 20.0, 0.1, 0.1);
+       RNA_def_property_ui_text(prop, "Max", "");
+       RNA_def_property_update(prop, NC_LOGIC, NULL);
+
+       /* x/y */
+       // It could be changed to be a regular ENUM instead of this weird 
"(float)string enum"
+       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);
+       RNA_def_property_ui_text(prop, "Axis", "Specify the axy the Camera will 
try to get behind.");
+       RNA_def_property_update(prop, NC_LOGIC, NULL);
+}
+
+static void rna_def_sound_actuator(BlenderRNA *brna)
+{
+       StructRNA *srna;
+       srna= RNA_def_struct(brna, "SoundActuator", "Actuator");
+       RNA_def_struct_ui_text(srna, "Sound Actuator", "Actuator to ...");
+       RNA_def_struct_sdna_from(srna, "bSoundActuator", "data");
+
+       //XXX
+}
+
+static void rna_def_property_actuator(BlenderRNA *brna)
+{
+       StructRNA *srna;

@@ Diff output truncated at 10240 characters. @@

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to