|
|
@@ -53,14 +53,11 @@ def import_obj(fp):
|
|
|
|
|
|
def setup_scene():
|
|
|
print('> SETTING UP SCENE')
|
|
|
-
|
|
|
-
|
|
|
|
|
|
print('> texture:', TEXTURE)
|
|
|
for object in bpy.data.objects:
|
|
|
if object.name == 'Cube':
|
|
|
object.select = True
|
|
|
- # remove it
|
|
|
bpy.ops.object.delete()
|
|
|
|
|
|
new_items = import_obj(OBJ_FILE)
|
|
|
@@ -74,7 +71,8 @@ def setup_scene():
|
|
|
mat.use_nodes = True
|
|
|
texnode = mat.node_tree.nodes.new(type="ShaderNodeTexImage")
|
|
|
mat.node_tree.links.new(texnode.outputs['Color'], mat.node_tree.nodes['Diffuse BSDF'].inputs['Color'])
|
|
|
- texnode.image = bpy.data.images.load(TEXTURE)
|
|
|
+ if os.path.isfile(str(TEXTURE)):
|
|
|
+ texnode.image = bpy.data.images.load(TEXTURE)
|
|
|
|
|
|
for item in new_items:
|
|
|
if item.type == 'MESH':
|
|
|
@@ -116,10 +114,6 @@ def deselect():
|
|
|
|
|
|
def preview_texture(image):
|
|
|
print('> PREVIEW TEXTURE GENERATION', TEXTURE)
|
|
|
- img = bpy.data.images.load(image)
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
|
|
|
for area in bpy.data.screens['Default'].areas:
|
|
|
if area.type == 'VIEW_3D':
|
|
|
@@ -152,7 +146,6 @@ def export():
|
|
|
|
|
|
update_maya()
|
|
|
|
|
|
-
|
|
|
@persistent
|
|
|
def save_handler(dummy):
|
|
|
export()
|