From 05d9bd7c4a655a4b47b6ccbce6484be9b8134485 Mon Sep 17 00:00:00 2001 From: Jacques Lucke Date: Wed, 21 Oct 2020 12:03:06 +0200 Subject: Modifiers: rename Simulation to Nodes modifier --- source/blender/blenkernel/intern/pointcache.c | 3 - source/blender/makesdna/DNA_modifier_defaults.h | 2 +- source/blender/makesdna/DNA_modifier_types.h | 6 +- source/blender/makesdna/intern/dna_defaults.c | 4 +- source/blender/makesrna/RNA_access.h | 2 +- source/blender/makesrna/intern/rna_modifier.c | 19 +-- source/blender/modifiers/CMakeLists.txt | 2 +- source/blender/modifiers/MOD_modifiertypes.h | 2 +- source/blender/modifiers/intern/MOD_nodes.cc | 194 ++++++++++++++++++++++ source/blender/modifiers/intern/MOD_simulation.cc | 194 ---------------------- source/blender/modifiers/intern/MOD_util.c | 2 +- 11 files changed, 211 insertions(+), 219 deletions(-) create mode 100644 source/blender/modifiers/intern/MOD_nodes.cc delete mode 100644 source/blender/modifiers/intern/MOD_simulation.cc (limited to 'source') diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c index 7c8527a8702..5944d1a693b 100644 --- a/source/blender/blenkernel/intern/pointcache.c +++ b/source/blender/blenkernel/intern/pointcache.c @@ -1187,9 +1187,6 @@ static bool foreach_object_modifier_ptcache(Object *object, } } } - else if (md->type == eModifierType_Simulation) { - /* TODO(jacques): */ - } } return true; } diff --git a/source/blender/makesdna/DNA_modifier_defaults.h b/source/blender/makesdna/DNA_modifier_defaults.h index 34a951ca988..0131339127e 100644 --- a/source/blender/makesdna/DNA_modifier_defaults.h +++ b/source/blender/makesdna/DNA_modifier_defaults.h @@ -574,7 +574,7 @@ .flag = 0, \ } -#define _DNA_DEFAULT_SimulationModifierData \ +#define _DNA_DEFAULT_NodesModifierData \ { 0 } #define _DNA_DEFAULT_SkinModifierData \ diff --git a/source/blender/makesdna/DNA_modifier_types.h b/source/blender/makesdna/DNA_modifier_types.h index 29bcc5fe903..f1d017fe173 100644 --- a/source/blender/makesdna/DNA_modifier_types.h +++ b/source/blender/makesdna/DNA_modifier_types.h @@ -94,7 +94,7 @@ typedef enum ModifierType { eModifierType_WeightedNormal = 54, eModifierType_Weld = 55, eModifierType_Fluid = 56, - eModifierType_Simulation = 57, + eModifierType_Nodes = 57, eModifierType_MeshToVolume = 58, eModifierType_VolumeDisplace = 59, eModifierType_VolumeToMesh = 60, @@ -2217,9 +2217,9 @@ enum { #define MOD_MESHSEQ_READ_ALL \ (MOD_MESHSEQ_READ_VERT | MOD_MESHSEQ_READ_POLY | MOD_MESHSEQ_READ_UV | MOD_MESHSEQ_READ_COLOR) -typedef struct SimulationModifierData { +typedef struct NodesModifierData { ModifierData modifier; -} SimulationModifierData; +} NodesModifierData; typedef struct MeshToVolumeModifierData { ModifierData modifier; diff --git a/source/blender/makesdna/intern/dna_defaults.c b/source/blender/makesdna/intern/dna_defaults.c index 8c95a6d2a31..1a8bd25215f 100644 --- a/source/blender/makesdna/intern/dna_defaults.c +++ b/source/blender/makesdna/intern/dna_defaults.c @@ -271,7 +271,7 @@ SDNA_DEFAULT_DECL_STRUCT(ScrewModifierData); /* Shape key modifier has no items. */ SDNA_DEFAULT_DECL_STRUCT(ShrinkwrapModifierData); SDNA_DEFAULT_DECL_STRUCT(SimpleDeformModifierData); -SDNA_DEFAULT_DECL_STRUCT(SimulationModifierData); +SDNA_DEFAULT_DECL_STRUCT(NodesModifierData); SDNA_DEFAULT_DECL_STRUCT(SkinModifierData); SDNA_DEFAULT_DECL_STRUCT(SmoothModifierData); /* Softbody modifier skipped for now. */ @@ -491,7 +491,7 @@ const void *DNA_default_table[SDNA_TYPE_MAX] = { /* Shape key modifier has no items. */ SDNA_DEFAULT_DECL(ShrinkwrapModifierData), SDNA_DEFAULT_DECL(SimpleDeformModifierData), - SDNA_DEFAULT_DECL(SimulationModifierData), + SDNA_DEFAULT_DECL(NodesModifierData), SDNA_DEFAULT_DECL(SkinModifierData), SDNA_DEFAULT_DECL(SmoothModifierData), /* Softbody modifier skipped for now. */ diff --git a/source/blender/makesrna/RNA_access.h b/source/blender/makesrna/RNA_access.h index 2f4b3e97f54..defb303ddfb 100644 --- a/source/blender/makesrna/RNA_access.h +++ b/source/blender/makesrna/RNA_access.h @@ -566,7 +566,7 @@ extern StructRNA RNA_SimpleDeformModifier; extern StructRNA RNA_SimplifyGpencilModifier; extern StructRNA RNA_Simulation; #ifdef WITH_PARTICLE_NODES -extern StructRNA RNA_SimulationModifier; +extern StructRNA RNA_NodesModifier; #endif extern StructRNA RNA_GeometryNode; extern StructRNA RNA_GeometryNodeTree; diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c index e42dfb83885..9a4898f31db 100644 --- a/source/blender/makesrna/intern/rna_modifier.c +++ b/source/blender/makesrna/intern/rna_modifier.c @@ -29,7 +29,6 @@ #include "DNA_object_force_types.h" #include "DNA_object_types.h" #include "DNA_scene_types.h" -#include "DNA_simulation_types.h" #include "MEM_guardedalloc.h" @@ -161,6 +160,7 @@ const EnumPropertyItem rna_enum_object_modifier_type_items[] = { ICON_MOD_MULTIRES, "Multiresolution", "Subdivide the mesh in a way that allows editing the higher subdivision levels"}, + {eModifierType_Nodes, "NODES", ICON_MESH_DATA, "Nodes", ""}, /* TODO: Use correct icon. */ {eModifierType_Remesh, "REMESH", ICON_MOD_REMESH, @@ -305,11 +305,6 @@ const EnumPropertyItem rna_enum_object_modifier_type_items[] = { "Spawn particles from the shape"}, {eModifierType_Softbody, "SOFT_BODY", ICON_MOD_SOFT, "Soft Body", ""}, {eModifierType_Surface, "SURFACE", ICON_MODIFIER, "Surface", ""}, - {eModifierType_Simulation, - "SIMULATION", - ICON_PHYSICS, - "Simulation", - ""}, /* TODO: Use correct icon. */ {0, NULL, 0, NULL, NULL}, }; @@ -6920,14 +6915,14 @@ static void rna_def_modifier_weightednormal(BlenderRNA *brna) } # ifdef WITH_PARTICLE_NODES -static void rna_def_modifier_simulation(BlenderRNA *brna) +static void rna_def_modifier_nodes(BlenderRNA *brna) { StructRNA *srna; - srna = RNA_def_struct(brna, "SimulationModifier", "Modifier"); - RNA_def_struct_ui_text(srna, "Simulation Modifier", ""); - RNA_def_struct_sdna(srna, "SimulationModifierData"); - RNA_def_struct_ui_icon(srna, ICON_PHYSICS); /* TODO: Use correct icon. */ + srna = RNA_def_struct(brna, "NodesModifier", "Modifier"); + RNA_def_struct_ui_text(srna, "Nodes Modifier", ""); + RNA_def_struct_sdna(srna, "NodesModifierData"); + RNA_def_struct_ui_icon(srna, ICON_MESH_DATA); /* TODO: Use correct icon. */ RNA_define_lib_overridable(true); @@ -7290,7 +7285,7 @@ void RNA_def_modifier(BlenderRNA *brna) rna_def_modifier_surfacedeform(brna); rna_def_modifier_weightednormal(brna); # ifdef WITH_PARTICLE_NODES - rna_def_modifier_simulation(brna); + rna_def_modifier_nodes(brna); # endif rna_def_modifier_mesh_to_volume(brna); rna_def_modifier_volume_displace(brna); diff --git a/source/blender/modifiers/CMakeLists.txt b/source/blender/modifiers/CMakeLists.txt index 754a7eefee7..823af7b0f18 100644 --- a/source/blender/modifiers/CMakeLists.txt +++ b/source/blender/modifiers/CMakeLists.txt @@ -86,7 +86,7 @@ set(SRC intern/MOD_shapekey.c intern/MOD_shrinkwrap.c intern/MOD_simpledeform.c - intern/MOD_simulation.cc + intern/MOD_nodes.cc intern/MOD_skin.c intern/MOD_smooth.c intern/MOD_softbody.c diff --git a/source/blender/modifiers/MOD_modifiertypes.h b/source/blender/modifiers/MOD_modifiertypes.h index 9c488780366..f36cb7ded9c 100644 --- a/source/blender/modifiers/MOD_modifiertypes.h +++ b/source/blender/modifiers/MOD_modifiertypes.h @@ -85,7 +85,7 @@ extern ModifierTypeInfo modifierType_CorrectiveSmooth; extern ModifierTypeInfo modifierType_MeshSequenceCache; extern ModifierTypeInfo modifierType_SurfaceDeform; extern ModifierTypeInfo modifierType_WeightedNormal; -extern ModifierTypeInfo modifierType_Simulation; +extern ModifierTypeInfo modifierType_Nodes; extern ModifierTypeInfo modifierType_MeshToVolume; extern ModifierTypeInfo modifierType_VolumeDisplace; extern ModifierTypeInfo modifierType_VolumeToMesh; diff --git a/source/blender/modifiers/intern/MOD_nodes.cc b/source/blender/modifiers/intern/MOD_nodes.cc new file mode 100644 index 00000000000..449bdde9e4c --- /dev/null +++ b/source/blender/modifiers/intern/MOD_nodes.cc @@ -0,0 +1,194 @@ +/* + * 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, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2005 by the Blender Foundation. + * All rights reserved. + */ + +/** \file + * \ingroup modifiers + */ + +#include +#include +#include + +#include "MEM_guardedalloc.h" + +#include "BLI_float3.hh" +#include "BLI_listbase.h" +#include "BLI_string.h" +#include "BLI_utildefines.h" + +#include "DNA_defaults.h" +#include "DNA_mesh_types.h" +#include "DNA_meshdata_types.h" +#include "DNA_modifier_types.h" +#include "DNA_object_types.h" +#include "DNA_pointcloud_types.h" +#include "DNA_scene_types.h" +#include "DNA_screen_types.h" +#include "DNA_simulation_types.h" + +#include "BKE_customdata.h" +#include "BKE_lib_query.h" +#include "BKE_mesh.h" +#include "BKE_modifier.h" +#include "BKE_pointcloud.h" +#include "BKE_screen.h" +#include "BKE_simulation.h" + +#include "BLO_read_write.h" + +#include "UI_interface.h" +#include "UI_resources.h" + +#include "RNA_access.h" + +#include "DEG_depsgraph_build.h" +#include "DEG_depsgraph_query.h" + +#include "MOD_modifiertypes.h" +#include "MOD_ui_common.h" + +using blender::float3; + +static void initData(ModifierData *md) +{ + NodesModifierData *nmd = (NodesModifierData *)md; + + BLI_assert(MEMCMP_STRUCT_AFTER_IS_ZERO(nmd, modifier)); + + MEMCPY_STRUCT_AFTER(nmd, DNA_struct_default_get(NodesModifierData), modifier); +} + +static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphContext *UNUSED(ctx)) +{ + NodesModifierData *nmd = reinterpret_cast(md); + UNUSED_VARS(nmd); +} + +static void foreachIDLink(ModifierData *md, + Object *UNUSED(ob), + IDWalkFunc UNUSED(walk), + void *UNUSED(userData)) +{ + NodesModifierData *nmd = reinterpret_cast(md); + UNUSED_VARS(nmd); +} + +static bool isDisabled(const struct Scene *UNUSED(scene), + ModifierData *md, + bool UNUSED(useRenderParams)) +{ + NodesModifierData *nmd = reinterpret_cast(md); + UNUSED_VARS(nmd); + return false; +} + +static PointCloud *modifyPointCloud(ModifierData *md, + const ModifierEvalContext *UNUSED(ctx), + PointCloud *pointcloud) +{ + NodesModifierData *nmd = reinterpret_cast(md); + UNUSED_VARS(nmd); + return pointcloud; +} + +static void panel_draw(const bContext *UNUSED(C), Panel *panel) +{ + uiLayout *layout = panel->layout; + + PointerRNA ob_ptr; + PointerRNA *ptr = modifier_panel_get_property_pointers(panel, &ob_ptr); + + uiLayoutSetPropSep(layout, true); + uiLayoutSetPropDecorate(layout, false); + + uiItemL(layout, "This modifier does nothing currently", ICON_INFO); + + modifier_panel_end(layout, ptr); +} + +static void panelRegister(ARegionType *region_type) +{ + modifier_panel_register(region_type, eModifierType_Nodes, panel_draw); +} + +static void blendWrite(BlendWriter *writer, const ModifierData *md) +{ + const NodesModifierData *nmd = reinterpret_cast(md); + UNUSED_VARS(nmd, writer); +} + +static void blendRead(BlendDataReader *reader, ModifierData *md) +{ + NodesModifierData *nmd = reinterpret_cast(md); + UNUSED_VARS(nmd, reader); +} + +static void copyData(const ModifierData *md, ModifierData *target, const int flag) +{ + const NodesModifierData *nmd = reinterpret_cast(md); + NodesModifierData *tnmd = reinterpret_cast(target); + UNUSED_VARS(nmd, tnmd); + + BKE_modifier_copydata_generic(md, target, flag); +} + +static void freeData(ModifierData *md) +{ + NodesModifierData *nmd = reinterpret_cast(md); + UNUSED_VARS(nmd); +} + +ModifierTypeInfo modifierType_Nodes = { + /* name */ "Nodes", + /* structName */ "NodesModifierData", + /* structSize */ sizeof(NodesModifierData), +#ifdef WITH_PARTICLE_NODES + /* srna */ &RNA_NodesModifier, +#else + /* srna */ &RNA_Modifier, +#endif + /* type */ eModifierTypeType_None, + /* flags */ (ModifierTypeFlag)0, + /* icon */ ICON_MESH_DATA, /* TODO: Use correct icon. */ + + /* copyData */ copyData, + + /* deformVerts */ NULL, + /* deformMatrices */ NULL, + /* deformVertsEM */ NULL, + /* deformMatricesEM */ NULL, + /* modifyMesh */ NULL, + /* modifyHair */ NULL, + /* modifyPointCloud */ modifyPointCloud, + /* modifyVolume */ NULL, + + /* initData */ initData, + /* requiredDataMask */ NULL, + /* freeData */ freeData, + /* isDisabled */ isDisabled, + /* updateDepsgraph */ updateDepsgraph, + /* dependsOnTime */ NULL, + /* dependsOnNormals */ NULL, + /* foreachIDLink */ foreachIDLink, + /* foreachTexLink */ NULL, + /* freeRuntimeData */ NULL, + /* panelRegister */ panelRegister, + /* blendWrite */ blendWrite, + /* blendRead */ blendRead, +}; diff --git a/source/blender/modifiers/intern/MOD_simulation.cc b/source/blender/modifiers/intern/MOD_simulation.cc deleted file mode 100644 index 28b4c329730..00000000000 --- a/source/blender/modifiers/intern/MOD_simulation.cc +++ /dev/null @@ -1,194 +0,0 @@ -/* - * 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, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2005 by the Blender Foundation. - * All rights reserved. - */ - -/** \file - * \ingroup modifiers - */ - -#include -#include -#include - -#include "MEM_guardedalloc.h" - -#include "BLI_float3.hh" -#include "BLI_listbase.h" -#include "BLI_string.h" -#include "BLI_utildefines.h" - -#include "DNA_defaults.h" -#include "DNA_mesh_types.h" -#include "DNA_meshdata_types.h" -#include "DNA_modifier_types.h" -#include "DNA_object_types.h" -#include "DNA_pointcloud_types.h" -#include "DNA_scene_types.h" -#include "DNA_screen_types.h" -#include "DNA_simulation_types.h" - -#include "BKE_customdata.h" -#include "BKE_lib_query.h" -#include "BKE_mesh.h" -#include "BKE_modifier.h" -#include "BKE_pointcloud.h" -#include "BKE_screen.h" -#include "BKE_simulation.h" - -#include "BLO_read_write.h" - -#include "UI_interface.h" -#include "UI_resources.h" - -#include "RNA_access.h" - -#include "DEG_depsgraph_build.h" -#include "DEG_depsgraph_query.h" - -#include "MOD_modifiertypes.h" -#include "MOD_ui_common.h" - -using blender::float3; - -static void initData(ModifierData *md) -{ - SimulationModifierData *smd = (SimulationModifierData *)md; - - BLI_assert(MEMCMP_STRUCT_AFTER_IS_ZERO(smd, modifier)); - - MEMCPY_STRUCT_AFTER(smd, DNA_struct_default_get(SimulationModifierData), modifier); -} - -static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphContext *UNUSED(ctx)) -{ - SimulationModifierData *smd = reinterpret_cast(md); - UNUSED_VARS(smd); -} - -static void foreachIDLink(ModifierData *md, - Object *UNUSED(ob), - IDWalkFunc UNUSED(walk), - void *UNUSED(userData)) -{ - SimulationModifierData *smd = reinterpret_cast(md); - UNUSED_VARS(smd); -} - -static bool isDisabled(const struct Scene *UNUSED(scene), - ModifierData *md, - bool UNUSED(useRenderParams)) -{ - SimulationModifierData *smd = reinterpret_cast(md); - UNUSED_VARS(smd); - return false; -} - -static PointCloud *modifyPointCloud(ModifierData *md, - const ModifierEvalContext *UNUSED(ctx), - PointCloud *pointcloud) -{ - SimulationModifierData *smd = reinterpret_cast(md); - UNUSED_VARS(smd); - return pointcloud; -} - -static void panel_draw(const bContext *UNUSED(C), Panel *panel) -{ - uiLayout *layout = panel->layout; - - PointerRNA ob_ptr; - PointerRNA *ptr = modifier_panel_get_property_pointers(panel, &ob_ptr); - - uiLayoutSetPropSep(layout, true); - uiLayoutSetPropDecorate(layout, false); - - uiItemL(layout, "This modifier does nothing currently", ICON_INFO); - - modifier_panel_end(layout, ptr); -} - -static void panelRegister(ARegionType *region_type) -{ - modifier_panel_register(region_type, eModifierType_Simulation, panel_draw); -} - -static void blendWrite(BlendWriter *writer, const ModifierData *md) -{ - const SimulationModifierData *smd = reinterpret_cast(md); - UNUSED_VARS(smd, writer); -} - -static void blendRead(BlendDataReader *reader, ModifierData *md) -{ - SimulationModifierData *smd = reinterpret_cast(md); - UNUSED_VARS(smd, reader); -} - -static void copyData(const ModifierData *md, ModifierData *target, const int flag) -{ - const SimulationModifierData *smd = reinterpret_cast(md); - SimulationModifierData *tsmd = reinterpret_cast(target); - UNUSED_VARS(smd, tsmd); - - BKE_modifier_copydata_generic(md, target, flag); -} - -static void freeData(ModifierData *md) -{ - SimulationModifierData *smd = reinterpret_cast(md); - UNUSED_VARS(smd); -} - -ModifierTypeInfo modifierType_Simulation = { - /* name */ "Simulation", - /* structName */ "SimulationModifierData", - /* structSize */ sizeof(SimulationModifierData), -#ifdef WITH_PARTICLE_NODES - /* srna */ &RNA_SimulationModifier, -#else - /* srna */ &RNA_Modifier, -#endif - /* type */ eModifierTypeType_None, - /* flags */ (ModifierTypeFlag)0, - /* icon */ ICON_PHYSICS, /* TODO: Use correct icon. */ - - /* copyData */ copyData, - - /* deformVerts */ NULL, - /* deformMatrices */ NULL, - /* deformVertsEM */ NULL, - /* deformMatricesEM */ NULL, - /* modifyMesh */ NULL, - /* modifyHair */ NULL, - /* modifyPointCloud */ modifyPointCloud, - /* modifyVolume */ NULL, - - /* initData */ initData, - /* requiredDataMask */ NULL, - /* freeData */ freeData, - /* isDisabled */ isDisabled, - /* updateDepsgraph */ updateDepsgraph, - /* dependsOnTime */ NULL, - /* dependsOnNormals */ NULL, - /* foreachIDLink */ foreachIDLink, - /* foreachTexLink */ NULL, - /* freeRuntimeData */ NULL, - /* panelRegister */ panelRegister, - /* blendWrite */ blendWrite, - /* blendRead */ blendRead, -}; diff --git a/source/blender/modifiers/intern/MOD_util.c b/source/blender/modifiers/intern/MOD_util.c index e0802dc5fb4..32d40027537 100644 --- a/source/blender/modifiers/intern/MOD_util.c +++ b/source/blender/modifiers/intern/MOD_util.c @@ -342,7 +342,7 @@ void modifier_type_init(ModifierTypeInfo *types[]) INIT_TYPE(MeshSequenceCache); INIT_TYPE(SurfaceDeform); INIT_TYPE(WeightedNormal); - INIT_TYPE(Simulation); + INIT_TYPE(Nodes); INIT_TYPE(MeshToVolume); INIT_TYPE(VolumeDisplace); INIT_TYPE(VolumeToMesh); -- cgit v1.2.3