Skip to content
Snippets Groups Projects
__init__.py 71.2 KiB
Newer Older
  • Learn to ignore specific revisions
  •                     bpy.ops.object.select_all(action='DESELECT')
                        obj_proxy.select_set(True)
    
                        bpy.ops.object.select_all(action='TOGGLE')
    
                        if objekti.coat3D.applink_firsttime == True and objekti.coat3D.type == 'vox':
                            objekti.select_set(True)
    
                            objekti.scale = (0.01, 0.01, 0.01)
    
                            objekti.rotation_euler[0] = 1.5708
                            objekti.rotation_euler[2] = 1.5708
                            bpy.ops.object.transforms_to_deltas(mode='ROT')
                            bpy.ops.object.transforms_to_deltas(mode='SCALE')
                            objekti.coat3D.applink_firsttime = False
                            objekti.select_set(False)
    
                        elif objekti.coat3D.applink_firsttime == True:
                            objekti.scale = (objekti.scale[0]/objekti.coat3D.applink_scale[0],objekti.scale[1]/objekti.coat3D.applink_scale[1],objekti.scale[2]/objekti.coat3D.applink_scale[2])
                            #bpy.ops.object.transforms_to_deltas(mode='SCALE')
                            if(objekti.coat3D.applink_onlyone == False):
                                objekti.rotation_euler = (0,0,0)
                            objekti.coat3D.applink_firsttime = False
    
                        if(coat3D.importlevel):
                            obj_proxy.select = True
                            obj_proxy.modifiers.new(name='temp',type='MULTIRES')
                            objekti.select = True
                            bpy.ops.object.multires_reshape(modifier=multires_name)
                            bpy.ops.object.select_all(action='TOGGLE')
                        else:
    
                            bpy.context.view_layer.objects.active = obj_proxy
                            keep_materials_count = len(obj_proxy.material_slots) - len(objekti.material_slots)
    
                            #delete_materials_from_end(keep_materials_count, obj_proxy)
    
                            updatemesh(objekti,obj_proxy, texturelist)
                            bpy.context.view_layer.objects.active = objekti
    
                        #it is important to get the object translated correctly
    
                        if (use_smooth):
                            for data_mesh in objekti.data.polygons:
                                data_mesh.use_smooth = True
                        else:
                            for data_mesh in objekti.data.polygons:
                                data_mesh.use_smooth = False
    
                            bpy.ops.object.select_all(action='DESELECT')
    
                        if(coat3D.importmesh and not(os.path.isfile(objekti.coat3D.applink_address))):
                            coat3D.importmesh = False
    
                        objekti.select_set(True)
                    if(coat3D.importtextures):
                        is_new = False
                        if(objekti.coat3D.retopo == False):
                            tex.matlab(objekti,mat_list,texturelist,is_new)
                    objekti.select_set(False)
                else:
                    mat_list = []
                    if (objekti.material_slots):
                        for obj_mat in objekti.material_slots:
                            mat_list.append(obj_mat.material)
    
                    if (coat3D.importtextures):
                        is_new = False
                        if(objekti.coat3D.retopo == False):
                            tex.matlab(objekti,mat_list,texturelist, is_new)
                    objekti.select_set(False)
    
        if(coat3D.remove_path == True):
    
            if(os.path.isfile(path3b_n)):
                os.remove(path3b_n)
    
            coat3D.remove_path = False
    
        bpy.ops.object.select_all(action='DESELECT')
        if(import_list):
    
            for del_obj in diff_objects:
    
                if(bpy.context.collection.all_objects[del_obj].coat3D.type == 'vox' and bpy.context.collection.all_objects[del_obj].coat3D.delete_proxy_mesh == False):
                    bpy.context.collection.all_objects[del_obj].select_set(True)
                    objekti = bpy.context.collection.all_objects[del_obj]
                    #bpy.ops.object.transforms_to_deltas(mode='ROT')
                    objekti.scale = (1, 1, 1)
                    bpy.ops.object.origin_set(type='ORIGIN_GEOMETRY')
    
                    objekti.data.coat3D.name = '3DC'
    
                    objekti.coat3D.objecttime = str(os.path.getmtime(objekti.coat3D.applink_address))
                    objekti.coat3D.applink_name = objekti.name
                    objekti.coat3D.applink_mesh = True
                    objekti.coat3D.import_mesh = False
    
    
                    #bpy.ops.object.transforms_to_deltas(mode='SCALE')
    
                    objekti.coat3D.applink_firsttime = False
                    bpy.context.collection.all_objects[del_obj].select_set(False)
    
                else:
                    bpy.context.collection.all_objects[del_obj].select_set(True)
                    bpy.data.objects.remove(bpy.data.objects[del_obj])
    
        if (coat3D.bring_retopo or coat3D.bring_retopo_path):
            if(os.path.isfile(coat3D.bring_retopo_path)):
                bpy.ops.import_scene.fbx(filepath=coat3D.bring_retopo_path, global_scale=1, axis_forward='X', use_custom_normals=False)
                os.remove(coat3D.bring_retopo_path)
    
        kokeilu = coat3D.exchangeFolder[:-9]
    
        Blender_folder2 = ("%s%sExchange" % (kokeilu, os.sep))
        Blender_folder2 += ('%sexport.txt' % (os.sep))
    
        if (os.path.isfile(Blender_folder2)):
            os.remove(Blender_folder2)
    
    def blender_3DC(texturelist, new_applink_address):
    
        bpy.ops.object.select_all(action='DESELECT')
        for old_obj in bpy.context.collection.objects:
            old_obj.coat3D.applink_old = True
    
        coat3D = bpy.context.scene.coat3D
    
        Blender_folder = ("%s%sBlender"%(coat3D.exchangeFolder,os.sep))
    
        Blender_export = Blender_folder
    
        path3b_now = coat3D.exchangeFolder + os.sep
    
        path3b_now += ('last_saved_3b_file.txt')
        Blender_export += ('%sexport.txt'%(os.sep))
        mat_list = []
        osoite_3b = ''
        if (os.path.isfile(path3b_now)):
            path3b_fil = open(path3b_now)
            for lin in path3b_fil:
                osoite_3b = lin
            path3b_fil.close()
            head, tail = os.path.split(osoite_3b)
            just_3b_name = tail
            os.remove(path3b_now)
    
        create_collection = True
        for collection in bpy.data.collections:
            if collection.name == 'Applink_Objects':
                create_collection = False
    
        if create_collection:
            bpy.data.collections.new('Applink_Objects')
    
        coll_items = bpy.context.scene.collection.children.items()
    
        add_applink_collection = True
        for coll in coll_items:
            if coll[0] == 'Applink_Objects':
                add_applink_collection = False
    
        if add_applink_collection:
            bpy.context.scene.collection.children.link(bpy.data.collections['Applink_Objects'])
    
        bpy.context.view_layer.active_layer_collection = bpy.context.view_layer.layer_collection.children['Applink_Objects']
    
        old_materials = bpy.data.materials.keys()
        old_objects = bpy.data.objects.keys()
    
        bpy.ops.import_scene.fbx(filepath=new_applink_address, global_scale = 1, axis_forward='-Z', axis_up='Y')
    
        new_materials = bpy.data.materials.keys()
        new_objects = bpy.data.objects.keys()
    
        diff_mat = [i for i in new_materials if i not in old_materials]
        diff_objects = [i for i in new_objects if i not in old_objects]
    
    
        for mark_mesh in diff_mat:
            bpy.data.materials[mark_mesh].coat3D.name = '3DC'
            bpy.data.materials[mark_mesh].use_fake_user = True
        laskuri = 0
        index = 0
    
        facture_object = False
    
        for c_index in diff_objects:
            bpy.data.objects[c_index].data.coat3D.name = '3DC'
            laskuri += 1
            if(laskuri == 2 and c_index == ('vt_' + diff_objects[0])):
                facture_object = True
                print('Facture object founded!!')
    
        #bpy.ops.object.transforms_to_deltas(mode='SCALE')
        bpy.ops.object.select_all(action='DESELECT')
        for new_obj in bpy.context.collection.objects:
    
            if(new_obj.coat3D.applink_old == False):
                new_obj.select_set(True)
                new_obj.coat3D.applink_firsttime = False
                new_obj.select_set(False)
                new_obj.coat3D.type = 'ppp'
                new_obj.coat3D.applink_address = new_applink_address
                new_obj.coat3D.applink_mesh = True
                new_obj.coat3D.objecttime = str(os.path.getmtime(new_obj.coat3D.applink_address))
    
                new_obj.coat3D.applink_name = new_obj.name
                index = index + 1
    
                bpy.context.view_layer.objects.active = new_obj
    
                new_obj.coat3D.applink_export = True
    
                if (os.path.isfile(osoite_3b)):
                    mesh_time = os.path.getmtime(new_obj.coat3D.applink_address)
                    b_time = os.path.getmtime(osoite_3b)
                    if (abs(mesh_time-b_time) < 240):
                        new_obj.coat3D.applink_3b_path = osoite_3b
                        new_obj.coat3D.applink_3b_just_name = just_3b_name
    
                mat_list.append(new_obj.material_slots[0].material)
                is_new = True
    
                if(facture_object):
                    texVR.matlab(new_obj, mat_list, texturelist, is_new)
    
                    new_obj.scale = (0.01, 0.01, 0.01)
    
                else:
                    tex.matlab(new_obj, mat_list, texturelist, is_new)
    
                mat_list.pop()
    
        for new_obj in bpy.context.collection.objects:
            if(new_obj.coat3D.applink_old == False):
                new_obj.coat3D.applink_old = True
    
    
        kokeilu = coat3D.exchangeFolder[:-10]
    
        Blender_folder2 = ("%s%sExchange%sBlender" % (kokeilu, os.sep, os.sep))
        Blender_folder2 += ('%sexport.txt' % (os.sep))
    
        if (os.path.isfile(Blender_export)):
            os.remove(Blender_export)
        if (os.path.isfile(Blender_folder2)):
            os.remove(Blender_folder2)
    
        for material in bpy.data.materials:
            if material.use_nodes == True:
                for node in material.node_tree.nodes:
                    if (node.name).startswith('3DC'):
                        node.location = node.location
    
    
    def workflow1(ExportFolder):
    
        coat3D = bpy.context.scene.coat3D
    
        texturelist = make_texture_list(ExportFolder)
    
        for texturepath in texturelist:
            for image in bpy.data.images:
                if(image.filepath == texturepath[3] and image.users == 0):
                    bpy.data.images.remove(image)
    
        path3b_now = coat3D.exchangeFolder
    
        path3b_now += ('last_saved_3b_file.txt')
        new_applink_address = 'False'
        new_object = False
        new_ref_object = False
    
    
        exportfile3 = coat3D.exchangeFolder
    
        exportfile3 += ('%sexport.txt' % (os.sep))
    
        if(os.path.isfile(exportfile3)):
    
            obj_pathh = open(exportfile3)
    
            for line in obj_pathh:
                new_applink_address = line
                break
            obj_pathh.close()
            for scene_objects in bpy.context.collection.all_objects:
                if(scene_objects.type == 'MESH'):
                    if(scene_objects.coat3D.applink_address == new_applink_address and scene_objects.coat3D.type == 'ref'):
                        scene_objects.coat3D.type == ''
                        new_ref_object = True
                        nimi = scene_objects.name
    
    
        exportfile = coat3D.exchangeFolder
    
        exportfile += ('%sBlender' % (os.sep))
        exportfile += ('%sexport.txt' % (os.sep))
        if (os.path.isfile(exportfile)):
            os.remove(exportfile)
    
        if(new_ref_object):
    
            new_ref_function(new_applink_address, nimi)
    
            blender_3DC_blender(texturelist, new_applink_address)
    
        coat3D = bpy.context.scene.coat3D
    
        texturelist = make_texture_list(BlenderFolder)
    
        for texturepath in texturelist:
            for image in bpy.data.images:
                if(image.filepath == texturepath[3] and image.users == 0):
                    bpy.data.images.remove(image)
    
    
        kokeilu = coat3D.exchangeFolder
    
    
        Blender_export = os.path.join(kokeilu, 'Blender')
    
        path3b_now = coat3D.exchangeFolder
    
        path3b_now += ('last_saved_3b_file.txt')
        Blender_export += ('%sexport.txt'%(os.sep))
        new_applink_address = 'False'
        new_object = False
        new_ref_object = False
    
        if(os.path.isfile(Blender_export)):
            obj_pathh = open(Blender_export)
            new_object = True
            for line in obj_pathh:
                new_applink_address = line
                break
            obj_pathh.close()
    
            for scene_objects in bpy.context.collection.all_objects:
                if(scene_objects.type == 'MESH'):
                    if(scene_objects.coat3D.applink_address == new_applink_address):
                        new_object = False
    
    
        exportfile = coat3D.exchangeFolder
    
        exportfile += ('%sBlender' % (os.sep))
        exportfile += ('%sexport.txt' % (os.sep))
        if (os.path.isfile(exportfile)):
            os.remove(exportfile)
    
        if(new_ref_object):
    
            new_ref_function(new_applink_address, nimi)
    
        else:
    
            blender_3DC(texturelist, new_applink_address)
    
    from bpy import *
    from mathutils import Vector, Matrix
    
    
    class SCENE_PT_Main(bpy.types.Panel):
    
        bl_space_type = "VIEW_3D"
    
        bl_category = '3D-Coat'
    
        @classmethod
        def poll(cls, context):
            if bpy.context.mode == 'OBJECT':
                return True
            else:
                return False
    
    
        def draw(self, context):
            layout = self.layout
            coat3D = bpy.context.scene.coat3D
    
            global foundExchangeFolder
    
    
            if(foundExchangeFolder == False):
    
                row = layout.row()
    
                row.label(text="Applink didn't find your 3d-Coat/Exchange folder.")
    
                row = layout.row()
    
                row.label(text="Please select it before using Applink.")
    
                row = layout.row()
    
                row.prop(coat3D,"exchangeFolder",text="")
    
                row = layout.row()
                row.operator("update_exchange_folder.pilgway_3d_coat", text="Apply folder")
    
            else:
                #Here you add your GUI
                row = layout.row()
                row.prop(coat3D,"type",text = "")
    
    Kalle-Samuli Riihikoski's avatar
    Kalle-Samuli Riihikoski committed
                flow = layout.grid_flow(row_major=True, columns=0, even_columns=False, even_rows=False, align=True)
    
    
                row = layout.row()
    
                row.operator("export_applink.pilgway_3d_coat", text="Send")
                row.operator("getback.pilgway_3d_coat", text="GetBack")
    
    class ObjectButtonsPanel():
        bl_space_type = 'PROPERTIES'
        bl_region_type = 'WINDOW'
        bl_context = "object"
    
    class SCENE_PT_Settings(ObjectButtonsPanel,bpy.types.Panel):
        bl_label = "3D-Coat Applink Settings"
        bl_space_type = "PROPERTIES"
        bl_region_type = "WINDOW"
        bl_context = "scene"
    
        def draw(self, context):
            pass
    
    
    class MaterialButtonsPanel():
        bl_space_type = 'PROPERTIES'
        bl_region_type = 'WINDOW'
        bl_context = "material"
    
    class SCENE_PT_Material(MaterialButtonsPanel,bpy.types.Panel):
        bl_label = "3D-Coat Applink"
        bl_space_type = "PROPERTIES"
        bl_region_type = "WINDOW"
        bl_context = "material"
    
        def draw(self, context):
            pass
    
    class SCENE_PT_Material_Import(MaterialButtonsPanel, bpy.types.Panel):
        bl_label = "Import Textures:"
        bl_parent_id = "SCENE_PT_Material"
        COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH'}
    
        def draw(self, context):
            layout = self.layout
            layout.use_property_split = False
            coat3D = bpy.context.active_object.active_material
    
            layout.active = True
    
            flow = layout.grid_flow(row_major=True, columns=0, even_columns=False, even_rows=False, align=True)
    
            col = flow.column()
            col.prop(coat3D, "coat3D_diffuse", text="Diffuse")
    
            col.prop(coat3D, "coat3D_metalness", text="Metalness")
    
            col.prop(coat3D, "coat3D_roughness", text="Roughness")
            col.prop(coat3D, "coat3D_ao", text="AO")
            col = flow.column()
            col.prop(coat3D, "coat3D_normal", text="NormalMap")
            col.prop(coat3D, "coat3D_displacement", text="Displacement")
            col.prop(coat3D, "coat3D_emissive", text="Emissive")
    
            col.prop(coat3D, "coat3D_alpha", text="Alpha")
    
    class SCENE_PT_Settings_Update(ObjectButtonsPanel, bpy.types.Panel):
        bl_label = "Update"
        bl_parent_id = "SCENE_PT_Settings"
    
        COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH'}
    
    
        def draw(self, context):
            layout = self.layout
            layout.use_property_split = False
            coat3D = bpy.context.scene.coat3D
    
            layout.active = True
    
            flow = layout.grid_flow(row_major=True, columns=0, even_columns=False, even_rows=False, align=True)
    
            col = flow.column()
    
            col.prop(coat3D, "importmesh", text="Update Mesh/UV")
    
            col = flow.column()
            col.prop(coat3D, "createnodes", text="Create Extra Nodes")
            col = flow.column()
            col.prop(coat3D, "importtextures", text="Update Textures")
            col = flow.column()
    
            col.prop(coat3D, "exportmod", text="Export with modifiers")
    
    class SCENE_PT_Bake_Settings(ObjectButtonsPanel, bpy.types.Panel):
        bl_label = "Bake"
        bl_parent_id = "SCENE_PT_Settings"
        COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH'}
    
        def draw(self, context):
            layout = self.layout
            layout.use_property_split = False
            coat3D = bpy.context.scene.coat3D
    
            layout.active = True
    
            flow = layout.grid_flow(row_major=True, columns=0, even_columns=False, even_rows=False, align=True)
    
            col = flow.column()
            col.prop(coat3D, "bake_resolution", text="Resolution")
            col = flow.column()
            col.prop(coat3D, "bake_diffuse", text="Diffuse")
            col = flow.column()
            col.prop(coat3D, "bake_ao", text="AO")
            col = flow.column()
    
            col.prop(coat3D, "bake_normal", text="Normal")
    
            col = flow.column()
            col.prop(coat3D, "bake_roughness", text="Roughness")
    
    
    class SCENE_PT_Settings_Folders(ObjectButtonsPanel, bpy.types.Panel):
        bl_label = "Folders"
        bl_parent_id = "SCENE_PT_Settings"
    
        COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH'}
    
    
        def draw(self, context):
            layout = self.layout
    
            layout.use_property_split = False
    
            coat3D = bpy.context.scene.coat3D
    
            layout.active = True
    
            flow = layout.grid_flow(row_major=True, columns=0, even_columns=False, even_rows=False, align=True)
    
            col = flow.column()
    
            col.prop(coat3D, "exchangeFolder", text="Exchange folder")
    
            col.operator("save_new_export.pilgway_3d_coat", text="Save new Exchange folder")
    
            col = flow.column()
            col.prop(coat3D, "defaultfolder", text="Object/Texture folder")
    
    
            col = flow.column()
            col.prop(coat3D, "folder_size", text="Max count in Applink folder")
    
    
    class SCENE_PT_Settings_DeleteNodes(ObjectButtonsPanel, bpy.types.Panel):
        bl_label = "Delete 3DC nodes from selected..."
        bl_parent_id = "SCENE_PT_Settings"
        COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH'}
    
        def draw(self, context):
            layout = self.layout
            layout.use_property_split = False
            coat3D = bpy.context.scene.coat3D
    
            layout.active = True
    
            flow = layout.grid_flow(row_major=True, columns=0, even_columns=False, even_rows=False, align=True)
    
            col = flow.column()
            col.operator("delete_material_nodes.pilgway_3d_coat", text="Material")
    
            col.operator("delete_object_nodes.pilgway_3d_coat", text="Object(s)")
    
            col = flow.column()
            col.operator("delete_collection_nodes.pilgway_3d_coat", text="Collection")
    
            col.operator("delete_scene_nodes.pilgway_3d_coat", text="Scene")
    
            col = flow.column()
            col.prop(coat3D, "delete_images", text="Delete nodes images")
    
    
    # 3D-Coat Dynamic Menu
    class VIEW3D_MT_Coat_Dynamic_Menu(bpy.types.Menu):
        bl_label = "3D-Coat Applink Menu"
    
        def draw(self, context):
            layout = self.layout
    
            layout.operator_context = 'INVOKE_REGION_WIN'
    
            ob = context
            if ob.mode == 'OBJECT':
                if(len(context.selected_objects) > 0):
    
                    layout.operator("import_applink.pilgway_3d_coat",
                                    text="Update Scene")
    
                    layout.separator()
    
    
                    layout.operator("export_applink.pilgway_3d_coat",
    
                    layout.separator()
    
                    if(context.selected_objects[0].coat3D.applink_3b_path != ''):
    
                        layout.operator("open_3dcoat.pilgway_3d_coat",
    
                                        text="Open " +context.selected_objects[0].coat3D.applink_3b_just_name)
    
                        layout.separator()
    
                else:
    
                    layout.operator("import_applink.pilgway_3d_coat",
                                    text="Update Scene")
    
                    layout.separator()
    
    
                if (len(context.selected_objects) > 0):
                    layout.operator("delete_material_nodes.pilgway_3d_coat",
                                    text="Delete 3D-Coat nodes from active material")
    
                    layout.operator("delete_object_nodes.pilgway_3d_coat",
    
                                    text="Delete 3D-Coat nodes from selected objects")
    
                layout.operator("delete_collection_nodes.pilgway_3d_coat",
    
                                text="Delete 3D-Coat nodes from active collection")
    
    
                layout.operator("delete_scene_nodes.pilgway_3d_coat",
    
                                text="Delete all 3D-Coat nodes")
                layout.separator()
    
    
    
    class ObjectCoat3D(PropertyGroup):
    
        obj_mat: StringProperty(
            name="Object_Path",
            default=''
        )
    
        applink_address: StringProperty(
            name="Object_Applink_address"
        )
    
        applink_index: StringProperty(
            name="Object_Applink_address"
        )
    
        applink_3b_path: StringProperty(
            name="Object_3B_Path"
        )
    
        applink_name: StringProperty(
            name="Applink object name"
        )
    
        applink_3b_just_name: StringProperty(
            name="Applink object name"
        )
    
        applink_firsttime: BoolProperty(
            name="FirstTime",
            description="FirstTime",
            default=True
        )
    
        retopo: BoolProperty(
            name="Retopo object",
            description="Retopo object",
            default=False
        )
    
        delete_proxy_mesh: BoolProperty(
            name="FirstTime",
            description="FirstTime",
            default=False
        )
        applink_onlyone: BoolProperty(
            name="FirstTime",
            description="FirstTime",
            default=False
        )
    
        type: StringProperty(
            name="type",
            description="shows type",
            default=''
        )
    
        import_mesh: BoolProperty(
            name="ImportMesh",
            description="ImportMesh",
            default=False
        )
    
        applink_mesh: BoolProperty(
            name="ImportMesh",
            description="ImportMesh",
            default=False
        )
    
        applink_old: BoolProperty(
            name="OldObject",
            description="Old Object",
            default=False
        )
    
        applink_export: BoolProperty(
            name="FirstTime",
            description="Object is from 3d-ocat",
            default=False
        )
        objecttime: StringProperty(
            name="ObjectTime",
            subtype="FILE_PATH"
        )
        path3b: StringProperty(
            name="3B Path",
            subtype="FILE_PATH"
    
    Campbell Barton's avatar
    Campbell Barton committed
        )
    
        dime: FloatVectorProperty(
            name="dime",
            description="Dimension"
        )
    
        applink_scale: FloatVectorProperty(
            name="Scale",
            description="Scale"
        )
    
    
    class SceneCoat3D(PropertyGroup):
        defaultfolder: StringProperty(
            name="FilePath",
            subtype="DIR_PATH",
        )
    
        deleteMode: StringProperty(
            name="FilePath",
            subtype="DIR_PATH",
            default=''
        )
    
        coat3D_exe: StringProperty(
            name="FilePath",
    
        exchangeFolder: StringProperty(
    
            name="FilePath",
            subtype="DIR_PATH"
        )
    
        bring_retopo: BoolProperty(
            name="Import window",
            description="Allows to skip import dialog",
            default=False
        )
    
        foundExchangeFolder: BoolProperty(
            name="found Exchange Folder",
    
            description="found Exchange folder",
    
        delete_images: BoolProperty(
            name="Import window",
            description="Allows to skip import dialog",
            default=True
        )
    
        bring_retopo_path: StringProperty(
            name="FilePath",
            subtype="DIR_PATH",
        )
    
        remove_path: BoolProperty(
            name="Import window",
            description="Allows to skip import dialog",
            default=False
        )
    
        exchange_found: BoolProperty(
            name="Exchange Found",
            description="Alert if Exchange folder is not found",
            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
        )
        importtextures: BoolProperty(
            name="Bring Textures",
            description="Import Textures",
            default=True
        )
    
        createnodes: BoolProperty(
            name="Bring Textures",
            description="Import Textures",
            default=True
        )
    
        importlevel: BoolProperty(
            name="Multires. Level",
            description="Bring Specific Multires Level",
            default=False
        )
        importmesh: BoolProperty(
            name="Mesh",
            description="Import Mesh",
    
        )
    
        # copy location
    
        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", ""),
    
                   ("update", "Update mesh/uvs", ""),
    
        bake_resolution: EnumProperty(
            name="Bake Resolution",
    
            description="Bake resolution",
    
            items=(("res_64", "64 x 64", ""),
                   ("res_128", "128 x 128", ""),
                   ("res_256", "256 x 256", ""),
                   ("res_512", "512 x 512", ""),
                   ("res_1024", "1024 x 1024", ""),
                   ("res_2048", "2048 x 2048", ""),
                   ("res_4096", "4096 x 4096", ""),
                   ("res_8192", "8192 x 8192", ""),
                   ),
            default="res_1024"
        )
    
        folder_size: EnumProperty(
            name="Applink folder size",
    
            description="Applink folder size",
    
            items=(("10", "10", ""),
                   ("100", "100", ""),
                   ("500", "500", ""),
                   ("1000", "1000", ""),
                   ("5000", "5000", ""),
                   ("10000", "10000", ""),
                   ),
            default="500"
        )
    
        bake_textures: BoolProperty(
            name="Bake all textures",
            description="Add Modifiers and export",
            default=False
        )
        bake_diffuse: BoolProperty(
            name="Bake diffuse texture",
            description="Add Modifiers and export",
            default=False
        )
        bake_ao: BoolProperty(
            name="Bake AO texture",
            description="Add Modifiers and export",
            default=False
        )
        bake_roughness: BoolProperty(
            name="Bake roughness texture",
            description="Add Modifiers and export",
            default=False
        )
    
            name="Bake metalness texture",
            description="Add Modifiers and export",
            default=False
        )
        bake_emissive: BoolProperty(
            name="Bake emissive texture",
            description="Add Modifiers and export",
            default=False
        )
        bake_normal: BoolProperty(
            name="Bake normal texture",
            description="Add Modifiers and export",
            default=False
        )
        bake_displacement: BoolProperty(
            name="Bake displacement",
            description="Add Modifiers and export",
            default=False
        )
    
    
    Kalle-Samuli Riihikoski's avatar
    Kalle-Samuli Riihikoski committed
    class MeshCoat3D(PropertyGroup):
        applink_address: StringProperty(
            name="ApplinkAddress",
    
    Kalle-Samuli Riihikoski's avatar
    Kalle-Samuli Riihikoski committed
        )
    
    class MaterialCoat3D(PropertyGroup):
    
    haikalle's avatar
    haikalle committed
            default=''
    
        )
        bring_diffuse: BoolProperty(
            name="Import diffuse texture",
            description="Import diffuse texture",
            default=True
        )
        bring_metalness: BoolProperty(
            name="Import diffuse texture",
            description="Import diffuse texture",
    
    haikalle's avatar
    haikalle committed
            default=True
    
        )
        bring_roughness: BoolProperty(
            name="Import diffuse texture",
            description="Import diffuse texture",
            default=True
        )
        bring_normal: BoolProperty(
            name="Import diffuse texture",
            description="Import diffuse texture",
            default=True
        )
        bring_displacement: BoolProperty(
            name="Import diffuse texture",
            description="Import diffuse texture",
            default=True
        )
        bring_emissive: BoolProperty(
            name="Import diffuse texture",
            description="Import diffuse texture",
            default=True
    
        bring_gloss: BoolProperty(
            name="Import diffuse texture",
            description="Import diffuse texture",
            default=True
        )
    
        SCENE_PT_Settings_Update,
    
        SCENE_PT_Bake_Settings,
    
        SCENE_PT_Settings_Folders,
    
        SCENE_OT_opencoat,
    
        SCENE_OT_getback,
    
        SCENE_OT_delete_material_nodes,
        SCENE_OT_delete_object_nodes,
        SCENE_OT_delete_collection_nodes,
        SCENE_OT_delete_scene_nodes,
    
        VIEW3D_MT_Coat_Dynamic_Menu,
    
        ObjectCoat3D,
        SceneCoat3D,
    
    Kalle-Samuli Riihikoski's avatar
    Kalle-Samuli Riihikoski committed
        MeshCoat3D,
    
    Campbell Barton's avatar
    Campbell Barton committed
        )
    
    Campbell Barton's avatar
    Campbell Barton committed
    
    
        bpy.types.Material.coat3D_diffuse = BoolProperty(
            name="Import diffuse texture",
            description="Import diffuse texture",
            default=True
        )
        bpy.types.Material.coat3D_roughness = BoolProperty(
            name="Import diffuse texture",
            description="Import diffuse texture",
            default=True
        )
    
        bpy.types.Material.coat3D_metalness = BoolProperty(
    
            name="Import diffuse texture",
            description="Import diffuse texture",
            default=True
        )
        bpy.types.Material.coat3D_normal = BoolProperty(
            name="Import diffuse texture",
            description="Import diffuse texture",
            default=True
        )
        bpy.types.Material.coat3D_displacement = BoolProperty(
            name="Import diffuse texture",
            description="Import diffuse texture",
            default=True
        )
        bpy.types.Material.coat3D_emissive = BoolProperty(
            name="Import diffuse texture",
            description="Import diffuse texture",
            default=True
        )
        bpy.types.Material.coat3D_ao = BoolProperty(
            name="Import diffuse texture",
            description="Import diffuse texture",
            default=True
        )
    
        bpy.types.Material.coat3D_alpha = BoolProperty(
            name="Import alpha texture",
            description="Import alpha texture",
            default=True
        )
    
        bpy.types.Material.coat3D_gloss = BoolProperty(
            name="Import alpha texture",
            description="Import alpha texture",
            default=True
        )
    
        from bpy.utils import register_class
        for cls in classes:
            register_class(cls)