make logic connection colored differently to others

This commit is contained in:
sshumakov3
2020-12-27 11:06:35 +03:00
parent ea0d40e811
commit 4ab160e878
5 changed files with 14 additions and 6 deletions

View File

@@ -163,6 +163,11 @@ QColor
ConnectionStyle::
normalColor(QString typeId) const
{
static QColor logic_color = QColor::fromRgb(27, 242, 167);
static QColor regular_color = QColor::fromRgb(27, 167, 242);
return typeId == "logic" ? logic_color : regular_color;
/*
std::size_t hash = qHash(typeId);
std::size_t const hue_range = 0xFF;
@@ -175,6 +180,8 @@ normalColor(QString typeId) const
return QColor::fromHsl(hue,
sat,
160);
*/
}

View File

@@ -151,7 +151,7 @@ namespace noggit
"ConstructionLineWidth": 2.0,
"PointDiameter": 10.0,
"UseDataDefinedColors": false
"UseDataDefinedColors": true
}
}
)");

View File

@@ -42,7 +42,7 @@ namespace noggit
std::unique_ptr<NodeData> data_type;
std::weak_ptr<NodeData> in_value;
QWidget* default_widget = nullptr;
bool connected = false; // needed for multi-input only
bool connected = false;
};
struct OutNodePort
@@ -54,7 +54,7 @@ namespace noggit
std::shared_ptr<NodeData> out_value;
ConnectionPolicy connection_policy = ConnectionPolicy::Many;
QWidget* default_widget = nullptr;
bool connected = false; // needed for multi-input only
bool connected = false;
};

View File

@@ -24,6 +24,7 @@ void noggit::Red::NodeEditor::Nodes::BaseNode::addPort(PortType port_type,
{
throw std::logic_error("Incorrect port type or port type None.");
}
}
template<typename T>

View File

@@ -105,7 +105,6 @@ public:
D::setValue(widget, value);
};
private:
Ty _value;
};
@@ -252,7 +251,9 @@ private:
using TYPE_NAME##Data = GenericData<UNDERLYING_TYPE, \
TYPE_ID##_typeid, TYPE_ID##_typename, toQStringGeneric<UNDERLYING_TYPE>, DEFAULT_WIDGET_GEN>; \
\
template<> TypeFactory::Creator_t* TypeFactory::Register<TYPE_NAME##Data>::creator = TypeFactory::Register<TYPE_NAME##Data>::init_creator(#TYPE_ID);
template<> TypeFactory::Creator_t* TypeFactory::Register<TYPE_NAME##Data>::creator = TypeFactory::Register<TYPE_NAME##Data>::init_creator(#TYPE_ID); \
DECLARE_NODE_DATA_TYPE(logic, Logic, bool, NoDefaultWidget)
DECLARE_NODE_DATA_TYPE(int, Integer, int, DefaultIntWidget)
DECLARE_NODE_DATA_TYPE(uint, UnsignedInteger, unsigned int, DefaultIntWidget)
@@ -260,7 +261,6 @@ DECLARE_NODE_DATA_TYPE(uint, UnsignedInteger, unsigned int, DefaultIntWidget)
DECLARE_NODE_DATA_TYPE(double, Decimal, double, DefaultDecimalWidget)
DECLARE_NODE_DATA_TYPE(bool, Boolean, bool, DefaultBooleanWidget)
DECLARE_NODE_DATA_TYPE(string, String, std::string, DefaultStringWidget)
DECLARE_NODE_DATA_TYPE(logic, Logic, bool, NoDefaultWidget)
// GLM types
DECLARE_NODE_DATA_TYPE(vec2, Vector2D, glm::vec2, NoDefaultWidget)