diff --git a/Vanda Engine Editor/Debug/Assets/Docs/VandaEngineScriptingReferenceManual.chm b/Vanda Engine Editor/Debug/Assets/Docs/VandaEngineScriptingReferenceManual.chm index 11543b21..94d9c040 100644 Binary files a/Vanda Engine Editor/Debug/Assets/Docs/VandaEngineScriptingReferenceManual.chm and b/Vanda Engine Editor/Debug/Assets/Docs/VandaEngineScriptingReferenceManual.chm differ diff --git a/Vanda Engine Editor/Debug/Assets/Docs/VandaEngineScriptingReferenceManual.pdf b/Vanda Engine Editor/Debug/Assets/Docs/VandaEngineScriptingReferenceManual.pdf index c465cc73..304d5cf1 100644 Binary files a/Vanda Engine Editor/Debug/Assets/Docs/VandaEngineScriptingReferenceManual.pdf and b/Vanda Engine Editor/Debug/Assets/Docs/VandaEngineScriptingReferenceManual.pdf differ diff --git a/Vanda Engine Editor/Debug/Assets/Engine/Publish-Debug/publish-debug.exe b/Vanda Engine Editor/Debug/Assets/Engine/Publish-Debug/publish-debug.exe index 9f51202b..73661940 100644 Binary files a/Vanda Engine Editor/Debug/Assets/Engine/Publish-Debug/publish-debug.exe and b/Vanda Engine Editor/Debug/Assets/Engine/Publish-Debug/publish-debug.exe differ diff --git a/Vanda Engine Editor/Debug/Assets/Engine/Publish/publish.exe b/Vanda Engine Editor/Debug/Assets/Engine/Publish/publish.exe index 58a596ac..2a5ec785 100644 Binary files a/Vanda Engine Editor/Debug/Assets/Engine/Publish/publish.exe and b/Vanda Engine Editor/Debug/Assets/Engine/Publish/publish.exe differ diff --git a/Vanda Engine Editor/Debug/Readme.txt b/Vanda Engine Editor/Debug/Readme.txt index aed72811..3d837f5e 100644 --- a/Vanda Engine Editor/Debug/Readme.txt +++ b/Vanda Engine Editor/Debug/Readme.txt @@ -1,4 +1,4 @@ -Vanda Engine 2.9.6 +Vanda Engine 2.9.7 Copyright (C) 2023 Ehsan Kamrani www.vanda3d.org diff --git a/Vanda Engine Editor/VandaEngineEditor/Assets/Docs/VandaEngineScriptingReferenceManual.chm b/Vanda Engine Editor/VandaEngineEditor/Assets/Docs/VandaEngineScriptingReferenceManual.chm index 11543b21..94d9c040 100644 Binary files a/Vanda Engine Editor/VandaEngineEditor/Assets/Docs/VandaEngineScriptingReferenceManual.chm and b/Vanda Engine Editor/VandaEngineEditor/Assets/Docs/VandaEngineScriptingReferenceManual.chm differ diff --git a/Vanda Engine Editor/VandaEngineEditor/Assets/Docs/VandaEngineScriptingReferenceManual.pdf b/Vanda Engine Editor/VandaEngineEditor/Assets/Docs/VandaEngineScriptingReferenceManual.pdf index c465cc73..304d5cf1 100644 Binary files a/Vanda Engine Editor/VandaEngineEditor/Assets/Docs/VandaEngineScriptingReferenceManual.pdf and b/Vanda Engine Editor/VandaEngineEditor/Assets/Docs/VandaEngineScriptingReferenceManual.pdf differ diff --git a/Vanda Engine Editor/VandaEngineEditor/Assets/Engine/Publish-Debug/publish-debug.exe b/Vanda Engine Editor/VandaEngineEditor/Assets/Engine/Publish-Debug/publish-debug.exe index 9f51202b..73661940 100644 Binary files a/Vanda Engine Editor/VandaEngineEditor/Assets/Engine/Publish-Debug/publish-debug.exe and b/Vanda Engine Editor/VandaEngineEditor/Assets/Engine/Publish-Debug/publish-debug.exe differ diff --git a/Vanda Engine Editor/VandaEngineEditor/Assets/Engine/Publish/publish.exe b/Vanda Engine Editor/VandaEngineEditor/Assets/Engine/Publish/publish.exe index 58a596ac..2a5ec785 100644 Binary files a/Vanda Engine Editor/VandaEngineEditor/Assets/Engine/Publish/publish.exe and b/Vanda Engine Editor/VandaEngineEditor/Assets/Engine/Publish/publish.exe differ diff --git a/Vanda Engine Editor/VandaEngineEditor/EditProjectProperties.cpp b/Vanda Engine Editor/VandaEngineEditor/EditProjectProperties.cpp index f86a4f11..363d3901 100644 --- a/Vanda Engine Editor/VandaEngineEditor/EditProjectProperties.cpp +++ b/Vanda Engine Editor/VandaEngineEditor/EditProjectProperties.cpp @@ -149,7 +149,7 @@ void CEditProjectProperties::OnOK() } CChar temp[256]; - sprintf(temp, "%s%s%s%s%s", "Vanda Engine 2.9.6 (", newProjectName, " - ", m_currentVSceneNameWithoutDot, ")"); + sprintf(temp, "%s%s%s%s%s", "Vanda Engine 2.9.7 (", newProjectName, " - ", m_currentVSceneNameWithoutDot, ")"); ex_pVandaEngineDlg->SetWindowTextA(temp); //save changes to projects.dat @@ -230,7 +230,7 @@ void CEditProjectProperties::OnOK() } CChar temp[256]; - sprintf(temp, "%s%s%s%s%s", "Vanda Engine 2.9.6 (", newProject->m_name, " - ", m_currentVSceneNameWithoutDot, ")"); + sprintf(temp, "%s%s%s%s%s", "Vanda Engine 2.9.7 (", newProject->m_name, " - ", m_currentVSceneNameWithoutDot, ")"); ex_pVandaEngineDlg->SetWindowTextA(temp); //create new directory diff --git a/Vanda Engine Editor/VandaEngineEditor/GraphicsEngine/PerspectiveWindow.cpp b/Vanda Engine Editor/VandaEngineEditor/GraphicsEngine/PerspectiveWindow.cpp index 275fe1bf..c6e9bbc0 100644 --- a/Vanda Engine Editor/VandaEngineEditor/GraphicsEngine/PerspectiveWindow.cpp +++ b/Vanda Engine Editor/VandaEngineEditor/GraphicsEngine/PerspectiveWindow.cpp @@ -9579,6 +9579,650 @@ CInt DisablePrefabInstanceMaterial(lua_State* L) return 0; } +CInt GetPrefabInstanceAmbient(lua_State* L) +{ + if (g_testScript) + return 0; + + int argc = lua_gettop(L); + if (argc < 1) + { + PrintInfo("\nPlease specify 1 argument for GetPrefabInstanceAmbient()", COLOR_RED); + return 0; + } + + CChar luaToString[MAX_NAME_SIZE]; + Cpy(luaToString, lua_tostring(L, 1)); + StringToUpper(luaToString); + + CBool foundPrefabInstance = CFalse; + + CFloat ambientColor[3]; + + if (Cmp("THIS", luaToString)) + { + if (g_editorMode == eMODE_VSCENE) + { + if (g_currentInstancePrefab) + { + for (CUInt i = 0; i < 3; i++) + { + ambientColor[i] = g_currentInstancePrefab->GetAmbient()[i]; + lua_pushnumber(L, ambientColor[i]); + } + + return 3; + } + else + { + PrintInfo("\nGetPrefabInstanceAmbient() Error: Couldn't find current prefab instance", COLOR_RED); + } + return 0; + } + else if (g_editorMode == eMODE_PREFAB) + { + CChar temp[MAX_NAME_SIZE]; + sprintf(temp, "\nGetPrefabInstanceAmbient() will execute for current prefab instance"); + PrintInfo(temp, COLOR_GREEN); + return 0; + } + } + + if (g_editorMode == eMODE_PREFAB || g_editorMode == eMODE_GUI) + { + for (CUInt pr = 0; pr < g_projects.size(); pr++) + { + for (CUInt i = 0; i < g_projects[pr]->m_vsceneObjectNames.size(); i++) + { + for (CUInt j = 0; j < g_projects[pr]->m_vsceneObjectNames[i].m_instancePrefabNames.size(); j++) + { + CChar prefabInstanceName[MAX_NAME_SIZE]; + Cpy(prefabInstanceName, g_projects[pr]->m_vsceneObjectNames[i].m_instancePrefabNames[j].m_name); + StringToUpper(prefabInstanceName); + + if (Cmp(prefabInstanceName, luaToString)) + { + foundPrefabInstance = CTrue; + CChar message[MAX_NAME_SIZE]; + sprintf(message, "\nProject '%s', VScene '%s' : GetPrefabInstanceAmbient(%s) will execute", g_projects[pr]->m_name, g_projects[pr]->m_sceneNames[i].c_str(), g_projects[pr]->m_vsceneObjectNames[i].m_instancePrefabNames[j].m_name); + PrintInfo(message, COLOR_GREEN); + break; + } + } + } + } + if (!foundPrefabInstance) + { + CChar temp[MAX_NAME_SIZE]; + sprintf(temp, "\nGetPrefabInstanceAmbient() Error: %s%s%s", "Couldn't find '", luaToString, "' Prefab Instance"); + PrintInfo(temp, COLOR_RED); + } + + return 0; + } + + for (CUInt i = 0; i < g_instancePrefab.size(); i++) + { + CChar prefabName[MAX_NAME_SIZE]; + Cpy(prefabName, g_instancePrefab[i]->GetName()); + StringToUpper(prefabName); + if (Cmp(prefabName, luaToString)) + { + foundPrefabInstance = CTrue; + for (CUInt j = 0; j < 3; j++) + { + ambientColor[j] = g_instancePrefab[i]->GetAmbient()[j]; + lua_pushnumber(L, ambientColor[j]); + } + + return 3; + } + } + if (!foundPrefabInstance) + { + CChar temp[MAX_NAME_SIZE]; + sprintf(temp, "\nGetPrefabInstanceAmbient() Error: %s%s%s", "Couldn't find '", luaToString, "' Prefab Instance"); + PrintInfo(temp, COLOR_RED); + return 0; + } + + return 0; +} + +CInt GetPrefabInstanceDiffuse(lua_State* L) +{ + if (g_testScript) + return 0; + + int argc = lua_gettop(L); + if (argc < 1) + { + PrintInfo("\nPlease specify 1 argument for GetPrefabInstanceDiffuse()", COLOR_RED); + return 0; + } + + CChar luaToString[MAX_NAME_SIZE]; + Cpy(luaToString, lua_tostring(L, 1)); + StringToUpper(luaToString); + + CBool foundPrefabInstance = CFalse; + + CFloat diffuseColor[3]; + + if (Cmp("THIS", luaToString)) + { + if (g_editorMode == eMODE_VSCENE) + { + if (g_currentInstancePrefab) + { + for (CUInt i = 0; i < 3; i++) + { + diffuseColor[i] = g_currentInstancePrefab->GetDiffuse()[i]; + lua_pushnumber(L, diffuseColor[i]); + } + + return 3; + } + else + { + PrintInfo("\nGetPrefabInstanceDiffuse() Error: Couldn't find current prefab instance", COLOR_RED); + } + return 0; + } + else if (g_editorMode == eMODE_PREFAB) + { + CChar temp[MAX_NAME_SIZE]; + sprintf(temp, "\nGetPrefabInstanceDiffuse() will execute for current prefab instance"); + PrintInfo(temp, COLOR_GREEN); + return 0; + } + } + + if (g_editorMode == eMODE_PREFAB || g_editorMode == eMODE_GUI) + { + for (CUInt pr = 0; pr < g_projects.size(); pr++) + { + for (CUInt i = 0; i < g_projects[pr]->m_vsceneObjectNames.size(); i++) + { + for (CUInt j = 0; j < g_projects[pr]->m_vsceneObjectNames[i].m_instancePrefabNames.size(); j++) + { + CChar prefabInstanceName[MAX_NAME_SIZE]; + Cpy(prefabInstanceName, g_projects[pr]->m_vsceneObjectNames[i].m_instancePrefabNames[j].m_name); + StringToUpper(prefabInstanceName); + + if (Cmp(prefabInstanceName, luaToString)) + { + foundPrefabInstance = CTrue; + CChar message[MAX_NAME_SIZE]; + sprintf(message, "\nProject '%s', VScene '%s' : GetPrefabInstanceDiffuse(%s) will execute", g_projects[pr]->m_name, g_projects[pr]->m_sceneNames[i].c_str(), g_projects[pr]->m_vsceneObjectNames[i].m_instancePrefabNames[j].m_name); + PrintInfo(message, COLOR_GREEN); + break; + } + } + } + } + if (!foundPrefabInstance) + { + CChar temp[MAX_NAME_SIZE]; + sprintf(temp, "\nGetPrefabInstanceDiffuse() Error: %s%s%s", "Couldn't find '", luaToString, "' Prefab Instance"); + PrintInfo(temp, COLOR_RED); + } + + return 0; + } + + for (CUInt i = 0; i < g_instancePrefab.size(); i++) + { + CChar prefabName[MAX_NAME_SIZE]; + Cpy(prefabName, g_instancePrefab[i]->GetName()); + StringToUpper(prefabName); + if (Cmp(prefabName, luaToString)) + { + foundPrefabInstance = CTrue; + for (CUInt j = 0; j < 3; j++) + { + diffuseColor[j] = g_instancePrefab[i]->GetDiffuse()[j]; + lua_pushnumber(L, diffuseColor[j]); + } + + return 3; + } + } + if (!foundPrefabInstance) + { + CChar temp[MAX_NAME_SIZE]; + sprintf(temp, "\nGetPrefabInstanceDiffuse() Error: %s%s%s", "Couldn't find '", luaToString, "' Prefab Instance"); + PrintInfo(temp, COLOR_RED); + return 0; + } + + return 0; +} + +CInt GetPrefabInstanceSpecular(lua_State* L) +{ + if (g_testScript) + return 0; + + int argc = lua_gettop(L); + if (argc < 1) + { + PrintInfo("\nPlease specify 1 argument for GetPrefabInstanceSpecular()", COLOR_RED); + return 0; + } + + CChar luaToString[MAX_NAME_SIZE]; + Cpy(luaToString, lua_tostring(L, 1)); + StringToUpper(luaToString); + + CBool foundPrefabInstance = CFalse; + + CFloat specularColor[3]; + + if (Cmp("THIS", luaToString)) + { + if (g_editorMode == eMODE_VSCENE) + { + if (g_currentInstancePrefab) + { + for (CUInt i = 0; i < 3; i++) + { + specularColor[i] = g_currentInstancePrefab->GetSpecular()[i]; + lua_pushnumber(L, specularColor[i]); + } + + return 3; + } + else + { + PrintInfo("\nGetPrefabInstanceSpecular() Error: Couldn't find current prefab instance", COLOR_RED); + } + return 0; + } + else if (g_editorMode == eMODE_PREFAB) + { + CChar temp[MAX_NAME_SIZE]; + sprintf(temp, "\nGetPrefabInstanceSpecular() will execute for current prefab instance"); + PrintInfo(temp, COLOR_GREEN); + return 0; + } + } + + if (g_editorMode == eMODE_PREFAB || g_editorMode == eMODE_GUI) + { + for (CUInt pr = 0; pr < g_projects.size(); pr++) + { + for (CUInt i = 0; i < g_projects[pr]->m_vsceneObjectNames.size(); i++) + { + for (CUInt j = 0; j < g_projects[pr]->m_vsceneObjectNames[i].m_instancePrefabNames.size(); j++) + { + CChar prefabInstanceName[MAX_NAME_SIZE]; + Cpy(prefabInstanceName, g_projects[pr]->m_vsceneObjectNames[i].m_instancePrefabNames[j].m_name); + StringToUpper(prefabInstanceName); + + if (Cmp(prefabInstanceName, luaToString)) + { + foundPrefabInstance = CTrue; + CChar message[MAX_NAME_SIZE]; + sprintf(message, "\nProject '%s', VScene '%s' : GetPrefabInstanceSpecular(%s) will execute", g_projects[pr]->m_name, g_projects[pr]->m_sceneNames[i].c_str(), g_projects[pr]->m_vsceneObjectNames[i].m_instancePrefabNames[j].m_name); + PrintInfo(message, COLOR_GREEN); + break; + } + } + } + } + if (!foundPrefabInstance) + { + CChar temp[MAX_NAME_SIZE]; + sprintf(temp, "\nGetPrefabInstanceSpecular() Error: %s%s%s", "Couldn't find '", luaToString, "' Prefab Instance"); + PrintInfo(temp, COLOR_RED); + } + + return 0; + } + + for (CUInt i = 0; i < g_instancePrefab.size(); i++) + { + CChar prefabName[MAX_NAME_SIZE]; + Cpy(prefabName, g_instancePrefab[i]->GetName()); + StringToUpper(prefabName); + if (Cmp(prefabName, luaToString)) + { + foundPrefabInstance = CTrue; + for (CUInt j = 0; j < 3; j++) + { + specularColor[j] = g_instancePrefab[i]->GetSpecular()[j]; + lua_pushnumber(L, specularColor[j]); + } + + return 3; + } + } + if (!foundPrefabInstance) + { + CChar temp[MAX_NAME_SIZE]; + sprintf(temp, "\nGetPrefabInstanceSpecular() Error: %s%s%s", "Couldn't find '", luaToString, "' Prefab Instance"); + PrintInfo(temp, COLOR_RED); + return 0; + } + + return 0; +} + +CInt GetPrefabInstanceEmission(lua_State* L) +{ + if (g_testScript) + return 0; + + int argc = lua_gettop(L); + if (argc < 1) + { + PrintInfo("\nPlease specify 1 argument for GetPrefabInstanceEmission()", COLOR_RED); + return 0; + } + + CChar luaToString[MAX_NAME_SIZE]; + Cpy(luaToString, lua_tostring(L, 1)); + StringToUpper(luaToString); + + CBool foundPrefabInstance = CFalse; + + CFloat emissionColor[3]; + + if (Cmp("THIS", luaToString)) + { + if (g_editorMode == eMODE_VSCENE) + { + if (g_currentInstancePrefab) + { + for (CUInt i = 0; i < 3; i++) + { + emissionColor[i] = g_currentInstancePrefab->GetEmission()[i]; + lua_pushnumber(L, emissionColor[i]); + } + + return 3; + } + else + { + PrintInfo("\nGetPrefabInstanceEmission() Error: Couldn't find current prefab instance", COLOR_RED); + } + return 0; + } + else if (g_editorMode == eMODE_PREFAB) + { + CChar temp[MAX_NAME_SIZE]; + sprintf(temp, "\nGetPrefabInstanceEmission() will execute for current prefab instance"); + PrintInfo(temp, COLOR_GREEN); + return 0; + } + } + + if (g_editorMode == eMODE_PREFAB || g_editorMode == eMODE_GUI) + { + for (CUInt pr = 0; pr < g_projects.size(); pr++) + { + for (CUInt i = 0; i < g_projects[pr]->m_vsceneObjectNames.size(); i++) + { + for (CUInt j = 0; j < g_projects[pr]->m_vsceneObjectNames[i].m_instancePrefabNames.size(); j++) + { + CChar prefabInstanceName[MAX_NAME_SIZE]; + Cpy(prefabInstanceName, g_projects[pr]->m_vsceneObjectNames[i].m_instancePrefabNames[j].m_name); + StringToUpper(prefabInstanceName); + + if (Cmp(prefabInstanceName, luaToString)) + { + foundPrefabInstance = CTrue; + CChar message[MAX_NAME_SIZE]; + sprintf(message, "\nProject '%s', VScene '%s' : GetPrefabInstanceEmission(%s) will execute", g_projects[pr]->m_name, g_projects[pr]->m_sceneNames[i].c_str(), g_projects[pr]->m_vsceneObjectNames[i].m_instancePrefabNames[j].m_name); + PrintInfo(message, COLOR_GREEN); + break; + } + } + } + } + if (!foundPrefabInstance) + { + CChar temp[MAX_NAME_SIZE]; + sprintf(temp, "\nGetPrefabInstanceEmission() Error: %s%s%s", "Couldn't find '", luaToString, "' Prefab Instance"); + PrintInfo(temp, COLOR_RED); + } + + return 0; + } + + for (CUInt i = 0; i < g_instancePrefab.size(); i++) + { + CChar prefabName[MAX_NAME_SIZE]; + Cpy(prefabName, g_instancePrefab[i]->GetName()); + StringToUpper(prefabName); + if (Cmp(prefabName, luaToString)) + { + foundPrefabInstance = CTrue; + for (CUInt j = 0; j < 3; j++) + { + emissionColor[j] = g_instancePrefab[i]->GetEmission()[j]; + lua_pushnumber(L, emissionColor[j]); + } + + return 3; + } + } + if (!foundPrefabInstance) + { + CChar temp[MAX_NAME_SIZE]; + sprintf(temp, "\nGetPrefabInstanceEmission() Error: %s%s%s", "Couldn't find '", luaToString, "' Prefab Instance"); + PrintInfo(temp, COLOR_RED); + return 0; + } + + return 0; +} + +CInt GetPrefabInstanceShininess(lua_State* L) +{ + if (g_testScript) + return 0; + + int argc = lua_gettop(L); + if (argc < 1) + { + PrintInfo("\nPlease specify 1 argument for GetPrefabInstanceShininess()", COLOR_RED); + return 0; + } + + CChar luaToString[MAX_NAME_SIZE]; + Cpy(luaToString, lua_tostring(L, 1)); + StringToUpper(luaToString); + + CBool foundPrefabInstance = CFalse; + + CFloat shininess = 0.0; + + if (Cmp("THIS", luaToString)) + { + if (g_editorMode == eMODE_VSCENE) + { + if (g_currentInstancePrefab) + { + shininess = g_currentInstancePrefab->GetShininess(); + lua_pushnumber(L, shininess); + return 1; + } + else + { + PrintInfo("\nGetPrefabInstanceShininess() Error: Couldn't find current prefab instance", COLOR_RED); + } + return 0; + } + else if (g_editorMode == eMODE_PREFAB) + { + CChar temp[MAX_NAME_SIZE]; + sprintf(temp, "\nGetPrefabInstanceShininess() will execute for current prefab instance"); + PrintInfo(temp, COLOR_GREEN); + return 0; + } + } + + if (g_editorMode == eMODE_PREFAB || g_editorMode == eMODE_GUI) + { + for (CUInt pr = 0; pr < g_projects.size(); pr++) + { + for (CUInt i = 0; i < g_projects[pr]->m_vsceneObjectNames.size(); i++) + { + for (CUInt j = 0; j < g_projects[pr]->m_vsceneObjectNames[i].m_instancePrefabNames.size(); j++) + { + CChar prefabInstanceName[MAX_NAME_SIZE]; + Cpy(prefabInstanceName, g_projects[pr]->m_vsceneObjectNames[i].m_instancePrefabNames[j].m_name); + StringToUpper(prefabInstanceName); + + if (Cmp(prefabInstanceName, luaToString)) + { + foundPrefabInstance = CTrue; + CChar message[MAX_NAME_SIZE]; + sprintf(message, "\nProject '%s', VScene '%s' : GetPrefabInstanceShininess(%s) will execute", g_projects[pr]->m_name, g_projects[pr]->m_sceneNames[i].c_str(), g_projects[pr]->m_vsceneObjectNames[i].m_instancePrefabNames[j].m_name); + PrintInfo(message, COLOR_GREEN); + break; + } + } + } + } + if (!foundPrefabInstance) + { + CChar temp[MAX_NAME_SIZE]; + sprintf(temp, "\nGetPrefabInstanceShininess() Error: %s%s%s", "Couldn't find '", luaToString, "' Prefab Instance"); + PrintInfo(temp, COLOR_RED); + } + + return 0; + } + + for (CUInt i = 0; i < g_instancePrefab.size(); i++) + { + CChar prefabName[MAX_NAME_SIZE]; + Cpy(prefabName, g_instancePrefab[i]->GetName()); + StringToUpper(prefabName); + if (Cmp(prefabName, luaToString)) + { + foundPrefabInstance = CTrue; + shininess = g_instancePrefab[i]->GetShininess(); + lua_pushnumber(L, shininess); + return 1; + } + } + if (!foundPrefabInstance) + { + CChar temp[MAX_NAME_SIZE]; + sprintf(temp, "\nGetPrefabInstanceShininess() Error: %s%s%s", "Couldn't find '", luaToString, "' Prefab Instance"); + PrintInfo(temp, COLOR_RED); + return 0; + } + + return 0; +} + +CInt GetPrefabInstanceTransparency(lua_State* L) +{ + if (g_testScript) + return 0; + + int argc = lua_gettop(L); + if (argc < 1) + { + PrintInfo("\nPlease specify 1 argument for GetPrefabInstanceTransparency()", COLOR_RED); + return 0; + } + + CChar luaToString[MAX_NAME_SIZE]; + Cpy(luaToString, lua_tostring(L, 1)); + StringToUpper(luaToString); + + CBool foundPrefabInstance = CFalse; + + CFloat transparency = 0.0; + + if (Cmp("THIS", luaToString)) + { + if (g_editorMode == eMODE_VSCENE) + { + if (g_currentInstancePrefab) + { + transparency = g_currentInstancePrefab->GetTransparency(); + lua_pushnumber(L, transparency); + return 1; + } + else + { + PrintInfo("\nGetPrefabInstanceTransparency() Error: Couldn't find current prefab instance", COLOR_RED); + } + return 0; + } + else if (g_editorMode == eMODE_PREFAB) + { + CChar temp[MAX_NAME_SIZE]; + sprintf(temp, "\nGetPrefabInstanceTransparency() will execute for current prefab instance"); + PrintInfo(temp, COLOR_GREEN); + return 0; + } + } + + if (g_editorMode == eMODE_PREFAB || g_editorMode == eMODE_GUI) + { + for (CUInt pr = 0; pr < g_projects.size(); pr++) + { + for (CUInt i = 0; i < g_projects[pr]->m_vsceneObjectNames.size(); i++) + { + for (CUInt j = 0; j < g_projects[pr]->m_vsceneObjectNames[i].m_instancePrefabNames.size(); j++) + { + CChar prefabInstanceName[MAX_NAME_SIZE]; + Cpy(prefabInstanceName, g_projects[pr]->m_vsceneObjectNames[i].m_instancePrefabNames[j].m_name); + StringToUpper(prefabInstanceName); + + if (Cmp(prefabInstanceName, luaToString)) + { + foundPrefabInstance = CTrue; + CChar message[MAX_NAME_SIZE]; + sprintf(message, "\nProject '%s', VScene '%s' : GetPrefabInstanceTransparency(%s) will execute", g_projects[pr]->m_name, g_projects[pr]->m_sceneNames[i].c_str(), g_projects[pr]->m_vsceneObjectNames[i].m_instancePrefabNames[j].m_name); + PrintInfo(message, COLOR_GREEN); + break; + } + } + } + } + if (!foundPrefabInstance) + { + CChar temp[MAX_NAME_SIZE]; + sprintf(temp, "\nGetPrefabInstanceTransparency() Error: %s%s%s", "Couldn't find '", luaToString, "' Prefab Instance"); + PrintInfo(temp, COLOR_RED); + } + + return 0; + } + + for (CUInt i = 0; i < g_instancePrefab.size(); i++) + { + CChar prefabName[MAX_NAME_SIZE]; + Cpy(prefabName, g_instancePrefab[i]->GetName()); + StringToUpper(prefabName); + if (Cmp(prefabName, luaToString)) + { + foundPrefabInstance = CTrue; + transparency = g_instancePrefab[i]->GetTransparency(); + lua_pushnumber(L, transparency); + return 1; + } + } + if (!foundPrefabInstance) + { + CChar temp[MAX_NAME_SIZE]; + sprintf(temp, "\nGetPrefabInstanceTransparency() Error: %s%s%s", "Couldn't find '", luaToString, "' Prefab Instance"); + PrintInfo(temp, COLOR_RED); + return 0; + } + + return 0; +} + CInt SetPhysicsDefaultRestitution(lua_State* L) { diff --git a/Vanda Engine Editor/VandaEngineEditor/GraphicsEngine/Scene.cpp b/Vanda Engine Editor/VandaEngineEditor/GraphicsEngine/Scene.cpp index caab560d..d2619585 100644 --- a/Vanda Engine Editor/VandaEngineEditor/GraphicsEngine/Scene.cpp +++ b/Vanda Engine Editor/VandaEngineEditor/GraphicsEngine/Scene.cpp @@ -144,7 +144,7 @@ CInt CScene::WriteZipFile(CChar* zipFileName, CChar* fileInZipName, CChar* fileI CChar temp[MAX_NAME_SIZE]; sprintf(temp, "\n%s %s %s", "Error in opening",fileInZipPath, "in zipfile"); zipCloseFileInZip(zf); - zipClose(zipOpen, "Vanda Engine 2.9.6"); + zipClose(zipOpen, "Vanda Engine 2.9.7"); free(buf); return -1; } @@ -157,7 +157,7 @@ CInt CScene::WriteZipFile(CChar* zipFileName, CChar* fileInZipName, CChar* fileI //sprintf(temp, "\n%s %s %s", "Error in opening",fileInZipPath, "for reading"); //PrintInfo( temp, COLOR_RED ); //zipCloseFileInZip(zf); - //zipClose(zf, "Vanda Engine 2.9.6"); + //zipClose(zf, "Vanda Engine 2.9.7"); //free(buf); //return -1; // } @@ -173,7 +173,7 @@ CInt CScene::WriteZipFile(CChar* zipFileName, CChar* fileInZipName, CChar* fileI CChar temp[MAX_NAME_SIZE]; sprintf(temp, "\n%s%s", "Error in reading ",fileInZipPath); zipCloseFileInZip(zf); - zipClose(zf, "Vanda Engine 2.9.6"); + zipClose(zf, "Vanda Engine 2.9.7"); free(buf); return -1; } @@ -188,7 +188,7 @@ CInt CScene::WriteZipFile(CChar* zipFileName, CChar* fileInZipName, CChar* fileI sprintf( temp, "\n%s%s%s", "Error in writing ", fileInZipPath, " in the zipfile"); zipCloseFileInZip(zf); - zipClose(zf, "Vanda Engine 2.9.6"); + zipClose(zf, "Vanda Engine 2.9.7"); free(buf); return -1; } @@ -198,7 +198,7 @@ CInt CScene::WriteZipFile(CChar* zipFileName, CChar* fileInZipName, CChar* fileI if (fin) fclose(fin); zipCloseFileInZip(zf); - zipClose(zf,"Vanda Engine 2.9.6"); + zipClose(zf,"Vanda Engine 2.9.7"); free(buf); return 1; } diff --git a/Vanda Engine Editor/VandaEngineEditor/ScriptEditorAddFunction.cpp b/Vanda Engine Editor/VandaEngineEditor/ScriptEditorAddFunction.cpp index cdac2b39..2b7672e4 100644 --- a/Vanda Engine Editor/VandaEngineEditor/ScriptEditorAddFunction.cpp +++ b/Vanda Engine Editor/VandaEngineEditor/ScriptEditorAddFunction.cpp @@ -160,6 +160,13 @@ CScriptEditorAddFunction::CScriptEditorAddFunction(CWnd* pParent /*=NULL*/) Cpy(EnablePrefabInstanceMaterial, "EnablePrefabInstanceMaterial(string prefabInstanceName)"); Cpy(DisablePrefabInstanceMaterial, "DisablePrefabInstanceMaterial(string prefabInstanceName)"); + Cpy(GetPrefabInstanceAmbient, "double, double, double GetPrefabInstanceAmbient(string prefabInstanceName)"); + Cpy(GetPrefabInstanceDiffuse, "double, double, double GetPrefabInstanceDiffuse(string prefabInstanceName)"); + Cpy(GetPrefabInstanceSpecular, "double, double, double GetPrefabInstanceSpecular(string prefabInstanceName)"); + Cpy(GetPrefabInstanceEmission, "double, double, double GetPrefabInstanceEmission(string prefabInstanceName)"); + Cpy(GetPrefabInstanceShininess, "double GetPrefabInstanceShininess(string prefabInstanceName)"); + Cpy(GetPrefabInstanceTransparency, "double GetPrefabInstanceTransparency(string prefabInstanceName)"); + Cpy(SetPhysicsDefaultRestitution, "SetPhysicsDefaultRestitution(float restitution)"); Cpy(SetPhysicsDefaultSkinWidth, "SetPhysicsDefaultSkinWidth(float skinWidth)"); Cpy(SetPhysicsDefaultStaticFriction, "SetPhysicsDefaultStaticFriction(float staticFriction)"); @@ -2623,6 +2630,30 @@ void CScriptEditorAddFunction::OnLvnItemchangedListFunctions(NMHDR *pNMHDR, LRES { m_richFunctionName.SetWindowTextA(GetDirectionalShadowLight); } + else if (Cmp(szBuffer, "GetPrefabInstanceAmbient")) + { + m_richFunctionName.SetWindowTextA(GetPrefabInstanceAmbient); + } + else if (Cmp(szBuffer, "GetPrefabInstanceDiffuse")) + { + m_richFunctionName.SetWindowTextA(GetPrefabInstanceDiffuse); + } + else if (Cmp(szBuffer, "GetPrefabInstanceSpecular")) + { + m_richFunctionName.SetWindowTextA(GetPrefabInstanceSpecular); + } + else if (Cmp(szBuffer, "GetPrefabInstanceEmission")) + { + m_richFunctionName.SetWindowTextA(GetPrefabInstanceEmission); + } + else if (Cmp(szBuffer, "GetPrefabInstanceShininess")) + { + m_richFunctionName.SetWindowTextA(GetPrefabInstanceShininess); + } + else if (Cmp(szBuffer, "GetPrefabInstanceTransparency")) + { + m_richFunctionName.SetWindowTextA(GetPrefabInstanceTransparency); + } CInt end = m_richFunctionName.GetWindowTextLengthA(); m_richFunctionName.SetSel(0, end); @@ -2796,6 +2827,13 @@ BOOL CScriptEditorAddFunction::OnInitDialog() InsertItem("EnablePrefabInstanceMaterial"); InsertItem("DisablePrefabInstanceMaterial"); + InsertItem("GetPrefabInstanceAmbient"); + InsertItem("GetPrefabInstanceDiffuse"); + InsertItem("GetPrefabInstanceSpecular"); + InsertItem("GetPrefabInstanceEmission"); + InsertItem("GetPrefabInstanceShininess"); + InsertItem("GetPrefabInstanceTransparency"); + InsertItem("SetPhysicsDefaultRestitution"); InsertItem("SetPhysicsDefaultSkinWidth"); InsertItem("SetPhysicsDefaultStaticFriction"); diff --git a/Vanda Engine Editor/VandaEngineEditor/ScriptEditorAddFunction.h b/Vanda Engine Editor/VandaEngineEditor/ScriptEditorAddFunction.h index 2f7c8d36..0f8e39f2 100644 --- a/Vanda Engine Editor/VandaEngineEditor/ScriptEditorAddFunction.h +++ b/Vanda Engine Editor/VandaEngineEditor/ScriptEditorAddFunction.h @@ -172,6 +172,13 @@ class CScriptEditorAddFunction : public CDialog CChar EnablePrefabInstanceMaterial[MAX_URI_SIZE]; CChar DisablePrefabInstanceMaterial[MAX_URI_SIZE]; + CChar GetPrefabInstanceAmbient[MAX_URI_SIZE]; + CChar GetPrefabInstanceDiffuse[MAX_URI_SIZE]; + CChar GetPrefabInstanceSpecular[MAX_URI_SIZE]; + CChar GetPrefabInstanceEmission[MAX_URI_SIZE]; + CChar GetPrefabInstanceShininess[MAX_URI_SIZE]; + CChar GetPrefabInstanceTransparency[MAX_URI_SIZE]; + CChar SetPhysicsDefaultRestitution[MAX_URI_SIZE]; CChar SetPhysicsDefaultSkinWidth[MAX_URI_SIZE]; CChar SetPhysicsDefaultStaticFriction[MAX_URI_SIZE]; diff --git a/Vanda Engine Editor/VandaEngineEditor/ScriptEngine/LuaForCpp.h b/Vanda Engine Editor/VandaEngineEditor/ScriptEngine/LuaForCpp.h index cb7fcbc8..668f5766 100644 --- a/Vanda Engine Editor/VandaEngineEditor/ScriptEngine/LuaForCpp.h +++ b/Vanda Engine Editor/VandaEngineEditor/ScriptEngine/LuaForCpp.h @@ -222,6 +222,13 @@ static void LuaRegisterFunctions(lua_State* L) lua_register(L, "EnablePrefabInstanceMaterial", EnablePrefabInstanceMaterial); lua_register(L, "DisablePrefabInstanceMaterial", DisablePrefabInstanceMaterial); + lua_register(L, "GetPrefabInstanceAmbient", GetPrefabInstanceAmbient); + lua_register(L, "GetPrefabInstanceDiffuse", GetPrefabInstanceDiffuse); + lua_register(L, "GetPrefabInstanceSpecular", GetPrefabInstanceSpecular); + lua_register(L, "GetPrefabInstanceEmission", GetPrefabInstanceEmission); + lua_register(L, "GetPrefabInstanceShininess", GetPrefabInstanceShininess); + lua_register(L, "GetPrefabInstanceTransparency", GetPrefabInstanceTransparency); + lua_register(L, "SetPhysicsDefaultRestitution", SetPhysicsDefaultRestitution); lua_register(L, "SetPhysicsDefaultSkinWidth", SetPhysicsDefaultSkinWidth); lua_register(L, "SetPhysicsDefaultStaticFriction", SetPhysicsDefaultStaticFriction); diff --git a/Vanda Engine Editor/VandaEngineEditor/SetCurrentProject.cpp b/Vanda Engine Editor/VandaEngineEditor/SetCurrentProject.cpp index e50e61e3..481757be 100644 --- a/Vanda Engine Editor/VandaEngineEditor/SetCurrentProject.cpp +++ b/Vanda Engine Editor/VandaEngineEditor/SetCurrentProject.cpp @@ -165,7 +165,7 @@ void CSetCurrentProject::OnOK() } CChar temp[256]; - sprintf(temp, "%s%s%s%s%s", "Vanda Engine 2.9.6 (", szBuffer, " - ", m_currentVSceneNameWithoutDot, ")"); + sprintf(temp, "%s%s%s%s%s", "Vanda Engine 2.9.7 (", szBuffer, " - ", m_currentVSceneNameWithoutDot, ")"); ex_pVandaEngineDlg->SetWindowTextA(temp); //save the changes to projects.dat FILE *ProjectsFilePtr; diff --git a/Vanda Engine Editor/VandaEngineEditor/VandaEngineEditor.rc b/Vanda Engine Editor/VandaEngineEditor/VandaEngineEditor.rc index d5019666..1c8e6100 100644 --- a/Vanda Engine Editor/VandaEngineEditor/VandaEngineEditor.rc +++ b/Vanda Engine Editor/VandaEngineEditor/VandaEngineEditor.rc @@ -2894,7 +2894,7 @@ BEGIN LTEXT "Do not show this dialog at startup",IDC_STATIC,20,151,155,10 CONTROL "Tick",IDC_WELCOME_BUTTON_UNCHECK,"Button",BS_OWNERDRAW | WS_TABSTOP,5,149,12,12 CONTROL IDB_BITMAP7,IDC_STATIC,"Static",SS_BITMAP,2,3,77,19 - LTEXT "Version 2.9.6",IDC_STATIC,7,33,60,8 + LTEXT "Version 2.9.7",IDC_STATIC,7,33,60,8 LTEXT "© 2023 Ehsan Kamrani",IDC_STATIC,7,50,126,9 CONTROL "Tutorials",IDDONATE,"Button",BS_OWNERDRAW | WS_TABSTOP,15,91,52,16 LTEXT "To see the demo, please go to File | Open menu.",IDC_STATIC,9,69,167,9 @@ -3054,7 +3054,7 @@ CAPTION "About Vanda Engine" FONT 9, "Century Gothic", 400, 0, 0x0 BEGIN DEFPUSHBUTTON "OK",IDOK,241,114,50,16,WS_GROUP - LTEXT "VandaEngine Version 2.9.6",IDC_STATIC,103,7,123,8,SS_NOPREFIX + LTEXT "VandaEngine Version 2.9.7",IDC_STATIC,103,7,123,8,SS_NOPREFIX CONTROL IDB_BITMAP_SCENE_LIST,IDC_STATIC,"Static",SS_BITMAP,21,79,59,17 CONTROL IDB_BITMAP1,IDC_STATIC,"Static",SS_BITMAP,83,79,67,17 CONTROL IDB_BITMAP_OPENAL_LOGO,IDC_STATIC,"Static",SS_BITMAP,153,73,59,27 @@ -3631,12 +3631,12 @@ BEGIN BEGIN VALUE "CompanyName", "Ehsan Kamrani " VALUE "FileDescription", "Vanda Engine" - VALUE "FileVersion", "2.9.6" + VALUE "FileVersion", "2.9.7" VALUE "internalName", "VandaEngine.exe" VALUE "LegalCopyright", "(c) 2023 Ehsan Kamrani . All rights reserved." VALUE "OriginalFilename", "VandaEngine.exe" VALUE "ProductName", " Vanda Engine" - VALUE "ProductVersion", "2.9.6" + VALUE "ProductVersion", "2.9.7" END END BLOCK "VarFileInfo" diff --git a/Vanda Engine Editor/VandaEngineEditor/VandaEngineEditorDlg.cpp b/Vanda Engine Editor/VandaEngineEditor/VandaEngineEditorDlg.cpp index 62dbf645..313a9153 100644 --- a/Vanda Engine Editor/VandaEngineEditor/VandaEngineEditorDlg.cpp +++ b/Vanda Engine Editor/VandaEngineEditor/VandaEngineEditorDlg.cpp @@ -27,7 +27,7 @@ #endif //Version = Max.Min.BugFixes; -CInt g_version = 296; +CInt g_version = 297; CChar g_edition[MAX_NAME_SIZE]; CBool g_useOriginalPathOfDAETextures = CFalse; @@ -1484,7 +1484,7 @@ BOOL CVandaEngineDlg::OnInitDialog() SetIcon(m_hIcon, TRUE); // Set big icon SetIcon(m_hIcon, FALSE); // Set small icon - SetWindowText(_T("Vanda Engine 2.9.6")); + SetWindowText(_T("Vanda Engine 2.9.7")); // TODO: Add extra initialization here ShowWindow( SW_SHOWMAXIMIZED ); @@ -3066,7 +3066,7 @@ BOOL CVandaEngineDlg::OnInitDialog() } CChar temp[256]; - sprintf(temp, "%s%s%s%s%s", "Vanda Engine 2.9.6 (", g_projects[i]->m_name, " - ", m_currentVSceneNameWithoutDot, ")"); + sprintf(temp, "%s%s%s%s%s", "Vanda Engine 2.9.7 (", g_projects[i]->m_name, " - ", m_currentVSceneNameWithoutDot, ")"); ex_pVandaEngineDlg->SetWindowTextA(temp); break; @@ -3127,7 +3127,7 @@ BOOL CVandaEngineDlg::OnInitDialog() PrintInfo("\nFatal Error(s) Occured. Go To View > Report", COLOR_RED); } else - PrintInfo( "\nVersion 2.9.6 initialized successfully" ); + PrintInfo( "\nVersion 2.9.7 initialized successfully" ); //CAboutDlg dlgAbout; //dlgAbout.DoModal(); ReleaseCapture(); @@ -3316,7 +3316,7 @@ BOOL CVandaEngineDlg::OnCommand(WPARAM wParam, LPARAM lParam) } CChar temp[256]; - sprintf(temp, "%s%s%s%s%s", "Vanda Engine 2.9.6 (", g_projects[i]->m_name, " - ", m_currentVSceneNameWithoutDot, ")"); + sprintf(temp, "%s%s%s%s%s", "Vanda Engine 2.9.7 (", g_projects[i]->m_name, " - ", m_currentVSceneNameWithoutDot, ")"); ex_pVandaEngineDlg->SetWindowTextA(temp); break; } @@ -3402,7 +3402,7 @@ BOOL CVandaEngineDlg::OnCommand(WPARAM wParam, LPARAM lParam) g_shareGeometriesBetweenScenes = CFalse; CChar temp[256]; - sprintf(temp, "%s", "Vanda Engine 2.9.6 : Prefab Mode (Untitled)"); + sprintf(temp, "%s", "Vanda Engine 2.9.7 : Prefab Mode (Untitled)"); ex_pVandaEngineDlg->SetWindowTextA(temp); if (g_multipleView->IsPlayGameMode()) @@ -3476,7 +3476,7 @@ BOOL CVandaEngineDlg::OnCommand(WPARAM wParam, LPARAM lParam) SortButtons(); CChar temp[256]; - sprintf(temp, "%s", "Vanda Engine 2.9.6 : GUI Mode (Untitled)"); + sprintf(temp, "%s", "Vanda Engine 2.9.7 : GUI Mode (Untitled)"); ex_pVandaEngineDlg->SetWindowTextA(temp); if (g_multipleView->IsPlayGameMode()) @@ -7816,7 +7816,7 @@ CBool CVandaEngineDlg::OnMenuClickedNew( CBool askQuestion ) PrintInfo("\nScene cleared successfully"); CChar temp[256]; - sprintf(temp, "%s", "Vanda Engine 2.9.6 : GUI Mode (Untitled)"); + sprintf(temp, "%s", "Vanda Engine 2.9.7 : GUI Mode (Untitled)"); ex_pVandaEngineDlg->SetWindowTextA(temp); return CTrue; @@ -8264,7 +8264,7 @@ CBool CVandaEngineDlg::OnMenuClickedNew( CBool askQuestion ) if (g_projects[i]->m_isActive) { CChar temp[256]; - sprintf(temp, "%s%s%s%s%s", "Vanda Engine 2.9.6 (", g_projects[i]->m_name, " - ", "Untitled", ")"); + sprintf(temp, "%s%s%s%s%s", "Vanda Engine 2.9.7 (", g_projects[i]->m_name, " - ", "Untitled", ")"); ex_pVandaEngineDlg->SetWindowTextA(temp); break; } @@ -8273,7 +8273,7 @@ CBool CVandaEngineDlg::OnMenuClickedNew( CBool askQuestion ) else if (g_editorMode == eMODE_PREFAB) { CChar temp[256]; - sprintf(temp, "%s", "Vanda Engine 2.9.6 : Prefab Mode (Untitled)"); + sprintf(temp, "%s", "Vanda Engine 2.9.7 : Prefab Mode (Untitled)"); ex_pVandaEngineDlg->SetWindowTextA(temp); } @@ -10027,7 +10027,7 @@ CVoid CVandaEngineDlg::OnMenuClickedSaveGUIAs(CBool askQuestion) g_multipleView->RenderWindow(); //to save screenshot CChar temp[256]; - sprintf(temp, "%s%s%s", "Vanda Engine 2.9.6 : GUI Mode (", g_currentPackageAndGUIName, ")"); + sprintf(temp, "%s%s%s", "Vanda Engine 2.9.7 : GUI Mode (", g_currentPackageAndGUIName, ")"); ex_pVandaEngineDlg->SetWindowTextA(temp); if (m_dlgSaveGUIs) @@ -10869,7 +10869,7 @@ CVoid CVandaEngineDlg::OnMenuClickedSavePrefabAs(CBool askQuestion) g_multipleView->RenderWindow(); //to save screenshot CChar temp[256]; - sprintf(temp, "%s%s%s", "Vanda Engine 2.9.6 : Prefab Mode (", g_currentPackageAndPrefabName, ")"); + sprintf(temp, "%s%s%s", "Vanda Engine 2.9.7 : Prefab Mode (", g_currentPackageAndPrefabName, ")"); ex_pVandaEngineDlg->SetWindowTextA(temp); if (m_dlgSavePrefabs) @@ -14194,7 +14194,7 @@ CVoid CVandaEngineDlg::OnMenuClickedSaveAs(CBool askQuestion) } CChar temp[256]; - sprintf(temp, "%s%s%s%s%s", "Vanda Engine 2.9.6 (", g_projects[i]->m_name, " - ", m_currentVSceneNameWithoutDot, ")"); + sprintf(temp, "%s%s%s%s%s", "Vanda Engine 2.9.7 (", g_projects[i]->m_name, " - ", m_currentVSceneNameWithoutDot, ")"); ex_pVandaEngineDlg->SetWindowTextA(temp); break; @@ -15381,7 +15381,7 @@ CBool CVandaEngineDlg::OnMenuClickedOpenGUI() ReleaseCapture(); CChar temp[256]; - sprintf(temp, "%s%s%s", "Vanda Engine 2.9.6 : GUI Mode (", guiAndPackageName, ")"); + sprintf(temp, "%s%s%s", "Vanda Engine 2.9.7 : GUI Mode (", guiAndPackageName, ")"); ex_pVandaEngineDlg->SetWindowTextA(temp); } @@ -17151,7 +17151,7 @@ CBool CVandaEngineDlg::OnMenuClickedOpenPrefab() } g_updateOctree = CTrue; CChar temp[256]; - sprintf(temp, "%s%s%s", "Vanda Engine 2.9.6 : Prefab Mode (", prefabAndPackageName, ")"); + sprintf(temp, "%s%s%s", "Vanda Engine 2.9.7 : Prefab Mode (", prefabAndPackageName, ")"); ex_pVandaEngineDlg->SetWindowTextA(temp); fclose(filePtr); @@ -19194,7 +19194,7 @@ CBool CVandaEngineDlg::OnMenuClickedOpenVScene(CBool askQuestion) } CChar temp[256]; - sprintf(temp, "%s%s%s%s%s", "Vanda Engine 2.9.6 (", g_projects[i]->m_name, " - ", m_currentVSceneNameWithoutDot, ")"); + sprintf(temp, "%s%s%s%s%s", "Vanda Engine 2.9.7 (", g_projects[i]->m_name, " - ", m_currentVSceneNameWithoutDot, ")"); ex_pVandaEngineDlg->SetWindowTextA(temp); break; diff --git a/Vanda Engine Editor/VandaEngineEditor/stdafx.h b/Vanda Engine Editor/VandaEngineEditor/stdafx.h index 478b6ec8..46d56777 100644 --- a/Vanda Engine Editor/VandaEngineEditor/stdafx.h +++ b/Vanda Engine Editor/VandaEngineEditor/stdafx.h @@ -253,6 +253,13 @@ CInt SetPrefabInstanceTransparency(lua_State* L); CInt EnablePrefabInstanceMaterial(lua_State* L); CInt DisablePrefabInstanceMaterial(lua_State* L); +CInt GetPrefabInstanceAmbient(lua_State* L); +CInt GetPrefabInstanceDiffuse(lua_State* L); +CInt GetPrefabInstanceSpecular(lua_State* L); +CInt GetPrefabInstanceEmission(lua_State* L); +CInt GetPrefabInstanceShininess(lua_State* L); +CInt GetPrefabInstanceTransparency(lua_State* L); + CInt SetPhysicsDefaultRestitution(lua_State* L); CInt SetPhysicsDefaultSkinWidth(lua_State* L); CInt SetPhysicsDefaultStaticFriction(lua_State* L); diff --git a/Vanda Engine Editor/release/Assets/Docs/VandaEngineScriptingReferenceManual.chm b/Vanda Engine Editor/release/Assets/Docs/VandaEngineScriptingReferenceManual.chm index 11543b21..94d9c040 100644 Binary files a/Vanda Engine Editor/release/Assets/Docs/VandaEngineScriptingReferenceManual.chm and b/Vanda Engine Editor/release/Assets/Docs/VandaEngineScriptingReferenceManual.chm differ diff --git a/Vanda Engine Editor/release/Assets/Docs/VandaEngineScriptingReferenceManual.pdf b/Vanda Engine Editor/release/Assets/Docs/VandaEngineScriptingReferenceManual.pdf index c465cc73..304d5cf1 100644 Binary files a/Vanda Engine Editor/release/Assets/Docs/VandaEngineScriptingReferenceManual.pdf and b/Vanda Engine Editor/release/Assets/Docs/VandaEngineScriptingReferenceManual.pdf differ diff --git a/Vanda Engine Editor/release/Assets/Engine/Publish-Debug/publish-debug.exe b/Vanda Engine Editor/release/Assets/Engine/Publish-Debug/publish-debug.exe index 9f51202b..73661940 100644 Binary files a/Vanda Engine Editor/release/Assets/Engine/Publish-Debug/publish-debug.exe and b/Vanda Engine Editor/release/Assets/Engine/Publish-Debug/publish-debug.exe differ diff --git a/Vanda Engine Editor/release/Assets/Engine/Publish/publish.exe b/Vanda Engine Editor/release/Assets/Engine/Publish/publish.exe index 58a596ac..2a5ec785 100644 Binary files a/Vanda Engine Editor/release/Assets/Engine/Publish/publish.exe and b/Vanda Engine Editor/release/Assets/Engine/Publish/publish.exe differ diff --git a/Vanda Engine Editor/release/Readme.txt b/Vanda Engine Editor/release/Readme.txt index aed72811..3d837f5e 100644 --- a/Vanda Engine Editor/release/Readme.txt +++ b/Vanda Engine Editor/release/Readme.txt @@ -1,4 +1,4 @@ -Vanda Engine 2.9.6 +Vanda Engine 2.9.7 Copyright (C) 2023 Ehsan Kamrani www.vanda3d.org diff --git a/Vanda Engine Win32/Debug/Readme.txt b/Vanda Engine Win32/Debug/Readme.txt index aed72811..3d837f5e 100644 --- a/Vanda Engine Win32/Debug/Readme.txt +++ b/Vanda Engine Win32/Debug/Readme.txt @@ -1,4 +1,4 @@ -Vanda Engine 2.9.6 +Vanda Engine 2.9.7 Copyright (C) 2023 Ehsan Kamrani www.vanda3d.org diff --git a/Vanda Engine Win32/VandaEngineWin32/Main.cpp b/Vanda Engine Win32/VandaEngineWin32/Main.cpp index 90223577..cf40abff 100644 --- a/Vanda Engine Win32/VandaEngineWin32/Main.cpp +++ b/Vanda Engine Win32/VandaEngineWin32/Main.cpp @@ -6318,6 +6318,377 @@ CInt DisablePrefabInstanceMaterial(lua_State* L) return 0; } +CInt GetPrefabInstanceAmbient(lua_State* L) +{ + int argc = lua_gettop(L); + if (argc < 1) + { + //PrintInfo("\nPlease specify 1 argument for GetPrefabInstanceAmbient()", COLOR_RED); + return 0; + } + + CChar luaToString[MAX_NAME_SIZE]; + Cpy(luaToString, lua_tostring(L, 1)); + StringToUpper(luaToString); + + CBool foundPrefabInstance = CFalse; + + CFloat ambientColor[3]; + + if (Cmp("THIS", luaToString)) + { + if (g_currentInstancePrefab) + { + for (CUInt i = 0; i < 3; i++) + { + ambientColor[i] = g_currentInstancePrefab->GetAmbient()[i]; + lua_pushnumber(L, ambientColor[i]); + } + + return 3; + } + else + { + //PrintInfo("\nGetPrefabInstanceAmbient() Error: Couldn't find current prefab instance", COLOR_RED); + } + return 0; + } + + for (CUInt i = 0; i < g_instancePrefab.size(); i++) + { + CChar prefabName[MAX_NAME_SIZE]; + Cpy(prefabName, g_instancePrefab[i]->GetName()); + StringToUpper(prefabName); + if (Cmp(prefabName, luaToString)) + { + foundPrefabInstance = CTrue; + for (CUInt j = 0; j < 3; j++) + { + ambientColor[j] = g_instancePrefab[i]->GetAmbient()[j]; + lua_pushnumber(L, ambientColor[j]); + } + + return 3; + } + } + if (!foundPrefabInstance) + { + //CChar temp[MAX_NAME_SIZE]; + //sprintf(temp, "\nGetPrefabInstanceAmbient() Error: %s%s%s", "Couldn't find '", luaToString, "' Prefab Instance"); + //PrintInfo(temp, COLOR_RED); + return 0; + } + + return 0; +} + + +CInt GetPrefabInstanceDiffuse(lua_State* L) +{ + int argc = lua_gettop(L); + if (argc < 1) + { + //PrintInfo("\nPlease specify 1 argument for GetPrefabInstanceDiffuse()", COLOR_RED); + return 0; + } + + CChar luaToString[MAX_NAME_SIZE]; + Cpy(luaToString, lua_tostring(L, 1)); + StringToUpper(luaToString); + + CBool foundPrefabInstance = CFalse; + + CFloat diffuseColor[3]; + + if (Cmp("THIS", luaToString)) + { + if (g_currentInstancePrefab) + { + for (CUInt i = 0; i < 3; i++) + { + diffuseColor[i] = g_currentInstancePrefab->GetDiffuse()[i]; + lua_pushnumber(L, diffuseColor[i]); + } + + return 3; + } + else + { + //PrintInfo("\nGetPrefabInstanceDiffuse() Error: Couldn't find current prefab instance", COLOR_RED); + } + return 0; + } + + for (CUInt i = 0; i < g_instancePrefab.size(); i++) + { + CChar prefabName[MAX_NAME_SIZE]; + Cpy(prefabName, g_instancePrefab[i]->GetName()); + StringToUpper(prefabName); + if (Cmp(prefabName, luaToString)) + { + foundPrefabInstance = CTrue; + for (CUInt j = 0; j < 3; j++) + { + diffuseColor[j] = g_instancePrefab[i]->GetDiffuse()[j]; + lua_pushnumber(L, diffuseColor[j]); + } + + return 3; + } + } + if (!foundPrefabInstance) + { + //CChar temp[MAX_NAME_SIZE]; + //sprintf(temp, "\nGetPrefabInstanceDiffuse() Error: %s%s%s", "Couldn't find '", luaToString, "' Prefab Instance"); + //PrintInfo(temp, COLOR_RED); + return 0; + } + + return 0; +} + +CInt GetPrefabInstanceSpecular(lua_State* L) +{ + int argc = lua_gettop(L); + if (argc < 1) + { + //PrintInfo("\nPlease specify 1 argument for GetPrefabInstanceSpecular()", COLOR_RED); + return 0; + } + + CChar luaToString[MAX_NAME_SIZE]; + Cpy(luaToString, lua_tostring(L, 1)); + StringToUpper(luaToString); + + CBool foundPrefabInstance = CFalse; + + CFloat specularColor[3]; + + if (Cmp("THIS", luaToString)) + { + if (g_currentInstancePrefab) + { + for (CUInt i = 0; i < 3; i++) + { + specularColor[i] = g_currentInstancePrefab->GetSpecular()[i]; + lua_pushnumber(L, specularColor[i]); + } + + return 3; + } + else + { + //PrintInfo("\nGetPrefabInstanceSpecular() Error: Couldn't find current prefab instance", COLOR_RED); + } + return 0; + } + + for (CUInt i = 0; i < g_instancePrefab.size(); i++) + { + CChar prefabName[MAX_NAME_SIZE]; + Cpy(prefabName, g_instancePrefab[i]->GetName()); + StringToUpper(prefabName); + if (Cmp(prefabName, luaToString)) + { + foundPrefabInstance = CTrue; + for (CUInt j = 0; j < 3; j++) + { + specularColor[j] = g_instancePrefab[i]->GetSpecular()[j]; + lua_pushnumber(L, specularColor[j]); + } + + return 3; + } + } + if (!foundPrefabInstance) + { + //CChar temp[MAX_NAME_SIZE]; + //sprintf(temp, "\nGetPrefabInstanceSpecular() Error: %s%s%s", "Couldn't find '", luaToString, "' Prefab Instance"); + //PrintInfo(temp, COLOR_RED); + return 0; + } + + return 0; +} + +CInt GetPrefabInstanceEmission(lua_State* L) +{ + int argc = lua_gettop(L); + if (argc < 1) + { + //PrintInfo("\nPlease specify 1 argument for GetPrefabInstanceEmission()", COLOR_RED); + return 0; + } + + CChar luaToString[MAX_NAME_SIZE]; + Cpy(luaToString, lua_tostring(L, 1)); + StringToUpper(luaToString); + + CBool foundPrefabInstance = CFalse; + + CFloat emissionColor[3]; + + if (Cmp("THIS", luaToString)) + { + if (g_currentInstancePrefab) + { + for (CUInt i = 0; i < 3; i++) + { + emissionColor[i] = g_currentInstancePrefab->GetEmission()[i]; + lua_pushnumber(L, emissionColor[i]); + } + + return 3; + } + else + { + //PrintInfo("\nGetPrefabInstanceEmission() Error: Couldn't find current prefab instance", COLOR_RED); + } + return 0; + } + + for (CUInt i = 0; i < g_instancePrefab.size(); i++) + { + CChar prefabName[MAX_NAME_SIZE]; + Cpy(prefabName, g_instancePrefab[i]->GetName()); + StringToUpper(prefabName); + if (Cmp(prefabName, luaToString)) + { + foundPrefabInstance = CTrue; + for (CUInt j = 0; j < 3; j++) + { + emissionColor[j] = g_instancePrefab[i]->GetEmission()[j]; + lua_pushnumber(L, emissionColor[j]); + } + + return 3; + } + } + if (!foundPrefabInstance) + { + //CChar temp[MAX_NAME_SIZE]; + //sprintf(temp, "\nGetPrefabInstanceEmission() Error: %s%s%s", "Couldn't find '", luaToString, "' Prefab Instance"); + //PrintInfo(temp, COLOR_RED); + return 0; + } + + return 0; +} + +CInt GetPrefabInstanceShininess(lua_State* L) +{ + int argc = lua_gettop(L); + if (argc < 1) + { + //PrintInfo("\nPlease specify 1 argument for GetPrefabInstanceShininess()", COLOR_RED); + return 0; + } + + CChar luaToString[MAX_NAME_SIZE]; + Cpy(luaToString, lua_tostring(L, 1)); + StringToUpper(luaToString); + + CBool foundPrefabInstance = CFalse; + + CFloat shininess = 0.0; + + if (Cmp("THIS", luaToString)) + { + if (g_currentInstancePrefab) + { + shininess = g_currentInstancePrefab->GetShininess(); + lua_pushnumber(L, shininess); + return 1; + } + else + { + //PrintInfo("\nGetPrefabInstanceShininess() Error: Couldn't find current prefab instance", COLOR_RED); + } + return 0; + } + + for (CUInt i = 0; i < g_instancePrefab.size(); i++) + { + CChar prefabName[MAX_NAME_SIZE]; + Cpy(prefabName, g_instancePrefab[i]->GetName()); + StringToUpper(prefabName); + if (Cmp(prefabName, luaToString)) + { + foundPrefabInstance = CTrue; + shininess = g_instancePrefab[i]->GetShininess(); + lua_pushnumber(L, shininess); + return 1; + } + } + if (!foundPrefabInstance) + { + //CChar temp[MAX_NAME_SIZE]; + //sprintf(temp, "\nGetPrefabInstanceShininess() Error: %s%s%s", "Couldn't find '", luaToString, "' Prefab Instance"); + //PrintInfo(temp, COLOR_RED); + return 0; + } + + return 0; +} + +CInt GetPrefabInstanceTransparency(lua_State* L) +{ + int argc = lua_gettop(L); + if (argc < 1) + { + //PrintInfo("\nPlease specify 1 argument for GetPrefabInstanceTransparency()", COLOR_RED); + return 0; + } + + CChar luaToString[MAX_NAME_SIZE]; + Cpy(luaToString, lua_tostring(L, 1)); + StringToUpper(luaToString); + + CBool foundPrefabInstance = CFalse; + + CFloat transparency = 0.0; + + if (Cmp("THIS", luaToString)) + { + if (g_currentInstancePrefab) + { + transparency = g_currentInstancePrefab->GetTransparency(); + lua_pushnumber(L, transparency); + return 1; + } + else + { + //PrintInfo("\nGetPrefabInstanceTransparency() Error: Couldn't find current prefab instance", COLOR_RED); + } + return 0; + } + + for (CUInt i = 0; i < g_instancePrefab.size(); i++) + { + CChar prefabName[MAX_NAME_SIZE]; + Cpy(prefabName, g_instancePrefab[i]->GetName()); + StringToUpper(prefabName); + if (Cmp(prefabName, luaToString)) + { + foundPrefabInstance = CTrue; + transparency = g_instancePrefab[i]->GetTransparency(); + lua_pushnumber(L, transparency); + return 1; + } + } + if (!foundPrefabInstance) + { + //CChar temp[MAX_NAME_SIZE]; + //sprintf(temp, "\nGetPrefabInstanceTransparency() Error: %s%s%s", "Couldn't find '", luaToString, "' Prefab Instance"); + //PrintInfo(temp, COLOR_RED); + return 0; + } + + return 0; +} + + + CInt SetPhysicsDefaultRestitution(lua_State* L) { if (!gPhysXscene) diff --git a/Vanda Engine Win32/VandaEngineWin32/ScriptEngine/LuaForCpp.h b/Vanda Engine Win32/VandaEngineWin32/ScriptEngine/LuaForCpp.h index 80cde8ff..785910c5 100644 --- a/Vanda Engine Win32/VandaEngineWin32/ScriptEngine/LuaForCpp.h +++ b/Vanda Engine Win32/VandaEngineWin32/ScriptEngine/LuaForCpp.h @@ -211,6 +211,13 @@ static void LuaRegisterFunctions(lua_State* L) lua_register(L, "EnablePrefabInstanceMaterial", EnablePrefabInstanceMaterial); lua_register(L, "DisablePrefabInstanceMaterial", DisablePrefabInstanceMaterial); + lua_register(L, "GetPrefabInstanceAmbient", GetPrefabInstanceAmbient); + lua_register(L, "GetPrefabInstanceDiffuse", GetPrefabInstanceDiffuse); + lua_register(L, "GetPrefabInstanceSpecular", GetPrefabInstanceSpecular); + lua_register(L, "GetPrefabInstanceEmission", GetPrefabInstanceEmission); + lua_register(L, "GetPrefabInstanceShininess", GetPrefabInstanceShininess); + lua_register(L, "GetPrefabInstanceTransparency", GetPrefabInstanceTransparency); + lua_register(L, "SetPhysicsDefaultRestitution", SetPhysicsDefaultRestitution); lua_register(L, "SetPhysicsDefaultSkinWidth", SetPhysicsDefaultSkinWidth); lua_register(L, "SetPhysicsDefaultStaticFriction", SetPhysicsDefaultStaticFriction); diff --git a/Vanda Engine Win32/VandaEngineWin32/VandaEngineWin32.cpp b/Vanda Engine Win32/VandaEngineWin32/VandaEngineWin32.cpp index 07af0a2b..0a7cb1ed 100644 --- a/Vanda Engine Win32/VandaEngineWin32/VandaEngineWin32.cpp +++ b/Vanda Engine Win32/VandaEngineWin32/VandaEngineWin32.cpp @@ -22,7 +22,7 @@ class COpenALSoundBuffer; //Edition.MaxVersion.MinVersion.BugFixes; -CInt g_version = 296; +CInt g_version = 297; CChar g_edition[MAX_NAME_SIZE]; CScene* g_currentScene = NULL; CInstancePrefab* g_currentInstancePrefab = NULL; diff --git a/Vanda Engine Win32/VandaEngineWin32/VandaEngineWin32.rc b/Vanda Engine Win32/VandaEngineWin32/VandaEngineWin32.rc index 206526be..ae3e7e3c 100644 --- a/Vanda Engine Win32/VandaEngineWin32/VandaEngineWin32.rc +++ b/Vanda Engine Win32/VandaEngineWin32/VandaEngineWin32.rc @@ -75,12 +75,12 @@ BEGIN BEGIN VALUE "CompanyName", "Ehsan Kamrani " VALUE "FileDescription", "Vanda Engine" - VALUE "FileVersion", "2.9.6" + VALUE "FileVersion", "2.9.7" VALUE "internalName", "VandaEngine.exe" VALUE "LegalCopyright", "(c) 2023 Vanda Engine. All rights reserved." VALUE "OriginalFilename", "VandaEngine.exe" VALUE "ProductName", " Vanda Engine" - VALUE "ProductVersion", "2.9.6" + VALUE "ProductVersion", "2.9.7" END END BLOCK "VarFileInfo" @@ -101,7 +101,7 @@ CAPTION "About" FONT 8, "System" BEGIN ICON 107,IDC_MYICON,14,9,16,16 - LTEXT "VandaEngine Version 2.9.6",IDC_STATIC,49,10,119,8,SS_NOPREFIX + LTEXT "VandaEngine Version 2.9.7",IDC_STATIC,49,10,119,8,SS_NOPREFIX LTEXT "Copyright (C) 2023",IDC_STATIC,49,20,119,8 DEFPUSHBUTTON "OK",IDOK,195,6,30,11,WS_GROUP END diff --git a/Vanda Engine Win32/VandaEngineWin32/stdafx.h b/Vanda Engine Win32/VandaEngineWin32/stdafx.h index c4b38e8d..bb234709 100644 --- a/Vanda Engine Win32/VandaEngineWin32/stdafx.h +++ b/Vanda Engine Win32/VandaEngineWin32/stdafx.h @@ -209,6 +209,13 @@ CInt SetPrefabInstanceTransparency(lua_State* L); CInt EnablePrefabInstanceMaterial(lua_State* L); CInt DisablePrefabInstanceMaterial(lua_State* L); +CInt GetPrefabInstanceAmbient(lua_State* L); +CInt GetPrefabInstanceDiffuse(lua_State* L); +CInt GetPrefabInstanceSpecular(lua_State* L); +CInt GetPrefabInstanceEmission(lua_State* L); +CInt GetPrefabInstanceShininess(lua_State* L); +CInt GetPrefabInstanceTransparency(lua_State* L); + CInt SetPhysicsDefaultRestitution(lua_State* L); CInt SetPhysicsDefaultSkinWidth(lua_State* L); CInt SetPhysicsDefaultStaticFriction(lua_State* L); diff --git a/Vanda Engine Win32/release/Readme.txt b/Vanda Engine Win32/release/Readme.txt index aed72811..3d837f5e 100644 --- a/Vanda Engine Win32/release/Readme.txt +++ b/Vanda Engine Win32/release/Readme.txt @@ -1,4 +1,4 @@ -Vanda Engine 2.9.6 +Vanda Engine 2.9.7 Copyright (C) 2023 Ehsan Kamrani www.vanda3d.org