Merge pull request #576 from JeffProgrammer/more-eval-cleanups

Clean up more evals that have local variables are not working correctly.
This commit is contained in:
Brian Roberts 2021-09-12 22:03:23 -05:00 committed by GitHub
commit 4effefce91
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 27 additions and 29 deletions

View file

@ -123,7 +123,7 @@ function VerveEditor::CreateField( %targetStack, %fieldName, %fieldType )
if ( isMethod( "VerveEditor", "Create" @ %fieldType @ "Field" ) ) if ( isMethod( "VerveEditor", "Create" @ %fieldType @ "Field" ) )
{ {
// Create the Input Control. // Create the Input Control.
eval( "%fieldInput = VerveEditor::Create" @ %fieldType @ "Field( %fieldContainer, %fieldName );" ); %fieldInput = eval( "return VerveEditor::Create" @ %fieldType @ "Field( %fieldContainer, %fieldName );" );
} }
else else
{ {

View file

@ -1420,15 +1420,13 @@ function MaterialSelector::updateSelection( %this, %material, %previewImagePath
// after we move away from the material. eg: if we remove a field from the material, // after we move away from the material. eg: if we remove a field from the material,
// the empty checkbox will still be there until you move fro and to the material again // the empty checkbox will still be there until you move fro and to the material again
%isMaterialBorder = 0; %isMaterialBorder = eval("return isObject(MaterialSelector-->"@%material@"Border);");
eval("%isMaterialBorder = isObject(MaterialSelector-->"@%material@"Border);");
if( %isMaterialBorder ) if( %isMaterialBorder )
{ {
eval( "MaterialSelector-->"@%material@"Border.setStateOn(1);"); eval( "MaterialSelector-->"@%material@"Border.setStateOn(1);");
} }
%isMaterialBorderPrevious = 0; %isMaterialBorderPrevious = eval("return isObject(MaterialSelector-->"@$prevSelectedMaterialHL@"Border);");
eval("%isMaterialBorderPrevious = isObject(MaterialSelector-->"@$prevSelectedMaterialHL@"Border);");
if( %isMaterialBorderPrevious ) if( %isMaterialBorderPrevious )
{ {
eval( "MaterialSelector-->"@$prevSelectedMaterialHL@"Border.setStateOn(0);"); eval( "MaterialSelector-->"@$prevSelectedMaterialHL@"Border.setStateOn(0);");

View file

@ -205,7 +205,7 @@ function _TextPadOnOk()
if(ScriptEditorDlg.callback !$= "") if(ScriptEditorDlg.callback !$= "")
{ {
%text = ScriptEditorDlg-->textpad.getText(); %text = ScriptEditorDlg-->textpad.getText();
%command = ScriptEditorDlg.callback @ "( %text );"; %command = ScriptEditorDlg.callback @ "(\"" @ expandEscape(%text) @ "\");";
eval(%command); eval(%command);
} }
ScriptEditorDlg.callback = ""; ScriptEditorDlg.callback = "";

View file

@ -1124,13 +1124,13 @@ function MaterialEditorGui::updateActiveMaterial(%this, %propertyField, %value,
MaterialEditorGui.submitUndo( %action ); MaterialEditorGui.submitUndo( %action );
} }
eval("materialEd_previewMaterial." @ %propertyField @ " = " @ %value @ ";"); materialEd_previewMaterial.setFieldValue(%propertyField, %value);
materialEd_previewMaterial.flush(); materialEd_previewMaterial.flush();
materialEd_previewMaterial.reload(); materialEd_previewMaterial.reload();
if (MaterialEditorGui.livePreview == true) if (MaterialEditorGui.livePreview == true)
{ {
eval("MaterialEditorGui.currentMaterial." @ %propertyField @ " = " @ %value @ ";"); MaterialEditorGui.setFieldValue(%propertyField, %value);
MaterialEditorGui.currentMaterial.flush(); MaterialEditorGui.currentMaterial.flush();
MaterialEditorGui.currentMaterial.reload(); MaterialEditorGui.currentMaterial.reload();
} }
@ -1173,7 +1173,7 @@ function MaterialEditorGui::updateMaterialReferences( %this, %obj, %oldName, %ne
%fieldName = %obj.getField( %i ); %fieldName = %obj.getField( %i );
if ( ( %obj.getFieldType( %fieldName ) $= "TypeMaterialName" ) && ( %obj.getFieldValue( %fieldName ) $= %oldName ) ) if ( ( %obj.getFieldType( %fieldName ) $= "TypeMaterialName" ) && ( %obj.getFieldValue( %fieldName ) $= %oldName ) )
{ {
eval( %obj @ "." @ %fieldName @ " = " @ %newName @ ";" ); %obj.setFieldValue(%fieldName, %newName);
%objChanged = true; %objChanged = true;
} }
} }
@ -1431,13 +1431,13 @@ function MaterialEditorGui::updateAnimationFlags(%this)
%action.oldValue = %oldFlags; %action.oldValue = %oldFlags;
MaterialEditorGui.submitUndo( %action ); MaterialEditorGui.submitUndo( %action );
eval("materialEd_previewMaterial.animFlags[" @ MaterialEditorGui.currentLayer @ "] = " @ %flags @ ";"); materialEd_previewMaterial.animFlags[MaterialEditorGui.currentLayer] = %flags;
materialEd_previewMaterial.flush(); materialEd_previewMaterial.flush();
materialEd_previewMaterial.reload(); materialEd_previewMaterial.reload();
if (MaterialEditorGui.livePreview == true) if (MaterialEditorGui.livePreview == true)
{ {
eval("MaterialEditorGui.currentMaterial.animFlags[" @ MaterialEditorGui.currentLayer @ "] = " @ %flags @ ";"); MaterialEditorGui.currentMaterial.animFlags[MaterialEditorGui.currentLayer] = %flags;
MaterialEditorGui.currentMaterial.flush(); MaterialEditorGui.currentMaterial.flush();
MaterialEditorGui.currentMaterial.reload(); MaterialEditorGui.currentMaterial.reload();
} }
@ -2324,7 +2324,7 @@ function MaterialEditorGui::changeMaterial(%this, %fromMaterial, %toMaterial)
{ {
%action.mode = "editorShapes"; %action.mode = "editorShapes";
eval("MaterialEditorGui.currentObject." @ SubMaterialSelector.getText() @ " = " @ %toMaterial.getName() @ ";"); MaterialEditorGui.currentObject.setFieldValue(SubMaterialSelector.getText(), %toMaterial.getName());
if( MaterialEditorGui.currentObject.isMethod("postApply") ) if( MaterialEditorGui.currentObject.isMethod("postApply") )
MaterialEditorGui.currentObject.postApply(); MaterialEditorGui.currentObject.postApply();

View file

@ -62,13 +62,13 @@ function ActionUpdateActiveMaterial::redo(%this)
MaterialEditorGui.setActiveMaterial(%this.material); MaterialEditorGui.setActiveMaterial(%this.material);
} }
*/ */
eval("materialEd_previewMaterial." @ %this.field @ " = " @ %this.newValue @ ";"); materialEd_previewMaterial.setFieldValue(%this.field, %this.newValue);
materialEd_previewMaterial.flush(); materialEd_previewMaterial.flush();
materialEd_previewMaterial.reload(); materialEd_previewMaterial.reload();
if (MaterialEditorGui.livePreview == true) if (MaterialEditorGui.livePreview == true)
{ {
eval("%this.material." @ %this.field @ " = " @ %this.newValue @ ";"); %this.material.setFieldValue(%this.field, %this.newValue);
MaterialEditorGui.currentMaterial.flush(); MaterialEditorGui.currentMaterial.flush();
MaterialEditorGui.currentMaterial.reload(); MaterialEditorGui.currentMaterial.reload();
} }
@ -80,7 +80,7 @@ function ActionUpdateActiveMaterial::redo(%this)
} }
else else
{ {
eval("%this.material." @ %this.field @ " = " @ %this.newValue @ ";"); %this.material.setFieldValue(%this.field, %this.newValue);
%this.material.flush(); %this.material.flush();
%this.material.reload(); %this.material.reload();
} }
@ -100,13 +100,13 @@ function ActionUpdateActiveMaterial::undo(%this)
} }
*/ */
eval("materialEd_previewMaterial." @ %this.field @ " = " @ %this.oldValue @ ";"); materialEd_previewMaterial.setFieldValue(%this.field, %this.oldValue);
materialEd_previewMaterial.flush(); materialEd_previewMaterial.flush();
materialEd_previewMaterial.reload(); materialEd_previewMaterial.reload();
if (MaterialEditorGui.livePreview == true) if (MaterialEditorGui.livePreview == true)
{ {
eval("%this.material." @ %this.field @ " = " @ %this.oldValue @ ";"); %this.material.setFieldValue(%this.field, %this.oldValue);
MaterialEditorGui.currentMaterial.flush(); MaterialEditorGui.currentMaterial.flush();
MaterialEditorGui.currentMaterial.reload(); MaterialEditorGui.currentMaterial.reload();
} }
@ -115,7 +115,7 @@ function ActionUpdateActiveMaterial::undo(%this)
} }
else else
{ {
eval("%this.material." @ %this.field @ " = " @ %this.oldValue @ ";"); %this.material.setFieldValue(%this.field, %this.oldValue);
%this.material.flush(); %this.material.flush();
%this.material.reload(); %this.material.reload();
} }
@ -138,13 +138,13 @@ function ActionUpdateActiveMaterialAnimationFlags::redo(%this)
} }
*/ */
eval("materialEd_previewMaterial.animFlags[" @ %this.layer @ "] = " @ %this.newValue @ ";"); materialEd_previewMaterial.animFlags[%this.layer] = %this.newValue;
materialEd_previewMaterial.flush(); materialEd_previewMaterial.flush();
materialEd_previewMaterial.reload(); materialEd_previewMaterial.reload();
if (MaterialEditorGui.livePreview == true) if (MaterialEditorGui.livePreview == true)
{ {
eval("%this.material.animFlags[" @ %this.layer @ "] = " @ %this.newValue @ ";"); %this.material.animFlags[%this.layer] = %this.newValue;
MaterialEditorGui.currentMaterial.flush(); MaterialEditorGui.currentMaterial.flush();
MaterialEditorGui.currentMaterial.reload(); MaterialEditorGui.currentMaterial.reload();
} }
@ -153,7 +153,7 @@ function ActionUpdateActiveMaterialAnimationFlags::redo(%this)
} }
else else
{ {
eval("%this.material.animFlags[" @ %this.layer @ "] = " @ %this.newValue @ ";"); %this.material.animFlags[%this.layer] = %this.newValue;
%this.material.flush(); %this.material.flush();
%this.material.reload(); %this.material.reload();
} }
@ -162,14 +162,14 @@ function ActionUpdateActiveMaterialAnimationFlags::redo(%this)
function ActionUpdateActiveMaterialAnimationFlags::undo(%this) function ActionUpdateActiveMaterialAnimationFlags::undo(%this)
{ {
if( MaterialEditorPreviewWindow.isVisible() && MaterialEditorGui.currentMaterial == %this.material ) if( MaterialEditorPreviewWindow.isVisible() && MaterialEditorGui.currentMaterial == %this.material )
{ {
eval("materialEd_previewMaterial.animFlags[" @ %this.layer @ "] = " @ %this.oldValue @ ";"); materialEd_previewMaterial.animFlags[%this.layer] = %this.oldValue;
materialEd_previewMaterial.flush(); materialEd_previewMaterial.flush();
materialEd_previewMaterial.reload(); materialEd_previewMaterial.reload();
if (MaterialEditorGui.livePreview == true) if (MaterialEditorGui.livePreview == true)
{ {
eval("%this.material.animFlags[" @ %this.layer @ "] = " @ %this.oldValue @ ";"); %this.material.animFlags[%this.layer] = %this.oldValue;
MaterialEditorGui.currentMaterial.flush(); MaterialEditorGui.currentMaterial.flush();
MaterialEditorGui.currentMaterial.reload(); MaterialEditorGui.currentMaterial.reload();
} }
@ -178,7 +178,7 @@ function ActionUpdateActiveMaterialAnimationFlags::undo(%this)
} }
else else
{ {
eval("%this.material.animFlags[" @ %this.layer @ "] = " @ %this.oldValue @ ";"); %this.material.animFlags[%this.layer] = %this.oldValue;
%this.material.flush(); %this.material.flush();
%this.material.reload(); %this.material.reload();
} }
@ -340,7 +340,7 @@ function ActionChangeMaterial::redo(%this)
} }
else else
{ {
eval("%this.object." @ %this.materialTarget @ " = " @ %this.toMaterial.getName() @ ";"); %this.object.setFieldValue(%this.materialTarget, %this.toMaterial.getName());
MaterialEditorGui.currentObject.postApply(); MaterialEditorGui.currentObject.postApply();
} }
@ -372,7 +372,7 @@ function ActionChangeMaterial::undo(%this)
} }
else else
{ {
eval("%this.object." @ %this.materialTarget @ " = " @ %this.fromMaterial.getName() @ ";"); %this.object.setFieldValue(%this.materialTarget, %this.fromMaterial.getName());
MaterialEditorGui.currentObject.postApply(); MaterialEditorGui.currentObject.postApply();
} }

View file

@ -262,7 +262,7 @@ function NavEditorGui::findCover(%this)
%pos = LocalClientConnection.getControlObject().getPosition(); %pos = LocalClientConnection.getControlObject().getPosition();
%text = NavEditorOptionsWindow-->TestProperties->CoverPosition.getText(); %text = NavEditorOptionsWindow-->TestProperties->CoverPosition.getText();
if(%text !$= "") if(%text !$= "")
%pos = eval(%text); %pos = eval("return " @ %text);
%this.getPlayer().findCover(%pos, NavEditorOptionsWindow-->TestProperties->CoverRadius.getText()); %this.getPlayer().findCover(%pos, NavEditorOptionsWindow-->TestProperties->CoverRadius.getText());
} }
} }
@ -275,7 +275,7 @@ function NavEditorGui::followObject(%this)
%text = NavEditorOptionsWindow-->TestProperties->FollowObject.getText(); %text = NavEditorOptionsWindow-->TestProperties->FollowObject.getText();
if(%text !$= "") if(%text !$= "")
{ {
eval("%obj = " @ %text); %obj = eval("return " @ %text);
if(!isObject(%obj)) if(!isObject(%obj))
toolsMessageBoxOk("Error", "Cannot find object" SPC %text); toolsMessageBoxOk("Error", "Cannot find object" SPC %text);
} }