MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / constructEditControl

Method constructEditControl

Engine/source/T3D/assets/ShapeAsset.cpp:746–839  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

744}
745
746GuiControl* GuiInspectorTypeShapeAssetPtr::constructEditControl()
747{
748 // Create base filename edit controls
749 GuiControl* retCtrl = Parent::constructEditControl();
750 if (retCtrl == NULL)
751 return retCtrl;
752
753 // Change filespec
754 char szBuffer[512];
755
756 const char* previewImage;
757
758 if (mInspector->getInspectObject() != nullptr)
759 {
760 dSprintf(szBuffer, sizeof(szBuffer), "AssetBrowser.showDialog(\"ShapeAsset\", \"AssetBrowser.changeAsset\", %s, %s);",
761 mInspector->getIdString(), mCaption);
762 mBrowseButton->setField("Command", szBuffer);
763
764 setDataField(StringTable->insert("targetObject"), NULL, mInspector->getInspectObject()->getIdString());
765
766 previewImage = mInspector->getInspectObject()->getDataField(mCaption, NULL);
767 }
768 else
769 {
770 //if we don't have a target object, we'll be manipulating the desination value directly
771 dSprintf(szBuffer, sizeof(szBuffer), "AssetBrowser.showDialog(\"ShapeAsset\", \"AssetBrowser.changeAsset\", %s, \"%s\");",
772 mInspector->getIdString(), mVariableName);
773 mBrowseButton->setField("Command", szBuffer);
774
775 previewImage = Con::getVariable(mVariableName);
776 }
777
778 mLabel = new GuiTextCtrl();
779 mLabel->registerObject();
780 mLabel->setControlProfile(mProfile);
781 mLabel->setText(mCaption);
782 addObject(mLabel);
783
784 //
785 GuiTextEditCtrl* editTextCtrl = static_cast<GuiTextEditCtrl*>(retCtrl);
786 GuiControlProfile* toolEditProfile;
787 if (Sim::findObject("ToolsGuiTextEditProfile", toolEditProfile))
788 editTextCtrl->setControlProfile(toolEditProfile);
789
790 GuiControlProfile* toolDefaultProfile = nullptr;
791 Sim::findObject("ToolsGuiDefaultProfile", toolDefaultProfile);
792
793 //
794 mPreviewImage = new GuiBitmapCtrl();
795 mPreviewImage->registerObject();
796
797 if (toolDefaultProfile)
798 mPreviewImage->setControlProfile(toolDefaultProfile);
799
800 updatePreviewImage();
801
802 addObject(mPreviewImage);
803

Callers

nothing calls this directly

Calls 14

dSprintfFunction · 0.85
getVariableFunction · 0.85
getIdStringMethod · 0.80
setFieldMethod · 0.80
getDataFieldMethod · 0.80
setControlProfileMethod · 0.80
_setBitmapMethod · 0.80
setSizingMethod · 0.80
getIdMethod · 0.65
findObjectFunction · 0.50
insertMethod · 0.45
registerObjectMethod · 0.45

Tested by

no test coverage detected