Skip to content

Commit

Permalink
noesis plugin now supports jpeg textures
Browse files Browse the repository at this point in the history
  • Loading branch information
majimboo committed May 16, 2017
1 parent ed48b35 commit 99cfc7c
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 8 deletions.
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
MView File Viewer
=================

This project consists of 2 scripts. `extract_mview` to extract files inside the mview archive and `extract_model` to convert the `.dat` files to `.obj`. Also includes a Noesis plugin. (see below)
This project consists of 2 scripts. `extract_mview` to extract files inside the mview archive and `extract_model` to convert the `.dat` files to `.obj`.

Also includes a Noesis plugin. (see below)

**Example**

Expand Down Expand Up @@ -62,9 +64,9 @@ Viewer
You can use the included viewer called Noesis. Just drag and drop the `.obj` file into Noesis.
You can also open the `.obj` file with any 3D program that supports wavefront format. @[richwhitehouse](http://richwhitehouse.com/index.php?content=inc_projects.php)

A Noesis plugin is also available at `noesis/plugins/python/fmt_artstation_mview.py`. Just open the `.mview` files with Noesis. (no texture support)
A Noesis plugin is also available at `noesis/plugins/python/fmt_artstation_mview.py`. Just open the `.mview` files with Noesis.

![](http://i.imgur.com/4F1azVi.png)
![](http://i.imgur.com/LgUFvEF.png)

Notes
=====
Expand Down
20 changes: 15 additions & 5 deletions noesis/plugins/python/fmt_artstation_mview.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import noesis, rapi, json, io
import noesis, rapi, json, io, os
from inc_noesis import *
from pprint import pprint

Expand Down Expand Up @@ -28,10 +28,20 @@ def loadModel(data, mdlList):
# load all the materials
for mat in scene["materials"]:
name = mat["name"]
diffuse = mat["albedoTex"]
fdiffuse = mat["albedoTex"]
ftypediffuse = os.path.splitext(fdiffuse)[1]

# texList.append(NoeTexture(diffuse, ))
matList.append(NoeMaterial(name, diffuse))
diffuse = None
if ftypediffuse == ".jpg":
diffuse = find(files["image/jpeg"], "filename", fdiffuse)["data"]
if ftypediffuse == ".png":
diffuse = find(files["image/png"], "filename", fdiffuse)["data"]

texture_d = rapi.loadTexByHandler(diffuse, ftypediffuse)
texture_d.name = fdiffuse

texList.append(texture_d)
matList.append(NoeMaterial(name, fdiffuse))

# load all the mesh
for mesh in scene["meshes"]:
Expand Down Expand Up @@ -84,7 +94,7 @@ def loadModel(data, mdlList):

for v in range(vertexCount):
posList.append(NoeVec3.fromBytes(df.readBytes(12)))
uvsList.append(NoeVec3([df.readFloat(), df.readFloat(), 0]))
uvsList.append(NoeVec3([df.readFloat(), -df.readFloat(), 0]))
df.readBytes(stride - 20)

for mesh in subMeshes:
Expand Down

0 comments on commit 99cfc7c

Please sign in to comment.