SceneHookData Class Reference

#include <c4d_scenehookdata.h>

Inheritance diagram for SceneHookData:

详细描述

A data class for creating scene hook plugins.
A scene hook is called on every scene prepare, for example before redraw and before rendering.

使用 RegisterSceneHookPlugin() to register a scene hook plugin.

警告
Make sure that a scene hook plugin is 100% stable and not too slow before releasing it. A crashing scene hook is a potential disaster!

公共成员函数

virtual Bool   MouseInput ( BaseSceneHook *node, BaseDocument *doc, BaseDraw *bd, EditorWindow *win, const BaseContainer &msg)
virtual Bool   KeyboardInput ( BaseSceneHook *node, BaseDocument *doc, BaseDraw *bd, EditorWindow *win, const BaseContainer &msg)
virtual Bool   GetCursorInfo ( BaseSceneHook *node, BaseDocument *doc, BaseDraw *bd, Float x, Float y, BaseContainer &bc)
virtual Bool   Draw ( BaseSceneHook *node, BaseDocument *doc, BaseDraw *bd, BaseDrawHelp *bh, BaseThread *bt, SCENEHOOKDRAW flags)
-  Public Member Functions inherited from NodeData
  NodeData ()
GeListNode Get (void) const
virtual Bool   消息 ( GeListNode *node, Int32 type, void *data)
virtual void  GetBubbleHelp ( GeListNode *node, maxon::String &str)
virtual BaseDocument GetDocument ( GeListNode *node)
virtual Int32   GetBranchInfo ( GeListNode *node, BranchInfo *info, Int32 max, GETBRANCHINFO flags)
virtual Bool   IsInstanceOf (const GeListNode *node, Int32 type) const
virtual Bool   IsDocumentRelated (const GeListNode *node, Bool &docrelated) const
virtual Bool   Init ( GeListNode *node)
virtual void  Free ( GeListNode *node)
virtual Bool   读取 ( GeListNode *node, HyperFile *hf, Int32 level)
virtual Bool   Write ( GeListNode *node, HyperFile *hf)
virtual Bool   CopyTo ( NodeData *dest, GeListNode *snode, GeListNode *dnode, COPYFLAGS flags, AliasTrans *trn)
virtual Bool   GetDDescription ( GeListNode *node, 描述 *description, DESCFLAGS_DESC &flags)
virtual Bool   GetDParameter ( GeListNode *node, const DescID &id, GeData &t_data, DESCFLAGS_GET &flags)
virtual Bool   SetDParameter ( GeListNode *node, const DescID &id, const GeData &t_data, DESCFLAGS_SET &flags)
virtual Bool   GetDEnabling ( GeListNode *node, const DescID &id, const GeData &t_data, DESCFLAGS_ENABLE flags, const BaseContainer *itemdesc)
virtual Bool   TranslateDescID ( GeListNode *node, const DescID &id, DescID &res_id, C4DAtom *&res_at)
-  Public Member Functions inherited from BaseData
  BaseData ()
virtual  ~BaseData (void)
void  Destructor (void)

Init/Free SceneHook

virtual EXECUTIONRESULT   InitSceneHook ( BaseSceneHook *node, BaseDocument *doc, BaseThread *bt)
virtual void  FreeSceneHook ( BaseSceneHook *node, BaseDocument *doc)

Execute

virtual EXECUTIONRESULT   Execute ( BaseSceneHook *node, BaseDocument *doc, BaseThread *bt, Int32 priority, EXECUTIONFLAGS flags)
virtual Bool   AddToExecution ( BaseSceneHook *node, PriorityList *list)

DisplayControl

virtual Bool   DisplayControl ( BaseDocument *doc, BaseObject *op, BaseObject *chainstart, BaseDraw *bd, BaseDrawHelp *bh, ControlDisplayStruct &cds) const
virtual Bool   InitDisplayControl ( BaseSceneHook *node, BaseDocument *doc, BaseDraw *bd, const AtomArray *active)
virtual void  FreeDisplayControl (void)

Additional Inherited Members

-  Protected Attributes inherited from NodeData
GeListNode private_link

成员函数文档编制

◆  InitSceneHook()

virtual EXECUTIONRESULT InitSceneHook ( BaseSceneHook node ,
BaseDocument doc ,
BaseThread bt  
)
virtual

Called to initialize the scene hook, before all scene hooks and expressions in a scene are calculated.
Allocate here temporary data in the node.

参数
[in] node The BaseSceneHook connected with the SceneHookData instance. Equal to static_cast < BaseSceneHook *> Get() . Provided for speed and convenience. Cinema 4D owns the pointed scene hook.
[in] doc The active document. Cinema 4D owns the pointed document.
[in] bt The calling thread. Can be nullptr . Cinema 4D owns the pointed thread.
返回
The execution result: EXECUTIONRESULT

◆  FreeSceneHook()

virtual void FreeSceneHook ( BaseSceneHook node ,
BaseDocument doc  
)
virtual

Called to free the scene hook, after all scene hooks and expressions in a scene are calculated, before the drawing starts.
Free here temporary data allocated in InitSceneHook .

参数
[in] node The BaseSceneHook connected with the SceneHookData instance. Equal to static_cast < BaseSceneHook *> Get() . Provided for speed and convenience. Cinema 4D owns the pointed scene hook.
[in] doc The active document. Cinema 4D owns the pointed document.

◆  Execute()

virtual EXECUTIONRESULT Execute ( BaseSceneHook node ,
BaseDocument doc ,
BaseThread bt ,
Int32   priority ,
EXECUTIONFLAGS   flags  
)
virtual

Called at the point in the priority pipeline specified by AddToExecution , or by RegisterSceneHookPlugin .

注意
This function is called in a thread context. See the important information about threading.
参数
[in] node The BaseSceneHook connected with the SceneHookData instance. Equal to static_cast < BaseSceneHook *> Get() . Provided for speed and convenience. Cinema 4D owns the pointed scene hook.
[in] doc The active document. Cinema 4D owns the pointed document.
[in] bt The calling thread. Can be nullptr . Cinema 4D owns the pointed thread.
[in] priority The priority of the call to Execute() in the pipeline: EXECUTIONPRIORITY
[in] flags The execution flags: EXECUTIONFLAGS
返回
The execution result: EXECUTIONRESULT

◆  AddToExecution()

virtual Bool AddToExecution ( BaseSceneHook node ,
PriorityList list  
)
virtual

Called to add execution priorities.
By default returns false . In that case Cinema 4D will call Execute() at the priority specified by the RegisterSceneHookPlugin() call for the scene hook.
If overridden then insert points of execution in the list and return true . Heres is an example:

list->Add(node, EXECUTIONPRIORITY_ANIMATION , EXECUTIONFLAGS::NONE ); list->Add(node, EXECUTIONPRIORITY_GENERATOR , EXECUTIONFLAGS::NONE );

Cinema 4D will then call Execute() 2 times.

参数
[in] node The BaseSceneHook connected with the SceneHookData instance. Equal to static_cast < BaseSceneHook *> Get() . Provided for speed and convenience. Cinema 4D owns the pointed scene hook.
[in] list The priority list to add execution points to. Cinema 4D owns the pointed priority list.
返回
true if priority was added to the execution list , otherwise false .

◆  MouseInput()

virtual Bool MouseInput ( BaseSceneHook node ,
BaseDocument doc ,
BaseDraw bd ,
EditorWindow win ,
const BaseContainer msg  
)
virtual

Called when the user clicks with the mouse in any of the editors views.

注意
Make sure this function is used only when the user is somehow working with the scene hook plugin, so that other plugins can also use this hook when it is their turn.
警告
At least call SceneHookData::MouseInput(node, doc, bd, win, msg) as last return, so that other plugins can also use this hook when it is their turn.
true is returned the right-click will not be evaluated anymore in the editor views.
参数
[in] node The BaseSceneHook connected with the SceneHookData instance. Equal to static_cast < BaseSceneHook *> Get() . Provided for speed and convenience. Cinema 4D owns the pointed scene hook.
[in] doc The active document. Cinema 4D owns the pointed document.
[in] bd The active editor view. Cinema 4D owns the pointed base draw.
[in] win The window for the active editor view. Cinema 4D owns the pointed editor window.
[in] msg The mouse message container. See Input Events .
返回
true if successful, otherwise false .

◆  KeyboardInput()

virtual Bool KeyboardInput ( BaseSceneHook node ,
BaseDocument doc ,
BaseDraw bd ,
EditorWindow win ,
const BaseContainer msg  
)
virtual

Called when the user types something in any of the editors views.

注意
Make sure this function is used only when the user is somehow working with the scene hook plugin, so that other plugins can also use this hook when it is their turn.
警告
At least call SceneHookData::KeyboardInput(node, doc, bd, win, msg) as last return, so that other plugins can also use this hook when it is their turn.
true is returned the keyboard will be blocked in the editor views.
参数
[in] node The BaseSceneHook connected with the SceneHookData instance. Equal to static_cast < BaseSceneHook *> Get() . Provided for speed and convenience. Cinema 4D owns the pointed scene hook.
[in] doc The active document. Cinema 4D owns the pointed document.
[in] bd The active editor view. Cinema 4D owns the pointed base draw.
[in] win The window for the active editor view. Cinema 4D owns the pointed editor window.
[in] msg The keyboard message container. See Input Events .
返回
true if successful, otherwise false .

◆  GetCursorInfo()

virtual Bool GetCursorInfo ( BaseSceneHook node ,
BaseDocument doc ,
BaseDraw bd ,
Float   x ,
Float   y ,
BaseContainer bc  
)
virtual

Called when the cursor is over the editor views to get the state of the mouse pointer.
Set the bubble help and cursor, for example:

bc. SetString ( RESULT_BUBBLEHELP , "My Tools Help" ); bc. SetInt32 ( RESULT_CURSOR , MOUSE_POINT_HAND );
注意
Make sure this function is used only when the user is somehow working with the scene hook plugin, so that other plugins can also use this hook when it is their turn.
参数
[in] node The BaseSceneHook connected with the SceneHookData instance. Equal to static_cast < BaseSceneHook *> Get() . Provided for speed and convenience. Cinema 4D owns the pointed scene hook.
[in] doc The active document. Cinema 4D owns the pointed document.
[in] bd The active editor view. Cinema 4D owns the pointed base draw.
[in] x The X coordinate of the mouse cursor relative to the top-left of the active editor view.
[in] y The Y coordinate of the mouse cursor relative to the top-left of the active editor view.
[in] bc The container to store the cursor information in: BFM_GETCURSORINFO_RESULT
返回
true if successful, otherwise false .

◆  Draw()

virtual Bool Draw ( BaseSceneHook node ,
BaseDocument doc ,
BaseDraw bd ,
BaseDrawHelp bh ,
BaseThread bt ,
SCENEHOOKDRAW   flags  
)
virtual

Called when the display is updated to display arbitrary visual elements in the editor views.

注意
This function is called in a thread context. See the important information about threading.
Make sure this function is used only when the user is somehow working with the scene hook plugin, so that other plugins can also use this hook when it is their turn.
参数
[in] node The BaseSceneHook connected with the SceneHookData instance. Equal to static_cast < BaseSceneHook *> Get() . Provided for speed and convenience. Cinema 4D owns the pointed scene hook.
[in] doc The active document. Cinema 4D owns the pointed document.
[in] bd The active editor view. Cinema 4D owns the pointed base draw.
[in] bh The helper for active the editor view. The caller owns the pointed view helper.
[in] bt The calling thread. Can be nullptr . Cinema 4D owns the pointed thread.
[in] flags The draw flags: SCENEHOOKDRAW
返回
true if successful, otherwise false .

◆  DisplayControl()

virtual Bool DisplayControl ( BaseDocument doc ,
BaseObject op ,
BaseObject chainstart ,
BaseDraw bd ,
BaseDrawHelp bh ,
ControlDisplayStruct cds  
) const
virtual

Called to set information about how the active object should be displayed.

参数
[in] doc The active document. Cinema 4D owns the pointed document.
[in] op The active object. Cinema 4D owns the pointed object.
[in] chainstart The start of the object chain. Cinema 4D owns the pointed object.
[in] bd The active editor view. Cinema 4D owns the pointed base draw.
[in] bh The helper for active the editor view. The caller owns the pointed view helper.
[in] cds The display control settings.
返回
true if successful, otherwise false .

◆  InitDisplayControl()

virtual Bool InitDisplayControl ( BaseSceneHook node ,
BaseDocument doc ,
BaseDraw bd ,
const AtomArray active  
)
virtual

Initialize resources for the display control used in DisplayControl .

参数
[in] node The BaseSceneHook connected with the SceneHookData instance. Equal to static_cast < BaseSceneHook *> Get() . Provided for speed and convenience. Cinema 4D owns the pointed scene hook.
[in] doc The active document. Cinema 4D owns the pointed document.
[in] bd The active editor view. Cinema 4D owns the pointed base draw.
[in] active The active objects array. Cinema 4D owns the pointed array.
返回
true if successful, otherwise false .

◆  FreeDisplayControl()

virtual void FreeDisplayControl ( void  )
virtual

Free resources allocated in InitDisplayControl .

EXECUTIONFLAGS::NONE
@ NONE
None.
BaseContainer::SetInt32
void SetInt32(Int32 id, Int32 l)
定义: c4d_basecontainer.h:505
BaseContainer::SetString
void SetString(Int32 id, const maxon::String &s)
定义: c4d_basecontainer.h:569
EXECUTIONPRIORITY_ANIMATION
#define EXECUTIONPRIORITY_ANIMATION
Animation.
定义: ge_prepass.h:3623
EXECUTIONPRIORITY_GENERATOR
#define EXECUTIONPRIORITY_GENERATOR
Generators.
定义: ge_prepass.h:3627
RESULT_CURSOR
@ RESULT_CURSOR
Int32 Mouse cursor: MOUSE
定义: gui.h:542
MOUSE_POINT_HAND
static const Int32 MOUSE_POINT_HAND
Point hand cursor.
定义: ge_prepass.h:2495
RESULT_BUBBLEHELP
@ RESULT_BUBBLEHELP
String Bubble help text.
定义: gui.h:543