GetContour() issues



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

    On 03/03/2011 at 02:22, xxxxxxxx wrote:

    I am not sure myself. I will forward the problem to our developers.

    cheers,
    Matthias



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

    On 03/03/2011 at 02:25, xxxxxxxx wrote:

    Thanks Matthias,

    I'll do some experiments on my side. Hopefully I can find a decent workaround.

    Cheers,
    -gene



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

    On 28/06/2011 at 08:03, xxxxxxxx wrote:

    I'm also having a hard time with this. I use a link field to link to a mesh, on which i base my spline. My spline only updates when i change some value in the attribute editor.

    i'm using python, r12.



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

    On 01/07/2011 at 05:24, xxxxxxxx wrote:

    i've sort of worked it out in a tag instead. if you create spline, add the tag to it, then link to a mesh in the tag, the tag will modify the spline so it goes through all the vertices of the mesh. gives exactly the same result as the tracer with deforms and sweepnurbs.
    one problem is that the spline disapears in the viewport sometimes.

    Osfspaghetti.res:
    #############################################

    CONTAINER Osfspaghetti
    {
    NAME Osfspaghetti;
    INCLUDE Obase;

    GROUP ID_OBJECTPROPERTIES
    {
    	LINK PYMESHLINK_MESH { ACCEPT {Opolygon;} }
    }
    

    }
    #############################################

    Osfspaghetti.h:
    #############################################
    #ifndef _Osfspaghetti_H_
    #define _Osfspaghetti_H_

    enum
    {
    PYMESHLINK_MESH = 10000
    };

    #endif
    #############################################

    Osfspaghetti.str:
    #############################################
    STRINGTABLE Osfspaghetti
    {
    Osfspaghetti "Spaghetti";

    PYMESHLINK_MESH	"Object";
    

    }
    #############################################

    SF-spaghetti.pyp
    #############################################
    import c4d
    import math
    import sys
    import os
    from c4d import plugins, utils, bitmaps

    PLUGIN_ID = 1000001

    class spaghettiData(plugins.TagData) :
        
        def Execute(self, tag, doc, op, bt, priority, flags) :
            
            if op.GetTypeName() != "Spline":
                return c4d.EXECUTIONRESULT_OK
            else:
                bc = tag.GetDataInstance()    
                mesh = bc.GetLink(c4d.PYMESHLINK_MESH)
                if not mesh:

    return c4d.EXECUTIONRESULT_OK
                
                pCount = mesh.GetPointCount()
                
                if mesh.GetDeformCache() is None:
                    points = mesh.GetAllPoints()
                else:    
                    points = mesh.GetDeformCache().GetAllPoints()
                
                if pCount != op.GetPointCount() :
                    op.ResizeObject(pCount)
                
                MG = mesh.GetMg()
                op.SetMg(MG)
                
                op[c4d.SPLINEOBJECT_CLOSED] = True
                for i,p in enumerate(points) :
                    op.SetPoint(i, p)
                    
                op.Message(c4d.MSG_UPDATE)

    return c4d.EXECUTIONRESULT_OK

    if __name__ == "__main__":
        path, file = os.path.split(__file__)
        bmp = bitmaps.BaseBitmap()
        bmp.InitWith(os.path.join(path, "res", "spaghetti.tif"))
        plugins.RegisterTagPlugin(id=PLUGIN_ID, str="SF-spaghetti",
                                    g=spaghettiData,
                                    description="Osfspaghetti", icon=bmp,
                                    info=c4d.TAG_VISIBLE|c4d.TAG_EXPRESSION)
    #############################################



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

    On 05/07/2011 at 06:32, xxxxxxxx wrote:

    Sorry for the delay, I'll try to find a solution.

    cheers,
    Matthias



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

    On 05/10/2011 at 05:40, xxxxxxxx wrote:

    Have there been any news in this regard? I actually had this problem popping up multiple times, but I am not sure if there is a clean solution.

    This btw. also happens, when the spline objects shape depends on the object transformation. GetCountour isn't called when the transformation changes as well.



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

    On 04/12/2011 at 03:31, xxxxxxxx wrote:

    Is there a way to return more than one Spline?



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

    On 04/12/2011 at 03:56, xxxxxxxx wrote:

    If you're using GetVirtualObjects to return your splines, just create a null object and make the generated splines child objects of the null. Then return the null.

    If you have to use GetContour, you can't do that because then you have to return a pointer to a SplineObject, not a BaseObject. So what I do is create a Connect object, make the splines children of that, do a SendModelingCommand with MCOMMAND_JOIN on the Connect object, cast the result to a *SplineObject and return that.

    The whole issue with GVO and GC is a mess, it should have been fixed years ago. We shouldn't need both, just the generic GVO function.



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

    On 04/12/2011 at 04:18, xxxxxxxx wrote:

    Yeah. I've got two other plugins I as working on that are spline-dependent (custom spline IK with rail spline option and one for poly deformation).
    Another issue I have is that there is no way for me to adjust the execution point of Splines I'm using. (Splines are always set to Generator priority, which heavily limits their use for tags that need priority set to Experssion.)
    I've yet to hear any news of either an overhaul or at the very least a hack to deal with SplineObjects...



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

    On 04/12/2011 at 04:32, xxxxxxxx wrote:

    I don't know if it will help your problem, but there's a hack on my site to deal with the issue of GetContour not being called except when the AM is updated. It might be of some use, you can find it at http://www.microbion.co.uk/graphics/c4d/cookbook-3.htm.



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

    On 04/12/2011 at 04:51, xxxxxxxx wrote:

    Yeah, that would work great! My original setup was to manually add in keyframes in C4D using a dummy Description to force the update. Your solution's much more elegant. I can probably get UberTracer finally running with that one.
    I'll start working on it again this week.
    Thanks Spedler. 😄



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

    On 10/04/2012 at 07:28, xxxxxxxx wrote:

    See solution posted here.



  • On 29/08/2014 at 03:33, xxxxxxxx wrote:

    Getting back to updating my plugin after all these years...

    It seems that if I call the GetContour() method within the GetVirtualObjects() method, the spline finally updates as expected. The splines also redraw for Sketch & Toon.

      
    BaseObject *UberTracer::GetVirtualObjects(BaseObject*op, HierarchyHelp*hh){  
      return UberTracer::GetContour(op, op->GetDocument(), op->GetDocument->GetLOD(), hh->GetThread());  
    }  
    SplineObject *UberTracer::GetContour(BaseObject* op, BaseDocument* doc, Float lod, BaseThread* bt){  
      /*code for spline generation in here*/  
    }
    

    ...is it safe to code an object this way, or will there be side-effects?
    I've tried the CheckDirty workaround and it doesn't really work as I need it to.



  • On 25/10/2014 at 03:13, xxxxxxxx wrote:

    Welp... answering my question, running GetContour() inside GetVirtualObjects() seems to work almost perfectly.

    Update calls are regular, and Generators and Sketch & Toon will recognize the spline.

    BUT the Hair Renderer will not recognize the spline if GetContour is called in GetVirtualObjects.

    I just have to figure out a way to do a CompareDependenceList() call inside GetContour to optimize the redraw calls...



  • On 25/10/2014 at 08:53, xxxxxxxx wrote:

    I think this happens because the Hair engine expects to be fed a SplineObject (as returned by GetContour), but what GVO returns is a BaseObject. As far as I know, and I spent a lot of time on this a couple of years ago, there is no way to make this work because GVO will not return a SplineObject. I mean, obviously it can return a spline but not as a SplineObject, which is a subclass of BaseObject.

    Steve



  • On 27/10/2014 at 01:30, xxxxxxxx wrote:

    I guess that does make sense.

    Anyways, I'm overhauling my ubertracer code from scratch for R16 and Yannick's CheckDirty() suggestion seems to work so far. I'll just have to do several more case tests to make sure it doesn't break.


Log in to reply