/Blended-Cities

a city builder for blender

Primary LanguagePython

Blended Cities for the new blender releases ( > 2.5 )
continuation of a procedural city project begun with 2.4x :
http://jerome.le.chat.free.fr/index.php/en/city-engine/documentation/introduction.html

2012/08/21
. quickly updated code for 2.63a bpy

2011/11/03
. hey I'm not john doe dear Im littleneo :) 
. added uv support for tile-mapping and test textures in \library\textures
methods are implemented for the buildings builder :
after 1st creation of a building configure the floor mat of it to use the texture for BGL mode or rendering
or load the tex in image editor, switch to multitexture mode then refresh
. corrected the mat * V thing for post 2.59
. removed dependencies to script_events, modal is now local as builtin module
(currently testing things about this..)

2011/08/23
new builder : building_lots (ported from 0.445 / b2.49)
. adapted 0.445 code responsible for splitting a perimeter into building lots as a builder
. it generates outlines along each perimeter of an outline.
. geo module : aligned(a,b,c), Angle(), parallel(), SegmentIntersect(a,b,c,d)
polyUnedge(), polyBool(), polyBool2(??),polyClean(), polyInter()
. perimeters verts of the outline need to be ordered ANTI-CLOCKWORK from top view for now,
like [ [0,0,z],[1,0,z],[1,1,z],[0,1,z] ]
. basic tests are ok most of the time : outline hierarchy system looks ok, can be generated from the sidewalk outline.
a lot to check/test and improve using the new api

2011/08/23
converting code from bc0.445
. geo module : area() perimeter()
. length cut function tests in geo_tests.py. used to spawn objects on a line or cut a perimeter into building lots
. building lots builder extract/conversion from 0.445 to bc 0.6 in /builders
. removed the outdated matslots argument from builders.

2011/08/22
group.stack() improvements
. grp.stack() : height offset now computed at object level, not mesh.
still faulty with rotated otl in object mode for now, and stacking over generated outlines (height offset error)
. multi stacks are ok
. generated or stacked outlines childs are updated again (according to the new concept I still need to document ;)
. moved 'stack' button to group tab in the outline ui
. improved city.list() and display() now lists childs outlines
. removed some of the outdated methods : otl.stack, otl.childsadd, city.elementStack
. added a concrete mat to sidewalks builder

2011/08/19
. corrected modal, remove objects, and remove objects and tags buttons
. corrected coordinates stuff : mixed advantages of local and global coords use for builders
. detach() keep the previous parent matrix. now equivalent to a 'clear parent/keep transformation'

2011/08/19
more methods. begun stack rewrite
. otl.objectAtttach()
. grp.replace() method
. grp.stack() method (1st step)

2011/08/17
important concept changes
. added a builder 'groups' collection. it points to every object generated by a builder, including outlines
. a group contains at least one builder/3d object. it can also contain several generated outlines. 
. several groups can be attached to one outline. relation ship is now otl <-> group <-> generated elements (bld/otl)
. the outline panel reflects these changes. also see console at creation time, and list elements button.
. added misc code about materials (very simple mat preset in the building builder file)
. this is transitional : broken methods (peer() is outdated), 'update childs' and object selector are disabled for example
I push because of the important changes in master branch.


2011/08/04
big update !! news bugs !!
. builder can requests object from external files (library. minimal. use the default object file from bc 2.49 asis)
. builder can build/append several library/parametric objects, ** including outlines ** :
  this means we've got a first implementation of outline influences (parent to childs outlines).
  to test : build a sidewalk, add a building on the generated outline, modify the sidewalk outline or change the width prop.
. added a weird parks builder for multi-object tests and debugs.
. added a network builder for outlines inheritance tests. not working. (an outlines that creates outlines)
. as a consequence elm.pointer returns one or several objects in a list.
. added 'objects' collection that stores instance of external objects
. added 'nones' collection to store an outline apart from a builder, without breaking elm methods
. added a bc_element field in collections, used to name elements in collection
. element methods use bc_collection for lookup, not names
. in Elements, renamed 'type' to 'collection' used for elm -> bld or otl lookup.
. splitted/created modules : geo, library, common.
. various new elm methods and mods of existing ones (_rem, _add, removeObject...)
. elementAdd() : if obj is already used as outline, will update it (removes the previous bld, add the new)
. bld.build() builder methods are now called from city.builders.build(bld)
. various bug : rescaling, childs location, gui, elements/object cleaning
...

2011/08/01
. dots and lines are now extracted from outlines. should be able to read any kind of meshes now.
. adapted buildings to use lines as wall or as facades
. debug about mats, shared vert in outline and sidewalks fill when more than one perimeter

2011/07/31
* a better class_import by der_On push on master branch
. class_import debug by littleneo. bugs were in main.py and register_builder().
inheritance thing was not the reason in fact, it's almost der_On code
. added sys module cleaning (restart unnecessary while modding addon)
. added a quick patch for sidewalk stacking and building inheritance

2011/07/30
. elm.remove(True) remove an element from collections, rebuild relationship. boolean True to remove the object too
. elm.stack('buildername') build a new 'buildername' above this. with no args, add the same builder than the parent
. elm.child() added child index argument elm.child(2) returns the third child
. city.elementGet() with no args returns now bld and otl of the active object
. consolidated city methods (list, add, stack, remove)
. add, stack and remove work now with several selected objects in a row
. added elm.Previous() elm.Parent()
. updated addon

2011/07/29
. element method elm.objectAttach() elm.objectDetach()
. city method city.list() city.build(), cleaning code, operator names
. added an example file about objects and elements
. added info ('how to use it') in DOCUMENTATION
* Merge branch 'local-coords' by der_On : local point of view, looks better since childs parts updates accordingly to parent transformations

2011/07/28
. appended scale mecanism : class_main.py dataGet/Set
and meshes_io buToMeters() and meters ToBu()
(see CITY MAIN SCALE in DOCUMENTATION)
. cleaned the buildings class (buildbox() now in build() )
. retested element remove / add, misc debug

2011/07/27
. outline and builder are now parented. outline and outline childs too.
. code cleaning. code splitting. needs litterature, more documentation
. improved function documentation.
. elements own outlines-only methods, this to have a cleaner code , like elm.childAdd() rather than elm.asOutline().childAdd() 
. appended 'bin' to 'core' mod by ondrej 
. first remove element feature, to check. cares about parenting in 'real world' too.
.. lot of stuff, but it's initial/test/concept time, still going with my machete in the jungle.

2011/07/26
. can be enabled by default. can be disabled without complaining. can reload the builders classes and submodules without restarting blender, if addons dependencies v0.3 is installed http://jerome.le.chat.free.fr/index.php/en/download/blender/addon-dependencies-download.html
with the normal addon utils tool, this can't be reenabled without restarting Blender utils since this one does not clean sys.modules : the BC_builders class is created at init time (exec code. stores the builders pointers that are gathered from the builders folder) and blender find it in its sys.module whereas it has not been created yet : it fails.
without the mod, RIGHT after having disabled the addon, one can copy this in a text block :

import sys
module_name = 'blended_cities'
for m in dict(sys.modules) :
    if module_name + '.' == m[0:len(module_name) +1 ] :
        print('\taddon_utils.removing %s child : %s'%(module_name,m[len(module_name) +1:]))
        del sys.modules[m]
try : del sys.modules[module_name]
except : pass

.. then run it. this should refresh the builders files and the other at the same occasion without restarting.

. uploaded the documentation here
http://jerome.le.chat.free.fr/projets/blendedCities25/documentation/internal/html/index.html
can be retrieved from github too but destined to collaborative updates.

2011/07/25
. internal documentation ( doxygen ) created /documentation/internal/html. begin to document internal code, cleaning, naming convention.
. debug. renamed some function : inElement -> asElement, inClass -> asBuilder, inOutlines -S asOutline
( naming convention isLikeThat to recognize BC functions from_the_bpy_ones )
. added a fake builder class, sidewalk (test purposes)
. added command examples in /documentation/internal/examples
. new builders modules moved in the builders should now append automatically at init. their name should appear in the Outlines panel, and their gui should be spawned if needed. building_class.py and its ui are references (I mean will be)
. parts moved from modules to another, still organizing things.
. some ui improvements

2011/07/24
. turned it as a module. first multifile split and organisation.

2011 june-july
. first test using blender 2.5, bpy classes first generated thing with it :)