Welcome to mirror list, hosted at ThFree Co, Russian Federation.

DNA_sensor_types.h « makesdna « blender « source - git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 3bbcb128f073ddf9bd9bdcfe74da0493e407812d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
/**
 * blenlib/DNA_sensor_types.h (mar-2001 nzc)
 *	
 * $Id$ 
 *
 * ***** BEGIN GPL LICENSE BLOCK *****
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software Foundation,
 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 *
 * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
 * All rights reserved.
 *
 * The Original Code is: all of this file.
 *
 * Contributor(s): none yet.
 *
 * ***** END GPL LICENSE BLOCK *****
 */
#ifndef DNA_SENSOR_TYPES_H
#define DNA_SENSOR_TYPES_H

struct Object;
struct Material;

/* ****************** SENSORS ********************* */

typedef struct bNearSensor {
	char name[32];
	float dist, resetdist;
	int lastval, pad;
} bNearSensor;

/**
 * Defines the settings of a mouse sensor.
 */
typedef struct bMouseSensor {
	/**
	 * The type of key this sensor listens to. 
	 */
	short type;
	short flag;
	short pad1;
	short pad2;
} bMouseSensor;

typedef struct bTouchSensor {
	char name[32];
	struct Material *ma;
	float dist, pad;
} bTouchSensor;

typedef struct bKeyboardSensor {
	short key, qual;
	short type, qual2;
	/**
	 * Name of the target property
	 */
	char targetName[32];
	/**
	 * Name of the toggle property
	 */
	char toggleName[32];
} bKeyboardSensor;

typedef struct bPropertySensor {
	int type;
	int pad;
	char name[32];
	char value[32];
	char maxvalue[32];
} bPropertySensor;

typedef struct bActuatorSensor {
	int type;
	int pad;
	char name[32];
} bActuatorSensor;

typedef struct bDelaySensor {
	short delay;
	short duration;
	short flag;
	short pad;
} bDelaySensor;

typedef struct bCollisionSensor {
	char name[32];          /* property name */
	char materialName[32];  /* material      */
	// struct Material *ma; // XXX remove materialName
	short damptimer, damp;
	short mode;             /* flag to choose material or property */
	 short pad2;
} bCollisionSensor;

typedef struct bRadarSensor {
	char name[32];
	float angle;
	float range;
	short flag, axis;
} bRadarSensor;

typedef struct bRandomSensor {
	char name[32];
	int seed;
	int delay;
} bRandomSensor;

typedef struct bRaySensor {
	char name[32];
	float range;
	char propname[32];
	char matname[32];
	//struct Material *ma; // XXX remove materialName
	short mode;
	short pad1;
	int axisflag;
} bRaySensor;

typedef struct bArmatureSensor {
	char posechannel[32];
	char constraint[32];
	int  type;
	float value;
} bArmatureSensor;

typedef struct bMessageSensor {
	/**
	 * (Possible future use) pointer to a single sender object
	 */
	struct Object *fromObject;

	/**
	 * Can be used to filter on subjects like this
	 */
	char subject[32];

	/**
	 * (Possible future use) body to filter on
	 */
	char body[32];
} bMessageSensor;

typedef struct bSensor {
	struct bSensor *next, *prev;
	/* pulse and freq are the bool toggle and frame count for pulse mode */
	short type, otype, flag, pulse;
	short freq, totlinks, pad1, pad2;
	char name[32];
	void *data;
	
	struct bController **links;
	
	struct Object *ob;

	/* just add here, to avoid align errors... */
	short invert; /* Whether or not to invert the output. */
	short level;  /* Whether the sensor is level base (edge by default) */
	short tap;
	short pad;
} bSensor;

typedef struct bJoystickSensor {
	char name[32];
	char type;
	char joyindex;
	short flag;
	short axis;
	short axis_single;
	int axisf;
	int button;
	int hat;
	int hatf;
	int precision;
} bJoystickSensor;

/* bMouseSensor->type: uses blender event defines */

/* bMouseSensor->flag: only pulse for now */
#define SENS_MOUSE_FOCUS_PULSE	1

/* propertysensor->type */
#define SENS_PROP_EQUAL		0
#define SENS_PROP_NEQUAL	1
#define SENS_PROP_INTERVAL	2
#define SENS_PROP_CHANGED	3
#define SENS_PROP_EXPRESSION	4

/* raysensor->axisflag */
/* flip x and y to make y default!!! */
#define SENS_RAY_X_AXIS     1
#define SENS_RAY_Y_AXIS     0
#define SENS_RAY_Z_AXIS     2
#define SENS_RAY_NEG_X_AXIS     3
#define SENS_RAY_NEG_Y_AXIS     4
#define SENS_RAY_NEG_Z_AXIS     5
//#define SENS_RAY_NEGATIVE_AXIS     1

/* bMessageSensor->type */
#define SENS_MESG_MESG		0
#define SENS_MESG_PROP		1

/* bArmatureSensor->type */
#define SENS_ARM_STATE_CHANGED		0
#define SENS_ARM_LIN_ERROR_BELOW	1
#define SENS_ARM_LIN_ERROR_ABOVE	2
#define SENS_ARM_ROT_ERROR_BELOW	3
#define SENS_ARM_ROT_ERROR_ABOVE	4
/* update this when adding new type */
#define SENS_ARM_MAXTYPE			4

/* sensor->type */
#define SENS_ALWAYS		0
#define SENS_TOUCH		1
#define SENS_NEAR		2
#define SENS_KEYBOARD	3
#define SENS_PROPERTY	4
#define SENS_MOUSE		5
#define SENS_COLLISION	6
#define SENS_RADAR		7
#define SENS_RANDOM     8
#define SENS_RAY        9
#define SENS_MESSAGE   10
#define SENS_JOYSTICK  11
#define SENS_ACTUATOR  12
#define SENS_DELAY     13
#define SENS_ARMATURE  14
/* sensor->flag */
#define SENS_SHOW		1
#define SENS_DEL		2
#define SENS_NEW		4
#define SENS_NOT		8
#define SENS_VISIBLE	16
#define SENS_PIN		32

/* sensor->pulse */
#define SENS_PULSE_CONT 	0
#define SENS_PULSE_REPEAT	1
//#define SENS_PULSE_ONCE 	2
#define SENS_NEG_PULSE_MODE 4

/* sensor->suppress */
#define SENS_SUPPRESS_POSITIVE (1 << 0)
#define SENS_SUPPRESS_NEGATIVE (1 << 1)

/* collision, ray sensor modes: */
/* A little bit fake: when property is active, the first bit is
 * reset. Bite me :) So we don't actually use it, so we comment it out
 * ... The reason for this is that we need to be backward compatible,
 * and have a proper default value for this thing.
 * */
/*  #define SENS_COLLISION_PROPERTY 0  */
#define SENS_COLLISION_MATERIAL 1
#define SENS_COLLISION_PULSE 2
/* ray specific mode */
/* X-Ray means that the ray will traverse objects that don't have the property/material */
#define SENS_RAY_XRAY			2

/* Some stuff for the mouse sensor Type: */
#define BL_SENS_MOUSE_LEFT_BUTTON    1
#define BL_SENS_MOUSE_MIDDLE_BUTTON  2
#define BL_SENS_MOUSE_RIGHT_BUTTON   4
#define BL_SENS_MOUSE_WHEEL_UP       5
#define BL_SENS_MOUSE_WHEEL_DOWN     6
#define BL_SENS_MOUSE_MOVEMENT       8
#define BL_SENS_MOUSE_MOUSEOVER      16
#define BL_SENS_MOUSE_MOUSEOVER_ANY	 32

#define SENS_JOY_ANY_EVENT		1

#define SENS_JOY_BUTTON		0			/* axis type */
#define SENS_JOY_BUTTON_PRESSED	0
#define SENS_JOY_BUTTON_RELEASED	1

#define SENS_JOY_AXIS			1		/* axis type */
#define SENS_JOY_X_AXIS		0
#define SENS_JOY_Y_AXIS		1
#define SENS_JOY_NEG_X_AXIS     	2
#define SENS_JOY_NEG_Y_AXIS     	3
#define SENS_JOY_PRECISION		4

#define SENS_JOY_HAT			2		/* axis type */
#define SENS_JOY_HAT_DIR		0

#define SENS_JOY_AXIS_SINGLE	3		/* axis type */


#define SENS_DELAY_REPEAT		1
// should match JOYINDEX_MAX in SCA_JoystickDefines.h */
#define SENS_JOY_MAXINDEX		8
#endif