Skip to content

Commit

Permalink
refactor(NodeView): naming
Browse files Browse the repository at this point in the history
  • Loading branch information
berdal84 committed May 17, 2024
1 parent 19335f0 commit cf36467
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/nodable/gui/NodeView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -600,13 +600,13 @@ bool NodeView::draw_property_view(PropertyView* _view, const char* _override_lab
{
/* Draw the property */
const fw::type* property_type = property->get_type();
bool has_input_connected = _view->has_input_connected();
bool read_only = _view->has_input_connected();

if( property_type->is<i32_t>() )
{
auto integer = (i32_t)*property->value();

if (ImGui::InputInt(label.c_str(), &integer, 0, 0, input_text_flags ) && !has_input_connected )
if (ImGui::InputInt(label.c_str(), &integer, 0, 0, input_text_flags ) && !read_only )
{
property->set(integer);
changed |= true;
Expand All @@ -616,7 +616,7 @@ bool NodeView::draw_property_view(PropertyView* _view, const char* _override_lab
{
auto d = (double)*property->value();

if (ImGui::InputDouble(label.c_str(), &d, 0.0F, 0.0F, "%g", input_text_flags ) && !has_input_connected )
if (ImGui::InputDouble(label.c_str(), &d, 0.0F, 0.0F, "%g", input_text_flags ) && !read_only )
{
property->set(d);
changed |= true;
Expand All @@ -627,19 +627,17 @@ bool NodeView::draw_property_view(PropertyView* _view, const char* _override_lab
char str[255];
snprintf(str, 255, "%s", (const char*)*property->value() );

if ( ImGui::InputText(label.c_str(), str, 255, input_text_flags ) && !has_input_connected )
if ( ImGui::InputText(label.c_str(), str, 255, input_text_flags ) && !read_only )
{
property->set( std::string(str) );
changed |= true;
}
}
else if( property_type->is<bool>() )
{
std::string checkBoxLabel = property->get_name();

auto b = (bool)*property->value();

if (ImGui::Checkbox(label.c_str(), &b ) && !has_input_connected )
if (ImGui::Checkbox(label.c_str(), &b) && !read_only )
{
property->set(b);
changed |= true;
Expand Down

0 comments on commit cf36467

Please sign in to comment.