AREA forums upgrade
Read more about the planned upgrade of our forums
  • 1/3
You are here: Forum Home / Autodesk 3ds® Max® / SDK / How to get user property setting
IMPORTANT ANNOUNCEMENT ABOUT AREA FORUMS
  RSS 2.0 ATOM  

How to get user property setting
Rate this thread
 
64733
 
Permlink of this thread  
avatar
  • arkeon
  • Posted: 24 February 2012 06:40 AM
  • Total Posts: 5
  • Joined: 24 February 2012 06:32 AM

Hello !

I’m working on a Exporter for Ogre, and i’m trying to get user custom setting from the object property dialog.

I’ve tried this the same way we can see in the SDK documentation and IGame sample.

//object user params
    
float renderDistance 0.0f;
    
IPropertyContainerpc pGameMesh->GetIPropertyContainer();
    
IGamePropertypRenderDistance pc->QueryProperty(_T("renderingDistance"));
    if(
pRenderDistance)
      
pRenderDistance->GetPropertyValue(renderDistance);

but the IGameProperty always return 0 even if I had :
renderingDistance=5
for example in the object user property setting dialog

I read that it was “easy” to get user custom setting but I cannot understand what to do here :/

Any help ?



Replies: 0
avatar
  • Jason:.
  • Posted: 27 February 2012 04:14 PM

Hi arkeon, I have had some success using the GetIPropertyContainer() so I can verify that it works. I used it a bit differently to you though, see below.

int numProps child->GetIGameObject()->GetIPropertyContainer()->GetNumberOfProperties();
 
PropType propType;

 for (
int i 0numPropsi++)
 
{
     IGameProperty
prop child->GetIGameObject()->GetIPropertyContainer()->GetProperty(i);
 
     
propType prop->GetType(); 
     const 
charpropName;

     if (
propType == IGAME_STRING_PROP)
     
{
        propName 
prop->GetName();
        if (
strcmp(propName"guid") == 0)
        
{
            prop
->GetPropertyValue(guid0); 
//etc....

etc....

I tested your code and found that the QueryProperty will only work on “known” properties. The “known” properties can be defined in IGameProp.xml. The documentation does mention this but it isn’t actually very clear in my opinion.

Hope this helps.

PS
Here is a sample using the IGameProp.xml file that will work for you as long as you add the “IGameTest” property to one of the objects. ("IGameTest" is already defined as a sample)

IGamePropertygp pGameNode->GetIGameObject()->GetIPropertyContainer()->QueryProperty(_T("IGameTest"));
float temp 0
if(
gp)
{
    gp
->GetPropertyValue(temp);
}


3DSMax 2012 with subscription advantage pack / Windows 7 Enterprise

Replies: 0
avatar
  • arkeon
  • Posted: 27 February 2012 10:38 PM

Hello !

Thank you very much for your help !

Yes the documentation mention this xml file but where to make it / put it or modify it ?!
I only found a sample in the Igame exporter with a non terminated code ...



Replies: 0
avatar
  • arkeon
  • Posted: 28 February 2012 05:06 AM

Ok I found the IGameProp.xml in the plugcfg directory.

But it means that I have to modify the main IGameProp.xml used by all plugins ?
Or I am able to define witches xml file I want the Igame use ?

Edit :
Ok I found IGameScene::SetPropertyFile(const MCHAR * fileName) in the documentation
with this you can provide a defined xml file for the plugin properties.

It should be great is it was explain clearly somewhere (like so much other functionality) ^^

Anyway, thanks for help :)



Replies: 0