Skip to content

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
...
  • 3 commits
  • 1 file changed
  • 0 commit comments
  • 1 contributor
Showing with 17 additions and 9 deletions.
  1. +17 −9 io_scene_s3d/S3DFile.py
View
26 io_scene_s3d/S3DFile.py
@@ -154,8 +154,9 @@ def open(self, path, switchGLSL, removeDoubles):
## object position
objectPositionX = self.readFromFile("f", 1)[0]
- objectPositionY = self.readFromFile("f", 1)[0]
+ ## Y and Z need to be swapped.
objectPositionZ = self.readFromFile("f", 1)[0]
+ objectPositionY = self.readFromFile("f", 1)[0]
## object rotation
objectRotationW = self.readFromFile("f", 1)[0]
@@ -165,8 +166,9 @@ def open(self, path, switchGLSL, removeDoubles):
## object scale
objectScaleX = self.readFromFile("f", 1)[0]
- objectScaleY = self.readFromFile("f", 1)[0]
+ ## Y and Z need to be swapped.
objectScaleZ = self.readFromFile("f", 1)[0]
+ objectScaleY = self.readFromFile("f", 1)[0]
objectNoCollision = self.readFromFile("B", 1)
objectNoRender = self.readFromFile("B", 1)
@@ -174,7 +176,7 @@ def open(self, path, switchGLSL, removeDoubles):
objectVertexAmount = self.readFromFile("H", 1)[0]
objectFaceAmount = self.readFromFile("H", 1)[0]
-
+
objectLOD = self.readFromFile("B", 1)
objectWeights = self.readFromFile("B", 1)
@@ -376,7 +378,11 @@ def write(self, path):
for t in allTextures:
if t.type == 'IMAGE':
- textureFileName = t.image.filepath.split(self.getFileSystemSlash())[-1]
+ if t.image != None:
+ textureFileName = t.image.filepath.split(self.getFileSystemSlash())[-1]
+ else:
+ ## the file name cannot be blank
+ textureFileName = 'none'
## textureName
self.writeToFile("s", textureFileName)
@@ -406,7 +412,7 @@ def write(self, path):
texSlot = m.texture_slots[0]
## materialTextureBase
- if texSlot != None and bpy.data.textures[texSlot.name].type == 'IMAGE':
+ if texSlot != None and bpy.data.textures[texSlot.name].type == 'IMAGE' and bpy.data.textures[texSlot.name].image != None:
textureBase = bpy.data.textures[texSlot.name].image.filepath.split(self.getFileSystemSlash())[-1]
textureId = texturesIdList.index(textureBase)
else:
@@ -507,8 +513,9 @@ def write(self, path):
## object position
self.writeToFile("f", o.location[0])
- self.writeToFile("f", o.location[1])
+ ## Y and Z need to be swapped.
self.writeToFile("f", o.location[2])
+ self.writeToFile("f", o.location[1])
## object rotation
self.writeToFile("f", o.rotation_quaternion[1])
@@ -517,9 +524,10 @@ def write(self, path):
self.writeToFile("f", o.rotation_quaternion[0])
## object scale
- self.writeToFile("f", 1.0)
- self.writeToFile("f", 1.0)
- self.writeToFile("f", 1.0)
+ self.writeToFile("f", o.scale[0])
+ ## Y and Z need to be swapped.
+ self.writeToFile("f", o.scale[1])
+ self.writeToFile("f", o.scale[2])
## objectNoCollision
self.writeToFile("B", 0)

No commit comments for this range

Something went wrong with that request. Please try again.