Page 1 of 1

How to use Magic_SetPath

PostPosted: Wed Oct 25, 2017 9:58 am
by ivasyliev
Hello,

I have an emitter (type MAGIC_PARTICLES_TYPE_PATH), which is created in the program for designers,
when I run the program, I draw the effect "as is", such as it is created in the program, but after I want to change it programmatically, for this I do such actions

Code: Select all
int iResult = MAGIC_SUCCESS;
ASSERT(Magic_GetParticlesTypeCount(m_iEmitterId) > 0);
   
Magic_LockParticlesType(m_iEmitterId, 0);
ASSERT(iResult == MAGIC_SUCCESS);
   
MAGIC_PARTICLES_TYPE_ENUM eType = Magic_GetParticlesTypeMode();
if(eType == MAGIC_PARTICLES_TYPE_PATH)
{
    int iPathLenght = Magic_GetPathLength();
    MAGIC_KEY keys[iPathLenght];
    iResult = Magic_GetPath(keys);
    ASSERT(iResult == MAGIC_SUCCESS);
       
    keys[1].position.x -= 60;
    keys[1].position.y += 40;
       
    iResult = Magic_SetPath(iPathLenght, &keys[0]);
    ASSERT(iResult == MAGIC_SUCCESS);
}
iResult = Magic_UnlockParticlesType();
ASSERT(iResult == MAGIC_SUCCESS);




all functions work and return MAGIC_SUCCESS, everything is given according to the documentation,
but after these actions the emitter works without a path at all. I mean all particles appear at the starting point and remain in place.
Tell me please do I do something wrong or is it a bug?

thanks

p.s.
the coordinates that I add are correct. (I looked at those coordinates that come from GetPath and exhibited accordingly with them).

Re: How to use Magic_SetPath

PostPosted: Wed Oct 25, 2017 11:52 am
by Odin_KG
Hello,

It seems to me, you understand Russian language (фамилия vasyliev дает мне право так думать).

Поэтому предлагают перейти на русский.
У вас в примере происходит только чтение ключей, а как вы их добавляете ? Может у вас время неверное или еще что ?
Самый лучший вариант, который сразу доказывает, что проблема у меня - повторить проблему в моем враппере на DX9 или OpenGL под Windows и прислать этот пример мне. Это максимально ускоряет исправление ошибок с моей стороны, если таковые имеются. И какая у вас версия библиотеки ? Версию можно получить через Magic_GetVersion();

Re: How to use Magic_SetPath

PostPosted: Wed Oct 25, 2017 12:31 pm
by ivasyliev
версия библиотеки ?

версия - Magic Particles API 2D 3.35

У вас в примере происходит только чтение ключей, а как вы их добавляете


согласно документации - Magic_SetPath устанавливает новый путь.

В своем коде, я беру текущий путь с помощью Magic_GetPath, затем изменяя позицию 1го из MAGIC_KEY и передаю обратно тот же(уже измененный) массив в Magic_SetPath

Re: How to use Magic_SetPath

PostPosted: Wed Oct 25, 2017 12:35 pm
by Odin_KG
версия - Magic Particles API 2D 3.35

Не могли бы взять с сайта последнюю официальную версию 3.45 ? Дело в том, что я эти версии обновляю в основном по причине выявления таких вот мелких ошибок и, есть вероятность, что эта проблема уже может быть давно решена.

Re: How to use Magic_SetPath

PostPosted: Wed Oct 25, 2017 2:36 pm
by ivasyliev
проверил в последней версии(3.45), а также повторил используя wrapper_opengl(Mac Version)
получил тот же результат

Re: How to use Magic_SetPath

PostPosted: Wed Oct 25, 2017 5:30 pm
by Odin_KG
Хорошо, посмотрю у себя в коде

Re: How to use Magic_SetPath

PostPosted: Fri Oct 27, 2017 4:03 pm
by Odin_KG
Я решил проблему.
Вам какие платформы срочно нужны ? Просто пересобирать промежуточные версии мне не очень нравится. Мне проще всего собрать под Windows.

Re: How to use Magic_SetPath

PostPosted: Fri Oct 27, 2017 5:04 pm
by ivasyliev
Я решил проблему.

отлично, спасибо большое :)

какие платформы ?

было бы очень хорошо получить версию для iOS

Re: How to use Magic_SetPath

PostPosted: Fri Oct 27, 2017 5:14 pm
by Odin_KG
отлично, спасибо большое :)

Пожалуйста :-)

было бы очень хорошо получить версию для iOS

Если можно, то напишите, пожалуйста (можно в личку), кого вы представляете ? Просто iOS я обычно даю только после покупки.
Без bitcode-а подойдет ? Я потом, когда будет официальный релиз соберу всё целиком, а пока мне надо решить вашу проблему в оперативном варианте.

Re: How to use Magic_SetPath

PostPosted: Wed Aug 23, 2023 7:17 am
by pawantanwar
Once again it seems you are on the right path; however, one could potentially overlook an issue here. After changing the positions in your keys array and setting new paths using Magic_SetPath again; however, this time around the issue could lie with using an invalid index when creating a keys array.

Your code contains keys[1].position.x = 60 and keys[1].position.y +40; ensure your iPathLength is large enough to accommodate this change as anything less than 2 could cause unexpected behavior.

Make sure that the index key you are changing matches the key index on which it was added; also ensure the length matches how many keys are being used; otherwise the issue could lie elsewhere within your code or perhaps in an external library that requires fixing.