diff --git a/Cinema 4D/appdir_common/plugins/DazToC4D/DazToC4D.pyp b/Cinema 4D/appdir_common/plugins/DazToC4D/DazToC4D.pyp index 64d6673..b90dc23 100644 --- a/Cinema 4D/appdir_common/plugins/DazToC4D/DazToC4D.pyp +++ b/Cinema 4D/appdir_common/plugins/DazToC4D/DazToC4D.pyp @@ -51,13 +51,17 @@ del blob, b, t, z, m import importlib import os +import sys -check = importlib.util.find_spec("ptvsd") is not None -if check: - import ptvsd +print("Python Version is {0}".format(sys.version_info)) - ptvsd.enable_attach(address=("127.0.0.1", 3000)) - ptvsd.wait_for_attach() +if sys.version_info > (3,0): + check = importlib.util.find_spec("ptvsd") is not None + if check: + import ptvsd + + ptvsd.enable_attach(address=("127.0.0.1", 3000)) + ptvsd.wait_for_attach() import c4d diff --git a/Cinema 4D/appdir_common/plugins/DazToC4D/lib/CustomImports.py b/Cinema 4D/appdir_common/plugins/DazToC4D/lib/CustomImports.py index 4b51be7..a12776e 100644 --- a/Cinema 4D/appdir_common/plugins/DazToC4D/lib/CustomImports.py +++ b/Cinema 4D/appdir_common/plugins/DazToC4D/lib/CustomImports.py @@ -231,7 +231,7 @@ def import_daz_fbx(self, file_path): ) file = c4d.documents.LoadDocument( - file_path, + str(file_path), flags, ) c4d.documents.InsertBaseDocument(file) diff --git a/Cinema 4D/appdir_common/plugins/DazToC4D/lib/DazRig.py b/Cinema 4D/appdir_common/plugins/DazToC4D/lib/DazRig.py index 78faebc..50e25a1 100644 --- a/Cinema 4D/appdir_common/plugins/DazToC4D/lib/DazRig.py +++ b/Cinema 4D/appdir_common/plugins/DazToC4D/lib/DazRig.py @@ -1,7 +1,7 @@ from ntpath import join import c4d from c4d import documents -import math +import sys from .CustomCmd import Cinema4DCommands as dzc4d from .CustomIterators import TagIterator @@ -105,10 +105,16 @@ def reset_bind_pose(self, c_meshes): for tag in tags: tag_type = tag.GetTypeName() if tag_type == "Weight": - tag[c4d.ID_CA_WEIGHT_TAG_SET_BUTTON] = 2005 - c4d.CallButton(tag, c4d.ID_CA_WEIGHT_TAG_SET_BUTTON) - c4d.EventAdd() - break + if sys.version_info > (3,0): + tag[c4d.ID_CA_WEIGHT_TAG_SET_BUTTON] = 2005 + c4d.CallButton(tag, c4d.ID_CA_WEIGHT_TAG_SET_BUTTON) + c4d.EventAdd() + break + else: + tag[c4d.ID_CA_WEIGHT_TAG_SET] = 2005 + c4d.CallButton(tag, c4d.ID_CA_WEIGHT_TAG_SET) + c4d.EventAdd() + break def fix_joints(self, c_skin_data, c_joints, c_meshes): self.disable_skin_data(c_skin_data) diff --git a/Cinema 4D/appdir_common/plugins/DazToC4D/lib/DtC4DWindow.py b/Cinema 4D/appdir_common/plugins/DazToC4D/lib/DtC4DWindow.py index 67b8517..a90b43e 100644 --- a/Cinema 4D/appdir_common/plugins/DazToC4D/lib/DtC4DWindow.py +++ b/Cinema 4D/appdir_common/plugins/DazToC4D/lib/DtC4DWindow.py @@ -4,7 +4,6 @@ import c4d from c4d import gui -from .Utilities import hideEyePolys from .Materials import Materials, convertToRedshift, convertMaterials from .CustomImports import CustomImports from .DtC4DDialogs import EXTRADialog @@ -395,13 +394,11 @@ def Command(self, id, msg): convert_to_redshift = convertToRedshift() convert_to_redshift.getBumpType(redshiftBumpType) convert_to_redshift.execute() - hideEyePolys() c4d.CallCommand(100004766, 100004766) # Select All c4d.CallCommand(100004767, 100004767) # Deselect All if comboRender == 3: mat.convertToOctane() - hideEyePolys() c4d.CallCommand(100004766, 100004766) # Select All c4d.CallCommand(100004767, 100004767) # Deselect All diff --git a/Cinema 4D/appdir_common/plugins/DazToC4D/lib/Materials.py b/Cinema 4D/appdir_common/plugins/DazToC4D/lib/Materials.py index 807acaa..5c02b5f 100644 --- a/Cinema 4D/appdir_common/plugins/DazToC4D/lib/Materials.py +++ b/Cinema 4D/appdir_common/plugins/DazToC4D/lib/Materials.py @@ -29,8 +29,14 @@ def srgb_to_linear_rgb(srgb): def hex_to_col(hex, normalize=True, precision=6): col = [] it = iter(hex) + if c4d.GetC4DVersion() >= 22123: + iterator = it.next() + else: + iterator = it.__next__() + for char in it: - col.append(int(char + it.__next__(), 16)) + col.append(int(char + iterator, 16)) + if normalize: col = map(lambda x: x / 255, col) col = map(lambda x: round(x, precision), col) @@ -190,6 +196,7 @@ def find_mat_properties(self, obj, mat): @staticmethod def create_texture(mat, path): + path = str(path) texture = c4d.BaseList2D(c4d.Xbitmap) texture[c4d.BITMAPSHADER_FILENAME] = path mat.InsertShader(texture) diff --git a/Cinema 4D/appdir_common/plugins/DazToC4D/lib/Utilities.py b/Cinema 4D/appdir_common/plugins/DazToC4D/lib/Utilities.py index e36409d..31b0bd1 100644 --- a/Cinema 4D/appdir_common/plugins/DazToC4D/lib/Utilities.py +++ b/Cinema 4D/appdir_common/plugins/DazToC4D/lib/Utilities.py @@ -111,15 +111,6 @@ def get_daz_name(): return "" -def hideEyePolys(self): - doc = documents.GetActiveDocument() - obj = doc.GetFirstObject() - scene = ObjectIterator(obj) - for obj in scene: - self.hidePolyTagByName(obj, "EyeMoisture") - self.hidePolyTagByName(obj, "Cornea") - - def getJointFromSkin(obj, jointName): objTags = TagIterator(obj) for t in objTags: