sarbian / ModuleManager

176 stars 96 forks source link

[Question] How do I rename a node? #165

Closed antonioltg91 closed 3 years ago

antonioltg91 commented 3 years ago

What is the easiest way of renaming something without having to cancel and rewriting all it's content? I have to rename MODEL_MULTI_PARTICLE_PERSIST in MODEL_MULTI_PARTICLE

this is the structure: EFFECTS { powerflame { MODEL_MULTI_PARTICLE_PERSIST { name = flamejet1 modelName = KSO/FX/thrustmax ... }

Thanks for your support

hemeac commented 3 years ago

If you only need to rename flamejet1 to something else:


    @EFFECTS
    {
        @powerflame
        {
            @MODEL_MULTI_PARTICLE_PERSIST[flamejet1]
            {
                @name = newflamejet
            }
        }
    }

Here is a guide on the syntax which should also help: https://github.com/sarbian/ModuleManager/wiki/Module-Manager-Syntax

antonioltg91 commented 3 years ago

I have to rename MODEL_MULTI_PARTICLE_PERSIST in MODEL_MULTI_PARTICLE

so it will be @powerflame[MODEL_MULTI_PARTICLE_PERSIST] { MODEL_MULTI_PARTICLE }

is it right?

hemeac commented 3 years ago

Re-reading your question in the header, don't know how to re-name a node. However, if you want a patch for a few parts and they all have exactly the same set of variable names within MODEL_MULTI_PARTICLE_PERSIST, you could set up something like this:


//PART
//{
//  name = partName
//  EFFECTS
//  {
//      powerflame
//      {
//          MODEL_MULTI_PARTICLE_PERSIST[flamejet1]
//          {
//              name = flamejet1
//              property1 = 2
//              property2 = 3
//          }
//      }
//  }
//}

@PART[partName]
{
    @EFFECTS
    {
        @powerflame
        {
            nameCopy = #$MODEL_MULTI_PARTICLE_PERSIST/name$
            property1Copy = #$MODEL_MULTI_PARTICLE_PERSIST/property1$
            property2Copy = #$MODEL_MULTI_PARTICLE_PERSIST/property2$
        }
    }
}

@PART[partName] // You may be able to combine these two patches into one
{
    @EFFECTS
    {
        @powerflame
        {
            !MODEL_MULTI_PARTICLE_PERSIST {} // If you don't want/need this, safe to delete
            MODEL_MULTI_PARTICLE
            {
                name = #$../nameCopy$
                property1 = #$../property1Copy$
                property2 = #$../property2Copy$
            }
        }
    }
}
antonioltg91 commented 3 years ago

I did this and it worked

@EFFECTS
    {
        @powerflame
        {
            MODEL_MULTI_PARTICLE
            {
                name = flamejet1
                modelName = KSO/FX/thrustmax
                transformName = flamePoint
                emission = 0.0 0.0
                emission = 0.1 0.0
                emission = 0.71 1.8
                emission = 1.0 2.35
                speed = 0.0 1.97
                speed = 1.0 1.97
                size = 0.0 1.07
                size = 1.0 1.07
                energy = 0.0 0.0
                energy = 1.0 0.6
                fixedEmissions = false
                %logGrow
                {
                    density = 0 8
                    density = 1 0.7
                    density = 10 0 
                }
            }
            !MODEL_MULTI_PARTICLE_PERSIST
        }

But the problem is I have another part with hundreds keys and will be much easier with a way to rename the node

blowfishpro commented 3 years ago

There is a weird syntax for doing this. The config:

TEST_NODE
{
    SUBNODE1
    {
        some = value
    }
}

With the patch:

@TEST_NODE
{
    @SUBNODE1
    {
        |whatever = SUBNODE1MOD
    }
}

Results in:

TEST_NODE
{
    SUBNODE1MOD
    {
        some = value
    }
}

the whatever part doesn't actually matter, there just has to be something there

antonioltg91 commented 3 years ago

worked perfectly, thank you so much for the help