Followup for r.48515
authorJoshua Leung <aligorith@gmail.com>
Tue, 3 Jul 2012 05:30:19 +0000 (05:30 +0000)
committerJoshua Leung <aligorith@gmail.com>
Tue, 3 Jul 2012 05:30:19 +0000 (05:30 +0000)
* Removed material driver creation hack. However, the textures one remains, as
texture eval isn't ready yet
* Shuffled some code

source/blender/blenkernel/intern/depsgraph.c
source/blender/editors/animation/drivers.c

index 99c3b17dee2fca86d42c1ffef179b0374532107c..65d36d665dbebd13c17ffa92d4cb3cb12f3fc5a7 100644 (file)
@@ -66,6 +66,7 @@
 #include "BKE_library.h"
 #include "BKE_main.h"
 #include "BKE_node.h"
+#include "BKE_material.h"
 #include "BKE_mball.h"
 #include "BKE_modifier.h"
 #include "BKE_object.h"
@@ -311,7 +312,7 @@ static void dag_add_driver_relation(AnimData *adt, DagForest *dag, DagNode *node
        for (fcu = adt->drivers.first; fcu; fcu = fcu->next) {
                ChannelDriver *driver = fcu->driver;
                DriverVar *dvar;
-               int isdata_fcu = isdata || (fcu->rna_path && strstr(fcu->rna_path, "modifiers["));
+               int isdata_fcu = (isdata) || (fcu->rna_path && strstr(fcu->rna_path, "modifiers["));
                
                /* loop over variables to get the target relationships */
                for (dvar = driver->variables.first; dvar; dvar = dvar->next) {
@@ -379,6 +380,10 @@ static void dag_add_material_driver_relations(DagForest *dag, DagNode *node, Mat
                dag_add_driver_relation(ma->adt, dag, node, 1);
        }
        
+       /* textures */
+       // TODO...
+       //dag_add_texture_driver_relations(DagForest *dag, DagNode *node, ID *id);
+       
        /* material's nodetree */
        if (ma->nodetree) {
                dag_add_material_nodetree_driver_relations(dag, node, ma->nodetree);
index 4a5966948aea2dea1d551b4ae1289c48f2530bb0..672e11ac61363e99c34cd893071cdf12c670eb46 100644 (file)
@@ -416,6 +416,7 @@ static char *get_driver_path_hack(bContext *C, PointerRNA *ptr, PropertyRNA *pro
        char *basepath = RNA_path_from_ID_to_property(ptr, prop);
        char *path = basepath; /* in case no remapping is needed */
        
+       
        /* Remapping will only be performed in the Properties Editor, as only this 
         * restricts the subspace of options to the 'active' data (a manageable state)
         */
@@ -426,23 +427,6 @@ static char *get_driver_path_hack(bContext *C, PointerRNA *ptr, PropertyRNA *pro
                if (ob && id) {
                        /* only id-types which can be remapped to go through objects should be considered */
                        switch (GS(id->name)) {
-                               case ID_MA: /* materials */
-                               {
-                                       Material *ma = give_current_material(ob, ob->actcol);
-                                       
-                                       /* assumes: material will only be shown if it is active objects's active material it's ok */
-                                       if ((ID *)ma == id) {
-                                               /* create new path */
-                                               // TODO: use RNA path functions to construct instead?
-                                               path = BLI_sprintfN("material_slots[\"%s\"].material.%s",
-                                                                   ma->id.name + 2, basepath);
-                                                       
-                                               /* free old one */
-                                               MEM_freeN(basepath);
-                                       }
-                               }
-                               break;
-                                       
                                case ID_TE: /* textures */
                                {
                                        Material *ma = give_current_material(ob, ob->actcol);
@@ -452,6 +436,7 @@ static char *get_driver_path_hack(bContext *C, PointerRNA *ptr, PropertyRNA *pro
                                        if ((ID *)tex == id) {
                                                /* create new path */
                                                // TODO: use RNA path functions to construct step by step instead?
+                                               // FIXME: maybe this isn't even needed anymore...
                                                path = BLI_sprintfN("material_slots[\"%s\"].material.texture_slots[\"%s\"].texture.%s", 
                                                                    ma->id.name + 2, tex->id.name + 2, basepath);