Blender V2.61 - r43446

rna_actuator_api.c

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