Blender V5.3
MOD_softbody.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2005 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
8
9#include "BLT_translation.hh"
10
12#include "DNA_screen_types.h"
13
14#include "BKE_softbody.h"
15
17#include "UI_resources.hh"
18
19#include "RNA_prototypes.hh"
20
21#include "DEG_depsgraph.hh"
25
26#include "MOD_modifiertypes.hh"
27#include "MOD_ui_common.hh"
28
29namespace blender {
30
31static void deform_verts(ModifierData * /*md*/,
32 const ModifierEvalContext *ctx,
33 Mesh * /*mesh*/,
34 MutableSpan<float3> positions)
35{
38 scene,
39 ctx->object,
41 reinterpret_cast<float (*)[3]>(positions.data()),
42 positions.size());
43}
44
45static bool depends_on_time(Scene * /*scene*/, ModifierData * /*md*/)
46{
47 return true;
48}
49
51{
52 if (ctx->object->soft) {
53 /* Actual code uses ccd_build_deflector_hash */
55 ctx->object,
58 nullptr,
59 "Softbody Collision");
61 ctx->node, ctx->object, ctx->object->soft->effector_weights, true, 0, "Softbody Field");
62 }
63 /* We need our own transformation as well. */
64 DEG_add_depends_on_transform_relation(ctx->node, "SoftBody Modifier");
65}
66
67static void panel_draw(const bContext * /*C*/, Panel *panel)
68{
69 ui::Layout &layout = *panel->layout;
70
72
73 layout.label(RPT_("Settings are inside the Physics tab"), ICON_NONE);
74
75 modifier_error_message_draw(layout, ptr);
76}
77
78static void panel_register(ARegionType *region_type)
79{
81}
82
84 /*idname*/ "Softbody",
85 /*name*/ N_("Softbody"),
86 /*struct_name*/ "SoftbodyModifierData",
87 /*struct_size*/ sizeof(SoftbodyModifierData),
88 /*srna*/ &RNA_SoftBodyModifier,
93 /*icon*/ ICON_MOD_SOFT,
94
95 /*copy_data*/ nullptr,
96
97 /*deform_verts*/ deform_verts,
98 /*deform_matrices*/ nullptr,
99 /*deform_verts_EM*/ nullptr,
100 /*deform_matrices_EM*/ nullptr,
101 /*modify_mesh*/ nullptr,
102 /*modify_geometry_set*/ nullptr,
103
104 /*init_data*/ nullptr,
105 /*required_data_mask*/ nullptr,
106 /*free_data*/ nullptr,
107 /*is_disabled*/ nullptr,
108 /*update_depsgraph*/ update_depsgraph,
109 /*depends_on_time*/ depends_on_time,
110 /*depends_on_normals*/ nullptr,
111 /*foreach_ID_link*/ nullptr,
112 /*foreach_tex_link*/ nullptr,
113 /*free_runtime_data*/ nullptr,
114 /*panel_register*/ panel_register,
115 /*blend_write*/ nullptr,
116 /*blend_read*/ nullptr,
117 /*foreach_cache*/ nullptr,
118 /*foreach_working_space_color*/ nullptr,
119};
120
121} // namespace blender
#define RPT_(msgid)
constexpr int64_t size() const
Definition BLI_span.hh:499
constexpr T * data() const
Definition BLI_span.hh:545
BMesh Iterators.
PointerRNA * modifier_panel_get_property_pointers(Panel *panel, PointerRNA *r_ob_ptr)
ModifierTypeInfo modifierType_Softbody
static bool depends_on_time(Scene *, ModifierData *)
Definition MOD_build.cc:46
static void update_depsgraph(tGraphSliderOp *gso)
void DEG_add_depends_on_transform_relation(DepsNodeHandle *node_handle, const char *description)
void sbObjectStep(struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob, float cfra, float(*vertexCos)[3], int numVerts)
Definition softbody.cc:3514
void modifier_error_message_draw(ui::Layout &layout, PointerRNA *ptr)
static void panel_register(ARegionType *region_type)
void DEG_add_collision_relations(DepsNodeHandle *handle, Object *object, Collection *collection, unsigned int modifier_type, DEG_CollobjFilterFunction filter_function, const char *name)
@ eModifierTypeFlag_AcceptsCVs
@ eModifierTypeFlag_UsesPointCache
@ eModifierTypeFlag_RequiresOriginalData
@ eModifierTypeFlag_Single
@ eModifierTypeFlag_AcceptsVertexCosOnly
PanelType * modifier_panel_register(ARegionType *region_type, ModifierType type, PanelDrawFn draw)
static void panel_draw(const bContext *, Panel *panel)
static void deform_verts(ModifierData *md, const ModifierEvalContext *ctx, Mesh *mesh, MutableSpan< float3 > positions)
Scene * DEG_get_evaluated_scene(const Depsgraph *graph)
float DEG_get_ctime(const Depsgraph *graph)
void DEG_add_forcefield_relations(DepsNodeHandle *handle, Object *object, EffectorWeights *eff, bool add_absorption, int skip_forcefield, const char *name)
struct SoftBody * soft
ui::Layout * layout
struct EffectorWeights * effector_weights
struct Collection * collision_group
void label(StringRef name, int icon)
#define N_(msgid)