[Py] GetAllBits returns 0, for video posts

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

On 09/03/2012 at 09:57, xxxxxxxx wrote:

User Information:
Cinema 4D Version:    
Platform:      
Language(s) :

---------

_<__<_t_<__<_t_<__<_t_>__px" width="100%"> Method Problem Replication
c4d.BaseList2D.GetAllBits Always returns zero, Returns zero for Video-post objects. , but should return all bits (in a list? documentation isn't correct, either)

|

import c4d
def main() :  
    ~~# print op.GetAllBits()~~  
    rdata = doc.GetFirstRenderData()  
    vpost = rdata.GetFirstVideoPost()  
    while vpost:  
        print vpost.GetAllBits()  
        vpost = vpost.GetNext()  
 ma\_<\_t\_>\_  

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

On 09/03/2012 at 13:49, xxxxxxxx wrote:

Can you double check my findings on this Nux?

When selecting an object or tag from the manager using op.SetBit(c4d.BIT_ACTIVE) the Bit result is always zero.
But if you physically select the object or tag first. The code returns the correct bits value.

I tried it out in C++ & Python command data plugins. And this problem doesn't seem to happen.
It seems to be a selection issue with the script manager.

Can you confirm this?

-ScottA

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

On 09/03/2012 at 14:37, xxxxxxxx wrote:

Ohhhhh.. oh.. I should've tested a bit more.. I actually tried it with Video-post objects and then mapped that onto everything else. Using SetBit() and calling GetAllBits() afterwards works fine for me (on objects and tags), and it doesn't for you?

I'll correct the topics name.

-Niklas

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

On 09/03/2012 at 14:39, xxxxxxxx wrote:

Get/SetBit() return ok here.
GetAllBits() returns the int bits
(I guess the sum of all bits in obj)

  
import c4d   
  
def main() :   
    objs = doc.GetObjects()   
    for o in objs:   
        if o.GetBit(c4d.BIT_ACTIVE) is False:   
            o.SetBit(c4d.BIT_ACTIVE)   
        else:   
            o.DelBit(c4d.BIT_ACTIVE)   
        print o.GetBit(c4d.BIT_ACTIVE)   
        print o.GetAllBits()   
  
    c4d.EventAdd()   
  
if __name__=='__main__':   
    main()   

Cheers
Lennart

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

On 09/03/2012 at 15:18, xxxxxxxx wrote:

Originally posted by xxxxxxxx

Using SetBit() and calling GetAllBits() afterwards works fine for me (on objects and tags), and it doesn't for you?

Well...No.... It didn't.
Here's the very simple code I was using:

import c4d  
  
def main() :  
  obj = doc.GetFirstObject() #The first object in the OM(a cube)  
  ft = obj.GetFirstTag()     #The first tag on the object  
  print obj.GetAllBits()     #Printed 0   
  print ft.GetAllBits()      #Printed 0  
  
  ft.SetBit(c4d.BIT_ACTIVE)  
  print ft.GetAllBits()      #Still printed 0  <---I don't know why  
  
  c4d.EventAdd()  
  
if __name__=='__main__':  
  main()

However.
Now all of a sudden it does work for me.
I must have been in one of those annoying corrupted sessions that occasionally happens to me.

SetBit(c4d.BIT_ACTIVE) has always been a bit flaky in my script manager code.
But I sometimes get corrupted results from the script manager if I make too many errors while creating scripts with it.  And when that happens I have to close C4D and re open it to make it work properly again.

It's a talent that I can't teach. I'm just born with it. 😂

-ScottA