Blender V2.61 - r43446
|
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_sensor_types.h" 00042 #include "DNA_controller_types.h" 00043 #include "DNA_actuator_types.h" 00044 00045 static void rna_Controller_link(bController *cont, bSensor *sens, bActuator *act) 00046 { 00047 if(sens) 00048 link_logicbricks((void **)&cont, (void ***)&(sens->links), &sens->totlinks, sizeof(bController *)); 00049 if(act) 00050 link_logicbricks((void **)&act, (void ***)&(cont->links), &cont->totlinks, sizeof(bActuator *)); 00051 } 00052 00053 static void rna_Controller_unlink(bController *cont, bSensor *sens, bActuator *act) 00054 { 00055 if(sens) 00056 unlink_logicbricks((void **)&cont, (void ***)&(sens->links), &sens->totlinks); 00057 if(act) 00058 unlink_logicbricks((void **)&act, (void ***)&(cont->links), &cont->totlinks); 00059 } 00060 00061 #else 00062 00063 void RNA_api_controller(StructRNA *srna) 00064 { 00065 FunctionRNA *func; 00066 PropertyRNA *parm; 00067 00068 func= RNA_def_function(srna, "link", "rna_Controller_link"); 00069 RNA_def_function_ui_description(func, "Link the controller with a sensor/actuator"); 00070 parm= RNA_def_pointer(func, "sensor", "Sensor", "", "Sensor to link the controller to"); 00071 RNA_def_property_update(parm, NC_LOGIC, NULL); 00072 parm= RNA_def_pointer(func, "actuator", "Actuator", "", "Actuator to link the controller to"); 00073 RNA_def_property_update(parm, NC_LOGIC, NULL); 00074 00075 func= RNA_def_function(srna, "unlink", "rna_Controller_unlink"); 00076 RNA_def_function_ui_description(func, "Unlink the controller from a sensor/actuator"); 00077 parm= RNA_def_pointer(func, "sensor", "Sensor", "", "Sensor to unlink the controller from"); 00078 RNA_def_property_update(parm, NC_LOGIC, NULL); 00079 parm= RNA_def_pointer(func, "actuator", "Actuator", "", "Actuator to unlink the controller from"); 00080 RNA_def_property_update(parm, NC_LOGIC, NULL); 00081 } 00082 00083 #endif 00084