Asset Pipeline v2 #145
@ -1,12 +1,14 @@
|
||||
import bpy
|
||||
from pathlib import Path
|
||||
from .prefs import get_addon_prefs
|
||||
|
||||
|
||||
def save_images():
|
||||
# TODO Make customizable
|
||||
save_path = Path(bpy.data.filepath).parent.joinpath("images")
|
||||
prefs = get_addon_prefs()
|
||||
user_path = Path(prefs.save_images_path)
|
||||
default_path = Path(bpy.data.filepath).parent.joinpath("images")
|
||||
save_path = default_path if prefs.save_images_path == "" else user_path
|
||||
for img in bpy.data.images:
|
||||
if img.is_dirty:
|
||||
filepath = save_path.joinpath(img.name).__str__()
|
||||
img.filepath = filepath
|
||||
filepath = save_path.joinpath(img.name).__str__() + ".png"
|
||||
img.save(filepath=filepath)
|
||||
|
@ -16,8 +16,16 @@ class ASSET_PIPELINE_addon_preferences(bpy.types.AddonPreferences):
|
||||
subtype="DIR_PATH",
|
||||
)
|
||||
|
||||
save_images_path: bpy.props.StringProperty( # type: ignore
|
||||
name="Save Images Path",
|
||||
description="Path to save un-saved images to, if left blank images will save in a called 'images' folder relative to the asset",
|
||||
default="",
|
||||
subtype="DIR_PATH",
|
||||
)
|
||||
|
||||
def draw(self, context):
|
||||
self.layout.prop(self, "custom_task_layers_dir")
|
||||
self.layout.prop(self, "save_images_path")
|
||||
|
||||
|
||||
classes = (ASSET_PIPELINE_addon_preferences,)
|
||||
|
Loading…
Reference in New Issue
Block a user