Fix for "new" Cycles handling of textures, UI code assumed all texture users use "texture" as prop name, but at least WeightVG modifiers do not.

Fixed by adding a "texture_user_property" member to spacebuts' context, and using it to get the prop identifier in ui script.

Thanks to Brecht for its advice!
This commit is contained in:
Bastien Montagne 2013-04-28 15:20:52 +00:00
parent 85a4938c10
commit 428debd9c8
2 changed files with 17 additions and 3 deletions

@ -896,8 +896,9 @@ class CyclesTexture_PT_context(CyclesButtonsPanel, Panel):
if pin_id:
col.template_ID(space, "pin_id")
elif user:
col.template_ID(user, "texture", new="texture.new")
else:
propname = context.texture_user_property.identifier
col.template_ID(user, propname, new="texture.new")
if tex:
split = layout.split(percentage=0.2)

@ -685,7 +685,7 @@ void buttons_context_compute(const bContext *C, SpaceButs *sbuts)
const char *buttons_context_dir[] = {
"texture_slot", "world", "object", "mesh", "armature", "lattice", "curve",
"meta_ball", "lamp", "speaker", "camera", "material", "material_slot",
"texture", "texture_user", "bone", "edit_bone",
"texture", "texture_user", "texture_user_property", "bone", "edit_bone",
"pose_bone", "particle_system", "particle_system_editable", "particle_settings",
"cloth", "soft_body", "fluid", "smoke", "collision", "brush", "dynamic_paint", NULL
};
@ -795,6 +795,19 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r
return 1;
}
else if (CTX_data_equals(member, "texture_user_property")) {
ButsContextTexture *ct = sbuts->texuser;
if (!ct)
return -1; /* old shading system (found but not available) */
if (ct->user && ct->user->ptr.data) {
ButsTextureUser *user = ct->user;
CTX_data_pointer_set(result, NULL, &RNA_Property, user->prop);
}
return 1;
}
else if (CTX_data_equals(member, "texture_node")) {
ButsContextTexture *ct = sbuts->texuser;