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

Method constructEditControl

Engine/source/T3D/assets/ImageAsset.cpp:472–567  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

470}
471
472GuiControl* GuiInspectorTypeImageAssetPtr::constructEditControl()
473{
474 // Create base filename edit controls
475 GuiControl* retCtrl = Parent::constructEditControl();
476 if (retCtrl == NULL)
477 return retCtrl;
478
479 retCtrl->getRenderTooltipDelegate().bind(this, &GuiInspectorTypeImageAssetPtr::renderTooltip);
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(\"ImageAsset\", \"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(\"ImageAsset\", \"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

Callers

nothing calls this directly

Calls 12

dSprintfFunction · 0.85
getVariableFunction · 0.85
getIdStringMethod · 0.80
setFieldMethod · 0.80
getDataFieldMethod · 0.80
setControlProfileMethod · 0.80
_setBitmapMethod · 0.80
findObjectFunction · 0.50
bindMethod · 0.45
insertMethod · 0.45
registerObjectMethod · 0.45
setTextMethod · 0.45

Tested by

no test coverage detected