Can someone please compile a bone in c++?
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 07/10/2005 at 06:40, xxxxxxxx wrote:
User Information:
Cinema 4D Version: 9.102
Platform: Windows ;
Language(s) : C.O.F.F.E.E ; XPRESSO ;---------
I have a coffee tag plugin that distort a the object where it is placed, based on the matrix of a lot of Null objects that work like body parts. I think it is better than c4d bones, but the result takes about 12 seconds to calculate each redraw, so I think that a c++ deformer object could be far better. My problem is that I don´t understand howw c++ works exactly, and i don´t know how to get a cdl or xdl file.
I´ll post here the code for everyone later. Can someone transform it to c++ and compile it (for free, of course)? -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 08/10/2005 at 05:35, xxxxxxxx wrote:
12 seconds seems a bit much, even in coffee. Perhaps you could do with some optimizations?
What plans do you have for your plugin? Are you planning on making it free/commercial/open source?
To convert your code into a cdl/xdl file you will need a compiler such as Microsoft Visual Studio. VS will only compile into a .cdl file, so it would only work for PC
To compile your code into a .xdl file you need a piece of software called Code Warrior, which can compile into a Mac compatible plugin.
Of course, this will only work if you first convert your coffee code into c++ code, of course this would require experience of c++.
Any chance you could show us any videos or images of the plugin in action?
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 09/10/2005 at 03:56, xxxxxxxx wrote:
Thank you for reply. Here you have my code for my tag:
/////////////////////////////////////////////////////////////////////////////
var TagName="Bonify";
var TagHelp="";
class MyExpressionPluginTag : ExpressionPluginTag
{public:
MyExpressionPluginTag();
GetID();
MultipleAllowed();
DisplayAllowed();
GetIcon();
GetHelpText();
UseMenu();
GetName();
Edit();
Message(type, data);//I don´t know very well how to
//use this.Perhaps I could make it faster there.
Execute(doc, op);
Speedup(doc, op);
}
MyExpressionPluginTag::MyExpressionPluginTag() {super();}
MyExpressionPluginTag::GetID() {return PluginID;}
MyExpressionPluginTag::MultipleAllowed() {return FALSE;}
MyExpressionPluginTag::DisplayAllowed() {return TRUE;}
MyExpressionPluginTag::GetIcon() { /*code for load a bitmap*/}
MyExpressionPluginTag::GetHelpText() {return TagHelp ;}
MyExpressionPluginTag::UseMenu() {return TRUE;}
MyExpressionPluginTag::GetName() {return TagName;}
MyExpressionPluginTag::Edit(){/*code for settings dialog*/}
MyExpressionPluginTag::Message(type, data){}
MyExpressionPluginTag::Execute(doc, op)
{
//this is just for facilities in work
if((op#ID_BASEOBJECT_VISIBILITY_EDITOR==1) || (op#ID_BASEOBJECT_VISIBILITY_RENDER==1) )return;
//the number of points we are working with
var count=op->GetPointCount();
var opdef;/*an object with the same points before
been deformed. I know this will not be necessary with
a deformer in c++.*/
//I store it in a user data
try { opdef=op#ID_USERDATA:1;}catch(ExLastException) { Edit();return FALSE;}
// now i´ll find a "bone" for each vertexmap of the object.
/*first, I had the expressiontag in each "bone", but this is faster, at least in coffee*/
var t=op->GetFirstTag();
while(t)
{var wei,bon,miklo,trans=0,v,v0,i=0;
if(t->GetType()==Tvertexmap)
{
wei=t->GetData();/*the values for mixing the default point with the deformed one*/
/*This is how I store the "bones" and their relation to vertexmaps. In c++ you could do it with node data or whatever for the attributes manager*/
try{ bon=t#ID_USERDATA:1; if(!bon){bon=doc->FindObject(t#ID_BASELIST_NAME);t#ID_USERDATA:1=bon; } }
catch(ExLastException) { bon=doc->FindObject(t#ID_BASELIST_NAME);}
if(!bon){TextDialog(t#ID_BASELIST_NAME+"?");}
miklo=bon->GetMg();//global matrix of the "bone"
/*This is my code for finding the true relative point of rotation of the "bone". perhaps you have a faster way?*/
while(bon){ trans+=bon#ID_BASEOBJECT_POSITION;
bon=bon->GetUp();}
gc();//I don´t know really if it is necessary
while(i<count)
{
if(wei[i]!=0)//I skip the points not afected
{
v0=opdef->GetPoint(i);
v=miklo->GetMulP(v0-trans);/*This is really my "innovation" */
v=Mix(v0,v,wei[i]);
op->SetPoint(i,v);
}
i++;
}
op->MultiMessage(MSG_UPDATE);
}
t=t->GetNext();
}
}
MyExpressionPluginTag::Speedup(doc, op){if(op) Touch(op); return TRUE;}
main(){Register(MyExpressionPluginTag);}
///////////////////////////////////////////////////////////////////
I know a little about c++. I have the sdk, and I have a free compiler found in www.bloodshed.net .But I don´t know how to use it for c4d.
This takes 12 seconds with a figure of about 3000 points.
With a figure of about 300 points you can work right, even in coffee.
Of couse, It will be a free, open source plugin (here you have the code). I will try to put it in a c++ pseudocode for an object plugin later. But i think now you can imagine what i want. -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 09/10/2005 at 08:30, xxxxxxxx wrote:
The only compilers that currently work with the SDK are Microsoft Visual C++ and CodeWarrior. I think that there is a free version of VC++ which you can use for non-commercial work, but don't remember the specifics.
Victoria 3 has 72712 points and, yikes, Miki has 115067! It needs to be tight code.
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 09/10/2005 at 09:41, xxxxxxxx wrote:
Hi Robert! I wanted to talk with you! So it´s easily tofind you here that in your own forum?
I was wrong with my estimation in points. I didn´t want to talk in Poser´s things beacause perhaps someone didn´t know it's figures. My "12 seconds" were measured woking : ) ! with Victoria 3. But with the P3 woman, it takes faster and you can work right, even with coffee. The result its very near to Poser's way. I haven´t got "miki", but I yhink in most projects you don´t need so much points, an hypernurbs could do a good thing. I will try now an option to import vertexmaps exported with a python, like I told you in the e-mail.
I think the problem in my code is that I have several iteractions, especially in taking the points from the deformed object and the default one. This is twice the work that a c++ deformer would do, taking into acount that c4d owns the default point and "projects" the deformed one. Perhaps in c++ it is faster to get the code in several objects (like the deafaul c4d bone) instead of one deformer that collects the position of other objects, like i currently do.
This way, the object could store his relative position (wich I get with: while(bon){ trans+=bon#ID_BASEOBJECT_POSITION;bon=bon->GetUp();}) before readding the points to deform. and the relation to vertexmaps could be done in c4d´s way with restrictiontags, or with a link in the attributes manager, or even with claude bonet tags, if it accepts to be linken to the new boneobject.
¿are you sure Bloodshed Dev C++ does not compile c4d files? It can import Visual Studio proyects and it say it works in the same way. I don´t know why, I have a problem to install Visual Studio. I will try again, but it would be better if someone experienced in c++ help me.
It would be great if Robert or someone else, especially someone who owns poser figures, try my tag. It is easy: you just have to put it on the mesh and rename some objects with bodypat names. It is easy to do a code to transform polyselections to vertexmaps very fast; I suppose you can do it in a few minutes, but I will post it later for everyone. then i have another code to create a null object that rèpresent each body part. then You select all the vertexmaps in your mesh, Add User Data - Link, and run my tag.
In the future I will do a code to automatically put the "bone" objects in Poser´s center of rotation, now I do that manually. It don´t have to be perfect to sea the results, and it´s like tweaking with the JointEditor, very easy.
Finally, you can rotate this objects and the mesh moves ok .
I think with this corrections in c++, it can work good withot changing the main code.
The main idea is :
=== First, getting the "virtual translation" adding the translations of all
the parents of the current calculated deformer,and putting it as
V0 of it´s global Matrix, getting the matrix Mnew, and the vector Vnew;
===Second, deforming each point this way:
deformed_point=Mnew->GetMulP(default_point-Vnew);
I will try to post some images or video or c4d scene, but I think I have explained well...
Thank you for your attention and replies. I hope you like my idea.