From cae05598b1d10a70a0e37f28b6e49a5b5715a30f Mon Sep 17 00:00:00 2001 From: Nicholas Bishop Date: Sun, 31 Jul 2011 02:03:28 +0000 Subject: Added DNA and RNA for skin modifier, stubbed in skin modifier functions --- source/blender/makesdna/DNA_modifier_types.h | 14 +++++ source/blender/makesrna/intern/rna_modifier.c | 15 +++++ source/blender/modifiers/CMakeLists.txt | 1 + source/blender/modifiers/MOD_modifiertypes.h | 1 + source/blender/modifiers/intern/MOD_skin.c | 88 +++++++++++++++++++++++++++ source/blender/modifiers/intern/MOD_util.c | 1 + 6 files changed, 120 insertions(+) create mode 100644 source/blender/modifiers/intern/MOD_skin.c (limited to 'source') diff --git a/source/blender/makesdna/DNA_modifier_types.h b/source/blender/makesdna/DNA_modifier_types.h index 3787675f339..483bd339b3d 100644 --- a/source/blender/makesdna/DNA_modifier_types.h +++ b/source/blender/makesdna/DNA_modifier_types.h @@ -71,6 +71,7 @@ typedef enum ModifierType { eModifierType_Solidify, eModifierType_Screw, eModifierType_Warp, + eModifierType_Skin, NUM_MODIFIER_TYPES } ModifierType; @@ -785,4 +786,17 @@ typedef enum { /* PROP_RANDOM not used */ } WarpModifierFalloff; +typedef enum SkinModifierFlags { + MOD_SKIN_DRAW_SKIN = (1<<0), + MOD_SKIN_DRAW_NODES = (1<<1), +} SkinModifierFlags; + +typedef struct SkinModifierData { + ModifierData modifier; + float threshold; + int subdiv; + int flag; + int pad; +} SkinModifierData; + #endif diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c index ba655915fb6..b4a4c593ba9 100644 --- a/source/blender/makesrna/intern/rna_modifier.c +++ b/source/blender/makesrna/intern/rna_modifier.c @@ -68,6 +68,7 @@ EnumPropertyItem modifier_type_items[] ={ {eModifierType_Solidify, "SOLIDIFY", ICON_MOD_SOLIDIFY, "Solidify", ""}, {eModifierType_Subsurf, "SUBSURF", ICON_MOD_SUBSURF, "Subdivision Surface", ""}, {eModifierType_UVProject, "UV_PROJECT", ICON_MOD_UVPROJECT, "UV Project", ""}, + {eModifierType_Skin, "SKIN", ICON_MOD_ARMATURE, "Skin", ""}, {0, "", 0, "Deform", ""}, {eModifierType_Armature, "ARMATURE", ICON_MOD_ARMATURE, "Armature", ""}, {eModifierType_Cast, "CAST", ICON_MOD_CAST, "Cast", ""}, @@ -183,6 +184,8 @@ static StructRNA* rna_Modifier_refine(struct PointerRNA *ptr) return &RNA_ScrewModifier; case eModifierType_Warp: return &RNA_WarpModifier; + case eModifierType_Skin: + return &RNA_SkinModifier; default: return &RNA_Modifier; } @@ -2412,6 +2415,17 @@ static void rna_def_modifier_screw(BlenderRNA *brna) RNA_def_property_update(prop, 0, "rna_Modifier_update");*/ } +static void rna_def_modifier_skin(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + + srna= RNA_def_struct(brna, "SkinModifier", "Modifier"); + RNA_def_struct_ui_text(srna, "Skin Modifier", "Generate Skin"); + RNA_def_struct_sdna(srna, "SkinModifierData"); + RNA_def_struct_ui_icon(srna, ICON_MOD_ARMATURE); +} + void RNA_def_modifier(BlenderRNA *brna) { StructRNA *srna; @@ -2509,6 +2523,7 @@ void RNA_def_modifier(BlenderRNA *brna) rna_def_modifier_smoke(brna); rna_def_modifier_solidify(brna); rna_def_modifier_screw(brna); + rna_def_modifier_skin(brna); } #endif diff --git a/source/blender/modifiers/CMakeLists.txt b/source/blender/modifiers/CMakeLists.txt index d1f153265ac..7db03f48631 100644 --- a/source/blender/modifiers/CMakeLists.txt +++ b/source/blender/modifiers/CMakeLists.txt @@ -70,6 +70,7 @@ set(SRC intern/MOD_shapekey.c intern/MOD_shrinkwrap.c intern/MOD_simpledeform.c + intern/MOD_skin.c intern/MOD_smoke.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 4e44a226c64..329037ee210 100644 --- a/source/blender/modifiers/MOD_modifiertypes.h +++ b/source/blender/modifiers/MOD_modifiertypes.h @@ -72,6 +72,7 @@ extern ModifierTypeInfo modifierType_ShapeKey; extern ModifierTypeInfo modifierType_Solidify; extern ModifierTypeInfo modifierType_Screw; extern ModifierTypeInfo modifierType_Warp; +extern ModifierTypeInfo modifierType_Skin; /* MOD_util.c */ void modifier_type_init(ModifierTypeInfo *types[]); diff --git a/source/blender/modifiers/intern/MOD_skin.c b/source/blender/modifiers/intern/MOD_skin.c new file mode 100644 index 00000000000..adc47f32c9c --- /dev/null +++ b/source/blender/modifiers/intern/MOD_skin.c @@ -0,0 +1,88 @@ +/* +* $Id$ +* +* ***** BEGIN GPL LICENSE BLOCK ***** +* +* 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. +* +* ***** END GPL LICENSE BLOCK ***** +* +*/ + +/** \file blender/modifiers/intern/MOD_skin.c + * \ingroup modifiers + */ + + +#include + +#include "BKE_cdderivedmesh.h" +#include "BKE_modifier.h" + +#include "DNA_mesh_types.h" +#include "DNA_object_types.h" + +#include "MOD_util.h" + +static void initData(ModifierData *md) +{ + SkinModifierData *smd = (SkinModifierData*)md; + + smd->threshold = 0; + smd->subdiv = 1; + smd->flag = MOD_SKIN_DRAW_NODES; +} + +static void copyData(ModifierData *md, ModifierData *target) +{ + SkinModifierData *smd = (SkinModifierData*) md; + SkinModifierData *tsmd = (SkinModifierData*) target; + + tsmd->threshold = smd->threshold; + tsmd->subdiv = smd->subdiv; + tsmd->flag = smd->flag; +} + +static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *dm, + int useRenderParams, int isFinalCalc) +{ + return dm; +} + + +ModifierTypeInfo modifierType_Skin = { + /* name */ "Skin", + /* structName */ "SkinModifierData", + /* structSize */ sizeof(SkinModifierData), + /* type */ eModifierTypeType_Constructive, + /* flags */ eModifierTypeFlag_AcceptsMesh, + + /* copyData */ copyData, + /* deformVerts */ NULL, + /* deformMatrices */ NULL, + /* deformVertsEM */ NULL, + /* deformMatricesEM */ NULL, + /* applyModifier */ applyModifier, + /* applyModifierEM */ NULL, + /* initData */ initData, + /* requiredDataMask */ NULL, + /* freeData */ NULL, + /* isDisabled */ NULL, + /* updateDepgraph */ NULL, + /* dependsOnTime */ NULL, + /* dependsOnNormals */ NULL, + /* foreachObjectLink */ NULL, + /* foreachIDLink */ NULL, +}; diff --git a/source/blender/modifiers/intern/MOD_util.c b/source/blender/modifiers/intern/MOD_util.c index e9b835eab81..e823a347ced 100644 --- a/source/blender/modifiers/intern/MOD_util.c +++ b/source/blender/modifiers/intern/MOD_util.c @@ -295,5 +295,6 @@ void modifier_type_init(ModifierTypeInfo *types[]) INIT_TYPE(Solidify); INIT_TYPE(Screw); INIT_TYPE(Warp); + INIT_TYPE(Skin); #undef INIT_TYPE } -- cgit v1.2.3