Notifications
Clear all

[Closed] SDK GetObjectTM from SimpleObject2

Haha Right xD I’m need the Plugin’s Node transformation for the BuildMesh. I have other nodes that need to attach to the Mesh, but need to stay within their original position. Due to this I am using the otherNodes TM * Inverse(PluginNode TM). So I need to find a way to get the Plugin Node at certain times.

in general your object can have different relative transforms for different nodes. probably your ‘mesh build’ method has to take as an argument a matrix (or node) to be used in calculation. (like GetWorldBoundBox or GetLocalBoundBox). without a specified node it doesn’t make sense.

 lo1

If the actual mesh your object generates must be dependent on the node then this should not be implemented as an object.

Let’s say you create your object.

Then you instance it to another node.

Which transform is the object’s mesh based on? the first object or the second?

1 Reply
(@denist)
Joined: 11 months ago

Posts: 0

It might be the third which the base object is not applied at all

Note: this is a simple solution that won’t work properly on instances.

Put this somewhere in your .cpp file, above your buildMesh function:


  class MyEnumProc : public DependentEnumProc 
  	{
  	  public :
  		MyEnumProc( bool bDoHalt ) { mbDoHalt = bDoHalt; }
  	  virtual int proc(ReferenceMaker *rmaker); 
  	  INodeTab Nodes;			  
  	private:
  		bool mbDoHalt;
  	};
  
  int MyEnumProc::proc(ReferenceMaker *rmaker) 
  { 
  	if (rmaker->SuperClassID()==BASENODE_CLASS_ID)	
  	{
  		Nodes.Append(1, (INode **)&rmaker);  
  		if( mbDoHalt )		
  			return DEP_ENUM_HALT;
  	}
  
  	return DEP_ENUM_CONTINUE;
  }
  

Then in your buildMesh function, put this:


  INode* self = NULL;
  MyEnumProc dep(true);
   DoEnumDependents(&dep);
  if (dep.Nodes.Count() > 0)
  {
  	 self = dep.Nodes[0];
  }
  
  Matrix3 selfTM;
   if (self != NULL)
  {
  		selfTM = self->GetObjectTM(t);
  }
  

well… there is no really a problem to find the first dependent. the idea sounds like the base object has to be unique some sort. it means like an instance of this plugin must be applied to only one node. and it can make a sense! i’ve been in this situation. but in general case it’s against the sense of base object meaning.

Ahhh, that works perfectly for what I need at the moment. Thank you. I understand what you guys are saying about instances and it definitely made me think about how I should be changing this later on. So thanks for all your guys input, its helped a bunch

Page 2 / 2