2011-02-23 10:52:22 +00:00
|
|
|
/*
|
2009-01-02 13:47:33 +00:00
|
|
|
* 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,
|
2010-02-12 13:34:04 +00:00
|
|
|
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2009-01-02 13:47:33 +00:00
|
|
|
*/
|
|
|
|
|
|
2019-02-18 08:08:12 +11:00
|
|
|
/** \file
|
|
|
|
|
* \ingroup RNA
|
2011-02-27 20:20:01 +00:00
|
|
|
*/
|
|
|
|
|
|
2009-01-02 13:47:33 +00:00
|
|
|
#include <stdlib.h>
|
|
|
|
|
|
2009-11-03 02:49:36 +00:00
|
|
|
#include "DNA_cloth_types.h"
|
2009-01-02 13:47:33 +00:00
|
|
|
#include "DNA_object_types.h"
|
2018-02-07 11:14:08 +11:00
|
|
|
#include "DNA_object_force_types.h"
|
2016-12-28 17:30:58 +01:00
|
|
|
#include "DNA_particle_types.h"
|
Pointcache refresh part 2
* Based on what happens during simulation the cache is marked (also in cache panel, this could possibly be extended to 3d view as well) as:
- exact (not marked)
- outdated (simulation is not done completely with current settings)
- non-exact (frames were skipped during simulation)
* The parameter "cache step" effects the number of frames between saved cache frames.
- This can save a lot of memory (or disk space) if absolutely frame accurate simulation is not required.
- Speeds up the "quick caching" very much.
- Frames between cached frames are interpolated from the cached frames.
- Current default value of 10 frames works nicely with up/down-arrows (skip 10 frames forwards/backwards on timeline), but can be changed if wanted.
* The caching can work in normal or "quick" mode:
[Normal cache]
- Basic: Calculate what even happens (settings change, big frame steps etc.) and cache results, if possible try to use "cache step" when saving cache frames.
- Becomes non-exact: After larger than 1 frame steps.
- Becomes outdated: After any change effecting the simulation other than frame steps.
- Pros/cons: Freedom of doing anything and playing with particles, but exact results have to calculated from the beginning.
[Quick cache]
- Basic: Calculate simulation up to current frame automatically on changes with cache step sized jumps in simulation. With multiple "quick cached" simulations the smallest cache step is used.
- Becomes non-exact: Always from frame 1 (unless cache step = 1).
- Becomes outdated: Never.
- Pros/cons: Not very accurate, but super fast!
- Todo: Transform of any animated (non-autokeyed) object is locked! Probably needs some tinkering with anim sys overrides.
* The simulation can be run forwards or backwards even if it's cache is outdated or non-exact, the following rules apply in these situations:
- step forwards (to unknown) -> simulate from last exact frame, store result
- step backwards (to known) -> result is interpolated from existing frames, store result, clear cache forwards if current frame is after last exact frame
* "Calculate to current frame" runs the simulation from start to current frame with a frame steps of 1.
- Baking does the same, but runs the simulation all the way to the end of simulation.
- Rendering does this automatically if the simulation is outdated of non-exact, so all rendered simulations will always be updated and exact.
* Every cache panel also holds buttons to "Bake all dynamics", "Free all dynamics" and "Update all dynamics to current frame".
* Cloth simulation supports the new cache too.
2009-06-27 15:28:58 +00:00
|
|
|
#include "DNA_scene_types.h"
|
2009-11-03 02:49:36 +00:00
|
|
|
#include "DNA_smoke_types.h"
|
2009-01-02 13:47:33 +00:00
|
|
|
|
2013-03-07 02:44:55 +00:00
|
|
|
#include "RNA_define.h"
|
2015-11-18 12:23:05 +11:00
|
|
|
#include "RNA_enum_types.h"
|
2013-03-07 02:44:55 +00:00
|
|
|
|
|
|
|
|
#include "rna_internal.h"
|
|
|
|
|
|
2009-07-02 19:41:31 +00:00
|
|
|
#include "WM_api.h"
|
2009-06-21 10:16:52 +00:00
|
|
|
#include "WM_types.h"
|
|
|
|
|
|
2017-10-18 15:07:26 +11:00
|
|
|
static const EnumPropertyItem effector_shape_items[] = {
|
2019-04-17 06:17:24 +02:00
|
|
|
{PFIELD_SHAPE_POINT, "POINT", 0, "Point", "Field originates from the object center"},
|
|
|
|
|
{PFIELD_SHAPE_LINE, "LINE", 0, "Line", "Field originates from the local Z axis of the object"},
|
|
|
|
|
{PFIELD_SHAPE_PLANE,
|
|
|
|
|
"PLANE",
|
|
|
|
|
0,
|
|
|
|
|
"Plane",
|
|
|
|
|
"Field originates from the local XY plane of the object"},
|
|
|
|
|
{PFIELD_SHAPE_SURFACE,
|
|
|
|
|
"SURFACE",
|
|
|
|
|
0,
|
|
|
|
|
"Surface",
|
|
|
|
|
"Field originates from the surface of the object"},
|
|
|
|
|
{PFIELD_SHAPE_POINTS,
|
|
|
|
|
"POINTS",
|
|
|
|
|
0,
|
|
|
|
|
"Every Point",
|
|
|
|
|
"Field originates from all of the vertices of the object"},
|
|
|
|
|
{0, NULL, 0, NULL, NULL},
|
Unified effector functionality for particles, cloth and softbody
* Unified scene wide gravity (currently in scene buttons)
instead of each simulation having it's own gravity.
* Weight parameters for all effectors and an effector group
setting.
* Every effector can use noise.
* Most effectors have "shapes" point, plane, surface, every point.
- "Point" is most like the old effectors and uses the
effector location as the effector point.
- "Plane" uses the closest point on effectors local xy-plane
as the effector point.
- "Surface" uses the closest point on an effector object's
surface as the effector point.
- "Every Point" uses every point in a mesh effector object
as an effector point.
- The falloff is calculated from this point, so for example
with "surface" shape and "use only negative z axis" it's
possible to apply force only "inside" the effector object.
* Spherical effector is now renamed as "force" as it's no longer
just spherical.
* New effector parameter "flow", which makes the effector act as
surrounding air velocity, so the resulting force is
proportional to the velocity difference of the point and "air
velocity". For example a wind field with flow=1.0 results in
proper non-accelerating wind.
* New effector fields "turbulence", which creates nice random
flow paths, and "drag", which slows the points down.
* Much improved vortex field.
* Effectors can now effect particle rotation as well as location.
* Use full, or only positive/negative z-axis to apply force
(note. the z-axis is the surface normal in the case of
effector shape "surface")
* New "force field" submenu in add menu, which adds an empty
with the chosen effector (curve object for corve guides).
* Other dynamics should be quite easy to add to the effector
system too if wanted.
* "Unified" doesn't mean that force fields give the exact same results for
particles, softbody & cloth, since their final effect depends on many external
factors, like for example the surface area of the effected faces.
Code changes
* Subversion bump for correct handling of global gravity.
* Separate ui py file for common dynamics stuff.
* Particle settings updating is flushed with it's id through
DAG_id_flush_update(..).
Known issues
* Curve guides don't yet have all ui buttons in place, but they
should work none the less.
* Hair dynamics don't yet respect force fields.
Other changes
* Particle emission defaults now to frames 1-200 with life of 50
frames to fill the whole default timeline.
* Many particles drawing related crashes fixed.
* Sometimes particles didn't update on first frame properly.
* Hair with object/group visualization didn't work properly.
* Memory leaks with PointCacheID lists (Genscher, remember to
free pidlists after use :).
2009-09-30 22:10:14 +00:00
|
|
|
};
|
|
|
|
|
|
2011-08-28 05:06:30 +00:00
|
|
|
#ifdef RNA_RUNTIME
|
|
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
# include "BLI_math_base.h"
|
2012-11-07 12:31:05 +00:00
|
|
|
|
2011-10-15 14:14:22 +00:00
|
|
|
/* type specific return values only used from functions */
|
2017-10-18 15:07:26 +11:00
|
|
|
static const EnumPropertyItem curve_shape_items[] = {
|
2019-04-17 06:17:24 +02:00
|
|
|
{PFIELD_SHAPE_POINT, "POINT", 0, "Point", "Field originates from the object center"},
|
|
|
|
|
{PFIELD_SHAPE_LINE, "LINE", 0, "Line", "Field originates from the local Z axis of the object"},
|
|
|
|
|
{PFIELD_SHAPE_PLANE,
|
|
|
|
|
"PLANE",
|
|
|
|
|
0,
|
|
|
|
|
"Plane",
|
|
|
|
|
"Field originates from the local XY plane of the object"},
|
|
|
|
|
{PFIELD_SHAPE_SURFACE, "SURFACE", 0, "Curve", "Field originates from the curve itself"},
|
|
|
|
|
{0, NULL, 0, NULL, NULL},
|
2009-10-05 13:25:56 +00:00
|
|
|
};
|
|
|
|
|
|
2017-10-18 15:07:26 +11:00
|
|
|
static const EnumPropertyItem empty_shape_items[] = {
|
2019-04-17 06:17:24 +02:00
|
|
|
{PFIELD_SHAPE_POINT, "POINT", 0, "Point", "Field originates from the object center"},
|
|
|
|
|
{PFIELD_SHAPE_LINE, "LINE", 0, "Line", "Field originates from the local Z axis of the object"},
|
|
|
|
|
{PFIELD_SHAPE_PLANE,
|
|
|
|
|
"PLANE",
|
|
|
|
|
0,
|
|
|
|
|
"Plane",
|
|
|
|
|
"Field originates from the local XY plane of the object"},
|
|
|
|
|
{0, NULL, 0, NULL, NULL},
|
Unified effector functionality for particles, cloth and softbody
* Unified scene wide gravity (currently in scene buttons)
instead of each simulation having it's own gravity.
* Weight parameters for all effectors and an effector group
setting.
* Every effector can use noise.
* Most effectors have "shapes" point, plane, surface, every point.
- "Point" is most like the old effectors and uses the
effector location as the effector point.
- "Plane" uses the closest point on effectors local xy-plane
as the effector point.
- "Surface" uses the closest point on an effector object's
surface as the effector point.
- "Every Point" uses every point in a mesh effector object
as an effector point.
- The falloff is calculated from this point, so for example
with "surface" shape and "use only negative z axis" it's
possible to apply force only "inside" the effector object.
* Spherical effector is now renamed as "force" as it's no longer
just spherical.
* New effector parameter "flow", which makes the effector act as
surrounding air velocity, so the resulting force is
proportional to the velocity difference of the point and "air
velocity". For example a wind field with flow=1.0 results in
proper non-accelerating wind.
* New effector fields "turbulence", which creates nice random
flow paths, and "drag", which slows the points down.
* Much improved vortex field.
* Effectors can now effect particle rotation as well as location.
* Use full, or only positive/negative z-axis to apply force
(note. the z-axis is the surface normal in the case of
effector shape "surface")
* New "force field" submenu in add menu, which adds an empty
with the chosen effector (curve object for corve guides).
* Other dynamics should be quite easy to add to the effector
system too if wanted.
* "Unified" doesn't mean that force fields give the exact same results for
particles, softbody & cloth, since their final effect depends on many external
factors, like for example the surface area of the effected faces.
Code changes
* Subversion bump for correct handling of global gravity.
* Separate ui py file for common dynamics stuff.
* Particle settings updating is flushed with it's id through
DAG_id_flush_update(..).
Known issues
* Curve guides don't yet have all ui buttons in place, but they
should work none the less.
* Hair dynamics don't yet respect force fields.
Other changes
* Particle emission defaults now to frames 1-200 with life of 50
frames to fill the whole default timeline.
* Many particles drawing related crashes fixed.
* Sometimes particles didn't update on first frame properly.
* Hair with object/group visualization didn't work properly.
* Memory leaks with PointCacheID lists (Genscher, remember to
free pidlists after use :).
2009-09-30 22:10:14 +00:00
|
|
|
};
|
|
|
|
|
|
2017-10-18 15:07:26 +11:00
|
|
|
static const EnumPropertyItem vortex_shape_items[] = {
|
2019-04-17 06:17:24 +02:00
|
|
|
{PFIELD_SHAPE_POINT, "POINT", 0, "Point", ""},
|
|
|
|
|
{PFIELD_SHAPE_PLANE, "PLANE", 0, "Plane", ""},
|
2019-08-24 00:45:21 +02:00
|
|
|
{PFIELD_SHAPE_SURFACE, "SURFACE", 0, "Surface", ""},
|
|
|
|
|
{PFIELD_SHAPE_POINTS, "POINTS", 0, "Every Point", ""},
|
2019-04-17 06:17:24 +02:00
|
|
|
{0, NULL, 0, NULL, NULL},
|
Unified effector functionality for particles, cloth and softbody
* Unified scene wide gravity (currently in scene buttons)
instead of each simulation having it's own gravity.
* Weight parameters for all effectors and an effector group
setting.
* Every effector can use noise.
* Most effectors have "shapes" point, plane, surface, every point.
- "Point" is most like the old effectors and uses the
effector location as the effector point.
- "Plane" uses the closest point on effectors local xy-plane
as the effector point.
- "Surface" uses the closest point on an effector object's
surface as the effector point.
- "Every Point" uses every point in a mesh effector object
as an effector point.
- The falloff is calculated from this point, so for example
with "surface" shape and "use only negative z axis" it's
possible to apply force only "inside" the effector object.
* Spherical effector is now renamed as "force" as it's no longer
just spherical.
* New effector parameter "flow", which makes the effector act as
surrounding air velocity, so the resulting force is
proportional to the velocity difference of the point and "air
velocity". For example a wind field with flow=1.0 results in
proper non-accelerating wind.
* New effector fields "turbulence", which creates nice random
flow paths, and "drag", which slows the points down.
* Much improved vortex field.
* Effectors can now effect particle rotation as well as location.
* Use full, or only positive/negative z-axis to apply force
(note. the z-axis is the surface normal in the case of
effector shape "surface")
* New "force field" submenu in add menu, which adds an empty
with the chosen effector (curve object for corve guides).
* Other dynamics should be quite easy to add to the effector
system too if wanted.
* "Unified" doesn't mean that force fields give the exact same results for
particles, softbody & cloth, since their final effect depends on many external
factors, like for example the surface area of the effected faces.
Code changes
* Subversion bump for correct handling of global gravity.
* Separate ui py file for common dynamics stuff.
* Particle settings updating is flushed with it's id through
DAG_id_flush_update(..).
Known issues
* Curve guides don't yet have all ui buttons in place, but they
should work none the less.
* Hair dynamics don't yet respect force fields.
Other changes
* Particle emission defaults now to frames 1-200 with life of 50
frames to fill the whole default timeline.
* Many particles drawing related crashes fixed.
* Sometimes particles didn't update on first frame properly.
* Hair with object/group visualization didn't work properly.
* Memory leaks with PointCacheID lists (Genscher, remember to
free pidlists after use :).
2009-09-30 22:10:14 +00:00
|
|
|
};
|
|
|
|
|
|
2017-10-18 15:07:26 +11:00
|
|
|
static const EnumPropertyItem curve_vortex_shape_items[] = {
|
2019-04-17 06:17:24 +02:00
|
|
|
{PFIELD_SHAPE_POINT, "POINT", 0, "Point", ""},
|
|
|
|
|
{PFIELD_SHAPE_PLANE, "PLANE", 0, "Plane", ""},
|
2019-08-24 00:45:21 +02:00
|
|
|
{PFIELD_SHAPE_SURFACE, "SURFACE", 0, "Curve", ""},
|
2019-04-17 06:17:24 +02:00
|
|
|
{0, NULL, 0, NULL, NULL},
|
2009-10-05 13:25:56 +00:00
|
|
|
};
|
|
|
|
|
|
2017-10-18 15:07:26 +11:00
|
|
|
static const EnumPropertyItem empty_vortex_shape_items[] = {
|
2019-04-17 06:17:24 +02:00
|
|
|
{PFIELD_SHAPE_POINT, "POINT", 0, "Point", ""},
|
|
|
|
|
{PFIELD_SHAPE_PLANE, "PLANE", 0, "Plane", ""},
|
|
|
|
|
{0, NULL, 0, NULL, NULL},
|
Unified effector functionality for particles, cloth and softbody
* Unified scene wide gravity (currently in scene buttons)
instead of each simulation having it's own gravity.
* Weight parameters for all effectors and an effector group
setting.
* Every effector can use noise.
* Most effectors have "shapes" point, plane, surface, every point.
- "Point" is most like the old effectors and uses the
effector location as the effector point.
- "Plane" uses the closest point on effectors local xy-plane
as the effector point.
- "Surface" uses the closest point on an effector object's
surface as the effector point.
- "Every Point" uses every point in a mesh effector object
as an effector point.
- The falloff is calculated from this point, so for example
with "surface" shape and "use only negative z axis" it's
possible to apply force only "inside" the effector object.
* Spherical effector is now renamed as "force" as it's no longer
just spherical.
* New effector parameter "flow", which makes the effector act as
surrounding air velocity, so the resulting force is
proportional to the velocity difference of the point and "air
velocity". For example a wind field with flow=1.0 results in
proper non-accelerating wind.
* New effector fields "turbulence", which creates nice random
flow paths, and "drag", which slows the points down.
* Much improved vortex field.
* Effectors can now effect particle rotation as well as location.
* Use full, or only positive/negative z-axis to apply force
(note. the z-axis is the surface normal in the case of
effector shape "surface")
* New "force field" submenu in add menu, which adds an empty
with the chosen effector (curve object for corve guides).
* Other dynamics should be quite easy to add to the effector
system too if wanted.
* "Unified" doesn't mean that force fields give the exact same results for
particles, softbody & cloth, since their final effect depends on many external
factors, like for example the surface area of the effected faces.
Code changes
* Subversion bump for correct handling of global gravity.
* Separate ui py file for common dynamics stuff.
* Particle settings updating is flushed with it's id through
DAG_id_flush_update(..).
Known issues
* Curve guides don't yet have all ui buttons in place, but they
should work none the less.
* Hair dynamics don't yet respect force fields.
Other changes
* Particle emission defaults now to frames 1-200 with life of 50
frames to fill the whole default timeline.
* Many particles drawing related crashes fixed.
* Sometimes particles didn't update on first frame properly.
* Hair with object/group visualization didn't work properly.
* Memory leaks with PointCacheID lists (Genscher, remember to
free pidlists after use :).
2009-09-30 22:10:14 +00:00
|
|
|
};
|
|
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
# include "MEM_guardedalloc.h"
|
2009-06-21 10:16:52 +00:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
# include "DNA_modifier_types.h"
|
|
|
|
|
# include "DNA_texture_types.h"
|
2009-07-02 19:41:31 +00:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
# include "BKE_collection.h"
|
|
|
|
|
# include "BKE_context.h"
|
|
|
|
|
# include "BKE_modifier.h"
|
|
|
|
|
# include "BKE_pointcache.h"
|
2017-06-08 10:14:53 +02:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
# include "DEG_depsgraph.h"
|
|
|
|
|
# include "DEG_depsgraph_build.h"
|
2009-06-21 10:16:52 +00:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
# include "ED_object.h"
|
2009-07-02 19:41:31 +00:00
|
|
|
|
2019-08-26 16:01:16 +02:00
|
|
|
static bool rna_Cache_get_valid_owner_ID(PointerRNA *ptr, Object **ob, Scene **scene)
|
|
|
|
|
{
|
|
|
|
|
switch (GS(ptr->owner_id->name)) {
|
|
|
|
|
case ID_OB:
|
|
|
|
|
*ob = (Object *)ptr->owner_id;
|
|
|
|
|
break;
|
|
|
|
|
case ID_SCE:
|
|
|
|
|
*scene = (Scene *)ptr->owner_id;
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
BLI_assert(!"Trying to get PTCacheID from an invalid ID type "
|
|
|
|
|
"(Only scenes and objects are supported).");
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return (*ob != NULL || *scene != NULL);
|
|
|
|
|
}
|
|
|
|
|
|
2016-12-28 17:30:58 +01:00
|
|
|
static void rna_Cache_change(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
|
|
|
|
|
{
|
2019-08-26 16:01:16 +02:00
|
|
|
Object *ob = NULL;
|
|
|
|
|
Scene *scene = NULL;
|
2016-12-28 17:30:58 +01:00
|
|
|
|
2019-08-26 16:01:16 +02:00
|
|
|
if (!rna_Cache_get_valid_owner_ID(ptr, &ob, &scene)) {
|
2019-04-17 06:17:24 +02:00
|
|
|
return;
|
2019-06-04 00:21:57 +10:00
|
|
|
}
|
2016-12-28 17:30:58 +01:00
|
|
|
|
2019-08-26 16:01:16 +02:00
|
|
|
PointCache *cache = (PointCache *)ptr->data;
|
|
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
cache->flag |= PTCACHE_OUTDATED;
|
2016-12-28 17:30:58 +01:00
|
|
|
|
2019-08-26 16:01:16 +02:00
|
|
|
PTCacheID pid = BKE_ptcache_id_find(ob, scene, cache);
|
2016-12-28 17:30:58 +01:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
|
2016-12-28 17:30:58 +01:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
if (pid.cache) {
|
|
|
|
|
/* Just make sure this wasn't changed. */
|
2019-06-04 00:21:57 +10:00
|
|
|
if (pid.type == PTCACHE_TYPE_SMOKE_DOMAIN) {
|
2019-04-17 06:17:24 +02:00
|
|
|
cache->step = 1;
|
2019-06-04 00:21:57 +10:00
|
|
|
}
|
2019-08-13 12:56:27 +02:00
|
|
|
cache->flag |= PTCACHE_FLAG_INFO_DIRTY;
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
2016-12-28 17:30:58 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void rna_Cache_toggle_disk_cache(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
|
|
|
|
|
{
|
2019-08-26 16:01:16 +02:00
|
|
|
Object *ob = NULL;
|
|
|
|
|
Scene *scene = NULL;
|
2016-12-28 17:30:58 +01:00
|
|
|
|
2019-08-26 16:01:16 +02:00
|
|
|
if (!rna_Cache_get_valid_owner_ID(ptr, &ob, &scene)) {
|
2019-04-17 06:17:24 +02:00
|
|
|
return;
|
2019-06-04 00:21:57 +10:00
|
|
|
}
|
2016-12-28 17:30:58 +01:00
|
|
|
|
2019-08-26 16:01:16 +02:00
|
|
|
PointCache *cache = (PointCache *)ptr->data;
|
|
|
|
|
|
|
|
|
|
PTCacheID pid = BKE_ptcache_id_find(ob, scene, cache);
|
2016-12-28 17:30:58 +01:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
/* smoke can only use disk cache */
|
2019-06-04 00:21:57 +10:00
|
|
|
if (pid.cache && pid.type != PTCACHE_TYPE_SMOKE_DOMAIN) {
|
2019-04-17 06:17:24 +02:00
|
|
|
BKE_ptcache_toggle_disk_cache(&pid);
|
2019-06-04 00:21:57 +10:00
|
|
|
}
|
|
|
|
|
else {
|
2019-04-17 06:17:24 +02:00
|
|
|
cache->flag ^= PTCACHE_DISK_CACHE;
|
2019-06-04 00:21:57 +10:00
|
|
|
}
|
2016-12-28 17:30:58 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void rna_Cache_idname_change(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
|
|
|
|
|
{
|
2019-08-26 16:01:16 +02:00
|
|
|
Object *ob = NULL;
|
|
|
|
|
Scene *scene = NULL;
|
2016-12-28 17:30:58 +01:00
|
|
|
|
2019-08-26 16:01:16 +02:00
|
|
|
if (!rna_Cache_get_valid_owner_ID(ptr, &ob, &scene)) {
|
2019-04-17 06:17:24 +02:00
|
|
|
return;
|
2019-06-04 00:21:57 +10:00
|
|
|
}
|
2016-12-28 17:30:58 +01:00
|
|
|
|
2019-08-26 16:01:16 +02:00
|
|
|
PointCache *cache = (PointCache *)ptr->data;
|
|
|
|
|
bool use_new_name = true;
|
|
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
/* TODO: check for proper characters */
|
2016-12-28 17:30:58 +01:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
if (cache->flag & PTCACHE_EXTERNAL) {
|
2019-08-26 16:01:16 +02:00
|
|
|
PTCacheID pid = BKE_ptcache_id_find(ob, scene, cache);
|
2016-12-28 17:30:58 +01:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
if (pid.cache) {
|
|
|
|
|
BKE_ptcache_load_external(&pid);
|
|
|
|
|
}
|
2016-12-28 17:30:58 +01:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
|
|
|
|
|
WM_main_add_notifier(NC_OBJECT | ND_POINTCACHE, ob);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
PTCacheID *pid = NULL, *pid2 = NULL;
|
|
|
|
|
ListBase pidlist;
|
2018-04-12 18:43:43 +02:00
|
|
|
|
2019-08-26 16:01:16 +02:00
|
|
|
BKE_ptcache_ids_from_object(&pidlist, ob, scene, 0);
|
2018-04-12 18:43:43 +02:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
for (pid = pidlist.first; pid; pid = pid->next) {
|
2019-06-04 00:21:57 +10:00
|
|
|
if (pid->cache == cache) {
|
2019-04-17 06:17:24 +02:00
|
|
|
pid2 = pid;
|
2019-06-04 00:21:57 +10:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
else if (cache->name[0] != '\0' && STREQ(cache->name, pid->cache->name)) {
|
|
|
|
|
/*TODO: report "name exists" to user */
|
|
|
|
|
BLI_strncpy(cache->name, cache->prev_name, sizeof(cache->name));
|
|
|
|
|
use_new_name = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
2016-12-28 17:30:58 +01:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
if (use_new_name) {
|
|
|
|
|
BLI_filename_make_safe(cache->name);
|
2016-12-28 17:30:58 +01:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
if (pid2 && cache->flag & PTCACHE_DISK_CACHE) {
|
|
|
|
|
char old_name[80];
|
|
|
|
|
char new_name[80];
|
2016-12-28 17:30:58 +01:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
BLI_strncpy(old_name, cache->prev_name, sizeof(old_name));
|
|
|
|
|
BLI_strncpy(new_name, cache->name, sizeof(new_name));
|
2016-12-28 17:30:58 +01:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
BKE_ptcache_disk_cache_rename(pid2, old_name, new_name);
|
|
|
|
|
}
|
2016-12-28 17:30:58 +01:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
BLI_strncpy(cache->prev_name, cache->name, sizeof(cache->prev_name));
|
|
|
|
|
}
|
2016-12-28 17:30:58 +01:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
BLI_freelistN(&pidlist);
|
|
|
|
|
}
|
2016-12-28 17:30:58 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void rna_Cache_list_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
|
|
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
PointCache *cache = ptr->data;
|
|
|
|
|
ListBase lb;
|
2016-12-28 17:30:58 +01:00
|
|
|
|
2019-06-04 00:21:57 +10:00
|
|
|
while (cache->prev) {
|
2019-04-17 06:17:24 +02:00
|
|
|
cache = cache->prev;
|
2019-06-04 00:21:57 +10:00
|
|
|
}
|
2016-12-28 17:30:58 +01:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
lb.first = cache;
|
|
|
|
|
lb.last = NULL; /* not used by listbase_begin */
|
2016-12-28 17:30:58 +01:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
rna_iterator_listbase_begin(iter, &lb, NULL);
|
2016-12-28 17:30:58 +01:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
static void rna_Cache_active_point_cache_index_range(
|
|
|
|
|
PointerRNA *ptr, int *min, int *max, int *UNUSED(softmin), int *UNUSED(softmax))
|
2016-12-28 17:30:58 +01:00
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
*min = 0;
|
|
|
|
|
*max = 0;
|
2016-12-28 17:30:58 +01:00
|
|
|
|
2019-08-26 16:01:16 +02:00
|
|
|
Object *ob = NULL;
|
|
|
|
|
Scene *scene = NULL;
|
|
|
|
|
|
|
|
|
|
if (!rna_Cache_get_valid_owner_ID(ptr, &ob, &scene)) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PointCache *cache = ptr->data;
|
|
|
|
|
PTCacheID pid = BKE_ptcache_id_find(ob, scene, cache);
|
|
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
if (pid.cache) {
|
|
|
|
|
*max = max_ii(0, BLI_listbase_count(pid.ptcaches) - 1);
|
|
|
|
|
}
|
2016-12-28 17:30:58 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int rna_Cache_active_point_cache_index_get(PointerRNA *ptr)
|
|
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
int num = 0;
|
2016-12-28 17:30:58 +01:00
|
|
|
|
2019-08-26 16:01:16 +02:00
|
|
|
Object *ob = NULL;
|
|
|
|
|
Scene *scene = NULL;
|
|
|
|
|
|
|
|
|
|
if (!rna_Cache_get_valid_owner_ID(ptr, &ob, &scene)) {
|
|
|
|
|
return num;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PointCache *cache = ptr->data;
|
|
|
|
|
PTCacheID pid = BKE_ptcache_id_find(ob, scene, cache);
|
|
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
if (pid.cache) {
|
|
|
|
|
num = BLI_findindex(pid.ptcaches, cache);
|
|
|
|
|
}
|
2016-12-28 17:30:58 +01:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
return num;
|
2016-12-28 17:30:58 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void rna_Cache_active_point_cache_index_set(struct PointerRNA *ptr, int value)
|
|
|
|
|
{
|
2019-08-26 16:01:16 +02:00
|
|
|
Object *ob = NULL;
|
|
|
|
|
Scene *scene = NULL;
|
|
|
|
|
|
|
|
|
|
if (!rna_Cache_get_valid_owner_ID(ptr, &ob, &scene)) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
PointCache *cache = ptr->data;
|
2019-08-26 16:01:16 +02:00
|
|
|
PTCacheID pid = BKE_ptcache_id_find(ob, scene, cache);
|
2018-06-09 14:40:09 +02:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
if (pid.cache) {
|
|
|
|
|
*(pid.cache_ptr) = BLI_findlink(pid.ptcaches, value);
|
|
|
|
|
}
|
2016-12-28 17:30:58 +01:00
|
|
|
}
|
|
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
static void rna_PointCache_frame_step_range(
|
|
|
|
|
PointerRNA *ptr, int *min, int *max, int *UNUSED(softmin), int *UNUSED(softmax))
|
2016-12-28 17:30:58 +01:00
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
*min = 1;
|
|
|
|
|
*max = 20;
|
2016-12-28 17:30:58 +01:00
|
|
|
|
2019-08-26 16:01:16 +02:00
|
|
|
Object *ob = NULL;
|
|
|
|
|
Scene *scene = NULL;
|
|
|
|
|
|
|
|
|
|
if (!rna_Cache_get_valid_owner_ID(ptr, &ob, &scene)) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PointCache *cache = ptr->data;
|
|
|
|
|
PTCacheID pid = BKE_ptcache_id_find(ob, scene, cache);
|
|
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
if (pid.cache) {
|
|
|
|
|
*max = pid.max_step;
|
|
|
|
|
}
|
2016-12-28 17:30:58 +01:00
|
|
|
}
|
|
|
|
|
|
2019-08-13 12:56:27 +02:00
|
|
|
int rna_Cache_info_length(PointerRNA *ptr)
|
|
|
|
|
{
|
2019-08-26 16:01:16 +02:00
|
|
|
Object *ob = NULL;
|
|
|
|
|
Scene *scene = NULL;
|
2019-08-13 12:56:27 +02:00
|
|
|
|
2019-08-26 16:01:16 +02:00
|
|
|
if (!rna_Cache_get_valid_owner_ID(ptr, &ob, &scene)) {
|
2019-08-13 12:56:27 +02:00
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2019-08-26 16:01:16 +02:00
|
|
|
PointCache *cache = (PointCache *)ptr->data;
|
|
|
|
|
|
|
|
|
|
PTCacheID pid = BKE_ptcache_id_find(ob, scene, cache);
|
2019-08-13 12:56:27 +02:00
|
|
|
|
|
|
|
|
if (cache->flag & PTCACHE_FLAG_INFO_DIRTY) {
|
|
|
|
|
BKE_ptcache_update_info(&pid);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return (int)strlen(cache->info);
|
|
|
|
|
}
|
|
|
|
|
|
2011-05-31 02:14:25 +00:00
|
|
|
static char *rna_CollisionSettings_path(PointerRNA *UNUSED(ptr))
|
2009-11-03 02:49:36 +00:00
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
/* both methods work ok, but return the shorter path */
|
|
|
|
|
# if 0
|
2019-08-23 09:52:12 +02:00
|
|
|
Object *ob = (Object *)ptr->owner_id;
|
2019-04-17 06:17:24 +02:00
|
|
|
ModifierData *md = (ModifierData *)modifiers_findByType(ob, eModifierType_Collision);
|
|
|
|
|
|
|
|
|
|
if (md) {
|
|
|
|
|
char name_esc[sizeof(md->name) * 2];
|
|
|
|
|
|
|
|
|
|
BLI_strescape(name_esc, md->name, sizeof(name_esc));
|
|
|
|
|
return BLI_sprintfN("modifiers[\"%s\"].settings", name_esc);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
return BLI_strdup("");
|
|
|
|
|
}
|
|
|
|
|
# else
|
|
|
|
|
/* more reliable */
|
|
|
|
|
return BLI_strdup("collision");
|
|
|
|
|
# endif
|
2009-11-03 02:49:36 +00:00
|
|
|
}
|
|
|
|
|
|
2018-07-05 22:25:34 +02:00
|
|
|
static bool rna_SoftBodySettings_use_edges_get(PointerRNA *ptr)
|
2009-06-27 14:02:21 +00:00
|
|
|
{
|
2019-08-23 09:52:12 +02:00
|
|
|
Object *data = (Object *)(ptr->owner_id);
|
2019-04-17 06:17:24 +02:00
|
|
|
return (((data->softflag) & OB_SB_EDGES) != 0);
|
2009-06-27 14:02:21 +00:00
|
|
|
}
|
|
|
|
|
|
2018-07-05 22:25:34 +02:00
|
|
|
static void rna_SoftBodySettings_use_edges_set(PointerRNA *ptr, bool value)
|
2009-06-27 14:02:21 +00:00
|
|
|
{
|
2019-08-23 09:52:12 +02:00
|
|
|
Object *data = (Object *)(ptr->owner_id);
|
2019-06-04 00:21:57 +10:00
|
|
|
if (value) {
|
2019-04-17 06:17:24 +02:00
|
|
|
data->softflag |= OB_SB_EDGES;
|
2019-06-04 00:21:57 +10:00
|
|
|
}
|
|
|
|
|
else {
|
2019-04-17 06:17:24 +02:00
|
|
|
data->softflag &= ~OB_SB_EDGES;
|
2019-06-04 00:21:57 +10:00
|
|
|
}
|
2009-06-27 14:02:21 +00:00
|
|
|
}
|
|
|
|
|
|
2018-07-05 22:25:34 +02:00
|
|
|
static bool rna_SoftBodySettings_use_goal_get(PointerRNA *ptr)
|
2009-06-27 14:02:21 +00:00
|
|
|
{
|
2019-08-23 09:52:12 +02:00
|
|
|
Object *data = (Object *)(ptr->owner_id);
|
2019-04-17 06:17:24 +02:00
|
|
|
return (((data->softflag) & OB_SB_GOAL) != 0);
|
2009-06-27 14:02:21 +00:00
|
|
|
}
|
|
|
|
|
|
2018-07-05 22:25:34 +02:00
|
|
|
static void rna_SoftBodySettings_use_goal_set(PointerRNA *ptr, bool value)
|
2009-06-27 14:02:21 +00:00
|
|
|
{
|
2019-08-23 09:52:12 +02:00
|
|
|
Object *data = (Object *)(ptr->owner_id);
|
2019-06-04 00:21:57 +10:00
|
|
|
if (value) {
|
2019-04-17 06:17:24 +02:00
|
|
|
data->softflag |= OB_SB_GOAL;
|
2019-06-04 00:21:57 +10:00
|
|
|
}
|
|
|
|
|
else {
|
2019-04-17 06:17:24 +02:00
|
|
|
data->softflag &= ~OB_SB_GOAL;
|
2019-06-04 00:21:57 +10:00
|
|
|
}
|
2009-06-27 14:02:21 +00:00
|
|
|
}
|
|
|
|
|
|
2018-07-05 22:25:34 +02:00
|
|
|
static bool rna_SoftBodySettings_stiff_quads_get(PointerRNA *ptr)
|
2009-06-27 14:02:21 +00:00
|
|
|
{
|
2019-08-23 09:52:12 +02:00
|
|
|
Object *data = (Object *)(ptr->owner_id);
|
2019-04-17 06:17:24 +02:00
|
|
|
return (((data->softflag) & OB_SB_QUADS) != 0);
|
2009-06-27 14:02:21 +00:00
|
|
|
}
|
|
|
|
|
|
2018-07-05 22:25:34 +02:00
|
|
|
static void rna_SoftBodySettings_stiff_quads_set(PointerRNA *ptr, bool value)
|
2009-06-27 14:02:21 +00:00
|
|
|
{
|
2019-08-23 09:52:12 +02:00
|
|
|
Object *data = (Object *)(ptr->owner_id);
|
2019-06-04 00:21:57 +10:00
|
|
|
if (value) {
|
2019-04-17 06:17:24 +02:00
|
|
|
data->softflag |= OB_SB_QUADS;
|
2019-06-04 00:21:57 +10:00
|
|
|
}
|
|
|
|
|
else {
|
2019-04-17 06:17:24 +02:00
|
|
|
data->softflag &= ~OB_SB_QUADS;
|
2019-06-04 00:21:57 +10:00
|
|
|
}
|
2009-06-27 14:02:21 +00:00
|
|
|
}
|
|
|
|
|
|
2018-07-05 22:25:34 +02:00
|
|
|
static bool rna_SoftBodySettings_self_collision_get(PointerRNA *ptr)
|
2009-06-27 14:02:21 +00:00
|
|
|
{
|
2019-08-23 09:52:12 +02:00
|
|
|
Object *data = (Object *)(ptr->owner_id);
|
2019-04-17 06:17:24 +02:00
|
|
|
return (((data->softflag) & OB_SB_SELF) != 0);
|
2009-06-27 14:02:21 +00:00
|
|
|
}
|
|
|
|
|
|
2018-07-05 22:25:34 +02:00
|
|
|
static void rna_SoftBodySettings_self_collision_set(PointerRNA *ptr, bool value)
|
2009-06-27 14:02:21 +00:00
|
|
|
{
|
2019-08-23 09:52:12 +02:00
|
|
|
Object *data = (Object *)(ptr->owner_id);
|
2019-06-04 00:21:57 +10:00
|
|
|
if (value) {
|
2019-04-17 06:17:24 +02:00
|
|
|
data->softflag |= OB_SB_SELF;
|
2019-06-04 00:21:57 +10:00
|
|
|
}
|
|
|
|
|
else {
|
2019-04-17 06:17:24 +02:00
|
|
|
data->softflag &= ~OB_SB_SELF;
|
2019-06-04 00:21:57 +10:00
|
|
|
}
|
2009-06-27 14:02:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int rna_SoftBodySettings_new_aero_get(PointerRNA *ptr)
|
|
|
|
|
{
|
2019-08-23 09:52:12 +02:00
|
|
|
Object *data = (Object *)(ptr->owner_id);
|
2019-06-04 00:21:57 +10:00
|
|
|
if (data->softflag & OB_SB_AERO_ANGLE) {
|
2019-04-17 06:17:24 +02:00
|
|
|
return 1;
|
2019-06-04 00:21:57 +10:00
|
|
|
}
|
|
|
|
|
else {
|
2019-04-17 06:17:24 +02:00
|
|
|
return 0;
|
2019-06-04 00:21:57 +10:00
|
|
|
}
|
2009-06-27 14:02:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void rna_SoftBodySettings_new_aero_set(PointerRNA *ptr, int value)
|
|
|
|
|
{
|
2019-08-23 09:52:12 +02:00
|
|
|
Object *data = (Object *)(ptr->owner_id);
|
2019-06-04 00:21:57 +10:00
|
|
|
if (value == 1) {
|
2019-04-17 06:17:24 +02:00
|
|
|
data->softflag |= OB_SB_AERO_ANGLE;
|
2019-06-04 00:21:57 +10:00
|
|
|
}
|
|
|
|
|
else { /* value == 0 */
|
2019-04-17 06:17:24 +02:00
|
|
|
data->softflag &= ~OB_SB_AERO_ANGLE;
|
2019-06-04 00:21:57 +10:00
|
|
|
}
|
2009-06-27 14:02:21 +00:00
|
|
|
}
|
|
|
|
|
|
2018-07-05 22:25:34 +02:00
|
|
|
static bool rna_SoftBodySettings_face_collision_get(PointerRNA *ptr)
|
2009-06-27 14:02:21 +00:00
|
|
|
{
|
2019-08-23 09:52:12 +02:00
|
|
|
Object *data = (Object *)(ptr->owner_id);
|
2019-04-17 06:17:24 +02:00
|
|
|
return (((data->softflag) & OB_SB_FACECOLL) != 0);
|
2009-06-27 14:02:21 +00:00
|
|
|
}
|
|
|
|
|
|
2018-07-05 22:25:34 +02:00
|
|
|
static void rna_SoftBodySettings_face_collision_set(PointerRNA *ptr, bool value)
|
2009-06-27 14:02:21 +00:00
|
|
|
{
|
2019-08-23 09:52:12 +02:00
|
|
|
Object *data = (Object *)(ptr->owner_id);
|
2019-06-04 00:21:57 +10:00
|
|
|
if (value) {
|
2019-04-17 06:17:24 +02:00
|
|
|
data->softflag |= OB_SB_FACECOLL;
|
2019-06-04 00:21:57 +10:00
|
|
|
}
|
|
|
|
|
else {
|
2019-04-17 06:17:24 +02:00
|
|
|
data->softflag &= ~OB_SB_FACECOLL;
|
2019-06-04 00:21:57 +10:00
|
|
|
}
|
2009-06-27 14:02:21 +00:00
|
|
|
}
|
|
|
|
|
|
2018-07-05 22:25:34 +02:00
|
|
|
static bool rna_SoftBodySettings_edge_collision_get(PointerRNA *ptr)
|
2009-06-27 14:02:21 +00:00
|
|
|
{
|
2019-08-23 09:52:12 +02:00
|
|
|
Object *data = (Object *)(ptr->owner_id);
|
2019-04-17 06:17:24 +02:00
|
|
|
return (((data->softflag) & OB_SB_EDGECOLL) != 0);
|
2009-06-27 14:02:21 +00:00
|
|
|
}
|
|
|
|
|
|
2018-07-05 22:25:34 +02:00
|
|
|
static void rna_SoftBodySettings_edge_collision_set(PointerRNA *ptr, bool value)
|
2009-06-27 14:02:21 +00:00
|
|
|
{
|
2019-08-23 09:52:12 +02:00
|
|
|
Object *data = (Object *)(ptr->owner_id);
|
2019-06-04 00:21:57 +10:00
|
|
|
if (value) {
|
2019-04-17 06:17:24 +02:00
|
|
|
data->softflag |= OB_SB_EDGECOLL;
|
2019-06-04 00:21:57 +10:00
|
|
|
}
|
|
|
|
|
else {
|
2019-04-17 06:17:24 +02:00
|
|
|
data->softflag &= ~OB_SB_EDGECOLL;
|
2019-06-04 00:21:57 +10:00
|
|
|
}
|
2009-06-27 14:02:21 +00:00
|
|
|
}
|
|
|
|
|
|
2009-07-02 19:41:31 +00:00
|
|
|
static void rna_SoftBodySettings_goal_vgroup_get(PointerRNA *ptr, char *value)
|
|
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
SoftBody *sb = (SoftBody *)ptr->data;
|
|
|
|
|
rna_object_vgroup_name_index_get(ptr, value, sb->vertgroup);
|
2009-07-02 19:41:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int rna_SoftBodySettings_goal_vgroup_length(PointerRNA *ptr)
|
|
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
SoftBody *sb = (SoftBody *)ptr->data;
|
|
|
|
|
return rna_object_vgroup_name_index_length(ptr, sb->vertgroup);
|
2009-07-02 19:41:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void rna_SoftBodySettings_goal_vgroup_set(PointerRNA *ptr, const char *value)
|
|
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
SoftBody *sb = (SoftBody *)ptr->data;
|
|
|
|
|
rna_object_vgroup_name_index_set(ptr, value, &sb->vertgroup);
|
2009-07-02 19:41:31 +00:00
|
|
|
}
|
|
|
|
|
|
2009-11-05 02:50:26 +00:00
|
|
|
static void rna_SoftBodySettings_mass_vgroup_set(PointerRNA *ptr, const char *value)
|
|
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
SoftBody *sb = (SoftBody *)ptr->data;
|
|
|
|
|
rna_object_vgroup_name_set(ptr, value, sb->namedVG_Mass, sizeof(sb->namedVG_Mass));
|
2009-11-05 02:50:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void rna_SoftBodySettings_spring_vgroup_set(PointerRNA *ptr, const char *value)
|
|
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
SoftBody *sb = (SoftBody *)ptr->data;
|
|
|
|
|
rna_object_vgroup_name_set(ptr, value, sb->namedVG_Spring_K, sizeof(sb->namedVG_Spring_K));
|
2009-11-05 02:50:26 +00:00
|
|
|
}
|
|
|
|
|
|
2009-11-03 02:49:36 +00:00
|
|
|
static char *rna_SoftBodySettings_path(PointerRNA *ptr)
|
|
|
|
|
{
|
2019-08-23 09:52:12 +02:00
|
|
|
Object *ob = (Object *)ptr->owner_id;
|
2019-04-17 06:17:24 +02:00
|
|
|
ModifierData *md = (ModifierData *)modifiers_findByType(ob, eModifierType_Softbody);
|
|
|
|
|
char name_esc[sizeof(md->name) * 2];
|
2013-04-23 20:10:22 +00:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
BLI_strescape(name_esc, md->name, sizeof(name_esc));
|
|
|
|
|
return BLI_sprintfN("modifiers[\"%s\"].settings", name_esc);
|
2009-11-03 02:49:36 +00:00
|
|
|
}
|
|
|
|
|
|
2016-12-28 17:30:58 +01:00
|
|
|
static int particle_id_check(PointerRNA *ptr)
|
|
|
|
|
{
|
2019-08-23 09:52:12 +02:00
|
|
|
ID *id = ptr->owner_id;
|
2016-12-28 17:30:58 +01:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
return (GS(id->name) == ID_PA);
|
2016-12-28 17:30:58 +01:00
|
|
|
}
|
|
|
|
|
|
2011-05-31 02:14:25 +00:00
|
|
|
static void rna_FieldSettings_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
|
2009-07-02 19:41:31 +00:00
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
if (particle_id_check(ptr)) {
|
2019-08-23 09:52:12 +02:00
|
|
|
ParticleSettings *part = (ParticleSettings *)ptr->owner_id;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
|
|
|
|
if (part->pd->forcefield != PFIELD_TEXTURE && part->pd->tex) {
|
|
|
|
|
id_us_min(&part->pd->tex->id);
|
|
|
|
|
part->pd->tex = NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (part->pd2 && part->pd2->forcefield != PFIELD_TEXTURE && part->pd2->tex) {
|
|
|
|
|
id_us_min(&part->pd2->tex->id);
|
|
|
|
|
part->pd2->tex = NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
DEG_id_tag_update(&part->id,
|
|
|
|
|
ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY | ID_RECALC_ANIMATION |
|
|
|
|
|
ID_RECALC_PSYS_RESET);
|
|
|
|
|
WM_main_add_notifier(NC_OBJECT | ND_DRAW, NULL);
|
|
|
|
|
}
|
|
|
|
|
else {
|
2019-08-23 09:52:12 +02:00
|
|
|
Object *ob = (Object *)ptr->owner_id;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
|
|
|
|
if (ob->pd->forcefield != PFIELD_TEXTURE && ob->pd->tex) {
|
|
|
|
|
id_us_min(&ob->pd->tex->id);
|
|
|
|
|
ob->pd->tex = NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
DEG_id_tag_update(&ob->id, ID_RECALC_TRANSFORM);
|
|
|
|
|
WM_main_add_notifier(NC_OBJECT | ND_DRAW, ob);
|
|
|
|
|
}
|
2009-07-02 19:41:31 +00:00
|
|
|
}
|
|
|
|
|
|
2009-12-08 17:23:48 +00:00
|
|
|
static void rna_FieldSettings_shape_update(Main *bmain, Scene *scene, PointerRNA *ptr)
|
2009-07-02 19:41:31 +00:00
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
if (!particle_id_check(ptr)) {
|
2019-08-23 09:52:12 +02:00
|
|
|
Object *ob = (Object *)ptr->owner_id;
|
2019-04-17 06:17:24 +02:00
|
|
|
ED_object_check_force_modifiers(bmain, scene, ob);
|
2019-07-17 08:30:24 -03:00
|
|
|
|
|
|
|
|
DEG_id_tag_update(&ob->id, ID_RECALC_TRANSFORM);
|
2019-04-17 06:17:24 +02:00
|
|
|
WM_main_add_notifier(NC_OBJECT | ND_DRAW, ob);
|
|
|
|
|
WM_main_add_notifier(NC_OBJECT | ND_MODIFIER, ob);
|
|
|
|
|
}
|
2009-07-02 19:41:31 +00:00
|
|
|
}
|
|
|
|
|
|
2013-12-05 01:24:05 +06:00
|
|
|
static void rna_FieldSettings_type_set(PointerRNA *ptr, int value)
|
|
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
PartDeflect *part_deflect = (PartDeflect *)ptr->data;
|
|
|
|
|
|
|
|
|
|
part_deflect->forcefield = value;
|
|
|
|
|
|
|
|
|
|
if (!particle_id_check(ptr)) {
|
2019-08-23 09:52:12 +02:00
|
|
|
Object *ob = (Object *)ptr->owner_id;
|
2019-04-17 06:17:24 +02:00
|
|
|
ob->pd->forcefield = value;
|
|
|
|
|
if (ELEM(value, PFIELD_WIND, PFIELD_VORTEX)) {
|
|
|
|
|
ob->empty_drawtype = OB_SINGLE_ARROW;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
ob->empty_drawtype = OB_PLAINAXES;
|
|
|
|
|
}
|
|
|
|
|
}
|
2013-12-05 01:24:05 +06:00
|
|
|
}
|
|
|
|
|
|
2009-12-08 17:23:48 +00:00
|
|
|
static void rna_FieldSettings_dependency_update(Main *bmain, Scene *scene, PointerRNA *ptr)
|
2009-07-02 19:41:31 +00:00
|
|
|
{
|
2019-04-19 15:38:45 +02:00
|
|
|
DEG_relations_tag_update(bmain);
|
|
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
if (particle_id_check(ptr)) {
|
2019-08-23 09:52:12 +02:00
|
|
|
DEG_id_tag_update(ptr->owner_id,
|
2019-04-17 06:17:24 +02:00
|
|
|
ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY | ID_RECALC_ANIMATION |
|
|
|
|
|
ID_RECALC_PSYS_RESET);
|
|
|
|
|
}
|
|
|
|
|
else {
|
2019-08-23 09:52:12 +02:00
|
|
|
Object *ob = (Object *)ptr->owner_id;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
|
|
|
|
rna_FieldSettings_shape_update(bmain, scene, ptr);
|
|
|
|
|
|
2019-06-04 00:21:57 +10:00
|
|
|
if (ob->type == OB_CURVE && ob->pd->forcefield == PFIELD_GUIDE) {
|
2019-04-17 06:17:24 +02:00
|
|
|
DEG_id_tag_update(&ob->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY | ID_RECALC_ANIMATION);
|
2019-06-04 00:21:57 +10:00
|
|
|
}
|
|
|
|
|
else {
|
2019-04-17 06:17:24 +02:00
|
|
|
DEG_id_tag_update(&ob->id, ID_RECALC_TRANSFORM);
|
2019-06-04 00:21:57 +10:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
|
|
|
|
WM_main_add_notifier(NC_OBJECT | ND_DRAW, ob);
|
|
|
|
|
}
|
Unified effector functionality for particles, cloth and softbody
* Unified scene wide gravity (currently in scene buttons)
instead of each simulation having it's own gravity.
* Weight parameters for all effectors and an effector group
setting.
* Every effector can use noise.
* Most effectors have "shapes" point, plane, surface, every point.
- "Point" is most like the old effectors and uses the
effector location as the effector point.
- "Plane" uses the closest point on effectors local xy-plane
as the effector point.
- "Surface" uses the closest point on an effector object's
surface as the effector point.
- "Every Point" uses every point in a mesh effector object
as an effector point.
- The falloff is calculated from this point, so for example
with "surface" shape and "use only negative z axis" it's
possible to apply force only "inside" the effector object.
* Spherical effector is now renamed as "force" as it's no longer
just spherical.
* New effector parameter "flow", which makes the effector act as
surrounding air velocity, so the resulting force is
proportional to the velocity difference of the point and "air
velocity". For example a wind field with flow=1.0 results in
proper non-accelerating wind.
* New effector fields "turbulence", which creates nice random
flow paths, and "drag", which slows the points down.
* Much improved vortex field.
* Effectors can now effect particle rotation as well as location.
* Use full, or only positive/negative z-axis to apply force
(note. the z-axis is the surface normal in the case of
effector shape "surface")
* New "force field" submenu in add menu, which adds an empty
with the chosen effector (curve object for corve guides).
* Other dynamics should be quite easy to add to the effector
system too if wanted.
* "Unified" doesn't mean that force fields give the exact same results for
particles, softbody & cloth, since their final effect depends on many external
factors, like for example the surface area of the effected faces.
Code changes
* Subversion bump for correct handling of global gravity.
* Separate ui py file for common dynamics stuff.
* Particle settings updating is flushed with it's id through
DAG_id_flush_update(..).
Known issues
* Curve guides don't yet have all ui buttons in place, but they
should work none the less.
* Hair dynamics don't yet respect force fields.
Other changes
* Particle emission defaults now to frames 1-200 with life of 50
frames to fill the whole default timeline.
* Many particles drawing related crashes fixed.
* Sometimes particles didn't update on first frame properly.
* Hair with object/group visualization didn't work properly.
* Memory leaks with PointCacheID lists (Genscher, remember to
free pidlists after use :).
2009-09-30 22:10:14 +00:00
|
|
|
}
|
|
|
|
|
|
2009-11-03 02:49:36 +00:00
|
|
|
static char *rna_FieldSettings_path(PointerRNA *ptr)
|
|
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
PartDeflect *pd = (PartDeflect *)ptr->data;
|
|
|
|
|
|
|
|
|
|
/* Check through all possible places the settings can be to find the right one */
|
|
|
|
|
|
|
|
|
|
if (particle_id_check(ptr)) {
|
|
|
|
|
/* particle system force field */
|
2019-08-23 09:52:12 +02:00
|
|
|
ParticleSettings *part = (ParticleSettings *)ptr->owner_id;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-06-04 00:21:57 +10:00
|
|
|
if (part->pd == pd) {
|
2019-04-17 06:17:24 +02:00
|
|
|
return BLI_strdup("force_field_1");
|
2019-06-04 00:21:57 +10:00
|
|
|
}
|
|
|
|
|
else if (part->pd2 == pd) {
|
2019-04-17 06:17:24 +02:00
|
|
|
return BLI_strdup("force_field_2");
|
2019-06-04 00:21:57 +10:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
/* object force field */
|
2019-08-23 09:52:12 +02:00
|
|
|
Object *ob = (Object *)ptr->owner_id;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-06-04 00:21:57 +10:00
|
|
|
if (ob->pd == pd) {
|
2019-04-17 06:17:24 +02:00
|
|
|
return BLI_strdup("field");
|
2019-06-04 00:21:57 +10:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
|
|
|
|
return NULL;
|
2009-11-03 02:49:36 +00:00
|
|
|
}
|
|
|
|
|
|
2011-05-31 02:14:25 +00:00
|
|
|
static void rna_EffectorWeight_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
|
Unified effector functionality for particles, cloth and softbody
* Unified scene wide gravity (currently in scene buttons)
instead of each simulation having it's own gravity.
* Weight parameters for all effectors and an effector group
setting.
* Every effector can use noise.
* Most effectors have "shapes" point, plane, surface, every point.
- "Point" is most like the old effectors and uses the
effector location as the effector point.
- "Plane" uses the closest point on effectors local xy-plane
as the effector point.
- "Surface" uses the closest point on an effector object's
surface as the effector point.
- "Every Point" uses every point in a mesh effector object
as an effector point.
- The falloff is calculated from this point, so for example
with "surface" shape and "use only negative z axis" it's
possible to apply force only "inside" the effector object.
* Spherical effector is now renamed as "force" as it's no longer
just spherical.
* New effector parameter "flow", which makes the effector act as
surrounding air velocity, so the resulting force is
proportional to the velocity difference of the point and "air
velocity". For example a wind field with flow=1.0 results in
proper non-accelerating wind.
* New effector fields "turbulence", which creates nice random
flow paths, and "drag", which slows the points down.
* Much improved vortex field.
* Effectors can now effect particle rotation as well as location.
* Use full, or only positive/negative z-axis to apply force
(note. the z-axis is the surface normal in the case of
effector shape "surface")
* New "force field" submenu in add menu, which adds an empty
with the chosen effector (curve object for corve guides).
* Other dynamics should be quite easy to add to the effector
system too if wanted.
* "Unified" doesn't mean that force fields give the exact same results for
particles, softbody & cloth, since their final effect depends on many external
factors, like for example the surface area of the effected faces.
Code changes
* Subversion bump for correct handling of global gravity.
* Separate ui py file for common dynamics stuff.
* Particle settings updating is flushed with it's id through
DAG_id_flush_update(..).
Known issues
* Curve guides don't yet have all ui buttons in place, but they
should work none the less.
* Hair dynamics don't yet respect force fields.
Other changes
* Particle emission defaults now to frames 1-200 with life of 50
frames to fill the whole default timeline.
* Many particles drawing related crashes fixed.
* Sometimes particles didn't update on first frame properly.
* Hair with object/group visualization didn't work properly.
* Memory leaks with PointCacheID lists (Genscher, remember to
free pidlists after use :).
2009-09-30 22:10:14 +00:00
|
|
|
{
|
2019-08-23 09:52:12 +02:00
|
|
|
ID *id = ptr->owner_id;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
|
|
|
|
if (id && GS(id->name) == ID_SCE) {
|
|
|
|
|
Scene *scene = (Scene *)id;
|
|
|
|
|
FOREACH_SCENE_OBJECT_BEGIN (scene, ob) {
|
|
|
|
|
BKE_ptcache_object_reset(scene, ob, PTCACHE_RESET_DEPSGRAPH);
|
|
|
|
|
}
|
|
|
|
|
FOREACH_SCENE_OBJECT_END;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
DEG_id_tag_update(id, ID_RECALC_GEOMETRY | ID_RECALC_PSYS_RESET);
|
|
|
|
|
WM_main_add_notifier(NC_OBJECT | ND_DRAW, NULL);
|
|
|
|
|
}
|
2009-07-02 19:41:31 +00:00
|
|
|
}
|
|
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
static void rna_EffectorWeight_dependency_update(Main *bmain,
|
|
|
|
|
Scene *UNUSED(scene),
|
|
|
|
|
PointerRNA *ptr)
|
Unified effector functionality for particles, cloth and softbody
* Unified scene wide gravity (currently in scene buttons)
instead of each simulation having it's own gravity.
* Weight parameters for all effectors and an effector group
setting.
* Every effector can use noise.
* Most effectors have "shapes" point, plane, surface, every point.
- "Point" is most like the old effectors and uses the
effector location as the effector point.
- "Plane" uses the closest point on effectors local xy-plane
as the effector point.
- "Surface" uses the closest point on an effector object's
surface as the effector point.
- "Every Point" uses every point in a mesh effector object
as an effector point.
- The falloff is calculated from this point, so for example
with "surface" shape and "use only negative z axis" it's
possible to apply force only "inside" the effector object.
* Spherical effector is now renamed as "force" as it's no longer
just spherical.
* New effector parameter "flow", which makes the effector act as
surrounding air velocity, so the resulting force is
proportional to the velocity difference of the point and "air
velocity". For example a wind field with flow=1.0 results in
proper non-accelerating wind.
* New effector fields "turbulence", which creates nice random
flow paths, and "drag", which slows the points down.
* Much improved vortex field.
* Effectors can now effect particle rotation as well as location.
* Use full, or only positive/negative z-axis to apply force
(note. the z-axis is the surface normal in the case of
effector shape "surface")
* New "force field" submenu in add menu, which adds an empty
with the chosen effector (curve object for corve guides).
* Other dynamics should be quite easy to add to the effector
system too if wanted.
* "Unified" doesn't mean that force fields give the exact same results for
particles, softbody & cloth, since their final effect depends on many external
factors, like for example the surface area of the effected faces.
Code changes
* Subversion bump for correct handling of global gravity.
* Separate ui py file for common dynamics stuff.
* Particle settings updating is flushed with it's id through
DAG_id_flush_update(..).
Known issues
* Curve guides don't yet have all ui buttons in place, but they
should work none the less.
* Hair dynamics don't yet respect force fields.
Other changes
* Particle emission defaults now to frames 1-200 with life of 50
frames to fill the whole default timeline.
* Many particles drawing related crashes fixed.
* Sometimes particles didn't update on first frame properly.
* Hair with object/group visualization didn't work properly.
* Memory leaks with PointCacheID lists (Genscher, remember to
free pidlists after use :).
2009-09-30 22:10:14 +00:00
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
DEG_relations_tag_update(bmain);
|
Unified effector functionality for particles, cloth and softbody
* Unified scene wide gravity (currently in scene buttons)
instead of each simulation having it's own gravity.
* Weight parameters for all effectors and an effector group
setting.
* Every effector can use noise.
* Most effectors have "shapes" point, plane, surface, every point.
- "Point" is most like the old effectors and uses the
effector location as the effector point.
- "Plane" uses the closest point on effectors local xy-plane
as the effector point.
- "Surface" uses the closest point on an effector object's
surface as the effector point.
- "Every Point" uses every point in a mesh effector object
as an effector point.
- The falloff is calculated from this point, so for example
with "surface" shape and "use only negative z axis" it's
possible to apply force only "inside" the effector object.
* Spherical effector is now renamed as "force" as it's no longer
just spherical.
* New effector parameter "flow", which makes the effector act as
surrounding air velocity, so the resulting force is
proportional to the velocity difference of the point and "air
velocity". For example a wind field with flow=1.0 results in
proper non-accelerating wind.
* New effector fields "turbulence", which creates nice random
flow paths, and "drag", which slows the points down.
* Much improved vortex field.
* Effectors can now effect particle rotation as well as location.
* Use full, or only positive/negative z-axis to apply force
(note. the z-axis is the surface normal in the case of
effector shape "surface")
* New "force field" submenu in add menu, which adds an empty
with the chosen effector (curve object for corve guides).
* Other dynamics should be quite easy to add to the effector
system too if wanted.
* "Unified" doesn't mean that force fields give the exact same results for
particles, softbody & cloth, since their final effect depends on many external
factors, like for example the surface area of the effected faces.
Code changes
* Subversion bump for correct handling of global gravity.
* Separate ui py file for common dynamics stuff.
* Particle settings updating is flushed with it's id through
DAG_id_flush_update(..).
Known issues
* Curve guides don't yet have all ui buttons in place, but they
should work none the less.
* Hair dynamics don't yet respect force fields.
Other changes
* Particle emission defaults now to frames 1-200 with life of 50
frames to fill the whole default timeline.
* Many particles drawing related crashes fixed.
* Sometimes particles didn't update on first frame properly.
* Hair with object/group visualization didn't work properly.
* Memory leaks with PointCacheID lists (Genscher, remember to
free pidlists after use :).
2009-09-30 22:10:14 +00:00
|
|
|
|
2019-08-23 09:52:12 +02:00
|
|
|
DEG_id_tag_update(ptr->owner_id, ID_RECALC_GEOMETRY | ID_RECALC_PSYS_RESET);
|
Unified effector functionality for particles, cloth and softbody
* Unified scene wide gravity (currently in scene buttons)
instead of each simulation having it's own gravity.
* Weight parameters for all effectors and an effector group
setting.
* Every effector can use noise.
* Most effectors have "shapes" point, plane, surface, every point.
- "Point" is most like the old effectors and uses the
effector location as the effector point.
- "Plane" uses the closest point on effectors local xy-plane
as the effector point.
- "Surface" uses the closest point on an effector object's
surface as the effector point.
- "Every Point" uses every point in a mesh effector object
as an effector point.
- The falloff is calculated from this point, so for example
with "surface" shape and "use only negative z axis" it's
possible to apply force only "inside" the effector object.
* Spherical effector is now renamed as "force" as it's no longer
just spherical.
* New effector parameter "flow", which makes the effector act as
surrounding air velocity, so the resulting force is
proportional to the velocity difference of the point and "air
velocity". For example a wind field with flow=1.0 results in
proper non-accelerating wind.
* New effector fields "turbulence", which creates nice random
flow paths, and "drag", which slows the points down.
* Much improved vortex field.
* Effectors can now effect particle rotation as well as location.
* Use full, or only positive/negative z-axis to apply force
(note. the z-axis is the surface normal in the case of
effector shape "surface")
* New "force field" submenu in add menu, which adds an empty
with the chosen effector (curve object for corve guides).
* Other dynamics should be quite easy to add to the effector
system too if wanted.
* "Unified" doesn't mean that force fields give the exact same results for
particles, softbody & cloth, since their final effect depends on many external
factors, like for example the surface area of the effected faces.
Code changes
* Subversion bump for correct handling of global gravity.
* Separate ui py file for common dynamics stuff.
* Particle settings updating is flushed with it's id through
DAG_id_flush_update(..).
Known issues
* Curve guides don't yet have all ui buttons in place, but they
should work none the less.
* Hair dynamics don't yet respect force fields.
Other changes
* Particle emission defaults now to frames 1-200 with life of 50
frames to fill the whole default timeline.
* Many particles drawing related crashes fixed.
* Sometimes particles didn't update on first frame properly.
* Hair with object/group visualization didn't work properly.
* Memory leaks with PointCacheID lists (Genscher, remember to
free pidlists after use :).
2009-09-30 22:10:14 +00:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
WM_main_add_notifier(NC_OBJECT | ND_DRAW, NULL);
|
Unified effector functionality for particles, cloth and softbody
* Unified scene wide gravity (currently in scene buttons)
instead of each simulation having it's own gravity.
* Weight parameters for all effectors and an effector group
setting.
* Every effector can use noise.
* Most effectors have "shapes" point, plane, surface, every point.
- "Point" is most like the old effectors and uses the
effector location as the effector point.
- "Plane" uses the closest point on effectors local xy-plane
as the effector point.
- "Surface" uses the closest point on an effector object's
surface as the effector point.
- "Every Point" uses every point in a mesh effector object
as an effector point.
- The falloff is calculated from this point, so for example
with "surface" shape and "use only negative z axis" it's
possible to apply force only "inside" the effector object.
* Spherical effector is now renamed as "force" as it's no longer
just spherical.
* New effector parameter "flow", which makes the effector act as
surrounding air velocity, so the resulting force is
proportional to the velocity difference of the point and "air
velocity". For example a wind field with flow=1.0 results in
proper non-accelerating wind.
* New effector fields "turbulence", which creates nice random
flow paths, and "drag", which slows the points down.
* Much improved vortex field.
* Effectors can now effect particle rotation as well as location.
* Use full, or only positive/negative z-axis to apply force
(note. the z-axis is the surface normal in the case of
effector shape "surface")
* New "force field" submenu in add menu, which adds an empty
with the chosen effector (curve object for corve guides).
* Other dynamics should be quite easy to add to the effector
system too if wanted.
* "Unified" doesn't mean that force fields give the exact same results for
particles, softbody & cloth, since their final effect depends on many external
factors, like for example the surface area of the effected faces.
Code changes
* Subversion bump for correct handling of global gravity.
* Separate ui py file for common dynamics stuff.
* Particle settings updating is flushed with it's id through
DAG_id_flush_update(..).
Known issues
* Curve guides don't yet have all ui buttons in place, but they
should work none the less.
* Hair dynamics don't yet respect force fields.
Other changes
* Particle emission defaults now to frames 1-200 with life of 50
frames to fill the whole default timeline.
* Many particles drawing related crashes fixed.
* Sometimes particles didn't update on first frame properly.
* Hair with object/group visualization didn't work properly.
* Memory leaks with PointCacheID lists (Genscher, remember to
free pidlists after use :).
2009-09-30 22:10:14 +00:00
|
|
|
}
|
2009-11-03 02:49:36 +00:00
|
|
|
|
|
|
|
|
static char *rna_EffectorWeight_path(PointerRNA *ptr)
|
|
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
EffectorWeights *ew = (EffectorWeights *)ptr->data;
|
|
|
|
|
/* Check through all possible places the settings can be to find the right one */
|
|
|
|
|
|
|
|
|
|
if (particle_id_check(ptr)) {
|
|
|
|
|
/* particle effector weights */
|
2019-08-23 09:52:12 +02:00
|
|
|
ParticleSettings *part = (ParticleSettings *)ptr->owner_id;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
|
|
|
|
if (part->effector_weights == ew) {
|
|
|
|
|
return BLI_strdup("effector_weights");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else {
|
2019-08-23 09:52:12 +02:00
|
|
|
Object *ob = (Object *)ptr->owner_id;
|
2019-04-17 06:17:24 +02:00
|
|
|
ModifierData *md;
|
|
|
|
|
|
|
|
|
|
/* check softbody modifier */
|
|
|
|
|
md = (ModifierData *)modifiers_findByType(ob, eModifierType_Softbody);
|
|
|
|
|
if (md) {
|
|
|
|
|
/* no pointer from modifier data to actual softbody storage, would be good to add */
|
|
|
|
|
if (ob->soft->effector_weights == ew) {
|
|
|
|
|
char name_esc[sizeof(md->name) * 2];
|
|
|
|
|
BLI_strescape(name_esc, md->name, sizeof(name_esc));
|
|
|
|
|
return BLI_sprintfN("modifiers[\"%s\"].settings.effector_weights", name_esc);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* check cloth modifier */
|
|
|
|
|
md = (ModifierData *)modifiers_findByType(ob, eModifierType_Cloth);
|
|
|
|
|
if (md) {
|
|
|
|
|
ClothModifierData *cmd = (ClothModifierData *)md;
|
|
|
|
|
if (cmd->sim_parms->effector_weights == ew) {
|
|
|
|
|
char name_esc[sizeof(md->name) * 2];
|
|
|
|
|
BLI_strescape(name_esc, md->name, sizeof(name_esc));
|
|
|
|
|
return BLI_sprintfN("modifiers[\"%s\"].settings.effector_weights", name_esc);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* check smoke modifier */
|
|
|
|
|
md = (ModifierData *)modifiers_findByType(ob, eModifierType_Smoke);
|
|
|
|
|
if (md) {
|
|
|
|
|
SmokeModifierData *smd = (SmokeModifierData *)md;
|
|
|
|
|
if (smd->domain->effector_weights == ew) {
|
|
|
|
|
char name_esc[sizeof(md->name) * 2];
|
|
|
|
|
BLI_strescape(name_esc, md->name, sizeof(name_esc));
|
|
|
|
|
return BLI_sprintfN("modifiers[\"%s\"].settings.effector_weights", name_esc);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* check dynamic paint modifier */
|
|
|
|
|
md = (ModifierData *)modifiers_findByType(ob, eModifierType_DynamicPaint);
|
|
|
|
|
if (md) {
|
|
|
|
|
DynamicPaintModifierData *pmd = (DynamicPaintModifierData *)md;
|
|
|
|
|
|
|
|
|
|
if (pmd->canvas) {
|
|
|
|
|
DynamicPaintSurface *surface = pmd->canvas->surfaces.first;
|
|
|
|
|
|
|
|
|
|
for (; surface; surface = surface->next) {
|
|
|
|
|
if (surface->effector_weights == ew) {
|
|
|
|
|
char name_esc[sizeof(md->name) * 2];
|
|
|
|
|
char name_esc_surface[sizeof(surface->name) * 2];
|
|
|
|
|
|
|
|
|
|
BLI_strescape(name_esc, md->name, sizeof(name_esc));
|
|
|
|
|
BLI_strescape(name_esc_surface, surface->name, sizeof(name_esc_surface));
|
|
|
|
|
return BLI_sprintfN(
|
|
|
|
|
"modifiers[\"%s\"].canvas_settings.canvas_surfaces[\"%s\"]"
|
|
|
|
|
".effector_weights",
|
|
|
|
|
name_esc,
|
|
|
|
|
name_esc_surface);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return NULL;
|
2009-11-03 02:49:36 +00:00
|
|
|
}
|
|
|
|
|
|
2009-12-08 17:23:48 +00:00
|
|
|
static void rna_CollisionSettings_dependency_update(Main *bmain, Scene *scene, PointerRNA *ptr)
|
2009-07-02 19:41:31 +00:00
|
|
|
{
|
2019-08-23 09:52:12 +02:00
|
|
|
Object *ob = (Object *)ptr->owner_id;
|
2019-04-17 06:17:24 +02:00
|
|
|
ModifierData *md = modifiers_findByType(ob, eModifierType_Collision);
|
2009-07-02 19:41:31 +00:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
/* add/remove modifier as needed */
|
2019-06-04 00:21:57 +10:00
|
|
|
if (ob->pd->deflect && !md) {
|
2019-04-17 06:17:24 +02:00
|
|
|
ED_object_modifier_add(NULL, bmain, scene, ob, NULL, eModifierType_Collision);
|
2019-06-04 00:21:57 +10:00
|
|
|
}
|
|
|
|
|
else if (!ob->pd->deflect && md) {
|
2019-04-17 06:17:24 +02:00
|
|
|
ED_object_modifier_remove(NULL, bmain, ob, md);
|
2019-06-04 00:21:57 +10:00
|
|
|
}
|
2009-07-02 19:41:31 +00:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
WM_main_add_notifier(NC_OBJECT | ND_DRAW, ob);
|
2009-07-02 19:41:31 +00:00
|
|
|
}
|
|
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
static void rna_CollisionSettings_update(Main *UNUSED(bmain),
|
|
|
|
|
Scene *UNUSED(scene),
|
|
|
|
|
PointerRNA *ptr)
|
2009-07-02 19:41:31 +00:00
|
|
|
{
|
2019-08-23 09:52:12 +02:00
|
|
|
Object *ob = (Object *)ptr->owner_id;
|
2009-07-02 19:41:31 +00:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
DEG_id_tag_update(&ob->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY | ID_RECALC_ANIMATION);
|
|
|
|
|
WM_main_add_notifier(NC_OBJECT | ND_DRAW, ob);
|
2009-07-02 19:41:31 +00:00
|
|
|
}
|
|
|
|
|
|
2011-05-31 02:14:25 +00:00
|
|
|
static void rna_softbody_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
|
2.5
Notifiers
---------
Various fixes for wrong use of notifiers, and some new notifiers
to make things a bit more clear and consistent, with two notable
changes:
* Geometry changes are now done with NC_GEOM, rather than
NC_OBJECT|ND_GEOM_, so an object does need to be available.
* Space data now use NC_SPACE|ND_SPACE_*, instead of data
notifiers or even NC_WINDOW in some cases. Note that NC_SPACE
should only be used for notifying about changes in space data,
we don't want to go back to allqueue(REDRAW..).
Depsgraph
---------
The dependency graph now has a different flush call:
DAG_object_flush_update(scene, ob, flag)
is replaced by:
DAG_id_flush_update(id, flag)
It still works basically the same, one difference is that it now
also accepts object data (e.g. Mesh), again to avoid requiring an
Object to be available. Other ID types will simply do nothing at
the moment.
Docs
----
I made some guidelines for how/when to do which kinds of updates
and notifiers. I can't specify totally exact how to make these
decisions, but these are basically the guidelines I use. So, new
and updated docs are here:
http://wiki.blender.org/index.php/BlenderDev/Blender2.5/NotifiersUpdates
http://wiki.blender.org/index.php/BlenderDev/Blender2.5/DataNotifiers
2009-09-04 20:51:09 +00:00
|
|
|
{
|
2019-08-23 09:52:12 +02:00
|
|
|
Object *ob = (Object *)ptr->owner_id;
|
2.5
Notifiers
---------
Various fixes for wrong use of notifiers, and some new notifiers
to make things a bit more clear and consistent, with two notable
changes:
* Geometry changes are now done with NC_GEOM, rather than
NC_OBJECT|ND_GEOM_, so an object does need to be available.
* Space data now use NC_SPACE|ND_SPACE_*, instead of data
notifiers or even NC_WINDOW in some cases. Note that NC_SPACE
should only be used for notifying about changes in space data,
we don't want to go back to allqueue(REDRAW..).
Depsgraph
---------
The dependency graph now has a different flush call:
DAG_object_flush_update(scene, ob, flag)
is replaced by:
DAG_id_flush_update(id, flag)
It still works basically the same, one difference is that it now
also accepts object data (e.g. Mesh), again to avoid requiring an
Object to be available. Other ID types will simply do nothing at
the moment.
Docs
----
I made some guidelines for how/when to do which kinds of updates
and notifiers. I can't specify totally exact how to make these
decisions, but these are basically the guidelines I use. So, new
and updated docs are here:
http://wiki.blender.org/index.php/BlenderDev/Blender2.5/NotifiersUpdates
http://wiki.blender.org/index.php/BlenderDev/Blender2.5/DataNotifiers
2009-09-04 20:51:09 +00:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
|
|
|
|
|
WM_main_add_notifier(NC_OBJECT | ND_MODIFIER, ob);
|
2.5
Notifiers
---------
Various fixes for wrong use of notifiers, and some new notifiers
to make things a bit more clear and consistent, with two notable
changes:
* Geometry changes are now done with NC_GEOM, rather than
NC_OBJECT|ND_GEOM_, so an object does need to be available.
* Space data now use NC_SPACE|ND_SPACE_*, instead of data
notifiers or even NC_WINDOW in some cases. Note that NC_SPACE
should only be used for notifying about changes in space data,
we don't want to go back to allqueue(REDRAW..).
Depsgraph
---------
The dependency graph now has a different flush call:
DAG_object_flush_update(scene, ob, flag)
is replaced by:
DAG_id_flush_update(id, flag)
It still works basically the same, one difference is that it now
also accepts object data (e.g. Mesh), again to avoid requiring an
Object to be available. Other ID types will simply do nothing at
the moment.
Docs
----
I made some guidelines for how/when to do which kinds of updates
and notifiers. I can't specify totally exact how to make these
decisions, but these are basically the guidelines I use. So, new
and updated docs are here:
http://wiki.blender.org/index.php/BlenderDev/Blender2.5/NotifiersUpdates
http://wiki.blender.org/index.php/BlenderDev/Blender2.5/DataNotifiers
2009-09-04 20:51:09 +00:00
|
|
|
}
|
|
|
|
|
|
Fix depsgraph to compute more accurate links for collision & force.
Current implementation more or less indiscriminately links physics
objects to colliders and forces, ignoring precise details of layer
checks and collider groups. The new depsgraph seemed to lack some
such links at all. The relevant code in modifiers suffers from a
lot of duplication.
Different physics simulations use independent implementations of
collision and similar things, which results in a lot of variance:
* Cloth collides with objects on same or visible layer with dupli.
* Softbody collides with objects on same layer without dupli.
* Non-hair particles collide on same layer with dupli.
* Smoke uses same code as cloth, but needs different modifier.
* Dynamic paint "collides" with brushes on any layer without dupli.
Force fields with absorption also imply dependency on colliders:
* For most systems, colliders are selected from same layer as field.
* For non-hair particles, it uses the same exact set as the particles.
As a special quirk, smoke ignores smoke flow force fields; on the other
hand dependency on such field implies dependency on the smoke domain.
This introduces two utility functions each for old and new depsgraph
that are flexible enough to handle all these variations, and uses them
to handle particles, cloth, smoke, softbody and dynpaint.
One thing to watch out for is that depsgraph code shouldn't rely on
any properties that don't cause a graph rebuild when changed. This
was violated in the original code that was building force field links,
while taking zero field weights into account.
This change may cause new dependency cycles in cases where necessary
dependencies were missing, but may also remove cycles in situations
where unnecessary links were previously created. It's also now possible
to solve some cycles by switching to explicit groups, since they are
now properly taken into account for dependencies.
Differential Revision: https://developer.blender.org/D2141
2016-08-12 18:23:29 +03:00
|
|
|
static void rna_softbody_dependency_update(Main *bmain, Scene *scene, PointerRNA *ptr)
|
|
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
DEG_relations_tag_update(bmain);
|
|
|
|
|
rna_softbody_update(bmain, scene, ptr);
|
Fix depsgraph to compute more accurate links for collision & force.
Current implementation more or less indiscriminately links physics
objects to colliders and forces, ignoring precise details of layer
checks and collider groups. The new depsgraph seemed to lack some
such links at all. The relevant code in modifiers suffers from a
lot of duplication.
Different physics simulations use independent implementations of
collision and similar things, which results in a lot of variance:
* Cloth collides with objects on same or visible layer with dupli.
* Softbody collides with objects on same layer without dupli.
* Non-hair particles collide on same layer with dupli.
* Smoke uses same code as cloth, but needs different modifier.
* Dynamic paint "collides" with brushes on any layer without dupli.
Force fields with absorption also imply dependency on colliders:
* For most systems, colliders are selected from same layer as field.
* For non-hair particles, it uses the same exact set as the particles.
As a special quirk, smoke ignores smoke flow force fields; on the other
hand dependency on such field implies dependency on the smoke domain.
This introduces two utility functions each for old and new depsgraph
that are flexible enough to handle all these variations, and uses them
to handle particles, cloth, smoke, softbody and dynpaint.
One thing to watch out for is that depsgraph code shouldn't rely on
any properties that don't cause a graph rebuild when changed. This
was violated in the original code that was building force field links,
while taking zero field weights into account.
This change may cause new dependency cycles in cases where necessary
dependencies were missing, but may also remove cycles in situations
where unnecessary links were previously created. It's also now possible
to solve some cycles by switching to explicit groups, since they are
now properly taken into account for dependencies.
Differential Revision: https://developer.blender.org/D2141
2016-08-12 18:23:29 +03:00
|
|
|
}
|
Unified effector functionality for particles, cloth and softbody
* Unified scene wide gravity (currently in scene buttons)
instead of each simulation having it's own gravity.
* Weight parameters for all effectors and an effector group
setting.
* Every effector can use noise.
* Most effectors have "shapes" point, plane, surface, every point.
- "Point" is most like the old effectors and uses the
effector location as the effector point.
- "Plane" uses the closest point on effectors local xy-plane
as the effector point.
- "Surface" uses the closest point on an effector object's
surface as the effector point.
- "Every Point" uses every point in a mesh effector object
as an effector point.
- The falloff is calculated from this point, so for example
with "surface" shape and "use only negative z axis" it's
possible to apply force only "inside" the effector object.
* Spherical effector is now renamed as "force" as it's no longer
just spherical.
* New effector parameter "flow", which makes the effector act as
surrounding air velocity, so the resulting force is
proportional to the velocity difference of the point and "air
velocity". For example a wind field with flow=1.0 results in
proper non-accelerating wind.
* New effector fields "turbulence", which creates nice random
flow paths, and "drag", which slows the points down.
* Much improved vortex field.
* Effectors can now effect particle rotation as well as location.
* Use full, or only positive/negative z-axis to apply force
(note. the z-axis is the surface normal in the case of
effector shape "surface")
* New "force field" submenu in add menu, which adds an empty
with the chosen effector (curve object for corve guides).
* Other dynamics should be quite easy to add to the effector
system too if wanted.
* "Unified" doesn't mean that force fields give the exact same results for
particles, softbody & cloth, since their final effect depends on many external
factors, like for example the surface area of the effected faces.
Code changes
* Subversion bump for correct handling of global gravity.
* Separate ui py file for common dynamics stuff.
* Particle settings updating is flushed with it's id through
DAG_id_flush_update(..).
Known issues
* Curve guides don't yet have all ui buttons in place, but they
should work none the less.
* Hair dynamics don't yet respect force fields.
Other changes
* Particle emission defaults now to frames 1-200 with life of 50
frames to fill the whole default timeline.
* Many particles drawing related crashes fixed.
* Sometimes particles didn't update on first frame properly.
* Hair with object/group visualization didn't work properly.
* Memory leaks with PointCacheID lists (Genscher, remember to
free pidlists after use :).
2009-09-30 22:10:14 +00:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
static const EnumPropertyItem *rna_Effector_shape_itemf(bContext *UNUSED(C),
|
|
|
|
|
PointerRNA *ptr,
|
|
|
|
|
PropertyRNA *UNUSED(prop),
|
|
|
|
|
bool *UNUSED(r_free))
|
Unified effector functionality for particles, cloth and softbody
* Unified scene wide gravity (currently in scene buttons)
instead of each simulation having it's own gravity.
* Weight parameters for all effectors and an effector group
setting.
* Every effector can use noise.
* Most effectors have "shapes" point, plane, surface, every point.
- "Point" is most like the old effectors and uses the
effector location as the effector point.
- "Plane" uses the closest point on effectors local xy-plane
as the effector point.
- "Surface" uses the closest point on an effector object's
surface as the effector point.
- "Every Point" uses every point in a mesh effector object
as an effector point.
- The falloff is calculated from this point, so for example
with "surface" shape and "use only negative z axis" it's
possible to apply force only "inside" the effector object.
* Spherical effector is now renamed as "force" as it's no longer
just spherical.
* New effector parameter "flow", which makes the effector act as
surrounding air velocity, so the resulting force is
proportional to the velocity difference of the point and "air
velocity". For example a wind field with flow=1.0 results in
proper non-accelerating wind.
* New effector fields "turbulence", which creates nice random
flow paths, and "drag", which slows the points down.
* Much improved vortex field.
* Effectors can now effect particle rotation as well as location.
* Use full, or only positive/negative z-axis to apply force
(note. the z-axis is the surface normal in the case of
effector shape "surface")
* New "force field" submenu in add menu, which adds an empty
with the chosen effector (curve object for corve guides).
* Other dynamics should be quite easy to add to the effector
system too if wanted.
* "Unified" doesn't mean that force fields give the exact same results for
particles, softbody & cloth, since their final effect depends on many external
factors, like for example the surface area of the effected faces.
Code changes
* Subversion bump for correct handling of global gravity.
* Separate ui py file for common dynamics stuff.
* Particle settings updating is flushed with it's id through
DAG_id_flush_update(..).
Known issues
* Curve guides don't yet have all ui buttons in place, but they
should work none the less.
* Hair dynamics don't yet respect force fields.
Other changes
* Particle emission defaults now to frames 1-200 with life of 50
frames to fill the whole default timeline.
* Many particles drawing related crashes fixed.
* Sometimes particles didn't update on first frame properly.
* Hair with object/group visualization didn't work properly.
* Memory leaks with PointCacheID lists (Genscher, remember to
free pidlists after use :).
2009-09-30 22:10:14 +00:00
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
Object *ob = NULL;
|
Unified effector functionality for particles, cloth and softbody
* Unified scene wide gravity (currently in scene buttons)
instead of each simulation having it's own gravity.
* Weight parameters for all effectors and an effector group
setting.
* Every effector can use noise.
* Most effectors have "shapes" point, plane, surface, every point.
- "Point" is most like the old effectors and uses the
effector location as the effector point.
- "Plane" uses the closest point on effectors local xy-plane
as the effector point.
- "Surface" uses the closest point on an effector object's
surface as the effector point.
- "Every Point" uses every point in a mesh effector object
as an effector point.
- The falloff is calculated from this point, so for example
with "surface" shape and "use only negative z axis" it's
possible to apply force only "inside" the effector object.
* Spherical effector is now renamed as "force" as it's no longer
just spherical.
* New effector parameter "flow", which makes the effector act as
surrounding air velocity, so the resulting force is
proportional to the velocity difference of the point and "air
velocity". For example a wind field with flow=1.0 results in
proper non-accelerating wind.
* New effector fields "turbulence", which creates nice random
flow paths, and "drag", which slows the points down.
* Much improved vortex field.
* Effectors can now effect particle rotation as well as location.
* Use full, or only positive/negative z-axis to apply force
(note. the z-axis is the surface normal in the case of
effector shape "surface")
* New "force field" submenu in add menu, which adds an empty
with the chosen effector (curve object for corve guides).
* Other dynamics should be quite easy to add to the effector
system too if wanted.
* "Unified" doesn't mean that force fields give the exact same results for
particles, softbody & cloth, since their final effect depends on many external
factors, like for example the surface area of the effected faces.
Code changes
* Subversion bump for correct handling of global gravity.
* Separate ui py file for common dynamics stuff.
* Particle settings updating is flushed with it's id through
DAG_id_flush_update(..).
Known issues
* Curve guides don't yet have all ui buttons in place, but they
should work none the less.
* Hair dynamics don't yet respect force fields.
Other changes
* Particle emission defaults now to frames 1-200 with life of 50
frames to fill the whole default timeline.
* Many particles drawing related crashes fixed.
* Sometimes particles didn't update on first frame properly.
* Hair with object/group visualization didn't work properly.
* Memory leaks with PointCacheID lists (Genscher, remember to
free pidlists after use :).
2009-09-30 22:10:14 +00:00
|
|
|
|
2019-06-04 00:21:57 +10:00
|
|
|
if (particle_id_check(ptr)) {
|
2019-04-17 06:17:24 +02:00
|
|
|
return empty_shape_items;
|
2019-06-04 00:21:57 +10:00
|
|
|
}
|
2018-06-09 14:40:09 +02:00
|
|
|
|
2019-08-23 09:52:12 +02:00
|
|
|
ob = (Object *)ptr->owner_id;
|
2018-06-09 14:40:09 +02:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
if (ob->type == OB_CURVE) {
|
2019-06-04 00:21:57 +10:00
|
|
|
if (ob->pd->forcefield == PFIELD_VORTEX) {
|
2019-04-17 06:17:24 +02:00
|
|
|
return curve_vortex_shape_items;
|
2019-06-04 00:21:57 +10:00
|
|
|
}
|
2009-10-05 13:25:56 +00:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
return curve_shape_items;
|
|
|
|
|
}
|
|
|
|
|
else if (ELEM(ob->type, OB_MESH, OB_SURF, OB_FONT)) {
|
2019-06-04 00:21:57 +10:00
|
|
|
if (ob->pd->forcefield == PFIELD_VORTEX) {
|
2019-04-17 06:17:24 +02:00
|
|
|
return vortex_shape_items;
|
2019-06-04 00:21:57 +10:00
|
|
|
}
|
Unified effector functionality for particles, cloth and softbody
* Unified scene wide gravity (currently in scene buttons)
instead of each simulation having it's own gravity.
* Weight parameters for all effectors and an effector group
setting.
* Every effector can use noise.
* Most effectors have "shapes" point, plane, surface, every point.
- "Point" is most like the old effectors and uses the
effector location as the effector point.
- "Plane" uses the closest point on effectors local xy-plane
as the effector point.
- "Surface" uses the closest point on an effector object's
surface as the effector point.
- "Every Point" uses every point in a mesh effector object
as an effector point.
- The falloff is calculated from this point, so for example
with "surface" shape and "use only negative z axis" it's
possible to apply force only "inside" the effector object.
* Spherical effector is now renamed as "force" as it's no longer
just spherical.
* New effector parameter "flow", which makes the effector act as
surrounding air velocity, so the resulting force is
proportional to the velocity difference of the point and "air
velocity". For example a wind field with flow=1.0 results in
proper non-accelerating wind.
* New effector fields "turbulence", which creates nice random
flow paths, and "drag", which slows the points down.
* Much improved vortex field.
* Effectors can now effect particle rotation as well as location.
* Use full, or only positive/negative z-axis to apply force
(note. the z-axis is the surface normal in the case of
effector shape "surface")
* New "force field" submenu in add menu, which adds an empty
with the chosen effector (curve object for corve guides).
* Other dynamics should be quite easy to add to the effector
system too if wanted.
* "Unified" doesn't mean that force fields give the exact same results for
particles, softbody & cloth, since their final effect depends on many external
factors, like for example the surface area of the effected faces.
Code changes
* Subversion bump for correct handling of global gravity.
* Separate ui py file for common dynamics stuff.
* Particle settings updating is flushed with it's id through
DAG_id_flush_update(..).
Known issues
* Curve guides don't yet have all ui buttons in place, but they
should work none the less.
* Hair dynamics don't yet respect force fields.
Other changes
* Particle emission defaults now to frames 1-200 with life of 50
frames to fill the whole default timeline.
* Many particles drawing related crashes fixed.
* Sometimes particles didn't update on first frame properly.
* Hair with object/group visualization didn't work properly.
* Memory leaks with PointCacheID lists (Genscher, remember to
free pidlists after use :).
2009-09-30 22:10:14 +00:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
return effector_shape_items;
|
|
|
|
|
}
|
|
|
|
|
else {
|
2019-06-04 00:21:57 +10:00
|
|
|
if (ob->pd->forcefield == PFIELD_VORTEX) {
|
2019-04-17 06:17:24 +02:00
|
|
|
return empty_vortex_shape_items;
|
2019-06-04 00:21:57 +10:00
|
|
|
}
|
Unified effector functionality for particles, cloth and softbody
* Unified scene wide gravity (currently in scene buttons)
instead of each simulation having it's own gravity.
* Weight parameters for all effectors and an effector group
setting.
* Every effector can use noise.
* Most effectors have "shapes" point, plane, surface, every point.
- "Point" is most like the old effectors and uses the
effector location as the effector point.
- "Plane" uses the closest point on effectors local xy-plane
as the effector point.
- "Surface" uses the closest point on an effector object's
surface as the effector point.
- "Every Point" uses every point in a mesh effector object
as an effector point.
- The falloff is calculated from this point, so for example
with "surface" shape and "use only negative z axis" it's
possible to apply force only "inside" the effector object.
* Spherical effector is now renamed as "force" as it's no longer
just spherical.
* New effector parameter "flow", which makes the effector act as
surrounding air velocity, so the resulting force is
proportional to the velocity difference of the point and "air
velocity". For example a wind field with flow=1.0 results in
proper non-accelerating wind.
* New effector fields "turbulence", which creates nice random
flow paths, and "drag", which slows the points down.
* Much improved vortex field.
* Effectors can now effect particle rotation as well as location.
* Use full, or only positive/negative z-axis to apply force
(note. the z-axis is the surface normal in the case of
effector shape "surface")
* New "force field" submenu in add menu, which adds an empty
with the chosen effector (curve object for corve guides).
* Other dynamics should be quite easy to add to the effector
system too if wanted.
* "Unified" doesn't mean that force fields give the exact same results for
particles, softbody & cloth, since their final effect depends on many external
factors, like for example the surface area of the effected faces.
Code changes
* Subversion bump for correct handling of global gravity.
* Separate ui py file for common dynamics stuff.
* Particle settings updating is flushed with it's id through
DAG_id_flush_update(..).
Known issues
* Curve guides don't yet have all ui buttons in place, but they
should work none the less.
* Hair dynamics don't yet respect force fields.
Other changes
* Particle emission defaults now to frames 1-200 with life of 50
frames to fill the whole default timeline.
* Many particles drawing related crashes fixed.
* Sometimes particles didn't update on first frame properly.
* Hair with object/group visualization didn't work properly.
* Memory leaks with PointCacheID lists (Genscher, remember to
free pidlists after use :).
2009-09-30 22:10:14 +00:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
return empty_shape_items;
|
|
|
|
|
}
|
Unified effector functionality for particles, cloth and softbody
* Unified scene wide gravity (currently in scene buttons)
instead of each simulation having it's own gravity.
* Weight parameters for all effectors and an effector group
setting.
* Every effector can use noise.
* Most effectors have "shapes" point, plane, surface, every point.
- "Point" is most like the old effectors and uses the
effector location as the effector point.
- "Plane" uses the closest point on effectors local xy-plane
as the effector point.
- "Surface" uses the closest point on an effector object's
surface as the effector point.
- "Every Point" uses every point in a mesh effector object
as an effector point.
- The falloff is calculated from this point, so for example
with "surface" shape and "use only negative z axis" it's
possible to apply force only "inside" the effector object.
* Spherical effector is now renamed as "force" as it's no longer
just spherical.
* New effector parameter "flow", which makes the effector act as
surrounding air velocity, so the resulting force is
proportional to the velocity difference of the point and "air
velocity". For example a wind field with flow=1.0 results in
proper non-accelerating wind.
* New effector fields "turbulence", which creates nice random
flow paths, and "drag", which slows the points down.
* Much improved vortex field.
* Effectors can now effect particle rotation as well as location.
* Use full, or only positive/negative z-axis to apply force
(note. the z-axis is the surface normal in the case of
effector shape "surface")
* New "force field" submenu in add menu, which adds an empty
with the chosen effector (curve object for corve guides).
* Other dynamics should be quite easy to add to the effector
system too if wanted.
* "Unified" doesn't mean that force fields give the exact same results for
particles, softbody & cloth, since their final effect depends on many external
factors, like for example the surface area of the effected faces.
Code changes
* Subversion bump for correct handling of global gravity.
* Separate ui py file for common dynamics stuff.
* Particle settings updating is flushed with it's id through
DAG_id_flush_update(..).
Known issues
* Curve guides don't yet have all ui buttons in place, but they
should work none the less.
* Hair dynamics don't yet respect force fields.
Other changes
* Particle emission defaults now to frames 1-200 with life of 50
frames to fill the whole default timeline.
* Many particles drawing related crashes fixed.
* Sometimes particles didn't update on first frame properly.
* Hair with object/group visualization didn't work properly.
* Memory leaks with PointCacheID lists (Genscher, remember to
free pidlists after use :).
2009-09-30 22:10:14 +00:00
|
|
|
}
|
|
|
|
|
|
2009-01-02 13:47:33 +00:00
|
|
|
#else
|
|
|
|
|
|
2018-03-18 15:37:23 +01:00
|
|
|
static void rna_def_pointcache_common(StructRNA *srna)
|
2016-12-28 17:30:58 +01:00
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
PropertyRNA *prop;
|
|
|
|
|
|
|
|
|
|
static const EnumPropertyItem point_cache_compress_items[] = {
|
|
|
|
|
{PTCACHE_COMPRESS_NO, "NO", 0, "None", "No compression"},
|
2019-05-08 22:24:10 +02:00
|
|
|
{PTCACHE_COMPRESS_LZO, "LIGHT", 0, "Lite", "Fast but not so effective compression"},
|
2019-04-17 06:17:24 +02:00
|
|
|
{PTCACHE_COMPRESS_LZMA, "HEAVY", 0, "Heavy", "Effective but slow compression"},
|
|
|
|
|
{0, NULL, 0, NULL, NULL},
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "frame_start", PROP_INT, PROP_TIME);
|
|
|
|
|
RNA_def_property_int_sdna(prop, NULL, "startframe");
|
|
|
|
|
RNA_def_property_range(prop, -MAXFRAME, MAXFRAME);
|
|
|
|
|
RNA_def_property_ui_range(prop, 1, MAXFRAME, 1, 1);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Start", "Frame on which the simulation starts");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "frame_end", PROP_INT, PROP_TIME);
|
|
|
|
|
RNA_def_property_int_sdna(prop, NULL, "endframe");
|
|
|
|
|
RNA_def_property_range(prop, 1, MAXFRAME);
|
|
|
|
|
RNA_def_property_ui_text(prop, "End", "Frame on which the simulation stops");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "frame_step", PROP_INT, PROP_NONE);
|
|
|
|
|
RNA_def_property_int_sdna(prop, NULL, "step");
|
|
|
|
|
RNA_def_property_range(prop, 1, 20);
|
|
|
|
|
RNA_def_property_int_funcs(prop, NULL, NULL, "rna_PointCache_frame_step_range");
|
|
|
|
|
RNA_def_property_ui_text(prop, "Cache Step", "Number of frames between cached frames");
|
|
|
|
|
RNA_def_property_update(prop, NC_OBJECT, "rna_Cache_change");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "index", PROP_INT, PROP_NONE);
|
|
|
|
|
RNA_def_property_int_sdna(prop, NULL, "index");
|
|
|
|
|
RNA_def_property_range(prop, -1, 100);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Cache Index", "Index number of cache files");
|
|
|
|
|
RNA_def_property_update(prop, NC_OBJECT, "rna_Cache_idname_change");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "compression", PROP_ENUM, PROP_NONE);
|
|
|
|
|
RNA_def_property_enum_items(prop, point_cache_compress_items);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Cache Compression", "Compression method to be used");
|
|
|
|
|
|
|
|
|
|
/* flags */
|
|
|
|
|
prop = RNA_def_property(srna, "is_baked", PROP_BOOLEAN, PROP_NONE);
|
|
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", PTCACHE_BAKED);
|
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "is_baking", PROP_BOOLEAN, PROP_NONE);
|
|
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", PTCACHE_BAKING);
|
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "use_disk_cache", PROP_BOOLEAN, PROP_NONE);
|
|
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", PTCACHE_DISK_CACHE);
|
|
|
|
|
RNA_def_property_ui_text(
|
|
|
|
|
prop, "Disk Cache", "Save cache files to disk (.blend file must be saved first)");
|
|
|
|
|
RNA_def_property_update(prop, NC_OBJECT, "rna_Cache_toggle_disk_cache");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "is_outdated", PROP_BOOLEAN, PROP_NONE);
|
|
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", PTCACHE_OUTDATED);
|
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Cache is outdated", "");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "is_frame_skip", PROP_BOOLEAN, PROP_NONE);
|
|
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", PTCACHE_FRAMES_SKIPPED);
|
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
|
|
|
|
|
RNA_def_property_string_sdna(prop, NULL, "name");
|
|
|
|
|
RNA_def_property_ui_text(prop, "Name", "Cache name");
|
|
|
|
|
RNA_def_property_update(prop, NC_OBJECT, "rna_Cache_idname_change");
|
|
|
|
|
RNA_def_struct_name_property(srna, prop);
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_DIRPATH);
|
|
|
|
|
RNA_def_property_string_sdna(prop, NULL, "path");
|
|
|
|
|
RNA_def_property_ui_text(prop, "File Path", "Cache file path");
|
|
|
|
|
RNA_def_property_update(prop, NC_OBJECT, "rna_Cache_idname_change");
|
|
|
|
|
|
|
|
|
|
/* removed, see PTCACHE_QUICK_CACHE */
|
|
|
|
|
# if 0
|
|
|
|
|
prop = RNA_def_property(srna, "use_quick_cache", PROP_BOOLEAN, PROP_NONE);
|
|
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", PTCACHE_QUICK_CACHE);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Quick Cache", "Update simulation with cache steps");
|
|
|
|
|
RNA_def_property_update(prop, NC_OBJECT, "rna_Cache_change");
|
|
|
|
|
# endif
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "info", PROP_STRING, PROP_NONE);
|
|
|
|
|
RNA_def_property_string_sdna(prop, NULL, "info");
|
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
2019-08-17 00:54:22 +10:00
|
|
|
/* Note that we do not actually need a getter here, `rna_Cache_info_length` will update the info
|
2019-08-13 12:56:27 +02:00
|
|
|
* string just as well. */
|
|
|
|
|
RNA_def_property_string_funcs(prop, NULL, "rna_Cache_info_length", NULL);
|
|
|
|
|
RNA_def_property_string_maxlength(
|
|
|
|
|
prop, sizeof(((PointCache *)0)->info) / sizeof(*(((PointCache *)0)->info)));
|
2019-04-17 06:17:24 +02:00
|
|
|
RNA_def_property_ui_text(prop, "Cache Info", "Info on current cache status");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "use_external", PROP_BOOLEAN, PROP_NONE);
|
|
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", PTCACHE_EXTERNAL);
|
|
|
|
|
RNA_def_property_ui_text(prop, "External", "Read cache from an external location");
|
|
|
|
|
RNA_def_property_update(prop, NC_OBJECT, "rna_Cache_idname_change");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "use_library_path", PROP_BOOLEAN, PROP_NONE);
|
|
|
|
|
RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", PTCACHE_IGNORE_LIBPATH);
|
|
|
|
|
RNA_def_property_ui_text(
|
|
|
|
|
prop,
|
|
|
|
|
"Library Path",
|
|
|
|
|
"Use this file's path for the disk cache when library linked into another file "
|
|
|
|
|
"(for local bakes per scene file, disable this option)");
|
|
|
|
|
RNA_def_property_update(prop, NC_OBJECT, "rna_Cache_idname_change");
|
2018-03-18 15:37:23 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void rna_def_ptcache_point_caches(BlenderRNA *brna, PropertyRNA *cprop)
|
|
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
StructRNA *srna;
|
|
|
|
|
PropertyRNA *prop;
|
|
|
|
|
|
|
|
|
|
/* FunctionRNA *func; */
|
|
|
|
|
/* PropertyRNA *parm; */
|
|
|
|
|
|
|
|
|
|
RNA_def_property_srna(cprop, "PointCaches");
|
|
|
|
|
srna = RNA_def_struct(brna, "PointCaches", NULL);
|
|
|
|
|
RNA_def_struct_sdna(srna, "PointCache");
|
|
|
|
|
RNA_def_struct_ui_text(srna, "Point Caches", "Collection of point caches");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "active_index", PROP_INT, PROP_UNSIGNED);
|
|
|
|
|
RNA_def_property_int_funcs(prop,
|
|
|
|
|
"rna_Cache_active_point_cache_index_get",
|
|
|
|
|
"rna_Cache_active_point_cache_index_set",
|
|
|
|
|
"rna_Cache_active_point_cache_index_range");
|
|
|
|
|
RNA_def_property_ui_text(prop, "Active Point Cache Index", "");
|
|
|
|
|
RNA_def_property_update(prop, NC_OBJECT, "rna_Cache_change");
|
|
|
|
|
|
|
|
|
|
/* And define another RNA type for those collection items. */
|
|
|
|
|
srna = RNA_def_struct(brna, "PointCacheItem", NULL);
|
|
|
|
|
RNA_def_struct_sdna(srna, "PointCache");
|
|
|
|
|
RNA_def_struct_ui_text(srna, "Point Cache", "Point cache for physics simulations");
|
|
|
|
|
RNA_def_struct_ui_icon(srna, ICON_PHYSICS);
|
|
|
|
|
|
|
|
|
|
rna_def_pointcache_common(srna);
|
2018-03-18 15:37:23 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void rna_def_pointcache_active(BlenderRNA *brna)
|
|
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
StructRNA *srna;
|
|
|
|
|
PropertyRNA *prop;
|
|
|
|
|
|
|
|
|
|
srna = RNA_def_struct(brna, "PointCache", NULL);
|
|
|
|
|
RNA_def_struct_ui_text(srna, "Active Point Cache", "Active point cache for physics simulations");
|
|
|
|
|
RNA_def_struct_ui_icon(srna, ICON_PHYSICS);
|
|
|
|
|
|
|
|
|
|
rna_def_pointcache_common(srna);
|
|
|
|
|
|
|
|
|
|
/* This first-level RNA pointer also has list of all caches from owning ID.
|
|
|
|
|
* Those caches items have exact same content as 'active' one, except for that collection,
|
|
|
|
|
* to prevent ugly recursive layout pattern.
|
2019-04-22 02:48:05 +10:00
|
|
|
*
|
|
|
|
|
* Note: This shall probably be redone from scratch in a proper way at some point,
|
|
|
|
|
* but for now that will do, and shall not break anything in the API. */
|
2019-04-17 06:17:24 +02:00
|
|
|
prop = RNA_def_property(srna, "point_caches", PROP_COLLECTION, PROP_NONE);
|
|
|
|
|
RNA_def_property_collection_funcs(prop,
|
|
|
|
|
"rna_Cache_list_begin",
|
|
|
|
|
"rna_iterator_listbase_next",
|
|
|
|
|
"rna_iterator_listbase_end",
|
|
|
|
|
"rna_iterator_listbase_get",
|
|
|
|
|
NULL,
|
|
|
|
|
NULL,
|
|
|
|
|
NULL,
|
|
|
|
|
NULL);
|
|
|
|
|
RNA_def_property_struct_type(prop, "PointCacheItem");
|
|
|
|
|
RNA_def_property_ui_text(prop, "Point Cache List", "");
|
|
|
|
|
rna_def_ptcache_point_caches(brna, prop);
|
2016-12-28 17:30:58 +01:00
|
|
|
}
|
|
|
|
|
|
2009-01-02 13:47:33 +00:00
|
|
|
static void rna_def_collision(BlenderRNA *brna)
|
|
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
StructRNA *srna;
|
|
|
|
|
PropertyRNA *prop;
|
|
|
|
|
|
|
|
|
|
srna = RNA_def_struct(brna, "CollisionSettings", NULL);
|
|
|
|
|
RNA_def_struct_sdna(srna, "PartDeflect");
|
|
|
|
|
RNA_def_struct_path_func(srna, "rna_CollisionSettings_path");
|
|
|
|
|
RNA_def_struct_ui_text(
|
|
|
|
|
srna, "Collision Settings", "Collision settings for object in physics simulation");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "use", PROP_BOOLEAN, PROP_NONE);
|
|
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "deflect", 1);
|
|
|
|
|
RNA_def_property_ui_text(
|
|
|
|
|
prop, "Enabled", "Enable this objects as a collider for physics systems");
|
|
|
|
|
RNA_def_property_update(prop, 0, "rna_CollisionSettings_dependency_update");
|
|
|
|
|
|
|
|
|
|
/* Particle Interaction */
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "damping_factor", PROP_FLOAT, PROP_FACTOR);
|
|
|
|
|
RNA_def_property_float_sdna(prop, NULL, "pdef_damp");
|
|
|
|
|
RNA_def_property_range(prop, 0.0f, 1.0f);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Damping Factor", "Amount of damping during particle collision");
|
|
|
|
|
RNA_def_property_update(prop, 0, "rna_CollisionSettings_update");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "damping_random", PROP_FLOAT, PROP_FACTOR);
|
|
|
|
|
RNA_def_property_float_sdna(prop, NULL, "pdef_rdamp");
|
|
|
|
|
RNA_def_property_range(prop, 0.0f, 1.0f);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Random Damping", "Random variation of damping");
|
|
|
|
|
RNA_def_property_update(prop, 0, "rna_CollisionSettings_update");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "friction_factor", PROP_FLOAT, PROP_FACTOR);
|
|
|
|
|
RNA_def_property_float_sdna(prop, NULL, "pdef_frict");
|
|
|
|
|
RNA_def_property_range(prop, 0.0f, 1.0f);
|
|
|
|
|
RNA_def_property_ui_text(
|
|
|
|
|
prop, "Friction Factor", "Amount of friction during particle collision");
|
|
|
|
|
RNA_def_property_update(prop, 0, "rna_CollisionSettings_update");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "friction_random", PROP_FLOAT, PROP_FACTOR);
|
|
|
|
|
RNA_def_property_float_sdna(prop, NULL, "pdef_rfrict");
|
|
|
|
|
RNA_def_property_range(prop, 0.0f, 1.0f);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Random Friction", "Random variation of friction");
|
|
|
|
|
RNA_def_property_update(prop, 0, "rna_CollisionSettings_update");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "permeability", PROP_FLOAT, PROP_FACTOR);
|
|
|
|
|
RNA_def_property_float_sdna(prop, NULL, "pdef_perm");
|
|
|
|
|
RNA_def_property_range(prop, 0.0f, 1.0f);
|
|
|
|
|
RNA_def_property_ui_text(
|
|
|
|
|
prop, "Permeability", "Chance that the particle will pass through the mesh");
|
|
|
|
|
RNA_def_property_update(prop, 0, "rna_CollisionSettings_update");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "use_particle_kill", PROP_BOOLEAN, PROP_NONE);
|
|
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", PDEFLE_KILL_PART);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Kill Particles", "Kill collided particles");
|
|
|
|
|
RNA_def_property_update(prop, 0, "rna_CollisionSettings_update");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "stickiness", PROP_FLOAT, PROP_NONE);
|
|
|
|
|
RNA_def_property_float_sdna(prop, NULL, "pdef_stickness");
|
|
|
|
|
RNA_def_property_range(prop, 0.0f, 10.0f);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Stickiness", "Amount of stickiness to surface collision");
|
|
|
|
|
RNA_def_property_update(prop, 0, "rna_CollisionSettings_update");
|
|
|
|
|
|
|
|
|
|
/* Soft Body and Cloth Interaction */
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "thickness_inner", PROP_FLOAT, PROP_NONE);
|
|
|
|
|
RNA_def_property_float_sdna(prop, NULL, "pdef_sbift");
|
|
|
|
|
RNA_def_property_range(prop, 0.001f, 1.0f);
|
|
|
|
|
RNA_def_property_ui_text(
|
|
|
|
|
prop, "Inner Thickness", "Inner face thickness (only used by softbodies)");
|
|
|
|
|
RNA_def_property_update(prop, 0, "rna_CollisionSettings_update");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "thickness_outer", PROP_FLOAT, PROP_NONE);
|
|
|
|
|
RNA_def_property_float_sdna(prop, NULL, "pdef_sboft");
|
|
|
|
|
RNA_def_property_range(prop, 0.001f, 1.0f);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Outer Thickness", "Outer face thickness");
|
|
|
|
|
RNA_def_property_update(prop, 0, "rna_CollisionSettings_update");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "damping", PROP_FLOAT, PROP_FACTOR);
|
|
|
|
|
RNA_def_property_float_sdna(prop, NULL, "pdef_sbdamp");
|
|
|
|
|
RNA_def_property_range(prop, 0.0f, 1.0f);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Damping", "Amount of damping during collision");
|
|
|
|
|
RNA_def_property_update(prop, 0, "rna_CollisionSettings_update");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "absorption", PROP_FLOAT, PROP_FACTOR);
|
|
|
|
|
RNA_def_property_range(prop, 0.0f, 1.0f);
|
|
|
|
|
RNA_def_property_ui_range(prop, 0.0f, 1.0f, 1, 2);
|
|
|
|
|
RNA_def_property_ui_text(
|
|
|
|
|
prop,
|
|
|
|
|
"Absorption",
|
|
|
|
|
"How much of effector force gets lost during collision with this object (in percent)");
|
|
|
|
|
RNA_def_property_update(prop, 0, "rna_CollisionSettings_update");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "cloth_friction", PROP_FLOAT, PROP_NONE);
|
|
|
|
|
RNA_def_property_float_sdna(prop, NULL, "pdef_cfrict");
|
|
|
|
|
RNA_def_property_range(prop, 0.0f, 80.0f);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Friction", "Friction for cloth collisions");
|
|
|
|
|
RNA_def_property_update(prop, 0, "rna_CollisionSettings_update");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "use_culling", PROP_BOOLEAN, PROP_NONE);
|
|
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", PFIELD_CLOTH_USE_CULLING);
|
|
|
|
|
RNA_def_property_ui_text(
|
|
|
|
|
prop,
|
|
|
|
|
"Single Sided",
|
|
|
|
|
"Cloth collision acts with respect to the collider normals (improves penetration recovery)");
|
|
|
|
|
RNA_def_property_update(prop, 0, "rna_CollisionSettings_update");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "use_normal", PROP_BOOLEAN, PROP_NONE);
|
|
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", PFIELD_CLOTH_USE_NORMAL);
|
|
|
|
|
RNA_def_property_ui_text(prop,
|
|
|
|
|
"Override Normals",
|
|
|
|
|
"Cloth collision impulses act in the direction of the collider normals "
|
|
|
|
|
"(more reliable in some cases)");
|
|
|
|
|
RNA_def_property_update(prop, 0, "rna_CollisionSettings_update");
|
2009-01-02 13:47:33 +00:00
|
|
|
}
|
|
|
|
|
|
Unified effector functionality for particles, cloth and softbody
* Unified scene wide gravity (currently in scene buttons)
instead of each simulation having it's own gravity.
* Weight parameters for all effectors and an effector group
setting.
* Every effector can use noise.
* Most effectors have "shapes" point, plane, surface, every point.
- "Point" is most like the old effectors and uses the
effector location as the effector point.
- "Plane" uses the closest point on effectors local xy-plane
as the effector point.
- "Surface" uses the closest point on an effector object's
surface as the effector point.
- "Every Point" uses every point in a mesh effector object
as an effector point.
- The falloff is calculated from this point, so for example
with "surface" shape and "use only negative z axis" it's
possible to apply force only "inside" the effector object.
* Spherical effector is now renamed as "force" as it's no longer
just spherical.
* New effector parameter "flow", which makes the effector act as
surrounding air velocity, so the resulting force is
proportional to the velocity difference of the point and "air
velocity". For example a wind field with flow=1.0 results in
proper non-accelerating wind.
* New effector fields "turbulence", which creates nice random
flow paths, and "drag", which slows the points down.
* Much improved vortex field.
* Effectors can now effect particle rotation as well as location.
* Use full, or only positive/negative z-axis to apply force
(note. the z-axis is the surface normal in the case of
effector shape "surface")
* New "force field" submenu in add menu, which adds an empty
with the chosen effector (curve object for corve guides).
* Other dynamics should be quite easy to add to the effector
system too if wanted.
* "Unified" doesn't mean that force fields give the exact same results for
particles, softbody & cloth, since their final effect depends on many external
factors, like for example the surface area of the effected faces.
Code changes
* Subversion bump for correct handling of global gravity.
* Separate ui py file for common dynamics stuff.
* Particle settings updating is flushed with it's id through
DAG_id_flush_update(..).
Known issues
* Curve guides don't yet have all ui buttons in place, but they
should work none the less.
* Hair dynamics don't yet respect force fields.
Other changes
* Particle emission defaults now to frames 1-200 with life of 50
frames to fill the whole default timeline.
* Many particles drawing related crashes fixed.
* Sometimes particles didn't update on first frame properly.
* Hair with object/group visualization didn't work properly.
* Memory leaks with PointCacheID lists (Genscher, remember to
free pidlists after use :).
2009-09-30 22:10:14 +00:00
|
|
|
static void rna_def_effector_weight(BlenderRNA *brna)
|
|
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
StructRNA *srna;
|
|
|
|
|
PropertyRNA *prop;
|
|
|
|
|
|
|
|
|
|
srna = RNA_def_struct(brna, "EffectorWeights", NULL);
|
|
|
|
|
RNA_def_struct_sdna(srna, "EffectorWeights");
|
|
|
|
|
RNA_def_struct_path_func(srna, "rna_EffectorWeight_path");
|
|
|
|
|
RNA_def_struct_ui_text(srna, "Effector Weights", "Effector weights for physics simulation");
|
|
|
|
|
RNA_def_struct_ui_icon(srna, ICON_PHYSICS);
|
|
|
|
|
|
|
|
|
|
/* Flags */
|
|
|
|
|
prop = RNA_def_property(srna, "apply_to_hair_growing", PROP_BOOLEAN, PROP_NONE);
|
|
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", EFF_WEIGHT_DO_HAIR);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Use For Growing Hair", "Use force fields when growing hair");
|
|
|
|
|
RNA_def_property_update(prop, 0, "rna_EffectorWeight_update");
|
|
|
|
|
|
|
|
|
|
/* General */
|
|
|
|
|
prop = RNA_def_property(srna, "collection", PROP_POINTER, PROP_NONE);
|
|
|
|
|
RNA_def_property_struct_type(prop, "Collection");
|
|
|
|
|
RNA_def_property_pointer_sdna(prop, NULL, "group");
|
|
|
|
|
RNA_def_property_flag(prop, PROP_EDITABLE);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Effector Collection", "Limit effectors to this collection");
|
|
|
|
|
RNA_def_property_update(prop, 0, "rna_EffectorWeight_dependency_update");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "gravity", PROP_FLOAT, PROP_NONE);
|
|
|
|
|
RNA_def_property_float_sdna(prop, NULL, "global_gravity");
|
|
|
|
|
RNA_def_property_range(prop, -200.0f, 200.0f);
|
|
|
|
|
RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 3);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Gravity", "Global gravity weight");
|
|
|
|
|
RNA_def_property_update(prop, 0, "rna_EffectorWeight_update");
|
|
|
|
|
|
|
|
|
|
/* Effector weights */
|
|
|
|
|
prop = RNA_def_property(srna, "all", PROP_FLOAT, PROP_NONE);
|
|
|
|
|
RNA_def_property_float_sdna(prop, NULL, "weight[0]");
|
|
|
|
|
RNA_def_property_range(prop, -200.0f, 200.0f);
|
|
|
|
|
RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 3);
|
|
|
|
|
RNA_def_property_ui_text(prop, "All", "All effector's weight");
|
|
|
|
|
RNA_def_property_update(prop, 0, "rna_EffectorWeight_update");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "force", PROP_FLOAT, PROP_NONE);
|
|
|
|
|
RNA_def_property_float_sdna(prop, NULL, "weight[1]");
|
|
|
|
|
RNA_def_property_range(prop, -200.0f, 200.0f);
|
|
|
|
|
RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 3);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Force", "Force effector weight");
|
|
|
|
|
RNA_def_property_update(prop, 0, "rna_EffectorWeight_update");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "vortex", PROP_FLOAT, PROP_NONE);
|
|
|
|
|
RNA_def_property_float_sdna(prop, NULL, "weight[2]");
|
|
|
|
|
RNA_def_property_range(prop, -200.0f, 200.0f);
|
|
|
|
|
RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 3);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Vortex", "Vortex effector weight");
|
|
|
|
|
RNA_def_property_update(prop, 0, "rna_EffectorWeight_update");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "magnetic", PROP_FLOAT, PROP_NONE);
|
|
|
|
|
RNA_def_property_float_sdna(prop, NULL, "weight[3]");
|
|
|
|
|
RNA_def_property_range(prop, -200.0f, 200.0f);
|
|
|
|
|
RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 3);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Magnetic", "Magnetic effector weight");
|
|
|
|
|
RNA_def_property_update(prop, 0, "rna_EffectorWeight_update");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "wind", PROP_FLOAT, PROP_NONE);
|
|
|
|
|
RNA_def_property_float_sdna(prop, NULL, "weight[4]");
|
|
|
|
|
RNA_def_property_range(prop, -200.0f, 200.0f);
|
|
|
|
|
RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 3);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Wind", "Wind effector weight");
|
|
|
|
|
RNA_def_property_update(prop, 0, "rna_EffectorWeight_update");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "curve_guide", PROP_FLOAT, PROP_NONE);
|
|
|
|
|
RNA_def_property_float_sdna(prop, NULL, "weight[5]");
|
|
|
|
|
RNA_def_property_range(prop, -200.0f, 200.0f);
|
|
|
|
|
RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 3);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Curve Guide", "Curve guide effector weight");
|
|
|
|
|
RNA_def_property_update(prop, 0, "rna_EffectorWeight_update");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "texture", PROP_FLOAT, PROP_NONE);
|
|
|
|
|
RNA_def_property_float_sdna(prop, NULL, "weight[6]");
|
|
|
|
|
RNA_def_property_range(prop, -200.0f, 200.0f);
|
|
|
|
|
RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 3);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Texture", "Texture effector weight");
|
|
|
|
|
RNA_def_property_update(prop, 0, "rna_EffectorWeight_update");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "harmonic", PROP_FLOAT, PROP_NONE);
|
|
|
|
|
RNA_def_property_float_sdna(prop, NULL, "weight[7]");
|
|
|
|
|
RNA_def_property_range(prop, -200.0f, 200.0f);
|
|
|
|
|
RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 3);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Harmonic", "Harmonic effector weight");
|
|
|
|
|
RNA_def_property_update(prop, 0, "rna_EffectorWeight_update");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "charge", PROP_FLOAT, PROP_NONE);
|
|
|
|
|
RNA_def_property_float_sdna(prop, NULL, "weight[8]");
|
|
|
|
|
RNA_def_property_range(prop, -200.0f, 200.0f);
|
|
|
|
|
RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 3);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Charge", "Charge effector weight");
|
|
|
|
|
RNA_def_property_update(prop, 0, "rna_EffectorWeight_update");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "lennardjones", PROP_FLOAT, PROP_NONE);
|
|
|
|
|
RNA_def_property_float_sdna(prop, NULL, "weight[9]");
|
|
|
|
|
RNA_def_property_range(prop, -200.0f, 200.0f);
|
|
|
|
|
RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 3);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Lennard-Jones", "Lennard-Jones effector weight");
|
|
|
|
|
RNA_def_property_update(prop, 0, "rna_EffectorWeight_update");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "boid", PROP_FLOAT, PROP_NONE);
|
|
|
|
|
RNA_def_property_float_sdna(prop, NULL, "weight[10]");
|
|
|
|
|
RNA_def_property_range(prop, -200.0f, 200.0f);
|
|
|
|
|
RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 3);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Boid", "Boid effector weight");
|
|
|
|
|
RNA_def_property_update(prop, 0, "rna_EffectorWeight_update");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "turbulence", PROP_FLOAT, PROP_NONE);
|
|
|
|
|
RNA_def_property_float_sdna(prop, NULL, "weight[11]");
|
|
|
|
|
RNA_def_property_range(prop, -200.0f, 200.0f);
|
|
|
|
|
RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 3);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Turbulence", "Turbulence effector weight");
|
|
|
|
|
RNA_def_property_update(prop, 0, "rna_EffectorWeight_update");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "drag", PROP_FLOAT, PROP_NONE);
|
|
|
|
|
RNA_def_property_float_sdna(prop, NULL, "weight[12]");
|
|
|
|
|
RNA_def_property_range(prop, -200.0f, 200.0f);
|
|
|
|
|
RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 3);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Drag", "Drag effector weight");
|
|
|
|
|
RNA_def_property_update(prop, 0, "rna_EffectorWeight_update");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "smokeflow", PROP_FLOAT, PROP_NONE);
|
|
|
|
|
RNA_def_property_float_sdna(prop, NULL, "weight[13]");
|
|
|
|
|
RNA_def_property_range(prop, -200.0f, 200.0f);
|
|
|
|
|
RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 3);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Smoke Flow", "Smoke Flow effector weight");
|
|
|
|
|
RNA_def_property_update(prop, 0, "rna_EffectorWeight_update");
|
Unified effector functionality for particles, cloth and softbody
* Unified scene wide gravity (currently in scene buttons)
instead of each simulation having it's own gravity.
* Weight parameters for all effectors and an effector group
setting.
* Every effector can use noise.
* Most effectors have "shapes" point, plane, surface, every point.
- "Point" is most like the old effectors and uses the
effector location as the effector point.
- "Plane" uses the closest point on effectors local xy-plane
as the effector point.
- "Surface" uses the closest point on an effector object's
surface as the effector point.
- "Every Point" uses every point in a mesh effector object
as an effector point.
- The falloff is calculated from this point, so for example
with "surface" shape and "use only negative z axis" it's
possible to apply force only "inside" the effector object.
* Spherical effector is now renamed as "force" as it's no longer
just spherical.
* New effector parameter "flow", which makes the effector act as
surrounding air velocity, so the resulting force is
proportional to the velocity difference of the point and "air
velocity". For example a wind field with flow=1.0 results in
proper non-accelerating wind.
* New effector fields "turbulence", which creates nice random
flow paths, and "drag", which slows the points down.
* Much improved vortex field.
* Effectors can now effect particle rotation as well as location.
* Use full, or only positive/negative z-axis to apply force
(note. the z-axis is the surface normal in the case of
effector shape "surface")
* New "force field" submenu in add menu, which adds an empty
with the chosen effector (curve object for corve guides).
* Other dynamics should be quite easy to add to the effector
system too if wanted.
* "Unified" doesn't mean that force fields give the exact same results for
particles, softbody & cloth, since their final effect depends on many external
factors, like for example the surface area of the effected faces.
Code changes
* Subversion bump for correct handling of global gravity.
* Separate ui py file for common dynamics stuff.
* Particle settings updating is flushed with it's id through
DAG_id_flush_update(..).
Known issues
* Curve guides don't yet have all ui buttons in place, but they
should work none the less.
* Hair dynamics don't yet respect force fields.
Other changes
* Particle emission defaults now to frames 1-200 with life of 50
frames to fill the whole default timeline.
* Many particles drawing related crashes fixed.
* Sometimes particles didn't update on first frame properly.
* Hair with object/group visualization didn't work properly.
* Memory leaks with PointCacheID lists (Genscher, remember to
free pidlists after use :).
2009-09-30 22:10:14 +00:00
|
|
|
}
|
|
|
|
|
|
2009-01-02 13:47:33 +00:00
|
|
|
static void rna_def_field(BlenderRNA *brna)
|
|
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
StructRNA *srna;
|
|
|
|
|
PropertyRNA *prop;
|
|
|
|
|
|
|
|
|
|
static const EnumPropertyItem field_type_items[] = {
|
|
|
|
|
{0, "NONE", 0, "None", ""},
|
|
|
|
|
{PFIELD_FORCE,
|
|
|
|
|
"FORCE",
|
|
|
|
|
ICON_FORCE_FORCE,
|
|
|
|
|
"Force",
|
|
|
|
|
"Radial field toward the center of object"},
|
|
|
|
|
{PFIELD_WIND,
|
|
|
|
|
"WIND",
|
|
|
|
|
ICON_FORCE_WIND,
|
|
|
|
|
"Wind",
|
|
|
|
|
"Constant force along the force object's local Z axis"},
|
|
|
|
|
{PFIELD_VORTEX,
|
|
|
|
|
"VORTEX",
|
|
|
|
|
ICON_FORCE_VORTEX,
|
|
|
|
|
"Vortex",
|
|
|
|
|
"Spiraling force that twists the force object's local Z axis"},
|
|
|
|
|
{PFIELD_MAGNET,
|
|
|
|
|
"MAGNET",
|
|
|
|
|
ICON_FORCE_MAGNETIC,
|
|
|
|
|
"Magnetic",
|
|
|
|
|
"Forcefield depends on the speed of the particles"},
|
|
|
|
|
{PFIELD_HARMONIC,
|
|
|
|
|
"HARMONIC",
|
|
|
|
|
ICON_FORCE_HARMONIC,
|
|
|
|
|
"Harmonic",
|
|
|
|
|
"The source of this force field is the zero point of a harmonic oscillator"},
|
|
|
|
|
{PFIELD_CHARGE,
|
|
|
|
|
"CHARGE",
|
|
|
|
|
ICON_FORCE_CHARGE,
|
|
|
|
|
"Charge",
|
|
|
|
|
"Spherical forcefield based on the charge of particles, "
|
|
|
|
|
"only influences other charge force fields"},
|
|
|
|
|
{PFIELD_LENNARDJ,
|
|
|
|
|
"LENNARDJ",
|
|
|
|
|
ICON_FORCE_LENNARDJONES,
|
|
|
|
|
"Lennard-Jones",
|
|
|
|
|
"Forcefield based on the Lennard-Jones potential"},
|
|
|
|
|
{PFIELD_TEXTURE, "TEXTURE", ICON_FORCE_TEXTURE, "Texture", "Forcefield based on a texture"},
|
|
|
|
|
{PFIELD_GUIDE,
|
|
|
|
|
"GUIDE",
|
|
|
|
|
ICON_FORCE_CURVE,
|
|
|
|
|
"Curve Guide",
|
|
|
|
|
"Create a force along a curve object"},
|
|
|
|
|
{PFIELD_BOID, "BOID", ICON_FORCE_BOID, "Boid", ""},
|
|
|
|
|
{PFIELD_TURBULENCE,
|
|
|
|
|
"TURBULENCE",
|
|
|
|
|
ICON_FORCE_TURBULENCE,
|
|
|
|
|
"Turbulence",
|
|
|
|
|
"Create turbulence with a noise field"},
|
|
|
|
|
{PFIELD_DRAG, "DRAG", ICON_FORCE_DRAG, "Drag", "Create a force that dampens motion"},
|
|
|
|
|
{PFIELD_SMOKEFLOW,
|
|
|
|
|
"SMOKE_FLOW",
|
|
|
|
|
ICON_FORCE_SMOKEFLOW,
|
|
|
|
|
"Smoke Flow",
|
|
|
|
|
"Create a force based on smoke simulation air flow"},
|
|
|
|
|
{0, NULL, 0, NULL, NULL},
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static const EnumPropertyItem falloff_items[] = {
|
|
|
|
|
{PFIELD_FALL_SPHERE, "SPHERE", 0, "Sphere", ""},
|
|
|
|
|
{PFIELD_FALL_TUBE, "TUBE", 0, "Tube", ""},
|
|
|
|
|
{PFIELD_FALL_CONE, "CONE", 0, "Cone", ""},
|
|
|
|
|
{0, NULL, 0, NULL, NULL},
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static const EnumPropertyItem texture_items[] = {
|
|
|
|
|
{PFIELD_TEX_RGB, "RGB", 0, "RGB", ""},
|
|
|
|
|
{PFIELD_TEX_GRAD, "GRADIENT", 0, "Gradient", ""},
|
|
|
|
|
{PFIELD_TEX_CURL, "CURL", 0, "Curl", ""},
|
|
|
|
|
{0, NULL, 0, NULL, NULL},
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static const EnumPropertyItem zdirection_items[] = {
|
|
|
|
|
{PFIELD_Z_BOTH, "BOTH", 0, "Both Z", ""},
|
|
|
|
|
{PFIELD_Z_POS, "POSITIVE", 0, "+Z", ""},
|
|
|
|
|
{PFIELD_Z_NEG, "NEGATIVE", 0, "-Z", ""},
|
|
|
|
|
{0, NULL, 0, NULL, NULL},
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static const EnumPropertyItem guide_kink_items[] = {
|
|
|
|
|
{0, "NONE", 0, "Nothing", ""},
|
|
|
|
|
{1, "CURL", 0, "Curl", ""},
|
|
|
|
|
{2, "RADIAL", 0, "Radial", ""},
|
|
|
|
|
{3, "WAVE", 0, "Wave", ""},
|
|
|
|
|
{4, "BRAID", 0, "Braid", ""},
|
|
|
|
|
{5, "ROTATION", 0, "Rotation", ""},
|
|
|
|
|
{6, "ROLL", 0, "Roll", ""},
|
|
|
|
|
{0, NULL, 0, NULL, NULL},
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
srna = RNA_def_struct(brna, "FieldSettings", NULL);
|
|
|
|
|
RNA_def_struct_sdna(srna, "PartDeflect");
|
|
|
|
|
RNA_def_struct_path_func(srna, "rna_FieldSettings_path");
|
|
|
|
|
RNA_def_struct_ui_text(
|
|
|
|
|
srna, "Field Settings", "Field settings for an object in physics simulation");
|
|
|
|
|
RNA_def_struct_ui_icon(srna, ICON_PHYSICS);
|
|
|
|
|
|
|
|
|
|
/* Enums */
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
|
|
|
|
|
RNA_def_property_enum_sdna(prop, NULL, "forcefield");
|
|
|
|
|
RNA_def_property_enum_items(prop, field_type_items);
|
|
|
|
|
RNA_def_property_enum_funcs(prop, NULL, "rna_FieldSettings_type_set", NULL);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Type", "Type of field");
|
|
|
|
|
RNA_def_property_update(prop, 0, "rna_FieldSettings_dependency_update");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "shape", PROP_ENUM, PROP_NONE);
|
|
|
|
|
RNA_def_property_enum_items(prop, effector_shape_items);
|
|
|
|
|
RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Effector_shape_itemf");
|
|
|
|
|
RNA_def_property_ui_text(
|
|
|
|
|
prop, "Shape", "Which direction is used to calculate the effector force");
|
|
|
|
|
RNA_def_property_update(prop, 0, "rna_FieldSettings_shape_update");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "falloff_type", PROP_ENUM, PROP_NONE);
|
|
|
|
|
RNA_def_property_enum_sdna(prop, NULL, "falloff");
|
|
|
|
|
RNA_def_property_enum_items(prop, falloff_items);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Fall-Off", "");
|
|
|
|
|
RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "texture_mode", PROP_ENUM, PROP_NONE);
|
|
|
|
|
RNA_def_property_enum_sdna(prop, NULL, "tex_mode");
|
|
|
|
|
RNA_def_property_enum_items(prop, texture_items);
|
|
|
|
|
RNA_def_property_ui_text(prop,
|
|
|
|
|
"Texture Mode",
|
|
|
|
|
"How the texture effect is calculated (RGB & Curl need a RGB texture, "
|
|
|
|
|
"else Gradient will be used instead)");
|
|
|
|
|
RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "z_direction", PROP_ENUM, PROP_NONE);
|
|
|
|
|
RNA_def_property_enum_sdna(prop, NULL, "zdir");
|
|
|
|
|
RNA_def_property_enum_items(prop, zdirection_items);
|
|
|
|
|
RNA_def_property_ui_text(
|
|
|
|
|
prop, "Z Direction", "Effect in full or only positive/negative Z direction");
|
|
|
|
|
RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
|
|
|
|
|
|
|
|
|
|
/* Float */
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "strength", PROP_FLOAT, PROP_NONE);
|
|
|
|
|
RNA_def_property_float_sdna(prop, NULL, "f_strength");
|
|
|
|
|
RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Strength", "Strength of force field");
|
|
|
|
|
RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
|
|
|
|
|
|
|
|
|
|
/* different ui range to above */
|
|
|
|
|
prop = RNA_def_property(srna, "linear_drag", PROP_FLOAT, PROP_NONE);
|
|
|
|
|
RNA_def_property_float_sdna(prop, NULL, "f_strength");
|
|
|
|
|
RNA_def_property_range(prop, -2.0f, 2.0f);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Linear Drag", "Drag component proportional to velocity");
|
|
|
|
|
RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "harmonic_damping", PROP_FLOAT, PROP_NONE);
|
|
|
|
|
RNA_def_property_float_sdna(prop, NULL, "f_damp");
|
|
|
|
|
RNA_def_property_range(prop, 0.0f, 10.0f);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Harmonic Damping", "Damping of the harmonic force");
|
|
|
|
|
RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
|
|
|
|
|
|
|
|
|
|
/* different ui range to above */
|
|
|
|
|
prop = RNA_def_property(srna, "quadratic_drag", PROP_FLOAT, PROP_NONE);
|
|
|
|
|
RNA_def_property_float_sdna(prop, NULL, "f_damp");
|
|
|
|
|
RNA_def_property_range(prop, -2.0f, 2.0f);
|
|
|
|
|
RNA_def_property_ui_text(
|
|
|
|
|
prop, "Quadratic Drag", "Drag component proportional to the square of velocity");
|
|
|
|
|
RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "flow", PROP_FLOAT, PROP_NONE);
|
|
|
|
|
RNA_def_property_float_sdna(prop, NULL, "f_flow");
|
|
|
|
|
RNA_def_property_range(prop, 0.0f, 10.0f);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Flow", "Convert effector force into air flow velocity");
|
|
|
|
|
RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
|
|
|
|
|
|
|
|
|
|
/* different ui range to above */
|
|
|
|
|
prop = RNA_def_property(srna, "inflow", PROP_FLOAT, PROP_NONE);
|
|
|
|
|
RNA_def_property_float_sdna(prop, NULL, "f_flow");
|
|
|
|
|
RNA_def_property_range(prop, -10.0f, 10.0f);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Inflow", "Inwards component of the vortex force");
|
|
|
|
|
RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "size", PROP_FLOAT, PROP_NONE);
|
|
|
|
|
RNA_def_property_float_sdna(prop, NULL, "f_size");
|
|
|
|
|
RNA_def_property_range(prop, 0.0f, FLT_MAX);
|
|
|
|
|
RNA_def_property_ui_range(prop, 0.0f, 10.0f, 1.0f, 3);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Size", "Size of the turbulence");
|
|
|
|
|
RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "rest_length", PROP_FLOAT, PROP_NONE);
|
|
|
|
|
RNA_def_property_float_sdna(prop, NULL, "f_size");
|
|
|
|
|
RNA_def_property_range(prop, 0.0f, 1000.0f);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Rest Length", "Rest length of the harmonic force");
|
|
|
|
|
RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "falloff_power", PROP_FLOAT, PROP_NONE);
|
|
|
|
|
RNA_def_property_float_sdna(prop, NULL, "f_power");
|
|
|
|
|
RNA_def_property_range(prop, 0.0f, 10.0f);
|
|
|
|
|
RNA_def_property_ui_text(
|
|
|
|
|
prop, "Falloff Power", "How quickly strength falls off with distance from the force field");
|
|
|
|
|
RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "distance_min", PROP_FLOAT, PROP_DISTANCE);
|
|
|
|
|
RNA_def_property_float_sdna(prop, NULL, "mindist");
|
|
|
|
|
RNA_def_property_range(prop, 0.0f, 1000.0f);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Minimum Distance", "Minimum distance for the field's fall-off");
|
|
|
|
|
RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "distance_max", PROP_FLOAT, PROP_DISTANCE);
|
|
|
|
|
RNA_def_property_float_sdna(prop, NULL, "maxdist");
|
|
|
|
|
RNA_def_property_range(prop, 0.0f, FLT_MAX);
|
|
|
|
|
RNA_def_property_ui_range(prop, 0.0f, 1000.0f, 1.0f, 3);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Maximum Distance", "Maximum distance for the field to work");
|
|
|
|
|
RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "radial_min", PROP_FLOAT, PROP_NONE);
|
|
|
|
|
RNA_def_property_float_sdna(prop, NULL, "minrad");
|
|
|
|
|
RNA_def_property_range(prop, 0.0f, 1000.0f);
|
|
|
|
|
RNA_def_property_ui_text(
|
|
|
|
|
prop, "Minimum Radial Distance", "Minimum radial distance for the field's fall-off");
|
|
|
|
|
RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "radial_max", PROP_FLOAT, PROP_NONE);
|
|
|
|
|
RNA_def_property_float_sdna(prop, NULL, "maxrad");
|
|
|
|
|
RNA_def_property_range(prop, 0.0f, 1000.0f);
|
|
|
|
|
RNA_def_property_ui_text(
|
|
|
|
|
prop, "Maximum Radial Distance", "Maximum radial distance for the field to work");
|
|
|
|
|
RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "radial_falloff", PROP_FLOAT, PROP_NONE);
|
|
|
|
|
RNA_def_property_float_sdna(prop, NULL, "f_power_r");
|
|
|
|
|
RNA_def_property_range(prop, 0.0f, 10.0f);
|
|
|
|
|
RNA_def_property_ui_text(
|
|
|
|
|
prop, "Radial Falloff Power", "Radial falloff power (real gravitational falloff = 2)");
|
|
|
|
|
RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "texture_nabla", PROP_FLOAT, PROP_NONE);
|
|
|
|
|
RNA_def_property_float_sdna(prop, NULL, "tex_nabla");
|
|
|
|
|
RNA_def_property_range(prop, 0.0001f, 1.0f);
|
|
|
|
|
RNA_def_property_ui_text(
|
|
|
|
|
prop, "Nabla", "Defines size of derivative offset used for calculating gradient and curl");
|
|
|
|
|
RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "noise", PROP_FLOAT, PROP_NONE);
|
|
|
|
|
RNA_def_property_float_sdna(prop, NULL, "f_noise");
|
|
|
|
|
RNA_def_property_range(prop, 0.0f, 10.0f);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Noise", "Amount of noise for the force strength");
|
|
|
|
|
RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "seed", PROP_INT, PROP_UNSIGNED);
|
|
|
|
|
RNA_def_property_range(prop, 1, 128);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Seed", "Seed of the noise");
|
|
|
|
|
RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
|
|
|
|
|
|
|
|
|
|
/* Boolean */
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "use_min_distance", PROP_BOOLEAN, PROP_NONE);
|
|
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", PFIELD_USEMIN);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Use Min", "Use a minimum distance for the field's fall-off");
|
|
|
|
|
RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "use_max_distance", PROP_BOOLEAN, PROP_NONE);
|
|
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", PFIELD_USEMAX);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Use Max", "Use a maximum distance for the field to work");
|
|
|
|
|
RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "use_radial_min", PROP_BOOLEAN, PROP_NONE);
|
|
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", PFIELD_USEMINR);
|
|
|
|
|
RNA_def_property_ui_text(
|
|
|
|
|
prop, "Use Min", "Use a minimum radial distance for the field's fall-off");
|
|
|
|
|
/* "Use a minimum angle for the field's fall-off" */
|
|
|
|
|
RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "use_radial_max", PROP_BOOLEAN, PROP_NONE);
|
|
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", PFIELD_USEMAXR);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Use Max", "Use a maximum radial distance for the field to work");
|
|
|
|
|
/* "Use a maximum angle for the field to work" */
|
|
|
|
|
RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "use_object_coords", PROP_BOOLEAN, PROP_NONE);
|
|
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", PFIELD_TEX_OBJECT);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Use Coordinates", "Use object/global coordinates for texture");
|
|
|
|
|
RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "use_global_coords", PROP_BOOLEAN, PROP_NONE);
|
|
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", PFIELD_GLOBAL_CO);
|
|
|
|
|
RNA_def_property_ui_text(
|
|
|
|
|
prop, "Use Global Coordinates", "Use effector/global coordinates for turbulence");
|
|
|
|
|
RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "use_2d_force", PROP_BOOLEAN, PROP_NONE);
|
|
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", PFIELD_TEX_2D);
|
|
|
|
|
RNA_def_property_ui_text(prop, "2D", "Apply force only in 2D");
|
|
|
|
|
RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "use_root_coords", PROP_BOOLEAN, PROP_NONE);
|
|
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", PFIELD_TEX_ROOTCO);
|
|
|
|
|
RNA_def_property_ui_text(
|
|
|
|
|
prop, "Root Texture Coordinates", "Texture coordinates from root particle locations");
|
|
|
|
|
RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "apply_to_location", PROP_BOOLEAN, PROP_NONE);
|
|
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", PFIELD_DO_LOCATION);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Location", "Affect particle's location");
|
|
|
|
|
RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "apply_to_rotation", PROP_BOOLEAN, PROP_NONE);
|
|
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", PFIELD_DO_ROTATION);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Rotation", "Affect particle's dynamic rotation");
|
|
|
|
|
RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "use_absorption", PROP_BOOLEAN, PROP_NONE);
|
|
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", PFIELD_VISIBILITY);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Absorption", "Force gets absorbed by collision objects");
|
|
|
|
|
RNA_def_property_update(prop, 0, "rna_FieldSettings_dependency_update");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "use_multiple_springs", PROP_BOOLEAN, PROP_NONE);
|
|
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", PFIELD_MULTIPLE_SPRINGS);
|
|
|
|
|
RNA_def_property_ui_text(
|
|
|
|
|
prop, "Multiple Springs", "Every point is effected by multiple springs");
|
|
|
|
|
RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "use_smoke_density", PROP_BOOLEAN, PROP_NONE);
|
|
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", PFIELD_SMOKE_DENSITY);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Apply Density", "Adjust force strength based on smoke density");
|
|
|
|
|
RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
|
|
|
|
|
prop = RNA_def_property(srna, "use_gravity_falloff", PROP_BOOLEAN, PROP_NONE);
|
|
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", PFIELD_GRAVITATION);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Gravity Falloff", "Multiply force by 1/distance²");
|
|
|
|
|
RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
|
|
|
|
|
|
|
|
|
|
/* Pointer */
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "texture", PROP_POINTER, PROP_NONE);
|
|
|
|
|
RNA_def_property_pointer_sdna(prop, NULL, "tex");
|
|
|
|
|
RNA_def_property_flag(prop, PROP_EDITABLE);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Texture", "Texture to use as force");
|
|
|
|
|
RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "source_object", PROP_POINTER, PROP_NONE);
|
|
|
|
|
RNA_def_property_pointer_sdna(prop, NULL, "f_source");
|
|
|
|
|
RNA_def_property_ui_text(prop, "Domain Object", "Select domain object of the smoke simulation");
|
|
|
|
|
RNA_def_property_flag(prop, PROP_EDITABLE);
|
|
|
|
|
RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
|
|
|
|
|
|
|
|
|
|
/********** Curve Guide Field Settings **********/
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "guide_minimum", PROP_FLOAT, PROP_NONE);
|
|
|
|
|
RNA_def_property_float_sdna(prop, NULL, "f_strength");
|
|
|
|
|
RNA_def_property_range(prop, 0.0f, 1000.0f);
|
|
|
|
|
RNA_def_property_ui_text(
|
|
|
|
|
prop, "Minimum Distance", "The distance from which particles are affected fully");
|
|
|
|
|
RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "guide_free", PROP_FLOAT, PROP_NONE);
|
|
|
|
|
RNA_def_property_float_sdna(prop, NULL, "free_end");
|
|
|
|
|
RNA_def_property_range(prop, 0.0f, 0.99f);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Free", "Guide-free time from particle life's end");
|
|
|
|
|
RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "use_guide_path_add", PROP_BOOLEAN, PROP_NONE);
|
|
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", PFIELD_GUIDE_PATH_ADD);
|
|
|
|
|
RNA_def_property_ui_text(
|
|
|
|
|
prop, "Additive", "Based on distance/falloff it adds a portion of the entire path");
|
|
|
|
|
RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "use_guide_path_weight", PROP_BOOLEAN, PROP_NONE);
|
|
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", PFIELD_GUIDE_PATH_WEIGHT);
|
|
|
|
|
RNA_def_property_ui_text(
|
|
|
|
|
prop, "Weights", "Use curve weights to influence the particle influence along the curve");
|
|
|
|
|
RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
|
|
|
|
|
|
|
|
|
|
/* Clump Settings */
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "guide_clump_amount", PROP_FLOAT, PROP_NONE);
|
|
|
|
|
RNA_def_property_float_sdna(prop, NULL, "clump_fac");
|
|
|
|
|
RNA_def_property_range(prop, -1.0f, 1.0f);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Amount", "Amount of clumping");
|
|
|
|
|
RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "guide_clump_shape", PROP_FLOAT, PROP_NONE);
|
|
|
|
|
RNA_def_property_float_sdna(prop, NULL, "clump_pow");
|
|
|
|
|
RNA_def_property_range(prop, -0.999f, 0.999f);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Shape", "Shape of clumping");
|
|
|
|
|
RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
|
|
|
|
|
|
|
|
|
|
/* Kink Settings */
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "guide_kink_type", PROP_ENUM, PROP_NONE);
|
|
|
|
|
RNA_def_property_enum_sdna(prop, NULL, "kink");
|
|
|
|
|
RNA_def_property_enum_items(prop, guide_kink_items);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Kink", "Type of periodic offset on the curve");
|
|
|
|
|
RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "guide_kink_axis", PROP_ENUM, PROP_NONE);
|
|
|
|
|
RNA_def_property_enum_sdna(prop, NULL, "kink_axis");
|
|
|
|
|
RNA_def_property_enum_items(prop, rna_enum_axis_xyz_items);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Axis", "Which axis to use for offset");
|
|
|
|
|
RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "guide_kink_frequency", PROP_FLOAT, PROP_NONE);
|
|
|
|
|
RNA_def_property_float_sdna(prop, NULL, "kink_freq");
|
|
|
|
|
RNA_def_property_range(prop, 0.0f, 10.0f);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Frequency", "The frequency of the offset (1/total length)");
|
|
|
|
|
RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "guide_kink_shape", PROP_FLOAT, PROP_NONE);
|
|
|
|
|
RNA_def_property_float_sdna(prop, NULL, "kink_shape");
|
|
|
|
|
RNA_def_property_range(prop, -0.999f, 0.999f);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Shape", "Adjust the offset to the beginning/end");
|
|
|
|
|
RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "guide_kink_amplitude", PROP_FLOAT, PROP_NONE);
|
|
|
|
|
RNA_def_property_float_sdna(prop, NULL, "kink_amp");
|
|
|
|
|
RNA_def_property_range(prop, 0.0f, 10.0f);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Amplitude", "The amplitude of the offset");
|
|
|
|
|
RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
|
|
|
|
|
|
|
|
|
|
/* Variables used for Curve Guide, already wrapped, used for other fields too */
|
|
|
|
|
/* falloff_power, use_max_distance, maximum_distance */
|
2009-01-02 13:47:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void rna_def_softbody(BlenderRNA *brna)
|
|
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
StructRNA *srna;
|
|
|
|
|
PropertyRNA *prop;
|
|
|
|
|
|
|
|
|
|
static const EnumPropertyItem collision_type_items[] = {
|
|
|
|
|
{SBC_MODE_MANUAL, "MANUAL", 0, "Manual", "Manual adjust"},
|
|
|
|
|
{SBC_MODE_AVG, "AVERAGE", 0, "Average", "Average Spring length * Ball Size"},
|
|
|
|
|
{SBC_MODE_MIN, "MINIMAL", 0, "Minimal", "Minimal Spring length * Ball Size"},
|
|
|
|
|
{SBC_MODE_MAX, "MAXIMAL", 0, "Maximal", "Maximal Spring length * Ball Size"},
|
|
|
|
|
{SBC_MODE_AVGMINMAX, "MINMAX", 0, "AvMinMax", "(Min+Max)/2 * Ball Size"},
|
|
|
|
|
{0, NULL, 0, NULL, NULL},
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static const EnumPropertyItem aerodynamics_type[] = {
|
|
|
|
|
{0, "SIMPLE", 0, "Simple", "Edges receive a drag force from surrounding media"},
|
|
|
|
|
{1,
|
|
|
|
|
"LIFT_FORCE",
|
|
|
|
|
0,
|
|
|
|
|
"Lift Force",
|
|
|
|
|
"Edges receive a lift force when passing through surrounding media"},
|
|
|
|
|
{0, NULL, 0, NULL, NULL},
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
srna = RNA_def_struct(brna, "SoftBodySettings", NULL);
|
|
|
|
|
RNA_def_struct_sdna(srna, "SoftBody");
|
|
|
|
|
RNA_def_struct_path_func(srna, "rna_SoftBodySettings_path");
|
|
|
|
|
RNA_def_struct_ui_text(
|
|
|
|
|
srna, "Soft Body Settings", "Soft body simulation settings for an object");
|
|
|
|
|
|
|
|
|
|
/* General Settings */
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "friction", PROP_FLOAT, PROP_NONE);
|
|
|
|
|
RNA_def_property_float_sdna(prop, NULL, "mediafrict");
|
|
|
|
|
RNA_def_property_range(prop, 0.0f, 50.0f);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Friction", "General media friction for point movements");
|
|
|
|
|
RNA_def_property_update(prop, 0, "rna_softbody_update");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "mass", PROP_FLOAT, PROP_UNIT_MASS);
|
|
|
|
|
RNA_def_property_float_sdna(prop, NULL, "nodemass");
|
|
|
|
|
RNA_def_property_range(prop, 0.0f, 50000.0f);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Mass", "General Mass value");
|
|
|
|
|
RNA_def_property_update(prop, 0, "rna_softbody_update");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "vertex_group_mass", PROP_STRING, PROP_NONE);
|
|
|
|
|
RNA_def_property_string_sdna(prop, NULL, "namedVG_Mass");
|
|
|
|
|
RNA_def_property_ui_text(prop, "Mass Vertex Group", "Control point mass values");
|
|
|
|
|
RNA_def_property_string_funcs(prop, NULL, NULL, "rna_SoftBodySettings_mass_vgroup_set");
|
|
|
|
|
RNA_def_property_update(prop, 0, "rna_softbody_update");
|
|
|
|
|
|
|
|
|
|
/* no longer used */
|
|
|
|
|
prop = RNA_def_property(srna, "gravity", PROP_FLOAT, PROP_ACCELERATION);
|
|
|
|
|
RNA_def_property_float_sdna(prop, NULL, "grav");
|
|
|
|
|
RNA_def_property_range(prop, -10.0f, 10.0f);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Gravitation", "Apply gravitation to point movement");
|
|
|
|
|
RNA_def_property_update(prop, 0, "rna_softbody_update");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "speed", PROP_FLOAT, PROP_NONE);
|
|
|
|
|
RNA_def_property_float_sdna(prop, NULL, "physics_speed");
|
|
|
|
|
RNA_def_property_range(prop, 0.01f, 100.0f);
|
|
|
|
|
RNA_def_property_ui_text(
|
|
|
|
|
prop, "Speed", "Tweak timing for physics to control frequency and speed");
|
|
|
|
|
RNA_def_property_update(prop, 0, "rna_softbody_update");
|
|
|
|
|
|
|
|
|
|
/* Goal */
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "vertex_group_goal", PROP_STRING, PROP_NONE);
|
|
|
|
|
RNA_def_property_string_sdna(prop, NULL, "vertgroup");
|
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); /* not impossible .. but not supported yet */
|
|
|
|
|
RNA_def_property_string_funcs(prop,
|
|
|
|
|
"rna_SoftBodySettings_goal_vgroup_get",
|
|
|
|
|
"rna_SoftBodySettings_goal_vgroup_length",
|
|
|
|
|
"rna_SoftBodySettings_goal_vgroup_set");
|
|
|
|
|
RNA_def_property_ui_text(prop, "Goal Vertex Group", "Control point weight values");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "goal_min", PROP_FLOAT, PROP_FACTOR);
|
|
|
|
|
RNA_def_property_float_sdna(prop, NULL, "mingoal");
|
|
|
|
|
RNA_def_property_range(prop, 0.0f, 1.0f);
|
|
|
|
|
RNA_def_property_ui_text(
|
|
|
|
|
prop, "Goal Minimum", "Goal minimum, vertex weights are scaled to match this range");
|
|
|
|
|
RNA_def_property_update(prop, 0, "rna_softbody_update");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "goal_max", PROP_FLOAT, PROP_FACTOR);
|
|
|
|
|
RNA_def_property_float_sdna(prop, NULL, "maxgoal");
|
|
|
|
|
RNA_def_property_range(prop, 0.0f, 1.0f);
|
|
|
|
|
RNA_def_property_ui_text(
|
|
|
|
|
prop, "Goal Maximum", "Goal maximum, vertex weights are scaled to match this range");
|
|
|
|
|
RNA_def_property_update(prop, 0, "rna_softbody_update");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "goal_default", PROP_FLOAT, PROP_FACTOR);
|
|
|
|
|
RNA_def_property_float_sdna(prop, NULL, "defgoal");
|
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
|
|
|
|
|
RNA_def_property_range(prop, 0.0f, 1.0f);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Goal Default", "Default Goal (vertex target position) value");
|
|
|
|
|
RNA_def_property_update(prop, 0, "rna_softbody_update");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "goal_spring", PROP_FLOAT, PROP_NONE);
|
|
|
|
|
RNA_def_property_float_sdna(prop, NULL, "goalspring");
|
|
|
|
|
RNA_def_property_range(prop, 0.0f, 0.999f);
|
|
|
|
|
RNA_def_property_ui_text(
|
|
|
|
|
prop, "Goal Stiffness", "Goal (vertex target position) spring stiffness");
|
|
|
|
|
RNA_def_property_update(prop, 0, "rna_softbody_update");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "goal_friction", PROP_FLOAT, PROP_NONE);
|
|
|
|
|
RNA_def_property_float_sdna(prop, NULL, "goalfrict");
|
|
|
|
|
RNA_def_property_range(prop, 0.0f, 50.0f);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Goal Damping", "Goal (vertex target position) friction");
|
|
|
|
|
RNA_def_property_update(prop, 0, "rna_softbody_update");
|
|
|
|
|
|
|
|
|
|
/* Edge Spring Settings */
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "pull", PROP_FLOAT, PROP_NONE);
|
|
|
|
|
RNA_def_property_float_sdna(prop, NULL, "inspring");
|
|
|
|
|
RNA_def_property_range(prop, 0.0f, 0.999f);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Pull", "Edge spring stiffness when longer than rest length");
|
|
|
|
|
RNA_def_property_update(prop, 0, "rna_softbody_update");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "push", PROP_FLOAT, PROP_NONE);
|
|
|
|
|
RNA_def_property_float_sdna(prop, NULL, "inpush");
|
|
|
|
|
RNA_def_property_range(prop, 0.0f, 0.999f);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Push", "Edge spring stiffness when shorter than rest length");
|
|
|
|
|
RNA_def_property_update(prop, 0, "rna_softbody_update");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "damping", PROP_FLOAT, PROP_NONE);
|
|
|
|
|
RNA_def_property_float_sdna(prop, NULL, "infrict");
|
|
|
|
|
RNA_def_property_range(prop, 0.0f, 50.0f);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Damp", "Edge spring friction");
|
|
|
|
|
RNA_def_property_update(prop, 0, "rna_softbody_update");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "spring_length", PROP_INT, PROP_NONE);
|
|
|
|
|
RNA_def_property_int_sdna(prop, NULL, "springpreload");
|
|
|
|
|
RNA_def_property_range(prop, 0.0f, 200.0f);
|
|
|
|
|
RNA_def_property_ui_text(
|
|
|
|
|
prop, "View Layer", "Alter spring length to shrink/blow up (unit %) 0 to disable");
|
|
|
|
|
RNA_def_property_update(prop, 0, "rna_softbody_update");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "aero", PROP_INT, PROP_NONE);
|
|
|
|
|
RNA_def_property_int_sdna(prop, NULL, "aeroedge");
|
|
|
|
|
RNA_def_property_range(prop, 0.0f, 30000.0f);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Aero", "Make edges 'sail'");
|
|
|
|
|
RNA_def_property_update(prop, 0, "rna_softbody_update");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "plastic", PROP_INT, PROP_NONE);
|
|
|
|
|
RNA_def_property_int_sdna(prop, NULL, "plastic");
|
|
|
|
|
RNA_def_property_range(prop, 0.0f, 100.0f);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Plastic", "Permanent deform");
|
|
|
|
|
RNA_def_property_update(prop, 0, "rna_softbody_update");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "bend", PROP_FLOAT, PROP_NONE);
|
|
|
|
|
RNA_def_property_float_sdna(prop, NULL, "secondspring");
|
|
|
|
|
RNA_def_property_range(prop, 0.0f, 10.0f);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Bending", "Bending Stiffness");
|
|
|
|
|
RNA_def_property_update(prop, 0, "rna_softbody_update");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "shear", PROP_FLOAT, PROP_FACTOR);
|
|
|
|
|
RNA_def_property_float_sdna(prop, NULL, "shearstiff");
|
|
|
|
|
RNA_def_property_range(prop, 0.0f, 1.0f);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Shear", "Shear Stiffness");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "vertex_group_spring", PROP_STRING, PROP_NONE);
|
|
|
|
|
RNA_def_property_string_sdna(prop, NULL, "namedVG_Spring_K");
|
|
|
|
|
RNA_def_property_ui_text(prop, "Spring Vertex Group", "Control point spring strength values");
|
|
|
|
|
RNA_def_property_string_funcs(prop, NULL, NULL, "rna_SoftBodySettings_spring_vgroup_set");
|
|
|
|
|
RNA_def_property_update(prop, 0, "rna_softbody_update");
|
|
|
|
|
|
|
|
|
|
/* Collision */
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "collision_type", PROP_ENUM, PROP_NONE);
|
|
|
|
|
RNA_def_property_enum_sdna(prop, NULL, "sbc_mode");
|
|
|
|
|
RNA_def_property_enum_items(prop, collision_type_items);
|
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Collision Type", "Choose Collision Type");
|
|
|
|
|
RNA_def_property_update(prop, 0, "rna_softbody_update");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "ball_size", PROP_FLOAT, PROP_DISTANCE);
|
|
|
|
|
RNA_def_property_float_sdna(prop, NULL, "colball");
|
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); /* code is not ready for that yet */
|
|
|
|
|
RNA_def_property_range(prop, -10.0f, 10.0f);
|
|
|
|
|
RNA_def_property_ui_text(
|
|
|
|
|
prop, "Ball Size", "Absolute ball size or factor if not manually adjusted");
|
|
|
|
|
RNA_def_property_update(prop, 0, "rna_softbody_update");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "ball_stiff", PROP_FLOAT, PROP_NONE);
|
|
|
|
|
RNA_def_property_float_sdna(prop, NULL, "ballstiff");
|
|
|
|
|
RNA_def_property_range(prop, 0.001f, 100.0f);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Ball Size", "Ball inflating pressure");
|
|
|
|
|
RNA_def_property_update(prop, 0, "rna_softbody_update");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "ball_damp", PROP_FLOAT, PROP_NONE);
|
|
|
|
|
RNA_def_property_float_sdna(prop, NULL, "balldamp");
|
|
|
|
|
RNA_def_property_range(prop, 0.001f, 1.0f);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Ball Size", "Blending to inelastic collision");
|
|
|
|
|
RNA_def_property_update(prop, 0, "rna_softbody_update");
|
|
|
|
|
|
|
|
|
|
/* Solver */
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "error_threshold", PROP_FLOAT, PROP_NONE);
|
|
|
|
|
RNA_def_property_float_sdna(prop, NULL, "rklimit");
|
|
|
|
|
RNA_def_property_range(prop, 0.001f, 10.0f);
|
|
|
|
|
RNA_def_property_ui_text(
|
|
|
|
|
prop,
|
|
|
|
|
"Error Limit",
|
|
|
|
|
"The Runge-Kutta ODE solver error limit, low value gives more precision, "
|
|
|
|
|
"high values speed");
|
|
|
|
|
RNA_def_property_update(prop, 0, "rna_softbody_update");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "step_min", PROP_INT, PROP_NONE);
|
|
|
|
|
RNA_def_property_int_sdna(prop, NULL, "minloops");
|
|
|
|
|
RNA_def_property_range(prop, 0, 30000);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Min Step", "Minimal # solver steps/frame");
|
|
|
|
|
RNA_def_property_update(prop, 0, "rna_softbody_update");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "step_max", PROP_INT, PROP_NONE);
|
|
|
|
|
RNA_def_property_int_sdna(prop, NULL, "maxloops");
|
|
|
|
|
RNA_def_property_range(prop, 0, 30000);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Max Step", "Maximal # solver steps/frame");
|
|
|
|
|
RNA_def_property_update(prop, 0, "rna_softbody_update");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "choke", PROP_INT, PROP_NONE);
|
|
|
|
|
RNA_def_property_int_sdna(prop, NULL, "choke");
|
|
|
|
|
RNA_def_property_range(prop, 0, 100);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Choke", "'Viscosity' inside collision target");
|
|
|
|
|
RNA_def_property_update(prop, 0, "rna_softbody_update");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "fuzzy", PROP_INT, PROP_NONE);
|
|
|
|
|
RNA_def_property_int_sdna(prop, NULL, "fuzzyness");
|
|
|
|
|
RNA_def_property_range(prop, 1, 100);
|
|
|
|
|
RNA_def_property_ui_text(
|
|
|
|
|
prop,
|
|
|
|
|
"Fuzzy",
|
|
|
|
|
"Fuzziness while on collision, high values make collision handling faster "
|
|
|
|
|
"but less stable");
|
|
|
|
|
RNA_def_property_update(prop, 0, "rna_softbody_update");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "use_auto_step", PROP_BOOLEAN, PROP_NONE);
|
|
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "solverflags", SBSO_OLDERR);
|
|
|
|
|
RNA_def_property_ui_text(prop, "V", "Use velocities for automagic step sizes");
|
|
|
|
|
RNA_def_property_update(prop, 0, "rna_softbody_update");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "use_diagnose", PROP_BOOLEAN, PROP_NONE);
|
|
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "solverflags", SBSO_MONITOR);
|
|
|
|
|
RNA_def_property_ui_text(
|
|
|
|
|
prop, "Print Performance to Console", "Turn on SB diagnose console prints");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "use_estimate_matrix", PROP_BOOLEAN, PROP_NONE);
|
|
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "solverflags", SBSO_ESTIMATEIPO);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Estimate matrix", "Estimate matrix... split to COM, ROT, SCALE");
|
|
|
|
|
|
|
|
|
|
/***********************************************************************************/
|
|
|
|
|
/* these are not exactly settings, but reading calculated results*/
|
|
|
|
|
/* but i did not want to start a new property struct */
|
|
|
|
|
/* so rather rename this from SoftBodySettings to SoftBody */
|
|
|
|
|
/* translation */
|
|
|
|
|
prop = RNA_def_property(srna, "location_mass_center", PROP_FLOAT, PROP_TRANSLATION);
|
|
|
|
|
RNA_def_property_float_sdna(prop, NULL, "lcom");
|
|
|
|
|
RNA_def_property_ui_text(prop, "Center of mass", "Location of Center of mass");
|
|
|
|
|
RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT);
|
|
|
|
|
|
|
|
|
|
/* matrix */
|
|
|
|
|
prop = RNA_def_property(srna, "rotation_estimate", PROP_FLOAT, PROP_MATRIX);
|
|
|
|
|
RNA_def_property_float_sdna(prop, NULL, "lrot");
|
|
|
|
|
RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_3x3);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Rot Matrix", "Estimated rotation matrix");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "scale_estimate", PROP_FLOAT, PROP_MATRIX);
|
|
|
|
|
RNA_def_property_float_sdna(prop, NULL, "lscale");
|
|
|
|
|
RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_3x3);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Scale Matrix", "Estimated scale matrix");
|
|
|
|
|
/***********************************************************************************/
|
|
|
|
|
|
|
|
|
|
/* Flags */
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "use_goal", PROP_BOOLEAN, PROP_NONE);
|
|
|
|
|
RNA_def_property_boolean_funcs(
|
|
|
|
|
prop, "rna_SoftBodySettings_use_goal_get", "rna_SoftBodySettings_use_goal_set");
|
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
|
|
|
|
|
RNA_def_property_ui_text(
|
|
|
|
|
prop, "Use Goal", "Define forces for vertices to stick to animated position");
|
|
|
|
|
RNA_def_property_update(prop, 0, "rna_softbody_update");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "use_edges", PROP_BOOLEAN, PROP_NONE);
|
|
|
|
|
RNA_def_property_boolean_funcs(
|
|
|
|
|
prop, "rna_SoftBodySettings_use_edges_get", "rna_SoftBodySettings_use_edges_set");
|
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Use Edges", "Use Edges as springs");
|
|
|
|
|
RNA_def_property_update(prop, 0, "rna_softbody_update");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "use_stiff_quads", PROP_BOOLEAN, PROP_NONE);
|
|
|
|
|
RNA_def_property_boolean_funcs(
|
|
|
|
|
prop, "rna_SoftBodySettings_stiff_quads_get", "rna_SoftBodySettings_stiff_quads_set");
|
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Stiff Quads", "Add diagonal springs on 4-gons");
|
|
|
|
|
RNA_def_property_update(prop, 0, "rna_softbody_update");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "use_edge_collision", PROP_BOOLEAN, PROP_NONE);
|
|
|
|
|
RNA_def_property_boolean_funcs(
|
|
|
|
|
prop, "rna_SoftBodySettings_edge_collision_get", "rna_SoftBodySettings_edge_collision_set");
|
|
|
|
|
RNA_def_property_ui_text(prop, "Edge Collision", "Edges collide too");
|
|
|
|
|
RNA_def_property_update(prop, 0, "rna_softbody_update");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "use_face_collision", PROP_BOOLEAN, PROP_NONE);
|
|
|
|
|
RNA_def_property_boolean_funcs(
|
|
|
|
|
prop, "rna_SoftBodySettings_face_collision_get", "rna_SoftBodySettings_face_collision_set");
|
|
|
|
|
RNA_def_property_ui_text(prop, "Face Collision", "Faces collide too, can be very slow");
|
|
|
|
|
RNA_def_property_update(prop, 0, "rna_softbody_update");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "aerodynamics_type", PROP_ENUM, PROP_NONE);
|
|
|
|
|
RNA_def_property_enum_items(prop, aerodynamics_type);
|
|
|
|
|
RNA_def_property_enum_funcs(
|
|
|
|
|
prop, "rna_SoftBodySettings_new_aero_get", "rna_SoftBodySettings_new_aero_set", NULL);
|
|
|
|
|
RNA_def_property_ui_text(
|
|
|
|
|
prop, "Aerodynamics Type", "Method of calculating aerodynamic interaction");
|
|
|
|
|
RNA_def_property_update(prop, 0, "rna_softbody_update");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "use_self_collision", PROP_BOOLEAN, PROP_NONE);
|
|
|
|
|
RNA_def_property_boolean_funcs(
|
|
|
|
|
prop, "rna_SoftBodySettings_self_collision_get", "rna_SoftBodySettings_self_collision_set");
|
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Self Collision", "Enable naive vertex ball self collision");
|
|
|
|
|
RNA_def_property_update(prop, 0, "rna_softbody_update");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "collision_collection", PROP_POINTER, PROP_NONE);
|
|
|
|
|
RNA_def_property_struct_type(prop, "Collection");
|
|
|
|
|
RNA_def_property_pointer_sdna(prop, NULL, "collision_group");
|
|
|
|
|
RNA_def_property_flag(prop, PROP_EDITABLE);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Collision Collection", "Limit colliders to this collection");
|
|
|
|
|
RNA_def_property_update(prop, 0, "rna_softbody_dependency_update");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "effector_weights", PROP_POINTER, PROP_NONE);
|
|
|
|
|
RNA_def_property_pointer_sdna(prop, NULL, "effector_weights");
|
|
|
|
|
RNA_def_property_struct_type(prop, "EffectorWeights");
|
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Effector Weights", "");
|
2009-01-02 13:47:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void RNA_def_object_force(BlenderRNA *brna)
|
|
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
rna_def_pointcache_active(brna);
|
|
|
|
|
rna_def_collision(brna);
|
|
|
|
|
rna_def_effector_weight(brna);
|
|
|
|
|
rna_def_field(brna);
|
|
|
|
|
rna_def_softbody(brna);
|
2009-01-02 13:47:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endif
|