doc.GetHighest - Program-crash



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

    On 13/07/2011 at 18:06, xxxxxxxx wrote:

    While finding the active Stage-object I get a Problem with the "GetHighest"-commando.
    It returns the correct Object, when the stage-object is active, but when its inactive, the program crashes.
    My Code:

    import c4d   
    print doc.GetHighest(c4d.Ostage,False).GetName()
    


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

    On 13/07/2011 at 21:24, xxxxxxxx wrote:

    perhaps try to add an if() statement to make sure there is an active object first? 
    something like:

    import c4d
    from c4d import documents as docs

    doc = docs.GetActiveDocument()
    obj = doc.GetActiveObject()

    if obj != None:
        print doc.GetHighest(c4d.Ostage,False).GetName()



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

    On 14/07/2011 at 03:58, xxxxxxxx wrote:

    The commando is not searching for the highest active object, it is searching for the highest object in hierarchy. The program crashes, when finding a stage object, doesn't visible in renderer.



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

    On 14/07/2011 at 06:50, xxxxxxxx wrote:

    I can confirm this on Windows XP 32 Bit, but the Method crashes Cinema in any way I use it.



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

    On 14/07/2011 at 09:05, xxxxxxxx wrote:

    My OS: Win 7 64 bit - Ultimate



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

    On 14/07/2011 at 15:43, xxxxxxxx wrote:

    Ok, so i tested out your code in a new scene on my mac pro and i got no crashing and the script worked.

    here it is



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

    On 14/07/2011 at 17:06, xxxxxxxx wrote:

    thanks,
    but when i set the stage to invisible, the program crashes, too :(



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

    On 15/07/2011 at 03:13, xxxxxxxx wrote:

    Hi, I can confirm this crash. This needs to be fixed.



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

    On 15/07/2011 at 04:17, xxxxxxxx wrote:

    maybe the code for the commando will become public? This would be nice for working with it :)



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

    On 15/07/2011 at 10:03, xxxxxxxx wrote:

    confirmed. once the stage object is made invisible, it crashes. definitely a bug.



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

    On 15/07/2011 at 12:20, xxxxxxxx wrote:

    Originally posted by xxxxxxxx

    maybe the code for the commando will become public? This would be nice for working with it :)

    You can do the iteration by hand like this:

    import c4d  
    from c4d import gui  
      
    def SearchOM(op) :  
      if not op: return  
      if op.GetDown() : return op.GetDown()  
      while not op.GetNext() and op.GetUp() :  
          op = op.GetUp()  
      return op.GetNext()  
      
      
    def main() :  
      
    obj = doc.GetFirstObject()  
    while obj:  
       objtype = obj.GetType()  
       mode = obj.GetEditorMode()   
       if objtype == c4d.Ostage and mode == c4d.MODE_UNDEF: #If the Stage tag has grey dots       
          obj.SetBit(c4d.BIT_ACTIVE)                        #Select it in the OM  
          break                                             #We found the first one. So break out of the loop   
       obj = SearchOM(obj)  
    c4d.EventAdd()  
      
    if __name__=='__main__':  
      main()
    

    The three modes for those little dots are: c4d.MODE_ON, c4d. MODE_OFF, c4d.MODE_UNDEF.

    -ScottA



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

    On 21/07/2011 at 04:11, xxxxxxxx wrote:

    Thank you ScottA


Log in to reply