Verified Commit 0ba17afd authored by JohnMH's avatar JohnMH

Handle exceptions with setting properties from Studio

parent 32bb4b1a
Pipeline #2501 passed with stage
in 3 minutes and 54 seconds
......@@ -28,6 +28,10 @@
#include "PropertyItem.h"
#include "StudioWindow.h"
#include <OBException.h>
namespace OB{
namespace Studio{
PropertyTreeWidget::PropertyTreeWidget(){
......@@ -281,7 +285,19 @@ namespace OB{
for(auto i = editingInstances.begin(); i != editingInstances.end(); ++i){
shared_ptr<Instance::Instance> inst = *i;
if(inst){
inst->setProperty(prop, val);
try{
inst->setProperty(prop, val);
}catch(OBException* ex){
OBEngine* eng = inst->getEngine();
if(eng){
StudioGLWidget* glWidget = StudioWindow::static_win->getCurrentGLWidget(eng);
if(glWidget){
// Still temporary
QColor errorCol(255, 51, 0);
glWidget->sendOutput(QString(ex->getMessage().c_str()), errorCol);
}
}
}
}
}
}
......
......@@ -22,6 +22,8 @@
#include <OBEngine.h>
#include <instance/DataModel.h>
#include <OBException.h>
#include "StudioWindow.h"
#include "StudioGLWidget.h"
......@@ -35,11 +37,17 @@ namespace OB{
Name = ClassName;
netId = OB_NETID_NOT_REPLICATED;
Archivable = false;
SelectionChanged = make_shared<Type::Event>("SelectionChanged");
}
Selection::~Selection(){}
void Selection::setArchivable(bool archivable){
throw new OBException("The Archivable property of Selection is read-only.");
}
shared_ptr<Type::Event> Selection::getSelectionChanged(){
return SelectionChanged;
}
......
......@@ -29,6 +29,8 @@ namespace OB{
Selection(OBEngine* eng);
virtual ~Selection();
virtual void setArchivable(bool archivable);
shared_ptr<Type::Event> getSelectionChanged();
std::vector<shared_ptr<Instance>> Get();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment