| 472 | } |
| 473 | |
| 474 | GuiControl* GuiInspectorTypeMaterialAssetPtr::constructEditControl() |
| 475 | { |
| 476 | // Create base filename edit controls |
| 477 | GuiControl* retCtrl = Parent::constructEditControl(); |
| 478 | if (retCtrl == NULL) |
| 479 | return retCtrl; |
| 480 | |
| 481 | // Change filespec |
| 482 | char szBuffer[512]; |
| 483 | |
| 484 | const char* previewImage; |
| 485 | |
| 486 | if (mInspector->getInspectObject() != nullptr) |
| 487 | { |
| 488 | dSprintf(szBuffer, sizeof(szBuffer), "AssetBrowser.showDialog(\"MaterialAsset\", \"AssetBrowser.changeAsset\", %s, %s);", |
| 489 | mInspector->getIdString(), mCaption); |
| 490 | mBrowseButton->setField("Command", szBuffer); |
| 491 | |
| 492 | setDataField(StringTable->insert("targetObject"), NULL, mInspector->getInspectObject()->getIdString()); |
| 493 | |
| 494 | previewImage = mInspector->getInspectObject()->getDataField(mCaption, NULL); |
| 495 | } |
| 496 | else |
| 497 | { |
| 498 | //if we don't have a target object, we'll be manipulating the desination value directly |
| 499 | dSprintf(szBuffer, sizeof(szBuffer), "AssetBrowser.showDialog(\"MaterialAsset\", \"AssetBrowser.changeAsset\", %s, \"%s\");", |
| 500 | mInspector->getIdString(), mVariableName); |
| 501 | mBrowseButton->setField("Command", szBuffer); |
| 502 | |
| 503 | previewImage = Con::getVariable(mVariableName); |
| 504 | } |
| 505 | |
| 506 | mLabel = new GuiTextCtrl(); |
| 507 | mLabel->registerObject(); |
| 508 | mLabel->setControlProfile(mProfile); |
| 509 | mLabel->setText(mCaption); |
| 510 | addObject(mLabel); |
| 511 | |
| 512 | // |
| 513 | GuiTextEditCtrl* editTextCtrl = static_cast<GuiTextEditCtrl*>(retCtrl); |
| 514 | GuiControlProfile* toolEditProfile; |
| 515 | if (Sim::findObject("ToolsGuiTextEditProfile", toolEditProfile)) |
| 516 | editTextCtrl->setControlProfile(toolEditProfile); |
| 517 | |
| 518 | GuiControlProfile* toolDefaultProfile = nullptr; |
| 519 | Sim::findObject("ToolsGuiDefaultProfile", toolDefaultProfile); |
| 520 | |
| 521 | // |
| 522 | mPreviewImage = new GuiBitmapCtrl(); |
| 523 | mPreviewImage->registerObject(); |
| 524 | |
| 525 | if(toolDefaultProfile) |
| 526 | mPreviewImage->setControlProfile(toolDefaultProfile); |
| 527 | |
| 528 | updatePreviewImage(); |
| 529 | |
| 530 | addObject(mPreviewImage); |
| 531 |
nothing calls this directly
no test coverage detected