[Solved][Ogre 2.1] PbsMaterials.material Compiler error

Discussion area about developing with Ogre-Next (2.1, 2.2 and beyond)


Post Reply
Jay974
Gnoblar
Posts: 5
Joined: Mon Oct 29, 2012 4:07 pm

[Solved][Ogre 2.1] PbsMaterials.material Compiler error

Post by Jay974 »

Hello,

I'm trying to reproduce sample "sample_PbsMaterials" and i have there follow line in my log :

Code: Select all

22:34:57: Compiler error: invalid parameters in PbsMaterials.material(3): pbs is not a valid hlms type
22:34:57: Compiler error: invalid parameters in PbsMaterials.material(56): pbs is not a valid hlms type
22:34:57: Compiler error: invalid parameters in PbsMaterials.material(67): pbs is not a valid hlms type
...
22:44:35: Can't assign material Marbre because this Material does not exist. Have you forgotten to define it in a .material script?
My code

Code: Select all

Ogre::Item *item = mSceneMgr->createItem("cube.mesh", Ogre::ResourceGroupManager::AUTODETECT_RESOURCE_GROUP_NAME, Ogre::SCENE_DYNAMIC)
Ogre::SceneNode *sceneNode = mSceneMgr->getRootSceneNode(Ogre::SCENE_DYNAMIC)->createChildSceneNode(Ogre::SCENE_DYNAMIC);
	sceneNode->attachObject(item);
	sceneNode->setPosition(200, 0, 0);
	item->setMaterialName("Marbre");
Thank for your help :)
Attachments
Sans titre.png
Last edited by Jay974 on Sat Jun 10, 2017 5:21 pm, edited 1 time in total.
xrgo
OGRE Expert User
OGRE Expert User
Posts: 1148
Joined: Sat Jul 06, 2013 10:59 pm
Location: Chile
x 168

Re: [Ogre 2.1] PbsMaterials.material Compiler error

Post by xrgo »

might be because the material file is not in the resource manager scope, try adding it by doing:

Code: Select all

    Ogre::ResourceGroupManager::getSingleton().addResourceLocation("./theFolder/Where/is/TheFile/","FileSystem");
    Ogre::ResourceGroupManager::getSingleton().initialiseAllResourceGroups();
or make sure its in the resources cfg file and that you are actually loading it
Jay974
Gnoblar
Posts: 5
Joined: Mon Oct 29, 2012 4:07 pm

Re: [Ogre 2.1] PbsMaterials.material Compiler error

Post by Jay974 »

Thanks xrgo.

yes, i'm sure its in the resources cfg file and that i'm loading it

Code: Select all

Ogre::ConfigFile mConfigFile;
	mConfigFile.load(".\\Setting\\resources.cfg");

	Ogre::ConfigFile::SectionIterator seci = mConfigFile.getSectionIterator();

	Ogre::String secName, typeName, archName;

	while (seci.hasMoreElements())
	{
		secName = seci.peekNextKey();
		Ogre::ConfigFile::SettingsMultiMap *settings = seci.getNext();
		Ogre::ConfigFile::SettingsMultiMap::iterator i;
		for (i = settings->begin(); i != settings->end(); ++i)
		{
			typeName = i->first;
			archName = i->second;
			Ogre::ResourceGroupManager::getSingleton().addResourceLocation(archName, typeName, secName);
		}
	}	
	Ogre::TextureManager::getSingleton().setDefaultNumMipmaps(5);
	Ogre::ResourceGroupManager::getSingleton().addResourceLocation("./data", "FileSystem");
	Ogre::ResourceGroupManager::getSingleton().initialiseAllResourceGroups();
resources.cfg

Code: Select all

[General]
FileSystem=./Data
I have the same log :

Code: Select all

09:21:24: Parsing script PbsMaterials.material
09:21:24: Compiler error: invalid parameters in PbsMaterials.material(3): pbs is not a valid hlms type
09:21:24: Compiler error: invalid parameters in PbsMaterials.material(56): pbs is not a valid hlms type
09:21:24: Compiler error: invalid parameters in PbsMaterials.material(67): pbs is not a valid hlms type
User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 5298
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1279
Contact:

Re: [Ogre 2.1] PbsMaterials.material Compiler error

Post by dark_sylinc »

Sounds like you didn't register the Hlms before initializing the resources groups.

Take a look at GraphicsSystem::registerHlms; and see it's getting called right before initialiseAllResourceGroups.
Jay974
Gnoblar
Posts: 5
Joined: Mon Oct 29, 2012 4:07 pm

Re: [Ogre 2.1] PbsMaterials.material Compiler error

Post by Jay974 »

Its working :D

Thank dark_ssylinc
Post Reply