Difference between revisions of "ShipEditor"

From SfzWiki
Jump to: navigation, search
Line 8: Line 8:
 
// TODO : Research : Multiple Inheritance : Con-/Destructor Calling and Order
 
// TODO : Research : Multiple Inheritance : Con-/Destructor Calling and Order
 
// TODO : Research : Multiple Inheritance : automatic casting ??? or static_cast<Type>(ptr)
 
// TODO : Research : Multiple Inheritance : automatic casting ??? or static_cast<Type>(ptr)
// TODO : Research : Trac : auto-generate tickers from doxygen TODOs
+
// TODO : Research : Trac : auto-generate tickets from doxygen TODOs
 
// TODO : Research : Exceptions  
 
// TODO : Research : Exceptions  
 
// TODO : Research : Decorator : editor for framecomponent
 
// 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 : Memento for Create/Destroy-Command
 
// Todo : Research : DesignPattern : Builder -> ComponentBuilder
 
// Todo : Research : DesignPattern : Builder -> ComponentBuilder
 
</nowiki></pre>
 
</nowiki></pre>
Line 35: Line 35:
  
 
<pre><nowiki>
 
<pre><nowiki>
Interface:iEditable
+
Interface:iEditable  
 
list<VertexPtr> listVertices();
 
list<VertexPtr> listVertices();
 
abstract void Move (Vec3 v);
 
abstract void Move (Vec3 v);
Line 47: Line 47:
 
Vec3 GetPivot ();
 
Vec3 GetPivot ();
 
</nowiki></pre>
 
</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
 +
position+rotation access -> coordinate conversion + align rotation.
 +
flags for lock vertices, lock pos/rot...
 +
cockpit is model with one designated side for docking,
 +
vertices cannot be changed, but position+rotation change is possible
 +
framecomponent does not need to use rotation, as the vertices are usualle freely movable
 +
when docked to cockpit, and moving the docked side, try to rotate/move the cockpit
 +
as closely as possible, then readjust vertices
 +
also otpional "lock form/vertices" for completed frame components (only rotate/position)
 +
-> behave similar to cockpit
 +
// visual feedback(side/edge/face hilighting, gizmos...) implemented in this class ??
 +
</nowiki></pre>
 +
  
 
<pre><nowiki>
 
<pre><nowiki>
Line 66: Line 88:
 
</nowiki></pre>
 
</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>
 
  
  
Line 118: Line 130:
 
EditComponentGroup
 
EditComponentGroup
 
// type of elements = EditComponent, use Component->GetEditComponent()
 
// type of elements = EditComponent, use Component->GetEditComponent()
 +
</nowiki></pre>
 +
 +
 +
<pre><nowiki>
 +
mousemode
 +
activate,deactivate,step,abort(by rightclick, activates parent if set)
 +
child-functions ??
 
</nowiki></pre>
 
</nowiki></pre>
  
Line 338: Line 357:
 
* system (starsystem) contains entities
 
* system (starsystem) contains entities
 
* entity has course, pos+vel or pos+orbit(center,elliptic-params)
 
* entity has course, pos+vel or pos+orbit(center,elliptic-params)
*
 

Revision as of 18:06, 17 November 2005

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 tickets from doxygen TODOs
// TODO : Research : Exceptions 
// TODO : Research : Decorator : editor for framecomponent
// TODO : Research : Python for Editor ?
// TODO : Research : DesignPattern : Memento 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		();
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
position+rotation access -> coordinate conversion + align rotation.
flags for lock vertices, lock pos/rot...
	cockpit is model with one designated side for docking,
		vertices cannot be changed, but position+rotation change is possible
	framecomponent does not need to use rotation, as the vertices are usualle freely movable
	when docked to cockpit, and moving the docked side, try to rotate/move the cockpit
		as closely as possible, then readjust vertices
	also otpional "lock form/vertices" for completed frame components (only rotate/position)
		-> behave similar to cockpit
// visual feedback(side/edge/face hilighting, gizmos...) implemented in this class ??


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


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()


mousemode
activate,deactivate,step,abort(by rightclick, activates parent if set)
child-functions ??


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)