[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [29691] branches/soc-2010-nicks: - added new modifier to create navigation mesh (it's empty now)
Nick Samarin
nicks1987 at bigmir.net
Fri Jun 25 15:03:57 CEST 2010
Revision: 29691
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=29691
Author: nicks
Date: 2010-06-25 15:03:57 +0200 (Fri, 25 Jun 2010)
Log Message:
-----------
- added new modifier to create navigation mesh (it's empty now)
- added parameters for navmesh modifier
Modified Paths:
--------------
branches/soc-2010-nicks/projectfiles_vc9/blender/modifiers/modifiers.vcproj
branches/soc-2010-nicks/release/scripts/ui/properties_data_modifier.py
branches/soc-2010-nicks/source/blender/makesdna/DNA_modifier_types.h
branches/soc-2010-nicks/source/blender/makesrna/intern/rna_modifier.c
branches/soc-2010-nicks/source/blender/modifiers/MOD_modifiertypes.h
branches/soc-2010-nicks/source/blender/modifiers/intern/MOD_util.c
Added Paths:
-----------
branches/soc-2010-nicks/source/blender/modifiers/intern/MOD_navmesh.c
Modified: branches/soc-2010-nicks/projectfiles_vc9/blender/modifiers/modifiers.vcproj
===================================================================
--- branches/soc-2010-nicks/projectfiles_vc9/blender/modifiers/modifiers.vcproj 2010-06-25 13:01:04 UTC (rev 29690)
+++ branches/soc-2010-nicks/projectfiles_vc9/blender/modifiers/modifiers.vcproj 2010-06-25 13:03:57 UTC (rev 29691)
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
- Version="9,00"
+ Version="9.00"
Name="BL_modifiers"
ProjectGUID="{7CB0C521-91E0-40CE-A7C4-45FEA7ABE8BC}"
RootNamespace="BL_modifiers"
@@ -395,6 +395,10 @@
>
</File>
<File
+ RelativePath="..\..\..\source\blender\modifiers\intern\MOD_navmesh.c"
+ >
+ </File>
+ <File
RelativePath="..\..\..\source\blender\modifiers\intern\MOD_none.c"
>
</File>
Modified: branches/soc-2010-nicks/release/scripts/ui/properties_data_modifier.py
===================================================================
--- branches/soc-2010-nicks/release/scripts/ui/properties_data_modifier.py 2010-06-25 13:01:04 UTC (rev 29690)
+++ branches/soc-2010-nicks/release/scripts/ui/properties_data_modifier.py 2010-06-25 13:03:57 UTC (rev 29691)
@@ -460,6 +460,67 @@
row.operator("object.multires_save_external", text="Save External...")
row.label()
+ def NAVMESH(self, layout, ob, md, wide_ui):
+ layout.label(text="Rasterization:")
+ split = layout.split()
+
+ col = split.column()
+ col.prop(md, "cellsize")
+ if wide_ui:
+ col = split.column()
+ col.prop(md, "cellheight")
+
+ layout.separator()
+
+ layout.label(text="Agent:")
+ split = layout.split()
+ col = split.column()
+ row = col.row()
+ row.prop(md, "agentheight")
+ row = col.row()
+ row.prop(md, "agentradius")
+ if wide_ui:
+ col = split.column()
+ row = col.row()
+ row.prop(md, "agentmaxslope")
+ row = col.row()
+ row.prop(md, "agentmaxclimb")
+
+ layout.separator()
+
+ layout.label(text="Region:")
+ split = layout.split()
+ col = split.column()
+ col.prop(md, "regionminsize")
+ if wide_ui:
+ col = split.column()
+ col.prop(md, "regionmergesize")
+
+ layout.separator()
+
+ layout.label(text="Polygonization:")
+ split = layout.split()
+ col = split.column()
+ row = col.row()
+ row.prop(md, "edgemaxlen")
+ row = col.row()
+ row.prop(md, "edgemaxerror")
+ if wide_ui:
+ col = split.column()
+ row = col.row()
+ row.prop(md, "vertsperpoly")
+
+ layout.separator()
+
+ layout.label(text="Detail Mesh:")
+ split = layout.split()
+ col = split.column()
+ col.prop(md, "detailsampledist")
+ if wide_ui:
+ col = split.column()
+ col.prop(md, "detailsamplemaxerror")
+
+
def PARTICLE_INSTANCE(self, layout, ob, md, wide_ui):
layout.prop(md, "object")
layout.prop(md, "particle_system_number", text="Particle System")
Modified: branches/soc-2010-nicks/source/blender/makesdna/DNA_modifier_types.h
===================================================================
--- branches/soc-2010-nicks/source/blender/makesdna/DNA_modifier_types.h 2010-06-25 13:01:04 UTC (rev 29690)
+++ branches/soc-2010-nicks/source/blender/makesdna/DNA_modifier_types.h 2010-06-25 13:03:57 UTC (rev 29691)
@@ -66,6 +66,7 @@
eModifierType_ShapeKey,
eModifierType_Solidify,
eModifierType_Screw,
+ eModifierType_NavMesh,
NUM_MODIFIER_TYPES
} ModifierType;
@@ -336,6 +337,7 @@
int faceCount;
} DecimateModifierData;
+
/* Smooth modifier flags */
#define MOD_SMOOTH_X (1<<1)
#define MOD_SMOOTH_Y (1<<2)
@@ -722,4 +724,23 @@
// #define MOD_SCREW_OBJECT_ANGLE (1<<4)
+typedef struct NavMeshModifierData {
+ ModifierData modifier;
+ char pad[4];
+ float cellsize;
+ float cellheight;
+ float agentmaxslope;
+ float agentmaxclimb;
+ float agentheight;
+ float agentradius;
+ float edgemaxlen;
+ float edgemaxerror;
+ float regionminsize;
+ float regionmergesize;
+ int vertsperpoly;
+ float detailsampledist;
+ float detailsamplemaxerror;
+
+} NavMeshModifierData;
+
#endif
Modified: branches/soc-2010-nicks/source/blender/makesrna/intern/rna_modifier.c
===================================================================
--- branches/soc-2010-nicks/source/blender/makesrna/intern/rna_modifier.c 2010-06-25 13:01:04 UTC (rev 29690)
+++ branches/soc-2010-nicks/source/blender/makesrna/intern/rna_modifier.c 2010-06-25 13:03:57 UTC (rev 29691)
@@ -60,6 +60,7 @@
{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_NavMesh, "NAVMESH", ICON_MOD_DECIM, "Navigation mesh", ""},
{0, "", 0, "Deform", ""},
{eModifierType_Armature, "ARMATURE", ICON_MOD_ARMATURE, "Armature", ""},
{eModifierType_Cast, "CAST", ICON_MOD_CAST, "Cast", ""},
@@ -168,6 +169,8 @@
return &RNA_SolidifyModifier;
case eModifierType_Screw:
return &RNA_ScrewModifier;
+ case eModifierType_NavMesh:
+ return &RNA_NavMeshModifier;
default:
return &RNA_Modifier;
}
@@ -2190,6 +2193,84 @@
RNA_def_property_update(prop, 0, "rna_Modifier_update");*/
}
+static void rna_def_modifier_navmesh(BlenderRNA *brna)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna= RNA_def_struct(brna, "NavMeshModifier", "Modifier");
+ RNA_def_struct_ui_text(srna, "NavMesh Modifier", "NavMesh modifier");
+ RNA_def_struct_sdna(srna, "NavMeshModifierData");
+ RNA_def_struct_ui_icon(srna, ICON_MOD_DECIM);
+
+ prop= RNA_def_property(srna, "cellsize", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_ui_range(prop, 0.1, 1, 0.01, 2);
+ RNA_def_property_ui_text(prop, "Cell size", "Rasterized cell size");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop= RNA_def_property(srna, "cellheight", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_ui_range(prop, 0.1, 1, 0.01, 2);
+ RNA_def_property_ui_text(prop, "Cell height", "Rasterized cell height");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop= RNA_def_property(srna, "agentheight", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_ui_range(prop, 0.1, 5, 0.1, 2);
+ RNA_def_property_ui_text(prop, "Agent height", "Minimum height where the agent can still walk");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop= RNA_def_property(srna, "agentradius", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_ui_range(prop, 0.1, 5, 0.1, 2);
+ RNA_def_property_ui_text(prop, "Agent radius", "Radius of the agent");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop= RNA_def_property(srna, "agentmaxclimb", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_ui_range(prop, 0.1, 5, 0.1, 2);
+ RNA_def_property_ui_text(prop, "Max climb", "Maximum height between grid cells the agent can climb");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop= RNA_def_property(srna, "agentmaxslope", PROP_FLOAT, PROP_ANGLE);
+ RNA_def_property_ui_range(prop, 0, 90, 1, 2);
+ RNA_def_property_ui_text(prop, "Max slope", "Maximum walkable slope angle in degrees");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+
+ prop= RNA_def_property(srna, "regionminsize", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_ui_range(prop, 0, 150, 1, 2);
+ RNA_def_property_ui_text(prop, "Min region size", "Minimum regions size. Smaller regions will be deleted");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop= RNA_def_property(srna, "regionmergesize", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_ui_range(prop, 0, 150, 1, 2);
+ RNA_def_property_ui_text(prop, "Merged region size", "Minimum regions size. Smaller regions will be merged");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop= RNA_def_property(srna, "edgemaxlen", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_ui_range(prop, 0, 50, 1, 2);
+ RNA_def_property_ui_text(prop, "Max edge length", "Maximum contour edge length");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop= RNA_def_property(srna, "edgemaxerror", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_ui_range(prop, 0.1, 3.0, 0.1, 2);
+ RNA_def_property_ui_text(prop, "Max edge error", "Maximum distance error from contour to cells");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop= RNA_def_property(srna, "vertsperpoly", PROP_INT, PROP_NONE);
+ RNA_def_property_ui_range(prop, 3, 12, 1, 0);
+ RNA_def_property_ui_text(prop, "Verts per poly", "Max number of vertices per polygon");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop= RNA_def_property(srna, "detailsampledist", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_ui_range(prop, 0.0, 16.0, 1, 2);
+ RNA_def_property_ui_text(prop, "Sample Distance", "Detail mesh sample spacing");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop= RNA_def_property(srna, "detailsamplemaxerror", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_ui_range(prop, 0.0, 16.0, 1, 2);
+ RNA_def_property_ui_text(prop, "Max Sample Error", "Detail mesh simplification max sample error");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+}
+
void RNA_def_modifier(BlenderRNA *brna)
{
StructRNA *srna;
@@ -2280,6 +2361,7 @@
rna_def_modifier_smoke(brna);
rna_def_modifier_solidify(brna);
rna_def_modifier_screw(brna);
+ rna_def_modifier_navmesh(brna);
}
#endif
Modified: branches/soc-2010-nicks/source/blender/modifiers/MOD_modifiertypes.h
===================================================================
--- branches/soc-2010-nicks/source/blender/modifiers/MOD_modifiertypes.h 2010-06-25 13:01:04 UTC (rev 29690)
+++ branches/soc-2010-nicks/source/blender/modifiers/MOD_modifiertypes.h 2010-06-25 13:03:57 UTC (rev 29691)
@@ -67,6 +67,7 @@
extern ModifierTypeInfo modifierType_ShapeKey;
extern ModifierTypeInfo modifierType_Solidify;
extern ModifierTypeInfo modifierType_Screw;
+extern ModifierTypeInfo modifierType_NavMesh;
/* MOD_util.c */
void modifier_type_init(ModifierTypeInfo *types[], ModifierType type);
Added: branches/soc-2010-nicks/source/blender/modifiers/intern/MOD_navmesh.c
===================================================================
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list