[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [33070] trunk/blender: fix [#24712] 3ds_import fix
Campbell Barton
ideasman42 at gmail.com
Mon Nov 15 01:07:38 CET 2010
Revision: 33070
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=33070
Author: campbellbarton
Date: 2010-11-15 01:07:38 +0100 (Mon, 15 Nov 2010)
Log Message:
-----------
fix [#24712] 3ds_import fix
Rather then applying the proposed fix, enabling 'Apply Transform' works in almost all cases including the reported one.
There are some files that don't work with 'Apply Transform', which is why the option is worth keeping.
also remove unneeded calls to paint_facesel_test()
Modified Paths:
--------------
trunk/blender/release/scripts/op/io_scene_3ds/__init__.py
trunk/blender/release/scripts/op/io_scene_3ds/import_3ds.py
trunk/blender/source/blender/editors/space_view3d/drawobject.c
Modified: trunk/blender/release/scripts/op/io_scene_3ds/__init__.py
===================================================================
--- trunk/blender/release/scripts/op/io_scene_3ds/__init__.py 2010-11-14 23:37:03 UTC (rev 33069)
+++ trunk/blender/release/scripts/op/io_scene_3ds/__init__.py 2010-11-15 00:07:38 UTC (rev 33070)
@@ -40,7 +40,7 @@
constrain_size = FloatProperty(name="Size Constraint", description="Scale the model by 10 until it reacehs the size constraint. Zero Disables.", min=0.0, max=1000.0, soft_min=0.0, soft_max=1000.0, default=10.0)
use_image_search = BoolProperty(name="Image Search", description="Search subdirectories for any assosiated images (Warning, may be slow)", default=True)
- use_apply_transform = BoolProperty(name="Apply Transform", description="Workaround for object transformations importing incorrectly", default=False)
+ use_apply_transform = BoolProperty(name="Apply Transform", description="Workaround for object transformations importing incorrectly", default=True)
def execute(self, context):
import io_scene_3ds.import_3ds
Modified: trunk/blender/release/scripts/op/io_scene_3ds/import_3ds.py
===================================================================
--- trunk/blender/release/scripts/op/io_scene_3ds/import_3ds.py 2010-11-14 23:37:03 UTC (rev 33069)
+++ trunk/blender/release/scripts/op/io_scene_3ds/import_3ds.py 2010-11-15 00:07:38 UTC (rev 33070)
@@ -578,49 +578,6 @@
data[6:9] + [0],\
data[9:] + [1])
-
- '''
- contextMatrix_rot = Blender.mathutils.Matrix(\
- data[:3] + [0],\
- data[3:6] + [0],\
- data[6:9] + [0],\
- [0,0,0,1])
- '''
-
- '''
- contextMatrix_rot = Blender.mathutils.Matrix(\
- data[:3] ,\
- data[3:6],\
- data[6:9])
- '''
-
- '''
- contextMatrix_rot = Blender.mathutils.Matrix()
- m = 0
- for j in xrange(4):
- for i in xrange(3):
- contextMatrix_rot[j][i] = data[m]
- m += 1
-
- contextMatrix_rot[0][3]=0;
- contextMatrix_rot[1][3]=0;
- contextMatrix_rot[2][3]=0;
- contextMatrix_rot[3][3]=1;
- '''
-
- #contextMatrix_rot.resize4x4()
- #print "MTX"
- #print contextMatrix_rot
- contextMatrix_rot.invert()
- #print contextMatrix_rot
- #contextMatrix_tx = mathutils.Matrix.Translation(0.5 * Blender.mathutils.Vector(data[9:]))
- #contextMatrix_tx.invert()
-
- #tx.invert()
-
- #contextMatrix = contextMatrix * tx
- #contextMatrix = contextMatrix *tx
-
elif (new_chunk.ID == MAT_MAP_FILEPATH):
texture_name, read_str_len = read_string(file)
try:
@@ -651,7 +608,7 @@
if CreateBlenderObject:
putContextMesh(contextMesh_vertls, contextMesh_facels, contextMeshMaterials)
-def load_3ds(filepath, context, IMPORT_CONSTRAIN_BOUNDS=10.0, IMAGE_SEARCH=True, APPLY_MATRIX=False):
+def load_3ds(filepath, context, IMPORT_CONSTRAIN_BOUNDS=10.0, IMAGE_SEARCH=True, APPLY_MATRIX=True):
global SCN
# XXX
@@ -722,11 +679,10 @@
# REMOVE DUMMYVERT, - remove this in the next release when blenders internal are fixed.
- for ob in importedObjects:
- if ob.type == 'MESH':
- me = ob.data
-# me.vertices.delete([me.vertices[0],]) # XXX, todo
- if not APPLY_MATRIX:
+ if APPLY_MATRIX:
+ for ob in importedObjects:
+ if ob.type == 'MESH':
+ me = ob.data
me.transform(ob.matrix_world.copy().invert())
# Done DUMMYVERT
Modified: trunk/blender/source/blender/editors/space_view3d/drawobject.c
===================================================================
--- trunk/blender/source/blender/editors/space_view3d/drawobject.c 2010-11-14 23:37:03 UTC (rev 33069)
+++ trunk/blender/source/blender/editors/space_view3d/drawobject.c 2010-11-15 00:07:38 UTC (rev 33070)
@@ -2335,7 +2335,7 @@
}
}
- if((me->drawflag & (ME_DRAWFACES)) || paint_facesel_test(ob)) { /* transp faces */
+ if(me->drawflag & ME_DRAWFACES) { /* transp faces */
unsigned char col1[4], col2[4], col3[4];
UI_GetThemeColor4ubv(TH_FACE, (char *)col1);
@@ -2472,7 +2472,8 @@
Object *ob= base->object;
Mesh *me = ob->data;
Material *ma= give_current_material(ob, 1);
- int hasHaloMat = (ma && (ma->material_type == MA_TYPE_HALO));
+ const short hasHaloMat = (ma && (ma->material_type == MA_TYPE_HALO));
+ const short is_paint_sel= (ob==OBACT && paint_facesel_test(ob));
int draw_wire = 0;
int totvert, totedge, totface;
DispList *dl;
@@ -2494,7 +2495,7 @@
glFrontFace((ob->transflag&OB_NEG_SCALE)?GL_CW:GL_CCW);
// Unwanted combination.
- if (ob==OBACT && paint_facesel_test(ob)) draw_wire = 0;
+ if (is_paint_sel) draw_wire = 0;
if(dt==OB_BOUNDBOX) {
if((v3d->flag2 & V3D_RENDER_OVERRIDE && v3d->drawtype >= OB_WIRE)==0)
@@ -2508,11 +2509,10 @@
else if(dt==OB_WIRE || totface==0) {
draw_wire = 1; /* draw wire only, no depth buffer stuff */
}
- else if( (ob==OBACT && (ob->mode & OB_MODE_TEXTURE_PAINT || paint_facesel_test(ob))) ||
+ else if( (is_paint_sel && (ob->mode & OB_MODE_TEXTURE_PAINT)) ||
CHECK_OB_DRAWTEXTURE(v3d, dt))
{
- int faceselect= (ob==OBACT && paint_facesel_test(ob));
- if ((v3d->flag&V3D_SELECT_OUTLINE) && ((v3d->flag2 & V3D_RENDER_OVERRIDE)==0) && (base->flag&SELECT) && !(G.f&G_PICKSEL || paint_facesel_test(ob)) && !draw_wire) {
+ if ((v3d->flag&V3D_SELECT_OUTLINE) && ((v3d->flag2 & V3D_RENDER_OVERRIDE)==0) && (base->flag&SELECT) && !(G.f&G_PICKSEL || is_paint_sel) && !draw_wire) {
draw_mesh_object_outline(v3d, ob, dm);
}
@@ -2527,10 +2527,10 @@
glFrontFace(GL_CCW);
}
else {
- draw_mesh_textured(scene, v3d, rv3d, ob, dm, faceselect);
+ draw_mesh_textured(scene, v3d, rv3d, ob, dm, is_paint_sel);
}
- if(!faceselect) {
+ if(!is_paint_sel) {
if(base->flag & SELECT)
UI_ThemeColor((ob==OBACT)?TH_ACTIVE:TH_SELECT);
else
More information about the Bf-blender-cvs
mailing list