diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2011-09-20 16:01:16 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2011-09-20 16:01:16 +0400 |
commit | 7172316b945c62797e6beba953ff203766614531 (patch) | |
tree | 640ac56fadded9c7686399b5a1f1c64f1a135700 /source/blender/makesrna | |
parent | 2015eefef70350382931881dd65ed2da09f8f2cd (diff) | |
parent | 78d4260144dbf01166fac8bc9303e6d5aa022f71 (diff) |
Merging r40366 through r40392 from trunk into soc-2011-garlicsoc-2011-garlic
Diffstat (limited to 'source/blender/makesrna')
-rw-r--r-- | source/blender/makesrna/intern/rna_curve.c | 3 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_material.c | 63 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_mesh.c | 32 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_nodetree.c | 2 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_object.c | 5 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_scene.c | 32 |
6 files changed, 131 insertions, 6 deletions
diff --git a/source/blender/makesrna/intern/rna_curve.c b/source/blender/makesrna/intern/rna_curve.c index 99473d13daa..5d0c1db572d 100644 --- a/source/blender/makesrna/intern/rna_curve.c +++ b/source/blender/makesrna/intern/rna_curve.c @@ -296,7 +296,8 @@ static EnumPropertyItem *rna_Curve_fill_mode_itemf(bContext *UNUSED(C), PointerR { Curve *cu= (Curve*)ptr->id.data; - return (cu->flag&CU_3D) ? curve3d_fill_mode_items : curve2d_fill_mode_items; + /* cast to quiet warning it IS a const still */ + return (EnumPropertyItem *)((cu->flag & CU_3D) ? curve3d_fill_mode_items : curve2d_fill_mode_items); } static int rna_Nurb_length(PointerRNA *ptr) diff --git a/source/blender/makesrna/intern/rna_material.c b/source/blender/makesrna/intern/rna_material.c index dcaeb523df5..673e768e71e 100644 --- a/source/blender/makesrna/intern/rna_material.c +++ b/source/blender/makesrna/intern/rna_material.c @@ -742,6 +742,61 @@ static void rna_def_material_mtex(BlenderRNA *brna) RNA_def_property_update(prop, 0, "rna_Material_update"); } +static void rna_def_material_gamesettings(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + + static EnumPropertyItem prop_alpha_blend_items[] = { + {GEMAT_SOLID, "OPAQUE", 0, "Opaque", "Render color of textured face as color"}, + {GEMAT_ADD, "ADD", 0, "Add", "Render face transparent and add color of face"}, + {GEMAT_CLIP, "CLIP", 0, "Alpha Clip", "Use the image alpha values clipped with no blending (binary alpha)"}, + {GEMAT_ALPHA, "ALPHA", 0, "Alpha Blend", "Render polygon transparent, depending on alpha channel of the texture"}, + {GEMAT_ALPHA_SORT, "ALPHA_SORT", 0, "Alpha Sort", "Sort faces for correct alpha drawing (slow, use Alpha Clip instead when possible)"}, + {0, NULL, 0, NULL, NULL}}; + + static EnumPropertyItem prop_face_orientation_items[] = { + {GEMAT_NORMAL,"NORMAL",0,"Normal","No tranformation"}, + {GEMAT_HALO, "HALO", 0, "Halo", "Screen aligned billboard"}, + {GEMAT_BILLBOARD, "BILLBOARD", 0, "Billboard", "Billboard with Z-axis constraint"}, + {GEMAT_SHADOW, "SHADOW", 0, "Shadow", "Faces are used for shadow"}, + {0, NULL, 0, NULL, NULL}}; + + srna= RNA_def_struct(brna, "MaterialGameSettings", NULL); + RNA_def_struct_sdna(srna, "GameSettings"); + 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); + 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_update(prop, 0, "rna_Material_draw_update"); + + prop= RNA_def_property(srna, "text", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", GEMAT_TEXT); /* use bitflags */ + RNA_def_property_ui_text(prop, "Text", "Use material as text in Game Engine "); + RNA_def_property_update(prop, 0, "rna_Material_draw_update"); + + prop= RNA_def_property(srna, "invisible", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", GEMAT_INVISIBLE); /* use bitflags */ + RNA_def_property_ui_text(prop, "Invisible", "Make face invisible"); + RNA_def_property_update(prop, 0, "rna_Material_draw_update"); + + prop= RNA_def_property(srna, "alpha_blend", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "alpha_blend"); + RNA_def_property_enum_items(prop, prop_alpha_blend_items); + RNA_def_property_ui_text(prop, "Blend Mode", "Blend Mode for Transparent Faces"); + RNA_def_property_update(prop, 0, "rna_Material_draw_update"); + + prop= RNA_def_property(srna, "face_orientation", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_items(prop, prop_face_orientation_items); + RNA_def_property_ui_text(prop, "Face Orientations", "Especial face orientation options"); + + prop= RNA_def_property(srna, "physics", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", GEMAT_NOPHYSICS); /* use bitflags */ + RNA_def_property_ui_text(prop, "Physics", "Use physics properties of materials "); +} + static void rna_def_material_colors(StructRNA *srna) { PropertyRNA *prop; @@ -1887,6 +1942,13 @@ void RNA_def_material(BlenderRNA *brna) RNA_def_property_pointer_funcs(prop, "rna_Material_physics_get", NULL, NULL, NULL); RNA_def_property_ui_text(prop, "Physics", "Game physics settings"); + /* game settings */ + prop= RNA_def_property(srna, "game_settings", PROP_POINTER, PROP_NONE); + RNA_def_property_flag(prop, PROP_NEVER_NULL); + RNA_def_property_pointer_sdna(prop, NULL, "game"); + RNA_def_property_struct_type(prop, "MaterialGameSettings"); + RNA_def_property_ui_text(prop, "Game Settings", "Game material settings"); + /* nodetree */ prop= RNA_def_property(srna, "node_tree", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "nodetree"); @@ -1932,6 +1994,7 @@ void RNA_def_material(BlenderRNA *brna) rna_def_material_mtex(brna); rna_def_material_strand(brna); rna_def_material_physics(brna); + rna_def_material_gamesettings(brna); RNA_api_material(srna); } diff --git a/source/blender/makesrna/intern/rna_mesh.c b/source/blender/makesrna/intern/rna_mesh.c index a560b54a87a..1bbdc7cc853 100644 --- a/source/blender/makesrna/intern/rna_mesh.c +++ b/source/blender/makesrna/intern/rna_mesh.c @@ -90,6 +90,24 @@ void rna_Mesh_update_draw(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA } } + +void rna_Mesh_update_vertmask(Main *bmain, Scene *scene, PointerRNA *ptr) +{ + Mesh* me = ptr->data; + if ((me->editflag & ME_EDIT_VERT_SEL) && (me->editflag & ME_EDIT_PAINT_MASK)) { + me->editflag ^= ME_EDIT_PAINT_MASK; + } + rna_Mesh_update_draw(bmain, scene, ptr); +} + +void rna_Mesh_update_facemask(Main *bmain, Scene *scene, PointerRNA *ptr) +{ + Mesh* me = ptr->data; + if ((me->editflag & ME_EDIT_VERT_SEL) && (me->editflag & ME_EDIT_PAINT_MASK)) { + me->editflag ^= ME_EDIT_VERT_SEL; + } + rna_Mesh_update_draw(bmain, scene, ptr); +} static void rna_MeshVertex_normal_get(PointerRNA *ptr, float *value) { MVert *mvert= (MVert*)ptr->data; @@ -1402,6 +1420,9 @@ 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"); @@ -1468,6 +1489,9 @@ static void rna_def_mtface(BlenderRNA *brna) 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); @@ -2075,8 +2099,14 @@ static void rna_def_mesh(BlenderRNA *brna) RNA_def_property_boolean_sdna(prop, NULL, "editflag", ME_EDIT_PAINT_MASK); RNA_def_property_ui_text(prop, "Paint Mask", "Face selection masking for painting"); RNA_def_property_ui_icon(prop, ICON_FACESEL_HLT, 0); - RNA_def_property_update(prop, 0, "rna_Mesh_update_draw"); + RNA_def_property_update(prop, 0, "rna_Mesh_update_facemask"); + + prop= RNA_def_property(srna, "use_paint_mask_vertex", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "editflag", ME_EDIT_VERT_SEL); + RNA_def_property_ui_text(prop, "Vertex Selection", "Vertex selection masking for painting (weight paint only)"); + RNA_def_property_ui_icon(prop, ICON_VERTEXSEL, 0); + RNA_def_property_update(prop, 0, "rna_Mesh_update_vertmask"); /* readonly editmesh info - use for extrude menu */ prop= RNA_def_property(srna, "total_vert_sel", PROP_INT, PROP_UNSIGNED); diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c index 80092b716c2..1b113620663 100644 --- a/source/blender/makesrna/intern/rna_nodetree.c +++ b/source/blender/makesrna/intern/rna_nodetree.c @@ -391,6 +391,7 @@ static void rna_NodeGroupSocket_update(Main *bmain, Scene *scene, PointerRNA *pt node_update(bmain, scene, ntree, node); } +#if 0 /* UNUSED */ static void rna_NodeLink_update(Main *bmain, Scene *scene, PointerRNA *ptr) { bNodeTree *ntree= (bNodeTree*)ptr->id.data; @@ -398,6 +399,7 @@ static void rna_NodeLink_update(Main *bmain, Scene *scene, PointerRNA *ptr) ntree->update |= NTREE_UPDATE_LINKS; ntreeUpdateTree(ntree); } +#endif static void rna_NodeSocketInt_range(PointerRNA *ptr, int *min, int *max) { diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c index 4f5aa2cc8b0..720fea682ce 100644 --- a/source/blender/makesrna/intern/rna_object.c +++ b/source/blender/makesrna/intern/rna_object.c @@ -1265,6 +1265,11 @@ static void rna_def_vertex_group(BlenderRNA *brna) RNA_def_struct_name_property(srna, prop); RNA_def_property_string_funcs(prop, NULL, NULL, "rna_VertexGroup_name_set"); RNA_def_property_update(prop, NC_GEOM|ND_DATA|NA_RENAME, "rna_Object_internal_update_data"); /* update data because modifiers may use [#24761] */ + + prop= RNA_def_property(srna, "lock_weight", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_ui_text(prop, "", "Maintain the relative weights for the group"); + RNA_def_property_boolean_sdna(prop, NULL, "flag", 0); + RNA_def_property_update(prop, NC_GEOM|ND_DATA|NA_RENAME, "rna_Object_internal_update_data"); /* update data because modifiers may use [#24761] */ prop= RNA_def_property(srna, "index", PROP_INT, PROP_UNSIGNED); RNA_def_property_clear_flag(prop, PROP_EDITABLE); diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index 49ca8b2c03c..774e21297da 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -1044,6 +1044,22 @@ static KeyingSet *rna_Scene_keying_set_new(Scene *sce, ReportList *reports, cons } } + + +/* note: without this, when Multi-Paint is activated/deactivated, the colors + * will not change right away when multiple bones are selected, this function + * is not for general use and only for the few cases where changing scene + * settings and NOT for general purpose updates, possibly this should be + * given its own notifier. */ +static void rna_Scene_update_active_object_data(Main *bmain, Scene *scene, PointerRNA *ptr) +{ + Object *ob= OBACT; + if(ob) { + DAG_id_tag_update(&ob->id, OB_RECALC_DATA); + WM_main_add_notifier(NC_OBJECT|ND_DRAW, &ob->id); + } +} + #else static void rna_def_transform_orientation(BlenderRNA *brna) @@ -1117,9 +1133,17 @@ static void rna_def_tool_settings(BlenderRNA *brna) prop = RNA_def_property(srna, "use_auto_normalize", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "auto_normalize", 1); - RNA_def_property_ui_text(prop, "WPaint Auto-Normalize", - "Ensure all bone-deforming vertex groups add up to 1.0 while " - "weight painting"); + RNA_def_property_ui_text(prop, "WPaint Auto-Normalize", + "Ensure all bone-deforming vertex groups add up " + "to 1.0 while weight painting"); + RNA_def_property_update(prop, 0, "rna_Scene_update_active_object_data"); + + prop = RNA_def_property(srna, "use_multipaint", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "multipaint", 1); + RNA_def_property_ui_text(prop, "WPaint Multi-Paint", + "Paint across all selected bones while " + "weight painting"); + RNA_def_property_update(prop, 0, "rna_Scene_update_active_object_data"); prop= RNA_def_property(srna, "vertex_paint", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "vpaint"); @@ -1804,7 +1828,7 @@ static void rna_def_scene_game_data(BlenderRNA *brna) {0, NULL, 0, NULL, NULL}}; static EnumPropertyItem material_items[] ={ - {GAME_MAT_TEXFACE, "TEXTURE_FACE", 0, "Texture Face", "Single texture face materials"}, + {GAME_MAT_TEXFACE, "SINGLETEXTURE", 0, "Singletexture", "Singletexture face materials"}, {GAME_MAT_MULTITEX, "MULTITEXTURE", 0, "Multitexture", "Multitexture materials"}, {GAME_MAT_GLSL, "GLSL", 0, "GLSL", "OpenGL shading language shaders"}, {0, NULL, 0, NULL, NULL}}; |