Baum3D als Plugin (Testphase)



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 18/02/2008 at 14:54, xxxxxxxx wrote:

    User Information:
    Cinema 4D Version:   9.1 
    Platform:   Windows  ;   
    Language(s) :     C++  ;

    ---------
    Hallo,

    bin gerade dabei, mein Baum3D-Programm (siehe http://www.kbuechner.gmxhome.de) in ein C++-Plugin umzufriemeln.
    Ist ganz schön knifflig, sich mit Visual-C anzufreunden und bei den Beispielen irgendwie durchzublicken. Danke an Jack für seine Tipps.
    Vorteil ist u.A., dass ich es auch für Mac-User kompilieren kann.

    Vielleicht will das mal jemand testen (Vorsicht mit den Rekursionen)

    Dazu bitte folgende Dateien ins C4D-Plugins-Verzeichnis entpacken:

    http://www.kbuechner.gmxhome.de/Baum_Plugin.zip

    Also meine Fragen:
    Die Blätter gehören jetzt zum Baumobjekt und können nicht extra texturiert werden.
    - Wie generiere ich ein zweites Objekt (Blätter) ?
    - Wie bekomme ich ein Drag-and-Drop-Feld hin, wo der User irgendein Blatt-Polygon-Objekt reinziehen kann (kann auch ein Apfel sein), das ich dann im C-Programm verwende?

    Gruß,
    Klaus



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 18/02/2008 at 15:40, xxxxxxxx wrote:

    Hi Klaus,

    welcome to the Café ;-)

    First of all: You will get much more answers if you post your questions in English here.

    Concerning your questions:

    1. How to generate a second object (leaves, apples)
    You simply have to create more (polygon) objects in the virtual hierarchy. Just like you did with the first one, the tree object.

    2. How to create a link field in the Attribute Manager
    You can create every kind of data in the .res file. Read the section "description resource" in the SDK documentation. You can also assign units to the input fields you already have, e.g. to define the tree height in meters.
    After making a link field, you can access the linked object and copy its geometry.

    Cheers,
    Jack



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 19/02/2008 at 01:45, xxxxxxxx wrote:

    Thank you,

    here in english again:
    I try to change my Baum3D-program (look http://www.kbuechner.gmxhome.de) to a C++-Plugin.
    It is heavy for me to understand it, but it makes fun.
    Later I can compile it also for Mac-User.

    If you like, you can test it (be carefully with number of recursions)

    Please decompress followed files to your C4D-Plugins-directory:

    http://www.kbuechner.gmxhome.de/Baum_Plugin.zip

    My questions (the first an second answered by Jack soon) :
    - how I can generate a second object to texture it separatly(leafs)?
    - how can I create a drag-and-drop-field,the user can take any leaf-polygon-object (my also be an apple), and how can I use it in my program?

    new question:
    - how can I fit the start-view to the size of the tree, to see the whole tree?

    thanks,
    Klaus



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 19/02/2008 at 02:30, xxxxxxxx wrote:

    - how can I fit the start-view to the size of the tree, to see the whole tree?

    CallCommand(12151L) will "Frame Active Objects". That means that you'll have to set the objects as selected.

    > // If you don't have the document already \> BaseDocument\* doc = GetActiveDocument(); \> // op is your BaseObject\* for the tree object \> doc->SetActiveObject(op, SELECTION_NEW); \> // If you need to include children, call this as well \> //(Select Children in Object Manager) : \> CallCommand(100004768L); \> // Frame Active Objects \> CallCommand(12151L);

    This is untested so verify its veracity.

    - how can I create a drag-and-drop-field,the user can take any leaf-polygon-object (my also be an apple), and how can I use it in my program?

    This will depend on if the field is in the Attributes Manager or a Dialog (they have different interfaces). For the Attributes Manager, you create a LINK description in the res file (or dynamically using GetDDescription() in the NodeData for the plugin). For a Dialog, you'll need to use a custom gui element:

    > // LinkBox \> BaseContainer     tbc; \> tbc.SetBool(LINKBOX_HIDE_ICON, FALSE); \> // this variable is stored in the dialog class for later \> copyLinkBox = (LinkBoxGui\* )AddCustomGui(IP_COPY_SOURCE,CUSTOMGUI_LINKBOX,String(),BFH_SCALEFIT|BFV_SCALEFIT,0L,0L,tbc); \> if (!copyLinkBox) return FALSE;

    You'll need to check Message() for drag-n-dop here:

    > // GeDialog.Message \> //\*---------------------------------------------------------------------------\* \> LONG IPPDialog::Message(const BaseContainer& msg, BaseContainer& result) \> //\*---------------------------------------------------------------------------\* \> { \>      //GePrint(BaseContainerToString(msg)); \>      LONG     mid =     msg.GetId(); \>      if          (mid == BFM_DRAGRECEIVE)     return Msg_DragReceive(msg, result); \>      else if (mid == BFM_GETCURSORINFO)     return Msg_GetCursorInfo(msg, result); \>      return GeDialog::Message(msg, result); \> } \> // IPPDialog.Msg_DragReceive - BFM_DRAGRECEIVE \> //\*---------------------------------------------------------------------------\* \> LONG IPPDialog::Msg_DragReceive(const BaseContainer& msg, BaseContainer& result) \> //\*---------------------------------------------------------------------------\* \> { \>      // Copy-Paste LinkBox \>      if (!CheckDropArea(IP_COPY_SOURCE, msg, TRUE, TRUE))     return GeDialog::Message(msg, result); \>      if (msg.GetLong(BFM_DRAG_LOST))                                   return GeDialog::Message(msg, result); \> \>      LONG          cursor =     MOUSE_POINT_HAND; \>      LONG          type =          0L; \>      void\*          object =     NULL; \>      BaseObject\*     op =          NULL; \> \>      GetDragObject(msg, &type;, &object;); \> \>      if ((type == DRAGTYPE_ATOMARRAY) && (((AtomArray\* )object)->GetCount() == 1L) && ((AtomArray\* )object)->GetIndex(0)) \>      { \>           op =     (BaseObject\* )((AtomArray\* )object)->GetIndex(0L); \>           if (op->IsInstanceOf(Obase) && (op->GetTag(ID_IPPFIGURETAG) || op->GetTag(ID_IPPOBJECTTAG)))     cursor = MOUSE_INSERTCOPY; \>           else \>           { \>                cursor = MOUSE_FORBIDDEN; \>                op = NULL; \>           } \>      } \> \>      if (msg.GetLong(BFM_DRAG_FINISHED)) \>      { \>           copyLinkBox->SetLink(op); \>           copySource =     op; \>           copyDoc =          op->GetDocument(); \>      } \> \>      return SetDragDestination(cursor); \> }



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 19/02/2008 at 06:20, xxxxxxxx wrote:

    thank you very much, I will try it.

    But the other problem:
    How can I create 2 objects.
    I have to return in GetVirtualObjects one Object.
    And the other ?

    Klaus from Berlin



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 19/02/2008 at 06:59, xxxxxxxx wrote:

    You can group the virtual object under a virtual Null object for instance. Check the Atom object example in the SDK.

    cheers,
    Matthias



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 20/02/2008 at 00:17, xxxxxxxx wrote:

    Thanks!!!!!!!!!!

    Klaus



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 20/02/2008 at 01:25, xxxxxxxx wrote:

    Help!!!!!

    I go crazy. What is wrong?
    I try to insert the tree and leafs under the Plugin, but it dont't work. Otherwise, if I convert it with 'c' to a polygon-object, it is right.

    // this is the source-code:
    BaseObject *CBaumPlugin::GetVirtualObjects(PluginObject *op, HierarchyHelp *hh)
    {
    BaseObject *ret = BaseObject::Alloc(Onull);

    BaseObject *botree = tree.op;//pointer to the tree
    BaseObject *boleafs = leaf.op;//pointer to the leafs
    botree->SetName("tree");
    boleafs->SetName("leafs");
    botree->InsertUnderLast(ret);
    boleafs->InsertUnderLast(ret);
    // also tryed with: ret->InsertUnderLast(botree);

    return ret;

    }

    what is wrong ?



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 20/02/2008 at 02:43, xxxxxxxx wrote:

    I don't know maybe something wrong with your tree.op/leaf.op pointers? I tried a simple example with a cube and a sphere inserted under a null and this works fine.

    > \> BaseObject \*AtomObject::GetVirtualObjects(PluginObject \*op, HierarchyHelp \*hh) \> { \>      // group all further objects with this null object \>      BaseObject \*main=NULL, \*cube=NULL, \*sphere=NULL; \> \>      main = BaseObject::Alloc(Onull); \>      if(!main) goto Error; \> \>      cube = BaseObject::Alloc(Ocube); \>      if(!cube) goto Error; \> \>      sphere = BaseObject::Alloc(Osphere); \>      if(!sphere) goto Error; \> \>      cube->SetPos(Vector(150,0,0)); \>      cube->InsertUnderLast(main); \> \>      sphere->SetPos(Vector(-150,0,0)); \>      sphere->InsertUnderLast(main); \> \>      return main; \> \> Error: \>      blDelete(main); \>      blDelete(cube); \>      blDelete(sphere); \>      return NULL; \> } \>

    cheers,
    Matthias



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 20/02/2008 at 08:42, xxxxxxxx wrote:

    thank you,

    exactly so i had made it.

    But I see in the C4D-object-manager only my Plugin without sub-items.

    But when I convert (with key 'c') ist, I see it.

    ???



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 20/02/2008 at 08:56, xxxxxxxx wrote:

    All the objects you create are virtual! They are NOT visible in the OM. If you want to create the polygon objects in the OM, you better use a GeDialog gui (See gui sdk examples) where the user can hit a button to create the objects in the OM, but then you loose interactivity of a c4d object.



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 20/02/2008 at 09:16, xxxxxxxx wrote:

    ooooooohhhh,

    here you can test it by pressing 'c'.

    http://www.kbuechner.gmxhome.de/Baum_Plugin.zip



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 20/02/2008 at 09:18, xxxxxxxx wrote:

    As Katachi notes, virtual objects are 'virtual' - they only exist for the purpose of the deformations/generations/rendering processes and nothing more. Beyond that, they *really* don't exist in the document and there are restrictions on what can be done with/to them (see the C++ SDK Documentation).



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 20/02/2008 at 11:15, xxxxxxxx wrote:

    thank you.

    I have an idea: I don't need two objects.
    To texture separately, it is enough to create two polygon-selections!
    But I don't now again, how I can make it :-(

    Klaus



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 22/02/2008 at 03:52, xxxxxxxx wrote:

    Hello,

    Plugin is almost ready.
    Thanks for help.

    Screenshot here:
    http://www.kbuechner.gmxhome.de/BaumPlugiScreen.jpg

    It is for C4D 9.1 but works likely in higher versions (now only Windows)

    Download here:
    http://www.kbuechner.gmxhome.de/Baum_Plugin.zip

    To make leafs, you must insert a polygon-object under the Plugin (make it unvisible for renderer).
    These texture-coordinaten were adopted.

    The you must give the plugin one tree- and one leaf-texture.
    Important: name the Selektion per texture "tree" and "leafs", these are hidden polygon-selektions.

    in future:
    - leaf-angle
    - gravitation
    - wind (you can simulate it now by animating "Biegung"(bend)
    - tree withot middle-twig
    - fitting the start-view to whole tree
    - dimension-frame
    - Mac-Version
    - ????
    - ????

    Klaus
    http://www.kbuechner.gmxhome.de



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 25/02/2008 at 06:29, xxxxxxxx wrote:

    Hello,

    something in the Baum-Plugin is new:

    - gravitation für tree and leafs
    - tree without middle-twig

    Screenshot here:
    http://www.kbuechner.gmxhome.de/BaumPlugiScreen.jpg

    download here:
    http://www.kbuechner.gmxhome.de/Baum_Plugin.zip

    Klaus



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 28/02/2008 at 13:58, xxxxxxxx wrote:

    Hello,

    here is a new version of my baum-plugin.

    Screenshot:
    http://www.kbuechner.gmxhome.de/BaumPluginScreen.jpg

    Download from my WebSite or directly:
    http://www.kbuechner.gmxhome.de/Baum_Plugin.zip

    In BaumPlugin_Manual.doc you can read how to use it.

    Please write me error-informations or suggestions.

    Thanks from Berlin,
    Klaus
    kbuechner@gmx.de



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 04/03/2008 at 04:03, xxxxxxxx wrote:

    Hello,

    new version of Baum-Plugin:

    rising tree (Divx5) :
    http://www.gfai.de/~buechner/Baum_Wachstum.avi

    Screenshots:
    http://www.kbuechner.gmxhome.de/BaumPluginScreen.jpg

    or here:
    http://www.gfai.de/~buechner/Apfelbaum.jpg

    Download:
    http://www.kbuechner.gmxhome.de/Baum_Plugin.zip

    Please read BaumPlugin_Manual.doc.

    Klaus
    http://www.kbuechner.gmxhome.de



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 09/03/2008 at 10:28, xxxxxxxx wrote:

    Hello,

    Now you have more parameters for leafs.
    Therefore you can also make something like fern.
    look here:
    http://www.gfai.de/~buechner/Baum_Wachstum.avi

    Screenshots:
    http://www.kbuechner.gmxhome.de/BaumPluginScreen.jpg
    http://www.gfai.de/~buechner/Apfelbaum.jpg

    Download:
    http://www.kbuechner.gmxhome.de/Baum_Plugin.zip

    Please copy Baum_Plugin-directory in your C4D-plugins-directory and read "BaumPlugin_Manual.doc"

    Thanks,
    Klaus
    http://www.kbuechner.gmxhome.de


Log in to reply