Added DNA and RNA for skin modifier, stubbed in skin modifier functions
authorNicholas Bishop <nicholasbishop@gmail.com>
Sun, 31 Jul 2011 02:03:28 +0000 (02:03 +0000)
committerNicholas Bishop <nicholasbishop@gmail.com>
Sun, 31 Jul 2011 02:03:28 +0000 (02:03 +0000)
source/blender/makesdna/DNA_modifier_types.h
source/blender/makesrna/intern/rna_modifier.c
source/blender/modifiers/CMakeLists.txt
source/blender/modifiers/MOD_modifiertypes.h
source/blender/modifiers/intern/MOD_skin.c [new file with mode: 0644]
source/blender/modifiers/intern/MOD_util.c

index 3787675..483bd33 100644 (file)
@@ -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
index ba65591..b4a4c59 100644 (file)
@@ -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
index d1f1532..7db03f4 100644 (file)
@@ -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
index 4e44a22..329037e 100644 (file)
@@ -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 (file)
index 0000000..adc47f3
--- /dev/null
@@ -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 <stddef.h>
+
+#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,
+};
index e9b835e..e823a34 100644 (file)
@@ -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
 }