~ubuntu-branches/ubuntu/trusty/blender/trusty-proposed

« back to all changes in this revision

Viewing changes to source/blender/editors/space_graph/graph_buttons.c

  • Committer: Package Import Robot
  • Author(s): Matteo F. Vescovi
  • Date: 2013-08-14 10:43:49 UTC
  • mfrom: (14.2.19 sid)
  • Revision ID: package-import@ubuntu.com-20130814104349-t1d5mtwkphp12dyj
Tags: 2.68a-3
* Upload to unstable
* debian/: python3.3 Depends simplified
  - debian/control: python3.3 Depends dropped
    for blender-data package
  - 0001-blender_thumbnailer.patch refreshed
* debian/control: libavcodec b-dep versioning dropped

Show diffs side-by-side

added added

removed removed

Lines of Context:
42
42
 
43
43
#include "BLI_math.h"
44
44
#include "BLI_blenlib.h"
45
 
#include "BLI_rand.h"
46
45
#include "BLI_utildefines.h"
47
46
 
48
47
#include "BLF_translation.h"
296
295
                
297
296
                /* get property that F-Curve affects, for some unit-conversion magic */
298
297
                RNA_id_pointer_create(ale->id, &id_ptr);
299
 
                if (RNA_path_resolve(&id_ptr, fcu->rna_path, &fcu_prop_ptr, &fcu_prop) && fcu_prop) {
 
298
                if (RNA_path_resolve_property(&id_ptr, fcu->rna_path, &fcu_prop_ptr, &fcu_prop)) {
300
299
                        /* determine the unit for this property */
301
300
                        unit = RNA_SUBTYPE_UNIT(RNA_property_subtype(fcu_prop));
302
301
                }
383
382
                case B_IPO_DEPCHANGE:
384
383
                {
385
384
                        /* rebuild depsgraph for the new deps */
386
 
                        DAG_scene_sort(bmain, scene);
387
 
                        
388
 
                        /* force an update of depsgraph */
389
 
                        DAG_ids_flush_update(bmain, 0);
 
385
                        DAG_relations_tag_update(bmain);
390
386
                }
391
387
                break;
392
388
        }
464
460
        
465
461
        /* Target ID */
466
462
        row = uiLayoutRow(layout, FALSE);
 
463
        uiLayoutSetRedAlert(row, ((dtar->flag & DTAR_FLAG_INVALID) && !dtar->id));
467
464
        uiTemplateAnyID(row, &dtar_ptr, "id", "id_type", IFACE_("Prop:"));
468
465
        
469
466
        /* Target Property */
473
470
                /* get pointer for resolving the property selected */
474
471
                RNA_id_pointer_create(dtar->id, &root_ptr);
475
472
                
476
 
                col = uiLayoutColumn(layout, TRUE);
477
473
                /* rna path */
 
474
                col = uiLayoutColumn(layout, TRUE);
 
475
                uiLayoutSetRedAlert(col, (dtar->flag & DTAR_FLAG_INVALID));
478
476
                uiTemplatePathBuilder(col, &dtar_ptr, "data_path", &root_ptr, IFACE_("Path"));
479
477
        }
480
478
}
495
493
        
496
494
        /* Bone 1 */
497
495
        col = uiLayoutColumn(layout, TRUE);
 
496
        uiLayoutSetRedAlert(col, (dtar->flag & DTAR_FLAG_INVALID)); /* XXX: per field... */
498
497
        uiTemplateAnyID(col, &dtar_ptr, "id", "id_type", IFACE_("Bone 1:"));
499
 
                
 
498
        
500
499
        if (dtar->id && ob1->pose) {
501
500
                PointerRNA tar_ptr;
502
 
                        
 
501
                
503
502
                RNA_pointer_create(dtar->id, &RNA_Pose, ob1->pose, &tar_ptr);
504
503
                uiItemPointerR(col, &dtar_ptr, "bone_target", &tar_ptr, "bones", "", ICON_BONE_DATA);
505
504
        }
506
505
        
507
506
        col = uiLayoutColumn(layout, TRUE);
 
507
        uiLayoutSetRedAlert(col, (dtar2->flag & DTAR_FLAG_INVALID)); /* XXX: per field... */
508
508
        uiTemplateAnyID(col, &dtar2_ptr, "id", "id_type", IFACE_("Bone 2:"));
509
509
                
510
510
        if (dtar2->id && ob2->pose) {
511
511
                PointerRNA tar_ptr;
512
 
                        
 
512
                
513
513
                RNA_pointer_create(dtar2->id, &RNA_Pose, ob2->pose, &tar_ptr);
514
514
                uiItemPointerR(col, &dtar2_ptr, "bone_target", &tar_ptr, "bones", "", ICON_BONE_DATA);
515
515
        }
518
518
/* settings for 'location difference' driver variable type */
519
519
static void graph_panel_driverVar__locDiff(uiLayout *layout, ID *id, DriverVar *dvar)
520
520
{
521
 
        DriverTarget *dtar = &dvar->targets[0];
 
521
        DriverTarget *dtar  = &dvar->targets[0];
522
522
        DriverTarget *dtar2 = &dvar->targets[1];
523
523
        Object *ob1 = (Object *)dtar->id;
524
524
        Object *ob2 = (Object *)dtar2->id;
526
526
        uiLayout *col;
527
527
        
528
528
        /* initialize RNA pointer to the target */
529
 
        RNA_pointer_create(id, &RNA_DriverTarget, dtar, &dtar_ptr); 
 
529
        RNA_pointer_create(id, &RNA_DriverTarget, dtar,  &dtar_ptr); 
530
530
        RNA_pointer_create(id, &RNA_DriverTarget, dtar2, &dtar2_ptr); 
531
531
        
532
532
        /* Bone 1 */
533
533
        col = uiLayoutColumn(layout, TRUE);
 
534
        uiLayoutSetRedAlert(col, (dtar->flag & DTAR_FLAG_INVALID)); /* XXX: per field... */
534
535
        uiTemplateAnyID(col, &dtar_ptr, "id", "id_type", IFACE_("Ob/Bone 1:"));
535
536
                
536
537
        if (dtar->id && ob1->pose) {
537
538
                PointerRNA tar_ptr;
538
 
                        
 
539
                
539
540
                RNA_pointer_create(dtar->id, &RNA_Pose, ob1->pose, &tar_ptr);
540
541
                uiItemPointerR(col, &dtar_ptr, "bone_target", &tar_ptr, "bones", "", ICON_BONE_DATA);
541
542
        }
542
 
                
 
543
        
 
544
        uiLayoutSetRedAlert(col, false); /* we can clear it again now - it's only needed when creating the ID/Bone fields */
543
545
        uiItemR(col, &dtar_ptr, "transform_space", 0, NULL, ICON_NONE);
544
546
        
545
547
        col = uiLayoutColumn(layout, TRUE);
 
548
        uiLayoutSetRedAlert(col, (dtar2->flag & DTAR_FLAG_INVALID)); /* XXX: per field... */
546
549
        uiTemplateAnyID(col, &dtar2_ptr, "id", "id_type", IFACE_("Ob/Bone 2:"));
547
550
                
548
551
        if (dtar2->id && ob2->pose) {
549
552
                PointerRNA tar_ptr;
550
 
                        
 
553
                
551
554
                RNA_pointer_create(dtar2->id, &RNA_Pose, ob2->pose, &tar_ptr);
552
555
                uiItemPointerR(col, &dtar2_ptr, "bone_target", &tar_ptr, "bones", "", ICON_BONE_DATA);
553
556
        }
554
557
                
 
558
        uiLayoutSetRedAlert(col, false); /* we can clear it again now - it's only needed when creating the ID/Bone fields */
555
559
        uiItemR(col, &dtar2_ptr, "transform_space", 0, NULL, ICON_NONE);
556
560
}
557
561
 
568
572
        
569
573
        /* properties */
570
574
        col = uiLayoutColumn(layout, TRUE);
 
575
        uiLayoutSetRedAlert(col, (dtar->flag & DTAR_FLAG_INVALID)); /* XXX: per field... */
571
576
        uiTemplateAnyID(col, &dtar_ptr, "id", "id_type", IFACE_("Ob/Bone:"));
572
577
                
573
578
        if (dtar->id && ob->pose) {
574
579
                PointerRNA tar_ptr;
575
 
                        
 
580
                
576
581
                RNA_pointer_create(dtar->id, &RNA_Pose, ob->pose, &tar_ptr);
577
582
                uiItemPointerR(col, &dtar_ptr, "bone_target", &tar_ptr, "bones", "", ICON_BONE_DATA);
578
583
        }
626
631
        if (driver->type == DRIVER_TYPE_PYTHON) {
627
632
                /* expression */
628
633
                uiItemR(col, &driver_ptr, "expression", 0, IFACE_("Expr"), ICON_NONE);
629
 
 
 
634
                
630
635
                /* errors? */
631
636
                if (driver->flag & DRIVER_FLAG_INVALID)
632
637
                        uiItemL(col, IFACE_("ERROR: Invalid Python expression"), ICON_ERROR);
671
676
                box = uiLayoutBox(col);
672
677
                /* first row context info for driver */
673
678
                RNA_pointer_create(ale->id, &RNA_DriverVariable, dvar, &dvar_ptr);
674
 
 
 
679
                
675
680
                row = uiLayoutRow(box, FALSE);
676
681
                block = uiLayoutGetBlock(row);
677
682
                /* variable name */
678
683
                uiItemR(row, &dvar_ptr, "name", 0, "", ICON_NONE);
679
 
 
 
684
                
680
685
                /* remove button */
681
686
                uiBlockSetEmboss(block, UI_EMBOSSN);
682
687
                but = uiDefIconBut(block, BUT, B_IPO_DEPCHANGE, ICON_X, 290, 0, UI_UNIT_X, UI_UNIT_Y,
683
688
                                   NULL, 0.0, 0.0, 0.0, 0.0, IFACE_("Delete target variable"));
684
689
                uiButSetFunc(but, driver_delete_var_cb, driver, dvar);
685
690
                uiBlockSetEmboss(block, UI_EMBOSS);
686
 
 
 
691
                
687
692
                /* variable type */
688
693
                row = uiLayoutRow(box, FALSE);
689
694
                uiItemR(row, &dvar_ptr, "type", 0, "", ICON_NONE);
724
729
                        else {
725
730
                                BLI_snprintf(valBuf, sizeof(valBuf), "%.3f", dvar->curval);
726
731
                        }
727
 
 
 
732
                        
728
733
                        uiItemL(row, valBuf, ICON_NONE);
729
734
                }
730
735
        }
770
775
                 * a menu might be nicer but would be tricky as we need some custom filtering
771
776
                 */
772
777
                uiDefButO(block, BUT, "GRAPH_OT_fmodifier_add", WM_OP_INVOKE_REGION_WIN, IFACE_("Add Modifier"),
773
 
                          10, 0, 150, 20, TIP_("Adds a new F-Curve Modifier for the active F-Curve"));
 
778
                          0.5 * UI_UNIT_X, 0, 7.5 * UI_UNIT_X, UI_UNIT_Y, TIP_("Adds a new F-Curve Modifier for the active F-Curve"));
774
779
                
775
780
                /* copy/paste (as sub-row)*/
776
781
                row = uiLayoutRow(row, TRUE);
797
802
        pt = MEM_callocN(sizeof(PanelType), "spacetype graph panel view");
798
803
        strcpy(pt->idname, "GRAPH_PT_view");
799
804
        strcpy(pt->label, N_("View Properties"));
 
805
        strcpy(pt->translation_context, BLF_I18NCONTEXT_DEFAULT_BPYRNA);
800
806
        pt->draw = graph_panel_view;
801
807
        pt->flag |= PNL_DEFAULT_CLOSED;
802
808
        BLI_addtail(&art->paneltypes, pt);
804
810
        pt = MEM_callocN(sizeof(PanelType), "spacetype graph panel properties");
805
811
        strcpy(pt->idname, "GRAPH_PT_properties");
806
812
        strcpy(pt->label, N_("Active F-Curve"));
 
813
        strcpy(pt->translation_context, BLF_I18NCONTEXT_DEFAULT_BPYRNA);
807
814
        pt->draw = graph_panel_properties;
808
815
        pt->poll = graph_panel_poll;
809
816
        BLI_addtail(&art->paneltypes, pt);
811
818
        pt = MEM_callocN(sizeof(PanelType), "spacetype graph panel properties");
812
819
        strcpy(pt->idname, "GRAPH_PT_key_properties");
813
820
        strcpy(pt->label, N_("Active Keyframe"));
 
821
        strcpy(pt->translation_context, BLF_I18NCONTEXT_DEFAULT_BPYRNA);
814
822
        pt->draw = graph_panel_key_properties;
815
823
        pt->poll = graph_panel_poll;
816
824
        BLI_addtail(&art->paneltypes, pt);
819
827
        pt = MEM_callocN(sizeof(PanelType), "spacetype graph panel drivers");
820
828
        strcpy(pt->idname, "GRAPH_PT_drivers");
821
829
        strcpy(pt->label, N_("Drivers"));
 
830
        strcpy(pt->translation_context, BLF_I18NCONTEXT_DEFAULT_BPYRNA);
822
831
        pt->draw = graph_panel_drivers;
823
832
        pt->poll = graph_panel_drivers_poll;
824
833
        BLI_addtail(&art->paneltypes, pt);
826
835
        pt = MEM_callocN(sizeof(PanelType), "spacetype graph panel modifiers");
827
836
        strcpy(pt->idname, "GRAPH_PT_modifiers");
828
837
        strcpy(pt->label, N_("Modifiers"));
 
838
        strcpy(pt->translation_context, BLF_I18NCONTEXT_DEFAULT_BPYRNA);
829
839
        pt->draw = graph_panel_modifiers;
830
840
        pt->poll = graph_panel_poll;
831
841
        BLI_addtail(&art->paneltypes, pt);