diff options
author | Dalai Felinto <dfelinto@gmail.com> | 2012-03-03 06:47:01 +0400 |
---|---|---|
committer | Dalai Felinto <dfelinto@gmail.com> | 2012-03-03 06:47:01 +0400 |
commit | 1f928833f3677fa47a10099205c9f7ffa9adfadb (patch) | |
tree | 85b6fb8af88d7d459830e7b3fb51f6b84e74cf50 /source/blender | |
parent | 95bba22af075148f9cbdb5a9b1ef41aeff1f560f (diff) |
option for the Armature Actuator to change the influence of a bone constraint.
Also adds DampedTrackTo to the list of supported constraints in the BGE
Test file:
http://www.pasteall.org/blend/11715
Patch developed as part of a project to NF-UBC Nereus Program.
Development time 'sponsored' by the project.
www.nereusprogram.org
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/blenkernel/intern/sca.c | 3 | ||||
-rw-r--r-- | source/blender/editors/space_logic/logic_window.c | 10 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_actuator_types.h | 7 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_actuator.c | 7 |
4 files changed, 25 insertions, 2 deletions
diff --git a/source/blender/blenkernel/intern/sca.c b/source/blender/blenkernel/intern/sca.c index 92dfe90eec1..30a7449be1b 100644 --- a/source/blender/blenkernel/intern/sca.c +++ b/source/blender/blenkernel/intern/sca.c @@ -395,6 +395,7 @@ void init_actuator(bActuator *act) bRandomActuator *ra; bSoundActuator *sa; bSteeringActuator *sta; + bArmatureActuator *arma; if(act->data) MEM_freeN(act->data); act->data= NULL; @@ -468,6 +469,8 @@ void init_actuator(bActuator *act) break; case ACT_ARMATURE: act->data = MEM_callocN(sizeof( bArmatureActuator ), "armature act"); + arma = act->data; + arma->influence = 1.f; break; case ACT_STEERING: act->data = MEM_callocN(sizeof( bSteeringActuator), "steering act"); diff --git a/source/blender/editors/space_logic/logic_window.c b/source/blender/editors/space_logic/logic_window.c index 878543e6a36..15aab2aa9b0 100644 --- a/source/blender/editors/space_logic/logic_window.c +++ b/source/blender/editors/space_logic/logic_window.c @@ -3806,6 +3806,16 @@ static void draw_actuator_armature(uiLayout *layout, PointerRNA *ptr) uiItemR(layout, ptr, "weight", 0, NULL, ICON_NONE); break; + case ACT_ARM_SETINFLUENCE: + if (ob->pose) { + uiItemPointerR(layout, ptr, "bone", &pose_ptr, "bones", NULL, ICON_BONE_DATA); + + if (RNA_property_collection_lookup_string(&pose_ptr, bones_prop, aa->posechannel, &pchan_ptr)) + uiItemPointerR(layout, ptr, "constraint", &pchan_ptr, "constraints", NULL, ICON_CONSTRAINT_BONE); + } + + uiItemR(layout, ptr, "influence", 0, NULL, ICON_NONE); + break; } } diff --git a/source/blender/makesdna/DNA_actuator_types.h b/source/blender/makesdna/DNA_actuator_types.h index 41b830847ad..776231476ba 100644 --- a/source/blender/makesdna/DNA_actuator_types.h +++ b/source/blender/makesdna/DNA_actuator_types.h @@ -224,6 +224,8 @@ typedef struct bArmatureActuator { char constraint[64]; /* MAX_NAME */ int type; /* 0=run, 1=enable, 2=disable, 3=set target, 4=set weight */ float weight; + float influence; + float pad; struct Object *target; struct Object *subtarget; } bArmatureActuator; @@ -511,8 +513,9 @@ typedef struct bActuator { #define ACT_ARM_DISABLE 2 #define ACT_ARM_SETTARGET 3 #define ACT_ARM_SETWEIGHT 4 -/* update this define if more type are addedd */ -#define ACT_ARM_MAXTYPE 4 +#define ACT_ARM_SETINFLUENCE 5 +/* update this define if more types are added */ +#define ACT_ARM_MAXTYPE 5 /* stateactuator->type */ #define ACT_STATE_SET 0 diff --git a/source/blender/makesrna/intern/rna_actuator.c b/source/blender/makesrna/intern/rna_actuator.c index 6098e885df5..c9a57279181 100644 --- a/source/blender/makesrna/intern/rna_actuator.c +++ b/source/blender/makesrna/intern/rna_actuator.c @@ -1887,6 +1887,7 @@ static void rna_def_armature_actuator(BlenderRNA *brna) {ACT_ARM_DISABLE, "DISABLE", 0, "Disable", ""}, {ACT_ARM_SETTARGET, "SETTARGET", 0, "Set Target", ""}, {ACT_ARM_SETWEIGHT, "SETWEIGHT", 0, "Set Weight", ""}, + {ACT_ARM_SETINFLUENCE, "SETINFLUENCE", 0, "Set Influence", ""}, {0, NULL, 0, NULL, NULL}}; srna= RNA_def_struct(brna, "ArmatureActuator", "Actuator"); @@ -1927,6 +1928,12 @@ static void rna_def_armature_actuator(BlenderRNA *brna) RNA_def_property_range(prop, 0.0, 1.0); RNA_def_property_ui_text(prop, "Weight", "Weight of this constraint"); RNA_def_property_update(prop, NC_LOGIC, NULL); + + prop= RNA_def_property(srna, "influence", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "influence"); + RNA_def_property_range(prop, 0.0, 1.0); + RNA_def_property_ui_text(prop, "Influence", "Influence of this constraint"); + RNA_def_property_update(prop, NC_LOGIC, NULL); } static void rna_def_steering_actuator(BlenderRNA *brna) |