Blender  V2.59
rna_sensor_api.c
Go to the documentation of this file.
00001 /*
00002  * $Id: rna_sensor_api.c 35238 2011-02-27 20:20:01Z jesterking $
00003  *
00004  * ***** BEGIN GPL LICENSE BLOCK *****
00005  *
00006  * This program is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU General Public License
00008  * as published by the Free Software Foundation; either version 2
00009  * of the License, or (at your option) any later version. 
00010  *
00011  * This program is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU General Public License
00017  * along with this program; if not, write to the Free Software Foundation,
00018  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00019  *
00020  * The Original Code is Copyright (C) 2010 Blender Foundation.
00021  * All rights reserved.
00022  *
00023  * 
00024  * Contributor(s):
00025  *
00026  * ***** END GPL LICENSE BLOCK *****
00027  */
00028 
00034 #include <stdlib.h>
00035 #include <stdio.h>
00036 
00037 #include "WM_types.h"
00038 #include "RNA_define.h"
00039 
00040 #ifdef RNA_RUNTIME
00041 
00042 #include "BKE_sca.h"
00043 #include "DNA_sensor_types.h"
00044 #include "DNA_controller_types.h"
00045 
00046 static void rna_Sensor_link(bSensor *sens, bController *cont)
00047 {
00048         link_logicbricks((void **)&cont, (void ***)&(sens->links), &sens->totlinks, sizeof(bController *));
00049 }
00050 
00051 static void rna_Sensor_unlink(bSensor *sens, bController *cont)
00052 {
00053         unlink_logicbricks((void **)&cont, (void ***)&(sens->links), &sens->totlinks);
00054 }
00055 
00056 #else
00057 
00058 void RNA_api_sensor(StructRNA *srna)
00059 {
00060         FunctionRNA *func;
00061         PropertyRNA *parm;
00062 
00063         func= RNA_def_function(srna, "link", "rna_Sensor_link");
00064         RNA_def_function_ui_description(func, "Link the sensor to a controller.");
00065         parm= RNA_def_pointer(func, "controller", "Controller", "", "Controller to link to."); 
00066         RNA_def_property_flag(parm, PROP_REQUIRED);
00067         RNA_def_property_update(parm, NC_LOGIC, NULL);
00068 
00069         func= RNA_def_function(srna, "unlink", "rna_Sensor_unlink");
00070         RNA_def_function_ui_description(func, "Unlink the sensor from a controller.");
00071         parm= RNA_def_pointer(func, "controller", "Controller", "", "Controller to unlink from."); 
00072         RNA_def_property_flag(parm, PROP_REQUIRED);
00073         RNA_def_property_update(parm, NC_LOGIC, NULL);
00074 }
00075 
00076 #endif
00077