Difference between revisions of "ShipEditor"
From SfzWiki
								
												
				Ghoulsblade  (Talk | contribs)  | 
				Ghoulsblade  (Talk | contribs)   | 
				||
| Line 10: | Line 10: | ||
// TODO : Research : Trac : auto-generate tickers from doxygen TODOs  | // TODO : Research : Trac : auto-generate tickers from doxygen TODOs  | ||
// TODO : Research : Exceptions    | // TODO : Research : Exceptions    | ||
| + | // TODO : Research : Decorator : editor for framecomponent  | ||
// TODO : Research : Python for Editor ?  | // TODO : Research : Python for Editor ?  | ||
// TODO : Research : DesignPattern : Mnemonic/InnerState for Create/Destroy-Command  | // TODO : Research : DesignPattern : Mnemonic/InnerState for Create/Destroy-Command  | ||
| Line 16: | Line 17: | ||
<pre><nowiki>  | <pre><nowiki>  | ||
| − | Interface:  | + | Interface:iSmartPointable  | 
| − | list<  | + | list<SmartPtr>  | 
// Destructor calls NotifyDestroy() of all pointers (ListenerPattern)  | // Destructor calls NotifyDestroy() of all pointers (ListenerPattern)  | ||
| + | // could include changenotifyer for custom behavior/listener  | ||
| − | + | Interface:iSmartPtrListener  | |
| − | iPointable  | + | void	NotifyDestroy	(); // DesignPattern:Listener  | 
| + | |||
| + | SmartPtr<Type>  | ||
| + | iPointable* target;  | ||
| + | iSmartPtrListener* listener; // passed to constructor  | ||
Type operator * ()  | Type operator * ()  | ||
Type operator -> ()  | Type operator -> ()  | ||
| Line 44: | Line 50: | ||
<pre><nowiki>  | <pre><nowiki>  | ||
Component  | Component  | ||
| − | + | SmartPtr<Component> parent; // frame:group,maschine:frame,...  | |
| + | position,rotation  | ||
| + | GetBounds()  | ||
| + | GenBluePrint(tex,axis,offset,scale,colors)  | ||
| + | Cast2Group()  | ||
| + | Cast2Frame()  | ||
| + | ComponentType*	type;  | ||
| + | // emissions for sensors....  | ||
| + | // blueprint status display : functionality and damage  | ||
| + | NotifyDamage(); // Section (groupname) has been hit..  | ||
| + | GetDescription();  | ||
| + | // also baseclass for inner-maschinery etc...  | ||
| + | // coordinate translation ! (rotation)  | ||
| + | //intersection,inclusion-calc  | ||
| + | </nowiki></pre>  | ||
| + | |||
| + | <pre><nowiki>  | ||
| + | interface:iMeshLike  : iEditable  | ||
| + | list	GetLinkedSides(SideNum);  | ||
| + | list	GetLinkedVertices(VertexNum);  | ||
| + | list	GetLinkedEdges(EdgeNum);  | ||
| + | list	GetSideVertices(SideNum);  | ||
| + | list	GetEdgeVertices(EdgeNum);  | ||
| + | vertex,side,edge enumeration and access  | ||
| + | editable functions  | ||
| + | </nowiki></pre>  | ||
| + | |||
| + | |||
| + | <pre><nowiki>  | ||
| + | FrameComponent : iMeshLike  | ||
list<Vec3>		top;  | list<Vec3>		top;  | ||
list<Vec3>		bot;  | list<Vec3>		bot;  | ||
int				flags;  | int				flags;  | ||
| − | |||
| − | |||
EditComponent	GetEditComponent	(); // null or overridden  | EditComponent	GetEditComponent	(); // null or overridden  | ||
| + | </nowiki></pre>  | ||
| + | |||
| + | |||
| + | <pre><nowiki>  | ||
| + | ModuleComponent : iMeshLike  | ||
| + | list<list<Vec3>>	sides;  | ||
| + | // throws exceptions on illegal edit  | ||
| + | // cockpit, solarpanel...  | ||
</nowiki></pre>  | </nowiki></pre>  | ||
| Line 60: | Line 101: | ||
<pre><nowiki>  | <pre><nowiki>  | ||
EditComponent  | EditComponent  | ||
| − | // lists for selected vertices,edges,sides and whole   | + | // lists for selected vertices,edges,sides and whole FrameComponent  | 
</nowiki></pre>  | </nowiki></pre>  | ||
| Line 92: | Line 133: | ||
<graph>digraph G {    | <graph>digraph G {    | ||
| − | + | FrameComponent -> { Inner, Hull };  | |
ComponentBuilder -> Component;  | ComponentBuilder -> Component;  | ||
}</graph>  | }</graph>  | ||
| − | |||
<graph>digraph G {    | <graph>digraph G {    | ||
| − | Component;  | + | FrameComponent -> Component;  | 
GameComponent -> Component;  | GameComponent -> Component;  | ||
| − | + | GameFrameComponent -> FrameComponent;  | |
| + | EditFrameComponent -> {FrameComponent,iEditable};  | ||
Selection -> iEditable;  | Selection -> iEditable;  | ||
| − | |||
ComponentGroup -> Component;  | ComponentGroup -> Component;  | ||
| Line 113: | Line 153: | ||
| + | |||
| + | === Intuitive Behavior ===  | ||
| + | |||
| + | * esc,rightclick : cancel mousemode  | ||
| + | * backspace=back_to_parent, return=show_detail  | ||
| + | * remove(delete) : kill/remove/collapse selected  | ||
| + | |||
| + | === StackTracer/Profile ===  | ||
| + | |||
| + | * see sfz-wiki : std:uncaught_exception()  | ||
| + | * macro : can be declared empty for release-compile  | ||
| + | * macro at beginning of function  | ||
| + | * creates object, which runs out of scope as the function exits -> exception-safe  | ||
| + | * pass "path"("cBaseClass::MyMethod"),file,line to constructor  | ||
| + | * use (const char*)path pointer instead of string compare  | ||
| + | * profile : measure time from constructor to destructor  | ||
| + | |||
| + | === Custom-Assert ===  | ||
| + | |||
| + | * keep gui intact if possible  | ||
| + | * write report to file  | ||
| + | * print stacktrace  | ||
| + | * offer options : ignore,abort,debug,throw-exception  | ||
| + | |||
| + | === Linking ===  | ||
| + | |||
| + | * Link Sides from different components  | ||
| + | * throw exception when trying to move/scale/rotate link when locked  | ||
| + | * throw exception when trying to change form of link when locked  | ||
| + | |||
| + | === Locking ===  | ||
| + | |||
| + | * lock form(edge-count,connections,NOT SIZE/POS), size(rotate allowed ??), position  | ||
| + | * beware of linking !  | ||
| + | |||
| + | === Face/Edge/Vertex Indexing ===  | ||
| + | |||
| + | * prism based -> use positive for top, negative for bottom  | ||
| + | * keep numbering if possible if only one half is changed  | ||
| + | * smartptr-change notify usage ? (integrated listener pattern)  | ||
| + | |||
| + | === Symetry ===  | ||
| + | |||
| + | * operates on list<component/sides/edges>:mutli-selection?, keeps binding, operator Source.  | ||
| + | * mirror-plane + center-merger-plane gizmo :  <[]> <[I]>  | ||
=== Editing ===  | === Editing ===  | ||
| Line 119: | Line 204: | ||
* Uses Mnemonic/Inner State Pattern for Create/Destroy  | * Uses Mnemonic/Inner State Pattern for Create/Destroy  | ||
* Python Support ??  | * Python Support ??  | ||
| − | * Commands bindable to Buttons, MenuItems, Right-Click Menu....  | + | * Commands bindable to Buttons, Keys/KeyCombos, MenuItems, Right-Click Menu....  | 
=== Move,Scale,Rotate ===  | === Move,Scale,Rotate ===  | ||
| Line 139: | Line 224: | ||
*types/smartpointers for vertex,edge,side  | *types/smartpointers for vertex,edge,side  | ||
*Selection managed as (named)list of those types  | *Selection managed as (named)list of those types  | ||
| − | *Selection depends on active "type" (vertex,edge,side,  | + | *Selection depends on active "type" (vertex,edge,side,FrameComponent,group), no mixing  | 
*select gizmo (rectangle)  | *select gizmo (rectangle)  | ||
*Toggle select on intersect or only on complete containment  | *Toggle select on intersect or only on complete containment  | ||
| Line 146: | Line 231: | ||
*undo for selection  | *undo for selection  | ||
*group select : when group is already selected, click selects subgroup  | *group select : when group is already selected, click selects subgroup  | ||
| − | + | *map<smartptr<comp>,list<num>>  | |
=== Picking ===  | === Picking ===  | ||
| Line 153: | Line 238: | ||
*named selection,    | *named selection,    | ||
*hierarchy list (groups)  | *hierarchy list (groups)  | ||
| − | *pick-by-click (current mode : vertex,edge,side,  | + | *pick-by-click (current mode : vertex,edge,side,FrameComponent,group)  | 
=== Tools ===  | === Tools ===  | ||
| Line 161: | Line 246: | ||
*Tools can "pick" current selection, named selection, groups, or pick-by-click    | *Tools can "pick" current selection, named selection, groups, or pick-by-click    | ||
| − | * Named Selections (depends on current mode (vertex,edge,side,  | + | * Grid Move Gizmo = Axis at left-top  | 
| − | * Mode Selection (vertex,edge,side,  | + | * Grid Centered on Origin, Center of Current Selection, or fixed point  | 
| + | * Grid x,y,z,off (toggle bindable to key)  | ||
| + | * Named Selections (depends on current mode (vertex,edge,side,FrameComponent,group)) + Select/Unselect/Show/Hide/Delete  | ||
| + | * Mode Selection (vertex,edge,side,FrameComponent,group)  | ||
* Tool Selection (Select,Move,Scale,Rotate,Extrude,Bevel,SpinExtrude,SpinBevel)  | * Tool Selection (Select,Move,Scale,Rotate,Extrude,Bevel,SpinExtrude,SpinBevel)  | ||
* Snap (Grid,Vertex,Edge,Face)  | * Snap (Grid,Vertex,Edge,Face)  | ||
| Line 173: | Line 261: | ||
	only for top/bottom, autoconvert if top/bottom <= 4  | 	only for top/bottom, autoconvert if top/bottom <= 4  | ||
* Later : Toggle select on intersect or only on complete containment  | * Later : Toggle select on intersect or only on complete containment  | ||
| − | * Later : QuickCut/Slice (  | + | * Later : QuickCut/Slice (FrameComponent, : DrawLine Gizmo  | 
* Later : Create Adapter : pick operand a,b  | * Later : Create Adapter : pick operand a,b  | ||
* Later : ExtrudeAroundEdge,TurnAroundEdge (pick edge + turn selection)  | * Later : ExtrudeAroundEdge,TurnAroundEdge (pick edge + turn selection)  | ||
* Later : SoftSelection (falloff:distance/adjactance,falloff:linear,cubic,curve,falloffdist)  | * Later : SoftSelection (falloff:distance/adjactance,falloff:linear,cubic,curve,falloffdist)  | ||
* Later : Dock : move 2 sides together and link them, pick base(not moved) and operand (modifyed)  | * Later : Dock : move 2 sides together and link them, pick base(not moved) and operand (modifyed)  | ||
| − | * Later : Constraints/Links + LockSize (link 2 sides of different   | + | * Later : Constraints/Links + LockSize (link 2 sides of different FrameComponents, only move, not scale group)  | 
* Later : Prism-Based Subdivide (height/width)    | * Later : Prism-Based Subdivide (height/width)    | ||
* Later : Hide/Show Selection/All  | * Later : Hide/Show Selection/All  | ||
| Line 211: | Line 299: | ||
  -------  |   -------  | ||
  </nowiki></pre>  |   </nowiki></pre>  | ||
| + | |||
| + | |||
| + | |||
| + | === Blinking/Signal lights ===  | ||
| + | |||
| + | * position on hull, can have limied offset  | ||
| + | * choose color, frequency and offset  | ||
| + | |||
| + | === Sensors ===  | ||
| + | |||
| + | * Heat/Temperature, Radioactivity, Electricity, Mass, Radar(metal), Bio  | ||
| + | * spectrum analyzer : distinct materials  | ||
| + | * active scanning (radar, detailed materials, freight)  | ||
| + | * colors can be customized  | ||
| + | * hud element for active scanning : modus (off, manual ping, fade display, ping interval)  | ||
| + | * hud element for radar : 2 half-spheres (front and back) or single full sphere  | ||
| + | ** FOF-colors customizable, lines to center : distance...  | ||
| + | ** alternate : 2d-circle with orthogonal-lines indicating height  | ||
| + | |||
| + | === ComponentTypes ===  | ||
| + | |||
| + | * implement constraints by inheritance or decorator or callback...  | ||
| + | * factory for components ??   | ||
| + | ** (could be used to convert component-type if neccessary : steel-titan-frame)  | ||
| + | ** editable restraints  | ||
| + | |||
| + | === SampleComponents ===  | ||
| + | |||
| + | * Frame (different materials, eg steel,titan,...)  | ||
| + | * Cockpit/Bridge (different models)  | ||
| + | * Scalable Thruster/Engine  | ||
| + | * Scalable Solar Panel (rotatable?)  | ||
| + | * Mountable Thruster ( mount on wing, like jumbo-jet, can mount missile/rocket-launcher instead)  | ||
| + | |||
| + | === Naming Scheme ===  | ||
| + | * entity : ship,cargo-box,star,planet...  | ||
| + | * entity has components  | ||
| + | * system (starsystem) contains entities  | ||
| + | * entity has course, pos+vel or pos+orbit(center,elliptic-params)  | ||
| + | *  | ||
Revision as of 15:10, 16 November 2005
Contents
- 1 OLM
- 1.1 TODO
 - 1.2 Intuitive Behavior
 - 1.3 StackTracer/Profile
 - 1.4 Custom-Assert
 - 1.5 Linking
 - 1.6 Locking
 - 1.7 Face/Edge/Vertex Indexing
 - 1.8 Symetry
 - 1.9 Editing
 - 1.10 Move,Scale,Rotate
 - 1.11 Creation
 - 1.12 Selection
 - 1.13 Picking
 - 1.14 Tools
 - 1.15 Gizmos
 - 1.16 Click / Drag Handling
 - 1.17 Spawning/ObjectCreation
 - 1.18 Inclusion/Intersection Warning
 - 1.19 Blinking/Signal lights
 - 1.20 Sensors
 - 1.21 ComponentTypes
 - 1.22 SampleComponents
 - 1.23 Naming Scheme
 
 
OLM
- ObjectOriented-Lowpoly-Modeller
 - Prism Based -> enhanced Interior Detection and Mesh-Management
 
TODO
// TODO : NameSpace for Editor ? (or just for whole project) // TODO : Research : Multiple Inheritance : Con-/Destructor Calling and Order // TODO : Research : Multiple Inheritance : automatic casting ??? or static_cast<Type>(ptr) // TODO : Research : Trac : auto-generate tickers from doxygen TODOs // TODO : Research : Exceptions // TODO : Research : Decorator : editor for framecomponent // TODO : Research : Python for Editor ? // TODO : Research : DesignPattern : Mnemonic/InnerState for Create/Destroy-Command // Todo : Research : DesignPattern : Builder -> ComponentBuilder
Interface:iSmartPointable list<SmartPtr> // Destructor calls NotifyDestroy() of all pointers (ListenerPattern) // could include changenotifyer for custom behavior/listener Interface:iSmartPtrListener void NotifyDestroy (); // DesignPattern:Listener SmartPtr<Type> iPointable* target; iSmartPtrListener* listener; // passed to constructor Type operator * () Type operator -> () void NotifyDestroy (); // DesignPattern:Listener // TODO : Research : DesignPattern : SmartPointer
Interface:iEditable list<VertexPtr> listVertices(); abstract void Move (Vec3 v); abstract void Scale (Vec3 v,Vec3 o); abstract void Scale (Vec3 v); abstract void Rotate (Quaternion q,Vec3 o); abstract void Rotate (Quaternion q); Vec3 GetBoundsMin (); Vec3 GetBoundsMax (); Vec3 GetBoundsCenter (); Vec3 GetPivot ();
Component SmartPtr<Component> parent; // frame:group,maschine:frame,... position,rotation GetBounds() GenBluePrint(tex,axis,offset,scale,colors) Cast2Group() Cast2Frame() ComponentType* type; // emissions for sensors.... // blueprint status display : functionality and damage NotifyDamage(); // Section (groupname) has been hit.. GetDescription(); // also baseclass for inner-maschinery etc... // coordinate translation ! (rotation) //intersection,inclusion-calc
interface:iMeshLike : iEditable list GetLinkedSides(SideNum); list GetLinkedVertices(VertexNum); list GetLinkedEdges(EdgeNum); list GetSideVertices(SideNum); list GetEdgeVertices(EdgeNum); vertex,side,edge enumeration and access editable functions
FrameComponent : iMeshLike list<Vec3> top; list<Vec3> bot; int flags; EditComponent GetEditComponent (); // null or overridden
ModuleComponent : iMeshLike list<list<Vec3>> sides; // throws exceptions on illegal edit // cockpit, solarpanel...
ComponentType // SteelFrame,TitanFrame,Cockpit...
EditComponent // lists for selected vertices,edges,sides and whole FrameComponent
Selection // Selection != Group, as selection can be mutliple vertices/faces/lines...
ComponentGroup list<Component> elements;
EditComponentGroup // type of elements = EditComponent, use Component->GetEditComponent()
Gizmo bool MouseOver(Vec3 o,Vec3 v); // click+drag // TODO : Research : CEGUI click+drag handling
digraph G { 
Gizmo -> AxisGizmo -> { MoveGizmo, ScaleGizmo };
Gizmo -> RotateGizmo;
}
digraph G { 
FrameComponent -> { Inner, Hull };
ComponentBuilder -> Component;
}
digraph G { 
FrameComponent -> Component;
GameComponent -> Component;
GameFrameComponent -> FrameComponent;
EditFrameComponent -> {FrameComponent,iEditable};
Selection -> iEditable;
ComponentGroup -> Component;
EditComponentGroup -> {ComponentGroup,iEditable}
}
Intuitive Behavior
- esc,rightclick : cancel mousemode
 - backspace=back_to_parent, return=show_detail
 - remove(delete) : kill/remove/collapse selected
 
StackTracer/Profile
- see sfz-wiki : std:uncaught_exception()
 - macro : can be declared empty for release-compile
 - macro at beginning of function
 - creates object, which runs out of scope as the function exits -> exception-safe
 - pass "path"("cBaseClass::MyMethod"),file,line to constructor
 - use (const char*)path pointer instead of string compare
 - profile : measure time from constructor to destructor
 
Custom-Assert
- keep gui intact if possible
 - write report to file
 - print stacktrace
 - offer options : ignore,abort,debug,throw-exception
 
Linking
- Link Sides from different components
 - throw exception when trying to move/scale/rotate link when locked
 - throw exception when trying to change form of link when locked
 
Locking
- lock form(edge-count,connections,NOT SIZE/POS), size(rotate allowed ??), position
 - beware of linking !
 
Face/Edge/Vertex Indexing
- prism based -> use positive for top, negative for bottom
 - keep numbering if possible if only one half is changed
 - smartptr-change notify usage ? (integrated listener pattern)
 
Symetry
- operates on list<component/sides/edges>:mutli-selection?, keeps binding, operator Source.
 - mirror-plane + center-merger-plane gizmo : <[]> <[I]>
 
Editing
- All Operations use the Command Pattern, to support Undo/Redo
 - Uses Mnemonic/Inner State Pattern for Create/Destroy
 - Python Support ??
 - Commands bindable to Buttons, Keys/KeyCombos, MenuItems, Right-Click Menu....
 
Move,Scale,Rotate
- when Tool is active, show the apropriate gizmo in scene
 - gizmo acts on Current Selection (iEditable)
 - gizmo gives visual MouseOver feedback
 - support snapping
 
Creation
- CreateFrameComponent : Activates a Create-Mode :
 - click(first corner) + drag(2d base) + click(3d)
 - gizmo gives visual feedback during creation
 - support snapping
 
Selection
- types/smartpointers for vertex,edge,side
 - Selection managed as (named)list of those types
 - Selection depends on active "type" (vertex,edge,side,FrameComponent,group), no mixing
 - select gizmo (rectangle)
 - Toggle select on intersect or only on complete containment
 - manual selection with shift(add) and control(remove)
 - when selection from list, and last selection was manually altered, save last manual selection as named
 - undo for selection
 - group select : when group is already selected, click selects subgroup
 - map<smartptr<comp>,list<num>>
 
Picking
in popup :
- current selection,
 - named selection,
 - hierarchy list (groups)
 - pick-by-click (current mode : vertex,edge,side,FrameComponent,group)
 
Tools
- ToolPanel = view, Tool = model(singleton) -> model/view seperation, change-listener
 - Tool->CreatePanel()
 - Python Support ??
 - Tools can "pick" current selection, named selection, groups, or pick-by-click
 
- Grid Move Gizmo = Axis at left-top
 - Grid Centered on Origin, Center of Current Selection, or fixed point
 - Grid x,y,z,off (toggle bindable to key)
 - Named Selections (depends on current mode (vertex,edge,side,FrameComponent,group)) + Select/Unselect/Show/Hide/Delete
 - Mode Selection (vertex,edge,side,FrameComponent,group)
 - Tool Selection (Select,Move,Scale,Rotate,Extrude,Bevel,SpinExtrude,SpinBevel)
 - Snap (Grid,Vertex,Edge,Face)
 - AngleSnap (edit+on/off button + buttons for 20 30 40 45 60 90)
 - Name+Group / Ungroup
 - Hierarchy-List (also for popup)
 - Change Parent (opens hierarchy-list popup)
 - Later : Change Type (popup : for compatible types, eg titanframe -> steelframe ??)
 - Later : Change Side (point,line,3up,3down,square,penta,[x]:popup)
 
only for top/bottom, autoconvert if top/bottom <= 4
- Later : Toggle select on intersect or only on complete containment
 - Later : QuickCut/Slice (FrameComponent, : DrawLine Gizmo
 - Later : Create Adapter : pick operand a,b
 - Later : ExtrudeAroundEdge,TurnAroundEdge (pick edge + turn selection)
 - Later : SoftSelection (falloff:distance/adjactance,falloff:linear,cubic,curve,falloffdist)
 - Later : Dock : move 2 sides together and link them, pick base(not moved) and operand (modifyed)
 - Later : Constraints/Links + LockSize (link 2 sides of different FrameComponents, only move, not scale group)
 - Later : Prism-Based Subdivide (height/width)
 - Later : Hide/Show Selection/All
 
Gizmos
- scalable with +/-
 - mouseovereffekt, areas : axis,area-between
 
Click / Drag Handling
- TODO : Research : CEGUI
 
- Tool/Mode/Gizmo can activate "MouseMode", abort on esc,rightclick
 
and when another MouseMode is activated
Spawning/ObjectCreation
- MouseMode
 - Frame/Cockpit :
- click on side : extrude/bevel
 - click on empty : create in space/ on grid
 
 
Inclusion/Intersection Warning
- not possible for space ships, breaks interior-definition,
 
and enables cheating (ultra compact, multi-dimensional cargo bays)
--- /\X/\ / - \ -------
Blinking/Signal lights
- position on hull, can have limied offset
 - choose color, frequency and offset
 
Sensors
- Heat/Temperature, Radioactivity, Electricity, Mass, Radar(metal), Bio
 - spectrum analyzer : distinct materials
 - active scanning (radar, detailed materials, freight)
 - colors can be customized
 - hud element for active scanning : modus (off, manual ping, fade display, ping interval)
 -  hud element for radar : 2 half-spheres (front and back) or single full sphere
- FOF-colors customizable, lines to center : distance...
 - alternate : 2d-circle with orthogonal-lines indicating height
 
 
ComponentTypes
- implement constraints by inheritance or decorator or callback...
 -  factory for components ?? 
- (could be used to convert component-type if neccessary : steel-titan-frame)
 - editable restraints
 
 
SampleComponents
- Frame (different materials, eg steel,titan,...)
 - Cockpit/Bridge (different models)
 - Scalable Thruster/Engine
 - Scalable Solar Panel (rotatable?)
 - Mountable Thruster ( mount on wing, like jumbo-jet, can mount missile/rocket-launcher instead)
 
Naming Scheme
- entity : ship,cargo-box,star,planet...
 - entity has components
 - system (starsystem) contains entities
 - entity has course, pos+vel or pos+orbit(center,elliptic-params)