Set frame range description values [SOLVED]
On 28/05/2015 at 11:25, xxxxxxxx wrote:
Cinema 4D Version: R16
Platform: Windows ;
Language(s) : C++ ;
I am trying to set the start and stop frame range inside the point cache tag. This tag cannot be accessed through the API so I am trying to set the description parameters directly.
In the code I command the tag to perform the following:
1. Store state.
2. Set auto time to false.
3. Set start frame range to 2050.
4. Set stop frame range to 2150.
DescriptionCommand clickStore; clickStore.id = DescID(DescLevel(ID_CA_GEOMCACHE_TAG_STORE, DTYPE_BUTTON, 0L)); tag->Message(MSG_DESCRIPTION_COMMAND, &clickStore); tag->Message(MSG_UPDATE); EventAdd(); tag->SetParameter(DescID(ID_CA_GEOMCACHE_TAG_CACHE_AUTOTIME), GeData(0), DESCFLAGS_SET_0); tag->Message(MSG_UPDATE); EventAdd(); tag->SetParameter(DescID(ID_CA_GEOMCACHE_TAG_CACHE_START), GeData(2050), DESCFLAGS_SET_FORCESET); tag->Message(MSG_UPDATE); tag->SetParameter(DescID(ID_CA_GEOMCACHE_TAG_CACHE_STOP), GeData(2150), DESCFLAGS_SET_FORCESET); tag->Message(MSG_UPDATE); DescriptionCommand clickCalculate; clickCalculate.id = DescID(DescLevel(ID_CA_GEOMCACHE_TAG_CALCULATE, DTYPE_BUTTON, 0L)); tag->Message(MSG_DESCRIPTION_COMMAND, &clickCalculate); tag->Message(MSG_UPDATE); EventAdd();
Storing state, setting autotime to false and calculating all works perfectly. But I cannot set the start and stop frame range parameters. If I do not set the stop parameter, the value defaults to 30 F. But if I set the stop parameter, it becomes 0 F.
I have tried setting the parameter to a range of value types, and nothing seems to work
I know its something simple and I can't find it. Why is this happening?
On 28/05/2015 at 12:46, xxxxxxxx wrote:
The document (scene) frame range is the final arbiter in allowable frame ranges elsewhere. When you attempt to set either of these outside the range, it appears that they are set to 0 instead. So, first, set the document range to cover the range you need:
BaseDocument* doc = GetActiveDocument(); BaseTime bt = BaseTime::BaseTime(2050, doc->GetFps()); doc->SetMinTime(bt); bt = BaseTime::BaseTime(2150, doc->GetFps()); doc->SetMaxTime(bt);
If I might ask, why are you using these frame values?
On 29/05/2015 at 09:31, xxxxxxxx wrote:
I checked my document frame range. The point cache tag frame range is well inside the frame range of the document. But it still sets the tag range to 0. An artist gave me a character with animation 4,000 + frames. It takes a while to bake and Some of it is unusable. I'm giving them the option to bake sections of the animation.
On 29/05/2015 at 09:41, xxxxxxxx wrote:
ID_CA_GEOMCACHE_TAG_CACHE_START and ID_CA_GEOMCACHE_TAG_CACHE_STOP are of type BaseTime.
On 29/05/2015 at 09:45, xxxxxxxx wrote:
Those frame elements are described as BASETIME in the .res file for the Point Cache tag. It is very likely that you will need to insert data using GeData() using the BaseTime equivalent (in the same manner as in my previous post). Give that a try.
BaseTime bt = BaseTime::BaseTime(2050, doc->GetFps()); tag->SetParameter(DescID(ID_CA_GEOMCACHE_TAG_CACHE_START), GeData(bt), DESCFLAGS_SET_FORCESET); tag->Message(MSG_UPDATE);
On 29/05/2015 at 09:53, xxxxxxxx wrote:
Tested it and it worked. Thanks to both of you.