Skocz do zawartości
View in the app

A better way to browse. Learn more.

Max3D.pl

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Skrypt wczytujący pliki.

Featured Replies

Napisano

Witam.

 

Potrzebuje napisać skrypt który importuje i rozmieszcza na scenie obiekty zdefiniowane w pliku(custom format .sce(textowy)), a właściwie prymitywnym drzewie hierarchicznym plików.

 

Budowa pliku(znaczenia znaczników chyba nie muszę tłumaczyć):

 

plik scena.sce:

geomobj teren2_1_1

file "scena\teren\teren2_1_1.obj" 512 1024

pos -256 -256

child_lod 0 768

dist cheby xz

xref "scena\sceterenu\teren1_1_1.sce"

xref "scena\sceterenu\teren1_1_2.sce"

xref "scena\sceterenu\teren1_2_1.sce"

xref "scena\sceterenu\teren1_2_2.sce"

end

....

 

 

plik teren1_1_1.sce:

geomobj teren1_1_1

file "scena\teren\teren1_1_1.obj" 256 512

pos -384 -384

child_lod 0 384

dist cheby xz

xref "scena\rosliny\rosliny1_1_1.sce"

end

.....

 

plik rosliny1_1_1.sce:

geomobj OB_TRAWA

file "scena\obiekty\trawa.obj" 0.0 50

rot 0 56 0

scl 0 0 0

pos -492 33.8314 -336

dist euclid

end

geomobj OB_DRZWEO

file "scena\obiekty\drzewo.obj" 0.0 150

rot 0 37 0

scl 0 0 0

pos -492 19.4751 -310

dist euclid

end

geomobj OB_KRZEW

file "scena\obiekty\krzew.obj" 0.0 100

rot 0 12 0

scl 0 0 0

pos -488 48.7808 -426

dist euclid

end

.........

itd itp

 

skrypt (formatowanie kodu się kompletnie sypie jak go wklejam ale może ktoś dojdzie co i jak):

  1. (
  2. fn openSCE fileName yep =
  3. (
  4. f = openfile (fileName)
  5. --f = openfile ("d:\scena\scena\rosliny\rosliny1_1_1.sce")
  6. if f == undefined then
  7. (
  8. MessageBox "nie wczytalem"
  9. )
  10. if f != undefined then
  11. (
  12. MessageBox fileName
  13. while not (eof f) do
  14. (
  15. l = readline f
  16. lf = filterString l " "
  17. lname = ""
  18. if yep=="true" then
  19. (
  20. if lf[1] == "geomobj" then
  21. (
  22. lname = lf[2]
  23. )
  24. if lf[1] == "file" then
  25. (
  26. local plugins = importerPlugin.classes
  27. local pluginName = Wavefront_Object
  28. if findItem plugins ObjImp != 0 then
  29. (pluginName = ObjImp)
  30. --MessageBox "file"
  31. --braclf =filterString lf[2] "\""
  32. s1 =lf[2]
  33. bracss=filterString s1 "\""
  34. importFile (bracss[1]) #noPrompt using:pluginName
  35. for i in selection do i.name = lname --max select none
  36. )
  37. if lf[1] == "pos" then
  38. (
  39. if (lf.count)==4 then
  40. (
  41. X=lf[2]as Float
  42. Y=lf[3]as Float
  43. Z=lf[4]as Float
  44. move $ [Z,-X,Y]
  45. )
  46. else
  47. (
  48. X=lf[3]as Float
  49. Y=lf[2]as Float
  50. move $ [X,-Y,0]
  51. )
  52. )
  53. ) ---yep yep yep
  54. if lf[1] =="xref" then
  55. (
  56. s1 =lf[2]
  57. bracss=filterString s1"\""
  58. if matchPattern s1 pattern:"rosliny" then
  59. (
  60. openSCE bracss[1] "true"
  61. )
  62. else
  63. (
  64. openSCE bracss[1] "no"
  65. )
  66. )
  67. )
  68. close f
  69. )
  70. )
  71. --openSCE "scena\\rosliny\\rosliny1_1_1.sce" "true"
  72. --openSCE "scena\rosliny1_1_1.sce" "true"
  73. openSCE "scena\\scena.sce" "true"
  74. )

 

 

 

Skrypt czyta pojedyncze pliki bez problemu. Nie działa jednak już gdy jest wykonany w rekursji-pliki się otwierają ale chyba nic z nich nie jest czytane. Wydaje mi się że maxscrypt poze mieć problemy z czytaniem z wielu plików na raz... Albo po prstu jest coś o czym nie wiem i nie mogę znaleźć. Foldery są zdefiniowane poprawnie otwiera wszystkie pliki ale żadne operacje nie są wykonywane.

  • Wyświetleń 720
  • Created
  • Ostatniej odpowiedzi

Jeśli chcesz dodać odpowiedź, zaloguj się lub zarejestruj nowe konto

Powiadomienie o plikach cookie

Wykorzystujemy cookies. Przeczytaj więcej Polityka prywatności

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.