Accurately retrieval of time during SMB?

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

On 03/09/2009 at 08:26, xxxxxxxx wrote:

User Information:
Cinema 4D Version:    
Platform:   Windows  ; Mac  ;  Mac OSX  ; 
Language(s) :     C++  ;

---------
Hi,

I have a hard retrieving time during SMB from within an object plugin.

The active RenderData min and max times are not filled! They are min=0 and max=0. How should one retrieve the correct min and max time of the render document? I cannot use the document passed from the Hierarchy Help (which by definition should be the render document evaluated) as it does not return the correct min and max times set in the render settings but returns the editor document time.

And, is there a way to retrieve the current subframe from within my object?

I would need a solution for this if possible. Or is it a bug?

Thank you in advance

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

On 04/09/2009 at 02:30, xxxxxxxx wrote:

I have to ask the developers.

cheers,
Matthias

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

On 04/09/2009 at 03:22, xxxxxxxx wrote:

thank you matthias.

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

On 07/09/2009 at 06:49, xxxxxxxx wrote:

On second thought why don't you get the SMB videopost and from there the number of subframes. Now with the current document time and current frame it should be possible to calculate the current subframe.

Btw. I can all the necessary times without any problems.

> \> BaseObject \*AtomObject::GetVirtualObjects(PluginObject \*op, HierarchyHelp \*hh) \> { \>      BaseDocument \*doc = NULL; \>      doc = hh->GetDocument(); \>      if (doc) \>      { \>           RenderData \*rdata = NULL; \>           rdata = doc->GetActiveRenderData(); \> \>           BaseContainer \*rbc = rdata->GetDataInstance(); \> \>           GePrint("From "+RealToString(rbc->GetTime(RDATA_FRAMEFROM).Get())); \>           GePrint("Current "+RealToString(doc->GetTime().Get())); \>           GePrint("To "+RealToString(rbc->GetTime(RDATA_FRAMETO).Get())); \>           GePrint("Min "+RealToString(doc->GetMinTime().Get())); \>           GePrint("Max "+RealToString(doc->GetMaxTime().Get())); \> \>           PluginVideoPost \*pvp = NULL; \>           pvp = rdata->GetFirstVideoPost(); \> \>           while (pvp) \>           { \>                if (pvp->GetType() == 1001010) //is SMB \>                { \>                     BaseContainer \*pvpdata = NULL; \>                     pvpdata = pvp->GetDataInstance(); \>                     LONG subframes = pvpdata->GetLong(VP_SMBSUB); \> \>                     GePrint(LongToString(subframes)); \> \>                     break; \>                } \> \>                pvp = pvp->GetNext(); \>           } \>      } \> \>      return BaseObject::Alloc(Ocube); \> } \>

cheers,
Matthias

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

On 07/09/2009 at 07:17, xxxxxxxx wrote:

Hi Matthias,

thanks first of all.

I use exactly! the same code and RDATA_FRAMEFROM and RDATA_FRAMETO always return 0 during SMB. That really works for you? Hmm, are you trying in 11.5 or 11.0? I haven´t tried in R11.5 yet (will report back if that works in there).

Edit: Instead of .Get() I use GetFrame(fps). That´s the difference I do as I need the Frame number not the time in seconds.

Also, I don´t need the number of subframes but the currently processed subframe! Or does VP_SMBSUB return this? I couldn´t find any information about this ID in the docs or in the API files. I get a compiling error as the ID is unknown. What´s the specific LONG value associated with this ID? And does it work in R10 and higher or only in R11.5 maybe?

thanks!

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

On 07/09/2009 at 07:51, xxxxxxxx wrote:

Yep, just confirmed it in R11.5. Copied your code into the Atom Array example and ran it (I additionally added output for GetFrame() calls). GetFrame(fps) does always return 0 and 0 as stated in my initial post. This is when I set the renderframes to "All Frames".

When I manually change the "To" value to let´s say 90, then it correctly returns 0 and 90. But when I set back from Manually to "All frames" then it still returns 0 to 90!

So it seems to be a bug as the RDATA_FROMTO is not updated correctly but keeps the last change to the "To" field instead of returning the actual last frame (that´s also why it returns 0 and 0 at the beginning. Most probably that setting is not correctly initialised.

btw. Also VP_SMBSUB is not defined in the R11.5 SDK.

Mist..is there any way to otherwise retrieve these values?

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

On 07/09/2009 at 09:04, xxxxxxxx wrote:

Ok, here some working code:

> \> BaseObject \*AtomObject::GetVirtualObjects(PluginObject \*op, HierarchyHelp \*hh) \> { \>      BaseDocument \*doc = NULL; \>      doc = hh->GetDocument(); \>      if (doc) \>      { \>           RenderData \*rdata = doc->GetActiveRenderData(); \>           BaseContainer \*rbc = rdata->GetDataInstance(); \> \>           PluginVideoPost \*pvp = NULL; \>           pvp = rdata->GetFirstVideoPost(); \> \>           while (pvp) \>           { \>                if (pvp->GetType() == VPscenemotionblur) //is SMB \>                { \>                     BaseContainer \*pvpdata = NULL; \>                     pvpdata = pvp->GetDataInstance(); \> \>                     Real strength = pvpdata->GetReal(VP_SMBSTRENGTH); //SMB strength \>                     if (strength == 0.f) break; \> \>                     LONG subframes = pvpdata->GetLong(VP_SMBSUB); //subframes menu \> \>                     switch (subframes) \>                     { \>                          case VP_SMBSUB_5: subframes = 5; break; \>                          case VP_SMBSUB_9: subframes = 9; break; \>                          case VP_SMBSUB_16: subframes = 16; break; \>                          case VP_SMBSUB_25: subframes = 25; break; \>                          case VP_SMBSUB_36: subframes = 36; break; \>                          case VP_SMBSUB_49: subframes = 49; break; \>                     } \> \>                     Real fps = doc->GetFps(); \>                     Real factor = subframes \* fps; \>                     BaseTime time = doc->GetTime(); \>                     Real seconds = time.Get(); \>                     Real frame = time.GetFrame(fps)/fps; \> \>                     if (seconds != frame) \>                     { \>                          GePrint("subframe "+RealToString( ((seconds-frame)\*factor/strength) )); //this is the subframe \>                     } \>                     else \>                     { \>                          GePrint("first frame"); \>                     } \> \>                     break; \>                } \>                pvp = pvp->GetNext(); \>           } \>      } \> \>      return BaseObject::Alloc(Ocube); \> } \>

You find the SMB container IDs in CINEMA 4D\resource\res\description\vpscenemotionblur.h

cheers,
Matthias

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

On 07/09/2009 at 10:06, xxxxxxxx wrote:

Thanks Matthias! Will give that a go.

I assume the frame thing is a bug?