ah got it, thanks for the quick explanation!
so without super i would call SetFloat in an endless loop, because it returns itself.
Best posts made by datamilch
-
RE: set only the value of a dialog gadget
-
how to track if the document has changed?
hi there,
i have a command plugin that is dependent on the state of the active document. so i want to track if the document has changed.
there seems to be no dedicated core message. so i tried the following. but it gives me "basedocument is not alive", which makes senes in a way. but how can i make it work?
class MyDialog( ... doc_old = None ... def CoreMessage(self, cid, msg): doc = c4d.documents.GetActiveDocument() if cid == c4d.EVMSG_CHANGE: if doc != self.doc_old: print ("doc changed") self.doc_old = doc
thanks,
sebastian
Latest posts made by datamilch
-
RE: Message from Object or Tag to CommandData/GeDialog Plugin
oh well ... tried option B) as planned.
a python tag tracks the dirty status of some objects and starts a c4d.SpecialEventAdd(). this is received as a core message in my dialog. but when i go looking for the dirty objects, they are not dirty anymore.
my workaround for now is, to have a str userdata on the pyhon tag. once the tag detects a dirty object, it writes its name into the str userdata. my dialog can then read the name of the object and find it. feels quite cumbersome but works for now.would there be a better/more hidden way to store the data?
-
Message from Object or Tag to CommandData/GeDialog Plugin
hi there,
i have a bunch of objects with userdata. then i have a GeDialog plugin with mostly the identical userdata. the dialog plugin is intended to control the objects from one common panel. but there might be cases, where the objects are adjusted direktly, so the dialog needs to be updated. i'm looking for a solution for this case.
A)
am i correct, the change of DIRTYFLAGS_DATA can not be tracked from GeDialog directly via the message system? i could only track things, that trigger a global event?
i suppose it could be done with a timer, that checks the doc/objects every few millyseconds, but that feels very unprecise.B)
with a python tag i can easily track the dirty status of objects, but from what i've read here, i can not send data (list of dirty objects) direkcly to the dialog/command plugin. i can just call my dialog and make it aware to look and find the dirty objects.C)
there also seems to be c4d.GePluginMessage() and PluginMessage(). but i never found a clear statement, which plugin types are supported. i never even got c4d.GePluginMessage() to return True, which made me doubt myself a bit.so i would try to go with option B).
any objections or completly different suggestions?
cheers sebastian -
RE: use thicken generator inside a python generator
hi @i_mazlov,
ok, good to know.
i also tried to insert the thicken generator into a temp_doc, activating the selections and executing passes. but that didn't work either. -
RE: MCOMMAND_SELECTALL and MCOMMAND_SELECTINVERSE not working?
@i_mazlov Thanks!
makes sens. seems i only used the forgiving commands until now.the code is run in a python generator. so by returning the object, it will be inserted into the scene.
-
MCOMMAND_SELECTALL and MCOMMAND_SELECTINVERSE not working?
hi there,
i was shifting around some selections and noticed that some modeling commands seem to have no effect.
MCOMMAND_SELECTALL
MCOMMAND_SELECTINVERSE
i realize i can use SelectAll on the BaseSelect. and i could surely build a loop, to invert the selection. but why are these commands there? they even return true, despite doing nothing.this is my code and a demo file:
import c4d doc: c4d.documents.BaseDocument op: c4d.BaseObject def main() -> c4d.BaseObject: obj = op[c4d.ID_USERDATA,1].GetClone() bs_points = obj.GetPointS() #bs_points.SelectAll( obj.GetPointCount()-1 ) # will select all points c4d.utils.SendModelingCommand( c4d.MCOMMAND_SELECTALL, [ obj ], c4d.MODELINGCOMMANDMODE_POINTSELECTION, doc=doc) # not working c4d.utils.SendModelingCommand( c4d.MCOMMAND_SELECTSHRINK, [ obj ], c4d.MODELINGCOMMANDMODE_POINTSELECTION, doc=doc) c4d.utils.SendModelingCommand( c4d.MCOMMAND_SELECTINVERSE, [ obj ], c4d.MODELINGCOMMANDMODE_POINTSELECTION, doc=doc) # not working bc = c4d.BaseContainer() bc[c4d.MDATA_CONVERTSELECTION_LEFT] = 0 # 0 = points bc[c4d.MDATA_CONVERTSELECTION_RIGHT] = 1 # 1 = edges bc[c4d.MDATA_CONVERTSELECTION_TOLERANT] = False # tolerant conversion res = c4d.utils.SendModelingCommand( c4d.MCOMMAND_CONVERTSELECTION, [ obj ], bc=bc, doc=doc) res = c4d.utils.SendModelingCommand( c4d.MCOMMAND_EDGE_TO_SPLINE, [ obj ], doc=doc) return obj
-
RE: use thicken generator inside a python generator
circumvented the problem by generating 3 thicken objects - one for each surface part (shell, start cap, end cap). then created selection tags and stitched everything together with a connector object.
-
use thicken generator inside a python generator
hi there,
the thicken generator object is a super cool and powerful tool. i'd like to use it inside of a python generator object, to create some more complex geometry. for this i need some of the selection options of the thicken generator. but activating e.g. 'shell' selection from within the python generator will mess up the output geometry of the thicken object and not generate any polygon selection tag. see attached c4d file.
after converting the python generator you have access to the built hierarchy and the generated thicken generator. when you select it and then try to activate some selection options ther will be no selection tags created. so it looks like something in the thicken generator is broken/uncomplete, when it is created within a python generator object.
is there any way to make this work, or is this a special case/limitation?def main() -> c4d.BaseObject: source_obj = c4d.BaseObject( 5170 ) source_obj[c4d.PRIM_CYLINDER_CAPS] = False thicken = c4d.BaseObject( 1060179 ) source_obj.InsertUnder( thicken ) thicken[c4d.SOLIDIFYGENERATOR_SELECTION_POLYGON_BOUNDARY] = 1 # does not create tag, will mess up (delete) geo of the selected polys return thicken
-
RE: issue with inserting fieldlayers in r2024
hi ilia @i_mazlov,
thaks for the advice about threading and the dummy document and the fishy part.I continued testing the last days and noticed that it seems to work, when i insert a clone of the fieldlayer.
-
issue with inserting fieldlayers in r2024
hi there,
I'm having a weird issue with fieldlayers in r2024.
I want to add a layer to a fieldlist. In r2023 it worked quite fine. Now I get a reference Error.
But when I print anything, the error is not raised.
In my example I use a python generator, but it seems to happen with a python tag, too.
Or am I using/inserting the fieldlayers wrong?cheers sebastian
python generator :
import c4d def main() -> c4d.BaseObject: obj = c4d.BaseObject(c4d.Ocube) res = c4d.utils.SendModelingCommand( c4d.MCOMMAND_MAKEEDITABLE, [obj], c4d.MODELINGCOMMANDMODE_ALL, doc = doc ) if not res: print("error") else: obj = res[0].GetClone() vertex_tag = obj.MakeVariableTag( c4d.Tvertexmap, len(obj.GetAllPoints()) ) vertex_tag.SetName( "vertex_highlight_reinforce" ) vertex_tag[c4d.ID_TAGFIELD_ENABLE] = 1 fields = vertex_tag[c4d.ID_TAGFIELDS] f_layer_1 = c4d.modules.mograph.FieldLayer( c4d.FLquantize ) fields.InsertLayer( f_layer_1 ) vertex_tag[c4d.ID_TAGFIELDS] = fields #print ("") # with print active, no error will be raised return obj
results in the following error:
ReferenceError: the object 'c4d.modules.mograph.FieldLayer' is not alive -
RE: Create folder in Volume Builder
hi @i_mazlov,
thanks for the answer. good to know about this status / limitation.
for my current case I found a solution without folders..