Inside Sabertooth
Learn how Sabertooth uses 3ds Max to create 3D interactive projects, including HBO Go’s Game of Thrones interactive experience
  • 1/3
You are here: Forum Home / Autodesk® MotionBuilder® / Open Reality / FBProperty SetName
  RSS 2.0 ATOM  

FBProperty SetName
Rate this thread
 
24839
 
Permlink of this thread  
avatar
  • John McC
  • Posted: 31 March 2009 06:27 AM
  • Location: Sydney, Australia
  • Total Posts: 41
  • Joined: 05 December 2007 04:30 AM

Hi,

I appear to be getting a name corruption when setting the name of a property e.g.

FBString name "testname";
HFBProperty prop GetSelectedProperty();
if ( 
prop )
{
    prop
->SetNamename );
}

The name appears to become corrupted, this is not always immediately obvious in the properties pane in MB, however if you go to the custom properties list, the name is total gibberish.

FBProperty stores it’s name via an FBString but exposes a char * interface. So I expect it copies it when assigned, meaning it isn’t a simple case of a shallow string copy. To test this I assigned a heap allocated string yet the corruption still occurs.

Has anyone else hit this (and overcame it)?



Replies: 0
avatar
  • KxL
  • Posted: 31 March 2009 06:58 AM

What MB version you use? I ask because this works fine for me on MB2009:

FBModelList lModels;
    
FBGetSelectedModels(lModels);
    for(
int i 0lModels.GetCount(); i++){
        FBProperty
lProperty lModels[i]->PropertyCreate"NewProp"kFBPT_double,ANIMATIONNODE_TYPE_NUMBERtruetrue );
        
FBString lName("testname");
        
lProperty->SetName((char*)lName);
    
}

Also, are you calling SetName for user properties ?

Cheers



Replies: 0
avatar
  • John McC
  • Posted: 31 March 2009 06:52 PM

Thanks for the reply. Even when I paste your sample code into an otherwise empty plugin (the button click method in ortool_template_tool sample), I still get odd results. In this case the name is either set to the name of the dll or it isn’t changed at all. The result is the same regardless if I create a user or internal property. If it means anything I am using MB 7.5 ext 2.



Replies: 0
avatar
  • KxL
  • Posted: 02 April 2009 03:39 AM

Now I have tested it in MB 7.5 ext2 and after that again in MB 2009...and nothing good to say. I get exactly what you describe :( I had to test it wrong first time, problem shows when I refresh Property Editor (close and open) - sorry for that. Why you need to change property name? Maybe there is other solution to problem you wants to solve with it?

Cheers



Replies: 0
avatar
  • John McC
  • Posted: 07 April 2009 05:45 AM

Thanks for doing the extra tests, I am going to just omit the feature I was planning as the only alternative I can think of is creating a new prop, copying curves etc. and deleting the old one which seems like a higher hack cost than what the feature gives back.



Replies: 0
avatar

One workaround solution would be to clone the property and give it a new name, and then delete the original....

~Kristine



KRISTINE MIDDLEMISS | SENIOR DEVELOPER CONSULTANT
AUTODESK DEVELOPER NETWORK Media & Entertainment
http://www.autodesk.com/joinadn

Replies: 0