[Bf-extensions-cvs] [0c17c55d] blender2.8: Updating the script to work in 2.8
Kalle-Samuli Riihikoski
noreply at git.blender.org
Sat Jul 21 11:42:14 CEST 2018
Commit: 0c17c55d105cdca7a429238df400c7e4624a5bd1
Author: Kalle-Samuli Riihikoski
Date: Sat Jul 21 09:40:10 2018 +0300
Branches: blender2.8
https://developer.blender.org/rBA0c17c55d105cdca7a429238df400c7e4624a5bd1
Updating the script to work in 2.8
===================================================================
M io_coat3D/__init__.py
D io_coat3D/coat.py
M io_coat3D/tex.py
===================================================================
diff --git a/io_coat3D/__init__.py b/io_coat3D/__init__.py
index ea9b5d9a..a55d8a17 100644
--- a/io_coat3D/__init__.py
+++ b/io_coat3D/__init__.py
@@ -35,9 +35,14 @@ if "bpy" in locals():
importlib.reload(coat)
importlib.reload(tex)
else:
- from . import coat
from . import tex
+from io_coat3D import tex
+import os
+import ntpath
+import re
+
+import time
import bpy
from bpy.types import PropertyGroup
from bpy.props import (
@@ -49,254 +54,849 @@ from bpy.props import (
)
-def register():
- bpy.coat3D = dict()
- bpy.coat3D['active_coat'] = ''
- bpy.coat3D['status'] = 0
- bpy.coat3D['kuva'] = 1
+bpy.coat3D = dict()
+bpy.coat3D['active_coat'] = ''
+bpy.coat3D['status'] = 0
+def set_exchange_folder():
+ platform = os.sys.platform
+ coat3D = bpy.context.scene.coat3D
+ Blender_export = ""
- class ObjectCoat3D(PropertyGroup):
- objpath: StringProperty(
- name="Object_Path"
- )
- applink_address: StringProperty(
- name="Object_Applink_address"
- )
- applink_name: StringProperty(
- name="Applink object name"
- )
- applink_group: StringProperty(
- name="Applink group"
- )
- applink_skip: StringProperty(
- name="Object_Applink_Update",
- default="False"
- )
- applink_firsttime: BoolProperty(
- name="FirstTime",
- description="FirstTime",
- default=True
- )
- coatpath: StringProperty(
- name="Coat_Path"
- )
- objectdir: StringProperty(
- name="ObjectPath",
- subtype="FILE_PATH"
- )
- objecttime: StringProperty(
- name="ObjectTime",
- subtype="FILE_PATH"
- )
- texturefolder: StringProperty(
- name="Texture folder:",
- subtype="DIR_PATH"
- )
- path3b: StringProperty(
- name="3B Path",
- subtype="FILE_PATH"
- )
- export_on: BoolProperty(
- name="Export_On",
- description="Add Modifiers and export",
- default=False
- )
- dime: FloatVectorProperty(
- name="dime",
- description="Dimension"
- )
- loc: FloatVectorProperty(
- name="Location",
- description="Location"
- )
- rot: FloatVectorProperty(
- name="Rotation",
- description="Rotation",
- subtype='EULER'
- )
- sca: FloatVectorProperty(
- name="Scale",
- description="Scale"
- )
+ if(platform == 'win32'):
+ exchange = os.path.expanduser("~") + os.sep + 'Documents' + os.sep + '3D-CoatV4' + os.sep +'Exchange'
+ if not(os.path.isdir(exchange)):
+ exchange = os.path.expanduser("~") + os.sep + 'Documents' + os.sep + '3D-CoatV3' + os.sep +'Exchange'
+ else:
+ exchange = os.path.expanduser("~") + os.sep + '3D-CoatV4' + os.sep + 'Exchange'
+ if not(os.path.isdir(exchange)):
+ exchange = os.path.expanduser("~") + os.sep + '3D-CoatV3' + os.sep + 'Exchange'
+ if(not(os.path.isdir(exchange))):
+ exchange = coat3D.exchangedir
- class SceneCoat3D(PropertyGroup):
- defaultfolder: StringProperty(
- name="FilePath",
- subtype="DIR_PATH",
- )
- cursor_loc: FloatVectorProperty(
- name="Cursor_loc",
- description="location"
- )
- exchangedir: StringProperty(
- name="FilePath",
- subtype="DIR_PATH"
- )
- exchangefolder: StringProperty(
- name="FilePath",
- subtype="DIR_PATH"
- )
- wasactive: StringProperty(
- name="Pass active object",
- )
- import_box: BoolProperty(
- name="Import window",
- description="Allows to skip import dialog",
- default=True
- )
- exchange_found: BoolProperty(
- name="Exchange Found",
- 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",
- default=False
- )
- importmod: BoolProperty(
- name="Remove Modifiers",
- description="Import and add modifiers",
- default=False
- )
- exportmod: BoolProperty(
- name="Modifiers",
- description="Export modifiers",
- default=False
- )
- export_pos: BoolProperty(
- name="Remember Position",
- description="Remember position",
- default=True
- )
- importtextures: 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",
- default=True
- )
+ if(os.path.isdir(exchange)):
+ bpy.coat3D['status'] = 1
+ if(platform == 'win32'):
+ exchange_path = os.path.expanduser("~") + os.sep + 'Documents' + os.sep + '3DC2Blender' + os.sep + 'Exchange_folder.txt'
+ applink_folder = os.path.expanduser("~") + os.sep + 'Documents' + os.sep + '3DC2Blender'
+ if(not(os.path.isdir(applink_folder))):
+ os.makedirs(applink_folder)
+ else:
+ exchange_path = os.path.expanduser("~") + os.sep + 'Documents' + os.sep + '3DC2Blender' + os.sep + 'Exchange_folder.txt'
+ applink_folder = os.path.expanduser("~") + os.sep + 'Documents' + os.sep + '3DC2Blender'
+ if(not(os.path.isdir(applink_folder))):
+ os.makedirs(applink_folder)
+ file = open(exchange_path, "w")
+ file.write("%s"%(coat3D.exchangedir))
+ file.close()
- # copy location
+ else:
+ if(platform == 'win32'):
+ exchange_path = os.path.expanduser("~") + os.sep + 'Documents' + os.sep + '3DC2Blender' + os.sep + 'Exchange_folder.txt'
+ else:
+ exchange_path = os.path.expanduser("~") + os.sep + '3DC2Blender' + os.sep + 'Exchange_folder.txt'
+ if(os.path.isfile(exchange_path)):
+ ex_path =''
- loca: FloatVectorProperty(
- name="location",
- description="Location",
- subtype="XYZ",
- default=(0.0, 0.0, 0.0)
- )
- rota: FloatVectorProperty(
- name="location",
- description="Location",
- subtype="EULER",
- default=(0.0, 0.0, 0.0)
- )
- scal: FloatVectorProperty(
- name="location",
- description="Location",
- subtype="XYZ",
- default=(0.0, 0.0, 0.0)
- )
- dime: FloatVectorProperty(
- name="dimension",
- description="Dimension",
- subtype="XYZ",
- default=(0.0, 0.0, 0.0)
- )
- type: EnumProperty(
- name="Export Type",
- description="Different Export Types",
- items=(("ppp", "Per-Pixel Painting", ""),
- ("mv", "Microvertex Painting", ""),
- ("ptex", "Ptex Painting", ""),
- ("uv", "UV-Mapping", ""),
- ("ref", "Reference Mesh", ""),
- ("retopo", "Retopo mesh as new layer", ""),
- ("vox", "Mesh As Voxel Object", ""),
- ("alpha", "Mesh As New Pen Alpha", ""),
- ("prim", "Mesh As Voxel Primitive", ""),
- ("curv", "Mesh As a Curve Profile", ""),
- ("autopo", "Mesh For Auto-retopology", ""),
- ),
- default="ppp"
- )
+ ex_pathh = open(exchange_path)
+ for line in ex_pathh:
+ ex_path = line
+ break
+ ex_pathh.close()
+
+ if(os.path.isdir(ex_path) and ex_path.rfind('Exchange') >= 0):
+ exchange = ex_path
+ bpy.coat3D['status'] = 1
+ else:
+ bpy.coat3D['status'] = 0
+ else:
+ bpy.coat3D['status'] = 0
+ if(bpy.coat3D['status'] == 1):
+ Blender_folder = ("%s%sBlender"%(exchange,os.sep))
+ Blender_export = Blender_folder
+ path3b_now = exchange
+ path3b_now += ('last_saved_3b_file.txt')
+ Blender_ex
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-extensions-cvs
mailing list