3D Coat Forums: Export/Import SDK - 3D Coat Forums

Jump to content

  • (2 Pages)
  • +
  • 1
  • 2
  • You cannot start a new topic
  • You cannot reply to this topic

Export/Import SDK First version of 3D-Coat SDK released!

#1 User is offline   Andrew Shpagin Icon

  • 3DC creator & admin
  • PipPipPip
  • Group: Root Admin
  • Posts: 5,063
  • Joined: 20-February 07
  • Gender:Male

Posted 13 May 2008 - 03:32 PM

Hi all! I have made 3D-Coat SDK v 1.0. It required at least 3D-Coat 2.10.09 (www.3d-coat.com/files/3d-Coat-2-10.09.exe) You can download it there:

www.3d-coat.com/files/3D-CoatSDK-210.zip

This is first version of 3D-Coat SDK. It allows to create plugins for export/import of different 3D-files. To start you should download and unpack 3DCoatSDK.zip . Then you shoud open soluton ExportImport.sln. It requires at least MS VisualStudio 2008 Standart Edition to be properly compiled. Compile project. It is better to use “Release” configuration. You will get Odj.DLL file on output. This simple plugin is a sample for importing OBJ files. Obj.DLL should be copied to

$3D-CoatInstallationFolder\Plugins\MeshCodecs\

To understand how plugins work open files cMeshObj.h. You will see there class that is derived from cMeshCodec (It is defined in cIO.h).

class cMeshCodec {
public:
cMeshCodec() {}
virtual ~cMeshCodec() {}
virtual cMeshContainer * Decode(const cData &Fm) = 0;
virtual void Encode(const cMeshContainer &Mesh, cData *To) = 0;
virtual bool CanEncode(){return true;}
virtual bool CanDecode(){return true;}
};

To create new codec you should derive your class from cMeshCodec and re-define functions Encode and Decode. Decode should return filled object cRawMesh and Encode should fill Data structure cData using cMeshContainer. You can look and discover objects cData and cMeshContainer. After redefining functions you should change class name in ExportImport.cpp. I think it is very easy. The only not so easy task is filling/reading structure cMeshContainer. It is mesh that consists of:

uv-sets (see GetUVSets() )
Matrials(surfaces) (see GetMaterials() )
Objects (see GetObjects() )
PositionVertices (see GetPositions() )
UV-vertices (see GetTexCoords() )
Normals (see GetNormals() )
Faces (see GetRaw() )

To understand how it works it is better to discover how cMeshObj.cpp encodes/decodes obj – files. I will explain slightly how Faces list is organised.
Faces are array of cVec3i – 3 integer values

Count, - amount of polygones in face
idMtl = MaterialIndex + (UV-set index<<16) – index of material and uv-set
idObj - index of object

Next “Count” values are 3-indices of vertices that are part of face

PositionIndex (index in array of position vertices)
TexturevertexIndex (index in array of texture vertices, can be -1)
NormalIndex (index in array of normals, can be -1)

The best method to learn is to ask in forum and discover how cMeshObj is done.

Good luck!
0

#2 User is offline   Numakichi Icon

  • Newbie
  • Pip
  • Group: Approved
  • Posts: 4
  • Joined: 30-April 08

Posted 25 May 2008 - 12:26 AM

It is wonderful information!
This topic was translated into Japanese :)

http://numa3d.seesaa...e/97876878.html
0

#3 User is offline   Andrew Shpagin Icon

  • 3DC creator & admin
  • PipPipPip
  • Group: Root Admin
  • Posts: 5,063
  • Joined: 20-February 07
  • Gender:Male

Posted 25 May 2008 - 05:53 AM

View PostNumakichi, on May 25 2008, 03:26 AM, said:

It is wonderful information!
This topic was translated into Japanese :)

http://numa3d.seesaa...e/97876878.html

Thank you! That is very cool!
0

#4 User is offline   David Walters Icon

  • Advanced Member
  • PipPipPip
  • Group: Approved
  • Posts: 178
  • Joined: 15-September 08

Posted 15 September 2008 - 05:53 PM

Hi, I tried really hard to get the SDK to work with v2.10.05 but I've failed :( . I get a crash in the example cMeshObj class because the original cData object passed to Decode is not filled with file data, it appears to be uninitialised memory (the file name is correct though).

To get this far I had to comment out the operator overrides in 'newmem.h' because calls to 3d-coat.lib require 3d-coat.exe, but now there's only 3d-coatDX & GL, so the DLL fails to load and if I rename 3d-coatDX -> 3d-coat.exe, the plug-in silently fails.

I've tried with Visual Studio 2005 and 2008 (professional) and also this problem happens on both XP and Vista.
Can you confirm whether the SDK is working at the moment? is it just me?
0

#5 User is offline   Andrew Shpagin Icon

  • 3DC creator & admin
  • PipPipPip
  • Group: Root Admin
  • Posts: 5,063
  • Joined: 20-February 07
  • Gender:Male

Posted 15 September 2008 - 06:15 PM

Oh, excuse, really it was not updated for 2.10. I will update it asap.
There was no users of SDK, so it was suspended. I will resume it.
Thanks for interest!
0

#6 User is offline   Andrew Shpagin Icon

  • 3DC creator & admin
  • PipPipPip
  • Group: Root Admin
  • Posts: 5,063
  • Joined: 20-February 07
  • Gender:Male

Posted 16 September 2008 - 10:38 AM

I have updated the link to SDK.

www.3d-coat.com/files/3D-CoatSDK-210.zip

Now it will work with 2.10. But... special 2.10 version is required. It will be distributed soon among users. You can download 2.10 that accepts plugins properly there:

www.3d-coat.com/files/3d-Coat-2-10.09.exe

*edit: I have changed links to more recent.
0

#7 User is offline   David Walters Icon

  • Advanced Member
  • PipPipPip
  • Group: Approved
  • Posts: 178
  • Joined: 15-September 08

Posted 16 September 2008 - 01:05 PM

View PostAndrew Shpagin, on Sep 16 2008, 11:38 AM, said:

I have updated the link to SDK.

www.3d-coat.com/files/3D-CoatSDK.zip

Now it will work with 2.10. But... special 2.10 version is required. It will be distributed soon among users. You can download 2.10 that accepts plugins properly there:

www.3d-coat.com/files/3d-Coat-2-10.08.exe


Great, thank you!
0

#8 User is offline   David Walters Icon

  • Advanced Member
  • PipPipPip
  • Group: Approved
  • Posts: 178
  • Joined: 15-September 08

Posted 16 September 2008 - 03:09 PM

I managed to get this version to work! However I needed to disable 'newmem.h' or the DLL tried to import '3d-Coat.exe' which doesn't exist. I also made Visual Studio 2005 project files if that's helpful? :)

Attached File  3D_CoatSDK_20080916.zip (194.28K)
Number of downloads: 275

Thanks for the rapid response in getting this SDK working again!
0

#9 User is offline   JamesH Icon

  • Member
  • PipPip
  • Group: Approved
  • Posts: 25
  • Joined: 03-September 08

Posted 22 September 2008 - 06:55 PM

When I add my plugin to the \Plugins\MeshCodecs folder and run 3D Coat, where exactly does the plugin information appear on the menus ?

Should cMeshIO::AddCodec() be called and displayed for my plugin in the log.txt file ?

Cheers.
0

#10 User is offline   Andrew Shpagin Icon

  • 3DC creator & admin
  • PipPipPip
  • Group: Root Admin
  • Posts: 5,063
  • Joined: 20-February 07
  • Gender:Male

Posted 23 September 2008 - 05:25 AM

View PostJamesH, on Sep 22 2008, 09:55 PM, said:

When I add my plugin to the \Plugins\MeshCodecs folder and run 3D Coat, where exactly does the plugin information appear on the menus ?

Should cMeshIO::AddCodec() be called and displayed for my plugin in the log.txt file ?

Cheers.

If you add your codec for export/import new extension appears in Import and export dialogs.

Also, if loading codec is successful, you will finnd

cMeshIO::AddCodec(): Added "your_extension" mesh codec.

in Log.txt

Also, David, thanks for correcting! But it seems sometimes removing "newmem" can cause memory errors. I will try to correct it finally soon.
0

#11 User is offline   JamesH Icon

  • Member
  • PipPip
  • Group: Approved
  • Posts: 25
  • Joined: 03-September 08

Posted 23 September 2008 - 06:23 AM

View PostAndrew Shpagin, on Sep 23 2008, 06:25 AM, said:

If you add your codec for export/import new extension appears in Import and export dialogs.

Also, if loading codec is successful, you will finnd

cMeshIO::AddCodec(): Added "your_extension" mesh codec.

in Log.txt


Thanks for the clarification. I compiled the Obj example that comes with the SDK and copied the Obj.dll into the respective location. When loading 3DC it complained that 3D-Coat.exe could not be found, so I renamed 3D-CoatGL.exe to 3D-Coat.exe. Is this correct ? If so, then my plugin is still not being loaded, has anyone got this working ?
0

#12 User is offline   Andrew Shpagin Icon

  • 3DC creator & admin
  • PipPipPip
  • Group: Root Admin
  • Posts: 5,063
  • Joined: 20-February 07
  • Gender:Male

Posted 23 September 2008 - 08:11 AM

View PostJamesH, on Sep 23 2008, 09:23 AM, said:

Thanks for the clarification. I compiled the Obj example that comes with the SDK and copied the Obj.dll into the respective location. When loading 3DC it complained that 3D-Coat.exe could not be found, so I renamed 3D-CoatGL.exe to 3D-Coat.exe. Is this correct ? If so, then my plugin is still not being loaded, has anyone got this working ?

If you will rename 3D-CoatGL or DX to 3D-Coat and rud 3D-Coat.exe it will work. It is one way to get it to work.
As David Walters mentioned, it tries to load 3D-Coat.exe . He has remade project to avoid this. But it can lead to some memory errors.
I will modify project to avoid all that problems.
0

#13 User is offline   Andrew Shpagin Icon

  • 3DC creator & admin
  • PipPipPip
  • Group: Root Admin
  • Posts: 5,063
  • Joined: 20-February 07
  • Gender:Male

Posted 23 September 2008 - 09:14 AM

Ok, I have corrected problem with 3D-Coat.exe. Now DLL is independent and will use allocation functions form 3D-CoatDX or GL in dependence what is run. To get it to work pease:
1) Download SDK at www.3d-coat.com/files/3D-CoatSDK-210.zip
2) Download newest version of 3D-Coat at www.3d-coat.com/files/3d-Coat-2-10.09.exe
0

#14 User is offline   David Walters Icon

  • Advanced Member
  • PipPipPip
  • Group: Approved
  • Posts: 178
  • Joined: 15-September 08

Posted 23 September 2008 - 09:16 AM

View PostJamesH, on Sep 23 2008, 07:23 AM, said:

If so, then my plugin is still not being loaded, has anyone got this working ?

Don't forget that 'obj' is already supported by 3d-Coat, so if you want to make sure it's your code being run then change the extension to something else, "tst" or something.

I've also been able to run the plug-in through the Visual Studio debugger, then you can set breakpoints on the various API functions and watch as 3DC calls your code, to do this simply ensure appropriate debugging information has been built into the DLL and set [Properties] > [Debugging] > [Command] to 3d-coatDX.exe (or GL, and don't forget to set the working directory too). Then just hit 'run' like a normal executable project and Visual Studio make it all just work :lol:

I'm not sure how best to solve the memory errors, I assumed something bad would happen on deallocation if I didn't use the custom allocator defined by newmem.h - but it's the closest I got to success - renaming the EXE didn't work for me, the DLL loaded and then unloaded immediately .. I don't know why.

Regards,
Dave
0

#15 User is offline   Andrew Shpagin Icon

  • 3DC creator & admin
  • PipPipPip
  • Group: Root Admin
  • Posts: 5,063
  • Joined: 20-February 07
  • Gender:Male

Posted 23 September 2008 - 09:25 AM

Now (in newest SDK) I am getting adrresses of allocation procedures dynamically - you can look at dllmain.cpp, I removed dependence on 3D-Coat.lib
0

#16 User is offline   JamesH Icon

  • Member
  • PipPip
  • Group: Approved
  • Posts: 25
  • Joined: 03-September 08

Posted 23 September 2008 - 10:32 AM

View PostAndrew Shpagin, on Sep 23 2008, 10:25 AM, said:

Now (in newest SDK) I am getting adrresses of allocation procedures dynamically - you can look at dllmain.cpp, I removed dependence on 3D-Coat.lib


Thanks Andrew, the new SDK and 3DC work great for me.

Cheers.
0

#17 User is offline   JamesH Icon

  • Member
  • PipPip
  • Group: Approved
  • Posts: 25
  • Joined: 03-September 08

Posted 25 September 2008 - 06:26 AM

View PostJamesH, on Sep 23 2008, 11:32 AM, said:

Thanks Andrew, the new SDK and 3DC work great for me.

Cheers.


Quick feature request, nothing urgent, but would it be possible at some point to add the ability to create extra check boxes in the Export dialog from the SDK ?
0

#18 User is offline   Huidafa Icon

  • Newbie
  • Pip
  • Group: Members
  • Posts: 3
  • Joined: 27-September 08
  • Gender:Male
  • Location:Las Vegas, Nevada
  • Interests:C4 Engine, casino gaming (slots, video poker, and table games), Collada, tools for world editing.

Posted 27 September 2008 - 04:42 PM

View PostJamesH, on Sep 24 2008, 11:26 PM, said:

Quick feature request, nothing urgent, but would it be possible at some point to add the ability to create extra check boxes in the Export dialog from the SDK ?


I second this request. If it were also possible to add text boxes that could access metadata stored with the 3DC file, we could make use of the asset elements in Collada, to track authorship, copyright, licensing, and version/revision numbers.

There's also a field in the asset tag to specify the authoring tool, which would help to promote the fact that a given model was made with 3DC, but just as importantly, will lead to the ability to automatically re-import models when they are changed in 3DC, since the Collada asset element can point at the original 3DC file, making it possible for a third-party tool to check when it has been modified.
0

#19 User is offline   fishbelt Icon

  • Member
  • PipPip
  • Group: Approved
  • Posts: 19
  • Joined: 02-June 07
  • Gender:Male
  • Location:usa indiana
  • Interests:Start working with 3d about 6 months ago. Glade to of found this site and hope I can learn to use it. Camping, photos, canoing, wood working and wood carve are some of my interest.

Post icon  Posted 20 January 2009 - 05:29 AM

[quote name='Andrew Shpagin' date='May 13 2008, 09:32 AM' post='4383']
Hi all! I have made 3D-Coat SDK v 1.0. It required at least 3D-Coat 2.10.09 (www.3d-coat.com/files/3d-Coat-2-10.09.exe) You can download it there:

www.3d-coat.com/files/3D-CoatSDK-210.zip

This is first version of 3D-Coat SDK. It allows to create plugins for export/import of different 3D-files. To start you should download and unpack 3DCoatSDK.zip . Then you shoud open soluton ExportImport.sln. It requires at least MS VisualStudio 2008 Standart Edition to be properly compiled. Compile project. It is better to use “Release” configuration. You will get Odj.DLL file on output. This simple plugin is a sample for importing OBJ files. Obj.DLL should be copied to

$3D-CoatInstallationFolder\Plugins\MeshCodecs\

To understand how plugins work open files cMeshObj.h. You will see there class that is derived from cMeshCodec (It is defined in cIO.h).

class cMeshCodec {
public:
cMeshCodec() {}
virtual ~cMeshCodec() {}
virtual cMeshContainer * Decode(const cData &Fm) = 0;
virtual void Encode(const cMeshContainer &Mesh, cData *To) = 0;
virtual bool CanEncode(){return true;}
virtual bool CanDecode(){return true;}
};

AAAAAaaaa it'sall greek to me. You guys are going to make me pull out what's left of this old farts hair.. Ecuse me while iI jump off the roof. LOL fishbelt
0

#20 User is offline   Steve C Icon

  • Member
  • PipPip
  • Group: Approved
  • Posts: 11
  • Joined: 25-February 09

Posted 28 June 2009 - 06:37 AM

Will there be a 3d coat SDK for v3?
0

  • (2 Pages)
  • +
  • 1
  • 2
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users