diff options
author | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2010-05-22 02:01:47 +0400 |
---|---|---|
committer | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2010-05-22 02:01:47 +0400 |
commit | dbcb73c033fc15fc0df2ab0a05ac0b2c4a9a31b1 (patch) | |
tree | 630247e3c4b18a799545bee8de23ee075cfa5a79 /source/blender/makesrna/intern/rna_space.c | |
parent | f76c3aa3764283918413a50ed9dab079e720ed98 (diff) | |
parent | c0a0f2c43e934e2054eefe5bf90889cf67b736f9 (diff) |
Merged changes in the trunk up to revision 28911.
Diffstat (limited to 'source/blender/makesrna/intern/rna_space.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_space.c | 72 |
1 files changed, 70 insertions, 2 deletions
diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index 7ba56d77801..500ea6ee429 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -338,6 +338,18 @@ static void rna_RegionView3D_quadview_update(Main *main, Scene *scene, PointerRN ED_view3d_quadview_update(sa, ar); } +static void rna_RegionView3D_view_location_get(PointerRNA *ptr, float *values) +{ + RegionView3D *rv3d= (RegionView3D *)(ptr->data); + negate_v3_v3(values, rv3d->ofs); +} + +static void rna_RegionView3D_view_location_set(PointerRNA *ptr, const float *values) +{ + RegionView3D *rv3d= (RegionView3D *)(ptr->data); + negate_v3_v3(rv3d->ofs, values); +} + /* Space Image Editor */ static PointerRNA rna_SpaceImageEditor_uvedit_get(PointerRNA *ptr) @@ -509,6 +521,28 @@ static StructRNA *rna_SpaceProperties_pin_id_typef(PointerRNA *ptr) return &RNA_ID; } +static void rna_SpaceProperties_pin_id_update(Main *bmain, Scene *scene, PointerRNA *ptr) +{ + SpaceButs *sbuts= (SpaceButs*)(ptr->data); + ID *id = sbuts->pinid; + + switch (GS(id->name)) { + case ID_MA: + WM_main_add_notifier(NC_MATERIAL|ND_SHADING, NULL); + break; + case ID_TE: + WM_main_add_notifier(NC_TEXTURE, NULL); + break; + case ID_WO: + WM_main_add_notifier(NC_WORLD, NULL); + break; + case ID_LA: + WM_main_add_notifier(NC_LAMP, NULL); + break; + } +} + + static void rna_SpaceProperties_align_set(PointerRNA *ptr, int value) { SpaceButs *sbuts= (SpaceButs*)(ptr->data); @@ -899,7 +933,13 @@ static void rna_def_space_view3d(BlenderRNA *brna) {V3D_CENTROID, "MEDIAN_POINT", ICON_ROTATECENTER, "Median Point", ""}, {V3D_ACTIVE, "ACTIVE_ELEMENT", ICON_ROTACTIVE, "Active Element", ""}, {0, NULL, 0, NULL, NULL}}; - + + static EnumPropertyItem rv3d_persp_items[] = { + {RV3D_PERSP, "PERSP", 0, "Perspective", ""}, + {RV3D_ORTHO, "ORTHO", 0, "Orthographic", ""}, + {RV3D_CAMOB, "CAMERA", 0, "Camera", ""}, + {0, NULL, 0, NULL, NULL}}; + srna= RNA_def_struct(brna, "SpaceView3D", "Space"); RNA_def_struct_sdna(srna, "View3D"); RNA_def_struct_ui_text(srna, "3D View Space", "3D View space data"); @@ -1146,6 +1186,34 @@ static void rna_def_space_view3d(BlenderRNA *brna) RNA_def_property_clear_flag(prop, PROP_EDITABLE); // XXX: for now, it's too risky for users to do this RNA_def_property_multi_array(prop, 2, matrix_dimsize); RNA_def_property_ui_text(prop, "View Matrix", "Current view matrix of the 3D region"); + + prop= RNA_def_property(srna, "view_perspective", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "persp"); + RNA_def_property_enum_items(prop, rv3d_persp_items); + RNA_def_property_ui_text(prop, "Perspective", "View Perspective"); + RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL); + + prop= RNA_def_property(srna, "view_location", PROP_FLOAT, PROP_TRANSLATION); +#if 0 + RNA_def_property_float_sdna(prop, NULL, "ofs"); // cant use because its negated +#else + RNA_def_property_array(prop, 3); + RNA_def_property_float_funcs(prop, "rna_RegionView3D_view_location_get", "rna_RegionView3D_view_location_set", NULL); +#endif + RNA_def_property_ui_text(prop, "View Location", "View pivot location"); + RNA_def_property_ui_range(prop, -10000.0, 10000.0, 10, 4); + RNA_def_property_update(prop, NC_WINDOW, NULL); + + prop= RNA_def_property(srna, "view_rotation", PROP_FLOAT, PROP_QUATERNION); + RNA_def_property_float_sdna(prop, NULL, "viewquat"); + RNA_def_property_ui_text(prop, "View Rotation", "Rotation in quaternions (keep normalized)"); + RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL); + + /* not sure we need rna access to these but adding anyway */ + prop= RNA_def_property(srna, "view_distance", PROP_FLOAT, PROP_UNSIGNED); + RNA_def_property_float_sdna(prop, NULL, "dist"); + RNA_def_property_ui_text(prop, "Distance", "Distance to the view location"); + RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL); } static void rna_def_space_buttons(BlenderRNA *brna) @@ -1203,7 +1271,7 @@ static void rna_def_space_buttons(BlenderRNA *brna) /* note: custom set function is ONLY to avoid rna setting a user for this. */ RNA_def_property_pointer_funcs(prop, NULL, "rna_SpaceProperties_pin_id_set", "rna_SpaceProperties_pin_id_typef"); RNA_def_property_flag(prop, PROP_EDITABLE); - RNA_def_property_update(prop, NC_SPACE|ND_SPACE_PROPERTIES, NULL); + RNA_def_property_update(prop, NC_SPACE|ND_SPACE_PROPERTIES, "rna_SpaceProperties_pin_id_update"); prop= RNA_def_property(srna, "use_pin_id", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", SB_PIN_CONTEXT); |