~ubuntu-branches/ubuntu/trusty/blender/trusty

« back to all changes in this revision

Viewing changes to source/blender/makesrna/intern/rna_smoke.c

  • Committer: Package Import Robot
  • Author(s): Jeremy Bicha
  • Date: 2013-03-06 12:08:47 UTC
  • mfrom: (1.5.1) (14.1.8 experimental)
  • Revision ID: package-import@ubuntu.com-20130306120847-frjfaryb2zrotwcg
Tags: 2.66a-1ubuntu1
* Resynchronize with Debian (LP: #1076930, #1089256, #1052743, #999024,
  #1122888, #1147084)
* debian/control:
  - Lower build-depends on libavcodec-dev since we're not
    doing the libav9 transition in Ubuntu yet

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17
17
 *
18
18
 * Contributor(s): Daniel Genrich
 
19
 *                 Blender Foundation
19
20
 *
20
21
 * ***** END GPL LICENSE BLOCK *****
21
22
 */
50
51
#include "BKE_depsgraph.h"
51
52
#include "BKE_particle.h"
52
53
 
 
54
#include "smoke_API.h"
 
55
 
53
56
 
54
57
static void rna_Smoke_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
55
58
{
62
65
        DAG_scene_sort(bmain, scene);
63
66
}
64
67
 
 
68
static void rna_Smoke_resetCache(Main *bmain, Scene *scene, PointerRNA *ptr)
 
69
{
 
70
        SmokeDomainSettings *settings = (SmokeDomainSettings *)ptr->data;
 
71
        if (settings->smd && settings->smd->domain)
 
72
                settings->point_cache[0]->flag |= PTCACHE_OUTDATED;
 
73
        DAG_id_tag_update(ptr->id.data, OB_RECALC_DATA);
 
74
}
 
75
 
65
76
static void rna_Smoke_reset(Main *bmain, Scene *scene, PointerRNA *ptr)
66
77
{
67
 
        SmokeDomainSettings *settings = (SmokeDomainSettings*)ptr->data;
 
78
        SmokeDomainSettings *settings = (SmokeDomainSettings *)ptr->data;
68
79
 
69
80
        smokeModifier_reset(settings->smd);
70
 
 
71
 
        if (settings->smd && settings->smd->domain)
72
 
                settings->point_cache[0]->flag |= PTCACHE_OUTDATED;
 
81
        rna_Smoke_resetCache(bmain, scene, ptr);
73
82
 
74
83
        rna_Smoke_update(bmain, scene, ptr);
75
84
}
76
85
 
77
86
static void rna_Smoke_reset_dependancy(Main *bmain, Scene *scene, PointerRNA *ptr)
78
87
{
79
 
        SmokeDomainSettings *settings = (SmokeDomainSettings*)ptr->data;
 
88
        SmokeDomainSettings *settings = (SmokeDomainSettings *)ptr->data;
80
89
 
81
90
        smokeModifier_reset(settings->smd);
82
91
 
88
97
 
89
98
static char *rna_SmokeDomainSettings_path(PointerRNA *ptr)
90
99
{
91
 
        SmokeDomainSettings *settings = (SmokeDomainSettings*)ptr->data;
 
100
        SmokeDomainSettings *settings = (SmokeDomainSettings *)ptr->data;
92
101
        ModifierData *md = (ModifierData *)settings->smd;
93
102
 
94
103
        return BLI_sprintfN("modifiers[\"%s\"].domain_settings", md->name);
96
105
 
97
106
static char *rna_SmokeFlowSettings_path(PointerRNA *ptr)
98
107
{
99
 
        SmokeFlowSettings *settings = (SmokeFlowSettings*)ptr->data;
 
108
        SmokeFlowSettings *settings = (SmokeFlowSettings *)ptr->data;
100
109
        ModifierData *md = (ModifierData *)settings->smd;
101
110
 
102
111
        return BLI_sprintfN("modifiers[\"%s\"].flow_settings", md->name);
104
113
 
105
114
static char *rna_SmokeCollSettings_path(PointerRNA *ptr)
106
115
{
107
 
        SmokeCollSettings *settings = (SmokeCollSettings*)ptr->data;
 
116
        SmokeCollSettings *settings = (SmokeCollSettings *)ptr->data;
108
117
        ModifierData *md = (ModifierData *)settings->smd;
109
118
 
110
119
        return BLI_sprintfN("modifiers[\"%s\"].coll_settings", md->name);
111
120
}
112
121
 
 
122
static int rna_SmokeModifier_density_get_length(PointerRNA *ptr, int length[RNA_MAX_ARRAY_DIMENSION])
 
123
{
 
124
        SmokeDomainSettings *settings = (SmokeDomainSettings *)ptr->data;
 
125
 
 
126
        if (settings->fluid) {
 
127
                float *density = smoke_get_density(settings->fluid);
 
128
                unsigned int size = settings->res[0] * settings->res[1] * settings->res[2];
 
129
 
 
130
                if (density)
 
131
                        length[0] = size;
 
132
                else
 
133
                        length[0] = 0;
 
134
        }
 
135
        else {
 
136
                length[0] = 0; /* No smoke domain created yet */
 
137
        }
 
138
 
 
139
        return length[0];
 
140
}
 
141
 
 
142
static void rna_SmokeModifier_density_get(PointerRNA *ptr, float *values)
 
143
{
 
144
        SmokeDomainSettings *settings = (SmokeDomainSettings *)ptr->data;
 
145
        float *density = smoke_get_density(settings->fluid);
 
146
        unsigned int size = settings->res[0] * settings->res[1] * settings->res[2];
 
147
 
 
148
        memcpy(values, density, size * sizeof(float));
 
149
}
 
150
 
 
151
static void rna_SmokeFlow_density_vgroup_get(PointerRNA *ptr, char *value)
 
152
{
 
153
        SmokeFlowSettings *flow = (SmokeFlowSettings *)ptr->data;
 
154
        rna_object_vgroup_name_index_get(ptr, value, flow->vgroup_density);
 
155
}
 
156
 
 
157
static int rna_SmokeFlow_density_vgroup_length(PointerRNA *ptr)
 
158
{
 
159
        SmokeFlowSettings *flow = (SmokeFlowSettings *)ptr->data;
 
160
        return rna_object_vgroup_name_index_length(ptr, flow->vgroup_density);
 
161
}
 
162
 
 
163
static void rna_SmokeFlow_density_vgroup_set(PointerRNA *ptr, const char *value)
 
164
{
 
165
        SmokeFlowSettings *flow = (SmokeFlowSettings *)ptr->data;
 
166
        rna_object_vgroup_name_index_set(ptr, value, &flow->vgroup_density);
 
167
}
 
168
 
 
169
static void rna_SmokeFlow_uvlayer_set(PointerRNA *ptr, const char *value)
 
170
{
 
171
        SmokeFlowSettings *flow = (SmokeFlowSettings *)ptr->data;
 
172
        rna_object_uvlayer_name_set(ptr, value, flow->uvlayer_name, sizeof(flow->uvlayer_name));
 
173
}
 
174
 
113
175
#else
114
176
 
115
177
static void rna_def_smoke_domain_settings(BlenderRNA *brna)
118
180
        PropertyRNA *prop;
119
181
 
120
182
        static EnumPropertyItem prop_noise_type_items[] = {
121
 
                                {MOD_SMOKE_NOISEWAVE, "NOISEWAVE", 0, "Wavelet", ""},
 
183
                {MOD_SMOKE_NOISEWAVE, "NOISEWAVE", 0, "Wavelet", ""},
122
184
#ifdef WITH_FFTW3
123
 
                                {MOD_SMOKE_NOISEFFT, "NOISEFFT", 0, "FFT", ""},
 
185
                {MOD_SMOKE_NOISEFFT, "NOISEFFT", 0, "FFT", ""},
124
186
#endif
125
 
                        /*      {MOD_SMOKE_NOISECURL, "NOISECURL", 0, "Curl", ""}, */
126
 
                                {0, NULL, 0, NULL, NULL}};
 
187
                /*  {MOD_SMOKE_NOISECURL, "NOISECURL", 0, "Curl", ""}, */
 
188
                {0, NULL, 0, NULL, NULL}
 
189
        };
127
190
 
128
191
        static EnumPropertyItem smoke_cache_comp_items[] = {
129
192
                {SM_CACHE_LIGHT, "CACHELIGHT", 0, "Light", "Fast but not so effective compression"},
130
193
                {SM_CACHE_HEAVY, "CACHEHEAVY", 0, "Heavy", "Effective but slow compression"},
131
 
                {0, NULL, 0, NULL, NULL}};
 
194
                {0, NULL, 0, NULL, NULL}
 
195
        };
132
196
 
133
197
        static EnumPropertyItem smoke_domain_colli_items[] = {
134
198
                {SM_BORDER_OPEN, "BORDEROPEN", 0, "Open", "Smoke doesn't collide with any border"},
135
199
                {SM_BORDER_VERTICAL, "BORDERVERTICAL", 0, "Vertically Open",
136
 
                                     "Smoke doesn't collide with top and bottom sides"},
 
200
                 "Smoke doesn't collide with top and bottom sides"},
137
201
                {SM_BORDER_CLOSED, "BORDERCLOSED", 0, "Collide All", "Smoke collides with every side"},
138
 
                {0, NULL, 0, NULL, NULL}};
 
202
                {0, NULL, 0, NULL, NULL}
 
203
        };
139
204
 
140
205
        srna = RNA_def_struct(brna, "SmokeDomainSettings", NULL);
141
206
        RNA_def_struct_ui_text(srna, "Domain Settings", "Smoke domain settings");
148
213
        RNA_def_property_ui_range(prop, 24, 512, 2, 0);
149
214
        RNA_def_property_ui_text(prop, "Max Res", "Maximal resolution used in the fluid domain");
150
215
        RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
151
 
        RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Smoke_reset");
 
216
        RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset");
152
217
 
153
218
        prop = RNA_def_property(srna, "amplify", PROP_INT, PROP_NONE);
154
219
        RNA_def_property_int_sdna(prop, NULL, "amplify");
156
221
        RNA_def_property_ui_range(prop, 1, 10, 1, 0);
157
222
        RNA_def_property_ui_text(prop, "Amplification", "Enhance the resolution of smoke by this factor using noise");
158
223
        RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
159
 
        RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Smoke_reset");
 
224
        RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset");
160
225
 
161
226
        prop = RNA_def_property(srna, "use_high_resolution", PROP_BOOLEAN, PROP_NONE);
162
227
        RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_SMOKE_HIGHRES);
163
228
        RNA_def_property_ui_text(prop, "High res", "Enable high resolution (using amplification)");
164
229
        RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
165
 
        RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Smoke_reset");
 
230
        RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset");
166
231
 
167
232
        prop = RNA_def_property(srna, "show_high_resolution", PROP_BOOLEAN, PROP_NONE);
168
233
        RNA_def_property_boolean_sdna(prop, NULL, "viewsettings", MOD_SMOKE_VIEW_SHOWBIG);
169
234
        RNA_def_property_ui_text(prop, "Show High Resolution", "Show high resolution (using amplification)");
170
 
        RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
 
235
        RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
171
236
 
172
237
        prop = RNA_def_property(srna, "noise_type", PROP_ENUM, PROP_NONE);
173
238
        RNA_def_property_enum_sdna(prop, NULL, "noise");
174
239
        RNA_def_property_enum_items(prop, prop_noise_type_items);
175
240
        RNA_def_property_ui_text(prop, "Noise Method", "Noise method which is used for creating the high resolution");
176
241
        RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
177
 
        RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Smoke_reset");
 
242
        RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset");
178
243
 
179
244
        prop = RNA_def_property(srna, "alpha", PROP_FLOAT, PROP_NONE);
180
245
        RNA_def_property_float_sdna(prop, NULL, "alpha");
182
247
        RNA_def_property_ui_range(prop, -5.0, 5.0, 0.02, 5);
183
248
        RNA_def_property_ui_text(prop, "Density",
184
249
                                 "How much density affects smoke motion (higher value results in faster rising smoke)");
185
 
        RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Smoke_reset");
 
250
        RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_resetCache");
186
251
 
187
252
        prop = RNA_def_property(srna, "beta", PROP_FLOAT, PROP_NONE);
188
253
        RNA_def_property_float_sdna(prop, NULL, "beta");
190
255
        RNA_def_property_ui_range(prop, -5.0, 5.0, 0.02, 5);
191
256
        RNA_def_property_ui_text(prop, "Heat",
192
257
                                 "How much heat affects smoke motion (higher value results in faster rising smoke)");
193
 
        RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Smoke_reset");
 
258
        RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_resetCache");
194
259
 
195
260
        prop = RNA_def_property(srna, "collision_group", PROP_POINTER, PROP_NONE);
196
261
        RNA_def_property_pointer_sdna(prop, NULL, "coll_group");
197
262
        RNA_def_property_struct_type(prop, "Group");
198
263
        RNA_def_property_flag(prop, PROP_EDITABLE);
199
264
        RNA_def_property_ui_text(prop, "Collision Group", "Limit collisions to this group");
200
 
        RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Smoke_reset_dependancy");
 
265
        RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset_dependancy");
201
266
 
202
267
        prop = RNA_def_property(srna, "fluid_group", PROP_POINTER, PROP_NONE);
203
268
        RNA_def_property_pointer_sdna(prop, NULL, "fluid_group");
204
269
        RNA_def_property_struct_type(prop, "Group");
205
270
        RNA_def_property_flag(prop, PROP_EDITABLE);
206
271
        RNA_def_property_ui_text(prop, "Fluid Group", "Limit fluid objects to this group");
207
 
        RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Smoke_reset_dependancy");
 
272
        RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset_dependancy");
208
273
 
209
274
        prop = RNA_def_property(srna, "effector_group", PROP_POINTER, PROP_NONE);
210
275
        RNA_def_property_pointer_sdna(prop, NULL, "eff_group");
211
276
        RNA_def_property_struct_type(prop, "Group");
212
277
        RNA_def_property_flag(prop, PROP_EDITABLE);
213
278
        RNA_def_property_ui_text(prop, "Effector Group", "Limit effectors to this group");
214
 
        RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Smoke_reset_dependancy");
 
279
        RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset_dependancy");
215
280
 
216
281
        prop = RNA_def_property(srna, "strength", PROP_FLOAT, PROP_NONE);
217
282
        RNA_def_property_float_sdna(prop, NULL, "strength");
218
283
        RNA_def_property_range(prop, 0.0, 10.0);
219
284
        RNA_def_property_ui_range(prop, 0.0, 10.0, 1, 2);
220
285
        RNA_def_property_ui_text(prop, "Strength", "Strength of noise");
221
 
        RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Smoke_reset");
 
286
        RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_resetCache");
222
287
 
223
288
        prop = RNA_def_property(srna, "dissolve_speed", PROP_INT, PROP_NONE);
224
289
        RNA_def_property_int_sdna(prop, NULL, "diss_speed");
225
290
        RNA_def_property_range(prop, 1.0, 10000.0);
226
291
        RNA_def_property_ui_range(prop, 1.0, 10000.0, 1, 0);
227
292
        RNA_def_property_ui_text(prop, "Dissolve Speed", "Dissolve Speed");
228
 
        RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Smoke_reset");
 
293
        RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_resetCache");
229
294
 
230
295
        prop = RNA_def_property(srna, "use_dissolve_smoke", PROP_BOOLEAN, PROP_NONE);
231
296
        RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_SMOKE_DISSOLVE);
232
297
        RNA_def_property_ui_text(prop, "Dissolve Smoke", "Enable smoke to disappear over time");
233
 
        RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Smoke_reset");
 
298
        RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_resetCache");
234
299
 
235
300
        prop = RNA_def_property(srna, "use_dissolve_smoke_log", PROP_BOOLEAN, PROP_NONE);
236
301
        RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_SMOKE_DISSOLVE_LOG);
237
302
        RNA_def_property_ui_text(prop, "Logarithmic dissolve", "Using 1/x ");
238
 
        RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Smoke_reset");
 
303
        RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_resetCache");
239
304
 
240
305
        prop = RNA_def_property(srna, "point_cache", PROP_POINTER, PROP_NONE);
241
306
        RNA_def_property_flag(prop, PROP_NEVER_NULL);
252
317
        RNA_def_property_enum_items(prop, smoke_domain_colli_items);
253
318
        RNA_def_property_ui_text(prop, "Border Collisions",
254
319
                                 "Select which domain border will be treated as collision object");
255
 
        RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Smoke_reset");
 
320
        RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset");
256
321
 
257
322
        prop = RNA_def_property(srna, "effector_weights", PROP_POINTER, PROP_NONE);
258
323
        RNA_def_property_struct_type(prop, "EffectorWeights");
261
326
 
262
327
        prop = RNA_def_property(srna, "smooth_emitter", PROP_BOOLEAN, PROP_NONE);
263
328
        RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_SMOKE_HIGH_SMOOTH);
264
 
        RNA_def_property_ui_text(prop, "Smooth Emitter", "Smoothen emitted smoke to avoid blockiness");
265
 
        RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Smoke_reset");
 
329
        RNA_def_property_ui_text(prop, "Smooth Emitter", "Smooth emitted smoke to avoid blockiness");
 
330
        RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_resetCache");
266
331
 
267
332
        prop = RNA_def_property(srna, "time_scale", PROP_FLOAT, PROP_NONE);
268
333
        RNA_def_property_float_sdna(prop, NULL, "time_scale");
269
334
        RNA_def_property_range(prop, 0.2, 1.5);
270
335
        RNA_def_property_ui_range(prop, 0.2, 1.5, 0.02, 5);
271
336
        RNA_def_property_ui_text(prop, "Time Scale", "Adjust simulation speed");
272
 
        RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Smoke_reset");
 
337
        RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_resetCache");
273
338
 
274
339
        prop = RNA_def_property(srna, "vorticity", PROP_FLOAT, PROP_NONE);
275
340
        RNA_def_property_float_sdna(prop, NULL, "vorticity");
276
341
        RNA_def_property_range(prop, 0.01, 4.0);
277
342
        RNA_def_property_ui_range(prop, 0.01, 4.0, 0.02, 5);
278
343
        RNA_def_property_ui_text(prop, "Vorticity", "Amount of turbulence/rotation in fluid");
279
 
        RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Smoke_reset");
280
 
 
 
344
        RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_resetCache");
 
345
 
 
346
        prop = RNA_def_property(srna, "density", PROP_FLOAT, PROP_NONE);
 
347
        RNA_def_property_array(prop, 32);
 
348
        RNA_def_property_flag(prop, PROP_DYNAMIC);
 
349
        RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 
350
        RNA_def_property_dynamic_array_funcs(prop, "rna_SmokeModifier_density_get_length");
 
351
        RNA_def_property_float_funcs(prop, "rna_SmokeModifier_density_get", NULL, NULL);
 
352
        RNA_def_property_ui_text(prop, "Density", "Smoke density");
 
353
 
 
354
        prop = RNA_def_property(srna, "cell_size", PROP_FLOAT, PROP_XYZ); /* can change each frame when using adaptive domain */
 
355
        RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 
356
        RNA_def_property_ui_text(prop, "cell_size", "Cell Size");
 
357
 
 
358
        prop = RNA_def_property(srna, "start_point", PROP_FLOAT, PROP_XYZ); /* can change each frame when using adaptive domain */
 
359
        RNA_def_property_float_sdna(prop, NULL, "p0");
 
360
        RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 
361
        RNA_def_property_ui_text(prop, "p0", "Start point");
 
362
 
 
363
        prop = RNA_def_property(srna, "domain_resolution", PROP_INT, PROP_XYZ); /* can change each frame when using adaptive domain */
 
364
        RNA_def_property_int_sdna(prop, NULL, "res");
 
365
        RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 
366
        RNA_def_property_ui_text(prop, "res", "Smoke Grid Resolution");
 
367
 
 
368
        prop = RNA_def_property(srna, "burning_rate", PROP_FLOAT, PROP_NONE);
 
369
        RNA_def_property_range(prop, 0.01, 4.0);
 
370
        RNA_def_property_ui_range(prop, 0.01, 2.0, 1.0, 5);
 
371
        RNA_def_property_ui_text(prop, "Speed", "Speed of the burning reaction (use larger values for smaller flame)");
 
372
        RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_resetCache");
 
373
 
 
374
        prop = RNA_def_property(srna, "flame_smoke", PROP_FLOAT, PROP_NONE);
 
375
        RNA_def_property_range(prop, 0.0, 8.0);
 
376
        RNA_def_property_ui_range(prop, 0.0, 4.0, 1.0, 5);
 
377
        RNA_def_property_ui_text(prop, "Smoke", "Amount of smoke created by burning fuel");
 
378
        RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_resetCache");
 
379
 
 
380
        prop = RNA_def_property(srna, "flame_vorticity", PROP_FLOAT, PROP_NONE);
 
381
        RNA_def_property_range(prop, 0.0, 2.0);
 
382
        RNA_def_property_ui_range(prop, 0.0, 1.0, 1.0, 5);
 
383
        RNA_def_property_ui_text(prop, "Vorticity", "Additional vorticity for the flames");
 
384
        RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_resetCache");
 
385
 
 
386
        prop = RNA_def_property(srna, "flame_ignition", PROP_FLOAT, PROP_NONE);
 
387
        RNA_def_property_range(prop, 0.5, 5.0);
 
388
        RNA_def_property_ui_range(prop, 0.5, 2.5, 1.0, 5);
 
389
        RNA_def_property_ui_text(prop, "Ignition", "Minimum temperature of flames");
 
390
        RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_resetCache");
 
391
 
 
392
        prop = RNA_def_property(srna, "flame_max_temp", PROP_FLOAT, PROP_NONE);
 
393
        RNA_def_property_range(prop, 1.0, 10.0);
 
394
        RNA_def_property_ui_range(prop, 1.0, 5.0, 1.0, 5);
 
395
        RNA_def_property_ui_text(prop, "Maximum", "Maximum temperature of flames");
 
396
        RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_resetCache");
 
397
 
 
398
        prop = RNA_def_property(srna, "flame_smoke_color", PROP_FLOAT, PROP_COLOR_GAMMA);
 
399
        RNA_def_property_array(prop, 3);
 
400
        RNA_def_property_ui_text(prop, "Smoke Color", "Color of smoke emitted from burning fuel");
 
401
        RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_resetCache");
 
402
 
 
403
        prop = RNA_def_property(srna, "use_adaptive_domain", PROP_BOOLEAN, PROP_NONE);
 
404
        RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_SMOKE_ADAPTIVE_DOMAIN);
 
405
        RNA_def_property_ui_text(prop, "Adaptive Domain", "Adapt simulation resolution and size to fluid");
 
406
        RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 
407
        RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset");
 
408
 
 
409
        prop = RNA_def_property(srna, "additional_res", PROP_INT, PROP_NONE);
 
410
        RNA_def_property_int_sdna(prop, NULL, "adapt_res");
 
411
        RNA_def_property_range(prop, 0, 512);
 
412
        RNA_def_property_ui_range(prop, 0, 512, 2, 0);
 
413
        RNA_def_property_ui_text(prop, "Additional", "Maximum number of additional cells");
 
414
        RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_resetCache");
 
415
 
 
416
        prop = RNA_def_property(srna, "adapt_margin", PROP_INT, PROP_NONE);
 
417
        RNA_def_property_int_sdna(prop, NULL, "adapt_margin");
 
418
        RNA_def_property_range(prop, 2, 24);
 
419
        RNA_def_property_ui_range(prop, 2, 24, 2, 0);
 
420
        RNA_def_property_ui_text(prop, "Margin", "Margin added around fluid to minimize boundary interference");
 
421
        RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_resetCache");
 
422
 
 
423
        prop = RNA_def_property(srna, "adapt_threshold", PROP_FLOAT, PROP_NONE);
 
424
        RNA_def_property_range(prop, 0.01, 0.5);
 
425
        RNA_def_property_ui_range(prop, 0.01, 0.5, 1.0, 5);
 
426
        RNA_def_property_ui_text(prop, "Threshold",
 
427
                                 "Maximum amount of fluid cell can contain before it is considered empty");
 
428
        RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_resetCache");
281
429
}
282
430
 
283
431
static void rna_def_smoke_flow_settings(BlenderRNA *brna)
285
433
        StructRNA *srna;
286
434
        PropertyRNA *prop;
287
435
 
 
436
        static EnumPropertyItem smoke_flow_types[] = {
 
437
                {MOD_SMOKE_FLOW_TYPE_OUTFLOW, "OUTFLOW", 0, "Outflow", "Delete smoke from simulation"},
 
438
                {MOD_SMOKE_FLOW_TYPE_SMOKE, "SMOKE", 0, "Smoke", "Add smoke"},
 
439
                {MOD_SMOKE_FLOW_TYPE_SMOKEFIRE, "BOTH", 0, "Fire + Smoke", "Add fire and smoke"},
 
440
                {MOD_SMOKE_FLOW_TYPE_FIRE, "FIRE", 0, "Fire", "Add fire"},
 
441
                {0, NULL, 0, NULL, NULL}
 
442
        };
 
443
 
 
444
        static EnumPropertyItem smoke_flow_sources[] = {
 
445
                {MOD_SMOKE_FLOW_SOURCE_PARTICLES, "PARTICLES", ICON_PARTICLES, "Particle System", "Emit smoke from particles"},
 
446
                {MOD_SMOKE_FLOW_SOURCE_MESH, "MESH", ICON_META_CUBE, "Mesh", "Emit smoke from mesh surface or volume"},
 
447
                {0, NULL, 0, NULL, NULL}
 
448
        };
 
449
 
 
450
        static EnumPropertyItem smoke_flow_texture_types[] = {
 
451
                {MOD_SMOKE_FLOW_TEXTURE_MAP_AUTO, "AUTO", 0, "Generated", "Generated coordinates centered to flow object"},
 
452
                {MOD_SMOKE_FLOW_TEXTURE_MAP_UV, "UV", 0, "UV", "Use UV layer for texture coordinates"},
 
453
                {0, NULL, 0, NULL, NULL}
 
454
        };
 
455
 
288
456
        srna = RNA_def_struct(brna, "SmokeFlowSettings", NULL);
289
457
        RNA_def_struct_ui_text(srna, "Flow Settings", "Smoke flow settings");
290
458
        RNA_def_struct_sdna(srna, "SmokeFlowSettings");
292
460
 
293
461
        prop = RNA_def_property(srna, "density", PROP_FLOAT, PROP_NONE);
294
462
        RNA_def_property_float_sdna(prop, NULL, "density");
295
 
        RNA_def_property_range(prop, 0.001, 1);
296
 
        RNA_def_property_ui_range(prop, 0.001, 1.0, 1.0, 4);
 
463
        RNA_def_property_range(prop, 0.0, 1);
 
464
        RNA_def_property_ui_range(prop, 0.0, 1.0, 1.0, 4);
297
465
        RNA_def_property_ui_text(prop, "Density", "");
298
 
        RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Smoke_reset");
 
466
        RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset");
 
467
 
 
468
        prop = RNA_def_property(srna, "smoke_color", PROP_FLOAT, PROP_COLOR_GAMMA);
 
469
        RNA_def_property_float_sdna(prop, NULL, "color");
 
470
        RNA_def_property_array(prop, 3);
 
471
        RNA_def_property_ui_text(prop, "Smoke Color", "Color of smoke");
 
472
        RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset");
 
473
 
 
474
        prop = RNA_def_property(srna, "fuel_amount", PROP_FLOAT, PROP_NONE);
 
475
        RNA_def_property_range(prop, 0.0, 10);
 
476
        RNA_def_property_ui_range(prop, 0.0, 5.0, 1.0, 4);
 
477
        RNA_def_property_ui_text(prop, "Flame Rate", "");
 
478
        RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset");
299
479
 
300
480
        prop = RNA_def_property(srna, "temperature", PROP_FLOAT, PROP_NONE);
301
481
        RNA_def_property_float_sdna(prop, NULL, "temp");
302
482
        RNA_def_property_range(prop, -10, 10);
303
483
        RNA_def_property_ui_range(prop, -10, 10, 1, 1);
304
484
        RNA_def_property_ui_text(prop, "Temp. Diff.", "Temperature difference to ambient temperature");
305
 
        RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Smoke_reset");
 
485
        RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset");
306
486
        
307
487
        prop = RNA_def_property(srna, "particle_system", PROP_POINTER, PROP_NONE);
308
488
        RNA_def_property_pointer_sdna(prop, NULL, "psys");
311
491
        RNA_def_property_ui_text(prop, "Particle Systems", "Particle systems emitted from the object");
312
492
        RNA_def_property_update(prop, 0, "rna_Smoke_reset_dependancy");
313
493
 
314
 
        prop = RNA_def_property(srna, "use_outflow", PROP_BOOLEAN, PROP_NONE);
315
 
        RNA_def_property_boolean_sdna(prop, NULL, "type", MOD_SMOKE_FLOW_TYPE_OUTFLOW);
316
 
        RNA_def_property_ui_text(prop, "Outflow", "Delete smoke from simulation");
317
 
        RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Smoke_reset");
 
494
        prop = RNA_def_property(srna, "smoke_flow_type", PROP_ENUM, PROP_NONE);
 
495
        RNA_def_property_enum_sdna(prop, NULL, "type");
 
496
        RNA_def_property_enum_items(prop, smoke_flow_types);
 
497
        RNA_def_property_ui_text(prop, "Flow Type", "Change how flow affects the simulation");
 
498
        RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset");
 
499
 
 
500
        prop = RNA_def_property(srna, "smoke_flow_source", PROP_ENUM, PROP_NONE);
 
501
        RNA_def_property_enum_sdna(prop, NULL, "source");
 
502
        RNA_def_property_enum_items(prop, smoke_flow_sources);
 
503
        RNA_def_property_ui_text(prop, "Source", "Change how smoke is emitted");
 
504
        RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset");
318
505
 
319
506
        prop = RNA_def_property(srna, "use_absolute", PROP_BOOLEAN, PROP_NONE);
320
507
        RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_SMOKE_FLOW_ABSOLUTE);
321
508
        RNA_def_property_ui_text(prop, "Absolute Density", "Only allow given density value in emitter area");
322
 
        RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Smoke_reset");
 
509
        RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset");
323
510
 
324
511
        prop = RNA_def_property(srna, "initial_velocity", PROP_BOOLEAN, PROP_NONE);
325
512
        RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_SMOKE_FLOW_INITVELOCITY);
326
 
        RNA_def_property_ui_text(prop, "Initial Velocity", "Smoke inherits its velocity from the emitter particle");
327
 
        RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Smoke_reset");
 
513
        RNA_def_property_ui_text(prop, "Initial Velocity", "Smoke has some initial velocity when it is emitted");
 
514
        RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset");
328
515
 
329
516
        prop = RNA_def_property(srna, "velocity_factor", PROP_FLOAT, PROP_NONE);
330
517
        RNA_def_property_float_sdna(prop, NULL, "vel_multi");
331
518
        RNA_def_property_range(prop, -2.0, 2.0);
332
519
        RNA_def_property_ui_range(prop, -2.0, 2.0, 0.05, 5);
333
 
        RNA_def_property_ui_text(prop, "Multiplier", "Multiplier to adjust velocity passed to smoke");
334
 
        RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Smoke_reset");
 
520
        RNA_def_property_ui_text(prop, "Source", "Multiplier of source velocity passed to smoke");
 
521
        RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset");
 
522
 
 
523
        prop = RNA_def_property(srna, "velocity_normal", PROP_FLOAT, PROP_NONE);
 
524
        RNA_def_property_float_sdna(prop, NULL, "vel_normal");
 
525
        RNA_def_property_range(prop, -2.0, 2.0);
 
526
        RNA_def_property_ui_range(prop, -2.0, 2.0, 0.05, 5);
 
527
        RNA_def_property_ui_text(prop, "Normal", "Amount of normal directional velocity");
 
528
        RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset");
 
529
 
 
530
        prop = RNA_def_property(srna, "velocity_random", PROP_FLOAT, PROP_NONE);
 
531
        RNA_def_property_float_sdna(prop, NULL, "vel_random");
 
532
        RNA_def_property_range(prop, 0.0, 2.0);
 
533
        RNA_def_property_ui_range(prop, 0.0, 2.0, 0.05, 5);
 
534
        RNA_def_property_ui_text(prop, "Random", "Amount of random velocity");
 
535
        RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset");
 
536
 
 
537
        prop = RNA_def_property(srna, "volume_density", PROP_FLOAT, PROP_NONE);
 
538
        RNA_def_property_range(prop, 0.0, 1.0);
 
539
        RNA_def_property_ui_range(prop, 0.0, 1.0, 0.05, 5);
 
540
        RNA_def_property_ui_text(prop, "Volume", "Factor for smoke emitted from inside the mesh volume");
 
541
        RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset");
 
542
 
 
543
        prop = RNA_def_property(srna, "surface_distance", PROP_FLOAT, PROP_NONE);
 
544
        RNA_def_property_range(prop, 0.5, 10.0);
 
545
        RNA_def_property_ui_range(prop, 0.5, 5.0, 0.05, 5);
 
546
        RNA_def_property_ui_text(prop, "Surface", "Maximum distance from mesh surface to emit smoke");
 
547
        RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset");
 
548
 
 
549
        prop = RNA_def_property(srna, "density_vertex_group", PROP_STRING, PROP_NONE);
 
550
        RNA_def_property_string_funcs(prop, "rna_SmokeFlow_density_vgroup_get",
 
551
                                      "rna_SmokeFlow_density_vgroup_length",
 
552
                                      "rna_SmokeFlow_density_vgroup_set");
 
553
        RNA_def_property_ui_text(prop, "Vertex Group",
 
554
                                 "Name of vertex group which determines surface emission rate");
 
555
        RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset");
 
556
 
 
557
        prop = RNA_def_property(srna, "use_texture", PROP_BOOLEAN, PROP_NONE);
 
558
        RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_SMOKE_FLOW_TEXTUREEMIT);
 
559
        RNA_def_property_ui_text(prop, "Use Texture", "Use a texture to control emission strength");
 
560
        RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset");
 
561
 
 
562
        prop = RNA_def_property(srna, "texture_map_type", PROP_ENUM, PROP_NONE);
 
563
        RNA_def_property_enum_sdna(prop, NULL, "texture_type");
 
564
        RNA_def_property_enum_items(prop, smoke_flow_texture_types);
 
565
        RNA_def_property_ui_text(prop, "Mapping", "Texture mapping type");
 
566
        RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset");
 
567
 
 
568
        prop = RNA_def_property(srna, "uv_layer", PROP_STRING, PROP_NONE);
 
569
        RNA_def_property_string_sdna(prop, NULL, "uvlayer_name");
 
570
        RNA_def_property_ui_text(prop, "UV Map", "UV map name");
 
571
        RNA_def_property_string_funcs(prop, NULL, NULL, "rna_SmokeFlow_uvlayer_set");
 
572
        RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset");
 
573
 
 
574
        prop = RNA_def_property(srna, "noise_texture", PROP_POINTER, PROP_NONE);
 
575
        RNA_def_property_flag(prop, PROP_EDITABLE);
 
576
        RNA_def_property_ui_text(prop, "Texture", "Texture that controls emission strength");
 
577
        RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset");
 
578
 
 
579
        prop = RNA_def_property(srna, "texture_size", PROP_FLOAT, PROP_NONE);
 
580
        RNA_def_property_range(prop, 0.01, 10.0);
 
581
        RNA_def_property_ui_range(prop, 0.1, 5.0, 0.05, 5);
 
582
        RNA_def_property_ui_text(prop, "Size", "Size of texture mapping");
 
583
        RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset");
 
584
 
 
585
        prop = RNA_def_property(srna, "texture_offset", PROP_FLOAT, PROP_NONE);
 
586
        RNA_def_property_range(prop, 0.0, 200.0);
 
587
        RNA_def_property_ui_range(prop, 0.0, 100.0, 0.05, 5);
 
588
        RNA_def_property_ui_text(prop, "Offset", "Z-offset of texture mapping");
 
589
        RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset");
335
590
}
336
591
 
337
592
static void rna_def_smoke_coll_settings(BlenderRNA *brna)
338
593
{
 
594
        static EnumPropertyItem smoke_coll_type_items[] = {
 
595
                {SM_COLL_STATIC, "COLLSTATIC", 0, "Static", "Non moving obstacle"},
 
596
                {SM_COLL_RIGID, "COLLRIGID", 0, "Rigid", "Rigid obstacle"},
 
597
                {SM_COLL_ANIMATED, "COLLANIMATED", 0, "Animated", "Animated obstacle"},
 
598
                {0, NULL, 0, NULL, NULL}
 
599
        };
 
600
 
339
601
        StructRNA *srna;
 
602
        PropertyRNA *prop;
340
603
 
341
604
        srna = RNA_def_struct(brna, "SmokeCollSettings", NULL);
342
605
        RNA_def_struct_ui_text(srna, "Collision Settings", "Smoke collision settings");
343
606
        RNA_def_struct_sdna(srna, "SmokeCollSettings");
344
607
        RNA_def_struct_path_func(srna, "rna_SmokeCollSettings_path");
 
608
 
 
609
        prop = RNA_def_property(srna, "collision_type", PROP_ENUM, PROP_NONE);
 
610
        RNA_def_property_enum_sdna(prop, NULL, "type");
 
611
        RNA_def_property_enum_items(prop, smoke_coll_type_items);
 
612
        RNA_def_property_ui_text(prop, "Collision type", "Collision type");
 
613
        RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset");
345
614
}
346
615
 
347
616
void RNA_def_smoke(BlenderRNA *brna)