Freestyle: removed the dummy implementation of a texture manager.

Legacy texture shaders from the original stand-alone Freestyle program are also
declared as deprecated, in favor of Blender's new line style textures.

Patch contribution by Paolo Acampora.  Thanks!
This commit is contained in:
Tamito Kajiyama 2014-05-07 10:56:42 +09:00
parent 2e07109feb
commit a351ff7264
Notes: blender-bot 2024-05-02 21:33:31 +02:00
Referenced by issue #40560, Crash when subsurf applies
Referenced by issue #40082, Regression: Moving NLA strip causes bones to scale to 0, 0, 0
Referenced by issue #40056, Can't save file after saving externally
5 changed files with 3 additions and 245 deletions

View File

@ -38,8 +38,6 @@ set(SRC
intern/blender_interface/BlenderStrokeRenderer.cpp
intern/blender_interface/BlenderStrokeRenderer.h
intern/blender_interface/BlenderStyleModule.h
intern/blender_interface/BlenderTextureManager.cpp
intern/blender_interface/BlenderTextureManager.h
intern/blender_interface/FRS_freestyle.cpp
intern/geometry/BBox.h
intern/geometry/Bezier.cpp

View File

@ -23,7 +23,6 @@
*/
#include "BlenderStrokeRenderer.h"
#include "BlenderTextureManager.h"
#include "../application/AppConfig.h"
#include "../stroke/Canvas.h"
@ -61,10 +60,6 @@ BlenderStrokeRenderer::BlenderStrokeRenderer(Render *re, int render_count) : Str
{
freestyle_bmain = &re->freestyle_bmain;
// TEMPORARY - need a texture manager
_textureManager = new BlenderTextureManager;
_textureManager->load();
// for stroke mesh generation
_width = re->winx;
_height = re->winy;
@ -161,11 +156,6 @@ BlenderStrokeRenderer::~BlenderStrokeRenderer()
BKE_libblock_free(freestyle_bmain, ma);
}
if (0 != _textureManager) {
delete _textureManager;
_textureManager = NULL;
}
// The freestyle_scene object is not released here. Instead,
// the scene is released in free_all_freestyle_renders() in
// source/blender/render/intern/source/pipeline.c, after the

View File

@ -1,101 +0,0 @@
/*
* ***** BEGIN GPL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* ***** END GPL LICENSE BLOCK *****
*/
/** \file blender/freestyle/intern/blender_interface/BlenderTextureManager.cpp
* \ingroup freestyle
*/
#include "BlenderTextureManager.h"
#include "BKE_global.h"
namespace Freestyle {
BlenderTextureManager::BlenderTextureManager()
: TextureManager()
{
//_brushes_path = Config::getInstance()...
}
BlenderTextureManager::~BlenderTextureManager()
{
}
void BlenderTextureManager::loadStandardBrushes()
{
#if 0
getBrushTextureIndex(TEXTURES_DIR "/brushes/charcoalAlpha.bmp", Stroke::HUMID_MEDIUM);
getBrushTextureIndex(TEXTURES_DIR "/brushes/washbrushAlpha.bmp", Stroke::HUMID_MEDIUM);
getBrushTextureIndex(TEXTURES_DIR "/brushes/oil.bmp", Stroke::HUMID_MEDIUM);
getBrushTextureIndex(TEXTURES_DIR "/brushes/oilnoblend.bmp", Stroke::HUMID_MEDIUM);
getBrushTextureIndex(TEXTURES_DIR "/brushes/charcoalAlpha.bmp", Stroke::DRY_MEDIUM);
getBrushTextureIndex(TEXTURES_DIR "/brushes/washbrushAlpha.bmp", Stroke::DRY_MEDIUM);
getBrushTextureIndex(TEXTURES_DIR "/brushes/opaqueDryBrushAlpha.bmp", Stroke::OPAQUE_MEDIUM);
getBrushTextureIndex(TEXTURES_DIR "/brushes/opaqueBrushAlpha.bmp", Stroke::OPAQUE_MEDIUM);
_defaultTextureId = getBrushTextureIndex("smoothAlpha.bmp", Stroke::OPAQUE_MEDIUM);
#endif
}
unsigned int BlenderTextureManager::loadBrush(string sname, Stroke::MediumType mediumType)
{
#if 0
GLuint texId;
glGenTextures(1, &texId);
bool found = false;
vector<string> pathnames;
string path; //soc
StringUtils::getPathName(TextureManager::Options::getBrushesPath(), sname, pathnames);
for (vector<string>::const_iterator j = pathnames.begin(); j != pathnames.end(); j++) {
path = j->c_str();
//soc if (QFile::exists(path)) {
if (BLI_exists( const_cast<char *>(path.c_str()))) {
found = true;
break;
}
}
if (!found)
return 0;
// Brush texture
if (G.debug & G_DEBUG_FREESTYLE) {
cout << "Loading brush texture..." << endl;
}
switch (mediumType) {
case Stroke::DRY_MEDIUM:
//soc prepareTextureLuminance((const char*)path.toAscii(), texId);
prepareTextureLuminance(path, texId);
break;
case Stroke::HUMID_MEDIUM:
case Stroke::OPAQUE_MEDIUM:
default:
//soc prepareTextureAlpha((const char*)path.toAscii(), texId);
prepareTextureAlpha(path, texId);
break;
}
if (G.debug & G_DEBUG_FREESTYLE) {
cout << "Done." << endl << endl;
}
return texId;
#else
return 0;
#endif
}
} /* namespace Freestyle */

View File

@ -1,55 +0,0 @@
/*
* ***** BEGIN GPL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BLENDERTEXTUREMANAGER_H__
#define __BLENDERTEXTUREMANAGER_H__
/** \file blender/freestyle/intern/blender_interface/BlenderTextureManager.h
* \ingroup freestyle
*/
# include "../stroke/StrokeRenderer.h"
# include "../stroke/StrokeRep.h"
# include "../system/FreestyleConfig.h"
namespace Freestyle {
/*! Class to load textures */
class BlenderTextureManager : public TextureManager
{
public:
BlenderTextureManager();
virtual ~BlenderTextureManager();
protected:
virtual unsigned int loadBrush(string fileName, Stroke::MediumType=Stroke::OPAQUE_MEDIUM);
protected:
virtual void loadStandardBrushes();
#ifdef WITH_CXX_GUARDEDALLOC
MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:BlenderTextureManager")
#endif
};
} /* namespace Freestyle */
#endif // __BLENDERTEXTUREMANAGER_H__

View File

@ -460,90 +460,16 @@ int StrokeTextureStepShader::shade(Stroke& stroke) const
return 0;
}
// Legacy shaders from freestyle standalone texture system
int TextureAssignerShader::shade(Stroke& stroke) const
{
#if 0
getBrushTextureIndex(TEXTURES_DIR "/brushes/charcoalAlpha.bmp", Stroke::HUMID_MEDIUM);
getBrushTextureIndex(TEXTURES_DIR "/brushes/washbrushAlpha.bmp", Stroke::HUMID_MEDIUM);
getBrushTextureIndex(TEXTURES_DIR "/brushes/oil.bmp", Stroke::HUMID_MEDIUM);
getBrushTextureIndex(TEXTURES_DIR "/brushes/oilnoblend.bmp", Stroke::HUMID_MEDIUM);
getBrushTextureIndex(TEXTURES_DIR "/brushes/charcoalAlpha.bmp", Stroke::DRY_MEDIUM);
getBrushTextureIndex(TEXTURES_DIR "/brushes/washbrushAlpha.bmp", Stroke::DRY_MEDIUM);
getBrushTextureIndex(TEXTURES_DIR "/brushes/opaqueDryBrushAlpha.bmp", Stroke::OPAQUE_MEDIUM);
getBrushTextureIndex(TEXTURES_DIR "/brushes/opaqueBrushAlpha.bmp", Stroke::OPAQUE_MEDIUM);
#endif
TextureManager *instance = TextureManager::getInstance();
if (!instance)
return 0;
string pathname;
Stroke::MediumType mediumType;
bool hasTips = false;
switch (_textureId) {
case 0:
//pathname = TextureManager::Options::getBrushesPath() + "/charcoalAlpha.bmp";
pathname = "/charcoalAlpha.bmp";
mediumType = Stroke::HUMID_MEDIUM;
hasTips = false;
break;
case 1:
pathname = "/washbrushAlpha.bmp";
mediumType = Stroke::HUMID_MEDIUM;
hasTips = true;
break;
case 2:
pathname = "/oil.bmp";
mediumType = Stroke::HUMID_MEDIUM;
hasTips = true;
break;
case 3:
pathname = "/oilnoblend.bmp";
mediumType = Stroke::HUMID_MEDIUM;
hasTips = true;
break;
case 4:
pathname = "/charcoalAlpha.bmp";
mediumType = Stroke::DRY_MEDIUM;
hasTips = false;
break;
case 5:
mediumType = Stroke::DRY_MEDIUM;
hasTips = true;
break;
case 6:
pathname = "/opaqueDryBrushAlpha.bmp";
mediumType = Stroke::OPAQUE_MEDIUM;
hasTips = true;
break;
case 7:
pathname = "/opaqueBrushAlpha.bmp";
mediumType = Stroke::OPAQUE_MEDIUM;
hasTips = true;
break;
default:
pathname = "/smoothAlpha.bmp";
mediumType = Stroke::OPAQUE_MEDIUM;
hasTips = false;
break;
}
unsigned int texId = instance->getBrushTextureIndex(pathname, mediumType);
stroke.setMediumType(mediumType);
stroke.setTips(hasTips);
stroke.setTextureId(texId);
cout << "TextureAssignerShader is not supported in blender, please use the BlenderTextureShader" << endl;
return 0;
}
// FIXME
int StrokeTextureShader::shade(Stroke& stroke) const
{
TextureManager *instance = TextureManager::getInstance();
if (!instance)
return 0;
string pathname = TextureManager::Options::getBrushesPath() + "/" + _texturePath;
unsigned int texId = instance->getBrushTextureIndex(pathname, _mediumType);
stroke.setMediumType(_mediumType);
stroke.setTips(_tips);
stroke.setTextureId(texId);
cout << "StrokeTextureShader is not supported in blender, please use the BlenderTextureShader" << endl;
return 0;
}