Asset Pipeline v2 #145
@ -1,12 +1,14 @@
|
|||||||
import bpy
|
import bpy
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
from .prefs import get_addon_prefs
|
||||||
|
|
||||||
|
|
||||||
def save_images():
|
def save_images():
|
||||||
# TODO Make customizable
|
prefs = get_addon_prefs()
|
||||||
save_path = Path(bpy.data.filepath).parent.joinpath("images")
|
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:
|
for img in bpy.data.images:
|
||||||
if img.is_dirty:
|
if img.is_dirty:
|
||||||
filepath = save_path.joinpath(img.name).__str__()
|
filepath = save_path.joinpath(img.name).__str__() + ".png"
|
||||||
img.filepath = filepath
|
|
||||||
img.save(filepath=filepath)
|
img.save(filepath=filepath)
|
||||||
|
@ -16,8 +16,16 @@ class ASSET_PIPELINE_addon_preferences(bpy.types.AddonPreferences):
|
|||||||
subtype="DIR_PATH",
|
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):
|
def draw(self, context):
|
||||||
self.layout.prop(self, "custom_task_layers_dir")
|
self.layout.prop(self, "custom_task_layers_dir")
|
||||||
|
self.layout.prop(self, "save_images_path")
|
||||||
|
|
||||||
|
|
||||||
classes = (ASSET_PIPELINE_addon_preferences,)
|
classes = (ASSET_PIPELINE_addon_preferences,)
|
||||||
|
Loading…
Reference in New Issue
Block a user