PDA

View Full Version : C4D SDK plugin help ..


climber
02-27-2007, 09:31 PM
There was a plugin awhile back in V8, it still exists in the V9 and 10 sdk but needs to be complied, It is called liquid paint.... you could paint metaballs without splines etc..the longer you left your mouse tip in one place the larger the metaball.
I do not know a thing about plugin design or development , I am also on a mac. I have been told that all is needed is to compile it but..
Can anyone help ..a quick compile for me or what I need to do..software requirements etc

thanks

scott
http://zone3photo.com

Per-Anders
02-27-2007, 09:51 PM
You will need XCode which you should either have on the DEVtools disk of your OSX installer, preinstalled or you will need to download from Apple Developer Connection (it's free), then download the C++ SDK documentation from plugincafe and check it's "Migration to XCode" portion which contains a walkthrough of building projects in XCode from a fresh install. It's actually a three step process, opening the project file in xcode, a first time only change of the intermediate builds path in the preferences, and hitting the build button (you can ignore all the stuff in there about changing the project name and removing the files that you don't need from your own plugin, that's just if you're developing your own plugins rather than wanting to just compile the existing sdk).

climber
02-27-2007, 10:09 PM
Thank you very much for the info Per-Anders. Plenty of info to absorb! I checked the Xcode tools folder on my CD. I am going to DL the one from apple since it maybe more recent. Whats parts of the tool folder do I use..there is plenty inside? I just not sure where to start. For the Maxon SDK I will assume I should DL both the 9.6 and 10 version if I want to compile for both?
I may need to ask stupid newbie question since this is very foreign to me

PS..I just tried to use the original Xtools on my CD..wouldn't work..kept crashing..too old I think..the one on apples site is taking forever( 1 gig in size) to DL so I thought I would try..OH well

thank you

scott

climber
02-28-2007, 12:44 AM
well I tried..but I get many errors ..185 to be exact:) I would love to say I could do this but..can anyone compile this for me..the liquidtool.cpp file in the C4D 9.6 SDK
its in the source/tool folder

scott

Per-Anders
02-28-2007, 12:56 AM
Did you follow the instructions given in the SDK documentation? There shouldn't be any errors (just one warning about there not being a folder yet, do you want to make one sort of thing). Are you sure you loaded in the XCode project and not the Codewarrior one in the 9.6 SDK? The project is all there ready for you to grab and compile, you don't need to create a new project in XCode.

climber
02-28-2007, 01:28 AM
I obviously made a big mistake somewhere..I did finally get it to compile Ok with no errors but it seems to compile everything( unless that is what it should do) Since I am just trying to create the liquid-tool plugin I am still not sure if I did it correctly
this is what I got( 3 folders)

_api.build
cinema4dsdk.build
Debug
I don't see anything about the specific plugin that I want though and quite honestly I am not sure what to do with these folders..I tried placing them into the plugin folder but no plug shows( if it should)
I then double clicked teh specific file called liquidtool.cpp..and hit the build button. It goes through a long build process but again doesn't really create anything

Per-Anders
02-28-2007, 02:11 AM
No leave those files and folders be, the SDK compiles as a single project, none of the tools in the SDK are seperate plugins (you'd have to edit the main.cpp file to remove their registration calls as otherwise you'll get errors about missing files if you just remove them). The result of the compile is a cinema4dsdk.dylib file in the Cinema4DSDK folder, that is the plugin. You do not need to do anything else.

You shouldn't attempt to modify the project itself unless you know what you're doing as otherwise you will most probably end up screwing up the project and stopping it form compiling correctly. It's designed to compile from the off without any need to change anything (apart from the intermediate build paths in XCodes general preferences), you really shouldn't attempt to do anything other than just compile the project given your current level of understanding as you're just making your life a lot more difficult and complex than it needs to be (it really is very simple to compile provided you just follow the basic instructions, i.e. load project, set intermediate paths, build).

Now that you've been mesing a lot of things around you may find that you will need to delete all the SDK and intermediate build folders and reinstall them (possibly reinstalling C4D). Remember that the intermediate paths should not be in your plugin folder itself, but outside of the whole plugins folder somewhere (anywhere it's jsut temporary files, but it also contains things like intermediate builds of the dylibs that will interfere with your main plugin loading in correctly).

climber
02-28-2007, 02:23 AM
correct..I have a file called cinema4dsdk.dylib in the C4D SDK folder along with the files that always existed there..everything else( the 3 folders I mentioned) are outside that folder completely) just wasn't sure what they were. That can't be it though is it? since I still don't have the option that I did back in V8 of painting with metaballs

I appreciate your patience with all this Pre-Anders

scott

Per-Anders
02-28-2007, 02:39 AM
No, that's it. It's compiled and the tool is a part of the plugin. You will need to look for the tool under the Cinema4DSDK folder in your plugins menu, there you will find the Liquid Tool, which is the tool for painting metaballs. If the plugin hasn't loaded then it will mostly explain why in Cinema's Console (Windows->Console) displaying the list of errors.

Remember to leave the cinema4dSDK.dylib file in the cinema4dsdk folder as it will reference the res folder in there for it's resources (dialogs, icons etc).

climber
02-28-2007, 03:01 AM
not there..must have doen something wrong..I don't have any errors in the console either..The only thing in the cinema4d drop down in flashEX V2 and ASCII animation import
OH well..it was interesting..If anyone on a Mac has this and is willing to share I certainly would be thankful

scott

Per-Anders
02-28-2007, 03:51 AM
That's very odd, what computer are you running? (CoreDuo/Core2Duo/g5/g4)

It's possible that your machine is loading up the non UB version of 9.6 if you have a G4/G5, in which case it would look for Codewarrior built non UB libraries (Cinema4dSDK.XDL) rather than XCodes UB DYLIBs. You can try compiling and running the R10 SDK instead as it will force the issue, when you load R10 that is, apart from that the only solution would be to compile using codewarrior which would be difficult as it's no longer available.

You can test to see if the file is being loaded in by modifying the "main.cpp" file and adding in GePrint("it got this far!"); in the "Bool PluginStart(void)" routine after the various if(!Register.... lines then it will print out "it got this far!" in the console provided the plugin actually loads, and you can use that to work out roughly which line it's failing on, or even if the plugin is loading at all.

climber
02-28-2007, 01:16 PM
I am on a Quad G5. Since I didn't get any errors I would assume that all went OK but..Where exactly after..

Bool PluginStart(void)

should I paste that line ?

like this

Bool PluginStart(void)
{
GePrint("it got this far!");

I will keep trying..can I just use BBedit for this
thanks again

SUCCESS!..well kind of..I tried V10 and all went OK..plugins are all there...same steps as I did in V9.6 but again that version doesn't work so..I prefer to still work in V9 because of speed issues( it is still faster than 10 on my system and there are obvious plugin incompatibilities etc
The SDK of both 9 and 10 look the same but obviously something is different..visially can one check or look at something with BBedit to tell?

Fun little tool but does anyone know how to control the placement..it seems to place it outside a specific area..at least I have it working just have to figure out how to control where the globs are placed:)
scott

Per-Anders
03-02-2007, 02:59 AM
The placement is controlled by the mouse, in the MouseInput routine check the mouse polling loop and you will see the line:

cl->SetPos(bd->SW(Vector(mx,my,500.0)));

This sets the position of the object cl (a clone of an earlier allocated sphere) to the world coordinate (bd->SW is the basedraw or viewport call to convert a vector from screen space to world space) for the mouses current position and 500 units in front of the camera Vector(mx, my, 500.0). You can modify this however you want, however I would recommend at the very least reading through some of the SDK documentation on this stuff first, you would want to look up about BaseDraw, Vector and BaseObject classes.

climber
03-02-2007, 03:31 PM
well I tried to understand this but can't say that anything really made any sense. I changed the 500 value to both 800 and 10 and didn't notice anything different. The globs still place them selves perfectly outside a circle based on the position of the orange and green triangles..any hints. I actually enjoy trying to figure this out..just don't see my gooey brain getting anywhere:)

scott

Per-Anders
03-02-2007, 11:44 PM
I'm afraid I really don't understand what you mean. There are no orange or green handles, just a red triangle in the middle of the viewport, and you just click and drag and it draws a metaball surface where you click and drag in teh viewport (but 500 units in front of the camera). Do you have a screenshot to show what it is you mean?

climber
03-03-2007, 02:59 PM
I never mentioned handles..but triangles..but here is a couple screen shots. As you stated they seem to place the metaballs 500 units from the placement point or the center( world) Changing the values in the code you offered doesn't seem to change anything. I can work around this but it certainly would be helpful if I could control this better or for that matter have it so that the metaball could be placed on or snapped to polygon points( sorry I wish too much:)

Per-Anders
03-03-2007, 07:13 PM
The placement is 500 units from the camera not from the center of the world. Move the camera back and the next time you paint it will be further back with it. I'm not sure why changing the value there is having no change on the position of the metaballs for you, are you sure you're recompiling (building) the code after making a change?

If you want them to snap to surfaces then you must implement the code to get the distance of the surface point from the camera and put that in the z of the vector (where 500 currently is), for that you can use either the ViewportSelect class or the SelectionListCreate function (and the C4DObjectList), which both use opengl to speed up object picking, failing that you can use the GeRayCollider class which manually casts rays into the scene.

climber
03-04-2007, 02:17 PM
you are correct..I wasn't compiling it( fixed) I have it at 900 ..seems to give me the look( placement) I need ..and yes again moving the camera back changes the placement point but again moving the camera around in a static still scene that is already setup isn't a good thing:) so..
the other info about ( ViewportSelect class or the SelectionListCreate function (and the C4DObjectList),) etc..sorry beyound my ability but this sounds like it would be different for each scene correct?.since each scene would have a differnt value or distance from the camera each time. I think the optimum would be something similar to the extrude along spline(ESA)plugin..where when a point is selected and the plugin( liquid) selected the metaball would grow from that point in either an XYZ direction..again way beyond my ability to code but wishful thinking

I am still trying to figure out why V9.6+( compile) isn't working though

Per-Anders
03-04-2007, 02:56 PM
Your 9.6 is working, but your version of Cinema that is loading up is not the UB/XCode version, this means that dylibs will not load as plugins with it on your machine, you would have to compile with Codewarrior to create an .xdl library which would be able to load as a plugin, which unfortunately I believe is no longer available.

The classes I mentioned allow you to find a Z distance for any point in screen space regardless of the scene, however you can calculate a z based on the last point by getting the currently active object from the document, converting it's global position coordinate to screen space using the basedraw functions (Vector BaseDraw::WS(const Vector &position); ) and then using the z from that vector as your new z. It wont be very accurate because it will be based on the objects axis rather than any points in the object, but it will be close enough.

climber
03-04-2007, 03:26 PM
all your help is greatly appreciated..I am attempting to find a V of codewarrior so that I can compile the 9.6 V. I will attempt to figure the rest but most likley this will be as far as my brain will let me go:)

cheers

scott

Kuroyume0161
03-06-2007, 05:13 AM
Anything illegal about just passing this poor guy the pre-built SDK libs? I'm amazed that they don't come pre-built for those who just want the plugins but can't do the builds themselves. Let's face it, VC6, VS2005, and CodeWarrior are not free (and not inexpensive investments) just to build something like this...

;)

Per-Anders
03-06-2007, 06:08 AM
Nothing at all illegal about giving him the builds (though given he's posting here about making the build himself then he may have his reasons). I personally can't give anyone any pre XCode Mac SDK builds currently, however feel free to if you have the resources to do so.

Just a note that VC2005 Express is free from MSDN as is XCode from ADC and those are the current development tools of choice for the C4D SDK for plugin developers. The reasoning for not providing it fully compiled is probably that SDK mostly only contains examples of interest to developers, often replications of existing functionality, or tools that are only of value to coders (such as the memtest), adding them as a precompiled element would result in much more technical support, and probably some confusion amongst users (as a number of the examples are quite functionless except fro instance to show how to control dialogs, or even are only partially functioning, such as the liquid tool, which while cool is by no means a complete tool), as well as more documentation, they are effectively provided "as is" currently, while if they were part of the package as a build they would have to be given full support, so it's much easier to leave things as they are.

Kuroyume0161
03-06-2007, 06:39 AM
It is true that VC2005 Express is free - but no good for 64-bit. :)

I could indeed provide CW builds of the SDK plugin for any version from 8.2 onwards.

The purpose of the sdk examples is understood, but obviously these little 'treats' are useful to those not interested in development (consider the import/export examples as one area). Even if not included in the default install, the built plugin could easily be included on the CD for copying and use (?) if a user desired any of the functionality therein - with the obvious caveats aforementioned.

XCode is truly gratis, but it is a considerable download if the latest version isn't available on the disc - even I paused at such an endeavor. Most people are truly clueless about the entire process - it seems that climber is at least sufficient enough to get through it without too much consternation. But one must remember that we have been down these roads for very long times and often - the uninitiated can be downright boggled by this - even though the process to create the sdk example plugin is not very complex in itself.

Well, I'll keep my eyes on this thread and offer any assistance as needed - as I'm certain Per will! :)

Per-Anders
03-06-2007, 07:33 AM
I don't see any reason that you can't compile 64bit with VC++2005 Express, you do have to make sure you have the latest platform SDK, but you need that anyway in order to compile Cinema plugins.

http://msdn2.microsoft.com/en-us/library/9yb4317s(VS.80).aspx

The tools are free, and as I recall you can ask Microsoft or Apple to send you a free CD with the full installers on them for both. The SDK is meant for software developers, people who are interested in experimenting or maybe making their own plugins and tools, it's really an optional extra. It might be a good idea to have the compiled version on plugincafe though.

climber
03-06-2007, 01:12 PM
Although I have found this a very interesting project and I am at the wall of sorts regarding proper compliers for the 9.6 Version SDK..so I am more than happy to accept a compiled SDK for C4D 9.6. I have had offers for others on other forums as well but they are on a PC which has VC2005 Express for free..myself I am on a Mac which complicates things a little so Kuroyume0161 if you can offer a complied Mac SDK for C4D V9.6 I would be very greatful...and yes Xcode was a big one to DL:)

scott

Kuroyume0161
03-06-2007, 04:35 PM
I don't see any reason that you can't compile 64bit with VC++2005 Express, you do have to make sure you have the latest platform SDK, but you need that anyway in order to compile Cinema plugins.

http://msdn2.microsoft.com/en-us/library/9yb4317s(VS.80).aspx

The tools are free, and as I recall you can ask Microsoft or Apple to send you a free CD with the full installers on them for both. The SDK is meant for software developers, people who are interested in experimenting or maybe making their own plugins and tools, it's really an optional extra. It might be a good idea to have the compiled version on plugincafe though.

That's interesting. Last time I looked, it explicitly said that 64-bit was not possible with the Express edition - possibly a change of mind?

Kuroyume0161
03-06-2007, 05:07 PM
Although I have found this a very interesting project and I am at the wall of sorts regarding proper compliers for the 9.6 Version SDK..so I am more than happy to accept a compiled SDK for C4D 9.6. I have had offers for others on other forums as well but they are on a PC which has VC2005 Express for free..myself I am on a Mac which complicates things a little so Kuroyume0161 if you can offer a complied Mac SDK for C4D V9.6 I would be very greatful...and yes Xcode was a big one to DL:)

scott

Scott,

Here is the download link for the PPC (CodeWarrior) and UB (Xcode) 9.6 SDK example libs. Simply extract these from the zip archive into the Cinema4DSDK folder in the Cinema 4D R9.6 plugins folder.

http://www.kuroyumes-developmentzone.com/c4d/Cinema4Dsdk_R96.zip

Robert

climber
03-06-2007, 05:43 PM
Hi Robert

thank you very much for this..I appreciate it greatly. I now must be a ( beggers can't be choosers) person and ask a favour. I customized a few values in V10 that I would like in V9.6 if possible..here they are

radius from 5 to 1

BaseObject *cl=NULL,*null=NULL,*op=NULL;
Vector p=bd->SW(Vector(mx,my,500.0));
Real dx,dy,rad=1.0;
Bool newmeta=FALSE;

subdivide from 10 to 3

null = BaseObject::Alloc(Ometaball);
{
null->GetDataInstance()->SetReal(METABALLOBJECT_SUBEDITOR,3.0);
null->MakeTag(Tphong);

and

position from 500 to 900

cl->SetPos(bd->SW(Vector(mx,my,900.0)));
cl->InsertUnder(null);
DrawViews(DA_ONLY_ACTIVE_VIEW|DA_NO_THREAD|DA_NO_ANIMATION);


I hope I am not over asking..

scott

Kuroyume0161
03-06-2007, 08:50 PM
Scott,

Here is the download link for the modified PPC (CodeWarrior) and UB (Xcode) 9.6 SDK example libs. Simply extract these from the zip archive into the Cinema4DSDK folder in the Cinema 4D R9.6 plugins folder.

http://www.kuroyumes-developmentzon...ma4Dsdk_R96_Modified.zip (http://www.kuroyumes-developmentzone.com/c4d/Cinema4Dsdk_R96_Modified.zip)

Robert

climber
03-06-2007, 09:00 PM
Robert

thank you again for doing this for me..all works perfectly

cheers

scott

CGTalk Moderation
03-06-2007, 09:00 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.