Skip to content

Relation Constraint

Sergei Solokhin edited this page May 12, 2018 · 1 revision

I think it's interesting to add a support for a relation constraint. It has not a super complex graph. Some inputs/output models with their sourced/constrainted properties.

Inside FBX relation constriant is a MotionBuilder_Generic. Here is an ascii example

MotionBuilder_Generic: 859057360, "Relation", "" {
	Properties70:  {
		P: "MoBuTypeName", "KString", "", "", "Constraint"
		P: "MoBuSubTypeName", "KString", "", "", "Relations"
		P: "MoBuObjectFullName", "KString", "", "", "Constraint::Relation"
		P: "MultiTake", "int", "Integer", "",0
		P: "DefaultKeyingGroup", "int", "Integer", "",0
		P: "DefaultKeyingGroupEnum", "enum", "", "",0
		P: "Active", "bool", "", "",1
		P: "Lock", "bool", "", "",0
		P: "Snap", "Action", "", "",0
		P: "Weight", "Weight", "", "A",100
		P: "MoBuAttrBlindData", "KString", "", "", ""
		P: "MoBuRelationBlindData", "KString", "", "", ""
	}
}

Relation graph is stored inside MoBuRelationBlindData as a text data. Here is an example data with a little format adjustments. I'm driving light 2 model translation X by sin(SystemTime)

; ;
Relations:  
{
;    	
Model: ";Model::Light 2"; 
{ ;        
	Name: ";Light 2"; ;        
	State: ";Send"; ;        
	Mode: ";Global"; ;        
	Position: 738,71,1 ;        

	Connect:  
	{ ;            ";Translation";
		: ";KBoxExpression::Number to Vector";, ";Result"; ;        
	} ;    
} ;    

Box: ";KBoxExpression::Sine sin(a)"; 
{ ;        
	InternalType: ";Sine sin(a)"; ;        
	Position: 159,28,1 ;        
	Connect:  
	{ ;            ";a";
		: ";KBoxExpression::Time to seconds";, ";Result"; ;        
	} ;        
	Properties60:  
	{ ;            
		Property: ";DefaultKeyingGroup";, ";int";, ";";,0 ;            
		Property: ";DefaultKeyingGroupEnum";, ";enum";, ";";,0 ;        
	} ;    
} ;    

Box: ";KBoxExpression::Number to Vector"; 
{ ;        
	InternalType: ";Number to Vector"; ;        
	Position: 419,111,1 ;        
	Connect:  
	{ ;            ";X";
		: ";KBoxExpression::Sine sin(a)";, ";Result"; ;        
	} ;        
	Properties60:  
	{ ;            
		Property: ";DefaultKeyingGroup";, ";int";, ";";,0 ;            
		Property: ";DefaultKeyingGroupEnum";, ";enum";, ";";,0 ;        
	} ;    
} ;    

Box: ";KBoxExpression::Time to seconds"; 
{ ;        
	InternalType: ";Time to seconds"; ;        
	Position: 57,97,1 ;        
	Connect:  
	{ ;            ";Time";
		: ";KBoxExpression::System Time";, ";Result"; ;        
	} ;        
	Properties60:  
	{ ;            
		Property: ";DefaultKeyingGroup";, ";int";, ";";,0 ;            
		Property: ";DefaultKeyingGroupEnum";, ";enum";, ";";,0 ;        
	} ;    
} ;    
Box: ";KBoxExpression::System Time"; 
{ ;        
	InternalType: ";System Time"; ;        
	Position: 64,205,1 ;        
	Properties60:  
	{ ;            
		Property: ";DefaultKeyingGroup";, ";int";, ";";,0 ;            
		Property: ";DefaultKeyingGroupEnum";, ";enum";, ";";,0 ;        
	} ;    
} ;
} ;"

So, the format is not very complex, but there should be a support for almost all common relation boxes and implement connections between them. Anyway I have a plan to reflect FBBox class in a OpenFBX, so it would be closer to relation graph as well.

Clone this wiki locally