Notifications
Clear all

[Closed] SDK GetObjectTM from SimpleObject2

Hi, I have started writing a SimpleObject2 plugin, but at certain points I need to get the current ObjectTM. Anyone know how to do this ? Thanks

17 Replies

tm = iNode->GetObjectTM(t);

assuming you have no iNode-pointer available somewhere in your code,
this is what i did in one of my plugins:

in your objects Display-method you get an INode pointer
get the nodehandle and remember it
nodeHandle = inode->GetHandle();

when you need the inode:

if(nodeHandle)
  {
  	INode* inode = GetCOREInterface()->GetINodeByHandle(nodeHandle);
  	if(inode != nullptr)
  		iNode->GetObjectTM(t);
     ...
  }

guruware

I have been looking for the same sort of thing, getting the node of your SimpleObject2. What a damn nightmare!!

The display looks to be loaded one time and that’s it. And it is before my object get created.

void MyObject::GetINodeInfo(INode *inode){
	long nodeHandle;
	nodeHandle = inode->GetHandle();
	if(nodeHandle){
		MSTR name = L"Found_Node";
  		Basenode = GetCOREInterface()->GetINodeByHandle(nodeHandle);
  		if(inode != nullptr)
			ip->MakeNameUnique(name);
  			inode->SetName(name);
	}
}

So no changes are made. And I have no idea how to get to my scene node.

Why do they need to make this so hard. :banghead: :banghead: :banghead:

I think I found a good way of doing this now and you will always have access to your base node. What a pain this was.

Ok, I have found a way to do it. Although, it causes a lot of issues if I merge this plugin into a new scene. So looking at the Display function to get the node handle, although, it never seems to be called. Is there a reason for this ?? Thanks

 lo1

Display may not be called if the object is displayed using Nitrous.

I don’t understand this solution, or for that matter, even the question. What do you expect to get if your object is instanced across several nodes?

Ahh ok, that would explain that then.
Sorry, I’ll try and explain what I’m trying to do.
Within my SimpleObject2 Plugin, I have to get the node as I need the TM from it. The way Guruware explained above is that we get the NodeHandle and save that data into a paramblock. Which works as I can get the NodeHandle on creation. Although, this only works if I don’t merge this plugin into a new scene, as it will get a new handle. So I was going back to what Guruware was talking about the Display and getting the NodeHandle that way. Although, as you said, it won’t get called so now I’m not sure what to do xD

I don’t understand original question. If you want to get object’s TM you have to have a node first. your SimpleObject can be a base for many different nodes with different transforms. so you have to find and specify which one you are interested.

 lo1

Inside which methods of your object do you need the object TM? Generally the base object should not be dependent on the transform of the node it is applied to. It can be applied to many nodes.

1 Reply
(@denist)
Joined: 10 months ago

Posts: 0

and more… object shouldn’t really care about its own transform

it might help to understand your issue if you tell us why you need object TM

Page 1 / 2