Fix for first part of #28911: driver not working properly since 2.594
authorSergey Sharybin <sergey.vfx@gmail.com>
Fri, 14 Oct 2011 11:24:20 +0000 (11:24 +0000)
committerSergey Sharybin <sergey.vfx@gmail.com>
Fri, 14 Oct 2011 11:24:20 +0000 (11:24 +0000)
Missed id type set for driver target when setting target id.

Patch by me and Campbell.

source/blender/blenkernel/intern/ipo.c
source/blender/editors/interface/interface_anim.c

index 91f3c7a22bafd386a3f7b9d97dfe5fa22d4278aa..609f6cd38f18357e0312e5faac0ecd83ce81db3e 100644 (file)
@@ -1034,12 +1034,14 @@ static ChannelDriver *idriver_to_cdriver (IpoDriver *idriver)
                                        /* first bone target */
                                dtar= &dvar->targets[0];
                                dtar->id= (ID *)idriver->ob;
+                               dtar->idtype= ID_OB;
                                if (idriver->name[0])
                                        BLI_strncpy(dtar->pchan_name, idriver->name, sizeof(dtar->pchan_name));
                                
                                        /* second bone target (name was stored in same var as the first one) */
                                dtar= &dvar->targets[1];
                                dtar->id= (ID *)idriver->ob;
+                               dtar->idtype= ID_OB;
                                if (idriver->name[0]) // xxx... for safety
                                        BLI_strncpy(dtar->pchan_name, idriver->name+DRIVER_NAME_OFFS, sizeof(dtar->pchan_name));
                        }
@@ -1051,6 +1053,7 @@ static ChannelDriver *idriver_to_cdriver (IpoDriver *idriver)
                                /* only requires a single target */
                                dtar= &dvar->targets[0];
                                dtar->id= (ID *)idriver->ob;
+                               dtar->idtype= ID_OB;
                                if (idriver->name[0])
                                        BLI_strncpy(dtar->pchan_name, idriver->name, sizeof(dtar->pchan_name));
                                dtar->transChan= adrcode_to_dtar_transchan(idriver->adrcode);
@@ -1065,6 +1068,7 @@ static ChannelDriver *idriver_to_cdriver (IpoDriver *idriver)
                                /* only requires single target */
                        dtar= &dvar->targets[0];
                        dtar->id= (ID *)idriver->ob;
+                       dtar->idtype= ID_OB;
                        dtar->transChan= adrcode_to_dtar_transchan(idriver->adrcode);
                }
        }
index c35996701eea9b71d122d2aeae04e3bfce7c3907..6c661ba014e7063ae997dfc690c78a6aa16f2d60 100644 (file)
@@ -179,6 +179,7 @@ int ui_but_anim_expression_create(uiBut *but, const char *str)
                                
                                dtar = &dvar->targets[0];
                                dtar->id = (ID *)CTX_data_scene(C); // XXX: should we check that C is valid first?
+                               dtar->idtype= ID_SCE;
                                dtar->rna_path = BLI_sprintfN("frame_current");
                        }