MCPcopy Create free account
hub / github.com/OGRECave/ogre-next / OnEdit

Method OnEdit

Tools/MaterialEditor/MaterialEditor/src/WorkspacePanel.cpp:442–475  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

440}
441
442void WorkspacePanel::OnEdit(wxCommandEvent& event)
443{
444 wxTreeItemId selId = mTreeCtrl->GetSelection();
445 if(isMaterial(selId))
446 {
447 MaterialController* mc = getMaterial(selId);
448
449 EditorManager* editorManager = EditorManager::getSingletonPtr();
450 Editor* editor = editorManager->findEditor(mc->getMaterial()->getName().c_str());
451 Editor* editorMat = editorManager->findEditor(Ogre::String(mc->getMaterial()->getName() + ".material").c_str());
452 if(editor != NULL)
453 {
454 editorManager->setActiveEditor(editor);
455 }
456 else if(editorMat != NULL)
457 {
458 editorManager->setActiveEditor(editorMat);
459 }
460 else
461 {
462 MaterialSerializer* ms = new MaterialSerializer();
463 ms->queueForExport(mc->getMaterial(), true);
464 String script = ms->getQueuedAsString();
465
466 MaterialScriptEditor* materialEditor = new MaterialScriptEditor(editorManager->getEditorNotebook(), wxID_ANY);
467 wxString name = mc->getMaterial()->getName().c_str();
468 name += wxT(".material");
469 materialEditor->setName(name);
470 materialEditor->SetText(script);
471
472 editorManager->openEditor(materialEditor);
473 }
474 }
475}
476
477void WorkspacePanel::OnUpdateMaterialMenuItem(wxUpdateUIEvent& event)
478{

Callers

nothing calls this directly

Calls 12

getMaterialFunction · 0.85
GetSelectionMethod · 0.80
findEditorMethod · 0.80
setActiveEditorMethod · 0.80
queueForExportMethod · 0.80
getEditorNotebookMethod · 0.80
SetTextMethod · 0.80
openEditorMethod · 0.80
c_strMethod · 0.45
getNameMethod · 0.45
getMaterialMethod · 0.45
setNameMethod · 0.45

Tested by

no test coverage detected