forked from Mirrors/openclonk
Editor shapes: Update shape if value changed by script
parent
91af5a95be
commit
1621e984a9
|
@ -2713,6 +2713,7 @@ bool C4ConsoleQtPropListModel::AddPropertyGroup(C4PropList *add_proplist, int32_
|
|||
C4PropertyDelegateFactory *factory = this->delegate_factory;
|
||||
new_shape_delegate->ConnectSignals(shape, prop->shape_property_path);
|
||||
prop->shape->Set(shape);
|
||||
prop->shape->SetLastValue(v);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -2722,7 +2723,14 @@ bool C4ConsoleQtPropListModel::AddPropertyGroup(C4PropList *add_proplist, int32_
|
|||
}
|
||||
if (prop->shape)
|
||||
{
|
||||
// Mark this shape to be kept aftre update is complete
|
||||
prop->shape->visit();
|
||||
// Update shape by value if it was changed externally
|
||||
if (!prop->shape->GetLastValue().IsIdenticalTo(v))
|
||||
{
|
||||
prop->shape->Get()->SetValue(v);
|
||||
prop->shape->SetLastValue(v);
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -322,6 +322,7 @@ class C4ConsoleQtShapeHolder
|
|||
{
|
||||
C4ConsoleQtShape *shape;
|
||||
bool last_visit;
|
||||
C4Value last_value;
|
||||
|
||||
static bool last_visit_flag;
|
||||
|
||||
|
@ -337,6 +338,10 @@ public:
|
|||
void visit() { last_visit = last_visit_flag; }
|
||||
bool was_visited() const { return last_visit == last_visit_flag; }
|
||||
static void begin_visit() { last_visit_flag = !last_visit_flag; }
|
||||
|
||||
// Remember pointer to last proplist or array set in value to reflect scripted updates
|
||||
const C4Value &GetLastValue() const { return last_value; }
|
||||
void SetLastValue(const C4Value &new_val) { last_value = new_val; }
|
||||
};
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue