Browse Source

LuxCore Film.php Image.php 优化

master
yuanjiajia 1 year ago
parent
commit
d685f5f270
  1. 36
      src/scene/render/Film.php
  2. 11
      src/scene/render/Image.php

36
src/scene/render/Film.php

@ -67,8 +67,13 @@ class Film extends BaseCfg
Base::__construct($config); Base::__construct($config);
} }
public function addImage(object $object, $outDir)
public function addImage(object $object, $outDir, $filename = null)
{ {
if($filename){
$object->filename = $filename;
}
$nowTime = date("Y-m-d_H:i:s");
$i = -1; $i = -1;
if($object->type == Image::TYPE_RGB_IMAGEPIPELINE){ if($object->type == Image::TYPE_RGB_IMAGEPIPELINE){
foreach($this->outputs as $value){ foreach($this->outputs as $value){
@ -77,24 +82,27 @@ class Film extends BaseCfg
$object->index = $i + 1; $object->index = $i + 1;
if ($object->effect != null){ if ($object->effect != null){
$this->imagepipelines[ sprintf("%03d",$object->index) ] = $object->effect; $this->imagepipelines[ sprintf("%03d",$object->index) ] = $object->effect;
$object->effect = null;
} }
$object->filename = "{$object->type}_{$object->index}.png";
if(!$object->filename){
$object->filename = "{$nowTime}_{$object->type}_{$object->index}";
}
$object->filename = $object->filename.".png";
}else{ }else{
if(!$object->filename){ if(!$object->filename){
if( in_array($object->type,Image::PNG ) ){
$object->filename = "{$object->type}.png";
}
else if ( in_array($object->type,Image::EXR) ){
$object->filename = "{$object->type}.exr";
}
else{
$object->filename = "{$object->type}.jpg";
}
$object->filename = "{$nowTime}_{$object->type}";
}
if( in_array($object->type,Image::PNG ) ){
$object->filename = $object->filename.".png";
}
else if ( in_array($object->type,Image::EXR) ){
$object->filename = $object->filename.".exr";
}
else{
$object->filename = $object->filename.".jpg";
} }
} }
$nowTime = date("Y-m-d_H:i:s");
$object->filename = "{$outDir}/{$nowTime}_{$object->filename}";
$object->filename = "{$outDir}/{$object->filename}";
$this->outputs[] = $object; $this->outputs[] = $object;
} }

11
src/scene/render/Image.php

@ -148,17 +148,6 @@ class Image extends BaseCfg
public function __construct($config = []) public function __construct($config = [])
{ {
Base::__construct($config); Base::__construct($config);
if(!$this->filename){
if( in_array($this->type,self::PNG ) ){
$this->filename = "{$this->type}.png";
}
else if ( in_array($this->type,self::EXR) ){
$this->filename = "{$this->type}.exr";
}
else{
$this->filename = "{$this->type}.jpg";
}
}
} }
} }

Loading…
Cancel
Save