forked from bartvdbraak/blender
Cleanup: don't unnecessarily use ustring in IES file parsing
This commit is contained in:
parent
d2195d9ef2
commit
7ae3aa7b63
@ -944,7 +944,7 @@ void LightManager::tag_update(Scene * /*scene*/)
|
||||
need_update = true;
|
||||
}
|
||||
|
||||
int LightManager::add_ies_from_file(ustring filename)
|
||||
int LightManager::add_ies_from_file(const string &filename)
|
||||
{
|
||||
string content;
|
||||
|
||||
@ -953,10 +953,10 @@ int LightManager::add_ies_from_file(ustring filename)
|
||||
content = "\n";
|
||||
}
|
||||
|
||||
return add_ies(ustring(content));
|
||||
return add_ies(content);
|
||||
}
|
||||
|
||||
int LightManager::add_ies(ustring content)
|
||||
int LightManager::add_ies(const string &content)
|
||||
{
|
||||
uint hash = hash_string(content.c_str());
|
||||
|
||||
|
@ -92,8 +92,8 @@ class LightManager {
|
||||
~LightManager();
|
||||
|
||||
/* IES texture management */
|
||||
int add_ies(ustring ies);
|
||||
int add_ies_from_file(ustring filename);
|
||||
int add_ies(const string &ies);
|
||||
int add_ies_from_file(const string &filename);
|
||||
void remove_ies(int slot);
|
||||
|
||||
void device_update(Device *device, DeviceScene *dscene, Scene *scene, Progress &progress);
|
||||
|
@ -1067,10 +1067,10 @@ void IESLightNode::get_slot()
|
||||
|
||||
if (slot == -1) {
|
||||
if (ies.empty()) {
|
||||
slot = light_manager->add_ies_from_file(filename);
|
||||
slot = light_manager->add_ies_from_file(filename.string());
|
||||
}
|
||||
else {
|
||||
slot = light_manager->add_ies(ies);
|
||||
slot = light_manager->add_ies(ies.string());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -14,6 +14,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include "util/util_foreach.h"
|
||||
#include "util/util_ies.h"
|
||||
#include "util/util_math.h"
|
||||
@ -28,7 +30,7 @@ CCL_NAMESPACE_BEGIN
|
||||
// issue.
|
||||
template class GuardedAllocator<char>;
|
||||
|
||||
bool IESFile::load(ustring ies)
|
||||
bool IESFile::load(const string &ies)
|
||||
{
|
||||
clear();
|
||||
if (!parse(ies) || !process()) {
|
||||
@ -76,7 +78,7 @@ class IESTextParser {
|
||||
vector<char> text;
|
||||
char *data;
|
||||
|
||||
IESTextParser(ustring str) : text(str.begin(), str.end())
|
||||
IESTextParser(const string &str) : text(str.begin(), str.end())
|
||||
{
|
||||
std::replace(text.begin(), text.end(), ',', ' ');
|
||||
data = strstr(&text[0], "\nTILT=");
|
||||
@ -116,7 +118,7 @@ class IESTextParser {
|
||||
}
|
||||
};
|
||||
|
||||
bool IESFile::parse(ustring ies)
|
||||
bool IESFile::parse(const string &ies)
|
||||
{
|
||||
if (ies.empty()) {
|
||||
return false;
|
||||
|
@ -17,7 +17,7 @@
|
||||
#ifndef __UTIL_IES_H__
|
||||
#define __UTIL_IES_H__
|
||||
|
||||
#include "util/util_param.h"
|
||||
#include "util/util_string.h"
|
||||
#include "util/util_vector.h"
|
||||
|
||||
CCL_NAMESPACE_BEGIN
|
||||
@ -32,11 +32,11 @@ class IESFile {
|
||||
int packed_size();
|
||||
void pack(float *data);
|
||||
|
||||
bool load(ustring ies);
|
||||
bool load(const string &ies);
|
||||
void clear();
|
||||
|
||||
protected:
|
||||
bool parse(ustring ies);
|
||||
bool parse(const string &ies);
|
||||
bool process();
|
||||
bool process_type_b();
|
||||
bool process_type_c();
|
||||
|
Loading…
Reference in New Issue
Block a user