96
108
PropertyRNA *prop;
98
static EnumPropertyItem gameproperty_type_items[] ={
99
{GPROP_BOOL, "BOOL", 0, "Boolean", ""},
100
{GPROP_INT, "INT", 0, "Integer", ""},
101
{GPROP_FLOAT, "FLOAT", 0, "Float", ""},
102
{GPROP_STRING, "STRING", 0, "String", ""},
103
{GPROP_TIME, "TIMER", 0, "Timer", ""},
104
{0, NULL, 0, NULL, NULL}};
106
110
/* Base Struct for GameProperty */
107
srna= RNA_def_struct(brna, "GameProperty", NULL);
111
srna = RNA_def_struct(brna, "GameProperty", NULL);
108
112
RNA_def_struct_ui_text(srna , "Game Property", "Game engine user defined object property");
109
113
RNA_def_struct_sdna(srna, "bProperty");
110
114
RNA_def_struct_refine_func(srna, "rna_GameProperty_refine");
112
prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
116
prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
113
117
RNA_def_property_ui_text(prop, "Name", "Available as GameObject attributes in the game engine's python API");
114
118
RNA_def_struct_name_property(srna, prop);
115
119
RNA_def_property_string_funcs(prop, NULL, NULL, "rna_GameProperty_name_set");
116
120
RNA_def_property_update(prop, NC_LOGIC, NULL);
118
prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
122
prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
119
123
RNA_def_property_enum_items(prop, gameproperty_type_items);
120
124
RNA_def_property_ui_text(prop, "Type", "");
121
125
RNA_def_property_enum_funcs(prop, NULL, "rna_GameProperty_type_set", NULL);
122
126
RNA_def_property_update(prop, NC_LOGIC, NULL);
124
prop= RNA_def_property(srna, "debug", PROP_BOOLEAN, PROP_NONE);
128
prop = RNA_def_property(srna, "show_debug", PROP_BOOLEAN, PROP_NONE);
125
129
RNA_def_property_boolean_sdna(prop, NULL, "flag", PROP_DEBUG);
126
130
RNA_def_property_ui_text(prop, "Debug", "Print debug information for this property");
127
131
RNA_def_property_update(prop, NC_LOGIC, NULL);
129
133
/* GameBooleanProperty */
130
srna= RNA_def_struct(brna, "GameBooleanProperty", "GameProperty");
134
srna = RNA_def_struct(brna, "GameBooleanProperty", "GameProperty");
131
135
RNA_def_struct_ui_text(srna , "Game Boolean Property", "Game engine user defined Boolean property");
132
136
RNA_def_struct_sdna(srna, "bProperty");
133
137
RNA_def_property_update(prop, NC_LOGIC, NULL);
135
prop= RNA_def_property(srna, "value", PROP_BOOLEAN, PROP_NONE);
139
prop = RNA_def_property(srna, "value", PROP_BOOLEAN, PROP_NONE);
136
140
RNA_def_property_boolean_sdna(prop, NULL, "data", 1);
137
141
RNA_def_property_ui_text(prop, "Value", "Property value");
138
142
RNA_def_property_update(prop, NC_LOGIC, NULL);
140
144
/* GameIntProperty */
141
srna= RNA_def_struct(brna, "GameIntProperty", "GameProperty");
145
srna = RNA_def_struct(brna, "GameIntProperty", "GameProperty");
142
146
RNA_def_struct_ui_text(srna , "Game Integer Property", "Game engine user defined integer number property");
143
147
RNA_def_struct_sdna(srna, "bProperty");
145
prop= RNA_def_property(srna, "value", PROP_INT, PROP_NONE);
149
prop = RNA_def_property(srna, "value", PROP_INT, PROP_NONE);
146
150
RNA_def_property_int_sdna(prop, NULL, "data");
147
151
RNA_def_property_ui_text(prop, "Value", "Property value");
148
152
RNA_def_property_range(prop, -10000, 10000);
149
153
RNA_def_property_update(prop, NC_LOGIC, NULL);
151
155
/* GameFloatProperty */
152
srna= RNA_def_struct(brna, "GameFloatProperty", "GameProperty");
153
RNA_def_struct_ui_text(srna, "Game Float Property", "Game engine user defined floating pointer number property");
156
srna = RNA_def_struct(brna, "GameFloatProperty", "GameProperty");
157
RNA_def_struct_ui_text(srna, "Game Float Property", "Game engine user defined floating point number property");
154
158
RNA_def_struct_sdna(srna, "bProperty");
156
prop= RNA_def_property(srna, "value", PROP_FLOAT, PROP_NONE);
157
RNA_def_property_float_sdna(prop, NULL, "data");
160
prop = RNA_def_property(srna, "value", PROP_FLOAT, PROP_NONE);
161
/* RNA_def_property_float_sdna(prop, NULL, "data"); */
158
162
RNA_def_property_ui_text(prop, "Value", "Property value");
159
163
RNA_def_property_range(prop, -10000, 10000);
160
164
RNA_def_property_float_funcs(prop, "rna_GameFloatProperty_value_get", "rna_GameFloatProperty_value_set", NULL);
161
165
RNA_def_property_update(prop, NC_LOGIC, NULL);
163
167
/* GameTimerProperty */
164
srna= RNA_def_struct(brna, "GameTimerProperty", "GameProperty");
168
srna = RNA_def_struct(brna, "GameTimerProperty", "GameProperty");
165
169
RNA_def_struct_ui_text(srna, "Game Timer Property", "Game engine user defined timer property");
166
170
RNA_def_struct_sdna(srna, "bProperty");
168
prop= RNA_def_property(srna, "value", PROP_FLOAT, PROP_NONE);
169
RNA_def_property_float_sdna(prop, NULL, "data");
172
prop = RNA_def_property(srna, "value", PROP_FLOAT, PROP_NONE);
173
/* RNA_def_property_float_sdna(prop, NULL, "data"); */
170
174
RNA_def_property_ui_text(prop, "Value", "Property value");
171
175
RNA_def_property_range(prop, -10000, 10000);
172
176
RNA_def_property_float_funcs(prop, "rna_GameFloatProperty_value_get", "rna_GameFloatProperty_value_set", NULL);
173
177
RNA_def_property_update(prop, NC_LOGIC, NULL);
175
179
/* GameStringProperty */
176
srna= RNA_def_struct(brna, "GameStringProperty", "GameProperty");
180
srna = RNA_def_struct(brna, "GameStringProperty", "GameProperty");
177
181
RNA_def_struct_ui_text(srna, "Game String Property", "Game engine user defined text string property");
178
182
RNA_def_struct_sdna(srna, "bProperty");
180
prop= RNA_def_property(srna, "value", PROP_STRING, PROP_NONE);
184
prop = RNA_def_property(srna, "value", PROP_STRING, PROP_NONE);
181
185
RNA_def_property_string_sdna(prop, NULL, "poin");
182
186
RNA_def_property_string_maxlength(prop, MAX_PROPSTRING);
183
187
RNA_def_property_ui_text(prop, "Value", "Property value");