Implements misc fixes for the particle editor and particlesList inspector field

- Clicking the [...] button from the Particle Emitter tab now opens to the Particle tab *and* properly selects the particle data to be edited
- Selecting an emitter object in the map and opening the particle editor now selects the Particle Data to be edited
- Selecting a new Particle Data for a particles slot on a Particle Emitter in the editor now correctly updates the values and updates the field display
- Made it so if clicking [...] button on the ParticleEmitterData or other similar fields for objects, it will now open to the Particle editor instead of the Datablock editor
This commit is contained in:
JeffR 2026-04-19 02:18:05 -05:00
parent 12dddd07b5
commit defbaea2fe
7 changed files with 145 additions and 45 deletions

View file

@ -122,7 +122,6 @@ function PE_EmitterEditor::selectObject(%this, %obj)
&& %obj.getName() $= %this-->popupMenu.text )
return;
//FIXME: disregards particle tab dirty state
if( %this.dirty )
{
if( PE_ParticleEditor.dirty )
@ -483,6 +482,8 @@ function ParticleEditor::addParticleSlot(%this, %field, %emitterObj)
%action.oldValue = %emitterObj.particles;
ParticleEditor.submitUndo( %action );
%field.apply(%action.newValue);
}
function ParticleEditor::changeParticleSlot(%this, %field, %emitterObj, %slotIdx)
@ -495,7 +496,6 @@ function ParticleEditor::changeParticleSlot(%this, %field, %emitterObj, %slotIdx
foreach( %obj in DatablockGroup )
{
echo(%typesList);
%typesListCount = getWordCount(%typesList);
for(%i=0; %i < %typesListCount; %i++)
{
@ -552,7 +552,7 @@ function ParticleEditor::changeParticleSlot(%this, %field, %emitterObj, %slotIdx
}
}
ContextedDropdownListGui.show(%listSet, "Edit Particle Slot[" @ %slotIdx @ "]", "ParticleEditor.editSlot = " @ %slotIdx @ ";ParticleEditor.updateParticleSlot", %field);
ContextedDropdownListGui.show(%listSet, "Edit Particle Slot[" @ %slotIdx @ "]", "ParticleEditor.fieldObj = " @ %field @ ";ParticleEditor.editSlot = " @ %slotIdx @ ";ParticleEditor.updateParticleSlot", %field);
%particleData = getWord(%emitterObj.particles, %slotIdx);
if(%particleData !$= "")
{
@ -562,10 +562,10 @@ function ParticleEditor::changeParticleSlot(%this, %field, %emitterObj, %slotIdx
function ParticleEditor::updateParticleSlot(%this, %newParticle)
{
if(ParticleEditor.editSlot $= "")
if(ParticleEditor.editSlot $= "" || !isObject(%newParticle))
return;
%updatedParticlesList = setWord(PE_EmitterEditor.currEmitter.particles, ParticleEditor.editSlot, %newParticle);
%updatedParticlesList = setWord(PE_EmitterEditor.currEmitter.particles, ParticleEditor.editSlot, %newParticle.getName());
%action = ParticleEditor.createUndo(ActionUpdateActiveEmitter, "Edit Active Emitter Particle Slot");
%action.emitter = PE_EmitterEditor.currEmitter;
@ -575,16 +575,19 @@ function ParticleEditor::updateParticleSlot(%this, %newParticle)
ParticleEditor.submitUndo( %action );
ParticleEditor.editSlot = "";
ParticleEditor.fieldObj.apply(%action.newValue);
//%field.apply(%updatedParticlesList, %slotIdx);
//%this-->inspector.refresh();
ParticleEditor.editSlot = "";
ParticleEditor.fieldObj = "";
}
function ParticleEditor::editParticleSlot(%this, %field, %emitterObj, %slotIdx)
{
%particleName = getWord(%emitterObj.particles, %slotIdx);
ParticleEditor.editSlot = "";
ParticleEditor.fieldObj = "";
ParticleEditor.open(%particleName);
}
@ -600,6 +603,5 @@ function ParticleEditor::clearParticleSlot(%this, %field, %emitterObj, %slotIdx)
ParticleEditor.submitUndo( %action );
//%field.apply(%updatedParticlesList, %slotIdx);
//%this-->inspector.refresh();
%field.apply(%action.newValue);
}

View file

@ -74,7 +74,8 @@ function PE_ParticleEditor::updateVizNode(%this)
function PE_ParticleEditor::selectObject(%this, %obj)
{
// Bail if the user selected the same particle.
if( %obj == %this.currParticle )
if( isObject(%obj )
&& %obj.getName() $= %this-->popupMenu.text )
return;
// Load new particle if we're not in a dirty state