Announcements

Between mid-October and November, the content on AREA will be relocated to the Autodesk Community M&E Hub and the Autodesk Community Gallery. Learn more HERE.

How to invalidate render items

How to invalidate render items

sukoy27k
Participant Participant
567 Views
4 Replies
Message 1 of 5

How to invalidate render items

sukoy27k
Participant
Participant

Hi

 

Regarding the render items in nitrous

https://help.autodesk.com/view/3DSMAX/2020/ENU/?guid=__developer_3ds_max_sdk_features_viewports_and_...

 

Usually a system based on render items is made in this way

 

bool CustomPlugin::PrepareDisplay(
      const MaxSDK::Graphics::UpdateDisplayContext& displayContext)
{
      // cook some new render items
}

bool CustomPlugin::UpdatePerNodeItems(
      const UpdateDisplayContext& updateDisplayContext,
      UpdateNodeContext& nodeContext,
      IRenderItemContainer& targetRenderItemContainer)
{
      // remove the existing render items
      targetRenderItemContainer.ClearAllRenderItems();
      // add the new render items
      for( auto& item: myRenderItems )
      {
           CustomRenderItemHandle newHandle;
           newHandle.Initialize();
           newHandle.SetVisibilityGroup(RenderItemVisible_Gizmo);
           newHandle.SetCustomImplementation(mpSampleItem.GetPointer());
           targetRenderItemContainer.AddRenderItem(newHandle);
      }
      return true;
}

 

The question is: how to invalidate the render items and triger the system to invoke again PrepareDisplay?

Actually now PrepareDisaply is only called when the frame changes.

 

Thanks

0 Likes
568 Views
4 Replies
Replies (4)
Message 2 of 5

sukoy27k
Participant
Participant

No one knows?

0 Likes
Message 3 of 5

klvnk
Collaborator
Collaborator

sorry miss understood the question

0 Likes
Message 4 of 5

sukoy27k
Participant
Participant

Seems to work

ptrMaxObject->NotifyDependents ( FOREVER, PART_DISPLAY, REFMSG_CHANGE );
GetCOREInterface ()->ForceCompleteRedraw ();
0 Likes
Message 5 of 5

AtomLMW
Participant
Participant

This is what exactly I am looking for,  the solution of yours will work, however is this the reasonable way? The sdk document has said that "each object prepares the display data only once", so I am wondering when the UpdatePerNodeItems function will be invoke to update the object. From my debugging shows that this function will be invoked when the selected state of the object changed.   

 

0 Likes