Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    Using a BaseObject as Polygon

    SDK Help
    0
    6
    1.3k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H
      Helper
      last edited by

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

      On 21/11/2002 at 08:20, xxxxxxxx wrote:

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

      ---------
      How can I use a BaseObject as a PolygonObject? I am casting it to a Polygonobject and change for example a point (in position). That works fine when the object is a Polygonobject in Cinema 4D (and I can see the point moving in C4D). But when it is still a BaseObject (PrimitiveObject ie Sphere) in Cinema 4D it doesn´t work.
      So how can I use it as if it was a Polygonobject? It sure is just a simple thing, but I can´t make it anyway. 🙂
      Thanks

      1 Reply Last reply Reply Quote 0
      • H
        Helper
        last edited by

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

        On 21/11/2002 at 10:03, xxxxxxxx wrote:

        You can't. But you can convert it to a PolygonObject with:

            
            
            BaseObject* GetDeformedObject(BaseObject* obj, BaseDocument* doc)  
            {  
             if (!obj) return NULL;
            
            
            
            
             ModelingCommandData cd;  
             cd.doc = doc;  
             cd.op = obj;  
             if (!SendModelingCommand(MCOMMAND_CURRENTSTATETOOBJECT,cd)) return NULL;
            
            
            
            
             return cd.result1;  
            }
        
        1 Reply Last reply Reply Quote 0
        • H
          Helper
          last edited by

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

          On 21/11/2002 at 11:01, xxxxxxxx wrote:

          Thanks that worked but it somehow gives me a really strange result. 😕 It seems the returned BaseObject is somehow corrupted. When using a normal polygonobject and using the new code with a primitive it looks completely different and weird.
          I will have a look in my code. Maybe it´s something in there but I couldn´t find anything yet.
          I´ll get back to you when I know more.
          Best
          Samir

          1 Reply Last reply Reply Quote 0
          • H
            Helper
            last edited by

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

            On 21/11/2002 at 11:45, xxxxxxxx wrote:

            Oh yeah, something is definetly wrong with the returned object. When I use my code my deformer deforms with no strenght a sphere to this result:

            But when I use my code with the function you gave me (that looks alright to me anyway) I get this result with no strenght:

            I couldn´t find a mistake in my code. Everything is still the same. Now I only ask for the object type:

                
                
                Bool VertexNormal::ModifyObject(PluginObject *mod, BaseDocument *doc, BaseObject *op, const Matrix &op_mg, const Matrix &mod_mg, Real lod, LONG flags, BaseThread *thread)  
                {
                
                
                
                
                PolygonObject* obj;
                
                
                
                
                if(!op->IsInstanceof(Opoint) || !op->IsInstanceof(Opolygon)) obj = (PolygonObject* )GetDeformedObject(op,doc);
                
                
                
                
                else obj=(PolygonObject* )op; if(!obj) return TRUE;
            

            Any ideas? 😞

            1 Reply Last reply Reply Quote 0
            • H
              Helper
              last edited by

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

              On 22/11/2002 at 08:05, xxxxxxxx wrote:

              In your test you are saying:

              If not a point object, OR not a poly object...

              For this test to be false, BOTH parts must be false.
              For both to be false the object must be both a point object and a poly object.

              Poly objects are derived from point objects, so a poly object is also a point object, so this test is equivalent to saying

              If not a poly object...

              which is simpler and clearer.

              The other thing I noted is that you are returning TRUE if 'obj' is NOT valid...

              Hope this helps

              1 Reply Last reply Reply Quote 0
              • H
                Helper
                last edited by

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

                On 22/11/2002 at 08:55, xxxxxxxx wrote:

                Poly objects are derived from point objects, so a poly object is also a point object, so this test is equivalent to saying

                If not a poly object...
                -----------------------
                True that. 🙂 But not that bad. thanks anyway
                ------------------------
                The other thing I noted is that you are returning TRUE if 'obj' is NOT valid
                ------------------------
                yes, because the method returns TRUE, so I am returning TRUE too. This will stop the execution of the code anyway. It´s not always FALSE 😉
                ------------------------
                Hope this helps
                ------------------------
                no not really in my case. The procedure does work, but the returned BaseObject is somehow weird. There must be a fault anywhere in my code, cause after checking the returned object it seems to be completely ok.
                Best
                Samir

                1 Reply Last reply Reply Quote 0
                • First post
                  Last post