diff options
author | Nicholas Bishop <nicholasbishop@gmail.com> | 2009-08-16 09:48:07 +0400 |
---|---|---|
committer | Nicholas Bishop <nicholasbishop@gmail.com> | 2009-08-16 09:48:07 +0400 |
commit | d86663ee1a4e845afd15752bac6dfb05dd675f69 (patch) | |
tree | f81003eabb6326214bb03e3180426053b29ccdd9 /source/blender/makesrna | |
parent | 128cf1522453c8f800d31fd663ac9027f56ec151 (diff) |
2.5/Modes:
* Added OBJECT_OT_mode_set for setting the object mode. Takes one property, "mode", which can be any of the OB_MODE_* flags. The available modes are limited based on the active object (e.g. only meshes can have sculptmode, and so forth.)
* Set the icon properties in the object mode enum RNA
TODO:
At this point I think everything is ready to start ripping out the ugly hacks in view3d_header for setting the mode :)
Diffstat (limited to 'source/blender/makesrna')
-rw-r--r-- | source/blender/makesrna/RNA_enum_types.h | 2 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_object.c | 26 |
2 files changed, 16 insertions, 12 deletions
diff --git a/source/blender/makesrna/RNA_enum_types.h b/source/blender/makesrna/RNA_enum_types.h index 78e65e8fc06..a7488ed437b 100644 --- a/source/blender/makesrna/RNA_enum_types.h +++ b/source/blender/makesrna/RNA_enum_types.h @@ -29,6 +29,8 @@ /* Types */ +extern EnumPropertyItem object_mode_items[]; + extern EnumPropertyItem prop_mode_items[]; extern EnumPropertyItem space_type_items[]; extern EnumPropertyItem region_type_items[]; diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c index 105d08f237f..2e40765935d 100644 --- a/source/blender/makesrna/intern/rna_object.c +++ b/source/blender/makesrna/intern/rna_object.c @@ -41,6 +41,18 @@ #include "WM_types.h" + +EnumPropertyItem object_mode_items[] = { + {OB_MODE_OBJECT, "OBJECT", ICON_OBJECT_DATAMODE, "Object", ""}, + {OB_MODE_EDIT, "EDIT", ICON_EDITMODE_HLT, "Edit", ""}, + {OB_MODE_SCULPT, "SCULPT", ICON_SCULPTMODE_HLT, "Sculpt", ""}, + {OB_MODE_VERTEX_PAINT, "VERTEX_PAINT", ICON_VPAINT_HLT, "Vertex Paint", ""}, + {OB_MODE_WEIGHT_PAINT, "WEIGHT_PAINT", ICON_WPAINT_HLT, "Weight Paint", ""}, + {OB_MODE_TEXTURE_PAINT, "TEXTURE_PAINT", ICON_TPAINT_HLT, "Texture Paint", ""}, + {OB_MODE_PARTICLE_EDIT, "PARTICLE_EDIT", ICON_PARTICLEMODE, "Particle Edit", ""}, + {OB_MODE_POSE, "POSE", ICON_POSE_HLT, "Pose", ""}, + {0, NULL, 0, NULL, NULL}}; + static EnumPropertyItem parent_type_items[] = { {PAROBJECT, "OBJECT", 0, "Object", ""}, {PARCURVE, "CURVE", 0, "Curve", ""}, @@ -968,17 +980,6 @@ static void rna_def_object(BlenderRNA *brna) {OB_ARMATURE, "ARMATURE", 0, "Armature", ""}, {0, NULL, 0, NULL, NULL}}; - static EnumPropertyItem mode_items[] = { - {OB_MODE_OBJECT, "OBJECT", 0, "Object", ""}, - {OB_MODE_EDIT, "EDIT", 0, "Edit", ""}, - {OB_MODE_SCULPT, "SCULPT", 0, "Sculpt", ""}, - {OB_MODE_VERTEX_PAINT, "VERTEX_PAINT", 0, "Vertex Paint", ""}, - {OB_MODE_WEIGHT_PAINT, "WEIGHT_PAINT", 0, "Weight Paint", ""}, - {OB_MODE_WEIGHT_PAINT, "TEXTURE_PAINT", 0, "Texture Paint", ""}, - {OB_MODE_PARTICLE_EDIT, "PARTICLE_EDIT", 0, "Particle Edit", ""}, - {OB_MODE_POSE, "POSE", 0, "Pose", ""}, - {0, NULL, 0, NULL, NULL}}; - static EnumPropertyItem empty_drawtype_items[] = { {OB_ARROWS, "ARROWS", 0, "Arrows", ""}, {OB_SINGLE_ARROW, "SINGLE_ARROW", 0, "Single Arrow", ""}, @@ -1049,7 +1050,8 @@ static void rna_def_object(BlenderRNA *brna) prop= RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "mode"); - RNA_def_property_enum_items(prop, mode_items); + RNA_def_property_enum_items(prop, object_mode_items); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "Mode", "Object interaction mode."); prop= RNA_def_property(srna, "layers", PROP_BOOLEAN, PROP_NONE); |