Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Old COFFEE scripts to be converted to Python, since COFFEE no more works in Cinema4D r20
//---------------------------------------------------------------------------------------------------------
// REALLY SIMPLE SCRIPTS WITH ONLY 2-3 LINES. This has to be easy to convert to Python (I hope...)
//---------------------------------------------------------------------------------------------------------
// Duplicate.CSC
CallCommand(100004820);
CallCommand(100004821);
//---------------------------------------------------------------------------------------------------------
// Editor_Renderer_OFF.CSC
CallCommand(100004781); // Editor Off
CallCommand(100004784); // Renderer Off
//---------------------------------------------------------------------------------------------------------
// Editor_Renderer_ON.CSC
CallCommand(100004780); // Editor On
CallCommand(100004783); // Renderer On
//---------------------------------------------------------------------------------------------------------
// Editor_Renderer_UNCHANGED.CSC
CallCommand(100004779); // Editor Unchanged
CallCommand(100004782); // Renderer Unchanged
//---------------------------------------------------------------------------------------------------------
// ToggleAxisBands.CSC
var doc = GetActiveDocument();
doc->GetActiveBaseDraw()#BASEDRAW_DISPLAYFILTER_HANDLEBANDS =
!doc->GetActiveBaseDraw()#BASEDRAW_DISPLAYFILTER_HANDLEBANDS;
//---------------------------------------------------------------------------------------------------------
// ToggleCameras.CSC
var doc = GetActiveDocument();
doc->GetActiveBaseDraw()#BASEDRAW_DISPLAYFILTER_CAMERA =
!doc->GetActiveBaseDraw()#BASEDRAW_DISPLAYFILTER_CAMERA;
//---------------------------------------------------------------------------------------------------------
// ToggleDeformers.CSC
var doc = GetActiveDocument();
doc->GetActiveBaseDraw()#BASEDRAW_DISPLAYFILTER_DEFORMER =
!doc->GetActiveBaseDraw()#BASEDRAW_DISPLAYFILTER_DEFORMER;
//---------------------------------------------------------------------------------------------------------
// ToggleGrid.CSC
var doc = GetActiveDocument();
doc->GetActiveBaseDraw()#BASEDRAW_DISPLAYFILTER_GRID =
!doc->GetActiveBaseDraw()#BASEDRAW_DISPLAYFILTER_GRID;
//---------------------------------------------------------------------------------------------------------
// ToggleNull.CSC
var doc = GetActiveDocument();
doc->GetActiveBaseDraw()#BASEDRAW_DISPLAYFILTER_NULL =
!doc->GetActiveBaseDraw()#BASEDRAW_DISPLAYFILTER_NULL;
//---------------------------------------------------------------------------------------------------------
// ToggleRenderSafe.CSC
var doc = GetActiveDocument();
doc->GetActiveBaseDraw()#BASEDRAW_DATA_SHOWSAFEFRAME =
!doc->GetActiveBaseDraw()#BASEDRAW_DATA_SHOWSAFEFRAME;
//---------------------------------------------------------------------------------------------------------
//ToggleSplines.CSC
var doc = GetActiveDocument();
doc->GetActiveBaseDraw()#BASEDRAW_DISPLAYFILTER_SPLINE =
!doc->GetActiveBaseDraw()#BASEDRAW_DISPLAYFILTER_SPLINE;
//---------------------------------------------------------------------------------------------------------
//ToggleWireframedSelected.CSC
var doc = GetActiveDocument();
doc->GetActiveBaseDraw()#BASEDRAW_DATA_WIREFRAMESELECTION =
!doc->GetActiveBaseDraw()#BASEDRAW_DATA_WIREFRAMESELECTION;
//---------------------------------------------------------------------------------------------------------
//ToggleWorldAxis.CSC
var doc = GetActiveDocument();
doc->GetActiveBaseDraw()#BASEDRAW_DISPLAYFILTER_WORLDAXIS =
!doc->GetActiveBaseDraw()#BASEDRAW_DISPLAYFILTER_WORLDAXIS;
//---------------------------------------------------------------------------------------------------------
// SUPER-USEFUL SCRIPT: Creates an instance for all selected objects with a simple shortcut (“i”)
//---------------------------------------------------------------------------------------------------------
// InstanceSelected.CSC
GNHO(obj, stopAt)
{
if (!obj) return NULL;
var next;
if (next = obj->GetDown()) return next;
if (next = obj->GetNext()) return next;
var up = obj;
while (up = up->GetUp())
{
if (up == stopAt) return NULL;
if (next = up->GetNext()) return next;
}
}
main(doc,op)
{
doc->StartUndo();
var temp = doc->GetFirstObject();
while(temp)
{
if(temp->GetBit(BIT_AOBJ)==1)
{
var instance = AllocObject(5126);
instance ->SetName(stradd(temp->GetName(),"_Instance"));
instance#INSTANCEOBJECT_LINK=temp;
instance->InsertBefore(temp);
doc->AddUndo(UNDO_OBJECT_NEW, instance);
doc->AddUndo(BIT_AOBJ, instance);
instance->SetBit(BIT_AOBJ);
doc->AddUndo(BIT_AOBJ, temp);
temp->DelBit(BIT_AOBJ);
instance->SetMg(temp->GetMg());
}
temp=GNHO(temp,NULL);
}
doc->EndUndo();
//---------------------------------------------------------------------------------------------------------
// SUPER-USEFUL SCRIPT: to toggle between editor and and linked cameras in stage object
//---------------------------------------------------------------------------------------------------------
// CamSwitch.CSC
// CamSwitch V1 B.Horgan 2010 - works with Stage Object to toggle between editor and and linked cameras in stage object
// (just switches the stage on and off and refreshes the view )
// NB - rename the Stage Object to 'CamSwitch' for the script to work
var switcher,state;
switcher=doc->FindObject("CamSwitch");//Find the Stage object (searching by name)
if(switcher)//if the stage object exists -
{
state = switcher#ID_BASEOBJECT_GENERATOR_FLAG;
if (state==0)
{
switcher#ID_BASEOBJECT_GENERATOR_FLAG=1;
CallCommand(12147);//redraw view to activate linked camera in Stage Object
}
else
{
switcher#ID_BASEOBJECT_GENERATOR_FLAG=0;
CallCommand(12202); // Switch to the editor camera
}
}
}
//---------------------------------------------------------------------------------------------------------
// TO BE SINCERE I DON'T EVEN REMEMBER FOR WHAT IS THIS? “Toggle Modeling Axis” (forget, I don't use it...)
//---------------------------------------------------------------------------------------------------------
// Toggle Modeling Axis.CSC
var t = doc->GetActiveTool();
if(t#MDATA_AXIS_MODE == 8) {
t#MDATA_AXIS_MODE = 2;
t#MDATA_AXIS_FREE = FALSE; // turn on retain changes
} else {
t#MDATA_AXIS_MODE = 8; // switch to free mode
t#MDATA_AXIS_FREE = TRUE; // turn off retain changes
}
@ilias1512

This comment has been minimized.

Copy link

@ilias1512 ilias1512 commented May 17, 2019

$(document).ready ->
razmessage()
$('#all_items').change ->
if @checked
$('.checkSingle').each ->
@checked = true
return
$('#ifchecked').val 'yes'
else
$('.checkSingle').each ->
@checked = false
return
$('#ifchecked').val 'no'
return
$('.checkSingle').click ->
if $(this).is(':checked')
isAllChecked = 0
$('.checkSingle').each ->
if !@checked
isAllChecked = 1
return
if isAllChecked == 0
$('#all_items').prop 'checked', true
$('#ifchecked').val 'yes'
else
$('#all_items').prop 'checked', false
legchecked = $('input[class^=checkSingle]:checked').length
if legchecked == 0
$('#ifchecked').val 'no'
return
return

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.