[Bf-blender-cvs] [5dbbfc8cc36] temp-geometry-nodes-evaluator-refactor: Merge branch 'master' into temp-geometry-nodes-evaluator-refactor

Jacques Lucke noreply at git.blender.org
Tue Aug 23 12:27:34 CEST 2022


Commit: 5dbbfc8cc3673b324d46bca3f6f37da1de8d06a0
Author: Jacques Lucke
Date:   Tue Aug 23 12:26:50 2022 +0200
Branches: temp-geometry-nodes-evaluator-refactor
https://developer.blender.org/rB5dbbfc8cc3673b324d46bca3f6f37da1de8d06a0

Merge branch 'master' into temp-geometry-nodes-evaluator-refactor

===================================================================



===================================================================

diff --cc source/blender/editors/space_node/node_draw.cc
index 10f7245d47a,2cee7c4984a..74df17782d9
--- a/source/blender/editors/space_node/node_draw.cc
+++ b/source/blender/editors/space_node/node_draw.cc
@@@ -791,204 -780,262 +793,138 @@@ struct SocketTooltipData 
    bNodeSocket *socket;
  };
  
 -static void create_inspection_string_for_generic_value(const GPointer value, std::stringstream &ss)
 -{
 -  auto id_to_inspection_string = [&](const ID *id, const short idcode) {
 -    ss << (id ? id->name + 2 : TIP_("None")) << " (" << TIP_(BKE_idtype_idcode_to_name(idcode))
 -       << ")";
 -  };
 -
 -  const CPPType &type = *value.type();
 -  const void *buffer = value.get();
 -  if (type.is<Object *>()) {
 -    id_to_inspection_string(*static_cast<const ID *const *>(buffer), ID_OB);
 -  }
 -  else if (type.is<Material *>()) {
 -    id_to_inspection_string(*static_cast<const ID *const *>(buffer), ID_MA);
 -  }
 -  else if (type.is<Tex *>()) {
 -    id_to_inspection_string(*static_cast<const ID *const *>(buffer), ID_TE);
 -  }
 -  else if (type.is<Image *>()) {
 -    id_to_inspection_string(*static_cast<const ID *const *>(buffer), ID_IM);
 -  }
 -  else if (type.is<Collection *>()) {
 -    id_to_inspection_string(*static_cast<const ID *const *>(buffer), ID_GR);
 -  }
 -  else if (type.is<int>()) {
 -    ss << *(int *)buffer << TIP_(" (Integer)");
 -  }
 -  else if (type.is<float>()) {
 -    ss << *(float *)buffer << TIP_(" (Float)");
 -  }
 -  else if (type.is<blender::float3>()) {
 -    ss << *(blender::float3 *)buffer << TIP_(" (Vector)");
 -  }
 -  else if (type.is<bool>()) {
 -    ss << ((*(bool *)buffer) ? TIP_("True") : TIP_("False")) << TIP_(" (Boolean)");
 -  }
 -  else if (type.is<std::string>()) {
 -    ss << *(std::string *)buffer << TIP_(" (String)");
 -  }
 -}
 -
 -static void create_inspection_string_for_gfield(const geo_log::GFieldValueLog &value_log,
 -                                                std::stringstream &ss)
 -{
 -  const CPPType &type = value_log.type();
 -  const GField &field = value_log.field();
 -  const Span<std::string> input_tooltips = value_log.input_tooltips();
 -
 -  if (input_tooltips.is_empty()) {
 -    if (field) {
 -      BUFFER_FOR_CPP_TYPE_VALUE(type, buffer);
 -      blender::fn::evaluate_constant_field(field, buffer);
 -      create_inspection_string_for_generic_value({type, buffer}, ss);
 -      type.destruct(buffer);
 -    }
 -    else {
 -      /* Constant values should always be logged. */
 -      BLI_assert_unreachable();
 -      ss << "Value has not been logged";
 -    }
 -  }
 -  else {
 -    if (type.is<int>()) {
 -      ss << TIP_("Integer field");
 -    }
 -    else if (type.is<float>()) {
 -      ss << TIP_("Float field");
 -    }
 -    else if (type.is<blender::float3>()) {
 -      ss << TIP_("Vector field");
 -    }
 -    else if (type.is<bool>()) {
 -      ss << TIP_("Boolean field");
 -    }
 -    else if (type.is<std::string>()) {
 -      ss << TIP_("String field");
 -    }
 -    else if (type.is<blender::ColorGeometry4f>()) {
 -      ss << TIP_("Color field");
 -    }
 -    ss << TIP_(" based on:\n");
 -
 -    for (const int i : input_tooltips.index_range()) {
 -      const blender::StringRef tooltip = input_tooltips[i];
 -      ss << "\u2022 " << tooltip;
 -      if (i < input_tooltips.size() - 1) {
 -        ss << ".\n";
 -      }
 -    }
 -  }
 -}
 -
 -static void create_inspection_string_for_geometry(const geo_log::GeometryValueLog &value_log,
 -                                                  std::stringstream &ss,
 -                                                  const nodes::decl::Geometry *geometry)
 -{
 -  Span<GeometryComponentType> component_types = value_log.component_types();
 -  if (component_types.is_empty()) {
 -    ss << TIP_("Empty Geometry");
 -    return;
 -  }
 -
 -  auto to_string = [](int value) {
 -    char str[16];
 -    BLI_str_format_int_grouped(str, value);
 -    return std::string(str);
 -  };
 -
 -  ss << TIP_("Geometry:\n");
 -  for (GeometryComponentType type : component_types) {
 -    const char *line_end = (type == component_types.last()) ? "" : ".\n";
 -    switch (type) {
 -      case GEO_COMPONENT_TYPE_MESH: {
 -        const geo_log::GeometryValueLog::MeshInfo &mesh_info = *value_log.mesh_info;
 -        char line[256];
 -        BLI_snprintf(line,
 -                     sizeof(line),
 -                     TIP_("\u2022 Mesh: %s vertices, %s edges, %s faces"),
 -                     to_string(mesh_info.verts_num).c_str(),
 -                     to_string(mesh_info.edges_num).c_str(),
 -                     to_string(mesh_info.faces_num).c_str());
 -        ss << line << line_end;
 -        break;
 -      }
 -      case GEO_COMPONENT_TYPE_POINT_CLOUD: {
 -        const geo_log::GeometryValueLog::PointCloudInfo &pointcloud_info =
 -            *value_log.pointcloud_info;
 -        char line[256];
 -        BLI_snprintf(line,
 -                     sizeof(line),
 -                     TIP_("\u2022 Point Cloud: %s points"),
 -                     to_string(pointcloud_info.points_num).c_str());
 -        ss << line << line_end;
 -        break;
 -      }
 -      case GEO_COMPONENT_TYPE_CURVE: {
 -        const geo_log::GeometryValueLog::CurveInfo &curve_info = *value_log.curve_info;
 -        char line[256];
 -        BLI_snprintf(line,
 -                     sizeof(line),
 -                     TIP_("\u2022 Curve: %s splines"),
 -                     to_string(curve_info.splines_num).c_str());
 -        ss << line << line_end;
 -        break;
 -      }
 -      case GEO_COMPONENT_TYPE_INSTANCES: {
 -        const geo_log::GeometryValueLog::InstancesInfo &instances_info = *value_log.instances_info;
 -        char line[256];
 -        BLI_snprintf(line,
 -                     sizeof(line),
 -                     TIP_("\u2022 Instances: %s"),
 -                     to_string(instances_info.instances_num).c_str());
 -        ss << line << line_end;
 -        break;
 -      }
 -      case GEO_COMPONENT_TYPE_VOLUME: {
 -        ss << TIP_("\u2022 Volume") << line_end;
 -        break;
 -      }
 -      case GEO_COMPONENT_TYPE_EDIT: {
 -        if (value_log.edit_data_info.has_value()) {
 -          const geo_log::GeometryValueLog::EditDataInfo &edit_info = *value_log.edit_data_info;
 -          char line[256];
 -          BLI_snprintf(line,
 -                       sizeof(line),
 -                       TIP_("\u2022 Edit Curves: %s, %s"),
 -                       edit_info.has_deformed_positions ? TIP_("positions") : TIP_("no positions"),
 -                       edit_info.has_deform_matrices ? TIP_("matrices") : TIP_("no matrices"));
 -          ss << line << line_end;
 -        }
 -        break;
 -      }
 -    }
 -  }
 -
 -  /* If the geometry declaration is null, as is the case for input to group output,
 -   * or it is an output socket don't show supported types. */
 -  if (geometry == nullptr || geometry->in_out() == SOCK_OUT) {
 -    return;
 -  }
 -
 -  Span<GeometryComponentType> supported_types = geometry->supported_types();
 -  if (supported_types.is_empty()) {
 -    ss << ".\n\n" << TIP_("Supported: All Types");
 -    return;
 -  }
 -
 -  ss << ".\n\n" << TIP_("Supported: ");
 -  for (GeometryComponentType type : supported_types) {
 -    switch (type) {
 -      case GEO_COMPONENT_TYPE_MESH: {
 -        ss << TIP_("Mesh");
 -        break;
 -      }
 -      case GEO_COMPONENT_TYPE_POINT_CLOUD: {
 -        ss << TIP_("Point Cloud");
 -        break;
 -      }
 -      case GEO_COMPONENT_TYPE_CURVE: {
 -        ss << TIP_("Curve");
 -        break;
 -      }
 -      case GEO_COMPONENT_TYPE_INSTANCES: {
 -        ss << TIP_("Instances");
 -        break;
 -      }
 -      case GEO_COMPONENT_TYPE_VOLUME: {
 -        ss << TIP_("Volume");
 -        break;
 -      }
 -      case GEO_COMPONENT_TYPE_EDIT: {
 -        break;
 -      }
 -    }
 -    ss << ((type == supported_types.last()) ? "" : ", ");
 -  }
 +// static void create_inspection_string_for_generic_value(const GPointer value, std::stringstream
 +// &ss)
 +// {
 +//   auto id_to_inspection_string = [&](const ID *id, const short idcode) {
 +//     ss << (id ? id->name + 2 : TIP_("None")) << " (" << TIP_(BKE_idtype_idcode_to_name(idcode))
 +//        << ")";
 +//   };
 +
 +//   const CPPType &type = *value.type();
 +//   const void *buffer = value.get();
 +//   if (type.is<Object *>()) {
 +//     id_to_inspection_string(*static_cast<const ID *const *>(buffer), ID_OB);
 +//   }
 +//   else if (type.is<Material *>()) {
 +//     id_to_inspection_string(*static_cast<const ID *const *>(buffer), ID_MA);
 +//   }
 +//   else if (type.is<Tex *>()) {
 +//     id_to_inspection_string(*static_cast<const ID *const *>(buffer), ID_TE);
 +//   }
 +//   else if (type.is<Image *>()) {
 +//     id_to_inspection_string(*static_cast<const ID *const *>(buffer), ID_IM);
 +//   }
 +//   else if (type.is<Collection *>()) {
 +//     id_to_inspection_string(*static_cast<const ID *const *>(buffer), ID_GR);
 +//   }
 +//   else if (type.is<int>()) {
 +//     ss << *(int *)buffer << TIP_(" (Integer)");
 +//   }
 +//   else if (type.is<float>()) {
 +//     ss << *(float *)buffer << TIP_(" (Float)");
 +//   }
 +//   else if (type.is<blender::float3>()) {
 +//     ss << *(blender::float3 *)buffer << TIP_(" (Vector)");
 +//   }
 +//   else if (type.is<bool>()) {
 +//     ss << ((*(bool *)buffer) ? TIP_("True") : TIP_("False")) << TIP_(" (Boolean)");
 +//   }
 +//   else if (type.is<std::string>()) {
 +//     ss << *(std::string *)buffer << TIP_(" (String)");
 +//   }
 +// }
 +
 +// static void create_inspection_string_for_gfield(const geo_log::GFieldValueLog &value_log,
 +//                                                 std::stringstream &ss)
 +// {
 +//   const CPPType &type = value_log.type();
 +//   const GField &field = value_log.field();
 +//   const Span<std::string> input_tooltips = value_log.input_tooltips();
 +
 +//   if (input_tooltips.is_empty()) {
 +//     if (field) {
 +//       BUFFER_FOR_CPP_TYPE_VALUE(type, buffer);
 +//       blender::fn::evaluate_constant_field(field, buffer);
 +//       create_inspection_string_for_generic_value({type, buffer}, ss);
 +//       type.destruct(buffer);
 +//     }
 +//   

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list