Symulator EU07 (i nie tylko) > Pomoc w tworzeniu

 Problemy z skryptami z gmax

<< < (2/8) > >>

Sawi:
Skoro tak, to zrobimy inaczej. Poniżej skrypty ode mnie. Sprawdź je i daj znać.
http://eu07.pl/userfiles/6184/priv-gmax.7z

Pierog_SU42:
No to tak wypakowałem, odpalam w gmax-ie main.ms. Pierwsze co się rzuciło w oczy to to że jest odchudzony od tamtych (załącznik 1), a drugie że teraz wyskoczył inny błąd (załącznik 2) jak próbuję exportować. A po oznaczeniu "Export Selected Only" i naciśnięciu Save as... w ogóle nie reaguje i mogę sobie klikać ile wlezie.

eu07-001:
Pokaż zawartośc pliku t3dExp.ms, mi kiedyś też się tak działo.

Pierog_SU42:
Właśnie z kolegą też sprawdzałem, bo ja znam tylko podstawy w programowaniu i właśnie nic znaleść nie możemy. Proszę o to kod:

--- Kod: ----------------------------------------------------------------------------------------
-- T3DExport.ms
-------------------------------------------------------------------------------------

fileIn (scriptDirectory+"Reset Xform.ms")
rollout T3DExport "T3d Exporter"
(
local ostream, tabs = ""

group "Options"
(
checkbox cb_exportSelOnly "Export Selected Only"
)

button btn_export "Save As..." width:100


-------------------------------------------------------------------------------------
function ExportMesh meshObj =
(

Format ("\n") 
Format ("//---------------------------------------------------------------------------------") 
Format ("\n") 

-- convertToMesh meshObj
-- resetXFormU meshObj
-- collapseStack meshObj

if (meshObj.parent!=undefined) then
(
varname= meshObj.parent.name
for i = 1 to varname.count do
if varname[i] == " " then varname[i] = "_"
Format ("Parent: %\n") varname 
)
else
Format ("Parent: none\n") 

Format ("Type: Mesh\n") varname 

varname= meshObj.name
for i = 1 to varname.count do
if varname[i] == " " then varname[i] = "_"
Format ("Name: %\n") varname 

prop= (getUserProp meshObj "Anim")
if (prop!=undefined) then
Format ("Anim: % \n") prop 
else
Format ("Anim: false \n") varname 

bHasMap= false;
if (meshObj.material!=undefined) then
(

Format ("Ambient: % % %\n") meshObj.material.ambient.r meshObj.material.ambient.g meshObj.material.ambient.b 
Format ("Diffuse: % % %\n") meshObj.material.diffuse.r meshObj.material.diffuse.g meshObj.material.diffuse.b 
Format ("Specular: % % %\n") meshObj.material.specular.r meshObj.material.specular.g meshObj.material.specular.b 
Format ("SelfIllum: %\n") (meshObj.material.selfIllumAmount>0) 
Format ("Wire: %\n") meshObj.material.wire 
Format ("WireSize: %\n") meshObj.material.wireSize 
Format ("Opacity: %\n") meshObj.material.opacity 
if ((meshObj.material.mapEnables[2]) and (meshObj.material.maps[2]!=undefined)) then
(
Format ("Map: %\n") (filenameFromPath meshObj.material.maps[2].filename) 
bHasMap= true;
)
else
(
Format ("Map: none\n") 
)

)
else
(
Format ("Ambient: % % %\n") meshObj.wireColor.r meshObj.wireColor.g meshObj.wireColor.b 
Format ("Diffuse: % % %\n") meshObj.wireColor.r meshObj.wireColor.g meshObj.wireColor.b 
Format ("Specular: 0 0 0\n") 
Format ("SelfIllum: false\n") 
Format ("Wire: false\n") 
Format ("WireSize: 0\n") 
Format ("Opacity: 100\n") 
Format ("Map: none\n") 
)

prop= (getUserProp meshObj "MaxDistance")
if (prop!=undefined) then
Format ("MaxDistance: % \n") prop 
else
Format ("MaxDistance: 1000\n") 

prop= (getUserProp meshObj "MinDistance")
if (prop!=undefined) then
Format ("MinDistance: % \n") prop 
else
Format ("MinDistance: 0\n") 

if (meshObj.parent!=undefined) then
TM= meshObj.transform * (inverse meshObj.parent.transform)
else
TM= meshObj.transform

Format ("Transform: \n")   
Format ("           % % % 0.0\n") TM.row1.x TM.row1.y TM.row1.z 
Format ("           % % % 0.0\n") TM.row2.x TM.row2.y TM.row2.z 
Format ("           % % % 0.0\n") TM.row3.x TM.row3.y TM.row3.z 
Format ("           % % % 1.0\n") TM.row4.x TM.row4.y TM.row4.z 

Format ("NumVerts: % \n") (meshObj.numFaces*3) 

update meshObj true true true
if (meshObj.numFaces) > 0 then
(
if (bHasMap==true) then
(
for i = 1 to (meshObj.numFaces) do
(

Format ("% \n") (getFaceSmoothGroup meshObj i) 

vrt= (GetVert meshObj (GetFace meshObj i).x )*(inverse meshObj.transform)
Format ("% ") (vrt.x) 
Format ("% ") (vrt.y) 
Format ("% ") (vrt.z) 
Format ("% ") ((GetTVert meshObj (GetTVFace meshObj i).x ).x) 
Format ("% \n") ((GetTVert meshObj (GetTVFace meshObj i).x ).y) 

vrt= (GetVert meshObj (GetFace meshObj i).y )*(inverse meshObj.transform)
Format ("% ") (vrt.x) 
Format ("% ") (vrt.y) 
Format ("% ") (vrt.z) 
Format ("% ") ((GetTVert meshObj (GetTVFace meshObj i).y ).x) 
Format ("% \n") ((GetTVert meshObj (GetTVFace meshObj i).y ).y) 

vrt= (GetVert meshObj (GetFace meshObj i).z )*(inverse meshObj.transform)
Format ("% ") (vrt.x) 
Format ("% ") (vrt.y) 
Format ("% ") (vrt.z) 
Format ("% ") ((GetTVert meshObj (GetTVFace meshObj i).z ).x) 
Format ("% \n") ((GetTVert meshObj (GetTVFace meshObj i).z ).y) 
Format ("\n") 
)
)
else
(
for i = 1 to (meshObj.numFaces) do
(
Format ("% \n") (getFaceSmoothGroup meshObj i) 

vrt= (GetVert meshObj (GetFace meshObj i).x )*(inverse meshObj.transform)
Format ("% ") (vrt.x) 
Format ("% ") (vrt.y) 
Format ("% ") (vrt.z) 
Format ("0 ") 
Format ("0 \n") 

vrt= (GetVert meshObj (GetFace meshObj i).y )*(inverse meshObj.transform)
Format ("% ") (vrt.x) 
Format ("% ") (vrt.y) 
Format ("% ") (vrt.z) 
Format ("0 ") 
Format ("0 \n") 

vrt= (GetVert meshObj (GetFace meshObj i).z )*(inverse meshObj.transform)
Format ("% ") (vrt.x) 
Format ("% ") (vrt.y) 
Format ("% ") (vrt.z) 
Format ("0 ") 
Format ("0 \n") 
Format ("\n") 
)
)
)

)

-------------------------------------------------------------------------------------
function ExportPoint ptObj =
(
Format ("\n") 
Format ("//---------------------------------------------------------------------------------") 
Format ("\n") 

-- resetXFormU ptObj
-- collapseStack ptObj

if (ptObj.parent!=undefined) then
(
varname= ptObj.parent.name
for i = 1 to varname.count do
if varname[i] == " " then varname[i] = "_"
Format ("Parent: %\n") varname 
)
else
Format ("Parent: none\n") 

Format ("Type: Point\n") varname 

varname= ptObj.name
for i = 1 to varname.count do
if varname[i] == " " then varname[i] = "_"
Format ("Name: %\n") varname 

prop= (getUserProp ptObj "Anim")
if (prop!=undefined) then
Format ("Anim: % \n") prop 
else
Format ("Anim: false \n") varname 


Format ("Diffuse: % % %\n") ptObj.wireColor.r ptObj.wireColor.g ptObj.wireColor.b 

Format ("SelfIllum: true\n") 

prop= (getUserProp ptObj "MaxDistance")
if (prop!=undefined) then
Format ("MaxDistance: % \n") prop 
else
Format ("MaxDistance: 1000\n") 

prop= (getUserProp ptObj "MinDistance")
if (prop!=undefined) then
Format ("MinDistance: % \n") prop 
else
Format ("MinDistance: 0\n") 

if (ptObj.parent!=undefined) then
TM= ptObj.transform * (inverse ptObj.parent.transform)
else
TM= ptObj.transform

Format ("Transform: \n")   
Format ("           % % % 0.0\n") TM.row1.x TM.row1.y TM.row1.z 
Format ("           % % % 0.0\n") TM.row2.x TM.row2.y TM.row2.z 
Format ("           % % % 0.0\n") TM.row3.x TM.row3.y TM.row3.z 
Format ("           % % % 1.0\n") TM.row4.x TM.row4.y TM.row4.z 

)
--McZapkie-050702:export stozka swiatla
-------------------------------------------------------------------------------------
function ExportFreeSpot fsObj =
(
Format ("\n") 
Format ("//---------------------------------------------------------------------------------") 
Format ("\n") 

if (fsObj.parent!=undefined) then
(
varname= fsObj.parent.name
for i = 1 to varname.count do
if varname[i] == " " then varname[i] = "_"
Format ("Parent: %\n") varname 
)
else
Format ("Parent: none\n") 

Format ("Type: FreeSpotLight\n") varname 

varname= fsObj.name
for i = 1 to varname.count do
if varname[i] == " " then varname[i] = "_"
Format ("Name: %\n") varname 

prop= (getUserProp fsObj "Anim")
if (prop!=undefined) then
Format ("Anim: % \n") prop 
else
Format ("Anim: false \n") varname 


Format ("Diffuse: % % %\n") fsObj.rgb.r fsObj.rgb.g fsObj.rgb.b 

Format ("SelfIllum: true\n") 

varname= fsObj.nearAttenStart
Format ("NearAttenStart: %\n") varname 
varname= fsObj.nearAttenEnd
Format ("NearAttenEnd: %\n") varname 
varname= fsObj.useNearAtten
Format ("UseNearAtten: %\n") varname 
varname= fsObj.attenDecay
Format ("FarAttenDecayType: %\n") varname 
varname= fsObj.DecayRadius
Format ("FarDecayRadius: %\n") varname 
varname= fsObj.falloff
Format ("FalloffAngle: %\n") varname 
varname= fsObj.hotspot
Format ("HotspotAngle: %\n") varname               
             
prop= (getUserProp fsObj "MaxDistance")
if (prop!=undefined) then
Format ("MaxDistance: % \n") prop 
else
Format ("MaxDistance: 1000\n") 

prop= (getUserProp fsObj "MinDistance")
if (prop!=undefined) then
Format ("MinDistance: % \n") prop 
else
Format ("MinDistance: 0\n") 

if (fsObj.parent!=undefined) then
TM= fsObj.transform * (inverse fsObj.parent.transform)
else
TM= fsObj.transform

Format ("Transform: \n")   
Format ("           % % % 0.0\n") TM.row1.x TM.row1.y TM.row1.z 
Format ("           % % % 0.0\n") TM.row2.x TM.row2.y TM.row2.z 
Format ("           % % % 0.0\n") TM.row3.x TM.row3.y TM.row3.z 
Format ("           % % % 1.0\n") TM.row4.x TM.row4.y TM.row4.z 

)



-------------------------------------------------------------------------------------
function ExportNode node =
(
if SuperClassOf node == GeometryClass and ClassOf node == Editable_mesh then
ExportMesh node
if SuperClassOf node == Helper and ClassOf node == Point then
ExportPoint node
if SuperClassOf node == Light and ClassOf node == FreeSpot  then
ExportFreeSpot node

return true
)

-------------------------------------------------------------------------------------
function RecursiveExportNode node =
(
if (ExportNode node) == false then
return false

for child in node.children do
RecursiveExportNode child

)

-------------------------------------------------------------------------------------
function ExportT3D =
(

if cb_exportSelOnly.checked then
(
for node in selection do
ExportNode node
)
else
(
for node in rootnode.children do
RecursiveExportNode node
)
)

-------------------------------------------------------------------------------------


-------------------------------------------------------------------------------------
on btn_export pressed do
(
ExportT3D()
)

) -- End T3DExport

--- Koniec kodu ---

eu07-001:
Zamień:

--- Kod: ---Format ("WireSize: %\n") meshObj.material.wireSize
--- Koniec kodu ---
na:

--- Kod: ---Format ("WireSize: 0\n")
--- Koniec kodu ---

Nawigacja

[0] Indeks wiadomości

[#] Następna strona

[*] Poprzednia strona

Idź do wersji pełnej
Powered by Advanced Topic Prefix Pro
Powered by SMFPacks Likes Pro Mod