Notifications
Clear all
[Closed] Instance Cloning when the Object is referencing the INode
Page 2 / 2
Prev
Apr 23, 2019 2:10 am
class FindReferenceInPipe : public GeomPipelineEnumProc
{
Object* obj;
public:
BOOL ref_found;
FindReferenceInPipe(Object* _obj) : obj(_obj), ref_found(FALSE) { }
PipeEnumResult proc(ReferenceTarget *object, IDerivedObject *derObj, int index)
{
if(derObj && derObj->GetObjRef() == obj)
{
ref_found = TRUE;
return PIPE_ENUM_STOP;
}
return PIPE_ENUM_CONTINUE;
}
};
def_visible_primitive(areNodesReferences, "areNodesReferences");
// areNodesReferences <node> <node>
Value* areNodesReferences_cf(Value** arg_list, int count)
{
check_arg_count(isReference, 2, count);
INode* first_node = arg_list[0]->to_node();
INode* second_node = arg_list[1]->to_node();
Object* first_obj = first_node->GetObjectRef();
FindReferenceInPipe pipe_enumerator(first_obj->FindBaseObject());
EnumGeomPipeline(&pipe_enumerator, second_node, true);
return pipe_enumerator.ref_found ? &true_value : &false_value;
}
and seems to work both ways (edited so it matchs the areNodesInstances
Apr 23, 2019 2:10 am
hmm… but your method says for instances that they are references as well.
here is how i check the reference relation:
Value* areReferences_cf(Value** arg_list, int count)
{
check_arg_count(areReferences, 2, count);
ReferenceTarget* targ0 = arg_list[0]->to_reftarg();
Object* obj0 = arg_list[0]->to_node()->GetObjectRef();
ReferenceTarget* targ1 = arg_list[1]->to_reftarg();
Object* obj1 = arg_list[1]->to_node()->GetObjectRef();
return bool_result((targ0 == targ1) && (obj0 != obj1));
}
Apr 23, 2019 2:10 am
hmm… but your method says for instances that they are references as well.
no it doesn’t
areNodesReferences $box02 $box01
areNodesReferences $box01 $box02
false
false
Apr 23, 2019 2:10 am
are_references.max (228 KB)
check this file (max 2016) … box003 and box004 are instances but in your method are references as well
Page 2 / 2
Prev