Page 9 of 12

Re: [New Tool] Ogre MeshMagick - First official release

Posted: Thu May 28, 2009 11:51 pm
by haffax
Tonight I commited MeshMagick 0.6.

The Library-API is completely revamped. There now is a MeshMagick class which serves as a facade to the internals. You can get a tool from it via a getXxxTool() member function.
Details on how to use it can be found in the wiki: http://www.ogre3d.org/wiki/index.php/Me ... _a_library

I only have Windows available right now. I blindly changed build files for CMake, Code::Blocks and autotools too, but they are likely broken. If anyone on these platforms uses MeshMagick I gladly accept patches which will fix them.

@xabila, please try again with the new version. I didn't apply your patch because I chose to do most things differently. But your patch was very useful to see the bug regarding merging multiple meshes in succession with the MergeTool. This is now fixed, thanks.

Re: [New Tool] Ogre MeshMagick - First official release

Posted: Fri May 29, 2009 4:51 am
by syedhs
I think it would be a nice thing if MeshMagick can be statically linked to Ogre by default. Moving around the tool along with correct Ogremain.dll sometimes can be a hassle :)

Re: [New Tool] Ogre MeshMagick - First official release

Posted: Fri May 29, 2009 1:05 pm
by xabila
Ok, so on linux it's OK.

maybe you can add other tools such as optimise and rename on the MeshMagick class too

so gogo windows :(

Re: [New Tool] Ogre MeshMagick - First official release

Posted: Fri May 29, 2009 1:34 pm
by xabila
So now i have 2 link errors on windows ;) the both singleton ;)

simbad say here http://209.85.229.132/search?q=cache:DD ... =firefox-a, that it's a inlining problem, and we must override getSingleton on cpp.

So i did it
But i still get that *ùm^$ link error

Is there any option to stop the inline on visual

Code: Select all

MapEditorTreeView.obj : error LNK2001: symbole externe non résolu "protected: static class meshmagick::OgreEnvironment * Ogre::Singleton<class meshmagick::OgreEnvironment>::ms_Singleton" (?ms_Singleton@?$Singleton@VOgreEnvironment@meshmagick@@@Ogre@@1PAVOgreEnvironment@meshmagick@@A)
MapEditorTreeView.obj : error LNK2001: symbole externe non résolu "protected: static class meshmagick::MeshMagick * Ogre::Singleton<class meshmagick::MeshMagick>::ms_Singleton" (?ms_Singleton@?$Singleton@VMeshMagick@meshmagick@@@Ogre@@1PAVMeshMagick@meshmagick@@A)
..\Runtime\Debug\gose.exe : fatal error LNK1120: 2 externes non résolus

Re: [New Tool] Ogre MeshMagick - First official release

Posted: Fri May 29, 2009 1:54 pm
by jacmoe
Those errors are in your own project?

Re: [New Tool] Ogre MeshMagick - First official release

Posted: Fri May 29, 2009 2:09 pm
by haffax
xabila wrote:So now i have 2 link errors on windows ;) the both singleton ;)
Do you use the API as described in the MeshMagick wiki page and the API docs? Your old way doesn't work anymore. I made it much easier now.
I tested in Windows with a small test program and linking and using MeshMagick as a lib works.

Re: [New Tool] Ogre MeshMagick - First official release

Posted: Tue Sep 01, 2009 7:33 pm
by FlorianGeorge
First of all, thanks for this tool, it was able to remove/merge double vertices I couldn't remove with Blender.

Second, while the tool is successful at remapping the indexes of the triangles, it seems that it doesn't touch the target vertice indexes of Poses, which of course need attention as well after such an operation.

I added a little remapPoses method, see the attached zip. It currently only affects the optimise operation, but maybe the same method could be used for e.g. the merge operations.

Re: [New Tool] Ogre MeshMagick - First official release

Posted: Tue Sep 01, 2009 9:29 pm
by haffax
Thank you very much for this Flo81. :)
I am currently heavily involved in my day job (crunchtime :( ) so I cannot take a deeper look at it right now. Next week things should go on at a slower pace and I will review the patch.

Re: [New Tool] Ogre MeshMagick - First official release

Posted: Tue Sep 29, 2009 1:04 pm
by xabila
Just to inform you that i successfully add meshmagick on gose 1.2.
I can give you the diff if you want (just add some _MeshMagickExport and modify the Cmake files).

for gose : http://www.ogre3d.org/forums/viewtopic. ... 08&start=0

Re: [New Tool] Ogre MeshMagick - First official release

Posted: Thu Oct 01, 2009 10:40 pm
by KungFooMasta
Thanks for making the tool easier to use as a library! Few comments:

Changes need to be made to make the tool compatible with Ogre HEAD:
http://www.ogre3d.org/forums/viewtopic. ... cy#p322557

Mainly, "std::vector<String> ..." need to become "vector<String>::type ...". (Use Ogre vector)

Secondly, the wiki gives the following example:

Code: Select all

#include <MeshMagick.h>

using namespace meshmagick;

// Call this only after Ogre has been properly initialised.
void scaleMesh(MeshPtr mesh, Vector3 scale)
{
	MeshMagick mm;
	TransformTool* transformTool = mm.getTransformTool();
	transformTool->transform(mesh, Matrix4::getScale(scale), false);
}
Does this code write the mesh to file? Or we need to use 'invoke'? What does the transform API do?

Re: [New Tool] Ogre MeshMagick - First official release

Posted: Thu Oct 01, 2009 11:30 pm
by haffax
xabila wrote:Just to inform you that i successfully add meshmagick on gose 1.2.
I can give you the diff if you want (just add some _MeshMagickExport and modify the Cmake files).

for gose : http://www.ogre3d.org/forums/viewtopic. ... 08&start=0
Thank you for the notice. I gladly accept any patches, just post them here as attachment and I will look at it. If you needed to modify the source to make it work for you, I am all the more curious about the needed changes.


@KungFooMasta, right now meshmagick is compatible with Ogre 1.6, I will convert it too 1.7 when it is officially released, till then everyone is welcome to use your solution.
Does this code write the mesh to file? Or we need to use 'invoke'? What does the transform API do?
No, it will manipulate the Mesh in memory, to write it back you need to call MeshSerializer::exportMesh yourself.

Re: [New Tool] Ogre MeshMagick - First official release

Posted: Mon Oct 12, 2009 8:37 pm
by atorkhov
Few problems with build systems:
1. MmStatefulMeshSerializer.h and MmStatefulSkeletonSerializer.h are listed twice in include/Makefile.am
2. In configure.in version still stays 0.5.2
3. Cmake does not properly install libraries on 64-bit system - it installs them to /usr/lib instead of /usr/lib64

Re: [New Tool] Ogre MeshMagick - First official release

Posted: Wed Nov 25, 2009 6:55 am
by KungFooMasta
haffax,

I tried using MeshMagick as a library, to scale a mesh that also has a skeleton, however the resulting mesh is messed up when animating. In my case it is a spider, scaled by Vector3(3.0,3.0,3.0). When it animates the body parts fly around, probably because of the skeleton.

Here is my code:

Code: Select all

		using namespace meshmagick;

		MeshMagick mm(Ogre::LogManager::getSingleton().getDefaultLog());
		TransformTool* transformTool = mm.getTransformTool();
		Ogre::MeshPtr meshPtr = mMesh->mEntity->getMesh();
		transformTool->transform(meshPtr,Ogre::Matrix4::getScale(mBase->_getDerivedScale()));

		Ogre::MeshSerializer ms;
		ms.exportMesh(meshPtr.getPointer(),"./MeshViewer/" + mMesh->getMeshName());

		if(meshPtr->hasSkeleton())
		{
			Ogre::SkeletonPtr skelPtr = meshPtr->getSkeleton();
			transformTool->transform(skelPtr, Ogre::Matrix4::getScale(mBase->_getDerivedScale()));

			Ogre::SkeletonSerializer ss;
			ss.exportSkeleton(skelPtr.getPointer(),"./MeshViewer/" + skelPtr->getName());
		}
In my MeshViewer app I scaled the base node by Vector3(3.0,3.0,3.0) and then tried to serialize the changes to disk.

Here is the model I used:
GiantSpider.zip
GiantSpiderBAD.zip

Any idea what the problem is?

Re: [New Tool] Ogre MeshMagick - First official release

Posted: Wed Nov 25, 2009 1:28 pm
by haffax
@atorkhov, sorry, I seem to have missed your posts. Usually I get an email when someone posts in this thread, either I missed it or it didn't get sent.
I don't have a working Linux system right now. So I will have to do the changes blindly.

@KungFooMasta, you are scaling the skeleton twice.
Signature of the transform function is, maybe a bit of a trap that there is a default parameter:

Code: Select all

void TransformTool::transform(Ogre::MeshPtr mesh, Ogre::Matrix4 transformation, bool followSkeleton = true);
So, does it work, when you leave out the skeleton scaling in your code?


Edit: Come to think of it, I didnt get an email notification for KungFooMasta's post either, even though notification is turned on. :?

Re: [New Tool] Ogre MeshMagick - First official release

Posted: Wed Nov 25, 2009 1:33 pm
by haffax
While we are at it: Blakharaz was kind enough to make MeshMagick compile with Ogre 1.7. It remains compatible with Ogre 1.6.

Re: [New Tool] Ogre MeshMagick - First official release

Posted: Wed Feb 10, 2010 3:45 pm
by Svenstaro
Getting this:
meshmagick: /tmp/src/ogre/OgreMain/src/OgreLodStrategyManager.cpp:45: static Ogre::LodStrategyManager& Ogre::LodStrategyManager::getSingleton(): Assertion `ms_Singleton' failed.
Aborted
for every meshmagick action, even -version.

I'm running Arch Linux x86_64 and Ogre 1.7 rc1. I compiled https://ogreaddons.svn.sourceforge.net/ ... meshmagick using this build process:

Code: Select all

mkdir -p build
cd build
cmake -DCMAKE_INSTALL_PREFIX=/usr ..
make
make DESTDIR=$pkgdir install
Ogre itself is working fine.

Help much appreciated.

Re: [New Tool] Ogre MeshMagick - First official release

Posted: Wed Feb 10, 2010 4:12 pm
by haffax
Very likely due to a recent change in Ogre one of the generated managers expects LodStrategyManager to be instantiated.
Will check this evening.

You can try to instantiate LodStrategyManager in OgreEnvironment class just like those other managers.

Re: [New Tool] Ogre MeshMagick - First official release

Posted: Wed Feb 10, 2010 9:19 pm
by haffax
Ok, fix for this problem is in SVN.
It was what I believed it to be. MeshMagick now also instantiates LodStrategyManager and it works.

Change isn't so recent actually but it doesn't matter for using MeshMagick as a lib and that's how I used it with Ogre 1.7 so far.
Building meshmagick in Windows is a bit of a hassle right now due to cmake makefiles and other changes. freetype has to be linked manually in static builds and Ogre cannot be built statically and dynamically at once anymore.

I will have to figure out a way to make building in windows as comfortable as it was with Ogre 1.6.

Re: [New Tool] Ogre MeshMagick - First official release

Posted: Wed Feb 10, 2010 9:32 pm
by Svenstaro
Ok thanks :)

I don't mind it being a bitch to build in Windows since I merely use AUR's meshmagick-svn package (which appears to be yours or your team's).

Re: [New Tool] Ogre MeshMagick - First official release

Posted: Sat Mar 06, 2010 12:21 am
by haffax
Effective from today MeshMagic is released under the MIT license, just like Ogre.
In other news, Sinbad contributed a new optimisation tool utilizing Tootle. It reorganises face ordering in order to minimize pixel overdraw. For details see this thread.

Re: Official MeshMagick thread - now licensed under MIT

Posted: Sat Mar 06, 2010 3:08 am
by jacmoe
That is awesome news, Haffax! :D

Re: Official MeshMagick thread - now licensed under MIT

Posted: Wed Mar 17, 2010 8:55 pm
by cyrfer
I just want to give a big 'thank you' for making MeshMagick. We had some animations in 3DS Max that were in the wrong orientation. I never could figure out how to change the orientation in Max without destroying the skeletal animation. I used the rotate transform tool (2 transform ops on one line, very cool) and I now have what I need. MeshMagick is a life saver when you can't get your regular tools to work the way you want.

Re: Official MeshMagick thread - now licensed under MIT

Posted: Tue Mar 23, 2010 2:22 am
by cyrfer
Hi,
Again, thanks for making this tool available.

I'm having a problem to rotate a character with skeletal animation. The character starts out seated on the floor (hind end touching floor, knees out in front, feet touching the floor). The animation is for the character to stand up. My export from Max is fine except for the orientation, meaning when the character stands, the feet consistently touch the floor. However, after using the rotate tool in MeshMagick to correct the character for my coordinate system, the pivot point seems to have changed and the feet go through the floor, as if the pelvis was used as the point of rotation.

How can I clamp the rotation so that the feet never go below a specific plane? Thanks!

Re: Official MeshMagick thread - now licensed under MIT

Posted: Tue Mar 23, 2010 10:28 pm
by haffax
Hi cryfer,

glad you found meshmagick helpful.
Regarding your problem: I don't know why this happens. Rotating a mesh/skeleton should not change the pivot. Rotation is always around the origin of the mesh's local coordinate system, its 0/0/0 position vector.

What orientation did you change, around what of its axes? Where is the meshes pivot supposed to be? In its center, between its feet or elsewhere?
What is the command line you used for rotation?

Re: Official MeshMagick thread - now licensed under MIT

Posted: Tue Mar 23, 2010 11:18 pm
by xadhoom
Hi haffax!

Quick comment to the OptionsParser in MeshMagick. Currently it seems that missing manadatory parameter are only recognised when the parameter is provided with an empty value on the command line (according to the condition structure in OptionsParser::parseOptions()). To get generally an exception in case of a missing mandatory parameter I added the following code snippet at the bottom for a final check (sorry no direct patch because its taken from a different project):

Code: Select all

      // now we need to check if all mandatory options are present
      OptionDefinitionSet::const_iterator it = optionDefs.begin();
      while(it != optionDefs.end())
      {
         OptionDefinition optionDef = *it++;
         if(optionDef.isMandatory && !isOptionSet(options, optionDef.name))
            throw std::logic_error("option " + optionDef.name + " expects a parameter");
      }
This leads to correct exceptions in case of any missing parameter on parsing level but considering default values implicitly (this makes the other exception check in this method redundant, too)...

xad