python plugins ObjectData how can use the doc ?

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

On 03/01/2011 at 02:05, xxxxxxxx wrote:

User Information:
Cinema 4D Version:   12 
Platform:   Windows  ;   
Language(s) :       PYTHON  ;

---------
Hi everyone this my first post i try use in plugins.ObjectData i want take the doc becuase i want take the time frame in this example  `` i know this dosen't work correct ``class MyMain(plugins.ObjectData) :
 def GetVirtualObjects(self, op, hh) :
   **doc=documents.GetActiveDocument()** # <- maybe need change this ? Time=doc.GetTime() Frame=Time.GetFrame(doc.GetFps()) print Frame if Frame==0:return c4d.Ocube ``   if Frame==10:return c4d.Ocone
`   if Frame==20:r:return c4d.OSphere
return None

the problem is here ``doc=documents.GetActiveDocument() dosen't work correct in render
  i think i need something like this to use **ObjectData. AddToExecution( _self_ , _op_ , _list_ ) ObjectData.Execute`( self , op , doc , bt , priority , flags )**
here i have doc :)

but i don't know how to use this

any idea ?

Thank you

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

On 03/01/2011 at 04:05, xxxxxxxx wrote:

Hi and Welcome to PluginCafe.com. Please try this:

doc=op.GetDocument()

Cheers, Sebastian

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

On 03/01/2011 at 04:28, xxxxxxxx wrote:

Thank you Very Much Sebastian now understand what i did wrong
doc=op.GetDocument()  ->  so this Returns the document where the object is stored in .
and work fine now  !

Thank you again !!!!

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

On 03/01/2011 at 04:38, xxxxxxxx wrote:

Just want to add that GetActiveDocument returns only the opened editable document. The renderer, except viewport rendering, uses a clone of this document. This is why GetActiveDocument will return the wrong document during rendering.

cheers,
Matthias

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

On 03/01/2011 at 05:03, xxxxxxxx wrote:

Hi just i want to ask something i found now
whe i use

doc1=documents.GetActiveDocument()
  doc2=op.GetDocument()
  print doc1.GetFps()
  print doc2.GetFps()

the doc1 work fine but if i use doc2 like op.GetDocument() say error

i do something wrong ?
i use in

def Init(self, op) :
 because i want to install my vaules and one is c4d.BaseTime

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

On 03/01/2011 at 15:52, xxxxxxxx wrote:

In Init(..) the object is not in the document yet.

obj=c4d.BaseObject(YOUR_PLUGIN_ID) #internal call of the constructor and Init(..) afterwards
doc.InsertObject(obj) #here op is connected with the doc

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

On 04/01/2011 at 01:55, xxxxxxxx wrote:

ok thank you very much for clear this ;)