Followup for r.48515

* Removed material driver creation hack. However, the textures one remains, as
texture eval isn't ready yet
* Shuffled some code
This commit is contained in:
2012-07-03 05:30:19 +00:00
parent c960d1692f
commit d58cb1beaa
2 changed files with 8 additions and 18 deletions

View 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);

View 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);