@@ -83,14 +83,10 @@ HEMAX_3dsmaxHda::UpdateParameterInputNode(HAPI_ParmId ParamId)
83
83
HEMAX_InputInstance* ParameterInput = FindParameterInput (ParamId);
84
84
HEMAX_Parameter* Parameter = Hda.MainNode .GetParameter (ParamId);
85
85
86
- if (ParameterInput)
86
+ if (ParameterInput && ParameterInput-> MergeNode )
87
87
{
88
- InputNode = ParameterInput->MaxInput ->GetInputNode ();
89
-
90
- if (ParameterInput->MergeNode )
91
- {
92
- Parameter->UpdateInputNode (ParameterInput->MergeNode ->GetMergedInputs ().Info .id );
93
- }
88
+ Parameter->UpdateInputNode (
89
+ ParameterInput->MergeNode ->GetMergedInputs ().Info .id );
94
90
}
95
91
}
96
92
@@ -135,7 +131,6 @@ HEMAX_3dsmaxHda::UpdateSubnetworkInput(int Subnetwork)
135
131
{
136
132
if (SubnetworkNodeInputs[Subnetwork]->MergeNode )
137
133
{
138
- InputNode = SubnetworkNodeInputs[Subnetwork]->MaxInput ->GetInputNode ();
139
134
HEMAX_Node HapiInputNode = SubnetworkNodeInputs[Subnetwork]->MergeNode ->GetMergedInputs ();
140
135
Hda.MainNode .ConnectInputNode (HapiInputNode.Info .id , Subnetwork);
141
136
}
@@ -323,7 +318,8 @@ HEMAX_3dsmaxHda::InitializeParameterCustomAttributes()
323
318
} break ;
324
319
case (HAPI_PARMTYPE_NODE):
325
320
{
326
- HEMAX_NodeParameterAttrib* ParamCustAttrib = new HEMAX_NodeParameterAttrib;
321
+ HEMAX_NodeListParameterAttrib* ParamCustAttrib =
322
+ new HEMAX_NodeListParameterAttrib;
327
323
ParamCustAttrib->SetParameterName (Parameter->GetName ());
328
324
CustAttribContainer->AppendCustAttrib (ParamCustAttrib);
329
325
CustAttribMap->insert ({ Parameter->GetName (), ParamCustAttrib });
@@ -355,7 +351,13 @@ HEMAX_3dsmaxHda::UpdateAllCustomAttributes()
355
351
if (InputIter->second )
356
352
{
357
353
HEMAX_Parameter* TheParameter = Hda.MainNode .GetParameter (InputIter->first );
358
- UpdateInputNodeCustomAttribute (*TheParameter, InputIter->second ->MaxInput ->GetInputNode ());
354
+ INodeTab InputNodes;
355
+ for (auto && Input : InputIter->second ->MaxInputs )
356
+ {
357
+ InputNodes.AppendNode (GetCOREInterface ()->GetINodeByHandle (
358
+ Input->Get3dsMaxNodeHandle ()));
359
+ }
360
+ UpdateInputNodeCustomAttribute (*TheParameter, InputNodes);
359
361
}
360
362
}
361
363
@@ -559,84 +561,95 @@ HEMAX_3dsmaxHda::UpdateToggleCustomAttribute(HEMAX_Parameter& Parameter, std::ve
559
561
}
560
562
561
563
void
562
- HEMAX_3dsmaxHda::UpdateInputNodeCustomAttribute (HEMAX_Parameter& Parameter, HEMAX_Input* InputNode)
564
+ HEMAX_3dsmaxHda::UpdateInputNodeCustomAttribute (
565
+ HEMAX_Parameter& Parameter,
566
+ const INodeTab& InputNodes)
563
567
{
564
- std::unordered_map<std::string, HEMAX_ParameterAttrib*>* CustomAttributeMap = GetCustAttribMap ();
565
- std::string ParameterName = Parameter.GetName ();
566
- auto Search = CustomAttributeMap->find (ParameterName);
568
+ std::unordered_map<std::string, HEMAX_ParameterAttrib*>* CustAttribMap =
569
+ GetCustAttribMap ();
570
+ std::string ParmName = Parameter.GetName ();
571
+
572
+ auto Search = CustAttribMap->find (ParmName);
567
573
568
- if (Search != CustomAttributeMap->end ())
574
+ if (Search == CustAttribMap->end ())
575
+ return ;
576
+
577
+ HEMAX_NodeListParameterAttrib* Attrib =
578
+ dynamic_cast <HEMAX_NodeListParameterAttrib*>(Search->second );
579
+
580
+ if (!Attrib)
581
+ return ;
582
+
583
+ Attrib->SetMessagesBlocked (true );
584
+ Attrib->PBlock ->ZeroCount (0 );
585
+
586
+ for (int i = 0 ; i < InputNodes.Count (); ++i)
569
587
{
570
- if (InputNode)
571
- {
572
- INode* MaxInputNode = GetCOREInterface ()->GetINodeByHandle (InputNode->GetMaxNodeHandle ());
573
- HEMAX_NodeParameterAttrib* NodeParameterAttribute = (HEMAX_NodeParameterAttrib*)Search->second ;
574
- NodeParameterAttribute->SetMessagesBlocked (true );
575
- NodeParameterAttribute->PBlock ->SetValue (0 , GetCOREInterface ()->GetTime (), MaxInputNode);
576
- NodeParameterAttribute->SetMessagesBlocked (false );
577
- }
578
- else
579
- {
580
- INode* NullNode = nullptr ;
581
- HEMAX_NodeParameterAttrib* NodeParameterAttribute = (HEMAX_NodeParameterAttrib*)Search->second ;
582
- NodeParameterAttribute->SetMessagesBlocked (true );
583
- NodeParameterAttribute->PBlock ->SetValue (0 , GetCOREInterface ()->GetTime (), NullNode);
584
- NodeParameterAttribute->SetMessagesBlocked (false );
585
- }
588
+ Attrib->PBlock ->Append (0 , 1 , &InputNodes[i]);
586
589
}
590
+
591
+ Attrib->SetMessagesBlocked (false );
587
592
}
588
593
589
594
void
590
- HEMAX_3dsmaxHda::UpdateSubnetworkCustomAttribute (int Subnetwork, HEMAX_Input* InputNode)
595
+ HEMAX_3dsmaxHda::UpdateSubnetworkCustomAttribute (
596
+ int Subnetwork,
597
+ const INodeTab& InputNodes)
591
598
{
592
- std::unordered_map<std::string, HEMAX_ParameterAttrib*>* CustomAttributeMap = GetCustAttribMap ();
599
+ std::unordered_map<std::string, HEMAX_ParameterAttrib*>* CustAttribMap =
600
+ GetCustAttribMap ();
593
601
std::string SubnetworkName = " subnetwork_" + std::to_string (Subnetwork);
594
- auto Search = CustomAttributeMap->find (SubnetworkName);
602
+ auto Search = CustAttribMap->find (SubnetworkName);
603
+
604
+ if (Search == CustAttribMap->end ())
605
+ return ;
595
606
596
- if (Search != CustomAttributeMap->end ())
607
+ HEMAX_NodeListParameterAttrib* Attrib =
608
+ dynamic_cast <HEMAX_NodeListParameterAttrib*>(Search->second );
609
+
610
+ if (!Attrib)
611
+ return ;
612
+
613
+ Attrib->SetMessagesBlocked (true );
614
+ Attrib->PBlock ->ZeroCount (0 );
615
+
616
+ for (int i = 0 ; i < InputNodes.Count (); ++i)
597
617
{
598
- if (InputNode)
599
- {
600
- INode* MaxInputNode = GetCOREInterface ()->GetINodeByHandle (InputNode->GetMaxNodeHandle ());
601
- HEMAX_NodeParameterAttrib* NodeParameterAttribute = (HEMAX_NodeParameterAttrib*)Search->second ;
602
- NodeParameterAttribute->SetMessagesBlocked (true );
603
- NodeParameterAttribute->PBlock ->SetValue (0 , GetCOREInterface ()->GetTime (), MaxInputNode);
604
- NodeParameterAttribute->SetMessagesBlocked (false );
605
- }
606
- else
607
- {
608
- INode* NullNode = nullptr ;
609
- HEMAX_NodeParameterAttrib* NodeParameterAttribute = (HEMAX_NodeParameterAttrib*)Search->second ;
610
- NodeParameterAttribute->SetMessagesBlocked (true );
611
- NodeParameterAttribute->PBlock ->SetValue (0 , GetCOREInterface ()->GetTime (), NullNode);
612
- NodeParameterAttribute->SetMessagesBlocked (false );
613
- }
618
+ Attrib->PBlock ->Append (0 , 1 , &InputNodes[i]);
614
619
}
620
+
621
+ Attrib->SetMessagesBlocked (false );
615
622
}
616
623
617
624
std::vector<HEMAX_SubnetworkInputMapping>
618
625
HEMAX_3dsmaxHda::ReloadSubnetworkInputsFromCustomAttributes ()
619
626
{
620
- ICustAttribContainer* CustAttribContainer = GetCustAttribContainer ();
621
- std::unordered_map<std::string, HEMAX_ParameterAttrib*>* CustomAttributeMap = GetCustAttribMap ();
622
-
623
627
std::vector<HEMAX_SubnetworkInputMapping> Mapping;
624
628
629
+ std::unordered_map<std::string, HEMAX_ParameterAttrib*>* CustAttribMap =
630
+ GetCustAttribMap ();
631
+
625
632
for (int z = 0 ; z < Hda.MainNode .Info .inputCount ; z++)
626
633
{
627
- std::string SubnetworkSearch = " subnetwork_ " + std::to_string (z) ;
628
- auto Search = CustomAttributeMap-> find (SubnetworkSearch) ;
634
+ HEMAX_SubnetworkInputMapping Entry ;
635
+ Entry. Subnetwork = z ;
629
636
630
- if (Search != CustomAttributeMap->end ())
631
- {
632
- INode* InputNode = Search->second ->PBlock ->GetINode (0 );
637
+ std::string SubnetworkSearch = " subnetwork_" + std::to_string (z);
638
+ auto Search = CustAttribMap->find (SubnetworkSearch);
633
639
634
- HEMAX_SubnetworkInputMapping Entry;
635
- Entry.Subnetwork = z;
636
- Entry.Node = InputNode;
640
+ if (Search != CustAttribMap->end ())
641
+ {
642
+ for (int i = 0 ; i < Search->second ->PBlock ->Count (0 ); ++i)
643
+ {
644
+ INode* Node = nullptr ;
645
+ Interval ValidityInterval;
646
+ Search->second ->PBlock ->GetValue (0 , 0 , Node,
647
+ ValidityInterval, i);
648
+ Entry.Nodes .push_back (Node);
649
+ }
650
+ }
637
651
638
- Mapping.push_back (Entry);
639
- }
652
+ Mapping.push_back (Entry);
640
653
}
641
654
642
655
return Mapping;
@@ -646,7 +659,8 @@ std::vector<HEMAX_ParameterInputMapping>
646
659
HEMAX_3dsmaxHda::ReloadParametersFromCustomAttributes ()
647
660
{
648
661
std::vector<HEMAX_ParameterInputMapping> InputMap;
649
- std::unordered_map<std::string, HEMAX_ParameterAttrib*>* CustomAttributeMap = GetCustAttribMap ();
662
+ std::unordered_map<std::string, HEMAX_ParameterAttrib*>*
663
+ CustomAttributeMap = GetCustAttribMap ();
650
664
651
665
bool AnotherPassRequired = false ;
652
666
std::unordered_map<std::string, bool > CompletionMap;
@@ -698,8 +712,9 @@ HEMAX_3dsmaxHda::ReloadParametersFromCustomAttributes()
698
712
}
699
713
case (HAPI_PARMTYPE_NODE):
700
714
{
701
- HEMAX_ParameterInputMapping InputEntry = RemakeInputParameterFromCustAttrib (Parameter, *CustomAttributeMap);
702
- if (InputEntry.Node )
715
+ HEMAX_ParameterInputMapping InputEntry =
716
+ RemakeInputParameterFromCustAttrib (Parameter, *CustomAttributeMap);
717
+ if (InputEntry.Nodes .size () > 0 )
703
718
{
704
719
InputMap.push_back (InputEntry);
705
720
}
@@ -894,22 +909,27 @@ HEMAX_3dsmaxHda::RemakeToggleParameterFromCustAttrib(HEMAX_Parameter Parameter,
894
909
}
895
910
896
911
HEMAX_ParameterInputMapping
897
- HEMAX_3dsmaxHda::RemakeInputParameterFromCustAttrib (HEMAX_Parameter Parameter, std::unordered_map<std::string, HEMAX_ParameterAttrib*>& CustomAttributeMap)
912
+ HEMAX_3dsmaxHda::RemakeInputParameterFromCustAttrib (HEMAX_Parameter Parameter,
913
+ std::unordered_map<std::string,
914
+ HEMAX_ParameterAttrib*>& CustomAttributeMap)
898
915
{
899
916
HEMAX_ParameterInputMapping Entry;
900
- Entry.Node = nullptr ;
901
- Entry.ParameterName = " " ;
902
917
903
918
std::string ParameterName = Parameter.GetName ();
904
919
auto Search = CustomAttributeMap.find (ParameterName);
905
920
906
- if (Search != CustomAttributeMap.end ())
907
- {
908
- INode* InputNode = Search->second ->PBlock ->GetINode (0 );
921
+ if (Search == CustomAttributeMap.end ())
922
+ return Entry;
909
923
910
- Entry.Node = InputNode;
911
- Entry.ParameterName = ParameterName;
912
- }
924
+ Entry.ParameterName = ParameterName;
925
+
926
+ for (int i = 0 ; i < Search->second ->PBlock ->Count (0 ); ++i)
927
+ {
928
+ INode* Node = nullptr ;
929
+ Interval ValidityInterval;
930
+ Search->second ->PBlock ->GetValue (0 , 0 , Node, ValidityInterval, i);
931
+ Entry.Nodes .push_back (Node);
932
+ }
913
933
914
934
return Entry;
915
935
}
@@ -1027,15 +1047,3 @@ HEMAX_3dsmaxHda::SetCustomAttributeContainer(ICustAttribContainer* Container)
1027
1047
{
1028
1048
CustomAttributes = Container;
1029
1049
}
1030
-
1031
- ICustAttribContainer*
1032
- HEMAX_3dsmaxHda::GetCustAttribContainer ()
1033
- {
1034
- return CustomAttributes;
1035
- }
1036
-
1037
- std::unordered_map<std::string, HEMAX_ParameterAttrib*>*
1038
- HEMAX_3dsmaxHda::GetCustAttribMap ()
1039
- {
1040
- return &CustomAttributeMap;
1041
- }
0 commit comments