diff options
author | Campbell Barton <ideasman42@gmail.com> | 2009-10-19 18:03:02 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2009-10-19 18:03:02 +0400 |
commit | dd96bf6168b60639701dd0ff512806e3fe1b65d0 (patch) | |
tree | 3873125b4f2d05eddfd25cc9e954c6a53149a60b /source | |
parent | 51f11abe45097cbba59626ede06c3832bcc522e2 (diff) |
- added xmirror to the weightpaint options
- made texture_slot return the texture slot for the node texture
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/BKE_material.h | 1 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/material.c | 12 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_icons.c | 2 | ||||
-rw-r--r-- | source/blender/editors/space_buttons/buttons_context.c | 4 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_material.c | 16 |
5 files changed, 21 insertions, 14 deletions
diff --git a/source/blender/blenkernel/BKE_material.h b/source/blender/blenkernel/BKE_material.h index 85316dddedf..3ea7cae2c86 100644 --- a/source/blender/blenkernel/BKE_material.h +++ b/source/blender/blenkernel/BKE_material.h @@ -47,6 +47,7 @@ void test_object_materials(struct ID *id); void init_material(struct Material *ma); struct Material *add_material(char *name); struct Material *copy_material(struct Material *ma); +struct Material *give_node_material(struct Material *ma); /* returns node material or self */ void make_local_material(struct Material *ma); void automatname(struct Material *); diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c index ab700ab283c..c2260e1e761 100644 --- a/source/blender/blenkernel/intern/material.c +++ b/source/blender/blenkernel/intern/material.c @@ -485,6 +485,18 @@ ID *material_from(Object *ob, int act) else return ob->data; } +Material *give_node_material(Material *ma) +{ + if(ma && ma->use_nodes && ma->nodetree) { + bNode *node= nodeGetActiveID(ma->nodetree, ID_MA); + + if(node) + return (Material *)node->id; + } + + return NULL; +} + /* GS reads the memory pointed at in a specific ordering. There are, * however two definitions for it. I have jotted them down here, both, * but I think the first one is actually used. The thing is that diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c index 7648c9412b7..ad96796213d 100644 --- a/source/blender/editors/interface/interface_icons.c +++ b/source/blender/editors/interface/interface_icons.c @@ -38,6 +38,8 @@ #endif #include "MEM_guardedalloc.h" +#include "GPU_extensions.h" + #include "BLI_arithb.h" #include "BLI_blenlib.h" #include "BLI_storage_types.h" diff --git a/source/blender/editors/space_buttons/buttons_context.c b/source/blender/editors/space_buttons/buttons_context.c index 504e4a6866e..bc0cc536857 100644 --- a/source/blender/editors/space_buttons/buttons_context.c +++ b/source/blender/editors/space_buttons/buttons_context.c @@ -622,7 +622,9 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r PointerRNA *ptr; if((ptr=get_pointer_type(path, &RNA_Material))) { - Material *ma= ptr->data; + Material *ma= ptr->data; /* should this be made a different option? */ + Material *ma_node= give_node_material(ma); + ma= ma_node?ma_node:ma; if(ma) CTX_data_pointer_set(result, &ma->id, &RNA_MaterialTextureSlot, ma->mtex[(int)ma->texact]); diff --git a/source/blender/makesrna/intern/rna_material.c b/source/blender/makesrna/intern/rna_material.c index d0aa4e4439c..fbecf2b5f07 100644 --- a/source/blender/makesrna/intern/rna_material.c +++ b/source/blender/makesrna/intern/rna_material.c @@ -58,6 +58,7 @@ static EnumPropertyItem prop_texture_coordinates_items[] = { #include "BKE_depsgraph.h" #include "BKE_main.h" +#include "BKE_material.h" #include "BKE_texture.h" #include "BKE_node.h" @@ -143,19 +144,8 @@ static void rna_Material_active_texture_set(PointerRNA *ptr, PointerRNA value) static PointerRNA rna_Material_active_node_material_get(PointerRNA *ptr) { - Material *ma= (Material*)ptr->data; - Material *ma_node= NULL; - - /* used in buttons to check context, also checks for edited groups */ - - if(ma && ma->use_nodes && ma->nodetree) { - bNode *node= nodeGetActiveID(ma->nodetree, ID_MA); - - if(node) - ma_node= (Material *)node->id; - } - - return rna_pointer_inherit_refine(ptr, &RNA_Material, ma_node); + Material *ma= give_node_material((Material*)ptr->data); + return rna_pointer_inherit_refine(ptr, &RNA_Material, ma); } static void rna_Material_active_node_material_set(PointerRNA *ptr, PointerRNA value) |