Blender V4.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
9#include <cstdio>
10
11#include "BLI_utildefines.h"
12
13#include "BLT_translation.hh"
14
16#include "DNA_screen_types.h"
17
18#include "BKE_softbody.h"
19
20#include "UI_interface.hh"
21#include "UI_resources.hh"
22
23#include "RNA_prototypes.hh"
24
25#include "DEG_depsgraph.hh"
29
30#include "MOD_modifiertypes.hh"
31#include "MOD_ui_common.hh"
32
33static void deform_verts(ModifierData * /*md*/,
34 const ModifierEvalContext *ctx,
35 Mesh * /*mesh*/,
37{
40 scene,
41 ctx->object,
43 reinterpret_cast<float(*)[3]>(positions.data()),
44 positions.size());
45}
46
47static bool depends_on_time(Scene * /*scene*/, ModifierData * /*md*/)
48{
49 return true;
50}
51
53{
54 if (ctx->object->soft) {
55 /* Actual code uses ccd_build_deflector_hash */
57 ctx->object,
60 nullptr,
61 "Softbody Collision");
63 ctx->node, ctx->object, ctx->object->soft->effector_weights, true, 0, "Softbody Field");
64 }
65 /* We need our own transformation as well. */
66 DEG_add_depends_on_transform_relation(ctx->node, "SoftBody Modifier");
67}
68
69static void panel_draw(const bContext * /*C*/, Panel *panel)
70{
71 uiLayout *layout = panel->layout;
72
74
75 uiItemL(layout, RPT_("Settings are inside the Physics tab"), ICON_NONE);
76
77 modifier_panel_end(layout, ptr);
78}
79
80static void panel_register(ARegionType *region_type)
81{
83}
84
86 /*idname*/ "Softbody",
87 /*name*/ N_("Softbody"),
88 /*struct_name*/ "SoftbodyModifierData",
89 /*struct_size*/ sizeof(SoftbodyModifierData),
90 /*srna*/ &RNA_SoftBodyModifier,
95 /*icon*/ ICON_MOD_SOFT,
96
97 /*copy_data*/ nullptr,
98
99 /*deform_verts*/ deform_verts,
100 /*deform_matrices*/ nullptr,
101 /*deform_verts_EM*/ nullptr,
102 /*deform_matrices_EM*/ nullptr,
103 /*modify_mesh*/ nullptr,
104 /*modify_geometry_set*/ nullptr,
105
106 /*init_data*/ nullptr,
107 /*required_data_mask*/ nullptr,
108 /*free_data*/ nullptr,
109 /*is_disabled*/ nullptr,
110 /*update_depsgraph*/ update_depsgraph,
111 /*depends_on_time*/ depends_on_time,
112 /*depends_on_normals*/ nullptr,
113 /*foreach_ID_link*/ nullptr,
114 /*foreach_tex_link*/ nullptr,
115 /*free_runtime_data*/ nullptr,
116 /*panel_register*/ panel_register,
117 /*blend_write*/ nullptr,
118 /*blend_read*/ nullptr,
119 /*foreach_cache*/ nullptr,
120};
@ eModifierTypeFlag_Single
@ eModifierTypeFlag_UsesPointCache
@ eModifierTypeFlag_AcceptsCVs
@ eModifierTypeFlag_AcceptsVertexCosOnly
@ eModifierTypeFlag_RequiresOriginalData
void sbObjectStep(struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob, float cfra, float(*vertexCos)[3], int numVerts)
Definition softbody.cc:3513
#define RPT_(msgid)
void DEG_add_depends_on_transform_relation(DepsNodeHandle *node_handle, const char *description)
void DEG_add_collision_relations(DepsNodeHandle *handle, Object *object, Collection *collection, unsigned int modifier_type, DEG_CollobjFilterFunction filter_function, const char *name)
void DEG_add_forcefield_relations(DepsNodeHandle *handle, Object *object, EffectorWeights *eff, bool add_absorption, int skip_forcefield, const char *name)
float DEG_get_ctime(const Depsgraph *graph)
Scene * DEG_get_evaluated_scene(const Depsgraph *graph)
struct SoftbodyModifierData SoftbodyModifierData
@ eModifierType_Collision
@ eModifierType_Softbody
static void panel_register(ARegionType *region_type)
static void update_depsgraph(ModifierData *, const ModifierUpdateDepsgraphContext *ctx)
static void deform_verts(ModifierData *, const ModifierEvalContext *ctx, Mesh *, blender::MutableSpan< blender::float3 > positions)
static void panel_draw(const bContext *, Panel *panel)
static bool depends_on_time(Scene *, ModifierData *)
ModifierTypeInfo modifierType_Softbody
void modifier_panel_end(uiLayout *layout, PointerRNA *ptr)
PanelType * modifier_panel_register(ARegionType *region_type, ModifierType type, PanelDrawFn draw)
PointerRNA * modifier_panel_get_property_pointers(Panel *panel, PointerRNA *r_ob_ptr)
void uiItemL(uiLayout *layout, const char *name, int icon)
struct SoftBody * soft
struct uiLayout * layout
struct Collection * collision_group
struct EffectorWeights * effector_weights
#define N_(msgid)
PointerRNA * ptr
Definition wm_files.cc:4126