-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
127 additions
and
1 deletion.
There are no files selected for viewing
44 changes: 44 additions & 0 deletions
44
GE Toolbox (by w33zl)/XML Tools/GEPT_CreateI3DMappings_v1.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
-- Name: Create i3d XML mappings (v1) | ||
-- Author: w33zl | ||
-- Description: Prints a XML tag in the log for each selected node in the scenegraph | ||
-- Icon: | ||
-- Hide: no | ||
|
||
--[[ | ||
Version: 1.0 | ||
Modified: 2022-02-27 | ||
Facebook: https://www.facebook.com/w33zl | ||
Ko-fi: https://ko-fi.com/w33zl | ||
Patreon: https://www.patreon.com/wzlmodding | ||
Github: https://github.com/w33zl | ||
Changelog: | ||
v1.0.0 Initial version | ||
]] | ||
|
||
source("editorUtils.lua") | ||
|
||
local nNumSelectedNodes = getNumSelected() | ||
|
||
if nNumSelectedNodes <= 0 then | ||
|
||
print ( "Nothing selected. Please select at least 1 object. ") | ||
return | ||
|
||
elseif nNumSelectedNodes >= 1 then | ||
|
||
local nSelectedRootNodeID = getSelection( 0 ) | ||
|
||
print("Creating i3d mappings...") | ||
|
||
for i=0, nNumSelectedNodes - 1, 1 do | ||
|
||
local selectedNodeID = getSelection( i ) | ||
local _, indexPath = EditorUtils.getHierarchy(selectedNodeID) | ||
local name = getName(selectedNodeID) | ||
|
||
print( string.format("<i3dMapping id=\"%s\" node=\"%s\" />", name, indexPath )); | ||
|
||
end | ||
end |
68 changes: 68 additions & 0 deletions
68
GE Toolbox (by w33zl)/XML Tools/GEPT_CreateI3DMappings_v2.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
-- Name: Create i3d XML mappings (v2) | ||
-- Author: w33zl | ||
-- Description: Prints a XML tag in the log for each selected node in the scenegraph | ||
-- Icon: | ||
-- Hide: no | ||
|
||
--[[ | ||
Author: w33zl / WZL Modding | ||
Version: 2.0 | ||
Modified: 2022-02-27 | ||
Facebook: https://www.facebook.com/w33zl | ||
Ko-fi: https://ko-fi.com/w33zl | ||
Patreon: https://www.patreon.com/wzlmodding | ||
Github: https://github.com/w33zl | ||
Changelog: | ||
v2.0.0 Initial version (fork of v1) | ||
]] | ||
|
||
local nNumSelectedNodes = getNumSelected() | ||
|
||
local function getIndexPath(node) | ||
local name = getName(node) | ||
local index = getChildIndex(node) | ||
local parent = getParent(node) | ||
local grandParent = getParent(parent) | ||
|
||
if grandParent == getChildAt(getRootNode(), 0) then | ||
local p_name, p_index = getIndexPath(parent) | ||
name = p_name .. name | ||
index = p_index .. index | ||
elseif parent ~= 0 and parent ~= getChildAt(getRootNode(), 0) then | ||
local p_name, p_index = getIndexPath(parent) | ||
name = p_name .. "|" .. name | ||
index = p_index .. "|" .. index | ||
else | ||
name = name .. ">" | ||
index = index .. ">" | ||
end | ||
return name, index | ||
end | ||
|
||
if nNumSelectedNodes <= 0 then | ||
|
||
print ( "Nothing selected. Please select at least 1 object. ") | ||
return | ||
|
||
elseif nNumSelectedNodes >= 1 then | ||
|
||
local nSelectedRootNodeID = getSelection( 0 ) | ||
|
||
print("Creating i3d mappings...\n") | ||
|
||
print("\n==[COPY TEXT BELOW]=================") | ||
|
||
|
||
for i=0, nNumSelectedNodes - 1, 1 do | ||
|
||
local selectedNodeID = getSelection( i ) | ||
local _, indexPath = getIndexPath(selectedNodeID) | ||
local name = getName(selectedNodeID) | ||
|
||
print( string.format("<i3dMapping id=\"%s\" node=\"%s\" />", name, indexPath )); | ||
|
||
end | ||
print("====================================") | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# GE Toolbox - XML Tools | ||
|
||
This collection of scripts helps creating XML for the ingame assets. | ||
|
||
## Create i3d XML mappings | ||
|
||
### Usage | ||
1. Select one or more nodes in the scenegraph in GE | ||
2. Execute script "*Create i3d XML mappings (v2)*" in the scripts folder/submenu `GE Toolbox/XML Tools` (for keyboard shortcut, check [GE-HAM](https://github.com/w33zl/GE-Hotkeys-and-Macros)) | ||
3. The script now outputs a XML tag for each node selected with the node name as the "id" attribute and the index path as the "node" attribute, e.g. `<i3dMapping id="sampleNode" node="0>1" />` | ||
4. Copy the text below the line `==[COPY TEXT BELOW]=================` and then paste into your vehicle/placeable XML file | ||
|
||
***Please note:** There is two versions (v1 and v2) included, it is recommended to use the v2 version.* | ||
|