- set valid default value for facingaxis parameter of steering actuator (for earlier versions)

- disable instead hiding UI checkbox for facing_axis and normal_up parameters of steering actuator 
- fit rna names to the name convention for steering actuator and recast data structures
This commit is contained in:
Nick Samarin
2010-09-03 19:56:22 +00:00
parent a52f51df27
commit ee0f4e8d76
5 changed files with 94 additions and 56 deletions

View File

@@ -350,10 +350,10 @@ class SCENE_PT_navmesh(SceneButtonsPanel, bpy.types.Panel):
split = layout.split()
col = split.column()
col.prop(rd, "cellsize")
col.prop(rd, "cell_size")
if wide_ui:
col = split.column()
col.prop(rd, "cellheight")
col.prop(rd, "cell_height")
layout.separator()
@@ -361,25 +361,25 @@ class SCENE_PT_navmesh(SceneButtonsPanel, bpy.types.Panel):
split = layout.split()
col = split.column()
row = col.row()
row.prop(rd, "agentheight")
row.prop(rd, "agent_height")
row = col.row()
row.prop(rd, "agentradius")
row.prop(rd, "agent_radius")
if wide_ui:
col = split.column()
row = col.row()
row.prop(rd, "agentmaxslope")
row.prop(rd, "max_slope")
row = col.row()
row.prop(rd, "agentmaxclimb")
row.prop(rd, "max_climb")
layout.separator()
layout.label(text="Region:")
split = layout.split()
col = split.column()
col.prop(rd, "regionminsize")
col.prop(rd, "region_min_size")
if wide_ui:
col = split.column()
col.prop(rd, "regionmergesize")
col.prop(rd, "region_merge_size")
layout.separator()
@@ -387,23 +387,23 @@ class SCENE_PT_navmesh(SceneButtonsPanel, bpy.types.Panel):
split = layout.split()
col = split.column()
row = col.row()
row.prop(rd, "edgemaxlen")
row.prop(rd, "edge_max_len")
row = col.row()
row.prop(rd, "edgemaxerror")
row.prop(rd, "edge_max_error")
if wide_ui:
col = split.column()
row = col.row()
row.prop(rd, "vertsperpoly")
row.prop(rd, "verts_per_poly")
layout.separator()
layout.label(text="Detail Mesh:")
split = layout.split()
col = split.column()
col.prop(rd, "detailsampledist")
col.prop(rd, "sample_dist")
if wide_ui:
col = split.column()
col.prop(rd, "detailsamplemaxerror")
col.prop(rd, "sample_max_error")
def register():

View File

@@ -11157,6 +11157,23 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
// init facing axis property of steering actuators
{
Object *ob;
for(ob = main->object.first; ob; ob = ob->id.next) {
bActuator *act;
for(act= ob->actuators.first; act; act= act->next) {
if(act->type==ACT_STEERING) {
bSteeringActuator* stact = act->data;
if (stact->facingaxis==0)
{
stact->facingaxis=1;
}
}
}
}
}
/* WATCH IT!!!: pointers from libdata have not been converted yet here! */
/* WATCH IT 2!: Userdef struct init has to be in editors/interface/resources.c! */

View File

@@ -4336,6 +4336,7 @@ static void draw_actuator_visibility(uiLayout *layout, PointerRNA *ptr)
static void draw_actuator_steering(uiLayout *layout, PointerRNA *ptr)
{
uiLayout *row;
uiLayout *col;
uiItemR(layout, ptr, "mode", 0, NULL, 0);
uiItemR(layout, ptr, "target", 0, NULL, 0);
@@ -4346,25 +4347,32 @@ static void draw_actuator_steering(uiLayout *layout, PointerRNA *ptr)
uiItemR(row, ptr, "velocity", 0, NULL, 0);
row = uiLayoutRow(layout, 0);
uiItemR(row, ptr, "acceleration", 0, NULL, 0);
uiItemR(row, ptr, "turnspeed", 0, NULL, 0);
uiItemR(row, ptr, "turn_speed", 0, NULL, 0);
row = uiLayoutRow(layout, 0);
uiItemR(row, ptr, "facing", 0, NULL, 0);
if (RNA_boolean_get(ptr, "facing"))
col = uiLayoutColumn(row, 0);
uiItemR(col, ptr, "facing", 0, NULL, 0);
col = uiLayoutColumn(row, 0);
uiItemR(col, ptr, "facing_axis", 0, NULL, 0);
if (!RNA_boolean_get(ptr, "facing"))
{
uiItemR(row, ptr, "facingaxis", 0, NULL, 0);
uiLayoutSetActive(col, 0);
}
if (RNA_pointer_get(ptr, "navmesh").data)
col = uiLayoutColumn(row, 0);
uiItemR(col, ptr, "normal_up", 0, NULL, 0);
if (!RNA_pointer_get(ptr, "navmesh").data)
{
uiItemR(row, ptr, "normalup", 0, NULL, 0);
uiLayoutSetActive(col, 0);
}
row = uiLayoutRow(layout, 0);
uiItemR(row, ptr, "selfterminated", 0, NULL, 0);
uiItemR(row, ptr, "self_terminated", 0, NULL, 0);
if (RNA_enum_get(ptr, "mode")==ACT_STEERING_PATHFOLLOWING)
{
uiItemR(row, ptr, "updateperiod", 0, NULL, 0);
uiItemR(row, ptr, "update_period", 0, NULL, 0);
row = uiLayoutRow(layout, 0);
}
uiItemR(row, ptr, "enablevisualization", 0, NULL, 0);
uiItemR(row, ptr, "show_visualization", 0, NULL, 0);
}

View File

@@ -1923,10 +1923,10 @@ static void rna_def_steering_actuator(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Acceleration", "Max acceleration");
RNA_def_property_update(prop, NC_LOGIC, NULL);
prop= RNA_def_property(srna, "turnspeed", PROP_FLOAT, PROP_NONE);
prop= RNA_def_property(srna, "turn_speed", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "turnspeed");
RNA_def_property_range(prop, 0.0, 720.0);
RNA_def_property_ui_text(prop, "Turn speed", "Max turn speed");
RNA_def_property_ui_text(prop, "Turn Speed", "Max turn speed");
RNA_def_property_update(prop, NC_LOGIC, NULL);
prop= RNA_def_property(srna, "distance", PROP_FLOAT, PROP_NONE);
@@ -1942,17 +1942,17 @@ static void rna_def_steering_actuator(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Target Object", "Set target object");
RNA_def_property_update(prop, NC_LOGIC, NULL);
prop= RNA_def_property(srna, "selfterminated", PROP_BOOLEAN, PROP_NONE);
prop= RNA_def_property(srna, "self_terminated", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_STEERING_SELFTERMINATED);
RNA_def_property_ui_text(prop, "Self terminated", "Terminate when target is reached");
RNA_def_property_ui_text(prop, "Self Terminated", "Terminate when target is reached");
RNA_def_property_update(prop, NC_LOGIC, NULL);
prop= RNA_def_property(srna, "enablevisualization", PROP_BOOLEAN, PROP_NONE);
prop= RNA_def_property(srna, "show_visualization", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_STEERING_ENABLEVISUALIZATION);
RNA_def_property_ui_text(prop, "Visualize", "Enable debug visualization");
RNA_def_property_update(prop, NC_LOGIC, NULL);
prop= RNA_def_property(srna, "updateperiod", PROP_INT, PROP_NONE);
prop= RNA_def_property(srna, "update_period", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "updateTime");
RNA_def_property_ui_range(prop, -1, 100000, 1, 1);
RNA_def_property_ui_text(prop, "Update period", "Path update period");
@@ -1971,13 +1971,13 @@ static void rna_def_steering_actuator(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Facing", "Enable automatic facing");
RNA_def_property_update(prop, NC_LOGIC, NULL);
prop= RNA_def_property(srna, "facingaxis", PROP_ENUM, PROP_NONE);
prop= RNA_def_property(srna, "facing_axis", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "facingaxis");
RNA_def_property_enum_items(prop, facingaxis_items);
RNA_def_property_ui_text(prop, "Axis", "Axis for automatic facing");
RNA_def_property_update(prop, NC_LOGIC, NULL);
prop= RNA_def_property(srna, "normalup", PROP_BOOLEAN, PROP_NONE);
prop= RNA_def_property(srna, "normal_up", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_STEERING_NORMALUP);
RNA_def_property_ui_text(prop, "N", "Use normal of the navmesh to set \"UP\" vector");
RNA_def_property_update(prop, NC_LOGIC, NULL);

View File

@@ -1519,70 +1519,83 @@ static void rna_def_scene_game_recast_data(BlenderRNA *brna)
RNA_def_struct_nested(brna, srna, "Scene");
RNA_def_struct_ui_text(srna, "Recast Data", "Recast data for a Game datablock");
prop= RNA_def_property(srna, "cellsize", PROP_FLOAT, PROP_NONE);
prop= RNA_def_property(srna, "cell_size", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "cellsize");
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_ui_text(prop, "Cell Size", "Rasterized cell size");
RNA_def_property_update(prop, NC_SCENE, NULL);
prop= RNA_def_property(srna, "cellheight", PROP_FLOAT, PROP_NONE);
prop= RNA_def_property(srna, "cell_height", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "cellheight");
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_ui_text(prop, "Cell Height", "Rasterized cell height");
RNA_def_property_update(prop, NC_SCENE, NULL);
prop= RNA_def_property(srna, "agentheight", PROP_FLOAT, PROP_NONE);
prop= RNA_def_property(srna, "agent_height", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "agentheight");
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_ui_text(prop, "Agent Height", "Minimum height where the agent can still walk");
RNA_def_property_update(prop, NC_SCENE, NULL);
prop= RNA_def_property(srna, "agentradius", PROP_FLOAT, PROP_NONE);
prop= RNA_def_property(srna, "agent_radius", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "agentradius");
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_ui_text(prop, "Agent Radius", "Radius of the agent");
RNA_def_property_update(prop, NC_SCENE, NULL);
prop= RNA_def_property(srna, "agentmaxclimb", PROP_FLOAT, PROP_NONE);
prop= RNA_def_property(srna, "max_climb", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "agentmaxclimb");
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_ui_text(prop, "Max Climb", "Maximum height between grid cells the agent can climb");
RNA_def_property_update(prop, NC_SCENE, NULL);
prop= RNA_def_property(srna, "agentmaxslope", PROP_FLOAT, PROP_ANGLE);
prop= RNA_def_property(srna, "max_slope", PROP_FLOAT, PROP_ANGLE);
RNA_def_property_float_sdna(prop, NULL, "agentmaxslope");
RNA_def_property_range(prop, 0, M_PI/2);
RNA_def_property_ui_text(prop, "Max slope", "Maximum walkable slope angle in degrees");
RNA_def_property_ui_text(prop, "Max Slope", "Maximum walkable slope angle in degrees");
RNA_def_property_update(prop, NC_SCENE, NULL);
prop= RNA_def_property(srna, "regionminsize", PROP_FLOAT, PROP_NONE);
prop= RNA_def_property(srna, "region_min_size", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "regionminsize");
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_ui_text(prop, "Min Region Size", "Minimum regions size. Smaller regions will be deleted");
RNA_def_property_update(prop, NC_SCENE, NULL);
prop= RNA_def_property(srna, "regionmergesize", PROP_FLOAT, PROP_NONE);
prop= RNA_def_property(srna, "region_merge_size", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "regionmergesize");
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_ui_text(prop, "Merged Region Size", "Minimum regions size. Smaller regions will be merged");
RNA_def_property_update(prop, NC_SCENE, NULL);
prop= RNA_def_property(srna, "edgemaxlen", PROP_FLOAT, PROP_NONE);
prop= RNA_def_property(srna, "edge_max_len", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "edgemaxlen");
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_ui_text(prop, "Max Edge Length", "Maximum contour edge length");
RNA_def_property_update(prop, NC_SCENE, NULL);
prop= RNA_def_property(srna, "edgemaxerror", PROP_FLOAT, PROP_NONE);
prop= RNA_def_property(srna, "edge_max_error", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "edgemaxerror");
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_ui_text(prop, "Max Edge Error", "Maximum distance error from contour to cells");
RNA_def_property_update(prop, NC_SCENE, NULL);
prop= RNA_def_property(srna, "vertsperpoly", PROP_INT, PROP_NONE);
prop= RNA_def_property(srna, "verts_per_poly", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "vertsperpoly");
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_ui_text(prop, "Verts Per Poly", "Max number of vertices per polygon");
RNA_def_property_update(prop, NC_SCENE, NULL);
prop= RNA_def_property(srna, "detailsampledist", PROP_FLOAT, PROP_NONE);
prop= RNA_def_property(srna, "sample_dist", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "detailsampledist");
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_ui_text(prop, "Sample Distance", "Detail mesh sample spacing");
RNA_def_property_update(prop, NC_SCENE, NULL);
prop= RNA_def_property(srna, "detailsamplemaxerror", PROP_FLOAT, PROP_NONE);
prop= RNA_def_property(srna, "sample_max_error", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "detailsamplemaxerror");
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_ui_text(prop, "Max Sample Error", "Detail mesh simplification max sample error");
RNA_def_property_update(prop, NC_SCENE, NULL);
}