[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [28615] trunk/blender/source/blender: Logic UI: actuators - action+rna 100%, sound 100%, constraint+rna 50%
Dalai Felinto
dfelinto at gmail.com
Thu May 6 14:01:44 CEST 2010
Revision: 28615
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=28615
Author: dfelinto
Date: 2010-05-06 14:01:44 +0200 (Thu, 06 May 2010)
Log Message:
-----------
Logic UI: actuators - action+rna 100%, sound 100%, constraint+rna 50%
Notes:
1) I had to pass Context to the draw_actuator_sound in order to access the open_sound_operator
uiTemplateID(layout, C, ptr, "sound", NULL, "SOUND_OT_open", NULL);
According to Campbell they are better ways to do that (mdef bind for reference). but for now it works.
2) for the record: action actuator is equal to shape actuator (but runs in armature)
3) in Constraint Actuator I think I should unify all the limit_loc_max_, loc_min, ... properties. I was thinking about replacing it with a single limit_loc_max, limit_loc_min, range, distance, and use get/set funcs to find the correct one.
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
Modified: trunk/blender/source/blender/editors/space_logic/logic_window.c
===================================================================
--- trunk/blender/source/blender/editors/space_logic/logic_window.c 2010-05-06 11:49:26 UTC (rev 28614)
+++ trunk/blender/source/blender/editors/space_logic/logic_window.c 2010-05-06 12:01:44 UTC (rev 28615)
@@ -3544,7 +3544,32 @@
static void draw_actuator_action(uiLayout *layout, PointerRNA *ptr)
{
- //XXXACTUATOR
+ uiLayout *row;
+
+ row= uiLayoutRow(layout, 0);
+ uiItemR(row, ptr, "mode", 0, NULL, 0);
+ uiItemR(row, ptr, "action", 0, NULL, 0);
+ uiItemR(row, ptr, "continue_last_frame", 0, NULL, 0);
+
+ row= uiLayoutRow(layout, 0);
+ if((RNA_enum_get(ptr, "mode") == ACT_ACTION_FROM_PROP))
+ uiItemR(row, ptr, "property", 0, NULL, 0);
+
+ else {
+ uiItemR(row, ptr, "frame_start", 0, NULL, 0);
+ uiItemR(row, ptr, "frame_end", 0, NULL, 0);
+ }
+
+ row= uiLayoutRow(layout, 0);
+ uiItemR(row, ptr, "blendin", 0, NULL, 0);
+ uiItemR(row, ptr, "priority", 0, NULL, 0);
+
+ row= uiLayoutRow(layout, 0);
+ uiItemR(row, ptr, "frame_property", 0, NULL, 0);
+
+#ifdef __NLA_ACTION_BY_MOTION_ACTUATOR
+ uiItemR(row, "stride_length", 0, NULL, 0);
+#endif
}
static void draw_actuator_armature(uiLayout *layout, PointerRNA *ptr)
@@ -3599,6 +3624,90 @@
static void draw_actuator_constraint(uiLayout *layout, PointerRNA *ptr)
{
+ uiLayout *row, *subrow, *split;
+
+ uiItemR(layout, ptr, "mode", 0, NULL, 0);
+ switch (RNA_enum_get(ptr, "mode"))
+ {
+ case ACT_CONST_TYPE_LOC:
+ uiItemR(layout, ptr, "limit", 0, NULL, 0);
+
+ switch(RNA_enum_get(ptr, "limit")){
+ case ACT_CONST_LOCX:
+ row = uiLayoutRow(layout, 1);
+ uiItemR(row, ptr, "limit_loc_min_x", 0, NULL, 0);
+ uiItemR(row, ptr, "limit_loc_max_x", 0, NULL, 0);
+ break;
+
+ case ACT_CONST_LOCY:
+ row = uiLayoutRow(layout, 1);
+ uiItemR(row, ptr, "limit_loc_min_y", 0, NULL, 0);
+ uiItemR(row, ptr, "limit_loc_max_y", 0, NULL, 0);
+ break;
+
+ case ACT_CONST_LOCZ:
+ row = uiLayoutRow(layout, 1);
+ uiItemR(row, ptr, "limit_loc_min_z", 0, NULL, 0);
+ uiItemR(row, ptr, "limit_loc_max_z", 0, NULL, 0);
+ break;
+ }
+ uiItemR(layout, ptr, "damping", UI_ITEM_R_SLIDER, NULL, 0);
+ break;
+
+ case ACT_CONST_TYPE_DIST:
+ uiItemR(layout, ptr, "direction", 0, NULL, 0);//move to the right
+ if(RNA_enum_get(ptr, "direction")!=0)
+ uiItemR(layout, ptr, "force_distance", 0, NULL, 0);
+
+ switch(RNA_enum_get(ptr, "direction")){
+ case ACT_CONST_DIRPX:
+ case ACT_CONST_DIRNX:
+ row = uiLayoutRow(layout, 0);
+ uiItemR(row, ptr, "range_x", 0, NULL, 0);
+ subrow = uiLayoutRow(row, 0);
+ uiLayoutSetActive(subrow, RNA_boolean_get(ptr, "force_distance")==1);
+ uiItemR(subrow, ptr, "distance_x", 0, NULL, 0);
+ break;
+
+ case ACT_CONST_DIRPY:
+ case ACT_CONST_DIRNY:
+ row = uiLayoutRow(layout, 0);
+ uiItemR(row, ptr, "range_y", 0, NULL, 0);
+ subrow = uiLayoutRow(row, 0);
+ uiLayoutSetActive(subrow, RNA_boolean_get(ptr, "force_distance")==1);
+ uiItemR(subrow, ptr, "distance_y", 0, NULL, 0);
+ break;
+
+ case ACT_CONST_DIRPZ:
+ case ACT_CONST_DIRNZ:
+ row = uiLayoutRow(layout, 0);
+ uiItemR(row, ptr, "range_z", 0, NULL, 0);
+ subrow = uiLayoutRow(row, 0);
+ uiLayoutSetActive(subrow, RNA_boolean_get(ptr, "force_distance")==1);
+ uiItemR(subrow, ptr, "distance_z", 0, NULL, 0);
+ break;
+ }
+ uiItemR(layout, ptr, "damping", UI_ITEM_R_SLIDER , NULL, 0);
+ split = uiLayoutSplit(layout, 0.15, 0);
+ uiItemR(split, ptr, "detect_material", UI_ITEM_R_TOGGLE, NULL, 0);
+
+ if (RNA_boolean_get(ptr, "detect_material"))
+ uiItemR(split, ptr, "material", 0, NULL, 0);
+ else
+ uiItemR(split, ptr, "property", 0, NULL, 0);
+
+ uiItemR(layout, ptr, "damping_rotation", UI_ITEM_R_SLIDER, NULL, 0);
+ break;
+
+ case ACT_CONST_TYPE_ORI:
+ uiItemL(layout, "to be done", 0);
+ break;
+
+ case ACT_CONST_TYPE_FH:
+ uiItemL(layout, "to be done", 0);
+ break;
+ }
+
//XXXACTUATOR STILL HAVE TO DO THE RNA
}
@@ -3951,9 +4060,41 @@
#endif
}
-static void draw_actuator_sound(uiLayout *layout, PointerRNA *ptr)
+static void draw_actuator_sound(uiLayout *layout, PointerRNA *ptr, bContext *C)
{
- //XXXACTUATOR
+ uiLayout *row, *box;
+
+ uiTemplateID(layout, C, ptr, "sound", NULL, "SOUND_OT_open", NULL);
+ if (!RNA_pointer_get(ptr, "sound").data)
+ {
+ uiItemL(layout, "Select a sound from the list or load a new one", 0);
+ return;
+ }
+ uiItemR(layout, ptr, "mode", 0, NULL, 0);
+
+ row = uiLayoutRow(layout, 0);
+ uiItemR(row, ptr, "volume", 0, NULL, 0);
+ uiItemR(row, ptr, "pitch", 0, NULL, 0);
+
+ uiItemR(layout, ptr, "enable_sound_3d", UI_ITEM_R_TOGGLE, NULL, 0);
+ box = uiLayoutBox(layout);
+ uiLayoutSetActive(box, RNA_boolean_get(ptr, "enable_sound_3d")==1);
+
+ row = uiLayoutRow(box, 0);
+ uiItemR(row, ptr, "minimum_gain_3d", 0, NULL, 0);
+ uiItemR(row, ptr, "maximum_gain_3d", 0, NULL, 0);
+
+ row = uiLayoutRow(box, 0);
+ uiItemR(row, ptr, "reference_distance_3d", 0, NULL, 0);
+ uiItemR(row, ptr, "max_distance_3d", 0, NULL, 0);
+
+ row = uiLayoutRow(box, 0);
+ uiItemR(row, ptr, "rolloff_factor_3d", 0, NULL, 0);
+ uiItemR(row, ptr, "cone_outer_gain_3d", 0, NULL, 0);
+
+ row = uiLayoutRow(box, 0);
+ uiItemR(row, ptr, "cone_outer_angle_3d", 0, NULL, 0);
+ uiItemR(row, ptr, "cone_inner_angle_3d", 0, NULL, 0);
}
static void draw_actuator_state(uiLayout *layout, PointerRNA *ptr)
@@ -3971,7 +4112,7 @@
uiItemR(row, ptr, "children", 0, NULL, 0);
}
-void draw_brick_actuator(uiLayout *layout, PointerRNA *ptr)
+void draw_brick_actuator(uiLayout *layout, PointerRNA *ptr, bContext *C)
{
uiLayout *box;
@@ -4027,7 +4168,7 @@
draw_actuator_shape_action(box, ptr);
break;
case ACT_SOUND:
- draw_actuator_sound(box, ptr);
+ draw_actuator_sound(box, ptr, C);
break;
case ACT_STATE:
draw_actuator_state(box, ptr);
@@ -4287,7 +4428,7 @@
draw_actuator_header(col, &ptr);
/* draw the brick contents */
- draw_brick_actuator(col, &ptr);
+ draw_brick_actuator(col, &ptr, C);
}
}
Modified: trunk/blender/source/blender/makesdna/DNA_actuator_types.h
===================================================================
--- trunk/blender/source/blender/makesdna/DNA_actuator_types.h 2010-05-06 11:49:26 UTC (rev 28614)
+++ trunk/blender/source/blender/makesdna/DNA_actuator_types.h 2010-05-06 12:01:44 UTC (rev 28615)
@@ -351,6 +351,7 @@
#define ACT_PROP_TOGGLE 3
/* constraint flag */
+#define ACT_CONST_NONE 0
#define ACT_CONST_LOCX 1
#define ACT_CONST_LOCY 2
#define ACT_CONST_LOCZ 4
Modified: trunk/blender/source/blender/makesrna/intern/rna_actuator.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_actuator.c 2010-05-06 11:49:26 UTC (rev 28614)
+++ trunk/blender/source/blender/makesrna/intern/rna_actuator.c 2010-05-06 12:01:44 UTC (rev 28615)
@@ -27,7 +27,7 @@
#include "RNA_define.h"
#include "rna_internal.h"
-
+#include "DNA_object_types.h"
#include "DNA_actuator_types.h"
#include "DNA_scene_types.h" // for MAXFRAME
@@ -54,6 +54,14 @@
{ACT_VISIBILITY, "VISIBILITY", 0, "Visibility", ""},
{0, NULL, 0, NULL, NULL}};
+EnumPropertyItem edit_object_type_items[] ={
+ {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} };
+
#ifdef RNA_RUNTIME
#include "BKE_sca.h"
@@ -63,6 +71,8 @@
bActuator *actuator= (bActuator*)ptr->data;
switch(actuator->type) {
+ case ACT_ACTION:
+ return &RNA_ActionActuator;
case ACT_OBJECT:
return &RNA_ObjectActuator;
case ACT_IPO:
@@ -101,6 +111,18 @@
return &RNA_Actuator;
}
}
+//
+//static StructRNA* rna_ActionActuator_refine(struct PointerRNA *ptr)
+//{
+// bActuator *actuator= (bActuator*)ptr->data;
+//
+// switch(actuator->type) {
+// case ACT_ACTION:
+// return &RNA_ActionActuator;
+// case ACT_SHAPEACTION:
+// return &RNA_ShapeActionActuator;
+// }
+//}
static void rna_Actuator_type_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
@@ -118,7 +140,65 @@
oa->forcerot[0] = 60.0f*oa->forcerot[1];
}
+static EnumPropertyItem *rna_EditObjectActuator_mode_itemf(bContext *C, PointerRNA *ptr, int *free)
+{
+ EnumPropertyItem *item= NULL;
+ Object *ob = (Object *)ptr->id.data;
+ int totitem= 0;
+ if (ob->type!=OB_ARMATURE)
+ {
+ RNA_enum_items_add_value(&item, &totitem, edit_object_type_items, ACT_EDOB_REPLACE_MESH);
+ RNA_enum_items_add_value(&item, &totitem, edit_object_type_items, ACT_EDOB_DYNAMICS);
+ }
+
+ RNA_enum_items_add_value(&item, &totitem, edit_object_type_items, ACT_EDOB_ADD_OBJECT);
+ RNA_enum_items_add_value(&item, &totitem, edit_object_type_items, ACT_EDOB_END_OBJECT);
+ RNA_enum_items_add_value(&item, &totitem, edit_object_type_items, ACT_EDOB_TRACK_TO);
+
+ RNA_enum_item_end(&item, &totitem);
+ *free= 1;
+
+ return item;
+}
+
+static EnumPropertyItem *rna_Actuator_type_itemf(bContext *C, PointerRNA *ptr, int *free)
+{
+ EnumPropertyItem *item= NULL;
+ Object *ob = (Object *)ptr->id.data;
+
+ int totitem= 0;
+ if (ob->type==OB_ARMATURE)
+ {
+ RNA_enum_items_add_value(&item, &totitem, actuator_type_items, ACT_ACTION);
+ RNA_enum_items_add_value(&item, &totitem, actuator_type_items, ACT_ARMATURE);
+ }
+ else
+ RNA_enum_items_add_value(&item, &totitem, actuator_type_items, ACT_SHAPEACTION);
+
+ RNA_enum_items_add_value(&item, &totitem, actuator_type_items, ACT_CAMERA);
+ RNA_enum_items_add_value(&item, &totitem, actuator_type_items, ACT_CONSTRAINT);
+ RNA_enum_items_add_value(&item, &totitem, actuator_type_items, ACT_EDIT_OBJECT);
+ RNA_enum_items_add_value(&item, &totitem, actuator_type_items, ACT_2DFILTER);
+ RNA_enum_items_add_value(&item, &totitem, actuator_type_items, ACT_GAME);
+ RNA_enum_items_add_value(&item, &totitem, actuator_type_items, ACT_IPO);
+ RNA_enum_items_add_value(&item, &totitem, actuator_type_items, ACT_MESSAGE);
+ RNA_enum_items_add_value(&item, &totitem, actuator_type_items, ACT_OBJECT);
+ RNA_enum_items_add_value(&item, &totitem, actuator_type_items, ACT_PARENT);
+ RNA_enum_items_add_value(&item, &totitem, actuator_type_items, ACT_PROPERTY);
+
+ RNA_enum_items_add_value(&item, &totitem, actuator_type_items, ACT_RANDOM);
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list