home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 5 / DATAFILE_PDCD5.iso / utilities / _ / 3deditor / !3DEditor / Modules / Object / Module (.txt) next >
RISC OS BBC BASIC V Source  |  1994-01-07  |  6KB  |  191 lines

  1.  Object Placer/Editor
  2. 0,"To use this module run the !3DEditor application"
  3. object_info
  4. /ModulePurpose$="Object control and placing"
  5. #ModuleAuthor$="Simon Wilkinson"
  6. object_closed(win%):=0
  7. object_priority:=49
  8. object_initialise(data%)
  9. PutStr(data%,"object1")
  10. !data%=0
  11. data%+=4
  12. Z="-type creator -items 1 -windows -menus -variables -version 1.06 -atleast 2.04 -info"
  13. object_toolclick(tool$,num%)
  14. object_start
  15. Window_NewYbox(Object_Ybox%,
  16. object_toolend(tool$,num%)
  17. Window_LooseYbox(Object_Ybox%)
  18. object_windows(
  19. IndrPos%,task%)
  20. AObject_Ybox%=
  21. Window_CreateYbox("ybox",IndrPos%,Block%,task%)
  22. Block%!0=20:Block%!4=1
  23. Block%!8=19:Block%!12=2
  24. Block%!16=-1
  25. Window_ActiveIcon(Object_Ybox%,Block%)
  26. Window_Writeable(Object_Ybox%,19,19,255)
  27. object_menus(task%)
  28. Menu_BuildAlterable("ObList","Objects",12,1024)
  29. Menu_BuildMenu("Object","Object",12)
  30. Menu_AddSubMenu("Main","Object","Object",0,MenuNormal%)
  31. Menu_AddItem("Object",task%,1,"Make root",-1,0,MenuNormal%)
  32. Menu_AddSubMenu("Object","Edit","ObList",0,MenuNormal%)
  33. Menu_AddItem("ObList",0,0,"dummy",-1,0,0)
  34. object_menuwarning
  35. ObjectFrom%=0
  36. object_buildmenu(CurrentTask%,
  37. object_variables
  38. Obj_Xstep%=50
  39. Obj_Ystep%=50
  40. Obj_Zstep%=50
  41. Object_Created%=1
  42. object_click(win%,icon%,x%,y%,button%)
  43. d%,dum%
  44. Object_Ybox%
  45. Object_Op%
  46. 9Oup%=
  47. Window_ClickYbox(win%,icon%,d%,d%,d%,Obj_Xstep%,Obj_Ystep%,Obj_Zstep%)
  48. ;[up%=
  49. Window_ClickYbox(win%,icon%,Obj_X%,Obj_Y%,Obj_Z%,Obj_Xstep%,Obj_Ystep%,Obj_Zstep%)
  50. Object_UpdatePos(CurrentObj%,Selected%,Obj_X%,Obj_Y%,Obj_Z%,0,0,0,0,0,0,%100)
  51. Display_RedrawItem(CurrentObj%,Selected%)
  52. Display_UpdateItem(Selected%)
  53. Icon_UpText(Object_Ybox%,17,"("+
  54. Obj_X%+","+
  55. Obj_Y%+","+
  56. Obj_Z%+")")
  57. Icon_Redraw(Object_Ybox%,17)
  58. icon%
  59. Window_Coord("Enter coordinates",Obj_X%,Obj_Y%,Obj_Z%,win%,1)
  60. ObjectFrom%=1
  61. object_buildmenu(ToolTask%,
  62. Menu_OpenIcon(Object_Ybox%,20,"ObList")
  63. MyObject%=-1
  64. Object_EditObject(
  65. Object_NewObject(
  66. Icon_Read(Object_Ybox%,19)))
  67. Object_Created%+=1
  68. Object_EditObject(MyObject%)
  69. object_updateybox(CurrentObj%)
  70. Wimp_LoseCaret
  71. Object_PlaceObject(CurrentObj%,dum%,MyObject%,0,0,0,0,0,0,1,1,1)
  72. Selected%=dum%
  73. Select_Type%=3
  74. Display_RedrawAll
  75. Obj_X%=0:Obj_Y%=0:Obj_Z%=0
  76. Icon_UpText(Object_Ybox%,17,"(0,0,0)")
  77. Icon_GreyOut(Object_Ybox%,17,0)
  78. Icon_Redraw(Object_Ybox%,17)
  79. Object_Op%=1
  80. Wimp_LoseCaret
  81. MyObject%<>-1
  82. Object_UpdateName(MyObject%,
  83. Icon_Read(Object_Ybox%,19))
  84. MyObject%=-1
  85. Object_EditObject(
  86. Object_NewObject(
  87. Icon_Read(Object_Ybox%,19)))
  88. Object_Created%+=1
  89. object_updateybox(CurrentObj%)
  90. object_menuselect(name$,num%)
  91. name$
  92. "Object"
  93. Wimp_Naughty(
  94. num%)
  95. object_makeroot
  96. "ObList"
  97. ObjectFrom%=1
  98. object_updateybox(num%-2)
  99. Wimp_LoseCaret
  100. num%<>CurrentObj%
  101.  ObjectFrom%=0
  102. Tool_Clear
  103. CurrentObj%=num%
  104. Selected%=-1
  105. SelectType%=-1
  106. Display_RedrawAll
  107. Display_Update
  108. Window_UpdateTitle
  109. object_coords(num%,x%,y%,z%)
  110. Obj_Xstep%=x%
  111. Obj_Ystep%=y%
  112. Obj_Zstep%=z%
  113. Icon_UpText(Object_Ybox%,11,"("+
  114. Obj_Xstep%+","+
  115. Obj_Ystep%+","+
  116. Obj_Zstep%+")")
  117. Icon_Redraw(Object_Ybox%,11)
  118. Obj_X%=x%
  119. Obj_Y%=y%
  120. Obj_Z%=z%
  121. Object_UpdatePos(CurrentObj%,Selected%,Obj_X%,Obj_Y%,Obj_Z%,0,0,0,0,0,0,%100)
  122. Display_RedrawItem(CurrentObj%,Selected%)
  123. Display_UpdateItem(Selected%)
  124. Icon_UpText(Object_Ybox%,17,"("+
  125. Obj_X%+","+
  126. Obj_Y%+","+
  127. Obj_Z%+")")
  128. Icon_Redraw(Object_Ybox%,17)
  129. object_start
  130. object_updateybox(-2)
  131. object_updateybox(obj%)
  132. reply%
  133. Icon_GreyOut(Object_Ybox%,21,0)
  134. Icon_GreyOut(Object_Ybox%,22,1)
  135. Icon_UpText(Object_Ybox%,21,"Create")
  136. Icon_Redraw(Object_Ybox%,21)
  137. Icon_UpText(Object_Ybox%,19,"Untitled"+
  138. Object_Created%)
  139. Icon_Redraw(Object_Ybox%,19)
  140. MyObject%=-1
  141. Object_Op%=0
  142. MyObject%=0
  143. Wimp_Naughty("You cannot delete the root object")
  144. reply%=
  145. Wimp_Error(2,"Warning from 3D Editor","Are you sure that you want to delete the object '"+$((MyObject%)*16+ObjectList%+5)+"'","Cancel","Delete","")
  146. reply%=2
  147. Object_DeleteObject(MyObject%)
  148. CurrentObj%=MyObject%
  149. Object_EditObject(CurrentObj%-1)
  150. MyObject%-=1
  151. object_updateybox(MyObject%)
  152. Icon_GreyOut(Object_Ybox%,22,0)
  153. Icon_UpText(Object_Ybox%,21,"Edit")
  154. Icon_Redraw(Object_Ybox%,21)
  155. Icon_UpText(Object_Ybox%,19,$((obj%)*16+ObjectList%+5))
  156. Icon_Redraw(Object_Ybox%,19)
  157. Icon_GreyOut(Object_Ybox%,22,0)
  158. MyObject%=obj%
  159. Object_Op%=0
  160. Icon_GreyOut(Object_Ybox%,17,1)
  161. Icon_UpText(Object_Ybox%,17,"Unplaced")
  162. obj%=CurrentObj%
  163. Icon_GreyOut(Object_Ybox%,22,1)
  164. Icon_GreyOut(Object_Ybox%,21,1)
  165. object_buildmenu(task%,flag%)
  166. loop%,obj$,shading%,add%,ptr%
  167. Menu_Clear("ObList")
  168. flag%
  169. Menu_AddItem("ObList",task%,0,"New Object",-1,0,MenuNormal%)
  170. MyObject%<>-1
  171. shading%=MenuNormal%
  172. shading%=MenuShaded%
  173. Menu_AddItem("ObList",task%,1,"Delete Object",-1,MenuDot%,shading%)
  174. add%=2
  175. add%=0
  176. loop%=0
  177. Objects%-1
  178. ptr%=loop%*16+5
  179. obj$=$(ptr%+ObjectList%)
  180. Menu_AddItem("ObList",task%,loop%+add%,obj$,-1,0,MenuNormal%)
  181. loop%
  182. Menu_End("ObList")
  183. Menu_Tick("ObList",CurrentObj%+add%,1)
  184. object_makeroot
  185. dum%,loop%
  186. loop%=0
  187. dum%=ObjectList%!loop%
  188. 9ObjectList%!loop%=!(ObjectList%+CurrentObj%*16+loop%)
  189. ,!(ObjectList%+CurrentObj%*16+loop%)=dum%
  190. CurrentObj%=0
  191.