PLUGINFLAG_SCENELOADER

Detailed Description

Provides specialized flags which can be used to register scene loader plugins.

Macros

#define PLUGINFLAG_SCENELOADER_URL_AWARE
 
#define PLUGINFLAG_SCENELOADER_SUPPORT_ASYNC
 
#define PLUGINFLAG_SCENELOADER_MERGEORIGINAL
 

Macro Definition Documentation

◆ PLUGINFLAG_SCENELOADER_URL_AWARE

#define PLUGINFLAG_SCENELOADER_URL_AWARE

Signals that a scene loader can deal with URLs that are not of file scheme as for example asset URLs.

◆ PLUGINFLAG_SCENELOADER_SUPPORT_ASYNC

#define PLUGINFLAG_SCENELOADER_SUPPORT_ASYNC

Signals that a scene loader should run asynchronously.

Registering a scene loader with this flag requires following non-main-thread restrictions within its non-main-thread methods, as for example not performing GUI operations. But a call of SceneLoaderData::Load for such asynchronous laoder can still carry the flags SCENEFILTER::PROGRESSALLOWED and SCENEFILTER::DIALOGSALLOWED. To support these flags, GUI operations must then be dispatched to the main thread with maxon::ExecuteOnMainThread.

SCENEFILTER filterflags, maxon::String *error_string, BaseThread *bt)
{
// An asynchronous loader can be invoked with any combination of the GUI flags ::PROGRESSALLOWED
// and ::DIALOGSALLOWED. This example demonstrates an async loader which supports only PROGRESSALLOWED.
const Bool isNoGui = (filterflags & SCENEFILTER::PROGRESSALLOWED) != SCENEFILTER::NONE;
if (isNoGui)
{
// Loading which should not show progress in the status bar.
// ...
}
else
{
// Loading which is allowed to show progress status bar. Since this example is intended for
// PLUGINFLAG_SCENELOADER, GUI operations must be dispatched to the main thread. For synchronous
// loaders this is not necessary.
// A progress value which will be updated by fictional code of the loader not shown here.
maxon::Int32 progressValue = 0;
// ...
// Execute a GUI operation on the main thread, this should be used cautiously as this scope
// must wait until the job dispatched by ExecuteOnMainThread() has been carried out. Which
// might not happen right away. In this case one should make sure that the status bar is
// only updated for progress increments larger than 1%, instead of pushing out every
// possible value as this mock-code implies.
[&progressValue]()
{
// Set the main status bar of Cinema 4D to the current progress.
StatusSetBar(progressValue);
});
}
}
@ Load
Definition: Python-ast.h:20
const char const char * name
Definition: abstract.h:195
void StatusSetBar(Int32 p)
Definition: c4d_basedocument.h:497
Definition: c4d_baselist.h:3208
Definition: c4d_thread.h:29
Manages file and path names.
Definition: c4d_file.h:94
Definition: string.h:1235
maxon::Bool Bool
Definition: ge_sys_math.h:55
int32_t Int32
32 bit signed integer datatype.
Definition: apibase.h:201
FILEERROR
Definition: ge_prepass.h:3957
@ NONE
No error.
SCENEFILTER
Definition: ge_prepass.h:298
@ PROGRESSALLOWED
Flag to inform a plugin that a progress bar can be displayed. The progress bar can be set by calling ...
auto ExecuteOnMainThread(FN &&fn, WAITMODE waitMode=WAITMODE::DEFAULT, TimeValue wait=TIMEVALUE_INFINITE) -> decltype(fn())
Definition: thread.h:659
const char * doc
Definition: pyerrors.h:226
Definition: node.h:10

◆ PLUGINFLAG_SCENELOADER_MERGEORIGINAL

#define PLUGINFLAG_SCENELOADER_MERGEORIGINAL

Signals if a scene loader supports scene merging operations.

When this flag is being set and a user invokes a merging into an active scene, the output of the loader will be merged with the active scene. When this flag is not being set, all imports will be placed in a new scene, regardless of the user inputs.