[Bf-extensions-cvs] [0f1e494c] master: restructure texture part. Added json file

Kalle-Samuli Riihikoski noreply at git.blender.org
Thu Jan 24 16:53:14 CET 2019


Commit: 0f1e494c5fd0a8015d826a68a0be6597455529a0
Author: Kalle-Samuli Riihikoski
Date:   Thu Jan 24 15:36:51 2019 +0200
Branches: master
https://developer.blender.org/rBA0f1e494c5fd0a8015d826a68a0be6597455529a0

restructure texture part. Added json file

===================================================================

M	io_coat3D/__init__.py
A	io_coat3D/data.json
M	io_coat3D/tex.py

===================================================================

diff --git a/io_coat3D/__init__.py b/io_coat3D/__init__.py
index fa7011ed..e52682df 100644
--- a/io_coat3D/__init__.py
+++ b/io_coat3D/__init__.py
@@ -991,8 +991,6 @@ class SCENE_PT_Settings_Update(ObjectButtonsPanel, bpy.types.Panel):
         col = flow.column()
         col.prop(coat3D, "importtextures", text="Update Textures")
         col = flow.column()
-        col.prop(coat3D, "creategroup", text="Group Nodes")
-        col = flow.column()
         col.prop(coat3D, "exportmod", text="Export with modifiers")
 
 class SCENE_PT_Settings_Folders(ObjectButtonsPanel, bpy.types.Panel):
@@ -1174,46 +1172,6 @@ class SceneCoat3D(PropertyGroup):
         description="Alert if Exchange folder is not found",
         default=True
     )
-    export_box: BoolProperty(
-        name="Export window",
-        description="Allows to skip export dialog",
-        default=True
-    )
-    export_color: BoolProperty(
-        name="Export color",
-        description="Export color texture",
-        default=True
-    )
-    export_spec: BoolProperty(
-        name="Export specular",
-        description="Export specular texture",
-        default=True
-    )
-    export_normal: BoolProperty(
-        name="Export Normal",
-        description="Export normal texture",
-        default=True
-    )
-    export_disp: BoolProperty(
-        name="Export Displacement",
-        description="Export displacement texture",
-        default=True
-    )
-    export_position: BoolProperty(
-        name="Export Source Position",
-        description="Export source position",
-        default=True
-    )
-    export_zero_layer: BoolProperty(
-        name="Export from Layer 0",
-        description="Export mesh from Layer 0",
-        default=True
-    )
-    export_coarse: BoolProperty(
-        name="Export Coarse",
-        description="Export Coarse",
-        default=True
-    )
     exportfile: BoolProperty(
         name="No Import File",
         description="Add Modifiers and export",
@@ -1229,11 +1187,6 @@ class SceneCoat3D(PropertyGroup):
         description="Export modifiers",
         default=False
     )
-    export_pos: BoolProperty(
-        name="Remember Position",
-        description="Remember position",
-        default=True
-    )
     importtextures: BoolProperty(
         name="Bring Textures",
         description="Import Textures",
@@ -1244,21 +1197,11 @@ class SceneCoat3D(PropertyGroup):
         description="Import Textures",
         default=True
     )
-    creategroup: BoolProperty(
-        name="Bring Textures",
-        description="Import Textures",
-        default=True
-    )
     importlevel: BoolProperty(
         name="Multires. Level",
         description="Bring Specific Multires Level",
         default=False
     )
-    exportover: BoolProperty(
-        name="Export Obj",
-        description="Import Textures",
-        default=False
-    )
     importmesh: BoolProperty(
         name="Mesh",
         description="Import Mesh",
diff --git a/io_coat3D/data.json b/io_coat3D/data.json
new file mode 100644
index 00000000..2a3020e1
--- /dev/null
+++ b/io_coat3D/data.json
@@ -0,0 +1,83 @@
+{
+
+  "color": {
+    "name": "color",
+    "colorspace":  "color",
+    "normal": "no",
+    "displacement": "no",
+    "find_input": [ "Color", "Base Color" ],
+    "input": 0,
+    "rampnode":  "no",
+    "node_location":  [ -400, 400 ]
+  },
+
+  "metalness": {
+    "name": "metalness",
+    "colorspace": "color",
+    "normal": "no",
+    "displacement": "no",
+    "find_input": [ "Metallic" ],
+    "input": 1,
+    "rampnode": "yes",
+    "node_location": [ -830, 160 ]
+  },
+
+  "rough": {
+    "name": "rough",
+    "colorspace": "color",
+    "normal": "no",
+    "displacement": "no",
+    "find_input": [ "Roughness" ],
+    "input": 2,
+    "rampnode": "yes",
+    "node_location": [ -550, 0 ]
+  },
+
+  "nmap": {
+    "name": "nmap",
+    "colorspace": "noncolor",
+    "normal": "yes",
+    "displacement": "no",
+    "find_input": [ "Normal" ],
+    "input": 3,
+    "rampnode": "no",
+    "node_location": [ -650, -500 ],
+    "normal_node_location": [ -350, -350 ]
+  },
+
+  "displacement": {
+    "name": "displacement",
+    "colorspace": "color",
+    "normal": "no",
+    "displacement": "yes",
+    "rampnode": "yes",
+    "input": 4
+  },
+
+  "emissive": {
+    "name": "emissive",
+    "colorspace": "color",
+    "normal": "no",
+    "displacement": "no",
+    "find_input": [ "Emissive" ],
+    "rampnode": "no",
+    "input": 5
+  },
+
+  "emissive_power": {
+    "name": "emissive_power",
+    "colorspace": "color",
+    "normal": "no",
+    "displacement": "no",
+    "rampnode": "no"
+  },
+
+  "ao": {
+    "name": "ao",
+    "colorspace": "color",
+    "normal": "no",
+    "displacement": "no",
+    "rampnode": "yes"
+  }
+
+}
diff --git a/io_coat3D/tex.py b/io_coat3D/tex.py
index 4c8ea57e..9b0bcfbe 100644
--- a/io_coat3D/tex.py
+++ b/io_coat3D/tex.py
@@ -20,6 +20,8 @@
 import bpy
 import os
 import re
+import json
+
 def find_index(objekti):
 
     luku = 0
@@ -29,6 +31,7 @@ def find_index(objekti):
         luku = luku +1
     return luku
 
+
 def RemoveFbxNodes(objekti):
     Node_Tree = objekti.active_material.node_tree
     for node in Node_Tree.nodes:
@@ -42,6 +45,7 @@ def RemoveFbxNodes(objekti):
 
     Node_Tree.links.new(Prin_mat.outputs[0], output.inputs[0])
 
+
 def UVTiling(objekti, texturelist):
     """ Checks what materials are linked into UV """
 
@@ -70,6 +74,7 @@ def UVTiling(objekti, texturelist):
     print('uvtiles_index', uvtiles_index)
     return texturelist
 
+
 def readtexturefolder(objekti, mat_list, texturelist, is_new): #read textures from texture file
 
     create_nodes = False
@@ -87,7 +92,6 @@ def readtexturefolder(objekti, mat_list, texturelist, is_new): #read textures fr
         texcoat['rough'] = []
         texcoat['metalness'] = []
         texcoat['nmap'] = []
-        texcoat['disp'] = []
         texcoat['emissive'] = []
         texcoat['emissive_power'] = []
         texcoat['displacement'] = []
@@ -98,25 +102,25 @@ def readtexturefolder(objekti, mat_list, texturelist, is_new): #read textures fr
                 if texture_info[2] == 'color' or texture_info[2] == 'diffuse':
                     texcoat['color'].append(texture_info[3])
                     create_nodes = True
-                if texture_info[2] == 'metalness' or texture_info[2] == 'specular' or texture_info[2] == 'reflection':
+                elif texture_info[2] == 'metalness' or texture_info[2] == 'specular' or texture_info[2] == 'reflection':
                     texcoat['metalness'].append(texture_info[3])
                     create_nodes = True
-                if texture_info[2] == 'rough' or texture_info[2] == 'roughness':
+                elif texture_info[2] == 'rough' or texture_info[2] == 'roughness':
                     texcoat['rough'].append(texture_info[3])
                     create_nodes = True
-                if texture_info[2] == 'nmap' or texture_info[2] == 'normalmap' or texture_info[2] == 'normal_map'  or texture_info[2] == 'normal':
+                elif texture_info[2] == 'nmap' or texture_info[2] == 'normalmap' or texture_info[2] == 'normal_map'  or texture_info[2] == 'normal':
                     texcoat['nmap'].append(texture_info[3])
                     create_nodes = True
-                if texture_info[2] == 'emissive':
+                elif texture_info[2] == 'emissive':
                     texcoat['emissive'].append(texture_info[3])
                     create_nodes = True
-                if texture_info[2] == 'emissive_power':
+                elif texture_info[2] == 'emissive_power':
                     texcoat['emissive_power'].append(texture_info[3])
                     create_nodes = True
-                if texture_info[2] == 'ao':
+                elif texture_info[2] == 'ao':
                     texcoat['ao'].append(texture_info[3])
                     create_nodes = True
-                if texture_info[2].startswith('displacement'):
+                elif texture_info[2].startswith('displacement'):
                     texcoat['displacement'].append(texture_info[3])
                     create_nodes = True
                 create_group_node = True
@@ -133,6 +137,7 @@ def readtexturefolder(objekti, mat_list, texturelist, is_new): #read textures fr
                 coat3D.remove_path = True
             createnodes(index_mat, texcoat, create_group_node)
 
+
 def checkmaterial(mat_list, objekti): #check how many materials object has
     mat_list = []
 
@@ -140,12 +145,14 @@ def checkmaterial(mat_list, objekti): #check how many materials object has
         if(obj_mate.material.use_nodes == False):
             obj_mate.material.use_nodes = True
 
+
 def createnodes(active_mat,texcoat, create_group_node): # Cretes new nodes and link textures into them
     bring_color = True # Meaning of these is to check if we can only update textures or do we need to create new nodes
     bring_metalness = True
     bring_roughness = True
     bring_normal = True
     bring_displacement = True
+    bring_emissive = True
     bring_AO = True
 
     coat3D = bpy.context.scene.coat3D
@@ -180,22 +187,32 @@ def createnodes(active_mat,texcoat, create_group_node): # Cretes new nodes and l
             elif(node.name == '3DC_metalness'):
                 bring_metalness = False
                 node.image.reload()
-            elif(node.name == '3DC_roughness'):
+            elif(node.name == '3DC_rough'):
                 bring_roughness = False
                 node.image.reload()
-            elif(node.name == '3DC_normal'):
+            elif(node.name == '3DC_nmap'):
                 bring_normal = False
                 node.image.reload()
             elif(node.name == '3DC_displacement'):
                 bring_displacement = False
                 node.image.reload()
+            elif (node.name == '3DC_emissive'):
+                bring_emissive = False
+                node.image.reload()
             elif (node.name == '3DC_AO'):
                 bring_AO = False
                 node.image.reload()
 
     #seuraavaksi lahdemme rakentamaan node tree. Lahdetaan Material Outputista 

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-extensions-cvs mailing list