Class: ModraUp::Pages
- Inherits:
-
ModraUp::Entity
- Object
- ModraUp::Entity
- ModraUp::Pages
- Includes:
- Enumerable
Overview
The model's scene pages table. Obtain it from ModraUp::Model#pages. It includes Enumerable.
Class Method Summary # collapse
-
.add_frame_change_observer(observer) ⇒ Integer
Register a global ModraUp::FrameChangeObserver. The frameChange method is called when switching scenes.
-
.remove_frame_change_observer(id) ⇒ Boolean
Remove the observer by the id returned from ModraUp::Pages.add_frame_change_observer.
Instance Method Summary # collapse
-
#[] ⇒ ModraUp::Page, nil
Retrieve the scene by index or name. Return nil if none exists.
-
#add ⇒ ModraUp::Page
Add a new page using the current camera and layer visibility state, and select it. If the name is a duplicate, it will be renamed to avoid conflict. Omitting flags sets it to PAGE_USE_ALL.
-
#each ⇒ self, Enumerator
Iterate through the scene pages.
-
#erase(page) ⇒ Boolean
Delete a page.
-
#size ⇒ Integer
Number of scenes.
-
#parent ⇒ ModraUp::Model
The model it belongs to.
-
#selected_page ⇒ ModraUp::Page, nil
The currently selected page. Returns nil if no page is selected.
-
#selected_page=(page) ⇒ Boolean
Select the scene and apply its camera, shadows, and layer visibility immediately. No transition animation is played.
-
#add_observer(observer) ⇒ Boolean
Register a ModraUp::PagesObserver. Adding the same object a second time returns false.
-
#remove_observer(observer) ⇒ Boolean
Remove observers from the scene table.
-
#unique_name(base_name) ⇒ String
Generate a unique scene name based on the root name. If the name is already in use, append a number to it.
-
#slideshow_time ⇒ Float
Slide Show Total Time: Includes the seconds for transitions and holds of scenes that are included in the animation. If a scene's own time is negative, it defaults to the model's default time (ModraUp::Page#include_in_animation? / model.options["PageOptions"] / ["SlideshowOptions"]). If scene transitions are disabled, the transition time is counted as 0.
-
#show_frame_at(seconds) ⇒ Array(ModraUp::Page, Float), nil
Display the slide at the frame after seconds seconds: Select the scene at that moment and apply it. The camera position is set to the corresponding position from the previous scene to the current one (consistent with the easing during playback). The timeline is as follows: the first scene stays for the delay time, followed by each scene transitioning and then staying, and finally transitioning back to the start from the first scene, with a total length of #slideshow_time; scenes outside the range are ignored. Only scenes where ModraUp::Page#include_in_animation? returns true are considered.
-
#reorder(page, new_index) ⇒ nil
Move the scene to index new_index (starting at 0), keeping the selected scene unchanged.
Inherited from ModraUp::Entity
-
#typename ⇒ String
Type name (e.g., Face / Edge / Group).
-
#entityID ⇒ Integer
Entity ID within the current session: A small integer starting from 1 that increments and remains constant for the lifetime of the entity, unchanged by undo/redo operations. This ID is not preserved when saving the file; it will be renumbered upon reopening the model. For cross-session identification, use #persistent_id. Copied entities will receive new IDs.
-
#persistent_id ⇒ Integer
Number assigned with the model: A unique, incrementing small integer starting from 1 that persists across model saves and reloads, independent of #entityID. Copied entities receive new numbers, and deleted entities do not reuse their numbers. Edges, faces, vertices, curves, groups, component instances/definitions, dimensions, leader lines/points, section planes, materials, layers, layer folders, and drawing sheets have assigned numbers; all others (rings, EdgeUses, attribute dictionaries, line types, sets, etc.) return 0.
-
#model ⇒ ModraUp::Model
The model it belongs to.
-
#to_s ⇒ String
String form. Returns "#<Deleted Entity>” when the entity has been deleted.
-
#inspect ⇒ String
Same as #to_s.
-
#attribute_dictionaries ⇒ ModraUp::AttributeDictionaries, nil
Collection of attribute dictionaries. Returns nil (evaluates to false) if there are no dictionaries.
-
#attribute_dictionary(name) ⇒ ModraUp::AttributeDictionary, nil
Retrieve an attribute dictionary by name. If none exists, return nil; if create is true, create an empty dictionary. ModraUp::Loop / ModraUp::EdgeUse / ModraUp::Curve always return nil.
-
#valid? ⇒ Boolean
Returns true if the entity is valid, meaning it has not been deleted from the model. Revoked entities are false; even if new geometry is drawn occupying its original position, this object remains an invalid entity (still false). Repeating the action to restore it makes it valid again.
-
#deleted? ⇒ Boolean
Opposite of #valid?.
-
#set_attribute(dict_name, key, value) ⇒ Object
Write attribute values. Materials, groups, component instances, faces, and edges are supported. When dict_name and key are Symbols, they are converted to strings. The type of data written is the same type that will be read back.
-
#get_attribute(dict_name, key, default = nil) ⇒ Object
Read the attribute. If dict_name and key are Symbols, convert them to strings (similar to SketchUp). If the dictionary or key does not exist, return default. The return value type is the same as what is written by #set_attribute.
-
#delete_attribute(dict_name) ⇒ Boolean
Delete a key, or delete the entire dictionary when the key is omitted.
Class Method Details
Pages.add_frame_change_observer(observer) ⇒ Integer
Register a global ModraUp::FrameChangeObserver. The frameChange method is called when switching scenes. Returns an integer ID to be passed to ModraUp::Pages.remove_frame_change_observer.
Pages.remove_frame_change_observer(id) ⇒ Boolean
Remove the observer by the id returned from ModraUp::Pages.add_frame_change_observer.
Instance Method Details
pages[index] ⇒ ModraUp::Page, nilpages[name] ⇒ ModraUp::Page, nil
Retrieve the scene by index or name. Return nil if none exists.
pages.add ⇒ ModraUp::Pagepages.add(name) ⇒ ModraUp::Pagepages.add(name, flags) ⇒ ModraUp::Pagepages.add(name, flags, index) ⇒ ModraUp::Page
Add a new page using the current camera and layer visibility state, and select it. If the name is a duplicate, it will be renamed to avoid conflict. Omitting flags sets it to PAGE_USE_ALL.
pages.each {|page| ... } ⇒ selfpages.each ⇒ Enumerator
Iterate through the scene pages.
pages.erase(page) ⇒ Boolean
Delete a page.
pages.size ⇒ Integer
Number of scenes.
pages.parent ⇒ ModraUp::Model
The model it belongs to.
pages.selected_page ⇒ ModraUp::Page, nil
The currently selected page. Returns nil if no page is selected.
pages.selected_page=(page) ⇒ Boolean
Select the scene and apply its camera, shadows, and layer visibility immediately. No transition animation is played.
The camera read immediately after setting is the camera of that scene. The scene tag in the interface and ModraUp.send_action("pageNext:") update with the scene when model.options["PageOptions"] is set to play a transition in the view › animation.
pages.add_observer(observer) ⇒ Boolean
Register a ModraUp::PagesObserver. Adding the same object a second time returns false.
pages.remove_observer(observer) ⇒ Boolean
Remove observers from the scene table.
pages.unique_name(base_name) ⇒ String
Generate a unique scene name based on the root name. If the name is already in use, append a number to it.
pages.slideshow_time ⇒ Float
Slide Show Total Time: Includes the seconds for transitions and holds of scenes that are included in the animation. If a scene's own time is negative, it defaults to the model's default time (ModraUp::Page#include_in_animation? / model.options["PageOptions"] / ["SlideshowOptions"]). If scene transitions are disabled, the transition time is counted as 0.
pages.show_frame_at(seconds) ⇒ Array(ModraUp::Page, Float), nil
Display the slide at the frame after seconds seconds: Select the scene at that moment and apply it. The camera position is set to the corresponding position from the previous scene to the current one (consistent with the easing during playback). The timeline is as follows: the first scene stays for the delay time, followed by each scene transitioning and then staying, and finally transitioning back to the start from the first scene, with a total length of #slideshow_time; scenes outside the range are ignored. Only scenes where ModraUp::Page#include_in_animation? returns true are considered.
Return the displayed scene and the transition progress (0.0–1.0, 1.0 for staying). If no scenes are included in the animation, return nil. Trigger ModraUp::FrameChangeObserver#frameChange.
pages.reorder(page, new_index) ⇒ nil
Move the scene to index new_index (starting at 0), keeping the selected scene unchanged.