diff options
Diffstat (limited to 'source/blender/blenkernel/intern/sca.c')
-rw-r--r-- | source/blender/blenkernel/intern/sca.c | 59 |
1 files changed, 28 insertions, 31 deletions
diff --git a/source/blender/blenkernel/intern/sca.c b/source/blender/blenkernel/intern/sca.c index 74d2347ec39..5cd554725ff 100644 --- a/source/blender/blenkernel/intern/sca.c +++ b/source/blender/blenkernel/intern/sca.c @@ -35,6 +35,8 @@ #include <stdio.h> #include <string.h> +#include <float.h> + #include "MEM_guardedalloc.h" #include "DNA_text_types.h" @@ -50,30 +52,6 @@ #include "BKE_blender.h" #include "BKE_sca.h" -//#include "wm_event_types.h" - -void free_text_controllers(Text *txt) -{ - Object *ob; - bController *cont; - - ob= G.main->object.first; - while(ob) { - cont= ob->controllers.first; - while(cont) { - if(cont->type==CONT_PYTHON) { - bPythonCont *pc; - - pc= cont->data; - if(pc->text==txt) pc->text= NULL; - } - cont= cont->next; - } - ob= ob->id.next; - } -} - - /* ******************* SENSORS ************************ */ void free_sensor(bSensor *sens) @@ -150,6 +128,9 @@ void init_sensor(bSensor *sens) case SENS_PROPERTY: sens->data= MEM_callocN(sizeof(bPropertySensor), "propsens"); break; + case SENS_ARMATURE: + sens->data= MEM_callocN(sizeof(bArmatureSensor), "armsens"); + break; case SENS_ACTUATOR: sens->data= MEM_callocN(sizeof(bActuatorSensor), "actsens"); break; @@ -410,22 +391,25 @@ void init_actuator(bActuator *act) { /* also use when actuator changes type */ bObjectActuator *oa; + bSoundActuator *sa; if(act->data) MEM_freeN(act->data); act->data= 0; switch(act->type) { -#ifdef __NLA case ACT_ACTION: case ACT_SHAPEACTION: act->data= MEM_callocN(sizeof(bActionActuator), "actionact"); break; -#endif case ACT_SOUND: - act->data= MEM_callocN(sizeof(bSoundActuator), "soundact"); - break; - case ACT_CD: - act->data= MEM_callocN(sizeof(bCDActuator), "cdact"); + sa = act->data= MEM_callocN(sizeof(bSoundActuator), "soundact"); + sa->volume = 1.0f; + sa->sound3D.rolloff_factor = 1.0f; + sa->sound3D.reference_distance = 1.0f; + sa->sound3D.max_gain = 1.0f; + sa->sound3D.cone_inner_angle = 360.0f; + sa->sound3D.cone_outer_angle = 360.0f; + sa->sound3D.max_distance = FLT_MAX; break; case ACT_OBJECT: act->data= MEM_callocN(sizeof(bObjectActuator), "objectact"); @@ -474,6 +458,9 @@ void init_actuator(bActuator *act) case ACT_STATE: act->data = MEM_callocN(sizeof( bStateActuator ), "state act"); break; + case ACT_ARMATURE: + act->data = MEM_callocN(sizeof( bArmatureActuator ), "armature act"); + break; default: ; /* this is very severe... I cannot make any memory for this */ /* logic brick... */ @@ -615,6 +602,8 @@ void sca_remove_ob_poin(Object *obt, Object *ob) bEditObjectActuator *eoa; bPropertyActuator *pa; bMessageActuator *ma; + bParentActuator *para; + bArmatureActuator *aa; sens= obt->sensors.first; while(sens) { @@ -653,7 +642,15 @@ void sca_remove_ob_poin(Object *obt, Object *ob) ma= act->data; if(ma->toObject==ob) ma->toObject= NULL; break; - + case ACT_PARENT: + para = act->data; + if (para->ob==ob) para->ob = NULL; + break; + case ACT_ARMATURE: + aa = act->data; + if (aa->target == ob) aa->target = NULL; + if (aa->subtarget == ob) aa->subtarget = NULL; + break; } act= act->next; } |