~ubuntu-branches/ubuntu/utopic/blender/utopic-proposed

« back to all changes in this revision

Viewing changes to source/blender/makesrna/intern/rna_space.c

  • Committer: Package Import Robot
  • Author(s): Matthias Klose
  • Date: 2014-02-19 11:24:23 UTC
  • mfrom: (14.2.23 sid)
  • Revision ID: package-import@ubuntu.com-20140219112423-rkmaz2m7ha06d4tk
Tags: 2.69-3ubuntu1
* Merge with Debian; remaining changes:
  - Configure without OpenImageIO on armhf, as it is not available on
    Ubuntu.

Show diffs side-by-side

added added

removed removed

Lines of Context:
109
109
        {0, NULL, 0, NULL, NULL}
110
110
};
111
111
 
112
 
EnumPropertyItem autosnap_items[] = {
 
112
#ifndef RNA_RUNTIME
 
113
static EnumPropertyItem autosnap_items[] = {
113
114
        {SACTSNAP_OFF, "NONE", 0, "No Auto-Snap", ""},
114
115
        {SACTSNAP_STEP, "STEP", 0, "Time Step", "Snap to 1.0 frame/second intervals"},
115
116
        {SACTSNAP_FRAME, "FRAME", 0, "Nearest Frame", "Snap to actual frames/seconds (nla-action time)"},
116
117
        {SACTSNAP_MARKER, "MARKER", 0, "Nearest Marker", "Snap to nearest marker"},
117
118
        {0, NULL, 0, NULL, NULL}
118
119
};
 
120
#endif
119
121
 
120
122
EnumPropertyItem viewport_shade_items[] = {
121
123
        {OB_BOUNDBOX, "BOUNDBOX", ICON_BBOX, "Bounding Box", "Display the object's local bounding boxes only"},
172
174
#include "DNA_mask_types.h"
173
175
#include "DNA_scene_types.h"
174
176
#include "DNA_screen_types.h"
 
177
#include "DNA_userdef_types.h"
175
178
 
176
179
#include "BLI_math.h"
177
180
 
197
200
 
198
201
#include "IMB_imbuf_types.h"
199
202
 
 
203
#include "UI_interface.h"
 
204
#include "UI_view2d.h"
 
205
 
200
206
static StructRNA *rna_Space_refine(struct PointerRNA *ptr)
201
207
{
202
208
        SpaceLink *space = (SpaceLink *)ptr->data;
400
406
        DAG_on_visible_update(bmain, FALSE);
401
407
}
402
408
 
403
 
static void rna_SpaceView3D_viewport_shade_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
 
409
static void rna_SpaceView3D_viewport_shade_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
404
410
{
405
411
        View3D *v3d = (View3D *)(ptr->data);
406
412
        ScrArea *sa = rna_area_from_space(ptr);
407
413
 
408
 
        if (v3d->drawtype != OB_RENDER) {
409
 
                ARegion *ar;
410
 
 
411
 
                for (ar = sa->regionbase.first; ar; ar = ar->next) {
412
 
                        RegionView3D *rv3d = ar->regiondata;
413
 
 
414
 
                        if (rv3d && rv3d->render_engine) {
415
 
                                RE_engine_free(rv3d->render_engine);
416
 
                                rv3d->render_engine = NULL;
417
 
                        }
418
 
                }
419
 
        }
 
414
        ED_view3d_shade_update(bmain, v3d, sa);
420
415
}
421
416
 
422
417
static void rna_SpaceView3D_matcap_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
622
617
        return rna_pointer_inherit_refine(ptr, &RNA_SpaceUVEditor, ptr->data);
623
618
}
624
619
 
625
 
static void rna_SpaceImageEditor_mode_update(Main *bmain, Scene *scene, PointerRNA *ptr)
 
620
static void rna_SpaceImageEditor_mode_update(Main *bmain, Scene *scene, PointerRNA *UNUSED(ptr))
626
621
{
627
622
        ED_space_image_paint_update(bmain->wm.first, scene->toolsettings);
628
623
}
850
845
        sbuts->mainbuser = value;
851
846
}
852
847
 
853
 
static EnumPropertyItem *rna_SpaceProperties_context_itemf(bContext *C, PointerRNA *ptr,
854
 
                                                                   PropertyRNA *UNUSED(prop), int *free)
 
848
static EnumPropertyItem *rna_SpaceProperties_context_itemf(bContext *UNUSED(C), PointerRNA *ptr,
 
849
                                                           PropertyRNA *UNUSED(prop), int *free)
855
850
{
856
851
        SpaceButs *sbuts = (SpaceButs *)(ptr->data);
857
852
        EnumPropertyItem *item = NULL;
959
954
        return item;
960
955
}
961
956
 
 
957
static void rna_SpaceProperties_texture_context_set(PointerRNA *ptr, int value)
 
958
{
 
959
        SpaceButs *sbuts = (SpaceButs *)(ptr->data);
 
960
 
 
961
        /* User action, no need to keep "better" value in prev here! */
 
962
        sbuts->texture_context = sbuts->texture_context_prev = value;
 
963
}
 
964
 
962
965
/* Space Console */
963
966
static void rna_ConsoleLine_body_get(PointerRNA *ptr, char *value)
964
967
{
989
992
                ci->cursor = len;
990
993
}
991
994
 
992
 
static void rna_ConsoleLine_cursor_index_range(PointerRNA *ptr, int *min, int *max, int *softmin, int *softmax)
 
995
static void rna_ConsoleLine_cursor_index_range(PointerRNA *ptr, int *min, int *max,
 
996
                                               int *UNUSED(softmin), int *UNUSED(softmax))
993
997
{
994
998
        ConsoleLine *ci = (ConsoleLine *)ptr->data;
995
999
 
1255
1259
        WM_main_add_notifier(NC_SCENE | ND_NODES, NULL);
1256
1260
}
1257
1261
 
 
1262
static void rna_SpaceNodeEditor_cursor_location_from_region(SpaceNode *snode, bContext *C, int x, int y)
 
1263
{
 
1264
        ARegion *ar = CTX_wm_region(C);
 
1265
        
 
1266
        UI_view2d_region_to_view(&ar->v2d, x, y, &snode->cursor[0], &snode->cursor[1]);
 
1267
        snode->cursor[0] /= UI_DPI_FAC;
 
1268
        snode->cursor[1] /= UI_DPI_FAC;
 
1269
}
 
1270
 
1258
1271
static void rna_SpaceClipEditor_clip_set(PointerRNA *ptr, PointerRNA value)
1259
1272
{
1260
1273
        SpaceClip *sc = (SpaceClip *)(ptr->data);
1921
1934
        RNA_def_property_ui_text(prop, "Backface Culling", "Use back face culling to hide the back side of faces");
1922
1935
        RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
1923
1936
 
 
1937
        prop = RNA_def_property(srna, "show_occlude_wire", PROP_BOOLEAN, PROP_NONE);
 
1938
        RNA_def_property_boolean_sdna(prop, NULL, "flag2", V3D_OCCLUDE_WIRE);
 
1939
        RNA_def_property_ui_text(prop, "Hidden Wire", "Use hidden wireframe display");
 
1940
        RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
 
1941
 
1924
1942
        prop = RNA_def_property(srna, "lock_camera", PROP_BOOLEAN, PROP_NONE);
1925
1943
        RNA_def_property_boolean_sdna(prop, NULL, "flag2", V3D_LOCK_CAMERA);
1926
1944
        RNA_def_property_ui_text(prop, "Lock Camera to View", "Enable view navigation within the camera view");
2189
2207
 
2190
2208
        prop = RNA_def_property(srna, "texture_context", PROP_ENUM, PROP_NONE);
2191
2209
        RNA_def_property_enum_items(prop, buttons_texture_context_items);
2192
 
        RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_SpaceProperties_texture_context_itemf");
 
2210
        RNA_def_property_enum_funcs(prop, NULL, "rna_SpaceProperties_texture_context_set",
 
2211
                                    "rna_SpaceProperties_texture_context_itemf");
2193
2212
        RNA_def_property_ui_text(prop, "Texture Context", "Type of texture data to display and edit");
2194
2213
        RNA_def_property_update(prop, NC_TEXTURE, NULL);
2195
2214
 
2568
2587
        RNA_def_property_ui_text(prop, "Margin Column", "Column number to show right margin at");
2569
2588
        RNA_def_property_update(prop, NC_SPACE | ND_SPACE_TEXT, NULL);
2570
2589
 
 
2590
        prop = RNA_def_property(srna, "top", PROP_INT, PROP_NONE);
 
2591
        RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 
2592
        RNA_def_property_int_sdna(prop, NULL, "top");
 
2593
        RNA_def_property_ui_text(prop, "Top Line", "Top line visible");
 
2594
 
 
2595
        prop = RNA_def_property(srna, "visible_lines", PROP_INT, PROP_NONE);
 
2596
        RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 
2597
        RNA_def_property_int_sdna(prop, NULL, "viewlines");
 
2598
        RNA_def_property_ui_text(prop, "Top Line", "Amount of lines that can be visible in current editor");
 
2599
 
2571
2600
        /* functionality options */
2572
2601
        prop = RNA_def_property(srna, "use_overwrite", PROP_BOOLEAN, PROP_NONE);
2573
2602
        RNA_def_property_boolean_sdna(prop, NULL, "overwrite", 1);
3287
3316
static void rna_def_space_node(BlenderRNA *brna)
3288
3317
{
3289
3318
        StructRNA *srna;
3290
 
        PropertyRNA *prop;
 
3319
        PropertyRNA *prop, *parm;
 
3320
        FunctionRNA *func;
3291
3321
 
3292
3322
        static EnumPropertyItem texture_type_items[] = {
3293
3323
                {SNODE_TEX_OBJECT, "OBJECT", ICON_OBJECT_DATA, "Object", "Edit texture nodes from Object"},
3428
3458
        RNA_def_property_float_sdna(prop, NULL, "cursor");
3429
3459
        RNA_def_property_ui_text(prop, "Cursor Location", "Location for adding new nodes");
3430
3460
        RNA_def_property_update(prop, NC_SPACE | ND_SPACE_NODE_VIEW, NULL);
 
3461
 
 
3462
        func = RNA_def_function(srna, "cursor_location_from_region", "rna_SpaceNodeEditor_cursor_location_from_region");
 
3463
        RNA_def_function_ui_description(func, "Set the cursor location using region coordinates");
 
3464
        RNA_def_function_flag(func, FUNC_USE_CONTEXT);
 
3465
        parm = RNA_def_int(func, "x", 0, INT_MIN, INT_MAX, "x", "Region x coordinate", -10000, 10000);
 
3466
        RNA_def_property_flag(parm, PROP_REQUIRED);
 
3467
        parm = RNA_def_int(func, "y", 0, INT_MIN, INT_MAX, "y", "Region y coordinate", -10000, 10000);
 
3468
        RNA_def_property_flag(parm, PROP_REQUIRED);
3431
3469
}
3432
3470
 
3433
3471
static void rna_def_space_logic(BlenderRNA *brna)
3520
3558
        static EnumPropertyItem pivot_items[] = {
3521
3559
                {V3D_CENTER, "BOUNDING_BOX_CENTER", ICON_ROTATE, "Bounding Box Center",
3522
3560
                             "Pivot around bounding box center of selected object(s)"},
 
3561
                {V3D_CURSOR, "CURSOR", ICON_CURSOR, "2D Cursor", "Pivot around the 2D cursor"},
3523
3562
                {V3D_LOCAL, "INDIVIDUAL_ORIGINS", ICON_ROTATECOLLECTION,
3524
3563
                            "Individual Origins", "Pivot around each object's own origin"},
3525
3564
                {V3D_CENTROID, "MEDIAN_POINT", ICON_ROTATECENTER, "Median Point",