Docs: add doc-string for ED_view3d_viewcontext_init_object
This commit is contained in:
parent
dc57ab8941
commit
db63945c36
|
@ -952,6 +952,22 @@ float ED_view3d_select_dist_px(void);
|
|||
void ED_view3d_viewcontext_init(struct bContext *C,
|
||||
struct ViewContext *vc,
|
||||
struct Depsgraph *depsgraph);
|
||||
|
||||
/**
|
||||
* Re-initialize `vc` with `obact` as if it's active object (with some differences).
|
||||
*
|
||||
* This is often used when operating on multiple objects in modes (edit, pose mode etc)
|
||||
* where the `vc` is passed in as an argument which then references it's object data.
|
||||
*
|
||||
* \note members #ViewContext.obedit & #ViewContext.em are only initialized if they're already set,
|
||||
* by #ED_view3d_viewcontext_init in most cases.
|
||||
* This is necessary because the active object defines the current object-mode.
|
||||
* When iterating over objects in object-mode it doesn't make sense to perform
|
||||
* an edit-mode action on an object that happens to contain edit-mode data.
|
||||
* In some cases these values are cleared allowing the owner of `vc` to explicitly
|
||||
* disable edit-mode operation (to force object selection in edit-mode for e.g.).
|
||||
* So object-mode specific values should remain cleared when initialized with another object.
|
||||
*/
|
||||
void ED_view3d_viewcontext_init_object(struct ViewContext *vc, struct Object *obact);
|
||||
/**
|
||||
* Use this call when executing an operator,
|
||||
|
|
|
@ -126,6 +126,7 @@ void ED_view3d_viewcontext_init(bContext *C, ViewContext *vc, Depsgraph *depsgra
|
|||
void ED_view3d_viewcontext_init_object(ViewContext *vc, Object *obact)
|
||||
{
|
||||
vc->obact = obact;
|
||||
/* See public doc-string for rationale on checking the existing values first. */
|
||||
if (vc->obedit) {
|
||||
BLI_assert(BKE_object_is_in_editmode(obact));
|
||||
vc->obedit = obact;
|
||||
|
|
Loading…
Reference in New Issue