2019-06-08 23:42:50 +00:00
|
|
|
import bpy
|
|
|
|
import bmesh
|
|
|
|
import operator
|
|
|
|
import math
|
|
|
|
import os
|
|
|
|
|
|
|
|
from bpy.props import *
|
|
|
|
from . import settings
|
|
|
|
from . import utilities_bake
|
|
|
|
|
|
|
|
|
|
|
|
class op(bpy.types.Operator):
|
2019-12-18 20:53:16 +00:00
|
|
|
bl_idname = "uv.textools_texture_remove"
|
|
|
|
bl_label = "Remove Texture"
|
|
|
|
bl_description = "Remove the texture"
|
|
|
|
bl_options = {'REGISTER', 'UNDO'}
|
2019-06-08 23:42:50 +00:00
|
|
|
|
2019-12-18 20:53:16 +00:00
|
|
|
name : bpy.props.StringProperty(
|
|
|
|
name="image name",
|
|
|
|
default = ""
|
|
|
|
)
|
2019-06-08 23:42:50 +00:00
|
|
|
|
2019-12-18 20:53:16 +00:00
|
|
|
@classmethod
|
|
|
|
def poll(cls, context):
|
|
|
|
return True
|
|
|
|
|
|
|
|
def execute(self, context):
|
|
|
|
remove_texture(self.name)
|
|
|
|
return {'FINISHED'}
|
2019-06-08 23:42:50 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def remove_texture(name):
|
2019-12-18 20:53:16 +00:00
|
|
|
print("Save image.. "+name)
|
2019-06-08 23:42:50 +00:00
|
|
|
|
|
|
|
|
2019-12-18 20:53:16 +00:00
|
|
|
if name in bpy.data.images:
|
|
|
|
bpy.data.images.remove( bpy.data.images[name] )
|
2019-06-08 23:42:50 +00:00
|
|
|
|
|
|
|
|
|
|
|
bpy.utils.register_class(op)
|