[Bf-blender-cvs] [b0bbde6] strand_gpu: Stub modifier for testing strand geometry generation.
Lukas Tönne
noreply at git.blender.org
Tue Jul 5 09:56:50 CEST 2016
Commit: b0bbde6791ac7c404066cc381ba65b4cc3dc32bd
Author: Lukas Tönne
Date: Tue Jun 28 18:03:01 2016 +0200
Branches: strand_gpu
https://developer.blender.org/rBb0bbde6791ac7c404066cc381ba65b4cc3dc32bd
Stub modifier for testing strand geometry generation.
Modifier is not ideal, but easiest way to test code due to lack of
infrastructure in Object for node-generated data.
===================================================================
M release/scripts/startup/bl_ui/properties_data_modifier.py
M source/blender/CMakeLists.txt
M source/blender/editors/space_outliner/outliner_draw.c
M source/blender/makesdna/DNA_modifier_types.h
A source/blender/makesdna/DNA_strand_types.h
M source/blender/makesdna/intern/makesdna.c
M source/blender/makesrna/RNA_access.h
M source/blender/makesrna/intern/rna_modifier.c
M source/blender/modifiers/CMakeLists.txt
M source/blender/modifiers/MOD_modifiertypes.h
A source/blender/modifiers/intern/MOD_strands.c
M source/blender/modifiers/intern/MOD_util.c
===================================================================
diff --git a/release/scripts/startup/bl_ui/properties_data_modifier.py b/release/scripts/startup/bl_ui/properties_data_modifier.py
index 7863c07..4fc2846 100644
--- a/release/scripts/startup/bl_ui/properties_data_modifier.py
+++ b/release/scripts/startup/bl_ui/properties_data_modifier.py
@@ -879,6 +879,9 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel):
row.active = md.use_rim
row.prop(md, "material_offset_rim", text="Rim")
+ def STRANDS(self, layout, ob, md):
+ pass
+
def SUBSURF(self, layout, ob, md):
layout.row().prop(md, "subdivision_type", expand=True)
diff --git a/source/blender/CMakeLists.txt b/source/blender/CMakeLists.txt
index e36f9e2..e5ae6fa 100644
--- a/source/blender/CMakeLists.txt
+++ b/source/blender/CMakeLists.txt
@@ -79,6 +79,7 @@ set(SRC_DNA_INC
${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_sound_types.h
${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_space_types.h
${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_speaker_types.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_strand_types.h
${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_text_types.h
${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_texture_types.h
${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_userdef_types.h
diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c
index 43e9c26..4346b0b 100644
--- a/source/blender/editors/space_outliner/outliner_draw.c
+++ b/source/blender/editors/space_outliner/outliner_draw.c
@@ -1180,6 +1180,8 @@ static void tselem_draw_icon(uiBlock *block, int xmax, float x, float y, TreeSto
UI_icon_draw(x, y, ICON_MOD_DATA_TRANSFER); break;
case eModifierType_NormalEdit:
UI_icon_draw(x, y, ICON_MOD_NORMALEDIT); break;
+ case eModifierType_Strands:
+ UI_icon_draw(x, y, ICON_STRANDS); break;
/* Default */
case eModifierType_None:
case eModifierType_ShapeKey:
diff --git a/source/blender/makesdna/DNA_modifier_types.h b/source/blender/makesdna/DNA_modifier_types.h
index a58e995..28ee2c8 100644
--- a/source/blender/makesdna/DNA_modifier_types.h
+++ b/source/blender/makesdna/DNA_modifier_types.h
@@ -85,6 +85,7 @@ typedef enum ModifierType {
eModifierType_DataTransfer = 49,
eModifierType_NormalEdit = 50,
eModifierType_CorrectiveSmooth = 51,
+ eModifierType_Strands = 52,
NUM_MODIFIER_TYPES
} ModifierType;
@@ -1543,4 +1544,9 @@ enum {
MOD_NORMALEDIT_MIX_MUL = 3,
};
+/* Strand modifier */
+typedef struct StrandsModifierData {
+ ModifierData modifier;
+} StrandsModifierData;
+
#endif /* __DNA_MODIFIER_TYPES_H__ */
diff --git a/source/blender/makesdna/DNA_strand_types.h b/source/blender/makesdna/DNA_strand_types.h
new file mode 100644
index 0000000..6815b20
--- /dev/null
+++ b/source/blender/makesdna/DNA_strand_types.h
@@ -0,0 +1,81 @@
+/*
+ * ***** 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.
+ *
+ * The Original Code is Copyright (C) Blender Foundation
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): Lukas Toenne
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file DNA_strand_types.h
+ * \ingroup DNA
+ */
+
+#ifndef __DNA_STRAND_TYPES_H__
+#define __DNA_STRAND_TYPES_H__
+
+#include "DNA_defs.h"
+#include "DNA_ID.h"
+#include "DNA_meshdata_types.h"
+
+typedef struct StrandVertex {
+ /* Position */
+ float co[3];
+} StrandVertex;
+
+typedef struct StrandCurve {
+ /* Start of vertex list */
+ unsigned int verts_begin;
+ /* Number of vertices in the curve */
+ unsigned int num_verts;
+ /* Transform to object space */
+ float rootmat[4][4];
+} StrandCurve;
+
+typedef struct StrandData {
+ /* Array of vertices */
+ StrandVertex *verts;
+ /* Array of curves */
+ StrandCurve *curves;
+
+ /* Total number of vertices */
+ int totverts;
+ /* Total number of curves */
+ int totcurves;
+} StrandData;
+
+typedef struct Strand {
+ /* Sample on the scalp mesh for the root vertex */
+ MeshSample root;
+ /* Indices of control strands for interpolation */
+ unsigned int control_index[4];
+ /* Weights of control strands for interpolation */
+ float control_weights[4];
+} Strand;
+
+typedef struct ControlStrand {
+ /* Sample on the scalp mesh for the root vertex */
+ MeshSample root;
+ /* Curve in root space */
+ StrandCurve curve;
+} ControlStrand;
+
+#endif
diff --git a/source/blender/makesdna/intern/makesdna.c b/source/blender/makesdna/intern/makesdna.c
index fc94a8d..3b69fb5 100644
--- a/source/blender/makesdna/intern/makesdna.c
+++ b/source/blender/makesdna/intern/makesdna.c
@@ -129,6 +129,7 @@ static const char *includefiles[] = {
"DNA_rigidbody_types.h",
"DNA_freestyle_types.h",
"DNA_linestyle_types.h",
+ "DNA_strand_types.h",
/* see comment above before editing! */
/* empty string to indicate end of includefiles */
@@ -1317,4 +1318,5 @@ int main(int argc, char **argv)
#include "DNA_rigidbody_types.h"
#include "DNA_freestyle_types.h"
#include "DNA_linestyle_types.h"
+#include "DNA_strand_types.h"
/* end of list */
diff --git a/source/blender/makesrna/RNA_access.h b/source/blender/makesrna/RNA_access.h
index c3d25ed..7dc9247 100644
--- a/source/blender/makesrna/RNA_access.h
+++ b/source/blender/makesrna/RNA_access.h
@@ -584,6 +584,7 @@ extern StructRNA RNA_Spline;
extern StructRNA RNA_SplineIKConstraint;
extern StructRNA RNA_SpotLamp;
extern StructRNA RNA_Stereo3dDisplay;
+extern StructRNA RNA_StrandsModifier;
extern StructRNA RNA_StretchToConstraint;
extern StructRNA RNA_StringProperty;
extern StructRNA RNA_Struct;
diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c
index a7c9f29..c7b96b7 100644
--- a/source/blender/makesrna/intern/rna_modifier.c
+++ b/source/blender/makesrna/intern/rna_modifier.c
@@ -116,6 +116,7 @@ EnumPropertyItem rna_enum_object_modifier_type_items[] = {
{eModifierType_ParticleSystem, "PARTICLE_SYSTEM", ICON_MOD_PARTICLES, "Particle System", ""},
{eModifierType_Smoke, "SMOKE", ICON_MOD_SMOKE, "Smoke", ""},
{eModifierType_Softbody, "SOFT_BODY", ICON_MOD_SOFT, "Soft Body", ""},
+ {eModifierType_Strands, "STRANDS", ICON_STRANDS, "Strands", ""},
{eModifierType_Surface, "SURFACE", ICON_MOD_PHYSICS, "Surface", ""},
{0, NULL, 0, NULL, NULL}
};
@@ -399,6 +400,8 @@ static StructRNA *rna_Modifier_refine(struct PointerRNA *ptr)
return &RNA_NormalEditModifier;
case eModifierType_CorrectiveSmooth:
return &RNA_CorrectiveSmoothModifier;
+ case eModifierType_Strands:
+ return &RNA_StrandsModifier;
/* Default */
case eModifierType_None:
case eModifierType_ShapeKey:
@@ -4639,6 +4642,19 @@ static void rna_def_modifier_normaledit(BlenderRNA *brna)
RNA_def_property_update(prop, 0, "rna_Modifier_update");
}
+static void rna_def_modifier_strands(BlenderRNA *brna)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "StrandsModifier", "Modifier");
+ RNA_def_struct_ui_text(srna, "Strands Modifier", "Modifier modeling hair strands");
+ RNA_def_struct_sdna(srna, "StrandsModifierData");
+ RNA_def_struct_ui_icon(srna, ICON_STRANDS);
+
+ UNUSED_VARS(prop);
+}
+
void RNA_def_modifier(BlenderRNA *brna)
{
StructRNA *srna;
@@ -4755,6 +4771,7 @@ void RNA_def_modifier(BlenderRNA *brna)
rna_def_modifier_wireframe(brna);
rna_def_modifier_datatransfer(brna);
rna_def_modifier_normaledit(brna);
+ rna_def_modifier_strands(brna);
}
#endif
diff --git a/source/blender/modifiers/CMakeLists.txt b/source/blender/modifiers/CMakeLists.txt
index 0de7676..0377046 100644
--- a/source/blender/modifiers/CMakeLists.txt
+++ b/source/blender/modifiers/CMakeLists.txt
@@ -90,6 +90,7 @@ set(SRC
intern/MOD_smooth.c
intern/MOD_softbody.c
intern/MOD_solidify.c
+ intern/MOD_strands.c
intern/MOD_subsurf.c
intern/MOD_surface.c
intern/MOD_triangulate.c
diff --git a/source/blender/modifiers/MOD_modifiertypes.h b/source/blender/modifiers/MOD_modifiertypes.h
index a5d9675..cc8308e 100644
--- a/source/blender/modifiers/MOD_modifiertypes.h
+++ b/source/blender/modifiers/MOD_modifiertypes.h
@@ -66,6 +66,7 @@ extern ModifierTypeInfo modifierType_Smoke;
extern ModifierTypeInfo modifierType_ShapeKey;
extern ModifierTypeInfo modifierType_Solidify;
extern ModifierTypeInfo modifierType_Screw;
+extern ModifierTypeInfo modifierType_Strands;
extern ModifierTypeInfo modifierType_Ocean;
extern ModifierTypeInfo modifierType_Warp;
extern ModifierTypeInfo modifierType_NavMesh;
diff --git a/source/blender/modifiers/intern/MOD_strands.c b/source/blender/modifiers/intern/MOD_strands.c
new file mode 100644
index 0000000..15f58c5
--- /dev/null
+++ b/source/blender/modifiers/intern/MOD_strands.c
@@ -0,0 +1,108 @@
+/*
+ * ***** 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.
+ *
+ * The Original Code is Copyright (C) 2005 by the
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list