THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 08/06/2011 at 10:22, xxxxxxxx wrote:
Cinema 4D Version: 12
Platform: Windows ;
Language(s) : C++ ;
How do you get at the World Dynamics attributes?
There seems to be several different variations of implementing the SetParameter() method. And no real explanation of which way to write it. Depending on the various different types of situations.
This kind of method works fine for the Project Settings & Info settings tab's attributes.
But not for the Dynamics tab's attributes:
doc->SetParameter(WORLD_ENABLED, GeData(FALSE), DESCFLAGS_SET_0);//<--doesn't work
Since these attributes are listed under sub group descriptions(General, Cache, Expert, Visualization). It occurred to me that I need to first target that subgroup description. Then target the individual attributes. But the SetParameter(const DescID& id, const GeData& t_data, DESCFLAGS_SET flags) method doesn't seem to allow for dealing with Sub Groups?
So I tried it this way:
BaseContainer *bc = doc->GetSettingsInstance(WORLD_GROUP_DYNAMICS);
if(!bc) return TRUE;
bc->SetParameter(DescID(WORLD_ENABLED), GeData(FALSE));//<--Still doesn't work
On 08/06/2011 at 10:46, xxxxxxxx wrote:
If you look at BaseDocument::GetSettingsInstance(), there are only a few options for the argument - none of which is WORLD_GROUP_DYNAMICS. WORLD_GROUP_DYNAMICS is defined in dynworldobject.h. If the setting is indeed stored in the BaseDocument container then you need to find out which flag retrieves the correct container. Since two of these are private and the other two are modeling and tool containers, try DOCUMENTSETTINGS_GENERAL.
Then you will need to get the subcontainer:
BaseContainer* sbc = bc->GetContainerInstance(WORLD_GROUP_DYNAMICS);
if (!sbc) // handle a NULL return!!
If sbc->SetParameter() still doesn't work, you should also try sbc->SetBool(WORLD_ENABLED, FALSE) (even though we're supposed to *always* use Get/SetParameter().
On 08/06/2011 at 12:37, xxxxxxxx wrote:
The Dynamics tab next to the Project settings is an interface of a scenehook.
You can retrieve the scenehook with BaseDocument::FindSceneHook().
Example for the Dynamics tab:
BaseSceneHook *sh = doc->FindSceneHook(180000100);
if (!sh) return FALSE;
if (sh->GetParameter(DescLevel(WORLD_GRAVITY,DTYPE_REAL,0), d, DESCFLAGS_GET_0))
// hook name
//value of the Gravity parameter
Don't forget to include CINEMA 4D\modules\dynamics2\res\description\dynworldobject.h for the parameter IDs.
On 08/06/2011 at 13:00, xxxxxxxx wrote:
Something else (scene hook) to learn about. :nerd:
Just when I start to get comfortable. You go and toss something completely new at me.
Thanks as always, for the help guys.