[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [31558] trunk/blender: bugfix/ aviodance for [#23488] bpy.types.Texture.type don?\194? \180t update the parameters of texture
Campbell Barton
ideasman42 at gmail.com
Wed Aug 25 03:20:55 CEST 2010
Revision: 31558
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=31558
Author: campbellbarton
Date: 2010-08-25 03:20:50 +0200 (Wed, 25 Aug 2010)
Log Message:
-----------
bugfix/aviodance for [#23488] bpy.types.Texture.type don?\194?\180t update the parameters of texture
bpy.data.textures.new() now has a type argument since changing the type after forces the hacky use of recast_type().
Modified Paths:
--------------
trunk/blender/release/scripts/io/import_scene_3ds.py
trunk/blender/release/scripts/io/import_scene_obj.py
trunk/blender/source/blender/makesrna/intern/rna_main_api.c
Modified: trunk/blender/release/scripts/io/import_scene_3ds.py
===================================================================
--- trunk/blender/release/scripts/io/import_scene_3ds.py 2010-08-25 00:58:15 UTC (rev 31557)
+++ trunk/blender/release/scripts/io/import_scene_3ds.py 2010-08-25 01:20:50 UTC (rev 31558)
@@ -266,12 +266,10 @@
s += struct.unpack('<c', file.read(1))[0]
#print 'string: ',s
+ #remove the null character from the string
s = str(s[:-1], 'ASCII')
# print("read string", s)
-
- #remove the null character from the string
return s
-# return s[:-1]
######################################################
# IMPORT
@@ -300,7 +298,6 @@
if image:
texture.image = image
-# if image: texture.setImage(image) # double check its an image.
material.add_texture(texture, "UV", mapto)
@@ -414,9 +411,7 @@
return [float(col)/255 for col in struct.unpack('<3B', temp_data)] # data [0,1,2] == rgb
def read_texture(new_chunk, temp_chunk, name, mapto):
- new_texture = bpy.data.textures.new(name)
- new_texture.type = 'IMAGE'
- new_texture = new_texture.recast_type()
+ new_texture = bpy.data.textures.new(name, type='IMAGE')
img = None
while (new_chunk.bytes_read < new_chunk.length):
Modified: trunk/blender/release/scripts/io/import_scene_obj.py
===================================================================
--- trunk/blender/release/scripts/io/import_scene_obj.py 2010-08-25 00:58:15 UTC (rev 31557)
+++ trunk/blender/release/scripts/io/import_scene_obj.py 2010-08-25 01:20:50 UTC (rev 31558)
@@ -356,18 +356,15 @@
#==================================================================================#
def load_material_image(blender_material, context_material_name, imagepath, type):
- texture= bpy.data.textures.new(type)
- texture.type= 'IMAGE'
- texture = texture.recast_type() # Workaround for limitation in rna api.
-# texture= bpy.data.textures.new(type)
-# texture.setType('Image')
+ texture= bpy.data.textures.new(name=type, type='IMAGE')
# Absolute path - c:\.. etc would work here
- image= obj_image_load(imagepath, DIR, IMAGE_SEARCH)
- has_data = image.has_data if image else False
+ image = obj_image_load(imagepath, DIR, IMAGE_SEARCH)
+ has_data = False
if image:
texture.image = image
+ has_data = image.has_data
# Adds textures for materials (rendering)
if type == 'Kd':
Modified: trunk/blender/source/blender/makesrna/intern/rna_main_api.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_main_api.c 2010-08-25 00:58:15 UTC (rev 31557)
+++ trunk/blender/source/blender/makesrna/intern/rna_main_api.c 2010-08-25 01:20:50 UTC (rev 31558)
@@ -348,7 +348,7 @@
/* XXX python now has invalid pointer? */
}
-Tex *rna_Main_textures_new(Main *bmain, char* name)
+Tex *rna_Main_textures_new(Main *bmain, char* name, int type)
{
Tex *tex= add_texture(name);
tex->id.us--;
@@ -766,7 +766,7 @@
RNA_def_function_ui_description(func, "Add a new curve to the main database");
parm= RNA_def_string(func, "name", "Curve", 0, "", "New name for the datablock.");
RNA_def_property_flag(parm, PROP_REQUIRED);
- parm= RNA_def_enum(func, "type", object_type_curve_items, 0, "Type", "The type of curve object to add");
+ parm= RNA_def_enum(func, "type", object_type_curve_items, 0, "Type", "The type of curve to add");
RNA_def_property_flag(parm, PROP_REQUIRED);
/* return type */
parm= RNA_def_pointer(func, "curve", "Curve", "", "New curve datablock.");
@@ -841,6 +841,8 @@
RNA_def_function_ui_description(func, "Add a new texture to the main database");
parm= RNA_def_string(func, "name", "Texture", 0, "", "New name for the datablock.");
RNA_def_property_flag(parm, PROP_REQUIRED);
+ parm= RNA_def_enum(func, "type", texture_type_items, 0, "Type", "The type of texture to add");
+ RNA_def_property_flag(parm, PROP_REQUIRED);
/* return type */
parm= RNA_def_pointer(func, "texture", "Texture", "", "New texture datablock.");
RNA_def_function_return(func, parm);
More information about the Bf-blender-cvs
mailing list