Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoshua Leung <aligorith@gmail.com>2010-02-10 04:55:45 +0300
committerJoshua Leung <aligorith@gmail.com>2010-02-10 04:55:45 +0300
commit491f9b7cbbba271d8b18cb41e00d5286aa96e5a6 (patch)
tree932f24a70a64fbeeccbe3df056354b1a4237369b /source/blender/makesrna
parentaf563d474f42486677ff593128f52138d55556c8 (diff)
Bugfix: 3DS Importer not settings UV's correctly
Thanks to example .3ds file and bug report from stridernzl. 1) The API function for adding textures to meshes was not working correctly, resulting in a Null texture slot being created (i.e. a texture slot was created, but the given texture could never be assigned to this). Fixed by making the function always require a texture as input (as with other places that use pointers as arguments). 2) In "Textured" draw mode, the imported meshes were shown white (i.e. without any textures). It appears that that the old old setting (mesh.faceUV) is no longer valid/wrapped in RNA, so worked around this by setting the 'tex' setting for UV-faces on. From the UI, this seems to do the same thing as entering editmode and assigning an image to the faces from the image editor. --- I've also removed a few lines of commented 2.4x code that is no longer valid. Hopefully there wasn't anything too valuable that I accidentally removed in this process ;)
Diffstat (limited to 'source/blender/makesrna')
-rw-r--r--source/blender/makesrna/intern/rna_material_api.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/source/blender/makesrna/intern/rna_material_api.c b/source/blender/makesrna/intern/rna_material_api.c
index aa28b6b923c..cb0c36af776 100644
--- a/source/blender/makesrna/intern/rna_material_api.c
+++ b/source/blender/makesrna/intern/rna_material_api.c
@@ -55,10 +55,10 @@ static void rna_Material_add_texture(Material *ma, Tex *tex, int mapto, int texc
break;
}
}
-
+
if (slot == -1)
slot= 0;
-
+
if (ma->mtex[slot]) {
ma->mtex[slot]->tex->id.us--;
}
@@ -69,8 +69,9 @@ static void rna_Material_add_texture(Material *ma, Tex *tex, int mapto, int texc
mtex= ma->mtex[slot];
mtex->tex= tex;
- id_us_plus(&tex->id);
-
+ if (tex)
+ id_us_plus(&tex->id);
+
mtex->texco= mapto;
mtex->mapto= texco;
}
@@ -117,7 +118,8 @@ void RNA_api_material(StructRNA *srna)
func= RNA_def_function(srna, "add_texture", "rna_Material_add_texture");
RNA_def_function_ui_description(func, "Add a texture to material's free texture slot.");
- parm= RNA_def_pointer(func, "texture", "Texture", "", "Texture to add.");
+ parm= RNA_def_pointer(func, "texture", "Texture", "Texture", "Texture to add.");
+ RNA_def_property_flag(parm, PROP_REQUIRED);
parm= RNA_def_enum(func, "texture_coordinates", prop_texture_coordinates_items, TEXCO_UV, "", "Source of texture coordinate information."); /* optional */
parm= RNA_def_enum(func, "map_to", prop_texture_mapto_items, MAP_COL, "", "Controls which material property the texture affects."); /* optional */
}