After writing the previous article, I found a question:
That is, the plugin cannot be previewed in real time.
After learning slate, I found a way to:
Overriding the Synchronizeproperties function
The header file is added:
#if With_editor ufunction () virtualvoidoverride; #endif
Because it only needs to be run in the editor, add # if With_editor
CPP file, add the following:
#ifWith_editorvoiduminimap::synchronizeproperties () {super::synchronizeproperties (); Widgetsize= -; Maptexturesize= +; //Building ComponentsMainmap = newobject<uimage> ( This, TEXT ("Mainmap")); Playercursor= Newobject<uimage> ( This, TEXT ("Playercursor")); Frame= Newobject<uimage> ( This, TEXT ("Frame")); //adding components to widget containersRootpanel = cast<ucanvaspanel> (widgettree->rootwidget); if(rootpanel) {Rootpanel-AddChild (MAINMAP); Rootpanel-AddChild (playercursor); Rootpanel-AddChild (Frame); } umaterialinstance*mainmapmaterialinstance = loadobject<umaterialinstance> (NULL, TEXT ("/game/ui/images/minimapmaterial_instance"), NULL, load_none, NULL); if(mainmapmaterialinstance) {mainmapmaterial=ukismetmateriallibrary::createdynamicmaterialinstance (Getworld (), mainmapmaterialinstance); if(mainmapmaterial->parent->getmaterial ()->materialdomain = =md_ui) {Uwidgetlayoutlibrary::slotascanvasslot (Mainmap)-SetSize (fvector2d (Widgetsize, widgetsize)); Mainmap-setbrushfrommaterial (mainmapmaterial); Mainmapmaterial->setscalarparametervalue (FName (TEXT ("Minimapscaleratio")), (float) Widgetsize/maptexturesize); }} utexture2d* Playercursortexture = loadobject<utexture2d> (NULL, TEXT ("/game/ui/images/playercursor"), NULL, load_none, NULL); if(playercursortexture) {uwidgetlayoutlibrary::slotascanvasslot (playercursor)->setsize (Fvector2d (Playercursortexture->getsizex (), playercursortexture->Getsizey ())); Playercursorsize= playercursortexture->Getsizex (); Uwidgetlayoutlibrary::slotascanvasslot (playercursor)->setposition (fvector2d (-playercursorsize/2+ Widgetsize/2,-playercursorsize/2+ Widgetsize/2)); Playercursor-setbrushfromtexture (playercursortexture); } if(Setimageburshfrommaterial (TEXT ("/game/ui/images/framematerial"), Frame, fvector2d (Widgetsize, widgetsize))) {Uwidgetlayoutlibrary::slotascanvasslot (frame)-SetSize (fvector2d (Widgetsize, widgetsize)); } //you can consider adding other buttons and borders later}#endif
However, there is a small problem, in the new blueprint (Inherit this class blueprint) Mad point, the engine will be directly collapsed, there is no solution, the engine is Slate, forum and Answerhub also have no relevant information, but this problem does not affect the use, so the tutorial ends.
A supplement to the article "Share your little map written in C + +"