From 37cd3368da39d5b93a80f9999c5838556b7ae214 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Sat, 24 Sep 2011 09:57:47 +0000 Subject: Minor: Other UI strings typos and tweaks. Also updated french po & mo --- source/blender/makesrna/intern/rna_mesh.c | 76 +++++++++++++++++++---------- source/blender/makesrna/intern/rna_object.c | 28 +++++------ 2 files changed, 64 insertions(+), 40 deletions(-) (limited to 'source') diff --git a/source/blender/makesrna/intern/rna_mesh.c b/source/blender/makesrna/intern/rna_mesh.c index 1bbdc7cc853..67bb7bffcfb 100644 --- a/source/blender/makesrna/intern/rna_mesh.c +++ b/source/blender/makesrna/intern/rna_mesh.c @@ -1226,7 +1226,8 @@ static void rna_def_mvert(BlenderRNA *brna) RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); prop= RNA_def_property(srna, "groups", PROP_COLLECTION, PROP_NONE); - RNA_def_property_collection_funcs(prop, "rna_MeshVertex_groups_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_get", 0, 0, 0); + RNA_def_property_collection_funcs(prop, "rna_MeshVertex_groups_begin", "rna_iterator_array_next", + "rna_iterator_array_end", "rna_iterator_array_get", 0, 0, 0); RNA_def_property_struct_type(prop, "VertexGroupElement"); RNA_def_property_ui_text(prop, "Groups", "Weights for the vertex groups this vertex is member of"); @@ -1392,7 +1393,8 @@ static void rna_def_mtface(BlenderRNA *brna) prop= RNA_def_property(srna, "active_render", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "active_rnd", 0); - RNA_def_property_boolean_funcs(prop, "rna_MeshTextureFaceLayer_active_render_get", "rna_MeshTextureFaceLayer_active_render_set"); + RNA_def_property_boolean_funcs(prop, "rna_MeshTextureFaceLayer_active_render_get", + "rna_MeshTextureFaceLayer_active_render_set"); RNA_def_property_ui_text(prop, "Active Render", "Sets the layer as active for rendering"); RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); @@ -1405,7 +1407,9 @@ static void rna_def_mtface(BlenderRNA *brna) prop= RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE); RNA_def_property_struct_type(prop, "MeshTextureFace"); RNA_def_property_ui_text(prop, "Data", ""); - RNA_def_property_collection_funcs(prop, "rna_MeshTextureFaceLayer_data_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_get", "rna_MeshTextureFaceLayer_data_length", 0, 0); + RNA_def_property_collection_funcs(prop, "rna_MeshTextureFaceLayer_data_begin", "rna_iterator_array_next", + "rna_iterator_array_end", "rna_iterator_array_get", + "rna_MeshTextureFaceLayer_data_length", 0, 0); srna= RNA_def_struct(brna, "MeshTextureFace", NULL); RNA_def_struct_sdna(srna, "MTFace"); @@ -1480,7 +1484,8 @@ static void rna_def_mtface(BlenderRNA *brna) prop= RNA_def_property(srna, "use_alpha_sort", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "mode", TF_ALPHASORT); - RNA_def_property_ui_text(prop, "Alpha Sort", "Enable sorting of faces for correct alpha drawing (slow, use Clip Alpha instead when possible)"); + RNA_def_property_ui_text(prop, "Alpha Sort", + "Enable sorting of faces for correct alpha drawing (slow, use Clip Alpha instead when possible)"); RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); prop= RNA_def_property(srna, "blend_type", PROP_ENUM, PROP_NONE); @@ -1589,7 +1594,9 @@ static void rna_def_mcol(BlenderRNA *brna) prop= RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE); RNA_def_property_struct_type(prop, "MeshColor"); RNA_def_property_ui_text(prop, "Data", ""); - RNA_def_property_collection_funcs(prop, "rna_MeshColorLayer_data_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_get", "rna_MeshColorLayer_data_length", 0, 0); + RNA_def_property_collection_funcs(prop, "rna_MeshColorLayer_data_begin", "rna_iterator_array_next", + "rna_iterator_array_end", "rna_iterator_array_get", + "rna_MeshColorLayer_data_length", 0, 0); srna= RNA_def_struct(brna, "MeshColor", NULL); RNA_def_struct_sdna(srna, "MCol"); @@ -1644,7 +1651,9 @@ static void rna_def_mproperties(BlenderRNA *brna) prop= RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE); RNA_def_property_struct_type(prop, "MeshFloatProperty"); RNA_def_property_ui_text(prop, "Data", ""); - RNA_def_property_collection_funcs(prop, "rna_MeshFloatPropertyLayer_data_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_get", "rna_MeshFloatPropertyLayer_data_length", 0, 0); + RNA_def_property_collection_funcs(prop, "rna_MeshFloatPropertyLayer_data_begin", "rna_iterator_array_next", + "rna_iterator_array_end", "rna_iterator_array_get", + "rna_MeshFloatPropertyLayer_data_length", 0, 0); srna= RNA_def_struct(brna, "MeshFloatProperty", NULL); RNA_def_struct_sdna(srna, "MFloatProperty"); @@ -1670,7 +1679,9 @@ static void rna_def_mproperties(BlenderRNA *brna) prop= RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE); RNA_def_property_struct_type(prop, "MeshIntProperty"); RNA_def_property_ui_text(prop, "Data", ""); - RNA_def_property_collection_funcs(prop, "rna_MeshIntPropertyLayer_data_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_get", "rna_MeshIntPropertyLayer_data_length", 0, 0); + RNA_def_property_collection_funcs(prop, "rna_MeshIntPropertyLayer_data_begin", "rna_iterator_array_next", + "rna_iterator_array_end", "rna_iterator_array_get", + "rna_MeshIntPropertyLayer_data_length", 0, 0); srna= RNA_def_struct(brna, "MeshIntProperty", NULL); RNA_def_struct_sdna(srna, "MIntProperty"); @@ -1696,7 +1707,9 @@ static void rna_def_mproperties(BlenderRNA *brna) prop= RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE); RNA_def_property_struct_type(prop, "MeshStringProperty"); RNA_def_property_ui_text(prop, "Data", ""); - RNA_def_property_collection_funcs(prop, "rna_MeshStringPropertyLayer_data_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_get", "rna_MeshStringPropertyLayer_data_length", 0, 0); + RNA_def_property_collection_funcs(prop, "rna_MeshStringPropertyLayer_data_begin", "rna_iterator_array_next", + "rna_iterator_array_end", "rna_iterator_array_get", + "rna_MeshStringPropertyLayer_data_length", 0, 0); srna= RNA_def_struct(brna, "MeshStringProperty", NULL); RNA_def_struct_sdna(srna, "MStringProperty"); @@ -1853,7 +1866,8 @@ static void rna_def_uv_textures(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); prop= RNA_def_property(srna, "active_index", PROP_INT, PROP_UNSIGNED); - RNA_def_property_int_funcs(prop, "rna_Mesh_active_uv_texture_index_get", "rna_Mesh_active_uv_texture_index_set", "rna_Mesh_active_uv_texture_index_range"); + RNA_def_property_int_funcs(prop, "rna_Mesh_active_uv_texture_index_get", + "rna_Mesh_active_uv_texture_index_set", "rna_Mesh_active_uv_texture_index_range"); RNA_def_property_ui_text(prop, "Active UV Texture Index", "Active UV texture index"); RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); } @@ -1911,7 +1925,8 @@ static void rna_def_mesh(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Clone UV Texture", "UV texture to be used as cloning source"); prop= RNA_def_property(srna, "uv_texture_clone_index", PROP_INT, PROP_UNSIGNED); - RNA_def_property_int_funcs(prop, "rna_Mesh_uv_texture_clone_index_get", "rna_Mesh_uv_texture_clone_index_set", "rna_Mesh_active_uv_texture_index_range"); + RNA_def_property_int_funcs(prop, "rna_Mesh_uv_texture_clone_index_get", + "rna_Mesh_uv_texture_clone_index_set", "rna_Mesh_active_uv_texture_index_range"); RNA_def_property_ui_text(prop, "Clone UV Texture Index", "Clone UV texture index"); prop= RNA_def_property(srna, "uv_texture_stencil", PROP_POINTER, PROP_UNSIGNED); @@ -1953,7 +1968,9 @@ static void rna_def_mesh(BlenderRNA *brna) prop= RNA_def_property(srna, "use_auto_smooth", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", ME_AUTOSMOOTH); - RNA_def_property_ui_text(prop, "Auto Smooth", "Treats all set-smoothed faces with angles less than the specified angle as 'smooth' during render"); + RNA_def_property_ui_text(prop, "Auto Smooth", + "Treat all set-smoothed faces with angles less than the " + "specified angle as 'smooth' during render"); #if 1 /* expose as radians */ prop= RNA_def_property(srna, "auto_smooth_angle", PROP_FLOAT, PROP_ANGLE); @@ -1964,7 +1981,8 @@ static void rna_def_mesh(BlenderRNA *brna) RNA_def_property_int_sdna(prop, NULL, "smoothresh"); RNA_def_property_range(prop, 1, 80); #endif - RNA_def_property_ui_text(prop, "Auto Smooth Angle", "Defines maximum angle between face normals that 'Auto Smooth' will operate on"); + RNA_def_property_ui_text(prop, "Auto Smooth Angle", + "Maximum angle between face normals that 'Auto Smooth' will operate on"); prop= RNA_def_property(srna, "show_double_sided", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", ME_TWOSIDED); @@ -1983,7 +2001,8 @@ static void rna_def_mesh(BlenderRNA *brna) /* texture space */ prop= RNA_def_property(srna, "use_auto_texspace", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "texflag", AUTOSPACE); - RNA_def_property_ui_text(prop, "Auto Texture Space", "Adjusts active object's texture space automatically when transforming object"); + RNA_def_property_ui_text(prop, "Auto Texture Space", + "Adjust active object's texture space automatically when transforming object"); RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Mesh_texspace_set"); prop= RNA_def_property(srna, "texspace_location", PROP_FLOAT, PROP_TRANSLATION); @@ -2018,62 +2037,66 @@ static void rna_def_mesh(BlenderRNA *brna) prop= RNA_def_property(srna, "show_edges", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "drawflag", ME_DRAWEDGES); - RNA_def_property_ui_text(prop, "Draw Edges", "Displays selected edges using highlights in the 3D view and UV editor"); + RNA_def_property_ui_text(prop, "Draw Edges", "Display selected edges using highlights in the 3D view and UV editor"); RNA_def_property_update(prop, 0, "rna_Mesh_update_draw"); prop= RNA_def_property(srna, "show_all_edges", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "drawflag", ME_ALLEDGES); - RNA_def_property_ui_text(prop, "All Edges", "Displays all edges for wireframe in all view modes in the 3D view"); + RNA_def_property_ui_text(prop, "All Edges", "Display all edges for wireframe in all view modes in the 3D view"); RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL); prop= RNA_def_property(srna, "show_faces", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "drawflag", ME_DRAWFACES); - RNA_def_property_ui_text(prop, "Draw Faces", "Displays all faces as shades in the 3D view and UV editor"); + RNA_def_property_ui_text(prop, "Draw Faces", "Display all faces as shades in the 3D view and UV editor"); RNA_def_property_update(prop, 0, "rna_Mesh_update_draw"); prop= RNA_def_property(srna, "show_normal_face", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "drawflag", ME_DRAWNORMALS); - RNA_def_property_ui_text(prop, "Draw Normals", "Displays face normals as lines"); + RNA_def_property_ui_text(prop, "Draw Normals", "Display face normals as lines"); RNA_def_property_update(prop, 0, "rna_Mesh_update_draw"); prop= RNA_def_property(srna, "show_normal_vertex", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "drawflag", ME_DRAW_VNORMALS); - RNA_def_property_ui_text(prop, "Draw Vertex Normals", "Displays vertex normals as lines"); + RNA_def_property_ui_text(prop, "Draw Vertex Normals", "Display vertex normals as lines"); RNA_def_property_update(prop, 0, "rna_Mesh_update_draw"); prop= RNA_def_property(srna, "show_edge_crease", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "drawflag", ME_DRAWCREASES); - RNA_def_property_ui_text(prop, "Draw Creases", "Displays creases created for subsurf weighting"); + RNA_def_property_ui_text(prop, "Draw Creases", "Display creases created for subsurf weighting"); RNA_def_property_update(prop, 0, "rna_Mesh_update_draw"); prop= RNA_def_property(srna, "show_edge_bevel_weight", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "drawflag", ME_DRAWBWEIGHTS); - RNA_def_property_ui_text(prop, "Draw Bevel Weights", "Displays weights created for the Bevel modifier"); + RNA_def_property_ui_text(prop, "Draw Bevel Weights", "Display weights created for the Bevel modifier"); RNA_def_property_update(prop, 0, "rna_Mesh_update_draw"); prop= RNA_def_property(srna, "show_edge_seams", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "drawflag", ME_DRAWSEAMS); - RNA_def_property_ui_text(prop, "Draw Seams", "Displays UV unwrapping seams"); + RNA_def_property_ui_text(prop, "Draw Seams", "Display UV unwrapping seams"); RNA_def_property_update(prop, 0, "rna_Mesh_update_draw"); prop= RNA_def_property(srna, "show_edge_sharp", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "drawflag", ME_DRAWSHARP); - RNA_def_property_ui_text(prop, "Draw Sharp", "Displays sharp edges, used with the EdgeSplit modifier"); + RNA_def_property_ui_text(prop, "Draw Sharp", "Display sharp edges, used with the EdgeSplit modifier"); RNA_def_property_update(prop, 0, "rna_Mesh_update_draw"); prop= RNA_def_property(srna, "show_extra_edge_length", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "drawflag", ME_DRAWEXTRA_EDGELEN); - RNA_def_property_ui_text(prop, "Edge Length", "Displays selected edge lengths, Using global values when set in the transform panel"); + RNA_def_property_ui_text(prop, "Edge Length", + "Display selected edge lengths, using global values when set in the transform panel"); RNA_def_property_update(prop, 0, "rna_Mesh_update_draw"); prop= RNA_def_property(srna, "show_extra_face_angle", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "drawflag", ME_DRAWEXTRA_FACEANG); - RNA_def_property_ui_text(prop, "Faces Angles", "Displays the angles in the selected edges in degrees, Using global values when set in the transform panel"); + RNA_def_property_ui_text(prop, "Faces Angles", + "Display the angles between the selected edges in degrees, using " + "global values when set in the transform panel"); RNA_def_property_update(prop, 0, "rna_Mesh_update_draw"); prop= RNA_def_property(srna, "show_extra_face_area", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "drawflag", ME_DRAWEXTRA_FACEAREA); - RNA_def_property_ui_text(prop, "Face Area", "Displays the area of selected faces, Using global values when set in the transform panel"); + RNA_def_property_ui_text(prop, "Face Area", + "Display the area of selected faces, using global values when set in the transform panel"); RNA_def_property_update(prop, 0, "rna_Mesh_update_draw"); /* editflag */ @@ -2093,7 +2116,8 @@ static void rna_def_mesh(BlenderRNA *brna) prop= RNA_def_property(srna, "use_mirror_topology", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "editflag", ME_EDIT_MIRROR_TOPO); - RNA_def_property_ui_text(prop, "Topology Mirror", "Use topology based mirroring. For when both sides of mesh have matching, unique topology"); + RNA_def_property_ui_text(prop, "Topology Mirror", + "Use topology based mirroring (for when both sides of mesh have matching, unique topology)"); prop= RNA_def_property(srna, "use_paint_mask", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "editflag", ME_EDIT_PAINT_MASK); diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c index 720fea682ce..6c273ff9f2e 100644 --- a/source/blender/makesrna/intern/rna_object.c +++ b/source/blender/makesrna/intern/rna_object.c @@ -1760,9 +1760,9 @@ static void rna_def_object(BlenderRNA *brna) static EnumPropertyItem drawtype_items[] = { {OB_BOUNDBOX, "BOUNDS", 0, "Bounds", "Draw the bounding box of the object"}, {OB_WIRE, "WIRE", 0, "Wire", "Draw the object as a wireframe"}, - {OB_SOLID, "SOLID", 0, "Solid", "Draw the object as a solid (If solid drawing is enabled in the viewport)"}, + {OB_SOLID, "SOLID", 0, "Solid", "Draw the object as a solid (if solid drawing is enabled in the viewport)"}, // disabled {OB_SHADED, "SHADED", 0, "Shaded", ""}, - {OB_TEXTURE, "TEXTURED", 0, "Textured", "Draw the object with textures (If textures are enabled in the viewport)"}, + {OB_TEXTURE, "TEXTURED", 0, "Textured", "Draw the object with textures (if textures are enabled in the viewport)"}, {0, NULL, 0, NULL, NULL}}; static EnumPropertyItem boundtype_items[] = { @@ -1785,13 +1785,13 @@ static void rna_def_object(BlenderRNA *brna) // XXX: this RNA enum define is currently duplicated for objects, since there is some text here which is not applicable static EnumPropertyItem prop_rotmode_items[] = { {ROT_MODE_QUAT, "QUATERNION", 0, "Quaternion (WXYZ)", "No Gimbal Lock"}, - {ROT_MODE_XYZ, "XYZ", 0, "XYZ Euler", "XYZ Rotation Order. Prone to Gimbal Lock. (Default)"}, - {ROT_MODE_XZY, "XZY", 0, "XZY Euler", "XZY Rotation Order. Prone to Gimbal Lock"}, - {ROT_MODE_YXZ, "YXZ", 0, "YXZ Euler", "YXZ Rotation Order. Prone to Gimbal Lock"}, - {ROT_MODE_YZX, "YZX", 0, "YZX Euler", "YZX Rotation Order. Prone to Gimbal Lock"}, - {ROT_MODE_ZXY, "ZXY", 0, "ZXY Euler", "ZXY Rotation Order. Prone to Gimbal Lock"}, - {ROT_MODE_ZYX, "ZYX", 0, "ZYX Euler", "ZYX Rotation Order. Prone to Gimbal Lock"}, - {ROT_MODE_AXISANGLE, "AXIS_ANGLE", 0, "Axis Angle", "Axis Angle (W+XYZ). Defines a rotation around some axis defined by 3D-Vector"}, + {ROT_MODE_XYZ, "XYZ", 0, "XYZ Euler", "XYZ Rotation Order - prone to Gimbal Lock (default)"}, + {ROT_MODE_XZY, "XZY", 0, "XZY Euler", "XZY Rotation Order - prone to Gimbal Lock"}, + {ROT_MODE_YXZ, "YXZ", 0, "YXZ Euler", "YXZ Rotation Order - prone to Gimbal Lock"}, + {ROT_MODE_YZX, "YZX", 0, "YZX Euler", "YZX Rotation Order - prone to Gimbal Lock"}, + {ROT_MODE_ZXY, "ZXY", 0, "ZXY Euler", "ZXY Rotation Order - prone to Gimbal Lock"}, + {ROT_MODE_ZYX, "ZYX", 0, "ZYX Euler", "ZYX Rotation Order - prone to Gimbal Lock"}, + {ROT_MODE_AXISANGLE, "AXIS_ANGLE", 0, "Axis Angle", "Axis Angle (W+XYZ), defines a rotation around some axis defined by 3D-Vector"}, {0, NULL, 0, NULL, NULL}}; static float default_quat[4] = {1,0,0,0}; /* default quaternion values */ @@ -1841,8 +1841,8 @@ static void rna_def_object(BlenderRNA *brna) RNA_def_property_multi_array(prop, 2, boundbox_dimsize); RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_float_funcs(prop, "rna_Object_boundbox_get", NULL, NULL); - RNA_def_property_ui_text(prop, "Bound Box", - "Objects bound box in object-space coordinates, all values are -1.0 when not available"); + RNA_def_property_ui_text(prop, "Bounding Box", + "Object's bounding box in object-space coordinates, all values are -1.0 when not available"); /* parent */ prop= RNA_def_property(srna, "parent", PROP_POINTER, PROP_NONE); @@ -1861,7 +1861,7 @@ static void rna_def_object(BlenderRNA *brna) prop= RNA_def_property(srna, "parent_vertices", PROP_INT, PROP_UNSIGNED); RNA_def_property_int_sdna(prop, NULL, "par1"); RNA_def_property_array(prop, 3); - RNA_def_property_ui_text(prop, "Parent Vertices", "Indices of vertices in cases of a vertex parenting relation"); + RNA_def_property_ui_text(prop, "Parent Vertices", "Indices of vertices in case of a vertex parenting relation"); RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_internal_update"); prop= RNA_def_property(srna, "parent_bone", PROP_STRING, PROP_NONE); @@ -2123,13 +2123,13 @@ static void rna_def_object(BlenderRNA *brna) RNA_def_property_pointer_sdna(prop, NULL, "pd"); RNA_def_property_struct_type(prop, "FieldSettings"); RNA_def_property_pointer_funcs(prop, "rna_Object_field_get", NULL, NULL, NULL); - RNA_def_property_ui_text(prop, "Field Settings", "Settings for using the objects as a field in physics simulation"); + RNA_def_property_ui_text(prop, "Field Settings", "Settings for using the object as a field in physics simulation"); prop= RNA_def_property(srna, "collision", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "pd"); RNA_def_property_struct_type(prop, "CollisionSettings"); RNA_def_property_pointer_funcs(prop, "rna_Object_collision_get", NULL, NULL, NULL); - RNA_def_property_ui_text(prop, "Collision Settings", "Settings for using the objects as a collider in physics simulation"); + RNA_def_property_ui_text(prop, "Collision Settings", "Settings for using the object as a collider in physics simulation"); prop= RNA_def_property(srna, "soft_body", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "soft"); -- cgit v1.2.3 From 8247bf6fa68bec20a76e613f77f3b49c3194ace8 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 24 Sep 2011 11:10:53 +0000 Subject: svn merge ^/branches/bmesh/blender -r40512:40513 --- source/blender/editors/space_view3d/view3d_view.c | 28 +++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) (limited to 'source') diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c index 8227ba87021..df4f615e5f1 100644 --- a/source/blender/editors/space_view3d/view3d_view.c +++ b/source/blender/editors/space_view3d/view3d_view.c @@ -713,7 +713,7 @@ void view3d_unproject(bglMats *mats, float out[3], const short x, const short y, } #endif -/* use above call to get projecting mat */ +/* use view3d_get_object_project_mat to get projecting mat */ void ED_view3d_project_float(ARegion *ar, const float vec[3], float adr[2], float mat[4][4]) { float vec4[4]; @@ -732,6 +732,26 @@ void ED_view3d_project_float(ARegion *ar, const float vec[3], float adr[2], floa } } +/* use view3d_get_object_project_mat to get projecting mat */ +void ED_view3d_project_float_v3(ARegion *ar, float *vec, float *adr, float mat[4][4]) +{ + float vec4[4]; + + copy_v3_v3(vec4, vec); + vec4[3]= 1.0; + adr[0]= IS_CLIPPED; + + mul_m4_v4(mat, vec4); + + if( vec4[3]>FLT_EPSILON ) { + adr[0] = (float)(ar->winx/2.0f)+(ar->winx/2.0f)*vec4[0]/vec4[3]; + adr[1] = (float)(ar->winy/2.0f)+(ar->winy/2.0f)*vec4[1]/vec4[3]; + adr[2] = vec4[2]/vec4[3]; + } else { + adr[0] = adr[1] = adr[2] = 0.0f; + } +} + int ED_view3d_boundbox_clip(RegionView3D *rv3d, float obmat[][4], BoundBox *bb) { /* return 1: draw */ @@ -803,9 +823,9 @@ void project_int(ARegion *ar, const float vec[3], int adr[2]) RegionView3D *rv3d= ar->regiondata; float fx, fy, vec4[4]; - adr[0]= (int)2140000000.0f; copy_v3_v3(vec4, vec); vec4[3]= 1.0; + adr[0]= (int)2140000000.0f; mul_m4_v4(rv3d->persmat, vec4); @@ -851,9 +871,9 @@ void project_short_noclip(ARegion *ar, const float vec[3], short adr[2]) RegionView3D *rv3d= ar->regiondata; float fx, fy, vec4[4]; - adr[0]= IS_CLIPPED; copy_v3_v3(vec4, vec); vec4[3]= 1.0; + adr[0]= IS_CLIPPED; mul_m4_v4(rv3d->persmat, vec4); @@ -877,9 +897,9 @@ void project_float(ARegion *ar, const float vec[3], float adr[2]) RegionView3D *rv3d= ar->regiondata; float vec4[4]; - adr[0]= IS_CLIPPED; copy_v3_v3(vec4, vec); vec4[3]= 1.0; + adr[0]= IS_CLIPPED; mul_m4_v4(rv3d->persmat, vec4); -- cgit v1.2.3 From e63c124e2bbb6725d513dd8e06795b8a9ec90139 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 24 Sep 2011 11:24:34 +0000 Subject: fix [#28736] FaceMask crash on Weight Paint --- source/blender/editors/space_view3d/drawmesh.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'source') diff --git a/source/blender/editors/space_view3d/drawmesh.c b/source/blender/editors/space_view3d/drawmesh.c index bf4bd7f1d93..546e5ccba5d 100644 --- a/source/blender/editors/space_view3d/drawmesh.c +++ b/source/blender/editors/space_view3d/drawmesh.c @@ -517,10 +517,8 @@ static int wpaint__setSolidDrawOptions(void *userData, int index, int *drawSmoot { Mesh *me = (Mesh*)userData; - if (me->mface) { - short matnr= me->mface[index].mat_nr; - Material *ma= me->mat[matnr]; - + if (me->mat && me->mface) { + Material *ma= me->mat[me->mface[index].mat_nr]; if (ma && (ma->game.flag & GEMAT_INVISIBLE)) { return 0; } -- cgit v1.2.3 From cb6255fdf84aa54a63c607aabeaa092962c11cdc Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 24 Sep 2011 14:34:24 +0000 Subject: edits to internal renderer - no functional changes. - move some larger vars into a nested scope. - replace memset with zero initializer. - rempace VECCOPY macros with copy_v3v3 - change function args to give the float array length. --- source/blender/render/intern/include/rendercore.h | 12 +- source/blender/render/intern/include/shading.h | 4 +- .../blender/render/intern/source/convertblender.c | 10 +- source/blender/render/intern/source/envmap.c | 6 +- source/blender/render/intern/source/rayshade.c | 241 +++++++++++---------- source/blender/render/intern/source/rendercore.c | 2 +- source/blender/render/intern/source/shadeinput.c | 6 +- source/blender/render/intern/source/shadeoutput.c | 50 +++-- source/blender/render/intern/source/strand.c | 4 +- source/blender/render/intern/source/zbuf.c | 9 +- 10 files changed, 178 insertions(+), 166 deletions(-) (limited to 'source') diff --git a/source/blender/render/intern/include/rendercore.h b/source/blender/render/intern/include/rendercore.h index f9486b5d5c0..7f804c9311d 100644 --- a/source/blender/render/intern/include/rendercore.h +++ b/source/blender/render/intern/include/rendercore.h @@ -76,12 +76,12 @@ typedef struct PixStrMain void calc_view_vector(float *view, float x, float y); -float mistfactor(float zcor, float *co); /* dist and height, return alpha */ +float mistfactor(float zcor, const float co[3]); /* dist and height, return alpha */ -void renderspothalo(struct ShadeInput *shi, float *col, float alpha); +void renderspothalo(struct ShadeInput *shi, float col[4], float alpha); void add_halo_flare(Render *re); -void calc_renderco_zbuf(float co[3], float *view, int z); +void calc_renderco_zbuf(float co[3], const float view[3], int z); void calc_renderco_ortho(float co[3], float x, float y, int z); int count_mask(unsigned short mask); @@ -103,9 +103,9 @@ extern void freeraytree(Render *re); extern void makeraytree(Render *re); struct RayObject* makeraytree_object(Render *re, ObjectInstanceRen *obi); -extern void ray_shadow(ShadeInput *, LampRen *, float *); -extern void ray_trace(ShadeInput *, ShadeResult *); -extern void ray_ao(ShadeInput *, float *, float *); +extern void ray_shadow(ShadeInput *shi, LampRen *lar, float shadfac[4]); +extern void ray_trace(ShadeInput *shi, ShadeResult *); +extern void ray_ao(ShadeInput *shi, float ao[3], float env[3]); extern void init_jitter_plane(LampRen *lar); extern void init_ao_sphere(struct World *wrld); extern void init_render_qmcsampler(Render *re); diff --git a/source/blender/render/intern/include/shading.h b/source/blender/render/intern/include/shading.h index 91507ef3f98..df5578dad7a 100644 --- a/source/blender/render/intern/include/shading.h +++ b/source/blender/render/intern/include/shading.h @@ -96,8 +96,8 @@ void ambient_occlusion(struct ShadeInput *shi); void environment_lighting_apply(struct ShadeInput *shi, struct ShadeResult *shr); ListBase *get_lights(struct ShadeInput *shi); -float lamp_get_visibility(struct LampRen *lar, const float co[3], float *lv, float *dist); -void lamp_get_shadow(struct LampRen *lar, ShadeInput *shi, float inp, float *shadfac, int do_real); +float lamp_get_visibility(struct LampRen *lar, const float co[3], float lv[3], float *dist); +void lamp_get_shadow(struct LampRen *lar, ShadeInput *shi, float inp, float shadfac[4], int do_real); float fresnel_fac(float *view, float *vn, float fresnel, float fac); diff --git a/source/blender/render/intern/source/convertblender.c b/source/blender/render/intern/source/convertblender.c index a15662f86f4..27c825ebdeb 100644 --- a/source/blender/render/intern/source/convertblender.c +++ b/source/blender/render/intern/source/convertblender.c @@ -5304,11 +5304,13 @@ static void calculate_speedvector(const float vectors[2], int step, float winsq, static float *calculate_strandsurface_speedvectors(Render *re, ObjectInstanceRen *obi, StrandSurface *mesh) { - float winsq= (float)re->winx*(float)re->winy, winroot= sqrt(winsq), (*winspeed)[4]; /* int's can wrap on large images */ - float ho[4], prevho[4], nextho[4], winmat[4][4], vec[2]; - int a; - if(mesh->co && mesh->prevco && mesh->nextco) { + float winsq= (float)re->winx*(float)re->winy; /* int's can wrap on large images */ + float winroot= sqrt(winsq); + float (*winspeed)[4]; + float ho[4], prevho[4], nextho[4], winmat[4][4], vec[2]; + int a; + if(obi->flag & R_TRANSFORMED) mul_m4_m4m4(winmat, obi->mat, re->winmat); else diff --git a/source/blender/render/intern/source/envmap.c b/source/blender/render/intern/source/envmap.c index e2b3b23b9c9..25895b81dd7 100644 --- a/source/blender/render/intern/source/envmap.c +++ b/source/blender/render/intern/source/envmap.c @@ -689,9 +689,9 @@ int envmaptex(Tex *tex, float *texvec, float *dxt, float *dyt, int osatex, TexRe env->ima= tex->ima; if(env->ima && env->ima->ok) { if(env->cube[1]==NULL) { - ImBuf *ibuf= BKE_image_get_ibuf(env->ima, NULL); - if(ibuf) - envmap_split_ima(env, ibuf); + ImBuf *ibuf_ima= BKE_image_get_ibuf(env->ima, NULL); + if(ibuf_ima) + envmap_split_ima(env, ibuf_ima); else env->ok= 0; } diff --git a/source/blender/render/intern/source/rayshade.c b/source/blender/render/intern/source/rayshade.c index e82e969d502..8fa90a51442 100644 --- a/source/blender/render/intern/source/rayshade.c +++ b/source/blender/render/intern/source/rayshade.c @@ -334,7 +334,6 @@ static void makeraytree_single(Render *re) for(obi=re->instancetable.first; obi; obi=obi->next) if(is_raytraceable(re, obi)) { - int v; ObjectRen *obr = obi->obr; obs++; @@ -344,6 +343,7 @@ static void makeraytree_single(Render *re) } else { + int v; for(v=0;vtotvlak;v++) { VlakRen *vlr = obr->vlaknodes[v>>8].vlak + (v&255); @@ -539,7 +539,7 @@ void shade_ray(Isect *is, ShadeInput *shi, ShadeResult *shr) VlakRen *vlr= (VlakRen*)is->hit.face; /* set up view vector */ - VECCOPY(shi->view, is->dir); + copy_v3_v3(shi->view, is->dir); /* render co */ shi->co[0]= is->start[0]+is->dist*(shi->view[0]); @@ -594,16 +594,16 @@ void shade_ray(Isect *is, ShadeInput *shi, ShadeResult *shr) } /* raytrace likes to separate the spec color */ - VECSUB(shr->diff, shr->combined, shr->spec); + sub_v3_v3v3(shr->diff, shr->combined, shr->spec); } } -static int refraction(float *refract, float *n, float *view, float index) +static int refraction(float refract[3], const float n[3], const float view[3], float index) { float dot, fac; - VECCOPY(refract, view); + copy_v3_v3(refract, view); dot= view[0]*n[0] + view[1]*n[1] + view[2]*n[2]; @@ -626,26 +626,26 @@ static int refraction(float *refract, float *n, float *view, float index) return 1; } +static void reflection_simple(float ref[3], float n[3], const float view[3]) +{ + const float f1= -2.0f * dot_v3v3(n, view); + madd_v3_v3v3fl(ref, view, n, f1); +} + /* orn = original face normal */ -static void reflection(float *ref, float *n, float *view, float *orn) +static void reflection(float ref[3], float n[3], const float view[3], const float orn[3]) { float f1; - - f1= -2.0f*(n[0]*view[0]+ n[1]*view[1]+ n[2]*view[2]); - - ref[0]= (view[0]+f1*n[0]); - ref[1]= (view[1]+f1*n[1]); - ref[2]= (view[2]+f1*n[2]); - if(orn) { - /* test phong normals, then we should prevent vector going to the back */ - f1= ref[0]*orn[0]+ ref[1]*orn[1]+ ref[2]*orn[2]; - if(f1>0.0f) { - f1+= .01f; - ref[0]-= f1*orn[0]; - ref[1]-= f1*orn[1]; - ref[2]-= f1*orn[2]; - } + reflection_simple(ref, n, view); + + /* test phong normals, then we should prevent vector going to the back */ + f1= dot_v3v3(ref, orn); + if(f1>0.0f) { + f1+= 0.01f; + ref[0]-= f1*orn[0]; + ref[1]-= f1*orn[1]; + ref[2]-= f1*orn[2]; } } @@ -672,8 +672,7 @@ static void color_combine(float *result, float fac1, float fac2, float *col1, fl static float shade_by_transmission(Isect *is, ShadeInput *shi, ShadeResult *shr) { - float dx, dy, dz, d, p; - + float d; if (0 == (shi->mat->mode & MA_TRANSP)) return -1; @@ -681,10 +680,12 @@ static float shade_by_transmission(Isect *is, ShadeInput *shi, ShadeResult *shr) d= 1.0f; } else { + float p; + /* shi.co[] calculated by shade_ray() */ - dx= shi->co[0] - is->start[0]; - dy= shi->co[1] - is->start[1]; - dz= shi->co[2] - is->start[2]; + const float dx= shi->co[0] - is->start[0]; + const float dy= shi->co[1] - is->start[1]; + const float dz= shi->co[2] - is->start[2]; d= sqrt(dx*dx+dy*dy+dz*dz); if (d > shi->mat->tx_limit) d= shi->mat->tx_limit; @@ -701,13 +702,13 @@ static float shade_by_transmission(Isect *is, ShadeInput *shi, ShadeResult *shr) return d; } -static void ray_fadeout_endcolor(float *col, ShadeInput *origshi, ShadeInput *shi, ShadeResult *shr, Isect *isec, float *vec) +static void ray_fadeout_endcolor(float col[3], ShadeInput *origshi, ShadeInput *shi, ShadeResult *shr, Isect *isec, const float vec[3]) { /* un-intersected rays get either rendered material color or sky color */ if (origshi->mat->fadeto_mir == MA_RAYMIR_FADETOMAT) { - VECCOPY(col, shr->combined); + copy_v3_v3(col, shr->combined); } else if (origshi->mat->fadeto_mir == MA_RAYMIR_FADETOSKY) { - VECCOPY(shi->view, vec); + copy_v3_v3(shi->view, vec); normalize_v3(shi->view); shadeSkyView(col, isec->start, shi->view, NULL, shi->thread); @@ -715,7 +716,7 @@ static void ray_fadeout_endcolor(float *col, ShadeInput *origshi, ShadeInput *sh } } -static void ray_fadeout(Isect *is, ShadeInput *shi, float *col, float *blendcol, float dist_mir) +static void ray_fadeout(Isect *is, ShadeInput *shi, float col[3], const float blendcol[3], float dist_mir) { /* if fading out, linear blend against fade color */ float blendfac; @@ -729,14 +730,14 @@ static void ray_fadeout(Isect *is, ShadeInput *shi, float *col, float *blendcol, /* the main recursive tracer itself * note: 'col' must be initialized */ -static void traceray(ShadeInput *origshi, ShadeResult *origshr, short depth, float *start, float *dir, float *col, ObjectInstanceRen *obi, VlakRen *vlr, int traflag) +static void traceray(ShadeInput *origshi, ShadeResult *origshr, short depth, const float start[3], const float dir[3], float col[4], ObjectInstanceRen *obi, VlakRen *vlr, int traflag) { ShadeInput shi= {0}; Isect isec; float dist_mir = origshi->mat->dist_mir; - VECCOPY(isec.start, start); - VECCOPY(isec.dir, dir ); + copy_v3_v3(isec.start, start); + copy_v3_v3(isec.dir, dir ); isec.dist = dist_mir > 0 ? dist_mir : RE_RAYTRACE_MAXDIST; isec.mode= RE_RAY_MIRROR; isec.check = RE_CHECK_VLR_RENDER; @@ -752,8 +753,8 @@ static void traceray(ShadeInput *origshi, ShadeResult *origshr, short depth, flo float d= 1.0f; /* for as long we don't have proper dx/dy transform for rays we copy over original */ - VECCOPY(shi.dxco, origshi->dxco); - VECCOPY(shi.dyco, origshi->dyco); + copy_v3_v3(shi.dxco, origshi->dxco); + copy_v3_v3(shi.dyco, origshi->dyco); shi.mask= origshi->mask; shi.osatex= origshi->osatex; @@ -845,7 +846,7 @@ static void traceray(ShadeInput *origshi, ShadeResult *origshr, short depth, flo float mircol[4]; float ref[3]; - reflection(ref, shi.vn, shi.view, NULL); + reflection_simple(ref, shi.vn, shi.view); traceray(origshi, origshr, depth-1, shi.co, ref, mircol, shi.obi, shi.vlr, 0); f1= 1.0f-f; @@ -896,7 +897,7 @@ static void traceray(ShadeInput *origshi, ShadeResult *origshr, short depth, flo /* calc distributed planar energy */ -static void DP_energy(float *table, float *vec, int tot, float xsize, float ysize) +static void DP_energy(float *table, float vec[2], int tot, float xsize, float ysize) { int x, y, a; float *fp, force[3], result[3]; @@ -950,7 +951,7 @@ static void jitter_plane_offset(float *jitter1, float *jitter2, int tot, float s void init_jitter_plane(LampRen *lar) { float *fp; - int x, iter=12, tot= lar->ray_totsamp; + int x, tot= lar->ray_totsamp; /* test if already initialized */ if(lar->jitter) return; @@ -962,7 +963,8 @@ void init_jitter_plane(LampRen *lar) /* if 1 sample, we leave table to be zero's */ if(tot>1) { - + int iter=12; + /* set per-lamp fixed seed */ BLI_srandom(tot); @@ -1125,7 +1127,7 @@ static void QMC_getSample(double *s, QMCSampler *qsa, int thread, int num) } /* phong weighted disc using 'blur' for exponent, centred on 0,0 */ -static void QMC_samplePhong(float *vec, QMCSampler *qsa, int thread, int num, float blur) +static void QMC_samplePhong(float vec[3], QMCSampler *qsa, int thread, int num, float blur) { double s[2]; float phi, pz, sqr; @@ -1142,7 +1144,7 @@ static void QMC_samplePhong(float *vec, QMCSampler *qsa, int thread, int num, fl } /* rect of edge lengths sizex, sizey, centred on 0.0,0.0 i.e. ranging from -sizex/2 to +sizey/2 */ -static void QMC_sampleRect(float *vec, QMCSampler *qsa, int thread, int num, float sizex, float sizey) +static void QMC_sampleRect(float vec[3], QMCSampler *qsa, int thread, int num, float sizex, float sizey) { double s[2]; @@ -1154,7 +1156,7 @@ static void QMC_sampleRect(float *vec, QMCSampler *qsa, int thread, int num, flo } /* disc of radius 'radius', centred on 0,0 */ -static void QMC_sampleDisc(float *vec, QMCSampler *qsa, int thread, int num, float radius) +static void QMC_sampleDisc(float vec[3], QMCSampler *qsa, int thread, int num, float radius) { double s[2]; float phi, sqr; @@ -1170,7 +1172,7 @@ static void QMC_sampleDisc(float *vec, QMCSampler *qsa, int thread, int num, flo } /* uniform hemisphere sampling */ -static void QMC_sampleHemi(float *vec, QMCSampler *qsa, int thread, int num) +static void QMC_sampleHemi(float vec[3], QMCSampler *qsa, int thread, int num) { double s[2]; float phi, sqr; @@ -1187,7 +1189,7 @@ static void QMC_sampleHemi(float *vec, QMCSampler *qsa, int thread, int num) #if 0 /* currently not used */ /* cosine weighted hemisphere sampling */ -static void QMC_sampleHemiCosine(float *vec, QMCSampler *qsa, int thread, int num) +static void QMC_sampleHemiCosine(float vec[3], QMCSampler *qsa, int thread, int num) { double s[2]; float phi, sqr; @@ -1238,10 +1240,9 @@ static void release_thread_qmcsampler(Render *UNUSED(re), int UNUSED(thread), QM void free_render_qmcsampler(Render *re) { - QMCSampler *qsa, *next; - int a; - if(re->qmcsamplers) { + QMCSampler *qsa, *next; + int a; for(a=0; aqmcsamplers[a].first; qsa; qsa=next) { next= qsa->next; @@ -1256,7 +1257,7 @@ void free_render_qmcsampler(Render *re) } } -static int adaptive_sample_variance(int samples, float *col, float *colsq, float thresh) +static int adaptive_sample_variance(int samples, const float col[3], const float colsq[3], float thresh) { float var[3], mean[3]; @@ -1306,7 +1307,7 @@ static float get_avg_speed(ShadeInput *shi) /* ***************** main calls ************** */ -static void trace_refract(float *col, ShadeInput *shi, ShadeResult *shr) +static void trace_refract(float col[4], ShadeInput *shi, ShadeResult *shr) { QMCSampler *qsa=NULL; int samp_type; @@ -1345,7 +1346,7 @@ static void trace_refract(float *col, ShadeInput *shi, ShadeResult *shr) if((shi->vlr->flag & R_SMOOTH)) reflection(v_refract, shi->vn, shi->view, shi->facenor); else - reflection(v_refract, shi->vn, shi->view, NULL); + reflection_simple(v_refract, shi->vn, shi->view); /* can't blur total external reflection */ max_samples = 1; @@ -1366,7 +1367,7 @@ static void trace_refract(float *col, ShadeInput *shi, ShadeResult *shr) normalize_v3(v_refract_new); } else { /* no blurriness, use the original normal */ - VECCOPY(v_refract_new, v_refract); + copy_v3_v3(v_refract_new, v_refract); } sampcol[0]= sampcol[1]= sampcol[2]= sampcol[3]= 0.0f; @@ -1406,7 +1407,7 @@ static void trace_refract(float *col, ShadeInput *shi, ShadeResult *shr) release_thread_qmcsampler(&R, shi->thread, qsa); } -static void trace_reflect(float *col, ShadeInput *shi, ShadeResult *shr, float fresnelfac) +static void trace_reflect(float col[3], ShadeInput *shi, ShadeResult *shr, float fresnelfac) { QMCSampler *qsa=NULL; int samp_type; @@ -1445,7 +1446,7 @@ static void trace_reflect(float *col, ShadeInput *shi, ShadeResult *shr, float f * if tangent shading enabled */ if (shi->mat->mode & (MA_TANGENT_V)) { cross_v3_v3v3(orthx, shi->vn, shi->tang); // bitangent - VECCOPY(orthy, shi->tang); + copy_v3_v3(orthy, shi->tang); mul_v3_fl(orthx, samp3d[0]); mul_v3_fl(orthy, samp3d[1]*aniso); } else { @@ -1460,13 +1461,13 @@ static void trace_reflect(float *col, ShadeInput *shi, ShadeResult *shr, float f normalize_v3(v_nor_new); } else { /* no blurriness, use the original normal */ - VECCOPY(v_nor_new, shi->vn); + copy_v3_v3(v_nor_new, shi->vn); } if((shi->vlr->flag & R_SMOOTH)) reflection(v_reflect, v_nor_new, shi->view, shi->facenor); else - reflection(v_reflect, v_nor_new, shi->view, NULL); + reflection_simple(v_reflect, v_nor_new, shi->view); sampcol[0]= sampcol[1]= sampcol[2]= sampcol[3]= 0.0f; @@ -1517,7 +1518,7 @@ static void trace_reflect(float *col, ShadeInput *shi, ShadeResult *shr, float f /* extern call from render loop */ void ray_trace(ShadeInput *shi, ShadeResult *shr) { - float i, f, f1, fr, fg, fb; + float f1, fr, fg, fb; float mircol[4], tracol[4]; float diff[3]; int do_tra, do_mir; @@ -1527,12 +1528,12 @@ void ray_trace(ShadeInput *shi, ShadeResult *shr) /* raytrace mirror amd refract like to separate the spec color */ if(shi->combinedflag & SCE_PASS_SPEC) - VECSUB(diff, shr->combined, shr->spec) /* no ; */ + sub_v3_v3v3(diff, shr->combined, shr->spec); else - VECCOPY(diff, shr->combined); + copy_v3_v3(diff, shr->combined); if(do_tra) { - float olddiff[3]; + float olddiff[3], f; trace_refract(tracol, shi, shr); @@ -1542,24 +1543,23 @@ void ray_trace(ShadeInput *shi, ShadeResult *shr) fb= 1.0f+ shi->mat->filter*(shi->b-1.0f); /* for refract pass */ - VECCOPY(olddiff, diff); + copy_v3_v3(olddiff, diff); diff[0]= f*diff[0] + f1*fr*tracol[0]; diff[1]= f*diff[1] + f1*fg*tracol[1]; diff[2]= f*diff[2] + f1*fb*tracol[2]; if(shi->passflag & SCE_PASS_REFRACT) - VECSUB(shr->refr, diff, olddiff); + sub_v3_v3v3(shr->refr, diff, olddiff); if(!(shi->combinedflag & SCE_PASS_REFRACT)) - VECSUB(diff, diff, shr->refr); + sub_v3_v3v3(diff, diff, shr->refr); shr->alpha= MIN2(1.0f, tracol[3]); } if(do_mir) { - - i= shi->ray_mirror*fresnel_fac(shi->view, shi->vn, shi->mat->fresnel_mir_i, shi->mat->fresnel_mir); + const float i= shi->ray_mirror*fresnel_fac(shi->view, shi->vn, shi->mat->fresnel_mir_i, shi->mat->fresnel_mir); if(i!=0.0f) { trace_reflect(mircol, shi, shr, i); @@ -1597,12 +1597,12 @@ void ray_trace(ShadeInput *shi, ShadeResult *shr) if(shi->combinedflag & SCE_PASS_SPEC) VECADD(shr->combined, diff, shr->spec) /* no ; */ else - VECCOPY(shr->combined, diff); + copy_v3_v3(shr->combined, diff); } /* color 'shadfac' passes through 'col' with alpha and filter */ /* filter is only applied on alpha defined transparent part */ -static void addAlphaLight(float *shadfac, float *col, float alpha, float filter) +static void addAlphaLight(float shadfac[4], const float col[3], float alpha, float filter) { float fr, fg, fb; @@ -1621,19 +1621,20 @@ static void ray_trace_shadow_tra(Isect *is, ShadeInput *origshi, int depth, int { /* ray to lamp, find first face that intersects, check alpha properties, if it has col[3]>0.0f continue. so exit when alpha is full */ - ShadeInput shi; - ShadeResult shr; - float initial_dist = is->dist; - + const float initial_dist = is->dist; + if(RE_rayobject_raycast(R.raytree, is)) { - float d= 1.0f; - /* we got a face */ - - /* Warning, This is not that nice, and possibly a bit slow for every ray, - however some variables were not initialized properly in, unless using shade_input_initialize(...), we need to do a memset */ - memset(&shi, 0, sizeof(ShadeInput)); + /* Warning regarding initializing to zero's, This is not that nice, + * and possibly a bit slow for every ray, however some variables were + * not initialized properly in, unless using + * shade_input_initialize(...), we need to zero them. */ + ShadeInput shi= {NULL}; /* end warning! - Campbell */ - + + ShadeResult shr; + + /* we got a face */ + shi.depth= origshi->depth + 1; /* only used to indicate tracing */ shi.mask= origshi->mask; shi.thread= origshi->thread; @@ -1647,9 +1648,9 @@ static void ray_trace_shadow_tra(Isect *is, ShadeInput *origshi, int depth, int shade_ray(is, &shi, &shr); if (shi.mat->material_type == MA_TYPE_SURFACE) { - if (traflag & RAY_TRA) - d= shade_by_transmission(is, &shi, &shr); - + const float d= (traflag & RAY_TRA) ? + shade_by_transmission(is, &shi, &shr) : + 1.0f; /* mix colors based on shadfac (rgb + amount of light factor) */ addAlphaLight(col, shr.diff, shr.alpha, d*shi.mat->filter); } else if (shi.mat->material_type == MA_TYPE_VOLUME) { @@ -1665,7 +1666,7 @@ static void ray_trace_shadow_tra(Isect *is, ShadeInput *origshi, int depth, int if(depth>0 && col[3]>0.0f) { /* adapt isect struct */ - VECCOPY(is->start, shi.co); + copy_v3_v3(is->start, shi.co); is->dist = initial_dist-is->dist; is->orig.ob = shi.obi; is->orig.face = shi.vlr; @@ -1702,7 +1703,7 @@ static int UNUSED_FUNCTION(ray_trace_shadow_rad)(ShadeInput *ship, ShadeResult * isec.orig.face = ship->vlr; isec.hint = 0; - VECCOPY(isec.start, ship->co); + copy_v3_v3(isec.start, ship->co); RE_RC_INIT(isec, shi); @@ -1710,14 +1711,14 @@ static int UNUSED_FUNCTION(ray_trace_shadow_rad)(ShadeInput *ship, ShadeResult * counter+=3; counter %= 768; - VECCOPY(vec, hashvectf+counter); + copy_v3_v3(vec, hashvectf+counter); if(ship->vn[0]*vec[0]+ship->vn[1]*vec[1]+ship->vn[2]*vec[2]>0.0f) { vec[0]-= vec[0]; vec[1]-= vec[1]; vec[2]-= vec[2]; } - VECCOPY(isec.dir, vec ); + copy_v3_v3(isec.dir, vec ); isec.dist = RE_RAYTRACE_MAXDIST; if(RE_rayobject_raycast(R.raytree, &isec)) { @@ -1751,7 +1752,7 @@ static int UNUSED_FUNCTION(ray_trace_shadow_rad)(ShadeInput *ship, ShadeResult * } /* aolight: function to create random unit sphere vectors for total random sampling */ -static void RandomSpherical(float *v) +static void RandomSpherical(float v[3]) { float r; v[2] = 2.f*BLI_frand()-1.f; @@ -1765,7 +1766,7 @@ static void RandomSpherical(float *v) } /* calc distributed spherical energy */ -static void DS_energy(float *sphere, int tot, float *vec) +static void DS_energy(float *sphere, int tot, float vec[3]) { float *fp, fac, force[3], res[3]; int a; @@ -1863,13 +1864,15 @@ static float *sphere_sampler(int type, int resol, int thread, int xs, int ys, in } else { float *sphere; - float cosfi, sinfi, cost, sint; - float ang, *vec1; - int a; + float *vec1; // returns table if xs and ys were equal to last call, and not resetting sphere= (reset)? NULL: threadsafe_table_sphere(1, thread, xs, ys, tot); if(sphere==NULL) { + float cosfi, sinfi, cost, sint; + float ang; + int a; + sphere= threadsafe_table_sphere(0, thread, xs, ys, tot); // random rotation @@ -1890,7 +1893,7 @@ static float *sphere_sampler(int type, int resol, int thread, int xs, int ys, in } } -static void ray_ao_qmc(ShadeInput *shi, float *ao, float *env) +static void ray_ao_qmc(ShadeInput *shi, float ao[3], float env[3]) { Isect isec; RayHint point_hint; @@ -1924,7 +1927,7 @@ static void ray_ao_qmc(ShadeInput *shi, float *ao, float *env) isec.mode= (R.wrld.aomode & WO_AODIST)?RE_RAY_SHADOW_TRA:RE_RAY_SHADOW; isec.lay= -1; - VECCOPY(isec.start, shi->co); + copy_v3_v3(isec.start, shi->co); RE_rayobject_hint_bb( R.raytree, &point_hint, isec.start, isec.start ); isec.hint = &point_hint; @@ -1943,10 +1946,10 @@ static void ray_ao_qmc(ShadeInput *shi, float *ao, float *env) } if(shi->vlr->flag & R_SMOOTH) { - VECCOPY(nrm, shi->vn); + copy_v3_v3(nrm, shi->vn); } else { - VECCOPY(nrm, shi->facenor); + copy_v3_v3(nrm, shi->facenor); } ortho_basis_v3v3_v3( up, side,nrm); @@ -1990,7 +1993,7 @@ static void ray_ao_qmc(ShadeInput *shi, float *ao, float *env) } else if(envcolor!=WO_AOPLAIN) { float skycol[4]; - float skyfac, view[3]; + float view[3]; view[0]= -dir[0]; view[1]= -dir[1]; @@ -1998,7 +2001,7 @@ static void ray_ao_qmc(ShadeInput *shi, float *ao, float *env) normalize_v3(view); if(envcolor==WO_AOSKYCOL) { - skyfac= 0.5f*(1.0f+view[0]*R.grvec[0]+ view[1]*R.grvec[1]+ view[2]*R.grvec[2]); + const float skyfac= 0.5f*(1.0f+view[0]*R.grvec[0]+ view[1]*R.grvec[1]+ view[2]*R.grvec[2]); env[0]+= (1.0f-skyfac)*R.wrld.horr + skyfac*R.wrld.zenr; env[1]+= (1.0f-skyfac)*R.wrld.horg + skyfac*R.wrld.zeng; env[2]+= (1.0f-skyfac)*R.wrld.horb + skyfac*R.wrld.zenb; @@ -2039,7 +2042,7 @@ static void ray_ao_qmc(ShadeInput *shi, float *ao, float *env) } /* extern call from shade_lamp_loop, ambient occlusion calculus */ -static void ray_ao_spheresamp(ShadeInput *shi, float *ao, float *env) +static void ray_ao_spheresamp(ShadeInput *shi, float ao[3], float env[3]) { Isect isec; RayHint point_hint; @@ -2063,7 +2066,7 @@ static void ray_ao_spheresamp(ShadeInput *shi, float *ao, float *env) isec.mode= (R.wrld.aomode & WO_AODIST)?RE_RAY_SHADOW_TRA:RE_RAY_SHADOW; isec.lay= -1; - VECCOPY(isec.start, shi->co); + copy_v3_v3(isec.start, shi->co); RE_rayobject_hint_bb( R.raytree, &point_hint, isec.start, isec.start ); isec.hint = &point_hint; @@ -2128,7 +2131,7 @@ static void ray_ao_spheresamp(ShadeInput *shi, float *ao, float *env) } else if(envcolor!=WO_AOPLAIN) { float skycol[4]; - float fac, view[3]; + float view[3]; view[0]= -vec[0]; view[1]= -vec[1]; @@ -2136,7 +2139,7 @@ static void ray_ao_spheresamp(ShadeInput *shi, float *ao, float *env) normalize_v3(view); if(envcolor==WO_AOSKYCOL) { - fac= 0.5f*(1.0f+view[0]*R.grvec[0]+ view[1]*R.grvec[1]+ view[2]*R.grvec[2]); + const float fac= 0.5f*(1.0f+view[0]*R.grvec[0]+ view[1]*R.grvec[1]+ view[2]*R.grvec[2]); env[0]+= (1.0f-fac)*R.wrld.horr + fac*R.wrld.zenr; env[1]+= (1.0f-fac)*R.wrld.horg + fac*R.wrld.zeng; env[2]+= (1.0f-fac)*R.wrld.horb + fac*R.wrld.zenb; @@ -2167,7 +2170,7 @@ static void ray_ao_spheresamp(ShadeInput *shi, float *ao, float *env) copy_v3_v3(env, ao); } -void ray_ao(ShadeInput *shi, float *ao, float *env) +void ray_ao(ShadeInput *shi, float ao[3], float env[3]) { /* Unfortunately, the unusual way that the sphere sampler calculates roughly twice as many * samples as are actually traced, and skips them based on bias and OSA settings makes it very difficult @@ -2214,12 +2217,12 @@ static void ray_shadow_jittered_coords(ShadeInput *shi, int max, float jitco[RE_ *totjitco= tot; } else { - VECCOPY(jitco[0], shi->co); + copy_v3_v3(jitco[0], shi->co); *totjitco= 1; } } -static void ray_shadow_qmc(ShadeInput *shi, LampRen *lar, float *lampco, float *shadfac, Isect *isec) +static void ray_shadow_qmc(ShadeInput *shi, LampRen *lar, const float lampco[3], float shadfac[4], Isect *isec) { QMCSampler *qsa=NULL; int samples=0; @@ -2276,7 +2279,7 @@ static void ray_shadow_qmc(ShadeInput *shi, LampRen *lar, float *lampco, float * isec->hint = &bb_hint; isec->check = RE_CHECK_VLR_RENDER; isec->skip = RE_SKIP_VLR_NEIGHBOUR; - VECCOPY(vec, lampco); + copy_v3_v3(vec, lampco); while (samples < max_samples) { @@ -2294,9 +2297,7 @@ static void ray_shadow_qmc(ShadeInput *shi, LampRen *lar, float *lampco, float * float ru[3], rv[3], v[3], s[3]; /* calc tangent plane vectors */ - v[0] = co[0] - lampco[0]; - v[1] = co[1] - lampco[1]; - v[2] = co[2] - lampco[2]; + sub_v3_v3v3(v, co, lampco); normalize_v3(v); ortho_basis_v3v3_v3( ru, rv,v); @@ -2308,7 +2309,7 @@ static void ray_shadow_qmc(ShadeInput *shi, LampRen *lar, float *lampco, float * s[1] = samp3d[0]*ru[1] + samp3d[1]*rv[1]; s[2] = samp3d[0]*ru[2] + samp3d[1]*rv[2]; - VECCOPY(samp3d, s); + copy_v3_v3(samp3d, s); } else { /* sampling, returns quasi-random vector in [sizex,sizey]^2 plane */ @@ -2321,7 +2322,7 @@ static void ray_shadow_qmc(ShadeInput *shi, LampRen *lar, float *lampco, float * end[1] = vec[1]+samp3d[1]; end[2] = vec[2]+samp3d[2]; } else { - VECCOPY(end, vec); + copy_v3_v3(end, vec); } if(shi->strand) { @@ -2329,7 +2330,7 @@ static void ray_shadow_qmc(ShadeInput *shi, LampRen *lar, float *lampco, float * float jitbias= 0.5f*(len_v3(shi->dxco) + len_v3(shi->dyco)); float v[3]; - VECSUB(v, co, end); + sub_v3_v3v3(v, co, end); normalize_v3(v); co[0] -= jitbias*v[0]; @@ -2337,7 +2338,7 @@ static void ray_shadow_qmc(ShadeInput *shi, LampRen *lar, float *lampco, float * co[2] -= jitbias*v[2]; } - VECCOPY(isec->start, co); + copy_v3_v3(isec->start, co); isec->dir[0] = end[0]-isec->start[0]; isec->dir[1] = end[1]-isec->start[1]; isec->dir[2] = end[2]-isec->start[2]; @@ -2393,7 +2394,7 @@ static void ray_shadow_qmc(ShadeInput *shi, LampRen *lar, float *lampco, float * release_thread_qmcsampler(&R, shi->thread, qsa); } -static void ray_shadow_jitter(ShadeInput *shi, LampRen *lar, float *lampco, float *shadfac, Isect *isec) +static void ray_shadow_jitter(ShadeInput *shi, LampRen *lar, const float lampco[3], float shadfac[4], Isect *isec) { /* area soft shadow */ float *jitlamp; @@ -2416,7 +2417,7 @@ static void ray_shadow_jitter(ShadeInput *shi, LampRen *lar, float *lampco, floa if(a==4) mask |= (mask>>4)|(mask>>8); else if(a==9) mask |= (mask>>9); - VECCOPY(isec->start, shi->co); + copy_v3_v3(isec->start, shi->co); isec->orig.ob = shi->obi; isec->orig.face = shi->vlr; RE_rayobject_hint_bb( R.raytree, &point_hint, isec->start, isec->start ); @@ -2477,7 +2478,7 @@ static void ray_shadow_jitter(ShadeInput *shi, LampRen *lar, float *lampco, floa } } /* extern call from shade_lamp_loop */ -void ray_shadow(ShadeInput *shi, LampRen *lar, float *shadfac) +void ray_shadow(ShadeInput *shi, LampRen *lar, float shadfac[4]) { Isect isec; float lampco[3]; @@ -2520,7 +2521,7 @@ void ray_shadow(ShadeInput *shi, LampRen *lar, float *shadfac) lampco[2]= shi->co[2] - R.maxdist*lar->vec[2]; } else { - VECCOPY(lampco, lar->co); + copy_v3_v3(lampco, lar->co); } if (ELEM(lar->ray_samp_method, LA_SAMP_HALTON, LA_SAMP_HAMMERSLEY)) { @@ -2536,8 +2537,8 @@ void ray_shadow(ShadeInput *shi, LampRen *lar, float *shadfac) shadfac[3]= 1.0f; // 1.0=full light /* set up isec.dir */ - VECCOPY(isec.start, shi->co); - VECSUB(isec.dir, lampco, isec.start); + copy_v3_v3(isec.start, shi->co); + sub_v3_v3v3(isec.dir, lampco, isec.start); isec.dist = normalize_v3(isec.dir); if(isec.mode==RE_RAY_SHADOW_TRA) { @@ -2545,7 +2546,7 @@ void ray_shadow(ShadeInput *shi, LampRen *lar, float *shadfac) float col[4] = {1.0f, 1.0f, 1.0f, 1.0f}; ray_trace_shadow_tra(&isec, shi, DEPTH_SHADOW_TRA, 0, col); - QUATCOPY(shadfac, col); + copy_v4_v4(shadfac, col); } else if(RE_rayobject_raycast(R.raytree, &isec)) shadfac[3]= 0.0f; @@ -2584,15 +2585,15 @@ static void ray_translucent(ShadeInput *shi, LampRen *lar, float *distfac, float lampco[2]= shi->co[2] - RE_RAYTRACE_MAXDIST*lar->vec[2]; } else { - VECCOPY(lampco, lar->co); + copy_v3_v3(lampco, lar->co); } isec.orig.ob = shi->obi; isec.orig.face = shi->vlr; /* set up isec.dir */ - VECCOPY(isec.start, shi->co); - VECCOPY(isec.end, lampco); + copy_v3_v3(isec.start, shi->co); + copy_v3_v3(isec.end, lampco); if(RE_rayobject_raycast(R.raytree, &isec)) { /* we got a face */ diff --git a/source/blender/render/intern/source/rendercore.c b/source/blender/render/intern/source/rendercore.c index bc5e7f23e21..fd824cee8a4 100644 --- a/source/blender/render/intern/source/rendercore.c +++ b/source/blender/render/intern/source/rendercore.c @@ -142,7 +142,7 @@ void calc_renderco_ortho(float co[3], float x, float y, int z) co[2]= R.winmat[3][2]/( R.winmat[2][3]*zco - R.winmat[2][2] ); } -void calc_renderco_zbuf(float co[3], float *view, int z) +void calc_renderco_zbuf(float co[3], const float view[3], int z) { float fac, zco; diff --git a/source/blender/render/intern/source/shadeinput.c b/source/blender/render/intern/source/shadeinput.c index 956a3d4de7c..5963c4c8ffd 100644 --- a/source/blender/render/intern/source/shadeinput.c +++ b/source/blender/render/intern/source/shadeinput.c @@ -1355,16 +1355,14 @@ void shade_sample_initialize(ShadeSample *ssamp, RenderPart *pa, RenderLayer *rl /* Do AO or (future) GI */ void shade_samples_do_AO(ShadeSample *ssamp) { - ShadeInput *shi; - int sample; - if(!(R.r.mode & R_SHADOW)) return; if(!(R.r.mode & R_RAYTRACE) && !(R.wrld.ao_gather_method == WO_AOGATHER_APPROX)) return; if(R.wrld.mode & (WO_AMB_OCC|WO_ENV_LIGHT|WO_INDIRECT_LIGHT)) { - shi= &ssamp->shi[0]; + ShadeInput *shi= &ssamp->shi[0]; + int sample; if(((shi->passflag & SCE_PASS_COMBINED) && (shi->combinedflag & (SCE_PASS_AO|SCE_PASS_ENVIRONMENT|SCE_PASS_INDIRECT))) || (shi->passflag & (SCE_PASS_AO|SCE_PASS_ENVIRONMENT|SCE_PASS_INDIRECT))) diff --git a/source/blender/render/intern/source/shadeoutput.c b/source/blender/render/intern/source/shadeoutput.c index c808d930e7c..66ae219a80a 100644 --- a/source/blender/render/intern/source/shadeoutput.c +++ b/source/blender/render/intern/source/shadeoutput.c @@ -119,7 +119,7 @@ static void fogcolor(float *colf, float *rco, float *view) #endif /* zcor is distance, co the 3d coordinate in eye space, return alpha */ -float mistfactor(float zcor, float *co) +float mistfactor(float zcor, float const co[3]) { float fac, hi; @@ -162,8 +162,7 @@ static void spothalo(struct LampRen *lar, ShadeInput *shi, float *intens) double t0, t1 = 0.0f, t2= 0.0f, t3; float p1[3], p2[3], ladist, maxz = 0.0f, maxy = 0.0f, haint; int snijp, doclip=1, use_yco=0; - int ok1=0, ok2=0; - + *intens= 0.0f; haint= lar->haint; @@ -243,6 +242,8 @@ static void spothalo(struct LampRen *lar, ShadeInput *shi, float *intens) } } if(snijp==2) { + int ok1=0, ok2=0; + /* sort */ if(t1>t2) { a= t1; t1= t2; t2= a; @@ -345,7 +346,7 @@ static void spothalo(struct LampRen *lar, ShadeInput *shi, float *intens) } } -void renderspothalo(ShadeInput *shi, float *col, float alpha) +void renderspothalo(ShadeInput *shi, float col[4], float alpha) { ListBase *lights; GroupObject *go; @@ -891,12 +892,11 @@ void shade_color(ShadeInput *shi, ShadeResult *shr) static void ramp_diffuse_result(float *diff, ShadeInput *shi) { Material *ma= shi->mat; - float col[4], fac=0; + float col[4]; if(ma->ramp_col) { if(ma->rampin_col==MA_RAMP_IN_RESULT) { - - fac= 0.3f*diff[0] + 0.58f*diff[1] + 0.12f*diff[2]; + float fac= 0.3f*diff[0] + 0.58f*diff[1] + 0.12f*diff[2]; do_colorband(ma->ramp_col, fac, col); /* blending method */ @@ -911,8 +911,7 @@ static void ramp_diffuse_result(float *diff, ShadeInput *shi) static void add_to_diffuse(float *diff, ShadeInput *shi, float is, float r, float g, float b) { Material *ma= shi->mat; - float col[4], colt[3], fac=0; - + if(ma->ramp_col && (ma->mode & MA_RAMP_COL)) { /* MA_RAMP_IN_RESULT is exceptional */ @@ -923,6 +922,9 @@ static void add_to_diffuse(float *diff, ShadeInput *shi, float is, float r, floa diff[2] += b * shi->b; } else { + float colt[3], col[4]; + float fac; + /* input */ switch(ma->rampin_col) { case MA_RAMP_IN_ENERGY: @@ -934,6 +936,9 @@ static void add_to_diffuse(float *diff, ShadeInput *shi, float is, float r, floa case MA_RAMP_IN_NOR: fac= shi->view[0]*shi->vn[0] + shi->view[1]*shi->vn[1] + shi->view[2]*shi->vn[2]; break; + default: + fac= 0.0f; + break; } do_colorband(ma->ramp_col, fac, col); @@ -962,11 +967,11 @@ static void add_to_diffuse(float *diff, ShadeInput *shi, float is, float r, floa static void ramp_spec_result(float *specr, float *specg, float *specb, ShadeInput *shi) { Material *ma= shi->mat; - float col[4]; - float fac; - + if(ma->ramp_spec && (ma->rampin_spec==MA_RAMP_IN_RESULT)) { - fac= 0.3f*(*specr) + 0.58f*(*specg) + 0.12f*(*specb); + float col[4]; + float fac= 0.3f*(*specr) + 0.58f*(*specg) + 0.12f*(*specb); + do_colorband(ma->ramp_spec, fac, col); /* blending method */ @@ -978,19 +983,19 @@ static void ramp_spec_result(float *specr, float *specg, float *specb, ShadeInpu } /* is = dot product shade, t = spec energy */ -static void do_specular_ramp(ShadeInput *shi, float is, float t, float *spec) +static void do_specular_ramp(ShadeInput *shi, float is, float t, float spec[3]) { Material *ma= shi->mat; - float col[4]; - float fac=0.0f; - + spec[0]= shi->specr; spec[1]= shi->specg; spec[2]= shi->specb; /* MA_RAMP_IN_RESULT is exception */ if(ma->ramp_spec && (ma->rampin_spec!=MA_RAMP_IN_RESULT)) { - + float fac; + float col[4]; + /* input */ switch(ma->rampin_spec) { case MA_RAMP_IN_ENERGY: @@ -1002,6 +1007,9 @@ static void do_specular_ramp(ShadeInput *shi, float is, float t, float *spec) case MA_RAMP_IN_NOR: fac= shi->view[0]*shi->vn[0] + shi->view[1]*shi->vn[1] + shi->view[2]*shi->vn[2]; break; + default: + fac= 0.0f; + break; } do_colorband(ma->ramp_spec, fac, col); @@ -1086,7 +1094,7 @@ static void indirect_lighting_apply(ShadeInput *shi, ShadeResult *shr) } /* result written in shadfac */ -void lamp_get_shadow(LampRen *lar, ShadeInput *shi, float inp, float *shadfac, int do_real) +void lamp_get_shadow(LampRen *lar, ShadeInput *shi, float inp, float shadfac[4], int do_real) { LampShadowSubSample *lss= &(lar->shadsamp[shi->thread].s[shi->sample]); @@ -1115,7 +1123,7 @@ void lamp_get_shadow(LampRen *lar, ShadeInput *shi, float inp, float *shadfac, i } /* lampdistance and spot angle, writes in lv and dist */ -float lamp_get_visibility(LampRen *lar, float *co, float *lv, float *dist) +float lamp_get_visibility(LampRen *lar, const float co[3], float lv[3], float *dist) { if(lar->type==LA_SUN || lar->type==LA_HEMI) { *dist= 1.0f; @@ -1621,7 +1629,7 @@ static void shade_lamp_loop_only_shadow(ShadeInput *shi, ShadeResult *shr) } /* let's map negative light as if it mirrors positive light, otherwise negative values disappear */ -static void wrld_exposure_correct(float *diff) +static void wrld_exposure_correct(float diff[3]) { diff[0]= R.wrld.linfac*(1.0f-exp( diff[0]*R.wrld.logfac) ); diff --git a/source/blender/render/intern/source/strand.c b/source/blender/render/intern/source/strand.c index 840e5444ff0..15226493977 100644 --- a/source/blender/render/intern/source/strand.c +++ b/source/blender/render/intern/source/strand.c @@ -92,7 +92,7 @@ void strand_eval_point(StrandSegment *sseg, StrandPoint *spoint) Material *ma; StrandBuffer *strandbuf; float *simplify; - float p[4][3], data[4], cross[3], crosslen, w, dx, dy, t; + float p[4][3], data[4], cross[3], w, dx, dy, t; int type; strandbuf= sseg->buffer; @@ -164,7 +164,7 @@ void strand_eval_point(StrandSegment *sseg, StrandPoint *spoint) if(w > 0.0f) { if(strandbuf->flag & R_STRAND_B_UNITS) { - crosslen= len_v3(cross); + const float crosslen= len_v3(cross); w= 2.0f*crosslen*strandbuf->minwidth/w; if(spoint->width < w) { diff --git a/source/blender/render/intern/source/zbuf.c b/source/blender/render/intern/source/zbuf.c index f36994e0969..62a54a51102 100644 --- a/source/blender/render/intern/source/zbuf.c +++ b/source/blender/render/intern/source/zbuf.c @@ -1747,13 +1747,14 @@ static void zbuf_project_cache_clear(ZbufProjectCache *cache, int size) static int zbuf_shadow_project(ZbufProjectCache *cache, int index, float winmat[][4], float *co, float *ho) { - int clipflag, cindex= index & 255; + int cindex= index & 255; if(cache[cindex].index == index) { QUATCOPY(ho, cache[cindex].ho); return cache[cindex].clip; } else { + int clipflag; projectvert(co, winmat, ho); clipflag= testclip(ho); @@ -1775,14 +1776,16 @@ static void zbuffer_part_bounds(int winx, int winy, RenderPart *pa, float *bound static int zbuf_part_project(ZbufProjectCache *cache, int index, float winmat[][4], float *bounds, float *co, float *ho) { - float vec[3], wco; - int clipflag= 0, cindex= index & 255; + float vec[3]; + int cindex= index & 255; if(cache[cindex].index == index) { QUATCOPY(ho, cache[cindex].ho); return cache[cindex].clip; } else { + float wco; + int clipflag= 0; VECCOPY(vec, co) projectvert(co, winmat, ho); -- cgit v1.2.3 From 1ddb64817dadf02d006a6db5ea4ad230484b5aca Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Sat, 24 Sep 2011 16:17:23 +0000 Subject: Minor: Added PROP_DISTANCE sub-type to min/max dstances of WeightVG Proximity, and Radius of Warp modifiers. --- source/blender/makesrna/intern/rna_modifier.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'source') diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c index 33f5e41b2cc..00ac371f929 100644 --- a/source/blender/makesrna/intern/rna_modifier.c +++ b/source/blender/makesrna/intern/rna_modifier.c @@ -805,7 +805,7 @@ static void rna_def_modifier_warp(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Falloff Type", ""); RNA_def_property_update(prop, 0, "rna_Modifier_update"); - prop= RNA_def_property(srna, "falloff_radius", PROP_FLOAT, PROP_UNSIGNED); + prop= RNA_def_property(srna, "falloff_radius", PROP_FLOAT, PROP_UNSIGNED | PROP_DISTANCE); RNA_def_property_ui_text(prop, "Radius", "Radius to apply"); RNA_def_property_update(prop, 0, "rna_Modifier_update"); @@ -2775,13 +2775,13 @@ static void rna_def_modifier_weightvgproximity(BlenderRNA *brna) RNA_def_property_flag(prop, PROP_EDITABLE|PROP_ID_SELF_CHECK); RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update"); - prop= RNA_def_property(srna, "min_dist", PROP_FLOAT, PROP_NONE); + prop= RNA_def_property(srna, "min_dist", PROP_FLOAT, PROP_DISTANCE); RNA_def_property_range(prop, 0.0, FLT_MAX); RNA_def_property_ui_range(prop, 0.0, 1000.0, 10, 0); RNA_def_property_ui_text(prop, "Lowest Dist", "Distance mapping to weight 0.0 (or weight 1.0 if above Highest Dist)"); RNA_def_property_update(prop, 0, "rna_Modifier_update"); - prop= RNA_def_property(srna, "max_dist", PROP_FLOAT, PROP_NONE); + prop= RNA_def_property(srna, "max_dist", PROP_FLOAT, PROP_DISTANCE); RNA_def_property_range(prop, 0.0, FLT_MAX); RNA_def_property_ui_range(prop, 0.0, 1000.0, 10, 0); RNA_def_property_ui_text(prop, "Highest Dist", "Distance mapping to weight 1.0 (or weight 0.0 if below Lowest Dist)"); -- cgit v1.2.3 From 3b40eea3cd88f2e927d95c8f1197195ebc7e600e Mon Sep 17 00:00:00 2001 From: Dalai Felinto Date: Sat, 24 Sep 2011 22:15:37 +0000 Subject: removing texface rna - changelog.rst update soon --- source/blender/makesrna/intern/rna_mesh.c | 73 ------------------------------- 1 file changed, 73 deletions(-) (limited to 'source') diff --git a/source/blender/makesrna/intern/rna_mesh.c b/source/blender/makesrna/intern/rna_mesh.c index 67bb7bffcfb..a43aa709dd6 100644 --- a/source/blender/makesrna/intern/rna_mesh.c +++ b/source/blender/makesrna/intern/rna_mesh.c @@ -1424,79 +1424,6 @@ static void rna_def_mtface(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Image", ""); RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); - //XXX to be deleted soon -- left for now in case we need it for debug - //XXX it should be out before Blender 2.6 (after texface to material patch) - - prop= RNA_def_property(srna, "use_image", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "mode", TF_TEX); - RNA_def_property_ui_text(prop, "Tex", "Render face with texture"); - RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); - - prop= RNA_def_property(srna, "use_light", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "mode", TF_LIGHT); - RNA_def_property_ui_text(prop, "Light", "Use light for face"); - RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); - - prop= RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "mode", TF_INVISIBLE); - RNA_def_property_ui_text(prop, "Invisible", "Make face invisible"); - RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); - - prop= RNA_def_property(srna, "use_collision", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "mode", TF_DYNAMIC); - RNA_def_property_ui_text(prop, "Collision", "Use face for collision and ray-sensor detection"); - RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); - - prop= RNA_def_property(srna, "use_blend_shared", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "mode", TF_SHAREDCOL); - RNA_def_property_ui_text(prop, "Shared", "Blend vertex colors across face when vertices are shared"); - RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); - - prop= RNA_def_property(srna, "use_twoside", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "mode", TF_TWOSIDE); - RNA_def_property_ui_text(prop, "Two-side", "Render face two-sided"); - RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); - - prop= RNA_def_property(srna, "use_object_color", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "mode", TF_OBCOL); - RNA_def_property_ui_text(prop, "Object Color", "Use ObColor instead of vertex colors"); - RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); - - prop= RNA_def_property(srna, "use_halo", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "mode", TF_BILLBOARD); - RNA_def_property_ui_text(prop, "Halo", "Screen aligned billboard"); - RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); - - prop= RNA_def_property(srna, "use_billboard", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "mode", TF_BILLBOARD2); - RNA_def_property_ui_text(prop, "Billboard", "Billboard with Z-axis constraint"); - RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); - - prop= RNA_def_property(srna, "use_shadow_cast", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "mode", TF_SHADOW); - RNA_def_property_ui_text(prop, "Shadow", "Face is used for shadow"); - RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); - - prop= RNA_def_property(srna, "use_bitmap_text", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "mode", TF_BMFONT); - RNA_def_property_ui_text(prop, "Text", "Enable bitmap text on face"); - RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); - - prop= RNA_def_property(srna, "use_alpha_sort", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "mode", TF_ALPHASORT); - RNA_def_property_ui_text(prop, "Alpha Sort", - "Enable sorting of faces for correct alpha drawing (slow, use Clip Alpha instead when possible)"); - RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); - - prop= RNA_def_property(srna, "blend_type", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_sdna(prop, NULL, "transp"); - RNA_def_property_enum_items(prop, transp_items); - RNA_def_property_ui_text(prop, "Transparency", "Transparency blending mode"); - RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); - - //XXX to be deleted soon -- left for now in case we need it for debug - //XXX it should be out before Blender 2.6 (after texface to material patch) - prop= RNA_def_property(srna, "select_uv", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", TF_SEL1); RNA_def_property_array(prop, 4); -- cgit v1.2.3 From 51555877b0e041e779cb59517ce978e81f924498 Mon Sep 17 00:00:00 2001 From: Dalai Felinto Date: Sat, 24 Sep 2011 23:50:00 +0000 Subject: manual update on changelog (python API) Change as suggested by Campbell. I'm not sure if this is the way to do for enums, I will check with him later --- source/blender/makesrna/intern/rna_mesh.c | 6 ------ 1 file changed, 6 deletions(-) (limited to 'source') diff --git a/source/blender/makesrna/intern/rna_mesh.c b/source/blender/makesrna/intern/rna_mesh.c index a43aa709dd6..00c79c32b3a 100644 --- a/source/blender/makesrna/intern/rna_mesh.c +++ b/source/blender/makesrna/intern/rna_mesh.c @@ -1366,12 +1366,6 @@ static void rna_def_mtface(BlenderRNA *brna) { StructRNA *srna; PropertyRNA *prop; - static const EnumPropertyItem transp_items[]= { - {TF_SOLID, "OPAQUE", 0, "Opaque", "Render color of textured face as color"}, - {TF_ADD, "ADD", 0, "Add", "Render face transparent and add color of face"}, - {TF_ALPHA, "ALPHA", 0, "Alpha", "Render polygon transparent, depending on alpha channel of the texture"}, - {TF_CLIP, "CLIPALPHA", 0, "Clip Alpha", "Use the images alpha values clipped with no blending (binary alpha)"}, - {0, NULL, 0, NULL, NULL}}; const int uv_dim[]= {4, 2}; srna= RNA_def_struct(brna, "MeshTextureFaceLayer", NULL); -- cgit v1.2.3 From 81f7e361d290a595a40f5811422e03f7560ff9f3 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 25 Sep 2011 02:49:46 +0000 Subject: make new rna variables more consistant with existing names. --- source/blender/makesrna/intern/rna_armature.c | 2 +- source/blender/makesrna/intern/rna_object.c | 2 +- source/blender/makesrna/intern/rna_sequencer.c | 2 +- source/blender/makesrna/intern/rna_sound.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) (limited to 'source') diff --git a/source/blender/makesrna/intern/rna_armature.c b/source/blender/makesrna/intern/rna_armature.c index ec928415876..a834fcf820b 100644 --- a/source/blender/makesrna/intern/rna_armature.c +++ b/source/blender/makesrna/intern/rna_armature.c @@ -867,7 +867,7 @@ static void rna_def_armature(BlenderRNA *brna) RNA_def_property_update(prop, 0, "rna_Armature_redraw_data"); RNA_def_property_flag(prop, PROP_LIB_EXCEPTION); - prop= RNA_def_property(srna, "vert_deformer", PROP_ENUM, PROP_NONE); + prop= RNA_def_property(srna, "deform_method", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "gevertdeformer"); RNA_def_property_enum_items(prop, prop_vdeformer); RNA_def_property_ui_text(prop, "Vertex Deformer", ""); diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c index 6c273ff9f2e..1f3a134f14d 100644 --- a/source/blender/makesrna/intern/rna_object.c +++ b/source/blender/makesrna/intern/rna_object.c @@ -1524,7 +1524,7 @@ static void rna_def_object_game_settings(BlenderRNA *brna) RNA_def_property_pointer_sdna(prop, NULL, "bsoft"); RNA_def_property_ui_text(prop, "Soft Body Settings", "Settings for Bullet soft body simulation"); - prop= RNA_def_property(srna, "create_obstacle", PROP_BOOLEAN, PROP_NONE); + prop= RNA_def_property(srna, "use_obstacle_create", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "gameflag", OB_HASOBSTACLE); RNA_def_property_ui_text(prop, "Create obstacle", "Create representation for obstacle simulation"); diff --git a/source/blender/makesrna/intern/rna_sequencer.c b/source/blender/makesrna/intern/rna_sequencer.c index 86682af189c..96e6eea22af 100644 --- a/source/blender/makesrna/intern/rna_sequencer.c +++ b/source/blender/makesrna/intern/rna_sequencer.c @@ -1421,7 +1421,7 @@ static void rna_def_movie(BlenderRNA *brna) RNA_def_property_ui_text(prop, "MPEG Preseek", "For MPEG movies, preseek this many frames"); RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update"); - prop= RNA_def_property(srna, "streamindex", PROP_INT, PROP_NONE); + prop= RNA_def_property(srna, "stream_index", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "streamindex"); RNA_def_property_range(prop, 0, 20); RNA_def_property_ui_text(prop, "Streamindex", "For files with several movie streams, use the stream with the given index"); diff --git a/source/blender/makesrna/intern/rna_sound.c b/source/blender/makesrna/intern/rna_sound.c index a6c1f400ade..a656e6d56df 100644 --- a/source/blender/makesrna/intern/rna_sound.c +++ b/source/blender/makesrna/intern/rna_sound.c @@ -94,7 +94,7 @@ static void rna_def_sound(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Caching", "The sound file is decoded and loaded into RAM"); RNA_def_property_update(prop, 0, "rna_Sound_caching_update"); - prop= RNA_def_property(srna, "mono", PROP_BOOLEAN, PROP_NONE); + prop= RNA_def_property(srna, "use_mono", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flags", SOUND_FLAGS_MONO); RNA_def_property_ui_text(prop, "Mono", "If the file contains multiple audio channels they are rendered to a single one"); RNA_def_property_update(prop, 0, "rna_Sound_update"); -- cgit v1.2.3 From e3c9986b7c229c35133d2b887b596320dcf81f36 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 25 Sep 2011 04:47:46 +0000 Subject: fix [#28459] Fly mode problem: "Precision enable" not working in 2.59 also added back freelook (from 2.4x) - so you can loop about without changing direction. --- source/blender/editors/space_view3d/view3d_fly.c | 130 +++++++++++++---------- 1 file changed, 73 insertions(+), 57 deletions(-) (limited to 'source') diff --git a/source/blender/editors/space_view3d/view3d_fly.c b/source/blender/editors/space_view3d/view3d_fly.c index 30d1a508888..1ce246a5542 100644 --- a/source/blender/editors/space_view3d/view3d_fly.c +++ b/source/blender/editors/space_view3d/view3d_fly.c @@ -62,49 +62,57 @@ #include "view3d_intern.h" // own include /* NOTE: these defines are saved in keymap files, do not change values but just add new ones */ -#define FLY_MODAL_CANCEL 1 -#define FLY_MODAL_CONFIRM 2 -#define FLY_MODAL_ACCELERATE 3 -#define FLY_MODAL_DECELERATE 4 -#define FLY_MODAL_PAN_ENABLE 5 -#define FLY_MODAL_PAN_DISABLE 6 -#define FLY_MODAL_DIR_FORWARD 7 -#define FLY_MODAL_DIR_BACKWARD 8 -#define FLY_MODAL_DIR_LEFT 9 -#define FLY_MODAL_DIR_RIGHT 10 -#define FLY_MODAL_DIR_UP 11 -#define FLY_MODAL_DIR_DOWN 12 -#define FLY_MODAL_AXIS_LOCK_X 13 -#define FLY_MODAL_AXIS_LOCK_Z 14 -#define FLY_MODAL_PRECISION_ENABLE 15 -#define FLY_MODAL_PRECISION_DISABLE 16 +enum { + FLY_MODAL_CANCEL= 1, + FLY_MODAL_CONFIRM, + FLY_MODAL_ACCELERATE, + FLY_MODAL_DECELERATE, + FLY_MODAL_PAN_ENABLE, + FLY_MODAL_PAN_DISABLE, + FLY_MODAL_DIR_FORWARD, + FLY_MODAL_DIR_BACKWARD, + FLY_MODAL_DIR_LEFT, + FLY_MODAL_DIR_RIGHT, + FLY_MODAL_DIR_UP, + FLY_MODAL_DIR_DOWN, + FLY_MODAL_AXIS_LOCK_X, + FLY_MODAL_AXIS_LOCK_Z, + FLY_MODAL_PRECISION_ENABLE, + FLY_MODAL_PRECISION_DISABLE, + FLY_MODAL_FREELOOK_ENABLE, + FLY_MODAL_FREELOOK_DISABLE + +}; /* called in transform_ops.c, on each regeneration of keymaps */ void fly_modal_keymap(wmKeyConfig *keyconf) { static EnumPropertyItem modal_items[] = { - {FLY_MODAL_CANCEL, "CANCEL", 0, "Cancel", ""}, - {FLY_MODAL_CONFIRM, "CONFIRM", 0, "Confirm", ""}, - {FLY_MODAL_ACCELERATE, "ACCELERATE", 0, "Accelerate", ""}, - {FLY_MODAL_DECELERATE, "DECELERATE", 0, "Decelerate", ""}, + {FLY_MODAL_CANCEL, "CANCEL", 0, "Cancel", ""}, + {FLY_MODAL_CONFIRM, "CONFIRM", 0, "Confirm", ""}, + {FLY_MODAL_ACCELERATE, "ACCELERATE", 0, "Accelerate", ""}, + {FLY_MODAL_DECELERATE, "DECELERATE", 0, "Decelerate", ""}, - {FLY_MODAL_PAN_ENABLE, "PAN_ENABLE", 0, "Pan Enable", ""}, - {FLY_MODAL_PAN_DISABLE, "PAN_DISABLE", 0, "Pan Disable", ""}, + {FLY_MODAL_PAN_ENABLE, "PAN_ENABLE", 0, "Pan Enable", ""}, + {FLY_MODAL_PAN_DISABLE, "PAN_DISABLE", 0, "Pan Disable", ""}, - {FLY_MODAL_DIR_FORWARD, "FORWARD", 0, "Fly Forward", ""}, - {FLY_MODAL_DIR_BACKWARD,"BACKWARD", 0, "Fly Backward", ""}, - {FLY_MODAL_DIR_LEFT, "LEFT", 0, "Fly Left", ""}, - {FLY_MODAL_DIR_RIGHT, "RIGHT", 0, "Fly Right", ""}, - {FLY_MODAL_DIR_UP, "UP", 0, "Fly Up", ""}, - {FLY_MODAL_DIR_DOWN, "DOWN", 0, "Fly Down", ""}, + {FLY_MODAL_DIR_FORWARD, "FORWARD", 0, "Fly Forward", ""}, + {FLY_MODAL_DIR_BACKWARD,"BACKWARD", 0, "Fly Backward", ""}, + {FLY_MODAL_DIR_LEFT, "LEFT", 0, "Fly Left", ""}, + {FLY_MODAL_DIR_RIGHT, "RIGHT", 0, "Fly Right", ""}, + {FLY_MODAL_DIR_UP, "UP", 0, "Fly Up", ""}, + {FLY_MODAL_DIR_DOWN, "DOWN", 0, "Fly Down", ""}, - {FLY_MODAL_AXIS_LOCK_X, "AXIS_LOCK_X", 0, "X Axis Correction", "X axis correction (toggle)"}, - {FLY_MODAL_AXIS_LOCK_Z, "AXIS_LOCK_Z", 0, "X Axis Correction", "Z axis correction (toggle)"}, + {FLY_MODAL_AXIS_LOCK_X, "AXIS_LOCK_X", 0, "X Axis Correction", "X axis correction (toggle)"}, + {FLY_MODAL_AXIS_LOCK_Z, "AXIS_LOCK_Z", 0, "X Axis Correction", "Z axis correction (toggle)"}, - {FLY_MODAL_PRECISION_ENABLE, "PRECISION_ENABLE", 0, "Precision Enable", ""}, - {FLY_MODAL_PRECISION_DISABLE, "PRECISION_DISABLE", 0, "Precision Disable", ""}, + {FLY_MODAL_PRECISION_ENABLE, "PRECISION_ENABLE", 0, "Precision Enable", ""}, + {FLY_MODAL_PRECISION_DISABLE, "PRECISION_DISABLE", 0, "Precision Disable", ""}, - {0, NULL, 0, NULL, NULL}}; + {FLY_MODAL_FREELOOK_ENABLE, "FREELOOK_ENABLE", 0, "Rotation Enable", ""}, + {FLY_MODAL_FREELOOK_DISABLE, "FREELOOK_DISABLE", 0, "Rotation Disable", ""}, + + {0, NULL, 0, NULL, NULL}}; wmKeyMap *keymap= WM_modalkeymap_get(keyconf, "View3D Fly Modal"); @@ -122,10 +130,10 @@ void fly_modal_keymap(wmKeyConfig *keyconf) WM_modalkeymap_add_item(keymap, SPACEKEY, KM_PRESS, KM_ANY, 0, FLY_MODAL_CONFIRM); WM_modalkeymap_add_item(keymap, PADENTER, KM_PRESS, KM_ANY, 0, FLY_MODAL_CONFIRM); - WM_modalkeymap_add_item(keymap, PADPLUSKEY, KM_PRESS, 0, 0, FLY_MODAL_ACCELERATE); - WM_modalkeymap_add_item(keymap, PADMINUS, KM_PRESS, 0, 0, FLY_MODAL_DECELERATE); - WM_modalkeymap_add_item(keymap, WHEELUPMOUSE, KM_PRESS, 0, 0, FLY_MODAL_ACCELERATE); - WM_modalkeymap_add_item(keymap, WHEELDOWNMOUSE, KM_PRESS, 0, 0, FLY_MODAL_DECELERATE); + WM_modalkeymap_add_item(keymap, PADPLUSKEY, KM_PRESS, KM_ANY, 0, FLY_MODAL_ACCELERATE); + WM_modalkeymap_add_item(keymap, PADMINUS, KM_PRESS, KM_ANY, 0, FLY_MODAL_DECELERATE); + WM_modalkeymap_add_item(keymap, WHEELUPMOUSE, KM_PRESS, KM_ANY, 0, FLY_MODAL_ACCELERATE); + WM_modalkeymap_add_item(keymap, WHEELDOWNMOUSE, KM_PRESS, KM_ANY, 0, FLY_MODAL_DECELERATE); WM_modalkeymap_add_item(keymap, MIDDLEMOUSE, KM_PRESS, KM_ANY, 0, FLY_MODAL_PAN_ENABLE); WM_modalkeymap_add_item(keymap, MIDDLEMOUSE, KM_RELEASE, KM_ANY, 0, FLY_MODAL_PAN_DISABLE); /* XXX - Bug in the event system, middle mouse release doesnt work */ @@ -144,6 +152,9 @@ void fly_modal_keymap(wmKeyConfig *keyconf) WM_modalkeymap_add_item(keymap, LEFTSHIFTKEY, KM_PRESS, KM_ANY, 0, FLY_MODAL_PRECISION_ENABLE); WM_modalkeymap_add_item(keymap, LEFTSHIFTKEY, KM_RELEASE, KM_ANY, 0, FLY_MODAL_PRECISION_DISABLE); + WM_modalkeymap_add_item(keymap, LEFTCTRLKEY, KM_PRESS, KM_ANY, 0, FLY_MODAL_FREELOOK_ENABLE); + WM_modalkeymap_add_item(keymap, LEFTCTRLKEY, KM_RELEASE, KM_ANY, 0, FLY_MODAL_FREELOOK_DISABLE); + /* assign map to operators */ WM_modalkeymap_assign(keymap, "VIEW3D_OT_fly"); } @@ -158,8 +169,9 @@ typedef struct FlyInfo { wmTimer *timer; /* needed for redraws */ short state; - short use_precision; short redraw; + unsigned char use_precision; + unsigned char use_freelook; /* if the user presses shift they can look about without movinf the direction there looking */ int mval[2]; /* latest 2D mouse values */ wmNDOFMotionData* ndof; /* latest 3D mouse values */ @@ -289,7 +301,8 @@ static int initFlyInfo (bContext *C, FlyInfo *fly, wmOperator *op, wmEvent *even fly->xlock_momentum=0.0f; fly->zlock_momentum=0.0f; fly->grid= 1.0f; - fly->use_precision= 0; + fly->use_precision= FALSE; + fly->use_freelook= FALSE; #ifdef NDOF_FLY_DRAW_TOOMUCH fly->redraw= 1; @@ -516,10 +529,7 @@ static void flyEvent(FlyInfo *fly, wmEvent *event) fly->speed= 0.0f; } else { - if (event->shift) - fly->speed += fly->grid*time_wheel * 0.1f; - else - fly->speed += fly->grid*time_wheel; + fly->speed += fly->grid*time_wheel * (fly->use_precision ? 0.1f : 1.0f); } break; } @@ -537,10 +547,7 @@ static void flyEvent(FlyInfo *fly, wmEvent *event) fly->speed=0; } else { - if (event->shift) - fly->speed-= fly->grid*time_wheel * 0.1f; - else - fly->speed-= fly->grid*time_wheel; + fly->speed-= fly->grid*time_wheel * (fly->use_precision ? 0.1f : 1.0f); } break; } @@ -605,6 +612,13 @@ static void flyEvent(FlyInfo *fly, wmEvent *event) case FLY_MODAL_PRECISION_DISABLE: fly->use_precision= FALSE; break; + + case FLY_MODAL_FREELOOK_ENABLE: + fly->use_freelook= TRUE; + break; + case FLY_MODAL_FREELOOK_DISABLE: + fly->use_freelook= FALSE; + break; } } } @@ -704,8 +718,6 @@ static int flyApply(bContext *C, FlyInfo *fly) // cent_orig[2], /* view center */ //XXX- can avoid using // cent[2], /* view center modified */ xmargin, ymargin; /* x and y margin are define the safe area where the mouses movement wont rotate the view */ - unsigned char - apply_rotation= 1; /* if the user presses shift they can look about without movinf the direction there looking*/ #ifdef NDOF_FLY_DEBUG static unsigned int iteration = 1; @@ -888,7 +900,7 @@ static int flyApply(bContext *C, FlyInfo *fly) } - if (apply_rotation) { + if (!fly->use_freelook) { /* Normal operation */ /* define dvec, view direction vector */ dvec_tmp[0]= dvec_tmp[1]= dvec_tmp[2]= 0.0f; @@ -896,9 +908,15 @@ static int flyApply(bContext *C, FlyInfo *fly) dvec_tmp[fly->axis]= 1.0f; mul_m3_v3(mat, dvec_tmp); - - mul_v3_fl(dvec_tmp, fly->speed * time_redraw * 0.25f); } + else { + normalize_v3_v3(dvec_tmp, fly->dvec_prev); + if(fly->speed < 0.0f) { + negate_v3(dvec_tmp); + } + } + + mul_v3_fl(dvec_tmp, fly->speed * time_redraw * 0.25f); } /* impose a directional lag */ @@ -967,11 +985,9 @@ static int flyApply_ndof(bContext *C, FlyInfo *fly) float speed = 10.f; /* blender units per second */ /* ^^ this is ok for default cube scene, but should scale with.. something */ - float trans[3] = { - lateral_sensitivity * ndof->tvec[0], - vertical_sensitivity * ndof->tvec[1], - forward_sensitivity * ndof->tvec[2] - }; + float trans[3] = {lateral_sensitivity * ndof->tvec[0], + vertical_sensitivity * ndof->tvec[1], + forward_sensitivity * ndof->tvec[2]}; if (fly->use_precision) speed *= 0.2f; -- cgit v1.2.3 From 2d5dd02db86813fcf984dbb9d2a90c8bf2ee5f24 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 25 Sep 2011 04:55:04 +0000 Subject: correction to armature drawing code, was implicitly casting the bone flag to a short when it contains flags in the int range. also was converting pose bone constflag to an int which is harmless but may as well not to it. --- source/blender/editors/space_view3d/drawarmature.c | 24 +++++++++++----------- 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'source') diff --git a/source/blender/editors/space_view3d/drawarmature.c b/source/blender/editors/space_view3d/drawarmature.c index fc35ab93f70..210d6d344cd 100644 --- a/source/blender/editors/space_view3d/drawarmature.c +++ b/source/blender/editors/space_view3d/drawarmature.c @@ -146,7 +146,7 @@ static void cp_shade_color3ub (unsigned char cp[3], const int offset) } /* This function sets the gl-color for coloring a certain bone (based on bcolor) */ -static short set_pchan_glColor (short colCode, int boneflag, int constflag) +static short set_pchan_glColor (short colCode, int boneflag, short constflag) { switch (colCode) { case PCHAN_COLOR_NORMAL: @@ -752,7 +752,7 @@ static void draw_sphere_bone_dist(float smat[][4], float imat[][4], bPoseChannel /* smat, imat = mat & imat to draw screenaligned */ -static void draw_sphere_bone_wire(float smat[][4], float imat[][4], int armflag, int boneflag, int constflag, unsigned int id, bPoseChannel *pchan, EditBone *ebone) +static void draw_sphere_bone_wire(float smat[][4], float imat[][4], int armflag, int boneflag, short constflag, unsigned int id, bPoseChannel *pchan, EditBone *ebone) { float head, tail /*, length*/; float *headvec, *tailvec, dirvec[3]; @@ -861,7 +861,7 @@ static void draw_sphere_bone_wire(float smat[][4], float imat[][4], int armflag, } /* does wire only for outline selecting */ -static void draw_sphere_bone(int dt, int armflag, int boneflag, int constflag, unsigned int id, bPoseChannel *pchan, EditBone *ebone) +static void draw_sphere_bone(int dt, int armflag, int boneflag, short constflag, unsigned int id, bPoseChannel *pchan, EditBone *ebone) { GLUquadricObj *qobj; float head, tail, length; @@ -991,7 +991,7 @@ static GLubyte bm_dot5[]= {0x0, 0x0, 0x10, 0x38, 0x7c, 0x38, 0x10, 0x0}; static GLubyte bm_dot7[]= {0x0, 0x38, 0x7C, 0xFE, 0xFE, 0xFE, 0x7C, 0x38}; -static void draw_line_bone(int armflag, int boneflag, int constflag, unsigned int id, bPoseChannel *pchan, EditBone *ebone) +static void draw_line_bone(int armflag, int boneflag, short constflag, unsigned int id, bPoseChannel *pchan, EditBone *ebone) { float length; @@ -1125,7 +1125,7 @@ static void draw_b_bone_boxes(int dt, bPoseChannel *pchan, float xwidth, float l } } -static void draw_b_bone(int dt, int armflag, int boneflag, int constflag, unsigned int id, bPoseChannel *pchan, EditBone *ebone) +static void draw_b_bone(int dt, int armflag, int boneflag, short constflag, unsigned int id, bPoseChannel *pchan, EditBone *ebone) { float xwidth, length, zwidth; @@ -1238,7 +1238,7 @@ static void draw_wire_bone_segments(bPoseChannel *pchan, Mat4 *bbones, float len } } -static void draw_wire_bone(int dt, int armflag, int boneflag, int constflag, unsigned int id, bPoseChannel *pchan, EditBone *ebone) +static void draw_wire_bone(int dt, int armflag, int boneflag, short constflag, unsigned int id, bPoseChannel *pchan, EditBone *ebone) { Mat4 *bbones = NULL; int segments = 0; @@ -1288,7 +1288,7 @@ static void draw_wire_bone(int dt, int armflag, int boneflag, int constflag, uns draw_wire_bone_segments(pchan, bbones, length, segments); } -static void draw_bone(int dt, int armflag, int boneflag, int constflag, unsigned int id, float length) +static void draw_bone(int dt, int armflag, int boneflag, short constflag, unsigned int id, float length) { /* Draw a 3d octahedral bone, we use normalized space based on length, @@ -1659,7 +1659,7 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base, float smat[4][4], imat[4][4], bmat[4][4]; int index= -1; short do_dashed= 3, draw_wire= 0; - short flag, constflag; + int flag; /* being set below */ arm->layer_used= 0; @@ -1880,6 +1880,7 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base, ((G.f & G_PICKSEL)==0 || (bone->flag & BONE_UNSELECTABLE)==0) ) { if (bone->layer & arm->layer) { + const short constflag= pchan->constflag; if ((do_dashed & 1) && (pchan->parent)) { /* Draw a line from our root to the parent's tip * - only if V3D_HIDE_HELPLINES is enabled... @@ -1901,16 +1902,16 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base, * - only if temporary chain (i.e. "autoik") */ if (arm->flag & ARM_POSEMODE) { - if (pchan->constflag & PCHAN_HAS_IK) { + if (constflag & PCHAN_HAS_IK) { if (bone->flag & BONE_SELECTED) { - if (pchan->constflag & PCHAN_HAS_TARGET) glColor3ub(200, 120, 0); + if (constflag & PCHAN_HAS_TARGET) glColor3ub(200, 120, 0); else glColor3ub(200, 200, 50); // add theme! glLoadName(index & 0xFFFF); pchan_draw_IK_root_lines(pchan, !(do_dashed & 2)); } } - else if (pchan->constflag & PCHAN_HAS_SPLINEIK) { + else if (constflag & PCHAN_HAS_SPLINEIK) { if (bone->flag & BONE_SELECTED) { glColor3ub(150, 200, 50); // add theme! @@ -1935,7 +1936,6 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base, flag |= BONE_DRAW_ACTIVE; /* extra draw service for pose mode */ - constflag= pchan->constflag; /* set color-set to use */ set_pchan_colorset(ob, pchan); -- cgit v1.2.3 From 0f21ecdb166d73e0b4786cd9eb625f901d48c1bb Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 25 Sep 2011 05:48:16 +0000 Subject: added bone envelope to the editbone UI, also use more BLI_math functions for armature drawing. --- source/blender/editors/space_view3d/drawarmature.c | 52 ++++++++-------------- .../blender/editors/space_view3d/view3d_buttons.c | 1 + 2 files changed, 19 insertions(+), 34 deletions(-) (limited to 'source') diff --git a/source/blender/editors/space_view3d/drawarmature.c b/source/blender/editors/space_view3d/drawarmature.c index 210d6d344cd..3f45e32937d 100644 --- a/source/blender/editors/space_view3d/drawarmature.c +++ b/source/blender/editors/space_view3d/drawarmature.c @@ -697,13 +697,9 @@ static void draw_sphere_bone_dist(float smat[][4], float imat[][4], bPoseChannel vec[0]= - *(si+a) * dirvec[0] + *(co+a) * norvec[0]; vec[1]= - *(si+a) * dirvec[1] + *(co+a) * norvec[1]; vec[2]= - *(si+a) * dirvec[2] + *(co+a) * norvec[2]; - - vec1[0]= headvec[0] + head*vec[0]; - vec1[1]= headvec[1] + head*vec[1]; - vec1[2]= headvec[2] + head*vec[2]; - vec2[0]= headvec[0] + (head+dist)*vec[0]; - vec2[1]= headvec[1] + (head+dist)*vec[1]; - vec2[2]= headvec[2] + (head+dist)*vec[2]; + + madd_v3_v3v3fl(vec1, headvec, vec, head); + madd_v3_v3v3fl(vec2, headvec, vec, head + dist); glColor4ub(255, 255, 255, 50); glVertex3fv(vec1); @@ -715,13 +711,9 @@ static void draw_sphere_bone_dist(float smat[][4], float imat[][4], bPoseChannel vec[0]= *(si+a) * dirvec[0] + *(co+a) * norvec[0]; vec[1]= *(si+a) * dirvec[1] + *(co+a) * norvec[1]; vec[2]= *(si+a) * dirvec[2] + *(co+a) * norvec[2]; - - vec1[0]= tailvec[0] + tail*vec[0]; - vec1[1]= tailvec[1] + tail*vec[1]; - vec1[2]= tailvec[2] + tail*vec[2]; - vec2[0]= tailvec[0] + (tail+dist)*vec[0]; - vec2[1]= tailvec[1] + (tail+dist)*vec[1]; - vec2[2]= tailvec[2] + (tail+dist)*vec[2]; + + madd_v3_v3v3fl(vec1, tailvec, vec, tail); + madd_v3_v3v3fl(vec2, tailvec, vec, tail + dist); //glColor4ub(255, 255, 255, 50); glVertex3fv(vec1); @@ -733,14 +725,10 @@ static void draw_sphere_bone_dist(float smat[][4], float imat[][4], bPoseChannel vec[0]= - *(si) * dirvec[0] + *(co) * norvec[0]; vec[1]= - *(si) * dirvec[1] + *(co) * norvec[1]; vec[2]= - *(si) * dirvec[2] + *(co) * norvec[2]; - - vec1[0]= headvec[0] + head*vec[0]; - vec1[1]= headvec[1] + head*vec[1]; - vec1[2]= headvec[2] + head*vec[2]; - vec2[0]= headvec[0] + (head+dist)*vec[0]; - vec2[1]= headvec[1] + (head+dist)*vec[1]; - vec2[2]= headvec[2] + (head+dist)*vec[2]; - + + madd_v3_v3v3fl(vec1, headvec, vec, head); + madd_v3_v3v3fl(vec2, headvec, vec, head + dist); + //glColor4ub(255, 255, 255, 50); glVertex3fv(vec1); //glColor4ub(255, 255, 255, 0); @@ -839,21 +827,17 @@ static void draw_sphere_bone_wire(float smat[][4], float imat[][4], int armflag, glLoadName(id | BONESEL_BONE); glBegin(GL_LINES); - vec[0]= headvec[0] + norvech[0]; - vec[1]= headvec[1] + norvech[1]; - vec[2]= headvec[2] + norvech[2]; + + add_v3_v3v3(vec, headvec, norvech); glVertex3fv(vec); - vec[0]= tailvec[0] + norvect[0]; - vec[1]= tailvec[1] + norvect[1]; - vec[2]= tailvec[2] + norvect[2]; + + add_v3_v3v3(vec, tailvec, norvect); glVertex3fv(vec); - vec[0]= headvec[0] - norvech[0]; - vec[1]= headvec[1] - norvech[1]; - vec[2]= headvec[2] - norvech[2]; + + sub_v3_v3v3(vec, headvec, norvech); glVertex3fv(vec); - vec[0]= tailvec[0] - norvect[0]; - vec[1]= tailvec[1] - norvect[1]; - vec[2]= tailvec[2] - norvect[2]; + + sub_v3_v3v3(vec, tailvec, norvect); glVertex3fv(vec); glEnd(); diff --git a/source/blender/editors/space_view3d/view3d_buttons.c b/source/blender/editors/space_view3d/view3d_buttons.c index 6c69e816b30..117dfda4551 100644 --- a/source/blender/editors/space_view3d/view3d_buttons.c +++ b/source/blender/editors/space_view3d/view3d_buttons.c @@ -986,6 +986,7 @@ static void v3d_editarmature_buts(uiLayout *layout, Object *ob) uiItemR(col, &eboneptr, "tail_radius", 0, "Radius", ICON_NONE); uiItemR(col, &eboneptr, "roll", 0, "Roll", ICON_NONE); + uiItemR(col, &eboneptr, "envelope_distance", 0, "Envelope", ICON_NONE); } static void v3d_editmetaball_buts(uiLayout *layout, Object *ob) -- cgit v1.2.3 From 58a74bc87faf30b036d3088b8f741b353296b6a4 Mon Sep 17 00:00:00 2001 From: Mitchell Stokes Date: Sun, 25 Sep 2011 07:03:20 +0000 Subject: BGE Animations: Fixing various Action Actuator compatibility issues reported by Dalai in issue #28723. --- source/gameengine/Converter/BL_ActionActuator.cpp | 31 ++++++++++------------- 1 file changed, 13 insertions(+), 18 deletions(-) (limited to 'source') diff --git a/source/gameengine/Converter/BL_ActionActuator.cpp b/source/gameengine/Converter/BL_ActionActuator.cpp index 895def17e8e..557b4aa7f11 100644 --- a/source/gameengine/Converter/BL_ActionActuator.cpp +++ b/source/gameengine/Converter/BL_ActionActuator.cpp @@ -226,10 +226,7 @@ bool BL_ActionActuator::Update(double curtime, bool frame) break; } - // Continue only really makes sense for play stop and flipper. All other modes go until they are complete. - if (m_flag & ACT_FLAG_CONTINUE && - (m_playtype == ACT_ACTION_LOOP_STOP || - m_playtype == ACT_ACTION_FLIPPER)) + if (m_flag & ACT_FLAG_CONTINUE) bUseContinue = true; @@ -244,12 +241,6 @@ bool BL_ActionActuator::Update(double curtime, bool frame) if (m_flag & ACT_FLAG_ATTEMPT_PLAY) SetLocalTime(curtime); - if (bUseContinue && (m_flag & ACT_FLAG_ACTIVE)) - { - m_localtime = obj->GetActionFrame(m_layer); - ResetStartTime(curtime); - } - // Handle a frame property if it's defined if ((m_flag & ACT_FLAG_ACTIVE) && m_framepropname[0] != 0) { @@ -264,22 +255,25 @@ bool BL_ActionActuator::Update(double curtime, bool frame) } // Handle a finished animation - if ((m_flag & ACT_FLAG_PLAY_END) && obj->IsActionDone(m_layer)) + if ((m_flag & ACT_FLAG_PLAY_END) && (m_flag & ACT_FLAG_ACTIVE) && obj->IsActionDone(m_layer)) { m_flag &= ~ACT_FLAG_ACTIVE; m_flag &= ~ACT_FLAG_ATTEMPT_PLAY; - obj->StopAction(m_layer); return false; } // If a different action is playing, we've been overruled and are no longer active - if (obj->GetCurrentAction(m_layer) != m_action) + if (obj->GetCurrentAction(m_layer) != m_action && !obj->IsActionDone(m_layer)) m_flag &= ~ACT_FLAG_ACTIVE; if (bPositiveEvent || (m_flag & ACT_FLAG_ATTEMPT_PLAY && !(m_flag & ACT_FLAG_ACTIVE))) { if (bPositiveEvent) + { + if (obj->IsActionDone(m_layer)) + m_localtime = start; ResetStartTime(curtime); + } if (obj->PlayAction(m_action->id.name+2, start, end, m_layer, m_priority, m_blendin, playtype, m_layer_weight, m_ipo_flags)) { @@ -307,11 +301,6 @@ bool BL_ActionActuator::Update(double curtime, bool frame) return false; } - - m_localtime = obj->GetActionFrame(m_layer); - if (m_localtime < min(m_startframe, m_endframe) || m_localtime > max(m_startframe, m_endframe)) - m_localtime = m_startframe; - switch(m_playtype) { case ACT_ACTION_LOOP_STOP: @@ -340,6 +329,12 @@ bool BL_ActionActuator::Update(double curtime, bool frame) break; } } + + if (bUseContinue && (m_flag & ACT_FLAG_ACTIVE)) + { + m_localtime = obj->GetActionFrame(m_layer); + ResetStartTime(curtime); + } return true; } -- cgit v1.2.3 From 3379099a6ea212eb9bb08b9271940658b85fdcd4 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 25 Sep 2011 07:42:43 +0000 Subject: patch [#28616] Multiple particle systems support from Andrea Rugliancich (andrearu01) --- source/blender/makesrna/intern/rna_particle.c | 57 +++++++++++++++------------ 1 file changed, 31 insertions(+), 26 deletions(-) (limited to 'source') diff --git a/source/blender/makesrna/intern/rna_particle.c b/source/blender/makesrna/intern/rna_particle.c index 77fa975761f..5dc2f2ccac5 100644 --- a/source/blender/makesrna/intern/rna_particle.c +++ b/source/blender/makesrna/intern/rna_particle.c @@ -145,33 +145,38 @@ static void rna_ParticleHairKey_location_object_info(PointerRNA *ptr, ParticleSy *psmd_pt= NULL; *pa_pt= NULL; - /* weak, what about multiple particle systems? */ - for (md = ob->modifiers.first; md; md=md->next) { - if (md->type == eModifierType_ParticleSystem) - psmd= (ParticleSystemModifierData*) md; - } - - if (!psmd || !psmd->dm || !psmd->psys) { - return; - } - - psys= psmd->psys; - - /* not a very efficient way of getting hair key location data, - * but it's the best we've got at the present */ - - /* find the particle that corresponds with this HairKey */ - for(i=0, pa=psys->particles; itotpart; i++, pa++) { - - /* hairkeys are stored sequentially in memory, so we can find if - * it's the same particle by comparing pointers, without having - * to iterate over them all */ - if ((hkey >= pa->hair) && (hkey < pa->hair + pa->totkey)) - break; + /* given the pointer HairKey *hkey, we iterate over all particles in all + * particle systems in the object "ob" in order to find + *- the ParticleSystemData to which the HairKey (and hence the particle) + * belongs (will be stored in psmd_pt) + *- the ParticleData to which the HairKey belongs (will be stored in pa_pt) + * + * not a very efficient way of getting hair key location data, + * but it's the best we've got at the present + * + * IDEAS: include additional information in pointerRNA beforehand, + * for example a pointer to the ParticleStstemModifierData to which the + * hairkey belongs. + */ + + for (md= ob->modifiers.first; md; md=md->next) { + if (md->type == eModifierType_ParticleSystem) { + psmd= (ParticleSystemModifierData *) md; + if (psmd && psmd->dm && psmd->psys) { + psys = psmd->psys; + for(i= 0, pa= psys->particles; i < psys->totpart; i++, pa++) { + /* hairkeys are stored sequentially in memory, so we can + * find if it's the same particle by comparing pointers, + * without having to iterate over them all */ + if ((hkey >= pa->hair) && (hkey < pa->hair + pa->totkey)) { + *psmd_pt = psmd; + *pa_pt = pa; + return; + } + } + } + } } - - *psmd_pt= psmd; - *pa_pt= pa; } static void rna_ParticleHairKey_location_object_get(PointerRNA *ptr, float *values) -- cgit v1.2.3 From 9931c9442e16867ac2117a60b5a41839df76a454 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Sun, 25 Sep 2011 09:55:13 +0000 Subject: Minor: Other UI strings typos and tweaks. Also updated french po & mo. --- source/blender/makesrna/intern/rna_object.c | 94 +++++++++++++++-------- source/blender/makesrna/intern/rna_object_force.c | 21 ++--- source/blender/makesrna/intern/rna_scene.c | 20 ++--- 3 files changed, 84 insertions(+), 51 deletions(-) (limited to 'source') diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c index 1f3a134f14d..f271673d278 100644 --- a/source/blender/makesrna/intern/rna_object.c +++ b/source/blender/makesrna/intern/rna_object.c @@ -387,7 +387,8 @@ static void rna_Object_parent_type_set(PointerRNA *ptr, int value) ED_object_parent(ob, ob->parent, value, ob->parsubstr); } -static EnumPropertyItem *rna_Object_parent_type_itemf(bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *free) +static EnumPropertyItem *rna_Object_parent_type_itemf(bContext *UNUSED(C), PointerRNA *ptr, + PropertyRNA *UNUSED(prop), int *free) { Object *ob= (Object*)ptr->data; EnumPropertyItem *item= NULL; @@ -418,7 +419,8 @@ static EnumPropertyItem *rna_Object_parent_type_itemf(bContext *UNUSED(C), Point return item; } -static EnumPropertyItem *rna_Object_collision_bounds_itemf(bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *free) +static EnumPropertyItem *rna_Object_collision_bounds_itemf(bContext *UNUSED(C), PointerRNA *ptr, + PropertyRNA *UNUSED(prop), int *free) { Object *ob= (Object*)ptr->data; EnumPropertyItem *item= NULL; @@ -889,7 +891,8 @@ static void rna_GameObjectSettings_physics_type_set(PointerRNA *ptr, int value) switch (ob->body_type) { case OB_BODY_TYPE_SENSOR: ob->gameflag |= OB_SENSOR|OB_COLLISION|OB_GHOST; - ob->gameflag &= ~(OB_OCCLUDER|OB_DYNAMIC|OB_RIGID_BODY|OB_SOFT_BODY|OB_ACTOR|OB_ANISOTROPIC_FRICTION|OB_DO_FH|OB_ROT_FH|OB_COLLISION_RESPONSE|OB_NAVMESH); + ob->gameflag &= ~(OB_OCCLUDER|OB_DYNAMIC|OB_RIGID_BODY|OB_SOFT_BODY|OB_ACTOR|OB_ANISOTROPIC_FRICTION + |OB_DO_FH|OB_ROT_FH|OB_COLLISION_RESPONSE|OB_NAVMESH); break; case OB_BODY_TYPE_OCCLUDER: ob->gameflag |= OB_OCCLUDER; @@ -1172,7 +1175,8 @@ static void rna_Object_vgroup_remove(Object *ob, bDeformGroup *defgroup) WM_main_add_notifier(NC_OBJECT|ND_DRAW, ob); } -static void rna_VertexGroup_vertex_add(ID *id, bDeformGroup *def, ReportList *reports, int index_len, int *index, float weight, int assignmode) +static void rna_VertexGroup_vertex_add(ID *id, bDeformGroup *def, ReportList *reports, int index_len, + int *index, float weight, int assignmode) { Object *ob = (Object *)id; @@ -1353,7 +1357,8 @@ static void rna_def_object_game_settings(BlenderRNA *brna) {OB_BODY_TYPE_RIGID, "RIGID_BODY", 0, "Rigid Body", "Linear and angular physics"}, {OB_BODY_TYPE_SOFT, "SOFT_BODY", 0, "Soft Body", "Soft body"}, {OB_BODY_TYPE_OCCLUDER, "OCCLUDE", 0, "Occlude", "Occluder for optimizing scene rendering"}, - {OB_BODY_TYPE_SENSOR, "SENSOR", 0, "Sensor", "Collision Sensor, detects static and dynamic objects but not the other collision sensor objects"}, + {OB_BODY_TYPE_SENSOR, "SENSOR", 0, "Sensor", + "Collision Sensor, detects static and dynamic objects but not the other collision sensor objects"}, {OB_BODY_TYPE_NAVMESH, "NAVMESH", 0, "Navigation Mesh", "Navigation mesh"}, {0, NULL, 0, NULL, NULL}}; @@ -1371,7 +1376,8 @@ static void rna_def_object_game_settings(BlenderRNA *brna) prop= RNA_def_property(srna, "controllers", PROP_COLLECTION, PROP_NONE); RNA_def_property_struct_type(prop, "Controller"); - RNA_def_property_ui_text(prop, "Controllers", "Game engine controllers to process events, connecting sensor to actuators"); + RNA_def_property_ui_text(prop, "Controllers", + "Game engine controllers to process events, connecting sensor to actuators"); prop= RNA_def_property(srna, "actuators", PROP_COLLECTION, PROP_NONE); RNA_def_property_struct_type(prop, "Actuator"); @@ -1399,7 +1405,8 @@ static void rna_def_object_game_settings(BlenderRNA *brna) prop= RNA_def_property(srna, "physics_type", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "body_type"); RNA_def_property_enum_items(prop, body_type_items); - RNA_def_property_enum_funcs(prop, "rna_GameObjectSettings_physics_type_get", "rna_GameObjectSettings_physics_type_set", NULL); + RNA_def_property_enum_funcs(prop, "rna_GameObjectSettings_physics_type_get", + "rna_GameObjectSettings_physics_type_set", NULL); RNA_def_property_ui_text(prop, "Physics Type", "Selects the type of physical representation"); RNA_def_property_update(prop, NC_LOGIC, NULL); @@ -1475,7 +1482,7 @@ static void rna_def_object_game_settings(BlenderRNA *brna) /* is this used anywhere ? */ prop= RNA_def_property(srna, "use_activity_culling", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_negative_sdna(prop, NULL, "gameflag2", OB_NEVER_DO_ACTIVITY_CULLING); - RNA_def_property_ui_text(prop, "Lock Z Rotation Axis", "Disable simulation of angular motion along the Z axis"); + RNA_def_property_ui_text(prop, "Lock Z Rotation Axis", "Disable simulation of angular motion along the Z axis"); prop= RNA_def_property(srna, "use_material_physics_fh", PROP_BOOLEAN, PROP_NONE); @@ -1484,7 +1491,8 @@ static void rna_def_object_game_settings(BlenderRNA *brna) prop= RNA_def_property(srna, "use_rotate_from_normal", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "gameflag", OB_ROT_FH); - RNA_def_property_ui_text(prop, "Rotate From Normal", "Use face normal to rotate object, so that it points away from the surface"); + RNA_def_property_ui_text(prop, "Rotate From Normal", + "Use face normal to rotate object, so that it points away from the surface"); prop= RNA_def_property(srna, "form_factor", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "formfactor"); @@ -1498,7 +1506,9 @@ static void rna_def_object_game_settings(BlenderRNA *brna) prop= RNA_def_property(srna, "friction_coefficients", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "anisotropicFriction"); RNA_def_property_range(prop, 0.0, 1.0); - RNA_def_property_ui_text(prop, "Friction Coefficients", "Relative friction coefficient in the in the X, Y and Z directions, when anisotropic friction is enabled"); + RNA_def_property_ui_text(prop, "Friction Coefficients", + "Relative friction coefficient in the in the X, Y and Z directions, " + "when anisotropic friction is enabled"); prop= RNA_def_property(srna, "use_collision_bounds", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "gameflag", OB_BOUNDS); @@ -1518,7 +1528,8 @@ static void rna_def_object_game_settings(BlenderRNA *brna) prop= RNA_def_property(srna, "collision_margin", PROP_FLOAT, PROP_NONE|PROP_UNIT_LENGTH); RNA_def_property_float_sdna(prop, NULL, "margin"); RNA_def_property_range(prop, 0.0, 1.0); - RNA_def_property_ui_text(prop, "Collision Margin", "Extra margin around object for collision detection, small amount required for stability"); + RNA_def_property_ui_text(prop, "Collision Margin", + "Extra margin around object for collision detection, small amount required for stability"); prop= RNA_def_property(srna, "soft_body", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "bsoft"); @@ -1678,7 +1689,9 @@ static void rna_def_object_particle_systems(BlenderRNA *brna, PropertyRNA *cprop prop= RNA_def_property(srna, "active_index", PROP_INT, PROP_UNSIGNED); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); - RNA_def_property_int_funcs(prop, "rna_Object_active_particle_system_index_get", "rna_Object_active_particle_system_index_set", "rna_Object_active_particle_system_index_range"); + RNA_def_property_int_funcs(prop, "rna_Object_active_particle_system_index_get", + "rna_Object_active_particle_system_index_set", + "rna_Object_active_particle_system_index_range"); RNA_def_property_ui_text(prop, "Active Particle System Index", "Index of active particle system slot"); RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_particle_update"); } @@ -1701,14 +1714,16 @@ static void rna_def_object_vertex_groups(BlenderRNA *brna, PropertyRNA *cprop) prop= RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE); RNA_def_property_struct_type(prop, "VertexGroup"); - RNA_def_property_pointer_funcs(prop, "rna_Object_active_vertex_group_get", "rna_Object_active_vertex_group_set", NULL, NULL); + RNA_def_property_pointer_funcs(prop, "rna_Object_active_vertex_group_get", + "rna_Object_active_vertex_group_set", NULL, NULL); RNA_def_property_ui_text(prop, "Active Vertex Group", "Vertex groups of the object"); RNA_def_property_update(prop, NC_GEOM|ND_DATA, "rna_Object_internal_update_data"); prop= RNA_def_property(srna, "active_index", PROP_INT, PROP_NONE); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_int_sdna(prop, NULL, "actdef"); - RNA_def_property_int_funcs(prop, "rna_Object_active_vertex_group_index_get", "rna_Object_active_vertex_group_index_set", "rna_Object_active_vertex_group_index_range"); + RNA_def_property_int_funcs(prop, "rna_Object_active_vertex_group_index_get", "rna_Object_active_vertex_group_index_set", + "rna_Object_active_vertex_group_index_range"); RNA_def_property_ui_text(prop, "Active Vertex Group Index", "Active index in vertex group array"); RNA_def_property_update(prop, NC_GEOM|ND_DATA, "rna_Object_internal_update_data"); @@ -1791,7 +1806,8 @@ static void rna_def_object(BlenderRNA *brna) {ROT_MODE_YZX, "YZX", 0, "YZX Euler", "YZX Rotation Order - prone to Gimbal Lock"}, {ROT_MODE_ZXY, "ZXY", 0, "ZXY Euler", "ZXY Rotation Order - prone to Gimbal Lock"}, {ROT_MODE_ZYX, "ZYX", 0, "ZYX Euler", "ZYX Rotation Order - prone to Gimbal Lock"}, - {ROT_MODE_AXISANGLE, "AXIS_ANGLE", 0, "Axis Angle", "Axis Angle (W+XYZ), defines a rotation around some axis defined by 3D-Vector"}, + {ROT_MODE_AXISANGLE, "AXIS_ANGLE", 0, "Axis Angle", + "Axis Angle (W+XYZ), defines a rotation around some axis defined by 3D-Vector"}, {0, NULL, 0, NULL, NULL}}; static float default_quat[4] = {1,0,0,0}; /* default quaternion values */ @@ -1875,13 +1891,17 @@ static void rna_def_object(BlenderRNA *brna) prop= RNA_def_property(srna, "track_axis", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "trackflag"); RNA_def_property_enum_items(prop, track_items); - RNA_def_property_ui_text(prop, "Track Axis", "Axis that points in 'forward' direction (applies to DupliFrame when parent 'Follow' is enabled)"); + RNA_def_property_ui_text(prop, "Track Axis", + "Axis that points in 'forward' direction (applies to DupliFrame when " + "parent 'Follow' is enabled)"); RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_internal_update"); prop= RNA_def_property(srna, "up_axis", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "upflag"); RNA_def_property_enum_items(prop, up_items); - RNA_def_property_ui_text(prop, "Up Axis", "Axis that points in the upward direction (applies to DupliFrame when parent 'Follow' is enabled)"); + RNA_def_property_ui_text(prop, "Up Axis", + "Axis that points in the upward direction (applies to DupliFrame when " + "parent 'Follow' is enabled)"); RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_internal_update"); /* proxy */ @@ -1908,7 +1928,8 @@ static void rna_def_object(BlenderRNA *brna) prop= RNA_def_property(srna, "active_material_index", PROP_INT, PROP_UNSIGNED); RNA_def_property_int_sdna(prop, NULL, "actcol"); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); - RNA_def_property_int_funcs(prop, "rna_Object_active_material_index_get", "rna_Object_active_material_index_set", "rna_Object_active_material_index_range"); + RNA_def_property_int_funcs(prop, "rna_Object_active_material_index_get", "rna_Object_active_material_index_set", + "rna_Object_active_material_index_range"); RNA_def_property_ui_text(prop, "Active Material Index", "Index of active material slot"); RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING, NULL); @@ -1975,20 +1996,23 @@ static void rna_def_object(BlenderRNA *brna) prop= RNA_def_property(srna, "delta_rotation_euler", PROP_FLOAT, PROP_EULER); RNA_def_property_float_sdna(prop, NULL, "drot"); - RNA_def_property_ui_text(prop, "Delta Rotation (Euler)", "Extra rotation added to the rotation of the object (when using Euler rotations)"); + RNA_def_property_ui_text(prop, "Delta Rotation (Euler)", + "Extra rotation added to the rotation of the object (when using Euler rotations)"); RNA_def_property_update(prop, NC_OBJECT|ND_TRANSFORM, "rna_Object_internal_update"); prop= RNA_def_property(srna, "delta_rotation_quaternion", PROP_FLOAT, PROP_QUATERNION); RNA_def_property_float_sdna(prop, NULL, "dquat"); RNA_def_property_float_array_default(prop, default_quat); - RNA_def_property_ui_text(prop, "Delta Rotation (Quaternion)", "Extra rotation added to the rotation of the object (when using Quaternion rotations)"); + RNA_def_property_ui_text(prop, "Delta Rotation (Quaternion)", + "Extra rotation added to the rotation of the object (when using Quaternion rotations)"); RNA_def_property_update(prop, NC_OBJECT|ND_TRANSFORM, "rna_Object_internal_update"); #if 0 // XXX not supported well yet... prop= RNA_def_property(srna, "delta_rotation_axis_angle", PROP_FLOAT, PROP_AXISANGLE); RNA_def_property_float_sdna(prop, NULL, "dquat"); // FIXME: this is not a single field any more! (drotAxis and drotAngle) RNA_def_property_float_array_default(prop, default_axisAngle); - RNA_def_property_ui_text(prop, "Delta Rotation (Axis Angle)", "Extra rotation added to the rotation of the object (when using Axis-Angle rotations)"); + RNA_def_property_ui_text(prop, "Delta Rotation (Axis Angle)", + "Extra rotation added to the rotation of the object (when using Axis-Angle rotations)"); RNA_def_property_update(prop, NC_OBJECT|ND_TRANSFORM, "rna_Object_internal_update"); #endif @@ -2016,11 +2040,13 @@ static void rna_def_object(BlenderRNA *brna) prop= RNA_def_property(srna, "lock_rotation_w", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "protectflag", OB_LOCK_ROTW); RNA_def_property_ui_icon(prop, ICON_UNLOCKED, 1); - RNA_def_property_ui_text(prop, "Lock Rotation (4D Angle)", "Lock editing of 'angle' component of four-component rotations in the interface"); + RNA_def_property_ui_text(prop, "Lock Rotation (4D Angle)", + "Lock editing of 'angle' component of four-component rotations in the interface"); // XXX this needs a better name prop= RNA_def_property(srna, "lock_rotations_4d", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "protectflag", OB_LOCK_ROT4D); - RNA_def_property_ui_text(prop, "Lock Rotations (4D)", "Lock editing of four component rotations by components (instead of as Eulers)"); + RNA_def_property_ui_text(prop, "Lock Rotations (4D)", + "Lock editing of four component rotations by components (instead of as Eulers)"); prop= RNA_def_property(srna, "lock_scale", PROP_BOOLEAN, PROP_XYZ); RNA_def_property_boolean_sdna(prop, NULL, "protectflag", OB_LOCK_SCALEX); @@ -2252,11 +2278,12 @@ static void rna_def_object(BlenderRNA *brna) prop= RNA_def_property(srna, "use_time_offset_edit", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "ipoflag", OB_OFFS_OB); - RNA_def_property_ui_text(prop, "Time Offset Edit", "Use time offset when inserting keys and display time offset for F-Curve and action views"); + RNA_def_property_ui_text(prop, "Time Offset Edit", + "Use time offset when inserting keys and display time offset for F-Curve and action views"); prop= RNA_def_property(srna, "use_time_offset_parent", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "ipoflag", OB_OFFS_PARENT); - RNA_def_property_ui_text(prop, "Time Offset Parent", "Apply the time offset to this objects parent relationship"); + RNA_def_property_ui_text(prop, "Time Offset Parent", "Apply the time offset to this object's parent relationship"); RNA_def_property_update(prop, NC_OBJECT|ND_TRANSFORM, "rna_Object_internal_update"); prop= RNA_def_property(srna, "use_time_offset_particle", PROP_BOOLEAN, PROP_NONE); @@ -2266,7 +2293,7 @@ static void rna_def_object(BlenderRNA *brna) prop= RNA_def_property(srna, "use_time_offset_add_parent", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "ipoflag", OB_OFFS_PARENTADD); - RNA_def_property_ui_text(prop, "Time Offset Add Parent", "Add the parents time offset value"); + RNA_def_property_ui_text(prop, "Time Offset Add Parent", "Add the parent's time offset value"); RNA_def_property_update(prop, NC_OBJECT|ND_TRANSFORM, "rna_Object_internal_update"); /* drawing */ @@ -2278,7 +2305,7 @@ static void rna_def_object(BlenderRNA *brna) prop= RNA_def_property(srna, "show_bounds", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "dtx", OB_BOUNDBOX); - RNA_def_property_ui_text(prop, "Draw Bounds", "Displays the object's bounds"); + RNA_def_property_ui_text(prop, "Draw Bounds", "Display the object's bounds"); RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL); prop= RNA_def_property(srna, "draw_bounds_type", PROP_ENUM, PROP_NONE); @@ -2289,32 +2316,33 @@ static void rna_def_object(BlenderRNA *brna) prop= RNA_def_property(srna, "show_name", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "dtx", OB_DRAWNAME); - RNA_def_property_ui_text(prop, "Draw Name", "Displays the object's name"); + RNA_def_property_ui_text(prop, "Draw Name", "Display the object's name"); RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL); prop= RNA_def_property(srna, "show_axis", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "dtx", OB_AXIS); - RNA_def_property_ui_text(prop, "Draw Axis", "Displays the object's origin and axis"); + RNA_def_property_ui_text(prop, "Draw Axes", "Display the object's origin and axes"); RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL); prop= RNA_def_property(srna, "show_texture_space", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "dtx", OB_TEXSPACE); - RNA_def_property_ui_text(prop, "Draw Texture Space", "Displays the object's texture space"); + RNA_def_property_ui_text(prop, "Draw Texture Space", "Display the object's texture space"); RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL); prop= RNA_def_property(srna, "show_wire", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "dtx", OB_DRAWWIRE); - RNA_def_property_ui_text(prop, "Draw Wire", "Adds the object's wireframe over solid drawing"); + RNA_def_property_ui_text(prop, "Draw Wire", "Add the object's wireframe over solid drawing"); RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL); prop= RNA_def_property(srna, "show_transparent", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "dtx", OB_DRAWTRANSP); - RNA_def_property_ui_text(prop, "Draw Transparent", "Displays material transparency in the object (unsupported for duplicator drawing)"); + RNA_def_property_ui_text(prop, "Draw Transparent", + "Display material transparency in the object (unsupported for duplicator drawing)"); RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL); prop= RNA_def_property(srna, "show_x_ray", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "dtx", OB_DRAWXRAY); - RNA_def_property_ui_text(prop, "X-Ray", "Makes the object draw in front of others (unsupported for duplicator drawing)"); + RNA_def_property_ui_text(prop, "X-Ray", "Make the object draw in front of others (unsupported for duplicator drawing)"); RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL); /* Grease Pencil */ diff --git a/source/blender/makesrna/intern/rna_object_force.c b/source/blender/makesrna/intern/rna_object_force.c index cc086bca6d8..c046c222898 100644 --- a/source/blender/makesrna/intern/rna_object_force.c +++ b/source/blender/makesrna/intern/rna_object_force.c @@ -1049,18 +1049,21 @@ static void rna_def_field(BlenderRNA *brna) static EnumPropertyItem field_type_items[] = { {0, "NONE", 0, "None", ""}, - {PFIELD_FORCE, "FORCE", ICON_FORCE_FORCE, "Force", "Gives a radial field toward the center of object"}, - {PFIELD_WIND, "WIND", ICON_FORCE_WIND, "Wind", "Gives a constant force along the force objects local Z axis"}, - {PFIELD_VORTEX, "VORTEX", ICON_FORCE_VORTEX, "Vortex", "Gives a spiraling force that twists the force objects local Z axis"}, + {PFIELD_FORCE, "FORCE", ICON_FORCE_FORCE, "Force", "Radial field toward the center of object"}, + {PFIELD_WIND, "WIND", ICON_FORCE_WIND, "Wind", "Constant force along the force object's local Z axis"}, + {PFIELD_VORTEX, "VORTEX", ICON_FORCE_VORTEX, "Vortex", "Spiraling force that twists the force object's local Z axis"}, {PFIELD_MAGNET, "MAGNET", ICON_FORCE_MAGNETIC, "Magnetic", "Forcefield depends on the speed of the particles"}, - {PFIELD_HARMONIC, "HARMONIC", ICON_FORCE_HARMONIC, "Harmonic", "The source of this force field is the zero point of a harmonic oscillator"}, - {PFIELD_CHARGE, "CHARGE", ICON_FORCE_CHARGE, "Charge", "Spherical forcefield based on the charge of particles, only influences other charge force fields"}, - {PFIELD_LENNARDJ, "LENNARDJ", ICON_FORCE_LENNARDJONES, "Lennard-Jones", "Forcefield based on the Lennard-Jones potential"}, + {PFIELD_HARMONIC, "HARMONIC", ICON_FORCE_HARMONIC, "Harmonic", + "The source of this force field is the zero point of a harmonic oscillator"}, + {PFIELD_CHARGE, "CHARGE", ICON_FORCE_CHARGE, "Charge", + "Spherical forcefield based on the charge of particles, only influences other charge force fields"}, + {PFIELD_LENNARDJ, "LENNARDJ", ICON_FORCE_LENNARDJONES, "Lennard-Jones", + "Forcefield based on the Lennard-Jones potential"}, {PFIELD_TEXTURE, "TEXTURE", ICON_FORCE_TEXTURE, "Texture", "Forcefield based on a texture"}, - {PFIELD_GUIDE, "GUIDE", ICON_FORCE_CURVE, "Curve Guide", "Creates a force along a curve object"}, + {PFIELD_GUIDE, "GUIDE", ICON_FORCE_CURVE, "Curve Guide", "Create a force along a curve object"}, {PFIELD_BOID, "BOID", ICON_FORCE_BOID, "Boid", ""}, - {PFIELD_TURBULENCE, "TURBULENCE", ICON_FORCE_TURBULENCE, "Turbulence", "Creates turbulence with a noise field"}, - {PFIELD_DRAG, "DRAG", ICON_FORCE_DRAG, "Drag", "Creates a force that dampens motion"}, + {PFIELD_TURBULENCE, "TURBULENCE", ICON_FORCE_TURBULENCE, "Turbulence", "Create turbulence with a noise field"}, + {PFIELD_DRAG, "DRAG", ICON_FORCE_DRAG, "Drag", "Create a force that dampens motion"}, {0, NULL, 0, NULL, NULL}}; static EnumPropertyItem falloff_items[] = { diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index 774e21297da..a9460429c0b 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -1392,7 +1392,7 @@ static void rna_def_unit_settings(BlenderRNA *brna) {0, NULL, 0, NULL, NULL}}; static EnumPropertyItem rotation_units[] = { - {0, "DEGREES", 0, "Degrees", "Use degrees for measuring rotation"}, + {0, "DEGREES", 0, "Degrees", "Use degrees for measuring angles and rotations"}, {USER_UNIT_ROT_RADIANS, "RADIANS", 0, "Radians", ""}, {0, NULL, 0, NULL, NULL}}; @@ -1506,7 +1506,7 @@ void rna_def_render_layer_common(StructRNA *srna, int scene) prop= RNA_def_property(srna, "use_ztransp", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "layflag", SCE_LAY_ZTRA); - RNA_def_property_ui_text(prop, "ZTransp", "Render Z-Transparent faces in this Layer (On top of Solid and Halos)"); + RNA_def_property_ui_text(prop, "ZTransp", "Render Z-Transparent faces in this Layer (on top of Solid and Halos)"); if(scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); else RNA_def_property_clear_flag(prop, PROP_EDITABLE); @@ -2380,7 +2380,9 @@ static void rna_def_scene_render_data(BlenderRNA *brna) prop= RNA_def_property(srna, "color_mode", PROP_ENUM, PROP_NONE); RNA_def_property_enum_bitflag_sdna(prop, NULL, "planes"); RNA_def_property_enum_items(prop, image_color_mode_items); - RNA_def_property_ui_text(prop, "Color Mode", "Choose BW for saving greyscale images, RGB for saving red, green and blue channels, AND RGBA for saving red, green, blue + alpha channels"); + RNA_def_property_ui_text(prop, "Color Mode", + "Choose BW for saving greyscale images, RGB for saving red, green and blue channels, " + "and RGBA for saving red, green, blue and alpha channels"); RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); prop= RNA_def_property(srna, "resolution_x", PROP_INT, PROP_NONE); @@ -2431,7 +2433,7 @@ static void rna_def_scene_render_data(BlenderRNA *brna) prop= RNA_def_property(srna, "file_quality", PROP_INT, PROP_PERCENTAGE); RNA_def_property_int_sdna(prop, NULL, "quality"); RNA_def_property_range(prop, 0, 100); /* 0 is needed for compression. */ - RNA_def_property_ui_text(prop, "Quality", "Quality of JPEG images, AVI Jpeg and SGI movies, Compression for PNG's"); + RNA_def_property_ui_text(prop, "Quality", "Quality of JPEG images, AVI Jpeg and SGI movies, compression for PNG's"); RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); /* Tiff */ @@ -2590,19 +2592,19 @@ static void rna_def_scene_render_data(BlenderRNA *brna) prop= RNA_def_property(srna, "ffmpeg_video_bitrate", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "ffcodecdata.video_bitrate"); RNA_def_property_range(prop, 1, 14000); - RNA_def_property_ui_text(prop, "Bitrate", "Video bitrate(kb/s)"); + RNA_def_property_ui_text(prop, "Bitrate", "Video bitrate (kb/s)"); RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); prop= RNA_def_property(srna, "ffmpeg_minrate", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "ffcodecdata.rc_min_rate"); RNA_def_property_range(prop, 0, 9000); - RNA_def_property_ui_text(prop, "Min Rate", "Rate control: min rate(kb/s)"); + RNA_def_property_ui_text(prop, "Min Rate", "Rate control: min rate (kb/s)"); RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); prop= RNA_def_property(srna, "ffmpeg_maxrate", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "ffcodecdata.rc_max_rate"); RNA_def_property_range(prop, 1, 14000); - RNA_def_property_ui_text(prop, "Max Rate", "Rate control: max rate(kb/s)"); + RNA_def_property_ui_text(prop, "Max Rate", "Rate control: max rate (kb/s)"); RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); prop= RNA_def_property(srna, "ffmpeg_muxrate", PROP_INT, PROP_NONE); @@ -2646,7 +2648,7 @@ static void rna_def_scene_render_data(BlenderRNA *brna) RNA_def_property_int_sdna(prop, NULL, "ffcodecdata.audio_bitrate"); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_range(prop, 32, 384); - RNA_def_property_ui_text(prop, "Bitrate", "Audio bitrate(kb/s)"); + RNA_def_property_ui_text(prop, "Bitrate", "Audio bitrate (kb/s)"); RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); prop= RNA_def_property(srna, "ffmpeg_audio_volume", PROP_FLOAT, PROP_NONE); @@ -2669,7 +2671,7 @@ static void rna_def_scene_render_data(BlenderRNA *brna) RNA_def_property_enum_sdna(prop, NULL, "ffcodecdata.audio_channels"); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_enum_items(prop, audio_channel_items); - RNA_def_property_ui_text(prop, "Audio Channels", "Sets the audio channel count"); + RNA_def_property_ui_text(prop, "Audio Channels", "Audio channel count"); prop= RNA_def_property(srna, "fps", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "frs_sec"); -- cgit v1.2.3 From 558b646216feaa43abf44eb332d2449c68bf1b39 Mon Sep 17 00:00:00 2001 From: Alex Fraser Date: Sun, 25 Sep 2011 11:51:28 +0000 Subject: Committing patch #27442: Adaptive time step for fluid particles. The number of subframes can now be altered automatically while an SPH (fluid particle) simulation is running. --- source/blender/blenkernel/BKE_particle.h | 4 + source/blender/blenkernel/intern/particle.c | 1 + source/blender/blenkernel/intern/particle_system.c | 124 ++++++++++++++++++--- source/blender/blenloader/intern/readfile.c | 9 +- source/blender/makesdna/DNA_particle_types.h | 12 +- source/blender/makesrna/intern/rna_particle.c | 27 ++++- 6 files changed, 156 insertions(+), 21 deletions(-) (limited to 'source') diff --git a/source/blender/blenkernel/BKE_particle.h b/source/blender/blenkernel/BKE_particle.h index 5b565223ece..c417b1efe4f 100644 --- a/source/blender/blenkernel/BKE_particle.h +++ b/source/blender/blenkernel/BKE_particle.h @@ -80,6 +80,10 @@ typedef struct ParticleSimulationData { struct ParticleSystem *psys; struct ParticleSystemModifierData *psmd; struct ListBase *colliders; + /* Courant number. This is used to implement an adaptive time step. Only the + maximum value per time step is important. Only sph_integrate makes use of + this at the moment. Other solvers could, too. */ + float courant_num; } ParticleSimulationData; typedef struct ParticleTexture{ diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c index 82a2436a010..06fb2d3927c 100644 --- a/source/blender/blenkernel/intern/particle.c +++ b/source/blender/blenkernel/intern/particle.c @@ -3488,6 +3488,7 @@ static void default_particle_settings(ParticleSettings *part) part->totpart= 1000; part->grid_res= 10; part->timetweak= 1.0; + part->courant_target = 0.2; part->integrator= PART_INT_MIDPOINT; part->phystype= PART_PHYS_NEWTON; diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c index e1ea6e419d3..c0f1e3dd697 100644 --- a/source/blender/blenkernel/intern/particle_system.c +++ b/source/blender/blenkernel/intern/particle_system.c @@ -26,6 +26,9 @@ * * Contributor(s): Raul Fernandez Hernandez (Farsthary), Stephen Swhitehorn. * + * Adaptive time step + * Copyright 2011 AutoCRC + * * ***** END GPL LICENSE BLOCK ***** */ @@ -2321,6 +2324,10 @@ typedef struct SPHRangeData float massfac; int use_size; + + /* Same as SPHData::element_size */ + float element_size; + float flow[3]; } SPHRangeData; typedef struct SPHData { ParticleSystem *psys[10]; @@ -2328,12 +2335,17 @@ typedef struct SPHData { float mass; EdgeHash *eh; float *gravity; + /* Average distance to neighbours (other particles in the support domain), + for calculating the Courant number (adaptive time step). */ + float element_size; + float flow[3]; }SPHData; static void sph_density_accum_cb(void *userdata, int index, float squared_dist) { SPHRangeData *pfr = (SPHRangeData *)userdata; ParticleData *npa = pfr->npsys->particles + index; float q; + float dist; if(npa == pfr->pa || squared_dist < FLT_EPSILON) return; @@ -2344,12 +2356,16 @@ static void sph_density_accum_cb(void *userdata, int index, float squared_dist) */ if(pfr->tot_neighbors >= 128) return; - + pfr->neighbors[pfr->tot_neighbors].index = index; pfr->neighbors[pfr->tot_neighbors].psys = pfr->npsys; pfr->tot_neighbors++; - q = (1.f - sqrtf(squared_dist)/pfr->h) * pfr->massfac; + dist = sqrtf(squared_dist); + q = (1.f - dist/pfr->h) * pfr->massfac; + + add_v3_v3(pfr->flow, npa->state.vel); + pfr->element_size += dist; if(pfr->use_size) q *= npa->size; @@ -2397,6 +2413,8 @@ static void sph_force_cb(void *sphdata_v, ParticleKey *state, float *force, floa pfr.density = pfr.near_density = 0.f; pfr.h = h; pfr.pa = pa; + pfr.element_size = fluid->radius; + pfr.flow[0] = pfr.flow[1] = pfr.flow[2] = 0.0f; for(i=0; i<10 && psys[i]; i++) { pfr.npsys = psys[i]; @@ -2405,6 +2423,14 @@ static void sph_force_cb(void *sphdata_v, ParticleKey *state, float *force, floa BLI_bvhtree_range_query(psys[i]->bvhtree, state->co, h, sph_density_accum_cb, &pfr); } + if (pfr.tot_neighbors > 0) { + pfr.element_size /= pfr.tot_neighbors; + mul_v3_fl(pfr.flow, 1.0f / pfr.tot_neighbors); + } else { + pfr.element_size = MAXFLOAT; + } + sphdata->element_size = pfr.element_size; + VECCOPY(sphdata->flow, pfr.flow); pressure = stiffness * (pfr.density - rest_density); near_pressure = stiffness_near_fac * pfr.near_density; @@ -2471,7 +2497,7 @@ static void sph_force_cb(void *sphdata_v, ParticleKey *state, float *force, floa madd_v3_v3fl(force, gravity, fluid->buoyancy * (pfr.density-rest_density)); } -static void sph_integrate(ParticleSimulationData *sim, ParticleData *pa, float dfra, float *gravity, EdgeHash *springhash){ +static void sph_integrate(ParticleSimulationData *sim, ParticleData *pa, float dfra, float *gravity, EdgeHash *springhash, float *element_size, float flow[3]) { ParticleTarget *pt; int i; @@ -2491,6 +2517,7 @@ static void sph_integrate(ParticleSimulationData *sim, ParticleData *pa, float d sphdata.gravity = gravity; sphdata.mass = pa_mass; sphdata.eh = springhash; + //sphdata.element_size and sphdata.flow are set in the callback. /* restore previous state and treat gravity & effectors as external acceleration*/ sub_v3_v3v3(effector_acceleration, pa->state.vel, pa->prev_state.vel); @@ -2499,6 +2526,8 @@ static void sph_integrate(ParticleSimulationData *sim, ParticleData *pa, float d copy_particle_key(&pa->state, &pa->prev_state, 0); integrate_particle(part, pa, dtime, effector_acceleration, sph_force_cb, &sphdata); + *element_size = sphdata.element_size; + VECCOPY(flow, sphdata.flow); } /************************************************/ @@ -3582,6 +3611,49 @@ static void save_hair(ParticleSimulationData *sim, float UNUSED(cfra)){ root->co[0] = root->co[1] = root->co[2] = 0.0f; } } + +/* Code for an adaptive time step based on the Courant-Friedrichs-Lewy + condition. */ +#define MIN_TIMESTEP 1.0f / 101.0f +/* Tolerance of 1.5 means the last subframe neither favours growing nor + shrinking (e.g if it were 1.3, the last subframe would tend to be too + small). */ +#define TIMESTEP_EXPANSION_TOLERANCE 1.5f + +/* Calculate the speed of the particle relative to the local scale of the + simulation. This should be called once per particle during a simulation + step, after the velocity has been updated. element_size defines the scale of + the simulation, and is typically the distance to neighbourning particles. */ +void update_courant_num(ParticleSimulationData *sim, ParticleData *pa, + float dtime, float element_size, float flow[3]) +{ + float relative_vel[3]; + float speed; + + sub_v3_v3v3(relative_vel, pa->state.vel, flow); + speed = len_v3(relative_vel); + if (sim->courant_num < speed * dtime / element_size) + sim->courant_num = speed * dtime / element_size; +} +/* Update time step size to suit current conditions. */ +float update_timestep(ParticleSystem *psys, ParticleSimulationData *sim, + float t_frac) +{ + if (sim->courant_num == 0.0f) + psys->dt_frac = 1.0f; + else + psys->dt_frac *= (psys->part->courant_target / sim->courant_num); + CLAMP(psys->dt_frac, MIN_TIMESTEP, 1.0f); + + /* Sync with frame end if it's close. */ + if (t_frac == 1.0f) + return psys->dt_frac; + else if (t_frac + (psys->dt_frac * TIMESTEP_EXPANSION_TOLERANCE) >= 1.0f) + return 1.0f - t_frac; + else + return psys->dt_frac; +} + /************************************************/ /* System Core */ /************************************************/ @@ -3597,7 +3669,7 @@ static void dynamics_step(ParticleSimulationData *sim, float cfra) /* frame & time changes */ float dfra, dtime; float birthtime, dietime; - + /* where have we gone in time since last time */ dfra= cfra - psys->cfra; @@ -3735,6 +3807,7 @@ static void dynamics_step(ParticleSimulationData *sim, float cfra) { EdgeHash *springhash = sph_springhash_build(psys); float *gravity = NULL; + float element_size, flow[3]; if(psys_uses_gravity(sim)) gravity = sim->scene->physics_settings.gravity; @@ -3744,13 +3817,17 @@ static void dynamics_step(ParticleSimulationData *sim, float cfra) basic_integrate(sim, p, pa->state.time, cfra); /* actual fluids calculations */ - sph_integrate(sim, pa, pa->state.time, gravity, springhash); + sph_integrate(sim, pa, pa->state.time, gravity, springhash, + &element_size, flow); if(sim->colliders) collision_check(sim, p, pa->state.time, cfra); /* SPH particles are not physical particles, just interpolation particles, thus rotation has not a direct sense for them */ basic_rotate(part, pa, pa->state.time, timestep); + + if (part->time_flag & PART_TIME_AUTOSF) + update_courant_num(sim, pa, dtime, element_size, flow); } sph_springs_modify(psys, timestep); @@ -3952,6 +4029,7 @@ static int emit_particles(ParticleSimulationData *sim, PTCacheID *pid, float UNU return totpart - oldtotpart; } + /* Calculates the next state for all particles of the system * In particles code most fra-ending are frames, time-ending are fra*timestep (seconds) * 1. Emit particles @@ -4057,23 +4135,39 @@ static void system_step(ParticleSimulationData *sim, float cfra) } if(psys->totpart) { - int dframe, subframe = 0, totframesback = 0, totsubframe = part->subframes+1; - float fraction; - + int dframe, totframesback = 0; + float t_frac, dt_frac; + /* handle negative frame start at the first frame by doing * all the steps before the first frame */ if((int)cfra == startframe && part->sta < startframe) totframesback = (startframe - (int)part->sta); - + + if (!(part->time_flag & PART_TIME_AUTOSF)) { + /* Constant time step */ + psys->dt_frac = 1.0f / (float) (part->subframes + 1); + } else if ((int)cfra == startframe) { + /* Variable time step; use a very conservative value at the start. + * If it doesn't need to be so small, it will quickly grow. */ + psys->dt_frac = 1.0; + } else if (psys->dt_frac < MIN_TIMESTEP) { + psys->dt_frac = MIN_TIMESTEP; + } + for(dframe=-totframesback; dframe<=0; dframe++) { - /* ok now we're all set so let's go */ - for (subframe = 1; subframe <= totsubframe; subframe++) { - fraction = (float)subframe/(float)totsubframe; - dynamics_step(sim, cfra+dframe+fraction - 1.f); - psys->cfra = cfra+dframe+fraction - 1.f; + /* simulate each subframe */ + dt_frac = psys->dt_frac; + for (t_frac = dt_frac; t_frac <= 1.0f; t_frac += dt_frac) { + sim->courant_num = 0.0f; + dynamics_step(sim, cfra+dframe+t_frac - 1.f); + psys->cfra = cfra+dframe+t_frac - 1.f; +#if 0 + printf("%f,%f,%f,%f\n", cfra+dframe+t_frac - 1.f, t_frac, dt_frac, sim->courant_num); +#endif + if (part->time_flag & PART_TIME_AUTOSF) + dt_frac = update_timestep(psys, sim, t_frac); } } - } /* 4. only write cache starting from second frame */ diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index ecd3c9b5dad..d62f6657e41 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -12066,7 +12066,14 @@ static void do_versions(FileData *fd, Library *lib, Main *main) /* put compatibility code here until next subversion bump */ { - + { + /* Adaptive time step for particle systems */ + ParticleSettings *part; + for (part = main->particle.first; part; part = part->id.next) { + part->courant_target = 0.2; + part->time_flag &= ~PART_TIME_AUTOSF; + } + } } //set defaults for obstacle avoidance, recast data diff --git a/source/blender/makesdna/DNA_particle_types.h b/source/blender/makesdna/DNA_particle_types.h index 69ee530c0b6..9fec5207dbb 100644 --- a/source/blender/makesdna/DNA_particle_types.h +++ b/source/blender/makesdna/DNA_particle_types.h @@ -179,10 +179,12 @@ typedef struct ParticleSettings { float simplify_rate, simplify_transition; float simplify_viewport; - /* general values */ + /* time and emission */ float sta, end, lifetime, randlife; - float timetweak, jitfac, eff_hair, grid_rand; + float timetweak, courant_target; + float jitfac, eff_hair, grid_rand, ps_offset[1]; int totpart, userjit, grid_res, effector_amount; + short time_flag, time_pad[3]; /* initial velocity factors */ float normfac, obfac, randfac, partfac, tanfac, tanphase, reactfac; @@ -288,6 +290,9 @@ typedef struct ParticleSystem{ /* note, make sure all (runtime) are NULL's in struct ParticleDrawData *pdd; float *frand; /* array of 1024 random floats for fast lookups */ + + float dt_frac; /* current time step, as a fraction of a frame */ + float _pad; /* spare capacity */ }ParticleSystem; /* part->type */ @@ -402,6 +407,9 @@ typedef struct ParticleSystem{ /* note, make sure all (runtime) are NULL's in #define PART_SIMPLIFY_ENABLE 1 #define PART_SIMPLIFY_VIEWPORT 2 +/* part->time_flag */ +#define PART_TIME_AUTOSF 1 /* Automatic subframes */ + /* part->bb_align */ #define PART_BB_X 0 #define PART_BB_Y 1 diff --git a/source/blender/makesrna/intern/rna_particle.c b/source/blender/makesrna/intern/rna_particle.c index 5dc2f2ccac5..56738dd9f11 100644 --- a/source/blender/makesrna/intern/rna_particle.c +++ b/source/blender/makesrna/intern/rna_particle.c @@ -19,6 +19,9 @@ * * Contributor(s): Blender Foundation (2008). * + * Adaptive time step + * Copyright 2011 AutoCRC + * * ***** END GPL LICENSE BLOCK ***** */ @@ -2049,12 +2052,23 @@ static void rna_def_particle_settings(BlenderRNA *brna) RNA_def_property_float_funcs(prop, "rna_PartSettings_timestep_get", "rna_PartSetings_timestep_set", NULL); RNA_def_property_range(prop, 0.0001, 100.0); RNA_def_property_ui_range(prop, 0.01, 10, 1, 3); - RNA_def_property_ui_text(prop, "Timestep", "The simulation timestep per frame (in seconds)"); + RNA_def_property_ui_text(prop, "Timestep", "The simulation timestep per frame (seconds per frame)"); RNA_def_property_update(prop, 0, "rna_Particle_reset"); - + + prop= RNA_def_property(srna, "adaptive_subframes", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "time_flag", PART_TIME_AUTOSF); + RNA_def_property_ui_text(prop, "Automatic Subframes", "Automatically set the number of subframes"); + RNA_def_property_update(prop, 0, "rna_Particle_reset"); + prop= RNA_def_property(srna, "subframes", PROP_INT, PROP_NONE); RNA_def_property_range(prop, 0, 1000); - RNA_def_property_ui_text(prop, "Subframes", "Subframes to simulate for improved stability and finer granularity simulations"); + RNA_def_property_ui_text(prop, "Subframes", "Subframes to simulate for improved stability and finer granularity simulations (dt = timestep / (subframes + 1))"); + RNA_def_property_update(prop, 0, "rna_Particle_reset"); + + prop= RNA_def_property(srna, "courant_target", PROP_FLOAT, PROP_NONE); + RNA_def_property_range(prop, 0.01, 10); + RNA_def_property_float_default(prop, 0.2); + RNA_def_property_ui_text(prop, "Adaptive Subframe Threshold", "The relative distance a particle can move before requiring more subframes (target Courant number). 0.1-0.3 is the recommended range."); RNA_def_property_update(prop, 0, "rna_Particle_reset"); prop= RNA_def_property(srna, "jitter_factor", PROP_FLOAT, PROP_NONE); @@ -2862,6 +2876,13 @@ static void rna_def_particle_system(BlenderRNA *brna) RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "Edited", "Particle system has been edited in particle mode"); + /* Read-only: this is calculated internally. Changing it would only affect + * the next time-step. The user should change ParticlSettings.subframes or + * ParticleSettings.courant_target instead. */ + prop= RNA_def_property(srna, "dt_frac", PROP_FLOAT, PROP_NONE); + RNA_def_property_range(prop, 1.0f/101.0f, 1.0f); + RNA_def_property_ui_text(prop, "Timestep", "The current simulation time step size, as a fraction of a frame."); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_struct_path_func(srna, "rna_ParticleSystem_path"); } -- cgit v1.2.3 From 274b9c8fb88ff6499ac3b13a081c1e60965e459e Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 25 Sep 2011 12:31:21 +0000 Subject: whitespace cleanup --- source/blender/blenkernel/intern/implicit.c | 4 ++-- source/blender/blenkernel/intern/ipo.c | 2 +- source/blender/blenkernel/intern/material.c | 4 ++-- source/blender/blenkernel/intern/scene.c | 2 +- source/blender/blenloader/intern/readfile.c | 2 +- source/blender/collada/AnimationImporter.cpp | 22 +++++++++--------- source/blender/collada/MeshImporter.cpp | 2 +- .../blender/editors/animation/anim_channels_edit.c | 2 +- source/blender/editors/animation/keyframing.c | 4 ++-- source/blender/editors/include/ED_anim_api.h | 2 +- source/blender/editors/interface/view2d_ops.c | 2 +- source/blender/editors/screen/area.c | 4 ++-- source/blender/editors/sculpt_paint/paint_image.c | 2 +- source/blender/editors/space_info/info_draw.c | 2 +- .../blender/editors/space_outliner/outliner_draw.c | 2 +- source/blender/editors/transform/transform.h | 4 ++-- .../editors/transform/transform_conversions.c | 4 ++-- source/blender/gpu/intern/gpu_buffers.c | 2 +- source/blender/gpu/intern/gpu_draw.c | 2 +- source/blender/imbuf/intern/indexer.c | 4 ++-- source/blender/makesdna/DNA_cloth_types.h | 2 +- source/blender/makesdna/DNA_constraint_types.h | 2 +- source/blender/makesdna/DNA_ipo_types.h | 2 +- source/blender/makesdna/DNA_modifier_types.h | 2 +- source/blender/makesdna/DNA_scene_types.h | 10 ++++----- source/blender/makesrna/intern/rna_userdef.c | 2 +- .../nodes/composite/nodes/node_composite_image.c | 2 +- source/blender/nodes/intern/node_common.c | 4 ++-- .../blender/render/intern/raytrace/rayobject.cpp | 2 +- .../render/intern/raytrace/rayobject_qbvh.cpp | 4 ++-- .../render/intern/raytrace/rayobject_svbvh.cpp | 4 ++-- .../render/intern/raytrace/rayobject_vbvh.cpp | 4 ++-- .../blender/render/intern/source/convertblender.c | 2 +- source/creator/creator.c | 2 +- source/gameengine/Converter/BL_ArmatureChannel.cpp | 26 +++++++++++----------- .../Converter/BL_BlenderDataConversion.cpp | 2 +- source/gameengine/Expressions/KX_HashedPtr.cpp | 2 +- source/gameengine/Expressions/ListValue.cpp | 14 ++++++------ source/gameengine/Expressions/PyObjectPlus.h | 2 +- .../gameengine/GameLogic/SCA_JoystickManager.cpp | 6 ++--- source/gameengine/Ketsji/KX_CameraActuator.cpp | 2 +- source/gameengine/Ketsji/KX_KetsjiEngine.cpp | 10 ++++----- source/gameengine/Ketsji/KX_MouseFocusSensor.h | 2 +- source/gameengine/Ketsji/KX_NearSensor.cpp | 4 ++-- source/gameengine/Ketsji/KX_ObjectActuator.h | 2 +- source/gameengine/Ketsji/KX_ParentActuator.h | 6 ++--- source/gameengine/Ketsji/KX_PythonSeq.cpp | 6 ++--- source/gameengine/Ketsji/KX_SCA_DynamicActuator.h | 8 +++---- source/gameengine/Network/NG_NetworkMessage.h | 2 +- source/gameengine/SceneGraph/SG_Node.cpp | 4 ++-- 50 files changed, 108 insertions(+), 108 deletions(-) (limited to 'source') diff --git a/source/blender/blenkernel/intern/implicit.c b/source/blender/blenkernel/intern/implicit.c index 099661f7914..295669c98c0 100644 --- a/source/blender/blenkernel/intern/implicit.c +++ b/source/blender/blenkernel/intern/implicit.c @@ -1827,7 +1827,7 @@ int cloth_calc_helper_forces(Object *UNUSED(ob), ClothModifierData * clmd, float return 1; } int implicit_solver (Object *ob, float frame, ClothModifierData *clmd, ListBase *effectors) -{ +{ unsigned int i=0; float step=0.0f, tf=clmd->sim_parms->timescale; Cloth *cloth = clmd->clothObject; @@ -1981,7 +1981,7 @@ int implicit_solver (Object *ob, float frame, ClothModifierData *clmd, ListBase } void implicit_set_positions (ClothModifierData *clmd) -{ +{ Cloth *cloth = clmd->clothObject; ClothVertex *verts = cloth->verts; unsigned int numverts = cloth->numverts, i; diff --git a/source/blender/blenkernel/intern/ipo.c b/source/blender/blenkernel/intern/ipo.c index 5acd6c169a0..71ca79706db 100644 --- a/source/blender/blenkernel/intern/ipo.c +++ b/source/blender/blenkernel/intern/ipo.c @@ -317,7 +317,7 @@ static const char *constraint_adrcodes_to_paths (int adrcode, int *array_index) /* ShapeKey types * NOTE: as we don't have access to the keyblock where the data comes from (for now), - * we'll just use numerical indices for now... + * we'll just use numerical indices for now... */ static char *shapekey_adrcodes_to_paths (int adrcode, int *UNUSED(array_index)) { diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c index f5df6efd622..f27046fe603 100644 --- a/source/blender/blenkernel/intern/material.c +++ b/source/blender/blenkernel/intern/material.c @@ -1283,7 +1283,7 @@ void ramp_blend(int type, float *r, float *g, float *b, float fac, const float c *g=1.0f; else *g = tmp; - + tmp = facm + fac*col[2]; if(tmp <= 0.0f) *b = 0.0f; @@ -1772,7 +1772,7 @@ int do_version_tface(Main *main, int fileload) int flag; int index; - /* sometimes mesh has no materials but will need a new one. In those + /* sometimes mesh has no materials but will need a new one. In those * cases we need to ignore the mf->mat_nr and only look at the face * mode because it can be zero as uninitialized or the 1st created material */ diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c index 1454b3f0ce3..6741ff2d018 100644 --- a/source/blender/blenkernel/intern/scene.c +++ b/source/blender/blenkernel/intern/scene.c @@ -428,7 +428,7 @@ Scene *add_scene(const char *name) sce->toolsettings->skgen_resolution = 100; sce->toolsettings->skgen_threshold_internal = 0.01f; sce->toolsettings->skgen_threshold_external = 0.01f; - sce->toolsettings->skgen_angle_limit = 45.0f; + sce->toolsettings->skgen_angle_limit = 45.0f; sce->toolsettings->skgen_length_ratio = 1.3f; sce->toolsettings->skgen_length_limit = 1.5f; sce->toolsettings->skgen_correlation_limit = 0.98f; diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index d62f6657e41..f80607a41b7 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -9985,7 +9985,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) sce->toolsettings->skgen_resolution = 250; sce->toolsettings->skgen_threshold_internal = 0.1f; sce->toolsettings->skgen_threshold_external = 0.1f; - sce->toolsettings->skgen_angle_limit = 30.0f; + sce->toolsettings->skgen_angle_limit = 30.0f; sce->toolsettings->skgen_length_ratio = 1.3f; sce->toolsettings->skgen_length_limit = 1.5f; sce->toolsettings->skgen_correlation_limit = 0.98f; diff --git a/source/blender/collada/AnimationImporter.cpp b/source/blender/collada/AnimationImporter.cpp index a176b6eb4cd..9d96814c403 100644 --- a/source/blender/collada/AnimationImporter.cpp +++ b/source/blender/collada/AnimationImporter.cpp @@ -603,7 +603,7 @@ void AnimationImporter:: Assign_color_animations(const COLLADAFW::UniqueId& list for (iter = animcurves.begin(); iter != animcurves.end(); iter++) { FCurve * fcu = *iter; BLI_addtail(AnimCurves, fcu); - } + } } @@ -621,16 +621,16 @@ void AnimationImporter:: Assign_float_animations(const COLLADAFW::UniqueId& list //all the curves belonging to the current binding std::vector animcurves; for (unsigned int j = 0; j < bindings.getCount(); j++) { - animcurves = curve_map[bindings[j].animation]; - - BLI_strncpy(rna_path, anim_type , sizeof(rna_path)); - modify_fcurve(&animcurves, rna_path, 0 ); - std::vector::iterator iter; - //Add the curves of the current animation to the object - for (iter = animcurves.begin(); iter != animcurves.end(); iter++) { - FCurve * fcu = *iter; - BLI_addtail(AnimCurves, fcu); - } + animcurves = curve_map[bindings[j].animation]; + + BLI_strncpy(rna_path, anim_type , sizeof(rna_path)); + modify_fcurve(&animcurves, rna_path, 0 ); + std::vector::iterator iter; + //Add the curves of the current animation to the object + for (iter = animcurves.begin(); iter != animcurves.end(); iter++) { + FCurve * fcu = *iter; + BLI_addtail(AnimCurves, fcu); + } } } diff --git a/source/blender/collada/MeshImporter.cpp b/source/blender/collada/MeshImporter.cpp index 2f5d9e54e50..a6757329ea1 100644 --- a/source/blender/collada/MeshImporter.cpp +++ b/source/blender/collada/MeshImporter.cpp @@ -466,7 +466,7 @@ void MeshImporter::read_faces(COLLADAFW::Mesh *mesh, Mesh *me, int new_tris) //T if (has_normals && mp->getPositionIndices().getCount() != mp->getNormalIndices().getCount()) { fprintf(stderr, "Warning: Number of normals is different from the number of vertcies, skipping normals\n"); - has_normals = false; + has_normals = false; } unsigned int j, k; diff --git a/source/blender/editors/animation/anim_channels_edit.c b/source/blender/editors/animation/anim_channels_edit.c index d58d51c8e08..7f05a7c2b1a 100644 --- a/source/blender/editors/animation/anim_channels_edit.c +++ b/source/blender/editors/animation/anim_channels_edit.c @@ -366,7 +366,7 @@ void ANIM_deselect_anim_channels (bAnimContext *ac, void *data, short datatype, /* Flush visibility (for Graph Editor) changes up/down hierarchy for changes in the given setting * - anim_data: list of the all the anim channels that can be chosen * -> filtered using ANIMFILTER_CHANNELS only, since if we took VISIBLE too, - * then the channels under closed expanders get ignored... + * then the channels under closed expanders get ignored... * - ale_setting: the anim channel (not in the anim_data list directly, though occuring there) * with the new state of the setting that we want flushed up/down the hierarchy * - setting: type of setting to set diff --git a/source/blender/editors/animation/keyframing.c b/source/blender/editors/animation/keyframing.c index 58e1549c0ed..b52550832c3 100644 --- a/source/blender/editors/animation/keyframing.c +++ b/source/blender/editors/animation/keyframing.c @@ -540,8 +540,8 @@ static short visualkey_can_use (PointerRNA *ptr, PropertyRNA *prop) /* get first constraint and determine type of keyframe constraints to check for * - constraints can be on either Objects or PoseChannels, so we only check if the - * ptr->type is RNA_Object or RNA_PoseBone, which are the RNA wrapping-info for - * those structs, allowing us to identify the owner of the data + * ptr->type is RNA_Object or RNA_PoseBone, which are the RNA wrapping-info for + * those structs, allowing us to identify the owner of the data */ if (ptr->type == &RNA_Object) { /* Object */ diff --git a/source/blender/editors/include/ED_anim_api.h b/source/blender/editors/include/ED_anim_api.h index b730913a368..3c810f7da2d 100644 --- a/source/blender/editors/include/ED_anim_api.h +++ b/source/blender/editors/include/ED_anim_api.h @@ -426,7 +426,7 @@ void ANIM_channel_setting_set(bAnimContext *ac, bAnimListElem *ale, int setting, /* Flush visibility (for Graph Editor) changes up/down hierarchy for changes in the given setting * - anim_data: list of the all the anim channels that can be chosen * -> filtered using ANIMFILTER_CHANNELS only, since if we took VISIBLE too, - * then the channels under closed expanders get ignored... + * then the channels under closed expanders get ignored... * - ale_setting: the anim channel (not in the anim_data list directly, though occuring there) * with the new state of the setting that we want flushed up/down the hierarchy * - setting: type of setting to set diff --git a/source/blender/editors/interface/view2d_ops.c b/source/blender/editors/interface/view2d_ops.c index 0aaf6fe3bc6..30ae69b71b8 100644 --- a/source/blender/editors/interface/view2d_ops.c +++ b/source/blender/editors/interface/view2d_ops.c @@ -785,7 +785,7 @@ static void VIEW2D_OT_zoom_out(wmOperatorType *ot) } /* ********************************************************* */ -/* DRAG-ZOOM OPERATOR */ +/* DRAG-ZOOM OPERATOR */ /* MMB Drag - allows non-uniform scaling by dragging mouse * diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c index 8951df9221e..041cb9091d9 100644 --- a/source/blender/editors/screen/area.c +++ b/source/blender/editors/screen/area.c @@ -1375,9 +1375,9 @@ static const char *editortype_pup(void) "|Outliner %x3" "|User Preferences %x19" "|Info%x7" - + "|%l" - + "|File Browser %x5" "|%l" diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c index eb919261127..5fe47f836d7 100644 --- a/source/blender/editors/sculpt_paint/paint_image.c +++ b/source/blender/editors/sculpt_paint/paint_image.c @@ -3702,7 +3702,7 @@ static void do_projectpaint_draw_f(ProjPaintState *ps, ProjPixel *projPixel, flo if(use_color_correction){ srgb_to_linearrgb_v3_v3(rgba, ps->brush->rgb); } - else { + else { VECCOPY(rgba, ps->brush->rgb); } rgba[3] = 1.0; diff --git a/source/blender/editors/space_info/info_draw.c b/source/blender/editors/space_info/info_draw.c index 3121ddaa3b4..126d75e76cb 100644 --- a/source/blender/editors/space_info/info_draw.c +++ b/source/blender/editors/space_info/info_draw.c @@ -87,7 +87,7 @@ static void info_report_color(unsigned char *fg, unsigned char *bg, Report *repo if (bool) { bg[0]=220; bg[1]=128; bg[2]=96; } else { bg[0]=214; bg[1]=122; bg[2]=90; } } -#if 0 // XXX: this looks like the selected colour, so don't use this +#if 0 // XXX: this looks like the selected color, so don't use this else if (report->type & RPT_OPERATOR_ALL) { if (bool) { bg[0]=96; bg[1]=128; bg[2]=255; } else { bg[0]=90; bg[1]=122; bg[2]=249; } diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c index 65ce2e71d8d..10ca482ae0e 100644 --- a/source/blender/editors/space_outliner/outliner_draw.c +++ b/source/blender/editors/space_outliner/outliner_draw.c @@ -1248,7 +1248,7 @@ static void outliner_draw_tree_element(bContext *C, uiBlock *block, Scene *scene if ( (SEARCHING_OUTLINER(soops) || (soops->outlinevis==SO_DATABLOCKS && soops->search_string[0]!=0)) && (tselem->flag & TSE_SEARCHMATCH)) { - /* TODO - add search highlight colour to theme? */ + /* TODO - add search highlight color to theme? */ glColor4f(0.2f, 0.5f, 0.2f, 0.3f); glRecti(startx, *starty+1, ar->v2d.cur.xmax, *starty+UI_UNIT_Y-1); } diff --git a/source/blender/editors/transform/transform.h b/source/blender/editors/transform/transform.h index 485344875d4..2f177239f44 100644 --- a/source/blender/editors/transform/transform.h +++ b/source/blender/editors/transform/transform.h @@ -425,8 +425,8 @@ typedef struct TransInfo { #define TD_BEZTRIPLE (1 << 12) /* if this is a bez triple, we need to restore the handles, if this is set transdata->misc.hdata needs freeing */ #define TD_NO_LOC (1 << 13) /* when this is set, don't apply translation changes to this element */ #define TD_NOTIMESNAP (1 << 14) /* for Graph Editor autosnap, indicates that point should not undergo autosnapping */ -#define TD_INTVALUES (1 << 15) /* for Graph Editor - curves that can only have int-values need their keyframes tagged with this */ -#define TD_MIRROR_EDGE (1 << 16) /* For editmode mirror, clamp to x = 0 */ +#define TD_INTVALUES (1 << 15) /* for Graph Editor - curves that can only have int-values need their keyframes tagged with this */ +#define TD_MIRROR_EDGE (1 << 16) /* For editmode mirror, clamp to x = 0 */ #define TD_MOVEHANDLE1 (1 << 17) /* For fcurve handles, move them along with their keyframes */ #define TD_MOVEHANDLE2 (1 << 18) #define TD_PBONE_LOCAL_MTX_P (1 << 19) /* exceptional case with pose bone rotating when a parent bone has 'Local Location' option enabled and rotating also transforms it. */ diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index 83f79eae4f2..b7a5f4bd979 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -5314,7 +5314,7 @@ void createTransData(bContext *C, TransInfo *t) t->ext = NULL; if (t->obedit->type == OB_MESH) { createTransEditVerts(C, t); - } + } else if ELEM(t->obedit->type, OB_CURVE, OB_SURF) { createTransCurveVerts(C, t); } @@ -5327,7 +5327,7 @@ void createTransData(bContext *C, TransInfo *t) else if (t->obedit->type==OB_ARMATURE) { t->flag &= ~T_PROP_EDIT; createTransArmatureVerts(t); - } + } else { printf("edit type not implemented!\n"); } diff --git a/source/blender/gpu/intern/gpu_buffers.c b/source/blender/gpu/intern/gpu_buffers.c index ce3a378ea00..0aaddf0dea5 100644 --- a/source/blender/gpu/intern/gpu_buffers.c +++ b/source/blender/gpu/intern/gpu_buffers.c @@ -629,7 +629,7 @@ static void GPU_buffer_copy_normal(DerivedMesh *dm, float *varray, int *index, i if(smoothnormal) { /* copy vertex normal */ normal_short_to_float_v3(&varray[start], mvert[f->v1].no); - normal_short_to_float_v3(&varray[start+3], mvert[f->v2].no); + normal_short_to_float_v3(&varray[start+3], mvert[f->v2].no); normal_short_to_float_v3(&varray[start+6], mvert[f->v3].no); if(f->v4) { diff --git a/source/blender/gpu/intern/gpu_draw.c b/source/blender/gpu/intern/gpu_draw.c index 4f79d577ae5..120c203e7bd 100644 --- a/source/blender/gpu/intern/gpu_draw.c +++ b/source/blender/gpu/intern/gpu_draw.c @@ -717,7 +717,7 @@ void GPU_paint_update_image(Image *ima, int x, int y, int w, int h, int mipmap) } else { /* Do partial drawing. 'buffer' holds only the changed part. Needed for color corrected result */ - float *buffer = (float *)MEM_mallocN(w*h*sizeof(float)*4, "temp_texpaint_float_buf"); + float *buffer = (float *)MEM_mallocN(w*h*sizeof(float)*4, "temp_texpaint_float_buf"); IMB_partial_rect_from_float(ibuf, buffer, x, y, w, h); glBindTexture(GL_TEXTURE_2D, ima->bindcode); glTexSubImage2D(GL_TEXTURE_2D, 0, x, y, w, h, GL_RGBA, diff --git a/source/blender/imbuf/intern/indexer.c b/source/blender/imbuf/intern/indexer.c index 2e45c0eb07a..d79e881e5a2 100644 --- a/source/blender/imbuf/intern/indexer.c +++ b/source/blender/imbuf/intern/indexer.c @@ -183,9 +183,9 @@ struct anim_index * IMB_indexer_open(const char * name) BLI_strncpy(idx->name, name, sizeof(idx->name)); - fseek(fp, 0, SEEK_END); + fseek(fp, 0, SEEK_END); - idx->num_entries = (ftell(fp) - 12) + idx->num_entries = (ftell(fp) - 12) / (sizeof(int) // framepos + sizeof(unsigned long long) // seek_pos + sizeof(unsigned long long) // seek_pos_dts diff --git a/source/blender/makesdna/DNA_cloth_types.h b/source/blender/makesdna/DNA_cloth_types.h index b7a8f21d724..128f19b504b 100644 --- a/source/blender/makesdna/DNA_cloth_types.h +++ b/source/blender/makesdna/DNA_cloth_types.h @@ -93,7 +93,7 @@ typedef struct ClothCollSettings { struct LinkNode *collision_list; /* e.g. pointer to temp memory for collisions */ float epsilon; /* min distance for collisions. */ - float self_friction; /* Fiction/damping with self contact. */ + float self_friction; /* Fiction/damping with self contact. */ float friction; /* Friction/damping applied on contact with other object.*/ float selfepsilon; /* for selfcollision */ float repel_force, distance_repel; diff --git a/source/blender/makesdna/DNA_constraint_types.h b/source/blender/makesdna/DNA_constraint_types.h index 1be2c811a1b..e04bdd4ec45 100644 --- a/source/blender/makesdna/DNA_constraint_types.h +++ b/source/blender/makesdna/DNA_constraint_types.h @@ -344,7 +344,7 @@ typedef struct bPivotConstraint { * Either target object + offset, or just offset is used */ struct Object *tar; /* target object (optional) */ - char subtarget[32]; /* subtarget name (optional) */ + char subtarget[32]; /* subtarget name (optional) */ float offset[3]; /* offset from the target to use, regardless of whether it exists */ /* Rotation-driven activation: diff --git a/source/blender/makesdna/DNA_ipo_types.h b/source/blender/makesdna/DNA_ipo_types.h index 43a4b99bc33..8fe8b3bcf70 100644 --- a/source/blender/makesdna/DNA_ipo_types.h +++ b/source/blender/makesdna/DNA_ipo_types.h @@ -56,7 +56,7 @@ typedef struct IpoDriver { short blocktype, adrcode; /* sub-channel to use */ short type, flag; /* driver settings */ - char name[128]; /* bone, or python expression here */ + char name[128]; /* bone, or python expression here */ } IpoDriver; /* --- IPO Curve --- */ diff --git a/source/blender/makesdna/DNA_modifier_types.h b/source/blender/makesdna/DNA_modifier_types.h index e9e78ab25d3..229f14dbaf3 100644 --- a/source/blender/makesdna/DNA_modifier_types.h +++ b/source/blender/makesdna/DNA_modifier_types.h @@ -808,7 +808,7 @@ typedef struct WeightVGEditModifierData { /* Mapping stuff. */ struct CurveMapping *cmap_curve; /* The custom mapping curve! */ - /* The add/remove vertices weight thresholds. */ + /* The add/remove vertices weight thresholds. */ float add_threshold, rem_threshold; /* Masking options. */ diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h index 9f176a22848..f0f346fb759 100644 --- a/source/blender/makesdna/DNA_scene_types.h +++ b/source/blender/makesdna/DNA_scene_types.h @@ -236,8 +236,8 @@ typedef struct RenderData { short stereomode; /* standalone player stereo settings */ // XXX deprecated since 2.5 short dimensionspreset; /* for the dimensions presets menu */ - - short filtertype; /* filter is box, tent, gauss, mitch, etc */ + + short filtertype; /* filter is box, tent, gauss, mitch, etc */ short size, maximsize; /* size in %, max in Kb */ /* from buttons: */ @@ -479,8 +479,8 @@ typedef struct GameData { } GameData; #define STEREO_NOSTEREO 1 -#define STEREO_ENABLED 2 -#define STEREO_DOME 3 +#define STEREO_ENABLED 2 +#define STEREO_DOME 3 //#define STEREO_NOSTEREO 1 #define STEREO_QUADBUFFERED 2 @@ -838,7 +838,7 @@ typedef struct Scene { void *sound_scrub_handle; void *speaker_handles; - void *fps_info; /* (runtime) info/cache used for presenting playback framerate info to the user */ + void *fps_info; /* (runtime) info/cache used for presenting playback framerate info to the user */ /* none of the dependancy graph vars is mean to be saved */ struct DagForest *theDag; diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index 44d645f970f..b81b370a890 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -2777,7 +2777,7 @@ static void rna_def_userdef_input(BlenderRNA *brna) RNA_def_property_range(prop, 3, 40); RNA_def_property_ui_text(prop, "Drag Threshold", "Amount of pixels you have to drag before dragging UI items happens"); - /* 3D mouse settings */ + /* 3D mouse settings */ /* global options */ prop= RNA_def_property(srna, "ndof_sensitivity", PROP_FLOAT, PROP_NONE); RNA_def_property_range(prop, 0.25f, 4.0f); diff --git a/source/blender/nodes/composite/nodes/node_composite_image.c b/source/blender/nodes/composite/nodes/node_composite_image.c index 6149947233e..c18a35fdd98 100644 --- a/source/blender/nodes/composite/nodes/node_composite_image.c +++ b/source/blender/nodes/composite/nodes/node_composite_image.c @@ -74,7 +74,7 @@ static CompBuf *node_composit_get_image(RenderData *rd, Image *ima, ImageUser *i ibuf= BKE_image_get_ibuf(ima, iuser); if(ibuf==NULL || (ibuf->rect==NULL && ibuf->rect_float==NULL)) { - return NULL; + return NULL; } if (ibuf->rect_float == NULL) { diff --git a/source/blender/nodes/intern/node_common.c b/source/blender/nodes/intern/node_common.c index 35f2dbf7b32..8225c986409 100644 --- a/source/blender/nodes/intern/node_common.c +++ b/source/blender/nodes/intern/node_common.c @@ -551,8 +551,8 @@ int node_group_ungroup(bNodeTree *ntree, bNode *gnode) } /* delete the group instance. this also removes old input links! */ - nodeFreeNode(ntree, gnode); - + nodeFreeNode(ntree, gnode); + /* free the group tree (takes care of user count) */ free_libblock(&G.main->nodetree, wgroup); diff --git a/source/blender/render/intern/raytrace/rayobject.cpp b/source/blender/render/intern/raytrace/rayobject.cpp index dfff35ba51a..550652560be 100644 --- a/source/blender/render/intern/raytrace/rayobject.cpp +++ b/source/blender/render/intern/raytrace/rayobject.cpp @@ -441,7 +441,7 @@ int RE_rayobject_intersect(RayObject *r, Isect *i) } else { assert(0); - return 0; + return 0; } } diff --git a/source/blender/render/intern/raytrace/rayobject_qbvh.cpp b/source/blender/render/intern/raytrace/rayobject_qbvh.cpp index 331358f727b..8fc3c938427 100644 --- a/source/blender/render/intern/raytrace/rayobject_qbvh.cpp +++ b/source/blender/render/intern/raytrace/rayobject_qbvh.cpp @@ -116,8 +116,8 @@ void bvh_hint_bb(Tree *tree, LCTSHint *hint, float *min, float *max) { //TODO renable hint support { - hint->size = 0; - hint->stack[hint->size++] = (RayObject*)tree->root; + hint->size = 0; + hint->stack[hint->size++] = (RayObject*)tree->root; } } /* the cast to pointer function is needed to workarround gcc bug: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11407 */ diff --git a/source/blender/render/intern/raytrace/rayobject_svbvh.cpp b/source/blender/render/intern/raytrace/rayobject_svbvh.cpp index a99c57ab233..0d1526fba6f 100644 --- a/source/blender/render/intern/raytrace/rayobject_svbvh.cpp +++ b/source/blender/render/intern/raytrace/rayobject_svbvh.cpp @@ -152,8 +152,8 @@ void bvh_hint_bb(Tree *tree, LCTSHint *hint, float *min, float *max) { //TODO renable hint support { - hint->size = 0; - hint->stack[hint->size++] = (RayObject*)tree->root; + hint->size = 0; + hint->stack[hint->size++] = (RayObject*)tree->root; } } /* the cast to pointer function is needed to workarround gcc bug: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11407 */ diff --git a/source/blender/render/intern/raytrace/rayobject_vbvh.cpp b/source/blender/render/intern/raytrace/rayobject_vbvh.cpp index 25eada43a4a..620477f1e70 100644 --- a/source/blender/render/intern/raytrace/rayobject_vbvh.cpp +++ b/source/blender/render/intern/raytrace/rayobject_vbvh.cpp @@ -154,8 +154,8 @@ void bvh_hint_bb(Tree *tree, LCTSHint *hint, float *min, float *max) { //TODO renable hint support { - hint->size = 0; - hint->stack[hint->size++] = (RayObject*)tree->root; + hint->size = 0; + hint->stack[hint->size++] = (RayObject*)tree->root; } } diff --git a/source/blender/render/intern/source/convertblender.c b/source/blender/render/intern/source/convertblender.c index 27c825ebdeb..195b037727e 100644 --- a/source/blender/render/intern/source/convertblender.c +++ b/source/blender/render/intern/source/convertblender.c @@ -1349,7 +1349,7 @@ static void particle_billboard(Render *re, ObjectRen *obr, Material *ma, Particl int totsplit = bb->uv_split * bb->uv_split; int tile, x, y; /* Tile offsets */ - float uvx = 0.0f, uvy = 0.0f, uvdx = 1.0f, uvdy = 1.0f, time = 0.0f; + float uvx = 0.0f, uvy = 0.0f, uvdx = 1.0f, uvdy = 1.0f, time = 0.0f; vlr= RE_findOrAddVlak(obr, obr->totvlak++); vlr->v1= RE_findOrAddVert(obr, obr->totvert++); diff --git a/source/creator/creator.c b/source/creator/creator.c index 56108f6c251..d25b0be30d8 100644 --- a/source/creator/creator.c +++ b/source/creator/creator.c @@ -483,7 +483,7 @@ static int no_joystick(int UNUSED(argc), const char **UNUSED(argv), void *data) SYS_SystemHandle *syshandle = data; /** - don't initialize joysticks if user doesn't want to use joysticks + don't initialize joysticks if user doesn't want to use joysticks failed joystick initialization delays over 5 seconds, before game engine start */ SYS_WriteCommandLineInt(*syshandle, "nojoystick",1); diff --git a/source/gameengine/Converter/BL_ArmatureChannel.cpp b/source/gameengine/Converter/BL_ArmatureChannel.cpp index df3a575850b..5442878d6c5 100644 --- a/source/gameengine/Converter/BL_ArmatureChannel.cpp +++ b/source/gameengine/Converter/BL_ArmatureChannel.cpp @@ -279,19 +279,19 @@ PyObject* BL_ArmatureChannel::py_attr_get_joint_rotation(void *self_v, const str if (sa > FLT_EPSILON) { norm = atan2(sa,ca)/sa; } else { - if (ca < 0.0) { - norm = M_PI; - mul_v3_fl(joints,0.f); - if (joint_mat[0][0] > 0.f) { - joints[0] = 1.0f; - } else if (joint_mat[1][1] > 0.f) { - joints[1] = 1.0f; - } else { - joints[2] = 1.0f; - } - } else { - norm = 0.0; - } + if (ca < 0.0) { + norm = M_PI; + mul_v3_fl(joints,0.f); + if (joint_mat[0][0] > 0.f) { + joints[0] = 1.0f; + } else if (joint_mat[1][1] > 0.f) { + joints[1] = 1.0f; + } else { + joints[2] = 1.0f; + } + } else { + norm = 0.0; + } } mul_v3_fl(joints,norm); break; diff --git a/source/gameengine/Converter/BL_BlenderDataConversion.cpp b/source/gameengine/Converter/BL_BlenderDataConversion.cpp index 2c2fd052b5d..8633a14de03 100644 --- a/source/gameengine/Converter/BL_BlenderDataConversion.cpp +++ b/source/gameengine/Converter/BL_BlenderDataConversion.cpp @@ -642,7 +642,7 @@ bool ConvertMaterial( if(validmat && (mat->mode & MA_TRANSP) && (mat->mode & MA_ZTRANSP) && (material->alphablend == GEMAT_SOLID)) material->alphablend = GEMAT_ALPHA; - // always zsort alpha + add + // always zsort alpha + add if((ELEM3(material->alphablend, GEMAT_ALPHA, GEMAT_ALPHA_SORT, GEMAT_ADD) || texalpha) && (material->alphablend != GEMAT_CLIP )) { material->ras_mode |= ALPHA; material->ras_mode |= (mat && (mat->game.alpha_blend & GEMAT_ALPHA_SORT))? ZSORT: 0; diff --git a/source/gameengine/Expressions/KX_HashedPtr.cpp b/source/gameengine/Expressions/KX_HashedPtr.cpp index f3233732ee3..f6cd5814e22 100644 --- a/source/gameengine/Expressions/KX_HashedPtr.cpp +++ b/source/gameengine/Expressions/KX_HashedPtr.cpp @@ -48,7 +48,7 @@ unsigned int KX_Hash(void * inDWord) key += ~(key << 9); key ^= (key >> 17); - return (unsigned int)(key & 0xffffffff); + return (unsigned int)(key & 0xffffffff); } diff --git a/source/gameengine/Expressions/ListValue.cpp b/source/gameengine/Expressions/ListValue.cpp index 934f2a8dd87..ade54f6d924 100644 --- a/source/gameengine/Expressions/ListValue.cpp +++ b/source/gameengine/Expressions/ListValue.cpp @@ -487,12 +487,12 @@ static int listvalue_buffer_contains(PyObject *self_v, PyObject *value) static PySequenceMethods listvalue_as_sequence = { listvalue_bufferlen,//(inquiry)buffer_length, /*sq_length*/ listvalue_buffer_concat, /*sq_concat*/ - NULL, /*sq_repeat*/ + NULL, /*sq_repeat*/ listvalue_buffer_item, /*sq_item*/ // TODO, slicing in py3 NULL, // listvalue_buffer_slice, /*sq_slice*/ - NULL, /*sq_ass_item*/ - NULL, /*sq_ass_slice*/ + NULL, /*sq_ass_item*/ + NULL, /*sq_ass_slice*/ (objobjproc)listvalue_buffer_contains, /* sq_contains */ (binaryfunc) NULL, /* sq_inplace_concat */ (ssizeargfunc) NULL, /* sq_inplace_repeat */ @@ -515,12 +515,12 @@ PyTypeObject CListValue::Type = { sizeof(PyObjectPlus_Proxy), /*tp_basicsize*/ 0, /*tp_itemsize*/ /* methods */ - py_base_dealloc, /*tp_dealloc*/ - 0, /*tp_print*/ + py_base_dealloc, /*tp_dealloc*/ + 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ - 0, /*tp_compare*/ - py_base_repr, /*tp_repr*/ + 0, /*tp_compare*/ + py_base_repr, /*tp_repr*/ 0, /*tp_as_number*/ &listvalue_as_sequence, /*tp_as_sequence*/ &instance_as_mapping, /*tp_as_mapping*/ diff --git a/source/gameengine/Expressions/PyObjectPlus.h b/source/gameengine/Expressions/PyObjectPlus.h index 080e7196d5a..d3b2eacbb4d 100644 --- a/source/gameengine/Expressions/PyObjectPlus.h +++ b/source/gameengine/Expressions/PyObjectPlus.h @@ -563,7 +563,7 @@ public: /** enable/disable display of deprecation warnings */ static void SetDeprecationWarnings(bool ignoreDeprecationWarnings); - /** Shows a deprecation warning */ + /** Shows a deprecation warning */ static void ShowDeprecationWarning_func(const char* method,const char* prop); static void ClearDeprecationWarning(); diff --git a/source/gameengine/GameLogic/SCA_JoystickManager.cpp b/source/gameengine/GameLogic/SCA_JoystickManager.cpp index 19633c2e09d..b61e4f4edca 100644 --- a/source/gameengine/GameLogic/SCA_JoystickManager.cpp +++ b/source/gameengine/GameLogic/SCA_JoystickManager.cpp @@ -83,8 +83,8 @@ void SCA_JoystickManager::NextFrame(double curtime,double deltatime) SCA_Joystick *SCA_JoystickManager::GetJoystickDevice( short int joyindex) { - /* - *Return the instance of SCA_Joystick for use - */ + /* + *Return the instance of SCA_Joystick for use + */ return m_joystick[joyindex]; } diff --git a/source/gameengine/Ketsji/KX_CameraActuator.cpp b/source/gameengine/Ketsji/KX_CameraActuator.cpp index ebb291b2284..7df08b83d49 100644 --- a/source/gameengine/Ketsji/KX_CameraActuator.cpp +++ b/source/gameengine/Ketsji/KX_CameraActuator.cpp @@ -253,7 +253,7 @@ bool KX_CameraActuator::Update(double curtime, bool frame) /* ... set up some parameters ... */ /* missing here: the 'floorloc' of the actor's shadow */ - mindistsq= m_minHeight*m_minHeight; + mindistsq= m_minHeight*m_minHeight; maxdistsq= m_maxHeight*m_maxHeight; /* C1: not checked... is a future option */ diff --git a/source/gameengine/Ketsji/KX_KetsjiEngine.cpp b/source/gameengine/Ketsji/KX_KetsjiEngine.cpp index acd25ace04a..8e6126bb173 100644 --- a/source/gameengine/Ketsji/KX_KetsjiEngine.cpp +++ b/source/gameengine/Ketsji/KX_KetsjiEngine.cpp @@ -765,12 +765,12 @@ else m_logger->StartLog(tc_scenegraph, m_kxsystem->GetTimeInSeconds(), true); SG_SetActiveStage(SG_STAGE_ACTUATOR); scene->UpdateParents(m_clockTime); - - scene->setSuspendedTime(0.0); + + scene->setSuspendedTime(0.0); } // suspended - else - if(scene->getSuspendedTime()==0.0) - scene->setSuspendedTime(m_clockTime); + else + if(scene->getSuspendedTime()==0.0) + scene->setSuspendedTime(m_clockTime); m_logger->StartLog(tc_services, m_kxsystem->GetTimeInSeconds(), true); } diff --git a/source/gameengine/Ketsji/KX_MouseFocusSensor.h b/source/gameengine/Ketsji/KX_MouseFocusSensor.h index 73c5d94e4a5..07787665b1d 100644 --- a/source/gameengine/Ketsji/KX_MouseFocusSensor.h +++ b/source/gameengine/Ketsji/KX_MouseFocusSensor.h @@ -140,7 +140,7 @@ class KX_MouseFocusSensor : public SCA_MouseSensor */ bool m_positive_event; - /** + /** * Tests whether the object is in mouse focus for this camera */ bool ParentObjectHasFocusCamera(KX_Camera *cam); diff --git a/source/gameengine/Ketsji/KX_NearSensor.cpp b/source/gameengine/Ketsji/KX_NearSensor.cpp index 913a1adac55..eca4d45e9c6 100644 --- a/source/gameengine/Ketsji/KX_NearSensor.cpp +++ b/source/gameengine/Ketsji/KX_NearSensor.cpp @@ -49,8 +49,8 @@ KX_NearSensor::KX_NearSensor(SCA_EventManager* eventmgr, float resetmargin, bool bFindMaterial, const STR_String& touchedpropname, - PHY_IPhysicsController* ctrl) - :KX_TouchSensor(eventmgr, + PHY_IPhysicsController* ctrl) + :KX_TouchSensor(eventmgr, gameobj, bFindMaterial, false, diff --git a/source/gameengine/Ketsji/KX_ObjectActuator.h b/source/gameengine/Ketsji/KX_ObjectActuator.h index 0737535b84c..3ba257b4f05 100644 --- a/source/gameengine/Ketsji/KX_ObjectActuator.h +++ b/source/gameengine/Ketsji/KX_ObjectActuator.h @@ -100,7 +100,7 @@ class KX_ObjectActuator : public SCA_IActuator // used in servo control MT_Vector3 m_previous_error; MT_Vector3 m_error_accumulator; - KX_LocalFlags m_bitLocalFlag; + KX_LocalFlags m_bitLocalFlag; KX_GameObject* m_reference; // A hack bool -- oh no sorry everyone // This bool is used to check if we have informed diff --git a/source/gameengine/Ketsji/KX_ParentActuator.h b/source/gameengine/Ketsji/KX_ParentActuator.h index a850cc72eb9..6984465623d 100644 --- a/source/gameengine/Ketsji/KX_ParentActuator.h +++ b/source/gameengine/Ketsji/KX_ParentActuator.h @@ -56,8 +56,8 @@ class KX_ParentActuator : public SCA_IActuator - public: - enum KX_PARENTACT_MODE +public: + enum KX_PARENTACT_MODE { KX_PARENT_NODEF = 0, KX_PARENT_SET, @@ -65,7 +65,7 @@ class KX_ParentActuator : public SCA_IActuator KX_PARENT_MAX }; - + KX_ParentActuator(class SCA_IObject* gameobj, int mode, bool addToCompound, diff --git a/source/gameengine/Ketsji/KX_PythonSeq.cpp b/source/gameengine/Ketsji/KX_PythonSeq.cpp index 04a53fbb493..729376f0a24 100644 --- a/source/gameengine/Ketsji/KX_PythonSeq.cpp +++ b/source/gameengine/Ketsji/KX_PythonSeq.cpp @@ -375,9 +375,9 @@ static PyObject *KX_PythonSeq_getIter(KX_PythonSeq *self) return (PyObject *)self; } else { return KX_PythonSeq_CreatePyObject(self->base, self->type); - } - } - + } +} + /* * Return next KX_PythonSeq iter. diff --git a/source/gameengine/Ketsji/KX_SCA_DynamicActuator.h b/source/gameengine/Ketsji/KX_SCA_DynamicActuator.h index 04b2c00f4c1..ecae0eba6cd 100644 --- a/source/gameengine/Ketsji/KX_SCA_DynamicActuator.h +++ b/source/gameengine/Ketsji/KX_SCA_DynamicActuator.h @@ -50,10 +50,10 @@ class KX_SCA_DynamicActuator : public SCA_IActuator float m_setmass; public: KX_SCA_DynamicActuator( - SCA_IObject* gameobj, - short dyn_operation, - float setmass - ); + SCA_IObject* gameobj, + short dyn_operation, + float setmass + ); ~KX_SCA_DynamicActuator( ); diff --git a/source/gameengine/Network/NG_NetworkMessage.h b/source/gameengine/Network/NG_NetworkMessage.h index 0163e18fde7..0b3918773e2 100644 --- a/source/gameengine/Network/NG_NetworkMessage.h +++ b/source/gameengine/Network/NG_NetworkMessage.h @@ -72,7 +72,7 @@ public: { if (! --m_refcount) { - delete this; + delete this; } } diff --git a/source/gameengine/SceneGraph/SG_Node.cpp b/source/gameengine/SceneGraph/SG_Node.cpp index 01ada4ea473..c39904bf742 100644 --- a/source/gameengine/SceneGraph/SG_Node.cpp +++ b/source/gameengine/SceneGraph/SG_Node.cpp @@ -128,9 +128,9 @@ Destruct() // We'll delete m_parent_relation now anyway. delete(m_parent_relation); - m_parent_relation = NULL; + m_parent_relation = NULL; - if (m_children.begin() != m_children.end()) + if (m_children.begin() != m_children.end()) { NodeList::iterator childit; for (childit = m_children.begin();childit!=m_children.end();++childit) -- cgit v1.2.3 From 7c46f1c4b77873c27485bc278e04195611237602 Mon Sep 17 00:00:00 2001 From: Andrew Wiggin Date: Sun, 25 Sep 2011 12:33:51 +0000 Subject: Fix some MSVC 2010 warnings (including one apparent bug in intern/elbeem/intern/solver_relax.h) --- source/blender/avi/intern/options.c | 6 ++++-- source/blender/blenlib/intern/pbvh.c | 2 +- source/blender/blenlib/intern/storage.c | 4 ++-- source/blender/blenloader/intern/readfile.c | 4 ++-- source/blender/editors/include/UI_interface_icons.h | 4 ++-- source/blender/editors/space_console/space_console.c | 2 +- source/blender/editors/space_file/file_draw.c | 2 +- 7 files changed, 13 insertions(+), 11 deletions(-) (limited to 'source') diff --git a/source/blender/avi/intern/options.c b/source/blender/avi/intern/options.c index 96c62843436..8993c1ef96a 100644 --- a/source/blender/avi/intern/options.c +++ b/source/blender/avi/intern/options.c @@ -46,6 +46,7 @@ AviError AVI_set_compress_option (AviMovie *movie, int option_type, int stream, AviOption option, void *opt_data) { int i; + int useconds; (void)stream; /* unused */ @@ -100,8 +101,9 @@ AviError AVI_set_compress_option (AviMovie *movie, int option_type, int stream, break; case AVI_OPTION_FRAMERATE: - if (1000000/(*((double *) opt_data))) - movie->header->MicroSecPerFrame = 1000000/(*((double *) opt_data)); + useconds = (int)(1000000/(*((double *) opt_data))); + if (useconds) + movie->header->MicroSecPerFrame = useconds; for (i=0; i < movie->header->Streams; i++) { if (avi_get_format_type(movie->streams[i].format) == FCC("vids")) { diff --git a/source/blender/blenlib/intern/pbvh.c b/source/blender/blenlib/intern/pbvh.c index 0613765b868..57008af1812 100644 --- a/source/blender/blenlib/intern/pbvh.c +++ b/source/blender/blenlib/intern/pbvh.c @@ -346,7 +346,7 @@ static int map_insert_vert(PBVH *bvh, GHash *map, if(!BLI_ghash_haskey(map, key)) { if(BLI_bitmap_get(bvh->vert_bitmap, vertex)) { - value = SET_INT_IN_POINTER(-(*face_verts) - 1); + value = SET_INT_IN_POINTER(~(*face_verts)); ++(*face_verts); } else { diff --git a/source/blender/blenlib/intern/storage.c b/source/blender/blenlib/intern/storage.c index 04a6d15a0ea..f088c5e2787 100644 --- a/source/blender/blenlib/intern/storage.c +++ b/source/blender/blenlib/intern/storage.c @@ -478,12 +478,12 @@ LinkNode *BLI_read_file_as_lines(const char *name) FILE *fp= fopen(name, "r"); LinkNode *lines= NULL; char *buf; - int64_t size; + size_t size; if (!fp) return NULL; fseek(fp, 0, SEEK_END); - size= ftell(fp); + size= (size_t)ftell(fp); fseek(fp, 0, SEEK_SET); buf= MEM_mallocN(size, "file_as_lines"); diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index f80607a41b7..6163fa015a8 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -12070,7 +12070,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) /* Adaptive time step for particle systems */ ParticleSettings *part; for (part = main->particle.first; part; part = part->id.next) { - part->courant_target = 0.2; + part->courant_target = 0.2f; part->time_flag &= ~PART_TIME_AUTOSF; } } @@ -12089,7 +12089,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) if(sce->gm.recastData.cellheight == 0.0f) sce->gm.recastData.cellheight = 0.2f; if(sce->gm.recastData.agentmaxslope == 0.0f) - sce->gm.recastData.agentmaxslope = M_PI/4; + sce->gm.recastData.agentmaxslope = (float)M_PI/4; if(sce->gm.recastData.agentmaxclimb == 0.0f) sce->gm.recastData.agentmaxclimb = 0.9f; if(sce->gm.recastData.agentheight == 0.0f) diff --git a/source/blender/editors/include/UI_interface_icons.h b/source/blender/editors/include/UI_interface_icons.h index b6837a4b3c9..54400accbc2 100644 --- a/source/blender/editors/include/UI_interface_icons.h +++ b/source/blender/editors/include/UI_interface_icons.h @@ -50,8 +50,8 @@ typedef struct IconFile { #define ICON_DEFAULT_HEIGHT 16 #define ICON_DEFAULT_WIDTH 16 -#define ICON_DEFAULT_HEIGHT_SCALE (UI_UNIT_Y * 0.8f) -#define ICON_DEFAULT_WIDTH_SCALE (UI_UNIT_X * 0.8f) +#define ICON_DEFAULT_HEIGHT_SCALE ((int)(UI_UNIT_Y * 0.8f)) +#define ICON_DEFAULT_WIDTH_SCALE ((int)(UI_UNIT_X * 0.8f)) #define PREVIEW_DEFAULT_HEIGHT 96 diff --git a/source/blender/editors/space_console/space_console.c b/source/blender/editors/space_console/space_console.c index 5a965fc076b..1b9e3fdfb4a 100644 --- a/source/blender/editors/space_console/space_console.c +++ b/source/blender/editors/space_console/space_console.c @@ -138,7 +138,7 @@ static void console_main_area_init(wmWindowManager *wm, ARegion *ar) wmKeyMap *keymap; ListBase *lb; - const int prev_y_min= ar->v2d.cur.ymin; /* so resizing keeps the cursor visible */ + const float prev_y_min= ar->v2d.cur.ymin; /* so resizing keeps the cursor visible */ UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_CUSTOM, ar->winx, ar->winy); diff --git a/source/blender/editors/space_file/file_draw.c b/source/blender/editors/space_file/file_draw.c index b2b734159ff..f7abb01546f 100644 --- a/source/blender/editors/space_file/file_draw.c +++ b/source/blender/editors/space_file/file_draw.c @@ -520,7 +520,7 @@ void file_draw_list(const bContext *C, ARegion *ar) file_draw_preview(block, file, sx, sy, imb, layout, !is_icon && (file->flags & IMAGEFILE)); } else { - file_draw_icon(block, file->path, sx, sy-(UI_UNIT_Y / 6), get_file_icon(file), ICON_DEFAULT_WIDTH_SCALE, ICON_DEFAULT_WIDTH_SCALE); + file_draw_icon(block, file->path, sx, sy-(UI_UNIT_Y / 6), get_file_icon(file), ICON_DEFAULT_WIDTH_SCALE, ICON_DEFAULT_HEIGHT_SCALE); sx += ICON_DEFAULT_WIDTH_SCALE + 4; } -- cgit v1.2.3 From a932f93098ae64edbfd79ff3debe9712a55f2421 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Sun, 25 Sep 2011 15:37:06 +0000 Subject: Commented and tagged some unused vars (gcc warnings...). --- .../editors/animation/anim_channels_defines.c | 4 +- source/blender/editors/animation/fmodifier_ui.c | 10 ++-- .../editors/armature/editarmature_retarget.c | 16 ++++-- source/blender/editors/mesh/editmesh_mods.c | 4 +- source/blender/editors/mesh/editmesh_tools.c | 60 +++++++++++----------- 5 files changed, 51 insertions(+), 43 deletions(-) (limited to 'source') diff --git a/source/blender/editors/animation/anim_channels_defines.c b/source/blender/editors/animation/anim_channels_defines.c index 373d351fb6c..e8af5a8f290 100644 --- a/source/blender/editors/animation/anim_channels_defines.c +++ b/source/blender/editors/animation/anim_channels_defines.c @@ -3051,7 +3051,7 @@ static void achannel_setting_slider_shapekey_cb(bContext *C, void *key_poin, voi /* Draw a widget for some setting */ static void draw_setting_widget (bAnimContext *ac, bAnimListElem *ale, bAnimChannelType *acf, uiBlock *block, int xpos, int ypos, int setting) { - short negflag, ptrsize, enabled, butType; + short negflag, ptrsize /* , enabled */ /* UNUSED */, butType; int flag, icon; void *ptr; const char *tooltip; @@ -3060,7 +3060,7 @@ static void draw_setting_widget (bAnimContext *ac, bAnimListElem *ale, bAnimChan /* get the flag and the pointer to that flag */ flag= acf->setting_flag(ac, setting, &negflag); ptr= acf->setting_ptr(ale, setting, &ptrsize); - enabled= ANIM_channel_setting_get(ac, ale, setting); + /* enabled= ANIM_channel_setting_get(ac, ale, setting); */ /* UNUSED */ /* get the base icon for the setting */ switch (setting) { diff --git a/source/blender/editors/animation/fmodifier_ui.c b/source/blender/editors/animation/fmodifier_ui.c index 77c67fc4af0..d329874e1ba 100644 --- a/source/blender/editors/animation/fmodifier_ui.c +++ b/source/blender/editors/animation/fmodifier_ui.c @@ -112,7 +112,7 @@ static void delete_fmodifier_cb (bContext *C, void *fmods_v, void *fcm_v) static void draw_modifier__generator(uiLayout *layout, ID *id, FModifier *fcm, short width) { FMod_Generator *data= (FMod_Generator *)fcm->data; - uiLayout *col, *row; + uiLayout /* *col, */ /* UNUSED */ *row; uiBlock *block; uiBut *but; PointerRNA ptr; @@ -121,7 +121,7 @@ static void draw_modifier__generator(uiLayout *layout, ID *id, FModifier *fcm, s RNA_pointer_create(id, &RNA_FModifierFunctionGenerator, fcm, &ptr); /* basic settings (backdrop + mode selector + some padding) */ - col= uiLayoutColumn(layout, 1); + /* col= uiLayoutColumn(layout, 1); */ /* UNUSED */ block= uiLayoutGetBlock(layout); uiBlockBeginAlign(block); but= uiDefButR(block, MENU, B_FMODIFIER_REDRAW, NULL, 0, 0, width-30, UI_UNIT_Y, &ptr, "mode", -1, 0, 0, -1, -1, NULL); @@ -521,7 +521,7 @@ static void draw_modifier__envelope(uiLayout *layout, ID *id, FModifier *fcm, sh /* draw settings for limits modifier */ static void draw_modifier__limits(uiLayout *layout, ID *id, FModifier *fcm, short UNUSED(width)) { - uiLayout *split, *col, *row; + uiLayout *split, *col /* , *row */ /* UNUSED */; PointerRNA ptr; /* init the RNA-pointer */ @@ -529,7 +529,7 @@ static void draw_modifier__limits(uiLayout *layout, ID *id, FModifier *fcm, shor /* row 1: minimum */ { - row= uiLayoutRow(layout, 0); + /* row= uiLayoutRow(layout, 0); */ /* UNUSED */ /* split into 2 columns */ split= uiLayoutSplit(layout, 0.5f, 0); @@ -547,7 +547,7 @@ static void draw_modifier__limits(uiLayout *layout, ID *id, FModifier *fcm, shor /* row 2: maximum */ { - row= uiLayoutRow(layout, 0); + /* row= uiLayoutRow(layout, 0); */ /* UNUSED */ /* split into 2 columns */ split= uiLayoutSplit(layout, 0.5f, 0); diff --git a/source/blender/editors/armature/editarmature_retarget.c b/source/blender/editors/armature/editarmature_retarget.c index b750bd5ef1c..14891826260 100644 --- a/source/blender/editors/armature/editarmature_retarget.c +++ b/source/blender/editors/armature/editarmature_retarget.c @@ -1889,7 +1889,7 @@ static RetargetMode detectArcRetargetMode(RigArc *iarc) RigEdge *edge; int large_angle = 0; float avg_angle = 0; - float avg_length = 0; + /* float avg_length = 0; */ /* UNUSED */ int nb_edges = 0; @@ -1901,7 +1901,7 @@ static RetargetMode detectArcRetargetMode(RigArc *iarc) avg_angle /= nb_edges - 1; /* -1 because last edge doesn't have an angle */ - avg_length = iarc->length / nb_edges; + /* avg_length = iarc->length / nb_edges; */ /* UNUSED */ if (nb_edges > 2) @@ -2202,7 +2202,9 @@ static void retargetArctoArcAggresive(bContext *C, RigGraph *rigg, RigArc *iarc, float angle_weight = 1.0; // GET FROM CONTEXT float length_weight = 1.0; float distance_weight = 1.0; +#ifndef USE_THREADS float min_cost = FLT_MAX; +#endif float *vec0, *vec1; int *best_positions; int nb_edges = BLI_countlist(&iarc->edges); @@ -2245,7 +2247,9 @@ static void retargetArctoArcAggresive(bContext *C, RigGraph *rigg, RigArc *iarc, int nb_positions = earc->bcount; int nb_memo_nodes = nb_positions * nb_positions * (nb_joints + 1); MemoNode *table = MEM_callocN(nb_memo_nodes * sizeof(MemoNode), "memoization table"); +#ifndef USE_THREADS MemoNode *result; +#endif float **positions_cache = MEM_callocN(sizeof(float*) * (nb_positions + 2), "positions cache"); int i; @@ -2260,11 +2264,15 @@ static void retargetArctoArcAggresive(bContext *C, RigGraph *rigg, RigArc *iarc, positions_cache[i] = bucket->p; } +#ifndef USE_THREADS result = solveJoints(table, iter, positions_cache, nb_joints, earc->bcount, 0, 0, iarc->edges.first, nb_joints, angle_weight, length_weight, distance_weight); - min_cost = result->weight; +#else + solveJoints(table, iter, positions_cache, nb_joints, earc->bcount, 0, 0, iarc->edges.first, nb_joints, angle_weight, length_weight, distance_weight); +#endif + copyMemoPositions(best_positions, table, earc->bcount, nb_joints); - + MEM_freeN(table); MEM_freeN(positions_cache); } diff --git a/source/blender/editors/mesh/editmesh_mods.c b/source/blender/editors/mesh/editmesh_mods.c index 8c035ca46fd..3f9d793cd70 100644 --- a/source/blender/editors/mesh/editmesh_mods.c +++ b/source/blender/editors/mesh/editmesh_mods.c @@ -137,7 +137,7 @@ static void EM_select_mirrored(Object *obedit, EditMesh *em, int extend) void EM_automerge(Scene *scene, Object *obedit, int update) { Mesh *me= obedit ? obedit->data : NULL; /* can be NULL */ - int len; + /* int len; */ /* UNUSED */ if ((scene->toolsettings->automerge) && (obedit && obedit->type==OB_MESH && (obedit->mode & OB_MODE_EDIT)) @@ -145,7 +145,7 @@ void EM_automerge(Scene *scene, Object *obedit, int update) EditMesh *em= me->edit_mesh; int totvert= em->totvert, totedge= em->totedge, totface= em->totface; - len = removedoublesflag(em, 1, 1, scene->toolsettings->doublimit); + /* len = */ /* UNUSED */ removedoublesflag(em, 1, 1, scene->toolsettings->doublimit); if (totvert != em->totvert || totedge != em->totedge || totface != em->totface) { if (update) { DAG_id_tag_update(&me->id, 0); diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c index c8e3075ac60..40d3ccb015c 100644 --- a/source/blender/editors/mesh/editmesh_tools.c +++ b/source/blender/editors/mesh/editmesh_tools.c @@ -1591,7 +1591,7 @@ static void fill_quad_single(EditMesh *em, EditFace *efa, struct GHash *gh, int EditEdge *cedge=NULL; EditVert *v[4], **verts; EditFace *hold; - short start=0, end, left, right, vertsize,i; + short start=0, /* end, */ /* UNUSED */ left, right, vertsize,i; v[0] = efa->v1; v[1] = efa->v2; @@ -1613,7 +1613,7 @@ static void fill_quad_single(EditMesh *em, EditFace *efa, struct GHash *gh, int // the array to the correct direction if(verts[0] != v[start]) {flipvertarray(verts,numcuts+2);} - end = (start+1)%4; + /* end = (start+1)%4; */ /* UNUSED */ left = (start+2)%4; right = (start+3)%4; @@ -1677,7 +1677,7 @@ static void fill_tri_single(EditMesh *em, EditFace *efa, struct GHash *gh, int n EditEdge *cedge=NULL; EditVert *v[3], **verts; EditFace *hold; - short start=0, end, op, vertsize,i; + short start=0, /* end, */ /* UNUSED */ op, vertsize,i; v[0] = efa->v1; v[1] = efa->v2; @@ -1697,8 +1697,8 @@ static void fill_tri_single(EditMesh *em, EditFace *efa, struct GHash *gh, int n // the array to the correct direction if(verts[0] != v[start]) {flipvertarray(verts,numcuts+2);} - end = (start+1)%3; - op = (start+2)%3; + /* end = (start+1)%3; */ /* UNUSED */ + op = (start+2)%3; /* We should have something like this now @@ -1888,7 +1888,7 @@ static void fill_quad_double_adj_fan(EditMesh *em, EditFace *efa, struct GHash * EditEdge *cedge[2]={NULL, NULL}; EditVert *v[4], *op=NULL, **verts[2]; EditFace *hold; - short start=0, start2=0, vertsize,i; + short start=0, start2=0, /* vertsize, */ /* UNUSED */ i; v[0] = efa->v1; v[1] = efa->v2; @@ -1905,7 +1905,7 @@ static void fill_quad_double_adj_fan(EditMesh *em, EditFace *efa, struct GHash * verts[0] = BLI_ghash_lookup(gh, cedge[0]); verts[1] = BLI_ghash_lookup(gh, cedge[1]); //This is the index size of the verts array - vertsize = numcuts+2; + /* vertsize = numcuts+2; */ /* UNUSED */ // Is the original v1 the same as the first vert on the selected edge? // if not, the edge is running the opposite direction in this face so flip @@ -1952,7 +1952,7 @@ static void fill_quad_double_adj_inner(EditMesh *em, EditFace *efa, struct GHash EditEdge *cedge[2]={NULL, NULL}; EditVert *v[4], *op=NULL, **verts[2],**inner; EditFace *hold; - short start=0, start2=0, vertsize,i; + short start=0, start2=0, /* vertsize, */ /* UNUSED */ i; float co[3]; v[0] = efa->v1; @@ -1970,7 +1970,7 @@ static void fill_quad_double_adj_inner(EditMesh *em, EditFace *efa, struct GHash verts[0] = BLI_ghash_lookup(gh, cedge[0]); verts[1] = BLI_ghash_lookup(gh, cedge[1]); //This is the index size of the verts array - vertsize = numcuts+2; + /* vertsize = numcuts+2; */ /* UNUSED */ // Is the original v1 the same as the first vert on the selected edge? // if not, the edge is running the opposite direction in this face so flip @@ -2297,7 +2297,7 @@ static void fill_quad_quadruple(EditMesh *em, EditFace *efa, struct GHash *gh, i EditVert **verts[4], ***innerverts; EditFace *hold; EditEdge temp; - short vertsize, i, j; + short /* vertsize, */ /* UNUSED */ i, j; // Point verts[0] and [1] to the array of new verts for cedge[0] and cedge[1] verts[0] = BLI_ghash_lookup(gh, efa->e1); @@ -2306,7 +2306,7 @@ static void fill_quad_quadruple(EditMesh *em, EditFace *efa, struct GHash *gh, i verts[3] = BLI_ghash_lookup(gh, efa->e4); //This is the index size of the verts array - vertsize = numcuts+2; + /* vertsize = numcuts+2; */ /* UNUSED */ // Is the original v1 the same as the first vert on the selected edge? // if not, the edge is running the opposite direction in this face so flip @@ -2392,7 +2392,7 @@ static void fill_quad_quadruple(EditMesh *em, EditFace *efa, struct GHash *gh, i static void fill_tri_triple(EditMesh *em, EditFace *efa, struct GHash *gh, int numcuts, float smooth, float fractal, int beauty) { EditVert **verts[3], ***innerverts; - short vertsize, i, j; + short /* vertsize, */ /* UNUSED */ i, j; EditFace *hold; EditEdge temp; @@ -2402,7 +2402,7 @@ static void fill_tri_triple(EditMesh *em, EditFace *efa, struct GHash *gh, int n verts[2] = BLI_ghash_lookup(gh, efa->e3); //This is the index size of the verts array - vertsize = numcuts+2; + /* vertsize = numcuts+2; */ /* UNUSED */ // Is the original v1 the same as the first vert on the selected edge? // if not, the edge is running the opposite direction in this face so flip @@ -2547,7 +2547,7 @@ static void fill_quad_singlevert(EditMesh *em, EditFace *efa, struct GHash *gh) EditEdge *cedge=NULL; EditVert *v[4], **verts; EditFace *hold; - short start=0, end, left, right, vertsize; + short start=0, end, left, right /* , vertsize */ /* UNUSED */; v[0] = efa->v1; v[1] = efa->v2; @@ -2562,7 +2562,7 @@ static void fill_quad_singlevert(EditMesh *em, EditFace *efa, struct GHash *gh) // Point verts to the array of new verts for cedge verts = BLI_ghash_lookup(gh, cedge); //This is the index size of the verts array - vertsize = 3; + /* vertsize = 3; */ /* UNUSED */ // Is the original v1 the same as the first vert on the selected edge? // if not, the edge is running the opposite direction in this face so flip @@ -3629,7 +3629,7 @@ static const EnumPropertyItem axis_items_xy[]= { static void edge_rotate(EditMesh *em, wmOperator *op, EditEdge *eed, int dir) { EditVert **verts[2]; - EditFace *face[2], *efa, *newFace[2]; + EditFace *face[2], *efa /* , *newFace[2] */ /* UNUSED */; EditEdge **edges[2], **hiddenedges, *srchedge; int facecount, p1, p2, p3, p4, fac1, fac2, i, j; int numhidden, numshared, p[2][4]; @@ -3720,16 +3720,16 @@ static void edge_rotate(EditMesh *em, wmOperator *op, EditEdge *eed, int dir) if(fac1 == 3 && fac2 == 3) { /* no need of reverse setup */ - newFace[0]= EM_face_from_faces(em, face[0], face[1], p[0][1], p[0][2], 4+p[1][1], -1); - newFace[1]= EM_face_from_faces(em, face[1], face[0], p[1][1], p[1][2], 4+p[0][1], -1); + /* newFace[0]= */ /* UNUSED */EM_face_from_faces(em, face[0], face[1], p[0][1], p[0][2], 4+p[1][1], -1); + /* newFace[1]= */ /* UNUSED */EM_face_from_faces(em, face[1], face[0], p[1][1], p[1][2], 4+p[0][1], -1); } else if(fac1 == 4 && fac2 == 3) { if(dir == DIRECTION_CCW) { - newFace[0]= EM_face_from_faces(em, face[0], face[1], p[0][1], p[0][2], p[0][3], 4+p[1][1]); - newFace[1]= EM_face_from_faces(em, face[1], face[0], p[1][1], p[1][2], 4+p[0][1], -1); + /* newFace[0]= */ /* UNUSED */EM_face_from_faces(em, face[0], face[1], p[0][1], p[0][2], p[0][3], 4+p[1][1]); + /* newFace[1]= */ /* UNUSED */EM_face_from_faces(em, face[1], face[0], p[1][1], p[1][2], 4+p[0][1], -1); } else if (dir == DIRECTION_CW) { - newFace[0]= EM_face_from_faces(em, face[0], face[1], p[0][2], 4+p[1][1], p[0][0], p[0][1]); - newFace[1]= EM_face_from_faces(em, face[1], face[0], 4+p[0][2], p[1][0], p[1][1], -1); + /* newFace[0]= */ /* UNUSED */EM_face_from_faces(em, face[0], face[1], p[0][2], 4+p[1][1], p[0][0], p[0][1]); + /* newFace[1]= */ /* UNUSED */EM_face_from_faces(em, face[1], face[0], 4+p[0][2], p[1][0], p[1][1], -1); verts[0][p[0][2]]->f |= SELECT; verts[1][p[1][1]]->f |= SELECT; @@ -3737,11 +3737,11 @@ static void edge_rotate(EditMesh *em, wmOperator *op, EditEdge *eed, int dir) } else if(fac1 == 3 && fac2 == 4) { if(dir == DIRECTION_CCW) { - newFace[0]= EM_face_from_faces(em, face[0], face[1], p[0][1], p[0][2], 4+p[1][1], -1); - newFace[1]= EM_face_from_faces(em, face[1], face[0], p[1][1], p[1][2], p[1][3], 4+p[0][1]); + /* newFace[0]= */ /* UNUSED */EM_face_from_faces(em, face[0], face[1], p[0][1], p[0][2], 4+p[1][1], -1); + /* newFace[1]= */ /* UNUSED */EM_face_from_faces(em, face[1], face[0], p[1][1], p[1][2], p[1][3], 4+p[0][1]); } else if (dir == DIRECTION_CW) { - newFace[0]= EM_face_from_faces(em, face[0], face[1], p[0][0], p[0][1], 4+p[1][2], -1); - newFace[1]= EM_face_from_faces(em, face[1], face[0], p[1][1], p[1][2], 4+p[0][1], 4+p[0][2]); + /* newFace[0]= */ /* UNUSED */EM_face_from_faces(em, face[0], face[1], p[0][0], p[0][1], 4+p[1][2], -1); + /* newFace[1]= */ /* UNUSED */EM_face_from_faces(em, face[1], face[0], p[1][1], p[1][2], 4+p[0][1], 4+p[0][2]); verts[0][p[0][1]]->f |= SELECT; verts[1][p[1][2]]->f |= SELECT; @@ -3750,11 +3750,11 @@ static void edge_rotate(EditMesh *em, wmOperator *op, EditEdge *eed, int dir) } else if(fac1 == 4 && fac2 == 4) { if(dir == DIRECTION_CCW) { - newFace[0]= EM_face_from_faces(em, face[0], face[1], p[0][1], p[0][2], p[0][3], 4+p[1][1]); - newFace[1]= EM_face_from_faces(em, face[1], face[0], p[1][1], p[1][2], p[1][3], 4+p[0][1]); + /* newFace[0]= */ /* UNUSED */EM_face_from_faces(em, face[0], face[1], p[0][1], p[0][2], p[0][3], 4+p[1][1]); + /* newFace[1]= */ /* UNUSED */EM_face_from_faces(em, face[1], face[0], p[1][1], p[1][2], p[1][3], 4+p[0][1]); } else if (dir == DIRECTION_CW) { - newFace[0]= EM_face_from_faces(em, face[0], face[1], p[0][2], p[0][3], 4+p[1][1], 4+p[1][2]); - newFace[1]= EM_face_from_faces(em, face[1], face[0], p[1][2], p[1][3], 4+p[0][1], 4+p[0][2]); + /* newFace[0]= */ /* UNUSED */EM_face_from_faces(em, face[0], face[1], p[0][2], p[0][3], 4+p[1][1], 4+p[1][2]); + /* newFace[1]= */ /* UNUSED */EM_face_from_faces(em, face[1], face[0], p[1][2], p[1][3], 4+p[0][1], 4+p[0][2]); verts[0][p[0][2]]->f |= SELECT; verts[1][p[1][2]]->f |= SELECT; -- cgit v1.2.3 From 4b273f013e043d2f64997bc60f0058e0898e49b8 Mon Sep 17 00:00:00 2001 From: Dalai Felinto Date: Mon, 26 Sep 2011 05:26:04 +0000 Subject: cmake files for bundling blenderplayer in OSX this is working fine. The only problem is described in the XXX there. While Blender is linked to the right place during `make` time (~/bin/blender.app/Content/MacOS/blender) blenderplayer is in the top bin folder (~/bin/blenderplayer). That means it will be correct only after you run `make install` (we are moving it to the right place inside the bundle). I couldn't find the place to fix this properly. I will see with Jens Verwiebe how we can address that. --- source/creator/CMakeLists.txt | 57 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) (limited to 'source') diff --git a/source/creator/CMakeLists.txt b/source/creator/CMakeLists.txt index 0b5d9f7c15c..87fd880ee72 100644 --- a/source/creator/CMakeLists.txt +++ b/source/creator/CMakeLists.txt @@ -709,6 +709,63 @@ elseif(APPLE) \${TARGETDIR_VER} ) endif() + + # install blenderplayer bundle - copy of blender.app above. re-using macros et al + if(WITH_GAMEENGINE AND WITH_PLAYER) + set(SOURCEDIR ${CMAKE_SOURCE_DIR}/source/darwin/blenderplayer.app) + set(SOURCEINFO ${SOURCEDIR}/Contents/Info.plist) + set(TARGETDIR_VER ${TARGETDIR}/blenderplayer.app/Contents/MacOS/${BLENDER_VERSION}) + + # setup Info.plist + execute_process(COMMAND date "+%Y-%m-%d" OUTPUT_VARIABLE BLENDER_DATE OUTPUT_STRIP_TRAILING_WHITESPACE) + + # important to make a clean install each time else old scripts get loaded. + install( + CODE + "file(REMOVE_RECURSE ${TARGETDIR_VER})" + ) + + # message after building. + add_custom_command( + TARGET blender POST_BUILD MAIN_DEPENDENCY blender + COMMAND ${CMAKE_COMMAND} -E echo 'now run: \"make install\" to copy runtime files & scripts to ${TARGETDIR_VER}' + ) + + install( + FILES ${SOURCEDIR}/Contents/PkgInfo + DESTINATION ${TARGETDIR}/blenderplayer.app/Contents + ) + + install_dir( + ${SOURCEDIR}/Contents/Resources + \${TARGETDIR}/blenderplayer.app/Contents/ + ) + + # python + if(WITH_PYTHON) + add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/python + COMMAND rm -rf ${CMAKE_CURRENT_BINARY_DIR}/python/ + COMMAND mkdir ${CMAKE_CURRENT_BINARY_DIR}/python/ + COMMAND unzip -q ${LIBDIR}/release/${PYTHON_ZIP} -d ${CMAKE_CURRENT_BINARY_DIR}/python/ + DEPENDS ${LIBDIR}/release/${PYTHON_ZIP}) + + # copy extracted python files + install_dir( + ${CMAKE_CURRENT_BINARY_DIR}/python + \${TARGETDIR_VER} + ) + endif() + + # This is a hack. Blender is linked to the right place (inside the .app) + # blenderplayer not ... that also means blenderplayer is in the right place + # only when we do make install. XXX to be fixed. + install( + CODE + "file(RENAME ${TARGETDIR}/blenderplayer ${TARGETDIR}/blenderplayer.app/Contents/MacOS/blenderplayer)" + ) + + endif() endif() unset(BLENDER_TEXT_FILES) -- cgit v1.2.3 From 11a0e008199a98c3e5863a6e5cc5357f2b949c55 Mon Sep 17 00:00:00 2001 From: Dalai Felinto Date: Mon, 26 Sep 2011 06:39:19 +0000 Subject: BGE Material settings renaming Back Culling to Backface Culling and make it on by default under suggestion of Mitchell Stokes (Moguri) --- source/blender/blenkernel/intern/material.c | 2 +- source/blender/makesrna/intern/rna_material.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'source') diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c index f27046fe603..a25da56d573 100644 --- a/source/blender/blenkernel/intern/material.c +++ b/source/blender/blenkernel/intern/material.c @@ -193,7 +193,7 @@ void init_material(Material *ma) ma->vol.ms_diff = 1.f; ma->vol.ms_intensity = 1.f; - ma->game.flag=0; + ma->game.flag = GEMAT_BACKCULL; ma->game.alpha_blend=0; ma->game.face_orientation=0; diff --git a/source/blender/makesrna/intern/rna_material.c b/source/blender/makesrna/intern/rna_material.c index 6ed2147ce1b..54631da7bca 100644 --- a/source/blender/makesrna/intern/rna_material.c +++ b/source/blender/makesrna/intern/rna_material.c @@ -767,9 +767,9 @@ static void rna_def_material_gamesettings(BlenderRNA *brna) RNA_def_struct_nested(brna, srna, "Material"); RNA_def_struct_ui_text(srna, "Material Game Settings", "Game Engine settings for a Material datablock"); - prop= RNA_def_property(srna, "back_culling", PROP_BOOLEAN, PROP_NONE); + prop= RNA_def_property(srna, "backface_culling", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", GEMAT_BACKCULL); /* use bitflags */ - RNA_def_property_ui_text(prop, "Back Culling", "Hide Back of the face in Game Engine "); + RNA_def_property_ui_text(prop, "Backface Culling", "Hide Back of the face in Game Engine "); RNA_def_property_update(prop, 0, "rna_Material_draw_update"); prop= RNA_def_property(srna, "text", PROP_BOOLEAN, PROP_NONE); -- cgit v1.2.3 From 8f302f7ffde9f44d7016bae3d74c20b41869b6c7 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 26 Sep 2011 07:39:29 +0000 Subject: bugfix [#28744] Object mapped textures (decals) in linked files are not rendered properly --- source/blender/render/intern/source/convertblender.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'source') diff --git a/source/blender/render/intern/source/convertblender.c b/source/blender/render/intern/source/convertblender.c index 195b037727e..b972569fdf6 100644 --- a/source/blender/render/intern/source/convertblender.c +++ b/source/blender/render/intern/source/convertblender.c @@ -4852,8 +4852,13 @@ static void database_init_objects(Render *re, unsigned int renderlay, int nolamp * NULL is just for init */ set_dupli_tex_mat(NULL, NULL, NULL); - for(SETLOOPER(re->scene, sce_iter, base)) { - ob= base->object; + /* loop over all objects rather then using SETLOOPER because we may + * reference an mtex-mapped object which isnt rendered or is an + * empty in a dupli group. We could scan all render material/lamp/world + * mtex's for mapto objects but its easier just to set the + * 'imat' / 'imat_ren' on all and unlikely to be a performance hit + * See bug: [#28744] - campbell */ + for(ob= re->main->object.first; ob; ob= ob->id.next) { /* imat objects has to be done here, since displace can have texture using Object map-input */ mul_m4_m4m4(mat, ob->obmat, re->viewmat); invert_m4_m4(ob->imat_ren, mat); -- cgit v1.2.3 From aeafb960b198788b0836e16a70622a4c8863d268 Mon Sep 17 00:00:00 2001 From: Dalai Felinto Date: Mon, 26 Sep 2011 07:54:30 +0000 Subject: OSX - cmake: blenderplayer part 2: Jens Verwiever co-patch Using OSX Bundle (in oppose to Blender dummy .app) as start point for binary. That way we don't need to move the blenderplayer after the bundle is finished and we can rebuild it without doing `make install` I will test more tomorrow, but it should be working now --- source/blenderplayer/CMakeLists.txt | 2 ++ source/creator/CMakeLists.txt | 14 ++++++-------- 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'source') diff --git a/source/blenderplayer/CMakeLists.txt b/source/blenderplayer/CMakeLists.txt index c8bf3b002f1..3ab1b4a3cdd 100644 --- a/source/blenderplayer/CMakeLists.txt +++ b/source/blenderplayer/CMakeLists.txt @@ -63,6 +63,8 @@ if(WIN32 AND NOT UNIX) endif() add_executable(blenderplayer ${EXETYPE} ${CMAKE_CURRENT_BINARY_DIR}/dna.c ../icons/winblender.rc) +elseif(APPLE) + add_executable(blenderplayer MACOSX_BUNDLE ${CMAKE_CURRENT_BINARY_DIR}/dna.c) else() add_executable(blenderplayer ${CMAKE_CURRENT_BINARY_DIR}/dna.c) endif() diff --git a/source/creator/CMakeLists.txt b/source/creator/CMakeLists.txt index 87fd880ee72..0bd2763c7d2 100644 --- a/source/creator/CMakeLists.txt +++ b/source/creator/CMakeLists.txt @@ -711,6 +711,7 @@ elseif(APPLE) endif() # install blenderplayer bundle - copy of blender.app above. re-using macros et al + # note we are using OSX Bundle as base and copying Blender dummy bundle on top of it if(WITH_GAMEENGINE AND WITH_PLAYER) set(SOURCEDIR ${CMAKE_SOURCE_DIR}/source/darwin/blenderplayer.app) set(SOURCEINFO ${SOURCEDIR}/Contents/Info.plist) @@ -719,6 +720,11 @@ elseif(APPLE) # setup Info.plist execute_process(COMMAND date "+%Y-%m-%d" OUTPUT_VARIABLE BLENDER_DATE OUTPUT_STRIP_TRAILING_WHITESPACE) + set_target_properties(blender PROPERTIES + MACOSX_BUNDLE_INFO_PLIST ${SOURCEINFO} + MACOSX_BUNDLE_SHORT_VERSION_STRING ${BLENDER_VERSION} + MACOSX_BUNDLE_LONG_VERSION_STRING "${BLENDER_VERSION} ${BLENDER_DATE}") + # important to make a clean install each time else old scripts get loaded. install( CODE @@ -756,14 +762,6 @@ elseif(APPLE) \${TARGETDIR_VER} ) endif() - - # This is a hack. Blender is linked to the right place (inside the .app) - # blenderplayer not ... that also means blenderplayer is in the right place - # only when we do make install. XXX to be fixed. - install( - CODE - "file(RENAME ${TARGETDIR}/blenderplayer ${TARGETDIR}/blenderplayer.app/Contents/MacOS/blenderplayer)" - ) endif() endif() -- cgit v1.2.3 From b3d21088aa924a8930b6577d4f9e9639f7779371 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 26 Sep 2011 08:33:51 +0000 Subject: workaround/fix for [#28379] Shift+F problem when using Ortho Camera temp switch to perspective mode since fly mode doesnt really make sense for otho view. --- source/blender/editors/space_view3d/view3d_fly.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'source') diff --git a/source/blender/editors/space_view3d/view3d_fly.c b/source/blender/editors/space_view3d/view3d_fly.c index 1ce246a5542..02a6cee5140 100644 --- a/source/blender/editors/space_view3d/view3d_fly.c +++ b/source/blender/editors/space_view3d/view3d_fly.c @@ -35,6 +35,7 @@ #include "DNA_anim_types.h" #include "DNA_scene_types.h" #include "DNA_object_types.h" +#include "DNA_camera_types.h" #include "MEM_guardedalloc.h" @@ -199,6 +200,10 @@ typedef struct FlyInfo { float rot_backup[4]; /* backup the views quat incase the user cancels flying in non camera mode. (quat for view, eul for camera) */ short persp_backup; /* remember if were ortho or not, only used for restoring the view if it was a ortho view */ + short is_ortho_cam; /* are we flying an ortho camera in perspective view, + * which was originall in ortho view? + * could probably figure it out but better be explicit */ + void *obtfm; /* backup the objects transform */ /* compare between last state */ @@ -330,6 +335,17 @@ static int initFlyInfo (bContext *C, FlyInfo *fly, wmOperator *op, wmEvent *even fly->persp_backup= fly->rv3d->persp; fly->dist_backup= fly->rv3d->dist; + + /* check for flying ortho camera - which we cant support well + * we _could_ also check for an ortho camera but this is easier */ + if( (fly->rv3d->persp == RV3D_CAMOB) && + (fly->v3d->camera != NULL) && + (fly->rv3d->is_persp == FALSE)) + { + ((Camera *)fly->v3d->camera->data)->type= CAM_PERSP; + fly->is_ortho_cam= TRUE; + } + if (fly->rv3d->persp==RV3D_CAMOB) { Object *ob_back; if ((U.uiflag & USER_CAM_LOCK_NO_PARENT)==0 && (fly->root_parent=fly->v3d->camera->parent)) { @@ -433,6 +449,10 @@ static int flyEnd(bContext *C, FlyInfo *fly) /*Done with correcting for the dist */ } + if(fly->is_ortho_cam) { + ((Camera *)fly->v3d->camera->data)->type= CAM_ORTHO; + } + rv3d->rflag &= ~RV3D_NAVIGATING; //XXX2.5 BIF_view3d_previewrender_signal(fly->sa, PR_DBASE|PR_DISPRECT); /* not working at the moment not sure why */ -- cgit v1.2.3 From f0cceedd7ac61464ffea0ede7893c03d998ac7e6 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Mon, 26 Sep 2011 08:51:02 +0000 Subject: Fix #28747: Crash in Node Editor Setting of transform flags happened with NULL edittree --- source/blender/editors/transform/transform_conversions.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'source') diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index b7a5f4bd979..54ab93b5fcf 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -5227,6 +5227,11 @@ static void createTransNodeData(bContext *C, TransInfo *t) SpaceNode *snode= t->sa->spacedata.first; bNode *node; + if(!snode->edittree) { + t->total= 0; + return; + } + /* set transform flags on nodes */ for (node=snode->edittree->nodes.first; node; node=node->next) { if ((node->flag & NODE_SELECT) || (node->parent && (node->parent->flag & NODE_TRANSFORM))) -- cgit v1.2.3 From 0aa19de52ff0b65352268f1d3728922be48e1c47 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 26 Sep 2011 09:31:24 +0000 Subject: add missing imports to wm.py and remove "." from rna descriptions. --- source/blender/makesrna/intern/rna_particle.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'source') diff --git a/source/blender/makesrna/intern/rna_particle.c b/source/blender/makesrna/intern/rna_particle.c index 56738dd9f11..1d8a91861d6 100644 --- a/source/blender/makesrna/intern/rna_particle.c +++ b/source/blender/makesrna/intern/rna_particle.c @@ -2068,7 +2068,7 @@ static void rna_def_particle_settings(BlenderRNA *brna) prop= RNA_def_property(srna, "courant_target", PROP_FLOAT, PROP_NONE); RNA_def_property_range(prop, 0.01, 10); RNA_def_property_float_default(prop, 0.2); - RNA_def_property_ui_text(prop, "Adaptive Subframe Threshold", "The relative distance a particle can move before requiring more subframes (target Courant number). 0.1-0.3 is the recommended range."); + RNA_def_property_ui_text(prop, "Adaptive Subframe Threshold", "The relative distance a particle can move before requiring more subframes (target Courant number). 0.1-0.3 is the recommended range"); RNA_def_property_update(prop, 0, "rna_Particle_reset"); prop= RNA_def_property(srna, "jitter_factor", PROP_FLOAT, PROP_NONE); @@ -2881,7 +2881,7 @@ static void rna_def_particle_system(BlenderRNA *brna) * ParticleSettings.courant_target instead. */ prop= RNA_def_property(srna, "dt_frac", PROP_FLOAT, PROP_NONE); RNA_def_property_range(prop, 1.0f/101.0f, 1.0f); - RNA_def_property_ui_text(prop, "Timestep", "The current simulation time step size, as a fraction of a frame."); + RNA_def_property_ui_text(prop, "Timestep", "The current simulation time step size, as a fraction of a frame"); RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_struct_path_func(srna, "rna_ParticleSystem_path"); @@ -2903,4 +2903,3 @@ void RNA_def_particle(BlenderRNA *brna) } #endif - -- cgit v1.2.3 From 573ed73be85d7f6342567bdaebbd0662c7428800 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 26 Sep 2011 10:35:47 +0000 Subject: change define INTERNATIONAL --> WITH_INTERNATIONAL also rename backface_culling --> use_backface_culling (which is used elsewhere in rna) --- source/blender/blenfont/BLF_translation.h | 2 +- source/blender/blenfont/CMakeLists.txt | 2 +- source/blender/blenfont/SConscript | 2 +- source/blender/blenfont/intern/blf_lang.c | 6 +++--- source/blender/blenfont/intern/blf_translation.c | 6 +++--- source/blender/editors/interface/CMakeLists.txt | 2 +- source/blender/editors/interface/SConscript | 2 +- source/blender/editors/interface/interface.c | 10 +++++----- source/blender/editors/interface/interface_draw.c | 4 ++-- source/blender/editors/interface/interface_handlers.c | 8 ++++---- source/blender/editors/interface/interface_layout.c | 4 ++-- source/blender/editors/interface/interface_panel.c | 2 +- source/blender/editors/interface/interface_style.c | 2 +- source/blender/makesrna/SConscript | 2 +- source/blender/makesrna/intern/CMakeLists.txt | 2 +- source/blender/makesrna/intern/SConscript | 2 +- source/blender/makesrna/intern/rna_access.c | 6 +++--- source/blender/makesrna/intern/rna_material.c | 2 +- source/blender/python/SConscript | 2 +- source/blender/python/intern/CMakeLists.txt | 2 +- source/blender/python/intern/bpy_rna.c | 6 +++--- source/blender/windowmanager/CMakeLists.txt | 2 +- source/blender/windowmanager/SConscript | 2 +- source/blender/windowmanager/intern/wm_init_exit.c | 2 +- source/gameengine/GamePlayer/ghost/CMakeLists.txt | 2 +- source/gameengine/GamePlayer/ghost/GPG_ghost.cpp | 2 +- source/gameengine/GamePlayer/ghost/SConscript | 2 +- 27 files changed, 44 insertions(+), 44 deletions(-) (limited to 'source') diff --git a/source/blender/blenfont/BLF_translation.h b/source/blender/blenfont/BLF_translation.h index 4377d391354..1c36f3e1504 100644 --- a/source/blender/blenfont/BLF_translation.h +++ b/source/blender/blenfont/BLF_translation.h @@ -37,7 +37,7 @@ /* blf_translation.c */ -#ifdef INTERNATIONAL +#ifdef WITH_INTERNATIONAL unsigned char *BLF_get_unifont(int *unifont_size); void BLF_free_unifont(void); #endif diff --git a/source/blender/blenfont/CMakeLists.txt b/source/blender/blenfont/CMakeLists.txt index b87a3b88f07..838a36d9fe2 100644 --- a/source/blender/blenfont/CMakeLists.txt +++ b/source/blender/blenfont/CMakeLists.txt @@ -55,7 +55,7 @@ if(WITH_INTERNATIONAL) list(APPEND INC_SYS ${GETTEXT_INC} ) - add_definitions(-DINTERNATIONAL) + add_definitions(-DWITH_INTERNATIONAL) endif() blender_add_lib(bf_blenfont "${SRC}" "${INC}" "${INC_SYS}") diff --git a/source/blender/blenfont/SConscript b/source/blender/blenfont/SConscript index 45a55793856..1a86d0ad671 100644 --- a/source/blender/blenfont/SConscript +++ b/source/blender/blenfont/SConscript @@ -15,6 +15,6 @@ if sys.platform == 'win32' or env['OURPLATFORM'] == 'linuxcross': defs.append('_WIN32') if env['WITH_BF_INTERNATIONAL']: - defs.append('INTERNATIONAL') + defs.append('WITH_INTERNATIONAL') env.BlenderLib ( 'bf_blenfont', sources, Split(incs), Split(defs), libtype=['core','player'], priority=[210,210] ) diff --git a/source/blender/blenfont/intern/blf_lang.c b/source/blender/blenfont/intern/blf_lang.c index b0b06bf059b..b5c6b5bd68c 100644 --- a/source/blender/blenfont/intern/blf_lang.c +++ b/source/blender/blenfont/intern/blf_lang.c @@ -36,7 +36,7 @@ #include "BLF_api.h" -#ifdef INTERNATIONAL +#ifdef WITH_INTERNATIONAL #include @@ -209,7 +209,7 @@ void BLF_lang_encoding(const char *str) /* bind_textdomain_codeset(DOMAIN_NAME, encoding_name); */ } -#else /* ! INTERNATIONAL */ +#else /* ! WITH_INTERNATIONAL */ void BLF_lang_init(void) { @@ -228,4 +228,4 @@ void BLF_lang_set(const char *str) return; } -#endif /* INTERNATIONAL */ +#endif /* WITH_INTERNATIONAL */ diff --git a/source/blender/blenfont/intern/blf_translation.c b/source/blender/blenfont/intern/blf_translation.c index b53f4cf7609..8c0a26df4c2 100644 --- a/source/blender/blenfont/intern/blf_translation.c +++ b/source/blender/blenfont/intern/blf_translation.c @@ -32,7 +32,7 @@ #include -#ifdef INTERNATIONAL +#ifdef WITH_INTERNATIONAL #include #endif @@ -45,7 +45,7 @@ #include "BLF_translation.h" -#ifdef INTERNATIONAL +#ifdef WITH_INTERNATIONAL const char unifont_filename[]="droidsans.ttf.gz"; static unsigned char *unifont_ttf= NULL; static int unifont_size= 0; @@ -76,7 +76,7 @@ void BLF_free_unifont(void) const char* BLF_gettext(const char *msgid) { -#ifdef INTERNATIONAL +#ifdef WITH_INTERNATIONAL if( msgid[0] ) return gettext( msgid ); return ""; diff --git a/source/blender/editors/interface/CMakeLists.txt b/source/blender/editors/interface/CMakeLists.txt index cc4c1eaa21c..678be82f160 100644 --- a/source/blender/editors/interface/CMakeLists.txt +++ b/source/blender/editors/interface/CMakeLists.txt @@ -60,7 +60,7 @@ set(SRC ) if(WITH_INTERNATIONAL) - add_definitions(-DINTERNATIONAL) + add_definitions(-DWITH_INTERNATIONAL) endif() if(WITH_HEADLESS) diff --git a/source/blender/editors/interface/SConscript b/source/blender/editors/interface/SConscript index 5998d4d2953..ec5ae99755d 100644 --- a/source/blender/editors/interface/SConscript +++ b/source/blender/editors/interface/SConscript @@ -14,7 +14,7 @@ incs += ' ../../python/' # python button eval defs = [] if env['WITH_BF_INTERNATIONAL']: - defs.append('INTERNATIONAL') + defs.append('WITH_INTERNATIONAL') if env['WITH_BF_PYTHON']: defs.append('WITH_PYTHON') diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index 32fe0fb86f9..8f440f7b61a 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -96,7 +96,7 @@ static void ui_free_but(const bContext *C, uiBut *but); int UI_translate_iface(void) { -#ifdef INTERNATIONAL +#ifdef WITH_INTERNATIONAL return (U.transopts & USER_DOTRANSLATE) && (U.transopts & USER_TR_IFACE); #else return 0; @@ -105,7 +105,7 @@ int UI_translate_iface(void) int UI_translate_tooltips(void) { -#ifdef INTERNATIONAL +#ifdef WITH_INTERNATIONAL return (U.transopts & USER_DOTRANSLATE) && (U.transopts & USER_TR_TOOLTIPS); #else return 0; @@ -114,7 +114,7 @@ int UI_translate_tooltips(void) const char *UI_translate_do_iface(const char *msgid) { -#ifdef INTERNATIONAL +#ifdef WITH_INTERNATIONAL if(UI_translate_iface()) return BLF_gettext(msgid); else @@ -126,7 +126,7 @@ const char *UI_translate_do_iface(const char *msgid) const char *UI_translate_do_tooltip(const char *msgid) { -#ifdef INTERNATIONAL +#ifdef WITH_INTERNATIONAL if(UI_translate_tooltips()) return BLF_gettext(msgid); else @@ -2741,7 +2741,7 @@ static uiBut *ui_def_but_operator(uiBlock *block, int type, const char *opname, if ((!tip || tip[0]=='\0') && ot && ot->description) { tip= ot->description; -#ifdef INTERNATIONAL +#ifdef WITH_INTERNATIONAL if(UI_translate_tooltips()) tip= BLF_gettext(tip); #endif diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c index a1275e237c1..fd437d2b0e5 100644 --- a/source/blender/editors/interface/interface_draw.c +++ b/source/blender/editors/interface/interface_draw.c @@ -500,7 +500,7 @@ void ui_draw_but_IMAGE(ARegion *UNUSED(ar), uiBut *but, uiWidgetColors *UNUSED(w } #if 0 -#ifdef INTERNATIONAL +#ifdef WITH_INTERNATIONAL static void ui_draw_but_CHARTAB(uiBut *but) { /* XXX 2.50 bad global access */ @@ -670,7 +670,7 @@ static void ui_draw_but_CHARTAB(uiBut *but) } } -#endif // INTERNATIONAL +#endif // WITH_INTERNATIONAL #endif static void draw_scope_end(rctf *rect, GLint *scissor) diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index 125928c136b..e4776cdb5f2 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -631,7 +631,7 @@ static void ui_apply_but_IDPOIN(bContext *C, uiBut *but, uiHandleButtonData *dat data->applied= 1; } -#ifdef INTERNATIONAL +#ifdef WITH_INTERNATIONAL static void ui_apply_but_CHARTAB(bContext *C, uiBut *but, uiHandleButtonData *data) { ui_apply_but_func(C, but); @@ -1023,7 +1023,7 @@ static void ui_apply_button(bContext *C, uiBlock *block, uiBut *but, uiHandleBut case IDPOIN: ui_apply_but_IDPOIN(C, but, data); break; -#ifdef INTERNATIONAL +#ifdef WITH_INTERNATIONAL case CHARTAB: ui_apply_but_CHARTAB(C, but, data); break; @@ -3924,7 +3924,7 @@ static int ui_do_but_VECTORSCOPE(bContext *C, uiBlock *block, uiBut *but, uiHand return WM_UI_HANDLER_CONTINUE; } -#ifdef INTERNATIONAL +#ifdef WITH_INTERNATIONAL static int ui_do_but_CHARTAB(bContext *UNUSED(C), uiBlock *UNUSED(block), uiBut *UNUSED(but), uiHandleButtonData *UNUSED(data), wmEvent *UNUSED(event)) { /* XXX 2.50 bad global and state access */ @@ -4584,7 +4584,7 @@ static int ui_do_button(bContext *C, uiBlock *block, uiBut *but, wmEvent *event) case HSVCIRCLE: retval= ui_do_but_HSVCIRCLE(C, block, but, data, event); break; -#ifdef INTERNATIONAL +#ifdef WITH_INTERNATIONAL case CHARTAB: retval= ui_do_but_CHARTAB(C, block, but, data, event); break; diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c index 3c02f7d4bd2..ae66d649a06 100644 --- a/source/blender/editors/interface/interface_layout.c +++ b/source/blender/editors/interface/interface_layout.c @@ -639,7 +639,7 @@ PointerRNA uiItemFullO(uiLayout *layout, const char *opname, const char *name, i if(!name) { name= ot->name; -#ifdef INTERNATIONAL +#ifdef WITH_INTERNATIONAL name= UI_translate_do_iface(name); #endif } @@ -1432,7 +1432,7 @@ void uiItemM(uiLayout *layout, bContext *UNUSED(C), const char *menuname, const if(!name) { name= mt->label; -#ifdef INTERNATIONAL +#ifdef WITH_INTERNATIONAL name= UI_translate_do_iface(name); #endif } diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c index ec7456eebdc..c25e7f23c04 100644 --- a/source/blender/editors/interface/interface_panel.c +++ b/source/blender/editors/interface/interface_panel.c @@ -444,7 +444,7 @@ static void ui_draw_aligned_panel_header(uiStyle *style, uiBlock *block, rcti *r int pnl_icons; const char *activename= panel->drawname[0]?panel->drawname:panel->panelname; -#ifdef INTERNATIONAL +#ifdef WITH_INTERNATIONAL activename= UI_translate_do_iface(activename); #endif diff --git a/source/blender/editors/interface/interface_style.c b/source/blender/editors/interface/interface_style.c index 3a9879384a3..2a183e3d994 100644 --- a/source/blender/editors/interface/interface_style.c +++ b/source/blender/editors/interface/interface_style.c @@ -322,7 +322,7 @@ void uiStyleInit(void) for(font= U.uifonts.first; font; font= font->next) { if(font->uifont_id==UIFONT_DEFAULT) { -#ifdef INTERNATIONAL +#ifdef WITH_INTERNATIONAL int font_size= datatoc_bfont_ttf_size; unsigned char *font_ttf= (unsigned char*)datatoc_bfont_ttf; static int last_font_size = 0; diff --git a/source/blender/makesrna/SConscript b/source/blender/makesrna/SConscript index d0002eda30b..da186a57c8b 100644 --- a/source/blender/makesrna/SConscript +++ b/source/blender/makesrna/SConscript @@ -63,6 +63,6 @@ if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'): incs += ' ' + env['BF_PTHREADS_INC'] if env['WITH_BF_INTERNATIONAL']: - defs.append('INTERNATIONAL') + defs.append('WITH_INTERNATIONAL') env.BlenderLib ( 'bf_rna', objs, Split(incs), defines=defs, libtype=['core','player'], priority = [165,20] ) diff --git a/source/blender/makesrna/intern/CMakeLists.txt b/source/blender/makesrna/intern/CMakeLists.txt index 966bc8f100c..99c7a0e2476 100644 --- a/source/blender/makesrna/intern/CMakeLists.txt +++ b/source/blender/makesrna/intern/CMakeLists.txt @@ -220,7 +220,7 @@ if(WITH_OPENCOLLADA) endif() if(WITH_INTERNATIONAL) - add_definitions(-DINTERNATIONAL) + add_definitions(-DWITH_INTERNATIONAL) endif() # Build makesrna executable diff --git a/source/blender/makesrna/intern/SConscript b/source/blender/makesrna/intern/SConscript index ef05875fe86..d710dd06a17 100644 --- a/source/blender/makesrna/intern/SConscript +++ b/source/blender/makesrna/intern/SConscript @@ -99,7 +99,7 @@ if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'): incs += ' ' + env['BF_PTHREADS_INC'] if env['WITH_BF_INTERNATIONAL']: - defs.append('INTERNATIONAL') + defs.append('WITH_INTERNATIONAL') makesrna_tool.Append(CPPDEFINES=defs) diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c index b7709416a75..b52de6a49b6 100644 --- a/source/blender/makesrna/intern/rna_access.c +++ b/source/blender/makesrna/intern/rna_access.c @@ -470,7 +470,7 @@ static const char *rna_ensure_property_description(PropertyRNA *prop) description= ((IDProperty*)prop)->name; /* XXX - not correct */ } -#ifdef INTERNATIONAL +#ifdef WITH_INTERNATIONAL if((U.transopts&USER_DOTRANSLATE) && (U.transopts&USER_TR_TOOLTIPS)) description= BLF_gettext(description); #endif @@ -487,7 +487,7 @@ static const char *rna_ensure_property_name(PropertyRNA *prop) else name= ((IDProperty*)prop)->name; -#ifdef INTERNATIONAL +#ifdef WITH_INTERNATIONAL if((U.transopts&USER_DOTRANSLATE) && (U.transopts&USER_TR_IFACE)) name= BLF_gettext(name); #endif @@ -1160,7 +1160,7 @@ void RNA_property_enum_items_gettexted(bContext *C, PointerRNA *ptr, PropertyRNA { RNA_property_enum_items(C, ptr, prop, item, totitem, free); -#ifdef INTERNATIONAL +#ifdef WITH_INTERNATIONAL if((U.transopts&USER_DOTRANSLATE) && (U.transopts&USER_TR_IFACE)) { int i; EnumPropertyItem *nitem; diff --git a/source/blender/makesrna/intern/rna_material.c b/source/blender/makesrna/intern/rna_material.c index 54631da7bca..80a418a0047 100644 --- a/source/blender/makesrna/intern/rna_material.c +++ b/source/blender/makesrna/intern/rna_material.c @@ -767,7 +767,7 @@ static void rna_def_material_gamesettings(BlenderRNA *brna) RNA_def_struct_nested(brna, srna, "Material"); RNA_def_struct_ui_text(srna, "Material Game Settings", "Game Engine settings for a Material datablock"); - prop= RNA_def_property(srna, "backface_culling", PROP_BOOLEAN, PROP_NONE); + prop= RNA_def_property(srna, "use_backface_culling", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", GEMAT_BACKCULL); /* use bitflags */ RNA_def_property_ui_text(prop, "Backface Culling", "Hide Back of the face in Game Engine "); RNA_def_property_update(prop, 0, "rna_Material_draw_update"); diff --git a/source/blender/python/SConscript b/source/blender/python/SConscript index f00d49fe8dd..3f47038687a 100644 --- a/source/blender/python/SConscript +++ b/source/blender/python/SConscript @@ -41,7 +41,7 @@ if env['BF_BUILDINFO']: defs.append('BUILD_DATE') if env['WITH_BF_INTERNATIONAL']: - defs.append('INTERNATIONAL') + defs.append('WITH_INTERNATIONAL') sources = env.Glob('intern/*.c') env.BlenderLib( libname = 'bf_python', sources = Split(sources), includes = Split(incs), defines = defs, libtype = ['core'], priority = [361]) diff --git a/source/blender/python/intern/CMakeLists.txt b/source/blender/python/intern/CMakeLists.txt index e628ea10e9c..0d5b980acba 100644 --- a/source/blender/python/intern/CMakeLists.txt +++ b/source/blender/python/intern/CMakeLists.txt @@ -96,7 +96,7 @@ if(WITH_AUDASPACE) endif() if(WITH_INTERNATIONAL) - add_definitions(-DINTERNATIONAL) + add_definitions(-DWITH_INTERNATIONAL) endif() blender_add_lib(bf_python "${SRC}" "${INC}" "${INC_SYS}") diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c index 013eac7fd58..3175c0d088e 100644 --- a/source/blender/python/intern/bpy_rna.c +++ b/source/blender/python/intern/bpy_rna.c @@ -73,7 +73,7 @@ #include "../generic/IDProp.h" /* for IDprop lookups */ #include "../generic/py_capi_utils.h" -#ifdef INTERNATIONAL +#ifdef WITH_INTERNATIONAL #include "UI_interface.h" /* bad level call into editors */ #endif @@ -1523,11 +1523,11 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb } else { param= _PyUnicode_AsString(value); -#ifdef INTERNATIONAL +#ifdef WITH_INTERNATIONAL if(subtype == PROP_TRANSLATE) { param= UI_translate_do_iface(param); } -#endif // INTERNATIONAL +#endif // WITH_INTERNATIONAL } #else // USE_STRING_COERCE diff --git a/source/blender/windowmanager/CMakeLists.txt b/source/blender/windowmanager/CMakeLists.txt index 7c34c086b2e..7da2e17ad89 100644 --- a/source/blender/windowmanager/CMakeLists.txt +++ b/source/blender/windowmanager/CMakeLists.txt @@ -82,7 +82,7 @@ set(SRC add_definitions(-DGLEW_STATIC) if(WITH_INTERNATIONAL) - add_definitions(-DINTERNATIONAL) + add_definitions(-DWITH_INTERNATIONAL) endif() if(WITH_OPENCOLLADA) diff --git a/source/blender/windowmanager/SConscript b/source/blender/windowmanager/SConscript index c60752b85f8..ef6ddd18bb1 100644 --- a/source/blender/windowmanager/SConscript +++ b/source/blender/windowmanager/SConscript @@ -40,6 +40,6 @@ if env['BF_BUILDINFO']: defs.append('WITH_BUILDINFO') if env['WITH_BF_INTERNATIONAL']: - defs.append('INTERNATIONAL') + defs.append('WITH_INTERNATIONAL') env.BlenderLib ( 'bf_windowmanager', sources, Split(incs), defines=defs, libtype=['core'], priority=[5] ) diff --git a/source/blender/windowmanager/intern/wm_init_exit.c b/source/blender/windowmanager/intern/wm_init_exit.c index cf3f12da767..3d7737830eb 100644 --- a/source/blender/windowmanager/intern/wm_init_exit.c +++ b/source/blender/windowmanager/intern/wm_init_exit.c @@ -403,7 +403,7 @@ void WM_exit_ext(bContext *C, const short do_python) BLF_exit(); -#ifdef INTERNATIONAL +#ifdef WITH_INTERNATIONAL BLF_free_unifont(); #endif diff --git a/source/gameengine/GamePlayer/ghost/CMakeLists.txt b/source/gameengine/GamePlayer/ghost/CMakeLists.txt index b452bb97cde..479cf3fd7cc 100644 --- a/source/gameengine/GamePlayer/ghost/CMakeLists.txt +++ b/source/gameengine/GamePlayer/ghost/CMakeLists.txt @@ -79,7 +79,7 @@ if(WITH_CODEC_FFMPEG) endif() if(WITH_INTERNATIONAL) - add_definitions(-DINTERNATIONAL) + add_definitions(-DWITH_INTERNATIONAL) endif() blender_add_lib_nolist(ge_player_ghost "${SRC}" "${INC}" "${INC_SYS}") diff --git a/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp b/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp index 726a1d4119a..f5bd3a91c26 100644 --- a/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp +++ b/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp @@ -999,7 +999,7 @@ int main(int argc, char** argv) RNA_exit(); BLF_exit(); -#ifdef INTERNATIONAL +#ifdef WITH_INTERNATIONAL BLF_free_unifont(); #endif diff --git a/source/gameengine/GamePlayer/ghost/SConscript b/source/gameengine/GamePlayer/ghost/SConscript index 57c1122c2cd..9fb0f053ed8 100644 --- a/source/gameengine/GamePlayer/ghost/SConscript +++ b/source/gameengine/GamePlayer/ghost/SConscript @@ -52,6 +52,6 @@ if env['WITH_BF_FFMPEG']: defs.append('WITH_FFMPEG') if env['WITH_BF_INTERNATIONAL']: - defs.append('INTERNATIONAL') + defs.append('WITH_INTERNATIONAL') env.BlenderLib (libname='ge_player_ghost', sources=source_files, includes = incs, defines = defs, libtype=['player'],priority=[0], cxx_compileflags=env['BGE_CXXFLAGS']) -- cgit v1.2.3 From c23bc0338295cc328534e2a045eee343e248ee69 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Mon, 26 Sep 2011 12:08:04 +0000 Subject: Minor: Other UI strings typos and tweaks. Also updated french po & mo. --- source/blender/makesrna/intern/rna_scene.c | 192 +++++++++++++++++++---------- 1 file changed, 127 insertions(+), 65 deletions(-) (limited to 'source') diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index a9460429c0b..5332d7b1657 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -628,7 +628,8 @@ static void rna_RenderSettings_qtcodecsettings_codecType_set(PointerRNA *ptr, in rd->qtcodecsettings.codecType = quicktime_videocodecType_from_rnatmpvalue(value); } -static EnumPropertyItem *rna_RenderSettings_qtcodecsettings_codecType_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *free) +static EnumPropertyItem *rna_RenderSettings_qtcodecsettings_codecType_itemf(bContext *C, PointerRNA *ptr, + PropertyRNA *UNUSED(prop), int *free) { EnumPropertyItem *item= NULL; EnumPropertyItem tmp = {0, "", 0, "", ""}; @@ -669,7 +670,8 @@ static void rna_RenderSettings_qtcodecsettings_audiocodecType_set(PointerRNA *pt rd->qtcodecsettings.audiocodecType = quicktime_audiocodecType_from_rnatmpvalue(value); } -static EnumPropertyItem *rna_RenderSettings_qtcodecsettings_audiocodecType_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *free) +static EnumPropertyItem *rna_RenderSettings_qtcodecsettings_audiocodecType_itemf(bContext *C, PointerRNA *ptr, + PropertyRNA *UNUSED(prop), int *free) { EnumPropertyItem *item= NULL; EnumPropertyItem tmp = {0, "", 0, "", ""}; @@ -740,7 +742,8 @@ static void rna_RenderSettings_engine_set(PointerRNA *ptr, int value) BLI_strncpy_utf8(rd->engine, type->idname, sizeof(rd->engine)); } -static EnumPropertyItem *rna_RenderSettings_engine_itemf(bContext *UNUSED(C), PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), int *free) +static EnumPropertyItem *rna_RenderSettings_engine_itemf(bContext *UNUSED(C), PointerRNA *UNUSED(ptr), + PropertyRNA *UNUSED(prop), int *free) { RenderEngineType *type; EnumPropertyItem *item= NULL; @@ -1112,7 +1115,8 @@ static void rna_def_tool_settings(BlenderRNA *brna) static EnumPropertyItem sketch_convert_items[] = { {SK_CONVERT_CUT_FIXED, "FIXED", 0, "Fixed", "Subdivide stroke in fixed number of bones"}, {SK_CONVERT_CUT_LENGTH, "LENGTH", 0, "Length", "Subdivide stroke in bones of specific length"}, - {SK_CONVERT_CUT_ADAPTATIVE, "ADAPTIVE", 0, "Adaptive", "Subdivide stroke adaptively, with more subdivision in curvier parts"}, + {SK_CONVERT_CUT_ADAPTATIVE, "ADAPTIVE", 0, "Adaptive", + "Subdivide stroke adaptively, with more subdivision in curvier parts"}, {SK_CONVERT_RETARGET, "RETARGET", 0, "Retarget", "Retarget template bone chain to stroke"}, {0, NULL, 0, NULL, NULL}}; @@ -1165,7 +1169,8 @@ static void rna_def_tool_settings(BlenderRNA *brna) prop= RNA_def_property(srna, "proportional_edit", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "proportional"); RNA_def_property_enum_items(prop, proportional_editing_items); - RNA_def_property_ui_text(prop, "Proportional Editing", "Proportional Editing mode, allows transforms with distance fall-off"); + RNA_def_property_ui_text(prop, "Proportional Editing", + "Proportional Editing mode, allows transforms with distance fall-off"); RNA_def_property_update(prop, NC_SCENE|ND_TOOLSETTINGS, NULL); /* header redraw */ prop= RNA_def_property(srna, "use_proportional_edit_objects", PROP_BOOLEAN, PROP_NONE); @@ -1228,7 +1233,8 @@ static void rna_def_tool_settings(BlenderRNA *brna) prop= RNA_def_property(srna, "use_snap_project", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "snap_flag", SCE_SNAP_PROJECT); - RNA_def_property_ui_text(prop, "Project Individual Elements", "Project individual elements on the surface of other objects"); + RNA_def_property_ui_text(prop, "Project Individual Elements", + "Project individual elements on the surface of other objects"); RNA_def_property_ui_icon(prop, ICON_RETOPO, 0); RNA_def_property_update(prop, NC_SCENE|ND_TOOLSETTINGS, NULL); /* header redraw */ @@ -1257,11 +1263,14 @@ static void rna_def_tool_settings(BlenderRNA *brna) prop= RNA_def_property(srna, "use_record_with_nla", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "autokey_flag", ANIMRECORD_FLAG_WITHNLA); - RNA_def_property_ui_text(prop, "Layered", "Add a new NLA Track + Strip for every loop/pass made over the animation to allow non-destructive tweaking"); + RNA_def_property_ui_text(prop, "Layered", + "Add a new NLA Track + Strip for every loop/pass made over the animation " + "to allow non-destructive tweaking"); prop= RNA_def_property(srna, "use_keyframe_insert_keyingset", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "autokey_flag", AUTOKEY_FLAG_ONLYKEYINGSET); - RNA_def_property_ui_text(prop, "Auto Keyframe Insert Keying Set", "Automatic keyframe insertion using active Keying Set only"); + RNA_def_property_ui_text(prop, "Auto Keyframe Insert Keying Set", + "Automatic keyframe insertion using active Keying Set only"); RNA_def_property_ui_icon(prop, ICON_KEYINGSET, 0); /* UV */ @@ -1372,11 +1381,13 @@ static void rna_def_tool_settings(BlenderRNA *brna) prop= RNA_def_property(srna, "sculpt_paint_use_unified_size", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "sculpt_paint_settings", SCULPT_PAINT_USE_UNIFIED_SIZE); - RNA_def_property_ui_text(prop, "Sculpt/Paint Use Unified Radius", "Instead of per brush radius, the radius is shared across brushes"); + RNA_def_property_ui_text(prop, "Sculpt/Paint Use Unified Radius", + "Instead of per brush radius, the radius is shared across brushes"); prop= RNA_def_property(srna, "sculpt_paint_use_unified_strength", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "sculpt_paint_settings", SCULPT_PAINT_USE_UNIFIED_ALPHA); - RNA_def_property_ui_text(prop, "Sculpt/Paint Use Unified Strength", "Instead of per brush strength, the strength is shared across brushes"); + RNA_def_property_ui_text(prop, "Sculpt/Paint Use Unified Strength", + "Instead of per brush strength, the strength is shared across brushes"); } @@ -1790,8 +1801,10 @@ static void rna_def_scene_game_data(BlenderRNA *brna) PropertyRNA *prop; static EnumPropertyItem framing_types_items[] ={ - {SCE_GAMEFRAMING_BARS, "LETTERBOX", 0, "Letterbox", "Show the entire viewport in the display window, using bar horizontally or vertically"}, - {SCE_GAMEFRAMING_EXTEND, "EXTEND", 0, "Extend", "Show the entire viewport in the display window, viewing more horizontally or vertically"}, + {SCE_GAMEFRAMING_BARS, "LETTERBOX", 0, "Letterbox", + "Show the entire viewport in the display window, using bar horizontally or vertically"}, + {SCE_GAMEFRAMING_EXTEND, "EXTEND", 0, "Extend", + "Show the entire viewport in the display window, viewing more horizontally or vertically"}, {SCE_GAMEFRAMING_SCALE, "SCALE", 0, "Scale", "Stretch or squeeze the viewport to fill the display window"}, {0, NULL, 0, NULL, NULL}}; @@ -1904,7 +1917,8 @@ static void rna_def_scene_game_data(BlenderRNA *brna) prop= RNA_def_property(srna, "stereo_eye_separation", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "eyeseparation"); RNA_def_property_range(prop, 0.01, 5.0); - RNA_def_property_ui_text(prop, "Eye Separation", "Set the distance between the eyes - the camera focal length/30 should be fine"); + RNA_def_property_ui_text(prop, "Eye Separation", + "Set the distance between the eyes - the camera focal length/30 should be fine"); RNA_def_property_update(prop, NC_SCENE, NULL); /* Dome */ @@ -1962,35 +1976,44 @@ static void rna_def_scene_game_data(BlenderRNA *brna) prop= RNA_def_property(srna, "occlusion_culling_resolution", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "occlusionRes"); RNA_def_property_range(prop, 128.0, 1024.0); - RNA_def_property_ui_text(prop, "Occlusion Resolution", "The size of the occlusion buffer in pixel, use higher value for better precision (slower)"); + RNA_def_property_ui_text(prop, "Occlusion Resolution", + "The size of the occlusion buffer in pixel, use higher value for better precision (slower)"); RNA_def_property_update(prop, NC_SCENE, NULL); prop= RNA_def_property(srna, "fps", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "ticrate"); RNA_def_property_ui_range(prop, 1, 60, 1, 1); RNA_def_property_range(prop, 1, 250); - RNA_def_property_ui_text(prop, "Frames Per Second", "The nominal number of game frames per second. Physics fixed timestep = 1/fps, independently of actual frame rate"); + RNA_def_property_ui_text(prop, "Frames Per Second", + "The nominal number of game frames per second " + "(physics fixed timestep = 1/fps, independently of actual frame rate)"); RNA_def_property_update(prop, NC_SCENE, NULL); prop= RNA_def_property(srna, "logic_step_max", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "maxlogicstep"); RNA_def_property_ui_range(prop, 1, 5, 1, 1); RNA_def_property_range(prop, 1, 5); - RNA_def_property_ui_text(prop, "Max Logic Steps", "Sets the maximum number of logic frame per game frame if graphics slows down the game, higher value allows better synchronization with physics"); + RNA_def_property_ui_text(prop, "Max Logic Steps", + "Sets the maximum number of logic frame per game frame if graphics slows down the game, " + "higher value allows better synchronization with physics"); RNA_def_property_update(prop, NC_SCENE, NULL); prop= RNA_def_property(srna, "physics_step_max", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "maxphystep"); RNA_def_property_ui_range(prop, 1, 5, 1, 1); RNA_def_property_range(prop, 1, 5); - RNA_def_property_ui_text(prop, "Max Physics Steps", "Sets the maximum number of physics step per game frame if graphics slows down the game, higher value allows physics to keep up with realtime"); + RNA_def_property_ui_text(prop, "Max Physics Steps", + "Sets the maximum number of physics step per game frame if graphics slows down the game, " + "higher value allows physics to keep up with realtime"); RNA_def_property_update(prop, NC_SCENE, NULL); prop= RNA_def_property(srna, "physics_step_sub", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "physubstep"); RNA_def_property_ui_range(prop, 1, 5, 1, 1); RNA_def_property_range(prop, 1, 5); - RNA_def_property_ui_text(prop, "Physics Sub Steps", "Sets the number of simulation substep per physic timestep, higher value give better physics precision"); + RNA_def_property_ui_text(prop, "Physics Sub Steps", + "Sets the number of simulation substep per physic timestep, " + "higher value give better physics precision"); RNA_def_property_update(prop, NC_SCENE, NULL); /* mode */ @@ -2007,7 +2030,9 @@ static void rna_def_scene_game_data(BlenderRNA *brna) prop= RNA_def_property(srna, "activity_culling_box_radius", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "activityBoxRadius"); RNA_def_property_range(prop, 0.0, 1000.0); - RNA_def_property_ui_text(prop, "box radius", "Radius of the activity bubble, in Manhattan length. Objects outside the box are activity-culled"); + RNA_def_property_ui_text(prop, "box radius", + "Radius of the activity bubble, in Manhattan length " + "(objects outside the box are activity-culled)"); /* booleans */ prop= RNA_def_property(srna, "show_debug_properties", PROP_BOOLEAN, PROP_NONE); @@ -2016,7 +2041,8 @@ static void rna_def_scene_game_data(BlenderRNA *brna) prop= RNA_def_property(srna, "show_framerate_profile", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", GAME_SHOW_FRAMERATE); - RNA_def_property_ui_text(prop, "Show Framerate and Profile", "Show framerate and profiling information while the game runs"); + RNA_def_property_ui_text(prop, "Show Framerate and Profile", + "Show framerate and profiling information while the game runs"); prop= RNA_def_property(srna, "show_physics_visualization", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", GAME_SHOW_PHYSICS); @@ -2149,13 +2175,15 @@ static void rna_def_render_layers(BlenderRNA *brna, PropertyRNA *cprop) prop= RNA_def_property(srna, "active_index", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "actlay"); - RNA_def_property_int_funcs(prop, "rna_RenderSettings_active_layer_index_get", "rna_RenderSettings_active_layer_index_set", "rna_RenderSettings_active_layer_index_range"); + RNA_def_property_int_funcs(prop, "rna_RenderSettings_active_layer_index_get", "rna_RenderSettings_active_layer_index_set", + "rna_RenderSettings_active_layer_index_range"); RNA_def_property_ui_text(prop, "Active Layer Index", "Active index in render layer array"); RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); prop= RNA_def_property(srna, "active", PROP_POINTER, PROP_UNSIGNED); RNA_def_property_struct_type(prop, "SceneRenderLayer"); - RNA_def_property_pointer_funcs(prop, "rna_RenderSettings_active_layer_get", "rna_RenderSettings_active_layer_set", NULL, NULL); + RNA_def_property_pointer_funcs(prop, "rna_RenderSettings_active_layer_get", + "rna_RenderSettings_active_layer_set", NULL, NULL); RNA_def_property_flag(prop, PROP_EDITABLE|PROP_NEVER_NULL); RNA_def_property_ui_text(prop, "Active Render Layer", "Active Render Layer"); RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); @@ -2692,21 +2720,22 @@ static void rna_def_scene_render_data(BlenderRNA *brna) RNA_def_property_int_sdna(prop, NULL, "framapto"); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_range(prop, 1, 900); - RNA_def_property_ui_text(prop, "Frame Map Old", "Specify old mapping value in frames"); + RNA_def_property_ui_text(prop, "Frame Map Old", "Old mapping value in frames"); RNA_def_property_update(prop, NC_SCENE|ND_FRAME, "rna_Scene_framelen_update"); prop= RNA_def_property(srna, "frame_map_new", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "images"); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_range(prop, 1, 900); - RNA_def_property_ui_text(prop, "Frame Map New", "Specify how many frames the Map Old will last"); + RNA_def_property_ui_text(prop, "Frame Map New", "How many frames the Map Old will last"); RNA_def_property_update(prop, NC_SCENE|ND_FRAME, "rna_Scene_framelen_update"); prop= RNA_def_property(srna, "dither_intensity", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "dither_intensity"); RNA_def_property_range(prop, 0.0f, 2.0f); - RNA_def_property_ui_text(prop, "Dither Intensity", "Amount of dithering noise added to the rendered image to break up banding"); + RNA_def_property_ui_text(prop, "Dither Intensity", + "Amount of dithering noise added to the rendered image to break up banding"); RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); prop= RNA_def_property(srna, "pixel_filter_type", PROP_ENUM, PROP_NONE); @@ -2730,7 +2759,8 @@ static void rna_def_scene_render_data(BlenderRNA *brna) prop= RNA_def_property(srna, "octree_resolution", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "ocres"); RNA_def_property_enum_items(prop, octree_resolution_items); - RNA_def_property_ui_text(prop, "Octree Resolution", "Resolution of raytrace accelerator. Use higher resolutions for larger scenes"); + RNA_def_property_ui_text(prop, "Octree Resolution", + "Resolution of raytrace accelerator, use higher resolutions for larger scenes"); RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); prop= RNA_def_property(srna, "raytrace_method", PROP_ENUM, PROP_NONE); @@ -2741,12 +2771,15 @@ static void rna_def_scene_render_data(BlenderRNA *brna) prop= RNA_def_property(srna, "use_instances", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "raytrace_options", R_RAYTRACE_USE_INSTANCES); - RNA_def_property_ui_text(prop, "Use Instances", "Instance support leads to effective memory reduction when using duplicates"); + RNA_def_property_ui_text(prop, "Use Instances", + "Instance support leads to effective memory reduction when using duplicates"); RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); prop= RNA_def_property(srna, "use_local_coords", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "raytrace_options", R_RAYTRACE_USE_LOCAL_COORDS); - RNA_def_property_ui_text(prop, "Use Local Coords", "Vertex coordinates are stored localy on each primitive. Increases memory usage, but may have impact on speed"); + RNA_def_property_ui_text(prop, "Use Local Coords", + "Vertex coordinates are stored localy on each primitive " + "(increases memory usage, but may have impact on speed)"); RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); prop= RNA_def_property(srna, "use_antialiasing", PROP_BOOLEAN, PROP_NONE); @@ -2768,7 +2801,9 @@ static void rna_def_scene_render_data(BlenderRNA *brna) prop= RNA_def_property(srna, "field_order", PROP_ENUM, PROP_NONE); RNA_def_property_enum_bitflag_sdna(prop, NULL, "mode"); RNA_def_property_enum_items(prop, field_order_items); - RNA_def_property_ui_text(prop, "Field Order", "Order of video fields. Select which lines get rendered first, to create smooth motion for TV output"); + RNA_def_property_ui_text(prop, "Field Order", + "Order of video fields (select which lines get rendered first, " + "to create smooth motion for TV output)"); RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); prop= RNA_def_property(srna, "use_fields_still", PROP_BOOLEAN, PROP_NONE); @@ -2829,7 +2864,8 @@ static void rna_def_scene_render_data(BlenderRNA *brna) RNA_def_property_int_sdna(prop, NULL, "threads"); RNA_def_property_range(prop, 1, BLENDER_MAX_THREADS); RNA_def_property_int_funcs(prop, "rna_RenderSettings_threads_get", NULL, NULL); - RNA_def_property_ui_text(prop, "Threads", "Number of CPU threads to use simultaneously while rendering (for multi-core/CPU systems)"); + RNA_def_property_ui_text(prop, "Threads", + "Number of CPU threads to use simultaneously while rendering (for multi-core/CPU systems)"); RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); prop= RNA_def_property(srna, "threads_mode", PROP_ENUM, PROP_NONE); @@ -2860,31 +2896,33 @@ static void rna_def_scene_render_data(BlenderRNA *brna) /* border */ prop= RNA_def_property(srna, "use_border", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "mode", R_BORDER); - RNA_def_property_ui_text(prop, "Border", "Render a user-defined border region, within the frame size. Note, this disables save_buffers and full_sample"); + RNA_def_property_ui_text(prop, "Border", + "Render a user-defined border region, within the frame size " + "(note that this disables save_buffers and full_sample)"); RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); prop= RNA_def_property(srna, "border_min_x", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "border.xmin"); RNA_def_property_range(prop, 0.0f, 1.0f); - RNA_def_property_ui_text(prop, "Border Minimum X", "Sets minimum X value to for the render border"); + RNA_def_property_ui_text(prop, "Border Minimum X", "Minimum X value to for the render border"); RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); prop= RNA_def_property(srna, "border_min_y", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "border.ymin"); RNA_def_property_range(prop, 0.0f, 1.0f); - RNA_def_property_ui_text(prop, "Border Minimum Y", "Sets minimum Y value for the render border"); + RNA_def_property_ui_text(prop, "Border Minimum Y", "Minimum Y value for the render border"); RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); prop= RNA_def_property(srna, "border_max_x", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "border.xmax"); RNA_def_property_range(prop, 0.0f, 1.0f); - RNA_def_property_ui_text(prop, "Border Maximum X", "Sets maximum X value for the render border"); + RNA_def_property_ui_text(prop, "Border Maximum X", "Maximum X value for the render border"); RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); prop= RNA_def_property(srna, "border_max_y", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "border.ymax"); RNA_def_property_range(prop, 0.0f, 1.0f); - RNA_def_property_ui_text(prop, "Border Maximum Y", "Sets maximum Y value for the render border"); + RNA_def_property_ui_text(prop, "Border Maximum Y", "Maximum Y value for the render border"); RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); prop= RNA_def_property(srna, "use_crop_to_border", PROP_BOOLEAN, PROP_NONE); @@ -2894,7 +2932,8 @@ static void rna_def_scene_render_data(BlenderRNA *brna) prop= RNA_def_property(srna, "use_placeholder", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "mode", R_TOUCH); - RNA_def_property_ui_text(prop, "Placeholders", "Create empty placeholder files while rendering frames (similar to Unix 'touch')"); + RNA_def_property_ui_text(prop, "Placeholders", + "Create empty placeholder files while rendering frames (similar to Unix 'touch')"); RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); prop= RNA_def_property(srna, "use_overwrite", PROP_BOOLEAN, PROP_NONE); @@ -2904,12 +2943,15 @@ static void rna_def_scene_render_data(BlenderRNA *brna) prop= RNA_def_property(srna, "use_compositing", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "scemode", R_DOCOMP); - RNA_def_property_ui_text(prop, "Compositing", "Process the render result through the compositing pipeline, if compositing nodes are enabled"); + RNA_def_property_ui_text(prop, "Compositing", + "Process the render result through the compositing pipeline, if compositing nodes are enabled"); RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); prop= RNA_def_property(srna, "use_sequencer", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "scemode", R_DOSEQ); - RNA_def_property_ui_text(prop, "Sequencer", "Process the render (and composited) result through the video sequence editor pipeline, if sequencer strips exist"); + RNA_def_property_ui_text(prop, "Sequencer", + "Process the render (and composited) result through the video sequence " + "editor pipeline, if sequencer strips exist"); RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); prop= RNA_def_property(srna, "use_color_management", PROP_BOOLEAN, PROP_NONE); @@ -2920,7 +2962,8 @@ static void rna_def_scene_render_data(BlenderRNA *brna) prop= RNA_def_property(srna, "use_file_extension", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "scemode", R_EXTENSION); - RNA_def_property_ui_text(prop, "File Extensions", "Add the file format extensions to the rendered file name (eg: filename + .jpg)"); + RNA_def_property_ui_text(prop, "File Extensions", + "Add the file format extensions to the rendered file name (eg: filename + .jpg)"); RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); prop= RNA_def_property(srna, "file_format", PROP_ENUM, PROP_NONE); @@ -2942,7 +2985,8 @@ static void rna_def_scene_render_data(BlenderRNA *brna) prop= RNA_def_property(srna, "use_free_image_textures", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "scemode", R_FREE_IMAGE); - RNA_def_property_ui_text(prop, "Free Image Textures", "Free all image texture from memory after render, to save memory before compositing"); + RNA_def_property_ui_text(prop, "Free Image Textures", + "Free all image texture from memory after render, to save memory before compositing"); RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); prop= RNA_def_property(srna, "use_free_unused_nodes", PROP_BOOLEAN, PROP_NONE); @@ -2953,13 +2997,17 @@ static void rna_def_scene_render_data(BlenderRNA *brna) prop= RNA_def_property(srna, "use_save_buffers", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "scemode", R_EXR_TILE_FILE); RNA_def_property_boolean_funcs(prop, "rna_RenderSettings_save_buffers_get", NULL); - RNA_def_property_ui_text(prop, "Save Buffers","Save tiles for all RenderLayers and SceneNodes to files in the temp directory (saves memory, required for Full Sample)"); + RNA_def_property_ui_text(prop, "Save Buffers", + "Save tiles for all RenderLayers and SceneNodes to files in the temp directory " + "(saves memory, required for Full Sample)"); RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); prop= RNA_def_property(srna, "use_full_sample", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "scemode", R_FULL_SAMPLE); RNA_def_property_boolean_funcs(prop, "rna_RenderSettings_full_sample_get", NULL); - RNA_def_property_ui_text(prop, "Full Sample","Save for every anti-aliasing sample the entire RenderLayer results. This solves anti-aliasing issues with compositing"); + RNA_def_property_ui_text(prop, "Full Sample", + "Save for every anti-aliasing sample the entire RenderLayer results " + "(this solves anti-aliasing issues with compositing)"); RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); prop= RNA_def_property(srna, "display_mode", PROP_ENUM, PROP_NONE); @@ -2970,7 +3018,9 @@ static void rna_def_scene_render_data(BlenderRNA *brna) prop= RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH); RNA_def_property_string_sdna(prop, NULL, "pic"); - RNA_def_property_ui_text(prop, "Output Path", "Directory/name to save animations, # characters defines the position and length of frame numbers"); + RNA_def_property_ui_text(prop, "Output Path", + "Directory/name to save animations, # characters defines the position " + "and length of frame numbers"); RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); /* Bake */ @@ -2996,11 +3046,14 @@ static void rna_def_scene_render_data(BlenderRNA *brna) prop= RNA_def_property(srna, "use_bake_selected_to_active", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "bake_flag", R_BAKE_TO_ACTIVE); - RNA_def_property_ui_text(prop, "Selected to Active", "Bake shading on the surface of selected objects to the active object"); + RNA_def_property_ui_text(prop, "Selected to Active", + "Bake shading on the surface of selected objects to the active object"); prop= RNA_def_property(srna, "use_bake_normalize", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "bake_flag", R_BAKE_NORMALIZE); - RNA_def_property_ui_text(prop, "Normalized", "With displacement normalize to the distance, with ambient occlusion normalize without using material settings"); + RNA_def_property_ui_text(prop, "Normalized", + "With displacement normalize to the distance, with ambient occlusion " + "normalize without using material settings"); prop= RNA_def_property(srna, "use_bake_clear", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "bake_flag", R_BAKE_CLEAR); @@ -3018,7 +3071,7 @@ static void rna_def_scene_render_data(BlenderRNA *brna) prop= RNA_def_property(srna, "bake_distance", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "bake_maxdist"); RNA_def_property_range(prop, 0.0, 1000.0); - RNA_def_property_ui_text(prop, "Distance", "Maximum distance from active object to other object (in blender units"); + RNA_def_property_ui_text(prop, "Distance", "Maximum distance from active object to other object (in blender units)"); prop= RNA_def_property(srna, "bake_bias", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "bake_biasdist"); @@ -3037,7 +3090,7 @@ static void rna_def_scene_render_data(BlenderRNA *brna) prop= RNA_def_property(srna, "use_stamp_time", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "stamp", R_STAMP_TIME); - RNA_def_property_ui_text(prop, "Stamp Time", "Include the render frame as HH:MM:SS.FF in image metadata"); + RNA_def_property_ui_text(prop, "Stamp Time", "Include the rendered frame timecode as HH:MM:SS.FF in image metadata"); RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); prop= RNA_def_property(srna, "use_stamp_date", PROP_BOOLEAN, PROP_NONE); @@ -3057,7 +3110,7 @@ static void rna_def_scene_render_data(BlenderRNA *brna) prop= RNA_def_property(srna, "use_stamp_lens", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "stamp", R_STAMP_CAMERALENS); - RNA_def_property_ui_text(prop, "Stamp Lens", "Include the name of the active cameras lens in image metadata"); + RNA_def_property_ui_text(prop, "Stamp Lens", "Include the active camera's lens in image metadata"); RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); prop= RNA_def_property(srna, "use_stamp_scene", PROP_BOOLEAN, PROP_NONE); @@ -3077,17 +3130,18 @@ static void rna_def_scene_render_data(BlenderRNA *brna) prop= RNA_def_property(srna, "use_stamp_filename", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "stamp", R_STAMP_FILENAME); - RNA_def_property_ui_text(prop, "Stamp Filename", "Include the filename of the .blend file in image metadata"); + RNA_def_property_ui_text(prop, "Stamp Filename", "Include the .blend filename in image metadata"); RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); prop= RNA_def_property(srna, "use_stamp_sequencer_strip", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "stamp", R_STAMP_SEQSTRIP); - RNA_def_property_ui_text(prop, "Stamp Sequence Strip", "Include the name of the foreground sequence strip in image metadata"); + RNA_def_property_ui_text(prop, "Stamp Sequence Strip", + "Include the name of the foreground sequence strip in image metadata"); RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); prop= RNA_def_property(srna, "use_stamp_render_time", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "stamp", R_STAMP_RENDERTIME); - RNA_def_property_ui_text(prop, "Stamp Render Time", "Include the render time in the stamp image"); + RNA_def_property_ui_text(prop, "Stamp Render Time", "Include the render time in image metadata"); RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); prop= RNA_def_property(srna, "stamp_note_text", PROP_STRING, PROP_NONE); @@ -3142,14 +3196,13 @@ static void rna_def_scene_render_data(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Sequencer Preview Shading", "Method to draw in the sequencer view"); /* layers */ - prop= RNA_def_property(srna, "layers", PROP_COLLECTION, PROP_NONE); RNA_def_property_collection_sdna(prop, NULL, "layers", NULL); RNA_def_property_struct_type(prop, "SceneRenderLayer"); RNA_def_property_ui_text(prop, "Render Layers", ""); rna_def_render_layers(brna, prop); - + prop= RNA_def_property(srna, "use_single_layer", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "scemode", R_SINGLE_LAYER); RNA_def_property_ui_text(prop, "Single Layer", "Only render the active layer"); @@ -3159,7 +3212,8 @@ static void rna_def_scene_render_data(BlenderRNA *brna) /* engine */ prop= RNA_def_property(srna, "engine", PROP_ENUM, PROP_NONE); RNA_def_property_enum_items(prop, engine_items); - RNA_def_property_enum_funcs(prop, "rna_RenderSettings_engine_get", "rna_RenderSettings_engine_set", "rna_RenderSettings_engine_itemf"); + RNA_def_property_enum_funcs(prop, "rna_RenderSettings_engine_get", "rna_RenderSettings_engine_set", + "rna_RenderSettings_engine_itemf"); RNA_def_property_ui_text(prop, "Engine", "Engine to use for rendering"); RNA_def_property_update(prop, NC_WINDOW, NULL); @@ -3198,7 +3252,7 @@ static void rna_def_scene_render_data(BlenderRNA *brna) prop= RNA_def_property(srna, "simplify_ao_sss", PROP_FLOAT, PROP_FACTOR); RNA_def_property_float_sdna(prop, NULL, "simplify_aosss"); - RNA_def_property_ui_text(prop, "Simplify AO and SSS", "Global approximate AA and SSS quality factor"); + RNA_def_property_ui_text(prop, "Simplify AO and SSS", "Global approximate AO and SSS quality factor"); RNA_def_property_update(prop, 0, "rna_Scene_simplify_update"); prop= RNA_def_property(srna, "use_simplify_triangulate", PROP_BOOLEAN, PROP_NONE); @@ -3334,7 +3388,8 @@ static void rna_def_scene_keying_sets(BlenderRNA *brna, PropertyRNA *cprop) prop= RNA_def_property(srna, "active_index", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "active_keyingset"); RNA_def_property_int_funcs(prop, "rna_Scene_active_keying_set_index_get", "rna_Scene_active_keying_set_index_set", NULL); - RNA_def_property_ui_text(prop, "Active Keying Set Index", "Current Keying Set index (negative for 'builtin' and positive for 'absolute')"); + RNA_def_property_ui_text(prop, "Active Keying Set Index", + "Current Keying Set index (negative for 'builtin' and positive for 'absolute')"); RNA_def_property_update(prop, NC_SCENE|ND_KEYINGSET, NULL); } @@ -3360,7 +3415,8 @@ static void rna_def_scene_keying_sets_all(BlenderRNA *brna, PropertyRNA *cprop) prop= RNA_def_property(srna, "active_index", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "active_keyingset"); RNA_def_property_int_funcs(prop, "rna_Scene_active_keying_set_index_get", "rna_Scene_active_keying_set_index_set", NULL); - RNA_def_property_ui_text(prop, "Active Keying Set Index", "Current Keying Set index (negative for 'builtin' and positive for 'absolute')"); + RNA_def_property_ui_text(prop, "Active Keying Set Index", + "Current Keying Set index (negative for 'builtin' and positive for 'absolute')"); RNA_def_property_update(prop, NC_SCENE|ND_KEYINGSET, NULL); } @@ -3388,7 +3444,8 @@ void RNA_def_scene(BlenderRNA *brna) /* Struct definition */ srna= RNA_def_struct(brna, "Scene", "ID"); - RNA_def_struct_ui_text(srna, "Scene", "Scene consisting objects and defining time and render related settings"); + RNA_def_struct_ui_text(srna, "Scene", + "Scene data block, consisting in objects and defining time and render related settings"); RNA_def_struct_ui_icon(srna, ICON_SCENE_DATA); RNA_def_struct_clear_flag(srna, STRUCT_ID_REFCOUNT); @@ -3396,7 +3453,7 @@ void RNA_def_scene(BlenderRNA *brna) prop= RNA_def_property(srna, "camera", PROP_POINTER, PROP_NONE); RNA_def_property_flag(prop, PROP_EDITABLE); RNA_def_property_pointer_funcs(prop, NULL, NULL, NULL, "rna_Camera_object_poll"); - RNA_def_property_ui_text(prop, "Camera", "Active camera used for rendering the scene"); + RNA_def_property_ui_text(prop, "Camera", "Active camera, used for rendering the scene"); RNA_def_property_update(prop, NC_SCENE|NA_EDITED, "rna_Scene_view3d_update"); prop= RNA_def_property(srna, "background_set", PROP_POINTER, PROP_NONE); @@ -3485,7 +3542,8 @@ void RNA_def_scene(BlenderRNA *brna) RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_boolean_sdna(prop, NULL, "r.flag", SCER_PRV_RANGE); RNA_def_property_boolean_funcs(prop, NULL, "rna_Scene_use_preview_range_set"); - RNA_def_property_ui_text(prop, "Use Preview Range", "Use an alternative start/end frame for UI playback, rather than the scene start/end frame"); + RNA_def_property_ui_text(prop, "Use Preview Range", + "Use an alternative start/end frame for UI playback, rather than the scene start/end frame"); RNA_def_property_update(prop, NC_SCENE|ND_FRAME, NULL); RNA_def_property_ui_icon(prop, ICON_PREVIEW_RANGE, 0); @@ -3506,7 +3564,7 @@ void RNA_def_scene(BlenderRNA *brna) /* Stamp */ prop= RNA_def_property(srna, "use_stamp_note", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "r.stamp_udata"); - RNA_def_property_ui_text(prop, "Stamp Note", "User define note for the render stamping"); + RNA_def_property_ui_text(prop, "Stamp Note", "User defined note for the render stamping"); RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); /* Animation Data (for Scene) */ @@ -3516,7 +3574,8 @@ void RNA_def_scene(BlenderRNA *brna) prop= RNA_def_property(srna, "is_nla_tweakmode", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", SCE_NLA_EDIT_ON); RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* DO NOT MAKE THIS EDITABLE, OR NLA EDITOR BREAKS */ - RNA_def_property_ui_text(prop, "NLA TweakMode", "Indicates whether there is any action referenced by NLA being edited. Strictly read-only"); + RNA_def_property_ui_text(prop, "NLA TweakMode", + "Whether there is any action referenced by NLA being edited (strictly read-only)"); RNA_def_property_update(prop, NC_SPACE|ND_SPACE_GRAPH, NULL); /* Frame dropping flag for playback and sync enum */ @@ -3558,9 +3617,11 @@ void RNA_def_scene(BlenderRNA *brna) rna_def_scene_keying_sets(brna, prop); prop= RNA_def_property(srna, "keying_sets_all", PROP_COLLECTION, PROP_NONE); - RNA_def_property_collection_funcs(prop, "rna_Scene_all_keyingsets_begin", "rna_Scene_all_keyingsets_next", "rna_iterator_listbase_end", "rna_iterator_listbase_get", 0, 0, 0); + RNA_def_property_collection_funcs(prop, "rna_Scene_all_keyingsets_begin", "rna_Scene_all_keyingsets_next", + "rna_iterator_listbase_end", "rna_iterator_listbase_get", 0, 0, 0); RNA_def_property_struct_type(prop, "KeyingSet"); - RNA_def_property_ui_text(prop, "All Keying Sets", "All Keying Sets available for use (Builtins and Absolute Keying Sets for this Scene)"); + RNA_def_property_ui_text(prop, "All Keying Sets", + "All Keying Sets available for use (Builtins and Absolute Keying Sets for this Scene)"); RNA_def_property_update(prop, NC_SCENE|ND_KEYINGSET, NULL); rna_def_scene_keying_sets_all(brna, prop); @@ -3613,7 +3674,8 @@ void RNA_def_scene(BlenderRNA *brna) prop= RNA_def_property(srna, "use_audio_sync", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "audio.flag", AUDIO_SYNC); - RNA_def_property_ui_text(prop, "Audio Sync", "Play back and sync with audio clock, dropping frames if frame display is too slow"); + RNA_def_property_ui_text(prop, "Audio Sync", + "Play back and sync with audio clock, dropping frames if frame display is too slow"); RNA_def_property_update(prop, NC_SCENE, NULL); prop= RNA_def_property(srna, "use_audio_scrub", PROP_BOOLEAN, PROP_NONE); -- cgit v1.2.3 From 3cff99c9a17aa20273c48afe45266c45608b118c Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Mon, 26 Sep 2011 13:24:42 +0000 Subject: Commented and tagged some unused vars (gcc warnings...). Also fixed some uninitialized warnings. --- source/blender/blenkernel/intern/BME_conversions.c | 14 +++++++------- source/blender/editors/armature/reeb.c | 4 ++-- source/blender/editors/object/object_vgroup.c | 2 +- source/blender/editors/space_text/text_python.c | 4 ++-- source/blender/editors/util/undo.c | 2 +- source/blender/editors/uvedit/uvedit_parametrizer.c | 10 +++++----- 6 files changed, 18 insertions(+), 18 deletions(-) (limited to 'source') diff --git a/source/blender/blenkernel/intern/BME_conversions.c b/source/blender/blenkernel/intern/BME_conversions.c index 4f83d25409a..9a3c9462934 100644 --- a/source/blender/blenkernel/intern/BME_conversions.c +++ b/source/blender/blenkernel/intern/BME_conversions.c @@ -353,7 +353,7 @@ void BME_bmesh_to_editmesh(BME_Mesh *bm, BME_TransData_Head *td, EditMesh *em) { BME_TransData *vtd; - EditVert *eve1, *eve2, *eve3, *eve4, **evlist; + EditVert *eve1, /* *eve2, *eve3, *eve4, */ /* UNUSED */ **evlist; EditEdge *eed; EditFace *efa; @@ -410,14 +410,14 @@ void BME_bmesh_to_editmesh(BME_Mesh *bm, BME_TransData_Head *td, EditMesh *em) { len = BME_cycle_length(f->loopbase); if (len==3 || len==4) { eve1= evlist[f->loopbase->v->tflag1]; - eve2= evlist[f->loopbase->next->v->tflag1]; - eve3= evlist[f->loopbase->next->next->v->tflag1]; - if (len == 4) { + /* eve2= evlist[f->loopbase->next->v->tflag1]; */ /* UNUSED */ + /* eve3= evlist[f->loopbase->next->next->v->tflag1]; */ /* UNUSED */ + /* if (len == 4) { eve4= evlist[f->loopbase->prev->v->tflag1]; } else { eve4= NULL; - } + } */ /* UNUSED */ efa = NULL; //XXX addfacelist(eve1, eve2, eve3, eve4, NULL, NULL); efa->mat_nr = (unsigned char)f->mat_nr; @@ -539,7 +539,7 @@ DerivedMesh *BME_bmesh_to_derivedmesh(BME_Mesh *bm, DerivedMesh *dm) MEdge *medge, *me; MVert *mvert, *mv; int *origindex; - int totface,totedge,totvert,i,bmeshok,len, numTex, numCol; + int totface, totedge, totvert, i, /* bmeshok, */ /* UNUSED */ len, numTex, numCol; BME_Vert *v1=NULL; BME_Edge *e=NULL, *oe=NULL; @@ -567,7 +567,7 @@ DerivedMesh *BME_bmesh_to_derivedmesh(BME_Mesh *bm, DerivedMesh *dm) /*count quads and tris*/ totface = 0; - bmeshok = 1; + /* bmeshok = 1; */ /* UNUSED */ for(f=bm->polys.first;f;f=f->next){ len = BME_cycle_length(f->loopbase); if(len == 3 || len == 4) totface++; diff --git a/source/blender/editors/armature/reeb.c b/source/blender/editors/armature/reeb.c index 04501243acb..78c9e601d87 100644 --- a/source/blender/editors/armature/reeb.c +++ b/source/blender/editors/armature/reeb.c @@ -1353,11 +1353,11 @@ static int joinSubgraphsEnds(ReebGraph *rg, float threshold, int nb_subgraphs) if (end_node && start_node) { - ReebArc *start_arc, *end_arc; + ReebArc *start_arc /* , *end_arc */ /* UNUSED */; int merging = 0; start_arc = start_node->arcs[0]; - end_arc = end_node->arcs[0]; + /* end_arc = end_node->arcs[0]; */ /* UNUSED */ if (start_arc->tail == start_node) { diff --git a/source/blender/editors/object/object_vgroup.c b/source/blender/editors/object/object_vgroup.c index 5265261f3af..e55a99ae2ab 100644 --- a/source/blender/editors/object/object_vgroup.c +++ b/source/blender/editors/object/object_vgroup.c @@ -939,7 +939,7 @@ static void moveCloserToDistanceFromPlane(Scene *scene, Object *ob, Mesh *me, in int totweight = dvert->totweight; float oldw = 0; float oldPos[3] = {0}; - float vc, hc, dist; + float vc, hc, dist = 0.0f /* Not necessary, but quites down gcc warnings! */; int i, k; float (*changes)[2] = MEM_mallocN(sizeof(float *)*totweight*2, "vertHorzChange"); float *dists = MEM_mallocN(sizeof(float)*totweight, "distance"); diff --git a/source/blender/editors/space_text/text_python.c b/source/blender/editors/space_text/text_python.c index 51b4b838171..08008f455e6 100644 --- a/source/blender/editors/space_text/text_python.c +++ b/source/blender/editors/space_text/text_python.c @@ -51,7 +51,7 @@ int text_do_suggest_select(SpaceText *st, ARegion *ar) { - SuggItem *item, *first, *last, *sel; + SuggItem *item, *first, *last /* , *sel */ /* UNUSED */; TextLine *tmp; int l, x, y, w, h, i; int tgti, *top; @@ -62,7 +62,7 @@ int text_do_suggest_select(SpaceText *st, ARegion *ar) first = texttool_suggest_first(); last = texttool_suggest_last(); - sel = texttool_suggest_selected(); + /* sel = texttool_suggest_selected(); */ /* UNUSED */ top = texttool_suggest_top(); if(!last || !first) diff --git a/source/blender/editors/util/undo.c b/source/blender/editors/util/undo.c index c1aca61f795..55fda84874d 100644 --- a/source/blender/editors/util/undo.c +++ b/source/blender/editors/util/undo.c @@ -471,7 +471,7 @@ static int undo_history_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(even if(totitem > 0) { uiPopupMenu *pup= uiPupMenuBegin(C, op->type->name, ICON_NONE); uiLayout *layout= uiPupMenuLayout(pup); - uiLayout *split= uiLayoutSplit(layout, 0, 0), *column; + uiLayout *split= uiLayoutSplit(layout, 0, 0), *column = NULL; int i, c; for(c=0, i=totitem-1; i >= 0; i--, c++) { diff --git a/source/blender/editors/uvedit/uvedit_parametrizer.c b/source/blender/editors/uvedit/uvedit_parametrizer.c index 846b05c1287..1b117a15516 100644 --- a/source/blender/editors/uvedit/uvedit_parametrizer.c +++ b/source/blender/editors/uvedit/uvedit_parametrizer.c @@ -2624,7 +2624,7 @@ static PBool p_chart_abf_solve(PChart *chart) PEdge *e, *e1, *e2, *e3; PAbfSystem sys; int i; - float lastnorm, limit = (chart->nfaces > 100)? 1.0f: 0.001f; + float /* lastnorm, */ /* UNUSED */ limit = (chart->nfaces > 100)? 1.0f: 0.001f; /* setup id's */ sys.ninterior = sys.nfaces = sys.nangles = 0; @@ -2703,12 +2703,12 @@ static PBool p_chart_abf_solve(PChart *chart) p_abf_compute_sines(&sys); /* iteration */ - lastnorm = 1e10; + /* lastnorm = 1e10; */ /* UNUSED */ for (i = 0; i < ABF_MAX_ITER; i++) { float norm = p_abf_compute_gradient(&sys, chart); - lastnorm = norm; + /* lastnorm = norm; */ /* UNUSED */ if (norm < limit) break; @@ -3609,7 +3609,7 @@ static SmoothNode *p_node_new(MemArena *arena, SmoothTriangle **tri, int ntri, f { SmoothNode *node = BLI_memarena_alloc(arena, sizeof *node); int axis, i, t1size = 0, t2size = 0; - float split, mi, mx; + float split, /* mi, */ /* UNUSED */ mx; SmoothTriangle **t1, **t2, *t; node->tri = tri; @@ -3650,7 +3650,7 @@ static SmoothNode *p_node_new(MemArena *arena, SmoothTriangle **tri, int ntri, f node->axis = axis; node->split = split; - mi = bmin[axis]; + /* mi = bmin[axis]; */ /* UNUSED */ mx = bmax[axis]; bmax[axis] = split; node->c1 = p_node_new(arena, t1, t1size, bmin, bmax, depth+1); -- cgit v1.2.3 From dc19877a09e307b91378565cca6e42aca6f68d9e Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Mon, 26 Sep 2011 14:29:39 +0000 Subject: Remove PROP_TRANSLATE flag from labels for operators, menus and panels. This flag lead to storing translated label for templates and instant language switching became impossible. This labels are display-time translated. --- source/blender/makesrna/intern/rna_ui.c | 4 ++-- source/blender/makesrna/intern/rna_wm.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'source') diff --git a/source/blender/makesrna/intern/rna_ui.c b/source/blender/makesrna/intern/rna_ui.c index 587e56443ff..52c359d79dd 100644 --- a/source/blender/makesrna/intern/rna_ui.c +++ b/source/blender/makesrna/intern/rna_ui.c @@ -661,7 +661,7 @@ static void rna_def_panel(BlenderRNA *brna) "class name is \"OBJECT_PT_hello\", and bl_idname is not set by the " "script, then bl_idname = \"OBJECT_PT_hello\""); - prop= RNA_def_property(srna, "bl_label", PROP_STRING, PROP_TRANSLATE); + prop= RNA_def_property(srna, "bl_label", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "type->label"); RNA_def_property_flag(prop, PROP_REGISTER); RNA_def_property_ui_text(prop, "Label", @@ -785,7 +785,7 @@ static void rna_def_menu(BlenderRNA *brna) "class name is \"OBJECT_MT_hello\", and bl_idname is not set by the " "script, then bl_idname = \"OBJECT_MT_hello\""); - prop= RNA_def_property(srna, "bl_label", PROP_STRING, PROP_TRANSLATE); + prop= RNA_def_property(srna, "bl_label", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "type->label"); RNA_def_property_flag(prop, PROP_REGISTER); RNA_def_property_ui_text(prop, "Label", "The menu label"); diff --git a/source/blender/makesrna/intern/rna_wm.c b/source/blender/makesrna/intern/rna_wm.c index c6805206051..8fa780de498 100644 --- a/source/blender/makesrna/intern/rna_wm.c +++ b/source/blender/makesrna/intern/rna_wm.c @@ -1188,7 +1188,7 @@ static void rna_def_operator(BlenderRNA *brna) RNA_def_property_flag(prop, PROP_REGISTER|PROP_NEVER_CLAMP); RNA_def_struct_name_property(srna, prop); - prop= RNA_def_property(srna, "bl_label", PROP_STRING, PROP_TRANSLATE); + prop= RNA_def_property(srna, "bl_label", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "type->name"); RNA_def_property_string_maxlength(prop, 1024); /* else it uses the pointer size! */ RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Operator_bl_label_set"); -- cgit v1.2.3 From fbdfdfefd814128520198c033866cc50298f1758 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 26 Sep 2011 16:53:04 +0000 Subject: use BLI_snprintf rather than sprintf for interface functions --- source/blender/editors/interface/interface.c | 6 +++--- source/blender/editors/interface/interface_draw.c | 3 ++- .../blender/editors/interface/interface_handlers.c | 8 ++++---- .../blender/editors/interface/interface_layout.c | 2 +- .../blender/editors/interface/interface_regions.c | 24 ++++++++++++---------- source/blender/editors/interface/interface_style.c | 2 +- .../editors/interface/interface_templates.c | 15 ++++++-------- source/blender/editors/interface/interface_utils.c | 3 ++- 8 files changed, 32 insertions(+), 31 deletions(-) (limited to 'source') diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index 8f440f7b61a..49156d3cf4a 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -2143,8 +2143,8 @@ void ui_check_but(uiBut *but) UI_GET_BUT_VALUE_INIT(but, value) if(ui_is_but_float(but)) { - if(value == (double) FLT_MAX) sprintf(but->drawstr, "%sinf", but->str); - else if(value == (double) -FLT_MAX) sprintf(but->drawstr, "%s-inf", but->str); + if(value == (double) FLT_MAX) BLI_snprintf(but->drawstr, sizeof(but->drawstr), "%sinf", but->str); + else if(value == (double) -FLT_MAX) BLI_snprintf(but->drawstr, sizeof(but->drawstr), "%s-inf", but->str); /* support length type buttons */ else if(ui_is_but_unit(but)) { char new_str[sizeof(but->drawstr)]; @@ -2157,7 +2157,7 @@ void ui_check_but(uiBut *but) } } else { - sprintf(but->drawstr, "%s%d", but->str, (int)value); + BLI_snprintf(but->drawstr, sizeof(but->drawstr), "%s%d", but->str, (int)value); } if(but->rnaprop) { diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c index fd437d2b0e5..b65be48f7ee 100644 --- a/source/blender/editors/interface/interface_draw.c +++ b/source/blender/editors/interface/interface_draw.c @@ -39,6 +39,7 @@ #include "BLI_math.h" #include "BLI_rect.h" +#include "BLI_string.h" #include "BLI_utildefines.h" #include "BKE_colortools.h" @@ -835,7 +836,7 @@ void ui_draw_but_WAVEFORM(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol), /* draw grid lines here */ for (i=0; i<6; i++) { char str[4]; - sprintf(str,"%-3d",i*20); + BLI_snprintf(str, sizeof(str), "%-3d",i*20); str[3]='\0'; fdrawline(rect.xmin+22, yofs+(i/5.f)*h, rect.xmax+1, yofs+(i/5.f)*h); BLF_draw_default(rect.xmin+1, yofs-5+(i/5.f)*h, 0, str, sizeof(str)-1); diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index e4776cdb5f2..568eaf358e5 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -1113,9 +1113,9 @@ static void ui_but_copy_paste(bContext *C, uiBut *but, uiHandleButtonData *data, if(but->poin==NULL && but->rnapoin.data==NULL); else if(mode=='c') { if(ui_is_but_float(but)) - sprintf(buf, "%f", ui_get_but_val(but)); + BLI_snprintf(buf, sizeof(buf), "%f", ui_get_but_val(but)); else - sprintf(buf, "%d", (int)ui_get_but_val(but)); + BLI_snprintf(buf, sizeof(buf), "%d", (int)ui_get_but_val(but)); WM_clipboard_text_set(buf, 0); } @@ -1136,7 +1136,7 @@ static void ui_but_copy_paste(bContext *C, uiBut *but, uiHandleButtonData *data, else if(mode=='c') { ui_get_but_vectorf(but, rgb); - sprintf(buf, "[%f, %f, %f]", rgb[0], rgb[1], rgb[2]); + BLI_snprintf(buf, sizeof(buf), "[%f, %f, %f]", rgb[0], rgb[1], rgb[2]); WM_clipboard_text_set(buf, 0); } @@ -4367,7 +4367,7 @@ static int ui_but_menu(bContext *C, uiBut *but) PointerRNA ptr_props; if(but->rnapoin.data && but->rnaprop) { - sprintf(buf, "%s.%s", RNA_struct_identifier(but->rnapoin.type), RNA_property_identifier(but->rnaprop)); + BLI_snprintf(buf, sizeof(buf), "%s.%s", RNA_struct_identifier(but->rnapoin.type), RNA_property_identifier(but->rnaprop)); WM_operator_properties_create(&ptr_props, "WM_OT_doc_view"); RNA_string_set(&ptr_props, "doc_id", buf); diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c index ae66d649a06..ab07cb4bbf6 100644 --- a/source/blender/editors/interface/interface_layout.c +++ b/source/blender/editors/interface/interface_layout.c @@ -1219,7 +1219,7 @@ static void rna_search_cb(const struct bContext *C, void *arg_but, const char *s #if 0 /* this name is used for a string comparison and can't be modified, TODO */ name_uiprefix_id(name_ui, id); #else - strcpy(name_ui, id->name+2); + BLI_strncpy(name_ui, id->name+2, sizeof(name_ui)); #endif name= BLI_strdup(name_ui); iconid= ui_id_icon_get((bContext*)C, id, 1); diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c index 4221f7c30ff..c0d6a07bdde 100644 --- a/source/blender/editors/interface/interface_regions.c +++ b/source/blender/editors/interface/interface_regions.c @@ -230,9 +230,11 @@ void ui_set_name_menu(uiBut *but, int value) int i; md= decompose_menu_string(but->str); - for (i=0; initems; i++) - if (md->items[i].retval==value) - strcpy(but->drawstr, md->items[i].str); + for (i=0; initems; i++) { + if (md->items[i].retval==value) { + BLI_strncpy(but->drawstr, md->items[i].str, sizeof(but->drawstr)); + } + } menudata_free(md); } @@ -1798,7 +1800,7 @@ static void ui_update_block_buts_rgb(uiBlock *block, float *rgb) if (rgb_gamma[1] > 1.0f) rgb_gamma[1] = modf(rgb_gamma[1], &intpart); if (rgb_gamma[2] > 1.0f) rgb_gamma[2] = modf(rgb_gamma[2], &intpart); - sprintf(col, "%02X%02X%02X", FTOCHAR(rgb_gamma[0]), FTOCHAR(rgb_gamma[1]), FTOCHAR(rgb_gamma[2])); + BLI_snprintf(col, sizeof(col), "%02X%02X%02X", FTOCHAR(rgb_gamma[0]), FTOCHAR(rgb_gamma[1]), FTOCHAR(rgb_gamma[2])); strcpy(bt->poin, col); } @@ -1986,10 +1988,10 @@ static void uiBlockPicker(uiBlock *block, float *rgb, PointerRNA *ptr, PropertyR /* existence of profile means storage is in linear color space, with display correction */ if (block->color_profile == BLI_PR_NONE) { - sprintf(tip, "Value in Display Color Space"); + BLI_strncpy(tip, "Value in Display Color Space", sizeof(tip)); copy_v3_v3(rgb_gamma, rgb); } else { - sprintf(tip, "Value in Linear RGB Color Space"); + BLI_strncpy(tip, "Value in Linear RGB Color Space", sizeof(tip)); /* make an sRGB version, for Hex code */ linearrgb_to_srgb_v3_v3(rgb_gamma, rgb); } @@ -2058,7 +2060,7 @@ static void uiBlockPicker(uiBlock *block, float *rgb, PointerRNA *ptr, PropertyR rgb[3]= 1.0f; } - sprintf(hexcol, "%02X%02X%02X", FTOCHAR(rgb_gamma[0]), FTOCHAR(rgb_gamma[1]), FTOCHAR(rgb_gamma[2])); + BLI_snprintf(hexcol, sizeof(hexcol), "%02X%02X%02X", FTOCHAR(rgb_gamma[0]), FTOCHAR(rgb_gamma[1]), FTOCHAR(rgb_gamma[2])); bt= uiDefBut(block, TEX, 0, "Hex: ", 0, -60, butwidth, UI_UNIT_Y, hexcol, 0, 8, 0, 0, "Hex triplet for color (#RRGGBB)"); uiButSetFunc(bt, do_hex_rna_cb, bt, hexcol); @@ -2369,7 +2371,7 @@ uiPopupMenu *uiPupMenuBegin(bContext *C, const char *title, int icon) char titlestr[256]; if(icon) { - sprintf(titlestr, " %s", title); + BLI_snprintf(titlestr, sizeof(titlestr), " %s", title); uiDefIconTextBut(pup->block, LABEL, 0, icon, titlestr, 0, 0, 200, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, ""); } else { @@ -2467,7 +2469,7 @@ void uiPupMenuOkee(bContext *C, const char *opname, const char *str, ...) va_list ap; char titlestr[256]; - sprintf(titlestr, "OK? %%i%d", ICON_QUESTION); + BLI_snprintf(titlestr, sizeof(titlestr), "OK? %%i%d", ICON_QUESTION); va_start(ap, str); vconfirm_opname(C, opname, titlestr, str, ap); @@ -2507,9 +2509,9 @@ void uiPupMenuError(bContext *C, const char *str, ...) char nfmt[256]; char titlestr[256]; - sprintf(titlestr, "Error %%i%d", ICON_ERROR); + BLI_snprintf(titlestr, sizeof(titlestr), "Error %%i%d", ICON_ERROR); - sprintf(nfmt, "%s", str); + BLI_strncpy(nfmt, str, sizeof(nfmt)); va_start(ap, str); vconfirm_opname(C, NULL, titlestr, nfmt, ap); diff --git a/source/blender/editors/interface/interface_style.c b/source/blender/editors/interface/interface_style.c index 2a183e3d994..3009d4fea09 100644 --- a/source/blender/editors/interface/interface_style.c +++ b/source/blender/editors/interface/interface_style.c @@ -315,7 +315,7 @@ void uiStyleInit(void) font= MEM_callocN(sizeof(uiFont), "ui font"); BLI_addtail(&U.uifonts, font); - strcpy(font->filename, "default"); + BLI_strncpy(font->filename, "default", sizeof(font->filename)); font->uifont_id= UIFONT_DEFAULT; } diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index bec9e6a7664..a4622f50725 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -412,7 +412,7 @@ static void template_ID(bContext *C, uiLayout *layout, TemplateID *template, Str if(id->us > 1) { char str[32]; - sprintf(str, "%d", id->us); + BLI_snprintf(str, sizeof(str), "%d", id->us); but= uiDefBut(block, BUT, 0, str, 0,0,UI_UNIT_X + ((id->us < 10) ? 0:10), UI_UNIT_Y, NULL, 0, 0, 0, 0, UI_translate_do_tooltip(_("Displays number of users of this data. Click to make a single-user copy"))); @@ -724,7 +724,7 @@ static uiLayout *draw_modifier(uiLayout *layout, Scene *scene, Object *ob, Modif block= uiLayoutGetBlock(row); /* VIRTUAL MODIFIER */ // XXX this is not used now, since these cannot be accessed via RNA - sprintf(str, "%s parent deform", md->name); + BLI_snprintf(str, sizeof(str), "%s parent deform", md->name); uiDefBut(block, LABEL, 0, str, 0, 0, 185, UI_UNIT_Y, NULL, 0.0, 0.0, 0.0, 0.0, "Modifier name"); but = uiDefBut(block, BUT, 0, UI_translate_do_iface(N_("Make Real")), 0, 0, 80, 16, NULL, 0.0, 0.0, 0.0, 0.0, @@ -959,13 +959,10 @@ static uiLayout *draw_constraint(uiLayout *layout, Object *ob, bConstraint *con) cti= constraint_get_typeinfo(con); if (cti == NULL) { /* exception for 'Null' constraint - it doesn't have constraint typeinfo! */ - if (con->type == CONSTRAINT_TYPE_NULL) - strcpy(typestr, "Null"); - else - strcpy(typestr, "Unknown"); + BLI_strncpy(typestr, (con->type == CONSTRAINT_TYPE_NULL) ? "Null" : "Unknown", sizeof(typestr)); } else - strcpy(typestr, cti->name); + BLI_strncpy(typestr, cti->name, sizeof(typestr)); /* determine whether constraint is proxy protected or not */ if (proxylocked_constraints_owner(ob, pchan)) @@ -2112,7 +2109,7 @@ static void list_item_row(bContext *C, uiLayout *layout, PointerRNA *ptr, Pointe manode= give_node_material(ma); if(manode) { char str[MAX_ID_NAME + 12]; - sprintf(str, "Node %s", manode->id.name+2); + BLI_snprintf(str, sizeof(str), "Node %s", manode->id.name+2); uiItemL(sub, str, ui_id_icon_get(C, &manode->id, 1)); } else if(ma->use_nodes) { @@ -2281,7 +2278,7 @@ void uiTemplateList(uiLayout *layout, bContext *C, PointerRNA *ptr, const char * uiItemL(row, "", ICON_NONE); /* next/prev button */ - sprintf(str, "%d :", i); + BLI_snprintf(str, sizeof(str), "%d :", i); but= uiDefIconTextButR_prop(block, NUM, 0, 0, str, 0,0,UI_UNIT_X*5,UI_UNIT_Y, activeptr, activeprop, 0, 0, 0, 0, 0, ""); if(i == 0) uiButSetFlag(but, UI_BUT_DISABLED); diff --git a/source/blender/editors/interface/interface_utils.c b/source/blender/editors/interface/interface_utils.c index a49060eaca2..206ecbad1d0 100644 --- a/source/blender/editors/interface/interface_utils.c +++ b/source/blender/editors/interface/interface_utils.c @@ -36,6 +36,7 @@ #include "DNA_object_types.h" #include "BLI_utildefines.h" +#include "BLI_string.h" #include "BLF_translation.h" @@ -116,7 +117,7 @@ uiBut *uiDefAutoButR(uiBlock *block, PointerRNA *ptr, PropertyRNA *prop, int ind } case PROP_COLLECTION: { char text[256]; - sprintf(text, UI_translate_do_iface(N_("%d items")), RNA_property_collection_length(ptr, prop)); + BLI_snprintf(text, sizeof(text), UI_translate_do_iface(N_("%d items")), RNA_property_collection_length(ptr, prop)); but= uiDefBut(block, LABEL, 0, text, x1, y1, x2, y2, NULL, 0, 0, 0, 0, NULL); uiButSetFlag(but, UI_BUT_DISABLED); break; -- cgit v1.2.3 From dc76be62d99f4da1983cfa84aa9c6d86124064ab Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 26 Sep 2011 17:30:56 +0000 Subject: replace strnlen with BLI_strnlen, make some args const - no functional changes. --- source/blender/editors/include/UI_interface.h | 2 +- source/blender/editors/interface/interface.c | 22 +++++++++++----------- source/blender/editors/interface/interface_anim.c | 2 +- .../blender/editors/interface/interface_intern.h | 6 +++--- .../blender/editors/interface/interface_regions.c | 19 ++++++++----------- .../blender/editors/interface/interface_widgets.c | 4 ++-- 6 files changed, 26 insertions(+), 29 deletions(-) (limited to 'source') diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h index f5abebbebd5..67b17a891ca 100644 --- a/source/blender/editors/include/UI_interface.h +++ b/source/blender/editors/include/UI_interface.h @@ -576,7 +576,7 @@ void uiButSetFocusOnEnter (struct wmWindow *win, uiBut *but); typedef struct AutoComplete AutoComplete; -AutoComplete *autocomplete_begin(const char *startname, int maxlen); +AutoComplete *autocomplete_begin(const char *startname, size_t maxlen); void autocomplete_do_name(AutoComplete *autocpl, const char *name); void autocomplete_end(AutoComplete *autocpl, char *autoname); diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index 49156d3cf4a..aad67b6b0be 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -1528,7 +1528,7 @@ static double ui_get_but_scale_unit(uiBut *but, double value) } /* str will be overwritten */ -void ui_convert_to_unit_alt_name(uiBut *but, char *str, int maxlen) +void ui_convert_to_unit_alt_name(uiBut *but, char *str, size_t maxlen) { if(ui_is_but_unit(but)) { UnitSettings *unit= but->block->unit; @@ -1576,7 +1576,7 @@ static float ui_get_but_step_unit(uiBut *but, float step_default) } -void ui_get_but_string(uiBut *but, char *str, int maxlen) +void ui_get_but_string(uiBut *but, char *str, size_t maxlen) { if(but->rnaprop && ELEM3(but->type, TEX, IDPOIN, SEARCH_MENU)) { PropertyType type; @@ -2176,7 +2176,7 @@ void ui_check_but(uiBut *but) BLI_snprintf(but->drawstr, sizeof(but->drawstr), "%s%.*f", but->str, prec, value); } else { - strncpy(but->drawstr, but->str, UI_MAX_DRAW_STR); + BLI_strncpy(but->drawstr, but->str, UI_MAX_DRAW_STR); } break; @@ -2194,7 +2194,7 @@ void ui_check_but(uiBut *but) break; case KEYEVT: - strncpy(but->drawstr, but->str, UI_MAX_DRAW_STR); + BLI_strncpy(but->drawstr, but->str, UI_MAX_DRAW_STR); if (but->flag & UI_SELECT) { strcat(but->drawstr, "Press a key"); } @@ -2226,15 +2226,15 @@ void ui_check_but(uiBut *but) strcat(but->drawstr, "Press a key "); } else - strncpy(but->drawstr, but->str, UI_MAX_DRAW_STR); + BLI_strncpy(but->drawstr, but->str, UI_MAX_DRAW_STR); break; case BUT_TOGDUAL: /* trying to get the dual-icon to left of text... not very nice */ if(but->str[0]) { - strncpy(but->drawstr, " ", UI_MAX_DRAW_STR); - strncpy(but->drawstr+2, but->str, UI_MAX_DRAW_STR-2); + BLI_strncpy(but->drawstr, " ", UI_MAX_DRAW_STR); + BLI_strncpy(but->drawstr+2, but->str, UI_MAX_DRAW_STR-2); } break; @@ -2242,13 +2242,13 @@ void ui_check_but(uiBut *but) case HSVCIRCLE: break; default: - strncpy(but->drawstr, but->str, UI_MAX_DRAW_STR); + BLI_strncpy(but->drawstr, but->str, UI_MAX_DRAW_STR); } /* if we are doing text editing, this will override the drawstr */ if(but->editstr) - strncpy(but->drawstr, but->editstr, UI_MAX_DRAW_STR); + BLI_strncpy(but->drawstr, but->editstr, UI_MAX_DRAW_STR); /* text clipping moved to widget drawing code itself */ } @@ -2822,12 +2822,12 @@ static int findBitIndex(unsigned int x) { /* autocomplete helper functions */ struct AutoComplete { - int maxlen; + size_t maxlen; char *truncate; const char *startname; }; -AutoComplete *autocomplete_begin(const char *startname, int maxlen) +AutoComplete *autocomplete_begin(const char *startname, size_t maxlen) { AutoComplete *autocpl; diff --git a/source/blender/editors/interface/interface_anim.c b/source/blender/editors/interface/interface_anim.c index 1113f90a652..c35996701ee 100644 --- a/source/blender/editors/interface/interface_anim.c +++ b/source/blender/editors/interface/interface_anim.c @@ -83,7 +83,7 @@ void ui_but_anim_flag(uiBut *but, float cfra) } } -int ui_but_anim_expression_get(uiBut *but, char *str, int maxlen) +int ui_but_anim_expression_get(uiBut *but, char *str, size_t maxlen) { FCurve *fcu; ChannelDriver *driver; diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h index 72eb869dea0..94eb180bd06 100644 --- a/source/blender/editors/interface/interface_intern.h +++ b/source/blender/editors/interface/interface_intern.h @@ -364,8 +364,8 @@ extern void ui_set_but_vectorf(uiBut *but, float *vec); extern void ui_hsvcircle_vals_from_pos(float *valrad, float *valdist, rcti *rect, float mx, float my); -extern void ui_get_but_string(uiBut *but, char *str, int maxlen); -extern void ui_convert_to_unit_alt_name(uiBut *but, char *str, int maxlen); +extern void ui_get_but_string(uiBut *but, char *str, size_t maxlen); +extern void ui_convert_to_unit_alt_name(uiBut *but, char *str, size_t maxlen); extern int ui_set_but_string(struct bContext *C, uiBut *but, const char *str); extern int ui_get_but_string_max_length(uiBut *but); @@ -517,7 +517,7 @@ void ui_but_anim_copy_driver(struct bContext *C); void ui_but_anim_paste_driver(struct bContext *C); void ui_but_anim_add_keyingset(struct bContext *C); void ui_but_anim_remove_keyingset(struct bContext *C); -int ui_but_anim_expression_get(uiBut *but, char *str, int maxlen); +int ui_but_anim_expression_get(uiBut *but, char *str, size_t maxlen); int ui_but_anim_expression_set(uiBut *but, const char *str); int ui_but_anim_expression_create(uiBut *but, const char *str); void ui_but_anim_autokey(struct bContext *C, uiBut *but, struct Scene *scene, float cfra); diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c index c0d6a07bdde..4a9eb8113fe 100644 --- a/source/blender/editors/interface/interface_regions.c +++ b/source/blender/editors/interface/interface_regions.c @@ -84,7 +84,7 @@ typedef struct MenuEntry { } MenuEntry; typedef struct MenuData { - char *instr; + const char *instr; const char *title; int titleicon; @@ -92,7 +92,7 @@ typedef struct MenuData { int nitems, itemssize; } MenuData; -static MenuData *menudata_new(char *instr) +static MenuData *menudata_new(const char *instr) { MenuData *md= MEM_mallocN(sizeof(*md), "MenuData"); @@ -137,7 +137,7 @@ static void menudata_add_item(MenuData *md, const char *str, int retval, int ico static void menudata_free(MenuData *md) { - MEM_freeN(md->instr); + MEM_freeN((void *)md->instr); if (md->items) MEM_freeN(md->items); MEM_freeN(md); @@ -156,7 +156,7 @@ static void menudata_free(MenuData *md) * @param str String to be parsed. * @retval new menudata structure, free with menudata_free() */ -static MenuData *decompose_menu_string(char *str) +static MenuData *decompose_menu_string(const char *str) { char *instr= BLI_strdup(str); MenuData *md= menudata_new(instr); @@ -1613,7 +1613,7 @@ static void ui_block_func_MENUSTR(bContext *UNUSED(C), uiLayout *layout, void *a uiBut *bt; MenuData *md; MenuEntry *entry; - char *instr= arg_str; + const char *instr= arg_str; int columns, rows, a, b; uiBlockSetFlag(block, UI_BLOCK_MOVEMOUSE_QUIT); @@ -2154,7 +2154,7 @@ static int ui_popup_string_hash(char *str) return hash; } -static int ui_popup_menu_hash(char *str) +static int ui_popup_menu_hash(const char *str) { return BLI_ghashutil_strhash(str); } @@ -2204,8 +2204,6 @@ static uiBlock *ui_block_func_POPUP(bContext *C, uiPopupBlockHandle *handle, voi { uiBlock *block; uiBut *bt; - ScrArea *sa; - ARegion *ar; uiPopupMenu *pup= arg_pup; int offset[2], direction, minwidth, width, height, flip; @@ -2277,10 +2275,9 @@ static uiBlock *ui_block_func_POPUP(bContext *C, uiPopupBlockHandle *handle, voi else { /* for a header menu we set the direction automatic */ if(!pup->slideout && flip) { - sa= CTX_wm_area(C); - ar= CTX_wm_region(C); - + ScrArea *sa= CTX_wm_area(C); if(sa && sa->headertype==HEADERDOWN) { + ARegion *ar= CTX_wm_region(C); if(ar && ar->regiontype == RGN_TYPE_HEADER) { uiBlockSetDirection(block, UI_TOP); uiBlockFlipOrder(block); diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c index 45829646145..62bb93055b5 100644 --- a/source/blender/editors/interface/interface_widgets.c +++ b/source/blender/editors/interface/interface_widgets.c @@ -574,7 +574,7 @@ static void widget_check_trias(uiWidgetTrias *tria, rcti *rect) /* prepares shade colors */ -static void shadecolors4(char *coltop, char *coldown, const char *color, short shadetop, short shadedown) +static void shadecolors4(char coltop[4], char *coldown, const char *color, short shadetop, short shadedown) { coltop[0]= CLAMPIS(color[0]+shadetop, 0, 255); @@ -1493,7 +1493,7 @@ void ui_widget_color_init(ThemeUI *tui) /* ************ button callbacks, state ***************** */ -static void widget_state_blend(char *cp, const char *cpstate, const float fac) +static void widget_state_blend(char cp[3], const char cpstate[3], const float fac) { if(fac != 0.0f) { cp[0]= (int)((1.0f-fac)*cp[0] + fac*cpstate[0]); -- cgit v1.2.3 From e897c8e83e1277767d9a44cb0ecb6f8a279dddc3 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 26 Sep 2011 17:32:50 +0000 Subject: fix [#28742] UILayout.menu() with icon misbehaves in headers --- source/blender/editors/interface/interface_widgets.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source') diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c index 62bb93055b5..0215cc05d36 100644 --- a/source/blender/editors/interface/interface_widgets.c +++ b/source/blender/editors/interface/interface_widgets.c @@ -889,7 +889,7 @@ static void widget_draw_icon(uiBut *but, BIFIconID icon, float alpha, rcti *rect UI_icon_draw_aspect(xs, ys, icon, aspect, alpha); } - if(but->flag & UI_ICON_SUBMENU) { + if((but->flag & UI_ICON_SUBMENU) && (but->dt == UI_EMBOSSP)) { xs= rect->xmax-17; ys= (rect->ymin+rect->ymax- height)/2; -- cgit v1.2.3 From 58587a38818b0dba25886c97d584285fef4e9249 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 26 Sep 2011 18:51:10 +0000 Subject: replace strncpy with BLI_strncpy, in some cases strncpy was being misused since it doesnt ensure \0 termination. also dont call CTX_data_scene() twice when checking for function arguments. --- source/blender/blenfont/intern/blf_lang.c | 2 +- source/blender/blenkernel/intern/action.c | 2 +- source/blender/blenkernel/intern/blender.c | 2 +- source/blender/blenkernel/intern/ipo.c | 2 +- source/blender/blenkernel/intern/key.c | 6 +-- source/blender/blenkernel/intern/node.c | 2 +- source/blender/blenkernel/intern/seqeffects.c | 5 +- source/blender/blenkernel/intern/sequencer.c | 2 +- source/blender/blenloader/intern/readfile.c | 8 ++-- source/blender/editors/armature/poselib.c | 2 +- source/blender/editors/physics/particle_edit.c | 2 +- source/blender/editors/sculpt_paint/paint_undo.c | 3 +- .../editors/space_sequencer/sequencer_select.c | 8 ++-- source/blender/editors/space_text/text_draw.c | 3 +- source/blender/editors/util/editmode_undo.c | 2 +- source/blender/modifiers/intern/MOD_armature.c | 3 +- source/blender/modifiers/intern/MOD_bevel.c | 2 +- source/blender/modifiers/intern/MOD_cast.c | 3 +- source/blender/modifiers/intern/MOD_curve.c | 3 +- source/blender/modifiers/intern/MOD_displace.c | 5 +- source/blender/modifiers/intern/MOD_hook.c | 5 +- source/blender/modifiers/intern/MOD_lattice.c | 3 +- source/blender/modifiers/intern/MOD_smooth.c | 3 +- source/blender/modifiers/intern/MOD_warp.c | 5 +- source/blender/modifiers/intern/MOD_wave.c | 3 +- source/blender/nodes/intern/node_common.c | 2 +- .../blender/python/generic/bpy_internal_import.c | 2 +- .../blender/render/intern/source/convertblender.c | 2 +- source/blender/render/intern/source/pipeline.c | 2 +- source/creator/creator.c | 53 +++++++++++----------- 30 files changed, 79 insertions(+), 68 deletions(-) (limited to 'source') diff --git a/source/blender/blenfont/intern/blf_lang.c b/source/blender/blenfont/intern/blf_lang.c index b5c6b5bd68c..0a102884969 100644 --- a/source/blender/blenfont/intern/blf_lang.c +++ b/source/blender/blenfont/intern/blf_lang.c @@ -158,7 +158,7 @@ void BLF_lang_set(const char *str) char *s; /* store defaul locale */ - strncpy(default_locale, env_language, sizeof(default_locale)); + BLI_strncpy(default_locale, env_language, sizeof(default_locale)); /* use first language as default */ s= strchr(default_locale, ':'); diff --git a/source/blender/blenkernel/intern/action.c b/source/blender/blenkernel/intern/action.c index 73ddcbecf94..8d18a1c27e7 100644 --- a/source/blender/blenkernel/intern/action.c +++ b/source/blender/blenkernel/intern/action.c @@ -270,7 +270,7 @@ bActionGroup *action_groups_add_new (bAction *act, const char name[]) /* make it selected, with default name */ agrp->flag = AGRP_SELECTED; - strncpy(agrp->name, name[0] ? name : "Group", sizeof(agrp->name)); + BLI_strncpy(agrp->name, name[0] ? name : "Group", sizeof(agrp->name)); /* add to action, and validate */ BLI_addtail(&act->groups, agrp); diff --git a/source/blender/blenkernel/intern/blender.c b/source/blender/blenkernel/intern/blender.c index 27ea1585e4b..1c729470da4 100644 --- a/source/blender/blenkernel/intern/blender.c +++ b/source/blender/blenkernel/intern/blender.c @@ -518,7 +518,7 @@ void BKE_write_undo(bContext *C, const char *name) /* make new */ curundo= uel= MEM_callocN(sizeof(UndoElem), "undo file"); - strncpy(uel->name, name, MAXUNDONAME-1); + BLI_strncpy(uel->name, name, sizeof(uel->name)); BLI_addtail(&undobase, uel); /* and limit amount to the maximum */ diff --git a/source/blender/blenkernel/intern/ipo.c b/source/blender/blenkernel/intern/ipo.c index 71ca79706db..b885e608b15 100644 --- a/source/blender/blenkernel/intern/ipo.c +++ b/source/blender/blenkernel/intern/ipo.c @@ -1103,7 +1103,7 @@ static void fcurve_add_to_list (ListBase *groups, ListBase *list, FCurve *fcu, c agrp->flag = AGRP_SELECTED; if (muteipo) agrp->flag |= AGRP_MUTED; - strncpy(agrp->name, grpname, sizeof(agrp->name)); + BLI_strncpy(agrp->name, grpname, sizeof(agrp->name)); BLI_addtail(&tmp_act.groups, agrp); BLI_uniquename(&tmp_act.groups, agrp, "Group", '.', offsetof(bActionGroup, name), sizeof(agrp->name)); diff --git a/source/blender/blenkernel/intern/key.c b/source/blender/blenkernel/intern/key.c index 4b8209ab77e..656bb3ef853 100644 --- a/source/blender/blenkernel/intern/key.c +++ b/source/blender/blenkernel/intern/key.c @@ -1445,10 +1445,10 @@ KeyBlock *add_keyblock(Key *key, const char *name) tot= BLI_countlist(&key->block); if(name) { - strncpy(kb->name, name, sizeof(kb->name)); + BLI_strncpy(kb->name, name, sizeof(kb->name)); } else { - if(tot==1) strcpy(kb->name, "Basis"); - else sprintf(kb->name, "Key %d", tot-1); + if(tot==1) BLI_strncpy(kb->name, "Basis", sizeof(kb->name)); + else BLI_snprintf(kb->name, sizeof(kb->name), "Key %d", tot-1); } BLI_uniquename(&key->block, kb, "Key", '.', offsetof(KeyBlock, name), sizeof(kb->name)); diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c index 524a63a8a95..f0be3c99f13 100644 --- a/source/blender/blenkernel/intern/node.c +++ b/source/blender/blenkernel/intern/node.c @@ -1682,7 +1682,7 @@ void node_type_size(struct bNodeType *ntype, int width, int minwidth, int maxwid void node_type_storage(bNodeType *ntype, const char *storagename, void (*freestoragefunc)(struct bNode *), void (*copystoragefunc)(struct bNode *, struct bNode *)) { if (storagename) - strncpy(ntype->storagename, storagename, sizeof(ntype->storagename)); + BLI_strncpy(ntype->storagename, storagename, sizeof(ntype->storagename)); else ntype->storagename[0] = '\0'; ntype->copystoragefunc = copystoragefunc; diff --git a/source/blender/blenkernel/intern/seqeffects.c b/source/blender/blenkernel/intern/seqeffects.c index e5d74177c91..70b44792b30 100644 --- a/source/blender/blenkernel/intern/seqeffects.c +++ b/source/blender/blenkernel/intern/seqeffects.c @@ -41,6 +41,7 @@ #include "BLI_math.h" /* windows needs for M_PI */ #include "BLI_utildefines.h" +#include "BLI_string.h" #include "DNA_scene_types.h" #include "DNA_sequence_types.h" @@ -177,7 +178,7 @@ static void open_plugin_seq(PluginSeq *pis, const char *seqname) MEM_freeN(info); cp= BLI_dynlib_find_symbol(pis->handle, "seqname"); - if(cp) strncpy(cp, seqname, 21); + if(cp) BLI_strncpy(cp, seqname, 21); } else { printf ("Plugin returned unrecognized version number\n"); return; @@ -203,7 +204,7 @@ static PluginSeq *add_plugin_seq(const char *str, const char *seqname) pis= MEM_callocN(sizeof(PluginSeq), "PluginSeq"); - strncpy(pis->name, str, FILE_MAXDIR+FILE_MAXFILE); + BLI_strncpy(pis->name, str, FILE_MAX); open_plugin_seq(pis, seqname); if(pis->doit==NULL) { diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c index a3237da6234..743111b925f 100644 --- a/source/blender/blenkernel/intern/sequencer.c +++ b/source/blender/blenkernel/intern/sequencer.c @@ -3653,7 +3653,7 @@ Sequence *sequencer_add_sound_strip(bContext *C, ListBase *seqbasep, SeqLoadInfo calc_sequence_disp(scene, seq); /* last active name */ - strncpy(ed->act_sounddir, strip->dir, FILE_MAXDIR-1); + BLI_strncpy(ed->act_sounddir, strip->dir, FILE_MAXDIR); seq_load_apply(scene, seq, seq_load); diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 6163fa015a8..f1f055b4004 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -516,7 +516,7 @@ static Main *blo_find_main(FileData *fd, ListBase *mainlist, const char *filepat BLI_addtail(mainlist, m); lib= alloc_libblock(&m->library, ID_LI, "lib"); - strncpy(lib->name, filepath, sizeof(lib->name)-1); + BLI_strncpy(lib->name, filepath, sizeof(lib->name)); BLI_strncpy(lib->filepath, name1, sizeof(lib->filepath)); m->curlib= lib; @@ -5614,7 +5614,7 @@ static void fix_relpaths_library(const char *basepath, Main *main) * link into an unsaved blend file. See [#27405]. * The remap relative option will make it relative again on save - campbell */ if (strncmp(lib->name, "//", 2)==0) { - strncpy(lib->name, lib->filepath, sizeof(lib->name)); + BLI_strncpy(lib->name, lib->filepath, sizeof(lib->name)); } } } @@ -5623,7 +5623,7 @@ static void fix_relpaths_library(const char *basepath, Main *main) /* Libraries store both relative and abs paths, recreate relative paths, * relative to the blend file since indirectly linked libs will be relative to their direct linked library */ if (strncmp(lib->name, "//", 2)==0) { /* if this is relative to begin with? */ - strncpy(lib->name, lib->filepath, sizeof(lib->name)); + BLI_strncpy(lib->name, lib->filepath, sizeof(lib->name)); BLI_path_rel(lib->name, basepath); } } @@ -12240,7 +12240,7 @@ BlendFileData *blo_read_file_internal(FileData *fd, const char *filepath) bfd->main->versionfile= fd->fileversion; bfd->type= BLENFILETYPE_BLEND; - strncpy(bfd->main->name, filepath, sizeof(bfd->main->name)-1); + BLI_strncpy(bfd->main->name, filepath, sizeof(bfd->main->name)); while(bhead) { switch(bhead->code) { diff --git a/source/blender/editors/armature/poselib.c b/source/blender/editors/armature/poselib.c index 8a7d837d2a8..bf2e17c4e87 100644 --- a/source/blender/editors/armature/poselib.c +++ b/source/blender/editors/armature/poselib.c @@ -993,7 +993,7 @@ static void poselib_preview_apply (bContext *C, wmOperator *op) memcpy(&tempstr[index+1], &pld->searchstr[index], 64-index); } else { - strncpy(tempstr, pld->searchstr, 64); + BLI_strncpy(tempstr, pld->searchstr, sizeof(tempstr)); } /* get marker name */ diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c index 74e91cf32ea..019d6df9b73 100644 --- a/source/blender/editors/physics/particle_edit.c +++ b/source/blender/editors/physics/particle_edit.c @@ -3918,7 +3918,7 @@ void PE_undo_push(Scene *scene, const char *str) /* make new */ edit->curundo= undo= MEM_callocN(sizeof(PTCacheUndo), "particle undo file"); - strncpy(undo->name, str, 64-1); + BLI_strncpy(undo->name, str, sizeof(undo->name)); BLI_addtail(&edit->undo, undo); /* and limit amount to the maximum */ diff --git a/source/blender/editors/sculpt_paint/paint_undo.c b/source/blender/editors/sculpt_paint/paint_undo.c index ba0c2c8be92..345cda63f5a 100644 --- a/source/blender/editors/sculpt_paint/paint_undo.c +++ b/source/blender/editors/sculpt_paint/paint_undo.c @@ -34,6 +34,7 @@ #include "BLI_listbase.h" #include "BLI_utildefines.h" +#include "BLI_string.h" #include "DNA_userdef_types.h" @@ -106,7 +107,7 @@ static void undo_stack_push_begin(UndoStack *stack, const char *name, UndoRestor BLI_addtail(&stack->elems, uel); /* name can be a dynamic string */ - strncpy(uel->name, name, MAXUNDONAME-1); + BLI_strncpy(uel->name, name, sizeof(uel->name)); /* limit amount to the maximum amount*/ nr= 0; diff --git a/source/blender/editors/space_sequencer/sequencer_select.c b/source/blender/editors/space_sequencer/sequencer_select.c index a6cc65017bb..c0919ef3043 100644 --- a/source/blender/editors/space_sequencer/sequencer_select.c +++ b/source/blender/editors/space_sequencer/sequencer_select.c @@ -169,11 +169,11 @@ static void UNUSED_FUNCTION(select_single_seq)(Scene *scene, Sequence *seq, int if((seq->type==SEQ_IMAGE) || (seq->type==SEQ_MOVIE)) { if(seq->strip) - strncpy(ed->act_imagedir, seq->strip->dir, FILE_MAXDIR-1); + BLI_strncpy(ed->act_imagedir, seq->strip->dir, FILE_MAXDIR); } else if(seq->type==SEQ_SOUND) { if(seq->strip) - strncpy(ed->act_sounddir, seq->strip->dir, FILE_MAXDIR-1); + BLI_strncpy(ed->act_sounddir, seq->strip->dir, FILE_MAXDIR); } seq->flag|= SELECT; recurs_sel_seq(seq); @@ -389,12 +389,12 @@ static int sequencer_select_invoke(bContext *C, wmOperator *op, wmEvent *event) if ((seq->type == SEQ_IMAGE) || (seq->type == SEQ_MOVIE)) { if(seq->strip) { - strncpy(ed->act_imagedir, seq->strip->dir, FILE_MAXDIR-1); + BLI_strncpy(ed->act_imagedir, seq->strip->dir, FILE_MAXDIR); } } else if (seq->type == SEQ_SOUND) { if(seq->strip) { - strncpy(ed->act_sounddir, seq->strip->dir, FILE_MAXDIR-1); + BLI_strncpy(ed->act_sounddir, seq->strip->dir, FILE_MAXDIR); } } diff --git a/source/blender/editors/space_text/text_draw.c b/source/blender/editors/space_text/text_draw.c index 4c617115a3d..10d355bd0c3 100644 --- a/source/blender/editors/space_text/text_draw.c +++ b/source/blender/editors/space_text/text_draw.c @@ -1421,8 +1421,7 @@ static void draw_suggestion_list(SpaceText *st, ARegion *ar) y -= st->lheight; - strncpy(str, item->name, SUGG_LIST_WIDTH); - str[SUGG_LIST_WIDTH] = '\0'; + BLI_strncpy(str, item->name, SUGG_LIST_WIDTH); w = text_font_width(st, str); diff --git a/source/blender/editors/util/editmode_undo.c b/source/blender/editors/util/editmode_undo.c index bcbc134d06d..f38ae136f71 100644 --- a/source/blender/editors/util/editmode_undo.c +++ b/source/blender/editors/util/editmode_undo.c @@ -142,7 +142,7 @@ void undo_editmode_push(bContext *C, const char *name, /* make new */ curundo= uel= MEM_callocN(sizeof(UndoElem), "undo editmode"); - strncpy(uel->name, name, MAXUNDONAME-1); + BLI_strncpy(uel->name, name, sizeof(uel->name)); BLI_addtail(&undobase, uel); uel->getdata= getdata; diff --git a/source/blender/modifiers/intern/MOD_armature.c b/source/blender/modifiers/intern/MOD_armature.c index 0b46d950950..0ef85a49899 100644 --- a/source/blender/modifiers/intern/MOD_armature.c +++ b/source/blender/modifiers/intern/MOD_armature.c @@ -42,6 +42,7 @@ #include "DNA_mesh_types.h" #include "BLI_utildefines.h" +#include "BLI_string.h" #include "BKE_cdderivedmesh.h" @@ -70,7 +71,7 @@ static void copyData(ModifierData *md, ModifierData *target) tamd->object = amd->object; tamd->deformflag = amd->deformflag; tamd->multi = amd->multi; - strncpy(tamd->defgrp_name, amd->defgrp_name, 32); + BLI_strncpy(tamd->defgrp_name, amd->defgrp_name, 32); } static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *UNUSED(md)) diff --git a/source/blender/modifiers/intern/MOD_bevel.c b/source/blender/modifiers/intern/MOD_bevel.c index 277f404f64d..197e6a24342 100644 --- a/source/blender/modifiers/intern/MOD_bevel.c +++ b/source/blender/modifiers/intern/MOD_bevel.c @@ -72,7 +72,7 @@ static void copyData(ModifierData *md, ModifierData *target) tbmd->lim_flags = bmd->lim_flags; tbmd->e_flags = bmd->e_flags; tbmd->bevel_angle = bmd->bevel_angle; - strncpy(tbmd->defgrp_name, bmd->defgrp_name, 32); + BLI_strncpy(tbmd->defgrp_name, bmd->defgrp_name, 32); } static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md) diff --git a/source/blender/modifiers/intern/MOD_cast.c b/source/blender/modifiers/intern/MOD_cast.c index 4061128b5ad..b0e001f0978 100644 --- a/source/blender/modifiers/intern/MOD_cast.c +++ b/source/blender/modifiers/intern/MOD_cast.c @@ -40,6 +40,7 @@ #include "BLI_math.h" #include "BLI_utildefines.h" +#include "BLI_string.h" #include "BKE_deform.h" @@ -77,7 +78,7 @@ static void copyData(ModifierData *md, ModifierData *target) tcmd->flag = cmd->flag; tcmd->type = cmd->type; tcmd->object = cmd->object; - strncpy(tcmd->defgrp_name, cmd->defgrp_name, 32); + BLI_strncpy(tcmd->defgrp_name, cmd->defgrp_name, 32); } static int isDisabled(ModifierData *md, int UNUSED(useRenderParams)) diff --git a/source/blender/modifiers/intern/MOD_curve.c b/source/blender/modifiers/intern/MOD_curve.c index d928c239eac..b732158358d 100644 --- a/source/blender/modifiers/intern/MOD_curve.c +++ b/source/blender/modifiers/intern/MOD_curve.c @@ -41,6 +41,7 @@ #include "DNA_object_types.h" #include "BLI_utildefines.h" +#include "BLI_string.h" #include "BKE_cdderivedmesh.h" @@ -65,7 +66,7 @@ static void copyData(ModifierData *md, ModifierData *target) tcmd->defaxis = cmd->defaxis; tcmd->object = cmd->object; - strncpy(tcmd->name, cmd->name, 32); + BLI_strncpy(tcmd->name, cmd->name, 32); } static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md) diff --git a/source/blender/modifiers/intern/MOD_displace.c b/source/blender/modifiers/intern/MOD_displace.c index fb7aeacecc8..b0d9892a8df 100644 --- a/source/blender/modifiers/intern/MOD_displace.c +++ b/source/blender/modifiers/intern/MOD_displace.c @@ -40,6 +40,7 @@ #include "BLI_math.h" #include "BLI_utildefines.h" +#include "BLI_string.h" #include "BKE_cdderivedmesh.h" @@ -75,11 +76,11 @@ static void copyData(ModifierData *md, ModifierData *target) tdmd->texture = dmd->texture; tdmd->strength = dmd->strength; tdmd->direction = dmd->direction; - strncpy(tdmd->defgrp_name, dmd->defgrp_name, 32); + BLI_strncpy(tdmd->defgrp_name, dmd->defgrp_name, 32); tdmd->midlevel = dmd->midlevel; tdmd->texmapping = dmd->texmapping; tdmd->map_object = dmd->map_object; - strncpy(tdmd->uvlayer_name, dmd->uvlayer_name, 32); + BLI_strncpy(tdmd->uvlayer_name, dmd->uvlayer_name, 32); } static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md) diff --git a/source/blender/modifiers/intern/MOD_hook.c b/source/blender/modifiers/intern/MOD_hook.c index 785abc7d4d1..ad97ee82ee2 100644 --- a/source/blender/modifiers/intern/MOD_hook.c +++ b/source/blender/modifiers/intern/MOD_hook.c @@ -41,6 +41,7 @@ #include "BLI_math.h" #include "BLI_utildefines.h" +#include "BLI_string.h" #include "BKE_action.h" #include "BKE_cdderivedmesh.h" @@ -72,8 +73,8 @@ static void copyData(ModifierData *md, ModifierData *target) thmd->totindex = hmd->totindex; thmd->indexar = MEM_dupallocN(hmd->indexar); memcpy(thmd->parentinv, hmd->parentinv, sizeof(hmd->parentinv)); - strncpy(thmd->name, hmd->name, 32); - strncpy(thmd->subtarget, hmd->subtarget, 32); + BLI_strncpy(thmd->name, hmd->name, 32); + BLI_strncpy(thmd->subtarget, hmd->subtarget, 32); } static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md) diff --git a/source/blender/modifiers/intern/MOD_lattice.c b/source/blender/modifiers/intern/MOD_lattice.c index 31c17fb7376..4ff92e3c86d 100644 --- a/source/blender/modifiers/intern/MOD_lattice.c +++ b/source/blender/modifiers/intern/MOD_lattice.c @@ -40,6 +40,7 @@ #include "DNA_object_types.h" #include "BLI_utildefines.h" +#include "BLI_string.h" #include "BKE_cdderivedmesh.h" @@ -57,7 +58,7 @@ static void copyData(ModifierData *md, ModifierData *target) LatticeModifierData *tlmd = (LatticeModifierData*) target; tlmd->object = lmd->object; - strncpy(tlmd->name, lmd->name, 32); + BLI_strncpy(tlmd->name, lmd->name, 32); } static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md) diff --git a/source/blender/modifiers/intern/MOD_smooth.c b/source/blender/modifiers/intern/MOD_smooth.c index 16898a80b53..5e13b8a6d3c 100644 --- a/source/blender/modifiers/intern/MOD_smooth.c +++ b/source/blender/modifiers/intern/MOD_smooth.c @@ -39,6 +39,7 @@ #include "BLI_math.h" #include "BLI_utildefines.h" +#include "BLI_string.h" #include "BKE_cdderivedmesh.h" #include "BKE_particle.h" @@ -69,7 +70,7 @@ static void copyData(ModifierData *md, ModifierData *target) tsmd->fac = smd->fac; tsmd->repeat = smd->repeat; tsmd->flag = smd->flag; - strncpy(tsmd->defgrp_name, smd->defgrp_name, 32); + BLI_strncpy(tsmd->defgrp_name, smd->defgrp_name, 32); } static int isDisabled(ModifierData *md, int UNUSED(useRenderParams)) diff --git a/source/blender/modifiers/intern/MOD_warp.c b/source/blender/modifiers/intern/MOD_warp.c index 36d3dc88b56..a088ba80b3d 100644 --- a/source/blender/modifiers/intern/MOD_warp.c +++ b/source/blender/modifiers/intern/MOD_warp.c @@ -33,6 +33,7 @@ #include "BLI_math.h" #include "BLI_utildefines.h" +#include "BLI_string.h" #include "BKE_cdderivedmesh.h" #include "BKE_modifier.h" @@ -73,13 +74,13 @@ static void copyData(ModifierData *md, ModifierData *target) twmd->strength = wmd->strength; twmd->falloff_radius = wmd->falloff_radius; twmd->falloff_type = wmd->falloff_type; - strncpy(twmd->defgrp_name, wmd->defgrp_name, sizeof(twmd->defgrp_name)); + BLI_strncpy(twmd->defgrp_name, wmd->defgrp_name, sizeof(twmd->defgrp_name)); twmd->curfalloff = curvemapping_copy(wmd->curfalloff); /* map info */ twmd->texture = wmd->texture; twmd->map_object = wmd->map_object; - strncpy(twmd->uvlayer_name, wmd->uvlayer_name, sizeof(twmd->uvlayer_name)); + BLI_strncpy(twmd->uvlayer_name, wmd->uvlayer_name, sizeof(twmd->uvlayer_name)); twmd->texmapping= wmd->texmapping; } diff --git a/source/blender/modifiers/intern/MOD_wave.c b/source/blender/modifiers/intern/MOD_wave.c index 4b5769ff603..820c7e16f53 100644 --- a/source/blender/modifiers/intern/MOD_wave.c +++ b/source/blender/modifiers/intern/MOD_wave.c @@ -42,6 +42,7 @@ #include "DNA_object_types.h" #include "BLI_utildefines.h" +#include "BLI_string.h" #include "BKE_DerivedMesh.h" @@ -98,7 +99,7 @@ static void copyData(ModifierData *md, ModifierData *target) twmd->texture = wmd->texture; twmd->map_object = wmd->map_object; twmd->texmapping = wmd->texmapping; - strncpy(twmd->defgrp_name, wmd->defgrp_name, 32); + BLI_strncpy(twmd->defgrp_name, wmd->defgrp_name, 32); } static int dependsOnTime(ModifierData *UNUSED(md)) diff --git a/source/blender/nodes/intern/node_common.c b/source/blender/nodes/intern/node_common.c index 8225c986409..fa5a3c727c2 100644 --- a/source/blender/nodes/intern/node_common.c +++ b/source/blender/nodes/intern/node_common.c @@ -567,7 +567,7 @@ bNodeSocket *node_group_add_socket(bNodeTree *ngroup, const char *name, int type bNodeSocketType *stype = ntreeGetSocketType(type); bNodeSocket *gsock = MEM_callocN(sizeof(bNodeSocket), "bNodeSocket"); - strncpy(gsock->name, name, sizeof(gsock->name)); + BLI_strncpy(gsock->name, name, sizeof(gsock->name)); gsock->type = type; /* group sockets are dynamically added */ gsock->flag |= SOCK_DYNAMIC; diff --git a/source/blender/python/generic/bpy_internal_import.c b/source/blender/python/generic/bpy_internal_import.c index 67ed90c79eb..90260100c83 100644 --- a/source/blender/python/generic/bpy_internal_import.c +++ b/source/blender/python/generic/bpy_internal_import.c @@ -120,7 +120,7 @@ PyObject *bpy_text_import(Text *text) } len= strlen(text->id.name+2); - strncpy(modulename, text->id.name+2, len); + BLI_strncpy(modulename, text->id.name+2, len); modulename[len - 3]= '\0'; /* remove .py */ return PyImport_ExecCodeModule(modulename, text->compiled); } diff --git a/source/blender/render/intern/source/convertblender.c b/source/blender/render/intern/source/convertblender.c index b972569fdf6..f06707c94fe 100644 --- a/source/blender/render/intern/source/convertblender.c +++ b/source/blender/render/intern/source/convertblender.c @@ -5026,7 +5026,7 @@ void RE_Database_FromScene(Render *re, Main *bmain, Scene *scene, unsigned int l /* per second, per object, stats print this */ re->i.infostr= "Preparing Scene data"; re->i.cfra= scene->r.cfra; - strncpy(re->i.scenename, scene->id.name+2, 20); + BLI_strncpy(re->i.scenename, scene->id.name+2, sizeof(re->i.scenename)); /* XXX add test if dbase was filled already? */ diff --git a/source/blender/render/intern/source/pipeline.c b/source/blender/render/intern/source/pipeline.c index 05bcc32a90a..7835ae6dcd3 100644 --- a/source/blender/render/intern/source/pipeline.c +++ b/source/blender/render/intern/source/pipeline.c @@ -1198,7 +1198,7 @@ Render *RE_NewRender(const char *name) /* new render data struct */ re= MEM_callocN(sizeof(Render), "new render"); BLI_addtail(&RenderGlobal.renderlist, re); - strncpy(re->name, name, RE_MAXNAME); + BLI_strncpy(re->name, name, RE_MAXNAME); BLI_rw_mutex_init(&re->resultmutex); } diff --git a/source/creator/creator.c b/source/creator/creator.c index d25b0be30d8..3ce469de4e8 100644 --- a/source/creator/creator.c +++ b/source/creator/creator.c @@ -520,8 +520,8 @@ static int set_output(int argc, const char **argv, void *data) { bContext *C = data; if (argc >= 1){ - if (CTX_data_scene(C)) { - Scene *scene= CTX_data_scene(C); + Scene *scene= CTX_data_scene(C); + if (scene) { BLI_strncpy(scene->r.pic, argv[1], sizeof(scene->r.pic)); } else { printf("\nError: no blend loaded. cannot use '-o / --render-output'.\n"); @@ -546,17 +546,17 @@ static int set_engine(int argc, const char **argv, void *data) exit(0); } else { - if (CTX_data_scene(C)==NULL) { - printf("\nError: no blend loaded. order the arguments so '-E / --engine ' is after a blend is loaded.\n"); - } - else { - Scene *scene= CTX_data_scene(C); + Scene *scene= CTX_data_scene(C); + if (scene) { RenderData *rd = &scene->r; if(BLI_findstring(&R_engines, argv[1], offsetof(RenderEngineType, idname))) { BLI_strncpy_utf8(rd->engine, argv[1], sizeof(rd->engine)); } } + else { + printf("\nError: no blend loaded. order the arguments so '-E / --engine ' is after a blend is loaded.\n"); + } } return 1; @@ -573,10 +573,8 @@ static int set_image_type(int argc, const char **argv, void *data) bContext *C = data; if (argc >= 1){ const char *imtype = argv[1]; - if (CTX_data_scene(C)==NULL) { - printf("\nError: no blend loaded. order the arguments so '-F / --render-format' is after the blend is loaded.\n"); - } else { - Scene *scene= CTX_data_scene(C); + Scene *scene= CTX_data_scene(C); + if (scene) { if (!strcmp(imtype,"TGA")) scene->r.imtype = R_TARGA; else if (!strcmp(imtype,"IRIS")) scene->r.imtype = R_IRIS; #ifdef WITH_DDS @@ -612,6 +610,9 @@ static int set_image_type(int argc, const char **argv, void *data) #endif else printf("\nError: Format from '-F / --render-format' not known or not compiled in this release.\n"); } + else { + printf("\nError: no blend loaded. order the arguments so '-F / --render-format' is after the blend is loaded.\n"); + } return 1; } else { printf("\nError: you must specify a format after '-F / --render-foramt'.\n"); @@ -638,8 +639,8 @@ static int set_extension(int argc, const char **argv, void *data) { bContext *C = data; if (argc >= 1) { - if (CTX_data_scene(C)) { - Scene *scene= CTX_data_scene(C); + Scene *scene= CTX_data_scene(C); + if (scene) { if (argv[1][0] == '0') { scene->r.scemode &= ~R_EXTENSION; } else if (argv[1][0] == '1') { @@ -721,9 +722,9 @@ example: static int render_frame(int argc, const char **argv, void *data) { bContext *C = data; - if (CTX_data_scene(C)) { + Scene *scene= CTX_data_scene(C); + if (scene) { Main *bmain= CTX_data_main(C); - Scene *scene= CTX_data_scene(C); if (argc > 1) { Render *re = RE_NewRender(scene->id.name); @@ -763,9 +764,9 @@ static int render_frame(int argc, const char **argv, void *data) static int render_animation(int UNUSED(argc), const char **UNUSED(argv), void *data) { bContext *C = data; - if (CTX_data_scene(C)) { + Scene *scene= CTX_data_scene(C); + if (scene) { Main *bmain= CTX_data_main(C); - Scene *scene= CTX_data_scene(C); Render *re= RE_NewRender(scene->id.name); ReportList reports; BKE_reports_init(&reports, RPT_PRINT); @@ -782,9 +783,9 @@ static int set_scene(int argc, const char **argv, void *data) { if(argc > 1) { bContext *C= data; - Scene *sce= set_scene_name(CTX_data_main(C), argv[1]); - if(sce) { - CTX_data_scene_set(C, sce); + Scene *scene= set_scene_name(CTX_data_main(C), argv[1]); + if(scene) { + CTX_data_scene_set(C, scene); } return 1; } else { @@ -796,8 +797,8 @@ static int set_scene(int argc, const char **argv, void *data) static int set_start_frame(int argc, const char **argv, void *data) { bContext *C = data; - if (CTX_data_scene(C)) { - Scene *scene= CTX_data_scene(C); + Scene *scene= CTX_data_scene(C); + if (scene) { if (argc > 1) { int frame = atoi(argv[1]); (scene->r.sfra) = CLAMPIS(frame, MINFRAME, MAXFRAME); @@ -815,8 +816,8 @@ static int set_start_frame(int argc, const char **argv, void *data) static int set_end_frame(int argc, const char **argv, void *data) { bContext *C = data; - if (CTX_data_scene(C)) { - Scene *scene= CTX_data_scene(C); + Scene *scene= CTX_data_scene(C); + if (scene) { if (argc > 1) { int frame = atoi(argv[1]); (scene->r.efra) = CLAMPIS(frame, MINFRAME, MAXFRAME); @@ -834,8 +835,8 @@ static int set_end_frame(int argc, const char **argv, void *data) static int set_skip_frame(int argc, const char **argv, void *data) { bContext *C = data; - if (CTX_data_scene(C)) { - Scene *scene= CTX_data_scene(C); + Scene *scene= CTX_data_scene(C); + if (scene) { if (argc > 1) { int frame = atoi(argv[1]); (scene->r.frame_step) = CLAMPIS(frame, 1, MAXFRAME); -- cgit v1.2.3 From 217030120463276043fa977656d3cd5bc13cd411 Mon Sep 17 00:00:00 2001 From: Martin Poirier Date: Tue, 27 Sep 2011 01:28:15 +0000 Subject: [#28681] Switching transform type doesn't register correct operator for 'repeat'. Reported by Nicholas Rishel Part of a potential fix, see discussion in tracker. --- source/blender/editors/transform/transform.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'source') diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index fbe0a1864bf..c77f7620326 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -1358,6 +1358,11 @@ void saveTransform(bContext *C, TransInfo *t, wmOperator *op) int proportional = 0; PropertyRNA *prop; + // Save back mode in case we're in the generic operator + if ((prop= RNA_struct_find_property(op->ptr, "mode"))) { + RNA_property_enum_set(op->ptr, prop, t->mode); + } + if ((prop= RNA_struct_find_property(op->ptr, "value"))) { float *values= (t->flag & T_AUTOVALUES) ? t->auto_values : t->values; if (RNA_property_array_check(prop)) { -- cgit v1.2.3 From f4dec97cef4b320c6f3ffd2ddc39d429da4fd4d5 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 27 Sep 2011 01:32:27 +0000 Subject: fix for building on windows, clear some warnings too --- source/blender/blenkernel/intern/writeframeserver.c | 4 ++++ source/blender/blenlib/intern/storage.c | 2 +- source/blender/blenlib/intern/winstuff.c | 10 +++++----- source/blender/editors/include/UI_interface.h | 1 + source/blender/editors/space_node/node_intern.h | 1 + 5 files changed, 12 insertions(+), 6 deletions(-) (limited to 'source') diff --git a/source/blender/blenkernel/intern/writeframeserver.c b/source/blender/blenkernel/intern/writeframeserver.c index d13d15d1269..15cb3b66db7 100644 --- a/source/blender/blenkernel/intern/writeframeserver.c +++ b/source/blender/blenkernel/intern/writeframeserver.c @@ -257,7 +257,11 @@ int frameserver_loop(RenderData *rd, ReportList *UNUSED(reports)) struct timeval tv; struct sockaddr_in addr; int len, rval; +#ifdef FREE_WINDOWS + int socklen; +#else unsigned int socklen; +#endif char buf[4096]; if (connsock != -1) { diff --git a/source/blender/blenlib/intern/storage.c b/source/blender/blenlib/intern/storage.c index f088c5e2787..8be86a4b407 100644 --- a/source/blender/blenlib/intern/storage.c +++ b/source/blender/blenlib/intern/storage.c @@ -488,7 +488,7 @@ LinkNode *BLI_read_file_as_lines(const char *name) buf= MEM_mallocN(size, "file_as_lines"); if (buf) { - int i, last= 0; + size_t i, last= 0; /* * size = because on win32 reading diff --git a/source/blender/blenlib/intern/winstuff.c b/source/blender/blenlib/intern/winstuff.c index 66080ed2a85..bf816a91fb3 100644 --- a/source/blender/blenlib/intern/winstuff.c +++ b/source/blender/blenlib/intern/winstuff.c @@ -301,7 +301,7 @@ char* dirname(char *path) { char *p; if( path == NULL || *path == '\0' ) - return "."; + return "."; p = path + strlen(path) - 1; while( *p == '/' ) { if( p == path ) @@ -309,11 +309,11 @@ char* dirname(char *path) *p-- = '\0'; } while( p >= path && *p != '/' ) - p--; + p--; return - p < path ? "." : - p == path ? "/" : - (*p = '\0', path); + p < path ? "." : + p == path ? "/" : + (*p = '\0', path); } /* End of copied part */ diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h index 67b17a891ca..4a895472b33 100644 --- a/source/blender/editors/include/UI_interface.h +++ b/source/blender/editors/include/UI_interface.h @@ -34,6 +34,7 @@ #ifndef UI_INTERFACE_H #define UI_INTERFACE_H +#include "BLO_sys_types.h" /* size_t */ #include "RNA_types.h" #include "DNA_userdef_types.h" diff --git a/source/blender/editors/space_node/node_intern.h b/source/blender/editors/space_node/node_intern.h index 3751d8efae8..8bc0ae51415 100644 --- a/source/blender/editors/space_node/node_intern.h +++ b/source/blender/editors/space_node/node_intern.h @@ -33,6 +33,7 @@ #ifndef ED_NODE_INTERN_H #define ED_NODE_INTERN_H +#include /* for size_t */ #include "UI_interface.h" /* internal exports only */ -- cgit v1.2.3