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

Method constructEditControl

Engine/source/T3D/assets/MaterialAsset.cpp:474–567  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

472}
473
474GuiControl* 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

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