few Allocation-Size might crash C4D?
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 15/04/2008 at 12:24, xxxxxxxx wrote:
User Information:
Cinema 4D Version: 10.5
Platform: Mac OSX ;
Language(s) :---------
Hi guysHow does C4D knows, how much memory it has to allocate for of a class, it creates?
I allocate a class via:
static NodeData* Alloc(void)
{
return gNew node;
}by
GvRegisterOperatorPlugin(... ,node::Alloc,...);
My problem is, that it seems, that C4D allocates to few memory, because I swap out a function that is calculated by a complete different application, that is too big for the allocated memory. Is it possible to increase it? I created a thread, but that didn't help.
Thanks a lot for your great help.
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 15/04/2008 at 12:50, xxxxxxxx wrote:
Short answer - it doesn't. Memory allocation is handled by the code and system.
Is 'node' the name of the derived class? As in,
class node : public GvOperatorData { ... };
1. I'd be very wary about using such a simple name for your class - it could easily clash with any number of other classes or variables, especially STL and general library classes. Use something unique like ShawniNode, for instance.
2. Of course the class name must be used after gNew and for Alloc registration - not an instance pointer etc. So it would be:
return gNew ShawniNode;
and
GvRegisterOperatorPlugin(..., ShawniNode::Alloc, ...);
This is one situation where example source code from Maxon would be much appreciated. I know that some devs here have done Xpresso node plugins. Hopefully one can chime in and provide some info/pointers/code!
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 15/04/2008 at 13:05, xxxxxxxx wrote:
Hi!
Thanks for your fast answer. Naturally I used an individual name, I only changed it to "node" to get it more simple to read here in the forum. altough thanks.
The class has the same name, because thats the class I want to register.
But I am at ones wits end. I tried everything. The problem is, when I put the code outside the class, for example after Registration of my node, C4D executes the command, everything is all right.
Only executed in the class, C4D crashs
Bye
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 15/04/2008 at 13:27, xxxxxxxx wrote:
How are you actually allocating a new instance of your Xpresso node plugin?
You should never do this:
ShawniNode* node = ShawniNode::Alloc();
That won't work because the NodeData is only part of the structure needed for a plugin (this class is part of a list node (GeListNode)). This is why the Alloc() method is registered - to be called when an instance of the plugin type is created (by other means).
For an XPresso node it gets a bit more complicated (haha). There must exist a GvNodeMaster to contain the GvNodes. Then you'll need to allocate a GvNode with GvNodeMaster::AllocNode(YOUR_ID) (see docs under GvNodeMaster and GvNode).
The basic steps are:
= Create an XPresso tag (Texpresso) and add to object in document. This can be done using obj->MakeTag(Texpresso).
= GvNodeMaster* gvnodeMaster = ((XPressoTag* )tag)->GetNodeMaster() - You need this to create/add your node(s).
= gvnodeMaster->AllocNode(...).
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 15/04/2008 at 22:47, xxxxxxxx wrote:
Hi!
Well, I allocated some other nodes exactly the same and the others work.
The only allocation part in my class-nodes are the static NodeData*.. method I posted and the GvRegisterOperatorPlugin-Method which calls that class...
How I wrote, when I delete the command-lines where I call the external application for calculation, everything runs (5-6 lines).
bye...
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 16/04/2008 at 11:31, xxxxxxxx wrote:
Hi!
Perhaps, is it possible to put out the command complete out of the class, so that they aren't concerned with the allocation of the node?
That would be more helpful. I tried a thread, normal class but nothing helped. And I can't explain why...
In the registration-main-method it works (and the node works too), in the class it crashes.
Thanks for support...