Writing DTYPE_FILENAME keys not working?



  • On 05/08/2016 at 09:28, xxxxxxxx wrote:

    I'm trying to write a texture path key into a simple bitmap shader. Setting the value as such works fine and without problems, but writing an actual key fails. The key is being generated and also written on the curve and into the track, but it holds no value. However, calling GeGetData() (not just in that print statement in the code, but also when I manually call it via the Console after creation) on that apparently empty key _does_ show the actual value as expected. It just never makes it into the "live" system.

    The key always shows up as Orange and not as Red, so apparently something is amiss - I just can't figure out what.

    The track is defined as such:
    desc = c4d.DescID(c4d.DescLevel(c4d.BITMAPSHADER_FILENAME, c4d.DTYPE_FILENAME, c4d.Xbitmap))

        def setKeyValueFileName(self, op, desc, fileName) :
            if not os.path.exists(fileName) :
                print "Filename does not exist"
                return
            doc = op.GetDocument()
            track = op.FindCTrack(desc)
            if not track:
                track = c4d.CTrack(op, desc)
                op.InsertTrackSorted(track)
            
            curve = track.GetCurve()
            key = c4d.CKey()
            key.SetTime(curve, doc.GetTime())
            key.SetGeData(curve, fileName)
            print key.GetGeData()
            curve.InsertKey(key)
    

    Any ideas??

    Cheers
    Michael



  • On 05/08/2016 at 10:20, xxxxxxxx wrote:

    Hi,
    I did not check your code for errors. But I have encountered the yellow dot problem.
    The way I've solved it is to use the DrawViews() message after adding the new keys.

            #Update the viewport changes(makes animation the dot for the attribute red)  
          #If you don't use this...the changes will not be set and the dot will turn yellow  
          c4d.DrawViews(c4d.DRAWFLAGS_FORCEFULLREDRAW)
    

    -ScottA



  • On 05/08/2016 at 12:47, xxxxxxxx wrote:

    Cool, I'll give that a try, cheers!



  • On 08/08/2016 at 01:11, xxxxxxxx wrote:

    No, unfortunately that didn't do it either. Keys stay blank, even though the data is there internally.

    http://i.imgur.com/oNdil9T.jpg



  • On 08/08/2016 at 01:59, xxxxxxxx wrote:

    So I assume this has something to do with the data being written into the key not being accepted as valid? But from what I gather from the docs, DTYPE_FILENAME is expecting a str. And that's what it gets. For example if I write this into the key:
    fileName = r'Z:\PROJECTS\06_PRODUCTION_3D\MA ex\DefaultMaterial_Normal.jpg'
    and read that key back out through curve.FindKey(), it reads exactly that value. Yet the key still shows up orange.
    If instead I manually set that key in the GUI with that path, FindKey() shows me the exact same value, but of course the key works now (red).

    I'm confused.



  • On 08/08/2016 at 03:13, xxxxxxxx wrote:

    Edit: never mind. Thought it worked now, but still did not. :(



  • On 08/08/2016 at 05:44, xxxxxxxx wrote:

    Hi,

    the issue is caused by the difference between String and Filename or rather the absence of Filename type in Python. This has to be fixed in our Python module, I've notified the developer.
    Unfortunately there's no workaround.



  • On 08/08/2016 at 05:45, xxxxxxxx wrote:

    I've feared as much :(


Log in to reply