Hidden Tag / Operation Complete [SOLVED]



  • On 13/10/2014 at 02:51, xxxxxxxx wrote:

    Hello,

    i have a simple script that gernerates a TextureBake Tag and bake the AO to Vertexmap. But if i will rename the generetet VertexMap or set to selected, in the Console is all good but in the Objectmanager is the old name in the VertexMap Tag and no VertexMap is selected.

    I need a Solution for this.

    Here is the Simple Code:

    tag=op.GetTag(c4d.Tbaketexture)
        tag[c4d.BAKETEXTURE_CHANNEL_AO]=True
        tag[c4d.BAKETEXTURE_AO_TO_VERTEX]=True
        c4d.CallButton(tag, c4d.BAKETEXTURE_BAKE)

    tag=obj.GetTag(c4d.Tvertexmap) # Select VertexMap
        tag.SetName("Ao Dirt Map")
        doc.SetActiveTag(tag)

    greetz iDani



  • On 13/10/2014 at 04:34, xxxxxxxx wrote:

    Hi,

    the second time you write obj instead of op.

    tag=obj.GetTag(c4d.Tvertexmap) # Select VertexMap

    and a

    c4d.EventAdd()

    is needed to update your selection choice at the end

    Cheers,
    Martin



  • On 13/10/2014 at 05:41, xxxxxxxx wrote:

    Hello Monkeytrack,

    thanks for your feedback.

    The c4d.EventAdd() doesn't fix it. The Tag is for Miliseconds selected and than unselected.



  • On 13/10/2014 at 06:13, xxxxxxxx wrote:

    You can call me Martin, ;)

    everything works fine here.
    You can use
    tag.SetBit(c4d.BIT_ACTIVE) with an addevent, too.

    But it seems there is another problem with your code.
    Post a little bit more from it, that we can find the problem.

    cheers,
    Martin



  • On 13/10/2014 at 07:29, xxxxxxxx wrote:

    Hello Martin,

    the tag is for miliseconds selected und renamed in Attributesmanager but than ist overwritten.

    Here is my complete code (a materialtag must be on the polygonobject to work) :
    import c4d
    from c4d import documents, utils, internals

    #Welcome to the world of Python

    def main() :

    c4d.CallCommand(1011133) # Bake Texture...
        
        tag=op.GetTag(c4d.Tbaketexture)
        tag[c4d.BAKETEXTURE_CHANNEL_AO]=True
        tag[c4d.BAKETEXTURE_AO_TO_VERTEX]=True
        c4d.CallButton(tag, c4d.BAKETEXTURE_BAKE)
            
        c4d.EventAdd()

    tag=op.GetTag(c4d.Tvertexmap) # Select VertexMap     
        tag.SetBit(c4d.BIT_ACTIVE)
        tag.SetName("Ao Dirt Map")
        doc.SetActiveTag(tag)
        
        #tag[c4d.ID_BASELIST_NAME]="Material_obj.Dirt Map1111"

    c4d.EventAdd()

    if __name__=='__main__':
        main()

    thanks for your help
    greetz
    iDani



  • On 13/10/2014 at 11:14, xxxxxxxx wrote:

    crossroadtraffic...

    your texture bake was´nt finished jet (including rendering the picture in the viewer)and the script  handled the selection step in between.
    To many tasks at once.

    It´s maybe a little bit dirty to sort it out like this, but you can open another userthread and within you let your selection task wait until your baking is finished.
    But I have no solution jet how we can detect if the baking is finished, like in a rendering.

    In this example I used the clause `if a vertex map exists´, but this is no solution for every case.
    If you find a better solution I´ll be interested.
    But as a starting point this works.
    cheers
    Martin

      
    import c4d  
    from c4d import documents, utils, internals  
    import os, time, thread  
      
    def Vertex(op,time) :  
      time.sleep(0.5)  
      tag2=op.GetTag(c4d.Tvertexmap) # Select VertexMap       
      tag2.SetBit(c4d.BIT_ACTIVE)  
      tag2.SetName("Ao Dirt Map")  
      c4d.EventAdd()  
      
        
      
    def main() :  
        
      
            
      tag=op.MakeTag(c4d.Tbaketexture)  
      tag[c4d.BAKETEXTURE_CHANNEL_AO]=True  
      tag[c4d.BAKETEXTURE_AO_TO_VERTEX]=True  
        
      tag[c4d.BAKETEXTURE_BAKE]  
      c4d.CallButton(tag, c4d.BAKETEXTURE_BAKE)  
      c4d.EventAdd()  
        
      
      if  op.GetTag(c4d.Tvertexmap)!= None:  
         thread.start_new(Vertex,(op, time))  
            
      
      
      
      c4d.EventAdd()  
    


  • On 14/10/2014 at 00:16, xxxxxxxx wrote:

    Hello,

    as Martin indicated, the BAKETEXTURE_BAKE command starts a process that involves threads. So the vertex map tag will be changed after the bake process is finished (and also after your script is done).

    The bake command already gives the vertex map a new name: "Object.Dirt Map". Maybe you can use this name for your purposes.

    best wishes,
    Sebastian



  • On 14/10/2014 at 01:06, xxxxxxxx wrote:

    Hello Sebastian,

    is there any way to detect the progress of texturebaking, as it is possilble with e.g. the batchrendering?

    batch = c4d.documents.GetBatchRender()
    if batch.IsRendering() :

    Thanks in advance
    Martin



  • On 14/10/2014 at 01:35, xxxxxxxx wrote:

    Hello Martin,

    this helps me a lot. Thank you for your help. :-)
    You are great! :-)

    Greetz
    iDani



  • On 15/10/2014 at 07:58, xxxxxxxx wrote:

    Hello,

    it seems that it is not possible to get the progress in Python. But using the C++ API you can use BakeTexture to bake a texture. You can then add a callback to get the progress.

    Best wishes,
    Sebastian



  • On 15/10/2014 at 08:18, xxxxxxxx wrote:

    Hello,

    thank you for the reply!
    It´s a real timesaver, if someone experienced says :"It´s not possible"
    But for iDani it works so far and that´s good to know.

    to iDani
    You´re welcome.

    Best wishes,
    Martin


Log in to reply