36 #include "SOP_CopyToPointsHDK.proto.h"
62 namespace HDK_Sample {
64 using namespace GU_Copy;
83 {
return COOK_GENERIC; }
85 void cook(
const CookParms &cookparms)
const override;
116 cppname "SourceGroup"
120 parmtag { "script_action" "import soputils\nkwargs['geometrytype'] = kwargs['node'].parmTuple('sourcegrouptype')\nkwargs['inputindex'] = 0\nsoputils.selectGroupParm(kwargs)" }
121 parmtag { "script_action_help" "Select geometry from an available viewport.\nShift-click to turn on Select Groups." }
122 parmtag { "script_action_icon" "BUTTONS_reselect" }
123 parmtag { "sop_input" "0" }
126 name "sourcegrouptype"
127 cppname "SourceGroupType"
128 label "Source Group Type"
132 "guess" "Guess from Group"
139 cppname "TargetGroup"
140 label "Target Points"
143 parmtag { "script_action" "import soputils\nkwargs['geometrytype'] = (hou.geometryType.Points,)\nkwargs['inputindex'] = 1\nsoputils.selectGroupParm(kwargs)" }
144 parmtag { "script_action_help" "Select geometry from an available viewport.\nShift-click to turn on Select Groups." }
145 parmtag { "script_action_icon" "BUTTONS_reselect" }
146 parmtag { "sop_input" "1" }
150 cppname "UseIDAttrib"
151 label "Piece Attribute"
160 label "Piece Attribute"
162 default { "variant" }
163 parmtag { "sop_input" "1" }
164 disablewhen "{ useidattrib == 0 }"
168 label "Pack and Instance"
174 label "Pivot Location"
176 default { "centroid" }
177 hidewhen "{ pack == 0 }"
180 "centroid" "Centroid"
185 cppname "ViewportLOD"
189 hidewhen "{ pack == 0 }"
191 "full" "Full Geometry"
192 "points" "Point Cloud"
194 "centroid" "Centroid"
200 label "Transform Using Target Point Orientations"
206 cppname "UseImplicitN"
207 label "Transform Using Implicit Target Point Normals If No Point N Attribute"
210 disablewhen "{ transform == 0 }"
213 name "resettargetattribs"
214 label "Reset Attributes from Target"
220 cppname "TargetAttribs"
221 label "Attributes from Target"
226 label "Apply Attributes"
262 parmtag { "sop_input" "1" }
275 static const char *
const theViewportLODNames[5] =
296 using namespace SOP_CopyToPointsHDKEnums;
302 case Pivot::CENTROID:
322 void resetTargetAttribs();
325 const char *inputLabel(
unsigned idx)
const override;
326 int isRefInput(
unsigned int i)
const;
330 sopResetTargetAttribsWrapper(
345 setInt(
"targetattribs", 0,
fpreal(0.0), 3);
346 int multiparm_index = 1;
347 setIntInst(1,
"useapply#", &multiparm_index, 0,
fpreal(0.0));
348 setIntInst(0,
"applyto#", &multiparm_index, 0,
fpreal(0.0));
349 setIntInst(
int(sop_AttribCombineMethod::COPY),
"applymethod#", &multiparm_index, 0,
fpreal(0.0));
350 setStringInst(
"*,^v,^Alpha,^N,^up,^pscale,^scale,^orient,^rot,^pivot,^trans,^transform",
CH_StringMeaning::CH_STRING_LITERAL,
"applyattribs#", &multiparm_index, 0,
fpreal(0.0));
352 setIntInst(1,
"useapply#", &multiparm_index, 0,
fpreal(0.0));
353 setIntInst(0,
"applyto#", &multiparm_index, 0,
fpreal(0.0));
354 setIntInst(
int(sop_AttribCombineMethod::MULTIPLY),
"applymethod#", &multiparm_index, 0,
fpreal(0.0));
357 setIntInst(1,
"useapply#", &multiparm_index, 0,
fpreal(0.0));
358 setIntInst(0,
"applyto#", &multiparm_index, 0,
fpreal(0.0));
359 setIntInst(
int(sop_AttribCombineMethod::ADD),
"applymethod#", &multiparm_index, 0,
fpreal(0.0));
364 sopApproveStringIntAttribs(
const GA_Attribute *attrib,
void*)
376 sopBuildStringIntPointAttribMenu(
377 void *data,
PRM_Name *menu_entries,
int menu_size,
380 SOP_CopyToPointsHDK *sop = (SOP_CopyToPointsHDK *)data;
381 if (!sop || !sop->getInput(1))
384 sop->fillAttribNameMenu(menu_entries, menu_size,
389 sopBuildTargetPointAttribMenu(
390 void *data,
PRM_Name *menu_entries,
int menu_size,
393 SOP_CopyToPointsHDK *sop = (SOP_CopyToPointsHDK *)data;
394 if (!sop || !sop->getInput(1))
397 sop->fillAttribNameMenu(menu_entries, menu_size,
403 sopBuildStringIntPointAttribMenu);
407 sopBuildTargetPointAttribMenu);
419 templ.
setCallback(
"resettargetattribs", &sopResetTargetAttribsWrapper);
451 if (param_group_type == SOP_CopyToPointsHDKEnums::SourceGroupType::POINTS)
453 else if (param_group_type == SOP_CopyToPointsHDKEnums::SourceGroupType::PRIMS)
457 OP_ERROR ret =
cookInputAllGroups(context, source_group, alone,
true, 0, 1, group_type,
true,
true,
false,
GroupCreator(detail));
488 "HDK Copy to Points",
497 namespace HDK_Sample {
505 const SOP_CopyToPointsHDKParms &sopparms,
506 SOP_CopyToPointsHDKCache *sopcache,
511 const bool source_topology_changed,
535 buf.
appendSprintf(
"Target Piece Attribute (%s) is a floating-point "
536 "attribute; it must be an integer or string attribute, "
537 "so ignoring Piece Attribute.",
538 idattribname.
c_str());
544 if (!source_int_idattrib.
isValid())
552 target_int_idattrib.
bind(idnumeric);
559 if (!source_str_idattrib.
isValid())
563 if (!source_str_idattrib.
isValid())
567 "attribute; source has no corresponding string point or "
568 "primitive attribute, so ignoring Piece Attribute.",
569 idattribname.
c_str());
574 target_str_idattrib.
bind(idstring);
575 source_id_owner = source_str_idattrib->
getOwner();
581 "or string attribute in the target input, so ignoring Piece Attribute.",
582 idattribname.
c_str());
587 bool target_group_changed =
588 (target_group !=
nullptr) != (sopcache->myPrevHadTargetGroup);
589 bool target_group_maybe_changed = target_group_changed;
590 if (!target_group_changed && target_group)
594 bool different_group = target_group->
isDetached() ||
595 (target_group->
getDataId() != sopcache->myPrevTargetGroupDataID);
596 target_group_maybe_changed = different_group;
602 bool topology_changed =
603 (output_geo->
getUniqueId() != sopcache->myPrevOutputDetailID) ||
604 source_topology_changed ||
605 target_group_changed ||
606 (sopparms.getPack() != sopcache->myPrevPack);
609 topology_changed |= (target_idattrib_dataid != sopcache->myTargetIDAttribDataID);
610 sopcache->myTargetIDAttribDataID = target_idattrib_dataid;
612 topology_changed |= (source_id_owner != sopcache->mySourceIDAttribOwner);
613 sopcache->mySourceIDAttribOwner = source_id_owner;
616 if (source_int_idattrib.
isValid())
618 source_idattrib_dataid = source_int_idattrib->
getDataId();
619 topology_changed |= (source_idattrib_dataid != sopcache->mySourceIDAttribDataID);
621 else if (source_str_idattrib.
isValid())
623 source_idattrib_dataid = source_str_idattrib->
getDataId();
624 topology_changed |= (source_idattrib_dataid != sopcache->mySourceIDAttribDataID);
633 sopcache->mySourceIDAttribDataID = source_idattrib_dataid;
635 using PieceData = SOP_CopyToPointsHDKCache::PieceData;
639 bool recompute_mapping = topology_changed || target_group_maybe_changed;
640 if (recompute_mapping)
651 if (target_int_idattrib.
isValid())
667 bool new_value = !target_int_to_source.
contains(value);
670 std::pair<exint,GA_OffsetList> &pair = target_int_to_source[
value];
672 pair.first =
GA_Size(end-start);
675 pair.first +=
GA_Size(end-start);
679 if (!source_int_idattrib.
isValid() &&
686 if (!source_primgroup || source_primgroup->
contains(source_primoff))
687 pair.second.append(source_primoff);
692 for (
GA_Offset target_ptoff = start; target_ptoff <
end; ++target_ptoff)
694 exint value = target_int_idattrib.
get(target_ptoff);
699 bool new_value = !target_int_to_source.
contains(value);
702 std::pair<exint,GA_OffsetList> &pair = target_int_to_source[
value];
711 if (!source_int_idattrib.
isValid() &&
718 if (!source_primgroup || source_primgroup->
contains(source_primoff))
719 pair.second.append(source_primoff);
725 if (source_int_idattrib.
isValid())
745 exint value = source_int_idattrib.
get(start);
749 if (!target_int_to_source.
contains(value))
758 for (
GA_Offset source_offset = start; source_offset <
end; ++source_offset)
760 exint value = source_int_idattrib.
get(source_offset);
764 if (!target_int_to_source.
contains(value))
768 list.
append(source_offset);
776 exint original_num_integers = target_int_to_source.
size();
777 for (
auto it = target_int_to_source.
begin(); !it.atEnd(); )
779 if (it->second.second.size() == 0)
780 it = target_int_to_source.
erase(it);
784 if (target_int_to_source.
size() != original_num_integers)
786 for (
exint i = 0,
n = input_target_point_list.
size(); i <
n; ++i)
788 GA_Offset ptoff = input_target_point_list[i];
789 exint value = target_int_idattrib.
get(ptoff);
790 if (target_int_to_source.
contains(value))
791 limited_target_point_list_nc.append(ptoff);
793 input_target_point_list = std::move(limited_target_point_list_nc);
811 bool new_value = !target_str_to_source.
contains(value);
814 std::pair<exint,GA_OffsetList> &pair = target_str_to_source[
value];
816 pair.first =
GA_Size(end-start);
818 pair.first +=
GA_Size(end-start);
822 for (
GA_Offset target_ptoff = start; target_ptoff <
end; ++target_ptoff)
827 bool new_value = !target_str_to_source.
contains(value);
830 std::pair<exint,GA_OffsetList> &pair = target_str_to_source[
value];
857 if (!target_str_to_source.
contains(value))
866 for (
GA_Offset source_offset = start; source_offset <
end; ++source_offset)
870 if (!target_str_to_source.
contains(value))
874 list.
append(source_offset);
881 exint original_num_strings = target_str_to_source.
size();
882 for (
auto it = target_str_to_source.
begin(); !it.atEnd(); )
884 if (it->second.second.size() == 0)
885 it = target_str_to_source.
erase(it);
889 if (target_str_to_source.
size() != original_num_strings)
891 for (
exint i = 0, n = input_target_point_list.
size(); i <
n; ++i)
893 GA_Offset ptoff = input_target_point_list[i];
895 if (target_str_to_source.
contains(value))
896 limited_target_point_list_nc.append(ptoff);
898 input_target_point_list = std::move(limited_target_point_list_nc);
904 target_group_changed |=
905 (!target_group && input_target_point_list.
size() != sopcache->myPrevTargetPtCount);
906 if (!target_group_changed && target_group)
909 bool different_group = target_group->
isDetached() ||
910 (target_group->
getDataId() != sopcache->myPrevTargetGroupDataID);
913 UT_ASSERT(sopcache->myTargetOffsetList.size() == input_target_point_list.
size());
914 bool equal_group = sopcache->myTargetOffsetList.isEqual(input_target_point_list, 0, input_target_point_list.
size());
917 target_group_changed =
true;
921 sopcache->myTargetOffsetList = input_target_point_list;
922 sopcache->myPrevHadTargetGroup = (target_group !=
nullptr);
924 topology_changed |= target_group_changed;
929 if (topology_changed)
936 if (!target_int_to_source.
empty())
940 for (
auto it = target_int_to_source.
ordered_begin(std::less<exint>()); !it.atEnd(); ++it, ++piecei)
942 PieceData ¤t_piece = piece_data[piecei];
943 current_piece.myRefCount = it->second.first;
945 it->second.first = piecei;
947 current_piece.mySourceOffsetLists[source_id_owner] = std::move(it->second.second);
950 else if (!target_str_to_source.
empty())
954 for (
auto it = target_str_to_source.
ordered_begin(std::less<UT_StringHolder>()); !it.atEnd(); ++it, ++piecei)
956 PieceData ¤t_piece = piece_data[piecei];
957 current_piece.myRefCount = it->second.first;
959 it->second.first = piecei;
961 current_piece.mySourceOffsetLists[source_id_owner] = std::move(it->second.second);
965 exint num_target_points = input_target_point_list.
size();
970 if (target_int_idattrib.
isValid())
972 for (
exint target_pointi = 0; target_pointi < num_target_points; ++target_pointi)
974 GA_Offset target_ptoff = input_target_point_list[target_pointi];
975 exint target_value = target_int_idattrib.
get(target_ptoff);
976 exint piecei = target_int_to_source[target_value].first;
977 target_to_piecei[target_pointi] = piecei;
983 for (
exint target_pointi = 0; target_pointi < num_target_points; ++target_pointi)
985 GA_Offset target_ptoff = input_target_point_list[target_pointi];
987 exint piecei = target_str_to_source[target_value].first;
988 target_to_piecei[target_pointi] = piecei;
996 bool had_transform_matrices = (sopcache->myTransformMatrices3D.get() !=
nullptr);
1004 bool transforms_changed = target_group_changed;
1005 GUsetupPointTransforms(sopcache, target_point_list, target, sopparms.getTransform(), sopparms.getUseImplicitN(), transforms_changed);
1007 const bool has_transform_matrices = (sopcache->myTransformMatrices3D.get() !=
nullptr);
1009 if (topology_changed)
1012 const exint npieces = piece_data.
size();
1013 for (
exint piecei = 0; piecei < npieces; ++piecei)
1015 PieceData ¤t_piece = piece_data[piecei];
1025 if (source_point_list.
size() == 1)
1040 source_prim_list.
append(primoff);
1048 for (
exint i = 0, n = source_point_list.
size(); i <
n; ++i)
1051 points_in_piece.
set<
true>(ptoff);
1055 prims_in_piece.set<
true>(primoff);
1066 prims_in_piece.getConstantSpan(start, end, size, value);
1073 for (
GA_Offset primoff = start; primoff < local_end; ++primoff)
1075 bool all_points_present =
true;
1077 for (
exint i = 0, n = vertices.
size(); i <
n; ++i)
1080 all_points_present &= points_in_piece.get(ptoff);
1082 if (all_points_present)
1083 source_prim_list.
append(primoff);
1101 for (
exint i = 0, n = source_prim_list.
size(); i <
n; ++i)
1103 GA_Offset primoff = source_prim_list[i];
1105 for (
exint i = 0, n = vertices.
size(); i <
n; ++i)
1108 points_in_piece.set<
true>(ptoff);
1117 points_in_piece.getConstantSpan(start, end, size, value);
1131 for (
exint i = 0, n = source_prim_list.
size(); i <
n; ++i)
1133 GA_Offset primoff = source_prim_list[i];
1135 source_vert_list.
append(vertices);
1139 exint nvertices = source_vert_list.
size();
1140 if (nvertices < 16 || source_point_list.
isTrivial())
1145 for (
exint i = 0; i < nvertices; ++i)
1149 exint rel_pointi = source_point_list.
find(ptoff);
1150 current_piece.myRelVtxToPt.append(rel_pointi);
1157 exint npoints = source_point_list.
size();
1160 ptoff_to_piecei.
reserve(npoints);
1162 for (
exint pointi = 0; pointi < npoints; ++pointi)
1164 GA_Offset ptoff = source_point_list[pointi];
1165 ptoff_to_piecei[ptoff] = pointi;
1168 for (
exint i = 0; i < nvertices; ++i)
1172 exint rel_pointi = ptoff_to_piecei[ptoff];
1173 current_piece.myRelVtxToPt.append(rel_pointi);
1179 const exint npieces = piece_data.
size();
1180 const exint num_target_points = target_to_piecei.
size();
1182 if (sopparms.getPack())
1184 const GEO_ViewportLOD lod = sopViewportLODFromParam(sopparms.getViewportLOD());
1185 const bool source_changed =
1186 source->
getUniqueId() != sopcache->myPrevSourceUniqueID ||
1188 source_topology_changed;
1189 const bool lod_changed = (lod != sopcache->myPrevViewportLOD);
1190 const bool source_intrinsic_changed =
1192 sopCachePivotType(sopparms.getPivot()) != sopcache->myPrevPivotEnum ||
1200 if (topology_changed || source_changed)
1204 if (num_target_points > 0)
1208 packed_geos.setSizeNoInit(npieces);
1212 for (
exint piecei = r.begin(), end = r.end(); piecei <
end; ++piecei)
1214 PieceData ¤t_piece = piece_data[piecei];
1229 exint num_source_attribs[3] = {0,0,0};
1231 "Array above depends on owners other than detail being less than 3");
1235 num_source_attribs);
1244 "Arrays above and loop below are assuming the order of GA_AttributeOwner enum");
1249 output_splittable_ranges,
1253 current_piece.mySourceOffsetLists,
1272 packed_geos[piecei] = packed_geo;
1277 bool centroid_pivot = (sopparms.getPivot() == SOP_CopyToPointsHDKEnums::Pivot::CENTROID);
1279 if (topology_changed || source_intrinsic_changed)
1284 auto &&functor = [output_geo,&packed_geos,start_primoff,
1285 &target_to_piecei,centroid_pivot,
lod,
1288 exint target_pointi =
GA_Size(r.begin()-start_primoff);
1289 for (
GA_Offset primoff = r.begin(), end = r.end(); primoff <
end; ++primoff, ++target_pointi)
1293 exint piecei = target_to_piecei[target_pointi];
1295 if (topology_changed || source_changed)
1323 constexpr
exint PARALLEL_THRESHOLD = 256;
1324 if (num_target_points >= PARALLEL_THRESHOLD)
1327 functor(prim_range);
1330 const bool pivots_changed =
1331 sopCachePivotType(sopparms.getPivot()) != sopcache->myPrevPivotEnum ||
1332 (centroid_pivot && source_changed);
1341 had_transform_matrices,
1346 !centroid_pivot ? &pivot :
nullptr);
1348 if (topology_changed)
1356 if (transforms_changed || pivots_changed)
1361 bool has_transform_matrices = (sopcache->myTransformMatrices3D.get() !=
nullptr);
1362 if ((has_transform_matrices || had_transform_matrices) && !source_changed)
1370 sopcache->myPrevPack =
true;
1371 sopcache->myPrevTargetPtCount = num_target_points;
1372 sopcache->myPrevSourceGroupDataID = source->
getUniqueId();
1374 sopcache->myPrevPivotEnum = sopCachePivotType(sopparms.getPivot());
1375 sopcache->myPrevViewportLOD =
lod;
1376 sopcache->myPrevOutputDetailID = output_geo->
getUniqueId();
1377 sopcache->myPrevSourceUniqueID = source->
getUniqueId();
1387 sopcache->mySourceEdgeGroupDataIDs.clear();
1395 if (topology_changed)
1401 for (
exint piecei = r.begin(), end = r.end(); piecei <
end; ++piecei)
1403 PieceData ¤t_piece = piece_data[piecei];
1414 bool hassharedpoints =
true;
1417 bool hascontiguouspoints =
false;
1421 exint piece_point_count = piece_point_list.
size();
1422 exint piece_vertex_count = piece_vertex_list.
size();
1423 exint piece_prim_count = piece_prim_list.
size();
1424 UT_ASSERT_P(piece_vertex_count == current_piece.myRelVtxToPt.size());
1425 if (piece_point_count >= piece_vertex_count)
1432 hascontiguouspoints = current_piece.myRelVtxToPt.isTrivial();
1433 hassharedpoints =
false;
1435 if (!hascontiguouspoints && piece_vertex_count > 0)
1441 exint last_point = current_piece.myRelVtxToPt[0];
1442 for (
exint vtxi = 1; vtxi < piece_vertex_count; ++vtxi)
1444 exint current_point = current_piece.myRelVtxToPt[vtxi];
1451 hassharedpoints |= (current_point <= last_point);
1452 if (hassharedpoints)
1454 last_point = current_point;
1458 current_piece.myHasSharedPoints = hassharedpoints;
1459 current_piece.myHasContiguousPoints = hascontiguouspoints;
1461 GA_PolyCounts &vertexlistsizelist = current_piece.myVertexListSizeList;
1462 vertexlistsizelist.
clear();
1463 auto &prim_type_count_pairs = current_piece.myPrimTypeCountPairs;
1464 prim_type_count_pairs.clear();
1466 closed_span_lengths.
clear();
1468 if (piece_prim_count > 0)
1473 vertexlistsizelist.
append(vertex_count);
1476 prim_type_count_pairs.append(std::make_pair(primtype,1));
1483 closed_span_lengths.
append(0);
1485 closed_span_lengths.
append(1);
1487 for (
exint primi = 1; primi < piece_prim_count; ++primi)
1489 GA_Offset primoff = piece_prim_list[primi];
1492 vertexlistsizelist.
append(vertex_count);
1495 if (prim_type_count_pairs.last().first == primtype)
1496 ++(prim_type_count_pairs.last().second);
1498 prim_type_count_pairs.append(std::make_pair(primtype,1));
1504 if ((closed_span_lengths.
size()&1) ==
exint(closed))
1505 closed_span_lengths.
append(1);
1507 ++(closed_span_lengths.
last());
1515 bool hassharedpoints =
false;
1516 bool hascontiguouspoints =
true;
1517 exint total_nvertices = 0;
1518 exint total_nprims = 0;
1519 for (
exint piecei = 0; piecei < npieces; ++piecei)
1521 PieceData ¤t_piece = piece_data[piecei];
1522 hassharedpoints |= current_piece.myHasSharedPoints;
1523 hascontiguouspoints &= current_piece.myHasContiguousPoints;
1526 total_nvertices += current_piece.myRefCount * piece_nvertices;
1527 total_nprims += current_piece.myRefCount * piece_nprims;
1533 if (total_nprims > 0)
1534 closed_span_lengths.
append(0);
1538 vertexpointnumbers.
setSizeNoInit(hascontiguouspoints ? 0 : total_nvertices);
1545 exint piece_point_start = 0;
1546 exint piece_vertex_start = 0;
1547 exint piece_prim_start = 0;
1548 for (
exint targeti = 0; targeti < num_target_points; ++targeti)
1550 exint piecei = target_to_piecei[targeti];
1551 PieceData ¤t_piece = piece_data[piecei];
1553 piece_point_starts[targeti] = piece_point_start;
1554 piece_vertex_starts[targeti] = piece_vertex_start;
1555 piece_prim_starts[targeti] = piece_prim_start;
1561 exint num_prim_type_count_pairs = current_piece.myPrimTypeCountPairs.size();
1562 if (num_prim_type_count_pairs > 0)
1565 if (prim_type_count_pairs.
size() > 0 &&
1566 prim_type_count_pairs.
last().first == current_piece.myPrimTypeCountPairs[0].first)
1568 prim_type_count_pairs.
last().second += current_piece.myPrimTypeCountPairs[0].second;
1571 for (; pairi < num_prim_type_count_pairs; ++pairi)
1573 prim_type_count_pairs.
append(current_piece.myPrimTypeCountPairs[pairi]);
1576 vertexlistsizelist.
append(current_piece.myVertexListSizeList);
1578 if (!vertexpointnumbers.
isEmpty())
1580 for (
exint i = 0; i < local_nvertices; ++i)
1582 vertexpointnumbers[piece_vertex_start+i] = current_piece.myRelVtxToPt[i] + piece_point_start;
1586 auto &local_closed_span_lengths = current_piece.myClosedSpanLengths;
1587 exint spani = (local_closed_span_lengths[0] == 0);
1588 if (((closed_span_lengths.
size()-1)&1) == (spani&1))
1590 closed_span_lengths.
last() += local_closed_span_lengths[spani];
1593 for (
exint nspans = local_closed_span_lengths.size(); spani < nspans; ++spani)
1595 closed_span_lengths.
append(local_closed_span_lengths[spani]);
1599 piece_point_start += local_npoints;
1600 piece_vertex_start += local_nvertices;
1601 piece_prim_start += local_nprims;
1604 exint total_npoints = piece_point_start;
1621 exint num_polys_and_tets =
1628 auto &&functor = [output_geo,
source,&piece_prim_starts,start_primoff,
1631 exint output_primi = r.begin() - start_primoff;
1635 exint targeti = (std::upper_bound(
1636 piece_prim_starts.getArray(),
1637 piece_prim_starts.getArray()+piece_prim_starts.size(),
1638 output_primi) - piece_prim_starts.getArray()) - 1;
1639 UT_ASSERT_P(targeti >= 0 && targeti < num_target_points);
1641 exint piece_prim_start = piece_prim_starts[targeti];
1642 exint piece_primi = output_primi - piece_prim_start;
1643 exint piecei = target_to_piecei[targeti];
1644 PieceData *current_piece = &piece_data[piecei];
1647 for (
GA_Offset dest_off = r.begin(), end = r.end(); dest_off <
end; ++dest_off)
1649 GA_Offset source_off = (*piece_prim_list)[piece_primi];
1650 const GA_Primitive *source_prim = source->getPrimitive(source_off);
1656 while (piece_primi >= piece_prim_list->
size())
1660 if (targeti >= num_target_points)
1662 piecei = target_to_piecei[targeti];
1663 current_piece = &piece_data[piecei];
1678 sopcache->myPrevOutputDetailID = output_geo->
getUniqueId();
1679 sopcache->myPrevTargetPtCount = num_target_points;
1680 sopcache->myPrevPack =
false;
1688 sopcache->mySourceEdgeGroupDataIDs.clear();
1689 sopcache->myTargetAttribInfo.clear();
1690 sopcache->myTargetGroupInfo.clear();
1695 if (!topology_changed)
1702 &target_attrib_info,
1703 &target_group_info);
1708 needed_transforms[i] =
false;
1711 exint num_source_attribs[3] = {0,0,0};
1712 exint num_target_attribs[3] = {0,0,0};
1714 "Arrays above are assuming the order of GA_AttributeOwner enum");
1720 has_transform_matrices,
1723 &target_attrib_info,
1725 num_target_attribs);
1744 "Arrays above and loop below are assuming the order of GA_AttributeOwner enum");
1748 cookparms.
sopAddWarning(
SOP_MESSAGE,
"Edge groups aren't yet supported when Piece Attribute is enabled and Pack and Instance is disabled.");
1753 output_splittable_ranges,
1757 sopcache->mySourceOffsetLists,
1760 had_transform_matrices,
1761 has_transform_matrices,
1765 &target_attrib_info,
1767 target_to_piecei.getArray(),
1768 sopcache->myPieceOffsetStarts,
1769 piece_data.getArray());
1775 output_splittable_ranges,
1787 target_to_piecei.getArray(),
1788 sopcache->myPieceOffsetStarts,
1789 piece_data.getArray());
1791 if (topology_changed)
1804 using namespace SOP_CopyToPointsHDKEnums;
1805 auto &&sopparms = cookparms.
parms<SOP_CopyToPointsHDKParms>();
1821 if (source_groupname.isstring())
1828 const GA_Group *temp_source_group =
1829 group_parser.parseGroupDetached(source_groupname, gagrouptype, source,
true,
true, ok);
1833 if (temp_source_group !=
nullptr)
1835 gagrouptype = temp_source_group->
classType();
1839 source_group = source_primgroup;
1844 source_primgroup_deleter = UTmakeUnique<GA_PrimitiveGroup>(*source);
1845 source_primgroup_deleter->
copyMembership(*source_primgroup,
false);
1846 source_primgroup = source_primgroup_deleter.get();
1850 source_pointgroup_deleter = UTmakeUnique<GA_PointGroup>(*source);
1851 source_pointgroup_deleter->
combine(source_primgroup);
1852 source_pointgroup_deleter->makeUnordered();
1853 source_pointgroup = source_pointgroup_deleter.get();
1858 source_group = source_pointgroup;
1864 source_primgroup_deleter = UTmakeUnique<GA_PrimitiveGroup>(*source);
1865 source_primgroup_deleter->
combine(source_group);
1866 source_primgroup_deleter->makeUnordered();
1867 source_primgroup = source_primgroup_deleter.get();
1869 if (!source_primgroup->
isEmpty())
1877 for (
GA_Offset primoff = start; primoff <
end; ++primoff)
1880 for (
exint i = 0, n = vertices.
size(); i <
n; ++i)
1882 GA_Offset ptoff = source->vertexPoint(vertices[i]);
1883 if (!source_pointgroup->
contains(ptoff))
1885 source_primgroup_deleter->removeOffset(primoff);
1904 if (target_groupname.isstring())
1908 target_group = group_parser.parsePointDetached(target_groupname, target,
true,
true, ok);
1926 target_point_list.setTrivialRange(target_point_list.
size(),
start, end-
start);
1932 GA_DataId source_primlist_data_id = source->getPrimitiveList().getDataId();
1933 GA_DataId source_topology_data_id = source->getTopology().getDataId();
1934 bool source_topology_changed =
1935 source_primlist_data_id != sopcache->myPrevSourcePrimListDataID ||
1936 source_topology_data_id != sopcache->myPrevSourceTopologyDataID;
1937 if (!source_topology_changed)
1939 source_topology_changed |= (source_group !=
nullptr) != (sopcache->myPrevHadSourceGroup);
1940 if (!source_topology_changed && (source_group !=
nullptr))
1942 bool different_group = source_group->isDetached() ||
1943 (source_group->getDataId() != sopcache->myPrevSourceGroupDataID);
1944 if (different_group)
1952 source_topology_changed =
true;
1961 source_topology_changed =
true;
1967 sopcache->myPrevHadSourceGroup = (source_group !=
nullptr);
1968 sopcache->myPrevSourceGroupDataID = ((!source_group || source_group->isDetached()) ?
GA_INVALID_DATAID : source_group->getDataId());
1969 sopcache->myPrevSourcePrimListDataID = source_primlist_data_id;
1970 sopcache->myPrevSourceTopologyDataID = source_topology_data_id;
1971 sopcache->mySourceOffsetLists[
GA_ATTRIB_POINT] = std::move(source_point_list);
1974 exint source_point_count = source_pointgroup ? source_pointgroup->
entries() : source->getNumPoints();
1975 exint source_prim_count = source_primgroup ? source_primgroup->
entries() : source->getNumPrimitives();
1976 exint source_vertex_count = 0;
1977 if (!source_primgroup)
1979 source_vertex_count = source->getNumVertices();
1980 sopcache->mySourceVertexCount = source_vertex_count;
1982 else if (source_primgroup->
entries() > 0)
1984 struct CountVerticesFunctor
1986 CountVerticesFunctor(
const GA_Detail &detail)
1990 CountVerticesFunctor(
const CountVerticesFunctor &that,
UT_Split)
1991 : myDetail(that.myDetail)
1997 auto &primlist = myDetail.getPrimitiveList();
2003 bool constant_page = primlist.isVertexListPageConstant(pagenum);
2006 nvertices += primlist.getConstantVertexListPage(pagenum).size() * (end-
start);
2011 nvertices += myDetail.getPrimitiveVertexCount(off);
2014 myVertexCount += nvertices;
2016 void join(
const CountVerticesFunctor &that)
2018 myVertexCount += that.myVertexCount;
2020 GA_Size getVertexCount()
const
2022 return myVertexCount;
2025 exint myVertexCount;
2027 if (source_topology_changed)
2029 CountVerticesFunctor functor(*source);
2031 source_vertex_count = functor.getVertexCount();
2032 sopcache->mySourceVertexCount = source_vertex_count;
2036 source_vertex_count = sopcache->mySourceVertexCount;
2061 for (
exint target_attribsi = 0, ntarget_attribs = target_attribs.size(); target_attribsi < ntarget_attribs; ++target_attribsi)
2063 const SOP_CopyToPointsHDKParms::TargetAttribs &target_attrib_pattern = target_attribs[target_attribsi];
2064 if (!target_attrib_pattern.useapply)
2067 const UT_StringHolder &attrib_pattern = target_attrib_pattern.applyattribs;
2068 if (!attrib_name_wrap.multiMatch(attrib_pattern))
2074 if (target_attrib_pattern.applyto == 0)
2076 else if (target_attrib_pattern.applyto == 1)
2081 sop_AttribCombineMethod method = sop_AttribCombineMethod(target_attrib_pattern.applymethod);
2087 target_group_info.erase(attrib_name);
2089 target_attrib_info.erase(attrib_name);
2095 target_group_info[attrib_name] :
2096 target_attrib_info[attrib_name];
2104 method != sop_AttribCombineMethod::COPY)
2106 method = sop_AttribCombineMethod::COPY;
2112 if (sopparms.getUseIDAttrib() && sopparms.getIDAttrib().isstring())
2114 bool used_idattrib = sopCopyByIDAttrib(
2122 source_topology_changed,
2137 if (
GAisValid(sopcache->myTargetIDAttribDataID))
2142 source_topology_changed =
true;
2143 sopcache->myPrevOutputDetailID = -1;
2147 sopcache->myPieceData.clear();
2148 sopcache->myTargetToPiece.clear();
2160 bool target_group_changed =
2161 (target_group !=
nullptr) != (sopcache->myPrevHadTargetGroup) ||
2162 (target_point_list.
size() != sopcache->myPrevTargetPtCount);
2163 if (!target_group_changed && (target_group!=
nullptr))
2166 bool different_group = target_group->
isDetached() ||
2167 (target_group->
getDataId() != sopcache->myPrevTargetGroupDataID);
2168 if (different_group)
2170 UT_ASSERT(sopcache->myTargetOffsetList.size() == target_point_list.
size());
2171 bool equal_group = sopcache->myTargetOffsetList.isEqual(target_point_list, 0, target_point_list.
size());
2174 target_group_changed =
true;
2178 sopcache->myTargetOffsetList = target_point_list;
2179 sopcache->myPrevHadTargetGroup = (target_group !=
nullptr);
2184 const bool had_transform_matrices = (sopcache->myTransformMatrices3D.get() !=
nullptr);
2188 bool transforms_changed = target_group_changed;
2189 GUsetupPointTransforms(sopcache, target_point_list, target, sopparms.getTransform(), sopparms.getUseImplicitN(), transforms_changed);
2191 const bool has_transform_matrices = (sopcache->myTransformMatrices3D.get() !=
nullptr);
2193 GA_Size num_target_points = target_point_list.
size();
2195 if (sopparms.getPack())
2197 const GEO_ViewportLOD lod = sopViewportLODFromParam(sopparms.getViewportLOD());
2209 source_topology_changed,
2210 had_transform_matrices,
2215 &target_attrib_info,
2216 &target_group_info);
2225 sopcache->mySourceEdgeGroupDataIDs.clear();
2233 bool topology_changed =
2234 (output_detail_id != sopcache->myPrevOutputDetailID) ||
2235 source_topology_changed ||
2236 (num_target_points != sopcache->myPrevTargetPtCount) ||
2237 sopcache->myPrevPack;
2238 if (topology_changed)
2246 source_vertex_count,
2255 sopcache->myPrevOutputDetailID = output_detail_id;
2256 sopcache->myPrevTargetPtCount = num_target_points;
2257 sopcache->myPrevPack =
false;
2265 sopcache->mySourceEdgeGroupDataIDs.clear();
2266 sopcache->myTargetAttribInfo.clear();
2267 sopcache->myTargetGroupInfo.clear();
2310 if (!topology_changed)
2317 &target_attrib_info,
2318 &target_group_info);
2323 needed_transforms[i] =
false;
2326 exint num_source_attribs[3] = {0,0,0};
2327 exint num_target_attribs[3] = {0,0,0};
2329 "Arrays above are assuming the order of GA_AttributeOwner enum");
2335 has_transform_matrices,
2338 &target_attrib_info,
2340 num_target_attribs);
2359 "Arrays above and loop below are assuming the order of GA_AttributeOwner enum");
2363 output_splittable_ranges,
2367 sopcache->mySourceOffsetLists,
2370 had_transform_matrices,
2371 has_transform_matrices,
2375 &target_attrib_info,
2376 &target_group_info);
2382 output_splittable_ranges,
2386 source_vertex_count,
2395 if (topology_changed)
2406 case 0:
return "Geometry to Copy";
2407 case 1:
return "Target Points to Copy to";
2410 return "Invalid Source";
static PRM_ChoiceList primGroupMenu
static SYS_FORCE_INLINE bool isType(const GA_Attribute *attrib)
SYS_FORCE_INLINE void bumpDataId()
SYS_FORCE_INLINE void forEachAttribute(FUNCTOR &&functor) const
SOP_CopyToPointsHDKVerb()
Definition of a geometry attribute.
SYS_FORCE_INLINE GA_Offset getPrimitiveVertexOffset(GA_Offset primoff, GA_Size i) const
~SOP_CopyToPointsHDKVerb() override
SYS_FORCE_INLINE GA_Primitive * getPrimitive(GA_Offset prim_off)
GU_API void GUcreatePointOrPrimList(GA_OffsetList &offset_list, const GU_Detail *const detail, const GA_ElementGroup *const group, const GA_AttributeOwner owner)
UT::ArraySet< std::pair< Key, T >, MULTI, MAX_LOAD_FACTOR_256, Clearer, MapKeyHash< Hash, Key, T >, MapKeyEqual< KeyEqual, Key, T > >::size size_type size() const
Returns the number of items in the set.
SYS_FORCE_INLINE const GA_AttributeDict & pointAttribs() const
SOP_Node * getNode() const
bool copyMembership(const GA_ATIGroupBool &src, bool copy_ordering=true)
int isRefInput(unsigned int i) const
FromType append(ToType value)
Add a single entry (may grow array)
void UTparallelForEachNumber(IntType nitems, const Body &body)
GA_Range getVertexRange(const GA_VertexGroup *group=0) const
Get a range of all vertices in the detail.
OP_ERROR cookInputGroups(OP_Context &context, int alone=0) override
Iteration over a range of elements.
FromType find(ToType value, FromType s=FromType(0)) const
static SYS_FORCE_INLINE bool isType(const GA_Attribute *attrib)
void setChoiceListPtr(const UT_StringRef &name, PRM_ChoiceList *list)
UT_ErrorSeverity sopAddWarning(int code, const char *msg=0, const UT_SourceLocation *loc=0) const
bool contains(const Key &key) const
static const SOP_NodeVerb::Register< SOP_CopyToPointsHDKVerb > theVerb
SYS_FORCE_INLINE int getPrimitiveTypeId(GA_Offset primoff) const
#define SYS_STATIC_ASSERT_MSG(expr, msg)
~SOP_CopyToPointsHDK() override
void bind(const GA_Detail *gdp, GA_AttributeOwner owner, const UT_StringRef &name, int minsize=1)
virtual void copySubclassData(const GA_Primitive *source)
bool blockAdvance(GA_Offset &start, GA_Offset &end)
bool GAisValid(GA_Size v)
GA_Size entries() const overridefinal
Will return the number of primary elements.
void setSizeNoInit(exint newsize)
void clearAndDestroy()
Clear all the points/primitives out of this detail.
static const char *const theDsFile
This is the parameter interface string, below.
**And then you can **find out if it s done
SYS_FORCE_INLINE bool getExtraFlag() const
Synonym for isClosed()
SYS_FORCE_INLINE bool isValid() const
GA_Attribute * getP()
Convenience method to access the P attribute.
SYS_FORCE_INLINE const HOLDER & get(GA_Offset off, int comp=0) const
Get the string at the given offset.
SYS_FORCE_INLINE const char * buffer() const
UT::ArraySet< std::pair< Key, T >, MULTI, MAX_LOAD_FACTOR_256, Clearer, MapKeyHash< Hash, Key, T >, MapKeyEqual< KeyEqual, Key, T > >::empty bool empty() const
Returns true iff there are no items in the set.
void setTrivialRange(FromType startindex, ToType startvalue, GA_Size nelements)
SOP_NodeCache * allocCache() const override
SYS_FORCE_INLINE TO_T UTverify_cast(FROM_T from)
GA_API const UT_StringHolder P
GLuint const GLchar * name
#define UT_ASSERT_MSG_P(ZZ,...)
bool addOperator(OP_Operator *op, std::ostream *err=nullptr)
GU_API void GUcreateVertexListAndGeometryFromSource(GU_Detail *output_geo, const GU_Detail *const source, const exint source_point_count, const exint source_vertex_count, const exint source_prim_count, const GA_OffsetList &source_point_list_cache, GA_OffsetList &source_vertex_list_cache, const GA_OffsetList &source_prim_list_cache, const GA_PointGroup *const source_pointgroup, const GA_PrimitiveGroup *const source_primgroup, const exint ncopies)
Standard user attribute level.
#define GA_INVALID_DATAID
ordered_iterator_t< true > ordered_begin(const COMPARATOR &comparator) const
bool getBoundsCached(UT_BoundingBox &box) const
const UT_StringHolder & getName() const
static PRM_ChoiceList pointGroupMenu
GU_API void GUcopyAttributesFromTarget(GU_Detail *const output_geo, const GA_SplittableRange *const output_splittable_ranges, const exint ncopies, GU_CopyToPointsCache *const cache, const exint source_point_count, const exint source_vertex_count, const exint source_prim_count, const exint *const num_target_attribs, const GA_OffsetListRef &target_point_list, const GU_Detail *const target, GU_CopyToPointsCache::TargetAttribInfoMap &target_attrib_info, GU_CopyToPointsCache::TargetAttribInfoMap &target_group_info, const bool topology_changed, const exint *const target_to_piecei=nullptr, const UT_Array< exint > *const owner_piece_offset_starts=nullptr, const GU_CopyToPointsCache::PieceData *const piece_data=nullptr)
GU_API void GUsetupPointTransforms(GU_PointTransformCache *cache, const GA_OffsetListRef &target_point_list, const GU_Detail *target, const bool transform_using_more_than_P, const bool allow_implicit_N, bool &transforms_changed)
void setSize(exint newsize)
exint GA_Size
Defines the bit width for index and offset types in GA.
#define GA_INVALID_OFFSET
GA_Size countPrimitiveType(const GA_PrimitiveTypeId &type) const
Geometry Embedded procedural.
A range of elements in an index-map.
void setViewportLOD(GEO_ViewportLOD vlod)
bool combine(const GA_Group *src) overridefinal
void set(FromType index, ToType value)
Set the index to the value.
void allocateAndSet(GU_Detail *gdp, bool own=true)
GA_Offset GEObuildPrimitives(GEO_Detail *detail, const std::pair< int, exint > *primtype_count_pairs, const GA_Offset init_startpt, const GA_Size npoints_per_copy, const GA_PolyCounts &vertexlistsizelist, const INT_T *vertexpointnumbers, const bool hassharedpoints, const exint *closed_span_lengths, const exint ncopies)
GU_API void GUcreateEmptyPackedGeometryPrims(GU_Detail *const output_geo, const exint num_packed_prims)
void resetTargetAttribs()
GU_ConstDetailHandle inputGeoHandle(exint idx) const
SYS_FORCE_INLINE bool isTrivial() const
GA_Range getPointRange(const GA_PointGroup *group=0) const
Get a range of all points in the detail.
const GA_IndexMap & getPointMap() const
GU_API void GUcreateGeometryFromSource(GU_Detail *output_geo, const GU_Detail *const source, const GA_OffsetList &source_point_list_cache, const GA_OffsetList &source_vertex_list_cache, const GA_OffsetList &source_prim_list_cache, const exint ncopies)
NOTE: This does not clear output_geo.
bool isEqual(const GA_ListTypeRef &other, FromType start, FromType end) const
Test a sub-block for equality with another list.
Constructs a PRM_Template list from an embedded .ds file or an istream.
void bind(const GA_Detail *gdp, GA_AttributeOwner owner, const UT_StringRef &name, int minsize=1)
UT_Vector3T< T > center() const
void UTparallelForLightItems(const Range &range, const Body &body)
GA_AttributeOwner myCopyTo
SYS_FORCE_INLINE GA_OffsetListRef getVertexList(GA_Offset primoff) const
SYS_FORCE_INLINE GA_Offset appendPointBlock(GA_Size npoints)
Append new points, returning the first offset of the contiguous block.
const GU_Detail * inputGeo(int index, OP_Context &)
GOP_Manager::GroupCreator GroupCreator
Typedef to help make use of GroupCreator less verbose.
void bumpDataId()
Use this to mark primitives or their intrinsic data as dirty.
GA_StorageClass getStorageClass() const
Returns the approximate type of the attribute.
PRM_Template * templates() const
CookMode cookMode(const SOP_NodeParms *parms) const override
static SYS_FORCE_INLINE GA_ATINumeric * cast(GA_Attribute *attrib)
GLsizei GLsizei GLchar * source
SYS_FORCE_INLINE GA_OffsetListRef getPrimitiveVertexList(GA_Offset primoff) const
UT::ArraySet< std::pair< Key, T >, MULTI, MAX_LOAD_FACTOR_256, Clearer, MapKeyHash< Hash, Key, T >, MapKeyEqual< KeyEqual, Key, T > >::begin iterator begin()
Returns a non-const iterator for the beginning of the set.
OP_ERROR cookMyselfAsVerb(OP_Context &context)
GU_API void GUaddAttributesFromSourceOrTarget(GU_Detail *output_geo, const GU_Detail *source, exint *num_source_attribs=nullptr, bool has_transform_matrices=false, bool *needed_transforms=nullptr, const GU_Detail *target=nullptr, GU_CopyToPointsCache::TargetAttribInfoMap *target_attrib_info=nullptr, GU_CopyToPointsCache::TargetAttribInfoMap *target_group_info=nullptr, exint *num_target_attribs=nullptr)
SYS_FORCE_INLINE GA_Offset pointVertex(GA_Offset point) const
UT_UniquePtr< GA_PrimitiveGroup > GA_PrimitiveGroupUPtr
SYS_FORCE_INLINE GA_Offset getNumPointOffsets() const
OP_ERROR cookInputPointGroups(OP_Context &context, const GA_PointGroup *&group, bool alone=false, bool do_selection=true, int parm_index=0, int group_type_index=-1, bool allow_reference=true, bool ordered=false, bool detached=true, int input_index=0)
See cookInputPrimitiveGroups.
size_type erase(const Key &key)
SOP_NodeParms * allocParms() const override
SYS_FORCE_INLINE const char * c_str() const
static SYS_FORCE_INLINE GA_ATIString * cast(GA_Attribute *attrib)
void setCallback(const UT_StringRef &name, PRM_Callback callback)
virtual void setPivot(const UT_Vector3 &pos)
SYS_FORCE_INLINE T get(GA_Offset off, int comp=0) const
SYS_FORCE_INLINE GA_Offset vertexPoint(GA_Offset vertex) const
Given a vertex, return the point it references.
OP_ERROR cookMySop(OP_Context &context) override
bool isOrdered() const overridefinal
Returns true if the group is currently ordered.
SYS_FORCE_INLINE GA_DataId getDataId() const
static PRM_Template * buildTemplates()
GA_Size GA_Index
Define the strictness of GA_Offset/GA_Index.
GA_AttributeScope getScope() const
bool contains(const GA_Primitive *prim) const
GU_API void GUcopyAttributesFromSource(GU_Detail *const output_geo, const GA_SplittableRange *const output_splittable_ranges, const GU_Detail *const source, const exint num_target_points, GU_CopyToPointsCache *const cache, const GA_OffsetList *const source_offset_lists, const exint *const num_source_attribs, const bool no_transforms, const bool had_transform_matrices, const bool has_transform_matrices, const bool topology_changed, const bool transforms_changed, const GU_Detail *const target=nullptr, const GU_CopyToPointsCache::TargetAttribInfoMap *const target_attrib_info=nullptr, const GU_CopyToPointsCache::TargetAttribInfoMap *const target_group_info=nullptr, const exint *const target_to_piecei=nullptr, const UT_Array< exint > *const owner_piece_offset_starts=nullptr, const GU_CopyToPointsCache::PieceData *const piece_data=nullptr)
void setManagesDataIDs(bool onOff)
SYS_FORCE_INLINE GA_Offset vertexToNextVertex(GA_Offset vtx) const
SYS_FORCE_INLINE bool isPageConstant(GA_PageNum pagenum) const
GA_GroupType classType() const
void newSopOperator(OP_OperatorTable *table)
exint getUniqueId() const
SYS_FORCE_INLINE const GA_Attribute * findPrimitiveAttribute(GA_AttributeScope s, const UT_StringRef &name) const
SYS_FORCE_INLINE bool isValid() const
GLenum GLuint GLenum GLsizei const GLchar * buf
GA_AttributeOwner getOwner() const
void notifyGroupParmListeners(SOP_Node *oldsop, int groupparm_idx, int grouptype_idx, const GU_Detail *gdp, const GA_Group *group) const
GU_API void GUcomputeTransformTypeCaches(GU_PointTransformCache *cache, exint num_target_points, bool transforms_changed, const bool needed_transforms[NeededTransforms::num_needed_transforms])
void assign(T xx=0.0f, T yy=0.0f, T zz=0.0f)
Set the values of the vector components.
GU_API void GUremoveUnnecessaryAttribs(GU_Detail *output_geo, const GU_Detail *source, const GU_Detail *target, GU_CopyToPointsCache *cache, const GU_CopyToPointsCache::TargetAttribInfoMap *target_attrib_info, const GU_CopyToPointsCache::TargetAttribInfoMap *target_group_info)
SYS_FORCE_INLINE GA_Offset vertexPrimitive(GA_Offset vertex) const
int int appendSprintf(const char *fmt,...) SYS_PRINTF_CHECK_ATTRIBUTE(2
OP_ERROR cookInputAllGroups(OP_Context &context, const GA_Group *&group, bool alone=false, bool do_selection=true, int parm_index=0, int group_type_index=-1, GA_GroupType grouptype=GA_GROUP_INVALID, bool allow_reference=true, bool is_default_prim=true, bool ordered=false, bool detached=true, int input_index=0)
void intrusive_ptr_add_ref(T *x)
SYS_FORCE_INLINE GA_Offset getNumPrimitiveOffsets() const
SYS_FORCE_INLINE bool isValid() const
Check whether the bounding box contains at least one point.
UT_StringHolder name() const override
SYS_FORCE_INLINE const GU_PackedImpl * implementation()
SYS_FORCE_INLINE GA_Offset primitiveOffset(GA_Index index) const
Given a primitive's index (in append order), return its data offset.
static OP_Node * myConstructor(OP_Network *net, const char *name, OP_Operator *entry)
GU_API void GUcopyPackAllSame(GU_Detail *output_geo, const GEO_ViewportLOD lod, const GU_CopyToPointsCache::PackedPivot pivot_type, GU_CopyToPointsCache *cache, const GU_ConstDetailHandle source_handle, const GU_Detail *source, const GA_PointGroup *source_pointgroup, const GA_PrimitiveGroup *source_primgroup, bool source_topology_changed, bool had_transform_matrices, bool transforms_changed, const exint num_packed_prims, const GU_Detail *target=nullptr, const GA_OffsetListRef *target_point_list=nullptr, GU_CopyToPointsCache::TargetAttribInfoMap *target_attrib_info=nullptr, GU_CopyToPointsCache::TargetAttribInfoMap *target_group_info=nullptr)
void append(GA_Size size, GA_Size count=1)
GA_GroupType
An ordinal enum for the different types of groups in GA.
AttribCombineMethod myCombineMethod
SYS_FORCE_INLINE GA_Size getNumPrimitives() const
Return the number of primitives.
iterator erase(iterator pos)
GEO_API const char * GEOviewportLOD(GEO_ViewportLOD type, bool label=false)
int64 getMetaCacheCount() const
GA_API const UT_StringHolder pivot
const GU_Detail * inputGeo(exint idx) const
GLsizei const GLfloat * value
const GA_PrimitiveList & getPrimitiveList() const
SOP_NodeCache * cache() const
void setDetailPtr(const GU_DetailHandle &d)
Container class for all geometry.
GU_API void GUhandleTargetAttribsForPackedPrims(GU_Detail *output_geo, GU_CopyToPointsCache *cache, const bool topology_changed, const bool had_transform_matrices, const GU_Detail *const target, const GA_OffsetListRef &target_point_list, GU_CopyToPointsCache::TargetAttribInfoMap &target_attrib_info, GU_CopyToPointsCache::TargetAttribInfoMap &target_group_info, const UT_Vector3 *const constant_pivot)
SYS_FORCE_INLINE GA_Size getPrimitiveVertexCount(GA_Offset primoff) const
exint evalInt(int pi, int vi, fpreal t) const
UT_UniquePtr< GA_PointGroup > GA_PointGroupUPtr
SYS_FORCE_INLINE bool isEmpty() const
Query whether the group is empty of primary elements.
void cook(const CookParms &cookparms) const override
Compute the output geometry.
void clear()
Resets list to an empty list.
SYS_FORCE_INLINE void setImplementation(const GU_PackedImpl *impl, bool add_ref=true, bool remove_ref=true)
SYS_FORCE_INLINE bool isPageConstant(GA_PageNum pagenum) const
SYS_FORCE_INLINE const GA_Attribute * findPointAttribute(GA_AttributeScope s, const UT_StringRef &name) const
GA_Range getPrimitiveRange(const GA_PrimitiveGroup *group=0) const
Get a range of all primitives in the detail.
UT_ArrayStringMap< TargetAttribInfo > TargetAttribInfoMap
const SOP_NodeVerb * cookVerb() const override
void bumpDataIdsForAddOrRemove(bool added_or_removed_points, bool added_or_removed_vertices, bool added_or_removed_primitives)
GLenum GLsizei GLenum GLenum const void * table
static SYS_FORCE_INLINE bool isType(const GA_Attribute *attrib)
GU_DetailHandle & gdh() const
The initial state of gdh depends on the cookMode()
GA_OffsetList getOffsetFromIndexList() const
bool fullBlockAdvance(GA_Offset &start, GA_Offset &end)
GA_PageNum GAgetPageNum(GA_Offset v)
SYS_FORCE_INLINE FromType size() const
Returns the number of used elements in the list (always <= capacity())
const char * inputLabel(unsigned idx) const override
void UTparallelReduceLightItems(const Range &range, Body &body)
SYS_FORCE_INLINE bool contains(GA_Offset offset) const
static const UT_StringHolder theSOPTypeName
SOP_CopyToPointsHDK(OP_Network *net, const char *name, OP_Operator *entry)
bool isEmpty() const
Returns true iff there are no occupied elements in the array.
UT::ArraySet< std::pair< Key, T >, MULTI, MAX_LOAD_FACTOR_256, Clearer, MapKeyHash< Hash, Key, T >, MapKeyEqual< KeyEqual, Key, T > >::reserve void reserve(size_type num_items)