| 744 | } |
| 745 | |
| 746 | GuiControl* 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 |
nothing calls this directly
no test coverage detected