forked from bartvdbraak/blender
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()
This commit is contained in:
parent
cdf7a1eaca
commit
7be25eba13
@ -40,7 +40,7 @@ class Import3DS(bpy.types.Operator, ImportHelper):
|
||||
|
||||
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
|
||||
|
@ -578,49 +578,6 @@ def process_next_chunk(file, previous_chunk, importedObjects, IMAGE_SEARCH):
|
||||
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 @@ def process_next_chunk(file, previous_chunk, importedObjects, IMAGE_SEARCH):
|
||||
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 @@ def load_3ds(filepath, context, IMPORT_CONSTRAIN_BOUNDS=10.0, IMAGE_SEARCH=True,
|
||||
|
||||
# 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
|
||||
|
@ -2335,7 +2335,7 @@ static void draw_em_fancy(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object
|
||||
}
|
||||
}
|
||||
|
||||
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 @@ static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D
|
||||
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 @@ static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D
|
||||
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 @@ static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D
|
||||
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 @@ static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user